3731 |
efrain |
1 |
/*!
|
|
|
2 |
* Bootstrap v4.6.0 (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' ? factory(exports, require('jquery')) :
|
|
|
8 |
typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) :
|
|
|
9 |
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.bootstrap = {}, global.jQuery));
|
|
|
10 |
}(this, (function (exports, $) { 'use strict';
|
|
|
11 |
|
|
|
12 |
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
|
13 |
|
|
|
14 |
var $__default = /*#__PURE__*/_interopDefaultLegacy($);
|
|
|
15 |
|
|
|
16 |
function _defineProperties(target, props) {
|
|
|
17 |
for (var i = 0; i < props.length; i++) {
|
|
|
18 |
var descriptor = props[i];
|
|
|
19 |
descriptor.enumerable = descriptor.enumerable || false;
|
|
|
20 |
descriptor.configurable = true;
|
|
|
21 |
if ("value" in descriptor) descriptor.writable = true;
|
|
|
22 |
Object.defineProperty(target, descriptor.key, descriptor);
|
|
|
23 |
}
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
function _createClass(Constructor, protoProps, staticProps) {
|
|
|
27 |
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
|
28 |
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
|
29 |
return Constructor;
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
function _extends() {
|
|
|
33 |
_extends = Object.assign || function (target) {
|
|
|
34 |
for (var i = 1; i < arguments.length; i++) {
|
|
|
35 |
var source = arguments[i];
|
|
|
36 |
|
|
|
37 |
for (var key in source) {
|
|
|
38 |
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
|
39 |
target[key] = source[key];
|
|
|
40 |
}
|
|
|
41 |
}
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
return target;
|
|
|
45 |
};
|
|
|
46 |
|
|
|
47 |
return _extends.apply(this, arguments);
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
function _inheritsLoose(subClass, superClass) {
|
|
|
51 |
subClass.prototype = Object.create(superClass.prototype);
|
|
|
52 |
subClass.prototype.constructor = subClass;
|
|
|
53 |
subClass.__proto__ = superClass;
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
/**
|
|
|
57 |
* --------------------------------------------------------------------------
|
|
|
58 |
* Bootstrap (v4.6.0): util.js
|
|
|
59 |
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
|
60 |
* --------------------------------------------------------------------------
|
|
|
61 |
*/
|
|
|
62 |
/**
|
|
|
63 |
* ------------------------------------------------------------------------
|
|
|
64 |
* Private TransitionEnd Helpers
|
|
|
65 |
* ------------------------------------------------------------------------
|
|
|
66 |
*/
|
|
|
67 |
|
|
|
68 |
var TRANSITION_END = 'transitionend';
|
|
|
69 |
var MAX_UID = 1000000;
|
|
|
70 |
var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
|
|
71 |
|
|
|
72 |
function toType(obj) {
|
|
|
73 |
if (obj === null || typeof obj === 'undefined') {
|
|
|
74 |
return "" + obj;
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
function getSpecialTransitionEndEvent() {
|
|
|
81 |
return {
|
|
|
82 |
bindType: TRANSITION_END,
|
|
|
83 |
delegateType: TRANSITION_END,
|
|
|
84 |
handle: function handle(event) {
|
|
|
85 |
if ($__default['default'](event.target).is(this)) {
|
|
|
86 |
return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
return undefined;
|
|
|
90 |
}
|
|
|
91 |
};
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
function transitionEndEmulator(duration) {
|
|
|
95 |
var _this = this;
|
|
|
96 |
|
|
|
97 |
var called = false;
|
|
|
98 |
$__default['default'](this).one(Util.TRANSITION_END, function () {
|
|
|
99 |
called = true;
|
|
|
100 |
});
|
|
|
101 |
setTimeout(function () {
|
|
|
102 |
if (!called) {
|
|
|
103 |
Util.triggerTransitionEnd(_this);
|
|
|
104 |
}
|
|
|
105 |
}, duration);
|
|
|
106 |
return this;
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
function setTransitionEndSupport() {
|
|
|
110 |
$__default['default'].fn.emulateTransitionEnd = transitionEndEmulator;
|
|
|
111 |
$__default['default'].event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
|
|
|
112 |
}
|
|
|
113 |
/**
|
|
|
114 |
* --------------------------------------------------------------------------
|
|
|
115 |
* Public Util Api
|
|
|
116 |
* --------------------------------------------------------------------------
|
|
|
117 |
*/
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
var Util = {
|
|
|
121 |
TRANSITION_END: 'bsTransitionEnd',
|
|
|
122 |
getUID: function getUID(prefix) {
|
|
|
123 |
do {
|
|
|
124 |
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
|
|
|
125 |
} while (document.getElementById(prefix));
|
|
|
126 |
|
|
|
127 |
return prefix;
|
|
|
128 |
},
|
|
|
129 |
getSelectorFromElement: function getSelectorFromElement(element) {
|
|
|
130 |
var selector = element.getAttribute('data-target');
|
|
|
131 |
|
|
|
132 |
if (!selector || selector === '#') {
|
|
|
133 |
var hrefAttr = element.getAttribute('href');
|
|
|
134 |
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
try {
|
|
|
138 |
return document.querySelector(selector) ? selector : null;
|
|
|
139 |
} catch (_) {
|
|
|
140 |
return null;
|
|
|
141 |
}
|
|
|
142 |
},
|
|
|
143 |
getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
|
|
|
144 |
if (!element) {
|
|
|
145 |
return 0;
|
|
|
146 |
} // Get transition-duration of the element
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
var transitionDuration = $__default['default'](element).css('transition-duration');
|
|
|
150 |
var transitionDelay = $__default['default'](element).css('transition-delay');
|
|
|
151 |
var floatTransitionDuration = parseFloat(transitionDuration);
|
|
|
152 |
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
|
|
153 |
|
|
|
154 |
if (!floatTransitionDuration && !floatTransitionDelay) {
|
|
|
155 |
return 0;
|
|
|
156 |
} // If multiple durations are defined, take the first
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
transitionDuration = transitionDuration.split(',')[0];
|
|
|
160 |
transitionDelay = transitionDelay.split(',')[0];
|
|
|
161 |
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
|
|
162 |
},
|
|
|
163 |
reflow: function reflow(element) {
|
|
|
164 |
return element.offsetHeight;
|
|
|
165 |
},
|
|
|
166 |
triggerTransitionEnd: function triggerTransitionEnd(element) {
|
|
|
167 |
$__default['default'](element).trigger(TRANSITION_END);
|
|
|
168 |
},
|
|
|
169 |
supportsTransitionEnd: function supportsTransitionEnd() {
|
|
|
170 |
return Boolean(TRANSITION_END);
|
|
|
171 |
},
|
|
|
172 |
isElement: function isElement(obj) {
|
|
|
173 |
return (obj[0] || obj).nodeType;
|
|
|
174 |
},
|
|
|
175 |
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
|
|
|
176 |
for (var property in configTypes) {
|
|
|
177 |
if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
|
|
|
178 |
var expectedTypes = configTypes[property];
|
|
|
179 |
var value = config[property];
|
|
|
180 |
var valueType = value && Util.isElement(value) ? 'element' : toType(value);
|
|
|
181 |
|
|
|
182 |
if (!new RegExp(expectedTypes).test(valueType)) {
|
|
|
183 |
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
|
|
184 |
}
|
|
|
185 |
}
|
|
|
186 |
}
|
|
|
187 |
},
|
|
|
188 |
findShadowRoot: function findShadowRoot(element) {
|
|
|
189 |
if (!document.documentElement.attachShadow) {
|
|
|
190 |
return null;
|
|
|
191 |
} // Can find the shadow root otherwise it'll return the document
|
|
|
192 |
|
|
|
193 |
|
|
|
194 |
if (typeof element.getRootNode === 'function') {
|
|
|
195 |
var root = element.getRootNode();
|
|
|
196 |
return root instanceof ShadowRoot ? root : null;
|
|
|
197 |
}
|
|
|
198 |
|
|
|
199 |
if (element instanceof ShadowRoot) {
|
|
|
200 |
return element;
|
|
|
201 |
} // when we don't find a shadow root
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
if (!element.parentNode) {
|
|
|
205 |
return null;
|
|
|
206 |
}
|
|
|
207 |
|
|
|
208 |
return Util.findShadowRoot(element.parentNode);
|
|
|
209 |
},
|
|
|
210 |
jQueryDetection: function jQueryDetection() {
|
|
|
211 |
if (typeof $__default['default'] === 'undefined') {
|
|
|
212 |
throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
var version = $__default['default'].fn.jquery.split(' ')[0].split('.');
|
|
|
216 |
var minMajor = 1;
|
|
|
217 |
var ltMajor = 2;
|
|
|
218 |
var minMinor = 9;
|
|
|
219 |
var minPatch = 1;
|
|
|
220 |
var maxMajor = 4;
|
|
|
221 |
|
|
|
222 |
if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
|
|
|
223 |
throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
|
|
|
224 |
}
|
|
|
225 |
}
|
|
|
226 |
};
|
|
|
227 |
Util.jQueryDetection();
|
|
|
228 |
setTransitionEndSupport();
|
|
|
229 |
|
|
|
230 |
/**
|
|
|
231 |
* ------------------------------------------------------------------------
|
|
|
232 |
* Constants
|
|
|
233 |
* ------------------------------------------------------------------------
|
|
|
234 |
*/
|
|
|
235 |
|
|
|
236 |
var NAME = 'alert';
|
|
|
237 |
var VERSION = '4.6.0';
|
|
|
238 |
var DATA_KEY = 'bs.alert';
|
|
|
239 |
var EVENT_KEY = "." + DATA_KEY;
|
|
|
240 |
var DATA_API_KEY = '.data-api';
|
|
|
241 |
var JQUERY_NO_CONFLICT = $__default['default'].fn[NAME];
|
|
|
242 |
var SELECTOR_DISMISS = '[data-dismiss="alert"]';
|
|
|
243 |
var EVENT_CLOSE = "close" + EVENT_KEY;
|
|
|
244 |
var EVENT_CLOSED = "closed" + EVENT_KEY;
|
|
|
245 |
var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
|
|
|
246 |
var CLASS_NAME_ALERT = 'alert';
|
|
|
247 |
var CLASS_NAME_FADE = 'fade';
|
|
|
248 |
var CLASS_NAME_SHOW = 'show';
|
|
|
249 |
/**
|
|
|
250 |
* ------------------------------------------------------------------------
|
|
|
251 |
* Class Definition
|
|
|
252 |
* ------------------------------------------------------------------------
|
|
|
253 |
*/
|
|
|
254 |
|
|
|
255 |
var Alert = /*#__PURE__*/function () {
|
|
|
256 |
function Alert(element) {
|
|
|
257 |
this._element = element;
|
|
|
258 |
} // Getters
|
|
|
259 |
|
|
|
260 |
|
|
|
261 |
var _proto = Alert.prototype;
|
|
|
262 |
|
|
|
263 |
// Public
|
|
|
264 |
_proto.close = function close(element) {
|
|
|
265 |
var rootElement = this._element;
|
|
|
266 |
|
|
|
267 |
if (element) {
|
|
|
268 |
rootElement = this._getRootElement(element);
|
|
|
269 |
}
|
|
|
270 |
|
|
|
271 |
var customEvent = this._triggerCloseEvent(rootElement);
|
|
|
272 |
|
|
|
273 |
if (customEvent.isDefaultPrevented()) {
|
|
|
274 |
return;
|
|
|
275 |
}
|
|
|
276 |
|
|
|
277 |
this._removeElement(rootElement);
|
|
|
278 |
};
|
|
|
279 |
|
|
|
280 |
_proto.dispose = function dispose() {
|
|
|
281 |
$__default['default'].removeData(this._element, DATA_KEY);
|
|
|
282 |
this._element = null;
|
|
|
283 |
} // Private
|
|
|
284 |
;
|
|
|
285 |
|
|
|
286 |
_proto._getRootElement = function _getRootElement(element) {
|
|
|
287 |
var selector = Util.getSelectorFromElement(element);
|
|
|
288 |
var parent = false;
|
|
|
289 |
|
|
|
290 |
if (selector) {
|
|
|
291 |
parent = document.querySelector(selector);
|
|
|
292 |
}
|
|
|
293 |
|
|
|
294 |
if (!parent) {
|
|
|
295 |
parent = $__default['default'](element).closest("." + CLASS_NAME_ALERT)[0];
|
|
|
296 |
}
|
|
|
297 |
|
|
|
298 |
return parent;
|
|
|
299 |
};
|
|
|
300 |
|
|
|
301 |
_proto._triggerCloseEvent = function _triggerCloseEvent(element) {
|
|
|
302 |
var closeEvent = $__default['default'].Event(EVENT_CLOSE);
|
|
|
303 |
$__default['default'](element).trigger(closeEvent);
|
|
|
304 |
return closeEvent;
|
|
|
305 |
};
|
|
|
306 |
|
|
|
307 |
_proto._removeElement = function _removeElement(element) {
|
|
|
308 |
var _this = this;
|
|
|
309 |
|
|
|
310 |
$__default['default'](element).removeClass(CLASS_NAME_SHOW);
|
|
|
311 |
|
|
|
312 |
if (!$__default['default'](element).hasClass(CLASS_NAME_FADE)) {
|
|
|
313 |
this._destroyElement(element);
|
|
|
314 |
|
|
|
315 |
return;
|
|
|
316 |
}
|
|
|
317 |
|
|
|
318 |
var transitionDuration = Util.getTransitionDurationFromElement(element);
|
|
|
319 |
$__default['default'](element).one(Util.TRANSITION_END, function (event) {
|
|
|
320 |
return _this._destroyElement(element, event);
|
|
|
321 |
}).emulateTransitionEnd(transitionDuration);
|
|
|
322 |
};
|
|
|
323 |
|
|
|
324 |
_proto._destroyElement = function _destroyElement(element) {
|
|
|
325 |
$__default['default'](element).detach().trigger(EVENT_CLOSED).remove();
|
|
|
326 |
} // Static
|
|
|
327 |
;
|
|
|
328 |
|
|
|
329 |
Alert._jQueryInterface = function _jQueryInterface(config) {
|
|
|
330 |
return this.each(function () {
|
|
|
331 |
var $element = $__default['default'](this);
|
|
|
332 |
var data = $element.data(DATA_KEY);
|
|
|
333 |
|
|
|
334 |
if (!data) {
|
|
|
335 |
data = new Alert(this);
|
|
|
336 |
$element.data(DATA_KEY, data);
|
|
|
337 |
}
|
|
|
338 |
|
|
|
339 |
if (config === 'close') {
|
|
|
340 |
data[config](this);
|
|
|
341 |
}
|
|
|
342 |
});
|
|
|
343 |
};
|
|
|
344 |
|
|
|
345 |
Alert._handleDismiss = function _handleDismiss(alertInstance) {
|
|
|
346 |
return function (event) {
|
|
|
347 |
if (event) {
|
|
|
348 |
event.preventDefault();
|
|
|
349 |
}
|
|
|
350 |
|
|
|
351 |
alertInstance.close(this);
|
|
|
352 |
};
|
|
|
353 |
};
|
|
|
354 |
|
|
|
355 |
_createClass(Alert, null, [{
|
|
|
356 |
key: "VERSION",
|
|
|
357 |
get: function get() {
|
|
|
358 |
return VERSION;
|
|
|
359 |
}
|
|
|
360 |
}]);
|
|
|
361 |
|
|
|
362 |
return Alert;
|
|
|
363 |
}();
|
|
|
364 |
/**
|
|
|
365 |
* ------------------------------------------------------------------------
|
|
|
366 |
* Data Api implementation
|
|
|
367 |
* ------------------------------------------------------------------------
|
|
|
368 |
*/
|
|
|
369 |
|
|
|
370 |
|
|
|
371 |
$__default['default'](document).on(EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert._handleDismiss(new Alert()));
|
|
|
372 |
/**
|
|
|
373 |
* ------------------------------------------------------------------------
|
|
|
374 |
* jQuery
|
|
|
375 |
* ------------------------------------------------------------------------
|
|
|
376 |
*/
|
|
|
377 |
|
|
|
378 |
$__default['default'].fn[NAME] = Alert._jQueryInterface;
|
|
|
379 |
$__default['default'].fn[NAME].Constructor = Alert;
|
|
|
380 |
|
|
|
381 |
$__default['default'].fn[NAME].noConflict = function () {
|
|
|
382 |
$__default['default'].fn[NAME] = JQUERY_NO_CONFLICT;
|
|
|
383 |
return Alert._jQueryInterface;
|
|
|
384 |
};
|
|
|
385 |
|
|
|
386 |
/**
|
|
|
387 |
* ------------------------------------------------------------------------
|
|
|
388 |
* Constants
|
|
|
389 |
* ------------------------------------------------------------------------
|
|
|
390 |
*/
|
|
|
391 |
|
|
|
392 |
var NAME$1 = 'button';
|
|
|
393 |
var VERSION$1 = '4.6.0';
|
|
|
394 |
var DATA_KEY$1 = 'bs.button';
|
|
|
395 |
var EVENT_KEY$1 = "." + DATA_KEY$1;
|
|
|
396 |
var DATA_API_KEY$1 = '.data-api';
|
|
|
397 |
var JQUERY_NO_CONFLICT$1 = $__default['default'].fn[NAME$1];
|
|
|
398 |
var CLASS_NAME_ACTIVE = 'active';
|
|
|
399 |
var CLASS_NAME_BUTTON = 'btn';
|
|
|
400 |
var CLASS_NAME_FOCUS = 'focus';
|
|
|
401 |
var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]';
|
|
|
402 |
var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]';
|
|
|
403 |
var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
|
|
|
404 |
var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn';
|
|
|
405 |
var SELECTOR_INPUT = 'input:not([type="hidden"])';
|
|
|
406 |
var SELECTOR_ACTIVE = '.active';
|
|
|
407 |
var SELECTOR_BUTTON = '.btn';
|
|
|
408 |
var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
|
|
|
409 |
var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1);
|
|
|
410 |
var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$1 + DATA_API_KEY$1;
|
|
|
411 |
/**
|
|
|
412 |
* ------------------------------------------------------------------------
|
|
|
413 |
* Class Definition
|
|
|
414 |
* ------------------------------------------------------------------------
|
|
|
415 |
*/
|
|
|
416 |
|
|
|
417 |
var Button = /*#__PURE__*/function () {
|
|
|
418 |
function Button(element) {
|
|
|
419 |
this._element = element;
|
|
|
420 |
this.shouldAvoidTriggerChange = false;
|
|
|
421 |
} // Getters
|
|
|
422 |
|
|
|
423 |
|
|
|
424 |
var _proto = Button.prototype;
|
|
|
425 |
|
|
|
426 |
// Public
|
|
|
427 |
_proto.toggle = function toggle() {
|
|
|
428 |
var triggerChangeEvent = true;
|
|
|
429 |
var addAriaPressed = true;
|
|
|
430 |
var rootElement = $__default['default'](this._element).closest(SELECTOR_DATA_TOGGLES)[0];
|
|
|
431 |
|
|
|
432 |
if (rootElement) {
|
|
|
433 |
var input = this._element.querySelector(SELECTOR_INPUT);
|
|
|
434 |
|
|
|
435 |
if (input) {
|
|
|
436 |
if (input.type === 'radio') {
|
|
|
437 |
if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
|
|
|
438 |
triggerChangeEvent = false;
|
|
|
439 |
} else {
|
|
|
440 |
var activeElement = rootElement.querySelector(SELECTOR_ACTIVE);
|
|
|
441 |
|
|
|
442 |
if (activeElement) {
|
|
|
443 |
$__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE);
|
|
|
444 |
}
|
|
|
445 |
}
|
|
|
446 |
}
|
|
|
447 |
|
|
|
448 |
if (triggerChangeEvent) {
|
|
|
449 |
// if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
|
|
|
450 |
if (input.type === 'checkbox' || input.type === 'radio') {
|
|
|
451 |
input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE);
|
|
|
452 |
}
|
|
|
453 |
|
|
|
454 |
if (!this.shouldAvoidTriggerChange) {
|
|
|
455 |
$__default['default'](input).trigger('change');
|
|
|
456 |
}
|
|
|
457 |
}
|
|
|
458 |
|
|
|
459 |
input.focus();
|
|
|
460 |
addAriaPressed = false;
|
|
|
461 |
}
|
|
|
462 |
}
|
|
|
463 |
|
|
|
464 |
if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
|
|
|
465 |
if (addAriaPressed) {
|
|
|
466 |
this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE));
|
|
|
467 |
}
|
|
|
468 |
|
|
|
469 |
if (triggerChangeEvent) {
|
|
|
470 |
$__default['default'](this._element).toggleClass(CLASS_NAME_ACTIVE);
|
|
|
471 |
}
|
|
|
472 |
}
|
|
|
473 |
};
|
|
|
474 |
|
|
|
475 |
_proto.dispose = function dispose() {
|
|
|
476 |
$__default['default'].removeData(this._element, DATA_KEY$1);
|
|
|
477 |
this._element = null;
|
|
|
478 |
} // Static
|
|
|
479 |
;
|
|
|
480 |
|
|
|
481 |
Button._jQueryInterface = function _jQueryInterface(config, avoidTriggerChange) {
|
|
|
482 |
return this.each(function () {
|
|
|
483 |
var $element = $__default['default'](this);
|
|
|
484 |
var data = $element.data(DATA_KEY$1);
|
|
|
485 |
|
|
|
486 |
if (!data) {
|
|
|
487 |
data = new Button(this);
|
|
|
488 |
$element.data(DATA_KEY$1, data);
|
|
|
489 |
}
|
|
|
490 |
|
|
|
491 |
data.shouldAvoidTriggerChange = avoidTriggerChange;
|
|
|
492 |
|
|
|
493 |
if (config === 'toggle') {
|
|
|
494 |
data[config]();
|
|
|
495 |
}
|
|
|
496 |
});
|
|
|
497 |
};
|
|
|
498 |
|
|
|
499 |
_createClass(Button, null, [{
|
|
|
500 |
key: "VERSION",
|
|
|
501 |
get: function get() {
|
|
|
502 |
return VERSION$1;
|
|
|
503 |
}
|
|
|
504 |
}]);
|
|
|
505 |
|
|
|
506 |
return Button;
|
|
|
507 |
}();
|
|
|
508 |
/**
|
|
|
509 |
* ------------------------------------------------------------------------
|
|
|
510 |
* Data Api implementation
|
|
|
511 |
* ------------------------------------------------------------------------
|
|
|
512 |
*/
|
|
|
513 |
|
|
|
514 |
|
|
|
515 |
$__default['default'](document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
|
|
|
516 |
var button = event.target;
|
|
|
517 |
var initialButton = button;
|
|
|
518 |
|
|
|
519 |
if (!$__default['default'](button).hasClass(CLASS_NAME_BUTTON)) {
|
|
|
520 |
button = $__default['default'](button).closest(SELECTOR_BUTTON)[0];
|
|
|
521 |
}
|
|
|
522 |
|
|
|
523 |
if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
|
|
|
524 |
event.preventDefault(); // work around Firefox bug #1540995
|
|
|
525 |
} else {
|
|
|
526 |
var inputBtn = button.querySelector(SELECTOR_INPUT);
|
|
|
527 |
|
|
|
528 |
if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
|
|
|
529 |
event.preventDefault(); // work around Firefox bug #1540995
|
|
|
530 |
|
|
|
531 |
return;
|
|
|
532 |
}
|
|
|
533 |
|
|
|
534 |
if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') {
|
|
|
535 |
Button._jQueryInterface.call($__default['default'](button), 'toggle', initialButton.tagName === 'INPUT');
|
|
|
536 |
}
|
|
|
537 |
}
|
|
|
538 |
}).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) {
|
|
|
539 |
var button = $__default['default'](event.target).closest(SELECTOR_BUTTON)[0];
|
|
|
540 |
$__default['default'](button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type));
|
|
|
541 |
});
|
|
|
542 |
$__default['default'](window).on(EVENT_LOAD_DATA_API, function () {
|
|
|
543 |
// ensure correct active class is set to match the controls' actual values/states
|
|
|
544 |
// find all checkboxes/readio buttons inside data-toggle groups
|
|
|
545 |
var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS));
|
|
|
546 |
|
|
|
547 |
for (var i = 0, len = buttons.length; i < len; i++) {
|
|
|
548 |
var button = buttons[i];
|
|
|
549 |
var input = button.querySelector(SELECTOR_INPUT);
|
|
|
550 |
|
|
|
551 |
if (input.checked || input.hasAttribute('checked')) {
|
|
|
552 |
button.classList.add(CLASS_NAME_ACTIVE);
|
|
|
553 |
} else {
|
|
|
554 |
button.classList.remove(CLASS_NAME_ACTIVE);
|
|
|
555 |
}
|
|
|
556 |
} // find all button toggles
|
|
|
557 |
|
|
|
558 |
|
|
|
559 |
buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE));
|
|
|
560 |
|
|
|
561 |
for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
|
|
|
562 |
var _button = buttons[_i];
|
|
|
563 |
|
|
|
564 |
if (_button.getAttribute('aria-pressed') === 'true') {
|
|
|
565 |
_button.classList.add(CLASS_NAME_ACTIVE);
|
|
|
566 |
} else {
|
|
|
567 |
_button.classList.remove(CLASS_NAME_ACTIVE);
|
|
|
568 |
}
|
|
|
569 |
}
|
|
|
570 |
});
|
|
|
571 |
/**
|
|
|
572 |
* ------------------------------------------------------------------------
|
|
|
573 |
* jQuery
|
|
|
574 |
* ------------------------------------------------------------------------
|
|
|
575 |
*/
|
|
|
576 |
|
|
|
577 |
$__default['default'].fn[NAME$1] = Button._jQueryInterface;
|
|
|
578 |
$__default['default'].fn[NAME$1].Constructor = Button;
|
|
|
579 |
|
|
|
580 |
$__default['default'].fn[NAME$1].noConflict = function () {
|
|
|
581 |
$__default['default'].fn[NAME$1] = JQUERY_NO_CONFLICT$1;
|
|
|
582 |
return Button._jQueryInterface;
|
|
|
583 |
};
|
|
|
584 |
|
|
|
585 |
/**
|
|
|
586 |
* ------------------------------------------------------------------------
|
|
|
587 |
* Constants
|
|
|
588 |
* ------------------------------------------------------------------------
|
|
|
589 |
*/
|
|
|
590 |
|
|
|
591 |
var NAME$2 = 'carousel';
|
|
|
592 |
var VERSION$2 = '4.6.0';
|
|
|
593 |
var DATA_KEY$2 = 'bs.carousel';
|
|
|
594 |
var EVENT_KEY$2 = "." + DATA_KEY$2;
|
|
|
595 |
var DATA_API_KEY$2 = '.data-api';
|
|
|
596 |
var JQUERY_NO_CONFLICT$2 = $__default['default'].fn[NAME$2];
|
|
|
597 |
var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
|
|
|
598 |
|
|
|
599 |
var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
|
|
|
600 |
|
|
|
601 |
var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
|
|
|
602 |
|
|
|
603 |
var SWIPE_THRESHOLD = 40;
|
|
|
604 |
var Default = {
|
|
|
605 |
interval: 5000,
|
|
|
606 |
keyboard: true,
|
|
|
607 |
slide: false,
|
|
|
608 |
pause: 'hover',
|
|
|
609 |
wrap: true,
|
|
|
610 |
touch: true
|
|
|
611 |
};
|
|
|
612 |
var DefaultType = {
|
|
|
613 |
interval: '(number|boolean)',
|
|
|
614 |
keyboard: 'boolean',
|
|
|
615 |
slide: '(boolean|string)',
|
|
|
616 |
pause: '(string|boolean)',
|
|
|
617 |
wrap: 'boolean',
|
|
|
618 |
touch: 'boolean'
|
|
|
619 |
};
|
|
|
620 |
var DIRECTION_NEXT = 'next';
|
|
|
621 |
var DIRECTION_PREV = 'prev';
|
|
|
622 |
var DIRECTION_LEFT = 'left';
|
|
|
623 |
var DIRECTION_RIGHT = 'right';
|
|
|
624 |
var EVENT_SLIDE = "slide" + EVENT_KEY$2;
|
|
|
625 |
var EVENT_SLID = "slid" + EVENT_KEY$2;
|
|
|
626 |
var EVENT_KEYDOWN = "keydown" + EVENT_KEY$2;
|
|
|
627 |
var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$2;
|
|
|
628 |
var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$2;
|
|
|
629 |
var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$2;
|
|
|
630 |
var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$2;
|
|
|
631 |
var EVENT_TOUCHEND = "touchend" + EVENT_KEY$2;
|
|
|
632 |
var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$2;
|
|
|
633 |
var EVENT_POINTERUP = "pointerup" + EVENT_KEY$2;
|
|
|
634 |
var EVENT_DRAG_START = "dragstart" + EVENT_KEY$2;
|
|
|
635 |
var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$2 + DATA_API_KEY$2;
|
|
|
636 |
var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$2 + DATA_API_KEY$2;
|
|
|
637 |
var CLASS_NAME_CAROUSEL = 'carousel';
|
|
|
638 |
var CLASS_NAME_ACTIVE$1 = 'active';
|
|
|
639 |
var CLASS_NAME_SLIDE = 'slide';
|
|
|
640 |
var CLASS_NAME_RIGHT = 'carousel-item-right';
|
|
|
641 |
var CLASS_NAME_LEFT = 'carousel-item-left';
|
|
|
642 |
var CLASS_NAME_NEXT = 'carousel-item-next';
|
|
|
643 |
var CLASS_NAME_PREV = 'carousel-item-prev';
|
|
|
644 |
var CLASS_NAME_POINTER_EVENT = 'pointer-event';
|
|
|
645 |
var SELECTOR_ACTIVE$1 = '.active';
|
|
|
646 |
var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
|
|
|
647 |
var SELECTOR_ITEM = '.carousel-item';
|
|
|
648 |
var SELECTOR_ITEM_IMG = '.carousel-item img';
|
|
|
649 |
var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
|
|
|
650 |
var SELECTOR_INDICATORS = '.carousel-indicators';
|
|
|
651 |
var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
|
|
|
652 |
var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
|
|
|
653 |
var PointerType = {
|
|
|
654 |
TOUCH: 'touch',
|
|
|
655 |
PEN: 'pen'
|
|
|
656 |
};
|
|
|
657 |
/**
|
|
|
658 |
* ------------------------------------------------------------------------
|
|
|
659 |
* Class Definition
|
|
|
660 |
* ------------------------------------------------------------------------
|
|
|
661 |
*/
|
|
|
662 |
|
|
|
663 |
var Carousel = /*#__PURE__*/function () {
|
|
|
664 |
function Carousel(element, config) {
|
|
|
665 |
this._items = null;
|
|
|
666 |
this._interval = null;
|
|
|
667 |
this._activeElement = null;
|
|
|
668 |
this._isPaused = false;
|
|
|
669 |
this._isSliding = false;
|
|
|
670 |
this.touchTimeout = null;
|
|
|
671 |
this.touchStartX = 0;
|
|
|
672 |
this.touchDeltaX = 0;
|
|
|
673 |
this._config = this._getConfig(config);
|
|
|
674 |
this._element = element;
|
|
|
675 |
this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
|
|
|
676 |
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
|
|
677 |
this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
|
|
|
678 |
|
|
|
679 |
this._addEventListeners();
|
|
|
680 |
} // Getters
|
|
|
681 |
|
|
|
682 |
|
|
|
683 |
var _proto = Carousel.prototype;
|
|
|
684 |
|
|
|
685 |
// Public
|
|
|
686 |
_proto.next = function next() {
|
|
|
687 |
if (!this._isSliding) {
|
|
|
688 |
this._slide(DIRECTION_NEXT);
|
|
|
689 |
}
|
|
|
690 |
};
|
|
|
691 |
|
|
|
692 |
_proto.nextWhenVisible = function nextWhenVisible() {
|
|
|
693 |
var $element = $__default['default'](this._element); // Don't call next when the page isn't visible
|
|
|
694 |
// or the carousel or its parent isn't visible
|
|
|
695 |
|
|
|
696 |
if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') {
|
|
|
697 |
this.next();
|
|
|
698 |
}
|
|
|
699 |
};
|
|
|
700 |
|
|
|
701 |
_proto.prev = function prev() {
|
|
|
702 |
if (!this._isSliding) {
|
|
|
703 |
this._slide(DIRECTION_PREV);
|
|
|
704 |
}
|
|
|
705 |
};
|
|
|
706 |
|
|
|
707 |
_proto.pause = function pause(event) {
|
|
|
708 |
if (!event) {
|
|
|
709 |
this._isPaused = true;
|
|
|
710 |
}
|
|
|
711 |
|
|
|
712 |
if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
|
|
|
713 |
Util.triggerTransitionEnd(this._element);
|
|
|
714 |
this.cycle(true);
|
|
|
715 |
}
|
|
|
716 |
|
|
|
717 |
clearInterval(this._interval);
|
|
|
718 |
this._interval = null;
|
|
|
719 |
};
|
|
|
720 |
|
|
|
721 |
_proto.cycle = function cycle(event) {
|
|
|
722 |
if (!event) {
|
|
|
723 |
this._isPaused = false;
|
|
|
724 |
}
|
|
|
725 |
|
|
|
726 |
if (this._interval) {
|
|
|
727 |
clearInterval(this._interval);
|
|
|
728 |
this._interval = null;
|
|
|
729 |
}
|
|
|
730 |
|
|
|
731 |
if (this._config.interval && !this._isPaused) {
|
|
|
732 |
this._updateInterval();
|
|
|
733 |
|
|
|
734 |
this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
|
|
|
735 |
}
|
|
|
736 |
};
|
|
|
737 |
|
|
|
738 |
_proto.to = function to(index) {
|
|
|
739 |
var _this = this;
|
|
|
740 |
|
|
|
741 |
this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
|
|
|
742 |
|
|
|
743 |
var activeIndex = this._getItemIndex(this._activeElement);
|
|
|
744 |
|
|
|
745 |
if (index > this._items.length - 1 || index < 0) {
|
|
|
746 |
return;
|
|
|
747 |
}
|
|
|
748 |
|
|
|
749 |
if (this._isSliding) {
|
|
|
750 |
$__default['default'](this._element).one(EVENT_SLID, function () {
|
|
|
751 |
return _this.to(index);
|
|
|
752 |
});
|
|
|
753 |
return;
|
|
|
754 |
}
|
|
|
755 |
|
|
|
756 |
if (activeIndex === index) {
|
|
|
757 |
this.pause();
|
|
|
758 |
this.cycle();
|
|
|
759 |
return;
|
|
|
760 |
}
|
|
|
761 |
|
|
|
762 |
var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
|
|
|
763 |
|
|
|
764 |
this._slide(direction, this._items[index]);
|
|
|
765 |
};
|
|
|
766 |
|
|
|
767 |
_proto.dispose = function dispose() {
|
|
|
768 |
$__default['default'](this._element).off(EVENT_KEY$2);
|
|
|
769 |
$__default['default'].removeData(this._element, DATA_KEY$2);
|
|
|
770 |
this._items = null;
|
|
|
771 |
this._config = null;
|
|
|
772 |
this._element = null;
|
|
|
773 |
this._interval = null;
|
|
|
774 |
this._isPaused = null;
|
|
|
775 |
this._isSliding = null;
|
|
|
776 |
this._activeElement = null;
|
|
|
777 |
this._indicatorsElement = null;
|
|
|
778 |
} // Private
|
|
|
779 |
;
|
|
|
780 |
|
|
|
781 |
_proto._getConfig = function _getConfig(config) {
|
|
|
782 |
config = _extends({}, Default, config);
|
|
|
783 |
Util.typeCheckConfig(NAME$2, config, DefaultType);
|
|
|
784 |
return config;
|
|
|
785 |
};
|
|
|
786 |
|
|
|
787 |
_proto._handleSwipe = function _handleSwipe() {
|
|
|
788 |
var absDeltax = Math.abs(this.touchDeltaX);
|
|
|
789 |
|
|
|
790 |
if (absDeltax <= SWIPE_THRESHOLD) {
|
|
|
791 |
return;
|
|
|
792 |
}
|
|
|
793 |
|
|
|
794 |
var direction = absDeltax / this.touchDeltaX;
|
|
|
795 |
this.touchDeltaX = 0; // swipe left
|
|
|
796 |
|
|
|
797 |
if (direction > 0) {
|
|
|
798 |
this.prev();
|
|
|
799 |
} // swipe right
|
|
|
800 |
|
|
|
801 |
|
|
|
802 |
if (direction < 0) {
|
|
|
803 |
this.next();
|
|
|
804 |
}
|
|
|
805 |
};
|
|
|
806 |
|
|
|
807 |
_proto._addEventListeners = function _addEventListeners() {
|
|
|
808 |
var _this2 = this;
|
|
|
809 |
|
|
|
810 |
if (this._config.keyboard) {
|
|
|
811 |
$__default['default'](this._element).on(EVENT_KEYDOWN, function (event) {
|
|
|
812 |
return _this2._keydown(event);
|
|
|
813 |
});
|
|
|
814 |
}
|
|
|
815 |
|
|
|
816 |
if (this._config.pause === 'hover') {
|
|
|
817 |
$__default['default'](this._element).on(EVENT_MOUSEENTER, function (event) {
|
|
|
818 |
return _this2.pause(event);
|
|
|
819 |
}).on(EVENT_MOUSELEAVE, function (event) {
|
|
|
820 |
return _this2.cycle(event);
|
|
|
821 |
});
|
|
|
822 |
}
|
|
|
823 |
|
|
|
824 |
if (this._config.touch) {
|
|
|
825 |
this._addTouchEventListeners();
|
|
|
826 |
}
|
|
|
827 |
};
|
|
|
828 |
|
|
|
829 |
_proto._addTouchEventListeners = function _addTouchEventListeners() {
|
|
|
830 |
var _this3 = this;
|
|
|
831 |
|
|
|
832 |
if (!this._touchSupported) {
|
|
|
833 |
return;
|
|
|
834 |
}
|
|
|
835 |
|
|
|
836 |
var start = function start(event) {
|
|
|
837 |
if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
|
|
838 |
_this3.touchStartX = event.originalEvent.clientX;
|
|
|
839 |
} else if (!_this3._pointerEvent) {
|
|
|
840 |
_this3.touchStartX = event.originalEvent.touches[0].clientX;
|
|
|
841 |
}
|
|
|
842 |
};
|
|
|
843 |
|
|
|
844 |
var move = function move(event) {
|
|
|
845 |
// ensure swiping with one touch and not pinching
|
|
|
846 |
if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
|
|
|
847 |
_this3.touchDeltaX = 0;
|
|
|
848 |
} else {
|
|
|
849 |
_this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
|
|
|
850 |
}
|
|
|
851 |
};
|
|
|
852 |
|
|
|
853 |
var end = function end(event) {
|
|
|
854 |
if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
|
|
855 |
_this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
|
|
|
856 |
}
|
|
|
857 |
|
|
|
858 |
_this3._handleSwipe();
|
|
|
859 |
|
|
|
860 |
if (_this3._config.pause === 'hover') {
|
|
|
861 |
// If it's a touch-enabled device, mouseenter/leave are fired as
|
|
|
862 |
// part of the mouse compatibility events on first tap - the carousel
|
|
|
863 |
// would stop cycling until user tapped out of it;
|
|
|
864 |
// here, we listen for touchend, explicitly pause the carousel
|
|
|
865 |
// (as if it's the second time we tap on it, mouseenter compat event
|
|
|
866 |
// is NOT fired) and after a timeout (to allow for mouse compatibility
|
|
|
867 |
// events to fire) we explicitly restart cycling
|
|
|
868 |
_this3.pause();
|
|
|
869 |
|
|
|
870 |
if (_this3.touchTimeout) {
|
|
|
871 |
clearTimeout(_this3.touchTimeout);
|
|
|
872 |
}
|
|
|
873 |
|
|
|
874 |
_this3.touchTimeout = setTimeout(function (event) {
|
|
|
875 |
return _this3.cycle(event);
|
|
|
876 |
}, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
|
|
|
877 |
}
|
|
|
878 |
};
|
|
|
879 |
|
|
|
880 |
$__default['default'](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) {
|
|
|
881 |
return e.preventDefault();
|
|
|
882 |
});
|
|
|
883 |
|
|
|
884 |
if (this._pointerEvent) {
|
|
|
885 |
$__default['default'](this._element).on(EVENT_POINTERDOWN, function (event) {
|
|
|
886 |
return start(event);
|
|
|
887 |
});
|
|
|
888 |
$__default['default'](this._element).on(EVENT_POINTERUP, function (event) {
|
|
|
889 |
return end(event);
|
|
|
890 |
});
|
|
|
891 |
|
|
|
892 |
this._element.classList.add(CLASS_NAME_POINTER_EVENT);
|
|
|
893 |
} else {
|
|
|
894 |
$__default['default'](this._element).on(EVENT_TOUCHSTART, function (event) {
|
|
|
895 |
return start(event);
|
|
|
896 |
});
|
|
|
897 |
$__default['default'](this._element).on(EVENT_TOUCHMOVE, function (event) {
|
|
|
898 |
return move(event);
|
|
|
899 |
});
|
|
|
900 |
$__default['default'](this._element).on(EVENT_TOUCHEND, function (event) {
|
|
|
901 |
return end(event);
|
|
|
902 |
});
|
|
|
903 |
}
|
|
|
904 |
};
|
|
|
905 |
|
|
|
906 |
_proto._keydown = function _keydown(event) {
|
|
|
907 |
if (/input|textarea/i.test(event.target.tagName)) {
|
|
|
908 |
return;
|
|
|
909 |
}
|
|
|
910 |
|
|
|
911 |
switch (event.which) {
|
|
|
912 |
case ARROW_LEFT_KEYCODE:
|
|
|
913 |
event.preventDefault();
|
|
|
914 |
this.prev();
|
|
|
915 |
break;
|
|
|
916 |
|
|
|
917 |
case ARROW_RIGHT_KEYCODE:
|
|
|
918 |
event.preventDefault();
|
|
|
919 |
this.next();
|
|
|
920 |
break;
|
|
|
921 |
}
|
|
|
922 |
};
|
|
|
923 |
|
|
|
924 |
_proto._getItemIndex = function _getItemIndex(element) {
|
|
|
925 |
this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
|
|
|
926 |
return this._items.indexOf(element);
|
|
|
927 |
};
|
|
|
928 |
|
|
|
929 |
_proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
|
|
|
930 |
var isNextDirection = direction === DIRECTION_NEXT;
|
|
|
931 |
var isPrevDirection = direction === DIRECTION_PREV;
|
|
|
932 |
|
|
|
933 |
var activeIndex = this._getItemIndex(activeElement);
|
|
|
934 |
|
|
|
935 |
var lastItemIndex = this._items.length - 1;
|
|
|
936 |
var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
|
|
|
937 |
|
|
|
938 |
if (isGoingToWrap && !this._config.wrap) {
|
|
|
939 |
return activeElement;
|
|
|
940 |
}
|
|
|
941 |
|
|
|
942 |
var delta = direction === DIRECTION_PREV ? -1 : 1;
|
|
|
943 |
var itemIndex = (activeIndex + delta) % this._items.length;
|
|
|
944 |
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
|
|
|
945 |
};
|
|
|
946 |
|
|
|
947 |
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
|
|
|
948 |
var targetIndex = this._getItemIndex(relatedTarget);
|
|
|
949 |
|
|
|
950 |
var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
|
|
|
951 |
|
|
|
952 |
var slideEvent = $__default['default'].Event(EVENT_SLIDE, {
|
|
|
953 |
relatedTarget: relatedTarget,
|
|
|
954 |
direction: eventDirectionName,
|
|
|
955 |
from: fromIndex,
|
|
|
956 |
to: targetIndex
|
|
|
957 |
});
|
|
|
958 |
$__default['default'](this._element).trigger(slideEvent);
|
|
|
959 |
return slideEvent;
|
|
|
960 |
};
|
|
|
961 |
|
|
|
962 |
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
|
|
|
963 |
if (this._indicatorsElement) {
|
|
|
964 |
var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1));
|
|
|
965 |
$__default['default'](indicators).removeClass(CLASS_NAME_ACTIVE$1);
|
|
|
966 |
|
|
|
967 |
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
|
|
|
968 |
|
|
|
969 |
if (nextIndicator) {
|
|
|
970 |
$__default['default'](nextIndicator).addClass(CLASS_NAME_ACTIVE$1);
|
|
|
971 |
}
|
|
|
972 |
}
|
|
|
973 |
};
|
|
|
974 |
|
|
|
975 |
_proto._updateInterval = function _updateInterval() {
|
|
|
976 |
var element = this._activeElement || this._element.querySelector(SELECTOR_ACTIVE_ITEM);
|
|
|
977 |
|
|
|
978 |
if (!element) {
|
|
|
979 |
return;
|
|
|
980 |
}
|
|
|
981 |
|
|
|
982 |
var elementInterval = parseInt(element.getAttribute('data-interval'), 10);
|
|
|
983 |
|
|
|
984 |
if (elementInterval) {
|
|
|
985 |
this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
|
|
|
986 |
this._config.interval = elementInterval;
|
|
|
987 |
} else {
|
|
|
988 |
this._config.interval = this._config.defaultInterval || this._config.interval;
|
|
|
989 |
}
|
|
|
990 |
};
|
|
|
991 |
|
|
|
992 |
_proto._slide = function _slide(direction, element) {
|
|
|
993 |
var _this4 = this;
|
|
|
994 |
|
|
|
995 |
var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
|
|
|
996 |
|
|
|
997 |
var activeElementIndex = this._getItemIndex(activeElement);
|
|
|
998 |
|
|
|
999 |
var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
|
|
|
1000 |
|
|
|
1001 |
var nextElementIndex = this._getItemIndex(nextElement);
|
|
|
1002 |
|
|
|
1003 |
var isCycling = Boolean(this._interval);
|
|
|
1004 |
var directionalClassName;
|
|
|
1005 |
var orderClassName;
|
|
|
1006 |
var eventDirectionName;
|
|
|
1007 |
|
|
|
1008 |
if (direction === DIRECTION_NEXT) {
|
|
|
1009 |
directionalClassName = CLASS_NAME_LEFT;
|
|
|
1010 |
orderClassName = CLASS_NAME_NEXT;
|
|
|
1011 |
eventDirectionName = DIRECTION_LEFT;
|
|
|
1012 |
} else {
|
|
|
1013 |
directionalClassName = CLASS_NAME_RIGHT;
|
|
|
1014 |
orderClassName = CLASS_NAME_PREV;
|
|
|
1015 |
eventDirectionName = DIRECTION_RIGHT;
|
|
|
1016 |
}
|
|
|
1017 |
|
|
|
1018 |
if (nextElement && $__default['default'](nextElement).hasClass(CLASS_NAME_ACTIVE$1)) {
|
|
|
1019 |
this._isSliding = false;
|
|
|
1020 |
return;
|
|
|
1021 |
}
|
|
|
1022 |
|
|
|
1023 |
var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
|
|
|
1024 |
|
|
|
1025 |
if (slideEvent.isDefaultPrevented()) {
|
|
|
1026 |
return;
|
|
|
1027 |
}
|
|
|
1028 |
|
|
|
1029 |
if (!activeElement || !nextElement) {
|
|
|
1030 |
// Some weirdness is happening, so we bail
|
|
|
1031 |
return;
|
|
|
1032 |
}
|
|
|
1033 |
|
|
|
1034 |
this._isSliding = true;
|
|
|
1035 |
|
|
|
1036 |
if (isCycling) {
|
|
|
1037 |
this.pause();
|
|
|
1038 |
}
|
|
|
1039 |
|
|
|
1040 |
this._setActiveIndicatorElement(nextElement);
|
|
|
1041 |
|
|
|
1042 |
this._activeElement = nextElement;
|
|
|
1043 |
var slidEvent = $__default['default'].Event(EVENT_SLID, {
|
|
|
1044 |
relatedTarget: nextElement,
|
|
|
1045 |
direction: eventDirectionName,
|
|
|
1046 |
from: activeElementIndex,
|
|
|
1047 |
to: nextElementIndex
|
|
|
1048 |
});
|
|
|
1049 |
|
|
|
1050 |
if ($__default['default'](this._element).hasClass(CLASS_NAME_SLIDE)) {
|
|
|
1051 |
$__default['default'](nextElement).addClass(orderClassName);
|
|
|
1052 |
Util.reflow(nextElement);
|
|
|
1053 |
$__default['default'](activeElement).addClass(directionalClassName);
|
|
|
1054 |
$__default['default'](nextElement).addClass(directionalClassName);
|
|
|
1055 |
var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
|
|
|
1056 |
$__default['default'](activeElement).one(Util.TRANSITION_END, function () {
|
|
|
1057 |
$__default['default'](nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$1);
|
|
|
1058 |
$__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE$1 + " " + orderClassName + " " + directionalClassName);
|
|
|
1059 |
_this4._isSliding = false;
|
|
|
1060 |
setTimeout(function () {
|
|
|
1061 |
return $__default['default'](_this4._element).trigger(slidEvent);
|
|
|
1062 |
}, 0);
|
|
|
1063 |
}).emulateTransitionEnd(transitionDuration);
|
|
|
1064 |
} else {
|
|
|
1065 |
$__default['default'](activeElement).removeClass(CLASS_NAME_ACTIVE$1);
|
|
|
1066 |
$__default['default'](nextElement).addClass(CLASS_NAME_ACTIVE$1);
|
|
|
1067 |
this._isSliding = false;
|
|
|
1068 |
$__default['default'](this._element).trigger(slidEvent);
|
|
|
1069 |
}
|
|
|
1070 |
|
|
|
1071 |
if (isCycling) {
|
|
|
1072 |
this.cycle();
|
|
|
1073 |
}
|
|
|
1074 |
} // Static
|
|
|
1075 |
;
|
|
|
1076 |
|
|
|
1077 |
Carousel._jQueryInterface = function _jQueryInterface(config) {
|
|
|
1078 |
return this.each(function () {
|
|
|
1079 |
var data = $__default['default'](this).data(DATA_KEY$2);
|
|
|
1080 |
|
|
|
1081 |
var _config = _extends({}, Default, $__default['default'](this).data());
|
|
|
1082 |
|
|
|
1083 |
if (typeof config === 'object') {
|
|
|
1084 |
_config = _extends({}, _config, config);
|
|
|
1085 |
}
|
|
|
1086 |
|
|
|
1087 |
var action = typeof config === 'string' ? config : _config.slide;
|
|
|
1088 |
|
|
|
1089 |
if (!data) {
|
|
|
1090 |
data = new Carousel(this, _config);
|
|
|
1091 |
$__default['default'](this).data(DATA_KEY$2, data);
|
|
|
1092 |
}
|
|
|
1093 |
|
|
|
1094 |
if (typeof config === 'number') {
|
|
|
1095 |
data.to(config);
|
|
|
1096 |
} else if (typeof action === 'string') {
|
|
|
1097 |
if (typeof data[action] === 'undefined') {
|
|
|
1098 |
throw new TypeError("No method named \"" + action + "\"");
|
|
|
1099 |
}
|
|
|
1100 |
|
|
|
1101 |
data[action]();
|
|
|
1102 |
} else if (_config.interval && _config.ride) {
|
|
|
1103 |
data.pause();
|
|
|
1104 |
data.cycle();
|
|
|
1105 |
}
|
|
|
1106 |
});
|
|
|
1107 |
};
|
|
|
1108 |
|
|
|
1109 |
Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
|
|
|
1110 |
var selector = Util.getSelectorFromElement(this);
|
|
|
1111 |
|
|
|
1112 |
if (!selector) {
|
|
|
1113 |
return;
|
|
|
1114 |
}
|
|
|
1115 |
|
|
|
1116 |
var target = $__default['default'](selector)[0];
|
|
|
1117 |
|
|
|
1118 |
if (!target || !$__default['default'](target).hasClass(CLASS_NAME_CAROUSEL)) {
|
|
|
1119 |
return;
|
|
|
1120 |
}
|
|
|
1121 |
|
|
|
1122 |
var config = _extends({}, $__default['default'](target).data(), $__default['default'](this).data());
|
|
|
1123 |
|
|
|
1124 |
var slideIndex = this.getAttribute('data-slide-to');
|
|
|
1125 |
|
|
|
1126 |
if (slideIndex) {
|
|
|
1127 |
config.interval = false;
|
|
|
1128 |
}
|
|
|
1129 |
|
|
|
1130 |
Carousel._jQueryInterface.call($__default['default'](target), config);
|
|
|
1131 |
|
|
|
1132 |
if (slideIndex) {
|
|
|
1133 |
$__default['default'](target).data(DATA_KEY$2).to(slideIndex);
|
|
|
1134 |
}
|
|
|
1135 |
|
|
|
1136 |
event.preventDefault();
|
|
|
1137 |
};
|
|
|
1138 |
|
|
|
1139 |
_createClass(Carousel, null, [{
|
|
|
1140 |
key: "VERSION",
|
|
|
1141 |
get: function get() {
|
|
|
1142 |
return VERSION$2;
|
|
|
1143 |
}
|
|
|
1144 |
}, {
|
|
|
1145 |
key: "Default",
|
|
|
1146 |
get: function get() {
|
|
|
1147 |
return Default;
|
|
|
1148 |
}
|
|
|
1149 |
}]);
|
|
|
1150 |
|
|
|
1151 |
return Carousel;
|
|
|
1152 |
}();
|
|
|
1153 |
/**
|
|
|
1154 |
* ------------------------------------------------------------------------
|
|
|
1155 |
* Data Api implementation
|
|
|
1156 |
* ------------------------------------------------------------------------
|
|
|
1157 |
*/
|
|
|
1158 |
|
|
|
1159 |
|
|
|
1160 |
$__default['default'](document).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler);
|
|
|
1161 |
$__default['default'](window).on(EVENT_LOAD_DATA_API$1, function () {
|
|
|
1162 |
var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE));
|
|
|
1163 |
|
|
|
1164 |
for (var i = 0, len = carousels.length; i < len; i++) {
|
|
|
1165 |
var $carousel = $__default['default'](carousels[i]);
|
|
|
1166 |
|
|
|
1167 |
Carousel._jQueryInterface.call($carousel, $carousel.data());
|
|
|
1168 |
}
|
|
|
1169 |
});
|
|
|
1170 |
/**
|
|
|
1171 |
* ------------------------------------------------------------------------
|
|
|
1172 |
* jQuery
|
|
|
1173 |
* ------------------------------------------------------------------------
|
|
|
1174 |
*/
|
|
|
1175 |
|
|
|
1176 |
$__default['default'].fn[NAME$2] = Carousel._jQueryInterface;
|
|
|
1177 |
$__default['default'].fn[NAME$2].Constructor = Carousel;
|
|
|
1178 |
|
|
|
1179 |
$__default['default'].fn[NAME$2].noConflict = function () {
|
|
|
1180 |
$__default['default'].fn[NAME$2] = JQUERY_NO_CONFLICT$2;
|
|
|
1181 |
return Carousel._jQueryInterface;
|
|
|
1182 |
};
|
|
|
1183 |
|
|
|
1184 |
/**
|
|
|
1185 |
* ------------------------------------------------------------------------
|
|
|
1186 |
* Constants
|
|
|
1187 |
* ------------------------------------------------------------------------
|
|
|
1188 |
*/
|
|
|
1189 |
|
|
|
1190 |
var NAME$3 = 'collapse';
|
|
|
1191 |
var VERSION$3 = '4.6.0';
|
|
|
1192 |
var DATA_KEY$3 = 'bs.collapse';
|
|
|
1193 |
var EVENT_KEY$3 = "." + DATA_KEY$3;
|
|
|
1194 |
var DATA_API_KEY$3 = '.data-api';
|
|
|
1195 |
var JQUERY_NO_CONFLICT$3 = $__default['default'].fn[NAME$3];
|
|
|
1196 |
var Default$1 = {
|
|
|
1197 |
toggle: true,
|
|
|
1198 |
parent: ''
|
|
|
1199 |
};
|
|
|
1200 |
var DefaultType$1 = {
|
|
|
1201 |
toggle: 'boolean',
|
|
|
1202 |
parent: '(string|element)'
|
|
|
1203 |
};
|
|
|
1204 |
var EVENT_SHOW = "show" + EVENT_KEY$3;
|
|
|
1205 |
var EVENT_SHOWN = "shown" + EVENT_KEY$3;
|
|
|
1206 |
var EVENT_HIDE = "hide" + EVENT_KEY$3;
|
|
|
1207 |
var EVENT_HIDDEN = "hidden" + EVENT_KEY$3;
|
|
|
1208 |
var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$3 + DATA_API_KEY$3;
|
|
|
1209 |
var CLASS_NAME_SHOW$1 = 'show';
|
|
|
1210 |
var CLASS_NAME_COLLAPSE = 'collapse';
|
|
|
1211 |
var CLASS_NAME_COLLAPSING = 'collapsing';
|
|
|
1212 |
var CLASS_NAME_COLLAPSED = 'collapsed';
|
|
|
1213 |
var DIMENSION_WIDTH = 'width';
|
|
|
1214 |
var DIMENSION_HEIGHT = 'height';
|
|
|
1215 |
var SELECTOR_ACTIVES = '.show, .collapsing';
|
|
|
1216 |
var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="collapse"]';
|
|
|
1217 |
/**
|
|
|
1218 |
* ------------------------------------------------------------------------
|
|
|
1219 |
* Class Definition
|
|
|
1220 |
* ------------------------------------------------------------------------
|
|
|
1221 |
*/
|
|
|
1222 |
|
|
|
1223 |
var Collapse = /*#__PURE__*/function () {
|
|
|
1224 |
function Collapse(element, config) {
|
|
|
1225 |
this._isTransitioning = false;
|
|
|
1226 |
this._element = element;
|
|
|
1227 |
this._config = this._getConfig(config);
|
|
|
1228 |
this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
|
|
|
1229 |
var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$1));
|
|
|
1230 |
|
|
|
1231 |
for (var i = 0, len = toggleList.length; i < len; i++) {
|
|
|
1232 |
var elem = toggleList[i];
|
|
|
1233 |
var selector = Util.getSelectorFromElement(elem);
|
|
|
1234 |
var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
|
|
|
1235 |
return foundElem === element;
|
|
|
1236 |
});
|
|
|
1237 |
|
|
|
1238 |
if (selector !== null && filterElement.length > 0) {
|
|
|
1239 |
this._selector = selector;
|
|
|
1240 |
|
|
|
1241 |
this._triggerArray.push(elem);
|
|
|
1242 |
}
|
|
|
1243 |
}
|
|
|
1244 |
|
|
|
1245 |
this._parent = this._config.parent ? this._getParent() : null;
|
|
|
1246 |
|
|
|
1247 |
if (!this._config.parent) {
|
|
|
1248 |
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
|
|
1249 |
}
|
|
|
1250 |
|
|
|
1251 |
if (this._config.toggle) {
|
|
|
1252 |
this.toggle();
|
|
|
1253 |
}
|
|
|
1254 |
} // Getters
|
|
|
1255 |
|
|
|
1256 |
|
|
|
1257 |
var _proto = Collapse.prototype;
|
|
|
1258 |
|
|
|
1259 |
// Public
|
|
|
1260 |
_proto.toggle = function toggle() {
|
|
|
1261 |
if ($__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
|
|
|
1262 |
this.hide();
|
|
|
1263 |
} else {
|
|
|
1264 |
this.show();
|
|
|
1265 |
}
|
|
|
1266 |
};
|
|
|
1267 |
|
|
|
1268 |
_proto.show = function show() {
|
|
|
1269 |
var _this = this;
|
|
|
1270 |
|
|
|
1271 |
if (this._isTransitioning || $__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
|
|
|
1272 |
return;
|
|
|
1273 |
}
|
|
|
1274 |
|
|
|
1275 |
var actives;
|
|
|
1276 |
var activesData;
|
|
|
1277 |
|
|
|
1278 |
if (this._parent) {
|
|
|
1279 |
actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) {
|
|
|
1280 |
if (typeof _this._config.parent === 'string') {
|
|
|
1281 |
return elem.getAttribute('data-parent') === _this._config.parent;
|
|
|
1282 |
}
|
|
|
1283 |
|
|
|
1284 |
return elem.classList.contains(CLASS_NAME_COLLAPSE);
|
|
|
1285 |
});
|
|
|
1286 |
|
|
|
1287 |
if (actives.length === 0) {
|
|
|
1288 |
actives = null;
|
|
|
1289 |
}
|
|
|
1290 |
}
|
|
|
1291 |
|
|
|
1292 |
if (actives) {
|
|
|
1293 |
activesData = $__default['default'](actives).not(this._selector).data(DATA_KEY$3);
|
|
|
1294 |
|
|
|
1295 |
if (activesData && activesData._isTransitioning) {
|
|
|
1296 |
return;
|
|
|
1297 |
}
|
|
|
1298 |
}
|
|
|
1299 |
|
|
|
1300 |
var startEvent = $__default['default'].Event(EVENT_SHOW);
|
|
|
1301 |
$__default['default'](this._element).trigger(startEvent);
|
|
|
1302 |
|
|
|
1303 |
if (startEvent.isDefaultPrevented()) {
|
|
|
1304 |
return;
|
|
|
1305 |
}
|
|
|
1306 |
|
|
|
1307 |
if (actives) {
|
|
|
1308 |
Collapse._jQueryInterface.call($__default['default'](actives).not(this._selector), 'hide');
|
|
|
1309 |
|
|
|
1310 |
if (!activesData) {
|
|
|
1311 |
$__default['default'](actives).data(DATA_KEY$3, null);
|
|
|
1312 |
}
|
|
|
1313 |
}
|
|
|
1314 |
|
|
|
1315 |
var dimension = this._getDimension();
|
|
|
1316 |
|
|
|
1317 |
$__default['default'](this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING);
|
|
|
1318 |
this._element.style[dimension] = 0;
|
|
|
1319 |
|
|
|
1320 |
if (this._triggerArray.length) {
|
|
|
1321 |
$__default['default'](this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true);
|
|
|
1322 |
}
|
|
|
1323 |
|
|
|
1324 |
this.setTransitioning(true);
|
|
|
1325 |
|
|
|
1326 |
var complete = function complete() {
|
|
|
1327 |
$__default['default'](_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
|
|
|
1328 |
_this._element.style[dimension] = '';
|
|
|
1329 |
|
|
|
1330 |
_this.setTransitioning(false);
|
|
|
1331 |
|
|
|
1332 |
$__default['default'](_this._element).trigger(EVENT_SHOWN);
|
|
|
1333 |
};
|
|
|
1334 |
|
|
|
1335 |
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
|
|
1336 |
var scrollSize = "scroll" + capitalizedDimension;
|
|
|
1337 |
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
|
|
1338 |
$__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
|
|
1339 |
this._element.style[dimension] = this._element[scrollSize] + "px";
|
|
|
1340 |
};
|
|
|
1341 |
|
|
|
1342 |
_proto.hide = function hide() {
|
|
|
1343 |
var _this2 = this;
|
|
|
1344 |
|
|
|
1345 |
if (this._isTransitioning || !$__default['default'](this._element).hasClass(CLASS_NAME_SHOW$1)) {
|
|
|
1346 |
return;
|
|
|
1347 |
}
|
|
|
1348 |
|
|
|
1349 |
var startEvent = $__default['default'].Event(EVENT_HIDE);
|
|
|
1350 |
$__default['default'](this._element).trigger(startEvent);
|
|
|
1351 |
|
|
|
1352 |
if (startEvent.isDefaultPrevented()) {
|
|
|
1353 |
return;
|
|
|
1354 |
}
|
|
|
1355 |
|
|
|
1356 |
var dimension = this._getDimension();
|
|
|
1357 |
|
|
|
1358 |
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
|
|
|
1359 |
Util.reflow(this._element);
|
|
|
1360 |
$__default['default'](this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$1);
|
|
|
1361 |
var triggerArrayLength = this._triggerArray.length;
|
|
|
1362 |
|
|
|
1363 |
if (triggerArrayLength > 0) {
|
|
|
1364 |
for (var i = 0; i < triggerArrayLength; i++) {
|
|
|
1365 |
var trigger = this._triggerArray[i];
|
|
|
1366 |
var selector = Util.getSelectorFromElement(trigger);
|
|
|
1367 |
|
|
|
1368 |
if (selector !== null) {
|
|
|
1369 |
var $elem = $__default['default']([].slice.call(document.querySelectorAll(selector)));
|
|
|
1370 |
|
|
|
1371 |
if (!$elem.hasClass(CLASS_NAME_SHOW$1)) {
|
|
|
1372 |
$__default['default'](trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false);
|
|
|
1373 |
}
|
|
|
1374 |
}
|
|
|
1375 |
}
|
|
|
1376 |
}
|
|
|
1377 |
|
|
|
1378 |
this.setTransitioning(true);
|
|
|
1379 |
|
|
|
1380 |
var complete = function complete() {
|
|
|
1381 |
_this2.setTransitioning(false);
|
|
|
1382 |
|
|
|
1383 |
$__default['default'](_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN);
|
|
|
1384 |
};
|
|
|
1385 |
|
|
|
1386 |
this._element.style[dimension] = '';
|
|
|
1387 |
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
|
|
1388 |
$__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
|
|
1389 |
};
|
|
|
1390 |
|
|
|
1391 |
_proto.setTransitioning = function setTransitioning(isTransitioning) {
|
|
|
1392 |
this._isTransitioning = isTransitioning;
|
|
|
1393 |
};
|
|
|
1394 |
|
|
|
1395 |
_proto.dispose = function dispose() {
|
|
|
1396 |
$__default['default'].removeData(this._element, DATA_KEY$3);
|
|
|
1397 |
this._config = null;
|
|
|
1398 |
this._parent = null;
|
|
|
1399 |
this._element = null;
|
|
|
1400 |
this._triggerArray = null;
|
|
|
1401 |
this._isTransitioning = null;
|
|
|
1402 |
} // Private
|
|
|
1403 |
;
|
|
|
1404 |
|
|
|
1405 |
_proto._getConfig = function _getConfig(config) {
|
|
|
1406 |
config = _extends({}, Default$1, config);
|
|
|
1407 |
config.toggle = Boolean(config.toggle); // Coerce string values
|
|
|
1408 |
|
|
|
1409 |
Util.typeCheckConfig(NAME$3, config, DefaultType$1);
|
|
|
1410 |
return config;
|
|
|
1411 |
};
|
|
|
1412 |
|
|
|
1413 |
_proto._getDimension = function _getDimension() {
|
|
|
1414 |
var hasWidth = $__default['default'](this._element).hasClass(DIMENSION_WIDTH);
|
|
|
1415 |
return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT;
|
|
|
1416 |
};
|
|
|
1417 |
|
|
|
1418 |
_proto._getParent = function _getParent() {
|
|
|
1419 |
var _this3 = this;
|
|
|
1420 |
|
|
|
1421 |
var parent;
|
|
|
1422 |
|
|
|
1423 |
if (Util.isElement(this._config.parent)) {
|
|
|
1424 |
parent = this._config.parent; // It's a jQuery object
|
|
|
1425 |
|
|
|
1426 |
if (typeof this._config.parent.jquery !== 'undefined') {
|
|
|
1427 |
parent = this._config.parent[0];
|
|
|
1428 |
}
|
|
|
1429 |
} else {
|
|
|
1430 |
parent = document.querySelector(this._config.parent);
|
|
|
1431 |
}
|
|
|
1432 |
|
|
|
1433 |
var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
|
|
|
1434 |
var children = [].slice.call(parent.querySelectorAll(selector));
|
|
|
1435 |
$__default['default'](children).each(function (i, element) {
|
|
|
1436 |
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
|
|
|
1437 |
});
|
|
|
1438 |
return parent;
|
|
|
1439 |
};
|
|
|
1440 |
|
|
|
1441 |
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
|
|
|
1442 |
var isOpen = $__default['default'](element).hasClass(CLASS_NAME_SHOW$1);
|
|
|
1443 |
|
|
|
1444 |
if (triggerArray.length) {
|
|
|
1445 |
$__default['default'](triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
|
|
|
1446 |
}
|
|
|
1447 |
} // Static
|
|
|
1448 |
;
|
|
|
1449 |
|
|
|
1450 |
Collapse._getTargetFromElement = function _getTargetFromElement(element) {
|
|
|
1451 |
var selector = Util.getSelectorFromElement(element);
|
|
|
1452 |
return selector ? document.querySelector(selector) : null;
|
|
|
1453 |
};
|
|
|
1454 |
|
|
|
1455 |
Collapse._jQueryInterface = function _jQueryInterface(config) {
|
|
|
1456 |
return this.each(function () {
|
|
|
1457 |
var $element = $__default['default'](this);
|
|
|
1458 |
var data = $element.data(DATA_KEY$3);
|
|
|
1459 |
|
|
|
1460 |
var _config = _extends({}, Default$1, $element.data(), typeof config === 'object' && config ? config : {});
|
|
|
1461 |
|
|
|
1462 |
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
|
|
|
1463 |
_config.toggle = false;
|
|
|
1464 |
}
|
|
|
1465 |
|
|
|
1466 |
if (!data) {
|
|
|
1467 |
data = new Collapse(this, _config);
|
|
|
1468 |
$element.data(DATA_KEY$3, data);
|
|
|
1469 |
}
|
|
|
1470 |
|
|
|
1471 |
if (typeof config === 'string') {
|
|
|
1472 |
if (typeof data[config] === 'undefined') {
|
|
|
1473 |
throw new TypeError("No method named \"" + config + "\"");
|
|
|
1474 |
}
|
|
|
1475 |
|
|
|
1476 |
data[config]();
|
|
|
1477 |
}
|
|
|
1478 |
});
|
|
|
1479 |
};
|
|
|
1480 |
|
|
|
1481 |
_createClass(Collapse, null, [{
|
|
|
1482 |
key: "VERSION",
|
|
|
1483 |
get: function get() {
|
|
|
1484 |
return VERSION$3;
|
|
|
1485 |
}
|
|
|
1486 |
}, {
|
|
|
1487 |
key: "Default",
|
|
|
1488 |
get: function get() {
|
|
|
1489 |
return Default$1;
|
|
|
1490 |
}
|
|
|
1491 |
}]);
|
|
|
1492 |
|
|
|
1493 |
return Collapse;
|
|
|
1494 |
}();
|
|
|
1495 |
/**
|
|
|
1496 |
* ------------------------------------------------------------------------
|
|
|
1497 |
* Data Api implementation
|
|
|
1498 |
* ------------------------------------------------------------------------
|
|
|
1499 |
*/
|
|
|
1500 |
|
|
|
1501 |
|
|
|
1502 |
$__default['default'](document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$1, function (event) {
|
|
|
1503 |
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
|
|
|
1504 |
if (event.currentTarget.tagName === 'A') {
|
|
|
1505 |
event.preventDefault();
|
|
|
1506 |
}
|
|
|
1507 |
|
|
|
1508 |
var $trigger = $__default['default'](this);
|
|
|
1509 |
var selector = Util.getSelectorFromElement(this);
|
|
|
1510 |
var selectors = [].slice.call(document.querySelectorAll(selector));
|
|
|
1511 |
$__default['default'](selectors).each(function () {
|
|
|
1512 |
var $target = $__default['default'](this);
|
|
|
1513 |
var data = $target.data(DATA_KEY$3);
|
|
|
1514 |
var config = data ? 'toggle' : $trigger.data();
|
|
|
1515 |
|
|
|
1516 |
Collapse._jQueryInterface.call($target, config);
|
|
|
1517 |
});
|
|
|
1518 |
});
|
|
|
1519 |
/**
|
|
|
1520 |
* ------------------------------------------------------------------------
|
|
|
1521 |
* jQuery
|
|
|
1522 |
* ------------------------------------------------------------------------
|
|
|
1523 |
*/
|
|
|
1524 |
|
|
|
1525 |
$__default['default'].fn[NAME$3] = Collapse._jQueryInterface;
|
|
|
1526 |
$__default['default'].fn[NAME$3].Constructor = Collapse;
|
|
|
1527 |
|
|
|
1528 |
$__default['default'].fn[NAME$3].noConflict = function () {
|
|
|
1529 |
$__default['default'].fn[NAME$3] = JQUERY_NO_CONFLICT$3;
|
|
|
1530 |
return Collapse._jQueryInterface;
|
|
|
1531 |
};
|
|
|
1532 |
|
|
|
1533 |
/**!
|
|
|
1534 |
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
|
|
1535 |
* @version 1.16.1
|
|
|
1536 |
* @license
|
|
|
1537 |
* Copyright (c) 2016 Federico Zivolo and contributors
|
|
|
1538 |
*
|
|
|
1539 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
1540 |
* of this software and associated documentation files (the "Software"), to deal
|
|
|
1541 |
* in the Software without restriction, including without limitation the rights
|
|
|
1542 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
1543 |
* copies of the Software, and to permit persons to whom the Software is
|
|
|
1544 |
* furnished to do so, subject to the following conditions:
|
|
|
1545 |
*
|
|
|
1546 |
* The above copyright notice and this permission notice shall be included in all
|
|
|
1547 |
* copies or substantial portions of the Software.
|
|
|
1548 |
*
|
|
|
1549 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
1550 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
1551 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
1552 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
1553 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
1554 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
1555 |
* SOFTWARE.
|
|
|
1556 |
*/
|
|
|
1557 |
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
|
|
|
1558 |
|
|
|
1559 |
var timeoutDuration = function () {
|
|
|
1560 |
var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
|
|
|
1561 |
for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
|
|
|
1562 |
if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
|
|
|
1563 |
return 1;
|
|
|
1564 |
}
|
|
|
1565 |
}
|
|
|
1566 |
return 0;
|
|
|
1567 |
}();
|
|
|
1568 |
|
|
|
1569 |
function microtaskDebounce(fn) {
|
|
|
1570 |
var called = false;
|
|
|
1571 |
return function () {
|
|
|
1572 |
if (called) {
|
|
|
1573 |
return;
|
|
|
1574 |
}
|
|
|
1575 |
called = true;
|
|
|
1576 |
window.Promise.resolve().then(function () {
|
|
|
1577 |
called = false;
|
|
|
1578 |
fn();
|
|
|
1579 |
});
|
|
|
1580 |
};
|
|
|
1581 |
}
|
|
|
1582 |
|
|
|
1583 |
function taskDebounce(fn) {
|
|
|
1584 |
var scheduled = false;
|
|
|
1585 |
return function () {
|
|
|
1586 |
if (!scheduled) {
|
|
|
1587 |
scheduled = true;
|
|
|
1588 |
setTimeout(function () {
|
|
|
1589 |
scheduled = false;
|
|
|
1590 |
fn();
|
|
|
1591 |
}, timeoutDuration);
|
|
|
1592 |
}
|
|
|
1593 |
};
|
|
|
1594 |
}
|
|
|
1595 |
|
|
|
1596 |
var supportsMicroTasks = isBrowser && window.Promise;
|
|
|
1597 |
|
|
|
1598 |
/**
|
|
|
1599 |
* Create a debounced version of a method, that's asynchronously deferred
|
|
|
1600 |
* but called in the minimum time possible.
|
|
|
1601 |
*
|
|
|
1602 |
* @method
|
|
|
1603 |
* @memberof Popper.Utils
|
|
|
1604 |
* @argument {Function} fn
|
|
|
1605 |
* @returns {Function}
|
|
|
1606 |
*/
|
|
|
1607 |
var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
|
|
|
1608 |
|
|
|
1609 |
/**
|
|
|
1610 |
* Check if the given variable is a function
|
|
|
1611 |
* @method
|
|
|
1612 |
* @memberof Popper.Utils
|
|
|
1613 |
* @argument {Any} functionToCheck - variable to check
|
|
|
1614 |
* @returns {Boolean} answer to: is a function?
|
|
|
1615 |
*/
|
|
|
1616 |
function isFunction(functionToCheck) {
|
|
|
1617 |
var getType = {};
|
|
|
1618 |
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
|
1619 |
}
|
|
|
1620 |
|
|
|
1621 |
/**
|
|
|
1622 |
* Get CSS computed property of the given element
|
|
|
1623 |
* @method
|
|
|
1624 |
* @memberof Popper.Utils
|
|
|
1625 |
* @argument {Eement} element
|
|
|
1626 |
* @argument {String} property
|
|
|
1627 |
*/
|
|
|
1628 |
function getStyleComputedProperty(element, property) {
|
|
|
1629 |
if (element.nodeType !== 1) {
|
|
|
1630 |
return [];
|
|
|
1631 |
}
|
|
|
1632 |
// NOTE: 1 DOM access here
|
|
|
1633 |
var window = element.ownerDocument.defaultView;
|
|
|
1634 |
var css = window.getComputedStyle(element, null);
|
|
|
1635 |
return property ? css[property] : css;
|
|
|
1636 |
}
|
|
|
1637 |
|
|
|
1638 |
/**
|
|
|
1639 |
* Returns the parentNode or the host of the element
|
|
|
1640 |
* @method
|
|
|
1641 |
* @memberof Popper.Utils
|
|
|
1642 |
* @argument {Element} element
|
|
|
1643 |
* @returns {Element} parent
|
|
|
1644 |
*/
|
|
|
1645 |
function getParentNode(element) {
|
|
|
1646 |
if (element.nodeName === 'HTML') {
|
|
|
1647 |
return element;
|
|
|
1648 |
}
|
|
|
1649 |
return element.parentNode || element.host;
|
|
|
1650 |
}
|
|
|
1651 |
|
|
|
1652 |
/**
|
|
|
1653 |
* Returns the scrolling parent of the given element
|
|
|
1654 |
* @method
|
|
|
1655 |
* @memberof Popper.Utils
|
|
|
1656 |
* @argument {Element} element
|
|
|
1657 |
* @returns {Element} scroll parent
|
|
|
1658 |
*/
|
|
|
1659 |
function getScrollParent(element) {
|
|
|
1660 |
// Return body, `getScroll` will take care to get the correct `scrollTop` from it
|
|
|
1661 |
if (!element) {
|
|
|
1662 |
return document.body;
|
|
|
1663 |
}
|
|
|
1664 |
|
|
|
1665 |
switch (element.nodeName) {
|
|
|
1666 |
case 'HTML':
|
|
|
1667 |
case 'BODY':
|
|
|
1668 |
return element.ownerDocument.body;
|
|
|
1669 |
case '#document':
|
|
|
1670 |
return element.body;
|
|
|
1671 |
}
|
|
|
1672 |
|
|
|
1673 |
// Firefox want us to check `-x` and `-y` variations as well
|
|
|
1674 |
|
|
|
1675 |
var _getStyleComputedProp = getStyleComputedProperty(element),
|
|
|
1676 |
overflow = _getStyleComputedProp.overflow,
|
|
|
1677 |
overflowX = _getStyleComputedProp.overflowX,
|
|
|
1678 |
overflowY = _getStyleComputedProp.overflowY;
|
|
|
1679 |
|
|
|
1680 |
if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
|
|
|
1681 |
return element;
|
|
|
1682 |
}
|
|
|
1683 |
|
|
|
1684 |
return getScrollParent(getParentNode(element));
|
|
|
1685 |
}
|
|
|
1686 |
|
|
|
1687 |
/**
|
|
|
1688 |
* Returns the reference node of the reference object, or the reference object itself.
|
|
|
1689 |
* @method
|
|
|
1690 |
* @memberof Popper.Utils
|
|
|
1691 |
* @param {Element|Object} reference - the reference element (the popper will be relative to this)
|
|
|
1692 |
* @returns {Element} parent
|
|
|
1693 |
*/
|
|
|
1694 |
function getReferenceNode(reference) {
|
|
|
1695 |
return reference && reference.referenceNode ? reference.referenceNode : reference;
|
|
|
1696 |
}
|
|
|
1697 |
|
|
|
1698 |
var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
|
|
|
1699 |
var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
|
|
|
1700 |
|
|
|
1701 |
/**
|
|
|
1702 |
* Determines if the browser is Internet Explorer
|
|
|
1703 |
* @method
|
|
|
1704 |
* @memberof Popper.Utils
|
|
|
1705 |
* @param {Number} version to check
|
|
|
1706 |
* @returns {Boolean} isIE
|
|
|
1707 |
*/
|
|
|
1708 |
function isIE(version) {
|
|
|
1709 |
if (version === 11) {
|
|
|
1710 |
return isIE11;
|
|
|
1711 |
}
|
|
|
1712 |
if (version === 10) {
|
|
|
1713 |
return isIE10;
|
|
|
1714 |
}
|
|
|
1715 |
return isIE11 || isIE10;
|
|
|
1716 |
}
|
|
|
1717 |
|
|
|
1718 |
/**
|
|
|
1719 |
* Returns the offset parent of the given element
|
|
|
1720 |
* @method
|
|
|
1721 |
* @memberof Popper.Utils
|
|
|
1722 |
* @argument {Element} element
|
|
|
1723 |
* @returns {Element} offset parent
|
|
|
1724 |
*/
|
|
|
1725 |
function getOffsetParent(element) {
|
|
|
1726 |
if (!element) {
|
|
|
1727 |
return document.documentElement;
|
|
|
1728 |
}
|
|
|
1729 |
|
|
|
1730 |
var noOffsetParent = isIE(10) ? document.body : null;
|
|
|
1731 |
|
|
|
1732 |
// NOTE: 1 DOM access here
|
|
|
1733 |
var offsetParent = element.offsetParent || null;
|
|
|
1734 |
// Skip hidden elements which don't have an offsetParent
|
|
|
1735 |
while (offsetParent === noOffsetParent && element.nextElementSibling) {
|
|
|
1736 |
offsetParent = (element = element.nextElementSibling).offsetParent;
|
|
|
1737 |
}
|
|
|
1738 |
|
|
|
1739 |
var nodeName = offsetParent && offsetParent.nodeName;
|
|
|
1740 |
|
|
|
1741 |
if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
|
|
|
1742 |
return element ? element.ownerDocument.documentElement : document.documentElement;
|
|
|
1743 |
}
|
|
|
1744 |
|
|
|
1745 |
// .offsetParent will return the closest TH, TD or TABLE in case
|
|
|
1746 |
// no offsetParent is present, I hate this job...
|
|
|
1747 |
if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
|
|
|
1748 |
return getOffsetParent(offsetParent);
|
|
|
1749 |
}
|
|
|
1750 |
|
|
|
1751 |
return offsetParent;
|
|
|
1752 |
}
|
|
|
1753 |
|
|
|
1754 |
function isOffsetContainer(element) {
|
|
|
1755 |
var nodeName = element.nodeName;
|
|
|
1756 |
|
|
|
1757 |
if (nodeName === 'BODY') {
|
|
|
1758 |
return false;
|
|
|
1759 |
}
|
|
|
1760 |
return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
|
|
|
1761 |
}
|
|
|
1762 |
|
|
|
1763 |
/**
|
|
|
1764 |
* Finds the root node (document, shadowDOM root) of the given element
|
|
|
1765 |
* @method
|
|
|
1766 |
* @memberof Popper.Utils
|
|
|
1767 |
* @argument {Element} node
|
|
|
1768 |
* @returns {Element} root node
|
|
|
1769 |
*/
|
|
|
1770 |
function getRoot(node) {
|
|
|
1771 |
if (node.parentNode !== null) {
|
|
|
1772 |
return getRoot(node.parentNode);
|
|
|
1773 |
}
|
|
|
1774 |
|
|
|
1775 |
return node;
|
|
|
1776 |
}
|
|
|
1777 |
|
|
|
1778 |
/**
|
|
|
1779 |
* Finds the offset parent common to the two provided nodes
|
|
|
1780 |
* @method
|
|
|
1781 |
* @memberof Popper.Utils
|
|
|
1782 |
* @argument {Element} element1
|
|
|
1783 |
* @argument {Element} element2
|
|
|
1784 |
* @returns {Element} common offset parent
|
|
|
1785 |
*/
|
|
|
1786 |
function findCommonOffsetParent(element1, element2) {
|
|
|
1787 |
// This check is needed to avoid errors in case one of the elements isn't defined for any reason
|
|
|
1788 |
if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
|
|
|
1789 |
return document.documentElement;
|
|
|
1790 |
}
|
|
|
1791 |
|
|
|
1792 |
// Here we make sure to give as "start" the element that comes first in the DOM
|
|
|
1793 |
var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
|
|
|
1794 |
var start = order ? element1 : element2;
|
|
|
1795 |
var end = order ? element2 : element1;
|
|
|
1796 |
|
|
|
1797 |
// Get common ancestor container
|
|
|
1798 |
var range = document.createRange();
|
|
|
1799 |
range.setStart(start, 0);
|
|
|
1800 |
range.setEnd(end, 0);
|
|
|
1801 |
var commonAncestorContainer = range.commonAncestorContainer;
|
|
|
1802 |
|
|
|
1803 |
// Both nodes are inside #document
|
|
|
1804 |
|
|
|
1805 |
if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
|
|
|
1806 |
if (isOffsetContainer(commonAncestorContainer)) {
|
|
|
1807 |
return commonAncestorContainer;
|
|
|
1808 |
}
|
|
|
1809 |
|
|
|
1810 |
return getOffsetParent(commonAncestorContainer);
|
|
|
1811 |
}
|
|
|
1812 |
|
|
|
1813 |
// one of the nodes is inside shadowDOM, find which one
|
|
|
1814 |
var element1root = getRoot(element1);
|
|
|
1815 |
if (element1root.host) {
|
|
|
1816 |
return findCommonOffsetParent(element1root.host, element2);
|
|
|
1817 |
} else {
|
|
|
1818 |
return findCommonOffsetParent(element1, getRoot(element2).host);
|
|
|
1819 |
}
|
|
|
1820 |
}
|
|
|
1821 |
|
|
|
1822 |
/**
|
|
|
1823 |
* Gets the scroll value of the given element in the given side (top and left)
|
|
|
1824 |
* @method
|
|
|
1825 |
* @memberof Popper.Utils
|
|
|
1826 |
* @argument {Element} element
|
|
|
1827 |
* @argument {String} side `top` or `left`
|
|
|
1828 |
* @returns {number} amount of scrolled pixels
|
|
|
1829 |
*/
|
|
|
1830 |
function getScroll(element) {
|
|
|
1831 |
var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
|
|
|
1832 |
|
|
|
1833 |
var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
|
|
|
1834 |
var nodeName = element.nodeName;
|
|
|
1835 |
|
|
|
1836 |
if (nodeName === 'BODY' || nodeName === 'HTML') {
|
|
|
1837 |
var html = element.ownerDocument.documentElement;
|
|
|
1838 |
var scrollingElement = element.ownerDocument.scrollingElement || html;
|
|
|
1839 |
return scrollingElement[upperSide];
|
|
|
1840 |
}
|
|
|
1841 |
|
|
|
1842 |
return element[upperSide];
|
|
|
1843 |
}
|
|
|
1844 |
|
|
|
1845 |
/*
|
|
|
1846 |
* Sum or subtract the element scroll values (left and top) from a given rect object
|
|
|
1847 |
* @method
|
|
|
1848 |
* @memberof Popper.Utils
|
|
|
1849 |
* @param {Object} rect - Rect object you want to change
|
|
|
1850 |
* @param {HTMLElement} element - The element from the function reads the scroll values
|
|
|
1851 |
* @param {Boolean} subtract - set to true if you want to subtract the scroll values
|
|
|
1852 |
* @return {Object} rect - The modifier rect object
|
|
|
1853 |
*/
|
|
|
1854 |
function includeScroll(rect, element) {
|
|
|
1855 |
var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
|
1856 |
|
|
|
1857 |
var scrollTop = getScroll(element, 'top');
|
|
|
1858 |
var scrollLeft = getScroll(element, 'left');
|
|
|
1859 |
var modifier = subtract ? -1 : 1;
|
|
|
1860 |
rect.top += scrollTop * modifier;
|
|
|
1861 |
rect.bottom += scrollTop * modifier;
|
|
|
1862 |
rect.left += scrollLeft * modifier;
|
|
|
1863 |
rect.right += scrollLeft * modifier;
|
|
|
1864 |
return rect;
|
|
|
1865 |
}
|
|
|
1866 |
|
|
|
1867 |
/*
|
|
|
1868 |
* Helper to detect borders of a given element
|
|
|
1869 |
* @method
|
|
|
1870 |
* @memberof Popper.Utils
|
|
|
1871 |
* @param {CSSStyleDeclaration} styles
|
|
|
1872 |
* Result of `getStyleComputedProperty` on the given element
|
|
|
1873 |
* @param {String} axis - `x` or `y`
|
|
|
1874 |
* @return {number} borders - The borders size of the given axis
|
|
|
1875 |
*/
|
|
|
1876 |
|
|
|
1877 |
function getBordersSize(styles, axis) {
|
|
|
1878 |
var sideA = axis === 'x' ? 'Left' : 'Top';
|
|
|
1879 |
var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
|
|
|
1880 |
|
|
|
1881 |
return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
|
|
|
1882 |
}
|
|
|
1883 |
|
|
|
1884 |
function getSize(axis, body, html, computedStyle) {
|
|
|
1885 |
return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
|
|
|
1886 |
}
|
|
|
1887 |
|
|
|
1888 |
function getWindowSizes(document) {
|
|
|
1889 |
var body = document.body;
|
|
|
1890 |
var html = document.documentElement;
|
|
|
1891 |
var computedStyle = isIE(10) && getComputedStyle(html);
|
|
|
1892 |
|
|
|
1893 |
return {
|
|
|
1894 |
height: getSize('Height', body, html, computedStyle),
|
|
|
1895 |
width: getSize('Width', body, html, computedStyle)
|
|
|
1896 |
};
|
|
|
1897 |
}
|
|
|
1898 |
|
|
|
1899 |
var classCallCheck = function (instance, Constructor) {
|
|
|
1900 |
if (!(instance instanceof Constructor)) {
|
|
|
1901 |
throw new TypeError("Cannot call a class as a function");
|
|
|
1902 |
}
|
|
|
1903 |
};
|
|
|
1904 |
|
|
|
1905 |
var createClass = function () {
|
|
|
1906 |
function defineProperties(target, props) {
|
|
|
1907 |
for (var i = 0; i < props.length; i++) {
|
|
|
1908 |
var descriptor = props[i];
|
|
|
1909 |
descriptor.enumerable = descriptor.enumerable || false;
|
|
|
1910 |
descriptor.configurable = true;
|
|
|
1911 |
if ("value" in descriptor) descriptor.writable = true;
|
|
|
1912 |
Object.defineProperty(target, descriptor.key, descriptor);
|
|
|
1913 |
}
|
|
|
1914 |
}
|
|
|
1915 |
|
|
|
1916 |
return function (Constructor, protoProps, staticProps) {
|
|
|
1917 |
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
|
1918 |
if (staticProps) defineProperties(Constructor, staticProps);
|
|
|
1919 |
return Constructor;
|
|
|
1920 |
};
|
|
|
1921 |
}();
|
|
|
1922 |
|
|
|
1923 |
|
|
|
1924 |
|
|
|
1925 |
|
|
|
1926 |
|
|
|
1927 |
var defineProperty = function (obj, key, value) {
|
|
|
1928 |
if (key in obj) {
|
|
|
1929 |
Object.defineProperty(obj, key, {
|
|
|
1930 |
value: value,
|
|
|
1931 |
enumerable: true,
|
|
|
1932 |
configurable: true,
|
|
|
1933 |
writable: true
|
|
|
1934 |
});
|
|
|
1935 |
} else {
|
|
|
1936 |
obj[key] = value;
|
|
|
1937 |
}
|
|
|
1938 |
|
|
|
1939 |
return obj;
|
|
|
1940 |
};
|
|
|
1941 |
|
|
|
1942 |
var _extends$1 = Object.assign || function (target) {
|
|
|
1943 |
for (var i = 1; i < arguments.length; i++) {
|
|
|
1944 |
var source = arguments[i];
|
|
|
1945 |
|
|
|
1946 |
for (var key in source) {
|
|
|
1947 |
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
|
1948 |
target[key] = source[key];
|
|
|
1949 |
}
|
|
|
1950 |
}
|
|
|
1951 |
}
|
|
|
1952 |
|
|
|
1953 |
return target;
|
|
|
1954 |
};
|
|
|
1955 |
|
|
|
1956 |
/**
|
|
|
1957 |
* Given element offsets, generate an output similar to getBoundingClientRect
|
|
|
1958 |
* @method
|
|
|
1959 |
* @memberof Popper.Utils
|
|
|
1960 |
* @argument {Object} offsets
|
|
|
1961 |
* @returns {Object} ClientRect like output
|
|
|
1962 |
*/
|
|
|
1963 |
function getClientRect(offsets) {
|
|
|
1964 |
return _extends$1({}, offsets, {
|
|
|
1965 |
right: offsets.left + offsets.width,
|
|
|
1966 |
bottom: offsets.top + offsets.height
|
|
|
1967 |
});
|
|
|
1968 |
}
|
|
|
1969 |
|
|
|
1970 |
/**
|
|
|
1971 |
* Get bounding client rect of given element
|
|
|
1972 |
* @method
|
|
|
1973 |
* @memberof Popper.Utils
|
|
|
1974 |
* @param {HTMLElement} element
|
|
|
1975 |
* @return {Object} client rect
|
|
|
1976 |
*/
|
|
|
1977 |
function getBoundingClientRect(element) {
|
|
|
1978 |
var rect = {};
|
|
|
1979 |
|
|
|
1980 |
// IE10 10 FIX: Please, don't ask, the element isn't
|
|
|
1981 |
// considered in DOM in some circumstances...
|
|
|
1982 |
// This isn't reproducible in IE10 compatibility mode of IE11
|
|
|
1983 |
try {
|
|
|
1984 |
if (isIE(10)) {
|
|
|
1985 |
rect = element.getBoundingClientRect();
|
|
|
1986 |
var scrollTop = getScroll(element, 'top');
|
|
|
1987 |
var scrollLeft = getScroll(element, 'left');
|
|
|
1988 |
rect.top += scrollTop;
|
|
|
1989 |
rect.left += scrollLeft;
|
|
|
1990 |
rect.bottom += scrollTop;
|
|
|
1991 |
rect.right += scrollLeft;
|
|
|
1992 |
} else {
|
|
|
1993 |
rect = element.getBoundingClientRect();
|
|
|
1994 |
}
|
|
|
1995 |
} catch (e) {}
|
|
|
1996 |
|
|
|
1997 |
var result = {
|
|
|
1998 |
left: rect.left,
|
|
|
1999 |
top: rect.top,
|
|
|
2000 |
width: rect.right - rect.left,
|
|
|
2001 |
height: rect.bottom - rect.top
|
|
|
2002 |
};
|
|
|
2003 |
|
|
|
2004 |
// subtract scrollbar size from sizes
|
|
|
2005 |
var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
|
|
|
2006 |
var width = sizes.width || element.clientWidth || result.width;
|
|
|
2007 |
var height = sizes.height || element.clientHeight || result.height;
|
|
|
2008 |
|
|
|
2009 |
var horizScrollbar = element.offsetWidth - width;
|
|
|
2010 |
var vertScrollbar = element.offsetHeight - height;
|
|
|
2011 |
|
|
|
2012 |
// if an hypothetical scrollbar is detected, we must be sure it's not a `border`
|
|
|
2013 |
// we make this check conditional for performance reasons
|
|
|
2014 |
if (horizScrollbar || vertScrollbar) {
|
|
|
2015 |
var styles = getStyleComputedProperty(element);
|
|
|
2016 |
horizScrollbar -= getBordersSize(styles, 'x');
|
|
|
2017 |
vertScrollbar -= getBordersSize(styles, 'y');
|
|
|
2018 |
|
|
|
2019 |
result.width -= horizScrollbar;
|
|
|
2020 |
result.height -= vertScrollbar;
|
|
|
2021 |
}
|
|
|
2022 |
|
|
|
2023 |
return getClientRect(result);
|
|
|
2024 |
}
|
|
|
2025 |
|
|
|
2026 |
function getOffsetRectRelativeToArbitraryNode(children, parent) {
|
|
|
2027 |
var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
|
2028 |
|
|
|
2029 |
var isIE10 = isIE(10);
|
|
|
2030 |
var isHTML = parent.nodeName === 'HTML';
|
|
|
2031 |
var childrenRect = getBoundingClientRect(children);
|
|
|
2032 |
var parentRect = getBoundingClientRect(parent);
|
|
|
2033 |
var scrollParent = getScrollParent(children);
|
|
|
2034 |
|
|
|
2035 |
var styles = getStyleComputedProperty(parent);
|
|
|
2036 |
var borderTopWidth = parseFloat(styles.borderTopWidth);
|
|
|
2037 |
var borderLeftWidth = parseFloat(styles.borderLeftWidth);
|
|
|
2038 |
|
|
|
2039 |
// In cases where the parent is fixed, we must ignore negative scroll in offset calc
|
|
|
2040 |
if (fixedPosition && isHTML) {
|
|
|
2041 |
parentRect.top = Math.max(parentRect.top, 0);
|
|
|
2042 |
parentRect.left = Math.max(parentRect.left, 0);
|
|
|
2043 |
}
|
|
|
2044 |
var offsets = getClientRect({
|
|
|
2045 |
top: childrenRect.top - parentRect.top - borderTopWidth,
|
|
|
2046 |
left: childrenRect.left - parentRect.left - borderLeftWidth,
|
|
|
2047 |
width: childrenRect.width,
|
|
|
2048 |
height: childrenRect.height
|
|
|
2049 |
});
|
|
|
2050 |
offsets.marginTop = 0;
|
|
|
2051 |
offsets.marginLeft = 0;
|
|
|
2052 |
|
|
|
2053 |
// Subtract margins of documentElement in case it's being used as parent
|
|
|
2054 |
// we do this only on HTML because it's the only element that behaves
|
|
|
2055 |
// differently when margins are applied to it. The margins are included in
|
|
|
2056 |
// the box of the documentElement, in the other cases not.
|
|
|
2057 |
if (!isIE10 && isHTML) {
|
|
|
2058 |
var marginTop = parseFloat(styles.marginTop);
|
|
|
2059 |
var marginLeft = parseFloat(styles.marginLeft);
|
|
|
2060 |
|
|
|
2061 |
offsets.top -= borderTopWidth - marginTop;
|
|
|
2062 |
offsets.bottom -= borderTopWidth - marginTop;
|
|
|
2063 |
offsets.left -= borderLeftWidth - marginLeft;
|
|
|
2064 |
offsets.right -= borderLeftWidth - marginLeft;
|
|
|
2065 |
|
|
|
2066 |
// Attach marginTop and marginLeft because in some circumstances we may need them
|
|
|
2067 |
offsets.marginTop = marginTop;
|
|
|
2068 |
offsets.marginLeft = marginLeft;
|
|
|
2069 |
}
|
|
|
2070 |
|
|
|
2071 |
if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
|
|
|
2072 |
offsets = includeScroll(offsets, parent);
|
|
|
2073 |
}
|
|
|
2074 |
|
|
|
2075 |
return offsets;
|
|
|
2076 |
}
|
|
|
2077 |
|
|
|
2078 |
function getViewportOffsetRectRelativeToArtbitraryNode(element) {
|
|
|
2079 |
var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
|
2080 |
|
|
|
2081 |
var html = element.ownerDocument.documentElement;
|
|
|
2082 |
var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
|
|
|
2083 |
var width = Math.max(html.clientWidth, window.innerWidth || 0);
|
|
|
2084 |
var height = Math.max(html.clientHeight, window.innerHeight || 0);
|
|
|
2085 |
|
|
|
2086 |
var scrollTop = !excludeScroll ? getScroll(html) : 0;
|
|
|
2087 |
var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
|
|
|
2088 |
|
|
|
2089 |
var offset = {
|
|
|
2090 |
top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
|
|
|
2091 |
left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
|
|
|
2092 |
width: width,
|
|
|
2093 |
height: height
|
|
|
2094 |
};
|
|
|
2095 |
|
|
|
2096 |
return getClientRect(offset);
|
|
|
2097 |
}
|
|
|
2098 |
|
|
|
2099 |
/**
|
|
|
2100 |
* Check if the given element is fixed or is inside a fixed parent
|
|
|
2101 |
* @method
|
|
|
2102 |
* @memberof Popper.Utils
|
|
|
2103 |
* @argument {Element} element
|
|
|
2104 |
* @argument {Element} customContainer
|
|
|
2105 |
* @returns {Boolean} answer to "isFixed?"
|
|
|
2106 |
*/
|
|
|
2107 |
function isFixed(element) {
|
|
|
2108 |
var nodeName = element.nodeName;
|
|
|
2109 |
if (nodeName === 'BODY' || nodeName === 'HTML') {
|
|
|
2110 |
return false;
|
|
|
2111 |
}
|
|
|
2112 |
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
|
2113 |
return true;
|
|
|
2114 |
}
|
|
|
2115 |
var parentNode = getParentNode(element);
|
|
|
2116 |
if (!parentNode) {
|
|
|
2117 |
return false;
|
|
|
2118 |
}
|
|
|
2119 |
return isFixed(parentNode);
|
|
|
2120 |
}
|
|
|
2121 |
|
|
|
2122 |
/**
|
|
|
2123 |
* Finds the first parent of an element that has a transformed property defined
|
|
|
2124 |
* @method
|
|
|
2125 |
* @memberof Popper.Utils
|
|
|
2126 |
* @argument {Element} element
|
|
|
2127 |
* @returns {Element} first transformed parent or documentElement
|
|
|
2128 |
*/
|
|
|
2129 |
|
|
|
2130 |
function getFixedPositionOffsetParent(element) {
|
|
|
2131 |
// This check is needed to avoid errors in case one of the elements isn't defined for any reason
|
|
|
2132 |
if (!element || !element.parentElement || isIE()) {
|
|
|
2133 |
return document.documentElement;
|
|
|
2134 |
}
|
|
|
2135 |
var el = element.parentElement;
|
|
|
2136 |
while (el && getStyleComputedProperty(el, 'transform') === 'none') {
|
|
|
2137 |
el = el.parentElement;
|
|
|
2138 |
}
|
|
|
2139 |
return el || document.documentElement;
|
|
|
2140 |
}
|
|
|
2141 |
|
|
|
2142 |
/**
|
|
|
2143 |
* Computed the boundaries limits and return them
|
|
|
2144 |
* @method
|
|
|
2145 |
* @memberof Popper.Utils
|
|
|
2146 |
* @param {HTMLElement} popper
|
|
|
2147 |
* @param {HTMLElement} reference
|
|
|
2148 |
* @param {number} padding
|
|
|
2149 |
* @param {HTMLElement} boundariesElement - Element used to define the boundaries
|
|
|
2150 |
* @param {Boolean} fixedPosition - Is in fixed position mode
|
|
|
2151 |
* @returns {Object} Coordinates of the boundaries
|
|
|
2152 |
*/
|
|
|
2153 |
function getBoundaries(popper, reference, padding, boundariesElement) {
|
|
|
2154 |
var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
|
2155 |
|
|
|
2156 |
// NOTE: 1 DOM access here
|
|
|
2157 |
|
|
|
2158 |
var boundaries = { top: 0, left: 0 };
|
|
|
2159 |
var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
|
|
|
2160 |
|
|
|
2161 |
// Handle viewport case
|
|
|
2162 |
if (boundariesElement === 'viewport') {
|
|
|
2163 |
boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
|
|
|
2164 |
} else {
|
|
|
2165 |
// Handle other cases based on DOM element used as boundaries
|
|
|
2166 |
var boundariesNode = void 0;
|
|
|
2167 |
if (boundariesElement === 'scrollParent') {
|
|
|
2168 |
boundariesNode = getScrollParent(getParentNode(reference));
|
|
|
2169 |
if (boundariesNode.nodeName === 'BODY') {
|
|
|
2170 |
boundariesNode = popper.ownerDocument.documentElement;
|
|
|
2171 |
}
|
|
|
2172 |
} else if (boundariesElement === 'window') {
|
|
|
2173 |
boundariesNode = popper.ownerDocument.documentElement;
|
|
|
2174 |
} else {
|
|
|
2175 |
boundariesNode = boundariesElement;
|
|
|
2176 |
}
|
|
|
2177 |
|
|
|
2178 |
var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
|
|
|
2179 |
|
|
|
2180 |
// In case of HTML, we need a different computation
|
|
|
2181 |
if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
|
|
|
2182 |
var _getWindowSizes = getWindowSizes(popper.ownerDocument),
|
|
|
2183 |
height = _getWindowSizes.height,
|
|
|
2184 |
width = _getWindowSizes.width;
|
|
|
2185 |
|
|
|
2186 |
boundaries.top += offsets.top - offsets.marginTop;
|
|
|
2187 |
boundaries.bottom = height + offsets.top;
|
|
|
2188 |
boundaries.left += offsets.left - offsets.marginLeft;
|
|
|
2189 |
boundaries.right = width + offsets.left;
|
|
|
2190 |
} else {
|
|
|
2191 |
// for all the other DOM elements, this one is good
|
|
|
2192 |
boundaries = offsets;
|
|
|
2193 |
}
|
|
|
2194 |
}
|
|
|
2195 |
|
|
|
2196 |
// Add paddings
|
|
|
2197 |
padding = padding || 0;
|
|
|
2198 |
var isPaddingNumber = typeof padding === 'number';
|
|
|
2199 |
boundaries.left += isPaddingNumber ? padding : padding.left || 0;
|
|
|
2200 |
boundaries.top += isPaddingNumber ? padding : padding.top || 0;
|
|
|
2201 |
boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
|
|
|
2202 |
boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
|
|
|
2203 |
|
|
|
2204 |
return boundaries;
|
|
|
2205 |
}
|
|
|
2206 |
|
|
|
2207 |
function getArea(_ref) {
|
|
|
2208 |
var width = _ref.width,
|
|
|
2209 |
height = _ref.height;
|
|
|
2210 |
|
|
|
2211 |
return width * height;
|
|
|
2212 |
}
|
|
|
2213 |
|
|
|
2214 |
/**
|
|
|
2215 |
* Utility used to transform the `auto` placement to the placement with more
|
|
|
2216 |
* available space.
|
|
|
2217 |
* @method
|
|
|
2218 |
* @memberof Popper.Utils
|
|
|
2219 |
* @argument {Object} data - The data object generated by update method
|
|
|
2220 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
2221 |
* @returns {Object} The data object, properly modified
|
|
|
2222 |
*/
|
|
|
2223 |
function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
|
|
|
2224 |
var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
|
2225 |
|
|
|
2226 |
if (placement.indexOf('auto') === -1) {
|
|
|
2227 |
return placement;
|
|
|
2228 |
}
|
|
|
2229 |
|
|
|
2230 |
var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
|
|
|
2231 |
|
|
|
2232 |
var rects = {
|
|
|
2233 |
top: {
|
|
|
2234 |
width: boundaries.width,
|
|
|
2235 |
height: refRect.top - boundaries.top
|
|
|
2236 |
},
|
|
|
2237 |
right: {
|
|
|
2238 |
width: boundaries.right - refRect.right,
|
|
|
2239 |
height: boundaries.height
|
|
|
2240 |
},
|
|
|
2241 |
bottom: {
|
|
|
2242 |
width: boundaries.width,
|
|
|
2243 |
height: boundaries.bottom - refRect.bottom
|
|
|
2244 |
},
|
|
|
2245 |
left: {
|
|
|
2246 |
width: refRect.left - boundaries.left,
|
|
|
2247 |
height: boundaries.height
|
|
|
2248 |
}
|
|
|
2249 |
};
|
|
|
2250 |
|
|
|
2251 |
var sortedAreas = Object.keys(rects).map(function (key) {
|
|
|
2252 |
return _extends$1({
|
|
|
2253 |
key: key
|
|
|
2254 |
}, rects[key], {
|
|
|
2255 |
area: getArea(rects[key])
|
|
|
2256 |
});
|
|
|
2257 |
}).sort(function (a, b) {
|
|
|
2258 |
return b.area - a.area;
|
|
|
2259 |
});
|
|
|
2260 |
|
|
|
2261 |
var filteredAreas = sortedAreas.filter(function (_ref2) {
|
|
|
2262 |
var width = _ref2.width,
|
|
|
2263 |
height = _ref2.height;
|
|
|
2264 |
return width >= popper.clientWidth && height >= popper.clientHeight;
|
|
|
2265 |
});
|
|
|
2266 |
|
|
|
2267 |
var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
|
|
|
2268 |
|
|
|
2269 |
var variation = placement.split('-')[1];
|
|
|
2270 |
|
|
|
2271 |
return computedPlacement + (variation ? '-' + variation : '');
|
|
|
2272 |
}
|
|
|
2273 |
|
|
|
2274 |
/**
|
|
|
2275 |
* Get offsets to the reference element
|
|
|
2276 |
* @method
|
|
|
2277 |
* @memberof Popper.Utils
|
|
|
2278 |
* @param {Object} state
|
|
|
2279 |
* @param {Element} popper - the popper element
|
|
|
2280 |
* @param {Element} reference - the reference element (the popper will be relative to this)
|
|
|
2281 |
* @param {Element} fixedPosition - is in fixed position mode
|
|
|
2282 |
* @returns {Object} An object containing the offsets which will be applied to the popper
|
|
|
2283 |
*/
|
|
|
2284 |
function getReferenceOffsets(state, popper, reference) {
|
|
|
2285 |
var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
|
2286 |
|
|
|
2287 |
var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
|
|
|
2288 |
return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
|
|
|
2289 |
}
|
|
|
2290 |
|
|
|
2291 |
/**
|
|
|
2292 |
* Get the outer sizes of the given element (offset size + margins)
|
|
|
2293 |
* @method
|
|
|
2294 |
* @memberof Popper.Utils
|
|
|
2295 |
* @argument {Element} element
|
|
|
2296 |
* @returns {Object} object containing width and height properties
|
|
|
2297 |
*/
|
|
|
2298 |
function getOuterSizes(element) {
|
|
|
2299 |
var window = element.ownerDocument.defaultView;
|
|
|
2300 |
var styles = window.getComputedStyle(element);
|
|
|
2301 |
var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
|
|
|
2302 |
var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
|
|
|
2303 |
var result = {
|
|
|
2304 |
width: element.offsetWidth + y,
|
|
|
2305 |
height: element.offsetHeight + x
|
|
|
2306 |
};
|
|
|
2307 |
return result;
|
|
|
2308 |
}
|
|
|
2309 |
|
|
|
2310 |
/**
|
|
|
2311 |
* Get the opposite placement of the given one
|
|
|
2312 |
* @method
|
|
|
2313 |
* @memberof Popper.Utils
|
|
|
2314 |
* @argument {String} placement
|
|
|
2315 |
* @returns {String} flipped placement
|
|
|
2316 |
*/
|
|
|
2317 |
function getOppositePlacement(placement) {
|
|
|
2318 |
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
|
|
2319 |
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
|
2320 |
return hash[matched];
|
|
|
2321 |
});
|
|
|
2322 |
}
|
|
|
2323 |
|
|
|
2324 |
/**
|
|
|
2325 |
* Get offsets to the popper
|
|
|
2326 |
* @method
|
|
|
2327 |
* @memberof Popper.Utils
|
|
|
2328 |
* @param {Object} position - CSS position the Popper will get applied
|
|
|
2329 |
* @param {HTMLElement} popper - the popper element
|
|
|
2330 |
* @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
|
|
|
2331 |
* @param {String} placement - one of the valid placement options
|
|
|
2332 |
* @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
|
|
|
2333 |
*/
|
|
|
2334 |
function getPopperOffsets(popper, referenceOffsets, placement) {
|
|
|
2335 |
placement = placement.split('-')[0];
|
|
|
2336 |
|
|
|
2337 |
// Get popper node sizes
|
|
|
2338 |
var popperRect = getOuterSizes(popper);
|
|
|
2339 |
|
|
|
2340 |
// Add position, width and height to our offsets object
|
|
|
2341 |
var popperOffsets = {
|
|
|
2342 |
width: popperRect.width,
|
|
|
2343 |
height: popperRect.height
|
|
|
2344 |
};
|
|
|
2345 |
|
|
|
2346 |
// depending by the popper placement we have to compute its offsets slightly differently
|
|
|
2347 |
var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
|
|
|
2348 |
var mainSide = isHoriz ? 'top' : 'left';
|
|
|
2349 |
var secondarySide = isHoriz ? 'left' : 'top';
|
|
|
2350 |
var measurement = isHoriz ? 'height' : 'width';
|
|
|
2351 |
var secondaryMeasurement = !isHoriz ? 'height' : 'width';
|
|
|
2352 |
|
|
|
2353 |
popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
|
|
|
2354 |
if (placement === secondarySide) {
|
|
|
2355 |
popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
|
|
|
2356 |
} else {
|
|
|
2357 |
popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
|
|
|
2358 |
}
|
|
|
2359 |
|
|
|
2360 |
return popperOffsets;
|
|
|
2361 |
}
|
|
|
2362 |
|
|
|
2363 |
/**
|
|
|
2364 |
* Mimics the `find` method of Array
|
|
|
2365 |
* @method
|
|
|
2366 |
* @memberof Popper.Utils
|
|
|
2367 |
* @argument {Array} arr
|
|
|
2368 |
* @argument prop
|
|
|
2369 |
* @argument value
|
|
|
2370 |
* @returns index or -1
|
|
|
2371 |
*/
|
|
|
2372 |
function find(arr, check) {
|
|
|
2373 |
// use native find if supported
|
|
|
2374 |
if (Array.prototype.find) {
|
|
|
2375 |
return arr.find(check);
|
|
|
2376 |
}
|
|
|
2377 |
|
|
|
2378 |
// use `filter` to obtain the same behavior of `find`
|
|
|
2379 |
return arr.filter(check)[0];
|
|
|
2380 |
}
|
|
|
2381 |
|
|
|
2382 |
/**
|
|
|
2383 |
* Return the index of the matching object
|
|
|
2384 |
* @method
|
|
|
2385 |
* @memberof Popper.Utils
|
|
|
2386 |
* @argument {Array} arr
|
|
|
2387 |
* @argument prop
|
|
|
2388 |
* @argument value
|
|
|
2389 |
* @returns index or -1
|
|
|
2390 |
*/
|
|
|
2391 |
function findIndex(arr, prop, value) {
|
|
|
2392 |
// use native findIndex if supported
|
|
|
2393 |
if (Array.prototype.findIndex) {
|
|
|
2394 |
return arr.findIndex(function (cur) {
|
|
|
2395 |
return cur[prop] === value;
|
|
|
2396 |
});
|
|
|
2397 |
}
|
|
|
2398 |
|
|
|
2399 |
// use `find` + `indexOf` if `findIndex` isn't supported
|
|
|
2400 |
var match = find(arr, function (obj) {
|
|
|
2401 |
return obj[prop] === value;
|
|
|
2402 |
});
|
|
|
2403 |
return arr.indexOf(match);
|
|
|
2404 |
}
|
|
|
2405 |
|
|
|
2406 |
/**
|
|
|
2407 |
* Loop trough the list of modifiers and run them in order,
|
|
|
2408 |
* each of them will then edit the data object.
|
|
|
2409 |
* @method
|
|
|
2410 |
* @memberof Popper.Utils
|
|
|
2411 |
* @param {dataObject} data
|
|
|
2412 |
* @param {Array} modifiers
|
|
|
2413 |
* @param {String} ends - Optional modifier name used as stopper
|
|
|
2414 |
* @returns {dataObject}
|
|
|
2415 |
*/
|
|
|
2416 |
function runModifiers(modifiers, data, ends) {
|
|
|
2417 |
var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
|
|
|
2418 |
|
|
|
2419 |
modifiersToRun.forEach(function (modifier) {
|
|
|
2420 |
if (modifier['function']) {
|
|
|
2421 |
// eslint-disable-line dot-notation
|
|
|
2422 |
console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
|
|
|
2423 |
}
|
|
|
2424 |
var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
|
|
|
2425 |
if (modifier.enabled && isFunction(fn)) {
|
|
|
2426 |
// Add properties to offsets to make them a complete clientRect object
|
|
|
2427 |
// we do this before each modifier to make sure the previous one doesn't
|
|
|
2428 |
// mess with these values
|
|
|
2429 |
data.offsets.popper = getClientRect(data.offsets.popper);
|
|
|
2430 |
data.offsets.reference = getClientRect(data.offsets.reference);
|
|
|
2431 |
|
|
|
2432 |
data = fn(data, modifier);
|
|
|
2433 |
}
|
|
|
2434 |
});
|
|
|
2435 |
|
|
|
2436 |
return data;
|
|
|
2437 |
}
|
|
|
2438 |
|
|
|
2439 |
/**
|
|
|
2440 |
* Updates the position of the popper, computing the new offsets and applying
|
|
|
2441 |
* the new style.<br />
|
|
|
2442 |
* Prefer `scheduleUpdate` over `update` because of performance reasons.
|
|
|
2443 |
* @method
|
|
|
2444 |
* @memberof Popper
|
|
|
2445 |
*/
|
|
|
2446 |
function update() {
|
|
|
2447 |
// if popper is destroyed, don't perform any further update
|
|
|
2448 |
if (this.state.isDestroyed) {
|
|
|
2449 |
return;
|
|
|
2450 |
}
|
|
|
2451 |
|
|
|
2452 |
var data = {
|
|
|
2453 |
instance: this,
|
|
|
2454 |
styles: {},
|
|
|
2455 |
arrowStyles: {},
|
|
|
2456 |
attributes: {},
|
|
|
2457 |
flipped: false,
|
|
|
2458 |
offsets: {}
|
|
|
2459 |
};
|
|
|
2460 |
|
|
|
2461 |
// compute reference element offsets
|
|
|
2462 |
data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
|
|
|
2463 |
|
|
|
2464 |
// compute auto placement, store placement inside the data object,
|
|
|
2465 |
// modifiers will be able to edit `placement` if needed
|
|
|
2466 |
// and refer to originalPlacement to know the original value
|
|
|
2467 |
data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
|
|
|
2468 |
|
|
|
2469 |
// store the computed placement inside `originalPlacement`
|
|
|
2470 |
data.originalPlacement = data.placement;
|
|
|
2471 |
|
|
|
2472 |
data.positionFixed = this.options.positionFixed;
|
|
|
2473 |
|
|
|
2474 |
// compute the popper offsets
|
|
|
2475 |
data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
|
|
|
2476 |
|
|
|
2477 |
data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
|
|
|
2478 |
|
|
|
2479 |
// run the modifiers
|
|
|
2480 |
data = runModifiers(this.modifiers, data);
|
|
|
2481 |
|
|
|
2482 |
// the first `update` will call `onCreate` callback
|
|
|
2483 |
// the other ones will call `onUpdate` callback
|
|
|
2484 |
if (!this.state.isCreated) {
|
|
|
2485 |
this.state.isCreated = true;
|
|
|
2486 |
this.options.onCreate(data);
|
|
|
2487 |
} else {
|
|
|
2488 |
this.options.onUpdate(data);
|
|
|
2489 |
}
|
|
|
2490 |
}
|
|
|
2491 |
|
|
|
2492 |
/**
|
|
|
2493 |
* Helper used to know if the given modifier is enabled.
|
|
|
2494 |
* @method
|
|
|
2495 |
* @memberof Popper.Utils
|
|
|
2496 |
* @returns {Boolean}
|
|
|
2497 |
*/
|
|
|
2498 |
function isModifierEnabled(modifiers, modifierName) {
|
|
|
2499 |
return modifiers.some(function (_ref) {
|
|
|
2500 |
var name = _ref.name,
|
|
|
2501 |
enabled = _ref.enabled;
|
|
|
2502 |
return enabled && name === modifierName;
|
|
|
2503 |
});
|
|
|
2504 |
}
|
|
|
2505 |
|
|
|
2506 |
/**
|
|
|
2507 |
* Get the prefixed supported property name
|
|
|
2508 |
* @method
|
|
|
2509 |
* @memberof Popper.Utils
|
|
|
2510 |
* @argument {String} property (camelCase)
|
|
|
2511 |
* @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
|
|
|
2512 |
*/
|
|
|
2513 |
function getSupportedPropertyName(property) {
|
|
|
2514 |
var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
|
|
|
2515 |
var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
|
|
|
2516 |
|
|
|
2517 |
for (var i = 0; i < prefixes.length; i++) {
|
|
|
2518 |
var prefix = prefixes[i];
|
|
|
2519 |
var toCheck = prefix ? '' + prefix + upperProp : property;
|
|
|
2520 |
if (typeof document.body.style[toCheck] !== 'undefined') {
|
|
|
2521 |
return toCheck;
|
|
|
2522 |
}
|
|
|
2523 |
}
|
|
|
2524 |
return null;
|
|
|
2525 |
}
|
|
|
2526 |
|
|
|
2527 |
/**
|
|
|
2528 |
* Destroys the popper.
|
|
|
2529 |
* @method
|
|
|
2530 |
* @memberof Popper
|
|
|
2531 |
*/
|
|
|
2532 |
function destroy() {
|
|
|
2533 |
this.state.isDestroyed = true;
|
|
|
2534 |
|
|
|
2535 |
// touch DOM only if `applyStyle` modifier is enabled
|
|
|
2536 |
if (isModifierEnabled(this.modifiers, 'applyStyle')) {
|
|
|
2537 |
this.popper.removeAttribute('x-placement');
|
|
|
2538 |
this.popper.style.position = '';
|
|
|
2539 |
this.popper.style.top = '';
|
|
|
2540 |
this.popper.style.left = '';
|
|
|
2541 |
this.popper.style.right = '';
|
|
|
2542 |
this.popper.style.bottom = '';
|
|
|
2543 |
this.popper.style.willChange = '';
|
|
|
2544 |
this.popper.style[getSupportedPropertyName('transform')] = '';
|
|
|
2545 |
}
|
|
|
2546 |
|
|
|
2547 |
this.disableEventListeners();
|
|
|
2548 |
|
|
|
2549 |
// remove the popper if user explicitly asked for the deletion on destroy
|
|
|
2550 |
// do not use `remove` because IE11 doesn't support it
|
|
|
2551 |
if (this.options.removeOnDestroy) {
|
|
|
2552 |
this.popper.parentNode.removeChild(this.popper);
|
|
|
2553 |
}
|
|
|
2554 |
return this;
|
|
|
2555 |
}
|
|
|
2556 |
|
|
|
2557 |
/**
|
|
|
2558 |
* Get the window associated with the element
|
|
|
2559 |
* @argument {Element} element
|
|
|
2560 |
* @returns {Window}
|
|
|
2561 |
*/
|
|
|
2562 |
function getWindow(element) {
|
|
|
2563 |
var ownerDocument = element.ownerDocument;
|
|
|
2564 |
return ownerDocument ? ownerDocument.defaultView : window;
|
|
|
2565 |
}
|
|
|
2566 |
|
|
|
2567 |
function attachToScrollParents(scrollParent, event, callback, scrollParents) {
|
|
|
2568 |
var isBody = scrollParent.nodeName === 'BODY';
|
|
|
2569 |
var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
|
|
|
2570 |
target.addEventListener(event, callback, { passive: true });
|
|
|
2571 |
|
|
|
2572 |
if (!isBody) {
|
|
|
2573 |
attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
|
|
|
2574 |
}
|
|
|
2575 |
scrollParents.push(target);
|
|
|
2576 |
}
|
|
|
2577 |
|
|
|
2578 |
/**
|
|
|
2579 |
* Setup needed event listeners used to update the popper position
|
|
|
2580 |
* @method
|
|
|
2581 |
* @memberof Popper.Utils
|
|
|
2582 |
* @private
|
|
|
2583 |
*/
|
|
|
2584 |
function setupEventListeners(reference, options, state, updateBound) {
|
|
|
2585 |
// Resize event listener on window
|
|
|
2586 |
state.updateBound = updateBound;
|
|
|
2587 |
getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
|
|
|
2588 |
|
|
|
2589 |
// Scroll event listener on scroll parents
|
|
|
2590 |
var scrollElement = getScrollParent(reference);
|
|
|
2591 |
attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
|
|
|
2592 |
state.scrollElement = scrollElement;
|
|
|
2593 |
state.eventsEnabled = true;
|
|
|
2594 |
|
|
|
2595 |
return state;
|
|
|
2596 |
}
|
|
|
2597 |
|
|
|
2598 |
/**
|
|
|
2599 |
* It will add resize/scroll events and start recalculating
|
|
|
2600 |
* position of the popper element when they are triggered.
|
|
|
2601 |
* @method
|
|
|
2602 |
* @memberof Popper
|
|
|
2603 |
*/
|
|
|
2604 |
function enableEventListeners() {
|
|
|
2605 |
if (!this.state.eventsEnabled) {
|
|
|
2606 |
this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
|
|
|
2607 |
}
|
|
|
2608 |
}
|
|
|
2609 |
|
|
|
2610 |
/**
|
|
|
2611 |
* Remove event listeners used to update the popper position
|
|
|
2612 |
* @method
|
|
|
2613 |
* @memberof Popper.Utils
|
|
|
2614 |
* @private
|
|
|
2615 |
*/
|
|
|
2616 |
function removeEventListeners(reference, state) {
|
|
|
2617 |
// Remove resize event listener on window
|
|
|
2618 |
getWindow(reference).removeEventListener('resize', state.updateBound);
|
|
|
2619 |
|
|
|
2620 |
// Remove scroll event listener on scroll parents
|
|
|
2621 |
state.scrollParents.forEach(function (target) {
|
|
|
2622 |
target.removeEventListener('scroll', state.updateBound);
|
|
|
2623 |
});
|
|
|
2624 |
|
|
|
2625 |
// Reset state
|
|
|
2626 |
state.updateBound = null;
|
|
|
2627 |
state.scrollParents = [];
|
|
|
2628 |
state.scrollElement = null;
|
|
|
2629 |
state.eventsEnabled = false;
|
|
|
2630 |
return state;
|
|
|
2631 |
}
|
|
|
2632 |
|
|
|
2633 |
/**
|
|
|
2634 |
* It will remove resize/scroll events and won't recalculate popper position
|
|
|
2635 |
* when they are triggered. It also won't trigger `onUpdate` callback anymore,
|
|
|
2636 |
* unless you call `update` method manually.
|
|
|
2637 |
* @method
|
|
|
2638 |
* @memberof Popper
|
|
|
2639 |
*/
|
|
|
2640 |
function disableEventListeners() {
|
|
|
2641 |
if (this.state.eventsEnabled) {
|
|
|
2642 |
cancelAnimationFrame(this.scheduleUpdate);
|
|
|
2643 |
this.state = removeEventListeners(this.reference, this.state);
|
|
|
2644 |
}
|
|
|
2645 |
}
|
|
|
2646 |
|
|
|
2647 |
/**
|
|
|
2648 |
* Tells if a given input is a number
|
|
|
2649 |
* @method
|
|
|
2650 |
* @memberof Popper.Utils
|
|
|
2651 |
* @param {*} input to check
|
|
|
2652 |
* @return {Boolean}
|
|
|
2653 |
*/
|
|
|
2654 |
function isNumeric(n) {
|
|
|
2655 |
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
|
|
2656 |
}
|
|
|
2657 |
|
|
|
2658 |
/**
|
|
|
2659 |
* Set the style to the given popper
|
|
|
2660 |
* @method
|
|
|
2661 |
* @memberof Popper.Utils
|
|
|
2662 |
* @argument {Element} element - Element to apply the style to
|
|
|
2663 |
* @argument {Object} styles
|
|
|
2664 |
* Object with a list of properties and values which will be applied to the element
|
|
|
2665 |
*/
|
|
|
2666 |
function setStyles(element, styles) {
|
|
|
2667 |
Object.keys(styles).forEach(function (prop) {
|
|
|
2668 |
var unit = '';
|
|
|
2669 |
// add unit if the value is numeric and is one of the following
|
|
|
2670 |
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
|
|
|
2671 |
unit = 'px';
|
|
|
2672 |
}
|
|
|
2673 |
element.style[prop] = styles[prop] + unit;
|
|
|
2674 |
});
|
|
|
2675 |
}
|
|
|
2676 |
|
|
|
2677 |
/**
|
|
|
2678 |
* Set the attributes to the given popper
|
|
|
2679 |
* @method
|
|
|
2680 |
* @memberof Popper.Utils
|
|
|
2681 |
* @argument {Element} element - Element to apply the attributes to
|
|
|
2682 |
* @argument {Object} styles
|
|
|
2683 |
* Object with a list of properties and values which will be applied to the element
|
|
|
2684 |
*/
|
|
|
2685 |
function setAttributes(element, attributes) {
|
|
|
2686 |
Object.keys(attributes).forEach(function (prop) {
|
|
|
2687 |
var value = attributes[prop];
|
|
|
2688 |
if (value !== false) {
|
|
|
2689 |
element.setAttribute(prop, attributes[prop]);
|
|
|
2690 |
} else {
|
|
|
2691 |
element.removeAttribute(prop);
|
|
|
2692 |
}
|
|
|
2693 |
});
|
|
|
2694 |
}
|
|
|
2695 |
|
|
|
2696 |
/**
|
|
|
2697 |
* @function
|
|
|
2698 |
* @memberof Modifiers
|
|
|
2699 |
* @argument {Object} data - The data object generated by `update` method
|
|
|
2700 |
* @argument {Object} data.styles - List of style properties - values to apply to popper element
|
|
|
2701 |
* @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
|
|
|
2702 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
2703 |
* @returns {Object} The same data object
|
|
|
2704 |
*/
|
|
|
2705 |
function applyStyle(data) {
|
|
|
2706 |
// any property present in `data.styles` will be applied to the popper,
|
|
|
2707 |
// in this way we can make the 3rd party modifiers add custom styles to it
|
|
|
2708 |
// Be aware, modifiers could override the properties defined in the previous
|
|
|
2709 |
// lines of this modifier!
|
|
|
2710 |
setStyles(data.instance.popper, data.styles);
|
|
|
2711 |
|
|
|
2712 |
// any property present in `data.attributes` will be applied to the popper,
|
|
|
2713 |
// they will be set as HTML attributes of the element
|
|
|
2714 |
setAttributes(data.instance.popper, data.attributes);
|
|
|
2715 |
|
|
|
2716 |
// if arrowElement is defined and arrowStyles has some properties
|
|
|
2717 |
if (data.arrowElement && Object.keys(data.arrowStyles).length) {
|
|
|
2718 |
setStyles(data.arrowElement, data.arrowStyles);
|
|
|
2719 |
}
|
|
|
2720 |
|
|
|
2721 |
return data;
|
|
|
2722 |
}
|
|
|
2723 |
|
|
|
2724 |
/**
|
|
|
2725 |
* Set the x-placement attribute before everything else because it could be used
|
|
|
2726 |
* to add margins to the popper margins needs to be calculated to get the
|
|
|
2727 |
* correct popper offsets.
|
|
|
2728 |
* @method
|
|
|
2729 |
* @memberof Popper.modifiers
|
|
|
2730 |
* @param {HTMLElement} reference - The reference element used to position the popper
|
|
|
2731 |
* @param {HTMLElement} popper - The HTML element used as popper
|
|
|
2732 |
* @param {Object} options - Popper.js options
|
|
|
2733 |
*/
|
|
|
2734 |
function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
|
|
|
2735 |
// compute reference element offsets
|
|
|
2736 |
var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
|
|
|
2737 |
|
|
|
2738 |
// compute auto placement, store placement inside the data object,
|
|
|
2739 |
// modifiers will be able to edit `placement` if needed
|
|
|
2740 |
// and refer to originalPlacement to know the original value
|
|
|
2741 |
var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
|
|
|
2742 |
|
|
|
2743 |
popper.setAttribute('x-placement', placement);
|
|
|
2744 |
|
|
|
2745 |
// Apply `position` to popper before anything else because
|
|
|
2746 |
// without the position applied we can't guarantee correct computations
|
|
|
2747 |
setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
|
|
|
2748 |
|
|
|
2749 |
return options;
|
|
|
2750 |
}
|
|
|
2751 |
|
|
|
2752 |
/**
|
|
|
2753 |
* @function
|
|
|
2754 |
* @memberof Popper.Utils
|
|
|
2755 |
* @argument {Object} data - The data object generated by `update` method
|
|
|
2756 |
* @argument {Boolean} shouldRound - If the offsets should be rounded at all
|
|
|
2757 |
* @returns {Object} The popper's position offsets rounded
|
|
|
2758 |
*
|
|
|
2759 |
* The tale of pixel-perfect positioning. It's still not 100% perfect, but as
|
|
|
2760 |
* good as it can be within reason.
|
|
|
2761 |
* Discussion here: https://github.com/FezVrasta/popper.js/pull/715
|
|
|
2762 |
*
|
|
|
2763 |
* Low DPI screens cause a popper to be blurry if not using full pixels (Safari
|
|
|
2764 |
* as well on High DPI screens).
|
|
|
2765 |
*
|
|
|
2766 |
* Firefox prefers no rounding for positioning and does not have blurriness on
|
|
|
2767 |
* high DPI screens.
|
|
|
2768 |
*
|
|
|
2769 |
* Only horizontal placement and left/right values need to be considered.
|
|
|
2770 |
*/
|
|
|
2771 |
function getRoundedOffsets(data, shouldRound) {
|
|
|
2772 |
var _data$offsets = data.offsets,
|
|
|
2773 |
popper = _data$offsets.popper,
|
|
|
2774 |
reference = _data$offsets.reference;
|
|
|
2775 |
var round = Math.round,
|
|
|
2776 |
floor = Math.floor;
|
|
|
2777 |
|
|
|
2778 |
var noRound = function noRound(v) {
|
|
|
2779 |
return v;
|
|
|
2780 |
};
|
|
|
2781 |
|
|
|
2782 |
var referenceWidth = round(reference.width);
|
|
|
2783 |
var popperWidth = round(popper.width);
|
|
|
2784 |
|
|
|
2785 |
var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
|
|
|
2786 |
var isVariation = data.placement.indexOf('-') !== -1;
|
|
|
2787 |
var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
|
|
|
2788 |
var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
|
|
|
2789 |
|
|
|
2790 |
var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
|
|
|
2791 |
var verticalToInteger = !shouldRound ? noRound : round;
|
|
|
2792 |
|
|
|
2793 |
return {
|
|
|
2794 |
left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
|
|
|
2795 |
top: verticalToInteger(popper.top),
|
|
|
2796 |
bottom: verticalToInteger(popper.bottom),
|
|
|
2797 |
right: horizontalToInteger(popper.right)
|
|
|
2798 |
};
|
|
|
2799 |
}
|
|
|
2800 |
|
|
|
2801 |
var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
|
|
|
2802 |
|
|
|
2803 |
/**
|
|
|
2804 |
* @function
|
|
|
2805 |
* @memberof Modifiers
|
|
|
2806 |
* @argument {Object} data - The data object generated by `update` method
|
|
|
2807 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
2808 |
* @returns {Object} The data object, properly modified
|
|
|
2809 |
*/
|
|
|
2810 |
function computeStyle(data, options) {
|
|
|
2811 |
var x = options.x,
|
|
|
2812 |
y = options.y;
|
|
|
2813 |
var popper = data.offsets.popper;
|
|
|
2814 |
|
|
|
2815 |
// Remove this legacy support in Popper.js v2
|
|
|
2816 |
|
|
|
2817 |
var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
|
|
|
2818 |
return modifier.name === 'applyStyle';
|
|
|
2819 |
}).gpuAcceleration;
|
|
|
2820 |
if (legacyGpuAccelerationOption !== undefined) {
|
|
|
2821 |
console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
|
|
|
2822 |
}
|
|
|
2823 |
var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
|
|
|
2824 |
|
|
|
2825 |
var offsetParent = getOffsetParent(data.instance.popper);
|
|
|
2826 |
var offsetParentRect = getBoundingClientRect(offsetParent);
|
|
|
2827 |
|
|
|
2828 |
// Styles
|
|
|
2829 |
var styles = {
|
|
|
2830 |
position: popper.position
|
|
|
2831 |
};
|
|
|
2832 |
|
|
|
2833 |
var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
|
|
|
2834 |
|
|
|
2835 |
var sideA = x === 'bottom' ? 'top' : 'bottom';
|
|
|
2836 |
var sideB = y === 'right' ? 'left' : 'right';
|
|
|
2837 |
|
|
|
2838 |
// if gpuAcceleration is set to `true` and transform is supported,
|
|
|
2839 |
// we use `translate3d` to apply the position to the popper we
|
|
|
2840 |
// automatically use the supported prefixed version if needed
|
|
|
2841 |
var prefixedProperty = getSupportedPropertyName('transform');
|
|
|
2842 |
|
|
|
2843 |
// now, let's make a step back and look at this code closely (wtf?)
|
|
|
2844 |
// If the content of the popper grows once it's been positioned, it
|
|
|
2845 |
// may happen that the popper gets misplaced because of the new content
|
|
|
2846 |
// overflowing its reference element
|
|
|
2847 |
// To avoid this problem, we provide two options (x and y), which allow
|
|
|
2848 |
// the consumer to define the offset origin.
|
|
|
2849 |
// If we position a popper on top of a reference element, we can set
|
|
|
2850 |
// `x` to `top` to make the popper grow towards its top instead of
|
|
|
2851 |
// its bottom.
|
|
|
2852 |
var left = void 0,
|
|
|
2853 |
top = void 0;
|
|
|
2854 |
if (sideA === 'bottom') {
|
|
|
2855 |
// when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
|
|
|
2856 |
// and not the bottom of the html element
|
|
|
2857 |
if (offsetParent.nodeName === 'HTML') {
|
|
|
2858 |
top = -offsetParent.clientHeight + offsets.bottom;
|
|
|
2859 |
} else {
|
|
|
2860 |
top = -offsetParentRect.height + offsets.bottom;
|
|
|
2861 |
}
|
|
|
2862 |
} else {
|
|
|
2863 |
top = offsets.top;
|
|
|
2864 |
}
|
|
|
2865 |
if (sideB === 'right') {
|
|
|
2866 |
if (offsetParent.nodeName === 'HTML') {
|
|
|
2867 |
left = -offsetParent.clientWidth + offsets.right;
|
|
|
2868 |
} else {
|
|
|
2869 |
left = -offsetParentRect.width + offsets.right;
|
|
|
2870 |
}
|
|
|
2871 |
} else {
|
|
|
2872 |
left = offsets.left;
|
|
|
2873 |
}
|
|
|
2874 |
if (gpuAcceleration && prefixedProperty) {
|
|
|
2875 |
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
|
|
|
2876 |
styles[sideA] = 0;
|
|
|
2877 |
styles[sideB] = 0;
|
|
|
2878 |
styles.willChange = 'transform';
|
|
|
2879 |
} else {
|
|
|
2880 |
// othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
|
|
|
2881 |
var invertTop = sideA === 'bottom' ? -1 : 1;
|
|
|
2882 |
var invertLeft = sideB === 'right' ? -1 : 1;
|
|
|
2883 |
styles[sideA] = top * invertTop;
|
|
|
2884 |
styles[sideB] = left * invertLeft;
|
|
|
2885 |
styles.willChange = sideA + ', ' + sideB;
|
|
|
2886 |
}
|
|
|
2887 |
|
|
|
2888 |
// Attributes
|
|
|
2889 |
var attributes = {
|
|
|
2890 |
'x-placement': data.placement
|
|
|
2891 |
};
|
|
|
2892 |
|
|
|
2893 |
// Update `data` attributes, styles and arrowStyles
|
|
|
2894 |
data.attributes = _extends$1({}, attributes, data.attributes);
|
|
|
2895 |
data.styles = _extends$1({}, styles, data.styles);
|
|
|
2896 |
data.arrowStyles = _extends$1({}, data.offsets.arrow, data.arrowStyles);
|
|
|
2897 |
|
|
|
2898 |
return data;
|
|
|
2899 |
}
|
|
|
2900 |
|
|
|
2901 |
/**
|
|
|
2902 |
* Helper used to know if the given modifier depends from another one.<br />
|
|
|
2903 |
* It checks if the needed modifier is listed and enabled.
|
|
|
2904 |
* @method
|
|
|
2905 |
* @memberof Popper.Utils
|
|
|
2906 |
* @param {Array} modifiers - list of modifiers
|
|
|
2907 |
* @param {String} requestingName - name of requesting modifier
|
|
|
2908 |
* @param {String} requestedName - name of requested modifier
|
|
|
2909 |
* @returns {Boolean}
|
|
|
2910 |
*/
|
|
|
2911 |
function isModifierRequired(modifiers, requestingName, requestedName) {
|
|
|
2912 |
var requesting = find(modifiers, function (_ref) {
|
|
|
2913 |
var name = _ref.name;
|
|
|
2914 |
return name === requestingName;
|
|
|
2915 |
});
|
|
|
2916 |
|
|
|
2917 |
var isRequired = !!requesting && modifiers.some(function (modifier) {
|
|
|
2918 |
return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
|
|
|
2919 |
});
|
|
|
2920 |
|
|
|
2921 |
if (!isRequired) {
|
|
|
2922 |
var _requesting = '`' + requestingName + '`';
|
|
|
2923 |
var requested = '`' + requestedName + '`';
|
|
|
2924 |
console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
|
|
|
2925 |
}
|
|
|
2926 |
return isRequired;
|
|
|
2927 |
}
|
|
|
2928 |
|
|
|
2929 |
/**
|
|
|
2930 |
* @function
|
|
|
2931 |
* @memberof Modifiers
|
|
|
2932 |
* @argument {Object} data - The data object generated by update method
|
|
|
2933 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
2934 |
* @returns {Object} The data object, properly modified
|
|
|
2935 |
*/
|
|
|
2936 |
function arrow(data, options) {
|
|
|
2937 |
var _data$offsets$arrow;
|
|
|
2938 |
|
|
|
2939 |
// arrow depends on keepTogether in order to work
|
|
|
2940 |
if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
|
|
|
2941 |
return data;
|
|
|
2942 |
}
|
|
|
2943 |
|
|
|
2944 |
var arrowElement = options.element;
|
|
|
2945 |
|
|
|
2946 |
// if arrowElement is a string, suppose it's a CSS selector
|
|
|
2947 |
if (typeof arrowElement === 'string') {
|
|
|
2948 |
arrowElement = data.instance.popper.querySelector(arrowElement);
|
|
|
2949 |
|
|
|
2950 |
// if arrowElement is not found, don't run the modifier
|
|
|
2951 |
if (!arrowElement) {
|
|
|
2952 |
return data;
|
|
|
2953 |
}
|
|
|
2954 |
} else {
|
|
|
2955 |
// if the arrowElement isn't a query selector we must check that the
|
|
|
2956 |
// provided DOM node is child of its popper node
|
|
|
2957 |
if (!data.instance.popper.contains(arrowElement)) {
|
|
|
2958 |
console.warn('WARNING: `arrow.element` must be child of its popper element!');
|
|
|
2959 |
return data;
|
|
|
2960 |
}
|
|
|
2961 |
}
|
|
|
2962 |
|
|
|
2963 |
var placement = data.placement.split('-')[0];
|
|
|
2964 |
var _data$offsets = data.offsets,
|
|
|
2965 |
popper = _data$offsets.popper,
|
|
|
2966 |
reference = _data$offsets.reference;
|
|
|
2967 |
|
|
|
2968 |
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
|
|
2969 |
|
|
|
2970 |
var len = isVertical ? 'height' : 'width';
|
|
|
2971 |
var sideCapitalized = isVertical ? 'Top' : 'Left';
|
|
|
2972 |
var side = sideCapitalized.toLowerCase();
|
|
|
2973 |
var altSide = isVertical ? 'left' : 'top';
|
|
|
2974 |
var opSide = isVertical ? 'bottom' : 'right';
|
|
|
2975 |
var arrowElementSize = getOuterSizes(arrowElement)[len];
|
|
|
2976 |
|
|
|
2977 |
//
|
|
|
2978 |
// extends keepTogether behavior making sure the popper and its
|
|
|
2979 |
// reference have enough pixels in conjunction
|
|
|
2980 |
//
|
|
|
2981 |
|
|
|
2982 |
// top/left side
|
|
|
2983 |
if (reference[opSide] - arrowElementSize < popper[side]) {
|
|
|
2984 |
data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
|
|
|
2985 |
}
|
|
|
2986 |
// bottom/right side
|
|
|
2987 |
if (reference[side] + arrowElementSize > popper[opSide]) {
|
|
|
2988 |
data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
|
|
|
2989 |
}
|
|
|
2990 |
data.offsets.popper = getClientRect(data.offsets.popper);
|
|
|
2991 |
|
|
|
2992 |
// compute center of the popper
|
|
|
2993 |
var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
|
|
|
2994 |
|
|
|
2995 |
// Compute the sideValue using the updated popper offsets
|
|
|
2996 |
// take popper margin in account because we don't have this info available
|
|
|
2997 |
var css = getStyleComputedProperty(data.instance.popper);
|
|
|
2998 |
var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
|
|
|
2999 |
var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
|
|
|
3000 |
var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
|
|
|
3001 |
|
|
|
3002 |
// prevent arrowElement from being placed not contiguously to its popper
|
|
|
3003 |
sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
|
|
|
3004 |
|
|
|
3005 |
data.arrowElement = arrowElement;
|
|
|
3006 |
data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
|
|
|
3007 |
|
|
|
3008 |
return data;
|
|
|
3009 |
}
|
|
|
3010 |
|
|
|
3011 |
/**
|
|
|
3012 |
* Get the opposite placement variation of the given one
|
|
|
3013 |
* @method
|
|
|
3014 |
* @memberof Popper.Utils
|
|
|
3015 |
* @argument {String} placement variation
|
|
|
3016 |
* @returns {String} flipped placement variation
|
|
|
3017 |
*/
|
|
|
3018 |
function getOppositeVariation(variation) {
|
|
|
3019 |
if (variation === 'end') {
|
|
|
3020 |
return 'start';
|
|
|
3021 |
} else if (variation === 'start') {
|
|
|
3022 |
return 'end';
|
|
|
3023 |
}
|
|
|
3024 |
return variation;
|
|
|
3025 |
}
|
|
|
3026 |
|
|
|
3027 |
/**
|
|
|
3028 |
* List of accepted placements to use as values of the `placement` option.<br />
|
|
|
3029 |
* Valid placements are:
|
|
|
3030 |
* - `auto`
|
|
|
3031 |
* - `top`
|
|
|
3032 |
* - `right`
|
|
|
3033 |
* - `bottom`
|
|
|
3034 |
* - `left`
|
|
|
3035 |
*
|
|
|
3036 |
* Each placement can have a variation from this list:
|
|
|
3037 |
* - `-start`
|
|
|
3038 |
* - `-end`
|
|
|
3039 |
*
|
|
|
3040 |
* Variations are interpreted easily if you think of them as the left to right
|
|
|
3041 |
* written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
|
|
|
3042 |
* is right.<br />
|
|
|
3043 |
* Vertically (`left` and `right`), `start` is top and `end` is bottom.
|
|
|
3044 |
*
|
|
|
3045 |
* Some valid examples are:
|
|
|
3046 |
* - `top-end` (on top of reference, right aligned)
|
|
|
3047 |
* - `right-start` (on right of reference, top aligned)
|
|
|
3048 |
* - `bottom` (on bottom, centered)
|
|
|
3049 |
* - `auto-end` (on the side with more space available, alignment depends by placement)
|
|
|
3050 |
*
|
|
|
3051 |
* @static
|
|
|
3052 |
* @type {Array}
|
|
|
3053 |
* @enum {String}
|
|
|
3054 |
* @readonly
|
|
|
3055 |
* @method placements
|
|
|
3056 |
* @memberof Popper
|
|
|
3057 |
*/
|
|
|
3058 |
var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
|
|
|
3059 |
|
|
|
3060 |
// Get rid of `auto` `auto-start` and `auto-end`
|
|
|
3061 |
var validPlacements = placements.slice(3);
|
|
|
3062 |
|
|
|
3063 |
/**
|
|
|
3064 |
* Given an initial placement, returns all the subsequent placements
|
|
|
3065 |
* clockwise (or counter-clockwise).
|
|
|
3066 |
*
|
|
|
3067 |
* @method
|
|
|
3068 |
* @memberof Popper.Utils
|
|
|
3069 |
* @argument {String} placement - A valid placement (it accepts variations)
|
|
|
3070 |
* @argument {Boolean} counter - Set to true to walk the placements counterclockwise
|
|
|
3071 |
* @returns {Array} placements including their variations
|
|
|
3072 |
*/
|
|
|
3073 |
function clockwise(placement) {
|
|
|
3074 |
var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
|
3075 |
|
|
|
3076 |
var index = validPlacements.indexOf(placement);
|
|
|
3077 |
var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
|
|
|
3078 |
return counter ? arr.reverse() : arr;
|
|
|
3079 |
}
|
|
|
3080 |
|
|
|
3081 |
var BEHAVIORS = {
|
|
|
3082 |
FLIP: 'flip',
|
|
|
3083 |
CLOCKWISE: 'clockwise',
|
|
|
3084 |
COUNTERCLOCKWISE: 'counterclockwise'
|
|
|
3085 |
};
|
|
|
3086 |
|
|
|
3087 |
/**
|
|
|
3088 |
* @function
|
|
|
3089 |
* @memberof Modifiers
|
|
|
3090 |
* @argument {Object} data - The data object generated by update method
|
|
|
3091 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
3092 |
* @returns {Object} The data object, properly modified
|
|
|
3093 |
*/
|
|
|
3094 |
function flip(data, options) {
|
|
|
3095 |
// if `inner` modifier is enabled, we can't use the `flip` modifier
|
|
|
3096 |
if (isModifierEnabled(data.instance.modifiers, 'inner')) {
|
|
|
3097 |
return data;
|
|
|
3098 |
}
|
|
|
3099 |
|
|
|
3100 |
if (data.flipped && data.placement === data.originalPlacement) {
|
|
|
3101 |
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
|
|
|
3102 |
return data;
|
|
|
3103 |
}
|
|
|
3104 |
|
|
|
3105 |
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
|
|
|
3106 |
|
|
|
3107 |
var placement = data.placement.split('-')[0];
|
|
|
3108 |
var placementOpposite = getOppositePlacement(placement);
|
|
|
3109 |
var variation = data.placement.split('-')[1] || '';
|
|
|
3110 |
|
|
|
3111 |
var flipOrder = [];
|
|
|
3112 |
|
|
|
3113 |
switch (options.behavior) {
|
|
|
3114 |
case BEHAVIORS.FLIP:
|
|
|
3115 |
flipOrder = [placement, placementOpposite];
|
|
|
3116 |
break;
|
|
|
3117 |
case BEHAVIORS.CLOCKWISE:
|
|
|
3118 |
flipOrder = clockwise(placement);
|
|
|
3119 |
break;
|
|
|
3120 |
case BEHAVIORS.COUNTERCLOCKWISE:
|
|
|
3121 |
flipOrder = clockwise(placement, true);
|
|
|
3122 |
break;
|
|
|
3123 |
default:
|
|
|
3124 |
flipOrder = options.behavior;
|
|
|
3125 |
}
|
|
|
3126 |
|
|
|
3127 |
flipOrder.forEach(function (step, index) {
|
|
|
3128 |
if (placement !== step || flipOrder.length === index + 1) {
|
|
|
3129 |
return data;
|
|
|
3130 |
}
|
|
|
3131 |
|
|
|
3132 |
placement = data.placement.split('-')[0];
|
|
|
3133 |
placementOpposite = getOppositePlacement(placement);
|
|
|
3134 |
|
|
|
3135 |
var popperOffsets = data.offsets.popper;
|
|
|
3136 |
var refOffsets = data.offsets.reference;
|
|
|
3137 |
|
|
|
3138 |
// using floor because the reference offsets may contain decimals we are not going to consider here
|
|
|
3139 |
var floor = Math.floor;
|
|
|
3140 |
var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
|
|
|
3141 |
|
|
|
3142 |
var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
|
|
|
3143 |
var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
|
|
|
3144 |
var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
|
|
|
3145 |
var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
|
|
|
3146 |
|
|
|
3147 |
var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
|
|
|
3148 |
|
|
|
3149 |
// flip the variation if required
|
|
|
3150 |
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
|
|
|
3151 |
|
|
|
3152 |
// flips variation if reference element overflows boundaries
|
|
|
3153 |
var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
|
|
|
3154 |
|
|
|
3155 |
// flips variation if popper content overflows boundaries
|
|
|
3156 |
var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
|
|
|
3157 |
|
|
|
3158 |
var flippedVariation = flippedVariationByRef || flippedVariationByContent;
|
|
|
3159 |
|
|
|
3160 |
if (overlapsRef || overflowsBoundaries || flippedVariation) {
|
|
|
3161 |
// this boolean to detect any flip loop
|
|
|
3162 |
data.flipped = true;
|
|
|
3163 |
|
|
|
3164 |
if (overlapsRef || overflowsBoundaries) {
|
|
|
3165 |
placement = flipOrder[index + 1];
|
|
|
3166 |
}
|
|
|
3167 |
|
|
|
3168 |
if (flippedVariation) {
|
|
|
3169 |
variation = getOppositeVariation(variation);
|
|
|
3170 |
}
|
|
|
3171 |
|
|
|
3172 |
data.placement = placement + (variation ? '-' + variation : '');
|
|
|
3173 |
|
|
|
3174 |
// this object contains `position`, we want to preserve it along with
|
|
|
3175 |
// any additional property we may add in the future
|
|
|
3176 |
data.offsets.popper = _extends$1({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
|
|
|
3177 |
|
|
|
3178 |
data = runModifiers(data.instance.modifiers, data, 'flip');
|
|
|
3179 |
}
|
|
|
3180 |
});
|
|
|
3181 |
return data;
|
|
|
3182 |
}
|
|
|
3183 |
|
|
|
3184 |
/**
|
|
|
3185 |
* @function
|
|
|
3186 |
* @memberof Modifiers
|
|
|
3187 |
* @argument {Object} data - The data object generated by update method
|
|
|
3188 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
3189 |
* @returns {Object} The data object, properly modified
|
|
|
3190 |
*/
|
|
|
3191 |
function keepTogether(data) {
|
|
|
3192 |
var _data$offsets = data.offsets,
|
|
|
3193 |
popper = _data$offsets.popper,
|
|
|
3194 |
reference = _data$offsets.reference;
|
|
|
3195 |
|
|
|
3196 |
var placement = data.placement.split('-')[0];
|
|
|
3197 |
var floor = Math.floor;
|
|
|
3198 |
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
|
|
|
3199 |
var side = isVertical ? 'right' : 'bottom';
|
|
|
3200 |
var opSide = isVertical ? 'left' : 'top';
|
|
|
3201 |
var measurement = isVertical ? 'width' : 'height';
|
|
|
3202 |
|
|
|
3203 |
if (popper[side] < floor(reference[opSide])) {
|
|
|
3204 |
data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
|
|
|
3205 |
}
|
|
|
3206 |
if (popper[opSide] > floor(reference[side])) {
|
|
|
3207 |
data.offsets.popper[opSide] = floor(reference[side]);
|
|
|
3208 |
}
|
|
|
3209 |
|
|
|
3210 |
return data;
|
|
|
3211 |
}
|
|
|
3212 |
|
|
|
3213 |
/**
|
|
|
3214 |
* Converts a string containing value + unit into a px value number
|
|
|
3215 |
* @function
|
|
|
3216 |
* @memberof {modifiers~offset}
|
|
|
3217 |
* @private
|
|
|
3218 |
* @argument {String} str - Value + unit string
|
|
|
3219 |
* @argument {String} measurement - `height` or `width`
|
|
|
3220 |
* @argument {Object} popperOffsets
|
|
|
3221 |
* @argument {Object} referenceOffsets
|
|
|
3222 |
* @returns {Number|String}
|
|
|
3223 |
* Value in pixels, or original string if no values were extracted
|
|
|
3224 |
*/
|
|
|
3225 |
function toValue(str, measurement, popperOffsets, referenceOffsets) {
|
|
|
3226 |
// separate value from unit
|
|
|
3227 |
var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
|
|
|
3228 |
var value = +split[1];
|
|
|
3229 |
var unit = split[2];
|
|
|
3230 |
|
|
|
3231 |
// If it's not a number it's an operator, I guess
|
|
|
3232 |
if (!value) {
|
|
|
3233 |
return str;
|
|
|
3234 |
}
|
|
|
3235 |
|
|
|
3236 |
if (unit.indexOf('%') === 0) {
|
|
|
3237 |
var element = void 0;
|
|
|
3238 |
switch (unit) {
|
|
|
3239 |
case '%p':
|
|
|
3240 |
element = popperOffsets;
|
|
|
3241 |
break;
|
|
|
3242 |
case '%':
|
|
|
3243 |
case '%r':
|
|
|
3244 |
default:
|
|
|
3245 |
element = referenceOffsets;
|
|
|
3246 |
}
|
|
|
3247 |
|
|
|
3248 |
var rect = getClientRect(element);
|
|
|
3249 |
return rect[measurement] / 100 * value;
|
|
|
3250 |
} else if (unit === 'vh' || unit === 'vw') {
|
|
|
3251 |
// if is a vh or vw, we calculate the size based on the viewport
|
|
|
3252 |
var size = void 0;
|
|
|
3253 |
if (unit === 'vh') {
|
|
|
3254 |
size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
|
|
3255 |
} else {
|
|
|
3256 |
size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
|
|
3257 |
}
|
|
|
3258 |
return size / 100 * value;
|
|
|
3259 |
} else {
|
|
|
3260 |
// if is an explicit pixel unit, we get rid of the unit and keep the value
|
|
|
3261 |
// if is an implicit unit, it's px, and we return just the value
|
|
|
3262 |
return value;
|
|
|
3263 |
}
|
|
|
3264 |
}
|
|
|
3265 |
|
|
|
3266 |
/**
|
|
|
3267 |
* Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
|
|
|
3268 |
* @function
|
|
|
3269 |
* @memberof {modifiers~offset}
|
|
|
3270 |
* @private
|
|
|
3271 |
* @argument {String} offset
|
|
|
3272 |
* @argument {Object} popperOffsets
|
|
|
3273 |
* @argument {Object} referenceOffsets
|
|
|
3274 |
* @argument {String} basePlacement
|
|
|
3275 |
* @returns {Array} a two cells array with x and y offsets in numbers
|
|
|
3276 |
*/
|
|
|
3277 |
function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
|
|
|
3278 |
var offsets = [0, 0];
|
|
|
3279 |
|
|
|
3280 |
// Use height if placement is left or right and index is 0 otherwise use width
|
|
|
3281 |
// in this way the first offset will use an axis and the second one
|
|
|
3282 |
// will use the other one
|
|
|
3283 |
var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
|
|
|
3284 |
|
|
|
3285 |
// Split the offset string to obtain a list of values and operands
|
|
|
3286 |
// The regex addresses values with the plus or minus sign in front (+10, -20, etc)
|
|
|
3287 |
var fragments = offset.split(/(\+|\-)/).map(function (frag) {
|
|
|
3288 |
return frag.trim();
|
|
|
3289 |
});
|
|
|
3290 |
|
|
|
3291 |
// Detect if the offset string contains a pair of values or a single one
|
|
|
3292 |
// they could be separated by comma or space
|
|
|
3293 |
var divider = fragments.indexOf(find(fragments, function (frag) {
|
|
|
3294 |
return frag.search(/,|\s/) !== -1;
|
|
|
3295 |
}));
|
|
|
3296 |
|
|
|
3297 |
if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
|
|
|
3298 |
console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
|
|
|
3299 |
}
|
|
|
3300 |
|
|
|
3301 |
// If divider is found, we divide the list of values and operands to divide
|
|
|
3302 |
// them by ofset X and Y.
|
|
|
3303 |
var splitRegex = /\s*,\s*|\s+/;
|
|
|
3304 |
var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
|
|
|
3305 |
|
|
|
3306 |
// Convert the values with units to absolute pixels to allow our computations
|
|
|
3307 |
ops = ops.map(function (op, index) {
|
|
|
3308 |
// Most of the units rely on the orientation of the popper
|
|
|
3309 |
var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
|
|
|
3310 |
var mergeWithPrevious = false;
|
|
|
3311 |
return op
|
|
|
3312 |
// This aggregates any `+` or `-` sign that aren't considered operators
|
|
|
3313 |
// e.g.: 10 + +5 => [10, +, +5]
|
|
|
3314 |
.reduce(function (a, b) {
|
|
|
3315 |
if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
|
|
|
3316 |
a[a.length - 1] = b;
|
|
|
3317 |
mergeWithPrevious = true;
|
|
|
3318 |
return a;
|
|
|
3319 |
} else if (mergeWithPrevious) {
|
|
|
3320 |
a[a.length - 1] += b;
|
|
|
3321 |
mergeWithPrevious = false;
|
|
|
3322 |
return a;
|
|
|
3323 |
} else {
|
|
|
3324 |
return a.concat(b);
|
|
|
3325 |
}
|
|
|
3326 |
}, [])
|
|
|
3327 |
// Here we convert the string values into number values (in px)
|
|
|
3328 |
.map(function (str) {
|
|
|
3329 |
return toValue(str, measurement, popperOffsets, referenceOffsets);
|
|
|
3330 |
});
|
|
|
3331 |
});
|
|
|
3332 |
|
|
|
3333 |
// Loop trough the offsets arrays and execute the operations
|
|
|
3334 |
ops.forEach(function (op, index) {
|
|
|
3335 |
op.forEach(function (frag, index2) {
|
|
|
3336 |
if (isNumeric(frag)) {
|
|
|
3337 |
offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
|
|
|
3338 |
}
|
|
|
3339 |
});
|
|
|
3340 |
});
|
|
|
3341 |
return offsets;
|
|
|
3342 |
}
|
|
|
3343 |
|
|
|
3344 |
/**
|
|
|
3345 |
* @function
|
|
|
3346 |
* @memberof Modifiers
|
|
|
3347 |
* @argument {Object} data - The data object generated by update method
|
|
|
3348 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
3349 |
* @argument {Number|String} options.offset=0
|
|
|
3350 |
* The offset value as described in the modifier description
|
|
|
3351 |
* @returns {Object} The data object, properly modified
|
|
|
3352 |
*/
|
|
|
3353 |
function offset(data, _ref) {
|
|
|
3354 |
var offset = _ref.offset;
|
|
|
3355 |
var placement = data.placement,
|
|
|
3356 |
_data$offsets = data.offsets,
|
|
|
3357 |
popper = _data$offsets.popper,
|
|
|
3358 |
reference = _data$offsets.reference;
|
|
|
3359 |
|
|
|
3360 |
var basePlacement = placement.split('-')[0];
|
|
|
3361 |
|
|
|
3362 |
var offsets = void 0;
|
|
|
3363 |
if (isNumeric(+offset)) {
|
|
|
3364 |
offsets = [+offset, 0];
|
|
|
3365 |
} else {
|
|
|
3366 |
offsets = parseOffset(offset, popper, reference, basePlacement);
|
|
|
3367 |
}
|
|
|
3368 |
|
|
|
3369 |
if (basePlacement === 'left') {
|
|
|
3370 |
popper.top += offsets[0];
|
|
|
3371 |
popper.left -= offsets[1];
|
|
|
3372 |
} else if (basePlacement === 'right') {
|
|
|
3373 |
popper.top += offsets[0];
|
|
|
3374 |
popper.left += offsets[1];
|
|
|
3375 |
} else if (basePlacement === 'top') {
|
|
|
3376 |
popper.left += offsets[0];
|
|
|
3377 |
popper.top -= offsets[1];
|
|
|
3378 |
} else if (basePlacement === 'bottom') {
|
|
|
3379 |
popper.left += offsets[0];
|
|
|
3380 |
popper.top += offsets[1];
|
|
|
3381 |
}
|
|
|
3382 |
|
|
|
3383 |
data.popper = popper;
|
|
|
3384 |
return data;
|
|
|
3385 |
}
|
|
|
3386 |
|
|
|
3387 |
/**
|
|
|
3388 |
* @function
|
|
|
3389 |
* @memberof Modifiers
|
|
|
3390 |
* @argument {Object} data - The data object generated by `update` method
|
|
|
3391 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
3392 |
* @returns {Object} The data object, properly modified
|
|
|
3393 |
*/
|
|
|
3394 |
function preventOverflow(data, options) {
|
|
|
3395 |
var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
|
|
|
3396 |
|
|
|
3397 |
// If offsetParent is the reference element, we really want to
|
|
|
3398 |
// go one step up and use the next offsetParent as reference to
|
|
|
3399 |
// avoid to make this modifier completely useless and look like broken
|
|
|
3400 |
if (data.instance.reference === boundariesElement) {
|
|
|
3401 |
boundariesElement = getOffsetParent(boundariesElement);
|
|
|
3402 |
}
|
|
|
3403 |
|
|
|
3404 |
// NOTE: DOM access here
|
|
|
3405 |
// resets the popper's position so that the document size can be calculated excluding
|
|
|
3406 |
// the size of the popper element itself
|
|
|
3407 |
var transformProp = getSupportedPropertyName('transform');
|
|
|
3408 |
var popperStyles = data.instance.popper.style; // assignment to help minification
|
|
|
3409 |
var top = popperStyles.top,
|
|
|
3410 |
left = popperStyles.left,
|
|
|
3411 |
transform = popperStyles[transformProp];
|
|
|
3412 |
|
|
|
3413 |
popperStyles.top = '';
|
|
|
3414 |
popperStyles.left = '';
|
|
|
3415 |
popperStyles[transformProp] = '';
|
|
|
3416 |
|
|
|
3417 |
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
|
|
|
3418 |
|
|
|
3419 |
// NOTE: DOM access here
|
|
|
3420 |
// restores the original style properties after the offsets have been computed
|
|
|
3421 |
popperStyles.top = top;
|
|
|
3422 |
popperStyles.left = left;
|
|
|
3423 |
popperStyles[transformProp] = transform;
|
|
|
3424 |
|
|
|
3425 |
options.boundaries = boundaries;
|
|
|
3426 |
|
|
|
3427 |
var order = options.priority;
|
|
|
3428 |
var popper = data.offsets.popper;
|
|
|
3429 |
|
|
|
3430 |
var check = {
|
|
|
3431 |
primary: function primary(placement) {
|
|
|
3432 |
var value = popper[placement];
|
|
|
3433 |
if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
|
|
|
3434 |
value = Math.max(popper[placement], boundaries[placement]);
|
|
|
3435 |
}
|
|
|
3436 |
return defineProperty({}, placement, value);
|
|
|
3437 |
},
|
|
|
3438 |
secondary: function secondary(placement) {
|
|
|
3439 |
var mainSide = placement === 'right' ? 'left' : 'top';
|
|
|
3440 |
var value = popper[mainSide];
|
|
|
3441 |
if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
|
|
|
3442 |
value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
|
|
|
3443 |
}
|
|
|
3444 |
return defineProperty({}, mainSide, value);
|
|
|
3445 |
}
|
|
|
3446 |
};
|
|
|
3447 |
|
|
|
3448 |
order.forEach(function (placement) {
|
|
|
3449 |
var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
|
|
|
3450 |
popper = _extends$1({}, popper, check[side](placement));
|
|
|
3451 |
});
|
|
|
3452 |
|
|
|
3453 |
data.offsets.popper = popper;
|
|
|
3454 |
|
|
|
3455 |
return data;
|
|
|
3456 |
}
|
|
|
3457 |
|
|
|
3458 |
/**
|
|
|
3459 |
* @function
|
|
|
3460 |
* @memberof Modifiers
|
|
|
3461 |
* @argument {Object} data - The data object generated by `update` method
|
|
|
3462 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
3463 |
* @returns {Object} The data object, properly modified
|
|
|
3464 |
*/
|
|
|
3465 |
function shift(data) {
|
|
|
3466 |
var placement = data.placement;
|
|
|
3467 |
var basePlacement = placement.split('-')[0];
|
|
|
3468 |
var shiftvariation = placement.split('-')[1];
|
|
|
3469 |
|
|
|
3470 |
// if shift shiftvariation is specified, run the modifier
|
|
|
3471 |
if (shiftvariation) {
|
|
|
3472 |
var _data$offsets = data.offsets,
|
|
|
3473 |
reference = _data$offsets.reference,
|
|
|
3474 |
popper = _data$offsets.popper;
|
|
|
3475 |
|
|
|
3476 |
var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
|
|
|
3477 |
var side = isVertical ? 'left' : 'top';
|
|
|
3478 |
var measurement = isVertical ? 'width' : 'height';
|
|
|
3479 |
|
|
|
3480 |
var shiftOffsets = {
|
|
|
3481 |
start: defineProperty({}, side, reference[side]),
|
|
|
3482 |
end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
|
|
|
3483 |
};
|
|
|
3484 |
|
|
|
3485 |
data.offsets.popper = _extends$1({}, popper, shiftOffsets[shiftvariation]);
|
|
|
3486 |
}
|
|
|
3487 |
|
|
|
3488 |
return data;
|
|
|
3489 |
}
|
|
|
3490 |
|
|
|
3491 |
/**
|
|
|
3492 |
* @function
|
|
|
3493 |
* @memberof Modifiers
|
|
|
3494 |
* @argument {Object} data - The data object generated by update method
|
|
|
3495 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
3496 |
* @returns {Object} The data object, properly modified
|
|
|
3497 |
*/
|
|
|
3498 |
function hide(data) {
|
|
|
3499 |
if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
|
|
|
3500 |
return data;
|
|
|
3501 |
}
|
|
|
3502 |
|
|
|
3503 |
var refRect = data.offsets.reference;
|
|
|
3504 |
var bound = find(data.instance.modifiers, function (modifier) {
|
|
|
3505 |
return modifier.name === 'preventOverflow';
|
|
|
3506 |
}).boundaries;
|
|
|
3507 |
|
|
|
3508 |
if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
|
|
|
3509 |
// Avoid unnecessary DOM access if visibility hasn't changed
|
|
|
3510 |
if (data.hide === true) {
|
|
|
3511 |
return data;
|
|
|
3512 |
}
|
|
|
3513 |
|
|
|
3514 |
data.hide = true;
|
|
|
3515 |
data.attributes['x-out-of-boundaries'] = '';
|
|
|
3516 |
} else {
|
|
|
3517 |
// Avoid unnecessary DOM access if visibility hasn't changed
|
|
|
3518 |
if (data.hide === false) {
|
|
|
3519 |
return data;
|
|
|
3520 |
}
|
|
|
3521 |
|
|
|
3522 |
data.hide = false;
|
|
|
3523 |
data.attributes['x-out-of-boundaries'] = false;
|
|
|
3524 |
}
|
|
|
3525 |
|
|
|
3526 |
return data;
|
|
|
3527 |
}
|
|
|
3528 |
|
|
|
3529 |
/**
|
|
|
3530 |
* @function
|
|
|
3531 |
* @memberof Modifiers
|
|
|
3532 |
* @argument {Object} data - The data object generated by `update` method
|
|
|
3533 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
3534 |
* @returns {Object} The data object, properly modified
|
|
|
3535 |
*/
|
|
|
3536 |
function inner(data) {
|
|
|
3537 |
var placement = data.placement;
|
|
|
3538 |
var basePlacement = placement.split('-')[0];
|
|
|
3539 |
var _data$offsets = data.offsets,
|
|
|
3540 |
popper = _data$offsets.popper,
|
|
|
3541 |
reference = _data$offsets.reference;
|
|
|
3542 |
|
|
|
3543 |
var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
|
|
|
3544 |
|
|
|
3545 |
var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
|
|
|
3546 |
|
|
|
3547 |
popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
|
|
|
3548 |
|
|
|
3549 |
data.placement = getOppositePlacement(placement);
|
|
|
3550 |
data.offsets.popper = getClientRect(popper);
|
|
|
3551 |
|
|
|
3552 |
return data;
|
|
|
3553 |
}
|
|
|
3554 |
|
|
|
3555 |
/**
|
|
|
3556 |
* Modifier function, each modifier can have a function of this type assigned
|
|
|
3557 |
* to its `fn` property.<br />
|
|
|
3558 |
* These functions will be called on each update, this means that you must
|
|
|
3559 |
* make sure they are performant enough to avoid performance bottlenecks.
|
|
|
3560 |
*
|
|
|
3561 |
* @function ModifierFn
|
|
|
3562 |
* @argument {dataObject} data - The data object generated by `update` method
|
|
|
3563 |
* @argument {Object} options - Modifiers configuration and options
|
|
|
3564 |
* @returns {dataObject} The data object, properly modified
|
|
|
3565 |
*/
|
|
|
3566 |
|
|
|
3567 |
/**
|
|
|
3568 |
* Modifiers are plugins used to alter the behavior of your poppers.<br />
|
|
|
3569 |
* Popper.js uses a set of 9 modifiers to provide all the basic functionalities
|
|
|
3570 |
* needed by the library.
|
|
|
3571 |
*
|
|
|
3572 |
* Usually you don't want to override the `order`, `fn` and `onLoad` props.
|
|
|
3573 |
* All the other properties are configurations that could be tweaked.
|
|
|
3574 |
* @namespace modifiers
|
|
|
3575 |
*/
|
|
|
3576 |
var modifiers = {
|
|
|
3577 |
/**
|
|
|
3578 |
* Modifier used to shift the popper on the start or end of its reference
|
|
|
3579 |
* element.<br />
|
|
|
3580 |
* It will read the variation of the `placement` property.<br />
|
|
|
3581 |
* It can be one either `-end` or `-start`.
|
|
|
3582 |
* @memberof modifiers
|
|
|
3583 |
* @inner
|
|
|
3584 |
*/
|
|
|
3585 |
shift: {
|
|
|
3586 |
/** @prop {number} order=100 - Index used to define the order of execution */
|
|
|
3587 |
order: 100,
|
|
|
3588 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
|
|
3589 |
enabled: true,
|
|
|
3590 |
/** @prop {ModifierFn} */
|
|
|
3591 |
fn: shift
|
|
|
3592 |
},
|
|
|
3593 |
|
|
|
3594 |
/**
|
|
|
3595 |
* The `offset` modifier can shift your popper on both its axis.
|
|
|
3596 |
*
|
|
|
3597 |
* It accepts the following units:
|
|
|
3598 |
* - `px` or unit-less, interpreted as pixels
|
|
|
3599 |
* - `%` or `%r`, percentage relative to the length of the reference element
|
|
|
3600 |
* - `%p`, percentage relative to the length of the popper element
|
|
|
3601 |
* - `vw`, CSS viewport width unit
|
|
|
3602 |
* - `vh`, CSS viewport height unit
|
|
|
3603 |
*
|
|
|
3604 |
* For length is intended the main axis relative to the placement of the popper.<br />
|
|
|
3605 |
* This means that if the placement is `top` or `bottom`, the length will be the
|
|
|
3606 |
* `width`. In case of `left` or `right`, it will be the `height`.
|
|
|
3607 |
*
|
|
|
3608 |
* You can provide a single value (as `Number` or `String`), or a pair of values
|
|
|
3609 |
* as `String` divided by a comma or one (or more) white spaces.<br />
|
|
|
3610 |
* The latter is a deprecated method because it leads to confusion and will be
|
|
|
3611 |
* removed in v2.<br />
|
|
|
3612 |
* Additionally, it accepts additions and subtractions between different units.
|
|
|
3613 |
* Note that multiplications and divisions aren't supported.
|
|
|
3614 |
*
|
|
|
3615 |
* Valid examples are:
|
|
|
3616 |
* ```
|
|
|
3617 |
* 10
|
|
|
3618 |
* '10%'
|
|
|
3619 |
* '10, 10'
|
|
|
3620 |
* '10%, 10'
|
|
|
3621 |
* '10 + 10%'
|
|
|
3622 |
* '10 - 5vh + 3%'
|
|
|
3623 |
* '-10px + 5vh, 5px - 6%'
|
|
|
3624 |
* ```
|
|
|
3625 |
* > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
|
|
|
3626 |
* > with their reference element, unfortunately, you will have to disable the `flip` modifier.
|
|
|
3627 |
* > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
|
|
|
3628 |
*
|
|
|
3629 |
* @memberof modifiers
|
|
|
3630 |
* @inner
|
|
|
3631 |
*/
|
|
|
3632 |
offset: {
|
|
|
3633 |
/** @prop {number} order=200 - Index used to define the order of execution */
|
|
|
3634 |
order: 200,
|
|
|
3635 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
|
|
3636 |
enabled: true,
|
|
|
3637 |
/** @prop {ModifierFn} */
|
|
|
3638 |
fn: offset,
|
|
|
3639 |
/** @prop {Number|String} offset=0
|
|
|
3640 |
* The offset value as described in the modifier description
|
|
|
3641 |
*/
|
|
|
3642 |
offset: 0
|
|
|
3643 |
},
|
|
|
3644 |
|
|
|
3645 |
/**
|
|
|
3646 |
* Modifier used to prevent the popper from being positioned outside the boundary.
|
|
|
3647 |
*
|
|
|
3648 |
* A scenario exists where the reference itself is not within the boundaries.<br />
|
|
|
3649 |
* We can say it has "escaped the boundaries" — or just "escaped".<br />
|
|
|
3650 |
* In this case we need to decide whether the popper should either:
|
|
|
3651 |
*
|
|
|
3652 |
* - detach from the reference and remain "trapped" in the boundaries, or
|
|
|
3653 |
* - if it should ignore the boundary and "escape with its reference"
|
|
|
3654 |
*
|
|
|
3655 |
* When `escapeWithReference` is set to`true` and reference is completely
|
|
|
3656 |
* outside its boundaries, the popper will overflow (or completely leave)
|
|
|
3657 |
* the boundaries in order to remain attached to the edge of the reference.
|
|
|
3658 |
*
|
|
|
3659 |
* @memberof modifiers
|
|
|
3660 |
* @inner
|
|
|
3661 |
*/
|
|
|
3662 |
preventOverflow: {
|
|
|
3663 |
/** @prop {number} order=300 - Index used to define the order of execution */
|
|
|
3664 |
order: 300,
|
|
|
3665 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
|
|
3666 |
enabled: true,
|
|
|
3667 |
/** @prop {ModifierFn} */
|
|
|
3668 |
fn: preventOverflow,
|
|
|
3669 |
/**
|
|
|
3670 |
* @prop {Array} [priority=['left','right','top','bottom']]
|
|
|
3671 |
* Popper will try to prevent overflow following these priorities by default,
|
|
|
3672 |
* then, it could overflow on the left and on top of the `boundariesElement`
|
|
|
3673 |
*/
|
|
|
3674 |
priority: ['left', 'right', 'top', 'bottom'],
|
|
|
3675 |
/**
|
|
|
3676 |
* @prop {number} padding=5
|
|
|
3677 |
* Amount of pixel used to define a minimum distance between the boundaries
|
|
|
3678 |
* and the popper. This makes sure the popper always has a little padding
|
|
|
3679 |
* between the edges of its container
|
|
|
3680 |
*/
|
|
|
3681 |
padding: 5,
|
|
|
3682 |
/**
|
|
|
3683 |
* @prop {String|HTMLElement} boundariesElement='scrollParent'
|
|
|
3684 |
* Boundaries used by the modifier. Can be `scrollParent`, `window`,
|
|
|
3685 |
* `viewport` or any DOM element.
|
|
|
3686 |
*/
|
|
|
3687 |
boundariesElement: 'scrollParent'
|
|
|
3688 |
},
|
|
|
3689 |
|
|
|
3690 |
/**
|
|
|
3691 |
* Modifier used to make sure the reference and its popper stay near each other
|
|
|
3692 |
* without leaving any gap between the two. Especially useful when the arrow is
|
|
|
3693 |
* enabled and you want to ensure that it points to its reference element.
|
|
|
3694 |
* It cares only about the first axis. You can still have poppers with margin
|
|
|
3695 |
* between the popper and its reference element.
|
|
|
3696 |
* @memberof modifiers
|
|
|
3697 |
* @inner
|
|
|
3698 |
*/
|
|
|
3699 |
keepTogether: {
|
|
|
3700 |
/** @prop {number} order=400 - Index used to define the order of execution */
|
|
|
3701 |
order: 400,
|
|
|
3702 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
|
|
3703 |
enabled: true,
|
|
|
3704 |
/** @prop {ModifierFn} */
|
|
|
3705 |
fn: keepTogether
|
|
|
3706 |
},
|
|
|
3707 |
|
|
|
3708 |
/**
|
|
|
3709 |
* This modifier is used to move the `arrowElement` of the popper to make
|
|
|
3710 |
* sure it is positioned between the reference element and its popper element.
|
|
|
3711 |
* It will read the outer size of the `arrowElement` node to detect how many
|
|
|
3712 |
* pixels of conjunction are needed.
|
|
|
3713 |
*
|
|
|
3714 |
* It has no effect if no `arrowElement` is provided.
|
|
|
3715 |
* @memberof modifiers
|
|
|
3716 |
* @inner
|
|
|
3717 |
*/
|
|
|
3718 |
arrow: {
|
|
|
3719 |
/** @prop {number} order=500 - Index used to define the order of execution */
|
|
|
3720 |
order: 500,
|
|
|
3721 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
|
|
3722 |
enabled: true,
|
|
|
3723 |
/** @prop {ModifierFn} */
|
|
|
3724 |
fn: arrow,
|
|
|
3725 |
/** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
|
|
|
3726 |
element: '[x-arrow]'
|
|
|
3727 |
},
|
|
|
3728 |
|
|
|
3729 |
/**
|
|
|
3730 |
* Modifier used to flip the popper's placement when it starts to overlap its
|
|
|
3731 |
* reference element.
|
|
|
3732 |
*
|
|
|
3733 |
* Requires the `preventOverflow` modifier before it in order to work.
|
|
|
3734 |
*
|
|
|
3735 |
* **NOTE:** this modifier will interrupt the current update cycle and will
|
|
|
3736 |
* restart it if it detects the need to flip the placement.
|
|
|
3737 |
* @memberof modifiers
|
|
|
3738 |
* @inner
|
|
|
3739 |
*/
|
|
|
3740 |
flip: {
|
|
|
3741 |
/** @prop {number} order=600 - Index used to define the order of execution */
|
|
|
3742 |
order: 600,
|
|
|
3743 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
|
|
3744 |
enabled: true,
|
|
|
3745 |
/** @prop {ModifierFn} */
|
|
|
3746 |
fn: flip,
|
|
|
3747 |
/**
|
|
|
3748 |
* @prop {String|Array} behavior='flip'
|
|
|
3749 |
* The behavior used to change the popper's placement. It can be one of
|
|
|
3750 |
* `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
|
|
|
3751 |
* placements (with optional variations)
|
|
|
3752 |
*/
|
|
|
3753 |
behavior: 'flip',
|
|
|
3754 |
/**
|
|
|
3755 |
* @prop {number} padding=5
|
|
|
3756 |
* The popper will flip if it hits the edges of the `boundariesElement`
|
|
|
3757 |
*/
|
|
|
3758 |
padding: 5,
|
|
|
3759 |
/**
|
|
|
3760 |
* @prop {String|HTMLElement} boundariesElement='viewport'
|
|
|
3761 |
* The element which will define the boundaries of the popper position.
|
|
|
3762 |
* The popper will never be placed outside of the defined boundaries
|
|
|
3763 |
* (except if `keepTogether` is enabled)
|
|
|
3764 |
*/
|
|
|
3765 |
boundariesElement: 'viewport',
|
|
|
3766 |
/**
|
|
|
3767 |
* @prop {Boolean} flipVariations=false
|
|
|
3768 |
* The popper will switch placement variation between `-start` and `-end` when
|
|
|
3769 |
* the reference element overlaps its boundaries.
|
|
|
3770 |
*
|
|
|
3771 |
* The original placement should have a set variation.
|
|
|
3772 |
*/
|
|
|
3773 |
flipVariations: false,
|
|
|
3774 |
/**
|
|
|
3775 |
* @prop {Boolean} flipVariationsByContent=false
|
|
|
3776 |
* The popper will switch placement variation between `-start` and `-end` when
|
|
|
3777 |
* the popper element overlaps its reference boundaries.
|
|
|
3778 |
*
|
|
|
3779 |
* The original placement should have a set variation.
|
|
|
3780 |
*/
|
|
|
3781 |
flipVariationsByContent: false
|
|
|
3782 |
},
|
|
|
3783 |
|
|
|
3784 |
/**
|
|
|
3785 |
* Modifier used to make the popper flow toward the inner of the reference element.
|
|
|
3786 |
* By default, when this modifier is disabled, the popper will be placed outside
|
|
|
3787 |
* the reference element.
|
|
|
3788 |
* @memberof modifiers
|
|
|
3789 |
* @inner
|
|
|
3790 |
*/
|
|
|
3791 |
inner: {
|
|
|
3792 |
/** @prop {number} order=700 - Index used to define the order of execution */
|
|
|
3793 |
order: 700,
|
|
|
3794 |
/** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
|
|
|
3795 |
enabled: false,
|
|
|
3796 |
/** @prop {ModifierFn} */
|
|
|
3797 |
fn: inner
|
|
|
3798 |
},
|
|
|
3799 |
|
|
|
3800 |
/**
|
|
|
3801 |
* Modifier used to hide the popper when its reference element is outside of the
|
|
|
3802 |
* popper boundaries. It will set a `x-out-of-boundaries` attribute which can
|
|
|
3803 |
* be used to hide with a CSS selector the popper when its reference is
|
|
|
3804 |
* out of boundaries.
|
|
|
3805 |
*
|
|
|
3806 |
* Requires the `preventOverflow` modifier before it in order to work.
|
|
|
3807 |
* @memberof modifiers
|
|
|
3808 |
* @inner
|
|
|
3809 |
*/
|
|
|
3810 |
hide: {
|
|
|
3811 |
/** @prop {number} order=800 - Index used to define the order of execution */
|
|
|
3812 |
order: 800,
|
|
|
3813 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
|
|
3814 |
enabled: true,
|
|
|
3815 |
/** @prop {ModifierFn} */
|
|
|
3816 |
fn: hide
|
|
|
3817 |
},
|
|
|
3818 |
|
|
|
3819 |
/**
|
|
|
3820 |
* Computes the style that will be applied to the popper element to gets
|
|
|
3821 |
* properly positioned.
|
|
|
3822 |
*
|
|
|
3823 |
* Note that this modifier will not touch the DOM, it just prepares the styles
|
|
|
3824 |
* so that `applyStyle` modifier can apply it. This separation is useful
|
|
|
3825 |
* in case you need to replace `applyStyle` with a custom implementation.
|
|
|
3826 |
*
|
|
|
3827 |
* This modifier has `850` as `order` value to maintain backward compatibility
|
|
|
3828 |
* with previous versions of Popper.js. Expect the modifiers ordering method
|
|
|
3829 |
* to change in future major versions of the library.
|
|
|
3830 |
*
|
|
|
3831 |
* @memberof modifiers
|
|
|
3832 |
* @inner
|
|
|
3833 |
*/
|
|
|
3834 |
computeStyle: {
|
|
|
3835 |
/** @prop {number} order=850 - Index used to define the order of execution */
|
|
|
3836 |
order: 850,
|
|
|
3837 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
|
|
3838 |
enabled: true,
|
|
|
3839 |
/** @prop {ModifierFn} */
|
|
|
3840 |
fn: computeStyle,
|
|
|
3841 |
/**
|
|
|
3842 |
* @prop {Boolean} gpuAcceleration=true
|
|
|
3843 |
* If true, it uses the CSS 3D transformation to position the popper.
|
|
|
3844 |
* Otherwise, it will use the `top` and `left` properties
|
|
|
3845 |
*/
|
|
|
3846 |
gpuAcceleration: true,
|
|
|
3847 |
/**
|
|
|
3848 |
* @prop {string} [x='bottom']
|
|
|
3849 |
* Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
|
|
|
3850 |
* Change this if your popper should grow in a direction different from `bottom`
|
|
|
3851 |
*/
|
|
|
3852 |
x: 'bottom',
|
|
|
3853 |
/**
|
|
|
3854 |
* @prop {string} [x='left']
|
|
|
3855 |
* Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
|
|
|
3856 |
* Change this if your popper should grow in a direction different from `right`
|
|
|
3857 |
*/
|
|
|
3858 |
y: 'right'
|
|
|
3859 |
},
|
|
|
3860 |
|
|
|
3861 |
/**
|
|
|
3862 |
* Applies the computed styles to the popper element.
|
|
|
3863 |
*
|
|
|
3864 |
* All the DOM manipulations are limited to this modifier. This is useful in case
|
|
|
3865 |
* you want to integrate Popper.js inside a framework or view library and you
|
|
|
3866 |
* want to delegate all the DOM manipulations to it.
|
|
|
3867 |
*
|
|
|
3868 |
* Note that if you disable this modifier, you must make sure the popper element
|
|
|
3869 |
* has its position set to `absolute` before Popper.js can do its work!
|
|
|
3870 |
*
|
|
|
3871 |
* Just disable this modifier and define your own to achieve the desired effect.
|
|
|
3872 |
*
|
|
|
3873 |
* @memberof modifiers
|
|
|
3874 |
* @inner
|
|
|
3875 |
*/
|
|
|
3876 |
applyStyle: {
|
|
|
3877 |
/** @prop {number} order=900 - Index used to define the order of execution */
|
|
|
3878 |
order: 900,
|
|
|
3879 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
|
|
|
3880 |
enabled: true,
|
|
|
3881 |
/** @prop {ModifierFn} */
|
|
|
3882 |
fn: applyStyle,
|
|
|
3883 |
/** @prop {Function} */
|
|
|
3884 |
onLoad: applyStyleOnLoad,
|
|
|
3885 |
/**
|
|
|
3886 |
* @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
|
|
|
3887 |
* @prop {Boolean} gpuAcceleration=true
|
|
|
3888 |
* If true, it uses the CSS 3D transformation to position the popper.
|
|
|
3889 |
* Otherwise, it will use the `top` and `left` properties
|
|
|
3890 |
*/
|
|
|
3891 |
gpuAcceleration: undefined
|
|
|
3892 |
}
|
|
|
3893 |
};
|
|
|
3894 |
|
|
|
3895 |
/**
|
|
|
3896 |
* The `dataObject` is an object containing all the information used by Popper.js.
|
|
|
3897 |
* This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
|
|
|
3898 |
* @name dataObject
|
|
|
3899 |
* @property {Object} data.instance The Popper.js instance
|
|
|
3900 |
* @property {String} data.placement Placement applied to popper
|
|
|
3901 |
* @property {String} data.originalPlacement Placement originally defined on init
|
|
|
3902 |
* @property {Boolean} data.flipped True if popper has been flipped by flip modifier
|
|
|
3903 |
* @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
|
|
|
3904 |
* @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
|
|
|
3905 |
* @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
|
|
|
3906 |
* @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
|
|
|
3907 |
* @property {Object} data.boundaries Offsets of the popper boundaries
|
|
|
3908 |
* @property {Object} data.offsets The measurements of popper, reference and arrow elements
|
|
|
3909 |
* @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
|
|
|
3910 |
* @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
|
|
|
3911 |
* @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
|
|
|
3912 |
*/
|
|
|
3913 |
|
|
|
3914 |
/**
|
|
|
3915 |
* Default options provided to Popper.js constructor.<br />
|
|
|
3916 |
* These can be overridden using the `options` argument of Popper.js.<br />
|
|
|
3917 |
* To override an option, simply pass an object with the same
|
|
|
3918 |
* structure of the `options` object, as the 3rd argument. For example:
|
|
|
3919 |
* ```
|
|
|
3920 |
* new Popper(ref, pop, {
|
|
|
3921 |
* modifiers: {
|
|
|
3922 |
* preventOverflow: { enabled: false }
|
|
|
3923 |
* }
|
|
|
3924 |
* })
|
|
|
3925 |
* ```
|
|
|
3926 |
* @type {Object}
|
|
|
3927 |
* @static
|
|
|
3928 |
* @memberof Popper
|
|
|
3929 |
*/
|
|
|
3930 |
var Defaults = {
|
|
|
3931 |
/**
|
|
|
3932 |
* Popper's placement.
|
|
|
3933 |
* @prop {Popper.placements} placement='bottom'
|
|
|
3934 |
*/
|
|
|
3935 |
placement: 'bottom',
|
|
|
3936 |
|
|
|
3937 |
/**
|
|
|
3938 |
* Set this to true if you want popper to position it self in 'fixed' mode
|
|
|
3939 |
* @prop {Boolean} positionFixed=false
|
|
|
3940 |
*/
|
|
|
3941 |
positionFixed: false,
|
|
|
3942 |
|
|
|
3943 |
/**
|
|
|
3944 |
* Whether events (resize, scroll) are initially enabled.
|
|
|
3945 |
* @prop {Boolean} eventsEnabled=true
|
|
|
3946 |
*/
|
|
|
3947 |
eventsEnabled: true,
|
|
|
3948 |
|
|
|
3949 |
/**
|
|
|
3950 |
* Set to true if you want to automatically remove the popper when
|
|
|
3951 |
* you call the `destroy` method.
|
|
|
3952 |
* @prop {Boolean} removeOnDestroy=false
|
|
|
3953 |
*/
|
|
|
3954 |
removeOnDestroy: false,
|
|
|
3955 |
|
|
|
3956 |
/**
|
|
|
3957 |
* Callback called when the popper is created.<br />
|
|
|
3958 |
* By default, it is set to no-op.<br />
|
|
|
3959 |
* Access Popper.js instance with `data.instance`.
|
|
|
3960 |
* @prop {onCreate}
|
|
|
3961 |
*/
|
|
|
3962 |
onCreate: function onCreate() {},
|
|
|
3963 |
|
|
|
3964 |
/**
|
|
|
3965 |
* Callback called when the popper is updated. This callback is not called
|
|
|
3966 |
* on the initialization/creation of the popper, but only on subsequent
|
|
|
3967 |
* updates.<br />
|
|
|
3968 |
* By default, it is set to no-op.<br />
|
|
|
3969 |
* Access Popper.js instance with `data.instance`.
|
|
|
3970 |
* @prop {onUpdate}
|
|
|
3971 |
*/
|
|
|
3972 |
onUpdate: function onUpdate() {},
|
|
|
3973 |
|
|
|
3974 |
/**
|
|
|
3975 |
* List of modifiers used to modify the offsets before they are applied to the popper.
|
|
|
3976 |
* They provide most of the functionalities of Popper.js.
|
|
|
3977 |
* @prop {modifiers}
|
|
|
3978 |
*/
|
|
|
3979 |
modifiers: modifiers
|
|
|
3980 |
};
|
|
|
3981 |
|
|
|
3982 |
/**
|
|
|
3983 |
* @callback onCreate
|
|
|
3984 |
* @param {dataObject} data
|
|
|
3985 |
*/
|
|
|
3986 |
|
|
|
3987 |
/**
|
|
|
3988 |
* @callback onUpdate
|
|
|
3989 |
* @param {dataObject} data
|
|
|
3990 |
*/
|
|
|
3991 |
|
|
|
3992 |
// Utils
|
|
|
3993 |
// Methods
|
|
|
3994 |
var Popper = function () {
|
|
|
3995 |
/**
|
|
|
3996 |
* Creates a new Popper.js instance.
|
|
|
3997 |
* @class Popper
|
|
|
3998 |
* @param {Element|referenceObject} reference - The reference element used to position the popper
|
|
|
3999 |
* @param {Element} popper - The HTML / XML element used as the popper
|
|
|
4000 |
* @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
|
|
|
4001 |
* @return {Object} instance - The generated Popper.js instance
|
|
|
4002 |
*/
|
|
|
4003 |
function Popper(reference, popper) {
|
|
|
4004 |
var _this = this;
|
|
|
4005 |
|
|
|
4006 |
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
|
4007 |
classCallCheck(this, Popper);
|
|
|
4008 |
|
|
|
4009 |
this.scheduleUpdate = function () {
|
|
|
4010 |
return requestAnimationFrame(_this.update);
|
|
|
4011 |
};
|
|
|
4012 |
|
|
|
4013 |
// make update() debounced, so that it only runs at most once-per-tick
|
|
|
4014 |
this.update = debounce(this.update.bind(this));
|
|
|
4015 |
|
|
|
4016 |
// with {} we create a new object with the options inside it
|
|
|
4017 |
this.options = _extends$1({}, Popper.Defaults, options);
|
|
|
4018 |
|
|
|
4019 |
// init state
|
|
|
4020 |
this.state = {
|
|
|
4021 |
isDestroyed: false,
|
|
|
4022 |
isCreated: false,
|
|
|
4023 |
scrollParents: []
|
|
|
4024 |
};
|
|
|
4025 |
|
|
|
4026 |
// get reference and popper elements (allow jQuery wrappers)
|
|
|
4027 |
this.reference = reference && reference.jquery ? reference[0] : reference;
|
|
|
4028 |
this.popper = popper && popper.jquery ? popper[0] : popper;
|
|
|
4029 |
|
|
|
4030 |
// Deep merge modifiers options
|
|
|
4031 |
this.options.modifiers = {};
|
|
|
4032 |
Object.keys(_extends$1({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
|
|
|
4033 |
_this.options.modifiers[name] = _extends$1({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
|
|
|
4034 |
});
|
|
|
4035 |
|
|
|
4036 |
// Refactoring modifiers' list (Object => Array)
|
|
|
4037 |
this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
|
|
|
4038 |
return _extends$1({
|
|
|
4039 |
name: name
|
|
|
4040 |
}, _this.options.modifiers[name]);
|
|
|
4041 |
})
|
|
|
4042 |
// sort the modifiers by order
|
|
|
4043 |
.sort(function (a, b) {
|
|
|
4044 |
return a.order - b.order;
|
|
|
4045 |
});
|
|
|
4046 |
|
|
|
4047 |
// modifiers have the ability to execute arbitrary code when Popper.js get inited
|
|
|
4048 |
// such code is executed in the same order of its modifier
|
|
|
4049 |
// they could add new properties to their options configuration
|
|
|
4050 |
// BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
|
|
|
4051 |
this.modifiers.forEach(function (modifierOptions) {
|
|
|
4052 |
if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
|
|
|
4053 |
modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
|
|
|
4054 |
}
|
|
|
4055 |
});
|
|
|
4056 |
|
|
|
4057 |
// fire the first update to position the popper in the right place
|
|
|
4058 |
this.update();
|
|
|
4059 |
|
|
|
4060 |
var eventsEnabled = this.options.eventsEnabled;
|
|
|
4061 |
if (eventsEnabled) {
|
|
|
4062 |
// setup event listeners, they will take care of update the position in specific situations
|
|
|
4063 |
this.enableEventListeners();
|
|
|
4064 |
}
|
|
|
4065 |
|
|
|
4066 |
this.state.eventsEnabled = eventsEnabled;
|
|
|
4067 |
}
|
|
|
4068 |
|
|
|
4069 |
// We can't use class properties because they don't get listed in the
|
|
|
4070 |
// class prototype and break stuff like Sinon stubs
|
|
|
4071 |
|
|
|
4072 |
|
|
|
4073 |
createClass(Popper, [{
|
|
|
4074 |
key: 'update',
|
|
|
4075 |
value: function update$$1() {
|
|
|
4076 |
return update.call(this);
|
|
|
4077 |
}
|
|
|
4078 |
}, {
|
|
|
4079 |
key: 'destroy',
|
|
|
4080 |
value: function destroy$$1() {
|
|
|
4081 |
return destroy.call(this);
|
|
|
4082 |
}
|
|
|
4083 |
}, {
|
|
|
4084 |
key: 'enableEventListeners',
|
|
|
4085 |
value: function enableEventListeners$$1() {
|
|
|
4086 |
return enableEventListeners.call(this);
|
|
|
4087 |
}
|
|
|
4088 |
}, {
|
|
|
4089 |
key: 'disableEventListeners',
|
|
|
4090 |
value: function disableEventListeners$$1() {
|
|
|
4091 |
return disableEventListeners.call(this);
|
|
|
4092 |
}
|
|
|
4093 |
|
|
|
4094 |
/**
|
|
|
4095 |
* Schedules an update. It will run on the next UI update available.
|
|
|
4096 |
* @method scheduleUpdate
|
|
|
4097 |
* @memberof Popper
|
|
|
4098 |
*/
|
|
|
4099 |
|
|
|
4100 |
|
|
|
4101 |
/**
|
|
|
4102 |
* Collection of utilities useful when writing custom modifiers.
|
|
|
4103 |
* Starting from version 1.7, this method is available only if you
|
|
|
4104 |
* include `popper-utils.js` before `popper.js`.
|
|
|
4105 |
*
|
|
|
4106 |
* **DEPRECATION**: This way to access PopperUtils is deprecated
|
|
|
4107 |
* and will be removed in v2! Use the PopperUtils module directly instead.
|
|
|
4108 |
* Due to the high instability of the methods contained in Utils, we can't
|
|
|
4109 |
* guarantee them to follow semver. Use them at your own risk!
|
|
|
4110 |
* @static
|
|
|
4111 |
* @private
|
|
|
4112 |
* @type {Object}
|
|
|
4113 |
* @deprecated since version 1.8
|
|
|
4114 |
* @member Utils
|
|
|
4115 |
* @memberof Popper
|
|
|
4116 |
*/
|
|
|
4117 |
|
|
|
4118 |
}]);
|
|
|
4119 |
return Popper;
|
|
|
4120 |
}();
|
|
|
4121 |
|
|
|
4122 |
/**
|
|
|
4123 |
* The `referenceObject` is an object that provides an interface compatible with Popper.js
|
|
|
4124 |
* and lets you use it as replacement of a real DOM node.<br />
|
|
|
4125 |
* You can use this method to position a popper relatively to a set of coordinates
|
|
|
4126 |
* in case you don't have a DOM node to use as reference.
|
|
|
4127 |
*
|
|
|
4128 |
* ```
|
|
|
4129 |
* new Popper(referenceObject, popperNode);
|
|
|
4130 |
* ```
|
|
|
4131 |
*
|
|
|
4132 |
* NB: This feature isn't supported in Internet Explorer 10.
|
|
|
4133 |
* @name referenceObject
|
|
|
4134 |
* @property {Function} data.getBoundingClientRect
|
|
|
4135 |
* A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
|
|
|
4136 |
* @property {number} data.clientWidth
|
|
|
4137 |
* An ES6 getter that will return the width of the virtual reference element.
|
|
|
4138 |
* @property {number} data.clientHeight
|
|
|
4139 |
* An ES6 getter that will return the height of the virtual reference element.
|
|
|
4140 |
*/
|
|
|
4141 |
|
|
|
4142 |
|
|
|
4143 |
Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
|
|
|
4144 |
Popper.placements = placements;
|
|
|
4145 |
Popper.Defaults = Defaults;
|
|
|
4146 |
|
|
|
4147 |
/**
|
|
|
4148 |
* ------------------------------------------------------------------------
|
|
|
4149 |
* Constants
|
|
|
4150 |
* ------------------------------------------------------------------------
|
|
|
4151 |
*/
|
|
|
4152 |
|
|
|
4153 |
var NAME$4 = 'dropdown';
|
|
|
4154 |
var VERSION$4 = '4.6.0';
|
|
|
4155 |
var DATA_KEY$4 = 'bs.dropdown';
|
|
|
4156 |
var EVENT_KEY$4 = "." + DATA_KEY$4;
|
|
|
4157 |
var DATA_API_KEY$4 = '.data-api';
|
|
|
4158 |
var JQUERY_NO_CONFLICT$4 = $__default['default'].fn[NAME$4];
|
|
|
4159 |
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
|
|
|
4160 |
|
|
|
4161 |
var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
|
|
|
4162 |
|
|
|
4163 |
var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
|
|
|
4164 |
|
|
|
4165 |
var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
|
|
|
4166 |
|
|
|
4167 |
var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
|
|
|
4168 |
|
|
|
4169 |
var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
|
|
|
4170 |
|
|
|
4171 |
var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
|
|
|
4172 |
var EVENT_HIDE$1 = "hide" + EVENT_KEY$4;
|
|
|
4173 |
var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$4;
|
|
|
4174 |
var EVENT_SHOW$1 = "show" + EVENT_KEY$4;
|
|
|
4175 |
var EVENT_SHOWN$1 = "shown" + EVENT_KEY$4;
|
|
|
4176 |
var EVENT_CLICK = "click" + EVENT_KEY$4;
|
|
|
4177 |
var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$4 + DATA_API_KEY$4;
|
|
|
4178 |
var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$4 + DATA_API_KEY$4;
|
|
|
4179 |
var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$4 + DATA_API_KEY$4;
|
|
|
4180 |
var CLASS_NAME_DISABLED = 'disabled';
|
|
|
4181 |
var CLASS_NAME_SHOW$2 = 'show';
|
|
|
4182 |
var CLASS_NAME_DROPUP = 'dropup';
|
|
|
4183 |
var CLASS_NAME_DROPRIGHT = 'dropright';
|
|
|
4184 |
var CLASS_NAME_DROPLEFT = 'dropleft';
|
|
|
4185 |
var CLASS_NAME_MENURIGHT = 'dropdown-menu-right';
|
|
|
4186 |
var CLASS_NAME_POSITION_STATIC = 'position-static';
|
|
|
4187 |
var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]';
|
|
|
4188 |
var SELECTOR_FORM_CHILD = '.dropdown form';
|
|
|
4189 |
var SELECTOR_MENU = '.dropdown-menu';
|
|
|
4190 |
var SELECTOR_NAVBAR_NAV = '.navbar-nav';
|
|
|
4191 |
var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
|
|
|
4192 |
var PLACEMENT_TOP = 'top-start';
|
|
|
4193 |
var PLACEMENT_TOPEND = 'top-end';
|
|
|
4194 |
var PLACEMENT_BOTTOM = 'bottom-start';
|
|
|
4195 |
var PLACEMENT_BOTTOMEND = 'bottom-end';
|
|
|
4196 |
var PLACEMENT_RIGHT = 'right-start';
|
|
|
4197 |
var PLACEMENT_LEFT = 'left-start';
|
|
|
4198 |
var Default$2 = {
|
|
|
4199 |
offset: 0,
|
|
|
4200 |
flip: true,
|
|
|
4201 |
boundary: 'scrollParent',
|
|
|
4202 |
reference: 'toggle',
|
|
|
4203 |
display: 'dynamic',
|
|
|
4204 |
popperConfig: null
|
|
|
4205 |
};
|
|
|
4206 |
var DefaultType$2 = {
|
|
|
4207 |
offset: '(number|string|function)',
|
|
|
4208 |
flip: 'boolean',
|
|
|
4209 |
boundary: '(string|element)',
|
|
|
4210 |
reference: '(string|element)',
|
|
|
4211 |
display: 'string',
|
|
|
4212 |
popperConfig: '(null|object)'
|
|
|
4213 |
};
|
|
|
4214 |
/**
|
|
|
4215 |
* ------------------------------------------------------------------------
|
|
|
4216 |
* Class Definition
|
|
|
4217 |
* ------------------------------------------------------------------------
|
|
|
4218 |
*/
|
|
|
4219 |
|
|
|
4220 |
var Dropdown = /*#__PURE__*/function () {
|
|
|
4221 |
function Dropdown(element, config) {
|
|
|
4222 |
this._element = element;
|
|
|
4223 |
this._popper = null;
|
|
|
4224 |
this._config = this._getConfig(config);
|
|
|
4225 |
this._menu = this._getMenuElement();
|
|
|
4226 |
this._inNavbar = this._detectNavbar();
|
|
|
4227 |
|
|
|
4228 |
this._addEventListeners();
|
|
|
4229 |
} // Getters
|
|
|
4230 |
|
|
|
4231 |
|
|
|
4232 |
var _proto = Dropdown.prototype;
|
|
|
4233 |
|
|
|
4234 |
// Public
|
|
|
4235 |
_proto.toggle = function toggle() {
|
|
|
4236 |
if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED)) {
|
|
|
4237 |
return;
|
|
|
4238 |
}
|
|
|
4239 |
|
|
|
4240 |
var isActive = $__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2);
|
|
|
4241 |
|
|
|
4242 |
Dropdown._clearMenus();
|
|
|
4243 |
|
|
|
4244 |
if (isActive) {
|
|
|
4245 |
return;
|
|
|
4246 |
}
|
|
|
4247 |
|
|
|
4248 |
this.show(true);
|
|
|
4249 |
};
|
|
|
4250 |
|
|
|
4251 |
_proto.show = function show(usePopper) {
|
|
|
4252 |
if (usePopper === void 0) {
|
|
|
4253 |
usePopper = false;
|
|
|
4254 |
}
|
|
|
4255 |
|
|
|
4256 |
if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED) || $__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2)) {
|
|
|
4257 |
return;
|
|
|
4258 |
}
|
|
|
4259 |
|
|
|
4260 |
var relatedTarget = {
|
|
|
4261 |
relatedTarget: this._element
|
|
|
4262 |
};
|
|
|
4263 |
var showEvent = $__default['default'].Event(EVENT_SHOW$1, relatedTarget);
|
|
|
4264 |
|
|
|
4265 |
var parent = Dropdown._getParentFromElement(this._element);
|
|
|
4266 |
|
|
|
4267 |
$__default['default'](parent).trigger(showEvent);
|
|
|
4268 |
|
|
|
4269 |
if (showEvent.isDefaultPrevented()) {
|
|
|
4270 |
return;
|
|
|
4271 |
} // Totally disable Popper for Dropdowns in Navbar
|
|
|
4272 |
|
|
|
4273 |
|
|
|
4274 |
if (!this._inNavbar && usePopper) {
|
|
|
4275 |
/**
|
|
|
4276 |
* Check for Popper dependency
|
|
|
4277 |
* Popper - https://popper.js.org
|
|
|
4278 |
*/
|
|
|
4279 |
if (typeof Popper === 'undefined') {
|
|
|
4280 |
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
|
|
|
4281 |
}
|
|
|
4282 |
|
|
|
4283 |
var referenceElement = this._element;
|
|
|
4284 |
|
|
|
4285 |
if (this._config.reference === 'parent') {
|
|
|
4286 |
referenceElement = parent;
|
|
|
4287 |
} else if (Util.isElement(this._config.reference)) {
|
|
|
4288 |
referenceElement = this._config.reference; // Check if it's jQuery element
|
|
|
4289 |
|
|
|
4290 |
if (typeof this._config.reference.jquery !== 'undefined') {
|
|
|
4291 |
referenceElement = this._config.reference[0];
|
|
|
4292 |
}
|
|
|
4293 |
} // If boundary is not `scrollParent`, then set position to `static`
|
|
|
4294 |
// to allow the menu to "escape" the scroll parent's boundaries
|
|
|
4295 |
// https://github.com/twbs/bootstrap/issues/24251
|
|
|
4296 |
|
|
|
4297 |
|
|
|
4298 |
if (this._config.boundary !== 'scrollParent') {
|
|
|
4299 |
$__default['default'](parent).addClass(CLASS_NAME_POSITION_STATIC);
|
|
|
4300 |
}
|
|
|
4301 |
|
|
|
4302 |
this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
|
|
|
4303 |
} // If this is a touch-enabled device we add extra
|
|
|
4304 |
// empty mouseover listeners to the body's immediate children;
|
|
|
4305 |
// only needed because of broken event delegation on iOS
|
|
|
4306 |
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
|
|
4307 |
|
|
|
4308 |
|
|
|
4309 |
if ('ontouchstart' in document.documentElement && $__default['default'](parent).closest(SELECTOR_NAVBAR_NAV).length === 0) {
|
|
|
4310 |
$__default['default'](document.body).children().on('mouseover', null, $__default['default'].noop);
|
|
|
4311 |
}
|
|
|
4312 |
|
|
|
4313 |
this._element.focus();
|
|
|
4314 |
|
|
|
4315 |
this._element.setAttribute('aria-expanded', true);
|
|
|
4316 |
|
|
|
4317 |
$__default['default'](this._menu).toggleClass(CLASS_NAME_SHOW$2);
|
|
|
4318 |
$__default['default'](parent).toggleClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_SHOWN$1, relatedTarget));
|
|
|
4319 |
};
|
|
|
4320 |
|
|
|
4321 |
_proto.hide = function hide() {
|
|
|
4322 |
if (this._element.disabled || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED) || !$__default['default'](this._menu).hasClass(CLASS_NAME_SHOW$2)) {
|
|
|
4323 |
return;
|
|
|
4324 |
}
|
|
|
4325 |
|
|
|
4326 |
var relatedTarget = {
|
|
|
4327 |
relatedTarget: this._element
|
|
|
4328 |
};
|
|
|
4329 |
var hideEvent = $__default['default'].Event(EVENT_HIDE$1, relatedTarget);
|
|
|
4330 |
|
|
|
4331 |
var parent = Dropdown._getParentFromElement(this._element);
|
|
|
4332 |
|
|
|
4333 |
$__default['default'](parent).trigger(hideEvent);
|
|
|
4334 |
|
|
|
4335 |
if (hideEvent.isDefaultPrevented()) {
|
|
|
4336 |
return;
|
|
|
4337 |
}
|
|
|
4338 |
|
|
|
4339 |
if (this._popper) {
|
|
|
4340 |
this._popper.destroy();
|
|
|
4341 |
}
|
|
|
4342 |
|
|
|
4343 |
$__default['default'](this._menu).toggleClass(CLASS_NAME_SHOW$2);
|
|
|
4344 |
$__default['default'](parent).toggleClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_HIDDEN$1, relatedTarget));
|
|
|
4345 |
};
|
|
|
4346 |
|
|
|
4347 |
_proto.dispose = function dispose() {
|
|
|
4348 |
$__default['default'].removeData(this._element, DATA_KEY$4);
|
|
|
4349 |
$__default['default'](this._element).off(EVENT_KEY$4);
|
|
|
4350 |
this._element = null;
|
|
|
4351 |
this._menu = null;
|
|
|
4352 |
|
|
|
4353 |
if (this._popper !== null) {
|
|
|
4354 |
this._popper.destroy();
|
|
|
4355 |
|
|
|
4356 |
this._popper = null;
|
|
|
4357 |
}
|
|
|
4358 |
};
|
|
|
4359 |
|
|
|
4360 |
_proto.update = function update() {
|
|
|
4361 |
this._inNavbar = this._detectNavbar();
|
|
|
4362 |
|
|
|
4363 |
if (this._popper !== null) {
|
|
|
4364 |
this._popper.scheduleUpdate();
|
|
|
4365 |
}
|
|
|
4366 |
} // Private
|
|
|
4367 |
;
|
|
|
4368 |
|
|
|
4369 |
_proto._addEventListeners = function _addEventListeners() {
|
|
|
4370 |
var _this = this;
|
|
|
4371 |
|
|
|
4372 |
$__default['default'](this._element).on(EVENT_CLICK, function (event) {
|
|
|
4373 |
event.preventDefault();
|
|
|
4374 |
event.stopPropagation();
|
|
|
4375 |
|
|
|
4376 |
_this.toggle();
|
|
|
4377 |
});
|
|
|
4378 |
};
|
|
|
4379 |
|
|
|
4380 |
_proto._getConfig = function _getConfig(config) {
|
|
|
4381 |
config = _extends({}, this.constructor.Default, $__default['default'](this._element).data(), config);
|
|
|
4382 |
Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
|
|
|
4383 |
return config;
|
|
|
4384 |
};
|
|
|
4385 |
|
|
|
4386 |
_proto._getMenuElement = function _getMenuElement() {
|
|
|
4387 |
if (!this._menu) {
|
|
|
4388 |
var parent = Dropdown._getParentFromElement(this._element);
|
|
|
4389 |
|
|
|
4390 |
if (parent) {
|
|
|
4391 |
this._menu = parent.querySelector(SELECTOR_MENU);
|
|
|
4392 |
}
|
|
|
4393 |
}
|
|
|
4394 |
|
|
|
4395 |
return this._menu;
|
|
|
4396 |
};
|
|
|
4397 |
|
|
|
4398 |
_proto._getPlacement = function _getPlacement() {
|
|
|
4399 |
var $parentDropdown = $__default['default'](this._element.parentNode);
|
|
|
4400 |
var placement = PLACEMENT_BOTTOM; // Handle dropup
|
|
|
4401 |
|
|
|
4402 |
if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) {
|
|
|
4403 |
placement = $__default['default'](this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
|
|
|
4404 |
} else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) {
|
|
|
4405 |
placement = PLACEMENT_RIGHT;
|
|
|
4406 |
} else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) {
|
|
|
4407 |
placement = PLACEMENT_LEFT;
|
|
|
4408 |
} else if ($__default['default'](this._menu).hasClass(CLASS_NAME_MENURIGHT)) {
|
|
|
4409 |
placement = PLACEMENT_BOTTOMEND;
|
|
|
4410 |
}
|
|
|
4411 |
|
|
|
4412 |
return placement;
|
|
|
4413 |
};
|
|
|
4414 |
|
|
|
4415 |
_proto._detectNavbar = function _detectNavbar() {
|
|
|
4416 |
return $__default['default'](this._element).closest('.navbar').length > 0;
|
|
|
4417 |
};
|
|
|
4418 |
|
|
|
4419 |
_proto._getOffset = function _getOffset() {
|
|
|
4420 |
var _this2 = this;
|
|
|
4421 |
|
|
|
4422 |
var offset = {};
|
|
|
4423 |
|
|
|
4424 |
if (typeof this._config.offset === 'function') {
|
|
|
4425 |
offset.fn = function (data) {
|
|
|
4426 |
data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
|
|
|
4427 |
return data;
|
|
|
4428 |
};
|
|
|
4429 |
} else {
|
|
|
4430 |
offset.offset = this._config.offset;
|
|
|
4431 |
}
|
|
|
4432 |
|
|
|
4433 |
return offset;
|
|
|
4434 |
};
|
|
|
4435 |
|
|
|
4436 |
_proto._getPopperConfig = function _getPopperConfig() {
|
|
|
4437 |
var popperConfig = {
|
|
|
4438 |
placement: this._getPlacement(),
|
|
|
4439 |
modifiers: {
|
|
|
4440 |
offset: this._getOffset(),
|
|
|
4441 |
flip: {
|
|
|
4442 |
enabled: this._config.flip
|
|
|
4443 |
},
|
|
|
4444 |
preventOverflow: {
|
|
|
4445 |
boundariesElement: this._config.boundary
|
|
|
4446 |
}
|
|
|
4447 |
}
|
|
|
4448 |
}; // Disable Popper if we have a static display
|
|
|
4449 |
|
|
|
4450 |
if (this._config.display === 'static') {
|
|
|
4451 |
popperConfig.modifiers.applyStyle = {
|
|
|
4452 |
enabled: false
|
|
|
4453 |
};
|
|
|
4454 |
}
|
|
|
4455 |
|
|
|
4456 |
return _extends({}, popperConfig, this._config.popperConfig);
|
|
|
4457 |
} // Static
|
|
|
4458 |
;
|
|
|
4459 |
|
|
|
4460 |
Dropdown._jQueryInterface = function _jQueryInterface(config) {
|
|
|
4461 |
return this.each(function () {
|
|
|
4462 |
var data = $__default['default'](this).data(DATA_KEY$4);
|
|
|
4463 |
|
|
|
4464 |
var _config = typeof config === 'object' ? config : null;
|
|
|
4465 |
|
|
|
4466 |
if (!data) {
|
|
|
4467 |
data = new Dropdown(this, _config);
|
|
|
4468 |
$__default['default'](this).data(DATA_KEY$4, data);
|
|
|
4469 |
}
|
|
|
4470 |
|
|
|
4471 |
if (typeof config === 'string') {
|
|
|
4472 |
if (typeof data[config] === 'undefined') {
|
|
|
4473 |
throw new TypeError("No method named \"" + config + "\"");
|
|
|
4474 |
}
|
|
|
4475 |
|
|
|
4476 |
data[config]();
|
|
|
4477 |
}
|
|
|
4478 |
});
|
|
|
4479 |
};
|
|
|
4480 |
|
|
|
4481 |
Dropdown._clearMenus = function _clearMenus(event) {
|
|
|
4482 |
if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
|
|
|
4483 |
return;
|
|
|
4484 |
}
|
|
|
4485 |
|
|
|
4486 |
var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2));
|
|
|
4487 |
|
|
|
4488 |
for (var i = 0, len = toggles.length; i < len; i++) {
|
|
|
4489 |
var parent = Dropdown._getParentFromElement(toggles[i]);
|
|
|
4490 |
|
|
|
4491 |
var context = $__default['default'](toggles[i]).data(DATA_KEY$4);
|
|
|
4492 |
var relatedTarget = {
|
|
|
4493 |
relatedTarget: toggles[i]
|
|
|
4494 |
};
|
|
|
4495 |
|
|
|
4496 |
if (event && event.type === 'click') {
|
|
|
4497 |
relatedTarget.clickEvent = event;
|
|
|
4498 |
}
|
|
|
4499 |
|
|
|
4500 |
if (!context) {
|
|
|
4501 |
continue;
|
|
|
4502 |
}
|
|
|
4503 |
|
|
|
4504 |
var dropdownMenu = context._menu;
|
|
|
4505 |
|
|
|
4506 |
if (!$__default['default'](parent).hasClass(CLASS_NAME_SHOW$2)) {
|
|
|
4507 |
continue;
|
|
|
4508 |
}
|
|
|
4509 |
|
|
|
4510 |
if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $__default['default'].contains(parent, event.target)) {
|
|
|
4511 |
continue;
|
|
|
4512 |
}
|
|
|
4513 |
|
|
|
4514 |
var hideEvent = $__default['default'].Event(EVENT_HIDE$1, relatedTarget);
|
|
|
4515 |
$__default['default'](parent).trigger(hideEvent);
|
|
|
4516 |
|
|
|
4517 |
if (hideEvent.isDefaultPrevented()) {
|
|
|
4518 |
continue;
|
|
|
4519 |
} // If this is a touch-enabled device we remove the extra
|
|
|
4520 |
// empty mouseover listeners we added for iOS support
|
|
|
4521 |
|
|
|
4522 |
|
|
|
4523 |
if ('ontouchstart' in document.documentElement) {
|
|
|
4524 |
$__default['default'](document.body).children().off('mouseover', null, $__default['default'].noop);
|
|
|
4525 |
}
|
|
|
4526 |
|
|
|
4527 |
toggles[i].setAttribute('aria-expanded', 'false');
|
|
|
4528 |
|
|
|
4529 |
if (context._popper) {
|
|
|
4530 |
context._popper.destroy();
|
|
|
4531 |
}
|
|
|
4532 |
|
|
|
4533 |
$__default['default'](dropdownMenu).removeClass(CLASS_NAME_SHOW$2);
|
|
|
4534 |
$__default['default'](parent).removeClass(CLASS_NAME_SHOW$2).trigger($__default['default'].Event(EVENT_HIDDEN$1, relatedTarget));
|
|
|
4535 |
}
|
|
|
4536 |
};
|
|
|
4537 |
|
|
|
4538 |
Dropdown._getParentFromElement = function _getParentFromElement(element) {
|
|
|
4539 |
var parent;
|
|
|
4540 |
var selector = Util.getSelectorFromElement(element);
|
|
|
4541 |
|
|
|
4542 |
if (selector) {
|
|
|
4543 |
parent = document.querySelector(selector);
|
|
|
4544 |
}
|
|
|
4545 |
|
|
|
4546 |
return parent || element.parentNode;
|
|
|
4547 |
} // eslint-disable-next-line complexity
|
|
|
4548 |
;
|
|
|
4549 |
|
|
|
4550 |
Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
|
|
|
4551 |
// If not input/textarea:
|
|
|
4552 |
// - And not a key in REGEXP_KEYDOWN => not a dropdown command
|
|
|
4553 |
// If input/textarea:
|
|
|
4554 |
// - If space key => not a dropdown command
|
|
|
4555 |
// - If key is other than escape
|
|
|
4556 |
// - If key is not up or down => not a dropdown command
|
|
|
4557 |
// - If trigger inside the menu => not a dropdown command
|
|
|
4558 |
if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $__default['default'](event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
|
|
|
4559 |
return;
|
|
|
4560 |
}
|
|
|
4561 |
|
|
|
4562 |
if (this.disabled || $__default['default'](this).hasClass(CLASS_NAME_DISABLED)) {
|
|
|
4563 |
return;
|
|
|
4564 |
}
|
|
|
4565 |
|
|
|
4566 |
var parent = Dropdown._getParentFromElement(this);
|
|
|
4567 |
|
|
|
4568 |
var isActive = $__default['default'](parent).hasClass(CLASS_NAME_SHOW$2);
|
|
|
4569 |
|
|
|
4570 |
if (!isActive && event.which === ESCAPE_KEYCODE) {
|
|
|
4571 |
return;
|
|
|
4572 |
}
|
|
|
4573 |
|
|
|
4574 |
event.preventDefault();
|
|
|
4575 |
event.stopPropagation();
|
|
|
4576 |
|
|
|
4577 |
if (!isActive || event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE) {
|
|
|
4578 |
if (event.which === ESCAPE_KEYCODE) {
|
|
|
4579 |
$__default['default'](parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus');
|
|
|
4580 |
}
|
|
|
4581 |
|
|
|
4582 |
$__default['default'](this).trigger('click');
|
|
|
4583 |
return;
|
|
|
4584 |
}
|
|
|
4585 |
|
|
|
4586 |
var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) {
|
|
|
4587 |
return $__default['default'](item).is(':visible');
|
|
|
4588 |
});
|
|
|
4589 |
|
|
|
4590 |
if (items.length === 0) {
|
|
|
4591 |
return;
|
|
|
4592 |
}
|
|
|
4593 |
|
|
|
4594 |
var index = items.indexOf(event.target);
|
|
|
4595 |
|
|
|
4596 |
if (event.which === ARROW_UP_KEYCODE && index > 0) {
|
|
|
4597 |
// Up
|
|
|
4598 |
index--;
|
|
|
4599 |
}
|
|
|
4600 |
|
|
|
4601 |
if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
|
|
|
4602 |
// Down
|
|
|
4603 |
index++;
|
|
|
4604 |
}
|
|
|
4605 |
|
|
|
4606 |
if (index < 0) {
|
|
|
4607 |
index = 0;
|
|
|
4608 |
}
|
|
|
4609 |
|
|
|
4610 |
items[index].focus();
|
|
|
4611 |
};
|
|
|
4612 |
|
|
|
4613 |
_createClass(Dropdown, null, [{
|
|
|
4614 |
key: "VERSION",
|
|
|
4615 |
get: function get() {
|
|
|
4616 |
return VERSION$4;
|
|
|
4617 |
}
|
|
|
4618 |
}, {
|
|
|
4619 |
key: "Default",
|
|
|
4620 |
get: function get() {
|
|
|
4621 |
return Default$2;
|
|
|
4622 |
}
|
|
|
4623 |
}, {
|
|
|
4624 |
key: "DefaultType",
|
|
|
4625 |
get: function get() {
|
|
|
4626 |
return DefaultType$2;
|
|
|
4627 |
}
|
|
|
4628 |
}]);
|
|
|
4629 |
|
|
|
4630 |
return Dropdown;
|
|
|
4631 |
}();
|
|
|
4632 |
/**
|
|
|
4633 |
* ------------------------------------------------------------------------
|
|
|
4634 |
* Data Api implementation
|
|
|
4635 |
* ------------------------------------------------------------------------
|
|
|
4636 |
*/
|
|
|
4637 |
|
|
|
4638 |
|
|
|
4639 |
$__default['default'](document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$4 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$2, function (event) {
|
|
|
4640 |
event.preventDefault();
|
|
|
4641 |
event.stopPropagation();
|
|
|
4642 |
|
|
|
4643 |
Dropdown._jQueryInterface.call($__default['default'](this), 'toggle');
|
|
|
4644 |
}).on(EVENT_CLICK_DATA_API$4, SELECTOR_FORM_CHILD, function (e) {
|
|
|
4645 |
e.stopPropagation();
|
|
|
4646 |
});
|
|
|
4647 |
/**
|
|
|
4648 |
* ------------------------------------------------------------------------
|
|
|
4649 |
* jQuery
|
|
|
4650 |
* ------------------------------------------------------------------------
|
|
|
4651 |
*/
|
|
|
4652 |
|
|
|
4653 |
$__default['default'].fn[NAME$4] = Dropdown._jQueryInterface;
|
|
|
4654 |
$__default['default'].fn[NAME$4].Constructor = Dropdown;
|
|
|
4655 |
|
|
|
4656 |
$__default['default'].fn[NAME$4].noConflict = function () {
|
|
|
4657 |
$__default['default'].fn[NAME$4] = JQUERY_NO_CONFLICT$4;
|
|
|
4658 |
return Dropdown._jQueryInterface;
|
|
|
4659 |
};
|
|
|
4660 |
|
|
|
4661 |
/**
|
|
|
4662 |
* ------------------------------------------------------------------------
|
|
|
4663 |
* Constants
|
|
|
4664 |
* ------------------------------------------------------------------------
|
|
|
4665 |
*/
|
|
|
4666 |
|
|
|
4667 |
var NAME$5 = 'modal';
|
|
|
4668 |
var VERSION$5 = '4.6.0';
|
|
|
4669 |
var DATA_KEY$5 = 'bs.modal';
|
|
|
4670 |
var EVENT_KEY$5 = "." + DATA_KEY$5;
|
|
|
4671 |
var DATA_API_KEY$5 = '.data-api';
|
|
|
4672 |
var JQUERY_NO_CONFLICT$5 = $__default['default'].fn[NAME$5];
|
|
|
4673 |
var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
|
|
|
4674 |
|
|
|
4675 |
var Default$3 = {
|
|
|
4676 |
backdrop: true,
|
|
|
4677 |
keyboard: true,
|
|
|
4678 |
focus: true,
|
|
|
4679 |
show: true
|
|
|
4680 |
};
|
|
|
4681 |
var DefaultType$3 = {
|
|
|
4682 |
backdrop: '(boolean|string)',
|
|
|
4683 |
keyboard: 'boolean',
|
|
|
4684 |
focus: 'boolean',
|
|
|
4685 |
show: 'boolean'
|
|
|
4686 |
};
|
|
|
4687 |
var EVENT_HIDE$2 = "hide" + EVENT_KEY$5;
|
|
|
4688 |
var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5;
|
|
|
4689 |
var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5;
|
|
|
4690 |
var EVENT_SHOW$2 = "show" + EVENT_KEY$5;
|
|
|
4691 |
var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5;
|
|
|
4692 |
var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5;
|
|
|
4693 |
var EVENT_RESIZE = "resize" + EVENT_KEY$5;
|
|
|
4694 |
var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY$5;
|
|
|
4695 |
var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5;
|
|
|
4696 |
var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5;
|
|
|
4697 |
var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5;
|
|
|
4698 |
var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$5 + DATA_API_KEY$5;
|
|
|
4699 |
var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable';
|
|
|
4700 |
var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
|
|
|
4701 |
var CLASS_NAME_BACKDROP = 'modal-backdrop';
|
|
|
4702 |
var CLASS_NAME_OPEN = 'modal-open';
|
|
|
4703 |
var CLASS_NAME_FADE$1 = 'fade';
|
|
|
4704 |
var CLASS_NAME_SHOW$3 = 'show';
|
|
|
4705 |
var CLASS_NAME_STATIC = 'modal-static';
|
|
|
4706 |
var SELECTOR_DIALOG = '.modal-dialog';
|
|
|
4707 |
var SELECTOR_MODAL_BODY = '.modal-body';
|
|
|
4708 |
var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="modal"]';
|
|
|
4709 |
var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
|
|
|
4710 |
var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
|
|
|
4711 |
var SELECTOR_STICKY_CONTENT = '.sticky-top';
|
|
|
4712 |
/**
|
|
|
4713 |
* ------------------------------------------------------------------------
|
|
|
4714 |
* Class Definition
|
|
|
4715 |
* ------------------------------------------------------------------------
|
|
|
4716 |
*/
|
|
|
4717 |
|
|
|
4718 |
var Modal = /*#__PURE__*/function () {
|
|
|
4719 |
function Modal(element, config) {
|
|
|
4720 |
this._config = this._getConfig(config);
|
|
|
4721 |
this._element = element;
|
|
|
4722 |
this._dialog = element.querySelector(SELECTOR_DIALOG);
|
|
|
4723 |
this._backdrop = null;
|
|
|
4724 |
this._isShown = false;
|
|
|
4725 |
this._isBodyOverflowing = false;
|
|
|
4726 |
this._ignoreBackdropClick = false;
|
|
|
4727 |
this._isTransitioning = false;
|
|
|
4728 |
this._scrollbarWidth = 0;
|
|
|
4729 |
} // Getters
|
|
|
4730 |
|
|
|
4731 |
|
|
|
4732 |
var _proto = Modal.prototype;
|
|
|
4733 |
|
|
|
4734 |
// Public
|
|
|
4735 |
_proto.toggle = function toggle(relatedTarget) {
|
|
|
4736 |
return this._isShown ? this.hide() : this.show(relatedTarget);
|
|
|
4737 |
};
|
|
|
4738 |
|
|
|
4739 |
_proto.show = function show(relatedTarget) {
|
|
|
4740 |
var _this = this;
|
|
|
4741 |
|
|
|
4742 |
if (this._isShown || this._isTransitioning) {
|
|
|
4743 |
return;
|
|
|
4744 |
}
|
|
|
4745 |
|
|
|
4746 |
if ($__default['default'](this._element).hasClass(CLASS_NAME_FADE$1)) {
|
|
|
4747 |
this._isTransitioning = true;
|
|
|
4748 |
}
|
|
|
4749 |
|
|
|
4750 |
var showEvent = $__default['default'].Event(EVENT_SHOW$2, {
|
|
|
4751 |
relatedTarget: relatedTarget
|
|
|
4752 |
});
|
|
|
4753 |
$__default['default'](this._element).trigger(showEvent);
|
|
|
4754 |
|
|
|
4755 |
if (this._isShown || showEvent.isDefaultPrevented()) {
|
|
|
4756 |
return;
|
|
|
4757 |
}
|
|
|
4758 |
|
|
|
4759 |
this._isShown = true;
|
|
|
4760 |
|
|
|
4761 |
this._checkScrollbar();
|
|
|
4762 |
|
|
|
4763 |
this._setScrollbar();
|
|
|
4764 |
|
|
|
4765 |
this._adjustDialog();
|
|
|
4766 |
|
|
|
4767 |
this._setEscapeEvent();
|
|
|
4768 |
|
|
|
4769 |
this._setResizeEvent();
|
|
|
4770 |
|
|
|
4771 |
$__default['default'](this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
|
|
|
4772 |
return _this.hide(event);
|
|
|
4773 |
});
|
|
|
4774 |
$__default['default'](this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () {
|
|
|
4775 |
$__default['default'](_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) {
|
|
|
4776 |
if ($__default['default'](event.target).is(_this._element)) {
|
|
|
4777 |
_this._ignoreBackdropClick = true;
|
|
|
4778 |
}
|
|
|
4779 |
});
|
|
|
4780 |
});
|
|
|
4781 |
|
|
|
4782 |
this._showBackdrop(function () {
|
|
|
4783 |
return _this._showElement(relatedTarget);
|
|
|
4784 |
});
|
|
|
4785 |
};
|
|
|
4786 |
|
|
|
4787 |
_proto.hide = function hide(event) {
|
|
|
4788 |
var _this2 = this;
|
|
|
4789 |
|
|
|
4790 |
if (event) {
|
|
|
4791 |
event.preventDefault();
|
|
|
4792 |
}
|
|
|
4793 |
|
|
|
4794 |
if (!this._isShown || this._isTransitioning) {
|
|
|
4795 |
return;
|
|
|
4796 |
}
|
|
|
4797 |
|
|
|
4798 |
var hideEvent = $__default['default'].Event(EVENT_HIDE$2);
|
|
|
4799 |
$__default['default'](this._element).trigger(hideEvent);
|
|
|
4800 |
|
|
|
4801 |
if (!this._isShown || hideEvent.isDefaultPrevented()) {
|
|
|
4802 |
return;
|
|
|
4803 |
}
|
|
|
4804 |
|
|
|
4805 |
this._isShown = false;
|
|
|
4806 |
var transition = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1);
|
|
|
4807 |
|
|
|
4808 |
if (transition) {
|
|
|
4809 |
this._isTransitioning = true;
|
|
|
4810 |
}
|
|
|
4811 |
|
|
|
4812 |
this._setEscapeEvent();
|
|
|
4813 |
|
|
|
4814 |
this._setResizeEvent();
|
|
|
4815 |
|
|
|
4816 |
$__default['default'](document).off(EVENT_FOCUSIN);
|
|
|
4817 |
$__default['default'](this._element).removeClass(CLASS_NAME_SHOW$3);
|
|
|
4818 |
$__default['default'](this._element).off(EVENT_CLICK_DISMISS);
|
|
|
4819 |
$__default['default'](this._dialog).off(EVENT_MOUSEDOWN_DISMISS);
|
|
|
4820 |
|
|
|
4821 |
if (transition) {
|
|
|
4822 |
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
|
|
4823 |
$__default['default'](this._element).one(Util.TRANSITION_END, function (event) {
|
|
|
4824 |
return _this2._hideModal(event);
|
|
|
4825 |
}).emulateTransitionEnd(transitionDuration);
|
|
|
4826 |
} else {
|
|
|
4827 |
this._hideModal();
|
|
|
4828 |
}
|
|
|
4829 |
};
|
|
|
4830 |
|
|
|
4831 |
_proto.dispose = function dispose() {
|
|
|
4832 |
[window, this._element, this._dialog].forEach(function (htmlElement) {
|
|
|
4833 |
return $__default['default'](htmlElement).off(EVENT_KEY$5);
|
|
|
4834 |
});
|
|
|
4835 |
/**
|
|
|
4836 |
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
|
|
4837 |
* Do not move `document` in `htmlElements` array
|
|
|
4838 |
* It will remove `EVENT_CLICK_DATA_API` event that should remain
|
|
|
4839 |
*/
|
|
|
4840 |
|
|
|
4841 |
$__default['default'](document).off(EVENT_FOCUSIN);
|
|
|
4842 |
$__default['default'].removeData(this._element, DATA_KEY$5);
|
|
|
4843 |
this._config = null;
|
|
|
4844 |
this._element = null;
|
|
|
4845 |
this._dialog = null;
|
|
|
4846 |
this._backdrop = null;
|
|
|
4847 |
this._isShown = null;
|
|
|
4848 |
this._isBodyOverflowing = null;
|
|
|
4849 |
this._ignoreBackdropClick = null;
|
|
|
4850 |
this._isTransitioning = null;
|
|
|
4851 |
this._scrollbarWidth = null;
|
|
|
4852 |
};
|
|
|
4853 |
|
|
|
4854 |
_proto.handleUpdate = function handleUpdate() {
|
|
|
4855 |
this._adjustDialog();
|
|
|
4856 |
} // Private
|
|
|
4857 |
;
|
|
|
4858 |
|
|
|
4859 |
_proto._getConfig = function _getConfig(config) {
|
|
|
4860 |
config = _extends({}, Default$3, config);
|
|
|
4861 |
Util.typeCheckConfig(NAME$5, config, DefaultType$3);
|
|
|
4862 |
return config;
|
|
|
4863 |
};
|
|
|
4864 |
|
|
|
4865 |
_proto._triggerBackdropTransition = function _triggerBackdropTransition() {
|
|
|
4866 |
var _this3 = this;
|
|
|
4867 |
|
|
|
4868 |
var hideEventPrevented = $__default['default'].Event(EVENT_HIDE_PREVENTED);
|
|
|
4869 |
$__default['default'](this._element).trigger(hideEventPrevented);
|
|
|
4870 |
|
|
|
4871 |
if (hideEventPrevented.isDefaultPrevented()) {
|
|
|
4872 |
return;
|
|
|
4873 |
}
|
|
|
4874 |
|
|
|
4875 |
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
|
|
4876 |
|
|
|
4877 |
if (!isModalOverflowing) {
|
|
|
4878 |
this._element.style.overflowY = 'hidden';
|
|
|
4879 |
}
|
|
|
4880 |
|
|
|
4881 |
this._element.classList.add(CLASS_NAME_STATIC);
|
|
|
4882 |
|
|
|
4883 |
var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog);
|
|
|
4884 |
$__default['default'](this._element).off(Util.TRANSITION_END);
|
|
|
4885 |
$__default['default'](this._element).one(Util.TRANSITION_END, function () {
|
|
|
4886 |
_this3._element.classList.remove(CLASS_NAME_STATIC);
|
|
|
4887 |
|
|
|
4888 |
if (!isModalOverflowing) {
|
|
|
4889 |
$__default['default'](_this3._element).one(Util.TRANSITION_END, function () {
|
|
|
4890 |
_this3._element.style.overflowY = '';
|
|
|
4891 |
}).emulateTransitionEnd(_this3._element, modalTransitionDuration);
|
|
|
4892 |
}
|
|
|
4893 |
}).emulateTransitionEnd(modalTransitionDuration);
|
|
|
4894 |
|
|
|
4895 |
this._element.focus();
|
|
|
4896 |
};
|
|
|
4897 |
|
|
|
4898 |
_proto._showElement = function _showElement(relatedTarget) {
|
|
|
4899 |
var _this4 = this;
|
|
|
4900 |
|
|
|
4901 |
var transition = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1);
|
|
|
4902 |
var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null;
|
|
|
4903 |
|
|
|
4904 |
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
|
|
4905 |
// Don't move modal's DOM position
|
|
|
4906 |
document.body.appendChild(this._element);
|
|
|
4907 |
}
|
|
|
4908 |
|
|
|
4909 |
this._element.style.display = 'block';
|
|
|
4910 |
|
|
|
4911 |
this._element.removeAttribute('aria-hidden');
|
|
|
4912 |
|
|
|
4913 |
this._element.setAttribute('aria-modal', true);
|
|
|
4914 |
|
|
|
4915 |
this._element.setAttribute('role', 'dialog');
|
|
|
4916 |
|
|
|
4917 |
if ($__default['default'](this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
|
|
|
4918 |
modalBody.scrollTop = 0;
|
|
|
4919 |
} else {
|
|
|
4920 |
this._element.scrollTop = 0;
|
|
|
4921 |
}
|
|
|
4922 |
|
|
|
4923 |
if (transition) {
|
|
|
4924 |
Util.reflow(this._element);
|
|
|
4925 |
}
|
|
|
4926 |
|
|
|
4927 |
$__default['default'](this._element).addClass(CLASS_NAME_SHOW$3);
|
|
|
4928 |
|
|
|
4929 |
if (this._config.focus) {
|
|
|
4930 |
this._enforceFocus();
|
|
|
4931 |
}
|
|
|
4932 |
|
|
|
4933 |
var shownEvent = $__default['default'].Event(EVENT_SHOWN$2, {
|
|
|
4934 |
relatedTarget: relatedTarget
|
|
|
4935 |
});
|
|
|
4936 |
|
|
|
4937 |
var transitionComplete = function transitionComplete() {
|
|
|
4938 |
if (_this4._config.focus) {
|
|
|
4939 |
_this4._element.focus();
|
|
|
4940 |
}
|
|
|
4941 |
|
|
|
4942 |
_this4._isTransitioning = false;
|
|
|
4943 |
$__default['default'](_this4._element).trigger(shownEvent);
|
|
|
4944 |
};
|
|
|
4945 |
|
|
|
4946 |
if (transition) {
|
|
|
4947 |
var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
|
|
|
4948 |
$__default['default'](this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
|
|
|
4949 |
} else {
|
|
|
4950 |
transitionComplete();
|
|
|
4951 |
}
|
|
|
4952 |
};
|
|
|
4953 |
|
|
|
4954 |
_proto._enforceFocus = function _enforceFocus() {
|
|
|
4955 |
var _this5 = this;
|
|
|
4956 |
|
|
|
4957 |
$__default['default'](document).off(EVENT_FOCUSIN) // Guard against infinite focus loop
|
|
|
4958 |
.on(EVENT_FOCUSIN, function (event) {
|
|
|
4959 |
if (document !== event.target && _this5._element !== event.target && $__default['default'](_this5._element).has(event.target).length === 0) {
|
|
|
4960 |
_this5._element.focus();
|
|
|
4961 |
}
|
|
|
4962 |
});
|
|
|
4963 |
};
|
|
|
4964 |
|
|
|
4965 |
_proto._setEscapeEvent = function _setEscapeEvent() {
|
|
|
4966 |
var _this6 = this;
|
|
|
4967 |
|
|
|
4968 |
if (this._isShown) {
|
|
|
4969 |
$__default['default'](this._element).on(EVENT_KEYDOWN_DISMISS, function (event) {
|
|
|
4970 |
if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
|
|
|
4971 |
event.preventDefault();
|
|
|
4972 |
|
|
|
4973 |
_this6.hide();
|
|
|
4974 |
} else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE$1) {
|
|
|
4975 |
_this6._triggerBackdropTransition();
|
|
|
4976 |
}
|
|
|
4977 |
});
|
|
|
4978 |
} else if (!this._isShown) {
|
|
|
4979 |
$__default['default'](this._element).off(EVENT_KEYDOWN_DISMISS);
|
|
|
4980 |
}
|
|
|
4981 |
};
|
|
|
4982 |
|
|
|
4983 |
_proto._setResizeEvent = function _setResizeEvent() {
|
|
|
4984 |
var _this7 = this;
|
|
|
4985 |
|
|
|
4986 |
if (this._isShown) {
|
|
|
4987 |
$__default['default'](window).on(EVENT_RESIZE, function (event) {
|
|
|
4988 |
return _this7.handleUpdate(event);
|
|
|
4989 |
});
|
|
|
4990 |
} else {
|
|
|
4991 |
$__default['default'](window).off(EVENT_RESIZE);
|
|
|
4992 |
}
|
|
|
4993 |
};
|
|
|
4994 |
|
|
|
4995 |
_proto._hideModal = function _hideModal() {
|
|
|
4996 |
var _this8 = this;
|
|
|
4997 |
|
|
|
4998 |
this._element.style.display = 'none';
|
|
|
4999 |
|
|
|
5000 |
this._element.setAttribute('aria-hidden', true);
|
|
|
5001 |
|
|
|
5002 |
this._element.removeAttribute('aria-modal');
|
|
|
5003 |
|
|
|
5004 |
this._element.removeAttribute('role');
|
|
|
5005 |
|
|
|
5006 |
this._isTransitioning = false;
|
|
|
5007 |
|
|
|
5008 |
this._showBackdrop(function () {
|
|
|
5009 |
$__default['default'](document.body).removeClass(CLASS_NAME_OPEN);
|
|
|
5010 |
|
|
|
5011 |
_this8._resetAdjustments();
|
|
|
5012 |
|
|
|
5013 |
_this8._resetScrollbar();
|
|
|
5014 |
|
|
|
5015 |
$__default['default'](_this8._element).trigger(EVENT_HIDDEN$2);
|
|
|
5016 |
});
|
|
|
5017 |
};
|
|
|
5018 |
|
|
|
5019 |
_proto._removeBackdrop = function _removeBackdrop() {
|
|
|
5020 |
if (this._backdrop) {
|
|
|
5021 |
$__default['default'](this._backdrop).remove();
|
|
|
5022 |
this._backdrop = null;
|
|
|
5023 |
}
|
|
|
5024 |
};
|
|
|
5025 |
|
|
|
5026 |
_proto._showBackdrop = function _showBackdrop(callback) {
|
|
|
5027 |
var _this9 = this;
|
|
|
5028 |
|
|
|
5029 |
var animate = $__default['default'](this._element).hasClass(CLASS_NAME_FADE$1) ? CLASS_NAME_FADE$1 : '';
|
|
|
5030 |
|
|
|
5031 |
if (this._isShown && this._config.backdrop) {
|
|
|
5032 |
this._backdrop = document.createElement('div');
|
|
|
5033 |
this._backdrop.className = CLASS_NAME_BACKDROP;
|
|
|
5034 |
|
|
|
5035 |
if (animate) {
|
|
|
5036 |
this._backdrop.classList.add(animate);
|
|
|
5037 |
}
|
|
|
5038 |
|
|
|
5039 |
$__default['default'](this._backdrop).appendTo(document.body);
|
|
|
5040 |
$__default['default'](this._element).on(EVENT_CLICK_DISMISS, function (event) {
|
|
|
5041 |
if (_this9._ignoreBackdropClick) {
|
|
|
5042 |
_this9._ignoreBackdropClick = false;
|
|
|
5043 |
return;
|
|
|
5044 |
}
|
|
|
5045 |
|
|
|
5046 |
if (event.target !== event.currentTarget) {
|
|
|
5047 |
return;
|
|
|
5048 |
}
|
|
|
5049 |
|
|
|
5050 |
if (_this9._config.backdrop === 'static') {
|
|
|
5051 |
_this9._triggerBackdropTransition();
|
|
|
5052 |
} else {
|
|
|
5053 |
_this9.hide();
|
|
|
5054 |
}
|
|
|
5055 |
});
|
|
|
5056 |
|
|
|
5057 |
if (animate) {
|
|
|
5058 |
Util.reflow(this._backdrop);
|
|
|
5059 |
}
|
|
|
5060 |
|
|
|
5061 |
$__default['default'](this._backdrop).addClass(CLASS_NAME_SHOW$3);
|
|
|
5062 |
|
|
|
5063 |
if (!callback) {
|
|
|
5064 |
return;
|
|
|
5065 |
}
|
|
|
5066 |
|
|
|
5067 |
if (!animate) {
|
|
|
5068 |
callback();
|
|
|
5069 |
return;
|
|
|
5070 |
}
|
|
|
5071 |
|
|
|
5072 |
var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
|
|
|
5073 |
$__default['default'](this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
|
|
|
5074 |
} else if (!this._isShown && this._backdrop) {
|
|
|
5075 |
$__default['default'](this._backdrop).removeClass(CLASS_NAME_SHOW$3);
|
|
|
5076 |
|
|
|
5077 |
var callbackRemove = function callbackRemove() {
|
|
|
5078 |
_this9._removeBackdrop();
|
|
|
5079 |
|
|
|
5080 |
if (callback) {
|
|
|
5081 |
callback();
|
|
|
5082 |
}
|
|
|
5083 |
};
|
|
|
5084 |
|
|
|
5085 |
if ($__default['default'](this._element).hasClass(CLASS_NAME_FADE$1)) {
|
|
|
5086 |
var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
|
|
|
5087 |
|
|
|
5088 |
$__default['default'](this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
|
|
|
5089 |
} else {
|
|
|
5090 |
callbackRemove();
|
|
|
5091 |
}
|
|
|
5092 |
} else if (callback) {
|
|
|
5093 |
callback();
|
|
|
5094 |
}
|
|
|
5095 |
} // ----------------------------------------------------------------------
|
|
|
5096 |
// the following methods are used to handle overflowing modals
|
|
|
5097 |
// todo (fat): these should probably be refactored out of modal.js
|
|
|
5098 |
// ----------------------------------------------------------------------
|
|
|
5099 |
;
|
|
|
5100 |
|
|
|
5101 |
_proto._adjustDialog = function _adjustDialog() {
|
|
|
5102 |
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
|
|
5103 |
|
|
|
5104 |
if (!this._isBodyOverflowing && isModalOverflowing) {
|
|
|
5105 |
this._element.style.paddingLeft = this._scrollbarWidth + "px";
|
|
|
5106 |
}
|
|
|
5107 |
|
|
|
5108 |
if (this._isBodyOverflowing && !isModalOverflowing) {
|
|
|
5109 |
this._element.style.paddingRight = this._scrollbarWidth + "px";
|
|
|
5110 |
}
|
|
|
5111 |
};
|
|
|
5112 |
|
|
|
5113 |
_proto._resetAdjustments = function _resetAdjustments() {
|
|
|
5114 |
this._element.style.paddingLeft = '';
|
|
|
5115 |
this._element.style.paddingRight = '';
|
|
|
5116 |
};
|
|
|
5117 |
|
|
|
5118 |
_proto._checkScrollbar = function _checkScrollbar() {
|
|
|
5119 |
var rect = document.body.getBoundingClientRect();
|
|
|
5120 |
this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
|
|
|
5121 |
this._scrollbarWidth = this._getScrollbarWidth();
|
|
|
5122 |
};
|
|
|
5123 |
|
|
|
5124 |
_proto._setScrollbar = function _setScrollbar() {
|
|
|
5125 |
var _this10 = this;
|
|
|
5126 |
|
|
|
5127 |
if (this._isBodyOverflowing) {
|
|
|
5128 |
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
|
|
|
5129 |
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
|
|
|
5130 |
var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
|
|
|
5131 |
var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding
|
|
|
5132 |
|
|
|
5133 |
$__default['default'](fixedContent).each(function (index, element) {
|
|
|
5134 |
var actualPadding = element.style.paddingRight;
|
|
|
5135 |
var calculatedPadding = $__default['default'](element).css('padding-right');
|
|
|
5136 |
$__default['default'](element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
|
|
|
5137 |
}); // Adjust sticky content margin
|
|
|
5138 |
|
|
|
5139 |
$__default['default'](stickyContent).each(function (index, element) {
|
|
|
5140 |
var actualMargin = element.style.marginRight;
|
|
|
5141 |
var calculatedMargin = $__default['default'](element).css('margin-right');
|
|
|
5142 |
$__default['default'](element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
|
|
|
5143 |
}); // Adjust body padding
|
|
|
5144 |
|
|
|
5145 |
var actualPadding = document.body.style.paddingRight;
|
|
|
5146 |
var calculatedPadding = $__default['default'](document.body).css('padding-right');
|
|
|
5147 |
$__default['default'](document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
|
|
|
5148 |
}
|
|
|
5149 |
|
|
|
5150 |
$__default['default'](document.body).addClass(CLASS_NAME_OPEN);
|
|
|
5151 |
};
|
|
|
5152 |
|
|
|
5153 |
_proto._resetScrollbar = function _resetScrollbar() {
|
|
|
5154 |
// Restore fixed content padding
|
|
|
5155 |
var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
|
|
|
5156 |
$__default['default'](fixedContent).each(function (index, element) {
|
|
|
5157 |
var padding = $__default['default'](element).data('padding-right');
|
|
|
5158 |
$__default['default'](element).removeData('padding-right');
|
|
|
5159 |
element.style.paddingRight = padding ? padding : '';
|
|
|
5160 |
}); // Restore sticky content
|
|
|
5161 |
|
|
|
5162 |
var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT));
|
|
|
5163 |
$__default['default'](elements).each(function (index, element) {
|
|
|
5164 |
var margin = $__default['default'](element).data('margin-right');
|
|
|
5165 |
|
|
|
5166 |
if (typeof margin !== 'undefined') {
|
|
|
5167 |
$__default['default'](element).css('margin-right', margin).removeData('margin-right');
|
|
|
5168 |
}
|
|
|
5169 |
}); // Restore body padding
|
|
|
5170 |
|
|
|
5171 |
var padding = $__default['default'](document.body).data('padding-right');
|
|
|
5172 |
$__default['default'](document.body).removeData('padding-right');
|
|
|
5173 |
document.body.style.paddingRight = padding ? padding : '';
|
|
|
5174 |
};
|
|
|
5175 |
|
|
|
5176 |
_proto._getScrollbarWidth = function _getScrollbarWidth() {
|
|
|
5177 |
// thx d.walsh
|
|
|
5178 |
var scrollDiv = document.createElement('div');
|
|
|
5179 |
scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
|
|
|
5180 |
document.body.appendChild(scrollDiv);
|
|
|
5181 |
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
|
|
|
5182 |
document.body.removeChild(scrollDiv);
|
|
|
5183 |
return scrollbarWidth;
|
|
|
5184 |
} // Static
|
|
|
5185 |
;
|
|
|
5186 |
|
|
|
5187 |
Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
|
|
|
5188 |
return this.each(function () {
|
|
|
5189 |
var data = $__default['default'](this).data(DATA_KEY$5);
|
|
|
5190 |
|
|
|
5191 |
var _config = _extends({}, Default$3, $__default['default'](this).data(), typeof config === 'object' && config ? config : {});
|
|
|
5192 |
|
|
|
5193 |
if (!data) {
|
|
|
5194 |
data = new Modal(this, _config);
|
|
|
5195 |
$__default['default'](this).data(DATA_KEY$5, data);
|
|
|
5196 |
}
|
|
|
5197 |
|
|
|
5198 |
if (typeof config === 'string') {
|
|
|
5199 |
if (typeof data[config] === 'undefined') {
|
|
|
5200 |
throw new TypeError("No method named \"" + config + "\"");
|
|
|
5201 |
}
|
|
|
5202 |
|
|
|
5203 |
data[config](relatedTarget);
|
|
|
5204 |
} else if (_config.show) {
|
|
|
5205 |
data.show(relatedTarget);
|
|
|
5206 |
}
|
|
|
5207 |
});
|
|
|
5208 |
};
|
|
|
5209 |
|
|
|
5210 |
_createClass(Modal, null, [{
|
|
|
5211 |
key: "VERSION",
|
|
|
5212 |
get: function get() {
|
|
|
5213 |
return VERSION$5;
|
|
|
5214 |
}
|
|
|
5215 |
}, {
|
|
|
5216 |
key: "Default",
|
|
|
5217 |
get: function get() {
|
|
|
5218 |
return Default$3;
|
|
|
5219 |
}
|
|
|
5220 |
}]);
|
|
|
5221 |
|
|
|
5222 |
return Modal;
|
|
|
5223 |
}();
|
|
|
5224 |
/**
|
|
|
5225 |
* ------------------------------------------------------------------------
|
|
|
5226 |
* Data Api implementation
|
|
|
5227 |
* ------------------------------------------------------------------------
|
|
|
5228 |
*/
|
|
|
5229 |
|
|
|
5230 |
|
|
|
5231 |
$__default['default'](document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
|
|
|
5232 |
var _this11 = this;
|
|
|
5233 |
|
|
|
5234 |
var target;
|
|
|
5235 |
var selector = Util.getSelectorFromElement(this);
|
|
|
5236 |
|
|
|
5237 |
if (selector) {
|
|
|
5238 |
target = document.querySelector(selector);
|
|
|
5239 |
}
|
|
|
5240 |
|
|
|
5241 |
var config = $__default['default'](target).data(DATA_KEY$5) ? 'toggle' : _extends({}, $__default['default'](target).data(), $__default['default'](this).data());
|
|
|
5242 |
|
|
|
5243 |
if (this.tagName === 'A' || this.tagName === 'AREA') {
|
|
|
5244 |
event.preventDefault();
|
|
|
5245 |
}
|
|
|
5246 |
|
|
|
5247 |
var $target = $__default['default'](target).one(EVENT_SHOW$2, function (showEvent) {
|
|
|
5248 |
if (showEvent.isDefaultPrevented()) {
|
|
|
5249 |
// Only register focus restorer if modal will actually get shown
|
|
|
5250 |
return;
|
|
|
5251 |
}
|
|
|
5252 |
|
|
|
5253 |
$target.one(EVENT_HIDDEN$2, function () {
|
|
|
5254 |
if ($__default['default'](_this11).is(':visible')) {
|
|
|
5255 |
_this11.focus();
|
|
|
5256 |
}
|
|
|
5257 |
});
|
|
|
5258 |
});
|
|
|
5259 |
|
|
|
5260 |
Modal._jQueryInterface.call($__default['default'](target), config, this);
|
|
|
5261 |
});
|
|
|
5262 |
/**
|
|
|
5263 |
* ------------------------------------------------------------------------
|
|
|
5264 |
* jQuery
|
|
|
5265 |
* ------------------------------------------------------------------------
|
|
|
5266 |
*/
|
|
|
5267 |
|
|
|
5268 |
$__default['default'].fn[NAME$5] = Modal._jQueryInterface;
|
|
|
5269 |
$__default['default'].fn[NAME$5].Constructor = Modal;
|
|
|
5270 |
|
|
|
5271 |
$__default['default'].fn[NAME$5].noConflict = function () {
|
|
|
5272 |
$__default['default'].fn[NAME$5] = JQUERY_NO_CONFLICT$5;
|
|
|
5273 |
return Modal._jQueryInterface;
|
|
|
5274 |
};
|
|
|
5275 |
|
|
|
5276 |
/**
|
|
|
5277 |
* --------------------------------------------------------------------------
|
|
|
5278 |
* Bootstrap (v4.6.0): tools/sanitizer.js
|
|
|
5279 |
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
|
5280 |
* --------------------------------------------------------------------------
|
|
|
5281 |
*/
|
|
|
5282 |
var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
|
|
|
5283 |
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
|
|
5284 |
var DefaultWhitelist = {
|
|
|
5285 |
// Global attributes allowed on any supplied element below.
|
|
|
5286 |
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
|
|
5287 |
a: ['target', 'href', 'title', 'rel'],
|
|
|
5288 |
area: [],
|
|
|
5289 |
b: [],
|
|
|
5290 |
br: [],
|
|
|
5291 |
col: [],
|
|
|
5292 |
code: [],
|
|
|
5293 |
div: [],
|
|
|
5294 |
em: [],
|
|
|
5295 |
hr: [],
|
|
|
5296 |
h1: [],
|
|
|
5297 |
h2: [],
|
|
|
5298 |
h3: [],
|
|
|
5299 |
h4: [],
|
|
|
5300 |
h5: [],
|
|
|
5301 |
h6: [],
|
|
|
5302 |
i: [],
|
|
|
5303 |
img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
|
|
|
5304 |
li: [],
|
|
|
5305 |
ol: [],
|
|
|
5306 |
p: [],
|
|
|
5307 |
pre: [],
|
|
|
5308 |
s: [],
|
|
|
5309 |
small: [],
|
|
|
5310 |
span: [],
|
|
|
5311 |
sub: [],
|
|
|
5312 |
sup: [],
|
|
|
5313 |
strong: [],
|
|
|
5314 |
u: [],
|
|
|
5315 |
ul: []
|
|
|
5316 |
};
|
|
|
5317 |
/**
|
|
|
5318 |
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
|
|
5319 |
*
|
|
|
5320 |
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
|
|
5321 |
*/
|
|
|
5322 |
|
|
|
5323 |
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
|
|
|
5324 |
/**
|
|
|
5325 |
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
|
|
5326 |
*
|
|
|
5327 |
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
|
|
5328 |
*/
|
|
|
5329 |
|
|
|
5330 |
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
|
|
|
5331 |
|
|
|
5332 |
function allowedAttribute(attr, allowedAttributeList) {
|
|
|
5333 |
var attrName = attr.nodeName.toLowerCase();
|
|
|
5334 |
|
|
|
5335 |
if (allowedAttributeList.indexOf(attrName) !== -1) {
|
|
|
5336 |
if (uriAttrs.indexOf(attrName) !== -1) {
|
|
|
5337 |
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
|
|
|
5338 |
}
|
|
|
5339 |
|
|
|
5340 |
return true;
|
|
|
5341 |
}
|
|
|
5342 |
|
|
|
5343 |
var regExp = allowedAttributeList.filter(function (attrRegex) {
|
|
|
5344 |
return attrRegex instanceof RegExp;
|
|
|
5345 |
}); // Check if a regular expression validates the attribute.
|
|
|
5346 |
|
|
|
5347 |
for (var i = 0, len = regExp.length; i < len; i++) {
|
|
|
5348 |
if (attrName.match(regExp[i])) {
|
|
|
5349 |
return true;
|
|
|
5350 |
}
|
|
|
5351 |
}
|
|
|
5352 |
|
|
|
5353 |
return false;
|
|
|
5354 |
}
|
|
|
5355 |
|
|
|
5356 |
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
|
|
|
5357 |
if (unsafeHtml.length === 0) {
|
|
|
5358 |
return unsafeHtml;
|
|
|
5359 |
}
|
|
|
5360 |
|
|
|
5361 |
if (sanitizeFn && typeof sanitizeFn === 'function') {
|
|
|
5362 |
return sanitizeFn(unsafeHtml);
|
|
|
5363 |
}
|
|
|
5364 |
|
|
|
5365 |
var domParser = new window.DOMParser();
|
|
|
5366 |
var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
|
|
5367 |
var whitelistKeys = Object.keys(whiteList);
|
|
|
5368 |
var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
|
|
|
5369 |
|
|
|
5370 |
var _loop = function _loop(i, len) {
|
|
|
5371 |
var el = elements[i];
|
|
|
5372 |
var elName = el.nodeName.toLowerCase();
|
|
|
5373 |
|
|
|
5374 |
if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
|
|
|
5375 |
el.parentNode.removeChild(el);
|
|
|
5376 |
return "continue";
|
|
|
5377 |
}
|
|
|
5378 |
|
|
|
5379 |
var attributeList = [].slice.call(el.attributes);
|
|
|
5380 |
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
|
|
|
5381 |
attributeList.forEach(function (attr) {
|
|
|
5382 |
if (!allowedAttribute(attr, whitelistedAttributes)) {
|
|
|
5383 |
el.removeAttribute(attr.nodeName);
|
|
|
5384 |
}
|
|
|
5385 |
});
|
|
|
5386 |
};
|
|
|
5387 |
|
|
|
5388 |
for (var i = 0, len = elements.length; i < len; i++) {
|
|
|
5389 |
var _ret = _loop(i);
|
|
|
5390 |
|
|
|
5391 |
if (_ret === "continue") continue;
|
|
|
5392 |
}
|
|
|
5393 |
|
|
|
5394 |
return createdDocument.body.innerHTML;
|
|
|
5395 |
}
|
|
|
5396 |
|
|
|
5397 |
/**
|
|
|
5398 |
* ------------------------------------------------------------------------
|
|
|
5399 |
* Constants
|
|
|
5400 |
* ------------------------------------------------------------------------
|
|
|
5401 |
*/
|
|
|
5402 |
|
|
|
5403 |
var NAME$6 = 'tooltip';
|
|
|
5404 |
var VERSION$6 = '4.6.0';
|
|
|
5405 |
var DATA_KEY$6 = 'bs.tooltip';
|
|
|
5406 |
var EVENT_KEY$6 = "." + DATA_KEY$6;
|
|
|
5407 |
var JQUERY_NO_CONFLICT$6 = $__default['default'].fn[NAME$6];
|
|
|
5408 |
var CLASS_PREFIX = 'bs-tooltip';
|
|
|
5409 |
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
|
|
|
5410 |
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
|
|
|
5411 |
var DefaultType$4 = {
|
|
|
5412 |
animation: 'boolean',
|
|
|
5413 |
template: 'string',
|
|
|
5414 |
title: '(string|element|function)',
|
|
|
5415 |
trigger: 'string',
|
|
|
5416 |
delay: '(number|object)',
|
|
|
5417 |
html: 'boolean',
|
|
|
5418 |
selector: '(string|boolean)',
|
|
|
5419 |
placement: '(string|function)',
|
|
|
5420 |
offset: '(number|string|function)',
|
|
|
5421 |
container: '(string|element|boolean)',
|
|
|
5422 |
fallbackPlacement: '(string|array)',
|
|
|
5423 |
boundary: '(string|element)',
|
|
|
5424 |
customClass: '(string|function)',
|
|
|
5425 |
sanitize: 'boolean',
|
|
|
5426 |
sanitizeFn: '(null|function)',
|
|
|
5427 |
whiteList: 'object',
|
|
|
5428 |
popperConfig: '(null|object)'
|
|
|
5429 |
};
|
|
|
5430 |
var AttachmentMap = {
|
|
|
5431 |
AUTO: 'auto',
|
|
|
5432 |
TOP: 'top',
|
|
|
5433 |
RIGHT: 'right',
|
|
|
5434 |
BOTTOM: 'bottom',
|
|
|
5435 |
LEFT: 'left'
|
|
|
5436 |
};
|
|
|
5437 |
var Default$4 = {
|
|
|
5438 |
animation: true,
|
|
|
5439 |
template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
|
|
|
5440 |
trigger: 'hover focus',
|
|
|
5441 |
title: '',
|
|
|
5442 |
delay: 0,
|
|
|
5443 |
html: false,
|
|
|
5444 |
selector: false,
|
|
|
5445 |
placement: 'top',
|
|
|
5446 |
offset: 0,
|
|
|
5447 |
container: false,
|
|
|
5448 |
fallbackPlacement: 'flip',
|
|
|
5449 |
boundary: 'scrollParent',
|
|
|
5450 |
customClass: '',
|
|
|
5451 |
sanitize: true,
|
|
|
5452 |
sanitizeFn: null,
|
|
|
5453 |
whiteList: DefaultWhitelist,
|
|
|
5454 |
popperConfig: null
|
|
|
5455 |
};
|
|
|
5456 |
var HOVER_STATE_SHOW = 'show';
|
|
|
5457 |
var HOVER_STATE_OUT = 'out';
|
|
|
5458 |
var Event = {
|
|
|
5459 |
HIDE: "hide" + EVENT_KEY$6,
|
|
|
5460 |
HIDDEN: "hidden" + EVENT_KEY$6,
|
|
|
5461 |
SHOW: "show" + EVENT_KEY$6,
|
|
|
5462 |
SHOWN: "shown" + EVENT_KEY$6,
|
|
|
5463 |
INSERTED: "inserted" + EVENT_KEY$6,
|
|
|
5464 |
CLICK: "click" + EVENT_KEY$6,
|
|
|
5465 |
FOCUSIN: "focusin" + EVENT_KEY$6,
|
|
|
5466 |
FOCUSOUT: "focusout" + EVENT_KEY$6,
|
|
|
5467 |
MOUSEENTER: "mouseenter" + EVENT_KEY$6,
|
|
|
5468 |
MOUSELEAVE: "mouseleave" + EVENT_KEY$6
|
|
|
5469 |
};
|
|
|
5470 |
var CLASS_NAME_FADE$2 = 'fade';
|
|
|
5471 |
var CLASS_NAME_SHOW$4 = 'show';
|
|
|
5472 |
var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
|
|
|
5473 |
var SELECTOR_ARROW = '.arrow';
|
|
|
5474 |
var TRIGGER_HOVER = 'hover';
|
|
|
5475 |
var TRIGGER_FOCUS = 'focus';
|
|
|
5476 |
var TRIGGER_CLICK = 'click';
|
|
|
5477 |
var TRIGGER_MANUAL = 'manual';
|
|
|
5478 |
/**
|
|
|
5479 |
* ------------------------------------------------------------------------
|
|
|
5480 |
* Class Definition
|
|
|
5481 |
* ------------------------------------------------------------------------
|
|
|
5482 |
*/
|
|
|
5483 |
|
|
|
5484 |
var Tooltip = /*#__PURE__*/function () {
|
|
|
5485 |
function Tooltip(element, config) {
|
|
|
5486 |
if (typeof Popper === 'undefined') {
|
|
|
5487 |
throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
|
|
|
5488 |
} // private
|
|
|
5489 |
|
|
|
5490 |
|
|
|
5491 |
this._isEnabled = true;
|
|
|
5492 |
this._timeout = 0;
|
|
|
5493 |
this._hoverState = '';
|
|
|
5494 |
this._activeTrigger = {};
|
|
|
5495 |
this._popper = null; // Protected
|
|
|
5496 |
|
|
|
5497 |
this.element = element;
|
|
|
5498 |
this.config = this._getConfig(config);
|
|
|
5499 |
this.tip = null;
|
|
|
5500 |
|
|
|
5501 |
this._setListeners();
|
|
|
5502 |
} // Getters
|
|
|
5503 |
|
|
|
5504 |
|
|
|
5505 |
var _proto = Tooltip.prototype;
|
|
|
5506 |
|
|
|
5507 |
// Public
|
|
|
5508 |
_proto.enable = function enable() {
|
|
|
5509 |
this._isEnabled = true;
|
|
|
5510 |
};
|
|
|
5511 |
|
|
|
5512 |
_proto.disable = function disable() {
|
|
|
5513 |
this._isEnabled = false;
|
|
|
5514 |
};
|
|
|
5515 |
|
|
|
5516 |
_proto.toggleEnabled = function toggleEnabled() {
|
|
|
5517 |
this._isEnabled = !this._isEnabled;
|
|
|
5518 |
};
|
|
|
5519 |
|
|
|
5520 |
_proto.toggle = function toggle(event) {
|
|
|
5521 |
if (!this._isEnabled) {
|
|
|
5522 |
return;
|
|
|
5523 |
}
|
|
|
5524 |
|
|
|
5525 |
if (event) {
|
|
|
5526 |
var dataKey = this.constructor.DATA_KEY;
|
|
|
5527 |
var context = $__default['default'](event.currentTarget).data(dataKey);
|
|
|
5528 |
|
|
|
5529 |
if (!context) {
|
|
|
5530 |
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
|
|
5531 |
$__default['default'](event.currentTarget).data(dataKey, context);
|
|
|
5532 |
}
|
|
|
5533 |
|
|
|
5534 |
context._activeTrigger.click = !context._activeTrigger.click;
|
|
|
5535 |
|
|
|
5536 |
if (context._isWithActiveTrigger()) {
|
|
|
5537 |
context._enter(null, context);
|
|
|
5538 |
} else {
|
|
|
5539 |
context._leave(null, context);
|
|
|
5540 |
}
|
|
|
5541 |
} else {
|
|
|
5542 |
if ($__default['default'](this.getTipElement()).hasClass(CLASS_NAME_SHOW$4)) {
|
|
|
5543 |
this._leave(null, this);
|
|
|
5544 |
|
|
|
5545 |
return;
|
|
|
5546 |
}
|
|
|
5547 |
|
|
|
5548 |
this._enter(null, this);
|
|
|
5549 |
}
|
|
|
5550 |
};
|
|
|
5551 |
|
|
|
5552 |
_proto.dispose = function dispose() {
|
|
|
5553 |
clearTimeout(this._timeout);
|
|
|
5554 |
$__default['default'].removeData(this.element, this.constructor.DATA_KEY);
|
|
|
5555 |
$__default['default'](this.element).off(this.constructor.EVENT_KEY);
|
|
|
5556 |
$__default['default'](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
|
|
|
5557 |
|
|
|
5558 |
if (this.tip) {
|
|
|
5559 |
$__default['default'](this.tip).remove();
|
|
|
5560 |
}
|
|
|
5561 |
|
|
|
5562 |
this._isEnabled = null;
|
|
|
5563 |
this._timeout = null;
|
|
|
5564 |
this._hoverState = null;
|
|
|
5565 |
this._activeTrigger = null;
|
|
|
5566 |
|
|
|
5567 |
if (this._popper) {
|
|
|
5568 |
this._popper.destroy();
|
|
|
5569 |
}
|
|
|
5570 |
|
|
|
5571 |
this._popper = null;
|
|
|
5572 |
this.element = null;
|
|
|
5573 |
this.config = null;
|
|
|
5574 |
this.tip = null;
|
|
|
5575 |
};
|
|
|
5576 |
|
|
|
5577 |
_proto.show = function show() {
|
|
|
5578 |
var _this = this;
|
|
|
5579 |
|
|
|
5580 |
if ($__default['default'](this.element).css('display') === 'none') {
|
|
|
5581 |
throw new Error('Please use show on visible elements');
|
|
|
5582 |
}
|
|
|
5583 |
|
|
|
5584 |
var showEvent = $__default['default'].Event(this.constructor.Event.SHOW);
|
|
|
5585 |
|
|
|
5586 |
if (this.isWithContent() && this._isEnabled) {
|
|
|
5587 |
$__default['default'](this.element).trigger(showEvent);
|
|
|
5588 |
var shadowRoot = Util.findShadowRoot(this.element);
|
|
|
5589 |
var isInTheDom = $__default['default'].contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
|
|
|
5590 |
|
|
|
5591 |
if (showEvent.isDefaultPrevented() || !isInTheDom) {
|
|
|
5592 |
return;
|
|
|
5593 |
}
|
|
|
5594 |
|
|
|
5595 |
var tip = this.getTipElement();
|
|
|
5596 |
var tipId = Util.getUID(this.constructor.NAME);
|
|
|
5597 |
tip.setAttribute('id', tipId);
|
|
|
5598 |
this.element.setAttribute('aria-describedby', tipId);
|
|
|
5599 |
this.setContent();
|
|
|
5600 |
|
|
|
5601 |
if (this.config.animation) {
|
|
|
5602 |
$__default['default'](tip).addClass(CLASS_NAME_FADE$2);
|
|
|
5603 |
}
|
|
|
5604 |
|
|
|
5605 |
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
|
|
|
5606 |
|
|
|
5607 |
var attachment = this._getAttachment(placement);
|
|
|
5608 |
|
|
|
5609 |
this.addAttachmentClass(attachment);
|
|
|
5610 |
|
|
|
5611 |
var container = this._getContainer();
|
|
|
5612 |
|
|
|
5613 |
$__default['default'](tip).data(this.constructor.DATA_KEY, this);
|
|
|
5614 |
|
|
|
5615 |
if (!$__default['default'].contains(this.element.ownerDocument.documentElement, this.tip)) {
|
|
|
5616 |
$__default['default'](tip).appendTo(container);
|
|
|
5617 |
}
|
|
|
5618 |
|
|
|
5619 |
$__default['default'](this.element).trigger(this.constructor.Event.INSERTED);
|
|
|
5620 |
this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
|
|
|
5621 |
$__default['default'](tip).addClass(CLASS_NAME_SHOW$4);
|
|
|
5622 |
$__default['default'](tip).addClass(this.config.customClass); // If this is a touch-enabled device we add extra
|
|
|
5623 |
// empty mouseover listeners to the body's immediate children;
|
|
|
5624 |
// only needed because of broken event delegation on iOS
|
|
|
5625 |
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
|
|
5626 |
|
|
|
5627 |
if ('ontouchstart' in document.documentElement) {
|
|
|
5628 |
$__default['default'](document.body).children().on('mouseover', null, $__default['default'].noop);
|
|
|
5629 |
}
|
|
|
5630 |
|
|
|
5631 |
var complete = function complete() {
|
|
|
5632 |
if (_this.config.animation) {
|
|
|
5633 |
_this._fixTransition();
|
|
|
5634 |
}
|
|
|
5635 |
|
|
|
5636 |
var prevHoverState = _this._hoverState;
|
|
|
5637 |
_this._hoverState = null;
|
|
|
5638 |
$__default['default'](_this.element).trigger(_this.constructor.Event.SHOWN);
|
|
|
5639 |
|
|
|
5640 |
if (prevHoverState === HOVER_STATE_OUT) {
|
|
|
5641 |
_this._leave(null, _this);
|
|
|
5642 |
}
|
|
|
5643 |
};
|
|
|
5644 |
|
|
|
5645 |
if ($__default['default'](this.tip).hasClass(CLASS_NAME_FADE$2)) {
|
|
|
5646 |
var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
|
|
|
5647 |
$__default['default'](this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
|
|
5648 |
} else {
|
|
|
5649 |
complete();
|
|
|
5650 |
}
|
|
|
5651 |
}
|
|
|
5652 |
};
|
|
|
5653 |
|
|
|
5654 |
_proto.hide = function hide(callback) {
|
|
|
5655 |
var _this2 = this;
|
|
|
5656 |
|
|
|
5657 |
var tip = this.getTipElement();
|
|
|
5658 |
var hideEvent = $__default['default'].Event(this.constructor.Event.HIDE);
|
|
|
5659 |
|
|
|
5660 |
var complete = function complete() {
|
|
|
5661 |
if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
|
|
|
5662 |
tip.parentNode.removeChild(tip);
|
|
|
5663 |
}
|
|
|
5664 |
|
|
|
5665 |
_this2._cleanTipClass();
|
|
|
5666 |
|
|
|
5667 |
_this2.element.removeAttribute('aria-describedby');
|
|
|
5668 |
|
|
|
5669 |
$__default['default'](_this2.element).trigger(_this2.constructor.Event.HIDDEN);
|
|
|
5670 |
|
|
|
5671 |
if (_this2._popper !== null) {
|
|
|
5672 |
_this2._popper.destroy();
|
|
|
5673 |
}
|
|
|
5674 |
|
|
|
5675 |
if (callback) {
|
|
|
5676 |
callback();
|
|
|
5677 |
}
|
|
|
5678 |
};
|
|
|
5679 |
|
|
|
5680 |
$__default['default'](this.element).trigger(hideEvent);
|
|
|
5681 |
|
|
|
5682 |
if (hideEvent.isDefaultPrevented()) {
|
|
|
5683 |
return;
|
|
|
5684 |
}
|
|
|
5685 |
|
|
|
5686 |
$__default['default'](tip).removeClass(CLASS_NAME_SHOW$4); // If this is a touch-enabled device we remove the extra
|
|
|
5687 |
// empty mouseover listeners we added for iOS support
|
|
|
5688 |
|
|
|
5689 |
if ('ontouchstart' in document.documentElement) {
|
|
|
5690 |
$__default['default'](document.body).children().off('mouseover', null, $__default['default'].noop);
|
|
|
5691 |
}
|
|
|
5692 |
|
|
|
5693 |
this._activeTrigger[TRIGGER_CLICK] = false;
|
|
|
5694 |
this._activeTrigger[TRIGGER_FOCUS] = false;
|
|
|
5695 |
this._activeTrigger[TRIGGER_HOVER] = false;
|
|
|
5696 |
|
|
|
5697 |
if ($__default['default'](this.tip).hasClass(CLASS_NAME_FADE$2)) {
|
|
|
5698 |
var transitionDuration = Util.getTransitionDurationFromElement(tip);
|
|
|
5699 |
$__default['default'](tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
|
|
5700 |
} else {
|
|
|
5701 |
complete();
|
|
|
5702 |
}
|
|
|
5703 |
|
|
|
5704 |
this._hoverState = '';
|
|
|
5705 |
};
|
|
|
5706 |
|
|
|
5707 |
_proto.update = function update() {
|
|
|
5708 |
if (this._popper !== null) {
|
|
|
5709 |
this._popper.scheduleUpdate();
|
|
|
5710 |
}
|
|
|
5711 |
} // Protected
|
|
|
5712 |
;
|
|
|
5713 |
|
|
|
5714 |
_proto.isWithContent = function isWithContent() {
|
|
|
5715 |
return Boolean(this.getTitle());
|
|
|
5716 |
};
|
|
|
5717 |
|
|
|
5718 |
_proto.addAttachmentClass = function addAttachmentClass(attachment) {
|
|
|
5719 |
$__default['default'](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
|
|
|
5720 |
};
|
|
|
5721 |
|
|
|
5722 |
_proto.getTipElement = function getTipElement() {
|
|
|
5723 |
this.tip = this.tip || $__default['default'](this.config.template)[0];
|
|
|
5724 |
return this.tip;
|
|
|
5725 |
};
|
|
|
5726 |
|
|
|
5727 |
_proto.setContent = function setContent() {
|
|
|
5728 |
var tip = this.getTipElement();
|
|
|
5729 |
this.setElementContent($__default['default'](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle());
|
|
|
5730 |
$__default['default'](tip).removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$4);
|
|
|
5731 |
};
|
|
|
5732 |
|
|
|
5733 |
_proto.setElementContent = function setElementContent($element, content) {
|
|
|
5734 |
if (typeof content === 'object' && (content.nodeType || content.jquery)) {
|
|
|
5735 |
// Content is a DOM node or a jQuery
|
|
|
5736 |
if (this.config.html) {
|
|
|
5737 |
if (!$__default['default'](content).parent().is($element)) {
|
|
|
5738 |
$element.empty().append(content);
|
|
|
5739 |
}
|
|
|
5740 |
} else {
|
|
|
5741 |
$element.text($__default['default'](content).text());
|
|
|
5742 |
}
|
|
|
5743 |
|
|
|
5744 |
return;
|
|
|
5745 |
}
|
|
|
5746 |
|
|
|
5747 |
if (this.config.html) {
|
|
|
5748 |
if (this.config.sanitize) {
|
|
|
5749 |
content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
|
|
|
5750 |
}
|
|
|
5751 |
|
|
|
5752 |
$element.html(content);
|
|
|
5753 |
} else {
|
|
|
5754 |
$element.text(content);
|
|
|
5755 |
}
|
|
|
5756 |
};
|
|
|
5757 |
|
|
|
5758 |
_proto.getTitle = function getTitle() {
|
|
|
5759 |
var title = this.element.getAttribute('data-original-title');
|
|
|
5760 |
|
|
|
5761 |
if (!title) {
|
|
|
5762 |
title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
|
|
|
5763 |
}
|
|
|
5764 |
|
|
|
5765 |
return title;
|
|
|
5766 |
} // Private
|
|
|
5767 |
;
|
|
|
5768 |
|
|
|
5769 |
_proto._getPopperConfig = function _getPopperConfig(attachment) {
|
|
|
5770 |
var _this3 = this;
|
|
|
5771 |
|
|
|
5772 |
var defaultBsConfig = {
|
|
|
5773 |
placement: attachment,
|
|
|
5774 |
modifiers: {
|
|
|
5775 |
offset: this._getOffset(),
|
|
|
5776 |
flip: {
|
|
|
5777 |
behavior: this.config.fallbackPlacement
|
|
|
5778 |
},
|
|
|
5779 |
arrow: {
|
|
|
5780 |
element: SELECTOR_ARROW
|
|
|
5781 |
},
|
|
|
5782 |
preventOverflow: {
|
|
|
5783 |
boundariesElement: this.config.boundary
|
|
|
5784 |
}
|
|
|
5785 |
},
|
|
|
5786 |
onCreate: function onCreate(data) {
|
|
|
5787 |
if (data.originalPlacement !== data.placement) {
|
|
|
5788 |
_this3._handlePopperPlacementChange(data);
|
|
|
5789 |
}
|
|
|
5790 |
},
|
|
|
5791 |
onUpdate: function onUpdate(data) {
|
|
|
5792 |
return _this3._handlePopperPlacementChange(data);
|
|
|
5793 |
}
|
|
|
5794 |
};
|
|
|
5795 |
return _extends({}, defaultBsConfig, this.config.popperConfig);
|
|
|
5796 |
};
|
|
|
5797 |
|
|
|
5798 |
_proto._getOffset = function _getOffset() {
|
|
|
5799 |
var _this4 = this;
|
|
|
5800 |
|
|
|
5801 |
var offset = {};
|
|
|
5802 |
|
|
|
5803 |
if (typeof this.config.offset === 'function') {
|
|
|
5804 |
offset.fn = function (data) {
|
|
|
5805 |
data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
|
|
|
5806 |
return data;
|
|
|
5807 |
};
|
|
|
5808 |
} else {
|
|
|
5809 |
offset.offset = this.config.offset;
|
|
|
5810 |
}
|
|
|
5811 |
|
|
|
5812 |
return offset;
|
|
|
5813 |
};
|
|
|
5814 |
|
|
|
5815 |
_proto._getContainer = function _getContainer() {
|
|
|
5816 |
if (this.config.container === false) {
|
|
|
5817 |
return document.body;
|
|
|
5818 |
}
|
|
|
5819 |
|
|
|
5820 |
if (Util.isElement(this.config.container)) {
|
|
|
5821 |
return $__default['default'](this.config.container);
|
|
|
5822 |
}
|
|
|
5823 |
|
|
|
5824 |
return $__default['default'](document).find(this.config.container);
|
|
|
5825 |
};
|
|
|
5826 |
|
|
|
5827 |
_proto._getAttachment = function _getAttachment(placement) {
|
|
|
5828 |
return AttachmentMap[placement.toUpperCase()];
|
|
|
5829 |
};
|
|
|
5830 |
|
|
|
5831 |
_proto._setListeners = function _setListeners() {
|
|
|
5832 |
var _this5 = this;
|
|
|
5833 |
|
|
|
5834 |
var triggers = this.config.trigger.split(' ');
|
|
|
5835 |
triggers.forEach(function (trigger) {
|
|
|
5836 |
if (trigger === 'click') {
|
|
|
5837 |
$__default['default'](_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
|
|
|
5838 |
return _this5.toggle(event);
|
|
|
5839 |
});
|
|
|
5840 |
} else if (trigger !== TRIGGER_MANUAL) {
|
|
|
5841 |
var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
|
|
|
5842 |
var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
|
|
|
5843 |
$__default['default'](_this5.element).on(eventIn, _this5.config.selector, function (event) {
|
|
|
5844 |
return _this5._enter(event);
|
|
|
5845 |
}).on(eventOut, _this5.config.selector, function (event) {
|
|
|
5846 |
return _this5._leave(event);
|
|
|
5847 |
});
|
|
|
5848 |
}
|
|
|
5849 |
});
|
|
|
5850 |
|
|
|
5851 |
this._hideModalHandler = function () {
|
|
|
5852 |
if (_this5.element) {
|
|
|
5853 |
_this5.hide();
|
|
|
5854 |
}
|
|
|
5855 |
};
|
|
|
5856 |
|
|
|
5857 |
$__default['default'](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
|
|
|
5858 |
|
|
|
5859 |
if (this.config.selector) {
|
|
|
5860 |
this.config = _extends({}, this.config, {
|
|
|
5861 |
trigger: 'manual',
|
|
|
5862 |
selector: ''
|
|
|
5863 |
});
|
|
|
5864 |
} else {
|
|
|
5865 |
this._fixTitle();
|
|
|
5866 |
}
|
|
|
5867 |
};
|
|
|
5868 |
|
|
|
5869 |
_proto._fixTitle = function _fixTitle() {
|
|
|
5870 |
var titleType = typeof this.element.getAttribute('data-original-title');
|
|
|
5871 |
|
|
|
5872 |
if (this.element.getAttribute('title') || titleType !== 'string') {
|
|
|
5873 |
this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
|
|
|
5874 |
this.element.setAttribute('title', '');
|
|
|
5875 |
}
|
|
|
5876 |
};
|
|
|
5877 |
|
|
|
5878 |
_proto._enter = function _enter(event, context) {
|
|
|
5879 |
var dataKey = this.constructor.DATA_KEY;
|
|
|
5880 |
context = context || $__default['default'](event.currentTarget).data(dataKey);
|
|
|
5881 |
|
|
|
5882 |
if (!context) {
|
|
|
5883 |
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
|
|
5884 |
$__default['default'](event.currentTarget).data(dataKey, context);
|
|
|
5885 |
}
|
|
|
5886 |
|
|
|
5887 |
if (event) {
|
|
|
5888 |
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
|
|
|
5889 |
}
|
|
|
5890 |
|
|
|
5891 |
if ($__default['default'](context.getTipElement()).hasClass(CLASS_NAME_SHOW$4) || context._hoverState === HOVER_STATE_SHOW) {
|
|
|
5892 |
context._hoverState = HOVER_STATE_SHOW;
|
|
|
5893 |
return;
|
|
|
5894 |
}
|
|
|
5895 |
|
|
|
5896 |
clearTimeout(context._timeout);
|
|
|
5897 |
context._hoverState = HOVER_STATE_SHOW;
|
|
|
5898 |
|
|
|
5899 |
if (!context.config.delay || !context.config.delay.show) {
|
|
|
5900 |
context.show();
|
|
|
5901 |
return;
|
|
|
5902 |
}
|
|
|
5903 |
|
|
|
5904 |
context._timeout = setTimeout(function () {
|
|
|
5905 |
if (context._hoverState === HOVER_STATE_SHOW) {
|
|
|
5906 |
context.show();
|
|
|
5907 |
}
|
|
|
5908 |
}, context.config.delay.show);
|
|
|
5909 |
};
|
|
|
5910 |
|
|
|
5911 |
_proto._leave = function _leave(event, context) {
|
|
|
5912 |
var dataKey = this.constructor.DATA_KEY;
|
|
|
5913 |
context = context || $__default['default'](event.currentTarget).data(dataKey);
|
|
|
5914 |
|
|
|
5915 |
if (!context) {
|
|
|
5916 |
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
|
|
5917 |
$__default['default'](event.currentTarget).data(dataKey, context);
|
|
|
5918 |
}
|
|
|
5919 |
|
|
|
5920 |
if (event) {
|
|
|
5921 |
context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
|
|
|
5922 |
}
|
|
|
5923 |
|
|
|
5924 |
if (context._isWithActiveTrigger()) {
|
|
|
5925 |
return;
|
|
|
5926 |
}
|
|
|
5927 |
|
|
|
5928 |
clearTimeout(context._timeout);
|
|
|
5929 |
context._hoverState = HOVER_STATE_OUT;
|
|
|
5930 |
|
|
|
5931 |
if (!context.config.delay || !context.config.delay.hide) {
|
|
|
5932 |
context.hide();
|
|
|
5933 |
return;
|
|
|
5934 |
}
|
|
|
5935 |
|
|
|
5936 |
context._timeout = setTimeout(function () {
|
|
|
5937 |
if (context._hoverState === HOVER_STATE_OUT) {
|
|
|
5938 |
context.hide();
|
|
|
5939 |
}
|
|
|
5940 |
}, context.config.delay.hide);
|
|
|
5941 |
};
|
|
|
5942 |
|
|
|
5943 |
_proto._isWithActiveTrigger = function _isWithActiveTrigger() {
|
|
|
5944 |
for (var trigger in this._activeTrigger) {
|
|
|
5945 |
if (this._activeTrigger[trigger]) {
|
|
|
5946 |
return true;
|
|
|
5947 |
}
|
|
|
5948 |
}
|
|
|
5949 |
|
|
|
5950 |
return false;
|
|
|
5951 |
};
|
|
|
5952 |
|
|
|
5953 |
_proto._getConfig = function _getConfig(config) {
|
|
|
5954 |
var dataAttributes = $__default['default'](this.element).data();
|
|
|
5955 |
Object.keys(dataAttributes).forEach(function (dataAttr) {
|
|
|
5956 |
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
|
|
|
5957 |
delete dataAttributes[dataAttr];
|
|
|
5958 |
}
|
|
|
5959 |
});
|
|
|
5960 |
config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
|
|
|
5961 |
|
|
|
5962 |
if (typeof config.delay === 'number') {
|
|
|
5963 |
config.delay = {
|
|
|
5964 |
show: config.delay,
|
|
|
5965 |
hide: config.delay
|
|
|
5966 |
};
|
|
|
5967 |
}
|
|
|
5968 |
|
|
|
5969 |
if (typeof config.title === 'number') {
|
|
|
5970 |
config.title = config.title.toString();
|
|
|
5971 |
}
|
|
|
5972 |
|
|
|
5973 |
if (typeof config.content === 'number') {
|
|
|
5974 |
config.content = config.content.toString();
|
|
|
5975 |
}
|
|
|
5976 |
|
|
|
5977 |
Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
|
|
|
5978 |
|
|
|
5979 |
if (config.sanitize) {
|
|
|
5980 |
config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
|
|
|
5981 |
}
|
|
|
5982 |
|
|
|
5983 |
return config;
|
|
|
5984 |
};
|
|
|
5985 |
|
|
|
5986 |
_proto._getDelegateConfig = function _getDelegateConfig() {
|
|
|
5987 |
var config = {};
|
|
|
5988 |
|
|
|
5989 |
if (this.config) {
|
|
|
5990 |
for (var key in this.config) {
|
|
|
5991 |
if (this.constructor.Default[key] !== this.config[key]) {
|
|
|
5992 |
config[key] = this.config[key];
|
|
|
5993 |
}
|
|
|
5994 |
}
|
|
|
5995 |
}
|
|
|
5996 |
|
|
|
5997 |
return config;
|
|
|
5998 |
};
|
|
|
5999 |
|
|
|
6000 |
_proto._cleanTipClass = function _cleanTipClass() {
|
|
|
6001 |
var $tip = $__default['default'](this.getTipElement());
|
|
|
6002 |
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
|
|
|
6003 |
|
|
|
6004 |
if (tabClass !== null && tabClass.length) {
|
|
|
6005 |
$tip.removeClass(tabClass.join(''));
|
|
|
6006 |
}
|
|
|
6007 |
};
|
|
|
6008 |
|
|
|
6009 |
_proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
|
|
|
6010 |
this.tip = popperData.instance.popper;
|
|
|
6011 |
|
|
|
6012 |
this._cleanTipClass();
|
|
|
6013 |
|
|
|
6014 |
this.addAttachmentClass(this._getAttachment(popperData.placement));
|
|
|
6015 |
};
|
|
|
6016 |
|
|
|
6017 |
_proto._fixTransition = function _fixTransition() {
|
|
|
6018 |
var tip = this.getTipElement();
|
|
|
6019 |
var initConfigAnimation = this.config.animation;
|
|
|
6020 |
|
|
|
6021 |
if (tip.getAttribute('x-placement') !== null) {
|
|
|
6022 |
return;
|
|
|
6023 |
}
|
|
|
6024 |
|
|
|
6025 |
$__default['default'](tip).removeClass(CLASS_NAME_FADE$2);
|
|
|
6026 |
this.config.animation = false;
|
|
|
6027 |
this.hide();
|
|
|
6028 |
this.show();
|
|
|
6029 |
this.config.animation = initConfigAnimation;
|
|
|
6030 |
} // Static
|
|
|
6031 |
;
|
|
|
6032 |
|
|
|
6033 |
Tooltip._jQueryInterface = function _jQueryInterface(config) {
|
|
|
6034 |
return this.each(function () {
|
|
|
6035 |
var $element = $__default['default'](this);
|
|
|
6036 |
var data = $element.data(DATA_KEY$6);
|
|
|
6037 |
|
|
|
6038 |
var _config = typeof config === 'object' && config;
|
|
|
6039 |
|
|
|
6040 |
if (!data && /dispose|hide/.test(config)) {
|
|
|
6041 |
return;
|
|
|
6042 |
}
|
|
|
6043 |
|
|
|
6044 |
if (!data) {
|
|
|
6045 |
data = new Tooltip(this, _config);
|
|
|
6046 |
$element.data(DATA_KEY$6, data);
|
|
|
6047 |
}
|
|
|
6048 |
|
|
|
6049 |
if (typeof config === 'string') {
|
|
|
6050 |
if (typeof data[config] === 'undefined') {
|
|
|
6051 |
throw new TypeError("No method named \"" + config + "\"");
|
|
|
6052 |
}
|
|
|
6053 |
|
|
|
6054 |
data[config]();
|
|
|
6055 |
}
|
|
|
6056 |
});
|
|
|
6057 |
};
|
|
|
6058 |
|
|
|
6059 |
_createClass(Tooltip, null, [{
|
|
|
6060 |
key: "VERSION",
|
|
|
6061 |
get: function get() {
|
|
|
6062 |
return VERSION$6;
|
|
|
6063 |
}
|
|
|
6064 |
}, {
|
|
|
6065 |
key: "Default",
|
|
|
6066 |
get: function get() {
|
|
|
6067 |
return Default$4;
|
|
|
6068 |
}
|
|
|
6069 |
}, {
|
|
|
6070 |
key: "NAME",
|
|
|
6071 |
get: function get() {
|
|
|
6072 |
return NAME$6;
|
|
|
6073 |
}
|
|
|
6074 |
}, {
|
|
|
6075 |
key: "DATA_KEY",
|
|
|
6076 |
get: function get() {
|
|
|
6077 |
return DATA_KEY$6;
|
|
|
6078 |
}
|
|
|
6079 |
}, {
|
|
|
6080 |
key: "Event",
|
|
|
6081 |
get: function get() {
|
|
|
6082 |
return Event;
|
|
|
6083 |
}
|
|
|
6084 |
}, {
|
|
|
6085 |
key: "EVENT_KEY",
|
|
|
6086 |
get: function get() {
|
|
|
6087 |
return EVENT_KEY$6;
|
|
|
6088 |
}
|
|
|
6089 |
}, {
|
|
|
6090 |
key: "DefaultType",
|
|
|
6091 |
get: function get() {
|
|
|
6092 |
return DefaultType$4;
|
|
|
6093 |
}
|
|
|
6094 |
}]);
|
|
|
6095 |
|
|
|
6096 |
return Tooltip;
|
|
|
6097 |
}();
|
|
|
6098 |
/**
|
|
|
6099 |
* ------------------------------------------------------------------------
|
|
|
6100 |
* jQuery
|
|
|
6101 |
* ------------------------------------------------------------------------
|
|
|
6102 |
*/
|
|
|
6103 |
|
|
|
6104 |
|
|
|
6105 |
$__default['default'].fn[NAME$6] = Tooltip._jQueryInterface;
|
|
|
6106 |
$__default['default'].fn[NAME$6].Constructor = Tooltip;
|
|
|
6107 |
|
|
|
6108 |
$__default['default'].fn[NAME$6].noConflict = function () {
|
|
|
6109 |
$__default['default'].fn[NAME$6] = JQUERY_NO_CONFLICT$6;
|
|
|
6110 |
return Tooltip._jQueryInterface;
|
|
|
6111 |
};
|
|
|
6112 |
|
|
|
6113 |
/**
|
|
|
6114 |
* ------------------------------------------------------------------------
|
|
|
6115 |
* Constants
|
|
|
6116 |
* ------------------------------------------------------------------------
|
|
|
6117 |
*/
|
|
|
6118 |
|
|
|
6119 |
var NAME$7 = 'popover';
|
|
|
6120 |
var VERSION$7 = '4.6.0';
|
|
|
6121 |
var DATA_KEY$7 = 'bs.popover';
|
|
|
6122 |
var EVENT_KEY$7 = "." + DATA_KEY$7;
|
|
|
6123 |
var JQUERY_NO_CONFLICT$7 = $__default['default'].fn[NAME$7];
|
|
|
6124 |
var CLASS_PREFIX$1 = 'bs-popover';
|
|
|
6125 |
var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
|
|
|
6126 |
|
|
|
6127 |
var Default$5 = _extends({}, Tooltip.Default, {
|
|
|
6128 |
placement: 'right',
|
|
|
6129 |
trigger: 'click',
|
|
|
6130 |
content: '',
|
|
|
6131 |
template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
|
|
|
6132 |
});
|
|
|
6133 |
|
|
|
6134 |
var DefaultType$5 = _extends({}, Tooltip.DefaultType, {
|
|
|
6135 |
content: '(string|element|function)'
|
|
|
6136 |
});
|
|
|
6137 |
|
|
|
6138 |
var CLASS_NAME_FADE$3 = 'fade';
|
|
|
6139 |
var CLASS_NAME_SHOW$5 = 'show';
|
|
|
6140 |
var SELECTOR_TITLE = '.popover-header';
|
|
|
6141 |
var SELECTOR_CONTENT = '.popover-body';
|
|
|
6142 |
var Event$1 = {
|
|
|
6143 |
HIDE: "hide" + EVENT_KEY$7,
|
|
|
6144 |
HIDDEN: "hidden" + EVENT_KEY$7,
|
|
|
6145 |
SHOW: "show" + EVENT_KEY$7,
|
|
|
6146 |
SHOWN: "shown" + EVENT_KEY$7,
|
|
|
6147 |
INSERTED: "inserted" + EVENT_KEY$7,
|
|
|
6148 |
CLICK: "click" + EVENT_KEY$7,
|
|
|
6149 |
FOCUSIN: "focusin" + EVENT_KEY$7,
|
|
|
6150 |
FOCUSOUT: "focusout" + EVENT_KEY$7,
|
|
|
6151 |
MOUSEENTER: "mouseenter" + EVENT_KEY$7,
|
|
|
6152 |
MOUSELEAVE: "mouseleave" + EVENT_KEY$7
|
|
|
6153 |
};
|
|
|
6154 |
/**
|
|
|
6155 |
* ------------------------------------------------------------------------
|
|
|
6156 |
* Class Definition
|
|
|
6157 |
* ------------------------------------------------------------------------
|
|
|
6158 |
*/
|
|
|
6159 |
|
|
|
6160 |
var Popover = /*#__PURE__*/function (_Tooltip) {
|
|
|
6161 |
_inheritsLoose(Popover, _Tooltip);
|
|
|
6162 |
|
|
|
6163 |
function Popover() {
|
|
|
6164 |
return _Tooltip.apply(this, arguments) || this;
|
|
|
6165 |
}
|
|
|
6166 |
|
|
|
6167 |
var _proto = Popover.prototype;
|
|
|
6168 |
|
|
|
6169 |
// Overrides
|
|
|
6170 |
_proto.isWithContent = function isWithContent() {
|
|
|
6171 |
return this.getTitle() || this._getContent();
|
|
|
6172 |
};
|
|
|
6173 |
|
|
|
6174 |
_proto.addAttachmentClass = function addAttachmentClass(attachment) {
|
|
|
6175 |
$__default['default'](this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
|
|
|
6176 |
};
|
|
|
6177 |
|
|
|
6178 |
_proto.getTipElement = function getTipElement() {
|
|
|
6179 |
this.tip = this.tip || $__default['default'](this.config.template)[0];
|
|
|
6180 |
return this.tip;
|
|
|
6181 |
};
|
|
|
6182 |
|
|
|
6183 |
_proto.setContent = function setContent() {
|
|
|
6184 |
var $tip = $__default['default'](this.getTipElement()); // We use append for html objects to maintain js events
|
|
|
6185 |
|
|
|
6186 |
this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle());
|
|
|
6187 |
|
|
|
6188 |
var content = this._getContent();
|
|
|
6189 |
|
|
|
6190 |
if (typeof content === 'function') {
|
|
|
6191 |
content = content.call(this.element);
|
|
|
6192 |
}
|
|
|
6193 |
|
|
|
6194 |
this.setElementContent($tip.find(SELECTOR_CONTENT), content);
|
|
|
6195 |
$tip.removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$5);
|
|
|
6196 |
} // Private
|
|
|
6197 |
;
|
|
|
6198 |
|
|
|
6199 |
_proto._getContent = function _getContent() {
|
|
|
6200 |
return this.element.getAttribute('data-content') || this.config.content;
|
|
|
6201 |
};
|
|
|
6202 |
|
|
|
6203 |
_proto._cleanTipClass = function _cleanTipClass() {
|
|
|
6204 |
var $tip = $__default['default'](this.getTipElement());
|
|
|
6205 |
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
|
|
|
6206 |
|
|
|
6207 |
if (tabClass !== null && tabClass.length > 0) {
|
|
|
6208 |
$tip.removeClass(tabClass.join(''));
|
|
|
6209 |
}
|
|
|
6210 |
} // Static
|
|
|
6211 |
;
|
|
|
6212 |
|
|
|
6213 |
Popover._jQueryInterface = function _jQueryInterface(config) {
|
|
|
6214 |
return this.each(function () {
|
|
|
6215 |
var data = $__default['default'](this).data(DATA_KEY$7);
|
|
|
6216 |
|
|
|
6217 |
var _config = typeof config === 'object' ? config : null;
|
|
|
6218 |
|
|
|
6219 |
if (!data && /dispose|hide/.test(config)) {
|
|
|
6220 |
return;
|
|
|
6221 |
}
|
|
|
6222 |
|
|
|
6223 |
if (!data) {
|
|
|
6224 |
data = new Popover(this, _config);
|
|
|
6225 |
$__default['default'](this).data(DATA_KEY$7, data);
|
|
|
6226 |
}
|
|
|
6227 |
|
|
|
6228 |
if (typeof config === 'string') {
|
|
|
6229 |
if (typeof data[config] === 'undefined') {
|
|
|
6230 |
throw new TypeError("No method named \"" + config + "\"");
|
|
|
6231 |
}
|
|
|
6232 |
|
|
|
6233 |
data[config]();
|
|
|
6234 |
}
|
|
|
6235 |
});
|
|
|
6236 |
};
|
|
|
6237 |
|
|
|
6238 |
_createClass(Popover, null, [{
|
|
|
6239 |
key: "VERSION",
|
|
|
6240 |
// Getters
|
|
|
6241 |
get: function get() {
|
|
|
6242 |
return VERSION$7;
|
|
|
6243 |
}
|
|
|
6244 |
}, {
|
|
|
6245 |
key: "Default",
|
|
|
6246 |
get: function get() {
|
|
|
6247 |
return Default$5;
|
|
|
6248 |
}
|
|
|
6249 |
}, {
|
|
|
6250 |
key: "NAME",
|
|
|
6251 |
get: function get() {
|
|
|
6252 |
return NAME$7;
|
|
|
6253 |
}
|
|
|
6254 |
}, {
|
|
|
6255 |
key: "DATA_KEY",
|
|
|
6256 |
get: function get() {
|
|
|
6257 |
return DATA_KEY$7;
|
|
|
6258 |
}
|
|
|
6259 |
}, {
|
|
|
6260 |
key: "Event",
|
|
|
6261 |
get: function get() {
|
|
|
6262 |
return Event$1;
|
|
|
6263 |
}
|
|
|
6264 |
}, {
|
|
|
6265 |
key: "EVENT_KEY",
|
|
|
6266 |
get: function get() {
|
|
|
6267 |
return EVENT_KEY$7;
|
|
|
6268 |
}
|
|
|
6269 |
}, {
|
|
|
6270 |
key: "DefaultType",
|
|
|
6271 |
get: function get() {
|
|
|
6272 |
return DefaultType$5;
|
|
|
6273 |
}
|
|
|
6274 |
}]);
|
|
|
6275 |
|
|
|
6276 |
return Popover;
|
|
|
6277 |
}(Tooltip);
|
|
|
6278 |
/**
|
|
|
6279 |
* ------------------------------------------------------------------------
|
|
|
6280 |
* jQuery
|
|
|
6281 |
* ------------------------------------------------------------------------
|
|
|
6282 |
*/
|
|
|
6283 |
|
|
|
6284 |
|
|
|
6285 |
$__default['default'].fn[NAME$7] = Popover._jQueryInterface;
|
|
|
6286 |
$__default['default'].fn[NAME$7].Constructor = Popover;
|
|
|
6287 |
|
|
|
6288 |
$__default['default'].fn[NAME$7].noConflict = function () {
|
|
|
6289 |
$__default['default'].fn[NAME$7] = JQUERY_NO_CONFLICT$7;
|
|
|
6290 |
return Popover._jQueryInterface;
|
|
|
6291 |
};
|
|
|
6292 |
|
|
|
6293 |
/**
|
|
|
6294 |
* ------------------------------------------------------------------------
|
|
|
6295 |
* Constants
|
|
|
6296 |
* ------------------------------------------------------------------------
|
|
|
6297 |
*/
|
|
|
6298 |
|
|
|
6299 |
var NAME$8 = 'scrollspy';
|
|
|
6300 |
var VERSION$8 = '4.6.0';
|
|
|
6301 |
var DATA_KEY$8 = 'bs.scrollspy';
|
|
|
6302 |
var EVENT_KEY$8 = "." + DATA_KEY$8;
|
|
|
6303 |
var DATA_API_KEY$6 = '.data-api';
|
|
|
6304 |
var JQUERY_NO_CONFLICT$8 = $__default['default'].fn[NAME$8];
|
|
|
6305 |
var Default$6 = {
|
|
|
6306 |
offset: 10,
|
|
|
6307 |
method: 'auto',
|
|
|
6308 |
target: ''
|
|
|
6309 |
};
|
|
|
6310 |
var DefaultType$6 = {
|
|
|
6311 |
offset: 'number',
|
|
|
6312 |
method: 'string',
|
|
|
6313 |
target: '(string|element)'
|
|
|
6314 |
};
|
|
|
6315 |
var EVENT_ACTIVATE = "activate" + EVENT_KEY$8;
|
|
|
6316 |
var EVENT_SCROLL = "scroll" + EVENT_KEY$8;
|
|
|
6317 |
var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$8 + DATA_API_KEY$6;
|
|
|
6318 |
var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
|
|
|
6319 |
var CLASS_NAME_ACTIVE$2 = 'active';
|
|
|
6320 |
var SELECTOR_DATA_SPY = '[data-spy="scroll"]';
|
|
|
6321 |
var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
|
|
6322 |
var SELECTOR_NAV_LINKS = '.nav-link';
|
|
|
6323 |
var SELECTOR_NAV_ITEMS = '.nav-item';
|
|
|
6324 |
var SELECTOR_LIST_ITEMS = '.list-group-item';
|
|
|
6325 |
var SELECTOR_DROPDOWN = '.dropdown';
|
|
|
6326 |
var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item';
|
|
|
6327 |
var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
|
|
6328 |
var METHOD_OFFSET = 'offset';
|
|
|
6329 |
var METHOD_POSITION = 'position';
|
|
|
6330 |
/**
|
|
|
6331 |
* ------------------------------------------------------------------------
|
|
|
6332 |
* Class Definition
|
|
|
6333 |
* ------------------------------------------------------------------------
|
|
|
6334 |
*/
|
|
|
6335 |
|
|
|
6336 |
var ScrollSpy = /*#__PURE__*/function () {
|
|
|
6337 |
function ScrollSpy(element, config) {
|
|
|
6338 |
var _this = this;
|
|
|
6339 |
|
|
|
6340 |
this._element = element;
|
|
|
6341 |
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
|
|
6342 |
this._config = this._getConfig(config);
|
|
|
6343 |
this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS);
|
|
|
6344 |
this._offsets = [];
|
|
|
6345 |
this._targets = [];
|
|
|
6346 |
this._activeTarget = null;
|
|
|
6347 |
this._scrollHeight = 0;
|
|
|
6348 |
$__default['default'](this._scrollElement).on(EVENT_SCROLL, function (event) {
|
|
|
6349 |
return _this._process(event);
|
|
|
6350 |
});
|
|
|
6351 |
this.refresh();
|
|
|
6352 |
|
|
|
6353 |
this._process();
|
|
|
6354 |
} // Getters
|
|
|
6355 |
|
|
|
6356 |
|
|
|
6357 |
var _proto = ScrollSpy.prototype;
|
|
|
6358 |
|
|
|
6359 |
// Public
|
|
|
6360 |
_proto.refresh = function refresh() {
|
|
|
6361 |
var _this2 = this;
|
|
|
6362 |
|
|
|
6363 |
var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
|
|
|
6364 |
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
|
|
|
6365 |
var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
|
|
|
6366 |
this._offsets = [];
|
|
|
6367 |
this._targets = [];
|
|
|
6368 |
this._scrollHeight = this._getScrollHeight();
|
|
|
6369 |
var targets = [].slice.call(document.querySelectorAll(this._selector));
|
|
|
6370 |
targets.map(function (element) {
|
|
|
6371 |
var target;
|
|
|
6372 |
var targetSelector = Util.getSelectorFromElement(element);
|
|
|
6373 |
|
|
|
6374 |
if (targetSelector) {
|
|
|
6375 |
target = document.querySelector(targetSelector);
|
|
|
6376 |
}
|
|
|
6377 |
|
|
|
6378 |
if (target) {
|
|
|
6379 |
var targetBCR = target.getBoundingClientRect();
|
|
|
6380 |
|
|
|
6381 |
if (targetBCR.width || targetBCR.height) {
|
|
|
6382 |
// TODO (fat): remove sketch reliance on jQuery position/offset
|
|
|
6383 |
return [$__default['default'](target)[offsetMethod]().top + offsetBase, targetSelector];
|
|
|
6384 |
}
|
|
|
6385 |
}
|
|
|
6386 |
|
|
|
6387 |
return null;
|
|
|
6388 |
}).filter(function (item) {
|
|
|
6389 |
return item;
|
|
|
6390 |
}).sort(function (a, b) {
|
|
|
6391 |
return a[0] - b[0];
|
|
|
6392 |
}).forEach(function (item) {
|
|
|
6393 |
_this2._offsets.push(item[0]);
|
|
|
6394 |
|
|
|
6395 |
_this2._targets.push(item[1]);
|
|
|
6396 |
});
|
|
|
6397 |
};
|
|
|
6398 |
|
|
|
6399 |
_proto.dispose = function dispose() {
|
|
|
6400 |
$__default['default'].removeData(this._element, DATA_KEY$8);
|
|
|
6401 |
$__default['default'](this._scrollElement).off(EVENT_KEY$8);
|
|
|
6402 |
this._element = null;
|
|
|
6403 |
this._scrollElement = null;
|
|
|
6404 |
this._config = null;
|
|
|
6405 |
this._selector = null;
|
|
|
6406 |
this._offsets = null;
|
|
|
6407 |
this._targets = null;
|
|
|
6408 |
this._activeTarget = null;
|
|
|
6409 |
this._scrollHeight = null;
|
|
|
6410 |
} // Private
|
|
|
6411 |
;
|
|
|
6412 |
|
|
|
6413 |
_proto._getConfig = function _getConfig(config) {
|
|
|
6414 |
config = _extends({}, Default$6, typeof config === 'object' && config ? config : {});
|
|
|
6415 |
|
|
|
6416 |
if (typeof config.target !== 'string' && Util.isElement(config.target)) {
|
|
|
6417 |
var id = $__default['default'](config.target).attr('id');
|
|
|
6418 |
|
|
|
6419 |
if (!id) {
|
|
|
6420 |
id = Util.getUID(NAME$8);
|
|
|
6421 |
$__default['default'](config.target).attr('id', id);
|
|
|
6422 |
}
|
|
|
6423 |
|
|
|
6424 |
config.target = "#" + id;
|
|
|
6425 |
}
|
|
|
6426 |
|
|
|
6427 |
Util.typeCheckConfig(NAME$8, config, DefaultType$6);
|
|
|
6428 |
return config;
|
|
|
6429 |
};
|
|
|
6430 |
|
|
|
6431 |
_proto._getScrollTop = function _getScrollTop() {
|
|
|
6432 |
return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
|
|
|
6433 |
};
|
|
|
6434 |
|
|
|
6435 |
_proto._getScrollHeight = function _getScrollHeight() {
|
|
|
6436 |
return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
|
|
|
6437 |
};
|
|
|
6438 |
|
|
|
6439 |
_proto._getOffsetHeight = function _getOffsetHeight() {
|
|
|
6440 |
return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
|
|
|
6441 |
};
|
|
|
6442 |
|
|
|
6443 |
_proto._process = function _process() {
|
|
|
6444 |
var scrollTop = this._getScrollTop() + this._config.offset;
|
|
|
6445 |
|
|
|
6446 |
var scrollHeight = this._getScrollHeight();
|
|
|
6447 |
|
|
|
6448 |
var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
|
|
|
6449 |
|
|
|
6450 |
if (this._scrollHeight !== scrollHeight) {
|
|
|
6451 |
this.refresh();
|
|
|
6452 |
}
|
|
|
6453 |
|
|
|
6454 |
if (scrollTop >= maxScroll) {
|
|
|
6455 |
var target = this._targets[this._targets.length - 1];
|
|
|
6456 |
|
|
|
6457 |
if (this._activeTarget !== target) {
|
|
|
6458 |
this._activate(target);
|
|
|
6459 |
}
|
|
|
6460 |
|
|
|
6461 |
return;
|
|
|
6462 |
}
|
|
|
6463 |
|
|
|
6464 |
if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
|
|
|
6465 |
this._activeTarget = null;
|
|
|
6466 |
|
|
|
6467 |
this._clear();
|
|
|
6468 |
|
|
|
6469 |
return;
|
|
|
6470 |
}
|
|
|
6471 |
|
|
|
6472 |
for (var i = this._offsets.length; i--;) {
|
|
|
6473 |
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
|
|
|
6474 |
|
|
|
6475 |
if (isActiveTarget) {
|
|
|
6476 |
this._activate(this._targets[i]);
|
|
|
6477 |
}
|
|
|
6478 |
}
|
|
|
6479 |
};
|
|
|
6480 |
|
|
|
6481 |
_proto._activate = function _activate(target) {
|
|
|
6482 |
this._activeTarget = target;
|
|
|
6483 |
|
|
|
6484 |
this._clear();
|
|
|
6485 |
|
|
|
6486 |
var queries = this._selector.split(',').map(function (selector) {
|
|
|
6487 |
return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
|
|
|
6488 |
});
|
|
|
6489 |
|
|
|
6490 |
var $link = $__default['default']([].slice.call(document.querySelectorAll(queries.join(','))));
|
|
|
6491 |
|
|
|
6492 |
if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) {
|
|
|
6493 |
$link.closest(SELECTOR_DROPDOWN).find(SELECTOR_DROPDOWN_TOGGLE).addClass(CLASS_NAME_ACTIVE$2);
|
|
|
6494 |
$link.addClass(CLASS_NAME_ACTIVE$2);
|
|
|
6495 |
} else {
|
|
|
6496 |
// Set triggered link as active
|
|
|
6497 |
$link.addClass(CLASS_NAME_ACTIVE$2); // Set triggered links parents as active
|
|
|
6498 |
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
|
|
6499 |
|
|
|
6500 |
$link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$2); // Handle special case when .nav-link is inside .nav-item
|
|
|
6501 |
|
|
|
6502 |
$link.parents(SELECTOR_NAV_LIST_GROUP).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$2);
|
|
|
6503 |
}
|
|
|
6504 |
|
|
|
6505 |
$__default['default'](this._scrollElement).trigger(EVENT_ACTIVATE, {
|
|
|
6506 |
relatedTarget: target
|
|
|
6507 |
});
|
|
|
6508 |
};
|
|
|
6509 |
|
|
|
6510 |
_proto._clear = function _clear() {
|
|
|
6511 |
[].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
|
|
|
6512 |
return node.classList.contains(CLASS_NAME_ACTIVE$2);
|
|
|
6513 |
}).forEach(function (node) {
|
|
|
6514 |
return node.classList.remove(CLASS_NAME_ACTIVE$2);
|
|
|
6515 |
});
|
|
|
6516 |
} // Static
|
|
|
6517 |
;
|
|
|
6518 |
|
|
|
6519 |
ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
|
|
|
6520 |
return this.each(function () {
|
|
|
6521 |
var data = $__default['default'](this).data(DATA_KEY$8);
|
|
|
6522 |
|
|
|
6523 |
var _config = typeof config === 'object' && config;
|
|
|
6524 |
|
|
|
6525 |
if (!data) {
|
|
|
6526 |
data = new ScrollSpy(this, _config);
|
|
|
6527 |
$__default['default'](this).data(DATA_KEY$8, data);
|
|
|
6528 |
}
|
|
|
6529 |
|
|
|
6530 |
if (typeof config === 'string') {
|
|
|
6531 |
if (typeof data[config] === 'undefined') {
|
|
|
6532 |
throw new TypeError("No method named \"" + config + "\"");
|
|
|
6533 |
}
|
|
|
6534 |
|
|
|
6535 |
data[config]();
|
|
|
6536 |
}
|
|
|
6537 |
});
|
|
|
6538 |
};
|
|
|
6539 |
|
|
|
6540 |
_createClass(ScrollSpy, null, [{
|
|
|
6541 |
key: "VERSION",
|
|
|
6542 |
get: function get() {
|
|
|
6543 |
return VERSION$8;
|
|
|
6544 |
}
|
|
|
6545 |
}, {
|
|
|
6546 |
key: "Default",
|
|
|
6547 |
get: function get() {
|
|
|
6548 |
return Default$6;
|
|
|
6549 |
}
|
|
|
6550 |
}]);
|
|
|
6551 |
|
|
|
6552 |
return ScrollSpy;
|
|
|
6553 |
}();
|
|
|
6554 |
/**
|
|
|
6555 |
* ------------------------------------------------------------------------
|
|
|
6556 |
* Data Api implementation
|
|
|
6557 |
* ------------------------------------------------------------------------
|
|
|
6558 |
*/
|
|
|
6559 |
|
|
|
6560 |
|
|
|
6561 |
$__default['default'](window).on(EVENT_LOAD_DATA_API$2, function () {
|
|
|
6562 |
var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY));
|
|
|
6563 |
var scrollSpysLength = scrollSpys.length;
|
|
|
6564 |
|
|
|
6565 |
for (var i = scrollSpysLength; i--;) {
|
|
|
6566 |
var $spy = $__default['default'](scrollSpys[i]);
|
|
|
6567 |
|
|
|
6568 |
ScrollSpy._jQueryInterface.call($spy, $spy.data());
|
|
|
6569 |
}
|
|
|
6570 |
});
|
|
|
6571 |
/**
|
|
|
6572 |
* ------------------------------------------------------------------------
|
|
|
6573 |
* jQuery
|
|
|
6574 |
* ------------------------------------------------------------------------
|
|
|
6575 |
*/
|
|
|
6576 |
|
|
|
6577 |
$__default['default'].fn[NAME$8] = ScrollSpy._jQueryInterface;
|
|
|
6578 |
$__default['default'].fn[NAME$8].Constructor = ScrollSpy;
|
|
|
6579 |
|
|
|
6580 |
$__default['default'].fn[NAME$8].noConflict = function () {
|
|
|
6581 |
$__default['default'].fn[NAME$8] = JQUERY_NO_CONFLICT$8;
|
|
|
6582 |
return ScrollSpy._jQueryInterface;
|
|
|
6583 |
};
|
|
|
6584 |
|
|
|
6585 |
/**
|
|
|
6586 |
* ------------------------------------------------------------------------
|
|
|
6587 |
* Constants
|
|
|
6588 |
* ------------------------------------------------------------------------
|
|
|
6589 |
*/
|
|
|
6590 |
|
|
|
6591 |
var NAME$9 = 'tab';
|
|
|
6592 |
var VERSION$9 = '4.6.0';
|
|
|
6593 |
var DATA_KEY$9 = 'bs.tab';
|
|
|
6594 |
var EVENT_KEY$9 = "." + DATA_KEY$9;
|
|
|
6595 |
var DATA_API_KEY$7 = '.data-api';
|
|
|
6596 |
var JQUERY_NO_CONFLICT$9 = $__default['default'].fn[NAME$9];
|
|
|
6597 |
var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
|
|
|
6598 |
var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
|
|
|
6599 |
var EVENT_SHOW$3 = "show" + EVENT_KEY$9;
|
|
|
6600 |
var EVENT_SHOWN$3 = "shown" + EVENT_KEY$9;
|
|
|
6601 |
var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$9 + DATA_API_KEY$7;
|
|
|
6602 |
var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
|
|
|
6603 |
var CLASS_NAME_ACTIVE$3 = 'active';
|
|
|
6604 |
var CLASS_NAME_DISABLED$1 = 'disabled';
|
|
|
6605 |
var CLASS_NAME_FADE$4 = 'fade';
|
|
|
6606 |
var CLASS_NAME_SHOW$6 = 'show';
|
|
|
6607 |
var SELECTOR_DROPDOWN$1 = '.dropdown';
|
|
|
6608 |
var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
|
|
|
6609 |
var SELECTOR_ACTIVE$2 = '.active';
|
|
|
6610 |
var SELECTOR_ACTIVE_UL = '> li > .active';
|
|
|
6611 |
var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
|
|
|
6612 |
var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
|
|
|
6613 |
var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active';
|
|
|
6614 |
/**
|
|
|
6615 |
* ------------------------------------------------------------------------
|
|
|
6616 |
* Class Definition
|
|
|
6617 |
* ------------------------------------------------------------------------
|
|
|
6618 |
*/
|
|
|
6619 |
|
|
|
6620 |
var Tab = /*#__PURE__*/function () {
|
|
|
6621 |
function Tab(element) {
|
|
|
6622 |
this._element = element;
|
|
|
6623 |
} // Getters
|
|
|
6624 |
|
|
|
6625 |
|
|
|
6626 |
var _proto = Tab.prototype;
|
|
|
6627 |
|
|
|
6628 |
// Public
|
|
|
6629 |
_proto.show = function show() {
|
|
|
6630 |
var _this = this;
|
|
|
6631 |
|
|
|
6632 |
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $__default['default'](this._element).hasClass(CLASS_NAME_ACTIVE$3) || $__default['default'](this._element).hasClass(CLASS_NAME_DISABLED$1)) {
|
|
|
6633 |
return;
|
|
|
6634 |
}
|
|
|
6635 |
|
|
|
6636 |
var target;
|
|
|
6637 |
var previous;
|
|
|
6638 |
var listElement = $__default['default'](this._element).closest(SELECTOR_NAV_LIST_GROUP$1)[0];
|
|
|
6639 |
var selector = Util.getSelectorFromElement(this._element);
|
|
|
6640 |
|
|
|
6641 |
if (listElement) {
|
|
|
6642 |
var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE$2;
|
|
|
6643 |
previous = $__default['default'].makeArray($__default['default'](listElement).find(itemSelector));
|
|
|
6644 |
previous = previous[previous.length - 1];
|
|
|
6645 |
}
|
|
|
6646 |
|
|
|
6647 |
var hideEvent = $__default['default'].Event(EVENT_HIDE$3, {
|
|
|
6648 |
relatedTarget: this._element
|
|
|
6649 |
});
|
|
|
6650 |
var showEvent = $__default['default'].Event(EVENT_SHOW$3, {
|
|
|
6651 |
relatedTarget: previous
|
|
|
6652 |
});
|
|
|
6653 |
|
|
|
6654 |
if (previous) {
|
|
|
6655 |
$__default['default'](previous).trigger(hideEvent);
|
|
|
6656 |
}
|
|
|
6657 |
|
|
|
6658 |
$__default['default'](this._element).trigger(showEvent);
|
|
|
6659 |
|
|
|
6660 |
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
|
|
|
6661 |
return;
|
|
|
6662 |
}
|
|
|
6663 |
|
|
|
6664 |
if (selector) {
|
|
|
6665 |
target = document.querySelector(selector);
|
|
|
6666 |
}
|
|
|
6667 |
|
|
|
6668 |
this._activate(this._element, listElement);
|
|
|
6669 |
|
|
|
6670 |
var complete = function complete() {
|
|
|
6671 |
var hiddenEvent = $__default['default'].Event(EVENT_HIDDEN$3, {
|
|
|
6672 |
relatedTarget: _this._element
|
|
|
6673 |
});
|
|
|
6674 |
var shownEvent = $__default['default'].Event(EVENT_SHOWN$3, {
|
|
|
6675 |
relatedTarget: previous
|
|
|
6676 |
});
|
|
|
6677 |
$__default['default'](previous).trigger(hiddenEvent);
|
|
|
6678 |
$__default['default'](_this._element).trigger(shownEvent);
|
|
|
6679 |
};
|
|
|
6680 |
|
|
|
6681 |
if (target) {
|
|
|
6682 |
this._activate(target, target.parentNode, complete);
|
|
|
6683 |
} else {
|
|
|
6684 |
complete();
|
|
|
6685 |
}
|
|
|
6686 |
};
|
|
|
6687 |
|
|
|
6688 |
_proto.dispose = function dispose() {
|
|
|
6689 |
$__default['default'].removeData(this._element, DATA_KEY$9);
|
|
|
6690 |
this._element = null;
|
|
|
6691 |
} // Private
|
|
|
6692 |
;
|
|
|
6693 |
|
|
|
6694 |
_proto._activate = function _activate(element, container, callback) {
|
|
|
6695 |
var _this2 = this;
|
|
|
6696 |
|
|
|
6697 |
var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $__default['default'](container).find(SELECTOR_ACTIVE_UL) : $__default['default'](container).children(SELECTOR_ACTIVE$2);
|
|
|
6698 |
var active = activeElements[0];
|
|
|
6699 |
var isTransitioning = callback && active && $__default['default'](active).hasClass(CLASS_NAME_FADE$4);
|
|
|
6700 |
|
|
|
6701 |
var complete = function complete() {
|
|
|
6702 |
return _this2._transitionComplete(element, active, callback);
|
|
|
6703 |
};
|
|
|
6704 |
|
|
|
6705 |
if (active && isTransitioning) {
|
|
|
6706 |
var transitionDuration = Util.getTransitionDurationFromElement(active);
|
|
|
6707 |
$__default['default'](active).removeClass(CLASS_NAME_SHOW$6).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
|
|
6708 |
} else {
|
|
|
6709 |
complete();
|
|
|
6710 |
}
|
|
|
6711 |
};
|
|
|
6712 |
|
|
|
6713 |
_proto._transitionComplete = function _transitionComplete(element, active, callback) {
|
|
|
6714 |
if (active) {
|
|
|
6715 |
$__default['default'](active).removeClass(CLASS_NAME_ACTIVE$3);
|
|
|
6716 |
var dropdownChild = $__default['default'](active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0];
|
|
|
6717 |
|
|
|
6718 |
if (dropdownChild) {
|
|
|
6719 |
$__default['default'](dropdownChild).removeClass(CLASS_NAME_ACTIVE$3);
|
|
|
6720 |
}
|
|
|
6721 |
|
|
|
6722 |
if (active.getAttribute('role') === 'tab') {
|
|
|
6723 |
active.setAttribute('aria-selected', false);
|
|
|
6724 |
}
|
|
|
6725 |
}
|
|
|
6726 |
|
|
|
6727 |
$__default['default'](element).addClass(CLASS_NAME_ACTIVE$3);
|
|
|
6728 |
|
|
|
6729 |
if (element.getAttribute('role') === 'tab') {
|
|
|
6730 |
element.setAttribute('aria-selected', true);
|
|
|
6731 |
}
|
|
|
6732 |
|
|
|
6733 |
Util.reflow(element);
|
|
|
6734 |
|
|
|
6735 |
if (element.classList.contains(CLASS_NAME_FADE$4)) {
|
|
|
6736 |
element.classList.add(CLASS_NAME_SHOW$6);
|
|
|
6737 |
}
|
|
|
6738 |
|
|
|
6739 |
if (element.parentNode && $__default['default'](element.parentNode).hasClass(CLASS_NAME_DROPDOWN_MENU)) {
|
|
|
6740 |
var dropdownElement = $__default['default'](element).closest(SELECTOR_DROPDOWN$1)[0];
|
|
|
6741 |
|
|
|
6742 |
if (dropdownElement) {
|
|
|
6743 |
var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE$1));
|
|
|
6744 |
$__default['default'](dropdownToggleList).addClass(CLASS_NAME_ACTIVE$3);
|
|
|
6745 |
}
|
|
|
6746 |
|
|
|
6747 |
element.setAttribute('aria-expanded', true);
|
|
|
6748 |
}
|
|
|
6749 |
|
|
|
6750 |
if (callback) {
|
|
|
6751 |
callback();
|
|
|
6752 |
}
|
|
|
6753 |
} // Static
|
|
|
6754 |
;
|
|
|
6755 |
|
|
|
6756 |
Tab._jQueryInterface = function _jQueryInterface(config) {
|
|
|
6757 |
return this.each(function () {
|
|
|
6758 |
var $this = $__default['default'](this);
|
|
|
6759 |
var data = $this.data(DATA_KEY$9);
|
|
|
6760 |
|
|
|
6761 |
if (!data) {
|
|
|
6762 |
data = new Tab(this);
|
|
|
6763 |
$this.data(DATA_KEY$9, data);
|
|
|
6764 |
}
|
|
|
6765 |
|
|
|
6766 |
if (typeof config === 'string') {
|
|
|
6767 |
if (typeof data[config] === 'undefined') {
|
|
|
6768 |
throw new TypeError("No method named \"" + config + "\"");
|
|
|
6769 |
}
|
|
|
6770 |
|
|
|
6771 |
data[config]();
|
|
|
6772 |
}
|
|
|
6773 |
});
|
|
|
6774 |
};
|
|
|
6775 |
|
|
|
6776 |
_createClass(Tab, null, [{
|
|
|
6777 |
key: "VERSION",
|
|
|
6778 |
get: function get() {
|
|
|
6779 |
return VERSION$9;
|
|
|
6780 |
}
|
|
|
6781 |
}]);
|
|
|
6782 |
|
|
|
6783 |
return Tab;
|
|
|
6784 |
}();
|
|
|
6785 |
/**
|
|
|
6786 |
* ------------------------------------------------------------------------
|
|
|
6787 |
* Data Api implementation
|
|
|
6788 |
* ------------------------------------------------------------------------
|
|
|
6789 |
*/
|
|
|
6790 |
|
|
|
6791 |
|
|
|
6792 |
$__default['default'](document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$4, function (event) {
|
|
|
6793 |
event.preventDefault();
|
|
|
6794 |
|
|
|
6795 |
Tab._jQueryInterface.call($__default['default'](this), 'show');
|
|
|
6796 |
});
|
|
|
6797 |
/**
|
|
|
6798 |
* ------------------------------------------------------------------------
|
|
|
6799 |
* jQuery
|
|
|
6800 |
* ------------------------------------------------------------------------
|
|
|
6801 |
*/
|
|
|
6802 |
|
|
|
6803 |
$__default['default'].fn[NAME$9] = Tab._jQueryInterface;
|
|
|
6804 |
$__default['default'].fn[NAME$9].Constructor = Tab;
|
|
|
6805 |
|
|
|
6806 |
$__default['default'].fn[NAME$9].noConflict = function () {
|
|
|
6807 |
$__default['default'].fn[NAME$9] = JQUERY_NO_CONFLICT$9;
|
|
|
6808 |
return Tab._jQueryInterface;
|
|
|
6809 |
};
|
|
|
6810 |
|
|
|
6811 |
/**
|
|
|
6812 |
* ------------------------------------------------------------------------
|
|
|
6813 |
* Constants
|
|
|
6814 |
* ------------------------------------------------------------------------
|
|
|
6815 |
*/
|
|
|
6816 |
|
|
|
6817 |
var NAME$a = 'toast';
|
|
|
6818 |
var VERSION$a = '4.6.0';
|
|
|
6819 |
var DATA_KEY$a = 'bs.toast';
|
|
|
6820 |
var EVENT_KEY$a = "." + DATA_KEY$a;
|
|
|
6821 |
var JQUERY_NO_CONFLICT$a = $__default['default'].fn[NAME$a];
|
|
|
6822 |
var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
|
|
|
6823 |
var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
|
|
|
6824 |
var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
|
|
|
6825 |
var EVENT_SHOW$4 = "show" + EVENT_KEY$a;
|
|
|
6826 |
var EVENT_SHOWN$4 = "shown" + EVENT_KEY$a;
|
|
|
6827 |
var CLASS_NAME_FADE$5 = 'fade';
|
|
|
6828 |
var CLASS_NAME_HIDE = 'hide';
|
|
|
6829 |
var CLASS_NAME_SHOW$7 = 'show';
|
|
|
6830 |
var CLASS_NAME_SHOWING = 'showing';
|
|
|
6831 |
var DefaultType$7 = {
|
|
|
6832 |
animation: 'boolean',
|
|
|
6833 |
autohide: 'boolean',
|
|
|
6834 |
delay: 'number'
|
|
|
6835 |
};
|
|
|
6836 |
var Default$7 = {
|
|
|
6837 |
animation: true,
|
|
|
6838 |
autohide: true,
|
|
|
6839 |
delay: 500
|
|
|
6840 |
};
|
|
|
6841 |
var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
|
|
|
6842 |
/**
|
|
|
6843 |
* ------------------------------------------------------------------------
|
|
|
6844 |
* Class Definition
|
|
|
6845 |
* ------------------------------------------------------------------------
|
|
|
6846 |
*/
|
|
|
6847 |
|
|
|
6848 |
var Toast = /*#__PURE__*/function () {
|
|
|
6849 |
function Toast(element, config) {
|
|
|
6850 |
this._element = element;
|
|
|
6851 |
this._config = this._getConfig(config);
|
|
|
6852 |
this._timeout = null;
|
|
|
6853 |
|
|
|
6854 |
this._setListeners();
|
|
|
6855 |
} // Getters
|
|
|
6856 |
|
|
|
6857 |
|
|
|
6858 |
var _proto = Toast.prototype;
|
|
|
6859 |
|
|
|
6860 |
// Public
|
|
|
6861 |
_proto.show = function show() {
|
|
|
6862 |
var _this = this;
|
|
|
6863 |
|
|
|
6864 |
var showEvent = $__default['default'].Event(EVENT_SHOW$4);
|
|
|
6865 |
$__default['default'](this._element).trigger(showEvent);
|
|
|
6866 |
|
|
|
6867 |
if (showEvent.isDefaultPrevented()) {
|
|
|
6868 |
return;
|
|
|
6869 |
}
|
|
|
6870 |
|
|
|
6871 |
this._clearTimeout();
|
|
|
6872 |
|
|
|
6873 |
if (this._config.animation) {
|
|
|
6874 |
this._element.classList.add(CLASS_NAME_FADE$5);
|
|
|
6875 |
}
|
|
|
6876 |
|
|
|
6877 |
var complete = function complete() {
|
|
|
6878 |
_this._element.classList.remove(CLASS_NAME_SHOWING);
|
|
|
6879 |
|
|
|
6880 |
_this._element.classList.add(CLASS_NAME_SHOW$7);
|
|
|
6881 |
|
|
|
6882 |
$__default['default'](_this._element).trigger(EVENT_SHOWN$4);
|
|
|
6883 |
|
|
|
6884 |
if (_this._config.autohide) {
|
|
|
6885 |
_this._timeout = setTimeout(function () {
|
|
|
6886 |
_this.hide();
|
|
|
6887 |
}, _this._config.delay);
|
|
|
6888 |
}
|
|
|
6889 |
};
|
|
|
6890 |
|
|
|
6891 |
this._element.classList.remove(CLASS_NAME_HIDE);
|
|
|
6892 |
|
|
|
6893 |
Util.reflow(this._element);
|
|
|
6894 |
|
|
|
6895 |
this._element.classList.add(CLASS_NAME_SHOWING);
|
|
|
6896 |
|
|
|
6897 |
if (this._config.animation) {
|
|
|
6898 |
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
|
|
6899 |
$__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
|
|
6900 |
} else {
|
|
|
6901 |
complete();
|
|
|
6902 |
}
|
|
|
6903 |
};
|
|
|
6904 |
|
|
|
6905 |
_proto.hide = function hide() {
|
|
|
6906 |
if (!this._element.classList.contains(CLASS_NAME_SHOW$7)) {
|
|
|
6907 |
return;
|
|
|
6908 |
}
|
|
|
6909 |
|
|
|
6910 |
var hideEvent = $__default['default'].Event(EVENT_HIDE$4);
|
|
|
6911 |
$__default['default'](this._element).trigger(hideEvent);
|
|
|
6912 |
|
|
|
6913 |
if (hideEvent.isDefaultPrevented()) {
|
|
|
6914 |
return;
|
|
|
6915 |
}
|
|
|
6916 |
|
|
|
6917 |
this._close();
|
|
|
6918 |
};
|
|
|
6919 |
|
|
|
6920 |
_proto.dispose = function dispose() {
|
|
|
6921 |
this._clearTimeout();
|
|
|
6922 |
|
|
|
6923 |
if (this._element.classList.contains(CLASS_NAME_SHOW$7)) {
|
|
|
6924 |
this._element.classList.remove(CLASS_NAME_SHOW$7);
|
|
|
6925 |
}
|
|
|
6926 |
|
|
|
6927 |
$__default['default'](this._element).off(EVENT_CLICK_DISMISS$1);
|
|
|
6928 |
$__default['default'].removeData(this._element, DATA_KEY$a);
|
|
|
6929 |
this._element = null;
|
|
|
6930 |
this._config = null;
|
|
|
6931 |
} // Private
|
|
|
6932 |
;
|
|
|
6933 |
|
|
|
6934 |
_proto._getConfig = function _getConfig(config) {
|
|
|
6935 |
config = _extends({}, Default$7, $__default['default'](this._element).data(), typeof config === 'object' && config ? config : {});
|
|
|
6936 |
Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
|
|
|
6937 |
return config;
|
|
|
6938 |
};
|
|
|
6939 |
|
|
|
6940 |
_proto._setListeners = function _setListeners() {
|
|
|
6941 |
var _this2 = this;
|
|
|
6942 |
|
|
|
6943 |
$__default['default'](this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
|
|
|
6944 |
return _this2.hide();
|
|
|
6945 |
});
|
|
|
6946 |
};
|
|
|
6947 |
|
|
|
6948 |
_proto._close = function _close() {
|
|
|
6949 |
var _this3 = this;
|
|
|
6950 |
|
|
|
6951 |
var complete = function complete() {
|
|
|
6952 |
_this3._element.classList.add(CLASS_NAME_HIDE);
|
|
|
6953 |
|
|
|
6954 |
$__default['default'](_this3._element).trigger(EVENT_HIDDEN$4);
|
|
|
6955 |
};
|
|
|
6956 |
|
|
|
6957 |
this._element.classList.remove(CLASS_NAME_SHOW$7);
|
|
|
6958 |
|
|
|
6959 |
if (this._config.animation) {
|
|
|
6960 |
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
|
|
6961 |
$__default['default'](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
|
|
6962 |
} else {
|
|
|
6963 |
complete();
|
|
|
6964 |
}
|
|
|
6965 |
};
|
|
|
6966 |
|
|
|
6967 |
_proto._clearTimeout = function _clearTimeout() {
|
|
|
6968 |
clearTimeout(this._timeout);
|
|
|
6969 |
this._timeout = null;
|
|
|
6970 |
} // Static
|
|
|
6971 |
;
|
|
|
6972 |
|
|
|
6973 |
Toast._jQueryInterface = function _jQueryInterface(config) {
|
|
|
6974 |
return this.each(function () {
|
|
|
6975 |
var $element = $__default['default'](this);
|
|
|
6976 |
var data = $element.data(DATA_KEY$a);
|
|
|
6977 |
|
|
|
6978 |
var _config = typeof config === 'object' && config;
|
|
|
6979 |
|
|
|
6980 |
if (!data) {
|
|
|
6981 |
data = new Toast(this, _config);
|
|
|
6982 |
$element.data(DATA_KEY$a, data);
|
|
|
6983 |
}
|
|
|
6984 |
|
|
|
6985 |
if (typeof config === 'string') {
|
|
|
6986 |
if (typeof data[config] === 'undefined') {
|
|
|
6987 |
throw new TypeError("No method named \"" + config + "\"");
|
|
|
6988 |
}
|
|
|
6989 |
|
|
|
6990 |
data[config](this);
|
|
|
6991 |
}
|
|
|
6992 |
});
|
|
|
6993 |
};
|
|
|
6994 |
|
|
|
6995 |
_createClass(Toast, null, [{
|
|
|
6996 |
key: "VERSION",
|
|
|
6997 |
get: function get() {
|
|
|
6998 |
return VERSION$a;
|
|
|
6999 |
}
|
|
|
7000 |
}, {
|
|
|
7001 |
key: "DefaultType",
|
|
|
7002 |
get: function get() {
|
|
|
7003 |
return DefaultType$7;
|
|
|
7004 |
}
|
|
|
7005 |
}, {
|
|
|
7006 |
key: "Default",
|
|
|
7007 |
get: function get() {
|
|
|
7008 |
return Default$7;
|
|
|
7009 |
}
|
|
|
7010 |
}]);
|
|
|
7011 |
|
|
|
7012 |
return Toast;
|
|
|
7013 |
}();
|
|
|
7014 |
/**
|
|
|
7015 |
* ------------------------------------------------------------------------
|
|
|
7016 |
* jQuery
|
|
|
7017 |
* ------------------------------------------------------------------------
|
|
|
7018 |
*/
|
|
|
7019 |
|
|
|
7020 |
|
|
|
7021 |
$__default['default'].fn[NAME$a] = Toast._jQueryInterface;
|
|
|
7022 |
$__default['default'].fn[NAME$a].Constructor = Toast;
|
|
|
7023 |
|
|
|
7024 |
$__default['default'].fn[NAME$a].noConflict = function () {
|
|
|
7025 |
$__default['default'].fn[NAME$a] = JQUERY_NO_CONFLICT$a;
|
|
|
7026 |
return Toast._jQueryInterface;
|
|
|
7027 |
};
|
|
|
7028 |
|
|
|
7029 |
exports.Alert = Alert;
|
|
|
7030 |
exports.Button = Button;
|
|
|
7031 |
exports.Carousel = Carousel;
|
|
|
7032 |
exports.Collapse = Collapse;
|
|
|
7033 |
exports.Dropdown = Dropdown;
|
|
|
7034 |
exports.Modal = Modal;
|
|
|
7035 |
exports.Popover = Popover;
|
|
|
7036 |
exports.Scrollspy = ScrollSpy;
|
|
|
7037 |
exports.Tab = Tab;
|
|
|
7038 |
exports.Toast = Toast;
|
|
|
7039 |
exports.Tooltip = Tooltip;
|
|
|
7040 |
exports.Util = Util;
|
|
|
7041 |
|
|
|
7042 |
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
7043 |
|
|
|
7044 |
})));
|
|
|
7045 |
//# sourceMappingURL=bootstrap.bundle.js.map
|