rspec_html_formatter2 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +20 -0
- data/README.md +37 -0
- data/lib/rspec_html_formatter.rb +300 -0
- data/resources/bootstrap-4.0.0-dist/css/bootstrap.min.css +6 -0
- data/resources/bootstrap-4.0.0-dist/js/bootstrap.js +3535 -0
- data/resources/bootstrap-4.0.0-dist/js/bootstrap.min.js +7 -0
- data/resources/bootstrap-4.0.0-dist/themes/bootstrap-theme-yeti.min.css +11 -0
- data/resources/js/Chart.js +12757 -0
- data/resources/js/jquery-1.11.1.min.js +4 -0
- data/resources/tether-1.3.3-dist/js/tether.min.js +1 -0
- data/spec/embed_graphics_spec.rb +144 -0
- data/spec/rspec_html_reporter_spec.rb +55 -0
- data/spec/support/assets/images/screen_1.png +0 -0
- data/spec/support/assets/images/screen_2.png +0 -0
- data/spec/support/assets/videos/screen_record.mp4 +0 -0
- data/templates/overview.erb +137 -0
- data/templates/report.erb +223 -0
- metadata +159 -0
@@ -0,0 +1,3535 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap v4.0.0-alpha.6 (https://getbootstrap.com)
|
3
|
+
* Copyright 2011-2017 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
5
|
+
*/
|
6
|
+
|
7
|
+
if (typeof jQuery === 'undefined') {
|
8
|
+
throw new Error('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.')
|
9
|
+
}
|
10
|
+
|
11
|
+
+function ($) {
|
12
|
+
var version = $.fn.jquery.split(' ')[0].split('.')
|
13
|
+
if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] >= 4)) {
|
14
|
+
throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0')
|
15
|
+
}
|
16
|
+
}(jQuery);
|
17
|
+
|
18
|
+
|
19
|
+
+function () {
|
20
|
+
|
21
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
22
|
+
|
23
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
24
|
+
|
25
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
26
|
+
|
27
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
28
|
+
|
29
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
30
|
+
|
31
|
+
/**
|
32
|
+
* --------------------------------------------------------------------------
|
33
|
+
* Bootstrap (v4.0.0-alpha.6): util.js
|
34
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
35
|
+
* --------------------------------------------------------------------------
|
36
|
+
*/
|
37
|
+
|
38
|
+
var Util = function ($) {
|
39
|
+
|
40
|
+
/**
|
41
|
+
* ------------------------------------------------------------------------
|
42
|
+
* Private TransitionEnd Helpers
|
43
|
+
* ------------------------------------------------------------------------
|
44
|
+
*/
|
45
|
+
|
46
|
+
var transition = false;
|
47
|
+
|
48
|
+
var MAX_UID = 1000000;
|
49
|
+
|
50
|
+
var TransitionEndEvent = {
|
51
|
+
WebkitTransition: 'webkitTransitionEnd',
|
52
|
+
MozTransition: 'transitionend',
|
53
|
+
OTransition: 'oTransitionEnd otransitionend',
|
54
|
+
transition: 'transitionend'
|
55
|
+
};
|
56
|
+
|
57
|
+
// shoutout AngusCroll (https://goo.gl/pxwQGp)
|
58
|
+
function toType(obj) {
|
59
|
+
return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
|
60
|
+
}
|
61
|
+
|
62
|
+
function isElement(obj) {
|
63
|
+
return (obj[0] || obj).nodeType;
|
64
|
+
}
|
65
|
+
|
66
|
+
function getSpecialTransitionEndEvent() {
|
67
|
+
return {
|
68
|
+
bindType: transition.end,
|
69
|
+
delegateType: transition.end,
|
70
|
+
handle: function handle(event) {
|
71
|
+
if ($(event.target).is(this)) {
|
72
|
+
return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
|
73
|
+
}
|
74
|
+
return undefined;
|
75
|
+
}
|
76
|
+
};
|
77
|
+
}
|
78
|
+
|
79
|
+
function transitionEndTest() {
|
80
|
+
if (window.QUnit) {
|
81
|
+
return false;
|
82
|
+
}
|
83
|
+
|
84
|
+
var el = document.createElement('bootstrap');
|
85
|
+
|
86
|
+
for (var name in TransitionEndEvent) {
|
87
|
+
if (el.style[name] !== undefined) {
|
88
|
+
return {
|
89
|
+
end: TransitionEndEvent[name]
|
90
|
+
};
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
return false;
|
95
|
+
}
|
96
|
+
|
97
|
+
function transitionEndEmulator(duration) {
|
98
|
+
var _this = this;
|
99
|
+
|
100
|
+
var called = false;
|
101
|
+
|
102
|
+
$(this).one(Util.TRANSITION_END, function () {
|
103
|
+
called = true;
|
104
|
+
});
|
105
|
+
|
106
|
+
setTimeout(function () {
|
107
|
+
if (!called) {
|
108
|
+
Util.triggerTransitionEnd(_this);
|
109
|
+
}
|
110
|
+
}, duration);
|
111
|
+
|
112
|
+
return this;
|
113
|
+
}
|
114
|
+
|
115
|
+
function setTransitionEndSupport() {
|
116
|
+
transition = transitionEndTest();
|
117
|
+
|
118
|
+
$.fn.emulateTransitionEnd = transitionEndEmulator;
|
119
|
+
|
120
|
+
if (Util.supportsTransitionEnd()) {
|
121
|
+
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
/**
|
126
|
+
* --------------------------------------------------------------------------
|
127
|
+
* Public Util Api
|
128
|
+
* --------------------------------------------------------------------------
|
129
|
+
*/
|
130
|
+
|
131
|
+
var Util = {
|
132
|
+
|
133
|
+
TRANSITION_END: 'bsTransitionEnd',
|
134
|
+
|
135
|
+
getUID: function getUID(prefix) {
|
136
|
+
do {
|
137
|
+
// eslint-disable-next-line no-bitwise
|
138
|
+
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
|
139
|
+
} while (document.getElementById(prefix));
|
140
|
+
return prefix;
|
141
|
+
},
|
142
|
+
getSelectorFromElement: function getSelectorFromElement(element) {
|
143
|
+
var selector = element.getAttribute('data-target');
|
144
|
+
|
145
|
+
if (!selector) {
|
146
|
+
selector = element.getAttribute('href') || '';
|
147
|
+
selector = /^#[a-z]/i.test(selector) ? selector : null;
|
148
|
+
}
|
149
|
+
|
150
|
+
return selector;
|
151
|
+
},
|
152
|
+
reflow: function reflow(element) {
|
153
|
+
return element.offsetHeight;
|
154
|
+
},
|
155
|
+
triggerTransitionEnd: function triggerTransitionEnd(element) {
|
156
|
+
$(element).trigger(transition.end);
|
157
|
+
},
|
158
|
+
supportsTransitionEnd: function supportsTransitionEnd() {
|
159
|
+
return Boolean(transition);
|
160
|
+
},
|
161
|
+
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
|
162
|
+
for (var property in configTypes) {
|
163
|
+
if (configTypes.hasOwnProperty(property)) {
|
164
|
+
var expectedTypes = configTypes[property];
|
165
|
+
var value = config[property];
|
166
|
+
var valueType = value && isElement(value) ? 'element' : toType(value);
|
167
|
+
|
168
|
+
if (!new RegExp(expectedTypes).test(valueType)) {
|
169
|
+
throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}
|
174
|
+
};
|
175
|
+
|
176
|
+
setTransitionEndSupport();
|
177
|
+
|
178
|
+
return Util;
|
179
|
+
}(jQuery);
|
180
|
+
|
181
|
+
/**
|
182
|
+
* --------------------------------------------------------------------------
|
183
|
+
* Bootstrap (v4.0.0-alpha.6): alert.js
|
184
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
185
|
+
* --------------------------------------------------------------------------
|
186
|
+
*/
|
187
|
+
|
188
|
+
var Alert = function ($) {
|
189
|
+
|
190
|
+
/**
|
191
|
+
* ------------------------------------------------------------------------
|
192
|
+
* Constants
|
193
|
+
* ------------------------------------------------------------------------
|
194
|
+
*/
|
195
|
+
|
196
|
+
var NAME = 'alert';
|
197
|
+
var VERSION = '4.0.0-alpha.6';
|
198
|
+
var DATA_KEY = 'bs.alert';
|
199
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
200
|
+
var DATA_API_KEY = '.data-api';
|
201
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
202
|
+
var TRANSITION_DURATION = 150;
|
203
|
+
|
204
|
+
var Selector = {
|
205
|
+
DISMISS: '[data-dismiss="alert"]'
|
206
|
+
};
|
207
|
+
|
208
|
+
var Event = {
|
209
|
+
CLOSE: 'close' + EVENT_KEY,
|
210
|
+
CLOSED: 'closed' + EVENT_KEY,
|
211
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
|
212
|
+
};
|
213
|
+
|
214
|
+
var ClassName = {
|
215
|
+
ALERT: 'alert',
|
216
|
+
FADE: 'fade',
|
217
|
+
SHOW: 'show'
|
218
|
+
};
|
219
|
+
|
220
|
+
/**
|
221
|
+
* ------------------------------------------------------------------------
|
222
|
+
* Class Definition
|
223
|
+
* ------------------------------------------------------------------------
|
224
|
+
*/
|
225
|
+
|
226
|
+
var Alert = function () {
|
227
|
+
function Alert(element) {
|
228
|
+
_classCallCheck(this, Alert);
|
229
|
+
|
230
|
+
this._element = element;
|
231
|
+
}
|
232
|
+
|
233
|
+
// getters
|
234
|
+
|
235
|
+
// public
|
236
|
+
|
237
|
+
Alert.prototype.close = function close(element) {
|
238
|
+
element = element || this._element;
|
239
|
+
|
240
|
+
var rootElement = this._getRootElement(element);
|
241
|
+
var customEvent = this._triggerCloseEvent(rootElement);
|
242
|
+
|
243
|
+
if (customEvent.isDefaultPrevented()) {
|
244
|
+
return;
|
245
|
+
}
|
246
|
+
|
247
|
+
this._removeElement(rootElement);
|
248
|
+
};
|
249
|
+
|
250
|
+
Alert.prototype.dispose = function dispose() {
|
251
|
+
$.removeData(this._element, DATA_KEY);
|
252
|
+
this._element = null;
|
253
|
+
};
|
254
|
+
|
255
|
+
// private
|
256
|
+
|
257
|
+
Alert.prototype._getRootElement = function _getRootElement(element) {
|
258
|
+
var selector = Util.getSelectorFromElement(element);
|
259
|
+
var parent = false;
|
260
|
+
|
261
|
+
if (selector) {
|
262
|
+
parent = $(selector)[0];
|
263
|
+
}
|
264
|
+
|
265
|
+
if (!parent) {
|
266
|
+
parent = $(element).closest('.' + ClassName.ALERT)[0];
|
267
|
+
}
|
268
|
+
|
269
|
+
return parent;
|
270
|
+
};
|
271
|
+
|
272
|
+
Alert.prototype._triggerCloseEvent = function _triggerCloseEvent(element) {
|
273
|
+
var closeEvent = $.Event(Event.CLOSE);
|
274
|
+
|
275
|
+
$(element).trigger(closeEvent);
|
276
|
+
return closeEvent;
|
277
|
+
};
|
278
|
+
|
279
|
+
Alert.prototype._removeElement = function _removeElement(element) {
|
280
|
+
var _this2 = this;
|
281
|
+
|
282
|
+
$(element).removeClass(ClassName.SHOW);
|
283
|
+
|
284
|
+
if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) {
|
285
|
+
this._destroyElement(element);
|
286
|
+
return;
|
287
|
+
}
|
288
|
+
|
289
|
+
$(element).one(Util.TRANSITION_END, function (event) {
|
290
|
+
return _this2._destroyElement(element, event);
|
291
|
+
}).emulateTransitionEnd(TRANSITION_DURATION);
|
292
|
+
};
|
293
|
+
|
294
|
+
Alert.prototype._destroyElement = function _destroyElement(element) {
|
295
|
+
$(element).detach().trigger(Event.CLOSED).remove();
|
296
|
+
};
|
297
|
+
|
298
|
+
// static
|
299
|
+
|
300
|
+
Alert._jQueryInterface = function _jQueryInterface(config) {
|
301
|
+
return this.each(function () {
|
302
|
+
var $element = $(this);
|
303
|
+
var data = $element.data(DATA_KEY);
|
304
|
+
|
305
|
+
if (!data) {
|
306
|
+
data = new Alert(this);
|
307
|
+
$element.data(DATA_KEY, data);
|
308
|
+
}
|
309
|
+
|
310
|
+
if (config === 'close') {
|
311
|
+
data[config](this);
|
312
|
+
}
|
313
|
+
});
|
314
|
+
};
|
315
|
+
|
316
|
+
Alert._handleDismiss = function _handleDismiss(alertInstance) {
|
317
|
+
return function (event) {
|
318
|
+
if (event) {
|
319
|
+
event.preventDefault();
|
320
|
+
}
|
321
|
+
|
322
|
+
alertInstance.close(this);
|
323
|
+
};
|
324
|
+
};
|
325
|
+
|
326
|
+
_createClass(Alert, null, [{
|
327
|
+
key: 'VERSION',
|
328
|
+
get: function get() {
|
329
|
+
return VERSION;
|
330
|
+
}
|
331
|
+
}]);
|
332
|
+
|
333
|
+
return Alert;
|
334
|
+
}();
|
335
|
+
|
336
|
+
/**
|
337
|
+
* ------------------------------------------------------------------------
|
338
|
+
* Data Api implementation
|
339
|
+
* ------------------------------------------------------------------------
|
340
|
+
*/
|
341
|
+
|
342
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
|
343
|
+
|
344
|
+
/**
|
345
|
+
* ------------------------------------------------------------------------
|
346
|
+
* jQuery
|
347
|
+
* ------------------------------------------------------------------------
|
348
|
+
*/
|
349
|
+
|
350
|
+
$.fn[NAME] = Alert._jQueryInterface;
|
351
|
+
$.fn[NAME].Constructor = Alert;
|
352
|
+
$.fn[NAME].noConflict = function () {
|
353
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
354
|
+
return Alert._jQueryInterface;
|
355
|
+
};
|
356
|
+
|
357
|
+
return Alert;
|
358
|
+
}(jQuery);
|
359
|
+
|
360
|
+
/**
|
361
|
+
* --------------------------------------------------------------------------
|
362
|
+
* Bootstrap (v4.0.0-alpha.6): button.js
|
363
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
364
|
+
* --------------------------------------------------------------------------
|
365
|
+
*/
|
366
|
+
|
367
|
+
var Button = function ($) {
|
368
|
+
|
369
|
+
/**
|
370
|
+
* ------------------------------------------------------------------------
|
371
|
+
* Constants
|
372
|
+
* ------------------------------------------------------------------------
|
373
|
+
*/
|
374
|
+
|
375
|
+
var NAME = 'button';
|
376
|
+
var VERSION = '4.0.0-alpha.6';
|
377
|
+
var DATA_KEY = 'bs.button';
|
378
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
379
|
+
var DATA_API_KEY = '.data-api';
|
380
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
381
|
+
|
382
|
+
var ClassName = {
|
383
|
+
ACTIVE: 'active',
|
384
|
+
BUTTON: 'btn',
|
385
|
+
FOCUS: 'focus'
|
386
|
+
};
|
387
|
+
|
388
|
+
var Selector = {
|
389
|
+
DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
|
390
|
+
DATA_TOGGLE: '[data-toggle="buttons"]',
|
391
|
+
INPUT: 'input',
|
392
|
+
ACTIVE: '.active',
|
393
|
+
BUTTON: '.btn'
|
394
|
+
};
|
395
|
+
|
396
|
+
var Event = {
|
397
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
|
398
|
+
FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + DATA_API_KEY)
|
399
|
+
};
|
400
|
+
|
401
|
+
/**
|
402
|
+
* ------------------------------------------------------------------------
|
403
|
+
* Class Definition
|
404
|
+
* ------------------------------------------------------------------------
|
405
|
+
*/
|
406
|
+
|
407
|
+
var Button = function () {
|
408
|
+
function Button(element) {
|
409
|
+
_classCallCheck(this, Button);
|
410
|
+
|
411
|
+
this._element = element;
|
412
|
+
}
|
413
|
+
|
414
|
+
// getters
|
415
|
+
|
416
|
+
// public
|
417
|
+
|
418
|
+
Button.prototype.toggle = function toggle() {
|
419
|
+
var triggerChangeEvent = true;
|
420
|
+
var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
|
421
|
+
|
422
|
+
if (rootElement) {
|
423
|
+
var input = $(this._element).find(Selector.INPUT)[0];
|
424
|
+
|
425
|
+
if (input) {
|
426
|
+
if (input.type === 'radio') {
|
427
|
+
if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) {
|
428
|
+
triggerChangeEvent = false;
|
429
|
+
} else {
|
430
|
+
var activeElement = $(rootElement).find(Selector.ACTIVE)[0];
|
431
|
+
|
432
|
+
if (activeElement) {
|
433
|
+
$(activeElement).removeClass(ClassName.ACTIVE);
|
434
|
+
}
|
435
|
+
}
|
436
|
+
}
|
437
|
+
|
438
|
+
if (triggerChangeEvent) {
|
439
|
+
input.checked = !$(this._element).hasClass(ClassName.ACTIVE);
|
440
|
+
$(input).trigger('change');
|
441
|
+
}
|
442
|
+
|
443
|
+
input.focus();
|
444
|
+
}
|
445
|
+
}
|
446
|
+
|
447
|
+
this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
|
448
|
+
|
449
|
+
if (triggerChangeEvent) {
|
450
|
+
$(this._element).toggleClass(ClassName.ACTIVE);
|
451
|
+
}
|
452
|
+
};
|
453
|
+
|
454
|
+
Button.prototype.dispose = function dispose() {
|
455
|
+
$.removeData(this._element, DATA_KEY);
|
456
|
+
this._element = null;
|
457
|
+
};
|
458
|
+
|
459
|
+
// static
|
460
|
+
|
461
|
+
Button._jQueryInterface = function _jQueryInterface(config) {
|
462
|
+
return this.each(function () {
|
463
|
+
var data = $(this).data(DATA_KEY);
|
464
|
+
|
465
|
+
if (!data) {
|
466
|
+
data = new Button(this);
|
467
|
+
$(this).data(DATA_KEY, data);
|
468
|
+
}
|
469
|
+
|
470
|
+
if (config === 'toggle') {
|
471
|
+
data[config]();
|
472
|
+
}
|
473
|
+
});
|
474
|
+
};
|
475
|
+
|
476
|
+
_createClass(Button, null, [{
|
477
|
+
key: 'VERSION',
|
478
|
+
get: function get() {
|
479
|
+
return VERSION;
|
480
|
+
}
|
481
|
+
}]);
|
482
|
+
|
483
|
+
return Button;
|
484
|
+
}();
|
485
|
+
|
486
|
+
/**
|
487
|
+
* ------------------------------------------------------------------------
|
488
|
+
* Data Api implementation
|
489
|
+
* ------------------------------------------------------------------------
|
490
|
+
*/
|
491
|
+
|
492
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
493
|
+
event.preventDefault();
|
494
|
+
|
495
|
+
var button = event.target;
|
496
|
+
|
497
|
+
if (!$(button).hasClass(ClassName.BUTTON)) {
|
498
|
+
button = $(button).closest(Selector.BUTTON);
|
499
|
+
}
|
500
|
+
|
501
|
+
Button._jQueryInterface.call($(button), 'toggle');
|
502
|
+
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
|
503
|
+
var button = $(event.target).closest(Selector.BUTTON)[0];
|
504
|
+
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
|
505
|
+
});
|
506
|
+
|
507
|
+
/**
|
508
|
+
* ------------------------------------------------------------------------
|
509
|
+
* jQuery
|
510
|
+
* ------------------------------------------------------------------------
|
511
|
+
*/
|
512
|
+
|
513
|
+
$.fn[NAME] = Button._jQueryInterface;
|
514
|
+
$.fn[NAME].Constructor = Button;
|
515
|
+
$.fn[NAME].noConflict = function () {
|
516
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
517
|
+
return Button._jQueryInterface;
|
518
|
+
};
|
519
|
+
|
520
|
+
return Button;
|
521
|
+
}(jQuery);
|
522
|
+
|
523
|
+
/**
|
524
|
+
* --------------------------------------------------------------------------
|
525
|
+
* Bootstrap (v4.0.0-alpha.6): carousel.js
|
526
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
527
|
+
* --------------------------------------------------------------------------
|
528
|
+
*/
|
529
|
+
|
530
|
+
var Carousel = function ($) {
|
531
|
+
|
532
|
+
/**
|
533
|
+
* ------------------------------------------------------------------------
|
534
|
+
* Constants
|
535
|
+
* ------------------------------------------------------------------------
|
536
|
+
*/
|
537
|
+
|
538
|
+
var NAME = 'carousel';
|
539
|
+
var VERSION = '4.0.0-alpha.6';
|
540
|
+
var DATA_KEY = 'bs.carousel';
|
541
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
542
|
+
var DATA_API_KEY = '.data-api';
|
543
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
544
|
+
var TRANSITION_DURATION = 600;
|
545
|
+
var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
|
546
|
+
var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
|
547
|
+
|
548
|
+
var Default = {
|
549
|
+
interval: 5000,
|
550
|
+
keyboard: true,
|
551
|
+
slide: false,
|
552
|
+
pause: 'hover',
|
553
|
+
wrap: true
|
554
|
+
};
|
555
|
+
|
556
|
+
var DefaultType = {
|
557
|
+
interval: '(number|boolean)',
|
558
|
+
keyboard: 'boolean',
|
559
|
+
slide: '(boolean|string)',
|
560
|
+
pause: '(string|boolean)',
|
561
|
+
wrap: 'boolean'
|
562
|
+
};
|
563
|
+
|
564
|
+
var Direction = {
|
565
|
+
NEXT: 'next',
|
566
|
+
PREV: 'prev',
|
567
|
+
LEFT: 'left',
|
568
|
+
RIGHT: 'right'
|
569
|
+
};
|
570
|
+
|
571
|
+
var Event = {
|
572
|
+
SLIDE: 'slide' + EVENT_KEY,
|
573
|
+
SLID: 'slid' + EVENT_KEY,
|
574
|
+
KEYDOWN: 'keydown' + EVENT_KEY,
|
575
|
+
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
576
|
+
MOUSELEAVE: 'mouseleave' + EVENT_KEY,
|
577
|
+
LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY,
|
578
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
|
579
|
+
};
|
580
|
+
|
581
|
+
var ClassName = {
|
582
|
+
CAROUSEL: 'carousel',
|
583
|
+
ACTIVE: 'active',
|
584
|
+
SLIDE: 'slide',
|
585
|
+
RIGHT: 'carousel-item-right',
|
586
|
+
LEFT: 'carousel-item-left',
|
587
|
+
NEXT: 'carousel-item-next',
|
588
|
+
PREV: 'carousel-item-prev',
|
589
|
+
ITEM: 'carousel-item'
|
590
|
+
};
|
591
|
+
|
592
|
+
var Selector = {
|
593
|
+
ACTIVE: '.active',
|
594
|
+
ACTIVE_ITEM: '.active.carousel-item',
|
595
|
+
ITEM: '.carousel-item',
|
596
|
+
NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
|
597
|
+
INDICATORS: '.carousel-indicators',
|
598
|
+
DATA_SLIDE: '[data-slide], [data-slide-to]',
|
599
|
+
DATA_RIDE: '[data-ride="carousel"]'
|
600
|
+
};
|
601
|
+
|
602
|
+
/**
|
603
|
+
* ------------------------------------------------------------------------
|
604
|
+
* Class Definition
|
605
|
+
* ------------------------------------------------------------------------
|
606
|
+
*/
|
607
|
+
|
608
|
+
var Carousel = function () {
|
609
|
+
function Carousel(element, config) {
|
610
|
+
_classCallCheck(this, Carousel);
|
611
|
+
|
612
|
+
this._items = null;
|
613
|
+
this._interval = null;
|
614
|
+
this._activeElement = null;
|
615
|
+
|
616
|
+
this._isPaused = false;
|
617
|
+
this._isSliding = false;
|
618
|
+
|
619
|
+
this._config = this._getConfig(config);
|
620
|
+
this._element = $(element)[0];
|
621
|
+
this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0];
|
622
|
+
|
623
|
+
this._addEventListeners();
|
624
|
+
}
|
625
|
+
|
626
|
+
// getters
|
627
|
+
|
628
|
+
// public
|
629
|
+
|
630
|
+
Carousel.prototype.next = function next() {
|
631
|
+
if (this._isSliding) {
|
632
|
+
throw new Error('Carousel is sliding');
|
633
|
+
}
|
634
|
+
this._slide(Direction.NEXT);
|
635
|
+
};
|
636
|
+
|
637
|
+
Carousel.prototype.nextWhenVisible = function nextWhenVisible() {
|
638
|
+
// Don't call next when the page isn't visible
|
639
|
+
if (!document.hidden) {
|
640
|
+
this.next();
|
641
|
+
}
|
642
|
+
};
|
643
|
+
|
644
|
+
Carousel.prototype.prev = function prev() {
|
645
|
+
if (this._isSliding) {
|
646
|
+
throw new Error('Carousel is sliding');
|
647
|
+
}
|
648
|
+
this._slide(Direction.PREVIOUS);
|
649
|
+
};
|
650
|
+
|
651
|
+
Carousel.prototype.pause = function pause(event) {
|
652
|
+
if (!event) {
|
653
|
+
this._isPaused = true;
|
654
|
+
}
|
655
|
+
|
656
|
+
if ($(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) {
|
657
|
+
Util.triggerTransitionEnd(this._element);
|
658
|
+
this.cycle(true);
|
659
|
+
}
|
660
|
+
|
661
|
+
clearInterval(this._interval);
|
662
|
+
this._interval = null;
|
663
|
+
};
|
664
|
+
|
665
|
+
Carousel.prototype.cycle = function cycle(event) {
|
666
|
+
if (!event) {
|
667
|
+
this._isPaused = false;
|
668
|
+
}
|
669
|
+
|
670
|
+
if (this._interval) {
|
671
|
+
clearInterval(this._interval);
|
672
|
+
this._interval = null;
|
673
|
+
}
|
674
|
+
|
675
|
+
if (this._config.interval && !this._isPaused) {
|
676
|
+
this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
|
677
|
+
}
|
678
|
+
};
|
679
|
+
|
680
|
+
Carousel.prototype.to = function to(index) {
|
681
|
+
var _this3 = this;
|
682
|
+
|
683
|
+
this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
|
684
|
+
|
685
|
+
var activeIndex = this._getItemIndex(this._activeElement);
|
686
|
+
|
687
|
+
if (index > this._items.length - 1 || index < 0) {
|
688
|
+
return;
|
689
|
+
}
|
690
|
+
|
691
|
+
if (this._isSliding) {
|
692
|
+
$(this._element).one(Event.SLID, function () {
|
693
|
+
return _this3.to(index);
|
694
|
+
});
|
695
|
+
return;
|
696
|
+
}
|
697
|
+
|
698
|
+
if (activeIndex === index) {
|
699
|
+
this.pause();
|
700
|
+
this.cycle();
|
701
|
+
return;
|
702
|
+
}
|
703
|
+
|
704
|
+
var direction = index > activeIndex ? Direction.NEXT : Direction.PREVIOUS;
|
705
|
+
|
706
|
+
this._slide(direction, this._items[index]);
|
707
|
+
};
|
708
|
+
|
709
|
+
Carousel.prototype.dispose = function dispose() {
|
710
|
+
$(this._element).off(EVENT_KEY);
|
711
|
+
$.removeData(this._element, DATA_KEY);
|
712
|
+
|
713
|
+
this._items = null;
|
714
|
+
this._config = null;
|
715
|
+
this._element = null;
|
716
|
+
this._interval = null;
|
717
|
+
this._isPaused = null;
|
718
|
+
this._isSliding = null;
|
719
|
+
this._activeElement = null;
|
720
|
+
this._indicatorsElement = null;
|
721
|
+
};
|
722
|
+
|
723
|
+
// private
|
724
|
+
|
725
|
+
Carousel.prototype._getConfig = function _getConfig(config) {
|
726
|
+
config = $.extend({}, Default, config);
|
727
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
728
|
+
return config;
|
729
|
+
};
|
730
|
+
|
731
|
+
Carousel.prototype._addEventListeners = function _addEventListeners() {
|
732
|
+
var _this4 = this;
|
733
|
+
|
734
|
+
if (this._config.keyboard) {
|
735
|
+
$(this._element).on(Event.KEYDOWN, function (event) {
|
736
|
+
return _this4._keydown(event);
|
737
|
+
});
|
738
|
+
}
|
739
|
+
|
740
|
+
if (this._config.pause === 'hover' && !('ontouchstart' in document.documentElement)) {
|
741
|
+
$(this._element).on(Event.MOUSEENTER, function (event) {
|
742
|
+
return _this4.pause(event);
|
743
|
+
}).on(Event.MOUSELEAVE, function (event) {
|
744
|
+
return _this4.cycle(event);
|
745
|
+
});
|
746
|
+
}
|
747
|
+
};
|
748
|
+
|
749
|
+
Carousel.prototype._keydown = function _keydown(event) {
|
750
|
+
if (/input|textarea/i.test(event.target.tagName)) {
|
751
|
+
return;
|
752
|
+
}
|
753
|
+
|
754
|
+
switch (event.which) {
|
755
|
+
case ARROW_LEFT_KEYCODE:
|
756
|
+
event.preventDefault();
|
757
|
+
this.prev();
|
758
|
+
break;
|
759
|
+
case ARROW_RIGHT_KEYCODE:
|
760
|
+
event.preventDefault();
|
761
|
+
this.next();
|
762
|
+
break;
|
763
|
+
default:
|
764
|
+
return;
|
765
|
+
}
|
766
|
+
};
|
767
|
+
|
768
|
+
Carousel.prototype._getItemIndex = function _getItemIndex(element) {
|
769
|
+
this._items = $.makeArray($(element).parent().find(Selector.ITEM));
|
770
|
+
return this._items.indexOf(element);
|
771
|
+
};
|
772
|
+
|
773
|
+
Carousel.prototype._getItemByDirection = function _getItemByDirection(direction, activeElement) {
|
774
|
+
var isNextDirection = direction === Direction.NEXT;
|
775
|
+
var isPrevDirection = direction === Direction.PREVIOUS;
|
776
|
+
var activeIndex = this._getItemIndex(activeElement);
|
777
|
+
var lastItemIndex = this._items.length - 1;
|
778
|
+
var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
|
779
|
+
|
780
|
+
if (isGoingToWrap && !this._config.wrap) {
|
781
|
+
return activeElement;
|
782
|
+
}
|
783
|
+
|
784
|
+
var delta = direction === Direction.PREVIOUS ? -1 : 1;
|
785
|
+
var itemIndex = (activeIndex + delta) % this._items.length;
|
786
|
+
|
787
|
+
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
|
788
|
+
};
|
789
|
+
|
790
|
+
Carousel.prototype._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
|
791
|
+
var slideEvent = $.Event(Event.SLIDE, {
|
792
|
+
relatedTarget: relatedTarget,
|
793
|
+
direction: eventDirectionName
|
794
|
+
});
|
795
|
+
|
796
|
+
$(this._element).trigger(slideEvent);
|
797
|
+
|
798
|
+
return slideEvent;
|
799
|
+
};
|
800
|
+
|
801
|
+
Carousel.prototype._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
|
802
|
+
if (this._indicatorsElement) {
|
803
|
+
$(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
|
804
|
+
|
805
|
+
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
|
806
|
+
|
807
|
+
if (nextIndicator) {
|
808
|
+
$(nextIndicator).addClass(ClassName.ACTIVE);
|
809
|
+
}
|
810
|
+
}
|
811
|
+
};
|
812
|
+
|
813
|
+
Carousel.prototype._slide = function _slide(direction, element) {
|
814
|
+
var _this5 = this;
|
815
|
+
|
816
|
+
var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
|
817
|
+
var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
|
818
|
+
|
819
|
+
var isCycling = Boolean(this._interval);
|
820
|
+
|
821
|
+
var directionalClassName = void 0;
|
822
|
+
var orderClassName = void 0;
|
823
|
+
var eventDirectionName = void 0;
|
824
|
+
|
825
|
+
if (direction === Direction.NEXT) {
|
826
|
+
directionalClassName = ClassName.LEFT;
|
827
|
+
orderClassName = ClassName.NEXT;
|
828
|
+
eventDirectionName = Direction.LEFT;
|
829
|
+
} else {
|
830
|
+
directionalClassName = ClassName.RIGHT;
|
831
|
+
orderClassName = ClassName.PREV;
|
832
|
+
eventDirectionName = Direction.RIGHT;
|
833
|
+
}
|
834
|
+
|
835
|
+
if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
|
836
|
+
this._isSliding = false;
|
837
|
+
return;
|
838
|
+
}
|
839
|
+
|
840
|
+
var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
|
841
|
+
if (slideEvent.isDefaultPrevented()) {
|
842
|
+
return;
|
843
|
+
}
|
844
|
+
|
845
|
+
if (!activeElement || !nextElement) {
|
846
|
+
// some weirdness is happening, so we bail
|
847
|
+
return;
|
848
|
+
}
|
849
|
+
|
850
|
+
this._isSliding = true;
|
851
|
+
|
852
|
+
if (isCycling) {
|
853
|
+
this.pause();
|
854
|
+
}
|
855
|
+
|
856
|
+
this._setActiveIndicatorElement(nextElement);
|
857
|
+
|
858
|
+
var slidEvent = $.Event(Event.SLID, {
|
859
|
+
relatedTarget: nextElement,
|
860
|
+
direction: eventDirectionName
|
861
|
+
});
|
862
|
+
|
863
|
+
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) {
|
864
|
+
|
865
|
+
$(nextElement).addClass(orderClassName);
|
866
|
+
|
867
|
+
Util.reflow(nextElement);
|
868
|
+
|
869
|
+
$(activeElement).addClass(directionalClassName);
|
870
|
+
$(nextElement).addClass(directionalClassName);
|
871
|
+
|
872
|
+
$(activeElement).one(Util.TRANSITION_END, function () {
|
873
|
+
$(nextElement).removeClass(directionalClassName + ' ' + orderClassName).addClass(ClassName.ACTIVE);
|
874
|
+
|
875
|
+
$(activeElement).removeClass(ClassName.ACTIVE + ' ' + orderClassName + ' ' + directionalClassName);
|
876
|
+
|
877
|
+
_this5._isSliding = false;
|
878
|
+
|
879
|
+
setTimeout(function () {
|
880
|
+
return $(_this5._element).trigger(slidEvent);
|
881
|
+
}, 0);
|
882
|
+
}).emulateTransitionEnd(TRANSITION_DURATION);
|
883
|
+
} else {
|
884
|
+
$(activeElement).removeClass(ClassName.ACTIVE);
|
885
|
+
$(nextElement).addClass(ClassName.ACTIVE);
|
886
|
+
|
887
|
+
this._isSliding = false;
|
888
|
+
$(this._element).trigger(slidEvent);
|
889
|
+
}
|
890
|
+
|
891
|
+
if (isCycling) {
|
892
|
+
this.cycle();
|
893
|
+
}
|
894
|
+
};
|
895
|
+
|
896
|
+
// static
|
897
|
+
|
898
|
+
Carousel._jQueryInterface = function _jQueryInterface(config) {
|
899
|
+
return this.each(function () {
|
900
|
+
var data = $(this).data(DATA_KEY);
|
901
|
+
var _config = $.extend({}, Default, $(this).data());
|
902
|
+
|
903
|
+
if ((typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object') {
|
904
|
+
$.extend(_config, config);
|
905
|
+
}
|
906
|
+
|
907
|
+
var action = typeof config === 'string' ? config : _config.slide;
|
908
|
+
|
909
|
+
if (!data) {
|
910
|
+
data = new Carousel(this, _config);
|
911
|
+
$(this).data(DATA_KEY, data);
|
912
|
+
}
|
913
|
+
|
914
|
+
if (typeof config === 'number') {
|
915
|
+
data.to(config);
|
916
|
+
} else if (typeof action === 'string') {
|
917
|
+
if (data[action] === undefined) {
|
918
|
+
throw new Error('No method named "' + action + '"');
|
919
|
+
}
|
920
|
+
data[action]();
|
921
|
+
} else if (_config.interval) {
|
922
|
+
data.pause();
|
923
|
+
data.cycle();
|
924
|
+
}
|
925
|
+
});
|
926
|
+
};
|
927
|
+
|
928
|
+
Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
|
929
|
+
var selector = Util.getSelectorFromElement(this);
|
930
|
+
|
931
|
+
if (!selector) {
|
932
|
+
return;
|
933
|
+
}
|
934
|
+
|
935
|
+
var target = $(selector)[0];
|
936
|
+
|
937
|
+
if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
|
938
|
+
return;
|
939
|
+
}
|
940
|
+
|
941
|
+
var config = $.extend({}, $(target).data(), $(this).data());
|
942
|
+
var slideIndex = this.getAttribute('data-slide-to');
|
943
|
+
|
944
|
+
if (slideIndex) {
|
945
|
+
config.interval = false;
|
946
|
+
}
|
947
|
+
|
948
|
+
Carousel._jQueryInterface.call($(target), config);
|
949
|
+
|
950
|
+
if (slideIndex) {
|
951
|
+
$(target).data(DATA_KEY).to(slideIndex);
|
952
|
+
}
|
953
|
+
|
954
|
+
event.preventDefault();
|
955
|
+
};
|
956
|
+
|
957
|
+
_createClass(Carousel, null, [{
|
958
|
+
key: 'VERSION',
|
959
|
+
get: function get() {
|
960
|
+
return VERSION;
|
961
|
+
}
|
962
|
+
}, {
|
963
|
+
key: 'Default',
|
964
|
+
get: function get() {
|
965
|
+
return Default;
|
966
|
+
}
|
967
|
+
}]);
|
968
|
+
|
969
|
+
return Carousel;
|
970
|
+
}();
|
971
|
+
|
972
|
+
/**
|
973
|
+
* ------------------------------------------------------------------------
|
974
|
+
* Data Api implementation
|
975
|
+
* ------------------------------------------------------------------------
|
976
|
+
*/
|
977
|
+
|
978
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
|
979
|
+
|
980
|
+
$(window).on(Event.LOAD_DATA_API, function () {
|
981
|
+
$(Selector.DATA_RIDE).each(function () {
|
982
|
+
var $carousel = $(this);
|
983
|
+
Carousel._jQueryInterface.call($carousel, $carousel.data());
|
984
|
+
});
|
985
|
+
});
|
986
|
+
|
987
|
+
/**
|
988
|
+
* ------------------------------------------------------------------------
|
989
|
+
* jQuery
|
990
|
+
* ------------------------------------------------------------------------
|
991
|
+
*/
|
992
|
+
|
993
|
+
$.fn[NAME] = Carousel._jQueryInterface;
|
994
|
+
$.fn[NAME].Constructor = Carousel;
|
995
|
+
$.fn[NAME].noConflict = function () {
|
996
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
997
|
+
return Carousel._jQueryInterface;
|
998
|
+
};
|
999
|
+
|
1000
|
+
return Carousel;
|
1001
|
+
}(jQuery);
|
1002
|
+
|
1003
|
+
/**
|
1004
|
+
* --------------------------------------------------------------------------
|
1005
|
+
* Bootstrap (v4.0.0-alpha.6): collapse.js
|
1006
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
1007
|
+
* --------------------------------------------------------------------------
|
1008
|
+
*/
|
1009
|
+
|
1010
|
+
var Collapse = function ($) {
|
1011
|
+
|
1012
|
+
/**
|
1013
|
+
* ------------------------------------------------------------------------
|
1014
|
+
* Constants
|
1015
|
+
* ------------------------------------------------------------------------
|
1016
|
+
*/
|
1017
|
+
|
1018
|
+
var NAME = 'collapse';
|
1019
|
+
var VERSION = '4.0.0-alpha.6';
|
1020
|
+
var DATA_KEY = 'bs.collapse';
|
1021
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
1022
|
+
var DATA_API_KEY = '.data-api';
|
1023
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
1024
|
+
var TRANSITION_DURATION = 600;
|
1025
|
+
|
1026
|
+
var Default = {
|
1027
|
+
toggle: true,
|
1028
|
+
parent: ''
|
1029
|
+
};
|
1030
|
+
|
1031
|
+
var DefaultType = {
|
1032
|
+
toggle: 'boolean',
|
1033
|
+
parent: 'string'
|
1034
|
+
};
|
1035
|
+
|
1036
|
+
var Event = {
|
1037
|
+
SHOW: 'show' + EVENT_KEY,
|
1038
|
+
SHOWN: 'shown' + EVENT_KEY,
|
1039
|
+
HIDE: 'hide' + EVENT_KEY,
|
1040
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
1041
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
|
1042
|
+
};
|
1043
|
+
|
1044
|
+
var ClassName = {
|
1045
|
+
SHOW: 'show',
|
1046
|
+
COLLAPSE: 'collapse',
|
1047
|
+
COLLAPSING: 'collapsing',
|
1048
|
+
COLLAPSED: 'collapsed'
|
1049
|
+
};
|
1050
|
+
|
1051
|
+
var Dimension = {
|
1052
|
+
WIDTH: 'width',
|
1053
|
+
HEIGHT: 'height'
|
1054
|
+
};
|
1055
|
+
|
1056
|
+
var Selector = {
|
1057
|
+
ACTIVES: '.card > .show, .card > .collapsing',
|
1058
|
+
DATA_TOGGLE: '[data-toggle="collapse"]'
|
1059
|
+
};
|
1060
|
+
|
1061
|
+
/**
|
1062
|
+
* ------------------------------------------------------------------------
|
1063
|
+
* Class Definition
|
1064
|
+
* ------------------------------------------------------------------------
|
1065
|
+
*/
|
1066
|
+
|
1067
|
+
var Collapse = function () {
|
1068
|
+
function Collapse(element, config) {
|
1069
|
+
_classCallCheck(this, Collapse);
|
1070
|
+
|
1071
|
+
this._isTransitioning = false;
|
1072
|
+
this._element = element;
|
1073
|
+
this._config = this._getConfig(config);
|
1074
|
+
this._triggerArray = $.makeArray($('[data-toggle="collapse"][href="#' + element.id + '"],' + ('[data-toggle="collapse"][data-target="#' + element.id + '"]')));
|
1075
|
+
|
1076
|
+
this._parent = this._config.parent ? this._getParent() : null;
|
1077
|
+
|
1078
|
+
if (!this._config.parent) {
|
1079
|
+
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
if (this._config.toggle) {
|
1083
|
+
this.toggle();
|
1084
|
+
}
|
1085
|
+
}
|
1086
|
+
|
1087
|
+
// getters
|
1088
|
+
|
1089
|
+
// public
|
1090
|
+
|
1091
|
+
Collapse.prototype.toggle = function toggle() {
|
1092
|
+
if ($(this._element).hasClass(ClassName.SHOW)) {
|
1093
|
+
this.hide();
|
1094
|
+
} else {
|
1095
|
+
this.show();
|
1096
|
+
}
|
1097
|
+
};
|
1098
|
+
|
1099
|
+
Collapse.prototype.show = function show() {
|
1100
|
+
var _this6 = this;
|
1101
|
+
|
1102
|
+
if (this._isTransitioning) {
|
1103
|
+
throw new Error('Collapse is transitioning');
|
1104
|
+
}
|
1105
|
+
|
1106
|
+
if ($(this._element).hasClass(ClassName.SHOW)) {
|
1107
|
+
return;
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
var actives = void 0;
|
1111
|
+
var activesData = void 0;
|
1112
|
+
|
1113
|
+
if (this._parent) {
|
1114
|
+
actives = $.makeArray($(this._parent).find(Selector.ACTIVES));
|
1115
|
+
if (!actives.length) {
|
1116
|
+
actives = null;
|
1117
|
+
}
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
if (actives) {
|
1121
|
+
activesData = $(actives).data(DATA_KEY);
|
1122
|
+
if (activesData && activesData._isTransitioning) {
|
1123
|
+
return;
|
1124
|
+
}
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
var startEvent = $.Event(Event.SHOW);
|
1128
|
+
$(this._element).trigger(startEvent);
|
1129
|
+
if (startEvent.isDefaultPrevented()) {
|
1130
|
+
return;
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
if (actives) {
|
1134
|
+
Collapse._jQueryInterface.call($(actives), 'hide');
|
1135
|
+
if (!activesData) {
|
1136
|
+
$(actives).data(DATA_KEY, null);
|
1137
|
+
}
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
var dimension = this._getDimension();
|
1141
|
+
|
1142
|
+
$(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
|
1143
|
+
|
1144
|
+
this._element.style[dimension] = 0;
|
1145
|
+
this._element.setAttribute('aria-expanded', true);
|
1146
|
+
|
1147
|
+
if (this._triggerArray.length) {
|
1148
|
+
$(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
this.setTransitioning(true);
|
1152
|
+
|
1153
|
+
var complete = function complete() {
|
1154
|
+
$(_this6._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
|
1155
|
+
|
1156
|
+
_this6._element.style[dimension] = '';
|
1157
|
+
|
1158
|
+
_this6.setTransitioning(false);
|
1159
|
+
|
1160
|
+
$(_this6._element).trigger(Event.SHOWN);
|
1161
|
+
};
|
1162
|
+
|
1163
|
+
if (!Util.supportsTransitionEnd()) {
|
1164
|
+
complete();
|
1165
|
+
return;
|
1166
|
+
}
|
1167
|
+
|
1168
|
+
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
1169
|
+
var scrollSize = 'scroll' + capitalizedDimension;
|
1170
|
+
|
1171
|
+
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
|
1172
|
+
|
1173
|
+
this._element.style[dimension] = this._element[scrollSize] + 'px';
|
1174
|
+
};
|
1175
|
+
|
1176
|
+
Collapse.prototype.hide = function hide() {
|
1177
|
+
var _this7 = this;
|
1178
|
+
|
1179
|
+
if (this._isTransitioning) {
|
1180
|
+
throw new Error('Collapse is transitioning');
|
1181
|
+
}
|
1182
|
+
|
1183
|
+
if (!$(this._element).hasClass(ClassName.SHOW)) {
|
1184
|
+
return;
|
1185
|
+
}
|
1186
|
+
|
1187
|
+
var startEvent = $.Event(Event.HIDE);
|
1188
|
+
$(this._element).trigger(startEvent);
|
1189
|
+
if (startEvent.isDefaultPrevented()) {
|
1190
|
+
return;
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
var dimension = this._getDimension();
|
1194
|
+
var offsetDimension = dimension === Dimension.WIDTH ? 'offsetWidth' : 'offsetHeight';
|
1195
|
+
|
1196
|
+
this._element.style[dimension] = this._element[offsetDimension] + 'px';
|
1197
|
+
|
1198
|
+
Util.reflow(this._element);
|
1199
|
+
|
1200
|
+
$(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
|
1201
|
+
|
1202
|
+
this._element.setAttribute('aria-expanded', false);
|
1203
|
+
|
1204
|
+
if (this._triggerArray.length) {
|
1205
|
+
$(this._triggerArray).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
|
1206
|
+
}
|
1207
|
+
|
1208
|
+
this.setTransitioning(true);
|
1209
|
+
|
1210
|
+
var complete = function complete() {
|
1211
|
+
_this7.setTransitioning(false);
|
1212
|
+
$(_this7._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
|
1213
|
+
};
|
1214
|
+
|
1215
|
+
this._element.style[dimension] = '';
|
1216
|
+
|
1217
|
+
if (!Util.supportsTransitionEnd()) {
|
1218
|
+
complete();
|
1219
|
+
return;
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
|
1223
|
+
};
|
1224
|
+
|
1225
|
+
Collapse.prototype.setTransitioning = function setTransitioning(isTransitioning) {
|
1226
|
+
this._isTransitioning = isTransitioning;
|
1227
|
+
};
|
1228
|
+
|
1229
|
+
Collapse.prototype.dispose = function dispose() {
|
1230
|
+
$.removeData(this._element, DATA_KEY);
|
1231
|
+
|
1232
|
+
this._config = null;
|
1233
|
+
this._parent = null;
|
1234
|
+
this._element = null;
|
1235
|
+
this._triggerArray = null;
|
1236
|
+
this._isTransitioning = null;
|
1237
|
+
};
|
1238
|
+
|
1239
|
+
// private
|
1240
|
+
|
1241
|
+
Collapse.prototype._getConfig = function _getConfig(config) {
|
1242
|
+
config = $.extend({}, Default, config);
|
1243
|
+
config.toggle = Boolean(config.toggle); // coerce string values
|
1244
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
1245
|
+
return config;
|
1246
|
+
};
|
1247
|
+
|
1248
|
+
Collapse.prototype._getDimension = function _getDimension() {
|
1249
|
+
var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
|
1250
|
+
return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
|
1251
|
+
};
|
1252
|
+
|
1253
|
+
Collapse.prototype._getParent = function _getParent() {
|
1254
|
+
var _this8 = this;
|
1255
|
+
|
1256
|
+
var parent = $(this._config.parent)[0];
|
1257
|
+
var selector = '[data-toggle="collapse"][data-parent="' + this._config.parent + '"]';
|
1258
|
+
|
1259
|
+
$(parent).find(selector).each(function (i, element) {
|
1260
|
+
_this8._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
|
1261
|
+
});
|
1262
|
+
|
1263
|
+
return parent;
|
1264
|
+
};
|
1265
|
+
|
1266
|
+
Collapse.prototype._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
|
1267
|
+
if (element) {
|
1268
|
+
var isOpen = $(element).hasClass(ClassName.SHOW);
|
1269
|
+
element.setAttribute('aria-expanded', isOpen);
|
1270
|
+
|
1271
|
+
if (triggerArray.length) {
|
1272
|
+
$(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
|
1273
|
+
}
|
1274
|
+
}
|
1275
|
+
};
|
1276
|
+
|
1277
|
+
// static
|
1278
|
+
|
1279
|
+
Collapse._getTargetFromElement = function _getTargetFromElement(element) {
|
1280
|
+
var selector = Util.getSelectorFromElement(element);
|
1281
|
+
return selector ? $(selector)[0] : null;
|
1282
|
+
};
|
1283
|
+
|
1284
|
+
Collapse._jQueryInterface = function _jQueryInterface(config) {
|
1285
|
+
return this.each(function () {
|
1286
|
+
var $this = $(this);
|
1287
|
+
var data = $this.data(DATA_KEY);
|
1288
|
+
var _config = $.extend({}, Default, $this.data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
|
1289
|
+
|
1290
|
+
if (!data && _config.toggle && /show|hide/.test(config)) {
|
1291
|
+
_config.toggle = false;
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
if (!data) {
|
1295
|
+
data = new Collapse(this, _config);
|
1296
|
+
$this.data(DATA_KEY, data);
|
1297
|
+
}
|
1298
|
+
|
1299
|
+
if (typeof config === 'string') {
|
1300
|
+
if (data[config] === undefined) {
|
1301
|
+
throw new Error('No method named "' + config + '"');
|
1302
|
+
}
|
1303
|
+
data[config]();
|
1304
|
+
}
|
1305
|
+
});
|
1306
|
+
};
|
1307
|
+
|
1308
|
+
_createClass(Collapse, null, [{
|
1309
|
+
key: 'VERSION',
|
1310
|
+
get: function get() {
|
1311
|
+
return VERSION;
|
1312
|
+
}
|
1313
|
+
}, {
|
1314
|
+
key: 'Default',
|
1315
|
+
get: function get() {
|
1316
|
+
return Default;
|
1317
|
+
}
|
1318
|
+
}]);
|
1319
|
+
|
1320
|
+
return Collapse;
|
1321
|
+
}();
|
1322
|
+
|
1323
|
+
/**
|
1324
|
+
* ------------------------------------------------------------------------
|
1325
|
+
* Data Api implementation
|
1326
|
+
* ------------------------------------------------------------------------
|
1327
|
+
*/
|
1328
|
+
|
1329
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
1330
|
+
event.preventDefault();
|
1331
|
+
|
1332
|
+
var target = Collapse._getTargetFromElement(this);
|
1333
|
+
var data = $(target).data(DATA_KEY);
|
1334
|
+
var config = data ? 'toggle' : $(this).data();
|
1335
|
+
|
1336
|
+
Collapse._jQueryInterface.call($(target), config);
|
1337
|
+
});
|
1338
|
+
|
1339
|
+
/**
|
1340
|
+
* ------------------------------------------------------------------------
|
1341
|
+
* jQuery
|
1342
|
+
* ------------------------------------------------------------------------
|
1343
|
+
*/
|
1344
|
+
|
1345
|
+
$.fn[NAME] = Collapse._jQueryInterface;
|
1346
|
+
$.fn[NAME].Constructor = Collapse;
|
1347
|
+
$.fn[NAME].noConflict = function () {
|
1348
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
1349
|
+
return Collapse._jQueryInterface;
|
1350
|
+
};
|
1351
|
+
|
1352
|
+
return Collapse;
|
1353
|
+
}(jQuery);
|
1354
|
+
|
1355
|
+
/**
|
1356
|
+
* --------------------------------------------------------------------------
|
1357
|
+
* Bootstrap (v4.0.0-alpha.6): dropdown.js
|
1358
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
1359
|
+
* --------------------------------------------------------------------------
|
1360
|
+
*/
|
1361
|
+
|
1362
|
+
var Dropdown = function ($) {
|
1363
|
+
|
1364
|
+
/**
|
1365
|
+
* ------------------------------------------------------------------------
|
1366
|
+
* Constants
|
1367
|
+
* ------------------------------------------------------------------------
|
1368
|
+
*/
|
1369
|
+
|
1370
|
+
var NAME = 'dropdown';
|
1371
|
+
var VERSION = '4.0.0-alpha.6';
|
1372
|
+
var DATA_KEY = 'bs.dropdown';
|
1373
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
1374
|
+
var DATA_API_KEY = '.data-api';
|
1375
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
1376
|
+
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
|
1377
|
+
var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
|
1378
|
+
var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
|
1379
|
+
var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
|
1380
|
+
|
1381
|
+
var Event = {
|
1382
|
+
HIDE: 'hide' + EVENT_KEY,
|
1383
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
1384
|
+
SHOW: 'show' + EVENT_KEY,
|
1385
|
+
SHOWN: 'shown' + EVENT_KEY,
|
1386
|
+
CLICK: 'click' + EVENT_KEY,
|
1387
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
|
1388
|
+
FOCUSIN_DATA_API: 'focusin' + EVENT_KEY + DATA_API_KEY,
|
1389
|
+
KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY
|
1390
|
+
};
|
1391
|
+
|
1392
|
+
var ClassName = {
|
1393
|
+
BACKDROP: 'dropdown-backdrop',
|
1394
|
+
DISABLED: 'disabled',
|
1395
|
+
SHOW: 'show'
|
1396
|
+
};
|
1397
|
+
|
1398
|
+
var Selector = {
|
1399
|
+
BACKDROP: '.dropdown-backdrop',
|
1400
|
+
DATA_TOGGLE: '[data-toggle="dropdown"]',
|
1401
|
+
FORM_CHILD: '.dropdown form',
|
1402
|
+
ROLE_MENU: '[role="menu"]',
|
1403
|
+
ROLE_LISTBOX: '[role="listbox"]',
|
1404
|
+
NAVBAR_NAV: '.navbar-nav',
|
1405
|
+
VISIBLE_ITEMS: '[role="menu"] li:not(.disabled) a, ' + '[role="listbox"] li:not(.disabled) a'
|
1406
|
+
};
|
1407
|
+
|
1408
|
+
/**
|
1409
|
+
* ------------------------------------------------------------------------
|
1410
|
+
* Class Definition
|
1411
|
+
* ------------------------------------------------------------------------
|
1412
|
+
*/
|
1413
|
+
|
1414
|
+
var Dropdown = function () {
|
1415
|
+
function Dropdown(element) {
|
1416
|
+
_classCallCheck(this, Dropdown);
|
1417
|
+
|
1418
|
+
this._element = element;
|
1419
|
+
|
1420
|
+
this._addEventListeners();
|
1421
|
+
}
|
1422
|
+
|
1423
|
+
// getters
|
1424
|
+
|
1425
|
+
// public
|
1426
|
+
|
1427
|
+
Dropdown.prototype.toggle = function toggle() {
|
1428
|
+
if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
|
1429
|
+
return false;
|
1430
|
+
}
|
1431
|
+
|
1432
|
+
var parent = Dropdown._getParentFromElement(this);
|
1433
|
+
var isActive = $(parent).hasClass(ClassName.SHOW);
|
1434
|
+
|
1435
|
+
Dropdown._clearMenus();
|
1436
|
+
|
1437
|
+
if (isActive) {
|
1438
|
+
return false;
|
1439
|
+
}
|
1440
|
+
|
1441
|
+
if ('ontouchstart' in document.documentElement && !$(parent).closest(Selector.NAVBAR_NAV).length) {
|
1442
|
+
|
1443
|
+
// if mobile we use a backdrop because click events don't delegate
|
1444
|
+
var dropdown = document.createElement('div');
|
1445
|
+
dropdown.className = ClassName.BACKDROP;
|
1446
|
+
$(dropdown).insertBefore(this);
|
1447
|
+
$(dropdown).on('click', Dropdown._clearMenus);
|
1448
|
+
}
|
1449
|
+
|
1450
|
+
var relatedTarget = {
|
1451
|
+
relatedTarget: this
|
1452
|
+
};
|
1453
|
+
var showEvent = $.Event(Event.SHOW, relatedTarget);
|
1454
|
+
|
1455
|
+
$(parent).trigger(showEvent);
|
1456
|
+
|
1457
|
+
if (showEvent.isDefaultPrevented()) {
|
1458
|
+
return false;
|
1459
|
+
}
|
1460
|
+
|
1461
|
+
this.focus();
|
1462
|
+
this.setAttribute('aria-expanded', true);
|
1463
|
+
|
1464
|
+
$(parent).toggleClass(ClassName.SHOW);
|
1465
|
+
$(parent).trigger($.Event(Event.SHOWN, relatedTarget));
|
1466
|
+
|
1467
|
+
return false;
|
1468
|
+
};
|
1469
|
+
|
1470
|
+
Dropdown.prototype.dispose = function dispose() {
|
1471
|
+
$.removeData(this._element, DATA_KEY);
|
1472
|
+
$(this._element).off(EVENT_KEY);
|
1473
|
+
this._element = null;
|
1474
|
+
};
|
1475
|
+
|
1476
|
+
// private
|
1477
|
+
|
1478
|
+
Dropdown.prototype._addEventListeners = function _addEventListeners() {
|
1479
|
+
$(this._element).on(Event.CLICK, this.toggle);
|
1480
|
+
};
|
1481
|
+
|
1482
|
+
// static
|
1483
|
+
|
1484
|
+
Dropdown._jQueryInterface = function _jQueryInterface(config) {
|
1485
|
+
return this.each(function () {
|
1486
|
+
var data = $(this).data(DATA_KEY);
|
1487
|
+
|
1488
|
+
if (!data) {
|
1489
|
+
data = new Dropdown(this);
|
1490
|
+
$(this).data(DATA_KEY, data);
|
1491
|
+
}
|
1492
|
+
|
1493
|
+
if (typeof config === 'string') {
|
1494
|
+
if (data[config] === undefined) {
|
1495
|
+
throw new Error('No method named "' + config + '"');
|
1496
|
+
}
|
1497
|
+
data[config].call(this);
|
1498
|
+
}
|
1499
|
+
});
|
1500
|
+
};
|
1501
|
+
|
1502
|
+
Dropdown._clearMenus = function _clearMenus(event) {
|
1503
|
+
if (event && event.which === RIGHT_MOUSE_BUTTON_WHICH) {
|
1504
|
+
return;
|
1505
|
+
}
|
1506
|
+
|
1507
|
+
var backdrop = $(Selector.BACKDROP)[0];
|
1508
|
+
if (backdrop) {
|
1509
|
+
backdrop.parentNode.removeChild(backdrop);
|
1510
|
+
}
|
1511
|
+
|
1512
|
+
var toggles = $.makeArray($(Selector.DATA_TOGGLE));
|
1513
|
+
|
1514
|
+
for (var i = 0; i < toggles.length; i++) {
|
1515
|
+
var parent = Dropdown._getParentFromElement(toggles[i]);
|
1516
|
+
var relatedTarget = {
|
1517
|
+
relatedTarget: toggles[i]
|
1518
|
+
};
|
1519
|
+
|
1520
|
+
if (!$(parent).hasClass(ClassName.SHOW)) {
|
1521
|
+
continue;
|
1522
|
+
}
|
1523
|
+
|
1524
|
+
if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'focusin') && $.contains(parent, event.target)) {
|
1525
|
+
continue;
|
1526
|
+
}
|
1527
|
+
|
1528
|
+
var hideEvent = $.Event(Event.HIDE, relatedTarget);
|
1529
|
+
$(parent).trigger(hideEvent);
|
1530
|
+
if (hideEvent.isDefaultPrevented()) {
|
1531
|
+
continue;
|
1532
|
+
}
|
1533
|
+
|
1534
|
+
toggles[i].setAttribute('aria-expanded', 'false');
|
1535
|
+
|
1536
|
+
$(parent).removeClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget));
|
1537
|
+
}
|
1538
|
+
};
|
1539
|
+
|
1540
|
+
Dropdown._getParentFromElement = function _getParentFromElement(element) {
|
1541
|
+
var parent = void 0;
|
1542
|
+
var selector = Util.getSelectorFromElement(element);
|
1543
|
+
|
1544
|
+
if (selector) {
|
1545
|
+
parent = $(selector)[0];
|
1546
|
+
}
|
1547
|
+
|
1548
|
+
return parent || element.parentNode;
|
1549
|
+
};
|
1550
|
+
|
1551
|
+
Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
|
1552
|
+
if (!/(38|40|27|32)/.test(event.which) || /input|textarea/i.test(event.target.tagName)) {
|
1553
|
+
return;
|
1554
|
+
}
|
1555
|
+
|
1556
|
+
event.preventDefault();
|
1557
|
+
event.stopPropagation();
|
1558
|
+
|
1559
|
+
if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
|
1560
|
+
return;
|
1561
|
+
}
|
1562
|
+
|
1563
|
+
var parent = Dropdown._getParentFromElement(this);
|
1564
|
+
var isActive = $(parent).hasClass(ClassName.SHOW);
|
1565
|
+
|
1566
|
+
if (!isActive && event.which !== ESCAPE_KEYCODE || isActive && event.which === ESCAPE_KEYCODE) {
|
1567
|
+
|
1568
|
+
if (event.which === ESCAPE_KEYCODE) {
|
1569
|
+
var toggle = $(parent).find(Selector.DATA_TOGGLE)[0];
|
1570
|
+
$(toggle).trigger('focus');
|
1571
|
+
}
|
1572
|
+
|
1573
|
+
$(this).trigger('click');
|
1574
|
+
return;
|
1575
|
+
}
|
1576
|
+
|
1577
|
+
var items = $(parent).find(Selector.VISIBLE_ITEMS).get();
|
1578
|
+
|
1579
|
+
if (!items.length) {
|
1580
|
+
return;
|
1581
|
+
}
|
1582
|
+
|
1583
|
+
var index = items.indexOf(event.target);
|
1584
|
+
|
1585
|
+
if (event.which === ARROW_UP_KEYCODE && index > 0) {
|
1586
|
+
// up
|
1587
|
+
index--;
|
1588
|
+
}
|
1589
|
+
|
1590
|
+
if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
|
1591
|
+
// down
|
1592
|
+
index++;
|
1593
|
+
}
|
1594
|
+
|
1595
|
+
if (index < 0) {
|
1596
|
+
index = 0;
|
1597
|
+
}
|
1598
|
+
|
1599
|
+
items[index].focus();
|
1600
|
+
};
|
1601
|
+
|
1602
|
+
_createClass(Dropdown, null, [{
|
1603
|
+
key: 'VERSION',
|
1604
|
+
get: function get() {
|
1605
|
+
return VERSION;
|
1606
|
+
}
|
1607
|
+
}]);
|
1608
|
+
|
1609
|
+
return Dropdown;
|
1610
|
+
}();
|
1611
|
+
|
1612
|
+
/**
|
1613
|
+
* ------------------------------------------------------------------------
|
1614
|
+
* Data Api implementation
|
1615
|
+
* ------------------------------------------------------------------------
|
1616
|
+
*/
|
1617
|
+
|
1618
|
+
$(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API + ' ' + Event.FOCUSIN_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
|
1619
|
+
e.stopPropagation();
|
1620
|
+
});
|
1621
|
+
|
1622
|
+
/**
|
1623
|
+
* ------------------------------------------------------------------------
|
1624
|
+
* jQuery
|
1625
|
+
* ------------------------------------------------------------------------
|
1626
|
+
*/
|
1627
|
+
|
1628
|
+
$.fn[NAME] = Dropdown._jQueryInterface;
|
1629
|
+
$.fn[NAME].Constructor = Dropdown;
|
1630
|
+
$.fn[NAME].noConflict = function () {
|
1631
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
1632
|
+
return Dropdown._jQueryInterface;
|
1633
|
+
};
|
1634
|
+
|
1635
|
+
return Dropdown;
|
1636
|
+
}(jQuery);
|
1637
|
+
|
1638
|
+
/**
|
1639
|
+
* --------------------------------------------------------------------------
|
1640
|
+
* Bootstrap (v4.0.0-alpha.6): modal.js
|
1641
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
1642
|
+
* --------------------------------------------------------------------------
|
1643
|
+
*/
|
1644
|
+
|
1645
|
+
var Modal = function ($) {
|
1646
|
+
|
1647
|
+
/**
|
1648
|
+
* ------------------------------------------------------------------------
|
1649
|
+
* Constants
|
1650
|
+
* ------------------------------------------------------------------------
|
1651
|
+
*/
|
1652
|
+
|
1653
|
+
var NAME = 'modal';
|
1654
|
+
var VERSION = '4.0.0-alpha.6';
|
1655
|
+
var DATA_KEY = 'bs.modal';
|
1656
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
1657
|
+
var DATA_API_KEY = '.data-api';
|
1658
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
1659
|
+
var TRANSITION_DURATION = 300;
|
1660
|
+
var BACKDROP_TRANSITION_DURATION = 150;
|
1661
|
+
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
|
1662
|
+
|
1663
|
+
var Default = {
|
1664
|
+
backdrop: true,
|
1665
|
+
keyboard: true,
|
1666
|
+
focus: true,
|
1667
|
+
show: true
|
1668
|
+
};
|
1669
|
+
|
1670
|
+
var DefaultType = {
|
1671
|
+
backdrop: '(boolean|string)',
|
1672
|
+
keyboard: 'boolean',
|
1673
|
+
focus: 'boolean',
|
1674
|
+
show: 'boolean'
|
1675
|
+
};
|
1676
|
+
|
1677
|
+
var Event = {
|
1678
|
+
HIDE: 'hide' + EVENT_KEY,
|
1679
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
1680
|
+
SHOW: 'show' + EVENT_KEY,
|
1681
|
+
SHOWN: 'shown' + EVENT_KEY,
|
1682
|
+
FOCUSIN: 'focusin' + EVENT_KEY,
|
1683
|
+
RESIZE: 'resize' + EVENT_KEY,
|
1684
|
+
CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
|
1685
|
+
KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
|
1686
|
+
MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
|
1687
|
+
MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
|
1688
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
|
1689
|
+
};
|
1690
|
+
|
1691
|
+
var ClassName = {
|
1692
|
+
SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
|
1693
|
+
BACKDROP: 'modal-backdrop',
|
1694
|
+
OPEN: 'modal-open',
|
1695
|
+
FADE: 'fade',
|
1696
|
+
SHOW: 'show'
|
1697
|
+
};
|
1698
|
+
|
1699
|
+
var Selector = {
|
1700
|
+
DIALOG: '.modal-dialog',
|
1701
|
+
DATA_TOGGLE: '[data-toggle="modal"]',
|
1702
|
+
DATA_DISMISS: '[data-dismiss="modal"]',
|
1703
|
+
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'
|
1704
|
+
};
|
1705
|
+
|
1706
|
+
/**
|
1707
|
+
* ------------------------------------------------------------------------
|
1708
|
+
* Class Definition
|
1709
|
+
* ------------------------------------------------------------------------
|
1710
|
+
*/
|
1711
|
+
|
1712
|
+
var Modal = function () {
|
1713
|
+
function Modal(element, config) {
|
1714
|
+
_classCallCheck(this, Modal);
|
1715
|
+
|
1716
|
+
this._config = this._getConfig(config);
|
1717
|
+
this._element = element;
|
1718
|
+
this._dialog = $(element).find(Selector.DIALOG)[0];
|
1719
|
+
this._backdrop = null;
|
1720
|
+
this._isShown = false;
|
1721
|
+
this._isBodyOverflowing = false;
|
1722
|
+
this._ignoreBackdropClick = false;
|
1723
|
+
this._isTransitioning = false;
|
1724
|
+
this._originalBodyPadding = 0;
|
1725
|
+
this._scrollbarWidth = 0;
|
1726
|
+
}
|
1727
|
+
|
1728
|
+
// getters
|
1729
|
+
|
1730
|
+
// public
|
1731
|
+
|
1732
|
+
Modal.prototype.toggle = function toggle(relatedTarget) {
|
1733
|
+
return this._isShown ? this.hide() : this.show(relatedTarget);
|
1734
|
+
};
|
1735
|
+
|
1736
|
+
Modal.prototype.show = function show(relatedTarget) {
|
1737
|
+
var _this9 = this;
|
1738
|
+
|
1739
|
+
if (this._isTransitioning) {
|
1740
|
+
throw new Error('Modal is transitioning');
|
1741
|
+
}
|
1742
|
+
|
1743
|
+
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
1744
|
+
this._isTransitioning = true;
|
1745
|
+
}
|
1746
|
+
var showEvent = $.Event(Event.SHOW, {
|
1747
|
+
relatedTarget: relatedTarget
|
1748
|
+
});
|
1749
|
+
|
1750
|
+
$(this._element).trigger(showEvent);
|
1751
|
+
|
1752
|
+
if (this._isShown || showEvent.isDefaultPrevented()) {
|
1753
|
+
return;
|
1754
|
+
}
|
1755
|
+
|
1756
|
+
this._isShown = true;
|
1757
|
+
|
1758
|
+
this._checkScrollbar();
|
1759
|
+
this._setScrollbar();
|
1760
|
+
|
1761
|
+
$(document.body).addClass(ClassName.OPEN);
|
1762
|
+
|
1763
|
+
this._setEscapeEvent();
|
1764
|
+
this._setResizeEvent();
|
1765
|
+
|
1766
|
+
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
|
1767
|
+
return _this9.hide(event);
|
1768
|
+
});
|
1769
|
+
|
1770
|
+
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
|
1771
|
+
$(_this9._element).one(Event.MOUSEUP_DISMISS, function (event) {
|
1772
|
+
if ($(event.target).is(_this9._element)) {
|
1773
|
+
_this9._ignoreBackdropClick = true;
|
1774
|
+
}
|
1775
|
+
});
|
1776
|
+
});
|
1777
|
+
|
1778
|
+
this._showBackdrop(function () {
|
1779
|
+
return _this9._showElement(relatedTarget);
|
1780
|
+
});
|
1781
|
+
};
|
1782
|
+
|
1783
|
+
Modal.prototype.hide = function hide(event) {
|
1784
|
+
var _this10 = this;
|
1785
|
+
|
1786
|
+
if (event) {
|
1787
|
+
event.preventDefault();
|
1788
|
+
}
|
1789
|
+
|
1790
|
+
if (this._isTransitioning) {
|
1791
|
+
throw new Error('Modal is transitioning');
|
1792
|
+
}
|
1793
|
+
|
1794
|
+
var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
|
1795
|
+
if (transition) {
|
1796
|
+
this._isTransitioning = true;
|
1797
|
+
}
|
1798
|
+
|
1799
|
+
var hideEvent = $.Event(Event.HIDE);
|
1800
|
+
$(this._element).trigger(hideEvent);
|
1801
|
+
|
1802
|
+
if (!this._isShown || hideEvent.isDefaultPrevented()) {
|
1803
|
+
return;
|
1804
|
+
}
|
1805
|
+
|
1806
|
+
this._isShown = false;
|
1807
|
+
|
1808
|
+
this._setEscapeEvent();
|
1809
|
+
this._setResizeEvent();
|
1810
|
+
|
1811
|
+
$(document).off(Event.FOCUSIN);
|
1812
|
+
|
1813
|
+
$(this._element).removeClass(ClassName.SHOW);
|
1814
|
+
|
1815
|
+
$(this._element).off(Event.CLICK_DISMISS);
|
1816
|
+
$(this._dialog).off(Event.MOUSEDOWN_DISMISS);
|
1817
|
+
|
1818
|
+
if (transition) {
|
1819
|
+
$(this._element).one(Util.TRANSITION_END, function (event) {
|
1820
|
+
return _this10._hideModal(event);
|
1821
|
+
}).emulateTransitionEnd(TRANSITION_DURATION);
|
1822
|
+
} else {
|
1823
|
+
this._hideModal();
|
1824
|
+
}
|
1825
|
+
};
|
1826
|
+
|
1827
|
+
Modal.prototype.dispose = function dispose() {
|
1828
|
+
$.removeData(this._element, DATA_KEY);
|
1829
|
+
|
1830
|
+
$(window, document, this._element, this._backdrop).off(EVENT_KEY);
|
1831
|
+
|
1832
|
+
this._config = null;
|
1833
|
+
this._element = null;
|
1834
|
+
this._dialog = null;
|
1835
|
+
this._backdrop = null;
|
1836
|
+
this._isShown = null;
|
1837
|
+
this._isBodyOverflowing = null;
|
1838
|
+
this._ignoreBackdropClick = null;
|
1839
|
+
this._originalBodyPadding = null;
|
1840
|
+
this._scrollbarWidth = null;
|
1841
|
+
};
|
1842
|
+
|
1843
|
+
// private
|
1844
|
+
|
1845
|
+
Modal.prototype._getConfig = function _getConfig(config) {
|
1846
|
+
config = $.extend({}, Default, config);
|
1847
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
1848
|
+
return config;
|
1849
|
+
};
|
1850
|
+
|
1851
|
+
Modal.prototype._showElement = function _showElement(relatedTarget) {
|
1852
|
+
var _this11 = this;
|
1853
|
+
|
1854
|
+
var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
|
1855
|
+
|
1856
|
+
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
1857
|
+
// don't move modals dom position
|
1858
|
+
document.body.appendChild(this._element);
|
1859
|
+
}
|
1860
|
+
|
1861
|
+
this._element.style.display = 'block';
|
1862
|
+
this._element.removeAttribute('aria-hidden');
|
1863
|
+
this._element.scrollTop = 0;
|
1864
|
+
|
1865
|
+
if (transition) {
|
1866
|
+
Util.reflow(this._element);
|
1867
|
+
}
|
1868
|
+
|
1869
|
+
$(this._element).addClass(ClassName.SHOW);
|
1870
|
+
|
1871
|
+
if (this._config.focus) {
|
1872
|
+
this._enforceFocus();
|
1873
|
+
}
|
1874
|
+
|
1875
|
+
var shownEvent = $.Event(Event.SHOWN, {
|
1876
|
+
relatedTarget: relatedTarget
|
1877
|
+
});
|
1878
|
+
|
1879
|
+
var transitionComplete = function transitionComplete() {
|
1880
|
+
if (_this11._config.focus) {
|
1881
|
+
_this11._element.focus();
|
1882
|
+
}
|
1883
|
+
_this11._isTransitioning = false;
|
1884
|
+
$(_this11._element).trigger(shownEvent);
|
1885
|
+
};
|
1886
|
+
|
1887
|
+
if (transition) {
|
1888
|
+
$(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
|
1889
|
+
} else {
|
1890
|
+
transitionComplete();
|
1891
|
+
}
|
1892
|
+
};
|
1893
|
+
|
1894
|
+
Modal.prototype._enforceFocus = function _enforceFocus() {
|
1895
|
+
var _this12 = this;
|
1896
|
+
|
1897
|
+
$(document).off(Event.FOCUSIN) // guard against infinite focus loop
|
1898
|
+
.on(Event.FOCUSIN, function (event) {
|
1899
|
+
if (document !== event.target && _this12._element !== event.target && !$(_this12._element).has(event.target).length) {
|
1900
|
+
_this12._element.focus();
|
1901
|
+
}
|
1902
|
+
});
|
1903
|
+
};
|
1904
|
+
|
1905
|
+
Modal.prototype._setEscapeEvent = function _setEscapeEvent() {
|
1906
|
+
var _this13 = this;
|
1907
|
+
|
1908
|
+
if (this._isShown && this._config.keyboard) {
|
1909
|
+
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
|
1910
|
+
if (event.which === ESCAPE_KEYCODE) {
|
1911
|
+
_this13.hide();
|
1912
|
+
}
|
1913
|
+
});
|
1914
|
+
} else if (!this._isShown) {
|
1915
|
+
$(this._element).off(Event.KEYDOWN_DISMISS);
|
1916
|
+
}
|
1917
|
+
};
|
1918
|
+
|
1919
|
+
Modal.prototype._setResizeEvent = function _setResizeEvent() {
|
1920
|
+
var _this14 = this;
|
1921
|
+
|
1922
|
+
if (this._isShown) {
|
1923
|
+
$(window).on(Event.RESIZE, function (event) {
|
1924
|
+
return _this14._handleUpdate(event);
|
1925
|
+
});
|
1926
|
+
} else {
|
1927
|
+
$(window).off(Event.RESIZE);
|
1928
|
+
}
|
1929
|
+
};
|
1930
|
+
|
1931
|
+
Modal.prototype._hideModal = function _hideModal() {
|
1932
|
+
var _this15 = this;
|
1933
|
+
|
1934
|
+
this._element.style.display = 'none';
|
1935
|
+
this._element.setAttribute('aria-hidden', 'true');
|
1936
|
+
this._isTransitioning = false;
|
1937
|
+
this._showBackdrop(function () {
|
1938
|
+
$(document.body).removeClass(ClassName.OPEN);
|
1939
|
+
_this15._resetAdjustments();
|
1940
|
+
_this15._resetScrollbar();
|
1941
|
+
$(_this15._element).trigger(Event.HIDDEN);
|
1942
|
+
});
|
1943
|
+
};
|
1944
|
+
|
1945
|
+
Modal.prototype._removeBackdrop = function _removeBackdrop() {
|
1946
|
+
if (this._backdrop) {
|
1947
|
+
$(this._backdrop).remove();
|
1948
|
+
this._backdrop = null;
|
1949
|
+
}
|
1950
|
+
};
|
1951
|
+
|
1952
|
+
Modal.prototype._showBackdrop = function _showBackdrop(callback) {
|
1953
|
+
var _this16 = this;
|
1954
|
+
|
1955
|
+
var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
|
1956
|
+
|
1957
|
+
if (this._isShown && this._config.backdrop) {
|
1958
|
+
var doAnimate = Util.supportsTransitionEnd() && animate;
|
1959
|
+
|
1960
|
+
this._backdrop = document.createElement('div');
|
1961
|
+
this._backdrop.className = ClassName.BACKDROP;
|
1962
|
+
|
1963
|
+
if (animate) {
|
1964
|
+
$(this._backdrop).addClass(animate);
|
1965
|
+
}
|
1966
|
+
|
1967
|
+
$(this._backdrop).appendTo(document.body);
|
1968
|
+
|
1969
|
+
$(this._element).on(Event.CLICK_DISMISS, function (event) {
|
1970
|
+
if (_this16._ignoreBackdropClick) {
|
1971
|
+
_this16._ignoreBackdropClick = false;
|
1972
|
+
return;
|
1973
|
+
}
|
1974
|
+
if (event.target !== event.currentTarget) {
|
1975
|
+
return;
|
1976
|
+
}
|
1977
|
+
if (_this16._config.backdrop === 'static') {
|
1978
|
+
_this16._element.focus();
|
1979
|
+
} else {
|
1980
|
+
_this16.hide();
|
1981
|
+
}
|
1982
|
+
});
|
1983
|
+
|
1984
|
+
if (doAnimate) {
|
1985
|
+
Util.reflow(this._backdrop);
|
1986
|
+
}
|
1987
|
+
|
1988
|
+
$(this._backdrop).addClass(ClassName.SHOW);
|
1989
|
+
|
1990
|
+
if (!callback) {
|
1991
|
+
return;
|
1992
|
+
}
|
1993
|
+
|
1994
|
+
if (!doAnimate) {
|
1995
|
+
callback();
|
1996
|
+
return;
|
1997
|
+
}
|
1998
|
+
|
1999
|
+
$(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
|
2000
|
+
} else if (!this._isShown && this._backdrop) {
|
2001
|
+
$(this._backdrop).removeClass(ClassName.SHOW);
|
2002
|
+
|
2003
|
+
var callbackRemove = function callbackRemove() {
|
2004
|
+
_this16._removeBackdrop();
|
2005
|
+
if (callback) {
|
2006
|
+
callback();
|
2007
|
+
}
|
2008
|
+
};
|
2009
|
+
|
2010
|
+
if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
|
2011
|
+
$(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
|
2012
|
+
} else {
|
2013
|
+
callbackRemove();
|
2014
|
+
}
|
2015
|
+
} else if (callback) {
|
2016
|
+
callback();
|
2017
|
+
}
|
2018
|
+
};
|
2019
|
+
|
2020
|
+
// ----------------------------------------------------------------------
|
2021
|
+
// the following methods are used to handle overflowing modals
|
2022
|
+
// todo (fat): these should probably be refactored out of modal.js
|
2023
|
+
// ----------------------------------------------------------------------
|
2024
|
+
|
2025
|
+
Modal.prototype._handleUpdate = function _handleUpdate() {
|
2026
|
+
this._adjustDialog();
|
2027
|
+
};
|
2028
|
+
|
2029
|
+
Modal.prototype._adjustDialog = function _adjustDialog() {
|
2030
|
+
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
2031
|
+
|
2032
|
+
if (!this._isBodyOverflowing && isModalOverflowing) {
|
2033
|
+
this._element.style.paddingLeft = this._scrollbarWidth + 'px';
|
2034
|
+
}
|
2035
|
+
|
2036
|
+
if (this._isBodyOverflowing && !isModalOverflowing) {
|
2037
|
+
this._element.style.paddingRight = this._scrollbarWidth + 'px';
|
2038
|
+
}
|
2039
|
+
};
|
2040
|
+
|
2041
|
+
Modal.prototype._resetAdjustments = function _resetAdjustments() {
|
2042
|
+
this._element.style.paddingLeft = '';
|
2043
|
+
this._element.style.paddingRight = '';
|
2044
|
+
};
|
2045
|
+
|
2046
|
+
Modal.prototype._checkScrollbar = function _checkScrollbar() {
|
2047
|
+
this._isBodyOverflowing = document.body.clientWidth < window.innerWidth;
|
2048
|
+
this._scrollbarWidth = this._getScrollbarWidth();
|
2049
|
+
};
|
2050
|
+
|
2051
|
+
Modal.prototype._setScrollbar = function _setScrollbar() {
|
2052
|
+
var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10);
|
2053
|
+
|
2054
|
+
this._originalBodyPadding = document.body.style.paddingRight || '';
|
2055
|
+
|
2056
|
+
if (this._isBodyOverflowing) {
|
2057
|
+
document.body.style.paddingRight = bodyPadding + this._scrollbarWidth + 'px';
|
2058
|
+
}
|
2059
|
+
};
|
2060
|
+
|
2061
|
+
Modal.prototype._resetScrollbar = function _resetScrollbar() {
|
2062
|
+
document.body.style.paddingRight = this._originalBodyPadding;
|
2063
|
+
};
|
2064
|
+
|
2065
|
+
Modal.prototype._getScrollbarWidth = function _getScrollbarWidth() {
|
2066
|
+
// thx d.walsh
|
2067
|
+
var scrollDiv = document.createElement('div');
|
2068
|
+
scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
|
2069
|
+
document.body.appendChild(scrollDiv);
|
2070
|
+
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
2071
|
+
document.body.removeChild(scrollDiv);
|
2072
|
+
return scrollbarWidth;
|
2073
|
+
};
|
2074
|
+
|
2075
|
+
// static
|
2076
|
+
|
2077
|
+
Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
|
2078
|
+
return this.each(function () {
|
2079
|
+
var data = $(this).data(DATA_KEY);
|
2080
|
+
var _config = $.extend({}, Modal.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
|
2081
|
+
|
2082
|
+
if (!data) {
|
2083
|
+
data = new Modal(this, _config);
|
2084
|
+
$(this).data(DATA_KEY, data);
|
2085
|
+
}
|
2086
|
+
|
2087
|
+
if (typeof config === 'string') {
|
2088
|
+
if (data[config] === undefined) {
|
2089
|
+
throw new Error('No method named "' + config + '"');
|
2090
|
+
}
|
2091
|
+
data[config](relatedTarget);
|
2092
|
+
} else if (_config.show) {
|
2093
|
+
data.show(relatedTarget);
|
2094
|
+
}
|
2095
|
+
});
|
2096
|
+
};
|
2097
|
+
|
2098
|
+
_createClass(Modal, null, [{
|
2099
|
+
key: 'VERSION',
|
2100
|
+
get: function get() {
|
2101
|
+
return VERSION;
|
2102
|
+
}
|
2103
|
+
}, {
|
2104
|
+
key: 'Default',
|
2105
|
+
get: function get() {
|
2106
|
+
return Default;
|
2107
|
+
}
|
2108
|
+
}]);
|
2109
|
+
|
2110
|
+
return Modal;
|
2111
|
+
}();
|
2112
|
+
|
2113
|
+
/**
|
2114
|
+
* ------------------------------------------------------------------------
|
2115
|
+
* Data Api implementation
|
2116
|
+
* ------------------------------------------------------------------------
|
2117
|
+
*/
|
2118
|
+
|
2119
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
2120
|
+
var _this17 = this;
|
2121
|
+
|
2122
|
+
var target = void 0;
|
2123
|
+
var selector = Util.getSelectorFromElement(this);
|
2124
|
+
|
2125
|
+
if (selector) {
|
2126
|
+
target = $(selector)[0];
|
2127
|
+
}
|
2128
|
+
|
2129
|
+
var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data());
|
2130
|
+
|
2131
|
+
if (this.tagName === 'A' || this.tagName === 'AREA') {
|
2132
|
+
event.preventDefault();
|
2133
|
+
}
|
2134
|
+
|
2135
|
+
var $target = $(target).one(Event.SHOW, function (showEvent) {
|
2136
|
+
if (showEvent.isDefaultPrevented()) {
|
2137
|
+
// only register focus restorer if modal will actually get shown
|
2138
|
+
return;
|
2139
|
+
}
|
2140
|
+
|
2141
|
+
$target.one(Event.HIDDEN, function () {
|
2142
|
+
if ($(_this17).is(':visible')) {
|
2143
|
+
_this17.focus();
|
2144
|
+
}
|
2145
|
+
});
|
2146
|
+
});
|
2147
|
+
|
2148
|
+
Modal._jQueryInterface.call($(target), config, this);
|
2149
|
+
});
|
2150
|
+
|
2151
|
+
/**
|
2152
|
+
* ------------------------------------------------------------------------
|
2153
|
+
* jQuery
|
2154
|
+
* ------------------------------------------------------------------------
|
2155
|
+
*/
|
2156
|
+
|
2157
|
+
$.fn[NAME] = Modal._jQueryInterface;
|
2158
|
+
$.fn[NAME].Constructor = Modal;
|
2159
|
+
$.fn[NAME].noConflict = function () {
|
2160
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
2161
|
+
return Modal._jQueryInterface;
|
2162
|
+
};
|
2163
|
+
|
2164
|
+
return Modal;
|
2165
|
+
}(jQuery);
|
2166
|
+
|
2167
|
+
/**
|
2168
|
+
* --------------------------------------------------------------------------
|
2169
|
+
* Bootstrap (v4.0.0-alpha.6): scrollspy.js
|
2170
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
2171
|
+
* --------------------------------------------------------------------------
|
2172
|
+
*/
|
2173
|
+
|
2174
|
+
var ScrollSpy = function ($) {
|
2175
|
+
|
2176
|
+
/**
|
2177
|
+
* ------------------------------------------------------------------------
|
2178
|
+
* Constants
|
2179
|
+
* ------------------------------------------------------------------------
|
2180
|
+
*/
|
2181
|
+
|
2182
|
+
var NAME = 'scrollspy';
|
2183
|
+
var VERSION = '4.0.0-alpha.6';
|
2184
|
+
var DATA_KEY = 'bs.scrollspy';
|
2185
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
2186
|
+
var DATA_API_KEY = '.data-api';
|
2187
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
2188
|
+
|
2189
|
+
var Default = {
|
2190
|
+
offset: 10,
|
2191
|
+
method: 'auto',
|
2192
|
+
target: ''
|
2193
|
+
};
|
2194
|
+
|
2195
|
+
var DefaultType = {
|
2196
|
+
offset: 'number',
|
2197
|
+
method: 'string',
|
2198
|
+
target: '(string|element)'
|
2199
|
+
};
|
2200
|
+
|
2201
|
+
var Event = {
|
2202
|
+
ACTIVATE: 'activate' + EVENT_KEY,
|
2203
|
+
SCROLL: 'scroll' + EVENT_KEY,
|
2204
|
+
LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
|
2205
|
+
};
|
2206
|
+
|
2207
|
+
var ClassName = {
|
2208
|
+
DROPDOWN_ITEM: 'dropdown-item',
|
2209
|
+
DROPDOWN_MENU: 'dropdown-menu',
|
2210
|
+
NAV_LINK: 'nav-link',
|
2211
|
+
NAV: 'nav',
|
2212
|
+
ACTIVE: 'active'
|
2213
|
+
};
|
2214
|
+
|
2215
|
+
var Selector = {
|
2216
|
+
DATA_SPY: '[data-spy="scroll"]',
|
2217
|
+
ACTIVE: '.active',
|
2218
|
+
LIST_ITEM: '.list-item',
|
2219
|
+
LI: 'li',
|
2220
|
+
LI_DROPDOWN: 'li.dropdown',
|
2221
|
+
NAV_LINKS: '.nav-link',
|
2222
|
+
DROPDOWN: '.dropdown',
|
2223
|
+
DROPDOWN_ITEMS: '.dropdown-item',
|
2224
|
+
DROPDOWN_TOGGLE: '.dropdown-toggle'
|
2225
|
+
};
|
2226
|
+
|
2227
|
+
var OffsetMethod = {
|
2228
|
+
OFFSET: 'offset',
|
2229
|
+
POSITION: 'position'
|
2230
|
+
};
|
2231
|
+
|
2232
|
+
/**
|
2233
|
+
* ------------------------------------------------------------------------
|
2234
|
+
* Class Definition
|
2235
|
+
* ------------------------------------------------------------------------
|
2236
|
+
*/
|
2237
|
+
|
2238
|
+
var ScrollSpy = function () {
|
2239
|
+
function ScrollSpy(element, config) {
|
2240
|
+
var _this18 = this;
|
2241
|
+
|
2242
|
+
_classCallCheck(this, ScrollSpy);
|
2243
|
+
|
2244
|
+
this._element = element;
|
2245
|
+
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
2246
|
+
this._config = this._getConfig(config);
|
2247
|
+
this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
|
2248
|
+
this._offsets = [];
|
2249
|
+
this._targets = [];
|
2250
|
+
this._activeTarget = null;
|
2251
|
+
this._scrollHeight = 0;
|
2252
|
+
|
2253
|
+
$(this._scrollElement).on(Event.SCROLL, function (event) {
|
2254
|
+
return _this18._process(event);
|
2255
|
+
});
|
2256
|
+
|
2257
|
+
this.refresh();
|
2258
|
+
this._process();
|
2259
|
+
}
|
2260
|
+
|
2261
|
+
// getters
|
2262
|
+
|
2263
|
+
// public
|
2264
|
+
|
2265
|
+
ScrollSpy.prototype.refresh = function refresh() {
|
2266
|
+
var _this19 = this;
|
2267
|
+
|
2268
|
+
var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
|
2269
|
+
|
2270
|
+
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
|
2271
|
+
|
2272
|
+
var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
|
2273
|
+
|
2274
|
+
this._offsets = [];
|
2275
|
+
this._targets = [];
|
2276
|
+
|
2277
|
+
this._scrollHeight = this._getScrollHeight();
|
2278
|
+
|
2279
|
+
var targets = $.makeArray($(this._selector));
|
2280
|
+
|
2281
|
+
targets.map(function (element) {
|
2282
|
+
var target = void 0;
|
2283
|
+
var targetSelector = Util.getSelectorFromElement(element);
|
2284
|
+
|
2285
|
+
if (targetSelector) {
|
2286
|
+
target = $(targetSelector)[0];
|
2287
|
+
}
|
2288
|
+
|
2289
|
+
if (target && (target.offsetWidth || target.offsetHeight)) {
|
2290
|
+
// todo (fat): remove sketch reliance on jQuery position/offset
|
2291
|
+
return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
|
2292
|
+
}
|
2293
|
+
return null;
|
2294
|
+
}).filter(function (item) {
|
2295
|
+
return item;
|
2296
|
+
}).sort(function (a, b) {
|
2297
|
+
return a[0] - b[0];
|
2298
|
+
}).forEach(function (item) {
|
2299
|
+
_this19._offsets.push(item[0]);
|
2300
|
+
_this19._targets.push(item[1]);
|
2301
|
+
});
|
2302
|
+
};
|
2303
|
+
|
2304
|
+
ScrollSpy.prototype.dispose = function dispose() {
|
2305
|
+
$.removeData(this._element, DATA_KEY);
|
2306
|
+
$(this._scrollElement).off(EVENT_KEY);
|
2307
|
+
|
2308
|
+
this._element = null;
|
2309
|
+
this._scrollElement = null;
|
2310
|
+
this._config = null;
|
2311
|
+
this._selector = null;
|
2312
|
+
this._offsets = null;
|
2313
|
+
this._targets = null;
|
2314
|
+
this._activeTarget = null;
|
2315
|
+
this._scrollHeight = null;
|
2316
|
+
};
|
2317
|
+
|
2318
|
+
// private
|
2319
|
+
|
2320
|
+
ScrollSpy.prototype._getConfig = function _getConfig(config) {
|
2321
|
+
config = $.extend({}, Default, config);
|
2322
|
+
|
2323
|
+
if (typeof config.target !== 'string') {
|
2324
|
+
var id = $(config.target).attr('id');
|
2325
|
+
if (!id) {
|
2326
|
+
id = Util.getUID(NAME);
|
2327
|
+
$(config.target).attr('id', id);
|
2328
|
+
}
|
2329
|
+
config.target = '#' + id;
|
2330
|
+
}
|
2331
|
+
|
2332
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
2333
|
+
|
2334
|
+
return config;
|
2335
|
+
};
|
2336
|
+
|
2337
|
+
ScrollSpy.prototype._getScrollTop = function _getScrollTop() {
|
2338
|
+
return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
|
2339
|
+
};
|
2340
|
+
|
2341
|
+
ScrollSpy.prototype._getScrollHeight = function _getScrollHeight() {
|
2342
|
+
return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
|
2343
|
+
};
|
2344
|
+
|
2345
|
+
ScrollSpy.prototype._getOffsetHeight = function _getOffsetHeight() {
|
2346
|
+
return this._scrollElement === window ? window.innerHeight : this._scrollElement.offsetHeight;
|
2347
|
+
};
|
2348
|
+
|
2349
|
+
ScrollSpy.prototype._process = function _process() {
|
2350
|
+
var scrollTop = this._getScrollTop() + this._config.offset;
|
2351
|
+
var scrollHeight = this._getScrollHeight();
|
2352
|
+
var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
|
2353
|
+
|
2354
|
+
if (this._scrollHeight !== scrollHeight) {
|
2355
|
+
this.refresh();
|
2356
|
+
}
|
2357
|
+
|
2358
|
+
if (scrollTop >= maxScroll) {
|
2359
|
+
var target = this._targets[this._targets.length - 1];
|
2360
|
+
|
2361
|
+
if (this._activeTarget !== target) {
|
2362
|
+
this._activate(target);
|
2363
|
+
}
|
2364
|
+
return;
|
2365
|
+
}
|
2366
|
+
|
2367
|
+
if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
|
2368
|
+
this._activeTarget = null;
|
2369
|
+
this._clear();
|
2370
|
+
return;
|
2371
|
+
}
|
2372
|
+
|
2373
|
+
for (var i = this._offsets.length; i--;) {
|
2374
|
+
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]);
|
2375
|
+
|
2376
|
+
if (isActiveTarget) {
|
2377
|
+
this._activate(this._targets[i]);
|
2378
|
+
}
|
2379
|
+
}
|
2380
|
+
};
|
2381
|
+
|
2382
|
+
ScrollSpy.prototype._activate = function _activate(target) {
|
2383
|
+
this._activeTarget = target;
|
2384
|
+
|
2385
|
+
this._clear();
|
2386
|
+
|
2387
|
+
var queries = this._selector.split(',');
|
2388
|
+
queries = queries.map(function (selector) {
|
2389
|
+
return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
|
2390
|
+
});
|
2391
|
+
|
2392
|
+
var $link = $(queries.join(','));
|
2393
|
+
|
2394
|
+
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
|
2395
|
+
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
|
2396
|
+
$link.addClass(ClassName.ACTIVE);
|
2397
|
+
} else {
|
2398
|
+
// todo (fat) this is kinda sus...
|
2399
|
+
// recursively add actives to tested nav-links
|
2400
|
+
$link.parents(Selector.LI).find('> ' + Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
|
2401
|
+
}
|
2402
|
+
|
2403
|
+
$(this._scrollElement).trigger(Event.ACTIVATE, {
|
2404
|
+
relatedTarget: target
|
2405
|
+
});
|
2406
|
+
};
|
2407
|
+
|
2408
|
+
ScrollSpy.prototype._clear = function _clear() {
|
2409
|
+
$(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
|
2410
|
+
};
|
2411
|
+
|
2412
|
+
// static
|
2413
|
+
|
2414
|
+
ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
|
2415
|
+
return this.each(function () {
|
2416
|
+
var data = $(this).data(DATA_KEY);
|
2417
|
+
var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config;
|
2418
|
+
|
2419
|
+
if (!data) {
|
2420
|
+
data = new ScrollSpy(this, _config);
|
2421
|
+
$(this).data(DATA_KEY, data);
|
2422
|
+
}
|
2423
|
+
|
2424
|
+
if (typeof config === 'string') {
|
2425
|
+
if (data[config] === undefined) {
|
2426
|
+
throw new Error('No method named "' + config + '"');
|
2427
|
+
}
|
2428
|
+
data[config]();
|
2429
|
+
}
|
2430
|
+
});
|
2431
|
+
};
|
2432
|
+
|
2433
|
+
_createClass(ScrollSpy, null, [{
|
2434
|
+
key: 'VERSION',
|
2435
|
+
get: function get() {
|
2436
|
+
return VERSION;
|
2437
|
+
}
|
2438
|
+
}, {
|
2439
|
+
key: 'Default',
|
2440
|
+
get: function get() {
|
2441
|
+
return Default;
|
2442
|
+
}
|
2443
|
+
}]);
|
2444
|
+
|
2445
|
+
return ScrollSpy;
|
2446
|
+
}();
|
2447
|
+
|
2448
|
+
/**
|
2449
|
+
* ------------------------------------------------------------------------
|
2450
|
+
* Data Api implementation
|
2451
|
+
* ------------------------------------------------------------------------
|
2452
|
+
*/
|
2453
|
+
|
2454
|
+
$(window).on(Event.LOAD_DATA_API, function () {
|
2455
|
+
var scrollSpys = $.makeArray($(Selector.DATA_SPY));
|
2456
|
+
|
2457
|
+
for (var i = scrollSpys.length; i--;) {
|
2458
|
+
var $spy = $(scrollSpys[i]);
|
2459
|
+
ScrollSpy._jQueryInterface.call($spy, $spy.data());
|
2460
|
+
}
|
2461
|
+
});
|
2462
|
+
|
2463
|
+
/**
|
2464
|
+
* ------------------------------------------------------------------------
|
2465
|
+
* jQuery
|
2466
|
+
* ------------------------------------------------------------------------
|
2467
|
+
*/
|
2468
|
+
|
2469
|
+
$.fn[NAME] = ScrollSpy._jQueryInterface;
|
2470
|
+
$.fn[NAME].Constructor = ScrollSpy;
|
2471
|
+
$.fn[NAME].noConflict = function () {
|
2472
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
2473
|
+
return ScrollSpy._jQueryInterface;
|
2474
|
+
};
|
2475
|
+
|
2476
|
+
return ScrollSpy;
|
2477
|
+
}(jQuery);
|
2478
|
+
|
2479
|
+
/**
|
2480
|
+
* --------------------------------------------------------------------------
|
2481
|
+
* Bootstrap (v4.0.0-alpha.6): tab.js
|
2482
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
2483
|
+
* --------------------------------------------------------------------------
|
2484
|
+
*/
|
2485
|
+
|
2486
|
+
var Tab = function ($) {
|
2487
|
+
|
2488
|
+
/**
|
2489
|
+
* ------------------------------------------------------------------------
|
2490
|
+
* Constants
|
2491
|
+
* ------------------------------------------------------------------------
|
2492
|
+
*/
|
2493
|
+
|
2494
|
+
var NAME = 'tab';
|
2495
|
+
var VERSION = '4.0.0-alpha.6';
|
2496
|
+
var DATA_KEY = 'bs.tab';
|
2497
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
2498
|
+
var DATA_API_KEY = '.data-api';
|
2499
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
2500
|
+
var TRANSITION_DURATION = 150;
|
2501
|
+
|
2502
|
+
var Event = {
|
2503
|
+
HIDE: 'hide' + EVENT_KEY,
|
2504
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
2505
|
+
SHOW: 'show' + EVENT_KEY,
|
2506
|
+
SHOWN: 'shown' + EVENT_KEY,
|
2507
|
+
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
|
2508
|
+
};
|
2509
|
+
|
2510
|
+
var ClassName = {
|
2511
|
+
DROPDOWN_MENU: 'dropdown-menu',
|
2512
|
+
ACTIVE: 'active',
|
2513
|
+
DISABLED: 'disabled',
|
2514
|
+
FADE: 'fade',
|
2515
|
+
SHOW: 'show'
|
2516
|
+
};
|
2517
|
+
|
2518
|
+
var Selector = {
|
2519
|
+
A: 'a',
|
2520
|
+
LI: 'li',
|
2521
|
+
DROPDOWN: '.dropdown',
|
2522
|
+
LIST: 'ul:not(.dropdown-menu), ol:not(.dropdown-menu), nav:not(.dropdown-menu)',
|
2523
|
+
FADE_CHILD: '> .nav-item .fade, > .fade',
|
2524
|
+
ACTIVE: '.active',
|
2525
|
+
ACTIVE_CHILD: '> .nav-item > .active, > .active',
|
2526
|
+
DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"]',
|
2527
|
+
DROPDOWN_TOGGLE: '.dropdown-toggle',
|
2528
|
+
DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
|
2529
|
+
};
|
2530
|
+
|
2531
|
+
/**
|
2532
|
+
* ------------------------------------------------------------------------
|
2533
|
+
* Class Definition
|
2534
|
+
* ------------------------------------------------------------------------
|
2535
|
+
*/
|
2536
|
+
|
2537
|
+
var Tab = function () {
|
2538
|
+
function Tab(element) {
|
2539
|
+
_classCallCheck(this, Tab);
|
2540
|
+
|
2541
|
+
this._element = element;
|
2542
|
+
}
|
2543
|
+
|
2544
|
+
// getters
|
2545
|
+
|
2546
|
+
// public
|
2547
|
+
|
2548
|
+
Tab.prototype.show = function show() {
|
2549
|
+
var _this20 = this;
|
2550
|
+
|
2551
|
+
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
|
2552
|
+
return;
|
2553
|
+
}
|
2554
|
+
|
2555
|
+
var target = void 0;
|
2556
|
+
var previous = void 0;
|
2557
|
+
var listElement = $(this._element).closest(Selector.LIST)[0];
|
2558
|
+
var selector = Util.getSelectorFromElement(this._element);
|
2559
|
+
|
2560
|
+
if (listElement) {
|
2561
|
+
previous = $.makeArray($(listElement).find(Selector.ACTIVE));
|
2562
|
+
previous = previous[previous.length - 1];
|
2563
|
+
}
|
2564
|
+
|
2565
|
+
var hideEvent = $.Event(Event.HIDE, {
|
2566
|
+
relatedTarget: this._element
|
2567
|
+
});
|
2568
|
+
|
2569
|
+
var showEvent = $.Event(Event.SHOW, {
|
2570
|
+
relatedTarget: previous
|
2571
|
+
});
|
2572
|
+
|
2573
|
+
if (previous) {
|
2574
|
+
$(previous).trigger(hideEvent);
|
2575
|
+
}
|
2576
|
+
|
2577
|
+
$(this._element).trigger(showEvent);
|
2578
|
+
|
2579
|
+
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
|
2580
|
+
return;
|
2581
|
+
}
|
2582
|
+
|
2583
|
+
if (selector) {
|
2584
|
+
target = $(selector)[0];
|
2585
|
+
}
|
2586
|
+
|
2587
|
+
this._activate(this._element, listElement);
|
2588
|
+
|
2589
|
+
var complete = function complete() {
|
2590
|
+
var hiddenEvent = $.Event(Event.HIDDEN, {
|
2591
|
+
relatedTarget: _this20._element
|
2592
|
+
});
|
2593
|
+
|
2594
|
+
var shownEvent = $.Event(Event.SHOWN, {
|
2595
|
+
relatedTarget: previous
|
2596
|
+
});
|
2597
|
+
|
2598
|
+
$(previous).trigger(hiddenEvent);
|
2599
|
+
$(_this20._element).trigger(shownEvent);
|
2600
|
+
};
|
2601
|
+
|
2602
|
+
if (target) {
|
2603
|
+
this._activate(target, target.parentNode, complete);
|
2604
|
+
} else {
|
2605
|
+
complete();
|
2606
|
+
}
|
2607
|
+
};
|
2608
|
+
|
2609
|
+
Tab.prototype.dispose = function dispose() {
|
2610
|
+
$.removeClass(this._element, DATA_KEY);
|
2611
|
+
this._element = null;
|
2612
|
+
};
|
2613
|
+
|
2614
|
+
// private
|
2615
|
+
|
2616
|
+
Tab.prototype._activate = function _activate(element, container, callback) {
|
2617
|
+
var _this21 = this;
|
2618
|
+
|
2619
|
+
var active = $(container).find(Selector.ACTIVE_CHILD)[0];
|
2620
|
+
var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0]));
|
2621
|
+
|
2622
|
+
var complete = function complete() {
|
2623
|
+
return _this21._transitionComplete(element, active, isTransitioning, callback);
|
2624
|
+
};
|
2625
|
+
|
2626
|
+
if (active && isTransitioning) {
|
2627
|
+
$(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
|
2628
|
+
} else {
|
2629
|
+
complete();
|
2630
|
+
}
|
2631
|
+
|
2632
|
+
if (active) {
|
2633
|
+
$(active).removeClass(ClassName.SHOW);
|
2634
|
+
}
|
2635
|
+
};
|
2636
|
+
|
2637
|
+
Tab.prototype._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) {
|
2638
|
+
if (active) {
|
2639
|
+
$(active).removeClass(ClassName.ACTIVE);
|
2640
|
+
|
2641
|
+
var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
|
2642
|
+
|
2643
|
+
if (dropdownChild) {
|
2644
|
+
$(dropdownChild).removeClass(ClassName.ACTIVE);
|
2645
|
+
}
|
2646
|
+
|
2647
|
+
active.setAttribute('aria-expanded', false);
|
2648
|
+
}
|
2649
|
+
|
2650
|
+
$(element).addClass(ClassName.ACTIVE);
|
2651
|
+
element.setAttribute('aria-expanded', true);
|
2652
|
+
|
2653
|
+
if (isTransitioning) {
|
2654
|
+
Util.reflow(element);
|
2655
|
+
$(element).addClass(ClassName.SHOW);
|
2656
|
+
} else {
|
2657
|
+
$(element).removeClass(ClassName.FADE);
|
2658
|
+
}
|
2659
|
+
|
2660
|
+
if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
|
2661
|
+
|
2662
|
+
var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
|
2663
|
+
if (dropdownElement) {
|
2664
|
+
$(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
|
2665
|
+
}
|
2666
|
+
|
2667
|
+
element.setAttribute('aria-expanded', true);
|
2668
|
+
}
|
2669
|
+
|
2670
|
+
if (callback) {
|
2671
|
+
callback();
|
2672
|
+
}
|
2673
|
+
};
|
2674
|
+
|
2675
|
+
// static
|
2676
|
+
|
2677
|
+
Tab._jQueryInterface = function _jQueryInterface(config) {
|
2678
|
+
return this.each(function () {
|
2679
|
+
var $this = $(this);
|
2680
|
+
var data = $this.data(DATA_KEY);
|
2681
|
+
|
2682
|
+
if (!data) {
|
2683
|
+
data = new Tab(this);
|
2684
|
+
$this.data(DATA_KEY, data);
|
2685
|
+
}
|
2686
|
+
|
2687
|
+
if (typeof config === 'string') {
|
2688
|
+
if (data[config] === undefined) {
|
2689
|
+
throw new Error('No method named "' + config + '"');
|
2690
|
+
}
|
2691
|
+
data[config]();
|
2692
|
+
}
|
2693
|
+
});
|
2694
|
+
};
|
2695
|
+
|
2696
|
+
_createClass(Tab, null, [{
|
2697
|
+
key: 'VERSION',
|
2698
|
+
get: function get() {
|
2699
|
+
return VERSION;
|
2700
|
+
}
|
2701
|
+
}]);
|
2702
|
+
|
2703
|
+
return Tab;
|
2704
|
+
}();
|
2705
|
+
|
2706
|
+
/**
|
2707
|
+
* ------------------------------------------------------------------------
|
2708
|
+
* Data Api implementation
|
2709
|
+
* ------------------------------------------------------------------------
|
2710
|
+
*/
|
2711
|
+
|
2712
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
2713
|
+
event.preventDefault();
|
2714
|
+
Tab._jQueryInterface.call($(this), 'show');
|
2715
|
+
});
|
2716
|
+
|
2717
|
+
/**
|
2718
|
+
* ------------------------------------------------------------------------
|
2719
|
+
* jQuery
|
2720
|
+
* ------------------------------------------------------------------------
|
2721
|
+
*/
|
2722
|
+
|
2723
|
+
$.fn[NAME] = Tab._jQueryInterface;
|
2724
|
+
$.fn[NAME].Constructor = Tab;
|
2725
|
+
$.fn[NAME].noConflict = function () {
|
2726
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
2727
|
+
return Tab._jQueryInterface;
|
2728
|
+
};
|
2729
|
+
|
2730
|
+
return Tab;
|
2731
|
+
}(jQuery);
|
2732
|
+
|
2733
|
+
/* global Tether */
|
2734
|
+
|
2735
|
+
/**
|
2736
|
+
* --------------------------------------------------------------------------
|
2737
|
+
* Bootstrap (v4.0.0-alpha.6): tooltip.js
|
2738
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
2739
|
+
* --------------------------------------------------------------------------
|
2740
|
+
*/
|
2741
|
+
|
2742
|
+
var Tooltip = function ($) {
|
2743
|
+
|
2744
|
+
/**
|
2745
|
+
* Check for Tether dependency
|
2746
|
+
* Tether - http://tether.io/
|
2747
|
+
*/
|
2748
|
+
if (typeof Tether === 'undefined') {
|
2749
|
+
throw new Error('Bootstrap tooltips require Tether (http://tether.io/)');
|
2750
|
+
}
|
2751
|
+
|
2752
|
+
/**
|
2753
|
+
* ------------------------------------------------------------------------
|
2754
|
+
* Constants
|
2755
|
+
* ------------------------------------------------------------------------
|
2756
|
+
*/
|
2757
|
+
|
2758
|
+
var NAME = 'tooltip';
|
2759
|
+
var VERSION = '4.0.0-alpha.6';
|
2760
|
+
var DATA_KEY = 'bs.tooltip';
|
2761
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
2762
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
2763
|
+
var TRANSITION_DURATION = 150;
|
2764
|
+
var CLASS_PREFIX = 'bs-tether';
|
2765
|
+
|
2766
|
+
var Default = {
|
2767
|
+
animation: true,
|
2768
|
+
template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-inner"></div></div>',
|
2769
|
+
trigger: 'hover focus',
|
2770
|
+
title: '',
|
2771
|
+
delay: 0,
|
2772
|
+
html: false,
|
2773
|
+
selector: false,
|
2774
|
+
placement: 'top',
|
2775
|
+
offset: '0 0',
|
2776
|
+
constraints: [],
|
2777
|
+
container: false
|
2778
|
+
};
|
2779
|
+
|
2780
|
+
var DefaultType = {
|
2781
|
+
animation: 'boolean',
|
2782
|
+
template: 'string',
|
2783
|
+
title: '(string|element|function)',
|
2784
|
+
trigger: 'string',
|
2785
|
+
delay: '(number|object)',
|
2786
|
+
html: 'boolean',
|
2787
|
+
selector: '(string|boolean)',
|
2788
|
+
placement: '(string|function)',
|
2789
|
+
offset: 'string',
|
2790
|
+
constraints: 'array',
|
2791
|
+
container: '(string|element|boolean)'
|
2792
|
+
};
|
2793
|
+
|
2794
|
+
var AttachmentMap = {
|
2795
|
+
TOP: 'bottom center',
|
2796
|
+
RIGHT: 'middle left',
|
2797
|
+
BOTTOM: 'top center',
|
2798
|
+
LEFT: 'middle right'
|
2799
|
+
};
|
2800
|
+
|
2801
|
+
var HoverState = {
|
2802
|
+
SHOW: 'show',
|
2803
|
+
OUT: 'out'
|
2804
|
+
};
|
2805
|
+
|
2806
|
+
var Event = {
|
2807
|
+
HIDE: 'hide' + EVENT_KEY,
|
2808
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
2809
|
+
SHOW: 'show' + EVENT_KEY,
|
2810
|
+
SHOWN: 'shown' + EVENT_KEY,
|
2811
|
+
INSERTED: 'inserted' + EVENT_KEY,
|
2812
|
+
CLICK: 'click' + EVENT_KEY,
|
2813
|
+
FOCUSIN: 'focusin' + EVENT_KEY,
|
2814
|
+
FOCUSOUT: 'focusout' + EVENT_KEY,
|
2815
|
+
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
2816
|
+
MOUSELEAVE: 'mouseleave' + EVENT_KEY
|
2817
|
+
};
|
2818
|
+
|
2819
|
+
var ClassName = {
|
2820
|
+
FADE: 'fade',
|
2821
|
+
SHOW: 'show'
|
2822
|
+
};
|
2823
|
+
|
2824
|
+
var Selector = {
|
2825
|
+
TOOLTIP: '.tooltip',
|
2826
|
+
TOOLTIP_INNER: '.tooltip-inner'
|
2827
|
+
};
|
2828
|
+
|
2829
|
+
var TetherClass = {
|
2830
|
+
element: false,
|
2831
|
+
enabled: false
|
2832
|
+
};
|
2833
|
+
|
2834
|
+
var Trigger = {
|
2835
|
+
HOVER: 'hover',
|
2836
|
+
FOCUS: 'focus',
|
2837
|
+
CLICK: 'click',
|
2838
|
+
MANUAL: 'manual'
|
2839
|
+
};
|
2840
|
+
|
2841
|
+
/**
|
2842
|
+
* ------------------------------------------------------------------------
|
2843
|
+
* Class Definition
|
2844
|
+
* ------------------------------------------------------------------------
|
2845
|
+
*/
|
2846
|
+
|
2847
|
+
var Tooltip = function () {
|
2848
|
+
function Tooltip(element, config) {
|
2849
|
+
_classCallCheck(this, Tooltip);
|
2850
|
+
|
2851
|
+
// private
|
2852
|
+
this._isEnabled = true;
|
2853
|
+
this._timeout = 0;
|
2854
|
+
this._hoverState = '';
|
2855
|
+
this._activeTrigger = {};
|
2856
|
+
this._isTransitioning = false;
|
2857
|
+
this._tether = null;
|
2858
|
+
|
2859
|
+
// protected
|
2860
|
+
this.element = element;
|
2861
|
+
this.config = this._getConfig(config);
|
2862
|
+
this.tip = null;
|
2863
|
+
|
2864
|
+
this._setListeners();
|
2865
|
+
}
|
2866
|
+
|
2867
|
+
// getters
|
2868
|
+
|
2869
|
+
// public
|
2870
|
+
|
2871
|
+
Tooltip.prototype.enable = function enable() {
|
2872
|
+
this._isEnabled = true;
|
2873
|
+
};
|
2874
|
+
|
2875
|
+
Tooltip.prototype.disable = function disable() {
|
2876
|
+
this._isEnabled = false;
|
2877
|
+
};
|
2878
|
+
|
2879
|
+
Tooltip.prototype.toggleEnabled = function toggleEnabled() {
|
2880
|
+
this._isEnabled = !this._isEnabled;
|
2881
|
+
};
|
2882
|
+
|
2883
|
+
Tooltip.prototype.toggle = function toggle(event) {
|
2884
|
+
if (event) {
|
2885
|
+
var dataKey = this.constructor.DATA_KEY;
|
2886
|
+
var context = $(event.currentTarget).data(dataKey);
|
2887
|
+
|
2888
|
+
if (!context) {
|
2889
|
+
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
2890
|
+
$(event.currentTarget).data(dataKey, context);
|
2891
|
+
}
|
2892
|
+
|
2893
|
+
context._activeTrigger.click = !context._activeTrigger.click;
|
2894
|
+
|
2895
|
+
if (context._isWithActiveTrigger()) {
|
2896
|
+
context._enter(null, context);
|
2897
|
+
} else {
|
2898
|
+
context._leave(null, context);
|
2899
|
+
}
|
2900
|
+
} else {
|
2901
|
+
|
2902
|
+
if ($(this.getTipElement()).hasClass(ClassName.SHOW)) {
|
2903
|
+
this._leave(null, this);
|
2904
|
+
return;
|
2905
|
+
}
|
2906
|
+
|
2907
|
+
this._enter(null, this);
|
2908
|
+
}
|
2909
|
+
};
|
2910
|
+
|
2911
|
+
Tooltip.prototype.dispose = function dispose() {
|
2912
|
+
clearTimeout(this._timeout);
|
2913
|
+
|
2914
|
+
this.cleanupTether();
|
2915
|
+
|
2916
|
+
$.removeData(this.element, this.constructor.DATA_KEY);
|
2917
|
+
|
2918
|
+
$(this.element).off(this.constructor.EVENT_KEY);
|
2919
|
+
$(this.element).closest('.modal').off('hide.bs.modal');
|
2920
|
+
|
2921
|
+
if (this.tip) {
|
2922
|
+
$(this.tip).remove();
|
2923
|
+
}
|
2924
|
+
|
2925
|
+
this._isEnabled = null;
|
2926
|
+
this._timeout = null;
|
2927
|
+
this._hoverState = null;
|
2928
|
+
this._activeTrigger = null;
|
2929
|
+
this._tether = null;
|
2930
|
+
|
2931
|
+
this.element = null;
|
2932
|
+
this.config = null;
|
2933
|
+
this.tip = null;
|
2934
|
+
};
|
2935
|
+
|
2936
|
+
Tooltip.prototype.show = function show() {
|
2937
|
+
var _this22 = this;
|
2938
|
+
|
2939
|
+
if ($(this.element).css('display') === 'none') {
|
2940
|
+
throw new Error('Please use show on visible elements');
|
2941
|
+
}
|
2942
|
+
|
2943
|
+
var showEvent = $.Event(this.constructor.Event.SHOW);
|
2944
|
+
if (this.isWithContent() && this._isEnabled) {
|
2945
|
+
if (this._isTransitioning) {
|
2946
|
+
throw new Error('Tooltip is transitioning');
|
2947
|
+
}
|
2948
|
+
$(this.element).trigger(showEvent);
|
2949
|
+
|
2950
|
+
var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
|
2951
|
+
|
2952
|
+
if (showEvent.isDefaultPrevented() || !isInTheDom) {
|
2953
|
+
return;
|
2954
|
+
}
|
2955
|
+
|
2956
|
+
var tip = this.getTipElement();
|
2957
|
+
var tipId = Util.getUID(this.constructor.NAME);
|
2958
|
+
|
2959
|
+
tip.setAttribute('id', tipId);
|
2960
|
+
this.element.setAttribute('aria-describedby', tipId);
|
2961
|
+
|
2962
|
+
this.setContent();
|
2963
|
+
|
2964
|
+
if (this.config.animation) {
|
2965
|
+
$(tip).addClass(ClassName.FADE);
|
2966
|
+
}
|
2967
|
+
|
2968
|
+
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
|
2969
|
+
|
2970
|
+
var attachment = this._getAttachment(placement);
|
2971
|
+
|
2972
|
+
var container = this.config.container === false ? document.body : $(this.config.container);
|
2973
|
+
|
2974
|
+
$(tip).data(this.constructor.DATA_KEY, this).appendTo(container);
|
2975
|
+
|
2976
|
+
$(this.element).trigger(this.constructor.Event.INSERTED);
|
2977
|
+
|
2978
|
+
this._tether = new Tether({
|
2979
|
+
attachment: attachment,
|
2980
|
+
element: tip,
|
2981
|
+
target: this.element,
|
2982
|
+
classes: TetherClass,
|
2983
|
+
classPrefix: CLASS_PREFIX,
|
2984
|
+
offset: this.config.offset,
|
2985
|
+
constraints: this.config.constraints,
|
2986
|
+
addTargetClasses: false
|
2987
|
+
});
|
2988
|
+
|
2989
|
+
Util.reflow(tip);
|
2990
|
+
this._tether.position();
|
2991
|
+
|
2992
|
+
$(tip).addClass(ClassName.SHOW);
|
2993
|
+
|
2994
|
+
var complete = function complete() {
|
2995
|
+
var prevHoverState = _this22._hoverState;
|
2996
|
+
_this22._hoverState = null;
|
2997
|
+
_this22._isTransitioning = false;
|
2998
|
+
|
2999
|
+
$(_this22.element).trigger(_this22.constructor.Event.SHOWN);
|
3000
|
+
|
3001
|
+
if (prevHoverState === HoverState.OUT) {
|
3002
|
+
_this22._leave(null, _this22);
|
3003
|
+
}
|
3004
|
+
};
|
3005
|
+
|
3006
|
+
if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
|
3007
|
+
this._isTransitioning = true;
|
3008
|
+
$(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
|
3009
|
+
return;
|
3010
|
+
}
|
3011
|
+
|
3012
|
+
complete();
|
3013
|
+
}
|
3014
|
+
};
|
3015
|
+
|
3016
|
+
Tooltip.prototype.hide = function hide(callback) {
|
3017
|
+
var _this23 = this;
|
3018
|
+
|
3019
|
+
var tip = this.getTipElement();
|
3020
|
+
var hideEvent = $.Event(this.constructor.Event.HIDE);
|
3021
|
+
if (this._isTransitioning) {
|
3022
|
+
throw new Error('Tooltip is transitioning');
|
3023
|
+
}
|
3024
|
+
var complete = function complete() {
|
3025
|
+
if (_this23._hoverState !== HoverState.SHOW && tip.parentNode) {
|
3026
|
+
tip.parentNode.removeChild(tip);
|
3027
|
+
}
|
3028
|
+
|
3029
|
+
_this23.element.removeAttribute('aria-describedby');
|
3030
|
+
$(_this23.element).trigger(_this23.constructor.Event.HIDDEN);
|
3031
|
+
_this23._isTransitioning = false;
|
3032
|
+
_this23.cleanupTether();
|
3033
|
+
|
3034
|
+
if (callback) {
|
3035
|
+
callback();
|
3036
|
+
}
|
3037
|
+
};
|
3038
|
+
|
3039
|
+
$(this.element).trigger(hideEvent);
|
3040
|
+
|
3041
|
+
if (hideEvent.isDefaultPrevented()) {
|
3042
|
+
return;
|
3043
|
+
}
|
3044
|
+
|
3045
|
+
$(tip).removeClass(ClassName.SHOW);
|
3046
|
+
|
3047
|
+
this._activeTrigger[Trigger.CLICK] = false;
|
3048
|
+
this._activeTrigger[Trigger.FOCUS] = false;
|
3049
|
+
this._activeTrigger[Trigger.HOVER] = false;
|
3050
|
+
|
3051
|
+
if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
|
3052
|
+
this._isTransitioning = true;
|
3053
|
+
$(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
|
3054
|
+
} else {
|
3055
|
+
complete();
|
3056
|
+
}
|
3057
|
+
|
3058
|
+
this._hoverState = '';
|
3059
|
+
};
|
3060
|
+
|
3061
|
+
// protected
|
3062
|
+
|
3063
|
+
Tooltip.prototype.isWithContent = function isWithContent() {
|
3064
|
+
return Boolean(this.getTitle());
|
3065
|
+
};
|
3066
|
+
|
3067
|
+
Tooltip.prototype.getTipElement = function getTipElement() {
|
3068
|
+
return this.tip = this.tip || $(this.config.template)[0];
|
3069
|
+
};
|
3070
|
+
|
3071
|
+
Tooltip.prototype.setContent = function setContent() {
|
3072
|
+
var $tip = $(this.getTipElement());
|
3073
|
+
|
3074
|
+
this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
|
3075
|
+
|
3076
|
+
$tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
|
3077
|
+
|
3078
|
+
this.cleanupTether();
|
3079
|
+
};
|
3080
|
+
|
3081
|
+
Tooltip.prototype.setElementContent = function setElementContent($element, content) {
|
3082
|
+
var html = this.config.html;
|
3083
|
+
if ((typeof content === 'undefined' ? 'undefined' : _typeof(content)) === 'object' && (content.nodeType || content.jquery)) {
|
3084
|
+
// content is a DOM node or a jQuery
|
3085
|
+
if (html) {
|
3086
|
+
if (!$(content).parent().is($element)) {
|
3087
|
+
$element.empty().append(content);
|
3088
|
+
}
|
3089
|
+
} else {
|
3090
|
+
$element.text($(content).text());
|
3091
|
+
}
|
3092
|
+
} else {
|
3093
|
+
$element[html ? 'html' : 'text'](content);
|
3094
|
+
}
|
3095
|
+
};
|
3096
|
+
|
3097
|
+
Tooltip.prototype.getTitle = function getTitle() {
|
3098
|
+
var title = this.element.getAttribute('data-original-title');
|
3099
|
+
|
3100
|
+
if (!title) {
|
3101
|
+
title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
|
3102
|
+
}
|
3103
|
+
|
3104
|
+
return title;
|
3105
|
+
};
|
3106
|
+
|
3107
|
+
Tooltip.prototype.cleanupTether = function cleanupTether() {
|
3108
|
+
if (this._tether) {
|
3109
|
+
this._tether.destroy();
|
3110
|
+
}
|
3111
|
+
};
|
3112
|
+
|
3113
|
+
// private
|
3114
|
+
|
3115
|
+
Tooltip.prototype._getAttachment = function _getAttachment(placement) {
|
3116
|
+
return AttachmentMap[placement.toUpperCase()];
|
3117
|
+
};
|
3118
|
+
|
3119
|
+
Tooltip.prototype._setListeners = function _setListeners() {
|
3120
|
+
var _this24 = this;
|
3121
|
+
|
3122
|
+
var triggers = this.config.trigger.split(' ');
|
3123
|
+
|
3124
|
+
triggers.forEach(function (trigger) {
|
3125
|
+
if (trigger === 'click') {
|
3126
|
+
$(_this24.element).on(_this24.constructor.Event.CLICK, _this24.config.selector, function (event) {
|
3127
|
+
return _this24.toggle(event);
|
3128
|
+
});
|
3129
|
+
} else if (trigger !== Trigger.MANUAL) {
|
3130
|
+
var eventIn = trigger === Trigger.HOVER ? _this24.constructor.Event.MOUSEENTER : _this24.constructor.Event.FOCUSIN;
|
3131
|
+
var eventOut = trigger === Trigger.HOVER ? _this24.constructor.Event.MOUSELEAVE : _this24.constructor.Event.FOCUSOUT;
|
3132
|
+
|
3133
|
+
$(_this24.element).on(eventIn, _this24.config.selector, function (event) {
|
3134
|
+
return _this24._enter(event);
|
3135
|
+
}).on(eventOut, _this24.config.selector, function (event) {
|
3136
|
+
return _this24._leave(event);
|
3137
|
+
});
|
3138
|
+
}
|
3139
|
+
|
3140
|
+
$(_this24.element).closest('.modal').on('hide.bs.modal', function () {
|
3141
|
+
return _this24.hide();
|
3142
|
+
});
|
3143
|
+
});
|
3144
|
+
|
3145
|
+
if (this.config.selector) {
|
3146
|
+
this.config = $.extend({}, this.config, {
|
3147
|
+
trigger: 'manual',
|
3148
|
+
selector: ''
|
3149
|
+
});
|
3150
|
+
} else {
|
3151
|
+
this._fixTitle();
|
3152
|
+
}
|
3153
|
+
};
|
3154
|
+
|
3155
|
+
Tooltip.prototype._fixTitle = function _fixTitle() {
|
3156
|
+
var titleType = _typeof(this.element.getAttribute('data-original-title'));
|
3157
|
+
if (this.element.getAttribute('title') || titleType !== 'string') {
|
3158
|
+
this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
|
3159
|
+
this.element.setAttribute('title', '');
|
3160
|
+
}
|
3161
|
+
};
|
3162
|
+
|
3163
|
+
Tooltip.prototype._enter = function _enter(event, context) {
|
3164
|
+
var dataKey = this.constructor.DATA_KEY;
|
3165
|
+
|
3166
|
+
context = context || $(event.currentTarget).data(dataKey);
|
3167
|
+
|
3168
|
+
if (!context) {
|
3169
|
+
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
3170
|
+
$(event.currentTarget).data(dataKey, context);
|
3171
|
+
}
|
3172
|
+
|
3173
|
+
if (event) {
|
3174
|
+
context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
|
3175
|
+
}
|
3176
|
+
|
3177
|
+
if ($(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) {
|
3178
|
+
context._hoverState = HoverState.SHOW;
|
3179
|
+
return;
|
3180
|
+
}
|
3181
|
+
|
3182
|
+
clearTimeout(context._timeout);
|
3183
|
+
|
3184
|
+
context._hoverState = HoverState.SHOW;
|
3185
|
+
|
3186
|
+
if (!context.config.delay || !context.config.delay.show) {
|
3187
|
+
context.show();
|
3188
|
+
return;
|
3189
|
+
}
|
3190
|
+
|
3191
|
+
context._timeout = setTimeout(function () {
|
3192
|
+
if (context._hoverState === HoverState.SHOW) {
|
3193
|
+
context.show();
|
3194
|
+
}
|
3195
|
+
}, context.config.delay.show);
|
3196
|
+
};
|
3197
|
+
|
3198
|
+
Tooltip.prototype._leave = function _leave(event, context) {
|
3199
|
+
var dataKey = this.constructor.DATA_KEY;
|
3200
|
+
|
3201
|
+
context = context || $(event.currentTarget).data(dataKey);
|
3202
|
+
|
3203
|
+
if (!context) {
|
3204
|
+
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
3205
|
+
$(event.currentTarget).data(dataKey, context);
|
3206
|
+
}
|
3207
|
+
|
3208
|
+
if (event) {
|
3209
|
+
context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
|
3210
|
+
}
|
3211
|
+
|
3212
|
+
if (context._isWithActiveTrigger()) {
|
3213
|
+
return;
|
3214
|
+
}
|
3215
|
+
|
3216
|
+
clearTimeout(context._timeout);
|
3217
|
+
|
3218
|
+
context._hoverState = HoverState.OUT;
|
3219
|
+
|
3220
|
+
if (!context.config.delay || !context.config.delay.hide) {
|
3221
|
+
context.hide();
|
3222
|
+
return;
|
3223
|
+
}
|
3224
|
+
|
3225
|
+
context._timeout = setTimeout(function () {
|
3226
|
+
if (context._hoverState === HoverState.OUT) {
|
3227
|
+
context.hide();
|
3228
|
+
}
|
3229
|
+
}, context.config.delay.hide);
|
3230
|
+
};
|
3231
|
+
|
3232
|
+
Tooltip.prototype._isWithActiveTrigger = function _isWithActiveTrigger() {
|
3233
|
+
for (var trigger in this._activeTrigger) {
|
3234
|
+
if (this._activeTrigger[trigger]) {
|
3235
|
+
return true;
|
3236
|
+
}
|
3237
|
+
}
|
3238
|
+
|
3239
|
+
return false;
|
3240
|
+
};
|
3241
|
+
|
3242
|
+
Tooltip.prototype._getConfig = function _getConfig(config) {
|
3243
|
+
config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
|
3244
|
+
|
3245
|
+
if (config.delay && typeof config.delay === 'number') {
|
3246
|
+
config.delay = {
|
3247
|
+
show: config.delay,
|
3248
|
+
hide: config.delay
|
3249
|
+
};
|
3250
|
+
}
|
3251
|
+
|
3252
|
+
Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
3253
|
+
|
3254
|
+
return config;
|
3255
|
+
};
|
3256
|
+
|
3257
|
+
Tooltip.prototype._getDelegateConfig = function _getDelegateConfig() {
|
3258
|
+
var config = {};
|
3259
|
+
|
3260
|
+
if (this.config) {
|
3261
|
+
for (var key in this.config) {
|
3262
|
+
if (this.constructor.Default[key] !== this.config[key]) {
|
3263
|
+
config[key] = this.config[key];
|
3264
|
+
}
|
3265
|
+
}
|
3266
|
+
}
|
3267
|
+
|
3268
|
+
return config;
|
3269
|
+
};
|
3270
|
+
|
3271
|
+
// static
|
3272
|
+
|
3273
|
+
Tooltip._jQueryInterface = function _jQueryInterface(config) {
|
3274
|
+
return this.each(function () {
|
3275
|
+
var data = $(this).data(DATA_KEY);
|
3276
|
+
var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config;
|
3277
|
+
|
3278
|
+
if (!data && /dispose|hide/.test(config)) {
|
3279
|
+
return;
|
3280
|
+
}
|
3281
|
+
|
3282
|
+
if (!data) {
|
3283
|
+
data = new Tooltip(this, _config);
|
3284
|
+
$(this).data(DATA_KEY, data);
|
3285
|
+
}
|
3286
|
+
|
3287
|
+
if (typeof config === 'string') {
|
3288
|
+
if (data[config] === undefined) {
|
3289
|
+
throw new Error('No method named "' + config + '"');
|
3290
|
+
}
|
3291
|
+
data[config]();
|
3292
|
+
}
|
3293
|
+
});
|
3294
|
+
};
|
3295
|
+
|
3296
|
+
_createClass(Tooltip, null, [{
|
3297
|
+
key: 'VERSION',
|
3298
|
+
get: function get() {
|
3299
|
+
return VERSION;
|
3300
|
+
}
|
3301
|
+
}, {
|
3302
|
+
key: 'Default',
|
3303
|
+
get: function get() {
|
3304
|
+
return Default;
|
3305
|
+
}
|
3306
|
+
}, {
|
3307
|
+
key: 'NAME',
|
3308
|
+
get: function get() {
|
3309
|
+
return NAME;
|
3310
|
+
}
|
3311
|
+
}, {
|
3312
|
+
key: 'DATA_KEY',
|
3313
|
+
get: function get() {
|
3314
|
+
return DATA_KEY;
|
3315
|
+
}
|
3316
|
+
}, {
|
3317
|
+
key: 'Event',
|
3318
|
+
get: function get() {
|
3319
|
+
return Event;
|
3320
|
+
}
|
3321
|
+
}, {
|
3322
|
+
key: 'EVENT_KEY',
|
3323
|
+
get: function get() {
|
3324
|
+
return EVENT_KEY;
|
3325
|
+
}
|
3326
|
+
}, {
|
3327
|
+
key: 'DefaultType',
|
3328
|
+
get: function get() {
|
3329
|
+
return DefaultType;
|
3330
|
+
}
|
3331
|
+
}]);
|
3332
|
+
|
3333
|
+
return Tooltip;
|
3334
|
+
}();
|
3335
|
+
|
3336
|
+
/**
|
3337
|
+
* ------------------------------------------------------------------------
|
3338
|
+
* jQuery
|
3339
|
+
* ------------------------------------------------------------------------
|
3340
|
+
*/
|
3341
|
+
|
3342
|
+
$.fn[NAME] = Tooltip._jQueryInterface;
|
3343
|
+
$.fn[NAME].Constructor = Tooltip;
|
3344
|
+
$.fn[NAME].noConflict = function () {
|
3345
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
3346
|
+
return Tooltip._jQueryInterface;
|
3347
|
+
};
|
3348
|
+
|
3349
|
+
return Tooltip;
|
3350
|
+
}(jQuery);
|
3351
|
+
|
3352
|
+
/**
|
3353
|
+
* --------------------------------------------------------------------------
|
3354
|
+
* Bootstrap (v4.0.0-alpha.6): popover.js
|
3355
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
3356
|
+
* --------------------------------------------------------------------------
|
3357
|
+
*/
|
3358
|
+
|
3359
|
+
var Popover = function ($) {
|
3360
|
+
|
3361
|
+
/**
|
3362
|
+
* ------------------------------------------------------------------------
|
3363
|
+
* Constants
|
3364
|
+
* ------------------------------------------------------------------------
|
3365
|
+
*/
|
3366
|
+
|
3367
|
+
var NAME = 'popover';
|
3368
|
+
var VERSION = '4.0.0-alpha.6';
|
3369
|
+
var DATA_KEY = 'bs.popover';
|
3370
|
+
var EVENT_KEY = '.' + DATA_KEY;
|
3371
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
3372
|
+
|
3373
|
+
var Default = $.extend({}, Tooltip.Default, {
|
3374
|
+
placement: 'right',
|
3375
|
+
trigger: 'click',
|
3376
|
+
content: '',
|
3377
|
+
template: '<div class="popover" role="tooltip">' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>'
|
3378
|
+
});
|
3379
|
+
|
3380
|
+
var DefaultType = $.extend({}, Tooltip.DefaultType, {
|
3381
|
+
content: '(string|element|function)'
|
3382
|
+
});
|
3383
|
+
|
3384
|
+
var ClassName = {
|
3385
|
+
FADE: 'fade',
|
3386
|
+
SHOW: 'show'
|
3387
|
+
};
|
3388
|
+
|
3389
|
+
var Selector = {
|
3390
|
+
TITLE: '.popover-title',
|
3391
|
+
CONTENT: '.popover-content'
|
3392
|
+
};
|
3393
|
+
|
3394
|
+
var Event = {
|
3395
|
+
HIDE: 'hide' + EVENT_KEY,
|
3396
|
+
HIDDEN: 'hidden' + EVENT_KEY,
|
3397
|
+
SHOW: 'show' + EVENT_KEY,
|
3398
|
+
SHOWN: 'shown' + EVENT_KEY,
|
3399
|
+
INSERTED: 'inserted' + EVENT_KEY,
|
3400
|
+
CLICK: 'click' + EVENT_KEY,
|
3401
|
+
FOCUSIN: 'focusin' + EVENT_KEY,
|
3402
|
+
FOCUSOUT: 'focusout' + EVENT_KEY,
|
3403
|
+
MOUSEENTER: 'mouseenter' + EVENT_KEY,
|
3404
|
+
MOUSELEAVE: 'mouseleave' + EVENT_KEY
|
3405
|
+
};
|
3406
|
+
|
3407
|
+
/**
|
3408
|
+
* ------------------------------------------------------------------------
|
3409
|
+
* Class Definition
|
3410
|
+
* ------------------------------------------------------------------------
|
3411
|
+
*/
|
3412
|
+
|
3413
|
+
var Popover = function (_Tooltip) {
|
3414
|
+
_inherits(Popover, _Tooltip);
|
3415
|
+
|
3416
|
+
function Popover() {
|
3417
|
+
_classCallCheck(this, Popover);
|
3418
|
+
|
3419
|
+
return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments));
|
3420
|
+
}
|
3421
|
+
|
3422
|
+
// overrides
|
3423
|
+
|
3424
|
+
Popover.prototype.isWithContent = function isWithContent() {
|
3425
|
+
return this.getTitle() || this._getContent();
|
3426
|
+
};
|
3427
|
+
|
3428
|
+
Popover.prototype.getTipElement = function getTipElement() {
|
3429
|
+
return this.tip = this.tip || $(this.config.template)[0];
|
3430
|
+
};
|
3431
|
+
|
3432
|
+
Popover.prototype.setContent = function setContent() {
|
3433
|
+
var $tip = $(this.getTipElement());
|
3434
|
+
|
3435
|
+
// we use append for html objects to maintain js events
|
3436
|
+
this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
|
3437
|
+
this.setElementContent($tip.find(Selector.CONTENT), this._getContent());
|
3438
|
+
|
3439
|
+
$tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
|
3440
|
+
|
3441
|
+
this.cleanupTether();
|
3442
|
+
};
|
3443
|
+
|
3444
|
+
// private
|
3445
|
+
|
3446
|
+
Popover.prototype._getContent = function _getContent() {
|
3447
|
+
return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content);
|
3448
|
+
};
|
3449
|
+
|
3450
|
+
// static
|
3451
|
+
|
3452
|
+
Popover._jQueryInterface = function _jQueryInterface(config) {
|
3453
|
+
return this.each(function () {
|
3454
|
+
var data = $(this).data(DATA_KEY);
|
3455
|
+
var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
|
3456
|
+
|
3457
|
+
if (!data && /destroy|hide/.test(config)) {
|
3458
|
+
return;
|
3459
|
+
}
|
3460
|
+
|
3461
|
+
if (!data) {
|
3462
|
+
data = new Popover(this, _config);
|
3463
|
+
$(this).data(DATA_KEY, data);
|
3464
|
+
}
|
3465
|
+
|
3466
|
+
if (typeof config === 'string') {
|
3467
|
+
if (data[config] === undefined) {
|
3468
|
+
throw new Error('No method named "' + config + '"');
|
3469
|
+
}
|
3470
|
+
data[config]();
|
3471
|
+
}
|
3472
|
+
});
|
3473
|
+
};
|
3474
|
+
|
3475
|
+
_createClass(Popover, null, [{
|
3476
|
+
key: 'VERSION',
|
3477
|
+
|
3478
|
+
|
3479
|
+
// getters
|
3480
|
+
|
3481
|
+
get: function get() {
|
3482
|
+
return VERSION;
|
3483
|
+
}
|
3484
|
+
}, {
|
3485
|
+
key: 'Default',
|
3486
|
+
get: function get() {
|
3487
|
+
return Default;
|
3488
|
+
}
|
3489
|
+
}, {
|
3490
|
+
key: 'NAME',
|
3491
|
+
get: function get() {
|
3492
|
+
return NAME;
|
3493
|
+
}
|
3494
|
+
}, {
|
3495
|
+
key: 'DATA_KEY',
|
3496
|
+
get: function get() {
|
3497
|
+
return DATA_KEY;
|
3498
|
+
}
|
3499
|
+
}, {
|
3500
|
+
key: 'Event',
|
3501
|
+
get: function get() {
|
3502
|
+
return Event;
|
3503
|
+
}
|
3504
|
+
}, {
|
3505
|
+
key: 'EVENT_KEY',
|
3506
|
+
get: function get() {
|
3507
|
+
return EVENT_KEY;
|
3508
|
+
}
|
3509
|
+
}, {
|
3510
|
+
key: 'DefaultType',
|
3511
|
+
get: function get() {
|
3512
|
+
return DefaultType;
|
3513
|
+
}
|
3514
|
+
}]);
|
3515
|
+
|
3516
|
+
return Popover;
|
3517
|
+
}(Tooltip);
|
3518
|
+
|
3519
|
+
/**
|
3520
|
+
* ------------------------------------------------------------------------
|
3521
|
+
* jQuery
|
3522
|
+
* ------------------------------------------------------------------------
|
3523
|
+
*/
|
3524
|
+
|
3525
|
+
$.fn[NAME] = Popover._jQueryInterface;
|
3526
|
+
$.fn[NAME].Constructor = Popover;
|
3527
|
+
$.fn[NAME].noConflict = function () {
|
3528
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
3529
|
+
return Popover._jQueryInterface;
|
3530
|
+
};
|
3531
|
+
|
3532
|
+
return Popover;
|
3533
|
+
}(jQuery);
|
3534
|
+
|
3535
|
+
}();
|