@blueking/bk-user-selector 0.0.19 → 0.0.21

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/README.md CHANGED
@@ -123,21 +123,23 @@ import '@blueking/bk-user-selector/vue2/vue2.css';
123
123
 
124
124
  ### 属性
125
125
 
126
- | 参数 | 说明 | 类型 | 默认值 |
127
- | -------------------- | ----------------------------------------------------------------------- | -------------- | ------------------ |
128
- | modelValue / v-model | 绑定值,单选为字符串,多选为数组 | String / Array | '' / [] |
129
- | label | 文本标签 | String | 人员选择 |
130
- | required | 是否必填 | Boolean | false |
131
- | placeholder | 占位文本 | String | 请输入人员名称搜索 |
132
- | multiple | 是否多选 | Boolean | false |
133
- | draggable | 是否可拖拽(仅多选模式有效) | Boolean | false |
134
- | apiBaseUrl | API 基础 URL | String | '' |
135
- | tenantId | 租户 ID | String | '' |
136
- | exactSearchKey | 精确查找key,可选值为 bk_username、login_name、full_name, 多个以逗号分隔 | String | bk_username |
137
- | currentUserId | 当前用户ID(用于快速选择"我") | String | '' |
138
- | userGroup | 用户组列表,用于在下拉列表中显示用户组 | Array | [] |
139
- | userGroupName | 用户组名称,用于在下拉列表中显示用户组名称 | String | 用户群组 |
140
- | emptyText | 无匹配人员时的提示文本 | String | 无匹配人员 |
126
+ | 参数 | 说明 | 类型 | 默认值 |
127
+ | -------------------- | ----------------------------------------------------------------------- | ------------------------------ | ------------------ |
128
+ | modelValue / v-model | 绑定值,单选为字符串,多选为数组 | String / Array | '' / [] |
129
+ | label | 文本标签 | String | 人员选择 |
130
+ | required | 是否必填 | Boolean | false |
131
+ | placeholder | 占位文本 | String | 请输入人员名称搜索 |
132
+ | multiple | 是否多选 | Boolean | false |
133
+ | draggable | 是否可拖拽(仅多选模式有效) | Boolean | false |
134
+ | apiBaseUrl | API 基础 URL | String | '' |
135
+ | tenantId | 租户 ID | String | '' |
136
+ | exactSearchKey | 精确查找key,可选值为 bk_username、login_name、full_name, 多个以逗号分隔 | String | bk_username |
137
+ | currentUserId | 当前用户ID(用于快速选择"我") | String | '' |
138
+ | userGroup | 用户组列表,用于在下拉列表中显示用户组 | Array | [] |
139
+ | userGroupName | 用户组名称,用于在下拉列表中显示用户组名称 | String | 用户群组 |
140
+ | emptyText | 无匹配人员时的提示文本 | String | 无匹配人员 |
141
+ | renderTag | 渲染标签 | Function(h, userInfo) => VNode | - |
142
+ | renderListItem | 渲染列表项 | Function(h, userInfo) => VNode | - |
141
143
 
142
144
  ### 事件
143
145
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/bk-user-selector",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "蓝鲸用户选择器",
5
5
  "license": "MIT",
6
6
  "author": "Tencent BlueKing",
@@ -40,6 +40,11 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
40
40
  userGroup: {
41
41
  id: string;
42
42
  name: string;
43
+ hidden
44
+ /**
45
+ * 多选模式用户选择器组件
46
+ */
47
+ ?: boolean;
43
48
  }[];
44
49
  userGroupName: string;
45
50
  emptyText: string;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * 用户选择器下拉菜单组件
3
+ */
4
+ import { createVNode, VNode } from 'vue';
1
5
  import { FormattedUser } from '../types';
2
6
  declare const _default: import("vue").DefineComponent<{
3
7
  /**
@@ -74,6 +78,12 @@ declare const _default: import("vue").DefineComponent<{
74
78
  type: StringConstructor;
75
79
  default: string;
76
80
  };
81
+ /**
82
+ * 渲染列表项
83
+ */
84
+ renderListItem: {
85
+ type: () => (h: typeof createVNode, item: FormattedUser) => VNode;
86
+ };
77
87
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
78
88
  "select-user": (...args: any[]) => void;
79
89
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -151,6 +161,12 @@ declare const _default: import("vue").DefineComponent<{
151
161
  type: StringConstructor;
152
162
  default: string;
153
163
  };
164
+ /**
165
+ * 渲染列表项
166
+ */
167
+ renderListItem: {
168
+ type: () => (h: typeof createVNode, item: FormattedUser) => VNode;
169
+ };
154
170
  }>> & {
155
171
  "onSelect-user"?: ((...args: any[]) => any) | undefined;
156
172
  }, {
@@ -31,6 +31,11 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
31
31
  userGroup: {
32
32
  id: string;
33
33
  name: string;
34
+ hidden
35
+ /**
36
+ * 单选模式用户选择器组件
37
+ */
38
+ ?: boolean;
34
39
  }[];
35
40
  userGroupName: string;
36
41
  emptyText: string;
@@ -0,0 +1,21 @@
1
+ import type { FormattedUser } from '../types';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ render: {
4
+ type: FunctionConstructor;
5
+ required: true;
6
+ };
7
+ user: {
8
+ type: () => FormattedUser;
9
+ required: true;
10
+ };
11
+ }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
12
+ render: {
13
+ type: FunctionConstructor;
14
+ required: true;
15
+ };
16
+ user: {
17
+ type: () => FormattedUser;
18
+ required: true;
19
+ };
20
+ }>>, {}, {}>;
21
+ export default _default;
@@ -35,6 +35,12 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
35
35
  userGroup: {
36
36
  id: string;
37
37
  name: string;
38
+ hidden
39
+ /**
40
+ * 蓝鲸用户选择器组件
41
+ * @module components/UserSelector
42
+ */
43
+ ?: boolean;
38
44
  }[];
39
45
  userGroupName: string;
40
46
  emptyText: string;
@@ -1,3 +1,4 @@
1
+ import { createVNode, VNode } from 'vue';
1
2
  import { FormattedUser } from '../types';
2
3
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
3
4
  /**
@@ -24,6 +25,10 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
24
25
  * 是否显示租户信息
25
26
  */
26
27
  showTenant?: boolean;
28
+ /**
29
+ * 渲染标签
30
+ */
31
+ renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
27
32
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
28
33
  click: (...args: any[]) => void;
29
34
  close: (...args: any[]) => void;
@@ -52,6 +57,10 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
52
57
  * 是否显示租户信息
53
58
  */
54
59
  showTenant?: boolean;
60
+ /**
61
+ * 渲染标签
62
+ */
63
+ renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
55
64
  }>>> & {
56
65
  onClick?: ((...args: any[]) => any) | undefined;
57
66
  onClose?: ((...args: any[]) => any) | undefined;
@@ -97,6 +97,7 @@ interface BaseSelectorProps {
97
97
  userGroup?: {
98
98
  id: string;
99
99
  name: string;
100
+ hidden?: boolean;
100
101
  }[];
101
102
  /**
102
103
  * 用户组名称
@@ -1,5 +1,5 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "@blueking/bkui-library";
2
- import { ref, onBeforeMount, defineComponent, createElementBlock, createCommentVNode, openBlock, withModifiers, normalizeClass, computed, createBlock, unref, withCtx, createVNode, createElementVNode, toDisplayString, Fragment, renderList, watch, nextTick, onMounted, withDirectives, isRef, vModelText, createTextVNode, pushScopeId, popScopeId, createApp, h as h$1 } from "@blueking/bkui-library";
2
+ import { ref, onBeforeMount, defineComponent, createElementBlock, createCommentVNode, openBlock, withModifiers, normalizeClass, h as h$1, computed, createBlock, unref, withCtx, createVNode, createElementVNode, toDisplayString, Fragment, renderList, watch, nextTick, onMounted, withDirectives, isRef, vModelText, createTextVNode, createApp } from "@blueking/bkui-library";
3
3
  const getTenants = async (apiBaseUrl, tenantId) => {
4
4
  if (!apiBaseUrl || !tenantId) {
5
5
  console.warn("获取租户信息需要提供有效的apiBaseUrl和租户ID");
@@ -16601,7 +16601,7 @@ const useUserSearch = (apiBaseUrl, tenantId) => {
16601
16601
  const loading2 = ref(false);
16602
16602
  const searchQuery = ref("");
16603
16603
  const performSearch = async (keyword) => {
16604
- if (!keyword || keyword.length < 2) {
16604
+ if (!(keyword == null ? void 0 : keyword.length)) {
16605
16605
  searchResults.value = [];
16606
16606
  return;
16607
16607
  }
@@ -16690,14 +16690,39 @@ const _export_sfc = (sfc, props2) => {
16690
16690
  return target;
16691
16691
  };
16692
16692
  const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-887b7c44"]]);
16693
+ const UserRender = defineComponent({
16694
+ name: "UserRender",
16695
+ props: {
16696
+ render: {
16697
+ type: Function,
16698
+ required: true
16699
+ },
16700
+ user: {
16701
+ type: Object,
16702
+ required: true
16703
+ }
16704
+ },
16705
+ setup(props2) {
16706
+ return () => {
16707
+ try {
16708
+ return props2.render(h$1, props2.user);
16709
+ } catch (error3) {
16710
+ console.error("Error rendering tag:", error3);
16711
+ return h$1("div", props2.user.name);
16712
+ }
16713
+ };
16714
+ }
16715
+ });
16693
16716
  const _hoisted_1$4 = {
16694
16717
  key: 0,
16695
16718
  class: "no-data"
16696
16719
  };
16697
16720
  const _hoisted_2$3 = { class: "group-name" };
16698
- const _hoisted_3$3 = { class: "group-count" };
16721
+ const _hoisted_3$2 = { class: "group-count" };
16699
16722
  const _hoisted_4$1 = ["onMousedown"];
16700
- const _hoisted_5 = {
16723
+ const _hoisted_5 = { key: 0 };
16724
+ const _hoisted_6 = { key: 1 };
16725
+ const _hoisted_7 = {
16701
16726
  key: 0,
16702
16727
  class: "tenant-name"
16703
16728
  };
@@ -16776,6 +16801,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16776
16801
  emptyText: {
16777
16802
  type: String,
16778
16803
  default: "无匹配人员"
16804
+ },
16805
+ /**
16806
+ * 渲染列表项
16807
+ */
16808
+ renderListItem: {
16809
+ type: Function
16779
16810
  }
16780
16811
  },
16781
16812
  emits: ["select-user"],
@@ -16785,7 +16816,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16785
16816
  const groupedUsers = computed(() => {
16786
16817
  const groups = {};
16787
16818
  if (Array.isArray(props2.userGroup) && props2.userGroup.length > 0) {
16788
- groups[props2.userGroupName] = props2.userGroup.filter((group) => !group.hidden).map((group) => ({
16819
+ groups[props2.userGroupName] = props2.userGroup.map((group) => ({
16789
16820
  ...group,
16790
16821
  tenantId: "",
16791
16822
  type: "userGroup"
@@ -16825,7 +16856,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16825
16856
  createElementVNode(
16826
16857
  "span",
16827
16858
  null,
16828
- toDisplayString(__props.searchQuery.length > 1 ? __props.emptyText : "请至少输入2个字符搜索"),
16859
+ toDisplayString(__props.emptyText),
16829
16860
  1
16830
16861
  /* TEXT */
16831
16862
  )
@@ -16855,7 +16886,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16855
16886
  ),
16856
16887
  createElementVNode(
16857
16888
  "span",
16858
- _hoisted_3$3,
16889
+ _hoisted_3$2,
16859
16890
  "(" + toDisplayString(group.length) + ")",
16860
16891
  1
16861
16892
  /* TEXT */
@@ -16873,7 +16904,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16873
16904
  key: user.id,
16874
16905
  onMousedown: withModifiers(($event) => selectUser(user), ["prevent"])
16875
16906
  }, [
16876
- createElementVNode("div", null, [
16907
+ __props.renderListItem ? (openBlock(), createElementBlock("div", _hoisted_5, [
16908
+ createVNode(unref(UserRender), {
16909
+ render: __props.renderListItem,
16910
+ user
16911
+ }, null, 8, ["render", "user"])
16912
+ ])) : (openBlock(), createElementBlock("div", _hoisted_6, [
16877
16913
  createElementVNode(
16878
16914
  "span",
16879
16915
  null,
@@ -16883,12 +16919,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16883
16919
  ),
16884
16920
  user.tenantId !== __props.tenantId && user.tenantId && __props.tenants[user.tenantId] ? (openBlock(), createElementBlock(
16885
16921
  "span",
16886
- _hoisted_5,
16922
+ _hoisted_7,
16887
16923
  "@" + toDisplayString(__props.tenants[user.tenantId]),
16888
16924
  1
16889
16925
  /* TEXT */
16890
16926
  )) : createCommentVNode("v-if", true)
16891
- ])
16927
+ ]))
16892
16928
  ], 40, _hoisted_4$1);
16893
16929
  }),
16894
16930
  128
@@ -16910,10 +16946,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
16910
16946
  };
16911
16947
  }
16912
16948
  });
16913
- const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-f47cc878"]]);
16914
- const _hoisted_1$3 = { class: "tag-content" };
16915
- const _hoisted_2$2 = { class: "user-name" };
16916
- const _hoisted_3$2 = {
16949
+ const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-a1278ff6"]]);
16950
+ const _hoisted_1$3 = { key: 0 };
16951
+ const _hoisted_2$2 = {
16952
+ key: 1,
16953
+ class: "tag-content"
16954
+ };
16955
+ const _hoisted_3$1 = { class: "user-name" };
16956
+ const _hoisted_4 = {
16917
16957
  key: 0,
16918
16958
  class: "tenant-name"
16919
16959
  };
@@ -16928,7 +16968,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16928
16968
  currentTenantId: {},
16929
16969
  draggable: { type: Boolean },
16930
16970
  active: { type: Boolean },
16931
- showTenant: { type: Boolean }
16971
+ showTenant: { type: Boolean },
16972
+ renderTag: { type: Function }
16932
16973
  },
16933
16974
  emits: ["click", "close"],
16934
16975
  setup(__props, { emit: __emit }) {
@@ -16947,22 +16988,27 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16947
16988
  onClose: handleClose
16948
16989
  }, {
16949
16990
  default: withCtx(() => [
16950
- createElementVNode("div", _hoisted_1$3, [
16991
+ _ctx.renderTag ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
16992
+ createVNode(unref(UserRender), {
16993
+ render: _ctx.renderTag,
16994
+ user: _ctx.user
16995
+ }, null, 8, ["render", "user"])
16996
+ ])) : (openBlock(), createElementBlock("div", _hoisted_2$2, [
16951
16997
  createElementVNode(
16952
16998
  "span",
16953
- _hoisted_2$2,
16999
+ _hoisted_3$1,
16954
17000
  toDisplayString(_ctx.user.name),
16955
17001
  1
16956
17002
  /* TEXT */
16957
17003
  ),
16958
17004
  _ctx.user.tenantId !== _ctx.currentTenantId && _ctx.user.tenantId ? (openBlock(), createElementBlock(
16959
17005
  "span",
16960
- _hoisted_3$2,
17006
+ _hoisted_4,
16961
17007
  " @" + toDisplayString(_ctx.tenants[_ctx.user.tenantId]),
16962
17008
  1
16963
17009
  /* TEXT */
16964
17010
  )) : createCommentVNode("v-if", true)
16965
- ])
17011
+ ]))
16966
17012
  ]),
16967
17013
  _: 1
16968
17014
  /* STABLE */
@@ -16970,10 +17016,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16970
17016
  };
16971
17017
  }
16972
17018
  });
16973
- const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-87c12feb"]]);
17019
+ const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7099192b"]]);
16974
17020
  const _hoisted_1$2 = ["onClick"];
16975
17021
  const _hoisted_2$1 = ["placeholder"];
16976
- const _hoisted_3$1 = ["placeholder"];
17022
+ const _hoisted_3 = ["placeholder"];
16977
17023
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
16978
17024
  ...{
16979
17025
  name: "BkUserSelectorMultiple"
@@ -17022,6 +17068,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17022
17068
  const options = computed(() => {
17023
17069
  return searchResults.value.filter((user) => !props2.selectedUsers.some((selectedUser) => selectedUser.id === user.id));
17024
17070
  });
17071
+ const userGroupFilter = computed(() => {
17072
+ return props2.userGroup.filter((group) => !props2.selectedUsers.some((user) => user.id === group.id) && !group.hidden);
17073
+ });
17025
17074
  const initSortable = () => {
17026
17075
  if (!props2.draggable || !sortableContainerRef.value) return;
17027
17076
  if (sortableInstance.value) {
@@ -17111,7 +17160,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17111
17160
  if (!isFocused.value) {
17112
17161
  isFocused.value = true;
17113
17162
  }
17114
- if (searchQuery.value.length >= 2) {
17163
+ if (searchQuery.value.length >= 1) {
17115
17164
  showDropdown.value = true;
17116
17165
  }
17117
17166
  };
@@ -17280,11 +17329,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17280
17329
  active: index === activeTagIndex.value,
17281
17330
  "current-tenant-id": _ctx.tenantId,
17282
17331
  draggable: _ctx.draggable,
17332
+ "render-tag": _ctx.renderTag,
17283
17333
  tenants: _ctx.tenants,
17284
17334
  user,
17285
17335
  onClick: ($event) => handleTagClick(index),
17286
17336
  onClose: ($event) => removeUser(user)
17287
- }, null, 8, ["active", "current-tenant-id", "draggable", "tenants", "user", "onClick", "onClose"]),
17337
+ }, null, 8, ["active", "current-tenant-id", "draggable", "render-tag", "tenants", "user", "onClick", "onClose"]),
17288
17338
  createCommentVNode(" 在当前激活标签后插入输入框 "),
17289
17339
  index === activeTagIndex.value && activeTagIndex.value !== _ctx.selectedUsers.length - 1 ? withDirectives((openBlock(), createElementBlock(
17290
17340
  "input",
@@ -17360,12 +17410,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17360
17410
  return openBlock(), createBlock(UserTag, {
17361
17411
  "current-tenant-id": _ctx.tenantId,
17362
17412
  key: user.id,
17413
+ "render-tag": _ctx.renderTag,
17363
17414
  "show-tenant": true,
17364
17415
  tenants: _ctx.tenants,
17365
17416
  user,
17366
17417
  onClick: handleFocus,
17367
17418
  onClose: ($event) => removeUser(user)
17368
- }, null, 8, ["current-tenant-id", "tenants", "user", "onClose"]);
17419
+ }, null, 8, ["current-tenant-id", "render-tag", "tenants", "user", "onClose"]);
17369
17420
  }),
17370
17421
  128
17371
17422
  /* KEYED_FRAGMENT */
@@ -17398,7 +17449,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17398
17449
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(searchQuery) ? searchQuery.value = $event : null),
17399
17450
  placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
17400
17451
  onFocus: handleFocus
17401
- }, null, 40, _hoisted_3$1), [
17452
+ }, null, 40, _hoisted_3), [
17402
17453
  [vModelText, unref(searchQuery)]
17403
17454
  ]),
17404
17455
  createCommentVNode(' 未聚焦状态下的"我"标签 '),
@@ -17422,14 +17473,15 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17422
17473
  "is-show": showDropdown.value,
17423
17474
  loading: unref(searchLoading),
17424
17475
  options: options.value,
17476
+ "render-list-item": _ctx.renderListItem,
17425
17477
  "search-query": unref(searchQuery),
17426
17478
  "tenant-id": _ctx.tenantId,
17427
17479
  tenants: _ctx.tenants,
17428
- "user-group": _ctx.userGroup,
17480
+ "user-group": userGroupFilter.value,
17429
17481
  "user-group-name": _ctx.userGroupName,
17430
17482
  onClickoutside: handleClickOutside,
17431
17483
  onSelectUser: addUser
17432
- }, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
17484
+ }, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
17433
17485
  ],
17434
17486
  512
17435
17487
  /* NEED_PATCH */
@@ -17437,21 +17489,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17437
17489
  };
17438
17490
  }
17439
17491
  });
17440
- const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-1b988eae"]]);
17441
- const _withScopeId = (n2) => (pushScopeId("data-v-5040d42f"), n2 = n2(), popScopeId(), n2);
17492
+ const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d4f489c3"]]);
17442
17493
  const _hoisted_1$1 = { class: "input-container" };
17443
- const _hoisted_2 = {
17444
- key: 0,
17445
- class: "tenant-name"
17446
- };
17447
- const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode(
17448
- "i",
17449
- { class: "close-icon" },
17450
- "×",
17451
- -1
17452
- /* HOISTED */
17453
- ));
17454
- const _hoisted_4 = ["placeholder"];
17494
+ const _hoisted_2 = ["placeholder"];
17455
17495
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17456
17496
  ...{
17457
17497
  name: "BkUserSelectorSingle"
@@ -17482,6 +17522,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17482
17522
  const selectedUser = ref(props2.modelValue || "");
17483
17523
  const searchQuery = ref("");
17484
17524
  const showDropdown = ref(false);
17525
+ const userGroupFilter = computed(() => {
17526
+ return props2.userGroup.filter((group) => group.id !== selectedUser.value && !group.hidden);
17527
+ });
17485
17528
  const selectedUserInfo = computed(() => {
17486
17529
  const userGroup = (props2.userGroup || []).map((group) => ({
17487
17530
  ...group,
@@ -17530,7 +17573,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17530
17573
  }
17531
17574
  };
17532
17575
  const fetchUsers = async (keyword = "") => {
17533
- if (!keyword || keyword.length < 2) {
17576
+ if (!(keyword == null ? void 0 : keyword.length)) {
17534
17577
  options.value = [];
17535
17578
  return;
17536
17579
  }
@@ -17555,13 +17598,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17555
17598
  searchQuery.value = "";
17556
17599
  };
17557
17600
  const handleInputFocus = () => {
17558
- if (searchQuery.value.length >= 2 || Array.isArray(props2.userGroup) && props2.userGroup.length > 0) {
17601
+ if (searchQuery.value.length >= 1 || Array.isArray(props2.userGroup) && props2.userGroup.length > 0) {
17559
17602
  showDropdown.value = true;
17560
17603
  }
17561
17604
  };
17562
17605
  const handleInput = () => {
17563
17606
  fetchUsers(searchQuery.value);
17564
- showDropdown.value = searchQuery.value.length >= 2;
17607
+ showDropdown.value = searchQuery.value.length >= 1;
17565
17608
  };
17566
17609
  const handleClickOutside = () => {
17567
17610
  showDropdown.value = false;
@@ -17580,24 +17623,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17580
17623
  createCommentVNode(" 用户标签显示 "),
17581
17624
  selectedUserInfo.value ? (openBlock(), createElementBlock("div", {
17582
17625
  key: 0,
17583
- class: "selected-user",
17584
17626
  onClick: withModifiers(removeSelectedUser, ["stop"])
17585
17627
  }, [
17586
- createElementVNode(
17587
- "span",
17588
- null,
17589
- toDisplayString(selectedUserInfo.value.name),
17590
- 1
17591
- /* TEXT */
17592
- ),
17593
- selectedUserInfo.value.tenantId !== _ctx.tenantId && selectedUserInfo.value.tenantId && _ctx.tenants[selectedUserInfo.value.tenantId] ? (openBlock(), createElementBlock(
17594
- "span",
17595
- _hoisted_2,
17596
- "@" + toDisplayString(_ctx.tenants[selectedUserInfo.value.tenantId]),
17597
- 1
17598
- /* TEXT */
17599
- )) : createCommentVNode("v-if", true),
17600
- _hoisted_3
17628
+ createVNode(UserTag, {
17629
+ "render-tag": _ctx.renderTag,
17630
+ tenants: _ctx.tenants,
17631
+ user: selectedUserInfo.value,
17632
+ onClose: removeSelectedUser
17633
+ }, null, 8, ["render-tag", "tenants", "user"])
17601
17634
  ])) : createCommentVNode("v-if", true),
17602
17635
  withDirectives(createElementVNode("input", {
17603
17636
  ref_key: "inputRef",
@@ -17607,7 +17640,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17607
17640
  placeholder: selectedUserInfo.value ? "" : _ctx.placeholder,
17608
17641
  onFocus: handleInputFocus,
17609
17642
  onInput: handleInput
17610
- }, null, 40, _hoisted_4), [
17643
+ }, null, 40, _hoisted_2), [
17611
17644
  [vModelText, searchQuery.value]
17612
17645
  ]),
17613
17646
  createCommentVNode(' "我"标签 '),
@@ -17624,20 +17657,21 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17624
17657
  "is-show": showDropdown.value,
17625
17658
  loading: isLoading.value,
17626
17659
  options: options.value,
17660
+ "render-list-item": _ctx.renderListItem,
17627
17661
  "search-query": searchQuery.value,
17628
17662
  "tenant-id": _ctx.tenantId,
17629
17663
  tenants: _ctx.tenants,
17630
- "user-group": _ctx.userGroup,
17664
+ "user-group": userGroupFilter.value,
17631
17665
  "user-group-name": _ctx.userGroupName,
17632
17666
  onSelectUser: addUser
17633
- }, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
17667
+ }, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
17634
17668
  ])), [
17635
17669
  [unref(__webpack_exports__clickoutside), handleClickOutside]
17636
17670
  ]);
17637
17671
  };
17638
17672
  }
17639
17673
  });
17640
- const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-5040d42f"]]);
17674
+ const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-91a75bba"]]);
17641
17675
  const _hoisted_1 = {
17642
17676
  ref: "containerRef",
17643
17677
  class: "bk-user-selector"