@blueking/bk-user-selector 0.0.23 → 0.0.25
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/multiple-selector.vue.d.ts +3 -0
- package/typings/components/single-selector.vue.d.ts +3 -0
- package/typings/components/user-selector.vue.d.ts +3 -0
- package/typings/types/index.d.ts +4 -0
- package/vue2/index.es.min.js +4630 -6887
- package/vue2/index.iife.min.js +4636 -6893
- package/vue2/index.umd.min.js +4618 -6875
- package/vue2/vue2.css +188 -705
- package/vue3/index.es.min.js +21 -13
- package/vue3/index.iife.min.js +4618 -6875
- package/vue3/index.umd.min.js +21 -13
- package/vue3/vue3.css +16 -16
package/vue3/index.es.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref, onBeforeMount, defineComponent, createElementBlock, createCommentVNode, openBlock, withModifiers, normalizeClass, h, computed, createBlock, unref, withCtx, createVNode, createElementVNode, toDisplayString, Fragment, renderList, watch, nextTick, onMounted, withDirectives, isRef, vModelText, createTextVNode } from "vue";
|
|
2
|
-
import { Popover, Loading, Tag, clickoutside } from "bkui-vue";
|
|
2
|
+
import { Popover, Loading, Tag, clickoutside, provideGlobalConfig } from "bkui-vue";
|
|
3
3
|
const getTenants = async (apiBaseUrl, tenantId) => {
|
|
4
4
|
if (!apiBaseUrl || !tenantId) {
|
|
5
5
|
console.warn("获取租户信息需要提供有效的apiBaseUrl和租户ID");
|
|
@@ -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 }) {
|
|
@@ -3874,7 +3876,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3874
3876
|
const result = await lookupUsers(props.apiBaseUrl || "", props.tenantId || "", props.exactSearchKey, [
|
|
3875
3877
|
props.modelValue
|
|
3876
3878
|
]);
|
|
3877
|
-
options.value = formatUsers(result);
|
|
3879
|
+
options.value = formatUsers(result).filter((user) => !props.excludeUserIds.includes(user.id));
|
|
3878
3880
|
if (props.userGroup.length > 0) {
|
|
3879
3881
|
const groupResult = props.userGroup.filter((group) => group.id == props.modelValue);
|
|
3880
3882
|
options.value = groupResult.map((group) => ({
|
|
@@ -3901,7 +3903,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3901
3903
|
const result = await lookupUsers(props.apiBaseUrl, props.tenantId, props.exactSearchKey, [props.currentUserId]);
|
|
3902
3904
|
const formattedResults = formatUsers(result);
|
|
3903
3905
|
if (formattedResults.length > 0) {
|
|
3904
|
-
options.value = formattedResults;
|
|
3906
|
+
options.value = formattedResults.filter((user) => !props.excludeUserIds.includes(user.id));
|
|
3905
3907
|
addUser(formattedResults[0]);
|
|
3906
3908
|
}
|
|
3907
3909
|
} catch (error) {
|
|
@@ -3916,7 +3918,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3916
3918
|
isLoading.value = true;
|
|
3917
3919
|
try {
|
|
3918
3920
|
const result = await searchUsers(props.apiBaseUrl, props.tenantId, keyword);
|
|
3919
|
-
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));
|
|
3920
3922
|
} catch (error) {
|
|
3921
3923
|
console.error("获取用户列表失败:", error);
|
|
3922
3924
|
options.value = [];
|
|
@@ -4014,7 +4016,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4014
4016
|
};
|
|
4015
4017
|
}
|
|
4016
4018
|
});
|
|
4017
|
-
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
4019
|
+
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-1454c121"]]);
|
|
4018
4020
|
const _hoisted_1 = {
|
|
4019
4021
|
ref: "containerRef",
|
|
4020
4022
|
class: "bk-user-selector"
|
|
@@ -4037,10 +4039,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4037
4039
|
userGroupName: { default: "用户群组" },
|
|
4038
4040
|
emptyText: { default: "无匹配人员" },
|
|
4039
4041
|
renderListItem: {},
|
|
4040
|
-
renderTag: {}
|
|
4042
|
+
renderTag: {},
|
|
4043
|
+
excludeUserIds: { default: () => [] }
|
|
4041
4044
|
},
|
|
4042
4045
|
emits: ["update:modelValue", "change"],
|
|
4043
4046
|
setup(__props, { emit: __emit }) {
|
|
4047
|
+
provideGlobalConfig({
|
|
4048
|
+
prefix: "bk"
|
|
4049
|
+
});
|
|
4044
4050
|
const props = __props;
|
|
4045
4051
|
const emit = __emit;
|
|
4046
4052
|
const { tenants = {} } = useTenantData(props.apiBaseUrl, props.tenantId);
|
|
@@ -4120,6 +4126,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4120
4126
|
"current-user-id": _ctx.currentUserId,
|
|
4121
4127
|
"empty-text": _ctx.emptyText,
|
|
4122
4128
|
"exact-search-key": _ctx.exactSearchKey,
|
|
4129
|
+
"exclude-user-ids": _ctx.excludeUserIds,
|
|
4123
4130
|
placeholder: _ctx.placeholder,
|
|
4124
4131
|
"render-list-item": _ctx.renderListItem,
|
|
4125
4132
|
"render-tag": _ctx.renderTag,
|
|
@@ -4128,7 +4135,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4128
4135
|
"user-group": _ctx.userGroup,
|
|
4129
4136
|
"user-group-name": _ctx.userGroupName,
|
|
4130
4137
|
onChange: handleUpdateUser
|
|
4131
|
-
}, 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(
|
|
4138
|
+
}, 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(
|
|
4132
4139
|
Fragment,
|
|
4133
4140
|
{ key: 1 },
|
|
4134
4141
|
[
|
|
@@ -4141,6 +4148,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4141
4148
|
draggable: _ctx.draggable,
|
|
4142
4149
|
"empty-text": _ctx.emptyText,
|
|
4143
4150
|
"exact-search-key": _ctx.exactSearchKey,
|
|
4151
|
+
"exclude-user-ids": _ctx.excludeUserIds,
|
|
4144
4152
|
placeholder: _ctx.placeholder,
|
|
4145
4153
|
"render-list-item": _ctx.renderListItem,
|
|
4146
4154
|
"render-tag": _ctx.renderTag,
|
|
@@ -4150,7 +4158,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4150
4158
|
"user-group": _ctx.userGroup,
|
|
4151
4159
|
"user-group-name": _ctx.userGroupName,
|
|
4152
4160
|
"onUpdate:selectedUsers": handleUpdateSelectedUsers
|
|
4153
|
-
}, 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"])
|
|
4161
|
+
}, 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"])
|
|
4154
4162
|
],
|
|
4155
4163
|
2112
|
|
4156
4164
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
@@ -4162,7 +4170,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4162
4170
|
};
|
|
4163
4171
|
}
|
|
4164
4172
|
});
|
|
4165
|
-
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4173
|
+
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6f6d9f42"]]);
|
|
4166
4174
|
export {
|
|
4167
4175
|
BkUserSelector,
|
|
4168
4176
|
BkUserSelector as default
|