disguise-ui 0.2.3 → 0.2.5

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.
Files changed (35) hide show
  1. package/dist/avatar-cell-BPzpEjQT.js +31 -0
  2. package/dist/context-DqlD6qDJ.js +50 -0
  3. package/dist/disguise-ui.js +1540 -1539
  4. package/dist/file-upload-BkRSvBlx.js +4 -0
  5. package/dist/{file-upload-g-PauJpk.js → file-upload-CeqibzK8.js} +5 -5
  6. package/dist/{i18n-DQW_MS90.js → i18n-DejVnxC8.js} +1 -1
  7. package/dist/{picture-upload-KEFFSvsi.js → picture-upload-E97PfpUU.js} +3 -3
  8. package/dist/{picture-upload-vp1RCUJo.js → picture-upload-uc9FsqEo.js} +1 -1
  9. package/dist/style.css +1 -1
  10. package/dist/types/components/async-select/async-select.vue.d.ts +1 -1
  11. package/dist/types/components/dialog-list/index.vue.d.ts +10 -10
  12. package/dist/types/components/dict-tag/index.vue.d.ts +1 -1
  13. package/dist/types/components/drawer-form-page/index.vue.d.ts +2 -2
  14. package/dist/types/components/file-upload/components/file-status.vue.d.ts +1 -1
  15. package/dist/types/components/file-upload/file-upload.vue.d.ts +2 -2
  16. package/dist/types/components/image-upload/index.vue.d.ts +2 -2
  17. package/dist/types/components/images-view/index.vue.d.ts +1 -1
  18. package/dist/types/components/picture-upload/picture-upload.vue.d.ts +2 -2
  19. package/dist/types/components/rich-text-editor/index.vue.d.ts +1 -1
  20. package/dist/types/components/schema-form/index.d.ts +1 -1
  21. package/dist/types/components/schema-form/schema-form.type.d.ts +7 -3
  22. package/dist/types/components/schema-form/schema-form.vue.d.ts +1 -1
  23. package/dist/types/components/schema-form/translate-field.vue.d.ts +1 -1
  24. package/dist/types/components/schema-form/translate-toolbar.vue.d.ts +3 -3
  25. package/dist/types/components/search-form/index.vue.d.ts +1 -1
  26. package/dist/types/components/table-entity/index.vue.d.ts +2 -2
  27. package/dist/types/index.d.ts +5 -1
  28. package/dist/types/runtime/context.d.ts +3321 -0
  29. package/dist/types/setup.d.ts +1 -1
  30. package/dist/{use-image-url-hImb4UEO.js → use-image-url-Bs5WMZ6L.js} +1 -1
  31. package/dist/{use-multiple-file-upload-BrhklFSk.js → use-multiple-file-upload-BFNkLVy-.js} +3 -3
  32. package/dist/user-avatar-info-SD6OE607.js +276 -0
  33. package/package.json +1 -1
  34. package/dist/avatar-cell-BzklaM_h.js +0 -302
  35. package/dist/context-CpMT_OSb.js +0 -34
@@ -4,4 +4,4 @@ import type { DisguiseOptions } from './runtime/context';
4
4
  * 组件不直接依赖具体后台,这些能力都从这里进入。
5
5
  */
6
6
  export declare function setupDisguise(options?: DisguiseOptions): void;
7
- export type { DisguiseOptions } from './runtime/context';
7
+ export type { DisguiseOptions, PaginationConfig } from './runtime/context';
@@ -1,4 +1,4 @@
1
- import { s as e } from "./context-CpMT_OSb.js";
1
+ import { s as e } from "./context-DqlD6qDJ.js";
2
2
  // src/composables/use-image-url.ts
3
3
  var t = () => {
4
4
  function t(t) {
@@ -1,6 +1,6 @@
1
- import { o as e } from "./context-CpMT_OSb.js";
2
- import { n as t } from "./i18n-DQW_MS90.js";
3
- import { t as n } from "./use-image-url-hImb4UEO.js";
1
+ import { o as e } from "./context-DqlD6qDJ.js";
2
+ import { n as t } from "./i18n-DejVnxC8.js";
3
+ import { t as n } from "./use-image-url-Bs5WMZ6L.js";
4
4
  import { t as r } from "./use-file-type-rNstoxXw.js";
5
5
  import { computed as i, ref as a, watch as o } from "vue";
6
6
  import { ElMessage as s } from "element-plus";
@@ -0,0 +1,276 @@
1
+ import { n as e } from "./i18n-DejVnxC8.js";
2
+ import { t } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
3
+ import { t as n } from "./use-image-url-Bs5WMZ6L.js";
4
+ 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";
5
+ 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";
6
+ // src/components/user-avatar-info/index.vue?vue&type=script&setup=true&lang.ts
7
+ var _e = { class: "user-avatar-info-root" }, ve = {
8
+ key: 0,
9
+ class: "user-avatar-info__loading"
10
+ }, ye = { class: "user-avatar-info__skeleton-row" }, be = { class: "user-avatar-info__skeleton-text" }, xe = [
11
+ "role",
12
+ "tabindex",
13
+ "aria-label",
14
+ "aria-disabled"
15
+ ], Se = { class: "user-avatar-info__avatar-wrap" }, T = { class: "user-avatar-info__name" }, E = {
16
+ key: 0,
17
+ class: "user-avatar-info__subtitle-wrap"
18
+ }, D = { class: "user-avatar-info__tooltip-text displaySubtitle" }, O = { class: "row-detail-drawer__header" }, k = { class: "row-detail-drawer__title" }, A = {
19
+ key: 0,
20
+ class: "user-avatar-info__drawer-slot"
21
+ }, j = {
22
+ key: 1,
23
+ class: "user-avatar-info__drawer"
24
+ }, 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 = {
25
+ key: 0,
26
+ class: "user-avatar-info__hero-gender"
27
+ }, 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({
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(t, { expose: u }) {
63
+ let f = t, { ensureImageBaseUrl: M, resolveImageUrl: Le } = n();
64
+ M();
65
+ let N = ie(t, "drawerVisible"), P = _(!1);
66
+ S(N, (e) => {
67
+ e && (P.value = !0);
68
+ }, { immediate: !0 });
69
+ function Re() {
70
+ P.value = !1;
71
+ }
72
+ 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(() => {
73
+ if (f.gender !== void 0 && f.gender !== null && f.gender !== "") return f.gender;
74
+ let e = f.sex;
75
+ return e === "0" ? "male" : e === "1" ? "female" : "unknown";
76
+ }), W = r(() => {
77
+ let e = L.value?.sex;
78
+ return e === "0" ? "male" : e === "1" ? "female" : "unknown";
79
+ }), 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(() => ({
80
+ "user-avatar-info__meta--male": U.value === "male",
81
+ "user-avatar-info__meta--female": U.value === "female"
82
+ })), 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(() => ({
83
+ ...f.avatar,
84
+ size: f.size,
85
+ src: Le(f.src || "--"),
86
+ shape: "circle"
87
+ })), Qe = r(() => f.drawerTitle ?? F("components.userAvatarInfo.drawerTitle")), J = {
88
+ avatar: d(fe),
89
+ name: d(he),
90
+ gender: d(w),
91
+ age: d(ue),
92
+ workYears: d(de),
93
+ email: d(pe),
94
+ phone: d(me),
95
+ department: d(le),
96
+ jobLevel: d(se),
97
+ position: d(ce)
98
+ }, $e = r(() => [
99
+ {
100
+ key: "name",
101
+ label: F("components.userAvatarInfo.fieldName"),
102
+ icon: J.name,
103
+ value: V.value
104
+ },
105
+ {
106
+ key: "gender",
107
+ label: F("components.userAvatarInfo.fieldGender"),
108
+ icon: J.gender,
109
+ value: G.value
110
+ },
111
+ {
112
+ key: "age",
113
+ label: F("components.userAvatarInfo.fieldAge"),
114
+ icon: J.age,
115
+ value: Y(Ue.value)
116
+ },
117
+ {
118
+ key: "workYears",
119
+ label: F("components.userAvatarInfo.fieldWorkYears"),
120
+ icon: J.workYears,
121
+ value: Y(We.value)
122
+ },
123
+ {
124
+ key: "jobLevel",
125
+ label: F("components.userAvatarInfo.fieldJobLevel"),
126
+ icon: J.position,
127
+ value: Y(Ge.value)
128
+ },
129
+ {
130
+ key: "phone",
131
+ label: F("components.userAvatarInfo.fieldPhone"),
132
+ icon: J.phone,
133
+ value: Y(L.value?.phonenumber ?? "")
134
+ },
135
+ {
136
+ key: "email",
137
+ label: F("components.userAvatarInfo.fieldEmail"),
138
+ icon: J.email,
139
+ value: Y(L.value?.email ?? "")
140
+ },
141
+ {
142
+ key: "department",
143
+ label: F("components.userAvatarInfo.fieldDepartment"),
144
+ icon: J.department,
145
+ value: X.value
146
+ }
147
+ ]), et = r(() => ({
148
+ appendToBody: !0,
149
+ destroyOnClose: !1,
150
+ ...f.drawerProps
151
+ })), tt = r(() => f.enableDrawer ? `${F("components.userAvatarInfo.ariaLabel")}, ${F("components.userAvatarInfo.clickToViewDetail")}` : F("components.userAvatarInfo.ariaLabel"));
152
+ function Y(e) {
153
+ return e == null || e === "" ? F("components.userAvatarInfo.empty") : String(e);
154
+ }
155
+ let X = r(() => Y(L.value?.dept?.deptName ?? ""));
156
+ function nt() {
157
+ f.enableDrawer && (N.value = !0);
158
+ }
159
+ function rt(e) {
160
+ f.enableDrawer && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), N.value = !0);
161
+ }
162
+ let Z = _(null), Q = _(!1);
163
+ function $() {
164
+ let e = Z.value;
165
+ e ? Q.value = e.scrollWidth > e.clientWidth + 1 : Q.value = !1;
166
+ }
167
+ oe((e) => {
168
+ let t = Z.value;
169
+ if (!t || typeof ResizeObserver > "u") {
170
+ Q.value = !1;
171
+ return;
172
+ }
173
+ $();
174
+ let n = new ResizeObserver(() => $());
175
+ n.observe(t), e(() => n.disconnect());
176
+ }), S(() => B.value, () => m($));
177
+ function it() {
178
+ N.value = !0;
179
+ }
180
+ function at() {
181
+ N.value = !1;
182
+ }
183
+ return u({
184
+ openDrawer: it,
185
+ closeDrawer: at,
186
+ remoteUser: L,
187
+ remoteDetail: I
188
+ }), (e, n) => {
189
+ let r = y("el-skeleton-item"), u = y("el-skeleton"), d = y("el-avatar"), m = y("el-tooltip"), _ = y("el-drawer");
190
+ return g(), o("div", _e, [He.value ? (g(), o("div", ve, [l(u, { animated: "" }, {
191
+ template: C(() => [s("div", ye, [l(r, {
192
+ variant: "circle",
193
+ style: te({
194
+ width: `${t.size}px`,
195
+ height: `${t.size}px`
196
+ })
197
+ }, null, 8, ["style"]), s("div", be, [l(r, {
198
+ variant: "p",
199
+ style: { width: "55%" }
200
+ }), l(r, {
201
+ variant: "p",
202
+ style: { width: "40%" }
203
+ })])])]),
204
+ _: 1
205
+ })])) : (g(), o("div", {
206
+ key: 1,
207
+ class: h(["user-avatar-info", { "user-avatar-info--clickable": t.enableDrawer }]),
208
+ role: t.enableDrawer ? "button" : void 0,
209
+ tabindex: t.enableDrawer ? 0 : void 0,
210
+ "aria-label": tt.value,
211
+ "aria-disabled": !t.enableDrawer,
212
+ onClick: nt,
213
+ onKeydown: rt
214
+ }, [s("div", Se, [
215
+ l(d, p({ class: "user-avatar-info__avatar" }, q.value), {
216
+ default: C(() => [v(e.$slots, "avatar", {}, () => [c(b(z.value?.slice(0, 1)), 1)], !0)]),
217
+ _: 3
218
+ }, 16),
219
+ Ye.value ? (g(), o("span", {
220
+ key: 0,
221
+ class: h(["user-avatar-info__gender-badge", `user-avatar-info__gender-badge--${U.value}`]),
222
+ "aria-hidden": "true"
223
+ }, [U.value === "male" ? (g(), i(x(w), {
224
+ key: 0,
225
+ size: K.value,
226
+ "stroke-width": 2.5
227
+ }, null, 8, ["size"])) : (g(), i(x(ge), {
228
+ key: 1,
229
+ size: K.value,
230
+ "stroke-width": 2.5
231
+ }, null, 8, ["size"]))], 2)) : a("", !0),
232
+ Xe.value ? (g(), o("span", {
233
+ key: 1,
234
+ class: h(["user-avatar-info__presence-badge", { "user-avatar-info__presence-badge--online": Ze.value }]),
235
+ "aria-hidden": "true"
236
+ }, null, 2)) : a("", !0)
237
+ ]), 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, {
238
+ placement: "top",
239
+ disabled: !Q.value,
240
+ "show-after": 200,
241
+ "popper-class": "user-avatar-info-tooltip"
242
+ }, {
243
+ content: C(() => [s("div", D, [v(e.$slots, "subtitle", {}, () => [c(b(B.value), 1)], !0)])]),
244
+ default: C(() => [s("div", {
245
+ ref_key: "subtitleRef",
246
+ ref: Z,
247
+ class: h(["user-avatar-info__subtitle", { "user-avatar-info__subtitle--overflow": Q.value }])
248
+ }, [v(e.$slots, "subtitle", {}, () => [c(b(B.value), 1)], !0)], 2)]),
249
+ _: 3
250
+ }, 8, ["disabled"])])) : a("", !0)], 2)], 42, xe)), P.value ? (g(), i(_, p({
251
+ key: 2,
252
+ modelValue: N.value,
253
+ "onUpdate:modelValue": n[0] ||= (e) => N.value = e,
254
+ size: t.drawerSize,
255
+ class: "user-avatar-info-drawer row-detail-drawer"
256
+ }, et.value, { onClosed: Re }), {
257
+ header: C(() => [s("div", O, [s("span", k, b(Qe.value), 1)])]),
258
+ 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, {
259
+ size: f.drawerAvatarSize,
260
+ src: q.value.src
261
+ }, {
262
+ default: C(() => [c(b(V.value?.slice(0, 1)), 1)]),
263
+ _: 1
264
+ }, 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)("field.id")) + ": " + 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", {
265
+ key: e.key,
266
+ class: "user-avatar-info__field-card"
267
+ }, [s("div", Ne, [(g(), i(re(e.icon), {
268
+ size: 18,
269
+ "stroke-width": 2.2
270
+ }))]), s("div", Pe, [s("div", Fe, b(e.label), 1), s("div", Ie, b(e.value), 1)])]))), 128))])]))]),
271
+ _: 3
272
+ }, 16, ["modelValue", "size"])) : a("", !0)]);
273
+ };
274
+ }
275
+ }), [["__scopeId", "data-v-5b19a12c"]]);
276
+ export { M as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disguise-ui",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Disguise:可独立使用的后台列表、表单和上传组件",
5
5
  "type": "module",
6
6
  "files": [
@@ -1,302 +0,0 @@
1
- import { n as e } from "./i18n-DQW_MS90.js";
2
- import { t } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
3
- import { t as n } from "./use-image-url-hImb4UEO.js";
4
- import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, markRaw as f, mergeModels as p, mergeProps as m, nextTick as h, normalizeClass as g, normalizeStyle as ee, openBlock as _, ref as v, renderList as te, renderSlot as y, resolveComponent as b, resolveDynamicComponent as ne, toDisplayString as x, unref as S, useModel as re, useSlots as ie, watch as C, watchEffect as ae, withCtx as w } from "vue";
5
- import { Badge as oe, Briefcase as se, Building2 as ce, Cake as le, CalendarDays as ue, Image as de, Mail as fe, Mars as T, Phone as pe, User as me, Venus as he } from "lucide-vue-next";
6
- // src/components/user-avatar-info/index.vue?vue&type=script&setup=true&lang.ts
7
- var ge = { class: "user-avatar-info-root" }, _e = {
8
- key: 0,
9
- class: "user-avatar-info__loading"
10
- }, ve = { class: "user-avatar-info__skeleton-row" }, ye = { class: "user-avatar-info__skeleton-text" }, be = [
11
- "role",
12
- "tabindex",
13
- "aria-label",
14
- "aria-disabled"
15
- ], xe = { class: "user-avatar-info__avatar-wrap" }, Se = { class: "user-avatar-info__name" }, Ce = {
16
- key: 0,
17
- class: "user-avatar-info__subtitle-wrap"
18
- }, E = { class: "user-avatar-info__tooltip-text displaySubtitle" }, D = { class: "row-detail-drawer__header" }, O = { class: "row-detail-drawer__title" }, k = {
19
- key: 0,
20
- class: "user-avatar-info__drawer-slot"
21
- }, A = {
22
- key: 1,
23
- class: "user-avatar-info__drawer"
24
- }, we = { class: "user-avatar-info__hero" }, Te = { class: "user-avatar-info__hero-avatar" }, Ee = { class: "user-avatar-info__hero-main" }, De = { class: "user-avatar-info__hero-name-row" }, Oe = { class: "user-avatar-info__hero-name" }, ke = {
25
- key: 0,
26
- class: "user-avatar-info__hero-gender"
27
- }, Ae = { class: "user-avatar-info__hero-meta" }, je = { key: 0 }, Me = { key: 1 }, Ne = { class: "user-avatar-info__card-grid" }, Pe = { class: "user-avatar-info__field-icon" }, Fe = { class: "user-avatar-info__field-content" }, Ie = { class: "user-avatar-info__field-label" }, Le = { class: "user-avatar-info__field-value" }, j = /*#__PURE__*/ t(/* @__PURE__ */ d({
28
- __name: "index",
29
- props: /*@__PURE__*/ p({
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(t, { expose: d }) {
63
- let p = t, { ensureImageBaseUrl: j, resolveImageUrl: M } = n();
64
- j();
65
- let N = re(t, "drawerVisible"), P = v(!1);
66
- C(N, (e) => {
67
- e && (P.value = !0);
68
- }, { immediate: !0 });
69
- function Re() {
70
- P.value = !1;
71
- }
72
- let { t: F } = e(), ze = ie(), I = i(() => null), L = i(() => I.value?.data), Be = i(() => !1), Ve = i(() => !1), R = i(() => ({ isUserOnline: (e) => !1 })).value, He = i(() => Be.value && Ve.value && !I.value), z = i(() => p.nickName || p.name || ""), B = i(() => p.subtitle || p.deptName || ""), Ue = i(() => p.age), We = i(() => p.workYears), Ge = i(() => p.jobLevel), V = i(() => L.value?.nickName ?? L.value?.userName ?? ""), H = i(() => L.value?.userId ?? p.userId), Ke = i(() => !!ze.default), U = i(() => {
73
- if (p.gender !== void 0 && p.gender !== null && p.gender !== "") return p.gender;
74
- let e = p.sex;
75
- return e === "0" ? "male" : e === "1" ? "female" : "unknown";
76
- }), W = i(() => {
77
- let e = L.value?.sex;
78
- return e === "0" ? "male" : e === "1" ? "female" : "unknown";
79
- }), G = i(() => W.value === "male" ? F("components.userAvatarInfo.genderMale") : W.value === "female" ? F("components.userAvatarInfo.genderFemale") : F("components.userAvatarInfo.genderUnknown")), qe = i(() => W.value === "male" || W.value === "female"), Je = i(() => ({
80
- "user-avatar-info__meta--male": U.value === "male",
81
- "user-avatar-info__meta--female": U.value === "female"
82
- })), Ye = i(() => U.value === "male" || U.value === "female"), Xe = i(() => p.userId != null && String(p.userId) !== ""), Ze = i(() => R.isUserOnline(p.userId == null ? null : String(p.userId))), K = i(() => Math.max(10, Math.min(16, Math.round(p.size * .36)))), q = i(() => ({
83
- ...p.avatar,
84
- size: p.size,
85
- src: M(p.src || "--"),
86
- shape: "circle"
87
- })), Qe = i(() => p.drawerTitle ?? F("components.userAvatarInfo.drawerTitle")), J = {
88
- avatar: f(de),
89
- name: f(me),
90
- gender: f(T),
91
- age: f(le),
92
- workYears: f(ue),
93
- email: f(fe),
94
- phone: f(pe),
95
- department: f(ce),
96
- jobLevel: f(oe),
97
- position: f(se)
98
- }, $e = i(() => [
99
- {
100
- key: "name",
101
- label: F("components.userAvatarInfo.fieldName"),
102
- icon: J.name,
103
- value: V.value
104
- },
105
- {
106
- key: "gender",
107
- label: F("components.userAvatarInfo.fieldGender"),
108
- icon: J.gender,
109
- value: G.value
110
- },
111
- {
112
- key: "age",
113
- label: F("components.userAvatarInfo.fieldAge"),
114
- icon: J.age,
115
- value: Y(Ue.value)
116
- },
117
- {
118
- key: "workYears",
119
- label: F("components.userAvatarInfo.fieldWorkYears"),
120
- icon: J.workYears,
121
- value: Y(We.value)
122
- },
123
- {
124
- key: "jobLevel",
125
- label: F("components.userAvatarInfo.fieldJobLevel"),
126
- icon: J.position,
127
- value: Y(Ge.value)
128
- },
129
- {
130
- key: "phone",
131
- label: F("components.userAvatarInfo.fieldPhone"),
132
- icon: J.phone,
133
- value: Y(L.value?.phonenumber ?? "")
134
- },
135
- {
136
- key: "email",
137
- label: F("components.userAvatarInfo.fieldEmail"),
138
- icon: J.email,
139
- value: Y(L.value?.email ?? "")
140
- },
141
- {
142
- key: "department",
143
- label: F("components.userAvatarInfo.fieldDepartment"),
144
- icon: J.department,
145
- value: X.value
146
- }
147
- ]), et = i(() => ({
148
- appendToBody: !0,
149
- destroyOnClose: !1,
150
- ...p.drawerProps
151
- })), tt = i(() => p.enableDrawer ? `${F("components.userAvatarInfo.ariaLabel")}, ${F("components.userAvatarInfo.clickToViewDetail")}` : F("components.userAvatarInfo.ariaLabel"));
152
- function Y(e) {
153
- return e == null || e === "" ? F("components.userAvatarInfo.empty") : String(e);
154
- }
155
- let X = i(() => Y(L.value?.dept?.deptName ?? ""));
156
- function nt() {
157
- p.enableDrawer && (N.value = !0);
158
- }
159
- function rt(e) {
160
- p.enableDrawer && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), N.value = !0);
161
- }
162
- let Z = v(null), Q = v(!1);
163
- function $() {
164
- let e = Z.value;
165
- e ? Q.value = e.scrollWidth > e.clientWidth + 1 : Q.value = !1;
166
- }
167
- ae((e) => {
168
- let t = Z.value;
169
- if (!t || typeof ResizeObserver > "u") {
170
- Q.value = !1;
171
- return;
172
- }
173
- $();
174
- let n = new ResizeObserver(() => $());
175
- n.observe(t), e(() => n.disconnect());
176
- }), C(() => B.value, () => h($));
177
- function it() {
178
- N.value = !0;
179
- }
180
- function at() {
181
- N.value = !1;
182
- }
183
- return d({
184
- openDrawer: it,
185
- closeDrawer: at,
186
- remoteUser: L,
187
- remoteDetail: I
188
- }), (e, n) => {
189
- let i = b("el-skeleton-item"), d = b("el-skeleton"), f = b("el-avatar"), h = b("el-tooltip"), v = b("el-drawer");
190
- return _(), s("div", ge, [He.value ? (_(), s("div", _e, [u(d, { animated: "" }, {
191
- template: w(() => [c("div", ve, [u(i, {
192
- variant: "circle",
193
- style: ee({
194
- width: `${t.size}px`,
195
- height: `${t.size}px`
196
- })
197
- }, null, 8, ["style"]), c("div", ye, [u(i, {
198
- variant: "p",
199
- style: { width: "55%" }
200
- }), u(i, {
201
- variant: "p",
202
- style: { width: "40%" }
203
- })])])]),
204
- _: 1
205
- })])) : (_(), s("div", {
206
- key: 1,
207
- class: g(["user-avatar-info", { "user-avatar-info--clickable": t.enableDrawer }]),
208
- role: t.enableDrawer ? "button" : void 0,
209
- tabindex: t.enableDrawer ? 0 : void 0,
210
- "aria-label": tt.value,
211
- "aria-disabled": !t.enableDrawer,
212
- onClick: nt,
213
- onKeydown: rt
214
- }, [c("div", xe, [
215
- u(f, m({ class: "user-avatar-info__avatar" }, q.value), {
216
- default: w(() => [y(e.$slots, "avatar", {}, () => [l(x(z.value?.slice(0, 1)), 1)], !0)]),
217
- _: 3
218
- }, 16),
219
- Ye.value ? (_(), s("span", {
220
- key: 0,
221
- class: g(["user-avatar-info__gender-badge", `user-avatar-info__gender-badge--${U.value}`]),
222
- "aria-hidden": "true"
223
- }, [U.value === "male" ? (_(), a(S(T), {
224
- key: 0,
225
- size: K.value,
226
- "stroke-width": 2.5
227
- }, null, 8, ["size"])) : (_(), a(S(he), {
228
- key: 1,
229
- size: K.value,
230
- "stroke-width": 2.5
231
- }, null, 8, ["size"]))], 2)) : o("", !0),
232
- Xe.value ? (_(), s("span", {
233
- key: 1,
234
- class: g(["user-avatar-info__presence-badge", { "user-avatar-info__presence-badge--online": Ze.value }]),
235
- "aria-hidden": "true"
236
- }, null, 2)) : o("", !0)
237
- ]), c("div", { class: g(["user-avatar-info__meta", Je.value]) }, [c("div", Se, [y(e.$slots, "name", {}, () => [l(x(z.value), 1)], !0)]), B.value || e.$slots.subtitle ? (_(), s("div", Ce, [u(h, {
238
- placement: "top",
239
- disabled: !Q.value,
240
- "show-after": 200,
241
- "popper-class": "user-avatar-info-tooltip"
242
- }, {
243
- content: w(() => [c("div", E, [y(e.$slots, "subtitle", {}, () => [l(x(B.value), 1)], !0)])]),
244
- default: w(() => [c("div", {
245
- ref_key: "subtitleRef",
246
- ref: Z,
247
- class: g(["user-avatar-info__subtitle", { "user-avatar-info__subtitle--overflow": Q.value }])
248
- }, [y(e.$slots, "subtitle", {}, () => [l(x(B.value), 1)], !0)], 2)]),
249
- _: 3
250
- }, 8, ["disabled"])])) : o("", !0)], 2)], 42, be)), P.value ? (_(), a(v, m({
251
- key: 2,
252
- modelValue: N.value,
253
- "onUpdate:modelValue": n[0] ||= (e) => N.value = e,
254
- size: t.drawerSize,
255
- class: "user-avatar-info-drawer row-detail-drawer"
256
- }, et.value, { onClosed: Re }), {
257
- header: w(() => [c("div", D, [c("span", O, x(Qe.value), 1)])]),
258
- default: w(() => [Ke.value ? (_(), s("div", k, [y(e.$slots, "default", {}, void 0, !0)])) : (_(), s("div", A, [c("section", we, [c("div", Te, [y(e.$slots, "drawer-avatar", {}, () => [u(f, {
259
- size: p.drawerAvatarSize,
260
- src: q.value.src
261
- }, {
262
- default: w(() => [l(x(V.value?.slice(0, 1)), 1)]),
263
- _: 1
264
- }, 8, ["size", "src"])], !0)]), c("div", Ee, [c("div", De, [y(e.$slots, "drawer-name", {}, () => [c("strong", Oe, x(V.value), 1)], !0), qe.value ? (_(), s("span", ke, x(G.value), 1)) : o("", !0)]), c("div", Ae, [H.value ? (_(), s("span", je, x(S(F)("field.id")) + ": " + x(H.value), 1)) : o("", !0), X.value ? (_(), s("span", Me, x(X.value), 1)) : o("", !0)])])]), c("section", Ne, [(_(!0), s(r, null, te($e.value, (e) => (_(), s("div", {
265
- key: e.key,
266
- class: "user-avatar-info__field-card"
267
- }, [c("div", Pe, [(_(), a(ne(e.icon), {
268
- size: 18,
269
- "stroke-width": 2.2
270
- }))]), c("div", Fe, [c("div", Ie, x(e.label), 1), c("div", Le, x(e.value), 1)])]))), 128))])]))]),
271
- _: 3
272
- }, 16, ["modelValue", "size"])) : o("", !0)]);
273
- };
274
- }
275
- }), [["__scopeId", "data-v-5b19a12c"]]), M = /* @__PURE__ */ d({
276
- __name: "avatar-cell",
277
- props: {
278
- row: { default: () => ({}) },
279
- value: { default: null }
280
- },
281
- setup(e) {
282
- let t = e, n = i(() => t.row?.userId), r = i(() => t.row?.nickName ?? ""), o = i(() => t.row?.userName ?? ""), s = i(() => t.row?.avatar ?? ""), c = i(() => t.row?.sex ?? ""), l = i(() => t.row?.deptName ?? t.row?.dept?.deptName ?? "");
283
- return (e, t) => (_(), a(j, {
284
- "user-id": n.value,
285
- "nick-name": r.value,
286
- name: o.value,
287
- src: s.value,
288
- avatar: s.value,
289
- sex: c.value,
290
- "dept-name": l.value
291
- }, null, 8, [
292
- "user-id",
293
- "nick-name",
294
- "name",
295
- "src",
296
- "avatar",
297
- "sex",
298
- "dept-name"
299
- ]));
300
- }
301
- });
302
- export { M as default };
@@ -1,34 +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 = null, s, c, l = "";
4
- function u(e) {
5
- e.locale && (t.value = e.locale), e.messages && (n.value = e.messages), e.request && (o = e.request), e.fetchAllDictData && (s = e.fetchAllDictData), e.uploadFile && (c = e.uploadFile), e.imageBaseUrl !== void 0 && (l = e.imageBaseUrl), e.hasAccess && (r.value = e.hasAccess), e.getAccessToken && (i.value = e.getAccessToken), e.cardShadow && (a.value = e.cardShadow);
6
- }
7
- function d() {
8
- return t;
9
- }
10
- function f() {
11
- return n;
12
- }
13
- function p() {
14
- return o;
15
- }
16
- function m() {
17
- return s?.() ?? Promise.resolve({});
18
- }
19
- function h() {
20
- return c;
21
- }
22
- function g() {
23
- return l;
24
- }
25
- function _() {
26
- return r;
27
- }
28
- function v() {
29
- return i.value();
30
- }
31
- function y() {
32
- return a;
33
- }
34
- export { f as a, d as c, y as i, p as l, _ as n, h as o, v as r, g as s, u as t, m as u };