@blueking/bk-user-selector 0.0.17 → 0.0.19

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.
@@ -3020,10 +3020,8 @@ const _hoisted_1$4 = {
3020
3020
  const _hoisted_2$3 = { class: "group-name" };
3021
3021
  const _hoisted_3$3 = { class: "group-count" };
3022
3022
  const _hoisted_4$1 = ["onMousedown"];
3023
- const _hoisted_5 = { key: 0 };
3024
- const _hoisted_6 = { key: 1 };
3025
- const _hoisted_7 = {
3026
- key: 2,
3023
+ const _hoisted_5 = {
3024
+ key: 0,
3027
3025
  class: "tenant-name"
3028
3026
  };
3029
3027
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
@@ -3110,9 +3108,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3110
3108
  const groupedUsers = computed(() => {
3111
3109
  const groups = {};
3112
3110
  if (Array.isArray(props.userGroup) && props.userGroup.length > 0) {
3113
- groups[props.userGroupName] = props.userGroup.map((group) => ({
3114
- id: group.id,
3115
- name: group.name,
3111
+ groups[props.userGroupName] = props.userGroup.filter((group) => !group.hidden).map((group) => ({
3112
+ ...group,
3116
3113
  tenantId: "",
3117
3114
  type: "userGroup"
3118
3115
  }));
@@ -3199,26 +3196,22 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3199
3196
  key: user.id,
3200
3197
  onMousedown: withModifiers(($event) => selectUser(user), ["prevent"])
3201
3198
  }, [
3202
- user.login_name ? (openBlock(), createElementBlock(
3203
- "span",
3204
- _hoisted_5,
3205
- toDisplayString(user.login_name) + "(" + toDisplayString(user.name) + ")",
3206
- 1
3207
- /* TEXT */
3208
- )) : (openBlock(), createElementBlock(
3209
- "span",
3210
- _hoisted_6,
3211
- toDisplayString(user.name),
3212
- 1
3213
- /* TEXT */
3214
- )),
3215
- user.tenantId !== __props.tenantId && user.tenantId && __props.tenants[user.tenantId] ? (openBlock(), createElementBlock(
3216
- "span",
3217
- _hoisted_7,
3218
- "@" + toDisplayString(__props.tenants[user.tenantId]),
3219
- 1
3220
- /* TEXT */
3221
- )) : createCommentVNode("v-if", true)
3199
+ createElementVNode("div", null, [
3200
+ createElementVNode(
3201
+ "span",
3202
+ null,
3203
+ toDisplayString(user.name),
3204
+ 1
3205
+ /* TEXT */
3206
+ ),
3207
+ user.tenantId !== __props.tenantId && user.tenantId && __props.tenants[user.tenantId] ? (openBlock(), createElementBlock(
3208
+ "span",
3209
+ _hoisted_5,
3210
+ "@" + toDisplayString(__props.tenants[user.tenantId]),
3211
+ 1
3212
+ /* TEXT */
3213
+ )) : createCommentVNode("v-if", true)
3214
+ ])
3222
3215
  ], 40, _hoisted_4$1);
3223
3216
  }),
3224
3217
  128
@@ -3240,7 +3233,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3240
3233
  };
3241
3234
  }
3242
3235
  });
3243
- const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ba42f78f"]]);
3236
+ const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-f47cc878"]]);
3244
3237
  const _hoisted_1$3 = { class: "tag-content" };
3245
3238
  const _hoisted_2$2 = { class: "user-name" };
3246
3239
  const _hoisted_3$2 = {
@@ -3321,7 +3314,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3321
3314
  exactSearchKey: { default: "bk_username" },
3322
3315
  userGroup: { default: () => [] },
3323
3316
  userGroupName: { default: "用户群组" },
3324
- emptyText: { default: "无匹配人员" }
3317
+ emptyText: { default: "无匹配人员" },
3318
+ renderListItem: {},
3319
+ renderTag: {}
3325
3320
  },
3326
3321
  emits: ["update:selectedUsers", "add-user", "remove-user"],
3327
3322
  setup(__props, { emit: __emit }) {
@@ -3766,7 +3761,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
3766
3761
  }
3767
3762
  });
3768
3763
  const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-1b988eae"]]);
3769
- const _withScopeId = (n) => (pushScopeId("data-v-b9296528"), n = n(), popScopeId(), n);
3764
+ const _withScopeId = (n) => (pushScopeId("data-v-5040d42f"), n = n(), popScopeId(), n);
3770
3765
  const _hoisted_1$1 = { class: "input-container" };
3771
3766
  const _hoisted_2 = {
3772
3767
  key: 0,
@@ -3795,7 +3790,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3795
3790
  exactSearchKey: { default: "bk_username" },
3796
3791
  userGroup: { default: () => [] },
3797
3792
  userGroupName: { default: "用户群组" },
3798
- emptyText: { default: "无匹配人员" }
3793
+ emptyText: { default: "无匹配人员" },
3794
+ renderListItem: {},
3795
+ renderTag: {}
3799
3796
  },
3800
3797
  emits: ["update:modelValue", "change"],
3801
3798
  setup(__props, { emit: __emit }) {
@@ -3810,9 +3807,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3810
3807
  const showDropdown = ref(false);
3811
3808
  const selectedUserInfo = computed(() => {
3812
3809
  const userGroup = (props.userGroup || []).map((group) => ({
3813
- id: group.id,
3814
- name: group.name,
3815
- tenantId: ""
3810
+ ...group,
3811
+ tenantId: "",
3812
+ type: "userGroup"
3816
3813
  }));
3817
3814
  const list = [...options.value, ...userGroup];
3818
3815
  const selectedUserInfo2 = list.find((user) => user.id === selectedUser.value);
@@ -3830,8 +3827,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3830
3827
  if (props.userGroup.length > 0) {
3831
3828
  const groupResult = props.userGroup.filter((group) => group.id == props.modelValue);
3832
3829
  options.value = groupResult.map((group) => ({
3833
- id: group.id,
3834
- name: group.name,
3830
+ ...group,
3835
3831
  tenantId: "",
3836
3832
  type: "userGroup"
3837
3833
  }));
@@ -3964,7 +3960,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3964
3960
  };
3965
3961
  }
3966
3962
  });
3967
- const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-b9296528"]]);
3963
+ const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-5040d42f"]]);
3968
3964
  const _hoisted_1 = {
3969
3965
  ref: "containerRef",
3970
3966
  class: "bk-user-selector"
@@ -3985,7 +3981,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3985
3981
  exactSearchKey: { default: "bk_username" },
3986
3982
  userGroup: { default: () => [] },
3987
3983
  userGroupName: { default: "用户群组" },
3988
- emptyText: { default: "无匹配人员" }
3984
+ emptyText: { default: "无匹配人员" },
3985
+ renderListItem: {},
3986
+ renderTag: {}
3989
3987
  },
3990
3988
  emits: ["update:modelValue", "change"],
3991
3989
  setup(__props, { emit: __emit }) {
@@ -4000,11 +3998,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4000
3998
  const initSelectedUsers = async () => {
4001
3999
  if (props.multiple) {
4002
4000
  const ids = Array.isArray(props.modelValue) ? props.modelValue : [];
4001
+ let selected = [];
4003
4002
  if (props.userGroup.length > 0) {
4004
4003
  const result = props.userGroup.filter((group) => ids.includes(group.id));
4005
- selectedUsers.value = result.map((group) => ({
4006
- id: group.id,
4007
- name: group.name,
4004
+ selected = result.map((group) => ({
4005
+ ...group,
4008
4006
  tenantId: "",
4009
4007
  type: "userGroup"
4010
4008
  }));
@@ -4012,7 +4010,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4012
4010
  if (ids.length > 0) {
4013
4011
  try {
4014
4012
  const result = await lookupUsers(props.apiBaseUrl, props.tenantId, props.exactSearchKey, ids);
4015
- selectedUsers.value = [...selectedUsers.value, ...formatUsers(result)];
4013
+ selectedUsers.value = [...selected, ...formatUsers(result)];
4016
4014
  } catch (error) {
4017
4015
  console.error("获取选中用户信息失败:", error);
4018
4016
  }
@@ -4061,12 +4059,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4061
4059
  "empty-text": _ctx.emptyText,
4062
4060
  "exact-search-key": _ctx.exactSearchKey,
4063
4061
  placeholder: _ctx.placeholder,
4062
+ "render-list-item": _ctx.renderListItem,
4063
+ "render-tag": _ctx.renderTag,
4064
4064
  "tenant-id": _ctx.tenantId,
4065
4065
  tenants: unref(tenants),
4066
4066
  "user-group": _ctx.userGroup,
4067
4067
  "user-group-name": _ctx.userGroupName,
4068
4068
  onChange: handleUpdateUser
4069
- }, null, 8, ["modelValue", "api-base-url", "current-user-id", "empty-text", "exact-search-key", "placeholder", "tenant-id", "tenants", "user-group", "user-group-name"])) : (openBlock(), createElementBlock(
4069
+ }, null, 8, ["modelValue", "api-base-url", "current-user-id", "empty-text", "exact-search-key", "placeholder", "render-list-item", "render-tag", "tenant-id", "tenants", "user-group", "user-group-name"])) : (openBlock(), createElementBlock(
4070
4070
  Fragment,
4071
4071
  { key: 1 },
4072
4072
  [
@@ -4080,13 +4080,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4080
4080
  "empty-text": _ctx.emptyText,
4081
4081
  "exact-search-key": _ctx.exactSearchKey,
4082
4082
  placeholder: _ctx.placeholder,
4083
+ "render-list-item": _ctx.renderListItem,
4084
+ "render-tag": _ctx.renderTag,
4083
4085
  "selected-users": selectedUsers.value,
4084
4086
  "tenant-id": _ctx.tenantId,
4085
4087
  tenants: unref(tenants),
4086
4088
  "user-group": _ctx.userGroup,
4087
4089
  "user-group-name": _ctx.userGroupName,
4088
4090
  "onUpdate:selectedUsers": handleUpdateSelectedUsers
4089
- }, null, 8, ["modelValue", "api-base-url", "current-user-id", "draggable", "empty-text", "exact-search-key", "placeholder", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
4091
+ }, null, 8, ["modelValue", "api-base-url", "current-user-id", "draggable", "empty-text", "exact-search-key", "placeholder", "render-list-item", "render-tag", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
4090
4092
  ],
4091
4093
  2112
4092
4094
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
@@ -4098,7 +4100,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4098
4100
  };
4099
4101
  }
4100
4102
  });
4101
- const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8ba8fd72"]]);
4103
+ const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c23f5bc9"]]);
4102
4104
  export {
4103
4105
  BkUserSelector,
4104
4106
  BkUserSelector as default