cd-personselector 1.3.7 → 1.3.9

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,5 +1,5 @@
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
- const ze = { class: "cd-ps-container" }, we = {
1
+ import { defineComponent as Se, ref as g, computed as D, watch as X, resolveComponent as N, openBlock as n, createBlock as W, withCtx as I, createElementVNode as u, createElementBlock as c, createVNode as k, Fragment as Q, renderList as oe, createCommentVNode as _, normalizeClass as ne, withModifiers as ue, toDisplayString as v, createTextVNode as Y, nextTick as $e, normalizeStyle as Ue } from "vue";
2
+ const we = { class: "cd-ps-container" }, ze = {
3
3
  key: 0,
4
4
  class: "cd-ps-search"
5
5
  }, Be = {
@@ -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 }, ft = /* @__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,17 +49,17 @@ 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 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 || []);
52
+ setup(b, { expose: Z, emit: C }) {
53
+ var Ce, Ve;
54
+ const r = b, V = C, U = g(r.visible), S = 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
- const ee = D(() => r.showSearch), ue = D(() => r.showOrg), re = D(() => r.dialogWidth), O = g({});
56
+ const ee = D(() => r.showSearch), re = D(() => r.showOrg), pe = D(() => r.dialogWidth), O = g({});
57
57
  X(() => r.tabs, (t) => {
58
58
  if (t && t.length > 0) {
59
59
  const e = {};
60
- t.forEach((n) => {
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);
60
+ t.forEach((s) => {
61
+ e[s.key] = JSON.parse(JSON.stringify(s.tree));
62
+ }), O.value = e, (!S.value || !t.find((s) => s.key === S.value)) && (S.value = t[0].key);
63
63
  }
64
64
  }, { immediate: !0, deep: !0 });
65
65
  function ce() {
@@ -72,20 +72,20 @@ const ze = { class: "cd-ps-container" }, we = {
72
72
  f.value = [], T.value.clear();
73
73
  }
74
74
  X(() => r.modelValue, (t) => {
75
- I.value && t && ce();
75
+ U.value && t && ce();
76
76
  }, { deep: !0 }), X(() => r.visible, (t) => {
77
- I.value = t, t && (ce(), r.organizations.length > 0 && !M.value && (M.value = r.organizations[0].id));
78
- }), X(I, (t) => {
79
- S("update:visible", t);
77
+ U.value = t, t && (ce(), r.organizations.length > 0 && !M.value && (M.value = r.organizations[0].id));
78
+ }), X(U, (t) => {
79
+ V("update:visible", t);
80
80
  });
81
81
  function j(t, e) {
82
82
  e && (G.value[t] = e);
83
83
  }
84
84
  function te(t, e) {
85
- for (const n of t) {
86
- if (n.id === e) return n;
87
- if (n.children) {
88
- const p = te(n.children, e);
85
+ for (const s of t) {
86
+ if (s.id === e) return s;
87
+ if (s.children) {
88
+ const p = te(s.children, e);
89
89
  if (p) return p;
90
90
  }
91
91
  }
@@ -98,21 +98,21 @@ const ze = { class: "cd-ps-container" }, we = {
98
98
  function ae(t) {
99
99
  f.value = f.value.filter((e) => e !== t), T.value.delete(t);
100
100
  }
101
- const pe = (t) => {
102
- var n;
101
+ const ve = (t) => {
102
+ var s;
103
103
  if (!$.value) return t.name;
104
- const e = ((n = L.value[t.key]) == null ? void 0 : n.length) ?? 0;
104
+ const e = ((s = L.value[t.key]) == null ? void 0 : s.length) ?? 0;
105
105
  return e > 0 ? `${t.name} (${e})` : t.name;
106
- }, ve = (t) => {
107
- $.value || (B.value = "", S("tab-change", { tabKey: t }));
108
106
  }, fe = (t) => {
107
+ $.value || (B.value = "", V("tab-change", { tabKey: t }));
108
+ }, he = (t) => {
109
109
  const e = {};
110
110
  r.tabs.forEach((p) => {
111
111
  e[p.key] = [];
112
112
  }), O.value = e;
113
- const n = () => {
113
+ const s = () => {
114
114
  };
115
- S("org-change", { orgId: t, tabKey: C.value, callback: n });
115
+ V("org-change", { orgId: t, tabKey: S.value, callback: s });
116
116
  };
117
117
  let a = null;
118
118
  const l = () => {
@@ -120,17 +120,17 @@ const ze = { class: "cd-ps-container" }, we = {
120
120
  E();
121
121
  return;
122
122
  }
123
- $.value = !0, R.value = !0, a = setTimeout(() => z(), 300);
124
- }, z = () => {
123
+ $.value = !0, R.value = !0, a = setTimeout(() => x(), 300);
124
+ }, x = () => {
125
125
  L.value = {};
126
126
  const t = (e) => {
127
- const n = {};
127
+ const s = {};
128
128
  e.forEach((p) => {
129
- const m = { ...p, isUser: p.isUser !== !1 }, N = p.nodeType || (p.isUser !== !1 ? "user" : "department");
130
- n[N] || (n[N] = []), n[N].push(m);
131
- }), L.value = n, R.value = !1;
129
+ const m = { ...p, isUser: p.isUser !== !1 }, w = p.nodeType || (p.isUser !== !1 ? "user" : "department");
130
+ s[w] || (s[w] = []), s[w].push(m);
131
+ }), L.value = s, R.value = !1;
132
132
  };
133
- S("search", { keyword: B.value, orgId: M.value || void 0, callback: t });
133
+ V("search", { keyword: B.value, orgId: M.value || void 0, callback: t });
134
134
  }, E = () => {
135
135
  a && (clearTimeout(a), a = null), $.value = !1, B.value = "", L.value = {}, R.value = !1;
136
136
  }, F = (t) => {
@@ -138,54 +138,54 @@ const ze = { class: "cd-ps-container" }, we = {
138
138
  ae(t.id);
139
139
  else {
140
140
  r.multiple || (f.value = [], T.value.clear());
141
- const n = t.isUser ? "搜索结果" : t.isPost ? "职位" : "部门";
142
- de(t.id, { ...t, typeName: n, orgId: M.value }), r.multiple || me();
141
+ const s = t.isUser ? "搜索结果" : t.isPost ? "职位" : "部门";
142
+ de(t.id, { ...t, typeName: s, orgId: M.value }), r.multiple || _e();
143
143
  }
144
144
  };
145
145
  function P(t) {
146
- const e = [], n = (p) => {
146
+ const e = [], s = (p) => {
147
147
  for (const m of p)
148
- e.push(m.id), m.children && n(m.children);
148
+ e.push(m.id), m.children && s(m.children);
149
149
  };
150
- return n(t), e;
150
+ return s(t), e;
151
151
  }
152
152
  const q = (t, e) => {
153
- var w, y;
154
- const n = e == null ? void 0 : e.node;
155
- if (n) {
156
- const h = n.value ?? ((w = n.data) == null ? void 0 : w.id);
153
+ var z, y;
154
+ const s = e == null ? void 0 : e.node;
155
+ if (s) {
156
+ const h = s.value ?? ((z = s.data) == null ? void 0 : z.id);
157
157
  if (h !== void 0) {
158
- if (n.checked) {
158
+ if (s.checked) {
159
159
  r.multiple || (f.value = [], T.value.clear());
160
- const H = r.tabs.find((se) => se.key === C.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();
160
+ const H = r.tabs.find((se) => se.key === S.value), le = H ? H.name.replace(/^按/, "") : "";
161
+ de(h, { ...s.data, typeName: le, orgId: M.value }), !r.multiple && ((y = s.data) != null && y.isUser) && _e();
162
162
  } else
163
163
  ae(h);
164
164
  return;
165
165
  }
166
166
  }
167
- const p = O.value[C.value] || [], m = P(p), N = f.value.filter((h) => !m.includes(h));
168
- f.value = [...N, ...t];
167
+ const p = O.value[S.value] || [], m = P(p), w = f.value.filter((h) => !m.includes(h));
168
+ f.value = [...w, ...t];
169
169
  };
170
- function s(t, e, n) {
170
+ function o(t, e, s) {
171
171
  for (const p of t) {
172
172
  if (p.id === e)
173
- return p.children = p.children || [], p.children.push(...n), p.loaded = !0, !0;
174
- if (p.children && s(p.children, e, n))
173
+ return p.children = p.children || [], p.children.push(...s), p.loaded = !0, !0;
174
+ if (p.children && o(p.children, e, s))
175
175
  return !0;
176
176
  }
177
177
  return !1;
178
178
  }
179
- async function he(t, e) {
180
- var N;
181
- const n = t.value, p = G.value[e];
179
+ async function me(t, e) {
180
+ var w;
181
+ const s = t.value, p = G.value[e];
182
182
  if (t.data.loaded) {
183
- const w = O.value[e];
184
- if (w) {
185
- const y = te(w, n);
183
+ const z = O.value[e];
184
+ if (z) {
185
+ const y = te(z, s);
186
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((h) => {
188
+ p && (((w = p.getItem(s)) == null ? void 0 : w.children) || []).filter((h) => {
189
189
  var J;
190
190
  return (J = h.data) == null ? void 0 : J.isUser;
191
191
  }).forEach((h) => {
@@ -195,16 +195,16 @@ const ze = { class: "cd-ps-container" }, we = {
195
195
  }
196
196
  }), t.data.loaded = !1;
197
197
  }
198
- S("load-users", { tabKey: e, nodeId: n, node: t, callback: async (w) => {
199
- if (w.length > 0) {
200
- const y = w.map((J) => {
198
+ V("load-users", { tabKey: e, nodeId: s, node: t, callback: async (z) => {
199
+ if (z.length > 0) {
200
+ const y = z.map((J) => {
201
201
  const { id: H, name: le, ...se } = J;
202
202
  return { ...se, id: H, name: J.displayName || le, isUser: !0 };
203
203
  }), h = O.value[e];
204
- if (h && s(h, n, y), p) {
205
- p.appendTo(n, y), t.data.loaded = !0, await $e();
204
+ if (h && o(h, s, y), p) {
205
+ p.appendTo(s, y), t.data.loaded = !0, await $e();
206
206
  try {
207
- p.setItem(n, { expanded: !0 });
207
+ p.setItem(s, { expanded: !0 });
208
208
  } catch {
209
209
  }
210
210
  }
@@ -212,60 +212,62 @@ 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 h = te(y, n);
215
+ const h = te(y, s);
216
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
223
  }, ke = () => {
224
224
  f.value = [], T.value.clear();
225
- }, me = () => {
226
- S("update:modelValue", f.value), S("confirm", A.value), I.value = !1;
227
- }, xe = () => {
228
- I.value = !1;
225
+ }, _e = () => {
226
+ V("update:modelValue", f.value), V("confirm", A.value), U.value = !1;
227
+ }, be = () => {
228
+ U.value = !1, V("close");
229
229
  };
230
230
  return Z({
231
231
  clearSelection: ke,
232
- appendUsers: (t, e, n) => {
232
+ appendUsers: (t, e, s) => {
233
233
  const p = G.value[t];
234
- if (p && n.length > 0) {
235
- const m = n.map((N) => {
236
- const { id: w, name: y, ...h } = N;
237
- return { ...h, id: w, name: N.displayName || y, isUser: !0 };
234
+ if (p && s.length > 0) {
235
+ const m = s.map((w) => {
236
+ const { id: z, name: y, ...h } = w;
237
+ return { ...h, id: z, name: w.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"), h = x("t-button"), J = x("t-tree"), H = x("t-tab-panel"), le = x("t-tabs"), se = x("t-dialog");
244
- return o(), W(se, {
245
- visible: I.value,
246
- "onUpdate:visible": e[4] || (e[4] = (i) => I.value = i),
243
+ const s = N("t-option"), p = N("t-select"), m = N("t-icon"), w = N("t-input"), z = N("t-loading"), y = N("t-checkbox"), h = N("t-button"), J = N("t-tree"), H = N("t-tab-panel"), le = N("t-tabs"), se = N("t-dialog");
244
+ return n(), W(se, {
245
+ visible: U.value,
246
+ "onUpdate:visible": e[4] || (e[4] = (i) => U.value = i),
247
247
  header: "选择人员",
248
- width: re.value,
248
+ width: pe.value,
249
249
  footer: !0,
250
250
  placement: "center",
251
251
  "destroy-on-close": "",
252
252
  attach: "body",
253
- onConfirm: me,
254
- onClose: xe
253
+ "close-on-overlay-click": !0,
254
+ onConfirm: _e,
255
+ onClose: be,
256
+ onCancel: be
255
257
  }, {
256
- default: V(() => [
257
- u("div", ze, [
258
- ee.value ? (o(), c("div", we, [
259
- ue.value && ie.value.length > 0 ? (o(), c("div", Be, [
258
+ default: I(() => [
259
+ u("div", we, [
260
+ ee.value ? (n(), c("div", ze, [
261
+ re.value && ie.value.length > 0 ? (n(), c("div", Be, [
260
262
  k(p, {
261
263
  modelValue: M.value,
262
264
  "onUpdate:modelValue": e[0] || (e[0] = (i) => M.value = i),
263
265
  placeholder: "选择组织",
264
266
  style: { width: "200px" },
265
- onChange: fe
267
+ onChange: he
266
268
  }, {
267
- default: V(() => [
268
- (o(!0), c(Q, null, oe(ie.value, (i) => (o(), W(n, {
269
+ default: I(() => [
270
+ (n(!0), c(Q, null, oe(ie.value, (i) => (n(), W(s, {
269
271
  key: i.id,
270
272
  value: i.id,
271
273
  label: i.displayName || i.name
@@ -275,7 +277,7 @@ const ze = { class: "cd-ps-container" }, we = {
275
277
  }, 8, ["modelValue"])
276
278
  ])) : _("", !0),
277
279
  u("div", Oe, [
278
- k(N, {
280
+ k(w, {
279
281
  modelValue: B.value,
280
282
  "onUpdate:modelValue": e[1] || (e[1] = (i) => B.value = i),
281
283
  placeholder: "输入手机号/工号/姓名/部门/职位搜索",
@@ -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": I(() => [
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
- onChange: ve
299
+ modelValue: S.value,
300
+ "onUpdate:modelValue": e[3] || (e[3] = (i) => S.value = i),
301
+ onChange: fe
300
302
  }, {
301
- default: V(() => [
302
- (o(!0), c(Q, null, oe(K.value, (i) => (o(), W(H, {
303
+ default: I(() => [
304
+ (n(!0), c(Q, null, oe(K.value, (i) => (n(), W(H, {
303
305
  key: i.key,
304
306
  value: i.key,
305
- label: pe(i)
307
+ label: ve(i)
306
308
  }, {
307
- default: V(() => {
308
- var _e;
309
+ default: I(() => {
310
+ var ge;
309
311
  return [
310
- $.value ? (o(), c(Q, { key: 0 }, [
311
- R.value ? (o(), c("div", Me, [
312
- k(w),
312
+ $.value ? (n(), c(Q, { key: 0 }, [
313
+ R.value ? (n(), c("div", Me, [
314
+ k(z),
313
315
  e[5] || (e[5] = u("span", null, "搜索中...", -1))
314
- ])) : !L.value[i.key] || L.value[i.key].length === 0 ? (o(), c("div", Re, [
316
+ ])) : !L.value[i.key] || L.value[i.key].length === 0 ? (n(), 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", Le, [
322
- (o(!0), c(Q, null, oe(L.value[i.key], (d) => (o(), c("div", {
323
+ ])) : (n(), c("div", Le, [
324
+ (n(!0), c(Q, null, oe(L.value[i.key], (d) => (n(), c("div", {
323
325
  key: d.id,
324
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
330
  checked: f.value.includes(d.id),
329
- onClick: e[2] || (e[2] = ye(() => {
331
+ onClick: e[2] || (e[2] = ue(() => {
330
332
  }, ["stop"]))
331
333
  }, null, 8, ["checked"]),
332
334
  u("div", {
@@ -339,17 +341,17 @@ const ze = { class: "cd-ps-container" }, we = {
339
341
  u("div", We, [
340
342
  u("div", je, v(d.displayName || d.name), 1),
341
343
  u("div", Je, [
342
- d.isUser ? _("", !0) : (o(), c("span", Ae, v(d.isPost ? "职位" : "部门"), 1)),
343
- d.position ? (o(), c("span", Fe, v(d.position), 1)) : _("", !0),
344
- d.department ? (o(), c("span", qe, v(d.department), 1)) : _("", !0),
345
- d.phone ? (o(), c("span", Ge, v(d.phone), 1)) : _("", !0),
346
- d.userCount ? (o(), c("span", He, v(d.userCount) + "人", 1)) : _("", !0)
344
+ d.isUser ? _("", !0) : (n(), c("span", Ae, v(d.isPost ? "职位" : "部门"), 1)),
345
+ d.position ? (n(), c("span", Fe, v(d.position), 1)) : _("", !0),
346
+ d.department ? (n(), c("span", qe, v(d.department), 1)) : _("", !0),
347
+ d.phone ? (n(), c("span", Ge, v(d.phone), 1)) : _("", !0),
348
+ d.userCount ? (n(), c("span", He, v(d.userCount) + "人", 1)) : _("", !0)
347
349
  ])
348
350
  ])
349
351
  ], 10, Ee))), 128))
350
352
  ]))
351
- ], 64)) : (o(), c("div", Qe, [
352
- ((_e = O.value[i.key]) == null ? void 0 : _e.length) > 0 ? (o(), W(J, {
353
+ ], 64)) : (n(), c("div", Qe, [
354
+ ((ge = O.value[i.key]) == null ? void 0 : ge.length) > 0 ? (n(), W(J, {
353
355
  key: 0,
354
356
  ref_for: !0,
355
357
  ref: (d) => j(i.key, d),
@@ -361,7 +363,7 @@ const ze = { class: "cd-ps-container" }, we = {
361
363
  value: f.value,
362
364
  onChange: q
363
365
  }, {
364
- label: V(({ node: d }) => [
366
+ label: I(({ node: d }) => [
365
367
  u("div", {
366
368
  class: ne(["cd-ps-node", { "cd-ps-node-user": d.data.isUser }])
367
369
  }, [
@@ -370,17 +372,17 @@ const ze = { class: "cd-ps-container" }, we = {
370
372
  }, null, 8, ["name"]),
371
373
  u("span", Xe, [
372
374
  Y(v(d.label) + " ", 1),
373
- d.data.isUser && d.data.position ? (o(), c("span", Ye, v(d.data.position), 1)) : _("", !0)
375
+ d.data.isUser && d.data.position ? (n(), c("span", Ye, v(d.data.position), 1)) : _("", !0)
374
376
  ]),
375
- d.data.userCount && !d.data.isUser ? (o(), c("span", Ze, "(" + v(d.data.userCount) + ")", 1)) : _("", !0),
376
- d.data.isUser ? _("", !0) : (o(), W(h, {
377
+ d.data.userCount && !d.data.isUser ? (n(), c("span", Ze, "(" + v(d.data.userCount) + ")", 1)) : _("", !0),
378
+ d.data.isUser ? _("", !0) : (n(), W(h, {
377
379
  key: 1,
378
380
  size: "small",
379
381
  variant: "text",
380
382
  class: "cd-ps-load-btn",
381
- onClick: ye((Ne) => he(d, i.key), ["stop"])
383
+ onClick: ue((Ne) => me(d, i.key), ["stop"])
382
384
  }, {
383
- default: V(() => [
385
+ default: I(() => [
384
386
  Y(v(d.data.loaded ? "刷新人员" : "显示人员"), 1)
385
387
  ]),
386
388
  _: 2
@@ -388,7 +390,7 @@ const ze = { class: "cd-ps-container" }, we = {
388
390
  ], 2)
389
391
  ]),
390
392
  _: 2
391
- }, 1032, ["data", "value"])) : (o(), c("div", Ke, [
393
+ }, 1032, ["data", "value"])) : (n(), c("div", Ke, [
392
394
  k(m, {
393
395
  name: i.icon || "folder-open",
394
396
  size: "48px",
@@ -409,28 +411,28 @@ 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(h, {
414
+ A.value.length > 0 ? (n(), W(h, {
413
415
  key: 0,
414
416
  size: "small",
415
417
  variant: "text",
416
418
  onClick: ke
417
419
  }, {
418
- default: V(() => [...e[8] || (e[8] = [
420
+ default: I(() => [...e[8] || (e[8] = [
419
421
  Y("清空", -1)
420
422
  ])]),
421
423
  _: 1
422
424
  })) : _("", !0)
423
425
  ]),
424
426
  u("div", lt, [
425
- A.value.length === 0 ? (o(), c("div", st, [
427
+ A.value.length === 0 ? (n(), c("div", st, [
426
428
  k(m, {
427
429
  name: "user-checked",
428
430
  size: "64px",
429
431
  style: { color: "#ddd" }
430
432
  }),
431
433
  e[10] || (e[10] = u("p", null, "暂无选择", -1))
432
- ])) : (o(), c("div", nt, [
433
- (o(!0), c(Q, null, oe(A.value, (i) => (o(), c("div", {
434
+ ])) : (n(), c("div", nt, [
435
+ (n(!0), c(Q, null, oe(A.value, (i) => (n(), c("div", {
434
436
  key: i.id,
435
437
  class: ne(["cd-ps-selected-item", { "cd-ps-dept-item": !i.isUser }])
436
438
  }, [
@@ -445,10 +447,10 @@ const ze = { class: "cd-ps-container" }, we = {
445
447
  u("div", it, [
446
448
  u("div", ct, v(i.displayName || i.name), 1),
447
449
  u("div", dt, [
448
- i.isUser && i.position ? (o(), c("span", ut, v(i.position), 1)) : _("", !0),
449
- i.isUser && i.department ? (o(), c("span", rt, v(i.department), 1)) : _("", !0),
450
- i.isUser ? _("", !0) : (o(), c("span", pt, v(i.typeName || "部门"), 1)),
451
- !i.isUser && i.userCount ? (o(), c("span", vt, v(i.userCount) + "人", 1)) : _("", !0)
450
+ i.isUser && i.position ? (n(), c("span", ut, v(i.position), 1)) : _("", !0),
451
+ i.isUser && i.department ? (n(), c("span", rt, v(i.department), 1)) : _("", !0),
452
+ i.isUser ? _("", !0) : (n(), c("span", pt, v(i.typeName || "部门"), 1)),
453
+ !i.isUser && i.userCount ? (n(), c("span", vt, v(i.userCount) + "人", 1)) : _("", !0)
452
454
  ])
453
455
  ])
454
456
  ]),
@@ -456,9 +458,9 @@ const ze = { class: "cd-ps-container" }, we = {
456
458
  size: "small",
457
459
  variant: "text",
458
460
  shape: "circle",
459
- onClick: (_e) => Te(i.id)
461
+ onClick: (ge) => xe(i.id)
460
462
  }, {
461
- icon: V(() => [
463
+ icon: I(() => [
462
464
  k(m, { name: "close" })
463
465
  ]),
464
466
  _: 1
@@ -474,12 +476,12 @@ 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(ft, [["__scopeId", "data-v-08bc0ceb"]]), ht = { class: "cd-input-select" }, mt = { class: "cd-input-select__grid" }, _t = { class: "cd-input-select__option-content" }, gt = {
479
+ }), Ie = (b, Z) => {
480
+ const C = b.__vccOpts || b;
481
+ for (const [r, V] of Z)
482
+ C[r] = V;
483
+ return C;
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 = {
483
485
  key: 0,
484
486
  class: "cd-input-select__option-avatar"
485
487
  }, yt = ["src", "alt"], kt = { class: "cd-input-select__option-info" }, bt = { class: "cd-input-select__option-name" }, Ct = {
@@ -497,7 +499,7 @@ const ze = { class: "cd-ps-container" }, we = {
497
499
  }, Nt = {
498
500
  key: 2,
499
501
  class: "cd-input-select__empty"
500
- }, ge = 10, $t = /* @__PURE__ */ Ue({
502
+ }, ye = 10, $t = /* @__PURE__ */ Se({
501
503
  name: "CdInputPersonSelector",
502
504
  __name: "InputSelect",
503
505
  props: {
@@ -510,10 +512,10 @@ const ze = { class: "cd-ps-container" }, we = {
510
512
  },
511
513
  emits: ["update:modelValue", "search", "load-users", "tab-change"],
512
514
  setup(b, { emit: Z }) {
513
- const U = b, r = Z, S = g(!1), I = g([]), C = g(1), M = D(() => {
514
- const a = (C.value - 1) * ge;
515
- return I.value.slice(a, a + 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) => ({
515
+ const C = b, r = Z, V = g(!1), U = g([]), S = g(1), M = D(() => {
516
+ const a = (S.value - 1) * ye;
517
+ return U.value.slice(a, a + ye);
518
+ }), B = D(() => Math.ceil(U.value.length / ye)), f = g(!1), T = g([]), G = g([]), $ = g(!1), R = g(""), L = D(() => C.modelValue.map((a) => ({
517
519
  label: a.name,
518
520
  value: a.id
519
521
  }))), K = {
@@ -529,13 +531,13 @@ const ze = { class: "cd-ps-container" }, we = {
529
531
  }, ee = (a) => {
530
532
  var l;
531
533
  return ((l = K[a || ""]) == null ? void 0 : l.color) || "#999";
532
- }, ue = (a) => {
534
+ }, re = (a) => {
533
535
  var l;
534
536
  return ((l = K[a || ""]) == null ? void 0 : l.icon) || "?";
535
- }, re = (a) => {
537
+ }, pe = (a) => {
536
538
  const l = String(a);
537
539
  return l.startsWith("dept-") ? "warning" : l.startsWith("u-") ? "primary" : l.startsWith("pos-") ? "success" : l.startsWith("role-") ? "info" : "default";
538
- }, O = (a) => U.modelValue.some((l) => l.id === a), ce = (a) => ({
540
+ }, O = (a) => C.modelValue.some((l) => l.id === a), ce = (a) => ({
539
541
  id: a.id,
540
542
  name: a.displayName || a.name || a.title || String(a.id),
541
543
  avatar: a.avatar || "",
@@ -545,53 +547,57 @@ const ze = { class: "cd-ps-container" }, we = {
545
547
  isUser: a.isUser !== !1
546
548
  }), j = (a) => {
547
549
  r("update:modelValue", a), G.value = a;
548
- }, te = (a) => {
549
- a || (I.value = [], R.value = "");
550
+ }, te = (a, l) => {
551
+ if (a) {
552
+ $.value = !0;
553
+ return;
554
+ }
555
+ const x = (l == null ? void 0 : l.trigger) || "";
556
+ C.multiple && U.value.length > 0 && x !== "document" && x !== "keydown-esc" || ($.value = !1, U.value = [], R.value = "");
550
557
  }, A = (a, l) => {
551
- a ? U.multiple ? j([...U.modelValue, l]) : (j([l]), $.value = !1) : j(U.modelValue.filter((z) => z.id !== l.id));
558
+ a ? C.multiple ? j([...C.modelValue, l]) : (j([l]), $.value = !1) : j(C.modelValue.filter((x) => x.id !== l.id));
552
559
  }, de = (a, l) => {
553
- const { trigger: z, index: E } = l;
554
- if ((z === "tag-remove" || z === "backspace") && ($.value = !1), z === "clear")
560
+ const { trigger: x, index: E } = l;
561
+ if ((x === "tag-remove" || x === "backspace") && ($.value = !1), x === "clear")
555
562
  T.value = [], j([]);
556
- else if (["tag-remove", "backspace"].includes(z)) {
563
+ else if (["tag-remove", "backspace"].includes(x)) {
557
564
  const F = a.map((q) => q.value || q);
558
565
  T.value = F;
559
- const P = [...U.modelValue];
566
+ const P = [...C.modelValue];
560
567
  P.splice(E, 1), j(P);
561
568
  }
562
569
  }, ae = (a) => {
563
570
  a.stopPropagation(), a.preventDefault(), $.value = !1, f.value = !0;
564
- }, pe = (a) => {
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);
566
- j(F), f.value = !1;
567
571
  }, ve = (a) => {
568
- r("load-users", a);
572
+ const l = a.map(ce), x = new Set(C.modelValue.map((P) => P.id)), E = l.filter((P) => !x.has(P.id)), F = C.multiple ? [...C.modelValue, ...E] : l.slice(0, 1);
573
+ j(F), f.value = !1;
569
574
  }, fe = (a) => {
575
+ r("load-users", a);
576
+ }, he = (a) => {
570
577
  r("search", { keyword: a.keyword, callback: a.callback });
571
578
  };
572
- return X(() => U.modelValue, (a) => {
579
+ return X(() => C.modelValue, (a) => {
573
580
  T.value = a.map((l) => l.id), G.value = a;
574
581
  }, { immediate: !0, deep: !0 }), X(R, (a) => {
575
582
  if (!(a != null && a.trim())) {
576
- I.value = [], S.value = !1;
583
+ U.value = [], V.value = !1;
577
584
  return;
578
585
  }
579
- S.value = !0, r("search", {
586
+ V.value = !0, r("search", {
580
587
  keyword: a,
581
588
  callback: (l) => {
582
- I.value = l, C.value = 1, S.value = !1, l.length > 0 && ($.value = !0);
589
+ U.value = l, S.value = 1, V.value = !1, l.length > 0 && ($.value = !0);
583
590
  }
584
591
  });
585
592
  }), (a, l) => {
586
593
  var q;
587
- const z = x("t-checkbox"), E = x("t-button"), F = x("t-tag"), P = x("t-select-input");
588
- return o(), c("div", ht, [
594
+ const x = N("t-checkbox"), E = N("t-button"), F = N("t-tag"), P = N("t-select-input");
595
+ return n(), c("div", ht, [
589
596
  k(P, {
590
597
  value: L.value,
591
598
  inputValue: R.value,
592
- "onUpdate:inputValue": l[3] || (l[3] = (s) => R.value = s),
599
+ "onUpdate:inputValue": l[4] || (l[4] = (o) => R.value = o),
593
600
  "popup-visible": $.value,
594
- "onUpdate:popupVisible": l[4] || (l[4] = (s) => $.value = s),
595
601
  "input-props": {
596
602
  readonly: !1,
597
603
  disabled: !1
@@ -604,7 +610,7 @@ const ze = { class: "cd-ps-container" }, we = {
604
610
  closeBtn: !0
605
611
  },
606
612
  placeholder: b.placeholder,
607
- loading: S.value,
613
+ loading: V.value,
608
614
  "allow-input": "",
609
615
  clearable: "",
610
616
  multiple: b.multiple,
@@ -612,94 +618,96 @@ const ze = { class: "cd-ps-container" }, we = {
612
618
  onPopupVisibleChange: te,
613
619
  onTagChange: de
614
620
  }, {
615
- panel: V(() => [
616
- I.value.length > 0 ? (o(), c("div", {
621
+ panel: I(() => [
622
+ U.value.length > 0 ? (n(), c("div", {
617
623
  key: 0,
618
624
  class: "cd-input-select__panel",
619
- onMousedown: l[2] || (l[2] = ye(() => {
625
+ onMousedown: l[2] || (l[2] = ue(() => {
626
+ }, ["stop"])),
627
+ onClick: l[3] || (l[3] = ue(() => {
620
628
  }, ["stop"]))
621
629
  }, [
622
630
  u("div", mt, [
623
- (o(!0), c(Q, null, oe(M.value, (s) => (o(), W(z, {
624
- key: s.id,
625
- value: s.id,
626
- checked: O(s.id),
631
+ (n(!0), c(Q, null, oe(M.value, (o) => (n(), W(x, {
632
+ key: o.id,
633
+ value: o.id,
634
+ checked: O(o.id),
627
635
  class: "cd-input-select__option",
628
- onChange: (he) => A(he, s)
636
+ onChange: (me) => A(me, o)
629
637
  }, {
630
- default: V(() => [
638
+ default: I(() => [
631
639
  u("div", _t, [
632
- s.avatar ? (o(), c("div", gt, [
640
+ o.avatar ? (n(), c("div", gt, [
633
641
  u("img", {
634
- src: s.avatar,
635
- alt: s.name
642
+ src: o.avatar,
643
+ alt: o.name
636
644
  }, null, 8, yt)
637
- ])) : (o(), c("div", {
645
+ ])) : (n(), c("div", {
638
646
  key: 1,
639
647
  class: "cd-input-select__option-avatar cd-input-select__option-avatar--placeholder",
640
- style: Ve({
641
- backgroundColor: ee(s.nodeType),
648
+ style: Ue({
649
+ backgroundColor: ee(o.nodeType),
642
650
  color: "#fff"
643
651
  })
644
- }, v(ue(s.nodeType)), 5)),
652
+ }, v(re(o.nodeType)), 5)),
645
653
  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)
654
+ u("div", bt, v(o.name), 1),
655
+ o.isUser && (o.department || o.post) ? (n(), c("div", Ct, v(o.department) + v(o.department && o.post ? " · " : "") + v(o.post), 1)) : o.fnumber ? (n(), c("div", Vt, v(o.fnumber), 1)) : _("", !0)
648
656
  ]),
649
657
  u("span", {
650
658
  class: "cd-input-select__option-tag",
651
- style: Ve({ backgroundColor: ee(s.nodeType) + "18", color: ee(s.nodeType) })
652
- }, v(ie(s.nodeType)), 5)
659
+ style: Ue({ backgroundColor: ee(o.nodeType) + "18", color: ee(o.nodeType) })
660
+ }, v(ie(o.nodeType)), 5)
653
661
  ])
654
662
  ]),
655
663
  _: 2
656
664
  }, 1032, ["value", "checked", "onChange"]))), 128))
657
665
  ]),
658
- B.value > 1 ? (o(), c("div", Ut, [
659
- u("span", St, v(I.value.length) + " 条结果", 1),
666
+ B.value > 1 ? (n(), c("div", Ut, [
667
+ u("span", St, v(U.value.length) + " 条结果", 1),
660
668
  u("div", It, [
661
669
  k(E, {
662
670
  size: "small",
663
671
  variant: "text",
664
- disabled: C.value <= 1,
665
- onClick: l[0] || (l[0] = (s) => C.value--)
672
+ disabled: S.value <= 1,
673
+ onClick: l[0] || (l[0] = (o) => S.value--)
666
674
  }, {
667
- default: V(() => [...l[9] || (l[9] = [
675
+ default: I(() => [...l[9] || (l[9] = [
668
676
  Y("上一页", -1)
669
677
  ])]),
670
678
  _: 1
671
679
  }, 8, ["disabled"]),
672
- u("span", Tt, v(C.value) + "/" + v(B.value), 1),
680
+ u("span", Tt, v(S.value) + "/" + v(B.value), 1),
673
681
  k(E, {
674
682
  size: "small",
675
683
  variant: "text",
676
- disabled: C.value >= B.value,
677
- onClick: l[1] || (l[1] = (s) => C.value++)
684
+ disabled: S.value >= B.value,
685
+ onClick: l[1] || (l[1] = (o) => S.value++)
678
686
  }, {
679
- default: V(() => [...l[10] || (l[10] = [
687
+ default: I(() => [...l[10] || (l[10] = [
680
688
  Y("下一页", -1)
681
689
  ])]),
682
690
  _: 1
683
691
  }, 8, ["disabled"])
684
692
  ])
685
693
  ])) : _("", !0)
686
- ], 32)) : S.value ? (o(), c("div", xt, " 搜索中... ")) : (o(), c("div", Nt, " 暂无搜索结果 "))
694
+ ], 32)) : V.value ? (n(), c("div", xt, " 搜索中... ")) : (n(), c("div", Nt, " 暂无搜索结果 "))
687
695
  ]),
688
- tag: V((s) => [
689
- s && s.tag ? (o(), W(F, {
696
+ tag: I((o) => [
697
+ o && o.tag ? (n(), W(F, {
690
698
  key: 0,
691
- theme: re(typeof s.tag == "object" ? s.tag.value : s.tag),
699
+ theme: pe(typeof o.tag == "object" ? o.tag.value : o.tag),
692
700
  variant: "light",
693
701
  closable: !0,
694
702
  size: "medium"
695
703
  }, {
696
- default: V(() => [
697
- Y(v(typeof s.tag == "object" ? s.tag.label : s.tag), 1)
704
+ default: I(() => [
705
+ Y(v(typeof o.tag == "object" ? o.tag.label : o.tag), 1)
698
706
  ]),
699
707
  _: 2
700
708
  }, 1032, ["theme"])) : _("", !0)
701
709
  ]),
702
- suffixIcon: V(() => [
710
+ suffixIcon: I(() => [
703
711
  u("i", {
704
712
  class: "ri-add-circle-line cd-input-select__add-icon",
705
713
  onClick: ae
@@ -707,34 +715,34 @@ const ze = { class: "cd-ps-container" }, we = {
707
715
  ]),
708
716
  _: 1
709
717
  }, 8, ["value", "inputValue", "popup-visible", "placeholder", "loading", "multiple"]),
710
- (q = b.tabs) != null && q.length && f.value ? (o(), W(Ie, {
718
+ (q = b.tabs) != null && q.length && f.value ? (n(), W(Te, {
711
719
  key: 0,
712
720
  visible: f.value,
713
- "onUpdate:visible": l[5] || (l[5] = (s) => f.value = s),
721
+ "onUpdate:visible": l[5] || (l[5] = (o) => f.value = o),
714
722
  modelValue: T.value,
715
- "onUpdate:modelValue": l[6] || (l[6] = (s) => T.value = s),
723
+ "onUpdate:modelValue": l[6] || (l[6] = (o) => T.value = o),
716
724
  tabs: b.tabs,
717
725
  organizations: b.organizations || [],
718
726
  "show-org": b.showOrg !== !1,
719
727
  "show-search": !0,
720
728
  multiple: b.multiple,
721
- onConfirm: pe,
722
- onLoadUsers: ve,
723
- onSearch: fe,
724
- onTabChange: l[7] || (l[7] = (s) => r("tab-change", s)),
725
- onClose: l[8] || (l[8] = (s) => f.value = !1)
729
+ onConfirm: ve,
730
+ onLoadUsers: fe,
731
+ onSearch: he,
732
+ onTabChange: l[7] || (l[7] = (o) => r("tab-change", o)),
733
+ onClose: l[8] || (l[8] = (o) => f.value = !1)
726
734
  }, null, 8, ["visible", "modelValue", "tabs", "organizations", "show-org", "multiple"])) : _("", !0)
727
735
  ]);
728
736
  };
729
737
  }
730
- }), zt = /* @__PURE__ */ Se($t, [["__scopeId", "data-v-e9fbddf8"]]), Bt = {
738
+ }), wt = /* @__PURE__ */ Ie($t, [["__scopeId", "data-v-29d7ef35"]]), Bt = {
731
739
  install(b) {
732
- b.component("PersonSelector", Ie), b.component("CdInputPersonSelector", zt);
740
+ b.component("PersonSelector", Te), b.component("CdInputPersonSelector", wt);
733
741
  }
734
742
  };
735
743
  export {
736
- zt as CdInputPersonSelector,
737
- zt as InputSelect,
738
- Ie as PersonSelector,
744
+ wt as CdInputPersonSelector,
745
+ wt as InputSelect,
746
+ Te as PersonSelector,
739
747
  Bt as default
740
748
  };