aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/src
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/js/src')
-rw-r--r--vendor/twbs/bootstrap/js/src/alert.js4
-rw-r--r--vendor/twbs/bootstrap/js/src/button.js92
-rw-r--r--vendor/twbs/bootstrap/js/src/carousel.js6
-rw-r--r--vendor/twbs/bootstrap/js/src/collapse.js4
-rw-r--r--vendor/twbs/bootstrap/js/src/dropdown.js79
-rw-r--r--vendor/twbs/bootstrap/js/src/index.js20
-rw-r--r--vendor/twbs/bootstrap/js/src/modal.js46
-rw-r--r--vendor/twbs/bootstrap/js/src/popover.js4
-rw-r--r--vendor/twbs/bootstrap/js/src/scrollspy.js4
-rw-r--r--vendor/twbs/bootstrap/js/src/tab.js4
-rw-r--r--vendor/twbs/bootstrap/js/src/toast.js33
-rw-r--r--vendor/twbs/bootstrap/js/src/tools/sanitizer.js2
-rw-r--r--vendor/twbs/bootstrap/js/src/tooltip.js81
-rw-r--r--vendor/twbs/bootstrap/js/src/util.js20
14 files changed, 242 insertions, 157 deletions
diff --git a/vendor/twbs/bootstrap/js/src/alert.js b/vendor/twbs/bootstrap/js/src/alert.js
index 64e8e3843..57ab676f9 100644
--- a/vendor/twbs/bootstrap/js/src/alert.js
+++ b/vendor/twbs/bootstrap/js/src/alert.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): alert.js
+ * Bootstrap (v4.4.1): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'alert'
-const VERSION = '4.3.1'
+const VERSION = '4.4.1'
const DATA_KEY = 'bs.alert'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
diff --git a/vendor/twbs/bootstrap/js/src/button.js b/vendor/twbs/bootstrap/js/src/button.js
index fcf805502..f5b4fa0a7 100644
--- a/vendor/twbs/bootstrap/js/src/button.js
+++ b/vendor/twbs/bootstrap/js/src/button.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): button.js
+ * Bootstrap (v4.4.1): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -14,7 +14,7 @@ import $ from 'jquery'
*/
const NAME = 'button'
-const VERSION = '4.3.1'
+const VERSION = '4.4.1'
const DATA_KEY = 'bs.button'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
@@ -27,17 +27,20 @@ const ClassName = {
}
const Selector = {
- DATA_TOGGLE_CARROT : '[data-toggle^="button"]',
- DATA_TOGGLE : '[data-toggle="buttons"]',
- INPUT : 'input:not([type="hidden"])',
- ACTIVE : '.active',
- BUTTON : '.btn'
+ DATA_TOGGLE_CARROT : '[data-toggle^="button"]',
+ DATA_TOGGLES : '[data-toggle="buttons"]',
+ DATA_TOGGLE : '[data-toggle="button"]',
+ DATA_TOGGLES_BUTTONS : '[data-toggle="buttons"] .btn',
+ INPUT : 'input:not([type="hidden"])',
+ ACTIVE : '.active',
+ BUTTON : '.btn'
}
const Event = {
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}`
+ `blur${EVENT_KEY}${DATA_API_KEY}`,
+ LOAD_DATA_API : `load${EVENT_KEY}${DATA_API_KEY}`
}
/**
@@ -63,7 +66,7 @@ class Button {
let triggerChangeEvent = true
let addAriaPressed = true
const rootElement = $(this._element).closest(
- Selector.DATA_TOGGLE
+ Selector.DATA_TOGGLES
)[0]
if (rootElement) {
@@ -81,15 +84,16 @@ class Button {
$(activeElement).removeClass(ClassName.ACTIVE)
}
}
+ } else if (input.type === 'checkbox') {
+ if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName.ACTIVE)) {
+ triggerChangeEvent = false
+ }
+ } else {
+ // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
+ triggerChangeEvent = false
}
if (triggerChangeEvent) {
- if (input.hasAttribute('disabled') ||
- rootElement.hasAttribute('disabled') ||
- input.classList.contains('disabled') ||
- rootElement.classList.contains('disabled')) {
- return
- }
input.checked = !this._element.classList.contains(ClassName.ACTIVE)
$(input).trigger('change')
}
@@ -99,13 +103,15 @@ class Button {
}
}
- if (addAriaPressed) {
- this._element.setAttribute('aria-pressed',
- !this._element.classList.contains(ClassName.ACTIVE))
- }
+ if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
+ if (addAriaPressed) {
+ this._element.setAttribute('aria-pressed',
+ !this._element.classList.contains(ClassName.ACTIVE))
+ }
- if (triggerChangeEvent) {
- $(this._element).toggleClass(ClassName.ACTIVE)
+ if (triggerChangeEvent) {
+ $(this._element).toggleClass(ClassName.ACTIVE)
+ }
}
}
@@ -140,21 +146,57 @@ class Button {
$(document)
.on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, (event) => {
- event.preventDefault()
-
let button = event.target
if (!$(button).hasClass(ClassName.BUTTON)) {
- button = $(button).closest(Selector.BUTTON)
+ button = $(button).closest(Selector.BUTTON)[0]
}
- Button._jQueryInterface.call($(button), 'toggle')
+ if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
+ event.preventDefault() // work around Firefox bug #1540995
+ } else {
+ const inputBtn = button.querySelector(Selector.INPUT)
+
+ if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
+ event.preventDefault() // work around Firefox bug #1540995
+ return
+ }
+
+ Button._jQueryInterface.call($(button), 'toggle')
+ }
})
.on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, (event) => {
const button = $(event.target).closest(Selector.BUTTON)[0]
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type))
})
+$(window).on(Event.LOAD_DATA_API, () => {
+ // ensure correct active class is set to match the controls' actual values/states
+
+ // find all checkboxes/readio buttons inside data-toggle groups
+ let buttons = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLES_BUTTONS))
+ for (let i = 0, len = buttons.length; i < len; i++) {
+ const button = buttons[i]
+ const input = button.querySelector(Selector.INPUT)
+ if (input.checked || input.hasAttribute('checked')) {
+ button.classList.add(ClassName.ACTIVE)
+ } else {
+ button.classList.remove(ClassName.ACTIVE)
+ }
+ }
+
+ // find all button toggles
+ buttons = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE))
+ for (let i = 0, len = buttons.length; i < len; i++) {
+ const button = buttons[i]
+ if (button.getAttribute('aria-pressed') === 'true') {
+ button.classList.add(ClassName.ACTIVE)
+ } else {
+ button.classList.remove(ClassName.ACTIVE)
+ }
+ }
+})
+
/**
* ------------------------------------------------------------------------
* jQuery
diff --git a/vendor/twbs/bootstrap/js/src/carousel.js b/vendor/twbs/bootstrap/js/src/carousel.js
index 36176dd9c..74c410168 100644
--- a/vendor/twbs/bootstrap/js/src/carousel.js
+++ b/vendor/twbs/bootstrap/js/src/carousel.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): carousel.js
+ * Bootstrap (v4.4.1): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'carousel'
-const VERSION = '4.3.1'
+const VERSION = '4.4.1'
const DATA_KEY = 'bs.carousel'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
@@ -245,6 +245,8 @@ class Carousel {
const direction = absDeltax / this.touchDeltaX
+ this.touchDeltaX = 0
+
// swipe left
if (direction > 0) {
this.prev()
diff --git a/vendor/twbs/bootstrap/js/src/collapse.js b/vendor/twbs/bootstrap/js/src/collapse.js
index 10df450d0..8abab3f1d 100644
--- a/vendor/twbs/bootstrap/js/src/collapse.js
+++ b/vendor/twbs/bootstrap/js/src/collapse.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): collapse.js
+ * Bootstrap (v4.4.1): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'collapse'
-const VERSION = '4.3.1'
+const VERSION = '4.4.1'
const DATA_KEY = 'bs.collapse'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
diff --git a/vendor/twbs/bootstrap/js/src/dropdown.js b/vendor/twbs/bootstrap/js/src/dropdown.js
index d336a46d9..f907c0849 100644
--- a/vendor/twbs/bootstrap/js/src/dropdown.js
+++ b/vendor/twbs/bootstrap/js/src/dropdown.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): dropdown.js
+ * Bootstrap (v4.4.1): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -16,7 +16,7 @@ import Util from './util'
*/
const NAME = 'dropdown'
-const VERSION = '4.3.1'
+const VERSION = '4.4.1'
const DATA_KEY = 'bs.dropdown'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
@@ -71,19 +71,21 @@ const AttachmentMap = {
}
const Default = {
- offset : 0,
- flip : true,
- boundary : 'scrollParent',
- reference : 'toggle',
- display : 'dynamic'
+ offset : 0,
+ flip : true,
+ boundary : 'scrollParent',
+ reference : 'toggle',
+ display : 'dynamic',
+ popperConfig : null
}
const DefaultType = {
- offset : '(number|string|function)',
- flip : 'boolean',
- boundary : '(string|element)',
- reference : '(string|element)',
- display : 'string'
+ offset : '(number|string|function)',
+ flip : 'boolean',
+ boundary : '(string|element)',
+ reference : '(string|element)',
+ display : 'string',
+ popperConfig : '(null|object)'
}
/**
@@ -124,7 +126,6 @@ class Dropdown {
return
}
- const parent = Dropdown._getParentFromElement(this._element)
const isActive = $(this._menu).hasClass(ClassName.SHOW)
Dropdown._clearMenus()
@@ -133,10 +134,19 @@ class Dropdown {
return
}
+ this.show(true)
+ }
+
+ show(usePopper = false) {
+ if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED) || $(this._menu).hasClass(ClassName.SHOW)) {
+ return
+ }
+
const relatedTarget = {
relatedTarget: this._element
}
const showEvent = $.Event(Event.SHOW, relatedTarget)
+ const parent = Dropdown._getParentFromElement(this._element)
$(parent).trigger(showEvent)
@@ -145,7 +155,7 @@ class Dropdown {
}
// Disable totally Popper.js for Dropdown in Navbar
- if (!this._inNavbar) {
+ if (!this._inNavbar && usePopper) {
/**
* Check for Popper dependency
* Popper - https://popper.js.org
@@ -194,29 +204,6 @@ class Dropdown {
.trigger($.Event(Event.SHOWN, relatedTarget))
}
- show() {
- if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED) || $(this._menu).hasClass(ClassName.SHOW)) {
- return
- }
-
- const relatedTarget = {
- relatedTarget: this._element
- }
- const showEvent = $.Event(Event.SHOW, relatedTarget)
- const parent = Dropdown._getParentFromElement(this._element)
-
- $(parent).trigger(showEvent)
-
- if (showEvent.isDefaultPrevented()) {
- return
- }
-
- $(this._menu).toggleClass(ClassName.SHOW)
- $(parent)
- .toggleClass(ClassName.SHOW)
- .trigger($.Event(Event.SHOWN, relatedTarget))
- }
-
hide() {
if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED) || !$(this._menu).hasClass(ClassName.SHOW)) {
return
@@ -234,6 +221,10 @@ class Dropdown {
return
}
+ if (this._popper) {
+ this._popper.destroy()
+ }
+
$(this._menu).toggleClass(ClassName.SHOW)
$(parent)
.toggleClass(ClassName.SHOW)
@@ -359,7 +350,10 @@ class Dropdown {
}
}
- return popperConfig
+ return {
+ ...popperConfig,
+ ...this._config.popperConfig
+ }
}
// Static
@@ -431,6 +425,10 @@ class Dropdown {
toggles[i].setAttribute('aria-expanded', 'false')
+ if (context._popper) {
+ context._popper.destroy()
+ }
+
$(dropdownMenu).removeClass(ClassName.SHOW)
$(parent)
.removeClass(ClassName.SHOW)
@@ -475,6 +473,10 @@ class Dropdown {
const parent = Dropdown._getParentFromElement(this)
const isActive = $(parent).hasClass(ClassName.SHOW)
+ if (!isActive && event.which === ESCAPE_KEYCODE) {
+ return
+ }
+
if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
if (event.which === ESCAPE_KEYCODE) {
const toggle = parent.querySelector(Selector.DATA_TOGGLE)
@@ -486,6 +488,7 @@ class Dropdown {
}
const items = [].slice.call(parent.querySelectorAll(Selector.VISIBLE_ITEMS))
+ .filter((item) => $(item).is(':visible'))
if (items.length === 0) {
return
diff --git a/vendor/twbs/bootstrap/js/src/index.js b/vendor/twbs/bootstrap/js/src/index.js
index c4a4d4b1f..dbba72db3 100644
--- a/vendor/twbs/bootstrap/js/src/index.js
+++ b/vendor/twbs/bootstrap/js/src/index.js
@@ -1,4 +1,3 @@
-import $ from 'jquery'
import Alert from './alert'
import Button from './button'
import Carousel from './carousel'
@@ -14,28 +13,11 @@ import Util from './util'
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): index.js
+ * Bootstrap (v4.4.1): index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
-(() => {
- if (typeof $ === 'undefined') {
- throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.')
- }
-
- const version = $.fn.jquery.split(' ')[0].split('.')
- const minMajor = 1
- const ltMajor = 2
- const minMinor = 9
- const minPatch = 1
- const 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')
- }
-})()
-
export {
Util,
Alert,
diff --git a/vendor/twbs/bootstrap/js/src/modal.js b/vendor/twbs/bootstrap/js/src/modal.js
index 99fe1bf2d..ad925f6ff 100644
--- a/vendor/twbs/bootstrap/js/src/modal.js
+++ b/vendor/twbs/bootstrap/js/src/modal.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): modal.js
+ * Bootstrap (v4.4.1): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'modal'
-const VERSION = '4.3.1'
+const VERSION = '4.4.1'
const DATA_KEY = 'bs.modal'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
@@ -38,6 +38,7 @@ const DefaultType = {
const Event = {
HIDE : `hide${EVENT_KEY}`,
+ HIDE_PREVENTED : `hidePrevented${EVENT_KEY}`,
HIDDEN : `hidden${EVENT_KEY}`,
SHOW : `show${EVENT_KEY}`,
SHOWN : `shown${EVENT_KEY}`,
@@ -56,7 +57,8 @@ const ClassName = {
BACKDROP : 'modal-backdrop',
OPEN : 'modal-open',
FADE : 'fade',
- SHOW : 'show'
+ SHOW : 'show',
+ STATIC : 'modal-static'
}
const Selector = {
@@ -234,8 +236,32 @@ class Modal {
return config
}
+ _triggerBackdropTransition() {
+ if (this._config.backdrop === 'static') {
+ const hideEventPrevented = $.Event(Event.HIDE_PREVENTED)
+
+ $(this._element).trigger(hideEventPrevented)
+ if (hideEventPrevented.defaultPrevented) {
+ return
+ }
+
+ this._element.classList.add(ClassName.STATIC)
+
+ const modalTransitionDuration = Util.getTransitionDurationFromElement(this._element)
+
+ $(this._element).one(Util.TRANSITION_END, () => {
+ this._element.classList.remove(ClassName.STATIC)
+ })
+ .emulateTransitionEnd(modalTransitionDuration)
+ this._element.focus()
+ } else {
+ this.hide()
+ }
+ }
+
_showElement(relatedTarget) {
const transition = $(this._element).hasClass(ClassName.FADE)
+ const modalBody = this._dialog ? this._dialog.querySelector(Selector.MODAL_BODY) : null
if (!this._element.parentNode ||
this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
@@ -247,8 +273,8 @@ class Modal {
this._element.removeAttribute('aria-hidden')
this._element.setAttribute('aria-modal', true)
- if ($(this._dialog).hasClass(ClassName.SCROLLABLE)) {
- this._dialog.querySelector(Selector.MODAL_BODY).scrollTop = 0
+ if ($(this._dialog).hasClass(ClassName.SCROLLABLE) && modalBody) {
+ modalBody.scrollTop = 0
} else {
this._element.scrollTop = 0
}
@@ -302,8 +328,7 @@ class Modal {
if (this._isShown && this._config.keyboard) {
$(this._element).on(Event.KEYDOWN_DISMISS, (event) => {
if (event.which === ESCAPE_KEYCODE) {
- event.preventDefault()
- this.hide()
+ this._triggerBackdropTransition()
}
})
} else if (!this._isShown) {
@@ -361,11 +386,8 @@ class Modal {
if (event.target !== event.currentTarget) {
return
}
- if (this._config.backdrop === 'static') {
- this._element.focus()
- } else {
- this.hide()
- }
+
+ this._triggerBackdropTransition()
})
if (animate) {
diff --git a/vendor/twbs/bootstrap/js/src/popover.js b/vendor/twbs/bootstrap/js/src/popover.js
index 98f2f3fbe..570dba991 100644
--- a/vendor/twbs/bootstrap/js/src/popover.js
+++ b/vendor/twbs/bootstrap/js/src/popover.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): popover.js
+ * Bootstrap (v4.4.1): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Tooltip from './tooltip'
*/
const NAME = 'popover'
-const VERSION = '4.3.1'
+const VERSION = '4.4.1'
const DATA_KEY = 'bs.popover'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
diff --git a/vendor/twbs/bootstrap/js/src/scrollspy.js b/vendor/twbs/bootstrap/js/src/scrollspy.js
index e8cd6bf98..e9b6c8cd2 100644
--- a/vendor/twbs/bootstrap/js/src/scrollspy.js
+++ b/vendor/twbs/bootstrap/js/src/scrollspy.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): scrollspy.js
+ * Bootstrap (v4.4.1): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'scrollspy'
-const VERSION = '4.3.1'
+const VERSION = '4.4.1'
const DATA_KEY = 'bs.scrollspy'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
diff --git a/vendor/twbs/bootstrap/js/src/tab.js b/vendor/twbs/bootstrap/js/src/tab.js
index 8421e0a43..12347b78c 100644
--- a/vendor/twbs/bootstrap/js/src/tab.js
+++ b/vendor/twbs/bootstrap/js/src/tab.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): tab.js
+ * Bootstrap (v4.4.1): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'tab'
-const VERSION = '4.3.1'
+const VERSION = '4.4.1'
const DATA_KEY = 'bs.tab'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
diff --git a/vendor/twbs/bootstrap/js/src/toast.js b/vendor/twbs/bootstrap/js/src/toast.js
index 4aef2d40c..6e2a00783 100644
--- a/vendor/twbs/bootstrap/js/src/toast.js
+++ b/vendor/twbs/bootstrap/js/src/toast.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): toast.js
+ * Bootstrap (v4.4.1): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@ import Util from './util'
*/
const NAME = 'toast'
-const VERSION = '4.3.1'
+const VERSION = '4.4.1'
const DATA_KEY = 'bs.toast'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
@@ -82,7 +82,12 @@ class Toast {
// Public
show() {
- $(this._element).trigger(Event.SHOW)
+ const showEvent = $.Event(Event.SHOW)
+
+ $(this._element).trigger(showEvent)
+ if (showEvent.isDefaultPrevented()) {
+ return
+ }
if (this._config.animation) {
this._element.classList.add(ClassName.FADE)
@@ -95,11 +100,14 @@ class Toast {
$(this._element).trigger(Event.SHOWN)
if (this._config.autohide) {
- this.hide()
+ this._timeout = setTimeout(() => {
+ this.hide()
+ }, this._config.delay)
}
}
this._element.classList.remove(ClassName.HIDE)
+ Util.reflow(this._element)
this._element.classList.add(ClassName.SHOWING)
if (this._config.animation) {
const transitionDuration = Util.getTransitionDurationFromElement(this._element)
@@ -112,20 +120,19 @@ class Toast {
}
}
- hide(withoutTimeout) {
+ hide() {
if (!this._element.classList.contains(ClassName.SHOW)) {
return
}
- $(this._element).trigger(Event.HIDE)
+ const hideEvent = $.Event(Event.HIDE)
- if (withoutTimeout) {
- this._close()
- } else {
- this._timeout = setTimeout(() => {
- this._close()
- }, this._config.delay)
+ $(this._element).trigger(hideEvent)
+ if (hideEvent.isDefaultPrevented()) {
+ return
}
+
+ this._close()
}
dispose() {
@@ -165,7 +172,7 @@ class Toast {
$(this._element).on(
Event.CLICK_DISMISS,
Selector.DATA_DISMISS,
- () => this.hide(true)
+ () => this.hide()
)
}
diff --git a/vendor/twbs/bootstrap/js/src/tools/sanitizer.js b/vendor/twbs/bootstrap/js/src/tools/sanitizer.js
index ff78d06a7..797159bcc 100644
--- a/vendor/twbs/bootstrap/js/src/tools/sanitizer.js
+++ b/vendor/twbs/bootstrap/js/src/tools/sanitizer.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): tools/sanitizer.js
+ * Bootstrap (v4.4.1): tools/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
diff --git a/vendor/twbs/bootstrap/js/src/tooltip.js b/vendor/twbs/bootstrap/js/src/tooltip.js
index 81a2dedc6..26fa90603 100644
--- a/vendor/twbs/bootstrap/js/src/tooltip.js
+++ b/vendor/twbs/bootstrap/js/src/tooltip.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): tooltip.js
+ * Bootstrap (v4.4.1): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -20,7 +20,7 @@ import Util from './util'
*/
const NAME = 'tooltip'
-const VERSION = '4.3.1'
+const VERSION = '4.4.1'
const DATA_KEY = 'bs.tooltip'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
@@ -43,7 +43,8 @@ const DefaultType = {
boundary : '(string|element)',
sanitize : 'boolean',
sanitizeFn : '(null|function)',
- whiteList : 'object'
+ whiteList : 'object',
+ popperConfig : '(null|object)'
}
const AttachmentMap = {
@@ -71,7 +72,8 @@ const Default = {
boundary : 'scrollParent',
sanitize : true,
sanitizeFn : null,
- whiteList : DefaultWhitelist
+ whiteList : DefaultWhitelist,
+ popperConfig : null
}
const HoverState = {
@@ -119,10 +121,6 @@ const Trigger = {
class Tooltip {
constructor(element, config) {
- /**
- * Check for Popper dependency
- * Popper - https://popper.js.org
- */
if (typeof Popper === 'undefined') {
throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)')
}
@@ -226,7 +224,7 @@ class Tooltip {
$.removeData(this.element, this.constructor.DATA_KEY)
$(this.element).off(this.constructor.EVENT_KEY)
- $(this.element).closest('.modal').off('hide.bs.modal')
+ $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler)
if (this.tip) {
$(this.tip).remove()
@@ -236,7 +234,7 @@ class Tooltip {
this._timeout = null
this._hoverState = null
this._activeTrigger = null
- if (this._popper !== null) {
+ if (this._popper) {
this._popper.destroy()
}
@@ -293,27 +291,7 @@ class Tooltip {
$(this.element).trigger(this.constructor.Event.INSERTED)
- this._popper = new Popper(this.element, tip, {
- placement: attachment,
- modifiers: {
- offset: this._getOffset(),
- flip: {
- behavior: this.config.fallbackPlacement
- },
- arrow: {
- element: Selector.ARROW
- },
- preventOverflow: {
- boundariesElement: this.config.boundary
- }
- },
- onCreate: (data) => {
- if (data.originalPlacement !== data.placement) {
- this._handlePopperPlacementChange(data)
- }
- },
- onUpdate: (data) => this._handlePopperPlacementChange(data)
- })
+ this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment))
$(tip).addClass(ClassName.SHOW)
@@ -468,6 +446,35 @@ class Tooltip {
// Private
+ _getPopperConfig(attachment) {
+ const defaultBsConfig = {
+ placement: attachment,
+ modifiers: {
+ offset: this._getOffset(),
+ flip: {
+ behavior: this.config.fallbackPlacement
+ },
+ arrow: {
+ element: Selector.ARROW
+ },
+ preventOverflow: {
+ boundariesElement: this.config.boundary
+ }
+ },
+ onCreate: (data) => {
+ if (data.originalPlacement !== data.placement) {
+ this._handlePopperPlacementChange(data)
+ }
+ },
+ onUpdate: (data) => this._handlePopperPlacementChange(data)
+ }
+
+ return {
+ ...defaultBsConfig,
+ ...this.config.popperConfig
+ }
+ }
+
_getOffset() {
const offset = {}
@@ -535,13 +542,15 @@ class Tooltip {
}
})
+ this._hideModalHandler = () => {
+ if (this.element) {
+ this.hide()
+ }
+ }
+
$(this.element).closest('.modal').on(
'hide.bs.modal',
- () => {
- if (this.element) {
- this.hide()
- }
- }
+ this._hideModalHandler
)
if (this.config.selector) {
diff --git a/vendor/twbs/bootstrap/js/src/util.js b/vendor/twbs/bootstrap/js/src/util.js
index d459aa266..d130682e3 100644
--- a/vendor/twbs/bootstrap/js/src/util.js
+++ b/vendor/twbs/bootstrap/js/src/util.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.3.1): util.js
+ * Bootstrap (v4.4.1): util.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -169,9 +169,27 @@ const Util = {
}
return Util.findShadowRoot(element.parentNode)
+ },
+
+ jQueryDetection() {
+ if (typeof $ === 'undefined') {
+ throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.')
+ }
+
+ const version = $.fn.jquery.split(' ')[0].split('.')
+ const minMajor = 1
+ const ltMajor = 2
+ const minMinor = 9
+ const minPatch = 1
+ const 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')
+ }
}
}
+Util.jQueryDetection()
setTransitionEndSupport()
export default Util