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

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.23-beta.1",
3
+ "version": "0.0.23",
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,39 @@
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
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
16
  "update:selectedUsers": (...args: any[]) => void;
4
17
  "add-user": (...args: any[]) => void;
5
18
  "remove-user": (...args: any[]) => void;
6
- }, string, import("vue").PublicProps, Readonly<MultipleSelectorProps> & Readonly<{
19
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MultipleSelectorProps>, {
20
+ modelValue: () => never[];
21
+ placeholder: string;
22
+ draggable: boolean;
23
+ apiBaseUrl: string;
24
+ tenantId: string;
25
+ selectedUsers: () => never[];
26
+ tenants: () => {};
27
+ currentUserId: string;
28
+ exactSearchKey: string;
29
+ userGroup: () => never[];
30
+ userGroupName: string;
31
+ emptyText: string;
32
+ }>>> & {
7
33
  "onUpdate:selectedUsers"?: ((...args: any[]) => any) | undefined;
8
34
  "onAdd-user"?: ((...args: any[]) => any) | undefined;
9
35
  "onRemove-user"?: ((...args: any[]) => any) | undefined;
10
- }>, {
36
+ }, {
11
37
  tenantId: string;
12
38
  currentUserId: string;
13
39
  tenants: Record<string, string>;
@@ -28,5 +54,22 @@ declare const _default: import("vue").DefineComponent<MultipleSelectorProps, {},
28
54
  apiBaseUrl: string;
29
55
  placeholder: string;
30
56
  exactSearchKey: string;
31
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
57
+ }, {}>;
32
58
  export default _default;
59
+ type __VLS_WithDefaults<P, D> = {
60
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
61
+ default: D[K];
62
+ }> : P[K];
63
+ };
64
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
65
+ type __VLS_TypePropsToOption<T> = {
66
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
67
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
68
+ } : {
69
+ type: import('vue').PropType<T[K]>;
70
+ required: true;
71
+ };
72
+ };
73
+ type __VLS_PrettifyLocal<T> = {
74
+ [K in keyof T]: T[K];
75
+ } & {};
@@ -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,31 @@
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
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
13
  change: (...args: any[]) => void;
4
14
  "update:modelValue": (...args: any[]) => void;
5
- }, string, import("vue").PublicProps, Readonly<SingleSelectorProps> & Readonly<{
15
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<SingleSelectorProps>, {
16
+ apiBaseUrl: string;
17
+ tenantId: string;
18
+ placeholder: string;
19
+ modelValue: string;
20
+ currentUserId: string;
21
+ exactSearchKey: string;
22
+ userGroup: () => never[];
23
+ userGroupName: string;
24
+ emptyText: string;
25
+ }>>> & {
6
26
  onChange?: ((...args: any[]) => any) | undefined;
7
27
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
8
- }>, {
28
+ }, {
9
29
  tenantId: string;
10
30
  currentUserId: string;
11
31
  userGroup: {
@@ -23,5 +43,22 @@ declare const _default: import("vue").DefineComponent<SingleSelectorProps, {}, {
23
43
  apiBaseUrl: string;
24
44
  placeholder: string;
25
45
  exactSearchKey: string;
26
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
46
+ }, {}>;
27
47
  export default _default;
48
+ type __VLS_WithDefaults<P, D> = {
49
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
50
+ default: D[K];
51
+ }> : P[K];
52
+ };
53
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
54
+ type __VLS_TypePropsToOption<T> = {
55
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
56
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
57
+ } : {
58
+ type: import('vue').PropType<T[K]>;
59
+ required: true;
60
+ };
61
+ };
62
+ type __VLS_PrettifyLocal<T> = {
63
+ [K in keyof T]: T[K];
64
+ } & {};
@@ -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,35 @@
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
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
15
  change: (...args: any[]) => void;
4
16
  "update:modelValue": (...args: any[]) => void;
5
- }, string, import("vue").PublicProps, Readonly<UserSelectorProps> & Readonly<{
17
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<UserSelectorProps>, {
18
+ apiBaseUrl: string;
19
+ tenantId: string;
20
+ placeholder: string;
21
+ modelValue: string;
22
+ draggable: boolean;
23
+ multiple: boolean;
24
+ currentUserId: string;
25
+ exactSearchKey: string;
26
+ userGroup: () => never[];
27
+ userGroupName: string;
28
+ emptyText: string;
29
+ }>>> & {
6
30
  onChange?: ((...args: any[]) => any) | undefined;
7
31
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
8
- }>, {
32
+ }, {
9
33
  tenantId: string;
10
34
  currentUserId: string;
11
35
  userGroup: {
@@ -26,5 +50,22 @@ declare const _default: import("vue").DefineComponent<UserSelectorProps, {}, {},
26
50
  placeholder: string;
27
51
  exactSearchKey: string;
28
52
  multiple: boolean;
29
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
53
+ }, {}>;
30
54
  export default _default;
55
+ type __VLS_WithDefaults<P, D> = {
56
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
57
+ default: D[K];
58
+ }> : P[K];
59
+ };
60
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
61
+ type __VLS_TypePropsToOption<T> = {
62
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
63
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
64
+ } : {
65
+ type: import('vue').PropType<T[K]>;
66
+ required: true;
67
+ };
68
+ };
69
+ type __VLS_PrettifyLocal<T> = {
70
+ [K in keyof T]: T[K];
71
+ } & {};
@@ -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;
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;
@@ -1,5 +1,5 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "@blueking/bkui-library";
2
- import { ref, onBeforeMount, defineComponent, createElementBlock, createCommentVNode, openBlock, withModifiers, normalizeClass, h as h$1, computed, createBlock, unref, withCtx, createVNode, createElementVNode, toDisplayString, Fragment, renderList, watch, nextTick, onMounted, withDirectives, isRef, vModelText, createTextVNode, createApp, getCurrentInstance, onBeforeUnmount } from "@blueking/bkui-library";
2
+ import { ref, onBeforeMount, defineComponent, createElementBlock, createCommentVNode, openBlock, withModifiers, normalizeClass, h as h$1, computed, createBlock, unref, withCtx, createVNode, createElementVNode, toDisplayString, Fragment, renderList, watch, nextTick, onMounted, withDirectives, isRef, vModelText, createTextVNode, createApp } from "@blueking/bkui-library";
3
3
  const getTenants = async (apiBaseUrl, tenantId) => {
4
4
  if (!apiBaseUrl || !tenantId) {
5
5
  console.warn("获取租户信息需要提供有效的apiBaseUrl和租户ID");
@@ -17005,7 +17005,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
17005
17005
  };
17006
17006
  }
17007
17007
  });
17008
- const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-487799ec"]]);
17008
+ const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-655f7a5a"]]);
17009
17009
  const _hoisted_1$2 = ["onClick"];
17010
17010
  const _hoisted_2$1 = ["placeholder"];
17011
17011
  const _hoisted_3 = ["placeholder"];
@@ -17497,7 +17497,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
17497
17497
  };
17498
17498
  }
17499
17499
  });
17500
- const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-95b69442"]]);
17500
+ const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d9743f6d"]]);
17501
17501
  const _hoisted_1$1 = { class: "input-container" };
17502
17502
  const _hoisted_2 = ["placeholder"];
17503
17503
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
@@ -17540,9 +17540,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17540
17540
  type: "userGroup"
17541
17541
  }));
17542
17542
  const list = [...options.value, ...userGroup];
17543
- return list.find((user) => user.id === selectedUser.value);
17543
+ const selectedUserInfo2 = list.find((user) => user.id === selectedUser.value);
17544
+ emit("change", selectedUserInfo2 || null);
17545
+ return selectedUserInfo2;
17544
17546
  });
17545
- onBeforeMount(async () => {
17547
+ const initSelectedUser = async () => {
17546
17548
  if (typeof props2.modelValue === "string" && props2.modelValue) {
17547
17549
  try {
17548
17550
  isLoading.value = true;
@@ -17563,7 +17565,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17563
17565
  } finally {
17564
17566
  isLoading.value = false;
17565
17567
  }
17568
+ } else {
17569
+ options.value = [];
17566
17570
  }
17571
+ };
17572
+ onBeforeMount(async () => {
17573
+ initSelectedUser();
17567
17574
  });
17568
17575
  const addCurrentUser = async () => {
17569
17576
  if (!props2.currentUserId || selectedUser.value === props2.currentUserId) return;
@@ -17615,9 +17622,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17615
17622
  const handleClickOutside = () => {
17616
17623
  showDropdown.value = false;
17617
17624
  };
17618
- watch(selectedUserInfo, (newVal) => {
17619
- emit("change", newVal || null);
17620
- }, { immediate: true });
17625
+ watch(
17626
+ () => props2.modelValue,
17627
+ (newVal) => {
17628
+ selectedUser.value = newVal;
17629
+ }
17630
+ );
17631
+ watch(selectedUser, (newVal) => {
17632
+ emit("update:modelValue", newVal);
17633
+ });
17621
17634
  return (_ctx, _cache) => {
17622
17635
  return withDirectives((openBlock(), createElementBlock("div", {
17623
17636
  ref_key: "containerRef",
@@ -17678,7 +17691,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17678
17691
  };
17679
17692
  }
17680
17693
  });
17681
- const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-4fec9d7c"]]);
17694
+ const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-75a8e031"]]);
17682
17695
  const _hoisted_1 = {
17683
17696
  ref: "containerRef",
17684
17697
  class: "bk-user-selector"
@@ -17732,6 +17745,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17732
17745
  } catch (error3) {
17733
17746
  console.error("获取选中用户信息失败:", error3);
17734
17747
  }
17748
+ } else {
17749
+ selectedUsers.value = [];
17735
17750
  }
17736
17751
  } else {
17737
17752
  selectedUser.value = props2.modelValue;
@@ -17751,15 +17766,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17751
17766
  watch(selectedUser, (newVal) => {
17752
17767
  if (!props2.multiple) {
17753
17768
  emit("update:modelValue", newVal);
17754
- emit("change", newVal);
17755
17769
  }
17756
- }, { immediate: true });
17770
+ });
17757
17771
  watch(
17758
17772
  () => props2.userGroup,
17759
17773
  () => {
17760
17774
  initSelectedUsers();
17761
- },
17762
- { immediate: true }
17775
+ }
17776
+ );
17777
+ watch(
17778
+ () => props2.modelValue,
17779
+ () => {
17780
+ initSelectedUsers();
17781
+ }
17763
17782
  );
17764
17783
  onBeforeMount(() => {
17765
17784
  initSelectedUsers();
@@ -17820,52 +17839,54 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17820
17839
  };
17821
17840
  }
17822
17841
  });
17823
- const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-78f5783f"]]);
17842
+ const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-53d8b462"]]);
17824
17843
  const vue2 = {
17844
+ model: {
17845
+ prop: "modelValue",
17846
+ event: "change"
17847
+ },
17848
+ beforeDestroy() {
17849
+ var _a;
17850
+ this.unWatchStack.forEach((unWatch) => unWatch == null ? void 0 : unWatch());
17851
+ (_a = this.app) == null ? void 0 : _a.unmount();
17852
+ },
17825
17853
  created() {
17826
- const that = this;
17827
- let app = createApp({
17828
- setup() {
17829
- const currentInstance = getCurrentInstance();
17830
- const unwatchList = Object.keys(that.$props).map((key) => {
17831
- return that.$watch(key, () => {
17832
- currentInstance.proxy.$forceUpdate();
17833
- });
17834
- });
17835
- onBeforeUnmount(() => {
17836
- unwatchList.forEach((unwatch) => unwatch());
17837
- });
17838
- return () => h$1(BkUserSelector, {
17839
- ...that.$props,
17840
- "onUpdate:modelValue": (value) => {
17841
- that.$emit("update:modelValue", value);
17842
- that.$emit("change", value);
17854
+ const props2 = this.$props;
17855
+ const emit = this.$emit.bind(this);
17856
+ let userSelectorInstance;
17857
+ this.app = createApp({
17858
+ render() {
17859
+ userSelectorInstance = this;
17860
+ return h$1(BkUserSelector, {
17861
+ ...props2,
17862
+ "onUpdate:modelValue"() {
17863
+ emit("update:modelValue", ...arguments);
17864
+ emit("change", ...arguments);
17843
17865
  },
17844
- onChange: (value) => {
17845
- console.info("onChange", value);
17846
- that.$emit("change", value);
17847
- }
17866
+ ref: "userSelectorRef"
17848
17867
  });
17849
17868
  }
17850
17869
  });
17851
- this.$once("hook:mounted", () => {
17852
- app.mount(this.$el);
17853
- console.info("app", app);
17854
- });
17855
- this.$once("hook:beforeDestroy", () => {
17856
- app.unmount();
17857
- console.info("unmount", app);
17858
- app = null;
17870
+ this.unWatchStack = Object.keys(this.$props).map((k2) => {
17871
+ return this.$watch(k2, (v2) => {
17872
+ userSelectorInstance[k2] = v2;
17873
+ userSelectorInstance.$forceUpdate();
17874
+ });
17859
17875
  });
17860
17876
  },
17861
- model: {
17862
- prop: "modelValue",
17863
- event: "change"
17877
+ data() {
17878
+ return {
17879
+ app: null,
17880
+ unWatchStack: []
17881
+ };
17882
+ },
17883
+ mounted() {
17884
+ var _a;
17885
+ (_a = this.app) == null ? void 0 : _a.mount(this.$el);
17864
17886
  },
17865
17887
  name: "BkUserSelector",
17866
17888
  props: BkUserSelector.props || {},
17867
17889
  render(createElement) {
17868
- console.info("render", createElement);
17869
17890
  return createElement("div");
17870
17891
  }
17871
17892
  };