@blueking/bk-user-selector 0.0.25 → 0.0.26
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 +3 -3
- package/package.json +1 -1
- package/typings/components/user-selector.vue.d.ts +3 -0
- package/typings/types/index.d.ts +4 -0
- package/vue2/index.es.min.js +84 -74
- package/vue2/index.iife.min.js +85 -75
- package/vue2/index.umd.min.js +85 -75
- package/vue2/vue2.css +32 -23
- package/vue3/index.es.min.js +84 -74
- package/vue3/index.iife.min.js +85 -75
- package/vue3/index.umd.min.js +85 -75
- package/vue3/vue3.css +32 -23
- package/typings/components/render-tag.d.ts +0 -8
package/README.md
CHANGED
|
@@ -127,18 +127,18 @@ export default {
|
|
|
127
127
|
| 参数 | 说明 | 类型 | 默认值 |
|
|
128
128
|
| -------------------- | ----------------------------------------------------------------------- | ------------------------------ | ------------------ |
|
|
129
129
|
| modelValue / v-model | 绑定值,单选为字符串,多选为数组 | String / Array | '' / [] |
|
|
130
|
+
| apiBaseUrl | API 基础 URL | String | '' |
|
|
131
|
+
| tenantId | 租户 ID | String | '' |
|
|
130
132
|
| label | 文本标签 | String | 人员选择 |
|
|
131
|
-
| required | 是否必填 | Boolean | false |
|
|
132
133
|
| placeholder | 占位文本 | String | 请输入人员名称搜索 |
|
|
133
134
|
| multiple | 是否多选 | Boolean | false |
|
|
134
135
|
| draggable | 是否可拖拽(仅多选模式有效) | Boolean | false |
|
|
135
|
-
| apiBaseUrl | API 基础 URL | String | '' |
|
|
136
|
-
| tenantId | 租户 ID | String | '' |
|
|
137
136
|
| exactSearchKey | 精确查找key,可选值为 bk_username、login_name、full_name, 多个以逗号分隔 | String | bk_username |
|
|
138
137
|
| currentUserId | 当前用户ID(用于快速选择"我") | String | '' |
|
|
139
138
|
| userGroup | 用户组列表,用于在下拉列表中显示用户组 | Array | [] |
|
|
140
139
|
| userGroupName | 用户组名称,用于在下拉列表中显示用户组名称 | String | 用户群组 |
|
|
141
140
|
| emptyText | 无匹配人员时的提示文本 | String | 无匹配人员 |
|
|
141
|
+
| disabled | 是否禁用 | Boolean | false |
|
|
142
142
|
| renderTag | 渲染标签 | Function(h, userInfo) => VNode | - |
|
|
143
143
|
| renderListItem | 渲染列表项 | Function(h, userInfo) => VNode | - |
|
|
144
144
|
| excludeUserIds | 排除的用户ID列表 | Array | [] |
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
6
6
|
modelValue: string;
|
|
7
7
|
draggable: boolean;
|
|
8
8
|
multiple: boolean;
|
|
9
|
+
disabled: boolean;
|
|
9
10
|
currentUserId: string;
|
|
10
11
|
exactSearchKey: string;
|
|
11
12
|
userGroup: () => never[];
|
|
@@ -22,6 +23,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
22
23
|
modelValue: string;
|
|
23
24
|
draggable: boolean;
|
|
24
25
|
multiple: boolean;
|
|
26
|
+
disabled: boolean;
|
|
25
27
|
currentUserId: string;
|
|
26
28
|
exactSearchKey: string;
|
|
27
29
|
userGroup: () => never[];
|
|
@@ -34,6 +36,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
34
36
|
}, {
|
|
35
37
|
tenantId: string;
|
|
36
38
|
currentUserId: string;
|
|
39
|
+
disabled: boolean;
|
|
37
40
|
userGroup: {
|
|
38
41
|
id: string;
|
|
39
42
|
name: string;
|
package/typings/types/index.d.ts
CHANGED
package/vue2/index.es.min.js
CHANGED
|
@@ -14471,7 +14471,7 @@ const UserRender = defineComponent({
|
|
|
14471
14471
|
};
|
|
14472
14472
|
}
|
|
14473
14473
|
});
|
|
14474
|
-
const _hoisted_1$
|
|
14474
|
+
const _hoisted_1$2 = {
|
|
14475
14475
|
key: 0,
|
|
14476
14476
|
class: "no-data"
|
|
14477
14477
|
};
|
|
@@ -14616,7 +14616,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
14616
14616
|
mode: "spin"
|
|
14617
14617
|
}, {
|
|
14618
14618
|
default: withCtx(() => [
|
|
14619
|
-
__props.options.length === 0 && __props.userGroup.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
14619
|
+
__props.options.length === 0 && __props.userGroup.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
14620
14620
|
createElementVNode(
|
|
14621
14621
|
"span",
|
|
14622
14622
|
null,
|
|
@@ -14695,7 +14695,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
14695
14695
|
};
|
|
14696
14696
|
}
|
|
14697
14697
|
});
|
|
14698
|
-
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
14698
|
+
const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-e3741833"]]);
|
|
14699
14699
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
14700
14700
|
...{
|
|
14701
14701
|
name: "UserTag"
|
|
@@ -14741,7 +14741,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
14741
14741
|
}
|
|
14742
14742
|
});
|
|
14743
14743
|
const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-655f7a5a"]]);
|
|
14744
|
-
const _hoisted_1$
|
|
14744
|
+
const _hoisted_1$1 = ["onClick"];
|
|
14745
14745
|
const _hoisted_2$1 = ["placeholder"];
|
|
14746
14746
|
const _hoisted_3 = ["placeholder"];
|
|
14747
14747
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
@@ -14762,6 +14762,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
14762
14762
|
userGroup: { default: () => [] },
|
|
14763
14763
|
userGroupName: { default: "用户群组" },
|
|
14764
14764
|
emptyText: { default: "无匹配人员" },
|
|
14765
|
+
disabled: { type: Boolean },
|
|
14765
14766
|
renderListItem: {},
|
|
14766
14767
|
renderTag: {},
|
|
14767
14768
|
excludeUserIds: { default: () => [] }
|
|
@@ -15019,7 +15020,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
15019
15020
|
{
|
|
15020
15021
|
ref_key: "containerRef",
|
|
15021
15022
|
ref: containerRef,
|
|
15022
|
-
class: "multiple-selector"
|
|
15023
|
+
class: normalizeClass(["multiple-selector", { "is-disabled": _ctx.disabled }])
|
|
15023
15024
|
},
|
|
15024
15025
|
[
|
|
15025
15026
|
createCommentVNode(" 聚焦状态 - 可编辑模式 "),
|
|
@@ -15082,7 +15083,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
15082
15083
|
)), [
|
|
15083
15084
|
[vModelText, unref(searchQuery)]
|
|
15084
15085
|
]) : createCommentVNode("v-if", true)
|
|
15085
|
-
], 8, _hoisted_1$
|
|
15086
|
+
], 8, _hoisted_1$1);
|
|
15086
15087
|
}),
|
|
15087
15088
|
128
|
|
15088
15089
|
/* KEYED_FRAGMENT */
|
|
@@ -15227,14 +15228,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
15227
15228
|
onSelectUser: addUser
|
|
15228
15229
|
}, null, 8, ["container-width", "cross-axis-offset", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
15229
15230
|
],
|
|
15230
|
-
|
|
15231
|
-
/*
|
|
15231
|
+
2
|
|
15232
|
+
/* CLASS */
|
|
15232
15233
|
);
|
|
15233
15234
|
};
|
|
15234
15235
|
}
|
|
15235
15236
|
});
|
|
15236
|
-
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
15237
|
-
const _hoisted_1
|
|
15237
|
+
const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-19a0ebec"]]);
|
|
15238
|
+
const _hoisted_1 = { class: "input-container" };
|
|
15238
15239
|
const _hoisted_2 = ["placeholder"];
|
|
15239
15240
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
15240
15241
|
...{
|
|
@@ -15252,6 +15253,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
15252
15253
|
userGroup: { default: () => [] },
|
|
15253
15254
|
userGroupName: { default: "用户群组" },
|
|
15254
15255
|
emptyText: { default: "无匹配人员" },
|
|
15256
|
+
disabled: { type: Boolean },
|
|
15255
15257
|
renderListItem: {},
|
|
15256
15258
|
renderTag: {},
|
|
15257
15259
|
excludeUserIds: { default: () => [] }
|
|
@@ -15369,70 +15371,72 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
15369
15371
|
emit("update:modelValue", newVal);
|
|
15370
15372
|
});
|
|
15371
15373
|
return (_ctx, _cache) => {
|
|
15372
|
-
return withDirectives((openBlock(), createElementBlock(
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
|
|
15385
|
-
|
|
15386
|
-
|
|
15387
|
-
|
|
15388
|
-
|
|
15389
|
-
|
|
15390
|
-
|
|
15391
|
-
|
|
15392
|
-
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
|
|
15399
|
-
|
|
15400
|
-
|
|
15401
|
-
|
|
15374
|
+
return withDirectives((openBlock(), createElementBlock(
|
|
15375
|
+
"div",
|
|
15376
|
+
{
|
|
15377
|
+
ref_key: "containerRef",
|
|
15378
|
+
ref: containerRef,
|
|
15379
|
+
class: normalizeClass(["single-selector", { "is-disabled": _ctx.disabled }])
|
|
15380
|
+
},
|
|
15381
|
+
[
|
|
15382
|
+
createCommentVNode(" 输入框 "),
|
|
15383
|
+
createElementVNode("div", _hoisted_1, [
|
|
15384
|
+
createCommentVNode(" 用户标签显示 "),
|
|
15385
|
+
selectedUserInfo.value ? (openBlock(), createElementBlock("div", {
|
|
15386
|
+
key: 0,
|
|
15387
|
+
onClick: withModifiers(removeSelectedUser, ["stop"])
|
|
15388
|
+
}, [
|
|
15389
|
+
createVNode(UserTag, {
|
|
15390
|
+
"current-tenant-id": _ctx.tenantId,
|
|
15391
|
+
"render-tag": _ctx.renderTag,
|
|
15392
|
+
tenants: _ctx.tenants,
|
|
15393
|
+
user: selectedUserInfo.value,
|
|
15394
|
+
onClose: removeSelectedUser
|
|
15395
|
+
}, null, 8, ["current-tenant-id", "render-tag", "tenants", "user"])
|
|
15396
|
+
])) : createCommentVNode("v-if", true),
|
|
15397
|
+
withDirectives(createElementVNode("input", {
|
|
15398
|
+
ref_key: "inputRef",
|
|
15399
|
+
ref: inputRef,
|
|
15400
|
+
class: "search-input",
|
|
15401
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
|
|
15402
|
+
placeholder: selectedUserInfo.value ? "" : _ctx.placeholder,
|
|
15403
|
+
onFocus: handleInputFocus,
|
|
15404
|
+
onInput: handleInput
|
|
15405
|
+
}, null, 40, _hoisted_2), [
|
|
15406
|
+
[vModelText, searchQuery.value]
|
|
15407
|
+
]),
|
|
15408
|
+
createCommentVNode(' "我"标签 '),
|
|
15409
|
+
createVNode(MeTag, {
|
|
15410
|
+
"current-user-id": _ctx.currentUserId,
|
|
15411
|
+
"is-disabled": !!_ctx.currentUserId && !!selectedUserInfo.value && selectedUserInfo.value[_ctx.exactSearchKey] === _ctx.currentUserId,
|
|
15412
|
+
onClick: addCurrentUser
|
|
15413
|
+
}, null, 8, ["current-user-id", "is-disabled"])
|
|
15402
15414
|
]),
|
|
15403
|
-
createCommentVNode(
|
|
15404
|
-
createVNode(
|
|
15405
|
-
"
|
|
15406
|
-
"
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
|
|
15416
|
-
|
|
15417
|
-
"render-list-item"
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
"user-group-name": _ctx.userGroupName,
|
|
15423
|
-
onSelectUser: addUser
|
|
15424
|
-
}, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
15425
|
-
])), [
|
|
15415
|
+
createCommentVNode(" 使用新的公共下拉选项组件 "),
|
|
15416
|
+
createVNode(SelectionPopover, {
|
|
15417
|
+
"container-width": containerRef.value ? containerRef.value.offsetWidth : "auto",
|
|
15418
|
+
"empty-text": _ctx.emptyText,
|
|
15419
|
+
"is-show": showDropdown.value,
|
|
15420
|
+
loading: isLoading.value,
|
|
15421
|
+
options: options.value,
|
|
15422
|
+
"render-list-item": _ctx.renderListItem,
|
|
15423
|
+
"search-query": searchQuery.value,
|
|
15424
|
+
"tenant-id": _ctx.tenantId,
|
|
15425
|
+
tenants: _ctx.tenants,
|
|
15426
|
+
"user-group": userGroupFilter.value,
|
|
15427
|
+
"user-group-name": _ctx.userGroupName,
|
|
15428
|
+
onSelectUser: addUser
|
|
15429
|
+
}, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
15430
|
+
],
|
|
15431
|
+
2
|
|
15432
|
+
/* CLASS */
|
|
15433
|
+
)), [
|
|
15426
15434
|
[unref(__webpack_exports__clickoutside), handleClickOutside]
|
|
15427
15435
|
]);
|
|
15428
15436
|
};
|
|
15429
15437
|
}
|
|
15430
15438
|
});
|
|
15431
|
-
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
15432
|
-
const _hoisted_1 = {
|
|
15433
|
-
ref: "containerRef",
|
|
15434
|
-
class: "bk-user-selector"
|
|
15435
|
-
};
|
|
15439
|
+
const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-b6af00c3"]]);
|
|
15436
15440
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
15437
15441
|
...{
|
|
15438
15442
|
name: "BkUserSelector"
|
|
@@ -15450,6 +15454,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15450
15454
|
userGroup: { default: () => [] },
|
|
15451
15455
|
userGroupName: { default: "用户群组" },
|
|
15452
15456
|
emptyText: { default: "无匹配人员" },
|
|
15457
|
+
disabled: { type: Boolean, default: false },
|
|
15453
15458
|
renderListItem: {},
|
|
15454
15459
|
renderTag: {},
|
|
15455
15460
|
excludeUserIds: { default: () => [] }
|
|
@@ -15527,7 +15532,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15527
15532
|
return (_ctx, _cache) => {
|
|
15528
15533
|
return openBlock(), createElementBlock(
|
|
15529
15534
|
"section",
|
|
15530
|
-
|
|
15535
|
+
{
|
|
15536
|
+
ref: "containerRef",
|
|
15537
|
+
class: normalizeClass(["bk-user-selector", { "is-disabled": _ctx.disabled }])
|
|
15538
|
+
},
|
|
15531
15539
|
[
|
|
15532
15540
|
createCommentVNode(" 单选模式 "),
|
|
15533
15541
|
!_ctx.multiple ? (openBlock(), createBlock(SingleSelector, {
|
|
@@ -15536,6 +15544,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15536
15544
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedUser.value = $event),
|
|
15537
15545
|
"api-base-url": _ctx.apiBaseUrl,
|
|
15538
15546
|
"current-user-id": _ctx.currentUserId,
|
|
15547
|
+
disabled: _ctx.disabled,
|
|
15539
15548
|
"empty-text": _ctx.emptyText,
|
|
15540
15549
|
"exact-search-key": _ctx.exactSearchKey,
|
|
15541
15550
|
"exclude-user-ids": _ctx.excludeUserIds,
|
|
@@ -15547,7 +15556,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15547
15556
|
"user-group": _ctx.userGroup,
|
|
15548
15557
|
"user-group-name": _ctx.userGroupName,
|
|
15549
15558
|
onChange: handleUpdateUser
|
|
15550
|
-
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "empty-text", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "tenant-id", "tenants", "user-group", "user-group-name"])) : (openBlock(), createElementBlock(
|
|
15559
|
+
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "disabled", "empty-text", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "tenant-id", "tenants", "user-group", "user-group-name"])) : (openBlock(), createElementBlock(
|
|
15551
15560
|
Fragment,
|
|
15552
15561
|
{ key: 1 },
|
|
15553
15562
|
[
|
|
@@ -15557,6 +15566,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15557
15566
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedUserIds.value = $event),
|
|
15558
15567
|
"api-base-url": _ctx.apiBaseUrl,
|
|
15559
15568
|
"current-user-id": _ctx.currentUserId,
|
|
15569
|
+
disabled: _ctx.disabled,
|
|
15560
15570
|
draggable: _ctx.draggable,
|
|
15561
15571
|
"empty-text": _ctx.emptyText,
|
|
15562
15572
|
"exact-search-key": _ctx.exactSearchKey,
|
|
@@ -15570,19 +15580,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15570
15580
|
"user-group": _ctx.userGroup,
|
|
15571
15581
|
"user-group-name": _ctx.userGroupName,
|
|
15572
15582
|
"onUpdate:selectedUsers": handleUpdateSelectedUsers
|
|
15573
|
-
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "draggable", "empty-text", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
15583
|
+
}, null, 8, ["modelValue", "api-base-url", "current-user-id", "disabled", "draggable", "empty-text", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
|
|
15574
15584
|
],
|
|
15575
15585
|
2112
|
|
15576
15586
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
15577
15587
|
))
|
|
15578
15588
|
],
|
|
15579
|
-
|
|
15580
|
-
/*
|
|
15589
|
+
2
|
|
15590
|
+
/* CLASS */
|
|
15581
15591
|
);
|
|
15582
15592
|
};
|
|
15583
15593
|
}
|
|
15584
15594
|
});
|
|
15585
|
-
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
15595
|
+
const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c31311f7"]]);
|
|
15586
15596
|
const vue2 = {
|
|
15587
15597
|
model: {
|
|
15588
15598
|
prop: "modelValue",
|