@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 +3 -3
- package/package.json +1 -1
- package/typings/components/user-selector.vue.d.ts +3 -0
- package/typings/types/index.d.ts +4 -0
- package/vue2/index.es.min.js +203 -190
- package/vue2/index.iife.min.js +204 -191
- package/vue2/index.umd.min.js +204 -191
- package/vue2/vue2.css +163 -154
- package/vue3/index.es.min.js +88 -75
- package/vue3/index.iife.min.js +204 -191
- package/vue3/index.umd.min.js +88 -75
- package/vue3/vue3.css +32 -23
- package/typings/components/render-tag.d.ts +0 -8
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");
|
|
@@ -3059,7 +3059,7 @@ const UserRender = defineComponent({
|
|
|
3059
3059
|
};
|
|
3060
3060
|
}
|
|
3061
3061
|
});
|
|
3062
|
-
const _hoisted_1$
|
|
3062
|
+
const _hoisted_1$2 = {
|
|
3063
3063
|
key: 0,
|
|
3064
3064
|
class: "no-data"
|
|
3065
3065
|
};
|
|
@@ -3204,7 +3204,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3204
3204
|
mode: "spin"
|
|
3205
3205
|
}, {
|
|
3206
3206
|
default: withCtx(() => [
|
|
3207
|
-
__props.options.length === 0 && __props.userGroup.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
3207
|
+
__props.options.length === 0 && __props.userGroup.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
3208
3208
|
createElementVNode(
|
|
3209
3209
|
"span",
|
|
3210
3210
|
null,
|
|
@@ -3283,7 +3283,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3283
3283
|
};
|
|
3284
3284
|
}
|
|
3285
3285
|
});
|
|
3286
|
-
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
3286
|
+
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-e3741833"]]);
|
|
3287
3287
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3288
3288
|
...{
|
|
3289
3289
|
name: "UserTag"
|
|
@@ -3329,7 +3329,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3329
3329
|
}
|
|
3330
3330
|
});
|
|
3331
3331
|
const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-655f7a5a"]]);
|
|
3332
|
-
const _hoisted_1$
|
|
3332
|
+
const _hoisted_1$1 = ["onClick"];
|
|
3333
3333
|
const _hoisted_2$1 = ["placeholder"];
|
|
3334
3334
|
const _hoisted_3 = ["placeholder"];
|
|
3335
3335
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
@@ -3350,6 +3350,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3350
3350
|
userGroup: { default: () => [] },
|
|
3351
3351
|
userGroupName: { default: "用户群组" },
|
|
3352
3352
|
emptyText: { default: "无匹配人员" },
|
|
3353
|
+
disabled: { type: Boolean },
|
|
3353
3354
|
renderListItem: {},
|
|
3354
3355
|
renderTag: {},
|
|
3355
3356
|
excludeUserIds: { default: () => [] }
|
|
@@ -3607,7 +3608,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3607
3608
|
{
|
|
3608
3609
|
ref_key: "containerRef",
|
|
3609
3610
|
ref: containerRef,
|
|
3610
|
-
class: "multiple-selector"
|
|
3611
|
+
class: normalizeClass(["multiple-selector", { "is-disabled": _ctx.disabled }])
|
|
3611
3612
|
},
|
|
3612
3613
|
[
|
|
3613
3614
|
createCommentVNode(" 聚焦状态 - 可编辑模式 "),
|
|
@@ -3670,7 +3671,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3670
3671
|
)), [
|
|
3671
3672
|
[vModelText, unref(searchQuery)]
|
|
3672
3673
|
]) : createCommentVNode("v-if", true)
|
|
3673
|
-
], 8, _hoisted_1$
|
|
3674
|
+
], 8, _hoisted_1$1);
|
|
3674
3675
|
}),
|
|
3675
3676
|
128
|
|
3676
3677
|
/* KEYED_FRAGMENT */
|
|
@@ -3815,14 +3816,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3815
3816
|
onSelectUser: addUser
|
|
3816
3817
|
}, 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"])
|
|
3817
3818
|
],
|
|
3818
|
-
|
|
3819
|
-
/*
|
|
3819
|
+
2
|
|
3820
|
+
/* CLASS */
|
|
3820
3821
|
);
|
|
3821
3822
|
};
|
|
3822
3823
|
}
|
|
3823
3824
|
});
|
|
3824
|
-
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
3825
|
-
const _hoisted_1
|
|
3825
|
+
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-19a0ebec"]]);
|
|
3826
|
+
const _hoisted_1 = { class: "input-container" };
|
|
3826
3827
|
const _hoisted_2 = ["placeholder"];
|
|
3827
3828
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3828
3829
|
...{
|
|
@@ -3840,6 +3841,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3840
3841
|
userGroup: { default: () => [] },
|
|
3841
3842
|
userGroupName: { default: "用户群组" },
|
|
3842
3843
|
emptyText: { default: "无匹配人员" },
|
|
3844
|
+
disabled: { type: Boolean },
|
|
3843
3845
|
renderListItem: {},
|
|
3844
3846
|
renderTag: {},
|
|
3845
3847
|
excludeUserIds: { default: () => [] }
|
|
@@ -3957,70 +3959,72 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3957
3959
|
emit("update:modelValue", newVal);
|
|
3958
3960
|
});
|
|
3959
3961
|
return (_ctx, _cache) => {
|
|
3960
|
-
return withDirectives((openBlock(), createElementBlock(
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3962
|
+
return withDirectives((openBlock(), createElementBlock(
|
|
3963
|
+
"div",
|
|
3964
|
+
{
|
|
3965
|
+
ref_key: "containerRef",
|
|
3966
|
+
ref: containerRef,
|
|
3967
|
+
class: normalizeClass(["single-selector", { "is-disabled": _ctx.disabled }])
|
|
3968
|
+
},
|
|
3969
|
+
[
|
|
3970
|
+
createCommentVNode(" 输入框 "),
|
|
3971
|
+
createElementVNode("div", _hoisted_1, [
|
|
3972
|
+
createCommentVNode(" 用户标签显示 "),
|
|
3973
|
+
selectedUserInfo.value ? (openBlock(), createElementBlock("div", {
|
|
3974
|
+
key: 0,
|
|
3975
|
+
onClick: withModifiers(removeSelectedUser, ["stop"])
|
|
3976
|
+
}, [
|
|
3977
|
+
createVNode(UserTag, {
|
|
3978
|
+
"current-tenant-id": _ctx.tenantId,
|
|
3979
|
+
"render-tag": _ctx.renderTag,
|
|
3980
|
+
tenants: _ctx.tenants,
|
|
3981
|
+
user: selectedUserInfo.value,
|
|
3982
|
+
onClose: removeSelectedUser
|
|
3983
|
+
}, null, 8, ["current-tenant-id", "render-tag", "tenants", "user"])
|
|
3984
|
+
])) : createCommentVNode("v-if", true),
|
|
3985
|
+
withDirectives(createElementVNode("input", {
|
|
3986
|
+
ref_key: "inputRef",
|
|
3987
|
+
ref: inputRef,
|
|
3988
|
+
class: "search-input",
|
|
3989
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
|
|
3990
|
+
placeholder: selectedUserInfo.value ? "" : _ctx.placeholder,
|
|
3991
|
+
onFocus: handleInputFocus,
|
|
3992
|
+
onInput: handleInput
|
|
3993
|
+
}, null, 40, _hoisted_2), [
|
|
3994
|
+
[vModelText, searchQuery.value]
|
|
3995
|
+
]),
|
|
3996
|
+
createCommentVNode(' "我"标签 '),
|
|
3997
|
+
createVNode(MeTag, {
|
|
3998
|
+
"current-user-id": _ctx.currentUserId,
|
|
3999
|
+
"is-disabled": !!_ctx.currentUserId && !!selectedUserInfo.value && selectedUserInfo.value[_ctx.exactSearchKey] === _ctx.currentUserId,
|
|
4000
|
+
onClick: addCurrentUser
|
|
4001
|
+
}, null, 8, ["current-user-id", "is-disabled"])
|
|
3990
4002
|
]),
|
|
3991
|
-
createCommentVNode(
|
|
3992
|
-
createVNode(
|
|
3993
|
-
"
|
|
3994
|
-
"
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
"render-list-item"
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
"user-group-name": _ctx.userGroupName,
|
|
4011
|
-
onSelectUser: addUser
|
|
4012
|
-
}, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
4013
|
-
])), [
|
|
4003
|
+
createCommentVNode(" 使用新的公共下拉选项组件 "),
|
|
4004
|
+
createVNode(SelectionPopover, {
|
|
4005
|
+
"container-width": containerRef.value ? containerRef.value.offsetWidth : "auto",
|
|
4006
|
+
"empty-text": _ctx.emptyText,
|
|
4007
|
+
"is-show": showDropdown.value,
|
|
4008
|
+
loading: isLoading.value,
|
|
4009
|
+
options: options.value,
|
|
4010
|
+
"render-list-item": _ctx.renderListItem,
|
|
4011
|
+
"search-query": searchQuery.value,
|
|
4012
|
+
"tenant-id": _ctx.tenantId,
|
|
4013
|
+
tenants: _ctx.tenants,
|
|
4014
|
+
"user-group": userGroupFilter.value,
|
|
4015
|
+
"user-group-name": _ctx.userGroupName,
|
|
4016
|
+
onSelectUser: addUser
|
|
4017
|
+
}, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
4018
|
+
],
|
|
4019
|
+
2
|
|
4020
|
+
/* CLASS */
|
|
4021
|
+
)), [
|
|
4014
4022
|
[unref(clickoutside), handleClickOutside]
|
|
4015
4023
|
]);
|
|
4016
4024
|
};
|
|
4017
4025
|
}
|
|
4018
4026
|
});
|
|
4019
|
-
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
4020
|
-
const _hoisted_1 = {
|
|
4021
|
-
ref: "containerRef",
|
|
4022
|
-
class: "bk-user-selector"
|
|
4023
|
-
};
|
|
4027
|
+
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-b6af00c3"]]);
|
|
4024
4028
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4025
4029
|
...{
|
|
4026
4030
|
name: "BkUserSelector"
|
|
@@ -4038,12 +4042,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4038
4042
|
userGroup: { default: () => [] },
|
|
4039
4043
|
userGroupName: { default: "用户群组" },
|
|
4040
4044
|
emptyText: { default: "无匹配人员" },
|
|
4045
|
+
disabled: { type: Boolean, default: false },
|
|
4041
4046
|
renderListItem: {},
|
|
4042
4047
|
renderTag: {},
|
|
4043
4048
|
excludeUserIds: { default: () => [] }
|
|
4044
4049
|
},
|
|
4045
4050
|
emits: ["update:modelValue", "change"],
|
|
4046
4051
|
setup(__props, { emit: __emit }) {
|
|
4052
|
+
provideGlobalConfig({
|
|
4053
|
+
prefix: "bk"
|
|
4054
|
+
});
|
|
4047
4055
|
const props = __props;
|
|
4048
4056
|
const emit = __emit;
|
|
4049
4057
|
const { tenants = {} } = useTenantData(props.apiBaseUrl, props.tenantId);
|
|
@@ -4112,7 +4120,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4112
4120
|
return (_ctx, _cache) => {
|
|
4113
4121
|
return openBlock(), createElementBlock(
|
|
4114
4122
|
"section",
|
|
4115
|
-
|
|
4123
|
+
{
|
|
4124
|
+
ref: "containerRef",
|
|
4125
|
+
class: normalizeClass(["bk-user-selector", { "is-disabled": _ctx.disabled }])
|
|
4126
|
+
},
|
|
4116
4127
|
[
|
|
4117
4128
|
createCommentVNode(" 单选模式 "),
|
|
4118
4129
|
!_ctx.multiple ? (openBlock(), createBlock(SingleSelector, {
|
|
@@ -4121,6 +4132,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4121
4132
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedUser.value = $event),
|
|
4122
4133
|
"api-base-url": _ctx.apiBaseUrl,
|
|
4123
4134
|
"current-user-id": _ctx.currentUserId,
|
|
4135
|
+
disabled: _ctx.disabled,
|
|
4124
4136
|
"empty-text": _ctx.emptyText,
|
|
4125
4137
|
"exact-search-key": _ctx.exactSearchKey,
|
|
4126
4138
|
"exclude-user-ids": _ctx.excludeUserIds,
|
|
@@ -4132,7 +4144,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4132
4144
|
"user-group": _ctx.userGroup,
|
|
4133
4145
|
"user-group-name": _ctx.userGroupName,
|
|
4134
4146
|
onChange: handleUpdateUser
|
|
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(
|
|
4147
|
+
}, 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(
|
|
4136
4148
|
Fragment,
|
|
4137
4149
|
{ key: 1 },
|
|
4138
4150
|
[
|
|
@@ -4142,6 +4154,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4142
4154
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedUserIds.value = $event),
|
|
4143
4155
|
"api-base-url": _ctx.apiBaseUrl,
|
|
4144
4156
|
"current-user-id": _ctx.currentUserId,
|
|
4157
|
+
disabled: _ctx.disabled,
|
|
4145
4158
|
draggable: _ctx.draggable,
|
|
4146
4159
|
"empty-text": _ctx.emptyText,
|
|
4147
4160
|
"exact-search-key": _ctx.exactSearchKey,
|
|
@@ -4155,19 +4168,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4155
4168
|
"user-group": _ctx.userGroup,
|
|
4156
4169
|
"user-group-name": _ctx.userGroupName,
|
|
4157
4170
|
"onUpdate:selectedUsers": handleUpdateSelectedUsers
|
|
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"])
|
|
4171
|
+
}, 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"])
|
|
4159
4172
|
],
|
|
4160
4173
|
2112
|
|
4161
4174
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
4162
4175
|
))
|
|
4163
4176
|
],
|
|
4164
|
-
|
|
4165
|
-
/*
|
|
4177
|
+
2
|
|
4178
|
+
/* CLASS */
|
|
4166
4179
|
);
|
|
4167
4180
|
};
|
|
4168
4181
|
}
|
|
4169
4182
|
});
|
|
4170
|
-
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4183
|
+
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c31311f7"]]);
|
|
4171
4184
|
export {
|
|
4172
4185
|
BkUserSelector,
|
|
4173
4186
|
BkUserSelector as default
|