bkui-vue 1.0.3-beta.54 → 1.0.3-beta.55
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/dist/index.cjs.js +45 -47
- package/dist/index.esm.js +9608 -9557
- package/dist/index.umd.js +44 -46
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/search-select/index.d.ts +18 -3
- package/lib/search-select/index.js +380 -211
- package/lib/search-select/input.d.ts +2 -1
- package/lib/search-select/search-select.css +19 -6
- package/lib/search-select/search-select.d.ts +6 -1
- package/lib/search-select/search-select.less +15 -12
- package/lib/search-select/search-select.variable.css +19 -6
- package/lib/search-select/selected.d.ts +2 -1
- package/lib/search-select/utils.d.ts +6 -1
- package/package.json +1 -1
@@ -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, ["
|
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 {
|
@@ -922,6 +982,7 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
922
982
|
* IN THE SOFTWARE.
|
923
983
|
*/
|
924
984
|
|
985
|
+
|
925
986
|
/**
|
926
987
|
* @description: 获取menu list方法
|
927
988
|
* @param {ISearchItem} item 已选择的key字段 为空则代表当前并未选择key字段
|
@@ -955,11 +1016,13 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
955
1016
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
956
1017
|
_classCallCheck(this, SelectedItem);
|
957
1018
|
_defineProperty(this, "values", []);
|
1019
|
+
_defineProperty(this, "nameRenderkey", (0,shared_namespaceObject.random)(4));
|
958
1020
|
this.searchItem = searchItem;
|
959
1021
|
this.type = type;
|
960
1022
|
this.id = searchItem.id;
|
961
1023
|
this.name = searchItem.name;
|
962
1024
|
this.logical = searchItem.logical || SearchLogical.OR;
|
1025
|
+
this.type = type;
|
963
1026
|
}
|
964
1027
|
_createClass(SelectedItem, [{
|
965
1028
|
key: "multiple",
|
@@ -1024,6 +1087,7 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
1024
1087
|
}, {
|
1025
1088
|
key: "addValue",
|
1026
1089
|
value: function addValue(item) {
|
1090
|
+
this.nameRenderkey = (0,shared_namespaceObject.random)(4);
|
1027
1091
|
if (this.multiple) {
|
1028
1092
|
var index = this.values.findIndex(function (val) {
|
1029
1093
|
return val.id === item.id;
|
@@ -1037,6 +1101,66 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
1037
1101
|
}
|
1038
1102
|
this.values = [item];
|
1039
1103
|
}
|
1104
|
+
}, {
|
1105
|
+
key: "str2Values",
|
1106
|
+
value: function str2Values(str) {
|
1107
|
+
var _this = this;
|
1108
|
+
var list = str === null || str === void 0 ? void 0 : str.split(this.logical).map(function (v) {
|
1109
|
+
return v.trim();
|
1110
|
+
}).filter(function (v) {
|
1111
|
+
return v;
|
1112
|
+
});
|
1113
|
+
if (!(list !== null && list !== void 0 && list.length)) return [];
|
1114
|
+
var findChildByName = function findChildByName(name) {
|
1115
|
+
return _this.children.find(function (item) {
|
1116
|
+
return item.name === name;
|
1117
|
+
});
|
1118
|
+
};
|
1119
|
+
if (!this.multiple) {
|
1120
|
+
var val = list.join(this.logical).trim();
|
1121
|
+
var item = findChildByName(val);
|
1122
|
+
return [{
|
1123
|
+
id: item ? item.id : val,
|
1124
|
+
name: item ? item.name : val,
|
1125
|
+
disabled: !!(item !== null && item !== void 0 && item.disabled)
|
1126
|
+
}];
|
1127
|
+
}
|
1128
|
+
// 对于多选情况,处理整个列表
|
1129
|
+
return list.map(function (val) {
|
1130
|
+
var existing = _this.values.find(function (item) {
|
1131
|
+
return item.name === val;
|
1132
|
+
});
|
1133
|
+
if (existing) return existing;
|
1134
|
+
var item = findChildByName(val);
|
1135
|
+
return {
|
1136
|
+
id: item ? item.id : val,
|
1137
|
+
name: item ? item.name : val,
|
1138
|
+
disabled: !!(item !== null && item !== void 0 && item.disabled)
|
1139
|
+
};
|
1140
|
+
});
|
1141
|
+
}
|
1142
|
+
}, {
|
1143
|
+
key: "addValues",
|
1144
|
+
value: function addValues(str) {
|
1145
|
+
var mergeValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
1146
|
+
var list = this.str2Values(str.split(/(\s|\||,|、|\/|\n\r|\n)/gm).filter(function (v) {
|
1147
|
+
return !!v.trim();
|
1148
|
+
}).concat(this.values.map(function (item) {
|
1149
|
+
return mergeValues ? item.name : '';
|
1150
|
+
})).filter(function (v) {
|
1151
|
+
return !!v.trim();
|
1152
|
+
}).join(this.logical));
|
1153
|
+
this.values = list;
|
1154
|
+
}
|
1155
|
+
}, {
|
1156
|
+
key: "getValue",
|
1157
|
+
value: function getValue(str) {
|
1158
|
+
return this.values.find(function (item) {
|
1159
|
+
return item.id === str;
|
1160
|
+
}) || this.values.find(function (item) {
|
1161
|
+
return item.name === str;
|
1162
|
+
});
|
1163
|
+
}
|
1040
1164
|
}, {
|
1041
1165
|
key: "toValue",
|
1042
1166
|
value: function toValue() {
|
@@ -1315,9 +1439,10 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
1315
1439
|
|
1316
1440
|
|
1317
1441
|
|
1442
|
+
|
1443
|
+
|
1318
1444
|
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; }
|
1319
1445
|
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; }
|
1320
|
-
|
1321
1446
|
/*
|
1322
1447
|
* Tencent is pleased to support the open source community by making
|
1323
1448
|
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
@@ -1403,7 +1528,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1403
1528
|
var menuList = (0,external_vue_namespaceObject.ref)([]);
|
1404
1529
|
var _useSearchSelectInjec = useSearchSelectInject(),
|
1405
1530
|
editKey = _useSearchSelectInjec.editKey,
|
1406
|
-
onValidate = _useSearchSelectInjec.onValidate
|
1531
|
+
onValidate = _useSearchSelectInjec.onValidate,
|
1532
|
+
searchData = _useSearchSelectInjec.searchData;
|
1407
1533
|
var valueLoagic = (0,external_vue_namespaceObject.computed)(function () {
|
1408
1534
|
var _usingItem$value;
|
1409
1535
|
return ((_usingItem$value = usingItem.value) === null || _usingItem$value === void 0 ? void 0 : _usingItem$value.logical) || SearchLogical.OR;
|
@@ -1414,13 +1540,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1414
1540
|
}
|
1415
1541
|
});
|
1416
1542
|
// effects
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
}
|
1422
|
-
|
1423
|
-
}
|
1543
|
+
// watchEffect(
|
1544
|
+
// () => {
|
1545
|
+
// if (!keyword.value) {
|
1546
|
+
// setInputText();
|
1547
|
+
// }
|
1548
|
+
// },
|
1549
|
+
// { flush: 'pre' },
|
1550
|
+
// );
|
1424
1551
|
(0,external_vue_namespaceObject.watch)([menuList, showPopover], function () {
|
1425
1552
|
var _menuList$value;
|
1426
1553
|
if ((_menuList$value = menuList.value) !== null && _menuList$value !== void 0 && _menuList$value.some(function (item) {
|
@@ -1494,53 +1621,72 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1494
1621
|
function handleClickOutside(e) {
|
1495
1622
|
var _popoverRef$value, _props$clickOutside;
|
1496
1623
|
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)) {
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1624
|
+
if (props.mode === SearchInputMode.EDIT || usingItem.value) {
|
1625
|
+
usingItem.value && handleKeyEnter();
|
1626
|
+
if (!usingItem.value) {
|
1627
|
+
emit('focus', false);
|
1628
|
+
}
|
1501
1629
|
return;
|
1502
1630
|
}
|
1503
|
-
showPopover.value = false;
|
1504
1631
|
isFocus.value = false;
|
1632
|
+
showPopover.value = false;
|
1505
1633
|
emit('focus', isFocus.value);
|
1506
1634
|
}
|
1507
1635
|
}
|
1508
|
-
function handleInputFocus(
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
var _usingItem$value4;
|
1518
|
-
event.preventDefault();
|
1519
|
-
text = text.replace(/(\r|\n)/gm, " ".concat(valueLoagic.value, " ")).replace(/\s{2}/gm, '');
|
1520
|
-
inputRef.value.innerText = text;
|
1521
|
-
setInputFocus();
|
1522
|
-
keyword.value = text.replace(((_usingItem$value4 = usingItem.value) === null || _usingItem$value4 === void 0 ? void 0 : _usingItem$value4.keyInnerText) || '', '').trim();
|
1523
|
-
debounceSetMenuList();
|
1524
|
-
} 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)) {
|
1525
|
-
var _usingItem$value6, _usingItem$value7, _usingItem$value$valu, _text;
|
1526
|
-
var outerText = text.replace("\xA0", " ").replace(((_usingItem$value6 = usingItem.value) === null || _usingItem$value6 === void 0 ? void 0 : _usingItem$value6.keyInnerText.replace("\xA0", " ").trim()) || '', '').trim();
|
1527
|
-
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());
|
1528
|
-
if (hasKeyword && outerText && (_usingItem$value$valu = usingItem.value.values) !== null && _usingItem$value$valu !== void 0 && _usingItem$value$valu.length) {
|
1529
|
-
keyword.value = outerText;
|
1530
|
-
debounceSetMenuList();
|
1531
|
-
return;
|
1636
|
+
function handleInputFocus() {
|
1637
|
+
if (props.mode === SearchInputMode.EDIT && usingItem.value && !isFocus.value) {
|
1638
|
+
var range = document.createRange();
|
1639
|
+
var selection = window.getSelection();
|
1640
|
+
var nodeList = [];
|
1641
|
+
if (usingItem.value.values.length) {
|
1642
|
+
nodeList = Array.from(inputRef.value.querySelectorAll('[data-type="value"]'));
|
1643
|
+
} else {
|
1644
|
+
nodeList = Array.from(inputRef.value.querySelectorAll("[data-type=\"".concat(usingItem.value.type, "\"]")));
|
1532
1645
|
}
|
1533
|
-
if (
|
1534
|
-
|
1646
|
+
if (!nodeList.length) return;
|
1647
|
+
range.selectNodeContents(nodeList.at(-1));
|
1648
|
+
selection === null || selection === void 0 || selection.removeAllRanges();
|
1649
|
+
selection.addRange(range); // 注意这里会触发focu事件
|
1650
|
+
setInputFocus(true, false);
|
1651
|
+
return;
|
1652
|
+
}
|
1653
|
+
setMenuList();
|
1654
|
+
setInputFocus(false, !isFocus.value);
|
1655
|
+
}
|
1656
|
+
function handleInputPaste(event) {
|
1657
|
+
event.preventDefault();
|
1658
|
+
var clipboardData = event.clipboardData;
|
1659
|
+
var pastedData = clipboardData.getData('text');
|
1660
|
+
var tempDiv = document.createElement('div');
|
1661
|
+
tempDiv.innerHTML = pastedData;
|
1662
|
+
var formattedText = (tempDiv.textContent || tempDiv.innerText || '').trim();
|
1663
|
+
if (!usingItem.value) {
|
1664
|
+
var formateItem = str2SeletedItem(formattedText);
|
1665
|
+
if (formateItem) {
|
1666
|
+
usingItem.value = formateItem;
|
1667
|
+
setInputFocus(true, true);
|
1668
|
+
return;
|
1535
1669
|
}
|
1536
|
-
keyword.value =
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
keyword.value = text.replace("\xA0", " ").replace(((_usingItem$value9 = usingItem.value) === null || _usingItem$value9 === void 0 ? void 0 : _usingItem$value9.keyInnerText.replace("\xA0", " ")) || '', '').trim();
|
1670
|
+
keyword.value = formattedText.split(/(\s|\||,|、|\/|\n\r|\n)/gm).filter(function (v) {
|
1671
|
+
return !!v.trim();
|
1672
|
+
}).join(valueLoagic.value);
|
1673
|
+
inputRef.value.innerText = keyword.value;
|
1541
1674
|
setInputFocus();
|
1542
1675
|
debounceSetMenuList();
|
1676
|
+
return;
|
1677
|
+
}
|
1678
|
+
usingItem.value.addValues(formattedText);
|
1679
|
+
debounceSetMenuList();
|
1680
|
+
}
|
1681
|
+
function handleInputChange(event) {
|
1682
|
+
var text = event.target.innerText;
|
1683
|
+
if (!usingItem.value) {
|
1684
|
+
keyword.value = text;
|
1685
|
+
debounceSetMenuList();
|
1686
|
+
return;
|
1543
1687
|
}
|
1688
|
+
keyword.value = usingItem.value.isSpecialType() ? text.trim() : text.replace(usingItem.value.name, '').replace(':', '').trim();
|
1689
|
+
debounceSetMenuList();
|
1544
1690
|
}
|
1545
1691
|
function handleInputKeyup(event) {
|
1546
1692
|
switch (event.code) {
|
@@ -1549,10 +1695,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1549
1695
|
if (props.valueBehavior === ValueBehavior.NEEDKEY && menuList.value.some(function (item) {
|
1550
1696
|
return item.id === menuHoverId.value;
|
1551
1697
|
})) return;
|
1552
|
-
handleKeyEnter(event)
|
1698
|
+
handleKeyEnter(event).then(function (v) {
|
1699
|
+
return v && clearInput();
|
1700
|
+
});
|
1553
1701
|
break;
|
1554
1702
|
case 'Backspace':
|
1555
|
-
handleKeyBackspace();
|
1703
|
+
handleKeyBackspace(event);
|
1556
1704
|
default:
|
1557
1705
|
showNoSelectValueError.value = false;
|
1558
1706
|
break;
|
@@ -1563,7 +1711,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1563
1711
|
}
|
1564
1712
|
function _handleKeyEnter() {
|
1565
1713
|
_handleKeyEnter = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee(event) {
|
1566
|
-
var
|
1714
|
+
var _keyword$value, _usingItem$value4, _usingItem$value5;
|
1715
|
+
var formatItem, valueList, _res, _valueList, _formatItem, _res2, res;
|
1567
1716
|
return regenerator_default().wrap(function _callee$(_context) {
|
1568
1717
|
while (1) switch (_context.prev = _context.next) {
|
1569
1718
|
case 0:
|
@@ -1575,7 +1724,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1575
1724
|
});
|
1576
1725
|
case 3:
|
1577
1726
|
if (usingItem.value) {
|
1578
|
-
_context.next =
|
1727
|
+
_context.next = 17;
|
1579
1728
|
break;
|
1580
1729
|
}
|
1581
1730
|
if (!(!keyword.value || props.valueBehavior === ValueBehavior.NEEDKEY)) {
|
@@ -1584,43 +1733,54 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1584
1733
|
}
|
1585
1734
|
return _context.abrupt("return");
|
1586
1735
|
case 6:
|
1587
|
-
|
1736
|
+
formatItem = str2SeletedItem(keyword.value);
|
1737
|
+
valueList = (formatItem === null || formatItem === void 0 ? void 0 : formatItem.values) || [{
|
1588
1738
|
id: keyword.value,
|
1589
1739
|
name: keyword.value
|
1590
|
-
};
|
1591
|
-
_context.next =
|
1592
|
-
return
|
1593
|
-
|
1740
|
+
}];
|
1741
|
+
_context.next = 10;
|
1742
|
+
return Promise.all(valueList.map(function (item) {
|
1743
|
+
return validateUsingItemValues(item);
|
1744
|
+
})).then(function () {
|
1745
|
+
return true;
|
1746
|
+
})["catch"](function () {
|
1747
|
+
return false;
|
1748
|
+
});
|
1749
|
+
case 10:
|
1594
1750
|
_res = _context.sent;
|
1595
1751
|
if (_res) {
|
1596
|
-
_context.next =
|
1752
|
+
_context.next = 13;
|
1597
1753
|
break;
|
1598
1754
|
}
|
1599
1755
|
return _context.abrupt("return");
|
1600
|
-
case
|
1601
|
-
emit('add', new SelectedItem(
|
1756
|
+
case 13:
|
1757
|
+
emit('add', formatItem || new SelectedItem(_objectSpread({}, valueList[0]), 'text'));
|
1602
1758
|
keyword.value = '';
|
1603
1759
|
setMenuList();
|
1604
|
-
return _context.abrupt("return");
|
1605
|
-
case
|
1606
|
-
values = usingItem.value.values;
|
1607
|
-
if (values !== null && values !== void 0 && values.length) {
|
1608
|
-
_context.next = 43;
|
1609
|
-
break;
|
1610
|
-
}
|
1760
|
+
return _context.abrupt("return", true);
|
1761
|
+
case 17:
|
1611
1762
|
if (!((_keyword$value = keyword.value) !== null && _keyword$value !== void 0 && _keyword$value.length)) {
|
1612
|
-
_context.next =
|
1763
|
+
_context.next = 32;
|
1613
1764
|
break;
|
1614
1765
|
}
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1766
|
+
_valueList = [];
|
1767
|
+
if (usingItem.value.isSpecialType()) {
|
1768
|
+
_formatItem = str2SeletedItem(keyword.value);
|
1769
|
+
if (_formatItem) {
|
1770
|
+
usingItem.value = _formatItem;
|
1771
|
+
_valueList = _formatItem.values;
|
1772
|
+
}
|
1773
|
+
}
|
1774
|
+
if (!_valueList.length) {
|
1775
|
+
_valueList = usingItem.value.str2Values(keyword.value);
|
1618
1776
|
}
|
1619
|
-
valueList = keyword.value.split(valueLoagic.value);
|
1620
1777
|
_context.next = 23;
|
1621
|
-
return
|
1622
|
-
|
1623
|
-
|
1778
|
+
return Promise.all(_valueList.map(function (item) {
|
1779
|
+
return validateUsingItemValues(item);
|
1780
|
+
})).then(function () {
|
1781
|
+
return true;
|
1782
|
+
})["catch"](function () {
|
1783
|
+
return false;
|
1624
1784
|
});
|
1625
1785
|
case 23:
|
1626
1786
|
_res2 = _context.sent;
|
@@ -1630,77 +1790,38 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1630
1790
|
}
|
1631
1791
|
return _context.abrupt("return");
|
1632
1792
|
case 26:
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
});
|
1639
|
-
_context.next = 36;
|
1640
|
-
break;
|
1641
|
-
case 29:
|
1642
|
-
_value = {
|
1643
|
-
id: keyword.value,
|
1644
|
-
name: keyword.value
|
1645
|
-
};
|
1646
|
-
_context.next = 32;
|
1647
|
-
return validateUsingItemValues(_value);
|
1648
|
-
case 32:
|
1649
|
-
_res3 = _context.sent;
|
1650
|
-
if (_res3) {
|
1651
|
-
_context.next = 35;
|
1652
|
-
break;
|
1793
|
+
if (usingItem.value.type === 'text') {
|
1794
|
+
usingItem.value.name = keyword.value;
|
1795
|
+
usingItem.value.id = keyword.value;
|
1796
|
+
} else {
|
1797
|
+
usingItem.value.values = _valueList;
|
1653
1798
|
}
|
1654
|
-
return _context.abrupt("return");
|
1655
|
-
case 35:
|
1656
|
-
usingItem.value.addValue(_value);
|
1657
|
-
case 36:
|
1658
1799
|
emit('add', usingItem.value);
|
1659
1800
|
keyword.value = '';
|
1660
1801
|
usingItem.value = null;
|
1661
1802
|
setInputFocus(true);
|
1662
|
-
return _context.abrupt("return");
|
1663
|
-
case
|
1664
|
-
|
1665
|
-
|
1666
|
-
case 43:
|
1667
|
-
if (!keyword.value) {
|
1668
|
-
_context.next = 56;
|
1669
|
-
break;
|
1670
|
-
}
|
1671
|
-
_value2 = {
|
1672
|
-
id: keyword.value,
|
1673
|
-
name: keyword.value
|
1674
|
-
};
|
1675
|
-
_context.next = 47;
|
1676
|
-
return validateUsingItemValues(_value2);
|
1677
|
-
case 47:
|
1678
|
-
_res4 = _context.sent;
|
1679
|
-
if (_res4) {
|
1680
|
-
_context.next = 50;
|
1803
|
+
return _context.abrupt("return", true);
|
1804
|
+
case 32:
|
1805
|
+
if (!(!((_usingItem$value4 = usingItem.value) !== null && _usingItem$value4 !== void 0 && _usingItem$value4.isSpecialType()) && ((_usingItem$value5 = usingItem.value) === null || _usingItem$value5 === void 0 || (_usingItem$value5 = _usingItem$value5.values) === null || _usingItem$value5 === void 0 ? void 0 : _usingItem$value5.length) < 1)) {
|
1806
|
+
_context.next = 35;
|
1681
1807
|
break;
|
1682
1808
|
}
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
keyword.value = '';
|
1688
|
-
usingItem.value = null;
|
1689
|
-
setInputFocus(true);
|
1690
|
-
return _context.abrupt("return");
|
1691
|
-
case 56:
|
1692
|
-
_context.next = 58;
|
1809
|
+
showNoSelectValueError.value = true;
|
1810
|
+
return _context.abrupt("return", false);
|
1811
|
+
case 35:
|
1812
|
+
_context.next = 37;
|
1693
1813
|
return validateUsingItemValues();
|
1694
|
-
case
|
1814
|
+
case 37:
|
1695
1815
|
res = _context.sent;
|
1696
1816
|
if (res) {
|
1697
|
-
_context.next =
|
1817
|
+
_context.next = 40;
|
1698
1818
|
break;
|
1699
1819
|
}
|
1700
|
-
return _context.abrupt("return");
|
1701
|
-
case
|
1820
|
+
return _context.abrupt("return", false);
|
1821
|
+
case 40:
|
1702
1822
|
setSelectedItem();
|
1703
|
-
|
1823
|
+
return _context.abrupt("return", false);
|
1824
|
+
case 42:
|
1704
1825
|
case "end":
|
1705
1826
|
return _context.stop();
|
1706
1827
|
}
|
@@ -1708,22 +1829,31 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1708
1829
|
}));
|
1709
1830
|
return _handleKeyEnter.apply(this, arguments);
|
1710
1831
|
}
|
1711
|
-
function handleKeyBackspace() {
|
1712
|
-
var _usingItem$
|
1832
|
+
function handleKeyBackspace(event) {
|
1833
|
+
var _usingItem$value2;
|
1713
1834
|
// 删除已选择项
|
1714
1835
|
if (!usingItem.value && !keyword.value) {
|
1715
1836
|
emit('delete');
|
1716
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
1717
1837
|
setTimeout(setMenuList, 16);
|
1718
1838
|
return;
|
1719
1839
|
}
|
1720
|
-
if ((_usingItem$
|
1721
|
-
|
1722
|
-
//
|
1723
|
-
|
1724
|
-
|
1840
|
+
if ((_usingItem$value2 = usingItem.value) !== null && _usingItem$value2 !== void 0 && _usingItem$value2.values.length) {
|
1841
|
+
// if (hasSelectAllContent) {
|
1842
|
+
// }
|
1843
|
+
event.preventDefault();
|
1844
|
+
var selection = window.getSelection();
|
1845
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.rangeCount) > 0) {
|
1846
|
+
var _node;
|
1847
|
+
var range = selection.getRangeAt(0);
|
1848
|
+
var startPos = range.startContainer;
|
1849
|
+
var node = startPos;
|
1850
|
+
while (node && node.parentNode !== inputRef.value) {
|
1851
|
+
node = node.parentNode;
|
1852
|
+
}
|
1853
|
+
var editIndex = ((_node = node) === null || _node === void 0 || (_node = _node.dataset) === null || _node === void 0 ? void 0 : _node.index) || -1;
|
1854
|
+
usingItem.value.values.splice(+editIndex, 1);
|
1725
1855
|
keyword.value = '';
|
1726
|
-
setInputFocus();
|
1856
|
+
setInputFocus(false, false);
|
1727
1857
|
return;
|
1728
1858
|
}
|
1729
1859
|
} else if (!keyword.value) {
|
@@ -1738,8 +1868,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1738
1868
|
}
|
1739
1869
|
function _handleSelectItem() {
|
1740
1870
|
_handleSelectItem = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee2(item, type) {
|
1741
|
-
var _item$value,
|
1742
|
-
var _item$realId2, _item$realId, seleted,
|
1871
|
+
var _item$value, _usingItem$value6, _usingItem$value7, _usingItem$value8;
|
1872
|
+
var _item$realId2, _item$realId, seleted, _res3, isCondition, res;
|
1743
1873
|
return regenerator_default().wrap(function _callee2$(_context2) {
|
1744
1874
|
while (1) switch (_context2.prev = _context2.next) {
|
1745
1875
|
case 0:
|
@@ -1754,7 +1884,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1754
1884
|
seleted = new SelectedItem(_objectSpread(_objectSpread({}, item), {}, {
|
1755
1885
|
id: (_item$realId = item.realId) !== null && _item$realId !== void 0 ? _item$realId : item.id
|
1756
1886
|
}), type);
|
1757
|
-
seleted.
|
1887
|
+
seleted.addValues(item.value.name, false);
|
1758
1888
|
setSelectedItem(seleted);
|
1759
1889
|
if (props.valueBehavior === ValueBehavior.NEEDKEY && menuHoverId.value) {
|
1760
1890
|
setInputFocus(true);
|
@@ -1765,12 +1895,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1765
1895
|
usingItem.value = new SelectedItem(_objectSpread(_objectSpread({}, item), {}, {
|
1766
1896
|
id: (_item$realId2 = item.realId) !== null && _item$realId2 !== void 0 ? _item$realId2 : item.id
|
1767
1897
|
}), type);
|
1768
|
-
usingItem.value.
|
1898
|
+
usingItem.value.addValues(item.value.name, false);
|
1769
1899
|
_context2.next = 12;
|
1770
|
-
return
|
1900
|
+
return Promise.all(usingItem.value.values.map(function (v) {
|
1901
|
+
return validateUsingItemValues(v);
|
1902
|
+
}));
|
1771
1903
|
case 12:
|
1772
|
-
|
1773
|
-
if (
|
1904
|
+
_res3 = _context2.sent;
|
1905
|
+
if (_res3) {
|
1774
1906
|
_context2.next = 16;
|
1775
1907
|
break;
|
1776
1908
|
}
|
@@ -1782,7 +1914,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1782
1914
|
setInputFocus(true);
|
1783
1915
|
return _context2.abrupt("return");
|
1784
1916
|
case 20:
|
1785
|
-
if (
|
1917
|
+
if (usingItem.value) {
|
1786
1918
|
_context2.next = 28;
|
1787
1919
|
break;
|
1788
1920
|
}
|
@@ -1794,7 +1926,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1794
1926
|
setInputFocus(props.valueBehavior === ValueBehavior.NEEDKEY && !!menuHoverId.value);
|
1795
1927
|
return _context2.abrupt("return");
|
1796
1928
|
case 28:
|
1797
|
-
if (!(((_usingItem$
|
1929
|
+
if (!(((_usingItem$value6 = usingItem.value) === null || _usingItem$value6 === void 0 ? void 0 : _usingItem$value6.type) === 'condition')) {
|
1798
1930
|
_context2.next = 32;
|
1799
1931
|
break;
|
1800
1932
|
}
|
@@ -1802,22 +1934,23 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1802
1934
|
setSelectedItem();
|
1803
1935
|
return _context2.abrupt("return");
|
1804
1936
|
case 32:
|
1805
|
-
usingItem.value.addValue(item);
|
1806
|
-
|
1937
|
+
(_usingItem$value7 = usingItem.value) === null || _usingItem$value7 === void 0 || _usingItem$value7.addValue(item);
|
1938
|
+
keyword.value = '';
|
1939
|
+
_context2.next = 36;
|
1807
1940
|
return validateUsingItemValues(item);
|
1808
|
-
case
|
1941
|
+
case 36:
|
1809
1942
|
res = _context2.sent;
|
1810
1943
|
if (res) {
|
1811
|
-
_context2.next =
|
1944
|
+
_context2.next = 39;
|
1812
1945
|
break;
|
1813
1946
|
}
|
1814
1947
|
return _context2.abrupt("return");
|
1815
|
-
case
|
1948
|
+
case 39:
|
1816
1949
|
if (!usingItem.value.multiple) setSelectedItem();
|
1817
|
-
if (props.valueBehavior === ValueBehavior.NEEDKEY && (_usingItem$
|
1950
|
+
if (props.valueBehavior === ValueBehavior.NEEDKEY && (_usingItem$value8 = usingItem.value) !== null && _usingItem$value8 !== void 0 && _usingItem$value8.multiple) {
|
1818
1951
|
setInputFocus();
|
1819
1952
|
}
|
1820
|
-
case
|
1953
|
+
case 41:
|
1821
1954
|
case "end":
|
1822
1955
|
return _context2.stop();
|
1823
1956
|
}
|
@@ -1829,10 +1962,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1829
1962
|
handleSelectItem(item, 'condition');
|
1830
1963
|
}
|
1831
1964
|
function handleMenuFooterClick(item) {
|
1832
|
-
var _usingItem$
|
1965
|
+
var _usingItem$value3;
|
1833
1966
|
switch (item.id) {
|
1834
1967
|
case 'confirm':
|
1835
|
-
if (!((_usingItem$
|
1968
|
+
if (!((_usingItem$value3 = usingItem.value) !== null && _usingItem$value3 !== void 0 && _usingItem$value3.values.length)) return;
|
1836
1969
|
keyword.value = '';
|
1837
1970
|
handleKeyEnter();
|
1838
1971
|
break;
|
@@ -1848,7 +1981,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1848
1981
|
}
|
1849
1982
|
function _validateUsingItemValues() {
|
1850
1983
|
_validateUsingItemValues = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee3(value) {
|
1851
|
-
var _usingItem$
|
1984
|
+
var _usingItem$value9, searchItem, validate, values;
|
1852
1985
|
return regenerator_default().wrap(function _callee3$(_context3) {
|
1853
1986
|
while (1) switch (_context3.prev = _context3.next) {
|
1854
1987
|
case 0:
|
@@ -1861,7 +1994,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1861
1994
|
case 3:
|
1862
1995
|
return _context3.abrupt("return", _context3.sent);
|
1863
1996
|
case 4:
|
1864
|
-
_usingItem$
|
1997
|
+
_usingItem$value9 = usingItem.value, searchItem = _usingItem$value9.searchItem, validate = _usingItem$value9.validate, values = _usingItem$value9.values;
|
1865
1998
|
if (!(validate && typeof props.validateValues === 'function')) {
|
1866
1999
|
_context3.next = 9;
|
1867
2000
|
break;
|
@@ -1914,47 +2047,24 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1914
2047
|
}));
|
1915
2048
|
return _validateValues.apply(this, arguments);
|
1916
2049
|
}
|
1917
|
-
function setInputFocus() {
|
1918
|
-
var refleshMenuList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
1919
|
-
if (refleshMenuList) {
|
1920
|
-
setTimeout(function () {
|
1921
|
-
setMenuList();
|
1922
|
-
}, 16);
|
1923
|
-
}
|
1924
|
-
isFocus.value = true;
|
1925
|
-
showPopover.value = true;
|
1926
|
-
showNoSelectValueError.value = false;
|
1927
|
-
var timer = setTimeout(function () {
|
1928
|
-
if (inputRef.value) {
|
1929
|
-
inputRef.value.focus(); // 光标移至最后
|
1930
|
-
var selection = window.getSelection();
|
1931
|
-
if (selection.focusOffset === 0) {
|
1932
|
-
selection.selectAllChildren(inputRef.value);
|
1933
|
-
selection.collapseToEnd();
|
1934
|
-
}
|
1935
|
-
}
|
1936
|
-
window.clearTimeout(timer);
|
1937
|
-
}, 0);
|
1938
|
-
emit('focus', isFocus.value);
|
1939
|
-
}
|
1940
2050
|
function setMenuList() {
|
1941
2051
|
return _setMenuList.apply(this, arguments);
|
1942
2052
|
}
|
1943
2053
|
function _setMenuList() {
|
1944
2054
|
_setMenuList = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee5() {
|
1945
|
-
var _usingItem$
|
1946
|
-
var list, _usingItem$
|
2055
|
+
var _usingItem$value10, _usingItem$value$valu;
|
2056
|
+
var list, _usingItem$value11, _keyword$value2, hoverItem;
|
1947
2057
|
return regenerator_default().wrap(function _callee5$(_context5) {
|
1948
2058
|
while (1) switch (_context5.prev = _context5.next) {
|
1949
2059
|
case 0:
|
1950
2060
|
list = [];
|
1951
|
-
if (!(typeof props.getMenuList === 'function' && (typeof ((_usingItem$
|
2061
|
+
if (!(typeof props.getMenuList === 'function' && (typeof ((_usingItem$value10 = usingItem.value) === null || _usingItem$value10 === void 0 || (_usingItem$value10 = _usingItem$value10.searchItem) === null || _usingItem$value10 === void 0 ? void 0 : _usingItem$value10.async) === 'undefined' || usingItem.value.searchItem.async === true))) {
|
1952
2062
|
_context5.next = 9;
|
1953
2063
|
break;
|
1954
2064
|
}
|
1955
2065
|
loading.value = true;
|
1956
2066
|
_context5.next = 5;
|
1957
|
-
return props.getMenuList((_usingItem$
|
2067
|
+
return props.getMenuList((_usingItem$value11 = usingItem.value) === null || _usingItem$value11 === void 0 ? void 0 : _usingItem$value11.searchItem, keyword.value)["catch"](function () {
|
1958
2068
|
return [];
|
1959
2069
|
});
|
1960
2070
|
case 5:
|
@@ -2015,7 +2125,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2015
2125
|
});
|
2016
2126
|
} else if (usingItem.value.type === 'condition') {
|
2017
2127
|
list = props.conditions;
|
2018
|
-
} else if (!((_usingItem$value$
|
2128
|
+
} 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) {
|
2019
2129
|
list = usingItem.value.children.filter(function (item) {
|
2020
2130
|
return item.name.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase());
|
2021
2131
|
});
|
@@ -2040,35 +2150,66 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2040
2150
|
}));
|
2041
2151
|
return _setMenuList.apply(this, arguments);
|
2042
2152
|
}
|
2153
|
+
function setCursorToEnd() {
|
2154
|
+
if (!inputRef.value) return;
|
2155
|
+
var range = document.createRange();
|
2156
|
+
var selection = window.getSelection();
|
2157
|
+
range.selectNodeContents(inputRef.value);
|
2158
|
+
range.collapse(false);
|
2159
|
+
selection.removeAllRanges();
|
2160
|
+
selection.addRange(range);
|
2161
|
+
}
|
2162
|
+
function setInputFocus() {
|
2163
|
+
var refleshMenuList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
2164
|
+
var needCursorToEnd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
2165
|
+
if (refleshMenuList) {
|
2166
|
+
setTimeout(setMenuList, 16);
|
2167
|
+
}
|
2168
|
+
isFocus.value = true;
|
2169
|
+
showPopover.value = true;
|
2170
|
+
showNoSelectValueError.value = false;
|
2171
|
+
needCursorToEnd && (0,external_vue_namespaceObject.nextTick)(setCursorToEnd);
|
2172
|
+
emit('focus', isFocus.value);
|
2173
|
+
}
|
2043
2174
|
function setSelectedItem(item) {
|
2044
2175
|
emit('add', item !== null && item !== void 0 ? item : usingItem.value);
|
2045
2176
|
usingItem.value = null;
|
2046
2177
|
keyword.value = '';
|
2047
|
-
setInputFocus(
|
2178
|
+
setInputFocus(true, true);
|
2179
|
+
(0,external_vue_namespaceObject.nextTick)(clearInput);
|
2048
2180
|
}
|
2049
2181
|
function clearInput() {
|
2050
|
-
|
2051
|
-
|
2052
|
-
setInputText(text.slice(0, -1));
|
2053
|
-
clearInput();
|
2054
|
-
} else if (text[0] === '\n' || text[0] === '\r') {
|
2055
|
-
setInputText(text.slice(1));
|
2056
|
-
clearInput();
|
2057
|
-
}
|
2058
|
-
}
|
2059
|
-
function setInputText() {
|
2060
|
-
var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
2061
|
-
if (inputRef.value) {
|
2062
|
-
var _usingItem$value13;
|
2063
|
-
inputRef.value.innerHTML = text || ((_usingItem$value13 = usingItem.value) === null || _usingItem$value13 === void 0 ? void 0 : _usingItem$value13.inputInnerHtml) || '';
|
2064
|
-
}
|
2182
|
+
if (!inputRef.value) return;
|
2183
|
+
inputRef.value.innerText = '';
|
2065
2184
|
}
|
2066
2185
|
function handleLogicalChange(logical) {
|
2067
2186
|
if (!usingItem.value) return;
|
2068
2187
|
usingItem.value.logical = logical;
|
2069
2188
|
}
|
2189
|
+
function str2SeletedItem(str) {
|
2190
|
+
var _str$split = str.split(':'),
|
2191
|
+
_str$split2 = _slicedToArray(_str$split, 2),
|
2192
|
+
key = _str$split2[0],
|
2193
|
+
value = _str$split2[1];
|
2194
|
+
if (key !== null && key !== void 0 && key.trim()) {
|
2195
|
+
var selectedItem = searchData.value.find(function (item) {
|
2196
|
+
return item.name === key.trim();
|
2197
|
+
});
|
2198
|
+
if (selectedItem) {
|
2199
|
+
var item = new SelectedItem(_objectSpread({}, selectedItem), 'default');
|
2200
|
+
item.addValues(value);
|
2201
|
+
return item;
|
2202
|
+
}
|
2203
|
+
}
|
2204
|
+
return undefined;
|
2205
|
+
}
|
2206
|
+
function inputFocusForWrapper() {
|
2207
|
+
var _inputRef$value2;
|
2208
|
+
(_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 || _inputRef$value2.focus();
|
2209
|
+
}
|
2070
2210
|
// expose
|
2071
2211
|
expose({
|
2212
|
+
inputFocusForWrapper: inputFocusForWrapper,
|
2072
2213
|
handleInputFocus: handleInputFocus,
|
2073
2214
|
isFocus: isFocus
|
2074
2215
|
});
|
@@ -2089,6 +2230,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2089
2230
|
handleClickOutside: handleClickOutside,
|
2090
2231
|
handleInputFocus: handleInputFocus,
|
2091
2232
|
handleInputChange: handleInputChange,
|
2233
|
+
handleInputPaste: handleInputPaste,
|
2092
2234
|
handleLogicalChange: handleLogicalChange,
|
2093
2235
|
handleInputKeyup: handleInputKeyup,
|
2094
2236
|
handleSelectItem: handleSelectItem,
|
@@ -2117,7 +2259,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2117
2259
|
}
|
2118
2260
|
} : {});
|
2119
2261
|
var inputContent = function inputContent() {
|
2120
|
-
var _this$keyword2;
|
2262
|
+
var _this$keyword2, _this$usingItem, _this$usingItem2;
|
2121
2263
|
return (0,external_vue_namespaceObject.withDirectives)((0,external_vue_namespaceObject.createVNode)("div", {
|
2122
2264
|
"ref": "inputRef",
|
2123
2265
|
"class": {
|
@@ -2129,13 +2271,37 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2129
2271
|
"data-placeholder": !inputInnerHtml && !_this.keyword ? _this.placeholder : '',
|
2130
2272
|
"data-tips": placeholder || '',
|
2131
2273
|
"spellcheck": "false",
|
2274
|
+
"onPaste": _this.handleInputPaste,
|
2132
2275
|
"onFocus": _this.handleInputFocus,
|
2133
2276
|
"onInput": _this.handleInputChange,
|
2134
2277
|
"onKeydown": _this.handleInputKeyup
|
2135
|
-
}, null)
|
2278
|
+
}, [((_this$usingItem = _this.usingItem) === null || _this$usingItem === void 0 ? void 0 : _this$usingItem.name) && (!_this.usingItem.isSpecialType() ? (0,external_vue_namespaceObject.createVNode)("span", {
|
2279
|
+
"data-key": _this.usingItem.name,
|
2280
|
+
"data-type": _this.usingItem.type,
|
2281
|
+
"key": _this.usingItem.nameRenderkey,
|
2282
|
+
"onMousedown": function onMousedown(e) {
|
2283
|
+
return e.preventDefault();
|
2284
|
+
},
|
2285
|
+
"contenteditable": false,
|
2286
|
+
"style": {
|
2287
|
+
color: '#979BA5'
|
2288
|
+
}
|
2289
|
+
}, [_this.usingItem.name, (0,external_vue_namespaceObject.createTextVNode)(":\xA0")]) : (0,external_vue_namespaceObject.createVNode)("span", {
|
2290
|
+
"data-key": _this.usingItem.name,
|
2291
|
+
"data-type": _this.usingItem.type,
|
2292
|
+
"key": _this.usingItem.nameRenderkey
|
2293
|
+
}, [_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) {
|
2294
|
+
return (0,external_vue_namespaceObject.createVNode)("span", {
|
2295
|
+
"key": index,
|
2296
|
+
"data-key": item.name,
|
2297
|
+
"data-type": "value",
|
2298
|
+
"data-id": item.id,
|
2299
|
+
"data-index": index
|
2300
|
+
}, [index > 0 ? " ".concat(_this.usingItem.logical, " ") : '', item.name]);
|
2301
|
+
})]), [[(0,external_vue_namespaceObject.resolveDirective)("clickoutside"), _this.handleClickOutside]]);
|
2136
2302
|
};
|
2137
2303
|
var popoverContent = function popoverContent() {
|
2138
|
-
var _this$menuList2, _this$
|
2304
|
+
var _this$menuList2, _this$usingItem3, _this$usingItem4;
|
2139
2305
|
if (_this.loading) {
|
2140
2306
|
return (0,external_vue_namespaceObject.createVNode)("div", null, [_this.t.loading]);
|
2141
2307
|
}
|
@@ -2154,8 +2320,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2154
2320
|
return item.id;
|
2155
2321
|
})) || [],
|
2156
2322
|
"conditions": showCondition ? _this.conditions : [],
|
2157
|
-
"logical": (_this$
|
2158
|
-
"showLogical": (_this$
|
2323
|
+
"logical": (_this$usingItem3 = _this.usingItem) === null || _this$usingItem3 === void 0 ? void 0 : _this$usingItem3.logical,
|
2324
|
+
"showLogical": (_this$usingItem4 = _this.usingItem) === null || _this$usingItem4 === void 0 ? void 0 : _this$usingItem4.showLogical,
|
2159
2325
|
"onUpdate:logical": _this.handleLogicalChange,
|
2160
2326
|
"onSelectItem": _this.handleSelectItem,
|
2161
2327
|
"onSelectCondition": _this.handleSelectCondtionItem,
|
@@ -2528,7 +2694,10 @@ var SearchSelectProps = {
|
|
2528
2694
|
onEditEnter: onEditEnter,
|
2529
2695
|
onEditBlur: onEditBlur,
|
2530
2696
|
onValidate: onValidate,
|
2531
|
-
editKey: editKey
|
2697
|
+
editKey: editKey,
|
2698
|
+
searchData: (0,external_vue_namespaceObject.computed)(function () {
|
2699
|
+
return props.data;
|
2700
|
+
})
|
2532
2701
|
});
|
2533
2702
|
function onEditClick(item, index) {
|
2534
2703
|
editKey.value = "".concat(item.id, "_").concat(index);
|
@@ -2580,7 +2749,7 @@ var SearchSelectProps = {
|
|
2580
2749
|
}
|
2581
2750
|
function handleWrapClick() {
|
2582
2751
|
if (!editKey.value) {
|
2583
|
-
inputRef.value.
|
2752
|
+
inputRef.value.inputFocusForWrapper();
|
2584
2753
|
}
|
2585
2754
|
}
|
2586
2755
|
function handleClearAll() {
|