@blueking/bk-user-selector 0.0.38 → 0.0.39-beta.2
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 +7 -6
- package/package.json +1 -1
- package/typings/api/user.d.ts +8 -8
- package/typings/components/multiple-selector.vue.d.ts +5 -4
- package/typings/components/selection-popover.vue.d.ts +3 -3
- package/typings/components/single-selector.vue.d.ts +3 -3
- package/typings/components/user-selector.vue.d.ts +5 -4
- package/typings/components/user-tag.vue.d.ts +20 -20
- package/typings/hooks/use-jsonp.d.ts +5 -5
- package/typings/hooks/useUserSearch.d.ts +1 -1
- package/typings/types/index.d.ts +107 -99
- package/typings/utils/common.d.ts +1 -1
- package/vue2/index.es.min.js +123 -209
- package/vue2/index.iife.min.js +123 -209
- package/vue2/index.umd.min.js +123 -209
- package/vue2/vue2.css +41 -41
- package/vue3/index.es.min.js +118 -63
- package/vue3/index.iife.min.js +123 -209
- package/vue3/index.umd.min.js +119 -64
- package/vue3/vue3.css +41 -41
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-ef4a05c4] {
|
|
801
801
|
position: absolute;
|
|
802
802
|
top: 50%;
|
|
803
803
|
right: 8px;
|
|
@@ -810,83 +810,81 @@ optgroup {
|
|
|
810
810
|
padding: 0 8px;
|
|
811
811
|
font-size: 12px;
|
|
812
812
|
color: #4d4f56;
|
|
813
|
+
white-space: nowrap;
|
|
813
814
|
cursor: pointer;
|
|
814
815
|
background-color: #e1ecff;
|
|
815
816
|
border-radius: 50%;
|
|
816
817
|
transform: translateY(-50%);
|
|
817
|
-
white-space: nowrap;
|
|
818
818
|
}
|
|
819
|
-
.me-tag[data-v-
|
|
819
|
+
.me-tag[data-v-ef4a05c4]:hover {
|
|
820
820
|
color: #3a84ff;
|
|
821
821
|
background-color: #cddffe;
|
|
822
822
|
}
|
|
823
|
-
.me-tag.disabled[data-v-
|
|
823
|
+
.me-tag.disabled[data-v-ef4a05c4] {
|
|
824
824
|
color: #c4c6cc;
|
|
825
825
|
cursor: not-allowed;
|
|
826
826
|
background-color: #f0f1f5;
|
|
827
|
-
}.dropdown-content[data-v-
|
|
827
|
+
}.dropdown-content[data-v-78875ea6] {
|
|
828
828
|
min-height: 40px;
|
|
829
829
|
max-height: 300px;
|
|
830
830
|
padding: 5px 0;
|
|
831
831
|
overflow-y: auto;
|
|
832
832
|
}
|
|
833
|
-
.dropdown-content .no-data[data-v-
|
|
833
|
+
.dropdown-content .no-data[data-v-78875ea6] {
|
|
834
834
|
padding: 10px;
|
|
835
835
|
color: #979ba5;
|
|
836
836
|
text-align: center;
|
|
837
837
|
}
|
|
838
|
-
.dropdown-content .user-group .group-header[data-v-
|
|
838
|
+
.dropdown-content .user-group .group-header[data-v-78875ea6] {
|
|
839
839
|
display: flex;
|
|
840
840
|
align-items: center;
|
|
841
841
|
padding: 8px 12px;
|
|
842
842
|
color: #979ba5;
|
|
843
843
|
}
|
|
844
|
-
.dropdown-content .user-group .group-header .group-count[data-v-
|
|
844
|
+
.dropdown-content .user-group .group-header .group-count[data-v-78875ea6] {
|
|
845
845
|
margin-left: 4px;
|
|
846
846
|
}
|
|
847
|
-
.dropdown-content .user-option[data-v-
|
|
847
|
+
.dropdown-content .user-option[data-v-78875ea6] {
|
|
848
848
|
display: flex;
|
|
849
849
|
align-items: center;
|
|
850
850
|
height: 32px;
|
|
851
851
|
padding: 8px 12px;
|
|
852
852
|
cursor: pointer;
|
|
853
853
|
}
|
|
854
|
-
.dropdown-content .user-option[data-v-
|
|
854
|
+
.dropdown-content .user-option[data-v-78875ea6]:hover {
|
|
855
855
|
background-color: #f5f7fa;
|
|
856
|
-
}.
|
|
857
|
-
padding: 0;
|
|
858
|
-
}.user-tag[data-v-3ff46050] {
|
|
856
|
+
}.user-tag[data-v-48ac8fc1] {
|
|
859
857
|
margin-right: 4px;
|
|
860
858
|
margin-left: 0;
|
|
861
859
|
}
|
|
862
|
-
.user-tag.draggable[data-v-
|
|
860
|
+
.user-tag.draggable[data-v-48ac8fc1] {
|
|
863
861
|
cursor: move;
|
|
864
862
|
}
|
|
865
|
-
.user-tag.active[data-v-
|
|
863
|
+
.user-tag.active[data-v-48ac8fc1] {
|
|
866
864
|
background-color: #e1ecff;
|
|
867
865
|
border-color: #3a84ff;
|
|
868
866
|
}
|
|
869
|
-
.user-tag.is-custom[data-v-
|
|
867
|
+
.user-tag.is-custom[data-v-48ac8fc1] {
|
|
870
868
|
color: #ea3636;
|
|
871
869
|
background-color: #feebea;
|
|
872
870
|
border-color: rgba(234, 53, 54, 0.3019607843);
|
|
873
871
|
}
|
|
874
|
-
.user-tag.is-custom[data-v-
|
|
872
|
+
.user-tag.is-custom[data-v-48ac8fc1]:hover {
|
|
875
873
|
background-color: #fedddc;
|
|
876
874
|
}
|
|
877
|
-
.user-tag .tag-content .user-name[data-v-
|
|
875
|
+
.user-tag .tag-content .user-name[data-v-48ac8fc1] {
|
|
878
876
|
overflow: hidden;
|
|
879
|
-
font-size: 12px;
|
|
880
877
|
text-overflow: ellipsis;
|
|
878
|
+
font-size: 12px;
|
|
881
879
|
white-space: nowrap;
|
|
882
|
-
}.multiple-selector[data-v-
|
|
880
|
+
}.multiple-selector[data-v-2a532f24] {
|
|
883
881
|
position: relative;
|
|
884
882
|
width: 100%;
|
|
885
883
|
}
|
|
886
|
-
.multiple-selector.is-disabled[data-v-
|
|
884
|
+
.multiple-selector.is-disabled[data-v-2a532f24] {
|
|
887
885
|
pointer-events: none;
|
|
888
886
|
}
|
|
889
|
-
.multiple-selector .tags-container[data-v-
|
|
887
|
+
.multiple-selector .tags-container[data-v-2a532f24] {
|
|
890
888
|
min-height: 32px;
|
|
891
889
|
padding: 1px 10px 1px 8px;
|
|
892
890
|
background-color: #fff;
|
|
@@ -894,51 +892,51 @@ optgroup {
|
|
|
894
892
|
border-radius: 2px;
|
|
895
893
|
transition: all 0.2s ease;
|
|
896
894
|
}
|
|
897
|
-
.multiple-selector .tags-container.focused[data-v-
|
|
895
|
+
.multiple-selector .tags-container.focused[data-v-2a532f24] {
|
|
898
896
|
border-color: #3a84ff;
|
|
899
897
|
box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);
|
|
900
898
|
}
|
|
901
|
-
.multiple-selector .tags-container.collapsed[data-v-
|
|
899
|
+
.multiple-selector .tags-container.collapsed[data-v-2a532f24] {
|
|
902
900
|
display: flex;
|
|
903
901
|
flex-wrap: wrap;
|
|
904
902
|
align-items: center;
|
|
905
903
|
}
|
|
906
|
-
.multiple-selector .tag-list[data-v-
|
|
904
|
+
.multiple-selector .tag-list[data-v-2a532f24] {
|
|
907
905
|
display: flex;
|
|
908
906
|
flex-wrap: wrap;
|
|
909
907
|
align-items: center;
|
|
910
908
|
}
|
|
911
|
-
.multiple-selector .tag-wrapper[data-v-
|
|
909
|
+
.multiple-selector .tag-wrapper[data-v-2a532f24] {
|
|
912
910
|
display: inline-flex;
|
|
913
911
|
align-items: center;
|
|
914
912
|
max-width: 100%;
|
|
915
913
|
}
|
|
916
|
-
.multiple-selector .search-input[data-v-
|
|
914
|
+
.multiple-selector .search-input[data-v-2a532f24] {
|
|
917
915
|
min-width: 10px;
|
|
918
916
|
height: 28px;
|
|
917
|
+
outline: none;
|
|
919
918
|
background: transparent;
|
|
920
919
|
border: none;
|
|
921
|
-
outline: none;
|
|
922
920
|
}
|
|
923
|
-
.multiple-selector .search-input[data-v-
|
|
921
|
+
.multiple-selector .search-input[data-v-2a532f24]::placeholder {
|
|
924
922
|
color: #c4c6cc;
|
|
925
923
|
}
|
|
926
|
-
.multiple-selector .search-input.inline[data-v-
|
|
924
|
+
.multiple-selector .search-input.inline[data-v-2a532f24] {
|
|
927
925
|
min-width: 10px;
|
|
928
926
|
}
|
|
929
|
-
.multiple-selector .search-input.last[data-v-
|
|
927
|
+
.multiple-selector .search-input.last[data-v-2a532f24], .multiple-selector .search-input.collapsed[data-v-2a532f24] {
|
|
930
928
|
flex: 1;
|
|
931
929
|
}
|
|
932
|
-
.hidden-users[data-v-
|
|
930
|
+
.hidden-users[data-v-2a532f24] {
|
|
933
931
|
padding: 6px 10px;
|
|
934
|
-
}.single-selector[data-v-
|
|
932
|
+
}.single-selector[data-v-cbe352a6] {
|
|
935
933
|
position: relative;
|
|
936
934
|
width: 100%;
|
|
937
935
|
}
|
|
938
|
-
.single-selector.is-disabled[data-v-
|
|
936
|
+
.single-selector.is-disabled[data-v-cbe352a6] {
|
|
939
937
|
pointer-events: none;
|
|
940
938
|
}
|
|
941
|
-
.input-container[data-v-
|
|
939
|
+
.input-container[data-v-cbe352a6] {
|
|
942
940
|
position: relative;
|
|
943
941
|
display: flex;
|
|
944
942
|
align-items: center;
|
|
@@ -948,25 +946,27 @@ optgroup {
|
|
|
948
946
|
border: 1px solid #c4c6cc;
|
|
949
947
|
border-radius: 2px;
|
|
950
948
|
}
|
|
951
|
-
.input-container[data-v-
|
|
949
|
+
.input-container[data-v-cbe352a6]:focus-within {
|
|
952
950
|
border-color: #3a84ff;
|
|
953
951
|
box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);
|
|
954
952
|
}
|
|
955
|
-
.search-input[data-v-
|
|
953
|
+
.search-input[data-v-cbe352a6] {
|
|
956
954
|
flex: 1;
|
|
957
955
|
height: 30px;
|
|
956
|
+
outline: none;
|
|
958
957
|
background: transparent;
|
|
959
958
|
border: none;
|
|
960
|
-
outline: none;
|
|
961
959
|
}
|
|
962
|
-
.search-input[data-v-
|
|
960
|
+
.search-input[data-v-cbe352a6]::placeholder {
|
|
963
961
|
color: #c4c6cc;
|
|
964
|
-
}.bk-user-selector[data-v-
|
|
962
|
+
}.bk-user-selector[data-v-f29cda5a] {
|
|
965
963
|
position: relative;
|
|
966
964
|
width: 100%;
|
|
967
965
|
font-size: 12px;
|
|
968
966
|
}
|
|
969
|
-
.bk-user-selector.is-disabled[data-v-
|
|
967
|
+
.bk-user-selector.is-disabled[data-v-f29cda5a] {
|
|
970
968
|
cursor: not-allowed;
|
|
971
969
|
background-color: #dcdee5;
|
|
970
|
+
}.bk-user-selector-popover.bk-user-selector-pop2-content {
|
|
971
|
+
padding: 0;
|
|
972
972
|
}
|
package/vue3/index.es.min.js
CHANGED
|
@@ -8,15 +8,11 @@ const generateCallbackName = () => {
|
|
|
8
8
|
const jsonpRequest = (requestUrl, options = {}) => {
|
|
9
9
|
return new Promise((resolve, reject) => {
|
|
10
10
|
const url = unref(requestUrl);
|
|
11
|
-
const { timeout = 1e3 * 60 * 2, params
|
|
11
|
+
const { timeout = 1e3 * 60 * 2, params } = options;
|
|
12
12
|
const callbackName = generateCallbackName();
|
|
13
13
|
const script = document.createElement("script");
|
|
14
|
-
let timeoutId;
|
|
15
|
-
|
|
16
|
-
script.crossOrigin = "use-credentials";
|
|
17
|
-
} else {
|
|
18
|
-
script.crossOrigin = "anonymous";
|
|
19
|
-
}
|
|
14
|
+
let timeoutId = null;
|
|
15
|
+
script.setAttribute("type", "text/javascript");
|
|
20
16
|
const cleanup = () => {
|
|
21
17
|
if (timeoutId) {
|
|
22
18
|
clearTimeout(timeoutId);
|
|
@@ -3262,7 +3258,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
3262
3258
|
}
|
|
3263
3259
|
return target;
|
|
3264
3260
|
};
|
|
3265
|
-
const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
|
3261
|
+
const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-ef4a05c4"]]);
|
|
3266
3262
|
const UserRender = defineComponent({
|
|
3267
3263
|
name: "UserRender",
|
|
3268
3264
|
props: {
|
|
@@ -3437,22 +3433,22 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3437
3433
|
};
|
|
3438
3434
|
return (_ctx, _cache) => {
|
|
3439
3435
|
return openBlock(), createBlock(unref(Popover), {
|
|
3440
|
-
"ext-cls": "bk-user-selector-popover",
|
|
3441
3436
|
arrow: false,
|
|
3437
|
+
"ext-cls": "bk-user-selector-popover",
|
|
3442
3438
|
"is-show": __props.isShow,
|
|
3443
3439
|
offset: { mainAxis: 4, crossAxis: __props.crossAxisOffset },
|
|
3444
|
-
width: __props.containerWidth,
|
|
3445
3440
|
placement: "bottom-start",
|
|
3446
3441
|
theme: "light",
|
|
3447
3442
|
trigger: "manual",
|
|
3443
|
+
width: __props.containerWidth,
|
|
3448
3444
|
onClickoutside: handleClickOutside
|
|
3449
3445
|
}, {
|
|
3450
3446
|
content: withCtx(() => [
|
|
3451
3447
|
createVNode(unref(Loading), {
|
|
3452
3448
|
class: "dropdown-content",
|
|
3453
3449
|
loading: __props.loading,
|
|
3454
|
-
|
|
3455
|
-
|
|
3450
|
+
mode: "spin",
|
|
3451
|
+
size: "mini"
|
|
3456
3452
|
}, {
|
|
3457
3453
|
default: withCtx(() => [
|
|
3458
3454
|
__props.options.length === 0 && __props.userGroup.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
@@ -3468,8 +3464,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3468
3464
|
{ key: 1 },
|
|
3469
3465
|
renderList(groupedUsers.value, (group, groupName) => {
|
|
3470
3466
|
return openBlock(), createElementBlock("div", {
|
|
3471
|
-
|
|
3472
|
-
|
|
3467
|
+
key: groupName,
|
|
3468
|
+
class: "user-group"
|
|
3473
3469
|
}, [
|
|
3474
3470
|
Object.keys(groupedUsers.value).length > 1 || group.some((user) => user.type === "userGroup") ? (openBlock(), createElementBlock("div", {
|
|
3475
3471
|
key: 0,
|
|
@@ -3497,8 +3493,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3497
3493
|
null,
|
|
3498
3494
|
renderList(group, (user) => {
|
|
3499
3495
|
return openBlock(), createElementBlock("div", {
|
|
3500
|
-
class: "user-option",
|
|
3501
3496
|
key: user.id,
|
|
3497
|
+
class: "user-option",
|
|
3502
3498
|
onClick: withModifiers(($event) => selectUser(user), ["prevent"])
|
|
3503
3499
|
}, [
|
|
3504
3500
|
createVNode(unref(UserRender), {
|
|
@@ -3531,20 +3527,20 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3531
3527
|
};
|
|
3532
3528
|
}
|
|
3533
3529
|
});
|
|
3534
|
-
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
3530
|
+
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-78875ea6"]]);
|
|
3535
3531
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3536
3532
|
...{
|
|
3537
3533
|
name: "UserTag"
|
|
3538
3534
|
},
|
|
3539
3535
|
__name: "user-tag",
|
|
3540
3536
|
props: {
|
|
3541
|
-
|
|
3542
|
-
tenants: {},
|
|
3537
|
+
active: { type: Boolean },
|
|
3543
3538
|
currentTenantId: {},
|
|
3544
3539
|
draggable: { type: Boolean },
|
|
3545
|
-
|
|
3540
|
+
renderTag: { type: Function },
|
|
3546
3541
|
showTenant: { type: Boolean },
|
|
3547
|
-
|
|
3542
|
+
tenants: {},
|
|
3543
|
+
user: {}
|
|
3548
3544
|
},
|
|
3549
3545
|
emits: ["click", "close"],
|
|
3550
3546
|
setup(__props, { emit: __emit }) {
|
|
@@ -3577,7 +3573,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3577
3573
|
};
|
|
3578
3574
|
}
|
|
3579
3575
|
});
|
|
3580
|
-
const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
3576
|
+
const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-48ac8fc1"]]);
|
|
3581
3577
|
const _hoisted_1$1 = ["onClick"];
|
|
3582
3578
|
const _hoisted_2$1 = ["placeholder"];
|
|
3583
3579
|
const _hoisted_3 = { class: "hidden-users" };
|
|
@@ -3588,24 +3584,25 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3588
3584
|
},
|
|
3589
3585
|
__name: "multiple-selector",
|
|
3590
3586
|
props: {
|
|
3591
|
-
modelValue: { default: () => [] },
|
|
3592
3587
|
draggable: { type: Boolean, default: false },
|
|
3588
|
+
freePaste: { type: Boolean, default: false },
|
|
3589
|
+
modelValue: { default: () => [] },
|
|
3593
3590
|
selectedUsers: { default: () => [] },
|
|
3594
3591
|
tenants: { default: () => ({}) },
|
|
3592
|
+
allowCreate: { type: Boolean, default: false },
|
|
3595
3593
|
apiBaseUrl: { default: "" },
|
|
3596
|
-
tenantId: { default: "" },
|
|
3597
|
-
placeholder: { default: "" },
|
|
3598
3594
|
currentUserId: { default: "" },
|
|
3595
|
+
disabled: { type: Boolean },
|
|
3596
|
+
emptyText: { default: "" },
|
|
3597
|
+
enableMultiTenantMode: { type: Boolean },
|
|
3599
3598
|
exactSearchKey: { default: "bk_username" },
|
|
3600
|
-
|
|
3599
|
+
excludeUserIds: { default: () => [] },
|
|
3600
|
+
placeholder: { default: "" },
|
|
3601
|
+
tenantId: { default: "" },
|
|
3601
3602
|
userGroupName: { default: "" },
|
|
3602
|
-
emptyText: { default: "" },
|
|
3603
|
-
disabled: { type: Boolean },
|
|
3604
3603
|
renderListItem: {},
|
|
3605
3604
|
renderTag: {},
|
|
3606
|
-
|
|
3607
|
-
enableMultiTenantMode: { type: Boolean },
|
|
3608
|
-
allowCreate: { type: Boolean, default: false }
|
|
3605
|
+
userGroup: { default: () => [] }
|
|
3609
3606
|
},
|
|
3610
3607
|
emits: [
|
|
3611
3608
|
"update:selectedUsers",
|
|
@@ -3706,7 +3703,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3706
3703
|
});
|
|
3707
3704
|
};
|
|
3708
3705
|
const handleClickOutside = (event) => {
|
|
3709
|
-
event.stopPropagation();
|
|
3710
3706
|
const target = event.target;
|
|
3711
3707
|
const container = containerRef.value;
|
|
3712
3708
|
if ((container == null ? void 0 : container.contains(target)) || container === target) {
|
|
@@ -3808,7 +3804,37 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3808
3804
|
}
|
|
3809
3805
|
});
|
|
3810
3806
|
const updatedUsers = Array.from(userMap.values());
|
|
3811
|
-
|
|
3807
|
+
if (props.freePaste) {
|
|
3808
|
+
const pastedUsers = usersList.map((user) => ({
|
|
3809
|
+
id: user,
|
|
3810
|
+
name: user,
|
|
3811
|
+
type: "custom",
|
|
3812
|
+
tenantId: "",
|
|
3813
|
+
login_name: user
|
|
3814
|
+
}));
|
|
3815
|
+
pastedUsers.forEach((user) => {
|
|
3816
|
+
if (!updatedUsers.some((item) => item.login_name === user.login_name)) {
|
|
3817
|
+
addUser(user);
|
|
3818
|
+
}
|
|
3819
|
+
});
|
|
3820
|
+
} else {
|
|
3821
|
+
emit("update:selectedUsers", updatedUsers);
|
|
3822
|
+
}
|
|
3823
|
+
} else {
|
|
3824
|
+
if (props.freePaste) {
|
|
3825
|
+
const pastedUsers = usersList.map((user) => ({
|
|
3826
|
+
id: user,
|
|
3827
|
+
name: user,
|
|
3828
|
+
type: "custom",
|
|
3829
|
+
tenantId: "",
|
|
3830
|
+
login_name: user
|
|
3831
|
+
}));
|
|
3832
|
+
pastedUsers.forEach((user) => {
|
|
3833
|
+
if (!props.selectedUsers.some((item) => item.login_name === user.login_name)) {
|
|
3834
|
+
addUser(user);
|
|
3835
|
+
}
|
|
3836
|
+
});
|
|
3837
|
+
}
|
|
3812
3838
|
}
|
|
3813
3839
|
} catch (error) {
|
|
3814
3840
|
console.error("精准查找用户失败:", error);
|
|
@@ -3830,7 +3856,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3830
3856
|
removeUser(lastUser);
|
|
3831
3857
|
}
|
|
3832
3858
|
} else if (event.key === "Enter" && props.allowCreate) {
|
|
3833
|
-
addUser({
|
|
3859
|
+
addUser({
|
|
3860
|
+
id: searchQuery.value,
|
|
3861
|
+
name: searchQuery.value,
|
|
3862
|
+
type: "custom",
|
|
3863
|
+
tenantId: "",
|
|
3864
|
+
login_name: searchQuery.value
|
|
3865
|
+
});
|
|
3834
3866
|
}
|
|
3835
3867
|
};
|
|
3836
3868
|
const addUser = (user) => {
|
|
@@ -3954,8 +3986,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3954
3986
|
null,
|
|
3955
3987
|
renderList(_ctx.selectedUsers, (user, index) => {
|
|
3956
3988
|
return openBlock(), createElementBlock("div", {
|
|
3957
|
-
class: "tag-wrapper",
|
|
3958
3989
|
key: user.id,
|
|
3990
|
+
class: "tag-wrapper",
|
|
3959
3991
|
onClick: withModifiers(($event) => handleTagClick(index), ["stop"])
|
|
3960
3992
|
}, [
|
|
3961
3993
|
createVNode(UserTag, {
|
|
@@ -3976,8 +4008,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3976
4008
|
ref_for: true,
|
|
3977
4009
|
ref_key: "inlineInputRef",
|
|
3978
4010
|
ref: inlineInputRef,
|
|
3979
|
-
class: "search-input inline",
|
|
3980
4011
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchQuery) ? searchQuery.value = $event : null),
|
|
4012
|
+
class: "search-input inline",
|
|
3981
4013
|
onFocus: handleInputFocus,
|
|
3982
4014
|
onInput: handleInput,
|
|
3983
4015
|
onKeydown: handleKeyDown,
|
|
@@ -3999,8 +4031,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3999
4031
|
key: 0,
|
|
4000
4032
|
ref_key: "lastInputRef",
|
|
4001
4033
|
ref: lastInputRef,
|
|
4002
|
-
class: "search-input last",
|
|
4003
4034
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(searchQuery) ? searchQuery.value = $event : null),
|
|
4035
|
+
class: "search-input last",
|
|
4004
4036
|
placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
|
|
4005
4037
|
onFocus: handleInputFocus,
|
|
4006
4038
|
onInput: handleInput,
|
|
@@ -4041,8 +4073,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
4041
4073
|
null,
|
|
4042
4074
|
renderList(visibleUsers.value, (user) => {
|
|
4043
4075
|
return openBlock(), createBlock(UserTag, {
|
|
4044
|
-
"current-tenant-id": _ctx.tenantId,
|
|
4045
4076
|
key: user.id,
|
|
4077
|
+
"current-tenant-id": _ctx.tenantId,
|
|
4046
4078
|
"render-tag": _ctx.renderTag,
|
|
4047
4079
|
"show-tenant": true,
|
|
4048
4080
|
tenants: _ctx.tenants,
|
|
@@ -4097,8 +4129,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
4097
4129
|
withDirectives(createElementVNode("input", {
|
|
4098
4130
|
ref_key: "collapsedInputRef",
|
|
4099
4131
|
ref: collapsedInputRef,
|
|
4100
|
-
class: "search-input collapsed",
|
|
4101
4132
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(searchQuery) ? searchQuery.value = $event : null),
|
|
4133
|
+
class: "search-input collapsed",
|
|
4102
4134
|
placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
|
|
4103
4135
|
onFocus: handleFocus
|
|
4104
4136
|
}, null, 40, _hoisted_4), [
|
|
@@ -4129,7 +4161,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
4129
4161
|
};
|
|
4130
4162
|
}
|
|
4131
4163
|
});
|
|
4132
|
-
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
4164
|
+
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-2a532f24"]]);
|
|
4133
4165
|
const _hoisted_1 = { class: "input-container" };
|
|
4134
4166
|
const _hoisted_2 = ["placeholder"];
|
|
4135
4167
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
@@ -4140,20 +4172,21 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4140
4172
|
props: {
|
|
4141
4173
|
modelValue: { default: "" },
|
|
4142
4174
|
tenants: {},
|
|
4175
|
+
allowCreate: { type: Boolean },
|
|
4143
4176
|
apiBaseUrl: { default: "" },
|
|
4144
|
-
tenantId: { default: "" },
|
|
4145
|
-
placeholder: { default: "" },
|
|
4146
4177
|
currentUserId: { default: "" },
|
|
4178
|
+
disabled: { type: Boolean },
|
|
4179
|
+
emptyText: { default: "" },
|
|
4180
|
+
enableMultiTenantMode: { type: Boolean },
|
|
4147
4181
|
exactSearchKey: { default: "bk_username" },
|
|
4148
|
-
|
|
4182
|
+
excludeUserIds: { default: () => [] },
|
|
4183
|
+
freePaste: { type: Boolean },
|
|
4184
|
+
placeholder: { default: "" },
|
|
4185
|
+
tenantId: { default: "" },
|
|
4149
4186
|
userGroupName: { default: "" },
|
|
4150
|
-
emptyText: { default: "" },
|
|
4151
|
-
disabled: { type: Boolean },
|
|
4152
4187
|
renderListItem: {},
|
|
4153
4188
|
renderTag: {},
|
|
4154
|
-
|
|
4155
|
-
enableMultiTenantMode: { type: Boolean },
|
|
4156
|
-
allowCreate: { type: Boolean }
|
|
4189
|
+
userGroup: { default: () => [] }
|
|
4157
4190
|
},
|
|
4158
4191
|
emits: ["update:modelValue", "change", "focus", "blur"],
|
|
4159
4192
|
setup(__props, { emit: __emit }) {
|
|
@@ -4251,6 +4284,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4251
4284
|
const fetchUsers = async (keyword = "") => {
|
|
4252
4285
|
if (!(keyword == null ? void 0 : keyword.length)) {
|
|
4253
4286
|
options.value = [];
|
|
4287
|
+
isLoading.value = false;
|
|
4254
4288
|
return;
|
|
4255
4289
|
}
|
|
4256
4290
|
isLoading.value = true;
|
|
@@ -4283,6 +4317,18 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4283
4317
|
}
|
|
4284
4318
|
}
|
|
4285
4319
|
};
|
|
4320
|
+
const handlePaste = (event) => {
|
|
4321
|
+
var _a;
|
|
4322
|
+
event.preventDefault();
|
|
4323
|
+
const pastedText = ((_a = event.clipboardData) == null ? void 0 : _a.getData("text").trim()) || "";
|
|
4324
|
+
if (props.freePaste) {
|
|
4325
|
+
const customUser = { id: pastedText, name: pastedText, type: "custom", tenantId: "", login_name: pastedText };
|
|
4326
|
+
if (!options.value.some((item) => item.login_name === customUser.login_name)) {
|
|
4327
|
+
options.value.push(customUser);
|
|
4328
|
+
}
|
|
4329
|
+
addUser(customUser);
|
|
4330
|
+
}
|
|
4331
|
+
};
|
|
4286
4332
|
const addUser = (user) => {
|
|
4287
4333
|
selectedUser.value = user.id;
|
|
4288
4334
|
searchQuery.value = "";
|
|
@@ -4298,9 +4344,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4298
4344
|
}
|
|
4299
4345
|
emit("focus");
|
|
4300
4346
|
};
|
|
4347
|
+
let timer = null;
|
|
4301
4348
|
const handleInput = () => {
|
|
4302
|
-
fetchUsers(searchQuery.value);
|
|
4303
4349
|
showDropdown.value = searchQuery.value.length >= 1;
|
|
4350
|
+
isLoading.value = true;
|
|
4351
|
+
clearTimeout(timer);
|
|
4352
|
+
timer = setTimeout(() => {
|
|
4353
|
+
fetchUsers(searchQuery.value);
|
|
4354
|
+
}, 300);
|
|
4304
4355
|
};
|
|
4305
4356
|
const handleClickOutside = () => {
|
|
4306
4357
|
setTimeout(() => {
|
|
@@ -4359,13 +4410,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4359
4410
|
withDirectives(createElementVNode("input", {
|
|
4360
4411
|
ref_key: "inputRef",
|
|
4361
4412
|
ref: inputRef,
|
|
4362
|
-
class: "search-input",
|
|
4363
4413
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
|
|
4414
|
+
class: "search-input",
|
|
4364
4415
|
placeholder: selectedUserInfo.value ? "" : _ctx.placeholder,
|
|
4365
4416
|
onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur")),
|
|
4366
4417
|
onFocus: handleInputFocus,
|
|
4367
4418
|
onInput: handleInput,
|
|
4368
|
-
onKeydown: handleKeyDown
|
|
4419
|
+
onKeydown: handleKeyDown,
|
|
4420
|
+
onPaste: handlePaste
|
|
4369
4421
|
}, null, 40, _hoisted_2), [
|
|
4370
4422
|
[vModelText, searchQuery.value]
|
|
4371
4423
|
]),
|
|
@@ -4389,30 +4441,31 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4389
4441
|
};
|
|
4390
4442
|
}
|
|
4391
4443
|
});
|
|
4392
|
-
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
4444
|
+
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-cbe352a6"]]);
|
|
4393
4445
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4394
4446
|
...{
|
|
4395
4447
|
name: "BkUserSelector"
|
|
4396
4448
|
},
|
|
4397
4449
|
__name: "user-selector",
|
|
4398
4450
|
props: {
|
|
4399
|
-
modelValue: { default: "" },
|
|
4400
4451
|
draggable: { type: Boolean, default: false },
|
|
4452
|
+
modelValue: { default: "" },
|
|
4401
4453
|
multiple: { type: Boolean, default: false },
|
|
4454
|
+
allowCreate: { type: Boolean, default: false },
|
|
4402
4455
|
apiBaseUrl: { default: "" },
|
|
4403
|
-
tenantId: { default: "" },
|
|
4404
|
-
placeholder: { default: "" },
|
|
4405
4456
|
currentUserId: { default: "" },
|
|
4457
|
+
disabled: { type: Boolean, default: false },
|
|
4458
|
+
emptyText: { default: "" },
|
|
4459
|
+
enableMultiTenantMode: { type: Boolean, default: true },
|
|
4406
4460
|
exactSearchKey: { default: "bk_username" },
|
|
4407
|
-
|
|
4461
|
+
excludeUserIds: { default: () => [] },
|
|
4462
|
+
freePaste: { type: Boolean, default: false },
|
|
4463
|
+
placeholder: { default: "" },
|
|
4464
|
+
tenantId: { default: "" },
|
|
4408
4465
|
userGroupName: { default: "" },
|
|
4409
|
-
emptyText: { default: "" },
|
|
4410
|
-
disabled: { type: Boolean, default: false },
|
|
4411
4466
|
renderListItem: {},
|
|
4412
4467
|
renderTag: {},
|
|
4413
|
-
|
|
4414
|
-
enableMultiTenantMode: { type: Boolean, default: true },
|
|
4415
|
-
allowCreate: { type: Boolean, default: false }
|
|
4468
|
+
userGroup: { default: () => [] }
|
|
4416
4469
|
},
|
|
4417
4470
|
emits: ["update:modelValue", "change", "dragStart", "dragEnd", "focus", "blur"],
|
|
4418
4471
|
setup(__props, { emit: __emit }) {
|
|
@@ -4535,10 +4588,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4535
4588
|
tenants: unref(tenants),
|
|
4536
4589
|
"user-group": _ctx.userGroup,
|
|
4537
4590
|
"user-group-name": userGroupName.value,
|
|
4591
|
+
"free-paste": _ctx.freePaste,
|
|
4538
4592
|
onBlur: handleBlur,
|
|
4539
4593
|
onChange: handleUpdateUser,
|
|
4540
4594
|
onFocus: handleFocus
|
|
4541
|
-
}, null, 8, ["modelValue", "allow-create", "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(
|
|
4595
|
+
}, null, 8, ["modelValue", "allow-create", "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", "free-paste"])) : (openBlock(), createElementBlock(
|
|
4542
4596
|
Fragment,
|
|
4543
4597
|
{ key: 1 },
|
|
4544
4598
|
[
|
|
@@ -4563,12 +4617,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4563
4617
|
tenants: unref(tenants),
|
|
4564
4618
|
"user-group": _ctx.userGroup,
|
|
4565
4619
|
"user-group-name": userGroupName.value,
|
|
4620
|
+
"free-paste": _ctx.freePaste,
|
|
4566
4621
|
onBlur: handleBlur,
|
|
4567
4622
|
onDragEnd: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("dragEnd", $event)),
|
|
4568
4623
|
onDragStart: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("dragStart", $event)),
|
|
4569
4624
|
onFocus: handleFocus,
|
|
4570
4625
|
"onUpdate:selectedUsers": handleUpdateSelectedUsers
|
|
4571
|
-
}, null, 8, ["modelValue", "allow-create", "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"])
|
|
4626
|
+
}, null, 8, ["modelValue", "allow-create", "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", "free-paste"])
|
|
4572
4627
|
],
|
|
4573
4628
|
2112
|
|
4574
4629
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
@@ -4580,7 +4635,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4580
4635
|
};
|
|
4581
4636
|
}
|
|
4582
4637
|
});
|
|
4583
|
-
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4638
|
+
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f29cda5a"]]);
|
|
4584
4639
|
export {
|
|
4585
4640
|
BkUserSelector,
|
|
4586
4641
|
BkUserSelector as default
|