bkui-vue 1.0.3-beta.60.scrollbar.5 → 1.0.3-beta.61.dialog.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.
Files changed (84) hide show
  1. package/dist/index.cjs.js +61 -63
  2. package/dist/index.esm.js +19978 -19906
  3. package/dist/index.umd.js +61 -63
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/components.d.ts +2 -0
  7. package/lib/components.js +3 -1
  8. package/lib/date-picker/index.js +1 -1
  9. package/lib/dialog/dialog.css +140 -80
  10. package/lib/dialog/dialog.d.ts +41 -121
  11. package/lib/dialog/dialog.less +10 -65
  12. package/lib/dialog/dialog.variable.css +140 -80
  13. package/lib/dialog/index.d.ts +105 -272
  14. package/lib/dialog/index.js +91 -100
  15. package/lib/dialog/props.d.ts +8 -48
  16. package/lib/info-box/index.d.ts +2 -2
  17. package/lib/info-box/index.js +312 -172
  18. package/lib/info-box/info-box.css +63 -7
  19. package/lib/info-box/info-box.d.ts +17 -16
  20. package/lib/info-box/info-box.less +76 -14
  21. package/lib/info-box/info-box.variable.css +63 -7
  22. package/lib/info-box/render-component.d.ts +4 -0
  23. package/lib/modal/hooks.d.ts +1 -1
  24. package/lib/modal/index.d.ts +48 -325
  25. package/lib/modal/index.js +195 -675
  26. package/lib/modal/mask.d.ts +6 -0
  27. package/lib/modal/modal.css +132 -34
  28. package/lib/modal/modal.d.ts +17 -126
  29. package/lib/modal/modal.less +88 -39
  30. package/lib/modal/modal.variable.css +132 -34
  31. package/lib/modal/props.mixin.d.ts +2 -53
  32. package/lib/scrollbar/index.d.ts +14 -0
  33. package/lib/scrollbar/index.js +18737 -0
  34. package/lib/{virtual-render → scrollbar}/scrollbar-core/index.d.ts +31 -8
  35. package/lib/{virtual-render/bk-scrollbar.css → scrollbar/scrollbar.css} +13 -13
  36. package/lib/{virtual-render/bk-scrollbar.less → scrollbar/scrollbar.less} +13 -13
  37. package/lib/{virtual-render/bk-scrollbar.variable.css → scrollbar/scrollbar.variable.css} +13 -13
  38. package/lib/search-select/index.d.ts +327 -12
  39. package/lib/search-select/index.js +620 -340
  40. package/lib/search-select/input.d.ts +6 -1
  41. package/lib/search-select/search-select.css +20 -6
  42. package/lib/search-select/search-select.d.ts +109 -4
  43. package/lib/search-select/search-select.less +16 -12
  44. package/lib/search-select/search-select.variable.css +20 -6
  45. package/lib/search-select/selected.d.ts +107 -5
  46. package/lib/search-select/utils.d.ts +13 -1
  47. package/lib/select/index.d.ts +23 -0
  48. package/lib/select/index.js +4 -1
  49. package/lib/select/select.d.ts +11 -0
  50. package/lib/shared/index.d.ts +0 -1
  51. package/lib/shared/index.js +1 -48
  52. package/lib/sideslider/index.d.ts +31 -222
  53. package/lib/sideslider/index.js +49 -36
  54. package/lib/sideslider/sideslider.css +4 -47
  55. package/lib/sideslider/sideslider.d.ts +14 -105
  56. package/lib/sideslider/sideslider.less +14 -65
  57. package/lib/sideslider/sideslider.variable.css +4 -47
  58. package/lib/table/index.js +37 -28
  59. package/lib/table/plugins/use-pagination.d.ts +3 -1
  60. package/lib/table/table.css +14 -13
  61. package/lib/table/table.less +2 -2
  62. package/lib/table/table.variable.css +14 -13
  63. package/lib/table/use-attributes.d.ts +1 -0
  64. package/lib/timeline/index.js +1 -0
  65. package/lib/tree/tree.css +13 -13
  66. package/lib/tree/tree.variable.css +13 -13
  67. package/lib/upload/index.d.ts +12 -0
  68. package/lib/upload/index.js +21 -30
  69. package/lib/upload/props.d.ts +3 -0
  70. package/lib/upload/upload-trigger.d.ts +6 -0
  71. package/lib/upload/upload.d.ts +6 -0
  72. package/lib/virtual-render/index.js +262 -2175
  73. package/lib/virtual-render/use-scrollbar.d.ts +2 -2
  74. package/lib/virtual-render/virtual-render.css +13 -13
  75. package/lib/virtual-render/virtual-render.less +2 -2
  76. package/lib/virtual-render/virtual-render.variable.css +13 -13
  77. package/package.json +2 -2
  78. package/lib/icon/image-fill.js +0 -191
  79. package/lib/shared/mask.d.ts +0 -11
  80. package/lib/virtual-render/bk-scrollbar.d.ts +0 -10
  81. /package/lib/{virtual-render → scrollbar}/scrollbar-core/can-use-dom.d.ts +0 -0
  82. /package/lib/{virtual-render → scrollbar}/scrollbar-core/helpers.d.ts +0 -0
  83. /package/lib/{virtual-render → scrollbar}/scrollbar-core/mouse-wheel.d.ts +0 -0
  84. /package/lib/{virtual-render → scrollbar}/scrollbar-core/scrollbar-width.d.ts +0 -0
@@ -480,7 +480,7 @@ function _defineProperty(obj, key, value) {
480
480
  ;// CONCATENATED MODULE: external "vue"
481
481
  var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
482
482
  var external_vue_y = x => () => x
483
- const external_vue_namespaceObject = external_vue_x({ ["Fragment"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Fragment, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createTextVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["inject"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.inject, ["onBeforeUnmount"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["provide"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.provide, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["resolveDirective"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.resolveDirective, ["shallowRef"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch, ["watchEffect"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watchEffect, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
483
+ const external_vue_namespaceObject = external_vue_x({ ["Fragment"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Fragment, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createTextVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["inject"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.inject, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onBeforeUnmount"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["provide"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.provide, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["resolveDirective"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.resolveDirective, ["shallowRef"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
484
484
  ;// CONCATENATED MODULE: ../../node_modules/resize-detector/esm/index.js
485
485
  var raf = null;
486
486
  function requestAnimationFrame (callback) {
@@ -809,6 +809,66 @@ const directives_namespaceObject = directives_x({ ["clickoutside"]: () => __WEBP
809
809
  var icon_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
810
810
  var icon_y = x => () => x
811
811
  const icon_namespaceObject = icon_x({ ["Close"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.Close, ["Error"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.Error, ["ExclamationCircleShape"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.ExclamationCircleShape, ["Search"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.Search });
812
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
813
+ function _arrayWithHoles(arr) {
814
+ if (Array.isArray(arr)) return arr;
815
+ }
816
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
817
+ function _iterableToArrayLimit(r, l) {
818
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
819
+ if (null != t) {
820
+ var e,
821
+ n,
822
+ i,
823
+ u,
824
+ a = [],
825
+ f = !0,
826
+ o = !1;
827
+ try {
828
+ if (i = (t = t.call(r)).next, 0 === l) {
829
+ if (Object(t) !== t) return;
830
+ f = !1;
831
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
832
+ } catch (r) {
833
+ o = !0, n = r;
834
+ } finally {
835
+ try {
836
+ if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
837
+ } finally {
838
+ if (o) throw n;
839
+ }
840
+ }
841
+ return a;
842
+ }
843
+ }
844
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
845
+ function _arrayLikeToArray(arr, len) {
846
+ if (len == null || len > arr.length) len = arr.length;
847
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
848
+ return arr2;
849
+ }
850
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
851
+
852
+ function _unsupportedIterableToArray(o, minLen) {
853
+ if (!o) return;
854
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
855
+ var n = Object.prototype.toString.call(o).slice(8, -1);
856
+ if (n === "Object" && o.constructor) n = o.constructor.name;
857
+ if (n === "Map" || n === "Set") return Array.from(o);
858
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
859
+ }
860
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
861
+ function _nonIterableRest() {
862
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
863
+ }
864
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js
865
+
866
+
867
+
868
+
869
+ function _slicedToArray(arr, i) {
870
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
871
+ }
812
872
  ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
813
873
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
814
874
  try {
@@ -867,6 +927,27 @@ const radio_namespaceObject = radio_x({ ["default"]: () => __WEBPACK_EXTERNAL_MO
867
927
  var radio_less_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
868
928
  var radio_less_y = x => () => x
869
929
  const radio_less_namespaceObject = radio_less_x({ });
930
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
931
+
932
+ function _arrayWithoutHoles(arr) {
933
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
934
+ }
935
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js
936
+ function _iterableToArray(iter) {
937
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
938
+ }
939
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
940
+ function _nonIterableSpread() {
941
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
942
+ }
943
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
944
+
945
+
946
+
947
+
948
+ function _toConsumableArray(arr) {
949
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
950
+ }
870
951
  ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
871
952
  function _classCallCheck(instance, Constructor) {
872
953
  if (!(instance instanceof Constructor)) {
@@ -896,6 +977,7 @@ function _createClass(Constructor, protoProps, staticProps) {
896
977
 
897
978
 
898
979
 
980
+
899
981
  /*
900
982
  * Tencent is pleased to support the open source community by making
901
983
  * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
@@ -922,6 +1004,7 @@ function _createClass(Constructor, protoProps, staticProps) {
922
1004
  * IN THE SOFTWARE.
923
1005
  */
924
1006
 
1007
+
925
1008
  /**
926
1009
  * @description: 获取menu list方法
927
1010
  * @param {ISearchItem} item 已选择的key字段 为空则代表当前并未选择key字段
@@ -933,6 +1016,11 @@ var ValueBehavior;
933
1016
  ValueBehavior["ALL"] = "all";
934
1017
  ValueBehavior["NEEDKEY"] = "need-key";
935
1018
  })(ValueBehavior || (ValueBehavior = {}));
1019
+ var DeleteBehavior;
1020
+ (function (DeleteBehavior) {
1021
+ DeleteBehavior["CHAR"] = "delete-char";
1022
+ DeleteBehavior["VALUE"] = "delete-value";
1023
+ })(DeleteBehavior || (DeleteBehavior = {}));
936
1024
  var SEARCH_SLECT_PROVIDER_KEY = Symbol('SEARCH_SLECT_PROVIDER_KEY');
937
1025
  var useSearchSelectProvider = function useSearchSelectProvider(data) {
938
1026
  (0,external_vue_namespaceObject.provide)(SEARCH_SLECT_PROVIDER_KEY, data);
@@ -945,6 +1033,8 @@ var SearchInputMode;
945
1033
  SearchInputMode["DEFAULT"] = "default";
946
1034
  SearchInputMode["EDIT"] = "edit";
947
1035
  })(SearchInputMode || (SearchInputMode = {}));
1036
+ var ValueSplitRegex = /(\||,|、|\/|\r\n|\n)/gm;
1037
+ var ValueSplitTestRegex = /^(\||,|、|\/|\r\n|\n)$/;
948
1038
  var SearchLogical;
949
1039
  (function (SearchLogical) {
950
1040
  SearchLogical["AND"] = "&";
@@ -955,11 +1045,13 @@ var SelectedItem = /*#__PURE__*/function () {
955
1045
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
956
1046
  _classCallCheck(this, SelectedItem);
957
1047
  _defineProperty(this, "values", []);
1048
+ _defineProperty(this, "nameRenderkey", (0,shared_namespaceObject.random)(4));
958
1049
  this.searchItem = searchItem;
959
1050
  this.type = type;
960
1051
  this.id = searchItem.id;
961
1052
  this.name = searchItem.name;
962
1053
  this.logical = searchItem.logical || SearchLogical.OR;
1054
+ this.type = type;
963
1055
  }
964
1056
  return _createClass(SelectedItem, [{
965
1057
  key: "multiple",
@@ -1024,6 +1116,7 @@ var SelectedItem = /*#__PURE__*/function () {
1024
1116
  }, {
1025
1117
  key: "addValue",
1026
1118
  value: function addValue(item) {
1119
+ this.nameRenderkey = (0,shared_namespaceObject.random)(4);
1027
1120
  if (this.multiple) {
1028
1121
  var index = this.values.findIndex(function (val) {
1029
1122
  return val.id === item.id;
@@ -1037,6 +1130,69 @@ var SelectedItem = /*#__PURE__*/function () {
1037
1130
  }
1038
1131
  this.values = [item];
1039
1132
  }
1133
+ }, {
1134
+ key: "str2Values",
1135
+ value: function str2Values(str) {
1136
+ var _this = this;
1137
+ var list = str === null || str === void 0 ? void 0 : str.split(this.logical).map(function (v) {
1138
+ return v.trim();
1139
+ }).filter(function (v) {
1140
+ return v;
1141
+ });
1142
+ if (!(list !== null && list !== void 0 && list.length)) return [];
1143
+ var findChildByName = function findChildByName(name) {
1144
+ return _this.children.find(function (item) {
1145
+ return item.name === name;
1146
+ });
1147
+ };
1148
+ if (!this.multiple) {
1149
+ var val = list.join(" ".concat(this.logical, " ")).trim();
1150
+ var item = findChildByName(val);
1151
+ return [{
1152
+ id: item ? item.id : val,
1153
+ name: item ? item.name : val,
1154
+ disabled: !!(item !== null && item !== void 0 && item.disabled)
1155
+ }];
1156
+ }
1157
+ // 对于多选情况,处理整个列表
1158
+ return list.map(function (val) {
1159
+ var existing = _this.values.find(function (item) {
1160
+ return item.name === val;
1161
+ });
1162
+ if (existing) return existing;
1163
+ var item = findChildByName(val);
1164
+ return {
1165
+ id: item ? item.id : val,
1166
+ name: item ? item.name : val,
1167
+ disabled: !!(item !== null && item !== void 0 && item.disabled)
1168
+ };
1169
+ });
1170
+ }
1171
+ }, {
1172
+ key: "addValues",
1173
+ value: function addValues(str) {
1174
+ var mergeValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1175
+ var valuesFromStr = str.split(ValueSplitRegex).filter(function (v) {
1176
+ return v.trim() && !ValueSplitTestRegex.test(v);
1177
+ });
1178
+ var currentValues = mergeValues ? this.values.map(function (item) {
1179
+ return item.name;
1180
+ }) : [];
1181
+ var combinedValues = [].concat(_toConsumableArray(valuesFromStr), _toConsumableArray(currentValues));
1182
+ var logicalString = combinedValues.filter(function (v) {
1183
+ return v.trim();
1184
+ }).join(this.logical);
1185
+ this.values = this.str2Values(logicalString);
1186
+ }
1187
+ }, {
1188
+ key: "getValue",
1189
+ value: function getValue(str) {
1190
+ return this.values.find(function (item) {
1191
+ return item.id === str;
1192
+ }) || this.values.find(function (item) {
1193
+ return item.name === str;
1194
+ });
1195
+ }
1040
1196
  }, {
1041
1197
  key: "toValue",
1042
1198
  value: function toValue() {
@@ -1313,9 +1469,10 @@ var SelectedItem = /*#__PURE__*/function () {
1313
1469
 
1314
1470
 
1315
1471
 
1472
+
1473
+
1316
1474
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1317
1475
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1318
-
1319
1476
  /*
1320
1477
  * Tencent is pleased to support the open source community by making
1321
1478
  * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
@@ -1401,7 +1558,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
1401
1558
  var menuList = (0,external_vue_namespaceObject.ref)([]);
1402
1559
  var _useSearchSelectInjec = useSearchSelectInject(),
1403
1560
  editKey = _useSearchSelectInjec.editKey,
1404
- onValidate = _useSearchSelectInjec.onValidate;
1561
+ onValidate = _useSearchSelectInjec.onValidate,
1562
+ searchData = _useSearchSelectInjec.searchData;
1405
1563
  var valueLoagic = (0,external_vue_namespaceObject.computed)(function () {
1406
1564
  var _usingItem$value;
1407
1565
  return ((_usingItem$value = usingItem.value) === null || _usingItem$value === void 0 ? void 0 : _usingItem$value.logical) || SearchLogical.OR;
@@ -1412,26 +1570,25 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
1412
1570
  }
1413
1571
  });
1414
1572
  // effects
1415
- (0,external_vue_namespaceObject.watchEffect)(function () {
1416
- if (!keyword.value) {
1417
- setInputText();
1418
- }
1419
- }, {
1420
- flush: 'pre'
1421
- });
1573
+ // watchEffect(
1574
+ // () => {
1575
+ // if (!keyword.value) {
1576
+ // setInputText();
1577
+ // }
1578
+ // },
1579
+ // { flush: 'pre' },
1580
+ // );
1422
1581
  (0,external_vue_namespaceObject.watch)([menuList, showPopover], function () {
1423
1582
  var _menuList$value;
1424
- if ((_menuList$value = menuList.value) !== null && _menuList$value !== void 0 && _menuList$value.some(function (item) {
1583
+ var shouldBindEvent = showPopover.value && ((_menuList$value = menuList.value) === null || _menuList$value === void 0 ? void 0 : _menuList$value.some(function (item) {
1425
1584
  return !item.disabled;
1426
- }) && showPopover.value) {
1585
+ }));
1586
+ if (shouldBindEvent) {
1427
1587
  if (!isBindEvent) {
1428
- if (props.valueBehavior === ValueBehavior.NEEDKEY) {
1429
- menuHoverId.value = menuList.value.find(function (item) {
1430
- return !item.disabled;
1431
- }).id;
1432
- } else {
1433
- menuHoverId.value = '';
1434
- }
1588
+ var _menuList$value$find;
1589
+ menuHoverId.value = props.valueBehavior === ValueBehavior.NEEDKEY ? ((_menuList$value$find = menuList.value.find(function (item) {
1590
+ return !item.disabled;
1591
+ })) === null || _menuList$value$find === void 0 ? void 0 : _menuList$value$find.id) || '' : '';
1435
1592
  isBindEvent = true;
1436
1593
  document.addEventListener('keydown', handleDocumentKeydown);
1437
1594
  }
@@ -1461,84 +1618,91 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
1461
1618
  e.preventDefault();
1462
1619
  (_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 || _inputRef$value.blur();
1463
1620
  var len = menuList.value.length;
1464
- var i = len;
1465
1621
  var index = menuList.value.findIndex(function (set) {
1466
1622
  return set.id === menuHoverId.value;
1467
1623
  });
1468
- while (i >= 0) {
1469
- index = e.code === 'ArrowDown' ? index + 1 : index - 1;
1470
- // eslint-disable-next-line no-nested-ternary
1471
- index = index > len - 1 ? 0 : index < 0 ? len - 1 : index;
1624
+ for (var tries = 0; tries < len; tries++) {
1625
+ index = (index + (e.code === 'ArrowDown' ? 1 : -1) + len) % len;
1472
1626
  var item = menuList.value[index];
1473
1627
  if (item && !item.disabled) {
1474
- i = -1;
1475
1628
  var dom = document.getElementById(item.id);
1476
1629
  dom === null || dom === void 0 || dom.focus();
1477
1630
  menuHoverId.value = item.id;
1478
- return;
1631
+ break;
1479
1632
  }
1480
- i -= 1;
1481
1633
  }
1482
1634
  }
1483
1635
  function documentEnterEvent(e) {
1484
- if (isBindEvent) {
1485
- e.preventDefault();
1486
- var item = menuList.value.find(function (item) {
1487
- return item.id === menuHoverId.value;
1488
- });
1489
- item && handleSelectItem(item);
1490
- }
1636
+ if (!isBindEvent) return;
1637
+ e.preventDefault();
1638
+ var item = menuList.value.find(function (item) {
1639
+ return item.id === menuHoverId.value;
1640
+ });
1641
+ item && handleSelectItem(item);
1491
1642
  }
1492
1643
  function handleClickOutside(e) {
1493
1644
  var _popoverRef$value, _props$clickOutside;
1494
1645
  if (!((_popoverRef$value = popoverRef.value) !== null && _popoverRef$value !== void 0 && _popoverRef$value.contains(e.target)) && (_props$clickOutside = props.clickOutside) !== null && _props$clickOutside !== void 0 && _props$clickOutside.call(props, e.target, popoverRef.value)) {
1495
- var _usingItem$value2, _usingItem$value3;
1496
- if ((_usingItem$value2 = usingItem.value) !== null && _usingItem$value2 !== void 0 && (_usingItem$value2 = _usingItem$value2.values) !== null && _usingItem$value2 !== void 0 && _usingItem$value2.length && (_usingItem$value3 = usingItem.value) !== null && _usingItem$value3 !== void 0 && _usingItem$value3.multiple) {
1497
- keyword.value = '';
1498
- handleKeyEnter();
1646
+ if (props.mode === SearchInputMode.EDIT || usingItem.value) {
1647
+ usingItem.value && handleKeyEnter().then(function (v) {
1648
+ return v && clearInput();
1649
+ });
1650
+ if (!usingItem.value) {
1651
+ emit('focus', false);
1652
+ }
1499
1653
  return;
1500
1654
  }
1501
- showPopover.value = false;
1502
1655
  isFocus.value = false;
1656
+ showPopover.value = false;
1503
1657
  emit('focus', isFocus.value);
1504
1658
  }
1505
1659
  }
1506
- function handleInputFocus(e) {
1507
- setInputFocus();
1508
- e && setMenuList();
1509
- }
1510
- function handleInputChange(event) {
1511
- var _usingItem$value5, _usingItem$value8;
1512
- clearInput();
1513
- var text = event.target.innerText;
1514
- if (/(\r|\n)/gm.test(text) || /\s{2}/gm.test(text)) {
1515
- var _usingItem$value4;
1516
- event.preventDefault();
1517
- text = text.replace(/(\r|\n)/gm, " ".concat(valueLoagic.value, " ")).replace(/\s{2}/gm, '');
1518
- inputRef.value.innerText = text;
1519
- setInputFocus();
1520
- keyword.value = text.replace(((_usingItem$value4 = usingItem.value) === null || _usingItem$value4 === void 0 ? void 0 : _usingItem$value4.keyInnerText) || '', '').trim();
1521
- debounceSetMenuList();
1522
- } else if (!keyword.value && text.length < (((_usingItem$value5 = usingItem.value) === null || _usingItem$value5 === void 0 || (_usingItem$value5 = _usingItem$value5.inputInnerText) === null || _usingItem$value5 === void 0 ? void 0 : _usingItem$value5.length) || 1)) {
1523
- var _usingItem$value6, _usingItem$value7, _usingItem$value$valu, _text;
1524
- var outerText = text.replace("\xA0", " ").replace(((_usingItem$value6 = usingItem.value) === null || _usingItem$value6 === void 0 ? void 0 : _usingItem$value6.keyInnerText.replace("\xA0", " ").trim()) || '', '').trim();
1525
- var hasKeyword = text && ((_usingItem$value7 = usingItem.value) === null || _usingItem$value7 === void 0 ? void 0 : _usingItem$value7.keyInnerText) && text.replace("\xA0", " ").includes(usingItem.value.keyInnerText.replace("\xA0", " ").trim());
1526
- if (hasKeyword && outerText && (_usingItem$value$valu = usingItem.value.values) !== null && _usingItem$value$valu !== void 0 && _usingItem$value$valu.length) {
1527
- keyword.value = outerText;
1528
- debounceSetMenuList();
1660
+ function handleInputFocus() {
1661
+ showNoSelectValueError.value = false;
1662
+ if (props.mode === SearchInputMode.EDIT && usingItem.value && !isFocus.value) {
1663
+ var nodeList = Array.from(inputRef.value.querySelectorAll("[data-type=\"".concat(usingItem.value.values.length ? 'value' : usingItem.value.type, "\"]")));
1664
+ if (!nodeList.length) return;
1665
+ var range = document.createRange();
1666
+ var selection = window.getSelection();
1667
+ range.selectNodeContents(nodeList.at(-1));
1668
+ selection === null || selection === void 0 || selection.removeAllRanges();
1669
+ selection.addRange(range); // 注意这里会触发focu事件
1670
+ setInputFocus(true, false);
1671
+ return;
1672
+ }
1673
+ setMenuList();
1674
+ setInputFocus(false, !isFocus.value);
1675
+ }
1676
+ function handleInputPaste(event) {
1677
+ event.preventDefault();
1678
+ var formattedText = event.clipboardData.getData('text').trim();
1679
+ if (!usingItem.value) {
1680
+ var formateItem = str2SeletedItem(formattedText);
1681
+ if (formateItem) {
1682
+ usingItem.value = formateItem;
1683
+ setInputFocus(true, true);
1529
1684
  return;
1530
1685
  }
1531
- if (outerText || !((_text = text) !== null && _text !== void 0 && _text.length)) {
1532
- usingItem.value = null;
1533
- }
1534
- keyword.value = outerText ? text : '';
1535
- debounceSetMenuList();
1536
- } else if (!((_usingItem$value8 = usingItem.value) !== null && _usingItem$value8 !== void 0 && (_usingItem$value8 = _usingItem$value8.values) !== null && _usingItem$value8 !== void 0 && _usingItem$value8.length)) {
1537
- var _usingItem$value9;
1538
- keyword.value = text.replace("\xA0", " ").replace(((_usingItem$value9 = usingItem.value) === null || _usingItem$value9 === void 0 ? void 0 : _usingItem$value9.keyInnerText.replace("\xA0", " ")) || '', '').trim();
1686
+ keyword.value = formattedText.split(ValueSplitRegex).filter(function (v) {
1687
+ return v.trim() && !ValueSplitTestRegex.test(v);
1688
+ }).join(" ".concat(valueLoagic.value, " "));
1689
+ inputRef.value.innerText = keyword.value;
1539
1690
  setInputFocus();
1540
1691
  debounceSetMenuList();
1692
+ return;
1693
+ }
1694
+ usingItem.value.addValues(formattedText);
1695
+ debounceSetMenuList();
1696
+ }
1697
+ function handleInputChange(event) {
1698
+ var text = event.target.innerText.trim();
1699
+ if (!usingItem.value) {
1700
+ keyword.value = text;
1701
+ debounceSetMenuList();
1702
+ return;
1541
1703
  }
1704
+ keyword.value = usingItem.value.isSpecialType() ? text : text.replace(usingItem.value.name, '').replace(':', '').trim();
1705
+ debounceSetMenuList();
1542
1706
  }
1543
1707
  function handleInputKeyup(event) {
1544
1708
  switch (event.code) {
@@ -1547,10 +1711,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
1547
1711
  if (props.valueBehavior === ValueBehavior.NEEDKEY && menuList.value.some(function (item) {
1548
1712
  return item.id === menuHoverId.value;
1549
1713
  })) return;
1550
- handleKeyEnter(event);
1714
+ handleKeyEnter(event).then(function (v) {
1715
+ return v && clearInput();
1716
+ });
1551
1717
  break;
1552
1718
  case 'Backspace':
1553
- handleKeyBackspace();
1719
+ handleKeyBackspace(event);
1554
1720
  default:
1555
1721
  showNoSelectValueError.value = false;
1556
1722
  break;
@@ -1561,19 +1727,20 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
1561
1727
  }
1562
1728
  function _handleKeyEnter() {
1563
1729
  _handleKeyEnter = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee(event) {
1564
- var value, _res, values, _keyword$value, valueList, _res2, _value, _res3, _value2, _res4, res;
1730
+ var _usingItem$value4, _usingItem$value5;
1731
+ var isValid;
1565
1732
  return regenerator_default().wrap(function _callee$(_context) {
1566
1733
  while (1) switch (_context.prev = _context.next) {
1567
1734
  case 0:
1568
1735
  event === null || event === void 0 || event.preventDefault();
1569
- // resolve 中文输入时直接按下enter的错误表现
1736
+ // 异步延迟解决确保响应时机问题
1570
1737
  _context.next = 3;
1571
- return new Promise(function (r) {
1572
- return setTimeout(r, 0);
1738
+ return new Promise(function (resolve) {
1739
+ return setTimeout(resolve, 0);
1573
1740
  });
1574
1741
  case 3:
1575
1742
  if (usingItem.value) {
1576
- _context.next = 16;
1743
+ _context.next = 9;
1577
1744
  break;
1578
1745
  }
1579
1746
  if (!(!keyword.value || props.valueBehavior === ValueBehavior.NEEDKEY)) {
@@ -1582,123 +1749,40 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
1582
1749
  }
1583
1750
  return _context.abrupt("return");
1584
1751
  case 6:
1585
- value = {
1586
- id: keyword.value,
1587
- name: keyword.value
1588
- };
1589
- _context.next = 9;
1590
- return validateUsingItemValues(value);
1752
+ _context.next = 8;
1753
+ return enterNewItemSelected();
1754
+ case 8:
1755
+ return _context.abrupt("return", _context.sent);
1591
1756
  case 9:
1592
- _res = _context.sent;
1593
- if (_res) {
1594
- _context.next = 12;
1595
- break;
1596
- }
1597
- return _context.abrupt("return");
1598
- case 12:
1599
- emit('add', new SelectedItem(value, 'text'));
1600
- keyword.value = '';
1601
- setMenuList();
1602
- return _context.abrupt("return");
1603
- case 16:
1604
- values = usingItem.value.values;
1605
- if (values !== null && values !== void 0 && values.length) {
1606
- _context.next = 43;
1607
- break;
1608
- }
1609
- if (!((_keyword$value = keyword.value) !== null && _keyword$value !== void 0 && _keyword$value.length)) {
1610
- _context.next = 41;
1611
- break;
1612
- }
1613
- if (!keyword.value.includes(valueLoagic.value)) {
1614
- _context.next = 29;
1615
- break;
1616
- }
1617
- valueList = keyword.value.split(valueLoagic.value);
1618
- _context.next = 23;
1619
- return validateUsingItemValues({
1620
- id: keyword.value,
1621
- name: keyword.value
1622
- });
1623
- case 23:
1624
- _res2 = _context.sent;
1625
- if (_res2) {
1626
- _context.next = 26;
1627
- break;
1628
- }
1629
- return _context.abrupt("return");
1630
- case 26:
1631
- valueList.forEach(function (v) {
1632
- return usingItem.value.addValue({
1633
- id: v,
1634
- name: v
1635
- });
1636
- });
1637
- _context.next = 36;
1638
- break;
1639
- case 29:
1640
- _value = {
1641
- id: keyword.value,
1642
- name: keyword.value
1643
- };
1644
- _context.next = 32;
1645
- return validateUsingItemValues(_value);
1646
- case 32:
1647
- _res3 = _context.sent;
1648
- if (_res3) {
1649
- _context.next = 35;
1650
- break;
1651
- }
1652
- return _context.abrupt("return");
1653
- case 35:
1654
- usingItem.value.addValue(_value);
1655
- case 36:
1656
- emit('add', usingItem.value);
1657
- keyword.value = '';
1658
- usingItem.value = null;
1659
- setInputFocus(true);
1660
- return _context.abrupt("return");
1661
- case 41:
1662
- showNoSelectValueError.value = true;
1663
- return _context.abrupt("return");
1664
- case 43:
1665
1757
  if (!keyword.value) {
1666
- _context.next = 56;
1758
+ _context.next = 13;
1667
1759
  break;
1668
1760
  }
1669
- _value2 = {
1670
- id: keyword.value,
1671
- name: keyword.value
1672
- };
1673
- _context.next = 47;
1674
- return validateUsingItemValues(_value2);
1675
- case 47:
1676
- _res4 = _context.sent;
1677
- if (_res4) {
1678
- _context.next = 50;
1761
+ _context.next = 12;
1762
+ return enterExistingItemSelected();
1763
+ case 12:
1764
+ return _context.abrupt("return", _context.sent);
1765
+ case 13:
1766
+ if (!(!((_usingItem$value4 = usingItem.value) !== null && _usingItem$value4 !== void 0 && _usingItem$value4.isSpecialType()) && ((_usingItem$value5 = usingItem.value) === null || _usingItem$value5 === void 0 ? void 0 : _usingItem$value5.values.length) < 1)) {
1767
+ _context.next = 16;
1679
1768
  break;
1680
1769
  }
1681
- return _context.abrupt("return");
1682
- case 50:
1683
- usingItem.value.addValue(_value2);
1684
- emit('add', usingItem.value);
1685
- keyword.value = '';
1686
- usingItem.value = null;
1687
- setInputFocus(true);
1688
- return _context.abrupt("return");
1689
- case 56:
1690
- _context.next = 58;
1770
+ showNoSelectValueError.value = !showNoSelectValueError.value;
1771
+ return _context.abrupt("return", false);
1772
+ case 16:
1773
+ _context.next = 18;
1691
1774
  return validateUsingItemValues();
1692
- case 58:
1693
- res = _context.sent;
1694
- if (res) {
1695
- _context.next = 61;
1775
+ case 18:
1776
+ isValid = _context.sent;
1777
+ if (isValid) {
1778
+ _context.next = 21;
1696
1779
  break;
1697
1780
  }
1698
- return _context.abrupt("return");
1699
- case 61:
1781
+ return _context.abrupt("return", false);
1782
+ case 21:
1700
1783
  setSelectedItem();
1701
- case 62:
1784
+ return _context.abrupt("return", false);
1785
+ case 23:
1702
1786
  case "end":
1703
1787
  return _context.stop();
1704
1788
  }
@@ -1706,22 +1790,31 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
1706
1790
  }));
1707
1791
  return _handleKeyEnter.apply(this, arguments);
1708
1792
  }
1709
- function handleKeyBackspace() {
1710
- var _usingItem$value10;
1793
+ function handleKeyBackspace(event) {
1794
+ var _usingItem$value2;
1711
1795
  // 删除已选择项
1712
1796
  if (!usingItem.value && !keyword.value) {
1713
1797
  emit('delete');
1714
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
1715
1798
  setTimeout(setMenuList, 16);
1716
1799
  return;
1717
1800
  }
1718
- if ((_usingItem$value10 = usingItem.value) !== null && _usingItem$value10 !== void 0 && _usingItem$value10.values.length) {
1719
- var _usingItem$value11;
1720
- // 删除选项
1721
- if ((_usingItem$value11 = usingItem.value) !== null && _usingItem$value11 !== void 0 && _usingItem$value11.multiple || usingItem.value.isInValueList(usingItem.value.values[0]) || props.mode === SearchInputMode.EDIT && !keyword.value) {
1722
- usingItem.value.values.splice(-1, 1);
1801
+ if ((_usingItem$value2 = usingItem.value) !== null && _usingItem$value2 !== void 0 && _usingItem$value2.values.length) {
1802
+ var _usingItem$value$chil;
1803
+ if (usingItem.value.type === 'text' || !((_usingItem$value$chil = usingItem.value.children) !== null && _usingItem$value$chil !== void 0 && _usingItem$value$chil.length)) return;
1804
+ event.preventDefault();
1805
+ var selection = window.getSelection();
1806
+ if ((selection === null || selection === void 0 ? void 0 : selection.rangeCount) > 0) {
1807
+ var _node;
1808
+ var range = selection.getRangeAt(0);
1809
+ var startPos = range.startContainer;
1810
+ var node = startPos;
1811
+ while (node && node.parentNode !== inputRef.value) {
1812
+ node = node.parentNode;
1813
+ }
1814
+ var editIndex = ((_node = node) === null || _node === void 0 || (_node = _node.dataset) === null || _node === void 0 ? void 0 : _node.index) || -1;
1815
+ usingItem.value.values.splice(+editIndex, 1);
1723
1816
  keyword.value = '';
1724
- setInputFocus();
1817
+ setInputFocus(false, false);
1725
1818
  return;
1726
1819
  }
1727
1820
  } else if (!keyword.value) {
@@ -1736,86 +1829,78 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
1736
1829
  }
1737
1830
  function _handleSelectItem() {
1738
1831
  _handleSelectItem = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee2(item, type) {
1739
- var _item$value, _inputRef$value2, _usingItem$value14, _usingItem$value15;
1740
- var _item$realId2, _item$realId, seleted, _res5, isCondition, res;
1832
+ var _item$value, _usingItem$value6, _usingItem$value9;
1833
+ var _item$realId, selectedItem, _usingItem$value7, _usingItem$value8, isCondition;
1741
1834
  return regenerator_default().wrap(function _callee2$(_context2) {
1742
1835
  while (1) switch (_context2.prev = _context2.next) {
1743
1836
  case 0:
1744
1837
  if (!((_item$value = item.value) !== null && _item$value !== void 0 && _item$value.id)) {
1745
- _context2.next = 20;
1838
+ _context2.next = 18;
1746
1839
  break;
1747
1840
  }
1748
- if (!(props.valueBehavior === ValueBehavior.NEEDKEY && item.value || !props.validateValues)) {
1749
- _context2.next = 8;
1750
- break;
1751
- }
1752
- seleted = new SelectedItem(_objectSpread(_objectSpread({}, item), {}, {
1841
+ selectedItem = new SelectedItem(_objectSpread(_objectSpread({}, item), {}, {
1753
1842
  id: (_item$realId = item.realId) !== null && _item$realId !== void 0 ? _item$realId : item.id
1754
1843
  }), type);
1755
- seleted.addValue(item.value);
1756
- setSelectedItem(seleted);
1757
- if (props.valueBehavior === ValueBehavior.NEEDKEY && menuHoverId.value) {
1758
- setInputFocus(true);
1844
+ selectedItem.addValues(item.value.name, false);
1845
+ if (!(props.valueBehavior === ValueBehavior.NEEDKEY && menuHoverId.value)) {
1846
+ _context2.next = 8;
1847
+ break;
1759
1848
  }
1849
+ setSelectedItem(selectedItem);
1850
+ setInputFocus(true);
1760
1851
  menuHoverId.value = '';
1761
1852
  return _context2.abrupt("return");
1762
1853
  case 8:
1763
- usingItem.value = new SelectedItem(_objectSpread(_objectSpread({}, item), {}, {
1764
- id: (_item$realId2 = item.realId) !== null && _item$realId2 !== void 0 ? _item$realId2 : item.id
1765
- }), type);
1766
- usingItem.value.addValue(item.value);
1767
- _context2.next = 12;
1768
- return validateUsingItemValues(item.value);
1769
- case 12:
1770
- _res5 = _context2.sent;
1771
- if (_res5) {
1772
- _context2.next = 16;
1854
+ usingItem.value = selectedItem;
1855
+ _context2.next = 11;
1856
+ return validateUsingItemValues(usingItem.value.values);
1857
+ case 11:
1858
+ if (_context2.sent) {
1859
+ _context2.next = 14;
1773
1860
  break;
1774
1861
  }
1775
1862
  usingItem.value = null;
1776
1863
  return _context2.abrupt("return");
1777
- case 16:
1864
+ case 14:
1778
1865
  setSelectedItem(usingItem.value);
1779
- menuHoverId.value = '';
1780
1866
  setInputFocus(true);
1867
+ menuHoverId.value = '';
1781
1868
  return _context2.abrupt("return");
1782
- case 20:
1783
- if (!(!usingItem.value || !(inputRef !== null && inputRef !== void 0 && (_inputRef$value2 = inputRef.value) !== null && _inputRef$value2 !== void 0 && _inputRef$value2.innerText))) {
1784
- _context2.next = 28;
1869
+ case 18:
1870
+ if (!(!usingItem.value || ((_usingItem$value6 = usingItem.value) === null || _usingItem$value6 === void 0 ? void 0 : _usingItem$value6.type) === 'condition')) {
1871
+ _context2.next = 26;
1785
1872
  break;
1786
1873
  }
1787
- usingItem.value = new SelectedItem(item, type);
1874
+ usingItem.value = new SelectedItem(item, type !== null && type !== void 0 ? type : (_usingItem$value7 = usingItem.value) === null || _usingItem$value7 === void 0 ? void 0 : _usingItem$value7.type);
1788
1875
  keyword.value = '';
1789
- isCondition = type === 'condition';
1790
- isCondition && setSelectedItem();
1876
+ isCondition = ((_usingItem$value8 = usingItem.value) === null || _usingItem$value8 === void 0 ? void 0 : _usingItem$value8.type) === 'condition';
1877
+ if (isCondition) {
1878
+ setSelectedItem();
1879
+ }
1791
1880
  showPopover.value = isCondition || !!usingItem.value.children.length;
1792
1881
  setInputFocus(props.valueBehavior === ValueBehavior.NEEDKEY && !!menuHoverId.value);
1793
1882
  return _context2.abrupt("return");
1794
- case 28:
1795
- if (!(((_usingItem$value14 = usingItem.value) === null || _usingItem$value14 === void 0 ? void 0 : _usingItem$value14.type) === 'condition')) {
1796
- _context2.next = 32;
1797
- break;
1883
+ case 26:
1884
+ if (usingItem.value) {
1885
+ usingItem.value.addValue(item);
1886
+ (0,external_vue_namespaceObject.nextTick)(deleteInputTextNode);
1798
1887
  }
1799
- usingItem.value = new SelectedItem(item, type);
1800
- setSelectedItem();
1801
- return _context2.abrupt("return");
1802
- case 32:
1803
- usingItem.value.addValue(item);
1804
- _context2.next = 35;
1805
- return validateUsingItemValues(item);
1806
- case 35:
1807
- res = _context2.sent;
1808
- if (res) {
1809
- _context2.next = 38;
1888
+ _context2.next = 29;
1889
+ return validateUsingItemValues(usingItem.value.values);
1890
+ case 29:
1891
+ if (_context2.sent) {
1892
+ _context2.next = 31;
1810
1893
  break;
1811
1894
  }
1812
1895
  return _context2.abrupt("return");
1813
- case 38:
1814
- if (!usingItem.value.multiple) setSelectedItem();
1815
- if (props.valueBehavior === ValueBehavior.NEEDKEY && (_usingItem$value15 = usingItem.value) !== null && _usingItem$value15 !== void 0 && _usingItem$value15.multiple) {
1896
+ case 31:
1897
+ if (!usingItem.value.multiple) {
1898
+ setSelectedItem();
1899
+ }
1900
+ if (props.valueBehavior === ValueBehavior.NEEDKEY && (_usingItem$value9 = usingItem.value) !== null && _usingItem$value9 !== void 0 && _usingItem$value9.multiple) {
1816
1901
  setInputFocus();
1817
1902
  }
1818
- case 40:
1903
+ case 33:
1819
1904
  case "end":
1820
1905
  return _context2.stop();
1821
1906
  }
@@ -1827,10 +1912,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
1827
1912
  handleSelectItem(item, 'condition');
1828
1913
  }
1829
1914
  function handleMenuFooterClick(item) {
1830
- var _usingItem$value12;
1915
+ var _usingItem$value3;
1831
1916
  switch (item.id) {
1832
1917
  case 'confirm':
1833
- if (!((_usingItem$value12 = usingItem.value) !== null && _usingItem$value12 !== void 0 && _usingItem$value12.values.length)) return;
1918
+ if (!((_usingItem$value3 = usingItem.value) !== null && _usingItem$value3 !== void 0 && _usingItem$value3.values.length)) return;
1834
1919
  keyword.value = '';
1835
1920
  handleKeyEnter();
1836
1921
  break;
@@ -1840,119 +1925,110 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
1840
1925
  break;
1841
1926
  }
1842
1927
  }
1928
+ function handleLogicalChange(logical) {
1929
+ if (!usingItem.value) return;
1930
+ usingItem.value.logical = logical;
1931
+ }
1843
1932
  // functions
1844
- function validateUsingItemValues(_x4) {
1845
- return _validateUsingItemValues.apply(this, arguments);
1933
+ function validateValues(_x4, _x5) {
1934
+ return _validateValues.apply(this, arguments);
1846
1935
  }
1847
- function _validateUsingItemValues() {
1848
- _validateUsingItemValues = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee3(value) {
1849
- var _usingItem$value16, searchItem, validate, values;
1936
+ function _validateValues() {
1937
+ _validateValues = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee3(searchItem, value) {
1938
+ var validateStr;
1850
1939
  return regenerator_default().wrap(function _callee3$(_context3) {
1851
1940
  while (1) switch (_context3.prev = _context3.next) {
1852
1941
  case 0:
1853
- if (usingItem.value) {
1854
- _context3.next = 4;
1942
+ if (!(typeof props.validateValues === 'function')) {
1943
+ _context3.next = 14;
1855
1944
  break;
1856
1945
  }
1857
- _context3.next = 3;
1858
- return validateValues(null, [value]);
1859
- case 3:
1860
- return _context3.abrupt("return", _context3.sent);
1861
- case 4:
1862
- _usingItem$value16 = usingItem.value, searchItem = _usingItem$value16.searchItem, validate = _usingItem$value16.validate, values = _usingItem$value16.values;
1863
- if (!(validate && typeof props.validateValues === 'function')) {
1864
- _context3.next = 9;
1946
+ validateStr = '';
1947
+ _context3.prev = 2;
1948
+ _context3.next = 5;
1949
+ return props.validateValues(searchItem !== null && searchItem !== void 0 ? searchItem : null, value);
1950
+ case 5:
1951
+ validateStr = _context3.sent;
1952
+ _context3.next = 11;
1953
+ break;
1954
+ case 8:
1955
+ _context3.prev = 8;
1956
+ _context3.t0 = _context3["catch"](2);
1957
+ validateStr = false;
1958
+ case 11:
1959
+ if (!(typeof validateStr === 'string' || validateStr === false)) {
1960
+ _context3.next = 14;
1865
1961
  break;
1866
1962
  }
1867
- _context3.next = 8;
1868
- return validateValues(searchItem, value ? [value] : values);
1869
- case 8:
1870
- return _context3.abrupt("return", _context3.sent);
1871
- case 9:
1963
+ onValidate(validateStr || '校验错误');
1964
+ return _context3.abrupt("return", false);
1965
+ case 14:
1872
1966
  onValidate('');
1873
1967
  return _context3.abrupt("return", true);
1874
- case 11:
1968
+ case 16:
1875
1969
  case "end":
1876
1970
  return _context3.stop();
1877
1971
  }
1878
- }, _callee3);
1972
+ }, _callee3, null, [[2, 8]]);
1879
1973
  }));
1880
- return _validateUsingItemValues.apply(this, arguments);
1881
- }
1882
- function validateValues(_x5, _x6) {
1883
1974
  return _validateValues.apply(this, arguments);
1884
1975
  }
1885
- function _validateValues() {
1886
- _validateValues = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee4(searchItem, value) {
1887
- var _props$validateValues;
1888
- var validateStr;
1976
+ function validateUsingItemValues(_x6) {
1977
+ return _validateUsingItemValues.apply(this, arguments);
1978
+ }
1979
+ function _validateUsingItemValues() {
1980
+ _validateUsingItemValues = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee4(preValues) {
1981
+ var _usingItem$value10, searchItem, validate, values;
1889
1982
  return regenerator_default().wrap(function _callee4$(_context4) {
1890
1983
  while (1) switch (_context4.prev = _context4.next) {
1891
1984
  case 0:
1892
- _context4.next = 2;
1893
- return (_props$validateValues = props.validateValues) === null || _props$validateValues === void 0 ? void 0 : _props$validateValues.call(props, searchItem !== null && searchItem !== void 0 ? searchItem : null, value)["catch"](function () {
1894
- return false;
1895
- });
1896
- case 2:
1897
- validateStr = _context4.sent;
1898
- if (!(typeof validateStr === 'string' || validateStr === false)) {
1899
- _context4.next = 6;
1985
+ if (usingItem.value) {
1986
+ _context4.next = 4;
1900
1987
  break;
1901
1988
  }
1902
- onValidate(validateStr || '校验错误');
1903
- return _context4.abrupt("return", false);
1904
- case 6:
1989
+ _context4.next = 3;
1990
+ return validateValues(null, preValues);
1991
+ case 3:
1992
+ return _context4.abrupt("return", _context4.sent);
1993
+ case 4:
1994
+ _usingItem$value10 = usingItem.value, searchItem = _usingItem$value10.searchItem, validate = _usingItem$value10.validate, values = _usingItem$value10.values;
1995
+ if (!(validate && typeof props.validateValues === 'function')) {
1996
+ _context4.next = 9;
1997
+ break;
1998
+ }
1999
+ _context4.next = 8;
2000
+ return validateValues(searchItem, preValues !== null && preValues !== void 0 ? preValues : values);
2001
+ case 8:
2002
+ return _context4.abrupt("return", _context4.sent);
2003
+ case 9:
1905
2004
  onValidate('');
1906
2005
  return _context4.abrupt("return", true);
1907
- case 8:
2006
+ case 11:
1908
2007
  case "end":
1909
2008
  return _context4.stop();
1910
2009
  }
1911
2010
  }, _callee4);
1912
2011
  }));
1913
- return _validateValues.apply(this, arguments);
1914
- }
1915
- function setInputFocus() {
1916
- var refleshMenuList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1917
- if (refleshMenuList) {
1918
- setTimeout(function () {
1919
- setMenuList();
1920
- }, 16);
1921
- }
1922
- isFocus.value = true;
1923
- showPopover.value = true;
1924
- showNoSelectValueError.value = false;
1925
- var timer = setTimeout(function () {
1926
- if (inputRef.value) {
1927
- inputRef.value.focus(); // 光标移至最后
1928
- var selection = window.getSelection();
1929
- if (selection.focusOffset === 0) {
1930
- selection.selectAllChildren(inputRef.value);
1931
- selection.collapseToEnd();
1932
- }
1933
- }
1934
- window.clearTimeout(timer);
1935
- }, 0);
1936
- emit('focus', isFocus.value);
2012
+ return _validateUsingItemValues.apply(this, arguments);
1937
2013
  }
1938
2014
  function setMenuList() {
1939
2015
  return _setMenuList.apply(this, arguments);
1940
2016
  }
1941
2017
  function _setMenuList() {
1942
2018
  _setMenuList = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee5() {
1943
- var _usingItem$value17, _usingItem$value$valu2;
1944
- var list, _usingItem$value18, _keyword$value2, hoverItem;
2019
+ var _props$data, _usingItem$value$sear, _usingItem$value$valu;
2020
+ var list, _usingItem$value11, _keyword$value2, hoverItem;
1945
2021
  return regenerator_default().wrap(function _callee5$(_context5) {
1946
2022
  while (1) switch (_context5.prev = _context5.next) {
1947
2023
  case 0:
1948
2024
  list = [];
1949
- if (!(typeof props.getMenuList === 'function' && (typeof ((_usingItem$value17 = usingItem.value) === null || _usingItem$value17 === void 0 || (_usingItem$value17 = _usingItem$value17.searchItem) === null || _usingItem$value17 === void 0 ? void 0 : _usingItem$value17.async) === 'undefined' || usingItem.value.searchItem.async === true))) {
2025
+ if (!(typeof props.getMenuList === 'function' && (!((_props$data = props.data) !== null && _props$data !== void 0 && _props$data.length) && !usingItem.value || usingItem.value && usingItem.value.type !== 'condition' && (((_usingItem$value$sear = usingItem.value.searchItem) === null || _usingItem$value$sear === void 0 ? void 0 : _usingItem$value$sear.async) === undefined || usingItem.value.searchItem.async === true)))) {
1950
2026
  _context5.next = 9;
1951
2027
  break;
1952
2028
  }
1953
2029
  loading.value = true;
1954
2030
  _context5.next = 5;
1955
- return props.getMenuList((_usingItem$value18 = usingItem.value) === null || _usingItem$value18 === void 0 ? void 0 : _usingItem$value18.searchItem, keyword.value)["catch"](function () {
2031
+ return props.getMenuList((_usingItem$value11 = usingItem.value) === null || _usingItem$value11 === void 0 ? void 0 : _usingItem$value11.searchItem, keyword.value)["catch"](function () {
1956
2032
  return [];
1957
2033
  });
1958
2034
  case 5:
@@ -2013,7 +2089,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2013
2089
  });
2014
2090
  } else if (usingItem.value.type === 'condition') {
2015
2091
  list = props.conditions;
2016
- } else if (!((_usingItem$value$valu2 = usingItem.value.values) !== null && _usingItem$value$valu2 !== void 0 && _usingItem$value$valu2.length) || usingItem.value.multiple || props.mode === SearchInputMode.EDIT) {
2092
+ } else if (!((_usingItem$value$valu = usingItem.value.values) !== null && _usingItem$value$valu !== void 0 && _usingItem$value$valu.length) || usingItem.value.multiple || props.mode === SearchInputMode.EDIT) {
2017
2093
  list = usingItem.value.children.filter(function (item) {
2018
2094
  return item.name.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase());
2019
2095
  });
@@ -2038,35 +2114,193 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2038
2114
  }));
2039
2115
  return _setMenuList.apply(this, arguments);
2040
2116
  }
2117
+ function enterNewItemSelected() {
2118
+ return _enterNewItemSelected.apply(this, arguments);
2119
+ }
2120
+ function _enterNewItemSelected() {
2121
+ _enterNewItemSelected = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee6() {
2122
+ var formatItem, valueList, res;
2123
+ return regenerator_default().wrap(function _callee6$(_context6) {
2124
+ while (1) switch (_context6.prev = _context6.next) {
2125
+ case 0:
2126
+ formatItem = str2SeletedItem(keyword.value);
2127
+ valueList = (formatItem === null || formatItem === void 0 ? void 0 : formatItem.values) || [{
2128
+ id: keyword.value,
2129
+ name: keyword.value
2130
+ }];
2131
+ _context6.next = 4;
2132
+ return validateUsingItemValues(valueList);
2133
+ case 4:
2134
+ res = _context6.sent;
2135
+ if (res) {
2136
+ _context6.next = 7;
2137
+ break;
2138
+ }
2139
+ return _context6.abrupt("return");
2140
+ case 7:
2141
+ emit('add', formatItem || new SelectedItem(_objectSpread({}, valueList[0]), 'text'));
2142
+ keyword.value = '';
2143
+ setMenuList();
2144
+ return _context6.abrupt("return", true);
2145
+ case 11:
2146
+ case "end":
2147
+ return _context6.stop();
2148
+ }
2149
+ }, _callee6);
2150
+ }));
2151
+ return _enterNewItemSelected.apply(this, arguments);
2152
+ }
2153
+ function enterExistingItemSelected() {
2154
+ return _enterExistingItemSelected.apply(this, arguments);
2155
+ }
2156
+ function _enterExistingItemSelected() {
2157
+ _enterExistingItemSelected = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee7() {
2158
+ var valueList, formatItem, isValid;
2159
+ return regenerator_default().wrap(function _callee7$(_context7) {
2160
+ while (1) switch (_context7.prev = _context7.next) {
2161
+ case 0:
2162
+ valueList = [];
2163
+ if (usingItem.value.isSpecialType()) {
2164
+ formatItem = str2SeletedItem(keyword.value);
2165
+ if (formatItem) {
2166
+ usingItem.value = formatItem;
2167
+ valueList = formatItem.values;
2168
+ }
2169
+ }
2170
+ valueList = valueList.length ? valueList : usingItem.value.str2Values(keyword.value);
2171
+ _context7.next = 5;
2172
+ return validateUsingItemValues(valueList);
2173
+ case 5:
2174
+ isValid = _context7.sent;
2175
+ if (isValid) {
2176
+ _context7.next = 8;
2177
+ break;
2178
+ }
2179
+ return _context7.abrupt("return");
2180
+ case 8:
2181
+ if (usingItem.value.type === 'text') {
2182
+ usingItem.value.name = keyword.value;
2183
+ usingItem.value.id = keyword.value;
2184
+ } else {
2185
+ usingItem.value.values = valueList;
2186
+ }
2187
+ emit('add', usingItem.value);
2188
+ keyword.value = '';
2189
+ usingItem.value = null;
2190
+ setInputFocus(true);
2191
+ return _context7.abrupt("return", true);
2192
+ case 14:
2193
+ case "end":
2194
+ return _context7.stop();
2195
+ }
2196
+ }, _callee7);
2197
+ }));
2198
+ return _enterExistingItemSelected.apply(this, arguments);
2199
+ }
2200
+ function setCursorToEnd() {
2201
+ if (!inputRef.value) return;
2202
+ var range = document.createRange();
2203
+ var selection = window.getSelection();
2204
+ range.selectNodeContents(inputRef.value);
2205
+ range.collapse(false);
2206
+ selection.removeAllRanges();
2207
+ selection.addRange(range);
2208
+ }
2209
+ function setInputFocus() {
2210
+ var refleshMenuList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2211
+ var needCursorToEnd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2212
+ if (refleshMenuList) {
2213
+ setTimeout(setMenuList, 16);
2214
+ }
2215
+ isFocus.value = true;
2216
+ showPopover.value = true;
2217
+ showNoSelectValueError.value = false;
2218
+ needCursorToEnd && (0,external_vue_namespaceObject.nextTick)(setCursorToEnd);
2219
+ emit('focus', isFocus.value);
2220
+ }
2041
2221
  function setSelectedItem(item) {
2042
2222
  emit('add', item !== null && item !== void 0 ? item : usingItem.value);
2043
2223
  usingItem.value = null;
2044
2224
  keyword.value = '';
2045
- setInputFocus(props.valueBehavior === ValueBehavior.NEEDKEY);
2225
+ setInputFocus(true, true);
2226
+ (0,external_vue_namespaceObject.nextTick)(clearInput);
2046
2227
  }
2047
2228
  function clearInput() {
2048
- var text = inputRef.value.innerText;
2049
- if (text[text.length - 1] === '\n' || text[0] === '\r') {
2050
- setInputText(text.slice(0, -1));
2051
- clearInput();
2052
- } else if (text[0] === '\n' || text[0] === '\r') {
2053
- setInputText(text.slice(1));
2054
- clearInput();
2229
+ if (!inputRef.value) return;
2230
+ keyword.value = '';
2231
+ (0,external_vue_namespaceObject.nextTick)(function () {
2232
+ return inputRef.value.innerText = '';
2233
+ });
2234
+ }
2235
+ function str2SeletedItem(str) {
2236
+ var _str$split = str.split(':'),
2237
+ _str$split2 = _slicedToArray(_str$split, 2),
2238
+ key = _str$split2[0],
2239
+ value = _str$split2[1];
2240
+ if (key !== null && key !== void 0 && key.trim()) {
2241
+ var selectedItem = searchData.value.find(function (item) {
2242
+ return item.name === key.trim();
2243
+ });
2244
+ if (selectedItem) {
2245
+ var item = new SelectedItem(_objectSpread({}, selectedItem), 'default');
2246
+ item.addValues(value);
2247
+ return item;
2248
+ }
2055
2249
  }
2250
+ return undefined;
2056
2251
  }
2057
- function setInputText() {
2058
- var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2059
- if (inputRef.value) {
2060
- var _usingItem$value13;
2061
- inputRef.value.innerHTML = text || ((_usingItem$value13 = usingItem.value) === null || _usingItem$value13 === void 0 ? void 0 : _usingItem$value13.inputInnerHtml) || '';
2252
+ function deleteInputTextNode() {
2253
+ var _keyword$value;
2254
+ if ((_keyword$value = keyword.value) !== null && _keyword$value !== void 0 && _keyword$value.length) {
2255
+ keyword.value = '';
2256
+ var nodes = Array.from(inputRef.value.childNodes);
2257
+ nodes.forEach(function (node) {
2258
+ var _node$textContent;
2259
+ if (node.nodeType === Node.TEXT_NODE && (_node$textContent = node.textContent) !== null && _node$textContent !== void 0 && _node$textContent.trim()) {
2260
+ inputRef.value.removeChild(node);
2261
+ }
2262
+ });
2062
2263
  }
2063
2264
  }
2064
- function handleLogicalChange(logical) {
2065
- if (!usingItem.value) return;
2066
- usingItem.value.logical = logical;
2265
+ function inputFocusForWrapper() {
2266
+ var _inputRef$value2;
2267
+ (_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 || _inputRef$value2.focus();
2268
+ }
2269
+ function inputEnterForWrapper() {
2270
+ return _inputEnterForWrapper.apply(this, arguments);
2271
+ }
2272
+ function _inputEnterForWrapper() {
2273
+ _inputEnterForWrapper = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee8() {
2274
+ return regenerator_default().wrap(function _callee8$(_context8) {
2275
+ while (1) switch (_context8.prev = _context8.next) {
2276
+ case 0:
2277
+ _context8.next = 2;
2278
+ return handleKeyEnter().then(function (v) {
2279
+ return v && clearInput();
2280
+ });
2281
+ case 2:
2282
+ showPopover.value = false;
2283
+ inputRef.value.blur();
2284
+ case 4:
2285
+ case "end":
2286
+ return _context8.stop();
2287
+ }
2288
+ }, _callee8);
2289
+ }));
2290
+ return _inputEnterForWrapper.apply(this, arguments);
2291
+ }
2292
+ function inputClearForWrapper() {
2293
+ keyword.value = '';
2294
+ showNoSelectValueError.value = false;
2295
+ showPopover.value = false;
2296
+ usingItem.value = null;
2297
+ (0,external_vue_namespaceObject.nextTick)(clearInput);
2067
2298
  }
2068
2299
  // expose
2069
2300
  expose({
2301
+ inputFocusForWrapper: inputFocusForWrapper,
2302
+ inputEnterForWrapper: inputEnterForWrapper,
2303
+ inputClearForWrapper: inputClearForWrapper,
2070
2304
  handleInputFocus: handleInputFocus,
2071
2305
  isFocus: isFocus
2072
2306
  });
@@ -2087,12 +2321,17 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2087
2321
  handleClickOutside: handleClickOutside,
2088
2322
  handleInputFocus: handleInputFocus,
2089
2323
  handleInputChange: handleInputChange,
2324
+ handleInputPaste: handleInputPaste,
2090
2325
  handleLogicalChange: handleLogicalChange,
2091
2326
  handleInputKeyup: handleInputKeyup,
2092
2327
  handleSelectItem: handleSelectItem,
2093
2328
  handleSelectCondtionItem: handleSelectCondtionItem,
2094
2329
  handleMenuFooterClick: handleMenuFooterClick,
2095
2330
  resolveClassName: resolveClassName,
2331
+ inputFocusForWrapper: inputFocusForWrapper,
2332
+ inputEnterForWrapper: inputEnterForWrapper,
2333
+ inputClearForWrapper: inputClearForWrapper,
2334
+ deleteInputTextNode: deleteInputTextNode,
2096
2335
  t: t
2097
2336
  };
2098
2337
  },
@@ -2115,7 +2354,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2115
2354
  }
2116
2355
  } : {});
2117
2356
  var inputContent = function inputContent() {
2118
- var _this$keyword2;
2357
+ var _this$keyword2, _this$usingItem, _this$usingItem2;
2119
2358
  return (0,external_vue_namespaceObject.withDirectives)((0,external_vue_namespaceObject.createVNode)("div", {
2120
2359
  "ref": "inputRef",
2121
2360
  "class": {
@@ -2127,13 +2366,37 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2127
2366
  "data-placeholder": !inputInnerHtml && !_this.keyword ? _this.placeholder : '',
2128
2367
  "data-tips": placeholder || '',
2129
2368
  "spellcheck": "false",
2369
+ "onPaste": _this.handleInputPaste,
2130
2370
  "onFocus": _this.handleInputFocus,
2131
2371
  "onInput": _this.handleInputChange,
2132
2372
  "onKeydown": _this.handleInputKeyup
2133
- }, null), [[(0,external_vue_namespaceObject.resolveDirective)("clickoutside"), _this.handleClickOutside]]);
2373
+ }, [((_this$usingItem = _this.usingItem) === null || _this$usingItem === void 0 ? void 0 : _this$usingItem.name) && (!_this.usingItem.isSpecialType() ? (0,external_vue_namespaceObject.createVNode)("span", {
2374
+ "data-key": _this.usingItem.name,
2375
+ "data-type": _this.usingItem.type,
2376
+ "key": _this.usingItem.nameRenderkey,
2377
+ "onMousedown": function onMousedown(e) {
2378
+ return e.preventDefault();
2379
+ },
2380
+ "contenteditable": false,
2381
+ "style": {
2382
+ color: '#979BA5'
2383
+ }
2384
+ }, [_this.usingItem.name, (0,external_vue_namespaceObject.createTextVNode)(":\xA0")]) : (0,external_vue_namespaceObject.createVNode)("span", {
2385
+ "data-key": _this.usingItem.name,
2386
+ "data-type": _this.usingItem.type,
2387
+ "key": _this.usingItem.nameRenderkey
2388
+ }, [_this.usingItem.name])), (_this$usingItem2 = _this.usingItem) === null || _this$usingItem2 === void 0 || (_this$usingItem2 = _this$usingItem2.values) === null || _this$usingItem2 === void 0 ? void 0 : _this$usingItem2.map(function (item, index) {
2389
+ return (0,external_vue_namespaceObject.createVNode)("span", {
2390
+ "key": index,
2391
+ "data-key": item.name,
2392
+ "data-type": "value",
2393
+ "data-id": item.id,
2394
+ "data-index": index
2395
+ }, [index > 0 ? " ".concat(_this.usingItem.logical, " ") : '', item.name]);
2396
+ })]), [[(0,external_vue_namespaceObject.resolveDirective)("clickoutside"), _this.handleClickOutside]]);
2134
2397
  };
2135
2398
  var popoverContent = function popoverContent() {
2136
- var _this$menuList2, _this$usingItem, _this$usingItem2;
2399
+ var _this$menuList2, _this$usingItem3, _this$usingItem4;
2137
2400
  if (_this.loading) {
2138
2401
  return (0,external_vue_namespaceObject.createVNode)("div", null, [_this.t.loading]);
2139
2402
  }
@@ -2152,8 +2415,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2152
2415
  return item.id;
2153
2416
  })) || [],
2154
2417
  "conditions": showCondition ? _this.conditions : [],
2155
- "logical": (_this$usingItem = _this.usingItem) === null || _this$usingItem === void 0 ? void 0 : _this$usingItem.logical,
2156
- "showLogical": (_this$usingItem2 = _this.usingItem) === null || _this$usingItem2 === void 0 ? void 0 : _this$usingItem2.showLogical,
2418
+ "logical": (_this$usingItem3 = _this.usingItem) === null || _this$usingItem3 === void 0 ? void 0 : _this$usingItem3.logical,
2419
+ "showLogical": (_this$usingItem4 = _this.usingItem) === null || _this$usingItem4 === void 0 ? void 0 : _this$usingItem4.showLogical,
2157
2420
  "onUpdate:logical": _this.handleLogicalChange,
2158
2421
  "onSelectItem": _this.handleSelectItem,
2159
2422
  "onSelectCondition": _this.handleSelectCondtionItem,
@@ -2232,6 +2495,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2232
2495
  setup: function setup(_props, _ref) {
2233
2496
  var emit = _ref.emit;
2234
2497
  var inputRef = ref(null);
2498
+ var selectedInputRef = ref(null);
2235
2499
  var _useSearchSelectInjec = useSearchSelectInject(),
2236
2500
  onEditClick = _useSearchSelectInjec.onEditClick,
2237
2501
  onEditEnter = _useSearchSelectInjec.onEditEnter,
@@ -2256,8 +2520,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2256
2520
  if (isFocus) return;
2257
2521
  onEditBlur();
2258
2522
  }
2259
- function handleInputOutside() {
2260
- return true;
2523
+ function handleInputOutside(target) {
2524
+ var _selectedInputRef$val;
2525
+ return !((_selectedInputRef$val = selectedInputRef.value) !== null && _selectedInputRef$val !== void 0 && _selectedInputRef$val.contains(target));
2261
2526
  }
2262
2527
  function copySeletedItem(item) {
2263
2528
  var newItem = new SelectedItem(item.searchItem, item.type);
@@ -2267,6 +2532,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2267
2532
  }
2268
2533
  return {
2269
2534
  inputRef: inputRef,
2535
+ selectedInputRef: selectedInputRef,
2270
2536
  editKey: editKey,
2271
2537
  copySeletedItem: copySeletedItem,
2272
2538
  handleDeleteSelected: handleDeleteSelected,
@@ -2281,7 +2547,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2281
2547
  var contentComponent = function contentComponent(item, index) {
2282
2548
  return _this.editKey === "".concat(item.id, "_").concat(index) ? (0,external_vue_namespaceObject.createVNode)("div", {
2283
2549
  "class": "selected-input",
2284
- "key": _this.editKey.toString()
2550
+ "key": _this.editKey.toString(),
2551
+ "ref": "selectedInputRef"
2285
2552
  }, [(0,external_vue_namespaceObject.createVNode)(input, {
2286
2553
  "ref": "inputRef",
2287
2554
  "key": _this.editKey.toString(),
@@ -2410,6 +2677,13 @@ var SearchSelectProps = {
2410
2677
  return [ValueBehavior.ALL, ValueBehavior.NEEDKEY].includes(v);
2411
2678
  }
2412
2679
  }
2680
+ // deleteBehavior: {
2681
+ // type: String as PropType<`${DeleteBehavior}`>,
2682
+ // default: DeleteBehavior.CHAR,
2683
+ // validator(v: DeleteBehavior) {
2684
+ // return [DeleteBehavior.CHAR, DeleteBehavior.VALUE].includes(v);
2685
+ // },
2686
+ // },
2413
2687
  };
2414
2688
  /* harmony default export */ const search_select = ((0,external_vue_namespaceObject.defineComponent)({
2415
2689
  name: 'SearchSelect',
@@ -2525,7 +2799,11 @@ var SearchSelectProps = {
2525
2799
  onEditEnter: onEditEnter,
2526
2800
  onEditBlur: onEditBlur,
2527
2801
  onValidate: onValidate,
2528
- editKey: editKey
2802
+ editKey: editKey,
2803
+ searchData: (0,external_vue_namespaceObject.computed)(function () {
2804
+ return props.data;
2805
+ }),
2806
+ isClickOutside: handleInputOutside
2529
2807
  });
2530
2808
  function onEditClick(item, index) {
2531
2809
  editKey.value = "".concat(item.id, "_").concat(index);
@@ -2577,12 +2855,13 @@ var SearchSelectProps = {
2577
2855
  }
2578
2856
  function handleWrapClick() {
2579
2857
  if (!editKey.value) {
2580
- inputRef.value.handleInputFocus();
2858
+ inputRef.value.inputFocusForWrapper();
2581
2859
  }
2582
2860
  }
2583
2861
  function handleClearAll() {
2584
2862
  selectedList.value = [];
2585
2863
  overflowIndex.value = -1;
2864
+ inputRef.value.inputClearForWrapper();
2586
2865
  emit('update:modelValue', []);
2587
2866
  }
2588
2867
  function handleInputOutside(target) {
@@ -2614,6 +2893,7 @@ var SearchSelectProps = {
2614
2893
  isFocus.value = v;
2615
2894
  }
2616
2895
  function handleClickSearch(e) {
2896
+ inputRef.value.inputEnterForWrapper();
2617
2897
  emit('search', e);
2618
2898
  }
2619
2899
  return {