@blueking/bk-user-selector 0.0.19 → 0.0.21
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 +17 -15
- package/package.json +1 -1
- package/typings/components/multiple-selector.vue.d.ts +5 -0
- package/typings/components/selection-popover.vue.d.ts +16 -0
- package/typings/components/single-selector.vue.d.ts +5 -0
- package/typings/components/user-render.d.ts +21 -0
- package/typings/components/user-selector.vue.d.ts +6 -0
- package/typings/components/user-tag.vue.d.ts +9 -0
- package/typings/types/index.d.ts +1 -0
- package/vue2/index.es.min.js +98 -64
- package/vue2/index.iife.min.js +98 -70
- package/vue2/index.umd.min.js +98 -64
- package/vue2/vue2.css +27 -46
- package/vue3/index.es.min.js +98 -64
- package/vue3/index.iife.min.js +98 -64
- package/vue3/index.umd.min.js +98 -64
- package/vue3/vue3.css +27 -46
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-a1278ff6] {\n min-height: 40px;\n max-height: 300px;\n overflow-y: auto;\n padding: 5px 0;\n}\n.dropdown-content .no-data[data-v-a1278ff6] {\n padding: 10px;\n text-align: center;\n color: #979ba5;\n}\n.dropdown-content .user-group .group-header[data-v-a1278ff6] {\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-a1278ff6] {\n margin-left: 4px;\n}\n.dropdown-content .user-option[data-v-a1278ff6] {\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-a1278ff6]:hover {\n background-color: #f5f7fa;\n}\n.dropdown-content .user-option .tenant-name[data-v-a1278ff6] {\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-7099192b] {\n margin-right: 4px;\n margin-left: 0;\n}\n.user-tag.draggable[data-v-7099192b] {\n cursor: move;\n}\n.user-tag.active[data-v-7099192b] {\n background-color: #e1ecff;\n border-color: #3a84ff;\n}\n.user-tag .tag-content .user-name[data-v-7099192b] {\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-7099192b] {\n color: #f59500;\n margin-left: 3px;\n white-space: nowrap;\n padding: 0 3px;\n border-radius: 2px;\n}.multiple-selector[data-v-d4f489c3] {\n position: relative;\n width: 100%;\n}\n.multiple-selector .tags-container[data-v-d4f489c3] {\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-d4f489c3] {\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-d4f489c3] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-list[data-v-d4f489c3] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-wrapper[data-v-d4f489c3] {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n}\n.multiple-selector .search-input[data-v-d4f489c3] {\n outline: none;\n border: none;\n height: 28px;\n min-width: 10px;\n background: transparent;\n}\n.multiple-selector .search-input[data-v-d4f489c3]::placeholder {\n color: #c4c6cc;\n}\n.multiple-selector .search-input.inline[data-v-d4f489c3] {\n min-width: 10px;\n}\n.multiple-selector .search-input.last[data-v-d4f489c3], .multiple-selector .search-input.collapsed[data-v-d4f489c3] {\n flex: 1;\n min-width: 60px;\n}.single-selector[data-v-91a75bba] {\n position: relative;\n width: 100%;\n}\n.input-container[data-v-91a75bba] {\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-91a75bba]: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-91a75bba] {\n flex: 1;\n outline: none;\n border: none;\n height: 30px;\n background: transparent;\n}\n.search-input[data-v-91a75bba]::placeholder {\n color: #c4c6cc;\n}.bk-user-selector[data-v-c23f5bc9] {\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) {
|
|
@@ -2929,7 +2929,7 @@
|
|
|
2929
2929
|
const loading = vue.ref(false);
|
|
2930
2930
|
const searchQuery = vue.ref("");
|
|
2931
2931
|
const performSearch = async (keyword) => {
|
|
2932
|
-
if (!keyword
|
|
2932
|
+
if (!(keyword == null ? void 0 : keyword.length)) {
|
|
2933
2933
|
searchResults.value = [];
|
|
2934
2934
|
return;
|
|
2935
2935
|
}
|
|
@@ -3018,14 +3018,39 @@
|
|
|
3018
3018
|
return target;
|
|
3019
3019
|
};
|
|
3020
3020
|
const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-887b7c44"]]);
|
|
3021
|
+
const UserRender = vue.defineComponent({
|
|
3022
|
+
name: "UserRender",
|
|
3023
|
+
props: {
|
|
3024
|
+
render: {
|
|
3025
|
+
type: Function,
|
|
3026
|
+
required: true
|
|
3027
|
+
},
|
|
3028
|
+
user: {
|
|
3029
|
+
type: Object,
|
|
3030
|
+
required: true
|
|
3031
|
+
}
|
|
3032
|
+
},
|
|
3033
|
+
setup(props) {
|
|
3034
|
+
return () => {
|
|
3035
|
+
try {
|
|
3036
|
+
return props.render(vue.h, props.user);
|
|
3037
|
+
} catch (error) {
|
|
3038
|
+
console.error("Error rendering tag:", error);
|
|
3039
|
+
return vue.h("div", props.user.name);
|
|
3040
|
+
}
|
|
3041
|
+
};
|
|
3042
|
+
}
|
|
3043
|
+
});
|
|
3021
3044
|
const _hoisted_1$4 = {
|
|
3022
3045
|
key: 0,
|
|
3023
3046
|
class: "no-data"
|
|
3024
3047
|
};
|
|
3025
3048
|
const _hoisted_2$3 = { class: "group-name" };
|
|
3026
|
-
const _hoisted_3$
|
|
3049
|
+
const _hoisted_3$2 = { class: "group-count" };
|
|
3027
3050
|
const _hoisted_4$1 = ["onMousedown"];
|
|
3028
|
-
const _hoisted_5 = {
|
|
3051
|
+
const _hoisted_5 = { key: 0 };
|
|
3052
|
+
const _hoisted_6 = { key: 1 };
|
|
3053
|
+
const _hoisted_7 = {
|
|
3029
3054
|
key: 0,
|
|
3030
3055
|
class: "tenant-name"
|
|
3031
3056
|
};
|
|
@@ -3104,6 +3129,12 @@
|
|
|
3104
3129
|
emptyText: {
|
|
3105
3130
|
type: String,
|
|
3106
3131
|
default: "无匹配人员"
|
|
3132
|
+
},
|
|
3133
|
+
/**
|
|
3134
|
+
* 渲染列表项
|
|
3135
|
+
*/
|
|
3136
|
+
renderListItem: {
|
|
3137
|
+
type: Function
|
|
3107
3138
|
}
|
|
3108
3139
|
},
|
|
3109
3140
|
emits: ["select-user"],
|
|
@@ -3113,7 +3144,7 @@
|
|
|
3113
3144
|
const groupedUsers = vue.computed(() => {
|
|
3114
3145
|
const groups = {};
|
|
3115
3146
|
if (Array.isArray(props.userGroup) && props.userGroup.length > 0) {
|
|
3116
|
-
groups[props.userGroupName] = props.userGroup.
|
|
3147
|
+
groups[props.userGroupName] = props.userGroup.map((group) => ({
|
|
3117
3148
|
...group,
|
|
3118
3149
|
tenantId: "",
|
|
3119
3150
|
type: "userGroup"
|
|
@@ -3153,7 +3184,7 @@
|
|
|
3153
3184
|
vue.createElementVNode(
|
|
3154
3185
|
"span",
|
|
3155
3186
|
null,
|
|
3156
|
-
vue.toDisplayString(__props.
|
|
3187
|
+
vue.toDisplayString(__props.emptyText),
|
|
3157
3188
|
1
|
|
3158
3189
|
/* TEXT */
|
|
3159
3190
|
)
|
|
@@ -3183,7 +3214,7 @@
|
|
|
3183
3214
|
),
|
|
3184
3215
|
vue.createElementVNode(
|
|
3185
3216
|
"span",
|
|
3186
|
-
_hoisted_3$
|
|
3217
|
+
_hoisted_3$2,
|
|
3187
3218
|
"(" + vue.toDisplayString(group.length) + ")",
|
|
3188
3219
|
1
|
|
3189
3220
|
/* TEXT */
|
|
@@ -3201,7 +3232,12 @@
|
|
|
3201
3232
|
key: user.id,
|
|
3202
3233
|
onMousedown: vue.withModifiers(($event) => selectUser(user), ["prevent"])
|
|
3203
3234
|
}, [
|
|
3204
|
-
vue.
|
|
3235
|
+
__props.renderListItem ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
|
|
3236
|
+
vue.createVNode(vue.unref(UserRender), {
|
|
3237
|
+
render: __props.renderListItem,
|
|
3238
|
+
user
|
|
3239
|
+
}, null, 8, ["render", "user"])
|
|
3240
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
|
|
3205
3241
|
vue.createElementVNode(
|
|
3206
3242
|
"span",
|
|
3207
3243
|
null,
|
|
@@ -3211,12 +3247,12 @@
|
|
|
3211
3247
|
),
|
|
3212
3248
|
user.tenantId !== __props.tenantId && user.tenantId && __props.tenants[user.tenantId] ? (vue.openBlock(), vue.createElementBlock(
|
|
3213
3249
|
"span",
|
|
3214
|
-
|
|
3250
|
+
_hoisted_7,
|
|
3215
3251
|
"@" + vue.toDisplayString(__props.tenants[user.tenantId]),
|
|
3216
3252
|
1
|
|
3217
3253
|
/* TEXT */
|
|
3218
3254
|
)) : vue.createCommentVNode("v-if", true)
|
|
3219
|
-
])
|
|
3255
|
+
]))
|
|
3220
3256
|
], 40, _hoisted_4$1);
|
|
3221
3257
|
}),
|
|
3222
3258
|
128
|
|
@@ -3238,10 +3274,14 @@
|
|
|
3238
3274
|
};
|
|
3239
3275
|
}
|
|
3240
3276
|
});
|
|
3241
|
-
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
3242
|
-
const _hoisted_1$3 = {
|
|
3243
|
-
const _hoisted_2$2 = {
|
|
3244
|
-
|
|
3277
|
+
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-a1278ff6"]]);
|
|
3278
|
+
const _hoisted_1$3 = { key: 0 };
|
|
3279
|
+
const _hoisted_2$2 = {
|
|
3280
|
+
key: 1,
|
|
3281
|
+
class: "tag-content"
|
|
3282
|
+
};
|
|
3283
|
+
const _hoisted_3$1 = { class: "user-name" };
|
|
3284
|
+
const _hoisted_4 = {
|
|
3245
3285
|
key: 0,
|
|
3246
3286
|
class: "tenant-name"
|
|
3247
3287
|
};
|
|
@@ -3256,7 +3296,8 @@
|
|
|
3256
3296
|
currentTenantId: {},
|
|
3257
3297
|
draggable: { type: Boolean },
|
|
3258
3298
|
active: { type: Boolean },
|
|
3259
|
-
showTenant: { type: Boolean }
|
|
3299
|
+
showTenant: { type: Boolean },
|
|
3300
|
+
renderTag: { type: Function }
|
|
3260
3301
|
},
|
|
3261
3302
|
emits: ["click", "close"],
|
|
3262
3303
|
setup(__props, { emit: __emit }) {
|
|
@@ -3275,22 +3316,27 @@
|
|
|
3275
3316
|
onClose: handleClose
|
|
3276
3317
|
}, {
|
|
3277
3318
|
default: vue.withCtx(() => [
|
|
3278
|
-
vue.
|
|
3319
|
+
_ctx.renderTag ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
|
|
3320
|
+
vue.createVNode(vue.unref(UserRender), {
|
|
3321
|
+
render: _ctx.renderTag,
|
|
3322
|
+
user: _ctx.user
|
|
3323
|
+
}, null, 8, ["render", "user"])
|
|
3324
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
|
|
3279
3325
|
vue.createElementVNode(
|
|
3280
3326
|
"span",
|
|
3281
|
-
|
|
3327
|
+
_hoisted_3$1,
|
|
3282
3328
|
vue.toDisplayString(_ctx.user.name),
|
|
3283
3329
|
1
|
|
3284
3330
|
/* TEXT */
|
|
3285
3331
|
),
|
|
3286
3332
|
_ctx.user.tenantId !== _ctx.currentTenantId && _ctx.user.tenantId ? (vue.openBlock(), vue.createElementBlock(
|
|
3287
3333
|
"span",
|
|
3288
|
-
|
|
3334
|
+
_hoisted_4,
|
|
3289
3335
|
" @" + vue.toDisplayString(_ctx.tenants[_ctx.user.tenantId]),
|
|
3290
3336
|
1
|
|
3291
3337
|
/* TEXT */
|
|
3292
3338
|
)) : vue.createCommentVNode("v-if", true)
|
|
3293
|
-
])
|
|
3339
|
+
]))
|
|
3294
3340
|
]),
|
|
3295
3341
|
_: 1
|
|
3296
3342
|
/* STABLE */
|
|
@@ -3298,10 +3344,10 @@
|
|
|
3298
3344
|
};
|
|
3299
3345
|
}
|
|
3300
3346
|
});
|
|
3301
|
-
const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
3347
|
+
const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7099192b"]]);
|
|
3302
3348
|
const _hoisted_1$2 = ["onClick"];
|
|
3303
3349
|
const _hoisted_2$1 = ["placeholder"];
|
|
3304
|
-
const _hoisted_3
|
|
3350
|
+
const _hoisted_3 = ["placeholder"];
|
|
3305
3351
|
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
3306
3352
|
...{
|
|
3307
3353
|
name: "BkUserSelectorMultiple"
|
|
@@ -3350,6 +3396,9 @@
|
|
|
3350
3396
|
const options = vue.computed(() => {
|
|
3351
3397
|
return searchResults.value.filter((user) => !props.selectedUsers.some((selectedUser) => selectedUser.id === user.id));
|
|
3352
3398
|
});
|
|
3399
|
+
const userGroupFilter = vue.computed(() => {
|
|
3400
|
+
return props.userGroup.filter((group) => !props.selectedUsers.some((user) => user.id === group.id) && !group.hidden);
|
|
3401
|
+
});
|
|
3353
3402
|
const initSortable = () => {
|
|
3354
3403
|
if (!props.draggable || !sortableContainerRef.value) return;
|
|
3355
3404
|
if (sortableInstance.value) {
|
|
@@ -3439,7 +3488,7 @@
|
|
|
3439
3488
|
if (!isFocused.value) {
|
|
3440
3489
|
isFocused.value = true;
|
|
3441
3490
|
}
|
|
3442
|
-
if (searchQuery.value.length >=
|
|
3491
|
+
if (searchQuery.value.length >= 1) {
|
|
3443
3492
|
showDropdown.value = true;
|
|
3444
3493
|
}
|
|
3445
3494
|
};
|
|
@@ -3608,11 +3657,12 @@
|
|
|
3608
3657
|
active: index === activeTagIndex.value,
|
|
3609
3658
|
"current-tenant-id": _ctx.tenantId,
|
|
3610
3659
|
draggable: _ctx.draggable,
|
|
3660
|
+
"render-tag": _ctx.renderTag,
|
|
3611
3661
|
tenants: _ctx.tenants,
|
|
3612
3662
|
user,
|
|
3613
3663
|
onClick: ($event) => handleTagClick(index),
|
|
3614
3664
|
onClose: ($event) => removeUser(user)
|
|
3615
|
-
}, null, 8, ["active", "current-tenant-id", "draggable", "tenants", "user", "onClick", "onClose"]),
|
|
3665
|
+
}, null, 8, ["active", "current-tenant-id", "draggable", "render-tag", "tenants", "user", "onClick", "onClose"]),
|
|
3616
3666
|
vue.createCommentVNode(" 在当前激活标签后插入输入框 "),
|
|
3617
3667
|
index === activeTagIndex.value && activeTagIndex.value !== _ctx.selectedUsers.length - 1 ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
|
|
3618
3668
|
"input",
|
|
@@ -3688,12 +3738,13 @@
|
|
|
3688
3738
|
return vue.openBlock(), vue.createBlock(UserTag, {
|
|
3689
3739
|
"current-tenant-id": _ctx.tenantId,
|
|
3690
3740
|
key: user.id,
|
|
3741
|
+
"render-tag": _ctx.renderTag,
|
|
3691
3742
|
"show-tenant": true,
|
|
3692
3743
|
tenants: _ctx.tenants,
|
|
3693
3744
|
user,
|
|
3694
3745
|
onClick: handleFocus,
|
|
3695
3746
|
onClose: ($event) => removeUser(user)
|
|
3696
|
-
}, null, 8, ["current-tenant-id", "tenants", "user", "onClose"]);
|
|
3747
|
+
}, null, 8, ["current-tenant-id", "render-tag", "tenants", "user", "onClose"]);
|
|
3697
3748
|
}),
|
|
3698
3749
|
128
|
|
3699
3750
|
/* KEYED_FRAGMENT */
|
|
@@ -3726,7 +3777,7 @@
|
|
|
3726
3777
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(searchQuery) ? searchQuery.value = $event : null),
|
|
3727
3778
|
placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
|
|
3728
3779
|
onFocus: handleFocus
|
|
3729
|
-
}, null, 40, _hoisted_3
|
|
3780
|
+
}, null, 40, _hoisted_3), [
|
|
3730
3781
|
[vue.vModelText, vue.unref(searchQuery)]
|
|
3731
3782
|
]),
|
|
3732
3783
|
vue.createCommentVNode(' 未聚焦状态下的"我"标签 '),
|
|
@@ -3750,14 +3801,15 @@
|
|
|
3750
3801
|
"is-show": showDropdown.value,
|
|
3751
3802
|
loading: vue.unref(searchLoading),
|
|
3752
3803
|
options: options.value,
|
|
3804
|
+
"render-list-item": _ctx.renderListItem,
|
|
3753
3805
|
"search-query": vue.unref(searchQuery),
|
|
3754
3806
|
"tenant-id": _ctx.tenantId,
|
|
3755
3807
|
tenants: _ctx.tenants,
|
|
3756
|
-
"user-group":
|
|
3808
|
+
"user-group": userGroupFilter.value,
|
|
3757
3809
|
"user-group-name": _ctx.userGroupName,
|
|
3758
3810
|
onClickoutside: handleClickOutside,
|
|
3759
3811
|
onSelectUser: addUser
|
|
3760
|
-
}, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
3812
|
+
}, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
3761
3813
|
],
|
|
3762
3814
|
512
|
|
3763
3815
|
/* NEED_PATCH */
|
|
@@ -3765,21 +3817,9 @@
|
|
|
3765
3817
|
};
|
|
3766
3818
|
}
|
|
3767
3819
|
});
|
|
3768
|
-
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
3769
|
-
const _withScopeId = (n) => (vue.pushScopeId("data-v-5040d42f"), n = n(), vue.popScopeId(), n);
|
|
3820
|
+
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d4f489c3"]]);
|
|
3770
3821
|
const _hoisted_1$1 = { class: "input-container" };
|
|
3771
|
-
const _hoisted_2 =
|
|
3772
|
-
key: 0,
|
|
3773
|
-
class: "tenant-name"
|
|
3774
|
-
};
|
|
3775
|
-
const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode(
|
|
3776
|
-
"i",
|
|
3777
|
-
{ class: "close-icon" },
|
|
3778
|
-
"×",
|
|
3779
|
-
-1
|
|
3780
|
-
/* HOISTED */
|
|
3781
|
-
));
|
|
3782
|
-
const _hoisted_4 = ["placeholder"];
|
|
3822
|
+
const _hoisted_2 = ["placeholder"];
|
|
3783
3823
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
3784
3824
|
...{
|
|
3785
3825
|
name: "BkUserSelectorSingle"
|
|
@@ -3810,6 +3850,9 @@
|
|
|
3810
3850
|
const selectedUser = vue.ref(props.modelValue || "");
|
|
3811
3851
|
const searchQuery = vue.ref("");
|
|
3812
3852
|
const showDropdown = vue.ref(false);
|
|
3853
|
+
const userGroupFilter = vue.computed(() => {
|
|
3854
|
+
return props.userGroup.filter((group) => group.id !== selectedUser.value && !group.hidden);
|
|
3855
|
+
});
|
|
3813
3856
|
const selectedUserInfo = vue.computed(() => {
|
|
3814
3857
|
const userGroup = (props.userGroup || []).map((group) => ({
|
|
3815
3858
|
...group,
|
|
@@ -3858,7 +3901,7 @@
|
|
|
3858
3901
|
}
|
|
3859
3902
|
};
|
|
3860
3903
|
const fetchUsers = async (keyword = "") => {
|
|
3861
|
-
if (!keyword
|
|
3904
|
+
if (!(keyword == null ? void 0 : keyword.length)) {
|
|
3862
3905
|
options.value = [];
|
|
3863
3906
|
return;
|
|
3864
3907
|
}
|
|
@@ -3883,13 +3926,13 @@
|
|
|
3883
3926
|
searchQuery.value = "";
|
|
3884
3927
|
};
|
|
3885
3928
|
const handleInputFocus = () => {
|
|
3886
|
-
if (searchQuery.value.length >=
|
|
3929
|
+
if (searchQuery.value.length >= 1 || Array.isArray(props.userGroup) && props.userGroup.length > 0) {
|
|
3887
3930
|
showDropdown.value = true;
|
|
3888
3931
|
}
|
|
3889
3932
|
};
|
|
3890
3933
|
const handleInput = () => {
|
|
3891
3934
|
fetchUsers(searchQuery.value);
|
|
3892
|
-
showDropdown.value = searchQuery.value.length >=
|
|
3935
|
+
showDropdown.value = searchQuery.value.length >= 1;
|
|
3893
3936
|
};
|
|
3894
3937
|
const handleClickOutside = () => {
|
|
3895
3938
|
showDropdown.value = false;
|
|
@@ -3908,24 +3951,14 @@
|
|
|
3908
3951
|
vue.createCommentVNode(" 用户标签显示 "),
|
|
3909
3952
|
selectedUserInfo.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3910
3953
|
key: 0,
|
|
3911
|
-
class: "selected-user",
|
|
3912
3954
|
onClick: vue.withModifiers(removeSelectedUser, ["stop"])
|
|
3913
3955
|
}, [
|
|
3914
|
-
vue.
|
|
3915
|
-
"
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
),
|
|
3921
|
-
selectedUserInfo.value.tenantId !== _ctx.tenantId && selectedUserInfo.value.tenantId && _ctx.tenants[selectedUserInfo.value.tenantId] ? (vue.openBlock(), vue.createElementBlock(
|
|
3922
|
-
"span",
|
|
3923
|
-
_hoisted_2,
|
|
3924
|
-
"@" + vue.toDisplayString(_ctx.tenants[selectedUserInfo.value.tenantId]),
|
|
3925
|
-
1
|
|
3926
|
-
/* TEXT */
|
|
3927
|
-
)) : vue.createCommentVNode("v-if", true),
|
|
3928
|
-
_hoisted_3
|
|
3956
|
+
vue.createVNode(UserTag, {
|
|
3957
|
+
"render-tag": _ctx.renderTag,
|
|
3958
|
+
tenants: _ctx.tenants,
|
|
3959
|
+
user: selectedUserInfo.value,
|
|
3960
|
+
onClose: removeSelectedUser
|
|
3961
|
+
}, null, 8, ["render-tag", "tenants", "user"])
|
|
3929
3962
|
])) : vue.createCommentVNode("v-if", true),
|
|
3930
3963
|
vue.withDirectives(vue.createElementVNode("input", {
|
|
3931
3964
|
ref_key: "inputRef",
|
|
@@ -3935,7 +3968,7 @@
|
|
|
3935
3968
|
placeholder: selectedUserInfo.value ? "" : _ctx.placeholder,
|
|
3936
3969
|
onFocus: handleInputFocus,
|
|
3937
3970
|
onInput: handleInput
|
|
3938
|
-
}, null, 40,
|
|
3971
|
+
}, null, 40, _hoisted_2), [
|
|
3939
3972
|
[vue.vModelText, searchQuery.value]
|
|
3940
3973
|
]),
|
|
3941
3974
|
vue.createCommentVNode(' "我"标签 '),
|
|
@@ -3952,20 +3985,21 @@
|
|
|
3952
3985
|
"is-show": showDropdown.value,
|
|
3953
3986
|
loading: isLoading.value,
|
|
3954
3987
|
options: options.value,
|
|
3988
|
+
"render-list-item": _ctx.renderListItem,
|
|
3955
3989
|
"search-query": searchQuery.value,
|
|
3956
3990
|
"tenant-id": _ctx.tenantId,
|
|
3957
3991
|
tenants: _ctx.tenants,
|
|
3958
|
-
"user-group":
|
|
3992
|
+
"user-group": userGroupFilter.value,
|
|
3959
3993
|
"user-group-name": _ctx.userGroupName,
|
|
3960
3994
|
onSelectUser: addUser
|
|
3961
|
-
}, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
3995
|
+
}, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
3962
3996
|
])), [
|
|
3963
3997
|
[vue.unref(bkuiVue.clickoutside), handleClickOutside]
|
|
3964
3998
|
]);
|
|
3965
3999
|
};
|
|
3966
4000
|
}
|
|
3967
4001
|
});
|
|
3968
|
-
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
4002
|
+
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-91a75bba"]]);
|
|
3969
4003
|
const _hoisted_1 = {
|
|
3970
4004
|
ref: "containerRef",
|
|
3971
4005
|
class: "bk-user-selector"
|
package/vue3/vue3.css
CHANGED
|
@@ -24,70 +24,70 @@
|
|
|
24
24
|
background-color: #f0f1f5;
|
|
25
25
|
color: #c4c6cc;
|
|
26
26
|
cursor: not-allowed;
|
|
27
|
-
}.dropdown-content[data-v-
|
|
27
|
+
}.dropdown-content[data-v-a1278ff6] {
|
|
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-a1278ff6] {
|
|
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-a1278ff6] {
|
|
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-a1278ff6] {
|
|
45
45
|
margin-left: 4px;
|
|
46
46
|
}
|
|
47
|
-
.dropdown-content .user-option[data-v-
|
|
47
|
+
.dropdown-content .user-option[data-v-a1278ff6] {
|
|
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-a1278ff6]: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-a1278ff6] {
|
|
58
58
|
color: #f59500;
|
|
59
59
|
margin-left: 4px;
|
|
60
60
|
padding: 0 4px;
|
|
61
61
|
}.bk-user-selector-popover.bk-popover.bk-pop2-content {
|
|
62
62
|
padding: 0;
|
|
63
|
-
}.user-tag[data-v-
|
|
63
|
+
}.user-tag[data-v-7099192b] {
|
|
64
64
|
margin-right: 4px;
|
|
65
65
|
margin-left: 0;
|
|
66
66
|
}
|
|
67
|
-
.user-tag.draggable[data-v-
|
|
67
|
+
.user-tag.draggable[data-v-7099192b] {
|
|
68
68
|
cursor: move;
|
|
69
69
|
}
|
|
70
|
-
.user-tag.active[data-v-
|
|
70
|
+
.user-tag.active[data-v-7099192b] {
|
|
71
71
|
background-color: #e1ecff;
|
|
72
72
|
border-color: #3a84ff;
|
|
73
73
|
}
|
|
74
|
-
.user-tag .tag-content .user-name[data-v-
|
|
74
|
+
.user-tag .tag-content .user-name[data-v-7099192b] {
|
|
75
75
|
white-space: nowrap;
|
|
76
76
|
overflow: hidden;
|
|
77
77
|
text-overflow: ellipsis;
|
|
78
78
|
font-size: 12px;
|
|
79
79
|
}
|
|
80
|
-
.user-tag .tag-content .tenant-name[data-v-
|
|
80
|
+
.user-tag .tag-content .tenant-name[data-v-7099192b] {
|
|
81
81
|
color: #f59500;
|
|
82
82
|
margin-left: 3px;
|
|
83
83
|
white-space: nowrap;
|
|
84
84
|
padding: 0 3px;
|
|
85
85
|
border-radius: 2px;
|
|
86
|
-
}.multiple-selector[data-v-
|
|
86
|
+
}.multiple-selector[data-v-d4f489c3] {
|
|
87
87
|
position: relative;
|
|
88
88
|
width: 100%;
|
|
89
89
|
}
|
|
90
|
-
.multiple-selector .tags-container[data-v-
|
|
90
|
+
.multiple-selector .tags-container[data-v-d4f489c3] {
|
|
91
91
|
min-height: 32px;
|
|
92
92
|
border: 1px solid #dcdee5;
|
|
93
93
|
border-radius: 2px;
|
|
@@ -95,46 +95,46 @@
|
|
|
95
95
|
transition: all 0.2s ease;
|
|
96
96
|
background-color: #fff;
|
|
97
97
|
}
|
|
98
|
-
.multiple-selector .tags-container.focused[data-v-
|
|
98
|
+
.multiple-selector .tags-container.focused[data-v-d4f489c3] {
|
|
99
99
|
border-color: #3a84ff;
|
|
100
100
|
box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);
|
|
101
101
|
}
|
|
102
|
-
.multiple-selector .tags-container.collapsed[data-v-
|
|
102
|
+
.multiple-selector .tags-container.collapsed[data-v-d4f489c3] {
|
|
103
103
|
display: flex;
|
|
104
104
|
flex-wrap: wrap;
|
|
105
105
|
align-items: center;
|
|
106
106
|
}
|
|
107
|
-
.multiple-selector .tag-list[data-v-
|
|
107
|
+
.multiple-selector .tag-list[data-v-d4f489c3] {
|
|
108
108
|
display: flex;
|
|
109
109
|
flex-wrap: wrap;
|
|
110
110
|
align-items: center;
|
|
111
111
|
}
|
|
112
|
-
.multiple-selector .tag-wrapper[data-v-
|
|
112
|
+
.multiple-selector .tag-wrapper[data-v-d4f489c3] {
|
|
113
113
|
display: inline-flex;
|
|
114
114
|
align-items: center;
|
|
115
115
|
max-width: 100%;
|
|
116
116
|
}
|
|
117
|
-
.multiple-selector .search-input[data-v-
|
|
117
|
+
.multiple-selector .search-input[data-v-d4f489c3] {
|
|
118
118
|
outline: none;
|
|
119
119
|
border: none;
|
|
120
120
|
height: 28px;
|
|
121
121
|
min-width: 10px;
|
|
122
122
|
background: transparent;
|
|
123
123
|
}
|
|
124
|
-
.multiple-selector .search-input[data-v-
|
|
124
|
+
.multiple-selector .search-input[data-v-d4f489c3]::placeholder {
|
|
125
125
|
color: #c4c6cc;
|
|
126
126
|
}
|
|
127
|
-
.multiple-selector .search-input.inline[data-v-
|
|
127
|
+
.multiple-selector .search-input.inline[data-v-d4f489c3] {
|
|
128
128
|
min-width: 10px;
|
|
129
129
|
}
|
|
130
|
-
.multiple-selector .search-input.last[data-v-
|
|
130
|
+
.multiple-selector .search-input.last[data-v-d4f489c3], .multiple-selector .search-input.collapsed[data-v-d4f489c3] {
|
|
131
131
|
flex: 1;
|
|
132
132
|
min-width: 60px;
|
|
133
|
-
}.single-selector[data-v-
|
|
133
|
+
}.single-selector[data-v-91a75bba] {
|
|
134
134
|
position: relative;
|
|
135
135
|
width: 100%;
|
|
136
136
|
}
|
|
137
|
-
.input-container[data-v-
|
|
137
|
+
.input-container[data-v-91a75bba] {
|
|
138
138
|
position: relative;
|
|
139
139
|
display: flex;
|
|
140
140
|
align-items: center;
|
|
@@ -144,38 +144,19 @@
|
|
|
144
144
|
padding: 0 8px;
|
|
145
145
|
background-color: #fff;
|
|
146
146
|
}
|
|
147
|
-
.input-container[data-v-
|
|
147
|
+
.input-container[data-v-91a75bba]:focus-within {
|
|
148
148
|
border-color: #3a84ff;
|
|
149
149
|
box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);
|
|
150
150
|
}
|
|
151
|
-
.search-input[data-v-
|
|
151
|
+
.search-input[data-v-91a75bba] {
|
|
152
152
|
flex: 1;
|
|
153
153
|
outline: none;
|
|
154
154
|
border: none;
|
|
155
155
|
height: 30px;
|
|
156
156
|
background: transparent;
|
|
157
157
|
}
|
|
158
|
-
.search-input[data-v-
|
|
158
|
+
.search-input[data-v-91a75bba]::placeholder {
|
|
159
159
|
color: #c4c6cc;
|
|
160
|
-
}
|
|
161
|
-
.selected-user[data-v-5040d42f] {
|
|
162
|
-
display: inline-flex;
|
|
163
|
-
align-items: center;
|
|
164
|
-
background-color: #f0f1f5;
|
|
165
|
-
border-radius: 2px;
|
|
166
|
-
padding: 0 8px;
|
|
167
|
-
margin-right: 8px;
|
|
168
|
-
height: 24px;
|
|
169
|
-
max-width: calc(100% - 32px);
|
|
170
|
-
}
|
|
171
|
-
.selected-user .tenant-name[data-v-5040d42f] {
|
|
172
|
-
color: #f59500;
|
|
173
|
-
margin-left: 4px;
|
|
174
|
-
}
|
|
175
|
-
.selected-user .close-icon[data-v-5040d42f] {
|
|
176
|
-
margin-left: 4px;
|
|
177
|
-
cursor: pointer;
|
|
178
|
-
font-style: normal;
|
|
179
160
|
}.bk-user-selector[data-v-c23f5bc9] {
|
|
180
161
|
width: 100%;
|
|
181
162
|
position: relative;
|