1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-30 08:39:56 +02:00
This commit is contained in:
XhmikosR
2020-09-14 18:12:06 +03:00
committed by GitHub
parent 5c25ea647b
commit 4491fb091f
57 changed files with 1243 additions and 1148 deletions

30
js/dist/alert.js vendored
View File

@@ -6,11 +6,13 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js'], factory) :
(global = global || self, global.Alert = factory(global.Data, global.EventHandler));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.Data, global.EventHandler));
}(this, (function (Data, EventHandler) { 'use strict';
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
/**
* --------------------------------------------------------------------------
@@ -125,7 +127,7 @@
this._element = element;
if (this._element) {
Data.setData(element, DATA_KEY, this);
Data__default['default'].setData(element, DATA_KEY, this);
}
} // Getters
@@ -134,11 +136,7 @@
// Public
_proto.close = function close(element) {
var rootElement = this._element;
if (element) {
rootElement = this._getRootElement(element);
}
var rootElement = element ? this._getRootElement(element) : this._element;
var customEvent = this._triggerCloseEvent(rootElement);
@@ -150,7 +148,7 @@
};
_proto.dispose = function dispose() {
Data.removeData(this._element, DATA_KEY);
Data__default['default'].removeData(this._element, DATA_KEY);
this._element = null;
} // Private
;
@@ -160,7 +158,7 @@
};
_proto._triggerCloseEvent = function _triggerCloseEvent(element) {
return EventHandler.trigger(element, EVENT_CLOSE);
return EventHandler__default['default'].trigger(element, EVENT_CLOSE);
};
_proto._removeElement = function _removeElement(element) {
@@ -175,7 +173,7 @@
}
var transitionDuration = getTransitionDurationFromElement(element);
EventHandler.one(element, TRANSITION_END, function () {
EventHandler__default['default'].one(element, TRANSITION_END, function () {
return _this._destroyElement(element);
});
emulateTransitionEnd(element, transitionDuration);
@@ -186,13 +184,13 @@
element.parentNode.removeChild(element);
}
EventHandler.trigger(element, EVENT_CLOSED);
EventHandler__default['default'].trigger(element, EVENT_CLOSED);
} // Static
;
Alert.jQueryInterface = function jQueryInterface(config) {
return this.each(function () {
var data = Data.getData(this, DATA_KEY);
var data = Data__default['default'].getData(this, DATA_KEY);
if (!data) {
data = new Alert(this);
@@ -215,7 +213,7 @@
};
Alert.getInstance = function getInstance(element) {
return Data.getData(element, DATA_KEY);
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Alert, null, [{
@@ -234,7 +232,7 @@
*/
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
var $ = getjQuery();
/**
* ------------------------------------------------------------------------

File diff suppressed because one or more lines are too long

20
js/dist/button.js vendored
View File

@@ -6,11 +6,13 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js'], factory) :
(global = global || self, global.Button = factory(global.Data, global.EventHandler));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.Data, global.EventHandler));
}(this, (function (Data, EventHandler) { 'use strict';
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
/**
* --------------------------------------------------------------------------
@@ -56,7 +58,7 @@
var Button = /*#__PURE__*/function () {
function Button(element) {
this._element = element;
Data.setData(element, DATA_KEY, this);
Data__default['default'].setData(element, DATA_KEY, this);
} // Getters
@@ -69,14 +71,14 @@
};
_proto.dispose = function dispose() {
Data.removeData(this._element, DATA_KEY);
Data__default['default'].removeData(this._element, DATA_KEY);
this._element = null;
} // Static
;
Button.jQueryInterface = function jQueryInterface(config) {
return this.each(function () {
var data = Data.getData(this, DATA_KEY);
var data = Data__default['default'].getData(this, DATA_KEY);
if (!data) {
data = new Button(this);
@@ -89,7 +91,7 @@
};
Button.getInstance = function getInstance(element) {
return Data.getData(element, DATA_KEY);
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Button, null, [{
@@ -108,10 +110,10 @@
*/
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
event.preventDefault();
var button = event.target.closest(SELECTOR_DATA_TOGGLE);
var data = Data.getData(button, DATA_KEY);
var data = Data__default['default'].getData(button, DATA_KEY);
if (!data) {
data = new Button(button);

File diff suppressed because one or more lines are too long

90
js/dist/carousel.js vendored
View File

@@ -6,13 +6,15 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', './dom/selector-engine.js'], factory) :
(global = global || self, global.Carousel = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
/**
* --------------------------------------------------------------------------
@@ -137,11 +139,7 @@
return null;
};
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -233,13 +231,13 @@
this.touchDeltaX = 0;
this._config = this._getConfig(config);
this._element = element;
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
this._indicatorsElement = SelectorEngine__default['default'].findOne(SELECTOR_INDICATORS, this._element);
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
this._pointerEvent = Boolean(window.PointerEvent);
this._addEventListeners();
Data.setData(element, DATA_KEY, this);
Data__default['default'].setData(element, DATA_KEY, this);
} // Getters
@@ -271,7 +269,7 @@
this._isPaused = true;
}
if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
if (SelectorEngine__default['default'].findOne(SELECTOR_NEXT_PREV, this._element)) {
triggerTransitionEnd(this._element);
this.cycle(true);
}
@@ -298,7 +296,7 @@
_proto.to = function to(index) {
var _this = this;
this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
this._activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
var activeIndex = this._getItemIndex(this._activeElement);
@@ -307,7 +305,7 @@
}
if (this._isSliding) {
EventHandler.one(this._element, EVENT_SLID, function () {
EventHandler__default['default'].one(this._element, EVENT_SLID, function () {
return _this.to(index);
});
return;
@@ -325,8 +323,8 @@
};
_proto.dispose = function dispose() {
EventHandler.off(this._element, EVENT_KEY);
Data.removeData(this._element, DATA_KEY);
EventHandler__default['default'].off(this._element, EVENT_KEY);
Data__default['default'].removeData(this._element, DATA_KEY);
this._items = null;
this._config = null;
this._element = null;
@@ -339,7 +337,7 @@
;
_proto._getConfig = function _getConfig(config) {
config = _objectSpread(_objectSpread({}, Default), config);
config = _extends({}, Default, config);
typeCheckConfig(NAME, config, DefaultType);
return config;
};
@@ -368,16 +366,16 @@
var _this2 = this;
if (this._config.keyboard) {
EventHandler.on(this._element, EVENT_KEYDOWN, function (event) {
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN, function (event) {
return _this2._keydown(event);
});
}
if (this._config.pause === 'hover') {
EventHandler.on(this._element, EVENT_MOUSEENTER, function (event) {
EventHandler__default['default'].on(this._element, EVENT_MOUSEENTER, function (event) {
return _this2.pause(event);
});
EventHandler.on(this._element, EVENT_MOUSELEAVE, function (event) {
EventHandler__default['default'].on(this._element, EVENT_MOUSELEAVE, function (event) {
return _this2.cycle(event);
});
}
@@ -434,29 +432,29 @@
}
};
SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(function (itemImg) {
EventHandler.on(itemImg, EVENT_DRAG_START, function (e) {
SelectorEngine__default['default'].find(SELECTOR_ITEM_IMG, this._element).forEach(function (itemImg) {
EventHandler__default['default'].on(itemImg, EVENT_DRAG_START, function (e) {
return e.preventDefault();
});
});
if (this._pointerEvent) {
EventHandler.on(this._element, EVENT_POINTERDOWN, function (event) {
EventHandler__default['default'].on(this._element, EVENT_POINTERDOWN, function (event) {
return start(event);
});
EventHandler.on(this._element, EVENT_POINTERUP, function (event) {
EventHandler__default['default'].on(this._element, EVENT_POINTERUP, function (event) {
return end(event);
});
this._element.classList.add(CLASS_NAME_POINTER_EVENT);
} else {
EventHandler.on(this._element, EVENT_TOUCHSTART, function (event) {
EventHandler__default['default'].on(this._element, EVENT_TOUCHSTART, function (event) {
return start(event);
});
EventHandler.on(this._element, EVENT_TOUCHMOVE, function (event) {
EventHandler__default['default'].on(this._element, EVENT_TOUCHMOVE, function (event) {
return move(event);
});
EventHandler.on(this._element, EVENT_TOUCHEND, function (event) {
EventHandler__default['default'].on(this._element, EVENT_TOUCHEND, function (event) {
return end(event);
});
}
@@ -481,7 +479,7 @@
};
_proto._getItemIndex = function _getItemIndex(element) {
this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
this._items = element && element.parentNode ? SelectorEngine__default['default'].find(SELECTOR_ITEM, element.parentNode) : [];
return this._items.indexOf(element);
};
@@ -506,9 +504,9 @@
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
var targetIndex = this._getItemIndex(relatedTarget);
var fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
var fromIndex = this._getItemIndex(SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element));
return EventHandler.trigger(this._element, EVENT_SLIDE, {
return EventHandler__default['default'].trigger(this._element, EVENT_SLIDE, {
relatedTarget: relatedTarget,
direction: eventDirectionName,
from: fromIndex,
@@ -518,7 +516,7 @@
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
if (this._indicatorsElement) {
var indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement);
var indicators = SelectorEngine__default['default'].find(SELECTOR_ACTIVE, this._indicatorsElement);
for (var i = 0; i < indicators.length; i++) {
indicators[i].classList.remove(CLASS_NAME_ACTIVE);
@@ -535,7 +533,7 @@
_proto._slide = function _slide(direction, element) {
var _this4 = this;
var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
var activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
var activeElementIndex = this._getItemIndex(activeElement);
@@ -597,13 +595,13 @@
}
var transitionDuration = getTransitionDurationFromElement(activeElement);
EventHandler.one(activeElement, TRANSITION_END, function () {
EventHandler__default['default'].one(activeElement, TRANSITION_END, function () {
nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE);
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
_this4._isSliding = false;
setTimeout(function () {
EventHandler.trigger(_this4._element, EVENT_SLID, {
EventHandler__default['default'].trigger(_this4._element, EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
@@ -616,7 +614,7 @@
activeElement.classList.remove(CLASS_NAME_ACTIVE);
nextElement.classList.add(CLASS_NAME_ACTIVE);
this._isSliding = false;
EventHandler.trigger(this._element, EVENT_SLID, {
EventHandler__default['default'].trigger(this._element, EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
@@ -631,12 +629,12 @@
;
Carousel.carouselInterface = function carouselInterface(element, config) {
var data = Data.getData(element, DATA_KEY);
var data = Data__default['default'].getData(element, DATA_KEY);
var _config = _objectSpread(_objectSpread({}, Default), Manipulator.getDataAttributes(element));
var _config = _extends({}, Default, Manipulator__default['default'].getDataAttributes(element));
if (typeof config === 'object') {
_config = _objectSpread(_objectSpread({}, _config), config);
_config = _extends({}, _config, config);
}
var action = typeof config === 'string' ? config : _config.slide;
@@ -672,7 +670,7 @@
return;
}
var config = _objectSpread(_objectSpread({}, Manipulator.getDataAttributes(target)), Manipulator.getDataAttributes(this));
var config = _extends({}, Manipulator__default['default'].getDataAttributes(target), Manipulator__default['default'].getDataAttributes(this));
var slideIndex = this.getAttribute('data-slide-to');
@@ -683,14 +681,14 @@
Carousel.carouselInterface(target, config);
if (slideIndex) {
Data.getData(target, DATA_KEY).to(slideIndex);
Data__default['default'].getData(target, DATA_KEY).to(slideIndex);
}
event.preventDefault();
};
Carousel.getInstance = function getInstance(element) {
return Data.getData(element, DATA_KEY);
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Carousel, null, [{
@@ -714,12 +712,12 @@
*/
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
EventHandler.on(window, EVENT_LOAD_DATA_API, function () {
var carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, function () {
var carousels = SelectorEngine__default['default'].find(SELECTOR_DATA_RIDE);
for (var i = 0, len = carousels.length; i < len; i++) {
Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY));
Carousel.carouselInterface(carousels[i], Data__default['default'].getData(carousels[i], DATA_KEY));
}
});
var $ = getjQuery();

File diff suppressed because one or more lines are too long

99
js/dist/collapse.js vendored
View File

@@ -6,13 +6,15 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', './dom/selector-engine.js'], factory) :
(global = global || self, global.Collapse = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
/**
* --------------------------------------------------------------------------
@@ -133,11 +135,7 @@
return null;
};
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -185,13 +183,13 @@
this._isTransitioning = false;
this._element = element;
this._config = this._getConfig(config);
this._triggerArray = SelectorEngine.find(SELECTOR_DATA_TOGGLE + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE + "[data-target=\"#" + element.id + "\"]"));
var toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
this._triggerArray = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE + "[data-target=\"#" + element.id + "\"]"));
var toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
for (var i = 0, len = toggleList.length; i < len; i++) {
var elem = toggleList[i];
var selector = getSelectorFromElement(elem);
var filterElement = SelectorEngine.find(selector).filter(function (foundElem) {
var filterElement = SelectorEngine__default['default'].find(selector).filter(function (foundElem) {
return foundElem === element;
});
@@ -212,7 +210,7 @@
this.toggle();
}
Data.setData(element, DATA_KEY, this);
Data__default['default'].setData(element, DATA_KEY, this);
} // Getters
@@ -238,7 +236,7 @@
var activesData;
if (this._parent) {
actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(function (elem) {
actives = SelectorEngine__default['default'].find(SELECTOR_ACTIVES, this._parent).filter(function (elem) {
if (typeof _this._config.parent === 'string') {
return elem.getAttribute('data-parent') === _this._config.parent;
}
@@ -251,20 +249,20 @@
}
}
var container = SelectorEngine.findOne(this._selector);
var container = SelectorEngine__default['default'].findOne(this._selector);
if (actives) {
var tempActiveData = actives.filter(function (elem) {
return container !== elem;
});
activesData = tempActiveData[0] ? Data.getData(tempActiveData[0], DATA_KEY) : null;
activesData = tempActiveData[0] ? Data__default['default'].getData(tempActiveData[0], DATA_KEY) : null;
if (activesData && activesData._isTransitioning) {
return;
}
}
var startEvent = EventHandler.trigger(this._element, EVENT_SHOW);
var startEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
if (startEvent.defaultPrevented) {
return;
@@ -277,7 +275,7 @@
}
if (!activesData) {
Data.setData(elemActive, DATA_KEY, null);
Data__default['default'].setData(elemActive, DATA_KEY, null);
}
});
}
@@ -308,13 +306,13 @@
_this.setTransitioning(false);
EventHandler.trigger(_this._element, EVENT_SHOWN);
EventHandler__default['default'].trigger(_this._element, EVENT_SHOWN);
};
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
var scrollSize = "scroll" + capitalizedDimension;
var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete);
EventHandler__default['default'].one(this._element, TRANSITION_END, complete);
emulateTransitionEnd(this._element, transitionDuration);
this._element.style[dimension] = this._element[scrollSize] + "px";
};
@@ -326,7 +324,7 @@
return;
}
var startEvent = EventHandler.trigger(this._element, EVENT_HIDE);
var startEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
if (startEvent.defaultPrevented) {
return;
@@ -364,12 +362,12 @@
_this2._element.classList.add(CLASS_NAME_COLLAPSE);
EventHandler.trigger(_this2._element, EVENT_HIDDEN);
EventHandler__default['default'].trigger(_this2._element, EVENT_HIDDEN);
};
this._element.style[dimension] = '';
var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete);
EventHandler__default['default'].one(this._element, TRANSITION_END, complete);
emulateTransitionEnd(this._element, transitionDuration);
};
@@ -378,7 +376,7 @@
};
_proto.dispose = function dispose() {
Data.removeData(this._element, DATA_KEY);
Data__default['default'].removeData(this._element, DATA_KEY);
this._config = null;
this._parent = null;
this._element = null;
@@ -388,7 +386,7 @@
;
_proto._getConfig = function _getConfig(config) {
config = _objectSpread(_objectSpread({}, Default), config);
config = _extends({}, Default, config);
config.toggle = Boolean(config.toggle); // Coerce string values
typeCheckConfig(NAME, config, DefaultType);
@@ -396,9 +394,7 @@
};
_proto._getDimension = function _getDimension() {
var hasWidth = this._element.classList.contains(WIDTH);
return hasWidth ? WIDTH : HEIGHT;
return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
};
_proto._getParent = function _getParent() {
@@ -412,11 +408,11 @@
parent = parent[0];
}
} else {
parent = SelectorEngine.findOne(parent);
parent = SelectorEngine__default['default'].findOne(parent);
}
var selector = SELECTOR_DATA_TOGGLE + "[data-parent=\"" + parent + "\"]";
SelectorEngine.find(selector, parent).forEach(function (element) {
SelectorEngine__default['default'].find(selector, parent).forEach(function (element) {
var selected = getElementFromSelector(element);
_this3._addAriaAndCollapsedClass(selected, [element]);
@@ -425,28 +421,27 @@
};
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
if (element) {
var isOpen = element.classList.contains(CLASS_NAME_SHOW);
if (triggerArray.length) {
triggerArray.forEach(function (elem) {
if (isOpen) {
elem.classList.remove(CLASS_NAME_COLLAPSED);
} else {
elem.classList.add(CLASS_NAME_COLLAPSED);
}
elem.setAttribute('aria-expanded', isOpen);
});
}
if (!element || !triggerArray.length) {
return;
}
var isOpen = element.classList.contains(CLASS_NAME_SHOW);
triggerArray.forEach(function (elem) {
if (isOpen) {
elem.classList.remove(CLASS_NAME_COLLAPSED);
} else {
elem.classList.add(CLASS_NAME_COLLAPSED);
}
elem.setAttribute('aria-expanded', isOpen);
});
} // Static
;
Collapse.collapseInterface = function collapseInterface(element, config) {
var data = Data.getData(element, DATA_KEY);
var data = Data__default['default'].getData(element, DATA_KEY);
var _config = _objectSpread(_objectSpread(_objectSpread({}, Default), Manipulator.getDataAttributes(element)), typeof config === 'object' && config ? config : {});
var _config = _extends({}, Default, Manipulator__default['default'].getDataAttributes(element), typeof config === 'object' && config ? config : {});
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
_config.toggle = false;
@@ -472,7 +467,7 @@
};
Collapse.getInstance = function getInstance(element) {
return Data.getData(element, DATA_KEY);
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Collapse, null, [{
@@ -496,17 +491,17 @@
*/
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.target.tagName === 'A') {
event.preventDefault();
}
var triggerData = Manipulator.getDataAttributes(this);
var triggerData = Manipulator__default['default'].getDataAttributes(this);
var selector = getSelectorFromElement(this);
var selectorElements = SelectorEngine.find(selector);
var selectorElements = SelectorEngine__default['default'].find(selector);
selectorElements.forEach(function (element) {
var data = Data.getData(element, DATA_KEY);
var data = Data__default['default'].getData(element, DATA_KEY);
var config;
if (data) {

File diff suppressed because one or more lines are too long

18
js/dist/dom/data.js vendored
View File

@@ -6,7 +6,7 @@
(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());
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Data = factory());
}(this, (function () { 'use strict';
/**
@@ -26,22 +26,22 @@
var id = 1;
return {
set: function set(element, key, data) {
if (typeof element.key === 'undefined') {
element.key = {
if (typeof element.bsKey === 'undefined') {
element.bsKey = {
key: key,
id: id
};
id++;
}
storeData[element.key.id] = data;
storeData[element.bsKey.id] = data;
},
get: function get(element, key) {
if (!element || typeof element.key === 'undefined') {
if (!element || typeof element.bsKey === 'undefined') {
return null;
}
var keyProperties = element.key;
var keyProperties = element.bsKey;
if (keyProperties.key === key) {
return storeData[keyProperties.id];
@@ -50,15 +50,15 @@
return null;
},
delete: function _delete(element, key) {
if (typeof element.key === 'undefined') {
if (typeof element.bsKey === 'undefined') {
return;
}
var keyProperties = element.key;
var keyProperties = element.bsKey;
if (keyProperties.key === key) {
delete storeData[keyProperties.id];
delete element.key;
delete element.bsKey;
}
}
};

View File

@@ -1 +1 @@
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-alpha1): dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/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\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;;EAED,aAAO,IAAP;EACD,KAvBI;EAwBLO,IAAAA,MAxBK,mBAwBEL,OAxBF,EAwBWC,GAxBX,EAwBgB;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;EAlCI,GAAP;EAoCD,CAvCe,EAAhB;;MAyCMK,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;;;;;;;;"}
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-alpha1): dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/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.bsKey === 'undefined') {\n element.bsKey = {\n key,\n id\n }\n id++\n }\n\n storeData[element.bsKey.id] = data\n },\n get(element, key) {\n if (!element || typeof element.bsKey === 'undefined') {\n return null\n }\n\n const keyProperties = element.bsKey\n if (keyProperties.key === key) {\n return storeData[keyProperties.id]\n }\n\n return null\n },\n delete(element, key) {\n if (typeof element.bsKey === 'undefined') {\n return\n }\n\n const keyProperties = element.bsKey\n if (keyProperties.key === key) {\n delete storeData[keyProperties.id]\n delete element.bsKey\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","bsKey","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,CAACG,KAAf,KAAyB,WAA7B,EAA0C;EACxCH,QAAAA,OAAO,CAACG,KAAR,GAAgB;EACdF,UAAAA,GAAG,EAAHA,GADc;EAEdH,UAAAA,EAAE,EAAFA;EAFc,SAAhB;EAIAA,QAAAA,EAAE;EACH;;EAEDD,MAAAA,SAAS,CAACG,OAAO,CAACG,KAAR,CAAcL,EAAf,CAAT,GAA8BI,IAA9B;EACD,KAXI;EAYLE,IAAAA,GAZK,eAYDJ,OAZC,EAYQC,GAZR,EAYa;EAChB,UAAI,CAACD,OAAD,IAAY,OAAOA,OAAO,CAACG,KAAf,KAAyB,WAAzC,EAAsD;EACpD,eAAO,IAAP;EACD;;EAED,UAAME,aAAa,GAAGL,OAAO,CAACG,KAA9B;;EACA,UAAIE,aAAa,CAACJ,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACQ,aAAa,CAACP,EAAf,CAAhB;EACD;;EAED,aAAO,IAAP;EACD,KAvBI;EAwBLQ,IAAAA,MAxBK,mBAwBEN,OAxBF,EAwBWC,GAxBX,EAwBgB;EACnB,UAAI,OAAOD,OAAO,CAACG,KAAf,KAAyB,WAA7B,EAA0C;EACxC;EACD;;EAED,UAAME,aAAa,GAAGL,OAAO,CAACG,KAA9B;;EACA,UAAIE,aAAa,CAACJ,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACQ,aAAa,CAACP,EAAf,CAAhB;EACA,eAAOE,OAAO,CAACG,KAAf;EACD;EACF;EAlCI,GAAP;EAoCD,CAvCe,EAAhB;;MAyCMI,IAAI,GAAG;EACXC,EAAAA,OADW,mBACHC,QADG,EACOR,GADP,EACYC,IADZ,EACkB;EAC3BN,IAAAA,OAAO,CAACG,GAAR,CAAYU,QAAZ,EAAsBR,GAAtB,EAA2BC,IAA3B;EACD,GAHU;EAIXQ,EAAAA,OAJW,mBAIHD,QAJG,EAIOR,GAJP,EAIY;EACrB,WAAOL,OAAO,CAACQ,GAAR,CAAYK,QAAZ,EAAsBR,GAAtB,CAAP;EACD,GANU;EAOXU,EAAAA,UAPW,sBAOAF,QAPA,EAOUR,GAPV,EAOe;EACxBL,IAAAA,OAAO,CAACU,MAAR,CAAeG,QAAf,EAAyBR,GAAzB;EACD;EATU;;;;;;;;"}

View File

@@ -6,7 +6,7 @@
(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));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.EventHandler = factory(global.Polyfill));
}(this, (function (polyfill_js) { 'use strict';
/**
@@ -70,6 +70,8 @@
function bootstrapHandler(element, fn) {
return function handler(event) {
event.delegateTarget = element;
if (handler.oneOff) {
EventHandler.off(element, event.type, fn);
}
@@ -85,6 +87,8 @@
for (var target = event.target; target && target !== this; target = target.parentNode) {
for (var i = domElements.length; i--;) {
if (domElements[i] === target) {
event.delegateTarget = target;
if (handler.oneOff) {
EventHandler.off(element, event.type, fn);
}
@@ -269,7 +273,7 @@
bubbles: bubbles,
cancelable: true
});
} // merge custom informations in our event
} // merge custom information in our event
if (typeof args !== 'undefined') {

File diff suppressed because one or more lines are too long

View File

@@ -6,14 +6,10 @@
(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());
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Manipulator = factory());
}(this, (function () { 'use strict';
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
/**
* --------------------------------------------------------------------------
@@ -59,7 +55,7 @@
return {};
}
var attributes = _objectSpread({}, element.dataset);
var attributes = _extends({}, element.dataset);
Object.keys(attributes).forEach(function (key) {
attributes[key] = normalizeData(attributes[key]);

View File

@@ -1 +1 @@
{"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-alpha1): dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/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,UAAAC,GAAG;EAAA,iBAAQA,GAAG,CAACC,WAAJ,EAAR;EAAA,GAAzB,CAAP;EACD;;MAEKC,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,UAAAhB,GAAG,EAAI;EACrCY,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;;;;;;;;"}
{"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-alpha1): dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/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,UAAAC,GAAG;EAAA,iBAAQA,GAAG,CAACC,WAAJ,EAAR;EAAA,GAAzB,CAAP;EACD;;MAEKC,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,gBACXN,OAAO,CAACO,OADG,CAAhB;;EAIAC,IAAAA,MAAM,CAACC,IAAP,CAAYH,UAAZ,EAAwBI,OAAxB,CAAgC,UAAAhB,GAAG,EAAI;EACrCY,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;;;;;;;;"}

View File

@@ -6,7 +6,7 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.Polyfill = {}));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Polyfill = {}));
}(this, (function (exports) { 'use strict';
/**

File diff suppressed because one or more lines are too long

View File

@@ -6,7 +6,7 @@
(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));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.SelectorEngine = factory(global.Polyfill));
}(this, (function (polyfill_js) { 'use strict';
/**

88
js/dist/dropdown.js vendored
View File

@@ -6,14 +6,16 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('popper.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', 'popper.js', './dom/selector-engine.js'], factory) :
(global = global || self, global.Dropdown = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper;
SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
/**
* --------------------------------------------------------------------------
@@ -91,11 +93,7 @@
return null;
};
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -178,7 +176,7 @@
this._addEventListeners();
Data.setData(element, DATA_KEY, this);
Data__default['default'].setData(element, DATA_KEY, this);
} // Getters
@@ -210,7 +208,7 @@
var relatedTarget = {
relatedTarget: this._element
};
var showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget);
var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, relatedTarget);
if (showEvent.defaultPrevented) {
return;
@@ -218,7 +216,7 @@
if (!this._inNavbar) {
if (typeof Popper === 'undefined') {
if (typeof Popper__default['default'] === 'undefined') {
throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org)');
}
@@ -241,7 +239,7 @@
parent.classList.add(CLASS_NAME_POSITION_STATIC);
}
this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
this._popper = new Popper__default['default'](referenceElement, this._menu, this._getPopperConfig());
} // If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
@@ -252,7 +250,7 @@
var _ref;
(_ref = []).concat.apply(_ref, document.body.children).forEach(function (elem) {
return EventHandler.on(elem, 'mouseover', null, noop());
return EventHandler__default['default'].on(elem, 'mouseover', null, noop());
});
}
@@ -260,9 +258,9 @@
this._element.setAttribute('aria-expanded', true);
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW);
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW);
EventHandler.trigger(parent, EVENT_SHOWN, relatedTarget);
Manipulator__default['default'].toggleClass(this._menu, CLASS_NAME_SHOW);
Manipulator__default['default'].toggleClass(this._element, CLASS_NAME_SHOW);
EventHandler__default['default'].trigger(parent, EVENT_SHOWN, relatedTarget);
};
_proto.hide = function hide() {
@@ -274,7 +272,7 @@
var relatedTarget = {
relatedTarget: this._element
};
var hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget);
var hideEvent = EventHandler__default['default'].trigger(parent, EVENT_HIDE, relatedTarget);
if (hideEvent.defaultPrevented) {
return;
@@ -284,14 +282,14 @@
this._popper.destroy();
}
Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW);
Manipulator.toggleClass(this._element, CLASS_NAME_SHOW);
EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget);
Manipulator__default['default'].toggleClass(this._menu, CLASS_NAME_SHOW);
Manipulator__default['default'].toggleClass(this._element, CLASS_NAME_SHOW);
EventHandler__default['default'].trigger(parent, EVENT_HIDDEN, relatedTarget);
};
_proto.dispose = function dispose() {
Data.removeData(this._element, DATA_KEY);
EventHandler.off(this._element, EVENT_KEY);
Data__default['default'].removeData(this._element, DATA_KEY);
EventHandler__default['default'].off(this._element, EVENT_KEY);
this._element = null;
this._menu = null;
@@ -314,7 +312,7 @@
_proto._addEventListeners = function _addEventListeners() {
var _this = this;
EventHandler.on(this._element, EVENT_CLICK, function (event) {
EventHandler__default['default'].on(this._element, EVENT_CLICK, function (event) {
event.preventDefault();
event.stopPropagation();
@@ -323,13 +321,13 @@
};
_proto._getConfig = function _getConfig(config) {
config = _objectSpread(_objectSpread(_objectSpread({}, this.constructor.Default), Manipulator.getDataAttributes(this._element)), config);
config = _extends({}, this.constructor.Default, Manipulator__default['default'].getDataAttributes(this._element), config);
typeCheckConfig(NAME, config, this.constructor.DefaultType);
return config;
};
_proto._getMenuElement = function _getMenuElement() {
return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
return SelectorEngine__default['default'].next(this._element, SELECTOR_MENU)[0];
};
_proto._getPlacement = function _getPlacement() {
@@ -364,7 +362,7 @@
if (typeof this._config.offset === 'function') {
offset.fn = function (data) {
data.offsets = _objectSpread(_objectSpread({}, data.offsets), _this2._config.offset(data.offsets, _this2._element) || {});
data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
return data;
};
} else {
@@ -394,12 +392,12 @@
};
}
return _objectSpread(_objectSpread({}, popperConfig), this._config.popperConfig);
return _extends({}, popperConfig, this._config.popperConfig);
} // Static
;
Dropdown.dropdownInterface = function dropdownInterface(element, config) {
var data = Data.getData(element, DATA_KEY);
var data = Data__default['default'].getData(element, DATA_KEY);
var _config = typeof config === 'object' ? config : null;
@@ -427,11 +425,11 @@
return;
}
var toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
var toggles = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
for (var i = 0, len = toggles.length; i < len; i++) {
var parent = Dropdown.getParentFromElement(toggles[i]);
var context = Data.getData(toggles[i], DATA_KEY);
var context = Data__default['default'].getData(toggles[i], DATA_KEY);
var relatedTarget = {
relatedTarget: toggles[i]
};
@@ -454,7 +452,7 @@
continue;
}
var hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget);
var hideEvent = EventHandler__default['default'].trigger(parent, EVENT_HIDE, relatedTarget);
if (hideEvent.defaultPrevented) {
continue;
@@ -466,7 +464,7 @@
var _ref2;
(_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (elem) {
return EventHandler.off(elem, 'mouseover', null, noop());
return EventHandler__default['default'].off(elem, 'mouseover', null, noop());
});
}
@@ -478,7 +476,7 @@
dropdownMenu.classList.remove(CLASS_NAME_SHOW);
toggles[i].classList.remove(CLASS_NAME_SHOW);
EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget);
EventHandler__default['default'].trigger(parent, EVENT_HIDDEN, relatedTarget);
}
};
@@ -509,7 +507,7 @@
var isActive = this.classList.contains(CLASS_NAME_SHOW);
if (event.key === ESCAPE_KEY) {
var button = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0];
var button = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine__default['default'].prev(this, SELECTOR_DATA_TOGGLE)[0];
button.focus();
Dropdown.clearMenus();
return;
@@ -520,7 +518,7 @@
return;
}
var items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible);
var items = SelectorEngine__default['default'].find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible);
if (!items.length) {
return;
@@ -544,7 +542,7 @@
};
Dropdown.getInstance = function getInstance(element) {
return Data.getData(element, DATA_KEY);
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Dropdown, null, [{
@@ -573,16 +571,16 @@
*/
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) {
EventHandler__default['default'].on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler);
EventHandler__default['default'].on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus);
EventHandler__default['default'].on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
event.preventDefault();
event.stopPropagation();
Dropdown.dropdownInterface(this, 'toggle');
});
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, function (e) {
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, function (e) {
return e.stopPropagation();
});
var $ = getjQuery();

File diff suppressed because one or more lines are too long

136
js/dist/modal.js vendored
View File

@@ -6,13 +6,15 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', './dom/selector-engine.js'], factory) :
(global = global || self, global.Modal = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
/**
* --------------------------------------------------------------------------
@@ -137,11 +139,7 @@
return null;
};
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -204,14 +202,14 @@
function Modal(element, config) {
this._config = this._getConfig(config);
this._element = element;
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element);
this._dialog = SelectorEngine__default['default'].findOne(SELECTOR_DIALOG, element);
this._backdrop = null;
this._isShown = false;
this._isBodyOverflowing = false;
this._ignoreBackdropClick = false;
this._isTransitioning = false;
this._scrollbarWidth = 0;
Data.setData(element, DATA_KEY, this);
Data__default['default'].setData(element, DATA_KEY, this);
} // Getters
@@ -233,7 +231,7 @@
this._isTransitioning = true;
}
var showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, {
relatedTarget: relatedTarget
});
@@ -253,11 +251,11 @@
this._setResizeEvent();
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
return _this.hide(event);
});
EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
EventHandler.one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) {
EventHandler__default['default'].on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
EventHandler__default['default'].one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) {
if (event.target === _this._element) {
_this._ignoreBackdropClick = true;
}
@@ -280,7 +278,7 @@
return;
}
var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
if (hideEvent.defaultPrevented) {
return;
@@ -298,16 +296,16 @@
this._setResizeEvent();
EventHandler.off(document, EVENT_FOCUSIN);
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
this._element.classList.remove(CLASS_NAME_SHOW);
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS);
EventHandler__default['default'].off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
if (transition) {
var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, function (event) {
EventHandler__default['default'].one(this._element, TRANSITION_END, function (event) {
return _this2._hideModal(event);
});
emulateTransitionEnd(this._element, transitionDuration);
@@ -318,7 +316,7 @@
_proto.dispose = function dispose() {
[window, this._element, this._dialog].forEach(function (htmlElement) {
return EventHandler.off(htmlElement, EVENT_KEY);
return EventHandler__default['default'].off(htmlElement, EVENT_KEY);
});
/**
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
@@ -326,8 +324,8 @@
* It will remove `EVENT_CLICK_DATA_API` event that should remain
*/
EventHandler.off(document, EVENT_FOCUSIN);
Data.removeData(this._element, DATA_KEY);
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
Data__default['default'].removeData(this._element, DATA_KEY);
this._config = null;
this._element = null;
this._dialog = null;
@@ -345,7 +343,7 @@
;
_proto._getConfig = function _getConfig(config) {
config = _objectSpread(_objectSpread({}, Default), config);
config = _extends({}, Default, config);
typeCheckConfig(NAME, config, DefaultType);
return config;
};
@@ -355,7 +353,7 @@
var transition = this._element.classList.contains(CLASS_NAME_FADE);
var modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
var modalBody = SelectorEngine__default['default'].findOne(SELECTOR_MODAL_BODY, this._dialog);
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
// Don't move modal's DOM position
@@ -392,14 +390,14 @@
}
_this3._isTransitioning = false;
EventHandler.trigger(_this3._element, EVENT_SHOWN, {
EventHandler__default['default'].trigger(_this3._element, EVENT_SHOWN, {
relatedTarget: relatedTarget
});
};
if (transition) {
var transitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler.one(this._dialog, TRANSITION_END, transitionComplete);
EventHandler__default['default'].one(this._dialog, TRANSITION_END, transitionComplete);
emulateTransitionEnd(this._dialog, transitionDuration);
} else {
transitionComplete();
@@ -409,9 +407,9 @@
_proto._enforceFocus = function _enforceFocus() {
var _this4 = this;
EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
EventHandler__default['default'].off(document, EVENT_FOCUSIN); // guard against infinite focus loop
EventHandler.on(document, EVENT_FOCUSIN, function (event) {
EventHandler__default['default'].on(document, EVENT_FOCUSIN, function (event) {
if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) {
_this4._element.focus();
}
@@ -422,7 +420,7 @@
var _this5 = this;
if (this._isShown) {
EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, function (event) {
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN_DISMISS, function (event) {
if (_this5._config.keyboard && event.key === ESCAPE_KEY) {
event.preventDefault();
@@ -432,7 +430,7 @@
}
});
} else {
EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS);
EventHandler__default['default'].off(this._element, EVENT_KEYDOWN_DISMISS);
}
};
@@ -440,11 +438,11 @@
var _this6 = this;
if (this._isShown) {
EventHandler.on(window, EVENT_RESIZE, function () {
EventHandler__default['default'].on(window, EVENT_RESIZE, function () {
return _this6._adjustDialog();
});
} else {
EventHandler.off(window, EVENT_RESIZE);
EventHandler__default['default'].off(window, EVENT_RESIZE);
}
};
@@ -468,7 +466,7 @@
_this7._resetScrollbar();
EventHandler.trigger(_this7._element, EVENT_HIDDEN);
EventHandler__default['default'].trigger(_this7._element, EVENT_HIDDEN);
});
};
@@ -492,7 +490,7 @@
}
document.body.appendChild(this._backdrop);
EventHandler.on(this._element, EVENT_CLICK_DISMISS, function (event) {
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, function (event) {
if (_this8._ignoreBackdropClick) {
_this8._ignoreBackdropClick = false;
return;
@@ -517,7 +515,7 @@
}
var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler.one(this._backdrop, TRANSITION_END, callback);
EventHandler__default['default'].one(this._backdrop, TRANSITION_END, callback);
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else if (!this._isShown && this._backdrop) {
this._backdrop.classList.remove(CLASS_NAME_SHOW);
@@ -531,7 +529,7 @@
if (this._element.classList.contains(CLASS_NAME_FADE)) {
var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove);
EventHandler__default['default'].one(this._backdrop, TRANSITION_END, callbackRemove);
emulateTransitionEnd(this._backdrop, _backdropTransitionDuration);
} else {
callbackRemove();
@@ -545,17 +543,31 @@
var _this9 = this;
if (this._config.backdrop === 'static') {
var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE_PREVENTED);
if (hideEvent.defaultPrevented) {
return;
}
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
if (!isModalOverflowing) {
this._element.style.overflowY = 'hidden';
}
this._element.classList.add(CLASS_NAME_STATIC);
var modalTransitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, function () {
var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler__default['default'].off(this._element, TRANSITION_END);
EventHandler__default['default'].one(this._element, TRANSITION_END, function () {
_this9._element.classList.remove(CLASS_NAME_STATIC);
if (!isModalOverflowing) {
EventHandler__default['default'].one(_this9._element, TRANSITION_END, function () {
_this9._element.style.overflowY = '';
});
emulateTransitionEnd(_this9._element, modalTransitionDuration);
}
});
emulateTransitionEnd(this._element, modalTransitionDuration);
@@ -598,23 +610,23 @@
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
// Adjust fixed content padding
SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
SelectorEngine__default['default'].find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
var actualPadding = element.style.paddingRight;
var calculatedPadding = window.getComputedStyle(element)['padding-right'];
Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
Manipulator__default['default'].setDataAttribute(element, 'padding-right', actualPadding);
element.style.paddingRight = parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px";
}); // Adjust sticky content margin
SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach(function (element) {
SelectorEngine__default['default'].find(SELECTOR_STICKY_CONTENT).forEach(function (element) {
var actualMargin = element.style.marginRight;
var calculatedMargin = window.getComputedStyle(element)['margin-right'];
Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
Manipulator__default['default'].setDataAttribute(element, 'margin-right', actualMargin);
element.style.marginRight = parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px";
}); // Adjust body padding
var actualPadding = document.body.style.paddingRight;
var calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
Manipulator__default['default'].setDataAttribute(document.body, 'padding-right', actualPadding);
document.body.style.paddingRight = parseFloat(calculatedPadding) + this._scrollbarWidth + "px";
}
@@ -623,30 +635,30 @@
_proto._resetScrollbar = function _resetScrollbar() {
// Restore fixed content padding
SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
var padding = Manipulator.getDataAttribute(element, 'padding-right');
SelectorEngine__default['default'].find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
var padding = Manipulator__default['default'].getDataAttribute(element, 'padding-right');
if (typeof padding !== 'undefined') {
Manipulator.removeDataAttribute(element, 'padding-right');
Manipulator__default['default'].removeDataAttribute(element, 'padding-right');
element.style.paddingRight = padding;
}
}); // Restore sticky content and navbar-toggler margin
SelectorEngine.find("" + SELECTOR_STICKY_CONTENT).forEach(function (element) {
var margin = Manipulator.getDataAttribute(element, 'margin-right');
SelectorEngine__default['default'].find("" + SELECTOR_STICKY_CONTENT).forEach(function (element) {
var margin = Manipulator__default['default'].getDataAttribute(element, 'margin-right');
if (typeof margin !== 'undefined') {
Manipulator.removeDataAttribute(element, 'margin-right');
Manipulator__default['default'].removeDataAttribute(element, 'margin-right');
element.style.marginRight = margin;
}
}); // Restore body padding
var padding = Manipulator.getDataAttribute(document.body, 'padding-right');
var padding = Manipulator__default['default'].getDataAttribute(document.body, 'padding-right');
if (typeof padding === 'undefined') {
document.body.style.paddingRight = '';
} else {
Manipulator.removeDataAttribute(document.body, 'padding-right');
Manipulator__default['default'].removeDataAttribute(document.body, 'padding-right');
document.body.style.paddingRight = padding;
}
};
@@ -664,9 +676,9 @@
Modal.jQueryInterface = function jQueryInterface(config, relatedTarget) {
return this.each(function () {
var data = Data.getData(this, DATA_KEY);
var data = Data__default['default'].getData(this, DATA_KEY);
var _config = _objectSpread(_objectSpread(_objectSpread({}, Default), Manipulator.getDataAttributes(this)), typeof config === 'object' && config ? config : {});
var _config = _extends({}, Default, Manipulator__default['default'].getDataAttributes(this), typeof config === 'object' && config ? config : {});
if (!data) {
data = new Modal(this, _config);
@@ -685,7 +697,7 @@
};
Modal.getInstance = function getInstance(element) {
return Data.getData(element, DATA_KEY);
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Modal, null, [{
@@ -709,7 +721,7 @@
*/
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
var _this11 = this;
var target = getElementFromSelector(this);
@@ -718,22 +730,22 @@
event.preventDefault();
}
EventHandler.one(target, EVENT_SHOW, function (showEvent) {
EventHandler__default['default'].one(target, EVENT_SHOW, function (showEvent) {
if (showEvent.defaultPrevented) {
// only register focus restorer if modal will actually get shown
return;
}
EventHandler.one(target, EVENT_HIDDEN, function () {
EventHandler__default['default'].one(target, EVENT_HIDDEN, function () {
if (isVisible(_this11)) {
_this11.focus();
}
});
});
var data = Data.getData(target, DATA_KEY);
var data = Data__default['default'].getData(target, DATA_KEY);
if (!data) {
var config = _objectSpread(_objectSpread({}, Manipulator.getDataAttributes(target)), Manipulator.getDataAttributes(this));
var config = _extends({}, Manipulator__default['default'].getDataAttributes(target), Manipulator__default['default'].getDataAttributes(this));
data = new Modal(target, config);
}

File diff suppressed because one or more lines are too long

38
js/dist/popover.js vendored
View File

@@ -6,12 +6,14 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/selector-engine.js'), require('./tooltip.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/selector-engine.js', './tooltip.js'], factory) :
(global = global || self, global.Popover = factory(global.Data, global.SelectorEngine, global.Tooltip));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.Data, global.SelectorEngine, global.Tooltip));
}(this, (function (Data, SelectorEngine, Tooltip) { 'use strict';
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
Tooltip = Tooltip && Object.prototype.hasOwnProperty.call(Tooltip, 'default') ? Tooltip['default'] : Tooltip;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
/**
* --------------------------------------------------------------------------
@@ -37,11 +39,7 @@
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
/**
* ------------------------------------------------------------------------
* Constants
@@ -55,14 +53,14 @@
var CLASS_PREFIX = 'bs-popover';
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
var Default = _objectSpread(_objectSpread({}, Tooltip.Default), {}, {
var Default = _extends({}, Tooltip__default['default'].Default, {
placement: 'right',
trigger: 'click',
content: '',
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(_objectSpread({}, Tooltip.DefaultType), {}, {
var DefaultType = _extends({}, Tooltip__default['default'].DefaultType, {
content: '(string|element|function)'
});
@@ -105,7 +103,7 @@
_proto.setContent = function setContent() {
var tip = this.getTipElement(); // we use append for html objects to maintain js events
this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_TITLE, tip), this.getTitle());
var content = this._getContent();
@@ -113,14 +111,14 @@
content = content.call(this.element);
}
this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_CONTENT, tip), content);
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
};
} // Private
;
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
} // Private
;
};
_proto._getContent = function _getContent() {
return this.element.getAttribute('data-content') || this.config.content;
@@ -142,7 +140,7 @@
Popover.jQueryInterface = function jQueryInterface(config) {
return this.each(function () {
var data = Data.getData(this, DATA_KEY);
var data = Data__default['default'].getData(this, DATA_KEY);
var _config = typeof config === 'object' ? config : null;
@@ -152,7 +150,7 @@
if (!data) {
data = new Popover(this, _config);
Data.setData(this, DATA_KEY, data);
Data__default['default'].setData(this, DATA_KEY, data);
}
if (typeof config === 'string') {
@@ -166,7 +164,7 @@
};
Popover.getInstance = function getInstance(element) {
return Data.getData(element, DATA_KEY);
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Popover, null, [{
@@ -208,7 +206,7 @@
}]);
return Popover;
}(Tooltip);
}(Tooltip__default['default']);
var $ = getjQuery();
/**

File diff suppressed because one or more lines are too long

66
js/dist/scrollspy.js vendored
View File

@@ -6,13 +6,15 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', './dom/selector-engine.js'], factory) :
(global = global || self, global.ScrollSpy = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ScrollSpy = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
/**
* --------------------------------------------------------------------------
@@ -92,11 +94,7 @@
return null;
};
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -149,19 +147,19 @@
this._element = element;
this._scrollElement = element.tagName === 'BODY' ? window : element;
this._config = this._getConfig(config);
this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM);
this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + ", " + this._config.target + " " + SELECTOR_LIST_ITEMS + ", " + this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM;
this._offsets = [];
this._targets = [];
this._activeTarget = null;
this._scrollHeight = 0;
EventHandler.on(this._scrollElement, EVENT_SCROLL, function (event) {
EventHandler__default['default'].on(this._scrollElement, EVENT_SCROLL, function (event) {
return _this._process(event);
});
this.refresh();
this._process();
Data.setData(element, DATA_KEY, this);
Data__default['default'].setData(element, DATA_KEY, this);
} // Getters
@@ -177,20 +175,16 @@
this._offsets = [];
this._targets = [];
this._scrollHeight = this._getScrollHeight();
var targets = SelectorEngine.find(this._selector);
var targets = SelectorEngine__default['default'].find(this._selector);
targets.map(function (element) {
var target;
var targetSelector = getSelectorFromElement(element);
if (targetSelector) {
target = SelectorEngine.findOne(targetSelector);
}
var target = targetSelector ? SelectorEngine__default['default'].findOne(targetSelector) : null;
if (target) {
var targetBCR = target.getBoundingClientRect();
if (targetBCR.width || targetBCR.height) {
return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
return [Manipulator__default['default'][offsetMethod](target).top + offsetBase, targetSelector];
}
}
@@ -207,8 +201,8 @@
};
_proto.dispose = function dispose() {
Data.removeData(this._element, DATA_KEY);
EventHandler.off(this._scrollElement, EVENT_KEY);
Data__default['default'].removeData(this._element, DATA_KEY);
EventHandler__default['default'].off(this._scrollElement, EVENT_KEY);
this._element = null;
this._scrollElement = null;
this._config = null;
@@ -221,7 +215,7 @@
;
_proto._getConfig = function _getConfig(config) {
config = _objectSpread(_objectSpread({}, Default), typeof config === 'object' && config ? config : {});
config = _extends({}, Default, typeof config === 'object' && config ? config : {});
if (typeof config.target !== 'string' && isElement(config.target)) {
var id = config.target.id;
@@ -297,36 +291,36 @@
return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
});
var link = SelectorEngine.findOne(queries.join(','));
var link = SelectorEngine__default['default'].findOne(queries.join(','));
if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
SelectorEngine__default['default'].findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
link.classList.add(CLASS_NAME_ACTIVE);
} else {
// Set triggered link as active
link.classList.add(CLASS_NAME_ACTIVE);
SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP).forEach(function (listGroup) {
SelectorEngine__default['default'].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
SelectorEngine.prev(listGroup, SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).forEach(function (item) {
SelectorEngine__default['default'].prev(listGroup, SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).forEach(function (item) {
return item.classList.add(CLASS_NAME_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) {
SelectorEngine__default['default'].prev(listGroup, SELECTOR_NAV_ITEMS).forEach(function (navItem) {
SelectorEngine__default['default'].children(navItem, SELECTOR_NAV_LINKS).forEach(function (item) {
return item.classList.add(CLASS_NAME_ACTIVE);
});
});
});
}
EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
EventHandler__default['default'].trigger(this._scrollElement, EVENT_ACTIVATE, {
relatedTarget: target
});
};
_proto._clear = function _clear() {
SelectorEngine.find(this._selector).filter(function (node) {
SelectorEngine__default['default'].find(this._selector).filter(function (node) {
return node.classList.contains(CLASS_NAME_ACTIVE);
}).forEach(function (node) {
return node.classList.remove(CLASS_NAME_ACTIVE);
@@ -336,7 +330,7 @@
ScrollSpy.jQueryInterface = function jQueryInterface(config) {
return this.each(function () {
var data = Data.getData(this, DATA_KEY);
var data = Data__default['default'].getData(this, DATA_KEY);
var _config = typeof config === 'object' && config;
@@ -355,7 +349,7 @@
};
ScrollSpy.getInstance = function getInstance(element) {
return Data.getData(element, DATA_KEY);
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(ScrollSpy, null, [{
@@ -379,9 +373,9 @@
*/
EventHandler.on(window, EVENT_LOAD_DATA_API, function () {
SelectorEngine.find(SELECTOR_DATA_SPY).forEach(function (spy) {
return new ScrollSpy(spy, Manipulator.getDataAttributes(spy));
EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, function () {
SelectorEngine__default['default'].find(SELECTOR_DATA_SPY).forEach(function (spy) {
return new ScrollSpy(spy, Manipulator__default['default'].getDataAttributes(spy));
});
});
var $ = getjQuery();

File diff suppressed because one or more lines are too long

40
js/dist/tab.js vendored
View File

@@ -6,12 +6,14 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/selector-engine.js'], factory) :
(global = global || self, global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine));
}(this, (function (Data, EventHandler, SelectorEngine) { 'use strict';
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
/**
* --------------------------------------------------------------------------
@@ -138,7 +140,7 @@
var Tab = /*#__PURE__*/function () {
function Tab(element) {
this._element = element;
Data.setData(this._element, DATA_KEY, this);
Data__default['default'].setData(this._element, DATA_KEY, this);
} // Getters
@@ -159,19 +161,19 @@
if (listElement) {
var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE;
previous = SelectorEngine.find(itemSelector, listElement);
previous = SelectorEngine__default['default'].find(itemSelector, listElement);
previous = previous[previous.length - 1];
}
var hideEvent = null;
if (previous) {
hideEvent = EventHandler.trigger(previous, EVENT_HIDE, {
hideEvent = EventHandler__default['default'].trigger(previous, EVENT_HIDE, {
relatedTarget: this._element
});
}
var showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, {
relatedTarget: previous
});
@@ -182,10 +184,10 @@
this._activate(this._element, listElement);
var complete = function complete() {
EventHandler.trigger(previous, EVENT_HIDDEN, {
EventHandler__default['default'].trigger(previous, EVENT_HIDDEN, {
relatedTarget: _this._element
});
EventHandler.trigger(_this._element, EVENT_SHOWN, {
EventHandler__default['default'].trigger(_this._element, EVENT_SHOWN, {
relatedTarget: previous
});
};
@@ -198,7 +200,7 @@
};
_proto.dispose = function dispose() {
Data.removeData(this._element, DATA_KEY);
Data__default['default'].removeData(this._element, DATA_KEY);
this._element = null;
} // Private
;
@@ -206,7 +208,7 @@
_proto._activate = function _activate(element, container, callback) {
var _this2 = this;
var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE);
var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine__default['default'].find(SELECTOR_ACTIVE_UL, container) : SelectorEngine__default['default'].children(container, SELECTOR_ACTIVE);
var active = activeElements[0];
var isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE);
@@ -217,7 +219,7 @@
if (active && isTransitioning) {
var transitionDuration = getTransitionDurationFromElement(active);
active.classList.remove(CLASS_NAME_SHOW);
EventHandler.one(active, TRANSITION_END, complete);
EventHandler__default['default'].one(active, TRANSITION_END, complete);
emulateTransitionEnd(active, transitionDuration);
} else {
complete();
@@ -227,7 +229,7 @@
_proto._transitionComplete = function _transitionComplete(element, active, callback) {
if (active) {
active.classList.remove(CLASS_NAME_ACTIVE);
var dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
var dropdownChild = SelectorEngine__default['default'].findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
if (dropdownChild) {
dropdownChild.classList.remove(CLASS_NAME_ACTIVE);
@@ -254,7 +256,7 @@
var dropdownElement = element.closest(SELECTOR_DROPDOWN);
if (dropdownElement) {
SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE).forEach(function (dropdown) {
SelectorEngine__default['default'].find(SELECTOR_DROPDOWN_TOGGLE).forEach(function (dropdown) {
return dropdown.classList.add(CLASS_NAME_ACTIVE);
});
}
@@ -270,7 +272,7 @@
Tab.jQueryInterface = function jQueryInterface(config) {
return this.each(function () {
var data = Data.getData(this, DATA_KEY) || new Tab(this);
var data = Data__default['default'].getData(this, DATA_KEY) || new Tab(this);
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
@@ -283,7 +285,7 @@
};
Tab.getInstance = function getInstance(element) {
return Data.getData(element, DATA_KEY);
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Tab, null, [{
@@ -302,9 +304,9 @@
*/
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
event.preventDefault();
var data = Data.getData(this, DATA_KEY) || new Tab(this);
var data = Data__default['default'].getData(this, DATA_KEY) || new Tab(this);
data.show();
});
var $ = getjQuery();

2
js/dist/tab.js.map vendored

File diff suppressed because one or more lines are too long

54
js/dist/toast.js vendored
View File

@@ -6,12 +6,14 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js'], factory) :
(global = global || self, global.Toast = factory(global.Data, global.EventHandler, global.Manipulator));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.Data, global.EventHandler, global.Manipulator));
}(this, (function (Data, EventHandler, Manipulator) { 'use strict';
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
/**
* --------------------------------------------------------------------------
@@ -106,11 +108,7 @@
return null;
};
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -142,7 +140,7 @@
var Default = {
animation: true,
autohide: true,
delay: 500
delay: 5000
};
var SELECTOR_DATA_DISMISS = '[data-dismiss="toast"]';
/**
@@ -159,7 +157,7 @@
this._setListeners();
Data.setData(element, DATA_KEY, this);
Data__default['default'].setData(element, DATA_KEY, this);
} // Getters
@@ -169,12 +167,14 @@
_proto.show = function show() {
var _this = this;
var showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
if (showEvent.defaultPrevented) {
return;
}
this._clearTimeout();
if (this._config.animation) {
this._element.classList.add(CLASS_NAME_FADE);
}
@@ -184,7 +184,7 @@
_this._element.classList.add(CLASS_NAME_SHOW);
EventHandler.trigger(_this._element, EVENT_SHOWN);
EventHandler__default['default'].trigger(_this._element, EVENT_SHOWN);
if (_this._config.autohide) {
_this._timeout = setTimeout(function () {
@@ -201,7 +201,7 @@
if (this._config.animation) {
var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete);
EventHandler__default['default'].one(this._element, TRANSITION_END, complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
complete();
@@ -215,7 +215,7 @@
return;
}
var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
if (hideEvent.defaultPrevented) {
return;
@@ -224,14 +224,14 @@
var complete = function complete() {
_this2._element.classList.add(CLASS_NAME_HIDE);
EventHandler.trigger(_this2._element, EVENT_HIDDEN);
EventHandler__default['default'].trigger(_this2._element, EVENT_HIDDEN);
};
this._element.classList.remove(CLASS_NAME_SHOW);
if (this._config.animation) {
var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete);
EventHandler__default['default'].one(this._element, TRANSITION_END, complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
complete();
@@ -239,22 +239,21 @@
};
_proto.dispose = function dispose() {
clearTimeout(this._timeout);
this._timeout = null;
this._clearTimeout();
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
this._element.classList.remove(CLASS_NAME_SHOW);
}
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
Data.removeData(this._element, DATA_KEY);
EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS);
Data__default['default'].removeData(this._element, DATA_KEY);
this._element = null;
this._config = null;
} // Private
;
_proto._getConfig = function _getConfig(config) {
config = _objectSpread(_objectSpread(_objectSpread({}, Default), Manipulator.getDataAttributes(this._element)), typeof config === 'object' && config ? config : {});
config = _extends({}, Default, Manipulator__default['default'].getDataAttributes(this._element), typeof config === 'object' && config ? config : {});
typeCheckConfig(NAME, config, this.constructor.DefaultType);
return config;
};
@@ -262,15 +261,20 @@
_proto._setListeners = function _setListeners() {
var _this3 = this;
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () {
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () {
return _this3.hide();
});
};
_proto._clearTimeout = function _clearTimeout() {
clearTimeout(this._timeout);
this._timeout = null;
} // Static
;
Toast.jQueryInterface = function jQueryInterface(config) {
return this.each(function () {
var data = Data.getData(this, DATA_KEY);
var data = Data__default['default'].getData(this, DATA_KEY);
var _config = typeof config === 'object' && config;
@@ -289,7 +293,7 @@
};
Toast.getInstance = function getInstance(element) {
return Data.getData(element, DATA_KEY);
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Toast, null, [{

File diff suppressed because one or more lines are too long

121
js/dist/tooltip.js vendored
View File

@@ -6,14 +6,16 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('popper.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', 'popper.js', './dom/selector-engine.js'], factory) :
(global = global || self, global.Tooltip = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper;
SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
/**
* --------------------------------------------------------------------------
@@ -193,7 +195,7 @@
return false;
};
var DefaultWhitelist = {
var DefaultAllowlist = {
// Global attributes allowed on any supplied element below.
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
a: ['target', 'href', 'title', 'rel'],
@@ -226,7 +228,7 @@
u: [],
ul: []
};
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
var _ref;
if (!unsafeHtml.length) {
@@ -239,7 +241,7 @@
var domParser = new window.DOMParser();
var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
var whitelistKeys = Object.keys(whiteList);
var allowlistKeys = Object.keys(allowList);
var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*'));
@@ -249,16 +251,16 @@
var el = elements[i];
var elName = el.nodeName.toLowerCase();
if (whitelistKeys.indexOf(elName) === -1) {
if (allowlistKeys.indexOf(elName) === -1) {
el.parentNode.removeChild(el);
return "continue";
}
var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes);
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
var allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
attributeList.forEach(function (attr) {
if (!allowedAttribute(attr, whitelistedAttributes)) {
if (!allowedAttribute(attr, allowedAttributes)) {
el.removeAttribute(attr.nodeName);
}
});
@@ -273,11 +275,7 @@
return createdDocument.body.innerHTML;
}
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -294,7 +292,7 @@
var EVENT_KEY = "." + DATA_KEY;
var CLASS_PREFIX = 'bs-tooltip';
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
var DISALLOWED_ATTRIBUTES = ['sanitize', 'allowList', 'sanitizeFn'];
var DefaultType = {
animation: 'boolean',
template: 'string',
@@ -310,7 +308,7 @@
boundary: '(string|element)',
sanitize: 'boolean',
sanitizeFn: '(null|function)',
whiteList: 'object',
allowList: 'object',
popperConfig: '(null|object)'
};
var AttachmentMap = {
@@ -335,7 +333,7 @@
boundary: 'scrollParent',
sanitize: true,
sanitizeFn: null,
whiteList: DefaultWhitelist,
allowList: DefaultAllowlist,
popperConfig: null
};
var Event$1 = {
@@ -368,7 +366,7 @@
var Tooltip = /*#__PURE__*/function () {
function Tooltip(element, config) {
if (typeof Popper === 'undefined') {
if (typeof Popper__default['default'] === 'undefined') {
throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)');
} // private
@@ -385,7 +383,7 @@
this._setListeners();
Data.setData(element, this.constructor.DATA_KEY, this);
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
} // Getters
@@ -411,11 +409,11 @@
if (event) {
var dataKey = this.constructor.DATA_KEY;
var context = Data.getData(event.target, dataKey);
var context = Data__default['default'].getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.target, this._getDelegateConfig());
Data.setData(event.target, dataKey, context);
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data__default['default'].setData(event.delegateTarget, dataKey, context);
}
context._activeTrigger.click = !context._activeTrigger.click;
@@ -438,9 +436,9 @@
_proto.dispose = function dispose() {
clearTimeout(this._timeout);
Data.removeData(this.element, this.constructor.DATA_KEY);
EventHandler.off(this.element, this.constructor.EVENT_KEY);
EventHandler.off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
Data__default['default'].removeData(this.element, this.constructor.DATA_KEY);
EventHandler__default['default'].off(this.element, this.constructor.EVENT_KEY);
EventHandler__default['default'].off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
if (this.tip) {
this.tip.parentNode.removeChild(this.tip);
@@ -469,7 +467,7 @@
}
if (this.isWithContent() && this._isEnabled) {
var showEvent = EventHandler.trigger(this.element, this.constructor.Event.SHOW);
var showEvent = EventHandler__default['default'].trigger(this.element, this.constructor.Event.SHOW);
var shadowRoot = findShadowRoot(this.element);
var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element);
@@ -495,14 +493,14 @@
var container = this._getContainer();
Data.setData(tip, this.constructor.DATA_KEY, this);
Data__default['default'].setData(tip, this.constructor.DATA_KEY, this);
if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
container.appendChild(tip);
}
EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
EventHandler__default['default'].trigger(this.element, this.constructor.Event.INSERTED);
this._popper = new Popper__default['default'](this.element, tip, this._getPopperConfig(attachment));
tip.classList.add(CLASS_NAME_SHOW); // If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
@@ -512,7 +510,7 @@
var _ref;
(_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
EventHandler.on(element, 'mouseover', noop());
EventHandler__default['default'].on(element, 'mouseover', noop());
});
}
@@ -523,7 +521,7 @@
var prevHoverState = _this._hoverState;
_this._hoverState = null;
EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN);
EventHandler__default['default'].trigger(_this.element, _this.constructor.Event.SHOWN);
if (prevHoverState === HOVER_STATE_OUT) {
_this._leave(null, _this);
@@ -532,7 +530,7 @@
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
var transitionDuration = getTransitionDurationFromElement(this.tip);
EventHandler.one(this.tip, TRANSITION_END, complete);
EventHandler__default['default'].one(this.tip, TRANSITION_END, complete);
emulateTransitionEnd(this.tip, transitionDuration);
} else {
complete();
@@ -554,12 +552,12 @@
_this2.element.removeAttribute('aria-describedby');
EventHandler.trigger(_this2.element, _this2.constructor.Event.HIDDEN);
EventHandler__default['default'].trigger(_this2.element, _this2.constructor.Event.HIDDEN);
_this2._popper.destroy();
};
var hideEvent = EventHandler.trigger(this.element, this.constructor.Event.HIDE);
var hideEvent = EventHandler__default['default'].trigger(this.element, this.constructor.Event.HIDE);
if (hideEvent.defaultPrevented) {
return;
@@ -572,7 +570,7 @@
var _ref2;
(_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (element) {
return EventHandler.off(element, 'mouseover', noop);
return EventHandler__default['default'].off(element, 'mouseover', noop);
});
}
@@ -582,7 +580,7 @@
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
var transitionDuration = getTransitionDurationFromElement(tip);
EventHandler.one(tip, TRANSITION_END, complete);
EventHandler__default['default'].one(tip, TRANSITION_END, complete);
emulateTransitionEnd(tip, transitionDuration);
} else {
complete();
@@ -615,7 +613,7 @@
_proto.setContent = function setContent() {
var tip = this.getTipElement();
this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
};
@@ -644,7 +642,7 @@
if (this.config.html) {
if (this.config.sanitize) {
content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
}
element.innerHTML = content;
@@ -690,7 +688,7 @@
return _this3._handlePopperPlacementChange(data);
}
};
return _objectSpread(_objectSpread({}, defaultBsConfig), this.config.popperConfig);
return _extends({}, defaultBsConfig, this.config.popperConfig);
};
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
@@ -704,7 +702,7 @@
if (typeof this.config.offset === 'function') {
offset.fn = function (data) {
data.offsets = _objectSpread(_objectSpread({}, data.offsets), _this4.config.offset(data.offsets, _this4.element) || {});
data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
return data;
};
} else {
@@ -723,7 +721,7 @@
return this.config.container;
}
return SelectorEngine.findOne(this.config.container);
return SelectorEngine__default['default'].findOne(this.config.container);
};
_proto._getAttachment = function _getAttachment(placement) {
@@ -736,16 +734,16 @@
var triggers = this.config.trigger.split(' ');
triggers.forEach(function (trigger) {
if (trigger === 'click') {
EventHandler.on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
EventHandler__default['default'].on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
return _this5.toggle(event);
});
} else if (trigger !== TRIGGER_MANUAL) {
var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
EventHandler.on(_this5.element, eventIn, _this5.config.selector, function (event) {
EventHandler__default['default'].on(_this5.element, eventIn, _this5.config.selector, function (event) {
return _this5._enter(event);
});
EventHandler.on(_this5.element, eventOut, _this5.config.selector, function (event) {
EventHandler__default['default'].on(_this5.element, eventOut, _this5.config.selector, function (event) {
return _this5._leave(event);
});
}
@@ -757,10 +755,10 @@
}
};
EventHandler.on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
EventHandler__default['default'].on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
if (this.config.selector) {
this.config = _objectSpread(_objectSpread({}, this.config), {}, {
this.config = _extends({}, this.config, {
trigger: 'manual',
selector: ''
});
@@ -780,11 +778,11 @@
_proto._enter = function _enter(event, context) {
var dataKey = this.constructor.DATA_KEY;
context = context || Data.getData(event.target, dataKey);
context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.target, this._getDelegateConfig());
Data.setData(event.target, dataKey, context);
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data__default['default'].setData(event.delegateTarget, dataKey, context);
}
if (event) {
@@ -813,11 +811,11 @@
_proto._leave = function _leave(event, context) {
var dataKey = this.constructor.DATA_KEY;
context = context || Data.getData(event.target, dataKey);
context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.target, this._getDelegateConfig());
Data.setData(event.target, dataKey, context);
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data__default['default'].setData(event.delegateTarget, dataKey, context);
}
if (event) {
@@ -854,7 +852,7 @@
};
_proto._getConfig = function _getConfig(config) {
var dataAttributes = Manipulator.getDataAttributes(this.element);
var dataAttributes = Manipulator__default['default'].getDataAttributes(this.element);
Object.keys(dataAttributes).forEach(function (dataAttr) {
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
delete dataAttributes[dataAttr];
@@ -865,7 +863,7 @@
config.container = config.container[0];
}
config = _objectSpread(_objectSpread(_objectSpread({}, this.constructor.Default), dataAttributes), typeof config === 'object' && config ? config : {});
config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
if (typeof config.delay === 'number') {
config.delay = {
@@ -885,7 +883,7 @@
typeCheckConfig(NAME, config, this.constructor.DefaultType);
if (config.sanitize) {
config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
}
return config;
@@ -919,8 +917,7 @@
};
_proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
var popperInstance = popperData.instance;
this.tip = popperInstance.popper;
this.tip = popperData.instance.popper;
this._cleanTipClass();
@@ -945,7 +942,7 @@
Tooltip.jQueryInterface = function jQueryInterface(config) {
return this.each(function () {
var data = Data.getData(this, DATA_KEY);
var data = Data__default['default'].getData(this, DATA_KEY);
var _config = typeof config === 'object' && config;
@@ -968,7 +965,7 @@
};
Tooltip.getInstance = function getInstance(element) {
return Data.getData(element, DATA_KEY);
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Tooltip, null, [{

File diff suppressed because one or more lines are too long