@blueking/bk-user-selector 0.0.23-beta.1 → 0.0.24

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 CHANGED
@@ -1,9 +1,13 @@
1
- # 蓝鲸用户人员选择器组件
1
+ # 蓝鲸多租户人员选择器组件
2
2
 
3
- 蓝鲸用户人员选择器(BkUserSelector)是一个用于在蓝鲸系统中选择用户的组件,支持单选和多选模式,具备搜索、跨租户查询等功能。
3
+ [![npm version](https://badge.fury.io/js/%40blueking%2Fbk-user-selector.svg)](https://badge.fury.io/js/%40blueking%2Fbk-user-selector)
4
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ 蓝鲸多租户人员选择器(BkUserSelector)是一个用于在蓝鲸系统中选择用户的组件,支持单选和多选模式,具备搜索、跨租户查询等功能。
4
7
 
5
8
  ## 特性
6
9
 
10
+ - 支持 Vue2 和 Vue3 双版本
7
11
  - 支持单选和多选模式
8
12
  - 支持用户搜索功能
9
13
  - 支持跨租户显示
@@ -22,21 +26,12 @@ npm install @blueking/bk-user-selector
22
26
  ### 在 Vue3 中使用
23
27
 
24
28
  ```javascript
25
- // 全局注册
26
- import { createApp } from 'vue';
27
29
  import BkUserSelector from '@blueking/bk-user-selector';
28
30
  import '@blueking/bk-user-selector/vue3/vue3.css';
29
31
 
30
- const app = createApp(App);
31
- app.use(BkUserSelector);
32
- app.mount('#app');
33
-
34
- // 或者局部注册
35
- import { UserSelector } from '@blueking/bk-user-selector';
36
-
37
32
  export default {
38
33
  components: {
39
- BkUserSelector: UserSelector,
34
+ BkUserSelector,
40
35
  },
41
36
  };
42
37
  ```
@@ -46,6 +41,12 @@ export default {
46
41
  ```javascript
47
42
  import BkUserSelector from '@blueking/bk-user-selector/vue2';
48
43
  import '@blueking/bk-user-selector/vue2/vue2.css';
44
+
45
+ export default {
46
+ components: {
47
+ BkUserSelector,
48
+ },
49
+ };
49
50
  ```
50
51
 
51
52
  ### 基本用法
@@ -140,6 +141,7 @@ import '@blueking/bk-user-selector/vue2/vue2.css';
140
141
  | emptyText | 无匹配人员时的提示文本 | String | 无匹配人员 |
141
142
  | renderTag | 渲染标签 | Function(h, userInfo) => VNode | - |
142
143
  | renderListItem | 渲染列表项 | Function(h, userInfo) => VNode | - |
144
+ | excludeUserIds | 排除的用户ID列表 | Array | [] |
143
145
 
144
146
  ### 事件
145
147
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/bk-user-selector",
3
- "version": "0.0.23-beta.1",
3
+ "version": "0.0.24",
4
4
  "description": "蓝鲸用户选择器",
5
5
  "license": "MIT",
6
6
  "author": "Tencent BlueKing",
@@ -1,4 +1,4 @@
1
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
1
+ declare const _default: import("vue").DefineComponent<{
2
2
  /**
3
3
  * 当前用户ID
4
4
  */
@@ -13,7 +13,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
13
13
  type: BooleanConstructor;
14
14
  default: boolean;
15
15
  };
16
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
17
  click: (...args: any[]) => void;
18
18
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
19
  /**
@@ -30,10 +30,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
30
30
  type: BooleanConstructor;
31
31
  default: boolean;
32
32
  };
33
- }>> & Readonly<{
33
+ }>> & {
34
34
  onClick?: ((...args: any[]) => any) | undefined;
35
- }>, {
35
+ }, {
36
36
  currentUserId: string;
37
37
  isDisabled: boolean;
38
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
38
+ }, {}>;
39
39
  export default _default;
@@ -1,13 +1,41 @@
1
1
  import { FormattedUser, MultipleSelectorProps } from '../types';
2
- declare const _default: import("vue").DefineComponent<MultipleSelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MultipleSelectorProps>, {
3
+ modelValue: () => never[];
4
+ placeholder: string;
5
+ draggable: boolean;
6
+ apiBaseUrl: string;
7
+ tenantId: string;
8
+ selectedUsers: () => never[];
9
+ tenants: () => {};
10
+ currentUserId: string;
11
+ exactSearchKey: string;
12
+ userGroup: () => never[];
13
+ userGroupName: string;
14
+ emptyText: string;
15
+ excludeUserIds: () => never[];
16
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
17
  "update:selectedUsers": (...args: any[]) => void;
4
18
  "add-user": (...args: any[]) => void;
5
19
  "remove-user": (...args: any[]) => void;
6
- }, string, import("vue").PublicProps, Readonly<MultipleSelectorProps> & Readonly<{
20
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MultipleSelectorProps>, {
21
+ modelValue: () => never[];
22
+ placeholder: string;
23
+ draggable: boolean;
24
+ apiBaseUrl: string;
25
+ tenantId: string;
26
+ selectedUsers: () => never[];
27
+ tenants: () => {};
28
+ currentUserId: string;
29
+ exactSearchKey: string;
30
+ userGroup: () => never[];
31
+ userGroupName: string;
32
+ emptyText: string;
33
+ excludeUserIds: () => never[];
34
+ }>>> & {
7
35
  "onUpdate:selectedUsers"?: ((...args: any[]) => any) | undefined;
8
36
  "onAdd-user"?: ((...args: any[]) => any) | undefined;
9
37
  "onRemove-user"?: ((...args: any[]) => any) | undefined;
10
- }>, {
38
+ }, {
11
39
  tenantId: string;
12
40
  currentUserId: string;
13
41
  tenants: Record<string, string>;
@@ -28,5 +56,23 @@ declare const _default: import("vue").DefineComponent<MultipleSelectorProps, {},
28
56
  apiBaseUrl: string;
29
57
  placeholder: string;
30
58
  exactSearchKey: string;
31
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
59
+ excludeUserIds: string[];
60
+ }, {}>;
32
61
  export default _default;
62
+ type __VLS_WithDefaults<P, D> = {
63
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
64
+ default: D[K];
65
+ }> : P[K];
66
+ };
67
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
68
+ type __VLS_TypePropsToOption<T> = {
69
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
70
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
71
+ } : {
72
+ type: import('vue').PropType<T[K]>;
73
+ required: true;
74
+ };
75
+ };
76
+ type __VLS_PrettifyLocal<T> = {
77
+ [K in keyof T]: T[K];
78
+ } & {};
@@ -0,0 +1,8 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ renderTag: FunctionConstructor;
3
+ userInfo: ObjectConstructor;
4
+ }, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
5
+ renderTag: FunctionConstructor;
6
+ userInfo: ObjectConstructor;
7
+ }>>, {}, {}>;
8
+ export default _default;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { createVNode, VNode } from 'vue';
5
5
  import { FormattedUser } from '../types';
6
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
+ declare const _default: import("vue").DefineComponent<{
7
7
  /**
8
8
  * 是否显示下拉菜单
9
9
  */
@@ -91,7 +91,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
91
91
  renderListItem: {
92
92
  type: () => (h: typeof createVNode, item: FormattedUser) => VNode;
93
93
  };
94
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
94
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
95
95
  "select-user": (...args: any[]) => void;
96
96
  "click-outside": (...args: any[]) => void;
97
97
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -182,10 +182,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
182
182
  renderListItem: {
183
183
  type: () => (h: typeof createVNode, item: FormattedUser) => VNode;
184
184
  };
185
- }>> & Readonly<{
185
+ }>> & {
186
186
  "onSelect-user"?: ((...args: any[]) => any) | undefined;
187
187
  "onClick-outside"?: ((...args: any[]) => any) | undefined;
188
- }>, {
188
+ }, {
189
189
  tenantId: string;
190
190
  tenants: Record<string, string>;
191
191
  isShow: boolean;
@@ -201,5 +201,5 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
201
201
  }[];
202
202
  userGroupName: string;
203
203
  emptyText: string;
204
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
204
+ }, {}>;
205
205
  export default _default;
@@ -1,11 +1,33 @@
1
1
  import { SingleSelectorProps } from '../types';
2
- declare const _default: import("vue").DefineComponent<SingleSelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<SingleSelectorProps>, {
3
+ apiBaseUrl: string;
4
+ tenantId: string;
5
+ placeholder: string;
6
+ modelValue: string;
7
+ currentUserId: string;
8
+ exactSearchKey: string;
9
+ userGroup: () => never[];
10
+ userGroupName: string;
11
+ emptyText: string;
12
+ excludeUserIds: () => never[];
13
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
14
  change: (...args: any[]) => void;
4
15
  "update:modelValue": (...args: any[]) => void;
5
- }, string, import("vue").PublicProps, Readonly<SingleSelectorProps> & Readonly<{
16
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<SingleSelectorProps>, {
17
+ apiBaseUrl: string;
18
+ tenantId: string;
19
+ placeholder: string;
20
+ modelValue: string;
21
+ currentUserId: string;
22
+ exactSearchKey: string;
23
+ userGroup: () => never[];
24
+ userGroupName: string;
25
+ emptyText: string;
26
+ excludeUserIds: () => never[];
27
+ }>>> & {
6
28
  onChange?: ((...args: any[]) => any) | undefined;
7
29
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
8
- }>, {
30
+ }, {
9
31
  tenantId: string;
10
32
  currentUserId: string;
11
33
  userGroup: {
@@ -23,5 +45,23 @@ declare const _default: import("vue").DefineComponent<SingleSelectorProps, {}, {
23
45
  apiBaseUrl: string;
24
46
  placeholder: string;
25
47
  exactSearchKey: string;
26
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
48
+ excludeUserIds: string[];
49
+ }, {}>;
27
50
  export default _default;
51
+ type __VLS_WithDefaults<P, D> = {
52
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
53
+ default: D[K];
54
+ }> : P[K];
55
+ };
56
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
57
+ type __VLS_TypePropsToOption<T> = {
58
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
59
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
60
+ } : {
61
+ type: import('vue').PropType<T[K]>;
62
+ required: true;
63
+ };
64
+ };
65
+ type __VLS_PrettifyLocal<T> = {
66
+ [K in keyof T]: T[K];
67
+ } & {};
@@ -1,5 +1,5 @@
1
1
  import type { FormattedUser } from '../types';
2
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ declare const _default: import("vue").DefineComponent<{
3
3
  user: {
4
4
  type: () => FormattedUser;
5
5
  required: true;
@@ -16,7 +16,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
16
16
  type: FunctionConstructor;
17
17
  required: false;
18
18
  };
19
- }>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
20
  user: {
21
21
  type: () => FormattedUser;
22
22
  required: true;
@@ -33,5 +33,5 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
33
33
  type: FunctionConstructor;
34
34
  required: false;
35
35
  };
36
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
36
+ }>>, {}, {}>;
37
37
  export default _default;
@@ -1,11 +1,37 @@
1
1
  import { UserSelectorProps } from '../types';
2
- declare const _default: import("vue").DefineComponent<UserSelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<UserSelectorProps>, {
3
+ apiBaseUrl: string;
4
+ tenantId: string;
5
+ placeholder: string;
6
+ modelValue: string;
7
+ draggable: boolean;
8
+ multiple: boolean;
9
+ currentUserId: string;
10
+ exactSearchKey: string;
11
+ userGroup: () => never[];
12
+ userGroupName: string;
13
+ emptyText: string;
14
+ excludeUserIds: () => never[];
15
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
16
  change: (...args: any[]) => void;
4
17
  "update:modelValue": (...args: any[]) => void;
5
- }, string, import("vue").PublicProps, Readonly<UserSelectorProps> & Readonly<{
18
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<UserSelectorProps>, {
19
+ apiBaseUrl: string;
20
+ tenantId: string;
21
+ placeholder: string;
22
+ modelValue: string;
23
+ draggable: boolean;
24
+ multiple: boolean;
25
+ currentUserId: string;
26
+ exactSearchKey: string;
27
+ userGroup: () => never[];
28
+ userGroupName: string;
29
+ emptyText: string;
30
+ excludeUserIds: () => never[];
31
+ }>>> & {
6
32
  onChange?: ((...args: any[]) => any) | undefined;
7
33
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
8
- }>, {
34
+ }, {
9
35
  tenantId: string;
10
36
  currentUserId: string;
11
37
  userGroup: {
@@ -25,6 +51,24 @@ declare const _default: import("vue").DefineComponent<UserSelectorProps, {}, {},
25
51
  apiBaseUrl: string;
26
52
  placeholder: string;
27
53
  exactSearchKey: string;
54
+ excludeUserIds: string[];
28
55
  multiple: boolean;
29
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
56
+ }, {}>;
30
57
  export default _default;
58
+ type __VLS_WithDefaults<P, D> = {
59
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
60
+ default: D[K];
61
+ }> : P[K];
62
+ };
63
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
64
+ type __VLS_TypePropsToOption<T> = {
65
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
66
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
67
+ } : {
68
+ type: import('vue').PropType<T[K]>;
69
+ required: true;
70
+ };
71
+ };
72
+ type __VLS_PrettifyLocal<T> = {
73
+ [K in keyof T]: T[K];
74
+ } & {};
@@ -1,9 +1,6 @@
1
1
  import { createVNode, VNode } from 'vue';
2
2
  import { FormattedUser } from '../types';
3
- /**
4
- * 组件属性
5
- */
6
- type __VLS_Props = {
3
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
7
4
  /**
8
5
  * 用户信息
9
6
  */
@@ -32,12 +29,49 @@ type __VLS_Props = {
32
29
  * 渲染标签
33
30
  */
34
31
  renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
35
- };
36
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
37
33
  click: (...args: any[]) => void;
38
34
  close: (...args: any[]) => void;
39
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
35
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
36
+ /**
37
+ * 用户信息
38
+ */
39
+ user: FormattedUser;
40
+ /**
41
+ * 租户数据映射
42
+ */
43
+ tenants: Record<string, string>;
44
+ /**
45
+ * 当前租户ID
46
+ */
47
+ currentTenantId: string;
48
+ /**
49
+ * 是否可拖拽
50
+ */
51
+ draggable?: boolean;
52
+ /**
53
+ * 是否激活状态
54
+ */
55
+ active?: boolean;
56
+ /**
57
+ * 是否显示租户信息
58
+ */
59
+ showTenant?: boolean;
60
+ /**
61
+ * 渲染标签
62
+ */
63
+ renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
64
+ }>>> & {
40
65
  onClick?: ((...args: any[]) => any) | undefined;
41
66
  onClose?: ((...args: any[]) => any) | undefined;
42
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
67
+ }, {}, {}>;
43
68
  export default _default;
69
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
70
+ type __VLS_TypePropsToOption<T> = {
71
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
72
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
73
+ } : {
74
+ type: import('vue').PropType<T[K]>;
75
+ required: true;
76
+ };
77
+ };
@@ -10,7 +10,7 @@ import { type Ref } from 'vue';
10
10
  * @returns 租户数据和加载状态
11
11
  */
12
12
  export declare const useTenantData: (apiBaseUrl: string, tenantId: string) => {
13
- tenants: Ref<Record<string, string>, Record<string, string>>;
14
- loading: Ref<boolean, boolean>;
13
+ tenants: Ref<Record<string, string>>;
14
+ loading: Ref<boolean>;
15
15
  fetchTenants: () => Promise<void>;
16
16
  };
@@ -11,9 +11,9 @@ import { type FormattedUser } from '../types';
11
11
  * @returns 用户搜索相关状态和方法
12
12
  */
13
13
  export declare const useUserSearch: (apiBaseUrl: string, tenantId: string) => {
14
- searchResults: Ref<FormattedUser[], FormattedUser[]>;
15
- loading: Ref<boolean, boolean>;
16
- searchQuery: Ref<string, string>;
14
+ searchResults: Ref<FormattedUser[]>;
15
+ loading: Ref<boolean>;
16
+ searchQuery: Ref<string>;
17
17
  performSearch: (keyword: string) => Promise<void>;
18
18
  handleSearchInput: (value: string) => void;
19
19
  clearSearch: () => void;
@@ -115,6 +115,10 @@ interface BaseSelectorProps {
115
115
  * 渲染标签
116
116
  */
117
117
  renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
118
+ /**
119
+ * 排除的用户ID列表
120
+ */
121
+ excludeUserIds?: string[];
118
122
  }
119
123
  /**
120
124
  * 用户选择器属性
package/typings/vue2.d.ts CHANGED
@@ -1,10 +1,16 @@
1
1
  import BkUserSelector from './components/user-selector.vue';
2
2
  declare const _default: {
3
- created(): void;
4
3
  model: {
5
4
  prop: string;
6
5
  event: string;
7
6
  };
7
+ beforeDestroy(): void;
8
+ created(): void;
9
+ data(): {
10
+ app: null;
11
+ unWatchStack: never[];
12
+ };
13
+ mounted(): void;
8
14
  name: string;
9
15
  props: any;
10
16
  render(createElement: any): any;