@blueking/bk-user-selector 0.1.4 → 0.1.5
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 +45 -0
- package/package.json +3 -6
- package/typings/components/me-tag.vue.d.ts +2 -1
- package/typings/components/selection-popover.vue.d.ts +7 -21
- package/typings/components/user-selector.vue.d.ts +6 -2
- package/typings/components/user-tag.vue.d.ts +8 -40
- package/typings/types/index.d.ts +17 -0
- package/vue2/config.json +22 -1
- package/vue2/index.es.min.js +11594 -19680
- package/vue2/index.iife.min.js +17827 -20765
- package/vue2/index.umd.min.js +12155 -20237
- package/vue2/vue2.css +45 -30
- package/vue3/config.json +22 -1
- package/vue3/index.es.min.js +4043 -4490
- package/vue3/index.iife.min.js +12103 -14018
- package/vue3/index.umd.min.js +4111 -4549
- package/vue3/vue3.css +44 -29
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
| 👥 **用户组** | 支持用户组/角色分组显示 |
|
|
21
21
|
| ✏️ **自定义输入** | 支持创建自定义用户和自由粘贴 |
|
|
22
22
|
| 🎭 **自定义渲染** | 支持自定义标签和列表项渲染 |
|
|
23
|
+
| 📝 **多行输入** | 支持 textarea 模式,完整展示所有标签 |
|
|
23
24
|
| ⌨️ **键盘导航** | 支持上下键切换选项、Enter 快速选中 |
|
|
24
25
|
|
|
25
26
|
## 📦 安装
|
|
@@ -232,6 +233,37 @@ export default {
|
|
|
232
233
|
</script>
|
|
233
234
|
```
|
|
234
235
|
|
|
236
|
+
### 多行输入模式(Textarea)
|
|
237
|
+
|
|
238
|
+
当需要展示大量已选用户时,可使用 textarea 模式完整展示所有标签:
|
|
239
|
+
|
|
240
|
+
```vue
|
|
241
|
+
<template>
|
|
242
|
+
<BkUserSelector
|
|
243
|
+
v-model="selectedUsers"
|
|
244
|
+
:api-base-url="apiBaseUrl"
|
|
245
|
+
:tenant-id="tenantId"
|
|
246
|
+
:multiple="true"
|
|
247
|
+
type="textarea"
|
|
248
|
+
:rows="4"
|
|
249
|
+
:resize="true"
|
|
250
|
+
@change="handleChange"
|
|
251
|
+
/>
|
|
252
|
+
</template>
|
|
253
|
+
|
|
254
|
+
<script setup>
|
|
255
|
+
import { ref } from 'vue';
|
|
256
|
+
|
|
257
|
+
const apiBaseUrl = ref('https://api.example.com');
|
|
258
|
+
const tenantId = ref('default');
|
|
259
|
+
const selectedUsers = ref([]);
|
|
260
|
+
|
|
261
|
+
const handleChange = users => {
|
|
262
|
+
console.log('Selected:', users);
|
|
263
|
+
};
|
|
264
|
+
</script>
|
|
265
|
+
```
|
|
266
|
+
|
|
235
267
|
### 排除指定用户
|
|
236
268
|
|
|
237
269
|
从下拉列表中排除特定用户:
|
|
@@ -286,6 +318,9 @@ export default {
|
|
|
286
318
|
| allowCreate | 是否允许自定义输入,按 Enter 确认 | `boolean` | `false` | 否 |
|
|
287
319
|
| freePaste | 是否允许粘贴任意文本 | `boolean` | `false` | 否 |
|
|
288
320
|
| maxCount | 最大可选数量(0 表示不限制) | `number` | `0` | 否 |
|
|
321
|
+
| type | 输入框类型 | `'input'` / `'textarea'` | `'input'` | 否 |
|
|
322
|
+
| rows | 默认行数(仅 textarea 模式生效) | `number` | `4` | 否 |
|
|
323
|
+
| resize | 是否允许拖拽调整高度(仅 textarea 模式生效) | `boolean` | `true` | 否 |
|
|
289
324
|
|
|
290
325
|
#### exactSearchKey 说明
|
|
291
326
|
|
|
@@ -360,6 +395,16 @@ type RenderFunction = (
|
|
|
360
395
|
- **开启(默认)**:使用多租户用户管理接口查询,支持跨租户显示
|
|
361
396
|
- **关闭**:使用原有用户管理接口查询
|
|
362
397
|
|
|
398
|
+
### 多行输入模式(Textarea)
|
|
399
|
+
|
|
400
|
+
通过 `type="textarea"` 启用多行模式:
|
|
401
|
+
|
|
402
|
+
- **完整展示**:未聚焦时不折叠标签,完整展示所有已选用户
|
|
403
|
+
- **高度可配**:通过 `rows` 设置默认行数,每行约 32px
|
|
404
|
+
- **可拖拽调整**:默认允许拖拽调整容器高度,可通过 `resize=false` 禁用
|
|
405
|
+
- **自动滚动**:内容超出容器高度时自动出现滚动条
|
|
406
|
+
- **聚焦同步**:切换聚焦/失焦状态时自动同步容器高度
|
|
407
|
+
|
|
363
408
|
### 拖拽排序
|
|
364
409
|
|
|
365
410
|
在多选模式下启用 `draggable`:
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueking/bk-user-selector",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "蓝鲸用户选择器",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Tencent BlueKing",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"prepublishOnly": "run-p build dts",
|
|
9
9
|
"dev": "vite --mode development -c scripts/vite.dev.ts",
|
|
10
|
-
"build": "
|
|
10
|
+
"build": "vite-node ./scripts/vite.build.ts",
|
|
11
11
|
"dts": "vue-tsc --project tsconfig.dts.json",
|
|
12
12
|
"prettier": "prettier ./src ./scripts ./playground --write",
|
|
13
13
|
"visualize": "vite-bundle-visualizer -c scripts/vite.visualizer.ts"
|
|
@@ -58,10 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"bkui-vue": "2.0.2-beta.63",
|
|
61
|
-
"lodash": "^4.17.
|
|
61
|
+
"lodash": "^4.17.23",
|
|
62
62
|
"sortablejs": "^1.15.6"
|
|
63
|
-
},
|
|
64
|
-
"engines": {
|
|
65
|
-
"node": ">=18.16.0"
|
|
66
63
|
}
|
|
67
64
|
}
|
|
@@ -7,7 +7,7 @@ interface MeTagProps {
|
|
|
7
7
|
/** 是否禁用 */
|
|
8
8
|
isDisabled?: boolean;
|
|
9
9
|
}
|
|
10
|
-
declare const
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<MeTagProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
11
|
click: () => any;
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<MeTagProps> & Readonly<{
|
|
13
13
|
onClick?: (() => any) | undefined;
|
|
@@ -15,4 +15,5 @@ declare const _default: import("vue").DefineComponent<MeTagProps, {}, {}, {}, {}
|
|
|
15
15
|
currentUserId: string;
|
|
16
16
|
isDisabled: boolean;
|
|
17
17
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
18
19
|
export default _default;
|
|
@@ -34,21 +34,11 @@ interface SelectionPopoverProps {
|
|
|
34
34
|
/** 用户组名称 */
|
|
35
35
|
userGroupName?: string;
|
|
36
36
|
}
|
|
37
|
-
declare var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
contentContainerRef: any;
|
|
41
|
-
slotContainerRef: any;
|
|
37
|
+
declare var __VLS_22: {};
|
|
38
|
+
type __VLS_Slots = {} & {
|
|
39
|
+
default?: (props: typeof __VLS_22) => any;
|
|
42
40
|
};
|
|
43
|
-
declare const
|
|
44
|
-
slots: {
|
|
45
|
-
default?(_: typeof __VLS_20): any;
|
|
46
|
-
};
|
|
47
|
-
refs: __VLS_PickRefsExpose<typeof __VLS_refs>;
|
|
48
|
-
attrs: Partial<typeof __VLS_inheritedAttrs>;
|
|
49
|
-
};
|
|
50
|
-
type __VLS_Slots = typeof __VLS_templateResult['slots'];
|
|
51
|
-
declare const __VLS_component: import("vue").DefineComponent<SelectionPopoverProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
41
|
+
declare const __VLS_base: import("vue").DefineComponent<SelectionPopoverProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
52
42
|
"click-outside": (event: MouseEvent) => any;
|
|
53
43
|
"select-user": (user: FormattedUser) => any;
|
|
54
44
|
}, string, import("vue").PublicProps, Readonly<SelectionPopoverProps> & Readonly<{
|
|
@@ -70,14 +60,10 @@ declare const __VLS_component: import("vue").DefineComponent<SelectionPopoverPro
|
|
|
70
60
|
options: FormattedUser[];
|
|
71
61
|
userGroupName: string;
|
|
72
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
73
|
-
declare const
|
|
63
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
64
|
+
declare const _default: typeof __VLS_export;
|
|
74
65
|
export default _default;
|
|
75
|
-
type
|
|
76
|
-
[K in keyof T]: (T[K] extends any[] ? Parameters<T[K][0]['expose']>[0][] : T[K] extends {
|
|
77
|
-
expose?: (exposed: infer E) => void;
|
|
78
|
-
} ? E : T[K]) | null;
|
|
79
|
-
} : never;
|
|
80
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
66
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
81
67
|
new (): {
|
|
82
68
|
$slots: S;
|
|
83
69
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormattedUser, UserSelectorProps } from '../types';
|
|
2
|
-
declare const
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<UserSelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
3
|
blur: () => any;
|
|
4
4
|
change: (user: FormattedUser | FormattedUser[] | null) => any;
|
|
5
5
|
focus: () => any;
|
|
@@ -15,6 +15,7 @@ declare const _default: import("vue").DefineComponent<UserSelectorProps, {}, {},
|
|
|
15
15
|
"onUpdate:modelValue"?: ((value: string | string[]) => any) | undefined;
|
|
16
16
|
}>, {
|
|
17
17
|
userGroup: import("../types").UserGroupConfig[];
|
|
18
|
+
type: "input" | "textarea";
|
|
18
19
|
apiBaseUrl: string;
|
|
19
20
|
tenantId: string;
|
|
20
21
|
enableMultiTenantMode: boolean;
|
|
@@ -24,14 +25,17 @@ declare const _default: import("vue").DefineComponent<UserSelectorProps, {}, {},
|
|
|
24
25
|
freePaste: boolean;
|
|
25
26
|
maxCount: number;
|
|
26
27
|
excludeUserIds: string[];
|
|
27
|
-
|
|
28
|
+
resize: boolean;
|
|
28
29
|
hasAvatar: boolean;
|
|
29
30
|
avatarBaseUrl: string;
|
|
30
31
|
emptyText: string;
|
|
31
32
|
userGroupName: string;
|
|
33
|
+
disabled: boolean;
|
|
32
34
|
draggable: boolean;
|
|
33
35
|
modelValue: string | string[];
|
|
34
36
|
multiple: boolean;
|
|
37
|
+
rows: number;
|
|
35
38
|
placeholder: string;
|
|
36
39
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
37
41
|
export default _default;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { createVNode, VNode } from 'vue';
|
|
2
2
|
import { FormattedUser } from '../types';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 组件属性
|
|
5
|
+
*/
|
|
6
|
+
type __VLS_Props = {
|
|
4
7
|
/**
|
|
5
8
|
* 是否激活状态
|
|
6
9
|
*/
|
|
@@ -37,48 +40,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
37
40
|
* 用户信息
|
|
38
41
|
*/
|
|
39
42
|
user: FormattedUser;
|
|
40
|
-
}
|
|
43
|
+
};
|
|
44
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
41
45
|
click: (...args: any[]) => void;
|
|
42
46
|
close: (...args: any[]) => void;
|
|
43
|
-
}, string, import("vue").PublicProps, Readonly<{
|
|
44
|
-
/**
|
|
45
|
-
* 是否激活状态
|
|
46
|
-
*/
|
|
47
|
-
active?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* 头像基础URL
|
|
50
|
-
*/
|
|
51
|
-
avatarBaseUrl?: string;
|
|
52
|
-
/**
|
|
53
|
-
* 当前租户ID
|
|
54
|
-
*/
|
|
55
|
-
currentTenantId: string;
|
|
56
|
-
/**
|
|
57
|
-
* 是否可拖拽
|
|
58
|
-
*/
|
|
59
|
-
draggable?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* 是否显示头像
|
|
62
|
-
*/
|
|
63
|
-
hasAvatar?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* 渲染标签
|
|
66
|
-
*/
|
|
67
|
-
renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
|
|
68
|
-
/**
|
|
69
|
-
* 是否显示租户信息
|
|
70
|
-
*/
|
|
71
|
-
showTenant?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* 租户数据映射
|
|
74
|
-
*/
|
|
75
|
-
tenants: Record<string, string>;
|
|
76
|
-
/**
|
|
77
|
-
* 用户信息
|
|
78
|
-
*/
|
|
79
|
-
user: FormattedUser;
|
|
80
|
-
}> & Readonly<{
|
|
47
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
81
48
|
onClick?: ((...args: any[]) => any) | undefined;
|
|
82
49
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
83
50
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
51
|
+
declare const _default: typeof __VLS_export;
|
|
84
52
|
export default _default;
|
package/typings/types/index.d.ts
CHANGED
|
@@ -220,6 +220,23 @@ export interface UserSelectorProps extends BaseSelectorProps {
|
|
|
220
220
|
* 是否多选
|
|
221
221
|
*/
|
|
222
222
|
multiple?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* 是否允许拖拽调整高度(仅 type='textarea' 时生效)
|
|
225
|
+
* @default true
|
|
226
|
+
*/
|
|
227
|
+
resize?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* 默认行数(仅 type='textarea' 时生效,每行约 32px)
|
|
230
|
+
* @default 4
|
|
231
|
+
*/
|
|
232
|
+
rows?: number;
|
|
233
|
+
/**
|
|
234
|
+
* 输入框类型
|
|
235
|
+
* - input: 单行模式(默认),固定高度,未聚焦时折叠标签
|
|
236
|
+
* - textarea: 多行模式,高度可配置,完整展示所有标签
|
|
237
|
+
* @default 'input'
|
|
238
|
+
*/
|
|
239
|
+
type?: 'input' | 'textarea';
|
|
223
240
|
}
|
|
224
241
|
/**
|
|
225
242
|
* 用户类型
|
package/vue2/config.json
CHANGED
|
@@ -1 +1,22 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"type": "bk-user-selector",
|
|
3
|
+
"name": "bk-user-selector",
|
|
4
|
+
"displayName": "人员选择器",
|
|
5
|
+
"framework": "vue2",
|
|
6
|
+
"styles": [],
|
|
7
|
+
"props": {
|
|
8
|
+
"modelValue": {
|
|
9
|
+
"type": [
|
|
10
|
+
"number",
|
|
11
|
+
"string"
|
|
12
|
+
],
|
|
13
|
+
"tips": "值"
|
|
14
|
+
},
|
|
15
|
+
"dataUrl": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"tips": "数据源接口"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"events": [],
|
|
21
|
+
"slots": {}
|
|
22
|
+
}
|