|
@@ -3104,26 +3104,6 @@ define('select2/dropdown',[
|
|
this.$dropdown.remove();
|
|
this.$dropdown.remove();
|
|
};
|
|
};
|
|
|
|
|
|
- Dropdown.prototype.bind = function (container, $container) {
|
|
|
|
- var self = this;
|
|
|
|
-
|
|
|
|
- container.on('select', function (params) {
|
|
|
|
- self._onSelect(params);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- container.on('unselect', function (params) {
|
|
|
|
- self._onUnSelect(params);
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- Dropdown.prototype._onSelect = function () {
|
|
|
|
- this.trigger('close');
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- Dropdown.prototype._onUnSelect = function () {
|
|
|
|
- this.trigger('close');
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
return Dropdown;
|
|
return Dropdown;
|
|
});
|
|
});
|
|
|
|
|
|
@@ -3610,6 +3590,31 @@ define('select2/dropdown/selectOnClose',[
|
|
return SelectOnClose;
|
|
return SelectOnClose;
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+define('select2/dropdown/closeOnSelect',[
|
|
|
|
+
|
|
|
|
+], function () {
|
|
|
|
+ function CloseOnSelect () { }
|
|
|
|
+
|
|
|
|
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
|
|
|
|
+ var self = this;
|
|
|
|
+
|
|
|
|
+ decorated.call(this, container, $container);
|
|
|
|
+
|
|
|
|
+ container.on('select', function (evt) {
|
|
|
|
+ var originalEvent = evt.originalEvent;
|
|
|
|
+
|
|
|
|
+ // Don't close if the control key is being held
|
|
|
|
+ if (originalEvent && originalEvent.ctrlKey) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ self.trigger('close');
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ return CloseOnSelect;
|
|
|
|
+});
|
|
|
|
+
|
|
define('select2/i18n/en',[],function () {
|
|
define('select2/i18n/en',[],function () {
|
|
// English
|
|
// English
|
|
return {
|
|
return {
|
|
@@ -3686,6 +3691,7 @@ define('select2/defaults',[
|
|
'./dropdown/attachBody',
|
|
'./dropdown/attachBody',
|
|
'./dropdown/minimumResultsForSearch',
|
|
'./dropdown/minimumResultsForSearch',
|
|
'./dropdown/selectOnClose',
|
|
'./dropdown/selectOnClose',
|
|
|
|
+ './dropdown/closeOnSelect',
|
|
|
|
|
|
'./i18n/en'
|
|
'./i18n/en'
|
|
], function ($, ResultsList,
|
|
], function ($, ResultsList,
|
|
@@ -3699,7 +3705,7 @@ define('select2/defaults',[
|
|
MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
|
|
MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
|
|
|
|
|
|
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
|
|
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
|
|
- AttachBody, MinimumResultsForSearch, SelectOnClose,
|
|
|
|
|
|
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
|
|
|
|
|
|
EnglishTranslation) {
|
|
EnglishTranslation) {
|
|
function Defaults () {
|
|
function Defaults () {
|
|
@@ -3810,6 +3816,13 @@ define('select2/defaults',[
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (options.closeOnSelect) {
|
|
|
|
+ options.dropdownAdapter = Utils.Decorate(
|
|
|
|
+ options.dropdownAdapter,
|
|
|
|
+ CloseOnSelect
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
options.dropdownAdapter = Utils.Decorate(
|
|
options.dropdownAdapter = Utils.Decorate(
|
|
options.dropdownAdapter,
|
|
options.dropdownAdapter,
|
|
AttachBody
|
|
AttachBody
|
|
@@ -3966,6 +3979,7 @@ define('select2/defaults',[
|
|
this.defaults = {
|
|
this.defaults = {
|
|
amdBase: 'select2/',
|
|
amdBase: 'select2/',
|
|
amdLanguageBase: 'select2/i18n/',
|
|
amdLanguageBase: 'select2/i18n/',
|
|
|
|
+ closeOnSelect: true,
|
|
escapeMarkup: Utils.escapeMarkup,
|
|
escapeMarkup: Utils.escapeMarkup,
|
|
language: EnglishTranslation,
|
|
language: EnglishTranslation,
|
|
matcher: matcher,
|
|
matcher: matcher,
|