@blueking/bk-user-selector 0.0.33 → 0.0.35-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/bk-user-selector",
3
- "version": "0.0.33",
3
+ "version": "0.0.35-beta.1",
4
4
  "description": "蓝鲸用户选择器",
5
5
  "license": "MIT",
6
6
  "author": "Tencent BlueKing",
@@ -3,10 +3,14 @@ declare const _default: import("vue").DefineComponent<MultipleSelectorProps, {},
3
3
  "update:selectedUsers": (...args: any[]) => void;
4
4
  "add-user": (...args: any[]) => void;
5
5
  "remove-user": (...args: any[]) => void;
6
+ dragStart: (...args: any[]) => void;
7
+ dragEnd: (...args: any[]) => void;
6
8
  }, string, import("vue").PublicProps, Readonly<MultipleSelectorProps> & Readonly<{
7
9
  "onUpdate:selectedUsers"?: ((...args: any[]) => any) | undefined;
8
10
  "onAdd-user"?: ((...args: any[]) => any) | undefined;
9
11
  "onRemove-user"?: ((...args: any[]) => any) | undefined;
12
+ onDragStart?: ((...args: any[]) => any) | undefined;
13
+ onDragEnd?: ((...args: any[]) => any) | undefined;
10
14
  }>, {
11
15
  tenantId: string;
12
16
  apiBaseUrl: string;
@@ -1,9 +1,13 @@
1
1
  import { UserSelectorProps } from '../types';
2
2
  declare const _default: import("vue").DefineComponent<UserSelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
3
  change: (...args: any[]) => void;
4
+ dragStart: (...args: any[]) => void;
5
+ dragEnd: (...args: any[]) => void;
4
6
  "update:modelValue": (...args: any[]) => void;
5
7
  }, string, import("vue").PublicProps, Readonly<UserSelectorProps> & Readonly<{
6
8
  onChange?: ((...args: any[]) => any) | undefined;
9
+ onDragStart?: ((...args: any[]) => any) | undefined;
10
+ onDragEnd?: ((...args: any[]) => any) | undefined;
7
11
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
8
12
  }>, {
9
13
  tenantId: string;
@@ -4546,10 +4546,6 @@ __webpack_require__$7.d(__webpack_exports__$7, {
4546
4546
  /* reexport */
4547
4547
  lang_en
4548
4548
  ),
4549
- jp: () => (
4550
- /* reexport */
4551
- ja_jp
4552
- ),
4553
4549
  zhCn: () => (
4554
4550
  /* reexport */
4555
4551
  zh_cn
@@ -4737,145 +4733,6 @@ var en = {
4737
4733
  }
4738
4734
  };
4739
4735
  const lang_en = en;
4740
- var jp = {
4741
- lang: "ja",
4742
- steps: {
4743
- step1: "ステップ1",
4744
- step2: "ステップ2",
4745
- step3: "ステップ3"
4746
- },
4747
- datePicker: {
4748
- selectDate: "日付を選択",
4749
- selectTime: "時間を選択",
4750
- clear: "クリア",
4751
- ok: "OK",
4752
- weekdays: {
4753
- sun: "日",
4754
- mon: "月",
4755
- tue: "火",
4756
- wed: "水",
4757
- thu: "木",
4758
- fri: "金",
4759
- sat: "土"
4760
- },
4761
- hour: "時間",
4762
- min: "分",
4763
- sec: "秒",
4764
- toNow: "現在まで"
4765
- },
4766
- dialog: {
4767
- ok: "OK",
4768
- cancel: "キャンセル",
4769
- prev: "前へ",
4770
- next: "次へ"
4771
- },
4772
- popConfirm: {
4773
- ok: "OK",
4774
- cancel: "キャンセル"
4775
- },
4776
- form: {
4777
- notBeEmpty: "空にできません",
4778
- incorrectFormat: "形式が正しくありません",
4779
- max: "最大値",
4780
- min: "最小値",
4781
- maxLen: "最大長",
4782
- verifyError: "検証エラー"
4783
- },
4784
- pagination: {
4785
- eachPage: "各ページ",
4786
- strip: "",
4787
- total: "合計"
4788
- },
4789
- process: {
4790
- step1: "ステップ1",
4791
- step2: "ステップ2",
4792
- step3: "ステップ3",
4793
- step4: "ステップ4"
4794
- },
4795
- searchSelect: {
4796
- pleaseSelect: "選択してください",
4797
- loading: "ロード中...",
4798
- filterQueryMustHasValue: "フィルタークエリに値を含める必要があります",
4799
- ok: "OK",
4800
- cancel: "キャンセル",
4801
- or: "または",
4802
- and: "そして",
4803
- logical: "論理:"
4804
- },
4805
- select: {
4806
- noData: "データなし",
4807
- noMatchedData: "一致するデータがありません",
4808
- loading: "読み込み中...",
4809
- pleaseSelect: "選んでください",
4810
- enterKeywords: "キーワードを入力してください",
4811
- all: "すべて",
4812
- selectAll: "すべて選択"
4813
- },
4814
- table: {
4815
- emptyText: "データがありません",
4816
- confirm: "確認",
4817
- reset: "リセット",
4818
- sort: "ソート",
4819
- setting: {
4820
- title: "テーブル設定",
4821
- fields: {
4822
- title: "表示フィールド設定",
4823
- subtitle: function subtitle2(max2) {
4824
- return "(".concat(max2, "フィールド最大)");
4825
- },
4826
- selectAll: "すべて選択"
4827
- },
4828
- lineHeight: {
4829
- title: "テーブル行の高さ",
4830
- small: "小",
4831
- medium: "中",
4832
- large: "大"
4833
- },
4834
- options: {
4835
- ok: "OK",
4836
- cancel: "キャンセル"
4837
- }
4838
- }
4839
- },
4840
- transfer: {
4841
- sourceList: "ソースリスト",
4842
- targetList: "ターゲットリスト",
4843
- removeAll: "すべて削除",
4844
- selectAll: "すべて選択",
4845
- noData: "データがありません",
4846
- noSelected: "選択されていません",
4847
- search: "検索"
4848
- },
4849
- upload: {
4850
- uploadSuccess: "アップロード成功",
4851
- uploadFailed: "アップロード失敗",
4852
- drapFileOr: "ここにファイルをドラッグまたは",
4853
- clickUpload: "クリックしてアップロード",
4854
- uploadLabel: "ファイルをアップロード"
4855
- },
4856
- input: {
4857
- placeholder: "入力してください",
4858
- maxlengthLimitTips: "文字数制限に達しました"
4859
- },
4860
- tagInput: {
4861
- placeholder: "入力してEnterキーで終了"
4862
- },
4863
- message: {
4864
- assistant: "アシスタント",
4865
- details: "詳細",
4866
- copySuccess: "コピー成功",
4867
- copyFailed: "コピー失敗"
4868
- },
4869
- cascader: {
4870
- pleaseSelect: "選択してください",
4871
- noData: "データがありません",
4872
- emptyText: "データがありません"
4873
- },
4874
- versionLog: {
4875
- current: "現在のバージョン"
4876
- }
4877
- };
4878
- const ja_jp = jp;
4879
4736
  var zhCn = {
4880
4737
  lang: "zh-cn",
4881
4738
  steps: {
@@ -4960,7 +4817,7 @@ var zhCn = {
4960
4817
  title: "表格设置",
4961
4818
  fields: {
4962
4819
  title: "字段显示设置",
4963
- subtitle: function subtitle3(max2) {
4820
+ subtitle: function subtitle2(max2) {
4964
4821
  return "(最多".concat(max2, "项)");
4965
4822
  },
4966
4823
  selectAll: "全选"
@@ -5059,7 +4916,6 @@ var zhCn = {
5059
4916
  };
5060
4917
  const zh_cn = zhCn;
5061
4918
  __webpack_exports__$7.en;
5062
- __webpack_exports__$7.jp;
5063
4919
  var __webpack_exports__zhCn = __webpack_exports__$7.zhCn;
5064
4920
  var __webpack_require__$6 = {};
5065
4921
  (() => {
@@ -10617,6 +10473,9 @@ var __webpack_exports__ = {};
10617
10473
  hide2(el);
10618
10474
  }, 100);
10619
10475
  });
10476
+ el.addEventListener("click", function() {
10477
+ hide2(el);
10478
+ });
10620
10479
  popper2.addEventListener("mouseleave", function() {
10621
10480
  clearTimeout(delayTimeout);
10622
10481
  hideTimeout = setTimeout(function() {
@@ -10630,7 +10489,7 @@ var __webpack_exports__ = {};
10630
10489
  show(el);
10631
10490
  clearTimeout(delayTimeout);
10632
10491
  }, opts.delay);
10633
- } else if (!el.contains(event.target) && popper2.hasAttribute("data-show")) {
10492
+ } else if (popper2.hasAttribute("data-show")) {
10634
10493
  hide2(el);
10635
10494
  }
10636
10495
  });
@@ -14338,7 +14197,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
14338
14197
  };
14339
14198
  }
14340
14199
  });
14341
- const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-561a8644"]]);
14200
+ const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-e11d7af7"]]);
14342
14201
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
14343
14202
  ...{
14344
14203
  name: "UserTag"
@@ -14414,7 +14273,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14414
14273
  enableMultiTenantMode: { type: Boolean },
14415
14274
  allowCreate: { type: Boolean, default: false }
14416
14275
  },
14417
- emits: ["update:selectedUsers", "add-user", "remove-user"],
14276
+ emits: ["update:selectedUsers", "add-user", "remove-user", "dragStart", "dragEnd"],
14418
14277
  setup(__props, { emit: __emit }) {
14419
14278
  const props2 = __props;
14420
14279
  const emit = __emit;
@@ -14459,6 +14318,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14459
14318
  sortableInstance.value = new Sortable(sortableContainerRef.value, {
14460
14319
  animation: 150,
14461
14320
  draggable: ".tag-wrapper",
14321
+ onStart: (event) => {
14322
+ emit("dragStart", event);
14323
+ },
14462
14324
  onEnd: (evt) => {
14463
14325
  const { oldIndex, newIndex } = evt;
14464
14326
  if (oldIndex === newIndex || oldIndex === void 0 || newIndex === void 0) return;
@@ -14466,6 +14328,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14466
14328
  const [movedUser] = updatedUsers.splice(oldIndex, 1);
14467
14329
  updatedUsers.splice(newIndex, 0, movedUser);
14468
14330
  emit("update:selectedUsers", updatedUsers);
14331
+ emit("dragEnd", evt);
14469
14332
  }
14470
14333
  });
14471
14334
  };
@@ -14488,7 +14351,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14488
14351
  };
14489
14352
  const handleFocus = () => {
14490
14353
  isFocused.value = true;
14491
- showDropdown.value = false;
14354
+ if (props2.userGroup.length > 0) {
14355
+ showDropdown.value = true;
14356
+ } else {
14357
+ showDropdown.value = false;
14358
+ }
14492
14359
  activeTagIndex.value = -1;
14493
14360
  nextTick(() => {
14494
14361
  if (lastInputRef.value) {
@@ -14582,13 +14449,19 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14582
14449
  const result = await lookupUsers({
14583
14450
  apiBaseUrl: props2.apiBaseUrl,
14584
14451
  tenantId: props2.tenantId,
14585
- exactSearchKey: props2.exactSearchKey,
14452
+ exactSearchKey: "login_name",
14586
14453
  usersList: users,
14587
14454
  enableMultiTenantMode: props2.enableMultiTenantMode
14588
14455
  });
14589
14456
  const formattedUsers = formatUsers(result, props2.enableMultiTenantMode);
14590
14457
  if (formattedUsers.length > 0) {
14591
- const updatedUsers = [...props2.selectedUsers, ...formattedUsers];
14458
+ const userMap = /* @__PURE__ */ new Map();
14459
+ [...props2.selectedUsers, ...formattedUsers].forEach((user) => {
14460
+ if (!userMap.has(user.id)) {
14461
+ userMap.set(user.id, user);
14462
+ }
14463
+ });
14464
+ const updatedUsers = Array.from(userMap.values());
14592
14465
  emit("update:selectedUsers", updatedUsers);
14593
14466
  }
14594
14467
  } catch (error3) {
@@ -14910,7 +14783,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14910
14783
  };
14911
14784
  }
14912
14785
  });
14913
- const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d8aff9ea"]]);
14786
+ const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-7515c7a3"]]);
14914
14787
  const _hoisted_1 = { class: "input-container" };
14915
14788
  const _hoisted_2 = ["placeholder"];
14916
14789
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
@@ -15193,7 +15066,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15193
15066
  enableMultiTenantMode: { type: Boolean, default: true },
15194
15067
  allowCreate: { type: Boolean, default: false }
15195
15068
  },
15196
- emits: ["update:modelValue", "change"],
15069
+ emits: ["update:modelValue", "change", "dragStart", "dragEnd"],
15197
15070
  setup(__props, { emit: __emit }) {
15198
15071
  const { t: t2 } = useI18n();
15199
15072
  __webpack_exports__provideGlobalConfig({
@@ -15273,6 +15146,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15273
15146
  watch(
15274
15147
  () => props2.modelValue,
15275
15148
  () => {
15149
+ initSelectedUsers();
15276
15150
  }
15277
15151
  );
15278
15152
  onBeforeMount(() => {
@@ -15291,8 +15165,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15291
15165
  key: 0,
15292
15166
  modelValue: selectedUser.value,
15293
15167
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedUser.value = $event),
15294
- "api-base-url": _ctx.apiBaseUrl,
15295
15168
  "allow-create": _ctx.allowCreate,
15169
+ "api-base-url": _ctx.apiBaseUrl,
15296
15170
  "current-user-id": _ctx.currentUserId,
15297
15171
  disabled: _ctx.disabled,
15298
15172
  "empty-text": emptyText.value,
@@ -15307,7 +15181,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15307
15181
  "user-group": _ctx.userGroup,
15308
15182
  "user-group-name": userGroupName.value,
15309
15183
  onChange: handleUpdateUser
15310
- }, null, 8, ["modelValue", "api-base-url", "allow-create", "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(
15184
+ }, 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(
15311
15185
  Fragment,
15312
15186
  { key: 1 },
15313
15187
  [
@@ -15315,8 +15189,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15315
15189
  createVNode(MultipleSelector, {
15316
15190
  modelValue: selectedUserIds.value,
15317
15191
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedUserIds.value = $event),
15318
- "api-base-url": _ctx.apiBaseUrl,
15319
15192
  "allow-create": _ctx.allowCreate,
15193
+ "api-base-url": _ctx.apiBaseUrl,
15320
15194
  "current-user-id": _ctx.currentUserId,
15321
15195
  disabled: _ctx.disabled,
15322
15196
  draggable: _ctx.draggable,
@@ -15332,8 +15206,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15332
15206
  tenants: unref(tenants),
15333
15207
  "user-group": _ctx.userGroup,
15334
15208
  "user-group-name": userGroupName.value,
15209
+ onDragEnd: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("dragEnd", $event)),
15210
+ onDragStart: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("dragStart", $event)),
15335
15211
  "onUpdate:selectedUsers": handleUpdateSelectedUsers
15336
- }, null, 8, ["modelValue", "api-base-url", "allow-create", "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"])
15212
+ }, 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"])
15337
15213
  ],
15338
15214
  2112
15339
15215
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
@@ -15345,7 +15221,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15345
15221
  };
15346
15222
  }
15347
15223
  });
15348
- const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8a402cb7"]]);
15224
+ const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-20d45a5c"]]);
15349
15225
  const vue2 = {
15350
15226
  model: {
15351
15227
  prop: "modelValue",
@@ -15369,6 +15245,12 @@ const vue2 = {
15369
15245
  emit("update:modelValue", ...arguments);
15370
15246
  emit("change", ...arguments);
15371
15247
  },
15248
+ onDragStart: (event) => {
15249
+ emit("dragStart", event);
15250
+ },
15251
+ onDragEnd: (event) => {
15252
+ emit("dragEnd", event);
15253
+ },
15372
15254
  ref: "userSelectorRef"
15373
15255
  });
15374
15256
  }