@blueking/bk-user-selector 0.0.35-beta.1 → 0.0.36

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/README.md CHANGED
@@ -151,6 +151,8 @@ export default {
151
151
  | ----------------- | ---------------- | ---------------- |
152
152
  | update:modelValue | 绑定值变化时触发 | 变化后的值 |
153
153
  | change | 选中值变化时触发 | 变化后的用户信息 |
154
+ | focus | 输入框获得焦点时触发 | - |
155
+ | blur | 输入框失去焦点时触发 | - |
154
156
 
155
157
  ## 功能说明
156
158
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/bk-user-selector",
3
- "version": "0.0.35-beta.1",
3
+ "version": "0.0.36",
4
4
  "description": "蓝鲸用户选择器",
5
5
  "license": "MIT",
6
6
  "author": "Tencent BlueKing",
@@ -1,16 +1,16 @@
1
1
  import { FormattedUser, MultipleSelectorProps } from '../types';
2
2
  declare const _default: import("vue").DefineComponent<MultipleSelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ blur: (...args: any[]) => void;
4
+ focus: (...args: any[]) => void;
3
5
  "update:selectedUsers": (...args: any[]) => void;
4
6
  "add-user": (...args: any[]) => void;
5
7
  "remove-user": (...args: any[]) => void;
6
- dragStart: (...args: any[]) => void;
7
- dragEnd: (...args: any[]) => void;
8
8
  }, string, import("vue").PublicProps, Readonly<MultipleSelectorProps> & Readonly<{
9
+ onBlur?: ((...args: any[]) => any) | undefined;
10
+ onFocus?: ((...args: any[]) => any) | undefined;
9
11
  "onUpdate:selectedUsers"?: ((...args: any[]) => any) | undefined;
10
12
  "onAdd-user"?: ((...args: any[]) => any) | undefined;
11
13
  "onRemove-user"?: ((...args: any[]) => any) | undefined;
12
- onDragStart?: ((...args: any[]) => any) | undefined;
13
- onDragEnd?: ((...args: any[]) => any) | undefined;
14
14
  }>, {
15
15
  tenantId: string;
16
16
  apiBaseUrl: string;
@@ -1,9 +1,13 @@
1
1
  import { SingleSelectorProps } from '../types';
2
2
  declare const _default: import("vue").DefineComponent<SingleSelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ blur: (...args: any[]) => void;
3
4
  change: (...args: any[]) => void;
5
+ focus: (...args: any[]) => void;
4
6
  "update:modelValue": (...args: any[]) => void;
5
7
  }, string, import("vue").PublicProps, Readonly<SingleSelectorProps> & Readonly<{
8
+ onBlur?: ((...args: any[]) => any) | undefined;
6
9
  onChange?: ((...args: any[]) => any) | undefined;
10
+ onFocus?: ((...args: any[]) => any) | undefined;
7
11
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
8
12
  }>, {
9
13
  tenantId: string;
@@ -1,13 +1,13 @@
1
1
  import { UserSelectorProps } from '../types';
2
2
  declare const _default: import("vue").DefineComponent<UserSelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ blur: (...args: any[]) => void;
3
4
  change: (...args: any[]) => void;
4
- dragStart: (...args: any[]) => void;
5
- dragEnd: (...args: any[]) => void;
5
+ focus: (...args: any[]) => void;
6
6
  "update:modelValue": (...args: any[]) => void;
7
7
  }, string, import("vue").PublicProps, Readonly<UserSelectorProps> & Readonly<{
8
+ onBlur?: ((...args: any[]) => any) | undefined;
8
9
  onChange?: ((...args: any[]) => any) | undefined;
9
- onDragStart?: ((...args: any[]) => any) | undefined;
10
- onDragEnd?: ((...args: any[]) => any) | undefined;
10
+ onFocus?: ((...args: any[]) => any) | undefined;
11
11
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
12
12
  }>, {
13
13
  tenantId: string;
@@ -4546,6 +4546,10 @@ __webpack_require__$7.d(__webpack_exports__$7, {
4546
4546
  /* reexport */
4547
4547
  lang_en
4548
4548
  ),
4549
+ jp: () => (
4550
+ /* reexport */
4551
+ ja_jp
4552
+ ),
4549
4553
  zhCn: () => (
4550
4554
  /* reexport */
4551
4555
  zh_cn
@@ -4733,6 +4737,145 @@ var en = {
4733
4737
  }
4734
4738
  };
4735
4739
  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;
4736
4879
  var zhCn = {
4737
4880
  lang: "zh-cn",
4738
4881
  steps: {
@@ -4817,7 +4960,7 @@ var zhCn = {
4817
4960
  title: "表格设置",
4818
4961
  fields: {
4819
4962
  title: "字段显示设置",
4820
- subtitle: function subtitle2(max2) {
4963
+ subtitle: function subtitle3(max2) {
4821
4964
  return "(最多".concat(max2, "项)");
4822
4965
  },
4823
4966
  selectAll: "全选"
@@ -4916,6 +5059,7 @@ var zhCn = {
4916
5059
  };
4917
5060
  const zh_cn = zhCn;
4918
5061
  __webpack_exports__$7.en;
5062
+ __webpack_exports__$7.jp;
4919
5063
  var __webpack_exports__zhCn = __webpack_exports__$7.zhCn;
4920
5064
  var __webpack_require__$6 = {};
4921
5065
  (() => {
@@ -10473,9 +10617,6 @@ var __webpack_exports__ = {};
10473
10617
  hide2(el);
10474
10618
  }, 100);
10475
10619
  });
10476
- el.addEventListener("click", function() {
10477
- hide2(el);
10478
- });
10479
10620
  popper2.addEventListener("mouseleave", function() {
10480
10621
  clearTimeout(delayTimeout);
10481
10622
  hideTimeout = setTimeout(function() {
@@ -10489,7 +10630,7 @@ var __webpack_exports__ = {};
10489
10630
  show(el);
10490
10631
  clearTimeout(delayTimeout);
10491
10632
  }, opts.delay);
10492
- } else if (popper2.hasAttribute("data-show")) {
10633
+ } else if (!el.contains(event.target) && popper2.hasAttribute("data-show")) {
10493
10634
  hide2(el);
10494
10635
  }
10495
10636
  });
@@ -14273,7 +14414,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14273
14414
  enableMultiTenantMode: { type: Boolean },
14274
14415
  allowCreate: { type: Boolean, default: false }
14275
14416
  },
14276
- emits: ["update:selectedUsers", "add-user", "remove-user", "dragStart", "dragEnd"],
14417
+ emits: ["update:selectedUsers", "add-user", "remove-user", "focus", "blur"],
14277
14418
  setup(__props, { emit: __emit }) {
14278
14419
  const props2 = __props;
14279
14420
  const emit = __emit;
@@ -14318,9 +14459,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14318
14459
  sortableInstance.value = new Sortable(sortableContainerRef.value, {
14319
14460
  animation: 150,
14320
14461
  draggable: ".tag-wrapper",
14321
- onStart: (event) => {
14322
- emit("dragStart", event);
14323
- },
14324
14462
  onEnd: (evt) => {
14325
14463
  const { oldIndex, newIndex } = evt;
14326
14464
  if (oldIndex === newIndex || oldIndex === void 0 || newIndex === void 0) return;
@@ -14328,7 +14466,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14328
14466
  const [movedUser] = updatedUsers.splice(oldIndex, 1);
14329
14467
  updatedUsers.splice(newIndex, 0, movedUser);
14330
14468
  emit("update:selectedUsers", updatedUsers);
14331
- emit("dragEnd", evt);
14332
14469
  }
14333
14470
  });
14334
14471
  };
@@ -14370,6 +14507,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14370
14507
  if ((container == null ? void 0 : container.contains(target)) || container === target) {
14371
14508
  return;
14372
14509
  }
14510
+ if (isFocused.value) {
14511
+ emit("blur");
14512
+ }
14373
14513
  isFocused.value = false;
14374
14514
  showDropdown.value = false;
14375
14515
  activeTagIndex.value = -1;
@@ -14400,6 +14540,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14400
14540
  });
14401
14541
  };
14402
14542
  const handleInputFocus = () => {
14543
+ emit("focus");
14403
14544
  if (!isFocused.value) {
14404
14545
  isFocused.value = true;
14405
14546
  }
@@ -14783,7 +14924,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
14783
14924
  };
14784
14925
  }
14785
14926
  });
14786
- const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-7515c7a3"]]);
14927
+ const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-94252de2"]]);
14787
14928
  const _hoisted_1 = { class: "input-container" };
14788
14929
  const _hoisted_2 = ["placeholder"];
14789
14930
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
@@ -14809,7 +14950,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
14809
14950
  enableMultiTenantMode: { type: Boolean },
14810
14951
  allowCreate: { type: Boolean }
14811
14952
  },
14812
- emits: ["update:modelValue", "change"],
14953
+ emits: ["update:modelValue", "change", "focus", "blur"],
14813
14954
  setup(__props, { emit: __emit }) {
14814
14955
  const props2 = __props;
14815
14956
  const emit = __emit;
@@ -14950,6 +15091,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
14950
15091
  if (searchQuery.value.length >= 1 || Array.isArray(props2.userGroup) && props2.userGroup.length > 0) {
14951
15092
  showDropdown.value = true;
14952
15093
  }
15094
+ emit("focus");
14953
15095
  };
14954
15096
  const handleInput = () => {
14955
15097
  fetchUsers(searchQuery.value);
@@ -15015,6 +15157,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
15015
15157
  class: "search-input",
15016
15158
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
15017
15159
  placeholder: selectedUserInfo.value ? "" : _ctx.placeholder,
15160
+ onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur")),
15018
15161
  onFocus: handleInputFocus,
15019
15162
  onInput: handleInput,
15020
15163
  onKeydown: handleKeyDown
@@ -15041,7 +15184,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
15041
15184
  };
15042
15185
  }
15043
15186
  });
15044
- const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-6b8c23c5"]]);
15187
+ const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-726a967e"]]);
15045
15188
  const _sfc_main = /* @__PURE__ */ defineComponent({
15046
15189
  ...{
15047
15190
  name: "BkUserSelector"
@@ -15066,7 +15209,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15066
15209
  enableMultiTenantMode: { type: Boolean, default: true },
15067
15210
  allowCreate: { type: Boolean, default: false }
15068
15211
  },
15069
- emits: ["update:modelValue", "change", "dragStart", "dragEnd"],
15212
+ emits: ["update:modelValue", "change", "focus", "blur"],
15070
15213
  setup(__props, { emit: __emit }) {
15071
15214
  const { t: t2 } = useI18n();
15072
15215
  __webpack_exports__provideGlobalConfig({
@@ -15132,6 +15275,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15132
15275
  );
15133
15276
  emit("change", users);
15134
15277
  };
15278
+ const handleFocus = () => {
15279
+ emit("focus");
15280
+ };
15281
+ const handleBlur = () => {
15282
+ emit("blur");
15283
+ };
15135
15284
  watch(selectedUser, (newVal) => {
15136
15285
  if (!props2.multiple) {
15137
15286
  emit("update:modelValue", newVal);
@@ -15147,7 +15296,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15147
15296
  () => props2.modelValue,
15148
15297
  () => {
15149
15298
  initSelectedUsers();
15150
- }
15299
+ },
15300
+ { deep: true }
15151
15301
  );
15152
15302
  onBeforeMount(() => {
15153
15303
  initSelectedUsers();
@@ -15180,7 +15330,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15180
15330
  tenants: unref(tenants),
15181
15331
  "user-group": _ctx.userGroup,
15182
15332
  "user-group-name": userGroupName.value,
15183
- onChange: handleUpdateUser
15333
+ onBlur: handleBlur,
15334
+ onChange: handleUpdateUser,
15335
+ onFocus: handleFocus
15184
15336
  }, 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(
15185
15337
  Fragment,
15186
15338
  { key: 1 },
@@ -15206,8 +15358,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15206
15358
  tenants: unref(tenants),
15207
15359
  "user-group": _ctx.userGroup,
15208
15360
  "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)),
15361
+ onBlur: handleBlur,
15362
+ onFocus: handleFocus,
15211
15363
  "onUpdate:selectedUsers": handleUpdateSelectedUsers
15212
15364
  }, 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"])
15213
15365
  ],
@@ -15221,7 +15373,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15221
15373
  };
15222
15374
  }
15223
15375
  });
15224
- const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-20d45a5c"]]);
15376
+ const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3a531e42"]]);
15225
15377
  const vue2 = {
15226
15378
  model: {
15227
15379
  prop: "modelValue",
@@ -15245,11 +15397,11 @@ const vue2 = {
15245
15397
  emit("update:modelValue", ...arguments);
15246
15398
  emit("change", ...arguments);
15247
15399
  },
15248
- onDragStart: (event) => {
15249
- emit("dragStart", event);
15400
+ onBlur() {
15401
+ emit("blur", ...arguments);
15250
15402
  },
15251
- onDragEnd: (event) => {
15252
- emit("dragEnd", event);
15403
+ onFocus() {
15404
+ emit("focus", ...arguments);
15253
15405
  },
15254
15406
  ref: "userSelectorRef"
15255
15407
  });