Skip to content
Permalink
Browse files

fix(b-popover, b-tooltip): ensure `boundary-padding` is passed to pop…

…per instance (fixes #4131) (#4133)
  • Loading branch information...
tmorehouse committed Sep 20, 2019
1 parent d82c4f5 commit a54a647d64dc1251c2667f2179f6e8d648dccd40
@@ -165,11 +165,11 @@
"slots": [
{
"name": "title",
"description": "Optional slot for title (HTML supported)"
"description": "Optional slot for title (HTML/components supported)"
},
{
"name": "default",
"description": "Slot for content (HTML supported)"
"description": "Slot for content (HTML/components supported)"
}
]
}
@@ -47,7 +47,7 @@ export const BPopover = /*#__PURE__*/ Vue.extend({
default: () => getComponentConfig(NAME, 'boundary')
},
boundaryPadding: {
type: Number,
type: [Number, String],
default: () => getComponentConfig(NAME, 'boundaryPadding')
}
},
@@ -59,7 +59,7 @@ export const BPopover = /*#__PURE__*/ Vue.extend({
updateContent() {
// Tooltip: Default slot is `title`
// Popover: Default slot is `content`, `title` slot is title
// We pass a scoped slot function by default (v2.6x)
// We pass a scoped slot function references by default (Vue v2.6x)
// And pass the title prop as a fallback
this.setContent(this.$scopedSlots.default || this.content)
this.setTitle(this.$scopedSlots.title || this.title)
@@ -285,11 +285,12 @@ export const BVTooltip = /*#__PURE__*/ Vue.extend({
html: this.html,
placement: this.placement,
fallbackPlacement: this.fallbackPlacement,
offset: this.offset,
arrowPadding: this.arrowPadding,
boundaryPadding: this.boundaryPadding,
target: this.getPlacementTarget(),
boundary: this.getBoundary(),
target: this.getPlacementTarget()
// Ensure the following are integers
offset: parseInt(this.offset, 10) || 0,
arrowPadding: parseInt(this.arrowPadding, 10) || 0,
boundaryPadding: parseInt(this.boundaryPadding, 10) || 0
}
}))
// We set the initial reactive data (values that can be changed while open)
@@ -165,7 +165,7 @@
"slots": [
{
"name": "default",
"description": "Slot for tooltip content (HTML supported)"
"description": "Slot for tooltip content (HTML/components supported)"
}
]
}
@@ -66,7 +66,7 @@ export const BTooltip = /*#__PURE__*/ Vue.extend({
default: () => getComponentConfig(NAME, 'boundary')
},
boundaryPadding: {
type: Number,
type: [Number, String],
default: () => getComponentConfig(NAME, 'boundaryPadding')
},
offset: {
@@ -122,6 +122,7 @@ export const BTooltip = /*#__PURE__*/ Vue.extend({
customClass: this.customClass,
container: this.container,
boundary: this.boundary,
boundaryPadding: this.boundaryPadding,
delay: this.delay,
offset: this.offset,
noFade: this.noFade,
@@ -244,19 +245,21 @@ export const BTooltip = /*#__PURE__*/ Vue.extend({
// Overridden by BPopover
// Tooltip: Default slot is `title`
// Popover: Default slot is `content`, `title` slot is title
// We pass a scoped slot function by default (v2.6x)
// We pass a scoped slot function reference by default (Vue v2.6x)
// And pass the title prop as a fallback
this.setTitle(this.$scopedSlots.default || this.title)
},
// Helper methods for `updateContent()`
setTitle(val) {
val = isUndefinedOrNull(val) ? '' : val
// We only update the value if it has changed
if (this.localTitle !== val) {
this.localTitle = val
}
},
setContent(val) {
val = isUndefinedOrNull(val) ? '' : val
// We only update the value if it has changed
if (this.localContent !== val) {
this.localContent = val
}
@@ -5,8 +5,8 @@ import { getComponentConfig } from '../../utils/config'
import { isBrowser } from '../../utils/env'
import {
isFunction,
isObject,
isNumber,
isPlainObject,
isString,
isUndefined,
isUndefinedOrNull
@@ -71,7 +71,7 @@ const parseBindings = (bindings, vnode) => /* istanbul ignore next: not easy to
} else if (isFunction(bindings.value)) {
// Content generator function
config.content = bindings.value
} else if (isObject(bindings.value)) {
} else if (isPlainObject(bindings.value)) {
// Value is config object, so merge
config = { ...config, ...bindings.value }
}
@@ -91,10 +91,10 @@ const parseBindings = (bindings, vnode) => /* istanbul ignore next: not easy to
}

// Normalize delay
if (!isObject(config.delay)) {
if (!isPlainObject(config.delay)) {
config.delay = {
show: config.delay,
hide: config.delay
show: parseInt(config.delay, 10) || 0,
hide: parseInt(config.delay, 10) || 0
}
}

@@ -6,7 +6,7 @@ import { isBrowser } from '../../utils/env'
import {
isFunction,
isNumber,
isObject,
isPlainObject,
isString,
isUndefined,
isUndefinedOrNull
@@ -71,7 +71,7 @@ const parseBindings = (bindings, vnode) => /* istanbul ignore next: not easy to
} else if (isFunction(bindings.value)) {
// Title generator function
config.title = bindings.value
} else if (isObject(bindings.value)) {
} else if (isPlainObject(bindings.value)) {
// Value is config object, so merge
config = { ...config, ...bindings.value }
}
@@ -84,10 +84,10 @@ const parseBindings = (bindings, vnode) => /* istanbul ignore next: not easy to
}

// Normalize delay
if (!isObject(config.delay)) {
if (!isPlainObject(config.delay)) {
config.delay = {
show: config.delay,
hide: config.delay
show: parseInt(config.delay, 10) || 0,
hide: parseInt(config.delay, 10) || 0
}
}

0 comments on commit a54a647

Please sign in to comment.
You can’t perform that action at this time.