|
@@ -12387,6 +12387,36 @@ define('select2/data/maximumInputLength',[
|
|
return MaximumInputLength;
|
|
return MaximumInputLength;
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+define('select2/data/maximumSelectionLength',[
|
|
|
|
+
|
|
|
|
+], function (){
|
|
|
|
+ function MaximumSelectionLength (decorated, $e, options) {
|
|
|
|
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
|
|
|
|
+
|
|
|
|
+ decorated.call(this, $e, options);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ MaximumSelectionLength.prototype.query =
|
|
|
|
+ function (decorated, params, callback) {
|
|
|
|
+
|
|
|
|
+ var count = this.$element.val() != null ? this.$element.val().length : 0;
|
|
|
|
+ if (count >= this.maximumSelectionLength) {
|
|
|
|
+ this.trigger('results:message', {
|
|
|
|
+ message: 'maximumSelected',
|
|
|
|
+ args: {
|
|
|
|
+ maximum: this.maximumSelectionLength
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ decorated.call(this, params, callback);
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ return MaximumSelectionLength;
|
|
|
|
+});
|
|
|
|
+
|
|
define('select2/dropdown',[
|
|
define('select2/dropdown',[
|
|
'./utils'
|
|
'./utils'
|
|
], function (Utils) {
|
|
], function (Utils) {
|
|
@@ -12938,6 +12968,7 @@ define('select2/defaults',[
|
|
'./data/tokenizer',
|
|
'./data/tokenizer',
|
|
'./data/minimumInputLength',
|
|
'./data/minimumInputLength',
|
|
'./data/maximumInputLength',
|
|
'./data/maximumInputLength',
|
|
|
|
+ './data/maximumSelectionLength',
|
|
|
|
|
|
'./dropdown',
|
|
'./dropdown',
|
|
'./dropdown/search',
|
|
'./dropdown/search',
|
|
@@ -12956,7 +12987,7 @@ define('select2/defaults',[
|
|
Utils, Translation, DIACRITICS,
|
|
Utils, Translation, DIACRITICS,
|
|
|
|
|
|
SelectData, ArrayData, AjaxData, Tags, Tokenizer,
|
|
SelectData, ArrayData, AjaxData, Tags, Tokenizer,
|
|
- MinimumInputLength, MaximumInputLength,
|
|
|
|
|
|
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
|
|
|
|
|
|
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
|
|
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
|
|
AttachBody, MinimumResultsForSearch, SelectOnClose,
|
|
AttachBody, MinimumResultsForSearch, SelectOnClose,
|
|
@@ -12992,6 +13023,13 @@ define('select2/defaults',[
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (options.maximumSelectionLength > 0) {
|
|
|
|
+ options.dataAdapter = Utils.Decorate(
|
|
|
|
+ options.dataAdapter,
|
|
|
|
+ MaximumSelectionLength
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
if (options.tags != null) {
|
|
if (options.tags != null) {
|
|
options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
|
|
options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
|
|
}
|
|
}
|
|
@@ -13105,7 +13143,7 @@ define('select2/defaults',[
|
|
language = Translation.loadPath(name);
|
|
language = Translation.loadPath(name);
|
|
} catch (e) {
|
|
} catch (e) {
|
|
// If we couldn't load it, check if it wasn't the full path
|
|
// If we couldn't load it, check if it wasn't the full path
|
|
- name = this.get('amdTranslationBase') + name;
|
|
|
|
|
|
+ name = this.defaults.amdLanguageBase + name;
|
|
language = Translation.loadPath(name);
|
|
language = Translation.loadPath(name);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -13182,6 +13220,7 @@ define('select2/defaults',[
|
|
matcher: matcher,
|
|
matcher: matcher,
|
|
minimumInputLength: 0,
|
|
minimumInputLength: 0,
|
|
maximumInputLength: 0,
|
|
maximumInputLength: 0,
|
|
|
|
+ maximumSelectionLength: 0,
|
|
minimumResultsForSearch: 0,
|
|
minimumResultsForSearch: 0,
|
|
selectOnClose: false,
|
|
selectOnClose: false,
|
|
sorter: function (data) {
|
|
sorter: function (data) {
|