1
1
import Vue from '../../utils/vue'
2
2
import { stripTags } from '../../utils/html'
3
3
import { getComponentConfig } from '../../utils/config'
4
+ import { HTMLElement } from '../../utils/safe-types'
4
5
import idMixin from '../../mixins/id'
5
6
import dropdownMixin from '../../mixins/dropdown'
6
7
import normalizeSlotMixin from '../../mixins/normalize-slot'
@@ -60,8 +61,8 @@ export const props = {
60
61
} ,
61
62
boundary : {
62
63
// String: `scrollParent`, `window` or `viewport`
63
- // Object : HTML Element reference
64
- type : [ String , Object ] ,
64
+ // HTMLElement : HTML Element reference
65
+ type : [ String , HTMLElement ] ,
65
66
default : 'scrollParent'
66
67
}
67
68
}
@@ -73,40 +74,33 @@ export default Vue.extend({
73
74
props,
74
75
computed : {
75
76
dropdownClasses ( ) {
76
- // Position `static` is needed to allow menu to "breakout" of the scrollParent boundaries
77
- // when boundary is anything other than `scrollParent`
78
- // See https://github.com/twbs/bootstrap/issues/24251#issuecomment-341413786
79
- const positionStatic = this . boundary !== 'scrollParent' || ! this . boundary
80
-
81
77
return [
82
- 'btn-group' ,
83
- 'b-dropdown' ,
84
- 'dropdown' ,
85
78
this . directionClass ,
86
79
{
87
80
show : this . visible ,
88
- 'position-static' : positionStatic
81
+ // Position `static` is needed to allow menu to "breakout" of the scrollParent boundaries
82
+ // when boundary is anything other than `scrollParent`
83
+ // See https://github.com/twbs/bootstrap/issues/24251#issuecomment-341413786
84
+ 'position-static' : this . boundary !== 'scrollParent' || ! this . boundary
89
85
}
90
86
]
91
87
} ,
92
88
menuClasses ( ) {
93
89
return [
94
- 'dropdown-menu' ,
90
+ this . menuClass ,
95
91
{
96
92
'dropdown-menu-right' : this . right ,
97
93
show : this . visible
98
- } ,
99
- this . menuClass
94
+ }
100
95
]
101
96
} ,
102
97
toggleClasses ( ) {
103
98
return [
104
- 'dropdown-toggle' ,
99
+ this . toggleClass ,
105
100
{
106
101
'dropdown-toggle-split' : this . split ,
107
102
'dropdown-toggle-no-caret' : this . noCaret && ! this . split
108
- } ,
109
- this . toggleClass
103
+ }
110
104
]
111
105
}
112
106
} ,
@@ -149,6 +143,7 @@ export default Vue.extend({
149
143
BButton ,
150
144
{
151
145
ref : 'toggle' ,
146
+ staticClass : 'dropdown-toggle' ,
152
147
class : this . toggleClasses ,
153
148
props : {
154
149
variant : this . variant ,
@@ -172,6 +167,7 @@ export default Vue.extend({
172
167
'ul' ,
173
168
{
174
169
ref : 'menu' ,
170
+ staticClass : 'dropdown-menu' ,
175
171
class : this . menuClasses ,
176
172
attrs : {
177
173
role : this . role ,
@@ -183,12 +179,16 @@ export default Vue.extend({
183
179
keydown : this . onKeydown // tab, up, down, esc
184
180
}
185
181
} ,
186
- this . normalizeSlot ( 'default' )
182
+ this . normalizeSlot ( 'default' , { hide : this . hide } )
183
+ )
184
+ return h (
185
+ 'div' ,
186
+ {
187
+ staticClass : 'dropdown btn-group b-dropdown' ,
188
+ class : this . dropdownClasses ,
189
+ attrs : { id : this . safeId ( ) }
190
+ } ,
191
+ [ split , toggle , menu ]
187
192
)
188
- return h ( 'div' , { attrs : { id : this . safeId ( ) } , class : this . dropdownClasses } , [
189
- split ,
190
- toggle ,
191
- menu
192
- ] )
193
193
}
194
194
} )
0 commit comments