@dataloop-ai/components 0.20.261-new-input.4 → 0.20.261-new-input.5
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
|
@@ -161,6 +161,7 @@
|
|
|
161
161
|
<dl-menu
|
|
162
162
|
v-if="showSuggestItems"
|
|
163
163
|
:model-value="isMenuOpen"
|
|
164
|
+
:menu-class="suggestionMenuClass()"
|
|
164
165
|
persistent
|
|
165
166
|
no-focus
|
|
166
167
|
no-refocus
|
|
@@ -842,7 +843,6 @@ export default defineComponent({
|
|
|
842
843
|
}
|
|
843
844
|
|
|
844
845
|
const onAutoSuggestClick = (e: Event, item: string): void => {
|
|
845
|
-
console.log('### onAutoSuggestClick', item, e)
|
|
846
846
|
if (typeof item !== 'string' || !item.trim().length) {
|
|
847
847
|
return
|
|
848
848
|
}
|
|
@@ -1290,7 +1290,6 @@ export default defineComponent({
|
|
|
1290
1290
|
}
|
|
1291
1291
|
},
|
|
1292
1292
|
onClick(e: Event, item: DlInputSuggestion) {
|
|
1293
|
-
console.log('### onClick', item, e)
|
|
1294
1293
|
this.onAutoSuggestClick(e, item.suggestion)
|
|
1295
1294
|
},
|
|
1296
1295
|
async handlePaste() {
|
|
@@ -1357,10 +1356,16 @@ export default defineComponent({
|
|
|
1357
1356
|
this.$emit('focus', e)
|
|
1358
1357
|
},
|
|
1359
1358
|
blur(): void {
|
|
1360
|
-
console.log('### blur')
|
|
1361
1359
|
const inputRef = this.$refs.input as HTMLInputElement
|
|
1362
1360
|
inputRef.blur()
|
|
1363
1361
|
},
|
|
1362
|
+
suggestionMenuClass(): string {
|
|
1363
|
+
return `${this.uuid}__suggestion-menu`
|
|
1364
|
+
},
|
|
1365
|
+
isBlurToSuggestionMenu(e: FocusEvent): boolean {
|
|
1366
|
+
const relatedTarget = e.relatedTarget as HTMLElement | null
|
|
1367
|
+
return !!relatedTarget?.closest(`.${this.suggestionMenuClass()}`)
|
|
1368
|
+
},
|
|
1364
1369
|
closeSuggestionMenuAfterBlur(): void {
|
|
1365
1370
|
// Delay close so suggestion item click can finish before menu teardown.
|
|
1366
1371
|
setTimeout(() => {
|
|
@@ -1369,8 +1374,10 @@ export default defineComponent({
|
|
|
1369
1374
|
}
|
|
1370
1375
|
}, 0)
|
|
1371
1376
|
},
|
|
1372
|
-
onBlur(e:
|
|
1373
|
-
|
|
1377
|
+
onBlur(e: FocusEvent): void {
|
|
1378
|
+
if (this.isBlurToSuggestionMenu(e)) {
|
|
1379
|
+
return
|
|
1380
|
+
}
|
|
1374
1381
|
const el = e.target as HTMLElement
|
|
1375
1382
|
el.innerText = (el.innerText ?? '').endsWith('.')
|
|
1376
1383
|
? el.innerText.slice(0, -1)
|
|
@@ -1393,7 +1400,9 @@ export default defineComponent({
|
|
|
1393
1400
|
this.$emit('focus', e)
|
|
1394
1401
|
},
|
|
1395
1402
|
onNativeBlur(e: FocusEvent): void {
|
|
1396
|
-
|
|
1403
|
+
if (this.isBlurToSuggestionMenu(e)) {
|
|
1404
|
+
return
|
|
1405
|
+
}
|
|
1397
1406
|
this.focused = false
|
|
1398
1407
|
this.closeSuggestionMenuAfterBlur()
|
|
1399
1408
|
this.$emit('blur', e)
|