@@ -172,7 +172,7 @@ export default () => defineComponent({
172
172
} ,
173
173
174
174
autoHide : {
175
- type : Boolean ,
175
+ type : [ Boolean , Function ] ,
176
176
default : defaultPropFactory ( 'autoHide' ) ,
177
177
} ,
178
178
@@ -300,6 +300,7 @@ export default () => defineComponent({
300
300
transformOrigin : null ,
301
301
} ,
302
302
shownChildren : new Set ( ) ,
303
+ lastAutoHide : true ,
303
304
}
304
305
} ,
305
306
@@ -318,7 +319,7 @@ export default () => defineComponent({
318
319
isShown : this . isShown ,
319
320
shouldMountContent : this . shouldMountContent ,
320
321
skipTransition : this . skipTransition ,
321
- autoHide : this . autoHide ,
322
+ autoHide : typeof this . autoHide === 'function' ? this . lastAutoHide : this . autoHide ,
322
323
show : this . show ,
323
324
hide : this . hide ,
324
325
handleResize : this . handleResize ,
@@ -1119,7 +1120,16 @@ function isContainingEventTarget (popper, event): boolean {
1119
1120
}
1120
1121
1121
1122
function shouldAutoHide ( popper , contains , event ) : boolean {
1122
- return event . closeAllPopover || ( event . closePopover && contains ) || ( popper . autoHide && ! contains )
1123
+ return event . closeAllPopover || ( event . closePopover && contains ) || ( getAutoHideResult ( popper , event ) && ! contains )
1124
+ }
1125
+
1126
+ function getAutoHideResult ( popper , event ) {
1127
+ if ( typeof popper . autoHide === 'function' ) {
1128
+ const result = popper . autoHide ( event )
1129
+ popper . lastAutoHide = result
1130
+ return result
1131
+ }
1132
+ return popper . autoHide
1123
1133
}
1124
1134
1125
1135
function computePositionAllShownPoppers ( event ) {
0 commit comments