diff --git a/src/pretix/static/select2/_select2.scss b/src/pretix/static/select2/_select2.scss
index 7ac4f3b933..342344d0c2 100644
--- a/src/pretix/static/select2/_select2.scss
+++ b/src/pretix/static/select2/_select2.scss
@@ -1,5 +1,5 @@
/*!
- * Select2 4.0.6-rc.1
+ * Select2 4.0.13
* https://select2.github.io
*
* Released under the MIT license
@@ -195,16 +195,13 @@
width: 100%; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
list-style: none; }
- .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
- color: #999;
- margin-top: 5px;
- float: left; }
.select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-top: 5px;
- margin-right: 10px; }
+ margin-right: 10px;
+ padding: 1px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4;
border: 1px solid #aaa;
@@ -223,7 +220,7 @@
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #333; }
-.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
+.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
float: right; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
diff --git a/src/pretix/static/select2/select2.js b/src/pretix/static/select2/select2.js
index 73d33af9f4..40e196a2dc 100644
--- a/src/pretix/static/select2/select2.js
+++ b/src/pretix/static/select2/select2.js
@@ -1,5 +1,5 @@
/*!
- * Select2 4.0.6-rc.1
+ * Select2 4.0.13
* https://select2.github.io
*
* Released under the MIT license
@@ -777,9 +777,9 @@ S2.define('select2/utils',[
var id = 0;
Utils.GetUniqueElementId = function (element) {
- // Get a unique element Id. If element has no id,
- // creates a new unique number, stores it in the id
- // attribute and returns the new id.
+ // Get a unique element Id. If element has no id,
+ // creates a new unique number, stores it in the id
+ // attribute and returns the new id.
// If an id already exists, it simply returns it.
var select2Id = element.getAttribute('data-select2-id');
@@ -798,7 +798,7 @@ S2.define('select2/utils',[
Utils.StoreData = function (element, name, value) {
// Stores an item in the cache for a specified element.
- // name is the cache key.
+ // name is the cache key.
var id = Utils.GetUniqueElementId(element);
if (!Utils.__cache[id]) {
Utils.__cache[id] = {};
@@ -809,19 +809,20 @@ S2.define('select2/utils',[
Utils.GetData = function (element, name) {
// Retrieves a value from the cache by its key (name)
- // name is optional. If no name specified, return
+ // name is optional. If no name specified, return
// all cache items for the specified element.
// and for a specified element.
var id = Utils.GetUniqueElementId(element);
if (name) {
if (Utils.__cache[id]) {
- return Utils.__cache[id][name] != null ?
- Utils.__cache[id][name]:
- $(element).data(name); // Fallback to HTML5 data attribs.
+ if (Utils.__cache[id][name] != null) {
+ return Utils.__cache[id][name];
+ }
+ return $(element).data(name); // Fallback to HTML5 data attribs.
}
return $(element).data(name); // Fallback to HTML5 data attribs.
} else {
- return Utils.__cache[id];
+ return Utils.__cache[id];
}
};
@@ -831,6 +832,8 @@ S2.define('select2/utils',[
if (Utils.__cache[id] != null) {
delete Utils.__cache[id];
}
+
+ element.removeAttribute('data-select2-id');
};
return Utils;
@@ -852,7 +855,7 @@ S2.define('select2/results',[
Results.prototype.render = function () {
var $results = $(
- '
'
+ '
'
);
if (this.options.get('multiple')) {
@@ -875,7 +878,7 @@ S2.define('select2/results',[
this.hideLoading();
var $message = $(
- ''
);
@@ -1009,11 +1012,16 @@ S2.define('select2/results',[
option.className = 'select2-results__option';
var attrs = {
- 'role': 'treeitem',
+ 'role': 'option',
'aria-selected': 'false'
};
- if (data.disabled) {
+ var matches = window.Element.prototype.matches ||
+ window.Element.prototype.msMatchesSelector ||
+ window.Element.prototype.webkitMatchesSelector;
+
+ if ((data.element != null && matches.call(data.element, ':disabled')) ||
+ (data.element == null && data.disabled)) {
delete attrs['aria-selected'];
attrs['aria-disabled'] = 'true';
}
@@ -1114,7 +1122,10 @@ S2.define('select2/results',[
}
self.setClasses();
- self.highlightFirstItem();
+
+ if (self.options.get('scrollAfterSelect')) {
+ self.highlightFirstItem();
+ }
});
container.on('unselect', function () {
@@ -1123,7 +1134,10 @@ S2.define('select2/results',[
}
self.setClasses();
- self.highlightFirstItem();
+
+ if (self.options.get('scrollAfterSelect')) {
+ self.highlightFirstItem();
+ }
});
container.on('open', function () {
@@ -1177,7 +1191,7 @@ S2.define('select2/results',[
var currentIndex = $options.index($highlighted);
- // If we are already at te top, don't move further
+ // If we are already at the top, don't move further
// If no options, currentIndex will be -1
if (currentIndex <= 0) {
return;
@@ -1418,6 +1432,7 @@ S2.define('select2/selection/base',[
$selection.attr('title', this.$element.attr('title'));
$selection.attr('tabindex', this._tabindex);
+ $selection.attr('aria-disabled', 'false');
this.$selection = $selection;
@@ -1427,7 +1442,6 @@ S2.define('select2/selection/base',[
BaseSelection.prototype.bind = function (container, $container) {
var self = this;
- var id = container.id + '-container';
var resultsId = container.id + '-results';
this.container = container;
@@ -1470,20 +1484,19 @@ S2.define('select2/selection/base',[
self.$selection.removeAttr('aria-activedescendant');
self.$selection.removeAttr('aria-owns');
- self.$selection.focus();
- window.setTimeout(function () {
- self.$selection.focus();
- }, 0);
+ self.$selection.trigger('focus');
self._detachCloseHandler(container);
});
container.on('enable', function () {
self.$selection.attr('tabindex', self._tabindex);
+ self.$selection.attr('aria-disabled', 'false');
});
container.on('disable', function () {
self.$selection.attr('tabindex', '-1');
+ self.$selection.attr('aria-disabled', 'true');
});
};
@@ -1506,7 +1519,6 @@ S2.define('select2/selection/base',[
};
BaseSelection.prototype._attachCloseHandler = function (container) {
- var self = this;
$(document.body).on('mousedown.select2.' + container.id, function (e) {
var $target = $(e.target);
@@ -1516,8 +1528,6 @@ S2.define('select2/selection/base',[
var $all = $('.select2.select2-container--open');
$all.each(function () {
- var $this = $(this);
-
if (this == $select[0]) {
return;
}
@@ -1546,6 +1556,27 @@ S2.define('select2/selection/base',[
throw new Error('The `update` method must be defined in child classes.');
};
+ /**
+ * Helper method to abstract the "enabled" (not "disabled") state of this
+ * object.
+ *
+ * @return {true} if the instance is not disabled.
+ * @return {false} if the instance is disabled.
+ */
+ BaseSelection.prototype.isEnabled = function () {
+ return !this.isDisabled();
+ };
+
+ /**
+ * Helper method to abstract the "disabled" state of this object.
+ *
+ * @return {true} if the disabled option is true.
+ * @return {false} if the disabled option is false.
+ */
+ BaseSelection.prototype.isDisabled = function () {
+ return this.options.get('disabled');
+ };
+
return BaseSelection;
});
@@ -1610,7 +1641,7 @@ S2.define('select2/selection/single',[
container.on('focus', function (evt) {
if (!container.isOpen()) {
- self.$selection.focus();
+ self.$selection.trigger('focus');
}
});
};
@@ -1644,7 +1675,14 @@ S2.define('select2/selection/single',[
var formatted = this.display(selection, $rendered);
$rendered.empty().append(formatted);
- $rendered.attr('title', selection.title || selection.text);
+
+ var title = selection.title || selection.text;
+
+ if (title) {
+ $rendered.attr('title', title);
+ } else {
+ $rendered.removeAttr('title');
+ }
};
return SingleSelection;
@@ -1689,7 +1727,7 @@ S2.define('select2/selection/multiple',[
'.select2-selection__choice__remove',
function (evt) {
// Ignore the event if it is disabled
- if (self.options.get('disabled')) {
+ if (self.isDisabled()) {
return;
}
@@ -1747,7 +1785,12 @@ S2.define('select2/selection/multiple',[
var formatted = this.display(selection, $selection);
$selection.append(formatted);
- $selection.attr('title', selection.title || selection.text);
+
+ var title = selection.title || selection.text;
+
+ if (title) {
+ $selection.attr('title', title);
+ }
Utils.StoreData($selection[0], 'data', selection);
@@ -1845,7 +1888,7 @@ S2.define('select2/selection/allowClear',[
AllowClear.prototype._handleClear = function (_, evt) {
// Ignore the event if it is disabled
- if (this.options.get('disabled')) {
+ if (this.isDisabled()) {
return;
}
@@ -1888,7 +1931,7 @@ S2.define('select2/selection/allowClear',[
}
}
- this.$element.trigger('change');
+ this.$element.trigger('input').trigger('change');
this.trigger('toggle', {});
};
@@ -1911,8 +1954,10 @@ S2.define('select2/selection/allowClear',[
return;
}
+ var removeAll = this.options.get('translations').get('removeAllItems');
+
var $remove = $(
- '' +
+ '' +
'×' +
''
);
@@ -1938,7 +1983,7 @@ S2.define('select2/selection/search',[
'