disguise-ui 0.3.2 → 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.
- package/dist/_plugin-vue_export-helper-Djzt4Yr7.js +7 -0
- package/dist/{avatar-cell-CGc64Tyy.js → avatar-cell-B9VByweR.js} +1 -1
- package/dist/disguise-ui.js +341 -340
- package/dist/{file-upload-DSqjKCVS.js → file-upload-C1cpwWWY.js} +1 -1
- package/dist/{file-upload-BllX1YqY.js → file-upload-n4pZizh3.js} +4 -3
- package/dist/{_plugin-vue_export-helper-BaV2q_qe.js → i18n-D9LSb_U5.js} +1 -7
- package/dist/{picture-cell-D4IF_fwn.js → picture-cell-C6BLbwEb.js} +2 -1
- package/dist/{picture-upload-DO3ttk_V.js → picture-upload-C_10NZsL.js} +4 -3
- package/dist/{picture-upload-CDMrYc5t.js → picture-upload-DFIHyqTp.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/user-avatar-info/index.vue.d.ts +0 -28
- package/dist/{use-image-url-BnWCAP3q.js → use-image-url-Df54pSFh.js} +1 -1
- package/dist/{use-multiple-file-upload-D84IYptm.js → use-multiple-file-upload-CBOycBu3.js} +55 -55
- package/dist/user-avatar-info-COmJGI9K.js +271 -0
- package/package.json +1 -1
- package/dist/user-avatar-info-CLHoRFpQ.js +0 -275
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as n } from "./use-image-url-
|
|
1
|
+
import { n as e, s as t } from "./i18n-D9LSb_U5.js";
|
|
2
|
+
import { t as n } from "./use-image-url-Df54pSFh.js";
|
|
3
3
|
import { t as r } from "./use-file-type-rNstoxXw.js";
|
|
4
4
|
import { computed as i, ref as a, watch as o } from "vue";
|
|
5
5
|
import { ElMessage as s } from "element-plus";
|
|
6
6
|
// src/runtime/upload.ts
|
|
7
|
-
async function c(
|
|
8
|
-
let r =
|
|
7
|
+
async function c(e, n) {
|
|
8
|
+
let r = t();
|
|
9
9
|
if (!r) throw Error("请先调用 setupDisguise,并传入 uploadFile");
|
|
10
|
-
return r(
|
|
10
|
+
return r(e, n);
|
|
11
11
|
}
|
|
12
12
|
// src/services/file-upload.ts
|
|
13
13
|
async function l(e, t, n) {
|
|
@@ -41,18 +41,18 @@ var f = (e) => {
|
|
|
41
41
|
if (e < 1024) return `${e} B`;
|
|
42
42
|
let t = e / 1024;
|
|
43
43
|
return t < 1024 ? `${t.toFixed(2)} KB` : `${(t / 1024).toFixed(2)} MB`;
|
|
44
|
-
}, p = (
|
|
45
|
-
let { t: c } =
|
|
44
|
+
}, p = (t) => {
|
|
45
|
+
let { t: c } = e(), { ensureImageBaseUrl: u, resolveImageUrl: p } = n();
|
|
46
46
|
u();
|
|
47
|
-
let m = a(!1), h = a(0), g = a(null), _ = a(""), v = a(null), y = i(() => v.value ? v.value :
|
|
48
|
-
o(() =>
|
|
47
|
+
let m = a(!1), h = a(0), g = a(null), _ = a(""), v = a(null), y = i(() => v.value ? v.value : t.modelValue.value ? typeof t.modelValue.value == "string" ? { url: t.modelValue.value } : t.modelValue.value : null), b = i(() => y.value?.fileUrl || y.value?.url || "");
|
|
48
|
+
o(() => t.modelValue.value, (e) => {
|
|
49
49
|
v.value = d({
|
|
50
50
|
incomingValue: e,
|
|
51
51
|
pendingFileData: v.value,
|
|
52
52
|
isUploading: !!g.value
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
|
-
let x = i(() => p(b.value || y.value?.name || "")), S = i(() => !y.value && !g.value), C = i(() => !!(
|
|
55
|
+
let x = i(() => p(b.value || y.value?.name || "")), S = i(() => !y.value && !g.value), C = i(() => !!(t.errorMessage?.value || _.value)), w = i(() => t.errorMessage?.value || _.value || ""), T = i(() => g.value ? g.value.name : y.value ? t.fileName?.value || y.value.name || c("components.fileUpload.unnamedFile") : ""), E = i(() => {
|
|
56
56
|
if (!g.value) return "";
|
|
57
57
|
let e = g.value.size;
|
|
58
58
|
return `${f(Math.round(e * h.value / 100))} / ${f(e)}`;
|
|
@@ -71,65 +71,65 @@ var f = (e) => {
|
|
|
71
71
|
progressText: E,
|
|
72
72
|
getFileIconClass: D.iconClass,
|
|
73
73
|
getFileIconSvg: D.iconSvg,
|
|
74
|
-
acceptAttr: i(() =>
|
|
75
|
-
beforeUpload: (
|
|
76
|
-
handleUpload: async (
|
|
77
|
-
let n =
|
|
74
|
+
acceptAttr: i(() => t.accept.value.join(",")),
|
|
75
|
+
beforeUpload: (e) => (_.value = "", t.accept.value.length > 0 && !t.accept.value.some((t) => t.startsWith(".") ? e.name.toLowerCase().endsWith(t.toLowerCase()) : e.type.toLowerCase().startsWith(t.toLowerCase().replace("*", ""))) ? (s.error(c("components.fileUpload.typeNotAllowed", { types: t.accept.value.join(", ") })), !1) : e.size / 1024 / 1024 > t.maxSize.value ? (s.error(c("components.fileUpload.sizeLimitExceeded", { size: t.maxSize.value })), !1) : !0),
|
|
76
|
+
handleUpload: async (e) => {
|
|
77
|
+
let n = e.file;
|
|
78
78
|
g.value = n, m.value = !0, h.value = 0, _.value = "";
|
|
79
79
|
try {
|
|
80
|
-
let
|
|
81
|
-
baseFolder:
|
|
82
|
-
addWatermark:
|
|
80
|
+
let e, r = {
|
|
81
|
+
baseFolder: t.baseFolder?.value,
|
|
82
|
+
addWatermark: t.addWatermark?.value
|
|
83
83
|
};
|
|
84
|
-
|
|
84
|
+
e = (n.size, await l(n, (e) => {
|
|
85
85
|
h.value = e;
|
|
86
|
-
}, r)), h.value = 100, v.value =
|
|
87
|
-
} catch (
|
|
88
|
-
let n =
|
|
89
|
-
_.value = n.message || c("components.fileUpload.uploadRetryFailed"),
|
|
86
|
+
}, r)), h.value = 100, v.value = e, t.onUpdate(e.fileUrl || e.url), t.onUploadSuccess?.(e), s.success(c("components.fileUpload.uploadSuccess"));
|
|
87
|
+
} catch (e) {
|
|
88
|
+
let n = e;
|
|
89
|
+
_.value = n.message || c("components.fileUpload.uploadRetryFailed"), t.onUploadError?.(n), s.error(_.value);
|
|
90
90
|
} finally {
|
|
91
91
|
m.value = !1, g.value = null, h.value = 0;
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
handleRemove: () => {
|
|
95
|
-
_.value = "", v.value = null, g.value = null, h.value = 0, m.value = !1,
|
|
95
|
+
_.value = "", v.value = null, g.value = null, h.value = 0, m.value = !1, t.onUpdate(void 0), y.value && t.onRemove?.(y.value);
|
|
96
96
|
},
|
|
97
97
|
handlePreview: () => {
|
|
98
|
-
let
|
|
99
|
-
|
|
98
|
+
let e = x.value;
|
|
99
|
+
e && y.value && (window.open(e, "_blank"), t.onPreview?.(y.value));
|
|
100
100
|
},
|
|
101
101
|
handleDownload: () => {
|
|
102
102
|
if (C.value) {
|
|
103
103
|
s.error(c("components.fileUpload.fileDownloadError", {}));
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
let
|
|
107
|
-
if (
|
|
106
|
+
let e = x.value;
|
|
107
|
+
if (e && y.value) {
|
|
108
108
|
let n = document.createElement("a");
|
|
109
|
-
n.href =
|
|
109
|
+
n.href = e, n.download = y.value.name || "file", n.click(), t.onDownload?.(y.value);
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
formatFileSize: f
|
|
113
113
|
};
|
|
114
|
-
}, m = (
|
|
115
|
-
let { t: o } =
|
|
114
|
+
}, m = (t) => {
|
|
115
|
+
let { t: o } = e(), { ensureImageBaseUrl: c, resolveImageUrl: u } = n();
|
|
116
116
|
c();
|
|
117
|
-
let d = a(!1), f = a(/* @__PURE__ */ new Map()), p = i(() =>
|
|
118
|
-
if (
|
|
117
|
+
let d = a(!1), f = a(/* @__PURE__ */ new Map()), p = i(() => t.modelValue.value || []), m = i(() => p.value.length === 0), h = (e) => e.fileUrl || e.url || "", g = i(() => {
|
|
118
|
+
if (t.errorMessage?.value) return !0;
|
|
119
119
|
for (let e of f.value.values()) if (e.status === "error") return !0;
|
|
120
120
|
return !1;
|
|
121
|
-
}), _ = i(() =>
|
|
121
|
+
}), _ = i(() => t.errorMessage?.value || ""), v = i(() => {
|
|
122
122
|
let e = [...f.value.values()];
|
|
123
123
|
if (e.length === 0) return 0;
|
|
124
124
|
let t = e.reduce((e, t) => e + t.progress, 0);
|
|
125
125
|
return Math.round(t / e.length);
|
|
126
|
-
}), y = (
|
|
126
|
+
}), y = (e) => t.maxCount?.value && t.maxCount.value > 1 && p.value.length + f.value.size >= t.maxCount.value ? (s.error(o("components.fileUpload.maxCountExceeded", { count: t.maxCount.value })), !1) : t.accept.value.length > 0 && !t.accept.value.some((t) => t.startsWith(".") ? e.name.toLowerCase().endsWith(t.toLowerCase()) : e.type.toLowerCase().startsWith(t.toLowerCase().replace("*", ""))) ? (s.error(o("components.fileUpload.typeNotAllowed", { types: t.accept.value.join(", ") })), !1) : e.size / 1024 / 1024 > t.maxSize.value ? (s.error(o("components.fileUpload.sizeLimitExceeded", { size: t.maxSize.value })), !1) : !0, b = (e, t) => {
|
|
127
127
|
let n = f.value.get(e);
|
|
128
128
|
n && f.value.set(e, {
|
|
129
129
|
...n,
|
|
130
130
|
...t
|
|
131
131
|
});
|
|
132
|
-
}, x = async (
|
|
132
|
+
}, x = async (e, n) => {
|
|
133
133
|
if (!f.value.get(n)) throw Error(o("components.fileUpload.uploadItemNotFound"));
|
|
134
134
|
b(n, {
|
|
135
135
|
status: "uploading",
|
|
@@ -137,11 +137,11 @@ var f = (e) => {
|
|
|
137
137
|
});
|
|
138
138
|
try {
|
|
139
139
|
let r;
|
|
140
|
-
return r = (
|
|
140
|
+
return r = (e.size, await l(e, (e) => {
|
|
141
141
|
b(n, { progress: e });
|
|
142
142
|
}, {
|
|
143
|
-
baseFolder:
|
|
144
|
-
addWatermark:
|
|
143
|
+
baseFolder: t.baseFolder?.value,
|
|
144
|
+
addWatermark: t.addWatermark?.value
|
|
145
145
|
})), b(n, {
|
|
146
146
|
status: "success",
|
|
147
147
|
progress: 100,
|
|
@@ -163,42 +163,42 @@ var f = (e) => {
|
|
|
163
163
|
isEmpty: m,
|
|
164
164
|
isError: g,
|
|
165
165
|
displayErrorMessage: _,
|
|
166
|
-
acceptAttr: i(() =>
|
|
166
|
+
acceptAttr: i(() => t.accept.value.join(",")),
|
|
167
167
|
beforeUpload: y,
|
|
168
|
-
handleUpload: async (
|
|
169
|
-
let n =
|
|
168
|
+
handleUpload: async (e) => {
|
|
169
|
+
let n = e.file, r = `${Date.now()}-${Math.random()}`;
|
|
170
170
|
f.value.set(r, {
|
|
171
171
|
file: n,
|
|
172
172
|
progress: 0,
|
|
173
173
|
status: "pending"
|
|
174
174
|
}), d.value = !0;
|
|
175
175
|
try {
|
|
176
|
-
let
|
|
177
|
-
|
|
178
|
-
} catch (
|
|
179
|
-
let r =
|
|
180
|
-
|
|
176
|
+
let e = await x(n, r), i = [...p.value, e];
|
|
177
|
+
t.onUpdate(i), t.onUploadSuccess?.(e), f.value.delete(r), s.success(o("components.fileUpload.uploadSuccess"));
|
|
178
|
+
} catch (e) {
|
|
179
|
+
let r = e;
|
|
180
|
+
t.onUploadError?.(r, n), s.error(r.message || o("components.fileUpload.uploadRetryFailed"));
|
|
181
181
|
} finally {
|
|
182
182
|
[...f.value.values()].some((e) => e.status === "uploading" || e.status === "pending") || (d.value = !1);
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
|
-
handleRemove: (
|
|
186
|
-
let n = p.value.filter((
|
|
187
|
-
|
|
185
|
+
handleRemove: (e) => {
|
|
186
|
+
let n = p.value.filter((t) => h(t) !== h(e) && t.name !== e.name);
|
|
187
|
+
t.onUpdate(n.length > 0 ? n : void 0), t.onRemove?.(e);
|
|
188
188
|
},
|
|
189
|
-
handlePreview: (
|
|
190
|
-
let n = u(h(
|
|
191
|
-
n && (window.open(n, "_blank"),
|
|
189
|
+
handlePreview: (e) => {
|
|
190
|
+
let n = u(h(e) || e.name || "");
|
|
191
|
+
n && (window.open(n, "_blank"), t.onPreview?.(e));
|
|
192
192
|
},
|
|
193
|
-
handleDownload: (
|
|
193
|
+
handleDownload: (e) => {
|
|
194
194
|
if (g.value) {
|
|
195
195
|
s.error(o("components.fileUpload.fileDownloadError", {}));
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
|
-
let n = u(h(
|
|
198
|
+
let n = u(h(e) || e.name || "");
|
|
199
199
|
if (n) {
|
|
200
200
|
let r = document.createElement("a");
|
|
201
|
-
r.href = n, r.download =
|
|
201
|
+
r.href = n, r.download = e.name || "file", r.click(), t.onDownload?.(e);
|
|
202
202
|
}
|
|
203
203
|
},
|
|
204
204
|
getUploadItem: (e) => {
|
|
@@ -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 };
|