@ticatec/uniface-element 0.3.22 → 0.3.23
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.
|
@@ -49,28 +49,32 @@
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const lazyLoad = async (searchText: string, page: number, isLoadMore: boolean = false) => {
|
|
52
|
+
console.log('lazyLoad called: searchText=', searchText, 'page=', page);
|
|
53
|
+
|
|
52
54
|
// 取消之前的加载请求
|
|
53
55
|
if (loadingController) {
|
|
54
56
|
loadingController.abort();
|
|
55
57
|
}
|
|
56
|
-
|
|
58
|
+
|
|
57
59
|
// 创建新的AbortController
|
|
58
60
|
loadingController = new AbortController();
|
|
59
61
|
const currentController = loadingController;
|
|
60
|
-
|
|
62
|
+
|
|
61
63
|
loading = true;
|
|
62
64
|
if (!isLoadMore) {
|
|
63
65
|
isBusy = true;
|
|
64
66
|
}
|
|
65
|
-
|
|
67
|
+
|
|
66
68
|
try {
|
|
67
69
|
let res = await lazyLoader(searchText, page);
|
|
68
|
-
|
|
70
|
+
|
|
71
|
+
console.log('lazyLoad result:', res);
|
|
72
|
+
|
|
69
73
|
// 检查请求是否被取消
|
|
70
74
|
if (currentController.signal.aborted) {
|
|
71
75
|
return;
|
|
72
76
|
}
|
|
73
|
-
|
|
77
|
+
|
|
74
78
|
if (page == 1) {
|
|
75
79
|
options = res.list;
|
|
76
80
|
} else {
|
|
@@ -99,11 +103,14 @@
|
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
const delayReload = () => {
|
|
106
|
+
const searchText = inputText; // 直接使用 inputText,避免响应式更新延迟问题
|
|
107
|
+
console.log('delayReload: searchText=', searchText);
|
|
108
|
+
|
|
102
109
|
// 取消之前的延迟加载
|
|
103
110
|
if (interval) {
|
|
104
111
|
clearInterval(interval);
|
|
105
112
|
}
|
|
106
|
-
|
|
113
|
+
|
|
107
114
|
// 取消当前正在进行的加载
|
|
108
115
|
if (loadingController) {
|
|
109
116
|
loadingController.abort();
|
|
@@ -111,18 +118,21 @@
|
|
|
111
118
|
loading = false;
|
|
112
119
|
isBusy = false;
|
|
113
120
|
}
|
|
114
|
-
|
|
121
|
+
|
|
115
122
|
// 重置状态
|
|
116
123
|
options = [];
|
|
117
124
|
hasMore = false;
|
|
118
|
-
|
|
125
|
+
|
|
119
126
|
// 设置新的延迟加载
|
|
120
127
|
idleTime = 0;
|
|
121
128
|
interval = setInterval(() => {
|
|
122
129
|
idleTime += 100;
|
|
123
130
|
if (idleTime >= 200) {
|
|
124
131
|
clearInterval(interval);
|
|
125
|
-
|
|
132
|
+
console.log('delayReload firing: searchText=', searchText, 'length=', searchText?.length);
|
|
133
|
+
if (searchText && searchText.length > 0) {
|
|
134
|
+
lazyLoad(searchText, 1, false);
|
|
135
|
+
}
|
|
126
136
|
}
|
|
127
137
|
}, 100);
|
|
128
138
|
}
|
|
@@ -165,6 +175,7 @@
|
|
|
165
175
|
let isUserTyping: boolean = false;
|
|
166
176
|
|
|
167
177
|
const handleInput = () => {
|
|
178
|
+
console.log('handleInput: inputText=', inputText, 'text=', text);
|
|
168
179
|
isUserTyping = true;
|
|
169
180
|
if (!composing) {
|
|
170
181
|
text = inputText;
|
|
@@ -244,9 +255,11 @@
|
|
|
244
255
|
}
|
|
245
256
|
|
|
246
257
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
258
|
+
// 注释掉自动清空text的逻辑,因为它会与用户输入冲突
|
|
259
|
+
// $: if (!showPopup && value == null && !isUserTyping) {
|
|
260
|
+
// console.log('clearing text: showPopup=', showPopup, 'value=', value, 'isUserTyping=', isUserTyping);
|
|
261
|
+
// text = '';
|
|
262
|
+
// }
|
|
250
263
|
|
|
251
264
|
// 监听popup关闭,如果是点击外部关闭且之前有焦点,触发blur
|
|
252
265
|
$: if (!showPopup && hasFocus) {
|
package/package.json
CHANGED