2018-11-13 07:41:12 +01:00
|
|
|
/*!
|
2020-08-06 18:22:43 +02:00
|
|
|
* Bootstrap collapse.js v4.5.2 (https://getbootstrap.com/)
|
2020-05-12 18:53:07 +02:00
|
|
|
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
2020-08-04 18:24:33 +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('jquery'), require('./util.js')) :
|
|
|
|
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
|
2020-08-04 18:24:33 +02:00
|
|
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.jQuery, global.Util));
|
2019-11-26 18:12:00 +01:00
|
|
|
}(this, (function ($, Util) { 'use strict';
|
2018-07-24 02:51:14 +02:00
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
$ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
|
|
|
|
Util = Util && Object.prototype.hasOwnProperty.call(Util, 'default') ? Util['default'] : Util;
|
2018-07-24 02:51:14 +02:00
|
|
|
|
2020-08-04 18:24:33 +02:00
|
|
|
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); }
|
2017-09-06 06:05:12 +02:00
|
|
|
|
2020-08-04 18:24:33 +02:00
|
|
|
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); } }
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2020-08-04 18:24:33 +02:00
|
|
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
2018-11-13 07:41:12 +01:00
|
|
|
/**
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
* Constants
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
var NAME = 'collapse';
|
2020-08-06 18:22:43 +02:00
|
|
|
var VERSION = '4.5.2';
|
2018-11-13 07:41:12 +01:00
|
|
|
var DATA_KEY = 'bs.collapse';
|
|
|
|
var EVENT_KEY = "." + DATA_KEY;
|
|
|
|
var DATA_API_KEY = '.data-api';
|
|
|
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
|
|
var Default = {
|
|
|
|
toggle: true,
|
|
|
|
parent: ''
|
|
|
|
};
|
|
|
|
var DefaultType = {
|
|
|
|
toggle: 'boolean',
|
|
|
|
parent: '(string|element)'
|
|
|
|
};
|
2020-05-12 18:53:07 +02:00
|
|
|
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 DIMENSION_WIDTH = 'width';
|
|
|
|
var DIMENSION_HEIGHT = 'height';
|
|
|
|
var SELECTOR_ACTIVES = '.show, .collapsing';
|
|
|
|
var SELECTOR_DATA_TOGGLE = '[data-toggle="collapse"]';
|
2019-11-26 18:12:00 +01:00
|
|
|
/**
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
* Class Definition
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
*/
|
2018-11-13 07:41:12 +01:00
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
var Collapse = /*#__PURE__*/function () {
|
2018-11-13 07:41:12 +01:00
|
|
|
function Collapse(element, config) {
|
|
|
|
this._isTransitioning = false;
|
|
|
|
this._element = element;
|
|
|
|
this._config = this._getConfig(config);
|
2018-11-24 17:22:59 +01:00
|
|
|
this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
|
2020-05-12 18:53:07 +02:00
|
|
|
var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
|
2018-11-13 07:41:12 +01:00
|
|
|
|
|
|
|
for (var i = 0, len = toggleList.length; i < len; i++) {
|
|
|
|
var elem = toggleList[i];
|
|
|
|
var selector = Util.getSelectorFromElement(elem);
|
|
|
|
var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
|
|
|
|
return foundElem === element;
|
|
|
|
});
|
2017-05-16 09:59:44 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (selector !== null && filterElement.length > 0) {
|
|
|
|
this._selector = selector;
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +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
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
this._parent = this._config.parent ? this._getParent() : null;
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (!this._config.parent) {
|
|
|
|
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
|
|
|
}
|
2015-08-13 06:12:03 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (this._config.toggle) {
|
|
|
|
this.toggle();
|
|
|
|
}
|
|
|
|
} // Getters
|
2015-05-10 08:00:59 +02:00
|
|
|
|
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
var _proto = Collapse.prototype;
|
2016-10-10 02:26:51 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
// Public
|
|
|
|
_proto.toggle = function toggle() {
|
2020-05-12 18:53:07 +02:00
|
|
|
if ($(this._element).hasClass(CLASS_NAME_SHOW)) {
|
2018-11-13 07:41:12 +01:00
|
|
|
this.hide();
|
|
|
|
} else {
|
|
|
|
this.show();
|
|
|
|
}
|
|
|
|
};
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
_proto.show = function show() {
|
|
|
|
var _this = this;
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
if (this._isTransitioning || $(this._element).hasClass(CLASS_NAME_SHOW)) {
|
2018-11-13 07:41:12 +01:00
|
|
|
return;
|
|
|
|
}
|
2018-09-17 21:34:34 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
var actives;
|
|
|
|
var activesData;
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (this._parent) {
|
2020-05-12 18:53:07 +02:00
|
|
|
actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) {
|
2018-11-13 07:41:12 +01:00
|
|
|
if (typeof _this._config.parent === 'string') {
|
|
|
|
return elem.getAttribute('data-parent') === _this._config.parent;
|
2018-07-24 02:51:14 +02:00
|
|
|
}
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2020-05-12 18:53:07 +02: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
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (actives) {
|
|
|
|
activesData = $(actives).not(this._selector).data(DATA_KEY);
|
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
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
var startEvent = $.Event(EVENT_SHOW);
|
2018-11-13 07:41:12 +01:00
|
|
|
$(this._element).trigger(startEvent);
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (startEvent.isDefaultPrevented()) {
|
|
|
|
return;
|
|
|
|
}
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (actives) {
|
|
|
|
Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (!activesData) {
|
|
|
|
$(actives).data(DATA_KEY, null);
|
2018-07-24 02:51:14 +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
|
|
|
var dimension = this._getDimension();
|
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
$(this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING);
|
2018-11-13 07:41:12 +01:00
|
|
|
this._element.style[dimension] = 0;
|
|
|
|
|
|
|
|
if (this._triggerArray.length) {
|
2020-05-12 18:53:07 +02:00
|
|
|
$(this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('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
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
var complete = function complete() {
|
2020-05-12 18:53:07 +02:00
|
|
|
$(_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW);
|
2018-11-13 07:41:12 +01:00
|
|
|
_this._element.style[dimension] = '';
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
_this.setTransitioning(false);
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
$(_this._element).trigger(EVENT_SHOWN);
|
2018-07-24 02:51:14 +02:00
|
|
|
};
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
|
|
|
var scrollSize = "scroll" + capitalizedDimension;
|
|
|
|
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
|
|
|
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
|
|
|
this._element.style[dimension] = this._element[scrollSize] + "px";
|
|
|
|
};
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
_proto.hide = function hide() {
|
|
|
|
var _this2 = this;
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
if (this._isTransitioning || !$(this._element).hasClass(CLASS_NAME_SHOW)) {
|
2018-11-13 07:41:12 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
var startEvent = $.Event(EVENT_HIDE);
|
2018-11-13 07:41:12 +01:00
|
|
|
$(this._element).trigger(startEvent);
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (startEvent.isDefaultPrevented()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var dimension = this._getDimension();
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
|
|
|
|
Util.reflow(this._element);
|
2020-05-12 18:53:07 +02:00
|
|
|
$(this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW);
|
2018-11-13 07:41:12 +01:00
|
|
|
var triggerArrayLength = this._triggerArray.length;
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (triggerArrayLength > 0) {
|
|
|
|
for (var i = 0; i < triggerArrayLength; i++) {
|
|
|
|
var trigger = this._triggerArray[i];
|
|
|
|
var selector = Util.getSelectorFromElement(trigger);
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (selector !== null) {
|
|
|
|
var $elem = $([].slice.call(document.querySelectorAll(selector)));
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
if (!$elem.hasClass(CLASS_NAME_SHOW)) {
|
|
|
|
$(trigger).addClass(CLASS_NAME_COLLAPSED).attr('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
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
var complete = function complete() {
|
|
|
|
_this2.setTransitioning(false);
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
$(_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(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] = '';
|
|
|
|
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
|
|
|
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
|
|
|
};
|
2016-10-10 02:26:51 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
_proto.setTransitioning = function setTransitioning(isTransitioning) {
|
|
|
|
this._isTransitioning = isTransitioning;
|
|
|
|
};
|
2016-10-10 02:26:51 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
_proto.dispose = function dispose() {
|
|
|
|
$.removeData(this._element, DATA_KEY);
|
|
|
|
this._config = null;
|
|
|
|
this._parent = null;
|
|
|
|
this._element = null;
|
|
|
|
this._triggerArray = null;
|
|
|
|
this._isTransitioning = null;
|
2019-01-04 17:29:45 +01:00
|
|
|
} // Private
|
|
|
|
;
|
2016-10-10 02:26:51 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
_proto._getConfig = function _getConfig(config) {
|
2020-08-04 18:24:33 +02:00
|
|
|
config = _extends({}, 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
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
Util.typeCheckConfig(NAME, config, DefaultType);
|
|
|
|
return config;
|
|
|
|
};
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
_proto._getDimension = function _getDimension() {
|
2020-05-12 18:53:07 +02:00
|
|
|
var hasWidth = $(this._element).hasClass(DIMENSION_WIDTH);
|
|
|
|
return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT;
|
2018-11-13 07:41:12 +01:00
|
|
|
};
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
_proto._getParent = function _getParent() {
|
|
|
|
var _this3 = this;
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
var parent;
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (Util.isElement(this._config.parent)) {
|
|
|
|
parent = this._config.parent; // It's a jQuery object
|
|
|
|
|
|
|
|
if (typeof this._config.parent.jquery !== 'undefined') {
|
|
|
|
parent = this._config.parent[0];
|
2015-05-10 08:00:59 +02:00
|
|
|
}
|
2018-11-13 07:41:12 +01:00
|
|
|
} else {
|
|
|
|
parent = document.querySelector(this._config.parent);
|
|
|
|
}
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
|
|
|
|
var children = [].slice.call(parent.querySelectorAll(selector));
|
|
|
|
$(children).each(function (i, element) {
|
|
|
|
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
|
|
|
|
});
|
|
|
|
return parent;
|
|
|
|
};
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
|
2020-05-12 18:53:07 +02:00
|
|
|
var isOpen = $(element).hasClass(CLASS_NAME_SHOW);
|
2016-10-10 02:26:51 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (triggerArray.length) {
|
2020-05-12 18:53:07 +02:00
|
|
|
$(triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
|
2018-11-13 07:41:12 +01:00
|
|
|
}
|
2019-01-04 17:29:45 +01:00
|
|
|
} // Static
|
|
|
|
;
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
Collapse._getTargetFromElement = function _getTargetFromElement(element) {
|
|
|
|
var selector = Util.getSelectorFromElement(element);
|
|
|
|
return selector ? document.querySelector(selector) : null;
|
|
|
|
};
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
Collapse._jQueryInterface = function _jQueryInterface(config) {
|
|
|
|
return this.each(function () {
|
|
|
|
var $this = $(this);
|
|
|
|
var data = $this.data(DATA_KEY);
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2020-08-04 18:24:33 +02:00
|
|
|
var _config = _extends({}, Default, $this.data(), typeof config === 'object' && config ? config : {});
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
|
2018-11-13 07:41:12 +01:00
|
|
|
_config.toggle = false;
|
|
|
|
}
|
2018-07-24 02:51:14 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (!data) {
|
|
|
|
data = new Collapse(this, _config);
|
|
|
|
$this.data(DATA_KEY, data);
|
|
|
|
}
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
if (typeof config === 'string') {
|
|
|
|
if (typeof data[config] === 'undefined') {
|
|
|
|
throw new TypeError("No method named \"" + config + "\"");
|
2017-09-06 06:05:12 +02:00
|
|
|
}
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
data[config]();
|
2018-07-24 02:51:14 +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
|
|
|
_createClass(Collapse, null, [{
|
|
|
|
key: "VERSION",
|
|
|
|
get: function get() {
|
|
|
|
return VERSION;
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
key: "Default",
|
|
|
|
get: function get() {
|
|
|
|
return Default;
|
|
|
|
}
|
|
|
|
}]);
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
return Collapse;
|
|
|
|
}();
|
|
|
|
/**
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
* Data Api implementation
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
*/
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2020-05-12 18:53:07 +02:00
|
|
|
$(document).on(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.currentTarget.tagName === 'A') {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
var $trigger = $(this);
|
|
|
|
var selector = Util.getSelectorFromElement(this);
|
|
|
|
var selectors = [].slice.call(document.querySelectorAll(selector));
|
|
|
|
$(selectors).each(function () {
|
|
|
|
var $target = $(this);
|
|
|
|
var data = $target.data(DATA_KEY);
|
|
|
|
var config = data ? 'toggle' : $trigger.data();
|
2018-07-24 02:51:14 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
Collapse._jQueryInterface.call($target, config);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
/**
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
* jQuery
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
*/
|
2015-05-10 08:00:59 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
$.fn[NAME] = Collapse._jQueryInterface;
|
|
|
|
$.fn[NAME].Constructor = Collapse;
|
2017-09-30 23:28:03 +02:00
|
|
|
|
2018-11-13 07:41:12 +01:00
|
|
|
$.fn[NAME].noConflict = function () {
|
|
|
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
|
|
|
return Collapse._jQueryInterface;
|
|
|
|
};
|
2015-05-10 08:00:59 +02:00
|
|
|
|
|
|
|
return Collapse;
|
2018-07-24 02:51:14 +02:00
|
|
|
|
2019-11-26 18:12:00 +01:00
|
|
|
})));
|
2018-07-24 02:51:14 +02:00
|
|
|
//# sourceMappingURL=collapse.js.map
|