@dataloop-ai/components 0.20.261-new-input.2 → 0.20.261-new-input.4
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/package.json
CHANGED
|
@@ -842,6 +842,7 @@ export default defineComponent({
|
|
|
842
842
|
}
|
|
843
843
|
|
|
844
844
|
const onAutoSuggestClick = (e: Event, item: string): void => {
|
|
845
|
+
console.log('### onAutoSuggestClick', item, e)
|
|
845
846
|
if (typeof item !== 'string' || !item.trim().length) {
|
|
846
847
|
return
|
|
847
848
|
}
|
|
@@ -1289,6 +1290,7 @@ export default defineComponent({
|
|
|
1289
1290
|
}
|
|
1290
1291
|
},
|
|
1291
1292
|
onClick(e: Event, item: DlInputSuggestion) {
|
|
1293
|
+
console.log('### onClick', item, e)
|
|
1292
1294
|
this.onAutoSuggestClick(e, item.suggestion)
|
|
1293
1295
|
},
|
|
1294
1296
|
async handlePaste() {
|
|
@@ -1355,17 +1357,27 @@ export default defineComponent({
|
|
|
1355
1357
|
this.$emit('focus', e)
|
|
1356
1358
|
},
|
|
1357
1359
|
blur(): void {
|
|
1360
|
+
console.log('### blur')
|
|
1358
1361
|
const inputRef = this.$refs.input as HTMLInputElement
|
|
1359
1362
|
inputRef.blur()
|
|
1360
1363
|
},
|
|
1364
|
+
closeSuggestionMenuAfterBlur(): void {
|
|
1365
|
+
// Delay close so suggestion item click can finish before menu teardown.
|
|
1366
|
+
setTimeout(() => {
|
|
1367
|
+
if (!this.focused) {
|
|
1368
|
+
this.isMenuOpen = false
|
|
1369
|
+
}
|
|
1370
|
+
}, 0)
|
|
1371
|
+
},
|
|
1361
1372
|
onBlur(e: InputEvent): void {
|
|
1373
|
+
console.log('### onBlur', e)
|
|
1362
1374
|
const el = e.target as HTMLElement
|
|
1363
1375
|
el.innerText = (el.innerText ?? '').endsWith('.')
|
|
1364
1376
|
? el.innerText.slice(0, -1)
|
|
1365
1377
|
: el.innerText
|
|
1366
1378
|
el.scroll(0, 0)
|
|
1367
1379
|
this.focused = false
|
|
1368
|
-
this.
|
|
1380
|
+
this.closeSuggestionMenuAfterBlur()
|
|
1369
1381
|
this.$emit('blur', e)
|
|
1370
1382
|
this.handleValueTrim()
|
|
1371
1383
|
},
|
|
@@ -1381,8 +1393,9 @@ export default defineComponent({
|
|
|
1381
1393
|
this.$emit('focus', e)
|
|
1382
1394
|
},
|
|
1383
1395
|
onNativeBlur(e: FocusEvent): void {
|
|
1396
|
+
console.log('### onNativeBlur', e)
|
|
1384
1397
|
this.focused = false
|
|
1385
|
-
this.
|
|
1398
|
+
this.closeSuggestionMenuAfterBlur()
|
|
1386
1399
|
this.$emit('blur', e)
|
|
1387
1400
|
},
|
|
1388
1401
|
onNativeEnterPress(e: KeyboardEvent): void {
|