@blueking/bk-user-selector 0.0.24 → 0.0.26

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
@@ -127,18 +127,18 @@ export default {
127
127
  | 参数 | 说明 | 类型 | 默认值 |
128
128
  | -------------------- | ----------------------------------------------------------------------- | ------------------------------ | ------------------ |
129
129
  | modelValue / v-model | 绑定值,单选为字符串,多选为数组 | String / Array | '' / [] |
130
+ | apiBaseUrl | API 基础 URL | String | '' |
131
+ | tenantId | 租户 ID | String | '' |
130
132
  | label | 文本标签 | String | 人员选择 |
131
- | required | 是否必填 | Boolean | false |
132
133
  | placeholder | 占位文本 | String | 请输入人员名称搜索 |
133
134
  | multiple | 是否多选 | Boolean | false |
134
135
  | draggable | 是否可拖拽(仅多选模式有效) | Boolean | false |
135
- | apiBaseUrl | API 基础 URL | String | '' |
136
- | tenantId | 租户 ID | String | '' |
137
136
  | exactSearchKey | 精确查找key,可选值为 bk_username、login_name、full_name, 多个以逗号分隔 | String | bk_username |
138
137
  | currentUserId | 当前用户ID(用于快速选择"我") | String | '' |
139
138
  | userGroup | 用户组列表,用于在下拉列表中显示用户组 | Array | [] |
140
139
  | userGroupName | 用户组名称,用于在下拉列表中显示用户组名称 | String | 用户群组 |
141
140
  | emptyText | 无匹配人员时的提示文本 | String | 无匹配人员 |
141
+ | disabled | 是否禁用 | Boolean | false |
142
142
  | renderTag | 渲染标签 | Function(h, userInfo) => VNode | - |
143
143
  | renderListItem | 渲染列表项 | Function(h, userInfo) => VNode | - |
144
144
  | excludeUserIds | 排除的用户ID列表 | Array | [] |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/bk-user-selector",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "description": "蓝鲸用户选择器",
5
5
  "license": "MIT",
6
6
  "author": "Tencent BlueKing",
@@ -6,6 +6,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
6
6
  modelValue: string;
7
7
  draggable: boolean;
8
8
  multiple: boolean;
9
+ disabled: boolean;
9
10
  currentUserId: string;
10
11
  exactSearchKey: string;
11
12
  userGroup: () => never[];
@@ -22,6 +23,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
22
23
  modelValue: string;
23
24
  draggable: boolean;
24
25
  multiple: boolean;
26
+ disabled: boolean;
25
27
  currentUserId: string;
26
28
  exactSearchKey: string;
27
29
  userGroup: () => never[];
@@ -34,6 +36,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
34
36
  }, {
35
37
  tenantId: string;
36
38
  currentUserId: string;
39
+ disabled: boolean;
37
40
  userGroup: {
38
41
  id: string;
39
42
  name: string;
@@ -107,6 +107,10 @@ interface BaseSelectorProps {
107
107
  * 无匹配人员时的提示文本
108
108
  */
109
109
  emptyText?: string;
110
+ /**
111
+ * 是否禁用
112
+ */
113
+ disabled?: boolean;
110
114
  /**
111
115
  * 渲染列表项
112
116
  */
@@ -1,120 +1,5 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "@blueking/bkui-library";
2
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
- const getTenants = async (apiBaseUrl, tenantId) => {
4
- if (!apiBaseUrl || !tenantId) {
5
- console.warn("获取租户信息需要提供有效的apiBaseUrl和租户ID");
6
- return [];
7
- }
8
- try {
9
- const url = `${apiBaseUrl}/api/v3/open-web/tenant/data-source-owner-tenants/`;
10
- const response = await fetch(url, {
11
- method: "GET",
12
- headers: {
13
- "x-bk-tenant-id": tenantId
14
- },
15
- credentials: "include"
16
- });
17
- if (!response.ok) {
18
- throw new Error(`获取租户信息失败: ${response.status} ${response.statusText}`);
19
- }
20
- const data2 = await response.json();
21
- return data2.data || [];
22
- } catch (error3) {
23
- console.error("获取租户信息失败:", error3);
24
- return [];
25
- }
26
- };
27
- const searchUsers = async (apiBaseUrl = "", tenantId = "", keyword = "") => {
28
- if (!keyword || !apiBaseUrl || !tenantId) {
29
- console.warn("搜索用户需要提供有效的apiBaseUrl、租户ID和关键词");
30
- return [];
31
- }
32
- try {
33
- const url = `${apiBaseUrl}/api/v3/open-web/tenant/users/-/search/?keyword=${encodeURIComponent(keyword)}`;
34
- const response = await fetch(url, {
35
- method: "GET",
36
- headers: {
37
- "x-bk-tenant-id": tenantId
38
- },
39
- credentials: "include"
40
- });
41
- if (!response.ok) {
42
- throw new Error(`搜索用户失败: ${response.status} ${response.statusText}`);
43
- }
44
- const data2 = await response.json();
45
- return data2.data || [];
46
- } catch (error3) {
47
- console.error("搜索用户失败:", error3);
48
- return [];
49
- }
50
- };
51
- const lookupUsers = async (apiBaseUrl = "", tenantId = "", exactSearchKey = "bk_username", usersList = []) => {
52
- const users = usersList.filter((user) => user).map((user) => user.trim());
53
- if (users.length === 0 || !apiBaseUrl || !tenantId) {
54
- console.warn("批量查找用户需要提供有效的apiBaseUrl、租户ID和至少一个用户名");
55
- return [];
56
- }
57
- try {
58
- const url = `${apiBaseUrl}/api/v3/open-web/tenant/users/-/lookup/?lookups=${users.join(",")}&lookup_fields=${exactSearchKey}`;
59
- const response = await fetch(url, {
60
- method: "GET",
61
- headers: {
62
- "x-bk-tenant-id": tenantId
63
- },
64
- credentials: "include"
65
- });
66
- if (!response.ok) {
67
- throw new Error(`批量查找用户失败: ${response.status} ${response.statusText}`);
68
- }
69
- const data2 = await response.json();
70
- return data2.data || [];
71
- } catch (error3) {
72
- console.error("批量查找用户失败:", error3);
73
- return [];
74
- }
75
- };
76
- const formatUsers = (users) => {
77
- if (!users || !Array.isArray(users)) return [];
78
- return users.map((user) => ({
79
- id: user.bk_username,
80
- name: user.display_name,
81
- tenantId: user.owner_tenant_id,
82
- ...user
83
- }));
84
- };
85
- const useTenantData = (apiBaseUrl, tenantId) => {
86
- const tenants = ref({});
87
- const loading2 = ref(false);
88
- const fetchTenants = async () => {
89
- if (!apiBaseUrl || !tenantId) {
90
- console.warn("获取租户需要提供有效的API基础URL和租户ID");
91
- return;
92
- }
93
- loading2.value = true;
94
- try {
95
- const result = await getTenants(apiBaseUrl, tenantId);
96
- const tenantMap = {};
97
- result.forEach((item) => {
98
- if (item.id && item.name) {
99
- tenantMap[item.id] = item.name;
100
- }
101
- });
102
- tenants.value = tenantMap;
103
- } catch (error3) {
104
- console.error("获取租户数据失败:", error3);
105
- } finally {
106
- loading2.value = false;
107
- }
108
- };
109
- onBeforeMount(() => {
110
- fetchTenants();
111
- });
112
- return {
113
- tenants,
114
- loading: loading2,
115
- fetchTenants
116
- };
117
- };
118
3
  var top = "top";
119
4
  var bottom = "bottom";
120
5
  var right = "right";
@@ -5955,7 +5840,7 @@ var BkConfigProvider = (0, shared_namespaceObject$3.withInstall)(config_provider
5955
5840
  const src$3 = BkConfigProvider;
5956
5841
  __webpack_exports__$6["default"];
5957
5842
  __webpack_exports__$6.defaultRootConfig;
5958
- __webpack_exports__$6.provideGlobalConfig;
5843
+ var __webpack_exports__provideGlobalConfig = __webpack_exports__$6.provideGlobalConfig;
5959
5844
  __webpack_exports__$6.rootProviderKey;
5960
5845
  __webpack_exports__$6.setPrefixVariable;
5961
5846
  __webpack_exports__$6.useGlobalConfig;
@@ -11530,6 +11415,121 @@ __webpack_exports__.bkTooltips;
11530
11415
  var __webpack_exports__clickoutside = __webpack_exports__.clickoutside;
11531
11416
  __webpack_exports__.mousewheel;
11532
11417
  __webpack_exports__.overflowTitle;
11418
+ const getTenants = async (apiBaseUrl, tenantId) => {
11419
+ if (!apiBaseUrl || !tenantId) {
11420
+ console.warn("获取租户信息需要提供有效的apiBaseUrl和租户ID");
11421
+ return [];
11422
+ }
11423
+ try {
11424
+ const url = `${apiBaseUrl}/api/v3/open-web/tenant/data-source-owner-tenants/`;
11425
+ const response = await fetch(url, {
11426
+ method: "GET",
11427
+ headers: {
11428
+ "x-bk-tenant-id": tenantId
11429
+ },
11430
+ credentials: "include"
11431
+ });
11432
+ if (!response.ok) {
11433
+ throw new Error(`获取租户信息失败: ${response.status} ${response.statusText}`);
11434
+ }
11435
+ const data2 = await response.json();
11436
+ return data2.data || [];
11437
+ } catch (error3) {
11438
+ console.error("获取租户信息失败:", error3);
11439
+ return [];
11440
+ }
11441
+ };
11442
+ const searchUsers = async (apiBaseUrl = "", tenantId = "", keyword = "") => {
11443
+ if (!keyword || !apiBaseUrl || !tenantId) {
11444
+ console.warn("搜索用户需要提供有效的apiBaseUrl、租户ID和关键词");
11445
+ return [];
11446
+ }
11447
+ try {
11448
+ const url = `${apiBaseUrl}/api/v3/open-web/tenant/users/-/search/?keyword=${encodeURIComponent(keyword)}`;
11449
+ const response = await fetch(url, {
11450
+ method: "GET",
11451
+ headers: {
11452
+ "x-bk-tenant-id": tenantId
11453
+ },
11454
+ credentials: "include"
11455
+ });
11456
+ if (!response.ok) {
11457
+ throw new Error(`搜索用户失败: ${response.status} ${response.statusText}`);
11458
+ }
11459
+ const data2 = await response.json();
11460
+ return data2.data || [];
11461
+ } catch (error3) {
11462
+ console.error("搜索用户失败:", error3);
11463
+ return [];
11464
+ }
11465
+ };
11466
+ const lookupUsers = async (apiBaseUrl = "", tenantId = "", exactSearchKey = "bk_username", usersList = []) => {
11467
+ const users = usersList.filter((user) => user).map((user) => user.trim());
11468
+ if (users.length === 0 || !apiBaseUrl || !tenantId) {
11469
+ console.warn("批量查找用户需要提供有效的apiBaseUrl、租户ID和至少一个用户名");
11470
+ return [];
11471
+ }
11472
+ try {
11473
+ const url = `${apiBaseUrl}/api/v3/open-web/tenant/users/-/lookup/?lookups=${users.join(",")}&lookup_fields=${exactSearchKey}`;
11474
+ const response = await fetch(url, {
11475
+ method: "GET",
11476
+ headers: {
11477
+ "x-bk-tenant-id": tenantId
11478
+ },
11479
+ credentials: "include"
11480
+ });
11481
+ if (!response.ok) {
11482
+ throw new Error(`批量查找用户失败: ${response.status} ${response.statusText}`);
11483
+ }
11484
+ const data2 = await response.json();
11485
+ return data2.data || [];
11486
+ } catch (error3) {
11487
+ console.error("批量查找用户失败:", error3);
11488
+ return [];
11489
+ }
11490
+ };
11491
+ const formatUsers = (users) => {
11492
+ if (!users || !Array.isArray(users)) return [];
11493
+ return users.map((user) => ({
11494
+ id: user.bk_username,
11495
+ name: user.display_name,
11496
+ tenantId: user.owner_tenant_id,
11497
+ ...user
11498
+ }));
11499
+ };
11500
+ const useTenantData = (apiBaseUrl, tenantId) => {
11501
+ const tenants = ref({});
11502
+ const loading2 = ref(false);
11503
+ const fetchTenants = async () => {
11504
+ if (!apiBaseUrl || !tenantId) {
11505
+ console.warn("获取租户需要提供有效的API基础URL和租户ID");
11506
+ return;
11507
+ }
11508
+ loading2.value = true;
11509
+ try {
11510
+ const result = await getTenants(apiBaseUrl, tenantId);
11511
+ const tenantMap = {};
11512
+ result.forEach((item) => {
11513
+ if (item.id && item.name) {
11514
+ tenantMap[item.id] = item.name;
11515
+ }
11516
+ });
11517
+ tenants.value = tenantMap;
11518
+ } catch (error3) {
11519
+ console.error("获取租户数据失败:", error3);
11520
+ } finally {
11521
+ loading2.value = false;
11522
+ }
11523
+ };
11524
+ onBeforeMount(() => {
11525
+ fetchTenants();
11526
+ });
11527
+ return {
11528
+ tenants,
11529
+ loading: loading2,
11530
+ fetchTenants
11531
+ };
11532
+ };
11533
11533
  var Sortable$2 = { exports: {} };
11534
11534
  /**!
11535
11535
  * Sortable 1.15.6
@@ -14471,7 +14471,7 @@ const UserRender = defineComponent({
14471
14471
  };
14472
14472
  }
14473
14473
  });
14474
- const _hoisted_1$3 = {
14474
+ const _hoisted_1$2 = {
14475
14475
  key: 0,
14476
14476
  class: "no-data"
14477
14477
  };
@@ -14616,7 +14616,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
14616
14616
  mode: "spin"
14617
14617
  }, {
14618
14618
  default: withCtx(() => [
14619
- __props.options.length === 0 && __props.userGroup.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
14619
+ __props.options.length === 0 && __props.userGroup.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
14620
14620
  createElementVNode(
14621
14621
  "span",
14622
14622
  null,
@@ -14695,7 +14695,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
14695
14695
  };
14696
14696
  }
14697
14697
  });
14698
- const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-54b68f9a"]]);
14698
+ const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-e3741833"]]);
14699
14699
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
14700
14700
  ...{
14701
14701
  name: "UserTag"
@@ -14741,7 +14741,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
14741
14741
  }
14742
14742
  });
14743
14743
  const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-655f7a5a"]]);
14744
- const _hoisted_1$2 = ["onClick"];
14744
+ const _hoisted_1$1 = ["onClick"];
14745
14745
  const _hoisted_2$1 = ["placeholder"];
14746
14746
  const _hoisted_3 = ["placeholder"];
14747
14747
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
@@ -14762,6 +14762,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14762
14762
  userGroup: { default: () => [] },
14763
14763
  userGroupName: { default: "用户群组" },
14764
14764
  emptyText: { default: "无匹配人员" },
14765
+ disabled: { type: Boolean },
14765
14766
  renderListItem: {},
14766
14767
  renderTag: {},
14767
14768
  excludeUserIds: { default: () => [] }
@@ -15019,7 +15020,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
15019
15020
  {
15020
15021
  ref_key: "containerRef",
15021
15022
  ref: containerRef,
15022
- class: "multiple-selector"
15023
+ class: normalizeClass(["multiple-selector", { "is-disabled": _ctx.disabled }])
15023
15024
  },
15024
15025
  [
15025
15026
  createCommentVNode(" 聚焦状态 - 可编辑模式 "),
@@ -15082,7 +15083,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
15082
15083
  )), [
15083
15084
  [vModelText, unref(searchQuery)]
15084
15085
  ]) : createCommentVNode("v-if", true)
15085
- ], 8, _hoisted_1$2);
15086
+ ], 8, _hoisted_1$1);
15086
15087
  }),
15087
15088
  128
15088
15089
  /* KEYED_FRAGMENT */
@@ -15227,14 +15228,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
15227
15228
  onSelectUser: addUser
15228
15229
  }, null, 8, ["container-width", "cross-axis-offset", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
15229
15230
  ],
15230
- 512
15231
- /* NEED_PATCH */
15231
+ 2
15232
+ /* CLASS */
15232
15233
  );
15233
15234
  };
15234
15235
  }
15235
15236
  });
15236
- const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-9fc5bebf"]]);
15237
- const _hoisted_1$1 = { class: "input-container" };
15237
+ const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-19a0ebec"]]);
15238
+ const _hoisted_1 = { class: "input-container" };
15238
15239
  const _hoisted_2 = ["placeholder"];
15239
15240
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
15240
15241
  ...{
@@ -15252,6 +15253,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
15252
15253
  userGroup: { default: () => [] },
15253
15254
  userGroupName: { default: "用户群组" },
15254
15255
  emptyText: { default: "无匹配人员" },
15256
+ disabled: { type: Boolean },
15255
15257
  renderListItem: {},
15256
15258
  renderTag: {},
15257
15259
  excludeUserIds: { default: () => [] }
@@ -15369,70 +15371,72 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
15369
15371
  emit("update:modelValue", newVal);
15370
15372
  });
15371
15373
  return (_ctx, _cache) => {
15372
- return withDirectives((openBlock(), createElementBlock("div", {
15373
- ref_key: "containerRef",
15374
- ref: containerRef,
15375
- class: "single-selector"
15376
- }, [
15377
- createCommentVNode(" 输入框 "),
15378
- createElementVNode("div", _hoisted_1$1, [
15379
- createCommentVNode(" 用户标签显示 "),
15380
- selectedUserInfo.value ? (openBlock(), createElementBlock("div", {
15381
- key: 0,
15382
- onClick: withModifiers(removeSelectedUser, ["stop"])
15383
- }, [
15384
- createVNode(UserTag, {
15385
- "current-tenant-id": _ctx.tenantId,
15386
- "render-tag": _ctx.renderTag,
15387
- tenants: _ctx.tenants,
15388
- user: selectedUserInfo.value,
15389
- onClose: removeSelectedUser
15390
- }, null, 8, ["current-tenant-id", "render-tag", "tenants", "user"])
15391
- ])) : createCommentVNode("v-if", true),
15392
- withDirectives(createElementVNode("input", {
15393
- ref_key: "inputRef",
15394
- ref: inputRef,
15395
- class: "search-input",
15396
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
15397
- placeholder: selectedUserInfo.value ? "" : _ctx.placeholder,
15398
- onFocus: handleInputFocus,
15399
- onInput: handleInput
15400
- }, null, 40, _hoisted_2), [
15401
- [vModelText, searchQuery.value]
15374
+ return withDirectives((openBlock(), createElementBlock(
15375
+ "div",
15376
+ {
15377
+ ref_key: "containerRef",
15378
+ ref: containerRef,
15379
+ class: normalizeClass(["single-selector", { "is-disabled": _ctx.disabled }])
15380
+ },
15381
+ [
15382
+ createCommentVNode(" 输入框 "),
15383
+ createElementVNode("div", _hoisted_1, [
15384
+ createCommentVNode(" 用户标签显示 "),
15385
+ selectedUserInfo.value ? (openBlock(), createElementBlock("div", {
15386
+ key: 0,
15387
+ onClick: withModifiers(removeSelectedUser, ["stop"])
15388
+ }, [
15389
+ createVNode(UserTag, {
15390
+ "current-tenant-id": _ctx.tenantId,
15391
+ "render-tag": _ctx.renderTag,
15392
+ tenants: _ctx.tenants,
15393
+ user: selectedUserInfo.value,
15394
+ onClose: removeSelectedUser
15395
+ }, null, 8, ["current-tenant-id", "render-tag", "tenants", "user"])
15396
+ ])) : createCommentVNode("v-if", true),
15397
+ withDirectives(createElementVNode("input", {
15398
+ ref_key: "inputRef",
15399
+ ref: inputRef,
15400
+ class: "search-input",
15401
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
15402
+ placeholder: selectedUserInfo.value ? "" : _ctx.placeholder,
15403
+ onFocus: handleInputFocus,
15404
+ onInput: handleInput
15405
+ }, null, 40, _hoisted_2), [
15406
+ [vModelText, searchQuery.value]
15407
+ ]),
15408
+ createCommentVNode(' "我"标签 '),
15409
+ createVNode(MeTag, {
15410
+ "current-user-id": _ctx.currentUserId,
15411
+ "is-disabled": !!_ctx.currentUserId && !!selectedUserInfo.value && selectedUserInfo.value[_ctx.exactSearchKey] === _ctx.currentUserId,
15412
+ onClick: addCurrentUser
15413
+ }, null, 8, ["current-user-id", "is-disabled"])
15402
15414
  ]),
15403
- createCommentVNode(' "我"标签 '),
15404
- createVNode(MeTag, {
15405
- "current-user-id": _ctx.currentUserId,
15406
- "is-disabled": !!_ctx.currentUserId && !!selectedUserInfo.value && selectedUserInfo.value[_ctx.exactSearchKey] === _ctx.currentUserId,
15407
- onClick: addCurrentUser
15408
- }, null, 8, ["current-user-id", "is-disabled"])
15409
- ]),
15410
- createCommentVNode(" 使用新的公共下拉选项组件 "),
15411
- createVNode(SelectionPopover, {
15412
- "container-width": containerRef.value ? containerRef.value.offsetWidth : "auto",
15413
- "empty-text": _ctx.emptyText,
15414
- "is-show": showDropdown.value,
15415
- loading: isLoading.value,
15416
- options: options.value,
15417
- "render-list-item": _ctx.renderListItem,
15418
- "search-query": searchQuery.value,
15419
- "tenant-id": _ctx.tenantId,
15420
- tenants: _ctx.tenants,
15421
- "user-group": userGroupFilter.value,
15422
- "user-group-name": _ctx.userGroupName,
15423
- onSelectUser: addUser
15424
- }, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
15425
- ])), [
15415
+ createCommentVNode(" 使用新的公共下拉选项组件 "),
15416
+ createVNode(SelectionPopover, {
15417
+ "container-width": containerRef.value ? containerRef.value.offsetWidth : "auto",
15418
+ "empty-text": _ctx.emptyText,
15419
+ "is-show": showDropdown.value,
15420
+ loading: isLoading.value,
15421
+ options: options.value,
15422
+ "render-list-item": _ctx.renderListItem,
15423
+ "search-query": searchQuery.value,
15424
+ "tenant-id": _ctx.tenantId,
15425
+ tenants: _ctx.tenants,
15426
+ "user-group": userGroupFilter.value,
15427
+ "user-group-name": _ctx.userGroupName,
15428
+ onSelectUser: addUser
15429
+ }, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
15430
+ ],
15431
+ 2
15432
+ /* CLASS */
15433
+ )), [
15426
15434
  [unref(__webpack_exports__clickoutside), handleClickOutside]
15427
15435
  ]);
15428
15436
  };
15429
15437
  }
15430
15438
  });
15431
- const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-1454c121"]]);
15432
- const _hoisted_1 = {
15433
- ref: "containerRef",
15434
- class: "bk-user-selector"
15435
- };
15439
+ const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-b6af00c3"]]);
15436
15440
  const _sfc_main = /* @__PURE__ */ defineComponent({
15437
15441
  ...{
15438
15442
  name: "BkUserSelector"
@@ -15450,12 +15454,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15450
15454
  userGroup: { default: () => [] },
15451
15455
  userGroupName: { default: "用户群组" },
15452
15456
  emptyText: { default: "无匹配人员" },
15457
+ disabled: { type: Boolean, default: false },
15453
15458
  renderListItem: {},
15454
15459
  renderTag: {},
15455
15460
  excludeUserIds: { default: () => [] }
15456
15461
  },
15457
15462
  emits: ["update:modelValue", "change"],
15458
15463
  setup(__props, { emit: __emit }) {
15464
+ __webpack_exports__provideGlobalConfig({
15465
+ prefix: "bk-user-selector"
15466
+ });
15459
15467
  const props2 = __props;
15460
15468
  const emit = __emit;
15461
15469
  const { tenants = {} } = useTenantData(props2.apiBaseUrl, props2.tenantId);
@@ -15524,7 +15532,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15524
15532
  return (_ctx, _cache) => {
15525
15533
  return openBlock(), createElementBlock(
15526
15534
  "section",
15527
- _hoisted_1,
15535
+ {
15536
+ ref: "containerRef",
15537
+ class: normalizeClass(["bk-user-selector", { "is-disabled": _ctx.disabled }])
15538
+ },
15528
15539
  [
15529
15540
  createCommentVNode(" 单选模式 "),
15530
15541
  !_ctx.multiple ? (openBlock(), createBlock(SingleSelector, {
@@ -15533,6 +15544,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15533
15544
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedUser.value = $event),
15534
15545
  "api-base-url": _ctx.apiBaseUrl,
15535
15546
  "current-user-id": _ctx.currentUserId,
15547
+ disabled: _ctx.disabled,
15536
15548
  "empty-text": _ctx.emptyText,
15537
15549
  "exact-search-key": _ctx.exactSearchKey,
15538
15550
  "exclude-user-ids": _ctx.excludeUserIds,
@@ -15544,7 +15556,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15544
15556
  "user-group": _ctx.userGroup,
15545
15557
  "user-group-name": _ctx.userGroupName,
15546
15558
  onChange: handleUpdateUser
15547
- }, null, 8, ["modelValue", "api-base-url", "current-user-id", "empty-text", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "tenant-id", "tenants", "user-group", "user-group-name"])) : (openBlock(), createElementBlock(
15559
+ }, null, 8, ["modelValue", "api-base-url", "current-user-id", "disabled", "empty-text", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "tenant-id", "tenants", "user-group", "user-group-name"])) : (openBlock(), createElementBlock(
15548
15560
  Fragment,
15549
15561
  { key: 1 },
15550
15562
  [
@@ -15554,6 +15566,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15554
15566
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedUserIds.value = $event),
15555
15567
  "api-base-url": _ctx.apiBaseUrl,
15556
15568
  "current-user-id": _ctx.currentUserId,
15569
+ disabled: _ctx.disabled,
15557
15570
  draggable: _ctx.draggable,
15558
15571
  "empty-text": _ctx.emptyText,
15559
15572
  "exact-search-key": _ctx.exactSearchKey,
@@ -15567,19 +15580,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15567
15580
  "user-group": _ctx.userGroup,
15568
15581
  "user-group-name": _ctx.userGroupName,
15569
15582
  "onUpdate:selectedUsers": handleUpdateSelectedUsers
15570
- }, null, 8, ["modelValue", "api-base-url", "current-user-id", "draggable", "empty-text", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
15583
+ }, null, 8, ["modelValue", "api-base-url", "current-user-id", "disabled", "draggable", "empty-text", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
15571
15584
  ],
15572
15585
  2112
15573
15586
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
15574
15587
  ))
15575
15588
  ],
15576
- 512
15577
- /* NEED_PATCH */
15589
+ 2
15590
+ /* CLASS */
15578
15591
  );
15579
15592
  };
15580
15593
  }
15581
15594
  });
15582
- const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-906da21c"]]);
15595
+ const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c31311f7"]]);
15583
15596
  const vue2 = {
15584
15597
  model: {
15585
15598
  prop: "modelValue",