Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRohit Sharma <rohit2sharma95@gmail.com>2021-02-09 22:16:13 +0300
committerGitHub <noreply@github.com>2021-02-09 22:16:13 +0300
commitf7088e5d28d019f9876b71333185120b811ecb08 (patch)
treec17979945db9035e6f466541abf11712605ca549 /site/content
parent29e0c9dfa1c4324e4e2a8cf0b66e27b9e72f09a5 (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 'site/content')
-rw-r--r--site/content/docs/5.0/components/dropdowns.md19
-rw-r--r--site/content/docs/5.0/components/popovers.md19
-rw-r--r--site/content/docs/5.0/components/tooltips.md19
-rw-r--r--site/content/docs/5.0/migration.md1
4 files changed, 52 insertions, 6 deletions
diff --git a/site/content/docs/5.0/components/dropdowns.md b/site/content/docs/5.0/components/dropdowns.md
index d5efd3adbc..24353f0f4d 100644
--- a/site/content/docs/5.0/components/dropdowns.md
+++ b/site/content/docs/5.0/components/dropdowns.md
@@ -993,13 +993,28 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
</tr>
<tr>
<td><code>popperConfig</code></td>
- <td>null | object</td>
+ <td>null | object | function</td>
<td><code>null</code></td>
- <td>To change Bootstrap's default Popper config, see <a href="https://popper.js.org/docs/v2/constructors/#options">Popper's configuration</a></td>
+ <td>
+ <p>To change Bootstrap's default Popper config, see <a href="https://popper.js.org/docs/v2/constructors/#options">Popper's configuration</a>.</p>
+ <p>When a function is used to create the Popper configuration, it's called with an object that contains the Bootstrap's default Popper configuration. It helps you use and merge the default with your own configuration. The function must return a configuration object for Popper.</p>
+ </td>
</tr>
</tbody>
</table>
+#### Using function with `popperConfig`
+
+```js
+var dropdown = new bootstrap.Dropdown(element, {
+ popperConfig: function (defaultBsPopperConfig) {
+ // var newPopperConfig = {...}
+ // use defaultBsPopperConfig if needed...
+ // return newPopperConfig
+ }
+})
+```
+
### Methods
<table class="table">
diff --git a/site/content/docs/5.0/components/popovers.md b/site/content/docs/5.0/components/popovers.md
index 56616fd0cd..8a2efa0a2a 100644
--- a/site/content/docs/5.0/components/popovers.md
+++ b/site/content/docs/5.0/components/popovers.md
@@ -279,9 +279,12 @@ Note that for security reasons the `sanitize`, `sanitizeFn`, and `allowList` opt
</tr>
<tr>
<td><code>popperConfig</code></td>
- <td>null | object</td>
+ <td>null | object | function</td>
<td><code>null</code></td>
- <td>To change Bootstrap's default Popper config, see <a href="https://popper.js.org/docs/v2/constructors/#options">Popper's configuration</a></td>
+ <td>
+ <p>To change Bootstrap's default Popper config, see <a href="https://popper.js.org/docs/v2/constructors/#options">Popper's configuration</a>.</p>
+ <p>When a function is used to create the Popper configuration, it's called with an object that contains the Bootstrap's default Popper configuration. It helps you use and merge the default with your own configuration. The function must return a configuration object for Popper.</p>
+ </td>
</tr>
</tbody>
</table>
@@ -292,6 +295,18 @@ Note that for security reasons the `sanitize`, `sanitizeFn`, and `allowList` opt
Options for individual popovers can alternatively be specified through the use of data attributes, as explained above.
{{< /callout >}}
+#### Using function with `popperConfig`
+
+```js
+var popover = new bootstrap.Popover(element, {
+ popperConfig: function (defaultBsPopperConfig) {
+ // var newPopperConfig = {...}
+ // use defaultBsPopperConfig if needed...
+ // return newPopperConfig
+ }
+})
+```
+
### Methods
{{< callout danger >}}
diff --git a/site/content/docs/5.0/components/tooltips.md b/site/content/docs/5.0/components/tooltips.md
index 9a5dd93931..ee6d06e9e9 100644
--- a/site/content/docs/5.0/components/tooltips.md
+++ b/site/content/docs/5.0/components/tooltips.md
@@ -304,9 +304,12 @@ Note that for security reasons the `sanitize`, `sanitizeFn`, and `allowList` opt
</tr>
<tr>
<td><code>popperConfig</code></td>
- <td>null | object</td>
+ <td>null | object | function</td>
<td><code>null</code></td>
- <td>To change Bootstrap's default Popper config, see <a href="https://popper.js.org/docs/v2/constructors/#options">Popper's configuration</a></td>
+ <td>
+ <p>To change Bootstrap's default Popper config, see <a href="https://popper.js.org/docs/v2/constructors/#options">Popper's configuration</a>.</p>
+ <p>When a function is used to create the Popper configuration, it's called with an object that contains the Bootstrap's default Popper configuration. It helps you use and merge the default with your own configuration. The function must return a configuration object for Popper.</p>
+ </td>
</tr>
</tbody>
</table>
@@ -317,6 +320,18 @@ Note that for security reasons the `sanitize`, `sanitizeFn`, and `allowList` opt
Options for individual tooltips can alternatively be specified through the use of data attributes, as explained above.
{{< /callout >}}
+#### Using function with `popperConfig`
+
+```js
+var tooltip = new bootstrap.Tooltip(element, {
+ popperConfig: function (defaultBsPopperConfig) {
+ // var newPopperConfig = {...}
+ // use defaultBsPopperConfig if needed...
+ // return newPopperConfig
+ }
+})
+```
+
### Methods
{{< callout danger >}}
diff --git a/site/content/docs/5.0/migration.md b/site/content/docs/5.0/migration.md
index 6e4839348e..99a9c9e38c 100644
--- a/site/content/docs/5.0/migration.md
+++ b/site/content/docs/5.0/migration.md
@@ -24,6 +24,7 @@ toc: true
- The default value for the `fallbackPlacements` is changed to `['top', 'right', 'bottom', 'left']` for better placement of popper elements.
- All the events for the dropdown are now triggered on the dropdown toggle button and then bubbled up to the parent element.
- Dropdown menus now have a `data-bs-popper="static"` attribute set when the positioning of the dropdown is static and `data-bs-popper="none"` when dropdown is in the navbar. This is added by our JavaScript and helps us use custom position styles without interfering with Popper's positioning.
+- `popperConfig` can be passed as a function that accepts the Bootstrap's default Popper config as an argument, so that you can merge this default configuration in your way.
## v5.0.0-beta1