bkui-vue 2.0.2-beta.27 → 2.0.2-beta.29

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/lib/index.js CHANGED
@@ -3,5 +3,5 @@ export * from './hooks';
3
3
  export { default } from './preset';
4
4
  export * from './config-provider';
5
5
  export * from './directives';
6
- export const version = "2.0.2-beta.27";
6
+ export const version = "2.0.2-beta.29";
7
7
  window.__bkui_vue_version__ = version;
@@ -90,6 +90,7 @@ declare const BkSearchSelect: {
90
90
  menuList: import("vue").Ref<import("./utils").ISearchItem[]>;
91
91
  menuHoverId: import("vue").Ref<string>;
92
92
  isFocus: import("vue").Ref<boolean>;
93
+ isComposition: import("vue").Ref<boolean>;
93
94
  usingItem: import("vue").Ref<import("./utils").SelectedItem>;
94
95
  showPopover: import("vue").Ref<boolean>;
95
96
  showNoSelectValueError: import("vue").Ref<boolean>;
@@ -125,6 +126,8 @@ declare const BkSearchSelect: {
125
126
  logical: string;
126
127
  }>;
127
128
  inputKey: import("vue").Ref<string>;
129
+ handleCompositionEnd: (event: CompositionEvent) => void;
130
+ handleCompositionStart: () => void;
128
131
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("focus" | "delete" | "add" | "selectKey")[], import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
129
132
  data: {
130
133
  type: import("vue").PropType<import("./utils").ISearchItem[]>;
@@ -223,6 +226,7 @@ declare const BkSearchSelect: {
223
226
  menuList: import("vue").Ref<import("./utils").ISearchItem[]>;
224
227
  menuHoverId: import("vue").Ref<string>;
225
228
  isFocus: import("vue").Ref<boolean>;
229
+ isComposition: import("vue").Ref<boolean>;
226
230
  usingItem: import("vue").Ref<import("./utils").SelectedItem>;
227
231
  showPopover: import("vue").Ref<boolean>;
228
232
  showNoSelectValueError: import("vue").Ref<boolean>;
@@ -258,6 +262,8 @@ declare const BkSearchSelect: {
258
262
  logical: string;
259
263
  }>;
260
264
  inputKey: import("vue").Ref<string>;
265
+ handleCompositionEnd: (event: CompositionEvent) => void;
266
+ handleCompositionStart: () => void;
261
267
  }, {}, {}, {}, {
262
268
  maxHeight: number;
263
269
  mode: import("./utils").SearchInputMode;
@@ -546,6 +552,7 @@ declare const BkSearchSelect: {
546
552
  menuList: import("vue").Ref<import("./utils").ISearchItem[]>;
547
553
  menuHoverId: import("vue").Ref<string>;
548
554
  isFocus: import("vue").Ref<boolean>;
555
+ isComposition: import("vue").Ref<boolean>;
549
556
  usingItem: import("vue").Ref<import("./utils").SelectedItem>;
550
557
  showPopover: import("vue").Ref<boolean>;
551
558
  showNoSelectValueError: import("vue").Ref<boolean>;
@@ -581,6 +588,8 @@ declare const BkSearchSelect: {
581
588
  logical: string;
582
589
  }>;
583
590
  inputKey: import("vue").Ref<string>;
591
+ handleCompositionEnd: (event: CompositionEvent) => void;
592
+ handleCompositionStart: () => void;
584
593
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("focus" | "delete" | "add" | "selectKey")[], import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
585
594
  data: {
586
595
  type: import("vue").PropType<import("./utils").ISearchItem[]>;
@@ -679,6 +688,7 @@ declare const BkSearchSelect: {
679
688
  menuList: import("vue").Ref<import("./utils").ISearchItem[]>;
680
689
  menuHoverId: import("vue").Ref<string>;
681
690
  isFocus: import("vue").Ref<boolean>;
691
+ isComposition: import("vue").Ref<boolean>;
682
692
  usingItem: import("vue").Ref<import("./utils").SelectedItem>;
683
693
  showPopover: import("vue").Ref<boolean>;
684
694
  showNoSelectValueError: import("vue").Ref<boolean>;
@@ -714,6 +724,8 @@ declare const BkSearchSelect: {
714
724
  logical: string;
715
725
  }>;
716
726
  inputKey: import("vue").Ref<string>;
727
+ handleCompositionEnd: (event: CompositionEvent) => void;
728
+ handleCompositionStart: () => void;
717
729
  }, {}, {}, {}, {
718
730
  maxHeight: number;
719
731
  mode: import("./utils").SearchInputMode;
@@ -951,6 +963,7 @@ declare const BkSearchSelect: {
951
963
  menuList: import("vue").Ref<import("./utils").ISearchItem[]>;
952
964
  menuHoverId: import("vue").Ref<string>;
953
965
  isFocus: import("vue").Ref<boolean>;
966
+ isComposition: import("vue").Ref<boolean>;
954
967
  usingItem: import("vue").Ref<import("./utils").SelectedItem>;
955
968
  showPopover: import("vue").Ref<boolean>;
956
969
  showNoSelectValueError: import("vue").Ref<boolean>;
@@ -986,6 +999,8 @@ declare const BkSearchSelect: {
986
999
  logical: string;
987
1000
  }>;
988
1001
  inputKey: import("vue").Ref<string>;
1002
+ handleCompositionEnd: (event: CompositionEvent) => void;
1003
+ handleCompositionStart: () => void;
989
1004
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("focus" | "delete" | "add" | "selectKey")[], import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
990
1005
  data: {
991
1006
  type: import("vue").PropType<import("./utils").ISearchItem[]>;
@@ -1084,6 +1099,7 @@ declare const BkSearchSelect: {
1084
1099
  menuList: import("vue").Ref<import("./utils").ISearchItem[]>;
1085
1100
  menuHoverId: import("vue").Ref<string>;
1086
1101
  isFocus: import("vue").Ref<boolean>;
1102
+ isComposition: import("vue").Ref<boolean>;
1087
1103
  usingItem: import("vue").Ref<import("./utils").SelectedItem>;
1088
1104
  showPopover: import("vue").Ref<boolean>;
1089
1105
  showNoSelectValueError: import("vue").Ref<boolean>;
@@ -1119,6 +1135,8 @@ declare const BkSearchSelect: {
1119
1135
  logical: string;
1120
1136
  }>;
1121
1137
  inputKey: import("vue").Ref<string>;
1138
+ handleCompositionEnd: (event: CompositionEvent) => void;
1139
+ handleCompositionStart: () => void;
1122
1140
  }, {}, {}, {}, {
1123
1141
  maxHeight: number;
1124
1142
  mode: import("./utils").SearchInputMode;
@@ -2831,6 +2831,7 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
2831
2831
  return ((_usingItem$value = usingItem.value) === null || _usingItem$value === void 0 ? void 0 : _usingItem$value.logical) || SearchLogical.OR;
2832
2832
  });
2833
2833
  var inputKey = (0,external_vue_namespaceObject.ref)((0,shared_namespaceObject.random)(10));
2834
+ var isComposition = (0,external_vue_namespaceObject.ref)(false);
2834
2835
  (0,external_vue_namespaceObject.watch)(editKey, function () {
2835
2836
  if (props.mode === SearchInputMode.DEFAULT && editKey.value) {
2836
2837
  showPopover.value = false;
@@ -2980,7 +2981,9 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
2980
2981
  debounceSetMenuList();
2981
2982
  }
2982
2983
  function handleInputChange(event) {
2983
- var text = event.target.innerText.trim();
2984
+ if (isComposition.value) return;
2985
+ clearInputBr();
2986
+ var text = event.target.innerText;
2984
2987
  if (!usingItem.value) {
2985
2988
  keyword.value = text;
2986
2989
  debounceSetMenuList();
@@ -2999,7 +3002,7 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
2999
3002
  return;
3000
3003
  }
3001
3004
  }
3002
- keyword.value = usingItem.value.isSpecialType() ? text : text.replace(usingItem.value.name, '').replace(':', '').trim();
3005
+ keyword.value = usingItem.value.isSpecialType() ? text : text.replace(usingItem.value.name, '').replace(':', '');
3003
3006
  debounceSetMenuList();
3004
3007
  }
3005
3008
  function handleInputKeyup(event) {
@@ -3012,9 +3015,11 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
3012
3015
  // }
3013
3016
  // return;
3014
3017
  // }
3018
+ if (isComposition.value) return;
3015
3019
  switch (event.code) {
3016
3020
  case 'Enter':
3017
3021
  case 'NumpadEnter':
3022
+ event.preventDefault();
3018
3023
  if (props.valueBehavior === ValueBehavior.NEED_KEY && menuList.value.some(function (item) {
3019
3024
  return item.id === menuHoverId.value;
3020
3025
  })) {
@@ -3024,13 +3029,14 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
3024
3029
  }
3025
3030
  return;
3026
3031
  }
3027
- event.preventDefault();
3028
3032
  handleKeyEnter(event).then(function (v) {
3029
3033
  return v && clearInput();
3030
3034
  });
3031
3035
  break;
3032
3036
  case 'Backspace':
3037
+ case 'Delete':
3033
3038
  handleKeyBackspace(event);
3039
+ break;
3034
3040
  default:
3035
3041
  showNoSelectValueError.value = false;
3036
3042
  break;
@@ -3136,7 +3142,7 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
3136
3142
  setInputFocus(false, false);
3137
3143
  return;
3138
3144
  }
3139
- } else if (!keyword.value) {
3145
+ } else if (!keyword.value || keyword.value.length === 1) {
3140
3146
  usingItem.value = null;
3141
3147
  keyword.value = '';
3142
3148
  setMenuList();
@@ -3585,12 +3591,30 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
3585
3591
  (0,external_vue_namespaceObject.nextTick)(clearInput);
3586
3592
  }
3587
3593
  }
3594
+ function clearInputBr() {
3595
+ if (!inputRef.value) return;
3596
+ var brs = inputRef.value.querySelectorAll('br');
3597
+ brs === null || brs === void 0 || brs.forEach(function (br) {
3598
+ return br.remove();
3599
+ });
3600
+ }
3588
3601
  function clearInput() {
3589
3602
  if (!inputRef.value) return;
3590
- setTimeout(function () {
3591
- keyword.value = '';
3603
+ // magic code 判断是否是 windows 系统
3604
+ // const isWindows = navigator.userAgent.includes('Windows');
3605
+ // if (isWindows) {
3606
+ // setTimeout(() => {
3607
+ // keyword.value = '';
3608
+ // inputRef.value.innerText = '';
3609
+ // clearInputBr();
3610
+ // }, 32);
3611
+ // return;
3612
+ // }
3613
+ keyword.value = '';
3614
+ (0,external_vue_namespaceObject.nextTick)(function () {
3592
3615
  inputRef.value.innerText = '';
3593
- }, 16);
3616
+ clearInputBr();
3617
+ });
3594
3618
  }
3595
3619
  function str2SelectedItem(str) {
3596
3620
  var _str$split = str.split(':'),
@@ -3670,6 +3694,14 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
3670
3694
  menuHoverId.value = '';
3671
3695
  }
3672
3696
  }
3697
+ function handleCompositionEnd(event) {
3698
+ isComposition.value = false;
3699
+ keyword.value = event.data;
3700
+ handleInputChange(event);
3701
+ }
3702
+ function handleCompositionStart() {
3703
+ isComposition.value = true;
3704
+ }
3673
3705
  // expose
3674
3706
  expose({
3675
3707
  inputFocusForWrapper: inputFocusForWrapper,
@@ -3688,6 +3720,7 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
3688
3720
  menuList: menuList,
3689
3721
  menuHoverId: menuHoverId,
3690
3722
  isFocus: isFocus,
3723
+ isComposition: isComposition,
3691
3724
  usingItem: usingItem,
3692
3725
  showPopover: showPopover,
3693
3726
  showNoSelectValueError: showNoSelectValueError,
@@ -3710,7 +3743,9 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
3710
3743
  customPanelSubmit: customPanelSubmit,
3711
3744
  refleshMenuHover: refleshMenuHover,
3712
3745
  t: t,
3713
- inputKey: inputKey
3746
+ inputKey: inputKey,
3747
+ handleCompositionEnd: handleCompositionEnd,
3748
+ handleCompositionStart: handleCompositionStart
3714
3749
  };
3715
3750
  },
3716
3751
  render: function render() {
@@ -3737,9 +3772,11 @@ function input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { va
3737
3772
  'input-after': showInputAfter
3738
3773
  },
3739
3774
  "contenteditable": true,
3740
- "data-placeholder": !inputInnerHtml && !_this.keyword ? _this.placeholder : '',
3775
+ "data-placeholder": !_this.isComposition && !inputInnerHtml && !_this.keyword ? _this.placeholder : '',
3741
3776
  "data-tips": placeholder || '',
3742
3777
  "spellcheck": "false",
3778
+ "onCompositionend": _this.handleCompositionEnd,
3779
+ "onCompositionstart": _this.handleCompositionStart,
3743
3780
  "onFocus": _this.handleInputFocus,
3744
3781
  "onInput": _this.handleInputChange,
3745
3782
  "onKeydown": _this.handleInputKeyup,
@@ -49,6 +49,7 @@ declare const _default: import("vue").DefineComponent<{
49
49
  menuList: Ref<ISearchItem[]>;
50
50
  menuHoverId: Ref<string>;
51
51
  isFocus: Ref<boolean>;
52
+ isComposition: Ref<boolean>;
52
53
  usingItem: Ref<SelectedItem>;
53
54
  showPopover: Ref<boolean>;
54
55
  showNoSelectValueError: Ref<boolean>;
@@ -84,6 +85,8 @@ declare const _default: import("vue").DefineComponent<{
84
85
  logical: string;
85
86
  }>;
86
87
  inputKey: Ref<string>;
88
+ handleCompositionEnd: (event: CompositionEvent) => void;
89
+ handleCompositionStart: () => void;
87
90
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("focus" | "delete" | "add" | "selectKey")[], "focus" | "delete" | "add" | "selectKey", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
88
91
  data: {
89
92
  type: PropType<ISearchItem[]>;
@@ -122,6 +122,7 @@ declare const _default: import("vue").DefineComponent<{
122
122
  menuList: import("vue").Ref<ISearchItem[]>;
123
123
  menuHoverId: import("vue").Ref<string>;
124
124
  isFocus: import("vue").Ref<boolean>;
125
+ isComposition: import("vue").Ref<boolean>;
125
126
  usingItem: import("vue").Ref<SelectedItem>;
126
127
  showPopover: import("vue").Ref<boolean>;
127
128
  showNoSelectValueError: import("vue").Ref<boolean>;
@@ -157,6 +158,8 @@ declare const _default: import("vue").DefineComponent<{
157
158
  logical: string;
158
159
  }>;
159
160
  inputKey: import("vue").Ref<string>;
161
+ handleCompositionEnd: (event: CompositionEvent) => void;
162
+ handleCompositionStart: () => void;
160
163
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("focus" | "delete" | "add" | "selectKey")[], import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
161
164
  data: {
162
165
  type: PropType<ISearchItem[]>;
@@ -255,6 +258,7 @@ declare const _default: import("vue").DefineComponent<{
255
258
  menuList: import("vue").Ref<ISearchItem[]>;
256
259
  menuHoverId: import("vue").Ref<string>;
257
260
  isFocus: import("vue").Ref<boolean>;
261
+ isComposition: import("vue").Ref<boolean>;
258
262
  usingItem: import("vue").Ref<SelectedItem>;
259
263
  showPopover: import("vue").Ref<boolean>;
260
264
  showNoSelectValueError: import("vue").Ref<boolean>;
@@ -290,6 +294,8 @@ declare const _default: import("vue").DefineComponent<{
290
294
  logical: string;
291
295
  }>;
292
296
  inputKey: import("vue").Ref<string>;
297
+ handleCompositionEnd: (event: CompositionEvent) => void;
298
+ handleCompositionStart: () => void;
293
299
  }, {}, {}, {}, {
294
300
  maxHeight: number;
295
301
  mode: import("./utils").SearchInputMode;
@@ -78,6 +78,7 @@ declare const _default: import("vue").DefineComponent<{
78
78
  menuList: import("vue").Ref<ISearchItem[]>;
79
79
  menuHoverId: import("vue").Ref<string>;
80
80
  isFocus: import("vue").Ref<boolean>;
81
+ isComposition: import("vue").Ref<boolean>;
81
82
  usingItem: import("vue").Ref<SelectedItem>;
82
83
  showPopover: import("vue").Ref<boolean>;
83
84
  showNoSelectValueError: import("vue").Ref<boolean>;
@@ -113,6 +114,8 @@ declare const _default: import("vue").DefineComponent<{
113
114
  logical: string;
114
115
  }>;
115
116
  inputKey: import("vue").Ref<string>;
117
+ handleCompositionEnd: (event: CompositionEvent) => void;
118
+ handleCompositionStart: () => void;
116
119
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("focus" | "delete" | "add" | "selectKey")[], import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
117
120
  data: {
118
121
  type: PropType<ISearchItem[]>;
@@ -211,6 +214,7 @@ declare const _default: import("vue").DefineComponent<{
211
214
  menuList: import("vue").Ref<ISearchItem[]>;
212
215
  menuHoverId: import("vue").Ref<string>;
213
216
  isFocus: import("vue").Ref<boolean>;
217
+ isComposition: import("vue").Ref<boolean>;
214
218
  usingItem: import("vue").Ref<SelectedItem>;
215
219
  showPopover: import("vue").Ref<boolean>;
216
220
  showNoSelectValueError: import("vue").Ref<boolean>;
@@ -246,6 +250,8 @@ declare const _default: import("vue").DefineComponent<{
246
250
  logical: string;
247
251
  }>;
248
252
  inputKey: import("vue").Ref<string>;
253
+ handleCompositionEnd: (event: CompositionEvent) => void;
254
+ handleCompositionStart: () => void;
249
255
  }, {}, {}, {}, {
250
256
  maxHeight: number;
251
257
  mode: SearchInputMode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkui-vue",
3
- "version": "2.0.2-beta.27",
3
+ "version": "2.0.2-beta.29",
4
4
  "workspaces": [
5
5
  "packages/**",
6
6
  "scripts/cli",