zmdms-webui 2.7.9 → 2.8.0
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/es/select/select.js +19 -1
- package/package.json +1 -1
package/dist/es/select/select.js
CHANGED
|
@@ -120,7 +120,25 @@ var Select = function (props, ref) {
|
|
|
120
120
|
*/
|
|
121
121
|
var filterOptionHandle = function (input, option) {
|
|
122
122
|
var text = textContent(option === null || option === void 0 ? void 0 : option.children);
|
|
123
|
-
|
|
123
|
+
// 实现简易的分词查询逻辑
|
|
124
|
+
// 用空格分隔input
|
|
125
|
+
var inputList = input.split(" ").filter(function (item) { return item.trim() !== ""; });
|
|
126
|
+
// 遍历匹配
|
|
127
|
+
var isMatch = true;
|
|
128
|
+
var currentSearchText = text;
|
|
129
|
+
for (var i = 0; i < inputList.length; i++) {
|
|
130
|
+
var item = inputList[i];
|
|
131
|
+
// 找到上一个字符
|
|
132
|
+
var currentIndex = currentSearchText === null || currentSearchText === void 0 ? void 0 : currentSearchText.toLowerCase().indexOf(item.toLowerCase().trim());
|
|
133
|
+
if (currentIndex < 0) {
|
|
134
|
+
isMatch = false;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
// 重新赋值
|
|
138
|
+
currentSearchText = currentSearchText === null || currentSearchText === void 0 ? void 0 : currentSearchText.substring(currentIndex + item.length);
|
|
139
|
+
}
|
|
140
|
+
return isMatch;
|
|
141
|
+
// return text?.toLowerCase().indexOf(input.toLowerCase().trim()) >= 0;
|
|
124
142
|
};
|
|
125
143
|
return (jsx(Select$1, __assign({ defaultValue: showAll ? "" : undefined, showArrow: true, allowClear: true, dropdownMatchSelectWidth: dropdownMatchSelectWidth, onChange: onChangeHandle, showSearch: true, onSearch: onDebounceSearchHandle, filterOption: isRemoteSearch ? false : filterOptionHandle,
|
|
126
144
|
// 显示问题
|