@blueking/bk-user-selector 0.0.6 → 0.0.7
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 +24 -0
- package/package.json +1 -1
- package/typings/components/me-tag.vue.d.ts +39 -0
- package/typings/components/multiple-selector.vue.d.ts +40 -1
- package/typings/components/selection-popover.vue.d.ts +154 -0
- package/typings/components/user-selector.vue.d.ts +10 -1
- package/typings/types/index.d.ts +36 -39
- package/vue2/index.es.min.js +362 -203
- package/vue2/index.iife.min.js +362 -203
- package/vue2/index.umd.min.js +362 -203
- package/vue2/vue2.css +82 -128
- package/vue3/index.es.min.js +363 -204
- package/vue3/index.iife.min.js +362 -203
- package/vue3/index.umd.min.js +362 -203
- package/vue3/vue3.css +82 -128
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 = ".
|
|
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-c68dfcac] {\n min-height: 40px;\n max-height: 300px;\n overflow-y: auto;\n padding: 5px 0;\n}\n.dropdown-content .no-data[data-v-c68dfcac] {\n padding: 10px;\n text-align: center;\n color: #979ba5;\n}\n.dropdown-content .user-group .group-header[data-v-c68dfcac] {\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-c68dfcac] {\n margin-left: 4px;\n}\n.dropdown-content .user-option[data-v-c68dfcac] {\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-c68dfcac]:hover {\n background-color: #f5f7fa;\n}\n.dropdown-content .user-option .tenant-name[data-v-c68dfcac] {\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-a8dc735f] {\n position: relative;\n width: 100%;\n}\n.multiple-selector .tags-container[data-v-a8dc735f] {\n min-height: 32px;\n border: 1px solid #dcdee5;\n border-radius: 2px;\n padding: 1px 4px;\n transition: all 0.2s ease;\n background-color: #fff;\n}\n.multiple-selector .tags-container.focused[data-v-a8dc735f] {\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-a8dc735f] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-list[data-v-a8dc735f] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-wrapper[data-v-a8dc735f] {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n}\n.multiple-selector .search-input[data-v-a8dc735f] {\n outline: none;\n border: none;\n height: 28px;\n min-width: 10px;\n background: transparent;\n}\n.multiple-selector .search-input[data-v-a8dc735f]::placeholder {\n color: #c4c6cc;\n}\n.multiple-selector .search-input.inline[data-v-a8dc735f] {\n min-width: 10px;\n}\n.multiple-selector .search-input.last[data-v-a8dc735f], .multiple-selector .search-input.collapsed[data-v-a8dc735f] {\n flex: 1;\n min-width: 60px;\n}.single-selector[data-v-8b8dd0fd] {\n position: relative;\n width: 100%;\n}\n.input-container[data-v-8b8dd0fd] {\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-8b8dd0fd]: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-8b8dd0fd] {\n flex: 1;\n outline: none;\n border: none;\n height: 30px;\n background: transparent;\n}\n.search-input[data-v-8b8dd0fd]::placeholder {\n color: #c4c6cc;\n}\n.selected-user[data-v-8b8dd0fd] {\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-8b8dd0fd] {\n color: #f59500;\n margin-left: 4px;\n}\n.selected-user .close-icon[data-v-8b8dd0fd] {\n margin-left: 4px;\n cursor: pointer;\n font-style: normal;\n}.bk-user-selector[data-v-bc7b4ccd] {\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) {
|
|
@@ -2965,6 +2965,270 @@
|
|
|
2965
2965
|
clearSearch
|
|
2966
2966
|
};
|
|
2967
2967
|
};
|
|
2968
|
+
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
2969
|
+
...{
|
|
2970
|
+
name: "MeTag"
|
|
2971
|
+
},
|
|
2972
|
+
__name: "me-tag",
|
|
2973
|
+
props: {
|
|
2974
|
+
/**
|
|
2975
|
+
* 当前用户ID
|
|
2976
|
+
*/
|
|
2977
|
+
currentUserId: {
|
|
2978
|
+
type: String,
|
|
2979
|
+
default: ""
|
|
2980
|
+
},
|
|
2981
|
+
/**
|
|
2982
|
+
* 是否禁用
|
|
2983
|
+
*/
|
|
2984
|
+
isDisabled: {
|
|
2985
|
+
type: Boolean,
|
|
2986
|
+
default: false
|
|
2987
|
+
}
|
|
2988
|
+
},
|
|
2989
|
+
emits: ["click"],
|
|
2990
|
+
setup(__props, { emit: __emit }) {
|
|
2991
|
+
const props = __props;
|
|
2992
|
+
const emit = __emit;
|
|
2993
|
+
const handleClick = () => {
|
|
2994
|
+
if (props.isDisabled) return;
|
|
2995
|
+
emit("click");
|
|
2996
|
+
};
|
|
2997
|
+
return (_ctx, _cache) => {
|
|
2998
|
+
return __props.currentUserId ? (vue.openBlock(), vue.createElementBlock(
|
|
2999
|
+
"div",
|
|
3000
|
+
{
|
|
3001
|
+
key: 0,
|
|
3002
|
+
class: vue.normalizeClass(["me-tag", { disabled: __props.isDisabled }]),
|
|
3003
|
+
onClick: vue.withModifiers(handleClick, ["stop"])
|
|
3004
|
+
},
|
|
3005
|
+
" 我 ",
|
|
3006
|
+
2
|
|
3007
|
+
/* CLASS */
|
|
3008
|
+
)) : vue.createCommentVNode("v-if", true);
|
|
3009
|
+
};
|
|
3010
|
+
}
|
|
3011
|
+
});
|
|
3012
|
+
const _export_sfc = (sfc, props) => {
|
|
3013
|
+
const target = sfc.__vccOpts || sfc;
|
|
3014
|
+
for (const [key, val] of props) {
|
|
3015
|
+
target[key] = val;
|
|
3016
|
+
}
|
|
3017
|
+
return target;
|
|
3018
|
+
};
|
|
3019
|
+
const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-887b7c44"]]);
|
|
3020
|
+
const _hoisted_1$4 = {
|
|
3021
|
+
key: 0,
|
|
3022
|
+
class: "no-data"
|
|
3023
|
+
};
|
|
3024
|
+
const _hoisted_2$3 = { class: "group-name" };
|
|
3025
|
+
const _hoisted_3$3 = { class: "group-count" };
|
|
3026
|
+
const _hoisted_4$1 = ["onMousedown"];
|
|
3027
|
+
const _hoisted_5 = {
|
|
3028
|
+
key: 0,
|
|
3029
|
+
class: "tenant-name"
|
|
3030
|
+
};
|
|
3031
|
+
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
3032
|
+
...{
|
|
3033
|
+
name: "SelectionPopover"
|
|
3034
|
+
},
|
|
3035
|
+
__name: "selection-popover",
|
|
3036
|
+
props: {
|
|
3037
|
+
/**
|
|
3038
|
+
* 是否显示下拉菜单
|
|
3039
|
+
*/
|
|
3040
|
+
isShow: {
|
|
3041
|
+
type: Boolean,
|
|
3042
|
+
default: false
|
|
3043
|
+
},
|
|
3044
|
+
/**
|
|
3045
|
+
* 容器宽度
|
|
3046
|
+
*/
|
|
3047
|
+
containerWidth: {
|
|
3048
|
+
type: [Number, String],
|
|
3049
|
+
default: "auto"
|
|
3050
|
+
},
|
|
3051
|
+
/**
|
|
3052
|
+
* 是否加载中
|
|
3053
|
+
*/
|
|
3054
|
+
loading: {
|
|
3055
|
+
type: Boolean,
|
|
3056
|
+
default: false
|
|
3057
|
+
},
|
|
3058
|
+
/**
|
|
3059
|
+
* 搜索结果选项
|
|
3060
|
+
*/
|
|
3061
|
+
options: {
|
|
3062
|
+
type: Array,
|
|
3063
|
+
default: () => []
|
|
3064
|
+
},
|
|
3065
|
+
/**
|
|
3066
|
+
* 搜索关键词
|
|
3067
|
+
*/
|
|
3068
|
+
searchQuery: {
|
|
3069
|
+
type: String,
|
|
3070
|
+
default: ""
|
|
3071
|
+
},
|
|
3072
|
+
/**
|
|
3073
|
+
* 当前租户ID
|
|
3074
|
+
*/
|
|
3075
|
+
tenantId: {
|
|
3076
|
+
type: String,
|
|
3077
|
+
default: ""
|
|
3078
|
+
},
|
|
3079
|
+
/**
|
|
3080
|
+
* 租户信息映射
|
|
3081
|
+
*/
|
|
3082
|
+
tenants: {
|
|
3083
|
+
type: Object,
|
|
3084
|
+
default: () => ({})
|
|
3085
|
+
},
|
|
3086
|
+
/**
|
|
3087
|
+
* 用户组
|
|
3088
|
+
*/
|
|
3089
|
+
userGroup: {
|
|
3090
|
+
type: Array,
|
|
3091
|
+
default: () => []
|
|
3092
|
+
},
|
|
3093
|
+
/**
|
|
3094
|
+
* 用户组名称
|
|
3095
|
+
*/
|
|
3096
|
+
userGroupName: {
|
|
3097
|
+
type: String,
|
|
3098
|
+
default: "用户群组"
|
|
3099
|
+
}
|
|
3100
|
+
},
|
|
3101
|
+
emits: ["select-user"],
|
|
3102
|
+
setup(__props, { emit: __emit }) {
|
|
3103
|
+
const props = __props;
|
|
3104
|
+
const emit = __emit;
|
|
3105
|
+
const groupedUsers = vue.computed(() => {
|
|
3106
|
+
const groups = {};
|
|
3107
|
+
console.log("props.options", props.options);
|
|
3108
|
+
if (Array.isArray(props.userGroup) && props.userGroup.length > 0) {
|
|
3109
|
+
groups[props.userGroupName] = props.userGroup.map((group) => ({
|
|
3110
|
+
id: group.id,
|
|
3111
|
+
name: group.name,
|
|
3112
|
+
tenantId: ""
|
|
3113
|
+
}));
|
|
3114
|
+
}
|
|
3115
|
+
props.options.forEach((user) => {
|
|
3116
|
+
const groupName = user.data_source_type === "real" ? "用户" : "虚拟账号";
|
|
3117
|
+
if (!groups[groupName]) {
|
|
3118
|
+
groups[groupName] = [];
|
|
3119
|
+
}
|
|
3120
|
+
groups[groupName].push(user);
|
|
3121
|
+
});
|
|
3122
|
+
return groups;
|
|
3123
|
+
});
|
|
3124
|
+
const selectUser = (user) => {
|
|
3125
|
+
emit("select-user", user);
|
|
3126
|
+
};
|
|
3127
|
+
return (_ctx, _cache) => {
|
|
3128
|
+
return vue.openBlock(), vue.createBlock(vue.unref(bkuiVue.Popover), {
|
|
3129
|
+
"ext-cls": "bk-user-selector-popover",
|
|
3130
|
+
arrow: false,
|
|
3131
|
+
"is-show": __props.isShow,
|
|
3132
|
+
width: __props.containerWidth,
|
|
3133
|
+
placement: "bottom-start",
|
|
3134
|
+
theme: "light",
|
|
3135
|
+
trigger: "manual"
|
|
3136
|
+
}, {
|
|
3137
|
+
content: vue.withCtx(() => [
|
|
3138
|
+
vue.createVNode(vue.unref(bkuiVue.Loading), {
|
|
3139
|
+
class: "dropdown-content",
|
|
3140
|
+
loading: __props.loading,
|
|
3141
|
+
size: "mini",
|
|
3142
|
+
mode: "spin"
|
|
3143
|
+
}, {
|
|
3144
|
+
default: vue.withCtx(() => [
|
|
3145
|
+
__props.options.length === 0 && __props.userGroup.length === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
|
|
3146
|
+
vue.createElementVNode(
|
|
3147
|
+
"span",
|
|
3148
|
+
null,
|
|
3149
|
+
vue.toDisplayString(__props.searchQuery.length > 1 ? "未找到匹配用户" : "请输入关键词搜索"),
|
|
3150
|
+
1
|
|
3151
|
+
/* TEXT */
|
|
3152
|
+
)
|
|
3153
|
+
])) : (vue.openBlock(true), vue.createElementBlock(
|
|
3154
|
+
vue.Fragment,
|
|
3155
|
+
{ key: 1 },
|
|
3156
|
+
vue.renderList(groupedUsers.value, (group, groupName) => {
|
|
3157
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3158
|
+
class: "user-group",
|
|
3159
|
+
key: groupName
|
|
3160
|
+
}, [
|
|
3161
|
+
vue.createElementVNode(
|
|
3162
|
+
"div",
|
|
3163
|
+
{
|
|
3164
|
+
class: "group-header",
|
|
3165
|
+
onMousedown: _cache[0] || (_cache[0] = vue.withModifiers(() => {
|
|
3166
|
+
}, ["prevent"]))
|
|
3167
|
+
},
|
|
3168
|
+
[
|
|
3169
|
+
vue.createElementVNode(
|
|
3170
|
+
"span",
|
|
3171
|
+
_hoisted_2$3,
|
|
3172
|
+
vue.toDisplayString(groupName),
|
|
3173
|
+
1
|
|
3174
|
+
/* TEXT */
|
|
3175
|
+
),
|
|
3176
|
+
vue.createElementVNode(
|
|
3177
|
+
"span",
|
|
3178
|
+
_hoisted_3$3,
|
|
3179
|
+
"(" + vue.toDisplayString(group.length) + ")",
|
|
3180
|
+
1
|
|
3181
|
+
/* TEXT */
|
|
3182
|
+
)
|
|
3183
|
+
],
|
|
3184
|
+
32
|
|
3185
|
+
/* NEED_HYDRATION */
|
|
3186
|
+
),
|
|
3187
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
3188
|
+
vue.Fragment,
|
|
3189
|
+
null,
|
|
3190
|
+
vue.renderList(group, (user) => {
|
|
3191
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3192
|
+
class: "user-option",
|
|
3193
|
+
key: user.id,
|
|
3194
|
+
onMousedown: vue.withModifiers(($event) => selectUser(user), ["prevent"])
|
|
3195
|
+
}, [
|
|
3196
|
+
vue.createElementVNode(
|
|
3197
|
+
"span",
|
|
3198
|
+
null,
|
|
3199
|
+
vue.toDisplayString(user.name),
|
|
3200
|
+
1
|
|
3201
|
+
/* TEXT */
|
|
3202
|
+
),
|
|
3203
|
+
user.tenantId !== __props.tenantId && user.tenantId && __props.tenants[user.tenantId] ? (vue.openBlock(), vue.createElementBlock(
|
|
3204
|
+
"span",
|
|
3205
|
+
_hoisted_5,
|
|
3206
|
+
"@" + vue.toDisplayString(__props.tenants[user.tenantId]),
|
|
3207
|
+
1
|
|
3208
|
+
/* TEXT */
|
|
3209
|
+
)) : vue.createCommentVNode("v-if", true)
|
|
3210
|
+
], 40, _hoisted_4$1);
|
|
3211
|
+
}),
|
|
3212
|
+
128
|
|
3213
|
+
/* KEYED_FRAGMENT */
|
|
3214
|
+
))
|
|
3215
|
+
]);
|
|
3216
|
+
}),
|
|
3217
|
+
128
|
|
3218
|
+
/* KEYED_FRAGMENT */
|
|
3219
|
+
))
|
|
3220
|
+
]),
|
|
3221
|
+
_: 1
|
|
3222
|
+
/* STABLE */
|
|
3223
|
+
}, 8, ["loading"])
|
|
3224
|
+
]),
|
|
3225
|
+
_: 1
|
|
3226
|
+
/* STABLE */
|
|
3227
|
+
}, 8, ["is-show", "width"]);
|
|
3228
|
+
};
|
|
3229
|
+
}
|
|
3230
|
+
});
|
|
3231
|
+
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-c68dfcac"]]);
|
|
2968
3232
|
const _hoisted_1$3 = { class: "tag-content" };
|
|
2969
3233
|
const _hoisted_2$2 = { class: "user-name" };
|
|
2970
3234
|
const _hoisted_3$2 = {
|
|
@@ -3024,26 +3288,10 @@
|
|
|
3024
3288
|
};
|
|
3025
3289
|
}
|
|
3026
3290
|
});
|
|
3027
|
-
const _export_sfc = (sfc, props) => {
|
|
3028
|
-
const target = sfc.__vccOpts || sfc;
|
|
3029
|
-
for (const [key, val] of props) {
|
|
3030
|
-
target[key] = val;
|
|
3031
|
-
}
|
|
3032
|
-
return target;
|
|
3033
|
-
};
|
|
3034
3291
|
const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-203c36cb"]]);
|
|
3035
3292
|
const _hoisted_1$2 = ["onClick"];
|
|
3036
3293
|
const _hoisted_2$1 = ["placeholder"];
|
|
3037
3294
|
const _hoisted_3$1 = ["placeholder"];
|
|
3038
|
-
const _hoisted_4$1 = {
|
|
3039
|
-
key: 0,
|
|
3040
|
-
class: "no-data"
|
|
3041
|
-
};
|
|
3042
|
-
const _hoisted_5$1 = ["onMousedown"];
|
|
3043
|
-
const _hoisted_6$1 = {
|
|
3044
|
-
key: 0,
|
|
3045
|
-
class: "tenant-name"
|
|
3046
|
-
};
|
|
3047
3295
|
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
3048
3296
|
...{
|
|
3049
3297
|
name: "BkUserSelectorMultiple"
|
|
@@ -3112,6 +3360,20 @@
|
|
|
3112
3360
|
exactSearchKey: {
|
|
3113
3361
|
type: String,
|
|
3114
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: "用户群组"
|
|
3115
3377
|
}
|
|
3116
3378
|
},
|
|
3117
3379
|
emits: ["update:selectedUsers", "add-user", "remove-user"],
|
|
@@ -3137,6 +3399,9 @@
|
|
|
3137
3399
|
const sortableInstance = vue.ref(null);
|
|
3138
3400
|
const visibleUsers = vue.ref([]);
|
|
3139
3401
|
const hiddenCount = vue.ref(0);
|
|
3402
|
+
const options = vue.computed(() => {
|
|
3403
|
+
return searchResults.value.filter((user) => !props.selectedUsers.some((selectedUser) => selectedUser.id === user.id));
|
|
3404
|
+
});
|
|
3140
3405
|
const initSortable = () => {
|
|
3141
3406
|
if (!props.draggable || !sortableContainerRef.value) return;
|
|
3142
3407
|
if (sortableInstance.value) {
|
|
@@ -3174,7 +3439,11 @@
|
|
|
3174
3439
|
};
|
|
3175
3440
|
const handleFocus = () => {
|
|
3176
3441
|
isFocused.value = true;
|
|
3177
|
-
|
|
3442
|
+
if (props.userGroup.length > 0) {
|
|
3443
|
+
showDropdown.value = true;
|
|
3444
|
+
} else {
|
|
3445
|
+
showDropdown.value = false;
|
|
3446
|
+
}
|
|
3178
3447
|
activeTagIndex.value = -1;
|
|
3179
3448
|
vue.nextTick(() => {
|
|
3180
3449
|
if (lastInputRef.value) {
|
|
@@ -3425,17 +3694,11 @@
|
|
|
3425
3694
|
[vue.vModelText, vue.unref(searchQuery)]
|
|
3426
3695
|
]) : vue.createCommentVNode("v-if", true),
|
|
3427
3696
|
vue.createCommentVNode(' "我"标签 '),
|
|
3428
|
-
|
|
3429
|
-
"
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => addCurrentUser(), ["stop"]))
|
|
3434
|
-
},
|
|
3435
|
-
" 我 ",
|
|
3436
|
-
2
|
|
3437
|
-
/* CLASS */
|
|
3438
|
-
)) : vue.createCommentVNode("v-if", true)
|
|
3697
|
+
vue.createVNode(MeTag, {
|
|
3698
|
+
"current-user-id": __props.currentUserId,
|
|
3699
|
+
"is-disabled": !!__props.currentUserId && __props.selectedUsers.some((user) => user.id === __props.currentUserId),
|
|
3700
|
+
onClick: addCurrentUser
|
|
3701
|
+
}, null, 8, ["current-user-id", "is-disabled"])
|
|
3439
3702
|
],
|
|
3440
3703
|
512
|
|
3441
3704
|
/* NEED_PATCH */
|
|
@@ -3494,24 +3757,18 @@
|
|
|
3494
3757
|
ref_key: "collapsedInputRef",
|
|
3495
3758
|
ref: collapsedInputRef,
|
|
3496
3759
|
class: "search-input collapsed",
|
|
3497
|
-
"onUpdate:modelValue": _cache[
|
|
3760
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(searchQuery) ? searchQuery.value = $event : null),
|
|
3498
3761
|
placeholder: !__props.selectedUsers.length ? __props.placeholder : "",
|
|
3499
3762
|
onFocus: handleFocus
|
|
3500
3763
|
}, null, 40, _hoisted_3$1), [
|
|
3501
3764
|
[vue.vModelText, vue.unref(searchQuery)]
|
|
3502
3765
|
]),
|
|
3503
3766
|
vue.createCommentVNode(' 未聚焦状态下的"我"标签 '),
|
|
3504
|
-
|
|
3505
|
-
"
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => addCurrentUser(), ["stop"]))
|
|
3510
|
-
},
|
|
3511
|
-
" 我 ",
|
|
3512
|
-
2
|
|
3513
|
-
/* CLASS */
|
|
3514
|
-
)) : vue.createCommentVNode("v-if", true)
|
|
3767
|
+
vue.createVNode(MeTag, {
|
|
3768
|
+
"current-user-id": __props.currentUserId,
|
|
3769
|
+
"is-disabled": !!__props.currentUserId && __props.selectedUsers.some((user) => user[props.exactSearchKey] === __props.currentUserId),
|
|
3770
|
+
onClick: addCurrentUser
|
|
3771
|
+
}, null, 8, ["current-user-id", "is-disabled"])
|
|
3515
3772
|
],
|
|
3516
3773
|
512
|
|
3517
3774
|
/* NEED_PATCH */
|
|
@@ -3521,75 +3778,26 @@
|
|
|
3521
3778
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
3522
3779
|
)),
|
|
3523
3780
|
vue.createCommentVNode(" 下拉选项列表 "),
|
|
3524
|
-
vue.createVNode(
|
|
3525
|
-
"
|
|
3526
|
-
arrow: false,
|
|
3781
|
+
vue.createVNode(SelectionPopover, {
|
|
3782
|
+
"container-width": containerRef.value ? containerRef.value.offsetWidth : "auto",
|
|
3527
3783
|
"is-show": showDropdown.value,
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
size: "mini",
|
|
3538
|
-
mode: "spin"
|
|
3539
|
-
}, {
|
|
3540
|
-
default: vue.withCtx(() => [
|
|
3541
|
-
vue.unref(searchResults).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [
|
|
3542
|
-
vue.createElementVNode(
|
|
3543
|
-
"span",
|
|
3544
|
-
null,
|
|
3545
|
-
vue.toDisplayString(vue.unref(searchQuery).length > 1 ? "未找到匹配用户" : "请输入关键词搜索"),
|
|
3546
|
-
1
|
|
3547
|
-
/* TEXT */
|
|
3548
|
-
)
|
|
3549
|
-
])) : (vue.openBlock(true), vue.createElementBlock(
|
|
3550
|
-
vue.Fragment,
|
|
3551
|
-
{ key: 1 },
|
|
3552
|
-
vue.renderList(vue.unref(searchResults), (user) => {
|
|
3553
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3554
|
-
class: "user-option",
|
|
3555
|
-
key: user.id,
|
|
3556
|
-
onMousedown: vue.withModifiers(($event) => addUser(user), ["prevent"])
|
|
3557
|
-
}, [
|
|
3558
|
-
vue.createElementVNode(
|
|
3559
|
-
"span",
|
|
3560
|
-
null,
|
|
3561
|
-
vue.toDisplayString(user.name),
|
|
3562
|
-
1
|
|
3563
|
-
/* TEXT */
|
|
3564
|
-
),
|
|
3565
|
-
user.tenantId !== __props.tenantId && user.tenantId && __props.tenants[user.tenantId] ? (vue.openBlock(), vue.createElementBlock(
|
|
3566
|
-
"span",
|
|
3567
|
-
_hoisted_6$1,
|
|
3568
|
-
"@" + vue.toDisplayString(__props.tenants[user.tenantId]),
|
|
3569
|
-
1
|
|
3570
|
-
/* TEXT */
|
|
3571
|
-
)) : vue.createCommentVNode("v-if", true)
|
|
3572
|
-
], 40, _hoisted_5$1);
|
|
3573
|
-
}),
|
|
3574
|
-
128
|
|
3575
|
-
/* KEYED_FRAGMENT */
|
|
3576
|
-
))
|
|
3577
|
-
]),
|
|
3578
|
-
_: 1
|
|
3579
|
-
/* STABLE */
|
|
3580
|
-
}, 8, ["loading"])
|
|
3581
|
-
]),
|
|
3582
|
-
_: 1
|
|
3583
|
-
/* STABLE */
|
|
3584
|
-
}, 8, ["is-show", "width"])
|
|
3784
|
+
loading: vue.unref(searchLoading),
|
|
3785
|
+
options: options.value,
|
|
3786
|
+
"search-query": vue.unref(searchQuery),
|
|
3787
|
+
"tenant-id": __props.tenantId,
|
|
3788
|
+
tenants: __props.tenants,
|
|
3789
|
+
"user-group": __props.userGroup,
|
|
3790
|
+
"user-group-name": __props.userGroupName,
|
|
3791
|
+
onSelectUser: addUser
|
|
3792
|
+
}, null, 8, ["container-width", "is-show", "loading", "options", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
3585
3793
|
])), [
|
|
3586
3794
|
[vue.unref(bkuiVue.clickoutside), handleClickOutside]
|
|
3587
3795
|
]);
|
|
3588
3796
|
};
|
|
3589
3797
|
}
|
|
3590
3798
|
});
|
|
3591
|
-
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
3592
|
-
const _withScopeId = (n) => (vue.pushScopeId("data-v-
|
|
3799
|
+
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-a8dc735f"]]);
|
|
3800
|
+
const _withScopeId = (n) => (vue.pushScopeId("data-v-8b8dd0fd"), n = n(), vue.popScopeId(), n);
|
|
3593
3801
|
const _hoisted_1$1 = { class: "input-container" };
|
|
3594
3802
|
const _hoisted_2 = {
|
|
3595
3803
|
key: 0,
|
|
@@ -3603,15 +3811,6 @@
|
|
|
3603
3811
|
/* HOISTED */
|
|
3604
3812
|
));
|
|
3605
3813
|
const _hoisted_4 = ["placeholder"];
|
|
3606
|
-
const _hoisted_5 = {
|
|
3607
|
-
key: 0,
|
|
3608
|
-
class: "no-data"
|
|
3609
|
-
};
|
|
3610
|
-
const _hoisted_6 = ["onMousedown"];
|
|
3611
|
-
const _hoisted_7 = {
|
|
3612
|
-
key: 0,
|
|
3613
|
-
class: "tenant-name"
|
|
3614
|
-
};
|
|
3615
3814
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
3616
3815
|
...{
|
|
3617
3816
|
name: "BkUserSelectorSingle"
|
|
@@ -3619,12 +3818,14 @@
|
|
|
3619
3818
|
__name: "single-selector",
|
|
3620
3819
|
props: {
|
|
3621
3820
|
modelValue: {},
|
|
3622
|
-
|
|
3821
|
+
tenants: {},
|
|
3623
3822
|
apiBaseUrl: {},
|
|
3624
3823
|
tenantId: {},
|
|
3625
|
-
|
|
3824
|
+
placeholder: {},
|
|
3626
3825
|
currentUserId: {},
|
|
3627
|
-
exactSearchKey: {}
|
|
3826
|
+
exactSearchKey: {},
|
|
3827
|
+
userGroup: {},
|
|
3828
|
+
userGroupName: {}
|
|
3628
3829
|
},
|
|
3629
3830
|
emits: ["update:modelValue", "change"],
|
|
3630
3831
|
setup(__props, { emit: __emit }) {
|
|
@@ -3638,7 +3839,15 @@
|
|
|
3638
3839
|
const searchQuery = vue.ref("");
|
|
3639
3840
|
const showDropdown = vue.ref(false);
|
|
3640
3841
|
const selectedUserInfo = vue.computed(() => {
|
|
3641
|
-
|
|
3842
|
+
const userGroup = (props.userGroup || []).map((group) => ({
|
|
3843
|
+
id: group.id,
|
|
3844
|
+
name: group.name,
|
|
3845
|
+
tenantId: ""
|
|
3846
|
+
}));
|
|
3847
|
+
const list = [...options.value, ...userGroup];
|
|
3848
|
+
const selectedUserInfo2 = list.find((user) => user.id === selectedUser.value);
|
|
3849
|
+
emit("change", selectedUserInfo2 || null);
|
|
3850
|
+
return selectedUserInfo2;
|
|
3642
3851
|
});
|
|
3643
3852
|
vue.onBeforeMount(async () => {
|
|
3644
3853
|
if (typeof props.modelValue === "string" && props.modelValue) {
|
|
@@ -3662,7 +3871,7 @@
|
|
|
3662
3871
|
const formattedResults = formatUsers(result);
|
|
3663
3872
|
if (formattedResults.length > 0) {
|
|
3664
3873
|
options.value = formattedResults;
|
|
3665
|
-
|
|
3874
|
+
addUser(formattedResults[0]);
|
|
3666
3875
|
}
|
|
3667
3876
|
} catch (error) {
|
|
3668
3877
|
console.error("获取当前用户信息失败:", error);
|
|
@@ -3676,7 +3885,7 @@
|
|
|
3676
3885
|
isLoading.value = true;
|
|
3677
3886
|
try {
|
|
3678
3887
|
const result = await searchUsers(props.apiBaseUrl, props.tenantId, keyword);
|
|
3679
|
-
options.value = formatUsers(result);
|
|
3888
|
+
options.value = formatUsers(result).filter((user) => !selectedUser.value || user.id !== selectedUser.value);
|
|
3680
3889
|
console.log("options.value", options.value);
|
|
3681
3890
|
} catch (error) {
|
|
3682
3891
|
console.error("获取用户列表失败:", error);
|
|
@@ -3685,7 +3894,8 @@
|
|
|
3685
3894
|
isLoading.value = false;
|
|
3686
3895
|
}
|
|
3687
3896
|
};
|
|
3688
|
-
const
|
|
3897
|
+
const addUser = (user) => {
|
|
3898
|
+
console.log("addUser", user);
|
|
3689
3899
|
selectedUser.value = user.id;
|
|
3690
3900
|
searchQuery.value = "";
|
|
3691
3901
|
showDropdown.value = false;
|
|
@@ -3695,7 +3905,7 @@
|
|
|
3695
3905
|
searchQuery.value = "";
|
|
3696
3906
|
};
|
|
3697
3907
|
const handleInputFocus = () => {
|
|
3698
|
-
if (searchQuery.value.length >= 2) {
|
|
3908
|
+
if (searchQuery.value.length >= 2 || Array.isArray(props.userGroup) && props.userGroup.length > 0) {
|
|
3699
3909
|
showDropdown.value = true;
|
|
3700
3910
|
}
|
|
3701
3911
|
};
|
|
@@ -3708,12 +3918,10 @@
|
|
|
3708
3918
|
showDropdown.value = false;
|
|
3709
3919
|
};
|
|
3710
3920
|
vue.watch(selectedUser, (newVal) => {
|
|
3921
|
+
console.log("selectedUser", newVal);
|
|
3711
3922
|
emit("update:modelValue", newVal);
|
|
3712
|
-
const selectedUserInfo2 = options.value.find((user) => user.id === newVal);
|
|
3713
|
-
emit("change", selectedUserInfo2 || null);
|
|
3714
3923
|
});
|
|
3715
3924
|
return (_ctx, _cache) => {
|
|
3716
|
-
var _a;
|
|
3717
3925
|
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
3718
3926
|
ref_key: "containerRef",
|
|
3719
3927
|
ref: containerRef,
|
|
@@ -3755,87 +3963,32 @@
|
|
|
3755
3963
|
[vue.vModelText, searchQuery.value]
|
|
3756
3964
|
]),
|
|
3757
3965
|
vue.createCommentVNode(' "我"标签 '),
|
|
3758
|
-
|
|
3759
|
-
"
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
onClick: _cache[1] || (_cache[1] = ($event) => addCurrentUser())
|
|
3764
|
-
},
|
|
3765
|
-
" 我 ",
|
|
3766
|
-
2
|
|
3767
|
-
/* CLASS */
|
|
3768
|
-
)) : vue.createCommentVNode("v-if", true)
|
|
3966
|
+
vue.createVNode(MeTag, {
|
|
3967
|
+
"is-disabled": !!_ctx.currentUserId && !!selectedUserInfo.value && selectedUserInfo.value[_ctx.exactSearchKey || "bk_username"] === _ctx.currentUserId,
|
|
3968
|
+
"current-user-id": _ctx.currentUserId,
|
|
3969
|
+
onClick: addCurrentUser
|
|
3970
|
+
}, null, 8, ["is-disabled", "current-user-id"])
|
|
3769
3971
|
]),
|
|
3770
|
-
vue.createCommentVNode("
|
|
3771
|
-
vue.createVNode(
|
|
3772
|
-
"
|
|
3773
|
-
arrow: false,
|
|
3972
|
+
vue.createCommentVNode(" 使用新的公共下拉选项组件 "),
|
|
3973
|
+
vue.createVNode(SelectionPopover, {
|
|
3974
|
+
"container-width": containerRef.value ? containerRef.value.offsetWidth : "auto",
|
|
3774
3975
|
"is-show": showDropdown.value,
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
size: "mini",
|
|
3785
|
-
mode: "spin"
|
|
3786
|
-
}, {
|
|
3787
|
-
default: vue.withCtx(() => [
|
|
3788
|
-
options.value.length === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
|
|
3789
|
-
vue.createElementVNode(
|
|
3790
|
-
"span",
|
|
3791
|
-
null,
|
|
3792
|
-
vue.toDisplayString(searchQuery.value.length > 1 ? "未找到匹配用户" : "请输入关键词搜索"),
|
|
3793
|
-
1
|
|
3794
|
-
/* TEXT */
|
|
3795
|
-
)
|
|
3796
|
-
])) : (vue.openBlock(true), vue.createElementBlock(
|
|
3797
|
-
vue.Fragment,
|
|
3798
|
-
{ key: 1 },
|
|
3799
|
-
vue.renderList(options.value, (user) => {
|
|
3800
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3801
|
-
class: "user-option",
|
|
3802
|
-
key: user.id,
|
|
3803
|
-
onMousedown: vue.withModifiers(($event) => selectUser(user), ["prevent"])
|
|
3804
|
-
}, [
|
|
3805
|
-
vue.createElementVNode(
|
|
3806
|
-
"span",
|
|
3807
|
-
null,
|
|
3808
|
-
vue.toDisplayString(user.name),
|
|
3809
|
-
1
|
|
3810
|
-
/* TEXT */
|
|
3811
|
-
),
|
|
3812
|
-
user.tenantId !== _ctx.tenantId && user.tenantId && _ctx.tenants[user.tenantId] ? (vue.openBlock(), vue.createElementBlock(
|
|
3813
|
-
"span",
|
|
3814
|
-
_hoisted_7,
|
|
3815
|
-
"@" + vue.toDisplayString(_ctx.tenants[user.tenantId]),
|
|
3816
|
-
1
|
|
3817
|
-
/* TEXT */
|
|
3818
|
-
)) : vue.createCommentVNode("v-if", true)
|
|
3819
|
-
], 40, _hoisted_6);
|
|
3820
|
-
}),
|
|
3821
|
-
128
|
|
3822
|
-
/* KEYED_FRAGMENT */
|
|
3823
|
-
))
|
|
3824
|
-
]),
|
|
3825
|
-
_: 1
|
|
3826
|
-
/* STABLE */
|
|
3827
|
-
}, 8, ["loading"])
|
|
3828
|
-
]),
|
|
3829
|
-
_: 1
|
|
3830
|
-
/* STABLE */
|
|
3831
|
-
}, 8, ["is-show", "width"])
|
|
3976
|
+
loading: isLoading.value,
|
|
3977
|
+
options: options.value,
|
|
3978
|
+
"search-query": searchQuery.value,
|
|
3979
|
+
"tenant-id": _ctx.tenantId,
|
|
3980
|
+
tenants: _ctx.tenants,
|
|
3981
|
+
"user-group": _ctx.userGroup,
|
|
3982
|
+
"user-group-name": _ctx.userGroupName,
|
|
3983
|
+
onSelectUser: addUser
|
|
3984
|
+
}, null, 8, ["container-width", "is-show", "loading", "options", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
3832
3985
|
])), [
|
|
3833
3986
|
[vue.unref(bkuiVue.clickoutside), handleClickOutside]
|
|
3834
3987
|
]);
|
|
3835
3988
|
};
|
|
3836
3989
|
}
|
|
3837
3990
|
});
|
|
3838
|
-
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
3991
|
+
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-8b8dd0fd"]]);
|
|
3839
3992
|
const _hoisted_1 = { class: "bk-user-selector" };
|
|
3840
3993
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
3841
3994
|
...{
|
|
@@ -3843,14 +3996,16 @@
|
|
|
3843
3996
|
},
|
|
3844
3997
|
__name: "user-selector",
|
|
3845
3998
|
props: {
|
|
3846
|
-
apiBaseUrl: { default: "" },
|
|
3847
|
-
tenantId: { default: "" },
|
|
3848
|
-
placeholder: { default: "请输入人员名称搜索" },
|
|
3849
3999
|
modelValue: { default: "" },
|
|
3850
4000
|
draggable: { type: Boolean, default: false },
|
|
3851
4001
|
multiple: { type: Boolean, default: false },
|
|
4002
|
+
apiBaseUrl: { default: "" },
|
|
4003
|
+
tenantId: { default: "" },
|
|
4004
|
+
placeholder: { default: "请输入人员名称搜索" },
|
|
3852
4005
|
currentUserId: { default: "" },
|
|
3853
|
-
exactSearchKey: { default: "" }
|
|
4006
|
+
exactSearchKey: { default: "bk_username" },
|
|
4007
|
+
userGroup: { default: () => [] },
|
|
4008
|
+
userGroupName: { default: "用户群组" }
|
|
3854
4009
|
},
|
|
3855
4010
|
emits: ["update:modelValue", "change"],
|
|
3856
4011
|
setup(__props, { emit: __emit }) {
|
|
@@ -3910,8 +4065,10 @@
|
|
|
3910
4065
|
placeholder: _ctx.placeholder,
|
|
3911
4066
|
"tenant-id": _ctx.tenantId,
|
|
3912
4067
|
tenants: vue.unref(tenants),
|
|
4068
|
+
"user-group": _ctx.userGroup,
|
|
4069
|
+
"user-group-name": _ctx.userGroupName,
|
|
3913
4070
|
onChange: handleUpdateUser
|
|
3914
|
-
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "exact-search-key", "placeholder", "tenant-id", "tenants"])) : (vue.openBlock(), vue.createElementBlock(
|
|
4071
|
+
}, 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(
|
|
3915
4072
|
vue.Fragment,
|
|
3916
4073
|
{ key: 1 },
|
|
3917
4074
|
[
|
|
@@ -3927,8 +4084,10 @@
|
|
|
3927
4084
|
"selected-users": selectedUsers.value,
|
|
3928
4085
|
"tenant-id": _ctx.tenantId,
|
|
3929
4086
|
tenants: vue.unref(tenants),
|
|
4087
|
+
"user-group": _ctx.userGroup,
|
|
4088
|
+
"user-group-name": _ctx.userGroupName,
|
|
3930
4089
|
"onUpdate:selectedUsers": handleUpdateSelectedUsers
|
|
3931
|
-
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "draggable", "exact-search-key", "placeholder", "selected-users", "tenant-id", "tenants"])
|
|
4090
|
+
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "draggable", "exact-search-key", "placeholder", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
3932
4091
|
],
|
|
3933
4092
|
2112
|
|
3934
4093
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
@@ -3937,7 +4096,7 @@
|
|
|
3937
4096
|
};
|
|
3938
4097
|
}
|
|
3939
4098
|
});
|
|
3940
|
-
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4099
|
+
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bc7b4ccd"]]);
|
|
3941
4100
|
exports2.BkUserSelector = BkUserSelector;
|
|
3942
4101
|
exports2.default = BkUserSelector;
|
|
3943
4102
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|