disguise-ui 0.3.2 → 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.
@@ -1,275 +0,0 @@
1
- import { r as e, t } from "./_plugin-vue_export-helper-BaV2q_qe.js";
2
- import { t as n } from "./use-image-url-BnWCAP3q.js";
3
- import { Fragment as ee, 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 m, normalizeClass as h, normalizeStyle as te, openBlock as g, ref as _, renderList as ne, renderSlot as v, resolveComponent as y, resolveDynamicComponent as re, toDisplayString as b, unref as x, useModel as ie, useSlots as ae, watch as S, watchEffect as oe, withCtx as C } from "vue";
4
- import { Badge as se, Briefcase as ce, Building2 as le, Cake as ue, CalendarDays as de, Image as fe, Mail as pe, Mars as w, Phone as me, User as he, Venus as ge } from "lucide-vue-next";
5
- // src/components/user-avatar-info/index.vue?vue&type=script&setup=true&lang.ts
6
- var _e = { class: "user-avatar-info-root" }, ve = {
7
- key: 0,
8
- class: "user-avatar-info__loading"
9
- }, ye = { class: "user-avatar-info__skeleton-row" }, be = { class: "user-avatar-info__skeleton-text" }, xe = [
10
- "role",
11
- "tabindex",
12
- "aria-label",
13
- "aria-disabled"
14
- ], Se = { class: "user-avatar-info__avatar-wrap" }, T = { class: "user-avatar-info__name" }, E = {
15
- key: 0,
16
- class: "user-avatar-info__subtitle-wrap"
17
- }, D = { class: "user-avatar-info__tooltip-text displaySubtitle" }, O = { class: "row-detail-drawer__header" }, k = { class: "row-detail-drawer__title" }, A = {
18
- key: 0,
19
- class: "user-avatar-info__drawer-slot"
20
- }, j = {
21
- key: 1,
22
- class: "user-avatar-info__drawer"
23
- }, Ce = { class: "user-avatar-info__hero" }, we = { class: "user-avatar-info__hero-avatar" }, Te = { class: "user-avatar-info__hero-main" }, Ee = { class: "user-avatar-info__hero-name-row" }, De = { class: "user-avatar-info__hero-name" }, Oe = {
24
- key: 0,
25
- class: "user-avatar-info__hero-gender"
26
- }, ke = { class: "user-avatar-info__hero-meta" }, Ae = { key: 0 }, je = { key: 1 }, Me = { class: "user-avatar-info__card-grid" }, Ne = { class: "user-avatar-info__field-icon" }, Pe = { class: "user-avatar-info__field-content" }, Fe = { class: "user-avatar-info__field-label" }, Ie = { class: "user-avatar-info__field-value" }, M = /*#__PURE__*/ t(/* @__PURE__ */ u({
27
- __name: "index",
28
- props: /*@__PURE__*/ f({
29
- userId: { default: void 0 },
30
- name: { default: void 0 },
31
- subtitle: { default: "" },
32
- src: {},
33
- gender: { default: void 0 },
34
- size: { default: 30 },
35
- avatar: { default: void 0 },
36
- drawerAvatarSize: { default: 64 },
37
- age: { default: void 0 },
38
- workYears: { default: void 0 },
39
- email: { default: void 0 },
40
- phone: { default: void 0 },
41
- department: { default: void 0 },
42
- jobLevel: { default: void 0 },
43
- enableDrawer: {
44
- type: Boolean,
45
- default: !0
46
- },
47
- drawerTitle: { default: void 0 },
48
- drawerSize: { default: "40%" },
49
- drawerProps: { default: void 0 },
50
- nickName: { default: "" },
51
- deptName: { default: "" },
52
- sex: { default: "" }
53
- }, {
54
- drawerVisible: {
55
- type: Boolean,
56
- default: !1
57
- },
58
- drawerVisibleModifiers: {}
59
- }),
60
- emits: ["update:drawerVisible"],
61
- setup(t, { expose: u }) {
62
- let f = t, { ensureImageBaseUrl: M, resolveImageUrl: Le } = n();
63
- M();
64
- let N = ie(t, "drawerVisible"), P = _(!1);
65
- S(N, (e) => {
66
- e && (P.value = !0);
67
- }, { immediate: !0 });
68
- function Re() {
69
- P.value = !1;
70
- }
71
- let { t: F } = e(), ze = ae(), I = r(() => null), L = r(() => I.value?.data), Be = r(() => !1), Ve = r(() => !1), R = r(() => ({ isUserOnline: (e) => !1 })).value, He = r(() => Be.value && Ve.value && !I.value), z = r(() => f.nickName || f.name || ""), B = r(() => f.subtitle || f.deptName || ""), Ue = r(() => f.age), We = r(() => f.workYears), Ge = r(() => f.jobLevel), V = r(() => L.value?.nickName ?? L.value?.userName ?? ""), H = r(() => L.value?.userId ?? f.userId), Ke = r(() => !!ze.default), U = r(() => {
72
- if (f.gender !== void 0 && f.gender !== null && f.gender !== "") return f.gender;
73
- let e = f.sex;
74
- return e === "0" ? "male" : e === "1" ? "female" : "unknown";
75
- }), W = r(() => {
76
- let e = L.value?.sex;
77
- return e === "0" ? "male" : e === "1" ? "female" : "unknown";
78
- }), G = r(() => W.value === "male" ? F("components.userAvatarInfo.genderMale") : W.value === "female" ? F("components.userAvatarInfo.genderFemale") : F("components.userAvatarInfo.genderUnknown")), qe = r(() => W.value === "male" || W.value === "female"), Je = r(() => ({
79
- "user-avatar-info__meta--male": U.value === "male",
80
- "user-avatar-info__meta--female": U.value === "female"
81
- })), Ye = r(() => U.value === "male" || U.value === "female"), Xe = r(() => f.userId != null && String(f.userId) !== ""), Ze = r(() => R.isUserOnline(f.userId == null ? null : String(f.userId))), K = r(() => Math.max(10, Math.min(16, Math.round(f.size * .36)))), q = r(() => ({
82
- ...f.avatar,
83
- size: f.size,
84
- src: Le(f.src || "--"),
85
- shape: "circle"
86
- })), Qe = r(() => f.drawerTitle ?? F("components.userAvatarInfo.drawerTitle")), J = {
87
- avatar: d(fe),
88
- name: d(he),
89
- gender: d(w),
90
- age: d(ue),
91
- workYears: d(de),
92
- email: d(pe),
93
- phone: d(me),
94
- department: d(le),
95
- jobLevel: d(se),
96
- position: d(ce)
97
- }, $e = r(() => [
98
- {
99
- key: "name",
100
- label: F("components.userAvatarInfo.fieldName"),
101
- icon: J.name,
102
- value: V.value
103
- },
104
- {
105
- key: "gender",
106
- label: F("components.userAvatarInfo.fieldGender"),
107
- icon: J.gender,
108
- value: G.value
109
- },
110
- {
111
- key: "age",
112
- label: F("components.userAvatarInfo.fieldAge"),
113
- icon: J.age,
114
- value: Y(Ue.value)
115
- },
116
- {
117
- key: "workYears",
118
- label: F("components.userAvatarInfo.fieldWorkYears"),
119
- icon: J.workYears,
120
- value: Y(We.value)
121
- },
122
- {
123
- key: "jobLevel",
124
- label: F("components.userAvatarInfo.fieldJobLevel"),
125
- icon: J.position,
126
- value: Y(Ge.value)
127
- },
128
- {
129
- key: "phone",
130
- label: F("components.userAvatarInfo.fieldPhone"),
131
- icon: J.phone,
132
- value: Y(L.value?.phonenumber ?? "")
133
- },
134
- {
135
- key: "email",
136
- label: F("components.userAvatarInfo.fieldEmail"),
137
- icon: J.email,
138
- value: Y(L.value?.email ?? "")
139
- },
140
- {
141
- key: "department",
142
- label: F("components.userAvatarInfo.fieldDepartment"),
143
- icon: J.department,
144
- value: X.value
145
- }
146
- ]), et = r(() => ({
147
- appendToBody: !0,
148
- destroyOnClose: !1,
149
- ...f.drawerProps
150
- })), tt = r(() => f.enableDrawer ? `${F("components.userAvatarInfo.ariaLabel")}, ${F("components.userAvatarInfo.clickToViewDetail")}` : F("components.userAvatarInfo.ariaLabel"));
151
- function Y(e) {
152
- return e == null || e === "" ? F("components.userAvatarInfo.empty") : String(e);
153
- }
154
- let X = r(() => Y(L.value?.dept?.deptName ?? ""));
155
- function nt() {
156
- f.enableDrawer && (N.value = !0);
157
- }
158
- function rt(e) {
159
- f.enableDrawer && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), N.value = !0);
160
- }
161
- let Z = _(null), Q = _(!1);
162
- function $() {
163
- let e = Z.value;
164
- e ? Q.value = e.scrollWidth > e.clientWidth + 1 : Q.value = !1;
165
- }
166
- oe((e) => {
167
- let t = Z.value;
168
- if (!t || typeof ResizeObserver > "u") {
169
- Q.value = !1;
170
- return;
171
- }
172
- $();
173
- let n = new ResizeObserver(() => $());
174
- n.observe(t), e(() => n.disconnect());
175
- }), S(() => B.value, () => m($));
176
- function it() {
177
- N.value = !0;
178
- }
179
- function at() {
180
- N.value = !1;
181
- }
182
- return u({
183
- openDrawer: it,
184
- closeDrawer: at,
185
- remoteUser: L,
186
- remoteDetail: I
187
- }), (e, n) => {
188
- let r = y("el-skeleton-item"), u = y("el-skeleton"), d = y("el-avatar"), m = y("el-tooltip"), _ = y("el-drawer");
189
- return g(), o("div", _e, [He.value ? (g(), o("div", ve, [l(u, { animated: "" }, {
190
- template: C(() => [s("div", ye, [l(r, {
191
- variant: "circle",
192
- style: te({
193
- width: `${t.size}px`,
194
- height: `${t.size}px`
195
- })
196
- }, null, 8, ["style"]), s("div", be, [l(r, {
197
- variant: "p",
198
- style: { width: "55%" }
199
- }), l(r, {
200
- variant: "p",
201
- style: { width: "40%" }
202
- })])])]),
203
- _: 1
204
- })])) : (g(), o("div", {
205
- key: 1,
206
- class: h(["user-avatar-info", { "user-avatar-info--clickable": t.enableDrawer }]),
207
- role: t.enableDrawer ? "button" : void 0,
208
- tabindex: t.enableDrawer ? 0 : void 0,
209
- "aria-label": tt.value,
210
- "aria-disabled": !t.enableDrawer,
211
- onClick: nt,
212
- onKeydown: rt
213
- }, [s("div", Se, [
214
- l(d, p({ class: "user-avatar-info__avatar" }, q.value), {
215
- default: C(() => [v(e.$slots, "avatar", {}, () => [c(b(z.value?.slice(0, 1)), 1)], !0)]),
216
- _: 3
217
- }, 16),
218
- Ye.value ? (g(), o("span", {
219
- key: 0,
220
- class: h(["user-avatar-info__gender-badge", `user-avatar-info__gender-badge--${U.value}`]),
221
- "aria-hidden": "true"
222
- }, [U.value === "male" ? (g(), i(x(w), {
223
- key: 0,
224
- size: K.value,
225
- "stroke-width": 2.5
226
- }, null, 8, ["size"])) : (g(), i(x(ge), {
227
- key: 1,
228
- size: K.value,
229
- "stroke-width": 2.5
230
- }, null, 8, ["size"]))], 2)) : a("", !0),
231
- Xe.value ? (g(), o("span", {
232
- key: 1,
233
- class: h(["user-avatar-info__presence-badge", { "user-avatar-info__presence-badge--online": Ze.value }]),
234
- "aria-hidden": "true"
235
- }, null, 2)) : a("", !0)
236
- ]), s("div", { class: h(["user-avatar-info__meta", Je.value]) }, [s("div", T, [v(e.$slots, "name", {}, () => [c(b(z.value), 1)], !0)]), B.value || e.$slots.subtitle ? (g(), o("div", E, [l(m, {
237
- placement: "top",
238
- disabled: !Q.value,
239
- "show-after": 200,
240
- "popper-class": "user-avatar-info-tooltip"
241
- }, {
242
- content: C(() => [s("div", D, [v(e.$slots, "subtitle", {}, () => [c(b(B.value), 1)], !0)])]),
243
- default: C(() => [s("div", {
244
- ref_key: "subtitleRef",
245
- ref: Z,
246
- class: h(["user-avatar-info__subtitle", { "user-avatar-info__subtitle--overflow": Q.value }])
247
- }, [v(e.$slots, "subtitle", {}, () => [c(b(B.value), 1)], !0)], 2)]),
248
- _: 3
249
- }, 8, ["disabled"])])) : a("", !0)], 2)], 42, xe)), P.value ? (g(), i(_, p({
250
- key: 2,
251
- modelValue: N.value,
252
- "onUpdate:modelValue": n[0] ||= (e) => N.value = e,
253
- size: t.drawerSize,
254
- class: "user-avatar-info-drawer row-detail-drawer"
255
- }, et.value, { onClosed: Re }), {
256
- header: C(() => [s("div", O, [s("span", k, b(Qe.value), 1)])]),
257
- default: C(() => [Ke.value ? (g(), o("div", A, [v(e.$slots, "default", {}, void 0, !0)])) : (g(), o("div", j, [s("section", Ce, [s("div", we, [v(e.$slots, "drawer-avatar", {}, () => [l(d, {
258
- size: f.drawerAvatarSize,
259
- src: q.value.src
260
- }, {
261
- default: C(() => [c(b(V.value?.slice(0, 1)), 1)]),
262
- _: 1
263
- }, 8, ["size", "src"])], !0)]), s("div", Te, [s("div", Ee, [v(e.$slots, "drawer-name", {}, () => [s("strong", De, b(V.value), 1)], !0), qe.value ? (g(), o("span", Oe, b(G.value), 1)) : a("", !0)]), s("div", ke, [H.value ? (g(), o("span", Ae, b(x(F)("components.userAvatarInfo.fieldId")) + ": " + b(H.value), 1)) : a("", !0), X.value ? (g(), o("span", je, b(X.value), 1)) : a("", !0)])])]), s("section", Me, [(g(!0), o(ee, null, ne($e.value, (e) => (g(), o("div", {
264
- key: e.key,
265
- class: "user-avatar-info__field-card"
266
- }, [s("div", Ne, [(g(), i(re(e.icon), {
267
- size: 18,
268
- "stroke-width": 2.2
269
- }))]), s("div", Pe, [s("div", Fe, b(e.label), 1), s("div", Ie, b(e.value), 1)])]))), 128))])]))]),
270
- _: 3
271
- }, 16, ["modelValue", "size"])) : a("", !0)]);
272
- };
273
- }
274
- }), [["__scopeId", "data-v-4bc5f50f"]]);
275
- export { M as t };