bkui-vue 2.0.1-beta.31 → 2.0.1-beta.32
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 +37 -37
- package/dist/index.esm.js +5718 -5725
- package/dist/index.umd.js +36 -36
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/index.js +1 -1
- package/lib/search-select/index.d.ts +28 -66
- package/lib/search-select/index.js +50 -55
- package/lib/search-select/input.d.ts +3 -3
- package/lib/search-select/search-select.d.ts +11 -37
- package/lib/search-select/selected.d.ts +7 -7
- package/lib/search-select/utils.d.ts +3 -3
- package/lib/table/index.js +8 -3
- package/lib/tag/index.js +0 -1
- package/lib/tag/tag.css +1 -1
- package/lib/tag/tag.less +1 -1
- package/lib/tag/tag.variable.css +1 -1
- package/package.json +1 -1
@@ -1014,19 +1014,19 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
1014
1014
|
var ValueBehavior;
|
1015
1015
|
(function (ValueBehavior) {
|
1016
1016
|
ValueBehavior["ALL"] = "all";
|
1017
|
-
ValueBehavior["
|
1017
|
+
ValueBehavior["NEED_KEY"] = "need-key";
|
1018
1018
|
})(ValueBehavior || (ValueBehavior = {}));
|
1019
1019
|
var DeleteBehavior;
|
1020
1020
|
(function (DeleteBehavior) {
|
1021
1021
|
DeleteBehavior["CHAR"] = "delete-char";
|
1022
1022
|
DeleteBehavior["VALUE"] = "delete-value";
|
1023
1023
|
})(DeleteBehavior || (DeleteBehavior = {}));
|
1024
|
-
var
|
1024
|
+
var SEARCH_SELECT_PROVIDER_KEY = Symbol('SEARCH_SELECT_PROVIDER_KEY');
|
1025
1025
|
var useSearchSelectProvider = function useSearchSelectProvider(data) {
|
1026
|
-
(0,external_vue_namespaceObject.provide)(
|
1026
|
+
(0,external_vue_namespaceObject.provide)(SEARCH_SELECT_PROVIDER_KEY, data);
|
1027
1027
|
};
|
1028
1028
|
var useSearchSelectInject = function useSearchSelectInject() {
|
1029
|
-
return (0,external_vue_namespaceObject.inject)(
|
1029
|
+
return (0,external_vue_namespaceObject.inject)(SEARCH_SELECT_PROVIDER_KEY);
|
1030
1030
|
};
|
1031
1031
|
var SearchInputMode;
|
1032
1032
|
(function (SearchInputMode) {
|
@@ -1045,7 +1045,7 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
1045
1045
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
1046
1046
|
_classCallCheck(this, SelectedItem);
|
1047
1047
|
_defineProperty(this, "values", []);
|
1048
|
-
_defineProperty(this, "
|
1048
|
+
_defineProperty(this, "nameRenderKey", (0,shared_namespaceObject.random)(4));
|
1049
1049
|
this.searchItem = searchItem;
|
1050
1050
|
this.type = type;
|
1051
1051
|
this.id = searchItem.id;
|
@@ -1121,7 +1121,7 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
1121
1121
|
}, {
|
1122
1122
|
key: "addValue",
|
1123
1123
|
value: function addValue(item) {
|
1124
|
-
this.
|
1124
|
+
this.nameRenderKey = (0,shared_namespaceObject.random)(4);
|
1125
1125
|
if (this.multiple) {
|
1126
1126
|
var index = this.values.findIndex(function (val) {
|
1127
1127
|
return val.id === item.id;
|
@@ -1527,7 +1527,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1527
1527
|
return [];
|
1528
1528
|
}
|
1529
1529
|
},
|
1530
|
-
|
1530
|
+
defaultUsingItem: Object,
|
1531
1531
|
mode: {
|
1532
1532
|
type: String,
|
1533
1533
|
"default": SearchInputMode.DEFAULT
|
@@ -1550,7 +1550,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1550
1550
|
var showNoSelectValueError = (0,external_vue_namespaceObject.ref)(false);
|
1551
1551
|
var isFocus = (0,external_vue_namespaceObject.ref)(false);
|
1552
1552
|
var showPopover = (0,external_vue_namespaceObject.ref)(false);
|
1553
|
-
var usingItem = (0,external_vue_namespaceObject.ref)(props.
|
1553
|
+
var usingItem = (0,external_vue_namespaceObject.ref)(props.defaultUsingItem);
|
1554
1554
|
var menuHoverId = (0,external_vue_namespaceObject.ref)('');
|
1555
1555
|
var loading = (0,external_vue_namespaceObject.ref)(false);
|
1556
1556
|
var debounceSetMenuList = (0,shared_namespaceObject.debounce)(300, setMenuList);
|
@@ -1562,7 +1562,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1562
1562
|
editKey = _useSearchSelectInjec.editKey,
|
1563
1563
|
onValidate = _useSearchSelectInjec.onValidate,
|
1564
1564
|
searchData = _useSearchSelectInjec.searchData;
|
1565
|
-
var
|
1565
|
+
var valueLogic = (0,external_vue_namespaceObject.computed)(function () {
|
1566
1566
|
var _usingItem$value;
|
1567
1567
|
return ((_usingItem$value = usingItem.value) === null || _usingItem$value === void 0 ? void 0 : _usingItem$value.logical) || SearchLogical.OR;
|
1568
1568
|
});
|
@@ -1588,7 +1588,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1588
1588
|
if (shouldBindEvent) {
|
1589
1589
|
if (!isBindEvent) {
|
1590
1590
|
var _menuList$value$find;
|
1591
|
-
menuHoverId.value = props.valueBehavior === ValueBehavior.
|
1591
|
+
menuHoverId.value = props.valueBehavior === ValueBehavior.NEED_KEY ? ((_menuList$value$find = menuList.value.find(function (item) {
|
1592
1592
|
return !item.disabled;
|
1593
1593
|
})) === null || _menuList$value$find === void 0 ? void 0 : _menuList$value$find.id) || '' : '';
|
1594
1594
|
isBindEvent = true;
|
@@ -1597,7 +1597,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1597
1597
|
} else {
|
1598
1598
|
document.removeEventListener('keydown', handleDocumentKeydown);
|
1599
1599
|
isBindEvent = false;
|
1600
|
-
if (props.valueBehavior !== ValueBehavior.
|
1600
|
+
if (props.valueBehavior !== ValueBehavior.NEED_KEY) {
|
1601
1601
|
menuHoverId.value = '';
|
1602
1602
|
}
|
1603
1603
|
}
|
@@ -1678,7 +1678,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1678
1678
|
var selection = window.getSelection();
|
1679
1679
|
range.selectNodeContents(nodeList.at(-1));
|
1680
1680
|
selection === null || selection === void 0 || selection.removeAllRanges();
|
1681
|
-
selection.addRange(range); // 注意这里会触发
|
1681
|
+
selection.addRange(range); // 注意这里会触发focus事件
|
1682
1682
|
setInputFocus(true, false);
|
1683
1683
|
return;
|
1684
1684
|
}
|
@@ -1689,7 +1689,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1689
1689
|
event.preventDefault();
|
1690
1690
|
var formattedText = event.clipboardData.getData('text').trim();
|
1691
1691
|
if (!usingItem.value) {
|
1692
|
-
var formateItem =
|
1692
|
+
var formateItem = str2SelectedItem(formattedText);
|
1693
1693
|
if (formateItem) {
|
1694
1694
|
usingItem.value = formateItem;
|
1695
1695
|
setInputFocus(true, true);
|
@@ -1697,7 +1697,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1697
1697
|
}
|
1698
1698
|
keyword.value = formattedText.split(ValueSplitRegex).filter(function (v) {
|
1699
1699
|
return v.trim() && !ValueSplitTestRegex.test(v);
|
1700
|
-
}).join(" ".concat(
|
1700
|
+
}).join(" ".concat(valueLogic.value, " "));
|
1701
1701
|
inputRef.value.innerText = keyword.value;
|
1702
1702
|
setInputFocus();
|
1703
1703
|
debounceSetMenuList();
|
@@ -1720,7 +1720,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1720
1720
|
switch (event.code) {
|
1721
1721
|
case 'Enter':
|
1722
1722
|
case 'NumpadEnter':
|
1723
|
-
if (props.valueBehavior === ValueBehavior.
|
1723
|
+
if (props.valueBehavior === ValueBehavior.NEED_KEY && menuList.value.some(function (item) {
|
1724
1724
|
return item.id === menuHoverId.value;
|
1725
1725
|
})) return;
|
1726
1726
|
handleKeyEnter(event).then(function (v) {
|
@@ -1755,7 +1755,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1755
1755
|
_context.next = 9;
|
1756
1756
|
break;
|
1757
1757
|
}
|
1758
|
-
if (!(!keyword.value || props.valueBehavior === ValueBehavior.
|
1758
|
+
if (!(!keyword.value || props.valueBehavior === ValueBehavior.NEED_KEY)) {
|
1759
1759
|
_context.next = 6;
|
1760
1760
|
break;
|
1761
1761
|
}
|
@@ -1810,6 +1810,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1810
1810
|
// 删除已选择项
|
1811
1811
|
if (!usingItem.value && !keyword.value) {
|
1812
1812
|
emit('delete');
|
1813
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
1813
1814
|
setTimeout(setMenuList, 16);
|
1814
1815
|
return;
|
1815
1816
|
}
|
@@ -1857,7 +1858,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1857
1858
|
id: (_item$realId = item.realId) !== null && _item$realId !== void 0 ? _item$realId : item.id
|
1858
1859
|
}), type);
|
1859
1860
|
selectedItem.addValues(item.value.name, false);
|
1860
|
-
if (!(props.valueBehavior === ValueBehavior.
|
1861
|
+
if (!(props.valueBehavior === ValueBehavior.NEED_KEY && menuHoverId.value)) {
|
1861
1862
|
_context2.next = 8;
|
1862
1863
|
break;
|
1863
1864
|
}
|
@@ -1900,7 +1901,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1900
1901
|
setSelectedItem();
|
1901
1902
|
}
|
1902
1903
|
showPopover.value = isCondition || !!usingItem.value.children.length;
|
1903
|
-
setInputFocus(props.valueBehavior === ValueBehavior.
|
1904
|
+
setInputFocus(props.valueBehavior === ValueBehavior.NEED_KEY && !!menuHoverId.value);
|
1904
1905
|
return _context2.abrupt("return");
|
1905
1906
|
case 27:
|
1906
1907
|
if (usingItem.value) {
|
@@ -1919,7 +1920,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1919
1920
|
if (!usingItem.value.multiple) {
|
1920
1921
|
setSelectedItem();
|
1921
1922
|
}
|
1922
|
-
if (props.valueBehavior === ValueBehavior.
|
1923
|
+
if (props.valueBehavior === ValueBehavior.NEED_KEY && (_usingItem$value12 = usingItem.value) !== null && _usingItem$value12 !== void 0 && _usingItem$value12.multiple) {
|
1923
1924
|
setInputFocus();
|
1924
1925
|
}
|
1925
1926
|
case 34:
|
@@ -1930,7 +1931,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1930
1931
|
}));
|
1931
1932
|
return _handleSelectItem.apply(this, arguments);
|
1932
1933
|
}
|
1933
|
-
function
|
1934
|
+
function handleSelectConditionItem(item) {
|
1934
1935
|
handleSelectItem(item, 'condition');
|
1935
1936
|
}
|
1936
1937
|
function handleMenuFooterClick(item) {
|
@@ -2118,7 +2119,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2118
2119
|
}
|
2119
2120
|
case 10:
|
2120
2121
|
menuList.value = list;
|
2121
|
-
if (props.valueBehavior === ValueBehavior.
|
2122
|
+
if (props.valueBehavior === ValueBehavior.NEED_KEY) {
|
2122
2123
|
hoverItem = list.find(function (item) {
|
2123
2124
|
return !item.disabled;
|
2124
2125
|
});
|
@@ -2145,7 +2146,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2145
2146
|
return regenerator_default().wrap(function _callee6$(_context6) {
|
2146
2147
|
while (1) switch (_context6.prev = _context6.next) {
|
2147
2148
|
case 0:
|
2148
|
-
formatItem =
|
2149
|
+
formatItem = str2SelectedItem(keyword.value);
|
2149
2150
|
valueList = (formatItem === null || formatItem === void 0 ? void 0 : formatItem.values) || [{
|
2150
2151
|
id: keyword.value,
|
2151
2152
|
name: keyword.value
|
@@ -2183,7 +2184,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2183
2184
|
case 0:
|
2184
2185
|
valueList = [];
|
2185
2186
|
if (usingItem.value.isSpecialType()) {
|
2186
|
-
formatItem =
|
2187
|
+
formatItem = str2SelectedItem(keyword.value);
|
2187
2188
|
if (formatItem) {
|
2188
2189
|
usingItem.value = formatItem;
|
2189
2190
|
valueList = formatItem.values;
|
@@ -2229,9 +2230,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2229
2230
|
selection.addRange(range);
|
2230
2231
|
}
|
2231
2232
|
function setInputFocus() {
|
2232
|
-
var
|
2233
|
+
var refreshMenuList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
2233
2234
|
var needCursorToEnd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
2234
|
-
if (
|
2235
|
+
if (refreshMenuList) {
|
2236
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
2235
2237
|
setTimeout(setMenuList, 16);
|
2236
2238
|
}
|
2237
2239
|
isFocus.value = true;
|
@@ -2258,7 +2260,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2258
2260
|
return inputRef.value.innerText = '';
|
2259
2261
|
});
|
2260
2262
|
}
|
2261
|
-
function
|
2263
|
+
function str2SelectedItem(str) {
|
2262
2264
|
var _str$split = str.split(':'),
|
2263
2265
|
_str$split2 = _slicedToArray(_str$split, 2),
|
2264
2266
|
key = _str$split2[0],
|
@@ -2360,7 +2362,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2360
2362
|
handleLogicalChange: handleLogicalChange,
|
2361
2363
|
handleInputKeyup: handleInputKeyup,
|
2362
2364
|
handleSelectItem: handleSelectItem,
|
2363
|
-
|
2365
|
+
handleSelectConditionItem: handleSelectConditionItem,
|
2364
2366
|
handleMenuFooterClick: handleMenuFooterClick,
|
2365
2367
|
resolveClassName: resolveClassName,
|
2366
2368
|
inputFocusForWrapper: inputFocusForWrapper,
|
@@ -2402,7 +2404,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2402
2404
|
"onKeydown": _this.handleInputKeyup,
|
2403
2405
|
"onPaste": _this.handleInputPaste
|
2404
2406
|
}, [((_this$usingItem = _this.usingItem) === null || _this$usingItem === void 0 ? void 0 : _this$usingItem.name) && (!_this.usingItem.isSpecialType() ? (0,external_vue_namespaceObject.createVNode)("span", {
|
2405
|
-
"key": _this.usingItem.
|
2407
|
+
"key": _this.usingItem.nameRenderKey,
|
2406
2408
|
"style": {
|
2407
2409
|
color: '#979BA5'
|
2408
2410
|
},
|
@@ -2413,7 +2415,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2413
2415
|
return e.preventDefault();
|
2414
2416
|
}
|
2415
2417
|
}, [_this.usingItem.name, (0,external_vue_namespaceObject.createTextVNode)(":\xA0")]) : (0,external_vue_namespaceObject.createVNode)("span", {
|
2416
|
-
"key": _this.usingItem.
|
2418
|
+
"key": _this.usingItem.nameRenderKey,
|
2417
2419
|
"data-key": _this.usingItem.name,
|
2418
2420
|
"data-type": _this.usingItem.type
|
2419
2421
|
}, [_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) {
|
@@ -2461,7 +2463,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2461
2463
|
})) || [],
|
2462
2464
|
"showLogical": (_this$usingItem5 = _this.usingItem) === null || _this$usingItem5 === void 0 ? void 0 : _this$usingItem5.showLogical,
|
2463
2465
|
"onFooterClick": _this.handleMenuFooterClick,
|
2464
|
-
"onSelectCondition": _this.
|
2466
|
+
"onSelectCondition": _this.handleSelectConditionItem,
|
2465
2467
|
"onSelectItem": _this.handleSelectItem,
|
2466
2468
|
"onUpdate:logical": _this.handleLogicalChange
|
2467
2469
|
}, null)]) : undefined;
|
@@ -2551,7 +2553,7 @@ function selected_objectSpread(e) { for (var r = 1; r < arguments.length; r++) {
|
|
2551
2553
|
function handleDeleteSelected(index) {
|
2552
2554
|
emit('delete', index);
|
2553
2555
|
}
|
2554
|
-
function
|
2556
|
+
function handleEditSelected(e, item, index) {
|
2555
2557
|
e.preventDefault();
|
2556
2558
|
e.stopPropagation();
|
2557
2559
|
onEditClick(item, index);
|
@@ -2576,7 +2578,7 @@ function selected_objectSpread(e) { for (var r = 1; r < arguments.length; r++) {
|
|
2576
2578
|
var _selectedInputRef$val;
|
2577
2579
|
return !((_selectedInputRef$val = selectedInputRef.value) !== null && _selectedInputRef$val !== void 0 && _selectedInputRef$val.contains(target));
|
2578
2580
|
}
|
2579
|
-
function
|
2581
|
+
function copySelectedItem(item) {
|
2580
2582
|
var newItem = new SelectedItem(item.searchItem, item.type);
|
2581
2583
|
newItem.values = item.values.slice();
|
2582
2584
|
newItem.logical = item.logical || SearchLogical.OR;
|
@@ -2586,9 +2588,9 @@ function selected_objectSpread(e) { for (var r = 1; r < arguments.length; r++) {
|
|
2586
2588
|
inputRef: inputRef,
|
2587
2589
|
selectedInputRef: selectedInputRef,
|
2588
2590
|
editKey: editKey,
|
2589
|
-
|
2591
|
+
copySelectedItem: copySelectedItem,
|
2590
2592
|
handleDeleteSelected: handleDeleteSelected,
|
2591
|
-
|
2593
|
+
handleEditSelected: handleEditSelected,
|
2592
2594
|
handleInputOutside: handleInputOutside,
|
2593
2595
|
handleAddSelected: handleAddSelected,
|
2594
2596
|
handleInputFocus: handleInputFocus
|
@@ -2607,7 +2609,7 @@ function selected_objectSpread(e) { for (var r = 1; r < arguments.length; r++) {
|
|
2607
2609
|
"clickOutside": _this.handleInputOutside,
|
2608
2610
|
"conditions": _this.conditions,
|
2609
2611
|
"data": _this.data,
|
2610
|
-
"
|
2612
|
+
"defaultUsingItem": _this.copySelectedItem(item),
|
2611
2613
|
"getMenuList": _this.getMenuList,
|
2612
2614
|
"mode": SearchInputMode.EDIT,
|
2613
2615
|
"showCondition": false,
|
@@ -2623,7 +2625,7 @@ function selected_objectSpread(e) { for (var r = 1; r < arguments.length; r++) {
|
|
2623
2625
|
}, [(0,external_vue_namespaceObject.createVNode)("span", {
|
2624
2626
|
"class": "selected-name",
|
2625
2627
|
"onClick": function onClick(e) {
|
2626
|
-
return _this.
|
2628
|
+
return _this.handleEditSelected(e, item, index);
|
2627
2629
|
}
|
2628
2630
|
}, [item.inputInnerText]), (0,external_vue_namespaceObject.createVNode)(icon_namespaceObject.Error, {
|
2629
2631
|
"class": "selected-clear",
|
@@ -2679,7 +2681,8 @@ function search_select_objectSpread(e) { for (var r = 1; r < arguments.length; r
|
|
2679
2681
|
|
2680
2682
|
|
2681
2683
|
var INPUT_PADDING_WIDTH = 40;
|
2682
|
-
var
|
2684
|
+
var SELECTED_MARGIN_RIGHT = 6;
|
2685
|
+
var INPUT_MIN_HEIGHT = 26;
|
2683
2686
|
var SearchSelectProps = {
|
2684
2687
|
data: {
|
2685
2688
|
type: Array,
|
@@ -2693,18 +2696,10 @@ var SearchSelectProps = {
|
|
2693
2696
|
return [];
|
2694
2697
|
}
|
2695
2698
|
},
|
2696
|
-
shrink: {
|
2697
|
-
type: Boolean,
|
2698
|
-
"default": true
|
2699
|
-
},
|
2700
2699
|
maxHeight: {
|
2701
2700
|
type: Number,
|
2702
2701
|
"default": 120
|
2703
2702
|
},
|
2704
|
-
minHeight: {
|
2705
|
-
type: Number,
|
2706
|
-
"default": 26
|
2707
|
-
},
|
2708
2703
|
conditions: {
|
2709
2704
|
type: Array,
|
2710
2705
|
"default": function _default() {
|
@@ -2726,7 +2721,7 @@ var SearchSelectProps = {
|
|
2726
2721
|
type: String,
|
2727
2722
|
"default": ValueBehavior.ALL,
|
2728
2723
|
validator: function validator(v) {
|
2729
|
-
return [ValueBehavior.ALL, ValueBehavior.
|
2724
|
+
return [ValueBehavior.ALL, ValueBehavior.NEED_KEY].includes(v);
|
2730
2725
|
}
|
2731
2726
|
}
|
2732
2727
|
// deleteBehavior: {
|
@@ -2800,13 +2795,13 @@ var SearchSelectProps = {
|
|
2800
2795
|
}
|
2801
2796
|
var list = [];
|
2802
2797
|
v.forEach(function (item) {
|
2803
|
-
var
|
2798
|
+
var selected = selectedList.value.find(function (set) {
|
2804
2799
|
return set.id === item.id && set.name === item.name;
|
2805
2800
|
});
|
2806
|
-
if ((
|
2807
|
-
|
2808
|
-
|
2809
|
-
list.push(
|
2801
|
+
if ((selected === null || selected === void 0 ? void 0 : selected.toValueKey()) === JSON.stringify(item)) {
|
2802
|
+
selected.values = item.values || [];
|
2803
|
+
selected.logical = item.logical || SearchLogical.OR;
|
2804
|
+
list.push(selected);
|
2810
2805
|
} else {
|
2811
2806
|
var _item$values;
|
2812
2807
|
var searchItem = props.data.find(function (set) {
|
@@ -2883,18 +2878,18 @@ var SearchSelectProps = {
|
|
2883
2878
|
return;
|
2884
2879
|
}
|
2885
2880
|
var inputEl = wrapRef.value.querySelector(".".concat(resolveClassName('search-select-container')));
|
2886
|
-
var maxWidth = wrapRef.value.querySelector('.search-container').clientWidth -
|
2881
|
+
var maxWidth = wrapRef.value.querySelector('.search-container').clientWidth - SELECTED_MARGIN_RIGHT - 2;
|
2887
2882
|
var tagList = inputEl.querySelectorAll('.search-container-selected:not(.overflow-selected)');
|
2888
2883
|
var width = 0;
|
2889
2884
|
var index = 0;
|
2890
2885
|
var i = 0;
|
2891
2886
|
while (index === 0 && width <= maxWidth - INPUT_PADDING_WIDTH && i <= tagList.length - 1) {
|
2892
2887
|
var el = tagList[i];
|
2893
|
-
if (el.clientHeight >
|
2888
|
+
if (el.clientHeight > INPUT_MIN_HEIGHT) {
|
2894
2889
|
overflowIndex.value = i;
|
2895
2890
|
return;
|
2896
2891
|
}
|
2897
|
-
width += el ? el.clientWidth +
|
2892
|
+
width += el ? el.clientWidth + SELECTED_MARGIN_RIGHT : 0;
|
2898
2893
|
if (width >= maxWidth - INPUT_PADDING_WIDTH) {
|
2899
2894
|
index = i;
|
2900
2895
|
}
|
@@ -2980,7 +2975,7 @@ var SearchSelectProps = {
|
|
2980
2975
|
var _this = this,
|
2981
2976
|
_this$$slots$prepend,
|
2982
2977
|
_this$$slots2;
|
2983
|
-
var maxHeight = "".concat(
|
2978
|
+
var maxHeight = "".concat(this.isFocus ? this.maxHeight : INPUT_MIN_HEIGHT, "px");
|
2984
2979
|
var showCondition = !!this.selectedList.length && this.selectedList.slice(-1)[0].type !== 'condition';
|
2985
2980
|
var menuSlots = Object.assign({}, this.$slots.menu ? {
|
2986
2981
|
menu: function menu(data) {
|
@@ -13,7 +13,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
13
13
|
type: PropType<ICommonItem[]>;
|
14
14
|
default: () => any[];
|
15
15
|
};
|
16
|
-
|
16
|
+
defaultUsingItem: PropType<SelectedItem>;
|
17
17
|
mode: {
|
18
18
|
type: PropType<SearchInputMode>;
|
19
19
|
default: SearchInputMode;
|
@@ -59,7 +59,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
59
59
|
handleLogicalChange: (logical: SearchLogical) => void;
|
60
60
|
handleInputKeyup: (event: KeyboardEvent) => void;
|
61
61
|
handleSelectItem: (item: ICommonItem, type?: SearchItemType) => Promise<void>;
|
62
|
-
|
62
|
+
handleSelectConditionItem: (item: ICommonItem) => void;
|
63
63
|
handleMenuFooterClick: (item: IMenuFooterItem) => void;
|
64
64
|
resolveClassName: (cls: string) => string;
|
65
65
|
inputFocusForWrapper: () => void;
|
@@ -90,7 +90,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
90
90
|
type: PropType<ICommonItem[]>;
|
91
91
|
default: () => any[];
|
92
92
|
};
|
93
|
-
|
93
|
+
defaultUsingItem: PropType<SelectedItem>;
|
94
94
|
mode: {
|
95
95
|
type: PropType<SearchInputMode>;
|
96
96
|
default: SearchInputMode;
|
@@ -3,25 +3,17 @@ import { type SlotsType } from 'vue';
|
|
3
3
|
import { GetMenuListFunc, ICommonItem, ISearchItem, ISearchValue, MenuSlotParams, SearchItemType, SearchLogical, SelectedItem, ValidateValuesFunc, ValueBehavior } from './utils';
|
4
4
|
export declare const SearchSelectProps: {
|
5
5
|
data: {
|
6
|
-
type: PropType<ISearchItem[]>;
|
6
|
+
type: PropType<Omit<ISearchItem, "value" | "isSelected">[]>;
|
7
7
|
default: () => any[];
|
8
8
|
};
|
9
9
|
modelValue: {
|
10
10
|
type: PropType<ISearchValue[]>;
|
11
11
|
default: () => any[];
|
12
12
|
};
|
13
|
-
shrink: {
|
14
|
-
type: BooleanConstructor;
|
15
|
-
default: boolean;
|
16
|
-
};
|
17
13
|
maxHeight: {
|
18
14
|
type: NumberConstructor;
|
19
15
|
default: number;
|
20
16
|
};
|
21
|
-
minHeight: {
|
22
|
-
type: NumberConstructor;
|
23
|
-
default: number;
|
24
|
-
};
|
25
17
|
conditions: {
|
26
18
|
type: PropType<ICommonItem[]>;
|
27
19
|
default: () => any[];
|
@@ -45,25 +37,17 @@ export declare const SearchSelectProps: {
|
|
45
37
|
};
|
46
38
|
declare const _default: import("vue").DefineComponent<{
|
47
39
|
data: {
|
48
|
-
type: PropType<ISearchItem[]>;
|
40
|
+
type: PropType<Omit<ISearchItem, "value" | "isSelected">[]>;
|
49
41
|
default: () => any[];
|
50
42
|
};
|
51
43
|
modelValue: {
|
52
44
|
type: PropType<ISearchValue[]>;
|
53
45
|
default: () => any[];
|
54
46
|
};
|
55
|
-
shrink: {
|
56
|
-
type: BooleanConstructor;
|
57
|
-
default: boolean;
|
58
|
-
};
|
59
47
|
maxHeight: {
|
60
48
|
type: NumberConstructor;
|
61
49
|
default: number;
|
62
50
|
};
|
63
|
-
minHeight: {
|
64
|
-
type: NumberConstructor;
|
65
|
-
default: number;
|
66
|
-
};
|
67
51
|
conditions: {
|
68
52
|
type: PropType<ICommonItem[]>;
|
69
53
|
default: () => any[];
|
@@ -98,7 +82,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
98
82
|
type: PropType<ICommonItem[]>;
|
99
83
|
default: () => any[];
|
100
84
|
};
|
101
|
-
|
85
|
+
defaultUsingItem: PropType<SelectedItem>;
|
102
86
|
mode: {
|
103
87
|
type: PropType<import("./utils").SearchInputMode>;
|
104
88
|
default: import("./utils").SearchInputMode;
|
@@ -149,7 +133,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
149
133
|
handleLogicalChange: (logical: SearchLogical) => void;
|
150
134
|
handleInputKeyup: (event: KeyboardEvent) => void;
|
151
135
|
handleSelectItem: (item: ICommonItem, type?: SearchItemType) => Promise<void>;
|
152
|
-
|
136
|
+
handleSelectConditionItem: (item: ICommonItem) => void;
|
153
137
|
handleMenuFooterClick: (item: import("./utils").IMenuFooterItem) => void;
|
154
138
|
resolveClassName: (cls: string) => string;
|
155
139
|
inputFocusForWrapper: () => void;
|
@@ -180,7 +164,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
180
164
|
type: PropType<ICommonItem[]>;
|
181
165
|
default: () => any[];
|
182
166
|
};
|
183
|
-
|
167
|
+
defaultUsingItem: PropType<SelectedItem>;
|
184
168
|
mode: {
|
185
169
|
type: PropType<import("./utils").SearchInputMode>;
|
186
170
|
default: import("./utils").SearchInputMode;
|
@@ -220,7 +204,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
220
204
|
type: PropType<ICommonItem[]>;
|
221
205
|
default: () => any[];
|
222
206
|
};
|
223
|
-
|
207
|
+
defaultUsingItem: PropType<SelectedItem>;
|
224
208
|
mode: {
|
225
209
|
type: PropType<import("./utils").SearchInputMode>;
|
226
210
|
default: import("./utils").SearchInputMode;
|
@@ -271,7 +255,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
271
255
|
handleLogicalChange: (logical: SearchLogical) => void;
|
272
256
|
handleInputKeyup: (event: KeyboardEvent) => void;
|
273
257
|
handleSelectItem: (item: ICommonItem, type?: SearchItemType) => Promise<void>;
|
274
|
-
|
258
|
+
handleSelectConditionItem: (item: ICommonItem) => void;
|
275
259
|
handleMenuFooterClick: (item: import("./utils").IMenuFooterItem) => void;
|
276
260
|
resolveClassName: (cls: string) => string;
|
277
261
|
inputFocusForWrapper: () => void;
|
@@ -318,7 +302,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
318
302
|
}[];
|
319
303
|
condition: string;
|
320
304
|
logical: SearchLogical;
|
321
|
-
|
305
|
+
nameRenderKey: string;
|
322
306
|
searchItem: {
|
323
307
|
id: string;
|
324
308
|
name: string;
|
@@ -411,7 +395,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
411
395
|
handleClickSearch: (e: MouseEvent) => void;
|
412
396
|
localConditions: import("vue").ComputedRef<ICommonItem[]>;
|
413
397
|
resolveClassName: (cls: string) => string;
|
414
|
-
handleSelectedKey: (a:
|
398
|
+
handleSelectedKey: (a: ICommonItem) => void;
|
415
399
|
t: import("vue").ComputedRef<{
|
416
400
|
pleaseSelect: string;
|
417
401
|
loading: string;
|
@@ -424,25 +408,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
424
408
|
}>;
|
425
409
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("search" | "update:modelValue" | "selectKey")[], "search" | "update:modelValue" | "selectKey", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
426
410
|
data: {
|
427
|
-
type: PropType<ISearchItem[]>;
|
411
|
+
type: PropType<Omit<ISearchItem, "value" | "isSelected">[]>;
|
428
412
|
default: () => any[];
|
429
413
|
};
|
430
414
|
modelValue: {
|
431
415
|
type: PropType<ISearchValue[]>;
|
432
416
|
default: () => any[];
|
433
417
|
};
|
434
|
-
shrink: {
|
435
|
-
type: BooleanConstructor;
|
436
|
-
default: boolean;
|
437
|
-
};
|
438
418
|
maxHeight: {
|
439
419
|
type: NumberConstructor;
|
440
420
|
default: number;
|
441
421
|
};
|
442
|
-
minHeight: {
|
443
|
-
type: NumberConstructor;
|
444
|
-
default: number;
|
445
|
-
};
|
446
422
|
conditions: {
|
447
423
|
type: PropType<ICommonItem[]>;
|
448
424
|
default: () => any[];
|
@@ -468,14 +444,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
468
444
|
onSelectKey?: (...args: any[]) => any;
|
469
445
|
onSearch?: (...args: any[]) => any;
|
470
446
|
}, {
|
471
|
-
data: ISearchItem[];
|
447
|
+
data: Omit<ISearchItem, "value" | "isSelected">[];
|
472
448
|
maxHeight: number;
|
473
449
|
clearable: boolean;
|
474
450
|
modelValue: ISearchValue[];
|
475
|
-
minHeight: number;
|
476
451
|
conditions: ICommonItem[];
|
477
452
|
valueBehavior: "all" | "need-key";
|
478
|
-
shrink: boolean;
|
479
453
|
uniqueSelect: boolean;
|
480
454
|
}, SlotsType<{
|
481
455
|
menu: MenuSlotParams;
|
@@ -34,7 +34,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
34
34
|
type: PropType<ICommonItem[]>;
|
35
35
|
default: () => any[];
|
36
36
|
};
|
37
|
-
|
37
|
+
defaultUsingItem: PropType<SelectedItem>;
|
38
38
|
mode: {
|
39
39
|
type: PropType<SearchInputMode>;
|
40
40
|
default: SearchInputMode;
|
@@ -85,7 +85,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
85
85
|
handleLogicalChange: (logical: SearchLogical) => void;
|
86
86
|
handleInputKeyup: (event: KeyboardEvent) => void;
|
87
87
|
handleSelectItem: (item: ICommonItem, type?: import("./utils").SearchItemType) => Promise<void>;
|
88
|
-
|
88
|
+
handleSelectConditionItem: (item: ICommonItem) => void;
|
89
89
|
handleMenuFooterClick: (item: import("./utils").IMenuFooterItem) => void;
|
90
90
|
resolveClassName: (cls: string) => string;
|
91
91
|
inputFocusForWrapper: () => void;
|
@@ -116,7 +116,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
116
116
|
type: PropType<ICommonItem[]>;
|
117
117
|
default: () => any[];
|
118
118
|
};
|
119
|
-
|
119
|
+
defaultUsingItem: PropType<SelectedItem>;
|
120
120
|
mode: {
|
121
121
|
type: PropType<SearchInputMode>;
|
122
122
|
default: SearchInputMode;
|
@@ -156,7 +156,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
156
156
|
type: PropType<ICommonItem[]>;
|
157
157
|
default: () => any[];
|
158
158
|
};
|
159
|
-
|
159
|
+
defaultUsingItem: PropType<SelectedItem>;
|
160
160
|
mode: {
|
161
161
|
type: PropType<SearchInputMode>;
|
162
162
|
default: SearchInputMode;
|
@@ -207,7 +207,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
207
207
|
handleLogicalChange: (logical: SearchLogical) => void;
|
208
208
|
handleInputKeyup: (event: KeyboardEvent) => void;
|
209
209
|
handleSelectItem: (item: ICommonItem, type?: import("./utils").SearchItemType) => Promise<void>;
|
210
|
-
|
210
|
+
handleSelectConditionItem: (item: ICommonItem) => void;
|
211
211
|
handleMenuFooterClick: (item: import("./utils").IMenuFooterItem) => void;
|
212
212
|
resolveClassName: (cls: string) => string;
|
213
213
|
inputFocusForWrapper: () => void;
|
@@ -233,9 +233,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
233
233
|
}>>;
|
234
234
|
selectedInputRef: import("vue").Ref<HTMLDivElement>;
|
235
235
|
editKey: import("vue").Ref<string>;
|
236
|
-
|
236
|
+
copySelectedItem: (item: SelectedItem) => SelectedItem;
|
237
237
|
handleDeleteSelected: (index: number) => void;
|
238
|
-
|
238
|
+
handleEditSelected: (e: MouseEvent, item: SelectedItem, index: number) => void;
|
239
239
|
handleInputOutside: (target: Node) => boolean;
|
240
240
|
handleAddSelected: (item: SelectedItem, index: number) => void;
|
241
241
|
handleInputFocus: (isFocus: boolean) => void;
|
@@ -7,7 +7,7 @@ import { ComputedRef, InjectionKey, Ref } from 'vue';
|
|
7
7
|
*/
|
8
8
|
export declare enum ValueBehavior {
|
9
9
|
ALL = "all",
|
10
|
-
|
10
|
+
NEED_KEY = "need-key"
|
11
11
|
}
|
12
12
|
export declare enum DeleteBehavior {
|
13
13
|
CHAR = "delete-char",
|
@@ -30,7 +30,7 @@ export interface ISearchSelectProvider {
|
|
30
30
|
searchData: ComputedRef<ISearchItem[]>;
|
31
31
|
isClickOutside: (target: Node) => boolean;
|
32
32
|
}
|
33
|
-
export declare const
|
33
|
+
export declare const SEARCH_SELECT_PROVIDER_KEY: InjectionKey<ISearchSelectProvider>;
|
34
34
|
export declare const useSearchSelectProvider: (data: ISearchSelectProvider) => void;
|
35
35
|
export declare const useSearchSelectInject: () => ISearchSelectProvider;
|
36
36
|
export declare enum SearchInputMode {
|
@@ -86,7 +86,7 @@ export declare class SelectedItem {
|
|
86
86
|
values: ICommonItem[];
|
87
87
|
condition: string;
|
88
88
|
logical: SearchLogical;
|
89
|
-
|
89
|
+
nameRenderKey: string;
|
90
90
|
constructor(searchItem: ISearchItem, type?: SearchItemType);
|
91
91
|
get multiple(): boolean;
|
92
92
|
get placeholder(): string;
|