mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-18 03:11:19 +02:00
Move dropdown offset function logic into private function. (#28138)
This commit is contained in:
@@ -319,24 +319,30 @@ class Dropdown {
|
||||
return $(this._element).closest('.navbar').length > 0
|
||||
}
|
||||
|
||||
_getPopperConfig() {
|
||||
const offsetConf = {}
|
||||
_getOffset() {
|
||||
const offset = {}
|
||||
|
||||
if (typeof this._config.offset === 'function') {
|
||||
offsetConf.fn = (data) => {
|
||||
offset.fn = (data) => {
|
||||
data.offsets = {
|
||||
...data.offsets,
|
||||
...this._config.offset(data.offsets) || {}
|
||||
...this._config.offset(data.offsets, this._element) || {}
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
} else {
|
||||
offsetConf.offset = this._config.offset
|
||||
offset.offset = this._config.offset
|
||||
}
|
||||
|
||||
return offset
|
||||
}
|
||||
|
||||
_getPopperConfig() {
|
||||
const popperConfig = {
|
||||
placement: this._getPlacement(),
|
||||
modifiers: {
|
||||
offset: offsetConf,
|
||||
offset: this._getOffset(),
|
||||
flip: {
|
||||
enabled: this._config.flip
|
||||
},
|
||||
@@ -352,6 +358,7 @@ class Dropdown {
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
|
||||
return popperConfig
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user