effective_bootstrap 0.5.19 → 0.5.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/app/assets/javascripts/effective_select/select2.js +78 -216
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ec934d731e67dbd72ea5923e9cd72bcfdb1aa48800d53b63608079f48e6c12d
|
4
|
+
data.tar.gz: d55fb79c7c18cc51d9b0aa9780d57655470470ef25d883c3965ea1b210a3cecc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8d13125a0308c3d2d0e9eecc624e1c29bdd3d09526fdb62b706eee5857697287cdf98cf4a3eb1f7c8374b60de5777fe6b99018b72c2f3823a15a808ee602d8e
|
7
|
+
data.tar.gz: 8f997e745e188e2ad6f04344de1bc62072f4ba85b307cc75987380fb1c81efb92c9fa515c31b3de59db7032ebb42ed151d291970c26f84dd2ade6a2ac147d021
|
data/MIT-LICENSE
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
/*!
|
2
|
-
* Select2 4.0.
|
2
|
+
* Select2 4.0.5
|
3
3
|
* https://select2.github.io
|
4
4
|
*
|
5
5
|
* Released under the MIT license
|
6
6
|
* https://github.com/select2/select2/blob/master/LICENSE.md
|
7
7
|
*/
|
8
|
-
|
8
|
+
(function (factory) {
|
9
9
|
if (typeof define === 'function' && define.amd) {
|
10
10
|
// AMD. Register as an anonymous module.
|
11
11
|
define(['jquery'], factory);
|
@@ -574,10 +574,10 @@ S2.define('select2/utils',[
|
|
574
574
|
DecoratedClass.prototype = new ctr();
|
575
575
|
|
576
576
|
for (var m = 0; m < superMethods.length; m++) {
|
577
|
-
|
577
|
+
var superMethod = superMethods[m];
|
578
578
|
|
579
|
-
|
580
|
-
|
579
|
+
DecoratedClass.prototype[superMethod] =
|
580
|
+
SuperClass.prototype[superMethod];
|
581
581
|
}
|
582
582
|
|
583
583
|
var calledMethod = function (methodName) {
|
@@ -772,68 +772,6 @@ S2.define('select2/utils',[
|
|
772
772
|
$element.append($nodes);
|
773
773
|
};
|
774
774
|
|
775
|
-
// Cache objects in Utils.__cache instead of $.data (see #4346)
|
776
|
-
Utils.__cache = {};
|
777
|
-
|
778
|
-
var id = 0;
|
779
|
-
Utils.GetUniqueElementId = function (element) {
|
780
|
-
// Get a unique element Id. If element has no id,
|
781
|
-
// creates a new unique number, stores it in the id
|
782
|
-
// attribute and returns the new id.
|
783
|
-
// If an id already exists, it simply returns it.
|
784
|
-
|
785
|
-
var select2Id = element.getAttribute('data-select2-id');
|
786
|
-
if (select2Id == null) {
|
787
|
-
// If element has id, use it.
|
788
|
-
if (element.id) {
|
789
|
-
select2Id = element.id;
|
790
|
-
element.setAttribute('data-select2-id', select2Id);
|
791
|
-
} else {
|
792
|
-
element.setAttribute('data-select2-id', ++id);
|
793
|
-
select2Id = id.toString();
|
794
|
-
}
|
795
|
-
}
|
796
|
-
return select2Id;
|
797
|
-
};
|
798
|
-
|
799
|
-
Utils.StoreData = function (element, name, value) {
|
800
|
-
// Stores an item in the cache for a specified element.
|
801
|
-
// name is the cache key.
|
802
|
-
var id = Utils.GetUniqueElementId(element);
|
803
|
-
if (!Utils.__cache[id]) {
|
804
|
-
Utils.__cache[id] = {};
|
805
|
-
}
|
806
|
-
|
807
|
-
Utils.__cache[id][name] = value;
|
808
|
-
};
|
809
|
-
|
810
|
-
Utils.GetData = function (element, name) {
|
811
|
-
// Retrieves a value from the cache by its key (name)
|
812
|
-
// name is optional. If no name specified, return
|
813
|
-
// all cache items for the specified element.
|
814
|
-
// and for a specified element.
|
815
|
-
var id = Utils.GetUniqueElementId(element);
|
816
|
-
if (name) {
|
817
|
-
if (Utils.__cache[id]) {
|
818
|
-
if (Utils.__cache[id][name] != null) {
|
819
|
-
return Utils.__cache[id][name];
|
820
|
-
}
|
821
|
-
return $(element).data(name); // Fallback to HTML5 data attribs.
|
822
|
-
}
|
823
|
-
return $(element).data(name); // Fallback to HTML5 data attribs.
|
824
|
-
} else {
|
825
|
-
return Utils.__cache[id];
|
826
|
-
}
|
827
|
-
};
|
828
|
-
|
829
|
-
Utils.RemoveData = function (element) {
|
830
|
-
// Removes all cached items for a specified element.
|
831
|
-
var id = Utils.GetUniqueElementId(element);
|
832
|
-
if (Utils.__cache[id] != null) {
|
833
|
-
delete Utils.__cache[id];
|
834
|
-
}
|
835
|
-
};
|
836
|
-
|
837
775
|
return Utils;
|
838
776
|
});
|
839
777
|
|
@@ -969,7 +907,7 @@ S2.define('select2/results',[
|
|
969
907
|
$options.each(function () {
|
970
908
|
var $option = $(this);
|
971
909
|
|
972
|
-
var item =
|
910
|
+
var item = $.data(this, 'data');
|
973
911
|
|
974
912
|
// id needs to be converted to a string when comparing
|
975
913
|
var id = '' + item.id;
|
@@ -1074,7 +1012,7 @@ S2.define('select2/results',[
|
|
1074
1012
|
this.template(data, option);
|
1075
1013
|
}
|
1076
1014
|
|
1077
|
-
|
1015
|
+
$.data(option, 'data', data);
|
1078
1016
|
|
1079
1017
|
return option;
|
1080
1018
|
};
|
@@ -1115,10 +1053,7 @@ S2.define('select2/results',[
|
|
1115
1053
|
}
|
1116
1054
|
|
1117
1055
|
self.setClasses();
|
1118
|
-
|
1119
|
-
if (self.options.get('scrollAfterSelect')) {
|
1120
|
-
self.highlightFirstItem();
|
1121
|
-
}
|
1056
|
+
self.highlightFirstItem();
|
1122
1057
|
});
|
1123
1058
|
|
1124
1059
|
container.on('unselect', function () {
|
@@ -1127,10 +1062,7 @@ S2.define('select2/results',[
|
|
1127
1062
|
}
|
1128
1063
|
|
1129
1064
|
self.setClasses();
|
1130
|
-
|
1131
|
-
if (self.options.get('scrollAfterSelect')) {
|
1132
|
-
self.highlightFirstItem();
|
1133
|
-
}
|
1065
|
+
self.highlightFirstItem();
|
1134
1066
|
});
|
1135
1067
|
|
1136
1068
|
container.on('open', function () {
|
@@ -1166,7 +1098,7 @@ S2.define('select2/results',[
|
|
1166
1098
|
return;
|
1167
1099
|
}
|
1168
1100
|
|
1169
|
-
var data =
|
1101
|
+
var data = $highlighted.data('data');
|
1170
1102
|
|
1171
1103
|
if ($highlighted.attr('aria-selected') == 'true') {
|
1172
1104
|
self.trigger('close', {});
|
@@ -1184,9 +1116,8 @@ S2.define('select2/results',[
|
|
1184
1116
|
|
1185
1117
|
var currentIndex = $options.index($highlighted);
|
1186
1118
|
|
1187
|
-
// If we are already at
|
1188
|
-
|
1189
|
-
if (currentIndex <= 0) {
|
1119
|
+
// If we are already at te top, don't move further
|
1120
|
+
if (currentIndex === 0) {
|
1190
1121
|
return;
|
1191
1122
|
}
|
1192
1123
|
|
@@ -1279,7 +1210,7 @@ S2.define('select2/results',[
|
|
1279
1210
|
function (evt) {
|
1280
1211
|
var $this = $(this);
|
1281
1212
|
|
1282
|
-
var data =
|
1213
|
+
var data = $this.data('data');
|
1283
1214
|
|
1284
1215
|
if ($this.attr('aria-selected') === 'true') {
|
1285
1216
|
if (self.options.get('multiple')) {
|
@@ -1302,7 +1233,7 @@ S2.define('select2/results',[
|
|
1302
1233
|
|
1303
1234
|
this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
|
1304
1235
|
function (evt) {
|
1305
|
-
var data =
|
1236
|
+
var data = $(this).data('data');
|
1306
1237
|
|
1307
1238
|
self.getHighlightedResults()
|
1308
1239
|
.removeClass('select2-results__option--highlighted');
|
@@ -1417,8 +1348,8 @@ S2.define('select2/selection/base',[
|
|
1417
1348
|
|
1418
1349
|
this._tabindex = 0;
|
1419
1350
|
|
1420
|
-
if (
|
1421
|
-
this._tabindex =
|
1351
|
+
if (this.$element.data('old-tabindex') != null) {
|
1352
|
+
this._tabindex = this.$element.data('old-tabindex');
|
1422
1353
|
} else if (this.$element.attr('tabindex') != null) {
|
1423
1354
|
this._tabindex = this.$element.attr('tabindex');
|
1424
1355
|
}
|
@@ -1477,10 +1408,8 @@ S2.define('select2/selection/base',[
|
|
1477
1408
|
self.$selection.removeAttr('aria-activedescendant');
|
1478
1409
|
self.$selection.removeAttr('aria-owns');
|
1479
1410
|
|
1480
|
-
|
1481
|
-
|
1482
|
-
}, 0);
|
1483
|
-
|
1411
|
+
self.$selection.focus();
|
1412
|
+
|
1484
1413
|
self._detachCloseHandler(container);
|
1485
1414
|
});
|
1486
1415
|
|
@@ -1528,7 +1457,7 @@ S2.define('select2/selection/base',[
|
|
1528
1457
|
return;
|
1529
1458
|
}
|
1530
1459
|
|
1531
|
-
var $element =
|
1460
|
+
var $element = $this.data('element');
|
1532
1461
|
|
1533
1462
|
$element.select2('close');
|
1534
1463
|
});
|
@@ -1589,10 +1518,7 @@ S2.define('select2/selection/single',[
|
|
1589
1518
|
|
1590
1519
|
var id = container.id + '-container';
|
1591
1520
|
|
1592
|
-
this.$selection.find('.select2-selection__rendered')
|
1593
|
-
.attr('id', id)
|
1594
|
-
.attr('role', 'textbox')
|
1595
|
-
.attr('aria-readonly', 'true');
|
1521
|
+
this.$selection.find('.select2-selection__rendered').attr('id', id);
|
1596
1522
|
this.$selection.attr('aria-labelledby', id);
|
1597
1523
|
|
1598
1524
|
this.$selection.on('mousedown', function (evt) {
|
@@ -1619,12 +1545,14 @@ S2.define('select2/selection/single',[
|
|
1619
1545
|
self.$selection.focus();
|
1620
1546
|
}
|
1621
1547
|
});
|
1548
|
+
|
1549
|
+
container.on('selection:update', function (params) {
|
1550
|
+
self.update(params.data);
|
1551
|
+
});
|
1622
1552
|
};
|
1623
1553
|
|
1624
1554
|
SingleSelection.prototype.clear = function () {
|
1625
|
-
|
1626
|
-
$rendered.empty();
|
1627
|
-
$rendered.removeAttr('title'); // clear tooltip on empty
|
1555
|
+
this.$selection.find('.select2-selection__rendered').empty();
|
1628
1556
|
};
|
1629
1557
|
|
1630
1558
|
SingleSelection.prototype.display = function (data, container) {
|
@@ -1650,7 +1578,7 @@ S2.define('select2/selection/single',[
|
|
1650
1578
|
var formatted = this.display(selection, $rendered);
|
1651
1579
|
|
1652
1580
|
$rendered.empty().append(formatted);
|
1653
|
-
$rendered.
|
1581
|
+
$rendered.prop('title', selection.title || selection.text);
|
1654
1582
|
};
|
1655
1583
|
|
1656
1584
|
return SingleSelection;
|
@@ -1702,7 +1630,7 @@ S2.define('select2/selection/multiple',[
|
|
1702
1630
|
var $remove = $(this);
|
1703
1631
|
var $selection = $remove.parent();
|
1704
1632
|
|
1705
|
-
var data =
|
1633
|
+
var data = $selection.data('data');
|
1706
1634
|
|
1707
1635
|
self.trigger('unselect', {
|
1708
1636
|
originalEvent: evt,
|
@@ -1713,9 +1641,7 @@ S2.define('select2/selection/multiple',[
|
|
1713
1641
|
};
|
1714
1642
|
|
1715
1643
|
MultipleSelection.prototype.clear = function () {
|
1716
|
-
|
1717
|
-
$rendered.empty();
|
1718
|
-
$rendered.removeAttr('title');
|
1644
|
+
this.$selection.find('.select2-selection__rendered').empty();
|
1719
1645
|
};
|
1720
1646
|
|
1721
1647
|
MultipleSelection.prototype.display = function (data, container) {
|
@@ -1753,9 +1679,9 @@ S2.define('select2/selection/multiple',[
|
|
1753
1679
|
var formatted = this.display(selection, $selection);
|
1754
1680
|
|
1755
1681
|
$selection.append(formatted);
|
1756
|
-
$selection.
|
1682
|
+
$selection.prop('title', selection.title || selection.text);
|
1757
1683
|
|
1758
|
-
|
1684
|
+
$selection.data('data', selection);
|
1759
1685
|
|
1760
1686
|
$selections.push($selection);
|
1761
1687
|
}
|
@@ -1820,9 +1746,8 @@ S2.define('select2/selection/placeholder',[
|
|
1820
1746
|
|
1821
1747
|
S2.define('select2/selection/allowClear',[
|
1822
1748
|
'jquery',
|
1823
|
-
'../keys'
|
1824
|
-
|
1825
|
-
], function ($, KEYS, Utils) {
|
1749
|
+
'../keys'
|
1750
|
+
], function ($, KEYS) {
|
1826
1751
|
function AllowClear () { }
|
1827
1752
|
|
1828
1753
|
AllowClear.prototype.bind = function (decorated, container, $container) {
|
@@ -1864,22 +1789,10 @@ S2.define('select2/selection/allowClear',[
|
|
1864
1789
|
|
1865
1790
|
evt.stopPropagation();
|
1866
1791
|
|
1867
|
-
var data =
|
1868
|
-
|
1869
|
-
var previousVal = this.$element.val();
|
1870
|
-
this.$element.val(this.placeholder.id);
|
1871
|
-
|
1872
|
-
var unselectData = {
|
1873
|
-
data: data
|
1874
|
-
};
|
1875
|
-
this.trigger('clear', unselectData);
|
1876
|
-
if (unselectData.prevented) {
|
1877
|
-
this.$element.val(previousVal);
|
1878
|
-
return;
|
1879
|
-
}
|
1792
|
+
var data = $clear.data('data');
|
1880
1793
|
|
1881
1794
|
for (var d = 0; d < data.length; d++) {
|
1882
|
-
unselectData = {
|
1795
|
+
var unselectData = {
|
1883
1796
|
data: data[d]
|
1884
1797
|
};
|
1885
1798
|
|
@@ -1889,12 +1802,11 @@ S2.define('select2/selection/allowClear',[
|
|
1889
1802
|
|
1890
1803
|
// If the event was prevented, don't clear it out.
|
1891
1804
|
if (unselectData.prevented) {
|
1892
|
-
this.$element.val(previousVal);
|
1893
1805
|
return;
|
1894
1806
|
}
|
1895
1807
|
}
|
1896
1808
|
|
1897
|
-
this.$element.trigger('change');
|
1809
|
+
this.$element.val(this.placeholder.id).trigger('change');
|
1898
1810
|
|
1899
1811
|
this.trigger('toggle', {});
|
1900
1812
|
};
|
@@ -1917,14 +1829,12 @@ S2.define('select2/selection/allowClear',[
|
|
1917
1829
|
return;
|
1918
1830
|
}
|
1919
1831
|
|
1920
|
-
var removeAll = this.options.get('translations').get('removeAllItems');
|
1921
|
-
|
1922
1832
|
var $remove = $(
|
1923
|
-
'<span class="select2-selection__clear"
|
1833
|
+
'<span class="select2-selection__clear">' +
|
1924
1834
|
'×' +
|
1925
1835
|
'</span>'
|
1926
1836
|
);
|
1927
|
-
|
1837
|
+
$remove.data('data', data);
|
1928
1838
|
|
1929
1839
|
this.$selection.find('.select2-selection__rendered').prepend($remove);
|
1930
1840
|
};
|
@@ -2015,7 +1925,7 @@ S2.define('select2/selection/search',[
|
|
2015
1925
|
.prev('.select2-selection__choice');
|
2016
1926
|
|
2017
1927
|
if ($previousChoice.length > 0) {
|
2018
|
-
var item =
|
1928
|
+
var item = $previousChoice.data('data');
|
2019
1929
|
|
2020
1930
|
self.searchRemoveChoice(item);
|
2021
1931
|
|
@@ -2109,13 +2019,7 @@ S2.define('select2/selection/search',[
|
|
2109
2019
|
|
2110
2020
|
this.resizeSearch();
|
2111
2021
|
if (searchHadFocus) {
|
2112
|
-
|
2113
|
-
if (isTagInput) {
|
2114
|
-
// fix IE11 bug where tag input lost focus
|
2115
|
-
this.$element.focus();
|
2116
|
-
} else {
|
2117
|
-
this.$search.focus();
|
2118
|
-
}
|
2022
|
+
this.$search.focus();
|
2119
2023
|
}
|
2120
2024
|
};
|
2121
2025
|
|
@@ -2173,12 +2077,10 @@ S2.define('select2/selection/eventRelay',[
|
|
2173
2077
|
'close', 'closing',
|
2174
2078
|
'select', 'selecting',
|
2175
2079
|
'unselect', 'unselecting',
|
2176
|
-
'
|
2080
|
+
'focus'
|
2177
2081
|
];
|
2178
2082
|
|
2179
|
-
var preventableEvents = [
|
2180
|
-
'opening', 'closing', 'selecting', 'unselecting', 'clearing'
|
2181
|
-
];
|
2083
|
+
var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
|
2182
2084
|
|
2183
2085
|
decorated.call(this, container, $container);
|
2184
2086
|
|
@@ -2511,7 +2413,6 @@ S2.define('select2/diacritics',[
|
|
2511
2413
|
'\u019F': 'O',
|
2512
2414
|
'\uA74A': 'O',
|
2513
2415
|
'\uA74C': 'O',
|
2514
|
-
'\u0152': 'OE',
|
2515
2416
|
'\u01A2': 'OI',
|
2516
2417
|
'\uA74E': 'OO',
|
2517
2418
|
'\u0222': 'OU',
|
@@ -2921,7 +2822,6 @@ S2.define('select2/diacritics',[
|
|
2921
2822
|
'\uA74B': 'o',
|
2922
2823
|
'\uA74D': 'o',
|
2923
2824
|
'\u0275': 'o',
|
2924
|
-
'\u0153': 'oe',
|
2925
2825
|
'\u01A3': 'oi',
|
2926
2826
|
'\u0223': 'ou',
|
2927
2827
|
'\uA74F': 'oo',
|
@@ -3090,9 +2990,8 @@ S2.define('select2/diacritics',[
|
|
3090
2990
|
'\u03CD': '\u03C5',
|
3091
2991
|
'\u03CB': '\u03C5',
|
3092
2992
|
'\u03B0': '\u03C5',
|
3093
|
-
'\
|
3094
|
-
'\u03C2': '\u03C3'
|
3095
|
-
'\u2019': '\''
|
2993
|
+
'\u03C9': '\u03C9',
|
2994
|
+
'\u03C2': '\u03C3'
|
3096
2995
|
};
|
3097
2996
|
|
3098
2997
|
return diacritics;
|
@@ -3260,7 +3159,7 @@ S2.define('select2/data/select',[
|
|
3260
3159
|
// Remove anything added to child elements
|
3261
3160
|
this.$element.find('*').each(function () {
|
3262
3161
|
// Remove any custom data set by Select2
|
3263
|
-
|
3162
|
+
$.removeData(this, 'data');
|
3264
3163
|
});
|
3265
3164
|
};
|
3266
3165
|
|
@@ -3333,7 +3232,7 @@ S2.define('select2/data/select',[
|
|
3333
3232
|
normalizedData.element = option;
|
3334
3233
|
|
3335
3234
|
// Override the option's data with the combined data
|
3336
|
-
|
3235
|
+
$.data(option, 'data', normalizedData);
|
3337
3236
|
|
3338
3237
|
return $option;
|
3339
3238
|
};
|
@@ -3341,7 +3240,7 @@ S2.define('select2/data/select',[
|
|
3341
3240
|
SelectAdapter.prototype.item = function ($option) {
|
3342
3241
|
var data = {};
|
3343
3242
|
|
3344
|
-
data =
|
3243
|
+
data = $.data($option[0], 'data');
|
3345
3244
|
|
3346
3245
|
if (data != null) {
|
3347
3246
|
return data;
|
@@ -3379,13 +3278,13 @@ S2.define('select2/data/select',[
|
|
3379
3278
|
data = this._normalizeItem(data);
|
3380
3279
|
data.element = $option[0];
|
3381
3280
|
|
3382
|
-
|
3281
|
+
$.data($option[0], 'data', data);
|
3383
3282
|
|
3384
3283
|
return data;
|
3385
3284
|
};
|
3386
3285
|
|
3387
3286
|
SelectAdapter.prototype._normalizeItem = function (item) {
|
3388
|
-
if (
|
3287
|
+
if (!$.isPlainObject(item)) {
|
3389
3288
|
item = {
|
3390
3289
|
id: item,
|
3391
3290
|
text: item
|
@@ -3589,8 +3488,7 @@ S2.define('select2/data/ajax',[
|
|
3589
3488
|
}, function () {
|
3590
3489
|
// Attempt to detect if a request was aborted
|
3591
3490
|
// Only works if the transport exposes a status property
|
3592
|
-
if (
|
3593
|
-
($request.status === 0 || $request.status === '0')) {
|
3491
|
+
if ($request.status && $request.status === '0') {
|
3594
3492
|
return;
|
3595
3493
|
}
|
3596
3494
|
|
@@ -3989,7 +3887,7 @@ S2.define('select2/dropdown',[
|
|
3989
3887
|
};
|
3990
3888
|
|
3991
3889
|
Dropdown.prototype.position = function ($dropdown, $container) {
|
3992
|
-
// Should be
|
3890
|
+
// Should be implmented in subclasses
|
3993
3891
|
};
|
3994
3892
|
|
3995
3893
|
Dropdown.prototype.destroy = function () {
|
@@ -4062,7 +3960,6 @@ S2.define('select2/dropdown/search',[
|
|
4062
3960
|
self.$search.attr('tabindex', -1);
|
4063
3961
|
|
4064
3962
|
self.$search.val('');
|
4065
|
-
self.$search.blur();
|
4066
3963
|
});
|
4067
3964
|
|
4068
3965
|
container.on('focus', function () {
|
@@ -4328,14 +4225,14 @@ S2.define('select2/dropdown/attachBody',[
|
|
4328
4225
|
|
4329
4226
|
var $watchers = this.$container.parents().filter(Utils.hasScroll);
|
4330
4227
|
$watchers.each(function () {
|
4331
|
-
|
4228
|
+
$(this).data('select2-scroll-position', {
|
4332
4229
|
x: $(this).scrollLeft(),
|
4333
4230
|
y: $(this).scrollTop()
|
4334
4231
|
});
|
4335
4232
|
});
|
4336
4233
|
|
4337
4234
|
$watchers.on(scrollEvent, function (ev) {
|
4338
|
-
var position =
|
4235
|
+
var position = $(this).data('select2-scroll-position');
|
4339
4236
|
$(this).scrollTop(position.y);
|
4340
4237
|
});
|
4341
4238
|
|
@@ -4394,10 +4291,10 @@ S2.define('select2/dropdown/attachBody',[
|
|
4394
4291
|
top: container.bottom
|
4395
4292
|
};
|
4396
4293
|
|
4397
|
-
// Determine what the parent element is to use for
|
4294
|
+
// Determine what the parent element is to use for calciulating the offset
|
4398
4295
|
var $offsetParent = this.$dropdownParent;
|
4399
4296
|
|
4400
|
-
// For statically
|
4297
|
+
// For statically positoned elements, we need to get the element
|
4401
4298
|
// that is determining the offset
|
4402
4299
|
if ($offsetParent.css('position') === 'static') {
|
4403
4300
|
$offsetParent = $offsetParent.offsetParent();
|
@@ -4500,8 +4397,8 @@ S2.define('select2/dropdown/minimumResultsForSearch',[
|
|
4500
4397
|
});
|
4501
4398
|
|
4502
4399
|
S2.define('select2/dropdown/selectOnClose',[
|
4503
|
-
|
4504
|
-
], function (
|
4400
|
+
|
4401
|
+
], function () {
|
4505
4402
|
function SelectOnClose () { }
|
4506
4403
|
|
4507
4404
|
SelectOnClose.prototype.bind = function (decorated, container, $container) {
|
@@ -4532,7 +4429,7 @@ S2.define('select2/dropdown/selectOnClose',[
|
|
4532
4429
|
return;
|
4533
4430
|
}
|
4534
4431
|
|
4535
|
-
var data =
|
4432
|
+
var data = $highlightedResults.data('data');
|
4536
4433
|
|
4537
4434
|
// Don't re-select already selected resulte
|
4538
4435
|
if (
|
@@ -4573,7 +4470,7 @@ S2.define('select2/dropdown/closeOnSelect',[
|
|
4573
4470
|
var originalEvent = evt.originalEvent;
|
4574
4471
|
|
4575
4472
|
// Don't close if the control key is being held
|
4576
|
-
if (originalEvent &&
|
4473
|
+
if (originalEvent && originalEvent.ctrlKey) {
|
4577
4474
|
return;
|
4578
4475
|
}
|
4579
4476
|
|
@@ -4627,9 +4524,6 @@ S2.define('select2/i18n/en',[],function () {
|
|
4627
4524
|
},
|
4628
4525
|
searching: function () {
|
4629
4526
|
return 'Searching…';
|
4630
|
-
},
|
4631
|
-
removeAllItems: function () {
|
4632
|
-
return 'Remove all items';
|
4633
4527
|
}
|
4634
4528
|
};
|
4635
4529
|
});
|
@@ -5001,7 +4895,6 @@ S2.define('select2/defaults',[
|
|
5001
4895
|
maximumSelectionLength: 0,
|
5002
4896
|
minimumResultsForSearch: 0,
|
5003
4897
|
selectOnClose: false,
|
5004
|
-
scrollAfterSelect: false,
|
5005
4898
|
sorter: function (data) {
|
5006
4899
|
return data;
|
5007
4900
|
},
|
@@ -5024,7 +4917,7 @@ S2.define('select2/defaults',[
|
|
5024
4917
|
|
5025
4918
|
var convertedData = Utils._convertData(data);
|
5026
4919
|
|
5027
|
-
$.extend(
|
4920
|
+
$.extend(this.defaults, convertedData);
|
5028
4921
|
};
|
5029
4922
|
|
5030
4923
|
var defaults = new Defaults();
|
@@ -5089,7 +4982,7 @@ S2.define('select2/options',[
|
|
5089
4982
|
$e.prop('disabled', this.options.disabled);
|
5090
4983
|
$e.prop('multiple', this.options.multiple);
|
5091
4984
|
|
5092
|
-
if (
|
4985
|
+
if ($e.data('select2Tags')) {
|
5093
4986
|
if (this.options.debug && window.console && console.warn) {
|
5094
4987
|
console.warn(
|
5095
4988
|
'Select2: The `data-select2-tags` attribute has been changed to ' +
|
@@ -5098,11 +4991,11 @@ S2.define('select2/options',[
|
|
5098
4991
|
);
|
5099
4992
|
}
|
5100
4993
|
|
5101
|
-
|
5102
|
-
|
4994
|
+
$e.data('data', $e.data('select2Tags'));
|
4995
|
+
$e.data('tags', true);
|
5103
4996
|
}
|
5104
4997
|
|
5105
|
-
if (
|
4998
|
+
if ($e.data('ajaxUrl')) {
|
5106
4999
|
if (this.options.debug && window.console && console.warn) {
|
5107
5000
|
console.warn(
|
5108
5001
|
'Select2: The `data-ajax-url` attribute has been changed to ' +
|
@@ -5111,45 +5004,21 @@ S2.define('select2/options',[
|
|
5111
5004
|
);
|
5112
5005
|
}
|
5113
5006
|
|
5114
|
-
$e.attr('ajax--url',
|
5115
|
-
|
5007
|
+
$e.attr('ajax--url', $e.data('ajaxUrl'));
|
5008
|
+
$e.data('ajax--url', $e.data('ajaxUrl'));
|
5116
5009
|
}
|
5117
5010
|
|
5118
5011
|
var dataset = {};
|
5119
5012
|
|
5120
|
-
function upperCaseLetter(_, letter) {
|
5121
|
-
return letter.toUpperCase();
|
5122
|
-
}
|
5123
|
-
|
5124
|
-
// Pre-load all of the attributes which are prefixed with `data-`
|
5125
|
-
for (var attr = 0; attr < $e[0].attributes.length; attr++) {
|
5126
|
-
var attributeName = $e[0].attributes[attr].name;
|
5127
|
-
var prefix = 'data-';
|
5128
|
-
|
5129
|
-
if (attributeName.substr(0, prefix.length) == prefix) {
|
5130
|
-
// Get the contents of the attribute after `data-`
|
5131
|
-
var dataName = attributeName.substring(prefix.length);
|
5132
|
-
|
5133
|
-
// Get the data contents from the consistent source
|
5134
|
-
// This is more than likely the jQuery data helper
|
5135
|
-
var dataValue = Utils.GetData($e[0], dataName);
|
5136
|
-
|
5137
|
-
// camelCase the attribute name to match the spec
|
5138
|
-
var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter);
|
5139
|
-
|
5140
|
-
// Store the data attribute contents into the dataset since
|
5141
|
-
dataset[camelDataName] = dataValue;
|
5142
|
-
}
|
5143
|
-
}
|
5144
|
-
|
5145
5013
|
// Prefer the element's `dataset` attribute if it exists
|
5146
5014
|
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
5147
5015
|
if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
|
5148
|
-
dataset = $.extend(true, {}, $e[0].dataset,
|
5016
|
+
dataset = $.extend(true, {}, $e[0].dataset, $e.data());
|
5017
|
+
} else {
|
5018
|
+
dataset = $e.data();
|
5149
5019
|
}
|
5150
5020
|
|
5151
|
-
|
5152
|
-
var data = $.extend(true, {}, Utils.GetData($e[0]), dataset);
|
5021
|
+
var data = $.extend(true, {}, dataset);
|
5153
5022
|
|
5154
5023
|
data = Utils._convertData(data);
|
5155
5024
|
|
@@ -5186,8 +5055,8 @@ S2.define('select2/core',[
|
|
5186
5055
|
'./keys'
|
5187
5056
|
], function ($, Options, Utils, KEYS) {
|
5188
5057
|
var Select2 = function ($element, options) {
|
5189
|
-
if (
|
5190
|
-
|
5058
|
+
if ($element.data('select2') != null) {
|
5059
|
+
$element.data('select2').destroy();
|
5191
5060
|
}
|
5192
5061
|
|
5193
5062
|
this.$element = $element;
|
@@ -5203,7 +5072,7 @@ S2.define('select2/core',[
|
|
5203
5072
|
// Set up the tabindex
|
5204
5073
|
|
5205
5074
|
var tabindex = $element.attr('tabindex') || 0;
|
5206
|
-
|
5075
|
+
$element.data('old-tabindex', tabindex);
|
5207
5076
|
$element.attr('tabindex', '-1');
|
5208
5077
|
|
5209
5078
|
// Set up containers and adapters
|
@@ -5264,9 +5133,6 @@ S2.define('select2/core',[
|
|
5264
5133
|
// Synchronize any monitored attributes
|
5265
5134
|
this._syncAttributes();
|
5266
5135
|
|
5267
|
-
Utils.StoreData($element[0], 'select2', this);
|
5268
|
-
|
5269
|
-
// Ensure backwards compatibility with $element.data('select2').
|
5270
5136
|
$element.data('select2', this);
|
5271
5137
|
};
|
5272
5138
|
|
@@ -5600,8 +5466,7 @@ S2.define('select2/core',[
|
|
5600
5466
|
'open': 'opening',
|
5601
5467
|
'close': 'closing',
|
5602
5468
|
'select': 'selecting',
|
5603
|
-
'unselect': 'unselecting'
|
5604
|
-
'clear': 'clearing'
|
5469
|
+
'unselect': 'unselecting'
|
5605
5470
|
};
|
5606
5471
|
|
5607
5472
|
if (args === undefined) {
|
@@ -5756,12 +5621,10 @@ S2.define('select2/core',[
|
|
5756
5621
|
this._syncS = null;
|
5757
5622
|
|
5758
5623
|
this.$element.off('.select2');
|
5759
|
-
this.$element.attr('tabindex',
|
5760
|
-
Utils.GetData(this.$element[0], 'old-tabindex'));
|
5624
|
+
this.$element.attr('tabindex', this.$element.data('old-tabindex'));
|
5761
5625
|
|
5762
5626
|
this.$element.removeClass('select2-hidden-accessible');
|
5763
5627
|
this.$element.attr('aria-hidden', 'false');
|
5764
|
-
Utils.RemoveData(this.$element[0]);
|
5765
5628
|
this.$element.removeData('select2');
|
5766
5629
|
|
5767
5630
|
this.dataAdapter.destroy();
|
@@ -5789,7 +5652,7 @@ S2.define('select2/core',[
|
|
5789
5652
|
|
5790
5653
|
this.$container.addClass('select2-container--' + this.options.get('theme'));
|
5791
5654
|
|
5792
|
-
|
5655
|
+
$container.data('element', this.$element);
|
5793
5656
|
|
5794
5657
|
return $container;
|
5795
5658
|
};
|
@@ -5809,9 +5672,8 @@ S2.define('jquery.select2',[
|
|
5809
5672
|
'jquery-mousewheel',
|
5810
5673
|
|
5811
5674
|
'./select2/core',
|
5812
|
-
'./select2/defaults'
|
5813
|
-
|
5814
|
-
], function ($, _, Select2, Defaults, Utils) {
|
5675
|
+
'./select2/defaults'
|
5676
|
+
], function ($, _, Select2, Defaults) {
|
5815
5677
|
if ($.fn.select2 == null) {
|
5816
5678
|
// All methods that should return the element
|
5817
5679
|
var thisMethods = ['open', 'close', 'destroy'];
|
@@ -5832,7 +5694,7 @@ S2.define('jquery.select2',[
|
|
5832
5694
|
var args = Array.prototype.slice.call(arguments, 1);
|
5833
5695
|
|
5834
5696
|
this.each(function () {
|
5835
|
-
var instance =
|
5697
|
+
var instance = $(this).data('select2');
|
5836
5698
|
|
5837
5699
|
if (instance == null && window.console && console.error) {
|
5838
5700
|
console.error(
|