china-mobile-international-custom-components 0.0.30 → 0.0.32

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.
@@ -0,0 +1,302 @@
1
+ import { w as B } from "./index.bCzIhWFw.js";
2
+ import { computed as u, createElementBlock as b, createCommentVNode as E, openBlock as i, Fragment as I, createElementVNode as v, toDisplayString as g, normalizeClass as M, createBlock as A, renderList as P, unref as p, withCtx as D, ref as C, watch as U, onMounted as z, createVNode as F, createTextVNode as _, nextTick as H } from "vue";
3
+ import { ElPopover as $, ElButton as O } from "element-plus";
4
+ import { _ as W } from "./_plugin-vue_export-helper.CHgC5LLL.js";
5
+ import '../assets/index2.css';const R = {
6
+ ALL: !0,
7
+ PARTIAL: !1
8
+ }, Y = [
9
+ {
10
+ value: R.ALL,
11
+ label: "全部成员"
12
+ },
13
+ {
14
+ value: R.PARTIAL,
15
+ label: "部分成员"
16
+ }
17
+ ], m = {
18
+ MEMBER: 1,
19
+ DEPARTMENT: 2
20
+ }, ne = {
21
+ label: "memberName",
22
+ children: "children",
23
+ value: "memberId"
24
+ }, S = {
25
+ one: 1,
26
+ two: 2
27
+ }, ae = {
28
+ UNPUBLISHED: 0,
29
+ // 未发布
30
+ UNDER_REVIEW: 1,
31
+ // 审核中
32
+ PUBLISHED: 2,
33
+ // 已发布
34
+ REJECTED: 3,
35
+ // 审核不通过
36
+ FAILED: 4
37
+ // 发布失败
38
+ }, q = {
39
+ key: 0,
40
+ class: "pd-l-16 text-dee0e3 pd-r-16"
41
+ }, G = { class: "fz-14 text-646a73 nowrap" }, J = { class: "tag-item nowrap fz-12 pd-l-8 pd-r-8 radius-4 bg-eaf0fe text-3271fe pointer" }, j = { class: "tag-list-popover overflow-y-auto flex gap-4 flex-wrap" }, K = {
42
+ __name: "TagList",
43
+ props: {
44
+ // 显示的标签
45
+ label: {
46
+ type: String,
47
+ required: !0
48
+ },
49
+ // 数据项列表
50
+ items: {
51
+ type: Array,
52
+ default: () => []
53
+ },
54
+ // 默认显示的数量
55
+ defaultShowCount: {
56
+ type: Number,
57
+ default: S.one
58
+ },
59
+ // 是否为只读模式
60
+ readonly: {
61
+ type: Boolean,
62
+ default: !1
63
+ }
64
+ },
65
+ setup(e) {
66
+ const t = e, n = u(() => t.readonly ? t.items : t.items.slice(0, t.defaultShowCount)), d = u(() => t.items.length > t.defaultShowCount), f = u(() => t.items.length - t.defaultShowCount), h = u(() => t.items.slice(t.defaultShowCount));
67
+ return (a, o) => e.items.length > 0 ? (i(), b(I, { key: 0 }, [
68
+ e.readonly ? E("", !0) : (i(), b("span", q, "|")),
69
+ v("span", G, g(e.label), 1),
70
+ v("div", {
71
+ class: M(["tag-list", { "flex items-center gap-4": !e.readonly }])
72
+ }, [
73
+ (i(!0), b(I, null, P(n.value, (s) => (i(), b("div", {
74
+ key: s.memberId,
75
+ class: M(["tag-item fz-12 pd-l-8 pd-r-8 radius-4 bg-eaf0fe text-3271fe", { "mg-r-4 mg-b-4": e.readonly }])
76
+ }, g(s.memberName), 3))), 128)),
77
+ !e.readonly && d.value ? (i(), A(p($), {
78
+ key: 0,
79
+ placement: "top",
80
+ trigger: "click",
81
+ width: "300"
82
+ }, {
83
+ reference: D(() => [
84
+ v("span", J, " +" + g(f.value), 1)
85
+ ]),
86
+ default: D(() => [
87
+ v("div", j, [
88
+ (i(!0), b(I, null, P(h.value, (s) => (i(), b("span", {
89
+ key: s.memberId,
90
+ class: "tag-item nowrap fz-12 pd-l-8 pd-r-8 radius-4 bg-eaf0fe text-3271fe"
91
+ }, g(s.memberName), 1))), 128))
92
+ ])
93
+ ]),
94
+ _: 1
95
+ })) : E("", !0)
96
+ ], 2)
97
+ ], 64)) : E("", !0);
98
+ }
99
+ }, N = /* @__PURE__ */ W(K, [["__scopeId", "data-v-bf564085"]]), L = (e, t) => e?.filter(t) || [], w = (e, t) => L(e, (n) => n.memberType === t), x = (e, t) => {
100
+ if (e.children)
101
+ for (const n of e.children)
102
+ n.memberType === m.MEMBER ? t(n) : n.memberType === m.DEPARTMENT && x(n, t);
103
+ }, k = (e) => {
104
+ const t = [];
105
+ return x(e, (n) => t.push(n.memberId)), t;
106
+ };
107
+ function Q(e, t, n = !1) {
108
+ const d = u(() => {
109
+ if (!e.value) return [];
110
+ const a = [...e.value], o = w(
111
+ a,
112
+ m.DEPARTMENT
113
+ );
114
+ if (o.length > 0 && t.value && t.value.length > 0) {
115
+ const s = /* @__PURE__ */ new Set();
116
+ o.forEach((r) => {
117
+ const c = (y) => {
118
+ for (const T of y) {
119
+ if (T.memberType === m.DEPARTMENT && T.memberId === r.memberId)
120
+ return x(
121
+ T,
122
+ (V) => s.add(V)
123
+ ), !0;
124
+ if (T.children && c(T.children))
125
+ return !0;
126
+ }
127
+ return !1;
128
+ };
129
+ c(t.value);
130
+ });
131
+ const l = new Set(
132
+ w(a, m.MEMBER).map(
133
+ (r) => r.memberId
134
+ )
135
+ );
136
+ s.forEach((r) => {
137
+ l.has(r.memberId) || a.push(r);
138
+ });
139
+ }
140
+ return a;
141
+ }), f = u(() => {
142
+ if (n)
143
+ return w(
144
+ d.value,
145
+ m.MEMBER
146
+ );
147
+ {
148
+ const a = /* @__PURE__ */ new Set();
149
+ return h.value.forEach((o) => {
150
+ k(o).forEach((l) => a.add(l));
151
+ }), L(
152
+ d.value,
153
+ (o) => o.memberType === m.MEMBER && !a.has(o.memberId)
154
+ );
155
+ }
156
+ }), h = u(() => {
157
+ if (n)
158
+ return w(
159
+ d.value,
160
+ m.DEPARTMENT
161
+ );
162
+ {
163
+ const a = [], o = (l) => {
164
+ if (!l.children || l.children.length === 0) return !1;
165
+ const r = k(l);
166
+ return r.length === 0 ? !1 : r.every(
167
+ (c) => d.value.some(
168
+ (y) => y.memberType === m.MEMBER && y.memberId === c
169
+ )
170
+ );
171
+ }, s = (l, r = !1) => {
172
+ if (l.memberType === m.DEPARTMENT) {
173
+ const c = o(l);
174
+ if (c && !r) {
175
+ if (a.push({
176
+ memberId: l.memberId,
177
+ memberName: l.memberName,
178
+ memberType: m.DEPARTMENT,
179
+ children: l.children
180
+ }), l.children)
181
+ for (const y of l.children)
182
+ s(y, !0);
183
+ } else if (!c && l.children)
184
+ for (const y of l.children)
185
+ s(y, !1);
186
+ }
187
+ };
188
+ for (const l of t.value)
189
+ s(l, !1);
190
+ return a;
191
+ }
192
+ });
193
+ return {
194
+ selectedMembers: f,
195
+ selectedDepartments: h
196
+ };
197
+ }
198
+ const X = { class: "fz-14 text-1f2329" }, Z = {
199
+ __name: "layout",
200
+ props: {
201
+ // 当前选择的范围类型(是否全部可见)
202
+ allVisible: {
203
+ type: Boolean,
204
+ default: R.ALL
205
+ },
206
+ // 选中的项目列表(完整对象数组,由父组件根据ID从树中查找得到)
207
+ modelValue: {
208
+ type: Array,
209
+ default: () => []
210
+ },
211
+ // 完整的树形数据(用于判断部门成员是否全部选中)
212
+ treeList: {
213
+ type: Array,
214
+ default: () => []
215
+ },
216
+ // 是否为只读模式
217
+ readonly: {
218
+ type: Boolean,
219
+ default: !1
220
+ }
221
+ },
222
+ setup(e, { expose: t }) {
223
+ const n = C(null), d = () => {
224
+ n.value && H(() => {
225
+ n.value.scrollIntoView({
226
+ behavior: "smooth",
227
+ block: "center"
228
+ });
229
+ });
230
+ }, f = e, { selectedMembers: h, selectedDepartments: a } = Q(
231
+ u(() => f.modelValue),
232
+ u(() => f.treeList),
233
+ f.readonly
234
+ ), o = u(() => {
235
+ const l = h.value.length > 0, r = a.value.length > 0;
236
+ return l && !r || !l && r ? S.two : S.one;
237
+ }), s = u(() => [...h.value, ...a.value]);
238
+ return U(
239
+ () => [f.allVisible, f.modelValue],
240
+ () => {
241
+ d();
242
+ },
243
+ { immediate: !1, deep: !0 }
244
+ ), z(() => {
245
+ d();
246
+ }), t({
247
+ allSelectedItems: s
248
+ }), (l, r) => (i(), b("div", {
249
+ ref_key: "previewRef",
250
+ ref: n,
251
+ class: M(["available-range-preview w-full overflow-hidden", {
252
+ "flex items-center": !e.readonly
253
+ }])
254
+ }, [
255
+ e.readonly ? E("", !0) : (i(), b(I, { key: 0 }, [
256
+ r[2] || (r[2] = v("div", { class: "text-1f2329" }, "可用范围:", -1)),
257
+ v("span", X, g(p(Y).find((c) => c.value === e.allVisible)?.label), 1),
258
+ F(p(O), {
259
+ class: "mg-l-16",
260
+ type: "primary",
261
+ link: "",
262
+ onClick: r[0] || (r[0] = (c) => l.$emit("edit"))
263
+ }, {
264
+ default: D(() => [...r[1] || (r[1] = [
265
+ _(" 编辑 ", -1)
266
+ ])]),
267
+ _: 1
268
+ })
269
+ ], 64)),
270
+ e.allVisible === p(R).PARTIAL ? (i(), b("div", {
271
+ key: 1,
272
+ class: M(["flex-1 overflow-hidden", { "flex items-center": !e.readonly }])
273
+ }, [
274
+ p(h)?.length ? (i(), A(N, {
275
+ key: 0,
276
+ label: "成员:",
277
+ items: p(h),
278
+ "default-show-count": o.value,
279
+ readonly: e.readonly
280
+ }, null, 8, ["items", "default-show-count", "readonly"])) : E("", !0),
281
+ p(a)?.length ? (i(), A(N, {
282
+ key: 1,
283
+ label: "部门:",
284
+ items: p(a),
285
+ "default-show-count": o.value,
286
+ readonly: e.readonly
287
+ }, null, 8, ["items", "default-show-count", "readonly"])) : E("", !0)
288
+ ], 2)) : E("", !0)
289
+ ], 2));
290
+ }
291
+ }, se = B(Z), oe = B(N);
292
+ export {
293
+ se as A,
294
+ S as D,
295
+ m as M,
296
+ ae as P,
297
+ R,
298
+ oe as T,
299
+ ne as a,
300
+ Y as r,
301
+ Q as u
302
+ };