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 collapse.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,372 +63,364 @@
|
|
58
63
|
}
|
59
64
|
|
60
65
|
/**
|
61
|
-
*
|
62
|
-
*
|
63
|
-
*
|
64
|
-
* --------------------------------------------------------------------------
|
66
|
+
* ------------------------------------------------------------------------
|
67
|
+
* Constants
|
68
|
+
* ------------------------------------------------------------------------
|
65
69
|
*/
|
66
70
|
|
67
|
-
var
|
71
|
+
var NAME = 'collapse';
|
72
|
+
var VERSION = '4.2.1';
|
73
|
+
var DATA_KEY = 'bs.collapse';
|
74
|
+
var EVENT_KEY = "." + DATA_KEY;
|
75
|
+
var DATA_API_KEY = '.data-api';
|
76
|
+
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
77
|
+
var Default = {
|
78
|
+
toggle: true,
|
79
|
+
parent: ''
|
80
|
+
};
|
81
|
+
var DefaultType = {
|
82
|
+
toggle: 'boolean',
|
83
|
+
parent: '(string|element)'
|
84
|
+
};
|
85
|
+
var Event = {
|
86
|
+
SHOW: "show" + EVENT_KEY,
|
87
|
+
SHOWN: "shown" + EVENT_KEY,
|
88
|
+
HIDE: "hide" + EVENT_KEY,
|
89
|
+
HIDDEN: "hidden" + EVENT_KEY,
|
90
|
+
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
|
91
|
+
};
|
92
|
+
var ClassName = {
|
93
|
+
SHOW: 'show',
|
94
|
+
COLLAPSE: 'collapse',
|
95
|
+
COLLAPSING: 'collapsing',
|
96
|
+
COLLAPSED: 'collapsed'
|
97
|
+
};
|
98
|
+
var Dimension = {
|
99
|
+
WIDTH: 'width',
|
100
|
+
HEIGHT: 'height'
|
101
|
+
};
|
102
|
+
var Selector = {
|
103
|
+
ACTIVES: '.show, .collapsing',
|
104
|
+
DATA_TOGGLE: '[data-toggle="collapse"]'
|
68
105
|
/**
|
69
106
|
* ------------------------------------------------------------------------
|
70
|
-
*
|
107
|
+
* Class Definition
|
71
108
|
* ------------------------------------------------------------------------
|
72
109
|
*/
|
73
|
-
var NAME = 'collapse';
|
74
|
-
var VERSION = '4.1.3';
|
75
|
-
var DATA_KEY = 'bs.collapse';
|
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
|
-
toggle: true,
|
81
|
-
parent: ''
|
82
|
-
};
|
83
|
-
var DefaultType = {
|
84
|
-
toggle: 'boolean',
|
85
|
-
parent: '(string|element)'
|
86
|
-
};
|
87
|
-
var Event = {
|
88
|
-
SHOW: "show" + EVENT_KEY,
|
89
|
-
SHOWN: "shown" + EVENT_KEY,
|
90
|
-
HIDE: "hide" + EVENT_KEY,
|
91
|
-
HIDDEN: "hidden" + EVENT_KEY,
|
92
|
-
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
|
93
|
-
};
|
94
|
-
var ClassName = {
|
95
|
-
SHOW: 'show',
|
96
|
-
COLLAPSE: 'collapse',
|
97
|
-
COLLAPSING: 'collapsing',
|
98
|
-
COLLAPSED: 'collapsed'
|
99
|
-
};
|
100
|
-
var Dimension = {
|
101
|
-
WIDTH: 'width',
|
102
|
-
HEIGHT: 'height'
|
103
|
-
};
|
104
|
-
var Selector = {
|
105
|
-
ACTIVES: '.show, .collapsing',
|
106
|
-
DATA_TOGGLE: '[data-toggle="collapse"]'
|
107
|
-
/**
|
108
|
-
* ------------------------------------------------------------------------
|
109
|
-
* Class Definition
|
110
|
-
* ------------------------------------------------------------------------
|
111
|
-
*/
|
112
110
|
|
113
|
-
|
111
|
+
};
|
112
|
+
|
113
|
+
var Collapse =
|
114
|
+
/*#__PURE__*/
|
115
|
+
function () {
|
116
|
+
function Collapse(element, config) {
|
117
|
+
this._isTransitioning = false;
|
118
|
+
this._element = element;
|
119
|
+
this._config = this._getConfig(config);
|
120
|
+
this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
|
121
|
+
var toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
|
122
|
+
|
123
|
+
for (var i = 0, len = toggleList.length; i < len; i++) {
|
124
|
+
var elem = toggleList[i];
|
125
|
+
var selector = Util.getSelectorFromElement(elem);
|
126
|
+
var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
|
127
|
+
return foundElem === element;
|
128
|
+
});
|
114
129
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
this._isTransitioning = false;
|
120
|
-
this._element = element;
|
121
|
-
this._config = this._getConfig(config);
|
122
|
-
this._triggerArray = $$$1.makeArray(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
|
123
|
-
var toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
|
124
|
-
|
125
|
-
for (var i = 0, len = toggleList.length; i < len; i++) {
|
126
|
-
var elem = toggleList[i];
|
127
|
-
var selector = Util.getSelectorFromElement(elem);
|
128
|
-
var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
|
129
|
-
return foundElem === element;
|
130
|
-
});
|
131
|
-
|
132
|
-
if (selector !== null && filterElement.length > 0) {
|
133
|
-
this._selector = selector;
|
134
|
-
|
135
|
-
this._triggerArray.push(elem);
|
136
|
-
}
|
130
|
+
if (selector !== null && filterElement.length > 0) {
|
131
|
+
this._selector = selector;
|
132
|
+
|
133
|
+
this._triggerArray.push(elem);
|
137
134
|
}
|
135
|
+
}
|
138
136
|
|
139
|
-
|
137
|
+
this._parent = this._config.parent ? this._getParent() : null;
|
140
138
|
|
141
|
-
|
142
|
-
|
143
|
-
|
139
|
+
if (!this._config.parent) {
|
140
|
+
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
141
|
+
}
|
144
142
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
143
|
+
if (this._config.toggle) {
|
144
|
+
this.toggle();
|
145
|
+
}
|
146
|
+
} // Getters
|
149
147
|
|
150
148
|
|
151
|
-
|
149
|
+
var _proto = Collapse.prototype;
|
152
150
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
151
|
+
// Public
|
152
|
+
_proto.toggle = function toggle() {
|
153
|
+
if ($(this._element).hasClass(ClassName.SHOW)) {
|
154
|
+
this.hide();
|
155
|
+
} else {
|
156
|
+
this.show();
|
157
|
+
}
|
158
|
+
};
|
161
159
|
|
162
|
-
|
163
|
-
|
160
|
+
_proto.show = function show() {
|
161
|
+
var _this = this;
|
164
162
|
|
165
|
-
|
166
|
-
|
167
|
-
|
163
|
+
if (this._isTransitioning || $(this._element).hasClass(ClassName.SHOW)) {
|
164
|
+
return;
|
165
|
+
}
|
168
166
|
|
169
|
-
|
170
|
-
|
167
|
+
var actives;
|
168
|
+
var activesData;
|
171
169
|
|
172
|
-
|
173
|
-
|
170
|
+
if (this._parent) {
|
171
|
+
actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES)).filter(function (elem) {
|
172
|
+
if (typeof _this._config.parent === 'string') {
|
174
173
|
return elem.getAttribute('data-parent') === _this._config.parent;
|
175
|
-
});
|
176
|
-
|
177
|
-
if (actives.length === 0) {
|
178
|
-
actives = null;
|
179
174
|
}
|
180
|
-
}
|
181
175
|
|
182
|
-
|
183
|
-
|
176
|
+
return elem.classList.contains(ClassName.COLLAPSE);
|
177
|
+
});
|
184
178
|
|
185
|
-
|
186
|
-
|
187
|
-
}
|
179
|
+
if (actives.length === 0) {
|
180
|
+
actives = null;
|
188
181
|
}
|
182
|
+
}
|
189
183
|
|
190
|
-
|
191
|
-
|
184
|
+
if (actives) {
|
185
|
+
activesData = $(actives).not(this._selector).data(DATA_KEY);
|
192
186
|
|
193
|
-
if (
|
187
|
+
if (activesData && activesData._isTransitioning) {
|
194
188
|
return;
|
195
189
|
}
|
190
|
+
}
|
196
191
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
if (!activesData) {
|
201
|
-
$$$1(actives).data(DATA_KEY, null);
|
202
|
-
}
|
203
|
-
}
|
192
|
+
var startEvent = $.Event(Event.SHOW);
|
193
|
+
$(this._element).trigger(startEvent);
|
204
194
|
|
205
|
-
|
195
|
+
if (startEvent.isDefaultPrevented()) {
|
196
|
+
return;
|
197
|
+
}
|
206
198
|
|
207
|
-
|
208
|
-
this.
|
199
|
+
if (actives) {
|
200
|
+
Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
|
209
201
|
|
210
|
-
if (
|
211
|
-
|
202
|
+
if (!activesData) {
|
203
|
+
$(actives).data(DATA_KEY, null);
|
212
204
|
}
|
205
|
+
}
|
206
|
+
|
207
|
+
var dimension = this._getDimension();
|
208
|
+
|
209
|
+
$(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
|
210
|
+
this._element.style[dimension] = 0;
|
213
211
|
|
214
|
-
|
212
|
+
if (this._triggerArray.length) {
|
213
|
+
$(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
|
214
|
+
}
|
215
215
|
|
216
|
-
|
217
|
-
$$$1(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
|
218
|
-
_this._element.style[dimension] = '';
|
216
|
+
this.setTransitioning(true);
|
219
217
|
|
220
|
-
|
218
|
+
var complete = function complete() {
|
219
|
+
$(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
|
220
|
+
_this._element.style[dimension] = '';
|
221
221
|
|
222
|
-
|
223
|
-
};
|
222
|
+
_this.setTransitioning(false);
|
224
223
|
|
225
|
-
|
226
|
-
var scrollSize = "scroll" + capitalizedDimension;
|
227
|
-
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
228
|
-
$$$1(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
229
|
-
this._element.style[dimension] = this._element[scrollSize] + "px";
|
224
|
+
$(_this._element).trigger(Event.SHOWN);
|
230
225
|
};
|
231
226
|
|
232
|
-
|
233
|
-
|
227
|
+
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
228
|
+
var scrollSize = "scroll" + capitalizedDimension;
|
229
|
+
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
230
|
+
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
231
|
+
this._element.style[dimension] = this._element[scrollSize] + "px";
|
232
|
+
};
|
234
233
|
|
235
|
-
|
236
|
-
|
237
|
-
}
|
234
|
+
_proto.hide = function hide() {
|
235
|
+
var _this2 = this;
|
238
236
|
|
239
|
-
|
240
|
-
|
237
|
+
if (this._isTransitioning || !$(this._element).hasClass(ClassName.SHOW)) {
|
238
|
+
return;
|
239
|
+
}
|
241
240
|
|
242
|
-
|
243
|
-
|
244
|
-
|
241
|
+
var startEvent = $.Event(Event.HIDE);
|
242
|
+
$(this._element).trigger(startEvent);
|
243
|
+
|
244
|
+
if (startEvent.isDefaultPrevented()) {
|
245
|
+
return;
|
246
|
+
}
|
245
247
|
|
246
|
-
|
248
|
+
var dimension = this._getDimension();
|
247
249
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
250
|
+
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
|
251
|
+
Util.reflow(this._element);
|
252
|
+
$(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
|
253
|
+
var triggerArrayLength = this._triggerArray.length;
|
252
254
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
255
|
+
if (triggerArrayLength > 0) {
|
256
|
+
for (var i = 0; i < triggerArrayLength; i++) {
|
257
|
+
var trigger = this._triggerArray[i];
|
258
|
+
var selector = Util.getSelectorFromElement(trigger);
|
257
259
|
|
258
|
-
|
259
|
-
|
260
|
+
if (selector !== null) {
|
261
|
+
var $elem = $([].slice.call(document.querySelectorAll(selector)));
|
260
262
|
|
261
|
-
|
262
|
-
|
263
|
-
}
|
263
|
+
if (!$elem.hasClass(ClassName.SHOW)) {
|
264
|
+
$(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
|
264
265
|
}
|
265
266
|
}
|
266
267
|
}
|
268
|
+
}
|
267
269
|
|
268
|
-
|
269
|
-
|
270
|
-
var complete = function complete() {
|
271
|
-
_this2.setTransitioning(false);
|
270
|
+
this.setTransitioning(true);
|
272
271
|
|
273
|
-
|
274
|
-
|
272
|
+
var complete = function complete() {
|
273
|
+
_this2.setTransitioning(false);
|
275
274
|
|
276
|
-
|
277
|
-
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
278
|
-
$$$1(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
275
|
+
$(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
|
279
276
|
};
|
280
277
|
|
281
|
-
|
282
|
-
|
283
|
-
|
278
|
+
this._element.style[dimension] = '';
|
279
|
+
var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
280
|
+
$(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
281
|
+
};
|
284
282
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
this._parent = null;
|
289
|
-
this._element = null;
|
290
|
-
this._triggerArray = null;
|
291
|
-
this._isTransitioning = null;
|
292
|
-
}; // Private
|
283
|
+
_proto.setTransitioning = function setTransitioning(isTransitioning) {
|
284
|
+
this._isTransitioning = isTransitioning;
|
285
|
+
};
|
293
286
|
|
287
|
+
_proto.dispose = function dispose() {
|
288
|
+
$.removeData(this._element, DATA_KEY);
|
289
|
+
this._config = null;
|
290
|
+
this._parent = null;
|
291
|
+
this._element = null;
|
292
|
+
this._triggerArray = null;
|
293
|
+
this._isTransitioning = null;
|
294
|
+
}; // Private
|
294
295
|
|
295
|
-
_proto._getConfig = function _getConfig(config) {
|
296
|
-
config = _objectSpread({}, Default, config);
|
297
|
-
config.toggle = Boolean(config.toggle); // Coerce string values
|
298
296
|
|
299
|
-
|
300
|
-
|
301
|
-
|
297
|
+
_proto._getConfig = function _getConfig(config) {
|
298
|
+
config = _objectSpread({}, Default, config);
|
299
|
+
config.toggle = Boolean(config.toggle); // Coerce string values
|
302
300
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
};
|
301
|
+
Util.typeCheckConfig(NAME, config, DefaultType);
|
302
|
+
return config;
|
303
|
+
};
|
307
304
|
|
308
|
-
|
309
|
-
|
305
|
+
_proto._getDimension = function _getDimension() {
|
306
|
+
var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
|
307
|
+
return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
|
308
|
+
};
|
310
309
|
|
311
|
-
|
310
|
+
_proto._getParent = function _getParent() {
|
311
|
+
var _this3 = this;
|
312
312
|
|
313
|
-
|
314
|
-
parent = this._config.parent; // It's a jQuery object
|
313
|
+
var parent;
|
315
314
|
|
316
|
-
|
317
|
-
|
318
|
-
}
|
319
|
-
} else {
|
320
|
-
parent = document.querySelector(this._config.parent);
|
321
|
-
}
|
315
|
+
if (Util.isElement(this._config.parent)) {
|
316
|
+
parent = this._config.parent; // It's a jQuery object
|
322
317
|
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
};
|
318
|
+
if (typeof this._config.parent.jquery !== 'undefined') {
|
319
|
+
parent = this._config.parent[0];
|
320
|
+
}
|
321
|
+
} else {
|
322
|
+
parent = document.querySelector(this._config.parent);
|
323
|
+
}
|
330
324
|
|
331
|
-
|
332
|
-
|
333
|
-
|
325
|
+
var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
|
326
|
+
var children = [].slice.call(parent.querySelectorAll(selector));
|
327
|
+
$(children).each(function (i, element) {
|
328
|
+
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
|
329
|
+
});
|
330
|
+
return parent;
|
331
|
+
};
|
334
332
|
|
335
|
-
|
336
|
-
|
337
|
-
}
|
338
|
-
}
|
339
|
-
}; // Static
|
333
|
+
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
|
334
|
+
var isOpen = $(element).hasClass(ClassName.SHOW);
|
340
335
|
|
336
|
+
if (triggerArray.length) {
|
337
|
+
$(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
|
338
|
+
}
|
339
|
+
}; // Static
|
341
340
|
|
342
|
-
Collapse._getTargetFromElement = function _getTargetFromElement(element) {
|
343
|
-
var selector = Util.getSelectorFromElement(element);
|
344
|
-
return selector ? document.querySelector(selector) : null;
|
345
|
-
};
|
346
341
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
342
|
+
Collapse._getTargetFromElement = function _getTargetFromElement(element) {
|
343
|
+
var selector = Util.getSelectorFromElement(element);
|
344
|
+
return selector ? document.querySelector(selector) : null;
|
345
|
+
};
|
351
346
|
|
352
|
-
|
347
|
+
Collapse._jQueryInterface = function _jQueryInterface(config) {
|
348
|
+
return this.each(function () {
|
349
|
+
var $this = $(this);
|
350
|
+
var data = $this.data(DATA_KEY);
|
353
351
|
|
354
|
-
|
355
|
-
_config.toggle = false;
|
356
|
-
}
|
352
|
+
var _config = _objectSpread({}, Default, $this.data(), typeof config === 'object' && config ? config : {});
|
357
353
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
}
|
354
|
+
if (!data && _config.toggle && /show|hide/.test(config)) {
|
355
|
+
_config.toggle = false;
|
356
|
+
}
|
362
357
|
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
358
|
+
if (!data) {
|
359
|
+
data = new Collapse(this, _config);
|
360
|
+
$this.data(DATA_KEY, data);
|
361
|
+
}
|
367
362
|
|
368
|
-
|
363
|
+
if (typeof config === 'string') {
|
364
|
+
if (typeof data[config] === 'undefined') {
|
365
|
+
throw new TypeError("No method named \"" + config + "\"");
|
369
366
|
}
|
370
|
-
});
|
371
|
-
};
|
372
367
|
|
373
|
-
|
374
|
-
key: "VERSION",
|
375
|
-
get: function get() {
|
376
|
-
return VERSION;
|
377
|
-
}
|
378
|
-
}, {
|
379
|
-
key: "Default",
|
380
|
-
get: function get() {
|
381
|
-
return Default;
|
368
|
+
data[config]();
|
382
369
|
}
|
383
|
-
}
|
370
|
+
});
|
371
|
+
};
|
384
372
|
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
373
|
+
_createClass(Collapse, null, [{
|
374
|
+
key: "VERSION",
|
375
|
+
get: function get() {
|
376
|
+
return VERSION;
|
377
|
+
}
|
378
|
+
}, {
|
379
|
+
key: "Default",
|
380
|
+
get: function get() {
|
381
|
+
return Default;
|
382
|
+
}
|
383
|
+
}]);
|
392
384
|
|
385
|
+
return Collapse;
|
386
|
+
}();
|
387
|
+
/**
|
388
|
+
* ------------------------------------------------------------------------
|
389
|
+
* Data Api implementation
|
390
|
+
* ------------------------------------------------------------------------
|
391
|
+
*/
|
393
392
|
|
394
|
-
$$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
395
|
-
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
|
396
|
-
if (event.currentTarget.tagName === 'A') {
|
397
|
-
event.preventDefault();
|
398
|
-
}
|
399
393
|
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
var data = $target.data(DATA_KEY);
|
406
|
-
var config = data ? 'toggle' : $trigger.data();
|
394
|
+
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
395
|
+
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
|
396
|
+
if (event.currentTarget.tagName === 'A') {
|
397
|
+
event.preventDefault();
|
398
|
+
}
|
407
399
|
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
*/
|
400
|
+
var $trigger = $(this);
|
401
|
+
var selector = Util.getSelectorFromElement(this);
|
402
|
+
var selectors = [].slice.call(document.querySelectorAll(selector));
|
403
|
+
$(selectors).each(function () {
|
404
|
+
var $target = $(this);
|
405
|
+
var data = $target.data(DATA_KEY);
|
406
|
+
var config = data ? 'toggle' : $trigger.data();
|
416
407
|
|
417
|
-
|
418
|
-
|
408
|
+
Collapse._jQueryInterface.call($target, config);
|
409
|
+
});
|
410
|
+
});
|
411
|
+
/**
|
412
|
+
* ------------------------------------------------------------------------
|
413
|
+
* jQuery
|
414
|
+
* ------------------------------------------------------------------------
|
415
|
+
*/
|
419
416
|
|
420
|
-
|
421
|
-
|
422
|
-
return Collapse._jQueryInterface;
|
423
|
-
};
|
417
|
+
$.fn[NAME] = Collapse._jQueryInterface;
|
418
|
+
$.fn[NAME].Constructor = Collapse;
|
424
419
|
|
425
|
-
|
426
|
-
|
420
|
+
$.fn[NAME].noConflict = function () {
|
421
|
+
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
422
|
+
return Collapse._jQueryInterface;
|
423
|
+
};
|
427
424
|
|
428
425
|
return Collapse;
|
429
426
|
|