@blueking/bk-user-selector 0.0.38-beta.1 → 0.0.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/bk-user-selector",
3
- "version": "0.0.38-beta.1",
3
+ "version": "0.0.38",
4
4
  "description": "蓝鲸用户选择器",
5
5
  "license": "MIT",
6
6
  "author": "Tencent BlueKing",
@@ -66,4 +66,4 @@
66
66
  "engines": {
67
67
  "node": ">=18.16.0"
68
68
  }
69
- }
69
+ }
@@ -1,4 +1,4 @@
1
- import type { FormattedUser, Tenant, User } from '../types';
1
+ import { type User, type Tenant, type FormattedUser } from '../types';
2
2
  /**
3
3
  * 获取本租户所有数据来源的租户信息
4
4
  * @param apiBaseUrl - API基础URL
@@ -15,9 +15,9 @@ export declare const getTenants: (apiBaseUrl: string, tenantId: string) => Promi
15
15
  */
16
16
  export declare const searchUsers: (params: {
17
17
  apiBaseUrl: string;
18
- enableMultiTenantMode?: boolean;
19
- keyword: string;
20
18
  tenantId: string;
19
+ keyword: string;
20
+ enableMultiTenantMode?: boolean;
21
21
  }) => Promise<User[]>;
22
22
  /**
23
23
  * 批量精准查找用户
@@ -29,10 +29,10 @@ export declare const searchUsers: (params: {
29
29
  */
30
30
  export declare const lookupUsers: (params: {
31
31
  apiBaseUrl: string;
32
- enableMultiTenantMode?: boolean;
33
- exactSearchKey: string;
34
32
  tenantId: string;
33
+ exactSearchKey: string;
35
34
  usersList: string[];
35
+ enableMultiTenantMode?: boolean;
36
36
  }) => Promise<User[]>;
37
37
  /**
38
38
  * 将API返回的用户数据格式化为组件所需格式
@@ -47,9 +47,9 @@ export declare const formatUsers: (users: User[], enableMultiTenantMode?: boolea
47
47
  * @returns 用户列表
48
48
  */
49
49
  export declare const getUserList: (url: string, params: {
50
- appCode?: string;
50
+ userIds?: string[];
51
51
  keyword?: string;
52
- page?: number;
53
52
  pageSize?: number;
54
- userIds?: string[];
53
+ page?: number;
54
+ appCode?: string;
55
55
  }) => Promise<User[]>;
@@ -22,21 +22,21 @@ declare const _default: import("vue").DefineComponent<MultipleSelectorProps, {},
22
22
  currentUserId: string;
23
23
  tenants: Record<string, string>;
24
24
  userGroup: {
25
+ id: string;
26
+ name: string;
25
27
  hidden
26
28
  /**
27
29
  * 多选模式用户选择器组件
28
30
  */
29
31
  ?: boolean;
30
- id: string;
31
- name: string;
32
32
  }[];
33
33
  userGroupName: string;
34
34
  emptyText: string;
35
35
  draggable: boolean;
36
36
  modelValue: string[];
37
37
  selectedUsers: FormattedUser[];
38
- allowCreate: boolean;
39
- excludeUserIds: string[];
40
38
  placeholder: string;
39
+ excludeUserIds: string[];
40
+ allowCreate: boolean;
41
41
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
42
  export default _default;
@@ -76,9 +76,9 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
76
76
  */
77
77
  userGroup: {
78
78
  type: () => {
79
- hidden?: boolean;
80
79
  id: string;
81
80
  name: string;
81
+ hidden?: boolean;
82
82
  }[];
83
83
  default: () => never[];
84
84
  };
@@ -167,9 +167,9 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
167
167
  */
168
168
  userGroup: {
169
169
  type: () => {
170
- hidden?: boolean;
171
170
  id: string;
172
171
  name: string;
172
+ hidden?: boolean;
173
173
  }[];
174
174
  default: () => never[];
175
175
  };
@@ -206,9 +206,9 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
206
206
  options: FormattedUser[];
207
207
  searchQuery: string;
208
208
  userGroup: {
209
- hidden?: boolean;
210
209
  id: string;
211
210
  name: string;
211
+ hidden?: boolean;
212
212
  }[];
213
213
  userGroupName: string;
214
214
  emptyText: string;
@@ -15,18 +15,18 @@ declare const _default: import("vue").DefineComponent<SingleSelectorProps, {}, {
15
15
  exactSearchKey: string;
16
16
  currentUserId: string;
17
17
  userGroup: {
18
+ id: string;
19
+ name: string;
18
20
  hidden
19
21
  /**
20
22
  * 单选模式用户选择器组件
21
23
  */
22
24
  ?: boolean;
23
- id: string;
24
- name: string;
25
25
  }[];
26
26
  userGroupName: string;
27
27
  emptyText: string;
28
28
  modelValue: string;
29
- excludeUserIds: string[];
30
29
  placeholder: string;
30
+ excludeUserIds: string[];
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
32
  export default _default;
@@ -21,22 +21,22 @@ declare const _default: import("vue").DefineComponent<UserSelectorProps, {}, {},
21
21
  currentUserId: string;
22
22
  disabled: boolean;
23
23
  userGroup: {
24
+ id: string;
25
+ name: string;
24
26
  hidden
25
27
  /**
26
28
  * 蓝鲸用户选择器组件
27
29
  * @module components/UserSelector
28
30
  */
29
31
  ?: boolean;
30
- id: string;
31
- name: string;
32
32
  }[];
33
33
  userGroupName: string;
34
34
  emptyText: string;
35
35
  draggable: boolean;
36
36
  modelValue: string | string[];
37
- allowCreate: boolean;
38
- excludeUserIds: string[];
39
37
  placeholder: string;
38
+ excludeUserIds: string[];
39
+ allowCreate: boolean;
40
40
  multiple: boolean;
41
41
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
42
  export default _default;
@@ -2,9 +2,13 @@ import { createVNode, VNode } from 'vue';
2
2
  import { FormattedUser } from '../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  /**
5
- * 是否激活状态
5
+ * 用户信息
6
6
  */
7
- active?: boolean;
7
+ user: FormattedUser;
8
+ /**
9
+ * 租户数据映射
10
+ */
11
+ tenants: Record<string, string>;
8
12
  /**
9
13
  * 当前租户ID
10
14
  */
@@ -14,29 +18,29 @@ declare const _default: import("vue").DefineComponent<{
14
18
  */
15
19
  draggable?: boolean;
16
20
  /**
17
- * 渲染标签
21
+ * 是否激活状态
18
22
  */
19
- renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
23
+ active?: boolean;
20
24
  /**
21
25
  * 是否显示租户信息
22
26
  */
23
27
  showTenant?: boolean;
24
28
  /**
25
- * 租户数据映射
26
- */
27
- tenants: Record<string, string>;
28
- /**
29
- * 用户信息
29
+ * 渲染标签
30
30
  */
31
- user: FormattedUser;
31
+ renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
32
32
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
33
  click: (...args: any[]) => void;
34
34
  close: (...args: any[]) => void;
35
35
  }, string, import("vue").PublicProps, Readonly<{
36
36
  /**
37
- * 是否激活状态
37
+ * 用户信息
38
38
  */
39
- active?: boolean;
39
+ user: FormattedUser;
40
+ /**
41
+ * 租户数据映射
42
+ */
43
+ tenants: Record<string, string>;
40
44
  /**
41
45
  * 当前租户ID
42
46
  */
@@ -46,21 +50,17 @@ declare const _default: import("vue").DefineComponent<{
46
50
  */
47
51
  draggable?: boolean;
48
52
  /**
49
- * 渲染标签
53
+ * 是否激活状态
50
54
  */
51
- renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
55
+ active?: boolean;
52
56
  /**
53
57
  * 是否显示租户信息
54
58
  */
55
59
  showTenant?: boolean;
56
60
  /**
57
- * 租户数据映射
58
- */
59
- tenants: Record<string, string>;
60
- /**
61
- * 用户信息
61
+ * 渲染标签
62
62
  */
63
- user: FormattedUser;
63
+ renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
64
64
  }> & Readonly<{
65
65
  onClick?: ((...args: any[]) => any) | undefined;
66
66
  onClose?: ((...args: any[]) => any) | undefined;
@@ -1,19 +1,19 @@
1
1
  import { type MaybeRef, type ShallowRef } from 'vue';
2
2
  export interface JSONPOptions {
3
- /** 请求参数 */
4
- params?: Record<string, string | undefined>;
5
3
  /** 超时时间(毫秒),默认为 2 * 60 * 1000 */
6
4
  timeout?: number;
5
+ /** 请求参数 */
6
+ params?: Record<string, string | undefined>;
7
7
  /** 是否携带凭证(cookie),默认为 true */
8
8
  withCredentials?: boolean;
9
9
  }
10
10
  export interface JSONPResult<T> {
11
11
  /** 响应数据 */
12
- data: ShallowRef<null | T>;
13
- /** 错误信息 */
14
- error: ShallowRef<Error | null>;
12
+ data: ShallowRef<T | null>;
15
13
  /** 加载状态 */
16
14
  loading: ShallowRef<boolean>;
15
+ /** 错误信息 */
16
+ error: ShallowRef<Error | null>;
17
17
  /** 手动触发请求的函数 */
18
18
  refetch: () => void;
19
19
  }
@@ -3,7 +3,7 @@
3
3
  * @module hooks/useUserSearch
4
4
  */
5
5
  import { type Ref } from 'vue';
6
- import type { FormattedUser } from '../types';
6
+ import { type FormattedUser } from '../types';
7
7
  /**
8
8
  * 使用用户搜索的Hook
9
9
  * @param apiBaseUrl - API基础URL
@@ -1,63 +1,62 @@
1
- import type { createVNode } from 'vue';
1
+ import { type createVNode } from 'vue';
2
2
  import type { VNode } from 'vue';
3
3
  /**
4
- * 格式化后的用户信息
4
+ * 用户对象接口
5
5
  */
6
- export interface FormattedUser {
6
+ export interface User {
7
7
  /**
8
- * 其他属性
8
+ * 用户名
9
9
  */
10
- [key: string]: boolean | string | undefined;
10
+ bk_username: string;
11
11
  /**
12
- * 是否隐藏
12
+ * 显示名称
13
13
  */
14
- hidden?: boolean;
14
+ display_name: string;
15
15
  /**
16
- * 用户ID
16
+ * 所属租户ID
17
17
  */
18
- id: string;
18
+ owner_tenant_id: string;
19
19
  /**
20
- * 用户名称
20
+ * 数据源类型
21
21
  */
22
- name: string;
22
+ data_source_type: string;
23
23
  /**
24
- * 租户ID
24
+ * 全名
25
25
  */
26
- tenantId: string;
26
+ full_name: string;
27
+ /**
28
+ * 登录名, 对应内网企微英文名
29
+ */
30
+ login_name: string;
31
+ /**
32
+ * 用户名 旧版
33
+ */
34
+ username: string;
27
35
  }
28
36
  /**
29
- * 多选模式属性
37
+ * 格式化后的用户信息
30
38
  */
31
- export interface MultipleSelectorProps extends BaseSelectorProps {
32
- /**
33
- * 是否支持拖拽排序
34
- */
35
- draggable?: boolean;
39
+ export interface FormattedUser {
36
40
  /**
37
- * 选中的用户ID列表
41
+ * 用户ID
38
42
  */
39
- modelValue: string[];
43
+ id: string;
40
44
  /**
41
- * 已选用户列表
45
+ * 用户名称
42
46
  */
43
- selectedUsers: FormattedUser[];
47
+ name: string;
44
48
  /**
45
- * 租户信息映射
49
+ * 租户ID
46
50
  */
47
- tenants: Record<string, string>;
48
- }
49
- /**
50
- * 单选模式属性
51
- */
52
- export interface SingleSelectorProps extends BaseSelectorProps {
51
+ tenantId: string;
53
52
  /**
54
- * 选中的用户ID
53
+ * 是否隐藏
55
54
  */
56
- modelValue?: string;
55
+ hidden?: boolean;
57
56
  /**
58
- * 租户信息映射
57
+ * 其他属性
59
58
  */
60
- tenants: Record<string, string>;
59
+ [key: string]: boolean | string | undefined;
61
60
  }
62
61
  /**
63
62
  * 租户信息
@@ -73,118 +72,119 @@ export interface Tenant {
73
72
  name: string;
74
73
  }
75
74
  /**
76
- * 用户对象接口
75
+ * 基础选择器属性
77
76
  */
78
- export interface User {
79
- /**
80
- * 用户名
81
- */
82
- bk_username: string;
77
+ interface BaseSelectorProps {
83
78
  /**
84
- * 数据源类型
79
+ * 接口基础URL
85
80
  */
86
- data_source_type: string;
81
+ apiBaseUrl: string;
87
82
  /**
88
- * 显示名称
83
+ * 租户ID
89
84
  */
90
- display_name: string;
85
+ tenantId: string;
91
86
  /**
92
- * 全名
87
+ * 占位文字
93
88
  */
94
- full_name: string;
89
+ placeholder?: string;
95
90
  /**
96
- * 登录名, 对应内网企微英文名
91
+ * 本人ID
97
92
  */
98
- login_name: string;
93
+ currentUserId?: string;
99
94
  /**
100
- * 所属租户ID
95
+ * 精确查找key
101
96
  */
102
- owner_tenant_id: string;
97
+ exactSearchKey?: string;
103
98
  /**
104
- * 用户名 旧版
99
+ * 用户组配置
105
100
  */
106
- username: string;
107
- }
108
- /**
109
- * 用户选择器属性
110
- */
111
- export interface UserSelectorProps extends BaseSelectorProps {
101
+ userGroup?: {
102
+ id: string;
103
+ name: string;
104
+ hidden?: boolean;
105
+ }[];
112
106
  /**
113
- * 是否支持拖拽排序
107
+ * 用户组名称
114
108
  */
115
- draggable?: boolean;
109
+ userGroupName?: string;
116
110
  /**
117
- * 默认选中的用户(单选时为字符串,多选时为数组)
111
+ * 无匹配人员时的提示文本
118
112
  */
119
- modelValue?: string | string[];
113
+ emptyText?: string;
120
114
  /**
121
- * 是否多选
115
+ * 是否禁用
122
116
  */
123
- multiple?: boolean;
124
- }
125
- /**
126
- * 基础选择器属性
127
- */
128
- interface BaseSelectorProps {
117
+ disabled?: boolean;
129
118
  /**
130
- * 是否允许创建用户
119
+ * 渲染列表项
131
120
  */
132
- allowCreate?: boolean;
121
+ renderListItem?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
133
122
  /**
134
- * 接口基础URL
123
+ * 渲染标签
135
124
  */
136
- apiBaseUrl: string;
125
+ renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
137
126
  /**
138
- * 本人ID
127
+ * 排除的用户ID列表
139
128
  */
140
- currentUserId?: string;
129
+ excludeUserIds?: string[];
141
130
  /**
142
- * 是否禁用
131
+ * 是否启用多租户模式
143
132
  */
144
- disabled?: boolean;
133
+ enableMultiTenantMode?: boolean;
145
134
  /**
146
- * 无匹配人员时的提示文本
135
+ * 是否允许创建用户
147
136
  */
148
- emptyText?: string;
137
+ allowCreate?: boolean;
138
+ }
139
+ /**
140
+ * 用户选择器属性
141
+ */
142
+ export interface UserSelectorProps extends BaseSelectorProps {
149
143
  /**
150
- * 是否启用多租户模式
144
+ * 默认选中的用户(单选时为字符串,多选时为数组)
151
145
  */
152
- enableMultiTenantMode?: boolean;
146
+ modelValue?: string | string[];
153
147
  /**
154
- * 精确查找key
148
+ * 是否支持拖拽排序
155
149
  */
156
- exactSearchKey?: string;
150
+ draggable?: boolean;
157
151
  /**
158
- * 排除的用户ID列表
152
+ * 是否多选
159
153
  */
160
- excludeUserIds?: string[];
154
+ multiple?: boolean;
155
+ }
156
+ /**
157
+ * 单选模式属性
158
+ */
159
+ export interface SingleSelectorProps extends BaseSelectorProps {
161
160
  /**
162
- * 占位文字
161
+ * 选中的用户ID
163
162
  */
164
- placeholder?: string;
163
+ modelValue?: string;
165
164
  /**
166
- * 租户ID
165
+ * 租户信息映射
167
166
  */
168
- tenantId: string;
167
+ tenants: Record<string, string>;
168
+ }
169
+ /**
170
+ * 多选模式属性
171
+ */
172
+ export interface MultipleSelectorProps extends BaseSelectorProps {
169
173
  /**
170
- * 用户组名称
174
+ * 选中的用户ID列表
171
175
  */
172
- userGroupName?: string;
176
+ modelValue: string[];
173
177
  /**
174
- * 渲染列表项
178
+ * 是否支持拖拽排序
175
179
  */
176
- renderListItem?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
180
+ draggable?: boolean;
177
181
  /**
178
- * 渲染标签
182
+ * 已选用户列表
179
183
  */
180
- renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
184
+ selectedUsers: FormattedUser[];
181
185
  /**
182
- * 用户组配置
186
+ * 租户信息映射
183
187
  */
184
- userGroup?: {
185
- hidden?: boolean;
186
- id: string;
187
- name: string;
188
- }[];
188
+ tenants: Record<string, string>;
189
189
  }
190
190
  export {};
@@ -2,7 +2,7 @@
2
2
  * 通用工具函数
3
3
  * @module utils/common
4
4
  */
5
- import type { FormattedUser } from '../types';
5
+ import { type FormattedUser } from '../types';
6
6
  /**
7
7
  * 防抖函数
8
8
  * @param fn - 需要防抖的函数