bootstrap 5.0.0.beta2 → 5.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/assets/javascripts/bootstrap-sprockets.js +1 -0
- data/assets/javascripts/bootstrap.js +2051 -2009
- data/assets/javascripts/bootstrap.min.js +2 -2
- data/assets/javascripts/bootstrap/alert.js +75 -118
- data/assets/javascripts/bootstrap/base-component.js +23 -37
- data/assets/javascripts/bootstrap/button.js +39 -78
- data/assets/javascripts/bootstrap/carousel.js +284 -364
- data/assets/javascripts/bootstrap/collapse.js +178 -247
- data/assets/javascripts/bootstrap/dom/data.js +34 -47
- data/assets/javascripts/bootstrap/dom/event-handler.js +71 -77
- data/assets/javascripts/bootstrap/dom/manipulator.js +23 -21
- data/assets/javascripts/bootstrap/dom/selector-engine.js +20 -28
- data/assets/javascripts/bootstrap/dropdown.js +195 -265
- data/assets/javascripts/bootstrap/modal.js +256 -344
- data/assets/javascripts/bootstrap/offcanvas.js +508 -0
- data/assets/javascripts/bootstrap/popover.js +88 -157
- data/assets/javascripts/bootstrap/scrollspy.js +134 -212
- data/assets/javascripts/bootstrap/tab.js +108 -142
- data/assets/javascripts/bootstrap/toast.js +113 -183
- data/assets/javascripts/bootstrap/tooltip.js +297 -392
- data/assets/stylesheets/_bootstrap-grid.scss +1 -1
- data/assets/stylesheets/_bootstrap-reboot.scss +1 -1
- data/assets/stylesheets/_bootstrap.scss +2 -1
- data/assets/stylesheets/bootstrap/_accordion.scss +22 -32
- data/assets/stylesheets/bootstrap/_buttons.scss +2 -0
- data/assets/stylesheets/bootstrap/_card.scss +1 -1
- data/assets/stylesheets/bootstrap/_dropdown.scss +3 -6
- data/assets/stylesheets/bootstrap/_list-group.scss +11 -0
- data/assets/stylesheets/bootstrap/_modal.scss +2 -0
- data/assets/stylesheets/bootstrap/_nav.scss +7 -0
- data/assets/stylesheets/bootstrap/_navbar.scss +2 -0
- data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
- data/assets/stylesheets/bootstrap/_progress.scss +3 -0
- data/assets/stylesheets/bootstrap/_reboot.scss +7 -21
- data/assets/stylesheets/bootstrap/_spinners.scss +4 -0
- data/assets/stylesheets/bootstrap/_transitions.scss +2 -0
- data/assets/stylesheets/bootstrap/_utilities.scss +65 -37
- data/assets/stylesheets/bootstrap/_variables.scss +138 -30
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +0 -4
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +6 -1
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +11 -1
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +2 -0
- data/bootstrap.gemspec +1 -1
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +1 -1
- data/tasks/updater/network.rb +7 -1
- metadata +6 -4
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap collapse.js v5.0.0-
|
2
|
+
* Bootstrap collapse.js v5.0.0-beta3 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 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
|
*/
|
@@ -17,78 +17,28 @@
|
|
17
17
|
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
18
18
|
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
19
19
|
|
20
|
-
function _defineProperties(target, props) {
|
21
|
-
for (var i = 0; i < props.length; i++) {
|
22
|
-
var descriptor = props[i];
|
23
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
24
|
-
descriptor.configurable = true;
|
25
|
-
if ("value" in descriptor) descriptor.writable = true;
|
26
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
31
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
32
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
33
|
-
return Constructor;
|
34
|
-
}
|
35
|
-
|
36
|
-
function _extends() {
|
37
|
-
_extends = Object.assign || function (target) {
|
38
|
-
for (var i = 1; i < arguments.length; i++) {
|
39
|
-
var source = arguments[i];
|
40
|
-
|
41
|
-
for (var key in source) {
|
42
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
43
|
-
target[key] = source[key];
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
return target;
|
49
|
-
};
|
50
|
-
|
51
|
-
return _extends.apply(this, arguments);
|
52
|
-
}
|
53
|
-
|
54
|
-
function _inheritsLoose(subClass, superClass) {
|
55
|
-
subClass.prototype = Object.create(superClass.prototype);
|
56
|
-
subClass.prototype.constructor = subClass;
|
57
|
-
|
58
|
-
_setPrototypeOf(subClass, superClass);
|
59
|
-
}
|
60
|
-
|
61
|
-
function _setPrototypeOf(o, p) {
|
62
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
63
|
-
o.__proto__ = p;
|
64
|
-
return o;
|
65
|
-
};
|
66
|
-
|
67
|
-
return _setPrototypeOf(o, p);
|
68
|
-
}
|
69
|
-
|
70
20
|
/**
|
71
21
|
* --------------------------------------------------------------------------
|
72
|
-
* Bootstrap (v5.0.0-
|
22
|
+
* Bootstrap (v5.0.0-beta3): util/index.js
|
73
23
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
74
24
|
* --------------------------------------------------------------------------
|
75
25
|
*/
|
76
|
-
|
77
|
-
|
26
|
+
const MILLISECONDS_MULTIPLIER = 1000;
|
27
|
+
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
78
28
|
|
79
|
-
|
29
|
+
const toType = obj => {
|
80
30
|
if (obj === null || obj === undefined) {
|
81
|
-
return
|
31
|
+
return `${obj}`;
|
82
32
|
}
|
83
33
|
|
84
34
|
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
85
35
|
};
|
86
36
|
|
87
|
-
|
88
|
-
|
37
|
+
const getSelector = element => {
|
38
|
+
let selector = element.getAttribute('data-bs-target');
|
89
39
|
|
90
40
|
if (!selector || selector === '#') {
|
91
|
-
|
41
|
+
let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
92
42
|
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
93
43
|
// `document.querySelector` will rightfully complain it is invalid.
|
94
44
|
// See https://github.com/twbs/bootstrap/issues/32273
|
@@ -108,8 +58,8 @@
|
|
108
58
|
return selector;
|
109
59
|
};
|
110
60
|
|
111
|
-
|
112
|
-
|
61
|
+
const getSelectorFromElement = element => {
|
62
|
+
const selector = getSelector(element);
|
113
63
|
|
114
64
|
if (selector) {
|
115
65
|
return document.querySelector(selector) ? selector : null;
|
@@ -118,23 +68,23 @@
|
|
118
68
|
return null;
|
119
69
|
};
|
120
70
|
|
121
|
-
|
122
|
-
|
71
|
+
const getElementFromSelector = element => {
|
72
|
+
const selector = getSelector(element);
|
123
73
|
return selector ? document.querySelector(selector) : null;
|
124
74
|
};
|
125
75
|
|
126
|
-
|
76
|
+
const getTransitionDurationFromElement = element => {
|
127
77
|
if (!element) {
|
128
78
|
return 0;
|
129
79
|
} // Get transition-duration of the element
|
130
80
|
|
131
81
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
82
|
+
let {
|
83
|
+
transitionDuration,
|
84
|
+
transitionDelay
|
85
|
+
} = window.getComputedStyle(element);
|
86
|
+
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
87
|
+
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
138
88
|
|
139
89
|
if (!floatTransitionDuration && !floatTransitionDelay) {
|
140
90
|
return 0;
|
@@ -146,18 +96,16 @@
|
|
146
96
|
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
147
97
|
};
|
148
98
|
|
149
|
-
|
99
|
+
const triggerTransitionEnd = element => {
|
150
100
|
element.dispatchEvent(new Event(TRANSITION_END));
|
151
101
|
};
|
152
102
|
|
153
|
-
|
154
|
-
return (obj[0] || obj).nodeType;
|
155
|
-
};
|
103
|
+
const isElement = obj => (obj[0] || obj).nodeType;
|
156
104
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
105
|
+
const emulateTransitionEnd = (element, duration) => {
|
106
|
+
let called = false;
|
107
|
+
const durationPadding = 5;
|
108
|
+
const emulatedDuration = duration + durationPadding;
|
161
109
|
|
162
110
|
function listener() {
|
163
111
|
called = true;
|
@@ -165,32 +113,31 @@
|
|
165
113
|
}
|
166
114
|
|
167
115
|
element.addEventListener(TRANSITION_END, listener);
|
168
|
-
setTimeout(
|
116
|
+
setTimeout(() => {
|
169
117
|
if (!called) {
|
170
118
|
triggerTransitionEnd(element);
|
171
119
|
}
|
172
120
|
}, emulatedDuration);
|
173
121
|
};
|
174
122
|
|
175
|
-
|
176
|
-
Object.keys(configTypes).forEach(
|
177
|
-
|
178
|
-
|
179
|
-
|
123
|
+
const typeCheckConfig = (componentName, config, configTypes) => {
|
124
|
+
Object.keys(configTypes).forEach(property => {
|
125
|
+
const expectedTypes = configTypes[property];
|
126
|
+
const value = config[property];
|
127
|
+
const valueType = value && isElement(value) ? 'element' : toType(value);
|
180
128
|
|
181
129
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
182
|
-
throw new TypeError(componentName.toUpperCase()
|
130
|
+
throw new TypeError(`${componentName.toUpperCase()}: ` + `Option "${property}" provided type "${valueType}" ` + `but expected type "${expectedTypes}".`);
|
183
131
|
}
|
184
132
|
});
|
185
133
|
};
|
186
134
|
|
187
|
-
|
188
|
-
return element.offsetHeight;
|
189
|
-
};
|
135
|
+
const reflow = element => element.offsetHeight;
|
190
136
|
|
191
|
-
|
192
|
-
|
193
|
-
|
137
|
+
const getjQuery = () => {
|
138
|
+
const {
|
139
|
+
jQuery
|
140
|
+
} = window;
|
194
141
|
|
195
142
|
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
196
143
|
return jQuery;
|
@@ -199,7 +146,7 @@
|
|
199
146
|
return null;
|
200
147
|
};
|
201
148
|
|
202
|
-
|
149
|
+
const onDOMContentLoaded = callback => {
|
203
150
|
if (document.readyState === 'loading') {
|
204
151
|
document.addEventListener('DOMContentLoaded', callback);
|
205
152
|
} else {
|
@@ -207,19 +154,17 @@
|
|
207
154
|
}
|
208
155
|
};
|
209
156
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
onDOMContentLoaded(function () {
|
214
|
-
var $ = getjQuery();
|
157
|
+
const defineJQueryPlugin = (name, plugin) => {
|
158
|
+
onDOMContentLoaded(() => {
|
159
|
+
const $ = getjQuery();
|
215
160
|
/* istanbul ignore if */
|
216
161
|
|
217
162
|
if ($) {
|
218
|
-
|
163
|
+
const JQUERY_NO_CONFLICT = $.fn[name];
|
219
164
|
$.fn[name] = plugin.jQueryInterface;
|
220
165
|
$.fn[name].Constructor = plugin;
|
221
166
|
|
222
|
-
$.fn[name].noConflict =
|
167
|
+
$.fn[name].noConflict = () => {
|
223
168
|
$.fn[name] = JQUERY_NO_CONFLICT;
|
224
169
|
return plugin.jQueryInterface;
|
225
170
|
};
|
@@ -227,108 +172,110 @@
|
|
227
172
|
});
|
228
173
|
};
|
229
174
|
|
175
|
+
/**
|
176
|
+
* --------------------------------------------------------------------------
|
177
|
+
* Bootstrap (v5.0.0-beta3): collapse.js
|
178
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
179
|
+
* --------------------------------------------------------------------------
|
180
|
+
*/
|
230
181
|
/**
|
231
182
|
* ------------------------------------------------------------------------
|
232
183
|
* Constants
|
233
184
|
* ------------------------------------------------------------------------
|
234
185
|
*/
|
235
186
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
187
|
+
const NAME = 'collapse';
|
188
|
+
const DATA_KEY = 'bs.collapse';
|
189
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
190
|
+
const DATA_API_KEY = '.data-api';
|
191
|
+
const Default = {
|
241
192
|
toggle: true,
|
242
193
|
parent: ''
|
243
194
|
};
|
244
|
-
|
195
|
+
const DefaultType = {
|
245
196
|
toggle: 'boolean',
|
246
197
|
parent: '(string|element)'
|
247
198
|
};
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
199
|
+
const EVENT_SHOW = `show${EVENT_KEY}`;
|
200
|
+
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
201
|
+
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
202
|
+
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
203
|
+
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
204
|
+
const CLASS_NAME_SHOW = 'show';
|
205
|
+
const CLASS_NAME_COLLAPSE = 'collapse';
|
206
|
+
const CLASS_NAME_COLLAPSING = 'collapsing';
|
207
|
+
const CLASS_NAME_COLLAPSED = 'collapsed';
|
208
|
+
const WIDTH = 'width';
|
209
|
+
const HEIGHT = 'height';
|
210
|
+
const SELECTOR_ACTIVES = '.show, .collapsing';
|
211
|
+
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]';
|
261
212
|
/**
|
262
213
|
* ------------------------------------------------------------------------
|
263
214
|
* Class Definition
|
264
215
|
* ------------------------------------------------------------------------
|
265
216
|
*/
|
266
217
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
218
|
+
class Collapse extends BaseComponent__default['default'] {
|
219
|
+
constructor(element, config) {
|
220
|
+
super(element);
|
221
|
+
this._isTransitioning = false;
|
222
|
+
this._config = this._getConfig(config);
|
223
|
+
this._triggerArray = SelectorEngine__default['default'].find(`${SELECTOR_DATA_TOGGLE}[href="#${this._element.id}"],` + `${SELECTOR_DATA_TOGGLE}[data-bs-target="#${this._element.id}"]`);
|
224
|
+
const toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
|
272
225
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
var toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
|
278
|
-
|
279
|
-
for (var i = 0, len = toggleList.length; i < len; i++) {
|
280
|
-
var elem = toggleList[i];
|
281
|
-
var selector = getSelectorFromElement(elem);
|
282
|
-
var filterElement = SelectorEngine__default['default'].find(selector).filter(function (foundElem) {
|
283
|
-
return foundElem === element;
|
284
|
-
});
|
226
|
+
for (let i = 0, len = toggleList.length; i < len; i++) {
|
227
|
+
const elem = toggleList[i];
|
228
|
+
const selector = getSelectorFromElement(elem);
|
229
|
+
const filterElement = SelectorEngine__default['default'].find(selector).filter(foundElem => foundElem === this._element);
|
285
230
|
|
286
231
|
if (selector !== null && filterElement.length) {
|
287
|
-
|
232
|
+
this._selector = selector;
|
288
233
|
|
289
|
-
|
234
|
+
this._triggerArray.push(elem);
|
290
235
|
}
|
291
236
|
}
|
292
237
|
|
293
|
-
|
238
|
+
this._parent = this._config.parent ? this._getParent() : null;
|
294
239
|
|
295
|
-
if (!
|
296
|
-
|
240
|
+
if (!this._config.parent) {
|
241
|
+
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
297
242
|
}
|
298
243
|
|
299
|
-
if (
|
300
|
-
|
244
|
+
if (this._config.toggle) {
|
245
|
+
this.toggle();
|
301
246
|
}
|
302
|
-
|
303
|
-
return _this;
|
304
247
|
} // Getters
|
305
248
|
|
306
249
|
|
307
|
-
|
250
|
+
static get Default() {
|
251
|
+
return Default;
|
252
|
+
}
|
253
|
+
|
254
|
+
static get DATA_KEY() {
|
255
|
+
return DATA_KEY;
|
256
|
+
} // Public
|
257
|
+
|
308
258
|
|
309
|
-
|
310
|
-
_proto.toggle = function toggle() {
|
259
|
+
toggle() {
|
311
260
|
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
312
261
|
this.hide();
|
313
262
|
} else {
|
314
263
|
this.show();
|
315
264
|
}
|
316
|
-
}
|
317
|
-
|
318
|
-
_proto.show = function show() {
|
319
|
-
var _this2 = this;
|
265
|
+
}
|
320
266
|
|
267
|
+
show() {
|
321
268
|
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
|
322
269
|
return;
|
323
270
|
}
|
324
271
|
|
325
|
-
|
326
|
-
|
272
|
+
let actives;
|
273
|
+
let activesData;
|
327
274
|
|
328
275
|
if (this._parent) {
|
329
|
-
actives = SelectorEngine__default['default'].find(SELECTOR_ACTIVES, this._parent).filter(
|
330
|
-
if (typeof
|
331
|
-
return elem.getAttribute('data-bs-parent') ===
|
276
|
+
actives = SelectorEngine__default['default'].find(SELECTOR_ACTIVES, this._parent).filter(elem => {
|
277
|
+
if (typeof this._config.parent === 'string') {
|
278
|
+
return elem.getAttribute('data-bs-parent') === this._config.parent;
|
332
279
|
}
|
333
280
|
|
334
281
|
return elem.classList.contains(CLASS_NAME_COLLAPSE);
|
@@ -339,38 +286,36 @@
|
|
339
286
|
}
|
340
287
|
}
|
341
288
|
|
342
|
-
|
289
|
+
const container = SelectorEngine__default['default'].findOne(this._selector);
|
343
290
|
|
344
291
|
if (actives) {
|
345
|
-
|
346
|
-
|
347
|
-
});
|
348
|
-
activesData = tempActiveData ? Data__default['default'].getData(tempActiveData, DATA_KEY) : null;
|
292
|
+
const tempActiveData = actives.find(elem => container !== elem);
|
293
|
+
activesData = tempActiveData ? Data__default['default'].get(tempActiveData, DATA_KEY) : null;
|
349
294
|
|
350
295
|
if (activesData && activesData._isTransitioning) {
|
351
296
|
return;
|
352
297
|
}
|
353
298
|
}
|
354
299
|
|
355
|
-
|
300
|
+
const startEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
|
356
301
|
|
357
302
|
if (startEvent.defaultPrevented) {
|
358
303
|
return;
|
359
304
|
}
|
360
305
|
|
361
306
|
if (actives) {
|
362
|
-
actives.forEach(
|
307
|
+
actives.forEach(elemActive => {
|
363
308
|
if (container !== elemActive) {
|
364
309
|
Collapse.collapseInterface(elemActive, 'hide');
|
365
310
|
}
|
366
311
|
|
367
312
|
if (!activesData) {
|
368
|
-
Data__default['default'].
|
313
|
+
Data__default['default'].set(elemActive, DATA_KEY, null);
|
369
314
|
}
|
370
315
|
});
|
371
316
|
}
|
372
317
|
|
373
|
-
|
318
|
+
const dimension = this._getDimension();
|
374
319
|
|
375
320
|
this._element.classList.remove(CLASS_NAME_COLLAPSE);
|
376
321
|
|
@@ -379,7 +324,7 @@
|
|
379
324
|
this._element.style[dimension] = 0;
|
380
325
|
|
381
326
|
if (this._triggerArray.length) {
|
382
|
-
this._triggerArray.forEach(
|
327
|
+
this._triggerArray.forEach(element => {
|
383
328
|
element.classList.remove(CLASS_NAME_COLLAPSED);
|
384
329
|
element.setAttribute('aria-expanded', true);
|
385
330
|
});
|
@@ -387,54 +332,50 @@
|
|
387
332
|
|
388
333
|
this.setTransitioning(true);
|
389
334
|
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
_this2._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
335
|
+
const complete = () => {
|
336
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
394
337
|
|
395
|
-
|
338
|
+
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
396
339
|
|
397
|
-
|
398
|
-
|
399
|
-
EventHandler__default['default'].trigger(
|
340
|
+
this._element.style[dimension] = '';
|
341
|
+
this.setTransitioning(false);
|
342
|
+
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN);
|
400
343
|
};
|
401
344
|
|
402
|
-
|
403
|
-
|
404
|
-
|
345
|
+
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
346
|
+
const scrollSize = `scroll${capitalizedDimension}`;
|
347
|
+
const transitionDuration = getTransitionDurationFromElement(this._element);
|
405
348
|
EventHandler__default['default'].one(this._element, 'transitionend', complete);
|
406
349
|
emulateTransitionEnd(this._element, transitionDuration);
|
407
|
-
this._element.style[dimension] = this._element[scrollSize]
|
408
|
-
}
|
409
|
-
|
410
|
-
_proto.hide = function hide() {
|
411
|
-
var _this3 = this;
|
350
|
+
this._element.style[dimension] = `${this._element[scrollSize]}px`;
|
351
|
+
}
|
412
352
|
|
353
|
+
hide() {
|
413
354
|
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
|
414
355
|
return;
|
415
356
|
}
|
416
357
|
|
417
|
-
|
358
|
+
const startEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
|
418
359
|
|
419
360
|
if (startEvent.defaultPrevented) {
|
420
361
|
return;
|
421
362
|
}
|
422
363
|
|
423
|
-
|
364
|
+
const dimension = this._getDimension();
|
424
365
|
|
425
|
-
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension]
|
366
|
+
this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
|
426
367
|
reflow(this._element);
|
427
368
|
|
428
369
|
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
429
370
|
|
430
371
|
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
431
372
|
|
432
|
-
|
373
|
+
const triggerArrayLength = this._triggerArray.length;
|
433
374
|
|
434
375
|
if (triggerArrayLength > 0) {
|
435
|
-
for (
|
436
|
-
|
437
|
-
|
376
|
+
for (let i = 0; i < triggerArrayLength; i++) {
|
377
|
+
const trigger = this._triggerArray[i];
|
378
|
+
const elem = getElementFromSelector(trigger);
|
438
379
|
|
439
380
|
if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
|
440
381
|
trigger.classList.add(CLASS_NAME_COLLAPSED);
|
@@ -445,52 +386,53 @@
|
|
445
386
|
|
446
387
|
this.setTransitioning(true);
|
447
388
|
|
448
|
-
|
449
|
-
|
389
|
+
const complete = () => {
|
390
|
+
this.setTransitioning(false);
|
450
391
|
|
451
|
-
|
392
|
+
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
452
393
|
|
453
|
-
|
394
|
+
this._element.classList.add(CLASS_NAME_COLLAPSE);
|
454
395
|
|
455
|
-
EventHandler__default['default'].trigger(
|
396
|
+
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
|
456
397
|
};
|
457
398
|
|
458
399
|
this._element.style[dimension] = '';
|
459
|
-
|
400
|
+
const transitionDuration = getTransitionDurationFromElement(this._element);
|
460
401
|
EventHandler__default['default'].one(this._element, 'transitionend', complete);
|
461
402
|
emulateTransitionEnd(this._element, transitionDuration);
|
462
|
-
}
|
403
|
+
}
|
463
404
|
|
464
|
-
|
405
|
+
setTransitioning(isTransitioning) {
|
465
406
|
this._isTransitioning = isTransitioning;
|
466
|
-
}
|
467
|
-
|
468
|
-
_proto.dispose = function dispose() {
|
469
|
-
_BaseComponent.prototype.dispose.call(this);
|
407
|
+
}
|
470
408
|
|
409
|
+
dispose() {
|
410
|
+
super.dispose();
|
471
411
|
this._config = null;
|
472
412
|
this._parent = null;
|
473
413
|
this._triggerArray = null;
|
474
414
|
this._isTransitioning = null;
|
475
415
|
} // Private
|
476
|
-
;
|
477
416
|
|
478
|
-
|
479
|
-
|
417
|
+
|
418
|
+
_getConfig(config) {
|
419
|
+
config = { ...Default,
|
420
|
+
...config
|
421
|
+
};
|
480
422
|
config.toggle = Boolean(config.toggle); // Coerce string values
|
481
423
|
|
482
424
|
typeCheckConfig(NAME, config, DefaultType);
|
483
425
|
return config;
|
484
|
-
}
|
426
|
+
}
|
485
427
|
|
486
|
-
|
428
|
+
_getDimension() {
|
487
429
|
return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
|
488
|
-
}
|
489
|
-
|
490
|
-
_proto._getParent = function _getParent() {
|
491
|
-
var _this4 = this;
|
430
|
+
}
|
492
431
|
|
493
|
-
|
432
|
+
_getParent() {
|
433
|
+
let {
|
434
|
+
parent
|
435
|
+
} = this._config;
|
494
436
|
|
495
437
|
if (isElement(parent)) {
|
496
438
|
// it's a jQuery object
|
@@ -501,22 +443,22 @@
|
|
501
443
|
parent = SelectorEngine__default['default'].findOne(parent);
|
502
444
|
}
|
503
445
|
|
504
|
-
|
505
|
-
SelectorEngine__default['default'].find(selector, parent).forEach(
|
506
|
-
|
446
|
+
const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`;
|
447
|
+
SelectorEngine__default['default'].find(selector, parent).forEach(element => {
|
448
|
+
const selected = getElementFromSelector(element);
|
507
449
|
|
508
|
-
|
450
|
+
this._addAriaAndCollapsedClass(selected, [element]);
|
509
451
|
});
|
510
452
|
return parent;
|
511
|
-
}
|
453
|
+
}
|
512
454
|
|
513
|
-
|
455
|
+
_addAriaAndCollapsedClass(element, triggerArray) {
|
514
456
|
if (!element || !triggerArray.length) {
|
515
457
|
return;
|
516
458
|
}
|
517
459
|
|
518
|
-
|
519
|
-
triggerArray.forEach(
|
460
|
+
const isOpen = element.classList.contains(CLASS_NAME_SHOW);
|
461
|
+
triggerArray.forEach(elem => {
|
520
462
|
if (isOpen) {
|
521
463
|
elem.classList.remove(CLASS_NAME_COLLAPSED);
|
522
464
|
} else {
|
@@ -526,12 +468,14 @@
|
|
526
468
|
elem.setAttribute('aria-expanded', isOpen);
|
527
469
|
});
|
528
470
|
} // Static
|
529
|
-
;
|
530
471
|
|
531
|
-
Collapse.collapseInterface = function collapseInterface(element, config) {
|
532
|
-
var data = Data__default['default'].getData(element, DATA_KEY);
|
533
472
|
|
534
|
-
|
473
|
+
static collapseInterface(element, config) {
|
474
|
+
let data = Data__default['default'].get(element, DATA_KEY);
|
475
|
+
const _config = { ...Default,
|
476
|
+
...Manipulator__default['default'].getDataAttributes(element),
|
477
|
+
...(typeof config === 'object' && config ? config : {})
|
478
|
+
};
|
535
479
|
|
536
480
|
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
|
537
481
|
_config.toggle = false;
|
@@ -543,33 +487,20 @@
|
|
543
487
|
|
544
488
|
if (typeof config === 'string') {
|
545
489
|
if (typeof data[config] === 'undefined') {
|
546
|
-
throw new TypeError(
|
490
|
+
throw new TypeError(`No method named "${config}"`);
|
547
491
|
}
|
548
492
|
|
549
493
|
data[config]();
|
550
494
|
}
|
551
|
-
}
|
495
|
+
}
|
552
496
|
|
553
|
-
|
497
|
+
static jQueryInterface(config) {
|
554
498
|
return this.each(function () {
|
555
499
|
Collapse.collapseInterface(this, config);
|
556
500
|
});
|
557
|
-
}
|
558
|
-
|
559
|
-
_createClass(Collapse, null, [{
|
560
|
-
key: "Default",
|
561
|
-
get: function get() {
|
562
|
-
return Default;
|
563
|
-
}
|
564
|
-
}, {
|
565
|
-
key: "DATA_KEY",
|
566
|
-
get: function get() {
|
567
|
-
return DATA_KEY;
|
568
|
-
}
|
569
|
-
}]);
|
501
|
+
}
|
570
502
|
|
571
|
-
|
572
|
-
}(BaseComponent__default['default']);
|
503
|
+
}
|
573
504
|
/**
|
574
505
|
* ------------------------------------------------------------------------
|
575
506
|
* Data Api implementation
|
@@ -583,12 +514,12 @@
|
|
583
514
|
event.preventDefault();
|
584
515
|
}
|
585
516
|
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
selectorElements.forEach(
|
590
|
-
|
591
|
-
|
517
|
+
const triggerData = Manipulator__default['default'].getDataAttributes(this);
|
518
|
+
const selector = getSelectorFromElement(this);
|
519
|
+
const selectorElements = SelectorEngine__default['default'].find(selector);
|
520
|
+
selectorElements.forEach(element => {
|
521
|
+
const data = Data__default['default'].get(element, DATA_KEY);
|
522
|
+
let config;
|
592
523
|
|
593
524
|
if (data) {
|
594
525
|
// update parent attribute
|