1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-30 00:29:52 +02:00

fix modal

This commit is contained in:
Jacob Thornton
2015-08-12 21:12:03 -07:00
parent 9bdb6d13f6
commit 11abb0f7e9
38 changed files with 1750 additions and 4019 deletions

File diff suppressed because it is too large Load Diff

29
dist/js/umd/alert.js vendored
View File

@@ -51,7 +51,7 @@
var Event = {
CLOSE: 'close' + EVENT_KEY,
CLOSED: 'closed' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
@@ -73,6 +73,14 @@
this._element = element;
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Alert, [{
key: 'close',
@@ -96,11 +104,11 @@
$.removeData(this._element, DATA_KEY);
this._element = null;
}
}, {
key: '_getRootElement',
// private
}, {
key: '_getRootElement',
value: function _getRootElement(element) {
var parent = false;
var selector = _Util['default'].getSelectorFromElement(element);
@@ -139,11 +147,11 @@
value: function _destroyElement(element) {
$(element).detach().trigger(Event.CLOSED).remove();
}
}], [{
key: '_jQueryInterface',
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
@@ -172,10 +180,7 @@
}
}, {
key: 'VERSION',
// getters
get: function () {
get: function get() {
return VERSION;
}
}]);
@@ -183,12 +188,6 @@
return Alert;
})();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
/**

27
dist/js/umd/button.js vendored
View File

@@ -55,8 +55,8 @@
};
var Event = {
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY,
FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + '' + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + '' + DATA_API_KEY)
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + DATA_API_KEY)
};
/**
@@ -72,6 +72,14 @@
this._element = element;
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Button, [{
key: 'toggle',
@@ -116,11 +124,11 @@
$.removeData(this._element, DATA_KEY);
this._element = null;
}
}], [{
key: '_jQueryInterface',
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
@@ -137,10 +145,7 @@
}
}, {
key: 'VERSION',
// getters
get: function () {
get: function get() {
return VERSION;
}
}]);
@@ -148,12 +153,6 @@
return Button;
})();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
event.preventDefault();

View File

@@ -71,8 +71,8 @@
KEYDOWN: 'keydown' + EVENT_KEY,
MOUSEENTER: 'mouseenter' + EVENT_KEY,
MOUSELEAVE: 'mouseleave' + EVENT_KEY,
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
@@ -118,6 +118,14 @@
this._addEventListeners();
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Carousel, [{
key: 'next',
@@ -211,11 +219,11 @@
this._activeElement = null;
this._indicatorsElement = null;
}
}, {
key: '_getConfig',
// private
}, {
key: '_getConfig',
value: function _getConfig(config) {
config = $.extend({}, Default, config);
_Util['default'].typeCheckConfig(NAME, config, DefaultType);
@@ -371,11 +379,11 @@
this.cycle();
}
}
}], [{
key: '_jQueryInterface',
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
@@ -434,15 +442,12 @@
}
}, {
key: 'VERSION',
// getters
get: function () {
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function () {
get: function get() {
return Default;
}
}]);
@@ -450,12 +455,6 @@
return Carousel;
})();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
$(window).on(Event.LOAD_DATA_API, function () {

View File

@@ -59,7 +59,7 @@
SHOWN: 'shown' + EVENT_KEY,
HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
@@ -105,6 +105,14 @@
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Collapse, [{
key: 'toggle',
@@ -251,11 +259,11 @@
this._triggerArray = null;
this._isTransitioning = null;
}
}, {
key: '_getConfig',
// private
}, {
key: '_getConfig',
value: function _getConfig(config) {
config = $.extend({}, Default, config);
config.toggle = !!config.toggle; // coerce string values
@@ -294,11 +302,11 @@
}
}
}
}], [{
key: '_getTargetFromElement',
// static
}], [{
key: '_getTargetFromElement',
value: function _getTargetFromElement(element) {
var selector = _Util['default'].getSelectorFromElement(element);
return selector ? $(selector)[0] : null;
@@ -327,15 +335,12 @@
}
}, {
key: 'VERSION',
// getters
get: function () {
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function () {
get: function get() {
return Default;
}
}]);
@@ -343,12 +348,6 @@
return Collapse;
})();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault();

View File

@@ -49,8 +49,8 @@
SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY,
CLICK: 'click' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY,
KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + '' + DATA_API_KEY
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
@@ -84,6 +84,14 @@
this._addEventListeners();
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Dropdown, [{
key: 'toggle',
@@ -136,19 +144,19 @@
$(this._element).off(EVENT_KEY);
this._element = null;
}
}, {
key: '_addEventListeners',
// private
}, {
key: '_addEventListeners',
value: function _addEventListeners() {
$(this._element).on(Event.CLICK, this.toggle);
}
}], [{
key: '_jQueryInterface',
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
@@ -259,10 +267,7 @@
}
}, {
key: 'VERSION',
// getters
get: function () {
get: function get() {
return VERSION;
}
}]);
@@ -270,12 +275,6 @@
return Dropdown;
})();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
e.stopPropagation();
});

37
dist/js/umd/modal.js vendored
View File

@@ -70,7 +70,7 @@
KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
@@ -108,6 +108,14 @@
this._scrollbarWidth = 0;
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Modal, [{
key: 'toggle',
@@ -207,11 +215,11 @@
this._originalBodyPadding = null;
this._scrollbarWidth = null;
}
}, {
key: '_getConfig',
// private
}, {
key: '_getConfig',
value: function _getConfig(config) {
config = $.extend({}, Default, config);
_Util['default'].typeCheckConfig(NAME, config, DefaultType);
@@ -329,7 +337,7 @@
$(this._backdrop).addClass(animate);
}
$(this._backdrop).appendTo(this.$body);
$(this._backdrop).appendTo(document.body);
$(this._element).on(Event.CLICK_DISMISS, function (event) {
if (_this6._ignoreBackdropClick) {
@@ -381,14 +389,14 @@
callback();
}
}
}, {
key: '_handleUpdate',
// ----------------------------------------------------------------------
// the following methods are used to handle overflowing modals
// todo (fat): these should probably be refactored out of modal.js
// ----------------------------------------------------------------------
}, {
key: '_handleUpdate',
value: function _handleUpdate() {
this._adjustDialog();
}
@@ -450,11 +458,11 @@
document.body.removeChild(scrollDiv);
return scrollbarWidth;
}
}], [{
key: '_jQueryInterface',
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config, relatedTarget) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
@@ -474,15 +482,12 @@
}
}, {
key: 'VERSION',
// getters
get: function () {
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function () {
get: function get() {
return Default;
}
}]);
@@ -490,12 +495,6 @@
return Modal;
})();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
var _this7 = this;

View File

@@ -15,11 +15,13 @@
var _createClass = (function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _Tooltip2 = _interopRequireDefault(_tooltip);
@@ -86,15 +88,19 @@
*/
var Popover = (function (_Tooltip) {
_inherits(Popover, _Tooltip);
function Popover() {
_classCallCheck(this, Popover);
if (_Tooltip != null) {
_Tooltip.apply(this, arguments);
}
_get(Object.getPrototypeOf(Popover.prototype), 'constructor', this).apply(this, arguments);
}
_inherits(Popover, _Tooltip);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(Popover, [{
key: 'isWithContent',
@@ -128,19 +134,19 @@
this.cleanupTether();
}
}, {
key: '_getContent',
// private
}, {
key: '_getContent',
value: function _getContent() {
return this.element.getAttribute('data-content') || (typeof this.config.content == 'function' ? this.config.content.call(this.element) : this.config.content);
}
}], [{
key: '_jQueryInterface',
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
@@ -165,37 +171,37 @@
// getters
get: function () {
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function () {
get: function get() {
return Default;
}
}, {
key: 'NAME',
get: function () {
get: function get() {
return NAME;
}
}, {
key: 'DATA_KEY',
get: function () {
get: function get() {
return DATA_KEY;
}
}, {
key: 'Event',
get: function () {
get: function get() {
return Event;
}
}, {
key: 'EVENT_KEY',
get: function () {
get: function get() {
return EVENT_KEY;
}
}, {
key: 'DefaultType',
get: function () {
get: function get() {
return DefaultType;
}
}]);
@@ -203,12 +209,6 @@
return Popover;
})(_Tooltip2['default']);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Popover._jQueryInterface;
$.fn[NAME].Constructor = Popover;
$.fn[NAME].noConflict = function () {

View File

@@ -58,7 +58,7 @@
var Event = {
ACTIVATE: 'activate' + EVENT_KEY,
SCROLL: 'scroll' + EVENT_KEY,
LOAD_DATA_API: 'load' + EVENT_KEY + '' + DATA_API_KEY
LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
@@ -92,7 +92,7 @@
this._element = element;
this._scrollElement = element.tagName === 'BODY' ? window : element;
this._config = this._getConfig(config);
this._selector = '' + this._config.target + ' ' + Selector.NAV_ANCHORS;
this._selector = this._config.target + ' ' + Selector.NAV_ANCHORS;
this._offsets = [];
this._targets = [];
this._activeTarget = null;
@@ -104,6 +104,14 @@
this._process();
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(ScrollSpy, [{
key: 'refresh',
@@ -161,11 +169,11 @@
this._activeTarget = null;
this._scrollHeight = null;
}
}, {
key: '_getConfig',
// private
}, {
key: '_getConfig',
value: function _getConfig(config) {
config = $.extend({}, Default, config);
@@ -232,7 +240,7 @@
this._clear();
var selector = '' + this._selector + '[data-target="' + target + '"],' + ('' + this._selector + '[href="' + target + '"]');
var selector = this._selector + '[data-target="' + target + '"],' + (this._selector + '[href="' + target + '"]');
// todo (fat): getting all the raw li's up the tree is not great.
var parentListItems = $(selector).parents(Selector.LI);
@@ -261,11 +269,11 @@
$(activeParents[i]).removeClass(ClassName.ACTIVE);
}
}
}], [{
key: '_jQueryInterface',
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
@@ -283,15 +291,12 @@
}
}, {
key: 'VERSION',
// getters
get: function () {
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function () {
get: function get() {
return Default;
}
}]);
@@ -299,12 +304,6 @@
return ScrollSpy;
})();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(window).on(Event.LOAD_DATA_API, function () {
var scrollSpys = $.makeArray($(Selector.DATA_SPY));

29
dist/js/umd/tab.js vendored
View File

@@ -49,7 +49,7 @@
HIDDEN: 'hidden' + EVENT_KEY,
SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + '' + DATA_API_KEY
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
@@ -84,6 +84,14 @@
this._element = element;
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Tab, [{
key: 'show',
@@ -159,11 +167,11 @@
$.removeClass(this._element, DATA_KEY);
this._element = null;
}
}, {
key: '_activate',
// private
}, {
key: '_activate',
value: function _activate(element, container, callback) {
var active = $(container).find(Selector.ACTIVE_CHILD)[0];
var isTransitioning = callback && _Util['default'].supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || !!$(container).find(Selector.FADE_CHILD)[0]);
@@ -228,11 +236,11 @@
callback();
}
}
}], [{
key: '_jQueryInterface',
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $this = $(this);
@@ -250,10 +258,7 @@
}
}, {
key: 'VERSION',
// getters
get: function () {
get: function get() {
return VERSION;
}
}]);
@@ -261,12 +266,6 @@
return Tab;
})();
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault();
Tab._jQueryInterface.call($(this), 'show');

View File

@@ -142,6 +142,14 @@
this._setListeners();
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
// getters
_createClass(Tooltip, [{
key: 'enable',
@@ -313,11 +321,11 @@
this._hoverState = '';
}
}, {
key: 'isWithContent',
// protected
}, {
key: 'isWithContent',
value: function isWithContent() {
return !!this.getTitle();
}
@@ -363,11 +371,11 @@
$(this.tip).removeClass(this._removeTetherClasses);
}
}
}, {
key: '_getAttachment',
// private
}, {
key: '_getAttachment',
value: function _getAttachment(placement) {
return AttachmentMap[placement.toUpperCase()];
}
@@ -526,11 +534,11 @@
return config;
}
}], [{
key: '_jQueryInterface',
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
@@ -552,40 +560,37 @@
}
}, {
key: 'VERSION',
// getters
get: function () {
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function () {
get: function get() {
return Default;
}
}, {
key: 'NAME',
get: function () {
get: function get() {
return NAME;
}
}, {
key: 'DATA_KEY',
get: function () {
get: function get() {
return DATA_KEY;
}
}, {
key: 'Event',
get: function () {
get: function get() {
return Event;
}
}, {
key: 'EVENT_KEY',
get: function () {
get: function get() {
return EVENT_KEY;
}
}, {
key: 'DefaultType',
get: function () {
get: function get() {
return DefaultType;
}
}]);
@@ -593,12 +598,6 @@
return Tooltip;
})();
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Tooltip._jQueryInterface;
$.fn[NAME].Constructor = Tooltip;
$.fn[NAME].noConflict = function () {

2
dist/js/umd/util.js vendored
View File

@@ -150,7 +150,7 @@
if (value && isElement(value)) valueType = 'element';else valueType = toType(value);
if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error('' + componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
}
}
}