disguise-ui 0.3.3 → 0.3.4
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./user-avatar-info-
|
|
1
|
+
import { t as e } from "./user-avatar-info-COmJGI9K.js";
|
|
2
2
|
import { computed as t, createBlock as n, defineComponent as r, openBlock as i } from "vue";
|
|
3
3
|
// src/components/table-entity/cells/avatar-cell.vue
|
|
4
4
|
var a = /* @__PURE__ */ r({
|
package/dist/disguise-ui.js
CHANGED
|
@@ -3,7 +3,7 @@ import { t as r } from "./modal-CHOpDVLd.js";
|
|
|
3
3
|
import { a as i, d as a, i as o, l as s, o as c, r as l, t as u, u as d } from "./i18n-D9LSb_U5.js";
|
|
4
4
|
import { t as f } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
5
5
|
import { t as p } from "./use-image-url-Df54pSFh.js";
|
|
6
|
-
import { t as m } from "./user-avatar-info-
|
|
6
|
+
import { t as m } from "./user-avatar-info-COmJGI9K.js";
|
|
7
7
|
import { t as h } from "./use-file-type-rNstoxXw.js";
|
|
8
8
|
import { t as g } from "./file-upload-n4pZizh3.js";
|
|
9
9
|
import { r as _ } from "./use-multiple-file-upload-CBOycBu3.js";
|
|
@@ -1545,7 +1545,7 @@ function gi(e, t = "name") {
|
|
|
1545
1545
|
}).filter(Boolean);
|
|
1546
1546
|
}
|
|
1547
1547
|
// src/components/table-entity/utils/column-slots.ts
|
|
1548
|
-
var _i = O(() => Promise.resolve().then(() => Zr)), vi = O(() => import("./picture-cell-C6BLbwEb.js").then((e) => e.n)), yi = O(() => import("./avatar-cell-
|
|
1548
|
+
var _i = O(() => Promise.resolve().then(() => Zr)), vi = O(() => import("./picture-cell-C6BLbwEb.js").then((e) => e.n)), yi = O(() => import("./avatar-cell-B9VByweR.js")), { resolveImageUrl: bi } = p();
|
|
1549
1549
|
function xi(e) {
|
|
1550
1550
|
return e == null || e === "" ? [] : (Array.isArray(e) ? e : typeof e == "string" ? e.split(",") : [e]).map((e) => e && typeof e == "object" ? e.fileUrl ?? e.url : e).map((e) => bi(e)).filter(Boolean);
|
|
1551
1551
|
}
|
|
@@ -50,10 +50,6 @@ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
|
50
50
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
51
51
|
openDrawer: typeof openDrawer;
|
|
52
52
|
closeDrawer: typeof closeDrawer;
|
|
53
|
-
remoteUser: import("vue").ComputedRef<Record<string, any> | undefined>;
|
|
54
|
-
remoteDetail: import("vue").ComputedRef<{
|
|
55
|
-
data?: Record<string, any>;
|
|
56
|
-
} | null>;
|
|
57
53
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
58
54
|
"update:drawerVisible": (value: boolean) => any;
|
|
59
55
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { n as e } from "./i18n-D9LSb_U5.js";
|
|
2
|
+
import { t } from "./use-image-url-Df54pSFh.js";
|
|
3
|
+
import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, markRaw as d, mergeModels as f, mergeProps as p, nextTick as ee, normalizeClass as m, openBlock as h, ref as g, renderList as te, renderSlot as _, resolveDynamicComponent as ne, toDisplayString as v, unref as y, useModel as re, useSlots as ie, watch as b, watchEffect as ae, withCtx as x } from "vue";
|
|
4
|
+
import { ElAvatar as S, ElDrawer as oe, ElTooltip as se } from "element-plus";
|
|
5
|
+
import { Badge as ce, Briefcase as le, Building2 as ue, Cake as de, CalendarDays as fe, Image as pe, Mail as me, Mars as C, Phone as he, User as ge, Venus as _e } from "lucide-vue-next";
|
|
6
|
+
// src/components/user-avatar-info/index.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var ve = { class: "inline-block max-w-full" }, ye = [
|
|
8
|
+
"role",
|
|
9
|
+
"tabindex",
|
|
10
|
+
"aria-label",
|
|
11
|
+
"aria-disabled"
|
|
12
|
+
], be = { class: "relative flex-shrink-0 w-fit" }, xe = { class: "overflow-hidden text-ellipsis text-[13px] font-medium whitespace-nowrap" }, Se = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "w-full min-w-0"
|
|
15
|
+
}, w = { class: "max-w-[min(90vw,360px)] text-[10px] leading-[1.45] break-words whitespace-normal" }, T = { class: "flex items-center w-full min-h-[24px] gap-3" }, E = { class: "flex-1 font-semibold text-gray-900" }, D = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "text-sm text-gray-900"
|
|
18
|
+
}, O = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "flex flex-col gap-5 pt-2.5"
|
|
21
|
+
}, k = { class: "relative z-[1] flex-shrink-0" }, A = { class: "relative z-[1] min-w-0 text-center sm:text-left" }, j = { class: "flex flex-col sm:flex-row items-center gap-3" }, Ce = { class: "text-xl font-semibold text-slate-800 tracking-wide" }, we = { class: "flex flex-wrap justify-center sm:justify-start gap-3 mt-2.5 text-[13px] text-slate-500" }, Te = {
|
|
22
|
+
key: 0,
|
|
23
|
+
class: "flex items-center px-2 py-0.5 font-mono bg-white/60 rounded-md"
|
|
24
|
+
}, Ee = {
|
|
25
|
+
key: 1,
|
|
26
|
+
class: "flex items-center"
|
|
27
|
+
}, De = { class: "grid grid-cols-1 sm:grid-cols-2 gap-4" }, Oe = { class: "flex flex-col gap-1 min-w-0" }, ke = { class: "text-xs text-slate-400" }, Ae = ["title"], M = /* @__PURE__ */ u({
|
|
28
|
+
__name: "index",
|
|
29
|
+
props: /*@__PURE__*/ f({
|
|
30
|
+
userId: { default: void 0 },
|
|
31
|
+
name: { default: void 0 },
|
|
32
|
+
subtitle: { default: "" },
|
|
33
|
+
src: {},
|
|
34
|
+
gender: { default: void 0 },
|
|
35
|
+
size: { default: 30 },
|
|
36
|
+
avatar: { default: void 0 },
|
|
37
|
+
drawerAvatarSize: { default: 64 },
|
|
38
|
+
age: { default: void 0 },
|
|
39
|
+
workYears: { default: void 0 },
|
|
40
|
+
email: { default: void 0 },
|
|
41
|
+
phone: { default: void 0 },
|
|
42
|
+
department: { default: void 0 },
|
|
43
|
+
jobLevel: { default: void 0 },
|
|
44
|
+
enableDrawer: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: !0
|
|
47
|
+
},
|
|
48
|
+
drawerTitle: { default: void 0 },
|
|
49
|
+
drawerSize: { default: "40%" },
|
|
50
|
+
drawerProps: { default: void 0 },
|
|
51
|
+
nickName: { default: "" },
|
|
52
|
+
deptName: { default: "" },
|
|
53
|
+
sex: { default: "" }
|
|
54
|
+
}, {
|
|
55
|
+
drawerVisible: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: !1
|
|
58
|
+
},
|
|
59
|
+
drawerVisibleModifiers: {}
|
|
60
|
+
}),
|
|
61
|
+
emits: ["update:drawerVisible"],
|
|
62
|
+
setup(u, { expose: f }) {
|
|
63
|
+
let M = u, { ensureImageBaseUrl: je, resolveImageUrl: Me } = t();
|
|
64
|
+
je();
|
|
65
|
+
let N = re(u, "drawerVisible"), P = g(!1);
|
|
66
|
+
b(N, (e) => {
|
|
67
|
+
e && (P.value = !0);
|
|
68
|
+
}, { immediate: !0 });
|
|
69
|
+
function Ne() {
|
|
70
|
+
P.value = !1;
|
|
71
|
+
}
|
|
72
|
+
let { t: F } = e(), Pe = ie(), I = r(() => M.nickName || M.name || ""), L = r(() => M.subtitle || M.deptName || ""), Fe = r(() => M.age), Ie = r(() => M.workYears), Le = r(() => M.jobLevel), Re = r(() => M.email), ze = r(() => M.phone), R = r(() => M.department || M.deptName || ""), z = r(() => M.nickName || M.name || ""), B = r(() => M.userId), Be = r(() => !!Pe.default), V = r(() => {
|
|
73
|
+
if (M.gender !== void 0 && M.gender !== null && M.gender !== "") return M.gender;
|
|
74
|
+
let e = M.sex;
|
|
75
|
+
return e === "0" ? "male" : e === "1" ? "female" : "unknown";
|
|
76
|
+
}), H = r(() => V.value), U = r(() => V.value === "female"), Ve = r(() => U.value ? "theme-female" : "theme-male"), He = r(() => ({
|
|
77
|
+
"!text-blue-600": V.value === "male",
|
|
78
|
+
"!text-pink-500": V.value === "female"
|
|
79
|
+
})), W = r(() => H.value === "male" ? F("components.userAvatarInfo.genderMale") : H.value === "female" ? F("components.userAvatarInfo.genderFemale") : F("components.userAvatarInfo.genderUnknown")), Ue = r(() => H.value === "male" || H.value === "female"), We = r(() => V.value === "male" || V.value === "female"), Ge = r(() => M.userId != null && String(M.userId) !== ""), Ke = r(() => !1), G = r(() => Math.max(10, Math.min(16, Math.round(M.size * .36)))), K = r(() => ({
|
|
80
|
+
...M.avatar,
|
|
81
|
+
size: M.size,
|
|
82
|
+
src: Me(M.src || "--"),
|
|
83
|
+
shape: "circle"
|
|
84
|
+
})), qe = r(() => M.drawerTitle ?? F("components.userAvatarInfo.drawerTitle")), q = {
|
|
85
|
+
avatar: d(pe),
|
|
86
|
+
name: d(ge),
|
|
87
|
+
gender: d(C),
|
|
88
|
+
age: d(de),
|
|
89
|
+
workYears: d(fe),
|
|
90
|
+
email: d(me),
|
|
91
|
+
phone: d(he),
|
|
92
|
+
department: d(ue),
|
|
93
|
+
jobLevel: d(ce),
|
|
94
|
+
position: d(le)
|
|
95
|
+
}, Je = r(() => [
|
|
96
|
+
{
|
|
97
|
+
key: "name",
|
|
98
|
+
label: F("components.userAvatarInfo.fieldName"),
|
|
99
|
+
icon: q.name,
|
|
100
|
+
value: z.value
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: "gender",
|
|
104
|
+
label: F("components.userAvatarInfo.fieldGender"),
|
|
105
|
+
icon: q.gender,
|
|
106
|
+
value: W.value
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: "age",
|
|
110
|
+
label: F("components.userAvatarInfo.fieldAge"),
|
|
111
|
+
icon: q.age,
|
|
112
|
+
value: Y(Fe.value)
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
key: "workYears",
|
|
116
|
+
label: F("components.userAvatarInfo.fieldWorkYears"),
|
|
117
|
+
icon: q.workYears,
|
|
118
|
+
value: Y(Ie.value)
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
key: "jobLevel",
|
|
122
|
+
label: F("components.userAvatarInfo.fieldJobLevel"),
|
|
123
|
+
icon: q.position,
|
|
124
|
+
value: Y(Le.value)
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
key: "phone",
|
|
128
|
+
label: F("components.userAvatarInfo.fieldPhone"),
|
|
129
|
+
icon: q.phone,
|
|
130
|
+
value: Y(ze.value)
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
key: "email",
|
|
134
|
+
label: F("components.userAvatarInfo.fieldEmail"),
|
|
135
|
+
icon: q.email,
|
|
136
|
+
value: Y(Re.value)
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
key: "department",
|
|
140
|
+
label: F("components.userAvatarInfo.fieldDepartment"),
|
|
141
|
+
icon: q.department,
|
|
142
|
+
value: Y(R.value)
|
|
143
|
+
}
|
|
144
|
+
]), Ye = r(() => ({
|
|
145
|
+
appendToBody: !0,
|
|
146
|
+
destroyOnClose: !1,
|
|
147
|
+
...M.drawerProps
|
|
148
|
+
})), J = r(() => M.enableDrawer ? `${F("components.userAvatarInfo.ariaLabel")}, ${F("components.userAvatarInfo.clickToViewDetail")}` : F("components.userAvatarInfo.ariaLabel"));
|
|
149
|
+
function Y(e) {
|
|
150
|
+
return e == null || e === "" ? F("components.userAvatarInfo.empty") : String(e);
|
|
151
|
+
}
|
|
152
|
+
let X = r(() => Y(R.value));
|
|
153
|
+
function Xe() {
|
|
154
|
+
M.enableDrawer && (N.value = !0);
|
|
155
|
+
}
|
|
156
|
+
function Ze(e) {
|
|
157
|
+
M.enableDrawer && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), N.value = !0);
|
|
158
|
+
}
|
|
159
|
+
let Z = g(null), Q = g(!1);
|
|
160
|
+
function $() {
|
|
161
|
+
let e = Z.value;
|
|
162
|
+
e ? Q.value = e.scrollWidth > e.clientWidth + 1 : Q.value = !1;
|
|
163
|
+
}
|
|
164
|
+
ae((e) => {
|
|
165
|
+
let t = Z.value;
|
|
166
|
+
if (!t || typeof ResizeObserver > "u") {
|
|
167
|
+
Q.value = !1;
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
$();
|
|
171
|
+
let n = new ResizeObserver(() => $());
|
|
172
|
+
n.observe(t), e(() => n.disconnect());
|
|
173
|
+
}), b(() => L.value, () => ee($));
|
|
174
|
+
function Qe() {
|
|
175
|
+
N.value = !0;
|
|
176
|
+
}
|
|
177
|
+
function $e() {
|
|
178
|
+
N.value = !1;
|
|
179
|
+
}
|
|
180
|
+
return f({
|
|
181
|
+
openDrawer: Qe,
|
|
182
|
+
closeDrawer: $e
|
|
183
|
+
}), (e, t) => (h(), o("div", ve, [s("div", {
|
|
184
|
+
class: m(["inline-flex items-center min-w-0 max-w-full gap-2 outline-none rounded-md", { "cursor-pointer focus-visible:ring-2 focus-visible:ring-blue-100": u.enableDrawer }]),
|
|
185
|
+
role: u.enableDrawer ? "button" : void 0,
|
|
186
|
+
tabindex: u.enableDrawer ? 0 : void 0,
|
|
187
|
+
"aria-label": J.value,
|
|
188
|
+
"aria-disabled": !u.enableDrawer,
|
|
189
|
+
onClick: Xe,
|
|
190
|
+
onKeydown: Ze
|
|
191
|
+
}, [s("div", be, [
|
|
192
|
+
l(y(S), p({ class: "inline-flex flex-shrink-0 items-center justify-center align-middle" }, K.value), {
|
|
193
|
+
default: x(() => [_(e.$slots, "avatar", {}, () => [c(v(I.value?.slice(0, 1)), 1)])]),
|
|
194
|
+
_: 3
|
|
195
|
+
}, 16),
|
|
196
|
+
We.value ? (h(), o("span", {
|
|
197
|
+
key: 0,
|
|
198
|
+
class: m(["absolute -top-0.5 -right-0.5 z-[1] box-border inline-flex items-center justify-center w-3 h-3 pointer-events-none rounded-full border-2 border-white bg-white", V.value === "male" ? "text-blue-600" : "text-pink-500"]),
|
|
199
|
+
"aria-hidden": "true"
|
|
200
|
+
}, [V.value === "male" ? (h(), i(y(C), {
|
|
201
|
+
key: 0,
|
|
202
|
+
size: G.value,
|
|
203
|
+
"stroke-width": 2.5
|
|
204
|
+
}, null, 8, ["size"])) : (h(), i(y(_e), {
|
|
205
|
+
key: 1,
|
|
206
|
+
size: G.value,
|
|
207
|
+
"stroke-width": 2.5
|
|
208
|
+
}, null, 8, ["size"]))], 2)) : a("", !0),
|
|
209
|
+
Ge.value ? (h(), o("span", {
|
|
210
|
+
key: 1,
|
|
211
|
+
class: m(["absolute right-0 bottom-0 z-[1] box-border w-2.5 h-2.5 pointer-events-none rounded-full border-2 border-white", Ke.value ? "bg-emerald-500" : "bg-gray-300"]),
|
|
212
|
+
"aria-hidden": "true"
|
|
213
|
+
}, null, 2)) : a("", !0)
|
|
214
|
+
]), s("div", { class: m(["flex flex-col flex-1 justify-center min-w-0 text-sm leading-[1.35]", He.value]) }, [s("div", xe, [_(e.$slots, "name", {}, () => [c(v(I.value), 1)])]), L.value || e.$slots.subtitle ? (h(), o("div", Se, [l(y(se), {
|
|
215
|
+
placement: "top",
|
|
216
|
+
disabled: !Q.value,
|
|
217
|
+
"show-after": 200,
|
|
218
|
+
"popper-class": "max-w-[min(90vw,380px)]"
|
|
219
|
+
}, {
|
|
220
|
+
content: x(() => [s("div", w, [_(e.$slots, "subtitle", {}, () => [c(v(L.value), 1)])])]),
|
|
221
|
+
default: x(() => [s("div", {
|
|
222
|
+
ref_key: "subtitleRef",
|
|
223
|
+
ref: Z,
|
|
224
|
+
class: m(["min-w-0 overflow-hidden text-ellipsis text-[10px] whitespace-nowrap", Q.value ? "cursor-help" : ""])
|
|
225
|
+
}, [_(e.$slots, "subtitle", {}, () => [c(v(L.value), 1)])], 2)]),
|
|
226
|
+
_: 3
|
|
227
|
+
}, 8, ["disabled"])])) : a("", !0)], 2)], 42, ye), P.value ? (h(), i(y(oe), p({
|
|
228
|
+
key: 0,
|
|
229
|
+
modelValue: N.value,
|
|
230
|
+
"onUpdate:modelValue": t[0] ||= (e) => N.value = e,
|
|
231
|
+
size: u.drawerSize,
|
|
232
|
+
class: ["user-avatar-info-drawer", Ve.value]
|
|
233
|
+
}, Ye.value, { onClosed: Ne }), {
|
|
234
|
+
header: x(() => [s("div", T, [s("span", E, v(qe.value), 1)])]),
|
|
235
|
+
default: x(() => [Be.value ? (h(), o("div", D, [_(e.$slots, "default")])) : (h(), o("div", O, [s("section", { class: m(["relative flex flex-col items-center sm:flex-row gap-5 min-h-[140px] p-6 overflow-hidden rounded-2xl shadow-[inset_0_1px_0_rgba(255,255,255,0.6)]", U.value ? "bg-gradient-to-br from-pink-50 to-rose-100" : "bg-gradient-to-br from-sky-50 to-indigo-100"]) }, [
|
|
236
|
+
t[1] ||= s("div", { class: "absolute top-[-50%] right-[-10%] w-[300px] h-[300px] bg-[radial-gradient(circle,rgba(255,255,255,0.8)_0%,rgba(255,255,255,0)_70%)] rounded-full pointer-events-none" }, null, -1),
|
|
237
|
+
s("div", k, [_(e.$slots, "drawer-avatar", {}, () => [l(y(S), {
|
|
238
|
+
size: M.drawerAvatarSize,
|
|
239
|
+
src: K.value.src,
|
|
240
|
+
class: m(["!text-[24px] !font-semibold !text-white !border-[3px] !border-white", U.value ? "!bg-gradient-to-br !from-pink-400 !to-rose-500 !shadow-[0_4px_12px_rgba(244,63,94,0.2)]" : "!bg-gradient-to-br !from-blue-400 !to-blue-500 !shadow-[0_4px_12px_rgba(59,130,246,0.2)]"])
|
|
241
|
+
}, {
|
|
242
|
+
default: x(() => [c(v(z.value?.slice(0, 1)), 1)]),
|
|
243
|
+
_: 1
|
|
244
|
+
}, 8, [
|
|
245
|
+
"size",
|
|
246
|
+
"src",
|
|
247
|
+
"class"
|
|
248
|
+
])])]),
|
|
249
|
+
s("div", A, [s("div", j, [_(e.$slots, "drawer-name", {}, () => [s("strong", Ce, v(z.value || "暂无姓名"), 1)]), Ue.value ? (h(), o("span", {
|
|
250
|
+
key: 0,
|
|
251
|
+
class: m(["px-2.5 py-0.5 text-xs font-medium leading-5 rounded-xl", U.value ? "text-pink-600 bg-pink-600/10" : "text-blue-600 bg-blue-600/10"])
|
|
252
|
+
}, v(W.value), 3)) : a("", !0)]), s("div", we, [B.value ? (h(), o("span", Te, v(y(F)("components.userAvatarInfo.fieldId")) + ": " + v(B.value), 1)) : a("", !0), X.value ? (h(), o("span", Ee, v(X.value), 1)) : a("", !0)])])
|
|
253
|
+
], 2), s("section", De, [(h(!0), o(n, null, te(Je.value, (e) => (h(), o("div", {
|
|
254
|
+
key: e.key,
|
|
255
|
+
class: "group flex items-center gap-4 min-w-0 p-4 sm:p-5 bg-white border border-slate-200/80 rounded-xl shadow-sm transition-all duration-200"
|
|
256
|
+
}, [s("div", { class: m(["flex flex-shrink-0 items-center justify-center w-10 h-10 rounded-[10px] transition-colors", U.value ? "text-pink-500 bg-pink-50 group-hover:bg-pink-100" : "text-blue-500 bg-blue-50 group-hover:bg-blue-100"]) }, [(h(), i(ne(e.icon), {
|
|
257
|
+
size: 18,
|
|
258
|
+
"stroke-width": 2
|
|
259
|
+
}))], 2), s("div", Oe, [s("div", ke, v(e.label), 1), s("div", {
|
|
260
|
+
class: "overflow-hidden text-ellipsis text-sm font-semibold text-slate-800 whitespace-nowrap",
|
|
261
|
+
title: e.value
|
|
262
|
+
}, v(e.value), 9, Ae)])]))), 128))])]))]),
|
|
263
|
+
_: 3
|
|
264
|
+
}, 16, [
|
|
265
|
+
"modelValue",
|
|
266
|
+
"size",
|
|
267
|
+
"class"
|
|
268
|
+
])) : a("", !0)]));
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
export { M as t };
|
package/package.json
CHANGED
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./i18n-D9LSb_U5.js";
|
|
2
|
-
import { t } from "./use-image-url-Df54pSFh.js";
|
|
3
|
-
import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, markRaw as d, mergeModels as f, mergeProps as p, nextTick as ee, normalizeClass as m, normalizeStyle as te, openBlock as h, ref as g, renderList as ne, renderSlot as _, resolveDynamicComponent as re, toDisplayString as v, unref as y, useModel as ie, useSlots as ae, watch as b, watchEffect as oe, withCtx as x } from "vue";
|
|
4
|
-
import { ElAvatar as S, ElDrawer as se, ElSkeleton as ce, ElSkeletonItem as C, ElTooltip as le } from "element-plus";
|
|
5
|
-
import { Badge as ue, Briefcase as de, Building2 as fe, Cake as pe, CalendarDays as me, Image as he, Mail as ge, Mars as w, Phone as _e, User as ve, Venus as ye } from "lucide-vue-next";
|
|
6
|
-
// src/components/user-avatar-info/index.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
-
var be = { class: "inline-block max-w-full" }, xe = {
|
|
8
|
-
key: 0,
|
|
9
|
-
class: "min-w-[120px]"
|
|
10
|
-
}, Se = { class: "flex items-center gap-2" }, Ce = { class: "flex flex-col flex-1 min-w-0 gap-2" }, T = [
|
|
11
|
-
"role",
|
|
12
|
-
"tabindex",
|
|
13
|
-
"aria-label",
|
|
14
|
-
"aria-disabled"
|
|
15
|
-
], E = { class: "relative flex-shrink-0 w-fit" }, D = { class: "overflow-hidden text-ellipsis text-[13px] font-medium whitespace-nowrap" }, O = {
|
|
16
|
-
key: 0,
|
|
17
|
-
class: "w-full min-w-0"
|
|
18
|
-
}, k = { class: "max-w-[min(90vw,360px)] text-[10px] leading-[1.45] break-words whitespace-normal" }, A = { class: "flex items-center w-full min-h-[24px] gap-3" }, we = { class: "flex-1 font-semibold text-gray-900" }, Te = {
|
|
19
|
-
key: 0,
|
|
20
|
-
class: "text-sm text-gray-900"
|
|
21
|
-
}, Ee = {
|
|
22
|
-
key: 1,
|
|
23
|
-
class: "flex flex-col gap-5 pt-2.5"
|
|
24
|
-
}, De = { class: "relative z-[1] flex-shrink-0" }, Oe = { class: "relative z-[1] min-w-0 text-center sm:text-left" }, ke = { class: "flex flex-col sm:flex-row items-center gap-3" }, Ae = { class: "text-xl font-semibold text-slate-800 tracking-wide" }, je = { class: "flex flex-wrap justify-center sm:justify-start gap-3 mt-2.5 text-[13px] text-slate-500" }, Me = {
|
|
25
|
-
key: 0,
|
|
26
|
-
class: "flex items-center px-2 py-0.5 font-mono bg-white/60 rounded-md"
|
|
27
|
-
}, Ne = {
|
|
28
|
-
key: 1,
|
|
29
|
-
class: "flex items-center"
|
|
30
|
-
}, Pe = { class: "grid grid-cols-1 sm:grid-cols-2 gap-4" }, Fe = { class: "flex flex-col gap-1 min-w-0" }, Ie = { class: "text-xs text-slate-400" }, Le = ["title"], j = /* @__PURE__ */ u({
|
|
31
|
-
__name: "index",
|
|
32
|
-
props: /*@__PURE__*/ f({
|
|
33
|
-
userId: { default: void 0 },
|
|
34
|
-
name: { default: void 0 },
|
|
35
|
-
subtitle: { default: "" },
|
|
36
|
-
src: {},
|
|
37
|
-
gender: { default: void 0 },
|
|
38
|
-
size: { default: 30 },
|
|
39
|
-
avatar: { default: void 0 },
|
|
40
|
-
drawerAvatarSize: { default: 64 },
|
|
41
|
-
age: { default: void 0 },
|
|
42
|
-
workYears: { default: void 0 },
|
|
43
|
-
email: { default: void 0 },
|
|
44
|
-
phone: { default: void 0 },
|
|
45
|
-
department: { default: void 0 },
|
|
46
|
-
jobLevel: { default: void 0 },
|
|
47
|
-
enableDrawer: {
|
|
48
|
-
type: Boolean,
|
|
49
|
-
default: !0
|
|
50
|
-
},
|
|
51
|
-
drawerTitle: { default: void 0 },
|
|
52
|
-
drawerSize: { default: "40%" },
|
|
53
|
-
drawerProps: { default: void 0 },
|
|
54
|
-
nickName: { default: "" },
|
|
55
|
-
deptName: { default: "" },
|
|
56
|
-
sex: { default: "" }
|
|
57
|
-
}, {
|
|
58
|
-
drawerVisible: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: !1
|
|
61
|
-
},
|
|
62
|
-
drawerVisibleModifiers: {}
|
|
63
|
-
}),
|
|
64
|
-
emits: ["update:drawerVisible"],
|
|
65
|
-
setup(u, { expose: f }) {
|
|
66
|
-
let j = u, { ensureImageBaseUrl: Re, resolveImageUrl: ze } = t();
|
|
67
|
-
Re();
|
|
68
|
-
let M = ie(u, "drawerVisible"), N = g(!1);
|
|
69
|
-
b(M, (e) => {
|
|
70
|
-
e && (N.value = !0);
|
|
71
|
-
}, { immediate: !0 });
|
|
72
|
-
function Be() {
|
|
73
|
-
N.value = !1;
|
|
74
|
-
}
|
|
75
|
-
let { t: P } = e(), Ve = ae(), F = r(() => null), I = r(() => F.value?.data), He = r(() => !1), Ue = r(() => !1), We = r(() => ({ isUserOnline: (e) => !1 })).value, Ge = r(() => He.value && Ue.value && !F.value), L = r(() => j.nickName || j.name || ""), R = r(() => j.subtitle || j.deptName || ""), Ke = r(() => j.age), qe = r(() => j.workYears), Je = r(() => j.jobLevel), z = r(() => I.value?.nickName ?? I.value?.userName ?? ""), B = r(() => I.value?.userId ?? j.userId), Ye = r(() => !!Ve.default), V = r(() => {
|
|
76
|
-
if (j.gender !== void 0 && j.gender !== null && j.gender !== "") return j.gender;
|
|
77
|
-
let e = j.sex;
|
|
78
|
-
return e === "0" ? "male" : e === "1" ? "female" : "unknown";
|
|
79
|
-
}), H = r(() => {
|
|
80
|
-
let e = I.value?.sex;
|
|
81
|
-
return e === "0" ? "male" : e === "1" ? "female" : "unknown";
|
|
82
|
-
}), U = r(() => (I.value?.sex ? H.value : V.value) === "female"), Xe = r(() => U.value ? "theme-female" : "theme-male"), Ze = r(() => ({
|
|
83
|
-
"!text-blue-600": V.value === "male",
|
|
84
|
-
"!text-pink-500": V.value === "female"
|
|
85
|
-
})), W = r(() => H.value === "male" ? P("components.userAvatarInfo.genderMale") : H.value === "female" ? P("components.userAvatarInfo.genderFemale") : P("components.userAvatarInfo.genderUnknown")), Qe = r(() => H.value === "male" || H.value === "female"), $e = r(() => V.value === "male" || V.value === "female"), et = r(() => j.userId != null && String(j.userId) !== ""), tt = r(() => We.isUserOnline(j.userId == null ? null : String(j.userId))), G = r(() => Math.max(10, Math.min(16, Math.round(j.size * .36)))), K = r(() => ({
|
|
86
|
-
...j.avatar,
|
|
87
|
-
size: j.size,
|
|
88
|
-
src: ze(j.src || "--"),
|
|
89
|
-
shape: "circle"
|
|
90
|
-
})), nt = r(() => j.drawerTitle ?? P("components.userAvatarInfo.drawerTitle")), q = {
|
|
91
|
-
avatar: d(he),
|
|
92
|
-
name: d(ve),
|
|
93
|
-
gender: d(w),
|
|
94
|
-
age: d(pe),
|
|
95
|
-
workYears: d(me),
|
|
96
|
-
email: d(ge),
|
|
97
|
-
phone: d(_e),
|
|
98
|
-
department: d(fe),
|
|
99
|
-
jobLevel: d(ue),
|
|
100
|
-
position: d(de)
|
|
101
|
-
}, J = r(() => [
|
|
102
|
-
{
|
|
103
|
-
key: "name",
|
|
104
|
-
label: P("components.userAvatarInfo.fieldName"),
|
|
105
|
-
icon: q.name,
|
|
106
|
-
value: z.value
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
key: "gender",
|
|
110
|
-
label: P("components.userAvatarInfo.fieldGender"),
|
|
111
|
-
icon: q.gender,
|
|
112
|
-
value: W.value
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
key: "age",
|
|
116
|
-
label: P("components.userAvatarInfo.fieldAge"),
|
|
117
|
-
icon: q.age,
|
|
118
|
-
value: Y(Ke.value)
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
key: "workYears",
|
|
122
|
-
label: P("components.userAvatarInfo.fieldWorkYears"),
|
|
123
|
-
icon: q.workYears,
|
|
124
|
-
value: Y(qe.value)
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
key: "jobLevel",
|
|
128
|
-
label: P("components.userAvatarInfo.fieldJobLevel"),
|
|
129
|
-
icon: q.position,
|
|
130
|
-
value: Y(Je.value)
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
key: "phone",
|
|
134
|
-
label: P("components.userAvatarInfo.fieldPhone"),
|
|
135
|
-
icon: q.phone,
|
|
136
|
-
value: Y(I.value?.phonenumber ?? "")
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
key: "email",
|
|
140
|
-
label: P("components.userAvatarInfo.fieldEmail"),
|
|
141
|
-
icon: q.email,
|
|
142
|
-
value: Y(I.value?.email ?? "")
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
key: "department",
|
|
146
|
-
label: P("components.userAvatarInfo.fieldDepartment"),
|
|
147
|
-
icon: q.department,
|
|
148
|
-
value: X.value
|
|
149
|
-
}
|
|
150
|
-
]), rt = r(() => ({
|
|
151
|
-
appendToBody: !0,
|
|
152
|
-
destroyOnClose: !1,
|
|
153
|
-
...j.drawerProps
|
|
154
|
-
})), it = r(() => j.enableDrawer ? `${P("components.userAvatarInfo.ariaLabel")}, ${P("components.userAvatarInfo.clickToViewDetail")}` : P("components.userAvatarInfo.ariaLabel"));
|
|
155
|
-
function Y(e) {
|
|
156
|
-
return e == null || e === "" ? P("components.userAvatarInfo.empty") : String(e);
|
|
157
|
-
}
|
|
158
|
-
let X = r(() => Y(I.value?.dept?.deptName ?? ""));
|
|
159
|
-
function at() {
|
|
160
|
-
j.enableDrawer && (M.value = !0);
|
|
161
|
-
}
|
|
162
|
-
function ot(e) {
|
|
163
|
-
j.enableDrawer && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), M.value = !0);
|
|
164
|
-
}
|
|
165
|
-
let Z = g(null), Q = g(!1);
|
|
166
|
-
function $() {
|
|
167
|
-
let e = Z.value;
|
|
168
|
-
e ? Q.value = e.scrollWidth > e.clientWidth + 1 : Q.value = !1;
|
|
169
|
-
}
|
|
170
|
-
oe((e) => {
|
|
171
|
-
let t = Z.value;
|
|
172
|
-
if (!t || typeof ResizeObserver > "u") {
|
|
173
|
-
Q.value = !1;
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
$();
|
|
177
|
-
let n = new ResizeObserver(() => $());
|
|
178
|
-
n.observe(t), e(() => n.disconnect());
|
|
179
|
-
}), b(() => R.value, () => ee($));
|
|
180
|
-
function st() {
|
|
181
|
-
M.value = !0;
|
|
182
|
-
}
|
|
183
|
-
function ct() {
|
|
184
|
-
M.value = !1;
|
|
185
|
-
}
|
|
186
|
-
return f({
|
|
187
|
-
openDrawer: st,
|
|
188
|
-
closeDrawer: ct,
|
|
189
|
-
remoteUser: I,
|
|
190
|
-
remoteDetail: F
|
|
191
|
-
}), (e, t) => (h(), o("div", be, [Ge.value ? (h(), o("div", xe, [l(y(ce), { animated: "" }, {
|
|
192
|
-
template: x(() => [s("div", Se, [l(y(C), {
|
|
193
|
-
variant: "circle",
|
|
194
|
-
style: te({
|
|
195
|
-
width: `${u.size}px`,
|
|
196
|
-
height: `${u.size}px`
|
|
197
|
-
})
|
|
198
|
-
}, null, 8, ["style"]), s("div", Ce, [l(y(C), {
|
|
199
|
-
variant: "p",
|
|
200
|
-
style: { width: "55%" }
|
|
201
|
-
}), l(y(C), {
|
|
202
|
-
variant: "p",
|
|
203
|
-
style: { width: "40%" }
|
|
204
|
-
})])])]),
|
|
205
|
-
_: 1
|
|
206
|
-
})])) : (h(), o("div", {
|
|
207
|
-
key: 1,
|
|
208
|
-
class: m(["inline-flex items-center min-w-0 max-w-full gap-2 outline-none rounded-md", { "cursor-pointer focus-visible:ring-2 focus-visible:ring-blue-100": u.enableDrawer }]),
|
|
209
|
-
role: u.enableDrawer ? "button" : void 0,
|
|
210
|
-
tabindex: u.enableDrawer ? 0 : void 0,
|
|
211
|
-
"aria-label": it.value,
|
|
212
|
-
"aria-disabled": !u.enableDrawer,
|
|
213
|
-
onClick: at,
|
|
214
|
-
onKeydown: ot
|
|
215
|
-
}, [s("div", E, [
|
|
216
|
-
l(y(S), p({ class: "inline-flex flex-shrink-0 items-center justify-center align-middle" }, K.value), {
|
|
217
|
-
default: x(() => [_(e.$slots, "avatar", {}, () => [c(v(L.value?.slice(0, 1)), 1)])]),
|
|
218
|
-
_: 3
|
|
219
|
-
}, 16),
|
|
220
|
-
$e.value ? (h(), o("span", {
|
|
221
|
-
key: 0,
|
|
222
|
-
class: m(["absolute -top-0.5 -right-0.5 z-[1] box-border inline-flex items-center justify-center w-3 h-3 pointer-events-none rounded-full border-2 border-white bg-white", V.value === "male" ? "text-blue-600" : "text-pink-500"]),
|
|
223
|
-
"aria-hidden": "true"
|
|
224
|
-
}, [V.value === "male" ? (h(), i(y(w), {
|
|
225
|
-
key: 0,
|
|
226
|
-
size: G.value,
|
|
227
|
-
"stroke-width": 2.5
|
|
228
|
-
}, null, 8, ["size"])) : (h(), i(y(ye), {
|
|
229
|
-
key: 1,
|
|
230
|
-
size: G.value,
|
|
231
|
-
"stroke-width": 2.5
|
|
232
|
-
}, null, 8, ["size"]))], 2)) : a("", !0),
|
|
233
|
-
et.value ? (h(), o("span", {
|
|
234
|
-
key: 1,
|
|
235
|
-
class: m(["absolute right-0 bottom-0 z-[1] box-border w-2.5 h-2.5 pointer-events-none rounded-full border-2 border-white", tt.value ? "bg-emerald-500" : "bg-gray-300"]),
|
|
236
|
-
"aria-hidden": "true"
|
|
237
|
-
}, null, 2)) : a("", !0)
|
|
238
|
-
]), s("div", { class: m(["flex flex-col flex-1 justify-center min-w-0 text-sm leading-[1.35]", Ze.value]) }, [s("div", D, [_(e.$slots, "name", {}, () => [c(v(L.value), 1)])]), R.value || e.$slots.subtitle ? (h(), o("div", O, [l(y(le), {
|
|
239
|
-
placement: "top",
|
|
240
|
-
disabled: !Q.value,
|
|
241
|
-
"show-after": 200,
|
|
242
|
-
"popper-class": "max-w-[min(90vw,380px)]"
|
|
243
|
-
}, {
|
|
244
|
-
content: x(() => [s("div", k, [_(e.$slots, "subtitle", {}, () => [c(v(R.value), 1)])])]),
|
|
245
|
-
default: x(() => [s("div", {
|
|
246
|
-
ref_key: "subtitleRef",
|
|
247
|
-
ref: Z,
|
|
248
|
-
class: m(["min-w-0 overflow-hidden text-ellipsis text-[10px] whitespace-nowrap", Q.value ? "cursor-help" : ""])
|
|
249
|
-
}, [_(e.$slots, "subtitle", {}, () => [c(v(R.value), 1)])], 2)]),
|
|
250
|
-
_: 3
|
|
251
|
-
}, 8, ["disabled"])])) : a("", !0)], 2)], 42, T)), N.value ? (h(), i(y(se), p({
|
|
252
|
-
key: 2,
|
|
253
|
-
modelValue: M.value,
|
|
254
|
-
"onUpdate:modelValue": t[0] ||= (e) => M.value = e,
|
|
255
|
-
size: u.drawerSize,
|
|
256
|
-
class: ["user-avatar-info-drawer", Xe.value]
|
|
257
|
-
}, rt.value, { onClosed: Be }), {
|
|
258
|
-
header: x(() => [s("div", A, [s("span", we, v(nt.value), 1)])]),
|
|
259
|
-
default: x(() => [Ye.value ? (h(), o("div", Te, [_(e.$slots, "default")])) : (h(), o("div", Ee, [s("section", { class: m(["relative flex flex-col items-center sm:flex-row gap-5 min-h-[140px] p-6 overflow-hidden rounded-2xl shadow-[inset_0_1px_0_rgba(255,255,255,0.6)]", U.value ? "bg-gradient-to-br from-pink-50 to-rose-100" : "bg-gradient-to-br from-sky-50 to-indigo-100"]) }, [
|
|
260
|
-
t[1] ||= s("div", { class: "absolute top-[-50%] right-[-10%] w-[300px] h-[300px] bg-[radial-gradient(circle,rgba(255,255,255,0.8)_0%,rgba(255,255,255,0)_70%)] rounded-full pointer-events-none" }, null, -1),
|
|
261
|
-
s("div", De, [_(e.$slots, "drawer-avatar", {}, () => [l(y(S), {
|
|
262
|
-
size: j.drawerAvatarSize,
|
|
263
|
-
src: K.value.src,
|
|
264
|
-
class: m(["!text-[24px] !font-semibold !text-white !border-[3px] !border-white", U.value ? "!bg-gradient-to-br !from-pink-400 !to-rose-500 !shadow-[0_4px_12px_rgba(244,63,94,0.2)]" : "!bg-gradient-to-br !from-blue-400 !to-blue-500 !shadow-[0_4px_12px_rgba(59,130,246,0.2)]"])
|
|
265
|
-
}, {
|
|
266
|
-
default: x(() => [c(v(z.value?.slice(0, 1)), 1)]),
|
|
267
|
-
_: 1
|
|
268
|
-
}, 8, [
|
|
269
|
-
"size",
|
|
270
|
-
"src",
|
|
271
|
-
"class"
|
|
272
|
-
])])]),
|
|
273
|
-
s("div", Oe, [s("div", ke, [_(e.$slots, "drawer-name", {}, () => [s("strong", Ae, v(z.value || "暂无姓名"), 1)]), Qe.value ? (h(), o("span", {
|
|
274
|
-
key: 0,
|
|
275
|
-
class: m(["px-2.5 py-0.5 text-xs font-medium leading-5 rounded-xl", U.value ? "text-pink-600 bg-pink-600/10" : "text-blue-600 bg-blue-600/10"])
|
|
276
|
-
}, v(W.value), 3)) : a("", !0)]), s("div", je, [B.value ? (h(), o("span", Me, v(y(P)("components.userAvatarInfo.fieldId")) + ": " + v(B.value), 1)) : a("", !0), X.value ? (h(), o("span", Ne, v(X.value), 1)) : a("", !0)])])
|
|
277
|
-
], 2), s("section", Pe, [(h(!0), o(n, null, ne(J.value, (e) => (h(), o("div", {
|
|
278
|
-
key: e.key,
|
|
279
|
-
class: "group flex items-center gap-4 min-w-0 p-4 sm:p-5 bg-white border border-slate-200/80 rounded-xl shadow-sm transition-all duration-200"
|
|
280
|
-
}, [s("div", { class: m(["flex flex-shrink-0 items-center justify-center w-10 h-10 rounded-[10px] transition-colors", U.value ? "text-pink-500 bg-pink-50 group-hover:bg-pink-100" : "text-blue-500 bg-blue-50 group-hover:bg-blue-100"]) }, [(h(), i(re(e.icon), {
|
|
281
|
-
size: 18,
|
|
282
|
-
"stroke-width": 2
|
|
283
|
-
}))], 2), s("div", Fe, [s("div", Ie, v(e.label), 1), s("div", {
|
|
284
|
-
class: "overflow-hidden text-ellipsis text-sm font-semibold text-slate-800 whitespace-nowrap",
|
|
285
|
-
title: e.value
|
|
286
|
-
}, v(e.value), 9, Le)])]))), 128))])]))]),
|
|
287
|
-
_: 3
|
|
288
|
-
}, 16, [
|
|
289
|
-
"modelValue",
|
|
290
|
-
"size",
|
|
291
|
-
"class"
|
|
292
|
-
])) : a("", !0)]));
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
export { j as t };
|