cd-personselector 1.3.6 → 1.3.7
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/index.js +1 -1
- package/dist/index.mjs +117 -115
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/InputSelect.vue +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as Ue, ref as g, computed as D, watch as X, resolveComponent as x, openBlock as o, createBlock as W, withCtx as V, createElementVNode as u, createElementBlock as c, createVNode as k, Fragment as Q, renderList as oe, createCommentVNode as _, normalizeClass as ne, withModifiers as
|
|
1
|
+
import { defineComponent as Ue, ref as g, computed as D, watch as X, resolveComponent as x, openBlock as o, createBlock as W, withCtx as V, createElementVNode as u, createElementBlock as c, createVNode as k, Fragment as Q, renderList as oe, createCommentVNode as _, normalizeClass as ne, withModifiers as ye, toDisplayString as v, createTextVNode as Y, nextTick as $e, normalizeStyle as Ve } from "vue";
|
|
2
2
|
const ze = { class: "cd-ps-container" }, we = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "cd-ps-search"
|
|
5
5
|
}, Be = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "cd-ps-org-select"
|
|
8
|
-
}, Oe = { class: "cd-ps-search-input" }, Pe = { class: "cd-ps-content" }, De = { class: "cd-ps-left" },
|
|
8
|
+
}, Oe = { class: "cd-ps-search-input" }, Pe = { class: "cd-ps-content" }, De = { class: "cd-ps-left" }, Me = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "cd-ps-loading"
|
|
11
|
-
},
|
|
11
|
+
}, Re = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "cd-ps-empty"
|
|
14
|
-
},
|
|
14
|
+
}, Le = {
|
|
15
15
|
key: 2,
|
|
16
16
|
class: "cd-ps-result-list"
|
|
17
17
|
}, Ee = ["onClick"], We = { class: "cd-ps-info" }, je = { class: "cd-ps-name" }, Je = { class: "cd-ps-meta" }, Ae = {
|
|
@@ -35,7 +35,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
35
35
|
}, nt = {
|
|
36
36
|
key: 1,
|
|
37
37
|
class: "cd-ps-selected-list"
|
|
38
|
-
}, ot = { class: "cd-ps-item-info" }, it = { class: "cd-ps-info" }, ct = { class: "cd-ps-name" }, dt = { class: "cd-ps-meta" }, ut = { key: 0 }, rt = { key: 1 }, pt = { key: 2 }, vt = { key: 3 },
|
|
38
|
+
}, ot = { class: "cd-ps-item-info" }, it = { class: "cd-ps-info" }, ct = { class: "cd-ps-name" }, dt = { class: "cd-ps-meta" }, ut = { key: 0 }, rt = { key: 1 }, pt = { key: 2 }, vt = { key: 3 }, ft = /* @__PURE__ */ Ue({
|
|
39
39
|
__name: "PersonSelector",
|
|
40
40
|
props: {
|
|
41
41
|
visible: { type: Boolean, default: !1 },
|
|
@@ -50,8 +50,8 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
50
50
|
},
|
|
51
51
|
emits: ["update:visible", "update:modelValue", "confirm", "load-users", "search", "org-change", "tab-change"],
|
|
52
52
|
setup(b, { expose: Z, emit: U }) {
|
|
53
|
-
var
|
|
54
|
-
const r = b, S = U, I = g(r.visible), C = g(((
|
|
53
|
+
var be, Ce;
|
|
54
|
+
const r = b, S = U, I = g(r.visible), C = g(((Ce = (be = r.tabs) == null ? void 0 : be[0]) == null ? void 0 : Ce.key) || ""), M = g(null), B = g(""), f = g([]), T = g(/* @__PURE__ */ new Map()), G = g({}), $ = g(!1), R = g(!1), L = g({}), K = D(() => r.tabs || []), ie = D(() => r.organizations || []);
|
|
55
55
|
D(() => r.tips || "");
|
|
56
56
|
const ee = D(() => r.showSearch), ue = D(() => r.showOrg), re = D(() => r.dialogWidth), O = g({});
|
|
57
57
|
X(() => r.tabs, (t) => {
|
|
@@ -65,16 +65,16 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
65
65
|
function ce() {
|
|
66
66
|
if (r.modelValue && r.modelValue.length > 0) {
|
|
67
67
|
const t = r.modelValue[0];
|
|
68
|
-
typeof t == "object" && t !== null && "id" in t ? (
|
|
68
|
+
typeof t == "object" && t !== null && "id" in t ? (f.value = r.modelValue.map((e) => e.id), T.value.clear(), r.modelValue.forEach((e) => {
|
|
69
69
|
T.value.set(e.id, e);
|
|
70
|
-
})) :
|
|
70
|
+
})) : f.value = [...r.modelValue];
|
|
71
71
|
} else
|
|
72
|
-
|
|
72
|
+
f.value = [], T.value.clear();
|
|
73
73
|
}
|
|
74
74
|
X(() => r.modelValue, (t) => {
|
|
75
75
|
I.value && t && ce();
|
|
76
76
|
}, { deep: !0 }), X(() => r.visible, (t) => {
|
|
77
|
-
I.value = t, t && (ce(), r.organizations.length > 0 && !
|
|
77
|
+
I.value = t, t && (ce(), r.organizations.length > 0 && !M.value && (M.value = r.organizations[0].id));
|
|
78
78
|
}), X(I, (t) => {
|
|
79
79
|
S("update:visible", t);
|
|
80
80
|
});
|
|
@@ -91,21 +91,21 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
91
91
|
}
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
|
-
const A = D(() =>
|
|
94
|
+
const A = D(() => f.value.map((t) => T.value.get(t)).filter(Boolean));
|
|
95
95
|
function de(t, e) {
|
|
96
|
-
|
|
96
|
+
f.value.includes(t) || f.value.push(t), T.value.set(t, e);
|
|
97
97
|
}
|
|
98
98
|
function ae(t) {
|
|
99
|
-
|
|
99
|
+
f.value = f.value.filter((e) => e !== t), T.value.delete(t);
|
|
100
100
|
}
|
|
101
101
|
const pe = (t) => {
|
|
102
102
|
var n;
|
|
103
103
|
if (!$.value) return t.name;
|
|
104
|
-
const e = ((n =
|
|
104
|
+
const e = ((n = L.value[t.key]) == null ? void 0 : n.length) ?? 0;
|
|
105
105
|
return e > 0 ? `${t.name} (${e})` : t.name;
|
|
106
106
|
}, ve = (t) => {
|
|
107
107
|
$.value || (B.value = "", S("tab-change", { tabKey: t }));
|
|
108
|
-
},
|
|
108
|
+
}, fe = (t) => {
|
|
109
109
|
const e = {};
|
|
110
110
|
r.tabs.forEach((p) => {
|
|
111
111
|
e[p.key] = [];
|
|
@@ -120,26 +120,26 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
120
120
|
E();
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
$.value = !0,
|
|
123
|
+
$.value = !0, R.value = !0, a = setTimeout(() => z(), 300);
|
|
124
124
|
}, z = () => {
|
|
125
|
-
|
|
125
|
+
L.value = {};
|
|
126
126
|
const t = (e) => {
|
|
127
127
|
const n = {};
|
|
128
128
|
e.forEach((p) => {
|
|
129
129
|
const m = { ...p, isUser: p.isUser !== !1 }, N = p.nodeType || (p.isUser !== !1 ? "user" : "department");
|
|
130
130
|
n[N] || (n[N] = []), n[N].push(m);
|
|
131
|
-
}),
|
|
131
|
+
}), L.value = n, R.value = !1;
|
|
132
132
|
};
|
|
133
|
-
S("search", { keyword: B.value, orgId:
|
|
133
|
+
S("search", { keyword: B.value, orgId: M.value || void 0, callback: t });
|
|
134
134
|
}, E = () => {
|
|
135
|
-
a && (clearTimeout(a), a = null), $.value = !1, B.value = "",
|
|
135
|
+
a && (clearTimeout(a), a = null), $.value = !1, B.value = "", L.value = {}, R.value = !1;
|
|
136
136
|
}, F = (t) => {
|
|
137
|
-
if (
|
|
137
|
+
if (f.value.indexOf(t.id) > -1)
|
|
138
138
|
ae(t.id);
|
|
139
139
|
else {
|
|
140
|
-
r.multiple || (
|
|
140
|
+
r.multiple || (f.value = [], T.value.clear());
|
|
141
141
|
const n = t.isUser ? "搜索结果" : t.isPost ? "职位" : "部门";
|
|
142
|
-
de(t.id, { ...t, typeName: n, orgId:
|
|
142
|
+
de(t.id, { ...t, typeName: n, orgId: M.value }), r.multiple || me();
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
145
|
function P(t) {
|
|
@@ -153,19 +153,19 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
153
153
|
var w, y;
|
|
154
154
|
const n = e == null ? void 0 : e.node;
|
|
155
155
|
if (n) {
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
156
|
+
const h = n.value ?? ((w = n.data) == null ? void 0 : w.id);
|
|
157
|
+
if (h !== void 0) {
|
|
158
158
|
if (n.checked) {
|
|
159
|
-
r.multiple || (
|
|
159
|
+
r.multiple || (f.value = [], T.value.clear());
|
|
160
160
|
const H = r.tabs.find((se) => se.key === C.value), le = H ? H.name.replace(/^按/, "") : "";
|
|
161
|
-
de(
|
|
161
|
+
de(h, { ...n.data, typeName: le, orgId: M.value }), !r.multiple && ((y = n.data) != null && y.isUser) && me();
|
|
162
162
|
} else
|
|
163
|
-
ae(
|
|
163
|
+
ae(h);
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
const p = O.value[C.value] || [], m = P(p), N =
|
|
168
|
-
|
|
167
|
+
const p = O.value[C.value] || [], m = P(p), N = f.value.filter((h) => !m.includes(h));
|
|
168
|
+
f.value = [...N, ...t];
|
|
169
169
|
};
|
|
170
170
|
function s(t, e, n) {
|
|
171
171
|
for (const p of t) {
|
|
@@ -176,21 +176,21 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
176
176
|
}
|
|
177
177
|
return !1;
|
|
178
178
|
}
|
|
179
|
-
async function
|
|
179
|
+
async function he(t, e) {
|
|
180
180
|
var N;
|
|
181
181
|
const n = t.value, p = G.value[e];
|
|
182
182
|
if (t.data.loaded) {
|
|
183
183
|
const w = O.value[e];
|
|
184
184
|
if (w) {
|
|
185
185
|
const y = te(w, n);
|
|
186
|
-
y && y.children && (y.children = y.children.filter((
|
|
186
|
+
y && y.children && (y.children = y.children.filter((h) => !h.isUser));
|
|
187
187
|
}
|
|
188
|
-
p && (((N = p.getItem(n)) == null ? void 0 : N.children) || []).filter((
|
|
188
|
+
p && (((N = p.getItem(n)) == null ? void 0 : N.children) || []).filter((h) => {
|
|
189
189
|
var J;
|
|
190
|
-
return (J =
|
|
191
|
-
}).forEach((
|
|
190
|
+
return (J = h.data) == null ? void 0 : J.isUser;
|
|
191
|
+
}).forEach((h) => {
|
|
192
192
|
try {
|
|
193
|
-
p.remove(
|
|
193
|
+
p.remove(h.value);
|
|
194
194
|
} catch {
|
|
195
195
|
}
|
|
196
196
|
}), t.data.loaded = !1;
|
|
@@ -200,8 +200,8 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
200
200
|
const y = w.map((J) => {
|
|
201
201
|
const { id: H, name: le, ...se } = J;
|
|
202
202
|
return { ...se, id: H, name: J.displayName || le, isUser: !0 };
|
|
203
|
-
}),
|
|
204
|
-
if (
|
|
203
|
+
}), h = O.value[e];
|
|
204
|
+
if (h && s(h, n, y), p) {
|
|
205
205
|
p.appendTo(n, y), t.data.loaded = !0, await $e();
|
|
206
206
|
try {
|
|
207
207
|
p.setItem(n, { expanded: !0 });
|
|
@@ -212,35 +212,35 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
212
212
|
t.data.loaded = !0;
|
|
213
213
|
const y = O.value[e];
|
|
214
214
|
if (y) {
|
|
215
|
-
const
|
|
216
|
-
|
|
215
|
+
const h = te(y, n);
|
|
216
|
+
h && (h.loaded = !0);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
} });
|
|
220
220
|
}
|
|
221
221
|
const Te = (t) => {
|
|
222
222
|
ae(t);
|
|
223
|
-
},
|
|
224
|
-
|
|
223
|
+
}, ke = () => {
|
|
224
|
+
f.value = [], T.value.clear();
|
|
225
225
|
}, me = () => {
|
|
226
|
-
S("update:modelValue",
|
|
226
|
+
S("update:modelValue", f.value), S("confirm", A.value), I.value = !1;
|
|
227
227
|
}, xe = () => {
|
|
228
228
|
I.value = !1;
|
|
229
229
|
};
|
|
230
230
|
return Z({
|
|
231
|
-
clearSelection:
|
|
231
|
+
clearSelection: ke,
|
|
232
232
|
appendUsers: (t, e, n) => {
|
|
233
233
|
const p = G.value[t];
|
|
234
234
|
if (p && n.length > 0) {
|
|
235
235
|
const m = n.map((N) => {
|
|
236
|
-
const { id: w, name: y, ...
|
|
237
|
-
return { ...
|
|
236
|
+
const { id: w, name: y, ...h } = N;
|
|
237
|
+
return { ...h, id: w, name: N.displayName || y, isUser: !0 };
|
|
238
238
|
});
|
|
239
239
|
p.appendTo(e, m);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
}), (t, e) => {
|
|
243
|
-
const n = x("t-option"), p = x("t-select"), m = x("t-icon"), N = x("t-input"), w = x("t-loading"), y = x("t-checkbox"),
|
|
243
|
+
const n = x("t-option"), p = x("t-select"), m = x("t-icon"), N = x("t-input"), w = x("t-loading"), y = x("t-checkbox"), h = x("t-button"), J = x("t-tree"), H = x("t-tab-panel"), le = x("t-tabs"), se = x("t-dialog");
|
|
244
244
|
return o(), W(se, {
|
|
245
245
|
visible: I.value,
|
|
246
246
|
"onUpdate:visible": e[4] || (e[4] = (i) => I.value = i),
|
|
@@ -258,11 +258,11 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
258
258
|
ee.value ? (o(), c("div", we, [
|
|
259
259
|
ue.value && ie.value.length > 0 ? (o(), c("div", Be, [
|
|
260
260
|
k(p, {
|
|
261
|
-
modelValue:
|
|
262
|
-
"onUpdate:modelValue": e[0] || (e[0] = (i) =>
|
|
261
|
+
modelValue: M.value,
|
|
262
|
+
"onUpdate:modelValue": e[0] || (e[0] = (i) => M.value = i),
|
|
263
263
|
placeholder: "选择组织",
|
|
264
264
|
style: { width: "200px" },
|
|
265
|
-
onChange:
|
|
265
|
+
onChange: fe
|
|
266
266
|
}, {
|
|
267
267
|
default: V(() => [
|
|
268
268
|
(o(!0), c(Q, null, oe(ie.value, (i) => (o(), W(n, {
|
|
@@ -308,25 +308,25 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
308
308
|
var _e;
|
|
309
309
|
return [
|
|
310
310
|
$.value ? (o(), c(Q, { key: 0 }, [
|
|
311
|
-
|
|
311
|
+
R.value ? (o(), c("div", Me, [
|
|
312
312
|
k(w),
|
|
313
313
|
e[5] || (e[5] = u("span", null, "搜索中...", -1))
|
|
314
|
-
])) : !
|
|
314
|
+
])) : !L.value[i.key] || L.value[i.key].length === 0 ? (o(), c("div", Re, [
|
|
315
315
|
k(m, {
|
|
316
316
|
name: "search",
|
|
317
317
|
size: "48px",
|
|
318
318
|
style: { color: "#ddd" }
|
|
319
319
|
}),
|
|
320
320
|
e[6] || (e[6] = u("p", null, "暂无结果", -1))
|
|
321
|
-
])) : (o(), c("div",
|
|
322
|
-
(o(!0), c(Q, null, oe(
|
|
321
|
+
])) : (o(), c("div", Le, [
|
|
322
|
+
(o(!0), c(Q, null, oe(L.value[i.key], (d) => (o(), c("div", {
|
|
323
323
|
key: d.id,
|
|
324
|
-
class: ne(["cd-ps-result-item", { "cd-ps-selected":
|
|
324
|
+
class: ne(["cd-ps-result-item", { "cd-ps-selected": f.value.includes(d.id), "cd-ps-dept-result": !d.isUser }]),
|
|
325
325
|
onClick: (Ne) => F(d)
|
|
326
326
|
}, [
|
|
327
327
|
k(y, {
|
|
328
|
-
checked:
|
|
329
|
-
onClick: e[2] || (e[2] =
|
|
328
|
+
checked: f.value.includes(d.id),
|
|
329
|
+
onClick: e[2] || (e[2] = ye(() => {
|
|
330
330
|
}, ["stop"]))
|
|
331
331
|
}, null, 8, ["checked"]),
|
|
332
332
|
u("div", {
|
|
@@ -358,7 +358,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
358
358
|
hover: "",
|
|
359
359
|
checkable: "",
|
|
360
360
|
"expand-all": !1,
|
|
361
|
-
value:
|
|
361
|
+
value: f.value,
|
|
362
362
|
onChange: q
|
|
363
363
|
}, {
|
|
364
364
|
label: V(({ node: d }) => [
|
|
@@ -373,12 +373,12 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
373
373
|
d.data.isUser && d.data.position ? (o(), c("span", Ye, v(d.data.position), 1)) : _("", !0)
|
|
374
374
|
]),
|
|
375
375
|
d.data.userCount && !d.data.isUser ? (o(), c("span", Ze, "(" + v(d.data.userCount) + ")", 1)) : _("", !0),
|
|
376
|
-
d.data.isUser ? _("", !0) : (o(), W(
|
|
376
|
+
d.data.isUser ? _("", !0) : (o(), W(h, {
|
|
377
377
|
key: 1,
|
|
378
378
|
size: "small",
|
|
379
379
|
variant: "text",
|
|
380
380
|
class: "cd-ps-load-btn",
|
|
381
|
-
onClick:
|
|
381
|
+
onClick: ye((Ne) => he(d, i.key), ["stop"])
|
|
382
382
|
}, {
|
|
383
383
|
default: V(() => [
|
|
384
384
|
Y(v(d.data.loaded ? "刷新人员" : "显示人员"), 1)
|
|
@@ -409,11 +409,11 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
409
409
|
u("div", tt, [
|
|
410
410
|
e[9] || (e[9] = u("span", { class: "cd-ps-title" }, "已选择", -1)),
|
|
411
411
|
u("span", at, v(A.value.length) + " 项", 1),
|
|
412
|
-
A.value.length > 0 ? (o(), W(
|
|
412
|
+
A.value.length > 0 ? (o(), W(h, {
|
|
413
413
|
key: 0,
|
|
414
414
|
size: "small",
|
|
415
415
|
variant: "text",
|
|
416
|
-
onClick:
|
|
416
|
+
onClick: ke
|
|
417
417
|
}, {
|
|
418
418
|
default: V(() => [...e[8] || (e[8] = [
|
|
419
419
|
Y("清空", -1)
|
|
@@ -452,7 +452,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
452
452
|
])
|
|
453
453
|
])
|
|
454
454
|
]),
|
|
455
|
-
k(
|
|
455
|
+
k(h, {
|
|
456
456
|
size: "small",
|
|
457
457
|
variant: "text",
|
|
458
458
|
shape: "circle",
|
|
@@ -479,28 +479,25 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
479
479
|
for (const [r, S] of Z)
|
|
480
480
|
U[r] = S;
|
|
481
481
|
return U;
|
|
482
|
-
}, Ie = /* @__PURE__ */ Se(
|
|
483
|
-
key: 0,
|
|
484
|
-
class: "cd-input-select__panel"
|
|
485
|
-
}, _t = { class: "cd-input-select__grid" }, gt = { class: "cd-input-select__option-content" }, yt = {
|
|
482
|
+
}, Ie = /* @__PURE__ */ Se(ft, [["__scopeId", "data-v-08bc0ceb"]]), ht = { class: "cd-input-select" }, mt = { class: "cd-input-select__grid" }, _t = { class: "cd-input-select__option-content" }, gt = {
|
|
486
483
|
key: 0,
|
|
487
484
|
class: "cd-input-select__option-avatar"
|
|
488
|
-
},
|
|
485
|
+
}, yt = ["src", "alt"], kt = { class: "cd-input-select__option-info" }, bt = { class: "cd-input-select__option-name" }, Ct = {
|
|
489
486
|
key: 0,
|
|
490
487
|
class: "cd-input-select__option-desc"
|
|
491
|
-
},
|
|
488
|
+
}, Vt = {
|
|
492
489
|
key: 1,
|
|
493
490
|
class: "cd-input-select__option-desc"
|
|
494
|
-
},
|
|
491
|
+
}, Ut = {
|
|
495
492
|
key: 0,
|
|
496
493
|
class: "cd-input-select__pager"
|
|
497
|
-
},
|
|
494
|
+
}, St = { class: "cd-input-select__pager-info" }, It = { class: "cd-input-select__pager-btns" }, Tt = { class: "cd-input-select__pager-num" }, xt = {
|
|
498
495
|
key: 1,
|
|
499
496
|
class: "cd-input-select__loading"
|
|
500
|
-
},
|
|
497
|
+
}, Nt = {
|
|
501
498
|
key: 2,
|
|
502
499
|
class: "cd-input-select__empty"
|
|
503
|
-
}, ge = 10,
|
|
500
|
+
}, ge = 10, $t = /* @__PURE__ */ Ue({
|
|
504
501
|
name: "CdInputPersonSelector",
|
|
505
502
|
__name: "InputSelect",
|
|
506
503
|
props: {
|
|
@@ -513,10 +510,10 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
513
510
|
},
|
|
514
511
|
emits: ["update:modelValue", "search", "load-users", "tab-change"],
|
|
515
512
|
setup(b, { emit: Z }) {
|
|
516
|
-
const U = b, r = Z, S = g(!1), I = g([]), C = g(1),
|
|
513
|
+
const U = b, r = Z, S = g(!1), I = g([]), C = g(1), M = D(() => {
|
|
517
514
|
const a = (C.value - 1) * ge;
|
|
518
515
|
return I.value.slice(a, a + ge);
|
|
519
|
-
}), B = D(() => Math.ceil(I.value.length / ge)),
|
|
516
|
+
}), B = D(() => Math.ceil(I.value.length / ge)), f = g(!1), T = g([]), G = g([]), $ = g(!1), R = g(""), L = D(() => U.modelValue.map((a) => ({
|
|
520
517
|
label: a.name,
|
|
521
518
|
value: a.id
|
|
522
519
|
}))), K = {
|
|
@@ -549,7 +546,7 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
549
546
|
}), j = (a) => {
|
|
550
547
|
r("update:modelValue", a), G.value = a;
|
|
551
548
|
}, te = (a) => {
|
|
552
|
-
a || (I.value = [],
|
|
549
|
+
a || (I.value = [], R.value = "");
|
|
553
550
|
}, A = (a, l) => {
|
|
554
551
|
a ? U.multiple ? j([...U.modelValue, l]) : (j([l]), $.value = !1) : j(U.modelValue.filter((z) => z.id !== l.id));
|
|
555
552
|
}, de = (a, l) => {
|
|
@@ -563,18 +560,18 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
563
560
|
P.splice(E, 1), j(P);
|
|
564
561
|
}
|
|
565
562
|
}, ae = (a) => {
|
|
566
|
-
a.stopPropagation(), a.preventDefault(), $.value = !1,
|
|
563
|
+
a.stopPropagation(), a.preventDefault(), $.value = !1, f.value = !0;
|
|
567
564
|
}, pe = (a) => {
|
|
568
565
|
const l = a.map(ce), z = new Set(U.modelValue.map((P) => P.id)), E = l.filter((P) => !z.has(P.id)), F = U.multiple ? [...U.modelValue, ...E] : l.slice(0, 1);
|
|
569
|
-
j(F),
|
|
566
|
+
j(F), f.value = !1;
|
|
570
567
|
}, ve = (a) => {
|
|
571
568
|
r("load-users", a);
|
|
572
|
-
},
|
|
569
|
+
}, fe = (a) => {
|
|
573
570
|
r("search", { keyword: a.keyword, callback: a.callback });
|
|
574
571
|
};
|
|
575
572
|
return X(() => U.modelValue, (a) => {
|
|
576
573
|
T.value = a.map((l) => l.id), G.value = a;
|
|
577
|
-
}, { immediate: !0, deep: !0 }), X(
|
|
574
|
+
}, { immediate: !0, deep: !0 }), X(R, (a) => {
|
|
578
575
|
if (!(a != null && a.trim())) {
|
|
579
576
|
I.value = [], S.value = !1;
|
|
580
577
|
return;
|
|
@@ -588,13 +585,13 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
588
585
|
}), (a, l) => {
|
|
589
586
|
var q;
|
|
590
587
|
const z = x("t-checkbox"), E = x("t-button"), F = x("t-tag"), P = x("t-select-input");
|
|
591
|
-
return o(), c("div",
|
|
588
|
+
return o(), c("div", ht, [
|
|
592
589
|
k(P, {
|
|
593
|
-
value:
|
|
594
|
-
inputValue:
|
|
595
|
-
"onUpdate:inputValue": l[
|
|
590
|
+
value: L.value,
|
|
591
|
+
inputValue: R.value,
|
|
592
|
+
"onUpdate:inputValue": l[3] || (l[3] = (s) => R.value = s),
|
|
596
593
|
"popup-visible": $.value,
|
|
597
|
-
"onUpdate:popupVisible": l[
|
|
594
|
+
"onUpdate:popupVisible": l[4] || (l[4] = (s) => $.value = s),
|
|
598
595
|
"input-props": {
|
|
599
596
|
readonly: !1,
|
|
600
597
|
disabled: !1
|
|
@@ -616,22 +613,27 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
616
613
|
onTagChange: de
|
|
617
614
|
}, {
|
|
618
615
|
panel: V(() => [
|
|
619
|
-
I.value.length > 0 ? (o(), c("div",
|
|
620
|
-
|
|
621
|
-
|
|
616
|
+
I.value.length > 0 ? (o(), c("div", {
|
|
617
|
+
key: 0,
|
|
618
|
+
class: "cd-input-select__panel",
|
|
619
|
+
onMousedown: l[2] || (l[2] = ye(() => {
|
|
620
|
+
}, ["stop"]))
|
|
621
|
+
}, [
|
|
622
|
+
u("div", mt, [
|
|
623
|
+
(o(!0), c(Q, null, oe(M.value, (s) => (o(), W(z, {
|
|
622
624
|
key: s.id,
|
|
623
625
|
value: s.id,
|
|
624
626
|
checked: O(s.id),
|
|
625
627
|
class: "cd-input-select__option",
|
|
626
|
-
onChange: (
|
|
628
|
+
onChange: (he) => A(he, s)
|
|
627
629
|
}, {
|
|
628
630
|
default: V(() => [
|
|
629
|
-
u("div",
|
|
630
|
-
s.avatar ? (o(), c("div",
|
|
631
|
+
u("div", _t, [
|
|
632
|
+
s.avatar ? (o(), c("div", gt, [
|
|
631
633
|
u("img", {
|
|
632
634
|
src: s.avatar,
|
|
633
635
|
alt: s.name
|
|
634
|
-
}, null, 8,
|
|
636
|
+
}, null, 8, yt)
|
|
635
637
|
])) : (o(), c("div", {
|
|
636
638
|
key: 1,
|
|
637
639
|
class: "cd-input-select__option-avatar cd-input-select__option-avatar--placeholder",
|
|
@@ -640,9 +642,9 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
640
642
|
color: "#fff"
|
|
641
643
|
})
|
|
642
644
|
}, v(ue(s.nodeType)), 5)),
|
|
643
|
-
u("div",
|
|
644
|
-
u("div",
|
|
645
|
-
s.isUser && (s.department || s.post) ? (o(), c("div",
|
|
645
|
+
u("div", kt, [
|
|
646
|
+
u("div", bt, v(s.name), 1),
|
|
647
|
+
s.isUser && (s.department || s.post) ? (o(), c("div", Ct, v(s.department) + v(s.department && s.post ? " · " : "") + v(s.post), 1)) : s.fnumber ? (o(), c("div", Vt, v(s.fnumber), 1)) : _("", !0)
|
|
646
648
|
]),
|
|
647
649
|
u("span", {
|
|
648
650
|
class: "cd-input-select__option-tag",
|
|
@@ -653,35 +655,35 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
653
655
|
_: 2
|
|
654
656
|
}, 1032, ["value", "checked", "onChange"]))), 128))
|
|
655
657
|
]),
|
|
656
|
-
B.value > 1 ? (o(), c("div",
|
|
657
|
-
u("span",
|
|
658
|
-
u("div",
|
|
658
|
+
B.value > 1 ? (o(), c("div", Ut, [
|
|
659
|
+
u("span", St, v(I.value.length) + " 条结果", 1),
|
|
660
|
+
u("div", It, [
|
|
659
661
|
k(E, {
|
|
660
662
|
size: "small",
|
|
661
663
|
variant: "text",
|
|
662
664
|
disabled: C.value <= 1,
|
|
663
665
|
onClick: l[0] || (l[0] = (s) => C.value--)
|
|
664
666
|
}, {
|
|
665
|
-
default: V(() => [...l[
|
|
667
|
+
default: V(() => [...l[9] || (l[9] = [
|
|
666
668
|
Y("上一页", -1)
|
|
667
669
|
])]),
|
|
668
670
|
_: 1
|
|
669
671
|
}, 8, ["disabled"]),
|
|
670
|
-
u("span",
|
|
672
|
+
u("span", Tt, v(C.value) + "/" + v(B.value), 1),
|
|
671
673
|
k(E, {
|
|
672
674
|
size: "small",
|
|
673
675
|
variant: "text",
|
|
674
676
|
disabled: C.value >= B.value,
|
|
675
677
|
onClick: l[1] || (l[1] = (s) => C.value++)
|
|
676
678
|
}, {
|
|
677
|
-
default: V(() => [...l[
|
|
679
|
+
default: V(() => [...l[10] || (l[10] = [
|
|
678
680
|
Y("下一页", -1)
|
|
679
681
|
])]),
|
|
680
682
|
_: 1
|
|
681
683
|
}, 8, ["disabled"])
|
|
682
684
|
])
|
|
683
685
|
])) : _("", !0)
|
|
684
|
-
])) : S.value ? (o(), c("div",
|
|
686
|
+
], 32)) : S.value ? (o(), c("div", xt, " 搜索中... ")) : (o(), c("div", Nt, " 暂无搜索结果 "))
|
|
685
687
|
]),
|
|
686
688
|
tag: V((s) => [
|
|
687
689
|
s && s.tag ? (o(), W(F, {
|
|
@@ -705,12 +707,12 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
705
707
|
]),
|
|
706
708
|
_: 1
|
|
707
709
|
}, 8, ["value", "inputValue", "popup-visible", "placeholder", "loading", "multiple"]),
|
|
708
|
-
(q = b.tabs) != null && q.length &&
|
|
710
|
+
(q = b.tabs) != null && q.length && f.value ? (o(), W(Ie, {
|
|
709
711
|
key: 0,
|
|
710
|
-
visible:
|
|
711
|
-
"onUpdate:visible": l[
|
|
712
|
+
visible: f.value,
|
|
713
|
+
"onUpdate:visible": l[5] || (l[5] = (s) => f.value = s),
|
|
712
714
|
modelValue: T.value,
|
|
713
|
-
"onUpdate:modelValue": l[
|
|
715
|
+
"onUpdate:modelValue": l[6] || (l[6] = (s) => T.value = s),
|
|
714
716
|
tabs: b.tabs,
|
|
715
717
|
organizations: b.organizations || [],
|
|
716
718
|
"show-org": b.showOrg !== !1,
|
|
@@ -718,21 +720,21 @@ const ze = { class: "cd-ps-container" }, we = {
|
|
|
718
720
|
multiple: b.multiple,
|
|
719
721
|
onConfirm: pe,
|
|
720
722
|
onLoadUsers: ve,
|
|
721
|
-
onSearch:
|
|
722
|
-
onTabChange: l[
|
|
723
|
-
onClose: l[
|
|
723
|
+
onSearch: fe,
|
|
724
|
+
onTabChange: l[7] || (l[7] = (s) => r("tab-change", s)),
|
|
725
|
+
onClose: l[8] || (l[8] = (s) => f.value = !1)
|
|
724
726
|
}, null, 8, ["visible", "modelValue", "tabs", "organizations", "show-org", "multiple"])) : _("", !0)
|
|
725
727
|
]);
|
|
726
728
|
};
|
|
727
729
|
}
|
|
728
|
-
}),
|
|
730
|
+
}), zt = /* @__PURE__ */ Se($t, [["__scopeId", "data-v-e9fbddf8"]]), Bt = {
|
|
729
731
|
install(b) {
|
|
730
|
-
b.component("PersonSelector", Ie), b.component("CdInputPersonSelector",
|
|
732
|
+
b.component("PersonSelector", Ie), b.component("CdInputPersonSelector", zt);
|
|
731
733
|
}
|
|
732
734
|
};
|
|
733
735
|
export {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
+
zt as CdInputPersonSelector,
|
|
737
|
+
zt as InputSelect,
|
|
736
738
|
Ie as PersonSelector,
|
|
737
|
-
|
|
739
|
+
Bt as default
|
|
738
740
|
};
|