administrate-bootstrap-theme 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/administrate-bootstrap-theme/components/_content_body.scss +16 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/theme.scss +12 -0
- data/lib/administrate-bootstrap-theme/version.rb +1 -1
- metadata +4 -85
- data/node_modules/bootstrap/LICENSE +0 -22
- data/node_modules/bootstrap/README.md +0 -239
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css +0 -4997
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css +0 -4996
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css +0 -426
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css +0 -8
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css +0 -423
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css +0 -8
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css +0 -4752
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css +0 -4743
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap.css +0 -10819
- data/node_modules/bootstrap/dist/css/bootstrap.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css +0 -10795
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.js +0 -6714
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.js.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js +0 -7
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js +0 -4944
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js +0 -7
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.js +0 -4993
- data/node_modules/bootstrap/dist/js/bootstrap.js.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.min.js +0 -7
- data/node_modules/bootstrap/dist/js/bootstrap.min.js.map +0 -1
- data/node_modules/bootstrap/js/dist/alert.js +0 -264
- data/node_modules/bootstrap/js/dist/alert.js.map +0 -1
- data/node_modules/bootstrap/js/dist/base-component.js +0 -62
- data/node_modules/bootstrap/js/dist/base-component.js.map +0 -1
- data/node_modules/bootstrap/js/dist/button.js +0 -146
- data/node_modules/bootstrap/js/dist/button.js.map +0 -1
- data/node_modules/bootstrap/js/dist/carousel.js +0 -757
- data/node_modules/bootstrap/js/dist/carousel.js.map +0 -1
- data/node_modules/bootstrap/js/dist/collapse.js +0 -551
- data/node_modules/bootstrap/js/dist/collapse.js.map +0 -1
- data/node_modules/bootstrap/js/dist/dom/data.js +0 -69
- data/node_modules/bootstrap/js/dist/dom/data.js.map +0 -1
- data/node_modules/bootstrap/js/dist/dom/event-handler.js +0 -305
- data/node_modules/bootstrap/js/dist/dom/event-handler.js.map +0 -1
- data/node_modules/bootstrap/js/dist/dom/manipulator.js +0 -89
- data/node_modules/bootstrap/js/dist/dom/manipulator.js.map +0 -1
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js +0 -86
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js.map +0 -1
- data/node_modules/bootstrap/js/dist/dropdown.js +0 -662
- data/node_modules/bootstrap/js/dist/dropdown.js.map +0 -1
- data/node_modules/bootstrap/js/dist/modal.js +0 -752
- data/node_modules/bootstrap/js/dist/modal.js.map +0 -1
- data/node_modules/bootstrap/js/dist/offcanvas.js +0 -509
- data/node_modules/bootstrap/js/dist/offcanvas.js.map +0 -1
- data/node_modules/bootstrap/js/dist/popover.js +0 -216
- data/node_modules/bootstrap/js/dist/popover.js.map +0 -1
- data/node_modules/bootstrap/js/dist/scrollspy.js +0 -400
- data/node_modules/bootstrap/js/dist/scrollspy.js.map +0 -1
- data/node_modules/bootstrap/js/dist/tab.js +0 -347
- data/node_modules/bootstrap/js/dist/tab.js.map +0 -1
- data/node_modules/bootstrap/js/dist/toast.js +0 -335
- data/node_modules/bootstrap/js/dist/toast.js.map +0 -1
- data/node_modules/bootstrap/js/dist/tooltip.js +0 -1055
- data/node_modules/bootstrap/js/dist/tooltip.js.map +0 -1
- data/node_modules/bootstrap/package.json +0 -177
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../src/util/index.js","../src/button.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta3): util/index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst MAX_UID = 1000000\nconst MILLISECONDS_MULTIPLIER = 1000\nconst TRANSITION_END = 'transitionend'\n\n// Shoutout AngusCroll (https://goo.gl/pxwQGp)\nconst toType = obj => {\n if (obj === null || obj === undefined) {\n return `${obj}`\n }\n\n return {}.toString.call(obj).match(/\\s([a-z]+)/i)[1].toLowerCase()\n}\n\n/**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\nconst getUID = prefix => {\n do {\n prefix += Math.floor(Math.random() * MAX_UID)\n } while (document.getElementById(prefix))\n\n return prefix\n}\n\nconst getSelector = element => {\n let selector = element.getAttribute('data-bs-target')\n\n if (!selector || selector === '#') {\n let hrefAttr = element.getAttribute('href')\n\n // The only valid content that could double as a selector are IDs or classes,\n // so everything starting with `#` or `.`. If a \"real\" URL is used as the selector,\n // `document.querySelector` will rightfully complain it is invalid.\n // See https://github.com/twbs/bootstrap/issues/32273\n if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {\n return null\n }\n\n // Just in case some CMS puts out a full URL with the anchor appended\n if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {\n hrefAttr = '#' + hrefAttr.split('#')[1]\n }\n\n selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null\n }\n\n return selector\n}\n\nconst getSelectorFromElement = element => {\n const selector = getSelector(element)\n\n if (selector) {\n return document.querySelector(selector) ? selector : null\n }\n\n return null\n}\n\nconst getElementFromSelector = element => {\n const selector = getSelector(element)\n\n return selector ? document.querySelector(selector) : null\n}\n\nconst getTransitionDurationFromElement = element => {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let { transitionDuration, transitionDelay } = window.getComputedStyle(element)\n\n const floatTransitionDuration = Number.parseFloat(transitionDuration)\n const floatTransitionDelay = Number.parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n}\n\nconst triggerTransitionEnd = element => {\n element.dispatchEvent(new Event(TRANSITION_END))\n}\n\nconst isElement = obj => (obj[0] || obj).nodeType\n\nconst emulateTransitionEnd = (element, duration) => {\n let called = false\n const durationPadding = 5\n const emulatedDuration = duration + durationPadding\n\n function listener() {\n called = true\n element.removeEventListener(TRANSITION_END, listener)\n }\n\n element.addEventListener(TRANSITION_END, listener)\n setTimeout(() => {\n if (!called) {\n triggerTransitionEnd(element)\n }\n }, emulatedDuration)\n}\n\nconst typeCheckConfig = (componentName, config, configTypes) => {\n Object.keys(configTypes).forEach(property => {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = value && isElement(value) ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new TypeError(\n `${componentName.toUpperCase()}: ` +\n `Option \"${property}\" provided type \"${valueType}\" ` +\n `but expected type \"${expectedTypes}\".`\n )\n }\n })\n}\n\nconst isVisible = element => {\n if (!element) {\n return false\n }\n\n if (element.style && element.parentNode && element.parentNode.style) {\n const elementStyle = getComputedStyle(element)\n const parentNodeStyle = getComputedStyle(element.parentNode)\n\n return elementStyle.display !== 'none' &&\n parentNodeStyle.display !== 'none' &&\n elementStyle.visibility !== 'hidden'\n }\n\n return false\n}\n\nconst isDisabled = element => {\n if (!element || element.nodeType !== Node.ELEMENT_NODE) {\n return true\n }\n\n if (element.classList.contains('disabled')) {\n return true\n }\n\n if (typeof element.disabled !== 'undefined') {\n return element.disabled\n }\n\n return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'\n}\n\nconst findShadowRoot = element => {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root instanceof ShadowRoot ? root : null\n }\n\n if (element instanceof ShadowRoot) {\n return element\n }\n\n // when we don't find a shadow root\n if (!element.parentNode) {\n return null\n }\n\n return findShadowRoot(element.parentNode)\n}\n\nconst noop = () => function () {}\n\nconst reflow = element => element.offsetHeight\n\nconst getjQuery = () => {\n const { jQuery } = window\n\n if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {\n return jQuery\n }\n\n return null\n}\n\nconst onDOMContentLoaded = callback => {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', callback)\n } else {\n callback()\n }\n}\n\nconst isRTL = () => document.documentElement.dir === 'rtl'\n\nconst defineJQueryPlugin = (name, plugin) => {\n onDOMContentLoaded(() => {\n const $ = getjQuery()\n /* istanbul ignore if */\n if ($) {\n const JQUERY_NO_CONFLICT = $.fn[name]\n $.fn[name] = plugin.jQueryInterface\n $.fn[name].Constructor = plugin\n $.fn[name].noConflict = () => {\n $.fn[name] = JQUERY_NO_CONFLICT\n return plugin.jQueryInterface\n }\n }\n })\n}\n\nexport {\n getUID,\n getSelectorFromElement,\n getElementFromSelector,\n getTransitionDurationFromElement,\n triggerTransitionEnd,\n isElement,\n emulateTransitionEnd,\n typeCheckConfig,\n isVisible,\n isDisabled,\n findShadowRoot,\n noop,\n reflow,\n getjQuery,\n onDOMContentLoaded,\n isRTL,\n defineJQueryPlugin\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta3): button.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { defineJQueryPlugin } from './util/index'\nimport Data from './dom/data'\nimport EventHandler from './dom/event-handler'\nimport BaseComponent from './base-component'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'button'\nconst DATA_KEY = 'bs.button'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst CLASS_NAME_ACTIVE = 'active'\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"button\"]'\n\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Button extends BaseComponent {\n // Getters\n\n static get DATA_KEY() {\n return DATA_KEY\n }\n\n // Public\n\n toggle() {\n // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method\n this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE))\n }\n\n // Static\n\n static jQueryInterface(config) {\n return this.each(function () {\n let data = Data.get(this, DATA_KEY)\n\n if (!data) {\n data = new Button(this)\n }\n\n if (config === 'toggle') {\n data[config]()\n }\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {\n event.preventDefault()\n\n const button = event.target.closest(SELECTOR_DATA_TOGGLE)\n\n let data = Data.get(button, DATA_KEY)\n if (!data) {\n data = new Button(button)\n }\n\n data.toggle()\n})\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n * add .Button to jQuery only if jQuery is present\n */\n\ndefineJQueryPlugin(NAME, Button)\n\nexport default Button\n"],"names":["getjQuery","jQuery","window","document","body","hasAttribute","onDOMContentLoaded","callback","readyState","addEventListener","defineJQueryPlugin","name","plugin","$","JQUERY_NO_CONFLICT","fn","jQueryInterface","Constructor","noConflict","NAME","DATA_KEY","EVENT_KEY","DATA_API_KEY","CLASS_NAME_ACTIVE","SELECTOR_DATA_TOGGLE","EVENT_CLICK_DATA_API","Button","BaseComponent","toggle","_element","setAttribute","classList","config","each","data","Data","get","EventHandler","on","event","preventDefault","button","target","closest"],"mappings":"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"}
|
|
@@ -1,757 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Bootstrap carousel.js v5.0.0-beta3 (https://getbootstrap.com/)
|
|
3
|
-
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
-
*/
|
|
6
|
-
(function (global, factory) {
|
|
7
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
|
|
8
|
-
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
|
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
|
10
|
-
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
|
|
11
|
-
|
|
12
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
-
|
|
14
|
-
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
|
15
|
-
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
|
16
|
-
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
|
|
17
|
-
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
|
18
|
-
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* --------------------------------------------------------------------------
|
|
22
|
-
* Bootstrap (v5.0.0-beta3): util/index.js
|
|
23
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
24
|
-
* --------------------------------------------------------------------------
|
|
25
|
-
*/
|
|
26
|
-
const MILLISECONDS_MULTIPLIER = 1000;
|
|
27
|
-
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
|
28
|
-
|
|
29
|
-
const toType = obj => {
|
|
30
|
-
if (obj === null || obj === undefined) {
|
|
31
|
-
return `${obj}`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const getSelector = element => {
|
|
38
|
-
let selector = element.getAttribute('data-bs-target');
|
|
39
|
-
|
|
40
|
-
if (!selector || selector === '#') {
|
|
41
|
-
let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
|
42
|
-
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
|
43
|
-
// `document.querySelector` will rightfully complain it is invalid.
|
|
44
|
-
// See https://github.com/twbs/bootstrap/issues/32273
|
|
45
|
-
|
|
46
|
-
if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
|
|
47
|
-
return null;
|
|
48
|
-
} // Just in case some CMS puts out a full URL with the anchor appended
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
|
|
52
|
-
hrefAttr = '#' + hrefAttr.split('#')[1];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return selector;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const getElementFromSelector = element => {
|
|
62
|
-
const selector = getSelector(element);
|
|
63
|
-
return selector ? document.querySelector(selector) : null;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const getTransitionDurationFromElement = element => {
|
|
67
|
-
if (!element) {
|
|
68
|
-
return 0;
|
|
69
|
-
} // Get transition-duration of the element
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
let {
|
|
73
|
-
transitionDuration,
|
|
74
|
-
transitionDelay
|
|
75
|
-
} = window.getComputedStyle(element);
|
|
76
|
-
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
|
77
|
-
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
|
78
|
-
|
|
79
|
-
if (!floatTransitionDuration && !floatTransitionDelay) {
|
|
80
|
-
return 0;
|
|
81
|
-
} // If multiple durations are defined, take the first
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
transitionDuration = transitionDuration.split(',')[0];
|
|
85
|
-
transitionDelay = transitionDelay.split(',')[0];
|
|
86
|
-
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const triggerTransitionEnd = element => {
|
|
90
|
-
element.dispatchEvent(new Event(TRANSITION_END));
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const isElement = obj => (obj[0] || obj).nodeType;
|
|
94
|
-
|
|
95
|
-
const emulateTransitionEnd = (element, duration) => {
|
|
96
|
-
let called = false;
|
|
97
|
-
const durationPadding = 5;
|
|
98
|
-
const emulatedDuration = duration + durationPadding;
|
|
99
|
-
|
|
100
|
-
function listener() {
|
|
101
|
-
called = true;
|
|
102
|
-
element.removeEventListener(TRANSITION_END, listener);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
element.addEventListener(TRANSITION_END, listener);
|
|
106
|
-
setTimeout(() => {
|
|
107
|
-
if (!called) {
|
|
108
|
-
triggerTransitionEnd(element);
|
|
109
|
-
}
|
|
110
|
-
}, emulatedDuration);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const typeCheckConfig = (componentName, config, configTypes) => {
|
|
114
|
-
Object.keys(configTypes).forEach(property => {
|
|
115
|
-
const expectedTypes = configTypes[property];
|
|
116
|
-
const value = config[property];
|
|
117
|
-
const valueType = value && isElement(value) ? 'element' : toType(value);
|
|
118
|
-
|
|
119
|
-
if (!new RegExp(expectedTypes).test(valueType)) {
|
|
120
|
-
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const isVisible = element => {
|
|
126
|
-
if (!element) {
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (element.style && element.parentNode && element.parentNode.style) {
|
|
131
|
-
const elementStyle = getComputedStyle(element);
|
|
132
|
-
const parentNodeStyle = getComputedStyle(element.parentNode);
|
|
133
|
-
return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return false;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const reflow = element => element.offsetHeight;
|
|
140
|
-
|
|
141
|
-
const getjQuery = () => {
|
|
142
|
-
const {
|
|
143
|
-
jQuery
|
|
144
|
-
} = window;
|
|
145
|
-
|
|
146
|
-
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
|
147
|
-
return jQuery;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return null;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const onDOMContentLoaded = callback => {
|
|
154
|
-
if (document.readyState === 'loading') {
|
|
155
|
-
document.addEventListener('DOMContentLoaded', callback);
|
|
156
|
-
} else {
|
|
157
|
-
callback();
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const isRTL = () => document.documentElement.dir === 'rtl';
|
|
162
|
-
|
|
163
|
-
const defineJQueryPlugin = (name, plugin) => {
|
|
164
|
-
onDOMContentLoaded(() => {
|
|
165
|
-
const $ = getjQuery();
|
|
166
|
-
/* istanbul ignore if */
|
|
167
|
-
|
|
168
|
-
if ($) {
|
|
169
|
-
const JQUERY_NO_CONFLICT = $.fn[name];
|
|
170
|
-
$.fn[name] = plugin.jQueryInterface;
|
|
171
|
-
$.fn[name].Constructor = plugin;
|
|
172
|
-
|
|
173
|
-
$.fn[name].noConflict = () => {
|
|
174
|
-
$.fn[name] = JQUERY_NO_CONFLICT;
|
|
175
|
-
return plugin.jQueryInterface;
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* --------------------------------------------------------------------------
|
|
183
|
-
* Bootstrap (v5.0.0-beta3): carousel.js
|
|
184
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
185
|
-
* --------------------------------------------------------------------------
|
|
186
|
-
*/
|
|
187
|
-
/**
|
|
188
|
-
* ------------------------------------------------------------------------
|
|
189
|
-
* Constants
|
|
190
|
-
* ------------------------------------------------------------------------
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
const NAME = 'carousel';
|
|
194
|
-
const DATA_KEY = 'bs.carousel';
|
|
195
|
-
const EVENT_KEY = `.${DATA_KEY}`;
|
|
196
|
-
const DATA_API_KEY = '.data-api';
|
|
197
|
-
const ARROW_LEFT_KEY = 'ArrowLeft';
|
|
198
|
-
const ARROW_RIGHT_KEY = 'ArrowRight';
|
|
199
|
-
const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
|
|
200
|
-
|
|
201
|
-
const SWIPE_THRESHOLD = 40;
|
|
202
|
-
const Default = {
|
|
203
|
-
interval: 5000,
|
|
204
|
-
keyboard: true,
|
|
205
|
-
slide: false,
|
|
206
|
-
pause: 'hover',
|
|
207
|
-
wrap: true,
|
|
208
|
-
touch: true
|
|
209
|
-
};
|
|
210
|
-
const DefaultType = {
|
|
211
|
-
interval: '(number|boolean)',
|
|
212
|
-
keyboard: 'boolean',
|
|
213
|
-
slide: '(boolean|string)',
|
|
214
|
-
pause: '(string|boolean)',
|
|
215
|
-
wrap: 'boolean',
|
|
216
|
-
touch: 'boolean'
|
|
217
|
-
};
|
|
218
|
-
const ORDER_NEXT = 'next';
|
|
219
|
-
const ORDER_PREV = 'prev';
|
|
220
|
-
const DIRECTION_LEFT = 'left';
|
|
221
|
-
const DIRECTION_RIGHT = 'right';
|
|
222
|
-
const EVENT_SLIDE = `slide${EVENT_KEY}`;
|
|
223
|
-
const EVENT_SLID = `slid${EVENT_KEY}`;
|
|
224
|
-
const EVENT_KEYDOWN = `keydown${EVENT_KEY}`;
|
|
225
|
-
const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`;
|
|
226
|
-
const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`;
|
|
227
|
-
const EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`;
|
|
228
|
-
const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`;
|
|
229
|
-
const EVENT_TOUCHEND = `touchend${EVENT_KEY}`;
|
|
230
|
-
const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`;
|
|
231
|
-
const EVENT_POINTERUP = `pointerup${EVENT_KEY}`;
|
|
232
|
-
const EVENT_DRAG_START = `dragstart${EVENT_KEY}`;
|
|
233
|
-
const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
|
|
234
|
-
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
|
235
|
-
const CLASS_NAME_CAROUSEL = 'carousel';
|
|
236
|
-
const CLASS_NAME_ACTIVE = 'active';
|
|
237
|
-
const CLASS_NAME_SLIDE = 'slide';
|
|
238
|
-
const CLASS_NAME_END = 'carousel-item-end';
|
|
239
|
-
const CLASS_NAME_START = 'carousel-item-start';
|
|
240
|
-
const CLASS_NAME_NEXT = 'carousel-item-next';
|
|
241
|
-
const CLASS_NAME_PREV = 'carousel-item-prev';
|
|
242
|
-
const CLASS_NAME_POINTER_EVENT = 'pointer-event';
|
|
243
|
-
const SELECTOR_ACTIVE = '.active';
|
|
244
|
-
const SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
|
|
245
|
-
const SELECTOR_ITEM = '.carousel-item';
|
|
246
|
-
const SELECTOR_ITEM_IMG = '.carousel-item img';
|
|
247
|
-
const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
|
|
248
|
-
const SELECTOR_INDICATORS = '.carousel-indicators';
|
|
249
|
-
const SELECTOR_INDICATOR = '[data-bs-target]';
|
|
250
|
-
const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
|
|
251
|
-
const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
|
|
252
|
-
const POINTER_TYPE_TOUCH = 'touch';
|
|
253
|
-
const POINTER_TYPE_PEN = 'pen';
|
|
254
|
-
/**
|
|
255
|
-
* ------------------------------------------------------------------------
|
|
256
|
-
* Class Definition
|
|
257
|
-
* ------------------------------------------------------------------------
|
|
258
|
-
*/
|
|
259
|
-
|
|
260
|
-
class Carousel extends BaseComponent__default['default'] {
|
|
261
|
-
constructor(element, config) {
|
|
262
|
-
super(element);
|
|
263
|
-
this._items = null;
|
|
264
|
-
this._interval = null;
|
|
265
|
-
this._activeElement = null;
|
|
266
|
-
this._isPaused = false;
|
|
267
|
-
this._isSliding = false;
|
|
268
|
-
this.touchTimeout = null;
|
|
269
|
-
this.touchStartX = 0;
|
|
270
|
-
this.touchDeltaX = 0;
|
|
271
|
-
this._config = this._getConfig(config);
|
|
272
|
-
this._indicatorsElement = SelectorEngine__default['default'].findOne(SELECTOR_INDICATORS, this._element);
|
|
273
|
-
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
|
274
|
-
this._pointerEvent = Boolean(window.PointerEvent);
|
|
275
|
-
|
|
276
|
-
this._addEventListeners();
|
|
277
|
-
} // Getters
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
static get Default() {
|
|
281
|
-
return Default;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
static get DATA_KEY() {
|
|
285
|
-
return DATA_KEY;
|
|
286
|
-
} // Public
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
next() {
|
|
290
|
-
if (!this._isSliding) {
|
|
291
|
-
this._slide(ORDER_NEXT);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
nextWhenVisible() {
|
|
296
|
-
// Don't call next when the page isn't visible
|
|
297
|
-
// or the carousel or its parent isn't visible
|
|
298
|
-
if (!document.hidden && isVisible(this._element)) {
|
|
299
|
-
this.next();
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
prev() {
|
|
304
|
-
if (!this._isSliding) {
|
|
305
|
-
this._slide(ORDER_PREV);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
pause(event) {
|
|
310
|
-
if (!event) {
|
|
311
|
-
this._isPaused = true;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if (SelectorEngine__default['default'].findOne(SELECTOR_NEXT_PREV, this._element)) {
|
|
315
|
-
triggerTransitionEnd(this._element);
|
|
316
|
-
this.cycle(true);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
clearInterval(this._interval);
|
|
320
|
-
this._interval = null;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
cycle(event) {
|
|
324
|
-
if (!event) {
|
|
325
|
-
this._isPaused = false;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
if (this._interval) {
|
|
329
|
-
clearInterval(this._interval);
|
|
330
|
-
this._interval = null;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
if (this._config && this._config.interval && !this._isPaused) {
|
|
334
|
-
this._updateInterval();
|
|
335
|
-
|
|
336
|
-
this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
to(index) {
|
|
341
|
-
this._activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
|
342
|
-
|
|
343
|
-
const activeIndex = this._getItemIndex(this._activeElement);
|
|
344
|
-
|
|
345
|
-
if (index > this._items.length - 1 || index < 0) {
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
if (this._isSliding) {
|
|
350
|
-
EventHandler__default['default'].one(this._element, EVENT_SLID, () => this.to(index));
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
if (activeIndex === index) {
|
|
355
|
-
this.pause();
|
|
356
|
-
this.cycle();
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
|
|
361
|
-
|
|
362
|
-
this._slide(order, this._items[index]);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
dispose() {
|
|
366
|
-
EventHandler__default['default'].off(this._element, EVENT_KEY);
|
|
367
|
-
this._items = null;
|
|
368
|
-
this._config = null;
|
|
369
|
-
this._interval = null;
|
|
370
|
-
this._isPaused = null;
|
|
371
|
-
this._isSliding = null;
|
|
372
|
-
this._activeElement = null;
|
|
373
|
-
this._indicatorsElement = null;
|
|
374
|
-
super.dispose();
|
|
375
|
-
} // Private
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
_getConfig(config) {
|
|
379
|
-
config = { ...Default,
|
|
380
|
-
...config
|
|
381
|
-
};
|
|
382
|
-
typeCheckConfig(NAME, config, DefaultType);
|
|
383
|
-
return config;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
_handleSwipe() {
|
|
387
|
-
const absDeltax = Math.abs(this.touchDeltaX);
|
|
388
|
-
|
|
389
|
-
if (absDeltax <= SWIPE_THRESHOLD) {
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
const direction = absDeltax / this.touchDeltaX;
|
|
394
|
-
this.touchDeltaX = 0;
|
|
395
|
-
|
|
396
|
-
if (!direction) {
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
_addEventListeners() {
|
|
404
|
-
if (this._config.keyboard) {
|
|
405
|
-
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
if (this._config.pause === 'hover') {
|
|
409
|
-
EventHandler__default['default'].on(this._element, EVENT_MOUSEENTER, event => this.pause(event));
|
|
410
|
-
EventHandler__default['default'].on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event));
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
if (this._config.touch && this._touchSupported) {
|
|
414
|
-
this._addTouchEventListeners();
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
_addTouchEventListeners() {
|
|
419
|
-
const start = event => {
|
|
420
|
-
if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
|
|
421
|
-
this.touchStartX = event.clientX;
|
|
422
|
-
} else if (!this._pointerEvent) {
|
|
423
|
-
this.touchStartX = event.touches[0].clientX;
|
|
424
|
-
}
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
const move = event => {
|
|
428
|
-
// ensure swiping with one touch and not pinching
|
|
429
|
-
this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
const end = event => {
|
|
433
|
-
if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
|
|
434
|
-
this.touchDeltaX = event.clientX - this.touchStartX;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
this._handleSwipe();
|
|
438
|
-
|
|
439
|
-
if (this._config.pause === 'hover') {
|
|
440
|
-
// If it's a touch-enabled device, mouseenter/leave are fired as
|
|
441
|
-
// part of the mouse compatibility events on first tap - the carousel
|
|
442
|
-
// would stop cycling until user tapped out of it;
|
|
443
|
-
// here, we listen for touchend, explicitly pause the carousel
|
|
444
|
-
// (as if it's the second time we tap on it, mouseenter compat event
|
|
445
|
-
// is NOT fired) and after a timeout (to allow for mouse compatibility
|
|
446
|
-
// events to fire) we explicitly restart cycling
|
|
447
|
-
this.pause();
|
|
448
|
-
|
|
449
|
-
if (this.touchTimeout) {
|
|
450
|
-
clearTimeout(this.touchTimeout);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
SelectorEngine__default['default'].find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {
|
|
458
|
-
EventHandler__default['default'].on(itemImg, EVENT_DRAG_START, e => e.preventDefault());
|
|
459
|
-
});
|
|
460
|
-
|
|
461
|
-
if (this._pointerEvent) {
|
|
462
|
-
EventHandler__default['default'].on(this._element, EVENT_POINTERDOWN, event => start(event));
|
|
463
|
-
EventHandler__default['default'].on(this._element, EVENT_POINTERUP, event => end(event));
|
|
464
|
-
|
|
465
|
-
this._element.classList.add(CLASS_NAME_POINTER_EVENT);
|
|
466
|
-
} else {
|
|
467
|
-
EventHandler__default['default'].on(this._element, EVENT_TOUCHSTART, event => start(event));
|
|
468
|
-
EventHandler__default['default'].on(this._element, EVENT_TOUCHMOVE, event => move(event));
|
|
469
|
-
EventHandler__default['default'].on(this._element, EVENT_TOUCHEND, event => end(event));
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
_keydown(event) {
|
|
474
|
-
if (/input|textarea/i.test(event.target.tagName)) {
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
if (event.key === ARROW_LEFT_KEY) {
|
|
479
|
-
event.preventDefault();
|
|
480
|
-
|
|
481
|
-
this._slide(DIRECTION_LEFT);
|
|
482
|
-
} else if (event.key === ARROW_RIGHT_KEY) {
|
|
483
|
-
event.preventDefault();
|
|
484
|
-
|
|
485
|
-
this._slide(DIRECTION_RIGHT);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
_getItemIndex(element) {
|
|
490
|
-
this._items = element && element.parentNode ? SelectorEngine__default['default'].find(SELECTOR_ITEM, element.parentNode) : [];
|
|
491
|
-
return this._items.indexOf(element);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
_getItemByOrder(order, activeElement) {
|
|
495
|
-
const isNext = order === ORDER_NEXT;
|
|
496
|
-
const isPrev = order === ORDER_PREV;
|
|
497
|
-
|
|
498
|
-
const activeIndex = this._getItemIndex(activeElement);
|
|
499
|
-
|
|
500
|
-
const lastItemIndex = this._items.length - 1;
|
|
501
|
-
const isGoingToWrap = isPrev && activeIndex === 0 || isNext && activeIndex === lastItemIndex;
|
|
502
|
-
|
|
503
|
-
if (isGoingToWrap && !this._config.wrap) {
|
|
504
|
-
return activeElement;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
const delta = isPrev ? -1 : 1;
|
|
508
|
-
const itemIndex = (activeIndex + delta) % this._items.length;
|
|
509
|
-
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
_triggerSlideEvent(relatedTarget, eventDirectionName) {
|
|
513
|
-
const targetIndex = this._getItemIndex(relatedTarget);
|
|
514
|
-
|
|
515
|
-
const fromIndex = this._getItemIndex(SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element));
|
|
516
|
-
|
|
517
|
-
return EventHandler__default['default'].trigger(this._element, EVENT_SLIDE, {
|
|
518
|
-
relatedTarget,
|
|
519
|
-
direction: eventDirectionName,
|
|
520
|
-
from: fromIndex,
|
|
521
|
-
to: targetIndex
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
_setActiveIndicatorElement(element) {
|
|
526
|
-
if (this._indicatorsElement) {
|
|
527
|
-
const activeIndicator = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE, this._indicatorsElement);
|
|
528
|
-
activeIndicator.classList.remove(CLASS_NAME_ACTIVE);
|
|
529
|
-
activeIndicator.removeAttribute('aria-current');
|
|
530
|
-
const indicators = SelectorEngine__default['default'].find(SELECTOR_INDICATOR, this._indicatorsElement);
|
|
531
|
-
|
|
532
|
-
for (let i = 0; i < indicators.length; i++) {
|
|
533
|
-
if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) {
|
|
534
|
-
indicators[i].classList.add(CLASS_NAME_ACTIVE);
|
|
535
|
-
indicators[i].setAttribute('aria-current', 'true');
|
|
536
|
-
break;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
_updateInterval() {
|
|
543
|
-
const element = this._activeElement || SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
|
544
|
-
|
|
545
|
-
if (!element) {
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
|
|
550
|
-
|
|
551
|
-
if (elementInterval) {
|
|
552
|
-
this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
|
|
553
|
-
this._config.interval = elementInterval;
|
|
554
|
-
} else {
|
|
555
|
-
this._config.interval = this._config.defaultInterval || this._config.interval;
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
_slide(directionOrOrder, element) {
|
|
560
|
-
const order = this._directionToOrder(directionOrOrder);
|
|
561
|
-
|
|
562
|
-
const activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
|
|
563
|
-
|
|
564
|
-
const activeElementIndex = this._getItemIndex(activeElement);
|
|
565
|
-
|
|
566
|
-
const nextElement = element || this._getItemByOrder(order, activeElement);
|
|
567
|
-
|
|
568
|
-
const nextElementIndex = this._getItemIndex(nextElement);
|
|
569
|
-
|
|
570
|
-
const isCycling = Boolean(this._interval);
|
|
571
|
-
const isNext = order === ORDER_NEXT;
|
|
572
|
-
const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
|
|
573
|
-
const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
|
|
574
|
-
|
|
575
|
-
const eventDirectionName = this._orderToDirection(order);
|
|
576
|
-
|
|
577
|
-
if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
|
|
578
|
-
this._isSliding = false;
|
|
579
|
-
return;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
|
|
583
|
-
|
|
584
|
-
if (slideEvent.defaultPrevented) {
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
if (!activeElement || !nextElement) {
|
|
589
|
-
// Some weirdness is happening, so we bail
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
this._isSliding = true;
|
|
594
|
-
|
|
595
|
-
if (isCycling) {
|
|
596
|
-
this.pause();
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
this._setActiveIndicatorElement(nextElement);
|
|
600
|
-
|
|
601
|
-
this._activeElement = nextElement;
|
|
602
|
-
|
|
603
|
-
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
|
|
604
|
-
nextElement.classList.add(orderClassName);
|
|
605
|
-
reflow(nextElement);
|
|
606
|
-
activeElement.classList.add(directionalClassName);
|
|
607
|
-
nextElement.classList.add(directionalClassName);
|
|
608
|
-
const transitionDuration = getTransitionDurationFromElement(activeElement);
|
|
609
|
-
EventHandler__default['default'].one(activeElement, 'transitionend', () => {
|
|
610
|
-
nextElement.classList.remove(directionalClassName, orderClassName);
|
|
611
|
-
nextElement.classList.add(CLASS_NAME_ACTIVE);
|
|
612
|
-
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
|
|
613
|
-
this._isSliding = false;
|
|
614
|
-
setTimeout(() => {
|
|
615
|
-
EventHandler__default['default'].trigger(this._element, EVENT_SLID, {
|
|
616
|
-
relatedTarget: nextElement,
|
|
617
|
-
direction: eventDirectionName,
|
|
618
|
-
from: activeElementIndex,
|
|
619
|
-
to: nextElementIndex
|
|
620
|
-
});
|
|
621
|
-
}, 0);
|
|
622
|
-
});
|
|
623
|
-
emulateTransitionEnd(activeElement, transitionDuration);
|
|
624
|
-
} else {
|
|
625
|
-
activeElement.classList.remove(CLASS_NAME_ACTIVE);
|
|
626
|
-
nextElement.classList.add(CLASS_NAME_ACTIVE);
|
|
627
|
-
this._isSliding = false;
|
|
628
|
-
EventHandler__default['default'].trigger(this._element, EVENT_SLID, {
|
|
629
|
-
relatedTarget: nextElement,
|
|
630
|
-
direction: eventDirectionName,
|
|
631
|
-
from: activeElementIndex,
|
|
632
|
-
to: nextElementIndex
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
if (isCycling) {
|
|
637
|
-
this.cycle();
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
_directionToOrder(direction) {
|
|
642
|
-
if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
|
|
643
|
-
return direction;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
if (isRTL()) {
|
|
647
|
-
return direction === DIRECTION_RIGHT ? ORDER_PREV : ORDER_NEXT;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
return direction === DIRECTION_RIGHT ? ORDER_NEXT : ORDER_PREV;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
_orderToDirection(order) {
|
|
654
|
-
if (![ORDER_NEXT, ORDER_PREV].includes(order)) {
|
|
655
|
-
return order;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
if (isRTL()) {
|
|
659
|
-
return order === ORDER_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
return order === ORDER_NEXT ? DIRECTION_RIGHT : DIRECTION_LEFT;
|
|
663
|
-
} // Static
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
static carouselInterface(element, config) {
|
|
667
|
-
let data = Data__default['default'].get(element, DATA_KEY);
|
|
668
|
-
let _config = { ...Default,
|
|
669
|
-
...Manipulator__default['default'].getDataAttributes(element)
|
|
670
|
-
};
|
|
671
|
-
|
|
672
|
-
if (typeof config === 'object') {
|
|
673
|
-
_config = { ..._config,
|
|
674
|
-
...config
|
|
675
|
-
};
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
const action = typeof config === 'string' ? config : _config.slide;
|
|
679
|
-
|
|
680
|
-
if (!data) {
|
|
681
|
-
data = new Carousel(element, _config);
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
if (typeof config === 'number') {
|
|
685
|
-
data.to(config);
|
|
686
|
-
} else if (typeof action === 'string') {
|
|
687
|
-
if (typeof data[action] === 'undefined') {
|
|
688
|
-
throw new TypeError(`No method named "${action}"`);
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
data[action]();
|
|
692
|
-
} else if (_config.interval && _config.ride) {
|
|
693
|
-
data.pause();
|
|
694
|
-
data.cycle();
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
static jQueryInterface(config) {
|
|
699
|
-
return this.each(function () {
|
|
700
|
-
Carousel.carouselInterface(this, config);
|
|
701
|
-
});
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
static dataApiClickHandler(event) {
|
|
705
|
-
const target = getElementFromSelector(this);
|
|
706
|
-
|
|
707
|
-
if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
const config = { ...Manipulator__default['default'].getDataAttributes(target),
|
|
712
|
-
...Manipulator__default['default'].getDataAttributes(this)
|
|
713
|
-
};
|
|
714
|
-
const slideIndex = this.getAttribute('data-bs-slide-to');
|
|
715
|
-
|
|
716
|
-
if (slideIndex) {
|
|
717
|
-
config.interval = false;
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
Carousel.carouselInterface(target, config);
|
|
721
|
-
|
|
722
|
-
if (slideIndex) {
|
|
723
|
-
Data__default['default'].get(target, DATA_KEY).to(slideIndex);
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
event.preventDefault();
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* ------------------------------------------------------------------------
|
|
732
|
-
* Data Api implementation
|
|
733
|
-
* ------------------------------------------------------------------------
|
|
734
|
-
*/
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
|
|
738
|
-
EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => {
|
|
739
|
-
const carousels = SelectorEngine__default['default'].find(SELECTOR_DATA_RIDE);
|
|
740
|
-
|
|
741
|
-
for (let i = 0, len = carousels.length; i < len; i++) {
|
|
742
|
-
Carousel.carouselInterface(carousels[i], Data__default['default'].get(carousels[i], DATA_KEY));
|
|
743
|
-
}
|
|
744
|
-
});
|
|
745
|
-
/**
|
|
746
|
-
* ------------------------------------------------------------------------
|
|
747
|
-
* jQuery
|
|
748
|
-
* ------------------------------------------------------------------------
|
|
749
|
-
* add .Carousel to jQuery only if jQuery is present
|
|
750
|
-
*/
|
|
751
|
-
|
|
752
|
-
defineJQueryPlugin(NAME, Carousel);
|
|
753
|
-
|
|
754
|
-
return Carousel;
|
|
755
|
-
|
|
756
|
-
})));
|
|
757
|
-
//# sourceMappingURL=carousel.js.map
|