bootstrap 4.6.2.1 → 5.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +0 -4
- data/README.md +1 -7
- data/Rakefile +4 -16
- data/assets/javascripts/bootstrap/alert.js +148 -73
- data/assets/javascripts/bootstrap/button.js +71 -154
- data/assets/javascripts/bootstrap/carousel.js +315 -209
- data/assets/javascripts/bootstrap/collapse.js +307 -153
- data/assets/javascripts/bootstrap/dom/data.js +81 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +311 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +100 -0
- data/assets/javascripts/bootstrap/dom/polyfill.js +110 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +98 -0
- data/assets/javascripts/bootstrap/dropdown.js +257 -205
- data/assets/javascripts/bootstrap/modal.js +354 -250
- data/assets/javascripts/bootstrap/popover.js +85 -94
- data/assets/javascripts/bootstrap/scrollspy.js +179 -107
- data/assets/javascripts/bootstrap/tab.js +170 -99
- data/assets/javascripts/bootstrap/toast.js +181 -110
- data/assets/javascripts/bootstrap/tooltip.js +375 -226
- data/assets/javascripts/bootstrap-sprockets.js +5 -1
- data/assets/javascripts/bootstrap.js +2260 -1550
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +53 -18
- data/assets/stylesheets/_bootstrap-reboot.scss +6 -3
- data/assets/stylesheets/_bootstrap.scss +16 -10
- data/assets/stylesheets/bootstrap/_alert.scss +3 -4
- data/assets/stylesheets/bootstrap/_badge.scss +2 -27
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +5 -17
- data/assets/stylesheets/bootstrap/_button-group.scss +16 -38
- data/assets/stylesheets/bootstrap/_buttons.scss +27 -45
- data/assets/stylesheets/bootstrap/_card.scss +22 -68
- data/assets/stylesheets/bootstrap/_carousel.scss +15 -20
- data/assets/stylesheets/bootstrap/_close.scss +9 -13
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +12 -9
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +82 -69
- data/assets/stylesheets/bootstrap/_grid.scss +3 -54
- data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +7 -4
- data/assets/stylesheets/bootstrap/_mixins.scss +6 -12
- data/assets/stylesheets/bootstrap/_modal.scss +36 -41
- data/assets/stylesheets/bootstrap/_nav.scss +7 -9
- data/assets/stylesheets/bootstrap/_navbar.scss +42 -82
- data/assets/stylesheets/bootstrap/_pagination.scss +7 -20
- data/assets/stylesheets/bootstrap/_popover.scss +14 -14
- data/assets/stylesheets/bootstrap/_progress.scss +3 -5
- data/assets/stylesheets/bootstrap/_reboot.scss +304 -172
- data/assets/stylesheets/bootstrap/_root.scss +5 -8
- data/assets/stylesheets/bootstrap/_spinners.scss +8 -17
- data/assets/stylesheets/bootstrap/_tables.scss +80 -114
- data/assets/stylesheets/bootstrap/_toasts.scss +2 -4
- data/assets/stylesheets/bootstrap/_tooltip.scss +9 -9
- data/assets/stylesheets/bootstrap/_transitions.scss +0 -7
- data/assets/stylesheets/bootstrap/_type.scss +38 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +503 -18
- data/assets/stylesheets/bootstrap/_variables.scss +548 -437
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +142 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +116 -0
- data/assets/stylesheets/bootstrap/forms/_form-file.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +136 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +82 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +140 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_embed.scss +31 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_screenreaders.scss +8 -0
- data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +0 -4
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +11 -8
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +62 -47
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +4 -4
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +23 -85
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +9 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +86 -34
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +15 -8
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +18 -24
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +49 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
- data/bootstrap.gemspec +3 -1
- data/lib/bootstrap/engine.rb +1 -17
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +6 -18
- data/tasks/updater/network.rb +1 -7
- metadata +49 -47
- data/assets/javascripts/bootstrap/util.js +0 -189
- data/assets/stylesheets/bootstrap/_code.scss +0 -48
- data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
- data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
- data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
- data/assets/stylesheets/bootstrap/_media.scss +0 -8
- data/assets/stylesheets/bootstrap/_print.scss +0 -132
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
- data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
- data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
- data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
- data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
- data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
- data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
- data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
- data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
- data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
- data/test/gemfiles/rails_7_0_dartsass.gemfile +0 -8
- data/test/gemfiles/rails_7_0_sassc.gemfile +0 -8
- /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,64 +1,198 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap tooltip.js
|
3
|
-
* Copyright 2011-
|
2
|
+
* Bootstrap tooltip.js v5.0.0-alpha1 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
4
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
5
|
*/
|
6
6
|
(function (global, factory) {
|
7
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('
|
8
|
-
typeof define === 'function' && define.amd ? define(['
|
9
|
-
(global =
|
10
|
-
}
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('popper.js'), require('./dom/selector-engine.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', 'popper.js', './dom/selector-engine.js'], factory) :
|
9
|
+
(global = global || self, global.Tooltip = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
|
10
|
+
}(this, (function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
|
11
|
+
|
12
|
+
Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
|
13
|
+
EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
|
14
|
+
Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
|
15
|
+
Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper;
|
16
|
+
SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* --------------------------------------------------------------------------
|
20
|
+
* Bootstrap (v5.0.0-alpha1): util/index.js
|
21
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
22
|
+
* --------------------------------------------------------------------------
|
23
|
+
*/
|
24
|
+
var MAX_UID = 1000000;
|
25
|
+
var MILLISECONDS_MULTIPLIER = 1000;
|
26
|
+
var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
27
|
+
|
28
|
+
var toType = function toType(obj) {
|
29
|
+
if (obj === null || obj === undefined) {
|
30
|
+
return "" + obj;
|
25
31
|
}
|
26
|
-
}
|
27
32
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
33
|
+
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
34
|
+
};
|
35
|
+
/**
|
36
|
+
* --------------------------------------------------------------------------
|
37
|
+
* Public Util Api
|
38
|
+
* --------------------------------------------------------------------------
|
39
|
+
*/
|
36
40
|
|
37
|
-
function _extends() {
|
38
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
39
|
-
for (var i = 1; i < arguments.length; i++) {
|
40
|
-
var source = arguments[i];
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
var getUID = function getUID(prefix) {
|
43
|
+
do {
|
44
|
+
prefix += Math.floor(Math.random() * MAX_UID);
|
45
|
+
} while (document.getElementById(prefix));
|
46
|
+
|
47
|
+
return prefix;
|
48
|
+
};
|
49
|
+
|
50
|
+
var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
|
51
|
+
if (!element) {
|
52
|
+
return 0;
|
53
|
+
} // Get transition-duration of the element
|
54
|
+
|
55
|
+
|
56
|
+
var _window$getComputedSt = window.getComputedStyle(element),
|
57
|
+
transitionDuration = _window$getComputedSt.transitionDuration,
|
58
|
+
transitionDelay = _window$getComputedSt.transitionDelay;
|
59
|
+
|
60
|
+
var floatTransitionDuration = parseFloat(transitionDuration);
|
61
|
+
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
62
|
+
|
63
|
+
if (!floatTransitionDuration && !floatTransitionDelay) {
|
64
|
+
return 0;
|
65
|
+
} // If multiple durations are defined, take the first
|
66
|
+
|
67
|
+
|
68
|
+
transitionDuration = transitionDuration.split(',')[0];
|
69
|
+
transitionDelay = transitionDelay.split(',')[0];
|
70
|
+
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
71
|
+
};
|
72
|
+
|
73
|
+
var triggerTransitionEnd = function triggerTransitionEnd(element) {
|
74
|
+
element.dispatchEvent(new Event(TRANSITION_END));
|
75
|
+
};
|
76
|
+
|
77
|
+
var isElement = function isElement(obj) {
|
78
|
+
return (obj[0] || obj).nodeType;
|
79
|
+
};
|
80
|
+
|
81
|
+
var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
|
82
|
+
var called = false;
|
83
|
+
var durationPadding = 5;
|
84
|
+
var emulatedDuration = duration + durationPadding;
|
85
|
+
|
86
|
+
function listener() {
|
87
|
+
called = true;
|
88
|
+
element.removeEventListener(TRANSITION_END, listener);
|
89
|
+
}
|
90
|
+
|
91
|
+
element.addEventListener(TRANSITION_END, listener);
|
92
|
+
setTimeout(function () {
|
93
|
+
if (!called) {
|
94
|
+
triggerTransitionEnd(element);
|
47
95
|
}
|
96
|
+
}, emulatedDuration);
|
97
|
+
};
|
48
98
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
99
|
+
var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
|
100
|
+
Object.keys(configTypes).forEach(function (property) {
|
101
|
+
var expectedTypes = configTypes[property];
|
102
|
+
var value = config[property];
|
103
|
+
var valueType = value && isElement(value) ? 'element' : toType(value);
|
104
|
+
|
105
|
+
if (!new RegExp(expectedTypes).test(valueType)) {
|
106
|
+
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
107
|
+
}
|
108
|
+
});
|
109
|
+
};
|
110
|
+
|
111
|
+
var findShadowRoot = function findShadowRoot(element) {
|
112
|
+
if (!document.documentElement.attachShadow) {
|
113
|
+
return null;
|
114
|
+
} // Can find the shadow root otherwise it'll return the document
|
115
|
+
|
116
|
+
|
117
|
+
if (typeof element.getRootNode === 'function') {
|
118
|
+
var root = element.getRootNode();
|
119
|
+
return root instanceof ShadowRoot ? root : null;
|
120
|
+
}
|
121
|
+
|
122
|
+
if (element instanceof ShadowRoot) {
|
123
|
+
return element;
|
124
|
+
} // when we don't find a shadow root
|
125
|
+
|
126
|
+
|
127
|
+
if (!element.parentNode) {
|
128
|
+
return null;
|
129
|
+
}
|
130
|
+
|
131
|
+
return findShadowRoot(element.parentNode);
|
132
|
+
};
|
133
|
+
|
134
|
+
var noop = function noop() {
|
135
|
+
return function () {};
|
136
|
+
};
|
137
|
+
|
138
|
+
var getjQuery = function getjQuery() {
|
139
|
+
var _window = window,
|
140
|
+
jQuery = _window.jQuery;
|
141
|
+
|
142
|
+
if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
|
143
|
+
return jQuery;
|
144
|
+
}
|
145
|
+
|
146
|
+
return null;
|
147
|
+
};
|
53
148
|
|
54
149
|
/**
|
55
150
|
* --------------------------------------------------------------------------
|
56
|
-
* Bootstrap (
|
151
|
+
* Bootstrap (v5.0.0-alpha1): util/sanitizer.js
|
57
152
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
58
153
|
* --------------------------------------------------------------------------
|
59
154
|
*/
|
60
155
|
var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
|
61
156
|
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
157
|
+
/**
|
158
|
+
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
159
|
+
*
|
160
|
+
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
161
|
+
*/
|
162
|
+
|
163
|
+
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
|
164
|
+
/**
|
165
|
+
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
166
|
+
*
|
167
|
+
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
168
|
+
*/
|
169
|
+
|
170
|
+
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
|
171
|
+
|
172
|
+
var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) {
|
173
|
+
var attrName = attr.nodeName.toLowerCase();
|
174
|
+
|
175
|
+
if (allowedAttributeList.indexOf(attrName) !== -1) {
|
176
|
+
if (uriAttrs.indexOf(attrName) !== -1) {
|
177
|
+
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
|
178
|
+
}
|
179
|
+
|
180
|
+
return true;
|
181
|
+
}
|
182
|
+
|
183
|
+
var regExp = allowedAttributeList.filter(function (attrRegex) {
|
184
|
+
return attrRegex instanceof RegExp;
|
185
|
+
}); // Check if a regular expression validates the attribute.
|
186
|
+
|
187
|
+
for (var i = 0, len = regExp.length; i < len; i++) {
|
188
|
+
if (attrName.match(regExp[i])) {
|
189
|
+
return true;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
return false;
|
194
|
+
};
|
195
|
+
|
62
196
|
var DefaultWhitelist = {
|
63
197
|
// Global attributes allowed on any supplied element below.
|
64
198
|
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
@@ -92,47 +226,10 @@
|
|
92
226
|
u: [],
|
93
227
|
ul: []
|
94
228
|
};
|
95
|
-
/**
|
96
|
-
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
97
|
-
*
|
98
|
-
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
99
|
-
*/
|
100
|
-
|
101
|
-
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
|
102
|
-
/**
|
103
|
-
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
104
|
-
*
|
105
|
-
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
|
106
|
-
*/
|
107
|
-
|
108
|
-
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
|
109
|
-
|
110
|
-
function allowedAttribute(attr, allowedAttributeList) {
|
111
|
-
var attrName = attr.nodeName.toLowerCase();
|
112
|
-
|
113
|
-
if (allowedAttributeList.indexOf(attrName) !== -1) {
|
114
|
-
if (uriAttrs.indexOf(attrName) !== -1) {
|
115
|
-
return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
|
116
|
-
}
|
117
|
-
|
118
|
-
return true;
|
119
|
-
}
|
120
|
-
|
121
|
-
var regExp = allowedAttributeList.filter(function (attrRegex) {
|
122
|
-
return attrRegex instanceof RegExp;
|
123
|
-
}); // Check if a regular expression validates the attribute.
|
124
|
-
|
125
|
-
for (var i = 0, len = regExp.length; i < len; i++) {
|
126
|
-
if (regExp[i].test(attrName)) {
|
127
|
-
return true;
|
128
|
-
}
|
129
|
-
}
|
130
|
-
|
131
|
-
return false;
|
132
|
-
}
|
133
|
-
|
134
229
|
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
|
135
|
-
|
230
|
+
var _ref;
|
231
|
+
|
232
|
+
if (!unsafeHtml.length) {
|
136
233
|
return unsafeHtml;
|
137
234
|
}
|
138
235
|
|
@@ -143,18 +240,21 @@
|
|
143
240
|
var domParser = new window.DOMParser();
|
144
241
|
var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
145
242
|
var whitelistKeys = Object.keys(whiteList);
|
146
|
-
|
243
|
+
|
244
|
+
var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*'));
|
147
245
|
|
148
246
|
var _loop = function _loop(i, len) {
|
247
|
+
var _ref2;
|
248
|
+
|
149
249
|
var el = elements[i];
|
150
250
|
var elName = el.nodeName.toLowerCase();
|
151
251
|
|
152
|
-
if (whitelistKeys.indexOf(
|
252
|
+
if (whitelistKeys.indexOf(elName) === -1) {
|
153
253
|
el.parentNode.removeChild(el);
|
154
254
|
return "continue";
|
155
255
|
}
|
156
256
|
|
157
|
-
var attributeList = [].
|
257
|
+
var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes);
|
158
258
|
|
159
259
|
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
|
160
260
|
attributeList.forEach(function (attr) {
|
@@ -173,28 +273,46 @@
|
|
173
273
|
return createdDocument.body.innerHTML;
|
174
274
|
}
|
175
275
|
|
276
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
277
|
+
|
278
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
279
|
+
|
280
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
281
|
+
|
282
|
+
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); } }
|
283
|
+
|
284
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
176
285
|
/**
|
286
|
+
* ------------------------------------------------------------------------
|
177
287
|
* Constants
|
288
|
+
* ------------------------------------------------------------------------
|
178
289
|
*/
|
179
290
|
|
180
291
|
var NAME = 'tooltip';
|
181
|
-
var VERSION = '
|
292
|
+
var VERSION = '5.0.0-alpha1';
|
182
293
|
var DATA_KEY = 'bs.tooltip';
|
183
294
|
var EVENT_KEY = "." + DATA_KEY;
|
184
|
-
var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
|
185
295
|
var CLASS_PREFIX = 'bs-tooltip';
|
186
296
|
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
|
187
297
|
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
|
188
|
-
var
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
298
|
+
var DefaultType = {
|
299
|
+
animation: 'boolean',
|
300
|
+
template: 'string',
|
301
|
+
title: '(string|element|function)',
|
302
|
+
trigger: 'string',
|
303
|
+
delay: '(number|object)',
|
304
|
+
html: 'boolean',
|
305
|
+
selector: '(string|boolean)',
|
306
|
+
placement: '(string|function)',
|
307
|
+
offset: '(number|string|function)',
|
308
|
+
container: '(string|element|boolean)',
|
309
|
+
fallbackPlacement: '(string|array)',
|
310
|
+
boundary: '(string|element)',
|
311
|
+
sanitize: 'boolean',
|
312
|
+
sanitizeFn: '(null|function)',
|
313
|
+
whiteList: 'object',
|
314
|
+
popperConfig: '(null|object)'
|
315
|
+
};
|
198
316
|
var AttachmentMap = {
|
199
317
|
AUTO: 'auto',
|
200
318
|
TOP: 'top',
|
@@ -204,7 +322,7 @@
|
|
204
322
|
};
|
205
323
|
var Default = {
|
206
324
|
animation: true,
|
207
|
-
template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
|
325
|
+
template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
|
208
326
|
trigger: 'hover focus',
|
209
327
|
title: '',
|
210
328
|
delay: 0,
|
@@ -215,32 +333,12 @@
|
|
215
333
|
container: false,
|
216
334
|
fallbackPlacement: 'flip',
|
217
335
|
boundary: 'scrollParent',
|
218
|
-
customClass: '',
|
219
336
|
sanitize: true,
|
220
337
|
sanitizeFn: null,
|
221
338
|
whiteList: DefaultWhitelist,
|
222
339
|
popperConfig: null
|
223
340
|
};
|
224
|
-
var
|
225
|
-
animation: 'boolean',
|
226
|
-
template: 'string',
|
227
|
-
title: '(string|element|function)',
|
228
|
-
trigger: 'string',
|
229
|
-
delay: '(number|object)',
|
230
|
-
html: 'boolean',
|
231
|
-
selector: '(string|boolean)',
|
232
|
-
placement: '(string|function)',
|
233
|
-
offset: '(number|string|function)',
|
234
|
-
container: '(string|element|boolean)',
|
235
|
-
fallbackPlacement: '(string|array)',
|
236
|
-
boundary: '(string|element)',
|
237
|
-
customClass: '(string|function)',
|
238
|
-
sanitize: 'boolean',
|
239
|
-
sanitizeFn: '(null|function)',
|
240
|
-
whiteList: 'object',
|
241
|
-
popperConfig: '(null|object)'
|
242
|
-
};
|
243
|
-
var Event = {
|
341
|
+
var Event$1 = {
|
244
342
|
HIDE: "hide" + EVENT_KEY,
|
245
343
|
HIDDEN: "hidden" + EVENT_KEY,
|
246
344
|
SHOW: "show" + EVENT_KEY,
|
@@ -252,15 +350,27 @@
|
|
252
350
|
MOUSEENTER: "mouseenter" + EVENT_KEY,
|
253
351
|
MOUSELEAVE: "mouseleave" + EVENT_KEY
|
254
352
|
};
|
353
|
+
var CLASS_NAME_FADE = 'fade';
|
354
|
+
var CLASS_NAME_MODAL = 'modal';
|
355
|
+
var CLASS_NAME_SHOW = 'show';
|
356
|
+
var HOVER_STATE_SHOW = 'show';
|
357
|
+
var HOVER_STATE_OUT = 'out';
|
358
|
+
var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
|
359
|
+
var TRIGGER_HOVER = 'hover';
|
360
|
+
var TRIGGER_FOCUS = 'focus';
|
361
|
+
var TRIGGER_CLICK = 'click';
|
362
|
+
var TRIGGER_MANUAL = 'manual';
|
255
363
|
/**
|
256
|
-
*
|
364
|
+
* ------------------------------------------------------------------------
|
365
|
+
* Class Definition
|
366
|
+
* ------------------------------------------------------------------------
|
257
367
|
*/
|
258
368
|
|
259
369
|
var Tooltip = /*#__PURE__*/function () {
|
260
370
|
function Tooltip(element, config) {
|
261
|
-
if (typeof
|
262
|
-
throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
|
263
|
-
} //
|
371
|
+
if (typeof Popper === 'undefined') {
|
372
|
+
throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)');
|
373
|
+
} // private
|
264
374
|
|
265
375
|
|
266
376
|
this._isEnabled = true;
|
@@ -274,6 +384,8 @@
|
|
274
384
|
this.tip = null;
|
275
385
|
|
276
386
|
this._setListeners();
|
387
|
+
|
388
|
+
Data.setData(element, this.constructor.DATA_KEY, this);
|
277
389
|
} // Getters
|
278
390
|
|
279
391
|
|
@@ -299,11 +411,11 @@
|
|
299
411
|
|
300
412
|
if (event) {
|
301
413
|
var dataKey = this.constructor.DATA_KEY;
|
302
|
-
var context =
|
414
|
+
var context = Data.getData(event.target, dataKey);
|
303
415
|
|
304
416
|
if (!context) {
|
305
|
-
context = new this.constructor(event.
|
306
|
-
|
417
|
+
context = new this.constructor(event.target, this._getDelegateConfig());
|
418
|
+
Data.setData(event.target, dataKey, context);
|
307
419
|
}
|
308
420
|
|
309
421
|
context._activeTrigger.click = !context._activeTrigger.click;
|
@@ -314,7 +426,7 @@
|
|
314
426
|
context._leave(null, context);
|
315
427
|
}
|
316
428
|
} else {
|
317
|
-
if (
|
429
|
+
if (this.getTipElement().classList.contains(CLASS_NAME_SHOW)) {
|
318
430
|
this._leave(null, this);
|
319
431
|
|
320
432
|
return;
|
@@ -326,12 +438,12 @@
|
|
326
438
|
|
327
439
|
_proto.dispose = function dispose() {
|
328
440
|
clearTimeout(this._timeout);
|
329
|
-
|
330
|
-
|
331
|
-
|
441
|
+
Data.removeData(this.element, this.constructor.DATA_KEY);
|
442
|
+
EventHandler.off(this.element, this.constructor.EVENT_KEY);
|
443
|
+
EventHandler.off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
|
332
444
|
|
333
445
|
if (this.tip) {
|
334
|
-
|
446
|
+
this.tip.parentNode.removeChild(this.tip);
|
335
447
|
}
|
336
448
|
|
337
449
|
this._isEnabled = null;
|
@@ -352,55 +464,56 @@
|
|
352
464
|
_proto.show = function show() {
|
353
465
|
var _this = this;
|
354
466
|
|
355
|
-
if (
|
467
|
+
if (this.element.style.display === 'none') {
|
356
468
|
throw new Error('Please use show on visible elements');
|
357
469
|
}
|
358
470
|
|
359
|
-
var showEvent = $__default["default"].Event(this.constructor.Event.SHOW);
|
360
|
-
|
361
471
|
if (this.isWithContent() && this._isEnabled) {
|
362
|
-
|
363
|
-
var shadowRoot =
|
364
|
-
var isInTheDom =
|
472
|
+
var showEvent = EventHandler.trigger(this.element, this.constructor.Event.SHOW);
|
473
|
+
var shadowRoot = findShadowRoot(this.element);
|
474
|
+
var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element);
|
365
475
|
|
366
|
-
if (showEvent.
|
476
|
+
if (showEvent.defaultPrevented || !isInTheDom) {
|
367
477
|
return;
|
368
478
|
}
|
369
479
|
|
370
480
|
var tip = this.getTipElement();
|
371
|
-
var tipId =
|
481
|
+
var tipId = getUID(this.constructor.NAME);
|
372
482
|
tip.setAttribute('id', tipId);
|
373
483
|
this.element.setAttribute('aria-describedby', tipId);
|
374
484
|
this.setContent();
|
375
485
|
|
376
486
|
if (this.config.animation) {
|
377
|
-
|
487
|
+
tip.classList.add(CLASS_NAME_FADE);
|
378
488
|
}
|
379
489
|
|
380
490
|
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
|
381
491
|
|
382
492
|
var attachment = this._getAttachment(placement);
|
383
493
|
|
384
|
-
this.
|
494
|
+
this._addAttachmentClass(attachment);
|
385
495
|
|
386
496
|
var container = this._getContainer();
|
387
497
|
|
388
|
-
|
498
|
+
Data.setData(tip, this.constructor.DATA_KEY, this);
|
389
499
|
|
390
|
-
if (
|
391
|
-
|
500
|
+
if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
|
501
|
+
container.appendChild(tip);
|
392
502
|
}
|
393
503
|
|
394
|
-
|
395
|
-
this._popper = new
|
396
|
-
|
397
|
-
$__default["default"](tip).addClass(this.config.customClass); // If this is a touch-enabled device we add extra
|
504
|
+
EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
|
505
|
+
this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
|
506
|
+
tip.classList.add(CLASS_NAME_SHOW); // If this is a touch-enabled device we add extra
|
398
507
|
// empty mouseover listeners to the body's immediate children;
|
399
508
|
// only needed because of broken event delegation on iOS
|
400
509
|
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
401
510
|
|
402
511
|
if ('ontouchstart' in document.documentElement) {
|
403
|
-
|
512
|
+
var _ref;
|
513
|
+
|
514
|
+
(_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
|
515
|
+
EventHandler.on(element, 'mouseover', noop());
|
516
|
+
});
|
404
517
|
}
|
405
518
|
|
406
519
|
var complete = function complete() {
|
@@ -410,27 +523,27 @@
|
|
410
523
|
|
411
524
|
var prevHoverState = _this._hoverState;
|
412
525
|
_this._hoverState = null;
|
413
|
-
|
526
|
+
EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN);
|
414
527
|
|
415
528
|
if (prevHoverState === HOVER_STATE_OUT) {
|
416
529
|
_this._leave(null, _this);
|
417
530
|
}
|
418
531
|
};
|
419
532
|
|
420
|
-
if (
|
421
|
-
var transitionDuration =
|
422
|
-
|
533
|
+
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
|
534
|
+
var transitionDuration = getTransitionDurationFromElement(this.tip);
|
535
|
+
EventHandler.one(this.tip, TRANSITION_END, complete);
|
536
|
+
emulateTransitionEnd(this.tip, transitionDuration);
|
423
537
|
} else {
|
424
538
|
complete();
|
425
539
|
}
|
426
540
|
}
|
427
541
|
};
|
428
542
|
|
429
|
-
_proto.hide = function hide(
|
543
|
+
_proto.hide = function hide() {
|
430
544
|
var _this2 = this;
|
431
545
|
|
432
546
|
var tip = this.getTipElement();
|
433
|
-
var hideEvent = $__default["default"].Event(this.constructor.Event.HIDE);
|
434
547
|
|
435
548
|
var complete = function complete() {
|
436
549
|
if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
|
@@ -441,37 +554,36 @@
|
|
441
554
|
|
442
555
|
_this2.element.removeAttribute('aria-describedby');
|
443
556
|
|
444
|
-
|
445
|
-
|
446
|
-
if (_this2._popper !== null) {
|
447
|
-
_this2._popper.destroy();
|
448
|
-
}
|
557
|
+
EventHandler.trigger(_this2.element, _this2.constructor.Event.HIDDEN);
|
449
558
|
|
450
|
-
|
451
|
-
callback();
|
452
|
-
}
|
559
|
+
_this2._popper.destroy();
|
453
560
|
};
|
454
561
|
|
455
|
-
|
562
|
+
var hideEvent = EventHandler.trigger(this.element, this.constructor.Event.HIDE);
|
456
563
|
|
457
|
-
if (hideEvent.
|
564
|
+
if (hideEvent.defaultPrevented) {
|
458
565
|
return;
|
459
566
|
}
|
460
567
|
|
461
|
-
|
568
|
+
tip.classList.remove(CLASS_NAME_SHOW); // If this is a touch-enabled device we remove the extra
|
462
569
|
// empty mouseover listeners we added for iOS support
|
463
570
|
|
464
571
|
if ('ontouchstart' in document.documentElement) {
|
465
|
-
|
572
|
+
var _ref2;
|
573
|
+
|
574
|
+
(_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (element) {
|
575
|
+
return EventHandler.off(element, 'mouseover', noop);
|
576
|
+
});
|
466
577
|
}
|
467
578
|
|
468
579
|
this._activeTrigger[TRIGGER_CLICK] = false;
|
469
580
|
this._activeTrigger[TRIGGER_FOCUS] = false;
|
470
581
|
this._activeTrigger[TRIGGER_HOVER] = false;
|
471
582
|
|
472
|
-
if (
|
473
|
-
var transitionDuration =
|
474
|
-
|
583
|
+
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
|
584
|
+
var transitionDuration = getTransitionDurationFromElement(tip);
|
585
|
+
EventHandler.one(tip, TRANSITION_END, complete);
|
586
|
+
emulateTransitionEnd(tip, transitionDuration);
|
475
587
|
} else {
|
476
588
|
complete();
|
477
589
|
}
|
@@ -490,30 +602,41 @@
|
|
490
602
|
return Boolean(this.getTitle());
|
491
603
|
};
|
492
604
|
|
493
|
-
_proto.addAttachmentClass = function addAttachmentClass(attachment) {
|
494
|
-
$__default["default"](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
|
495
|
-
};
|
496
|
-
|
497
605
|
_proto.getTipElement = function getTipElement() {
|
498
|
-
|
606
|
+
if (this.tip) {
|
607
|
+
return this.tip;
|
608
|
+
}
|
609
|
+
|
610
|
+
var element = document.createElement('div');
|
611
|
+
element.innerHTML = this.config.template;
|
612
|
+
this.tip = element.children[0];
|
499
613
|
return this.tip;
|
500
614
|
};
|
501
615
|
|
502
616
|
_proto.setContent = function setContent() {
|
503
617
|
var tip = this.getTipElement();
|
504
|
-
this.setElementContent(
|
505
|
-
|
618
|
+
this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
|
619
|
+
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
|
506
620
|
};
|
507
621
|
|
508
|
-
_proto.setElementContent = function setElementContent(
|
509
|
-
if (
|
510
|
-
|
622
|
+
_proto.setElementContent = function setElementContent(element, content) {
|
623
|
+
if (element === null) {
|
624
|
+
return;
|
625
|
+
}
|
626
|
+
|
627
|
+
if (typeof content === 'object' && isElement(content)) {
|
628
|
+
if (content.jquery) {
|
629
|
+
content = content[0];
|
630
|
+
} // content is a DOM node or a jQuery
|
631
|
+
|
632
|
+
|
511
633
|
if (this.config.html) {
|
512
|
-
if (
|
513
|
-
|
634
|
+
if (content.parentNode !== element) {
|
635
|
+
element.innerHTML = '';
|
636
|
+
element.appendChild(content);
|
514
637
|
}
|
515
638
|
} else {
|
516
|
-
|
639
|
+
element.textContent = content.textContent;
|
517
640
|
}
|
518
641
|
|
519
642
|
return;
|
@@ -524,9 +647,9 @@
|
|
524
647
|
content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
|
525
648
|
}
|
526
649
|
|
527
|
-
|
650
|
+
element.innerHTML = content;
|
528
651
|
} else {
|
529
|
-
|
652
|
+
element.textContent = content;
|
530
653
|
}
|
531
654
|
};
|
532
655
|
|
@@ -552,7 +675,7 @@
|
|
552
675
|
behavior: this.config.fallbackPlacement
|
553
676
|
},
|
554
677
|
arrow: {
|
555
|
-
element:
|
678
|
+
element: "." + this.constructor.NAME + "-arrow"
|
556
679
|
},
|
557
680
|
preventOverflow: {
|
558
681
|
boundariesElement: this.config.boundary
|
@@ -567,7 +690,11 @@
|
|
567
690
|
return _this3._handlePopperPlacementChange(data);
|
568
691
|
}
|
569
692
|
};
|
570
|
-
return
|
693
|
+
return _objectSpread(_objectSpread({}, defaultBsConfig), this.config.popperConfig);
|
694
|
+
};
|
695
|
+
|
696
|
+
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
|
697
|
+
this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
|
571
698
|
};
|
572
699
|
|
573
700
|
_proto._getOffset = function _getOffset() {
|
@@ -577,7 +704,7 @@
|
|
577
704
|
|
578
705
|
if (typeof this.config.offset === 'function') {
|
579
706
|
offset.fn = function (data) {
|
580
|
-
data.offsets =
|
707
|
+
data.offsets = _objectSpread(_objectSpread({}, data.offsets), _this4.config.offset(data.offsets, _this4.element) || {});
|
581
708
|
return data;
|
582
709
|
};
|
583
710
|
} else {
|
@@ -592,11 +719,11 @@
|
|
592
719
|
return document.body;
|
593
720
|
}
|
594
721
|
|
595
|
-
if (
|
596
|
-
return
|
722
|
+
if (isElement(this.config.container)) {
|
723
|
+
return this.config.container;
|
597
724
|
}
|
598
725
|
|
599
|
-
return
|
726
|
+
return SelectorEngine.findOne(this.config.container);
|
600
727
|
};
|
601
728
|
|
602
729
|
_proto._getAttachment = function _getAttachment(placement) {
|
@@ -609,15 +736,16 @@
|
|
609
736
|
var triggers = this.config.trigger.split(' ');
|
610
737
|
triggers.forEach(function (trigger) {
|
611
738
|
if (trigger === 'click') {
|
612
|
-
|
739
|
+
EventHandler.on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
|
613
740
|
return _this5.toggle(event);
|
614
741
|
});
|
615
742
|
} else if (trigger !== TRIGGER_MANUAL) {
|
616
743
|
var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
|
617
744
|
var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
|
618
|
-
|
745
|
+
EventHandler.on(_this5.element, eventIn, _this5.config.selector, function (event) {
|
619
746
|
return _this5._enter(event);
|
620
|
-
})
|
747
|
+
});
|
748
|
+
EventHandler.on(_this5.element, eventOut, _this5.config.selector, function (event) {
|
621
749
|
return _this5._leave(event);
|
622
750
|
});
|
623
751
|
}
|
@@ -629,10 +757,10 @@
|
|
629
757
|
}
|
630
758
|
};
|
631
759
|
|
632
|
-
|
760
|
+
EventHandler.on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
|
633
761
|
|
634
762
|
if (this.config.selector) {
|
635
|
-
this.config =
|
763
|
+
this.config = _objectSpread(_objectSpread({}, this.config), {}, {
|
636
764
|
trigger: 'manual',
|
637
765
|
selector: ''
|
638
766
|
});
|
@@ -652,18 +780,18 @@
|
|
652
780
|
|
653
781
|
_proto._enter = function _enter(event, context) {
|
654
782
|
var dataKey = this.constructor.DATA_KEY;
|
655
|
-
context = context ||
|
783
|
+
context = context || Data.getData(event.target, dataKey);
|
656
784
|
|
657
785
|
if (!context) {
|
658
|
-
context = new this.constructor(event.
|
659
|
-
|
786
|
+
context = new this.constructor(event.target, this._getDelegateConfig());
|
787
|
+
Data.setData(event.target, dataKey, context);
|
660
788
|
}
|
661
789
|
|
662
790
|
if (event) {
|
663
791
|
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
|
664
792
|
}
|
665
793
|
|
666
|
-
if (
|
794
|
+
if (context.getTipElement().classList.contains(CLASS_NAME_SHOW) || context._hoverState === HOVER_STATE_SHOW) {
|
667
795
|
context._hoverState = HOVER_STATE_SHOW;
|
668
796
|
return;
|
669
797
|
}
|
@@ -685,11 +813,11 @@
|
|
685
813
|
|
686
814
|
_proto._leave = function _leave(event, context) {
|
687
815
|
var dataKey = this.constructor.DATA_KEY;
|
688
|
-
context = context ||
|
816
|
+
context = context || Data.getData(event.target, dataKey);
|
689
817
|
|
690
818
|
if (!context) {
|
691
|
-
context = new this.constructor(event.
|
692
|
-
|
819
|
+
context = new this.constructor(event.target, this._getDelegateConfig());
|
820
|
+
Data.setData(event.target, dataKey, context);
|
693
821
|
}
|
694
822
|
|
695
823
|
if (event) {
|
@@ -726,13 +854,18 @@
|
|
726
854
|
};
|
727
855
|
|
728
856
|
_proto._getConfig = function _getConfig(config) {
|
729
|
-
var dataAttributes =
|
857
|
+
var dataAttributes = Manipulator.getDataAttributes(this.element);
|
730
858
|
Object.keys(dataAttributes).forEach(function (dataAttr) {
|
731
859
|
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
|
732
860
|
delete dataAttributes[dataAttr];
|
733
861
|
}
|
734
862
|
});
|
735
|
-
|
863
|
+
|
864
|
+
if (config && typeof config.container === 'object' && config.container.jquery) {
|
865
|
+
config.container = config.container[0];
|
866
|
+
}
|
867
|
+
|
868
|
+
config = _objectSpread(_objectSpread(_objectSpread({}, this.constructor.Default), dataAttributes), typeof config === 'object' && config ? config : {});
|
736
869
|
|
737
870
|
if (typeof config.delay === 'number') {
|
738
871
|
config.delay = {
|
@@ -749,7 +882,7 @@
|
|
749
882
|
config.content = config.content.toString();
|
750
883
|
}
|
751
884
|
|
752
|
-
|
885
|
+
typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
753
886
|
|
754
887
|
if (config.sanitize) {
|
755
888
|
config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
|
@@ -773,20 +906,25 @@
|
|
773
906
|
};
|
774
907
|
|
775
908
|
_proto._cleanTipClass = function _cleanTipClass() {
|
776
|
-
var
|
777
|
-
var tabClass =
|
909
|
+
var tip = this.getTipElement();
|
910
|
+
var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
778
911
|
|
779
|
-
if (tabClass !== null && tabClass.length) {
|
780
|
-
|
912
|
+
if (tabClass !== null && tabClass.length > 0) {
|
913
|
+
tabClass.map(function (token) {
|
914
|
+
return token.trim();
|
915
|
+
}).forEach(function (tClass) {
|
916
|
+
return tip.classList.remove(tClass);
|
917
|
+
});
|
781
918
|
}
|
782
919
|
};
|
783
920
|
|
784
921
|
_proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
|
785
|
-
|
922
|
+
var popperInstance = popperData.instance;
|
923
|
+
this.tip = popperInstance.popper;
|
786
924
|
|
787
925
|
this._cleanTipClass();
|
788
926
|
|
789
|
-
this.
|
927
|
+
this._addAttachmentClass(this._getAttachment(popperData.placement));
|
790
928
|
};
|
791
929
|
|
792
930
|
_proto._fixTransition = function _fixTransition() {
|
@@ -797,7 +935,7 @@
|
|
797
935
|
return;
|
798
936
|
}
|
799
937
|
|
800
|
-
|
938
|
+
tip.classList.remove(CLASS_NAME_FADE);
|
801
939
|
this.config.animation = false;
|
802
940
|
this.hide();
|
803
941
|
this.show();
|
@@ -805,10 +943,9 @@
|
|
805
943
|
} // Static
|
806
944
|
;
|
807
945
|
|
808
|
-
Tooltip.
|
946
|
+
Tooltip.jQueryInterface = function jQueryInterface(config) {
|
809
947
|
return this.each(function () {
|
810
|
-
var
|
811
|
-
var data = $element.data(DATA_KEY);
|
948
|
+
var data = Data.getData(this, DATA_KEY);
|
812
949
|
|
813
950
|
var _config = typeof config === 'object' && config;
|
814
951
|
|
@@ -818,7 +955,6 @@
|
|
818
955
|
|
819
956
|
if (!data) {
|
820
957
|
data = new Tooltip(this, _config);
|
821
|
-
$element.data(DATA_KEY, data);
|
822
958
|
}
|
823
959
|
|
824
960
|
if (typeof config === 'string') {
|
@@ -831,6 +967,10 @@
|
|
831
967
|
});
|
832
968
|
};
|
833
969
|
|
970
|
+
Tooltip.getInstance = function getInstance(element) {
|
971
|
+
return Data.getData(element, DATA_KEY);
|
972
|
+
};
|
973
|
+
|
834
974
|
_createClass(Tooltip, null, [{
|
835
975
|
key: "VERSION",
|
836
976
|
get: function get() {
|
@@ -854,7 +994,7 @@
|
|
854
994
|
}, {
|
855
995
|
key: "Event",
|
856
996
|
get: function get() {
|
857
|
-
return Event;
|
997
|
+
return Event$1;
|
858
998
|
}
|
859
999
|
}, {
|
860
1000
|
key: "EVENT_KEY",
|
@@ -870,19 +1010,28 @@
|
|
870
1010
|
|
871
1011
|
return Tooltip;
|
872
1012
|
}();
|
1013
|
+
|
1014
|
+
var $ = getjQuery();
|
873
1015
|
/**
|
1016
|
+
* ------------------------------------------------------------------------
|
874
1017
|
* jQuery
|
1018
|
+
* ------------------------------------------------------------------------
|
1019
|
+
* add .tooltip to jQuery only if jQuery is present
|
875
1020
|
*/
|
876
1021
|
|
1022
|
+
/* istanbul ignore if */
|
877
1023
|
|
878
|
-
$
|
879
|
-
|
1024
|
+
if ($) {
|
1025
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
1026
|
+
$.fn[NAME] = Tooltip.jQueryInterface;
|
1027
|
+
$.fn[NAME].Constructor = Tooltip;
|
880
1028
|
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
1029
|
+
$.fn[NAME].noConflict = function () {
|
1030
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
1031
|
+
return Tooltip.jQueryInterface;
|
1032
|
+
};
|
1033
|
+
}
|
885
1034
|
|
886
1035
|
return Tooltip;
|
887
1036
|
|
888
|
-
}));
|
1037
|
+
})));
|