0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-12 00:08:59 +01:00
Bootstrap/js/dist/collapse.js

504 lines
15 KiB
JavaScript
Raw Normal View History

2018-11-13 07:41:12 +01:00
/*!
* Bootstrap collapse.js v5.0.1 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2020-06-16 20:50:01 +02:00
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
2018-11-13 07:41:12 +01:00
*/
2018-07-24 02:51:14 +02:00
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./base-component.js')) :
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/data', './dom/event-handler', './dom/manipulator', './base-component'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.SelectorEngine, global.Data, global.EventHandler, global.Manipulator, global.Base));
}(this, (function (SelectorEngine, Data, EventHandler, Manipulator, BaseComponent) { 'use strict';
2018-07-24 02:51:14 +02:00
2020-09-14 17:12:06 +02:00
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
2020-09-14 17:12:06 +02:00
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
2021-03-23 17:26:54 +01:00
const toType = obj => {
2020-03-28 11:29:08 +01:00
if (obj === null || obj === undefined) {
2021-03-23 17:26:54 +01:00
return `${obj}`;
2020-03-28 11:29:08 +01:00
}
2019-03-01 17:31:34 +01:00
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
};
2021-03-23 17:26:54 +01:00
const getSelector = element => {
let selector = element.getAttribute('data-bs-target');
2019-03-01 17:31:34 +01:00
if (!selector || selector === '#') {
2021-03-23 17:26:54 +01:00
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]}`;
}
2019-08-27 15:03:21 +02:00
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
2019-03-01 17:31:34 +01:00
}
2019-08-27 15:03:21 +02:00
return selector;
};
2021-03-23 17:26:54 +01:00
const getSelectorFromElement = element => {
const selector = getSelector(element);
2019-08-27 15:03:21 +02:00
if (selector) {
2019-03-01 17:31:34 +01:00
return document.querySelector(selector) ? selector : null;
}
2019-08-27 15:03:21 +02:00
return null;
};
2021-03-23 17:26:54 +01:00
const getElementFromSelector = element => {
const selector = getSelector(element);
2019-08-27 15:03:21 +02:00
return selector ? document.querySelector(selector) : null;
2019-03-01 17:31:34 +01:00
};
const isElement = obj => {
if (!obj || typeof obj !== 'object') {
return false;
}
2019-03-01 17:31:34 +01:00
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
2019-03-01 17:31:34 +01:00
return typeof obj.nodeType !== 'undefined';
2019-03-01 17:31:34 +01:00
};
const getElement = obj => {
if (isElement(obj)) {
// it's a jQuery object or a node element
return obj.jquery ? obj[0] : obj;
}
2019-03-01 17:31:34 +01:00
if (typeof obj === 'string' && obj.length > 0) {
return SelectorEngine__default['default'].findOne(obj);
2019-03-01 17:31:34 +01:00
}
return null;
2019-03-01 17:31:34 +01:00
};
2021-03-23 17:26:54 +01:00
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);
2019-03-01 17:31:34 +01:00
if (!new RegExp(expectedTypes).test(valueType)) {
throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
2019-03-01 17:31:34 +01:00
}
});
};
2021-03-23 17:26:54 +01:00
const reflow = element => element.offsetHeight;
2019-03-01 17:31:34 +01:00
2021-03-23 17:26:54 +01:00
const getjQuery = () => {
const {
jQuery
} = window;
2019-08-27 15:03:21 +02:00
2020-11-23 14:17:16 +01:00
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
2019-08-27 15:03:21 +02:00
return jQuery;
}
return null;
};
2021-03-23 17:26:54 +01:00
const onDOMContentLoaded = callback => {
2020-11-11 18:07:37 +01:00
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', callback);
} else {
callback();
}
};
const defineJQueryPlugin = plugin => {
2021-03-23 17:26:54 +01:00
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
2020-12-03 15:18:59 +01:00
if ($) {
const name = plugin.NAME;
2021-03-23 17:26:54 +01:00
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
2020-12-03 15:18:59 +01:00
2021-03-23 17:26:54 +01:00
$.fn[name].noConflict = () => {
$.fn[name] = JQUERY_NO_CONFLICT;
return plugin.jQueryInterface;
};
2020-12-03 15:18:59 +01:00
}
});
};
2020-12-03 15:18:59 +01:00
2021-03-23 17:26:54 +01:00
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.1): collapse.js
2021-03-23 17:26:54 +01:00
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
2020-12-03 15:18:59 +01:00
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
2021-03-23 17:26:54 +01:00
const NAME = 'collapse';
const DATA_KEY = 'bs.collapse';
const EVENT_KEY = `.${DATA_KEY}`;
const DATA_API_KEY = '.data-api';
const Default = {
2018-11-13 07:41:12 +01:00
toggle: true,
parent: ''
};
2021-03-23 17:26:54 +01:00
const DefaultType = {
2018-11-13 07:41:12 +01:00
toggle: 'boolean',
parent: '(string|element)'
};
2021-03-23 17:26:54 +01:00
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"]';
2019-10-08 08:39:10 +02:00
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
2018-11-13 07:41:12 +01:00
2021-03-23 17:26:54 +01:00
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}"]`);
const toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
2020-12-03 15:18:59 +01:00
2021-03-23 17:26:54 +01:00
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(foundElem => foundElem === this._element);
2017-05-16 09:59:44 +02:00
2019-03-01 17:31:34 +01:00
if (selector !== null && filterElement.length) {
2021-03-23 17:26:54 +01:00
this._selector = selector;
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
this._triggerArray.push(elem);
2018-07-24 02:51:14 +02:00
}
2018-11-13 07:41:12 +01:00
}
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
this._parent = this._config.parent ? this._getParent() : null;
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
if (!this._config.parent) {
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
2018-11-13 07:41:12 +01:00
}
2015-08-13 06:12:03 +02:00
2021-03-23 17:26:54 +01:00
if (this._config.toggle) {
this.toggle();
2018-11-13 07:41:12 +01:00
}
} // Getters
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
static get Default() {
return Default;
}
static get NAME() {
return NAME;
2021-03-23 17:26:54 +01:00
} // Public
2016-10-10 02:26:51 +02:00
2021-03-23 17:26:54 +01:00
toggle() {
2020-03-28 11:29:08 +01:00
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
2018-11-13 07:41:12 +01:00
this.hide();
} else {
this.show();
}
2021-03-23 17:26:54 +01:00
}
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
show() {
2020-03-28 11:29:08 +01:00
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
2018-11-13 07:41:12 +01:00
return;
}
2018-09-17 21:34:34 +02:00
2021-03-23 17:26:54 +01:00
let actives;
let activesData;
2015-05-10 08:00:59 +02:00
2018-11-13 07:41:12 +01:00
if (this._parent) {
2021-03-23 17:26:54 +01:00
actives = SelectorEngine__default['default'].find(SELECTOR_ACTIVES, this._parent).filter(elem => {
if (typeof this._config.parent === 'string') {
return elem.getAttribute('data-bs-parent') === this._config.parent;
2018-07-24 02:51:14 +02:00
}
2015-05-10 08:00:59 +02:00
2020-03-28 11:29:08 +01:00
return elem.classList.contains(CLASS_NAME_COLLAPSE);
2018-11-13 07:41:12 +01:00
});
2015-05-10 08:00:59 +02:00
2018-11-13 07:41:12 +01:00
if (actives.length === 0) {
actives = null;
2017-09-06 06:05:12 +02:00
}
2018-11-13 07:41:12 +01:00
}
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
const container = SelectorEngine__default['default'].findOne(this._selector);
2019-03-01 17:31:34 +01:00
2018-11-13 07:41:12 +01:00
if (actives) {
2021-03-23 17:26:54 +01:00
const tempActiveData = actives.find(elem => container !== elem);
activesData = tempActiveData ? Data__default['default'].get(tempActiveData, DATA_KEY) : null;
2015-05-10 08:00:59 +02:00
2018-11-13 07:41:12 +01:00
if (activesData && activesData._isTransitioning) {
2018-07-24 02:51:14 +02:00
return;
}
2018-11-13 07:41:12 +01:00
}
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
const startEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
2015-05-10 08:00:59 +02:00
2019-03-01 17:31:34 +01:00
if (startEvent.defaultPrevented) {
2018-11-13 07:41:12 +01:00
return;
}
2015-05-10 08:00:59 +02:00
2018-11-13 07:41:12 +01:00
if (actives) {
2021-03-23 17:26:54 +01:00
actives.forEach(elemActive => {
2019-03-01 17:31:34 +01:00
if (container !== elemActive) {
2019-08-27 15:03:21 +02:00
Collapse.collapseInterface(elemActive, 'hide');
2019-03-01 17:31:34 +01:00
}
2015-05-10 08:00:59 +02:00
2019-03-01 17:31:34 +01:00
if (!activesData) {
2021-03-23 17:26:54 +01:00
Data__default['default'].set(elemActive, DATA_KEY, null);
2019-03-01 17:31:34 +01:00
}
});
2018-11-13 07:41:12 +01:00
}
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
const dimension = this._getDimension();
2018-11-13 07:41:12 +01:00
2020-03-28 11:29:08 +01:00
this._element.classList.remove(CLASS_NAME_COLLAPSE);
2019-03-01 17:31:34 +01:00
2020-03-28 11:29:08 +01:00
this._element.classList.add(CLASS_NAME_COLLAPSING);
2019-03-01 17:31:34 +01:00
2018-11-13 07:41:12 +01:00
this._element.style[dimension] = 0;
if (this._triggerArray.length) {
2021-03-23 17:26:54 +01:00
this._triggerArray.forEach(element => {
2020-03-28 11:29:08 +01:00
element.classList.remove(CLASS_NAME_COLLAPSED);
2019-03-01 17:31:34 +01:00
element.setAttribute('aria-expanded', true);
});
2018-11-13 07:41:12 +01:00
}
2015-05-10 08:00:59 +02:00
2018-11-13 07:41:12 +01:00
this.setTransitioning(true);
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
const complete = () => {
this._element.classList.remove(CLASS_NAME_COLLAPSING);
2019-03-01 17:31:34 +01:00
2021-03-23 17:26:54 +01:00
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
this._element.style[dimension] = '';
this.setTransitioning(false);
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN);
2018-07-24 02:51:14 +02:00
};
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
const scrollSize = `scroll${capitalizedDimension}`;
this._queueCallback(complete, this._element, true);
2021-03-23 17:26:54 +01:00
this._element.style[dimension] = `${this._element[scrollSize]}px`;
}
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
hide() {
2020-03-28 11:29:08 +01:00
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
2018-11-13 07:41:12 +01:00
return;
}
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
const startEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
2015-05-10 08:00:59 +02:00
2019-03-01 17:31:34 +01:00
if (startEvent.defaultPrevented) {
2018-11-13 07:41:12 +01:00
return;
}
2021-03-23 17:26:54 +01:00
const dimension = this._getDimension();
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
2019-03-01 17:31:34 +01:00
reflow(this._element);
2020-03-28 11:29:08 +01:00
this._element.classList.add(CLASS_NAME_COLLAPSING);
2019-03-01 17:31:34 +01:00
2020-05-13 20:53:43 +02:00
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
2019-03-01 17:31:34 +01:00
2021-03-23 17:26:54 +01:00
const triggerArrayLength = this._triggerArray.length;
2015-05-10 08:00:59 +02:00
2018-11-13 07:41:12 +01:00
if (triggerArrayLength > 0) {
2021-03-23 17:26:54 +01:00
for (let i = 0; i < triggerArrayLength; i++) {
const trigger = this._triggerArray[i];
const elem = getElementFromSelector(trigger);
2015-05-10 08:00:59 +02:00
2020-03-28 11:29:08 +01:00
if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
trigger.classList.add(CLASS_NAME_COLLAPSED);
2019-08-27 15:03:21 +02:00
trigger.setAttribute('aria-expanded', false);
2017-09-06 06:05:12 +02:00
}
}
2018-11-13 07:41:12 +01:00
}
2015-05-10 08:00:59 +02:00
2018-11-13 07:41:12 +01:00
this.setTransitioning(true);
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
const complete = () => {
this.setTransitioning(false);
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
this._element.classList.remove(CLASS_NAME_COLLAPSING);
2019-03-01 17:31:34 +01:00
2021-03-23 17:26:54 +01:00
this._element.classList.add(CLASS_NAME_COLLAPSE);
2019-03-01 17:31:34 +01:00
2021-03-23 17:26:54 +01:00
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
2018-07-24 02:51:14 +02:00
};
2016-10-10 02:26:51 +02:00
2018-11-13 07:41:12 +01:00
this._element.style[dimension] = '';
this._queueCallback(complete, this._element, true);
2021-03-23 17:26:54 +01:00
}
2016-10-10 02:26:51 +02:00
2021-03-23 17:26:54 +01:00
setTransitioning(isTransitioning) {
2018-11-13 07:41:12 +01:00
this._isTransitioning = isTransitioning;
2019-01-04 17:29:45 +01:00
} // Private
2016-10-10 02:26:51 +02:00
2021-03-23 17:26:54 +01:00
_getConfig(config) {
config = { ...Default,
...config
};
2018-11-13 07:41:12 +01:00
config.toggle = Boolean(config.toggle); // Coerce string values
2017-09-30 23:28:03 +02:00
2019-03-01 17:31:34 +01:00
typeCheckConfig(NAME, config, DefaultType);
2018-11-13 07:41:12 +01:00
return config;
2021-03-23 17:26:54 +01:00
}
2017-09-30 23:28:03 +02:00
2021-03-23 17:26:54 +01:00
_getDimension() {
2020-09-14 17:12:06 +02:00
return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
2021-03-23 17:26:54 +01:00
}
2017-09-30 23:28:03 +02:00
2021-03-23 17:26:54 +01:00
_getParent() {
let {
parent
} = this._config;
parent = getElement(parent);
2021-03-23 17:26:54 +01:00
const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`;
SelectorEngine__default['default'].find(selector, parent).forEach(element => {
const selected = getElementFromSelector(element);
2021-03-23 17:26:54 +01:00
this._addAriaAndCollapsedClass(selected, [element]);
2018-11-13 07:41:12 +01:00
});
return parent;
2021-03-23 17:26:54 +01:00
}
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
_addAriaAndCollapsedClass(element, triggerArray) {
2020-09-14 17:12:06 +02:00
if (!element || !triggerArray.length) {
return;
2018-11-13 07:41:12 +01:00
}
2020-09-14 17:12:06 +02:00
2021-03-23 17:26:54 +01:00
const isOpen = element.classList.contains(CLASS_NAME_SHOW);
triggerArray.forEach(elem => {
2020-09-14 17:12:06 +02:00
if (isOpen) {
elem.classList.remove(CLASS_NAME_COLLAPSED);
} else {
elem.classList.add(CLASS_NAME_COLLAPSED);
}
elem.setAttribute('aria-expanded', isOpen);
});
2019-01-04 17:29:45 +01:00
} // Static
2017-09-30 23:28:03 +02:00
2021-03-23 17:26:54 +01:00
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 : {})
};
2017-09-30 23:28:03 +02:00
2020-05-13 20:53:43 +02:00
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
2019-03-01 17:31:34 +01:00
_config.toggle = false;
}
if (!data) {
data = new Collapse(element, _config);
}
2018-07-24 02:51:14 +02:00
2019-03-01 17:31:34 +01:00
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
2021-03-23 17:26:54 +01:00
throw new TypeError(`No method named "${config}"`);
2018-11-13 07:41:12 +01:00
}
2017-09-30 23:28:03 +02:00
2019-03-01 17:31:34 +01:00
data[config]();
}
2021-03-23 17:26:54 +01:00
}
2017-09-30 23:28:03 +02:00
2021-03-23 17:26:54 +01:00
static jQueryInterface(config) {
2019-03-01 17:31:34 +01:00
return this.each(function () {
2019-08-27 15:03:21 +02:00
Collapse.collapseInterface(this, config);
2018-11-13 07:41:12 +01:00
});
2021-03-23 17:26:54 +01:00
}
2015-05-10 08:00:59 +02:00
2021-03-23 17:26:54 +01:00
}
2018-11-13 07:41:12 +01:00
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
2017-09-30 23:28:03 +02:00
2015-05-10 08:00:59 +02:00
2020-09-14 17:12:06 +02:00
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
2018-11-13 07:41:12 +01:00
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') {
2018-11-13 07:41:12 +01:00
event.preventDefault();
}
2017-09-30 23:28:03 +02:00
2021-03-23 17:26:54 +01:00
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;
2019-03-01 17:31:34 +01:00
if (data) {
// update parent attribute
if (data._parent === null && typeof triggerData.parent === 'string') {
data._config.parent = triggerData.parent;
data._parent = data._getParent();
}
config = 'toggle';
} else {
config = triggerData;
}
2018-07-24 02:51:14 +02:00
2019-08-27 15:03:21 +02:00
Collapse.collapseInterface(element, config);
2018-11-13 07:41:12 +01:00
});
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
2020-11-11 18:07:37 +01:00
* add .Collapse to jQuery only if jQuery is present
2018-11-13 07:41:12 +01:00
*/
2015-05-10 08:00:59 +02:00
defineJQueryPlugin(Collapse);
2015-05-10 08:00:59 +02:00
return Collapse;
2018-07-24 02:51:14 +02:00
2019-11-08 09:11:23 +01:00
})));
2018-07-24 02:51:14 +02:00
//# sourceMappingURL=collapse.js.map