diff options
author | Rohit Sharma <rohit2sharma95@gmail.com> | 2021-02-09 22:16:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-09 22:16:13 +0300 |
commit | f7088e5d28d019f9876b71333185120b811ecb08 (patch) | |
tree | c17979945db9035e6f466541abf11712605ca549 /js/src/dropdown.js | |
parent | 29e0c9dfa1c4324e4e2a8cf0b66e27b9e72f09a5 (diff) |
Add function type for `popperConfig` option (#32882)
* Add function type for `popperConfig` option
* Update .bundlewatch.config.json
* copy edits
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <markdotto@gmail.com>
Diffstat (limited to 'js/src/dropdown.js')
-rw-r--r-- | js/src/dropdown.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/js/src/dropdown.js b/js/src/dropdown.js index 878a5a9a21..7221debfc2 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -86,7 +86,7 @@ const DefaultType = { boundary: '(string|element)', reference: '(string|element|object)', display: 'string', - popperConfig: '(null|object)' + popperConfig: '(null|object|function)' } /** @@ -322,7 +322,7 @@ class Dropdown extends BaseComponent { } _getPopperConfig() { - const popperConfig = { + const defaultBsPopperConfig = { placement: this._getPlacement(), modifiers: [{ name: 'preventOverflow', @@ -341,15 +341,15 @@ class Dropdown extends BaseComponent { // Disable Popper if we have a static display if (this._config.display === 'static') { - popperConfig.modifiers = [{ + defaultBsPopperConfig.modifiers = [{ name: 'applyStyles', enabled: false }] } return { - ...popperConfig, - ...this._config.popperConfig + ...defaultBsPopperConfig, + ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig) } } |