This commit is contained in:
koenemann 2017-08-17 10:40:48 +02:00
parent ab0225ceb4
commit 776a76057f
5 changed files with 25 additions and 16 deletions

6
css/theme.min.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/**! /**!
* @fileOverview Kickass library to create and place poppers near their reference elements. * @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.11.1 * @version 1.12.2
* @license * @license
* Copyright (c) 2016 Federico Zivolo and contributors * Copyright (c) 2016 Federico Zivolo and contributors
* *
@ -873,6 +873,7 @@ function update() {
var data = { var data = {
instance: this, instance: this,
styles: {}, styles: {},
arrowStyles: {},
attributes: {}, attributes: {},
flipped: false, flipped: false,
offsets: {} offsets: {}
@ -1117,9 +1118,9 @@ function applyStyle(data) {
// they will be set as HTML attributes of the element // they will be set as HTML attributes of the element
setAttributes(data.instance.popper, data.attributes); setAttributes(data.instance.popper, data.attributes);
// if the arrow style has been computed, apply the arrow style // if arrowElement is defined and arrowStyles has some properties
if (data.offsets.arrow) { if (data.arrowElement && Object.keys(data.arrowStyles).length) {
setStyles(data.arrowElement, data.offsets.arrow); setStyles(data.arrowElement, data.arrowStyles);
} }
return data; return data;
@ -1239,9 +1240,10 @@ function computeStyle(data, options) {
'x-placement': data.placement 'x-placement': data.placement
}; };
// Update attributes and styles of `data` // Update `data` attributes, styles and arrowStyles
data.attributes = _extends({}, attributes, data.attributes); data.attributes = _extends({}, attributes, data.attributes);
data.styles = _extends({}, styles, data.styles); data.styles = _extends({}, styles, data.styles);
data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
return data; return data;
} }
@ -1314,13 +1316,15 @@ function arrow(data, options) {
var isVertical = ['left', 'right'].indexOf(placement) !== -1; var isVertical = ['left', 'right'].indexOf(placement) !== -1;
var len = isVertical ? 'height' : 'width'; var len = isVertical ? 'height' : 'width';
var side = isVertical ? 'top' : 'left'; var sideCapitalized = isVertical ? 'Top' : 'Left';
var side = sideCapitalized.toLowerCase();
var altSide = isVertical ? 'left' : 'top'; var altSide = isVertical ? 'left' : 'top';
var opSide = isVertical ? 'bottom' : 'right'; var opSide = isVertical ? 'bottom' : 'right';
var arrowElementSize = getOuterSizes(arrowElement)[len]; var arrowElementSize = getOuterSizes(arrowElement)[len];
// //
// extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction // extends keepTogether behavior making sure the popper and its
// reference have enough pixels in conjuction
// //
// top/left side // top/left side
@ -1336,7 +1340,9 @@ function arrow(data, options) {
var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
// Compute the sideValue using the updated popper offsets // Compute the sideValue using the updated popper offsets
var sideValue = center - getClientRect(data.offsets.popper)[side]; // take popper margin in account because we don't have this info available
var popperMarginSide = getStyleComputedProperty(data.instance.popper, 'margin' + sideCapitalized).replace('px', '');
var sideValue = center - getClientRect(data.offsets.popper)[side] - popperMarginSide;
// prevent arrowElement from being placed not contiguously to its popper // prevent arrowElement from being placed not contiguously to its popper
sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
@ -1858,7 +1864,7 @@ function inner(data) {
var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
popper[isHoriz ? 'left' : 'top'] = reference[placement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
data.placement = getOppositePlacement(placement); data.placement = getOppositePlacement(placement);
data.offsets.popper = getClientRect(popper); data.offsets.popper = getClientRect(popper);
@ -1936,6 +1942,9 @@ var modifiers = {
* '10 - 5vh + 3%' * '10 - 5vh + 3%'
* '-10px + 5vh, 5px - 6%' * '-10px + 5vh, 5px - 6%'
* ``` * ```
* > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
* > with their reference element, unfortunately, you will have to disable the `flip` modifier.
* > More on this [reading this issue](https://github.com/FezVrasta/popper.js/issues/373)
* *
* @memberof modifiers * @memberof modifiers
* @inner * @inner
@ -2198,6 +2207,7 @@ var modifiers = {
* @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper.
* @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
* @property {Object} data.styles Any CSS property defined here will be applied to the popper, it expects the JavaScript nomenclature (eg. `marginBottom`) * @property {Object} data.styles Any CSS property defined here will be applied to the popper, it expects the JavaScript nomenclature (eg. `marginBottom`)
* @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow, it expects the JavaScript nomenclature (eg. `marginBottom`)
* @property {Object} data.boundaries Offsets of the popper boundaries * @property {Object} data.boundaries Offsets of the popper boundaries
* @property {Object} data.offsets The measurements of popper, reference and arrow elements. * @property {Object} data.offsets The measurements of popper, reference and arrow elements.
* @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values

2
js/popper.min.js vendored

File diff suppressed because one or more lines are too long

3
js/theme.min.js vendored

File diff suppressed because one or more lines are too long