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

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.
@@ -14069,7 +14069,7 @@ const _export_sfc = (sfc, props2) => {
14069
14069
  }
14070
14070
  return target;
14071
14071
  };
14072
- const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-44fec2ba"]]);
14072
+ const MeTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-ef4a05c4"]]);
14073
14073
  const UserRender = defineComponent({
14074
14074
  name: "UserRender",
14075
14075
  props: {
@@ -14244,22 +14244,22 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
14244
14244
  };
14245
14245
  return (_ctx, _cache) => {
14246
14246
  return openBlock(), createBlock(unref(__webpack_exports__default$1), {
14247
- "ext-cls": "bk-user-selector-popover",
14248
14247
  arrow: false,
14248
+ "ext-cls": "bk-user-selector-popover",
14249
14249
  "is-show": __props.isShow,
14250
14250
  offset: { mainAxis: 4, crossAxis: __props.crossAxisOffset },
14251
- width: __props.containerWidth,
14252
14251
  placement: "bottom-start",
14253
14252
  theme: "light",
14254
14253
  trigger: "manual",
14254
+ width: __props.containerWidth,
14255
14255
  onClickoutside: handleClickOutside
14256
14256
  }, {
14257
14257
  content: withCtx(() => [
14258
14258
  createVNode(unref(__webpack_exports__default$2), {
14259
14259
  class: "dropdown-content",
14260
14260
  loading: __props.loading,
14261
- size: "mini",
14262
- mode: "spin"
14261
+ mode: "spin",
14262
+ size: "mini"
14263
14263
  }, {
14264
14264
  default: withCtx(() => [
14265
14265
  __props.options.length === 0 && __props.userGroup.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
@@ -14275,8 +14275,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
14275
14275
  { key: 1 },
14276
14276
  renderList(groupedUsers.value, (group, groupName) => {
14277
14277
  return openBlock(), createElementBlock("div", {
14278
- class: "user-group",
14279
- key: groupName
14278
+ key: groupName,
14279
+ class: "user-group"
14280
14280
  }, [
14281
14281
  Object.keys(groupedUsers.value).length > 1 || group.some((user) => user.type === "userGroup") ? (openBlock(), createElementBlock("div", {
14282
14282
  key: 0,
@@ -14304,8 +14304,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
14304
14304
  null,
14305
14305
  renderList(group, (user) => {
14306
14306
  return openBlock(), createElementBlock("div", {
14307
- class: "user-option",
14308
14307
  key: user.id,
14308
+ class: "user-option",
14309
14309
  onClick: withModifiers(($event) => selectUser(user), ["prevent"])
14310
14310
  }, [
14311
14311
  createVNode(unref(UserRender), {
@@ -14338,20 +14338,20 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
14338
14338
  };
14339
14339
  }
14340
14340
  });
14341
- const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-e11d7af7"]]);
14341
+ const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ee78cf72"]]);
14342
14342
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
14343
14343
  ...{
14344
14344
  name: "UserTag"
14345
14345
  },
14346
14346
  __name: "user-tag",
14347
14347
  props: {
14348
- user: {},
14349
- tenants: {},
14348
+ active: { type: Boolean },
14350
14349
  currentTenantId: {},
14351
14350
  draggable: { type: Boolean },
14352
- active: { type: Boolean },
14351
+ renderTag: { type: Function },
14353
14352
  showTenant: { type: Boolean },
14354
- renderTag: { type: Function }
14353
+ tenants: {},
14354
+ user: {}
14355
14355
  },
14356
14356
  emits: ["click", "close"],
14357
14357
  setup(__props, { emit: __emit }) {
@@ -14384,7 +14384,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
14384
14384
  };
14385
14385
  }
14386
14386
  });
14387
- const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-3ff46050"]]);
14387
+ const UserTag = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-48ac8fc1"]]);
14388
14388
  const _hoisted_1$1 = ["onClick"];
14389
14389
  const _hoisted_2$1 = ["placeholder"];
14390
14390
  const _hoisted_3 = { class: "hidden-users" };
@@ -14395,24 +14395,25 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14395
14395
  },
14396
14396
  __name: "multiple-selector",
14397
14397
  props: {
14398
- modelValue: { default: () => [] },
14398
+ freePaste: { type: Boolean, default: false },
14399
14399
  draggable: { type: Boolean, default: false },
14400
+ modelValue: { default: () => [] },
14400
14401
  selectedUsers: { default: () => [] },
14401
14402
  tenants: { default: () => ({}) },
14403
+ allowCreate: { type: Boolean, default: false },
14402
14404
  apiBaseUrl: { default: "" },
14403
- tenantId: { default: "" },
14404
- placeholder: { default: "" },
14405
14405
  currentUserId: { default: "" },
14406
+ disabled: { type: Boolean },
14407
+ emptyText: { default: "" },
14408
+ enableMultiTenantMode: { type: Boolean },
14406
14409
  exactSearchKey: { default: "bk_username" },
14407
- userGroup: { default: () => [] },
14410
+ excludeUserIds: { default: () => [] },
14411
+ placeholder: { default: "" },
14412
+ tenantId: { default: "" },
14408
14413
  userGroupName: { default: "" },
14409
- emptyText: { default: "" },
14410
- disabled: { type: Boolean },
14411
14414
  renderListItem: {},
14412
14415
  renderTag: {},
14413
- excludeUserIds: { default: () => [] },
14414
- enableMultiTenantMode: { type: Boolean },
14415
- allowCreate: { type: Boolean, default: false }
14416
+ userGroup: { default: () => [] }
14416
14417
  },
14417
14418
  emits: [
14418
14419
  "update:selectedUsers",
@@ -14513,7 +14514,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14513
14514
  });
14514
14515
  };
14515
14516
  const handleClickOutside = (event) => {
14516
- event.stopPropagation();
14517
14517
  const target = event.target;
14518
14518
  const container = containerRef.value;
14519
14519
  if ((container == null ? void 0 : container.contains(target)) || container === target) {
@@ -14615,7 +14615,37 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14615
14615
  }
14616
14616
  });
14617
14617
  const updatedUsers = Array.from(userMap.values());
14618
- emit("update:selectedUsers", updatedUsers);
14618
+ if (props2.freePaste) {
14619
+ const pastedUsers = usersList.map((user) => ({
14620
+ id: user,
14621
+ name: user,
14622
+ type: "custom",
14623
+ tenantId: "",
14624
+ login_name: user
14625
+ }));
14626
+ pastedUsers.forEach((user) => {
14627
+ if (!updatedUsers.some((item) => item.login_name === user.login_name)) {
14628
+ addUser(user);
14629
+ }
14630
+ });
14631
+ } else {
14632
+ emit("update:selectedUsers", updatedUsers);
14633
+ }
14634
+ } else {
14635
+ if (props2.freePaste) {
14636
+ const pastedUsers = usersList.map((user) => ({
14637
+ id: user,
14638
+ name: user,
14639
+ type: "custom",
14640
+ tenantId: "",
14641
+ login_name: user
14642
+ }));
14643
+ pastedUsers.forEach((user) => {
14644
+ if (!props2.selectedUsers.some((item) => item.login_name === user.login_name)) {
14645
+ addUser(user);
14646
+ }
14647
+ });
14648
+ }
14619
14649
  }
14620
14650
  } catch (error3) {
14621
14651
  console.error("精准查找用户失败:", error3);
@@ -14637,7 +14667,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14637
14667
  removeUser(lastUser);
14638
14668
  }
14639
14669
  } else if (event.key === "Enter" && props2.allowCreate) {
14640
- addUser({ id: searchQuery.value, name: searchQuery.value, type: "custom", tenantId: "" });
14670
+ addUser({
14671
+ id: searchQuery.value,
14672
+ name: searchQuery.value,
14673
+ type: "custom",
14674
+ tenantId: "",
14675
+ login_name: searchQuery.value
14676
+ });
14641
14677
  }
14642
14678
  };
14643
14679
  const addUser = (user) => {
@@ -14761,8 +14797,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14761
14797
  null,
14762
14798
  renderList(_ctx.selectedUsers, (user, index) => {
14763
14799
  return openBlock(), createElementBlock("div", {
14764
- class: "tag-wrapper",
14765
14800
  key: user.id,
14801
+ class: "tag-wrapper",
14766
14802
  onClick: withModifiers(($event) => handleTagClick(index), ["stop"])
14767
14803
  }, [
14768
14804
  createVNode(UserTag, {
@@ -14783,8 +14819,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14783
14819
  ref_for: true,
14784
14820
  ref_key: "inlineInputRef",
14785
14821
  ref: inlineInputRef,
14786
- class: "search-input inline",
14787
14822
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchQuery) ? searchQuery.value = $event : null),
14823
+ class: "search-input inline",
14788
14824
  onFocus: handleInputFocus,
14789
14825
  onInput: handleInput,
14790
14826
  onKeydown: handleKeyDown,
@@ -14806,8 +14842,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14806
14842
  key: 0,
14807
14843
  ref_key: "lastInputRef",
14808
14844
  ref: lastInputRef,
14809
- class: "search-input last",
14810
14845
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(searchQuery) ? searchQuery.value = $event : null),
14846
+ class: "search-input last",
14811
14847
  placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
14812
14848
  onFocus: handleInputFocus,
14813
14849
  onInput: handleInput,
@@ -14848,8 +14884,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14848
14884
  null,
14849
14885
  renderList(visibleUsers.value, (user) => {
14850
14886
  return openBlock(), createBlock(UserTag, {
14851
- "current-tenant-id": _ctx.tenantId,
14852
14887
  key: user.id,
14888
+ "current-tenant-id": _ctx.tenantId,
14853
14889
  "render-tag": _ctx.renderTag,
14854
14890
  "show-tenant": true,
14855
14891
  tenants: _ctx.tenants,
@@ -14904,8 +14940,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14904
14940
  withDirectives(createElementVNode("input", {
14905
14941
  ref_key: "collapsedInputRef",
14906
14942
  ref: collapsedInputRef,
14907
- class: "search-input collapsed",
14908
14943
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(searchQuery) ? searchQuery.value = $event : null),
14944
+ class: "search-input collapsed",
14909
14945
  placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
14910
14946
  onFocus: handleFocus
14911
14947
  }, null, 40, _hoisted_4), [
@@ -14936,7 +14972,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14936
14972
  };
14937
14973
  }
14938
14974
  });
14939
- const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-49f3716b"]]);
14975
+ const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-2a532f24"]]);
14940
14976
  const _hoisted_1 = { class: "input-container" };
14941
14977
  const _hoisted_2 = ["placeholder"];
14942
14978
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
@@ -14947,20 +14983,21 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
14947
14983
  props: {
14948
14984
  modelValue: { default: "" },
14949
14985
  tenants: {},
14986
+ allowCreate: { type: Boolean },
14987
+ freePaste: { type: Boolean },
14950
14988
  apiBaseUrl: { default: "" },
14951
- tenantId: { default: "" },
14952
- placeholder: { default: "" },
14953
14989
  currentUserId: { default: "" },
14990
+ disabled: { type: Boolean },
14991
+ emptyText: { default: "" },
14992
+ enableMultiTenantMode: { type: Boolean },
14954
14993
  exactSearchKey: { default: "bk_username" },
14955
- userGroup: { default: () => [] },
14994
+ excludeUserIds: { default: () => [] },
14995
+ placeholder: { default: "" },
14996
+ tenantId: { default: "" },
14956
14997
  userGroupName: { default: "" },
14957
- emptyText: { default: "" },
14958
- disabled: { type: Boolean },
14959
14998
  renderListItem: {},
14960
14999
  renderTag: {},
14961
- excludeUserIds: { default: () => [] },
14962
- enableMultiTenantMode: { type: Boolean },
14963
- allowCreate: { type: Boolean }
15000
+ userGroup: { default: () => [] }
14964
15001
  },
14965
15002
  emits: ["update:modelValue", "change", "focus", "blur"],
14966
15003
  setup(__props, { emit: __emit }) {
@@ -15090,6 +15127,18 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
15090
15127
  }
15091
15128
  }
15092
15129
  };
15130
+ const handlePaste = (event) => {
15131
+ var _a;
15132
+ event.preventDefault();
15133
+ const pastedText = ((_a = event.clipboardData) == null ? void 0 : _a.getData("text").trim()) || "";
15134
+ if (props2.freePaste) {
15135
+ const customUser = { id: pastedText, name: pastedText, type: "custom", tenantId: "", login_name: pastedText };
15136
+ if (!options.value.some((item) => item.login_name === customUser.login_name)) {
15137
+ options.value.push(customUser);
15138
+ }
15139
+ addUser(customUser);
15140
+ }
15141
+ };
15093
15142
  const addUser = (user) => {
15094
15143
  selectedUser.value = user.id;
15095
15144
  searchQuery.value = "";
@@ -15166,13 +15215,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
15166
15215
  withDirectives(createElementVNode("input", {
15167
15216
  ref_key: "inputRef",
15168
15217
  ref: inputRef,
15169
- class: "search-input",
15170
15218
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
15219
+ class: "search-input",
15171
15220
  placeholder: selectedUserInfo.value ? "" : _ctx.placeholder,
15172
15221
  onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur")),
15173
15222
  onFocus: handleInputFocus,
15174
15223
  onInput: handleInput,
15175
- onKeydown: handleKeyDown
15224
+ onKeydown: handleKeyDown,
15225
+ onPaste: handlePaste
15176
15226
  }, null, 40, _hoisted_2), [
15177
15227
  [vModelText, searchQuery.value]
15178
15228
  ]),
@@ -15196,30 +15246,31 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
15196
15246
  };
15197
15247
  }
15198
15248
  });
15199
- const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-726a967e"]]);
15249
+ const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-633b6466"]]);
15200
15250
  const _sfc_main = /* @__PURE__ */ defineComponent({
15201
15251
  ...{
15202
15252
  name: "BkUserSelector"
15203
15253
  },
15204
15254
  __name: "user-selector",
15205
15255
  props: {
15206
- modelValue: { default: "" },
15207
15256
  draggable: { type: Boolean, default: false },
15257
+ modelValue: { default: "" },
15208
15258
  multiple: { type: Boolean, default: false },
15259
+ allowCreate: { type: Boolean, default: false },
15260
+ freePaste: { type: Boolean, default: false },
15209
15261
  apiBaseUrl: { default: "" },
15210
- tenantId: { default: "" },
15211
- placeholder: { default: "" },
15212
15262
  currentUserId: { default: "" },
15263
+ disabled: { type: Boolean, default: false },
15264
+ emptyText: { default: "" },
15265
+ enableMultiTenantMode: { type: Boolean, default: true },
15213
15266
  exactSearchKey: { default: "bk_username" },
15214
- userGroup: { default: () => [] },
15267
+ excludeUserIds: { default: () => [] },
15268
+ placeholder: { default: "" },
15269
+ tenantId: { default: "" },
15215
15270
  userGroupName: { default: "" },
15216
- emptyText: { default: "" },
15217
- disabled: { type: Boolean, default: false },
15218
15271
  renderListItem: {},
15219
15272
  renderTag: {},
15220
- excludeUserIds: { default: () => [] },
15221
- enableMultiTenantMode: { type: Boolean, default: true },
15222
- allowCreate: { type: Boolean, default: false }
15273
+ userGroup: { default: () => [] }
15223
15274
  },
15224
15275
  emits: ["update:modelValue", "change", "dragStart", "dragEnd", "focus", "blur"],
15225
15276
  setup(__props, { emit: __emit }) {
@@ -15342,10 +15393,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15342
15393
  tenants: unref(tenants),
15343
15394
  "user-group": _ctx.userGroup,
15344
15395
  "user-group-name": userGroupName.value,
15396
+ "free-paste": _ctx.freePaste,
15345
15397
  onBlur: handleBlur,
15346
15398
  onChange: handleUpdateUser,
15347
15399
  onFocus: handleFocus
15348
- }, null, 8, ["modelValue", "allow-create", "api-base-url", "current-user-id", "disabled", "empty-text", "enable-multi-tenant-mode", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "tenant-id", "tenants", "user-group", "user-group-name"])) : (openBlock(), createElementBlock(
15400
+ }, null, 8, ["modelValue", "allow-create", "api-base-url", "current-user-id", "disabled", "empty-text", "enable-multi-tenant-mode", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "tenant-id", "tenants", "user-group", "user-group-name", "free-paste"])) : (openBlock(), createElementBlock(
15349
15401
  Fragment,
15350
15402
  { key: 1 },
15351
15403
  [
@@ -15370,12 +15422,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15370
15422
  tenants: unref(tenants),
15371
15423
  "user-group": _ctx.userGroup,
15372
15424
  "user-group-name": userGroupName.value,
15425
+ "free-paste": _ctx.freePaste,
15373
15426
  onBlur: handleBlur,
15374
15427
  onDragEnd: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("dragEnd", $event)),
15375
15428
  onDragStart: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("dragStart", $event)),
15376
15429
  onFocus: handleFocus,
15377
15430
  "onUpdate:selectedUsers": handleUpdateSelectedUsers
15378
- }, null, 8, ["modelValue", "allow-create", "api-base-url", "current-user-id", "disabled", "draggable", "empty-text", "enable-multi-tenant-mode", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name"])
15431
+ }, null, 8, ["modelValue", "allow-create", "api-base-url", "current-user-id", "disabled", "draggable", "empty-text", "enable-multi-tenant-mode", "exact-search-key", "exclude-user-ids", "placeholder", "render-list-item", "render-tag", "selected-users", "tenant-id", "tenants", "user-group", "user-group-name", "free-paste"])
15379
15432
  ],
15380
15433
  2112
15381
15434
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
@@ -15387,7 +15440,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15387
15440
  };
15388
15441
  }
15389
15442
  });
15390
- const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-879a2fa1"]]);
15443
+ const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-37ff6c88"]]);
15391
15444
  const vue2 = {
15392
15445
  model: {
15393
15446
  prop: "modelValue",