mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2025-02-09 08:10:39 +03:00
release: 3.5.0
This commit is contained in:
parent
4156a2fc5a
commit
addd9b8530
BIN
License.pdf
Normal file
BIN
License.pdf
Normal file
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
MDB5
|
||||
Version: FREE 3.4.0
|
||||
Version: FREE 3.5.0
|
||||
|
||||
Documentation:
|
||||
https://mdbootstrap.com/docs/standard/
|
||||
|
|
10
css/mdb.dark.min.css
vendored
10
css/mdb.dark.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
6
css/mdb.dark.rtl.min.css
vendored
6
css/mdb.dark.rtl.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
12
css/mdb.min.css
vendored
12
css/mdb.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
6
css/mdb.rtl.min.css
vendored
6
css/mdb.rtl.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
js/mdb.min.js
vendored
4
js/mdb.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mdb-ui-kit",
|
||||
"version": "3.4.0",
|
||||
"version": "3.5.0",
|
||||
"main": "js/mdb.min.js",
|
||||
"homepage": "https://mdbootstrap.com/docs/standard/",
|
||||
"repository": "https://github.com/mdbootstrap/mdb-ui-kit.git",
|
||||
|
|
196
src/js/bootstrap/dist/alert.js
vendored
196
src/js/bootstrap/dist/alert.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap alert.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap alert.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -25,54 +25,20 @@
|
|||
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
|
||||
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
function _inheritsLoose(subClass, superClass) {
|
||||
subClass.prototype = Object.create(superClass.prototype);
|
||||
subClass.prototype.constructor = subClass;
|
||||
|
||||
_setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf =
|
||||
Object.setPrototypeOf ||
|
||||
function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/index.js
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
var MILLISECONDS_MULTIPLIER = 1000;
|
||||
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
const MILLISECONDS_MULTIPLIER = 1000;
|
||||
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
|
||||
var getSelector = function getSelector(element) {
|
||||
var selector = element.getAttribute('data-bs-target');
|
||||
const getSelector = (element) => {
|
||||
let selector = element.getAttribute('data-bs-target');
|
||||
|
||||
if (!selector || selector === '#') {
|
||||
var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
||||
// `document.querySelector` will rightfully complain it is invalid.
|
||||
// See https://github.com/twbs/bootstrap/issues/32273
|
||||
|
@ -91,22 +57,19 @@
|
|||
return selector;
|
||||
};
|
||||
|
||||
var getElementFromSelector = function getElementFromSelector(element) {
|
||||
var selector = getSelector(element);
|
||||
const getElementFromSelector = (element) => {
|
||||
const selector = getSelector(element);
|
||||
return selector ? document.querySelector(selector) : null;
|
||||
};
|
||||
|
||||
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
||||
const getTransitionDurationFromElement = (element) => {
|
||||
if (!element) {
|
||||
return 0;
|
||||
} // Get transition-duration of the element
|
||||
|
||||
var _window$getComputedSt = window.getComputedStyle(element),
|
||||
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||
|
||||
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||
var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
||||
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||
|
||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||
return 0;
|
||||
|
@ -120,14 +83,14 @@
|
|||
);
|
||||
};
|
||||
|
||||
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||
const triggerTransitionEnd = (element) => {
|
||||
element.dispatchEvent(new Event(TRANSITION_END));
|
||||
};
|
||||
|
||||
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
||||
var called = false;
|
||||
var durationPadding = 5;
|
||||
var emulatedDuration = duration + durationPadding;
|
||||
const emulateTransitionEnd = (element, duration) => {
|
||||
let called = false;
|
||||
const durationPadding = 5;
|
||||
const emulatedDuration = duration + durationPadding;
|
||||
|
||||
function listener() {
|
||||
called = true;
|
||||
|
@ -135,16 +98,15 @@
|
|||
}
|
||||
|
||||
element.addEventListener(TRANSITION_END, listener);
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
if (!called) {
|
||||
triggerTransitionEnd(element);
|
||||
}
|
||||
}, emulatedDuration);
|
||||
};
|
||||
|
||||
var getjQuery = function getjQuery() {
|
||||
var _window = window,
|
||||
jQuery = _window.jQuery;
|
||||
const getjQuery = () => {
|
||||
const { jQuery } = window;
|
||||
|
||||
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||
return jQuery;
|
||||
|
@ -153,7 +115,7 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||
const onDOMContentLoaded = (callback) => {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
} else {
|
||||
|
@ -161,19 +123,17 @@
|
|||
}
|
||||
};
|
||||
|
||||
document.documentElement.dir === 'rtl';
|
||||
|
||||
var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
|
||||
onDOMContentLoaded(function () {
|
||||
var $ = getjQuery();
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
var JQUERY_NO_CONFLICT = $.fn[name];
|
||||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||||
$.fn[name] = plugin.jQueryInterface;
|
||||
$.fn[name].Constructor = plugin;
|
||||
|
||||
$.fn[name].noConflict = function () {
|
||||
$.fn[name].noConflict = () => {
|
||||
$.fn[name] = JQUERY_NO_CONFLICT;
|
||||
return plugin.jQueryInterface;
|
||||
};
|
||||
|
@ -181,62 +141,62 @@
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): alert.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var NAME = 'alert';
|
||||
var DATA_KEY = 'bs.alert';
|
||||
var EVENT_KEY = '.' + DATA_KEY;
|
||||
var DATA_API_KEY = '.data-api';
|
||||
var SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
|
||||
var EVENT_CLOSE = 'close' + EVENT_KEY;
|
||||
var EVENT_CLOSED = 'closed' + EVENT_KEY;
|
||||
var EVENT_CLICK_DATA_API = 'click' + EVENT_KEY + DATA_API_KEY;
|
||||
var CLASS_NAME_ALERT = 'alert';
|
||||
var CLASS_NAME_FADE = 'fade';
|
||||
var CLASS_NAME_SHOW = 'show';
|
||||
const NAME = 'alert';
|
||||
const DATA_KEY = 'bs.alert';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const DATA_API_KEY = '.data-api';
|
||||
const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
|
||||
const EVENT_CLOSE = `close${EVENT_KEY}`;
|
||||
const EVENT_CLOSED = `closed${EVENT_KEY}`;
|
||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const CLASS_NAME_ALERT = 'alert';
|
||||
const CLASS_NAME_FADE = 'fade';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var Alert = /*#__PURE__*/ (function (_BaseComponent) {
|
||||
_inheritsLoose(Alert, _BaseComponent);
|
||||
class Alert extends BaseComponent__default['default'] {
|
||||
// Getters
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
} // Public
|
||||
|
||||
function Alert() {
|
||||
return _BaseComponent.apply(this, arguments) || this;
|
||||
}
|
||||
close(element) {
|
||||
const rootElement = element ? this._getRootElement(element) : this._element;
|
||||
|
||||
var _proto = Alert.prototype;
|
||||
|
||||
// Public
|
||||
_proto.close = function close(element) {
|
||||
var rootElement = element ? this._getRootElement(element) : this._element;
|
||||
|
||||
var customEvent = this._triggerCloseEvent(rootElement);
|
||||
const customEvent = this._triggerCloseEvent(rootElement);
|
||||
|
||||
if (customEvent === null || customEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._removeElement(rootElement);
|
||||
}; // Private
|
||||
} // Private
|
||||
|
||||
_proto._getRootElement = function _getRootElement(element) {
|
||||
return getElementFromSelector(element) || element.closest('.' + CLASS_NAME_ALERT);
|
||||
};
|
||||
_getRootElement(element) {
|
||||
return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
|
||||
}
|
||||
|
||||
_proto._triggerCloseEvent = function _triggerCloseEvent(element) {
|
||||
_triggerCloseEvent(element) {
|
||||
return EventHandler__default['default'].trigger(element, EVENT_CLOSE);
|
||||
};
|
||||
|
||||
_proto._removeElement = function _removeElement(element) {
|
||||
var _this = this;
|
||||
}
|
||||
|
||||
_removeElement(element) {
|
||||
element.classList.remove(CLASS_NAME_SHOW);
|
||||
|
||||
if (!element.classList.contains(CLASS_NAME_FADE)) {
|
||||
|
@ -245,24 +205,24 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var transitionDuration = getTransitionDurationFromElement(element);
|
||||
EventHandler__default['default'].one(element, 'transitionend', function () {
|
||||
return _this._destroyElement(element);
|
||||
});
|
||||
const transitionDuration = getTransitionDurationFromElement(element);
|
||||
EventHandler__default['default'].one(element, 'transitionend', () =>
|
||||
this._destroyElement(element)
|
||||
);
|
||||
emulateTransitionEnd(element, transitionDuration);
|
||||
};
|
||||
}
|
||||
|
||||
_proto._destroyElement = function _destroyElement(element) {
|
||||
_destroyElement(element) {
|
||||
if (element.parentNode) {
|
||||
element.parentNode.removeChild(element);
|
||||
}
|
||||
|
||||
EventHandler__default['default'].trigger(element, EVENT_CLOSED);
|
||||
}; // Static
|
||||
} // Static
|
||||
|
||||
Alert.jQueryInterface = function jQueryInterface(config) {
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
var data = Data__default['default'].getData(this, DATA_KEY);
|
||||
let data = Data__default['default'].get(this, DATA_KEY);
|
||||
|
||||
if (!data) {
|
||||
data = new Alert(this);
|
||||
|
@ -272,9 +232,9 @@
|
|||
data[config](this);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Alert.handleDismiss = function handleDismiss(alertInstance) {
|
||||
static handleDismiss(alertInstance) {
|
||||
return function (event) {
|
||||
if (event) {
|
||||
event.preventDefault();
|
||||
|
@ -282,20 +242,8 @@
|
|||
|
||||
alertInstance.close(this);
|
||||
};
|
||||
};
|
||||
|
||||
_createClass(Alert, null, [
|
||||
{
|
||||
key: 'DATA_KEY',
|
||||
// Getters
|
||||
get: function get() {
|
||||
return DATA_KEY;
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
return Alert;
|
||||
})(BaseComponent__default['default']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Data Api implementation
|
||||
|
|
2
src/js/bootstrap/dist/alert.js.map
vendored
2
src/js/bootstrap/dist/alert.js.map
vendored
File diff suppressed because one or more lines are too long
63
src/js/bootstrap/dist/base-component.js
vendored
63
src/js/bootstrap/dist/base-component.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap base-component.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap base-component.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -19,63 +19,46 @@
|
|||
|
||||
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): base-component.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var VERSION = '5.0.0-beta2';
|
||||
const VERSION = '5.0.0-beta3';
|
||||
|
||||
class BaseComponent {
|
||||
constructor(element) {
|
||||
element = typeof element === 'string' ? document.querySelector(element) : element;
|
||||
|
||||
var BaseComponent = /*#__PURE__*/ (function () {
|
||||
function BaseComponent(element) {
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._element = element;
|
||||
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
||||
Data__default['default'].set(this._element, this.constructor.DATA_KEY, this);
|
||||
}
|
||||
|
||||
var _proto = BaseComponent.prototype;
|
||||
|
||||
_proto.dispose = function dispose() {
|
||||
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
|
||||
dispose() {
|
||||
Data__default['default'].remove(this._element, this.constructor.DATA_KEY);
|
||||
this._element = null;
|
||||
};
|
||||
}
|
||||
/** Static */
|
||||
|
||||
BaseComponent.getInstance = function getInstance(element) {
|
||||
return Data__default['default'].getData(element, this.DATA_KEY);
|
||||
};
|
||||
static getInstance(element) {
|
||||
return Data__default['default'].get(element, this.DATA_KEY);
|
||||
}
|
||||
|
||||
_createClass(BaseComponent, null, [
|
||||
{
|
||||
key: 'VERSION',
|
||||
get: function get() {
|
||||
return VERSION;
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
return BaseComponent;
|
||||
})();
|
||||
static get VERSION() {
|
||||
return VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
return BaseComponent;
|
||||
});
|
||||
|
|
2
src/js/bootstrap/dist/base-component.js.map
vendored
2
src/js/bootstrap/dist/base-component.js.map
vendored
|
@ -1 +1 @@
|
|||
{"version":3,"file":"base-component.js","sources":["../src/base-component.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta2): base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst VERSION = '5.0.0-beta2'\n\nclass BaseComponent {\n constructor(element) {\n if (!element) {\n return\n }\n\n this._element = element\n Data.setData(element, this.constructor.DATA_KEY, this)\n }\n\n dispose() {\n Data.removeData(this._element, this.constructor.DATA_KEY)\n this._element = null\n }\n\n /** Static */\n\n static getInstance(element) {\n return Data.getData(element, this.DATA_KEY)\n }\n\n static get VERSION() {\n return VERSION\n }\n}\n\nexport default BaseComponent\n"],"names":["VERSION","BaseComponent","element","_element","Data","setData","constructor","DATA_KEY","dispose","removeData","getInstance","getData"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA;EACA;EACA;EACA;EACA;;EAEA,IAAMA,OAAO,GAAG,aAAhB;;MAEMC;EACJ,yBAAYC,OAAZ,EAAqB;EACnB,QAAI,CAACA,OAAL,EAAc;EACZ;EACD;;EAED,SAAKC,QAAL,GAAgBD,OAAhB;EACAE,IAAAA,wBAAI,CAACC,OAAL,CAAaH,OAAb,EAAsB,KAAKI,WAAL,CAAiBC,QAAvC,EAAiD,IAAjD;EACD;;;;WAEDC,UAAA,mBAAU;EACRJ,IAAAA,wBAAI,CAACK,UAAL,CAAgB,KAAKN,QAArB,EAA+B,KAAKG,WAAL,CAAiBC,QAAhD;EACA,SAAKJ,QAAL,GAAgB,IAAhB;EACD;EAED;;;kBAEOO,cAAP,qBAAmBR,OAAnB,EAA4B;EAC1B,WAAOE,wBAAI,CAACO,OAAL,CAAaT,OAAb,EAAsB,KAAKK,QAA3B,CAAP;EACD;;;;WAED,eAAqB;EACnB,aAAOP,OAAP;EACD;;;;;;;;;;;;"}
|
||||
{"version":3,"file":"base-component.js","sources":["../src/base-component.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta3): base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst VERSION = '5.0.0-beta3'\n\nclass BaseComponent {\n constructor(element) {\n element = typeof element === 'string' ? document.querySelector(element) : element\n\n if (!element) {\n return\n }\n\n this._element = element\n Data.set(this._element, this.constructor.DATA_KEY, this)\n }\n\n dispose() {\n Data.remove(this._element, this.constructor.DATA_KEY)\n this._element = null\n }\n\n /** Static */\n\n static getInstance(element) {\n return Data.get(element, this.DATA_KEY)\n }\n\n static get VERSION() {\n return VERSION\n }\n}\n\nexport default BaseComponent\n"],"names":["VERSION","BaseComponent","constructor","element","document","querySelector","_element","Data","set","DATA_KEY","dispose","remove","getInstance","get"],"mappings":";;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAIA;EACA;EACA;EACA;EACA;;EAEA,MAAMA,OAAO,GAAG,aAAhB;;EAEA,MAAMC,aAAN,CAAoB;EAClBC,EAAAA,WAAW,CAACC,OAAD,EAAU;EACnBA,IAAAA,OAAO,GAAG,OAAOA,OAAP,KAAmB,QAAnB,GAA8BC,QAAQ,CAACC,aAAT,CAAuBF,OAAvB,CAA9B,GAAgEA,OAA1E;;EAEA,QAAI,CAACA,OAAL,EAAc;EACZ;EACD;;EAED,SAAKG,QAAL,GAAgBH,OAAhB;EACAI,IAAAA,wBAAI,CAACC,GAAL,CAAS,KAAKF,QAAd,EAAwB,KAAKJ,WAAL,CAAiBO,QAAzC,EAAmD,IAAnD;EACD;;EAEDC,EAAAA,OAAO,GAAG;EACRH,IAAAA,wBAAI,CAACI,MAAL,CAAY,KAAKL,QAAjB,EAA2B,KAAKJ,WAAL,CAAiBO,QAA5C;EACA,SAAKH,QAAL,GAAgB,IAAhB;EACD;EAED;;;EAEkB,SAAXM,WAAW,CAACT,OAAD,EAAU;EAC1B,WAAOI,wBAAI,CAACM,GAAL,CAASV,OAAT,EAAkB,KAAKM,QAAvB,CAAP;EACD;;EAEiB,aAAPT,OAAO,GAAG;EACnB,WAAOA,OAAP;EACD;;EAzBiB;;;;;;;;"}
|
121
src/js/bootstrap/dist/button.js
vendored
121
src/js/bootstrap/dist/button.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap button.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap button.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -25,50 +25,15 @@
|
|||
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
|
||||
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
function _inheritsLoose(subClass, superClass) {
|
||||
subClass.prototype = Object.create(superClass.prototype);
|
||||
subClass.prototype.constructor = subClass;
|
||||
|
||||
_setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf =
|
||||
Object.setPrototypeOf ||
|
||||
function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/index.js
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var getjQuery = function getjQuery() {
|
||||
var _window = window,
|
||||
jQuery = _window.jQuery;
|
||||
const getjQuery = () => {
|
||||
const { jQuery } = window;
|
||||
|
||||
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||
return jQuery;
|
||||
|
@ -77,7 +42,7 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||
const onDOMContentLoaded = (callback) => {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
} else {
|
||||
|
@ -85,19 +50,17 @@
|
|||
}
|
||||
};
|
||||
|
||||
document.documentElement.dir === 'rtl';
|
||||
|
||||
var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
|
||||
onDOMContentLoaded(function () {
|
||||
var $ = getjQuery();
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
var JQUERY_NO_CONFLICT = $.fn[name];
|
||||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||||
$.fn[name] = plugin.jQueryInterface;
|
||||
$.fn[name].Constructor = plugin;
|
||||
|
||||
$.fn[name].noConflict = function () {
|
||||
$.fn[name].noConflict = () => {
|
||||
$.fn[name] = JQUERY_NO_CONFLICT;
|
||||
return plugin.jQueryInterface;
|
||||
};
|
||||
|
@ -105,43 +68,45 @@
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): button.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var NAME = 'button';
|
||||
var DATA_KEY = 'bs.button';
|
||||
var EVENT_KEY = '.' + DATA_KEY;
|
||||
var DATA_API_KEY = '.data-api';
|
||||
var CLASS_NAME_ACTIVE = 'active';
|
||||
var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]';
|
||||
var EVENT_CLICK_DATA_API = 'click' + EVENT_KEY + DATA_API_KEY;
|
||||
const NAME = 'button';
|
||||
const DATA_KEY = 'bs.button';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const DATA_API_KEY = '.data-api';
|
||||
const CLASS_NAME_ACTIVE = 'active';
|
||||
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]';
|
||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var Button = /*#__PURE__*/ (function (_BaseComponent) {
|
||||
_inheritsLoose(Button, _BaseComponent);
|
||||
class Button extends BaseComponent__default['default'] {
|
||||
// Getters
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
} // Public
|
||||
|
||||
function Button() {
|
||||
return _BaseComponent.apply(this, arguments) || this;
|
||||
}
|
||||
|
||||
var _proto = Button.prototype;
|
||||
|
||||
// Public
|
||||
_proto.toggle = function toggle() {
|
||||
toggle() {
|
||||
// Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
|
||||
this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE));
|
||||
}; // Static
|
||||
} // Static
|
||||
|
||||
Button.jQueryInterface = function jQueryInterface(config) {
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
var data = Data__default['default'].getData(this, DATA_KEY);
|
||||
let data = Data__default['default'].get(this, DATA_KEY);
|
||||
|
||||
if (!data) {
|
||||
data = new Button(this);
|
||||
|
@ -151,20 +116,8 @@
|
|||
data[config]();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_createClass(Button, null, [
|
||||
{
|
||||
key: 'DATA_KEY',
|
||||
// Getters
|
||||
get: function get() {
|
||||
return DATA_KEY;
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
return Button;
|
||||
})(BaseComponent__default['default']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Data Api implementation
|
||||
|
@ -175,10 +128,10 @@
|
|||
document,
|
||||
EVENT_CLICK_DATA_API,
|
||||
SELECTOR_DATA_TOGGLE,
|
||||
function (event) {
|
||||
(event) => {
|
||||
event.preventDefault();
|
||||
var button = event.target.closest(SELECTOR_DATA_TOGGLE);
|
||||
var data = Data__default['default'].getData(button, DATA_KEY);
|
||||
const button = event.target.closest(SELECTOR_DATA_TOGGLE);
|
||||
let data = Data__default['default'].get(button, DATA_KEY);
|
||||
|
||||
if (!data) {
|
||||
data = new Button(button);
|
||||
|
|
2
src/js/bootstrap/dist/button.js.map
vendored
2
src/js/bootstrap/dist/button.js.map
vendored
File diff suppressed because one or more lines are too long
683
src/js/bootstrap/dist/carousel.js
vendored
683
src/js/bootstrap/dist/carousel.js
vendored
File diff suppressed because it is too large
Load Diff
2
src/js/bootstrap/dist/carousel.js.map
vendored
2
src/js/bootstrap/dist/carousel.js.map
vendored
File diff suppressed because one or more lines are too long
445
src/js/bootstrap/dist/collapse.js
vendored
445
src/js/bootstrap/dist/collapse.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap collapse.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap collapse.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -41,72 +41,18 @@
|
|||
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
|
||||
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
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 _inheritsLoose(subClass, superClass) {
|
||||
subClass.prototype = Object.create(superClass.prototype);
|
||||
subClass.prototype.constructor = subClass;
|
||||
|
||||
_setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf =
|
||||
Object.setPrototypeOf ||
|
||||
function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/index.js
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
var MILLISECONDS_MULTIPLIER = 1000;
|
||||
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
const MILLISECONDS_MULTIPLIER = 1000;
|
||||
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
|
||||
var toType = function toType(obj) {
|
||||
const toType = (obj) => {
|
||||
if (obj === null || obj === undefined) {
|
||||
return '' + obj;
|
||||
return `${obj}`;
|
||||
}
|
||||
|
||||
return {}.toString
|
||||
|
@ -115,11 +61,11 @@
|
|||
.toLowerCase();
|
||||
};
|
||||
|
||||
var getSelector = function getSelector(element) {
|
||||
var selector = element.getAttribute('data-bs-target');
|
||||
const getSelector = (element) => {
|
||||
let selector = element.getAttribute('data-bs-target');
|
||||
|
||||
if (!selector || selector === '#') {
|
||||
var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
||||
// `document.querySelector` will rightfully complain it is invalid.
|
||||
// See https://github.com/twbs/bootstrap/issues/32273
|
||||
|
@ -138,8 +84,8 @@
|
|||
return selector;
|
||||
};
|
||||
|
||||
var getSelectorFromElement = function getSelectorFromElement(element) {
|
||||
var selector = getSelector(element);
|
||||
const getSelectorFromElement = (element) => {
|
||||
const selector = getSelector(element);
|
||||
|
||||
if (selector) {
|
||||
return document.querySelector(selector) ? selector : null;
|
||||
|
@ -148,22 +94,19 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
var getElementFromSelector = function getElementFromSelector(element) {
|
||||
var selector = getSelector(element);
|
||||
const getElementFromSelector = (element) => {
|
||||
const selector = getSelector(element);
|
||||
return selector ? document.querySelector(selector) : null;
|
||||
};
|
||||
|
||||
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
||||
const getTransitionDurationFromElement = (element) => {
|
||||
if (!element) {
|
||||
return 0;
|
||||
} // Get transition-duration of the element
|
||||
|
||||
var _window$getComputedSt = window.getComputedStyle(element),
|
||||
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||
|
||||
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||
var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
||||
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||
|
||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||
return 0;
|
||||
|
@ -177,18 +120,16 @@
|
|||
);
|
||||
};
|
||||
|
||||
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||
const triggerTransitionEnd = (element) => {
|
||||
element.dispatchEvent(new Event(TRANSITION_END));
|
||||
};
|
||||
|
||||
var isElement = function isElement(obj) {
|
||||
return (obj[0] || obj).nodeType;
|
||||
};
|
||||
const isElement = (obj) => (obj[0] || obj).nodeType;
|
||||
|
||||
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
||||
var called = false;
|
||||
var durationPadding = 5;
|
||||
var emulatedDuration = duration + durationPadding;
|
||||
const emulateTransitionEnd = (element, duration) => {
|
||||
let called = false;
|
||||
const durationPadding = 5;
|
||||
const emulatedDuration = duration + durationPadding;
|
||||
|
||||
function listener() {
|
||||
called = true;
|
||||
|
@ -196,37 +137,33 @@
|
|||
}
|
||||
|
||||
element.addEventListener(TRANSITION_END, listener);
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
if (!called) {
|
||||
triggerTransitionEnd(element);
|
||||
}
|
||||
}, emulatedDuration);
|
||||
};
|
||||
|
||||
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
||||
Object.keys(configTypes).forEach(function (property) {
|
||||
var expectedTypes = configTypes[property];
|
||||
var value = config[property];
|
||||
var valueType = value && isElement(value) ? 'element' : toType(value);
|
||||
const typeCheckConfig = (componentName, config, configTypes) => {
|
||||
Object.keys(configTypes).forEach((property) => {
|
||||
const expectedTypes = configTypes[property];
|
||||
const value = config[property];
|
||||
const valueType = value && isElement(value) ? 'element' : toType(value);
|
||||
|
||||
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||
throw new TypeError(
|
||||
componentName.toUpperCase() +
|
||||
': ' +
|
||||
('Option "' + property + '" provided type "' + valueType + '" ') +
|
||||
('but expected type "' + expectedTypes + '".')
|
||||
`${componentName.toUpperCase()}: ` +
|
||||
`Option "${property}" provided type "${valueType}" ` +
|
||||
`but expected type "${expectedTypes}".`
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var reflow = function reflow(element) {
|
||||
return element.offsetHeight;
|
||||
};
|
||||
const reflow = (element) => element.offsetHeight;
|
||||
|
||||
var getjQuery = function getjQuery() {
|
||||
var _window = window,
|
||||
jQuery = _window.jQuery;
|
||||
const getjQuery = () => {
|
||||
const { jQuery } = window;
|
||||
|
||||
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||
return jQuery;
|
||||
|
@ -235,7 +172,7 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||
const onDOMContentLoaded = (callback) => {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
} else {
|
||||
|
@ -243,19 +180,17 @@
|
|||
}
|
||||
};
|
||||
|
||||
document.documentElement.dir === 'rtl';
|
||||
|
||||
var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
|
||||
onDOMContentLoaded(function () {
|
||||
var $ = getjQuery();
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
var JQUERY_NO_CONFLICT = $.fn[name];
|
||||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||||
$.fn[name] = plugin.jQueryInterface;
|
||||
$.fn[name].Constructor = plugin;
|
||||
|
||||
$.fn[name].noConflict = function () {
|
||||
$.fn[name].noConflict = () => {
|
||||
$.fn[name] = JQUERY_NO_CONFLICT;
|
||||
return plugin.jQueryInterface;
|
||||
};
|
||||
|
@ -263,117 +198,115 @@
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): collapse.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var NAME = 'collapse';
|
||||
var DATA_KEY = 'bs.collapse';
|
||||
var EVENT_KEY = '.' + DATA_KEY;
|
||||
var DATA_API_KEY = '.data-api';
|
||||
var Default = {
|
||||
const NAME = 'collapse';
|
||||
const DATA_KEY = 'bs.collapse';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const DATA_API_KEY = '.data-api';
|
||||
const Default = {
|
||||
toggle: true,
|
||||
parent: '',
|
||||
};
|
||||
var DefaultType = {
|
||||
const DefaultType = {
|
||||
toggle: 'boolean',
|
||||
parent: '(string|element)',
|
||||
};
|
||||
var EVENT_SHOW = 'show' + EVENT_KEY;
|
||||
var EVENT_SHOWN = 'shown' + EVENT_KEY;
|
||||
var EVENT_HIDE = 'hide' + EVENT_KEY;
|
||||
var EVENT_HIDDEN = 'hidden' + EVENT_KEY;
|
||||
var EVENT_CLICK_DATA_API = 'click' + EVENT_KEY + DATA_API_KEY;
|
||||
var CLASS_NAME_SHOW = 'show';
|
||||
var CLASS_NAME_COLLAPSE = 'collapse';
|
||||
var CLASS_NAME_COLLAPSING = 'collapsing';
|
||||
var CLASS_NAME_COLLAPSED = 'collapsed';
|
||||
var WIDTH = 'width';
|
||||
var HEIGHT = 'height';
|
||||
var SELECTOR_ACTIVES = '.show, .collapsing';
|
||||
var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]';
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
const CLASS_NAME_COLLAPSE = 'collapse';
|
||||
const CLASS_NAME_COLLAPSING = 'collapsing';
|
||||
const CLASS_NAME_COLLAPSED = 'collapsed';
|
||||
const WIDTH = 'width';
|
||||
const HEIGHT = 'height';
|
||||
const SELECTOR_ACTIVES = '.show, .collapsing';
|
||||
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]';
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var Collapse = /*#__PURE__*/ (function (_BaseComponent) {
|
||||
_inheritsLoose(Collapse, _BaseComponent);
|
||||
|
||||
function Collapse(element, config) {
|
||||
var _this;
|
||||
|
||||
_this = _BaseComponent.call(this, element) || this;
|
||||
_this._isTransitioning = false;
|
||||
_this._config = _this._getConfig(config);
|
||||
_this._triggerArray = SelectorEngine__default['default'].find(
|
||||
SELECTOR_DATA_TOGGLE +
|
||||
'[href="#' +
|
||||
element.id +
|
||||
'"],' +
|
||||
(SELECTOR_DATA_TOGGLE + '[data-bs-target="#' + element.id + '"]')
|
||||
class Collapse extends BaseComponent__default['default'] {
|
||||
constructor(element, config) {
|
||||
super(element);
|
||||
this._isTransitioning = false;
|
||||
this._config = this._getConfig(config);
|
||||
this._triggerArray = SelectorEngine__default['default'].find(
|
||||
`${SELECTOR_DATA_TOGGLE}[href="#${this._element.id}"],` +
|
||||
`${SELECTOR_DATA_TOGGLE}[data-bs-target="#${this._element.id}"]`
|
||||
);
|
||||
var toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
|
||||
const 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__default['default']
|
||||
for (let i = 0, len = toggleList.length; i < len; i++) {
|
||||
const elem = toggleList[i];
|
||||
const selector = getSelectorFromElement(elem);
|
||||
const filterElement = SelectorEngine__default['default']
|
||||
.find(selector)
|
||||
.filter(function (foundElem) {
|
||||
return foundElem === element;
|
||||
});
|
||||
.filter((foundElem) => foundElem === this._element);
|
||||
|
||||
if (selector !== null && filterElement.length) {
|
||||
_this._selector = selector;
|
||||
this._selector = selector;
|
||||
|
||||
_this._triggerArray.push(elem);
|
||||
this._triggerArray.push(elem);
|
||||
}
|
||||
}
|
||||
|
||||
_this._parent = _this._config.parent ? _this._getParent() : null;
|
||||
this._parent = this._config.parent ? this._getParent() : null;
|
||||
|
||||
if (!_this._config.parent) {
|
||||
_this._addAriaAndCollapsedClass(_this._element, _this._triggerArray);
|
||||
if (!this._config.parent) {
|
||||
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
||||
}
|
||||
|
||||
if (_this._config.toggle) {
|
||||
_this.toggle();
|
||||
if (this._config.toggle) {
|
||||
this.toggle();
|
||||
}
|
||||
|
||||
return _this;
|
||||
} // Getters
|
||||
|
||||
var _proto = Collapse.prototype;
|
||||
static get Default() {
|
||||
return Default;
|
||||
}
|
||||
|
||||
// Public
|
||||
_proto.toggle = function toggle() {
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
} // Public
|
||||
|
||||
toggle() {
|
||||
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||
this.hide();
|
||||
} else {
|
||||
this.show();
|
||||
}
|
||||
};
|
||||
|
||||
_proto.show = function show() {
|
||||
var _this2 = this;
|
||||
}
|
||||
|
||||
show() {
|
||||
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var actives;
|
||||
var activesData;
|
||||
let actives;
|
||||
let activesData;
|
||||
|
||||
if (this._parent) {
|
||||
actives = SelectorEngine__default['default']
|
||||
.find(SELECTOR_ACTIVES, this._parent)
|
||||
.filter(function (elem) {
|
||||
if (typeof _this2._config.parent === 'string') {
|
||||
return elem.getAttribute('data-bs-parent') === _this2._config.parent;
|
||||
.filter((elem) => {
|
||||
if (typeof this._config.parent === 'string') {
|
||||
return elem.getAttribute('data-bs-parent') === this._config.parent;
|
||||
}
|
||||
|
||||
return elem.classList.contains(CLASS_NAME_COLLAPSE);
|
||||
|
@ -384,14 +317,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
var container = SelectorEngine__default['default'].findOne(this._selector);
|
||||
const container = SelectorEngine__default['default'].findOne(this._selector);
|
||||
|
||||
if (actives) {
|
||||
var tempActiveData = actives.find(function (elem) {
|
||||
return container !== elem;
|
||||
});
|
||||
const tempActiveData = actives.find((elem) => container !== elem);
|
||||
activesData = tempActiveData
|
||||
? Data__default['default'].getData(tempActiveData, DATA_KEY)
|
||||
? Data__default['default'].get(tempActiveData, DATA_KEY)
|
||||
: null;
|
||||
|
||||
if (activesData && activesData._isTransitioning) {
|
||||
|
@ -399,25 +330,25 @@
|
|||
}
|
||||
}
|
||||
|
||||
var startEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
|
||||
const startEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
|
||||
|
||||
if (startEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (actives) {
|
||||
actives.forEach(function (elemActive) {
|
||||
actives.forEach((elemActive) => {
|
||||
if (container !== elemActive) {
|
||||
Collapse.collapseInterface(elemActive, 'hide');
|
||||
}
|
||||
|
||||
if (!activesData) {
|
||||
Data__default['default'].setData(elemActive, DATA_KEY, null);
|
||||
Data__default['default'].set(elemActive, DATA_KEY, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var dimension = this._getDimension();
|
||||
const dimension = this._getDimension();
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_COLLAPSE);
|
||||
|
||||
|
@ -426,7 +357,7 @@
|
|||
this._element.style[dimension] = 0;
|
||||
|
||||
if (this._triggerArray.length) {
|
||||
this._triggerArray.forEach(function (element) {
|
||||
this._triggerArray.forEach((element) => {
|
||||
element.classList.remove(CLASS_NAME_COLLAPSED);
|
||||
element.setAttribute('aria-expanded', true);
|
||||
});
|
||||
|
@ -434,54 +365,50 @@
|
|||
|
||||
this.setTransitioning(true);
|
||||
|
||||
var complete = function complete() {
|
||||
_this2._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||||
const complete = () => {
|
||||
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||||
|
||||
_this2._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
||||
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
||||
|
||||
_this2._element.style[dimension] = '';
|
||||
|
||||
_this2.setTransitioning(false);
|
||||
|
||||
EventHandler__default['default'].trigger(_this2._element, EVENT_SHOWN);
|
||||
this._element.style[dimension] = '';
|
||||
this.setTransitioning(false);
|
||||
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);
|
||||
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
||||
const scrollSize = `scroll${capitalizedDimension}`;
|
||||
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
EventHandler__default['default'].one(this._element, 'transitionend', complete);
|
||||
emulateTransitionEnd(this._element, transitionDuration);
|
||||
this._element.style[dimension] = this._element[scrollSize] + 'px';
|
||||
};
|
||||
|
||||
_proto.hide = function hide() {
|
||||
var _this3 = this;
|
||||
this._element.style[dimension] = `${this._element[scrollSize]}px`;
|
||||
}
|
||||
|
||||
hide() {
|
||||
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var startEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
|
||||
const startEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
|
||||
|
||||
if (startEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
var dimension = this._getDimension();
|
||||
const dimension = this._getDimension();
|
||||
|
||||
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + 'px';
|
||||
this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
|
||||
reflow(this._element);
|
||||
|
||||
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
||||
|
||||
var triggerArrayLength = this._triggerArray.length;
|
||||
const triggerArrayLength = this._triggerArray.length;
|
||||
|
||||
if (triggerArrayLength > 0) {
|
||||
for (var i = 0; i < triggerArrayLength; i++) {
|
||||
var trigger = this._triggerArray[i];
|
||||
var elem = getElementFromSelector(trigger);
|
||||
for (let i = 0; i < triggerArrayLength; i++) {
|
||||
const trigger = this._triggerArray[i];
|
||||
const elem = getElementFromSelector(trigger);
|
||||
|
||||
if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
|
||||
trigger.classList.add(CLASS_NAME_COLLAPSED);
|
||||
|
@ -492,51 +419,48 @@
|
|||
|
||||
this.setTransitioning(true);
|
||||
|
||||
var complete = function complete() {
|
||||
_this3.setTransitioning(false);
|
||||
const complete = () => {
|
||||
this.setTransitioning(false);
|
||||
|
||||
_this3._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||||
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||||
|
||||
_this3._element.classList.add(CLASS_NAME_COLLAPSE);
|
||||
this._element.classList.add(CLASS_NAME_COLLAPSE);
|
||||
|
||||
EventHandler__default['default'].trigger(_this3._element, EVENT_HIDDEN);
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
|
||||
};
|
||||
|
||||
this._element.style[dimension] = '';
|
||||
var transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
EventHandler__default['default'].one(this._element, 'transitionend', complete);
|
||||
emulateTransitionEnd(this._element, transitionDuration);
|
||||
};
|
||||
}
|
||||
|
||||
_proto.setTransitioning = function setTransitioning(isTransitioning) {
|
||||
setTransitioning(isTransitioning) {
|
||||
this._isTransitioning = isTransitioning;
|
||||
};
|
||||
|
||||
_proto.dispose = function dispose() {
|
||||
_BaseComponent.prototype.dispose.call(this);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
super.dispose();
|
||||
this._config = null;
|
||||
this._parent = null;
|
||||
this._triggerArray = null;
|
||||
this._isTransitioning = null;
|
||||
}; // Private
|
||||
} // Private
|
||||
|
||||
_proto._getConfig = function _getConfig(config) {
|
||||
config = _extends({}, Default, config);
|
||||
_getConfig(config) {
|
||||
config = { ...Default, ...config };
|
||||
config.toggle = Boolean(config.toggle); // Coerce string values
|
||||
|
||||
typeCheckConfig(NAME, config, DefaultType);
|
||||
return config;
|
||||
};
|
||||
}
|
||||
|
||||
_proto._getDimension = function _getDimension() {
|
||||
_getDimension() {
|
||||
return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
|
||||
};
|
||||
}
|
||||
|
||||
_proto._getParent = function _getParent() {
|
||||
var _this4 = this;
|
||||
|
||||
var parent = this._config.parent;
|
||||
_getParent() {
|
||||
let { parent } = this._config;
|
||||
|
||||
if (isElement(parent)) {
|
||||
// it's a jQuery object
|
||||
|
@ -547,22 +471,22 @@
|
|||
parent = SelectorEngine__default['default'].findOne(parent);
|
||||
}
|
||||
|
||||
var selector = SELECTOR_DATA_TOGGLE + '[data-bs-parent="' + parent + '"]';
|
||||
SelectorEngine__default['default'].find(selector, parent).forEach(function (element) {
|
||||
var selected = getElementFromSelector(element);
|
||||
const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`;
|
||||
SelectorEngine__default['default'].find(selector, parent).forEach((element) => {
|
||||
const selected = getElementFromSelector(element);
|
||||
|
||||
_this4._addAriaAndCollapsedClass(selected, [element]);
|
||||
this._addAriaAndCollapsedClass(selected, [element]);
|
||||
});
|
||||
return parent;
|
||||
};
|
||||
}
|
||||
|
||||
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
|
||||
_addAriaAndCollapsedClass(element, triggerArray) {
|
||||
if (!element || !triggerArray.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var isOpen = element.classList.contains(CLASS_NAME_SHOW);
|
||||
triggerArray.forEach(function (elem) {
|
||||
const isOpen = element.classList.contains(CLASS_NAME_SHOW);
|
||||
triggerArray.forEach((elem) => {
|
||||
if (isOpen) {
|
||||
elem.classList.remove(CLASS_NAME_COLLAPSED);
|
||||
} else {
|
||||
|
@ -571,17 +495,15 @@
|
|||
|
||||
elem.setAttribute('aria-expanded', isOpen);
|
||||
});
|
||||
}; // Static
|
||||
} // Static
|
||||
|
||||
Collapse.collapseInterface = function collapseInterface(element, config) {
|
||||
var data = Data__default['default'].getData(element, DATA_KEY);
|
||||
|
||||
var _config = _extends(
|
||||
{},
|
||||
Default,
|
||||
Manipulator__default['default'].getDataAttributes(element),
|
||||
typeof config === 'object' && config ? config : {}
|
||||
);
|
||||
static collapseInterface(element, config) {
|
||||
let data = Data__default['default'].get(element, DATA_KEY);
|
||||
const _config = {
|
||||
...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;
|
||||
|
@ -593,36 +515,19 @@
|
|||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
throw new TypeError('No method named "' + config + '"');
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config]();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Collapse.jQueryInterface = function jQueryInterface(config) {
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
Collapse.collapseInterface(this, config);
|
||||
});
|
||||
};
|
||||
|
||||
_createClass(Collapse, null, [
|
||||
{
|
||||
key: 'Default',
|
||||
get: function get() {
|
||||
return Default;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'DATA_KEY',
|
||||
get: function get() {
|
||||
return DATA_KEY;
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
return Collapse;
|
||||
})(BaseComponent__default['default']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Data Api implementation
|
||||
|
@ -642,12 +547,12 @@
|
|||
event.preventDefault();
|
||||
}
|
||||
|
||||
var triggerData = Manipulator__default['default'].getDataAttributes(this);
|
||||
var selector = getSelectorFromElement(this);
|
||||
var selectorElements = SelectorEngine__default['default'].find(selector);
|
||||
selectorElements.forEach(function (element) {
|
||||
var data = Data__default['default'].getData(element, DATA_KEY);
|
||||
var config;
|
||||
const triggerData = Manipulator__default['default'].getDataAttributes(this);
|
||||
const selector = getSelectorFromElement(this);
|
||||
const selectorElements = SelectorEngine__default['default'].find(selector);
|
||||
selectorElements.forEach((element) => {
|
||||
const data = Data__default['default'].get(element, DATA_KEY);
|
||||
let config;
|
||||
|
||||
if (data) {
|
||||
// update parent attribute
|
||||
|
|
2
src/js/bootstrap/dist/collapse.js.map
vendored
2
src/js/bootstrap/dist/collapse.js.map
vendored
File diff suppressed because one or more lines are too long
90
src/js/bootstrap/dist/dom/data.js
vendored
90
src/js/bootstrap/dist/dom/data.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap data.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap data.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/data.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/data.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -25,61 +25,51 @@
|
|||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
var mapData = (function () {
|
||||
var storeData = {};
|
||||
var id = 1;
|
||||
return {
|
||||
set: function set(element, key, data) {
|
||||
if (typeof element.bsKey === 'undefined') {
|
||||
element.bsKey = {
|
||||
key: key,
|
||||
id: id,
|
||||
};
|
||||
id++;
|
||||
}
|
||||
const elementMap = new Map();
|
||||
var data = {
|
||||
set(element, key, instance) {
|
||||
if (!elementMap.has(element)) {
|
||||
elementMap.set(element, new Map());
|
||||
}
|
||||
|
||||
storeData[element.bsKey.id] = data;
|
||||
},
|
||||
get: function get(element, key) {
|
||||
if (!element || typeof element.bsKey === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
|
||||
// can be removed later when multiple key/instances are fine to be used
|
||||
|
||||
var keyProperties = element.bsKey;
|
||||
if (!instanceMap.has(key) && instanceMap.size !== 0) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
`Bootstrap doesn't allow more than one instance per element. Bound instance: ${
|
||||
Array.from(instanceMap.keys())[0]
|
||||
}.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (keyProperties.key === key) {
|
||||
return storeData[keyProperties.id];
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
delete: function _delete(element, key) {
|
||||
if (typeof element.bsKey === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var keyProperties = element.bsKey;
|
||||
|
||||
if (keyProperties.key === key) {
|
||||
delete storeData[keyProperties.id];
|
||||
delete element.bsKey;
|
||||
}
|
||||
},
|
||||
};
|
||||
})();
|
||||
|
||||
var Data = {
|
||||
setData: function setData(instance, key, data) {
|
||||
mapData.set(instance, key, data);
|
||||
instanceMap.set(key, instance);
|
||||
},
|
||||
getData: function getData(instance, key) {
|
||||
return mapData.get(instance, key);
|
||||
|
||||
get(element, key) {
|
||||
if (elementMap.has(element)) {
|
||||
return elementMap.get(element).get(key) || null;
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
removeData: function removeData(instance, key) {
|
||||
mapData.delete(instance, key);
|
||||
|
||||
remove(element, key) {
|
||||
if (!elementMap.has(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const instanceMap = elementMap.get(element);
|
||||
instanceMap.delete(key); // free up element references if there are no instances left for an element
|
||||
|
||||
if (instanceMap.size === 0) {
|
||||
elementMap.delete(element);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return Data;
|
||||
return data;
|
||||
});
|
||||
//# sourceMappingURL=data.js.map
|
||||
|
|
2
src/js/bootstrap/dist/dom/data.js.map
vendored
2
src/js/bootstrap/dist/dom/data.js.map
vendored
|
@ -1 +1 @@
|
|||
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta2): 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;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,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;;;;;;;;"}
|
||||
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta3): 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 elementMap = new Map()\n\nexport default {\n set(element, key, instance) {\n if (!elementMap.has(element)) {\n elementMap.set(element, new Map())\n }\n\n const instanceMap = elementMap.get(element)\n\n // make it clear we only want one instance per element\n // can be removed later when multiple key/instances are fine to be used\n if (!instanceMap.has(key) && instanceMap.size !== 0) {\n // eslint-disable-next-line no-console\n console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)\n return\n }\n\n instanceMap.set(key, instance)\n },\n\n get(element, key) {\n if (elementMap.has(element)) {\n return elementMap.get(element).get(key) || null\n }\n\n return null\n },\n\n remove(element, key) {\n if (!elementMap.has(element)) {\n return\n }\n\n const instanceMap = elementMap.get(element)\n\n instanceMap.delete(key)\n\n // free up element references if there are no instances left for an element\n if (instanceMap.size === 0) {\n elementMap.delete(element)\n }\n }\n}\n"],"names":["elementMap","Map","set","element","key","instance","has","instanceMap","get","size","console","error","Array","from","keys","remove","delete"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,MAAMA,UAAU,GAAG,IAAIC,GAAJ,EAAnB;AAEA,aAAe;EACbC,EAAAA,GAAG,CAACC,OAAD,EAAUC,GAAV,EAAeC,QAAf,EAAyB;EAC1B,QAAI,CAACL,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAL,EAA8B;EAC5BH,MAAAA,UAAU,CAACE,GAAX,CAAeC,OAAf,EAAwB,IAAIF,GAAJ,EAAxB;EACD;;EAED,UAAMM,WAAW,GAAGP,UAAU,CAACQ,GAAX,CAAeL,OAAf,CAApB,CAL0B;EAQ1B;;EACA,QAAI,CAACI,WAAW,CAACD,GAAZ,CAAgBF,GAAhB,CAAD,IAAyBG,WAAW,CAACE,IAAZ,KAAqB,CAAlD,EAAqD;EACnD;EACAC,MAAAA,OAAO,CAACC,KAAR,CAAe,+EAA8EC,KAAK,CAACC,IAAN,CAAWN,WAAW,CAACO,IAAZ,EAAX,EAA+B,CAA/B,CAAkC,GAA/H;EACA;EACD;;EAEDP,IAAAA,WAAW,CAACL,GAAZ,CAAgBE,GAAhB,EAAqBC,QAArB;EACD,GAjBY;;EAmBbG,EAAAA,GAAG,CAACL,OAAD,EAAUC,GAAV,EAAe;EAChB,QAAIJ,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAJ,EAA6B;EAC3B,aAAOH,UAAU,CAACQ,GAAX,CAAeL,OAAf,EAAwBK,GAAxB,CAA4BJ,GAA5B,KAAoC,IAA3C;EACD;;EAED,WAAO,IAAP;EACD,GAzBY;;EA2BbW,EAAAA,MAAM,CAACZ,OAAD,EAAUC,GAAV,EAAe;EACnB,QAAI,CAACJ,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAL,EAA8B;EAC5B;EACD;;EAED,UAAMI,WAAW,GAAGP,UAAU,CAACQ,GAAX,CAAeL,OAAf,CAApB;EAEAI,IAAAA,WAAW,CAACS,MAAZ,CAAmBZ,GAAnB,EAPmB;;EAUnB,QAAIG,WAAW,CAACE,IAAZ,KAAqB,CAAzB,EAA4B;EAC1BT,MAAAA,UAAU,CAACgB,MAAX,CAAkBb,OAAlB;EACD;EACF;;EAxCY,CAAf;;;;;;;;"}
|
150
src/js/bootstrap/dist/dom/event-handler.js
vendored
150
src/js/bootstrap/dist/dom/event-handler.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap event-handler.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap event-handler.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -15,14 +15,13 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/index.js
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var getjQuery = function getjQuery() {
|
||||
var _window = window,
|
||||
jQuery = _window.jQuery;
|
||||
const getjQuery = () => {
|
||||
const { jQuery } = window;
|
||||
|
||||
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||
return jQuery;
|
||||
|
@ -31,11 +30,9 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
document.documentElement.dir === 'rtl';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/event-handler.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/event-handler.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -45,17 +42,17 @@
|
|||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
||||
var stripNameRegex = /\..*/;
|
||||
var stripUidRegex = /::\d+$/;
|
||||
var eventRegistry = {}; // Events storage
|
||||
const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
||||
const stripNameRegex = /\..*/;
|
||||
const stripUidRegex = /::\d+$/;
|
||||
const eventRegistry = {}; // Events storage
|
||||
|
||||
var uidEvent = 1;
|
||||
var customEvents = {
|
||||
let uidEvent = 1;
|
||||
const customEvents = {
|
||||
mouseenter: 'mouseover',
|
||||
mouseleave: 'mouseout',
|
||||
};
|
||||
var nativeEvents = new Set([
|
||||
const nativeEvents = new Set([
|
||||
'click',
|
||||
'dblclick',
|
||||
'mouseup',
|
||||
|
@ -110,11 +107,11 @@
|
|||
*/
|
||||
|
||||
function getUidEvent(element, uid) {
|
||||
return (uid && uid + '::' + uidEvent++) || element.uidEvent || uidEvent++;
|
||||
return (uid && `${uid}::${uidEvent++}`) || element.uidEvent || uidEvent++;
|
||||
}
|
||||
|
||||
function getEvent(element) {
|
||||
var uid = getUidEvent(element);
|
||||
const uid = getUidEvent(element);
|
||||
element.uidEvent = uid;
|
||||
eventRegistry[uid] = eventRegistry[uid] || {};
|
||||
return eventRegistry[uid];
|
||||
|
@ -134,10 +131,10 @@
|
|||
|
||||
function bootstrapDelegationHandler(element, selector, fn) {
|
||||
return function handler(event) {
|
||||
var domElements = element.querySelectorAll(selector);
|
||||
const domElements = element.querySelectorAll(selector);
|
||||
|
||||
for (var target = event.target; target && target !== this; target = target.parentNode) {
|
||||
for (var i = domElements.length; i--; ) {
|
||||
for (let { target } = event; target && target !== this; target = target.parentNode) {
|
||||
for (let i = domElements.length; i--; ) {
|
||||
if (domElements[i] === target) {
|
||||
event.delegateTarget = target;
|
||||
|
||||
|
@ -155,15 +152,11 @@
|
|||
};
|
||||
}
|
||||
|
||||
function findHandler(events, handler, delegationSelector) {
|
||||
if (delegationSelector === void 0) {
|
||||
delegationSelector = null;
|
||||
}
|
||||
function findHandler(events, handler, delegationSelector = null) {
|
||||
const uidEventList = Object.keys(events);
|
||||
|
||||
var uidEventList = Object.keys(events);
|
||||
|
||||
for (var i = 0, len = uidEventList.length; i < len; i++) {
|
||||
var event = events[uidEventList[i]];
|
||||
for (let i = 0, len = uidEventList.length; i < len; i++) {
|
||||
const event = events[uidEventList[i]];
|
||||
|
||||
if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
|
||||
return event;
|
||||
|
@ -174,17 +167,17 @@
|
|||
}
|
||||
|
||||
function normalizeParams(originalTypeEvent, handler, delegationFn) {
|
||||
var delegation = typeof handler === 'string';
|
||||
var originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
|
||||
const delegation = typeof handler === 'string';
|
||||
const originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
|
||||
|
||||
var typeEvent = originalTypeEvent.replace(stripNameRegex, '');
|
||||
var custom = customEvents[typeEvent];
|
||||
let typeEvent = originalTypeEvent.replace(stripNameRegex, '');
|
||||
const custom = customEvents[typeEvent];
|
||||
|
||||
if (custom) {
|
||||
typeEvent = custom;
|
||||
}
|
||||
|
||||
var isNative = nativeEvents.has(typeEvent);
|
||||
const isNative = nativeEvents.has(typeEvent);
|
||||
|
||||
if (!isNative) {
|
||||
typeEvent = originalTypeEvent;
|
||||
|
@ -203,22 +196,22 @@
|
|||
delegationFn = null;
|
||||
}
|
||||
|
||||
var _normalizeParams = normalizeParams(originalTypeEvent, handler, delegationFn),
|
||||
delegation = _normalizeParams[0],
|
||||
originalHandler = _normalizeParams[1],
|
||||
typeEvent = _normalizeParams[2];
|
||||
|
||||
var events = getEvent(element);
|
||||
var handlers = events[typeEvent] || (events[typeEvent] = {});
|
||||
var previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
|
||||
const [delegation, originalHandler, typeEvent] = normalizeParams(
|
||||
originalTypeEvent,
|
||||
handler,
|
||||
delegationFn
|
||||
);
|
||||
const events = getEvent(element);
|
||||
const handlers = events[typeEvent] || (events[typeEvent] = {});
|
||||
const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
|
||||
|
||||
if (previousFn) {
|
||||
previousFn.oneOff = previousFn.oneOff && oneOff;
|
||||
return;
|
||||
}
|
||||
|
||||
var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
|
||||
var fn = delegation
|
||||
const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
|
||||
const fn = delegation
|
||||
? bootstrapDelegationHandler(element, handler, delegationFn)
|
||||
: bootstrapHandler(element, handler);
|
||||
fn.delegationSelector = delegation ? handler : null;
|
||||
|
@ -230,7 +223,7 @@
|
|||
}
|
||||
|
||||
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
|
||||
var fn = findHandler(events[typeEvent], handler, delegationSelector);
|
||||
const fn = findHandler(events[typeEvent], handler, delegationSelector);
|
||||
|
||||
if (!fn) {
|
||||
return;
|
||||
|
@ -241,35 +234,37 @@
|
|||
}
|
||||
|
||||
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
||||
var storeElementEvent = events[typeEvent] || {};
|
||||
Object.keys(storeElementEvent).forEach(function (handlerKey) {
|
||||
const storeElementEvent = events[typeEvent] || {};
|
||||
Object.keys(storeElementEvent).forEach((handlerKey) => {
|
||||
if (handlerKey.includes(namespace)) {
|
||||
var event = storeElementEvent[handlerKey];
|
||||
const event = storeElementEvent[handlerKey];
|
||||
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var EventHandler = {
|
||||
on: function on(element, event, handler, delegationFn) {
|
||||
const EventHandler = {
|
||||
on(element, event, handler, delegationFn) {
|
||||
addHandler(element, event, handler, delegationFn, false);
|
||||
},
|
||||
one: function one(element, event, handler, delegationFn) {
|
||||
|
||||
one(element, event, handler, delegationFn) {
|
||||
addHandler(element, event, handler, delegationFn, true);
|
||||
},
|
||||
off: function off(element, originalTypeEvent, handler, delegationFn) {
|
||||
|
||||
off(element, originalTypeEvent, handler, delegationFn) {
|
||||
if (typeof originalTypeEvent !== 'string' || !element) {
|
||||
return;
|
||||
}
|
||||
|
||||
var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn),
|
||||
delegation = _normalizeParams2[0],
|
||||
originalHandler = _normalizeParams2[1],
|
||||
typeEvent = _normalizeParams2[2];
|
||||
|
||||
var inNamespace = typeEvent !== originalTypeEvent;
|
||||
var events = getEvent(element);
|
||||
var isNamespace = originalTypeEvent.startsWith('.');
|
||||
const [delegation, originalHandler, typeEvent] = normalizeParams(
|
||||
originalTypeEvent,
|
||||
handler,
|
||||
delegationFn
|
||||
);
|
||||
const inNamespace = typeEvent !== originalTypeEvent;
|
||||
const events = getEvent(element);
|
||||
const isNamespace = originalTypeEvent.startsWith('.');
|
||||
|
||||
if (typeof originalHandler !== 'undefined') {
|
||||
// Simplest case: handler is passed, remove that listener ONLY.
|
||||
|
@ -282,17 +277,17 @@
|
|||
}
|
||||
|
||||
if (isNamespace) {
|
||||
Object.keys(events).forEach(function (elementEvent) {
|
||||
Object.keys(events).forEach((elementEvent) => {
|
||||
removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
|
||||
});
|
||||
}
|
||||
|
||||
var storeElementEvent = events[typeEvent] || {};
|
||||
Object.keys(storeElementEvent).forEach(function (keyHandlers) {
|
||||
var handlerKey = keyHandlers.replace(stripUidRegex, '');
|
||||
const storeElementEvent = events[typeEvent] || {};
|
||||
Object.keys(storeElementEvent).forEach((keyHandlers) => {
|
||||
const handlerKey = keyHandlers.replace(stripUidRegex, '');
|
||||
|
||||
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
|
||||
var event = storeElementEvent[keyHandlers];
|
||||
const event = storeElementEvent[keyHandlers];
|
||||
removeHandler(
|
||||
element,
|
||||
events,
|
||||
|
@ -303,20 +298,21 @@
|
|||
}
|
||||
});
|
||||
},
|
||||
trigger: function trigger(element, event, args) {
|
||||
|
||||
trigger(element, event, args) {
|
||||
if (typeof event !== 'string' || !element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var $ = getjQuery();
|
||||
var typeEvent = event.replace(stripNameRegex, '');
|
||||
var inNamespace = event !== typeEvent;
|
||||
var isNative = nativeEvents.has(typeEvent);
|
||||
var jQueryEvent;
|
||||
var bubbles = true;
|
||||
var nativeDispatch = true;
|
||||
var defaultPrevented = false;
|
||||
var evt = null;
|
||||
const $ = getjQuery();
|
||||
const typeEvent = event.replace(stripNameRegex, '');
|
||||
const inNamespace = event !== typeEvent;
|
||||
const isNative = nativeEvents.has(typeEvent);
|
||||
let jQueryEvent;
|
||||
let bubbles = true;
|
||||
let nativeDispatch = true;
|
||||
let defaultPrevented = false;
|
||||
let evt = null;
|
||||
|
||||
if (inNamespace && $) {
|
||||
jQueryEvent = $.Event(event, args);
|
||||
|
@ -331,15 +327,15 @@
|
|||
evt.initEvent(typeEvent, bubbles, true);
|
||||
} else {
|
||||
evt = new CustomEvent(event, {
|
||||
bubbles: bubbles,
|
||||
bubbles,
|
||||
cancelable: true,
|
||||
});
|
||||
} // merge custom information in our event
|
||||
|
||||
if (typeof args !== 'undefined') {
|
||||
Object.keys(args).forEach(function (key) {
|
||||
Object.keys(args).forEach((key) => {
|
||||
Object.defineProperty(evt, key, {
|
||||
get: function get() {
|
||||
get() {
|
||||
return args[key];
|
||||
},
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
45
src/js/bootstrap/dist/dom/manipulator.js
vendored
45
src/js/bootstrap/dist/dom/manipulator.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap manipulator.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap manipulator.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/manipulator.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/manipulator.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -40,46 +40,47 @@
|
|||
}
|
||||
|
||||
function normalizeDataKey(key) {
|
||||
return key.replace(/[A-Z]/g, function (chr) {
|
||||
return '-' + chr.toLowerCase();
|
||||
});
|
||||
return key.replace(/[A-Z]/g, (chr) => `-${chr.toLowerCase()}`);
|
||||
}
|
||||
|
||||
var Manipulator = {
|
||||
setDataAttribute: function setDataAttribute(element, key, value) {
|
||||
element.setAttribute('data-bs-' + normalizeDataKey(key), value);
|
||||
const Manipulator = {
|
||||
setDataAttribute(element, key, value) {
|
||||
element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
|
||||
},
|
||||
removeDataAttribute: function removeDataAttribute(element, key) {
|
||||
element.removeAttribute('data-bs-' + normalizeDataKey(key));
|
||||
|
||||
removeDataAttribute(element, key) {
|
||||
element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
|
||||
},
|
||||
getDataAttributes: function getDataAttributes(element) {
|
||||
|
||||
getDataAttributes(element) {
|
||||
if (!element) {
|
||||
return {};
|
||||
}
|
||||
|
||||
var attributes = {};
|
||||
const attributes = {};
|
||||
Object.keys(element.dataset)
|
||||
.filter(function (key) {
|
||||
return key.startsWith('bs');
|
||||
})
|
||||
.forEach(function (key) {
|
||||
var pureKey = key.replace(/^bs/, '');
|
||||
.filter((key) => key.startsWith('bs'))
|
||||
.forEach((key) => {
|
||||
let pureKey = key.replace(/^bs/, '');
|
||||
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
|
||||
attributes[pureKey] = normalizeData(element.dataset[key]);
|
||||
});
|
||||
return attributes;
|
||||
},
|
||||
getDataAttribute: function getDataAttribute(element, key) {
|
||||
return normalizeData(element.getAttribute('data-bs-' + normalizeDataKey(key)));
|
||||
|
||||
getDataAttribute(element, key) {
|
||||
return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
|
||||
},
|
||||
offset: function offset(element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
|
||||
offset(element) {
|
||||
const rect = element.getBoundingClientRect();
|
||||
return {
|
||||
top: rect.top + document.body.scrollTop,
|
||||
left: rect.left + document.body.scrollLeft,
|
||||
};
|
||||
},
|
||||
position: function position(element) {
|
||||
|
||||
position(element) {
|
||||
return {
|
||||
top: element.offsetTop,
|
||||
left: element.offsetLeft,
|
||||
|
|
2
src/js/bootstrap/dist/dom/manipulator.js.map
vendored
2
src/js/bootstrap/dist/dom/manipulator.js.map
vendored
|
@ -1 +1 @@
|
|||
{"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta2): 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-bs-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {}\n\n Object.keys(element.dataset)\n .filter(key => key.startsWith('bs'))\n .forEach(key => {\n let pureKey = key.replace(/^bs/, '')\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)\n attributes[pureKey] = normalizeData(element.dataset[key])\n })\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-bs-${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\nexport default Manipulator\n"],"names":["normalizeData","val","Number","toString","normalizeDataKey","key","replace","chr","toLowerCase","Manipulator","setDataAttribute","element","value","setAttribute","removeDataAttribute","removeAttribute","getDataAttributes","attributes","Object","keys","dataset","filter","startsWith","forEach","pureKey","charAt","slice","length","getDataAttribute","getAttribute","offset","rect","getBoundingClientRect","top","document","body","scrollTop","left","scrollLeft","position","offsetTop","offsetLeft"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAEA,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,cAAgCT,gBAAgB,CAACC,GAAD,CAAhD,EAAyDO,KAAzD;EACD,GAHiB;EAKlBE,EAAAA,mBALkB,+BAKEH,OALF,EAKWN,GALX,EAKgB;EAChCM,IAAAA,OAAO,CAACI,eAAR,cAAmCX,gBAAgB,CAACC,GAAD,CAAnD;EACD,GAPiB;EASlBW,EAAAA,iBATkB,6BASAL,OATA,EASS;EACzB,QAAI,CAACA,OAAL,EAAc;EACZ,aAAO,EAAP;EACD;;EAED,QAAMM,UAAU,GAAG,EAAnB;EAEAC,IAAAA,MAAM,CAACC,IAAP,CAAYR,OAAO,CAACS,OAApB,EACGC,MADH,CACU,UAAAhB,GAAG;EAAA,aAAIA,GAAG,CAACiB,UAAJ,CAAe,IAAf,CAAJ;EAAA,KADb,EAEGC,OAFH,CAEW,UAAAlB,GAAG,EAAI;EACd,UAAImB,OAAO,GAAGnB,GAAG,CAACC,OAAJ,CAAY,KAAZ,EAAmB,EAAnB,CAAd;EACAkB,MAAAA,OAAO,GAAGA,OAAO,CAACC,MAAR,CAAe,CAAf,EAAkBjB,WAAlB,KAAkCgB,OAAO,CAACE,KAAR,CAAc,CAAd,EAAiBF,OAAO,CAACG,MAAzB,CAA5C;EACAV,MAAAA,UAAU,CAACO,OAAD,CAAV,GAAsBxB,aAAa,CAACW,OAAO,CAACS,OAAR,CAAgBf,GAAhB,CAAD,CAAnC;EACD,KANH;EAQA,WAAOY,UAAP;EACD,GAzBiB;EA2BlBW,EAAAA,gBA3BkB,4BA2BDjB,OA3BC,EA2BQN,GA3BR,EA2Ba;EAC7B,WAAOL,aAAa,CAACW,OAAO,CAACkB,YAAR,cAAgCzB,gBAAgB,CAACC,GAAD,CAAhD,CAAD,CAApB;EACD,GA7BiB;EA+BlByB,EAAAA,MA/BkB,kBA+BXnB,OA/BW,EA+BF;EACd,QAAMoB,IAAI,GAAGpB,OAAO,CAACqB,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,GAtCiB;EAwClBC,EAAAA,QAxCkB,oBAwCT5B,OAxCS,EAwCA;EAChB,WAAO;EACLsB,MAAAA,GAAG,EAAEtB,OAAO,CAAC6B,SADR;EAELH,MAAAA,IAAI,EAAE1B,OAAO,CAAC8B;EAFT,KAAP;EAID;EA7CiB;;;;;;;;"}
|
||||
{"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta3): 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-bs-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {}\n\n Object.keys(element.dataset)\n .filter(key => key.startsWith('bs'))\n .forEach(key => {\n let pureKey = key.replace(/^bs/, '')\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)\n attributes[pureKey] = normalizeData(element.dataset[key])\n })\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-bs-${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\nexport default Manipulator\n"],"names":["normalizeData","val","Number","toString","normalizeDataKey","key","replace","chr","toLowerCase","Manipulator","setDataAttribute","element","value","setAttribute","removeDataAttribute","removeAttribute","getDataAttributes","attributes","Object","keys","dataset","filter","startsWith","forEach","pureKey","charAt","slice","length","getDataAttribute","getAttribute","offset","rect","getBoundingClientRect","top","document","body","scrollTop","left","scrollLeft","position","offsetTop","offsetLeft"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAEA,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,EAAsBC,GAAG,IAAK,IAAGA,GAAG,CAACC,WAAJ,EAAkB,EAAnD,CAAP;EACD;;QAEKC,WAAW,GAAG;EAClBC,EAAAA,gBAAgB,CAACC,OAAD,EAAUN,GAAV,EAAeO,KAAf,EAAsB;EACpCD,IAAAA,OAAO,CAACE,YAAR,CAAsB,WAAUT,gBAAgB,CAACC,GAAD,CAAM,EAAtD,EAAyDO,KAAzD;EACD,GAHiB;;EAKlBE,EAAAA,mBAAmB,CAACH,OAAD,EAAUN,GAAV,EAAe;EAChCM,IAAAA,OAAO,CAACI,eAAR,CAAyB,WAAUX,gBAAgB,CAACC,GAAD,CAAM,EAAzD;EACD,GAPiB;;EASlBW,EAAAA,iBAAiB,CAACL,OAAD,EAAU;EACzB,QAAI,CAACA,OAAL,EAAc;EACZ,aAAO,EAAP;EACD;;EAED,UAAMM,UAAU,GAAG,EAAnB;EAEAC,IAAAA,MAAM,CAACC,IAAP,CAAYR,OAAO,CAACS,OAApB,EACGC,MADH,CACUhB,GAAG,IAAIA,GAAG,CAACiB,UAAJ,CAAe,IAAf,CADjB,EAEGC,OAFH,CAEWlB,GAAG,IAAI;EACd,UAAImB,OAAO,GAAGnB,GAAG,CAACC,OAAJ,CAAY,KAAZ,EAAmB,EAAnB,CAAd;EACAkB,MAAAA,OAAO,GAAGA,OAAO,CAACC,MAAR,CAAe,CAAf,EAAkBjB,WAAlB,KAAkCgB,OAAO,CAACE,KAAR,CAAc,CAAd,EAAiBF,OAAO,CAACG,MAAzB,CAA5C;EACAV,MAAAA,UAAU,CAACO,OAAD,CAAV,GAAsBxB,aAAa,CAACW,OAAO,CAACS,OAAR,CAAgBf,GAAhB,CAAD,CAAnC;EACD,KANH;EAQA,WAAOY,UAAP;EACD,GAzBiB;;EA2BlBW,EAAAA,gBAAgB,CAACjB,OAAD,EAAUN,GAAV,EAAe;EAC7B,WAAOL,aAAa,CAACW,OAAO,CAACkB,YAAR,CAAsB,WAAUzB,gBAAgB,CAACC,GAAD,CAAM,EAAtD,CAAD,CAApB;EACD,GA7BiB;;EA+BlByB,EAAAA,MAAM,CAACnB,OAAD,EAAU;EACd,UAAMoB,IAAI,GAAGpB,OAAO,CAACqB,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,GAtCiB;;EAwClBC,EAAAA,QAAQ,CAAC5B,OAAD,EAAU;EAChB,WAAO;EACLsB,MAAAA,GAAG,EAAEtB,OAAO,CAAC6B,SADR;EAELH,MAAAA,IAAI,EAAE1B,OAAO,CAAC8B;EAFT,KAAP;EAID;;EA7CiB;;;;;;;;"}
|
50
src/js/bootstrap/dist/dom/selector-engine.js
vendored
50
src/js/bootstrap/dist/dom/selector-engine.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap selector-engine.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap selector-engine.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/selector-engine.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/selector-engine.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -25,37 +25,23 @@
|
|||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
var NODE_TEXT = 3;
|
||||
var SelectorEngine = {
|
||||
find: function find(selector, element) {
|
||||
var _ref;
|
||||
|
||||
if (element === void 0) {
|
||||
element = document.documentElement;
|
||||
}
|
||||
|
||||
return (_ref = []).concat.apply(
|
||||
_ref,
|
||||
Element.prototype.querySelectorAll.call(element, selector)
|
||||
);
|
||||
const NODE_TEXT = 3;
|
||||
const SelectorEngine = {
|
||||
find(selector, element = document.documentElement) {
|
||||
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
||||
},
|
||||
findOne: function findOne(selector, element) {
|
||||
if (element === void 0) {
|
||||
element = document.documentElement;
|
||||
}
|
||||
|
||||
findOne(selector, element = document.documentElement) {
|
||||
return Element.prototype.querySelector.call(element, selector);
|
||||
},
|
||||
children: function children(element, selector) {
|
||||
var _ref2;
|
||||
|
||||
return (_ref2 = []).concat.apply(_ref2, element.children).filter(function (child) {
|
||||
return child.matches(selector);
|
||||
});
|
||||
children(element, selector) {
|
||||
return [].concat(...element.children).filter((child) => child.matches(selector));
|
||||
},
|
||||
parents: function parents(element, selector) {
|
||||
var parents = [];
|
||||
var ancestor = element.parentNode;
|
||||
|
||||
parents(element, selector) {
|
||||
const parents = [];
|
||||
let ancestor = element.parentNode;
|
||||
|
||||
while (
|
||||
ancestor &&
|
||||
|
@ -71,8 +57,9 @@
|
|||
|
||||
return parents;
|
||||
},
|
||||
prev: function prev(element, selector) {
|
||||
var previous = element.previousElementSibling;
|
||||
|
||||
prev(element, selector) {
|
||||
let previous = element.previousElementSibling;
|
||||
|
||||
while (previous) {
|
||||
if (previous.matches(selector)) {
|
||||
|
@ -84,8 +71,9 @@
|
|||
|
||||
return [];
|
||||
},
|
||||
next: function next(element, selector) {
|
||||
var next = element.nextElementSibling;
|
||||
|
||||
next(element, selector) {
|
||||
let next = element.nextElementSibling;
|
||||
|
||||
while (next) {
|
||||
if (next.matches(selector)) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"selector-engine.js","sources":["../../src/dom/selector-engine.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta2): dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NODE_TEXT = 3\n\nconst SelectorEngine = {\n find(selector, element = document.documentElement) {\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return Element.prototype.querySelector.call(element, selector)\n },\n\n children(element, selector) {\n return [].concat(...element.children)\n .filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n\n let ancestor = element.parentNode\n\n while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {\n if (ancestor.matches(selector)) {\n parents.push(ancestor)\n }\n\n ancestor = ancestor.parentNode\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (next.matches(selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n }\n}\n\nexport default SelectorEngine\n"],"names":["NODE_TEXT","SelectorEngine","find","selector","element","document","documentElement","concat","Element","prototype","querySelectorAll","call","findOne","querySelector","children","filter","child","matches","parents","ancestor","parentNode","nodeType","Node","ELEMENT_NODE","push","prev","previous","previousElementSibling","next","nextElementSibling"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,IAAMA,SAAS,GAAG,CAAlB;MAEMC,cAAc,GAAG;EACrBC,EAAAA,IADqB,gBAChBC,QADgB,EACNC,OADM,EAC8B;EAAA;;EAAA,QAApCA,OAAoC;EAApCA,MAAAA,OAAoC,GAA1BC,QAAQ,CAACC,eAAiB;EAAA;;EACjD,WAAO,YAAGC,MAAH,aAAaC,OAAO,CAACC,SAAR,CAAkBC,gBAAlB,CAAmCC,IAAnC,CAAwCP,OAAxC,EAAiDD,QAAjD,CAAb,CAAP;EACD,GAHoB;EAKrBS,EAAAA,OALqB,mBAKbT,QALa,EAKHC,OALG,EAKiC;EAAA,QAApCA,OAAoC;EAApCA,MAAAA,OAAoC,GAA1BC,QAAQ,CAACC,eAAiB;EAAA;;EACpD,WAAOE,OAAO,CAACC,SAAR,CAAkBI,aAAlB,CAAgCF,IAAhC,CAAqCP,OAArC,EAA8CD,QAA9C,CAAP;EACD,GAPoB;EASrBW,EAAAA,QATqB,oBASZV,OATY,EASHD,QATG,EASO;EAAA;;EAC1B,WAAO,aAAGI,MAAH,cAAaH,OAAO,CAACU,QAArB,EACJC,MADI,CACG,UAAAC,KAAK;EAAA,aAAIA,KAAK,CAACC,OAAN,CAAcd,QAAd,CAAJ;EAAA,KADR,CAAP;EAED,GAZoB;EAcrBe,EAAAA,OAdqB,mBAcbd,OAda,EAcJD,QAdI,EAcM;EACzB,QAAMe,OAAO,GAAG,EAAhB;EAEA,QAAIC,QAAQ,GAAGf,OAAO,CAACgB,UAAvB;;EAEA,WAAOD,QAAQ,IAAIA,QAAQ,CAACE,QAAT,KAAsBC,IAAI,CAACC,YAAvC,IAAuDJ,QAAQ,CAACE,QAAT,KAAsBrB,SAApF,EAA+F;EAC7F,UAAImB,QAAQ,CAACF,OAAT,CAAiBd,QAAjB,CAAJ,EAAgC;EAC9Be,QAAAA,OAAO,CAACM,IAAR,CAAaL,QAAb;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,UAApB;EACD;;EAED,WAAOF,OAAP;EACD,GA5BoB;EA8BrBO,EAAAA,IA9BqB,gBA8BhBrB,OA9BgB,EA8BPD,QA9BO,EA8BG;EACtB,QAAIuB,QAAQ,GAAGtB,OAAO,CAACuB,sBAAvB;;EAEA,WAAOD,QAAP,EAAiB;EACf,UAAIA,QAAQ,CAACT,OAAT,CAAiBd,QAAjB,CAAJ,EAAgC;EAC9B,eAAO,CAACuB,QAAD,CAAP;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,sBAApB;EACD;;EAED,WAAO,EAAP;EACD,GA1CoB;EA4CrBC,EAAAA,IA5CqB,gBA4ChBxB,OA5CgB,EA4CPD,QA5CO,EA4CG;EACtB,QAAIyB,IAAI,GAAGxB,OAAO,CAACyB,kBAAnB;;EAEA,WAAOD,IAAP,EAAa;EACX,UAAIA,IAAI,CAACX,OAAL,CAAad,QAAb,CAAJ,EAA4B;EAC1B,eAAO,CAACyB,IAAD,CAAP;EACD;;EAEDA,MAAAA,IAAI,GAAGA,IAAI,CAACC,kBAAZ;EACD;;EAED,WAAO,EAAP;EACD;EAxDoB;;;;;;;;"}
|
||||
{"version":3,"file":"selector-engine.js","sources":["../../src/dom/selector-engine.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta3): dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NODE_TEXT = 3\n\nconst SelectorEngine = {\n find(selector, element = document.documentElement) {\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return Element.prototype.querySelector.call(element, selector)\n },\n\n children(element, selector) {\n return [].concat(...element.children)\n .filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n\n let ancestor = element.parentNode\n\n while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {\n if (ancestor.matches(selector)) {\n parents.push(ancestor)\n }\n\n ancestor = ancestor.parentNode\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (next.matches(selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n }\n}\n\nexport default SelectorEngine\n"],"names":["NODE_TEXT","SelectorEngine","find","selector","element","document","documentElement","concat","Element","prototype","querySelectorAll","call","findOne","querySelector","children","filter","child","matches","parents","ancestor","parentNode","nodeType","Node","ELEMENT_NODE","push","prev","previous","previousElementSibling","next","nextElementSibling"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,MAAMA,SAAS,GAAG,CAAlB;QAEMC,cAAc,GAAG;EACrBC,EAAAA,IAAI,CAACC,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;EACjD,WAAO,GAAGC,MAAH,CAAU,GAAGC,OAAO,CAACC,SAAR,CAAkBC,gBAAlB,CAAmCC,IAAnC,CAAwCP,OAAxC,EAAiDD,QAAjD,CAAb,CAAP;EACD,GAHoB;;EAKrBS,EAAAA,OAAO,CAACT,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;EACpD,WAAOE,OAAO,CAACC,SAAR,CAAkBI,aAAlB,CAAgCF,IAAhC,CAAqCP,OAArC,EAA8CD,QAA9C,CAAP;EACD,GAPoB;;EASrBW,EAAAA,QAAQ,CAACV,OAAD,EAAUD,QAAV,EAAoB;EAC1B,WAAO,GAAGI,MAAH,CAAU,GAAGH,OAAO,CAACU,QAArB,EACJC,MADI,CACGC,KAAK,IAAIA,KAAK,CAACC,OAAN,CAAcd,QAAd,CADZ,CAAP;EAED,GAZoB;;EAcrBe,EAAAA,OAAO,CAACd,OAAD,EAAUD,QAAV,EAAoB;EACzB,UAAMe,OAAO,GAAG,EAAhB;EAEA,QAAIC,QAAQ,GAAGf,OAAO,CAACgB,UAAvB;;EAEA,WAAOD,QAAQ,IAAIA,QAAQ,CAACE,QAAT,KAAsBC,IAAI,CAACC,YAAvC,IAAuDJ,QAAQ,CAACE,QAAT,KAAsBrB,SAApF,EAA+F;EAC7F,UAAImB,QAAQ,CAACF,OAAT,CAAiBd,QAAjB,CAAJ,EAAgC;EAC9Be,QAAAA,OAAO,CAACM,IAAR,CAAaL,QAAb;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,UAApB;EACD;;EAED,WAAOF,OAAP;EACD,GA5BoB;;EA8BrBO,EAAAA,IAAI,CAACrB,OAAD,EAAUD,QAAV,EAAoB;EACtB,QAAIuB,QAAQ,GAAGtB,OAAO,CAACuB,sBAAvB;;EAEA,WAAOD,QAAP,EAAiB;EACf,UAAIA,QAAQ,CAACT,OAAT,CAAiBd,QAAjB,CAAJ,EAAgC;EAC9B,eAAO,CAACuB,QAAD,CAAP;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,sBAApB;EACD;;EAED,WAAO,EAAP;EACD,GA1CoB;;EA4CrBC,EAAAA,IAAI,CAACxB,OAAD,EAAUD,QAAV,EAAoB;EACtB,QAAIyB,IAAI,GAAGxB,OAAO,CAACyB,kBAAnB;;EAEA,WAAOD,IAAP,EAAa;EACX,UAAIA,IAAI,CAACX,OAAL,CAAad,QAAb,CAAJ,EAA4B;EAC1B,eAAO,CAACyB,IAAD,CAAP;EACD;;EAEDA,MAAAA,IAAI,GAAGA,IAAI,CAACC,kBAAZ;EACD;;EAED,WAAO,EAAP;EACD;;EAxDoB;;;;;;;;"}
|
514
src/js/bootstrap/dist/dropdown.js
vendored
514
src/js/bootstrap/dist/dropdown.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap dropdown.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap dropdown.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -71,70 +71,16 @@
|
|||
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
|
||||
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
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 _inheritsLoose(subClass, superClass) {
|
||||
subClass.prototype = Object.create(superClass.prototype);
|
||||
subClass.prototype.constructor = subClass;
|
||||
|
||||
_setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf =
|
||||
Object.setPrototypeOf ||
|
||||
function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/index.js
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var toType = function toType(obj) {
|
||||
const toType = (obj) => {
|
||||
if (obj === null || obj === undefined) {
|
||||
return '' + obj;
|
||||
return `${obj}`;
|
||||
}
|
||||
|
||||
return {}.toString
|
||||
|
@ -143,11 +89,11 @@
|
|||
.toLowerCase();
|
||||
};
|
||||
|
||||
var getSelector = function getSelector(element) {
|
||||
var selector = element.getAttribute('data-bs-target');
|
||||
const getSelector = (element) => {
|
||||
let selector = element.getAttribute('data-bs-target');
|
||||
|
||||
if (!selector || selector === '#') {
|
||||
var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
||||
// `document.querySelector` will rightfully complain it is invalid.
|
||||
// See https://github.com/twbs/bootstrap/issues/32273
|
||||
|
@ -166,40 +112,37 @@
|
|||
return selector;
|
||||
};
|
||||
|
||||
var getElementFromSelector = function getElementFromSelector(element) {
|
||||
var selector = getSelector(element);
|
||||
const getElementFromSelector = (element) => {
|
||||
const selector = getSelector(element);
|
||||
return selector ? document.querySelector(selector) : null;
|
||||
};
|
||||
|
||||
var isElement = function isElement(obj) {
|
||||
return (obj[0] || obj).nodeType;
|
||||
};
|
||||
const isElement = (obj) => (obj[0] || obj).nodeType;
|
||||
|
||||
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
||||
Object.keys(configTypes).forEach(function (property) {
|
||||
var expectedTypes = configTypes[property];
|
||||
var value = config[property];
|
||||
var valueType = value && isElement(value) ? 'element' : toType(value);
|
||||
const typeCheckConfig = (componentName, config, configTypes) => {
|
||||
Object.keys(configTypes).forEach((property) => {
|
||||
const expectedTypes = configTypes[property];
|
||||
const value = config[property];
|
||||
const valueType = value && isElement(value) ? 'element' : toType(value);
|
||||
|
||||
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||
throw new TypeError(
|
||||
componentName.toUpperCase() +
|
||||
': ' +
|
||||
('Option "' + property + '" provided type "' + valueType + '" ') +
|
||||
('but expected type "' + expectedTypes + '".')
|
||||
`${componentName.toUpperCase()}: ` +
|
||||
`Option "${property}" provided type "${valueType}" ` +
|
||||
`but expected type "${expectedTypes}".`
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var isVisible = function isVisible(element) {
|
||||
const isVisible = (element) => {
|
||||
if (!element) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (element.style && element.parentNode && element.parentNode.style) {
|
||||
var elementStyle = getComputedStyle(element);
|
||||
var parentNodeStyle = getComputedStyle(element.parentNode);
|
||||
const elementStyle = getComputedStyle(element);
|
||||
const parentNodeStyle = getComputedStyle(element.parentNode);
|
||||
return (
|
||||
elementStyle.display !== 'none' &&
|
||||
parentNodeStyle.display !== 'none' &&
|
||||
|
@ -210,13 +153,10 @@
|
|||
return false;
|
||||
};
|
||||
|
||||
var noop = function noop() {
|
||||
return function () {};
|
||||
};
|
||||
const noop = () => function () {};
|
||||
|
||||
var getjQuery = function getjQuery() {
|
||||
var _window = window,
|
||||
jQuery = _window.jQuery;
|
||||
const getjQuery = () => {
|
||||
const { jQuery } = window;
|
||||
|
||||
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||
return jQuery;
|
||||
|
@ -225,7 +165,7 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||
const onDOMContentLoaded = (callback) => {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
} else {
|
||||
|
@ -233,19 +173,19 @@
|
|||
}
|
||||
};
|
||||
|
||||
var isRTL = document.documentElement.dir === 'rtl';
|
||||
const isRTL = () => document.documentElement.dir === 'rtl';
|
||||
|
||||
var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
|
||||
onDOMContentLoaded(function () {
|
||||
var $ = getjQuery();
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
var JQUERY_NO_CONFLICT = $.fn[name];
|
||||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||||
$.fn[name] = plugin.jQueryInterface;
|
||||
$.fn[name].Constructor = plugin;
|
||||
|
||||
$.fn[name].noConflict = function () {
|
||||
$.fn[name].noConflict = () => {
|
||||
$.fn[name] = JQUERY_NO_CONFLICT;
|
||||
return plugin.jQueryInterface;
|
||||
};
|
||||
|
@ -253,60 +193,63 @@
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): dropdown.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var NAME = 'dropdown';
|
||||
var DATA_KEY = 'bs.dropdown';
|
||||
var EVENT_KEY = '.' + DATA_KEY;
|
||||
var DATA_API_KEY = '.data-api';
|
||||
var ESCAPE_KEY = 'Escape';
|
||||
var SPACE_KEY = 'Space';
|
||||
var TAB_KEY = 'Tab';
|
||||
var ARROW_UP_KEY = 'ArrowUp';
|
||||
var ARROW_DOWN_KEY = 'ArrowDown';
|
||||
var RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
|
||||
const NAME = 'dropdown';
|
||||
const DATA_KEY = 'bs.dropdown';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const DATA_API_KEY = '.data-api';
|
||||
const ESCAPE_KEY = 'Escape';
|
||||
const SPACE_KEY = 'Space';
|
||||
const TAB_KEY = 'Tab';
|
||||
const ARROW_UP_KEY = 'ArrowUp';
|
||||
const ARROW_DOWN_KEY = 'ArrowDown';
|
||||
const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
|
||||
|
||||
var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEY + '|' + ARROW_DOWN_KEY + '|' + ESCAPE_KEY);
|
||||
var EVENT_HIDE = 'hide' + EVENT_KEY;
|
||||
var EVENT_HIDDEN = 'hidden' + EVENT_KEY;
|
||||
var EVENT_SHOW = 'show' + EVENT_KEY;
|
||||
var EVENT_SHOWN = 'shown' + EVENT_KEY;
|
||||
var EVENT_CLICK = 'click' + EVENT_KEY;
|
||||
var EVENT_CLICK_DATA_API = 'click' + EVENT_KEY + DATA_API_KEY;
|
||||
var EVENT_KEYDOWN_DATA_API = 'keydown' + EVENT_KEY + DATA_API_KEY;
|
||||
var EVENT_KEYUP_DATA_API = 'keyup' + EVENT_KEY + DATA_API_KEY;
|
||||
var CLASS_NAME_DISABLED = 'disabled';
|
||||
var CLASS_NAME_SHOW = 'show';
|
||||
var CLASS_NAME_DROPUP = 'dropup';
|
||||
var CLASS_NAME_DROPEND = 'dropend';
|
||||
var CLASS_NAME_DROPSTART = 'dropstart';
|
||||
var CLASS_NAME_NAVBAR = 'navbar';
|
||||
var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]';
|
||||
var SELECTOR_FORM_CHILD = '.dropdown form';
|
||||
var SELECTOR_MENU = '.dropdown-menu';
|
||||
var SELECTOR_NAVBAR_NAV = '.navbar-nav';
|
||||
var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
|
||||
var PLACEMENT_TOP = isRTL ? 'top-end' : 'top-start';
|
||||
var PLACEMENT_TOPEND = isRTL ? 'top-start' : 'top-end';
|
||||
var PLACEMENT_BOTTOM = isRTL ? 'bottom-end' : 'bottom-start';
|
||||
var PLACEMENT_BOTTOMEND = isRTL ? 'bottom-start' : 'bottom-end';
|
||||
var PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start';
|
||||
var PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start';
|
||||
var Default = {
|
||||
const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY}`);
|
||||
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
const EVENT_CLICK = `click${EVENT_KEY}`;
|
||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const CLASS_NAME_DISABLED = 'disabled';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
const CLASS_NAME_DROPUP = 'dropup';
|
||||
const CLASS_NAME_DROPEND = 'dropend';
|
||||
const CLASS_NAME_DROPSTART = 'dropstart';
|
||||
const CLASS_NAME_NAVBAR = 'navbar';
|
||||
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]';
|
||||
const SELECTOR_MENU = '.dropdown-menu';
|
||||
const SELECTOR_NAVBAR_NAV = '.navbar-nav';
|
||||
const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
|
||||
const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start';
|
||||
const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end';
|
||||
const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
|
||||
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
|
||||
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
|
||||
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
|
||||
const Default = {
|
||||
offset: [0, 2],
|
||||
flip: true,
|
||||
boundary: 'clippingParents',
|
||||
reference: 'toggle',
|
||||
display: 'dynamic',
|
||||
popperConfig: null,
|
||||
};
|
||||
var DefaultType = {
|
||||
const DefaultType = {
|
||||
offset: '(array|string|function)',
|
||||
flip: 'boolean',
|
||||
boundary: '(string|element)',
|
||||
reference: '(string|element|object)',
|
||||
display: 'string',
|
||||
|
@ -318,32 +261,35 @@
|
|||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var Dropdown = /*#__PURE__*/ (function (_BaseComponent) {
|
||||
_inheritsLoose(Dropdown, _BaseComponent);
|
||||
class Dropdown extends BaseComponent__default['default'] {
|
||||
constructor(element, config) {
|
||||
super(element);
|
||||
this._popper = null;
|
||||
this._config = this._getConfig(config);
|
||||
this._menu = this._getMenuElement();
|
||||
this._inNavbar = this._detectNavbar();
|
||||
|
||||
function Dropdown(element, config) {
|
||||
var _this;
|
||||
|
||||
_this = _BaseComponent.call(this, element) || this;
|
||||
_this._popper = null;
|
||||
_this._config = _this._getConfig(config);
|
||||
_this._menu = _this._getMenuElement();
|
||||
_this._inNavbar = _this._detectNavbar();
|
||||
|
||||
_this._addEventListeners();
|
||||
|
||||
return _this;
|
||||
this._addEventListeners();
|
||||
} // Getters
|
||||
|
||||
var _proto = Dropdown.prototype;
|
||||
static get Default() {
|
||||
return Default;
|
||||
}
|
||||
|
||||
// Public
|
||||
_proto.toggle = function toggle() {
|
||||
static get DefaultType() {
|
||||
return DefaultType;
|
||||
}
|
||||
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
} // Public
|
||||
|
||||
toggle() {
|
||||
if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var isActive = this._element.classList.contains(CLASS_NAME_SHOW);
|
||||
const isActive = this._element.classList.contains(CLASS_NAME_SHOW);
|
||||
|
||||
Dropdown.clearMenus();
|
||||
|
||||
|
@ -352,9 +298,9 @@
|
|||
}
|
||||
|
||||
this.show();
|
||||
};
|
||||
}
|
||||
|
||||
_proto.show = function show() {
|
||||
show() {
|
||||
if (
|
||||
this._element.disabled ||
|
||||
this._element.classList.contains(CLASS_NAME_DISABLED) ||
|
||||
|
@ -363,11 +309,11 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var parent = Dropdown.getParentFromElement(this._element);
|
||||
var relatedTarget = {
|
||||
const parent = Dropdown.getParentFromElement(this._element);
|
||||
const relatedTarget = {
|
||||
relatedTarget: this._element,
|
||||
};
|
||||
var showEvent = EventHandler__default['default'].trigger(
|
||||
const showEvent = EventHandler__default['default'].trigger(
|
||||
this._element,
|
||||
EVENT_SHOW,
|
||||
relatedTarget
|
||||
|
@ -384,7 +330,7 @@
|
|||
throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
|
||||
}
|
||||
|
||||
var referenceElement = this._element;
|
||||
let referenceElement = this._element;
|
||||
|
||||
if (this._config.reference === 'parent') {
|
||||
referenceElement = parent;
|
||||
|
@ -398,12 +344,12 @@
|
|||
referenceElement = this._config.reference;
|
||||
}
|
||||
|
||||
var popperConfig = this._getPopperConfig();
|
||||
const popperConfig = this._getPopperConfig();
|
||||
|
||||
var isDisplayStatic = popperConfig.modifiers.find(function (modifier) {
|
||||
return modifier.name === 'applyStyles' && modifier.enabled === false;
|
||||
});
|
||||
this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
|
||||
const isDisplayStatic = popperConfig.modifiers.find(
|
||||
(modifier) => modifier.name === 'applyStyles' && modifier.enabled === false
|
||||
);
|
||||
this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig);
|
||||
|
||||
if (isDisplayStatic) {
|
||||
Manipulator__default['default'].setDataAttribute(this._menu, 'popper', 'static');
|
||||
|
@ -414,11 +360,9 @@
|
|||
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
||||
|
||||
if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
|
||||
var _ref;
|
||||
|
||||
(_ref = []).concat.apply(_ref, document.body.children).forEach(function (elem) {
|
||||
return EventHandler__default['default'].on(elem, 'mouseover', null, noop());
|
||||
});
|
||||
[]
|
||||
.concat(...document.body.children)
|
||||
.forEach((elem) => EventHandler__default['default'].on(elem, 'mouseover', null, noop()));
|
||||
}
|
||||
|
||||
this._element.focus();
|
||||
|
@ -430,9 +374,9 @@
|
|||
this._element.classList.toggle(CLASS_NAME_SHOW);
|
||||
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN, relatedTarget);
|
||||
};
|
||||
}
|
||||
|
||||
_proto.hide = function hide() {
|
||||
hide() {
|
||||
if (
|
||||
this._element.disabled ||
|
||||
this._element.classList.contains(CLASS_NAME_DISABLED) ||
|
||||
|
@ -441,10 +385,10 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var relatedTarget = {
|
||||
const relatedTarget = {
|
||||
relatedTarget: this._element,
|
||||
};
|
||||
var hideEvent = EventHandler__default['default'].trigger(
|
||||
const hideEvent = EventHandler__default['default'].trigger(
|
||||
this._element,
|
||||
EVENT_HIDE,
|
||||
relatedTarget
|
||||
|
@ -464,11 +408,9 @@
|
|||
|
||||
Manipulator__default['default'].removeDataAttribute(this._menu, 'popper');
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN, relatedTarget);
|
||||
};
|
||||
|
||||
_proto.dispose = function dispose() {
|
||||
_BaseComponent.prototype.dispose.call(this);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
EventHandler__default['default'].off(this._element, EVENT_KEY);
|
||||
this._menu = null;
|
||||
|
||||
|
@ -477,34 +419,31 @@
|
|||
|
||||
this._popper = null;
|
||||
}
|
||||
};
|
||||
|
||||
_proto.update = function update() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
update() {
|
||||
this._inNavbar = this._detectNavbar();
|
||||
|
||||
if (this._popper) {
|
||||
this._popper.update();
|
||||
}
|
||||
}; // Private
|
||||
} // Private
|
||||
|
||||
_proto._addEventListeners = function _addEventListeners() {
|
||||
var _this2 = this;
|
||||
|
||||
EventHandler__default['default'].on(this._element, EVENT_CLICK, function (event) {
|
||||
_addEventListeners() {
|
||||
EventHandler__default['default'].on(this._element, EVENT_CLICK, (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
_this2.toggle();
|
||||
this.toggle();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
_proto._getConfig = function _getConfig(config) {
|
||||
config = _extends(
|
||||
{},
|
||||
this.constructor.Default,
|
||||
Manipulator__default['default'].getDataAttributes(this._element),
|
||||
config
|
||||
);
|
||||
_getConfig(config) {
|
||||
config = {
|
||||
...this.constructor.Default,
|
||||
...Manipulator__default['default'].getDataAttributes(this._element),
|
||||
...config,
|
||||
};
|
||||
typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
||||
|
||||
if (
|
||||
|
@ -514,20 +453,19 @@
|
|||
) {
|
||||
// Popper virtual elements require a getBoundingClientRect method
|
||||
throw new TypeError(
|
||||
NAME.toUpperCase() +
|
||||
': Option "reference" provided type "object" without a required "getBoundingClientRect" method.'
|
||||
`${NAME.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`
|
||||
);
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
||||
}
|
||||
|
||||
_proto._getMenuElement = function _getMenuElement() {
|
||||
_getMenuElement() {
|
||||
return SelectorEngine__default['default'].next(this._element, SELECTOR_MENU)[0];
|
||||
};
|
||||
}
|
||||
|
||||
_proto._getPlacement = function _getPlacement() {
|
||||
var parentDropdown = this._element.parentNode;
|
||||
_getPlacement() {
|
||||
const parentDropdown = this._element.parentNode;
|
||||
|
||||
if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
|
||||
return PLACEMENT_RIGHT;
|
||||
|
@ -537,47 +475,40 @@
|
|||
return PLACEMENT_LEFT;
|
||||
} // We need to trim the value because custom properties can also include spaces
|
||||
|
||||
var isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
|
||||
const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
|
||||
|
||||
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
|
||||
return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
|
||||
}
|
||||
|
||||
return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
|
||||
};
|
||||
}
|
||||
|
||||
_proto._detectNavbar = function _detectNavbar() {
|
||||
return this._element.closest('.' + CLASS_NAME_NAVBAR) !== null;
|
||||
};
|
||||
_detectNavbar() {
|
||||
return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
|
||||
}
|
||||
|
||||
_proto._getOffset = function _getOffset() {
|
||||
var _this3 = this;
|
||||
|
||||
var offset = this._config.offset;
|
||||
_getOffset() {
|
||||
const { offset } = this._config;
|
||||
|
||||
if (typeof offset === 'string') {
|
||||
return offset.split(',').map(function (val) {
|
||||
return Number.parseInt(val, 10);
|
||||
});
|
||||
return offset.split(',').map((val) => Number.parseInt(val, 10));
|
||||
}
|
||||
|
||||
if (typeof offset === 'function') {
|
||||
return function (popperData) {
|
||||
return offset(popperData, _this3._element);
|
||||
};
|
||||
return (popperData) => offset(popperData, this._element);
|
||||
}
|
||||
|
||||
return offset;
|
||||
};
|
||||
}
|
||||
|
||||
_proto._getPopperConfig = function _getPopperConfig() {
|
||||
var defaultBsPopperConfig = {
|
||||
_getPopperConfig() {
|
||||
const defaultBsPopperConfig = {
|
||||
placement: this._getPlacement(),
|
||||
modifiers: [
|
||||
{
|
||||
name: 'preventOverflow',
|
||||
options: {
|
||||
altBoundary: this._config.flip,
|
||||
boundary: this._config.boundary,
|
||||
},
|
||||
},
|
||||
|
@ -599,19 +530,18 @@
|
|||
];
|
||||
}
|
||||
|
||||
return _extends(
|
||||
{},
|
||||
defaultBsPopperConfig,
|
||||
typeof this._config.popperConfig === 'function'
|
||||
return {
|
||||
...defaultBsPopperConfig,
|
||||
...(typeof this._config.popperConfig === 'function'
|
||||
? this._config.popperConfig(defaultBsPopperConfig)
|
||||
: this._config.popperConfig
|
||||
);
|
||||
}; // Static
|
||||
: this._config.popperConfig),
|
||||
};
|
||||
} // Static
|
||||
|
||||
Dropdown.dropdownInterface = function dropdownInterface(element, config) {
|
||||
var data = Data__default['default'].getData(element, DATA_KEY);
|
||||
static dropdownInterface(element, config) {
|
||||
let data = Data__default['default'].get(element, DATA_KEY);
|
||||
|
||||
var _config = typeof config === 'object' ? config : null;
|
||||
const _config = typeof config === 'object' ? config : null;
|
||||
|
||||
if (!data) {
|
||||
data = new Dropdown(element, _config);
|
||||
|
@ -619,32 +549,38 @@
|
|||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
throw new TypeError('No method named "' + config + '"');
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config]();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Dropdown.jQueryInterface = function jQueryInterface(config) {
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
Dropdown.dropdownInterface(this, config);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Dropdown.clearMenus = function clearMenus(event) {
|
||||
if (
|
||||
event &&
|
||||
(event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY))
|
||||
) {
|
||||
return;
|
||||
static clearMenus(event) {
|
||||
if (event) {
|
||||
if (
|
||||
event.button === RIGHT_MOUSE_BUTTON ||
|
||||
(event.type === 'keyup' && event.key !== TAB_KEY)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (/input|select|textarea|form/i.test(event.target.tagName)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var toggles = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
|
||||
const toggles = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
|
||||
|
||||
for (var i = 0, len = toggles.length; i < len; i++) {
|
||||
var context = Data__default['default'].getData(toggles[i], DATA_KEY);
|
||||
var relatedTarget = {
|
||||
for (let i = 0, len = toggles.length; i < len; i++) {
|
||||
const context = Data__default['default'].get(toggles[i], DATA_KEY);
|
||||
const relatedTarget = {
|
||||
relatedTarget: toggles[i],
|
||||
};
|
||||
|
||||
|
@ -656,22 +592,28 @@
|
|||
continue;
|
||||
}
|
||||
|
||||
var dropdownMenu = context._menu;
|
||||
const dropdownMenu = context._menu;
|
||||
|
||||
if (!toggles[i].classList.contains(CLASS_NAME_SHOW)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
event &&
|
||||
((event.type === 'click' && /input|textarea/i.test(event.target.tagName)) ||
|
||||
(event.type === 'keyup' && event.key === TAB_KEY)) &&
|
||||
dropdownMenu.contains(event.target)
|
||||
) {
|
||||
continue;
|
||||
if (event) {
|
||||
// Don't close the menu if the clicked element or one of its parents is the dropdown button
|
||||
if ([context._element].some((element) => event.composedPath().includes(element))) {
|
||||
continue;
|
||||
} // Tab navigation through the dropdown menu shouldn't close the menu
|
||||
|
||||
if (
|
||||
event.type === 'keyup' &&
|
||||
event.key === TAB_KEY &&
|
||||
dropdownMenu.contains(event.target)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var hideEvent = EventHandler__default['default'].trigger(
|
||||
const hideEvent = EventHandler__default['default'].trigger(
|
||||
toggles[i],
|
||||
EVENT_HIDE,
|
||||
relatedTarget
|
||||
|
@ -683,11 +625,11 @@
|
|||
// empty mouseover listeners we added for iOS support
|
||||
|
||||
if ('ontouchstart' in document.documentElement) {
|
||||
var _ref2;
|
||||
|
||||
(_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (elem) {
|
||||
return EventHandler__default['default'].off(elem, 'mouseover', null, noop());
|
||||
});
|
||||
[]
|
||||
.concat(...document.body.children)
|
||||
.forEach((elem) =>
|
||||
EventHandler__default['default'].off(elem, 'mouseover', null, noop())
|
||||
);
|
||||
}
|
||||
|
||||
toggles[i].setAttribute('aria-expanded', 'false');
|
||||
|
@ -701,13 +643,13 @@
|
|||
Manipulator__default['default'].removeDataAttribute(dropdownMenu, 'popper');
|
||||
EventHandler__default['default'].trigger(toggles[i], EVENT_HIDDEN, relatedTarget);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Dropdown.getParentFromElement = function getParentFromElement(element) {
|
||||
static getParentFromElement(element) {
|
||||
return getElementFromSelector(element) || element.parentNode;
|
||||
};
|
||||
}
|
||||
|
||||
Dropdown.dataApiKeydownHandler = function dataApiKeydownHandler(event) {
|
||||
static dataApiKeydownHandler(event) {
|
||||
// If not input/textarea:
|
||||
// - And not a key in REGEXP_KEYDOWN => not a dropdown command
|
||||
// If input/textarea:
|
||||
|
@ -733,11 +675,11 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var parent = Dropdown.getParentFromElement(this);
|
||||
var isActive = this.classList.contains(CLASS_NAME_SHOW);
|
||||
const parent = Dropdown.getParentFromElement(this);
|
||||
const isActive = this.classList.contains(CLASS_NAME_SHOW);
|
||||
|
||||
if (event.key === ESCAPE_KEY) {
|
||||
var button = this.matches(SELECTOR_DATA_TOGGLE)
|
||||
const button = this.matches(SELECTOR_DATA_TOGGLE)
|
||||
? this
|
||||
: SelectorEngine__default['default'].prev(this, SELECTOR_DATA_TOGGLE)[0];
|
||||
button.focus();
|
||||
|
@ -746,12 +688,10 @@
|
|||
}
|
||||
|
||||
if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
|
||||
var _button = this.matches(SELECTOR_DATA_TOGGLE)
|
||||
const button = this.matches(SELECTOR_DATA_TOGGLE)
|
||||
? this
|
||||
: SelectorEngine__default['default'].prev(this, SELECTOR_DATA_TOGGLE)[0];
|
||||
|
||||
_button.click();
|
||||
|
||||
button.click();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -760,7 +700,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var items = SelectorEngine__default['default']
|
||||
const items = SelectorEngine__default['default']
|
||||
.find(SELECTOR_VISIBLE_ITEMS, parent)
|
||||
.filter(isVisible);
|
||||
|
||||
|
@ -768,7 +708,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var index = items.indexOf(event.target); // Up
|
||||
let index = items.indexOf(event.target); // Up
|
||||
|
||||
if (event.key === ARROW_UP_KEY && index > 0) {
|
||||
index--;
|
||||
|
@ -780,31 +720,8 @@
|
|||
|
||||
index = index === -1 ? 0 : index;
|
||||
items[index].focus();
|
||||
};
|
||||
|
||||
_createClass(Dropdown, null, [
|
||||
{
|
||||
key: 'Default',
|
||||
get: function get() {
|
||||
return Default;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'DefaultType',
|
||||
get: function get() {
|
||||
return DefaultType;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'DATA_KEY',
|
||||
get: function get() {
|
||||
return DATA_KEY;
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
return Dropdown;
|
||||
})(BaseComponent__default['default']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Data Api implementation
|
||||
|
@ -831,16 +748,7 @@
|
|||
SELECTOR_DATA_TOGGLE,
|
||||
function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
Dropdown.dropdownInterface(this, 'toggle');
|
||||
}
|
||||
);
|
||||
EventHandler__default['default'].on(
|
||||
document,
|
||||
EVENT_CLICK_DATA_API,
|
||||
SELECTOR_FORM_CHILD,
|
||||
function (e) {
|
||||
return e.stopPropagation();
|
||||
Dropdown.dropdownInterface(this);
|
||||
}
|
||||
);
|
||||
/**
|
||||
|
|
2
src/js/bootstrap/dist/dropdown.js.map
vendored
2
src/js/bootstrap/dist/dropdown.js.map
vendored
File diff suppressed because one or more lines are too long
652
src/js/bootstrap/dist/modal.js
vendored
652
src/js/bootstrap/dist/modal.js
vendored
File diff suppressed because it is too large
Load Diff
2
src/js/bootstrap/dist/modal.js.map
vendored
2
src/js/bootstrap/dist/modal.js.map
vendored
File diff suppressed because one or more lines are too long
561
src/js/bootstrap/dist/offcanvas.js
vendored
Normal file
561
src/js/bootstrap/dist/offcanvas.js
vendored
Normal file
|
@ -0,0 +1,561 @@
|
|||
/*!
|
||||
* Bootstrap offcanvas.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined'
|
||||
? (module.exports = factory(
|
||||
require('./dom/selector-engine.js'),
|
||||
require('./dom/manipulator.js'),
|
||||
require('./dom/data.js'),
|
||||
require('./dom/event-handler.js'),
|
||||
require('./base-component.js')
|
||||
))
|
||||
: typeof define === 'function' && define.amd
|
||||
? define([
|
||||
'./dom/selector-engine',
|
||||
'./dom/manipulator',
|
||||
'./dom/data',
|
||||
'./dom/event-handler',
|
||||
'./base-component',
|
||||
], factory)
|
||||
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
|
||||
(global.Offcanvas = factory(
|
||||
global.SelectorEngine,
|
||||
global.Manipulator,
|
||||
global.Data,
|
||||
global.EventHandler,
|
||||
global.Base
|
||||
)));
|
||||
})(this, function (SelectorEngine, Manipulator, Data, EventHandler, BaseComponent) {
|
||||
'use strict';
|
||||
|
||||
function _interopDefaultLegacy(e) {
|
||||
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
||||
}
|
||||
|
||||
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
|
||||
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
|
||||
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
|
||||
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
|
||||
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
const MILLISECONDS_MULTIPLIER = 1000;
|
||||
|
||||
const toType = (obj) => {
|
||||
if (obj === null || obj === undefined) {
|
||||
return `${obj}`;
|
||||
}
|
||||
|
||||
return {}.toString
|
||||
.call(obj)
|
||||
.match(/\s([a-z]+)/i)[1]
|
||||
.toLowerCase();
|
||||
};
|
||||
|
||||
const getSelector = (element) => {
|
||||
let selector = element.getAttribute('data-bs-target');
|
||||
|
||||
if (!selector || selector === '#') {
|
||||
let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
||||
// `document.querySelector` will rightfully complain it is invalid.
|
||||
// See https://github.com/twbs/bootstrap/issues/32273
|
||||
|
||||
if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {
|
||||
return null;
|
||||
} // Just in case some CMS puts out a full URL with the anchor appended
|
||||
|
||||
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
|
||||
hrefAttr = '#' + hrefAttr.split('#')[1];
|
||||
}
|
||||
|
||||
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
|
||||
}
|
||||
|
||||
return selector;
|
||||
};
|
||||
|
||||
const getSelectorFromElement = (element) => {
|
||||
const selector = getSelector(element);
|
||||
|
||||
if (selector) {
|
||||
return document.querySelector(selector) ? selector : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const getElementFromSelector = (element) => {
|
||||
const selector = getSelector(element);
|
||||
return selector ? document.querySelector(selector) : null;
|
||||
};
|
||||
|
||||
const getTransitionDurationFromElement = (element) => {
|
||||
if (!element) {
|
||||
return 0;
|
||||
} // Get transition-duration of the element
|
||||
|
||||
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
||||
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||
|
||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||
return 0;
|
||||
} // If multiple durations are defined, take the first
|
||||
|
||||
transitionDuration = transitionDuration.split(',')[0];
|
||||
transitionDelay = transitionDelay.split(',')[0];
|
||||
return (
|
||||
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
|
||||
MILLISECONDS_MULTIPLIER
|
||||
);
|
||||
};
|
||||
|
||||
const isElement = (obj) => (obj[0] || obj).nodeType;
|
||||
|
||||
const typeCheckConfig = (componentName, config, configTypes) => {
|
||||
Object.keys(configTypes).forEach((property) => {
|
||||
const expectedTypes = configTypes[property];
|
||||
const value = config[property];
|
||||
const valueType = value && isElement(value) ? 'element' : toType(value);
|
||||
|
||||
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||
throw new TypeError(
|
||||
`${componentName.toUpperCase()}: ` +
|
||||
`Option "${property}" provided type "${valueType}" ` +
|
||||
`but expected type "${expectedTypes}".`
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const isVisible = (element) => {
|
||||
if (!element) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (element.style && element.parentNode && element.parentNode.style) {
|
||||
const elementStyle = getComputedStyle(element);
|
||||
const parentNodeStyle = getComputedStyle(element.parentNode);
|
||||
return (
|
||||
elementStyle.display !== 'none' &&
|
||||
parentNodeStyle.display !== 'none' &&
|
||||
elementStyle.visibility !== 'hidden'
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
const isDisabled = (element) => {
|
||||
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (element.classList.contains('disabled')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof element.disabled !== 'undefined') {
|
||||
return element.disabled;
|
||||
}
|
||||
|
||||
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
||||
};
|
||||
|
||||
const getjQuery = () => {
|
||||
const { jQuery } = window;
|
||||
|
||||
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||
return jQuery;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const onDOMContentLoaded = (callback) => {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||||
$.fn[name] = plugin.jQueryInterface;
|
||||
$.fn[name].Constructor = plugin;
|
||||
|
||||
$.fn[name].noConflict = () => {
|
||||
$.fn[name] = JQUERY_NO_CONFLICT;
|
||||
return plugin.jQueryInterface;
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): util/scrollBar.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed';
|
||||
const SELECTOR_STICKY_CONTENT = '.sticky-top';
|
||||
|
||||
const getWidth = () => {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
||||
const documentWidth = document.documentElement.clientWidth;
|
||||
return Math.abs(window.innerWidth - documentWidth);
|
||||
};
|
||||
|
||||
const hide = (width = getWidth()) => {
|
||||
document.body.style.overflow = 'hidden';
|
||||
|
||||
_setElementAttributes(
|
||||
SELECTOR_FIXED_CONTENT,
|
||||
'paddingRight',
|
||||
(calculatedValue) => calculatedValue + width
|
||||
);
|
||||
|
||||
_setElementAttributes(
|
||||
SELECTOR_STICKY_CONTENT,
|
||||
'marginRight',
|
||||
(calculatedValue) => calculatedValue - width
|
||||
);
|
||||
|
||||
_setElementAttributes('body', 'paddingRight', (calculatedValue) => calculatedValue + width);
|
||||
};
|
||||
|
||||
const _setElementAttributes = (selector, styleProp, callback) => {
|
||||
const scrollbarWidth = getWidth();
|
||||
SelectorEngine__default['default'].find(selector).forEach((element) => {
|
||||
if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
|
||||
return;
|
||||
}
|
||||
|
||||
const actualValue = element.style[styleProp];
|
||||
const calculatedValue = window.getComputedStyle(element)[styleProp];
|
||||
Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue);
|
||||
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
|
||||
});
|
||||
};
|
||||
|
||||
const reset = () => {
|
||||
document.body.style.overflow = 'auto';
|
||||
|
||||
_resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
|
||||
|
||||
_resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
|
||||
|
||||
_resetElementAttributes('body', 'paddingRight');
|
||||
};
|
||||
|
||||
const _resetElementAttributes = (selector, styleProp) => {
|
||||
SelectorEngine__default['default'].find(selector).forEach((element) => {
|
||||
const value = Manipulator__default['default'].getDataAttribute(element, styleProp);
|
||||
|
||||
if (typeof value === 'undefined' && element === document.body) {
|
||||
element.style.removeProperty(styleProp);
|
||||
} else {
|
||||
Manipulator__default['default'].removeDataAttribute(element, styleProp);
|
||||
element.style[styleProp] = value;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): offcanvas.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const NAME = 'offcanvas';
|
||||
const DATA_KEY = 'bs.offcanvas';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const DATA_API_KEY = '.data-api';
|
||||
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const ESCAPE_KEY = 'Escape';
|
||||
const Default = {
|
||||
backdrop: true,
|
||||
keyboard: true,
|
||||
scroll: false,
|
||||
};
|
||||
const DefaultType = {
|
||||
backdrop: 'boolean',
|
||||
keyboard: 'boolean',
|
||||
scroll: 'boolean',
|
||||
};
|
||||
const CLASS_NAME_BACKDROP_BODY = 'offcanvas-backdrop';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
const CLASS_NAME_TOGGLING = 'offcanvas-toggling';
|
||||
const OPEN_SELECTOR = '.offcanvas.show';
|
||||
const ACTIVE_SELECTOR = `${OPEN_SELECTOR}, .${CLASS_NAME_TOGGLING}`;
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
||||
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="offcanvas"]';
|
||||
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="offcanvas"]';
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
class Offcanvas extends BaseComponent__default['default'] {
|
||||
constructor(element, config) {
|
||||
super(element);
|
||||
this._config = this._getConfig(config);
|
||||
this._isShown = false;
|
||||
|
||||
this._addEventListeners();
|
||||
} // Getters
|
||||
|
||||
static get Default() {
|
||||
return Default;
|
||||
}
|
||||
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
} // Public
|
||||
|
||||
toggle(relatedTarget) {
|
||||
return this._isShown ? this.hide() : this.show(relatedTarget);
|
||||
}
|
||||
|
||||
show(relatedTarget) {
|
||||
if (this._isShown) {
|
||||
return;
|
||||
}
|
||||
|
||||
const showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, {
|
||||
relatedTarget,
|
||||
});
|
||||
|
||||
if (showEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._isShown = true;
|
||||
this._element.style.visibility = 'visible';
|
||||
|
||||
if (this._config.backdrop) {
|
||||
document.body.classList.add(CLASS_NAME_BACKDROP_BODY);
|
||||
}
|
||||
|
||||
if (!this._config.scroll) {
|
||||
hide();
|
||||
}
|
||||
|
||||
this._element.classList.add(CLASS_NAME_TOGGLING);
|
||||
|
||||
this._element.removeAttribute('aria-hidden');
|
||||
|
||||
this._element.setAttribute('aria-modal', true);
|
||||
|
||||
this._element.setAttribute('role', 'dialog');
|
||||
|
||||
this._element.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
const completeCallBack = () => {
|
||||
this._element.classList.remove(CLASS_NAME_TOGGLING);
|
||||
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN, {
|
||||
relatedTarget,
|
||||
});
|
||||
|
||||
this._enforceFocusOnElement(this._element);
|
||||
};
|
||||
|
||||
setTimeout(completeCallBack, getTransitionDurationFromElement(this._element));
|
||||
}
|
||||
|
||||
hide() {
|
||||
if (!this._isShown) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
|
||||
|
||||
if (hideEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._element.classList.add(CLASS_NAME_TOGGLING);
|
||||
|
||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
|
||||
|
||||
this._element.blur();
|
||||
|
||||
this._isShown = false;
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||
|
||||
const completeCallback = () => {
|
||||
this._element.setAttribute('aria-hidden', true);
|
||||
|
||||
this._element.removeAttribute('aria-modal');
|
||||
|
||||
this._element.removeAttribute('role');
|
||||
|
||||
this._element.style.visibility = 'hidden';
|
||||
|
||||
if (this._config.backdrop) {
|
||||
document.body.classList.remove(CLASS_NAME_BACKDROP_BODY);
|
||||
}
|
||||
|
||||
if (!this._config.scroll) {
|
||||
reset();
|
||||
}
|
||||
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_TOGGLING);
|
||||
};
|
||||
|
||||
setTimeout(completeCallback, getTransitionDurationFromElement(this._element));
|
||||
} // Private
|
||||
|
||||
_getConfig(config) {
|
||||
config = {
|
||||
...Default,
|
||||
...Manipulator__default['default'].getDataAttributes(this._element),
|
||||
...(typeof config === 'object' ? config : {}),
|
||||
};
|
||||
typeCheckConfig(NAME, config, DefaultType);
|
||||
return config;
|
||||
}
|
||||
|
||||
_enforceFocusOnElement(element) {
|
||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN); // guard against infinite focus loop
|
||||
|
||||
EventHandler__default['default'].on(document, EVENT_FOCUSIN, (event) => {
|
||||
if (
|
||||
document !== event.target &&
|
||||
element !== event.target &&
|
||||
!element.contains(event.target)
|
||||
) {
|
||||
element.focus();
|
||||
}
|
||||
});
|
||||
element.focus();
|
||||
}
|
||||
|
||||
_addEventListeners() {
|
||||
EventHandler__default['default'].on(
|
||||
this._element,
|
||||
EVENT_CLICK_DISMISS,
|
||||
SELECTOR_DATA_DISMISS,
|
||||
() => this.hide()
|
||||
);
|
||||
EventHandler__default['default'].on(document, 'keydown', (event) => {
|
||||
if (this._config.keyboard && event.key === ESCAPE_KEY) {
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, (event) => {
|
||||
const target = SelectorEngine__default['default'].findOne(
|
||||
getSelectorFromElement(event.target)
|
||||
);
|
||||
|
||||
if (!this._element.contains(event.target) && target !== this._element) {
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
} // Static
|
||||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
const data =
|
||||
Data__default['default'].get(this, DATA_KEY) ||
|
||||
new Offcanvas(this, typeof config === 'object' ? config : {});
|
||||
|
||||
if (typeof config !== 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config](this);
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Data Api implementation
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
EventHandler__default['default'].on(
|
||||
document,
|
||||
EVENT_CLICK_DATA_API,
|
||||
SELECTOR_DATA_TOGGLE,
|
||||
function (event) {
|
||||
const target = getElementFromSelector(this);
|
||||
|
||||
if (['A', 'AREA'].includes(this.tagName)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (isDisabled(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
EventHandler__default['default'].one(target, EVENT_HIDDEN, () => {
|
||||
// focus on trigger when it is closed
|
||||
if (isVisible(this)) {
|
||||
this.focus();
|
||||
}
|
||||
}); // avoid conflict when clicking a toggler of an offcanvas, while another is open
|
||||
|
||||
const allReadyOpen = SelectorEngine__default['default'].findOne(ACTIVE_SELECTOR);
|
||||
|
||||
if (allReadyOpen && allReadyOpen !== target) {
|
||||
return;
|
||||
}
|
||||
|
||||
const data = Data__default['default'].get(target, DATA_KEY) || new Offcanvas(target);
|
||||
data.toggle(this);
|
||||
}
|
||||
);
|
||||
EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => {
|
||||
SelectorEngine__default['default']
|
||||
.find(OPEN_SELECTOR)
|
||||
.forEach((el) => (Data__default['default'].get(el, DATA_KEY) || new Offcanvas(el)).show());
|
||||
});
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* jQuery
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
defineJQueryPlugin(NAME, Offcanvas);
|
||||
|
||||
return Offcanvas;
|
||||
});
|
||||
//# sourceMappingURL=offcanvas.js.map
|
1
src/js/bootstrap/dist/offcanvas.js.map
vendored
Normal file
1
src/js/bootstrap/dist/offcanvas.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
262
src/js/bootstrap/dist/popover.js
vendored
262
src/js/bootstrap/dist/popover.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap popover.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap popover.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -25,70 +25,15 @@
|
|||
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
|
||||
var Tooltip__default = /*#__PURE__*/ _interopDefaultLegacy(Tooltip);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
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 _inheritsLoose(subClass, superClass) {
|
||||
subClass.prototype = Object.create(superClass.prototype);
|
||||
subClass.prototype.constructor = subClass;
|
||||
|
||||
_setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf =
|
||||
Object.setPrototypeOf ||
|
||||
function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/index.js
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var getjQuery = function getjQuery() {
|
||||
var _window = window,
|
||||
jQuery = _window.jQuery;
|
||||
const getjQuery = () => {
|
||||
const { jQuery } = window;
|
||||
|
||||
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||
return jQuery;
|
||||
|
@ -97,7 +42,7 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||
const onDOMContentLoaded = (callback) => {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
} else {
|
||||
|
@ -105,19 +50,17 @@
|
|||
}
|
||||
};
|
||||
|
||||
document.documentElement.dir === 'rtl';
|
||||
|
||||
var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
|
||||
onDOMContentLoaded(function () {
|
||||
var $ = getjQuery();
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
var JQUERY_NO_CONFLICT = $.fn[name];
|
||||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||||
$.fn[name] = plugin.jQueryInterface;
|
||||
$.fn[name].Constructor = plugin;
|
||||
|
||||
$.fn[name].noConflict = function () {
|
||||
$.fn[name].noConflict = () => {
|
||||
$.fn[name] = JQUERY_NO_CONFLICT;
|
||||
return plugin.jQueryInterface;
|
||||
};
|
||||
|
@ -125,19 +68,25 @@
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): popover.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var NAME = 'popover';
|
||||
var DATA_KEY = 'bs.popover';
|
||||
var EVENT_KEY = '.' + DATA_KEY;
|
||||
var CLASS_PREFIX = 'bs-popover';
|
||||
var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g');
|
||||
|
||||
var Default = _extends({}, Tooltip__default['default'].Default, {
|
||||
const NAME = 'popover';
|
||||
const DATA_KEY = 'bs.popover';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const CLASS_PREFIX = 'bs-popover';
|
||||
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
||||
const Default = {
|
||||
...Tooltip__default['default'].Default,
|
||||
placement: 'right',
|
||||
offset: [0, 8],
|
||||
trigger: 'click',
|
||||
|
@ -148,57 +97,72 @@
|
|||
'<h3 class="popover-header"></h3>' +
|
||||
'<div class="popover-body"></div>' +
|
||||
'</div>',
|
||||
});
|
||||
|
||||
var DefaultType = _extends({}, Tooltip__default['default'].DefaultType, {
|
||||
content: '(string|element|function)',
|
||||
});
|
||||
|
||||
var Event = {
|
||||
HIDE: 'hide' + EVENT_KEY,
|
||||
HIDDEN: 'hidden' + EVENT_KEY,
|
||||
SHOW: 'show' + EVENT_KEY,
|
||||
SHOWN: 'shown' + EVENT_KEY,
|
||||
INSERTED: 'inserted' + EVENT_KEY,
|
||||
CLICK: 'click' + EVENT_KEY,
|
||||
FOCUSIN: 'focusin' + EVENT_KEY,
|
||||
FOCUSOUT: 'focusout' + EVENT_KEY,
|
||||
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
||||
MOUSELEAVE: 'mouseleave' + EVENT_KEY,
|
||||
};
|
||||
var CLASS_NAME_FADE = 'fade';
|
||||
var CLASS_NAME_SHOW = 'show';
|
||||
var SELECTOR_TITLE = '.popover-header';
|
||||
var SELECTOR_CONTENT = '.popover-body';
|
||||
const DefaultType = {
|
||||
...Tooltip__default['default'].DefaultType,
|
||||
content: '(string|element|function)',
|
||||
};
|
||||
const Event = {
|
||||
HIDE: `hide${EVENT_KEY}`,
|
||||
HIDDEN: `hidden${EVENT_KEY}`,
|
||||
SHOW: `show${EVENT_KEY}`,
|
||||
SHOWN: `shown${EVENT_KEY}`,
|
||||
INSERTED: `inserted${EVENT_KEY}`,
|
||||
CLICK: `click${EVENT_KEY}`,
|
||||
FOCUSIN: `focusin${EVENT_KEY}`,
|
||||
FOCUSOUT: `focusout${EVENT_KEY}`,
|
||||
MOUSEENTER: `mouseenter${EVENT_KEY}`,
|
||||
MOUSELEAVE: `mouseleave${EVENT_KEY}`,
|
||||
};
|
||||
const CLASS_NAME_FADE = 'fade';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
const SELECTOR_TITLE = '.popover-header';
|
||||
const SELECTOR_CONTENT = '.popover-body';
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var Popover = /*#__PURE__*/ (function (_Tooltip) {
|
||||
_inheritsLoose(Popover, _Tooltip);
|
||||
|
||||
function Popover() {
|
||||
return _Tooltip.apply(this, arguments) || this;
|
||||
class Popover extends Tooltip__default['default'] {
|
||||
// Getters
|
||||
static get Default() {
|
||||
return Default;
|
||||
}
|
||||
|
||||
var _proto = Popover.prototype;
|
||||
static get NAME() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
// Overrides
|
||||
_proto.isWithContent = function isWithContent() {
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
}
|
||||
|
||||
static get Event() {
|
||||
return Event;
|
||||
}
|
||||
|
||||
static get EVENT_KEY() {
|
||||
return EVENT_KEY;
|
||||
}
|
||||
|
||||
static get DefaultType() {
|
||||
return DefaultType;
|
||||
} // Overrides
|
||||
|
||||
isWithContent() {
|
||||
return this.getTitle() || this._getContent();
|
||||
};
|
||||
}
|
||||
|
||||
_proto.setContent = function setContent() {
|
||||
var tip = this.getTipElement(); // we use append for html objects to maintain js events
|
||||
setContent() {
|
||||
const tip = this.getTipElement(); // we use append for html objects to maintain js events
|
||||
|
||||
this.setElementContent(
|
||||
SelectorEngine__default['default'].findOne(SELECTOR_TITLE, tip),
|
||||
this.getTitle()
|
||||
);
|
||||
|
||||
var content = this._getContent();
|
||||
let content = this._getContent();
|
||||
|
||||
if (typeof content === 'function') {
|
||||
content = content.call(this._element);
|
||||
|
@ -209,36 +173,30 @@
|
|||
content
|
||||
);
|
||||
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
|
||||
}; // Private
|
||||
} // Private
|
||||
|
||||
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
|
||||
this.getTipElement().classList.add(CLASS_PREFIX + '-' + this.updateAttachment(attachment));
|
||||
};
|
||||
_addAttachmentClass(attachment) {
|
||||
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
||||
}
|
||||
|
||||
_proto._getContent = function _getContent() {
|
||||
_getContent() {
|
||||
return this._element.getAttribute('data-bs-content') || this.config.content;
|
||||
};
|
||||
}
|
||||
|
||||
_proto._cleanTipClass = function _cleanTipClass() {
|
||||
var tip = this.getTipElement();
|
||||
var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
||||
_cleanTipClass() {
|
||||
const tip = this.getTipElement();
|
||||
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
||||
|
||||
if (tabClass !== null && tabClass.length > 0) {
|
||||
tabClass
|
||||
.map(function (token) {
|
||||
return token.trim();
|
||||
})
|
||||
.forEach(function (tClass) {
|
||||
return tip.classList.remove(tClass);
|
||||
});
|
||||
tabClass.map((token) => token.trim()).forEach((tClass) => tip.classList.remove(tClass));
|
||||
}
|
||||
}; // Static
|
||||
} // Static
|
||||
|
||||
Popover.jQueryInterface = function jQueryInterface(config) {
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
var data = Data__default['default'].getData(this, DATA_KEY);
|
||||
let data = Data__default['default'].get(this, DATA_KEY);
|
||||
|
||||
var _config = typeof config === 'object' ? config : null;
|
||||
const _config = typeof config === 'object' ? config : null;
|
||||
|
||||
if (!data && /dispose|hide/.test(config)) {
|
||||
return;
|
||||
|
@ -246,61 +204,19 @@
|
|||
|
||||
if (!data) {
|
||||
data = new Popover(this, _config);
|
||||
Data__default['default'].setData(this, DATA_KEY, data);
|
||||
Data__default['default'].set(this, DATA_KEY, data);
|
||||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
throw new TypeError('No method named "' + config + '"');
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config]();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_createClass(Popover, null, [
|
||||
{
|
||||
key: 'Default',
|
||||
// Getters
|
||||
get: function get() {
|
||||
return Default;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'NAME',
|
||||
get: function get() {
|
||||
return NAME;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'DATA_KEY',
|
||||
get: function get() {
|
||||
return DATA_KEY;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'Event',
|
||||
get: function get() {
|
||||
return Event;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'EVENT_KEY',
|
||||
get: function get() {
|
||||
return EVENT_KEY;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'DefaultType',
|
||||
get: function get() {
|
||||
return DefaultType;
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
return Popover;
|
||||
})(Tooltip__default['default']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* jQuery
|
||||
|
|
2
src/js/bootstrap/dist/popover.js.map
vendored
2
src/js/bootstrap/dist/popover.js.map
vendored
File diff suppressed because one or more lines are too long
373
src/js/bootstrap/dist/scrollspy.js
vendored
373
src/js/bootstrap/dist/scrollspy.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap scrollspy.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap scrollspy.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -41,71 +41,17 @@
|
|||
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
|
||||
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
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 _inheritsLoose(subClass, superClass) {
|
||||
subClass.prototype = Object.create(superClass.prototype);
|
||||
subClass.prototype.constructor = subClass;
|
||||
|
||||
_setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf =
|
||||
Object.setPrototypeOf ||
|
||||
function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/index.js
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
var MAX_UID = 1000000;
|
||||
const MAX_UID = 1000000;
|
||||
|
||||
var toType = function toType(obj) {
|
||||
const toType = (obj) => {
|
||||
if (obj === null || obj === undefined) {
|
||||
return '' + obj;
|
||||
return `${obj}`;
|
||||
}
|
||||
|
||||
return {}.toString
|
||||
|
@ -119,7 +65,7 @@
|
|||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var getUID = function getUID(prefix) {
|
||||
const getUID = (prefix) => {
|
||||
do {
|
||||
prefix += Math.floor(Math.random() * MAX_UID);
|
||||
} while (document.getElementById(prefix));
|
||||
|
@ -127,11 +73,11 @@
|
|||
return prefix;
|
||||
};
|
||||
|
||||
var getSelector = function getSelector(element) {
|
||||
var selector = element.getAttribute('data-bs-target');
|
||||
const getSelector = (element) => {
|
||||
let selector = element.getAttribute('data-bs-target');
|
||||
|
||||
if (!selector || selector === '#') {
|
||||
var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
||||
// `document.querySelector` will rightfully complain it is invalid.
|
||||
// See https://github.com/twbs/bootstrap/issues/32273
|
||||
|
@ -150,8 +96,8 @@
|
|||
return selector;
|
||||
};
|
||||
|
||||
var getSelectorFromElement = function getSelectorFromElement(element) {
|
||||
var selector = getSelector(element);
|
||||
const getSelectorFromElement = (element) => {
|
||||
const selector = getSelector(element);
|
||||
|
||||
if (selector) {
|
||||
return document.querySelector(selector) ? selector : null;
|
||||
|
@ -160,30 +106,26 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
var isElement = function isElement(obj) {
|
||||
return (obj[0] || obj).nodeType;
|
||||
};
|
||||
const isElement = (obj) => (obj[0] || obj).nodeType;
|
||||
|
||||
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
||||
Object.keys(configTypes).forEach(function (property) {
|
||||
var expectedTypes = configTypes[property];
|
||||
var value = config[property];
|
||||
var valueType = value && isElement(value) ? 'element' : toType(value);
|
||||
const typeCheckConfig = (componentName, config, configTypes) => {
|
||||
Object.keys(configTypes).forEach((property) => {
|
||||
const expectedTypes = configTypes[property];
|
||||
const value = config[property];
|
||||
const valueType = value && isElement(value) ? 'element' : toType(value);
|
||||
|
||||
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||
throw new TypeError(
|
||||
componentName.toUpperCase() +
|
||||
': ' +
|
||||
('Option "' + property + '" provided type "' + valueType + '" ') +
|
||||
('but expected type "' + expectedTypes + '".')
|
||||
`${componentName.toUpperCase()}: ` +
|
||||
`Option "${property}" provided type "${valueType}" ` +
|
||||
`but expected type "${expectedTypes}".`
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var getjQuery = function getjQuery() {
|
||||
var _window = window,
|
||||
jQuery = _window.jQuery;
|
||||
const getjQuery = () => {
|
||||
const { jQuery } = window;
|
||||
|
||||
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||
return jQuery;
|
||||
|
@ -192,7 +134,7 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||
const onDOMContentLoaded = (callback) => {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
} else {
|
||||
|
@ -200,19 +142,17 @@
|
|||
}
|
||||
};
|
||||
|
||||
document.documentElement.dir === 'rtl';
|
||||
|
||||
var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
|
||||
onDOMContentLoaded(function () {
|
||||
var $ = getjQuery();
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
var JQUERY_NO_CONFLICT = $.fn[name];
|
||||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||||
$.fn[name] = plugin.jQueryInterface;
|
||||
$.fn[name].Constructor = plugin;
|
||||
|
||||
$.fn[name].noConflict = function () {
|
||||
$.fn[name].noConflict = () => {
|
||||
$.fn[name] = JQUERY_NO_CONFLICT;
|
||||
return plugin.jQueryInterface;
|
||||
};
|
||||
|
@ -220,105 +160,94 @@
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): scrollspy.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var NAME = 'scrollspy';
|
||||
var DATA_KEY = 'bs.scrollspy';
|
||||
var EVENT_KEY = '.' + DATA_KEY;
|
||||
var DATA_API_KEY = '.data-api';
|
||||
var Default = {
|
||||
const NAME = 'scrollspy';
|
||||
const DATA_KEY = 'bs.scrollspy';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const DATA_API_KEY = '.data-api';
|
||||
const Default = {
|
||||
offset: 10,
|
||||
method: 'auto',
|
||||
target: '',
|
||||
};
|
||||
var DefaultType = {
|
||||
const DefaultType = {
|
||||
offset: 'number',
|
||||
method: 'string',
|
||||
target: '(string|element)',
|
||||
};
|
||||
var EVENT_ACTIVATE = 'activate' + EVENT_KEY;
|
||||
var EVENT_SCROLL = 'scroll' + EVENT_KEY;
|
||||
var EVENT_LOAD_DATA_API = 'load' + EVENT_KEY + DATA_API_KEY;
|
||||
var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
|
||||
var CLASS_NAME_ACTIVE = 'active';
|
||||
var SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
|
||||
var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
||||
var SELECTOR_NAV_LINKS = '.nav-link';
|
||||
var SELECTOR_NAV_ITEMS = '.nav-item';
|
||||
var SELECTOR_LIST_ITEMS = '.list-group-item';
|
||||
var SELECTOR_DROPDOWN = '.dropdown';
|
||||
var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
||||
var METHOD_OFFSET = 'offset';
|
||||
var METHOD_POSITION = 'position';
|
||||
const EVENT_ACTIVATE = `activate${EVENT_KEY}`;
|
||||
const EVENT_SCROLL = `scroll${EVENT_KEY}`;
|
||||
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
|
||||
const CLASS_NAME_ACTIVE = 'active';
|
||||
const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
|
||||
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
||||
const SELECTOR_NAV_LINKS = '.nav-link';
|
||||
const SELECTOR_NAV_ITEMS = '.nav-item';
|
||||
const SELECTOR_LIST_ITEMS = '.list-group-item';
|
||||
const SELECTOR_DROPDOWN = '.dropdown';
|
||||
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
||||
const METHOD_OFFSET = 'offset';
|
||||
const METHOD_POSITION = 'position';
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var ScrollSpy = /*#__PURE__*/ (function (_BaseComponent) {
|
||||
_inheritsLoose(ScrollSpy, _BaseComponent);
|
||||
class ScrollSpy extends BaseComponent__default['default'] {
|
||||
constructor(element, config) {
|
||||
super(element);
|
||||
this._scrollElement = this._element.tagName === 'BODY' ? window : this._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._offsets = [];
|
||||
this._targets = [];
|
||||
this._activeTarget = null;
|
||||
this._scrollHeight = 0;
|
||||
EventHandler__default['default'].on(this._scrollElement, EVENT_SCROLL, () => this._process());
|
||||
this.refresh();
|
||||
|
||||
function ScrollSpy(element, config) {
|
||||
var _this;
|
||||
|
||||
_this = _BaseComponent.call(this, element) || this;
|
||||
_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._offsets = [];
|
||||
_this._targets = [];
|
||||
_this._activeTarget = null;
|
||||
_this._scrollHeight = 0;
|
||||
EventHandler__default['default'].on(_this._scrollElement, EVENT_SCROLL, function () {
|
||||
return _this._process();
|
||||
});
|
||||
|
||||
_this.refresh();
|
||||
|
||||
_this._process();
|
||||
|
||||
return _this;
|
||||
this._process();
|
||||
} // Getters
|
||||
|
||||
var _proto = ScrollSpy.prototype;
|
||||
static get Default() {
|
||||
return Default;
|
||||
}
|
||||
|
||||
// Public
|
||||
_proto.refresh = function refresh() {
|
||||
var _this2 = this;
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
} // Public
|
||||
|
||||
var autoMethod =
|
||||
refresh() {
|
||||
const autoMethod =
|
||||
this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
|
||||
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
|
||||
var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
|
||||
const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
|
||||
const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
|
||||
this._offsets = [];
|
||||
this._targets = [];
|
||||
this._scrollHeight = this._getScrollHeight();
|
||||
var targets = SelectorEngine__default['default'].find(this._selector);
|
||||
const targets = SelectorEngine__default['default'].find(this._selector);
|
||||
targets
|
||||
.map(function (element) {
|
||||
var targetSelector = getSelectorFromElement(element);
|
||||
var target = targetSelector
|
||||
.map((element) => {
|
||||
const targetSelector = getSelectorFromElement(element);
|
||||
const target = targetSelector
|
||||
? SelectorEngine__default['default'].findOne(targetSelector)
|
||||
: null;
|
||||
|
||||
if (target) {
|
||||
var targetBCR = target.getBoundingClientRect();
|
||||
const targetBCR = target.getBoundingClientRect();
|
||||
|
||||
if (targetBCR.width || targetBCR.height) {
|
||||
return [
|
||||
|
@ -330,22 +259,17 @@
|
|||
|
||||
return null;
|
||||
})
|
||||
.filter(function (item) {
|
||||
return item;
|
||||
})
|
||||
.sort(function (a, b) {
|
||||
return a[0] - b[0];
|
||||
})
|
||||
.forEach(function (item) {
|
||||
_this2._offsets.push(item[0]);
|
||||
.filter((item) => item)
|
||||
.sort((a, b) => a[0] - b[0])
|
||||
.forEach((item) => {
|
||||
this._offsets.push(item[0]);
|
||||
|
||||
_this2._targets.push(item[1]);
|
||||
this._targets.push(item[1]);
|
||||
});
|
||||
};
|
||||
|
||||
_proto.dispose = function dispose() {
|
||||
_BaseComponent.prototype.dispose.call(this);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
super.dispose();
|
||||
EventHandler__default['default'].off(this._scrollElement, EVENT_KEY);
|
||||
this._scrollElement = null;
|
||||
this._config = null;
|
||||
|
@ -354,58 +278,58 @@
|
|||
this._targets = null;
|
||||
this._activeTarget = null;
|
||||
this._scrollHeight = null;
|
||||
}; // Private
|
||||
} // Private
|
||||
|
||||
_proto._getConfig = function _getConfig(config) {
|
||||
config = _extends({}, Default, typeof config === 'object' && config ? config : {});
|
||||
_getConfig(config) {
|
||||
config = { ...Default, ...(typeof config === 'object' && config ? config : {}) };
|
||||
|
||||
if (typeof config.target !== 'string' && isElement(config.target)) {
|
||||
var id = config.target.id;
|
||||
let { id } = config.target;
|
||||
|
||||
if (!id) {
|
||||
id = getUID(NAME);
|
||||
config.target.id = id;
|
||||
}
|
||||
|
||||
config.target = '#' + id;
|
||||
config.target = `#${id}`;
|
||||
}
|
||||
|
||||
typeCheckConfig(NAME, config, DefaultType);
|
||||
return config;
|
||||
};
|
||||
}
|
||||
|
||||
_proto._getScrollTop = function _getScrollTop() {
|
||||
_getScrollTop() {
|
||||
return this._scrollElement === window
|
||||
? this._scrollElement.pageYOffset
|
||||
: this._scrollElement.scrollTop;
|
||||
};
|
||||
}
|
||||
|
||||
_proto._getScrollHeight = function _getScrollHeight() {
|
||||
_getScrollHeight() {
|
||||
return (
|
||||
this._scrollElement.scrollHeight ||
|
||||
Math.max(document.body.scrollHeight, document.documentElement.scrollHeight)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
_proto._getOffsetHeight = function _getOffsetHeight() {
|
||||
_getOffsetHeight() {
|
||||
return this._scrollElement === window
|
||||
? window.innerHeight
|
||||
: this._scrollElement.getBoundingClientRect().height;
|
||||
};
|
||||
}
|
||||
|
||||
_proto._process = function _process() {
|
||||
var scrollTop = this._getScrollTop() + this._config.offset;
|
||||
_process() {
|
||||
const scrollTop = this._getScrollTop() + this._config.offset;
|
||||
|
||||
var scrollHeight = this._getScrollHeight();
|
||||
const scrollHeight = this._getScrollHeight();
|
||||
|
||||
var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
|
||||
const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
|
||||
|
||||
if (this._scrollHeight !== scrollHeight) {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
if (scrollTop >= maxScroll) {
|
||||
var target = this._targets[this._targets.length - 1];
|
||||
const target = this._targets[this._targets.length - 1];
|
||||
|
||||
if (this._activeTarget !== target) {
|
||||
this._activate(target);
|
||||
|
@ -422,8 +346,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
for (var i = this._offsets.length; i--; ) {
|
||||
var isActiveTarget =
|
||||
for (let i = this._offsets.length; i--; ) {
|
||||
const isActiveTarget =
|
||||
this._activeTarget !== this._targets[i] &&
|
||||
scrollTop >= this._offsets[i] &&
|
||||
(typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
|
||||
|
@ -432,20 +356,18 @@
|
|||
this._activate(this._targets[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
_proto._activate = function _activate(target) {
|
||||
_activate(target) {
|
||||
this._activeTarget = target;
|
||||
|
||||
this._clear();
|
||||
|
||||
var queries = this._selector.split(',').map(function (selector) {
|
||||
return (
|
||||
selector + '[data-bs-target="' + target + '"],' + selector + '[href="' + target + '"]'
|
||||
);
|
||||
});
|
||||
const queries = this._selector
|
||||
.split(',')
|
||||
.map((selector) => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
|
||||
|
||||
var link = SelectorEngine__default['default'].findOne(queries.join(','));
|
||||
const link = SelectorEngine__default['default'].findOne(queries.join(','));
|
||||
|
||||
if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
|
||||
SelectorEngine__default['default']
|
||||
|
@ -457,23 +379,19 @@
|
|||
link.classList.add(CLASS_NAME_ACTIVE);
|
||||
SelectorEngine__default['default']
|
||||
.parents(link, SELECTOR_NAV_LIST_GROUP)
|
||||
.forEach(function (listGroup) {
|
||||
.forEach((listGroup) => {
|
||||
// Set triggered links parents as active
|
||||
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
||||
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
|
||||
.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`)
|
||||
.forEach((item) => item.classList.add(CLASS_NAME_ACTIVE)); // Handle special case when .nav-link is inside .nav-item
|
||||
|
||||
SelectorEngine__default['default']
|
||||
.prev(listGroup, SELECTOR_NAV_ITEMS)
|
||||
.forEach(function (navItem) {
|
||||
.forEach((navItem) => {
|
||||
SelectorEngine__default['default']
|
||||
.children(navItem, SELECTOR_NAV_LINKS)
|
||||
.forEach(function (item) {
|
||||
return item.classList.add(CLASS_NAME_ACTIVE);
|
||||
});
|
||||
.forEach((item) => item.classList.add(CLASS_NAME_ACTIVE));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -481,24 +399,20 @@
|
|||
EventHandler__default['default'].trigger(this._scrollElement, EVENT_ACTIVATE, {
|
||||
relatedTarget: target,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
_proto._clear = function _clear() {
|
||||
_clear() {
|
||||
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);
|
||||
});
|
||||
}; // Static
|
||||
.filter((node) => node.classList.contains(CLASS_NAME_ACTIVE))
|
||||
.forEach((node) => node.classList.remove(CLASS_NAME_ACTIVE));
|
||||
} // Static
|
||||
|
||||
ScrollSpy.jQueryInterface = function jQueryInterface(config) {
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
var data = Data__default['default'].getData(this, DATA_KEY);
|
||||
let data = Data__default['default'].get(this, DATA_KEY);
|
||||
|
||||
var _config = typeof config === 'object' && config;
|
||||
const _config = typeof config === 'object' && config;
|
||||
|
||||
if (!data) {
|
||||
data = new ScrollSpy(this, _config);
|
||||
|
@ -506,41 +420,24 @@
|
|||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
throw new TypeError('No method named "' + config + '"');
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config]();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_createClass(ScrollSpy, null, [
|
||||
{
|
||||
key: 'Default',
|
||||
get: function get() {
|
||||
return Default;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'DATA_KEY',
|
||||
get: function get() {
|
||||
return DATA_KEY;
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
return ScrollSpy;
|
||||
})(BaseComponent__default['default']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Data Api implementation
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
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));
|
||||
});
|
||||
EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => {
|
||||
SelectorEngine__default['default']
|
||||
.find(SELECTOR_DATA_SPY)
|
||||
.forEach((spy) => new ScrollSpy(spy, Manipulator__default['default'].getDataAttributes(spy)));
|
||||
});
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
|
|
2
src/js/bootstrap/dist/scrollspy.js.map
vendored
2
src/js/bootstrap/dist/scrollspy.js.map
vendored
File diff suppressed because one or more lines are too long
253
src/js/bootstrap/dist/tab.js
vendored
253
src/js/bootstrap/dist/tab.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap tab.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap tab.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -32,54 +32,20 @@
|
|||
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
|
||||
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
function _inheritsLoose(subClass, superClass) {
|
||||
subClass.prototype = Object.create(superClass.prototype);
|
||||
subClass.prototype.constructor = subClass;
|
||||
|
||||
_setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf =
|
||||
Object.setPrototypeOf ||
|
||||
function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/index.js
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
var MILLISECONDS_MULTIPLIER = 1000;
|
||||
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
const MILLISECONDS_MULTIPLIER = 1000;
|
||||
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
|
||||
var getSelector = function getSelector(element) {
|
||||
var selector = element.getAttribute('data-bs-target');
|
||||
const getSelector = (element) => {
|
||||
let selector = element.getAttribute('data-bs-target');
|
||||
|
||||
if (!selector || selector === '#') {
|
||||
var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
||||
// `document.querySelector` will rightfully complain it is invalid.
|
||||
// See https://github.com/twbs/bootstrap/issues/32273
|
||||
|
@ -98,22 +64,19 @@
|
|||
return selector;
|
||||
};
|
||||
|
||||
var getElementFromSelector = function getElementFromSelector(element) {
|
||||
var selector = getSelector(element);
|
||||
const getElementFromSelector = (element) => {
|
||||
const selector = getSelector(element);
|
||||
return selector ? document.querySelector(selector) : null;
|
||||
};
|
||||
|
||||
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
||||
const getTransitionDurationFromElement = (element) => {
|
||||
if (!element) {
|
||||
return 0;
|
||||
} // Get transition-duration of the element
|
||||
|
||||
var _window$getComputedSt = window.getComputedStyle(element),
|
||||
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||
|
||||
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||
var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
||||
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||
|
||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||
return 0;
|
||||
|
@ -127,14 +90,14 @@
|
|||
);
|
||||
};
|
||||
|
||||
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||
const triggerTransitionEnd = (element) => {
|
||||
element.dispatchEvent(new Event(TRANSITION_END));
|
||||
};
|
||||
|
||||
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
||||
var called = false;
|
||||
var durationPadding = 5;
|
||||
var emulatedDuration = duration + durationPadding;
|
||||
const emulateTransitionEnd = (element, duration) => {
|
||||
let called = false;
|
||||
const durationPadding = 5;
|
||||
const emulatedDuration = duration + durationPadding;
|
||||
|
||||
function listener() {
|
||||
called = true;
|
||||
|
@ -142,20 +105,33 @@
|
|||
}
|
||||
|
||||
element.addEventListener(TRANSITION_END, listener);
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
if (!called) {
|
||||
triggerTransitionEnd(element);
|
||||
}
|
||||
}, emulatedDuration);
|
||||
};
|
||||
|
||||
var reflow = function reflow(element) {
|
||||
return element.offsetHeight;
|
||||
const isDisabled = (element) => {
|
||||
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (element.classList.contains('disabled')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof element.disabled !== 'undefined') {
|
||||
return element.disabled;
|
||||
}
|
||||
|
||||
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
||||
};
|
||||
|
||||
var getjQuery = function getjQuery() {
|
||||
var _window = window,
|
||||
jQuery = _window.jQuery;
|
||||
const reflow = (element) => element.offsetHeight;
|
||||
|
||||
const getjQuery = () => {
|
||||
const { jQuery } = window;
|
||||
|
||||
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||
return jQuery;
|
||||
|
@ -164,7 +140,7 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||
const onDOMContentLoaded = (callback) => {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
} else {
|
||||
|
@ -172,19 +148,17 @@
|
|||
}
|
||||
};
|
||||
|
||||
document.documentElement.dir === 'rtl';
|
||||
|
||||
var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
|
||||
onDOMContentLoaded(function () {
|
||||
var $ = getjQuery();
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
var JQUERY_NO_CONFLICT = $.fn[name];
|
||||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||||
$.fn[name] = plugin.jQueryInterface;
|
||||
$.fn[name].Constructor = plugin;
|
||||
|
||||
$.fn[name].noConflict = function () {
|
||||
$.fn[name].noConflict = () => {
|
||||
$.fn[name] = JQUERY_NO_CONFLICT;
|
||||
return plugin.jQueryInterface;
|
||||
};
|
||||
|
@ -192,69 +166,68 @@
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): tab.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var NAME = 'tab';
|
||||
var DATA_KEY = 'bs.tab';
|
||||
var EVENT_KEY = '.' + DATA_KEY;
|
||||
var DATA_API_KEY = '.data-api';
|
||||
var EVENT_HIDE = 'hide' + EVENT_KEY;
|
||||
var EVENT_HIDDEN = 'hidden' + EVENT_KEY;
|
||||
var EVENT_SHOW = 'show' + EVENT_KEY;
|
||||
var EVENT_SHOWN = 'shown' + EVENT_KEY;
|
||||
var EVENT_CLICK_DATA_API = 'click' + EVENT_KEY + DATA_API_KEY;
|
||||
var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
|
||||
var CLASS_NAME_ACTIVE = 'active';
|
||||
var CLASS_NAME_DISABLED = 'disabled';
|
||||
var CLASS_NAME_FADE = 'fade';
|
||||
var CLASS_NAME_SHOW = 'show';
|
||||
var SELECTOR_DROPDOWN = '.dropdown';
|
||||
var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
||||
var SELECTOR_ACTIVE = '.active';
|
||||
var SELECTOR_ACTIVE_UL = ':scope > li > .active';
|
||||
var SELECTOR_DATA_TOGGLE =
|
||||
const NAME = 'tab';
|
||||
const DATA_KEY = 'bs.tab';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const DATA_API_KEY = '.data-api';
|
||||
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
|
||||
const CLASS_NAME_ACTIVE = 'active';
|
||||
const CLASS_NAME_FADE = 'fade';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
const SELECTOR_DROPDOWN = '.dropdown';
|
||||
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
||||
const SELECTOR_ACTIVE = '.active';
|
||||
const SELECTOR_ACTIVE_UL = ':scope > li > .active';
|
||||
const SELECTOR_DATA_TOGGLE =
|
||||
'[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
|
||||
var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
||||
var SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
|
||||
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
||||
const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var Tab = /*#__PURE__*/ (function (_BaseComponent) {
|
||||
_inheritsLoose(Tab, _BaseComponent);
|
||||
|
||||
function Tab() {
|
||||
return _BaseComponent.apply(this, arguments) || this;
|
||||
}
|
||||
|
||||
var _proto = Tab.prototype;
|
||||
|
||||
// Public
|
||||
_proto.show = function show() {
|
||||
var _this = this;
|
||||
class Tab extends BaseComponent__default['default'] {
|
||||
// Getters
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
} // Public
|
||||
|
||||
show() {
|
||||
if (
|
||||
(this._element.parentNode &&
|
||||
this._element.parentNode.nodeType === Node.ELEMENT_NODE &&
|
||||
this._element.classList.contains(CLASS_NAME_ACTIVE)) ||
|
||||
this._element.classList.contains(CLASS_NAME_DISABLED)
|
||||
isDisabled(this._element)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
var previous;
|
||||
var target = getElementFromSelector(this._element);
|
||||
let previous;
|
||||
const target = getElementFromSelector(this._element);
|
||||
|
||||
var listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
|
||||
const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
|
||||
|
||||
if (listElement) {
|
||||
var itemSelector =
|
||||
const itemSelector =
|
||||
listElement.nodeName === 'UL' || listElement.nodeName === 'OL'
|
||||
? SELECTOR_ACTIVE_UL
|
||||
: SELECTOR_ACTIVE;
|
||||
|
@ -262,12 +235,12 @@
|
|||
previous = previous[previous.length - 1];
|
||||
}
|
||||
|
||||
var hideEvent = previous
|
||||
const hideEvent = previous
|
||||
? EventHandler__default['default'].trigger(previous, EVENT_HIDE, {
|
||||
relatedTarget: this._element,
|
||||
})
|
||||
: null;
|
||||
var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, {
|
||||
const showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, {
|
||||
relatedTarget: previous,
|
||||
});
|
||||
|
||||
|
@ -277,11 +250,11 @@
|
|||
|
||||
this._activate(this._element, listElement);
|
||||
|
||||
var complete = function complete() {
|
||||
const complete = () => {
|
||||
EventHandler__default['default'].trigger(previous, EVENT_HIDDEN, {
|
||||
relatedTarget: _this._element,
|
||||
relatedTarget: this._element,
|
||||
});
|
||||
EventHandler__default['default'].trigger(_this._element, EVENT_SHOWN, {
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN, {
|
||||
relatedTarget: previous,
|
||||
});
|
||||
};
|
||||
|
@ -291,36 +264,32 @@
|
|||
} else {
|
||||
complete();
|
||||
}
|
||||
}; // Private
|
||||
} // Private
|
||||
|
||||
_proto._activate = function _activate(element, container, callback) {
|
||||
var _this2 = this;
|
||||
|
||||
var activeElements =
|
||||
_activate(element, container, callback) {
|
||||
const 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);
|
||||
const active = activeElements[0];
|
||||
const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE);
|
||||
|
||||
var complete = function complete() {
|
||||
return _this2._transitionComplete(element, active, callback);
|
||||
};
|
||||
const complete = () => this._transitionComplete(element, active, callback);
|
||||
|
||||
if (active && isTransitioning) {
|
||||
var transitionDuration = getTransitionDurationFromElement(active);
|
||||
const transitionDuration = getTransitionDurationFromElement(active);
|
||||
active.classList.remove(CLASS_NAME_SHOW);
|
||||
EventHandler__default['default'].one(active, 'transitionend', complete);
|
||||
emulateTransitionEnd(active, transitionDuration);
|
||||
} else {
|
||||
complete();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
_proto._transitionComplete = function _transitionComplete(element, active, callback) {
|
||||
_transitionComplete(element, active, callback) {
|
||||
if (active) {
|
||||
active.classList.remove(CLASS_NAME_ACTIVE);
|
||||
var dropdownChild = SelectorEngine__default['default'].findOne(
|
||||
const dropdownChild = SelectorEngine__default['default'].findOne(
|
||||
SELECTOR_DROPDOWN_ACTIVE_CHILD,
|
||||
active.parentNode
|
||||
);
|
||||
|
@ -347,14 +316,12 @@
|
|||
}
|
||||
|
||||
if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
|
||||
var dropdownElement = element.closest(SELECTOR_DROPDOWN);
|
||||
const dropdownElement = element.closest(SELECTOR_DROPDOWN);
|
||||
|
||||
if (dropdownElement) {
|
||||
SelectorEngine__default['default']
|
||||
.find(SELECTOR_DROPDOWN_TOGGLE)
|
||||
.forEach(function (dropdown) {
|
||||
return dropdown.classList.add(CLASS_NAME_ACTIVE);
|
||||
});
|
||||
.forEach((dropdown) => dropdown.classList.add(CLASS_NAME_ACTIVE));
|
||||
}
|
||||
|
||||
element.setAttribute('aria-expanded', true);
|
||||
|
@ -363,34 +330,22 @@
|
|||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}; // Static
|
||||
} // Static
|
||||
|
||||
Tab.jQueryInterface = function jQueryInterface(config) {
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
var data = Data__default['default'].getData(this, DATA_KEY) || new Tab(this);
|
||||
const data = Data__default['default'].get(this, DATA_KEY) || new Tab(this);
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
throw new TypeError('No method named "' + config + '"');
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config]();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_createClass(Tab, null, [
|
||||
{
|
||||
key: 'DATA_KEY',
|
||||
// Getters
|
||||
get: function get() {
|
||||
return DATA_KEY;
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
return Tab;
|
||||
})(BaseComponent__default['default']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Data Api implementation
|
||||
|
@ -403,7 +358,7 @@
|
|||
SELECTOR_DATA_TOGGLE,
|
||||
function (event) {
|
||||
event.preventDefault();
|
||||
var data = Data__default['default'].getData(this, DATA_KEY) || new Tab(this);
|
||||
const data = Data__default['default'].get(this, DATA_KEY) || new Tab(this);
|
||||
data.show();
|
||||
}
|
||||
);
|
||||
|
|
2
src/js/bootstrap/dist/tab.js.map
vendored
2
src/js/bootstrap/dist/tab.js.map
vendored
File diff suppressed because one or more lines are too long
312
src/js/bootstrap/dist/toast.js
vendored
312
src/js/bootstrap/dist/toast.js
vendored
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Bootstrap toast.js v5.0.0-beta2 (https://getbootstrap.com/)
|
||||
* Bootstrap toast.js v5.0.0-beta3 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
*/
|
||||
|
@ -32,72 +32,18 @@
|
|||
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
|
||||
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
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 _inheritsLoose(subClass, superClass) {
|
||||
subClass.prototype = Object.create(superClass.prototype);
|
||||
subClass.prototype.constructor = subClass;
|
||||
|
||||
_setPrototypeOf(subClass, superClass);
|
||||
}
|
||||
|
||||
function _setPrototypeOf(o, p) {
|
||||
_setPrototypeOf =
|
||||
Object.setPrototypeOf ||
|
||||
function _setPrototypeOf(o, p) {
|
||||
o.__proto__ = p;
|
||||
return o;
|
||||
};
|
||||
|
||||
return _setPrototypeOf(o, p);
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/index.js
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
var MILLISECONDS_MULTIPLIER = 1000;
|
||||
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
const MILLISECONDS_MULTIPLIER = 1000;
|
||||
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
|
||||
var toType = function toType(obj) {
|
||||
const toType = (obj) => {
|
||||
if (obj === null || obj === undefined) {
|
||||
return '' + obj;
|
||||
return `${obj}`;
|
||||
}
|
||||
|
||||
return {}.toString
|
||||
|
@ -106,17 +52,14 @@
|
|||
.toLowerCase();
|
||||
};
|
||||
|
||||
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
||||
const getTransitionDurationFromElement = (element) => {
|
||||
if (!element) {
|
||||
return 0;
|
||||
} // Get transition-duration of the element
|
||||
|
||||
var _window$getComputedSt = window.getComputedStyle(element),
|
||||
transitionDuration = _window$getComputedSt.transitionDuration,
|
||||
transitionDelay = _window$getComputedSt.transitionDelay;
|
||||
|
||||
var floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||
var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
||||
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||||
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
||||
|
||||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||||
return 0;
|
||||
|
@ -130,18 +73,16 @@
|
|||
);
|
||||
};
|
||||
|
||||
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
||||
const triggerTransitionEnd = (element) => {
|
||||
element.dispatchEvent(new Event(TRANSITION_END));
|
||||
};
|
||||
|
||||
var isElement = function isElement(obj) {
|
||||
return (obj[0] || obj).nodeType;
|
||||
};
|
||||
const isElement = (obj) => (obj[0] || obj).nodeType;
|
||||
|
||||
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
||||
var called = false;
|
||||
var durationPadding = 5;
|
||||
var emulatedDuration = duration + durationPadding;
|
||||
const emulateTransitionEnd = (element, duration) => {
|
||||
let called = false;
|
||||
const durationPadding = 5;
|
||||
const emulatedDuration = duration + durationPadding;
|
||||
|
||||
function listener() {
|
||||
called = true;
|
||||
|
@ -149,37 +90,33 @@
|
|||
}
|
||||
|
||||
element.addEventListener(TRANSITION_END, listener);
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
if (!called) {
|
||||
triggerTransitionEnd(element);
|
||||
}
|
||||
}, emulatedDuration);
|
||||
};
|
||||
|
||||
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
||||
Object.keys(configTypes).forEach(function (property) {
|
||||
var expectedTypes = configTypes[property];
|
||||
var value = config[property];
|
||||
var valueType = value && isElement(value) ? 'element' : toType(value);
|
||||
const typeCheckConfig = (componentName, config, configTypes) => {
|
||||
Object.keys(configTypes).forEach((property) => {
|
||||
const expectedTypes = configTypes[property];
|
||||
const value = config[property];
|
||||
const valueType = value && isElement(value) ? 'element' : toType(value);
|
||||
|
||||
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||
throw new TypeError(
|
||||
componentName.toUpperCase() +
|
||||
': ' +
|
||||
('Option "' + property + '" provided type "' + valueType + '" ') +
|
||||
('but expected type "' + expectedTypes + '".')
|
||||
`${componentName.toUpperCase()}: ` +
|
||||
`Option "${property}" provided type "${valueType}" ` +
|
||||
`but expected type "${expectedTypes}".`
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var reflow = function reflow(element) {
|
||||
return element.offsetHeight;
|
||||
};
|
||||
const reflow = (element) => element.offsetHeight;
|
||||
|
||||
var getjQuery = function getjQuery() {
|
||||
var _window = window,
|
||||
jQuery = _window.jQuery;
|
||||
const getjQuery = () => {
|
||||
const { jQuery } = window;
|
||||
|
||||
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
||||
return jQuery;
|
||||
|
@ -188,7 +125,7 @@
|
|||
return null;
|
||||
};
|
||||
|
||||
var onDOMContentLoaded = function onDOMContentLoaded(callback) {
|
||||
const onDOMContentLoaded = (callback) => {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
} else {
|
||||
|
@ -196,19 +133,17 @@
|
|||
}
|
||||
};
|
||||
|
||||
document.documentElement.dir === 'rtl';
|
||||
|
||||
var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
|
||||
onDOMContentLoaded(function () {
|
||||
var $ = getjQuery();
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
onDOMContentLoaded(() => {
|
||||
const $ = getjQuery();
|
||||
/* istanbul ignore if */
|
||||
|
||||
if ($) {
|
||||
var JQUERY_NO_CONFLICT = $.fn[name];
|
||||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||||
$.fn[name] = plugin.jQueryInterface;
|
||||
$.fn[name].Constructor = plugin;
|
||||
|
||||
$.fn[name].noConflict = function () {
|
||||
$.fn[name].noConflict = () => {
|
||||
$.fn[name] = JQUERY_NO_CONFLICT;
|
||||
return plugin.jQueryInterface;
|
||||
};
|
||||
|
@ -216,63 +151,70 @@
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): toast.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var NAME = 'toast';
|
||||
var DATA_KEY = 'bs.toast';
|
||||
var EVENT_KEY = '.' + DATA_KEY;
|
||||
var EVENT_CLICK_DISMISS = 'click.dismiss' + EVENT_KEY;
|
||||
var EVENT_HIDE = 'hide' + EVENT_KEY;
|
||||
var EVENT_HIDDEN = 'hidden' + EVENT_KEY;
|
||||
var EVENT_SHOW = 'show' + EVENT_KEY;
|
||||
var EVENT_SHOWN = 'shown' + EVENT_KEY;
|
||||
var CLASS_NAME_FADE = 'fade';
|
||||
var CLASS_NAME_HIDE = 'hide';
|
||||
var CLASS_NAME_SHOW = 'show';
|
||||
var CLASS_NAME_SHOWING = 'showing';
|
||||
var DefaultType = {
|
||||
const NAME = 'toast';
|
||||
const DATA_KEY = 'bs.toast';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
||||
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
const CLASS_NAME_FADE = 'fade';
|
||||
const CLASS_NAME_HIDE = 'hide';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
const CLASS_NAME_SHOWING = 'showing';
|
||||
const DefaultType = {
|
||||
animation: 'boolean',
|
||||
autohide: 'boolean',
|
||||
delay: 'number',
|
||||
};
|
||||
var Default = {
|
||||
const Default = {
|
||||
animation: true,
|
||||
autohide: true,
|
||||
delay: 5000,
|
||||
};
|
||||
var SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
|
||||
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
var Toast = /*#__PURE__*/ (function (_BaseComponent) {
|
||||
_inheritsLoose(Toast, _BaseComponent);
|
||||
class Toast extends BaseComponent__default['default'] {
|
||||
constructor(element, config) {
|
||||
super(element);
|
||||
this._config = this._getConfig(config);
|
||||
this._timeout = null;
|
||||
|
||||
function Toast(element, config) {
|
||||
var _this;
|
||||
|
||||
_this = _BaseComponent.call(this, element) || this;
|
||||
_this._config = _this._getConfig(config);
|
||||
_this._timeout = null;
|
||||
|
||||
_this._setListeners();
|
||||
|
||||
return _this;
|
||||
this._setListeners();
|
||||
} // Getters
|
||||
|
||||
var _proto = Toast.prototype;
|
||||
static get DefaultType() {
|
||||
return DefaultType;
|
||||
}
|
||||
|
||||
// Public
|
||||
_proto.show = function show() {
|
||||
var _this2 = this;
|
||||
static get Default() {
|
||||
return Default;
|
||||
}
|
||||
|
||||
var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
} // Public
|
||||
|
||||
show() {
|
||||
const showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
|
||||
|
||||
if (showEvent.defaultPrevented) {
|
||||
return;
|
||||
|
@ -284,17 +226,17 @@
|
|||
this._element.classList.add(CLASS_NAME_FADE);
|
||||
}
|
||||
|
||||
var complete = function complete() {
|
||||
_this2._element.classList.remove(CLASS_NAME_SHOWING);
|
||||
const complete = () => {
|
||||
this._element.classList.remove(CLASS_NAME_SHOWING);
|
||||
|
||||
_this2._element.classList.add(CLASS_NAME_SHOW);
|
||||
this._element.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
EventHandler__default['default'].trigger(_this2._element, EVENT_SHOWN);
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN);
|
||||
|
||||
if (_this2._config.autohide) {
|
||||
_this2._timeout = setTimeout(function () {
|
||||
_this2.hide();
|
||||
}, _this2._config.delay);
|
||||
if (this._config.autohide) {
|
||||
this._timeout = setTimeout(() => {
|
||||
this.hide();
|
||||
}, this._config.delay);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -305,45 +247,43 @@
|
|||
this._element.classList.add(CLASS_NAME_SHOWING);
|
||||
|
||||
if (this._config.animation) {
|
||||
var transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
EventHandler__default['default'].one(this._element, 'transitionend', complete);
|
||||
emulateTransitionEnd(this._element, transitionDuration);
|
||||
} else {
|
||||
complete();
|
||||
}
|
||||
};
|
||||
|
||||
_proto.hide = function hide() {
|
||||
var _this3 = this;
|
||||
}
|
||||
|
||||
hide() {
|
||||
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
|
||||
const hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
|
||||
|
||||
if (hideEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
var complete = function complete() {
|
||||
_this3._element.classList.add(CLASS_NAME_HIDE);
|
||||
const complete = () => {
|
||||
this._element.classList.add(CLASS_NAME_HIDE);
|
||||
|
||||
EventHandler__default['default'].trigger(_this3._element, EVENT_HIDDEN);
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
|
||||
};
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||
|
||||
if (this._config.animation) {
|
||||
var transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
EventHandler__default['default'].one(this._element, 'transitionend', complete);
|
||||
emulateTransitionEnd(this._element, transitionDuration);
|
||||
} else {
|
||||
complete();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
_proto.dispose = function dispose() {
|
||||
dispose() {
|
||||
this._clearTimeout();
|
||||
|
||||
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||
|
@ -351,46 +291,39 @@
|
|||
}
|
||||
|
||||
EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS);
|
||||
|
||||
_BaseComponent.prototype.dispose.call(this);
|
||||
|
||||
super.dispose();
|
||||
this._config = null;
|
||||
}; // Private
|
||||
} // Private
|
||||
|
||||
_proto._getConfig = function _getConfig(config) {
|
||||
config = _extends(
|
||||
{},
|
||||
Default,
|
||||
Manipulator__default['default'].getDataAttributes(this._element),
|
||||
typeof config === 'object' && config ? config : {}
|
||||
);
|
||||
_getConfig(config) {
|
||||
config = {
|
||||
...Default,
|
||||
...Manipulator__default['default'].getDataAttributes(this._element),
|
||||
...(typeof config === 'object' && config ? config : {}),
|
||||
};
|
||||
typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
||||
return config;
|
||||
};
|
||||
|
||||
_proto._setListeners = function _setListeners() {
|
||||
var _this4 = this;
|
||||
}
|
||||
|
||||
_setListeners() {
|
||||
EventHandler__default['default'].on(
|
||||
this._element,
|
||||
EVENT_CLICK_DISMISS,
|
||||
SELECTOR_DATA_DISMISS,
|
||||
function () {
|
||||
return _this4.hide();
|
||||
}
|
||||
() => this.hide()
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
_proto._clearTimeout = function _clearTimeout() {
|
||||
_clearTimeout() {
|
||||
clearTimeout(this._timeout);
|
||||
this._timeout = null;
|
||||
}; // Static
|
||||
} // Static
|
||||
|
||||
Toast.jQueryInterface = function jQueryInterface(config) {
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
var data = Data__default['default'].getData(this, DATA_KEY);
|
||||
let data = Data__default['default'].get(this, DATA_KEY);
|
||||
|
||||
var _config = typeof config === 'object' && config;
|
||||
const _config = typeof config === 'object' && config;
|
||||
|
||||
if (!data) {
|
||||
data = new Toast(this, _config);
|
||||
|
@ -398,37 +331,14 @@
|
|||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
throw new TypeError('No method named "' + config + '"');
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config](this);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_createClass(Toast, null, [
|
||||
{
|
||||
key: 'DefaultType',
|
||||
get: function get() {
|
||||
return DefaultType;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'Default',
|
||||
get: function get() {
|
||||
return Default;
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'DATA_KEY',
|
||||
get: function get() {
|
||||
return DATA_KEY;
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
return Toast;
|
||||
})(BaseComponent__default['default']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* jQuery
|
||||
|
|
2
src/js/bootstrap/dist/toast.js.map
vendored
2
src/js/bootstrap/dist/toast.js.map
vendored
File diff suppressed because one or more lines are too long
742
src/js/bootstrap/dist/tooltip.js
vendored
742
src/js/bootstrap/dist/tooltip.js
vendored
File diff suppressed because it is too large
Load Diff
2
src/js/bootstrap/dist/tooltip.js.map
vendored
2
src/js/bootstrap/dist/tooltip.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): alert.js
|
||||
* Bootstrap (v5.0.0-beta3): alert.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -98,7 +98,7 @@ class Alert extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
|
||||
if (!data) {
|
||||
data = new Alert(this);
|
||||
|
@ -126,6 +126,7 @@ class Alert extends BaseComponent {
|
|||
* Data Api implementation
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): base-component.js
|
||||
* Bootstrap (v5.0.0-beta3): base-component.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -13,27 +13,29 @@ import Data from './dom/data';
|
|||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const VERSION = '5.0.0-beta2';
|
||||
const VERSION = '5.0.0-beta3';
|
||||
|
||||
class BaseComponent {
|
||||
constructor(element) {
|
||||
element = typeof element === 'string' ? document.querySelector(element) : element;
|
||||
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._element = element;
|
||||
Data.setData(element, this.constructor.DATA_KEY, this);
|
||||
Data.set(this._element, this.constructor.DATA_KEY, this);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
Data.removeData(this._element, this.constructor.DATA_KEY);
|
||||
Data.remove(this._element, this.constructor.DATA_KEY);
|
||||
this._element = null;
|
||||
}
|
||||
|
||||
/** Static */
|
||||
|
||||
static getInstance(element) {
|
||||
return Data.getData(element, this.DATA_KEY);
|
||||
return Data.get(element, this.DATA_KEY);
|
||||
}
|
||||
|
||||
static get VERSION() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): button.js
|
||||
* Bootstrap (v5.0.0-beta3): button.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -51,7 +51,7 @@ class Button extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
|
||||
if (!data) {
|
||||
data = new Button(this);
|
||||
|
@ -75,7 +75,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, (event) =>
|
|||
|
||||
const button = event.target.closest(SELECTOR_DATA_TOGGLE);
|
||||
|
||||
let data = Data.getData(button, DATA_KEY);
|
||||
let data = Data.get(button, DATA_KEY);
|
||||
if (!data) {
|
||||
data = new Button(button);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): carousel.js
|
||||
* Bootstrap (v5.0.0-beta3): carousel.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -10,8 +10,8 @@ import {
|
|||
emulateTransitionEnd,
|
||||
getElementFromSelector,
|
||||
getTransitionDurationFromElement,
|
||||
isVisible,
|
||||
isRTL,
|
||||
isVisible,
|
||||
reflow,
|
||||
triggerTransitionEnd,
|
||||
typeCheckConfig,
|
||||
|
@ -56,8 +56,8 @@ const DefaultType = {
|
|||
touch: 'boolean',
|
||||
};
|
||||
|
||||
const DIRECTION_NEXT = 'next';
|
||||
const DIRECTION_PREV = 'prev';
|
||||
const ORDER_NEXT = 'next';
|
||||
const ORDER_PREV = 'prev';
|
||||
const DIRECTION_LEFT = 'left';
|
||||
const DIRECTION_RIGHT = 'right';
|
||||
|
||||
|
@ -138,7 +138,7 @@ class Carousel extends BaseComponent {
|
|||
|
||||
next() {
|
||||
if (!this._isSliding) {
|
||||
this._slide(DIRECTION_NEXT);
|
||||
this._slide(ORDER_NEXT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ class Carousel extends BaseComponent {
|
|||
|
||||
prev() {
|
||||
if (!this._isSliding) {
|
||||
this._slide(DIRECTION_PREV);
|
||||
this._slide(ORDER_PREV);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,13 +209,12 @@ class Carousel extends BaseComponent {
|
|||
return;
|
||||
}
|
||||
|
||||
const direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
|
||||
const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
|
||||
|
||||
this._slide(direction, this._items[index]);
|
||||
this._slide(order, this._items[index]);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
super.dispose();
|
||||
EventHandler.off(this._element, EVENT_KEY);
|
||||
|
||||
this._items = null;
|
||||
|
@ -225,6 +224,8 @@ class Carousel extends BaseComponent {
|
|||
this._isSliding = null;
|
||||
this._activeElement = null;
|
||||
this._indicatorsElement = null;
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// Private
|
||||
|
@ -249,23 +250,11 @@ class Carousel extends BaseComponent {
|
|||
|
||||
this.touchDeltaX = 0;
|
||||
|
||||
// swipe left
|
||||
if (direction > 0) {
|
||||
if (isRTL) {
|
||||
this.next();
|
||||
} else {
|
||||
this.prev();
|
||||
}
|
||||
if (!direction) {
|
||||
return;
|
||||
}
|
||||
|
||||
// swipe right
|
||||
if (direction < 0) {
|
||||
if (isRTL) {
|
||||
this.prev();
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
}
|
||||
this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
|
||||
}
|
||||
|
||||
_addEventListeners() {
|
||||
|
@ -297,11 +286,8 @@ class Carousel extends BaseComponent {
|
|||
|
||||
const move = (event) => {
|
||||
// ensure swiping with one touch and not pinching
|
||||
if (event.touches && event.touches.length > 1) {
|
||||
this.touchDeltaX = 0;
|
||||
} else {
|
||||
this.touchDeltaX = event.touches[0].clientX - this.touchStartX;
|
||||
}
|
||||
this.touchDeltaX =
|
||||
event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
|
||||
};
|
||||
|
||||
const end = (event) => {
|
||||
|
@ -357,18 +343,10 @@ class Carousel extends BaseComponent {
|
|||
|
||||
if (event.key === ARROW_LEFT_KEY) {
|
||||
event.preventDefault();
|
||||
if (isRTL) {
|
||||
this.next();
|
||||
} else {
|
||||
this.prev();
|
||||
}
|
||||
this._slide(DIRECTION_LEFT);
|
||||
} else if (event.key === ARROW_RIGHT_KEY) {
|
||||
event.preventDefault();
|
||||
if (isRTL) {
|
||||
this.prev();
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
this._slide(DIRECTION_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -379,19 +357,19 @@ class Carousel extends BaseComponent {
|
|||
return this._items.indexOf(element);
|
||||
}
|
||||
|
||||
_getItemByDirection(direction, activeElement) {
|
||||
const isNextDirection = direction === DIRECTION_NEXT;
|
||||
const isPrevDirection = direction === DIRECTION_PREV;
|
||||
_getItemByOrder(order, activeElement) {
|
||||
const isNext = order === ORDER_NEXT;
|
||||
const isPrev = order === ORDER_PREV;
|
||||
const activeIndex = this._getItemIndex(activeElement);
|
||||
const lastItemIndex = this._items.length - 1;
|
||||
const isGoingToWrap =
|
||||
(isPrevDirection && activeIndex === 0) || (isNextDirection && activeIndex === lastItemIndex);
|
||||
(isPrev && activeIndex === 0) || (isNext && activeIndex === lastItemIndex);
|
||||
|
||||
if (isGoingToWrap && !this._config.wrap) {
|
||||
return activeElement;
|
||||
}
|
||||
|
||||
const delta = direction === DIRECTION_PREV ? -1 : 1;
|
||||
const delta = isPrev ? -1 : 1;
|
||||
const itemIndex = (activeIndex + delta) % this._items.length;
|
||||
|
||||
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
|
||||
|
@ -451,18 +429,19 @@ class Carousel extends BaseComponent {
|
|||
}
|
||||
}
|
||||
|
||||
_slide(direction, element) {
|
||||
_slide(directionOrOrder, element) {
|
||||
const order = this._directionToOrder(directionOrOrder);
|
||||
const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
||||
const activeElementIndex = this._getItemIndex(activeElement);
|
||||
const nextElement =
|
||||
element || (activeElement && this._getItemByDirection(direction, activeElement));
|
||||
const nextElement = element || this._getItemByOrder(order, activeElement);
|
||||
|
||||
const nextElementIndex = this._getItemIndex(nextElement);
|
||||
const isCycling = Boolean(this._interval);
|
||||
|
||||
const directionalClassName = direction === DIRECTION_NEXT ? CLASS_NAME_START : CLASS_NAME_END;
|
||||
const orderClassName = direction === DIRECTION_NEXT ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
|
||||
const eventDirectionName = direction === DIRECTION_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
||||
const isNext = order === ORDER_NEXT;
|
||||
const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
|
||||
const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
|
||||
const eventDirectionName = this._orderToDirection(order);
|
||||
|
||||
if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
|
||||
this._isSliding = false;
|
||||
|
@ -535,10 +514,34 @@ class Carousel extends BaseComponent {
|
|||
}
|
||||
}
|
||||
|
||||
_directionToOrder(direction) {
|
||||
if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
|
||||
return direction;
|
||||
}
|
||||
|
||||
if (isRTL()) {
|
||||
return direction === DIRECTION_RIGHT ? ORDER_PREV : ORDER_NEXT;
|
||||
}
|
||||
|
||||
return direction === DIRECTION_RIGHT ? ORDER_NEXT : ORDER_PREV;
|
||||
}
|
||||
|
||||
_orderToDirection(order) {
|
||||
if (![ORDER_NEXT, ORDER_PREV].includes(order)) {
|
||||
return order;
|
||||
}
|
||||
|
||||
if (isRTL()) {
|
||||
return order === ORDER_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
||||
}
|
||||
|
||||
return order === ORDER_NEXT ? DIRECTION_RIGHT : DIRECTION_LEFT;
|
||||
}
|
||||
|
||||
// Static
|
||||
|
||||
static carouselInterface(element, config) {
|
||||
let data = Data.getData(element, DATA_KEY);
|
||||
let data = Data.get(element, DATA_KEY);
|
||||
let _config = {
|
||||
...Default,
|
||||
...Manipulator.getDataAttributes(element),
|
||||
|
@ -597,7 +600,7 @@ class Carousel extends BaseComponent {
|
|||
Carousel.carouselInterface(target, config);
|
||||
|
||||
if (slideIndex) {
|
||||
Data.getData(target, DATA_KEY).to(slideIndex);
|
||||
Data.get(target, DATA_KEY).to(slideIndex);
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
@ -616,7 +619,7 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
|||
const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
|
||||
|
||||
for (let i = 0, len = carousels.length; i < len; i++) {
|
||||
Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY));
|
||||
Carousel.carouselInterface(carousels[i], Data.get(carousels[i], DATA_KEY));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): collapse.js
|
||||
* Bootstrap (v5.0.0-beta3): collapse.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -72,8 +72,8 @@ class Collapse extends BaseComponent {
|
|||
this._isTransitioning = false;
|
||||
this._config = this._getConfig(config);
|
||||
this._triggerArray = SelectorEngine.find(
|
||||
`${SELECTOR_DATA_TOGGLE}[href="#${element.id}"],` +
|
||||
`${SELECTOR_DATA_TOGGLE}[data-mdb-target="#${element.id}"]`
|
||||
`${SELECTOR_DATA_TOGGLE}[href="#${this._element.id}"],` +
|
||||
`${SELECTOR_DATA_TOGGLE}[data-mdb-target="#${this._element.id}"]`
|
||||
);
|
||||
|
||||
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
|
||||
|
@ -82,7 +82,7 @@ class Collapse extends BaseComponent {
|
|||
const elem = toggleList[i];
|
||||
const selector = getSelectorFromElement(elem);
|
||||
const filterElement = SelectorEngine.find(selector).filter(
|
||||
(foundElem) => foundElem === element
|
||||
(foundElem) => foundElem === this._element
|
||||
);
|
||||
|
||||
if (selector !== null && filterElement.length) {
|
||||
|
@ -147,7 +147,7 @@ class Collapse extends BaseComponent {
|
|||
const container = SelectorEngine.findOne(this._selector);
|
||||
if (actives) {
|
||||
const tempActiveData = actives.find((elem) => container !== elem);
|
||||
activesData = tempActiveData ? Data.getData(tempActiveData, DATA_KEY) : null;
|
||||
activesData = tempActiveData ? Data.get(tempActiveData, DATA_KEY) : null;
|
||||
|
||||
if (activesData && activesData._isTransitioning) {
|
||||
return;
|
||||
|
@ -166,7 +166,7 @@ class Collapse extends BaseComponent {
|
|||
}
|
||||
|
||||
if (!activesData) {
|
||||
Data.setData(elemActive, DATA_KEY, null);
|
||||
Data.set(elemActive, DATA_KEY, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ class Collapse extends BaseComponent {
|
|||
// Static
|
||||
|
||||
static collapseInterface(element, config) {
|
||||
let data = Data.getData(element, DATA_KEY);
|
||||
let data = Data.get(element, DATA_KEY);
|
||||
const _config = {
|
||||
...Default,
|
||||
...Manipulator.getDataAttributes(element),
|
||||
|
@ -379,7 +379,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
|
|||
const selectorElements = SelectorEngine.find(selector);
|
||||
|
||||
selectorElements.forEach((element) => {
|
||||
const data = Data.getData(element, DATA_KEY);
|
||||
const data = Data.get(element, DATA_KEY);
|
||||
let config;
|
||||
if (data) {
|
||||
// update parent attribute
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/data.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/data.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -11,57 +11,51 @@
|
|||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const mapData = (() => {
|
||||
const storeData = {};
|
||||
let id = 1;
|
||||
return {
|
||||
set(element, key, data) {
|
||||
if (typeof element.bsKey === 'undefined') {
|
||||
element.bsKey = {
|
||||
key,
|
||||
id,
|
||||
};
|
||||
id++;
|
||||
}
|
||||
const elementMap = new Map();
|
||||
|
||||
storeData[element.bsKey.id] = data;
|
||||
},
|
||||
get(element, key) {
|
||||
if (!element || typeof element.bsKey === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
export default {
|
||||
set(element, key, instance) {
|
||||
if (!elementMap.has(element)) {
|
||||
elementMap.set(element, new Map());
|
||||
}
|
||||
|
||||
const keyProperties = element.bsKey;
|
||||
if (keyProperties.key === key) {
|
||||
return storeData[keyProperties.id];
|
||||
}
|
||||
const instanceMap = elementMap.get(element);
|
||||
|
||||
return null;
|
||||
},
|
||||
delete(element, key) {
|
||||
if (typeof element.bsKey === 'undefined') {
|
||||
return;
|
||||
}
|
||||
// make it clear we only want one instance per element
|
||||
// can be removed later when multiple key/instances are fine to be used
|
||||
if (!instanceMap.has(key) && instanceMap.size !== 0) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
`Bootstrap doesn't allow more than one instance per element. Bound instance: ${
|
||||
Array.from(instanceMap.keys())[0]
|
||||
}.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const keyProperties = element.bsKey;
|
||||
if (keyProperties.key === key) {
|
||||
delete storeData[keyProperties.id];
|
||||
delete element.bsKey;
|
||||
}
|
||||
},
|
||||
};
|
||||
})();
|
||||
|
||||
const Data = {
|
||||
setData(instance, key, data) {
|
||||
mapData.set(instance, key, data);
|
||||
instanceMap.set(key, instance);
|
||||
},
|
||||
getData(instance, key) {
|
||||
return mapData.get(instance, key);
|
||||
|
||||
get(element, key) {
|
||||
if (elementMap.has(element)) {
|
||||
return elementMap.get(element).get(key) || null;
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
removeData(instance, key) {
|
||||
mapData.delete(instance, key);
|
||||
|
||||
remove(element, key) {
|
||||
if (!elementMap.has(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const instanceMap = elementMap.get(element);
|
||||
|
||||
instanceMap.delete(key);
|
||||
|
||||
// free up element references if there are no instances left for an element
|
||||
if (instanceMap.size === 0) {
|
||||
elementMap.delete(element);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default Data;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/event-handler.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/event-handler.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -112,6 +112,7 @@ function bootstrapDelegationHandler(element, selector, fn) {
|
|||
event.delegateTarget = target;
|
||||
|
||||
if (handler.oneOff) {
|
||||
// eslint-disable-next-line unicorn/consistent-destructuring
|
||||
EventHandler.off(element, event.type, fn);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/manipulator.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/manipulator.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/selector-engine.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/selector-engine.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -14,10 +14,6 @@
|
|||
const NODE_TEXT = 3;
|
||||
|
||||
const SelectorEngine = {
|
||||
matches(element, selector) {
|
||||
return element.matches(selector);
|
||||
},
|
||||
|
||||
find(selector, element = document.documentElement) {
|
||||
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
||||
},
|
||||
|
@ -27,9 +23,7 @@ const SelectorEngine = {
|
|||
},
|
||||
|
||||
children(element, selector) {
|
||||
const children = [].concat(...element.children);
|
||||
|
||||
return children.filter((child) => child.matches(selector));
|
||||
return [].concat(...element.children).filter((child) => child.matches(selector));
|
||||
},
|
||||
|
||||
parents(element, selector) {
|
||||
|
@ -38,7 +32,7 @@ const SelectorEngine = {
|
|||
let ancestor = element.parentNode;
|
||||
|
||||
while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
|
||||
if (this.matches(ancestor, selector)) {
|
||||
if (ancestor.matches(selector)) {
|
||||
parents.push(ancestor);
|
||||
}
|
||||
|
||||
|
@ -66,7 +60,7 @@ const SelectorEngine = {
|
|||
let next = element.nextElementSibling;
|
||||
|
||||
while (next) {
|
||||
if (this.matches(next, selector)) {
|
||||
if (next.matches(selector)) {
|
||||
return [next];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dropdown.js
|
||||
* Bootstrap (v5.0.0-beta3): dropdown.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -59,21 +59,19 @@ const CLASS_NAME_DROPSTART = 'dropstart';
|
|||
const CLASS_NAME_NAVBAR = 'navbar';
|
||||
|
||||
const SELECTOR_DATA_TOGGLE = '[data-mdb-toggle="dropdown"]';
|
||||
const SELECTOR_FORM_CHILD = '.dropdown form';
|
||||
const SELECTOR_MENU = '.dropdown-menu';
|
||||
const SELECTOR_NAVBAR_NAV = '.navbar-nav';
|
||||
const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
|
||||
|
||||
const PLACEMENT_TOP = isRTL ? 'top-end' : 'top-start';
|
||||
const PLACEMENT_TOPEND = isRTL ? 'top-start' : 'top-end';
|
||||
const PLACEMENT_BOTTOM = isRTL ? 'bottom-end' : 'bottom-start';
|
||||
const PLACEMENT_BOTTOMEND = isRTL ? 'bottom-start' : 'bottom-end';
|
||||
const PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start';
|
||||
const PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start';
|
||||
const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start';
|
||||
const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end';
|
||||
const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
|
||||
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
|
||||
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
|
||||
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
|
||||
|
||||
const Default = {
|
||||
offset: [0, 2],
|
||||
flip: true,
|
||||
boundary: 'clippingParents',
|
||||
reference: 'toggle',
|
||||
display: 'dynamic',
|
||||
|
@ -82,7 +80,6 @@ const Default = {
|
|||
|
||||
const DefaultType = {
|
||||
offset: '(array|string|function)',
|
||||
flip: 'boolean',
|
||||
boundary: '(string|element)',
|
||||
reference: '(string|element|object)',
|
||||
display: 'string',
|
||||
|
@ -242,7 +239,6 @@ class Dropdown extends BaseComponent {
|
|||
}
|
||||
|
||||
dispose() {
|
||||
super.dispose();
|
||||
EventHandler.off(this._element, EVENT_KEY);
|
||||
this._menu = null;
|
||||
|
||||
|
@ -250,6 +246,8 @@ class Dropdown extends BaseComponent {
|
|||
this._popper.destroy();
|
||||
this._popper = null;
|
||||
}
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
update() {
|
||||
|
@ -264,7 +262,6 @@ class Dropdown extends BaseComponent {
|
|||
_addEventListeners() {
|
||||
EventHandler.on(this._element, EVENT_CLICK, (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.toggle();
|
||||
});
|
||||
}
|
||||
|
@ -342,7 +339,6 @@ class Dropdown extends BaseComponent {
|
|||
{
|
||||
name: 'preventOverflow',
|
||||
options: {
|
||||
altBoundary: this._config.flip,
|
||||
boundary: this._config.boundary,
|
||||
},
|
||||
},
|
||||
|
@ -376,7 +372,7 @@ class Dropdown extends BaseComponent {
|
|||
// Static
|
||||
|
||||
static dropdownInterface(element, config) {
|
||||
let data = Data.getData(element, DATA_KEY);
|
||||
let data = Data.get(element, DATA_KEY);
|
||||
const _config = typeof config === 'object' ? config : null;
|
||||
|
||||
if (!data) {
|
||||
|
@ -399,17 +395,23 @@ class Dropdown extends BaseComponent {
|
|||
}
|
||||
|
||||
static clearMenus(event) {
|
||||
if (
|
||||
event &&
|
||||
(event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY))
|
||||
) {
|
||||
return;
|
||||
if (event) {
|
||||
if (
|
||||
event.button === RIGHT_MOUSE_BUTTON ||
|
||||
(event.type === 'keyup' && event.key !== TAB_KEY)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (/input|select|textarea|form/i.test(event.target.tagName)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
|
||||
|
||||
for (let i = 0, len = toggles.length; i < len; i++) {
|
||||
const context = Data.getData(toggles[i], DATA_KEY);
|
||||
const context = Data.get(toggles[i], DATA_KEY);
|
||||
const relatedTarget = {
|
||||
relatedTarget: toggles[i],
|
||||
};
|
||||
|
@ -427,13 +429,20 @@ class Dropdown extends BaseComponent {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
event &&
|
||||
((event.type === 'click' && /input|textarea/i.test(event.target.tagName)) ||
|
||||
(event.type === 'keyup' && event.key === TAB_KEY)) &&
|
||||
dropdownMenu.contains(event.target)
|
||||
) {
|
||||
continue;
|
||||
if (event) {
|
||||
// Don't close the menu if the clicked element or one of its parents is the dropdown button
|
||||
if ([context._element].some((element) => event.composedPath().includes(element))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Tab navigation through the dropdown menu shouldn't close the menu
|
||||
if (
|
||||
event.type === 'keyup' &&
|
||||
event.key === TAB_KEY &&
|
||||
dropdownMenu.contains(event.target)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
const hideEvent = EventHandler.trigger(toggles[i], EVENT_HIDE, relatedTarget);
|
||||
|
@ -559,10 +568,8 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus);
|
|||
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
|
||||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
Dropdown.dropdownInterface(this, 'toggle');
|
||||
Dropdown.dropdownInterface(this);
|
||||
});
|
||||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, (e) => e.stopPropagation());
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): modal.js
|
||||
* Bootstrap (v5.0.0-beta3): modal.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -83,7 +83,7 @@ class Modal extends BaseComponent {
|
|||
super(element);
|
||||
|
||||
this._config = this._getConfig(config);
|
||||
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element);
|
||||
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
|
||||
this._backdrop = null;
|
||||
this._isShown = false;
|
||||
this._isBodyOverflowing = false;
|
||||
|
@ -113,7 +113,7 @@ class Modal extends BaseComponent {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this._element.classList.contains(CLASS_NAME_FADE)) {
|
||||
if (this._isAnimated()) {
|
||||
this._isTransitioning = true;
|
||||
}
|
||||
|
||||
|
@ -166,9 +166,9 @@ class Modal extends BaseComponent {
|
|||
}
|
||||
|
||||
this._isShown = false;
|
||||
const transition = this._element.classList.contains(CLASS_NAME_FADE);
|
||||
const isAnimated = this._isAnimated();
|
||||
|
||||
if (transition) {
|
||||
if (isAnimated) {
|
||||
this._isTransitioning = true;
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ class Modal extends BaseComponent {
|
|||
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
|
||||
EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
|
||||
|
||||
if (transition) {
|
||||
if (isAnimated) {
|
||||
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
|
||||
EventHandler.one(this._element, 'transitionend', (event) => this._hideModal(event));
|
||||
|
@ -233,7 +233,7 @@ class Modal extends BaseComponent {
|
|||
}
|
||||
|
||||
_showElement(relatedTarget) {
|
||||
const transition = this._element.classList.contains(CLASS_NAME_FADE);
|
||||
const isAnimated = this._isAnimated();
|
||||
const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
|
||||
|
||||
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
||||
|
@ -251,7 +251,7 @@ class Modal extends BaseComponent {
|
|||
modalBody.scrollTop = 0;
|
||||
}
|
||||
|
||||
if (transition) {
|
||||
if (isAnimated) {
|
||||
reflow(this._element);
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ class Modal extends BaseComponent {
|
|||
});
|
||||
};
|
||||
|
||||
if (transition) {
|
||||
if (isAnimated) {
|
||||
const transitionDuration = getTransitionDurationFromElement(this._dialog);
|
||||
|
||||
EventHandler.one(this._dialog, 'transitionend', transitionComplete);
|
||||
|
@ -338,14 +338,13 @@ class Modal extends BaseComponent {
|
|||
}
|
||||
|
||||
_showBackdrop(callback) {
|
||||
const animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
|
||||
|
||||
const isAnimated = this._isAnimated();
|
||||
if (this._isShown && this._config.backdrop) {
|
||||
this._backdrop = document.createElement('div');
|
||||
this._backdrop.className = CLASS_NAME_BACKDROP;
|
||||
|
||||
if (animate) {
|
||||
this._backdrop.classList.add(animate);
|
||||
if (isAnimated) {
|
||||
this._backdrop.classList.add(CLASS_NAME_FADE);
|
||||
}
|
||||
|
||||
document.body.appendChild(this._backdrop);
|
||||
|
@ -367,13 +366,13 @@ class Modal extends BaseComponent {
|
|||
}
|
||||
});
|
||||
|
||||
if (animate) {
|
||||
if (isAnimated) {
|
||||
reflow(this._backdrop);
|
||||
}
|
||||
|
||||
this._backdrop.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
if (!animate) {
|
||||
if (!isAnimated) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
@ -390,7 +389,7 @@ class Modal extends BaseComponent {
|
|||
callback();
|
||||
};
|
||||
|
||||
if (this._element.classList.contains(CLASS_NAME_FADE)) {
|
||||
if (isAnimated) {
|
||||
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
|
||||
EventHandler.one(this._backdrop, 'transitionend', callbackRemove);
|
||||
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
|
||||
|
@ -402,6 +401,10 @@ class Modal extends BaseComponent {
|
|||
}
|
||||
}
|
||||
|
||||
_isAnimated() {
|
||||
return this._element.classList.contains(CLASS_NAME_FADE);
|
||||
}
|
||||
|
||||
_triggerBackdropTransition() {
|
||||
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
|
||||
if (hideEvent.defaultPrevented) {
|
||||
|
@ -438,15 +441,15 @@ class Modal extends BaseComponent {
|
|||
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
||||
|
||||
if (
|
||||
(!this._isBodyOverflowing && isModalOverflowing && !isRTL) ||
|
||||
(this._isBodyOverflowing && !isModalOverflowing && isRTL)
|
||||
(!this._isBodyOverflowing && isModalOverflowing && !isRTL()) ||
|
||||
(this._isBodyOverflowing && !isModalOverflowing && isRTL())
|
||||
) {
|
||||
this._element.style.paddingLeft = `${this._scrollbarWidth}px`;
|
||||
}
|
||||
|
||||
if (
|
||||
(this._isBodyOverflowing && !isModalOverflowing && !isRTL) ||
|
||||
(!this._isBodyOverflowing && isModalOverflowing && isRTL)
|
||||
(this._isBodyOverflowing && !isModalOverflowing && !isRTL()) ||
|
||||
(!this._isBodyOverflowing && isModalOverflowing && isRTL())
|
||||
) {
|
||||
this._element.style.paddingRight = `${this._scrollbarWidth}px`;
|
||||
}
|
||||
|
@ -487,6 +490,13 @@ class Modal extends BaseComponent {
|
|||
|
||||
_setElementAttributes(selector, styleProp, callback) {
|
||||
SelectorEngine.find(selector).forEach((element) => {
|
||||
if (
|
||||
element !== document.body &&
|
||||
window.innerWidth > element.clientWidth + this._scrollbarWidth
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const actualValue = element.style[styleProp];
|
||||
const calculatedValue = window.getComputedStyle(element)[styleProp];
|
||||
Manipulator.setDataAttribute(element, styleProp, actualValue);
|
||||
|
@ -526,7 +536,7 @@ class Modal extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config, relatedTarget) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
const _config = {
|
||||
...Default,
|
||||
...Manipulator.getDataAttributes(this),
|
||||
|
@ -574,7 +584,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
|
|||
});
|
||||
});
|
||||
|
||||
let data = Data.getData(target, DATA_KEY);
|
||||
let data = Data.get(target, DATA_KEY);
|
||||
if (!data) {
|
||||
const config = {
|
||||
...Manipulator.getDataAttributes(target),
|
||||
|
|
284
src/js/bootstrap/mdb-prefix/offcanvas.js
Normal file
284
src/js/bootstrap/mdb-prefix/offcanvas.js
Normal file
|
@ -0,0 +1,284 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): offcanvas.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import {
|
||||
defineJQueryPlugin,
|
||||
getElementFromSelector,
|
||||
getSelectorFromElement,
|
||||
getTransitionDurationFromElement,
|
||||
isDisabled,
|
||||
isVisible,
|
||||
typeCheckConfig,
|
||||
} from './util/index';
|
||||
import { hide as scrollBarHide, reset as scrollBarReset } from './util/scrollbar';
|
||||
import Data from './dom/data';
|
||||
import EventHandler from './dom/event-handler';
|
||||
import BaseComponent from './base-component';
|
||||
import SelectorEngine from './dom/selector-engine';
|
||||
import Manipulator from './dom/manipulator';
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const NAME = 'offcanvas';
|
||||
const DATA_KEY = 'bs.offcanvas';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const DATA_API_KEY = '.data-api';
|
||||
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const ESCAPE_KEY = 'Escape';
|
||||
|
||||
const Default = {
|
||||
backdrop: true,
|
||||
keyboard: true,
|
||||
scroll: false,
|
||||
};
|
||||
|
||||
const DefaultType = {
|
||||
backdrop: 'boolean',
|
||||
keyboard: 'boolean',
|
||||
scroll: 'boolean',
|
||||
};
|
||||
|
||||
const CLASS_NAME_BACKDROP_BODY = 'offcanvas-backdrop';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
const CLASS_NAME_TOGGLING = 'offcanvas-toggling';
|
||||
const OPEN_SELECTOR = '.offcanvas.show';
|
||||
const ACTIVE_SELECTOR = `${OPEN_SELECTOR}, .${CLASS_NAME_TOGGLING}`;
|
||||
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
||||
|
||||
const SELECTOR_DATA_DISMISS = '[data-mdb-dismiss="offcanvas"]';
|
||||
const SELECTOR_DATA_TOGGLE = '[data-mdb-toggle="offcanvas"]';
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
class Offcanvas extends BaseComponent {
|
||||
constructor(element, config) {
|
||||
super(element);
|
||||
|
||||
this._config = this._getConfig(config);
|
||||
this._isShown = false;
|
||||
this._addEventListeners();
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
||||
static get Default() {
|
||||
return Default;
|
||||
}
|
||||
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
}
|
||||
|
||||
// Public
|
||||
|
||||
toggle(relatedTarget) {
|
||||
return this._isShown ? this.hide() : this.show(relatedTarget);
|
||||
}
|
||||
|
||||
show(relatedTarget) {
|
||||
if (this._isShown) {
|
||||
return;
|
||||
}
|
||||
|
||||
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { relatedTarget });
|
||||
|
||||
if (showEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._isShown = true;
|
||||
this._element.style.visibility = 'visible';
|
||||
|
||||
if (this._config.backdrop) {
|
||||
document.body.classList.add(CLASS_NAME_BACKDROP_BODY);
|
||||
}
|
||||
|
||||
if (!this._config.scroll) {
|
||||
scrollBarHide();
|
||||
}
|
||||
|
||||
this._element.classList.add(CLASS_NAME_TOGGLING);
|
||||
this._element.removeAttribute('aria-hidden');
|
||||
this._element.setAttribute('aria-modal', true);
|
||||
this._element.setAttribute('role', 'dialog');
|
||||
this._element.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
const completeCallBack = () => {
|
||||
this._element.classList.remove(CLASS_NAME_TOGGLING);
|
||||
EventHandler.trigger(this._element, EVENT_SHOWN, { relatedTarget });
|
||||
this._enforceFocusOnElement(this._element);
|
||||
};
|
||||
|
||||
setTimeout(completeCallBack, getTransitionDurationFromElement(this._element));
|
||||
}
|
||||
|
||||
hide() {
|
||||
if (!this._isShown) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
|
||||
|
||||
if (hideEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._element.classList.add(CLASS_NAME_TOGGLING);
|
||||
EventHandler.off(document, EVENT_FOCUSIN);
|
||||
this._element.blur();
|
||||
this._isShown = false;
|
||||
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||
|
||||
const completeCallback = () => {
|
||||
this._element.setAttribute('aria-hidden', true);
|
||||
this._element.removeAttribute('aria-modal');
|
||||
this._element.removeAttribute('role');
|
||||
this._element.style.visibility = 'hidden';
|
||||
|
||||
if (this._config.backdrop) {
|
||||
document.body.classList.remove(CLASS_NAME_BACKDROP_BODY);
|
||||
}
|
||||
|
||||
if (!this._config.scroll) {
|
||||
scrollBarReset();
|
||||
}
|
||||
|
||||
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
||||
this._element.classList.remove(CLASS_NAME_TOGGLING);
|
||||
};
|
||||
|
||||
setTimeout(completeCallback, getTransitionDurationFromElement(this._element));
|
||||
}
|
||||
|
||||
// Private
|
||||
|
||||
_getConfig(config) {
|
||||
config = {
|
||||
...Default,
|
||||
...Manipulator.getDataAttributes(this._element),
|
||||
...(typeof config === 'object' ? config : {}),
|
||||
};
|
||||
typeCheckConfig(NAME, config, DefaultType);
|
||||
return config;
|
||||
}
|
||||
|
||||
_enforceFocusOnElement(element) {
|
||||
EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
|
||||
EventHandler.on(document, EVENT_FOCUSIN, (event) => {
|
||||
if (
|
||||
document !== event.target &&
|
||||
element !== event.target &&
|
||||
!element.contains(event.target)
|
||||
) {
|
||||
element.focus();
|
||||
}
|
||||
});
|
||||
element.focus();
|
||||
}
|
||||
|
||||
_addEventListeners() {
|
||||
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
|
||||
|
||||
EventHandler.on(document, 'keydown', (event) => {
|
||||
if (this._config.keyboard && event.key === ESCAPE_KEY) {
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
|
||||
EventHandler.on(document, EVENT_CLICK_DATA_API, (event) => {
|
||||
const target = SelectorEngine.findOne(getSelectorFromElement(event.target));
|
||||
if (!this._element.contains(event.target) && target !== this._element) {
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Static
|
||||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
const data =
|
||||
Data.get(this, DATA_KEY) || new Offcanvas(this, typeof config === 'object' ? config : {});
|
||||
|
||||
if (typeof config !== 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config](this);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Data Api implementation
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
||||
const target = getElementFromSelector(this);
|
||||
|
||||
if (['A', 'AREA'].includes(this.tagName)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (isDisabled(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
EventHandler.one(target, EVENT_HIDDEN, () => {
|
||||
// focus on trigger when it is closed
|
||||
if (isVisible(this)) {
|
||||
this.focus();
|
||||
}
|
||||
});
|
||||
|
||||
// avoid conflict when clicking a toggler of an offcanvas, while another is open
|
||||
const allReadyOpen = SelectorEngine.findOne(ACTIVE_SELECTOR);
|
||||
if (allReadyOpen && allReadyOpen !== target) {
|
||||
return;
|
||||
}
|
||||
|
||||
const data = Data.get(target, DATA_KEY) || new Offcanvas(target);
|
||||
|
||||
data.toggle(this);
|
||||
});
|
||||
|
||||
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
||||
SelectorEngine.find(OPEN_SELECTOR).forEach((el) =>
|
||||
(Data.get(el, DATA_KEY) || new Offcanvas(el)).show()
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* jQuery
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
defineJQueryPlugin(NAME, Offcanvas);
|
||||
|
||||
export default Offcanvas;
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): popover.js
|
||||
* Bootstrap (v5.0.0-beta3): popover.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -136,7 +136,7 @@ class Popover extends Tooltip {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
const _config = typeof config === 'object' ? config : null;
|
||||
|
||||
if (!data && /dispose|hide/.test(config)) {
|
||||
|
@ -145,7 +145,7 @@ class Popover extends Tooltip {
|
|||
|
||||
if (!data) {
|
||||
data = new Popover(this, _config);
|
||||
Data.setData(this, DATA_KEY, data);
|
||||
Data.set(this, DATA_KEY, data);
|
||||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): scrollspy.js
|
||||
* Bootstrap (v5.0.0-beta3): scrollspy.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -68,7 +68,7 @@ const METHOD_POSITION = 'position';
|
|||
class ScrollSpy extends BaseComponent {
|
||||
constructor(element, config) {
|
||||
super(element);
|
||||
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
||||
this._scrollElement = this._element.tagName === 'BODY' ? window : this._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._offsets = [];
|
||||
|
@ -276,7 +276,7 @@ class ScrollSpy extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
const _config = typeof config === 'object' && config;
|
||||
|
||||
if (!data) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): tab.js
|
||||
* Bootstrap (v5.0.0-beta3): tab.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -10,6 +10,7 @@ import {
|
|||
emulateTransitionEnd,
|
||||
getElementFromSelector,
|
||||
getTransitionDurationFromElement,
|
||||
isDisabled,
|
||||
reflow,
|
||||
} from './util/index';
|
||||
import Data from './dom/data';
|
||||
|
@ -36,7 +37,6 @@ const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
|||
|
||||
const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
|
||||
const CLASS_NAME_ACTIVE = 'active';
|
||||
const CLASS_NAME_DISABLED = 'disabled';
|
||||
const CLASS_NAME_FADE = 'fade';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
|
||||
|
@ -69,7 +69,7 @@ class Tab extends BaseComponent {
|
|||
(this._element.parentNode &&
|
||||
this._element.parentNode.nodeType === Node.ELEMENT_NODE &&
|
||||
this._element.classList.contains(CLASS_NAME_ACTIVE)) ||
|
||||
this._element.classList.contains(CLASS_NAME_DISABLED)
|
||||
isDisabled(this._element)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ class Tab extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
const data = Data.getData(this, DATA_KEY) || new Tab(this);
|
||||
const data = Data.get(this, DATA_KEY) || new Tab(this);
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
|
@ -215,7 +215,7 @@ class Tab extends BaseComponent {
|
|||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
const data = Data.getData(this, DATA_KEY) || new Tab(this);
|
||||
const data = Data.get(this, DATA_KEY) || new Tab(this);
|
||||
data.show();
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): toast.js
|
||||
* Bootstrap (v5.0.0-beta3): toast.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -189,7 +189,7 @@ class Toast extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
const _config = typeof config === 'object' && config;
|
||||
|
||||
if (!data) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): tooltip.js
|
||||
* Bootstrap (v5.0.0-beta3): tooltip.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -61,9 +61,9 @@ const DefaultType = {
|
|||
const AttachmentMap = {
|
||||
AUTO: 'auto',
|
||||
TOP: 'top',
|
||||
RIGHT: isRTL ? 'left' : 'right',
|
||||
RIGHT: isRTL() ? 'left' : 'right',
|
||||
BOTTOM: 'bottom',
|
||||
LEFT: isRTL ? 'right' : 'left',
|
||||
LEFT: isRTL() ? 'right' : 'left',
|
||||
};
|
||||
|
||||
const Default = {
|
||||
|
@ -279,15 +279,18 @@ class Tooltip extends BaseComponent {
|
|||
this._addAttachmentClass(attachment);
|
||||
|
||||
const container = this._getContainer();
|
||||
Data.setData(tip, this.constructor.DATA_KEY, this);
|
||||
Data.set(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);
|
||||
}
|
||||
|
||||
EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
|
||||
|
||||
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
||||
if (this._popper) {
|
||||
this._popper.update();
|
||||
} else {
|
||||
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
||||
}
|
||||
|
||||
tip.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
|
@ -336,6 +339,10 @@ class Tooltip extends BaseComponent {
|
|||
|
||||
const tip = this.getTipElement();
|
||||
const complete = () => {
|
||||
if (this._isWithActiveTrigger()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
|
||||
tip.parentNode.removeChild(tip);
|
||||
}
|
||||
|
@ -474,11 +481,11 @@ class Tooltip extends BaseComponent {
|
|||
|
||||
_initializeOnDelegatedTarget(event, context) {
|
||||
const dataKey = this.constructor.DATA_KEY;
|
||||
context = context || Data.getData(event.delegateTarget, dataKey);
|
||||
context = context || Data.get(event.delegateTarget, dataKey);
|
||||
|
||||
if (!context) {
|
||||
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
||||
Data.setData(event.delegateTarget, dataKey, context);
|
||||
Data.set(event.delegateTarget, dataKey, context);
|
||||
}
|
||||
|
||||
return context;
|
||||
|
@ -671,7 +678,9 @@ class Tooltip extends BaseComponent {
|
|||
context = this._initializeOnDelegatedTarget(event, context);
|
||||
|
||||
if (event) {
|
||||
context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
|
||||
context._activeTrigger[
|
||||
event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER
|
||||
] = context._element.contains(event.relatedTarget);
|
||||
}
|
||||
|
||||
if (context._isWithActiveTrigger()) {
|
||||
|
@ -785,7 +794,7 @@ class Tooltip extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
const _config = typeof config === 'object' && config;
|
||||
|
||||
if (!data && /dispose|hide/.test(config)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/index.js
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -39,7 +39,20 @@ const getSelector = (element) => {
|
|||
let selector = element.getAttribute('data-mdb-target');
|
||||
|
||||
if (!selector || selector === '#') {
|
||||
const hrefAttr = element.getAttribute('href');
|
||||
let hrefAttr = element.getAttribute('href');
|
||||
|
||||
// The only valid content that could double as a selector are IDs or classes,
|
||||
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
||||
// `document.querySelector` will rightfully complain it is invalid.
|
||||
// See https://github.com/twbs/bootstrap/issues/32273
|
||||
if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Just in case some CMS puts out a full URL with the anchor appended
|
||||
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
|
||||
hrefAttr = '#' + hrefAttr.split('#')[1];
|
||||
}
|
||||
|
||||
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
|
||||
}
|
||||
|
@ -120,7 +133,7 @@ const typeCheckConfig = (componentName, config, configTypes) => {
|
|||
const valueType = value && isElement(value) ? 'element' : toType(value);
|
||||
|
||||
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||
throw new Error(
|
||||
throw new TypeError(
|
||||
`${componentName.toUpperCase()}: ` +
|
||||
`Option "${property}" provided type "${valueType}" ` +
|
||||
`but expected type "${expectedTypes}".`
|
||||
|
@ -148,6 +161,22 @@ const isVisible = (element) => {
|
|||
return false;
|
||||
};
|
||||
|
||||
const isDisabled = (element) => {
|
||||
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (element.classList.contains('disabled')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof element.disabled !== 'undefined') {
|
||||
return element.disabled;
|
||||
}
|
||||
|
||||
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
||||
};
|
||||
|
||||
const findShadowRoot = (element) => {
|
||||
if (!document.documentElement.attachShadow) {
|
||||
return null;
|
||||
|
@ -193,7 +222,7 @@ const onDOMContentLoaded = (callback) => {
|
|||
}
|
||||
};
|
||||
|
||||
const isRTL = document.documentElement.dir === 'rtl';
|
||||
const isRTL = () => document.documentElement.dir === 'rtl';
|
||||
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
onDOMContentLoaded(() => {
|
||||
|
@ -212,7 +241,6 @@ const defineJQueryPlugin = (name, plugin) => {
|
|||
};
|
||||
|
||||
export {
|
||||
TRANSITION_END,
|
||||
getUID,
|
||||
getSelectorFromElement,
|
||||
getElementFromSelector,
|
||||
|
@ -222,6 +250,7 @@ export {
|
|||
emulateTransitionEnd,
|
||||
typeCheckConfig,
|
||||
isVisible,
|
||||
isDisabled,
|
||||
findShadowRoot,
|
||||
noop,
|
||||
reflow,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/sanitizer.js
|
||||
* Bootstrap (v5.0.0-beta3): util/sanitizer.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@ const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
|||
*
|
||||
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
||||
*/
|
||||
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
|
||||
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
|
||||
|
||||
/**
|
||||
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
||||
|
@ -38,7 +38,7 @@ const allowedAttribute = (attr, allowedAttributeList) => {
|
|||
if (allowedAttributeList.includes(attrName)) {
|
||||
if (uriAttrs.has(attrName)) {
|
||||
return Boolean(
|
||||
attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)
|
||||
SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ const allowedAttribute = (attr, allowedAttributeList) => {
|
|||
|
||||
// Check if a regular expression validates the attribute.
|
||||
for (let i = 0, len = regExp.length; i < len; i++) {
|
||||
if (attrName.match(regExp[i])) {
|
||||
if (regExp[i].test(attrName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
72
src/js/bootstrap/mdb-prefix/util/scrollbar.js
Normal file
72
src/js/bootstrap/mdb-prefix/util/scrollbar.js
Normal file
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): util/scrollBar.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import SelectorEngine from '../dom/selector-engine';
|
||||
import Manipulator from '../dom/manipulator';
|
||||
|
||||
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed';
|
||||
const SELECTOR_STICKY_CONTENT = '.sticky-top';
|
||||
|
||||
const getWidth = () => {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
||||
const documentWidth = document.documentElement.clientWidth;
|
||||
return Math.abs(window.innerWidth - documentWidth);
|
||||
};
|
||||
|
||||
const hide = (width = getWidth()) => {
|
||||
document.body.style.overflow = 'hidden';
|
||||
_setElementAttributes(
|
||||
SELECTOR_FIXED_CONTENT,
|
||||
'paddingRight',
|
||||
(calculatedValue) => calculatedValue + width
|
||||
);
|
||||
_setElementAttributes(
|
||||
SELECTOR_STICKY_CONTENT,
|
||||
'marginRight',
|
||||
(calculatedValue) => calculatedValue - width
|
||||
);
|
||||
_setElementAttributes('body', 'paddingRight', (calculatedValue) => calculatedValue + width);
|
||||
};
|
||||
|
||||
const _setElementAttributes = (selector, styleProp, callback) => {
|
||||
const scrollbarWidth = getWidth();
|
||||
SelectorEngine.find(selector).forEach((element) => {
|
||||
if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
|
||||
return;
|
||||
}
|
||||
|
||||
const actualValue = element.style[styleProp];
|
||||
const calculatedValue = window.getComputedStyle(element)[styleProp];
|
||||
Manipulator.setDataAttribute(element, styleProp, actualValue);
|
||||
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
|
||||
});
|
||||
};
|
||||
|
||||
const reset = () => {
|
||||
document.body.style.overflow = 'auto';
|
||||
_resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
|
||||
_resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
|
||||
_resetElementAttributes('body', 'paddingRight');
|
||||
};
|
||||
|
||||
const _resetElementAttributes = (selector, styleProp) => {
|
||||
SelectorEngine.find(selector).forEach((element) => {
|
||||
const value = Manipulator.getDataAttribute(element, styleProp);
|
||||
if (typeof value === 'undefined' && element === document.body) {
|
||||
element.style.removeProperty(styleProp);
|
||||
} else {
|
||||
Manipulator.removeDataAttribute(element, styleProp);
|
||||
element.style[styleProp] = value;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const isBodyOverflowing = () => {
|
||||
return getWidth() > 0;
|
||||
};
|
||||
|
||||
export { getWidth, hide, isBodyOverflowing, reset };
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): alert.js
|
||||
* Bootstrap (v5.0.0-beta3): alert.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -98,7 +98,7 @@ class Alert extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
|
||||
if (!data) {
|
||||
data = new Alert(this);
|
||||
|
@ -126,6 +126,7 @@ class Alert extends BaseComponent {
|
|||
* Data Api implementation
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): base-component.js
|
||||
* Bootstrap (v5.0.0-beta3): base-component.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -13,27 +13,29 @@ import Data from './dom/data';
|
|||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const VERSION = '5.0.0-beta2';
|
||||
const VERSION = '5.0.0-beta3';
|
||||
|
||||
class BaseComponent {
|
||||
constructor(element) {
|
||||
element = typeof element === 'string' ? document.querySelector(element) : element;
|
||||
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._element = element;
|
||||
Data.setData(element, this.constructor.DATA_KEY, this);
|
||||
Data.set(this._element, this.constructor.DATA_KEY, this);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
Data.removeData(this._element, this.constructor.DATA_KEY);
|
||||
Data.remove(this._element, this.constructor.DATA_KEY);
|
||||
this._element = null;
|
||||
}
|
||||
|
||||
/** Static */
|
||||
|
||||
static getInstance(element) {
|
||||
return Data.getData(element, this.DATA_KEY);
|
||||
return Data.get(element, this.DATA_KEY);
|
||||
}
|
||||
|
||||
static get VERSION() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): button.js
|
||||
* Bootstrap (v5.0.0-beta3): button.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -51,7 +51,7 @@ class Button extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
|
||||
if (!data) {
|
||||
data = new Button(this);
|
||||
|
@ -75,7 +75,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, (event) =>
|
|||
|
||||
const button = event.target.closest(SELECTOR_DATA_TOGGLE);
|
||||
|
||||
let data = Data.getData(button, DATA_KEY);
|
||||
let data = Data.get(button, DATA_KEY);
|
||||
if (!data) {
|
||||
data = new Button(button);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): carousel.js
|
||||
* Bootstrap (v5.0.0-beta3): carousel.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -10,8 +10,8 @@ import {
|
|||
emulateTransitionEnd,
|
||||
getElementFromSelector,
|
||||
getTransitionDurationFromElement,
|
||||
isVisible,
|
||||
isRTL,
|
||||
isVisible,
|
||||
reflow,
|
||||
triggerTransitionEnd,
|
||||
typeCheckConfig,
|
||||
|
@ -56,8 +56,8 @@ const DefaultType = {
|
|||
touch: 'boolean',
|
||||
};
|
||||
|
||||
const DIRECTION_NEXT = 'next';
|
||||
const DIRECTION_PREV = 'prev';
|
||||
const ORDER_NEXT = 'next';
|
||||
const ORDER_PREV = 'prev';
|
||||
const DIRECTION_LEFT = 'left';
|
||||
const DIRECTION_RIGHT = 'right';
|
||||
|
||||
|
@ -138,7 +138,7 @@ class Carousel extends BaseComponent {
|
|||
|
||||
next() {
|
||||
if (!this._isSliding) {
|
||||
this._slide(DIRECTION_NEXT);
|
||||
this._slide(ORDER_NEXT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ class Carousel extends BaseComponent {
|
|||
|
||||
prev() {
|
||||
if (!this._isSliding) {
|
||||
this._slide(DIRECTION_PREV);
|
||||
this._slide(ORDER_PREV);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,13 +209,12 @@ class Carousel extends BaseComponent {
|
|||
return;
|
||||
}
|
||||
|
||||
const direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
|
||||
const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
|
||||
|
||||
this._slide(direction, this._items[index]);
|
||||
this._slide(order, this._items[index]);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
super.dispose();
|
||||
EventHandler.off(this._element, EVENT_KEY);
|
||||
|
||||
this._items = null;
|
||||
|
@ -225,6 +224,8 @@ class Carousel extends BaseComponent {
|
|||
this._isSliding = null;
|
||||
this._activeElement = null;
|
||||
this._indicatorsElement = null;
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// Private
|
||||
|
@ -249,23 +250,11 @@ class Carousel extends BaseComponent {
|
|||
|
||||
this.touchDeltaX = 0;
|
||||
|
||||
// swipe left
|
||||
if (direction > 0) {
|
||||
if (isRTL) {
|
||||
this.next();
|
||||
} else {
|
||||
this.prev();
|
||||
}
|
||||
if (!direction) {
|
||||
return;
|
||||
}
|
||||
|
||||
// swipe right
|
||||
if (direction < 0) {
|
||||
if (isRTL) {
|
||||
this.prev();
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
}
|
||||
this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
|
||||
}
|
||||
|
||||
_addEventListeners() {
|
||||
|
@ -297,11 +286,8 @@ class Carousel extends BaseComponent {
|
|||
|
||||
const move = (event) => {
|
||||
// ensure swiping with one touch and not pinching
|
||||
if (event.touches && event.touches.length > 1) {
|
||||
this.touchDeltaX = 0;
|
||||
} else {
|
||||
this.touchDeltaX = event.touches[0].clientX - this.touchStartX;
|
||||
}
|
||||
this.touchDeltaX =
|
||||
event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
|
||||
};
|
||||
|
||||
const end = (event) => {
|
||||
|
@ -357,18 +343,10 @@ class Carousel extends BaseComponent {
|
|||
|
||||
if (event.key === ARROW_LEFT_KEY) {
|
||||
event.preventDefault();
|
||||
if (isRTL) {
|
||||
this.next();
|
||||
} else {
|
||||
this.prev();
|
||||
}
|
||||
this._slide(DIRECTION_LEFT);
|
||||
} else if (event.key === ARROW_RIGHT_KEY) {
|
||||
event.preventDefault();
|
||||
if (isRTL) {
|
||||
this.prev();
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
this._slide(DIRECTION_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -379,19 +357,19 @@ class Carousel extends BaseComponent {
|
|||
return this._items.indexOf(element);
|
||||
}
|
||||
|
||||
_getItemByDirection(direction, activeElement) {
|
||||
const isNextDirection = direction === DIRECTION_NEXT;
|
||||
const isPrevDirection = direction === DIRECTION_PREV;
|
||||
_getItemByOrder(order, activeElement) {
|
||||
const isNext = order === ORDER_NEXT;
|
||||
const isPrev = order === ORDER_PREV;
|
||||
const activeIndex = this._getItemIndex(activeElement);
|
||||
const lastItemIndex = this._items.length - 1;
|
||||
const isGoingToWrap =
|
||||
(isPrevDirection && activeIndex === 0) || (isNextDirection && activeIndex === lastItemIndex);
|
||||
(isPrev && activeIndex === 0) || (isNext && activeIndex === lastItemIndex);
|
||||
|
||||
if (isGoingToWrap && !this._config.wrap) {
|
||||
return activeElement;
|
||||
}
|
||||
|
||||
const delta = direction === DIRECTION_PREV ? -1 : 1;
|
||||
const delta = isPrev ? -1 : 1;
|
||||
const itemIndex = (activeIndex + delta) % this._items.length;
|
||||
|
||||
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
|
||||
|
@ -451,18 +429,19 @@ class Carousel extends BaseComponent {
|
|||
}
|
||||
}
|
||||
|
||||
_slide(direction, element) {
|
||||
_slide(directionOrOrder, element) {
|
||||
const order = this._directionToOrder(directionOrOrder);
|
||||
const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
||||
const activeElementIndex = this._getItemIndex(activeElement);
|
||||
const nextElement =
|
||||
element || (activeElement && this._getItemByDirection(direction, activeElement));
|
||||
const nextElement = element || this._getItemByOrder(order, activeElement);
|
||||
|
||||
const nextElementIndex = this._getItemIndex(nextElement);
|
||||
const isCycling = Boolean(this._interval);
|
||||
|
||||
const directionalClassName = direction === DIRECTION_NEXT ? CLASS_NAME_START : CLASS_NAME_END;
|
||||
const orderClassName = direction === DIRECTION_NEXT ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
|
||||
const eventDirectionName = direction === DIRECTION_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
||||
const isNext = order === ORDER_NEXT;
|
||||
const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
|
||||
const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
|
||||
const eventDirectionName = this._orderToDirection(order);
|
||||
|
||||
if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
|
||||
this._isSliding = false;
|
||||
|
@ -535,10 +514,34 @@ class Carousel extends BaseComponent {
|
|||
}
|
||||
}
|
||||
|
||||
_directionToOrder(direction) {
|
||||
if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
|
||||
return direction;
|
||||
}
|
||||
|
||||
if (isRTL()) {
|
||||
return direction === DIRECTION_RIGHT ? ORDER_PREV : ORDER_NEXT;
|
||||
}
|
||||
|
||||
return direction === DIRECTION_RIGHT ? ORDER_NEXT : ORDER_PREV;
|
||||
}
|
||||
|
||||
_orderToDirection(order) {
|
||||
if (![ORDER_NEXT, ORDER_PREV].includes(order)) {
|
||||
return order;
|
||||
}
|
||||
|
||||
if (isRTL()) {
|
||||
return order === ORDER_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
||||
}
|
||||
|
||||
return order === ORDER_NEXT ? DIRECTION_RIGHT : DIRECTION_LEFT;
|
||||
}
|
||||
|
||||
// Static
|
||||
|
||||
static carouselInterface(element, config) {
|
||||
let data = Data.getData(element, DATA_KEY);
|
||||
let data = Data.get(element, DATA_KEY);
|
||||
let _config = {
|
||||
...Default,
|
||||
...Manipulator.getDataAttributes(element),
|
||||
|
@ -597,7 +600,7 @@ class Carousel extends BaseComponent {
|
|||
Carousel.carouselInterface(target, config);
|
||||
|
||||
if (slideIndex) {
|
||||
Data.getData(target, DATA_KEY).to(slideIndex);
|
||||
Data.get(target, DATA_KEY).to(slideIndex);
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
@ -616,7 +619,7 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
|||
const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
|
||||
|
||||
for (let i = 0, len = carousels.length; i < len; i++) {
|
||||
Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY));
|
||||
Carousel.carouselInterface(carousels[i], Data.get(carousels[i], DATA_KEY));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): collapse.js
|
||||
* Bootstrap (v5.0.0-beta3): collapse.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -72,8 +72,8 @@ class Collapse extends BaseComponent {
|
|||
this._isTransitioning = false;
|
||||
this._config = this._getConfig(config);
|
||||
this._triggerArray = SelectorEngine.find(
|
||||
`${SELECTOR_DATA_TOGGLE}[href="#${element.id}"],` +
|
||||
`${SELECTOR_DATA_TOGGLE}[data-bs-target="#${element.id}"]`
|
||||
`${SELECTOR_DATA_TOGGLE}[href="#${this._element.id}"],` +
|
||||
`${SELECTOR_DATA_TOGGLE}[data-bs-target="#${this._element.id}"]`
|
||||
);
|
||||
|
||||
const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
|
||||
|
@ -82,7 +82,7 @@ class Collapse extends BaseComponent {
|
|||
const elem = toggleList[i];
|
||||
const selector = getSelectorFromElement(elem);
|
||||
const filterElement = SelectorEngine.find(selector).filter(
|
||||
(foundElem) => foundElem === element
|
||||
(foundElem) => foundElem === this._element
|
||||
);
|
||||
|
||||
if (selector !== null && filterElement.length) {
|
||||
|
@ -147,7 +147,7 @@ class Collapse extends BaseComponent {
|
|||
const container = SelectorEngine.findOne(this._selector);
|
||||
if (actives) {
|
||||
const tempActiveData = actives.find((elem) => container !== elem);
|
||||
activesData = tempActiveData ? Data.getData(tempActiveData, DATA_KEY) : null;
|
||||
activesData = tempActiveData ? Data.get(tempActiveData, DATA_KEY) : null;
|
||||
|
||||
if (activesData && activesData._isTransitioning) {
|
||||
return;
|
||||
|
@ -166,7 +166,7 @@ class Collapse extends BaseComponent {
|
|||
}
|
||||
|
||||
if (!activesData) {
|
||||
Data.setData(elemActive, DATA_KEY, null);
|
||||
Data.set(elemActive, DATA_KEY, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ class Collapse extends BaseComponent {
|
|||
// Static
|
||||
|
||||
static collapseInterface(element, config) {
|
||||
let data = Data.getData(element, DATA_KEY);
|
||||
let data = Data.get(element, DATA_KEY);
|
||||
const _config = {
|
||||
...Default,
|
||||
...Manipulator.getDataAttributes(element),
|
||||
|
@ -379,7 +379,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
|
|||
const selectorElements = SelectorEngine.find(selector);
|
||||
|
||||
selectorElements.forEach((element) => {
|
||||
const data = Data.getData(element, DATA_KEY);
|
||||
const data = Data.get(element, DATA_KEY);
|
||||
let config;
|
||||
if (data) {
|
||||
// update parent attribute
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/data.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/data.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -11,57 +11,51 @@
|
|||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const mapData = (() => {
|
||||
const storeData = {};
|
||||
let id = 1;
|
||||
return {
|
||||
set(element, key, data) {
|
||||
if (typeof element.bsKey === 'undefined') {
|
||||
element.bsKey = {
|
||||
key,
|
||||
id,
|
||||
};
|
||||
id++;
|
||||
}
|
||||
const elementMap = new Map();
|
||||
|
||||
storeData[element.bsKey.id] = data;
|
||||
},
|
||||
get(element, key) {
|
||||
if (!element || typeof element.bsKey === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
export default {
|
||||
set(element, key, instance) {
|
||||
if (!elementMap.has(element)) {
|
||||
elementMap.set(element, new Map());
|
||||
}
|
||||
|
||||
const keyProperties = element.bsKey;
|
||||
if (keyProperties.key === key) {
|
||||
return storeData[keyProperties.id];
|
||||
}
|
||||
const instanceMap = elementMap.get(element);
|
||||
|
||||
return null;
|
||||
},
|
||||
delete(element, key) {
|
||||
if (typeof element.bsKey === 'undefined') {
|
||||
return;
|
||||
}
|
||||
// make it clear we only want one instance per element
|
||||
// can be removed later when multiple key/instances are fine to be used
|
||||
if (!instanceMap.has(key) && instanceMap.size !== 0) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
`Bootstrap doesn't allow more than one instance per element. Bound instance: ${
|
||||
Array.from(instanceMap.keys())[0]
|
||||
}.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const keyProperties = element.bsKey;
|
||||
if (keyProperties.key === key) {
|
||||
delete storeData[keyProperties.id];
|
||||
delete element.bsKey;
|
||||
}
|
||||
},
|
||||
};
|
||||
})();
|
||||
|
||||
const Data = {
|
||||
setData(instance, key, data) {
|
||||
mapData.set(instance, key, data);
|
||||
instanceMap.set(key, instance);
|
||||
},
|
||||
getData(instance, key) {
|
||||
return mapData.get(instance, key);
|
||||
|
||||
get(element, key) {
|
||||
if (elementMap.has(element)) {
|
||||
return elementMap.get(element).get(key) || null;
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
removeData(instance, key) {
|
||||
mapData.delete(instance, key);
|
||||
|
||||
remove(element, key) {
|
||||
if (!elementMap.has(element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const instanceMap = elementMap.get(element);
|
||||
|
||||
instanceMap.delete(key);
|
||||
|
||||
// free up element references if there are no instances left for an element
|
||||
if (instanceMap.size === 0) {
|
||||
elementMap.delete(element);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default Data;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/event-handler.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/event-handler.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -112,6 +112,7 @@ function bootstrapDelegationHandler(element, selector, fn) {
|
|||
event.delegateTarget = target;
|
||||
|
||||
if (handler.oneOff) {
|
||||
// eslint-disable-next-line unicorn/consistent-destructuring
|
||||
EventHandler.off(element, event.type, fn);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/manipulator.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/manipulator.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dom/selector-engine.js
|
||||
* Bootstrap (v5.0.0-beta3): dom/selector-engine.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -14,10 +14,6 @@
|
|||
const NODE_TEXT = 3;
|
||||
|
||||
const SelectorEngine = {
|
||||
matches(element, selector) {
|
||||
return element.matches(selector);
|
||||
},
|
||||
|
||||
find(selector, element = document.documentElement) {
|
||||
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
||||
},
|
||||
|
@ -27,9 +23,7 @@ const SelectorEngine = {
|
|||
},
|
||||
|
||||
children(element, selector) {
|
||||
const children = [].concat(...element.children);
|
||||
|
||||
return children.filter((child) => child.matches(selector));
|
||||
return [].concat(...element.children).filter((child) => child.matches(selector));
|
||||
},
|
||||
|
||||
parents(element, selector) {
|
||||
|
@ -38,7 +32,7 @@ const SelectorEngine = {
|
|||
let ancestor = element.parentNode;
|
||||
|
||||
while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
|
||||
if (this.matches(ancestor, selector)) {
|
||||
if (ancestor.matches(selector)) {
|
||||
parents.push(ancestor);
|
||||
}
|
||||
|
||||
|
@ -66,7 +60,7 @@ const SelectorEngine = {
|
|||
let next = element.nextElementSibling;
|
||||
|
||||
while (next) {
|
||||
if (this.matches(next, selector)) {
|
||||
if (next.matches(selector)) {
|
||||
return [next];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): dropdown.js
|
||||
* Bootstrap (v5.0.0-beta3): dropdown.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -59,21 +59,19 @@ const CLASS_NAME_DROPSTART = 'dropstart';
|
|||
const CLASS_NAME_NAVBAR = 'navbar';
|
||||
|
||||
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="dropdown"]';
|
||||
const SELECTOR_FORM_CHILD = '.dropdown form';
|
||||
const SELECTOR_MENU = '.dropdown-menu';
|
||||
const SELECTOR_NAVBAR_NAV = '.navbar-nav';
|
||||
const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
|
||||
|
||||
const PLACEMENT_TOP = isRTL ? 'top-end' : 'top-start';
|
||||
const PLACEMENT_TOPEND = isRTL ? 'top-start' : 'top-end';
|
||||
const PLACEMENT_BOTTOM = isRTL ? 'bottom-end' : 'bottom-start';
|
||||
const PLACEMENT_BOTTOMEND = isRTL ? 'bottom-start' : 'bottom-end';
|
||||
const PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start';
|
||||
const PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start';
|
||||
const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start';
|
||||
const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end';
|
||||
const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
|
||||
const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
|
||||
const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
|
||||
const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
|
||||
|
||||
const Default = {
|
||||
offset: [0, 2],
|
||||
flip: true,
|
||||
boundary: 'clippingParents',
|
||||
reference: 'toggle',
|
||||
display: 'dynamic',
|
||||
|
@ -82,7 +80,6 @@ const Default = {
|
|||
|
||||
const DefaultType = {
|
||||
offset: '(array|string|function)',
|
||||
flip: 'boolean',
|
||||
boundary: '(string|element)',
|
||||
reference: '(string|element|object)',
|
||||
display: 'string',
|
||||
|
@ -242,7 +239,6 @@ class Dropdown extends BaseComponent {
|
|||
}
|
||||
|
||||
dispose() {
|
||||
super.dispose();
|
||||
EventHandler.off(this._element, EVENT_KEY);
|
||||
this._menu = null;
|
||||
|
||||
|
@ -250,6 +246,8 @@ class Dropdown extends BaseComponent {
|
|||
this._popper.destroy();
|
||||
this._popper = null;
|
||||
}
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
update() {
|
||||
|
@ -264,7 +262,6 @@ class Dropdown extends BaseComponent {
|
|||
_addEventListeners() {
|
||||
EventHandler.on(this._element, EVENT_CLICK, (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.toggle();
|
||||
});
|
||||
}
|
||||
|
@ -342,7 +339,6 @@ class Dropdown extends BaseComponent {
|
|||
{
|
||||
name: 'preventOverflow',
|
||||
options: {
|
||||
altBoundary: this._config.flip,
|
||||
boundary: this._config.boundary,
|
||||
},
|
||||
},
|
||||
|
@ -376,7 +372,7 @@ class Dropdown extends BaseComponent {
|
|||
// Static
|
||||
|
||||
static dropdownInterface(element, config) {
|
||||
let data = Data.getData(element, DATA_KEY);
|
||||
let data = Data.get(element, DATA_KEY);
|
||||
const _config = typeof config === 'object' ? config : null;
|
||||
|
||||
if (!data) {
|
||||
|
@ -399,17 +395,23 @@ class Dropdown extends BaseComponent {
|
|||
}
|
||||
|
||||
static clearMenus(event) {
|
||||
if (
|
||||
event &&
|
||||
(event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY))
|
||||
) {
|
||||
return;
|
||||
if (event) {
|
||||
if (
|
||||
event.button === RIGHT_MOUSE_BUTTON ||
|
||||
(event.type === 'keyup' && event.key !== TAB_KEY)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (/input|select|textarea|form/i.test(event.target.tagName)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
|
||||
|
||||
for (let i = 0, len = toggles.length; i < len; i++) {
|
||||
const context = Data.getData(toggles[i], DATA_KEY);
|
||||
const context = Data.get(toggles[i], DATA_KEY);
|
||||
const relatedTarget = {
|
||||
relatedTarget: toggles[i],
|
||||
};
|
||||
|
@ -427,13 +429,20 @@ class Dropdown extends BaseComponent {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
event &&
|
||||
((event.type === 'click' && /input|textarea/i.test(event.target.tagName)) ||
|
||||
(event.type === 'keyup' && event.key === TAB_KEY)) &&
|
||||
dropdownMenu.contains(event.target)
|
||||
) {
|
||||
continue;
|
||||
if (event) {
|
||||
// Don't close the menu if the clicked element or one of its parents is the dropdown button
|
||||
if ([context._element].some((element) => event.composedPath().includes(element))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Tab navigation through the dropdown menu shouldn't close the menu
|
||||
if (
|
||||
event.type === 'keyup' &&
|
||||
event.key === TAB_KEY &&
|
||||
dropdownMenu.contains(event.target)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
const hideEvent = EventHandler.trigger(toggles[i], EVENT_HIDE, relatedTarget);
|
||||
|
@ -559,10 +568,8 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus);
|
|||
EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
|
||||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
Dropdown.dropdownInterface(this, 'toggle');
|
||||
Dropdown.dropdownInterface(this);
|
||||
});
|
||||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, (e) => e.stopPropagation());
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): modal.js
|
||||
* Bootstrap (v5.0.0-beta3): modal.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -83,7 +83,7 @@ class Modal extends BaseComponent {
|
|||
super(element);
|
||||
|
||||
this._config = this._getConfig(config);
|
||||
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element);
|
||||
this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
|
||||
this._backdrop = null;
|
||||
this._isShown = false;
|
||||
this._isBodyOverflowing = false;
|
||||
|
@ -113,7 +113,7 @@ class Modal extends BaseComponent {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this._element.classList.contains(CLASS_NAME_FADE)) {
|
||||
if (this._isAnimated()) {
|
||||
this._isTransitioning = true;
|
||||
}
|
||||
|
||||
|
@ -166,9 +166,9 @@ class Modal extends BaseComponent {
|
|||
}
|
||||
|
||||
this._isShown = false;
|
||||
const transition = this._element.classList.contains(CLASS_NAME_FADE);
|
||||
const isAnimated = this._isAnimated();
|
||||
|
||||
if (transition) {
|
||||
if (isAnimated) {
|
||||
this._isTransitioning = true;
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ class Modal extends BaseComponent {
|
|||
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
|
||||
EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
|
||||
|
||||
if (transition) {
|
||||
if (isAnimated) {
|
||||
const transitionDuration = getTransitionDurationFromElement(this._element);
|
||||
|
||||
EventHandler.one(this._element, 'transitionend', (event) => this._hideModal(event));
|
||||
|
@ -232,7 +232,7 @@ class Modal extends BaseComponent {
|
|||
}
|
||||
|
||||
_showElement(relatedTarget) {
|
||||
const transition = this._element.classList.contains(CLASS_NAME_FADE);
|
||||
const isAnimated = this._isAnimated();
|
||||
const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
|
||||
|
||||
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
||||
|
@ -250,7 +250,7 @@ class Modal extends BaseComponent {
|
|||
modalBody.scrollTop = 0;
|
||||
}
|
||||
|
||||
if (transition) {
|
||||
if (isAnimated) {
|
||||
reflow(this._element);
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ class Modal extends BaseComponent {
|
|||
});
|
||||
};
|
||||
|
||||
if (transition) {
|
||||
if (isAnimated) {
|
||||
const transitionDuration = getTransitionDurationFromElement(this._dialog);
|
||||
|
||||
EventHandler.one(this._dialog, 'transitionend', transitionComplete);
|
||||
|
@ -337,14 +337,13 @@ class Modal extends BaseComponent {
|
|||
}
|
||||
|
||||
_showBackdrop(callback) {
|
||||
const animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
|
||||
|
||||
const isAnimated = this._isAnimated();
|
||||
if (this._isShown && this._config.backdrop) {
|
||||
this._backdrop = document.createElement('div');
|
||||
this._backdrop.className = CLASS_NAME_BACKDROP;
|
||||
|
||||
if (animate) {
|
||||
this._backdrop.classList.add(animate);
|
||||
if (isAnimated) {
|
||||
this._backdrop.classList.add(CLASS_NAME_FADE);
|
||||
}
|
||||
|
||||
document.body.appendChild(this._backdrop);
|
||||
|
@ -366,13 +365,13 @@ class Modal extends BaseComponent {
|
|||
}
|
||||
});
|
||||
|
||||
if (animate) {
|
||||
if (isAnimated) {
|
||||
reflow(this._backdrop);
|
||||
}
|
||||
|
||||
this._backdrop.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
if (!animate) {
|
||||
if (!isAnimated) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
@ -389,7 +388,7 @@ class Modal extends BaseComponent {
|
|||
callback();
|
||||
};
|
||||
|
||||
if (this._element.classList.contains(CLASS_NAME_FADE)) {
|
||||
if (isAnimated) {
|
||||
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
|
||||
EventHandler.one(this._backdrop, 'transitionend', callbackRemove);
|
||||
emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
|
||||
|
@ -401,6 +400,10 @@ class Modal extends BaseComponent {
|
|||
}
|
||||
}
|
||||
|
||||
_isAnimated() {
|
||||
return this._element.classList.contains(CLASS_NAME_FADE);
|
||||
}
|
||||
|
||||
_triggerBackdropTransition() {
|
||||
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
|
||||
if (hideEvent.defaultPrevented) {
|
||||
|
@ -437,15 +440,15 @@ class Modal extends BaseComponent {
|
|||
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
||||
|
||||
if (
|
||||
(!this._isBodyOverflowing && isModalOverflowing && !isRTL) ||
|
||||
(this._isBodyOverflowing && !isModalOverflowing && isRTL)
|
||||
(!this._isBodyOverflowing && isModalOverflowing && !isRTL()) ||
|
||||
(this._isBodyOverflowing && !isModalOverflowing && isRTL())
|
||||
) {
|
||||
this._element.style.paddingLeft = `${this._scrollbarWidth}px`;
|
||||
}
|
||||
|
||||
if (
|
||||
(this._isBodyOverflowing && !isModalOverflowing && !isRTL) ||
|
||||
(!this._isBodyOverflowing && isModalOverflowing && isRTL)
|
||||
(this._isBodyOverflowing && !isModalOverflowing && !isRTL()) ||
|
||||
(!this._isBodyOverflowing && isModalOverflowing && isRTL())
|
||||
) {
|
||||
this._element.style.paddingRight = `${this._scrollbarWidth}px`;
|
||||
}
|
||||
|
@ -486,6 +489,13 @@ class Modal extends BaseComponent {
|
|||
|
||||
_setElementAttributes(selector, styleProp, callback) {
|
||||
SelectorEngine.find(selector).forEach((element) => {
|
||||
if (
|
||||
element !== document.body &&
|
||||
window.innerWidth > element.clientWidth + this._scrollbarWidth
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const actualValue = element.style[styleProp];
|
||||
const calculatedValue = window.getComputedStyle(element)[styleProp];
|
||||
Manipulator.setDataAttribute(element, styleProp, actualValue);
|
||||
|
@ -525,7 +535,7 @@ class Modal extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config, relatedTarget) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
const _config = {
|
||||
...Default,
|
||||
...Manipulator.getDataAttributes(this),
|
||||
|
@ -573,7 +583,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
|
|||
});
|
||||
});
|
||||
|
||||
let data = Data.getData(target, DATA_KEY);
|
||||
let data = Data.get(target, DATA_KEY);
|
||||
if (!data) {
|
||||
const config = {
|
||||
...Manipulator.getDataAttributes(target),
|
||||
|
|
284
src/js/bootstrap/src/offcanvas.js
Normal file
284
src/js/bootstrap/src/offcanvas.js
Normal file
|
@ -0,0 +1,284 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): offcanvas.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import {
|
||||
defineJQueryPlugin,
|
||||
getElementFromSelector,
|
||||
getSelectorFromElement,
|
||||
getTransitionDurationFromElement,
|
||||
isDisabled,
|
||||
isVisible,
|
||||
typeCheckConfig,
|
||||
} from './util/index';
|
||||
import { hide as scrollBarHide, reset as scrollBarReset } from './util/scrollbar';
|
||||
import Data from './dom/data';
|
||||
import EventHandler from './dom/event-handler';
|
||||
import BaseComponent from './base-component';
|
||||
import SelectorEngine from './dom/selector-engine';
|
||||
import Manipulator from './dom/manipulator';
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const NAME = 'offcanvas';
|
||||
const DATA_KEY = 'bs.offcanvas';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const DATA_API_KEY = '.data-api';
|
||||
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const ESCAPE_KEY = 'Escape';
|
||||
|
||||
const Default = {
|
||||
backdrop: true,
|
||||
keyboard: true,
|
||||
scroll: false,
|
||||
};
|
||||
|
||||
const DefaultType = {
|
||||
backdrop: 'boolean',
|
||||
keyboard: 'boolean',
|
||||
scroll: 'boolean',
|
||||
};
|
||||
|
||||
const CLASS_NAME_BACKDROP_BODY = 'offcanvas-backdrop';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
const CLASS_NAME_TOGGLING = 'offcanvas-toggling';
|
||||
const OPEN_SELECTOR = '.offcanvas.show';
|
||||
const ACTIVE_SELECTOR = `${OPEN_SELECTOR}, .${CLASS_NAME_TOGGLING}`;
|
||||
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
||||
|
||||
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="offcanvas"]';
|
||||
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="offcanvas"]';
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
class Offcanvas extends BaseComponent {
|
||||
constructor(element, config) {
|
||||
super(element);
|
||||
|
||||
this._config = this._getConfig(config);
|
||||
this._isShown = false;
|
||||
this._addEventListeners();
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
||||
static get Default() {
|
||||
return Default;
|
||||
}
|
||||
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY;
|
||||
}
|
||||
|
||||
// Public
|
||||
|
||||
toggle(relatedTarget) {
|
||||
return this._isShown ? this.hide() : this.show(relatedTarget);
|
||||
}
|
||||
|
||||
show(relatedTarget) {
|
||||
if (this._isShown) {
|
||||
return;
|
||||
}
|
||||
|
||||
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { relatedTarget });
|
||||
|
||||
if (showEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._isShown = true;
|
||||
this._element.style.visibility = 'visible';
|
||||
|
||||
if (this._config.backdrop) {
|
||||
document.body.classList.add(CLASS_NAME_BACKDROP_BODY);
|
||||
}
|
||||
|
||||
if (!this._config.scroll) {
|
||||
scrollBarHide();
|
||||
}
|
||||
|
||||
this._element.classList.add(CLASS_NAME_TOGGLING);
|
||||
this._element.removeAttribute('aria-hidden');
|
||||
this._element.setAttribute('aria-modal', true);
|
||||
this._element.setAttribute('role', 'dialog');
|
||||
this._element.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
const completeCallBack = () => {
|
||||
this._element.classList.remove(CLASS_NAME_TOGGLING);
|
||||
EventHandler.trigger(this._element, EVENT_SHOWN, { relatedTarget });
|
||||
this._enforceFocusOnElement(this._element);
|
||||
};
|
||||
|
||||
setTimeout(completeCallBack, getTransitionDurationFromElement(this._element));
|
||||
}
|
||||
|
||||
hide() {
|
||||
if (!this._isShown) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
|
||||
|
||||
if (hideEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._element.classList.add(CLASS_NAME_TOGGLING);
|
||||
EventHandler.off(document, EVENT_FOCUSIN);
|
||||
this._element.blur();
|
||||
this._isShown = false;
|
||||
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||
|
||||
const completeCallback = () => {
|
||||
this._element.setAttribute('aria-hidden', true);
|
||||
this._element.removeAttribute('aria-modal');
|
||||
this._element.removeAttribute('role');
|
||||
this._element.style.visibility = 'hidden';
|
||||
|
||||
if (this._config.backdrop) {
|
||||
document.body.classList.remove(CLASS_NAME_BACKDROP_BODY);
|
||||
}
|
||||
|
||||
if (!this._config.scroll) {
|
||||
scrollBarReset();
|
||||
}
|
||||
|
||||
EventHandler.trigger(this._element, EVENT_HIDDEN);
|
||||
this._element.classList.remove(CLASS_NAME_TOGGLING);
|
||||
};
|
||||
|
||||
setTimeout(completeCallback, getTransitionDurationFromElement(this._element));
|
||||
}
|
||||
|
||||
// Private
|
||||
|
||||
_getConfig(config) {
|
||||
config = {
|
||||
...Default,
|
||||
...Manipulator.getDataAttributes(this._element),
|
||||
...(typeof config === 'object' ? config : {}),
|
||||
};
|
||||
typeCheckConfig(NAME, config, DefaultType);
|
||||
return config;
|
||||
}
|
||||
|
||||
_enforceFocusOnElement(element) {
|
||||
EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
|
||||
EventHandler.on(document, EVENT_FOCUSIN, (event) => {
|
||||
if (
|
||||
document !== event.target &&
|
||||
element !== event.target &&
|
||||
!element.contains(event.target)
|
||||
) {
|
||||
element.focus();
|
||||
}
|
||||
});
|
||||
element.focus();
|
||||
}
|
||||
|
||||
_addEventListeners() {
|
||||
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
|
||||
|
||||
EventHandler.on(document, 'keydown', (event) => {
|
||||
if (this._config.keyboard && event.key === ESCAPE_KEY) {
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
|
||||
EventHandler.on(document, EVENT_CLICK_DATA_API, (event) => {
|
||||
const target = SelectorEngine.findOne(getSelectorFromElement(event.target));
|
||||
if (!this._element.contains(event.target) && target !== this._element) {
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Static
|
||||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
const data =
|
||||
Data.get(this, DATA_KEY) || new Offcanvas(this, typeof config === 'object' ? config : {});
|
||||
|
||||
if (typeof config !== 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config](this);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Data Api implementation
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
||||
const target = getElementFromSelector(this);
|
||||
|
||||
if (['A', 'AREA'].includes(this.tagName)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (isDisabled(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
EventHandler.one(target, EVENT_HIDDEN, () => {
|
||||
// focus on trigger when it is closed
|
||||
if (isVisible(this)) {
|
||||
this.focus();
|
||||
}
|
||||
});
|
||||
|
||||
// avoid conflict when clicking a toggler of an offcanvas, while another is open
|
||||
const allReadyOpen = SelectorEngine.findOne(ACTIVE_SELECTOR);
|
||||
if (allReadyOpen && allReadyOpen !== target) {
|
||||
return;
|
||||
}
|
||||
|
||||
const data = Data.get(target, DATA_KEY) || new Offcanvas(target);
|
||||
|
||||
data.toggle(this);
|
||||
});
|
||||
|
||||
EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
|
||||
SelectorEngine.find(OPEN_SELECTOR).forEach((el) =>
|
||||
(Data.get(el, DATA_KEY) || new Offcanvas(el)).show()
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* jQuery
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
defineJQueryPlugin(NAME, Offcanvas);
|
||||
|
||||
export default Offcanvas;
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): popover.js
|
||||
* Bootstrap (v5.0.0-beta3): popover.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -136,7 +136,7 @@ class Popover extends Tooltip {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
const _config = typeof config === 'object' ? config : null;
|
||||
|
||||
if (!data && /dispose|hide/.test(config)) {
|
||||
|
@ -145,7 +145,7 @@ class Popover extends Tooltip {
|
|||
|
||||
if (!data) {
|
||||
data = new Popover(this, _config);
|
||||
Data.setData(this, DATA_KEY, data);
|
||||
Data.set(this, DATA_KEY, data);
|
||||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): scrollspy.js
|
||||
* Bootstrap (v5.0.0-beta3): scrollspy.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -68,7 +68,7 @@ const METHOD_POSITION = 'position';
|
|||
class ScrollSpy extends BaseComponent {
|
||||
constructor(element, config) {
|
||||
super(element);
|
||||
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
||||
this._scrollElement = this._element.tagName === 'BODY' ? window : this._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._offsets = [];
|
||||
|
@ -276,7 +276,7 @@ class ScrollSpy extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
const _config = typeof config === 'object' && config;
|
||||
|
||||
if (!data) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): tab.js
|
||||
* Bootstrap (v5.0.0-beta3): tab.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -10,6 +10,7 @@ import {
|
|||
emulateTransitionEnd,
|
||||
getElementFromSelector,
|
||||
getTransitionDurationFromElement,
|
||||
isDisabled,
|
||||
reflow,
|
||||
} from './util/index';
|
||||
import Data from './dom/data';
|
||||
|
@ -36,7 +37,6 @@ const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
|||
|
||||
const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
|
||||
const CLASS_NAME_ACTIVE = 'active';
|
||||
const CLASS_NAME_DISABLED = 'disabled';
|
||||
const CLASS_NAME_FADE = 'fade';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
|
||||
|
@ -69,7 +69,7 @@ class Tab extends BaseComponent {
|
|||
(this._element.parentNode &&
|
||||
this._element.parentNode.nodeType === Node.ELEMENT_NODE &&
|
||||
this._element.classList.contains(CLASS_NAME_ACTIVE)) ||
|
||||
this._element.classList.contains(CLASS_NAME_DISABLED)
|
||||
isDisabled(this._element)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ class Tab extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
const data = Data.getData(this, DATA_KEY) || new Tab(this);
|
||||
const data = Data.get(this, DATA_KEY) || new Tab(this);
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
|
@ -215,7 +215,7 @@ class Tab extends BaseComponent {
|
|||
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
const data = Data.getData(this, DATA_KEY) || new Tab(this);
|
||||
const data = Data.get(this, DATA_KEY) || new Tab(this);
|
||||
data.show();
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): toast.js
|
||||
* Bootstrap (v5.0.0-beta3): toast.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -189,7 +189,7 @@ class Toast extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
const _config = typeof config === 'object' && config;
|
||||
|
||||
if (!data) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): tooltip.js
|
||||
* Bootstrap (v5.0.0-beta3): tooltip.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -61,9 +61,9 @@ const DefaultType = {
|
|||
const AttachmentMap = {
|
||||
AUTO: 'auto',
|
||||
TOP: 'top',
|
||||
RIGHT: isRTL ? 'left' : 'right',
|
||||
RIGHT: isRTL() ? 'left' : 'right',
|
||||
BOTTOM: 'bottom',
|
||||
LEFT: isRTL ? 'right' : 'left',
|
||||
LEFT: isRTL() ? 'right' : 'left',
|
||||
};
|
||||
|
||||
const Default = {
|
||||
|
@ -279,15 +279,18 @@ class Tooltip extends BaseComponent {
|
|||
this._addAttachmentClass(attachment);
|
||||
|
||||
const container = this._getContainer();
|
||||
Data.setData(tip, this.constructor.DATA_KEY, this);
|
||||
Data.set(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);
|
||||
}
|
||||
|
||||
EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
|
||||
|
||||
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
||||
if (this._popper) {
|
||||
this._popper.update();
|
||||
} else {
|
||||
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
|
||||
}
|
||||
|
||||
tip.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
|
@ -336,6 +339,10 @@ class Tooltip extends BaseComponent {
|
|||
|
||||
const tip = this.getTipElement();
|
||||
const complete = () => {
|
||||
if (this._isWithActiveTrigger()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
|
||||
tip.parentNode.removeChild(tip);
|
||||
}
|
||||
|
@ -474,11 +481,11 @@ class Tooltip extends BaseComponent {
|
|||
|
||||
_initializeOnDelegatedTarget(event, context) {
|
||||
const dataKey = this.constructor.DATA_KEY;
|
||||
context = context || Data.getData(event.delegateTarget, dataKey);
|
||||
context = context || Data.get(event.delegateTarget, dataKey);
|
||||
|
||||
if (!context) {
|
||||
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
||||
Data.setData(event.delegateTarget, dataKey, context);
|
||||
Data.set(event.delegateTarget, dataKey, context);
|
||||
}
|
||||
|
||||
return context;
|
||||
|
@ -671,7 +678,9 @@ class Tooltip extends BaseComponent {
|
|||
context = this._initializeOnDelegatedTarget(event, context);
|
||||
|
||||
if (event) {
|
||||
context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
|
||||
context._activeTrigger[
|
||||
event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER
|
||||
] = context._element.contains(event.relatedTarget);
|
||||
}
|
||||
|
||||
if (context._isWithActiveTrigger()) {
|
||||
|
@ -785,7 +794,7 @@ class Tooltip extends BaseComponent {
|
|||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
let data = Data.getData(this, DATA_KEY);
|
||||
let data = Data.get(this, DATA_KEY);
|
||||
const _config = typeof config === 'object' && config;
|
||||
|
||||
if (!data && /dispose|hide/.test(config)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/index.js
|
||||
* Bootstrap (v5.0.0-beta3): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -39,7 +39,20 @@ const getSelector = (element) => {
|
|||
let selector = element.getAttribute('data-bs-target');
|
||||
|
||||
if (!selector || selector === '#') {
|
||||
const hrefAttr = element.getAttribute('href');
|
||||
let hrefAttr = element.getAttribute('href');
|
||||
|
||||
// The only valid content that could double as a selector are IDs or classes,
|
||||
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
||||
// `document.querySelector` will rightfully complain it is invalid.
|
||||
// See https://github.com/twbs/bootstrap/issues/32273
|
||||
if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Just in case some CMS puts out a full URL with the anchor appended
|
||||
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
|
||||
hrefAttr = '#' + hrefAttr.split('#')[1];
|
||||
}
|
||||
|
||||
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
|
||||
}
|
||||
|
@ -120,7 +133,7 @@ const typeCheckConfig = (componentName, config, configTypes) => {
|
|||
const valueType = value && isElement(value) ? 'element' : toType(value);
|
||||
|
||||
if (!new RegExp(expectedTypes).test(valueType)) {
|
||||
throw new Error(
|
||||
throw new TypeError(
|
||||
`${componentName.toUpperCase()}: ` +
|
||||
`Option "${property}" provided type "${valueType}" ` +
|
||||
`but expected type "${expectedTypes}".`
|
||||
|
@ -148,6 +161,22 @@ const isVisible = (element) => {
|
|||
return false;
|
||||
};
|
||||
|
||||
const isDisabled = (element) => {
|
||||
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (element.classList.contains('disabled')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof element.disabled !== 'undefined') {
|
||||
return element.disabled;
|
||||
}
|
||||
|
||||
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
||||
};
|
||||
|
||||
const findShadowRoot = (element) => {
|
||||
if (!document.documentElement.attachShadow) {
|
||||
return null;
|
||||
|
@ -193,7 +222,7 @@ const onDOMContentLoaded = (callback) => {
|
|||
}
|
||||
};
|
||||
|
||||
const isRTL = document.documentElement.dir === 'rtl';
|
||||
const isRTL = () => document.documentElement.dir === 'rtl';
|
||||
|
||||
const defineJQueryPlugin = (name, plugin) => {
|
||||
onDOMContentLoaded(() => {
|
||||
|
@ -212,7 +241,6 @@ const defineJQueryPlugin = (name, plugin) => {
|
|||
};
|
||||
|
||||
export {
|
||||
TRANSITION_END,
|
||||
getUID,
|
||||
getSelectorFromElement,
|
||||
getElementFromSelector,
|
||||
|
@ -222,6 +250,7 @@ export {
|
|||
emulateTransitionEnd,
|
||||
typeCheckConfig,
|
||||
isVisible,
|
||||
isDisabled,
|
||||
findShadowRoot,
|
||||
noop,
|
||||
reflow,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta2): util/sanitizer.js
|
||||
* Bootstrap (v5.0.0-beta3): util/sanitizer.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@ const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
|||
*
|
||||
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
||||
*/
|
||||
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
|
||||
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
|
||||
|
||||
/**
|
||||
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
||||
|
@ -38,7 +38,7 @@ const allowedAttribute = (attr, allowedAttributeList) => {
|
|||
if (allowedAttributeList.includes(attrName)) {
|
||||
if (uriAttrs.has(attrName)) {
|
||||
return Boolean(
|
||||
attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)
|
||||
SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ const allowedAttribute = (attr, allowedAttributeList) => {
|
|||
|
||||
// Check if a regular expression validates the attribute.
|
||||
for (let i = 0, len = regExp.length; i < len; i++) {
|
||||
if (attrName.match(regExp[i])) {
|
||||
if (regExp[i].test(attrName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
72
src/js/bootstrap/src/util/scrollbar.js
Normal file
72
src/js/bootstrap/src/util/scrollbar.js
Normal file
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.0-beta3): util/scrollBar.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
import SelectorEngine from '../dom/selector-engine';
|
||||
import Manipulator from '../dom/manipulator';
|
||||
|
||||
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed';
|
||||
const SELECTOR_STICKY_CONTENT = '.sticky-top';
|
||||
|
||||
const getWidth = () => {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
||||
const documentWidth = document.documentElement.clientWidth;
|
||||
return Math.abs(window.innerWidth - documentWidth);
|
||||
};
|
||||
|
||||
const hide = (width = getWidth()) => {
|
||||
document.body.style.overflow = 'hidden';
|
||||
_setElementAttributes(
|
||||
SELECTOR_FIXED_CONTENT,
|
||||
'paddingRight',
|
||||
(calculatedValue) => calculatedValue + width
|
||||
);
|
||||
_setElementAttributes(
|
||||
SELECTOR_STICKY_CONTENT,
|
||||
'marginRight',
|
||||
(calculatedValue) => calculatedValue - width
|
||||
);
|
||||
_setElementAttributes('body', 'paddingRight', (calculatedValue) => calculatedValue + width);
|
||||
};
|
||||
|
||||
const _setElementAttributes = (selector, styleProp, callback) => {
|
||||
const scrollbarWidth = getWidth();
|
||||
SelectorEngine.find(selector).forEach((element) => {
|
||||
if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
|
||||
return;
|
||||
}
|
||||
|
||||
const actualValue = element.style[styleProp];
|
||||
const calculatedValue = window.getComputedStyle(element)[styleProp];
|
||||
Manipulator.setDataAttribute(element, styleProp, actualValue);
|
||||
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
|
||||
});
|
||||
};
|
||||
|
||||
const reset = () => {
|
||||
document.body.style.overflow = 'auto';
|
||||
_resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
|
||||
_resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
|
||||
_resetElementAttributes('body', 'paddingRight');
|
||||
};
|
||||
|
||||
const _resetElementAttributes = (selector, styleProp) => {
|
||||
SelectorEngine.find(selector).forEach((element) => {
|
||||
const value = Manipulator.getDataAttribute(element, styleProp);
|
||||
if (typeof value === 'undefined' && element === document.body) {
|
||||
element.style.removeProperty(styleProp);
|
||||
} else {
|
||||
Manipulator.removeDataAttribute(element, styleProp);
|
||||
element.style[styleProp] = value;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const isBodyOverflowing = () => {
|
||||
return getWidth() > 0;
|
||||
};
|
||||
|
||||
export { getWidth, hide, isBodyOverflowing, reset };
|
|
@ -153,7 +153,14 @@ class Dropdown extends BSDropdown {
|
|||
|
||||
_bindShowEvent() {
|
||||
EventHandler.on(this._element, EVENT_SHOW, (e) => {
|
||||
EventHandler.trigger(this._element, EVENT_SHOW_MDB, { relatedTarget: e.relatedTarget });
|
||||
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW_MDB, {
|
||||
relatedTarget: e.relatedTarget,
|
||||
});
|
||||
|
||||
if (showEvent.defaultPrevented) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
this._dropdownAnimationStart('show');
|
||||
});
|
||||
|
@ -161,13 +168,27 @@ class Dropdown extends BSDropdown {
|
|||
|
||||
_bindShownEvent() {
|
||||
EventHandler.on(this._parent, EVENT_SHOWN, (e) => {
|
||||
EventHandler.trigger(this._parent, EVENT_SHOWN_MDB, { relatedTarget: e.relatedTarget });
|
||||
const shownEvent = EventHandler.trigger(this._parent, EVENT_SHOWN_MDB, {
|
||||
relatedTarget: e.relatedTarget,
|
||||
});
|
||||
|
||||
if (shownEvent.defaultPrevented) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_bindHideEvent() {
|
||||
EventHandler.on(this._parent, EVENT_HIDE, (e) => {
|
||||
EventHandler.trigger(this._parent, EVENT_HIDE_MDB, { relatedTarget: e.relatedTarget });
|
||||
const hideEvent = EventHandler.trigger(this._parent, EVENT_HIDE_MDB, {
|
||||
relatedTarget: e.relatedTarget,
|
||||
});
|
||||
|
||||
if (hideEvent.defaultPrevented) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
this._menuStyle = this._menu.style.cssText;
|
||||
this._popperPlacement = this._menu.getAttribute('data-popper-placement');
|
||||
|
@ -177,7 +198,14 @@ class Dropdown extends BSDropdown {
|
|||
|
||||
_bindHiddenEvent() {
|
||||
EventHandler.on(this._parent, EVENT_HIDDEN, (e) => {
|
||||
EventHandler.trigger(this._parent, EVENT_HIDDEN_MDB, { relatedTarget: e.relatedTarget });
|
||||
const hiddenEvent = EventHandler.trigger(this._parent, EVENT_HIDDEN_MDB, {
|
||||
relatedTarget: e.relatedTarget,
|
||||
});
|
||||
|
||||
if (hiddenEvent.defaultPrevented) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._config.display !== 'static' && this._menuStyle !== '') {
|
||||
this._menu.style.cssText = this._menuStyle;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// BOOTSTRAP CORE COMPONENTS
|
||||
import Button from './free/button';
|
||||
import Collapse from './bootstrap/mdb-prefix/collapse';
|
||||
import Offcanvas from './bootstrap/mdb-prefix/offcanvas';
|
||||
import Alert from './free/alert';
|
||||
import Carousel from './free/carousel';
|
||||
import Modal from './free/modal';
|
||||
|
@ -21,6 +22,7 @@ export {
|
|||
Button,
|
||||
Carousel,
|
||||
Collapse,
|
||||
Offcanvas,
|
||||
Dropdown,
|
||||
Input,
|
||||
Modal,
|
||||
|
|
|
@ -12,18 +12,15 @@
|
|||
color: $accordion-button-color;
|
||||
text-align: left; // Reset button style
|
||||
background-color: $accordion-button-bg;
|
||||
border: $accordion-border-width solid $accordion-border-color;
|
||||
border: 0;
|
||||
@include border-radius(0);
|
||||
overflow-anchor: none;
|
||||
@include transition($accordion-transition);
|
||||
|
||||
&.collapsed {
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
|
||||
&:not(.collapsed) {
|
||||
color: $accordion-button-active-color;
|
||||
background-color: $accordion-button-active-bg;
|
||||
box-shadow: inset 0 ($accordion-border-width * -1) 0 $accordion-border-color;
|
||||
|
||||
&::after {
|
||||
background-image: escape-svg($accordion-button-active-icon);
|
||||
|
@ -61,33 +58,35 @@
|
|||
}
|
||||
|
||||
.accordion-item {
|
||||
margin-bottom: -$accordion-border-width;
|
||||
background-color: $accordion-bg;
|
||||
border: $accordion-border-width solid $accordion-border-color;
|
||||
|
||||
&:first-of-type {
|
||||
@include border-top-radius($accordion-border-radius);
|
||||
|
||||
.accordion-button {
|
||||
@include border-top-radius($accordion-border-radius);
|
||||
@include border-top-radius($accordion-inner-border-radius);
|
||||
}
|
||||
}
|
||||
|
||||
// Only set a border-radius on the last item if the accordion is collapsed
|
||||
&:last-of-type {
|
||||
margin-bottom: 0;
|
||||
@include border-bottom-radius($accordion-border-radius);
|
||||
|
||||
.accordion-button {
|
||||
// Only set a border-radius on the last item if the accordion is collapsed
|
||||
&.collapsed {
|
||||
border-bottom-width: $accordion-border-width;
|
||||
@include border-bottom-radius($accordion-border-radius);
|
||||
@include border-bottom-radius($accordion-inner-border-radius);
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-collapse {
|
||||
border-bottom-width: $accordion-border-width;
|
||||
@include border-bottom-radius($accordion-border-radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.accordion-collapse {
|
||||
border: solid $accordion-border-color;
|
||||
border-width: 0 $accordion-border-width;
|
||||
}
|
||||
|
||||
.accordion-body {
|
||||
padding: $accordion-body-padding-y $accordion-body-padding-x;
|
||||
}
|
||||
|
@ -97,29 +96,24 @@
|
|||
// Remove borders and border-radius to keep accordion items edge-to-edge.
|
||||
|
||||
.accordion-flush {
|
||||
.accordion-button {
|
||||
border-right: 0;
|
||||
border-left: 0;
|
||||
@include border-radius(0);
|
||||
}
|
||||
|
||||
.accordion-collapse {
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
.accordion-item {
|
||||
&:first-of-type {
|
||||
.accordion-button {
|
||||
border-top-width: 0;
|
||||
@include border-top-radius(0);
|
||||
}
|
||||
border-right: 0;
|
||||
border-left: 0;
|
||||
@include border-radius(0);
|
||||
|
||||
&:first-child {
|
||||
border-top: 0;
|
||||
}
|
||||
&:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
&:last-of-type {
|
||||
.accordion-button.collapsed {
|
||||
border-bottom-width: 0;
|
||||
@include border-bottom-radius(0);
|
||||
}
|
||||
.accordion-button {
|
||||
@include border-radius(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
// Alternate buttons
|
||||
//
|
||||
|
||||
// scss-docs-start btn-variant-loops
|
||||
@each $color, $value in $theme-colors {
|
||||
.btn-#{$color} {
|
||||
@include button-variant($value, $value);
|
||||
|
@ -65,6 +66,7 @@
|
|||
@include button-outline-variant($value);
|
||||
}
|
||||
}
|
||||
// scss-docs-end btn-variant-loops
|
||||
|
||||
//
|
||||
// Link buttons
|
||||
|
|
|
@ -69,7 +69,6 @@
|
|||
}
|
||||
|
||||
+ .card-link {
|
||||
/*!rtl:ignore*/
|
||||
margin-left: $card-spacer-x;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,14 +74,11 @@
|
|||
// Allow for dropdowns to go bottom up (aka, dropup-menu)
|
||||
// Just add .dropup after the standard .dropdown class and you're set.
|
||||
.dropup {
|
||||
.dropdown-menu {
|
||||
.dropdown-menu[data-mdb-popper] {
|
||||
top: auto;
|
||||
bottom: 100%;
|
||||
|
||||
&[data-mdb-popper] {
|
||||
margin-top: 0;
|
||||
margin-bottom: $dropdown-spacer;
|
||||
}
|
||||
margin-top: 0;
|
||||
margin-bottom: $dropdown-spacer;
|
||||
}
|
||||
|
||||
.dropdown-toggle {
|
||||
|
|
|
@ -12,6 +12,17 @@
|
|||
@include border-radius($list-group-border-radius);
|
||||
}
|
||||
|
||||
.list-group-numbered {
|
||||
list-style-type: none;
|
||||
counter-reset: section;
|
||||
|
||||
> li::before {
|
||||
// Increments only this instance of the section counter
|
||||
content: counters(section, '.') '. ';
|
||||
counter-increment: section;
|
||||
}
|
||||
}
|
||||
|
||||
// Interactive list items
|
||||
//
|
||||
// Use anchor or button elements instead of `li`s or `div`s to create interactive
|
||||
|
|
|
@ -210,6 +210,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
// scss-docs-start modal-fullscreen-loop
|
||||
@each $breakpoint in map-keys($grid-breakpoints) {
|
||||
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
|
||||
$postfix: if($infix != '', $infix + '-down', '');
|
||||
|
@ -241,3 +242,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
// scss-docs-end modal-fullscreen-loop
|
||||
|
|
|
@ -115,6 +115,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
.nav-fill,
|
||||
.nav-justified {
|
||||
.nav-item .nav-link {
|
||||
width: 100%; // Make sure button will grow
|
||||
}
|
||||
}
|
||||
|
||||
// Tabbable tabs
|
||||
//
|
||||
// Hide tabbable panes to start, show them when `.active`
|
||||
|
|
|
@ -149,6 +149,7 @@
|
|||
overflow-y: auto;
|
||||
}
|
||||
|
||||
// scss-docs-start navbar-expand-loop
|
||||
// Generate series of `.navbar-expand-*` responsive classes for configuring
|
||||
// where your navbar collapses.
|
||||
.navbar-expand {
|
||||
|
@ -191,6 +192,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
// scss-docs-end navbar-expand-loop
|
||||
|
||||
// Navbar themes
|
||||
//
|
||||
|
|
77
src/scss/bootstrap-rtl-fix/_offcanvas.scss
Normal file
77
src/scss/bootstrap-rtl-fix/_offcanvas.scss
Normal file
|
@ -0,0 +1,77 @@
|
|||
.offcanvas {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
z-index: $zindex-offcanvas;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 100%;
|
||||
color: $offcanvas-color;
|
||||
visibility: hidden;
|
||||
background-color: $offcanvas-bg-color;
|
||||
background-clip: padding-box;
|
||||
outline: 0;
|
||||
@include box-shadow($offcanvas-box-shadow);
|
||||
@include transition(transform $offcanvas-transition-duration ease-in-out);
|
||||
}
|
||||
|
||||
.offcanvas-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: $offcanvas-padding-y $offcanvas-padding-x;
|
||||
|
||||
.btn-close {
|
||||
padding: ($offcanvas-padding-y / 2) ($offcanvas-padding-x / 2);
|
||||
margin: ($offcanvas-padding-y / -2) ($offcanvas-padding-x / -2) ($offcanvas-padding-y / -2) auto;
|
||||
}
|
||||
}
|
||||
|
||||
.offcanvas-title {
|
||||
margin-bottom: 0;
|
||||
line-height: $offcanvas-title-line-height;
|
||||
}
|
||||
|
||||
.offcanvas-body {
|
||||
flex-grow: 1;
|
||||
padding: $offcanvas-padding-y $offcanvas-padding-x;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.offcanvas-start {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: $offcanvas-horizontal-width;
|
||||
border-right: $offcanvas-border-width solid $offcanvas-border-color;
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
.offcanvas-end {
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: $offcanvas-horizontal-width;
|
||||
border-left: $offcanvas-border-width solid $offcanvas-border-color;
|
||||
transform: translateX(100%);
|
||||
}
|
||||
|
||||
.offcanvas-bottom {
|
||||
right: 0;
|
||||
left: 0;
|
||||
height: $offcanvas-vertical-height;
|
||||
max-height: 100%;
|
||||
border-top: $offcanvas-border-width solid $offcanvas-border-color;
|
||||
transform: translateY(100%);
|
||||
}
|
||||
|
||||
.offcanvas.show {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.offcanvas-backdrop::before {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: $zindex-offcanvas - 1;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
content: '';
|
||||
background-color: $offcanvas-body-backdrop-color;
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
// Disable animation if transitions are disabled
|
||||
|
||||
// scss-docs-start progress-keyframes
|
||||
@if $enable-transitions {
|
||||
@keyframes progress-bar-stripes {
|
||||
0% {
|
||||
|
@ -6,6 +8,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
// scss-docs-end progress-keyframes
|
||||
|
||||
.progress {
|
||||
display: flex;
|
||||
|
|
|
@ -52,19 +52,6 @@ body {
|
|||
-webkit-tap-highlight-color: rgba($black, 0); // 4
|
||||
}
|
||||
|
||||
// Future-proof rule: in browsers that support :focus-visible, suppress the focus outline
|
||||
// on elements that programmatically receive focus but wouldn't normally show a visible
|
||||
// focus outline. In general, this would mean that the outline is only applied if the
|
||||
// interaction that led to the element receiving programmatic focus was a keyboard interaction,
|
||||
// or the browser has somehow determined that the user is primarily a keyboard user and/or
|
||||
// wants focus outlines to always be presented.
|
||||
// See https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible
|
||||
// and https://developer.paciellogroup.com/blog/2018/03/focus-visible-and-backwards-compatibility/
|
||||
|
||||
[tabindex='-1']:focus:not(:focus-visible) {
|
||||
outline: 0 !important;
|
||||
}
|
||||
|
||||
// Content grouping
|
||||
//
|
||||
// 1. Reset Firefox's gray color
|
||||
|
@ -148,7 +135,6 @@ p {
|
|||
abbr[title],
|
||||
abbr[data-mdb-original-title] {
|
||||
// 1
|
||||
text-decoration: underline; // 2
|
||||
text-decoration: underline dotted; // 2
|
||||
cursor: help; // 3
|
||||
text-decoration-skip-ink: none; // 4
|
||||
|
@ -418,12 +404,10 @@ textarea {
|
|||
}
|
||||
|
||||
// Remove the inheritance of text transform in Firefox
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
// Set the cursor for non-`<button>` buttons
|
||||
//
|
||||
// Details at https://github.com/twbs/bootstrap/pull/30562
|
||||
|
@ -431,11 +415,15 @@ select {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
// Remove the inheritance of word-wrap in Safari.
|
||||
// See https://github.com/twbs/bootstrap/issues/24990
|
||||
|
||||
select {
|
||||
// Remove the inheritance of word-wrap in Safari.
|
||||
// See https://github.com/twbs/bootstrap/issues/24990
|
||||
word-wrap: normal;
|
||||
|
||||
// Undo the opacity change from Chrome
|
||||
&:disabled {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the dropdown arrow in Chrome from inputs built with datalists.
|
||||
|
@ -565,7 +553,6 @@ legend {
|
|||
|
||||
// Inherit font family and line height for file input buttons
|
||||
|
||||
// stylelint-disable-next-line selector-pseudo-element-no-unknown
|
||||
::file-selector-button {
|
||||
font: inherit;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user