@blueking/bk-user-selector 0.0.29-beta.8 → 0.0.30
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 +19 -18
- package/package.json +1 -1
- package/typings/hooks/use-i18n.d.ts +5 -0
- package/typings/locale/en-us.d.ts +7 -0
- package/typings/locale/zh-cn.d.ts +7 -0
- package/vue2/index.es.min.js +207 -30
- package/vue2/index.iife.min.js +207 -30
- package/vue2/index.umd.min.js +207 -30
- package/vue2/vue2.css +28 -28
- package/vue3/index.es.min.js +207 -30
- package/vue3/index.iife.min.js +207 -30
- package/vue3/index.umd.min.js +207 -30
- package/vue3/vue3.css +28 -28
package/README.md
CHANGED
|
@@ -124,24 +124,25 @@ export default {
|
|
|
124
124
|
|
|
125
125
|
### 属性
|
|
126
126
|
|
|
127
|
-
| 参数
|
|
128
|
-
|
|
|
129
|
-
| modelValue / v-model
|
|
130
|
-
| apiBaseUrl
|
|
131
|
-
| tenantId
|
|
132
|
-
| label
|
|
133
|
-
| placeholder
|
|
134
|
-
| multiple
|
|
135
|
-
| draggable
|
|
136
|
-
| exactSearchKey
|
|
137
|
-
| currentUserId
|
|
138
|
-
| userGroup
|
|
139
|
-
| userGroupName
|
|
140
|
-
| emptyText
|
|
141
|
-
| disabled
|
|
142
|
-
| renderTag
|
|
143
|
-
| renderListItem
|
|
144
|
-
| excludeUserIds
|
|
127
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
128
|
+
| --------------------- | ----------------------------------------------------------------------- | ------------------------------ | ------------------ |
|
|
129
|
+
| modelValue / v-model | 绑定值,单选为字符串,多选为数组 | String / Array | '' / [] |
|
|
130
|
+
| apiBaseUrl | API 基础 URL | String | '' |
|
|
131
|
+
| tenantId | 租户 ID | String | '' |
|
|
132
|
+
| label | 文本标签 | String | 人员选择 |
|
|
133
|
+
| placeholder | 占位文本 | String | 请输入人员名称搜索 |
|
|
134
|
+
| multiple | 是否多选 | Boolean | false |
|
|
135
|
+
| draggable | 是否可拖拽(仅多选模式有效) | Boolean | false |
|
|
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
|
+
| disabled | 是否禁用 | Boolean | false |
|
|
142
|
+
| renderTag | 渲染标签 | Function(h, userInfo) => VNode | - |
|
|
143
|
+
| renderListItem | 渲染列表项 | Function(h, userInfo) => VNode | - |
|
|
144
|
+
| excludeUserIds | 排除的用户ID列表 | Array | [] |
|
|
145
|
+
| enableMultiTenantMode | 是否启用多租户模式,关闭后则使用原有用户管理接口查询 | Boolean | true |
|
|
145
146
|
|
|
146
147
|
### 事件
|
|
147
148
|
|
package/package.json
CHANGED
package/vue2/index.es.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "@blueking/bkui-library";
|
|
2
|
-
import { unref, ref, onBeforeMount, defineComponent, createElementBlock, createCommentVNode, openBlock, withModifiers, normalizeClass, h as h$1, computed, createBlock, withCtx, renderSlot, createVNode, createElementVNode,
|
|
2
|
+
import { unref, ref, onBeforeMount, defineComponent, createElementBlock, createCommentVNode, openBlock, withModifiers, normalizeClass, toDisplayString, h as h$1, computed, createBlock, withCtx, renderSlot, createVNode, createElementVNode, Fragment, renderList, watch, nextTick, onMounted, withDirectives, isRef, vModelText, createTextVNode, createApp } from "@blueking/bkui-library";
|
|
3
3
|
var top = "top";
|
|
4
4
|
var bottom = "bottom";
|
|
5
5
|
var right = "right";
|
|
@@ -11529,7 +11529,7 @@ const lookupUsers = async (params) => {
|
|
|
11529
11529
|
}).catch(() => {
|
|
11530
11530
|
return [];
|
|
11531
11531
|
});
|
|
11532
|
-
return userList;
|
|
11532
|
+
return users.map((user) => userList.find((u2) => u2.username === user)).filter(Boolean);
|
|
11533
11533
|
}
|
|
11534
11534
|
if (users.length === 0 || !apiBaseUrl || !tenantId) {
|
|
11535
11535
|
console.warn("批量查找用户需要提供有效的apiBaseUrl、租户ID和至少一个用户名");
|
|
@@ -11584,6 +11584,163 @@ const getUserList = async (url, params) => {
|
|
|
11584
11584
|
});
|
|
11585
11585
|
return (data2 == null ? void 0 : data2.results) || [];
|
|
11586
11586
|
};
|
|
11587
|
+
/*! js-cookie v3.0.5 | MIT */
|
|
11588
|
+
function assign(target) {
|
|
11589
|
+
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
11590
|
+
var source = arguments[i2];
|
|
11591
|
+
for (var key in source) {
|
|
11592
|
+
target[key] = source[key];
|
|
11593
|
+
}
|
|
11594
|
+
}
|
|
11595
|
+
return target;
|
|
11596
|
+
}
|
|
11597
|
+
var defaultConverter = {
|
|
11598
|
+
read: function(value) {
|
|
11599
|
+
if (value[0] === '"') {
|
|
11600
|
+
value = value.slice(1, -1);
|
|
11601
|
+
}
|
|
11602
|
+
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
11603
|
+
},
|
|
11604
|
+
write: function(value) {
|
|
11605
|
+
return encodeURIComponent(value).replace(
|
|
11606
|
+
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
11607
|
+
decodeURIComponent
|
|
11608
|
+
);
|
|
11609
|
+
}
|
|
11610
|
+
};
|
|
11611
|
+
function init(converter, defaultAttributes) {
|
|
11612
|
+
function set(name, value, attributes) {
|
|
11613
|
+
if (typeof document === "undefined") {
|
|
11614
|
+
return;
|
|
11615
|
+
}
|
|
11616
|
+
attributes = assign({}, defaultAttributes, attributes);
|
|
11617
|
+
if (typeof attributes.expires === "number") {
|
|
11618
|
+
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
|
|
11619
|
+
}
|
|
11620
|
+
if (attributes.expires) {
|
|
11621
|
+
attributes.expires = attributes.expires.toUTCString();
|
|
11622
|
+
}
|
|
11623
|
+
name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
11624
|
+
var stringifiedAttributes = "";
|
|
11625
|
+
for (var attributeName in attributes) {
|
|
11626
|
+
if (!attributes[attributeName]) {
|
|
11627
|
+
continue;
|
|
11628
|
+
}
|
|
11629
|
+
stringifiedAttributes += "; " + attributeName;
|
|
11630
|
+
if (attributes[attributeName] === true) {
|
|
11631
|
+
continue;
|
|
11632
|
+
}
|
|
11633
|
+
stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
|
|
11634
|
+
}
|
|
11635
|
+
return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
|
|
11636
|
+
}
|
|
11637
|
+
function get(name) {
|
|
11638
|
+
if (typeof document === "undefined" || arguments.length && !name) {
|
|
11639
|
+
return;
|
|
11640
|
+
}
|
|
11641
|
+
var cookies = document.cookie ? document.cookie.split("; ") : [];
|
|
11642
|
+
var jar = {};
|
|
11643
|
+
for (var i2 = 0; i2 < cookies.length; i2++) {
|
|
11644
|
+
var parts = cookies[i2].split("=");
|
|
11645
|
+
var value = parts.slice(1).join("=");
|
|
11646
|
+
try {
|
|
11647
|
+
var found = decodeURIComponent(parts[0]);
|
|
11648
|
+
jar[found] = converter.read(value, found);
|
|
11649
|
+
if (name === found) {
|
|
11650
|
+
break;
|
|
11651
|
+
}
|
|
11652
|
+
} catch (e) {
|
|
11653
|
+
}
|
|
11654
|
+
}
|
|
11655
|
+
return name ? jar[name] : jar;
|
|
11656
|
+
}
|
|
11657
|
+
return Object.create(
|
|
11658
|
+
{
|
|
11659
|
+
set,
|
|
11660
|
+
get,
|
|
11661
|
+
remove: function(name, attributes) {
|
|
11662
|
+
set(
|
|
11663
|
+
name,
|
|
11664
|
+
"",
|
|
11665
|
+
assign({}, attributes, {
|
|
11666
|
+
expires: -1
|
|
11667
|
+
})
|
|
11668
|
+
);
|
|
11669
|
+
},
|
|
11670
|
+
withAttributes: function(attributes) {
|
|
11671
|
+
return init(this.converter, assign({}, this.attributes, attributes));
|
|
11672
|
+
},
|
|
11673
|
+
withConverter: function(converter2) {
|
|
11674
|
+
return init(assign({}, this.converter, converter2), this.attributes);
|
|
11675
|
+
}
|
|
11676
|
+
},
|
|
11677
|
+
{
|
|
11678
|
+
attributes: { value: Object.freeze(defaultAttributes) },
|
|
11679
|
+
converter: { value: Object.freeze(converter) }
|
|
11680
|
+
}
|
|
11681
|
+
);
|
|
11682
|
+
}
|
|
11683
|
+
var api = init(defaultConverter, { path: "/" });
|
|
11684
|
+
const enUS = {
|
|
11685
|
+
我: "Me",
|
|
11686
|
+
请输入人员名称搜索: "Please enter the name of the user to search",
|
|
11687
|
+
用户群组: "User Group",
|
|
11688
|
+
无匹配人员: "No matching users"
|
|
11689
|
+
};
|
|
11690
|
+
const zhCN = {
|
|
11691
|
+
我: "我",
|
|
11692
|
+
请输入人员名称搜索: "请输入人员名称搜索",
|
|
11693
|
+
用户群组: "用户群组",
|
|
11694
|
+
无匹配人员: "无匹配人员"
|
|
11695
|
+
};
|
|
11696
|
+
const BLUEKINNG_LANGUAGE = "blueking_language";
|
|
11697
|
+
const languageMap = {
|
|
11698
|
+
"en-US": enUS,
|
|
11699
|
+
"zh-CN": zhCN
|
|
11700
|
+
};
|
|
11701
|
+
const getPath = (obj, path, variables) => {
|
|
11702
|
+
const pathStack = /^\w/.test(path) ? path.split(".") : [path];
|
|
11703
|
+
const { length } = pathStack;
|
|
11704
|
+
let target = obj;
|
|
11705
|
+
let i2 = 0;
|
|
11706
|
+
while (i2 <= length && target) {
|
|
11707
|
+
if (typeof target === "string") {
|
|
11708
|
+
return target;
|
|
11709
|
+
}
|
|
11710
|
+
if (variables) {
|
|
11711
|
+
target = target[pathStack[i2]];
|
|
11712
|
+
Object.keys(variables).forEach((key) => {
|
|
11713
|
+
target = target.replace(`{${key}}`, variables[key]);
|
|
11714
|
+
});
|
|
11715
|
+
} else {
|
|
11716
|
+
target = target[pathStack[i2]];
|
|
11717
|
+
}
|
|
11718
|
+
i2 = i2 + 1;
|
|
11719
|
+
if (!target) {
|
|
11720
|
+
return target;
|
|
11721
|
+
}
|
|
11722
|
+
}
|
|
11723
|
+
return target;
|
|
11724
|
+
};
|
|
11725
|
+
const useI18n = () => {
|
|
11726
|
+
let localeLanguage = "zh-CN";
|
|
11727
|
+
const bluekingLanguage = api.get(BLUEKINNG_LANGUAGE);
|
|
11728
|
+
if (bluekingLanguage && bluekingLanguage.toLowerCase() === "en") {
|
|
11729
|
+
localeLanguage = "en-US";
|
|
11730
|
+
}
|
|
11731
|
+
const languagePackage = languageMap[localeLanguage];
|
|
11732
|
+
const t2 = (path, variable) => {
|
|
11733
|
+
const value = getPath(languagePackage, path, variable);
|
|
11734
|
+
if (value === void 0) {
|
|
11735
|
+
console.warn(`缺少索引 * ${path} *`);
|
|
11736
|
+
}
|
|
11737
|
+
return value;
|
|
11738
|
+
};
|
|
11739
|
+
return {
|
|
11740
|
+
local: localeLanguage,
|
|
11741
|
+
t: t2
|
|
11742
|
+
};
|
|
11743
|
+
};
|
|
11587
11744
|
const useTenantData = (apiBaseUrl, tenantId, enableMultiTenantMode = true) => {
|
|
11588
11745
|
const tenants = ref({});
|
|
11589
11746
|
const loading2 = ref(false);
|
|
@@ -14490,6 +14647,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
14490
14647
|
},
|
|
14491
14648
|
emits: ["click"],
|
|
14492
14649
|
setup(__props, { emit: __emit }) {
|
|
14650
|
+
const { t: t2 } = useI18n();
|
|
14493
14651
|
const props2 = __props;
|
|
14494
14652
|
const emit = __emit;
|
|
14495
14653
|
const handleClick = () => {
|
|
@@ -14504,9 +14662,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
14504
14662
|
class: normalizeClass(["me-tag", { disabled: __props.isDisabled }]),
|
|
14505
14663
|
onClick: withModifiers(handleClick, ["stop"])
|
|
14506
14664
|
},
|
|
14507
|
-
"
|
|
14508
|
-
|
|
14509
|
-
/* CLASS */
|
|
14665
|
+
toDisplayString(unref(t2)("我")),
|
|
14666
|
+
3
|
|
14667
|
+
/* TEXT, CLASS */
|
|
14510
14668
|
)) : createCommentVNode("v-if", true);
|
|
14511
14669
|
};
|
|
14512
14670
|
}
|
|
@@ -14518,7 +14676,7 @@ const _export_sfc = (sfc, props2) => {
|
|
|
14518
14676
|
}
|
|
14519
14677
|
return target;
|
|
14520
14678
|
};
|
|
14521
|
-
const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
|
14679
|
+
const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-ce388fae"]]);
|
|
14522
14680
|
const UserRender = defineComponent({
|
|
14523
14681
|
name: "UserRender",
|
|
14524
14682
|
props: {
|
|
@@ -14646,14 +14804,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
14646
14804
|
*/
|
|
14647
14805
|
userGroupName: {
|
|
14648
14806
|
type: String,
|
|
14649
|
-
default: "
|
|
14807
|
+
default: ""
|
|
14650
14808
|
},
|
|
14651
14809
|
/**
|
|
14652
14810
|
* 无匹配人员时的提示文本
|
|
14653
14811
|
*/
|
|
14654
14812
|
emptyText: {
|
|
14655
14813
|
type: String,
|
|
14656
|
-
default: "
|
|
14814
|
+
default: ""
|
|
14657
14815
|
},
|
|
14658
14816
|
/**
|
|
14659
14817
|
* 渲染列表项
|
|
@@ -14792,7 +14950,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
14792
14950
|
};
|
|
14793
14951
|
}
|
|
14794
14952
|
});
|
|
14795
|
-
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
14953
|
+
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-61e98a47"]]);
|
|
14796
14954
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
14797
14955
|
...{
|
|
14798
14956
|
name: "UserTag"
|
|
@@ -14854,12 +15012,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
14854
15012
|
tenants: { default: () => ({}) },
|
|
14855
15013
|
apiBaseUrl: { default: "" },
|
|
14856
15014
|
tenantId: { default: "" },
|
|
14857
|
-
placeholder: { default: "
|
|
15015
|
+
placeholder: { default: "" },
|
|
14858
15016
|
currentUserId: { default: "" },
|
|
14859
15017
|
exactSearchKey: { default: "bk_username" },
|
|
14860
15018
|
userGroup: { default: () => [] },
|
|
14861
|
-
userGroupName: { default: "
|
|
14862
|
-
emptyText: { default: "
|
|
15019
|
+
userGroupName: { default: "" },
|
|
15020
|
+
emptyText: { default: "" },
|
|
14863
15021
|
disabled: { type: Boolean },
|
|
14864
15022
|
renderListItem: {},
|
|
14865
15023
|
renderTag: {},
|
|
@@ -14894,7 +15052,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
14894
15052
|
return searchResults.value.filter((user) => !props2.selectedUsers.some((selectedUser) => selectedUser.id === user.id)).filter((user) => !props2.excludeUserIds.includes(user.id));
|
|
14895
15053
|
});
|
|
14896
15054
|
const userGroupFilter = computed(() => {
|
|
14897
|
-
return props2.userGroup.filter((group) =>
|
|
15055
|
+
return props2.userGroup.filter((group) => {
|
|
15056
|
+
var _a, _b;
|
|
15057
|
+
const filtered = !props2.selectedUsers.some((user) => user.id === group.id) && !group.hidden;
|
|
15058
|
+
if (filtered) {
|
|
15059
|
+
return ((_a = group.id) == null ? void 0 : _a.includes(searchQuery.value)) || ((_b = group.name) == null ? void 0 : _b.includes(searchQuery.value));
|
|
15060
|
+
}
|
|
15061
|
+
return false;
|
|
15062
|
+
});
|
|
14898
15063
|
});
|
|
14899
15064
|
const initSortable = () => {
|
|
14900
15065
|
if (!props2.draggable || !sortableContainerRef.value) return;
|
|
@@ -15350,7 +15515,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
15350
15515
|
};
|
|
15351
15516
|
}
|
|
15352
15517
|
});
|
|
15353
|
-
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
15518
|
+
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-1c358144"]]);
|
|
15354
15519
|
const _hoisted_1 = { class: "input-container" };
|
|
15355
15520
|
const _hoisted_2 = ["placeholder"];
|
|
15356
15521
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
@@ -15363,12 +15528,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
15363
15528
|
tenants: {},
|
|
15364
15529
|
apiBaseUrl: { default: "" },
|
|
15365
15530
|
tenantId: { default: "" },
|
|
15366
|
-
placeholder: { default: "
|
|
15531
|
+
placeholder: { default: "" },
|
|
15367
15532
|
currentUserId: { default: "" },
|
|
15368
15533
|
exactSearchKey: { default: "bk_username" },
|
|
15369
15534
|
userGroup: { default: () => [] },
|
|
15370
|
-
userGroupName: { default: "
|
|
15371
|
-
emptyText: { default: "
|
|
15535
|
+
userGroupName: { default: "" },
|
|
15536
|
+
emptyText: { default: "" },
|
|
15372
15537
|
disabled: { type: Boolean },
|
|
15373
15538
|
renderListItem: {},
|
|
15374
15539
|
renderTag: {},
|
|
@@ -15387,7 +15552,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
15387
15552
|
const searchQuery = ref("");
|
|
15388
15553
|
const showDropdown = ref(false);
|
|
15389
15554
|
const userGroupFilter = computed(() => {
|
|
15390
|
-
return props2.userGroup.filter((group) =>
|
|
15555
|
+
return props2.userGroup.filter((group) => {
|
|
15556
|
+
var _a, _b;
|
|
15557
|
+
const filtered = group.id !== selectedUser.value && !group.hidden;
|
|
15558
|
+
if (filtered) {
|
|
15559
|
+
return ((_a = group.id) == null ? void 0 : _a.includes(searchQuery.value)) || ((_b = group.name) == null ? void 0 : _b.includes(searchQuery.value));
|
|
15560
|
+
}
|
|
15561
|
+
return false;
|
|
15562
|
+
});
|
|
15391
15563
|
});
|
|
15392
15564
|
const selectedUserInfo = computed(() => {
|
|
15393
15565
|
const userGroup = (props2.userGroup || []).map((group) => ({
|
|
@@ -15575,7 +15747,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
15575
15747
|
};
|
|
15576
15748
|
}
|
|
15577
15749
|
});
|
|
15578
|
-
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
15750
|
+
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-7080eb2b"]]);
|
|
15579
15751
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
15580
15752
|
...{
|
|
15581
15753
|
name: "BkUserSelector"
|
|
@@ -15587,12 +15759,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15587
15759
|
multiple: { type: Boolean, default: false },
|
|
15588
15760
|
apiBaseUrl: { default: "" },
|
|
15589
15761
|
tenantId: { default: "" },
|
|
15590
|
-
placeholder: { default: "
|
|
15762
|
+
placeholder: { default: "" },
|
|
15591
15763
|
currentUserId: { default: "" },
|
|
15592
15764
|
exactSearchKey: { default: "bk_username" },
|
|
15593
15765
|
userGroup: { default: () => [] },
|
|
15594
|
-
userGroupName: { default: "
|
|
15595
|
-
emptyText: { default: "
|
|
15766
|
+
userGroupName: { default: "" },
|
|
15767
|
+
emptyText: { default: "" },
|
|
15596
15768
|
disabled: { type: Boolean, default: false },
|
|
15597
15769
|
renderListItem: {},
|
|
15598
15770
|
renderTag: {},
|
|
@@ -15601,6 +15773,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15601
15773
|
},
|
|
15602
15774
|
emits: ["update:modelValue", "change"],
|
|
15603
15775
|
setup(__props, { emit: __emit }) {
|
|
15776
|
+
const { t: t2 } = useI18n();
|
|
15604
15777
|
__webpack_exports__provideGlobalConfig({
|
|
15605
15778
|
prefix: "bk-user-selector"
|
|
15606
15779
|
});
|
|
@@ -15612,6 +15785,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15612
15785
|
const selectedUserIds = computed(() => {
|
|
15613
15786
|
return props2.multiple ? selectedUsers.value.map((user) => user.id) : [];
|
|
15614
15787
|
});
|
|
15788
|
+
const placeholder = computed(() => props2.placeholder || t2("请输入人员名称搜索"));
|
|
15789
|
+
const userGroupName = computed(() => props2.userGroupName || t2("用户群组"));
|
|
15790
|
+
const emptyText = computed(() => props2.emptyText || t2("无匹配人员"));
|
|
15615
15791
|
const initSelectedUsers = async () => {
|
|
15616
15792
|
if (props2.multiple) {
|
|
15617
15793
|
const ids = Array.isArray(props2.modelValue) ? props2.modelValue : [];
|
|
@@ -15633,7 +15809,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15633
15809
|
usersList: ids,
|
|
15634
15810
|
enableMultiTenantMode: props2.enableMultiTenantMode
|
|
15635
15811
|
});
|
|
15636
|
-
|
|
15812
|
+
const selectedList = [...selected, ...formatUsers(result, props2.enableMultiTenantMode)];
|
|
15813
|
+
selectedUsers.value = ids.map((id) => selectedList.find((user) => user.id === id)).filter(Boolean);
|
|
15637
15814
|
} catch (error3) {
|
|
15638
15815
|
console.error("获取选中用户信息失败:", error3);
|
|
15639
15816
|
}
|
|
@@ -15691,17 +15868,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15691
15868
|
"api-base-url": _ctx.apiBaseUrl,
|
|
15692
15869
|
"current-user-id": _ctx.currentUserId,
|
|
15693
15870
|
disabled: _ctx.disabled,
|
|
15694
|
-
"empty-text":
|
|
15871
|
+
"empty-text": emptyText.value,
|
|
15695
15872
|
"enable-multi-tenant-mode": _ctx.enableMultiTenantMode,
|
|
15696
15873
|
"exact-search-key": _ctx.exactSearchKey,
|
|
15697
15874
|
"exclude-user-ids": _ctx.excludeUserIds,
|
|
15698
|
-
placeholder:
|
|
15875
|
+
placeholder: placeholder.value,
|
|
15699
15876
|
"render-list-item": _ctx.renderListItem,
|
|
15700
15877
|
"render-tag": _ctx.renderTag,
|
|
15701
15878
|
"tenant-id": _ctx.tenantId,
|
|
15702
15879
|
tenants: unref(tenants),
|
|
15703
15880
|
"user-group": _ctx.userGroup,
|
|
15704
|
-
"user-group-name":
|
|
15881
|
+
"user-group-name": userGroupName.value,
|
|
15705
15882
|
onChange: handleUpdateUser
|
|
15706
15883
|
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "disabled", "empty-text", "enable-multi-tenant-mode", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "tenant-id", "tenants", "user-group", "user-group-name"])) : (openBlock(), createElementBlock(
|
|
15707
15884
|
Fragment,
|
|
@@ -15715,18 +15892,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15715
15892
|
"current-user-id": _ctx.currentUserId,
|
|
15716
15893
|
disabled: _ctx.disabled,
|
|
15717
15894
|
draggable: _ctx.draggable,
|
|
15718
|
-
"empty-text":
|
|
15895
|
+
"empty-text": emptyText.value,
|
|
15719
15896
|
"enable-multi-tenant-mode": _ctx.enableMultiTenantMode,
|
|
15720
15897
|
"exact-search-key": _ctx.exactSearchKey,
|
|
15721
15898
|
"exclude-user-ids": _ctx.excludeUserIds,
|
|
15722
|
-
placeholder:
|
|
15899
|
+
placeholder: placeholder.value,
|
|
15723
15900
|
"render-list-item": _ctx.renderListItem,
|
|
15724
15901
|
"render-tag": _ctx.renderTag,
|
|
15725
15902
|
"selected-users": selectedUsers.value,
|
|
15726
15903
|
"tenant-id": _ctx.tenantId,
|
|
15727
15904
|
tenants: unref(tenants),
|
|
15728
15905
|
"user-group": _ctx.userGroup,
|
|
15729
|
-
"user-group-name":
|
|
15906
|
+
"user-group-name": userGroupName.value,
|
|
15730
15907
|
"onUpdate:selectedUsers": handleUpdateSelectedUsers
|
|
15731
15908
|
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "disabled", "draggable", "empty-text", "enable-multi-tenant-mode", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
15732
15909
|
],
|
|
@@ -15740,7 +15917,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15740
15917
|
};
|
|
15741
15918
|
}
|
|
15742
15919
|
});
|
|
15743
|
-
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
15920
|
+
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c4574ead"]]);
|
|
15744
15921
|
const vue2 = {
|
|
15745
15922
|
model: {
|
|
15746
15923
|
prop: "modelValue",
|