@blueking/bk-user-selector 0.0.8 → 0.0.10
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/package.json +1 -1
- package/typings/components/multiple-selector.vue.d.ts +47 -168
- package/typings/components/single-selector.vue.d.ts +41 -3
- package/typings/components/user-selector.vue.d.ts +1 -1
- package/typings/types/index.d.ts +21 -0
- package/typings/vue2.d.ts +4 -0
- package/vue2/index.es.min.js +102 -160
- package/vue2/index.iife.min.js +103 -161
- package/vue2/index.umd.min.js +103 -161
- package/vue2/vue2.css +26 -26
- package/vue3/index.es.min.js +98 -160
- package/vue3/index.iife.min.js +99 -161
- package/vue3/index.umd.min.js +99 -161
- package/vue3/vue3.css +26 -26
package/vue3/index.umd.min.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
})(this, function(exports2, vue, bkuiVue) {
|
|
4
4
|
"use strict";
|
|
5
5
|
var __vite_style__ = document.createElement("style");
|
|
6
|
-
__vite_style__.textContent = ".me-tag[data-v-887b7c44] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background-color: #e1ecff;\n color: #4d4f56;\n border-radius: 50%;\n padding: 0 8px;\n height: 24px;\n width: 24px;\n cursor: pointer;\n font-size: 12px;\n position: absolute;\n right: 8px;\n top: 50%;\n transform: translateY(-50%);\n z-index: 1;\n}\n.me-tag[data-v-887b7c44]:hover {\n background-color: #cddffe;\n color: #3a84ff;\n}\n.me-tag.disabled[data-v-887b7c44] {\n background-color: #f0f1f5;\n color: #c4c6cc;\n cursor: not-allowed;\n}.dropdown-content[data-v-
|
|
6
|
+
__vite_style__.textContent = ".me-tag[data-v-887b7c44] {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background-color: #e1ecff;\n color: #4d4f56;\n border-radius: 50%;\n padding: 0 8px;\n height: 24px;\n width: 24px;\n cursor: pointer;\n font-size: 12px;\n position: absolute;\n right: 8px;\n top: 50%;\n transform: translateY(-50%);\n z-index: 1;\n}\n.me-tag[data-v-887b7c44]:hover {\n background-color: #cddffe;\n color: #3a84ff;\n}\n.me-tag.disabled[data-v-887b7c44] {\n background-color: #f0f1f5;\n color: #c4c6cc;\n cursor: not-allowed;\n}.dropdown-content[data-v-01b75e6e] {\n min-height: 40px;\n max-height: 300px;\n overflow-y: auto;\n padding: 5px 0;\n}\n.dropdown-content .no-data[data-v-01b75e6e] {\n padding: 10px;\n text-align: center;\n color: #979ba5;\n}\n.dropdown-content .user-group .group-header[data-v-01b75e6e] {\n padding: 8px 12px;\n color: #979ba5;\n display: flex;\n align-items: center;\n}\n.dropdown-content .user-group .group-header .group-count[data-v-01b75e6e] {\n margin-left: 4px;\n}\n.dropdown-content .user-option[data-v-01b75e6e] {\n padding: 8px 12px;\n cursor: pointer;\n display: flex;\n align-items: center;\n height: 32px;\n}\n.dropdown-content .user-option[data-v-01b75e6e]:hover {\n background-color: #f5f7fa;\n}\n.dropdown-content .user-option .tenant-name[data-v-01b75e6e] {\n color: #f59500;\n margin-left: 4px;\n padding: 0 4px;\n}.bk-user-selector-popover.bk-popover.bk-pop2-content {\n padding: 0;\n}.user-tag[data-v-203c36cb] {\n margin-right: 4px;\n}\n.user-tag.draggable[data-v-203c36cb] {\n cursor: move;\n}\n.user-tag.active[data-v-203c36cb] {\n background-color: #e1ecff;\n border-color: #3a84ff;\n}\n.user-tag .tag-content .user-name[data-v-203c36cb] {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: 12px;\n}\n.user-tag .tag-content .tenant-name[data-v-203c36cb] {\n color: #f59500;\n margin-left: 3px;\n white-space: nowrap;\n padding: 0 3px;\n border-radius: 2px;\n}.multiple-selector[data-v-1a376d26] {\n position: relative;\n width: 100%;\n}\n.multiple-selector .tags-container[data-v-1a376d26] {\n min-height: 32px;\n border: 1px solid #dcdee5;\n border-radius: 2px;\n padding: 1px 10px 1px 8px;\n transition: all 0.2s ease;\n background-color: #fff;\n}\n.multiple-selector .tags-container.focused[data-v-1a376d26] {\n border-color: #3a84ff;\n box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);\n}\n.multiple-selector .tags-container.collapsed[data-v-1a376d26] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-list[data-v-1a376d26] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-wrapper[data-v-1a376d26] {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n}\n.multiple-selector .search-input[data-v-1a376d26] {\n outline: none;\n border: none;\n height: 28px;\n min-width: 10px;\n background: transparent;\n}\n.multiple-selector .search-input[data-v-1a376d26]::placeholder {\n color: #c4c6cc;\n}\n.multiple-selector .search-input.inline[data-v-1a376d26] {\n min-width: 10px;\n}\n.multiple-selector .search-input.last[data-v-1a376d26], .multiple-selector .search-input.collapsed[data-v-1a376d26] {\n flex: 1;\n min-width: 60px;\n}.single-selector[data-v-22d9b76f] {\n position: relative;\n width: 100%;\n}\n.input-container[data-v-22d9b76f] {\n position: relative;\n display: flex;\n align-items: center;\n min-height: 32px;\n border: 1px solid #dcdee5;\n border-radius: 2px;\n padding: 0 8px;\n background-color: #fff;\n}\n.input-container[data-v-22d9b76f]:focus-within {\n border-color: #3a84ff;\n box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);\n}\n.search-input[data-v-22d9b76f] {\n flex: 1;\n outline: none;\n border: none;\n height: 30px;\n background: transparent;\n}\n.search-input[data-v-22d9b76f]::placeholder {\n color: #c4c6cc;\n}\n.selected-user[data-v-22d9b76f] {\n display: inline-flex;\n align-items: center;\n background-color: #f0f1f5;\n border-radius: 2px;\n padding: 0 8px;\n margin-right: 8px;\n height: 24px;\n max-width: calc(100% - 32px);\n}\n.selected-user .tenant-name[data-v-22d9b76f] {\n color: #f59500;\n margin-left: 4px;\n}\n.selected-user .close-icon[data-v-22d9b76f] {\n margin-left: 4px;\n cursor: pointer;\n font-style: normal;\n}.bk-user-selector[data-v-84252deb] {\n width: 100%;\n position: relative;\n font-size: 12px;\n}/*$vite$:1*/";
|
|
7
7
|
document.head.appendChild(__vite_style__);
|
|
8
8
|
const getTenants = async (apiBaseUrl, tenantId) => {
|
|
9
9
|
if (!apiBaseUrl || !tenantId) {
|
|
@@ -3104,7 +3104,6 @@
|
|
|
3104
3104
|
const emit = __emit;
|
|
3105
3105
|
const groupedUsers = vue.computed(() => {
|
|
3106
3106
|
const groups = {};
|
|
3107
|
-
console.log("props.options", props.options);
|
|
3108
3107
|
if (Array.isArray(props.userGroup) && props.userGroup.length > 0) {
|
|
3109
3108
|
groups[props.userGroupName] = props.userGroup.map((group) => ({
|
|
3110
3109
|
id: group.id,
|
|
@@ -3158,9 +3157,10 @@
|
|
|
3158
3157
|
class: "user-group",
|
|
3159
3158
|
key: groupName
|
|
3160
3159
|
}, [
|
|
3161
|
-
vue.
|
|
3160
|
+
Object.keys(groupedUsers.value).length > 1 ? (vue.openBlock(), vue.createElementBlock(
|
|
3162
3161
|
"div",
|
|
3163
3162
|
{
|
|
3163
|
+
key: 0,
|
|
3164
3164
|
class: "group-header",
|
|
3165
3165
|
onMousedown: _cache[0] || (_cache[0] = vue.withModifiers(() => {
|
|
3166
3166
|
}, ["prevent"]))
|
|
@@ -3183,7 +3183,7 @@
|
|
|
3183
3183
|
],
|
|
3184
3184
|
32
|
|
3185
3185
|
/* NEED_HYDRATION */
|
|
3186
|
-
),
|
|
3186
|
+
)) : vue.createCommentVNode("v-if", true),
|
|
3187
3187
|
(vue.openBlock(true), vue.createElementBlock(
|
|
3188
3188
|
vue.Fragment,
|
|
3189
3189
|
null,
|
|
@@ -3228,7 +3228,7 @@
|
|
|
3228
3228
|
};
|
|
3229
3229
|
}
|
|
3230
3230
|
});
|
|
3231
|
-
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
3231
|
+
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-01b75e6e"]]);
|
|
3232
3232
|
const _hoisted_1$3 = { class: "tag-content" };
|
|
3233
3233
|
const _hoisted_2$2 = { class: "user-name" };
|
|
3234
3234
|
const _hoisted_3$2 = {
|
|
@@ -3298,83 +3298,17 @@
|
|
|
3298
3298
|
},
|
|
3299
3299
|
__name: "multiple-selector",
|
|
3300
3300
|
props: {
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
},
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
type: String,
|
|
3313
|
-
default: "请输入人员名称搜索"
|
|
3314
|
-
},
|
|
3315
|
-
/**
|
|
3316
|
-
* 是否可拖拽
|
|
3317
|
-
*/
|
|
3318
|
-
draggable: {
|
|
3319
|
-
type: Boolean,
|
|
3320
|
-
default: false
|
|
3321
|
-
},
|
|
3322
|
-
/**
|
|
3323
|
-
* API 基础 URL
|
|
3324
|
-
*/
|
|
3325
|
-
apiBaseUrl: {
|
|
3326
|
-
type: String,
|
|
3327
|
-
default: ""
|
|
3328
|
-
},
|
|
3329
|
-
/**
|
|
3330
|
-
* 租户 ID
|
|
3331
|
-
*/
|
|
3332
|
-
tenantId: {
|
|
3333
|
-
type: String,
|
|
3334
|
-
default: ""
|
|
3335
|
-
},
|
|
3336
|
-
/**
|
|
3337
|
-
* 已选用户
|
|
3338
|
-
*/
|
|
3339
|
-
selectedUsers: {
|
|
3340
|
-
type: Array,
|
|
3341
|
-
default: () => []
|
|
3342
|
-
},
|
|
3343
|
-
/**
|
|
3344
|
-
* 租户信息映射
|
|
3345
|
-
*/
|
|
3346
|
-
tenants: {
|
|
3347
|
-
type: Object,
|
|
3348
|
-
default: () => ({})
|
|
3349
|
-
},
|
|
3350
|
-
/**
|
|
3351
|
-
* 当前用户ID
|
|
3352
|
-
*/
|
|
3353
|
-
currentUserId: {
|
|
3354
|
-
type: String,
|
|
3355
|
-
default: ""
|
|
3356
|
-
},
|
|
3357
|
-
/**
|
|
3358
|
-
* 精确查找key
|
|
3359
|
-
*/
|
|
3360
|
-
exactSearchKey: {
|
|
3361
|
-
type: String,
|
|
3362
|
-
default: "bk_username"
|
|
3363
|
-
},
|
|
3364
|
-
/**
|
|
3365
|
-
* 用户组
|
|
3366
|
-
*/
|
|
3367
|
-
userGroup: {
|
|
3368
|
-
type: Array,
|
|
3369
|
-
default: () => []
|
|
3370
|
-
},
|
|
3371
|
-
/**
|
|
3372
|
-
* 用户组名称
|
|
3373
|
-
*/
|
|
3374
|
-
userGroupName: {
|
|
3375
|
-
type: String,
|
|
3376
|
-
default: "用户群组"
|
|
3377
|
-
}
|
|
3301
|
+
modelValue: { default: () => [] },
|
|
3302
|
+
draggable: { type: Boolean, default: false },
|
|
3303
|
+
selectedUsers: { default: () => [] },
|
|
3304
|
+
tenants: { default: () => ({}) },
|
|
3305
|
+
apiBaseUrl: { default: "" },
|
|
3306
|
+
tenantId: { default: "" },
|
|
3307
|
+
placeholder: { default: "请输入人员名称搜索" },
|
|
3308
|
+
currentUserId: { default: "" },
|
|
3309
|
+
exactSearchKey: { default: "bk_username" },
|
|
3310
|
+
userGroup: { default: () => [] },
|
|
3311
|
+
userGroupName: { default: "用户群组" }
|
|
3378
3312
|
},
|
|
3379
3313
|
emits: ["update:selectedUsers", "add-user", "remove-user"],
|
|
3380
3314
|
setup(__props, { emit: __emit }) {
|
|
@@ -3637,7 +3571,7 @@
|
|
|
3637
3571
|
(vue.openBlock(true), vue.createElementBlock(
|
|
3638
3572
|
vue.Fragment,
|
|
3639
3573
|
null,
|
|
3640
|
-
vue.renderList(
|
|
3574
|
+
vue.renderList(_ctx.selectedUsers, (user, index) => {
|
|
3641
3575
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3642
3576
|
class: "tag-wrapper",
|
|
3643
3577
|
key: user.id,
|
|
@@ -3645,15 +3579,15 @@
|
|
|
3645
3579
|
}, [
|
|
3646
3580
|
vue.createVNode(UserTag, {
|
|
3647
3581
|
active: index === activeTagIndex.value,
|
|
3648
|
-
"current-tenant-id":
|
|
3649
|
-
draggable:
|
|
3650
|
-
tenants:
|
|
3582
|
+
"current-tenant-id": _ctx.tenantId,
|
|
3583
|
+
draggable: _ctx.draggable,
|
|
3584
|
+
tenants: _ctx.tenants,
|
|
3651
3585
|
user,
|
|
3652
3586
|
onClick: ($event) => handleTagClick(index),
|
|
3653
3587
|
onClose: ($event) => removeUser(user)
|
|
3654
3588
|
}, null, 8, ["active", "current-tenant-id", "draggable", "tenants", "user", "onClick", "onClose"]),
|
|
3655
3589
|
vue.createCommentVNode(" 在当前激活标签后插入输入框 "),
|
|
3656
|
-
index === activeTagIndex.value && activeTagIndex.value !==
|
|
3590
|
+
index === activeTagIndex.value && activeTagIndex.value !== _ctx.selectedUsers.length - 1 ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
|
|
3657
3591
|
"input",
|
|
3658
3592
|
{
|
|
3659
3593
|
key: 0,
|
|
@@ -3679,13 +3613,13 @@
|
|
|
3679
3613
|
/* KEYED_FRAGMENT */
|
|
3680
3614
|
)),
|
|
3681
3615
|
vue.createCommentVNode(" 最后一个输入框 "),
|
|
3682
|
-
activeTagIndex.value === -1 || activeTagIndex.value ===
|
|
3616
|
+
activeTagIndex.value === -1 || activeTagIndex.value === _ctx.selectedUsers.length - 1 ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
|
|
3683
3617
|
key: 0,
|
|
3684
3618
|
ref_key: "lastInputRef",
|
|
3685
3619
|
ref: lastInputRef,
|
|
3686
3620
|
class: "search-input last",
|
|
3687
3621
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(searchQuery) ? searchQuery.value = $event : null),
|
|
3688
|
-
placeholder: !
|
|
3622
|
+
placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
|
|
3689
3623
|
onFocus: handleInputFocus,
|
|
3690
3624
|
onInput: handleInput,
|
|
3691
3625
|
onKeydown: handleKeyDown,
|
|
@@ -3695,8 +3629,8 @@
|
|
|
3695
3629
|
]) : vue.createCommentVNode("v-if", true),
|
|
3696
3630
|
vue.createCommentVNode(' "我"标签 '),
|
|
3697
3631
|
vue.createVNode(MeTag, {
|
|
3698
|
-
"current-user-id":
|
|
3699
|
-
"is-disabled": !!
|
|
3632
|
+
"current-user-id": _ctx.currentUserId,
|
|
3633
|
+
"is-disabled": !!_ctx.currentUserId && _ctx.selectedUsers.some((user) => user.id === _ctx.currentUserId),
|
|
3700
3634
|
onClick: addCurrentUser
|
|
3701
3635
|
}, null, 8, ["current-user-id", "is-disabled"])
|
|
3702
3636
|
],
|
|
@@ -3725,10 +3659,10 @@
|
|
|
3725
3659
|
null,
|
|
3726
3660
|
vue.renderList(visibleUsers.value, (user) => {
|
|
3727
3661
|
return vue.openBlock(), vue.createBlock(UserTag, {
|
|
3728
|
-
"current-tenant-id":
|
|
3662
|
+
"current-tenant-id": _ctx.tenantId,
|
|
3729
3663
|
key: user.id,
|
|
3730
3664
|
"show-tenant": true,
|
|
3731
|
-
tenants:
|
|
3665
|
+
tenants: _ctx.tenants,
|
|
3732
3666
|
user,
|
|
3733
3667
|
onClick: handleFocus,
|
|
3734
3668
|
onClose: ($event) => removeUser(user)
|
|
@@ -3753,7 +3687,7 @@
|
|
|
3753
3687
|
/* STABLE */
|
|
3754
3688
|
})), [
|
|
3755
3689
|
[vue.unref(bkuiVue.bkTooltips), {
|
|
3756
|
-
content:
|
|
3690
|
+
content: _ctx.selectedUsers.slice(visibleUsers.value.length).map((user) => user.display_name).join(","),
|
|
3757
3691
|
placement: "top"
|
|
3758
3692
|
}]
|
|
3759
3693
|
]) : vue.createCommentVNode("v-if", true),
|
|
@@ -3763,15 +3697,15 @@
|
|
|
3763
3697
|
ref: collapsedInputRef,
|
|
3764
3698
|
class: "search-input collapsed",
|
|
3765
3699
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(searchQuery) ? searchQuery.value = $event : null),
|
|
3766
|
-
placeholder: !
|
|
3700
|
+
placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
|
|
3767
3701
|
onFocus: handleFocus
|
|
3768
3702
|
}, null, 40, _hoisted_3$1), [
|
|
3769
3703
|
[vue.vModelText, vue.unref(searchQuery)]
|
|
3770
3704
|
]),
|
|
3771
3705
|
vue.createCommentVNode(' 未聚焦状态下的"我"标签 '),
|
|
3772
3706
|
vue.createVNode(MeTag, {
|
|
3773
|
-
"current-user-id":
|
|
3774
|
-
"is-disabled": !!
|
|
3707
|
+
"current-user-id": _ctx.currentUserId,
|
|
3708
|
+
"is-disabled": !!_ctx.currentUserId && _ctx.selectedUsers.some((user) => user[props.exactSearchKey] === _ctx.currentUserId),
|
|
3775
3709
|
onClick: addCurrentUser
|
|
3776
3710
|
}, null, 8, ["current-user-id", "is-disabled"])
|
|
3777
3711
|
],
|
|
@@ -3789,10 +3723,10 @@
|
|
|
3789
3723
|
loading: vue.unref(searchLoading),
|
|
3790
3724
|
options: options.value,
|
|
3791
3725
|
"search-query": vue.unref(searchQuery),
|
|
3792
|
-
"tenant-id":
|
|
3793
|
-
tenants:
|
|
3794
|
-
"user-group":
|
|
3795
|
-
"user-group-name":
|
|
3726
|
+
"tenant-id": _ctx.tenantId,
|
|
3727
|
+
tenants: _ctx.tenants,
|
|
3728
|
+
"user-group": _ctx.userGroup,
|
|
3729
|
+
"user-group-name": _ctx.userGroupName,
|
|
3796
3730
|
onSelectUser: addUser
|
|
3797
3731
|
}, null, 8, ["container-width", "is-show", "loading", "options", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
3798
3732
|
])), [
|
|
@@ -3801,8 +3735,8 @@
|
|
|
3801
3735
|
};
|
|
3802
3736
|
}
|
|
3803
3737
|
});
|
|
3804
|
-
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
3805
|
-
const _withScopeId = (n) => (vue.pushScopeId("data-v-
|
|
3738
|
+
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-1a376d26"]]);
|
|
3739
|
+
const _withScopeId = (n) => (vue.pushScopeId("data-v-22d9b76f"), n = n(), vue.popScopeId(), n);
|
|
3806
3740
|
const _hoisted_1$1 = { class: "input-container" };
|
|
3807
3741
|
const _hoisted_2 = {
|
|
3808
3742
|
key: 0,
|
|
@@ -3822,15 +3756,15 @@
|
|
|
3822
3756
|
},
|
|
3823
3757
|
__name: "single-selector",
|
|
3824
3758
|
props: {
|
|
3825
|
-
modelValue: {},
|
|
3759
|
+
modelValue: { default: "" },
|
|
3826
3760
|
tenants: {},
|
|
3827
|
-
apiBaseUrl: {},
|
|
3828
|
-
tenantId: {},
|
|
3829
|
-
placeholder: {},
|
|
3830
|
-
currentUserId: {},
|
|
3831
|
-
exactSearchKey: {},
|
|
3832
|
-
userGroup: {},
|
|
3833
|
-
userGroupName: {}
|
|
3761
|
+
apiBaseUrl: { default: "" },
|
|
3762
|
+
tenantId: { default: "" },
|
|
3763
|
+
placeholder: { default: "请输入人员名称搜索" },
|
|
3764
|
+
currentUserId: { default: "" },
|
|
3765
|
+
exactSearchKey: { default: "bk_username" },
|
|
3766
|
+
userGroup: { default: () => [] },
|
|
3767
|
+
userGroupName: { default: "用户群组" }
|
|
3834
3768
|
},
|
|
3835
3769
|
emits: ["update:modelValue", "change"],
|
|
3836
3770
|
setup(__props, { emit: __emit }) {
|
|
@@ -3891,7 +3825,6 @@
|
|
|
3891
3825
|
try {
|
|
3892
3826
|
const result = await searchUsers(props.apiBaseUrl, props.tenantId, keyword);
|
|
3893
3827
|
options.value = formatUsers(result).filter((user) => !selectedUser.value || user.id !== selectedUser.value);
|
|
3894
|
-
console.log("options.value", options.value);
|
|
3895
3828
|
} catch (error) {
|
|
3896
3829
|
console.error("获取用户列表失败:", error);
|
|
3897
3830
|
options.value = [];
|
|
@@ -3900,7 +3833,6 @@
|
|
|
3900
3833
|
}
|
|
3901
3834
|
};
|
|
3902
3835
|
const addUser = (user) => {
|
|
3903
|
-
console.log("addUser", user);
|
|
3904
3836
|
selectedUser.value = user.id;
|
|
3905
3837
|
searchQuery.value = "";
|
|
3906
3838
|
showDropdown.value = false;
|
|
@@ -3915,7 +3847,6 @@
|
|
|
3915
3847
|
}
|
|
3916
3848
|
};
|
|
3917
3849
|
const handleInput = () => {
|
|
3918
|
-
console.log("handleInput", searchQuery.value);
|
|
3919
3850
|
fetchUsers(searchQuery.value);
|
|
3920
3851
|
showDropdown.value = searchQuery.value.length >= 2;
|
|
3921
3852
|
};
|
|
@@ -3923,7 +3854,6 @@
|
|
|
3923
3854
|
showDropdown.value = false;
|
|
3924
3855
|
};
|
|
3925
3856
|
vue.watch(selectedUser, (newVal) => {
|
|
3926
|
-
console.log("selectedUser", newVal);
|
|
3927
3857
|
emit("update:modelValue", newVal);
|
|
3928
3858
|
});
|
|
3929
3859
|
return (_ctx, _cache) => {
|
|
@@ -3969,10 +3899,10 @@
|
|
|
3969
3899
|
]),
|
|
3970
3900
|
vue.createCommentVNode(' "我"标签 '),
|
|
3971
3901
|
vue.createVNode(MeTag, {
|
|
3972
|
-
"is-disabled": !!_ctx.currentUserId && !!selectedUserInfo.value && selectedUserInfo.value[_ctx.exactSearchKey || "bk_username"] === _ctx.currentUserId,
|
|
3973
3902
|
"current-user-id": _ctx.currentUserId,
|
|
3903
|
+
"is-disabled": !!_ctx.currentUserId && !!selectedUserInfo.value && selectedUserInfo.value[_ctx.exactSearchKey] === _ctx.currentUserId,
|
|
3974
3904
|
onClick: addCurrentUser
|
|
3975
|
-
}, null, 8, ["
|
|
3905
|
+
}, null, 8, ["current-user-id", "is-disabled"])
|
|
3976
3906
|
]),
|
|
3977
3907
|
vue.createCommentVNode(" 使用新的公共下拉选项组件 "),
|
|
3978
3908
|
vue.createVNode(SelectionPopover, {
|
|
@@ -3993,8 +3923,11 @@
|
|
|
3993
3923
|
};
|
|
3994
3924
|
}
|
|
3995
3925
|
});
|
|
3996
|
-
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
3997
|
-
const _hoisted_1 = {
|
|
3926
|
+
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-22d9b76f"]]);
|
|
3927
|
+
const _hoisted_1 = {
|
|
3928
|
+
ref: "containerRef",
|
|
3929
|
+
class: "bk-user-selector"
|
|
3930
|
+
};
|
|
3998
3931
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
3999
3932
|
...{
|
|
4000
3933
|
name: "BkUserSelector"
|
|
@@ -4027,7 +3960,6 @@
|
|
|
4027
3960
|
const ids = Array.isArray(props.modelValue) ? props.modelValue : [];
|
|
4028
3961
|
if (ids.length > 0) {
|
|
4029
3962
|
try {
|
|
4030
|
-
console.log(props.exactSearchKey);
|
|
4031
3963
|
const result = await lookupUsers(props.apiBaseUrl, props.tenantId, props.exactSearchKey, ids);
|
|
4032
3964
|
selectedUsers.value = formatUsers(result);
|
|
4033
3965
|
} catch (error) {
|
|
@@ -4058,50 +3990,56 @@
|
|
|
4058
3990
|
initSelectedUsers();
|
|
4059
3991
|
});
|
|
4060
3992
|
return (_ctx, _cache) => {
|
|
4061
|
-
return vue.openBlock(), vue.createElementBlock(
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
[
|
|
4080
|
-
vue.
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
"
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
3993
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
3994
|
+
"section",
|
|
3995
|
+
_hoisted_1,
|
|
3996
|
+
[
|
|
3997
|
+
vue.createCommentVNode(" 单选模式 "),
|
|
3998
|
+
!_ctx.multiple ? (vue.openBlock(), vue.createBlock(SingleSelector, {
|
|
3999
|
+
key: 0,
|
|
4000
|
+
modelValue: selectedUser.value,
|
|
4001
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedUser.value = $event),
|
|
4002
|
+
"api-base-url": _ctx.apiBaseUrl,
|
|
4003
|
+
"current-user-id": _ctx.currentUserId,
|
|
4004
|
+
"exact-search-key": _ctx.exactSearchKey,
|
|
4005
|
+
placeholder: _ctx.placeholder,
|
|
4006
|
+
"tenant-id": _ctx.tenantId,
|
|
4007
|
+
tenants: vue.unref(tenants),
|
|
4008
|
+
"user-group": _ctx.userGroup,
|
|
4009
|
+
"user-group-name": _ctx.userGroupName,
|
|
4010
|
+
onChange: handleUpdateUser
|
|
4011
|
+
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "exact-search-key", "placeholder", "tenant-id", "tenants", "user-group", "user-group-name"])) : (vue.openBlock(), vue.createElementBlock(
|
|
4012
|
+
vue.Fragment,
|
|
4013
|
+
{ key: 1 },
|
|
4014
|
+
[
|
|
4015
|
+
vue.createCommentVNode(" 多选模式 "),
|
|
4016
|
+
vue.createVNode(MultipleSelector, {
|
|
4017
|
+
modelValue: selectedUserIds.value,
|
|
4018
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedUserIds.value = $event),
|
|
4019
|
+
"api-base-url": _ctx.apiBaseUrl,
|
|
4020
|
+
"current-user-id": _ctx.currentUserId,
|
|
4021
|
+
draggable: _ctx.draggable,
|
|
4022
|
+
"exact-search-key": _ctx.exactSearchKey,
|
|
4023
|
+
placeholder: _ctx.placeholder,
|
|
4024
|
+
"selected-users": selectedUsers.value,
|
|
4025
|
+
"tenant-id": _ctx.tenantId,
|
|
4026
|
+
tenants: vue.unref(tenants),
|
|
4027
|
+
"user-group": _ctx.userGroup,
|
|
4028
|
+
"user-group-name": _ctx.userGroupName,
|
|
4029
|
+
"onUpdate:selectedUsers": handleUpdateSelectedUsers
|
|
4030
|
+
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "draggable", "exact-search-key", "placeholder", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
4031
|
+
],
|
|
4032
|
+
2112
|
|
4033
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
4034
|
+
))
|
|
4035
|
+
],
|
|
4036
|
+
512
|
|
4037
|
+
/* NEED_PATCH */
|
|
4038
|
+
);
|
|
4101
4039
|
};
|
|
4102
4040
|
}
|
|
4103
4041
|
});
|
|
4104
|
-
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4042
|
+
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-84252deb"]]);
|
|
4105
4043
|
exports2.BkUserSelector = BkUserSelector;
|
|
4106
4044
|
exports2.default = BkUserSelector;
|
|
4107
4045
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
package/vue3/vue3.css
CHANGED
|
@@ -24,37 +24,37 @@
|
|
|
24
24
|
background-color: #f0f1f5;
|
|
25
25
|
color: #c4c6cc;
|
|
26
26
|
cursor: not-allowed;
|
|
27
|
-
}.dropdown-content[data-v-
|
|
27
|
+
}.dropdown-content[data-v-01b75e6e] {
|
|
28
28
|
min-height: 40px;
|
|
29
29
|
max-height: 300px;
|
|
30
30
|
overflow-y: auto;
|
|
31
31
|
padding: 5px 0;
|
|
32
32
|
}
|
|
33
|
-
.dropdown-content .no-data[data-v-
|
|
33
|
+
.dropdown-content .no-data[data-v-01b75e6e] {
|
|
34
34
|
padding: 10px;
|
|
35
35
|
text-align: center;
|
|
36
36
|
color: #979ba5;
|
|
37
37
|
}
|
|
38
|
-
.dropdown-content .user-group .group-header[data-v-
|
|
38
|
+
.dropdown-content .user-group .group-header[data-v-01b75e6e] {
|
|
39
39
|
padding: 8px 12px;
|
|
40
40
|
color: #979ba5;
|
|
41
41
|
display: flex;
|
|
42
42
|
align-items: center;
|
|
43
43
|
}
|
|
44
|
-
.dropdown-content .user-group .group-header .group-count[data-v-
|
|
44
|
+
.dropdown-content .user-group .group-header .group-count[data-v-01b75e6e] {
|
|
45
45
|
margin-left: 4px;
|
|
46
46
|
}
|
|
47
|
-
.dropdown-content .user-option[data-v-
|
|
47
|
+
.dropdown-content .user-option[data-v-01b75e6e] {
|
|
48
48
|
padding: 8px 12px;
|
|
49
49
|
cursor: pointer;
|
|
50
50
|
display: flex;
|
|
51
51
|
align-items: center;
|
|
52
52
|
height: 32px;
|
|
53
53
|
}
|
|
54
|
-
.dropdown-content .user-option[data-v-
|
|
54
|
+
.dropdown-content .user-option[data-v-01b75e6e]:hover {
|
|
55
55
|
background-color: #f5f7fa;
|
|
56
56
|
}
|
|
57
|
-
.dropdown-content .user-option .tenant-name[data-v-
|
|
57
|
+
.dropdown-content .user-option .tenant-name[data-v-01b75e6e] {
|
|
58
58
|
color: #f59500;
|
|
59
59
|
margin-left: 4px;
|
|
60
60
|
padding: 0 4px;
|
|
@@ -82,11 +82,11 @@
|
|
|
82
82
|
white-space: nowrap;
|
|
83
83
|
padding: 0 3px;
|
|
84
84
|
border-radius: 2px;
|
|
85
|
-
}.multiple-selector[data-v-
|
|
85
|
+
}.multiple-selector[data-v-1a376d26] {
|
|
86
86
|
position: relative;
|
|
87
87
|
width: 100%;
|
|
88
88
|
}
|
|
89
|
-
.multiple-selector .tags-container[data-v-
|
|
89
|
+
.multiple-selector .tags-container[data-v-1a376d26] {
|
|
90
90
|
min-height: 32px;
|
|
91
91
|
border: 1px solid #dcdee5;
|
|
92
92
|
border-radius: 2px;
|
|
@@ -94,46 +94,46 @@
|
|
|
94
94
|
transition: all 0.2s ease;
|
|
95
95
|
background-color: #fff;
|
|
96
96
|
}
|
|
97
|
-
.multiple-selector .tags-container.focused[data-v-
|
|
97
|
+
.multiple-selector .tags-container.focused[data-v-1a376d26] {
|
|
98
98
|
border-color: #3a84ff;
|
|
99
99
|
box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);
|
|
100
100
|
}
|
|
101
|
-
.multiple-selector .tags-container.collapsed[data-v-
|
|
101
|
+
.multiple-selector .tags-container.collapsed[data-v-1a376d26] {
|
|
102
102
|
display: flex;
|
|
103
103
|
flex-wrap: wrap;
|
|
104
104
|
align-items: center;
|
|
105
105
|
}
|
|
106
|
-
.multiple-selector .tag-list[data-v-
|
|
106
|
+
.multiple-selector .tag-list[data-v-1a376d26] {
|
|
107
107
|
display: flex;
|
|
108
108
|
flex-wrap: wrap;
|
|
109
109
|
align-items: center;
|
|
110
110
|
}
|
|
111
|
-
.multiple-selector .tag-wrapper[data-v-
|
|
111
|
+
.multiple-selector .tag-wrapper[data-v-1a376d26] {
|
|
112
112
|
display: inline-flex;
|
|
113
113
|
align-items: center;
|
|
114
114
|
max-width: 100%;
|
|
115
115
|
}
|
|
116
|
-
.multiple-selector .search-input[data-v-
|
|
116
|
+
.multiple-selector .search-input[data-v-1a376d26] {
|
|
117
117
|
outline: none;
|
|
118
118
|
border: none;
|
|
119
119
|
height: 28px;
|
|
120
120
|
min-width: 10px;
|
|
121
121
|
background: transparent;
|
|
122
122
|
}
|
|
123
|
-
.multiple-selector .search-input[data-v-
|
|
123
|
+
.multiple-selector .search-input[data-v-1a376d26]::placeholder {
|
|
124
124
|
color: #c4c6cc;
|
|
125
125
|
}
|
|
126
|
-
.multiple-selector .search-input.inline[data-v-
|
|
126
|
+
.multiple-selector .search-input.inline[data-v-1a376d26] {
|
|
127
127
|
min-width: 10px;
|
|
128
128
|
}
|
|
129
|
-
.multiple-selector .search-input.last[data-v-
|
|
129
|
+
.multiple-selector .search-input.last[data-v-1a376d26], .multiple-selector .search-input.collapsed[data-v-1a376d26] {
|
|
130
130
|
flex: 1;
|
|
131
131
|
min-width: 60px;
|
|
132
|
-
}.single-selector[data-v-
|
|
132
|
+
}.single-selector[data-v-22d9b76f] {
|
|
133
133
|
position: relative;
|
|
134
134
|
width: 100%;
|
|
135
135
|
}
|
|
136
|
-
.input-container[data-v-
|
|
136
|
+
.input-container[data-v-22d9b76f] {
|
|
137
137
|
position: relative;
|
|
138
138
|
display: flex;
|
|
139
139
|
align-items: center;
|
|
@@ -143,21 +143,21 @@
|
|
|
143
143
|
padding: 0 8px;
|
|
144
144
|
background-color: #fff;
|
|
145
145
|
}
|
|
146
|
-
.input-container[data-v-
|
|
146
|
+
.input-container[data-v-22d9b76f]:focus-within {
|
|
147
147
|
border-color: #3a84ff;
|
|
148
148
|
box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);
|
|
149
149
|
}
|
|
150
|
-
.search-input[data-v-
|
|
150
|
+
.search-input[data-v-22d9b76f] {
|
|
151
151
|
flex: 1;
|
|
152
152
|
outline: none;
|
|
153
153
|
border: none;
|
|
154
154
|
height: 30px;
|
|
155
155
|
background: transparent;
|
|
156
156
|
}
|
|
157
|
-
.search-input[data-v-
|
|
157
|
+
.search-input[data-v-22d9b76f]::placeholder {
|
|
158
158
|
color: #c4c6cc;
|
|
159
159
|
}
|
|
160
|
-
.selected-user[data-v-
|
|
160
|
+
.selected-user[data-v-22d9b76f] {
|
|
161
161
|
display: inline-flex;
|
|
162
162
|
align-items: center;
|
|
163
163
|
background-color: #f0f1f5;
|
|
@@ -167,15 +167,15 @@
|
|
|
167
167
|
height: 24px;
|
|
168
168
|
max-width: calc(100% - 32px);
|
|
169
169
|
}
|
|
170
|
-
.selected-user .tenant-name[data-v-
|
|
170
|
+
.selected-user .tenant-name[data-v-22d9b76f] {
|
|
171
171
|
color: #f59500;
|
|
172
172
|
margin-left: 4px;
|
|
173
173
|
}
|
|
174
|
-
.selected-user .close-icon[data-v-
|
|
174
|
+
.selected-user .close-icon[data-v-22d9b76f] {
|
|
175
175
|
margin-left: 4px;
|
|
176
176
|
cursor: pointer;
|
|
177
177
|
font-style: normal;
|
|
178
|
-
}.bk-user-selector[data-v-
|
|
178
|
+
}.bk-user-selector[data-v-84252deb] {
|
|
179
179
|
width: 100%;
|
|
180
180
|
position: relative;
|
|
181
181
|
font-size: 12px;
|