mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-19 11:51:23 +02:00
grunt
This commit is contained in:
@@ -1713,7 +1713,8 @@ var Modal = function ($) {
|
||||
DIALOG: '.modal-dialog',
|
||||
DATA_TOGGLE: '[data-toggle="modal"]',
|
||||
DATA_DISMISS: '[data-dismiss="modal"]',
|
||||
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'
|
||||
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
|
||||
NAVBAR_TOGGLER: '.navbar-toggler'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1852,7 +1853,6 @@ var Modal = function ($) {
|
||||
this._isShown = null;
|
||||
this._isBodyOverflowing = null;
|
||||
this._ignoreBackdropClick = null;
|
||||
this._originalBodyPadding = null;
|
||||
this._scrollbarWidth = null;
|
||||
};
|
||||
|
||||
@@ -2065,17 +2065,55 @@ var Modal = function ($) {
|
||||
};
|
||||
|
||||
Modal.prototype._setScrollbar = function _setScrollbar() {
|
||||
var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10);
|
||||
|
||||
this._originalBodyPadding = document.body.style.paddingRight || '';
|
||||
var _this17 = this;
|
||||
|
||||
if (this._isBodyOverflowing) {
|
||||
document.body.style.paddingRight = bodyPadding + this._scrollbarWidth + 'px';
|
||||
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
|
||||
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
|
||||
|
||||
// Adjust fixed content padding
|
||||
$(Selector.FIXED_CONTENT).each(function (index, element) {
|
||||
var actualPadding = $(element)[0].style.paddingRight;
|
||||
var calculatedPadding = $(element).css('padding-right');
|
||||
$(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this17._scrollbarWidth + 'px');
|
||||
});
|
||||
|
||||
// Adjust navbar-toggler margin
|
||||
$(Selector.NAVBAR_TOGGLER).each(function (index, element) {
|
||||
var actualMargin = $(element)[0].style.marginRight;
|
||||
var calculatedMargin = $(element).css('margin-right');
|
||||
$(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this17._scrollbarWidth + 'px');
|
||||
});
|
||||
|
||||
// Adjust body padding
|
||||
var actualPadding = document.body.style.paddingRight;
|
||||
var calculatedPadding = $('body').css('padding-right');
|
||||
$('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + 'px');
|
||||
}
|
||||
};
|
||||
|
||||
Modal.prototype._resetScrollbar = function _resetScrollbar() {
|
||||
document.body.style.paddingRight = this._originalBodyPadding;
|
||||
// Restore fixed content padding
|
||||
$(Selector.FIXED_CONTENT).each(function (index, element) {
|
||||
var padding = $(element).data('padding-right');
|
||||
if (typeof padding !== 'undefined') {
|
||||
$(element).css('padding-right', padding).removeData('padding-right');
|
||||
}
|
||||
});
|
||||
|
||||
// Restore navbar-toggler margin
|
||||
$(Selector.NAVBAR_TOGGLER).each(function (index, element) {
|
||||
var margin = $(element).data('margin-right');
|
||||
if (typeof margin !== 'undefined') {
|
||||
$(element).css('margin-right', margin).removeData('margin-right');
|
||||
}
|
||||
});
|
||||
|
||||
// Restore body padding
|
||||
var padding = $('body').data('padding-right');
|
||||
if (typeof padding !== 'undefined') {
|
||||
$('body').css('padding-right', padding).removeData('padding-right');
|
||||
}
|
||||
};
|
||||
|
||||
Modal.prototype._getScrollbarWidth = function _getScrollbarWidth() {
|
||||
@@ -2133,7 +2171,7 @@ var Modal = function ($) {
|
||||
*/
|
||||
|
||||
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||
var _this17 = this;
|
||||
var _this18 = this;
|
||||
|
||||
var target = void 0;
|
||||
var selector = Util.getSelectorFromElement(this);
|
||||
@@ -2155,8 +2193,8 @@ var Modal = function ($) {
|
||||
}
|
||||
|
||||
$target.one(Event.HIDDEN, function () {
|
||||
if ($(_this17).is(':visible')) {
|
||||
_this17.focus();
|
||||
if ($(_this18).is(':visible')) {
|
||||
_this18.focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -2223,18 +2261,15 @@ var ScrollSpy = function ($) {
|
||||
var ClassName = {
|
||||
DROPDOWN_ITEM: 'dropdown-item',
|
||||
DROPDOWN_MENU: 'dropdown-menu',
|
||||
NAV_LINK: 'nav-link',
|
||||
NAV: 'nav',
|
||||
ACTIVE: 'active'
|
||||
};
|
||||
|
||||
var Selector = {
|
||||
DATA_SPY: '[data-spy="scroll"]',
|
||||
ACTIVE: '.active',
|
||||
LIST_ITEM: '.list-item',
|
||||
LI: 'li',
|
||||
LI_DROPDOWN: 'li.dropdown',
|
||||
NAV_LIST_GROUP: '.nav, .list-group',
|
||||
NAV_LINKS: '.nav-link',
|
||||
LIST_ITEMS: '.list-group-item',
|
||||
DROPDOWN: '.dropdown',
|
||||
DROPDOWN_ITEMS: '.dropdown-item',
|
||||
DROPDOWN_TOGGLE: '.dropdown-toggle'
|
||||
@@ -2253,21 +2288,21 @@ var ScrollSpy = function ($) {
|
||||
|
||||
var ScrollSpy = function () {
|
||||
function ScrollSpy(element, config) {
|
||||
var _this18 = this;
|
||||
var _this19 = this;
|
||||
|
||||
_classCallCheck(this, ScrollSpy);
|
||||
|
||||
this._element = element;
|
||||
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
||||
this._config = this._getConfig(config);
|
||||
this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
|
||||
this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.LIST_ITEMS + ',') + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
|
||||
this._offsets = [];
|
||||
this._targets = [];
|
||||
this._activeTarget = null;
|
||||
this._scrollHeight = 0;
|
||||
|
||||
$(this._scrollElement).on(Event.SCROLL, function (event) {
|
||||
return _this18._process(event);
|
||||
return _this19._process(event);
|
||||
});
|
||||
|
||||
this.refresh();
|
||||
@@ -2279,7 +2314,7 @@ var ScrollSpy = function ($) {
|
||||
// public
|
||||
|
||||
ScrollSpy.prototype.refresh = function refresh() {
|
||||
var _this19 = this;
|
||||
var _this20 = this;
|
||||
|
||||
var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
|
||||
|
||||
@@ -2315,8 +2350,8 @@ var ScrollSpy = function ($) {
|
||||
}).sort(function (a, b) {
|
||||
return a[0] - b[0];
|
||||
}).forEach(function (item) {
|
||||
_this19._offsets.push(item[0]);
|
||||
_this19._targets.push(item[1]);
|
||||
_this20._offsets.push(item[0]);
|
||||
_this20._targets.push(item[1]);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2414,9 +2449,11 @@ var ScrollSpy = function ($) {
|
||||
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
|
||||
$link.addClass(ClassName.ACTIVE);
|
||||
} else {
|
||||
// todo (fat) this is kinda sus...
|
||||
// recursively add actives to tested nav-links
|
||||
$link.parents(Selector.LI).find('> ' + Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
|
||||
// Set triggered link as active
|
||||
$link.addClass(ClassName.ACTIVE);
|
||||
// Set triggered links parents as active
|
||||
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
||||
$link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ', ' + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE);
|
||||
}
|
||||
|
||||
$(this._scrollElement).trigger(Event.ACTIVATE, {
|
||||
@@ -2535,14 +2572,10 @@ var Tab = function ($) {
|
||||
};
|
||||
|
||||
var Selector = {
|
||||
A: 'a',
|
||||
LI: 'li',
|
||||
DROPDOWN: '.dropdown',
|
||||
LIST: 'ul:not(.dropdown-menu), ol:not(.dropdown-menu), nav:not(.dropdown-menu), .list-group:not(.dropdown-menu)',
|
||||
FADE_CHILD: '> .nav-item .fade, > .list-group-item .fade, > .fade',
|
||||
NAV_LIST_GROUP: '.nav, .list-group',
|
||||
ACTIVE: '.active',
|
||||
ACTIVE_CHILD: '> .nav-item > .active, > .list-group-item > .active, > .active',
|
||||
DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"]',
|
||||
DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
|
||||
DROPDOWN_TOGGLE: '.dropdown-toggle',
|
||||
DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
|
||||
};
|
||||
@@ -2565,7 +2598,7 @@ var Tab = function ($) {
|
||||
// public
|
||||
|
||||
Tab.prototype.show = function show() {
|
||||
var _this20 = this;
|
||||
var _this21 = this;
|
||||
|
||||
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
|
||||
return;
|
||||
@@ -2573,7 +2606,7 @@ var Tab = function ($) {
|
||||
|
||||
var target = void 0;
|
||||
var previous = void 0;
|
||||
var listElement = $(this._element).closest(Selector.LIST)[0];
|
||||
var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0];
|
||||
var selector = Util.getSelectorFromElement(this._element);
|
||||
|
||||
if (listElement) {
|
||||
@@ -2607,7 +2640,7 @@ var Tab = function ($) {
|
||||
|
||||
var complete = function complete() {
|
||||
var hiddenEvent = $.Event(Event.HIDDEN, {
|
||||
relatedTarget: _this20._element
|
||||
relatedTarget: _this21._element
|
||||
});
|
||||
|
||||
var shownEvent = $.Event(Event.SHOWN, {
|
||||
@@ -2615,7 +2648,7 @@ var Tab = function ($) {
|
||||
});
|
||||
|
||||
$(previous).trigger(hiddenEvent);
|
||||
$(_this20._element).trigger(shownEvent);
|
||||
$(_this21._element).trigger(shownEvent);
|
||||
};
|
||||
|
||||
if (target) {
|
||||
@@ -2633,13 +2666,13 @@ var Tab = function ($) {
|
||||
// private
|
||||
|
||||
Tab.prototype._activate = function _activate(element, container, callback) {
|
||||
var _this21 = this;
|
||||
var _this22 = this;
|
||||
|
||||
var active = $(container).find(Selector.ACTIVE_CHILD)[0];
|
||||
var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0]));
|
||||
var active = $(container).find(Selector.ACTIVE)[0];
|
||||
var isTransitioning = callback && Util.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE);
|
||||
|
||||
var complete = function complete() {
|
||||
return _this21._transitionComplete(element, active, isTransitioning, callback);
|
||||
return _this22._transitionComplete(element, active, isTransitioning, callback);
|
||||
};
|
||||
|
||||
if (active && isTransitioning) {
|
||||
@@ -2656,9 +2689,6 @@ var Tab = function ($) {
|
||||
Tab.prototype._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) {
|
||||
if (active) {
|
||||
$(active).removeClass(ClassName.ACTIVE);
|
||||
if ($(active).hasClass('list-group-item')) {
|
||||
$(active).find('a.nav-link').removeClass(ClassName.ACTIVE);
|
||||
}
|
||||
|
||||
var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
|
||||
|
||||
@@ -2670,9 +2700,6 @@ var Tab = function ($) {
|
||||
}
|
||||
|
||||
$(element).addClass(ClassName.ACTIVE);
|
||||
if ($(element.parentNode).hasClass('list-group-item')) {
|
||||
$(element.parentNode).addClass(ClassName.ACTIVE);
|
||||
}
|
||||
element.setAttribute('aria-expanded', true);
|
||||
|
||||
if (isTransitioning) {
|
||||
@@ -2959,7 +2986,7 @@ var Tooltip = function ($) {
|
||||
};
|
||||
|
||||
Tooltip.prototype.show = function show() {
|
||||
var _this22 = this;
|
||||
var _this23 = this;
|
||||
|
||||
if ($(this.element).css('display') === 'none') {
|
||||
throw new Error('Please use show on visible elements');
|
||||
@@ -3018,13 +3045,13 @@ var Tooltip = function ($) {
|
||||
$(tip).addClass(ClassName.SHOW);
|
||||
|
||||
var complete = function complete() {
|
||||
var prevHoverState = _this22._hoverState;
|
||||
_this22._hoverState = null;
|
||||
var prevHoverState = _this23._hoverState;
|
||||
_this23._hoverState = null;
|
||||
|
||||
$(_this22.element).trigger(_this22.constructor.Event.SHOWN);
|
||||
$(_this23.element).trigger(_this23.constructor.Event.SHOWN);
|
||||
|
||||
if (prevHoverState === HoverState.OUT) {
|
||||
_this22._leave(null, _this22);
|
||||
_this23._leave(null, _this23);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3038,19 +3065,19 @@ var Tooltip = function ($) {
|
||||
};
|
||||
|
||||
Tooltip.prototype.hide = function hide(callback) {
|
||||
var _this23 = this;
|
||||
var _this24 = this;
|
||||
|
||||
var tip = this.getTipElement();
|
||||
var hideEvent = $.Event(this.constructor.Event.HIDE);
|
||||
var complete = function complete() {
|
||||
if (_this23._hoverState !== HoverState.SHOW && tip.parentNode) {
|
||||
if (_this24._hoverState !== HoverState.SHOW && tip.parentNode) {
|
||||
tip.parentNode.removeChild(tip);
|
||||
}
|
||||
|
||||
_this23._cleanTipClass();
|
||||
_this23.element.removeAttribute('aria-describedby');
|
||||
$(_this23.element).trigger(_this23.constructor.Event.HIDDEN);
|
||||
_this23.cleanupTether();
|
||||
_this24._cleanTipClass();
|
||||
_this24.element.removeAttribute('aria-describedby');
|
||||
$(_this24.element).trigger(_this24.constructor.Event.HIDDEN);
|
||||
_this24.cleanupTether();
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
@@ -3146,28 +3173,28 @@ var Tooltip = function ($) {
|
||||
};
|
||||
|
||||
Tooltip.prototype._setListeners = function _setListeners() {
|
||||
var _this24 = this;
|
||||
var _this25 = this;
|
||||
|
||||
var triggers = this.config.trigger.split(' ');
|
||||
|
||||
triggers.forEach(function (trigger) {
|
||||
if (trigger === 'click') {
|
||||
$(_this24.element).on(_this24.constructor.Event.CLICK, _this24.config.selector, function (event) {
|
||||
return _this24.toggle(event);
|
||||
$(_this25.element).on(_this25.constructor.Event.CLICK, _this25.config.selector, function (event) {
|
||||
return _this25.toggle(event);
|
||||
});
|
||||
} else if (trigger !== Trigger.MANUAL) {
|
||||
var eventIn = trigger === Trigger.HOVER ? _this24.constructor.Event.MOUSEENTER : _this24.constructor.Event.FOCUSIN;
|
||||
var eventOut = trigger === Trigger.HOVER ? _this24.constructor.Event.MOUSELEAVE : _this24.constructor.Event.FOCUSOUT;
|
||||
var eventIn = trigger === Trigger.HOVER ? _this25.constructor.Event.MOUSEENTER : _this25.constructor.Event.FOCUSIN;
|
||||
var eventOut = trigger === Trigger.HOVER ? _this25.constructor.Event.MOUSELEAVE : _this25.constructor.Event.FOCUSOUT;
|
||||
|
||||
$(_this24.element).on(eventIn, _this24.config.selector, function (event) {
|
||||
return _this24._enter(event);
|
||||
}).on(eventOut, _this24.config.selector, function (event) {
|
||||
return _this24._leave(event);
|
||||
$(_this25.element).on(eventIn, _this25.config.selector, function (event) {
|
||||
return _this25._enter(event);
|
||||
}).on(eventOut, _this25.config.selector, function (event) {
|
||||
return _this25._leave(event);
|
||||
});
|
||||
}
|
||||
|
||||
$(_this24.element).closest('.modal').on('hide.bs.modal', function () {
|
||||
return _this24.hide();
|
||||
$(_this25.element).closest('.modal').on('hide.bs.modal', function () {
|
||||
return _this25.hide();
|
||||
});
|
||||
});
|
||||
|
||||
|
4
dist/js/bootstrap.min.js
vendored
4
dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user