mirror of https://github.com/twbs/bootstrap.git
Dist (#28392)
This commit is contained in:
parent
d47d29aeaa
commit
19aee321a0
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2305
dist/js/bootstrap.js
2305
dist/js/bootstrap.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -4,13 +4,14 @@
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/eventHandler.js'), require('./dom/selectorEngine.js')) :
|
||||||
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
|
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/eventHandler.js', './dom/selectorEngine.js'], factory) :
|
||||||
(global = global || self, global.Alert = factory(global.jQuery, global.Util));
|
(global = global || self, global.Alert = factory(global.Data, global.EventHandler, global.SelectorEngine));
|
||||||
}(this, function ($, Util) { 'use strict';
|
}(this, function (Data, EventHandler, SelectorEngine) { 'use strict';
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
|
||||||
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
|
EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
|
||||||
|
SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -28,6 +29,76 @@
|
||||||
return Constructor;
|
return Constructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var MILLISECONDS_MULTIPLIER = 1000;
|
||||||
|
var TRANSITION_END = 'transitionend';
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
|
var getSelectorFromElement = function getSelectorFromElement(element) {
|
||||||
|
var selector = element.getAttribute('data-target');
|
||||||
|
|
||||||
|
if (!selector || selector === '#') {
|
||||||
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return document.querySelector(selector) ? selector : null;
|
||||||
|
} catch (err) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
||||||
|
if (!element) {
|
||||||
|
return 0;
|
||||||
|
} // Get transition-duration of the element
|
||||||
|
|
||||||
|
|
||||||
|
var _window$getComputedSt = window.getComputedStyle(element),
|
||||||
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
|
var floatTransitionDuration = parseFloat(transitionDuration);
|
||||||
|
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
|
return 0;
|
||||||
|
} // If multiple durations are defined, take the first
|
||||||
|
|
||||||
|
|
||||||
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
|
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
||||||
|
};
|
||||||
|
|
||||||
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
element.dispatchEvent(new Event(TRANSITION_END));
|
||||||
|
};
|
||||||
|
|
||||||
|
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
||||||
|
var called = false;
|
||||||
|
var durationPadding = 5;
|
||||||
|
var emulatedDuration = duration + durationPadding;
|
||||||
|
|
||||||
|
function listener() {
|
||||||
|
called = true;
|
||||||
|
element.removeEventListener(TRANSITION_END, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.addEventListener(TRANSITION_END, listener);
|
||||||
|
setTimeout(function () {
|
||||||
|
if (!called) {
|
||||||
|
triggerTransitionEnd(element);
|
||||||
|
}
|
||||||
|
}, emulatedDuration);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -39,11 +110,10 @@
|
||||||
var DATA_KEY = 'bs.alert';
|
var DATA_KEY = 'bs.alert';
|
||||||
var EVENT_KEY = "." + DATA_KEY;
|
var EVENT_KEY = "." + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
||||||
var Selector = {
|
var Selector = {
|
||||||
DISMISS: '[data-dismiss="alert"]'
|
DISMISS: '[data-dismiss="alert"]'
|
||||||
};
|
};
|
||||||
var Event = {
|
var Event$1 = {
|
||||||
CLOSE: "close" + EVENT_KEY,
|
CLOSE: "close" + EVENT_KEY,
|
||||||
CLOSED: "closed" + EVENT_KEY,
|
CLOSED: "closed" + EVENT_KEY,
|
||||||
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
|
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
|
||||||
|
@ -65,6 +135,10 @@
|
||||||
function () {
|
function () {
|
||||||
function Alert(element) {
|
function Alert(element) {
|
||||||
this._element = element;
|
this._element = element;
|
||||||
|
|
||||||
|
if (this._element) {
|
||||||
|
Data.setData(element, DATA_KEY, this);
|
||||||
|
}
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +154,7 @@
|
||||||
|
|
||||||
var customEvent = this._triggerCloseEvent(rootElement);
|
var customEvent = this._triggerCloseEvent(rootElement);
|
||||||
|
|
||||||
if (customEvent.isDefaultPrevented()) {
|
if (customEvent === null || customEvent.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,62 +162,63 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
$.removeData(this._element, DATA_KEY);
|
Data.removeData(this._element, DATA_KEY);
|
||||||
this._element = null;
|
this._element = null;
|
||||||
} // Private
|
} // Private
|
||||||
;
|
;
|
||||||
|
|
||||||
_proto._getRootElement = function _getRootElement(element) {
|
_proto._getRootElement = function _getRootElement(element) {
|
||||||
var selector = Util.getSelectorFromElement(element);
|
var selector = getSelectorFromElement(element);
|
||||||
var parent = false;
|
var parent = false;
|
||||||
|
|
||||||
if (selector) {
|
if (selector) {
|
||||||
parent = document.querySelector(selector);
|
parent = SelectorEngine.findOne(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
parent = $(element).closest("." + ClassName.ALERT)[0];
|
parent = SelectorEngine.closest(element, "." + ClassName.ALERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent;
|
return parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._triggerCloseEvent = function _triggerCloseEvent(element) {
|
_proto._triggerCloseEvent = function _triggerCloseEvent(element) {
|
||||||
var closeEvent = $.Event(Event.CLOSE);
|
return EventHandler.trigger(element, Event$1.CLOSE);
|
||||||
$(element).trigger(closeEvent);
|
|
||||||
return closeEvent;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._removeElement = function _removeElement(element) {
|
_proto._removeElement = function _removeElement(element) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
$(element).removeClass(ClassName.SHOW);
|
element.classList.remove(ClassName.SHOW);
|
||||||
|
|
||||||
if (!$(element).hasClass(ClassName.FADE)) {
|
if (!element.classList.contains(ClassName.FADE)) {
|
||||||
this._destroyElement(element);
|
this._destroyElement(element);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var transitionDuration = Util.getTransitionDurationFromElement(element);
|
var transitionDuration = getTransitionDurationFromElement(element);
|
||||||
$(element).one(Util.TRANSITION_END, function (event) {
|
EventHandler.one(element, TRANSITION_END, function (event) {
|
||||||
return _this._destroyElement(element, event);
|
return _this._destroyElement(element, event);
|
||||||
}).emulateTransitionEnd(transitionDuration);
|
});
|
||||||
|
emulateTransitionEnd(element, transitionDuration);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._destroyElement = function _destroyElement(element) {
|
_proto._destroyElement = function _destroyElement(element) {
|
||||||
$(element).detach().trigger(Event.CLOSED).remove();
|
if (element.parentNode) {
|
||||||
|
element.parentNode.removeChild(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
EventHandler.trigger(element, Event$1.CLOSED);
|
||||||
} // Static
|
} // Static
|
||||||
;
|
;
|
||||||
|
|
||||||
Alert._jQueryInterface = function _jQueryInterface(config) {
|
Alert._jQueryInterface = function _jQueryInterface(config) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $element = $(this);
|
var data = Data.getData(this, DATA_KEY);
|
||||||
var data = $element.data(DATA_KEY);
|
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = new Alert(this);
|
data = new Alert(this);
|
||||||
$element.data(DATA_KEY, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config === 'close') {
|
if (config === 'close') {
|
||||||
|
@ -162,6 +237,10 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Alert._getInstance = function _getInstance(element) {
|
||||||
|
return Data.getData(element, DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(Alert, null, [{
|
_createClass(Alert, null, [{
|
||||||
key: "VERSION",
|
key: "VERSION",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -178,20 +257,24 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
|
EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .alert to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$.fn[NAME] = Alert._jQueryInterface;
|
if (typeof jQuery !== 'undefined') {
|
||||||
$.fn[NAME].Constructor = Alert;
|
var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
|
||||||
|
jQuery.fn[NAME] = Alert._jQueryInterface;
|
||||||
|
jQuery.fn[NAME].Constructor = Alert;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
jQuery.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Alert._jQueryInterface;
|
return Alert._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Alert;
|
return Alert;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,12 +4,14 @@
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/eventHandler.js'), require('./dom/selectorEngine.js')) :
|
||||||
typeof define === 'function' && define.amd ? define(['jquery'], factory) :
|
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/eventHandler.js', './dom/selectorEngine.js'], factory) :
|
||||||
(global = global || self, global.Button = factory(global.jQuery));
|
(global = global || self, global.Button = factory(global.Data, global.EventHandler, global.SelectorEngine));
|
||||||
}(this, function ($) { 'use strict';
|
}(this, function (Data, EventHandler, SelectorEngine) { 'use strict';
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
|
||||||
|
EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
|
||||||
|
SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -27,6 +29,14 @@
|
||||||
return Constructor;
|
return Constructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -38,7 +48,6 @@
|
||||||
var DATA_KEY = 'bs.button';
|
var DATA_KEY = 'bs.button';
|
||||||
var EVENT_KEY = "." + DATA_KEY;
|
var EVENT_KEY = "." + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
||||||
var ClassName = {
|
var ClassName = {
|
||||||
ACTIVE: 'active',
|
ACTIVE: 'active',
|
||||||
BUTTON: 'btn',
|
BUTTON: 'btn',
|
||||||
|
@ -53,7 +62,8 @@
|
||||||
};
|
};
|
||||||
var Event = {
|
var Event = {
|
||||||
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
|
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY,
|
||||||
FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY + " " + ("blur" + EVENT_KEY + DATA_API_KEY)
|
FOCUS_DATA_API: "focus" + EVENT_KEY + DATA_API_KEY,
|
||||||
|
BLUR_DATA_API: "blur" + EVENT_KEY + DATA_API_KEY
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Class Definition
|
* Class Definition
|
||||||
|
@ -67,6 +77,7 @@
|
||||||
function () {
|
function () {
|
||||||
function Button(element) {
|
function Button(element) {
|
||||||
this._element = element;
|
this._element = element;
|
||||||
|
Data.setData(element, DATA_KEY, this);
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,20 +87,20 @@
|
||||||
_proto.toggle = function toggle() {
|
_proto.toggle = function toggle() {
|
||||||
var triggerChangeEvent = true;
|
var triggerChangeEvent = true;
|
||||||
var addAriaPressed = true;
|
var addAriaPressed = true;
|
||||||
var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
|
var rootElement = SelectorEngine.closest(this._element, Selector.DATA_TOGGLE);
|
||||||
|
|
||||||
if (rootElement) {
|
if (rootElement) {
|
||||||
var input = this._element.querySelector(Selector.INPUT);
|
var input = SelectorEngine.findOne(Selector.INPUT, this._element);
|
||||||
|
|
||||||
if (input) {
|
if (input) {
|
||||||
if (input.type === 'radio') {
|
if (input.type === 'radio') {
|
||||||
if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) {
|
if (input.checked && this._element.classList.contains(ClassName.ACTIVE)) {
|
||||||
triggerChangeEvent = false;
|
triggerChangeEvent = false;
|
||||||
} else {
|
} else {
|
||||||
var activeElement = rootElement.querySelector(Selector.ACTIVE);
|
var activeElement = SelectorEngine.findOne(Selector.ACTIVE, rootElement);
|
||||||
|
|
||||||
if (activeElement) {
|
if (activeElement) {
|
||||||
$(activeElement).removeClass(ClassName.ACTIVE);
|
activeElement.classList.remove(ClassName.ACTIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +111,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
input.checked = !this._element.classList.contains(ClassName.ACTIVE);
|
input.checked = !this._element.classList.contains(ClassName.ACTIVE);
|
||||||
$(input).trigger('change');
|
EventHandler.trigger(input, 'change');
|
||||||
}
|
}
|
||||||
|
|
||||||
input.focus();
|
input.focus();
|
||||||
|
@ -113,23 +124,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (triggerChangeEvent) {
|
if (triggerChangeEvent) {
|
||||||
$(this._element).toggleClass(ClassName.ACTIVE);
|
this._element.classList.toggle(ClassName.ACTIVE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
$.removeData(this._element, DATA_KEY);
|
Data.removeData(this._element, DATA_KEY);
|
||||||
this._element = null;
|
this._element = null;
|
||||||
} // Static
|
} // Static
|
||||||
;
|
;
|
||||||
|
|
||||||
Button._jQueryInterface = function _jQueryInterface(config) {
|
Button._jQueryInterface = function _jQueryInterface(config) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var data = $(this).data(DATA_KEY);
|
var data = Data.getData(this, DATA_KEY);
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = new Button(this);
|
data = new Button(this);
|
||||||
$(this).data(DATA_KEY, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config === 'toggle') {
|
if (config === 'toggle') {
|
||||||
|
@ -138,6 +148,10 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Button._getInstance = function _getInstance(element) {
|
||||||
|
return Data.getData(element, DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(Button, null, [{
|
_createClass(Button, null, [{
|
||||||
key: "VERSION",
|
key: "VERSION",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -154,32 +168,48 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
EventHandler.on(document, Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var button = event.target;
|
var button = event.target;
|
||||||
|
|
||||||
if (!$(button).hasClass(ClassName.BUTTON)) {
|
if (!button.classList.contains(ClassName.BUTTON)) {
|
||||||
button = $(button).closest(Selector.BUTTON);
|
button = SelectorEngine.closest(button, Selector.BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
Button._jQueryInterface.call($(button), 'toggle');
|
var data = Data.getData(button, DATA_KEY);
|
||||||
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
|
||||||
var button = $(event.target).closest(Selector.BUTTON)[0];
|
if (!data) {
|
||||||
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
|
data = new Button(button);
|
||||||
|
Data.setData(button, DATA_KEY, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.toggle();
|
||||||
|
});
|
||||||
|
EventHandler.on(document, Event.FOCUS_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
||||||
|
var button = SelectorEngine.closest(event.target, Selector.BUTTON);
|
||||||
|
button.classList.add(ClassName.FOCUS);
|
||||||
|
});
|
||||||
|
EventHandler.on(document, Event.BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
||||||
|
var button = SelectorEngine.closest(event.target, Selector.BUTTON);
|
||||||
|
button.classList.remove(ClassName.FOCUS);
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .button to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$.fn[NAME] = Button._jQueryInterface;
|
if (typeof jQuery !== 'undefined') {
|
||||||
$.fn[NAME].Constructor = Button;
|
var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
|
||||||
|
jQuery.fn[NAME] = Button._jQueryInterface;
|
||||||
|
jQuery.fn[NAME].Constructor = Button;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
jQuery.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Button._jQueryInterface;
|
return Button._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Button;
|
return Button;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,13 +4,15 @@
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/eventHandler.js'), require('./dom/manipulator.js'), require('./dom/selectorEngine.js')) :
|
||||||
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
|
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/eventHandler.js', './dom/manipulator.js', './dom/selectorEngine.js'], factory) :
|
||||||
(global = global || self, global.Carousel = factory(global.jQuery, global.Util));
|
(global = global || self, global.Carousel = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
|
||||||
}(this, function ($, Util) { 'use strict';
|
}(this, function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
|
||||||
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
|
EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
|
||||||
|
Manipulator = Manipulator && Manipulator.hasOwnProperty('default') ? Manipulator['default'] : Manipulator;
|
||||||
|
SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -62,6 +64,120 @@
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var MILLISECONDS_MULTIPLIER = 1000;
|
||||||
|
var TRANSITION_END = 'transitionend';
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
|
var toType = function toType(obj) {
|
||||||
|
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
||||||
|
};
|
||||||
|
|
||||||
|
var getSelectorFromElement = function getSelectorFromElement(element) {
|
||||||
|
var selector = element.getAttribute('data-target');
|
||||||
|
|
||||||
|
if (!selector || selector === '#') {
|
||||||
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return document.querySelector(selector) ? selector : null;
|
||||||
|
} catch (err) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
||||||
|
if (!element) {
|
||||||
|
return 0;
|
||||||
|
} // Get transition-duration of the element
|
||||||
|
|
||||||
|
|
||||||
|
var _window$getComputedSt = window.getComputedStyle(element),
|
||||||
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
|
var floatTransitionDuration = parseFloat(transitionDuration);
|
||||||
|
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
|
return 0;
|
||||||
|
} // If multiple durations are defined, take the first
|
||||||
|
|
||||||
|
|
||||||
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
|
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
||||||
|
};
|
||||||
|
|
||||||
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
element.dispatchEvent(new Event(TRANSITION_END));
|
||||||
|
};
|
||||||
|
|
||||||
|
var isElement = function isElement(obj) {
|
||||||
|
return (obj[0] || obj).nodeType;
|
||||||
|
};
|
||||||
|
|
||||||
|
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
||||||
|
var called = false;
|
||||||
|
var durationPadding = 5;
|
||||||
|
var emulatedDuration = duration + durationPadding;
|
||||||
|
|
||||||
|
function listener() {
|
||||||
|
called = true;
|
||||||
|
element.removeEventListener(TRANSITION_END, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.addEventListener(TRANSITION_END, listener);
|
||||||
|
setTimeout(function () {
|
||||||
|
if (!called) {
|
||||||
|
triggerTransitionEnd(element);
|
||||||
|
}
|
||||||
|
}, emulatedDuration);
|
||||||
|
};
|
||||||
|
|
||||||
|
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
||||||
|
Object.keys(configTypes).forEach(function (property) {
|
||||||
|
var expectedTypes = configTypes[property];
|
||||||
|
var value = config[property];
|
||||||
|
var valueType = value && isElement(value) ? 'element' : toType(value);
|
||||||
|
|
||||||
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||||
|
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var makeArray = function makeArray(nodeList) {
|
||||||
|
if (!nodeList) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [].slice.call(nodeList);
|
||||||
|
};
|
||||||
|
|
||||||
|
var isVisible = function isVisible(element) {
|
||||||
|
if (!element) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element.style && element.parentNode && element.parentNode.style) {
|
||||||
|
return element.style.display !== 'none' && element.parentNode.style.display !== 'none' && element.style.visibility !== 'hidden';
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
var reflow = function reflow(element) {
|
||||||
|
return element.offsetHeight;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -73,7 +189,6 @@
|
||||||
var DATA_KEY = 'bs.carousel';
|
var DATA_KEY = 'bs.carousel';
|
||||||
var EVENT_KEY = "." + DATA_KEY;
|
var EVENT_KEY = "." + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
||||||
var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
|
var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
|
||||||
|
|
||||||
var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
|
var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
|
||||||
|
@ -103,7 +218,7 @@
|
||||||
LEFT: 'left',
|
LEFT: 'left',
|
||||||
RIGHT: 'right'
|
RIGHT: 'right'
|
||||||
};
|
};
|
||||||
var Event = {
|
var Event$1 = {
|
||||||
SLIDE: "slide" + EVENT_KEY,
|
SLIDE: "slide" + EVENT_KEY,
|
||||||
SLID: "slid" + EVENT_KEY,
|
SLID: "slid" + EVENT_KEY,
|
||||||
KEYDOWN: "keydown" + EVENT_KEY,
|
KEYDOWN: "keydown" + EVENT_KEY,
|
||||||
|
@ -164,11 +279,13 @@
|
||||||
this.touchDeltaX = 0;
|
this.touchDeltaX = 0;
|
||||||
this._config = this._getConfig(config);
|
this._config = this._getConfig(config);
|
||||||
this._element = element;
|
this._element = element;
|
||||||
this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
|
this._indicatorsElement = SelectorEngine.findOne(Selector.INDICATORS, this._element);
|
||||||
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
||||||
this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
|
this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
|
||||||
|
|
||||||
this._addEventListeners();
|
this._addEventListeners();
|
||||||
|
|
||||||
|
Data.setData(element, DATA_KEY, this);
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,7 +301,7 @@
|
||||||
_proto.nextWhenVisible = function nextWhenVisible() {
|
_proto.nextWhenVisible = function nextWhenVisible() {
|
||||||
// Don't call next when the page isn't visible
|
// Don't call next when the page isn't visible
|
||||||
// or the carousel or its parent isn't visible
|
// or the carousel or its parent isn't visible
|
||||||
if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
|
if (!document.hidden && isVisible(this._element)) {
|
||||||
this.next();
|
this.next();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -200,8 +317,8 @@
|
||||||
this._isPaused = true;
|
this._isPaused = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._element.querySelector(Selector.NEXT_PREV)) {
|
if (SelectorEngine.findOne(Selector.NEXT_PREV, this._element)) {
|
||||||
Util.triggerTransitionEnd(this._element);
|
triggerTransitionEnd(this._element);
|
||||||
this.cycle(true);
|
this.cycle(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +336,7 @@
|
||||||
this._interval = null;
|
this._interval = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config.interval && !this._isPaused) {
|
if (this._config && this._config.interval && !this._isPaused) {
|
||||||
this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
|
this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -227,7 +344,7 @@
|
||||||
_proto.to = function to(index) {
|
_proto.to = function to(index) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
|
this._activeElement = SelectorEngine.findOne(Selector.ACTIVE_ITEM, this._element);
|
||||||
|
|
||||||
var activeIndex = this._getItemIndex(this._activeElement);
|
var activeIndex = this._getItemIndex(this._activeElement);
|
||||||
|
|
||||||
|
@ -236,7 +353,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._isSliding) {
|
if (this._isSliding) {
|
||||||
$(this._element).one(Event.SLID, function () {
|
EventHandler.one(this._element, Event$1.SLID, function () {
|
||||||
return _this.to(index);
|
return _this.to(index);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
@ -254,8 +371,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
$(this._element).off(EVENT_KEY);
|
EventHandler.off(this._element, EVENT_KEY);
|
||||||
$.removeData(this._element, DATA_KEY);
|
Data.removeData(this._element, DATA_KEY);
|
||||||
this._items = null;
|
this._items = null;
|
||||||
this._config = null;
|
this._config = null;
|
||||||
this._element = null;
|
this._element = null;
|
||||||
|
@ -269,7 +386,7 @@
|
||||||
|
|
||||||
_proto._getConfig = function _getConfig(config) {
|
_proto._getConfig = function _getConfig(config) {
|
||||||
config = _objectSpread({}, Default, config);
|
config = _objectSpread({}, Default, config);
|
||||||
Util.typeCheckConfig(NAME, config, DefaultType);
|
typeCheckConfig(NAME, config, DefaultType);
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -296,15 +413,16 @@
|
||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
if (this._config.keyboard) {
|
if (this._config.keyboard) {
|
||||||
$(this._element).on(Event.KEYDOWN, function (event) {
|
EventHandler.on(this._element, Event$1.KEYDOWN, function (event) {
|
||||||
return _this2._keydown(event);
|
return _this2._keydown(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._config.pause === 'hover') {
|
if (this._config.pause === 'hover') {
|
||||||
$(this._element).on(Event.MOUSEENTER, function (event) {
|
EventHandler.on(this._element, Event$1.MOUSEENTER, function (event) {
|
||||||
return _this2.pause(event);
|
return _this2.pause(event);
|
||||||
}).on(Event.MOUSELEAVE, function (event) {
|
});
|
||||||
|
EventHandler.on(this._element, Event$1.MOUSELEAVE, function (event) {
|
||||||
return _this2.cycle(event);
|
return _this2.cycle(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -322,25 +440,25 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var start = function start(event) {
|
var start = function start(event) {
|
||||||
if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
|
||||||
_this3.touchStartX = event.originalEvent.clientX;
|
_this3.touchStartX = event.clientX;
|
||||||
} else if (!_this3._pointerEvent) {
|
} else if (!_this3._pointerEvent) {
|
||||||
_this3.touchStartX = event.originalEvent.touches[0].clientX;
|
_this3.touchStartX = event.touches[0].clientX;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var move = function move(event) {
|
var move = function move(event) {
|
||||||
// ensure swiping with one touch and not pinching
|
// ensure swiping with one touch and not pinching
|
||||||
if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
|
if (event.touches && event.touches.length > 1) {
|
||||||
_this3.touchDeltaX = 0;
|
_this3.touchDeltaX = 0;
|
||||||
} else {
|
} else {
|
||||||
_this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
|
_this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var end = function end(event) {
|
var end = function end(event) {
|
||||||
if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
|
||||||
_this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
|
_this3.touchDeltaX = event.clientX - _this3.touchStartX;
|
||||||
}
|
}
|
||||||
|
|
||||||
_this3._handleSwipe();
|
_this3._handleSwipe();
|
||||||
|
@ -365,27 +483,29 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(this._element.querySelectorAll(Selector.ITEM_IMG)).on(Event.DRAG_START, function (e) {
|
makeArray(SelectorEngine.find(Selector.ITEM_IMG, this._element)).forEach(function (itemImg) {
|
||||||
|
EventHandler.on(itemImg, Event$1.DRAG_START, function (e) {
|
||||||
return e.preventDefault();
|
return e.preventDefault();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
if (this._pointerEvent) {
|
if (this._pointerEvent) {
|
||||||
$(this._element).on(Event.POINTERDOWN, function (event) {
|
EventHandler.on(this._element, Event$1.POINTERDOWN, function (event) {
|
||||||
return start(event);
|
return start(event);
|
||||||
});
|
});
|
||||||
$(this._element).on(Event.POINTERUP, function (event) {
|
EventHandler.on(this._element, Event$1.POINTERUP, function (event) {
|
||||||
return end(event);
|
return end(event);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._element.classList.add(ClassName.POINTER_EVENT);
|
this._element.classList.add(ClassName.POINTER_EVENT);
|
||||||
} else {
|
} else {
|
||||||
$(this._element).on(Event.TOUCHSTART, function (event) {
|
EventHandler.on(this._element, Event$1.TOUCHSTART, function (event) {
|
||||||
return start(event);
|
return start(event);
|
||||||
});
|
});
|
||||||
$(this._element).on(Event.TOUCHMOVE, function (event) {
|
EventHandler.on(this._element, Event$1.TOUCHMOVE, function (event) {
|
||||||
return move(event);
|
return move(event);
|
||||||
});
|
});
|
||||||
$(this._element).on(Event.TOUCHEND, function (event) {
|
EventHandler.on(this._element, Event$1.TOUCHEND, function (event) {
|
||||||
return end(event);
|
return end(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -412,7 +532,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getItemIndex = function _getItemIndex(element) {
|
_proto._getItemIndex = function _getItemIndex(element) {
|
||||||
this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
|
this._items = element && element.parentNode ? makeArray(SelectorEngine.find(Selector.ITEM, element.parentNode)) : [];
|
||||||
return this._items.indexOf(element);
|
return this._items.indexOf(element);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -437,27 +557,28 @@
|
||||||
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
|
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
|
||||||
var targetIndex = this._getItemIndex(relatedTarget);
|
var targetIndex = this._getItemIndex(relatedTarget);
|
||||||
|
|
||||||
var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
|
var fromIndex = this._getItemIndex(SelectorEngine.findOne(Selector.ACTIVE_ITEM, this._element));
|
||||||
|
|
||||||
var slideEvent = $.Event(Event.SLIDE, {
|
return EventHandler.trigger(this._element, Event$1.SLIDE, {
|
||||||
relatedTarget: relatedTarget,
|
relatedTarget: relatedTarget,
|
||||||
direction: eventDirectionName,
|
direction: eventDirectionName,
|
||||||
from: fromIndex,
|
from: fromIndex,
|
||||||
to: targetIndex
|
to: targetIndex
|
||||||
});
|
});
|
||||||
$(this._element).trigger(slideEvent);
|
|
||||||
return slideEvent;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
|
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
|
||||||
if (this._indicatorsElement) {
|
if (this._indicatorsElement) {
|
||||||
var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
|
var indicators = SelectorEngine.find(Selector.ACTIVE, this._indicatorsElement);
|
||||||
$(indicators).removeClass(ClassName.ACTIVE);
|
|
||||||
|
for (var i = 0; i < indicators.length; i++) {
|
||||||
|
indicators[i].classList.remove(ClassName.ACTIVE);
|
||||||
|
}
|
||||||
|
|
||||||
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
|
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
|
||||||
|
|
||||||
if (nextIndicator) {
|
if (nextIndicator) {
|
||||||
$(nextIndicator).addClass(ClassName.ACTIVE);
|
nextIndicator.classList.add(ClassName.ACTIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -465,7 +586,7 @@
|
||||||
_proto._slide = function _slide(direction, element) {
|
_proto._slide = function _slide(direction, element) {
|
||||||
var _this4 = this;
|
var _this4 = this;
|
||||||
|
|
||||||
var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
|
var activeElement = SelectorEngine.findOne(Selector.ACTIVE_ITEM, this._element);
|
||||||
|
|
||||||
var activeElementIndex = this._getItemIndex(activeElement);
|
var activeElementIndex = this._getItemIndex(activeElement);
|
||||||
|
|
||||||
|
@ -488,14 +609,14 @@
|
||||||
eventDirectionName = Direction.RIGHT;
|
eventDirectionName = Direction.RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
|
if (nextElement && nextElement.classList.contains(ClassName.ACTIVE)) {
|
||||||
this._isSliding = false;
|
this._isSliding = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
|
var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
|
||||||
|
|
||||||
if (slideEvent.isDefaultPrevented()) {
|
if (slideEvent.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,18 +633,11 @@
|
||||||
|
|
||||||
this._setActiveIndicatorElement(nextElement);
|
this._setActiveIndicatorElement(nextElement);
|
||||||
|
|
||||||
var slidEvent = $.Event(Event.SLID, {
|
if (this._element.classList.contains(ClassName.SLIDE)) {
|
||||||
relatedTarget: nextElement,
|
nextElement.classList.add(orderClassName);
|
||||||
direction: eventDirectionName,
|
reflow(nextElement);
|
||||||
from: activeElementIndex,
|
activeElement.classList.add(directionalClassName);
|
||||||
to: nextElementIndex
|
nextElement.classList.add(directionalClassName);
|
||||||
});
|
|
||||||
|
|
||||||
if ($(this._element).hasClass(ClassName.SLIDE)) {
|
|
||||||
$(nextElement).addClass(orderClassName);
|
|
||||||
Util.reflow(nextElement);
|
|
||||||
$(activeElement).addClass(directionalClassName);
|
|
||||||
$(nextElement).addClass(directionalClassName);
|
|
||||||
var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
|
var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
|
||||||
|
|
||||||
if (nextElementInterval) {
|
if (nextElementInterval) {
|
||||||
|
@ -533,20 +647,35 @@
|
||||||
this._config.interval = this._config.defaultInterval || this._config.interval;
|
this._config.interval = this._config.defaultInterval || this._config.interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
|
var transitionDuration = getTransitionDurationFromElement(activeElement);
|
||||||
$(activeElement).one(Util.TRANSITION_END, function () {
|
EventHandler.one(activeElement, TRANSITION_END, function () {
|
||||||
$(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
|
nextElement.classList.remove(directionalClassName);
|
||||||
$(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
|
nextElement.classList.remove(orderClassName);
|
||||||
|
nextElement.classList.add(ClassName.ACTIVE);
|
||||||
|
activeElement.classList.remove(ClassName.ACTIVE);
|
||||||
|
activeElement.classList.remove(orderClassName);
|
||||||
|
activeElement.classList.remove(directionalClassName);
|
||||||
_this4._isSliding = false;
|
_this4._isSliding = false;
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
return $(_this4._element).trigger(slidEvent);
|
EventHandler.trigger(_this4._element, Event$1.SLID, {
|
||||||
|
relatedTarget: nextElement,
|
||||||
|
direction: eventDirectionName,
|
||||||
|
from: activeElementIndex,
|
||||||
|
to: nextElementIndex
|
||||||
|
});
|
||||||
}, 0);
|
}, 0);
|
||||||
}).emulateTransitionEnd(transitionDuration);
|
});
|
||||||
|
emulateTransitionEnd(activeElement, transitionDuration);
|
||||||
} else {
|
} else {
|
||||||
$(activeElement).removeClass(ClassName.ACTIVE);
|
activeElement.classList.remove(ClassName.ACTIVE);
|
||||||
$(nextElement).addClass(ClassName.ACTIVE);
|
nextElement.classList.add(ClassName.ACTIVE);
|
||||||
this._isSliding = false;
|
this._isSliding = false;
|
||||||
$(this._element).trigger(slidEvent);
|
EventHandler.trigger(this._element, Event$1.SLID, {
|
||||||
|
relatedTarget: nextElement,
|
||||||
|
direction: eventDirectionName,
|
||||||
|
from: activeElementIndex,
|
||||||
|
to: nextElementIndex
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCycling) {
|
if (isCycling) {
|
||||||
|
@ -555,11 +684,10 @@
|
||||||
} // Static
|
} // Static
|
||||||
;
|
;
|
||||||
|
|
||||||
Carousel._jQueryInterface = function _jQueryInterface(config) {
|
Carousel._carouselInterface = function _carouselInterface(element, config) {
|
||||||
return this.each(function () {
|
var data = Data.getData(element, DATA_KEY);
|
||||||
var data = $(this).data(DATA_KEY);
|
|
||||||
|
|
||||||
var _config = _objectSpread({}, Default, $(this).data());
|
var _config = _objectSpread({}, Default, Manipulator.getDataAttributes(element));
|
||||||
|
|
||||||
if (typeof config === 'object') {
|
if (typeof config === 'object') {
|
||||||
_config = _objectSpread({}, _config, config);
|
_config = _objectSpread({}, _config, config);
|
||||||
|
@ -568,15 +696,14 @@
|
||||||
var action = typeof config === 'string' ? config : _config.slide;
|
var action = typeof config === 'string' ? config : _config.slide;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = new Carousel(this, _config);
|
data = new Carousel(element, _config);
|
||||||
$(this).data(DATA_KEY, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof config === 'number') {
|
if (typeof config === 'number') {
|
||||||
data.to(config);
|
data.to(config);
|
||||||
} else if (typeof action === 'string') {
|
} else if (typeof action === 'string') {
|
||||||
if (typeof data[action] === 'undefined') {
|
if (typeof data[action] === 'undefined') {
|
||||||
throw new TypeError("No method named \"" + action + "\"");
|
throw new Error("No method named \"" + action + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
data[action]();
|
data[action]();
|
||||||
|
@ -584,23 +711,28 @@
|
||||||
data.pause();
|
data.pause();
|
||||||
data.cycle();
|
data.cycle();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Carousel._jQueryInterface = function _jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
Carousel._carouselInterface(this, config);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
|
Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
|
||||||
var selector = Util.getSelectorFromElement(this);
|
var selector = getSelectorFromElement(this);
|
||||||
|
|
||||||
if (!selector) {
|
if (!selector) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var target = $(selector)[0];
|
var target = SelectorEngine.findOne(selector);
|
||||||
|
|
||||||
if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
|
if (!target || !target.classList.contains(ClassName.CAROUSEL)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = _objectSpread({}, $(target).data(), $(this).data());
|
var config = _objectSpread({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this));
|
||||||
|
|
||||||
var slideIndex = this.getAttribute('data-slide-to');
|
var slideIndex = this.getAttribute('data-slide-to');
|
||||||
|
|
||||||
|
@ -608,15 +740,19 @@
|
||||||
config.interval = false;
|
config.interval = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Carousel._jQueryInterface.call($(target), config);
|
Carousel._carouselInterface(target, config);
|
||||||
|
|
||||||
if (slideIndex) {
|
if (slideIndex) {
|
||||||
$(target).data(DATA_KEY).to(slideIndex);
|
Data.getData(target, DATA_KEY).to(slideIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Carousel._getInstance = function _getInstance(element) {
|
||||||
|
return Data.getData(element, DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(Carousel, null, [{
|
_createClass(Carousel, null, [{
|
||||||
key: "VERSION",
|
key: "VERSION",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -638,29 +774,31 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
|
EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
|
||||||
$(window).on(Event.LOAD_DATA_API, function () {
|
EventHandler.on(window, Event$1.LOAD_DATA_API, function () {
|
||||||
var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
|
var carousels = makeArray(SelectorEngine.find(Selector.DATA_RIDE));
|
||||||
|
|
||||||
for (var i = 0, len = carousels.length; i < len; i++) {
|
for (var i = 0, len = carousels.length; i < len; i++) {
|
||||||
var $carousel = $(carousels[i]);
|
Carousel._carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY));
|
||||||
|
|
||||||
Carousel._jQueryInterface.call($carousel, $carousel.data());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .carousel to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$.fn[NAME] = Carousel._jQueryInterface;
|
if (typeof jQuery !== 'undefined') {
|
||||||
$.fn[NAME].Constructor = Carousel;
|
var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
|
||||||
|
jQuery.fn[NAME] = Carousel._jQueryInterface;
|
||||||
|
jQuery.fn[NAME].Constructor = Carousel;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
jQuery.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Carousel._jQueryInterface;
|
return Carousel._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Carousel;
|
return Carousel;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,13 +4,15 @@
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/eventHandler.js'), require('./dom/manipulator.js'), require('./dom/selectorEngine.js')) :
|
||||||
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
|
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/eventHandler.js', './dom/manipulator.js', './dom/selectorEngine.js'], factory) :
|
||||||
(global = global || self, global.Collapse = factory(global.jQuery, global.Util));
|
(global = global || self, global.Collapse = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
|
||||||
}(this, function ($, Util) { 'use strict';
|
}(this, function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
|
||||||
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
|
EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
|
||||||
|
Manipulator = Manipulator && Manipulator.hasOwnProperty('default') ? Manipulator['default'] : Manipulator;
|
||||||
|
SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -62,6 +64,108 @@
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var MILLISECONDS_MULTIPLIER = 1000;
|
||||||
|
var TRANSITION_END = 'transitionend';
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
|
var toType = function toType(obj) {
|
||||||
|
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
||||||
|
};
|
||||||
|
|
||||||
|
var getSelectorFromElement = function getSelectorFromElement(element) {
|
||||||
|
var selector = element.getAttribute('data-target');
|
||||||
|
|
||||||
|
if (!selector || selector === '#') {
|
||||||
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return document.querySelector(selector) ? selector : null;
|
||||||
|
} catch (err) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
||||||
|
if (!element) {
|
||||||
|
return 0;
|
||||||
|
} // Get transition-duration of the element
|
||||||
|
|
||||||
|
|
||||||
|
var _window$getComputedSt = window.getComputedStyle(element),
|
||||||
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
|
var floatTransitionDuration = parseFloat(transitionDuration);
|
||||||
|
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
|
return 0;
|
||||||
|
} // If multiple durations are defined, take the first
|
||||||
|
|
||||||
|
|
||||||
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
|
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
||||||
|
};
|
||||||
|
|
||||||
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
element.dispatchEvent(new Event(TRANSITION_END));
|
||||||
|
};
|
||||||
|
|
||||||
|
var isElement = function isElement(obj) {
|
||||||
|
return (obj[0] || obj).nodeType;
|
||||||
|
};
|
||||||
|
|
||||||
|
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
||||||
|
var called = false;
|
||||||
|
var durationPadding = 5;
|
||||||
|
var emulatedDuration = duration + durationPadding;
|
||||||
|
|
||||||
|
function listener() {
|
||||||
|
called = true;
|
||||||
|
element.removeEventListener(TRANSITION_END, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.addEventListener(TRANSITION_END, listener);
|
||||||
|
setTimeout(function () {
|
||||||
|
if (!called) {
|
||||||
|
triggerTransitionEnd(element);
|
||||||
|
}
|
||||||
|
}, emulatedDuration);
|
||||||
|
};
|
||||||
|
|
||||||
|
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
||||||
|
Object.keys(configTypes).forEach(function (property) {
|
||||||
|
var expectedTypes = configTypes[property];
|
||||||
|
var value = config[property];
|
||||||
|
var valueType = value && isElement(value) ? 'element' : toType(value);
|
||||||
|
|
||||||
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||||
|
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var makeArray = function makeArray(nodeList) {
|
||||||
|
if (!nodeList) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [].slice.call(nodeList);
|
||||||
|
};
|
||||||
|
|
||||||
|
var reflow = function reflow(element) {
|
||||||
|
return element.offsetHeight;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -73,7 +177,6 @@
|
||||||
var DATA_KEY = 'bs.collapse';
|
var DATA_KEY = 'bs.collapse';
|
||||||
var EVENT_KEY = "." + DATA_KEY;
|
var EVENT_KEY = "." + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
||||||
var Default = {
|
var Default = {
|
||||||
toggle: true,
|
toggle: true,
|
||||||
parent: ''
|
parent: ''
|
||||||
|
@ -82,7 +185,7 @@
|
||||||
toggle: 'boolean',
|
toggle: 'boolean',
|
||||||
parent: '(string|element)'
|
parent: '(string|element)'
|
||||||
};
|
};
|
||||||
var Event = {
|
var Event$1 = {
|
||||||
SHOW: "show" + EVENT_KEY,
|
SHOW: "show" + EVENT_KEY,
|
||||||
SHOWN: "shown" + EVENT_KEY,
|
SHOWN: "shown" + EVENT_KEY,
|
||||||
HIDE: "hide" + EVENT_KEY,
|
HIDE: "hide" + EVENT_KEY,
|
||||||
|
@ -117,17 +220,17 @@
|
||||||
this._isTransitioning = false;
|
this._isTransitioning = false;
|
||||||
this._element = element;
|
this._element = element;
|
||||||
this._config = this._getConfig(config);
|
this._config = this._getConfig(config);
|
||||||
this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
|
this._triggerArray = makeArray(SelectorEngine.find("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
|
||||||
var toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
|
var toggleList = makeArray(SelectorEngine.find(Selector.DATA_TOGGLE));
|
||||||
|
|
||||||
for (var i = 0, len = toggleList.length; i < len; i++) {
|
for (var i = 0, len = toggleList.length; i < len; i++) {
|
||||||
var elem = toggleList[i];
|
var elem = toggleList[i];
|
||||||
var selector = Util.getSelectorFromElement(elem);
|
var selector = getSelectorFromElement(elem);
|
||||||
var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
|
var filterElement = makeArray(SelectorEngine.find(selector)).filter(function (foundElem) {
|
||||||
return foundElem === element;
|
return foundElem === element;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (selector !== null && filterElement.length > 0) {
|
if (selector !== null && filterElement.length) {
|
||||||
this._selector = selector;
|
this._selector = selector;
|
||||||
|
|
||||||
this._triggerArray.push(elem);
|
this._triggerArray.push(elem);
|
||||||
|
@ -143,6 +246,8 @@
|
||||||
if (this._config.toggle) {
|
if (this._config.toggle) {
|
||||||
this.toggle();
|
this.toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Data.setData(element, DATA_KEY, this);
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,7 +255,7 @@
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
_proto.toggle = function toggle() {
|
_proto.toggle = function toggle() {
|
||||||
if ($(this._element).hasClass(ClassName.SHOW)) {
|
if (this._element.classList.contains(ClassName.SHOW)) {
|
||||||
this.hide();
|
this.hide();
|
||||||
} else {
|
} else {
|
||||||
this.show();
|
this.show();
|
||||||
|
@ -160,7 +265,7 @@
|
||||||
_proto.show = function show() {
|
_proto.show = function show() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
if (this._isTransitioning || $(this._element).hasClass(ClassName.SHOW)) {
|
if (this._isTransitioning || this._element.classList.contains(ClassName.SHOW)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +273,7 @@
|
||||||
var activesData;
|
var activesData;
|
||||||
|
|
||||||
if (this._parent) {
|
if (this._parent) {
|
||||||
actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES)).filter(function (elem) {
|
actives = makeArray(SelectorEngine.find(Selector.ACTIVES, this._parent)).filter(function (elem) {
|
||||||
if (typeof _this._config.parent === 'string') {
|
if (typeof _this._config.parent === 'string') {
|
||||||
return elem.getAttribute('data-parent') === _this._config.parent;
|
return elem.getAttribute('data-parent') === _this._config.parent;
|
||||||
}
|
}
|
||||||
|
@ -181,87 +286,113 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var container = SelectorEngine.findOne(this._selector);
|
||||||
|
|
||||||
if (actives) {
|
if (actives) {
|
||||||
activesData = $(actives).not(this._selector).data(DATA_KEY);
|
var tempActiveData = actives.filter(function (elem) {
|
||||||
|
return container !== elem;
|
||||||
|
});
|
||||||
|
activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY) : null;
|
||||||
|
|
||||||
if (activesData && activesData._isTransitioning) {
|
if (activesData && activesData._isTransitioning) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var startEvent = $.Event(Event.SHOW);
|
var startEvent = EventHandler.trigger(this._element, Event$1.SHOW);
|
||||||
$(this._element).trigger(startEvent);
|
|
||||||
|
|
||||||
if (startEvent.isDefaultPrevented()) {
|
if (startEvent.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actives) {
|
if (actives) {
|
||||||
Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
|
actives.forEach(function (elemActive) {
|
||||||
|
if (container !== elemActive) {
|
||||||
|
Collapse._collapseInterface(elemActive, 'hide');
|
||||||
|
}
|
||||||
|
|
||||||
if (!activesData) {
|
if (!activesData) {
|
||||||
$(actives).data(DATA_KEY, null);
|
Data.setData(elemActive, DATA_KEY, null);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var dimension = this._getDimension();
|
var dimension = this._getDimension();
|
||||||
|
|
||||||
$(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
|
this._element.classList.remove(ClassName.COLLAPSE);
|
||||||
|
|
||||||
|
this._element.classList.add(ClassName.COLLAPSING);
|
||||||
|
|
||||||
this._element.style[dimension] = 0;
|
this._element.style[dimension] = 0;
|
||||||
|
|
||||||
if (this._triggerArray.length) {
|
if (this._triggerArray.length) {
|
||||||
$(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
|
this._triggerArray.forEach(function (element) {
|
||||||
|
element.classList.remove(ClassName.COLLAPSED);
|
||||||
|
element.setAttribute('aria-expanded', true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setTransitioning(true);
|
this.setTransitioning(true);
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
$(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
|
_this._element.classList.remove(ClassName.COLLAPSING);
|
||||||
|
|
||||||
|
_this._element.classList.add(ClassName.COLLAPSE);
|
||||||
|
|
||||||
|
_this._element.classList.add(ClassName.SHOW);
|
||||||
|
|
||||||
_this._element.style[dimension] = '';
|
_this._element.style[dimension] = '';
|
||||||
|
|
||||||
_this.setTransitioning(false);
|
_this.setTransitioning(false);
|
||||||
|
|
||||||
$(_this._element).trigger(Event.SHOWN);
|
EventHandler.trigger(_this._element, Event$1.SHOWN);
|
||||||
};
|
};
|
||||||
|
|
||||||
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
||||||
var scrollSize = "scroll" + capitalizedDimension;
|
var scrollSize = "scroll" + capitalizedDimension;
|
||||||
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
var transitionDuration = getTransitionDurationFromElement(this._element);
|
||||||
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
EventHandler.one(this._element, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(this._element, transitionDuration);
|
||||||
this._element.style[dimension] = this._element[scrollSize] + "px";
|
this._element.style[dimension] = this._element[scrollSize] + "px";
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.hide = function hide() {
|
_proto.hide = function hide() {
|
||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
if (this._isTransitioning || !$(this._element).hasClass(ClassName.SHOW)) {
|
if (this._isTransitioning || !this._element.classList.contains(ClassName.SHOW)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var startEvent = $.Event(Event.HIDE);
|
var startEvent = EventHandler.trigger(this._element, Event$1.HIDE);
|
||||||
$(this._element).trigger(startEvent);
|
|
||||||
|
|
||||||
if (startEvent.isDefaultPrevented()) {
|
if (startEvent.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dimension = this._getDimension();
|
var dimension = this._getDimension();
|
||||||
|
|
||||||
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
|
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
|
||||||
Util.reflow(this._element);
|
reflow(this._element);
|
||||||
$(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
|
|
||||||
|
this._element.classList.add(ClassName.COLLAPSING);
|
||||||
|
|
||||||
|
this._element.classList.remove(ClassName.COLLAPSE);
|
||||||
|
|
||||||
|
this._element.classList.remove(ClassName.SHOW);
|
||||||
|
|
||||||
var triggerArrayLength = this._triggerArray.length;
|
var triggerArrayLength = this._triggerArray.length;
|
||||||
|
|
||||||
if (triggerArrayLength > 0) {
|
if (triggerArrayLength > 0) {
|
||||||
for (var i = 0; i < triggerArrayLength; i++) {
|
for (var i = 0; i < triggerArrayLength; i++) {
|
||||||
var trigger = this._triggerArray[i];
|
var trigger = this._triggerArray[i];
|
||||||
var selector = Util.getSelectorFromElement(trigger);
|
var selector = getSelectorFromElement(trigger);
|
||||||
|
|
||||||
if (selector !== null) {
|
if (selector !== null) {
|
||||||
var $elem = $([].slice.call(document.querySelectorAll(selector)));
|
var elem = SelectorEngine.findOne(selector);
|
||||||
|
|
||||||
if (!$elem.hasClass(ClassName.SHOW)) {
|
if (!elem.classList.contains(ClassName.SHOW)) {
|
||||||
$(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
|
trigger.classList.add(ClassName.COLLAPSED);
|
||||||
|
trigger.setAttribute('aria-expanded', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,12 +403,17 @@
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
_this2.setTransitioning(false);
|
_this2.setTransitioning(false);
|
||||||
|
|
||||||
$(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
|
_this2._element.classList.remove(ClassName.COLLAPSING);
|
||||||
|
|
||||||
|
_this2._element.classList.add(ClassName.COLLAPSE);
|
||||||
|
|
||||||
|
EventHandler.trigger(_this2._element, Event$1.HIDDEN);
|
||||||
};
|
};
|
||||||
|
|
||||||
this._element.style[dimension] = '';
|
this._element.style[dimension] = '';
|
||||||
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
var transitionDuration = getTransitionDurationFromElement(this._element);
|
||||||
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
EventHandler.one(this._element, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(this._element, transitionDuration);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.setTransitioning = function setTransitioning(isTransitioning) {
|
_proto.setTransitioning = function setTransitioning(isTransitioning) {
|
||||||
|
@ -285,7 +421,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
$.removeData(this._element, DATA_KEY);
|
Data.removeData(this._element, DATA_KEY);
|
||||||
this._config = null;
|
this._config = null;
|
||||||
this._parent = null;
|
this._parent = null;
|
||||||
this._element = null;
|
this._element = null;
|
||||||
|
@ -298,12 +434,13 @@
|
||||||
config = _objectSpread({}, Default, config);
|
config = _objectSpread({}, Default, config);
|
||||||
config.toggle = Boolean(config.toggle); // Coerce string values
|
config.toggle = Boolean(config.toggle); // Coerce string values
|
||||||
|
|
||||||
Util.typeCheckConfig(NAME, config, DefaultType);
|
typeCheckConfig(NAME, config, DefaultType);
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getDimension = function _getDimension() {
|
_proto._getDimension = function _getDimension() {
|
||||||
var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
|
var hasWidth = this._element.classList.contains(Dimension.WIDTH);
|
||||||
|
|
||||||
return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
|
return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -312,64 +449,79 @@
|
||||||
|
|
||||||
var parent;
|
var parent;
|
||||||
|
|
||||||
if (Util.isElement(this._config.parent)) {
|
if (isElement(this._config.parent)) {
|
||||||
parent = this._config.parent; // It's a jQuery object
|
parent = this._config.parent; // it's a jQuery object
|
||||||
|
|
||||||
if (typeof this._config.parent.jquery !== 'undefined') {
|
if (typeof this._config.parent.jquery !== 'undefined' || typeof this._config.parent[0] !== 'undefined') {
|
||||||
parent = this._config.parent[0];
|
parent = this._config.parent[0];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
parent = document.querySelector(this._config.parent);
|
parent = SelectorEngine.findOne(this._config.parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
|
var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
|
||||||
var children = [].slice.call(parent.querySelectorAll(selector));
|
makeArray(SelectorEngine.find(selector, parent)).forEach(function (element) {
|
||||||
$(children).each(function (i, element) {
|
|
||||||
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
|
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
|
||||||
});
|
});
|
||||||
return parent;
|
return parent;
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
|
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
|
||||||
var isOpen = $(element).hasClass(ClassName.SHOW);
|
if (element) {
|
||||||
|
var isOpen = element.classList.contains(ClassName.SHOW);
|
||||||
|
|
||||||
if (triggerArray.length) {
|
if (triggerArray.length) {
|
||||||
$(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
|
triggerArray.forEach(function (elem) {
|
||||||
|
if (!isOpen) {
|
||||||
|
elem.classList.add(ClassName.COLLAPSED);
|
||||||
|
} else {
|
||||||
|
elem.classList.remove(ClassName.COLLAPSED);
|
||||||
|
}
|
||||||
|
|
||||||
|
elem.setAttribute('aria-expanded', isOpen);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // Static
|
} // Static
|
||||||
;
|
;
|
||||||
|
|
||||||
Collapse._getTargetFromElement = function _getTargetFromElement(element) {
|
Collapse._getTargetFromElement = function _getTargetFromElement(element) {
|
||||||
var selector = Util.getSelectorFromElement(element);
|
var selector = getSelectorFromElement(element);
|
||||||
return selector ? document.querySelector(selector) : null;
|
return selector ? SelectorEngine.findOne(selector) : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
Collapse._jQueryInterface = function _jQueryInterface(config) {
|
Collapse._collapseInterface = function _collapseInterface(element, config) {
|
||||||
return this.each(function () {
|
var data = Data.getData(element, DATA_KEY);
|
||||||
var $this = $(this);
|
|
||||||
var data = $this.data(DATA_KEY);
|
|
||||||
|
|
||||||
var _config = _objectSpread({}, Default, $this.data(), typeof config === 'object' && config ? config : {});
|
var _config = _objectSpread({}, Default, Manipulator.getDataAttributes(element), typeof config === 'object' && config ? config : {});
|
||||||
|
|
||||||
if (!data && _config.toggle && /show|hide/.test(config)) {
|
if (!data && _config.toggle && /show|hide/.test(config)) {
|
||||||
_config.toggle = false;
|
_config.toggle = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = new Collapse(this, _config);
|
data = new Collapse(element, _config);
|
||||||
$this.data(DATA_KEY, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
if (typeof data[config] === 'undefined') {
|
if (typeof data[config] === 'undefined') {
|
||||||
throw new TypeError("No method named \"" + config + "\"");
|
throw new Error("No method named \"" + config + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
data[config]();
|
data[config]();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Collapse._jQueryInterface = function _jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
Collapse._collapseInterface(this, config);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Collapse._getInstance = function _getInstance(element) {
|
||||||
|
return Data.getData(element, DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(Collapse, null, [{
|
_createClass(Collapse, null, [{
|
||||||
key: "VERSION",
|
key: "VERSION",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -391,36 +543,51 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
|
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
|
||||||
if (event.currentTarget.tagName === 'A') {
|
if (event.target.tagName === 'A') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
var $trigger = $(this);
|
var triggerData = Manipulator.getDataAttributes(this);
|
||||||
var selector = Util.getSelectorFromElement(this);
|
var selector = getSelectorFromElement(this);
|
||||||
var selectors = [].slice.call(document.querySelectorAll(selector));
|
var selectorElements = makeArray(SelectorEngine.find(selector));
|
||||||
$(selectors).each(function () {
|
selectorElements.forEach(function (element) {
|
||||||
var $target = $(this);
|
var data = Data.getData(element, DATA_KEY);
|
||||||
var data = $target.data(DATA_KEY);
|
var config;
|
||||||
var config = data ? 'toggle' : $trigger.data();
|
|
||||||
|
|
||||||
Collapse._jQueryInterface.call($target, config);
|
if (data) {
|
||||||
|
// update parent attribute
|
||||||
|
if (data._parent === null && typeof triggerData.parent === 'string') {
|
||||||
|
data._config.parent = triggerData.parent;
|
||||||
|
data._parent = data._getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
config = 'toggle';
|
||||||
|
} else {
|
||||||
|
config = triggerData;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collapse._collapseInterface(element, config);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .collapse to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$.fn[NAME] = Collapse._jQueryInterface;
|
if (typeof jQuery !== 'undefined') {
|
||||||
$.fn[NAME].Constructor = Collapse;
|
var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
|
||||||
|
jQuery.fn[NAME] = Collapse._jQueryInterface;
|
||||||
|
jQuery.fn[NAME].Constructor = Collapse;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
jQuery.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Collapse._jQueryInterface;
|
return Collapse._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Collapse;
|
return Collapse;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,82 @@
|
||||||
|
/*!
|
||||||
|
* Bootstrap data.js v4.3.1 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
*/
|
||||||
|
(function (global, factory) {
|
||||||
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||||
|
typeof define === 'function' && define.amd ? define(factory) :
|
||||||
|
(global = global || self, global.Data = factory());
|
||||||
|
}(this, function () { 'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): dom/data.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var mapData = function () {
|
||||||
|
var storeData = {};
|
||||||
|
var id = 1;
|
||||||
|
return {
|
||||||
|
set: function set(element, key, data) {
|
||||||
|
if (typeof element.key === 'undefined') {
|
||||||
|
element.key = {
|
||||||
|
key: key,
|
||||||
|
id: id
|
||||||
|
};
|
||||||
|
id++;
|
||||||
|
}
|
||||||
|
|
||||||
|
storeData[element.key.id] = data;
|
||||||
|
},
|
||||||
|
get: function get(element, key) {
|
||||||
|
if (!element || typeof element.key === 'undefined') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var keyProperties = element.key;
|
||||||
|
|
||||||
|
if (keyProperties.key === key) {
|
||||||
|
return storeData[keyProperties.id];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
delete: function _delete(element, key) {
|
||||||
|
if (typeof element.key === 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var keyProperties = element.key;
|
||||||
|
|
||||||
|
if (keyProperties.key === key) {
|
||||||
|
delete storeData[keyProperties.id];
|
||||||
|
delete element.key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
|
||||||
|
var Data = {
|
||||||
|
setData: function setData(instance, key, data) {
|
||||||
|
mapData.set(instance, key, data);
|
||||||
|
},
|
||||||
|
getData: function getData(instance, key) {
|
||||||
|
return mapData.get(instance, key);
|
||||||
|
},
|
||||||
|
removeData: function removeData(instance, key) {
|
||||||
|
mapData.delete(instance, key);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return Data;
|
||||||
|
|
||||||
|
}));
|
||||||
|
//# sourceMappingURL=data.js.map
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst mapData = (() => {\n const storeData = {}\n let id = 1\n return {\n set(element, key, data) {\n if (typeof element.key === 'undefined') {\n element.key = {\n key,\n id\n }\n id++\n }\n\n storeData[element.key.id] = data\n },\n get(element, key) {\n if (!element || typeof element.key === 'undefined') {\n return null\n }\n\n const keyProperties = element.key\n if (keyProperties.key === key) {\n return storeData[keyProperties.id]\n }\n return null\n },\n delete(element, key) {\n if (typeof element.key === 'undefined') {\n return\n }\n\n const keyProperties = element.key\n if (keyProperties.key === key) {\n delete storeData[keyProperties.id]\n delete element.key\n }\n }\n }\n})()\n\nconst Data = {\n setData(instance, key, data) {\n mapData.set(instance, key, data)\n },\n getData(instance, key) {\n return mapData.get(instance, key)\n },\n removeData(instance, key) {\n mapData.delete(instance, key)\n }\n}\n\nexport default Data\n"],"names":["mapData","storeData","id","set","element","key","data","get","keyProperties","delete","Data","setData","instance","getData","removeData"],"mappings":";;;;;;;;;;;EAAA;;;;;;;EAOA;;;;;EAMA,IAAMA,OAAO,GAAI,YAAM;EACrB,MAAMC,SAAS,GAAG,EAAlB;EACA,MAAIC,EAAE,GAAG,CAAT;EACA,SAAO;EACLC,IAAAA,GADK,eACDC,OADC,EACQC,GADR,EACaC,IADb,EACmB;EACtB,UAAI,OAAOF,OAAO,CAACC,GAAf,KAAuB,WAA3B,EAAwC;EACtCD,QAAAA,OAAO,CAACC,GAAR,GAAc;EACZA,UAAAA,GAAG,EAAHA,GADY;EAEZH,UAAAA,EAAE,EAAFA;EAFY,SAAd;EAIAA,QAAAA,EAAE;EACH;;EAEDD,MAAAA,SAAS,CAACG,OAAO,CAACC,GAAR,CAAYH,EAAb,CAAT,GAA4BI,IAA5B;EACD,KAXI;EAYLC,IAAAA,GAZK,eAYDH,OAZC,EAYQC,GAZR,EAYa;EAChB,UAAI,CAACD,OAAD,IAAY,OAAOA,OAAO,CAACC,GAAf,KAAuB,WAAvC,EAAoD;EAClD,eAAO,IAAP;EACD;;EAED,UAAMG,aAAa,GAAGJ,OAAO,CAACC,GAA9B;;EACA,UAAIG,aAAa,CAACH,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACO,aAAa,CAACN,EAAf,CAAhB;EACD;;EACD,aAAO,IAAP;EACD,KAtBI;EAuBLO,IAAAA,MAvBK,mBAuBEL,OAvBF,EAuBWC,GAvBX,EAuBgB;EACnB,UAAI,OAAOD,OAAO,CAACC,GAAf,KAAuB,WAA3B,EAAwC;EACtC;EACD;;EAED,UAAMG,aAAa,GAAGJ,OAAO,CAACC,GAA9B;;EACA,UAAIG,aAAa,CAACH,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACO,aAAa,CAACN,EAAf,CAAhB;EACA,eAAOE,OAAO,CAACC,GAAf;EACD;EACF;EAjCI,GAAP;EAmCD,CAtCe,EAAhB;;EAwCA,IAAMK,IAAI,GAAG;EACXC,EAAAA,OADW,mBACHC,QADG,EACOP,GADP,EACYC,IADZ,EACkB;EAC3BN,IAAAA,OAAO,CAACG,GAAR,CAAYS,QAAZ,EAAsBP,GAAtB,EAA2BC,IAA3B;EACD,GAHU;EAIXO,EAAAA,OAJW,mBAIHD,QAJG,EAIOP,GAJP,EAIY;EACrB,WAAOL,OAAO,CAACO,GAAR,CAAYK,QAAZ,EAAsBP,GAAtB,CAAP;EACD,GANU;EAOXS,EAAAA,UAPW,sBAOAF,QAPA,EAOUP,GAPV,EAOe;EACxBL,IAAAA,OAAO,CAACS,MAAR,CAAeG,QAAf,EAAyBP,GAAzB;EACD;EATU,CAAb;;;;;;;;"}
|
|
@ -0,0 +1,317 @@
|
||||||
|
/*!
|
||||||
|
* Bootstrap eventhandler.js v4.3.1 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
*/
|
||||||
|
(function (global, factory) {
|
||||||
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./polyfill.js')) :
|
||||||
|
typeof define === 'function' && define.amd ? define(['./polyfill.js'], factory) :
|
||||||
|
(global = global || self, global.EventHandler = factory(global.Polyfill));
|
||||||
|
}(this, function (Polyfill) { 'use strict';
|
||||||
|
|
||||||
|
Polyfill = Polyfill && Polyfill.hasOwnProperty('default') ? Polyfill['default'] : Polyfill;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): dom/eventHandler.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
||||||
|
var stripNameRegex = /\..*/;
|
||||||
|
var keyEventRegex = /^key/;
|
||||||
|
var stripUidRegex = /::\d+$/;
|
||||||
|
var eventRegistry = {}; // Events storage
|
||||||
|
|
||||||
|
var uidEvent = 1;
|
||||||
|
var customEvents = {
|
||||||
|
mouseenter: 'mouseover',
|
||||||
|
mouseleave: 'mouseout'
|
||||||
|
};
|
||||||
|
var nativeEvents = ['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll'];
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Private methods
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getUidEvent(element, uid) {
|
||||||
|
return uid && uid + "::" + uidEvent++ || element.uidEvent || uidEvent++;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getEvent(element) {
|
||||||
|
var uid = getUidEvent(element);
|
||||||
|
element.uidEvent = uid;
|
||||||
|
return eventRegistry[uid] = eventRegistry[uid] || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
function fixEvent(event, element) {
|
||||||
|
// Add which for key events
|
||||||
|
if (event.which === null && keyEventRegex.test(event.type)) {
|
||||||
|
event.which = event.charCode !== null ? event.charCode : event.keyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.delegateTarget = element;
|
||||||
|
}
|
||||||
|
|
||||||
|
function bootstrapHandler(element, fn) {
|
||||||
|
return function handler(event) {
|
||||||
|
fixEvent(event, element);
|
||||||
|
|
||||||
|
if (handler.oneOff) {
|
||||||
|
EventHandler.off(element, event.type, fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fn.apply(element, [event]);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function bootstrapDelegationHandler(element, selector, fn) {
|
||||||
|
return function handler(event) {
|
||||||
|
var domElements = element.querySelectorAll(selector);
|
||||||
|
|
||||||
|
for (var target = event.target; target && target !== this; target = target.parentNode) {
|
||||||
|
for (var i = domElements.length; i--;) {
|
||||||
|
if (domElements[i] === target) {
|
||||||
|
fixEvent(event, target);
|
||||||
|
|
||||||
|
if (handler.oneOff) {
|
||||||
|
EventHandler.off(element, event.type, fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fn.apply(target, [event]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // To please ESLint
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function findHandler(events, handler, delegationSelector) {
|
||||||
|
if (delegationSelector === void 0) {
|
||||||
|
delegationSelector = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var uidList = Object.keys(events);
|
||||||
|
|
||||||
|
for (var i = 0; i < uidList.length; i++) {
|
||||||
|
var uid = uidList[i];
|
||||||
|
var event = events[uid];
|
||||||
|
|
||||||
|
if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
|
||||||
|
return events[uid];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeParams(originalTypeEvent, handler, delegationFn) {
|
||||||
|
var delegation = typeof handler === 'string';
|
||||||
|
var originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
|
||||||
|
|
||||||
|
var typeEvent = originalTypeEvent.replace(stripNameRegex, '');
|
||||||
|
var custom = customEvents[typeEvent];
|
||||||
|
|
||||||
|
if (custom) {
|
||||||
|
typeEvent = custom;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isNative = nativeEvents.indexOf(typeEvent) > -1;
|
||||||
|
|
||||||
|
if (!isNative) {
|
||||||
|
typeEvent = originalTypeEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [delegation, originalHandler, typeEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
|
||||||
|
if (typeof originalTypeEvent !== 'string' || !element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handler) {
|
||||||
|
handler = delegationFn;
|
||||||
|
delegationFn = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _normalizeParams = normalizeParams(originalTypeEvent, handler, delegationFn),
|
||||||
|
delegation = _normalizeParams[0],
|
||||||
|
originalHandler = _normalizeParams[1],
|
||||||
|
typeEvent = _normalizeParams[2];
|
||||||
|
|
||||||
|
var events = getEvent(element);
|
||||||
|
var handlers = events[typeEvent] || (events[typeEvent] = {});
|
||||||
|
var previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
|
||||||
|
|
||||||
|
if (previousFn) {
|
||||||
|
previousFn.oneOff = previousFn.oneOff && oneOff;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
|
||||||
|
var fn = !delegation ? bootstrapHandler(element, handler) : bootstrapDelegationHandler(element, handler, delegationFn);
|
||||||
|
fn.delegationSelector = delegation ? handler : null;
|
||||||
|
fn.originalHandler = originalHandler;
|
||||||
|
fn.oneOff = oneOff;
|
||||||
|
fn.uidEvent = uid;
|
||||||
|
handlers[uid] = fn;
|
||||||
|
element.addEventListener(typeEvent, fn, delegation);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
|
||||||
|
var fn = findHandler(events[typeEvent], handler, delegationSelector);
|
||||||
|
|
||||||
|
if (fn === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
|
||||||
|
delete events[typeEvent][fn.uidEvent];
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
||||||
|
var storeElementEvent = events[typeEvent] || {};
|
||||||
|
Object.keys(storeElementEvent).forEach(function (handlerKey) {
|
||||||
|
if (handlerKey.indexOf(namespace) > -1) {
|
||||||
|
var event = storeElementEvent[handlerKey];
|
||||||
|
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var EventHandler = {
|
||||||
|
on: function on(element, event, handler, delegationFn) {
|
||||||
|
addHandler(element, event, handler, delegationFn, false);
|
||||||
|
},
|
||||||
|
one: function one(element, event, handler, delegationFn) {
|
||||||
|
addHandler(element, event, handler, delegationFn, true);
|
||||||
|
},
|
||||||
|
off: function off(element, originalTypeEvent, handler, delegationFn) {
|
||||||
|
if (typeof originalTypeEvent !== 'string' || !element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
|
||||||
|
delegation = _normalizeParams2[0],
|
||||||
|
originalHandler = _normalizeParams2[1],
|
||||||
|
typeEvent = _normalizeParams2[2];
|
||||||
|
|
||||||
|
var inNamespace = typeEvent !== originalTypeEvent;
|
||||||
|
var events = getEvent(element);
|
||||||
|
var isNamespace = originalTypeEvent.charAt(0) === '.';
|
||||||
|
|
||||||
|
if (typeof originalHandler !== 'undefined') {
|
||||||
|
// Simplest case: handler is passed, remove that listener ONLY.
|
||||||
|
if (!events || !events[typeEvent]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNamespace) {
|
||||||
|
Object.keys(events).forEach(function (elementEvent) {
|
||||||
|
removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.substr(1));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var storeElementEvent = events[typeEvent] || {};
|
||||||
|
Object.keys(storeElementEvent).forEach(function (keyHandlers) {
|
||||||
|
var handlerKey = keyHandlers.replace(stripUidRegex, '');
|
||||||
|
|
||||||
|
if (!inNamespace || originalTypeEvent.indexOf(handlerKey) > -1) {
|
||||||
|
var event = storeElementEvent[keyHandlers];
|
||||||
|
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
trigger: function trigger(element, event, args) {
|
||||||
|
if (typeof event !== 'string' || !element) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var typeEvent = event.replace(stripNameRegex, '');
|
||||||
|
var inNamespace = event !== typeEvent;
|
||||||
|
var isNative = nativeEvents.indexOf(typeEvent) > -1;
|
||||||
|
var jQueryEvent;
|
||||||
|
var bubbles = true;
|
||||||
|
var nativeDispatch = true;
|
||||||
|
var defaultPrevented = false;
|
||||||
|
var evt = null;
|
||||||
|
|
||||||
|
if (inNamespace && typeof jQuery !== 'undefined') {
|
||||||
|
jQueryEvent = jQuery.Event(event, args);
|
||||||
|
jQuery(element).trigger(jQueryEvent);
|
||||||
|
bubbles = !jQueryEvent.isPropagationStopped();
|
||||||
|
nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
|
||||||
|
defaultPrevented = jQueryEvent.isDefaultPrevented();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNative) {
|
||||||
|
evt = document.createEvent('HTMLEvents');
|
||||||
|
evt.initEvent(typeEvent, bubbles, true);
|
||||||
|
} else {
|
||||||
|
evt = new CustomEvent(event, {
|
||||||
|
bubbles: bubbles,
|
||||||
|
cancelable: true
|
||||||
|
});
|
||||||
|
} // merge custom informations in our event
|
||||||
|
|
||||||
|
|
||||||
|
if (typeof args !== 'undefined') {
|
||||||
|
Object.keys(args).forEach(function (key) {
|
||||||
|
Object.defineProperty(evt, key, {
|
||||||
|
get: function get() {
|
||||||
|
return args[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defaultPrevented) {
|
||||||
|
evt.preventDefault();
|
||||||
|
|
||||||
|
if (!Polyfill.defaultPreventedPreservedOnDispatch) {
|
||||||
|
Object.defineProperty(evt, 'defaultPrevented', {
|
||||||
|
get: function get() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nativeDispatch) {
|
||||||
|
element.dispatchEvent(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
|
||||||
|
jQueryEvent.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
return evt;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return EventHandler;
|
||||||
|
|
||||||
|
}));
|
||||||
|
//# sourceMappingURL=eventhandler.js.map
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,129 @@
|
||||||
|
/*!
|
||||||
|
* Bootstrap manipulator.js v4.3.1 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
*/
|
||||||
|
(function (global, factory) {
|
||||||
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||||
|
typeof define === 'function' && define.amd ? define(factory) :
|
||||||
|
(global = global || self, global.Manipulator = factory());
|
||||||
|
}(this, function () { 'use strict';
|
||||||
|
|
||||||
|
function _defineProperty(obj, key, value) {
|
||||||
|
if (key in obj) {
|
||||||
|
Object.defineProperty(obj, key, {
|
||||||
|
value: value,
|
||||||
|
enumerable: true,
|
||||||
|
configurable: true,
|
||||||
|
writable: true
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
obj[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _objectSpread(target) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
var source = arguments[i] != null ? arguments[i] : {};
|
||||||
|
var ownKeys = Object.keys(source);
|
||||||
|
|
||||||
|
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||||||
|
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
||||||
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
ownKeys.forEach(function (key) {
|
||||||
|
_defineProperty(target, key, source[key]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): dom/manipulator.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
function normalizeData(val) {
|
||||||
|
if (val === 'true') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val === 'false') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val === Number(val).toString()) {
|
||||||
|
return Number(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val === '' || val === 'null') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeDataKey(key) {
|
||||||
|
return key.replace(/[A-Z]/g, function (chr) {
|
||||||
|
return chr.toLowerCase();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var Manipulator = {
|
||||||
|
setDataAttribute: function setDataAttribute(element, key, value) {
|
||||||
|
element.setAttribute("data-" + normalizeDataKey(key), value);
|
||||||
|
},
|
||||||
|
removeDataAttribute: function removeDataAttribute(element, key) {
|
||||||
|
element.removeAttribute("data-" + normalizeDataKey(key));
|
||||||
|
},
|
||||||
|
getDataAttributes: function getDataAttributes(element) {
|
||||||
|
if (!element) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
var attributes = _objectSpread({}, element.dataset);
|
||||||
|
|
||||||
|
Object.keys(attributes).forEach(function (key) {
|
||||||
|
attributes[key] = normalizeData(attributes[key]);
|
||||||
|
});
|
||||||
|
return attributes;
|
||||||
|
},
|
||||||
|
getDataAttribute: function getDataAttribute(element, key) {
|
||||||
|
return normalizeData(element.getAttribute("data-" + normalizeDataKey(key)));
|
||||||
|
},
|
||||||
|
offset: function offset(element) {
|
||||||
|
var rect = element.getBoundingClientRect();
|
||||||
|
return {
|
||||||
|
top: rect.top + document.body.scrollTop,
|
||||||
|
left: rect.left + document.body.scrollLeft
|
||||||
|
};
|
||||||
|
},
|
||||||
|
position: function position(element) {
|
||||||
|
return {
|
||||||
|
top: element.offsetTop,
|
||||||
|
left: element.offsetLeft
|
||||||
|
};
|
||||||
|
},
|
||||||
|
toggleClass: function toggleClass(element, className) {
|
||||||
|
if (!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element.classList.contains(className)) {
|
||||||
|
element.classList.remove(className);
|
||||||
|
} else {
|
||||||
|
element.classList.add(className);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return Manipulator;
|
||||||
|
|
||||||
|
}));
|
||||||
|
//# sourceMappingURL=manipulator.js.map
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nfunction normalizeData(val) {\n if (val === 'true') {\n return true\n }\n\n if (val === 'false') {\n return false\n }\n\n if (val === Number(val).toString()) {\n return Number(val)\n }\n\n if (val === '' || val === 'null') {\n return null\n }\n\n return val\n}\n\nfunction normalizeDataKey(key) {\n return key.replace(/[A-Z]/g, (chr) => chr.toLowerCase())\n}\n\nconst Manipulator = {\n setDataAttribute(element, key, value) {\n element.setAttribute(`data-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {\n ...element.dataset\n }\n\n Object.keys(attributes).forEach((key) => {\n attributes[key] = normalizeData(attributes[key])\n })\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-${normalizeDataKey(key)}`))\n },\n\n offset(element) {\n const rect = element.getBoundingClientRect()\n\n return {\n top: rect.top + document.body.scrollTop,\n left: rect.left + document.body.scrollLeft\n }\n },\n\n position(element) {\n return {\n top: element.offsetTop,\n left: element.offsetLeft\n }\n },\n\n toggleClass(element, className) {\n if (!element) {\n return\n }\n\n if (element.classList.contains(className)) {\n element.classList.remove(className)\n } else {\n element.classList.add(className)\n }\n }\n}\n\nexport default Manipulator\n"],"names":["normalizeData","val","Number","toString","normalizeDataKey","key","replace","chr","toLowerCase","Manipulator","setDataAttribute","element","value","setAttribute","removeDataAttribute","removeAttribute","getDataAttributes","attributes","dataset","Object","keys","forEach","getDataAttribute","getAttribute","offset","rect","getBoundingClientRect","top","document","body","scrollTop","left","scrollLeft","position","offsetTop","offsetLeft","toggleClass","className","classList","contains","remove","add"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;EAOA,SAASA,aAAT,CAAuBC,GAAvB,EAA4B;EAC1B,MAAIA,GAAG,KAAK,MAAZ,EAAoB;EAClB,WAAO,IAAP;EACD;;EAED,MAAIA,GAAG,KAAK,OAAZ,EAAqB;EACnB,WAAO,KAAP;EACD;;EAED,MAAIA,GAAG,KAAKC,MAAM,CAACD,GAAD,CAAN,CAAYE,QAAZ,EAAZ,EAAoC;EAClC,WAAOD,MAAM,CAACD,GAAD,CAAb;EACD;;EAED,MAAIA,GAAG,KAAK,EAAR,IAAcA,GAAG,KAAK,MAA1B,EAAkC;EAChC,WAAO,IAAP;EACD;;EAED,SAAOA,GAAP;EACD;;EAED,SAASG,gBAAT,CAA0BC,GAA1B,EAA+B;EAC7B,SAAOA,GAAG,CAACC,OAAJ,CAAY,QAAZ,EAAsB,UAACC,GAAD;EAAA,WAASA,GAAG,CAACC,WAAJ,EAAT;EAAA,GAAtB,CAAP;EACD;;EAED,IAAMC,WAAW,GAAG;EAClBC,EAAAA,gBADkB,4BACDC,OADC,EACQN,GADR,EACaO,KADb,EACoB;EACpCD,IAAAA,OAAO,CAACE,YAAR,WAA6BT,gBAAgB,CAACC,GAAD,CAA7C,EAAsDO,KAAtD;EACD,GAHiB;EAKlBE,EAAAA,mBALkB,+BAKEH,OALF,EAKWN,GALX,EAKgB;EAChCM,IAAAA,OAAO,CAACI,eAAR,WAAgCX,gBAAgB,CAACC,GAAD,CAAhD;EACD,GAPiB;EASlBW,EAAAA,iBATkB,6BASAL,OATA,EASS;EACzB,QAAI,CAACA,OAAL,EAAc;EACZ,aAAO,EAAP;EACD;;EAED,QAAMM,UAAU,qBACXN,OAAO,CAACO,OADG,CAAhB;;EAIAC,IAAAA,MAAM,CAACC,IAAP,CAAYH,UAAZ,EAAwBI,OAAxB,CAAgC,UAAChB,GAAD,EAAS;EACvCY,MAAAA,UAAU,CAACZ,GAAD,CAAV,GAAkBL,aAAa,CAACiB,UAAU,CAACZ,GAAD,CAAX,CAA/B;EACD,KAFD;EAIA,WAAOY,UAAP;EACD,GAvBiB;EAyBlBK,EAAAA,gBAzBkB,4BAyBDX,OAzBC,EAyBQN,GAzBR,EAyBa;EAC7B,WAAOL,aAAa,CAACW,OAAO,CAACY,YAAR,WAA6BnB,gBAAgB,CAACC,GAAD,CAA7C,CAAD,CAApB;EACD,GA3BiB;EA6BlBmB,EAAAA,MA7BkB,kBA6BXb,OA7BW,EA6BF;EACd,QAAMc,IAAI,GAAGd,OAAO,CAACe,qBAAR,EAAb;EAEA,WAAO;EACLC,MAAAA,GAAG,EAAEF,IAAI,CAACE,GAAL,GAAWC,QAAQ,CAACC,IAAT,CAAcC,SADzB;EAELC,MAAAA,IAAI,EAAEN,IAAI,CAACM,IAAL,GAAYH,QAAQ,CAACC,IAAT,CAAcG;EAF3B,KAAP;EAID,GApCiB;EAsClBC,EAAAA,QAtCkB,oBAsCTtB,OAtCS,EAsCA;EAChB,WAAO;EACLgB,MAAAA,GAAG,EAAEhB,OAAO,CAACuB,SADR;EAELH,MAAAA,IAAI,EAAEpB,OAAO,CAACwB;EAFT,KAAP;EAID,GA3CiB;EA6ClBC,EAAAA,WA7CkB,uBA6CNzB,OA7CM,EA6CG0B,SA7CH,EA6Cc;EAC9B,QAAI,CAAC1B,OAAL,EAAc;EACZ;EACD;;EAED,QAAIA,OAAO,CAAC2B,SAAR,CAAkBC,QAAlB,CAA2BF,SAA3B,CAAJ,EAA2C;EACzC1B,MAAAA,OAAO,CAAC2B,SAAR,CAAkBE,MAAlB,CAAyBH,SAAzB;EACD,KAFD,MAEO;EACL1B,MAAAA,OAAO,CAAC2B,SAAR,CAAkBG,GAAlB,CAAsBJ,SAAtB;EACD;EACF;EAvDiB,CAApB;;;;;;;;"}
|
|
@ -0,0 +1,126 @@
|
||||||
|
/*!
|
||||||
|
* Bootstrap polyfill.js v4.3.1 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
*/
|
||||||
|
(function (global, factory) {
|
||||||
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||||
|
typeof define === 'function' && define.amd ? define(factory) :
|
||||||
|
(global = global || self, global.Polyfill = factory());
|
||||||
|
}(this, function () { 'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var MAX_UID = 1000000;
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Public Util Api
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var getUID = function getUID(prefix) {
|
||||||
|
do {
|
||||||
|
// eslint-disable-next-line no-bitwise
|
||||||
|
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
|
||||||
|
} while (document.getElementById(prefix));
|
||||||
|
|
||||||
|
return prefix;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): dom/polyfill.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
/* istanbul ignore next */
|
||||||
|
|
||||||
|
var Polyfill = function () {
|
||||||
|
// MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
|
||||||
|
var defaultPreventedPreservedOnDispatch = function () {
|
||||||
|
var e = new CustomEvent('Bootstrap', {
|
||||||
|
cancelable: true
|
||||||
|
});
|
||||||
|
var element = document.createElement('div');
|
||||||
|
element.addEventListener('Bootstrap', function () {
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
e.preventDefault();
|
||||||
|
element.dispatchEvent(e);
|
||||||
|
return e.defaultPrevented;
|
||||||
|
}();
|
||||||
|
|
||||||
|
var find = Element.prototype.querySelectorAll;
|
||||||
|
var findOne = Element.prototype.querySelector;
|
||||||
|
var scopeSelectorRegex = /:scope\b/;
|
||||||
|
|
||||||
|
var supportScopeQuery = function () {
|
||||||
|
var element = document.createElement('div');
|
||||||
|
|
||||||
|
try {
|
||||||
|
element.querySelectorAll(':scope *');
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}();
|
||||||
|
|
||||||
|
if (!supportScopeQuery) {
|
||||||
|
find = function find(selector) {
|
||||||
|
if (!scopeSelectorRegex.test(selector)) {
|
||||||
|
return this.querySelectorAll(selector);
|
||||||
|
}
|
||||||
|
|
||||||
|
var hasId = Boolean(this.id);
|
||||||
|
|
||||||
|
if (!hasId) {
|
||||||
|
this.id = getUID('scope');
|
||||||
|
}
|
||||||
|
|
||||||
|
var nodeList = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
selector = selector.replace(scopeSelectorRegex, "#" + this.id);
|
||||||
|
nodeList = this.querySelectorAll(selector);
|
||||||
|
} finally {
|
||||||
|
if (!hasId) {
|
||||||
|
this.removeAttribute('id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nodeList;
|
||||||
|
};
|
||||||
|
|
||||||
|
findOne = function findOne(selector) {
|
||||||
|
if (!scopeSelectorRegex.test(selector)) {
|
||||||
|
return this.querySelector(selector);
|
||||||
|
}
|
||||||
|
|
||||||
|
var matches = find.call(this, selector);
|
||||||
|
|
||||||
|
if (typeof matches[0] !== 'undefined') {
|
||||||
|
return matches[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
defaultPreventedPreservedOnDispatch: defaultPreventedPreservedOnDispatch,
|
||||||
|
find: find,
|
||||||
|
findOne: findOne
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
|
||||||
|
return Polyfill;
|
||||||
|
|
||||||
|
}));
|
||||||
|
//# sourceMappingURL=polyfill.js.map
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,131 @@
|
||||||
|
/*!
|
||||||
|
* Bootstrap selectorengine.js v4.3.1 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
*/
|
||||||
|
(function (global, factory) {
|
||||||
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./polyfill.js')) :
|
||||||
|
typeof define === 'function' && define.amd ? define(['./polyfill.js'], factory) :
|
||||||
|
(global = global || self, global.SelectorEngine = factory(global.Polyfill));
|
||||||
|
}(this, function (Polyfill) { 'use strict';
|
||||||
|
|
||||||
|
Polyfill = Polyfill && Polyfill.hasOwnProperty('default') ? Polyfill['default'] : Polyfill;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
|
var makeArray = function makeArray(nodeList) {
|
||||||
|
if (!nodeList) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [].slice.call(nodeList);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): dom/selectorEngine.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
* Constants
|
||||||
|
* ------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
var findFn = Polyfill.find;
|
||||||
|
var _findOne = Polyfill.findOne;
|
||||||
|
var NODE_TEXT = 3;
|
||||||
|
var SelectorEngine = {
|
||||||
|
matches: function matches(element, selector) {
|
||||||
|
return element.matches(selector);
|
||||||
|
},
|
||||||
|
find: function find(selector, element) {
|
||||||
|
if (element === void 0) {
|
||||||
|
element = document.documentElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof selector !== 'string') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return findFn.call(element, selector);
|
||||||
|
},
|
||||||
|
findOne: function findOne(selector, element) {
|
||||||
|
if (element === void 0) {
|
||||||
|
element = document.documentElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof selector !== 'string') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _findOne.call(element, selector);
|
||||||
|
},
|
||||||
|
children: function children(element, selector) {
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
if (typeof selector !== 'string') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var children = makeArray(element.children);
|
||||||
|
return children.filter(function (child) {
|
||||||
|
return _this.matches(child, selector);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
parents: function parents(element, selector) {
|
||||||
|
if (typeof selector !== 'string') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var parents = [];
|
||||||
|
var ancestor = element.parentNode;
|
||||||
|
|
||||||
|
while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
|
||||||
|
if (this.matches(ancestor, selector)) {
|
||||||
|
parents.push(ancestor);
|
||||||
|
}
|
||||||
|
|
||||||
|
ancestor = ancestor.parentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parents;
|
||||||
|
},
|
||||||
|
closest: function closest(element, selector) {
|
||||||
|
if (typeof selector !== 'string') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return element.closest(selector);
|
||||||
|
},
|
||||||
|
prev: function prev(element, selector) {
|
||||||
|
if (typeof selector !== 'string') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var siblings = [];
|
||||||
|
var previous = element.previousSibling;
|
||||||
|
|
||||||
|
while (previous && previous.nodeType === Node.ELEMENT_NODE && previous.nodeType !== NODE_TEXT) {
|
||||||
|
if (this.matches(previous, selector)) {
|
||||||
|
siblings.push(previous);
|
||||||
|
}
|
||||||
|
|
||||||
|
previous = previous.previousSibling;
|
||||||
|
}
|
||||||
|
|
||||||
|
return siblings;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return SelectorEngine;
|
||||||
|
|
||||||
|
}));
|
||||||
|
//# sourceMappingURL=selectorengine.js.map
|
File diff suppressed because one or more lines are too long
|
@ -4,14 +4,16 @@
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('popper.js'), require('./util.js')) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/eventHandler.js'), require('./dom/manipulator.js'), require('popper.js'), require('./dom/selectorEngine.js')) :
|
||||||
typeof define === 'function' && define.amd ? define(['jquery', 'popper.js', './util.js'], factory) :
|
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/eventHandler.js', './dom/manipulator.js', 'popper.js', './dom/selectorEngine.js'], factory) :
|
||||||
(global = global || self, global.Dropdown = factory(global.jQuery, global.Popper, global.Util));
|
(global = global || self, global.Dropdown = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
|
||||||
}(this, function ($, Popper, Util) { 'use strict';
|
}(this, function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
|
||||||
|
EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
|
||||||
|
Manipulator = Manipulator && Manipulator.hasOwnProperty('default') ? Manipulator['default'] : Manipulator;
|
||||||
Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
|
Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
|
||||||
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
|
SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -63,6 +65,62 @@
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
|
var toType = function toType(obj) {
|
||||||
|
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
||||||
|
};
|
||||||
|
|
||||||
|
var getSelectorFromElement = function getSelectorFromElement(element) {
|
||||||
|
var selector = element.getAttribute('data-target');
|
||||||
|
|
||||||
|
if (!selector || selector === '#') {
|
||||||
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return document.querySelector(selector) ? selector : null;
|
||||||
|
} catch (err) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var isElement = function isElement(obj) {
|
||||||
|
return (obj[0] || obj).nodeType;
|
||||||
|
};
|
||||||
|
|
||||||
|
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
||||||
|
Object.keys(configTypes).forEach(function (property) {
|
||||||
|
var expectedTypes = configTypes[property];
|
||||||
|
var value = config[property];
|
||||||
|
var valueType = value && isElement(value) ? 'element' : toType(value);
|
||||||
|
|
||||||
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||||
|
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var makeArray = function makeArray(nodeList) {
|
||||||
|
if (!nodeList) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [].slice.call(nodeList);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var noop = function noop() {
|
||||||
|
return function () {};
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -74,7 +132,6 @@
|
||||||
var DATA_KEY = 'bs.dropdown';
|
var DATA_KEY = 'bs.dropdown';
|
||||||
var EVENT_KEY = "." + DATA_KEY;
|
var EVENT_KEY = "." + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
||||||
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
|
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
|
||||||
|
|
||||||
var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
|
var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
|
||||||
|
@ -157,6 +214,8 @@
|
||||||
this._inNavbar = this._detectNavbar();
|
this._inNavbar = this._detectNavbar();
|
||||||
|
|
||||||
this._addEventListeners();
|
this._addEventListeners();
|
||||||
|
|
||||||
|
Data.setData(element, DATA_KEY, this);
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,13 +223,13 @@
|
||||||
|
|
||||||
// Public
|
// Public
|
||||||
_proto.toggle = function toggle() {
|
_proto.toggle = function toggle() {
|
||||||
if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED)) {
|
if (this._element.disabled || this._element.classList.contains(ClassName.DISABLED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = Dropdown._getParentFromElement(this._element);
|
var parent = Dropdown._getParentFromElement(this._element);
|
||||||
|
|
||||||
var isActive = $(this._menu).hasClass(ClassName.SHOW);
|
var isActive = this._menu.classList.contains(ClassName.SHOW);
|
||||||
|
|
||||||
Dropdown._clearMenus();
|
Dropdown._clearMenus();
|
||||||
|
|
||||||
|
@ -181,10 +240,9 @@
|
||||||
var relatedTarget = {
|
var relatedTarget = {
|
||||||
relatedTarget: this._element
|
relatedTarget: this._element
|
||||||
};
|
};
|
||||||
var showEvent = $.Event(Event.SHOW, relatedTarget);
|
var showEvent = EventHandler.trigger(parent, Event.SHOW, relatedTarget);
|
||||||
$(parent).trigger(showEvent);
|
|
||||||
|
|
||||||
if (showEvent.isDefaultPrevented()) {
|
if (showEvent.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
} // Disable totally Popper.js for Dropdown in Navbar
|
} // Disable totally Popper.js for Dropdown in Navbar
|
||||||
|
|
||||||
|
@ -195,14 +253,14 @@
|
||||||
* Popper - https://popper.js.org
|
* Popper - https://popper.js.org
|
||||||
*/
|
*/
|
||||||
if (typeof Popper === 'undefined') {
|
if (typeof Popper === 'undefined') {
|
||||||
throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
|
throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org)');
|
||||||
}
|
}
|
||||||
|
|
||||||
var referenceElement = this._element;
|
var referenceElement = this._element;
|
||||||
|
|
||||||
if (this._config.reference === 'parent') {
|
if (this._config.reference === 'parent') {
|
||||||
referenceElement = parent;
|
referenceElement = parent;
|
||||||
} else if (Util.isElement(this._config.reference)) {
|
} else if (isElement(this._config.reference)) {
|
||||||
referenceElement = this._config.reference; // Check if it's jQuery element
|
referenceElement = this._config.reference; // Check if it's jQuery element
|
||||||
|
|
||||||
if (typeof this._config.reference.jquery !== 'undefined') {
|
if (typeof this._config.reference.jquery !== 'undefined') {
|
||||||
|
@ -214,7 +272,7 @@
|
||||||
|
|
||||||
|
|
||||||
if (this._config.boundary !== 'scrollParent') {
|
if (this._config.boundary !== 'scrollParent') {
|
||||||
$(parent).addClass(ClassName.POSITION_STATIC);
|
parent.classList.add(ClassName.POSITION_STATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
|
this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
|
||||||
|
@ -224,65 +282,66 @@
|
||||||
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
||||||
|
|
||||||
|
|
||||||
if ('ontouchstart' in document.documentElement && $(parent).closest(Selector.NAVBAR_NAV).length === 0) {
|
if ('ontouchstart' in document.documentElement && !makeArray(SelectorEngine.closest(parent, Selector.NAVBAR_NAV)).length) {
|
||||||
$(document.body).children().on('mouseover', null, $.noop);
|
makeArray(document.body.children).forEach(function (elem) {
|
||||||
|
return EventHandler.on(elem, 'mouseover', null, noop());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this._element.focus();
|
this._element.focus();
|
||||||
|
|
||||||
this._element.setAttribute('aria-expanded', true);
|
this._element.setAttribute('aria-expanded', true);
|
||||||
|
|
||||||
$(this._menu).toggleClass(ClassName.SHOW);
|
Manipulator.toggleClass(this._menu, ClassName.SHOW);
|
||||||
$(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.SHOWN, relatedTarget));
|
Manipulator.toggleClass(parent, ClassName.SHOW);
|
||||||
|
EventHandler.trigger(parent, Event.SHOWN, relatedTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.show = function show() {
|
_proto.show = function show() {
|
||||||
if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED) || $(this._menu).hasClass(ClassName.SHOW)) {
|
if (this._element.disabled || this._element.classList.contains(ClassName.DISABLED) || this._menu.classList.contains(ClassName.SHOW)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var parent = Dropdown._getParentFromElement(this._element);
|
||||||
|
|
||||||
var relatedTarget = {
|
var relatedTarget = {
|
||||||
relatedTarget: this._element
|
relatedTarget: this._element
|
||||||
};
|
};
|
||||||
var showEvent = $.Event(Event.SHOW, relatedTarget);
|
var showEvent = EventHandler.trigger(parent, Event.SHOW, relatedTarget);
|
||||||
|
|
||||||
var parent = Dropdown._getParentFromElement(this._element);
|
if (showEvent.defaultPrevented) {
|
||||||
|
|
||||||
$(parent).trigger(showEvent);
|
|
||||||
|
|
||||||
if (showEvent.isDefaultPrevented()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this._menu).toggleClass(ClassName.SHOW);
|
Manipulator.toggleClass(this._menu, ClassName.SHOW);
|
||||||
$(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.SHOWN, relatedTarget));
|
Manipulator.toggleClass(parent, ClassName.SHOW);
|
||||||
|
EventHandler.trigger(parent, Event.SHOWN, relatedTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.hide = function hide() {
|
_proto.hide = function hide() {
|
||||||
if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED) || !$(this._menu).hasClass(ClassName.SHOW)) {
|
if (this._element.disabled || this._element.classList.contains(ClassName.DISABLED) || !this._menu.classList.contains(ClassName.SHOW)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var parent = Dropdown._getParentFromElement(this._element);
|
||||||
|
|
||||||
var relatedTarget = {
|
var relatedTarget = {
|
||||||
relatedTarget: this._element
|
relatedTarget: this._element
|
||||||
};
|
};
|
||||||
var hideEvent = $.Event(Event.HIDE, relatedTarget);
|
var hideEvent = EventHandler.trigger(parent, Event.HIDE, relatedTarget);
|
||||||
|
|
||||||
var parent = Dropdown._getParentFromElement(this._element);
|
if (hideEvent.defaultPrevented) {
|
||||||
|
|
||||||
$(parent).trigger(hideEvent);
|
|
||||||
|
|
||||||
if (hideEvent.isDefaultPrevented()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this._menu).toggleClass(ClassName.SHOW);
|
Manipulator.toggleClass(this._menu, ClassName.SHOW);
|
||||||
$(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget));
|
Manipulator.toggleClass(parent, ClassName.SHOW);
|
||||||
|
EventHandler.trigger(parent, Event.HIDDEN, relatedTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
$.removeData(this._element, DATA_KEY);
|
Data.removeData(this._element, DATA_KEY);
|
||||||
$(this._element).off(EVENT_KEY);
|
EventHandler.off(this._element, EVENT_KEY);
|
||||||
this._element = null;
|
this._element = null;
|
||||||
this._menu = null;
|
this._menu = null;
|
||||||
|
|
||||||
|
@ -305,7 +364,7 @@
|
||||||
_proto._addEventListeners = function _addEventListeners() {
|
_proto._addEventListeners = function _addEventListeners() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
$(this._element).on(Event.CLICK, function (event) {
|
EventHandler.on(this._element, Event.CLICK, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
|
@ -314,8 +373,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getConfig = function _getConfig(config) {
|
_proto._getConfig = function _getConfig(config) {
|
||||||
config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config);
|
config = _objectSpread({}, this.constructor.Default, Manipulator.getDataAttributes(this._element), config);
|
||||||
Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -324,7 +383,7 @@
|
||||||
var parent = Dropdown._getParentFromElement(this._element);
|
var parent = Dropdown._getParentFromElement(this._element);
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
this._menu = parent.querySelector(Selector.MENU);
|
this._menu = SelectorEngine.findOne(Selector.MENU, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,20 +391,20 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getPlacement = function _getPlacement() {
|
_proto._getPlacement = function _getPlacement() {
|
||||||
var $parentDropdown = $(this._element.parentNode);
|
var parentDropdown = this._element.parentNode;
|
||||||
var placement = AttachmentMap.BOTTOM; // Handle dropup
|
var placement = AttachmentMap.BOTTOM; // Handle dropup
|
||||||
|
|
||||||
if ($parentDropdown.hasClass(ClassName.DROPUP)) {
|
if (parentDropdown.classList.contains(ClassName.DROPUP)) {
|
||||||
placement = AttachmentMap.TOP;
|
placement = AttachmentMap.TOP;
|
||||||
|
|
||||||
if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
|
if (this._menu.classList.contains(ClassName.MENURIGHT)) {
|
||||||
placement = AttachmentMap.TOPEND;
|
placement = AttachmentMap.TOPEND;
|
||||||
}
|
}
|
||||||
} else if ($parentDropdown.hasClass(ClassName.DROPRIGHT)) {
|
} else if (parentDropdown.classList.contains(ClassName.DROPRIGHT)) {
|
||||||
placement = AttachmentMap.RIGHT;
|
placement = AttachmentMap.RIGHT;
|
||||||
} else if ($parentDropdown.hasClass(ClassName.DROPLEFT)) {
|
} else if (parentDropdown.classList.contains(ClassName.DROPLEFT)) {
|
||||||
placement = AttachmentMap.LEFT;
|
placement = AttachmentMap.LEFT;
|
||||||
} else if ($(this._menu).hasClass(ClassName.MENURIGHT)) {
|
} else if (this._menu.classList.contains(ClassName.MENURIGHT)) {
|
||||||
placement = AttachmentMap.BOTTOMEND;
|
placement = AttachmentMap.BOTTOMEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +412,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._detectNavbar = function _detectNavbar() {
|
_proto._detectNavbar = function _detectNavbar() {
|
||||||
return $(this._element).closest('.navbar').length > 0;
|
return Boolean(SelectorEngine.closest(this._element, '.navbar'));
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getOffset = function _getOffset() {
|
_proto._getOffset = function _getOffset() {
|
||||||
|
@ -398,24 +457,27 @@
|
||||||
} // Static
|
} // Static
|
||||||
;
|
;
|
||||||
|
|
||||||
Dropdown._jQueryInterface = function _jQueryInterface(config) {
|
Dropdown._dropdownInterface = function _dropdownInterface(element, config) {
|
||||||
return this.each(function () {
|
var data = Data.getData(element, DATA_KEY);
|
||||||
var data = $(this).data(DATA_KEY);
|
|
||||||
|
|
||||||
var _config = typeof config === 'object' ? config : null;
|
var _config = typeof config === 'object' ? config : null;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = new Dropdown(this, _config);
|
data = new Dropdown(element, _config);
|
||||||
$(this).data(DATA_KEY, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
if (typeof data[config] === 'undefined') {
|
if (typeof data[config] === 'undefined') {
|
||||||
throw new TypeError("No method named \"" + config + "\"");
|
throw new Error("No method named \"" + config + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
data[config]();
|
data[config]();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Dropdown._jQueryInterface = function _jQueryInterface(config) {
|
||||||
|
return this.each(function () {
|
||||||
|
Dropdown._dropdownInterface(this, config);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -424,12 +486,12 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var toggles = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
|
var toggles = makeArray(SelectorEngine.find(Selector.DATA_TOGGLE));
|
||||||
|
|
||||||
for (var i = 0, len = toggles.length; i < len; i++) {
|
for (var i = 0, len = toggles.length; i < len; i++) {
|
||||||
var parent = Dropdown._getParentFromElement(toggles[i]);
|
var parent = Dropdown._getParentFromElement(toggles[i]);
|
||||||
|
|
||||||
var context = $(toggles[i]).data(DATA_KEY);
|
var context = Data.getData(toggles[i], DATA_KEY);
|
||||||
var relatedTarget = {
|
var relatedTarget = {
|
||||||
relatedTarget: toggles[i]
|
relatedTarget: toggles[i]
|
||||||
};
|
};
|
||||||
|
@ -444,44 +506,45 @@
|
||||||
|
|
||||||
var dropdownMenu = context._menu;
|
var dropdownMenu = context._menu;
|
||||||
|
|
||||||
if (!$(parent).hasClass(ClassName.SHOW)) {
|
if (!parent.classList.contains(ClassName.SHOW)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
|
if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && parent.contains(event.target)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var hideEvent = $.Event(Event.HIDE, relatedTarget);
|
var hideEvent = EventHandler.trigger(parent, Event.HIDE, relatedTarget);
|
||||||
$(parent).trigger(hideEvent);
|
|
||||||
|
|
||||||
if (hideEvent.isDefaultPrevented()) {
|
if (hideEvent.defaultPrevented) {
|
||||||
continue;
|
continue;
|
||||||
} // If this is a touch-enabled device we remove the extra
|
} // If this is a touch-enabled device we remove the extra
|
||||||
// empty mouseover listeners we added for iOS support
|
// empty mouseover listeners we added for iOS support
|
||||||
|
|
||||||
|
|
||||||
if ('ontouchstart' in document.documentElement) {
|
if ('ontouchstart' in document.documentElement) {
|
||||||
$(document.body).children().off('mouseover', null, $.noop);
|
makeArray(document.body.children).forEach(function (elem) {
|
||||||
|
return EventHandler.off(elem, 'mouseover', null, noop());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
toggles[i].setAttribute('aria-expanded', 'false');
|
toggles[i].setAttribute('aria-expanded', 'false');
|
||||||
$(dropdownMenu).removeClass(ClassName.SHOW);
|
dropdownMenu.classList.remove(ClassName.SHOW);
|
||||||
$(parent).removeClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget));
|
parent.classList.remove(ClassName.SHOW);
|
||||||
|
EventHandler.trigger(parent, Event.HIDDEN, relatedTarget);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Dropdown._getParentFromElement = function _getParentFromElement(element) {
|
Dropdown._getParentFromElement = function _getParentFromElement(element) {
|
||||||
var parent;
|
var parent;
|
||||||
var selector = Util.getSelectorFromElement(element);
|
var selector = getSelectorFromElement(element);
|
||||||
|
|
||||||
if (selector) {
|
if (selector) {
|
||||||
parent = document.querySelector(selector);
|
parent = SelectorEngine.findOne(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent || element.parentNode;
|
return parent || element.parentNode;
|
||||||
} // eslint-disable-next-line complexity
|
};
|
||||||
;
|
|
||||||
|
|
||||||
Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
|
Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
|
||||||
// If not input/textarea:
|
// If not input/textarea:
|
||||||
|
@ -491,34 +554,34 @@
|
||||||
// - If key is other than escape
|
// - If key is other than escape
|
||||||
// - If key is not up or down => not a dropdown command
|
// - If key is not up or down => not a dropdown command
|
||||||
// - If trigger inside the menu => not a dropdown command
|
// - If trigger inside the menu => not a dropdown command
|
||||||
if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
|
if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || SelectorEngine.closest(event.target, Selector.MENU)) : !REGEXP_KEYDOWN.test(event.which)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
|
if (this.disabled || this.classList.contains(ClassName.DISABLED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = Dropdown._getParentFromElement(this);
|
var parent = Dropdown._getParentFromElement(this);
|
||||||
|
|
||||||
var isActive = $(parent).hasClass(ClassName.SHOW);
|
var isActive = parent.classList.contains(ClassName.SHOW);
|
||||||
|
|
||||||
if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
|
if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
|
||||||
if (event.which === ESCAPE_KEYCODE) {
|
if (event.which === ESCAPE_KEYCODE) {
|
||||||
var toggle = parent.querySelector(Selector.DATA_TOGGLE);
|
EventHandler.trigger(SelectorEngine.findOne(Selector.DATA_TOGGLE, parent), 'focus');
|
||||||
$(toggle).trigger('focus');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this).trigger('click');
|
Dropdown._clearMenus();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS));
|
var items = makeArray(SelectorEngine.find(Selector.VISIBLE_ITEMS, parent));
|
||||||
|
|
||||||
if (items.length === 0) {
|
if (!items.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,6 +604,10 @@
|
||||||
items[index].focus();
|
items[index].focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Dropdown._getInstance = function _getInstance(element) {
|
||||||
|
return Data.getData(element, DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(Dropdown, null, [{
|
_createClass(Dropdown, null, [{
|
||||||
key: "VERSION",
|
key: "VERSION",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -567,27 +634,36 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API + " " + Event.KEYUP_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
EventHandler.on(document, Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler);
|
||||||
|
EventHandler.on(document, Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler);
|
||||||
|
EventHandler.on(document, Event.CLICK_DATA_API, Dropdown._clearMenus);
|
||||||
|
EventHandler.on(document, Event.KEYUP_DATA_API, Dropdown._clearMenus);
|
||||||
|
EventHandler.on(document, Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
Dropdown._jQueryInterface.call($(this), 'toggle');
|
Dropdown._dropdownInterface(this, 'toggle');
|
||||||
}).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
|
});
|
||||||
e.stopPropagation();
|
EventHandler.on(document, Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
|
||||||
|
return e.stopPropagation();
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .dropdown to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$.fn[NAME] = Dropdown._jQueryInterface;
|
if (typeof jQuery !== 'undefined') {
|
||||||
$.fn[NAME].Constructor = Dropdown;
|
var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
|
||||||
|
jQuery.fn[NAME] = Dropdown._jQueryInterface;
|
||||||
|
jQuery.fn[NAME].Constructor = Dropdown;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
jQuery.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Dropdown._jQueryInterface;
|
return Dropdown._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Dropdown;
|
return Dropdown;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,23 +0,0 @@
|
||||||
/**
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
* Bootstrap (v4.3.1): index.js
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
(function ($) {
|
|
||||||
if (typeof $ === 'undefined') {
|
|
||||||
throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
|
|
||||||
}
|
|
||||||
|
|
||||||
var version = $.fn.jquery.split(' ')[0].split('.');
|
|
||||||
var minMajor = 1;
|
|
||||||
var ltMajor = 2;
|
|
||||||
var minMinor = 9;
|
|
||||||
var minPatch = 1;
|
|
||||||
var maxMajor = 4;
|
|
||||||
|
|
||||||
if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
|
|
||||||
throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
|
|
||||||
}
|
|
||||||
})($);
|
|
||||||
//# sourceMappingURL=index.js.map
|
|
|
@ -1 +0,0 @@
|
||||||
{"version":3,"sources":["../src/index.js"],"names":["$","TypeError","version","fn","jquery","split","minMajor","ltMajor","minMinor","minPatch","maxMajor","Error"],"mappings":"AAaA;;;;;;AAOA,CAAC,UAACA,CAAD,EAAO;AACN,MAAI,OAAOA,CAAP,KAAa,WAAjB,EAA8B;AAC5B,UAAM,IAAIC,SAAJ,CAAc,kGAAd,CAAN;AACD;;AAED,MAAMC,UAAUF,EAAEG,EAAF,CAAKC,MAAL,CAAYC,KAAZ,CAAkB,GAAlB,EAAuB,CAAvB,EAA0BA,KAA1B,CAAgC,GAAhC,CAAhB;AACA,MAAMC,WAAW,CAAjB;AACA,MAAMC,UAAU,CAAhB;AACA,MAAMC,WAAW,CAAjB;AACA,MAAMC,WAAW,CAAjB;AACA,MAAMC,WAAW,CAAjB;;AAEA,MAAIR,QAAQ,CAAR,IAAaK,OAAb,IAAwBL,QAAQ,CAAR,IAAaM,QAArC,IAAiDN,QAAQ,CAAR,MAAeI,QAAf,IAA2BJ,QAAQ,CAAR,MAAeM,QAA1C,IAAsDN,QAAQ,CAAR,IAAaO,QAApH,IAAgIP,QAAQ,CAAR,KAAcQ,QAAlJ,EAA4J;AAC1J,UAAM,IAAIC,KAAJ,CAAU,8EAAV,CAAN;AACD;AACF,CAfD,EAeGX,CAfH","sourcesContent":["import $ from 'jquery'\nimport Alert from './alert'\nimport Button from './button'\nimport Carousel from './carousel'\nimport Collapse from './collapse'\nimport Dropdown from './dropdown'\nimport Modal from './modal'\nimport Popover from './popover'\nimport Scrollspy from './scrollspy'\nimport Tab from './tab'\nimport Tooltip from './tooltip'\nimport Util from './util'\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.1.2): index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n(($) => {\n if (typeof $ === 'undefined') {\n throw new TypeError('Bootstrap\\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\\'s JavaScript.')\n }\n\n const version = $.fn.jquery.split(' ')[0].split('.')\n const minMajor = 1\n const ltMajor = 2\n const minMinor = 9\n const minPatch = 1\n const maxMajor = 4\n\n if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {\n throw new Error('Bootstrap\\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0')\n }\n})($)\n\nexport {\n Util,\n Alert,\n Button,\n Carousel,\n Collapse,\n Dropdown,\n Modal,\n Popover,\n Scrollspy,\n Tab,\n Tooltip\n}\n"],"file":"index.js"}
|
|
|
@ -4,13 +4,15 @@
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/eventHandler.js'), require('./dom/manipulator.js'), require('./dom/selectorEngine.js')) :
|
||||||
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
|
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/eventHandler.js', './dom/manipulator.js', './dom/selectorEngine.js'], factory) :
|
||||||
(global = global || self, global.Modal = factory(global.jQuery, global.Util));
|
(global = global || self, global.Modal = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
|
||||||
}(this, function ($, Util) { 'use strict';
|
}(this, function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
|
||||||
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
|
EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
|
||||||
|
Manipulator = Manipulator && Manipulator.hasOwnProperty('default') ? Manipulator['default'] : Manipulator;
|
||||||
|
SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -62,6 +64,120 @@
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var MILLISECONDS_MULTIPLIER = 1000;
|
||||||
|
var TRANSITION_END = 'transitionend';
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
|
var toType = function toType(obj) {
|
||||||
|
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
||||||
|
};
|
||||||
|
|
||||||
|
var getSelectorFromElement = function getSelectorFromElement(element) {
|
||||||
|
var selector = element.getAttribute('data-target');
|
||||||
|
|
||||||
|
if (!selector || selector === '#') {
|
||||||
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return document.querySelector(selector) ? selector : null;
|
||||||
|
} catch (err) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
||||||
|
if (!element) {
|
||||||
|
return 0;
|
||||||
|
} // Get transition-duration of the element
|
||||||
|
|
||||||
|
|
||||||
|
var _window$getComputedSt = window.getComputedStyle(element),
|
||||||
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
|
var floatTransitionDuration = parseFloat(transitionDuration);
|
||||||
|
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
|
return 0;
|
||||||
|
} // If multiple durations are defined, take the first
|
||||||
|
|
||||||
|
|
||||||
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
|
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
||||||
|
};
|
||||||
|
|
||||||
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
element.dispatchEvent(new Event(TRANSITION_END));
|
||||||
|
};
|
||||||
|
|
||||||
|
var isElement = function isElement(obj) {
|
||||||
|
return (obj[0] || obj).nodeType;
|
||||||
|
};
|
||||||
|
|
||||||
|
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
||||||
|
var called = false;
|
||||||
|
var durationPadding = 5;
|
||||||
|
var emulatedDuration = duration + durationPadding;
|
||||||
|
|
||||||
|
function listener() {
|
||||||
|
called = true;
|
||||||
|
element.removeEventListener(TRANSITION_END, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.addEventListener(TRANSITION_END, listener);
|
||||||
|
setTimeout(function () {
|
||||||
|
if (!called) {
|
||||||
|
triggerTransitionEnd(element);
|
||||||
|
}
|
||||||
|
}, emulatedDuration);
|
||||||
|
};
|
||||||
|
|
||||||
|
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
||||||
|
Object.keys(configTypes).forEach(function (property) {
|
||||||
|
var expectedTypes = configTypes[property];
|
||||||
|
var value = config[property];
|
||||||
|
var valueType = value && isElement(value) ? 'element' : toType(value);
|
||||||
|
|
||||||
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||||
|
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var makeArray = function makeArray(nodeList) {
|
||||||
|
if (!nodeList) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [].slice.call(nodeList);
|
||||||
|
};
|
||||||
|
|
||||||
|
var isVisible = function isVisible(element) {
|
||||||
|
if (!element) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element.style && element.parentNode && element.parentNode.style) {
|
||||||
|
return element.style.display !== 'none' && element.parentNode.style.display !== 'none' && element.style.visibility !== 'hidden';
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
var reflow = function reflow(element) {
|
||||||
|
return element.offsetHeight;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -73,7 +189,6 @@
|
||||||
var DATA_KEY = 'bs.modal';
|
var DATA_KEY = 'bs.modal';
|
||||||
var EVENT_KEY = "." + DATA_KEY;
|
var EVENT_KEY = "." + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
||||||
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
|
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
|
||||||
|
|
||||||
var Default = {
|
var Default = {
|
||||||
|
@ -88,7 +203,7 @@
|
||||||
focus: 'boolean',
|
focus: 'boolean',
|
||||||
show: 'boolean'
|
show: 'boolean'
|
||||||
};
|
};
|
||||||
var Event = {
|
var Event$1 = {
|
||||||
HIDE: "hide" + EVENT_KEY,
|
HIDE: "hide" + EVENT_KEY,
|
||||||
HIDDEN: "hidden" + EVENT_KEY,
|
HIDDEN: "hidden" + EVENT_KEY,
|
||||||
SHOW: "show" + EVENT_KEY,
|
SHOW: "show" + EVENT_KEY,
|
||||||
|
@ -130,13 +245,14 @@
|
||||||
function Modal(element, config) {
|
function Modal(element, config) {
|
||||||
this._config = this._getConfig(config);
|
this._config = this._getConfig(config);
|
||||||
this._element = element;
|
this._element = element;
|
||||||
this._dialog = element.querySelector(Selector.DIALOG);
|
this._dialog = SelectorEngine.findOne(Selector.DIALOG, element);
|
||||||
this._backdrop = null;
|
this._backdrop = null;
|
||||||
this._isShown = false;
|
this._isShown = false;
|
||||||
this._isBodyOverflowing = false;
|
this._isBodyOverflowing = false;
|
||||||
this._ignoreBackdropClick = false;
|
this._ignoreBackdropClick = false;
|
||||||
this._isTransitioning = false;
|
this._isTransitioning = false;
|
||||||
this._scrollbarWidth = 0;
|
this._scrollbarWidth = 0;
|
||||||
|
Data.setData(element, DATA_KEY, this);
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,16 +270,15 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(this._element).hasClass(ClassName.FADE)) {
|
if (this._element.classList.contains(ClassName.FADE)) {
|
||||||
this._isTransitioning = true;
|
this._isTransitioning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var showEvent = $.Event(Event.SHOW, {
|
var showEvent = EventHandler.trigger(this._element, Event$1.SHOW, {
|
||||||
relatedTarget: relatedTarget
|
relatedTarget: relatedTarget
|
||||||
});
|
});
|
||||||
$(this._element).trigger(showEvent);
|
|
||||||
|
|
||||||
if (this._isShown || showEvent.isDefaultPrevented()) {
|
if (this._isShown || showEvent.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,12 +294,12 @@
|
||||||
|
|
||||||
this._setResizeEvent();
|
this._setResizeEvent();
|
||||||
|
|
||||||
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
|
EventHandler.on(this._element, Event$1.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
|
||||||
return _this.hide(event);
|
return _this.hide(event);
|
||||||
});
|
});
|
||||||
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
|
EventHandler.on(this._dialog, Event$1.MOUSEDOWN_DISMISS, function () {
|
||||||
$(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
|
EventHandler.one(_this._element, Event$1.MOUSEUP_DISMISS, function (event) {
|
||||||
if ($(event.target).is(_this._element)) {
|
if (event.target === _this._element) {
|
||||||
_this._ignoreBackdropClick = true;
|
_this._ignoreBackdropClick = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -206,15 +321,15 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var hideEvent = $.Event(Event.HIDE);
|
var hideEvent = EventHandler.trigger(this._element, Event$1.HIDE);
|
||||||
$(this._element).trigger(hideEvent);
|
|
||||||
|
|
||||||
if (!this._isShown || hideEvent.isDefaultPrevented()) {
|
if (!this._isShown || hideEvent.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._isShown = false;
|
this._isShown = false;
|
||||||
var transition = $(this._element).hasClass(ClassName.FADE);
|
|
||||||
|
var transition = this._element.classList.contains(ClassName.FADE);
|
||||||
|
|
||||||
if (transition) {
|
if (transition) {
|
||||||
this._isTransitioning = true;
|
this._isTransitioning = true;
|
||||||
|
@ -224,16 +339,19 @@
|
||||||
|
|
||||||
this._setResizeEvent();
|
this._setResizeEvent();
|
||||||
|
|
||||||
$(document).off(Event.FOCUSIN);
|
EventHandler.off(document, Event$1.FOCUSIN);
|
||||||
$(this._element).removeClass(ClassName.SHOW);
|
|
||||||
$(this._element).off(Event.CLICK_DISMISS);
|
this._element.classList.remove(ClassName.SHOW);
|
||||||
$(this._dialog).off(Event.MOUSEDOWN_DISMISS);
|
|
||||||
|
EventHandler.off(this._element, Event$1.CLICK_DISMISS);
|
||||||
|
EventHandler.off(this._dialog, Event$1.MOUSEDOWN_DISMISS);
|
||||||
|
|
||||||
if (transition) {
|
if (transition) {
|
||||||
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
var transitionDuration = getTransitionDurationFromElement(this._element);
|
||||||
$(this._element).one(Util.TRANSITION_END, function (event) {
|
EventHandler.one(this._element, TRANSITION_END, function (event) {
|
||||||
return _this2._hideModal(event);
|
return _this2._hideModal(event);
|
||||||
}).emulateTransitionEnd(transitionDuration);
|
});
|
||||||
|
emulateTransitionEnd(this._element, transitionDuration);
|
||||||
} else {
|
} else {
|
||||||
this._hideModal();
|
this._hideModal();
|
||||||
}
|
}
|
||||||
|
@ -241,7 +359,7 @@
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
[window, this._element, this._dialog].forEach(function (htmlElement) {
|
[window, this._element, this._dialog].forEach(function (htmlElement) {
|
||||||
return $(htmlElement).off(EVENT_KEY);
|
return EventHandler.off(htmlElement, EVENT_KEY);
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
|
* `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
|
||||||
|
@ -249,8 +367,8 @@
|
||||||
* It will remove `Event.CLICK_DATA_API` event that should remain
|
* It will remove `Event.CLICK_DATA_API` event that should remain
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).off(Event.FOCUSIN);
|
EventHandler.off(document, Event$1.FOCUSIN);
|
||||||
$.removeData(this._element, DATA_KEY);
|
Data.removeData(this._element, DATA_KEY);
|
||||||
this._config = null;
|
this._config = null;
|
||||||
this._element = null;
|
this._element = null;
|
||||||
this._dialog = null;
|
this._dialog = null;
|
||||||
|
@ -269,14 +387,14 @@
|
||||||
|
|
||||||
_proto._getConfig = function _getConfig(config) {
|
_proto._getConfig = function _getConfig(config) {
|
||||||
config = _objectSpread({}, Default, config);
|
config = _objectSpread({}, Default, config);
|
||||||
Util.typeCheckConfig(NAME, config, DefaultType);
|
typeCheckConfig(NAME, config, DefaultType);
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._showElement = function _showElement(relatedTarget) {
|
_proto._showElement = function _showElement(relatedTarget) {
|
||||||
var _this3 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
var transition = $(this._element).hasClass(ClassName.FADE);
|
var transition = this._element.classList.contains(ClassName.FADE);
|
||||||
|
|
||||||
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
||||||
// Don't move modal's DOM position
|
// Don't move modal's DOM position
|
||||||
|
@ -289,38 +407,37 @@
|
||||||
|
|
||||||
this._element.setAttribute('aria-modal', true);
|
this._element.setAttribute('aria-modal', true);
|
||||||
|
|
||||||
if ($(this._dialog).hasClass(ClassName.SCROLLABLE)) {
|
if (this._dialog.classList.contains(ClassName.SCROLLABLE)) {
|
||||||
this._dialog.querySelector(Selector.MODAL_BODY).scrollTop = 0;
|
SelectorEngine.findOne(Selector.MODAL_BODY, this._dialog).scrollTop = 0;
|
||||||
} else {
|
} else {
|
||||||
this._element.scrollTop = 0;
|
this._element.scrollTop = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transition) {
|
if (transition) {
|
||||||
Util.reflow(this._element);
|
reflow(this._element);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this._element).addClass(ClassName.SHOW);
|
this._element.classList.add(ClassName.SHOW);
|
||||||
|
|
||||||
if (this._config.focus) {
|
if (this._config.focus) {
|
||||||
this._enforceFocus();
|
this._enforceFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
var shownEvent = $.Event(Event.SHOWN, {
|
|
||||||
relatedTarget: relatedTarget
|
|
||||||
});
|
|
||||||
|
|
||||||
var transitionComplete = function transitionComplete() {
|
var transitionComplete = function transitionComplete() {
|
||||||
if (_this3._config.focus) {
|
if (_this3._config.focus) {
|
||||||
_this3._element.focus();
|
_this3._element.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
_this3._isTransitioning = false;
|
_this3._isTransitioning = false;
|
||||||
$(_this3._element).trigger(shownEvent);
|
EventHandler.trigger(_this3._element, Event$1.SHOWN, {
|
||||||
|
relatedTarget: relatedTarget
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (transition) {
|
if (transition) {
|
||||||
var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
|
var transitionDuration = getTransitionDurationFromElement(this._dialog);
|
||||||
$(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
|
EventHandler.one(this._dialog, TRANSITION_END, transitionComplete);
|
||||||
|
emulateTransitionEnd(this._dialog, transitionDuration);
|
||||||
} else {
|
} else {
|
||||||
transitionComplete();
|
transitionComplete();
|
||||||
}
|
}
|
||||||
|
@ -329,9 +446,10 @@
|
||||||
_proto._enforceFocus = function _enforceFocus() {
|
_proto._enforceFocus = function _enforceFocus() {
|
||||||
var _this4 = this;
|
var _this4 = this;
|
||||||
|
|
||||||
$(document).off(Event.FOCUSIN) // Guard against infinite focus loop
|
EventHandler.off(document, Event$1.FOCUSIN); // guard against infinite focus loop
|
||||||
.on(Event.FOCUSIN, function (event) {
|
|
||||||
if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) {
|
EventHandler.on(document, Event$1.FOCUSIN, function (event) {
|
||||||
|
if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) {
|
||||||
_this4._element.focus();
|
_this4._element.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -341,7 +459,7 @@
|
||||||
var _this5 = this;
|
var _this5 = this;
|
||||||
|
|
||||||
if (this._isShown && this._config.keyboard) {
|
if (this._isShown && this._config.keyboard) {
|
||||||
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
|
EventHandler.on(this._element, Event$1.KEYDOWN_DISMISS, function (event) {
|
||||||
if (event.which === ESCAPE_KEYCODE) {
|
if (event.which === ESCAPE_KEYCODE) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
@ -349,7 +467,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (!this._isShown) {
|
} else if (!this._isShown) {
|
||||||
$(this._element).off(Event.KEYDOWN_DISMISS);
|
EventHandler.off(this._element, Event$1.KEYDOWN_DISMISS);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -357,11 +475,11 @@
|
||||||
var _this6 = this;
|
var _this6 = this;
|
||||||
|
|
||||||
if (this._isShown) {
|
if (this._isShown) {
|
||||||
$(window).on(Event.RESIZE, function (event) {
|
EventHandler.on(window, Event$1.RESIZE, function (event) {
|
||||||
return _this6.handleUpdate(event);
|
return _this6.handleUpdate(event);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$(window).off(Event.RESIZE);
|
EventHandler.off(window, Event$1.RESIZE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -377,19 +495,20 @@
|
||||||
this._isTransitioning = false;
|
this._isTransitioning = false;
|
||||||
|
|
||||||
this._showBackdrop(function () {
|
this._showBackdrop(function () {
|
||||||
$(document.body).removeClass(ClassName.OPEN);
|
document.body.classList.remove(ClassName.OPEN);
|
||||||
|
|
||||||
_this7._resetAdjustments();
|
_this7._resetAdjustments();
|
||||||
|
|
||||||
_this7._resetScrollbar();
|
_this7._resetScrollbar();
|
||||||
|
|
||||||
$(_this7._element).trigger(Event.HIDDEN);
|
EventHandler.trigger(_this7._element, Event$1.HIDDEN);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._removeBackdrop = function _removeBackdrop() {
|
_proto._removeBackdrop = function _removeBackdrop() {
|
||||||
if (this._backdrop) {
|
if (this._backdrop) {
|
||||||
$(this._backdrop).remove();
|
this._backdrop.parentNode.removeChild(this._backdrop);
|
||||||
|
|
||||||
this._backdrop = null;
|
this._backdrop = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -397,7 +516,7 @@
|
||||||
_proto._showBackdrop = function _showBackdrop(callback) {
|
_proto._showBackdrop = function _showBackdrop(callback) {
|
||||||
var _this8 = this;
|
var _this8 = this;
|
||||||
|
|
||||||
var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
|
var animate = this._element.classList.contains(ClassName.FADE) ? ClassName.FADE : '';
|
||||||
|
|
||||||
if (this._isShown && this._config.backdrop) {
|
if (this._isShown && this._config.backdrop) {
|
||||||
this._backdrop = document.createElement('div');
|
this._backdrop = document.createElement('div');
|
||||||
|
@ -407,8 +526,8 @@
|
||||||
this._backdrop.classList.add(animate);
|
this._backdrop.classList.add(animate);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this._backdrop).appendTo(document.body);
|
document.body.appendChild(this._backdrop);
|
||||||
$(this._element).on(Event.CLICK_DISMISS, function (event) {
|
EventHandler.on(this._element, Event$1.CLICK_DISMISS, function (event) {
|
||||||
if (_this8._ignoreBackdropClick) {
|
if (_this8._ignoreBackdropClick) {
|
||||||
_this8._ignoreBackdropClick = false;
|
_this8._ignoreBackdropClick = false;
|
||||||
return;
|
return;
|
||||||
|
@ -426,10 +545,10 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
if (animate) {
|
if (animate) {
|
||||||
Util.reflow(this._backdrop);
|
reflow(this._backdrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this._backdrop).addClass(ClassName.SHOW);
|
this._backdrop.classList.add(ClassName.SHOW);
|
||||||
|
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
return;
|
return;
|
||||||
|
@ -440,10 +559,11 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
|
var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
|
||||||
$(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
|
EventHandler.one(this._backdrop, TRANSITION_END, callback);
|
||||||
|
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
|
||||||
} else if (!this._isShown && this._backdrop) {
|
} else if (!this._isShown && this._backdrop) {
|
||||||
$(this._backdrop).removeClass(ClassName.SHOW);
|
this._backdrop.classList.remove(ClassName.SHOW);
|
||||||
|
|
||||||
var callbackRemove = function callbackRemove() {
|
var callbackRemove = function callbackRemove() {
|
||||||
_this8._removeBackdrop();
|
_this8._removeBackdrop();
|
||||||
|
@ -453,10 +573,11 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($(this._element).hasClass(ClassName.FADE)) {
|
if (this._element.classList.contains(ClassName.FADE)) {
|
||||||
var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
|
var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
|
||||||
|
|
||||||
$(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
|
EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove);
|
||||||
|
emulateTransitionEnd(this._backdrop, _backdropTransitionDuration);
|
||||||
} else {
|
} else {
|
||||||
callbackRemove();
|
callbackRemove();
|
||||||
}
|
}
|
||||||
|
@ -498,50 +619,58 @@
|
||||||
if (this._isBodyOverflowing) {
|
if (this._isBodyOverflowing) {
|
||||||
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
|
// 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
|
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
|
||||||
var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
|
// Adjust fixed content padding
|
||||||
var stickyContent = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT)); // Adjust fixed content padding
|
makeArray(SelectorEngine.find(Selector.FIXED_CONTENT)).forEach(function (element) {
|
||||||
|
|
||||||
$(fixedContent).each(function (index, element) {
|
|
||||||
var actualPadding = element.style.paddingRight;
|
var actualPadding = element.style.paddingRight;
|
||||||
var calculatedPadding = $(element).css('padding-right');
|
var calculatedPadding = window.getComputedStyle(element)['padding-right'];
|
||||||
$(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
|
Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
|
||||||
|
element.style.paddingRight = parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px";
|
||||||
}); // Adjust sticky content margin
|
}); // Adjust sticky content margin
|
||||||
|
|
||||||
$(stickyContent).each(function (index, element) {
|
makeArray(SelectorEngine.find(Selector.STICKY_CONTENT)).forEach(function (element) {
|
||||||
var actualMargin = element.style.marginRight;
|
var actualMargin = element.style.marginRight;
|
||||||
var calculatedMargin = $(element).css('margin-right');
|
var calculatedMargin = window.getComputedStyle(element)['margin-right'];
|
||||||
$(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
|
Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
|
||||||
|
element.style.marginRight = parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px";
|
||||||
}); // Adjust body padding
|
}); // Adjust body padding
|
||||||
|
|
||||||
var actualPadding = document.body.style.paddingRight;
|
var actualPadding = document.body.style.paddingRight;
|
||||||
var calculatedPadding = $(document.body).css('padding-right');
|
var calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
|
||||||
$(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
|
Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
|
||||||
|
document.body.style.paddingRight = parseFloat(calculatedPadding) + this._scrollbarWidth + "px";
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document.body).addClass(ClassName.OPEN);
|
document.body.classList.add(ClassName.OPEN);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._resetScrollbar = function _resetScrollbar() {
|
_proto._resetScrollbar = function _resetScrollbar() {
|
||||||
// Restore fixed content padding
|
// Restore fixed content padding
|
||||||
var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT));
|
makeArray(SelectorEngine.find(Selector.FIXED_CONTENT)).forEach(function (element) {
|
||||||
$(fixedContent).each(function (index, element) {
|
var padding = Manipulator.getDataAttribute(element, 'padding-right');
|
||||||
var padding = $(element).data('padding-right');
|
|
||||||
$(element).removeData('padding-right');
|
|
||||||
element.style.paddingRight = padding ? padding : '';
|
|
||||||
}); // Restore sticky content
|
|
||||||
|
|
||||||
var elements = [].slice.call(document.querySelectorAll("" + Selector.STICKY_CONTENT));
|
if (typeof padding !== 'undefined') {
|
||||||
$(elements).each(function (index, element) {
|
Manipulator.removeDataAttribute(element, 'padding-right');
|
||||||
var margin = $(element).data('margin-right');
|
element.style.paddingRight = padding;
|
||||||
|
}
|
||||||
|
}); // Restore sticky content and navbar-toggler margin
|
||||||
|
|
||||||
|
makeArray(SelectorEngine.find("" + Selector.STICKY_CONTENT)).forEach(function (element) {
|
||||||
|
var margin = Manipulator.getDataAttribute(element, 'margin-right');
|
||||||
|
|
||||||
if (typeof margin !== 'undefined') {
|
if (typeof margin !== 'undefined') {
|
||||||
$(element).css('margin-right', margin).removeData('margin-right');
|
Manipulator.removeDataAttribute(element, 'margin-right');
|
||||||
|
element.style.marginRight = margin;
|
||||||
}
|
}
|
||||||
}); // Restore body padding
|
}); // Restore body padding
|
||||||
|
|
||||||
var padding = $(document.body).data('padding-right');
|
var padding = Manipulator.getDataAttribute(document.body, 'padding-right');
|
||||||
$(document.body).removeData('padding-right');
|
|
||||||
document.body.style.paddingRight = padding ? padding : '';
|
if (typeof padding !== 'undefined') {
|
||||||
|
Manipulator.removeDataAttribute(document.body, 'padding-right');
|
||||||
|
document.body.style.paddingRight = padding;
|
||||||
|
} else {
|
||||||
|
document.body.style.paddingRight = '';
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getScrollbarWidth = function _getScrollbarWidth() {
|
_proto._getScrollbarWidth = function _getScrollbarWidth() {
|
||||||
|
@ -557,13 +686,12 @@
|
||||||
|
|
||||||
Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
|
Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var data = $(this).data(DATA_KEY);
|
var data = Data.getData(this, DATA_KEY);
|
||||||
|
|
||||||
var _config = _objectSpread({}, Default, $(this).data(), typeof config === 'object' && config ? config : {});
|
var _config = _objectSpread({}, Default, Manipulator.getDataAttributes(this), typeof config === 'object' && config ? config : {});
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = new Modal(this, _config);
|
data = new Modal(this, _config);
|
||||||
$(this).data(DATA_KEY, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
|
@ -578,6 +706,10 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Modal._getInstance = function _getInstance(element) {
|
||||||
|
return Data.getData(element, DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(Modal, null, [{
|
_createClass(Modal, null, [{
|
||||||
key: "VERSION",
|
key: "VERSION",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -599,36 +731,41 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
var _this10 = this;
|
var _this10 = this;
|
||||||
|
|
||||||
var target;
|
var target;
|
||||||
var selector = Util.getSelectorFromElement(this);
|
var selector = getSelectorFromElement(this);
|
||||||
|
|
||||||
if (selector) {
|
if (selector) {
|
||||||
target = document.querySelector(selector);
|
target = SelectorEngine.findOne(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = $(target).data(DATA_KEY) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data());
|
var config = Data.getData(target, DATA_KEY) ? 'toggle' : _objectSpread({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this));
|
||||||
|
|
||||||
if (this.tagName === 'A' || this.tagName === 'AREA') {
|
if (this.tagName === 'A' || this.tagName === 'AREA') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
var $target = $(target).one(Event.SHOW, function (showEvent) {
|
EventHandler.one(target, Event$1.SHOW, function (showEvent) {
|
||||||
if (showEvent.isDefaultPrevented()) {
|
if (showEvent.defaultPrevented) {
|
||||||
// Only register focus restorer if modal will actually get shown
|
// only register focus restorer if modal will actually get shown
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$target.one(Event.HIDDEN, function () {
|
EventHandler.one(target, Event$1.HIDDEN, function () {
|
||||||
if ($(_this10).is(':visible')) {
|
if (isVisible(_this10)) {
|
||||||
_this10.focus();
|
_this10.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
var data = Data.getData(target, DATA_KEY);
|
||||||
|
|
||||||
Modal._jQueryInterface.call($(target), config, this);
|
if (!data) {
|
||||||
|
data = new Modal(target, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.show(this);
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -636,13 +773,16 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$.fn[NAME] = Modal._jQueryInterface;
|
if (typeof jQuery !== 'undefined') {
|
||||||
$.fn[NAME].Constructor = Modal;
|
var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
|
||||||
|
jQuery.fn[NAME] = Modal._jQueryInterface;
|
||||||
|
jQuery.fn[NAME].Constructor = Modal;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
jQuery.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Modal._jQueryInterface;
|
return Modal._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Modal;
|
return Modal;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,12 +4,13 @@
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./tooltip.js')) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/selectorEngine.js'), require('./tooltip.js')) :
|
||||||
typeof define === 'function' && define.amd ? define(['jquery', './tooltip.js'], factory) :
|
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/selectorEngine.js', './tooltip.js'], factory) :
|
||||||
(global = global || self, global.Popover = factory(global.jQuery, global.Tooltip));
|
(global = global || self, global.Popover = factory(global.Data, global.SelectorEngine, global.Tooltip));
|
||||||
}(this, function ($, Tooltip) { 'use strict';
|
}(this, function (Data, SelectorEngine, Tooltip) { 'use strict';
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
|
||||||
|
SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
|
||||||
Tooltip = Tooltip && Tooltip.hasOwnProperty('default') ? Tooltip['default'] : Tooltip;
|
Tooltip = Tooltip && Tooltip.hasOwnProperty('default') ? Tooltip['default'] : Tooltip;
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
|
@ -68,6 +69,14 @@
|
||||||
subClass.__proto__ = superClass;
|
subClass.__proto__ = superClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -78,7 +87,6 @@
|
||||||
var VERSION = '4.3.1';
|
var VERSION = '4.3.1';
|
||||||
var DATA_KEY = 'bs.popover';
|
var DATA_KEY = 'bs.popover';
|
||||||
var EVENT_KEY = "." + DATA_KEY;
|
var EVENT_KEY = "." + DATA_KEY;
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
||||||
var CLASS_PREFIX = 'bs-popover';
|
var CLASS_PREFIX = 'bs-popover';
|
||||||
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
|
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
|
||||||
|
|
||||||
|
@ -86,7 +94,7 @@
|
||||||
placement: 'right',
|
placement: 'right',
|
||||||
trigger: 'click',
|
trigger: 'click',
|
||||||
content: '',
|
content: '',
|
||||||
template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
|
template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
|
||||||
});
|
});
|
||||||
|
|
||||||
var DefaultType = _objectSpread({}, Tooltip.DefaultType, {
|
var DefaultType = _objectSpread({}, Tooltip.DefaultType, {
|
||||||
|
@ -137,18 +145,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.addAttachmentClass = function addAttachmentClass(attachment) {
|
_proto.addAttachmentClass = function addAttachmentClass(attachment) {
|
||||||
$(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
|
this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
|
||||||
};
|
|
||||||
|
|
||||||
_proto.getTipElement = function getTipElement() {
|
|
||||||
this.tip = this.tip || $(this.config.template)[0];
|
|
||||||
return this.tip;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.setContent = function setContent() {
|
_proto.setContent = function setContent() {
|
||||||
var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
|
var tip = this.getTipElement(); // we use append for html objects to maintain js events
|
||||||
|
|
||||||
this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
|
this.setElementContent(SelectorEngine.findOne(Selector.TITLE, tip), this.getTitle());
|
||||||
|
|
||||||
var content = this._getContent();
|
var content = this._getContent();
|
||||||
|
|
||||||
|
@ -156,8 +159,9 @@
|
||||||
content = content.call(this.element);
|
content = content.call(this.element);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setElementContent($tip.find(Selector.CONTENT), content);
|
this.setElementContent(SelectorEngine.findOne(Selector.CONTENT, tip), content);
|
||||||
$tip.removeClass(ClassName.FADE + " " + ClassName.SHOW);
|
tip.classList.remove(ClassName.FADE);
|
||||||
|
tip.classList.remove(ClassName.SHOW);
|
||||||
} // Private
|
} // Private
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -166,18 +170,22 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._cleanTipClass = function _cleanTipClass() {
|
_proto._cleanTipClass = function _cleanTipClass() {
|
||||||
var $tip = $(this.getTipElement());
|
var tip = this.getTipElement();
|
||||||
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
|
var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
||||||
|
|
||||||
if (tabClass !== null && tabClass.length > 0) {
|
if (tabClass !== null && tabClass.length > 0) {
|
||||||
$tip.removeClass(tabClass.join(''));
|
tabClass.map(function (token) {
|
||||||
|
return token.trim();
|
||||||
|
}).forEach(function (tClass) {
|
||||||
|
return tip.classList.remove(tClass);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} // Static
|
} // Static
|
||||||
;
|
;
|
||||||
|
|
||||||
Popover._jQueryInterface = function _jQueryInterface(config) {
|
Popover._jQueryInterface = function _jQueryInterface(config) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var data = $(this).data(DATA_KEY);
|
var data = Data.getData(this, DATA_KEY);
|
||||||
|
|
||||||
var _config = typeof config === 'object' ? config : null;
|
var _config = typeof config === 'object' ? config : null;
|
||||||
|
|
||||||
|
@ -187,7 +195,7 @@
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = new Popover(this, _config);
|
data = new Popover(this, _config);
|
||||||
$(this).data(DATA_KEY, data);
|
Data.setData(this, DATA_KEY, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
|
@ -200,6 +208,10 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Popover._getInstance = function _getInstance(element) {
|
||||||
|
return Data.getData(element, DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(Popover, null, [{
|
_createClass(Popover, null, [{
|
||||||
key: "VERSION",
|
key: "VERSION",
|
||||||
// Getters
|
// Getters
|
||||||
|
@ -247,13 +259,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$.fn[NAME] = Popover._jQueryInterface;
|
if (typeof jQuery !== 'undefined') {
|
||||||
$.fn[NAME].Constructor = Popover;
|
var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
|
||||||
|
jQuery.fn[NAME] = Popover._jQueryInterface;
|
||||||
|
jQuery.fn[NAME].Constructor = Popover;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
jQuery.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Popover._jQueryInterface;
|
return Popover._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Popover;
|
return Popover;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,13 +4,15 @@
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/eventHandler.js'), require('./dom/manipulator.js'), require('./dom/selectorEngine.js')) :
|
||||||
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
|
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/eventHandler.js', './dom/manipulator.js', './dom/selectorEngine.js'], factory) :
|
||||||
(global = global || self, global.ScrollSpy = factory(global.jQuery, global.Util));
|
(global = global || self, global.ScrollSpy = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
|
||||||
}(this, function ($, Util) { 'use strict';
|
}(this, function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
|
||||||
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
|
EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
|
||||||
|
Manipulator = Manipulator && Manipulator.hasOwnProperty('default') ? Manipulator['default'] : Manipulator;
|
||||||
|
SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -62,6 +64,73 @@
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var MAX_UID = 1000000;
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
|
var toType = function toType(obj) {
|
||||||
|
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Public Util Api
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var getUID = function getUID(prefix) {
|
||||||
|
do {
|
||||||
|
// eslint-disable-next-line no-bitwise
|
||||||
|
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
|
||||||
|
} while (document.getElementById(prefix));
|
||||||
|
|
||||||
|
return prefix;
|
||||||
|
};
|
||||||
|
|
||||||
|
var getSelectorFromElement = function getSelectorFromElement(element) {
|
||||||
|
var selector = element.getAttribute('data-target');
|
||||||
|
|
||||||
|
if (!selector || selector === '#') {
|
||||||
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return document.querySelector(selector) ? selector : null;
|
||||||
|
} catch (err) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var isElement = function isElement(obj) {
|
||||||
|
return (obj[0] || obj).nodeType;
|
||||||
|
};
|
||||||
|
|
||||||
|
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
||||||
|
Object.keys(configTypes).forEach(function (property) {
|
||||||
|
var expectedTypes = configTypes[property];
|
||||||
|
var value = config[property];
|
||||||
|
var valueType = value && isElement(value) ? 'element' : toType(value);
|
||||||
|
|
||||||
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||||
|
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var makeArray = function makeArray(nodeList) {
|
||||||
|
if (!nodeList) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [].slice.call(nodeList);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -73,7 +142,6 @@
|
||||||
var DATA_KEY = 'bs.scrollspy';
|
var DATA_KEY = 'bs.scrollspy';
|
||||||
var EVENT_KEY = "." + DATA_KEY;
|
var EVENT_KEY = "." + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
||||||
var Default = {
|
var Default = {
|
||||||
offset: 10,
|
offset: 10,
|
||||||
method: 'auto',
|
method: 'auto',
|
||||||
|
@ -130,12 +198,14 @@
|
||||||
this._targets = [];
|
this._targets = [];
|
||||||
this._activeTarget = null;
|
this._activeTarget = null;
|
||||||
this._scrollHeight = 0;
|
this._scrollHeight = 0;
|
||||||
$(this._scrollElement).on(Event.SCROLL, function (event) {
|
EventHandler.on(this._scrollElement, Event.SCROLL, function (event) {
|
||||||
return _this._process(event);
|
return _this._process(event);
|
||||||
});
|
});
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
|
||||||
this._process();
|
this._process();
|
||||||
|
|
||||||
|
Data.setData(element, DATA_KEY, this);
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,13 +221,13 @@
|
||||||
this._offsets = [];
|
this._offsets = [];
|
||||||
this._targets = [];
|
this._targets = [];
|
||||||
this._scrollHeight = this._getScrollHeight();
|
this._scrollHeight = this._getScrollHeight();
|
||||||
var targets = [].slice.call(document.querySelectorAll(this._selector));
|
var targets = makeArray(SelectorEngine.find(this._selector));
|
||||||
targets.map(function (element) {
|
targets.map(function (element) {
|
||||||
var target;
|
var target;
|
||||||
var targetSelector = Util.getSelectorFromElement(element);
|
var targetSelector = getSelectorFromElement(element);
|
||||||
|
|
||||||
if (targetSelector) {
|
if (targetSelector) {
|
||||||
target = document.querySelector(targetSelector);
|
target = SelectorEngine.findOne(targetSelector);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
|
@ -165,7 +235,7 @@
|
||||||
|
|
||||||
if (targetBCR.width || targetBCR.height) {
|
if (targetBCR.width || targetBCR.height) {
|
||||||
// TODO (fat): remove sketch reliance on jQuery position/offset
|
// TODO (fat): remove sketch reliance on jQuery position/offset
|
||||||
return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
|
return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,8 +252,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
$.removeData(this._element, DATA_KEY);
|
Data.removeData(this._element, DATA_KEY);
|
||||||
$(this._scrollElement).off(EVENT_KEY);
|
EventHandler.off(this._scrollElement, EVENT_KEY);
|
||||||
this._element = null;
|
this._element = null;
|
||||||
this._scrollElement = null;
|
this._scrollElement = null;
|
||||||
this._config = null;
|
this._config = null;
|
||||||
|
@ -199,17 +269,17 @@
|
||||||
config = _objectSpread({}, Default, typeof config === 'object' && config ? config : {});
|
config = _objectSpread({}, Default, typeof config === 'object' && config ? config : {});
|
||||||
|
|
||||||
if (typeof config.target !== 'string') {
|
if (typeof config.target !== 'string') {
|
||||||
var id = $(config.target).attr('id');
|
var id = config.target.id;
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
id = Util.getUID(NAME);
|
id = getUID(NAME);
|
||||||
$(config.target).attr('id', id);
|
config.target.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.target = "#" + id;
|
config.target = "#" + id;
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.typeCheckConfig(NAME, config, DefaultType);
|
typeCheckConfig(NAME, config, DefaultType);
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -274,28 +344,36 @@
|
||||||
return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
|
return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
|
||||||
});
|
});
|
||||||
|
|
||||||
var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
|
var link = SelectorEngine.findOne(queries.join(','));
|
||||||
|
|
||||||
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
|
if (link.classList.contains(ClassName.DROPDOWN_ITEM)) {
|
||||||
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
|
SelectorEngine.findOne(Selector.DROPDOWN_TOGGLE, SelectorEngine.closest(link, Selector.DROPDOWN)).classList.add(ClassName.ACTIVE);
|
||||||
$link.addClass(ClassName.ACTIVE);
|
link.classList.add(ClassName.ACTIVE);
|
||||||
} else {
|
} else {
|
||||||
// Set triggered link as active
|
// Set triggered link as active
|
||||||
$link.addClass(ClassName.ACTIVE); // Set triggered links parents as active
|
link.classList.add(ClassName.ACTIVE);
|
||||||
|
SelectorEngine.parents(link, Selector.NAV_LIST_GROUP).forEach(function (listGroup) {
|
||||||
|
// Set triggered links parents as active
|
||||||
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
||||||
|
SelectorEngine.prev(listGroup, Selector.NAV_LINKS + ", " + Selector.LIST_ITEMS).forEach(function (item) {
|
||||||
|
return item.classList.add(ClassName.ACTIVE);
|
||||||
|
}); // Handle special case when .nav-link is inside .nav-item
|
||||||
|
|
||||||
$link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ", " + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE); // Handle special case when .nav-link is inside .nav-item
|
SelectorEngine.prev(listGroup, Selector.NAV_ITEMS).forEach(function (navItem) {
|
||||||
|
SelectorEngine.children(navItem, Selector.NAV_LINKS).forEach(function (item) {
|
||||||
$link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).children(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
|
return item.classList.add(ClassName.ACTIVE);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this._scrollElement).trigger(Event.ACTIVATE, {
|
EventHandler.trigger(this._scrollElement, Event.ACTIVATE, {
|
||||||
relatedTarget: target
|
relatedTarget: target
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._clear = function _clear() {
|
_proto._clear = function _clear() {
|
||||||
[].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
|
makeArray(SelectorEngine.find(this._selector)).filter(function (node) {
|
||||||
return node.classList.contains(ClassName.ACTIVE);
|
return node.classList.contains(ClassName.ACTIVE);
|
||||||
}).forEach(function (node) {
|
}).forEach(function (node) {
|
||||||
return node.classList.remove(ClassName.ACTIVE);
|
return node.classList.remove(ClassName.ACTIVE);
|
||||||
|
@ -305,13 +383,12 @@
|
||||||
|
|
||||||
ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
|
ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var data = $(this).data(DATA_KEY);
|
var data = Data.getData(this, DATA_KEY);
|
||||||
|
|
||||||
var _config = typeof config === 'object' && config;
|
var _config = typeof config === 'object' && config;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = new ScrollSpy(this, _config);
|
data = new ScrollSpy(this, _config);
|
||||||
$(this).data(DATA_KEY, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
|
@ -324,6 +401,10 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ScrollSpy._getInstance = function _getInstance(element) {
|
||||||
|
return Data.getData(element, DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(ScrollSpy, null, [{
|
_createClass(ScrollSpy, null, [{
|
||||||
key: "VERSION",
|
key: "VERSION",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -345,15 +426,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(window).on(Event.LOAD_DATA_API, function () {
|
EventHandler.on(window, Event.LOAD_DATA_API, function () {
|
||||||
var scrollSpys = [].slice.call(document.querySelectorAll(Selector.DATA_SPY));
|
makeArray(SelectorEngine.find(Selector.DATA_SPY)).forEach(function (spy) {
|
||||||
var scrollSpysLength = scrollSpys.length;
|
return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
|
||||||
|
});
|
||||||
for (var i = scrollSpysLength; i--;) {
|
|
||||||
var $spy = $(scrollSpys[i]);
|
|
||||||
|
|
||||||
ScrollSpy._jQueryInterface.call($spy, $spy.data());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
@ -361,13 +437,16 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$.fn[NAME] = ScrollSpy._jQueryInterface;
|
if (typeof jQuery !== 'undefined') {
|
||||||
$.fn[NAME].Constructor = ScrollSpy;
|
var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
|
||||||
|
jQuery.fn[NAME] = ScrollSpy._jQueryInterface;
|
||||||
|
jQuery.fn[NAME].Constructor = ScrollSpy;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
jQuery.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return ScrollSpy._jQueryInterface;
|
return ScrollSpy._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return ScrollSpy;
|
return ScrollSpy;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,13 +4,14 @@
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/eventHandler.js'), require('./dom/selectorEngine.js')) :
|
||||||
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
|
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/eventHandler.js', './dom/selectorEngine.js'], factory) :
|
||||||
(global = global || self, global.Tab = factory(global.jQuery, global.Util));
|
(global = global || self, global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine));
|
||||||
}(this, function ($, Util) { 'use strict';
|
}(this, function (Data, EventHandler, SelectorEngine) { 'use strict';
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
|
||||||
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
|
EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
|
||||||
|
SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -28,6 +29,88 @@
|
||||||
return Constructor;
|
return Constructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var MILLISECONDS_MULTIPLIER = 1000;
|
||||||
|
var TRANSITION_END = 'transitionend';
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
|
var getSelectorFromElement = function getSelectorFromElement(element) {
|
||||||
|
var selector = element.getAttribute('data-target');
|
||||||
|
|
||||||
|
if (!selector || selector === '#') {
|
||||||
|
var hrefAttr = element.getAttribute('href');
|
||||||
|
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return document.querySelector(selector) ? selector : null;
|
||||||
|
} catch (err) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
||||||
|
if (!element) {
|
||||||
|
return 0;
|
||||||
|
} // Get transition-duration of the element
|
||||||
|
|
||||||
|
|
||||||
|
var _window$getComputedSt = window.getComputedStyle(element),
|
||||||
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
|
var floatTransitionDuration = parseFloat(transitionDuration);
|
||||||
|
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
|
return 0;
|
||||||
|
} // If multiple durations are defined, take the first
|
||||||
|
|
||||||
|
|
||||||
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
|
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
||||||
|
};
|
||||||
|
|
||||||
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
element.dispatchEvent(new Event(TRANSITION_END));
|
||||||
|
};
|
||||||
|
|
||||||
|
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
||||||
|
var called = false;
|
||||||
|
var durationPadding = 5;
|
||||||
|
var emulatedDuration = duration + durationPadding;
|
||||||
|
|
||||||
|
function listener() {
|
||||||
|
called = true;
|
||||||
|
element.removeEventListener(TRANSITION_END, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.addEventListener(TRANSITION_END, listener);
|
||||||
|
setTimeout(function () {
|
||||||
|
if (!called) {
|
||||||
|
triggerTransitionEnd(element);
|
||||||
|
}
|
||||||
|
}, emulatedDuration);
|
||||||
|
};
|
||||||
|
|
||||||
|
var makeArray = function makeArray(nodeList) {
|
||||||
|
if (!nodeList) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [].slice.call(nodeList);
|
||||||
|
};
|
||||||
|
|
||||||
|
var reflow = function reflow(element) {
|
||||||
|
return element.offsetHeight;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -39,8 +122,7 @@
|
||||||
var DATA_KEY = 'bs.tab';
|
var DATA_KEY = 'bs.tab';
|
||||||
var EVENT_KEY = "." + DATA_KEY;
|
var EVENT_KEY = "." + DATA_KEY;
|
||||||
var DATA_API_KEY = '.data-api';
|
var DATA_API_KEY = '.data-api';
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var Event$1 = {
|
||||||
var Event = {
|
|
||||||
HIDE: "hide" + EVENT_KEY,
|
HIDE: "hide" + EVENT_KEY,
|
||||||
HIDDEN: "hidden" + EVENT_KEY,
|
HIDDEN: "hidden" + EVENT_KEY,
|
||||||
SHOW: "show" + EVENT_KEY,
|
SHOW: "show" + EVENT_KEY,
|
||||||
|
@ -58,10 +140,10 @@
|
||||||
DROPDOWN: '.dropdown',
|
DROPDOWN: '.dropdown',
|
||||||
NAV_LIST_GROUP: '.nav, .list-group',
|
NAV_LIST_GROUP: '.nav, .list-group',
|
||||||
ACTIVE: '.active',
|
ACTIVE: '.active',
|
||||||
ACTIVE_UL: '> li > .active',
|
ACTIVE_UL: ':scope > li > .active',
|
||||||
DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
|
DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
|
||||||
DROPDOWN_TOGGLE: '.dropdown-toggle',
|
DROPDOWN_TOGGLE: '.dropdown-toggle',
|
||||||
DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
|
DROPDOWN_ACTIVE_CHILD: ':scope > .dropdown-menu .active'
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Class Definition
|
* Class Definition
|
||||||
|
@ -75,6 +157,7 @@
|
||||||
function () {
|
function () {
|
||||||
function Tab(element) {
|
function Tab(element) {
|
||||||
this._element = element;
|
this._element = element;
|
||||||
|
Data.setData(this._element, DATA_KEY, this);
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,53 +167,50 @@
|
||||||
_proto.show = function show() {
|
_proto.show = function show() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
|
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(ClassName.ACTIVE) || this._element.classList.contains(ClassName.DISABLED)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var target;
|
var target;
|
||||||
var previous;
|
var previous;
|
||||||
var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0];
|
var listElement = SelectorEngine.closest(this._element, Selector.NAV_LIST_GROUP);
|
||||||
var selector = Util.getSelectorFromElement(this._element);
|
var selector = getSelectorFromElement(this._element);
|
||||||
|
|
||||||
if (listElement) {
|
if (listElement) {
|
||||||
var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector.ACTIVE_UL : Selector.ACTIVE;
|
var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector.ACTIVE_UL : Selector.ACTIVE;
|
||||||
previous = $.makeArray($(listElement).find(itemSelector));
|
previous = makeArray(SelectorEngine.find(itemSelector, listElement));
|
||||||
previous = previous[previous.length - 1];
|
previous = previous[previous.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
var hideEvent = $.Event(Event.HIDE, {
|
var hideEvent = null;
|
||||||
|
|
||||||
|
if (previous) {
|
||||||
|
hideEvent = EventHandler.trigger(previous, Event$1.HIDE, {
|
||||||
relatedTarget: this._element
|
relatedTarget: this._element
|
||||||
});
|
});
|
||||||
var showEvent = $.Event(Event.SHOW, {
|
}
|
||||||
|
|
||||||
|
var showEvent = EventHandler.trigger(this._element, Event$1.SHOW, {
|
||||||
relatedTarget: previous
|
relatedTarget: previous
|
||||||
});
|
});
|
||||||
|
|
||||||
if (previous) {
|
if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
|
||||||
$(previous).trigger(hideEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
$(this._element).trigger(showEvent);
|
|
||||||
|
|
||||||
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selector) {
|
if (selector) {
|
||||||
target = document.querySelector(selector);
|
target = SelectorEngine.findOne(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._activate(this._element, listElement);
|
this._activate(this._element, listElement);
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
var hiddenEvent = $.Event(Event.HIDDEN, {
|
EventHandler.trigger(previous, Event$1.HIDDEN, {
|
||||||
relatedTarget: _this._element
|
relatedTarget: _this._element
|
||||||
});
|
});
|
||||||
var shownEvent = $.Event(Event.SHOWN, {
|
EventHandler.trigger(_this._element, Event$1.SHOWN, {
|
||||||
relatedTarget: previous
|
relatedTarget: previous
|
||||||
});
|
});
|
||||||
$(previous).trigger(hiddenEvent);
|
|
||||||
$(_this._element).trigger(shownEvent);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
|
@ -141,7 +221,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
$.removeData(this._element, DATA_KEY);
|
Data.removeData(this._element, DATA_KEY);
|
||||||
this._element = null;
|
this._element = null;
|
||||||
} // Private
|
} // Private
|
||||||
;
|
;
|
||||||
|
@ -149,17 +229,19 @@
|
||||||
_proto._activate = function _activate(element, container, callback) {
|
_proto._activate = function _activate(element, container, callback) {
|
||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector.ACTIVE_UL) : $(container).children(Selector.ACTIVE);
|
var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(Selector.ACTIVE_UL, container) : SelectorEngine.children(container, Selector.ACTIVE);
|
||||||
var active = activeElements[0];
|
var active = activeElements[0];
|
||||||
var isTransitioning = callback && active && $(active).hasClass(ClassName.FADE);
|
var isTransitioning = callback && active && active.classList.contains(ClassName.FADE);
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
return _this2._transitionComplete(element, active, callback);
|
return _this2._transitionComplete(element, active, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (active && isTransitioning) {
|
if (active && isTransitioning) {
|
||||||
var transitionDuration = Util.getTransitionDurationFromElement(active);
|
var transitionDuration = getTransitionDurationFromElement(active);
|
||||||
$(active).removeClass(ClassName.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
active.classList.remove(ClassName.SHOW);
|
||||||
|
EventHandler.one(active, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(active, transitionDuration);
|
||||||
} else {
|
} else {
|
||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
|
@ -167,11 +249,11 @@
|
||||||
|
|
||||||
_proto._transitionComplete = function _transitionComplete(element, active, callback) {
|
_proto._transitionComplete = function _transitionComplete(element, active, callback) {
|
||||||
if (active) {
|
if (active) {
|
||||||
$(active).removeClass(ClassName.ACTIVE);
|
active.classList.remove(ClassName.ACTIVE);
|
||||||
var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
|
var dropdownChild = SelectorEngine.findOne(Selector.DROPDOWN_ACTIVE_CHILD, active.parentNode);
|
||||||
|
|
||||||
if (dropdownChild) {
|
if (dropdownChild) {
|
||||||
$(dropdownChild).removeClass(ClassName.ACTIVE);
|
dropdownChild.classList.remove(ClassName.ACTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active.getAttribute('role') === 'tab') {
|
if (active.getAttribute('role') === 'tab') {
|
||||||
|
@ -179,24 +261,25 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(element).addClass(ClassName.ACTIVE);
|
element.classList.add(ClassName.ACTIVE);
|
||||||
|
|
||||||
if (element.getAttribute('role') === 'tab') {
|
if (element.getAttribute('role') === 'tab') {
|
||||||
element.setAttribute('aria-selected', true);
|
element.setAttribute('aria-selected', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.reflow(element);
|
reflow(element);
|
||||||
|
|
||||||
if (element.classList.contains(ClassName.FADE)) {
|
if (element.classList.contains(ClassName.FADE)) {
|
||||||
element.classList.add(ClassName.SHOW);
|
element.classList.add(ClassName.SHOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
|
if (element.parentNode && element.parentNode.classList.contains(ClassName.DROPDOWN_MENU)) {
|
||||||
var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
|
var dropdownElement = SelectorEngine.closest(element, Selector.DROPDOWN);
|
||||||
|
|
||||||
if (dropdownElement) {
|
if (dropdownElement) {
|
||||||
var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector.DROPDOWN_TOGGLE));
|
makeArray(SelectorEngine.find(Selector.DROPDOWN_TOGGLE)).forEach(function (dropdown) {
|
||||||
$(dropdownToggleList).addClass(ClassName.ACTIVE);
|
return dropdown.classList.add(ClassName.ACTIVE);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
element.setAttribute('aria-expanded', true);
|
element.setAttribute('aria-expanded', true);
|
||||||
|
@ -210,13 +293,7 @@
|
||||||
|
|
||||||
Tab._jQueryInterface = function _jQueryInterface(config) {
|
Tab._jQueryInterface = function _jQueryInterface(config) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this);
|
var data = Data.getData(this, DATA_KEY) || new Tab(this);
|
||||||
var data = $this.data(DATA_KEY);
|
|
||||||
|
|
||||||
if (!data) {
|
|
||||||
data = new Tab(this);
|
|
||||||
$this.data(DATA_KEY, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
if (typeof data[config] === 'undefined') {
|
if (typeof data[config] === 'undefined') {
|
||||||
|
@ -228,6 +305,10 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Tab._getInstance = function _getInstance(element) {
|
||||||
|
return Data.getData(element, DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(Tab, null, [{
|
_createClass(Tab, null, [{
|
||||||
key: "VERSION",
|
key: "VERSION",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -244,24 +325,28 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
var data = Data.getData(this, DATA_KEY) || new Tab(this);
|
||||||
Tab._jQueryInterface.call($(this), 'show');
|
data.show();
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .tab to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$.fn[NAME] = Tab._jQueryInterface;
|
if (typeof jQuery !== 'undefined') {
|
||||||
$.fn[NAME].Constructor = Tab;
|
var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
|
||||||
|
jQuery.fn[NAME] = Tab._jQueryInterface;
|
||||||
|
jQuery.fn[NAME].Constructor = Tab;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
jQuery.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Tab._jQueryInterface;
|
return Tab._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Tab;
|
return Tab;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,13 +4,14 @@
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/eventHandler.js'), require('./dom/manipulator.js')) :
|
||||||
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
|
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/eventHandler.js', './dom/manipulator.js'], factory) :
|
||||||
(global = global || self, global.Toast = factory(global.jQuery, global.Util));
|
(global = global || self, global.Toast = factory(global.Data, global.EventHandler, global.Manipulator));
|
||||||
}(this, function ($, Util) { 'use strict';
|
}(this, function (Data, EventHandler, Manipulator) { 'use strict';
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
|
||||||
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
|
EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
|
||||||
|
Manipulator = Manipulator && Manipulator.hasOwnProperty('default') ? Manipulator['default'] : Manipulator;
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -62,6 +63,81 @@
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var MILLISECONDS_MULTIPLIER = 1000;
|
||||||
|
var TRANSITION_END = 'transitionend';
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
|
var toType = function toType(obj) {
|
||||||
|
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
||||||
|
};
|
||||||
|
|
||||||
|
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
||||||
|
if (!element) {
|
||||||
|
return 0;
|
||||||
|
} // Get transition-duration of the element
|
||||||
|
|
||||||
|
|
||||||
|
var _window$getComputedSt = window.getComputedStyle(element),
|
||||||
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
|
var floatTransitionDuration = parseFloat(transitionDuration);
|
||||||
|
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
|
return 0;
|
||||||
|
} // If multiple durations are defined, take the first
|
||||||
|
|
||||||
|
|
||||||
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
|
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
||||||
|
};
|
||||||
|
|
||||||
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
element.dispatchEvent(new Event(TRANSITION_END));
|
||||||
|
};
|
||||||
|
|
||||||
|
var isElement = function isElement(obj) {
|
||||||
|
return (obj[0] || obj).nodeType;
|
||||||
|
};
|
||||||
|
|
||||||
|
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
||||||
|
var called = false;
|
||||||
|
var durationPadding = 5;
|
||||||
|
var emulatedDuration = duration + durationPadding;
|
||||||
|
|
||||||
|
function listener() {
|
||||||
|
called = true;
|
||||||
|
element.removeEventListener(TRANSITION_END, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.addEventListener(TRANSITION_END, listener);
|
||||||
|
setTimeout(function () {
|
||||||
|
if (!called) {
|
||||||
|
triggerTransitionEnd(element);
|
||||||
|
}
|
||||||
|
}, emulatedDuration);
|
||||||
|
};
|
||||||
|
|
||||||
|
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
||||||
|
Object.keys(configTypes).forEach(function (property) {
|
||||||
|
var expectedTypes = configTypes[property];
|
||||||
|
var value = config[property];
|
||||||
|
var valueType = value && isElement(value) ? 'element' : toType(value);
|
||||||
|
|
||||||
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||||
|
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* Constants
|
* Constants
|
||||||
|
@ -72,8 +148,7 @@
|
||||||
var VERSION = '4.3.1';
|
var VERSION = '4.3.1';
|
||||||
var DATA_KEY = 'bs.toast';
|
var DATA_KEY = 'bs.toast';
|
||||||
var EVENT_KEY = "." + DATA_KEY;
|
var EVENT_KEY = "." + DATA_KEY;
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
var Event$1 = {
|
||||||
var Event = {
|
|
||||||
CLICK_DISMISS: "click.dismiss" + EVENT_KEY,
|
CLICK_DISMISS: "click.dismiss" + EVENT_KEY,
|
||||||
HIDE: "hide" + EVENT_KEY,
|
HIDE: "hide" + EVENT_KEY,
|
||||||
HIDDEN: "hidden" + EVENT_KEY,
|
HIDDEN: "hidden" + EVENT_KEY,
|
||||||
|
@ -115,6 +190,8 @@
|
||||||
this._timeout = null;
|
this._timeout = null;
|
||||||
|
|
||||||
this._setListeners();
|
this._setListeners();
|
||||||
|
|
||||||
|
Data.setData(element, DATA_KEY, this);
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +201,7 @@
|
||||||
_proto.show = function show() {
|
_proto.show = function show() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
$(this._element).trigger(Event.SHOW);
|
EventHandler.trigger(this._element, Event$1.SHOW);
|
||||||
|
|
||||||
if (this._config.animation) {
|
if (this._config.animation) {
|
||||||
this._element.classList.add(ClassName.FADE);
|
this._element.classList.add(ClassName.FADE);
|
||||||
|
@ -135,7 +212,7 @@
|
||||||
|
|
||||||
_this._element.classList.add(ClassName.SHOW);
|
_this._element.classList.add(ClassName.SHOW);
|
||||||
|
|
||||||
$(_this._element).trigger(Event.SHOWN);
|
EventHandler.trigger(_this._element, Event$1.SHOWN);
|
||||||
|
|
||||||
if (_this._config.autohide) {
|
if (_this._config.autohide) {
|
||||||
_this.hide();
|
_this.hide();
|
||||||
|
@ -147,8 +224,9 @@
|
||||||
this._element.classList.add(ClassName.SHOWING);
|
this._element.classList.add(ClassName.SHOWING);
|
||||||
|
|
||||||
if (this._config.animation) {
|
if (this._config.animation) {
|
||||||
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
var transitionDuration = getTransitionDurationFromElement(this._element);
|
||||||
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
EventHandler.one(this._element, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(this._element, transitionDuration);
|
||||||
} else {
|
} else {
|
||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
|
@ -161,7 +239,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this._element).trigger(Event.HIDE);
|
EventHandler.trigger(this._element, Event$1.HIDE);
|
||||||
|
|
||||||
if (withoutTimeout) {
|
if (withoutTimeout) {
|
||||||
this._close();
|
this._close();
|
||||||
|
@ -180,23 +258,23 @@
|
||||||
this._element.classList.remove(ClassName.SHOW);
|
this._element.classList.remove(ClassName.SHOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this._element).off(Event.CLICK_DISMISS);
|
EventHandler.off(this._element, Event$1.CLICK_DISMISS);
|
||||||
$.removeData(this._element, DATA_KEY);
|
Data.removeData(this._element, DATA_KEY);
|
||||||
this._element = null;
|
this._element = null;
|
||||||
this._config = null;
|
this._config = null;
|
||||||
} // Private
|
} // Private
|
||||||
;
|
;
|
||||||
|
|
||||||
_proto._getConfig = function _getConfig(config) {
|
_proto._getConfig = function _getConfig(config) {
|
||||||
config = _objectSpread({}, Default, $(this._element).data(), typeof config === 'object' && config ? config : {});
|
config = _objectSpread({}, Default, Manipulator.getDataAttributes(this._element), typeof config === 'object' && config ? config : {});
|
||||||
Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._setListeners = function _setListeners() {
|
_proto._setListeners = function _setListeners() {
|
||||||
var _this3 = this;
|
var _this3 = this;
|
||||||
|
|
||||||
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function () {
|
EventHandler.on(this._element, Event$1.CLICK_DISMISS, Selector.DATA_DISMISS, function () {
|
||||||
return _this3.hide(true);
|
return _this3.hide(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -207,14 +285,15 @@
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
_this4._element.classList.add(ClassName.HIDE);
|
_this4._element.classList.add(ClassName.HIDE);
|
||||||
|
|
||||||
$(_this4._element).trigger(Event.HIDDEN);
|
EventHandler.trigger(_this4._element, Event$1.HIDDEN);
|
||||||
};
|
};
|
||||||
|
|
||||||
this._element.classList.remove(ClassName.SHOW);
|
this._element.classList.remove(ClassName.SHOW);
|
||||||
|
|
||||||
if (this._config.animation) {
|
if (this._config.animation) {
|
||||||
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
var transitionDuration = getTransitionDurationFromElement(this._element);
|
||||||
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
EventHandler.one(this._element, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(this._element, transitionDuration);
|
||||||
} else {
|
} else {
|
||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
|
@ -223,14 +302,12 @@
|
||||||
|
|
||||||
Toast._jQueryInterface = function _jQueryInterface(config) {
|
Toast._jQueryInterface = function _jQueryInterface(config) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $element = $(this);
|
var data = Data.getData(this, DATA_KEY);
|
||||||
var data = $element.data(DATA_KEY);
|
|
||||||
|
|
||||||
var _config = typeof config === 'object' && config;
|
var _config = typeof config === 'object' && config;
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = new Toast(this, _config);
|
data = new Toast(this, _config);
|
||||||
$element.data(DATA_KEY, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
|
@ -243,6 +320,10 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Toast._getInstance = function _getInstance(element) {
|
||||||
|
return Data.getData(element, DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(Toast, null, [{
|
_createClass(Toast, null, [{
|
||||||
key: "VERSION",
|
key: "VERSION",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -266,16 +347,20 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .toast to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$.fn[NAME] = Toast._jQueryInterface;
|
if (typeof jQuery !== 'undefined') {
|
||||||
$.fn[NAME].Constructor = Toast;
|
var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
|
||||||
|
jQuery.fn[NAME] = Toast._jQueryInterface;
|
||||||
|
jQuery.fn[NAME].Constructor = Toast;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
jQuery.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Toast._jQueryInterface;
|
return Toast._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Toast;
|
return Toast;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,14 +4,16 @@
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
(function (global, factory) {
|
(function (global, factory) {
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('popper.js'), require('./util.js')) :
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/eventHandler.js'), require('./dom/manipulator.js'), require('popper.js'), require('./dom/selectorEngine.js')) :
|
||||||
typeof define === 'function' && define.amd ? define(['jquery', 'popper.js', './util.js'], factory) :
|
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/eventHandler.js', './dom/manipulator.js', 'popper.js', './dom/selectorEngine.js'], factory) :
|
||||||
(global = global || self, global.Tooltip = factory(global.jQuery, global.Popper, global.Util));
|
(global = global || self, global.Tooltip = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
|
||||||
}(this, function ($, Popper, Util) { 'use strict';
|
}(this, function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
Data = Data && Data.hasOwnProperty('default') ? Data['default'] : Data;
|
||||||
|
EventHandler = EventHandler && EventHandler.hasOwnProperty('default') ? EventHandler['default'] : EventHandler;
|
||||||
|
Manipulator = Manipulator && Manipulator.hasOwnProperty('default') ? Manipulator['default'] : Manipulator;
|
||||||
Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
|
Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
|
||||||
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
|
SelectorEngine = SelectorEngine && SelectorEngine.hasOwnProperty('default') ? SelectorEngine['default'] : SelectorEngine;
|
||||||
|
|
||||||
function _defineProperties(target, props) {
|
function _defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
|
@ -65,12 +67,178 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
* Bootstrap (v4.3.1): tools/sanitizer.js
|
* Bootstrap (v4.3.1): util/index.js
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
var MAX_UID = 1000000;
|
||||||
|
var MILLISECONDS_MULTIPLIER = 1000;
|
||||||
|
var TRANSITION_END = 'transitionend';
|
||||||
|
var jQuery = window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||||
|
|
||||||
|
var toType = function toType(obj) {
|
||||||
|
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Public Util Api
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var getUID = function getUID(prefix) {
|
||||||
|
do {
|
||||||
|
// eslint-disable-next-line no-bitwise
|
||||||
|
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
|
||||||
|
} while (document.getElementById(prefix));
|
||||||
|
|
||||||
|
return prefix;
|
||||||
|
};
|
||||||
|
|
||||||
|
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
||||||
|
if (!element) {
|
||||||
|
return 0;
|
||||||
|
} // Get transition-duration of the element
|
||||||
|
|
||||||
|
|
||||||
|
var _window$getComputedSt = window.getComputedStyle(element),
|
||||||
|
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||||
|
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||||
|
|
||||||
|
var floatTransitionDuration = parseFloat(transitionDuration);
|
||||||
|
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||||
|
|
||||||
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||||
|
return 0;
|
||||||
|
} // If multiple durations are defined, take the first
|
||||||
|
|
||||||
|
|
||||||
|
transitionDuration = transitionDuration.split(',')[0];
|
||||||
|
transitionDelay = transitionDelay.split(',')[0];
|
||||||
|
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
||||||
|
};
|
||||||
|
|
||||||
|
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||||
|
element.dispatchEvent(new Event(TRANSITION_END));
|
||||||
|
};
|
||||||
|
|
||||||
|
var isElement = function isElement(obj) {
|
||||||
|
return (obj[0] || obj).nodeType;
|
||||||
|
};
|
||||||
|
|
||||||
|
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
||||||
|
var called = false;
|
||||||
|
var durationPadding = 5;
|
||||||
|
var emulatedDuration = duration + durationPadding;
|
||||||
|
|
||||||
|
function listener() {
|
||||||
|
called = true;
|
||||||
|
element.removeEventListener(TRANSITION_END, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
element.addEventListener(TRANSITION_END, listener);
|
||||||
|
setTimeout(function () {
|
||||||
|
if (!called) {
|
||||||
|
triggerTransitionEnd(element);
|
||||||
|
}
|
||||||
|
}, emulatedDuration);
|
||||||
|
};
|
||||||
|
|
||||||
|
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
||||||
|
Object.keys(configTypes).forEach(function (property) {
|
||||||
|
var expectedTypes = configTypes[property];
|
||||||
|
var value = config[property];
|
||||||
|
var valueType = value && isElement(value) ? 'element' : toType(value);
|
||||||
|
|
||||||
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||||
|
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var makeArray = function makeArray(nodeList) {
|
||||||
|
if (!nodeList) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [].slice.call(nodeList);
|
||||||
|
};
|
||||||
|
|
||||||
|
var findShadowRoot = function findShadowRoot(element) {
|
||||||
|
if (!document.documentElement.attachShadow) {
|
||||||
|
return null;
|
||||||
|
} // Can find the shadow root otherwise it'll return the document
|
||||||
|
|
||||||
|
|
||||||
|
if (typeof element.getRootNode === 'function') {
|
||||||
|
var root = element.getRootNode();
|
||||||
|
return root instanceof ShadowRoot ? root : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element instanceof ShadowRoot) {
|
||||||
|
return element;
|
||||||
|
} // when we don't find a shadow root
|
||||||
|
|
||||||
|
|
||||||
|
if (!element.parentNode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return findShadowRoot(element.parentNode);
|
||||||
|
}; // eslint-disable-next-line no-empty-function
|
||||||
|
|
||||||
|
|
||||||
|
var noop = function noop() {
|
||||||
|
return function () {};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Bootstrap (v4.3.1): util/sanitizer.js
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
* --------------------------------------------------------------------------
|
* --------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
|
var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
|
||||||
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
||||||
|
/**
|
||||||
|
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
||||||
|
*
|
||||||
|
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
||||||
|
*/
|
||||||
|
|
||||||
|
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
|
||||||
|
/**
|
||||||
|
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
||||||
|
*
|
||||||
|
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
||||||
|
*/
|
||||||
|
|
||||||
|
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
|
||||||
|
|
||||||
|
var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) {
|
||||||
|
var attrName = attr.nodeName.toLowerCase();
|
||||||
|
|
||||||
|
if (allowedAttributeList.indexOf(attrName) !== -1) {
|
||||||
|
if (uriAttrs.indexOf(attrName) !== -1) {
|
||||||
|
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var regExp = allowedAttributeList.filter(function (attrRegex) {
|
||||||
|
return attrRegex instanceof RegExp;
|
||||||
|
}); // Check if a regular expression validates the attribute.
|
||||||
|
|
||||||
|
for (var i = 0, l = regExp.length; i < l; i++) {
|
||||||
|
if (attrName.match(regExp[i])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
var DefaultWhitelist = {
|
var DefaultWhitelist = {
|
||||||
// Global attributes allowed on any supplied element below.
|
// Global attributes allowed on any supplied element below.
|
||||||
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
||||||
|
@ -103,48 +271,9 @@
|
||||||
strong: [],
|
strong: [],
|
||||||
u: [],
|
u: [],
|
||||||
ul: []
|
ul: []
|
||||||
/**
|
|
||||||
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
|
||||||
*
|
|
||||||
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
|
||||||
*/
|
|
||||||
|
|
||||||
};
|
};
|
||||||
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
|
|
||||||
/**
|
|
||||||
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
|
||||||
*
|
|
||||||
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
|
||||||
*/
|
|
||||||
|
|
||||||
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
|
|
||||||
|
|
||||||
function allowedAttribute(attr, allowedAttributeList) {
|
|
||||||
var attrName = attr.nodeName.toLowerCase();
|
|
||||||
|
|
||||||
if (allowedAttributeList.indexOf(attrName) !== -1) {
|
|
||||||
if (uriAttrs.indexOf(attrName) !== -1) {
|
|
||||||
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var regExp = allowedAttributeList.filter(function (attrRegex) {
|
|
||||||
return attrRegex instanceof RegExp;
|
|
||||||
}); // Check if a regular expression validates the attribute.
|
|
||||||
|
|
||||||
for (var i = 0, l = regExp.length; i < l; i++) {
|
|
||||||
if (attrName.match(regExp[i])) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
|
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
|
||||||
if (unsafeHtml.length === 0) {
|
if (!unsafeHtml.length) {
|
||||||
return unsafeHtml;
|
return unsafeHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,18 +284,18 @@
|
||||||
var domParser = new window.DOMParser();
|
var domParser = new window.DOMParser();
|
||||||
var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
||||||
var whitelistKeys = Object.keys(whiteList);
|
var whitelistKeys = Object.keys(whiteList);
|
||||||
var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
|
var elements = makeArray(createdDocument.body.querySelectorAll('*'));
|
||||||
|
|
||||||
var _loop = function _loop(i, len) {
|
var _loop = function _loop(i, len) {
|
||||||
var el = elements[i];
|
var el = elements[i];
|
||||||
var elName = el.nodeName.toLowerCase();
|
var elName = el.nodeName.toLowerCase();
|
||||||
|
|
||||||
if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
|
if (whitelistKeys.indexOf(elName) === -1) {
|
||||||
el.parentNode.removeChild(el);
|
el.parentNode.removeChild(el);
|
||||||
return "continue";
|
return "continue";
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributeList = [].slice.call(el.attributes);
|
var attributeList = makeArray(el.attributes);
|
||||||
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
|
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
|
||||||
attributeList.forEach(function (attr) {
|
attributeList.forEach(function (attr) {
|
||||||
if (!allowedAttribute(attr, whitelistedAttributes)) {
|
if (!allowedAttribute(attr, whitelistedAttributes)) {
|
||||||
|
@ -194,7 +323,6 @@
|
||||||
var VERSION = '4.3.1';
|
var VERSION = '4.3.1';
|
||||||
var DATA_KEY = 'bs.tooltip';
|
var DATA_KEY = 'bs.tooltip';
|
||||||
var EVENT_KEY = "." + DATA_KEY;
|
var EVENT_KEY = "." + DATA_KEY;
|
||||||
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
||||||
var CLASS_PREFIX = 'bs-tooltip';
|
var CLASS_PREFIX = 'bs-tooltip';
|
||||||
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
|
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
|
||||||
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
|
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
|
||||||
|
@ -224,7 +352,7 @@
|
||||||
};
|
};
|
||||||
var Default = {
|
var Default = {
|
||||||
animation: true,
|
animation: true,
|
||||||
template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
|
template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
|
||||||
trigger: 'hover focus',
|
trigger: 'hover focus',
|
||||||
title: '',
|
title: '',
|
||||||
delay: 0,
|
delay: 0,
|
||||||
|
@ -243,7 +371,7 @@
|
||||||
SHOW: 'show',
|
SHOW: 'show',
|
||||||
OUT: 'out'
|
OUT: 'out'
|
||||||
};
|
};
|
||||||
var Event = {
|
var Event$1 = {
|
||||||
HIDE: "hide" + EVENT_KEY,
|
HIDE: "hide" + EVENT_KEY,
|
||||||
HIDDEN: "hidden" + EVENT_KEY,
|
HIDDEN: "hidden" + EVENT_KEY,
|
||||||
SHOW: "show" + EVENT_KEY,
|
SHOW: "show" + EVENT_KEY,
|
||||||
|
@ -262,7 +390,7 @@
|
||||||
var Selector = {
|
var Selector = {
|
||||||
TOOLTIP: '.tooltip',
|
TOOLTIP: '.tooltip',
|
||||||
TOOLTIP_INNER: '.tooltip-inner',
|
TOOLTIP_INNER: '.tooltip-inner',
|
||||||
ARROW: '.arrow'
|
TOOLTIP_ARROW: '.tooltip-arrow'
|
||||||
};
|
};
|
||||||
var Trigger = {
|
var Trigger = {
|
||||||
HOVER: 'hover',
|
HOVER: 'hover',
|
||||||
|
@ -286,7 +414,7 @@
|
||||||
* Popper - https://popper.js.org
|
* Popper - https://popper.js.org
|
||||||
*/
|
*/
|
||||||
if (typeof Popper === 'undefined') {
|
if (typeof Popper === 'undefined') {
|
||||||
throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
|
throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)');
|
||||||
} // private
|
} // private
|
||||||
|
|
||||||
|
|
||||||
|
@ -301,6 +429,8 @@
|
||||||
this.tip = null;
|
this.tip = null;
|
||||||
|
|
||||||
this._setListeners();
|
this._setListeners();
|
||||||
|
|
||||||
|
Data.setData(element, this.constructor.DATA_KEY, this);
|
||||||
} // Getters
|
} // Getters
|
||||||
|
|
||||||
|
|
||||||
|
@ -326,11 +456,11 @@
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
var dataKey = this.constructor.DATA_KEY;
|
var dataKey = this.constructor.DATA_KEY;
|
||||||
var context = $(event.currentTarget).data(dataKey);
|
var context = Data.getData(event.delegateTarget, dataKey);
|
||||||
|
|
||||||
if (!context) {
|
if (!context) {
|
||||||
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
||||||
$(event.currentTarget).data(dataKey, context);
|
Data.setData(event.delegateTarget, dataKey, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
context._activeTrigger.click = !context._activeTrigger.click;
|
context._activeTrigger.click = !context._activeTrigger.click;
|
||||||
|
@ -341,7 +471,7 @@
|
||||||
context._leave(null, context);
|
context._leave(null, context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($(this.getTipElement()).hasClass(ClassName.SHOW)) {
|
if (this.getTipElement().classList.contains(ClassName.SHOW)) {
|
||||||
this._leave(null, this);
|
this._leave(null, this);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -353,12 +483,12 @@
|
||||||
|
|
||||||
_proto.dispose = function dispose() {
|
_proto.dispose = function dispose() {
|
||||||
clearTimeout(this._timeout);
|
clearTimeout(this._timeout);
|
||||||
$.removeData(this.element, this.constructor.DATA_KEY);
|
Data.removeData(this.element, this.constructor.DATA_KEY);
|
||||||
$(this.element).off(this.constructor.EVENT_KEY);
|
EventHandler.off(this.element, this.constructor.EVENT_KEY);
|
||||||
$(this.element).closest('.modal').off('hide.bs.modal');
|
EventHandler.off(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal');
|
||||||
|
|
||||||
if (this.tip) {
|
if (this.tip) {
|
||||||
$(this.tip).remove();
|
this.tip.parentNode.removeChild(this.tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._isEnabled = null;
|
this._isEnabled = null;
|
||||||
|
@ -379,29 +509,27 @@
|
||||||
_proto.show = function show() {
|
_proto.show = function show() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
if ($(this.element).css('display') === 'none') {
|
if (this.element.style.display === 'none') {
|
||||||
throw new Error('Please use show on visible elements');
|
throw new Error('Please use show on visible elements');
|
||||||
}
|
}
|
||||||
|
|
||||||
var showEvent = $.Event(this.constructor.Event.SHOW);
|
|
||||||
|
|
||||||
if (this.isWithContent() && this._isEnabled) {
|
if (this.isWithContent() && this._isEnabled) {
|
||||||
$(this.element).trigger(showEvent);
|
var showEvent = EventHandler.trigger(this.element, this.constructor.Event.SHOW);
|
||||||
var shadowRoot = Util.findShadowRoot(this.element);
|
var shadowRoot = findShadowRoot(this.element);
|
||||||
var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
|
var isInTheDom = shadowRoot !== null ? shadowRoot.contains(this.element) : this.element.ownerDocument.documentElement.contains(this.element);
|
||||||
|
|
||||||
if (showEvent.isDefaultPrevented() || !isInTheDom) {
|
if (showEvent.defaultPrevented || !isInTheDom) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tip = this.getTipElement();
|
var tip = this.getTipElement();
|
||||||
var tipId = Util.getUID(this.constructor.NAME);
|
var tipId = getUID(this.constructor.NAME);
|
||||||
tip.setAttribute('id', tipId);
|
tip.setAttribute('id', tipId);
|
||||||
this.element.setAttribute('aria-describedby', tipId);
|
this.element.setAttribute('aria-describedby', tipId);
|
||||||
this.setContent();
|
this.setContent();
|
||||||
|
|
||||||
if (this.config.animation) {
|
if (this.config.animation) {
|
||||||
$(tip).addClass(ClassName.FADE);
|
tip.classList.add(ClassName.FADE);
|
||||||
}
|
}
|
||||||
|
|
||||||
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
|
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
|
||||||
|
@ -412,13 +540,13 @@
|
||||||
|
|
||||||
var container = this._getContainer();
|
var container = this._getContainer();
|
||||||
|
|
||||||
$(tip).data(this.constructor.DATA_KEY, this);
|
Data.setData(tip, this.constructor.DATA_KEY, this);
|
||||||
|
|
||||||
if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
|
if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
|
||||||
$(tip).appendTo(container);
|
container.appendChild(tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(this.element).trigger(this.constructor.Event.INSERTED);
|
EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
|
||||||
this._popper = new Popper(this.element, tip, {
|
this._popper = new Popper(this.element, tip, {
|
||||||
placement: attachment,
|
placement: attachment,
|
||||||
modifiers: {
|
modifiers: {
|
||||||
|
@ -427,7 +555,7 @@
|
||||||
behavior: this.config.fallbackPlacement
|
behavior: this.config.fallbackPlacement
|
||||||
},
|
},
|
||||||
arrow: {
|
arrow: {
|
||||||
element: Selector.ARROW
|
element: Selector.TOOLTIP_ARROW
|
||||||
},
|
},
|
||||||
preventOverflow: {
|
preventOverflow: {
|
||||||
boundariesElement: this.config.boundary
|
boundariesElement: this.config.boundary
|
||||||
|
@ -442,13 +570,15 @@
|
||||||
return _this._handlePopperPlacementChange(data);
|
return _this._handlePopperPlacementChange(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(tip).addClass(ClassName.SHOW); // If this is a touch-enabled device we add extra
|
tip.classList.add(ClassName.SHOW); // If this is a touch-enabled device we add extra
|
||||||
// empty mouseover listeners to the body's immediate children;
|
// empty mouseover listeners to the body's immediate children;
|
||||||
// only needed because of broken event delegation on iOS
|
// only needed because of broken event delegation on iOS
|
||||||
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
||||||
|
|
||||||
if ('ontouchstart' in document.documentElement) {
|
if ('ontouchstart' in document.documentElement) {
|
||||||
$(document.body).children().on('mouseover', null, $.noop);
|
makeArray(document.body.children).forEach(function (element) {
|
||||||
|
EventHandler.on(element, 'mouseover', noop());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
|
@ -458,16 +588,17 @@
|
||||||
|
|
||||||
var prevHoverState = _this._hoverState;
|
var prevHoverState = _this._hoverState;
|
||||||
_this._hoverState = null;
|
_this._hoverState = null;
|
||||||
$(_this.element).trigger(_this.constructor.Event.SHOWN);
|
EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN);
|
||||||
|
|
||||||
if (prevHoverState === HoverState.OUT) {
|
if (prevHoverState === HoverState.OUT) {
|
||||||
_this._leave(null, _this);
|
_this._leave(null, _this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($(this.tip).hasClass(ClassName.FADE)) {
|
if (this.tip.classList.contains(ClassName.FADE)) {
|
||||||
var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
|
var transitionDuration = getTransitionDurationFromElement(this.tip);
|
||||||
$(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
EventHandler.one(this.tip, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(this.tip, transitionDuration);
|
||||||
} else {
|
} else {
|
||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
|
@ -478,7 +609,6 @@
|
||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var tip = this.getTipElement();
|
var tip = this.getTipElement();
|
||||||
var hideEvent = $.Event(this.constructor.Event.HIDE);
|
|
||||||
|
|
||||||
var complete = function complete() {
|
var complete = function complete() {
|
||||||
if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
|
if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
|
||||||
|
@ -489,7 +619,7 @@
|
||||||
|
|
||||||
_this2.element.removeAttribute('aria-describedby');
|
_this2.element.removeAttribute('aria-describedby');
|
||||||
|
|
||||||
$(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
|
EventHandler.trigger(_this2.element, _this2.constructor.Event.HIDDEN);
|
||||||
|
|
||||||
if (_this2._popper !== null) {
|
if (_this2._popper !== null) {
|
||||||
_this2._popper.destroy();
|
_this2._popper.destroy();
|
||||||
|
@ -500,26 +630,29 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(this.element).trigger(hideEvent);
|
var hideEvent = EventHandler.trigger(this.element, this.constructor.Event.HIDE);
|
||||||
|
|
||||||
if (hideEvent.isDefaultPrevented()) {
|
if (hideEvent.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(tip).removeClass(ClassName.SHOW); // If this is a touch-enabled device we remove the extra
|
tip.classList.remove(ClassName.SHOW); // If this is a touch-enabled device we remove the extra
|
||||||
// empty mouseover listeners we added for iOS support
|
// empty mouseover listeners we added for iOS support
|
||||||
|
|
||||||
if ('ontouchstart' in document.documentElement) {
|
if ('ontouchstart' in document.documentElement) {
|
||||||
$(document.body).children().off('mouseover', null, $.noop);
|
makeArray(document.body.children).forEach(function (element) {
|
||||||
|
return EventHandler.off(element, 'mouseover', noop);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this._activeTrigger[Trigger.CLICK] = false;
|
this._activeTrigger[Trigger.CLICK] = false;
|
||||||
this._activeTrigger[Trigger.FOCUS] = false;
|
this._activeTrigger[Trigger.FOCUS] = false;
|
||||||
this._activeTrigger[Trigger.HOVER] = false;
|
this._activeTrigger[Trigger.HOVER] = false;
|
||||||
|
|
||||||
if ($(this.tip).hasClass(ClassName.FADE)) {
|
if (this.tip.classList.contains(ClassName.FADE)) {
|
||||||
var transitionDuration = Util.getTransitionDurationFromElement(tip);
|
var transitionDuration = getTransitionDurationFromElement(tip);
|
||||||
$(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
EventHandler.one(tip, TRANSITION_END, complete);
|
||||||
|
emulateTransitionEnd(tip, transitionDuration);
|
||||||
} else {
|
} else {
|
||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
|
@ -539,29 +672,45 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.addAttachmentClass = function addAttachmentClass(attachment) {
|
_proto.addAttachmentClass = function addAttachmentClass(attachment) {
|
||||||
$(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
|
this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.getTipElement = function getTipElement() {
|
_proto.getTipElement = function getTipElement() {
|
||||||
this.tip = this.tip || $(this.config.template)[0];
|
if (this.tip) {
|
||||||
|
return this.tip;
|
||||||
|
}
|
||||||
|
|
||||||
|
var element = document.createElement('div');
|
||||||
|
element.innerHTML = this.config.template;
|
||||||
|
this.tip = element.children[0];
|
||||||
return this.tip;
|
return this.tip;
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.setContent = function setContent() {
|
_proto.setContent = function setContent() {
|
||||||
var tip = this.getTipElement();
|
var tip = this.getTipElement();
|
||||||
this.setElementContent($(tip.querySelectorAll(Selector.TOOLTIP_INNER)), this.getTitle());
|
this.setElementContent(SelectorEngine.findOne(Selector.TOOLTIP_INNER, tip), this.getTitle());
|
||||||
$(tip).removeClass(ClassName.FADE + " " + ClassName.SHOW);
|
tip.classList.remove(ClassName.FADE);
|
||||||
|
tip.classList.remove(ClassName.SHOW);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto.setElementContent = function setElementContent($element, content) {
|
_proto.setElementContent = function setElementContent(element, content) {
|
||||||
|
if (element === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof content === 'object' && (content.nodeType || content.jquery)) {
|
if (typeof content === 'object' && (content.nodeType || content.jquery)) {
|
||||||
// Content is a DOM node or a jQuery
|
if (content.jquery) {
|
||||||
|
content = content[0];
|
||||||
|
} // content is a DOM node or a jQuery
|
||||||
|
|
||||||
|
|
||||||
if (this.config.html) {
|
if (this.config.html) {
|
||||||
if (!$(content).parent().is($element)) {
|
if (content.parentNode !== element) {
|
||||||
$element.empty().append(content);
|
element.innerHTML = '';
|
||||||
|
element.appendChild(content);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$element.text($(content).text());
|
element.innerText = content.textContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -572,9 +721,9 @@
|
||||||
content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
|
content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
|
||||||
}
|
}
|
||||||
|
|
||||||
$element.html(content);
|
element.innerHTML = content;
|
||||||
} else {
|
} else {
|
||||||
$element.text(content);
|
element.innerText = content;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -611,11 +760,11 @@
|
||||||
return document.body;
|
return document.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Util.isElement(this.config.container)) {
|
if (isElement(this.config.container)) {
|
||||||
return $(this.config.container);
|
return this.config.container;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $(document).find(this.config.container);
|
return SelectorEngine.findOne(this.config.container);
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getAttachment = function _getAttachment(placement) {
|
_proto._getAttachment = function _getAttachment(placement) {
|
||||||
|
@ -628,20 +777,21 @@
|
||||||
var triggers = this.config.trigger.split(' ');
|
var triggers = this.config.trigger.split(' ');
|
||||||
triggers.forEach(function (trigger) {
|
triggers.forEach(function (trigger) {
|
||||||
if (trigger === 'click') {
|
if (trigger === 'click') {
|
||||||
$(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) {
|
EventHandler.on(_this4.element, _this4.constructor.Event.CLICK, _this4.config.selector, function (event) {
|
||||||
return _this4.toggle(event);
|
return _this4.toggle(event);
|
||||||
});
|
});
|
||||||
} else if (trigger !== Trigger.MANUAL) {
|
} else if (trigger !== Trigger.MANUAL) {
|
||||||
var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN;
|
var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN;
|
||||||
var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT;
|
var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT;
|
||||||
$(_this4.element).on(eventIn, _this4.config.selector, function (event) {
|
EventHandler.on(_this4.element, eventIn, _this4.config.selector, function (event) {
|
||||||
return _this4._enter(event);
|
return _this4._enter(event);
|
||||||
}).on(eventOut, _this4.config.selector, function (event) {
|
});
|
||||||
|
EventHandler.on(_this4.element, eventOut, _this4.config.selector, function (event) {
|
||||||
return _this4._leave(event);
|
return _this4._leave(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(this.element).closest('.modal').on('hide.bs.modal', function () {
|
EventHandler.on(SelectorEngine.closest(this.element, '.modal'), 'hide.bs.modal', function () {
|
||||||
if (_this4.element) {
|
if (_this4.element) {
|
||||||
_this4.hide();
|
_this4.hide();
|
||||||
}
|
}
|
||||||
|
@ -668,18 +818,18 @@
|
||||||
|
|
||||||
_proto._enter = function _enter(event, context) {
|
_proto._enter = function _enter(event, context) {
|
||||||
var dataKey = this.constructor.DATA_KEY;
|
var dataKey = this.constructor.DATA_KEY;
|
||||||
context = context || $(event.currentTarget).data(dataKey);
|
context = context || Data.getData(event.delegateTarget, dataKey);
|
||||||
|
|
||||||
if (!context) {
|
if (!context) {
|
||||||
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
||||||
$(event.currentTarget).data(dataKey, context);
|
Data.setData(event.delegateTarget, dataKey, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
|
context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) {
|
if (context.getTipElement().classList.contains(ClassName.SHOW) || context._hoverState === HoverState.SHOW) {
|
||||||
context._hoverState = HoverState.SHOW;
|
context._hoverState = HoverState.SHOW;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -701,11 +851,11 @@
|
||||||
|
|
||||||
_proto._leave = function _leave(event, context) {
|
_proto._leave = function _leave(event, context) {
|
||||||
var dataKey = this.constructor.DATA_KEY;
|
var dataKey = this.constructor.DATA_KEY;
|
||||||
context = context || $(event.currentTarget).data(dataKey);
|
context = context || Data.getData(event.delegateTarget, dataKey);
|
||||||
|
|
||||||
if (!context) {
|
if (!context) {
|
||||||
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
||||||
$(event.currentTarget).data(dataKey, context);
|
Data.setData(event.delegateTarget, dataKey, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
|
@ -742,12 +892,17 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._getConfig = function _getConfig(config) {
|
_proto._getConfig = function _getConfig(config) {
|
||||||
var dataAttributes = $(this.element).data();
|
var dataAttributes = Manipulator.getDataAttributes(this.element);
|
||||||
Object.keys(dataAttributes).forEach(function (dataAttr) {
|
Object.keys(dataAttributes).forEach(function (dataAttr) {
|
||||||
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
|
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
|
||||||
delete dataAttributes[dataAttr];
|
delete dataAttributes[dataAttr];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (config && typeof config.container === 'object' && config.container.jquery) {
|
||||||
|
config.container = config.container[0];
|
||||||
|
}
|
||||||
|
|
||||||
config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
|
config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
|
||||||
|
|
||||||
if (typeof config.delay === 'number') {
|
if (typeof config.delay === 'number') {
|
||||||
|
@ -765,7 +920,7 @@
|
||||||
config.content = config.content.toString();
|
config.content = config.content.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
||||||
|
|
||||||
if (config.sanitize) {
|
if (config.sanitize) {
|
||||||
config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
|
config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
|
||||||
|
@ -789,11 +944,15 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
_proto._cleanTipClass = function _cleanTipClass() {
|
_proto._cleanTipClass = function _cleanTipClass() {
|
||||||
var $tip = $(this.getTipElement());
|
var tip = this.getTipElement();
|
||||||
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
|
var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
||||||
|
|
||||||
if (tabClass !== null && tabClass.length) {
|
if (tabClass !== null && tabClass.length) {
|
||||||
$tip.removeClass(tabClass.join(''));
|
tabClass.map(function (token) {
|
||||||
|
return token.trim();
|
||||||
|
}).forEach(function (tClass) {
|
||||||
|
return tip.classList.remove(tClass);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -814,7 +973,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(tip).removeClass(ClassName.FADE);
|
tip.classList.remove(ClassName.FADE);
|
||||||
this.config.animation = false;
|
this.config.animation = false;
|
||||||
this.hide();
|
this.hide();
|
||||||
this.show();
|
this.show();
|
||||||
|
@ -824,7 +983,7 @@
|
||||||
|
|
||||||
Tooltip._jQueryInterface = function _jQueryInterface(config) {
|
Tooltip._jQueryInterface = function _jQueryInterface(config) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var data = $(this).data(DATA_KEY);
|
var data = Data.getData(this, DATA_KEY);
|
||||||
|
|
||||||
var _config = typeof config === 'object' && config;
|
var _config = typeof config === 'object' && config;
|
||||||
|
|
||||||
|
@ -834,7 +993,6 @@
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
data = new Tooltip(this, _config);
|
data = new Tooltip(this, _config);
|
||||||
$(this).data(DATA_KEY, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
|
@ -847,6 +1005,10 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Tooltip._getInstance = function _getInstance(element) {
|
||||||
|
return Data.getData(element, DATA_KEY);
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(Tooltip, null, [{
|
_createClass(Tooltip, null, [{
|
||||||
key: "VERSION",
|
key: "VERSION",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
@ -870,7 +1032,7 @@
|
||||||
}, {
|
}, {
|
||||||
key: "Event",
|
key: "Event",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return Event;
|
return Event$1;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: "EVENT_KEY",
|
key: "EVENT_KEY",
|
||||||
|
@ -890,16 +1052,20 @@
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
* jQuery
|
* jQuery
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
* add .tooltip to jQuery only if jQuery is present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$.fn[NAME] = Tooltip._jQueryInterface;
|
if (typeof jQuery !== 'undefined') {
|
||||||
$.fn[NAME].Constructor = Tooltip;
|
var JQUERY_NO_CONFLICT = jQuery.fn[NAME];
|
||||||
|
jQuery.fn[NAME] = Tooltip._jQueryInterface;
|
||||||
|
jQuery.fn[NAME].Constructor = Tooltip;
|
||||||
|
|
||||||
$.fn[NAME].noConflict = function () {
|
jQuery.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
jQuery.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return Tooltip._jQueryInterface;
|
return Tooltip._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Tooltip;
|
return Tooltip;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,172 +0,0 @@
|
||||||
/*!
|
|
||||||
* Bootstrap util.js v4.3.1 (https://getbootstrap.com/)
|
|
||||||
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
||||||
*/
|
|
||||||
(function (global, factory) {
|
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :
|
|
||||||
typeof define === 'function' && define.amd ? define(['jquery'], factory) :
|
|
||||||
(global = global || self, global.Util = factory(global.jQuery));
|
|
||||||
}(this, function ($) { 'use strict';
|
|
||||||
|
|
||||||
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
* Bootstrap (v4.3.1): util.js
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* ------------------------------------------------------------------------
|
|
||||||
* Private TransitionEnd Helpers
|
|
||||||
* ------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
var TRANSITION_END = 'transitionend';
|
|
||||||
var MAX_UID = 1000000;
|
|
||||||
var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
|
||||||
|
|
||||||
function toType(obj) {
|
|
||||||
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSpecialTransitionEndEvent() {
|
|
||||||
return {
|
|
||||||
bindType: TRANSITION_END,
|
|
||||||
delegateType: TRANSITION_END,
|
|
||||||
handle: function handle(event) {
|
|
||||||
if ($(event.target).is(this)) {
|
|
||||||
return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined; // eslint-disable-line no-undefined
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function transitionEndEmulator(duration) {
|
|
||||||
var _this = this;
|
|
||||||
|
|
||||||
var called = false;
|
|
||||||
$(this).one(Util.TRANSITION_END, function () {
|
|
||||||
called = true;
|
|
||||||
});
|
|
||||||
setTimeout(function () {
|
|
||||||
if (!called) {
|
|
||||||
Util.triggerTransitionEnd(_this);
|
|
||||||
}
|
|
||||||
}, duration);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setTransitionEndSupport() {
|
|
||||||
$.fn.emulateTransitionEnd = transitionEndEmulator;
|
|
||||||
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
* Public Util Api
|
|
||||||
* --------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
var Util = {
|
|
||||||
TRANSITION_END: 'bsTransitionEnd',
|
|
||||||
getUID: function getUID(prefix) {
|
|
||||||
do {
|
|
||||||
// eslint-disable-next-line no-bitwise
|
|
||||||
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
|
|
||||||
} while (document.getElementById(prefix));
|
|
||||||
|
|
||||||
return prefix;
|
|
||||||
},
|
|
||||||
getSelectorFromElement: function getSelectorFromElement(element) {
|
|
||||||
var selector = element.getAttribute('data-target');
|
|
||||||
|
|
||||||
if (!selector || selector === '#') {
|
|
||||||
var hrefAttr = element.getAttribute('href');
|
|
||||||
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return document.querySelector(selector) ? selector : null;
|
|
||||||
} catch (err) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
|
|
||||||
if (!element) {
|
|
||||||
return 0;
|
|
||||||
} // Get transition-duration of the element
|
|
||||||
|
|
||||||
|
|
||||||
var transitionDuration = $(element).css('transition-duration');
|
|
||||||
var transitionDelay = $(element).css('transition-delay');
|
|
||||||
var floatTransitionDuration = parseFloat(transitionDuration);
|
|
||||||
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
|
||||||
|
|
||||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
|
||||||
return 0;
|
|
||||||
} // If multiple durations are defined, take the first
|
|
||||||
|
|
||||||
|
|
||||||
transitionDuration = transitionDuration.split(',')[0];
|
|
||||||
transitionDelay = transitionDelay.split(',')[0];
|
|
||||||
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
|
||||||
},
|
|
||||||
reflow: function reflow(element) {
|
|
||||||
return element.offsetHeight;
|
|
||||||
},
|
|
||||||
triggerTransitionEnd: function triggerTransitionEnd(element) {
|
|
||||||
$(element).trigger(TRANSITION_END);
|
|
||||||
},
|
|
||||||
// TODO: Remove in v5
|
|
||||||
supportsTransitionEnd: function supportsTransitionEnd() {
|
|
||||||
return Boolean(TRANSITION_END);
|
|
||||||
},
|
|
||||||
isElement: function isElement(obj) {
|
|
||||||
return (obj[0] || obj).nodeType;
|
|
||||||
},
|
|
||||||
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
|
|
||||||
for (var property in configTypes) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
|
|
||||||
var expectedTypes = configTypes[property];
|
|
||||||
var value = config[property];
|
|
||||||
var valueType = value && Util.isElement(value) ? 'element' : toType(value);
|
|
||||||
|
|
||||||
if (!new RegExp(expectedTypes).test(valueType)) {
|
|
||||||
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
findShadowRoot: function findShadowRoot(element) {
|
|
||||||
if (!document.documentElement.attachShadow) {
|
|
||||||
return null;
|
|
||||||
} // Can find the shadow root otherwise it'll return the document
|
|
||||||
|
|
||||||
|
|
||||||
if (typeof element.getRootNode === 'function') {
|
|
||||||
var root = element.getRootNode();
|
|
||||||
return root instanceof ShadowRoot ? root : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (element instanceof ShadowRoot) {
|
|
||||||
return element;
|
|
||||||
} // when we don't find a shadow root
|
|
||||||
|
|
||||||
|
|
||||||
if (!element.parentNode) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Util.findShadowRoot(element.parentNode);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
setTransitionEndSupport();
|
|
||||||
|
|
||||||
return Util;
|
|
||||||
|
|
||||||
}));
|
|
||||||
//# sourceMappingURL=util.js.map
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -35,9 +35,7 @@ h1, h2, h3, h4, h5, h6 {
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-scroller .nav {
|
.nav-scroller .nav {
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
-ms-flex-wrap: nowrap;
|
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
padding-bottom: 1rem;
|
padding-bottom: 1rem;
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
|
@ -59,7 +57,6 @@ h1, h2, h3, h4, h5, h6 {
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex-auto {
|
.flex-auto {
|
||||||
-ms-flex: 0 0 auto;
|
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-shadow: 0 .05rem .1rem rgba(0, 0, 0, .5);
|
text-shadow: 0 .05rem .1rem rgba(0, 0, 0, .5);
|
||||||
|
|
|
@ -4,9 +4,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-top: 40px;
|
padding-top: 40px;
|
||||||
padding-bottom: 40px;
|
padding-bottom: 40px;
|
||||||
|
|
|
@ -38,9 +38,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-scroller .nav {
|
.nav-scroller .nav {
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
-ms-flex-wrap: nowrap;
|
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
padding-bottom: 1rem;
|
padding-bottom: 1rem;
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
|
|
|
@ -61,12 +61,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.flex-equal > * {
|
.flex-equal > * {
|
||||||
-ms-flex: 1;
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 768px) {
|
||||||
.flex-md-equal > * {
|
.flex-md-equal > * {
|
||||||
-ms-flex: 1;
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
-ms-flex-align: center;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-top: 40px;
|
padding-top: 40px;
|
||||||
padding-bottom: 40px;
|
padding-bottom: 40px;
|
||||||
|
|
Loading…
Reference in New Issue