@dataloop-ai/components 0.20.143 → 0.20.144
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
|
@@ -507,6 +507,10 @@ export default defineComponent({
|
|
|
507
507
|
afterOptionsPadding: {
|
|
508
508
|
type: String,
|
|
509
509
|
default: null
|
|
510
|
+
},
|
|
511
|
+
keepFocusOnBlur: {
|
|
512
|
+
type: Boolean,
|
|
513
|
+
default: false
|
|
510
514
|
}
|
|
511
515
|
},
|
|
512
516
|
emits: [
|
|
@@ -1119,11 +1123,20 @@ export default defineComponent({
|
|
|
1119
1123
|
}
|
|
1120
1124
|
},
|
|
1121
1125
|
handleSearchBlur(e: Event): void {
|
|
1122
|
-
if (this.searchable)
|
|
1126
|
+
if (!this.searchable) return
|
|
1127
|
+
|
|
1128
|
+
const focusEvent = e as FocusEvent
|
|
1129
|
+
const shouldKeepFocus =
|
|
1130
|
+
this.keepFocusOnBlur &&
|
|
1131
|
+
!focusEvent.relatedTarget &&
|
|
1132
|
+
this.isExpanded
|
|
1133
|
+
|
|
1134
|
+
this.$nextTick(() => {
|
|
1123
1135
|
const inputRef = this.$refs.searchInput as HTMLInputElement
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1136
|
+
inputRef?.focus({})
|
|
1137
|
+
})
|
|
1138
|
+
|
|
1139
|
+
if (!shouldKeepFocus) {
|
|
1127
1140
|
this.$emit('search-blur', e)
|
|
1128
1141
|
}
|
|
1129
1142
|
},
|