@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/vue2/vue2.css
CHANGED
|
@@ -797,7 +797,7 @@ optgroup {
|
|
|
797
797
|
line-height: 0;
|
|
798
798
|
cursor: pointer;
|
|
799
799
|
}
|
|
800
|
-
.me-tag[data-v-
|
|
800
|
+
.me-tag[data-v-ce388fae] {
|
|
801
801
|
position: absolute;
|
|
802
802
|
top: 50%;
|
|
803
803
|
right: 8px;
|
|
@@ -815,42 +815,42 @@ optgroup {
|
|
|
815
815
|
border-radius: 50%;
|
|
816
816
|
transform: translateY(-50%);
|
|
817
817
|
}
|
|
818
|
-
.me-tag[data-v-
|
|
818
|
+
.me-tag[data-v-ce388fae]:hover {
|
|
819
819
|
color: #3a84ff;
|
|
820
820
|
background-color: #cddffe;
|
|
821
821
|
}
|
|
822
|
-
.me-tag.disabled[data-v-
|
|
822
|
+
.me-tag.disabled[data-v-ce388fae] {
|
|
823
823
|
color: #c4c6cc;
|
|
824
824
|
cursor: not-allowed;
|
|
825
825
|
background-color: #f0f1f5;
|
|
826
|
-
}.dropdown-content[data-v-
|
|
826
|
+
}.dropdown-content[data-v-61e98a47] {
|
|
827
827
|
min-height: 40px;
|
|
828
828
|
max-height: 300px;
|
|
829
829
|
padding: 5px 0;
|
|
830
830
|
overflow-y: auto;
|
|
831
831
|
}
|
|
832
|
-
.dropdown-content .no-data[data-v-
|
|
832
|
+
.dropdown-content .no-data[data-v-61e98a47] {
|
|
833
833
|
padding: 10px;
|
|
834
834
|
color: #979ba5;
|
|
835
835
|
text-align: center;
|
|
836
836
|
}
|
|
837
|
-
.dropdown-content .user-group .group-header[data-v-
|
|
837
|
+
.dropdown-content .user-group .group-header[data-v-61e98a47] {
|
|
838
838
|
display: flex;
|
|
839
839
|
align-items: center;
|
|
840
840
|
padding: 8px 12px;
|
|
841
841
|
color: #979ba5;
|
|
842
842
|
}
|
|
843
|
-
.dropdown-content .user-group .group-header .group-count[data-v-
|
|
843
|
+
.dropdown-content .user-group .group-header .group-count[data-v-61e98a47] {
|
|
844
844
|
margin-left: 4px;
|
|
845
845
|
}
|
|
846
|
-
.dropdown-content .user-option[data-v-
|
|
846
|
+
.dropdown-content .user-option[data-v-61e98a47] {
|
|
847
847
|
display: flex;
|
|
848
848
|
align-items: center;
|
|
849
849
|
height: 32px;
|
|
850
850
|
padding: 8px 12px;
|
|
851
851
|
cursor: pointer;
|
|
852
852
|
}
|
|
853
|
-
.dropdown-content .user-option[data-v-
|
|
853
|
+
.dropdown-content .user-option[data-v-61e98a47]:hover {
|
|
854
854
|
background-color: #f5f7fa;
|
|
855
855
|
}.bk-user-selector-popover.bk-user-selector-pop2-content {
|
|
856
856
|
padding: 0;
|
|
@@ -870,14 +870,14 @@ optgroup {
|
|
|
870
870
|
font-size: 12px;
|
|
871
871
|
text-overflow: ellipsis;
|
|
872
872
|
white-space: nowrap;
|
|
873
|
-
}.multiple-selector[data-v-
|
|
873
|
+
}.multiple-selector[data-v-1c358144] {
|
|
874
874
|
position: relative;
|
|
875
875
|
width: 100%;
|
|
876
876
|
}
|
|
877
|
-
.multiple-selector.is-disabled[data-v-
|
|
877
|
+
.multiple-selector.is-disabled[data-v-1c358144] {
|
|
878
878
|
pointer-events: none;
|
|
879
879
|
}
|
|
880
|
-
.multiple-selector .tags-container[data-v-
|
|
880
|
+
.multiple-selector .tags-container[data-v-1c358144] {
|
|
881
881
|
min-height: 32px;
|
|
882
882
|
padding: 1px 10px 1px 8px;
|
|
883
883
|
background-color: #fff;
|
|
@@ -885,49 +885,49 @@ optgroup {
|
|
|
885
885
|
border-radius: 2px;
|
|
886
886
|
transition: all 0.2s ease;
|
|
887
887
|
}
|
|
888
|
-
.multiple-selector .tags-container.focused[data-v-
|
|
888
|
+
.multiple-selector .tags-container.focused[data-v-1c358144] {
|
|
889
889
|
border-color: #3a84ff;
|
|
890
890
|
box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);
|
|
891
891
|
}
|
|
892
|
-
.multiple-selector .tags-container.collapsed[data-v-
|
|
892
|
+
.multiple-selector .tags-container.collapsed[data-v-1c358144] {
|
|
893
893
|
display: flex;
|
|
894
894
|
flex-wrap: wrap;
|
|
895
895
|
align-items: center;
|
|
896
896
|
}
|
|
897
|
-
.multiple-selector .tag-list[data-v-
|
|
897
|
+
.multiple-selector .tag-list[data-v-1c358144] {
|
|
898
898
|
display: flex;
|
|
899
899
|
flex-wrap: wrap;
|
|
900
900
|
align-items: center;
|
|
901
901
|
}
|
|
902
|
-
.multiple-selector .tag-wrapper[data-v-
|
|
902
|
+
.multiple-selector .tag-wrapper[data-v-1c358144] {
|
|
903
903
|
display: inline-flex;
|
|
904
904
|
align-items: center;
|
|
905
905
|
max-width: 100%;
|
|
906
906
|
}
|
|
907
|
-
.multiple-selector .search-input[data-v-
|
|
907
|
+
.multiple-selector .search-input[data-v-1c358144] {
|
|
908
908
|
min-width: 10px;
|
|
909
909
|
height: 28px;
|
|
910
910
|
background: transparent;
|
|
911
911
|
border: none;
|
|
912
912
|
outline: none;
|
|
913
913
|
}
|
|
914
|
-
.multiple-selector .search-input[data-v-
|
|
914
|
+
.multiple-selector .search-input[data-v-1c358144]::placeholder {
|
|
915
915
|
color: #c4c6cc;
|
|
916
916
|
}
|
|
917
|
-
.multiple-selector .search-input.inline[data-v-
|
|
917
|
+
.multiple-selector .search-input.inline[data-v-1c358144] {
|
|
918
918
|
min-width: 10px;
|
|
919
919
|
}
|
|
920
|
-
.multiple-selector .search-input.last[data-v-
|
|
920
|
+
.multiple-selector .search-input.last[data-v-1c358144], .multiple-selector .search-input.collapsed[data-v-1c358144] {
|
|
921
921
|
flex: 1;
|
|
922
922
|
min-width: 60px;
|
|
923
|
-
}.single-selector[data-v-
|
|
923
|
+
}.single-selector[data-v-7080eb2b] {
|
|
924
924
|
position: relative;
|
|
925
925
|
width: 100%;
|
|
926
926
|
}
|
|
927
|
-
.single-selector.is-disabled[data-v-
|
|
927
|
+
.single-selector.is-disabled[data-v-7080eb2b] {
|
|
928
928
|
pointer-events: none;
|
|
929
929
|
}
|
|
930
|
-
.input-container[data-v-
|
|
930
|
+
.input-container[data-v-7080eb2b] {
|
|
931
931
|
position: relative;
|
|
932
932
|
display: flex;
|
|
933
933
|
align-items: center;
|
|
@@ -937,25 +937,25 @@ optgroup {
|
|
|
937
937
|
border: 1px solid #c4c6cc;
|
|
938
938
|
border-radius: 2px;
|
|
939
939
|
}
|
|
940
|
-
.input-container[data-v-
|
|
940
|
+
.input-container[data-v-7080eb2b]:focus-within {
|
|
941
941
|
border-color: #3a84ff;
|
|
942
942
|
box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);
|
|
943
943
|
}
|
|
944
|
-
.search-input[data-v-
|
|
944
|
+
.search-input[data-v-7080eb2b] {
|
|
945
945
|
flex: 1;
|
|
946
946
|
height: 30px;
|
|
947
947
|
background: transparent;
|
|
948
948
|
border: none;
|
|
949
949
|
outline: none;
|
|
950
950
|
}
|
|
951
|
-
.search-input[data-v-
|
|
951
|
+
.search-input[data-v-7080eb2b]::placeholder {
|
|
952
952
|
color: #c4c6cc;
|
|
953
|
-
}.bk-user-selector[data-v-
|
|
953
|
+
}.bk-user-selector[data-v-c4574ead] {
|
|
954
954
|
position: relative;
|
|
955
955
|
width: 100%;
|
|
956
956
|
font-size: 12px;
|
|
957
957
|
}
|
|
958
|
-
.bk-user-selector.is-disabled[data-v-
|
|
958
|
+
.bk-user-selector.is-disabled[data-v-c4574ead] {
|
|
959
959
|
cursor: not-allowed;
|
|
960
960
|
background-color: #dcdee5;
|
|
961
961
|
}
|
package/vue3/index.es.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unref, ref, onBeforeMount, defineComponent, createElementBlock, createCommentVNode, openBlock, withModifiers, normalizeClass, h, computed, createBlock, withCtx, renderSlot, createVNode, createElementVNode,
|
|
1
|
+
import { unref, ref, onBeforeMount, defineComponent, createElementBlock, createCommentVNode, openBlock, withModifiers, normalizeClass, toDisplayString, h, computed, createBlock, withCtx, renderSlot, createVNode, createElementVNode, Fragment, renderList, watch, nextTick, onMounted, withDirectives, isRef, vModelText, createTextVNode } from "vue";
|
|
2
2
|
import { Popover, Loading, Tag, clickoutside, provideGlobalConfig } from "bkui-vue";
|
|
3
3
|
const generateCallbackName = () => {
|
|
4
4
|
const timestamp = Date.now();
|
|
@@ -114,7 +114,7 @@ const lookupUsers = async (params) => {
|
|
|
114
114
|
}).catch(() => {
|
|
115
115
|
return [];
|
|
116
116
|
});
|
|
117
|
-
return userList;
|
|
117
|
+
return users.map((user) => userList.find((u) => u.username === user)).filter(Boolean);
|
|
118
118
|
}
|
|
119
119
|
if (users.length === 0 || !apiBaseUrl || !tenantId) {
|
|
120
120
|
console.warn("批量查找用户需要提供有效的apiBaseUrl、租户ID和至少一个用户名");
|
|
@@ -169,6 +169,163 @@ const getUserList = async (url, params) => {
|
|
|
169
169
|
});
|
|
170
170
|
return (data == null ? void 0 : data.results) || [];
|
|
171
171
|
};
|
|
172
|
+
/*! js-cookie v3.0.5 | MIT */
|
|
173
|
+
function assign(target) {
|
|
174
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
175
|
+
var source = arguments[i];
|
|
176
|
+
for (var key in source) {
|
|
177
|
+
target[key] = source[key];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return target;
|
|
181
|
+
}
|
|
182
|
+
var defaultConverter = {
|
|
183
|
+
read: function(value) {
|
|
184
|
+
if (value[0] === '"') {
|
|
185
|
+
value = value.slice(1, -1);
|
|
186
|
+
}
|
|
187
|
+
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
188
|
+
},
|
|
189
|
+
write: function(value) {
|
|
190
|
+
return encodeURIComponent(value).replace(
|
|
191
|
+
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
192
|
+
decodeURIComponent
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
function init(converter, defaultAttributes) {
|
|
197
|
+
function set(name, value, attributes) {
|
|
198
|
+
if (typeof document === "undefined") {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
attributes = assign({}, defaultAttributes, attributes);
|
|
202
|
+
if (typeof attributes.expires === "number") {
|
|
203
|
+
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
|
|
204
|
+
}
|
|
205
|
+
if (attributes.expires) {
|
|
206
|
+
attributes.expires = attributes.expires.toUTCString();
|
|
207
|
+
}
|
|
208
|
+
name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
209
|
+
var stringifiedAttributes = "";
|
|
210
|
+
for (var attributeName in attributes) {
|
|
211
|
+
if (!attributes[attributeName]) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
stringifiedAttributes += "; " + attributeName;
|
|
215
|
+
if (attributes[attributeName] === true) {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
|
|
219
|
+
}
|
|
220
|
+
return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
|
|
221
|
+
}
|
|
222
|
+
function get(name) {
|
|
223
|
+
if (typeof document === "undefined" || arguments.length && !name) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
var cookies = document.cookie ? document.cookie.split("; ") : [];
|
|
227
|
+
var jar = {};
|
|
228
|
+
for (var i = 0; i < cookies.length; i++) {
|
|
229
|
+
var parts = cookies[i].split("=");
|
|
230
|
+
var value = parts.slice(1).join("=");
|
|
231
|
+
try {
|
|
232
|
+
var found = decodeURIComponent(parts[0]);
|
|
233
|
+
jar[found] = converter.read(value, found);
|
|
234
|
+
if (name === found) {
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
} catch (e) {
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return name ? jar[name] : jar;
|
|
241
|
+
}
|
|
242
|
+
return Object.create(
|
|
243
|
+
{
|
|
244
|
+
set,
|
|
245
|
+
get,
|
|
246
|
+
remove: function(name, attributes) {
|
|
247
|
+
set(
|
|
248
|
+
name,
|
|
249
|
+
"",
|
|
250
|
+
assign({}, attributes, {
|
|
251
|
+
expires: -1
|
|
252
|
+
})
|
|
253
|
+
);
|
|
254
|
+
},
|
|
255
|
+
withAttributes: function(attributes) {
|
|
256
|
+
return init(this.converter, assign({}, this.attributes, attributes));
|
|
257
|
+
},
|
|
258
|
+
withConverter: function(converter2) {
|
|
259
|
+
return init(assign({}, this.converter, converter2), this.attributes);
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
attributes: { value: Object.freeze(defaultAttributes) },
|
|
264
|
+
converter: { value: Object.freeze(converter) }
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
var api = init(defaultConverter, { path: "/" });
|
|
269
|
+
const enUS = {
|
|
270
|
+
我: "Me",
|
|
271
|
+
请输入人员名称搜索: "Please enter the name of the user to search",
|
|
272
|
+
用户群组: "User Group",
|
|
273
|
+
无匹配人员: "No matching users"
|
|
274
|
+
};
|
|
275
|
+
const zhCN = {
|
|
276
|
+
我: "我",
|
|
277
|
+
请输入人员名称搜索: "请输入人员名称搜索",
|
|
278
|
+
用户群组: "用户群组",
|
|
279
|
+
无匹配人员: "无匹配人员"
|
|
280
|
+
};
|
|
281
|
+
const BLUEKINNG_LANGUAGE = "blueking_language";
|
|
282
|
+
const languageMap = {
|
|
283
|
+
"en-US": enUS,
|
|
284
|
+
"zh-CN": zhCN
|
|
285
|
+
};
|
|
286
|
+
const getPath = (obj, path, variables) => {
|
|
287
|
+
const pathStack = /^\w/.test(path) ? path.split(".") : [path];
|
|
288
|
+
const { length } = pathStack;
|
|
289
|
+
let target = obj;
|
|
290
|
+
let i = 0;
|
|
291
|
+
while (i <= length && target) {
|
|
292
|
+
if (typeof target === "string") {
|
|
293
|
+
return target;
|
|
294
|
+
}
|
|
295
|
+
if (variables) {
|
|
296
|
+
target = target[pathStack[i]];
|
|
297
|
+
Object.keys(variables).forEach((key) => {
|
|
298
|
+
target = target.replace(`{${key}}`, variables[key]);
|
|
299
|
+
});
|
|
300
|
+
} else {
|
|
301
|
+
target = target[pathStack[i]];
|
|
302
|
+
}
|
|
303
|
+
i = i + 1;
|
|
304
|
+
if (!target) {
|
|
305
|
+
return target;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return target;
|
|
309
|
+
};
|
|
310
|
+
const useI18n = () => {
|
|
311
|
+
let localeLanguage = "zh-CN";
|
|
312
|
+
const bluekingLanguage = api.get(BLUEKINNG_LANGUAGE);
|
|
313
|
+
if (bluekingLanguage && bluekingLanguage.toLowerCase() === "en") {
|
|
314
|
+
localeLanguage = "en-US";
|
|
315
|
+
}
|
|
316
|
+
const languagePackage = languageMap[localeLanguage];
|
|
317
|
+
const t = (path, variable) => {
|
|
318
|
+
const value = getPath(languagePackage, path, variable);
|
|
319
|
+
if (value === void 0) {
|
|
320
|
+
console.warn(`缺少索引 * ${path} *`);
|
|
321
|
+
}
|
|
322
|
+
return value;
|
|
323
|
+
};
|
|
324
|
+
return {
|
|
325
|
+
local: localeLanguage,
|
|
326
|
+
t
|
|
327
|
+
};
|
|
328
|
+
};
|
|
172
329
|
const useTenantData = (apiBaseUrl, tenantId, enableMultiTenantMode = true) => {
|
|
173
330
|
const tenants = ref({});
|
|
174
331
|
const loading = ref(false);
|
|
@@ -3078,6 +3235,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3078
3235
|
},
|
|
3079
3236
|
emits: ["click"],
|
|
3080
3237
|
setup(__props, { emit: __emit }) {
|
|
3238
|
+
const { t } = useI18n();
|
|
3081
3239
|
const props = __props;
|
|
3082
3240
|
const emit = __emit;
|
|
3083
3241
|
const handleClick = () => {
|
|
@@ -3092,9 +3250,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3092
3250
|
class: normalizeClass(["me-tag", { disabled: __props.isDisabled }]),
|
|
3093
3251
|
onClick: withModifiers(handleClick, ["stop"])
|
|
3094
3252
|
},
|
|
3095
|
-
"
|
|
3096
|
-
|
|
3097
|
-
/* CLASS */
|
|
3253
|
+
toDisplayString(unref(t)("我")),
|
|
3254
|
+
3
|
|
3255
|
+
/* TEXT, CLASS */
|
|
3098
3256
|
)) : createCommentVNode("v-if", true);
|
|
3099
3257
|
};
|
|
3100
3258
|
}
|
|
@@ -3106,7 +3264,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
3106
3264
|
}
|
|
3107
3265
|
return target;
|
|
3108
3266
|
};
|
|
3109
|
-
const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
|
3267
|
+
const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-ce388fae"]]);
|
|
3110
3268
|
const UserRender = defineComponent({
|
|
3111
3269
|
name: "UserRender",
|
|
3112
3270
|
props: {
|
|
@@ -3234,14 +3392,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3234
3392
|
*/
|
|
3235
3393
|
userGroupName: {
|
|
3236
3394
|
type: String,
|
|
3237
|
-
default: "
|
|
3395
|
+
default: ""
|
|
3238
3396
|
},
|
|
3239
3397
|
/**
|
|
3240
3398
|
* 无匹配人员时的提示文本
|
|
3241
3399
|
*/
|
|
3242
3400
|
emptyText: {
|
|
3243
3401
|
type: String,
|
|
3244
|
-
default: "
|
|
3402
|
+
default: ""
|
|
3245
3403
|
},
|
|
3246
3404
|
/**
|
|
3247
3405
|
* 渲染列表项
|
|
@@ -3380,7 +3538,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3380
3538
|
};
|
|
3381
3539
|
}
|
|
3382
3540
|
});
|
|
3383
|
-
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
3541
|
+
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-61e98a47"]]);
|
|
3384
3542
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3385
3543
|
...{
|
|
3386
3544
|
name: "UserTag"
|
|
@@ -3442,12 +3600,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3442
3600
|
tenants: { default: () => ({}) },
|
|
3443
3601
|
apiBaseUrl: { default: "" },
|
|
3444
3602
|
tenantId: { default: "" },
|
|
3445
|
-
placeholder: { default: "
|
|
3603
|
+
placeholder: { default: "" },
|
|
3446
3604
|
currentUserId: { default: "" },
|
|
3447
3605
|
exactSearchKey: { default: "bk_username" },
|
|
3448
3606
|
userGroup: { default: () => [] },
|
|
3449
|
-
userGroupName: { default: "
|
|
3450
|
-
emptyText: { default: "
|
|
3607
|
+
userGroupName: { default: "" },
|
|
3608
|
+
emptyText: { default: "" },
|
|
3451
3609
|
disabled: { type: Boolean },
|
|
3452
3610
|
renderListItem: {},
|
|
3453
3611
|
renderTag: {},
|
|
@@ -3482,7 +3640,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3482
3640
|
return searchResults.value.filter((user) => !props.selectedUsers.some((selectedUser) => selectedUser.id === user.id)).filter((user) => !props.excludeUserIds.includes(user.id));
|
|
3483
3641
|
});
|
|
3484
3642
|
const userGroupFilter = computed(() => {
|
|
3485
|
-
return props.userGroup.filter((group) =>
|
|
3643
|
+
return props.userGroup.filter((group) => {
|
|
3644
|
+
var _a, _b;
|
|
3645
|
+
const filtered = !props.selectedUsers.some((user) => user.id === group.id) && !group.hidden;
|
|
3646
|
+
if (filtered) {
|
|
3647
|
+
return ((_a = group.id) == null ? void 0 : _a.includes(searchQuery.value)) || ((_b = group.name) == null ? void 0 : _b.includes(searchQuery.value));
|
|
3648
|
+
}
|
|
3649
|
+
return false;
|
|
3650
|
+
});
|
|
3486
3651
|
});
|
|
3487
3652
|
const initSortable = () => {
|
|
3488
3653
|
if (!props.draggable || !sortableContainerRef.value) return;
|
|
@@ -3938,7 +4103,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3938
4103
|
};
|
|
3939
4104
|
}
|
|
3940
4105
|
});
|
|
3941
|
-
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
4106
|
+
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-1c358144"]]);
|
|
3942
4107
|
const _hoisted_1 = { class: "input-container" };
|
|
3943
4108
|
const _hoisted_2 = ["placeholder"];
|
|
3944
4109
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
@@ -3951,12 +4116,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3951
4116
|
tenants: {},
|
|
3952
4117
|
apiBaseUrl: { default: "" },
|
|
3953
4118
|
tenantId: { default: "" },
|
|
3954
|
-
placeholder: { default: "
|
|
4119
|
+
placeholder: { default: "" },
|
|
3955
4120
|
currentUserId: { default: "" },
|
|
3956
4121
|
exactSearchKey: { default: "bk_username" },
|
|
3957
4122
|
userGroup: { default: () => [] },
|
|
3958
|
-
userGroupName: { default: "
|
|
3959
|
-
emptyText: { default: "
|
|
4123
|
+
userGroupName: { default: "" },
|
|
4124
|
+
emptyText: { default: "" },
|
|
3960
4125
|
disabled: { type: Boolean },
|
|
3961
4126
|
renderListItem: {},
|
|
3962
4127
|
renderTag: {},
|
|
@@ -3975,7 +4140,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3975
4140
|
const searchQuery = ref("");
|
|
3976
4141
|
const showDropdown = ref(false);
|
|
3977
4142
|
const userGroupFilter = computed(() => {
|
|
3978
|
-
return props.userGroup.filter((group) =>
|
|
4143
|
+
return props.userGroup.filter((group) => {
|
|
4144
|
+
var _a, _b;
|
|
4145
|
+
const filtered = group.id !== selectedUser.value && !group.hidden;
|
|
4146
|
+
if (filtered) {
|
|
4147
|
+
return ((_a = group.id) == null ? void 0 : _a.includes(searchQuery.value)) || ((_b = group.name) == null ? void 0 : _b.includes(searchQuery.value));
|
|
4148
|
+
}
|
|
4149
|
+
return false;
|
|
4150
|
+
});
|
|
3979
4151
|
});
|
|
3980
4152
|
const selectedUserInfo = computed(() => {
|
|
3981
4153
|
const userGroup = (props.userGroup || []).map((group) => ({
|
|
@@ -4163,7 +4335,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4163
4335
|
};
|
|
4164
4336
|
}
|
|
4165
4337
|
});
|
|
4166
|
-
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
4338
|
+
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-7080eb2b"]]);
|
|
4167
4339
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4168
4340
|
...{
|
|
4169
4341
|
name: "BkUserSelector"
|
|
@@ -4175,12 +4347,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4175
4347
|
multiple: { type: Boolean, default: false },
|
|
4176
4348
|
apiBaseUrl: { default: "" },
|
|
4177
4349
|
tenantId: { default: "" },
|
|
4178
|
-
placeholder: { default: "
|
|
4350
|
+
placeholder: { default: "" },
|
|
4179
4351
|
currentUserId: { default: "" },
|
|
4180
4352
|
exactSearchKey: { default: "bk_username" },
|
|
4181
4353
|
userGroup: { default: () => [] },
|
|
4182
|
-
userGroupName: { default: "
|
|
4183
|
-
emptyText: { default: "
|
|
4354
|
+
userGroupName: { default: "" },
|
|
4355
|
+
emptyText: { default: "" },
|
|
4184
4356
|
disabled: { type: Boolean, default: false },
|
|
4185
4357
|
renderListItem: {},
|
|
4186
4358
|
renderTag: {},
|
|
@@ -4189,6 +4361,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4189
4361
|
},
|
|
4190
4362
|
emits: ["update:modelValue", "change"],
|
|
4191
4363
|
setup(__props, { emit: __emit }) {
|
|
4364
|
+
const { t } = useI18n();
|
|
4192
4365
|
provideGlobalConfig({
|
|
4193
4366
|
prefix: "bk"
|
|
4194
4367
|
});
|
|
@@ -4200,6 +4373,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4200
4373
|
const selectedUserIds = computed(() => {
|
|
4201
4374
|
return props.multiple ? selectedUsers.value.map((user) => user.id) : [];
|
|
4202
4375
|
});
|
|
4376
|
+
const placeholder = computed(() => props.placeholder || t("请输入人员名称搜索"));
|
|
4377
|
+
const userGroupName = computed(() => props.userGroupName || t("用户群组"));
|
|
4378
|
+
const emptyText = computed(() => props.emptyText || t("无匹配人员"));
|
|
4203
4379
|
const initSelectedUsers = async () => {
|
|
4204
4380
|
if (props.multiple) {
|
|
4205
4381
|
const ids = Array.isArray(props.modelValue) ? props.modelValue : [];
|
|
@@ -4221,7 +4397,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4221
4397
|
usersList: ids,
|
|
4222
4398
|
enableMultiTenantMode: props.enableMultiTenantMode
|
|
4223
4399
|
});
|
|
4224
|
-
|
|
4400
|
+
const selectedList = [...selected, ...formatUsers(result, props.enableMultiTenantMode)];
|
|
4401
|
+
selectedUsers.value = ids.map((id) => selectedList.find((user) => user.id === id)).filter(Boolean);
|
|
4225
4402
|
} catch (error) {
|
|
4226
4403
|
console.error("获取选中用户信息失败:", error);
|
|
4227
4404
|
}
|
|
@@ -4279,17 +4456,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4279
4456
|
"api-base-url": _ctx.apiBaseUrl,
|
|
4280
4457
|
"current-user-id": _ctx.currentUserId,
|
|
4281
4458
|
disabled: _ctx.disabled,
|
|
4282
|
-
"empty-text":
|
|
4459
|
+
"empty-text": emptyText.value,
|
|
4283
4460
|
"enable-multi-tenant-mode": _ctx.enableMultiTenantMode,
|
|
4284
4461
|
"exact-search-key": _ctx.exactSearchKey,
|
|
4285
4462
|
"exclude-user-ids": _ctx.excludeUserIds,
|
|
4286
|
-
placeholder:
|
|
4463
|
+
placeholder: placeholder.value,
|
|
4287
4464
|
"render-list-item": _ctx.renderListItem,
|
|
4288
4465
|
"render-tag": _ctx.renderTag,
|
|
4289
4466
|
"tenant-id": _ctx.tenantId,
|
|
4290
4467
|
tenants: unref(tenants),
|
|
4291
4468
|
"user-group": _ctx.userGroup,
|
|
4292
|
-
"user-group-name":
|
|
4469
|
+
"user-group-name": userGroupName.value,
|
|
4293
4470
|
onChange: handleUpdateUser
|
|
4294
4471
|
}, 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"])) : (openBlock(), createElementBlock(
|
|
4295
4472
|
Fragment,
|
|
@@ -4303,18 +4480,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4303
4480
|
"current-user-id": _ctx.currentUserId,
|
|
4304
4481
|
disabled: _ctx.disabled,
|
|
4305
4482
|
draggable: _ctx.draggable,
|
|
4306
|
-
"empty-text":
|
|
4483
|
+
"empty-text": emptyText.value,
|
|
4307
4484
|
"enable-multi-tenant-mode": _ctx.enableMultiTenantMode,
|
|
4308
4485
|
"exact-search-key": _ctx.exactSearchKey,
|
|
4309
4486
|
"exclude-user-ids": _ctx.excludeUserIds,
|
|
4310
|
-
placeholder:
|
|
4487
|
+
placeholder: placeholder.value,
|
|
4311
4488
|
"render-list-item": _ctx.renderListItem,
|
|
4312
4489
|
"render-tag": _ctx.renderTag,
|
|
4313
4490
|
"selected-users": selectedUsers.value,
|
|
4314
4491
|
"tenant-id": _ctx.tenantId,
|
|
4315
4492
|
tenants: unref(tenants),
|
|
4316
4493
|
"user-group": _ctx.userGroup,
|
|
4317
|
-
"user-group-name":
|
|
4494
|
+
"user-group-name": userGroupName.value,
|
|
4318
4495
|
"onUpdate:selectedUsers": handleUpdateSelectedUsers
|
|
4319
4496
|
}, 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"])
|
|
4320
4497
|
],
|
|
@@ -4328,7 +4505,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4328
4505
|
};
|
|
4329
4506
|
}
|
|
4330
4507
|
});
|
|
4331
|
-
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4508
|
+
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c4574ead"]]);
|
|
4332
4509
|
export {
|
|
4333
4510
|
BkUserSelector,
|
|
4334
4511
|
BkUserSelector as default
|