bootstrap 4.1.3 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bootstrap might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/assets/javascripts/bootstrap-sprockets.js +6 -5
- data/assets/javascripts/bootstrap.js +3290 -2985
- data/assets/javascripts/bootstrap.min.js +2 -2
- data/assets/javascripts/bootstrap/alert.js +127 -132
- data/assets/javascripts/bootstrap/button.js +119 -124
- data/assets/javascripts/bootstrap/carousel.js +492 -393
- data/assets/javascripts/bootstrap/collapse.js +276 -279
- data/assets/javascripts/bootstrap/dropdown.js +413 -374
- data/assets/javascripts/bootstrap/modal.js +455 -445
- data/assets/javascripts/bootstrap/popover.js +155 -160
- data/assets/javascripts/bootstrap/scrollspy.js +246 -250
- data/assets/javascripts/bootstrap/tab.js +180 -192
- data/assets/javascripts/bootstrap/toast.js +277 -0
- data/assets/javascripts/bootstrap/tooltip.js +533 -522
- data/assets/javascripts/bootstrap/util.js +140 -116
- data/assets/stylesheets/_bootstrap-grid.scss +2 -5
- data/assets/stylesheets/_bootstrap-reboot.scss +1 -1
- data/assets/stylesheets/_bootstrap.scss +3 -1
- data/assets/stylesheets/bootstrap/_alert.scss +1 -1
- data/assets/stylesheets/bootstrap/_badge.scss +6 -0
- data/assets/stylesheets/bootstrap/_button-group.scss +9 -18
- data/assets/stylesheets/bootstrap/_buttons.scss +7 -10
- data/assets/stylesheets/bootstrap/_card.scss +30 -21
- data/assets/stylesheets/bootstrap/_carousel.scss +36 -74
- data/assets/stylesheets/bootstrap/_close.scss +15 -6
- data/assets/stylesheets/bootstrap/_custom-forms.scss +103 -29
- data/assets/stylesheets/bootstrap/_dropdown.scss +30 -5
- data/assets/stylesheets/bootstrap/_forms.scss +12 -11
- data/assets/stylesheets/bootstrap/_functions.scss +4 -4
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_input-group.scss +24 -4
- data/assets/stylesheets/bootstrap/_list-group.scss +6 -0
- data/assets/stylesheets/bootstrap/_modal.scss +16 -10
- data/assets/stylesheets/bootstrap/_nav.scss +2 -0
- data/assets/stylesheets/bootstrap/_navbar.scss +4 -4
- data/assets/stylesheets/bootstrap/_popover.scss +1 -1
- data/assets/stylesheets/bootstrap/_reboot.scss +14 -35
- data/assets/stylesheets/bootstrap/_spinners.scss +53 -0
- data/assets/stylesheets/bootstrap/_tables.scss +2 -2
- data/assets/stylesheets/bootstrap/_toasts.scss +43 -0
- data/assets/stylesheets/bootstrap/_type.scss +2 -2
- data/assets/stylesheets/bootstrap/_utilities.scss +1 -0
- data/assets/stylesheets/bootstrap/_variables.scss +220 -81
- data/assets/stylesheets/bootstrap/mixins/_badge.scss +1 -2
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +9 -7
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +0 -4
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +61 -10
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +3 -4
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +9 -10
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +10 -1
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +5 -2
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +4 -0
- data/assets/stylesheets/bootstrap/utilities/_embed.scss +7 -20
- data/assets/stylesheets/bootstrap/utilities/_overflow.scss +5 -0
- data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_sizing.scss +8 -0
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +23 -1
- data/assets/stylesheets/bootstrap/utilities/_text.scss +13 -4
- data/bootstrap.gemspec +6 -3
- data/lib/bootstrap.rb +10 -7
- data/lib/bootstrap/engine.rb +3 -0
- data/lib/bootstrap/version.rb +4 -2
- metadata +15 -11
@@ -1,3 +1,8 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap popover.js v4.2.1 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
5
|
+
*/
|
1
6
|
(function (global, factory) {
|
2
7
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./tooltip.js')) :
|
3
8
|
typeof define === 'function' && define.amd ? define(['jquery', './tooltip.js'], factory) :
|
@@ -64,201 +69,191 @@
|
|
64
69
|
}
|
65
70
|
|
66
71
|
/**
|
67
|
-
*
|
68
|
-
*
|
69
|
-
*
|
70
|
-
* --------------------------------------------------------------------------
|
72
|
+
* ------------------------------------------------------------------------
|
73
|
+
* Constants
|
74
|
+
* ------------------------------------------------------------------------
|
71
75
|
*/
|
72
76
|
|
73
|
-
var
|
77
|
+
var NAME = 'popover';
|
78
|
+
var VERSION = '4.2.1';
|
79
|
+
var DATA_KEY = 'bs.popover';
|
80
|
+
var EVENT_KEY = "." + DATA_KEY;
|
81
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
82
|
+
var CLASS_PREFIX = 'bs-popover';
|
83
|
+
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
|
84
|
+
|
85
|
+
var Default = _objectSpread({}, Tooltip.Default, {
|
86
|
+
placement: 'right',
|
87
|
+
trigger: 'click',
|
88
|
+
content: '',
|
89
|
+
template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
|
90
|
+
});
|
91
|
+
|
92
|
+
var DefaultType = _objectSpread({}, Tooltip.DefaultType, {
|
93
|
+
content: '(string|element|function)'
|
94
|
+
});
|
95
|
+
|
96
|
+
var ClassName = {
|
97
|
+
FADE: 'fade',
|
98
|
+
SHOW: 'show'
|
99
|
+
};
|
100
|
+
var Selector = {
|
101
|
+
TITLE: '.popover-header',
|
102
|
+
CONTENT: '.popover-body'
|
103
|
+
};
|
104
|
+
var Event = {
|
105
|
+
HIDE: "hide" + EVENT_KEY,
|
106
|
+
HIDDEN: "hidden" + EVENT_KEY,
|
107
|
+
SHOW: "show" + EVENT_KEY,
|
108
|
+
SHOWN: "shown" + EVENT_KEY,
|
109
|
+
INSERTED: "inserted" + EVENT_KEY,
|
110
|
+
CLICK: "click" + EVENT_KEY,
|
111
|
+
FOCUSIN: "focusin" + EVENT_KEY,
|
112
|
+
FOCUSOUT: "focusout" + EVENT_KEY,
|
113
|
+
MOUSEENTER: "mouseenter" + EVENT_KEY,
|
114
|
+
MOUSELEAVE: "mouseleave" + EVENT_KEY
|
74
115
|
/**
|
75
116
|
* ------------------------------------------------------------------------
|
76
|
-
*
|
117
|
+
* Class Definition
|
77
118
|
* ------------------------------------------------------------------------
|
78
119
|
*/
|
79
|
-
var NAME = 'popover';
|
80
|
-
var VERSION = '4.1.3';
|
81
|
-
var DATA_KEY = 'bs.popover';
|
82
|
-
var EVENT_KEY = "." + DATA_KEY;
|
83
|
-
var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
|
84
|
-
var CLASS_PREFIX = 'bs-popover';
|
85
|
-
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
|
86
|
-
|
87
|
-
var Default = _objectSpread({}, Tooltip.Default, {
|
88
|
-
placement: 'right',
|
89
|
-
trigger: 'click',
|
90
|
-
content: '',
|
91
|
-
template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
|
92
|
-
});
|
93
|
-
|
94
|
-
var DefaultType = _objectSpread({}, Tooltip.DefaultType, {
|
95
|
-
content: '(string|element|function)'
|
96
|
-
});
|
97
|
-
|
98
|
-
var ClassName = {
|
99
|
-
FADE: 'fade',
|
100
|
-
SHOW: 'show'
|
101
|
-
};
|
102
|
-
var Selector = {
|
103
|
-
TITLE: '.popover-header',
|
104
|
-
CONTENT: '.popover-body'
|
105
|
-
};
|
106
|
-
var Event = {
|
107
|
-
HIDE: "hide" + EVENT_KEY,
|
108
|
-
HIDDEN: "hidden" + EVENT_KEY,
|
109
|
-
SHOW: "show" + EVENT_KEY,
|
110
|
-
SHOWN: "shown" + EVENT_KEY,
|
111
|
-
INSERTED: "inserted" + EVENT_KEY,
|
112
|
-
CLICK: "click" + EVENT_KEY,
|
113
|
-
FOCUSIN: "focusin" + EVENT_KEY,
|
114
|
-
FOCUSOUT: "focusout" + EVENT_KEY,
|
115
|
-
MOUSEENTER: "mouseenter" + EVENT_KEY,
|
116
|
-
MOUSELEAVE: "mouseleave" + EVENT_KEY
|
117
|
-
/**
|
118
|
-
* ------------------------------------------------------------------------
|
119
|
-
* Class Definition
|
120
|
-
* ------------------------------------------------------------------------
|
121
|
-
*/
|
122
|
-
|
123
|
-
};
|
124
120
|
|
125
|
-
|
126
|
-
/*#__PURE__*/
|
127
|
-
function (_Tooltip) {
|
128
|
-
_inheritsLoose(Popover, _Tooltip);
|
121
|
+
};
|
129
122
|
|
130
|
-
|
131
|
-
|
132
|
-
|
123
|
+
var Popover =
|
124
|
+
/*#__PURE__*/
|
125
|
+
function (_Tooltip) {
|
126
|
+
_inheritsLoose(Popover, _Tooltip);
|
133
127
|
|
134
|
-
|
128
|
+
function Popover() {
|
129
|
+
return _Tooltip.apply(this, arguments) || this;
|
130
|
+
}
|
135
131
|
|
136
|
-
|
137
|
-
_proto.isWithContent = function isWithContent() {
|
138
|
-
return this.getTitle() || this._getContent();
|
139
|
-
};
|
132
|
+
var _proto = Popover.prototype;
|
140
133
|
|
141
|
-
|
142
|
-
|
143
|
-
|
134
|
+
// Overrides
|
135
|
+
_proto.isWithContent = function isWithContent() {
|
136
|
+
return this.getTitle() || this._getContent();
|
137
|
+
};
|
144
138
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
};
|
139
|
+
_proto.addAttachmentClass = function addAttachmentClass(attachment) {
|
140
|
+
$(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
|
141
|
+
};
|
149
142
|
|
150
|
-
|
151
|
-
|
143
|
+
_proto.getTipElement = function getTipElement() {
|
144
|
+
this.tip = this.tip || $(this.config.template)[0];
|
145
|
+
return this.tip;
|
146
|
+
};
|
152
147
|
|
153
|
-
|
148
|
+
_proto.setContent = function setContent() {
|
149
|
+
var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
|
154
150
|
|
155
|
-
|
151
|
+
this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
|
156
152
|
|
157
|
-
|
158
|
-
content = content.call(this.element);
|
159
|
-
}
|
153
|
+
var content = this._getContent();
|
160
154
|
|
161
|
-
|
162
|
-
|
163
|
-
}
|
155
|
+
if (typeof content === 'function') {
|
156
|
+
content = content.call(this.element);
|
157
|
+
}
|
164
158
|
|
159
|
+
this.setElementContent($tip.find(Selector.CONTENT), content);
|
160
|
+
$tip.removeClass(ClassName.FADE + " " + ClassName.SHOW);
|
161
|
+
}; // Private
|
165
162
|
|
166
|
-
_proto._getContent = function _getContent() {
|
167
|
-
return this.element.getAttribute('data-content') || this.config.content;
|
168
|
-
};
|
169
163
|
|
170
|
-
|
171
|
-
|
172
|
-
|
164
|
+
_proto._getContent = function _getContent() {
|
165
|
+
return this.element.getAttribute('data-content') || this.config.content;
|
166
|
+
};
|
173
167
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
}; // Static
|
168
|
+
_proto._cleanTipClass = function _cleanTipClass() {
|
169
|
+
var $tip = $(this.getTipElement());
|
170
|
+
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
|
178
171
|
|
172
|
+
if (tabClass !== null && tabClass.length > 0) {
|
173
|
+
$tip.removeClass(tabClass.join(''));
|
174
|
+
}
|
175
|
+
}; // Static
|
179
176
|
|
180
|
-
Popover._jQueryInterface = function _jQueryInterface(config) {
|
181
|
-
return this.each(function () {
|
182
|
-
var data = $$$1(this).data(DATA_KEY);
|
183
177
|
|
184
|
-
|
178
|
+
Popover._jQueryInterface = function _jQueryInterface(config) {
|
179
|
+
return this.each(function () {
|
180
|
+
var data = $(this).data(DATA_KEY);
|
185
181
|
|
186
|
-
|
187
|
-
return;
|
188
|
-
}
|
182
|
+
var _config = typeof config === 'object' ? config : null;
|
189
183
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
}
|
184
|
+
if (!data && /dispose|hide/.test(config)) {
|
185
|
+
return;
|
186
|
+
}
|
194
187
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
188
|
+
if (!data) {
|
189
|
+
data = new Popover(this, _config);
|
190
|
+
$(this).data(DATA_KEY, data);
|
191
|
+
}
|
199
192
|
|
200
|
-
|
193
|
+
if (typeof config === 'string') {
|
194
|
+
if (typeof data[config] === 'undefined') {
|
195
|
+
throw new TypeError("No method named \"" + config + "\"");
|
201
196
|
}
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
_createClass(Popover, null, [{
|
206
|
-
key: "VERSION",
|
207
|
-
// Getters
|
208
|
-
get: function get() {
|
209
|
-
return VERSION;
|
210
|
-
}
|
211
|
-
}, {
|
212
|
-
key: "Default",
|
213
|
-
get: function get() {
|
214
|
-
return Default;
|
215
|
-
}
|
216
|
-
}, {
|
217
|
-
key: "NAME",
|
218
|
-
get: function get() {
|
219
|
-
return NAME;
|
220
|
-
}
|
221
|
-
}, {
|
222
|
-
key: "DATA_KEY",
|
223
|
-
get: function get() {
|
224
|
-
return DATA_KEY;
|
225
|
-
}
|
226
|
-
}, {
|
227
|
-
key: "Event",
|
228
|
-
get: function get() {
|
229
|
-
return Event;
|
230
|
-
}
|
231
|
-
}, {
|
232
|
-
key: "EVENT_KEY",
|
233
|
-
get: function get() {
|
234
|
-
return EVENT_KEY;
|
235
|
-
}
|
236
|
-
}, {
|
237
|
-
key: "DefaultType",
|
238
|
-
get: function get() {
|
239
|
-
return DefaultType;
|
197
|
+
|
198
|
+
data[config]();
|
240
199
|
}
|
241
|
-
}
|
200
|
+
});
|
201
|
+
};
|
242
202
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
203
|
+
_createClass(Popover, null, [{
|
204
|
+
key: "VERSION",
|
205
|
+
// Getters
|
206
|
+
get: function get() {
|
207
|
+
return VERSION;
|
208
|
+
}
|
209
|
+
}, {
|
210
|
+
key: "Default",
|
211
|
+
get: function get() {
|
212
|
+
return Default;
|
213
|
+
}
|
214
|
+
}, {
|
215
|
+
key: "NAME",
|
216
|
+
get: function get() {
|
217
|
+
return NAME;
|
218
|
+
}
|
219
|
+
}, {
|
220
|
+
key: "DATA_KEY",
|
221
|
+
get: function get() {
|
222
|
+
return DATA_KEY;
|
223
|
+
}
|
224
|
+
}, {
|
225
|
+
key: "Event",
|
226
|
+
get: function get() {
|
227
|
+
return Event;
|
228
|
+
}
|
229
|
+
}, {
|
230
|
+
key: "EVENT_KEY",
|
231
|
+
get: function get() {
|
232
|
+
return EVENT_KEY;
|
233
|
+
}
|
234
|
+
}, {
|
235
|
+
key: "DefaultType",
|
236
|
+
get: function get() {
|
237
|
+
return DefaultType;
|
238
|
+
}
|
239
|
+
}]);
|
250
240
|
|
241
|
+
return Popover;
|
242
|
+
}(Tooltip);
|
243
|
+
/**
|
244
|
+
* ------------------------------------------------------------------------
|
245
|
+
* jQuery
|
246
|
+
* ------------------------------------------------------------------------
|
247
|
+
*/
|
251
248
|
|
252
|
-
$$$1.fn[NAME] = Popover._jQueryInterface;
|
253
|
-
$$$1.fn[NAME].Constructor = Popover;
|
254
249
|
|
255
|
-
|
256
|
-
|
257
|
-
return Popover._jQueryInterface;
|
258
|
-
};
|
250
|
+
$.fn[NAME] = Popover._jQueryInterface;
|
251
|
+
$.fn[NAME].Constructor = Popover;
|
259
252
|
|
260
|
-
|
261
|
-
|
253
|
+
$.fn[NAME].noConflict = function () {
|
254
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
255
|
+
return Popover._jQueryInterface;
|
256
|
+
};
|
262
257
|
|
263
258
|
return Popover;
|
264
259
|
|
@@ -1,3 +1,8 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap scrollspy.js v4.2.1 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
5
|
+
*/
|
1
6
|
(function (global, factory) {
|
2
7
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
|
3
8
|
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
|
@@ -58,320 +63,311 @@
|
|
58
63
|
}
|
59
64
|
|
60
65
|
/**
|
61
|
-
*
|
62
|
-
*
|
63
|
-
*
|
64
|
-
* --------------------------------------------------------------------------
|
66
|
+
* ------------------------------------------------------------------------
|
67
|
+
* Constants
|
68
|
+
* ------------------------------------------------------------------------
|
65
69
|
*/
|
66
70
|
|
67
|
-
var
|
71
|
+
var NAME = 'scrollspy';
|
72
|
+
var VERSION = '4.2.1';
|
73
|
+
var DATA_KEY = 'bs.scrollspy';
|
74
|
+
var EVENT_KEY = "." + DATA_KEY;
|
75
|
+
var DATA_API_KEY = '.data-api';
|
76
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
77
|
+
var Default = {
|
78
|
+
offset: 10,
|
79
|
+
method: 'auto',
|
80
|
+
target: ''
|
81
|
+
};
|
82
|
+
var DefaultType = {
|
83
|
+
offset: 'number',
|
84
|
+
method: 'string',
|
85
|
+
target: '(string|element)'
|
86
|
+
};
|
87
|
+
var Event = {
|
88
|
+
ACTIVATE: "activate" + EVENT_KEY,
|
89
|
+
SCROLL: "scroll" + EVENT_KEY,
|
90
|
+
LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY
|
91
|
+
};
|
92
|
+
var ClassName = {
|
93
|
+
DROPDOWN_ITEM: 'dropdown-item',
|
94
|
+
DROPDOWN_MENU: 'dropdown-menu',
|
95
|
+
ACTIVE: 'active'
|
96
|
+
};
|
97
|
+
var Selector = {
|
98
|
+
DATA_SPY: '[data-spy="scroll"]',
|
99
|
+
ACTIVE: '.active',
|
100
|
+
NAV_LIST_GROUP: '.nav, .list-group',
|
101
|
+
NAV_LINKS: '.nav-link',
|
102
|
+
NAV_ITEMS: '.nav-item',
|
103
|
+
LIST_ITEMS: '.list-group-item',
|
104
|
+
DROPDOWN: '.dropdown',
|
105
|
+
DROPDOWN_ITEMS: '.dropdown-item',
|
106
|
+
DROPDOWN_TOGGLE: '.dropdown-toggle'
|
107
|
+
};
|
108
|
+
var OffsetMethod = {
|
109
|
+
OFFSET: 'offset',
|
110
|
+
POSITION: 'position'
|
68
111
|
/**
|
69
112
|
* ------------------------------------------------------------------------
|
70
|
-
*
|
113
|
+
* Class Definition
|
71
114
|
* ------------------------------------------------------------------------
|
72
115
|
*/
|
73
|
-
var NAME = 'scrollspy';
|
74
|
-
var VERSION = '4.1.3';
|
75
|
-
var DATA_KEY = 'bs.scrollspy';
|
76
|
-
var EVENT_KEY = "." + DATA_KEY;
|
77
|
-
var DATA_API_KEY = '.data-api';
|
78
|
-
var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
|
79
|
-
var Default = {
|
80
|
-
offset: 10,
|
81
|
-
method: 'auto',
|
82
|
-
target: ''
|
83
|
-
};
|
84
|
-
var DefaultType = {
|
85
|
-
offset: 'number',
|
86
|
-
method: 'string',
|
87
|
-
target: '(string|element)'
|
88
|
-
};
|
89
|
-
var Event = {
|
90
|
-
ACTIVATE: "activate" + EVENT_KEY,
|
91
|
-
SCROLL: "scroll" + EVENT_KEY,
|
92
|
-
LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY
|
93
|
-
};
|
94
|
-
var ClassName = {
|
95
|
-
DROPDOWN_ITEM: 'dropdown-item',
|
96
|
-
DROPDOWN_MENU: 'dropdown-menu',
|
97
|
-
ACTIVE: 'active'
|
98
|
-
};
|
99
|
-
var Selector = {
|
100
|
-
DATA_SPY: '[data-spy="scroll"]',
|
101
|
-
ACTIVE: '.active',
|
102
|
-
NAV_LIST_GROUP: '.nav, .list-group',
|
103
|
-
NAV_LINKS: '.nav-link',
|
104
|
-
NAV_ITEMS: '.nav-item',
|
105
|
-
LIST_ITEMS: '.list-group-item',
|
106
|
-
DROPDOWN: '.dropdown',
|
107
|
-
DROPDOWN_ITEMS: '.dropdown-item',
|
108
|
-
DROPDOWN_TOGGLE: '.dropdown-toggle'
|
109
|
-
};
|
110
|
-
var OffsetMethod = {
|
111
|
-
OFFSET: 'offset',
|
112
|
-
POSITION: 'position'
|
113
|
-
/**
|
114
|
-
* ------------------------------------------------------------------------
|
115
|
-
* Class Definition
|
116
|
-
* ------------------------------------------------------------------------
|
117
|
-
*/
|
118
116
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
117
|
+
};
|
118
|
+
|
119
|
+
var ScrollSpy =
|
120
|
+
/*#__PURE__*/
|
121
|
+
function () {
|
122
|
+
function ScrollSpy(element, config) {
|
123
|
+
var _this = this;
|
124
|
+
|
125
|
+
this._element = element;
|
126
|
+
this._scrollElement = element.tagName === 'BODY' ? window : element;
|
127
|
+
this._config = this._getConfig(config);
|
128
|
+
this._selector = this._config.target + " " + Selector.NAV_LINKS + "," + (this._config.target + " " + Selector.LIST_ITEMS + ",") + (this._config.target + " " + Selector.DROPDOWN_ITEMS);
|
129
|
+
this._offsets = [];
|
130
|
+
this._targets = [];
|
131
|
+
this._activeTarget = null;
|
132
|
+
this._scrollHeight = 0;
|
133
|
+
$(this._scrollElement).on(Event.SCROLL, function (event) {
|
134
|
+
return _this._process(event);
|
135
|
+
});
|
136
|
+
this.refresh();
|
139
137
|
|
140
|
-
|
141
|
-
|
138
|
+
this._process();
|
139
|
+
} // Getters
|
142
140
|
|
143
141
|
|
144
|
-
|
142
|
+
var _proto = ScrollSpy.prototype;
|
145
143
|
|
146
|
-
|
147
|
-
|
148
|
-
|
144
|
+
// Public
|
145
|
+
_proto.refresh = function refresh() {
|
146
|
+
var _this2 = this;
|
149
147
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
148
|
+
var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
|
149
|
+
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
|
150
|
+
var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
|
151
|
+
this._offsets = [];
|
152
|
+
this._targets = [];
|
153
|
+
this._scrollHeight = this._getScrollHeight();
|
154
|
+
var targets = [].slice.call(document.querySelectorAll(this._selector));
|
155
|
+
targets.map(function (element) {
|
156
|
+
var target;
|
157
|
+
var targetSelector = Util.getSelectorFromElement(element);
|
160
158
|
|
161
|
-
|
162
|
-
|
163
|
-
|
159
|
+
if (targetSelector) {
|
160
|
+
target = document.querySelector(targetSelector);
|
161
|
+
}
|
164
162
|
|
165
|
-
|
166
|
-
|
163
|
+
if (target) {
|
164
|
+
var targetBCR = target.getBoundingClientRect();
|
167
165
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
}
|
166
|
+
if (targetBCR.width || targetBCR.height) {
|
167
|
+
// TODO (fat): remove sketch reliance on jQuery position/offset
|
168
|
+
return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
|
172
169
|
}
|
170
|
+
}
|
173
171
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
_this2._targets.push(item[1]);
|
183
|
-
});
|
184
|
-
};
|
185
|
-
|
186
|
-
_proto.dispose = function dispose() {
|
187
|
-
$$$1.removeData(this._element, DATA_KEY);
|
188
|
-
$$$1(this._scrollElement).off(EVENT_KEY);
|
189
|
-
this._element = null;
|
190
|
-
this._scrollElement = null;
|
191
|
-
this._config = null;
|
192
|
-
this._selector = null;
|
193
|
-
this._offsets = null;
|
194
|
-
this._targets = null;
|
195
|
-
this._activeTarget = null;
|
196
|
-
this._scrollHeight = null;
|
197
|
-
}; // Private
|
198
|
-
|
199
|
-
|
200
|
-
_proto._getConfig = function _getConfig(config) {
|
201
|
-
config = _objectSpread({}, Default, typeof config === 'object' && config ? config : {});
|
202
|
-
|
203
|
-
if (typeof config.target !== 'string') {
|
204
|
-
var id = $$$1(config.target).attr('id');
|
172
|
+
return null;
|
173
|
+
}).filter(function (item) {
|
174
|
+
return item;
|
175
|
+
}).sort(function (a, b) {
|
176
|
+
return a[0] - b[0];
|
177
|
+
}).forEach(function (item) {
|
178
|
+
_this2._offsets.push(item[0]);
|
205
179
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
}
|
180
|
+
_this2._targets.push(item[1]);
|
181
|
+
});
|
182
|
+
};
|
210
183
|
|
211
|
-
|
184
|
+
_proto.dispose = function dispose() {
|
185
|
+
$.removeData(this._element, DATA_KEY);
|
186
|
+
$(this._scrollElement).off(EVENT_KEY);
|
187
|
+
this._element = null;
|
188
|
+
this._scrollElement = null;
|
189
|
+
this._config = null;
|
190
|
+
this._selector = null;
|
191
|
+
this._offsets = null;
|
192
|
+
this._targets = null;
|
193
|
+
this._activeTarget = null;
|
194
|
+
this._scrollHeight = null;
|
195
|
+
}; // Private
|
196
|
+
|
197
|
+
|
198
|
+
_proto._getConfig = function _getConfig(config) {
|
199
|
+
config = _objectSpread({}, Default, typeof config === 'object' && config ? config : {});
|
200
|
+
|
201
|
+
if (typeof config.target !== 'string') {
|
202
|
+
var id = $(config.target).attr('id');
|
203
|
+
|
204
|
+
if (!id) {
|
205
|
+
id = Util.getUID(NAME);
|
206
|
+
$(config.target).attr('id', id);
|
212
207
|
}
|
213
208
|
|
214
|
-
|
215
|
-
|
216
|
-
};
|
209
|
+
config.target = "#" + id;
|
210
|
+
}
|
217
211
|
|
218
|
-
|
219
|
-
|
220
|
-
|
212
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
213
|
+
return config;
|
214
|
+
};
|
221
215
|
|
222
|
-
|
223
|
-
|
224
|
-
|
216
|
+
_proto._getScrollTop = function _getScrollTop() {
|
217
|
+
return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
|
218
|
+
};
|
225
219
|
|
226
|
-
|
227
|
-
|
228
|
-
|
220
|
+
_proto._getScrollHeight = function _getScrollHeight() {
|
221
|
+
return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
|
222
|
+
};
|
229
223
|
|
230
|
-
|
231
|
-
|
224
|
+
_proto._getOffsetHeight = function _getOffsetHeight() {
|
225
|
+
return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
|
226
|
+
};
|
232
227
|
|
233
|
-
|
228
|
+
_proto._process = function _process() {
|
229
|
+
var scrollTop = this._getScrollTop() + this._config.offset;
|
234
230
|
|
235
|
-
|
231
|
+
var scrollHeight = this._getScrollHeight();
|
236
232
|
|
237
|
-
|
238
|
-
this.refresh();
|
239
|
-
}
|
233
|
+
var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
|
240
234
|
|
241
|
-
|
242
|
-
|
235
|
+
if (this._scrollHeight !== scrollHeight) {
|
236
|
+
this.refresh();
|
237
|
+
}
|
243
238
|
|
244
|
-
|
245
|
-
|
246
|
-
}
|
239
|
+
if (scrollTop >= maxScroll) {
|
240
|
+
var target = this._targets[this._targets.length - 1];
|
247
241
|
|
248
|
-
|
242
|
+
if (this._activeTarget !== target) {
|
243
|
+
this._activate(target);
|
249
244
|
}
|
250
245
|
|
251
|
-
|
252
|
-
|
246
|
+
return;
|
247
|
+
}
|
253
248
|
|
254
|
-
|
249
|
+
if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
|
250
|
+
this._activeTarget = null;
|
255
251
|
|
256
|
-
|
257
|
-
}
|
252
|
+
this._clear();
|
258
253
|
|
259
|
-
|
254
|
+
return;
|
255
|
+
}
|
260
256
|
|
261
|
-
|
262
|
-
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
|
257
|
+
var offsetLength = this._offsets.length;
|
263
258
|
|
264
|
-
|
265
|
-
|
266
|
-
}
|
267
|
-
}
|
268
|
-
};
|
259
|
+
for (var i = offsetLength; i--;) {
|
260
|
+
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
|
269
261
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
262
|
+
if (isActiveTarget) {
|
263
|
+
this._activate(this._targets[i]);
|
264
|
+
}
|
265
|
+
}
|
266
|
+
};
|
274
267
|
|
275
|
-
|
268
|
+
_proto._activate = function _activate(target) {
|
269
|
+
this._activeTarget = target;
|
276
270
|
|
271
|
+
this._clear();
|
277
272
|
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
var $link = $$$1([].slice.call(document.querySelectorAll(queries.join(','))));
|
273
|
+
var queries = this._selector.split(',').map(function (selector) {
|
274
|
+
return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
|
275
|
+
});
|
282
276
|
|
283
|
-
|
284
|
-
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
|
285
|
-
$link.addClass(ClassName.ACTIVE);
|
286
|
-
} else {
|
287
|
-
// Set triggered link as active
|
288
|
-
$link.addClass(ClassName.ACTIVE); // Set triggered links parents as active
|
289
|
-
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
277
|
+
var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
|
290
278
|
|
291
|
-
|
279
|
+
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
|
280
|
+
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
|
281
|
+
$link.addClass(ClassName.ACTIVE);
|
282
|
+
} else {
|
283
|
+
// Set triggered link as active
|
284
|
+
$link.addClass(ClassName.ACTIVE); // Set triggered links parents as active
|
285
|
+
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
292
286
|
|
293
|
-
|
294
|
-
}
|
287
|
+
$link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ", " + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE); // Handle special case when .nav-link is inside .nav-item
|
295
288
|
|
296
|
-
|
297
|
-
|
298
|
-
});
|
299
|
-
};
|
289
|
+
$link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).children(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
|
290
|
+
}
|
300
291
|
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
292
|
+
$(this._scrollElement).trigger(Event.ACTIVATE, {
|
293
|
+
relatedTarget: target
|
294
|
+
});
|
295
|
+
};
|
305
296
|
|
297
|
+
_proto._clear = function _clear() {
|
298
|
+
[].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
|
299
|
+
return node.classList.contains(ClassName.ACTIVE);
|
300
|
+
}).forEach(function (node) {
|
301
|
+
return node.classList.remove(ClassName.ACTIVE);
|
302
|
+
});
|
303
|
+
}; // Static
|
306
304
|
|
307
|
-
ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
|
308
|
-
return this.each(function () {
|
309
|
-
var data = $$$1(this).data(DATA_KEY);
|
310
305
|
|
311
|
-
|
306
|
+
ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
|
307
|
+
return this.each(function () {
|
308
|
+
var data = $(this).data(DATA_KEY);
|
312
309
|
|
313
|
-
|
314
|
-
data = new ScrollSpy(this, _config);
|
315
|
-
$$$1(this).data(DATA_KEY, data);
|
316
|
-
}
|
310
|
+
var _config = typeof config === 'object' && config;
|
317
311
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
312
|
+
if (!data) {
|
313
|
+
data = new ScrollSpy(this, _config);
|
314
|
+
$(this).data(DATA_KEY, data);
|
315
|
+
}
|
322
316
|
|
323
|
-
|
317
|
+
if (typeof config === 'string') {
|
318
|
+
if (typeof data[config] === 'undefined') {
|
319
|
+
throw new TypeError("No method named \"" + config + "\"");
|
324
320
|
}
|
325
|
-
});
|
326
|
-
};
|
327
321
|
|
328
|
-
|
329
|
-
key: "VERSION",
|
330
|
-
get: function get() {
|
331
|
-
return VERSION;
|
332
|
-
}
|
333
|
-
}, {
|
334
|
-
key: "Default",
|
335
|
-
get: function get() {
|
336
|
-
return Default;
|
322
|
+
data[config]();
|
337
323
|
}
|
338
|
-
}
|
324
|
+
});
|
325
|
+
};
|
339
326
|
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
327
|
+
_createClass(ScrollSpy, null, [{
|
328
|
+
key: "VERSION",
|
329
|
+
get: function get() {
|
330
|
+
return VERSION;
|
331
|
+
}
|
332
|
+
}, {
|
333
|
+
key: "Default",
|
334
|
+
get: function get() {
|
335
|
+
return Default;
|
336
|
+
}
|
337
|
+
}]);
|
347
338
|
|
339
|
+
return ScrollSpy;
|
340
|
+
}();
|
341
|
+
/**
|
342
|
+
* ------------------------------------------------------------------------
|
343
|
+
* Data Api implementation
|
344
|
+
* ------------------------------------------------------------------------
|
345
|
+
*/
|
348
346
|
|
349
|
-
$$$1(window).on(Event.LOAD_DATA_API, function () {
|
350
|
-
var scrollSpys = [].slice.call(document.querySelectorAll(Selector.DATA_SPY));
|
351
|
-
var scrollSpysLength = scrollSpys.length;
|
352
347
|
|
353
|
-
|
354
|
-
|
348
|
+
$(window).on(Event.LOAD_DATA_API, function () {
|
349
|
+
var scrollSpys = [].slice.call(document.querySelectorAll(Selector.DATA_SPY));
|
350
|
+
var scrollSpysLength = scrollSpys.length;
|
355
351
|
|
356
|
-
|
357
|
-
|
358
|
-
});
|
359
|
-
/**
|
360
|
-
* ------------------------------------------------------------------------
|
361
|
-
* jQuery
|
362
|
-
* ------------------------------------------------------------------------
|
363
|
-
*/
|
352
|
+
for (var i = scrollSpysLength; i--;) {
|
353
|
+
var $spy = $(scrollSpys[i]);
|
364
354
|
|
365
|
-
|
366
|
-
|
355
|
+
ScrollSpy._jQueryInterface.call($spy, $spy.data());
|
356
|
+
}
|
357
|
+
});
|
358
|
+
/**
|
359
|
+
* ------------------------------------------------------------------------
|
360
|
+
* jQuery
|
361
|
+
* ------------------------------------------------------------------------
|
362
|
+
*/
|
367
363
|
|
368
|
-
|
369
|
-
|
370
|
-
return ScrollSpy._jQueryInterface;
|
371
|
-
};
|
364
|
+
$.fn[NAME] = ScrollSpy._jQueryInterface;
|
365
|
+
$.fn[NAME].Constructor = ScrollSpy;
|
372
366
|
|
373
|
-
|
374
|
-
|
367
|
+
$.fn[NAME].noConflict = function () {
|
368
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
369
|
+
return ScrollSpy._jQueryInterface;
|
370
|
+
};
|
375
371
|
|
376
372
|
return ScrollSpy;
|
377
373
|
|