bootstrap 4.0.0.beta → 4.0.0.beta2
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/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/README.md +10 -43
- data/Rakefile +1 -1
- data/assets/javascripts/bootstrap-sprockets.js +5 -5
- data/assets/javascripts/bootstrap.js +1561 -1542
- data/assets/javascripts/bootstrap.min.js +6 -5
- data/assets/javascripts/bootstrap/alert.js +31 -38
- data/assets/javascripts/bootstrap/button.js +23 -30
- data/assets/javascripts/bootstrap/carousel.js +72 -81
- data/assets/javascripts/bootstrap/collapse.js +72 -68
- data/assets/javascripts/bootstrap/dropdown.js +97 -85
- data/assets/javascripts/bootstrap/modal.js +104 -101
- data/assets/javascripts/bootstrap/popover.js +55 -68
- data/assets/javascripts/bootstrap/scrollspy.js +63 -68
- data/assets/javascripts/bootstrap/tab.js +54 -49
- data/assets/javascripts/bootstrap/tooltip.js +102 -116
- data/assets/javascripts/bootstrap/util.js +20 -30
- data/assets/stylesheets/_bootstrap-grid.scss +7 -9
- data/assets/stylesheets/_bootstrap-reboot.scss +7 -4
- data/assets/stylesheets/_bootstrap.scss +2 -1
- data/assets/stylesheets/bootstrap/_alert.scss +4 -3
- data/assets/stylesheets/bootstrap/_badge.scss +1 -2
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +4 -4
- data/assets/stylesheets/bootstrap/_button-group.scss +33 -24
- data/assets/stylesheets/bootstrap/_buttons.scss +24 -29
- data/assets/stylesheets/bootstrap/_card.scss +58 -22
- data/assets/stylesheets/bootstrap/_carousel.scss +6 -0
- data/assets/stylesheets/bootstrap/_close.scss +2 -2
- data/assets/stylesheets/bootstrap/_custom-forms.scss +11 -8
- data/assets/stylesheets/bootstrap/_dropdown.scss +16 -41
- data/assets/stylesheets/bootstrap/_forms.scss +12 -44
- data/assets/stylesheets/bootstrap/_functions.scss +6 -10
- data/assets/stylesheets/bootstrap/_grid.scss +0 -1
- data/assets/stylesheets/bootstrap/_input-group.scss +17 -7
- data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
- data/assets/stylesheets/bootstrap/_modal.scss +12 -1
- data/assets/stylesheets/bootstrap/_nav.scss +5 -5
- data/assets/stylesheets/bootstrap/_navbar.scss +27 -5
- data/assets/stylesheets/bootstrap/_pagination.scss +2 -4
- data/assets/stylesheets/bootstrap/_popover.scss +16 -17
- data/assets/stylesheets/bootstrap/_print.scss +2 -3
- data/assets/stylesheets/bootstrap/_progress.scss +4 -6
- data/assets/stylesheets/bootstrap/_reboot.scss +39 -16
- data/assets/stylesheets/bootstrap/_root.scss +19 -0
- data/assets/stylesheets/bootstrap/_tables.scss +40 -28
- data/assets/stylesheets/bootstrap/_tooltip.scss +6 -6
- data/assets/stylesheets/bootstrap/_transitions.scss +2 -0
- data/assets/stylesheets/bootstrap/_type.scss +2 -0
- data/assets/stylesheets/bootstrap/_variables.scss +467 -476
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_badge.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +18 -4
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +27 -16
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +35 -0
- data/assets/stylesheets/bootstrap/mixins/_float.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +31 -4
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +14 -1
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +10 -5
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +13 -12
- data/assets/stylesheets/bootstrap/mixins/_image.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +0 -2
- data/assets/stylesheets/bootstrap/mixins/_navbar-align.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +1 -2
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_visibility.scss +2 -0
- data/assets/stylesheets/bootstrap/utilities/_align.scss +2 -0
- data/assets/stylesheets/bootstrap/utilities/_background.scss +16 -3
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +5 -3
- data/assets/stylesheets/bootstrap/utilities/_display.scss +3 -0
- data/assets/stylesheets/bootstrap/utilities/_flex.scss +2 -0
- data/assets/stylesheets/bootstrap/utilities/_position.scss +12 -1
- data/assets/stylesheets/bootstrap/utilities/_sizing.scss +2 -0
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +24 -14
- data/assets/stylesheets/bootstrap/utilities/_text.scss +7 -4
- data/bootstrap.gemspec +2 -3
- data/lib/bootstrap.rb +0 -16
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +31 -4
- data/tasks/updater/scss.rb +0 -12
- data/test/dummy_rails/config/application.rb +0 -1
- metadata +16 -27
- data/templates/project/_bootstrap-variables.scss +0 -834
- data/templates/project/manifest.rb +0 -18
- data/templates/project/styles.scss +0 -10
- data/test/compass_test.rb +0 -14
@@ -1,28 +1,23 @@
|
|
1
|
-
|
1
|
+
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); } }
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
6
4
|
|
7
5
|
/**
|
8
6
|
* --------------------------------------------------------------------------
|
9
|
-
* Bootstrap (v4.0.0-beta): modal.js
|
7
|
+
* Bootstrap (v4.0.0-beta.2): modal.js
|
10
8
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
11
9
|
* --------------------------------------------------------------------------
|
12
10
|
*/
|
13
|
-
|
14
|
-
var Modal = function ($) {
|
15
|
-
|
11
|
+
var Modal = function () {
|
16
12
|
/**
|
17
13
|
* ------------------------------------------------------------------------
|
18
14
|
* Constants
|
19
15
|
* ------------------------------------------------------------------------
|
20
16
|
*/
|
21
|
-
|
22
17
|
var NAME = 'modal';
|
23
|
-
var VERSION = '4.0.0-beta';
|
18
|
+
var VERSION = '4.0.0-beta.2';
|
24
19
|
var DATA_KEY = 'bs.modal';
|
25
|
-
var EVENT_KEY =
|
20
|
+
var EVENT_KEY = "." + DATA_KEY;
|
26
21
|
var DATA_API_KEY = '.data-api';
|
27
22
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
28
23
|
var TRANSITION_DURATION = 300;
|
@@ -35,28 +30,25 @@ var Modal = function ($) {
|
|
35
30
|
focus: true,
|
36
31
|
show: true
|
37
32
|
};
|
38
|
-
|
39
33
|
var DefaultType = {
|
40
34
|
backdrop: '(boolean|string)',
|
41
35
|
keyboard: 'boolean',
|
42
36
|
focus: 'boolean',
|
43
37
|
show: 'boolean'
|
44
38
|
};
|
45
|
-
|
46
39
|
var Event = {
|
47
|
-
HIDE:
|
48
|
-
HIDDEN:
|
49
|
-
SHOW:
|
50
|
-
SHOWN:
|
51
|
-
FOCUSIN:
|
52
|
-
RESIZE:
|
53
|
-
CLICK_DISMISS:
|
54
|
-
KEYDOWN_DISMISS:
|
55
|
-
MOUSEUP_DISMISS:
|
56
|
-
MOUSEDOWN_DISMISS:
|
57
|
-
CLICK_DATA_API:
|
40
|
+
HIDE: "hide" + EVENT_KEY,
|
41
|
+
HIDDEN: "hidden" + EVENT_KEY,
|
42
|
+
SHOW: "show" + EVENT_KEY,
|
43
|
+
SHOWN: "shown" + EVENT_KEY,
|
44
|
+
FOCUSIN: "focusin" + EVENT_KEY,
|
45
|
+
RESIZE: "resize" + EVENT_KEY,
|
46
|
+
CLICK_DISMISS: "click.dismiss" + EVENT_KEY,
|
47
|
+
KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY,
|
48
|
+
MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY,
|
49
|
+
MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY,
|
50
|
+
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
|
58
51
|
};
|
59
|
-
|
60
52
|
var ClassName = {
|
61
53
|
SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
|
62
54
|
BACKDROP: 'modal-backdrop',
|
@@ -64,14 +56,13 @@ var Modal = function ($) {
|
|
64
56
|
FADE: 'fade',
|
65
57
|
SHOW: 'show'
|
66
58
|
};
|
67
|
-
|
68
59
|
var Selector = {
|
69
60
|
DIALOG: '.modal-dialog',
|
70
61
|
DATA_TOGGLE: '[data-toggle="modal"]',
|
71
62
|
DATA_DISMISS: '[data-dismiss="modal"]',
|
72
63
|
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
|
64
|
+
STICKY_CONTENT: '.sticky-top',
|
73
65
|
NAVBAR_TOGGLER: '.navbar-toggler'
|
74
|
-
|
75
66
|
/**
|
76
67
|
* ------------------------------------------------------------------------
|
77
68
|
* Class Definition
|
@@ -79,10 +70,11 @@ var Modal = function ($) {
|
|
79
70
|
*/
|
80
71
|
|
81
72
|
};
|
82
|
-
var Modal = function () {
|
83
|
-
function Modal(element, config) {
|
84
|
-
_classCallCheck(this, Modal);
|
85
73
|
|
74
|
+
var Modal =
|
75
|
+
/*#__PURE__*/
|
76
|
+
function () {
|
77
|
+
function Modal(element, config) {
|
86
78
|
this._config = this._getConfig(config);
|
87
79
|
this._element = element;
|
88
80
|
this._dialog = $(element).find(Selector.DIALOG)[0];
|
@@ -92,20 +84,20 @@ var Modal = function ($) {
|
|
92
84
|
this._ignoreBackdropClick = false;
|
93
85
|
this._originalBodyPadding = 0;
|
94
86
|
this._scrollbarWidth = 0;
|
95
|
-
}
|
87
|
+
} // getters
|
96
88
|
|
97
|
-
// getters
|
98
89
|
|
99
|
-
|
90
|
+
var _proto = Modal.prototype;
|
100
91
|
|
101
|
-
|
92
|
+
// public
|
93
|
+
_proto.toggle = function toggle(relatedTarget) {
|
102
94
|
return this._isShown ? this.hide() : this.show(relatedTarget);
|
103
95
|
};
|
104
96
|
|
105
|
-
|
97
|
+
_proto.show = function show(relatedTarget) {
|
106
98
|
var _this = this;
|
107
99
|
|
108
|
-
if (this._isTransitioning) {
|
100
|
+
if (this._isTransitioning || this._isShown) {
|
109
101
|
return;
|
110
102
|
}
|
111
103
|
|
@@ -116,7 +108,6 @@ var Modal = function ($) {
|
|
116
108
|
var showEvent = $.Event(Event.SHOW, {
|
117
109
|
relatedTarget: relatedTarget
|
118
110
|
});
|
119
|
-
|
120
111
|
$(this._element).trigger(showEvent);
|
121
112
|
|
122
113
|
if (this._isShown || showEvent.isDefaultPrevented()) {
|
@@ -126,17 +117,20 @@ var Modal = function ($) {
|
|
126
117
|
this._isShown = true;
|
127
118
|
|
128
119
|
this._checkScrollbar();
|
120
|
+
|
129
121
|
this._setScrollbar();
|
130
122
|
|
123
|
+
this._adjustDialog();
|
124
|
+
|
131
125
|
$(document.body).addClass(ClassName.OPEN);
|
132
126
|
|
133
127
|
this._setEscapeEvent();
|
128
|
+
|
134
129
|
this._setResizeEvent();
|
135
130
|
|
136
131
|
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
|
137
132
|
return _this.hide(event);
|
138
133
|
});
|
139
|
-
|
140
134
|
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
|
141
135
|
$(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
|
142
136
|
if ($(event.target).is(_this._element)) {
|
@@ -150,7 +144,7 @@ var Modal = function ($) {
|
|
150
144
|
});
|
151
145
|
};
|
152
146
|
|
153
|
-
|
147
|
+
_proto.hide = function hide(event) {
|
154
148
|
var _this2 = this;
|
155
149
|
|
156
150
|
if (event) {
|
@@ -161,14 +155,7 @@ var Modal = function ($) {
|
|
161
155
|
return;
|
162
156
|
}
|
163
157
|
|
164
|
-
var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
|
165
|
-
|
166
|
-
if (transition) {
|
167
|
-
this._isTransitioning = true;
|
168
|
-
}
|
169
|
-
|
170
158
|
var hideEvent = $.Event(Event.HIDE);
|
171
|
-
|
172
159
|
$(this._element).trigger(hideEvent);
|
173
160
|
|
174
161
|
if (!this._isShown || hideEvent.isDefaultPrevented()) {
|
@@ -176,19 +163,22 @@ var Modal = function ($) {
|
|
176
163
|
}
|
177
164
|
|
178
165
|
this._isShown = false;
|
166
|
+
var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
|
167
|
+
|
168
|
+
if (transition) {
|
169
|
+
this._isTransitioning = true;
|
170
|
+
}
|
179
171
|
|
180
172
|
this._setEscapeEvent();
|
173
|
+
|
181
174
|
this._setResizeEvent();
|
182
175
|
|
183
176
|
$(document).off(Event.FOCUSIN);
|
184
|
-
|
185
177
|
$(this._element).removeClass(ClassName.SHOW);
|
186
|
-
|
187
178
|
$(this._element).off(Event.CLICK_DISMISS);
|
188
179
|
$(this._dialog).off(Event.MOUSEDOWN_DISMISS);
|
189
180
|
|
190
181
|
if (transition) {
|
191
|
-
|
192
182
|
$(this._element).one(Util.TRANSITION_END, function (event) {
|
193
183
|
return _this2._hideModal(event);
|
194
184
|
}).emulateTransitionEnd(TRANSITION_DURATION);
|
@@ -197,11 +187,9 @@ var Modal = function ($) {
|
|
197
187
|
}
|
198
188
|
};
|
199
189
|
|
200
|
-
|
190
|
+
_proto.dispose = function dispose() {
|
201
191
|
$.removeData(this._element, DATA_KEY);
|
202
|
-
|
203
192
|
$(window, document, this._element, this._backdrop).off(EVENT_KEY);
|
204
|
-
|
205
193
|
this._config = null;
|
206
194
|
this._element = null;
|
207
195
|
this._dialog = null;
|
@@ -212,19 +200,18 @@ var Modal = function ($) {
|
|
212
200
|
this._scrollbarWidth = null;
|
213
201
|
};
|
214
202
|
|
215
|
-
|
203
|
+
_proto.handleUpdate = function handleUpdate() {
|
216
204
|
this._adjustDialog();
|
217
|
-
};
|
205
|
+
}; // private
|
218
206
|
|
219
|
-
// private
|
220
207
|
|
221
|
-
|
208
|
+
_proto._getConfig = function _getConfig(config) {
|
222
209
|
config = $.extend({}, Default, config);
|
223
210
|
Util.typeCheckConfig(NAME, config, DefaultType);
|
224
211
|
return config;
|
225
212
|
};
|
226
213
|
|
227
|
-
|
214
|
+
_proto._showElement = function _showElement(relatedTarget) {
|
228
215
|
var _this3 = this;
|
229
216
|
|
230
217
|
var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
|
@@ -235,7 +222,9 @@ var Modal = function ($) {
|
|
235
222
|
}
|
236
223
|
|
237
224
|
this._element.style.display = 'block';
|
225
|
+
|
238
226
|
this._element.removeAttribute('aria-hidden');
|
227
|
+
|
239
228
|
this._element.scrollTop = 0;
|
240
229
|
|
241
230
|
if (transition) {
|
@@ -256,6 +245,7 @@ var Modal = function ($) {
|
|
256
245
|
if (_this3._config.focus) {
|
257
246
|
_this3._element.focus();
|
258
247
|
}
|
248
|
+
|
259
249
|
_this3._isTransitioning = false;
|
260
250
|
$(_this3._element).trigger(shownEvent);
|
261
251
|
};
|
@@ -267,7 +257,7 @@ var Modal = function ($) {
|
|
267
257
|
}
|
268
258
|
};
|
269
259
|
|
270
|
-
|
260
|
+
_proto._enforceFocus = function _enforceFocus() {
|
271
261
|
var _this4 = this;
|
272
262
|
|
273
263
|
$(document).off(Event.FOCUSIN) // guard against infinite focus loop
|
@@ -278,13 +268,14 @@ var Modal = function ($) {
|
|
278
268
|
});
|
279
269
|
};
|
280
270
|
|
281
|
-
|
271
|
+
_proto._setEscapeEvent = function _setEscapeEvent() {
|
282
272
|
var _this5 = this;
|
283
273
|
|
284
274
|
if (this._isShown && this._config.keyboard) {
|
285
275
|
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
|
286
276
|
if (event.which === ESCAPE_KEYCODE) {
|
287
277
|
event.preventDefault();
|
278
|
+
|
288
279
|
_this5.hide();
|
289
280
|
}
|
290
281
|
});
|
@@ -293,7 +284,7 @@ var Modal = function ($) {
|
|
293
284
|
}
|
294
285
|
};
|
295
286
|
|
296
|
-
|
287
|
+
_proto._setResizeEvent = function _setResizeEvent() {
|
297
288
|
var _this6 = this;
|
298
289
|
|
299
290
|
if (this._isShown) {
|
@@ -305,35 +296,40 @@ var Modal = function ($) {
|
|
305
296
|
}
|
306
297
|
};
|
307
298
|
|
308
|
-
|
299
|
+
_proto._hideModal = function _hideModal() {
|
309
300
|
var _this7 = this;
|
310
301
|
|
311
302
|
this._element.style.display = 'none';
|
303
|
+
|
312
304
|
this._element.setAttribute('aria-hidden', true);
|
305
|
+
|
313
306
|
this._isTransitioning = false;
|
307
|
+
|
314
308
|
this._showBackdrop(function () {
|
315
309
|
$(document.body).removeClass(ClassName.OPEN);
|
310
|
+
|
316
311
|
_this7._resetAdjustments();
|
312
|
+
|
317
313
|
_this7._resetScrollbar();
|
314
|
+
|
318
315
|
$(_this7._element).trigger(Event.HIDDEN);
|
319
316
|
});
|
320
317
|
};
|
321
318
|
|
322
|
-
|
319
|
+
_proto._removeBackdrop = function _removeBackdrop() {
|
323
320
|
if (this._backdrop) {
|
324
321
|
$(this._backdrop).remove();
|
325
322
|
this._backdrop = null;
|
326
323
|
}
|
327
324
|
};
|
328
325
|
|
329
|
-
|
326
|
+
_proto._showBackdrop = function _showBackdrop(callback) {
|
330
327
|
var _this8 = this;
|
331
328
|
|
332
329
|
var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
|
333
330
|
|
334
331
|
if (this._isShown && this._config.backdrop) {
|
335
332
|
var doAnimate = Util.supportsTransitionEnd() && animate;
|
336
|
-
|
337
333
|
this._backdrop = document.createElement('div');
|
338
334
|
this._backdrop.className = ClassName.BACKDROP;
|
339
335
|
|
@@ -342,15 +338,16 @@ var Modal = function ($) {
|
|
342
338
|
}
|
343
339
|
|
344
340
|
$(this._backdrop).appendTo(document.body);
|
345
|
-
|
346
341
|
$(this._element).on(Event.CLICK_DISMISS, function (event) {
|
347
342
|
if (_this8._ignoreBackdropClick) {
|
348
343
|
_this8._ignoreBackdropClick = false;
|
349
344
|
return;
|
350
345
|
}
|
346
|
+
|
351
347
|
if (event.target !== event.currentTarget) {
|
352
348
|
return;
|
353
349
|
}
|
350
|
+
|
354
351
|
if (_this8._config.backdrop === 'static') {
|
355
352
|
_this8._element.focus();
|
356
353
|
} else {
|
@@ -379,6 +376,7 @@ var Modal = function ($) {
|
|
379
376
|
|
380
377
|
var callbackRemove = function callbackRemove() {
|
381
378
|
_this8._removeBackdrop();
|
379
|
+
|
382
380
|
if (callback) {
|
383
381
|
callback();
|
384
382
|
}
|
@@ -392,88 +390,92 @@ var Modal = function ($) {
|
|
392
390
|
} else if (callback) {
|
393
391
|
callback();
|
394
392
|
}
|
395
|
-
};
|
396
|
-
|
397
|
-
// ----------------------------------------------------------------------
|
393
|
+
}; // ----------------------------------------------------------------------
|
398
394
|
// the following methods are used to handle overflowing modals
|
399
395
|
// todo (fat): these should probably be refactored out of modal.js
|
400
396
|
// ----------------------------------------------------------------------
|
401
397
|
|
402
|
-
|
398
|
+
|
399
|
+
_proto._adjustDialog = function _adjustDialog() {
|
403
400
|
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
404
401
|
|
405
402
|
if (!this._isBodyOverflowing && isModalOverflowing) {
|
406
|
-
this._element.style.paddingLeft = this._scrollbarWidth +
|
403
|
+
this._element.style.paddingLeft = this._scrollbarWidth + "px";
|
407
404
|
}
|
408
405
|
|
409
406
|
if (this._isBodyOverflowing && !isModalOverflowing) {
|
410
|
-
this._element.style.paddingRight = this._scrollbarWidth +
|
407
|
+
this._element.style.paddingRight = this._scrollbarWidth + "px";
|
411
408
|
}
|
412
409
|
};
|
413
410
|
|
414
|
-
|
411
|
+
_proto._resetAdjustments = function _resetAdjustments() {
|
415
412
|
this._element.style.paddingLeft = '';
|
416
413
|
this._element.style.paddingRight = '';
|
417
414
|
};
|
418
415
|
|
419
|
-
|
420
|
-
|
416
|
+
_proto._checkScrollbar = function _checkScrollbar() {
|
417
|
+
var rect = document.body.getBoundingClientRect();
|
418
|
+
this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
|
421
419
|
this._scrollbarWidth = this._getScrollbarWidth();
|
422
420
|
};
|
423
421
|
|
424
|
-
|
422
|
+
_proto._setScrollbar = function _setScrollbar() {
|
425
423
|
var _this9 = this;
|
426
424
|
|
427
425
|
if (this._isBodyOverflowing) {
|
428
426
|
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
|
429
427
|
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
|
430
|
-
|
431
428
|
// Adjust fixed content padding
|
432
429
|
$(Selector.FIXED_CONTENT).each(function (index, element) {
|
433
430
|
var actualPadding = $(element)[0].style.paddingRight;
|
434
431
|
var calculatedPadding = $(element).css('padding-right');
|
435
|
-
$(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth +
|
436
|
-
});
|
432
|
+
$(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
|
433
|
+
}); // Adjust sticky content margin
|
434
|
+
|
435
|
+
$(Selector.STICKY_CONTENT).each(function (index, element) {
|
436
|
+
var actualMargin = $(element)[0].style.marginRight;
|
437
|
+
var calculatedMargin = $(element).css('margin-right');
|
438
|
+
$(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
|
439
|
+
}); // Adjust navbar-toggler margin
|
437
440
|
|
438
|
-
// Adjust navbar-toggler margin
|
439
441
|
$(Selector.NAVBAR_TOGGLER).each(function (index, element) {
|
440
442
|
var actualMargin = $(element)[0].style.marginRight;
|
441
443
|
var calculatedMargin = $(element).css('margin-right');
|
442
|
-
$(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth +
|
443
|
-
});
|
444
|
+
$(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this9._scrollbarWidth + "px");
|
445
|
+
}); // Adjust body padding
|
444
446
|
|
445
|
-
// Adjust body padding
|
446
447
|
var actualPadding = document.body.style.paddingRight;
|
447
448
|
var calculatedPadding = $('body').css('padding-right');
|
448
|
-
$('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth +
|
449
|
+
$('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
|
449
450
|
}
|
450
451
|
};
|
451
452
|
|
452
|
-
|
453
|
+
_proto._resetScrollbar = function _resetScrollbar() {
|
453
454
|
// Restore fixed content padding
|
454
455
|
$(Selector.FIXED_CONTENT).each(function (index, element) {
|
455
456
|
var padding = $(element).data('padding-right');
|
457
|
+
|
456
458
|
if (typeof padding !== 'undefined') {
|
457
459
|
$(element).css('padding-right', padding).removeData('padding-right');
|
458
460
|
}
|
459
|
-
});
|
461
|
+
}); // Restore sticky content and navbar-toggler margin
|
460
462
|
|
461
|
-
|
462
|
-
$(Selector.NAVBAR_TOGGLER).each(function (index, element) {
|
463
|
+
$(Selector.STICKY_CONTENT + ", " + Selector.NAVBAR_TOGGLER).each(function (index, element) {
|
463
464
|
var margin = $(element).data('margin-right');
|
465
|
+
|
464
466
|
if (typeof margin !== 'undefined') {
|
465
467
|
$(element).css('margin-right', margin).removeData('margin-right');
|
466
468
|
}
|
467
|
-
});
|
469
|
+
}); // Restore body padding
|
468
470
|
|
469
|
-
// Restore body padding
|
470
471
|
var padding = $('body').data('padding-right');
|
472
|
+
|
471
473
|
if (typeof padding !== 'undefined') {
|
472
474
|
$('body').css('padding-right', padding).removeData('padding-right');
|
473
475
|
}
|
474
476
|
};
|
475
477
|
|
476
|
-
|
478
|
+
_proto._getScrollbarWidth = function _getScrollbarWidth() {
|
477
479
|
// thx d.walsh
|
478
480
|
var scrollDiv = document.createElement('div');
|
479
481
|
scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
|
@@ -481,14 +483,14 @@ var Modal = function ($) {
|
|
481
483
|
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
|
482
484
|
document.body.removeChild(scrollDiv);
|
483
485
|
return scrollbarWidth;
|
484
|
-
};
|
486
|
+
}; // static
|
485
487
|
|
486
|
-
// static
|
487
488
|
|
488
489
|
Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
|
489
490
|
return this.each(function () {
|
490
491
|
var data = $(this).data(DATA_KEY);
|
491
|
-
|
492
|
+
|
493
|
+
var _config = $.extend({}, Modal.Default, $(this).data(), typeof config === 'object' && config);
|
492
494
|
|
493
495
|
if (!data) {
|
494
496
|
data = new Modal(this, _config);
|
@@ -496,9 +498,10 @@ var Modal = function ($) {
|
|
496
498
|
}
|
497
499
|
|
498
500
|
if (typeof config === 'string') {
|
499
|
-
if (data[config] === undefined) {
|
500
|
-
throw new Error(
|
501
|
+
if (typeof data[config] === 'undefined') {
|
502
|
+
throw new Error("No method named \"" + config + "\"");
|
501
503
|
}
|
504
|
+
|
502
505
|
data[config](relatedTarget);
|
503
506
|
} else if (_config.show) {
|
504
507
|
data.show(relatedTarget);
|
@@ -507,12 +510,12 @@ var Modal = function ($) {
|
|
507
510
|
};
|
508
511
|
|
509
512
|
_createClass(Modal, null, [{
|
510
|
-
key:
|
513
|
+
key: "VERSION",
|
511
514
|
get: function get() {
|
512
515
|
return VERSION;
|
513
516
|
}
|
514
517
|
}, {
|
515
|
-
key:
|
518
|
+
key: "Default",
|
516
519
|
get: function get() {
|
517
520
|
return Default;
|
518
521
|
}
|
@@ -520,17 +523,17 @@ var Modal = function ($) {
|
|
520
523
|
|
521
524
|
return Modal;
|
522
525
|
}();
|
523
|
-
|
524
526
|
/**
|
525
527
|
* ------------------------------------------------------------------------
|
526
528
|
* Data Api implementation
|
527
529
|
* ------------------------------------------------------------------------
|
528
530
|
*/
|
529
531
|
|
532
|
+
|
530
533
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
531
534
|
var _this10 = this;
|
532
535
|
|
533
|
-
var target
|
536
|
+
var target;
|
534
537
|
var selector = Util.getSelectorFromElement(this);
|
535
538
|
|
536
539
|
if (selector) {
|
@@ -558,7 +561,6 @@ var Modal = function ($) {
|
|
558
561
|
|
559
562
|
Modal._jQueryInterface.call($(target), config, this);
|
560
563
|
});
|
561
|
-
|
562
564
|
/**
|
563
565
|
* ------------------------------------------------------------------------
|
564
566
|
* jQuery
|
@@ -567,10 +569,11 @@ var Modal = function ($) {
|
|
567
569
|
|
568
570
|
$.fn[NAME] = Modal._jQueryInterface;
|
569
571
|
$.fn[NAME].Constructor = Modal;
|
572
|
+
|
570
573
|
$.fn[NAME].noConflict = function () {
|
571
574
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
572
575
|
return Modal._jQueryInterface;
|
573
576
|
};
|
574
577
|
|
575
578
|
return Modal;
|
576
|
-
}(
|
579
|
+
}($);
|