@blueking/bk-user-selector 0.0.28 → 0.0.29-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/bk-user-selector",
3
- "version": "0.0.28",
3
+ "version": "0.0.29-beta.2",
4
4
  "description": "蓝鲸用户选择器",
5
5
  "license": "MIT",
6
6
  "author": "Tencent BlueKing",
@@ -65,8 +65,5 @@
65
65
  },
66
66
  "engines": {
67
67
  "node": ">=18.16.0"
68
- },
69
- "devDependencies": {
70
- "vite": "^6.2.2"
71
68
  }
72
69
  }
@@ -1,7 +1,3 @@
1
- /**
2
- * 用户选择器相关API
3
- * @module api/user
4
- */
5
1
  import { type User, type Tenant, type FormattedUser } from '../types';
6
2
  /**
7
3
  * 获取本租户所有数据来源的租户信息
@@ -17,7 +13,12 @@ export declare const getTenants: (apiBaseUrl: string, tenantId: string) => Promi
17
13
  * @param keyword - 搜索关键词
18
14
  * @returns 用户列表Promise
19
15
  */
20
- export declare const searchUsers: (apiBaseUrl?: string, tenantId?: string, keyword?: string) => Promise<User[]>;
16
+ export declare const searchUsers: (params: {
17
+ apiBaseUrl: string;
18
+ tenantId: string;
19
+ keyword: string;
20
+ enableMultiTenantMode?: boolean;
21
+ }) => Promise<User[]>;
21
22
  /**
22
23
  * 批量精准查找用户
23
24
  * @param apiBaseUrl - API基础URL
@@ -26,10 +27,29 @@ export declare const searchUsers: (apiBaseUrl?: string, tenantId?: string, keywo
26
27
  * @param exactSearchKey - 精确查找key
27
28
  * @returns 查找到的用户列表Promise
28
29
  */
29
- export declare const lookupUsers: (apiBaseUrl?: string, tenantId?: string, exactSearchKey?: string, usersList?: string[]) => Promise<User[]>;
30
+ export declare const lookupUsers: (params: {
31
+ apiBaseUrl: string;
32
+ tenantId: string;
33
+ exactSearchKey: string;
34
+ usersList: string[];
35
+ enableMultiTenantMode?: boolean;
36
+ }) => Promise<User[]>;
30
37
  /**
31
38
  * 将API返回的用户数据格式化为组件所需格式
32
39
  * @param users - API返回的用户列表
33
40
  * @returns 格式化后的用户列表
34
41
  */
35
42
  export declare const formatUsers: (users: User[]) => FormattedUser[];
43
+ /**
44
+ * 获取用户列表 兼容旧版本的人员选择器
45
+ * @param url 请求的 URL
46
+ * @param params 请求参数
47
+ * @returns 用户列表
48
+ */
49
+ export declare const getUserList: (url: string, params: {
50
+ userIds?: string[];
51
+ keyword?: string;
52
+ pageSize?: number;
53
+ page?: number;
54
+ appCode?: string;
55
+ }) => Promise<User[]>;
@@ -1,4 +1,4 @@
1
- declare const _default: import("vue").DefineComponent<{
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
2
  /**
3
3
  * 当前用户ID
4
4
  */
@@ -13,7 +13,7 @@ declare const _default: import("vue").DefineComponent<{
13
13
  type: BooleanConstructor;
14
14
  default: boolean;
15
15
  };
16
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ }>, {}, {}, {}, {}, 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<{
30
30
  type: BooleanConstructor;
31
31
  default: boolean;
32
32
  };
33
- }>> & {
33
+ }>> & Readonly<{
34
34
  onClick?: ((...args: any[]) => any) | undefined;
35
- }, {
35
+ }>, {
36
36
  currentUserId: string;
37
37
  isDisabled: boolean;
38
- }, {}>;
38
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
39
39
  export default _default;
@@ -1,42 +1,16 @@
1
1
  import { FormattedUser, MultipleSelectorProps } from '../types';
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, {
2
+ declare const _default: import("vue").DefineComponent<MultipleSelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
3
  "update:selectedUsers": (...args: any[]) => void;
18
4
  "add-user": (...args: any[]) => void;
19
5
  "remove-user": (...args: any[]) => void;
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
- }>>> & {
6
+ }, string, import("vue").PublicProps, Readonly<MultipleSelectorProps> & Readonly<{
35
7
  "onUpdate:selectedUsers"?: ((...args: any[]) => any) | undefined;
36
8
  "onAdd-user"?: ((...args: any[]) => any) | undefined;
37
9
  "onRemove-user"?: ((...args: any[]) => any) | undefined;
38
- }, {
10
+ }>, {
39
11
  tenantId: string;
12
+ apiBaseUrl: string;
13
+ exactSearchKey: string;
40
14
  currentUserId: string;
41
15
  tenants: Record<string, string>;
42
16
  userGroup: {
@@ -53,26 +27,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
53
27
  draggable: boolean;
54
28
  modelValue: string[];
55
29
  selectedUsers: FormattedUser[];
56
- apiBaseUrl: string;
57
30
  placeholder: string;
58
- exactSearchKey: string;
59
31
  excludeUserIds: string[];
60
- }, {}>;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
61
33
  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
- } & {};
@@ -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<{
6
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
7
7
  /**
8
8
  * 是否显示下拉菜单
9
9
  */
@@ -91,7 +91,7 @@ declare const _default: import("vue").DefineComponent<{
91
91
  renderListItem: {
92
92
  type: () => (h: typeof createVNode, item: FormattedUser) => VNode;
93
93
  };
94
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
94
+ }>, {}, {}, {}, {}, 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<{
182
182
  renderListItem: {
183
183
  type: () => (h: typeof createVNode, item: FormattedUser) => VNode;
184
184
  };
185
- }>> & {
185
+ }>> & Readonly<{
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<{
201
201
  }[];
202
202
  userGroupName: string;
203
203
  emptyText: string;
204
- }, {}>;
204
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
205
205
  export default _default;
@@ -1,34 +1,14 @@
1
1
  import { SingleSelectorProps } from '../types';
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, {
2
+ declare const _default: import("vue").DefineComponent<SingleSelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
3
  change: (...args: any[]) => void;
15
4
  "update:modelValue": (...args: any[]) => void;
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
- }>>> & {
5
+ }, string, import("vue").PublicProps, Readonly<SingleSelectorProps> & Readonly<{
28
6
  onChange?: ((...args: any[]) => any) | undefined;
29
7
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
30
- }, {
8
+ }>, {
31
9
  tenantId: string;
10
+ apiBaseUrl: string;
11
+ exactSearchKey: string;
32
12
  currentUserId: string;
33
13
  userGroup: {
34
14
  id: string;
@@ -42,26 +22,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
42
22
  userGroupName: string;
43
23
  emptyText: string;
44
24
  modelValue: string;
45
- apiBaseUrl: string;
46
25
  placeholder: string;
47
- exactSearchKey: string;
48
26
  excludeUserIds: string[];
49
- }, {}>;
27
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
50
28
  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<{
2
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
3
  user: {
4
4
  type: () => FormattedUser;
5
5
  required: true;
@@ -16,7 +16,7 @@ declare const _default: import("vue").DefineComponent<{
16
16
  type: FunctionConstructor;
17
17
  required: false;
18
18
  };
19
- }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ }>, () => any, {}, {}, {}, 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<{
33
33
  type: FunctionConstructor;
34
34
  required: false;
35
35
  };
36
- }>>, {}, {}>;
36
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
37
37
  export default _default;
@@ -1,40 +1,15 @@
1
1
  import { UserSelectorProps } from '../types';
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
- disabled: boolean;
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, {
2
+ declare const _default: import("vue").DefineComponent<UserSelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
3
  change: (...args: any[]) => void;
18
4
  "update:modelValue": (...args: any[]) => void;
19
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<UserSelectorProps>, {
20
- apiBaseUrl: string;
21
- tenantId: string;
22
- placeholder: string;
23
- modelValue: string;
24
- draggable: boolean;
25
- multiple: boolean;
26
- disabled: boolean;
27
- currentUserId: string;
28
- exactSearchKey: string;
29
- userGroup: () => never[];
30
- userGroupName: string;
31
- emptyText: string;
32
- excludeUserIds: () => never[];
33
- }>>> & {
5
+ }, string, import("vue").PublicProps, Readonly<UserSelectorProps> & Readonly<{
34
6
  onChange?: ((...args: any[]) => any) | undefined;
35
7
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
36
- }, {
8
+ }>, {
37
9
  tenantId: string;
10
+ apiBaseUrl: string;
11
+ enableMultiTenantMode: boolean;
12
+ exactSearchKey: string;
38
13
  currentUserId: string;
39
14
  disabled: boolean;
40
15
  userGroup: {
@@ -51,27 +26,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
51
26
  emptyText: string;
52
27
  draggable: boolean;
53
28
  modelValue: string | string[];
54
- apiBaseUrl: string;
55
29
  placeholder: string;
56
- exactSearchKey: string;
57
30
  excludeUserIds: string[];
58
31
  multiple: boolean;
59
- }, {}>;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
60
33
  export default _default;
61
- type __VLS_WithDefaults<P, D> = {
62
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
63
- default: D[K];
64
- }> : P[K];
65
- };
66
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
67
- type __VLS_TypePropsToOption<T> = {
68
- [K in keyof T]-?: {} extends Pick<T, K> ? {
69
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
70
- } : {
71
- type: import('vue').PropType<T[K]>;
72
- required: true;
73
- };
74
- };
75
- type __VLS_PrettifyLocal<T> = {
76
- [K in keyof T]: T[K];
77
- } & {};
@@ -1,6 +1,6 @@
1
1
  import { createVNode, VNode } from 'vue';
2
2
  import { FormattedUser } from '../types';
3
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
3
+ declare const _default: import("vue").DefineComponent<{
4
4
  /**
5
5
  * 用户信息
6
6
  */
@@ -29,10 +29,10 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
29
29
  * 渲染标签
30
30
  */
31
31
  renderTag?: (h: typeof createVNode, userInfo: FormattedUser) => VNode;
32
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
32
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
33
  click: (...args: any[]) => void;
34
34
  close: (...args: any[]) => void;
35
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
35
+ }, string, import("vue").PublicProps, Readonly<{
36
36
  /**
37
37
  * 用户信息
38
38
  */
@@ -61,17 +61,8 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
61
61
  * 渲染标签
62
62
  */
63
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;
67
- }, {}, {}>;
67
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
68
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
- };
@@ -0,0 +1,29 @@
1
+ import { type MaybeRef, type ShallowRef } from 'vue';
2
+ export interface JSONPOptions {
3
+ /** 超时时间(毫秒),默认为 2 * 60 * 1000 */
4
+ timeout?: number;
5
+ /** 请求参数 */
6
+ params?: Record<string, string | undefined>;
7
+ }
8
+ export interface JSONPResult<T> {
9
+ /** 响应数据 */
10
+ data: ShallowRef<T | null>;
11
+ /** 加载状态 */
12
+ loading: ShallowRef<boolean>;
13
+ /** 错误信息 */
14
+ error: ShallowRef<Error | null>;
15
+ /** 手动触发请求的函数 */
16
+ refetch: () => void;
17
+ }
18
+ /**
19
+ * JSONP 请求函数
20
+ */
21
+ export declare const jsonpRequest: <T>(requestUrl: MaybeRef<string>, options?: JSONPOptions) => Promise<T>;
22
+ /**
23
+ * useJSONP
24
+ * @param url 请求的 URL,可以是字符串或 ref
25
+ * @param options JSONP 选项配置
26
+ * @returns JSONPResult 包含数据、加载状态、错误信息和重新请求函数
27
+ */
28
+ export declare const useJSONP: <T = unknown>(url: MaybeRef<string>, options?: JSONPOptions) => JSONPResult<T>;
29
+ export default useJSONP;
@@ -7,10 +7,11 @@ import { type Ref } from 'vue';
7
7
  * 使用租户数据的Hook
8
8
  * @param apiBaseUrl - API基础URL
9
9
  * @param tenantId - 租户ID
10
+ * @param enableMultiTenantMode - 是否启用多租户模式
10
11
  * @returns 租户数据和加载状态
11
12
  */
12
- export declare const useTenantData: (apiBaseUrl: string, tenantId: string) => {
13
- tenants: Ref<Record<string, string>>;
14
- loading: Ref<boolean>;
13
+ export declare const useTenantData: (apiBaseUrl: string, tenantId: string, enableMultiTenantMode?: boolean) => {
14
+ tenants: Ref<Record<string, string>, Record<string, string>>;
15
+ loading: Ref<boolean, boolean>;
15
16
  fetchTenants: () => Promise<void>;
16
17
  };
@@ -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[]>;
15
- loading: Ref<boolean>;
16
- searchQuery: Ref<string>;
14
+ searchResults: Ref<FormattedUser[], FormattedUser[]>;
15
+ loading: Ref<boolean, boolean>;
16
+ searchQuery: Ref<string, string>;
17
17
  performSearch: (keyword: string) => Promise<void>;
18
18
  handleSearchInput: (value: string) => void;
19
19
  clearSearch: () => void;
@@ -28,6 +28,10 @@ export interface User {
28
28
  * 登录名, 对应内网企微英文名
29
29
  */
30
30
  login_name: string;
31
+ /**
32
+ * 用户名 旧版
33
+ */
34
+ username: string;
31
35
  }
32
36
  /**
33
37
  * 格式化后的用户信息
@@ -123,6 +127,10 @@ interface BaseSelectorProps {
123
127
  * 排除的用户ID列表
124
128
  */
125
129
  excludeUserIds?: string[];
130
+ /**
131
+ * 是否启用多租户模式
132
+ */
133
+ enableMultiTenantMode?: boolean;
126
134
  }
127
135
  /**
128
136
  * 用户选择器属性