cd-personselector 1.3.6 → 1.3.8

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.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 Ce, toDisplayString as v, createTextVNode as Y, nextTick as $e, normalizeStyle as Ve } from "vue";
1
+ import { defineComponent as Se, ref as g, computed as D, watch as X, resolveComponent as x, openBlock as o, createBlock as W, withCtx as U, 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 Ue } 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" }, Re = {
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
- }, Le = {
11
+ }, Re = {
12
12
  key: 1,
13
13
  class: "cd-ps-empty"
14
- }, Me = {
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 }, ht = /* @__PURE__ */ Ue({
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__ */ Se({
39
39
  __name: "PersonSelector",
40
40
  props: {
41
41
  visible: { type: Boolean, default: !1 },
@@ -49,9 +49,9 @@ const ze = { class: "cd-ps-container" }, we = {
49
49
  multiple: { type: Boolean, default: !0 }
50
50
  },
51
51
  emits: ["update:visible", "update:modelValue", "confirm", "load-users", "search", "org-change", "tab-change"],
52
- setup(b, { expose: Z, emit: U }) {
53
- var ke, be;
54
- const r = b, S = U, I = g(r.visible), C = g(((be = (ke = r.tabs) == null ? void 0 : ke[0]) == null ? void 0 : be.key) || ""), R = g(null), B = g(""), h = g([]), T = g(/* @__PURE__ */ new Map()), G = g({}), $ = g(!1), L = g(!1), M = g({}), K = D(() => r.tabs || []), ie = D(() => r.organizations || []);
52
+ setup(b, { expose: Z, emit: S }) {
53
+ var Ce, Ve;
54
+ const r = b, C = S, I = g(r.visible), V = g(((Ve = (Ce = r.tabs) == null ? void 0 : Ce[0]) == null ? void 0 : Ve.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) => {
@@ -59,24 +59,24 @@ const ze = { class: "cd-ps-container" }, we = {
59
59
  const e = {};
60
60
  t.forEach((n) => {
61
61
  e[n.key] = JSON.parse(JSON.stringify(n.tree));
62
- }), O.value = e, (!C.value || !t.find((n) => n.key === C.value)) && (C.value = t[0].key);
62
+ }), O.value = e, (!V.value || !t.find((n) => n.key === V.value)) && (V.value = t[0].key);
63
63
  }
64
64
  }, { immediate: !0, deep: !0 });
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 ? (h.value = r.modelValue.map((e) => e.id), T.value.clear(), r.modelValue.forEach((e) => {
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
- })) : h.value = [...r.modelValue];
70
+ })) : f.value = [...r.modelValue];
71
71
  } else
72
- h.value = [], T.value.clear();
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 && !R.value && (R.value = r.organizations[0].id));
77
+ I.value = t, t && (ce(), r.organizations.length > 0 && !M.value && (M.value = r.organizations[0].id));
78
78
  }), X(I, (t) => {
79
- S("update:visible", t);
79
+ C("update:visible", t);
80
80
  });
81
81
  function j(t, e) {
82
82
  e && (G.value[t] = e);
@@ -91,28 +91,28 @@ const ze = { class: "cd-ps-container" }, we = {
91
91
  }
92
92
  return null;
93
93
  }
94
- const A = D(() => h.value.map((t) => T.value.get(t)).filter(Boolean));
94
+ const A = D(() => f.value.map((t) => T.value.get(t)).filter(Boolean));
95
95
  function de(t, e) {
96
- h.value.includes(t) || h.value.push(t), T.value.set(t, e);
96
+ f.value.includes(t) || f.value.push(t), T.value.set(t, e);
97
97
  }
98
98
  function ae(t) {
99
- h.value = h.value.filter((e) => e !== t), T.value.delete(t);
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 = M.value[t.key]) == null ? void 0 : n.length) ?? 0;
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
- $.value || (B.value = "", S("tab-change", { tabKey: t }));
108
- }, he = (t) => {
107
+ $.value || (B.value = "", C("tab-change", { tabKey: t }));
108
+ }, fe = (t) => {
109
109
  const e = {};
110
110
  r.tabs.forEach((p) => {
111
111
  e[p.key] = [];
112
112
  }), O.value = e;
113
113
  const n = () => {
114
114
  };
115
- S("org-change", { orgId: t, tabKey: C.value, callback: n });
115
+ C("org-change", { orgId: t, tabKey: V.value, callback: n });
116
116
  };
117
117
  let a = null;
118
118
  const l = () => {
@@ -120,26 +120,26 @@ const ze = { class: "cd-ps-container" }, we = {
120
120
  E();
121
121
  return;
122
122
  }
123
- $.value = !0, L.value = !0, a = setTimeout(() => z(), 300);
123
+ $.value = !0, R.value = !0, a = setTimeout(() => z(), 300);
124
124
  }, z = () => {
125
- M.value = {};
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
- }), M.value = n, L.value = !1;
131
+ }), L.value = n, R.value = !1;
132
132
  };
133
- S("search", { keyword: B.value, orgId: R.value || void 0, callback: t });
133
+ C("search", { keyword: B.value, orgId: M.value || void 0, callback: t });
134
134
  }, E = () => {
135
- a && (clearTimeout(a), a = null), $.value = !1, B.value = "", M.value = {}, L.value = !1;
135
+ a && (clearTimeout(a), a = null), $.value = !1, B.value = "", L.value = {}, R.value = !1;
136
136
  }, F = (t) => {
137
- if (h.value.indexOf(t.id) > -1)
137
+ if (f.value.indexOf(t.id) > -1)
138
138
  ae(t.id);
139
139
  else {
140
- r.multiple || (h.value = [], T.value.clear());
140
+ r.multiple || (f.value = [], T.value.clear());
141
141
  const n = t.isUser ? "搜索结果" : t.isPost ? "职位" : "部门";
142
- de(t.id, { ...t, typeName: n, orgId: R.value }), r.multiple || me();
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 f = n.value ?? ((w = n.data) == null ? void 0 : w.id);
157
- if (f !== void 0) {
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 || (h.value = [], T.value.clear());
160
- const H = r.tabs.find((se) => se.key === C.value), le = H ? H.name.replace(/^按/, "") : "";
161
- de(f, { ...n.data, typeName: le, orgId: R.value }), !r.multiple && ((y = n.data) != null && y.isUser) && me();
159
+ r.multiple || (f.value = [], T.value.clear());
160
+ const H = r.tabs.find((se) => se.key === V.value), le = H ? H.name.replace(/^按/, "") : "";
161
+ de(h, { ...n.data, typeName: le, orgId: M.value }), !r.multiple && ((y = n.data) != null && y.isUser) && me();
162
162
  } else
163
- ae(f);
163
+ ae(h);
164
164
  return;
165
165
  }
166
166
  }
167
- const p = O.value[C.value] || [], m = P(p), N = h.value.filter((f) => !m.includes(f));
168
- h.value = [...N, ...t];
167
+ const p = O.value[V.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,32 +176,32 @@ const ze = { class: "cd-ps-container" }, we = {
176
176
  }
177
177
  return !1;
178
178
  }
179
- async function fe(t, e) {
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((f) => !f.isUser));
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((f) => {
188
+ p && (((N = p.getItem(n)) == null ? void 0 : N.children) || []).filter((h) => {
189
189
  var J;
190
- return (J = f.data) == null ? void 0 : J.isUser;
191
- }).forEach((f) => {
190
+ return (J = h.data) == null ? void 0 : J.isUser;
191
+ }).forEach((h) => {
192
192
  try {
193
- p.remove(f.value);
193
+ p.remove(h.value);
194
194
  } catch {
195
195
  }
196
196
  }), t.data.loaded = !1;
197
197
  }
198
- S("load-users", { tabKey: e, nodeId: n, node: t, callback: async (w) => {
198
+ C("load-users", { tabKey: e, nodeId: n, node: t, callback: async (w) => {
199
199
  if (w.length > 0) {
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
- }), f = O.value[e];
204
- if (f && s(f, n, y), p) {
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 f = te(y, n);
216
- f && (f.loaded = !0);
215
+ const h = te(y, n);
216
+ h && (h.loaded = !0);
217
217
  }
218
218
  }
219
219
  } });
220
220
  }
221
- const Te = (t) => {
221
+ const xe = (t) => {
222
222
  ae(t);
223
- }, ye = () => {
224
- h.value = [], T.value.clear();
223
+ }, ke = () => {
224
+ f.value = [], T.value.clear();
225
225
  }, me = () => {
226
- S("update:modelValue", h.value), S("confirm", A.value), I.value = !1;
227
- }, xe = () => {
228
- I.value = !1;
226
+ C("update:modelValue", f.value), C("confirm", A.value), I.value = !1;
227
+ }, be = () => {
228
+ I.value = !1, C("close");
229
229
  };
230
230
  return Z({
231
- clearSelection: ye,
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, ...f } = N;
237
- return { ...f, id: w, name: N.displayName || y, isUser: !0 };
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"), f = x("t-button"), J = x("t-tree"), H = x("t-tab-panel"), le = x("t-tabs"), se = x("t-dialog");
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),
@@ -250,21 +250,23 @@ const ze = { class: "cd-ps-container" }, we = {
250
250
  placement: "center",
251
251
  "destroy-on-close": "",
252
252
  attach: "body",
253
+ "close-on-overlay-click": !0,
253
254
  onConfirm: me,
254
- onClose: xe
255
+ onClose: be,
256
+ onCancel: be
255
257
  }, {
256
- default: V(() => [
258
+ default: U(() => [
257
259
  u("div", ze, [
258
260
  ee.value ? (o(), c("div", we, [
259
261
  ue.value && ie.value.length > 0 ? (o(), c("div", Be, [
260
262
  k(p, {
261
- modelValue: R.value,
262
- "onUpdate:modelValue": e[0] || (e[0] = (i) => R.value = i),
263
+ modelValue: M.value,
264
+ "onUpdate:modelValue": e[0] || (e[0] = (i) => M.value = i),
263
265
  placeholder: "选择组织",
264
266
  style: { width: "200px" },
265
- onChange: he
267
+ onChange: fe
266
268
  }, {
267
- default: V(() => [
269
+ default: U(() => [
268
270
  (o(!0), c(Q, null, oe(ie.value, (i) => (o(), W(n, {
269
271
  key: i.id,
270
272
  value: i.id,
@@ -284,7 +286,7 @@ const ze = { class: "cd-ps-container" }, we = {
284
286
  onInput: l,
285
287
  onClear: E
286
288
  }, {
287
- "prefix-icon": V(() => [
289
+ "prefix-icon": U(() => [
288
290
  k(m, { name: "search" })
289
291
  ]),
290
292
  _: 1
@@ -294,39 +296,39 @@ const ze = { class: "cd-ps-container" }, we = {
294
296
  u("div", Pe, [
295
297
  u("div", De, [
296
298
  k(le, {
297
- modelValue: C.value,
298
- "onUpdate:modelValue": e[3] || (e[3] = (i) => C.value = i),
299
+ modelValue: V.value,
300
+ "onUpdate:modelValue": e[3] || (e[3] = (i) => V.value = i),
299
301
  onChange: ve
300
302
  }, {
301
- default: V(() => [
303
+ default: U(() => [
302
304
  (o(!0), c(Q, null, oe(K.value, (i) => (o(), W(H, {
303
305
  key: i.key,
304
306
  value: i.key,
305
307
  label: pe(i)
306
308
  }, {
307
- default: V(() => {
309
+ default: U(() => {
308
310
  var _e;
309
311
  return [
310
312
  $.value ? (o(), c(Q, { key: 0 }, [
311
- L.value ? (o(), c("div", Re, [
313
+ R.value ? (o(), c("div", Me, [
312
314
  k(w),
313
315
  e[5] || (e[5] = u("span", null, "搜索中...", -1))
314
- ])) : !M.value[i.key] || M.value[i.key].length === 0 ? (o(), c("div", Le, [
316
+ ])) : !L.value[i.key] || L.value[i.key].length === 0 ? (o(), c("div", Re, [
315
317
  k(m, {
316
318
  name: "search",
317
319
  size: "48px",
318
320
  style: { color: "#ddd" }
319
321
  }),
320
322
  e[6] || (e[6] = u("p", null, "暂无结果", -1))
321
- ])) : (o(), c("div", Me, [
322
- (o(!0), c(Q, null, oe(M.value[i.key], (d) => (o(), c("div", {
323
+ ])) : (o(), c("div", Le, [
324
+ (o(!0), c(Q, null, oe(L.value[i.key], (d) => (o(), c("div", {
323
325
  key: d.id,
324
- class: ne(["cd-ps-result-item", { "cd-ps-selected": h.value.includes(d.id), "cd-ps-dept-result": !d.isUser }]),
326
+ class: ne(["cd-ps-result-item", { "cd-ps-selected": f.value.includes(d.id), "cd-ps-dept-result": !d.isUser }]),
325
327
  onClick: (Ne) => F(d)
326
328
  }, [
327
329
  k(y, {
328
- checked: h.value.includes(d.id),
329
- onClick: e[2] || (e[2] = Ce(() => {
330
+ checked: f.value.includes(d.id),
331
+ onClick: e[2] || (e[2] = ye(() => {
330
332
  }, ["stop"]))
331
333
  }, null, 8, ["checked"]),
332
334
  u("div", {
@@ -358,10 +360,10 @@ const ze = { class: "cd-ps-container" }, we = {
358
360
  hover: "",
359
361
  checkable: "",
360
362
  "expand-all": !1,
361
- value: h.value,
363
+ value: f.value,
362
364
  onChange: q
363
365
  }, {
364
- label: V(({ node: d }) => [
366
+ label: U(({ node: d }) => [
365
367
  u("div", {
366
368
  class: ne(["cd-ps-node", { "cd-ps-node-user": d.data.isUser }])
367
369
  }, [
@@ -373,14 +375,14 @@ const ze = { class: "cd-ps-container" }, we = {
373
375
  d.data.isUser && d.data.position ? (o(), c("span", Ye, v(d.data.position), 1)) : _("", !0)
374
376
  ]),
375
377
  d.data.userCount && !d.data.isUser ? (o(), c("span", Ze, "(" + v(d.data.userCount) + ")", 1)) : _("", !0),
376
- d.data.isUser ? _("", !0) : (o(), W(f, {
378
+ d.data.isUser ? _("", !0) : (o(), W(h, {
377
379
  key: 1,
378
380
  size: "small",
379
381
  variant: "text",
380
382
  class: "cd-ps-load-btn",
381
- onClick: Ce((Ne) => fe(d, i.key), ["stop"])
383
+ onClick: ye((Ne) => he(d, i.key), ["stop"])
382
384
  }, {
383
- default: V(() => [
385
+ default: U(() => [
384
386
  Y(v(d.data.loaded ? "刷新人员" : "显示人员"), 1)
385
387
  ]),
386
388
  _: 2
@@ -409,13 +411,13 @@ const ze = { class: "cd-ps-container" }, we = {
409
411
  u("div", tt, [
410
412
  e[9] || (e[9] = u("span", { class: "cd-ps-title" }, "已选择", -1)),
411
413
  u("span", at, v(A.value.length) + " 项", 1),
412
- A.value.length > 0 ? (o(), W(f, {
414
+ A.value.length > 0 ? (o(), W(h, {
413
415
  key: 0,
414
416
  size: "small",
415
417
  variant: "text",
416
- onClick: ye
418
+ onClick: ke
417
419
  }, {
418
- default: V(() => [...e[8] || (e[8] = [
420
+ default: U(() => [...e[8] || (e[8] = [
419
421
  Y("清空", -1)
420
422
  ])]),
421
423
  _: 1
@@ -452,13 +454,13 @@ const ze = { class: "cd-ps-container" }, we = {
452
454
  ])
453
455
  ])
454
456
  ]),
455
- k(f, {
457
+ k(h, {
456
458
  size: "small",
457
459
  variant: "text",
458
460
  shape: "circle",
459
- onClick: (_e) => Te(i.id)
461
+ onClick: (_e) => xe(i.id)
460
462
  }, {
461
- icon: V(() => [
463
+ icon: U(() => [
462
464
  k(m, { name: "close" })
463
465
  ]),
464
466
  _: 1
@@ -474,33 +476,30 @@ const ze = { class: "cd-ps-container" }, we = {
474
476
  }, 8, ["visible", "width"]);
475
477
  };
476
478
  }
477
- }), Se = (b, Z) => {
478
- const U = b.__vccOpts || b;
479
- for (const [r, S] of Z)
480
- U[r] = S;
481
- return U;
482
- }, Ie = /* @__PURE__ */ Se(ht, [["__scopeId", "data-v-08bc0ceb"]]), ft = { class: "cd-input-select" }, mt = {
483
- key: 0,
484
- class: "cd-input-select__panel"
485
- }, _t = { class: "cd-input-select__grid" }, gt = { class: "cd-input-select__option-content" }, yt = {
479
+ }), Ie = (b, Z) => {
480
+ const S = b.__vccOpts || b;
481
+ for (const [r, C] of Z)
482
+ S[r] = C;
483
+ return S;
484
+ }, Te = /* @__PURE__ */ Ie(ft, [["__scopeId", "data-v-06746f32"]]), ht = { class: "cd-input-select" }, mt = { class: "cd-input-select__grid" }, _t = { class: "cd-input-select__option-content" }, gt = {
486
485
  key: 0,
487
486
  class: "cd-input-select__option-avatar"
488
- }, kt = ["src", "alt"], bt = { class: "cd-input-select__option-info" }, Ct = { class: "cd-input-select__option-name" }, Vt = {
487
+ }, yt = ["src", "alt"], kt = { class: "cd-input-select__option-info" }, bt = { class: "cd-input-select__option-name" }, Ct = {
489
488
  key: 0,
490
489
  class: "cd-input-select__option-desc"
491
- }, Ut = {
490
+ }, Vt = {
492
491
  key: 1,
493
492
  class: "cd-input-select__option-desc"
494
- }, St = {
493
+ }, Ut = {
495
494
  key: 0,
496
495
  class: "cd-input-select__pager"
497
- }, It = { class: "cd-input-select__pager-info" }, Tt = { class: "cd-input-select__pager-btns" }, xt = { class: "cd-input-select__pager-num" }, Nt = {
496
+ }, St = { class: "cd-input-select__pager-info" }, It = { class: "cd-input-select__pager-btns" }, Tt = { class: "cd-input-select__pager-num" }, xt = {
498
497
  key: 1,
499
498
  class: "cd-input-select__loading"
500
- }, $t = {
499
+ }, Nt = {
501
500
  key: 2,
502
501
  class: "cd-input-select__empty"
503
- }, ge = 10, zt = /* @__PURE__ */ Ue({
502
+ }, ge = 10, $t = /* @__PURE__ */ Se({
504
503
  name: "CdInputPersonSelector",
505
504
  __name: "InputSelect",
506
505
  props: {
@@ -513,10 +512,10 @@ const ze = { class: "cd-ps-container" }, we = {
513
512
  },
514
513
  emits: ["update:modelValue", "search", "load-users", "tab-change"],
515
514
  setup(b, { emit: Z }) {
516
- const U = b, r = Z, S = g(!1), I = g([]), C = g(1), R = D(() => {
517
- const a = (C.value - 1) * ge;
515
+ const S = b, r = Z, C = g(!1), I = g([]), V = g(1), M = D(() => {
516
+ const a = (V.value - 1) * ge;
518
517
  return I.value.slice(a, a + ge);
519
- }), B = D(() => Math.ceil(I.value.length / ge)), h = g(!1), T = g([]), G = g([]), $ = g(!1), L = g(""), M = D(() => U.modelValue.map((a) => ({
518
+ }), B = D(() => Math.ceil(I.value.length / ge)), f = g(!1), T = g([]), G = g([]), $ = g(!1), R = g(""), L = D(() => S.modelValue.map((a) => ({
520
519
  label: a.name,
521
520
  value: a.id
522
521
  }))), K = {
@@ -538,7 +537,7 @@ const ze = { class: "cd-ps-container" }, we = {
538
537
  }, re = (a) => {
539
538
  const l = String(a);
540
539
  return l.startsWith("dept-") ? "warning" : l.startsWith("u-") ? "primary" : l.startsWith("pos-") ? "success" : l.startsWith("role-") ? "info" : "default";
541
- }, O = (a) => U.modelValue.some((l) => l.id === a), ce = (a) => ({
540
+ }, O = (a) => S.modelValue.some((l) => l.id === a), ce = (a) => ({
542
541
  id: a.id,
543
542
  name: a.displayName || a.name || a.title || String(a.id),
544
543
  avatar: a.avatar || "",
@@ -549,9 +548,9 @@ const ze = { class: "cd-ps-container" }, we = {
549
548
  }), j = (a) => {
550
549
  r("update:modelValue", a), G.value = a;
551
550
  }, te = (a) => {
552
- a || (I.value = [], L.value = "");
551
+ a || (I.value = [], R.value = "");
553
552
  }, A = (a, l) => {
554
- a ? U.multiple ? j([...U.modelValue, l]) : (j([l]), $.value = !1) : j(U.modelValue.filter((z) => z.id !== l.id));
553
+ a ? S.multiple ? j([...S.modelValue, l]) : (j([l]), $.value = !1) : j(S.modelValue.filter((z) => z.id !== l.id));
555
554
  }, de = (a, l) => {
556
555
  const { trigger: z, index: E } = l;
557
556
  if ((z === "tag-remove" || z === "backspace") && ($.value = !1), z === "clear")
@@ -559,42 +558,42 @@ const ze = { class: "cd-ps-container" }, we = {
559
558
  else if (["tag-remove", "backspace"].includes(z)) {
560
559
  const F = a.map((q) => q.value || q);
561
560
  T.value = F;
562
- const P = [...U.modelValue];
561
+ const P = [...S.modelValue];
563
562
  P.splice(E, 1), j(P);
564
563
  }
565
564
  }, ae = (a) => {
566
- a.stopPropagation(), a.preventDefault(), $.value = !1, h.value = !0;
565
+ a.stopPropagation(), a.preventDefault(), $.value = !1, f.value = !0;
567
566
  }, pe = (a) => {
568
- 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), h.value = !1;
567
+ const l = a.map(ce), z = new Set(S.modelValue.map((P) => P.id)), E = l.filter((P) => !z.has(P.id)), F = S.multiple ? [...S.modelValue, ...E] : l.slice(0, 1);
568
+ j(F), f.value = !1;
570
569
  }, ve = (a) => {
571
570
  r("load-users", a);
572
- }, he = (a) => {
571
+ }, fe = (a) => {
573
572
  r("search", { keyword: a.keyword, callback: a.callback });
574
573
  };
575
- return X(() => U.modelValue, (a) => {
574
+ return X(() => S.modelValue, (a) => {
576
575
  T.value = a.map((l) => l.id), G.value = a;
577
- }, { immediate: !0, deep: !0 }), X(L, (a) => {
576
+ }, { immediate: !0, deep: !0 }), X(R, (a) => {
578
577
  if (!(a != null && a.trim())) {
579
- I.value = [], S.value = !1;
578
+ I.value = [], C.value = !1;
580
579
  return;
581
580
  }
582
- S.value = !0, r("search", {
581
+ C.value = !0, r("search", {
583
582
  keyword: a,
584
583
  callback: (l) => {
585
- I.value = l, C.value = 1, S.value = !1, l.length > 0 && ($.value = !0);
584
+ I.value = l, V.value = 1, C.value = !1, l.length > 0 && ($.value = !0);
586
585
  }
587
586
  });
588
587
  }), (a, l) => {
589
588
  var q;
590
589
  const z = x("t-checkbox"), E = x("t-button"), F = x("t-tag"), P = x("t-select-input");
591
- return o(), c("div", ft, [
590
+ return o(), c("div", ht, [
592
591
  k(P, {
593
- value: M.value,
594
- inputValue: L.value,
595
- "onUpdate:inputValue": l[2] || (l[2] = (s) => L.value = s),
592
+ value: L.value,
593
+ inputValue: R.value,
594
+ "onUpdate:inputValue": l[3] || (l[3] = (s) => R.value = s),
596
595
  "popup-visible": $.value,
597
- "onUpdate:popupVisible": l[3] || (l[3] = (s) => $.value = s),
596
+ "onUpdate:popupVisible": l[4] || (l[4] = (s) => $.value = s),
598
597
  "input-props": {
599
598
  readonly: !1,
600
599
  disabled: !1
@@ -607,7 +606,7 @@ const ze = { class: "cd-ps-container" }, we = {
607
606
  closeBtn: !0
608
607
  },
609
608
  placeholder: b.placeholder,
610
- loading: S.value,
609
+ loading: C.value,
611
610
  "allow-input": "",
612
611
  clearable: "",
613
612
  multiple: b.multiple,
@@ -615,75 +614,80 @@ const ze = { class: "cd-ps-container" }, we = {
615
614
  onPopupVisibleChange: te,
616
615
  onTagChange: de
617
616
  }, {
618
- panel: V(() => [
619
- I.value.length > 0 ? (o(), c("div", mt, [
620
- u("div", _t, [
621
- (o(!0), c(Q, null, oe(R.value, (s) => (o(), W(z, {
617
+ panel: U(() => [
618
+ I.value.length > 0 ? (o(), c("div", {
619
+ key: 0,
620
+ class: "cd-input-select__panel",
621
+ onMousedown: l[2] || (l[2] = ye(() => {
622
+ }, ["stop"]))
623
+ }, [
624
+ u("div", mt, [
625
+ (o(!0), c(Q, null, oe(M.value, (s) => (o(), W(z, {
622
626
  key: s.id,
623
627
  value: s.id,
624
628
  checked: O(s.id),
625
629
  class: "cd-input-select__option",
626
- onChange: (fe) => A(fe, s)
630
+ onChange: (he) => A(he, s)
627
631
  }, {
628
- default: V(() => [
629
- u("div", gt, [
630
- s.avatar ? (o(), c("div", yt, [
632
+ default: U(() => [
633
+ u("div", _t, [
634
+ s.avatar ? (o(), c("div", gt, [
631
635
  u("img", {
632
636
  src: s.avatar,
633
637
  alt: s.name
634
- }, null, 8, kt)
638
+ }, null, 8, yt)
635
639
  ])) : (o(), c("div", {
636
640
  key: 1,
637
641
  class: "cd-input-select__option-avatar cd-input-select__option-avatar--placeholder",
638
- style: Ve({
642
+ style: Ue({
639
643
  backgroundColor: ee(s.nodeType),
640
644
  color: "#fff"
641
645
  })
642
646
  }, v(ue(s.nodeType)), 5)),
643
- u("div", bt, [
644
- u("div", Ct, v(s.name), 1),
645
- s.isUser && (s.department || s.post) ? (o(), c("div", Vt, v(s.department) + v(s.department && s.post ? " · " : "") + v(s.post), 1)) : s.fnumber ? (o(), c("div", Ut, v(s.fnumber), 1)) : _("", !0)
647
+ u("div", kt, [
648
+ u("div", bt, v(s.name), 1),
649
+ 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
650
  ]),
647
651
  u("span", {
648
652
  class: "cd-input-select__option-tag",
649
- style: Ve({ backgroundColor: ee(s.nodeType) + "18", color: ee(s.nodeType) })
653
+ style: Ue({ backgroundColor: ee(s.nodeType) + "18", color: ee(s.nodeType) })
650
654
  }, v(ie(s.nodeType)), 5)
651
655
  ])
652
656
  ]),
653
657
  _: 2
654
658
  }, 1032, ["value", "checked", "onChange"]))), 128))
655
659
  ]),
656
- B.value > 1 ? (o(), c("div", St, [
657
- u("span", It, v(I.value.length) + " 条结果", 1),
658
- u("div", Tt, [
660
+ B.value > 1 ? (o(), c("div", Ut, [
661
+ u("span", St, v(I.value.length) + " 条结果", 1),
662
+ u("div", It, [
659
663
  k(E, {
660
664
  size: "small",
661
665
  variant: "text",
662
- disabled: C.value <= 1,
663
- onClick: l[0] || (l[0] = (s) => C.value--)
666
+ disabled: V.value <= 1,
667
+ onClick: l[0] || (l[0] = (s) => V.value--)
664
668
  }, {
665
- default: V(() => [...l[8] || (l[8] = [
669
+ default: U(() => [...l[9] || (l[9] = [
666
670
  Y("上一页", -1)
667
671
  ])]),
668
672
  _: 1
669
673
  }, 8, ["disabled"]),
670
- u("span", xt, v(C.value) + "/" + v(B.value), 1),
674
+ u("span", Tt, v(V.value) + "/" + v(B.value), 1),
671
675
  k(E, {
672
676
  size: "small",
673
677
  variant: "text",
674
- disabled: C.value >= B.value,
675
- onClick: l[1] || (l[1] = (s) => C.value++)
678
+ disabled: V.value >= B.value,
679
+ onClick: l[1] || (l[1] = (s) => V.value++)
676
680
  }, {
677
- default: V(() => [...l[9] || (l[9] = [
681
+ default: U(() => [...l[10] || (l[10] = [
678
682
  Y("下一页", -1)
679
683
  ])]),
680
684
  _: 1
681
685
  }, 8, ["disabled"])
682
686
  ])
683
687
  ])) : _("", !0)
684
- ])) : S.value ? (o(), c("div", Nt, " 搜索中... ")) : (o(), c("div", $t, " 暂无搜索结果 "))
688
+ ], 32)) : C.value ? (o(), c("div", xt, " 搜索中... ")) : (o(), c("div", Nt, " 暂无搜索结果 "))
685
689
  ]),
686
- tag: V((s) => [
690
+ tag: U((s) => [
687
691
  s && s.tag ? (o(), W(F, {
688
692
  key: 0,
689
693
  theme: re(typeof s.tag == "object" ? s.tag.value : s.tag),
@@ -691,13 +695,13 @@ const ze = { class: "cd-ps-container" }, we = {
691
695
  closable: !0,
692
696
  size: "medium"
693
697
  }, {
694
- default: V(() => [
698
+ default: U(() => [
695
699
  Y(v(typeof s.tag == "object" ? s.tag.label : s.tag), 1)
696
700
  ]),
697
701
  _: 2
698
702
  }, 1032, ["theme"])) : _("", !0)
699
703
  ]),
700
- suffixIcon: V(() => [
704
+ suffixIcon: U(() => [
701
705
  u("i", {
702
706
  class: "ri-add-circle-line cd-input-select__add-icon",
703
707
  onClick: ae
@@ -705,12 +709,12 @@ const ze = { class: "cd-ps-container" }, we = {
705
709
  ]),
706
710
  _: 1
707
711
  }, 8, ["value", "inputValue", "popup-visible", "placeholder", "loading", "multiple"]),
708
- (q = b.tabs) != null && q.length && h.value ? (o(), W(Ie, {
712
+ (q = b.tabs) != null && q.length && f.value ? (o(), W(Te, {
709
713
  key: 0,
710
- visible: h.value,
711
- "onUpdate:visible": l[4] || (l[4] = (s) => h.value = s),
714
+ visible: f.value,
715
+ "onUpdate:visible": l[5] || (l[5] = (s) => f.value = s),
712
716
  modelValue: T.value,
713
- "onUpdate:modelValue": l[5] || (l[5] = (s) => T.value = s),
717
+ "onUpdate:modelValue": l[6] || (l[6] = (s) => T.value = s),
714
718
  tabs: b.tabs,
715
719
  organizations: b.organizations || [],
716
720
  "show-org": b.showOrg !== !1,
@@ -718,21 +722,21 @@ const ze = { class: "cd-ps-container" }, we = {
718
722
  multiple: b.multiple,
719
723
  onConfirm: pe,
720
724
  onLoadUsers: ve,
721
- onSearch: he,
722
- onTabChange: l[6] || (l[6] = (s) => r("tab-change", s)),
723
- onClose: l[7] || (l[7] = (s) => h.value = !1)
725
+ onSearch: fe,
726
+ onTabChange: l[7] || (l[7] = (s) => r("tab-change", s)),
727
+ onClose: l[8] || (l[8] = (s) => f.value = !1)
724
728
  }, null, 8, ["visible", "modelValue", "tabs", "organizations", "show-org", "multiple"])) : _("", !0)
725
729
  ]);
726
730
  };
727
731
  }
728
- }), wt = /* @__PURE__ */ Se(zt, [["__scopeId", "data-v-fec953fc"]]), Ot = {
732
+ }), zt = /* @__PURE__ */ Ie($t, [["__scopeId", "data-v-e9fbddf8"]]), Bt = {
729
733
  install(b) {
730
- b.component("PersonSelector", Ie), b.component("CdInputPersonSelector", wt);
734
+ b.component("PersonSelector", Te), b.component("CdInputPersonSelector", zt);
731
735
  }
732
736
  };
733
737
  export {
734
- wt as CdInputPersonSelector,
735
- wt as InputSelect,
736
- Ie as PersonSelector,
737
- Ot as default
738
+ zt as CdInputPersonSelector,
739
+ zt as InputSelect,
740
+ Te as PersonSelector,
741
+ Bt as default
738
742
  };