disguise-ui 0.3.1 → 0.3.3
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/README.md +1 -21
- package/dist/{avatar-cell-CSanGG5Y.js → avatar-cell-B0Pvug8d.js} +1 -1
- package/dist/disguise-ui.js +1145 -1130
- package/dist/{file-upload-ClPojHbE.js → file-upload-C1cpwWWY.js} +1 -1
- package/dist/{file-upload-D7N0tsLF.js → file-upload-n4pZizh3.js} +3 -3
- package/dist/{i18n-_x6RCAst.js → i18n-D9LSb_U5.js} +170 -40
- package/dist/picture-cell-C6BLbwEb.js +121 -0
- package/dist/{picture-upload-BrrTtaCc.js → picture-upload-C_10NZsL.js} +5 -5
- package/dist/{picture-upload-VK7YOAr4.js → picture-upload-DFIHyqTp.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/table-entity/index.type.d.ts +16 -3
- package/dist/types/components/user-avatar-info/index.vue.d.ts +0 -24
- package/dist/types/composables/use-dict-data.d.ts +22 -22
- package/dist/types/index.d.ts +1 -1
- package/dist/types/runtime/context.d.ts +1 -1
- package/dist/types/runtime/dict.d.ts +1 -1
- package/dist/{use-image-url-Bs5WMZ6L.js → use-image-url-Df54pSFh.js} +1 -1
- package/dist/{use-multiple-file-upload-Cv2dfA07.js → use-multiple-file-upload-CBOycBu3.js} +55 -56
- package/dist/user-avatar-info-DDby9_5X.js +295 -0
- package/package.json +6 -1
- package/dist/context-DqlD6qDJ.js +0 -50
- package/dist/picture-cell-BhKqFZUx.js +0 -120
- package/dist/user-avatar-info-BruEfYy4.js +0 -276
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as n } from "./use-image-url-Bs5WMZ6L.js";
|
|
1
|
+
import { n as e, s as t } from "./i18n-D9LSb_U5.js";
|
|
2
|
+
import { t as n } from "./use-image-url-Df54pSFh.js";
|
|
4
3
|
import { t as r } from "./use-file-type-rNstoxXw.js";
|
|
5
4
|
import { computed as i, ref as a, watch as o } from "vue";
|
|
6
5
|
import { ElMessage as s } from "element-plus";
|
|
7
6
|
// src/runtime/upload.ts
|
|
8
|
-
async function c(
|
|
9
|
-
let r =
|
|
7
|
+
async function c(e, n) {
|
|
8
|
+
let r = t();
|
|
10
9
|
if (!r) throw Error("请先调用 setupDisguise,并传入 uploadFile");
|
|
11
|
-
return r(
|
|
10
|
+
return r(e, n);
|
|
12
11
|
}
|
|
13
12
|
// src/services/file-upload.ts
|
|
14
13
|
async function l(e, t, n) {
|
|
@@ -42,18 +41,18 @@ var f = (e) => {
|
|
|
42
41
|
if (e < 1024) return `${e} B`;
|
|
43
42
|
let t = e / 1024;
|
|
44
43
|
return t < 1024 ? `${t.toFixed(2)} KB` : `${(t / 1024).toFixed(2)} MB`;
|
|
45
|
-
}, p = (
|
|
46
|
-
let { t: c } =
|
|
44
|
+
}, p = (t) => {
|
|
45
|
+
let { t: c } = e(), { ensureImageBaseUrl: u, resolveImageUrl: p } = n();
|
|
47
46
|
u();
|
|
48
|
-
let m = a(!1), h = a(0), g = a(null), _ = a(""), v = a(null), y = i(() => v.value ? v.value :
|
|
49
|
-
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) => {
|
|
50
49
|
v.value = d({
|
|
51
50
|
incomingValue: e,
|
|
52
51
|
pendingFileData: v.value,
|
|
53
52
|
isUploading: !!g.value
|
|
54
53
|
});
|
|
55
54
|
});
|
|
56
|
-
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(() => {
|
|
57
56
|
if (!g.value) return "";
|
|
58
57
|
let e = g.value.size;
|
|
59
58
|
return `${f(Math.round(e * h.value / 100))} / ${f(e)}`;
|
|
@@ -72,65 +71,65 @@ var f = (e) => {
|
|
|
72
71
|
progressText: E,
|
|
73
72
|
getFileIconClass: D.iconClass,
|
|
74
73
|
getFileIconSvg: D.iconSvg,
|
|
75
|
-
acceptAttr: i(() =>
|
|
76
|
-
beforeUpload: (
|
|
77
|
-
handleUpload: async (
|
|
78
|
-
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;
|
|
79
78
|
g.value = n, m.value = !0, h.value = 0, _.value = "";
|
|
80
79
|
try {
|
|
81
|
-
let
|
|
82
|
-
baseFolder:
|
|
83
|
-
addWatermark:
|
|
80
|
+
let e, r = {
|
|
81
|
+
baseFolder: t.baseFolder?.value,
|
|
82
|
+
addWatermark: t.addWatermark?.value
|
|
84
83
|
};
|
|
85
|
-
|
|
84
|
+
e = (n.size, await l(n, (e) => {
|
|
86
85
|
h.value = e;
|
|
87
|
-
}, r)), h.value = 100, v.value =
|
|
88
|
-
} catch (
|
|
89
|
-
let n =
|
|
90
|
-
_.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);
|
|
91
90
|
} finally {
|
|
92
91
|
m.value = !1, g.value = null, h.value = 0;
|
|
93
92
|
}
|
|
94
93
|
},
|
|
95
94
|
handleRemove: () => {
|
|
96
|
-
_.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);
|
|
97
96
|
},
|
|
98
97
|
handlePreview: () => {
|
|
99
|
-
let
|
|
100
|
-
|
|
98
|
+
let e = x.value;
|
|
99
|
+
e && y.value && (window.open(e, "_blank"), t.onPreview?.(y.value));
|
|
101
100
|
},
|
|
102
101
|
handleDownload: () => {
|
|
103
102
|
if (C.value) {
|
|
104
103
|
s.error(c("components.fileUpload.fileDownloadError", {}));
|
|
105
104
|
return;
|
|
106
105
|
}
|
|
107
|
-
let
|
|
108
|
-
if (
|
|
106
|
+
let e = x.value;
|
|
107
|
+
if (e && y.value) {
|
|
109
108
|
let n = document.createElement("a");
|
|
110
|
-
n.href =
|
|
109
|
+
n.href = e, n.download = y.value.name || "file", n.click(), t.onDownload?.(y.value);
|
|
111
110
|
}
|
|
112
111
|
},
|
|
113
112
|
formatFileSize: f
|
|
114
113
|
};
|
|
115
|
-
}, m = (
|
|
116
|
-
let { t: o } =
|
|
114
|
+
}, m = (t) => {
|
|
115
|
+
let { t: o } = e(), { ensureImageBaseUrl: c, resolveImageUrl: u } = n();
|
|
117
116
|
c();
|
|
118
|
-
let d = a(!1), f = a(/* @__PURE__ */ new Map()), p = i(() =>
|
|
119
|
-
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;
|
|
120
119
|
for (let e of f.value.values()) if (e.status === "error") return !0;
|
|
121
120
|
return !1;
|
|
122
|
-
}), _ = i(() =>
|
|
121
|
+
}), _ = i(() => t.errorMessage?.value || ""), v = i(() => {
|
|
123
122
|
let e = [...f.value.values()];
|
|
124
123
|
if (e.length === 0) return 0;
|
|
125
124
|
let t = e.reduce((e, t) => e + t.progress, 0);
|
|
126
125
|
return Math.round(t / e.length);
|
|
127
|
-
}), 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) => {
|
|
128
127
|
let n = f.value.get(e);
|
|
129
128
|
n && f.value.set(e, {
|
|
130
129
|
...n,
|
|
131
130
|
...t
|
|
132
131
|
});
|
|
133
|
-
}, x = async (
|
|
132
|
+
}, x = async (e, n) => {
|
|
134
133
|
if (!f.value.get(n)) throw Error(o("components.fileUpload.uploadItemNotFound"));
|
|
135
134
|
b(n, {
|
|
136
135
|
status: "uploading",
|
|
@@ -138,11 +137,11 @@ var f = (e) => {
|
|
|
138
137
|
});
|
|
139
138
|
try {
|
|
140
139
|
let r;
|
|
141
|
-
return r = (
|
|
140
|
+
return r = (e.size, await l(e, (e) => {
|
|
142
141
|
b(n, { progress: e });
|
|
143
142
|
}, {
|
|
144
|
-
baseFolder:
|
|
145
|
-
addWatermark:
|
|
143
|
+
baseFolder: t.baseFolder?.value,
|
|
144
|
+
addWatermark: t.addWatermark?.value
|
|
146
145
|
})), b(n, {
|
|
147
146
|
status: "success",
|
|
148
147
|
progress: 100,
|
|
@@ -164,42 +163,42 @@ var f = (e) => {
|
|
|
164
163
|
isEmpty: m,
|
|
165
164
|
isError: g,
|
|
166
165
|
displayErrorMessage: _,
|
|
167
|
-
acceptAttr: i(() =>
|
|
166
|
+
acceptAttr: i(() => t.accept.value.join(",")),
|
|
168
167
|
beforeUpload: y,
|
|
169
|
-
handleUpload: async (
|
|
170
|
-
let n =
|
|
168
|
+
handleUpload: async (e) => {
|
|
169
|
+
let n = e.file, r = `${Date.now()}-${Math.random()}`;
|
|
171
170
|
f.value.set(r, {
|
|
172
171
|
file: n,
|
|
173
172
|
progress: 0,
|
|
174
173
|
status: "pending"
|
|
175
174
|
}), d.value = !0;
|
|
176
175
|
try {
|
|
177
|
-
let
|
|
178
|
-
|
|
179
|
-
} catch (
|
|
180
|
-
let r =
|
|
181
|
-
|
|
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"));
|
|
182
181
|
} finally {
|
|
183
182
|
[...f.value.values()].some((e) => e.status === "uploading" || e.status === "pending") || (d.value = !1);
|
|
184
183
|
}
|
|
185
184
|
},
|
|
186
|
-
handleRemove: (
|
|
187
|
-
let n = p.value.filter((
|
|
188
|
-
|
|
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);
|
|
189
188
|
},
|
|
190
|
-
handlePreview: (
|
|
191
|
-
let n = u(h(
|
|
192
|
-
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));
|
|
193
192
|
},
|
|
194
|
-
handleDownload: (
|
|
193
|
+
handleDownload: (e) => {
|
|
195
194
|
if (g.value) {
|
|
196
195
|
s.error(o("components.fileUpload.fileDownloadError", {}));
|
|
197
196
|
return;
|
|
198
197
|
}
|
|
199
|
-
let n = u(h(
|
|
198
|
+
let n = u(h(e) || e.name || "");
|
|
200
199
|
if (n) {
|
|
201
200
|
let r = document.createElement("a");
|
|
202
|
-
r.href = n, r.download =
|
|
201
|
+
r.href = n, r.download = e.name || "file", r.click(), t.onDownload?.(e);
|
|
203
202
|
}
|
|
204
203
|
},
|
|
205
204
|
getUploadItem: (e) => {
|
|
@@ -0,0 +1,295 @@
|
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "disguise-ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Disguise:可独立使用的后台列表、表单和上传组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "vite build && node scripts/build-types.mjs",
|
|
25
|
+
"format": "prettier --write .",
|
|
26
|
+
"format:check": "prettier --check .",
|
|
27
|
+
"typecheck": "vue-tsc --noEmit",
|
|
28
|
+
"prepare": "node scripts/setup-hooks.mjs",
|
|
25
29
|
"deploy": "bash scripts/deploy.sh",
|
|
26
30
|
"docs:dev": "vitepress dev docs",
|
|
27
31
|
"docs:build": "node scripts/generate-version.mjs && vitepress build docs",
|
|
@@ -76,6 +80,7 @@
|
|
|
76
80
|
"dayjs": "^1.11.21",
|
|
77
81
|
"element-plus": "^2.14.3",
|
|
78
82
|
"lucide-vue-next": "^1.0.0",
|
|
83
|
+
"prettier": "^3.9.10",
|
|
79
84
|
"sass-embedded": "^1.107.0",
|
|
80
85
|
"tailwindcss": "^4.3.3",
|
|
81
86
|
"typescript": "^5.9.2",
|
package/dist/context-DqlD6qDJ.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { ref as e } from "vue";
|
|
2
|
-
// src/runtime/context.ts
|
|
3
|
-
var t = e("zh-CN"), n = e({}), r = e(() => !0), i = e(() => ""), a = e("hover"), o = e({
|
|
4
|
-
layout: "total, sizes, prev, pager, next, jumper",
|
|
5
|
-
background: !0,
|
|
6
|
-
pageSizes: [
|
|
7
|
-
10,
|
|
8
|
-
20,
|
|
9
|
-
50,
|
|
10
|
-
100
|
|
11
|
-
],
|
|
12
|
-
popperStyle: { zIndex: 4e3 }
|
|
13
|
-
}), s = null, c, l, u = "";
|
|
14
|
-
function d(e) {
|
|
15
|
-
e.locale && (t.value = e.locale), e.messages && (n.value = e.messages), e.request && (s = e.request), e.fetchAllDictData && (c = e.fetchAllDictData), e.uploadFile && (l = e.uploadFile), e.imageBaseUrl !== void 0 && (u = e.imageBaseUrl), e.hasAccess && (r.value = e.hasAccess), e.getAccessToken && (i.value = e.getAccessToken), e.cardShadow && (a.value = e.cardShadow), e.paginationConfig && (o.value = {
|
|
16
|
-
...o.value,
|
|
17
|
-
...e.paginationConfig
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function f() {
|
|
21
|
-
return t;
|
|
22
|
-
}
|
|
23
|
-
function p() {
|
|
24
|
-
return n;
|
|
25
|
-
}
|
|
26
|
-
function m() {
|
|
27
|
-
return s;
|
|
28
|
-
}
|
|
29
|
-
function h() {
|
|
30
|
-
return c?.() ?? Promise.resolve({});
|
|
31
|
-
}
|
|
32
|
-
function g() {
|
|
33
|
-
return l;
|
|
34
|
-
}
|
|
35
|
-
function _() {
|
|
36
|
-
return u;
|
|
37
|
-
}
|
|
38
|
-
function v() {
|
|
39
|
-
return r;
|
|
40
|
-
}
|
|
41
|
-
function y() {
|
|
42
|
-
return i.value();
|
|
43
|
-
}
|
|
44
|
-
function b() {
|
|
45
|
-
return a;
|
|
46
|
-
}
|
|
47
|
-
function x() {
|
|
48
|
-
return o;
|
|
49
|
-
}
|
|
50
|
-
export { p as a, f as c, h as d, b as i, x as l, v as n, g as o, y as r, _ as s, d as t, m as u };
|