@blueking/bk-user-selector 0.0.23-beta.1 → 0.0.24
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 +14 -12
- package/package.json +1 -1
- package/typings/components/me-tag.vue.d.ts +5 -5
- package/typings/components/multiple-selector.vue.d.ts +50 -4
- package/typings/components/render-tag.d.ts +8 -0
- package/typings/components/selection-popover.vue.d.ts +5 -5
- package/typings/components/single-selector.vue.d.ts +44 -4
- package/typings/components/user-render.d.ts +3 -3
- package/typings/components/user-selector.vue.d.ts +48 -4
- package/typings/components/user-tag.vue.d.ts +42 -8
- package/typings/hooks/useTenantData.d.ts +2 -2
- package/typings/hooks/useUserSearch.d.ts +3 -3
- package/typings/types/index.d.ts +4 -0
- package/typings/vue2.d.ts +7 -1
- package/vue2/index.es.min.js +4571 -6810
- package/vue2/index.iife.min.js +5904 -8661
- package/vue2/index.umd.min.js +4639 -6878
- package/vue2/vue2.css +68 -585
- package/vue3/index.es.min.js +46 -22
- package/vue3/index.iife.min.js +4527 -6768
- package/vue3/index.umd.min.js +47 -23
- package/vue3/vue3.css +34 -34
package/vue3/index.es.min.js
CHANGED
|
@@ -3328,7 +3328,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3328
3328
|
};
|
|
3329
3329
|
}
|
|
3330
3330
|
});
|
|
3331
|
-
const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
3331
|
+
const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-655f7a5a"]]);
|
|
3332
3332
|
const _hoisted_1$2 = ["onClick"];
|
|
3333
3333
|
const _hoisted_2$1 = ["placeholder"];
|
|
3334
3334
|
const _hoisted_3 = ["placeholder"];
|
|
@@ -3351,7 +3351,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3351
3351
|
userGroupName: { default: "用户群组" },
|
|
3352
3352
|
emptyText: { default: "无匹配人员" },
|
|
3353
3353
|
renderListItem: {},
|
|
3354
|
-
renderTag: {}
|
|
3354
|
+
renderTag: {},
|
|
3355
|
+
excludeUserIds: { default: () => [] }
|
|
3355
3356
|
},
|
|
3356
3357
|
emits: ["update:selectedUsers", "add-user", "remove-user"],
|
|
3357
3358
|
setup(__props, { emit: __emit }) {
|
|
@@ -3378,7 +3379,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3378
3379
|
const visibleUsers = ref([]);
|
|
3379
3380
|
const hiddenCount = ref(0);
|
|
3380
3381
|
const options = computed(() => {
|
|
3381
|
-
return searchResults.value.filter((user) => !props.selectedUsers.some((selectedUser) => selectedUser.id === user.id));
|
|
3382
|
+
return searchResults.value.filter((user) => !props.selectedUsers.some((selectedUser) => selectedUser.id === user.id)).filter((user) => !props.excludeUserIds.includes(user.id));
|
|
3382
3383
|
});
|
|
3383
3384
|
const userGroupFilter = computed(() => {
|
|
3384
3385
|
return props.userGroup.filter((group) => !props.selectedUsers.some((user) => user.id === group.id) && !group.hidden);
|
|
@@ -3820,7 +3821,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3820
3821
|
};
|
|
3821
3822
|
}
|
|
3822
3823
|
});
|
|
3823
|
-
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
3824
|
+
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-9fc5bebf"]]);
|
|
3824
3825
|
const _hoisted_1$1 = { class: "input-container" };
|
|
3825
3826
|
const _hoisted_2 = ["placeholder"];
|
|
3826
3827
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
@@ -3840,7 +3841,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3840
3841
|
userGroupName: { default: "用户群组" },
|
|
3841
3842
|
emptyText: { default: "无匹配人员" },
|
|
3842
3843
|
renderListItem: {},
|
|
3843
|
-
renderTag: {}
|
|
3844
|
+
renderTag: {},
|
|
3845
|
+
excludeUserIds: { default: () => [] }
|
|
3844
3846
|
},
|
|
3845
3847
|
emits: ["update:modelValue", "change"],
|
|
3846
3848
|
setup(__props, { emit: __emit }) {
|
|
@@ -3863,16 +3865,18 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3863
3865
|
type: "userGroup"
|
|
3864
3866
|
}));
|
|
3865
3867
|
const list = [...options.value, ...userGroup];
|
|
3866
|
-
|
|
3868
|
+
const selectedUserInfo2 = list.find((user) => user.id === selectedUser.value);
|
|
3869
|
+
emit("change", selectedUserInfo2 || null);
|
|
3870
|
+
return selectedUserInfo2;
|
|
3867
3871
|
});
|
|
3868
|
-
|
|
3872
|
+
const initSelectedUser = async () => {
|
|
3869
3873
|
if (typeof props.modelValue === "string" && props.modelValue) {
|
|
3870
3874
|
try {
|
|
3871
3875
|
isLoading.value = true;
|
|
3872
3876
|
const result = await lookupUsers(props.apiBaseUrl || "", props.tenantId || "", props.exactSearchKey, [
|
|
3873
3877
|
props.modelValue
|
|
3874
3878
|
]);
|
|
3875
|
-
options.value = formatUsers(result);
|
|
3879
|
+
options.value = formatUsers(result).filter((user) => !props.excludeUserIds.includes(user.id));
|
|
3876
3880
|
if (props.userGroup.length > 0) {
|
|
3877
3881
|
const groupResult = props.userGroup.filter((group) => group.id == props.modelValue);
|
|
3878
3882
|
options.value = groupResult.map((group) => ({
|
|
@@ -3886,7 +3890,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3886
3890
|
} finally {
|
|
3887
3891
|
isLoading.value = false;
|
|
3888
3892
|
}
|
|
3893
|
+
} else {
|
|
3894
|
+
options.value = [];
|
|
3889
3895
|
}
|
|
3896
|
+
};
|
|
3897
|
+
onBeforeMount(async () => {
|
|
3898
|
+
initSelectedUser();
|
|
3890
3899
|
});
|
|
3891
3900
|
const addCurrentUser = async () => {
|
|
3892
3901
|
if (!props.currentUserId || selectedUser.value === props.currentUserId) return;
|
|
@@ -3894,7 +3903,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3894
3903
|
const result = await lookupUsers(props.apiBaseUrl, props.tenantId, props.exactSearchKey, [props.currentUserId]);
|
|
3895
3904
|
const formattedResults = formatUsers(result);
|
|
3896
3905
|
if (formattedResults.length > 0) {
|
|
3897
|
-
options.value = formattedResults;
|
|
3906
|
+
options.value = formattedResults.filter((user) => !props.excludeUserIds.includes(user.id));
|
|
3898
3907
|
addUser(formattedResults[0]);
|
|
3899
3908
|
}
|
|
3900
3909
|
} catch (error) {
|
|
@@ -3909,7 +3918,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3909
3918
|
isLoading.value = true;
|
|
3910
3919
|
try {
|
|
3911
3920
|
const result = await searchUsers(props.apiBaseUrl, props.tenantId, keyword);
|
|
3912
|
-
options.value = formatUsers(result).filter((user) => !selectedUser.value || user.id !== selectedUser.value);
|
|
3921
|
+
options.value = formatUsers(result).filter((user) => !selectedUser.value || user.id !== selectedUser.value).filter((user) => !props.excludeUserIds.includes(user.id));
|
|
3913
3922
|
} catch (error) {
|
|
3914
3923
|
console.error("获取用户列表失败:", error);
|
|
3915
3924
|
options.value = [];
|
|
@@ -3938,9 +3947,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3938
3947
|
const handleClickOutside = () => {
|
|
3939
3948
|
showDropdown.value = false;
|
|
3940
3949
|
};
|
|
3941
|
-
watch(
|
|
3942
|
-
|
|
3943
|
-
|
|
3950
|
+
watch(
|
|
3951
|
+
() => props.modelValue,
|
|
3952
|
+
(newVal) => {
|
|
3953
|
+
selectedUser.value = newVal;
|
|
3954
|
+
}
|
|
3955
|
+
);
|
|
3956
|
+
watch(selectedUser, (newVal) => {
|
|
3957
|
+
emit("update:modelValue", newVal);
|
|
3958
|
+
});
|
|
3944
3959
|
return (_ctx, _cache) => {
|
|
3945
3960
|
return withDirectives((openBlock(), createElementBlock("div", {
|
|
3946
3961
|
ref_key: "containerRef",
|
|
@@ -4001,7 +4016,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4001
4016
|
};
|
|
4002
4017
|
}
|
|
4003
4018
|
});
|
|
4004
|
-
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
4019
|
+
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-1454c121"]]);
|
|
4005
4020
|
const _hoisted_1 = {
|
|
4006
4021
|
ref: "containerRef",
|
|
4007
4022
|
class: "bk-user-selector"
|
|
@@ -4024,7 +4039,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4024
4039
|
userGroupName: { default: "用户群组" },
|
|
4025
4040
|
emptyText: { default: "无匹配人员" },
|
|
4026
4041
|
renderListItem: {},
|
|
4027
|
-
renderTag: {}
|
|
4042
|
+
renderTag: {},
|
|
4043
|
+
excludeUserIds: { default: () => [] }
|
|
4028
4044
|
},
|
|
4029
4045
|
emits: ["update:modelValue", "change"],
|
|
4030
4046
|
setup(__props, { emit: __emit }) {
|
|
@@ -4055,6 +4071,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4055
4071
|
} catch (error) {
|
|
4056
4072
|
console.error("获取选中用户信息失败:", error);
|
|
4057
4073
|
}
|
|
4074
|
+
} else {
|
|
4075
|
+
selectedUsers.value = [];
|
|
4058
4076
|
}
|
|
4059
4077
|
} else {
|
|
4060
4078
|
selectedUser.value = props.modelValue;
|
|
@@ -4074,15 +4092,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4074
4092
|
watch(selectedUser, (newVal) => {
|
|
4075
4093
|
if (!props.multiple) {
|
|
4076
4094
|
emit("update:modelValue", newVal);
|
|
4077
|
-
emit("change", newVal);
|
|
4078
4095
|
}
|
|
4079
|
-
}
|
|
4096
|
+
});
|
|
4080
4097
|
watch(
|
|
4081
4098
|
() => props.userGroup,
|
|
4082
4099
|
() => {
|
|
4083
4100
|
initSelectedUsers();
|
|
4084
|
-
}
|
|
4085
|
-
|
|
4101
|
+
}
|
|
4102
|
+
);
|
|
4103
|
+
watch(
|
|
4104
|
+
() => props.modelValue,
|
|
4105
|
+
() => {
|
|
4106
|
+
initSelectedUsers();
|
|
4107
|
+
}
|
|
4086
4108
|
);
|
|
4087
4109
|
onBeforeMount(() => {
|
|
4088
4110
|
initSelectedUsers();
|
|
@@ -4101,6 +4123,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4101
4123
|
"current-user-id": _ctx.currentUserId,
|
|
4102
4124
|
"empty-text": _ctx.emptyText,
|
|
4103
4125
|
"exact-search-key": _ctx.exactSearchKey,
|
|
4126
|
+
"exclude-user-ids": _ctx.excludeUserIds,
|
|
4104
4127
|
placeholder: _ctx.placeholder,
|
|
4105
4128
|
"render-list-item": _ctx.renderListItem,
|
|
4106
4129
|
"render-tag": _ctx.renderTag,
|
|
@@ -4109,7 +4132,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4109
4132
|
"user-group": _ctx.userGroup,
|
|
4110
4133
|
"user-group-name": _ctx.userGroupName,
|
|
4111
4134
|
onChange: handleUpdateUser
|
|
4112
|
-
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "empty-text", "exact-search-key", "placeholder", "render-list-item", "render-tag", "tenant-id", "tenants", "user-group", "user-group-name"])) : (openBlock(), createElementBlock(
|
|
4135
|
+
}, 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(
|
|
4113
4136
|
Fragment,
|
|
4114
4137
|
{ key: 1 },
|
|
4115
4138
|
[
|
|
@@ -4122,6 +4145,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4122
4145
|
draggable: _ctx.draggable,
|
|
4123
4146
|
"empty-text": _ctx.emptyText,
|
|
4124
4147
|
"exact-search-key": _ctx.exactSearchKey,
|
|
4148
|
+
"exclude-user-ids": _ctx.excludeUserIds,
|
|
4125
4149
|
placeholder: _ctx.placeholder,
|
|
4126
4150
|
"render-list-item": _ctx.renderListItem,
|
|
4127
4151
|
"render-tag": _ctx.renderTag,
|
|
@@ -4131,7 +4155,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4131
4155
|
"user-group": _ctx.userGroup,
|
|
4132
4156
|
"user-group-name": _ctx.userGroupName,
|
|
4133
4157
|
"onUpdate:selectedUsers": handleUpdateSelectedUsers
|
|
4134
|
-
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "draggable", "empty-text", "exact-search-key", "placeholder", "render-list-item", "render-tag", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
4158
|
+
}, 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"])
|
|
4135
4159
|
],
|
|
4136
4160
|
2112
|
|
4137
4161
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
@@ -4143,7 +4167,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4143
4167
|
};
|
|
4144
4168
|
}
|
|
4145
4169
|
});
|
|
4146
|
-
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4170
|
+
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-906da21c"]]);
|
|
4147
4171
|
export {
|
|
4148
4172
|
BkUserSelector,
|
|
4149
4173
|
BkUserSelector as default
|