@blueking/bk-user-selector 0.0.29-beta.8 → 0.0.30
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 +19 -18
- package/package.json +1 -1
- package/typings/hooks/use-i18n.d.ts +5 -0
- package/typings/locale/en-us.d.ts +7 -0
- package/typings/locale/zh-cn.d.ts +7 -0
- package/vue2/index.es.min.js +207 -30
- package/vue2/index.iife.min.js +207 -30
- package/vue2/index.umd.min.js +207 -30
- package/vue2/vue2.css +28 -28
- package/vue3/index.es.min.js +207 -30
- package/vue3/index.iife.min.js +207 -30
- package/vue3/index.umd.min.js +207 -30
- package/vue3/vue3.css +28 -28
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-
|
|
6
|
+
__vite_style__.textContent = ".me-tag[data-v-ce388fae] {\n position: absolute;\n top: 50%;\n right: 8px;\n z-index: 1;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n padding: 0 8px;\n font-size: 12px;\n color: #4d4f56;\n cursor: pointer;\n background-color: #e1ecff;\n border-radius: 50%;\n transform: translateY(-50%);\n}\n.me-tag[data-v-ce388fae]:hover {\n color: #3a84ff;\n background-color: #cddffe;\n}\n.me-tag.disabled[data-v-ce388fae] {\n color: #c4c6cc;\n cursor: not-allowed;\n background-color: #f0f1f5;\n}.dropdown-content[data-v-61e98a47] {\n min-height: 40px;\n max-height: 300px;\n padding: 5px 0;\n overflow-y: auto;\n}\n.dropdown-content .no-data[data-v-61e98a47] {\n padding: 10px;\n color: #979ba5;\n text-align: center;\n}\n.dropdown-content .user-group .group-header[data-v-61e98a47] {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n color: #979ba5;\n}\n.dropdown-content .user-group .group-header .group-count[data-v-61e98a47] {\n margin-left: 4px;\n}\n.dropdown-content .user-option[data-v-61e98a47] {\n display: flex;\n align-items: center;\n height: 32px;\n padding: 8px 12px;\n cursor: pointer;\n}\n.dropdown-content .user-option[data-v-61e98a47]:hover {\n background-color: #f5f7fa;\n}.bk-user-selector-popover.bk-user-selector-pop2-content {\n padding: 0;\n}.user-tag[data-v-51944a49] {\n margin-right: 4px;\n margin-left: 0;\n}\n.user-tag.draggable[data-v-51944a49] {\n cursor: move;\n}\n.user-tag.active[data-v-51944a49] {\n background-color: #e1ecff;\n border-color: #3a84ff;\n}\n.user-tag .tag-content .user-name[data-v-51944a49] {\n overflow: hidden;\n font-size: 12px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}.multiple-selector[data-v-1c358144] {\n position: relative;\n width: 100%;\n}\n.multiple-selector.is-disabled[data-v-1c358144] {\n pointer-events: none;\n}\n.multiple-selector .tags-container[data-v-1c358144] {\n min-height: 32px;\n padding: 1px 10px 1px 8px;\n background-color: #fff;\n border: 1px solid #c4c6cc;\n border-radius: 2px;\n transition: all 0.2s ease;\n}\n.multiple-selector .tags-container.focused[data-v-1c358144] {\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-1c358144] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-list[data-v-1c358144] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-wrapper[data-v-1c358144] {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n}\n.multiple-selector .search-input[data-v-1c358144] {\n min-width: 10px;\n height: 28px;\n background: transparent;\n border: none;\n outline: none;\n}\n.multiple-selector .search-input[data-v-1c358144]::placeholder {\n color: #c4c6cc;\n}\n.multiple-selector .search-input.inline[data-v-1c358144] {\n min-width: 10px;\n}\n.multiple-selector .search-input.last[data-v-1c358144], .multiple-selector .search-input.collapsed[data-v-1c358144] {\n flex: 1;\n min-width: 60px;\n}.single-selector[data-v-7080eb2b] {\n position: relative;\n width: 100%;\n}\n.single-selector.is-disabled[data-v-7080eb2b] {\n pointer-events: none;\n}\n.input-container[data-v-7080eb2b] {\n position: relative;\n display: flex;\n align-items: center;\n min-height: 32px;\n padding: 0 8px;\n background-color: #fff;\n border: 1px solid #c4c6cc;\n border-radius: 2px;\n}\n.input-container[data-v-7080eb2b]: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-7080eb2b] {\n flex: 1;\n height: 30px;\n background: transparent;\n border: none;\n outline: none;\n}\n.search-input[data-v-7080eb2b]::placeholder {\n color: #c4c6cc;\n}.bk-user-selector[data-v-c4574ead] {\n position: relative;\n width: 100%;\n font-size: 12px;\n}\n.bk-user-selector.is-disabled[data-v-c4574ead] {\n cursor: not-allowed;\n background-color: #dcdee5;\n}/*$vite$:1*/";
|
|
7
7
|
document.head.appendChild(__vite_style__);
|
|
8
8
|
const generateCallbackName = () => {
|
|
9
9
|
const timestamp = Date.now();
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
}).catch(() => {
|
|
120
120
|
return [];
|
|
121
121
|
});
|
|
122
|
-
return userList;
|
|
122
|
+
return users.map((user) => userList.find((u) => u.username === user)).filter(Boolean);
|
|
123
123
|
}
|
|
124
124
|
if (users.length === 0 || !apiBaseUrl || !tenantId) {
|
|
125
125
|
console.warn("批量查找用户需要提供有效的apiBaseUrl、租户ID和至少一个用户名");
|
|
@@ -174,6 +174,163 @@
|
|
|
174
174
|
});
|
|
175
175
|
return (data == null ? void 0 : data.results) || [];
|
|
176
176
|
};
|
|
177
|
+
/*! js-cookie v3.0.5 | MIT */
|
|
178
|
+
function assign(target) {
|
|
179
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
180
|
+
var source = arguments[i];
|
|
181
|
+
for (var key in source) {
|
|
182
|
+
target[key] = source[key];
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return target;
|
|
186
|
+
}
|
|
187
|
+
var defaultConverter = {
|
|
188
|
+
read: function(value) {
|
|
189
|
+
if (value[0] === '"') {
|
|
190
|
+
value = value.slice(1, -1);
|
|
191
|
+
}
|
|
192
|
+
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
193
|
+
},
|
|
194
|
+
write: function(value) {
|
|
195
|
+
return encodeURIComponent(value).replace(
|
|
196
|
+
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
197
|
+
decodeURIComponent
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
function init(converter, defaultAttributes) {
|
|
202
|
+
function set(name, value, attributes) {
|
|
203
|
+
if (typeof document === "undefined") {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
attributes = assign({}, defaultAttributes, attributes);
|
|
207
|
+
if (typeof attributes.expires === "number") {
|
|
208
|
+
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
|
|
209
|
+
}
|
|
210
|
+
if (attributes.expires) {
|
|
211
|
+
attributes.expires = attributes.expires.toUTCString();
|
|
212
|
+
}
|
|
213
|
+
name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
214
|
+
var stringifiedAttributes = "";
|
|
215
|
+
for (var attributeName in attributes) {
|
|
216
|
+
if (!attributes[attributeName]) {
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
stringifiedAttributes += "; " + attributeName;
|
|
220
|
+
if (attributes[attributeName] === true) {
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
|
|
224
|
+
}
|
|
225
|
+
return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
|
|
226
|
+
}
|
|
227
|
+
function get(name) {
|
|
228
|
+
if (typeof document === "undefined" || arguments.length && !name) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
var cookies = document.cookie ? document.cookie.split("; ") : [];
|
|
232
|
+
var jar = {};
|
|
233
|
+
for (var i = 0; i < cookies.length; i++) {
|
|
234
|
+
var parts = cookies[i].split("=");
|
|
235
|
+
var value = parts.slice(1).join("=");
|
|
236
|
+
try {
|
|
237
|
+
var found = decodeURIComponent(parts[0]);
|
|
238
|
+
jar[found] = converter.read(value, found);
|
|
239
|
+
if (name === found) {
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
} catch (e) {
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return name ? jar[name] : jar;
|
|
246
|
+
}
|
|
247
|
+
return Object.create(
|
|
248
|
+
{
|
|
249
|
+
set,
|
|
250
|
+
get,
|
|
251
|
+
remove: function(name, attributes) {
|
|
252
|
+
set(
|
|
253
|
+
name,
|
|
254
|
+
"",
|
|
255
|
+
assign({}, attributes, {
|
|
256
|
+
expires: -1
|
|
257
|
+
})
|
|
258
|
+
);
|
|
259
|
+
},
|
|
260
|
+
withAttributes: function(attributes) {
|
|
261
|
+
return init(this.converter, assign({}, this.attributes, attributes));
|
|
262
|
+
},
|
|
263
|
+
withConverter: function(converter2) {
|
|
264
|
+
return init(assign({}, this.converter, converter2), this.attributes);
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
attributes: { value: Object.freeze(defaultAttributes) },
|
|
269
|
+
converter: { value: Object.freeze(converter) }
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
var api = init(defaultConverter, { path: "/" });
|
|
274
|
+
const enUS = {
|
|
275
|
+
我: "Me",
|
|
276
|
+
请输入人员名称搜索: "Please enter the name of the user to search",
|
|
277
|
+
用户群组: "User Group",
|
|
278
|
+
无匹配人员: "No matching users"
|
|
279
|
+
};
|
|
280
|
+
const zhCN = {
|
|
281
|
+
我: "我",
|
|
282
|
+
请输入人员名称搜索: "请输入人员名称搜索",
|
|
283
|
+
用户群组: "用户群组",
|
|
284
|
+
无匹配人员: "无匹配人员"
|
|
285
|
+
};
|
|
286
|
+
const BLUEKINNG_LANGUAGE = "blueking_language";
|
|
287
|
+
const languageMap = {
|
|
288
|
+
"en-US": enUS,
|
|
289
|
+
"zh-CN": zhCN
|
|
290
|
+
};
|
|
291
|
+
const getPath = (obj, path, variables) => {
|
|
292
|
+
const pathStack = /^\w/.test(path) ? path.split(".") : [path];
|
|
293
|
+
const { length } = pathStack;
|
|
294
|
+
let target = obj;
|
|
295
|
+
let i = 0;
|
|
296
|
+
while (i <= length && target) {
|
|
297
|
+
if (typeof target === "string") {
|
|
298
|
+
return target;
|
|
299
|
+
}
|
|
300
|
+
if (variables) {
|
|
301
|
+
target = target[pathStack[i]];
|
|
302
|
+
Object.keys(variables).forEach((key) => {
|
|
303
|
+
target = target.replace(`{${key}}`, variables[key]);
|
|
304
|
+
});
|
|
305
|
+
} else {
|
|
306
|
+
target = target[pathStack[i]];
|
|
307
|
+
}
|
|
308
|
+
i = i + 1;
|
|
309
|
+
if (!target) {
|
|
310
|
+
return target;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return target;
|
|
314
|
+
};
|
|
315
|
+
const useI18n = () => {
|
|
316
|
+
let localeLanguage = "zh-CN";
|
|
317
|
+
const bluekingLanguage = api.get(BLUEKINNG_LANGUAGE);
|
|
318
|
+
if (bluekingLanguage && bluekingLanguage.toLowerCase() === "en") {
|
|
319
|
+
localeLanguage = "en-US";
|
|
320
|
+
}
|
|
321
|
+
const languagePackage = languageMap[localeLanguage];
|
|
322
|
+
const t = (path, variable) => {
|
|
323
|
+
const value = getPath(languagePackage, path, variable);
|
|
324
|
+
if (value === void 0) {
|
|
325
|
+
console.warn(`缺少索引 * ${path} *`);
|
|
326
|
+
}
|
|
327
|
+
return value;
|
|
328
|
+
};
|
|
329
|
+
return {
|
|
330
|
+
local: localeLanguage,
|
|
331
|
+
t
|
|
332
|
+
};
|
|
333
|
+
};
|
|
177
334
|
const useTenantData = (apiBaseUrl, tenantId, enableMultiTenantMode = true) => {
|
|
178
335
|
const tenants = vue.ref({});
|
|
179
336
|
const loading = vue.ref(false);
|
|
@@ -3083,6 +3240,7 @@
|
|
|
3083
3240
|
},
|
|
3084
3241
|
emits: ["click"],
|
|
3085
3242
|
setup(__props, { emit: __emit }) {
|
|
3243
|
+
const { t } = useI18n();
|
|
3086
3244
|
const props = __props;
|
|
3087
3245
|
const emit = __emit;
|
|
3088
3246
|
const handleClick = () => {
|
|
@@ -3097,9 +3255,9 @@
|
|
|
3097
3255
|
class: vue.normalizeClass(["me-tag", { disabled: __props.isDisabled }]),
|
|
3098
3256
|
onClick: vue.withModifiers(handleClick, ["stop"])
|
|
3099
3257
|
},
|
|
3100
|
-
"
|
|
3101
|
-
|
|
3102
|
-
/* CLASS */
|
|
3258
|
+
vue.toDisplayString(vue.unref(t)("我")),
|
|
3259
|
+
3
|
|
3260
|
+
/* TEXT, CLASS */
|
|
3103
3261
|
)) : vue.createCommentVNode("v-if", true);
|
|
3104
3262
|
};
|
|
3105
3263
|
}
|
|
@@ -3111,7 +3269,7 @@
|
|
|
3111
3269
|
}
|
|
3112
3270
|
return target;
|
|
3113
3271
|
};
|
|
3114
|
-
const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
|
3272
|
+
const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-ce388fae"]]);
|
|
3115
3273
|
const UserRender = vue.defineComponent({
|
|
3116
3274
|
name: "UserRender",
|
|
3117
3275
|
props: {
|
|
@@ -3239,14 +3397,14 @@
|
|
|
3239
3397
|
*/
|
|
3240
3398
|
userGroupName: {
|
|
3241
3399
|
type: String,
|
|
3242
|
-
default: "
|
|
3400
|
+
default: ""
|
|
3243
3401
|
},
|
|
3244
3402
|
/**
|
|
3245
3403
|
* 无匹配人员时的提示文本
|
|
3246
3404
|
*/
|
|
3247
3405
|
emptyText: {
|
|
3248
3406
|
type: String,
|
|
3249
|
-
default: "
|
|
3407
|
+
default: ""
|
|
3250
3408
|
},
|
|
3251
3409
|
/**
|
|
3252
3410
|
* 渲染列表项
|
|
@@ -3385,7 +3543,7 @@
|
|
|
3385
3543
|
};
|
|
3386
3544
|
}
|
|
3387
3545
|
});
|
|
3388
|
-
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
3546
|
+
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-61e98a47"]]);
|
|
3389
3547
|
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
3390
3548
|
...{
|
|
3391
3549
|
name: "UserTag"
|
|
@@ -3447,12 +3605,12 @@
|
|
|
3447
3605
|
tenants: { default: () => ({}) },
|
|
3448
3606
|
apiBaseUrl: { default: "" },
|
|
3449
3607
|
tenantId: { default: "" },
|
|
3450
|
-
placeholder: { default: "
|
|
3608
|
+
placeholder: { default: "" },
|
|
3451
3609
|
currentUserId: { default: "" },
|
|
3452
3610
|
exactSearchKey: { default: "bk_username" },
|
|
3453
3611
|
userGroup: { default: () => [] },
|
|
3454
|
-
userGroupName: { default: "
|
|
3455
|
-
emptyText: { default: "
|
|
3612
|
+
userGroupName: { default: "" },
|
|
3613
|
+
emptyText: { default: "" },
|
|
3456
3614
|
disabled: { type: Boolean },
|
|
3457
3615
|
renderListItem: {},
|
|
3458
3616
|
renderTag: {},
|
|
@@ -3487,7 +3645,14 @@
|
|
|
3487
3645
|
return searchResults.value.filter((user) => !props.selectedUsers.some((selectedUser) => selectedUser.id === user.id)).filter((user) => !props.excludeUserIds.includes(user.id));
|
|
3488
3646
|
});
|
|
3489
3647
|
const userGroupFilter = vue.computed(() => {
|
|
3490
|
-
return props.userGroup.filter((group) =>
|
|
3648
|
+
return props.userGroup.filter((group) => {
|
|
3649
|
+
var _a, _b;
|
|
3650
|
+
const filtered = !props.selectedUsers.some((user) => user.id === group.id) && !group.hidden;
|
|
3651
|
+
if (filtered) {
|
|
3652
|
+
return ((_a = group.id) == null ? void 0 : _a.includes(searchQuery.value)) || ((_b = group.name) == null ? void 0 : _b.includes(searchQuery.value));
|
|
3653
|
+
}
|
|
3654
|
+
return false;
|
|
3655
|
+
});
|
|
3491
3656
|
});
|
|
3492
3657
|
const initSortable = () => {
|
|
3493
3658
|
if (!props.draggable || !sortableContainerRef.value) return;
|
|
@@ -3943,7 +4108,7 @@
|
|
|
3943
4108
|
};
|
|
3944
4109
|
}
|
|
3945
4110
|
});
|
|
3946
|
-
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
4111
|
+
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-1c358144"]]);
|
|
3947
4112
|
const _hoisted_1 = { class: "input-container" };
|
|
3948
4113
|
const _hoisted_2 = ["placeholder"];
|
|
3949
4114
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -3956,12 +4121,12 @@
|
|
|
3956
4121
|
tenants: {},
|
|
3957
4122
|
apiBaseUrl: { default: "" },
|
|
3958
4123
|
tenantId: { default: "" },
|
|
3959
|
-
placeholder: { default: "
|
|
4124
|
+
placeholder: { default: "" },
|
|
3960
4125
|
currentUserId: { default: "" },
|
|
3961
4126
|
exactSearchKey: { default: "bk_username" },
|
|
3962
4127
|
userGroup: { default: () => [] },
|
|
3963
|
-
userGroupName: { default: "
|
|
3964
|
-
emptyText: { default: "
|
|
4128
|
+
userGroupName: { default: "" },
|
|
4129
|
+
emptyText: { default: "" },
|
|
3965
4130
|
disabled: { type: Boolean },
|
|
3966
4131
|
renderListItem: {},
|
|
3967
4132
|
renderTag: {},
|
|
@@ -3980,7 +4145,14 @@
|
|
|
3980
4145
|
const searchQuery = vue.ref("");
|
|
3981
4146
|
const showDropdown = vue.ref(false);
|
|
3982
4147
|
const userGroupFilter = vue.computed(() => {
|
|
3983
|
-
return props.userGroup.filter((group) =>
|
|
4148
|
+
return props.userGroup.filter((group) => {
|
|
4149
|
+
var _a, _b;
|
|
4150
|
+
const filtered = group.id !== selectedUser.value && !group.hidden;
|
|
4151
|
+
if (filtered) {
|
|
4152
|
+
return ((_a = group.id) == null ? void 0 : _a.includes(searchQuery.value)) || ((_b = group.name) == null ? void 0 : _b.includes(searchQuery.value));
|
|
4153
|
+
}
|
|
4154
|
+
return false;
|
|
4155
|
+
});
|
|
3984
4156
|
});
|
|
3985
4157
|
const selectedUserInfo = vue.computed(() => {
|
|
3986
4158
|
const userGroup = (props.userGroup || []).map((group) => ({
|
|
@@ -4168,7 +4340,7 @@
|
|
|
4168
4340
|
};
|
|
4169
4341
|
}
|
|
4170
4342
|
});
|
|
4171
|
-
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
4343
|
+
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-7080eb2b"]]);
|
|
4172
4344
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
4173
4345
|
...{
|
|
4174
4346
|
name: "BkUserSelector"
|
|
@@ -4180,12 +4352,12 @@
|
|
|
4180
4352
|
multiple: { type: Boolean, default: false },
|
|
4181
4353
|
apiBaseUrl: { default: "" },
|
|
4182
4354
|
tenantId: { default: "" },
|
|
4183
|
-
placeholder: { default: "
|
|
4355
|
+
placeholder: { default: "" },
|
|
4184
4356
|
currentUserId: { default: "" },
|
|
4185
4357
|
exactSearchKey: { default: "bk_username" },
|
|
4186
4358
|
userGroup: { default: () => [] },
|
|
4187
|
-
userGroupName: { default: "
|
|
4188
|
-
emptyText: { default: "
|
|
4359
|
+
userGroupName: { default: "" },
|
|
4360
|
+
emptyText: { default: "" },
|
|
4189
4361
|
disabled: { type: Boolean, default: false },
|
|
4190
4362
|
renderListItem: {},
|
|
4191
4363
|
renderTag: {},
|
|
@@ -4194,6 +4366,7 @@
|
|
|
4194
4366
|
},
|
|
4195
4367
|
emits: ["update:modelValue", "change"],
|
|
4196
4368
|
setup(__props, { emit: __emit }) {
|
|
4369
|
+
const { t } = useI18n();
|
|
4197
4370
|
bkuiVue.provideGlobalConfig({
|
|
4198
4371
|
prefix: "bk"
|
|
4199
4372
|
});
|
|
@@ -4205,6 +4378,9 @@
|
|
|
4205
4378
|
const selectedUserIds = vue.computed(() => {
|
|
4206
4379
|
return props.multiple ? selectedUsers.value.map((user) => user.id) : [];
|
|
4207
4380
|
});
|
|
4381
|
+
const placeholder = vue.computed(() => props.placeholder || t("请输入人员名称搜索"));
|
|
4382
|
+
const userGroupName = vue.computed(() => props.userGroupName || t("用户群组"));
|
|
4383
|
+
const emptyText = vue.computed(() => props.emptyText || t("无匹配人员"));
|
|
4208
4384
|
const initSelectedUsers = async () => {
|
|
4209
4385
|
if (props.multiple) {
|
|
4210
4386
|
const ids = Array.isArray(props.modelValue) ? props.modelValue : [];
|
|
@@ -4226,7 +4402,8 @@
|
|
|
4226
4402
|
usersList: ids,
|
|
4227
4403
|
enableMultiTenantMode: props.enableMultiTenantMode
|
|
4228
4404
|
});
|
|
4229
|
-
|
|
4405
|
+
const selectedList = [...selected, ...formatUsers(result, props.enableMultiTenantMode)];
|
|
4406
|
+
selectedUsers.value = ids.map((id) => selectedList.find((user) => user.id === id)).filter(Boolean);
|
|
4230
4407
|
} catch (error) {
|
|
4231
4408
|
console.error("获取选中用户信息失败:", error);
|
|
4232
4409
|
}
|
|
@@ -4284,17 +4461,17 @@
|
|
|
4284
4461
|
"api-base-url": _ctx.apiBaseUrl,
|
|
4285
4462
|
"current-user-id": _ctx.currentUserId,
|
|
4286
4463
|
disabled: _ctx.disabled,
|
|
4287
|
-
"empty-text":
|
|
4464
|
+
"empty-text": emptyText.value,
|
|
4288
4465
|
"enable-multi-tenant-mode": _ctx.enableMultiTenantMode,
|
|
4289
4466
|
"exact-search-key": _ctx.exactSearchKey,
|
|
4290
4467
|
"exclude-user-ids": _ctx.excludeUserIds,
|
|
4291
|
-
placeholder:
|
|
4468
|
+
placeholder: placeholder.value,
|
|
4292
4469
|
"render-list-item": _ctx.renderListItem,
|
|
4293
4470
|
"render-tag": _ctx.renderTag,
|
|
4294
4471
|
"tenant-id": _ctx.tenantId,
|
|
4295
4472
|
tenants: vue.unref(tenants),
|
|
4296
4473
|
"user-group": _ctx.userGroup,
|
|
4297
|
-
"user-group-name":
|
|
4474
|
+
"user-group-name": userGroupName.value,
|
|
4298
4475
|
onChange: handleUpdateUser
|
|
4299
4476
|
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "disabled", "empty-text", "enable-multi-tenant-mode", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "tenant-id", "tenants", "user-group", "user-group-name"])) : (vue.openBlock(), vue.createElementBlock(
|
|
4300
4477
|
vue.Fragment,
|
|
@@ -4308,18 +4485,18 @@
|
|
|
4308
4485
|
"current-user-id": _ctx.currentUserId,
|
|
4309
4486
|
disabled: _ctx.disabled,
|
|
4310
4487
|
draggable: _ctx.draggable,
|
|
4311
|
-
"empty-text":
|
|
4488
|
+
"empty-text": emptyText.value,
|
|
4312
4489
|
"enable-multi-tenant-mode": _ctx.enableMultiTenantMode,
|
|
4313
4490
|
"exact-search-key": _ctx.exactSearchKey,
|
|
4314
4491
|
"exclude-user-ids": _ctx.excludeUserIds,
|
|
4315
|
-
placeholder:
|
|
4492
|
+
placeholder: placeholder.value,
|
|
4316
4493
|
"render-list-item": _ctx.renderListItem,
|
|
4317
4494
|
"render-tag": _ctx.renderTag,
|
|
4318
4495
|
"selected-users": selectedUsers.value,
|
|
4319
4496
|
"tenant-id": _ctx.tenantId,
|
|
4320
4497
|
tenants: vue.unref(tenants),
|
|
4321
4498
|
"user-group": _ctx.userGroup,
|
|
4322
|
-
"user-group-name":
|
|
4499
|
+
"user-group-name": userGroupName.value,
|
|
4323
4500
|
"onUpdate:selectedUsers": handleUpdateSelectedUsers
|
|
4324
4501
|
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "disabled", "draggable", "empty-text", "enable-multi-tenant-mode", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
4325
4502
|
],
|
|
@@ -4333,7 +4510,7 @@
|
|
|
4333
4510
|
};
|
|
4334
4511
|
}
|
|
4335
4512
|
});
|
|
4336
|
-
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4513
|
+
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c4574ead"]]);
|
|
4337
4514
|
exports2.BkUserSelector = BkUserSelector;
|
|
4338
4515
|
exports2.default = BkUserSelector;
|
|
4339
4516
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
package/vue3/vue3.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.me-tag[data-v-
|
|
1
|
+
.me-tag[data-v-ce388fae] {
|
|
2
2
|
position: absolute;
|
|
3
3
|
top: 50%;
|
|
4
4
|
right: 8px;
|
|
@@ -16,42 +16,42 @@
|
|
|
16
16
|
border-radius: 50%;
|
|
17
17
|
transform: translateY(-50%);
|
|
18
18
|
}
|
|
19
|
-
.me-tag[data-v-
|
|
19
|
+
.me-tag[data-v-ce388fae]:hover {
|
|
20
20
|
color: #3a84ff;
|
|
21
21
|
background-color: #cddffe;
|
|
22
22
|
}
|
|
23
|
-
.me-tag.disabled[data-v-
|
|
23
|
+
.me-tag.disabled[data-v-ce388fae] {
|
|
24
24
|
color: #c4c6cc;
|
|
25
25
|
cursor: not-allowed;
|
|
26
26
|
background-color: #f0f1f5;
|
|
27
|
-
}.dropdown-content[data-v-
|
|
27
|
+
}.dropdown-content[data-v-61e98a47] {
|
|
28
28
|
min-height: 40px;
|
|
29
29
|
max-height: 300px;
|
|
30
30
|
padding: 5px 0;
|
|
31
31
|
overflow-y: auto;
|
|
32
32
|
}
|
|
33
|
-
.dropdown-content .no-data[data-v-
|
|
33
|
+
.dropdown-content .no-data[data-v-61e98a47] {
|
|
34
34
|
padding: 10px;
|
|
35
35
|
color: #979ba5;
|
|
36
36
|
text-align: center;
|
|
37
37
|
}
|
|
38
|
-
.dropdown-content .user-group .group-header[data-v-
|
|
38
|
+
.dropdown-content .user-group .group-header[data-v-61e98a47] {
|
|
39
39
|
display: flex;
|
|
40
40
|
align-items: center;
|
|
41
41
|
padding: 8px 12px;
|
|
42
42
|
color: #979ba5;
|
|
43
43
|
}
|
|
44
|
-
.dropdown-content .user-group .group-header .group-count[data-v-
|
|
44
|
+
.dropdown-content .user-group .group-header .group-count[data-v-61e98a47] {
|
|
45
45
|
margin-left: 4px;
|
|
46
46
|
}
|
|
47
|
-
.dropdown-content .user-option[data-v-
|
|
47
|
+
.dropdown-content .user-option[data-v-61e98a47] {
|
|
48
48
|
display: flex;
|
|
49
49
|
align-items: center;
|
|
50
50
|
height: 32px;
|
|
51
51
|
padding: 8px 12px;
|
|
52
52
|
cursor: pointer;
|
|
53
53
|
}
|
|
54
|
-
.dropdown-content .user-option[data-v-
|
|
54
|
+
.dropdown-content .user-option[data-v-61e98a47]:hover {
|
|
55
55
|
background-color: #f5f7fa;
|
|
56
56
|
}.bk-user-selector-popover.bk-user-selector-pop2-content {
|
|
57
57
|
padding: 0;
|
|
@@ -71,14 +71,14 @@
|
|
|
71
71
|
font-size: 12px;
|
|
72
72
|
text-overflow: ellipsis;
|
|
73
73
|
white-space: nowrap;
|
|
74
|
-
}.multiple-selector[data-v-
|
|
74
|
+
}.multiple-selector[data-v-1c358144] {
|
|
75
75
|
position: relative;
|
|
76
76
|
width: 100%;
|
|
77
77
|
}
|
|
78
|
-
.multiple-selector.is-disabled[data-v-
|
|
78
|
+
.multiple-selector.is-disabled[data-v-1c358144] {
|
|
79
79
|
pointer-events: none;
|
|
80
80
|
}
|
|
81
|
-
.multiple-selector .tags-container[data-v-
|
|
81
|
+
.multiple-selector .tags-container[data-v-1c358144] {
|
|
82
82
|
min-height: 32px;
|
|
83
83
|
padding: 1px 10px 1px 8px;
|
|
84
84
|
background-color: #fff;
|
|
@@ -86,49 +86,49 @@
|
|
|
86
86
|
border-radius: 2px;
|
|
87
87
|
transition: all 0.2s ease;
|
|
88
88
|
}
|
|
89
|
-
.multiple-selector .tags-container.focused[data-v-
|
|
89
|
+
.multiple-selector .tags-container.focused[data-v-1c358144] {
|
|
90
90
|
border-color: #3a84ff;
|
|
91
91
|
box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);
|
|
92
92
|
}
|
|
93
|
-
.multiple-selector .tags-container.collapsed[data-v-
|
|
93
|
+
.multiple-selector .tags-container.collapsed[data-v-1c358144] {
|
|
94
94
|
display: flex;
|
|
95
95
|
flex-wrap: wrap;
|
|
96
96
|
align-items: center;
|
|
97
97
|
}
|
|
98
|
-
.multiple-selector .tag-list[data-v-
|
|
98
|
+
.multiple-selector .tag-list[data-v-1c358144] {
|
|
99
99
|
display: flex;
|
|
100
100
|
flex-wrap: wrap;
|
|
101
101
|
align-items: center;
|
|
102
102
|
}
|
|
103
|
-
.multiple-selector .tag-wrapper[data-v-
|
|
103
|
+
.multiple-selector .tag-wrapper[data-v-1c358144] {
|
|
104
104
|
display: inline-flex;
|
|
105
105
|
align-items: center;
|
|
106
106
|
max-width: 100%;
|
|
107
107
|
}
|
|
108
|
-
.multiple-selector .search-input[data-v-
|
|
108
|
+
.multiple-selector .search-input[data-v-1c358144] {
|
|
109
109
|
min-width: 10px;
|
|
110
110
|
height: 28px;
|
|
111
111
|
background: transparent;
|
|
112
112
|
border: none;
|
|
113
113
|
outline: none;
|
|
114
114
|
}
|
|
115
|
-
.multiple-selector .search-input[data-v-
|
|
115
|
+
.multiple-selector .search-input[data-v-1c358144]::placeholder {
|
|
116
116
|
color: #c4c6cc;
|
|
117
117
|
}
|
|
118
|
-
.multiple-selector .search-input.inline[data-v-
|
|
118
|
+
.multiple-selector .search-input.inline[data-v-1c358144] {
|
|
119
119
|
min-width: 10px;
|
|
120
120
|
}
|
|
121
|
-
.multiple-selector .search-input.last[data-v-
|
|
121
|
+
.multiple-selector .search-input.last[data-v-1c358144], .multiple-selector .search-input.collapsed[data-v-1c358144] {
|
|
122
122
|
flex: 1;
|
|
123
123
|
min-width: 60px;
|
|
124
|
-
}.single-selector[data-v-
|
|
124
|
+
}.single-selector[data-v-7080eb2b] {
|
|
125
125
|
position: relative;
|
|
126
126
|
width: 100%;
|
|
127
127
|
}
|
|
128
|
-
.single-selector.is-disabled[data-v-
|
|
128
|
+
.single-selector.is-disabled[data-v-7080eb2b] {
|
|
129
129
|
pointer-events: none;
|
|
130
130
|
}
|
|
131
|
-
.input-container[data-v-
|
|
131
|
+
.input-container[data-v-7080eb2b] {
|
|
132
132
|
position: relative;
|
|
133
133
|
display: flex;
|
|
134
134
|
align-items: center;
|
|
@@ -138,25 +138,25 @@
|
|
|
138
138
|
border: 1px solid #c4c6cc;
|
|
139
139
|
border-radius: 2px;
|
|
140
140
|
}
|
|
141
|
-
.input-container[data-v-
|
|
141
|
+
.input-container[data-v-7080eb2b]:focus-within {
|
|
142
142
|
border-color: #3a84ff;
|
|
143
143
|
box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);
|
|
144
144
|
}
|
|
145
|
-
.search-input[data-v-
|
|
145
|
+
.search-input[data-v-7080eb2b] {
|
|
146
146
|
flex: 1;
|
|
147
147
|
height: 30px;
|
|
148
148
|
background: transparent;
|
|
149
149
|
border: none;
|
|
150
150
|
outline: none;
|
|
151
151
|
}
|
|
152
|
-
.search-input[data-v-
|
|
152
|
+
.search-input[data-v-7080eb2b]::placeholder {
|
|
153
153
|
color: #c4c6cc;
|
|
154
|
-
}.bk-user-selector[data-v-
|
|
154
|
+
}.bk-user-selector[data-v-c4574ead] {
|
|
155
155
|
position: relative;
|
|
156
156
|
width: 100%;
|
|
157
157
|
font-size: 12px;
|
|
158
158
|
}
|
|
159
|
-
.bk-user-selector.is-disabled[data-v-
|
|
159
|
+
.bk-user-selector.is-disabled[data-v-c4574ead] {
|
|
160
160
|
cursor: not-allowed;
|
|
161
161
|
background-color: #dcdee5;
|
|
162
162
|
}
|