|
afe42d0…
|
ragelink
|
1 |
/*! |
|
afe42d0…
|
ragelink
|
2 |
* Select2 4.0.13 |
|
afe42d0…
|
ragelink
|
3 |
* https://select2.github.io |
|
afe42d0…
|
ragelink
|
4 |
* |
|
afe42d0…
|
ragelink
|
5 |
* Released under the MIT license |
|
afe42d0…
|
ragelink
|
6 |
* https://github.com/select2/select2/blob/master/LICENSE.md |
|
afe42d0…
|
ragelink
|
7 |
*/ |
|
afe42d0…
|
ragelink
|
8 |
;(function (factory) { |
|
afe42d0…
|
ragelink
|
9 |
if (typeof define === 'function' && define.amd) { |
|
afe42d0…
|
ragelink
|
10 |
// AMD. Register as an anonymous module. |
|
afe42d0…
|
ragelink
|
11 |
define(['jquery'], factory); |
|
afe42d0…
|
ragelink
|
12 |
} else if (typeof module === 'object' && module.exports) { |
|
afe42d0…
|
ragelink
|
13 |
// Node/CommonJS |
|
afe42d0…
|
ragelink
|
14 |
module.exports = function (root, jQuery) { |
|
afe42d0…
|
ragelink
|
15 |
if (jQuery === undefined) { |
|
afe42d0…
|
ragelink
|
16 |
// require('jQuery') returns a factory that requires window to |
|
afe42d0…
|
ragelink
|
17 |
// build a jQuery instance, we normalize how we use modules |
|
afe42d0…
|
ragelink
|
18 |
// that require this pattern but the window provided is a noop |
|
afe42d0…
|
ragelink
|
19 |
// if it's defined (how jquery works) |
|
afe42d0…
|
ragelink
|
20 |
if (typeof window !== 'undefined') { |
|
afe42d0…
|
ragelink
|
21 |
jQuery = require('jquery'); |
|
afe42d0…
|
ragelink
|
22 |
} |
|
afe42d0…
|
ragelink
|
23 |
else { |
|
afe42d0…
|
ragelink
|
24 |
jQuery = require('jquery')(root); |
|
afe42d0…
|
ragelink
|
25 |
} |
|
afe42d0…
|
ragelink
|
26 |
} |
|
afe42d0…
|
ragelink
|
27 |
factory(jQuery); |
|
afe42d0…
|
ragelink
|
28 |
return jQuery; |
|
afe42d0…
|
ragelink
|
29 |
}; |
|
afe42d0…
|
ragelink
|
30 |
} else { |
|
afe42d0…
|
ragelink
|
31 |
// Browser globals |
|
afe42d0…
|
ragelink
|
32 |
factory(jQuery); |
|
afe42d0…
|
ragelink
|
33 |
} |
|
afe42d0…
|
ragelink
|
34 |
} (function (jQuery) { |
|
afe42d0…
|
ragelink
|
35 |
// This is needed so we can catch the AMD loader configuration and use it |
|
afe42d0…
|
ragelink
|
36 |
// The inner file should be wrapped (by `banner.start.js`) in a function that |
|
afe42d0…
|
ragelink
|
37 |
// returns the AMD loader references. |
|
afe42d0…
|
ragelink
|
38 |
var S2 =(function () { |
|
afe42d0…
|
ragelink
|
39 |
// Restore the Select2 AMD loader so it can be used |
|
afe42d0…
|
ragelink
|
40 |
// Needed mostly in the language files, where the loader is not inserted |
|
afe42d0…
|
ragelink
|
41 |
if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { |
|
afe42d0…
|
ragelink
|
42 |
var S2 = jQuery.fn.select2.amd; |
|
afe42d0…
|
ragelink
|
43 |
} |
|
afe42d0…
|
ragelink
|
44 |
var S2;(function () { if (!S2 || !S2.requirejs) { |
|
afe42d0…
|
ragelink
|
45 |
if (!S2) { S2 = {}; } else { require = S2; } |
|
afe42d0…
|
ragelink
|
46 |
/** |
|
afe42d0…
|
ragelink
|
47 |
* @license almond 0.3.3 Copyright jQuery Foundation and other contributors. |
|
afe42d0…
|
ragelink
|
48 |
* Released under MIT license, http://github.com/requirejs/almond/LICENSE |
|
afe42d0…
|
ragelink
|
49 |
*/ |
|
afe42d0…
|
ragelink
|
50 |
//Going sloppy to avoid 'use strict' string cost, but strict practices should |
|
afe42d0…
|
ragelink
|
51 |
//be followed. |
|
afe42d0…
|
ragelink
|
52 |
/*global setTimeout: false */ |
|
afe42d0…
|
ragelink
|
53 |
|
|
afe42d0…
|
ragelink
|
54 |
var requirejs, require, define; |
|
afe42d0…
|
ragelink
|
55 |
(function (undef) { |
|
afe42d0…
|
ragelink
|
56 |
var main, req, makeMap, handlers, |
|
afe42d0…
|
ragelink
|
57 |
defined = {}, |
|
afe42d0…
|
ragelink
|
58 |
waiting = {}, |
|
afe42d0…
|
ragelink
|
59 |
config = {}, |
|
afe42d0…
|
ragelink
|
60 |
defining = {}, |
|
afe42d0…
|
ragelink
|
61 |
hasOwn = Object.prototype.hasOwnProperty, |
|
afe42d0…
|
ragelink
|
62 |
aps = [].slice, |
|
afe42d0…
|
ragelink
|
63 |
jsSuffixRegExp = /\.js$/; |
|
afe42d0…
|
ragelink
|
64 |
|
|
afe42d0…
|
ragelink
|
65 |
function hasProp(obj, prop) { |
|
afe42d0…
|
ragelink
|
66 |
return hasOwn.call(obj, prop); |
|
afe42d0…
|
ragelink
|
67 |
} |
|
afe42d0…
|
ragelink
|
68 |
|
|
afe42d0…
|
ragelink
|
69 |
/** |
|
afe42d0…
|
ragelink
|
70 |
* Given a relative module name, like ./something, normalize it to |
|
afe42d0…
|
ragelink
|
71 |
* a real name that can be mapped to a path. |
|
afe42d0…
|
ragelink
|
72 |
* @param {String} name the relative name |
|
afe42d0…
|
ragelink
|
73 |
* @param {String} baseName a real name that the name arg is relative |
|
afe42d0…
|
ragelink
|
74 |
* to. |
|
afe42d0…
|
ragelink
|
75 |
* @returns {String} normalized name |
|
afe42d0…
|
ragelink
|
76 |
*/ |
|
afe42d0…
|
ragelink
|
77 |
function normalize(name, baseName) { |
|
afe42d0…
|
ragelink
|
78 |
var nameParts, nameSegment, mapValue, foundMap, lastIndex, |
|
afe42d0…
|
ragelink
|
79 |
foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, |
|
afe42d0…
|
ragelink
|
80 |
baseParts = baseName && baseName.split("/"), |
|
afe42d0…
|
ragelink
|
81 |
map = config.map, |
|
afe42d0…
|
ragelink
|
82 |
starMap = (map && map['*']) || {}; |
|
afe42d0…
|
ragelink
|
83 |
|
|
afe42d0…
|
ragelink
|
84 |
//Adjust any relative paths. |
|
afe42d0…
|
ragelink
|
85 |
if (name) { |
|
afe42d0…
|
ragelink
|
86 |
name = name.split('/'); |
|
afe42d0…
|
ragelink
|
87 |
lastIndex = name.length - 1; |
|
afe42d0…
|
ragelink
|
88 |
|
|
afe42d0…
|
ragelink
|
89 |
// If wanting node ID compatibility, strip .js from end |
|
afe42d0…
|
ragelink
|
90 |
// of IDs. Have to do this here, and not in nameToUrl |
|
afe42d0…
|
ragelink
|
91 |
// because node allows either .js or non .js to map |
|
afe42d0…
|
ragelink
|
92 |
// to same file. |
|
afe42d0…
|
ragelink
|
93 |
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { |
|
afe42d0…
|
ragelink
|
94 |
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); |
|
afe42d0…
|
ragelink
|
95 |
} |
|
afe42d0…
|
ragelink
|
96 |
|
|
afe42d0…
|
ragelink
|
97 |
// Starts with a '.' so need the baseName |
|
afe42d0…
|
ragelink
|
98 |
if (name[0].charAt(0) === '.' && baseParts) { |
|
afe42d0…
|
ragelink
|
99 |
//Convert baseName to array, and lop off the last part, |
|
afe42d0…
|
ragelink
|
100 |
//so that . matches that 'directory' and not name of the baseName's |
|
afe42d0…
|
ragelink
|
101 |
//module. For instance, baseName of 'one/two/three', maps to |
|
afe42d0…
|
ragelink
|
102 |
//'one/two/three.js', but we want the directory, 'one/two' for |
|
afe42d0…
|
ragelink
|
103 |
//this normalization. |
|
afe42d0…
|
ragelink
|
104 |
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); |
|
afe42d0…
|
ragelink
|
105 |
name = normalizedBaseParts.concat(name); |
|
afe42d0…
|
ragelink
|
106 |
} |
|
afe42d0…
|
ragelink
|
107 |
|
|
afe42d0…
|
ragelink
|
108 |
//start trimDots |
|
afe42d0…
|
ragelink
|
109 |
for (i = 0; i < name.length; i++) { |
|
afe42d0…
|
ragelink
|
110 |
part = name[i]; |
|
afe42d0…
|
ragelink
|
111 |
if (part === '.') { |
|
afe42d0…
|
ragelink
|
112 |
name.splice(i, 1); |
|
afe42d0…
|
ragelink
|
113 |
i -= 1; |
|
afe42d0…
|
ragelink
|
114 |
} else if (part === '..') { |
|
afe42d0…
|
ragelink
|
115 |
// If at the start, or previous value is still .., |
|
afe42d0…
|
ragelink
|
116 |
// keep them so that when converted to a path it may |
|
afe42d0…
|
ragelink
|
117 |
// still work when converted to a path, even though |
|
afe42d0…
|
ragelink
|
118 |
// as an ID it is less than ideal. In larger point |
|
afe42d0…
|
ragelink
|
119 |
// releases, may be better to just kick out an error. |
|
afe42d0…
|
ragelink
|
120 |
if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { |
|
afe42d0…
|
ragelink
|
121 |
continue; |
|
afe42d0…
|
ragelink
|
122 |
} else if (i > 0) { |
|
afe42d0…
|
ragelink
|
123 |
name.splice(i - 1, 2); |
|
afe42d0…
|
ragelink
|
124 |
i -= 2; |
|
afe42d0…
|
ragelink
|
125 |
} |
|
afe42d0…
|
ragelink
|
126 |
} |
|
afe42d0…
|
ragelink
|
127 |
} |
|
afe42d0…
|
ragelink
|
128 |
//end trimDots |
|
afe42d0…
|
ragelink
|
129 |
|
|
afe42d0…
|
ragelink
|
130 |
name = name.join('/'); |
|
afe42d0…
|
ragelink
|
131 |
} |
|
afe42d0…
|
ragelink
|
132 |
|
|
afe42d0…
|
ragelink
|
133 |
//Apply map config if available. |
|
afe42d0…
|
ragelink
|
134 |
if ((baseParts || starMap) && map) { |
|
afe42d0…
|
ragelink
|
135 |
nameParts = name.split('/'); |
|
afe42d0…
|
ragelink
|
136 |
|
|
afe42d0…
|
ragelink
|
137 |
for (i = nameParts.length; i > 0; i -= 1) { |
|
afe42d0…
|
ragelink
|
138 |
nameSegment = nameParts.slice(0, i).join("/"); |
|
afe42d0…
|
ragelink
|
139 |
|
|
afe42d0…
|
ragelink
|
140 |
if (baseParts) { |
|
afe42d0…
|
ragelink
|
141 |
//Find the longest baseName segment match in the config. |
|
afe42d0…
|
ragelink
|
142 |
//So, do joins on the biggest to smallest lengths of baseParts. |
|
afe42d0…
|
ragelink
|
143 |
for (j = baseParts.length; j > 0; j -= 1) { |
|
afe42d0…
|
ragelink
|
144 |
mapValue = map[baseParts.slice(0, j).join('/')]; |
|
afe42d0…
|
ragelink
|
145 |
|
|
afe42d0…
|
ragelink
|
146 |
//baseName segment has config, find if it has one for |
|
afe42d0…
|
ragelink
|
147 |
//this name. |
|
afe42d0…
|
ragelink
|
148 |
if (mapValue) { |
|
afe42d0…
|
ragelink
|
149 |
mapValue = mapValue[nameSegment]; |
|
afe42d0…
|
ragelink
|
150 |
if (mapValue) { |
|
afe42d0…
|
ragelink
|
151 |
//Match, update name to the new value. |
|
afe42d0…
|
ragelink
|
152 |
foundMap = mapValue; |
|
afe42d0…
|
ragelink
|
153 |
foundI = i; |
|
afe42d0…
|
ragelink
|
154 |
break; |
|
afe42d0…
|
ragelink
|
155 |
} |
|
afe42d0…
|
ragelink
|
156 |
} |
|
afe42d0…
|
ragelink
|
157 |
} |
|
afe42d0…
|
ragelink
|
158 |
} |
|
afe42d0…
|
ragelink
|
159 |
|
|
afe42d0…
|
ragelink
|
160 |
if (foundMap) { |
|
afe42d0…
|
ragelink
|
161 |
break; |
|
afe42d0…
|
ragelink
|
162 |
} |
|
afe42d0…
|
ragelink
|
163 |
|
|
afe42d0…
|
ragelink
|
164 |
//Check for a star map match, but just hold on to it, |
|
afe42d0…
|
ragelink
|
165 |
//if there is a shorter segment match later in a matching |
|
afe42d0…
|
ragelink
|
166 |
//config, then favor over this star map. |
|
afe42d0…
|
ragelink
|
167 |
if (!foundStarMap && starMap && starMap[nameSegment]) { |
|
afe42d0…
|
ragelink
|
168 |
foundStarMap = starMap[nameSegment]; |
|
afe42d0…
|
ragelink
|
169 |
starI = i; |
|
afe42d0…
|
ragelink
|
170 |
} |
|
afe42d0…
|
ragelink
|
171 |
} |
|
afe42d0…
|
ragelink
|
172 |
|
|
afe42d0…
|
ragelink
|
173 |
if (!foundMap && foundStarMap) { |
|
afe42d0…
|
ragelink
|
174 |
foundMap = foundStarMap; |
|
afe42d0…
|
ragelink
|
175 |
foundI = starI; |
|
afe42d0…
|
ragelink
|
176 |
} |
|
afe42d0…
|
ragelink
|
177 |
|
|
afe42d0…
|
ragelink
|
178 |
if (foundMap) { |
|
afe42d0…
|
ragelink
|
179 |
nameParts.splice(0, foundI, foundMap); |
|
afe42d0…
|
ragelink
|
180 |
name = nameParts.join('/'); |
|
afe42d0…
|
ragelink
|
181 |
} |
|
afe42d0…
|
ragelink
|
182 |
} |
|
afe42d0…
|
ragelink
|
183 |
|
|
afe42d0…
|
ragelink
|
184 |
return name; |
|
afe42d0…
|
ragelink
|
185 |
} |
|
afe42d0…
|
ragelink
|
186 |
|
|
afe42d0…
|
ragelink
|
187 |
function makeRequire(relName, forceSync) { |
|
afe42d0…
|
ragelink
|
188 |
return function () { |
|
afe42d0…
|
ragelink
|
189 |
//A version of a require function that passes a moduleName |
|
afe42d0…
|
ragelink
|
190 |
//value for items that may need to |
|
afe42d0…
|
ragelink
|
191 |
//look up paths relative to the moduleName |
|
afe42d0…
|
ragelink
|
192 |
var args = aps.call(arguments, 0); |
|
afe42d0…
|
ragelink
|
193 |
|
|
afe42d0…
|
ragelink
|
194 |
//If first arg is not require('string'), and there is only |
|
afe42d0…
|
ragelink
|
195 |
//one arg, it is the array form without a callback. Insert |
|
afe42d0…
|
ragelink
|
196 |
//a null so that the following concat is correct. |
|
afe42d0…
|
ragelink
|
197 |
if (typeof args[0] !== 'string' && args.length === 1) { |
|
afe42d0…
|
ragelink
|
198 |
args.push(null); |
|
afe42d0…
|
ragelink
|
199 |
} |
|
afe42d0…
|
ragelink
|
200 |
return req.apply(undef, args.concat([relName, forceSync])); |
|
afe42d0…
|
ragelink
|
201 |
}; |
|
afe42d0…
|
ragelink
|
202 |
} |
|
afe42d0…
|
ragelink
|
203 |
|
|
afe42d0…
|
ragelink
|
204 |
function makeNormalize(relName) { |
|
afe42d0…
|
ragelink
|
205 |
return function (name) { |
|
afe42d0…
|
ragelink
|
206 |
return normalize(name, relName); |
|
afe42d0…
|
ragelink
|
207 |
}; |
|
afe42d0…
|
ragelink
|
208 |
} |
|
afe42d0…
|
ragelink
|
209 |
|
|
afe42d0…
|
ragelink
|
210 |
function makeLoad(depName) { |
|
afe42d0…
|
ragelink
|
211 |
return function (value) { |
|
afe42d0…
|
ragelink
|
212 |
defined[depName] = value; |
|
afe42d0…
|
ragelink
|
213 |
}; |
|
afe42d0…
|
ragelink
|
214 |
} |
|
afe42d0…
|
ragelink
|
215 |
|
|
afe42d0…
|
ragelink
|
216 |
function callDep(name) { |
|
afe42d0…
|
ragelink
|
217 |
if (hasProp(waiting, name)) { |
|
afe42d0…
|
ragelink
|
218 |
var args = waiting[name]; |
|
afe42d0…
|
ragelink
|
219 |
delete waiting[name]; |
|
afe42d0…
|
ragelink
|
220 |
defining[name] = true; |
|
afe42d0…
|
ragelink
|
221 |
main.apply(undef, args); |
|
afe42d0…
|
ragelink
|
222 |
} |
|
afe42d0…
|
ragelink
|
223 |
|
|
afe42d0…
|
ragelink
|
224 |
if (!hasProp(defined, name) && !hasProp(defining, name)) { |
|
afe42d0…
|
ragelink
|
225 |
throw new Error('No ' + name); |
|
afe42d0…
|
ragelink
|
226 |
} |
|
afe42d0…
|
ragelink
|
227 |
return defined[name]; |
|
afe42d0…
|
ragelink
|
228 |
} |
|
afe42d0…
|
ragelink
|
229 |
|
|
afe42d0…
|
ragelink
|
230 |
//Turns a plugin!resource to [plugin, resource] |
|
afe42d0…
|
ragelink
|
231 |
//with the plugin being undefined if the name |
|
afe42d0…
|
ragelink
|
232 |
//did not have a plugin prefix. |
|
afe42d0…
|
ragelink
|
233 |
function splitPrefix(name) { |
|
afe42d0…
|
ragelink
|
234 |
var prefix, |
|
afe42d0…
|
ragelink
|
235 |
index = name ? name.indexOf('!') : -1; |
|
afe42d0…
|
ragelink
|
236 |
if (index > -1) { |
|
afe42d0…
|
ragelink
|
237 |
prefix = name.substring(0, index); |
|
afe42d0…
|
ragelink
|
238 |
name = name.substring(index + 1, name.length); |
|
afe42d0…
|
ragelink
|
239 |
} |
|
afe42d0…
|
ragelink
|
240 |
return [prefix, name]; |
|
afe42d0…
|
ragelink
|
241 |
} |
|
afe42d0…
|
ragelink
|
242 |
|
|
afe42d0…
|
ragelink
|
243 |
//Creates a parts array for a relName where first part is plugin ID, |
|
afe42d0…
|
ragelink
|
244 |
//second part is resource ID. Assumes relName has already been normalized. |
|
afe42d0…
|
ragelink
|
245 |
function makeRelParts(relName) { |
|
afe42d0…
|
ragelink
|
246 |
return relName ? splitPrefix(relName) : []; |
|
afe42d0…
|
ragelink
|
247 |
} |
|
afe42d0…
|
ragelink
|
248 |
|
|
afe42d0…
|
ragelink
|
249 |
/** |
|
afe42d0…
|
ragelink
|
250 |
* Makes a name map, normalizing the name, and using a plugin |
|
afe42d0…
|
ragelink
|
251 |
* for normalization if necessary. Grabs a ref to plugin |
|
afe42d0…
|
ragelink
|
252 |
* too, as an optimization. |
|
afe42d0…
|
ragelink
|
253 |
*/ |
|
afe42d0…
|
ragelink
|
254 |
makeMap = function (name, relParts) { |
|
afe42d0…
|
ragelink
|
255 |
var plugin, |
|
afe42d0…
|
ragelink
|
256 |
parts = splitPrefix(name), |
|
afe42d0…
|
ragelink
|
257 |
prefix = parts[0], |
|
afe42d0…
|
ragelink
|
258 |
relResourceName = relParts[1]; |
|
afe42d0…
|
ragelink
|
259 |
|
|
afe42d0…
|
ragelink
|
260 |
name = parts[1]; |
|
afe42d0…
|
ragelink
|
261 |
|
|
afe42d0…
|
ragelink
|
262 |
if (prefix) { |
|
afe42d0…
|
ragelink
|
263 |
prefix = normalize(prefix, relResourceName); |
|
afe42d0…
|
ragelink
|
264 |
plugin = callDep(prefix); |
|
afe42d0…
|
ragelink
|
265 |
} |
|
afe42d0…
|
ragelink
|
266 |
|
|
afe42d0…
|
ragelink
|
267 |
//Normalize according |
|
afe42d0…
|
ragelink
|
268 |
if (prefix) { |
|
afe42d0…
|
ragelink
|
269 |
if (plugin && plugin.normalize) { |
|
afe42d0…
|
ragelink
|
270 |
name = plugin.normalize(name, makeNormalize(relResourceName)); |
|
afe42d0…
|
ragelink
|
271 |
} else { |
|
afe42d0…
|
ragelink
|
272 |
name = normalize(name, relResourceName); |
|
afe42d0…
|
ragelink
|
273 |
} |
|
afe42d0…
|
ragelink
|
274 |
} else { |
|
afe42d0…
|
ragelink
|
275 |
name = normalize(name, relResourceName); |
|
afe42d0…
|
ragelink
|
276 |
parts = splitPrefix(name); |
|
afe42d0…
|
ragelink
|
277 |
prefix = parts[0]; |
|
afe42d0…
|
ragelink
|
278 |
name = parts[1]; |
|
afe42d0…
|
ragelink
|
279 |
if (prefix) { |
|
afe42d0…
|
ragelink
|
280 |
plugin = callDep(prefix); |
|
afe42d0…
|
ragelink
|
281 |
} |
|
afe42d0…
|
ragelink
|
282 |
} |
|
afe42d0…
|
ragelink
|
283 |
|
|
afe42d0…
|
ragelink
|
284 |
//Using ridiculous property names for space reasons |
|
afe42d0…
|
ragelink
|
285 |
return { |
|
afe42d0…
|
ragelink
|
286 |
f: prefix ? prefix + '!' + name : name, //fullName |
|
afe42d0…
|
ragelink
|
287 |
n: name, |
|
afe42d0…
|
ragelink
|
288 |
pr: prefix, |
|
afe42d0…
|
ragelink
|
289 |
p: plugin |
|
afe42d0…
|
ragelink
|
290 |
}; |
|
afe42d0…
|
ragelink
|
291 |
}; |
|
afe42d0…
|
ragelink
|
292 |
|
|
afe42d0…
|
ragelink
|
293 |
function makeConfig(name) { |
|
afe42d0…
|
ragelink
|
294 |
return function () { |
|
afe42d0…
|
ragelink
|
295 |
return (config && config.config && config.config[name]) || {}; |
|
afe42d0…
|
ragelink
|
296 |
}; |
|
afe42d0…
|
ragelink
|
297 |
} |
|
afe42d0…
|
ragelink
|
298 |
|
|
afe42d0…
|
ragelink
|
299 |
handlers = { |
|
afe42d0…
|
ragelink
|
300 |
require: function (name) { |
|
afe42d0…
|
ragelink
|
301 |
return makeRequire(name); |
|
afe42d0…
|
ragelink
|
302 |
}, |
|
afe42d0…
|
ragelink
|
303 |
exports: function (name) { |
|
afe42d0…
|
ragelink
|
304 |
var e = defined[name]; |
|
afe42d0…
|
ragelink
|
305 |
if (typeof e !== 'undefined') { |
|
afe42d0…
|
ragelink
|
306 |
return e; |
|
afe42d0…
|
ragelink
|
307 |
} else { |
|
afe42d0…
|
ragelink
|
308 |
return (defined[name] = {}); |
|
afe42d0…
|
ragelink
|
309 |
} |
|
afe42d0…
|
ragelink
|
310 |
}, |
|
afe42d0…
|
ragelink
|
311 |
module: function (name) { |
|
afe42d0…
|
ragelink
|
312 |
return { |
|
afe42d0…
|
ragelink
|
313 |
id: name, |
|
afe42d0…
|
ragelink
|
314 |
uri: '', |
|
afe42d0…
|
ragelink
|
315 |
exports: defined[name], |
|
afe42d0…
|
ragelink
|
316 |
config: makeConfig(name) |
|
afe42d0…
|
ragelink
|
317 |
}; |
|
afe42d0…
|
ragelink
|
318 |
} |
|
afe42d0…
|
ragelink
|
319 |
}; |
|
afe42d0…
|
ragelink
|
320 |
|
|
afe42d0…
|
ragelink
|
321 |
main = function (name, deps, callback, relName) { |
|
afe42d0…
|
ragelink
|
322 |
var cjsModule, depName, ret, map, i, relParts, |
|
afe42d0…
|
ragelink
|
323 |
args = [], |
|
afe42d0…
|
ragelink
|
324 |
callbackType = typeof callback, |
|
afe42d0…
|
ragelink
|
325 |
usingExports; |
|
afe42d0…
|
ragelink
|
326 |
|
|
afe42d0…
|
ragelink
|
327 |
//Use name if no relName |
|
afe42d0…
|
ragelink
|
328 |
relName = relName || name; |
|
afe42d0…
|
ragelink
|
329 |
relParts = makeRelParts(relName); |
|
afe42d0…
|
ragelink
|
330 |
|
|
afe42d0…
|
ragelink
|
331 |
//Call the callback to define the module, if necessary. |
|
afe42d0…
|
ragelink
|
332 |
if (callbackType === 'undefined' || callbackType === 'function') { |
|
afe42d0…
|
ragelink
|
333 |
//Pull out the defined dependencies and pass the ordered |
|
afe42d0…
|
ragelink
|
334 |
//values to the callback. |
|
afe42d0…
|
ragelink
|
335 |
//Default to [require, exports, module] if no deps |
|
afe42d0…
|
ragelink
|
336 |
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; |
|
afe42d0…
|
ragelink
|
337 |
for (i = 0; i < deps.length; i += 1) { |
|
afe42d0…
|
ragelink
|
338 |
map = makeMap(deps[i], relParts); |
|
afe42d0…
|
ragelink
|
339 |
depName = map.f; |
|
afe42d0…
|
ragelink
|
340 |
|
|
afe42d0…
|
ragelink
|
341 |
//Fast path CommonJS standard dependencies. |
|
afe42d0…
|
ragelink
|
342 |
if (depName === "require") { |
|
afe42d0…
|
ragelink
|
343 |
args[i] = handlers.require(name); |
|
afe42d0…
|
ragelink
|
344 |
} else if (depName === "exports") { |
|
afe42d0…
|
ragelink
|
345 |
//CommonJS module spec 1.1 |
|
afe42d0…
|
ragelink
|
346 |
args[i] = handlers.exports(name); |
|
afe42d0…
|
ragelink
|
347 |
usingExports = true; |
|
afe42d0…
|
ragelink
|
348 |
} else if (depName === "module") { |
|
afe42d0…
|
ragelink
|
349 |
//CommonJS module spec 1.1 |
|
afe42d0…
|
ragelink
|
350 |
cjsModule = args[i] = handlers.module(name); |
|
afe42d0…
|
ragelink
|
351 |
} else if (hasProp(defined, depName) || |
|
afe42d0…
|
ragelink
|
352 |
hasProp(waiting, depName) || |
|
afe42d0…
|
ragelink
|
353 |
hasProp(defining, depName)) { |
|
afe42d0…
|
ragelink
|
354 |
args[i] = callDep(depName); |
|
afe42d0…
|
ragelink
|
355 |
} else if (map.p) { |
|
afe42d0…
|
ragelink
|
356 |
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); |
|
afe42d0…
|
ragelink
|
357 |
args[i] = defined[depName]; |
|
afe42d0…
|
ragelink
|
358 |
} else { |
|
afe42d0…
|
ragelink
|
359 |
throw new Error(name + ' missing ' + depName); |
|
afe42d0…
|
ragelink
|
360 |
} |
|
afe42d0…
|
ragelink
|
361 |
} |
|
afe42d0…
|
ragelink
|
362 |
|
|
afe42d0…
|
ragelink
|
363 |
ret = callback ? callback.apply(defined[name], args) : undefined; |
|
afe42d0…
|
ragelink
|
364 |
|
|
afe42d0…
|
ragelink
|
365 |
if (name) { |
|
afe42d0…
|
ragelink
|
366 |
//If setting exports via "module" is in play, |
|
afe42d0…
|
ragelink
|
367 |
//favor that over return value and exports. After that, |
|
afe42d0…
|
ragelink
|
368 |
//favor a non-undefined return value over exports use. |
|
afe42d0…
|
ragelink
|
369 |
if (cjsModule && cjsModule.exports !== undef && |
|
afe42d0…
|
ragelink
|
370 |
cjsModule.exports !== defined[name]) { |
|
afe42d0…
|
ragelink
|
371 |
defined[name] = cjsModule.exports; |
|
afe42d0…
|
ragelink
|
372 |
} else if (ret !== undef || !usingExports) { |
|
afe42d0…
|
ragelink
|
373 |
//Use the return value from the function. |
|
afe42d0…
|
ragelink
|
374 |
defined[name] = ret; |
|
afe42d0…
|
ragelink
|
375 |
} |
|
afe42d0…
|
ragelink
|
376 |
} |
|
afe42d0…
|
ragelink
|
377 |
} else if (name) { |
|
afe42d0…
|
ragelink
|
378 |
//May just be an object definition for the module. Only |
|
afe42d0…
|
ragelink
|
379 |
//worry about defining if have a module name. |
|
afe42d0…
|
ragelink
|
380 |
defined[name] = callback; |
|
afe42d0…
|
ragelink
|
381 |
} |
|
afe42d0…
|
ragelink
|
382 |
}; |
|
afe42d0…
|
ragelink
|
383 |
|
|
afe42d0…
|
ragelink
|
384 |
requirejs = require = req = function (deps, callback, relName, forceSync, alt) { |
|
afe42d0…
|
ragelink
|
385 |
if (typeof deps === "string") { |
|
afe42d0…
|
ragelink
|
386 |
if (handlers[deps]) { |
|
afe42d0…
|
ragelink
|
387 |
//callback in this case is really relName |
|
afe42d0…
|
ragelink
|
388 |
return handlers[deps](callback); |
|
afe42d0…
|
ragelink
|
389 |
} |
|
afe42d0…
|
ragelink
|
390 |
//Just return the module wanted. In this scenario, the |
|
afe42d0…
|
ragelink
|
391 |
//deps arg is the module name, and second arg (if passed) |
|
afe42d0…
|
ragelink
|
392 |
//is just the relName. |
|
afe42d0…
|
ragelink
|
393 |
//Normalize module name, if it contains . or .. |
|
afe42d0…
|
ragelink
|
394 |
return callDep(makeMap(deps, makeRelParts(callback)).f); |
|
afe42d0…
|
ragelink
|
395 |
} else if (!deps.splice) { |
|
afe42d0…
|
ragelink
|
396 |
//deps is a config object, not an array. |
|
afe42d0…
|
ragelink
|
397 |
config = deps; |
|
afe42d0…
|
ragelink
|
398 |
if (config.deps) { |
|
afe42d0…
|
ragelink
|
399 |
req(config.deps, config.callback); |
|
afe42d0…
|
ragelink
|
400 |
} |
|
afe42d0…
|
ragelink
|
401 |
if (!callback) { |
|
afe42d0…
|
ragelink
|
402 |
return; |
|
afe42d0…
|
ragelink
|
403 |
} |
|
afe42d0…
|
ragelink
|
404 |
|
|
afe42d0…
|
ragelink
|
405 |
if (callback.splice) { |
|
afe42d0…
|
ragelink
|
406 |
//callback is an array, which means it is a dependency list. |
|
afe42d0…
|
ragelink
|
407 |
//Adjust args if there are dependencies |
|
afe42d0…
|
ragelink
|
408 |
deps = callback; |
|
afe42d0…
|
ragelink
|
409 |
callback = relName; |
|
afe42d0…
|
ragelink
|
410 |
relName = null; |
|
afe42d0…
|
ragelink
|
411 |
} else { |
|
afe42d0…
|
ragelink
|
412 |
deps = undef; |
|
afe42d0…
|
ragelink
|
413 |
} |
|
afe42d0…
|
ragelink
|
414 |
} |
|
afe42d0…
|
ragelink
|
415 |
|
|
afe42d0…
|
ragelink
|
416 |
//Support require(['a']) |
|
afe42d0…
|
ragelink
|
417 |
callback = callback || function () {}; |
|
afe42d0…
|
ragelink
|
418 |
|
|
afe42d0…
|
ragelink
|
419 |
//If relName is a function, it is an errback handler, |
|
afe42d0…
|
ragelink
|
420 |
//so remove it. |
|
afe42d0…
|
ragelink
|
421 |
if (typeof relName === 'function') { |
|
afe42d0…
|
ragelink
|
422 |
relName = forceSync; |
|
afe42d0…
|
ragelink
|
423 |
forceSync = alt; |
|
afe42d0…
|
ragelink
|
424 |
} |
|
afe42d0…
|
ragelink
|
425 |
|
|
afe42d0…
|
ragelink
|
426 |
//Simulate async callback; |
|
afe42d0…
|
ragelink
|
427 |
if (forceSync) { |
|
afe42d0…
|
ragelink
|
428 |
main(undef, deps, callback, relName); |
|
afe42d0…
|
ragelink
|
429 |
} else { |
|
afe42d0…
|
ragelink
|
430 |
//Using a non-zero value because of concern for what old browsers |
|
afe42d0…
|
ragelink
|
431 |
//do, and latest browsers "upgrade" to 4 if lower value is used: |
|
afe42d0…
|
ragelink
|
432 |
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: |
|
afe42d0…
|
ragelink
|
433 |
//If want a value immediately, use require('id') instead -- something |
|
afe42d0…
|
ragelink
|
434 |
//that works in almond on the global level, but not guaranteed and |
|
afe42d0…
|
ragelink
|
435 |
//unlikely to work in other AMD implementations. |
|
afe42d0…
|
ragelink
|
436 |
setTimeout(function () { |
|
afe42d0…
|
ragelink
|
437 |
main(undef, deps, callback, relName); |
|
afe42d0…
|
ragelink
|
438 |
}, 4); |
|
afe42d0…
|
ragelink
|
439 |
} |
|
afe42d0…
|
ragelink
|
440 |
|
|
afe42d0…
|
ragelink
|
441 |
return req; |
|
afe42d0…
|
ragelink
|
442 |
}; |
|
afe42d0…
|
ragelink
|
443 |
|
|
afe42d0…
|
ragelink
|
444 |
/** |
|
afe42d0…
|
ragelink
|
445 |
* Just drops the config on the floor, but returns req in case |
|
afe42d0…
|
ragelink
|
446 |
* the config return value is used. |
|
afe42d0…
|
ragelink
|
447 |
*/ |
|
afe42d0…
|
ragelink
|
448 |
req.config = function (cfg) { |
|
afe42d0…
|
ragelink
|
449 |
return req(cfg); |
|
afe42d0…
|
ragelink
|
450 |
}; |
|
afe42d0…
|
ragelink
|
451 |
|
|
afe42d0…
|
ragelink
|
452 |
/** |
|
afe42d0…
|
ragelink
|
453 |
* Expose module registry for debugging and tooling |
|
afe42d0…
|
ragelink
|
454 |
*/ |
|
afe42d0…
|
ragelink
|
455 |
requirejs._defined = defined; |
|
afe42d0…
|
ragelink
|
456 |
|
|
afe42d0…
|
ragelink
|
457 |
define = function (name, deps, callback) { |
|
afe42d0…
|
ragelink
|
458 |
if (typeof name !== 'string') { |
|
afe42d0…
|
ragelink
|
459 |
throw new Error('See almond README: incorrect module build, no module name'); |
|
afe42d0…
|
ragelink
|
460 |
} |
|
afe42d0…
|
ragelink
|
461 |
|
|
afe42d0…
|
ragelink
|
462 |
//This module may not have dependencies |
|
afe42d0…
|
ragelink
|
463 |
if (!deps.splice) { |
|
afe42d0…
|
ragelink
|
464 |
//deps is not an array, so probably means |
|
afe42d0…
|
ragelink
|
465 |
//an object literal or factory function for |
|
afe42d0…
|
ragelink
|
466 |
//the value. Adjust args. |
|
afe42d0…
|
ragelink
|
467 |
callback = deps; |
|
afe42d0…
|
ragelink
|
468 |
deps = []; |
|
afe42d0…
|
ragelink
|
469 |
} |
|
afe42d0…
|
ragelink
|
470 |
|
|
afe42d0…
|
ragelink
|
471 |
if (!hasProp(defined, name) && !hasProp(waiting, name)) { |
|
afe42d0…
|
ragelink
|
472 |
waiting[name] = [name, deps, callback]; |
|
afe42d0…
|
ragelink
|
473 |
} |
|
afe42d0…
|
ragelink
|
474 |
}; |
|
afe42d0…
|
ragelink
|
475 |
|
|
afe42d0…
|
ragelink
|
476 |
define.amd = { |
|
afe42d0…
|
ragelink
|
477 |
jQuery: true |
|
afe42d0…
|
ragelink
|
478 |
}; |
|
afe42d0…
|
ragelink
|
479 |
}()); |
|
afe42d0…
|
ragelink
|
480 |
|
|
afe42d0…
|
ragelink
|
481 |
S2.requirejs = requirejs;S2.require = require;S2.define = define; |
|
afe42d0…
|
ragelink
|
482 |
} |
|
afe42d0…
|
ragelink
|
483 |
}()); |
|
afe42d0…
|
ragelink
|
484 |
S2.define("almond", function(){}); |
|
afe42d0…
|
ragelink
|
485 |
|
|
afe42d0…
|
ragelink
|
486 |
/* global jQuery:false, $:false */ |
|
afe42d0…
|
ragelink
|
487 |
S2.define('jquery',[],function () { |
|
afe42d0…
|
ragelink
|
488 |
var _$ = jQuery || $; |
|
afe42d0…
|
ragelink
|
489 |
|
|
afe42d0…
|
ragelink
|
490 |
if (_$ == null && console && console.error) { |
|
afe42d0…
|
ragelink
|
491 |
console.error( |
|
afe42d0…
|
ragelink
|
492 |
'Select2: An instance of jQuery or a jQuery-compatible library was not ' + |
|
afe42d0…
|
ragelink
|
493 |
'found. Make sure that you are including jQuery before Select2 on your ' + |
|
afe42d0…
|
ragelink
|
494 |
'web page.' |
|
afe42d0…
|
ragelink
|
495 |
); |
|
afe42d0…
|
ragelink
|
496 |
} |
|
afe42d0…
|
ragelink
|
497 |
|
|
afe42d0…
|
ragelink
|
498 |
return _$; |
|
afe42d0…
|
ragelink
|
499 |
}); |
|
afe42d0…
|
ragelink
|
500 |
|
|
afe42d0…
|
ragelink
|
501 |
S2.define('select2/utils',[ |
|
afe42d0…
|
ragelink
|
502 |
'jquery' |
|
afe42d0…
|
ragelink
|
503 |
], function ($) { |
|
afe42d0…
|
ragelink
|
504 |
var Utils = {}; |
|
afe42d0…
|
ragelink
|
505 |
|
|
afe42d0…
|
ragelink
|
506 |
Utils.Extend = function (ChildClass, SuperClass) { |
|
afe42d0…
|
ragelink
|
507 |
var __hasProp = {}.hasOwnProperty; |
|
afe42d0…
|
ragelink
|
508 |
|
|
afe42d0…
|
ragelink
|
509 |
function BaseConstructor () { |
|
afe42d0…
|
ragelink
|
510 |
this.constructor = ChildClass; |
|
afe42d0…
|
ragelink
|
511 |
} |
|
afe42d0…
|
ragelink
|
512 |
|
|
afe42d0…
|
ragelink
|
513 |
for (var key in SuperClass) { |
|
afe42d0…
|
ragelink
|
514 |
if (__hasProp.call(SuperClass, key)) { |
|
afe42d0…
|
ragelink
|
515 |
ChildClass[key] = SuperClass[key]; |
|
afe42d0…
|
ragelink
|
516 |
} |
|
afe42d0…
|
ragelink
|
517 |
} |
|
afe42d0…
|
ragelink
|
518 |
|
|
afe42d0…
|
ragelink
|
519 |
BaseConstructor.prototype = SuperClass.prototype; |
|
afe42d0…
|
ragelink
|
520 |
ChildClass.prototype = new BaseConstructor(); |
|
afe42d0…
|
ragelink
|
521 |
ChildClass.__super__ = SuperClass.prototype; |
|
afe42d0…
|
ragelink
|
522 |
|
|
afe42d0…
|
ragelink
|
523 |
return ChildClass; |
|
afe42d0…
|
ragelink
|
524 |
}; |
|
afe42d0…
|
ragelink
|
525 |
|
|
afe42d0…
|
ragelink
|
526 |
function getMethods (theClass) { |
|
afe42d0…
|
ragelink
|
527 |
var proto = theClass.prototype; |
|
afe42d0…
|
ragelink
|
528 |
|
|
afe42d0…
|
ragelink
|
529 |
var methods = []; |
|
afe42d0…
|
ragelink
|
530 |
|
|
afe42d0…
|
ragelink
|
531 |
for (var methodName in proto) { |
|
afe42d0…
|
ragelink
|
532 |
var m = proto[methodName]; |
|
afe42d0…
|
ragelink
|
533 |
|
|
afe42d0…
|
ragelink
|
534 |
if (typeof m !== 'function') { |
|
afe42d0…
|
ragelink
|
535 |
continue; |
|
afe42d0…
|
ragelink
|
536 |
} |
|
afe42d0…
|
ragelink
|
537 |
|
|
afe42d0…
|
ragelink
|
538 |
if (methodName === 'constructor') { |
|
afe42d0…
|
ragelink
|
539 |
continue; |
|
afe42d0…
|
ragelink
|
540 |
} |
|
afe42d0…
|
ragelink
|
541 |
|
|
afe42d0…
|
ragelink
|
542 |
methods.push(methodName); |
|
afe42d0…
|
ragelink
|
543 |
} |
|
afe42d0…
|
ragelink
|
544 |
|
|
afe42d0…
|
ragelink
|
545 |
return methods; |
|
afe42d0…
|
ragelink
|
546 |
} |
|
afe42d0…
|
ragelink
|
547 |
|
|
afe42d0…
|
ragelink
|
548 |
Utils.Decorate = function (SuperClass, DecoratorClass) { |
|
afe42d0…
|
ragelink
|
549 |
var decoratedMethods = getMethods(DecoratorClass); |
|
afe42d0…
|
ragelink
|
550 |
var superMethods = getMethods(SuperClass); |
|
afe42d0…
|
ragelink
|
551 |
|
|
afe42d0…
|
ragelink
|
552 |
function DecoratedClass () { |
|
afe42d0…
|
ragelink
|
553 |
var unshift = Array.prototype.unshift; |
|
afe42d0…
|
ragelink
|
554 |
|
|
afe42d0…
|
ragelink
|
555 |
var argCount = DecoratorClass.prototype.constructor.length; |
|
afe42d0…
|
ragelink
|
556 |
|
|
afe42d0…
|
ragelink
|
557 |
var calledConstructor = SuperClass.prototype.constructor; |
|
afe42d0…
|
ragelink
|
558 |
|
|
afe42d0…
|
ragelink
|
559 |
if (argCount > 0) { |
|
afe42d0…
|
ragelink
|
560 |
unshift.call(arguments, SuperClass.prototype.constructor); |
|
afe42d0…
|
ragelink
|
561 |
|
|
afe42d0…
|
ragelink
|
562 |
calledConstructor = DecoratorClass.prototype.constructor; |
|
afe42d0…
|
ragelink
|
563 |
} |
|
afe42d0…
|
ragelink
|
564 |
|
|
afe42d0…
|
ragelink
|
565 |
calledConstructor.apply(this, arguments); |
|
afe42d0…
|
ragelink
|
566 |
} |
|
afe42d0…
|
ragelink
|
567 |
|
|
afe42d0…
|
ragelink
|
568 |
DecoratorClass.displayName = SuperClass.displayName; |
|
afe42d0…
|
ragelink
|
569 |
|
|
afe42d0…
|
ragelink
|
570 |
function ctr () { |
|
afe42d0…
|
ragelink
|
571 |
this.constructor = DecoratedClass; |
|
afe42d0…
|
ragelink
|
572 |
} |
|
afe42d0…
|
ragelink
|
573 |
|
|
afe42d0…
|
ragelink
|
574 |
DecoratedClass.prototype = new ctr(); |
|
afe42d0…
|
ragelink
|
575 |
|
|
afe42d0…
|
ragelink
|
576 |
for (var m = 0; m < superMethods.length; m++) { |
|
afe42d0…
|
ragelink
|
577 |
var superMethod = superMethods[m]; |
|
afe42d0…
|
ragelink
|
578 |
|
|
afe42d0…
|
ragelink
|
579 |
DecoratedClass.prototype[superMethod] = |
|
afe42d0…
|
ragelink
|
580 |
SuperClass.prototype[superMethod]; |
|
afe42d0…
|
ragelink
|
581 |
} |
|
afe42d0…
|
ragelink
|
582 |
|
|
afe42d0…
|
ragelink
|
583 |
var calledMethod = function (methodName) { |
|
afe42d0…
|
ragelink
|
584 |
// Stub out the original method if it's not decorating an actual method |
|
afe42d0…
|
ragelink
|
585 |
var originalMethod = function () {}; |
|
afe42d0…
|
ragelink
|
586 |
|
|
afe42d0…
|
ragelink
|
587 |
if (methodName in DecoratedClass.prototype) { |
|
afe42d0…
|
ragelink
|
588 |
originalMethod = DecoratedClass.prototype[methodName]; |
|
afe42d0…
|
ragelink
|
589 |
} |
|
afe42d0…
|
ragelink
|
590 |
|
|
afe42d0…
|
ragelink
|
591 |
var decoratedMethod = DecoratorClass.prototype[methodName]; |
|
afe42d0…
|
ragelink
|
592 |
|
|
afe42d0…
|
ragelink
|
593 |
return function () { |
|
afe42d0…
|
ragelink
|
594 |
var unshift = Array.prototype.unshift; |
|
afe42d0…
|
ragelink
|
595 |
|
|
afe42d0…
|
ragelink
|
596 |
unshift.call(arguments, originalMethod); |
|
afe42d0…
|
ragelink
|
597 |
|
|
afe42d0…
|
ragelink
|
598 |
return decoratedMethod.apply(this, arguments); |
|
afe42d0…
|
ragelink
|
599 |
}; |
|
afe42d0…
|
ragelink
|
600 |
}; |
|
afe42d0…
|
ragelink
|
601 |
|
|
afe42d0…
|
ragelink
|
602 |
for (var d = 0; d < decoratedMethods.length; d++) { |
|
afe42d0…
|
ragelink
|
603 |
var decoratedMethod = decoratedMethods[d]; |
|
afe42d0…
|
ragelink
|
604 |
|
|
afe42d0…
|
ragelink
|
605 |
DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); |
|
afe42d0…
|
ragelink
|
606 |
} |
|
afe42d0…
|
ragelink
|
607 |
|
|
afe42d0…
|
ragelink
|
608 |
return DecoratedClass; |
|
afe42d0…
|
ragelink
|
609 |
}; |
|
afe42d0…
|
ragelink
|
610 |
|
|
afe42d0…
|
ragelink
|
611 |
var Observable = function () { |
|
afe42d0…
|
ragelink
|
612 |
this.listeners = {}; |
|
afe42d0…
|
ragelink
|
613 |
}; |
|
afe42d0…
|
ragelink
|
614 |
|
|
afe42d0…
|
ragelink
|
615 |
Observable.prototype.on = function (event, callback) { |
|
afe42d0…
|
ragelink
|
616 |
this.listeners = this.listeners || {}; |
|
afe42d0…
|
ragelink
|
617 |
|
|
afe42d0…
|
ragelink
|
618 |
if (event in this.listeners) { |
|
afe42d0…
|
ragelink
|
619 |
this.listeners[event].push(callback); |
|
afe42d0…
|
ragelink
|
620 |
} else { |
|
afe42d0…
|
ragelink
|
621 |
this.listeners[event] = [callback]; |
|
afe42d0…
|
ragelink
|
622 |
} |
|
afe42d0…
|
ragelink
|
623 |
}; |
|
afe42d0…
|
ragelink
|
624 |
|
|
afe42d0…
|
ragelink
|
625 |
Observable.prototype.trigger = function (event) { |
|
afe42d0…
|
ragelink
|
626 |
var slice = Array.prototype.slice; |
|
afe42d0…
|
ragelink
|
627 |
var params = slice.call(arguments, 1); |
|
afe42d0…
|
ragelink
|
628 |
|
|
afe42d0…
|
ragelink
|
629 |
this.listeners = this.listeners || {}; |
|
afe42d0…
|
ragelink
|
630 |
|
|
afe42d0…
|
ragelink
|
631 |
// Params should always come in as an array |
|
afe42d0…
|
ragelink
|
632 |
if (params == null) { |
|
afe42d0…
|
ragelink
|
633 |
params = []; |
|
afe42d0…
|
ragelink
|
634 |
} |
|
afe42d0…
|
ragelink
|
635 |
|
|
afe42d0…
|
ragelink
|
636 |
// If there are no arguments to the event, use a temporary object |
|
afe42d0…
|
ragelink
|
637 |
if (params.length === 0) { |
|
afe42d0…
|
ragelink
|
638 |
params.push({}); |
|
afe42d0…
|
ragelink
|
639 |
} |
|
afe42d0…
|
ragelink
|
640 |
|
|
afe42d0…
|
ragelink
|
641 |
// Set the `_type` of the first object to the event |
|
afe42d0…
|
ragelink
|
642 |
params[0]._type = event; |
|
afe42d0…
|
ragelink
|
643 |
|
|
afe42d0…
|
ragelink
|
644 |
if (event in this.listeners) { |
|
afe42d0…
|
ragelink
|
645 |
this.invoke(this.listeners[event], slice.call(arguments, 1)); |
|
afe42d0…
|
ragelink
|
646 |
} |
|
afe42d0…
|
ragelink
|
647 |
|
|
afe42d0…
|
ragelink
|
648 |
if ('*' in this.listeners) { |
|
afe42d0…
|
ragelink
|
649 |
this.invoke(this.listeners['*'], arguments); |
|
afe42d0…
|
ragelink
|
650 |
} |
|
afe42d0…
|
ragelink
|
651 |
}; |
|
afe42d0…
|
ragelink
|
652 |
|
|
afe42d0…
|
ragelink
|
653 |
Observable.prototype.invoke = function (listeners, params) { |
|
afe42d0…
|
ragelink
|
654 |
for (var i = 0, len = listeners.length; i < len; i++) { |
|
afe42d0…
|
ragelink
|
655 |
listeners[i].apply(this, params); |
|
afe42d0…
|
ragelink
|
656 |
} |
|
afe42d0…
|
ragelink
|
657 |
}; |
|
afe42d0…
|
ragelink
|
658 |
|
|
afe42d0…
|
ragelink
|
659 |
Utils.Observable = Observable; |
|
afe42d0…
|
ragelink
|
660 |
|
|
afe42d0…
|
ragelink
|
661 |
Utils.generateChars = function (length) { |
|
afe42d0…
|
ragelink
|
662 |
var chars = ''; |
|
afe42d0…
|
ragelink
|
663 |
|
|
afe42d0…
|
ragelink
|
664 |
for (var i = 0; i < length; i++) { |
|
afe42d0…
|
ragelink
|
665 |
var randomChar = Math.floor(Math.random() * 36); |
|
afe42d0…
|
ragelink
|
666 |
chars += randomChar.toString(36); |
|
afe42d0…
|
ragelink
|
667 |
} |
|
afe42d0…
|
ragelink
|
668 |
|
|
afe42d0…
|
ragelink
|
669 |
return chars; |
|
afe42d0…
|
ragelink
|
670 |
}; |
|
afe42d0…
|
ragelink
|
671 |
|
|
afe42d0…
|
ragelink
|
672 |
Utils.bind = function (func, context) { |
|
afe42d0…
|
ragelink
|
673 |
return function () { |
|
afe42d0…
|
ragelink
|
674 |
func.apply(context, arguments); |
|
afe42d0…
|
ragelink
|
675 |
}; |
|
afe42d0…
|
ragelink
|
676 |
}; |
|
afe42d0…
|
ragelink
|
677 |
|
|
afe42d0…
|
ragelink
|
678 |
Utils._convertData = function (data) { |
|
afe42d0…
|
ragelink
|
679 |
for (var originalKey in data) { |
|
afe42d0…
|
ragelink
|
680 |
var keys = originalKey.split('-'); |
|
afe42d0…
|
ragelink
|
681 |
|
|
afe42d0…
|
ragelink
|
682 |
var dataLevel = data; |
|
afe42d0…
|
ragelink
|
683 |
|
|
afe42d0…
|
ragelink
|
684 |
if (keys.length === 1) { |
|
afe42d0…
|
ragelink
|
685 |
continue; |
|
afe42d0…
|
ragelink
|
686 |
} |
|
afe42d0…
|
ragelink
|
687 |
|
|
afe42d0…
|
ragelink
|
688 |
for (var k = 0; k < keys.length; k++) { |
|
afe42d0…
|
ragelink
|
689 |
var key = keys[k]; |
|
afe42d0…
|
ragelink
|
690 |
|
|
afe42d0…
|
ragelink
|
691 |
// Lowercase the first letter |
|
afe42d0…
|
ragelink
|
692 |
// By default, dash-separated becomes camelCase |
|
afe42d0…
|
ragelink
|
693 |
key = key.substring(0, 1).toLowerCase() + key.substring(1); |
|
afe42d0…
|
ragelink
|
694 |
|
|
afe42d0…
|
ragelink
|
695 |
if (!(key in dataLevel)) { |
|
afe42d0…
|
ragelink
|
696 |
dataLevel[key] = {}; |
|
afe42d0…
|
ragelink
|
697 |
} |
|
afe42d0…
|
ragelink
|
698 |
|
|
afe42d0…
|
ragelink
|
699 |
if (k == keys.length - 1) { |
|
afe42d0…
|
ragelink
|
700 |
dataLevel[key] = data[originalKey]; |
|
afe42d0…
|
ragelink
|
701 |
} |
|
afe42d0…
|
ragelink
|
702 |
|
|
afe42d0…
|
ragelink
|
703 |
dataLevel = dataLevel[key]; |
|
afe42d0…
|
ragelink
|
704 |
} |
|
afe42d0…
|
ragelink
|
705 |
|
|
afe42d0…
|
ragelink
|
706 |
delete data[originalKey]; |
|
afe42d0…
|
ragelink
|
707 |
} |
|
afe42d0…
|
ragelink
|
708 |
|
|
afe42d0…
|
ragelink
|
709 |
return data; |
|
afe42d0…
|
ragelink
|
710 |
}; |
|
afe42d0…
|
ragelink
|
711 |
|
|
afe42d0…
|
ragelink
|
712 |
Utils.hasScroll = function (index, el) { |
|
afe42d0…
|
ragelink
|
713 |
// Adapted from the function created by @ShadowScripter |
|
afe42d0…
|
ragelink
|
714 |
// and adapted by @BillBarry on the Stack Exchange Code Review website. |
|
afe42d0…
|
ragelink
|
715 |
// The original code can be found at |
|
afe42d0…
|
ragelink
|
716 |
// http://codereview.stackexchange.com/q/13338 |
|
afe42d0…
|
ragelink
|
717 |
// and was designed to be used with the Sizzle selector engine. |
|
afe42d0…
|
ragelink
|
718 |
|
|
afe42d0…
|
ragelink
|
719 |
var $el = $(el); |
|
afe42d0…
|
ragelink
|
720 |
var overflowX = el.style.overflowX; |
|
afe42d0…
|
ragelink
|
721 |
var overflowY = el.style.overflowY; |
|
afe42d0…
|
ragelink
|
722 |
|
|
afe42d0…
|
ragelink
|
723 |
//Check both x and y declarations |
|
afe42d0…
|
ragelink
|
724 |
if (overflowX === overflowY && |
|
afe42d0…
|
ragelink
|
725 |
(overflowY === 'hidden' || overflowY === 'visible')) { |
|
afe42d0…
|
ragelink
|
726 |
return false; |
|
afe42d0…
|
ragelink
|
727 |
} |
|
afe42d0…
|
ragelink
|
728 |
|
|
afe42d0…
|
ragelink
|
729 |
if (overflowX === 'scroll' || overflowY === 'scroll') { |
|
afe42d0…
|
ragelink
|
730 |
return true; |
|
afe42d0…
|
ragelink
|
731 |
} |
|
afe42d0…
|
ragelink
|
732 |
|
|
afe42d0…
|
ragelink
|
733 |
return ($el.innerHeight() < el.scrollHeight || |
|
afe42d0…
|
ragelink
|
734 |
$el.innerWidth() < el.scrollWidth); |
|
afe42d0…
|
ragelink
|
735 |
}; |
|
afe42d0…
|
ragelink
|
736 |
|
|
afe42d0…
|
ragelink
|
737 |
Utils.escapeMarkup = function (markup) { |
|
afe42d0…
|
ragelink
|
738 |
var replaceMap = { |
|
afe42d0…
|
ragelink
|
739 |
'\\': '\', |
|
afe42d0…
|
ragelink
|
740 |
'&': '&', |
|
afe42d0…
|
ragelink
|
741 |
'<': '<', |
|
afe42d0…
|
ragelink
|
742 |
'>': '>', |
|
afe42d0…
|
ragelink
|
743 |
'"': '"', |
|
afe42d0…
|
ragelink
|
744 |
'\'': ''', |
|
afe42d0…
|
ragelink
|
745 |
'/': '/' |
|
afe42d0…
|
ragelink
|
746 |
}; |
|
afe42d0…
|
ragelink
|
747 |
|
|
afe42d0…
|
ragelink
|
748 |
// Do not try to escape the markup if it's not a string |
|
afe42d0…
|
ragelink
|
749 |
if (typeof markup !== 'string') { |
|
afe42d0…
|
ragelink
|
750 |
return markup; |
|
afe42d0…
|
ragelink
|
751 |
} |
|
afe42d0…
|
ragelink
|
752 |
|
|
afe42d0…
|
ragelink
|
753 |
return String(markup).replace(/[&<>"'\/\\]/g, function (match) { |
|
afe42d0…
|
ragelink
|
754 |
return replaceMap[match]; |
|
afe42d0…
|
ragelink
|
755 |
}); |
|
afe42d0…
|
ragelink
|
756 |
}; |
|
afe42d0…
|
ragelink
|
757 |
|
|
afe42d0…
|
ragelink
|
758 |
// Append an array of jQuery nodes to a given element. |
|
afe42d0…
|
ragelink
|
759 |
Utils.appendMany = function ($element, $nodes) { |
|
afe42d0…
|
ragelink
|
760 |
// jQuery 1.7.x does not support $.fn.append() with an array |
|
afe42d0…
|
ragelink
|
761 |
// Fall back to a jQuery object collection using $.fn.add() |
|
afe42d0…
|
ragelink
|
762 |
if ($.fn.jquery.substr(0, 3) === '1.7') { |
|
afe42d0…
|
ragelink
|
763 |
var $jqNodes = $(); |
|
afe42d0…
|
ragelink
|
764 |
|
|
afe42d0…
|
ragelink
|
765 |
$.map($nodes, function (node) { |
|
afe42d0…
|
ragelink
|
766 |
$jqNodes = $jqNodes.add(node); |
|
afe42d0…
|
ragelink
|
767 |
}); |
|
afe42d0…
|
ragelink
|
768 |
|
|
afe42d0…
|
ragelink
|
769 |
$nodes = $jqNodes; |
|
afe42d0…
|
ragelink
|
770 |
} |
|
afe42d0…
|
ragelink
|
771 |
|
|
afe42d0…
|
ragelink
|
772 |
$element.append($nodes); |
|
afe42d0…
|
ragelink
|
773 |
}; |
|
afe42d0…
|
ragelink
|
774 |
|
|
afe42d0…
|
ragelink
|
775 |
// Cache objects in Utils.__cache instead of $.data (see #4346) |
|
afe42d0…
|
ragelink
|
776 |
Utils.__cache = {}; |
|
afe42d0…
|
ragelink
|
777 |
|
|
afe42d0…
|
ragelink
|
778 |
var id = 0; |
|
afe42d0…
|
ragelink
|
779 |
Utils.GetUniqueElementId = function (element) { |
|
afe42d0…
|
ragelink
|
780 |
// Get a unique element Id. If element has no id, |
|
afe42d0…
|
ragelink
|
781 |
// creates a new unique number, stores it in the id |
|
afe42d0…
|
ragelink
|
782 |
// attribute and returns the new id. |
|
afe42d0…
|
ragelink
|
783 |
// If an id already exists, it simply returns it. |
|
afe42d0…
|
ragelink
|
784 |
|
|
afe42d0…
|
ragelink
|
785 |
var select2Id = element.getAttribute('data-select2-id'); |
|
afe42d0…
|
ragelink
|
786 |
if (select2Id == null) { |
|
afe42d0…
|
ragelink
|
787 |
// If element has id, use it. |
|
afe42d0…
|
ragelink
|
788 |
if (element.id) { |
|
afe42d0…
|
ragelink
|
789 |
select2Id = element.id; |
|
afe42d0…
|
ragelink
|
790 |
element.setAttribute('data-select2-id', select2Id); |
|
afe42d0…
|
ragelink
|
791 |
} else { |
|
afe42d0…
|
ragelink
|
792 |
element.setAttribute('data-select2-id', ++id); |
|
afe42d0…
|
ragelink
|
793 |
select2Id = id.toString(); |
|
afe42d0…
|
ragelink
|
794 |
} |
|
afe42d0…
|
ragelink
|
795 |
} |
|
afe42d0…
|
ragelink
|
796 |
return select2Id; |
|
afe42d0…
|
ragelink
|
797 |
}; |
|
afe42d0…
|
ragelink
|
798 |
|
|
afe42d0…
|
ragelink
|
799 |
Utils.StoreData = function (element, name, value) { |
|
afe42d0…
|
ragelink
|
800 |
// Stores an item in the cache for a specified element. |
|
afe42d0…
|
ragelink
|
801 |
// name is the cache key. |
|
afe42d0…
|
ragelink
|
802 |
var id = Utils.GetUniqueElementId(element); |
|
afe42d0…
|
ragelink
|
803 |
if (!Utils.__cache[id]) { |
|
afe42d0…
|
ragelink
|
804 |
Utils.__cache[id] = {}; |
|
afe42d0…
|
ragelink
|
805 |
} |
|
afe42d0…
|
ragelink
|
806 |
|
|
afe42d0…
|
ragelink
|
807 |
Utils.__cache[id][name] = value; |
|
afe42d0…
|
ragelink
|
808 |
}; |
|
afe42d0…
|
ragelink
|
809 |
|
|
afe42d0…
|
ragelink
|
810 |
Utils.GetData = function (element, name) { |
|
afe42d0…
|
ragelink
|
811 |
// Retrieves a value from the cache by its key (name) |
|
afe42d0…
|
ragelink
|
812 |
// name is optional. If no name specified, return |
|
afe42d0…
|
ragelink
|
813 |
// all cache items for the specified element. |
|
afe42d0…
|
ragelink
|
814 |
// and for a specified element. |
|
afe42d0…
|
ragelink
|
815 |
var id = Utils.GetUniqueElementId(element); |
|
afe42d0…
|
ragelink
|
816 |
if (name) { |
|
afe42d0…
|
ragelink
|
817 |
if (Utils.__cache[id]) { |
|
afe42d0…
|
ragelink
|
818 |
if (Utils.__cache[id][name] != null) { |
|
afe42d0…
|
ragelink
|
819 |
return Utils.__cache[id][name]; |
|
afe42d0…
|
ragelink
|
820 |
} |
|
afe42d0…
|
ragelink
|
821 |
return $(element).data(name); // Fallback to HTML5 data attribs. |
|
afe42d0…
|
ragelink
|
822 |
} |
|
afe42d0…
|
ragelink
|
823 |
return $(element).data(name); // Fallback to HTML5 data attribs. |
|
afe42d0…
|
ragelink
|
824 |
} else { |
|
afe42d0…
|
ragelink
|
825 |
return Utils.__cache[id]; |
|
afe42d0…
|
ragelink
|
826 |
} |
|
afe42d0…
|
ragelink
|
827 |
}; |
|
afe42d0…
|
ragelink
|
828 |
|
|
afe42d0…
|
ragelink
|
829 |
Utils.RemoveData = function (element) { |
|
afe42d0…
|
ragelink
|
830 |
// Removes all cached items for a specified element. |
|
afe42d0…
|
ragelink
|
831 |
var id = Utils.GetUniqueElementId(element); |
|
afe42d0…
|
ragelink
|
832 |
if (Utils.__cache[id] != null) { |
|
afe42d0…
|
ragelink
|
833 |
delete Utils.__cache[id]; |
|
afe42d0…
|
ragelink
|
834 |
} |
|
afe42d0…
|
ragelink
|
835 |
|
|
afe42d0…
|
ragelink
|
836 |
element.removeAttribute('data-select2-id'); |
|
afe42d0…
|
ragelink
|
837 |
}; |
|
afe42d0…
|
ragelink
|
838 |
|
|
afe42d0…
|
ragelink
|
839 |
return Utils; |
|
afe42d0…
|
ragelink
|
840 |
}); |
|
afe42d0…
|
ragelink
|
841 |
|
|
afe42d0…
|
ragelink
|
842 |
S2.define('select2/results',[ |
|
afe42d0…
|
ragelink
|
843 |
'jquery', |
|
afe42d0…
|
ragelink
|
844 |
'./utils' |
|
afe42d0…
|
ragelink
|
845 |
], function ($, Utils) { |
|
afe42d0…
|
ragelink
|
846 |
function Results ($element, options, dataAdapter) { |
|
afe42d0…
|
ragelink
|
847 |
this.$element = $element; |
|
afe42d0…
|
ragelink
|
848 |
this.data = dataAdapter; |
|
afe42d0…
|
ragelink
|
849 |
this.options = options; |
|
afe42d0…
|
ragelink
|
850 |
|
|
afe42d0…
|
ragelink
|
851 |
Results.__super__.constructor.call(this); |
|
afe42d0…
|
ragelink
|
852 |
} |
|
afe42d0…
|
ragelink
|
853 |
|
|
afe42d0…
|
ragelink
|
854 |
Utils.Extend(Results, Utils.Observable); |
|
afe42d0…
|
ragelink
|
855 |
|
|
afe42d0…
|
ragelink
|
856 |
Results.prototype.render = function () { |
|
afe42d0…
|
ragelink
|
857 |
var $results = $( |
|
afe42d0…
|
ragelink
|
858 |
'<ul class="select2-results__options" role="listbox"></ul>' |
|
afe42d0…
|
ragelink
|
859 |
); |
|
afe42d0…
|
ragelink
|
860 |
|
|
afe42d0…
|
ragelink
|
861 |
if (this.options.get('multiple')) { |
|
afe42d0…
|
ragelink
|
862 |
$results.attr('aria-multiselectable', 'true'); |
|
afe42d0…
|
ragelink
|
863 |
} |
|
afe42d0…
|
ragelink
|
864 |
|
|
afe42d0…
|
ragelink
|
865 |
this.$results = $results; |
|
afe42d0…
|
ragelink
|
866 |
|
|
afe42d0…
|
ragelink
|
867 |
return $results; |
|
afe42d0…
|
ragelink
|
868 |
}; |
|
afe42d0…
|
ragelink
|
869 |
|
|
afe42d0…
|
ragelink
|
870 |
Results.prototype.clear = function () { |
|
afe42d0…
|
ragelink
|
871 |
this.$results.empty(); |
|
afe42d0…
|
ragelink
|
872 |
}; |
|
afe42d0…
|
ragelink
|
873 |
|
|
afe42d0…
|
ragelink
|
874 |
Results.prototype.displayMessage = function (params) { |
|
afe42d0…
|
ragelink
|
875 |
var escapeMarkup = this.options.get('escapeMarkup'); |
|
afe42d0…
|
ragelink
|
876 |
|
|
afe42d0…
|
ragelink
|
877 |
this.clear(); |
|
afe42d0…
|
ragelink
|
878 |
this.hideLoading(); |
|
afe42d0…
|
ragelink
|
879 |
|
|
afe42d0…
|
ragelink
|
880 |
var $message = $( |
|
afe42d0…
|
ragelink
|
881 |
'<li role="alert" aria-live="assertive"' + |
|
afe42d0…
|
ragelink
|
882 |
' class="select2-results__option"></li>' |
|
afe42d0…
|
ragelink
|
883 |
); |
|
afe42d0…
|
ragelink
|
884 |
|
|
afe42d0…
|
ragelink
|
885 |
var message = this.options.get('translations').get(params.message); |
|
afe42d0…
|
ragelink
|
886 |
|
|
afe42d0…
|
ragelink
|
887 |
$message.append( |
|
afe42d0…
|
ragelink
|
888 |
escapeMarkup( |
|
afe42d0…
|
ragelink
|
889 |
message(params.args) |
|
afe42d0…
|
ragelink
|
890 |
) |
|
afe42d0…
|
ragelink
|
891 |
); |
|
afe42d0…
|
ragelink
|
892 |
|
|
afe42d0…
|
ragelink
|
893 |
$message[0].className += ' select2-results__message'; |
|
afe42d0…
|
ragelink
|
894 |
|
|
afe42d0…
|
ragelink
|
895 |
this.$results.append($message); |
|
afe42d0…
|
ragelink
|
896 |
}; |
|
afe42d0…
|
ragelink
|
897 |
|
|
afe42d0…
|
ragelink
|
898 |
Results.prototype.hideMessages = function () { |
|
afe42d0…
|
ragelink
|
899 |
this.$results.find('.select2-results__message').remove(); |
|
afe42d0…
|
ragelink
|
900 |
}; |
|
afe42d0…
|
ragelink
|
901 |
|
|
afe42d0…
|
ragelink
|
902 |
Results.prototype.append = function (data) { |
|
afe42d0…
|
ragelink
|
903 |
this.hideLoading(); |
|
afe42d0…
|
ragelink
|
904 |
|
|
afe42d0…
|
ragelink
|
905 |
var $options = []; |
|
afe42d0…
|
ragelink
|
906 |
|
|
afe42d0…
|
ragelink
|
907 |
if (data.results == null || data.results.length === 0) { |
|
afe42d0…
|
ragelink
|
908 |
if (this.$results.children().length === 0) { |
|
afe42d0…
|
ragelink
|
909 |
this.trigger('results:message', { |
|
afe42d0…
|
ragelink
|
910 |
message: 'noResults' |
|
afe42d0…
|
ragelink
|
911 |
}); |
|
afe42d0…
|
ragelink
|
912 |
} |
|
afe42d0…
|
ragelink
|
913 |
|
|
afe42d0…
|
ragelink
|
914 |
return; |
|
afe42d0…
|
ragelink
|
915 |
} |
|
afe42d0…
|
ragelink
|
916 |
|
|
afe42d0…
|
ragelink
|
917 |
data.results = this.sort(data.results); |
|
afe42d0…
|
ragelink
|
918 |
|
|
afe42d0…
|
ragelink
|
919 |
for (var d = 0; d < data.results.length; d++) { |
|
afe42d0…
|
ragelink
|
920 |
var item = data.results[d]; |
|
afe42d0…
|
ragelink
|
921 |
|
|
afe42d0…
|
ragelink
|
922 |
var $option = this.option(item); |
|
afe42d0…
|
ragelink
|
923 |
|
|
afe42d0…
|
ragelink
|
924 |
$options.push($option); |
|
afe42d0…
|
ragelink
|
925 |
} |
|
afe42d0…
|
ragelink
|
926 |
|
|
afe42d0…
|
ragelink
|
927 |
this.$results.append($options); |
|
afe42d0…
|
ragelink
|
928 |
}; |
|
afe42d0…
|
ragelink
|
929 |
|
|
afe42d0…
|
ragelink
|
930 |
Results.prototype.position = function ($results, $dropdown) { |
|
afe42d0…
|
ragelink
|
931 |
var $resultsContainer = $dropdown.find('.select2-results'); |
|
afe42d0…
|
ragelink
|
932 |
$resultsContainer.append($results); |
|
afe42d0…
|
ragelink
|
933 |
}; |
|
afe42d0…
|
ragelink
|
934 |
|
|
afe42d0…
|
ragelink
|
935 |
Results.prototype.sort = function (data) { |
|
afe42d0…
|
ragelink
|
936 |
var sorter = this.options.get('sorter'); |
|
afe42d0…
|
ragelink
|
937 |
|
|
afe42d0…
|
ragelink
|
938 |
return sorter(data); |
|
afe42d0…
|
ragelink
|
939 |
}; |
|
afe42d0…
|
ragelink
|
940 |
|
|
afe42d0…
|
ragelink
|
941 |
Results.prototype.highlightFirstItem = function () { |
|
afe42d0…
|
ragelink
|
942 |
var $options = this.$results |
|
afe42d0…
|
ragelink
|
943 |
.find('.select2-results__option[aria-selected]'); |
|
afe42d0…
|
ragelink
|
944 |
|
|
afe42d0…
|
ragelink
|
945 |
var $selected = $options.filter('[aria-selected=true]'); |
|
afe42d0…
|
ragelink
|
946 |
|
|
afe42d0…
|
ragelink
|
947 |
// Check if there are any selected options |
|
afe42d0…
|
ragelink
|
948 |
if ($selected.length > 0) { |
|
afe42d0…
|
ragelink
|
949 |
// If there are selected options, highlight the first |
|
afe42d0…
|
ragelink
|
950 |
$selected.first().trigger('mouseenter'); |
|
afe42d0…
|
ragelink
|
951 |
} else { |
|
afe42d0…
|
ragelink
|
952 |
// If there are no selected options, highlight the first option |
|
afe42d0…
|
ragelink
|
953 |
// in the dropdown |
|
afe42d0…
|
ragelink
|
954 |
$options.first().trigger('mouseenter'); |
|
afe42d0…
|
ragelink
|
955 |
} |
|
afe42d0…
|
ragelink
|
956 |
|
|
afe42d0…
|
ragelink
|
957 |
this.ensureHighlightVisible(); |
|
afe42d0…
|
ragelink
|
958 |
}; |
|
afe42d0…
|
ragelink
|
959 |
|
|
afe42d0…
|
ragelink
|
960 |
Results.prototype.setClasses = function () { |
|
afe42d0…
|
ragelink
|
961 |
var self = this; |
|
afe42d0…
|
ragelink
|
962 |
|
|
afe42d0…
|
ragelink
|
963 |
this.data.current(function (selected) { |
|
afe42d0…
|
ragelink
|
964 |
var selectedIds = $.map(selected, function (s) { |
|
afe42d0…
|
ragelink
|
965 |
return s.id.toString(); |
|
afe42d0…
|
ragelink
|
966 |
}); |
|
afe42d0…
|
ragelink
|
967 |
|
|
afe42d0…
|
ragelink
|
968 |
var $options = self.$results |
|
afe42d0…
|
ragelink
|
969 |
.find('.select2-results__option[aria-selected]'); |
|
afe42d0…
|
ragelink
|
970 |
|
|
afe42d0…
|
ragelink
|
971 |
$options.each(function () { |
|
afe42d0…
|
ragelink
|
972 |
var $option = $(this); |
|
afe42d0…
|
ragelink
|
973 |
|
|
afe42d0…
|
ragelink
|
974 |
var item = Utils.GetData(this, 'data'); |
|
afe42d0…
|
ragelink
|
975 |
|
|
afe42d0…
|
ragelink
|
976 |
// id needs to be converted to a string when comparing |
|
afe42d0…
|
ragelink
|
977 |
var id = '' + item.id; |
|
afe42d0…
|
ragelink
|
978 |
|
|
afe42d0…
|
ragelink
|
979 |
if ((item.element != null && item.element.selected) || |
|
afe42d0…
|
ragelink
|
980 |
(item.element == null && $.inArray(id, selectedIds) > -1)) { |
|
afe42d0…
|
ragelink
|
981 |
$option.attr('aria-selected', 'true'); |
|
afe42d0…
|
ragelink
|
982 |
} else { |
|
afe42d0…
|
ragelink
|
983 |
$option.attr('aria-selected', 'false'); |
|
afe42d0…
|
ragelink
|
984 |
} |
|
afe42d0…
|
ragelink
|
985 |
}); |
|
afe42d0…
|
ragelink
|
986 |
|
|
afe42d0…
|
ragelink
|
987 |
}); |
|
afe42d0…
|
ragelink
|
988 |
}; |
|
afe42d0…
|
ragelink
|
989 |
|
|
afe42d0…
|
ragelink
|
990 |
Results.prototype.showLoading = function (params) { |
|
afe42d0…
|
ragelink
|
991 |
this.hideLoading(); |
|
afe42d0…
|
ragelink
|
992 |
|
|
afe42d0…
|
ragelink
|
993 |
var loadingMore = this.options.get('translations').get('searching'); |
|
afe42d0…
|
ragelink
|
994 |
|
|
afe42d0…
|
ragelink
|
995 |
var loading = { |
|
afe42d0…
|
ragelink
|
996 |
disabled: true, |
|
afe42d0…
|
ragelink
|
997 |
loading: true, |
|
afe42d0…
|
ragelink
|
998 |
text: loadingMore(params) |
|
afe42d0…
|
ragelink
|
999 |
}; |
|
afe42d0…
|
ragelink
|
1000 |
var $loading = this.option(loading); |
|
afe42d0…
|
ragelink
|
1001 |
$loading.className += ' loading-results'; |
|
afe42d0…
|
ragelink
|
1002 |
|
|
afe42d0…
|
ragelink
|
1003 |
this.$results.prepend($loading); |
|
afe42d0…
|
ragelink
|
1004 |
}; |
|
afe42d0…
|
ragelink
|
1005 |
|
|
afe42d0…
|
ragelink
|
1006 |
Results.prototype.hideLoading = function () { |
|
afe42d0…
|
ragelink
|
1007 |
this.$results.find('.loading-results').remove(); |
|
afe42d0…
|
ragelink
|
1008 |
}; |
|
afe42d0…
|
ragelink
|
1009 |
|
|
afe42d0…
|
ragelink
|
1010 |
Results.prototype.option = function (data) { |
|
afe42d0…
|
ragelink
|
1011 |
var option = document.createElement('li'); |
|
afe42d0…
|
ragelink
|
1012 |
option.className = 'select2-results__option'; |
|
afe42d0…
|
ragelink
|
1013 |
|
|
afe42d0…
|
ragelink
|
1014 |
var attrs = { |
|
afe42d0…
|
ragelink
|
1015 |
'role': 'option', |
|
afe42d0…
|
ragelink
|
1016 |
'aria-selected': 'false' |
|
afe42d0…
|
ragelink
|
1017 |
}; |
|
afe42d0…
|
ragelink
|
1018 |
|
|
afe42d0…
|
ragelink
|
1019 |
var matches = window.Element.prototype.matches || |
|
afe42d0…
|
ragelink
|
1020 |
window.Element.prototype.msMatchesSelector || |
|
afe42d0…
|
ragelink
|
1021 |
window.Element.prototype.webkitMatchesSelector; |
|
afe42d0…
|
ragelink
|
1022 |
|
|
afe42d0…
|
ragelink
|
1023 |
if ((data.element != null && matches.call(data.element, ':disabled')) || |
|
afe42d0…
|
ragelink
|
1024 |
(data.element == null && data.disabled)) { |
|
afe42d0…
|
ragelink
|
1025 |
delete attrs['aria-selected']; |
|
afe42d0…
|
ragelink
|
1026 |
attrs['aria-disabled'] = 'true'; |
|
afe42d0…
|
ragelink
|
1027 |
} |
|
afe42d0…
|
ragelink
|
1028 |
|
|
afe42d0…
|
ragelink
|
1029 |
if (data.id == null) { |
|
afe42d0…
|
ragelink
|
1030 |
delete attrs['aria-selected']; |
|
afe42d0…
|
ragelink
|
1031 |
} |
|
afe42d0…
|
ragelink
|
1032 |
|
|
afe42d0…
|
ragelink
|
1033 |
if (data._resultId != null) { |
|
afe42d0…
|
ragelink
|
1034 |
option.id = data._resultId; |
|
afe42d0…
|
ragelink
|
1035 |
} |
|
afe42d0…
|
ragelink
|
1036 |
|
|
afe42d0…
|
ragelink
|
1037 |
if (data.title) { |
|
afe42d0…
|
ragelink
|
1038 |
option.title = data.title; |
|
afe42d0…
|
ragelink
|
1039 |
} |
|
afe42d0…
|
ragelink
|
1040 |
|
|
afe42d0…
|
ragelink
|
1041 |
if (data.children) { |
|
afe42d0…
|
ragelink
|
1042 |
attrs.role = 'group'; |
|
afe42d0…
|
ragelink
|
1043 |
attrs['aria-label'] = data.text; |
|
afe42d0…
|
ragelink
|
1044 |
delete attrs['aria-selected']; |
|
afe42d0…
|
ragelink
|
1045 |
} |
|
afe42d0…
|
ragelink
|
1046 |
|
|
afe42d0…
|
ragelink
|
1047 |
for (var attr in attrs) { |
|
afe42d0…
|
ragelink
|
1048 |
var val = attrs[attr]; |
|
afe42d0…
|
ragelink
|
1049 |
|
|
afe42d0…
|
ragelink
|
1050 |
option.setAttribute(attr, val); |
|
afe42d0…
|
ragelink
|
1051 |
} |
|
afe42d0…
|
ragelink
|
1052 |
|
|
afe42d0…
|
ragelink
|
1053 |
if (data.children) { |
|
afe42d0…
|
ragelink
|
1054 |
var $option = $(option); |
|
afe42d0…
|
ragelink
|
1055 |
|
|
afe42d0…
|
ragelink
|
1056 |
var label = document.createElement('strong'); |
|
afe42d0…
|
ragelink
|
1057 |
label.className = 'select2-results__group'; |
|
afe42d0…
|
ragelink
|
1058 |
|
|
afe42d0…
|
ragelink
|
1059 |
var $label = $(label); |
|
afe42d0…
|
ragelink
|
1060 |
this.template(data, label); |
|
afe42d0…
|
ragelink
|
1061 |
|
|
afe42d0…
|
ragelink
|
1062 |
var $children = []; |
|
afe42d0…
|
ragelink
|
1063 |
|
|
afe42d0…
|
ragelink
|
1064 |
for (var c = 0; c < data.children.length; c++) { |
|
afe42d0…
|
ragelink
|
1065 |
var child = data.children[c]; |
|
afe42d0…
|
ragelink
|
1066 |
|
|
afe42d0…
|
ragelink
|
1067 |
var $child = this.option(child); |
|
afe42d0…
|
ragelink
|
1068 |
|
|
afe42d0…
|
ragelink
|
1069 |
$children.push($child); |
|
afe42d0…
|
ragelink
|
1070 |
} |
|
afe42d0…
|
ragelink
|
1071 |
|
|
afe42d0…
|
ragelink
|
1072 |
var $childrenContainer = $('<ul></ul>', { |
|
afe42d0…
|
ragelink
|
1073 |
'class': 'select2-results__options select2-results__options--nested' |
|
afe42d0…
|
ragelink
|
1074 |
}); |
|
afe42d0…
|
ragelink
|
1075 |
|
|
afe42d0…
|
ragelink
|
1076 |
$childrenContainer.append($children); |
|
afe42d0…
|
ragelink
|
1077 |
|
|
afe42d0…
|
ragelink
|
1078 |
$option.append(label); |
|
afe42d0…
|
ragelink
|
1079 |
$option.append($childrenContainer); |
|
afe42d0…
|
ragelink
|
1080 |
} else { |
|
afe42d0…
|
ragelink
|
1081 |
this.template(data, option); |
|
afe42d0…
|
ragelink
|
1082 |
} |
|
afe42d0…
|
ragelink
|
1083 |
|
|
afe42d0…
|
ragelink
|
1084 |
Utils.StoreData(option, 'data', data); |
|
afe42d0…
|
ragelink
|
1085 |
|
|
afe42d0…
|
ragelink
|
1086 |
return option; |
|
afe42d0…
|
ragelink
|
1087 |
}; |
|
afe42d0…
|
ragelink
|
1088 |
|
|
afe42d0…
|
ragelink
|
1089 |
Results.prototype.bind = function (container, $container) { |
|
afe42d0…
|
ragelink
|
1090 |
var self = this; |
|
afe42d0…
|
ragelink
|
1091 |
|
|
afe42d0…
|
ragelink
|
1092 |
var id = container.id + '-results'; |
|
afe42d0…
|
ragelink
|
1093 |
|
|
afe42d0…
|
ragelink
|
1094 |
this.$results.attr('id', id); |
|
afe42d0…
|
ragelink
|
1095 |
|
|
afe42d0…
|
ragelink
|
1096 |
container.on('results:all', function (params) { |
|
afe42d0…
|
ragelink
|
1097 |
self.clear(); |
|
afe42d0…
|
ragelink
|
1098 |
self.append(params.data); |
|
afe42d0…
|
ragelink
|
1099 |
|
|
afe42d0…
|
ragelink
|
1100 |
if (container.isOpen()) { |
|
afe42d0…
|
ragelink
|
1101 |
self.setClasses(); |
|
afe42d0…
|
ragelink
|
1102 |
self.highlightFirstItem(); |
|
afe42d0…
|
ragelink
|
1103 |
} |
|
afe42d0…
|
ragelink
|
1104 |
}); |
|
afe42d0…
|
ragelink
|
1105 |
|
|
afe42d0…
|
ragelink
|
1106 |
container.on('results:append', function (params) { |
|
afe42d0…
|
ragelink
|
1107 |
self.append(params.data); |
|
afe42d0…
|
ragelink
|
1108 |
|
|
afe42d0…
|
ragelink
|
1109 |
if (container.isOpen()) { |
|
afe42d0…
|
ragelink
|
1110 |
self.setClasses(); |
|
afe42d0…
|
ragelink
|
1111 |
} |
|
afe42d0…
|
ragelink
|
1112 |
}); |
|
afe42d0…
|
ragelink
|
1113 |
|
|
afe42d0…
|
ragelink
|
1114 |
container.on('query', function (params) { |
|
afe42d0…
|
ragelink
|
1115 |
self.hideMessages(); |
|
afe42d0…
|
ragelink
|
1116 |
self.showLoading(params); |
|
afe42d0…
|
ragelink
|
1117 |
}); |
|
afe42d0…
|
ragelink
|
1118 |
|
|
afe42d0…
|
ragelink
|
1119 |
container.on('select', function () { |
|
afe42d0…
|
ragelink
|
1120 |
if (!container.isOpen()) { |
|
afe42d0…
|
ragelink
|
1121 |
return; |
|
afe42d0…
|
ragelink
|
1122 |
} |
|
afe42d0…
|
ragelink
|
1123 |
|
|
afe42d0…
|
ragelink
|
1124 |
self.setClasses(); |
|
afe42d0…
|
ragelink
|
1125 |
|
|
afe42d0…
|
ragelink
|
1126 |
if (self.options.get('scrollAfterSelect')) { |
|
afe42d0…
|
ragelink
|
1127 |
self.highlightFirstItem(); |
|
afe42d0…
|
ragelink
|
1128 |
} |
|
afe42d0…
|
ragelink
|
1129 |
}); |
|
afe42d0…
|
ragelink
|
1130 |
|
|
afe42d0…
|
ragelink
|
1131 |
container.on('unselect', function () { |
|
afe42d0…
|
ragelink
|
1132 |
if (!container.isOpen()) { |
|
afe42d0…
|
ragelink
|
1133 |
return; |
|
afe42d0…
|
ragelink
|
1134 |
} |
|
afe42d0…
|
ragelink
|
1135 |
|
|
afe42d0…
|
ragelink
|
1136 |
self.setClasses(); |
|
afe42d0…
|
ragelink
|
1137 |
|
|
afe42d0…
|
ragelink
|
1138 |
if (self.options.get('scrollAfterSelect')) { |
|
afe42d0…
|
ragelink
|
1139 |
self.highlightFirstItem(); |
|
afe42d0…
|
ragelink
|
1140 |
} |
|
afe42d0…
|
ragelink
|
1141 |
}); |
|
afe42d0…
|
ragelink
|
1142 |
|
|
afe42d0…
|
ragelink
|
1143 |
container.on('open', function () { |
|
afe42d0…
|
ragelink
|
1144 |
// When the dropdown is open, aria-expended="true" |
|
afe42d0…
|
ragelink
|
1145 |
self.$results.attr('aria-expanded', 'true'); |
|
afe42d0…
|
ragelink
|
1146 |
self.$results.attr('aria-hidden', 'false'); |
|
afe42d0…
|
ragelink
|
1147 |
|
|
afe42d0…
|
ragelink
|
1148 |
self.setClasses(); |
|
afe42d0…
|
ragelink
|
1149 |
self.ensureHighlightVisible(); |
|
afe42d0…
|
ragelink
|
1150 |
}); |
|
afe42d0…
|
ragelink
|
1151 |
|
|
afe42d0…
|
ragelink
|
1152 |
container.on('close', function () { |
|
afe42d0…
|
ragelink
|
1153 |
// When the dropdown is closed, aria-expended="false" |
|
afe42d0…
|
ragelink
|
1154 |
self.$results.attr('aria-expanded', 'false'); |
|
afe42d0…
|
ragelink
|
1155 |
self.$results.attr('aria-hidden', 'true'); |
|
afe42d0…
|
ragelink
|
1156 |
self.$results.removeAttr('aria-activedescendant'); |
|
afe42d0…
|
ragelink
|
1157 |
}); |
|
afe42d0…
|
ragelink
|
1158 |
|
|
afe42d0…
|
ragelink
|
1159 |
container.on('results:toggle', function () { |
|
afe42d0…
|
ragelink
|
1160 |
var $highlighted = self.getHighlightedResults(); |
|
afe42d0…
|
ragelink
|
1161 |
|
|
afe42d0…
|
ragelink
|
1162 |
if ($highlighted.length === 0) { |
|
afe42d0…
|
ragelink
|
1163 |
return; |
|
afe42d0…
|
ragelink
|
1164 |
} |
|
afe42d0…
|
ragelink
|
1165 |
|
|
afe42d0…
|
ragelink
|
1166 |
$highlighted.trigger('mouseup'); |
|
afe42d0…
|
ragelink
|
1167 |
}); |
|
afe42d0…
|
ragelink
|
1168 |
|
|
afe42d0…
|
ragelink
|
1169 |
container.on('results:select', function () { |
|
afe42d0…
|
ragelink
|
1170 |
var $highlighted = self.getHighlightedResults(); |
|
afe42d0…
|
ragelink
|
1171 |
|
|
afe42d0…
|
ragelink
|
1172 |
if ($highlighted.length === 0) { |
|
afe42d0…
|
ragelink
|
1173 |
return; |
|
afe42d0…
|
ragelink
|
1174 |
} |
|
afe42d0…
|
ragelink
|
1175 |
|
|
afe42d0…
|
ragelink
|
1176 |
var data = Utils.GetData($highlighted[0], 'data'); |
|
afe42d0…
|
ragelink
|
1177 |
|
|
afe42d0…
|
ragelink
|
1178 |
if ($highlighted.attr('aria-selected') == 'true') { |
|
afe42d0…
|
ragelink
|
1179 |
self.trigger('close', {}); |
|
afe42d0…
|
ragelink
|
1180 |
} else { |
|
afe42d0…
|
ragelink
|
1181 |
self.trigger('select', { |
|
afe42d0…
|
ragelink
|
1182 |
data: data |
|
afe42d0…
|
ragelink
|
1183 |
}); |
|
afe42d0…
|
ragelink
|
1184 |
} |
|
afe42d0…
|
ragelink
|
1185 |
}); |
|
afe42d0…
|
ragelink
|
1186 |
|
|
afe42d0…
|
ragelink
|
1187 |
container.on('results:previous', function () { |
|
afe42d0…
|
ragelink
|
1188 |
var $highlighted = self.getHighlightedResults(); |
|
afe42d0…
|
ragelink
|
1189 |
|
|
afe42d0…
|
ragelink
|
1190 |
var $options = self.$results.find('[aria-selected]'); |
|
afe42d0…
|
ragelink
|
1191 |
|
|
afe42d0…
|
ragelink
|
1192 |
var currentIndex = $options.index($highlighted); |
|
afe42d0…
|
ragelink
|
1193 |
|
|
afe42d0…
|
ragelink
|
1194 |
// If we are already at the top, don't move further |
|
afe42d0…
|
ragelink
|
1195 |
// If no options, currentIndex will be -1 |
|
afe42d0…
|
ragelink
|
1196 |
if (currentIndex <= 0) { |
|
afe42d0…
|
ragelink
|
1197 |
return; |
|
afe42d0…
|
ragelink
|
1198 |
} |
|
afe42d0…
|
ragelink
|
1199 |
|
|
afe42d0…
|
ragelink
|
1200 |
var nextIndex = currentIndex - 1; |
|
afe42d0…
|
ragelink
|
1201 |
|
|
afe42d0…
|
ragelink
|
1202 |
// If none are highlighted, highlight the first |
|
afe42d0…
|
ragelink
|
1203 |
if ($highlighted.length === 0) { |
|
afe42d0…
|
ragelink
|
1204 |
nextIndex = 0; |
|
afe42d0…
|
ragelink
|
1205 |
} |
|
afe42d0…
|
ragelink
|
1206 |
|
|
afe42d0…
|
ragelink
|
1207 |
var $next = $options.eq(nextIndex); |
|
afe42d0…
|
ragelink
|
1208 |
|
|
afe42d0…
|
ragelink
|
1209 |
$next.trigger('mouseenter'); |
|
afe42d0…
|
ragelink
|
1210 |
|
|
afe42d0…
|
ragelink
|
1211 |
var currentOffset = self.$results.offset().top; |
|
afe42d0…
|
ragelink
|
1212 |
var nextTop = $next.offset().top; |
|
afe42d0…
|
ragelink
|
1213 |
var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); |
|
afe42d0…
|
ragelink
|
1214 |
|
|
afe42d0…
|
ragelink
|
1215 |
if (nextIndex === 0) { |
|
afe42d0…
|
ragelink
|
1216 |
self.$results.scrollTop(0); |
|
afe42d0…
|
ragelink
|
1217 |
} else if (nextTop - currentOffset < 0) { |
|
afe42d0…
|
ragelink
|
1218 |
self.$results.scrollTop(nextOffset); |
|
afe42d0…
|
ragelink
|
1219 |
} |
|
afe42d0…
|
ragelink
|
1220 |
}); |
|
afe42d0…
|
ragelink
|
1221 |
|
|
afe42d0…
|
ragelink
|
1222 |
container.on('results:next', function () { |
|
afe42d0…
|
ragelink
|
1223 |
var $highlighted = self.getHighlightedResults(); |
|
afe42d0…
|
ragelink
|
1224 |
|
|
afe42d0…
|
ragelink
|
1225 |
var $options = self.$results.find('[aria-selected]'); |
|
afe42d0…
|
ragelink
|
1226 |
|
|
afe42d0…
|
ragelink
|
1227 |
var currentIndex = $options.index($highlighted); |
|
afe42d0…
|
ragelink
|
1228 |
|
|
afe42d0…
|
ragelink
|
1229 |
var nextIndex = currentIndex + 1; |
|
afe42d0…
|
ragelink
|
1230 |
|
|
afe42d0…
|
ragelink
|
1231 |
// If we are at the last option, stay there |
|
afe42d0…
|
ragelink
|
1232 |
if (nextIndex >= $options.length) { |
|
afe42d0…
|
ragelink
|
1233 |
return; |
|
afe42d0…
|
ragelink
|
1234 |
} |
|
afe42d0…
|
ragelink
|
1235 |
|
|
afe42d0…
|
ragelink
|
1236 |
var $next = $options.eq(nextIndex); |
|
afe42d0…
|
ragelink
|
1237 |
|
|
afe42d0…
|
ragelink
|
1238 |
$next.trigger('mouseenter'); |
|
afe42d0…
|
ragelink
|
1239 |
|
|
afe42d0…
|
ragelink
|
1240 |
var currentOffset = self.$results.offset().top + |
|
afe42d0…
|
ragelink
|
1241 |
self.$results.outerHeight(false); |
|
afe42d0…
|
ragelink
|
1242 |
var nextBottom = $next.offset().top + $next.outerHeight(false); |
|
afe42d0…
|
ragelink
|
1243 |
var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; |
|
afe42d0…
|
ragelink
|
1244 |
|
|
afe42d0…
|
ragelink
|
1245 |
if (nextIndex === 0) { |
|
afe42d0…
|
ragelink
|
1246 |
self.$results.scrollTop(0); |
|
afe42d0…
|
ragelink
|
1247 |
} else if (nextBottom > currentOffset) { |
|
afe42d0…
|
ragelink
|
1248 |
self.$results.scrollTop(nextOffset); |
|
afe42d0…
|
ragelink
|
1249 |
} |
|
afe42d0…
|
ragelink
|
1250 |
}); |
|
afe42d0…
|
ragelink
|
1251 |
|
|
afe42d0…
|
ragelink
|
1252 |
container.on('results:focus', function (params) { |
|
afe42d0…
|
ragelink
|
1253 |
params.element.addClass('select2-results__option--highlighted'); |
|
afe42d0…
|
ragelink
|
1254 |
}); |
|
afe42d0…
|
ragelink
|
1255 |
|
|
afe42d0…
|
ragelink
|
1256 |
container.on('results:message', function (params) { |
|
afe42d0…
|
ragelink
|
1257 |
self.displayMessage(params); |
|
afe42d0…
|
ragelink
|
1258 |
}); |
|
afe42d0…
|
ragelink
|
1259 |
|
|
afe42d0…
|
ragelink
|
1260 |
if ($.fn.mousewheel) { |
|
afe42d0…
|
ragelink
|
1261 |
this.$results.on('mousewheel', function (e) { |
|
afe42d0…
|
ragelink
|
1262 |
var top = self.$results.scrollTop(); |
|
afe42d0…
|
ragelink
|
1263 |
|
|
afe42d0…
|
ragelink
|
1264 |
var bottom = self.$results.get(0).scrollHeight - top + e.deltaY; |
|
afe42d0…
|
ragelink
|
1265 |
|
|
afe42d0…
|
ragelink
|
1266 |
var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; |
|
afe42d0…
|
ragelink
|
1267 |
var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); |
|
afe42d0…
|
ragelink
|
1268 |
|
|
afe42d0…
|
ragelink
|
1269 |
if (isAtTop) { |
|
afe42d0…
|
ragelink
|
1270 |
self.$results.scrollTop(0); |
|
afe42d0…
|
ragelink
|
1271 |
|
|
afe42d0…
|
ragelink
|
1272 |
e.preventDefault(); |
|
afe42d0…
|
ragelink
|
1273 |
e.stopPropagation(); |
|
afe42d0…
|
ragelink
|
1274 |
} else if (isAtBottom) { |
|
afe42d0…
|
ragelink
|
1275 |
self.$results.scrollTop( |
|
afe42d0…
|
ragelink
|
1276 |
self.$results.get(0).scrollHeight - self.$results.height() |
|
afe42d0…
|
ragelink
|
1277 |
); |
|
afe42d0…
|
ragelink
|
1278 |
|
|
afe42d0…
|
ragelink
|
1279 |
e.preventDefault(); |
|
afe42d0…
|
ragelink
|
1280 |
e.stopPropagation(); |
|
afe42d0…
|
ragelink
|
1281 |
} |
|
afe42d0…
|
ragelink
|
1282 |
}); |
|
afe42d0…
|
ragelink
|
1283 |
} |
|
afe42d0…
|
ragelink
|
1284 |
|
|
afe42d0…
|
ragelink
|
1285 |
this.$results.on('mouseup', '.select2-results__option[aria-selected]', |
|
afe42d0…
|
ragelink
|
1286 |
function (evt) { |
|
afe42d0…
|
ragelink
|
1287 |
var $this = $(this); |
|
afe42d0…
|
ragelink
|
1288 |
|
|
afe42d0…
|
ragelink
|
1289 |
var data = Utils.GetData(this, 'data'); |
|
afe42d0…
|
ragelink
|
1290 |
|
|
afe42d0…
|
ragelink
|
1291 |
if ($this.attr('aria-selected') === 'true') { |
|
afe42d0…
|
ragelink
|
1292 |
if (self.options.get('multiple')) { |
|
afe42d0…
|
ragelink
|
1293 |
self.trigger('unselect', { |
|
afe42d0…
|
ragelink
|
1294 |
originalEvent: evt, |
|
afe42d0…
|
ragelink
|
1295 |
data: data |
|
afe42d0…
|
ragelink
|
1296 |
}); |
|
afe42d0…
|
ragelink
|
1297 |
} else { |
|
afe42d0…
|
ragelink
|
1298 |
self.trigger('close', {}); |
|
afe42d0…
|
ragelink
|
1299 |
} |
|
afe42d0…
|
ragelink
|
1300 |
|
|
afe42d0…
|
ragelink
|
1301 |
return; |
|
afe42d0…
|
ragelink
|
1302 |
} |
|
afe42d0…
|
ragelink
|
1303 |
|
|
afe42d0…
|
ragelink
|
1304 |
self.trigger('select', { |
|
afe42d0…
|
ragelink
|
1305 |
originalEvent: evt, |
|
afe42d0…
|
ragelink
|
1306 |
data: data |
|
afe42d0…
|
ragelink
|
1307 |
}); |
|
afe42d0…
|
ragelink
|
1308 |
}); |
|
afe42d0…
|
ragelink
|
1309 |
|
|
afe42d0…
|
ragelink
|
1310 |
this.$results.on('mouseenter', '.select2-results__option[aria-selected]', |
|
afe42d0…
|
ragelink
|
1311 |
function (evt) { |
|
afe42d0…
|
ragelink
|
1312 |
var data = Utils.GetData(this, 'data'); |
|
afe42d0…
|
ragelink
|
1313 |
|
|
afe42d0…
|
ragelink
|
1314 |
self.getHighlightedResults() |
|
afe42d0…
|
ragelink
|
1315 |
.removeClass('select2-results__option--highlighted'); |
|
afe42d0…
|
ragelink
|
1316 |
|
|
afe42d0…
|
ragelink
|
1317 |
self.trigger('results:focus', { |
|
afe42d0…
|
ragelink
|
1318 |
data: data, |
|
afe42d0…
|
ragelink
|
1319 |
element: $(this) |
|
afe42d0…
|
ragelink
|
1320 |
}); |
|
afe42d0…
|
ragelink
|
1321 |
}); |
|
afe42d0…
|
ragelink
|
1322 |
}; |
|
afe42d0…
|
ragelink
|
1323 |
|
|
afe42d0…
|
ragelink
|
1324 |
Results.prototype.getHighlightedResults = function () { |
|
afe42d0…
|
ragelink
|
1325 |
var $highlighted = this.$results |
|
afe42d0…
|
ragelink
|
1326 |
.find('.select2-results__option--highlighted'); |
|
afe42d0…
|
ragelink
|
1327 |
|
|
afe42d0…
|
ragelink
|
1328 |
return $highlighted; |
|
afe42d0…
|
ragelink
|
1329 |
}; |
|
afe42d0…
|
ragelink
|
1330 |
|
|
afe42d0…
|
ragelink
|
1331 |
Results.prototype.destroy = function () { |
|
afe42d0…
|
ragelink
|
1332 |
this.$results.remove(); |
|
afe42d0…
|
ragelink
|
1333 |
}; |
|
afe42d0…
|
ragelink
|
1334 |
|
|
afe42d0…
|
ragelink
|
1335 |
Results.prototype.ensureHighlightVisible = function () { |
|
afe42d0…
|
ragelink
|
1336 |
var $highlighted = this.getHighlightedResults(); |
|
afe42d0…
|
ragelink
|
1337 |
|
|
afe42d0…
|
ragelink
|
1338 |
if ($highlighted.length === 0) { |
|
afe42d0…
|
ragelink
|
1339 |
return; |
|
afe42d0…
|
ragelink
|
1340 |
} |
|
afe42d0…
|
ragelink
|
1341 |
|
|
afe42d0…
|
ragelink
|
1342 |
var $options = this.$results.find('[aria-selected]'); |
|
afe42d0…
|
ragelink
|
1343 |
|
|
afe42d0…
|
ragelink
|
1344 |
var currentIndex = $options.index($highlighted); |
|
afe42d0…
|
ragelink
|
1345 |
|
|
afe42d0…
|
ragelink
|
1346 |
var currentOffset = this.$results.offset().top; |
|
afe42d0…
|
ragelink
|
1347 |
var nextTop = $highlighted.offset().top; |
|
afe42d0…
|
ragelink
|
1348 |
var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); |
|
afe42d0…
|
ragelink
|
1349 |
|
|
afe42d0…
|
ragelink
|
1350 |
var offsetDelta = nextTop - currentOffset; |
|
afe42d0…
|
ragelink
|
1351 |
nextOffset -= $highlighted.outerHeight(false) * 2; |
|
afe42d0…
|
ragelink
|
1352 |
|
|
afe42d0…
|
ragelink
|
1353 |
if (currentIndex <= 2) { |
|
afe42d0…
|
ragelink
|
1354 |
this.$results.scrollTop(0); |
|
afe42d0…
|
ragelink
|
1355 |
} else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { |
|
afe42d0…
|
ragelink
|
1356 |
this.$results.scrollTop(nextOffset); |
|
afe42d0…
|
ragelink
|
1357 |
} |
|
afe42d0…
|
ragelink
|
1358 |
}; |
|
afe42d0…
|
ragelink
|
1359 |
|
|
afe42d0…
|
ragelink
|
1360 |
Results.prototype.template = function (result, container) { |
|
afe42d0…
|
ragelink
|
1361 |
var template = this.options.get('templateResult'); |
|
afe42d0…
|
ragelink
|
1362 |
var escapeMarkup = this.options.get('escapeMarkup'); |
|
afe42d0…
|
ragelink
|
1363 |
|
|
afe42d0…
|
ragelink
|
1364 |
var content = template(result, container); |
|
afe42d0…
|
ragelink
|
1365 |
|
|
afe42d0…
|
ragelink
|
1366 |
if (content == null) { |
|
afe42d0…
|
ragelink
|
1367 |
container.style.display = 'none'; |
|
afe42d0…
|
ragelink
|
1368 |
} else if (typeof content === 'string') { |
|
afe42d0…
|
ragelink
|
1369 |
container.innerHTML = escapeMarkup(content); |
|
afe42d0…
|
ragelink
|
1370 |
} else { |
|
afe42d0…
|
ragelink
|
1371 |
$(container).append(content); |
|
afe42d0…
|
ragelink
|
1372 |
} |
|
afe42d0…
|
ragelink
|
1373 |
}; |
|
afe42d0…
|
ragelink
|
1374 |
|
|
afe42d0…
|
ragelink
|
1375 |
return Results; |
|
afe42d0…
|
ragelink
|
1376 |
}); |
|
afe42d0…
|
ragelink
|
1377 |
|
|
afe42d0…
|
ragelink
|
1378 |
S2.define('select2/keys',[ |
|
afe42d0…
|
ragelink
|
1379 |
|
|
afe42d0…
|
ragelink
|
1380 |
], function () { |
|
afe42d0…
|
ragelink
|
1381 |
var KEYS = { |
|
afe42d0…
|
ragelink
|
1382 |
BACKSPACE: 8, |
|
afe42d0…
|
ragelink
|
1383 |
TAB: 9, |
|
afe42d0…
|
ragelink
|
1384 |
ENTER: 13, |
|
afe42d0…
|
ragelink
|
1385 |
SHIFT: 16, |
|
afe42d0…
|
ragelink
|
1386 |
CTRL: 17, |
|
afe42d0…
|
ragelink
|
1387 |
ALT: 18, |
|
afe42d0…
|
ragelink
|
1388 |
ESC: 27, |
|
afe42d0…
|
ragelink
|
1389 |
SPACE: 32, |
|
afe42d0…
|
ragelink
|
1390 |
PAGE_UP: 33, |
|
afe42d0…
|
ragelink
|
1391 |
PAGE_DOWN: 34, |
|
afe42d0…
|
ragelink
|
1392 |
END: 35, |
|
afe42d0…
|
ragelink
|
1393 |
HOME: 36, |
|
afe42d0…
|
ragelink
|
1394 |
LEFT: 37, |
|
afe42d0…
|
ragelink
|
1395 |
UP: 38, |
|
afe42d0…
|
ragelink
|
1396 |
RIGHT: 39, |
|
afe42d0…
|
ragelink
|
1397 |
DOWN: 40, |
|
afe42d0…
|
ragelink
|
1398 |
DELETE: 46 |
|
afe42d0…
|
ragelink
|
1399 |
}; |
|
afe42d0…
|
ragelink
|
1400 |
|
|
afe42d0…
|
ragelink
|
1401 |
return KEYS; |
|
afe42d0…
|
ragelink
|
1402 |
}); |
|
afe42d0…
|
ragelink
|
1403 |
|
|
afe42d0…
|
ragelink
|
1404 |
S2.define('select2/selection/base',[ |
|
afe42d0…
|
ragelink
|
1405 |
'jquery', |
|
afe42d0…
|
ragelink
|
1406 |
'../utils', |
|
afe42d0…
|
ragelink
|
1407 |
'../keys' |
|
afe42d0…
|
ragelink
|
1408 |
], function ($, Utils, KEYS) { |
|
afe42d0…
|
ragelink
|
1409 |
function BaseSelection ($element, options) { |
|
afe42d0…
|
ragelink
|
1410 |
this.$element = $element; |
|
afe42d0…
|
ragelink
|
1411 |
this.options = options; |
|
afe42d0…
|
ragelink
|
1412 |
|
|
afe42d0…
|
ragelink
|
1413 |
BaseSelection.__super__.constructor.call(this); |
|
afe42d0…
|
ragelink
|
1414 |
} |
|
afe42d0…
|
ragelink
|
1415 |
|
|
afe42d0…
|
ragelink
|
1416 |
Utils.Extend(BaseSelection, Utils.Observable); |
|
afe42d0…
|
ragelink
|
1417 |
|
|
afe42d0…
|
ragelink
|
1418 |
BaseSelection.prototype.render = function () { |
|
afe42d0…
|
ragelink
|
1419 |
var $selection = $( |
|
afe42d0…
|
ragelink
|
1420 |
'<span class="select2-selection" role="combobox" ' + |
|
afe42d0…
|
ragelink
|
1421 |
' aria-haspopup="true" aria-expanded="false">' + |
|
afe42d0…
|
ragelink
|
1422 |
'</span>' |
|
afe42d0…
|
ragelink
|
1423 |
); |
|
afe42d0…
|
ragelink
|
1424 |
|
|
afe42d0…
|
ragelink
|
1425 |
this._tabindex = 0; |
|
afe42d0…
|
ragelink
|
1426 |
|
|
afe42d0…
|
ragelink
|
1427 |
if (Utils.GetData(this.$element[0], 'old-tabindex') != null) { |
|
afe42d0…
|
ragelink
|
1428 |
this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex'); |
|
afe42d0…
|
ragelink
|
1429 |
} else if (this.$element.attr('tabindex') != null) { |
|
afe42d0…
|
ragelink
|
1430 |
this._tabindex = this.$element.attr('tabindex'); |
|
afe42d0…
|
ragelink
|
1431 |
} |
|
afe42d0…
|
ragelink
|
1432 |
|
|
afe42d0…
|
ragelink
|
1433 |
$selection.attr('title', this.$element.attr('title')); |
|
afe42d0…
|
ragelink
|
1434 |
$selection.attr('tabindex', this._tabindex); |
|
afe42d0…
|
ragelink
|
1435 |
$selection.attr('aria-disabled', 'false'); |
|
afe42d0…
|
ragelink
|
1436 |
|
|
afe42d0…
|
ragelink
|
1437 |
this.$selection = $selection; |
|
afe42d0…
|
ragelink
|
1438 |
|
|
afe42d0…
|
ragelink
|
1439 |
return $selection; |
|
afe42d0…
|
ragelink
|
1440 |
}; |
|
afe42d0…
|
ragelink
|
1441 |
|
|
afe42d0…
|
ragelink
|
1442 |
BaseSelection.prototype.bind = function (container, $container) { |
|
afe42d0…
|
ragelink
|
1443 |
var self = this; |
|
afe42d0…
|
ragelink
|
1444 |
|
|
afe42d0…
|
ragelink
|
1445 |
var resultsId = container.id + '-results'; |
|
afe42d0…
|
ragelink
|
1446 |
|
|
afe42d0…
|
ragelink
|
1447 |
this.container = container; |
|
afe42d0…
|
ragelink
|
1448 |
|
|
afe42d0…
|
ragelink
|
1449 |
this.$selection.on('focus', function (evt) { |
|
afe42d0…
|
ragelink
|
1450 |
self.trigger('focus', evt); |
|
afe42d0…
|
ragelink
|
1451 |
}); |
|
afe42d0…
|
ragelink
|
1452 |
|
|
afe42d0…
|
ragelink
|
1453 |
this.$selection.on('blur', function (evt) { |
|
afe42d0…
|
ragelink
|
1454 |
self._handleBlur(evt); |
|
afe42d0…
|
ragelink
|
1455 |
}); |
|
afe42d0…
|
ragelink
|
1456 |
|
|
afe42d0…
|
ragelink
|
1457 |
this.$selection.on('keydown', function (evt) { |
|
afe42d0…
|
ragelink
|
1458 |
self.trigger('keypress', evt); |
|
afe42d0…
|
ragelink
|
1459 |
|
|
afe42d0…
|
ragelink
|
1460 |
if (evt.which === KEYS.SPACE) { |
|
afe42d0…
|
ragelink
|
1461 |
evt.preventDefault(); |
|
afe42d0…
|
ragelink
|
1462 |
} |
|
afe42d0…
|
ragelink
|
1463 |
}); |
|
afe42d0…
|
ragelink
|
1464 |
|
|
afe42d0…
|
ragelink
|
1465 |
container.on('results:focus', function (params) { |
|
afe42d0…
|
ragelink
|
1466 |
self.$selection.attr('aria-activedescendant', params.data._resultId); |
|
afe42d0…
|
ragelink
|
1467 |
}); |
|
afe42d0…
|
ragelink
|
1468 |
|
|
afe42d0…
|
ragelink
|
1469 |
container.on('selection:update', function (params) { |
|
afe42d0…
|
ragelink
|
1470 |
self.update(params.data); |
|
afe42d0…
|
ragelink
|
1471 |
}); |
|
afe42d0…
|
ragelink
|
1472 |
|
|
afe42d0…
|
ragelink
|
1473 |
container.on('open', function () { |
|
afe42d0…
|
ragelink
|
1474 |
// When the dropdown is open, aria-expanded="true" |
|
afe42d0…
|
ragelink
|
1475 |
self.$selection.attr('aria-expanded', 'true'); |
|
afe42d0…
|
ragelink
|
1476 |
self.$selection.attr('aria-owns', resultsId); |
|
afe42d0…
|
ragelink
|
1477 |
|
|
afe42d0…
|
ragelink
|
1478 |
self._attachCloseHandler(container); |
|
afe42d0…
|
ragelink
|
1479 |
}); |
|
afe42d0…
|
ragelink
|
1480 |
|
|
afe42d0…
|
ragelink
|
1481 |
container.on('close', function () { |
|
afe42d0…
|
ragelink
|
1482 |
// When the dropdown is closed, aria-expanded="false" |
|
afe42d0…
|
ragelink
|
1483 |
self.$selection.attr('aria-expanded', 'false'); |
|
afe42d0…
|
ragelink
|
1484 |
self.$selection.removeAttr('aria-activedescendant'); |
|
afe42d0…
|
ragelink
|
1485 |
self.$selection.removeAttr('aria-owns'); |
|
afe42d0…
|
ragelink
|
1486 |
|
|
afe42d0…
|
ragelink
|
1487 |
self.$selection.trigger('focus'); |
|
afe42d0…
|
ragelink
|
1488 |
|
|
afe42d0…
|
ragelink
|
1489 |
self._detachCloseHandler(container); |
|
afe42d0…
|
ragelink
|
1490 |
}); |
|
afe42d0…
|
ragelink
|
1491 |
|
|
afe42d0…
|
ragelink
|
1492 |
container.on('enable', function () { |
|
afe42d0…
|
ragelink
|
1493 |
self.$selection.attr('tabindex', self._tabindex); |
|
afe42d0…
|
ragelink
|
1494 |
self.$selection.attr('aria-disabled', 'false'); |
|
afe42d0…
|
ragelink
|
1495 |
}); |
|
afe42d0…
|
ragelink
|
1496 |
|
|
afe42d0…
|
ragelink
|
1497 |
container.on('disable', function () { |
|
afe42d0…
|
ragelink
|
1498 |
self.$selection.attr('tabindex', '-1'); |
|
afe42d0…
|
ragelink
|
1499 |
self.$selection.attr('aria-disabled', 'true'); |
|
afe42d0…
|
ragelink
|
1500 |
}); |
|
afe42d0…
|
ragelink
|
1501 |
}; |
|
afe42d0…
|
ragelink
|
1502 |
|
|
afe42d0…
|
ragelink
|
1503 |
BaseSelection.prototype._handleBlur = function (evt) { |
|
afe42d0…
|
ragelink
|
1504 |
var self = this; |
|
afe42d0…
|
ragelink
|
1505 |
|
|
afe42d0…
|
ragelink
|
1506 |
// This needs to be delayed as the active element is the body when the tab |
|
afe42d0…
|
ragelink
|
1507 |
// key is pressed, possibly along with others. |
|
afe42d0…
|
ragelink
|
1508 |
window.setTimeout(function () { |
|
afe42d0…
|
ragelink
|
1509 |
// Don't trigger `blur` if the focus is still in the selection |
|
afe42d0…
|
ragelink
|
1510 |
if ( |
|
afe42d0…
|
ragelink
|
1511 |
(document.activeElement == self.$selection[0]) || |
|
afe42d0…
|
ragelink
|
1512 |
($.contains(self.$selection[0], document.activeElement)) |
|
afe42d0…
|
ragelink
|
1513 |
) { |
|
afe42d0…
|
ragelink
|
1514 |
return; |
|
afe42d0…
|
ragelink
|
1515 |
} |
|
afe42d0…
|
ragelink
|
1516 |
|
|
afe42d0…
|
ragelink
|
1517 |
self.trigger('blur', evt); |
|
afe42d0…
|
ragelink
|
1518 |
}, 1); |
|
afe42d0…
|
ragelink
|
1519 |
}; |
|
afe42d0…
|
ragelink
|
1520 |
|
|
afe42d0…
|
ragelink
|
1521 |
BaseSelection.prototype._attachCloseHandler = function (container) { |
|
afe42d0…
|
ragelink
|
1522 |
|
|
afe42d0…
|
ragelink
|
1523 |
$(document.body).on('mousedown.select2.' + container.id, function (e) { |
|
afe42d0…
|
ragelink
|
1524 |
var $target = $(e.target); |
|
afe42d0…
|
ragelink
|
1525 |
|
|
afe42d0…
|
ragelink
|
1526 |
var $select = $target.closest('.select2'); |
|
afe42d0…
|
ragelink
|
1527 |
|
|
afe42d0…
|
ragelink
|
1528 |
var $all = $('.select2.select2-container--open'); |
|
afe42d0…
|
ragelink
|
1529 |
|
|
afe42d0…
|
ragelink
|
1530 |
$all.each(function () { |
|
afe42d0…
|
ragelink
|
1531 |
if (this == $select[0]) { |
|
afe42d0…
|
ragelink
|
1532 |
return; |
|
afe42d0…
|
ragelink
|
1533 |
} |
|
afe42d0…
|
ragelink
|
1534 |
|
|
afe42d0…
|
ragelink
|
1535 |
var $element = Utils.GetData(this, 'element'); |
|
afe42d0…
|
ragelink
|
1536 |
|
|
afe42d0…
|
ragelink
|
1537 |
$element.select2('close'); |
|
afe42d0…
|
ragelink
|
1538 |
}); |
|
afe42d0…
|
ragelink
|
1539 |
}); |
|
afe42d0…
|
ragelink
|
1540 |
}; |
|
afe42d0…
|
ragelink
|
1541 |
|
|
afe42d0…
|
ragelink
|
1542 |
BaseSelection.prototype._detachCloseHandler = function (container) { |
|
afe42d0…
|
ragelink
|
1543 |
$(document.body).off('mousedown.select2.' + container.id); |
|
afe42d0…
|
ragelink
|
1544 |
}; |
|
afe42d0…
|
ragelink
|
1545 |
|
|
afe42d0…
|
ragelink
|
1546 |
BaseSelection.prototype.position = function ($selection, $container) { |
|
afe42d0…
|
ragelink
|
1547 |
var $selectionContainer = $container.find('.selection'); |
|
afe42d0…
|
ragelink
|
1548 |
$selectionContainer.append($selection); |
|
afe42d0…
|
ragelink
|
1549 |
}; |
|
afe42d0…
|
ragelink
|
1550 |
|
|
afe42d0…
|
ragelink
|
1551 |
BaseSelection.prototype.destroy = function () { |
|
afe42d0…
|
ragelink
|
1552 |
this._detachCloseHandler(this.container); |
|
afe42d0…
|
ragelink
|
1553 |
}; |
|
afe42d0…
|
ragelink
|
1554 |
|
|
afe42d0…
|
ragelink
|
1555 |
BaseSelection.prototype.update = function (data) { |
|
afe42d0…
|
ragelink
|
1556 |
throw new Error('The `update` method must be defined in child classes.'); |
|
afe42d0…
|
ragelink
|
1557 |
}; |
|
afe42d0…
|
ragelink
|
1558 |
|
|
afe42d0…
|
ragelink
|
1559 |
/** |
|
afe42d0…
|
ragelink
|
1560 |
* Helper method to abstract the "enabled" (not "disabled") state of this |
|
afe42d0…
|
ragelink
|
1561 |
* object. |
|
afe42d0…
|
ragelink
|
1562 |
* |
|
afe42d0…
|
ragelink
|
1563 |
* @return {true} if the instance is not disabled. |
|
afe42d0…
|
ragelink
|
1564 |
* @return {false} if the instance is disabled. |
|
afe42d0…
|
ragelink
|
1565 |
*/ |
|
afe42d0…
|
ragelink
|
1566 |
BaseSelection.prototype.isEnabled = function () { |
|
afe42d0…
|
ragelink
|
1567 |
return !this.isDisabled(); |
|
afe42d0…
|
ragelink
|
1568 |
}; |
|
afe42d0…
|
ragelink
|
1569 |
|
|
afe42d0…
|
ragelink
|
1570 |
/** |
|
afe42d0…
|
ragelink
|
1571 |
* Helper method to abstract the "disabled" state of this object. |
|
afe42d0…
|
ragelink
|
1572 |
* |
|
afe42d0…
|
ragelink
|
1573 |
* @return {true} if the disabled option is true. |
|
afe42d0…
|
ragelink
|
1574 |
* @return {false} if the disabled option is false. |
|
afe42d0…
|
ragelink
|
1575 |
*/ |
|
afe42d0…
|
ragelink
|
1576 |
BaseSelection.prototype.isDisabled = function () { |
|
afe42d0…
|
ragelink
|
1577 |
return this.options.get('disabled'); |
|
afe42d0…
|
ragelink
|
1578 |
}; |
|
afe42d0…
|
ragelink
|
1579 |
|
|
afe42d0…
|
ragelink
|
1580 |
return BaseSelection; |
|
afe42d0…
|
ragelink
|
1581 |
}); |
|
afe42d0…
|
ragelink
|
1582 |
|
|
afe42d0…
|
ragelink
|
1583 |
S2.define('select2/selection/single',[ |
|
afe42d0…
|
ragelink
|
1584 |
'jquery', |
|
afe42d0…
|
ragelink
|
1585 |
'./base', |
|
afe42d0…
|
ragelink
|
1586 |
'../utils', |
|
afe42d0…
|
ragelink
|
1587 |
'../keys' |
|
afe42d0…
|
ragelink
|
1588 |
], function ($, BaseSelection, Utils, KEYS) { |
|
afe42d0…
|
ragelink
|
1589 |
function SingleSelection () { |
|
afe42d0…
|
ragelink
|
1590 |
SingleSelection.__super__.constructor.apply(this, arguments); |
|
afe42d0…
|
ragelink
|
1591 |
} |
|
afe42d0…
|
ragelink
|
1592 |
|
|
afe42d0…
|
ragelink
|
1593 |
Utils.Extend(SingleSelection, BaseSelection); |
|
afe42d0…
|
ragelink
|
1594 |
|
|
afe42d0…
|
ragelink
|
1595 |
SingleSelection.prototype.render = function () { |
|
afe42d0…
|
ragelink
|
1596 |
var $selection = SingleSelection.__super__.render.call(this); |
|
afe42d0…
|
ragelink
|
1597 |
|
|
afe42d0…
|
ragelink
|
1598 |
$selection.addClass('select2-selection--single'); |
|
afe42d0…
|
ragelink
|
1599 |
|
|
afe42d0…
|
ragelink
|
1600 |
$selection.html( |
|
afe42d0…
|
ragelink
|
1601 |
'<span class="select2-selection__rendered"></span>' + |
|
afe42d0…
|
ragelink
|
1602 |
'<span class="select2-selection__arrow" role="presentation">' + |
|
afe42d0…
|
ragelink
|
1603 |
'<b role="presentation"></b>' + |
|
afe42d0…
|
ragelink
|
1604 |
'</span>' |
|
afe42d0…
|
ragelink
|
1605 |
); |
|
afe42d0…
|
ragelink
|
1606 |
|
|
afe42d0…
|
ragelink
|
1607 |
return $selection; |
|
afe42d0…
|
ragelink
|
1608 |
}; |
|
afe42d0…
|
ragelink
|
1609 |
|
|
afe42d0…
|
ragelink
|
1610 |
SingleSelection.prototype.bind = function (container, $container) { |
|
afe42d0…
|
ragelink
|
1611 |
var self = this; |
|
afe42d0…
|
ragelink
|
1612 |
|
|
afe42d0…
|
ragelink
|
1613 |
SingleSelection.__super__.bind.apply(this, arguments); |
|
afe42d0…
|
ragelink
|
1614 |
|
|
afe42d0…
|
ragelink
|
1615 |
var id = container.id + '-container'; |
|
afe42d0…
|
ragelink
|
1616 |
|
|
afe42d0…
|
ragelink
|
1617 |
this.$selection.find('.select2-selection__rendered') |
|
afe42d0…
|
ragelink
|
1618 |
.attr('id', id) |
|
afe42d0…
|
ragelink
|
1619 |
.attr('role', 'textbox') |
|
afe42d0…
|
ragelink
|
1620 |
.attr('aria-readonly', 'true'); |
|
afe42d0…
|
ragelink
|
1621 |
this.$selection.attr('aria-labelledby', id); |
|
afe42d0…
|
ragelink
|
1622 |
|
|
afe42d0…
|
ragelink
|
1623 |
this.$selection.on('mousedown', function (evt) { |
|
afe42d0…
|
ragelink
|
1624 |
// Only respond to left clicks |
|
afe42d0…
|
ragelink
|
1625 |
if (evt.which !== 1) { |
|
afe42d0…
|
ragelink
|
1626 |
return; |
|
afe42d0…
|
ragelink
|
1627 |
} |
|
afe42d0…
|
ragelink
|
1628 |
|
|
afe42d0…
|
ragelink
|
1629 |
self.trigger('toggle', { |
|
afe42d0…
|
ragelink
|
1630 |
originalEvent: evt |
|
afe42d0…
|
ragelink
|
1631 |
}); |
|
afe42d0…
|
ragelink
|
1632 |
}); |
|
afe42d0…
|
ragelink
|
1633 |
|
|
afe42d0…
|
ragelink
|
1634 |
this.$selection.on('focus', function (evt) { |
|
afe42d0…
|
ragelink
|
1635 |
// User focuses on the container |
|
afe42d0…
|
ragelink
|
1636 |
}); |
|
afe42d0…
|
ragelink
|
1637 |
|
|
afe42d0…
|
ragelink
|
1638 |
this.$selection.on('blur', function (evt) { |
|
afe42d0…
|
ragelink
|
1639 |
// User exits the container |
|
afe42d0…
|
ragelink
|
1640 |
}); |
|
afe42d0…
|
ragelink
|
1641 |
|
|
afe42d0…
|
ragelink
|
1642 |
container.on('focus', function (evt) { |
|
afe42d0…
|
ragelink
|
1643 |
if (!container.isOpen()) { |
|
afe42d0…
|
ragelink
|
1644 |
self.$selection.trigger('focus'); |
|
afe42d0…
|
ragelink
|
1645 |
} |
|
afe42d0…
|
ragelink
|
1646 |
}); |
|
afe42d0…
|
ragelink
|
1647 |
}; |
|
afe42d0…
|
ragelink
|
1648 |
|
|
afe42d0…
|
ragelink
|
1649 |
SingleSelection.prototype.clear = function () { |
|
afe42d0…
|
ragelink
|
1650 |
var $rendered = this.$selection.find('.select2-selection__rendered'); |
|
afe42d0…
|
ragelink
|
1651 |
$rendered.empty(); |
|
afe42d0…
|
ragelink
|
1652 |
$rendered.removeAttr('title'); // clear tooltip on empty |
|
afe42d0…
|
ragelink
|
1653 |
}; |
|
afe42d0…
|
ragelink
|
1654 |
|
|
afe42d0…
|
ragelink
|
1655 |
SingleSelection.prototype.display = function (data, container) { |
|
afe42d0…
|
ragelink
|
1656 |
var template = this.options.get('templateSelection'); |
|
afe42d0…
|
ragelink
|
1657 |
var escapeMarkup = this.options.get('escapeMarkup'); |
|
afe42d0…
|
ragelink
|
1658 |
|
|
afe42d0…
|
ragelink
|
1659 |
return escapeMarkup(template(data, container)); |
|
afe42d0…
|
ragelink
|
1660 |
}; |
|
afe42d0…
|
ragelink
|
1661 |
|
|
afe42d0…
|
ragelink
|
1662 |
SingleSelection.prototype.selectionContainer = function () { |
|
afe42d0…
|
ragelink
|
1663 |
return $('<span></span>'); |
|
afe42d0…
|
ragelink
|
1664 |
}; |
|
afe42d0…
|
ragelink
|
1665 |
|
|
afe42d0…
|
ragelink
|
1666 |
SingleSelection.prototype.update = function (data) { |
|
afe42d0…
|
ragelink
|
1667 |
if (data.length === 0) { |
|
afe42d0…
|
ragelink
|
1668 |
this.clear(); |
|
afe42d0…
|
ragelink
|
1669 |
return; |
|
afe42d0…
|
ragelink
|
1670 |
} |
|
afe42d0…
|
ragelink
|
1671 |
|
|
afe42d0…
|
ragelink
|
1672 |
var selection = data[0]; |
|
afe42d0…
|
ragelink
|
1673 |
|
|
afe42d0…
|
ragelink
|
1674 |
var $rendered = this.$selection.find('.select2-selection__rendered'); |
|
afe42d0…
|
ragelink
|
1675 |
var formatted = this.display(selection, $rendered); |
|
afe42d0…
|
ragelink
|
1676 |
|
|
afe42d0…
|
ragelink
|
1677 |
$rendered.empty().append(formatted); |
|
afe42d0…
|
ragelink
|
1678 |
|
|
afe42d0…
|
ragelink
|
1679 |
var title = selection.title || selection.text; |
|
afe42d0…
|
ragelink
|
1680 |
|
|
afe42d0…
|
ragelink
|
1681 |
if (title) { |
|
afe42d0…
|
ragelink
|
1682 |
$rendered.attr('title', title); |
|
afe42d0…
|
ragelink
|
1683 |
} else { |
|
afe42d0…
|
ragelink
|
1684 |
$rendered.removeAttr('title'); |
|
afe42d0…
|
ragelink
|
1685 |
} |
|
afe42d0…
|
ragelink
|
1686 |
}; |
|
afe42d0…
|
ragelink
|
1687 |
|
|
afe42d0…
|
ragelink
|
1688 |
return SingleSelection; |
|
afe42d0…
|
ragelink
|
1689 |
}); |
|
afe42d0…
|
ragelink
|
1690 |
|
|
afe42d0…
|
ragelink
|
1691 |
S2.define('select2/selection/multiple',[ |
|
afe42d0…
|
ragelink
|
1692 |
'jquery', |
|
afe42d0…
|
ragelink
|
1693 |
'./base', |
|
afe42d0…
|
ragelink
|
1694 |
'../utils' |
|
afe42d0…
|
ragelink
|
1695 |
], function ($, BaseSelection, Utils) { |
|
afe42d0…
|
ragelink
|
1696 |
function MultipleSelection ($element, options) { |
|
afe42d0…
|
ragelink
|
1697 |
MultipleSelection.__super__.constructor.apply(this, arguments); |
|
afe42d0…
|
ragelink
|
1698 |
} |
|
afe42d0…
|
ragelink
|
1699 |
|
|
afe42d0…
|
ragelink
|
1700 |
Utils.Extend(MultipleSelection, BaseSelection); |
|
afe42d0…
|
ragelink
|
1701 |
|
|
afe42d0…
|
ragelink
|
1702 |
MultipleSelection.prototype.render = function () { |
|
afe42d0…
|
ragelink
|
1703 |
var $selection = MultipleSelection.__super__.render.call(this); |
|
afe42d0…
|
ragelink
|
1704 |
|
|
afe42d0…
|
ragelink
|
1705 |
$selection.addClass('select2-selection--multiple'); |
|
afe42d0…
|
ragelink
|
1706 |
|
|
afe42d0…
|
ragelink
|
1707 |
$selection.html( |
|
afe42d0…
|
ragelink
|
1708 |
'<ul class="select2-selection__rendered"></ul>' |
|
afe42d0…
|
ragelink
|
1709 |
); |
|
afe42d0…
|
ragelink
|
1710 |
|
|
afe42d0…
|
ragelink
|
1711 |
return $selection; |
|
afe42d0…
|
ragelink
|
1712 |
}; |
|
afe42d0…
|
ragelink
|
1713 |
|
|
afe42d0…
|
ragelink
|
1714 |
MultipleSelection.prototype.bind = function (container, $container) { |
|
afe42d0…
|
ragelink
|
1715 |
var self = this; |
|
afe42d0…
|
ragelink
|
1716 |
|
|
afe42d0…
|
ragelink
|
1717 |
MultipleSelection.__super__.bind.apply(this, arguments); |
|
afe42d0…
|
ragelink
|
1718 |
|
|
afe42d0…
|
ragelink
|
1719 |
this.$selection.on('click', function (evt) { |
|
afe42d0…
|
ragelink
|
1720 |
self.trigger('toggle', { |
|
afe42d0…
|
ragelink
|
1721 |
originalEvent: evt |
|
afe42d0…
|
ragelink
|
1722 |
}); |
|
afe42d0…
|
ragelink
|
1723 |
}); |
|
afe42d0…
|
ragelink
|
1724 |
|
|
afe42d0…
|
ragelink
|
1725 |
this.$selection.on( |
|
afe42d0…
|
ragelink
|
1726 |
'click', |
|
afe42d0…
|
ragelink
|
1727 |
'.select2-selection__choice__remove', |
|
afe42d0…
|
ragelink
|
1728 |
function (evt) { |
|
afe42d0…
|
ragelink
|
1729 |
// Ignore the event if it is disabled |
|
afe42d0…
|
ragelink
|
1730 |
if (self.isDisabled()) { |
|
afe42d0…
|
ragelink
|
1731 |
return; |
|
afe42d0…
|
ragelink
|
1732 |
} |
|
afe42d0…
|
ragelink
|
1733 |
|
|
afe42d0…
|
ragelink
|
1734 |
var $remove = $(this); |
|
afe42d0…
|
ragelink
|
1735 |
var $selection = $remove.parent(); |
|
afe42d0…
|
ragelink
|
1736 |
|
|
afe42d0…
|
ragelink
|
1737 |
var data = Utils.GetData($selection[0], 'data'); |
|
afe42d0…
|
ragelink
|
1738 |
|
|
afe42d0…
|
ragelink
|
1739 |
self.trigger('unselect', { |
|
afe42d0…
|
ragelink
|
1740 |
originalEvent: evt, |
|
afe42d0…
|
ragelink
|
1741 |
data: data |
|
afe42d0…
|
ragelink
|
1742 |
}); |
|
afe42d0…
|
ragelink
|
1743 |
} |
|
afe42d0…
|
ragelink
|
1744 |
); |
|
afe42d0…
|
ragelink
|
1745 |
}; |
|
afe42d0…
|
ragelink
|
1746 |
|
|
afe42d0…
|
ragelink
|
1747 |
MultipleSelection.prototype.clear = function () { |
|
afe42d0…
|
ragelink
|
1748 |
var $rendered = this.$selection.find('.select2-selection__rendered'); |
|
afe42d0…
|
ragelink
|
1749 |
$rendered.empty(); |
|
afe42d0…
|
ragelink
|
1750 |
$rendered.removeAttr('title'); |
|
afe42d0…
|
ragelink
|
1751 |
}; |
|
afe42d0…
|
ragelink
|
1752 |
|
|
afe42d0…
|
ragelink
|
1753 |
MultipleSelection.prototype.display = function (data, container) { |
|
afe42d0…
|
ragelink
|
1754 |
var template = this.options.get('templateSelection'); |
|
afe42d0…
|
ragelink
|
1755 |
var escapeMarkup = this.options.get('escapeMarkup'); |
|
afe42d0…
|
ragelink
|
1756 |
|
|
afe42d0…
|
ragelink
|
1757 |
return escapeMarkup(template(data, container)); |
|
afe42d0…
|
ragelink
|
1758 |
}; |
|
afe42d0…
|
ragelink
|
1759 |
|
|
afe42d0…
|
ragelink
|
1760 |
MultipleSelection.prototype.selectionContainer = function () { |
|
afe42d0…
|
ragelink
|
1761 |
var $container = $( |
|
afe42d0…
|
ragelink
|
1762 |
'<li class="select2-selection__choice">' + |
|
afe42d0…
|
ragelink
|
1763 |
'<span class="select2-selection__choice__remove" role="presentation">' + |
|
afe42d0…
|
ragelink
|
1764 |
'×' + |
|
afe42d0…
|
ragelink
|
1765 |
'</span>' + |
|
afe42d0…
|
ragelink
|
1766 |
'</li>' |
|
afe42d0…
|
ragelink
|
1767 |
); |
|
afe42d0…
|
ragelink
|
1768 |
|
|
afe42d0…
|
ragelink
|
1769 |
return $container; |
|
afe42d0…
|
ragelink
|
1770 |
}; |
|
afe42d0…
|
ragelink
|
1771 |
|
|
afe42d0…
|
ragelink
|
1772 |
MultipleSelection.prototype.update = function (data) { |
|
afe42d0…
|
ragelink
|
1773 |
this.clear(); |
|
afe42d0…
|
ragelink
|
1774 |
|
|
afe42d0…
|
ragelink
|
1775 |
if (data.length === 0) { |
|
afe42d0…
|
ragelink
|
1776 |
return; |
|
afe42d0…
|
ragelink
|
1777 |
} |
|
afe42d0…
|
ragelink
|
1778 |
|
|
afe42d0…
|
ragelink
|
1779 |
var $selections = []; |
|
afe42d0…
|
ragelink
|
1780 |
|
|
afe42d0…
|
ragelink
|
1781 |
for (var d = 0; d < data.length; d++) { |
|
afe42d0…
|
ragelink
|
1782 |
var selection = data[d]; |
|
afe42d0…
|
ragelink
|
1783 |
|
|
afe42d0…
|
ragelink
|
1784 |
var $selection = this.selectionContainer(); |
|
afe42d0…
|
ragelink
|
1785 |
var formatted = this.display(selection, $selection); |
|
afe42d0…
|
ragelink
|
1786 |
|
|
afe42d0…
|
ragelink
|
1787 |
$selection.append(formatted); |
|
afe42d0…
|
ragelink
|
1788 |
|
|
afe42d0…
|
ragelink
|
1789 |
var title = selection.title || selection.text; |
|
afe42d0…
|
ragelink
|
1790 |
|
|
afe42d0…
|
ragelink
|
1791 |
if (title) { |
|
afe42d0…
|
ragelink
|
1792 |
$selection.attr('title', title); |
|
afe42d0…
|
ragelink
|
1793 |
} |
|
afe42d0…
|
ragelink
|
1794 |
|
|
afe42d0…
|
ragelink
|
1795 |
Utils.StoreData($selection[0], 'data', selection); |
|
afe42d0…
|
ragelink
|
1796 |
|
|
afe42d0…
|
ragelink
|
1797 |
$selections.push($selection); |
|
afe42d0…
|
ragelink
|
1798 |
} |
|
afe42d0…
|
ragelink
|
1799 |
|
|
afe42d0…
|
ragelink
|
1800 |
var $rendered = this.$selection.find('.select2-selection__rendered'); |
|
afe42d0…
|
ragelink
|
1801 |
|
|
afe42d0…
|
ragelink
|
1802 |
Utils.appendMany($rendered, $selections); |
|
afe42d0…
|
ragelink
|
1803 |
}; |
|
afe42d0…
|
ragelink
|
1804 |
|
|
afe42d0…
|
ragelink
|
1805 |
return MultipleSelection; |
|
afe42d0…
|
ragelink
|
1806 |
}); |
|
afe42d0…
|
ragelink
|
1807 |
|
|
afe42d0…
|
ragelink
|
1808 |
S2.define('select2/selection/placeholder',[ |
|
afe42d0…
|
ragelink
|
1809 |
'../utils' |
|
afe42d0…
|
ragelink
|
1810 |
], function (Utils) { |
|
afe42d0…
|
ragelink
|
1811 |
function Placeholder (decorated, $element, options) { |
|
afe42d0…
|
ragelink
|
1812 |
this.placeholder = this.normalizePlaceholder(options.get('placeholder')); |
|
afe42d0…
|
ragelink
|
1813 |
|
|
afe42d0…
|
ragelink
|
1814 |
decorated.call(this, $element, options); |
|
afe42d0…
|
ragelink
|
1815 |
} |
|
afe42d0…
|
ragelink
|
1816 |
|
|
afe42d0…
|
ragelink
|
1817 |
Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { |
|
afe42d0…
|
ragelink
|
1818 |
if (typeof placeholder === 'string') { |
|
afe42d0…
|
ragelink
|
1819 |
placeholder = { |
|
afe42d0…
|
ragelink
|
1820 |
id: '', |
|
afe42d0…
|
ragelink
|
1821 |
text: placeholder |
|
afe42d0…
|
ragelink
|
1822 |
}; |
|
afe42d0…
|
ragelink
|
1823 |
} |
|
afe42d0…
|
ragelink
|
1824 |
|
|
afe42d0…
|
ragelink
|
1825 |
return placeholder; |
|
afe42d0…
|
ragelink
|
1826 |
}; |
|
afe42d0…
|
ragelink
|
1827 |
|
|
afe42d0…
|
ragelink
|
1828 |
Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { |
|
afe42d0…
|
ragelink
|
1829 |
var $placeholder = this.selectionContainer(); |
|
afe42d0…
|
ragelink
|
1830 |
|
|
afe42d0…
|
ragelink
|
1831 |
$placeholder.html(this.display(placeholder)); |
|
afe42d0…
|
ragelink
|
1832 |
$placeholder.addClass('select2-selection__placeholder') |
|
afe42d0…
|
ragelink
|
1833 |
.removeClass('select2-selection__choice'); |
|
afe42d0…
|
ragelink
|
1834 |
|
|
afe42d0…
|
ragelink
|
1835 |
return $placeholder; |
|
afe42d0…
|
ragelink
|
1836 |
}; |
|
afe42d0…
|
ragelink
|
1837 |
|
|
afe42d0…
|
ragelink
|
1838 |
Placeholder.prototype.update = function (decorated, data) { |
|
afe42d0…
|
ragelink
|
1839 |
var singlePlaceholder = ( |
|
afe42d0…
|
ragelink
|
1840 |
data.length == 1 && data[0].id != this.placeholder.id |
|
afe42d0…
|
ragelink
|
1841 |
); |
|
afe42d0…
|
ragelink
|
1842 |
var multipleSelections = data.length > 1; |
|
afe42d0…
|
ragelink
|
1843 |
|
|
afe42d0…
|
ragelink
|
1844 |
if (multipleSelections || singlePlaceholder) { |
|
afe42d0…
|
ragelink
|
1845 |
return decorated.call(this, data); |
|
afe42d0…
|
ragelink
|
1846 |
} |
|
afe42d0…
|
ragelink
|
1847 |
|
|
afe42d0…
|
ragelink
|
1848 |
this.clear(); |
|
afe42d0…
|
ragelink
|
1849 |
|
|
afe42d0…
|
ragelink
|
1850 |
var $placeholder = this.createPlaceholder(this.placeholder); |
|
afe42d0…
|
ragelink
|
1851 |
|
|
afe42d0…
|
ragelink
|
1852 |
this.$selection.find('.select2-selection__rendered').append($placeholder); |
|
afe42d0…
|
ragelink
|
1853 |
}; |
|
afe42d0…
|
ragelink
|
1854 |
|
|
afe42d0…
|
ragelink
|
1855 |
return Placeholder; |
|
afe42d0…
|
ragelink
|
1856 |
}); |
|
afe42d0…
|
ragelink
|
1857 |
|
|
afe42d0…
|
ragelink
|
1858 |
S2.define('select2/selection/allowClear',[ |
|
afe42d0…
|
ragelink
|
1859 |
'jquery', |
|
afe42d0…
|
ragelink
|
1860 |
'../keys', |
|
afe42d0…
|
ragelink
|
1861 |
'../utils' |
|
afe42d0…
|
ragelink
|
1862 |
], function ($, KEYS, Utils) { |
|
afe42d0…
|
ragelink
|
1863 |
function AllowClear () { } |
|
afe42d0…
|
ragelink
|
1864 |
|
|
afe42d0…
|
ragelink
|
1865 |
AllowClear.prototype.bind = function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
1866 |
var self = this; |
|
afe42d0…
|
ragelink
|
1867 |
|
|
afe42d0…
|
ragelink
|
1868 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
1869 |
|
|
afe42d0…
|
ragelink
|
1870 |
if (this.placeholder == null) { |
|
afe42d0…
|
ragelink
|
1871 |
if (this.options.get('debug') && window.console && console.error) { |
|
afe42d0…
|
ragelink
|
1872 |
console.error( |
|
afe42d0…
|
ragelink
|
1873 |
'Select2: The `allowClear` option should be used in combination ' + |
|
afe42d0…
|
ragelink
|
1874 |
'with the `placeholder` option.' |
|
afe42d0…
|
ragelink
|
1875 |
); |
|
afe42d0…
|
ragelink
|
1876 |
} |
|
afe42d0…
|
ragelink
|
1877 |
} |
|
afe42d0…
|
ragelink
|
1878 |
|
|
afe42d0…
|
ragelink
|
1879 |
this.$selection.on('mousedown', '.select2-selection__clear', |
|
afe42d0…
|
ragelink
|
1880 |
function (evt) { |
|
afe42d0…
|
ragelink
|
1881 |
self._handleClear(evt); |
|
afe42d0…
|
ragelink
|
1882 |
}); |
|
afe42d0…
|
ragelink
|
1883 |
|
|
afe42d0…
|
ragelink
|
1884 |
container.on('keypress', function (evt) { |
|
afe42d0…
|
ragelink
|
1885 |
self._handleKeyboardClear(evt, container); |
|
afe42d0…
|
ragelink
|
1886 |
}); |
|
afe42d0…
|
ragelink
|
1887 |
}; |
|
afe42d0…
|
ragelink
|
1888 |
|
|
afe42d0…
|
ragelink
|
1889 |
AllowClear.prototype._handleClear = function (_, evt) { |
|
afe42d0…
|
ragelink
|
1890 |
// Ignore the event if it is disabled |
|
afe42d0…
|
ragelink
|
1891 |
if (this.isDisabled()) { |
|
afe42d0…
|
ragelink
|
1892 |
return; |
|
afe42d0…
|
ragelink
|
1893 |
} |
|
afe42d0…
|
ragelink
|
1894 |
|
|
afe42d0…
|
ragelink
|
1895 |
var $clear = this.$selection.find('.select2-selection__clear'); |
|
afe42d0…
|
ragelink
|
1896 |
|
|
afe42d0…
|
ragelink
|
1897 |
// Ignore the event if nothing has been selected |
|
afe42d0…
|
ragelink
|
1898 |
if ($clear.length === 0) { |
|
afe42d0…
|
ragelink
|
1899 |
return; |
|
afe42d0…
|
ragelink
|
1900 |
} |
|
afe42d0…
|
ragelink
|
1901 |
|
|
afe42d0…
|
ragelink
|
1902 |
evt.stopPropagation(); |
|
afe42d0…
|
ragelink
|
1903 |
|
|
afe42d0…
|
ragelink
|
1904 |
var data = Utils.GetData($clear[0], 'data'); |
|
afe42d0…
|
ragelink
|
1905 |
|
|
afe42d0…
|
ragelink
|
1906 |
var previousVal = this.$element.val(); |
|
afe42d0…
|
ragelink
|
1907 |
this.$element.val(this.placeholder.id); |
|
afe42d0…
|
ragelink
|
1908 |
|
|
afe42d0…
|
ragelink
|
1909 |
var unselectData = { |
|
afe42d0…
|
ragelink
|
1910 |
data: data |
|
afe42d0…
|
ragelink
|
1911 |
}; |
|
afe42d0…
|
ragelink
|
1912 |
this.trigger('clear', unselectData); |
|
afe42d0…
|
ragelink
|
1913 |
if (unselectData.prevented) { |
|
afe42d0…
|
ragelink
|
1914 |
this.$element.val(previousVal); |
|
afe42d0…
|
ragelink
|
1915 |
return; |
|
afe42d0…
|
ragelink
|
1916 |
} |
|
afe42d0…
|
ragelink
|
1917 |
|
|
afe42d0…
|
ragelink
|
1918 |
for (var d = 0; d < data.length; d++) { |
|
afe42d0…
|
ragelink
|
1919 |
unselectData = { |
|
afe42d0…
|
ragelink
|
1920 |
data: data[d] |
|
afe42d0…
|
ragelink
|
1921 |
}; |
|
afe42d0…
|
ragelink
|
1922 |
|
|
afe42d0…
|
ragelink
|
1923 |
// Trigger the `unselect` event, so people can prevent it from being |
|
afe42d0…
|
ragelink
|
1924 |
// cleared. |
|
afe42d0…
|
ragelink
|
1925 |
this.trigger('unselect', unselectData); |
|
afe42d0…
|
ragelink
|
1926 |
|
|
afe42d0…
|
ragelink
|
1927 |
// If the event was prevented, don't clear it out. |
|
afe42d0…
|
ragelink
|
1928 |
if (unselectData.prevented) { |
|
afe42d0…
|
ragelink
|
1929 |
this.$element.val(previousVal); |
|
afe42d0…
|
ragelink
|
1930 |
return; |
|
afe42d0…
|
ragelink
|
1931 |
} |
|
afe42d0…
|
ragelink
|
1932 |
} |
|
afe42d0…
|
ragelink
|
1933 |
|
|
afe42d0…
|
ragelink
|
1934 |
this.$element.trigger('input').trigger('change'); |
|
afe42d0…
|
ragelink
|
1935 |
|
|
afe42d0…
|
ragelink
|
1936 |
this.trigger('toggle', {}); |
|
afe42d0…
|
ragelink
|
1937 |
}; |
|
afe42d0…
|
ragelink
|
1938 |
|
|
afe42d0…
|
ragelink
|
1939 |
AllowClear.prototype._handleKeyboardClear = function (_, evt, container) { |
|
afe42d0…
|
ragelink
|
1940 |
if (container.isOpen()) { |
|
afe42d0…
|
ragelink
|
1941 |
return; |
|
afe42d0…
|
ragelink
|
1942 |
} |
|
afe42d0…
|
ragelink
|
1943 |
|
|
afe42d0…
|
ragelink
|
1944 |
if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) { |
|
afe42d0…
|
ragelink
|
1945 |
this._handleClear(evt); |
|
afe42d0…
|
ragelink
|
1946 |
} |
|
afe42d0…
|
ragelink
|
1947 |
}; |
|
afe42d0…
|
ragelink
|
1948 |
|
|
afe42d0…
|
ragelink
|
1949 |
AllowClear.prototype.update = function (decorated, data) { |
|
afe42d0…
|
ragelink
|
1950 |
decorated.call(this, data); |
|
afe42d0…
|
ragelink
|
1951 |
|
|
afe42d0…
|
ragelink
|
1952 |
if (this.$selection.find('.select2-selection__placeholder').length > 0 || |
|
afe42d0…
|
ragelink
|
1953 |
data.length === 0) { |
|
afe42d0…
|
ragelink
|
1954 |
return; |
|
afe42d0…
|
ragelink
|
1955 |
} |
|
afe42d0…
|
ragelink
|
1956 |
|
|
afe42d0…
|
ragelink
|
1957 |
var removeAll = this.options.get('translations').get('removeAllItems'); |
|
afe42d0…
|
ragelink
|
1958 |
|
|
afe42d0…
|
ragelink
|
1959 |
var $remove = $( |
|
afe42d0…
|
ragelink
|
1960 |
'<span class="select2-selection__clear" title="' + removeAll() +'">' + |
|
afe42d0…
|
ragelink
|
1961 |
'×' + |
|
afe42d0…
|
ragelink
|
1962 |
'</span>' |
|
afe42d0…
|
ragelink
|
1963 |
); |
|
afe42d0…
|
ragelink
|
1964 |
Utils.StoreData($remove[0], 'data', data); |
|
afe42d0…
|
ragelink
|
1965 |
|
|
afe42d0…
|
ragelink
|
1966 |
this.$selection.find('.select2-selection__rendered').prepend($remove); |
|
afe42d0…
|
ragelink
|
1967 |
}; |
|
afe42d0…
|
ragelink
|
1968 |
|
|
afe42d0…
|
ragelink
|
1969 |
return AllowClear; |
|
afe42d0…
|
ragelink
|
1970 |
}); |
|
afe42d0…
|
ragelink
|
1971 |
|
|
afe42d0…
|
ragelink
|
1972 |
S2.define('select2/selection/search',[ |
|
afe42d0…
|
ragelink
|
1973 |
'jquery', |
|
afe42d0…
|
ragelink
|
1974 |
'../utils', |
|
afe42d0…
|
ragelink
|
1975 |
'../keys' |
|
afe42d0…
|
ragelink
|
1976 |
], function ($, Utils, KEYS) { |
|
afe42d0…
|
ragelink
|
1977 |
function Search (decorated, $element, options) { |
|
afe42d0…
|
ragelink
|
1978 |
decorated.call(this, $element, options); |
|
afe42d0…
|
ragelink
|
1979 |
} |
|
afe42d0…
|
ragelink
|
1980 |
|
|
afe42d0…
|
ragelink
|
1981 |
Search.prototype.render = function (decorated) { |
|
afe42d0…
|
ragelink
|
1982 |
var $search = $( |
|
afe42d0…
|
ragelink
|
1983 |
'<li class="select2-search select2-search--inline">' + |
|
afe42d0…
|
ragelink
|
1984 |
'<input class="select2-search__field" type="search" tabindex="-1"' + |
|
afe42d0…
|
ragelink
|
1985 |
' autocomplete="off" autocorrect="off" autocapitalize="none"' + |
|
afe42d0…
|
ragelink
|
1986 |
' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + |
|
afe42d0…
|
ragelink
|
1987 |
'</li>' |
|
afe42d0…
|
ragelink
|
1988 |
); |
|
afe42d0…
|
ragelink
|
1989 |
|
|
afe42d0…
|
ragelink
|
1990 |
this.$searchContainer = $search; |
|
afe42d0…
|
ragelink
|
1991 |
this.$search = $search.find('input'); |
|
afe42d0…
|
ragelink
|
1992 |
|
|
afe42d0…
|
ragelink
|
1993 |
var $rendered = decorated.call(this); |
|
afe42d0…
|
ragelink
|
1994 |
|
|
afe42d0…
|
ragelink
|
1995 |
this._transferTabIndex(); |
|
afe42d0…
|
ragelink
|
1996 |
|
|
afe42d0…
|
ragelink
|
1997 |
return $rendered; |
|
afe42d0…
|
ragelink
|
1998 |
}; |
|
afe42d0…
|
ragelink
|
1999 |
|
|
afe42d0…
|
ragelink
|
2000 |
Search.prototype.bind = function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
2001 |
var self = this; |
|
afe42d0…
|
ragelink
|
2002 |
|
|
afe42d0…
|
ragelink
|
2003 |
var resultsId = container.id + '-results'; |
|
afe42d0…
|
ragelink
|
2004 |
|
|
afe42d0…
|
ragelink
|
2005 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
2006 |
|
|
afe42d0…
|
ragelink
|
2007 |
container.on('open', function () { |
|
afe42d0…
|
ragelink
|
2008 |
self.$search.attr('aria-controls', resultsId); |
|
afe42d0…
|
ragelink
|
2009 |
self.$search.trigger('focus'); |
|
afe42d0…
|
ragelink
|
2010 |
}); |
|
afe42d0…
|
ragelink
|
2011 |
|
|
afe42d0…
|
ragelink
|
2012 |
container.on('close', function () { |
|
afe42d0…
|
ragelink
|
2013 |
self.$search.val(''); |
|
afe42d0…
|
ragelink
|
2014 |
self.$search.removeAttr('aria-controls'); |
|
afe42d0…
|
ragelink
|
2015 |
self.$search.removeAttr('aria-activedescendant'); |
|
afe42d0…
|
ragelink
|
2016 |
self.$search.trigger('focus'); |
|
afe42d0…
|
ragelink
|
2017 |
}); |
|
afe42d0…
|
ragelink
|
2018 |
|
|
afe42d0…
|
ragelink
|
2019 |
container.on('enable', function () { |
|
afe42d0…
|
ragelink
|
2020 |
self.$search.prop('disabled', false); |
|
afe42d0…
|
ragelink
|
2021 |
|
|
afe42d0…
|
ragelink
|
2022 |
self._transferTabIndex(); |
|
afe42d0…
|
ragelink
|
2023 |
}); |
|
afe42d0…
|
ragelink
|
2024 |
|
|
afe42d0…
|
ragelink
|
2025 |
container.on('disable', function () { |
|
afe42d0…
|
ragelink
|
2026 |
self.$search.prop('disabled', true); |
|
afe42d0…
|
ragelink
|
2027 |
}); |
|
afe42d0…
|
ragelink
|
2028 |
|
|
afe42d0…
|
ragelink
|
2029 |
container.on('focus', function (evt) { |
|
afe42d0…
|
ragelink
|
2030 |
self.$search.trigger('focus'); |
|
afe42d0…
|
ragelink
|
2031 |
}); |
|
afe42d0…
|
ragelink
|
2032 |
|
|
afe42d0…
|
ragelink
|
2033 |
container.on('results:focus', function (params) { |
|
afe42d0…
|
ragelink
|
2034 |
if (params.data._resultId) { |
|
afe42d0…
|
ragelink
|
2035 |
self.$search.attr('aria-activedescendant', params.data._resultId); |
|
afe42d0…
|
ragelink
|
2036 |
} else { |
|
afe42d0…
|
ragelink
|
2037 |
self.$search.removeAttr('aria-activedescendant'); |
|
afe42d0…
|
ragelink
|
2038 |
} |
|
afe42d0…
|
ragelink
|
2039 |
}); |
|
afe42d0…
|
ragelink
|
2040 |
|
|
afe42d0…
|
ragelink
|
2041 |
this.$selection.on('focusin', '.select2-search--inline', function (evt) { |
|
afe42d0…
|
ragelink
|
2042 |
self.trigger('focus', evt); |
|
afe42d0…
|
ragelink
|
2043 |
}); |
|
afe42d0…
|
ragelink
|
2044 |
|
|
afe42d0…
|
ragelink
|
2045 |
this.$selection.on('focusout', '.select2-search--inline', function (evt) { |
|
afe42d0…
|
ragelink
|
2046 |
self._handleBlur(evt); |
|
afe42d0…
|
ragelink
|
2047 |
}); |
|
afe42d0…
|
ragelink
|
2048 |
|
|
afe42d0…
|
ragelink
|
2049 |
this.$selection.on('keydown', '.select2-search--inline', function (evt) { |
|
afe42d0…
|
ragelink
|
2050 |
evt.stopPropagation(); |
|
afe42d0…
|
ragelink
|
2051 |
|
|
afe42d0…
|
ragelink
|
2052 |
self.trigger('keypress', evt); |
|
afe42d0…
|
ragelink
|
2053 |
|
|
afe42d0…
|
ragelink
|
2054 |
self._keyUpPrevented = evt.isDefaultPrevented(); |
|
afe42d0…
|
ragelink
|
2055 |
|
|
afe42d0…
|
ragelink
|
2056 |
var key = evt.which; |
|
afe42d0…
|
ragelink
|
2057 |
|
|
afe42d0…
|
ragelink
|
2058 |
if (key === KEYS.BACKSPACE && self.$search.val() === '') { |
|
afe42d0…
|
ragelink
|
2059 |
var $previousChoice = self.$searchContainer |
|
afe42d0…
|
ragelink
|
2060 |
.prev('.select2-selection__choice'); |
|
afe42d0…
|
ragelink
|
2061 |
|
|
afe42d0…
|
ragelink
|
2062 |
if ($previousChoice.length > 0) { |
|
afe42d0…
|
ragelink
|
2063 |
var item = Utils.GetData($previousChoice[0], 'data'); |
|
afe42d0…
|
ragelink
|
2064 |
|
|
afe42d0…
|
ragelink
|
2065 |
self.searchRemoveChoice(item); |
|
afe42d0…
|
ragelink
|
2066 |
|
|
afe42d0…
|
ragelink
|
2067 |
evt.preventDefault(); |
|
afe42d0…
|
ragelink
|
2068 |
} |
|
afe42d0…
|
ragelink
|
2069 |
} |
|
afe42d0…
|
ragelink
|
2070 |
}); |
|
afe42d0…
|
ragelink
|
2071 |
|
|
afe42d0…
|
ragelink
|
2072 |
this.$selection.on('click', '.select2-search--inline', function (evt) { |
|
afe42d0…
|
ragelink
|
2073 |
if (self.$search.val()) { |
|
afe42d0…
|
ragelink
|
2074 |
evt.stopPropagation(); |
|
afe42d0…
|
ragelink
|
2075 |
} |
|
afe42d0…
|
ragelink
|
2076 |
}); |
|
afe42d0…
|
ragelink
|
2077 |
|
|
afe42d0…
|
ragelink
|
2078 |
// Try to detect the IE version should the `documentMode` property that |
|
afe42d0…
|
ragelink
|
2079 |
// is stored on the document. This is only implemented in IE and is |
|
afe42d0…
|
ragelink
|
2080 |
// slightly cleaner than doing a user agent check. |
|
afe42d0…
|
ragelink
|
2081 |
// This property is not available in Edge, but Edge also doesn't have |
|
afe42d0…
|
ragelink
|
2082 |
// this bug. |
|
afe42d0…
|
ragelink
|
2083 |
var msie = document.documentMode; |
|
afe42d0…
|
ragelink
|
2084 |
var disableInputEvents = msie && msie <= 11; |
|
afe42d0…
|
ragelink
|
2085 |
|
|
afe42d0…
|
ragelink
|
2086 |
// Workaround for browsers which do not support the `input` event |
|
afe42d0…
|
ragelink
|
2087 |
// This will prevent double-triggering of events for browsers which support |
|
afe42d0…
|
ragelink
|
2088 |
// both the `keyup` and `input` events. |
|
afe42d0…
|
ragelink
|
2089 |
this.$selection.on( |
|
afe42d0…
|
ragelink
|
2090 |
'input.searchcheck', |
|
afe42d0…
|
ragelink
|
2091 |
'.select2-search--inline', |
|
afe42d0…
|
ragelink
|
2092 |
function (evt) { |
|
afe42d0…
|
ragelink
|
2093 |
// IE will trigger the `input` event when a placeholder is used on a |
|
afe42d0…
|
ragelink
|
2094 |
// search box. To get around this issue, we are forced to ignore all |
|
afe42d0…
|
ragelink
|
2095 |
// `input` events in IE and keep using `keyup`. |
|
afe42d0…
|
ragelink
|
2096 |
if (disableInputEvents) { |
|
afe42d0…
|
ragelink
|
2097 |
self.$selection.off('input.search input.searchcheck'); |
|
afe42d0…
|
ragelink
|
2098 |
return; |
|
afe42d0…
|
ragelink
|
2099 |
} |
|
afe42d0…
|
ragelink
|
2100 |
|
|
afe42d0…
|
ragelink
|
2101 |
// Unbind the duplicated `keyup` event |
|
afe42d0…
|
ragelink
|
2102 |
self.$selection.off('keyup.search'); |
|
afe42d0…
|
ragelink
|
2103 |
} |
|
afe42d0…
|
ragelink
|
2104 |
); |
|
afe42d0…
|
ragelink
|
2105 |
|
|
afe42d0…
|
ragelink
|
2106 |
this.$selection.on( |
|
afe42d0…
|
ragelink
|
2107 |
'keyup.search input.search', |
|
afe42d0…
|
ragelink
|
2108 |
'.select2-search--inline', |
|
afe42d0…
|
ragelink
|
2109 |
function (evt) { |
|
afe42d0…
|
ragelink
|
2110 |
// IE will trigger the `input` event when a placeholder is used on a |
|
afe42d0…
|
ragelink
|
2111 |
// search box. To get around this issue, we are forced to ignore all |
|
afe42d0…
|
ragelink
|
2112 |
// `input` events in IE and keep using `keyup`. |
|
afe42d0…
|
ragelink
|
2113 |
if (disableInputEvents && evt.type === 'input') { |
|
afe42d0…
|
ragelink
|
2114 |
self.$selection.off('input.search input.searchcheck'); |
|
afe42d0…
|
ragelink
|
2115 |
return; |
|
afe42d0…
|
ragelink
|
2116 |
} |
|
afe42d0…
|
ragelink
|
2117 |
|
|
afe42d0…
|
ragelink
|
2118 |
var key = evt.which; |
|
afe42d0…
|
ragelink
|
2119 |
|
|
afe42d0…
|
ragelink
|
2120 |
// We can freely ignore events from modifier keys |
|
afe42d0…
|
ragelink
|
2121 |
if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) { |
|
afe42d0…
|
ragelink
|
2122 |
return; |
|
afe42d0…
|
ragelink
|
2123 |
} |
|
afe42d0…
|
ragelink
|
2124 |
|
|
afe42d0…
|
ragelink
|
2125 |
// Tabbing will be handled during the `keydown` phase |
|
afe42d0…
|
ragelink
|
2126 |
if (key == KEYS.TAB) { |
|
afe42d0…
|
ragelink
|
2127 |
return; |
|
afe42d0…
|
ragelink
|
2128 |
} |
|
afe42d0…
|
ragelink
|
2129 |
|
|
afe42d0…
|
ragelink
|
2130 |
self.handleSearch(evt); |
|
afe42d0…
|
ragelink
|
2131 |
} |
|
afe42d0…
|
ragelink
|
2132 |
); |
|
afe42d0…
|
ragelink
|
2133 |
}; |
|
afe42d0…
|
ragelink
|
2134 |
|
|
afe42d0…
|
ragelink
|
2135 |
/** |
|
afe42d0…
|
ragelink
|
2136 |
* This method will transfer the tabindex attribute from the rendered |
|
afe42d0…
|
ragelink
|
2137 |
* selection to the search box. This allows for the search box to be used as |
|
afe42d0…
|
ragelink
|
2138 |
* the primary focus instead of the selection container. |
|
afe42d0…
|
ragelink
|
2139 |
* |
|
afe42d0…
|
ragelink
|
2140 |
* @private |
|
afe42d0…
|
ragelink
|
2141 |
*/ |
|
afe42d0…
|
ragelink
|
2142 |
Search.prototype._transferTabIndex = function (decorated) { |
|
afe42d0…
|
ragelink
|
2143 |
this.$search.attr('tabindex', this.$selection.attr('tabindex')); |
|
afe42d0…
|
ragelink
|
2144 |
this.$selection.attr('tabindex', '-1'); |
|
afe42d0…
|
ragelink
|
2145 |
}; |
|
afe42d0…
|
ragelink
|
2146 |
|
|
afe42d0…
|
ragelink
|
2147 |
Search.prototype.createPlaceholder = function (decorated, placeholder) { |
|
afe42d0…
|
ragelink
|
2148 |
this.$search.attr('placeholder', placeholder.text); |
|
afe42d0…
|
ragelink
|
2149 |
}; |
|
afe42d0…
|
ragelink
|
2150 |
|
|
afe42d0…
|
ragelink
|
2151 |
Search.prototype.update = function (decorated, data) { |
|
afe42d0…
|
ragelink
|
2152 |
var searchHadFocus = this.$search[0] == document.activeElement; |
|
afe42d0…
|
ragelink
|
2153 |
|
|
afe42d0…
|
ragelink
|
2154 |
this.$search.attr('placeholder', ''); |
|
afe42d0…
|
ragelink
|
2155 |
|
|
afe42d0…
|
ragelink
|
2156 |
decorated.call(this, data); |
|
afe42d0…
|
ragelink
|
2157 |
|
|
afe42d0…
|
ragelink
|
2158 |
this.$selection.find('.select2-selection__rendered') |
|
afe42d0…
|
ragelink
|
2159 |
.append(this.$searchContainer); |
|
afe42d0…
|
ragelink
|
2160 |
|
|
afe42d0…
|
ragelink
|
2161 |
this.resizeSearch(); |
|
afe42d0…
|
ragelink
|
2162 |
if (searchHadFocus) { |
|
afe42d0…
|
ragelink
|
2163 |
this.$search.trigger('focus'); |
|
afe42d0…
|
ragelink
|
2164 |
} |
|
afe42d0…
|
ragelink
|
2165 |
}; |
|
afe42d0…
|
ragelink
|
2166 |
|
|
afe42d0…
|
ragelink
|
2167 |
Search.prototype.handleSearch = function () { |
|
afe42d0…
|
ragelink
|
2168 |
this.resizeSearch(); |
|
afe42d0…
|
ragelink
|
2169 |
|
|
afe42d0…
|
ragelink
|
2170 |
if (!this._keyUpPrevented) { |
|
afe42d0…
|
ragelink
|
2171 |
var input = this.$search.val(); |
|
afe42d0…
|
ragelink
|
2172 |
|
|
afe42d0…
|
ragelink
|
2173 |
this.trigger('query', { |
|
afe42d0…
|
ragelink
|
2174 |
term: input |
|
afe42d0…
|
ragelink
|
2175 |
}); |
|
afe42d0…
|
ragelink
|
2176 |
} |
|
afe42d0…
|
ragelink
|
2177 |
|
|
afe42d0…
|
ragelink
|
2178 |
this._keyUpPrevented = false; |
|
afe42d0…
|
ragelink
|
2179 |
}; |
|
afe42d0…
|
ragelink
|
2180 |
|
|
afe42d0…
|
ragelink
|
2181 |
Search.prototype.searchRemoveChoice = function (decorated, item) { |
|
afe42d0…
|
ragelink
|
2182 |
this.trigger('unselect', { |
|
afe42d0…
|
ragelink
|
2183 |
data: item |
|
afe42d0…
|
ragelink
|
2184 |
}); |
|
afe42d0…
|
ragelink
|
2185 |
|
|
afe42d0…
|
ragelink
|
2186 |
this.$search.val(item.text); |
|
afe42d0…
|
ragelink
|
2187 |
this.handleSearch(); |
|
afe42d0…
|
ragelink
|
2188 |
}; |
|
afe42d0…
|
ragelink
|
2189 |
|
|
afe42d0…
|
ragelink
|
2190 |
Search.prototype.resizeSearch = function () { |
|
afe42d0…
|
ragelink
|
2191 |
this.$search.css('width', '25px'); |
|
afe42d0…
|
ragelink
|
2192 |
|
|
afe42d0…
|
ragelink
|
2193 |
var width = ''; |
|
afe42d0…
|
ragelink
|
2194 |
|
|
afe42d0…
|
ragelink
|
2195 |
if (this.$search.attr('placeholder') !== '') { |
|
afe42d0…
|
ragelink
|
2196 |
width = this.$selection.find('.select2-selection__rendered').width(); |
|
afe42d0…
|
ragelink
|
2197 |
} else { |
|
afe42d0…
|
ragelink
|
2198 |
var minimumWidth = this.$search.val().length + 1; |
|
afe42d0…
|
ragelink
|
2199 |
|
|
afe42d0…
|
ragelink
|
2200 |
width = (minimumWidth * 0.75) + 'em'; |
|
afe42d0…
|
ragelink
|
2201 |
} |
|
afe42d0…
|
ragelink
|
2202 |
|
|
afe42d0…
|
ragelink
|
2203 |
this.$search.css('width', width); |
|
afe42d0…
|
ragelink
|
2204 |
}; |
|
afe42d0…
|
ragelink
|
2205 |
|
|
afe42d0…
|
ragelink
|
2206 |
return Search; |
|
afe42d0…
|
ragelink
|
2207 |
}); |
|
afe42d0…
|
ragelink
|
2208 |
|
|
afe42d0…
|
ragelink
|
2209 |
S2.define('select2/selection/eventRelay',[ |
|
afe42d0…
|
ragelink
|
2210 |
'jquery' |
|
afe42d0…
|
ragelink
|
2211 |
], function ($) { |
|
afe42d0…
|
ragelink
|
2212 |
function EventRelay () { } |
|
afe42d0…
|
ragelink
|
2213 |
|
|
afe42d0…
|
ragelink
|
2214 |
EventRelay.prototype.bind = function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
2215 |
var self = this; |
|
afe42d0…
|
ragelink
|
2216 |
var relayEvents = [ |
|
afe42d0…
|
ragelink
|
2217 |
'open', 'opening', |
|
afe42d0…
|
ragelink
|
2218 |
'close', 'closing', |
|
afe42d0…
|
ragelink
|
2219 |
'select', 'selecting', |
|
afe42d0…
|
ragelink
|
2220 |
'unselect', 'unselecting', |
|
afe42d0…
|
ragelink
|
2221 |
'clear', 'clearing' |
|
afe42d0…
|
ragelink
|
2222 |
]; |
|
afe42d0…
|
ragelink
|
2223 |
|
|
afe42d0…
|
ragelink
|
2224 |
var preventableEvents = [ |
|
afe42d0…
|
ragelink
|
2225 |
'opening', 'closing', 'selecting', 'unselecting', 'clearing' |
|
afe42d0…
|
ragelink
|
2226 |
]; |
|
afe42d0…
|
ragelink
|
2227 |
|
|
afe42d0…
|
ragelink
|
2228 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
2229 |
|
|
afe42d0…
|
ragelink
|
2230 |
container.on('*', function (name, params) { |
|
afe42d0…
|
ragelink
|
2231 |
// Ignore events that should not be relayed |
|
afe42d0…
|
ragelink
|
2232 |
if ($.inArray(name, relayEvents) === -1) { |
|
afe42d0…
|
ragelink
|
2233 |
return; |
|
afe42d0…
|
ragelink
|
2234 |
} |
|
afe42d0…
|
ragelink
|
2235 |
|
|
afe42d0…
|
ragelink
|
2236 |
// The parameters should always be an object |
|
afe42d0…
|
ragelink
|
2237 |
params = params || {}; |
|
afe42d0…
|
ragelink
|
2238 |
|
|
afe42d0…
|
ragelink
|
2239 |
// Generate the jQuery event for the Select2 event |
|
afe42d0…
|
ragelink
|
2240 |
var evt = $.Event('select2:' + name, { |
|
afe42d0…
|
ragelink
|
2241 |
params: params |
|
afe42d0…
|
ragelink
|
2242 |
}); |
|
afe42d0…
|
ragelink
|
2243 |
|
|
afe42d0…
|
ragelink
|
2244 |
self.$element.trigger(evt); |
|
afe42d0…
|
ragelink
|
2245 |
|
|
afe42d0…
|
ragelink
|
2246 |
// Only handle preventable events if it was one |
|
afe42d0…
|
ragelink
|
2247 |
if ($.inArray(name, preventableEvents) === -1) { |
|
afe42d0…
|
ragelink
|
2248 |
return; |
|
afe42d0…
|
ragelink
|
2249 |
} |
|
afe42d0…
|
ragelink
|
2250 |
|
|
afe42d0…
|
ragelink
|
2251 |
params.prevented = evt.isDefaultPrevented(); |
|
afe42d0…
|
ragelink
|
2252 |
}); |
|
afe42d0…
|
ragelink
|
2253 |
}; |
|
afe42d0…
|
ragelink
|
2254 |
|
|
afe42d0…
|
ragelink
|
2255 |
return EventRelay; |
|
afe42d0…
|
ragelink
|
2256 |
}); |
|
afe42d0…
|
ragelink
|
2257 |
|
|
afe42d0…
|
ragelink
|
2258 |
S2.define('select2/translation',[ |
|
afe42d0…
|
ragelink
|
2259 |
'jquery', |
|
afe42d0…
|
ragelink
|
2260 |
'require' |
|
afe42d0…
|
ragelink
|
2261 |
], function ($, require) { |
|
afe42d0…
|
ragelink
|
2262 |
function Translation (dict) { |
|
afe42d0…
|
ragelink
|
2263 |
this.dict = dict || {}; |
|
afe42d0…
|
ragelink
|
2264 |
} |
|
afe42d0…
|
ragelink
|
2265 |
|
|
afe42d0…
|
ragelink
|
2266 |
Translation.prototype.all = function () { |
|
afe42d0…
|
ragelink
|
2267 |
return this.dict; |
|
afe42d0…
|
ragelink
|
2268 |
}; |
|
afe42d0…
|
ragelink
|
2269 |
|
|
afe42d0…
|
ragelink
|
2270 |
Translation.prototype.get = function (key) { |
|
afe42d0…
|
ragelink
|
2271 |
return this.dict[key]; |
|
afe42d0…
|
ragelink
|
2272 |
}; |
|
afe42d0…
|
ragelink
|
2273 |
|
|
afe42d0…
|
ragelink
|
2274 |
Translation.prototype.extend = function (translation) { |
|
afe42d0…
|
ragelink
|
2275 |
this.dict = $.extend({}, translation.all(), this.dict); |
|
afe42d0…
|
ragelink
|
2276 |
}; |
|
afe42d0…
|
ragelink
|
2277 |
|
|
afe42d0…
|
ragelink
|
2278 |
// Static functions |
|
afe42d0…
|
ragelink
|
2279 |
|
|
afe42d0…
|
ragelink
|
2280 |
Translation._cache = {}; |
|
afe42d0…
|
ragelink
|
2281 |
|
|
afe42d0…
|
ragelink
|
2282 |
Translation.loadPath = function (path) { |
|
afe42d0…
|
ragelink
|
2283 |
if (!(path in Translation._cache)) { |
|
afe42d0…
|
ragelink
|
2284 |
var translations = require(path); |
|
afe42d0…
|
ragelink
|
2285 |
|
|
afe42d0…
|
ragelink
|
2286 |
Translation._cache[path] = translations; |
|
afe42d0…
|
ragelink
|
2287 |
} |
|
afe42d0…
|
ragelink
|
2288 |
|
|
afe42d0…
|
ragelink
|
2289 |
return new Translation(Translation._cache[path]); |
|
afe42d0…
|
ragelink
|
2290 |
}; |
|
afe42d0…
|
ragelink
|
2291 |
|
|
afe42d0…
|
ragelink
|
2292 |
return Translation; |
|
afe42d0…
|
ragelink
|
2293 |
}); |
|
afe42d0…
|
ragelink
|
2294 |
|
|
afe42d0…
|
ragelink
|
2295 |
S2.define('select2/diacritics',[ |
|
afe42d0…
|
ragelink
|
2296 |
|
|
afe42d0…
|
ragelink
|
2297 |
], function () { |
|
afe42d0…
|
ragelink
|
2298 |
var diacritics = { |
|
afe42d0…
|
ragelink
|
2299 |
'\u24B6': 'A', |
|
afe42d0…
|
ragelink
|
2300 |
'\uFF21': 'A', |
|
afe42d0…
|
ragelink
|
2301 |
'\u00C0': 'A', |
|
afe42d0…
|
ragelink
|
2302 |
'\u00C1': 'A', |
|
afe42d0…
|
ragelink
|
2303 |
'\u00C2': 'A', |
|
afe42d0…
|
ragelink
|
2304 |
'\u1EA6': 'A', |
|
afe42d0…
|
ragelink
|
2305 |
'\u1EA4': 'A', |
|
afe42d0…
|
ragelink
|
2306 |
'\u1EAA': 'A', |
|
afe42d0…
|
ragelink
|
2307 |
'\u1EA8': 'A', |
|
afe42d0…
|
ragelink
|
2308 |
'\u00C3': 'A', |
|
afe42d0…
|
ragelink
|
2309 |
'\u0100': 'A', |
|
afe42d0…
|
ragelink
|
2310 |
'\u0102': 'A', |
|
afe42d0…
|
ragelink
|
2311 |
'\u1EB0': 'A', |
|
afe42d0…
|
ragelink
|
2312 |
'\u1EAE': 'A', |
|
afe42d0…
|
ragelink
|
2313 |
'\u1EB4': 'A', |
|
afe42d0…
|
ragelink
|
2314 |
'\u1EB2': 'A', |
|
afe42d0…
|
ragelink
|
2315 |
'\u0226': 'A', |
|
afe42d0…
|
ragelink
|
2316 |
'\u01E0': 'A', |
|
afe42d0…
|
ragelink
|
2317 |
'\u00C4': 'A', |
|
afe42d0…
|
ragelink
|
2318 |
'\u01DE': 'A', |
|
afe42d0…
|
ragelink
|
2319 |
'\u1EA2': 'A', |
|
afe42d0…
|
ragelink
|
2320 |
'\u00C5': 'A', |
|
afe42d0…
|
ragelink
|
2321 |
'\u01FA': 'A', |
|
afe42d0…
|
ragelink
|
2322 |
'\u01CD': 'A', |
|
afe42d0…
|
ragelink
|
2323 |
'\u0200': 'A', |
|
afe42d0…
|
ragelink
|
2324 |
'\u0202': 'A', |
|
afe42d0…
|
ragelink
|
2325 |
'\u1EA0': 'A', |
|
afe42d0…
|
ragelink
|
2326 |
'\u1EAC': 'A', |
|
afe42d0…
|
ragelink
|
2327 |
'\u1EB6': 'A', |
|
afe42d0…
|
ragelink
|
2328 |
'\u1E00': 'A', |
|
afe42d0…
|
ragelink
|
2329 |
'\u0104': 'A', |
|
afe42d0…
|
ragelink
|
2330 |
'\u023A': 'A', |
|
afe42d0…
|
ragelink
|
2331 |
'\u2C6F': 'A', |
|
afe42d0…
|
ragelink
|
2332 |
'\uA732': 'AA', |
|
afe42d0…
|
ragelink
|
2333 |
'\u00C6': 'AE', |
|
afe42d0…
|
ragelink
|
2334 |
'\u01FC': 'AE', |
|
afe42d0…
|
ragelink
|
2335 |
'\u01E2': 'AE', |
|
afe42d0…
|
ragelink
|
2336 |
'\uA734': 'AO', |
|
afe42d0…
|
ragelink
|
2337 |
'\uA736': 'AU', |
|
afe42d0…
|
ragelink
|
2338 |
'\uA738': 'AV', |
|
afe42d0…
|
ragelink
|
2339 |
'\uA73A': 'AV', |
|
afe42d0…
|
ragelink
|
2340 |
'\uA73C': 'AY', |
|
afe42d0…
|
ragelink
|
2341 |
'\u24B7': 'B', |
|
afe42d0…
|
ragelink
|
2342 |
'\uFF22': 'B', |
|
afe42d0…
|
ragelink
|
2343 |
'\u1E02': 'B', |
|
afe42d0…
|
ragelink
|
2344 |
'\u1E04': 'B', |
|
afe42d0…
|
ragelink
|
2345 |
'\u1E06': 'B', |
|
afe42d0…
|
ragelink
|
2346 |
'\u0243': 'B', |
|
afe42d0…
|
ragelink
|
2347 |
'\u0182': 'B', |
|
afe42d0…
|
ragelink
|
2348 |
'\u0181': 'B', |
|
afe42d0…
|
ragelink
|
2349 |
'\u24B8': 'C', |
|
afe42d0…
|
ragelink
|
2350 |
'\uFF23': 'C', |
|
afe42d0…
|
ragelink
|
2351 |
'\u0106': 'C', |
|
afe42d0…
|
ragelink
|
2352 |
'\u0108': 'C', |
|
afe42d0…
|
ragelink
|
2353 |
'\u010A': 'C', |
|
afe42d0…
|
ragelink
|
2354 |
'\u010C': 'C', |
|
afe42d0…
|
ragelink
|
2355 |
'\u00C7': 'C', |
|
afe42d0…
|
ragelink
|
2356 |
'\u1E08': 'C', |
|
afe42d0…
|
ragelink
|
2357 |
'\u0187': 'C', |
|
afe42d0…
|
ragelink
|
2358 |
'\u023B': 'C', |
|
afe42d0…
|
ragelink
|
2359 |
'\uA73E': 'C', |
|
afe42d0…
|
ragelink
|
2360 |
'\u24B9': 'D', |
|
afe42d0…
|
ragelink
|
2361 |
'\uFF24': 'D', |
|
afe42d0…
|
ragelink
|
2362 |
'\u1E0A': 'D', |
|
afe42d0…
|
ragelink
|
2363 |
'\u010E': 'D', |
|
afe42d0…
|
ragelink
|
2364 |
'\u1E0C': 'D', |
|
afe42d0…
|
ragelink
|
2365 |
'\u1E10': 'D', |
|
afe42d0…
|
ragelink
|
2366 |
'\u1E12': 'D', |
|
afe42d0…
|
ragelink
|
2367 |
'\u1E0E': 'D', |
|
afe42d0…
|
ragelink
|
2368 |
'\u0110': 'D', |
|
afe42d0…
|
ragelink
|
2369 |
'\u018B': 'D', |
|
afe42d0…
|
ragelink
|
2370 |
'\u018A': 'D', |
|
afe42d0…
|
ragelink
|
2371 |
'\u0189': 'D', |
|
afe42d0…
|
ragelink
|
2372 |
'\uA779': 'D', |
|
afe42d0…
|
ragelink
|
2373 |
'\u01F1': 'DZ', |
|
afe42d0…
|
ragelink
|
2374 |
'\u01C4': 'DZ', |
|
afe42d0…
|
ragelink
|
2375 |
'\u01F2': 'Dz', |
|
afe42d0…
|
ragelink
|
2376 |
'\u01C5': 'Dz', |
|
afe42d0…
|
ragelink
|
2377 |
'\u24BA': 'E', |
|
afe42d0…
|
ragelink
|
2378 |
'\uFF25': 'E', |
|
afe42d0…
|
ragelink
|
2379 |
'\u00C8': 'E', |
|
afe42d0…
|
ragelink
|
2380 |
'\u00C9': 'E', |
|
afe42d0…
|
ragelink
|
2381 |
'\u00CA': 'E', |
|
afe42d0…
|
ragelink
|
2382 |
'\u1EC0': 'E', |
|
afe42d0…
|
ragelink
|
2383 |
'\u1EBE': 'E', |
|
afe42d0…
|
ragelink
|
2384 |
'\u1EC4': 'E', |
|
afe42d0…
|
ragelink
|
2385 |
'\u1EC2': 'E', |
|
afe42d0…
|
ragelink
|
2386 |
'\u1EBC': 'E', |
|
afe42d0…
|
ragelink
|
2387 |
'\u0112': 'E', |
|
afe42d0…
|
ragelink
|
2388 |
'\u1E14': 'E', |
|
afe42d0…
|
ragelink
|
2389 |
'\u1E16': 'E', |
|
afe42d0…
|
ragelink
|
2390 |
'\u0114': 'E', |
|
afe42d0…
|
ragelink
|
2391 |
'\u0116': 'E', |
|
afe42d0…
|
ragelink
|
2392 |
'\u00CB': 'E', |
|
afe42d0…
|
ragelink
|
2393 |
'\u1EBA': 'E', |
|
afe42d0…
|
ragelink
|
2394 |
'\u011A': 'E', |
|
afe42d0…
|
ragelink
|
2395 |
'\u0204': 'E', |
|
afe42d0…
|
ragelink
|
2396 |
'\u0206': 'E', |
|
afe42d0…
|
ragelink
|
2397 |
'\u1EB8': 'E', |
|
afe42d0…
|
ragelink
|
2398 |
'\u1EC6': 'E', |
|
afe42d0…
|
ragelink
|
2399 |
'\u0228': 'E', |
|
afe42d0…
|
ragelink
|
2400 |
'\u1E1C': 'E', |
|
afe42d0…
|
ragelink
|
2401 |
'\u0118': 'E', |
|
afe42d0…
|
ragelink
|
2402 |
'\u1E18': 'E', |
|
afe42d0…
|
ragelink
|
2403 |
'\u1E1A': 'E', |
|
afe42d0…
|
ragelink
|
2404 |
'\u0190': 'E', |
|
afe42d0…
|
ragelink
|
2405 |
'\u018E': 'E', |
|
afe42d0…
|
ragelink
|
2406 |
'\u24BB': 'F', |
|
afe42d0…
|
ragelink
|
2407 |
'\uFF26': 'F', |
|
afe42d0…
|
ragelink
|
2408 |
'\u1E1E': 'F', |
|
afe42d0…
|
ragelink
|
2409 |
'\u0191': 'F', |
|
afe42d0…
|
ragelink
|
2410 |
'\uA77B': 'F', |
|
afe42d0…
|
ragelink
|
2411 |
'\u24BC': 'G', |
|
afe42d0…
|
ragelink
|
2412 |
'\uFF27': 'G', |
|
afe42d0…
|
ragelink
|
2413 |
'\u01F4': 'G', |
|
afe42d0…
|
ragelink
|
2414 |
'\u011C': 'G', |
|
afe42d0…
|
ragelink
|
2415 |
'\u1E20': 'G', |
|
afe42d0…
|
ragelink
|
2416 |
'\u011E': 'G', |
|
afe42d0…
|
ragelink
|
2417 |
'\u0120': 'G', |
|
afe42d0…
|
ragelink
|
2418 |
'\u01E6': 'G', |
|
afe42d0…
|
ragelink
|
2419 |
'\u0122': 'G', |
|
afe42d0…
|
ragelink
|
2420 |
'\u01E4': 'G', |
|
afe42d0…
|
ragelink
|
2421 |
'\u0193': 'G', |
|
afe42d0…
|
ragelink
|
2422 |
'\uA7A0': 'G', |
|
afe42d0…
|
ragelink
|
2423 |
'\uA77D': 'G', |
|
afe42d0…
|
ragelink
|
2424 |
'\uA77E': 'G', |
|
afe42d0…
|
ragelink
|
2425 |
'\u24BD': 'H', |
|
afe42d0…
|
ragelink
|
2426 |
'\uFF28': 'H', |
|
afe42d0…
|
ragelink
|
2427 |
'\u0124': 'H', |
|
afe42d0…
|
ragelink
|
2428 |
'\u1E22': 'H', |
|
afe42d0…
|
ragelink
|
2429 |
'\u1E26': 'H', |
|
afe42d0…
|
ragelink
|
2430 |
'\u021E': 'H', |
|
afe42d0…
|
ragelink
|
2431 |
'\u1E24': 'H', |
|
afe42d0…
|
ragelink
|
2432 |
'\u1E28': 'H', |
|
afe42d0…
|
ragelink
|
2433 |
'\u1E2A': 'H', |
|
afe42d0…
|
ragelink
|
2434 |
'\u0126': 'H', |
|
afe42d0…
|
ragelink
|
2435 |
'\u2C67': 'H', |
|
afe42d0…
|
ragelink
|
2436 |
'\u2C75': 'H', |
|
afe42d0…
|
ragelink
|
2437 |
'\uA78D': 'H', |
|
afe42d0…
|
ragelink
|
2438 |
'\u24BE': 'I', |
|
afe42d0…
|
ragelink
|
2439 |
'\uFF29': 'I', |
|
afe42d0…
|
ragelink
|
2440 |
'\u00CC': 'I', |
|
afe42d0…
|
ragelink
|
2441 |
'\u00CD': 'I', |
|
afe42d0…
|
ragelink
|
2442 |
'\u00CE': 'I', |
|
afe42d0…
|
ragelink
|
2443 |
'\u0128': 'I', |
|
afe42d0…
|
ragelink
|
2444 |
'\u012A': 'I', |
|
afe42d0…
|
ragelink
|
2445 |
'\u012C': 'I', |
|
afe42d0…
|
ragelink
|
2446 |
'\u0130': 'I', |
|
afe42d0…
|
ragelink
|
2447 |
'\u00CF': 'I', |
|
afe42d0…
|
ragelink
|
2448 |
'\u1E2E': 'I', |
|
afe42d0…
|
ragelink
|
2449 |
'\u1EC8': 'I', |
|
afe42d0…
|
ragelink
|
2450 |
'\u01CF': 'I', |
|
afe42d0…
|
ragelink
|
2451 |
'\u0208': 'I', |
|
afe42d0…
|
ragelink
|
2452 |
'\u020A': 'I', |
|
afe42d0…
|
ragelink
|
2453 |
'\u1ECA': 'I', |
|
afe42d0…
|
ragelink
|
2454 |
'\u012E': 'I', |
|
afe42d0…
|
ragelink
|
2455 |
'\u1E2C': 'I', |
|
afe42d0…
|
ragelink
|
2456 |
'\u0197': 'I', |
|
afe42d0…
|
ragelink
|
2457 |
'\u24BF': 'J', |
|
afe42d0…
|
ragelink
|
2458 |
'\uFF2A': 'J', |
|
afe42d0…
|
ragelink
|
2459 |
'\u0134': 'J', |
|
afe42d0…
|
ragelink
|
2460 |
'\u0248': 'J', |
|
afe42d0…
|
ragelink
|
2461 |
'\u24C0': 'K', |
|
afe42d0…
|
ragelink
|
2462 |
'\uFF2B': 'K', |
|
afe42d0…
|
ragelink
|
2463 |
'\u1E30': 'K', |
|
afe42d0…
|
ragelink
|
2464 |
'\u01E8': 'K', |
|
afe42d0…
|
ragelink
|
2465 |
'\u1E32': 'K', |
|
afe42d0…
|
ragelink
|
2466 |
'\u0136': 'K', |
|
afe42d0…
|
ragelink
|
2467 |
'\u1E34': 'K', |
|
afe42d0…
|
ragelink
|
2468 |
'\u0198': 'K', |
|
afe42d0…
|
ragelink
|
2469 |
'\u2C69': 'K', |
|
afe42d0…
|
ragelink
|
2470 |
'\uA740': 'K', |
|
afe42d0…
|
ragelink
|
2471 |
'\uA742': 'K', |
|
afe42d0…
|
ragelink
|
2472 |
'\uA744': 'K', |
|
afe42d0…
|
ragelink
|
2473 |
'\uA7A2': 'K', |
|
afe42d0…
|
ragelink
|
2474 |
'\u24C1': 'L', |
|
afe42d0…
|
ragelink
|
2475 |
'\uFF2C': 'L', |
|
afe42d0…
|
ragelink
|
2476 |
'\u013F': 'L', |
|
afe42d0…
|
ragelink
|
2477 |
'\u0139': 'L', |
|
afe42d0…
|
ragelink
|
2478 |
'\u013D': 'L', |
|
afe42d0…
|
ragelink
|
2479 |
'\u1E36': 'L', |
|
afe42d0…
|
ragelink
|
2480 |
'\u1E38': 'L', |
|
afe42d0…
|
ragelink
|
2481 |
'\u013B': 'L', |
|
afe42d0…
|
ragelink
|
2482 |
'\u1E3C': 'L', |
|
afe42d0…
|
ragelink
|
2483 |
'\u1E3A': 'L', |
|
afe42d0…
|
ragelink
|
2484 |
'\u0141': 'L', |
|
afe42d0…
|
ragelink
|
2485 |
'\u023D': 'L', |
|
afe42d0…
|
ragelink
|
2486 |
'\u2C62': 'L', |
|
afe42d0…
|
ragelink
|
2487 |
'\u2C60': 'L', |
|
afe42d0…
|
ragelink
|
2488 |
'\uA748': 'L', |
|
afe42d0…
|
ragelink
|
2489 |
'\uA746': 'L', |
|
afe42d0…
|
ragelink
|
2490 |
'\uA780': 'L', |
|
afe42d0…
|
ragelink
|
2491 |
'\u01C7': 'LJ', |
|
afe42d0…
|
ragelink
|
2492 |
'\u01C8': 'Lj', |
|
afe42d0…
|
ragelink
|
2493 |
'\u24C2': 'M', |
|
afe42d0…
|
ragelink
|
2494 |
'\uFF2D': 'M', |
|
afe42d0…
|
ragelink
|
2495 |
'\u1E3E': 'M', |
|
afe42d0…
|
ragelink
|
2496 |
'\u1E40': 'M', |
|
afe42d0…
|
ragelink
|
2497 |
'\u1E42': 'M', |
|
afe42d0…
|
ragelink
|
2498 |
'\u2C6E': 'M', |
|
afe42d0…
|
ragelink
|
2499 |
'\u019C': 'M', |
|
afe42d0…
|
ragelink
|
2500 |
'\u24C3': 'N', |
|
afe42d0…
|
ragelink
|
2501 |
'\uFF2E': 'N', |
|
afe42d0…
|
ragelink
|
2502 |
'\u01F8': 'N', |
|
afe42d0…
|
ragelink
|
2503 |
'\u0143': 'N', |
|
afe42d0…
|
ragelink
|
2504 |
'\u00D1': 'N', |
|
afe42d0…
|
ragelink
|
2505 |
'\u1E44': 'N', |
|
afe42d0…
|
ragelink
|
2506 |
'\u0147': 'N', |
|
afe42d0…
|
ragelink
|
2507 |
'\u1E46': 'N', |
|
afe42d0…
|
ragelink
|
2508 |
'\u0145': 'N', |
|
afe42d0…
|
ragelink
|
2509 |
'\u1E4A': 'N', |
|
afe42d0…
|
ragelink
|
2510 |
'\u1E48': 'N', |
|
afe42d0…
|
ragelink
|
2511 |
'\u0220': 'N', |
|
afe42d0…
|
ragelink
|
2512 |
'\u019D': 'N', |
|
afe42d0…
|
ragelink
|
2513 |
'\uA790': 'N', |
|
afe42d0…
|
ragelink
|
2514 |
'\uA7A4': 'N', |
|
afe42d0…
|
ragelink
|
2515 |
'\u01CA': 'NJ', |
|
afe42d0…
|
ragelink
|
2516 |
'\u01CB': 'Nj', |
|
afe42d0…
|
ragelink
|
2517 |
'\u24C4': 'O', |
|
afe42d0…
|
ragelink
|
2518 |
'\uFF2F': 'O', |
|
afe42d0…
|
ragelink
|
2519 |
'\u00D2': 'O', |
|
afe42d0…
|
ragelink
|
2520 |
'\u00D3': 'O', |
|
afe42d0…
|
ragelink
|
2521 |
'\u00D4': 'O', |
|
afe42d0…
|
ragelink
|
2522 |
'\u1ED2': 'O', |
|
afe42d0…
|
ragelink
|
2523 |
'\u1ED0': 'O', |
|
afe42d0…
|
ragelink
|
2524 |
'\u1ED6': 'O', |
|
afe42d0…
|
ragelink
|
2525 |
'\u1ED4': 'O', |
|
afe42d0…
|
ragelink
|
2526 |
'\u00D5': 'O', |
|
afe42d0…
|
ragelink
|
2527 |
'\u1E4C': 'O', |
|
afe42d0…
|
ragelink
|
2528 |
'\u022C': 'O', |
|
afe42d0…
|
ragelink
|
2529 |
'\u1E4E': 'O', |
|
afe42d0…
|
ragelink
|
2530 |
'\u014C': 'O', |
|
afe42d0…
|
ragelink
|
2531 |
'\u1E50': 'O', |
|
afe42d0…
|
ragelink
|
2532 |
'\u1E52': 'O', |
|
afe42d0…
|
ragelink
|
2533 |
'\u014E': 'O', |
|
afe42d0…
|
ragelink
|
2534 |
'\u022E': 'O', |
|
afe42d0…
|
ragelink
|
2535 |
'\u0230': 'O', |
|
afe42d0…
|
ragelink
|
2536 |
'\u00D6': 'O', |
|
afe42d0…
|
ragelink
|
2537 |
'\u022A': 'O', |
|
afe42d0…
|
ragelink
|
2538 |
'\u1ECE': 'O', |
|
afe42d0…
|
ragelink
|
2539 |
'\u0150': 'O', |
|
afe42d0…
|
ragelink
|
2540 |
'\u01D1': 'O', |
|
afe42d0…
|
ragelink
|
2541 |
'\u020C': 'O', |
|
afe42d0…
|
ragelink
|
2542 |
'\u020E': 'O', |
|
afe42d0…
|
ragelink
|
2543 |
'\u01A0': 'O', |
|
afe42d0…
|
ragelink
|
2544 |
'\u1EDC': 'O', |
|
afe42d0…
|
ragelink
|
2545 |
'\u1EDA': 'O', |
|
afe42d0…
|
ragelink
|
2546 |
'\u1EE0': 'O', |
|
afe42d0…
|
ragelink
|
2547 |
'\u1EDE': 'O', |
|
afe42d0…
|
ragelink
|
2548 |
'\u1EE2': 'O', |
|
afe42d0…
|
ragelink
|
2549 |
'\u1ECC': 'O', |
|
afe42d0…
|
ragelink
|
2550 |
'\u1ED8': 'O', |
|
afe42d0…
|
ragelink
|
2551 |
'\u01EA': 'O', |
|
afe42d0…
|
ragelink
|
2552 |
'\u01EC': 'O', |
|
afe42d0…
|
ragelink
|
2553 |
'\u00D8': 'O', |
|
afe42d0…
|
ragelink
|
2554 |
'\u01FE': 'O', |
|
afe42d0…
|
ragelink
|
2555 |
'\u0186': 'O', |
|
afe42d0…
|
ragelink
|
2556 |
'\u019F': 'O', |
|
afe42d0…
|
ragelink
|
2557 |
'\uA74A': 'O', |
|
afe42d0…
|
ragelink
|
2558 |
'\uA74C': 'O', |
|
afe42d0…
|
ragelink
|
2559 |
'\u0152': 'OE', |
|
afe42d0…
|
ragelink
|
2560 |
'\u01A2': 'OI', |
|
afe42d0…
|
ragelink
|
2561 |
'\uA74E': 'OO', |
|
afe42d0…
|
ragelink
|
2562 |
'\u0222': 'OU', |
|
afe42d0…
|
ragelink
|
2563 |
'\u24C5': 'P', |
|
afe42d0…
|
ragelink
|
2564 |
'\uFF30': 'P', |
|
afe42d0…
|
ragelink
|
2565 |
'\u1E54': 'P', |
|
afe42d0…
|
ragelink
|
2566 |
'\u1E56': 'P', |
|
afe42d0…
|
ragelink
|
2567 |
'\u01A4': 'P', |
|
afe42d0…
|
ragelink
|
2568 |
'\u2C63': 'P', |
|
afe42d0…
|
ragelink
|
2569 |
'\uA750': 'P', |
|
afe42d0…
|
ragelink
|
2570 |
'\uA752': 'P', |
|
afe42d0…
|
ragelink
|
2571 |
'\uA754': 'P', |
|
afe42d0…
|
ragelink
|
2572 |
'\u24C6': 'Q', |
|
afe42d0…
|
ragelink
|
2573 |
'\uFF31': 'Q', |
|
afe42d0…
|
ragelink
|
2574 |
'\uA756': 'Q', |
|
afe42d0…
|
ragelink
|
2575 |
'\uA758': 'Q', |
|
afe42d0…
|
ragelink
|
2576 |
'\u024A': 'Q', |
|
afe42d0…
|
ragelink
|
2577 |
'\u24C7': 'R', |
|
afe42d0…
|
ragelink
|
2578 |
'\uFF32': 'R', |
|
afe42d0…
|
ragelink
|
2579 |
'\u0154': 'R', |
|
afe42d0…
|
ragelink
|
2580 |
'\u1E58': 'R', |
|
afe42d0…
|
ragelink
|
2581 |
'\u0158': 'R', |
|
afe42d0…
|
ragelink
|
2582 |
'\u0210': 'R', |
|
afe42d0…
|
ragelink
|
2583 |
'\u0212': 'R', |
|
afe42d0…
|
ragelink
|
2584 |
'\u1E5A': 'R', |
|
afe42d0…
|
ragelink
|
2585 |
'\u1E5C': 'R', |
|
afe42d0…
|
ragelink
|
2586 |
'\u0156': 'R', |
|
afe42d0…
|
ragelink
|
2587 |
'\u1E5E': 'R', |
|
afe42d0…
|
ragelink
|
2588 |
'\u024C': 'R', |
|
afe42d0…
|
ragelink
|
2589 |
'\u2C64': 'R', |
|
afe42d0…
|
ragelink
|
2590 |
'\uA75A': 'R', |
|
afe42d0…
|
ragelink
|
2591 |
'\uA7A6': 'R', |
|
afe42d0…
|
ragelink
|
2592 |
'\uA782': 'R', |
|
afe42d0…
|
ragelink
|
2593 |
'\u24C8': 'S', |
|
afe42d0…
|
ragelink
|
2594 |
'\uFF33': 'S', |
|
afe42d0…
|
ragelink
|
2595 |
'\u1E9E': 'S', |
|
afe42d0…
|
ragelink
|
2596 |
'\u015A': 'S', |
|
afe42d0…
|
ragelink
|
2597 |
'\u1E64': 'S', |
|
afe42d0…
|
ragelink
|
2598 |
'\u015C': 'S', |
|
afe42d0…
|
ragelink
|
2599 |
'\u1E60': 'S', |
|
afe42d0…
|
ragelink
|
2600 |
'\u0160': 'S', |
|
afe42d0…
|
ragelink
|
2601 |
'\u1E66': 'S', |
|
afe42d0…
|
ragelink
|
2602 |
'\u1E62': 'S', |
|
afe42d0…
|
ragelink
|
2603 |
'\u1E68': 'S', |
|
afe42d0…
|
ragelink
|
2604 |
'\u0218': 'S', |
|
afe42d0…
|
ragelink
|
2605 |
'\u015E': 'S', |
|
afe42d0…
|
ragelink
|
2606 |
'\u2C7E': 'S', |
|
afe42d0…
|
ragelink
|
2607 |
'\uA7A8': 'S', |
|
afe42d0…
|
ragelink
|
2608 |
'\uA784': 'S', |
|
afe42d0…
|
ragelink
|
2609 |
'\u24C9': 'T', |
|
afe42d0…
|
ragelink
|
2610 |
'\uFF34': 'T', |
|
afe42d0…
|
ragelink
|
2611 |
'\u1E6A': 'T', |
|
afe42d0…
|
ragelink
|
2612 |
'\u0164': 'T', |
|
afe42d0…
|
ragelink
|
2613 |
'\u1E6C': 'T', |
|
afe42d0…
|
ragelink
|
2614 |
'\u021A': 'T', |
|
afe42d0…
|
ragelink
|
2615 |
'\u0162': 'T', |
|
afe42d0…
|
ragelink
|
2616 |
'\u1E70': 'T', |
|
afe42d0…
|
ragelink
|
2617 |
'\u1E6E': 'T', |
|
afe42d0…
|
ragelink
|
2618 |
'\u0166': 'T', |
|
afe42d0…
|
ragelink
|
2619 |
'\u01AC': 'T', |
|
afe42d0…
|
ragelink
|
2620 |
'\u01AE': 'T', |
|
afe42d0…
|
ragelink
|
2621 |
'\u023E': 'T', |
|
afe42d0…
|
ragelink
|
2622 |
'\uA786': 'T', |
|
afe42d0…
|
ragelink
|
2623 |
'\uA728': 'TZ', |
|
afe42d0…
|
ragelink
|
2624 |
'\u24CA': 'U', |
|
afe42d0…
|
ragelink
|
2625 |
'\uFF35': 'U', |
|
afe42d0…
|
ragelink
|
2626 |
'\u00D9': 'U', |
|
afe42d0…
|
ragelink
|
2627 |
'\u00DA': 'U', |
|
afe42d0…
|
ragelink
|
2628 |
'\u00DB': 'U', |
|
afe42d0…
|
ragelink
|
2629 |
'\u0168': 'U', |
|
afe42d0…
|
ragelink
|
2630 |
'\u1E78': 'U', |
|
afe42d0…
|
ragelink
|
2631 |
'\u016A': 'U', |
|
afe42d0…
|
ragelink
|
2632 |
'\u1E7A': 'U', |
|
afe42d0…
|
ragelink
|
2633 |
'\u016C': 'U', |
|
afe42d0…
|
ragelink
|
2634 |
'\u00DC': 'U', |
|
afe42d0…
|
ragelink
|
2635 |
'\u01DB': 'U', |
|
afe42d0…
|
ragelink
|
2636 |
'\u01D7': 'U', |
|
afe42d0…
|
ragelink
|
2637 |
'\u01D5': 'U', |
|
afe42d0…
|
ragelink
|
2638 |
'\u01D9': 'U', |
|
afe42d0…
|
ragelink
|
2639 |
'\u1EE6': 'U', |
|
afe42d0…
|
ragelink
|
2640 |
'\u016E': 'U', |
|
afe42d0…
|
ragelink
|
2641 |
'\u0170': 'U', |
|
afe42d0…
|
ragelink
|
2642 |
'\u01D3': 'U', |
|
afe42d0…
|
ragelink
|
2643 |
'\u0214': 'U', |
|
afe42d0…
|
ragelink
|
2644 |
'\u0216': 'U', |
|
afe42d0…
|
ragelink
|
2645 |
'\u01AF': 'U', |
|
afe42d0…
|
ragelink
|
2646 |
'\u1EEA': 'U', |
|
afe42d0…
|
ragelink
|
2647 |
'\u1EE8': 'U', |
|
afe42d0…
|
ragelink
|
2648 |
'\u1EEE': 'U', |
|
afe42d0…
|
ragelink
|
2649 |
'\u1EEC': 'U', |
|
afe42d0…
|
ragelink
|
2650 |
'\u1EF0': 'U', |
|
afe42d0…
|
ragelink
|
2651 |
'\u1EE4': 'U', |
|
afe42d0…
|
ragelink
|
2652 |
'\u1E72': 'U', |
|
afe42d0…
|
ragelink
|
2653 |
'\u0172': 'U', |
|
afe42d0…
|
ragelink
|
2654 |
'\u1E76': 'U', |
|
afe42d0…
|
ragelink
|
2655 |
'\u1E74': 'U', |
|
afe42d0…
|
ragelink
|
2656 |
'\u0244': 'U', |
|
afe42d0…
|
ragelink
|
2657 |
'\u24CB': 'V', |
|
afe42d0…
|
ragelink
|
2658 |
'\uFF36': 'V', |
|
afe42d0…
|
ragelink
|
2659 |
'\u1E7C': 'V', |
|
afe42d0…
|
ragelink
|
2660 |
'\u1E7E': 'V', |
|
afe42d0…
|
ragelink
|
2661 |
'\u01B2': 'V', |
|
afe42d0…
|
ragelink
|
2662 |
'\uA75E': 'V', |
|
afe42d0…
|
ragelink
|
2663 |
'\u0245': 'V', |
|
afe42d0…
|
ragelink
|
2664 |
'\uA760': 'VY', |
|
afe42d0…
|
ragelink
|
2665 |
'\u24CC': 'W', |
|
afe42d0…
|
ragelink
|
2666 |
'\uFF37': 'W', |
|
afe42d0…
|
ragelink
|
2667 |
'\u1E80': 'W', |
|
afe42d0…
|
ragelink
|
2668 |
'\u1E82': 'W', |
|
afe42d0…
|
ragelink
|
2669 |
'\u0174': 'W', |
|
afe42d0…
|
ragelink
|
2670 |
'\u1E86': 'W', |
|
afe42d0…
|
ragelink
|
2671 |
'\u1E84': 'W', |
|
afe42d0…
|
ragelink
|
2672 |
'\u1E88': 'W', |
|
afe42d0…
|
ragelink
|
2673 |
'\u2C72': 'W', |
|
afe42d0…
|
ragelink
|
2674 |
'\u24CD': 'X', |
|
afe42d0…
|
ragelink
|
2675 |
'\uFF38': 'X', |
|
afe42d0…
|
ragelink
|
2676 |
'\u1E8A': 'X', |
|
afe42d0…
|
ragelink
|
2677 |
'\u1E8C': 'X', |
|
afe42d0…
|
ragelink
|
2678 |
'\u24CE': 'Y', |
|
afe42d0…
|
ragelink
|
2679 |
'\uFF39': 'Y', |
|
afe42d0…
|
ragelink
|
2680 |
'\u1EF2': 'Y', |
|
afe42d0…
|
ragelink
|
2681 |
'\u00DD': 'Y', |
|
afe42d0…
|
ragelink
|
2682 |
'\u0176': 'Y', |
|
afe42d0…
|
ragelink
|
2683 |
'\u1EF8': 'Y', |
|
afe42d0…
|
ragelink
|
2684 |
'\u0232': 'Y', |
|
afe42d0…
|
ragelink
|
2685 |
'\u1E8E': 'Y', |
|
afe42d0…
|
ragelink
|
2686 |
'\u0178': 'Y', |
|
afe42d0…
|
ragelink
|
2687 |
'\u1EF6': 'Y', |
|
afe42d0…
|
ragelink
|
2688 |
'\u1EF4': 'Y', |
|
afe42d0…
|
ragelink
|
2689 |
'\u01B3': 'Y', |
|
afe42d0…
|
ragelink
|
2690 |
'\u024E': 'Y', |
|
afe42d0…
|
ragelink
|
2691 |
'\u1EFE': 'Y', |
|
afe42d0…
|
ragelink
|
2692 |
'\u24CF': 'Z', |
|
afe42d0…
|
ragelink
|
2693 |
'\uFF3A': 'Z', |
|
afe42d0…
|
ragelink
|
2694 |
'\u0179': 'Z', |
|
afe42d0…
|
ragelink
|
2695 |
'\u1E90': 'Z', |
|
afe42d0…
|
ragelink
|
2696 |
'\u017B': 'Z', |
|
afe42d0…
|
ragelink
|
2697 |
'\u017D': 'Z', |
|
afe42d0…
|
ragelink
|
2698 |
'\u1E92': 'Z', |
|
afe42d0…
|
ragelink
|
2699 |
'\u1E94': 'Z', |
|
afe42d0…
|
ragelink
|
2700 |
'\u01B5': 'Z', |
|
afe42d0…
|
ragelink
|
2701 |
'\u0224': 'Z', |
|
afe42d0…
|
ragelink
|
2702 |
'\u2C7F': 'Z', |
|
afe42d0…
|
ragelink
|
2703 |
'\u2C6B': 'Z', |
|
afe42d0…
|
ragelink
|
2704 |
'\uA762': 'Z', |
|
afe42d0…
|
ragelink
|
2705 |
'\u24D0': 'a', |
|
afe42d0…
|
ragelink
|
2706 |
'\uFF41': 'a', |
|
afe42d0…
|
ragelink
|
2707 |
'\u1E9A': 'a', |
|
afe42d0…
|
ragelink
|
2708 |
'\u00E0': 'a', |
|
afe42d0…
|
ragelink
|
2709 |
'\u00E1': 'a', |
|
afe42d0…
|
ragelink
|
2710 |
'\u00E2': 'a', |
|
afe42d0…
|
ragelink
|
2711 |
'\u1EA7': 'a', |
|
afe42d0…
|
ragelink
|
2712 |
'\u1EA5': 'a', |
|
afe42d0…
|
ragelink
|
2713 |
'\u1EAB': 'a', |
|
afe42d0…
|
ragelink
|
2714 |
'\u1EA9': 'a', |
|
afe42d0…
|
ragelink
|
2715 |
'\u00E3': 'a', |
|
afe42d0…
|
ragelink
|
2716 |
'\u0101': 'a', |
|
afe42d0…
|
ragelink
|
2717 |
'\u0103': 'a', |
|
afe42d0…
|
ragelink
|
2718 |
'\u1EB1': 'a', |
|
afe42d0…
|
ragelink
|
2719 |
'\u1EAF': 'a', |
|
afe42d0…
|
ragelink
|
2720 |
'\u1EB5': 'a', |
|
afe42d0…
|
ragelink
|
2721 |
'\u1EB3': 'a', |
|
afe42d0…
|
ragelink
|
2722 |
'\u0227': 'a', |
|
afe42d0…
|
ragelink
|
2723 |
'\u01E1': 'a', |
|
afe42d0…
|
ragelink
|
2724 |
'\u00E4': 'a', |
|
afe42d0…
|
ragelink
|
2725 |
'\u01DF': 'a', |
|
afe42d0…
|
ragelink
|
2726 |
'\u1EA3': 'a', |
|
afe42d0…
|
ragelink
|
2727 |
'\u00E5': 'a', |
|
afe42d0…
|
ragelink
|
2728 |
'\u01FB': 'a', |
|
afe42d0…
|
ragelink
|
2729 |
'\u01CE': 'a', |
|
afe42d0…
|
ragelink
|
2730 |
'\u0201': 'a', |
|
afe42d0…
|
ragelink
|
2731 |
'\u0203': 'a', |
|
afe42d0…
|
ragelink
|
2732 |
'\u1EA1': 'a', |
|
afe42d0…
|
ragelink
|
2733 |
'\u1EAD': 'a', |
|
afe42d0…
|
ragelink
|
2734 |
'\u1EB7': 'a', |
|
afe42d0…
|
ragelink
|
2735 |
'\u1E01': 'a', |
|
afe42d0…
|
ragelink
|
2736 |
'\u0105': 'a', |
|
afe42d0…
|
ragelink
|
2737 |
'\u2C65': 'a', |
|
afe42d0…
|
ragelink
|
2738 |
'\u0250': 'a', |
|
afe42d0…
|
ragelink
|
2739 |
'\uA733': 'aa', |
|
afe42d0…
|
ragelink
|
2740 |
'\u00E6': 'ae', |
|
afe42d0…
|
ragelink
|
2741 |
'\u01FD': 'ae', |
|
afe42d0…
|
ragelink
|
2742 |
'\u01E3': 'ae', |
|
afe42d0…
|
ragelink
|
2743 |
'\uA735': 'ao', |
|
afe42d0…
|
ragelink
|
2744 |
'\uA737': 'au', |
|
afe42d0…
|
ragelink
|
2745 |
'\uA739': 'av', |
|
afe42d0…
|
ragelink
|
2746 |
'\uA73B': 'av', |
|
afe42d0…
|
ragelink
|
2747 |
'\uA73D': 'ay', |
|
afe42d0…
|
ragelink
|
2748 |
'\u24D1': 'b', |
|
afe42d0…
|
ragelink
|
2749 |
'\uFF42': 'b', |
|
afe42d0…
|
ragelink
|
2750 |
'\u1E03': 'b', |
|
afe42d0…
|
ragelink
|
2751 |
'\u1E05': 'b', |
|
afe42d0…
|
ragelink
|
2752 |
'\u1E07': 'b', |
|
afe42d0…
|
ragelink
|
2753 |
'\u0180': 'b', |
|
afe42d0…
|
ragelink
|
2754 |
'\u0183': 'b', |
|
afe42d0…
|
ragelink
|
2755 |
'\u0253': 'b', |
|
afe42d0…
|
ragelink
|
2756 |
'\u24D2': 'c', |
|
afe42d0…
|
ragelink
|
2757 |
'\uFF43': 'c', |
|
afe42d0…
|
ragelink
|
2758 |
'\u0107': 'c', |
|
afe42d0…
|
ragelink
|
2759 |
'\u0109': 'c', |
|
afe42d0…
|
ragelink
|
2760 |
'\u010B': 'c', |
|
afe42d0…
|
ragelink
|
2761 |
'\u010D': 'c', |
|
afe42d0…
|
ragelink
|
2762 |
'\u00E7': 'c', |
|
afe42d0…
|
ragelink
|
2763 |
'\u1E09': 'c', |
|
afe42d0…
|
ragelink
|
2764 |
'\u0188': 'c', |
|
afe42d0…
|
ragelink
|
2765 |
'\u023C': 'c', |
|
afe42d0…
|
ragelink
|
2766 |
'\uA73F': 'c', |
|
afe42d0…
|
ragelink
|
2767 |
'\u2184': 'c', |
|
afe42d0…
|
ragelink
|
2768 |
'\u24D3': 'd', |
|
afe42d0…
|
ragelink
|
2769 |
'\uFF44': 'd', |
|
afe42d0…
|
ragelink
|
2770 |
'\u1E0B': 'd', |
|
afe42d0…
|
ragelink
|
2771 |
'\u010F': 'd', |
|
afe42d0…
|
ragelink
|
2772 |
'\u1E0D': 'd', |
|
afe42d0…
|
ragelink
|
2773 |
'\u1E11': 'd', |
|
afe42d0…
|
ragelink
|
2774 |
'\u1E13': 'd', |
|
afe42d0…
|
ragelink
|
2775 |
'\u1E0F': 'd', |
|
afe42d0…
|
ragelink
|
2776 |
'\u0111': 'd', |
|
afe42d0…
|
ragelink
|
2777 |
'\u018C': 'd', |
|
afe42d0…
|
ragelink
|
2778 |
'\u0256': 'd', |
|
afe42d0…
|
ragelink
|
2779 |
'\u0257': 'd', |
|
afe42d0…
|
ragelink
|
2780 |
'\uA77A': 'd', |
|
afe42d0…
|
ragelink
|
2781 |
'\u01F3': 'dz', |
|
afe42d0…
|
ragelink
|
2782 |
'\u01C6': 'dz', |
|
afe42d0…
|
ragelink
|
2783 |
'\u24D4': 'e', |
|
afe42d0…
|
ragelink
|
2784 |
'\uFF45': 'e', |
|
afe42d0…
|
ragelink
|
2785 |
'\u00E8': 'e', |
|
afe42d0…
|
ragelink
|
2786 |
'\u00E9': 'e', |
|
afe42d0…
|
ragelink
|
2787 |
'\u00EA': 'e', |
|
afe42d0…
|
ragelink
|
2788 |
'\u1EC1': 'e', |
|
afe42d0…
|
ragelink
|
2789 |
'\u1EBF': 'e', |
|
afe42d0…
|
ragelink
|
2790 |
'\u1EC5': 'e', |
|
afe42d0…
|
ragelink
|
2791 |
'\u1EC3': 'e', |
|
afe42d0…
|
ragelink
|
2792 |
'\u1EBD': 'e', |
|
afe42d0…
|
ragelink
|
2793 |
'\u0113': 'e', |
|
afe42d0…
|
ragelink
|
2794 |
'\u1E15': 'e', |
|
afe42d0…
|
ragelink
|
2795 |
'\u1E17': 'e', |
|
afe42d0…
|
ragelink
|
2796 |
'\u0115': 'e', |
|
afe42d0…
|
ragelink
|
2797 |
'\u0117': 'e', |
|
afe42d0…
|
ragelink
|
2798 |
'\u00EB': 'e', |
|
afe42d0…
|
ragelink
|
2799 |
'\u1EBB': 'e', |
|
afe42d0…
|
ragelink
|
2800 |
'\u011B': 'e', |
|
afe42d0…
|
ragelink
|
2801 |
'\u0205': 'e', |
|
afe42d0…
|
ragelink
|
2802 |
'\u0207': 'e', |
|
afe42d0…
|
ragelink
|
2803 |
'\u1EB9': 'e', |
|
afe42d0…
|
ragelink
|
2804 |
'\u1EC7': 'e', |
|
afe42d0…
|
ragelink
|
2805 |
'\u0229': 'e', |
|
afe42d0…
|
ragelink
|
2806 |
'\u1E1D': 'e', |
|
afe42d0…
|
ragelink
|
2807 |
'\u0119': 'e', |
|
afe42d0…
|
ragelink
|
2808 |
'\u1E19': 'e', |
|
afe42d0…
|
ragelink
|
2809 |
'\u1E1B': 'e', |
|
afe42d0…
|
ragelink
|
2810 |
'\u0247': 'e', |
|
afe42d0…
|
ragelink
|
2811 |
'\u025B': 'e', |
|
afe42d0…
|
ragelink
|
2812 |
'\u01DD': 'e', |
|
afe42d0…
|
ragelink
|
2813 |
'\u24D5': 'f', |
|
afe42d0…
|
ragelink
|
2814 |
'\uFF46': 'f', |
|
afe42d0…
|
ragelink
|
2815 |
'\u1E1F': 'f', |
|
afe42d0…
|
ragelink
|
2816 |
'\u0192': 'f', |
|
afe42d0…
|
ragelink
|
2817 |
'\uA77C': 'f', |
|
afe42d0…
|
ragelink
|
2818 |
'\u24D6': 'g', |
|
afe42d0…
|
ragelink
|
2819 |
'\uFF47': 'g', |
|
afe42d0…
|
ragelink
|
2820 |
'\u01F5': 'g', |
|
afe42d0…
|
ragelink
|
2821 |
'\u011D': 'g', |
|
afe42d0…
|
ragelink
|
2822 |
'\u1E21': 'g', |
|
afe42d0…
|
ragelink
|
2823 |
'\u011F': 'g', |
|
afe42d0…
|
ragelink
|
2824 |
'\u0121': 'g', |
|
afe42d0…
|
ragelink
|
2825 |
'\u01E7': 'g', |
|
afe42d0…
|
ragelink
|
2826 |
'\u0123': 'g', |
|
afe42d0…
|
ragelink
|
2827 |
'\u01E5': 'g', |
|
afe42d0…
|
ragelink
|
2828 |
'\u0260': 'g', |
|
afe42d0…
|
ragelink
|
2829 |
'\uA7A1': 'g', |
|
afe42d0…
|
ragelink
|
2830 |
'\u1D79': 'g', |
|
afe42d0…
|
ragelink
|
2831 |
'\uA77F': 'g', |
|
afe42d0…
|
ragelink
|
2832 |
'\u24D7': 'h', |
|
afe42d0…
|
ragelink
|
2833 |
'\uFF48': 'h', |
|
afe42d0…
|
ragelink
|
2834 |
'\u0125': 'h', |
|
afe42d0…
|
ragelink
|
2835 |
'\u1E23': 'h', |
|
afe42d0…
|
ragelink
|
2836 |
'\u1E27': 'h', |
|
afe42d0…
|
ragelink
|
2837 |
'\u021F': 'h', |
|
afe42d0…
|
ragelink
|
2838 |
'\u1E25': 'h', |
|
afe42d0…
|
ragelink
|
2839 |
'\u1E29': 'h', |
|
afe42d0…
|
ragelink
|
2840 |
'\u1E2B': 'h', |
|
afe42d0…
|
ragelink
|
2841 |
'\u1E96': 'h', |
|
afe42d0…
|
ragelink
|
2842 |
'\u0127': 'h', |
|
afe42d0…
|
ragelink
|
2843 |
'\u2C68': 'h', |
|
afe42d0…
|
ragelink
|
2844 |
'\u2C76': 'h', |
|
afe42d0…
|
ragelink
|
2845 |
'\u0265': 'h', |
|
afe42d0…
|
ragelink
|
2846 |
'\u0195': 'hv', |
|
afe42d0…
|
ragelink
|
2847 |
'\u24D8': 'i', |
|
afe42d0…
|
ragelink
|
2848 |
'\uFF49': 'i', |
|
afe42d0…
|
ragelink
|
2849 |
'\u00EC': 'i', |
|
afe42d0…
|
ragelink
|
2850 |
'\u00ED': 'i', |
|
afe42d0…
|
ragelink
|
2851 |
'\u00EE': 'i', |
|
afe42d0…
|
ragelink
|
2852 |
'\u0129': 'i', |
|
afe42d0…
|
ragelink
|
2853 |
'\u012B': 'i', |
|
afe42d0…
|
ragelink
|
2854 |
'\u012D': 'i', |
|
afe42d0…
|
ragelink
|
2855 |
'\u00EF': 'i', |
|
afe42d0…
|
ragelink
|
2856 |
'\u1E2F': 'i', |
|
afe42d0…
|
ragelink
|
2857 |
'\u1EC9': 'i', |
|
afe42d0…
|
ragelink
|
2858 |
'\u01D0': 'i', |
|
afe42d0…
|
ragelink
|
2859 |
'\u0209': 'i', |
|
afe42d0…
|
ragelink
|
2860 |
'\u020B': 'i', |
|
afe42d0…
|
ragelink
|
2861 |
'\u1ECB': 'i', |
|
afe42d0…
|
ragelink
|
2862 |
'\u012F': 'i', |
|
afe42d0…
|
ragelink
|
2863 |
'\u1E2D': 'i', |
|
afe42d0…
|
ragelink
|
2864 |
'\u0268': 'i', |
|
afe42d0…
|
ragelink
|
2865 |
'\u0131': 'i', |
|
afe42d0…
|
ragelink
|
2866 |
'\u24D9': 'j', |
|
afe42d0…
|
ragelink
|
2867 |
'\uFF4A': 'j', |
|
afe42d0…
|
ragelink
|
2868 |
'\u0135': 'j', |
|
afe42d0…
|
ragelink
|
2869 |
'\u01F0': 'j', |
|
afe42d0…
|
ragelink
|
2870 |
'\u0249': 'j', |
|
afe42d0…
|
ragelink
|
2871 |
'\u24DA': 'k', |
|
afe42d0…
|
ragelink
|
2872 |
'\uFF4B': 'k', |
|
afe42d0…
|
ragelink
|
2873 |
'\u1E31': 'k', |
|
afe42d0…
|
ragelink
|
2874 |
'\u01E9': 'k', |
|
afe42d0…
|
ragelink
|
2875 |
'\u1E33': 'k', |
|
afe42d0…
|
ragelink
|
2876 |
'\u0137': 'k', |
|
afe42d0…
|
ragelink
|
2877 |
'\u1E35': 'k', |
|
afe42d0…
|
ragelink
|
2878 |
'\u0199': 'k', |
|
afe42d0…
|
ragelink
|
2879 |
'\u2C6A': 'k', |
|
afe42d0…
|
ragelink
|
2880 |
'\uA741': 'k', |
|
afe42d0…
|
ragelink
|
2881 |
'\uA743': 'k', |
|
afe42d0…
|
ragelink
|
2882 |
'\uA745': 'k', |
|
afe42d0…
|
ragelink
|
2883 |
'\uA7A3': 'k', |
|
afe42d0…
|
ragelink
|
2884 |
'\u24DB': 'l', |
|
afe42d0…
|
ragelink
|
2885 |
'\uFF4C': 'l', |
|
afe42d0…
|
ragelink
|
2886 |
'\u0140': 'l', |
|
afe42d0…
|
ragelink
|
2887 |
'\u013A': 'l', |
|
afe42d0…
|
ragelink
|
2888 |
'\u013E': 'l', |
|
afe42d0…
|
ragelink
|
2889 |
'\u1E37': 'l', |
|
afe42d0…
|
ragelink
|
2890 |
'\u1E39': 'l', |
|
afe42d0…
|
ragelink
|
2891 |
'\u013C': 'l', |
|
afe42d0…
|
ragelink
|
2892 |
'\u1E3D': 'l', |
|
afe42d0…
|
ragelink
|
2893 |
'\u1E3B': 'l', |
|
afe42d0…
|
ragelink
|
2894 |
'\u017F': 'l', |
|
afe42d0…
|
ragelink
|
2895 |
'\u0142': 'l', |
|
afe42d0…
|
ragelink
|
2896 |
'\u019A': 'l', |
|
afe42d0…
|
ragelink
|
2897 |
'\u026B': 'l', |
|
afe42d0…
|
ragelink
|
2898 |
'\u2C61': 'l', |
|
afe42d0…
|
ragelink
|
2899 |
'\uA749': 'l', |
|
afe42d0…
|
ragelink
|
2900 |
'\uA781': 'l', |
|
afe42d0…
|
ragelink
|
2901 |
'\uA747': 'l', |
|
afe42d0…
|
ragelink
|
2902 |
'\u01C9': 'lj', |
|
afe42d0…
|
ragelink
|
2903 |
'\u24DC': 'm', |
|
afe42d0…
|
ragelink
|
2904 |
'\uFF4D': 'm', |
|
afe42d0…
|
ragelink
|
2905 |
'\u1E3F': 'm', |
|
afe42d0…
|
ragelink
|
2906 |
'\u1E41': 'm', |
|
afe42d0…
|
ragelink
|
2907 |
'\u1E43': 'm', |
|
afe42d0…
|
ragelink
|
2908 |
'\u0271': 'm', |
|
afe42d0…
|
ragelink
|
2909 |
'\u026F': 'm', |
|
afe42d0…
|
ragelink
|
2910 |
'\u24DD': 'n', |
|
afe42d0…
|
ragelink
|
2911 |
'\uFF4E': 'n', |
|
afe42d0…
|
ragelink
|
2912 |
'\u01F9': 'n', |
|
afe42d0…
|
ragelink
|
2913 |
'\u0144': 'n', |
|
afe42d0…
|
ragelink
|
2914 |
'\u00F1': 'n', |
|
afe42d0…
|
ragelink
|
2915 |
'\u1E45': 'n', |
|
afe42d0…
|
ragelink
|
2916 |
'\u0148': 'n', |
|
afe42d0…
|
ragelink
|
2917 |
'\u1E47': 'n', |
|
afe42d0…
|
ragelink
|
2918 |
'\u0146': 'n', |
|
afe42d0…
|
ragelink
|
2919 |
'\u1E4B': 'n', |
|
afe42d0…
|
ragelink
|
2920 |
'\u1E49': 'n', |
|
afe42d0…
|
ragelink
|
2921 |
'\u019E': 'n', |
|
afe42d0…
|
ragelink
|
2922 |
'\u0272': 'n', |
|
afe42d0…
|
ragelink
|
2923 |
'\u0149': 'n', |
|
afe42d0…
|
ragelink
|
2924 |
'\uA791': 'n', |
|
afe42d0…
|
ragelink
|
2925 |
'\uA7A5': 'n', |
|
afe42d0…
|
ragelink
|
2926 |
'\u01CC': 'nj', |
|
afe42d0…
|
ragelink
|
2927 |
'\u24DE': 'o', |
|
afe42d0…
|
ragelink
|
2928 |
'\uFF4F': 'o', |
|
afe42d0…
|
ragelink
|
2929 |
'\u00F2': 'o', |
|
afe42d0…
|
ragelink
|
2930 |
'\u00F3': 'o', |
|
afe42d0…
|
ragelink
|
2931 |
'\u00F4': 'o', |
|
afe42d0…
|
ragelink
|
2932 |
'\u1ED3': 'o', |
|
afe42d0…
|
ragelink
|
2933 |
'\u1ED1': 'o', |
|
afe42d0…
|
ragelink
|
2934 |
'\u1ED7': 'o', |
|
afe42d0…
|
ragelink
|
2935 |
'\u1ED5': 'o', |
|
afe42d0…
|
ragelink
|
2936 |
'\u00F5': 'o', |
|
afe42d0…
|
ragelink
|
2937 |
'\u1E4D': 'o', |
|
afe42d0…
|
ragelink
|
2938 |
'\u022D': 'o', |
|
afe42d0…
|
ragelink
|
2939 |
'\u1E4F': 'o', |
|
afe42d0…
|
ragelink
|
2940 |
'\u014D': 'o', |
|
afe42d0…
|
ragelink
|
2941 |
'\u1E51': 'o', |
|
afe42d0…
|
ragelink
|
2942 |
'\u1E53': 'o', |
|
afe42d0…
|
ragelink
|
2943 |
'\u014F': 'o', |
|
afe42d0…
|
ragelink
|
2944 |
'\u022F': 'o', |
|
afe42d0…
|
ragelink
|
2945 |
'\u0231': 'o', |
|
afe42d0…
|
ragelink
|
2946 |
'\u00F6': 'o', |
|
afe42d0…
|
ragelink
|
2947 |
'\u022B': 'o', |
|
afe42d0…
|
ragelink
|
2948 |
'\u1ECF': 'o', |
|
afe42d0…
|
ragelink
|
2949 |
'\u0151': 'o', |
|
afe42d0…
|
ragelink
|
2950 |
'\u01D2': 'o', |
|
afe42d0…
|
ragelink
|
2951 |
'\u020D': 'o', |
|
afe42d0…
|
ragelink
|
2952 |
'\u020F': 'o', |
|
afe42d0…
|
ragelink
|
2953 |
'\u01A1': 'o', |
|
afe42d0…
|
ragelink
|
2954 |
'\u1EDD': 'o', |
|
afe42d0…
|
ragelink
|
2955 |
'\u1EDB': 'o', |
|
afe42d0…
|
ragelink
|
2956 |
'\u1EE1': 'o', |
|
afe42d0…
|
ragelink
|
2957 |
'\u1EDF': 'o', |
|
afe42d0…
|
ragelink
|
2958 |
'\u1EE3': 'o', |
|
afe42d0…
|
ragelink
|
2959 |
'\u1ECD': 'o', |
|
afe42d0…
|
ragelink
|
2960 |
'\u1ED9': 'o', |
|
afe42d0…
|
ragelink
|
2961 |
'\u01EB': 'o', |
|
afe42d0…
|
ragelink
|
2962 |
'\u01ED': 'o', |
|
afe42d0…
|
ragelink
|
2963 |
'\u00F8': 'o', |
|
afe42d0…
|
ragelink
|
2964 |
'\u01FF': 'o', |
|
afe42d0…
|
ragelink
|
2965 |
'\u0254': 'o', |
|
afe42d0…
|
ragelink
|
2966 |
'\uA74B': 'o', |
|
afe42d0…
|
ragelink
|
2967 |
'\uA74D': 'o', |
|
afe42d0…
|
ragelink
|
2968 |
'\u0275': 'o', |
|
afe42d0…
|
ragelink
|
2969 |
'\u0153': 'oe', |
|
afe42d0…
|
ragelink
|
2970 |
'\u01A3': 'oi', |
|
afe42d0…
|
ragelink
|
2971 |
'\u0223': 'ou', |
|
afe42d0…
|
ragelink
|
2972 |
'\uA74F': 'oo', |
|
afe42d0…
|
ragelink
|
2973 |
'\u24DF': 'p', |
|
afe42d0…
|
ragelink
|
2974 |
'\uFF50': 'p', |
|
afe42d0…
|
ragelink
|
2975 |
'\u1E55': 'p', |
|
afe42d0…
|
ragelink
|
2976 |
'\u1E57': 'p', |
|
afe42d0…
|
ragelink
|
2977 |
'\u01A5': 'p', |
|
afe42d0…
|
ragelink
|
2978 |
'\u1D7D': 'p', |
|
afe42d0…
|
ragelink
|
2979 |
'\uA751': 'p', |
|
afe42d0…
|
ragelink
|
2980 |
'\uA753': 'p', |
|
afe42d0…
|
ragelink
|
2981 |
'\uA755': 'p', |
|
afe42d0…
|
ragelink
|
2982 |
'\u24E0': 'q', |
|
afe42d0…
|
ragelink
|
2983 |
'\uFF51': 'q', |
|
afe42d0…
|
ragelink
|
2984 |
'\u024B': 'q', |
|
afe42d0…
|
ragelink
|
2985 |
'\uA757': 'q', |
|
afe42d0…
|
ragelink
|
2986 |
'\uA759': 'q', |
|
afe42d0…
|
ragelink
|
2987 |
'\u24E1': 'r', |
|
afe42d0…
|
ragelink
|
2988 |
'\uFF52': 'r', |
|
afe42d0…
|
ragelink
|
2989 |
'\u0155': 'r', |
|
afe42d0…
|
ragelink
|
2990 |
'\u1E59': 'r', |
|
afe42d0…
|
ragelink
|
2991 |
'\u0159': 'r', |
|
afe42d0…
|
ragelink
|
2992 |
'\u0211': 'r', |
|
afe42d0…
|
ragelink
|
2993 |
'\u0213': 'r', |
|
afe42d0…
|
ragelink
|
2994 |
'\u1E5B': 'r', |
|
afe42d0…
|
ragelink
|
2995 |
'\u1E5D': 'r', |
|
afe42d0…
|
ragelink
|
2996 |
'\u0157': 'r', |
|
afe42d0…
|
ragelink
|
2997 |
'\u1E5F': 'r', |
|
afe42d0…
|
ragelink
|
2998 |
'\u024D': 'r', |
|
afe42d0…
|
ragelink
|
2999 |
'\u027D': 'r', |
|
afe42d0…
|
ragelink
|
3000 |
'\uA75B': 'r', |
|
afe42d0…
|
ragelink
|
3001 |
'\uA7A7': 'r', |
|
afe42d0…
|
ragelink
|
3002 |
'\uA783': 'r', |
|
afe42d0…
|
ragelink
|
3003 |
'\u24E2': 's', |
|
afe42d0…
|
ragelink
|
3004 |
'\uFF53': 's', |
|
afe42d0…
|
ragelink
|
3005 |
'\u00DF': 's', |
|
afe42d0…
|
ragelink
|
3006 |
'\u015B': 's', |
|
afe42d0…
|
ragelink
|
3007 |
'\u1E65': 's', |
|
afe42d0…
|
ragelink
|
3008 |
'\u015D': 's', |
|
afe42d0…
|
ragelink
|
3009 |
'\u1E61': 's', |
|
afe42d0…
|
ragelink
|
3010 |
'\u0161': 's', |
|
afe42d0…
|
ragelink
|
3011 |
'\u1E67': 's', |
|
afe42d0…
|
ragelink
|
3012 |
'\u1E63': 's', |
|
afe42d0…
|
ragelink
|
3013 |
'\u1E69': 's', |
|
afe42d0…
|
ragelink
|
3014 |
'\u0219': 's', |
|
afe42d0…
|
ragelink
|
3015 |
'\u015F': 's', |
|
afe42d0…
|
ragelink
|
3016 |
'\u023F': 's', |
|
afe42d0…
|
ragelink
|
3017 |
'\uA7A9': 's', |
|
afe42d0…
|
ragelink
|
3018 |
'\uA785': 's', |
|
afe42d0…
|
ragelink
|
3019 |
'\u1E9B': 's', |
|
afe42d0…
|
ragelink
|
3020 |
'\u24E3': 't', |
|
afe42d0…
|
ragelink
|
3021 |
'\uFF54': 't', |
|
afe42d0…
|
ragelink
|
3022 |
'\u1E6B': 't', |
|
afe42d0…
|
ragelink
|
3023 |
'\u1E97': 't', |
|
afe42d0…
|
ragelink
|
3024 |
'\u0165': 't', |
|
afe42d0…
|
ragelink
|
3025 |
'\u1E6D': 't', |
|
afe42d0…
|
ragelink
|
3026 |
'\u021B': 't', |
|
afe42d0…
|
ragelink
|
3027 |
'\u0163': 't', |
|
afe42d0…
|
ragelink
|
3028 |
'\u1E71': 't', |
|
afe42d0…
|
ragelink
|
3029 |
'\u1E6F': 't', |
|
afe42d0…
|
ragelink
|
3030 |
'\u0167': 't', |
|
afe42d0…
|
ragelink
|
3031 |
'\u01AD': 't', |
|
afe42d0…
|
ragelink
|
3032 |
'\u0288': 't', |
|
afe42d0…
|
ragelink
|
3033 |
'\u2C66': 't', |
|
afe42d0…
|
ragelink
|
3034 |
'\uA787': 't', |
|
afe42d0…
|
ragelink
|
3035 |
'\uA729': 'tz', |
|
afe42d0…
|
ragelink
|
3036 |
'\u24E4': 'u', |
|
afe42d0…
|
ragelink
|
3037 |
'\uFF55': 'u', |
|
afe42d0…
|
ragelink
|
3038 |
'\u00F9': 'u', |
|
afe42d0…
|
ragelink
|
3039 |
'\u00FA': 'u', |
|
afe42d0…
|
ragelink
|
3040 |
'\u00FB': 'u', |
|
afe42d0…
|
ragelink
|
3041 |
'\u0169': 'u', |
|
afe42d0…
|
ragelink
|
3042 |
'\u1E79': 'u', |
|
afe42d0…
|
ragelink
|
3043 |
'\u016B': 'u', |
|
afe42d0…
|
ragelink
|
3044 |
'\u1E7B': 'u', |
|
afe42d0…
|
ragelink
|
3045 |
'\u016D': 'u', |
|
afe42d0…
|
ragelink
|
3046 |
'\u00FC': 'u', |
|
afe42d0…
|
ragelink
|
3047 |
'\u01DC': 'u', |
|
afe42d0…
|
ragelink
|
3048 |
'\u01D8': 'u', |
|
afe42d0…
|
ragelink
|
3049 |
'\u01D6': 'u', |
|
afe42d0…
|
ragelink
|
3050 |
'\u01DA': 'u', |
|
afe42d0…
|
ragelink
|
3051 |
'\u1EE7': 'u', |
|
afe42d0…
|
ragelink
|
3052 |
'\u016F': 'u', |
|
afe42d0…
|
ragelink
|
3053 |
'\u0171': 'u', |
|
afe42d0…
|
ragelink
|
3054 |
'\u01D4': 'u', |
|
afe42d0…
|
ragelink
|
3055 |
'\u0215': 'u', |
|
afe42d0…
|
ragelink
|
3056 |
'\u0217': 'u', |
|
afe42d0…
|
ragelink
|
3057 |
'\u01B0': 'u', |
|
afe42d0…
|
ragelink
|
3058 |
'\u1EEB': 'u', |
|
afe42d0…
|
ragelink
|
3059 |
'\u1EE9': 'u', |
|
afe42d0…
|
ragelink
|
3060 |
'\u1EEF': 'u', |
|
afe42d0…
|
ragelink
|
3061 |
'\u1EED': 'u', |
|
afe42d0…
|
ragelink
|
3062 |
'\u1EF1': 'u', |
|
afe42d0…
|
ragelink
|
3063 |
'\u1EE5': 'u', |
|
afe42d0…
|
ragelink
|
3064 |
'\u1E73': 'u', |
|
afe42d0…
|
ragelink
|
3065 |
'\u0173': 'u', |
|
afe42d0…
|
ragelink
|
3066 |
'\u1E77': 'u', |
|
afe42d0…
|
ragelink
|
3067 |
'\u1E75': 'u', |
|
afe42d0…
|
ragelink
|
3068 |
'\u0289': 'u', |
|
afe42d0…
|
ragelink
|
3069 |
'\u24E5': 'v', |
|
afe42d0…
|
ragelink
|
3070 |
'\uFF56': 'v', |
|
afe42d0…
|
ragelink
|
3071 |
'\u1E7D': 'v', |
|
afe42d0…
|
ragelink
|
3072 |
'\u1E7F': 'v', |
|
afe42d0…
|
ragelink
|
3073 |
'\u028B': 'v', |
|
afe42d0…
|
ragelink
|
3074 |
'\uA75F': 'v', |
|
afe42d0…
|
ragelink
|
3075 |
'\u028C': 'v', |
|
afe42d0…
|
ragelink
|
3076 |
'\uA761': 'vy', |
|
afe42d0…
|
ragelink
|
3077 |
'\u24E6': 'w', |
|
afe42d0…
|
ragelink
|
3078 |
'\uFF57': 'w', |
|
afe42d0…
|
ragelink
|
3079 |
'\u1E81': 'w', |
|
afe42d0…
|
ragelink
|
3080 |
'\u1E83': 'w', |
|
afe42d0…
|
ragelink
|
3081 |
'\u0175': 'w', |
|
afe42d0…
|
ragelink
|
3082 |
'\u1E87': 'w', |
|
afe42d0…
|
ragelink
|
3083 |
'\u1E85': 'w', |
|
afe42d0…
|
ragelink
|
3084 |
'\u1E98': 'w', |
|
afe42d0…
|
ragelink
|
3085 |
'\u1E89': 'w', |
|
afe42d0…
|
ragelink
|
3086 |
'\u2C73': 'w', |
|
afe42d0…
|
ragelink
|
3087 |
'\u24E7': 'x', |
|
afe42d0…
|
ragelink
|
3088 |
'\uFF58': 'x', |
|
afe42d0…
|
ragelink
|
3089 |
'\u1E8B': 'x', |
|
afe42d0…
|
ragelink
|
3090 |
'\u1E8D': 'x', |
|
afe42d0…
|
ragelink
|
3091 |
'\u24E8': 'y', |
|
afe42d0…
|
ragelink
|
3092 |
'\uFF59': 'y', |
|
afe42d0…
|
ragelink
|
3093 |
'\u1EF3': 'y', |
|
afe42d0…
|
ragelink
|
3094 |
'\u00FD': 'y', |
|
afe42d0…
|
ragelink
|
3095 |
'\u0177': 'y', |
|
afe42d0…
|
ragelink
|
3096 |
'\u1EF9': 'y', |
|
afe42d0…
|
ragelink
|
3097 |
'\u0233': 'y', |
|
afe42d0…
|
ragelink
|
3098 |
'\u1E8F': 'y', |
|
afe42d0…
|
ragelink
|
3099 |
'\u00FF': 'y', |
|
afe42d0…
|
ragelink
|
3100 |
'\u1EF7': 'y', |
|
afe42d0…
|
ragelink
|
3101 |
'\u1E99': 'y', |
|
afe42d0…
|
ragelink
|
3102 |
'\u1EF5': 'y', |
|
afe42d0…
|
ragelink
|
3103 |
'\u01B4': 'y', |
|
afe42d0…
|
ragelink
|
3104 |
'\u024F': 'y', |
|
afe42d0…
|
ragelink
|
3105 |
'\u1EFF': 'y', |
|
afe42d0…
|
ragelink
|
3106 |
'\u24E9': 'z', |
|
afe42d0…
|
ragelink
|
3107 |
'\uFF5A': 'z', |
|
afe42d0…
|
ragelink
|
3108 |
'\u017A': 'z', |
|
afe42d0…
|
ragelink
|
3109 |
'\u1E91': 'z', |
|
afe42d0…
|
ragelink
|
3110 |
'\u017C': 'z', |
|
afe42d0…
|
ragelink
|
3111 |
'\u017E': 'z', |
|
afe42d0…
|
ragelink
|
3112 |
'\u1E93': 'z', |
|
afe42d0…
|
ragelink
|
3113 |
'\u1E95': 'z', |
|
afe42d0…
|
ragelink
|
3114 |
'\u01B6': 'z', |
|
afe42d0…
|
ragelink
|
3115 |
'\u0225': 'z', |
|
afe42d0…
|
ragelink
|
3116 |
'\u0240': 'z', |
|
afe42d0…
|
ragelink
|
3117 |
'\u2C6C': 'z', |
|
afe42d0…
|
ragelink
|
3118 |
'\uA763': 'z', |
|
afe42d0…
|
ragelink
|
3119 |
'\u0386': '\u0391', |
|
afe42d0…
|
ragelink
|
3120 |
'\u0388': '\u0395', |
|
afe42d0…
|
ragelink
|
3121 |
'\u0389': '\u0397', |
|
afe42d0…
|
ragelink
|
3122 |
'\u038A': '\u0399', |
|
afe42d0…
|
ragelink
|
3123 |
'\u03AA': '\u0399', |
|
afe42d0…
|
ragelink
|
3124 |
'\u038C': '\u039F', |
|
afe42d0…
|
ragelink
|
3125 |
'\u038E': '\u03A5', |
|
afe42d0…
|
ragelink
|
3126 |
'\u03AB': '\u03A5', |
|
afe42d0…
|
ragelink
|
3127 |
'\u038F': '\u03A9', |
|
afe42d0…
|
ragelink
|
3128 |
'\u03AC': '\u03B1', |
|
afe42d0…
|
ragelink
|
3129 |
'\u03AD': '\u03B5', |
|
afe42d0…
|
ragelink
|
3130 |
'\u03AE': '\u03B7', |
|
afe42d0…
|
ragelink
|
3131 |
'\u03AF': '\u03B9', |
|
afe42d0…
|
ragelink
|
3132 |
'\u03CA': '\u03B9', |
|
afe42d0…
|
ragelink
|
3133 |
'\u0390': '\u03B9', |
|
afe42d0…
|
ragelink
|
3134 |
'\u03CC': '\u03BF', |
|
afe42d0…
|
ragelink
|
3135 |
'\u03CD': '\u03C5', |
|
afe42d0…
|
ragelink
|
3136 |
'\u03CB': '\u03C5', |
|
afe42d0…
|
ragelink
|
3137 |
'\u03B0': '\u03C5', |
|
afe42d0…
|
ragelink
|
3138 |
'\u03CE': '\u03C9', |
|
afe42d0…
|
ragelink
|
3139 |
'\u03C2': '\u03C3', |
|
afe42d0…
|
ragelink
|
3140 |
'\u2019': '\'' |
|
afe42d0…
|
ragelink
|
3141 |
}; |
|
afe42d0…
|
ragelink
|
3142 |
|
|
afe42d0…
|
ragelink
|
3143 |
return diacritics; |
|
afe42d0…
|
ragelink
|
3144 |
}); |
|
afe42d0…
|
ragelink
|
3145 |
|
|
afe42d0…
|
ragelink
|
3146 |
S2.define('select2/data/base',[ |
|
afe42d0…
|
ragelink
|
3147 |
'../utils' |
|
afe42d0…
|
ragelink
|
3148 |
], function (Utils) { |
|
afe42d0…
|
ragelink
|
3149 |
function BaseAdapter ($element, options) { |
|
afe42d0…
|
ragelink
|
3150 |
BaseAdapter.__super__.constructor.call(this); |
|
afe42d0…
|
ragelink
|
3151 |
} |
|
afe42d0…
|
ragelink
|
3152 |
|
|
afe42d0…
|
ragelink
|
3153 |
Utils.Extend(BaseAdapter, Utils.Observable); |
|
afe42d0…
|
ragelink
|
3154 |
|
|
afe42d0…
|
ragelink
|
3155 |
BaseAdapter.prototype.current = function (callback) { |
|
afe42d0…
|
ragelink
|
3156 |
throw new Error('The `current` method must be defined in child classes.'); |
|
afe42d0…
|
ragelink
|
3157 |
}; |
|
afe42d0…
|
ragelink
|
3158 |
|
|
afe42d0…
|
ragelink
|
3159 |
BaseAdapter.prototype.query = function (params, callback) { |
|
afe42d0…
|
ragelink
|
3160 |
throw new Error('The `query` method must be defined in child classes.'); |
|
afe42d0…
|
ragelink
|
3161 |
}; |
|
afe42d0…
|
ragelink
|
3162 |
|
|
afe42d0…
|
ragelink
|
3163 |
BaseAdapter.prototype.bind = function (container, $container) { |
|
afe42d0…
|
ragelink
|
3164 |
// Can be implemented in subclasses |
|
afe42d0…
|
ragelink
|
3165 |
}; |
|
afe42d0…
|
ragelink
|
3166 |
|
|
afe42d0…
|
ragelink
|
3167 |
BaseAdapter.prototype.destroy = function () { |
|
afe42d0…
|
ragelink
|
3168 |
// Can be implemented in subclasses |
|
afe42d0…
|
ragelink
|
3169 |
}; |
|
afe42d0…
|
ragelink
|
3170 |
|
|
afe42d0…
|
ragelink
|
3171 |
BaseAdapter.prototype.generateResultId = function (container, data) { |
|
afe42d0…
|
ragelink
|
3172 |
var id = container.id + '-result-'; |
|
afe42d0…
|
ragelink
|
3173 |
|
|
afe42d0…
|
ragelink
|
3174 |
id += Utils.generateChars(4); |
|
afe42d0…
|
ragelink
|
3175 |
|
|
afe42d0…
|
ragelink
|
3176 |
if (data.id != null) { |
|
afe42d0…
|
ragelink
|
3177 |
id += '-' + data.id.toString(); |
|
afe42d0…
|
ragelink
|
3178 |
} else { |
|
afe42d0…
|
ragelink
|
3179 |
id += '-' + Utils.generateChars(4); |
|
afe42d0…
|
ragelink
|
3180 |
} |
|
afe42d0…
|
ragelink
|
3181 |
return id; |
|
afe42d0…
|
ragelink
|
3182 |
}; |
|
afe42d0…
|
ragelink
|
3183 |
|
|
afe42d0…
|
ragelink
|
3184 |
return BaseAdapter; |
|
afe42d0…
|
ragelink
|
3185 |
}); |
|
afe42d0…
|
ragelink
|
3186 |
|
|
afe42d0…
|
ragelink
|
3187 |
S2.define('select2/data/select',[ |
|
afe42d0…
|
ragelink
|
3188 |
'./base', |
|
afe42d0…
|
ragelink
|
3189 |
'../utils', |
|
afe42d0…
|
ragelink
|
3190 |
'jquery' |
|
afe42d0…
|
ragelink
|
3191 |
], function (BaseAdapter, Utils, $) { |
|
afe42d0…
|
ragelink
|
3192 |
function SelectAdapter ($element, options) { |
|
afe42d0…
|
ragelink
|
3193 |
this.$element = $element; |
|
afe42d0…
|
ragelink
|
3194 |
this.options = options; |
|
afe42d0…
|
ragelink
|
3195 |
|
|
afe42d0…
|
ragelink
|
3196 |
SelectAdapter.__super__.constructor.call(this); |
|
afe42d0…
|
ragelink
|
3197 |
} |
|
afe42d0…
|
ragelink
|
3198 |
|
|
afe42d0…
|
ragelink
|
3199 |
Utils.Extend(SelectAdapter, BaseAdapter); |
|
afe42d0…
|
ragelink
|
3200 |
|
|
afe42d0…
|
ragelink
|
3201 |
SelectAdapter.prototype.current = function (callback) { |
|
afe42d0…
|
ragelink
|
3202 |
var data = []; |
|
afe42d0…
|
ragelink
|
3203 |
var self = this; |
|
afe42d0…
|
ragelink
|
3204 |
|
|
afe42d0…
|
ragelink
|
3205 |
this.$element.find(':selected').each(function () { |
|
afe42d0…
|
ragelink
|
3206 |
var $option = $(this); |
|
afe42d0…
|
ragelink
|
3207 |
|
|
afe42d0…
|
ragelink
|
3208 |
var option = self.item($option); |
|
afe42d0…
|
ragelink
|
3209 |
|
|
afe42d0…
|
ragelink
|
3210 |
data.push(option); |
|
afe42d0…
|
ragelink
|
3211 |
}); |
|
afe42d0…
|
ragelink
|
3212 |
|
|
afe42d0…
|
ragelink
|
3213 |
callback(data); |
|
afe42d0…
|
ragelink
|
3214 |
}; |
|
afe42d0…
|
ragelink
|
3215 |
|
|
afe42d0…
|
ragelink
|
3216 |
SelectAdapter.prototype.select = function (data) { |
|
afe42d0…
|
ragelink
|
3217 |
var self = this; |
|
afe42d0…
|
ragelink
|
3218 |
|
|
afe42d0…
|
ragelink
|
3219 |
data.selected = true; |
|
afe42d0…
|
ragelink
|
3220 |
|
|
afe42d0…
|
ragelink
|
3221 |
// If data.element is a DOM node, use it instead |
|
afe42d0…
|
ragelink
|
3222 |
if ($(data.element).is('option')) { |
|
afe42d0…
|
ragelink
|
3223 |
data.element.selected = true; |
|
afe42d0…
|
ragelink
|
3224 |
|
|
afe42d0…
|
ragelink
|
3225 |
this.$element.trigger('input').trigger('change'); |
|
afe42d0…
|
ragelink
|
3226 |
|
|
afe42d0…
|
ragelink
|
3227 |
return; |
|
afe42d0…
|
ragelink
|
3228 |
} |
|
afe42d0…
|
ragelink
|
3229 |
|
|
afe42d0…
|
ragelink
|
3230 |
if (this.$element.prop('multiple')) { |
|
afe42d0…
|
ragelink
|
3231 |
this.current(function (currentData) { |
|
afe42d0…
|
ragelink
|
3232 |
var val = []; |
|
afe42d0…
|
ragelink
|
3233 |
|
|
afe42d0…
|
ragelink
|
3234 |
data = [data]; |
|
afe42d0…
|
ragelink
|
3235 |
data.push.apply(data, currentData); |
|
afe42d0…
|
ragelink
|
3236 |
|
|
afe42d0…
|
ragelink
|
3237 |
for (var d = 0; d < data.length; d++) { |
|
afe42d0…
|
ragelink
|
3238 |
var id = data[d].id; |
|
afe42d0…
|
ragelink
|
3239 |
|
|
afe42d0…
|
ragelink
|
3240 |
if ($.inArray(id, val) === -1) { |
|
afe42d0…
|
ragelink
|
3241 |
val.push(id); |
|
afe42d0…
|
ragelink
|
3242 |
} |
|
afe42d0…
|
ragelink
|
3243 |
} |
|
afe42d0…
|
ragelink
|
3244 |
|
|
afe42d0…
|
ragelink
|
3245 |
self.$element.val(val); |
|
afe42d0…
|
ragelink
|
3246 |
self.$element.trigger('input').trigger('change'); |
|
afe42d0…
|
ragelink
|
3247 |
}); |
|
afe42d0…
|
ragelink
|
3248 |
} else { |
|
afe42d0…
|
ragelink
|
3249 |
var val = data.id; |
|
afe42d0…
|
ragelink
|
3250 |
|
|
afe42d0…
|
ragelink
|
3251 |
this.$element.val(val); |
|
afe42d0…
|
ragelink
|
3252 |
this.$element.trigger('input').trigger('change'); |
|
afe42d0…
|
ragelink
|
3253 |
} |
|
afe42d0…
|
ragelink
|
3254 |
}; |
|
afe42d0…
|
ragelink
|
3255 |
|
|
afe42d0…
|
ragelink
|
3256 |
SelectAdapter.prototype.unselect = function (data) { |
|
afe42d0…
|
ragelink
|
3257 |
var self = this; |
|
afe42d0…
|
ragelink
|
3258 |
|
|
afe42d0…
|
ragelink
|
3259 |
if (!this.$element.prop('multiple')) { |
|
afe42d0…
|
ragelink
|
3260 |
return; |
|
afe42d0…
|
ragelink
|
3261 |
} |
|
afe42d0…
|
ragelink
|
3262 |
|
|
afe42d0…
|
ragelink
|
3263 |
data.selected = false; |
|
afe42d0…
|
ragelink
|
3264 |
|
|
afe42d0…
|
ragelink
|
3265 |
if ($(data.element).is('option')) { |
|
afe42d0…
|
ragelink
|
3266 |
data.element.selected = false; |
|
afe42d0…
|
ragelink
|
3267 |
|
|
afe42d0…
|
ragelink
|
3268 |
this.$element.trigger('input').trigger('change'); |
|
afe42d0…
|
ragelink
|
3269 |
|
|
afe42d0…
|
ragelink
|
3270 |
return; |
|
afe42d0…
|
ragelink
|
3271 |
} |
|
afe42d0…
|
ragelink
|
3272 |
|
|
afe42d0…
|
ragelink
|
3273 |
this.current(function (currentData) { |
|
afe42d0…
|
ragelink
|
3274 |
var val = []; |
|
afe42d0…
|
ragelink
|
3275 |
|
|
afe42d0…
|
ragelink
|
3276 |
for (var d = 0; d < currentData.length; d++) { |
|
afe42d0…
|
ragelink
|
3277 |
var id = currentData[d].id; |
|
afe42d0…
|
ragelink
|
3278 |
|
|
afe42d0…
|
ragelink
|
3279 |
if (id !== data.id && $.inArray(id, val) === -1) { |
|
afe42d0…
|
ragelink
|
3280 |
val.push(id); |
|
afe42d0…
|
ragelink
|
3281 |
} |
|
afe42d0…
|
ragelink
|
3282 |
} |
|
afe42d0…
|
ragelink
|
3283 |
|
|
afe42d0…
|
ragelink
|
3284 |
self.$element.val(val); |
|
afe42d0…
|
ragelink
|
3285 |
|
|
afe42d0…
|
ragelink
|
3286 |
self.$element.trigger('input').trigger('change'); |
|
afe42d0…
|
ragelink
|
3287 |
}); |
|
afe42d0…
|
ragelink
|
3288 |
}; |
|
afe42d0…
|
ragelink
|
3289 |
|
|
afe42d0…
|
ragelink
|
3290 |
SelectAdapter.prototype.bind = function (container, $container) { |
|
afe42d0…
|
ragelink
|
3291 |
var self = this; |
|
afe42d0…
|
ragelink
|
3292 |
|
|
afe42d0…
|
ragelink
|
3293 |
this.container = container; |
|
afe42d0…
|
ragelink
|
3294 |
|
|
afe42d0…
|
ragelink
|
3295 |
container.on('select', function (params) { |
|
afe42d0…
|
ragelink
|
3296 |
self.select(params.data); |
|
afe42d0…
|
ragelink
|
3297 |
}); |
|
afe42d0…
|
ragelink
|
3298 |
|
|
afe42d0…
|
ragelink
|
3299 |
container.on('unselect', function (params) { |
|
afe42d0…
|
ragelink
|
3300 |
self.unselect(params.data); |
|
afe42d0…
|
ragelink
|
3301 |
}); |
|
afe42d0…
|
ragelink
|
3302 |
}; |
|
afe42d0…
|
ragelink
|
3303 |
|
|
afe42d0…
|
ragelink
|
3304 |
SelectAdapter.prototype.destroy = function () { |
|
afe42d0…
|
ragelink
|
3305 |
// Remove anything added to child elements |
|
afe42d0…
|
ragelink
|
3306 |
this.$element.find('*').each(function () { |
|
afe42d0…
|
ragelink
|
3307 |
// Remove any custom data set by Select2 |
|
afe42d0…
|
ragelink
|
3308 |
Utils.RemoveData(this); |
|
afe42d0…
|
ragelink
|
3309 |
}); |
|
afe42d0…
|
ragelink
|
3310 |
}; |
|
afe42d0…
|
ragelink
|
3311 |
|
|
afe42d0…
|
ragelink
|
3312 |
SelectAdapter.prototype.query = function (params, callback) { |
|
afe42d0…
|
ragelink
|
3313 |
var data = []; |
|
afe42d0…
|
ragelink
|
3314 |
var self = this; |
|
afe42d0…
|
ragelink
|
3315 |
|
|
afe42d0…
|
ragelink
|
3316 |
var $options = this.$element.children(); |
|
afe42d0…
|
ragelink
|
3317 |
|
|
afe42d0…
|
ragelink
|
3318 |
$options.each(function () { |
|
afe42d0…
|
ragelink
|
3319 |
var $option = $(this); |
|
afe42d0…
|
ragelink
|
3320 |
|
|
afe42d0…
|
ragelink
|
3321 |
if (!$option.is('option') && !$option.is('optgroup')) { |
|
afe42d0…
|
ragelink
|
3322 |
return; |
|
afe42d0…
|
ragelink
|
3323 |
} |
|
afe42d0…
|
ragelink
|
3324 |
|
|
afe42d0…
|
ragelink
|
3325 |
var option = self.item($option); |
|
afe42d0…
|
ragelink
|
3326 |
|
|
afe42d0…
|
ragelink
|
3327 |
var matches = self.matches(params, option); |
|
afe42d0…
|
ragelink
|
3328 |
|
|
afe42d0…
|
ragelink
|
3329 |
if (matches !== null) { |
|
afe42d0…
|
ragelink
|
3330 |
data.push(matches); |
|
afe42d0…
|
ragelink
|
3331 |
} |
|
afe42d0…
|
ragelink
|
3332 |
}); |
|
afe42d0…
|
ragelink
|
3333 |
|
|
afe42d0…
|
ragelink
|
3334 |
callback({ |
|
afe42d0…
|
ragelink
|
3335 |
results: data |
|
afe42d0…
|
ragelink
|
3336 |
}); |
|
afe42d0…
|
ragelink
|
3337 |
}; |
|
afe42d0…
|
ragelink
|
3338 |
|
|
afe42d0…
|
ragelink
|
3339 |
SelectAdapter.prototype.addOptions = function ($options) { |
|
afe42d0…
|
ragelink
|
3340 |
Utils.appendMany(this.$element, $options); |
|
afe42d0…
|
ragelink
|
3341 |
}; |
|
afe42d0…
|
ragelink
|
3342 |
|
|
afe42d0…
|
ragelink
|
3343 |
SelectAdapter.prototype.option = function (data) { |
|
afe42d0…
|
ragelink
|
3344 |
var option; |
|
afe42d0…
|
ragelink
|
3345 |
|
|
afe42d0…
|
ragelink
|
3346 |
if (data.children) { |
|
afe42d0…
|
ragelink
|
3347 |
option = document.createElement('optgroup'); |
|
afe42d0…
|
ragelink
|
3348 |
option.label = data.text; |
|
afe42d0…
|
ragelink
|
3349 |
} else { |
|
afe42d0…
|
ragelink
|
3350 |
option = document.createElement('option'); |
|
afe42d0…
|
ragelink
|
3351 |
|
|
afe42d0…
|
ragelink
|
3352 |
if (option.textContent !== undefined) { |
|
afe42d0…
|
ragelink
|
3353 |
option.textContent = data.text; |
|
afe42d0…
|
ragelink
|
3354 |
} else { |
|
afe42d0…
|
ragelink
|
3355 |
option.innerText = data.text; |
|
afe42d0…
|
ragelink
|
3356 |
} |
|
afe42d0…
|
ragelink
|
3357 |
} |
|
afe42d0…
|
ragelink
|
3358 |
|
|
afe42d0…
|
ragelink
|
3359 |
if (data.id !== undefined) { |
|
afe42d0…
|
ragelink
|
3360 |
option.value = data.id; |
|
afe42d0…
|
ragelink
|
3361 |
} |
|
afe42d0…
|
ragelink
|
3362 |
|
|
afe42d0…
|
ragelink
|
3363 |
if (data.disabled) { |
|
afe42d0…
|
ragelink
|
3364 |
option.disabled = true; |
|
afe42d0…
|
ragelink
|
3365 |
} |
|
afe42d0…
|
ragelink
|
3366 |
|
|
afe42d0…
|
ragelink
|
3367 |
if (data.selected) { |
|
afe42d0…
|
ragelink
|
3368 |
option.selected = true; |
|
afe42d0…
|
ragelink
|
3369 |
} |
|
afe42d0…
|
ragelink
|
3370 |
|
|
afe42d0…
|
ragelink
|
3371 |
if (data.title) { |
|
afe42d0…
|
ragelink
|
3372 |
option.title = data.title; |
|
afe42d0…
|
ragelink
|
3373 |
} |
|
afe42d0…
|
ragelink
|
3374 |
|
|
afe42d0…
|
ragelink
|
3375 |
var $option = $(option); |
|
afe42d0…
|
ragelink
|
3376 |
|
|
afe42d0…
|
ragelink
|
3377 |
var normalizedData = this._normalizeItem(data); |
|
afe42d0…
|
ragelink
|
3378 |
normalizedData.element = option; |
|
afe42d0…
|
ragelink
|
3379 |
|
|
afe42d0…
|
ragelink
|
3380 |
// Override the option's data with the combined data |
|
afe42d0…
|
ragelink
|
3381 |
Utils.StoreData(option, 'data', normalizedData); |
|
afe42d0…
|
ragelink
|
3382 |
|
|
afe42d0…
|
ragelink
|
3383 |
return $option; |
|
afe42d0…
|
ragelink
|
3384 |
}; |
|
afe42d0…
|
ragelink
|
3385 |
|
|
afe42d0…
|
ragelink
|
3386 |
SelectAdapter.prototype.item = function ($option) { |
|
afe42d0…
|
ragelink
|
3387 |
var data = {}; |
|
afe42d0…
|
ragelink
|
3388 |
|
|
afe42d0…
|
ragelink
|
3389 |
data = Utils.GetData($option[0], 'data'); |
|
afe42d0…
|
ragelink
|
3390 |
|
|
afe42d0…
|
ragelink
|
3391 |
if (data != null) { |
|
afe42d0…
|
ragelink
|
3392 |
return data; |
|
afe42d0…
|
ragelink
|
3393 |
} |
|
afe42d0…
|
ragelink
|
3394 |
|
|
afe42d0…
|
ragelink
|
3395 |
if ($option.is('option')) { |
|
afe42d0…
|
ragelink
|
3396 |
data = { |
|
afe42d0…
|
ragelink
|
3397 |
id: $option.val(), |
|
afe42d0…
|
ragelink
|
3398 |
text: $option.text(), |
|
afe42d0…
|
ragelink
|
3399 |
disabled: $option.prop('disabled'), |
|
afe42d0…
|
ragelink
|
3400 |
selected: $option.prop('selected'), |
|
afe42d0…
|
ragelink
|
3401 |
title: $option.prop('title') |
|
afe42d0…
|
ragelink
|
3402 |
}; |
|
afe42d0…
|
ragelink
|
3403 |
} else if ($option.is('optgroup')) { |
|
afe42d0…
|
ragelink
|
3404 |
data = { |
|
afe42d0…
|
ragelink
|
3405 |
text: $option.prop('label'), |
|
afe42d0…
|
ragelink
|
3406 |
children: [], |
|
afe42d0…
|
ragelink
|
3407 |
title: $option.prop('title') |
|
afe42d0…
|
ragelink
|
3408 |
}; |
|
afe42d0…
|
ragelink
|
3409 |
|
|
afe42d0…
|
ragelink
|
3410 |
var $children = $option.children('option'); |
|
afe42d0…
|
ragelink
|
3411 |
var children = []; |
|
afe42d0…
|
ragelink
|
3412 |
|
|
afe42d0…
|
ragelink
|
3413 |
for (var c = 0; c < $children.length; c++) { |
|
afe42d0…
|
ragelink
|
3414 |
var $child = $($children[c]); |
|
afe42d0…
|
ragelink
|
3415 |
|
|
afe42d0…
|
ragelink
|
3416 |
var child = this.item($child); |
|
afe42d0…
|
ragelink
|
3417 |
|
|
afe42d0…
|
ragelink
|
3418 |
children.push(child); |
|
afe42d0…
|
ragelink
|
3419 |
} |
|
afe42d0…
|
ragelink
|
3420 |
|
|
afe42d0…
|
ragelink
|
3421 |
data.children = children; |
|
afe42d0…
|
ragelink
|
3422 |
} |
|
afe42d0…
|
ragelink
|
3423 |
|
|
afe42d0…
|
ragelink
|
3424 |
data = this._normalizeItem(data); |
|
afe42d0…
|
ragelink
|
3425 |
data.element = $option[0]; |
|
afe42d0…
|
ragelink
|
3426 |
|
|
afe42d0…
|
ragelink
|
3427 |
Utils.StoreData($option[0], 'data', data); |
|
afe42d0…
|
ragelink
|
3428 |
|
|
afe42d0…
|
ragelink
|
3429 |
return data; |
|
afe42d0…
|
ragelink
|
3430 |
}; |
|
afe42d0…
|
ragelink
|
3431 |
|
|
afe42d0…
|
ragelink
|
3432 |
SelectAdapter.prototype._normalizeItem = function (item) { |
|
afe42d0…
|
ragelink
|
3433 |
if (item !== Object(item)) { |
|
afe42d0…
|
ragelink
|
3434 |
item = { |
|
afe42d0…
|
ragelink
|
3435 |
id: item, |
|
afe42d0…
|
ragelink
|
3436 |
text: item |
|
afe42d0…
|
ragelink
|
3437 |
}; |
|
afe42d0…
|
ragelink
|
3438 |
} |
|
afe42d0…
|
ragelink
|
3439 |
|
|
afe42d0…
|
ragelink
|
3440 |
item = $.extend({}, { |
|
afe42d0…
|
ragelink
|
3441 |
text: '' |
|
afe42d0…
|
ragelink
|
3442 |
}, item); |
|
afe42d0…
|
ragelink
|
3443 |
|
|
afe42d0…
|
ragelink
|
3444 |
var defaults = { |
|
afe42d0…
|
ragelink
|
3445 |
selected: false, |
|
afe42d0…
|
ragelink
|
3446 |
disabled: false |
|
afe42d0…
|
ragelink
|
3447 |
}; |
|
afe42d0…
|
ragelink
|
3448 |
|
|
afe42d0…
|
ragelink
|
3449 |
if (item.id != null) { |
|
afe42d0…
|
ragelink
|
3450 |
item.id = item.id.toString(); |
|
afe42d0…
|
ragelink
|
3451 |
} |
|
afe42d0…
|
ragelink
|
3452 |
|
|
afe42d0…
|
ragelink
|
3453 |
if (item.text != null) { |
|
afe42d0…
|
ragelink
|
3454 |
item.text = item.text.toString(); |
|
afe42d0…
|
ragelink
|
3455 |
} |
|
afe42d0…
|
ragelink
|
3456 |
|
|
afe42d0…
|
ragelink
|
3457 |
if (item._resultId == null && item.id && this.container != null) { |
|
afe42d0…
|
ragelink
|
3458 |
item._resultId = this.generateResultId(this.container, item); |
|
afe42d0…
|
ragelink
|
3459 |
} |
|
afe42d0…
|
ragelink
|
3460 |
|
|
afe42d0…
|
ragelink
|
3461 |
return $.extend({}, defaults, item); |
|
afe42d0…
|
ragelink
|
3462 |
}; |
|
afe42d0…
|
ragelink
|
3463 |
|
|
afe42d0…
|
ragelink
|
3464 |
SelectAdapter.prototype.matches = function (params, data) { |
|
afe42d0…
|
ragelink
|
3465 |
var matcher = this.options.get('matcher'); |
|
afe42d0…
|
ragelink
|
3466 |
|
|
afe42d0…
|
ragelink
|
3467 |
return matcher(params, data); |
|
afe42d0…
|
ragelink
|
3468 |
}; |
|
afe42d0…
|
ragelink
|
3469 |
|
|
afe42d0…
|
ragelink
|
3470 |
return SelectAdapter; |
|
afe42d0…
|
ragelink
|
3471 |
}); |
|
afe42d0…
|
ragelink
|
3472 |
|
|
afe42d0…
|
ragelink
|
3473 |
S2.define('select2/data/array',[ |
|
afe42d0…
|
ragelink
|
3474 |
'./select', |
|
afe42d0…
|
ragelink
|
3475 |
'../utils', |
|
afe42d0…
|
ragelink
|
3476 |
'jquery' |
|
afe42d0…
|
ragelink
|
3477 |
], function (SelectAdapter, Utils, $) { |
|
afe42d0…
|
ragelink
|
3478 |
function ArrayAdapter ($element, options) { |
|
afe42d0…
|
ragelink
|
3479 |
this._dataToConvert = options.get('data') || []; |
|
afe42d0…
|
ragelink
|
3480 |
|
|
afe42d0…
|
ragelink
|
3481 |
ArrayAdapter.__super__.constructor.call(this, $element, options); |
|
afe42d0…
|
ragelink
|
3482 |
} |
|
afe42d0…
|
ragelink
|
3483 |
|
|
afe42d0…
|
ragelink
|
3484 |
Utils.Extend(ArrayAdapter, SelectAdapter); |
|
afe42d0…
|
ragelink
|
3485 |
|
|
afe42d0…
|
ragelink
|
3486 |
ArrayAdapter.prototype.bind = function (container, $container) { |
|
afe42d0…
|
ragelink
|
3487 |
ArrayAdapter.__super__.bind.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
3488 |
|
|
afe42d0…
|
ragelink
|
3489 |
this.addOptions(this.convertToOptions(this._dataToConvert)); |
|
afe42d0…
|
ragelink
|
3490 |
}; |
|
afe42d0…
|
ragelink
|
3491 |
|
|
afe42d0…
|
ragelink
|
3492 |
ArrayAdapter.prototype.select = function (data) { |
|
afe42d0…
|
ragelink
|
3493 |
var $option = this.$element.find('option').filter(function (i, elm) { |
|
afe42d0…
|
ragelink
|
3494 |
return elm.value == data.id.toString(); |
|
afe42d0…
|
ragelink
|
3495 |
}); |
|
afe42d0…
|
ragelink
|
3496 |
|
|
afe42d0…
|
ragelink
|
3497 |
if ($option.length === 0) { |
|
afe42d0…
|
ragelink
|
3498 |
$option = this.option(data); |
|
afe42d0…
|
ragelink
|
3499 |
|
|
afe42d0…
|
ragelink
|
3500 |
this.addOptions($option); |
|
afe42d0…
|
ragelink
|
3501 |
} |
|
afe42d0…
|
ragelink
|
3502 |
|
|
afe42d0…
|
ragelink
|
3503 |
ArrayAdapter.__super__.select.call(this, data); |
|
afe42d0…
|
ragelink
|
3504 |
}; |
|
afe42d0…
|
ragelink
|
3505 |
|
|
afe42d0…
|
ragelink
|
3506 |
ArrayAdapter.prototype.convertToOptions = function (data) { |
|
afe42d0…
|
ragelink
|
3507 |
var self = this; |
|
afe42d0…
|
ragelink
|
3508 |
|
|
afe42d0…
|
ragelink
|
3509 |
var $existing = this.$element.find('option'); |
|
afe42d0…
|
ragelink
|
3510 |
var existingIds = $existing.map(function () { |
|
afe42d0…
|
ragelink
|
3511 |
return self.item($(this)).id; |
|
afe42d0…
|
ragelink
|
3512 |
}).get(); |
|
afe42d0…
|
ragelink
|
3513 |
|
|
afe42d0…
|
ragelink
|
3514 |
var $options = []; |
|
afe42d0…
|
ragelink
|
3515 |
|
|
afe42d0…
|
ragelink
|
3516 |
// Filter out all items except for the one passed in the argument |
|
afe42d0…
|
ragelink
|
3517 |
function onlyItem (item) { |
|
afe42d0…
|
ragelink
|
3518 |
return function () { |
|
afe42d0…
|
ragelink
|
3519 |
return $(this).val() == item.id; |
|
afe42d0…
|
ragelink
|
3520 |
}; |
|
afe42d0…
|
ragelink
|
3521 |
} |
|
afe42d0…
|
ragelink
|
3522 |
|
|
afe42d0…
|
ragelink
|
3523 |
for (var d = 0; d < data.length; d++) { |
|
afe42d0…
|
ragelink
|
3524 |
var item = this._normalizeItem(data[d]); |
|
afe42d0…
|
ragelink
|
3525 |
|
|
afe42d0…
|
ragelink
|
3526 |
// Skip items which were pre-loaded, only merge the data |
|
afe42d0…
|
ragelink
|
3527 |
if ($.inArray(item.id, existingIds) >= 0) { |
|
afe42d0…
|
ragelink
|
3528 |
var $existingOption = $existing.filter(onlyItem(item)); |
|
afe42d0…
|
ragelink
|
3529 |
|
|
afe42d0…
|
ragelink
|
3530 |
var existingData = this.item($existingOption); |
|
afe42d0…
|
ragelink
|
3531 |
var newData = $.extend(true, {}, item, existingData); |
|
afe42d0…
|
ragelink
|
3532 |
|
|
afe42d0…
|
ragelink
|
3533 |
var $newOption = this.option(newData); |
|
afe42d0…
|
ragelink
|
3534 |
|
|
afe42d0…
|
ragelink
|
3535 |
$existingOption.replaceWith($newOption); |
|
afe42d0…
|
ragelink
|
3536 |
|
|
afe42d0…
|
ragelink
|
3537 |
continue; |
|
afe42d0…
|
ragelink
|
3538 |
} |
|
afe42d0…
|
ragelink
|
3539 |
|
|
afe42d0…
|
ragelink
|
3540 |
var $option = this.option(item); |
|
afe42d0…
|
ragelink
|
3541 |
|
|
afe42d0…
|
ragelink
|
3542 |
if (item.children) { |
|
afe42d0…
|
ragelink
|
3543 |
var $children = this.convertToOptions(item.children); |
|
afe42d0…
|
ragelink
|
3544 |
|
|
afe42d0…
|
ragelink
|
3545 |
Utils.appendMany($option, $children); |
|
afe42d0…
|
ragelink
|
3546 |
} |
|
afe42d0…
|
ragelink
|
3547 |
|
|
afe42d0…
|
ragelink
|
3548 |
$options.push($option); |
|
afe42d0…
|
ragelink
|
3549 |
} |
|
afe42d0…
|
ragelink
|
3550 |
|
|
afe42d0…
|
ragelink
|
3551 |
return $options; |
|
afe42d0…
|
ragelink
|
3552 |
}; |
|
afe42d0…
|
ragelink
|
3553 |
|
|
afe42d0…
|
ragelink
|
3554 |
return ArrayAdapter; |
|
afe42d0…
|
ragelink
|
3555 |
}); |
|
afe42d0…
|
ragelink
|
3556 |
|
|
afe42d0…
|
ragelink
|
3557 |
S2.define('select2/data/ajax',[ |
|
afe42d0…
|
ragelink
|
3558 |
'./array', |
|
afe42d0…
|
ragelink
|
3559 |
'../utils', |
|
afe42d0…
|
ragelink
|
3560 |
'jquery' |
|
afe42d0…
|
ragelink
|
3561 |
], function (ArrayAdapter, Utils, $) { |
|
afe42d0…
|
ragelink
|
3562 |
function AjaxAdapter ($element, options) { |
|
afe42d0…
|
ragelink
|
3563 |
this.ajaxOptions = this._applyDefaults(options.get('ajax')); |
|
afe42d0…
|
ragelink
|
3564 |
|
|
afe42d0…
|
ragelink
|
3565 |
if (this.ajaxOptions.processResults != null) { |
|
afe42d0…
|
ragelink
|
3566 |
this.processResults = this.ajaxOptions.processResults; |
|
afe42d0…
|
ragelink
|
3567 |
} |
|
afe42d0…
|
ragelink
|
3568 |
|
|
afe42d0…
|
ragelink
|
3569 |
AjaxAdapter.__super__.constructor.call(this, $element, options); |
|
afe42d0…
|
ragelink
|
3570 |
} |
|
afe42d0…
|
ragelink
|
3571 |
|
|
afe42d0…
|
ragelink
|
3572 |
Utils.Extend(AjaxAdapter, ArrayAdapter); |
|
afe42d0…
|
ragelink
|
3573 |
|
|
afe42d0…
|
ragelink
|
3574 |
AjaxAdapter.prototype._applyDefaults = function (options) { |
|
afe42d0…
|
ragelink
|
3575 |
var defaults = { |
|
afe42d0…
|
ragelink
|
3576 |
data: function (params) { |
|
afe42d0…
|
ragelink
|
3577 |
return $.extend({}, params, { |
|
afe42d0…
|
ragelink
|
3578 |
q: params.term |
|
afe42d0…
|
ragelink
|
3579 |
}); |
|
afe42d0…
|
ragelink
|
3580 |
}, |
|
afe42d0…
|
ragelink
|
3581 |
transport: function (params, success, failure) { |
|
afe42d0…
|
ragelink
|
3582 |
var $request = $.ajax(params); |
|
afe42d0…
|
ragelink
|
3583 |
|
|
afe42d0…
|
ragelink
|
3584 |
$request.then(success); |
|
afe42d0…
|
ragelink
|
3585 |
$request.fail(failure); |
|
afe42d0…
|
ragelink
|
3586 |
|
|
afe42d0…
|
ragelink
|
3587 |
return $request; |
|
afe42d0…
|
ragelink
|
3588 |
} |
|
afe42d0…
|
ragelink
|
3589 |
}; |
|
afe42d0…
|
ragelink
|
3590 |
|
|
afe42d0…
|
ragelink
|
3591 |
return $.extend({}, defaults, options, true); |
|
afe42d0…
|
ragelink
|
3592 |
}; |
|
afe42d0…
|
ragelink
|
3593 |
|
|
afe42d0…
|
ragelink
|
3594 |
AjaxAdapter.prototype.processResults = function (results) { |
|
afe42d0…
|
ragelink
|
3595 |
return results; |
|
afe42d0…
|
ragelink
|
3596 |
}; |
|
afe42d0…
|
ragelink
|
3597 |
|
|
afe42d0…
|
ragelink
|
3598 |
AjaxAdapter.prototype.query = function (params, callback) { |
|
afe42d0…
|
ragelink
|
3599 |
var matches = []; |
|
afe42d0…
|
ragelink
|
3600 |
var self = this; |
|
afe42d0…
|
ragelink
|
3601 |
|
|
afe42d0…
|
ragelink
|
3602 |
if (this._request != null) { |
|
afe42d0…
|
ragelink
|
3603 |
// JSONP requests cannot always be aborted |
|
afe42d0…
|
ragelink
|
3604 |
if ($.isFunction(this._request.abort)) { |
|
afe42d0…
|
ragelink
|
3605 |
this._request.abort(); |
|
afe42d0…
|
ragelink
|
3606 |
} |
|
afe42d0…
|
ragelink
|
3607 |
|
|
afe42d0…
|
ragelink
|
3608 |
this._request = null; |
|
afe42d0…
|
ragelink
|
3609 |
} |
|
afe42d0…
|
ragelink
|
3610 |
|
|
afe42d0…
|
ragelink
|
3611 |
var options = $.extend({ |
|
afe42d0…
|
ragelink
|
3612 |
type: 'GET' |
|
afe42d0…
|
ragelink
|
3613 |
}, this.ajaxOptions); |
|
afe42d0…
|
ragelink
|
3614 |
|
|
afe42d0…
|
ragelink
|
3615 |
if (typeof options.url === 'function') { |
|
afe42d0…
|
ragelink
|
3616 |
options.url = options.url.call(this.$element, params); |
|
afe42d0…
|
ragelink
|
3617 |
} |
|
afe42d0…
|
ragelink
|
3618 |
|
|
afe42d0…
|
ragelink
|
3619 |
if (typeof options.data === 'function') { |
|
afe42d0…
|
ragelink
|
3620 |
options.data = options.data.call(this.$element, params); |
|
afe42d0…
|
ragelink
|
3621 |
} |
|
afe42d0…
|
ragelink
|
3622 |
|
|
afe42d0…
|
ragelink
|
3623 |
function request () { |
|
afe42d0…
|
ragelink
|
3624 |
var $request = options.transport(options, function (data) { |
|
afe42d0…
|
ragelink
|
3625 |
var results = self.processResults(data, params); |
|
afe42d0…
|
ragelink
|
3626 |
|
|
afe42d0…
|
ragelink
|
3627 |
if (self.options.get('debug') && window.console && console.error) { |
|
afe42d0…
|
ragelink
|
3628 |
// Check to make sure that the response included a `results` key. |
|
afe42d0…
|
ragelink
|
3629 |
if (!results || !results.results || !$.isArray(results.results)) { |
|
afe42d0…
|
ragelink
|
3630 |
console.error( |
|
afe42d0…
|
ragelink
|
3631 |
'Select2: The AJAX results did not return an array in the ' + |
|
afe42d0…
|
ragelink
|
3632 |
'`results` key of the response.' |
|
afe42d0…
|
ragelink
|
3633 |
); |
|
afe42d0…
|
ragelink
|
3634 |
} |
|
afe42d0…
|
ragelink
|
3635 |
} |
|
afe42d0…
|
ragelink
|
3636 |
|
|
afe42d0…
|
ragelink
|
3637 |
callback(results); |
|
afe42d0…
|
ragelink
|
3638 |
}, function () { |
|
afe42d0…
|
ragelink
|
3639 |
// Attempt to detect if a request was aborted |
|
afe42d0…
|
ragelink
|
3640 |
// Only works if the transport exposes a status property |
|
afe42d0…
|
ragelink
|
3641 |
if ('status' in $request && |
|
afe42d0…
|
ragelink
|
3642 |
($request.status === 0 || $request.status === '0')) { |
|
afe42d0…
|
ragelink
|
3643 |
return; |
|
afe42d0…
|
ragelink
|
3644 |
} |
|
afe42d0…
|
ragelink
|
3645 |
|
|
afe42d0…
|
ragelink
|
3646 |
self.trigger('results:message', { |
|
afe42d0…
|
ragelink
|
3647 |
message: 'errorLoading' |
|
afe42d0…
|
ragelink
|
3648 |
}); |
|
afe42d0…
|
ragelink
|
3649 |
}); |
|
afe42d0…
|
ragelink
|
3650 |
|
|
afe42d0…
|
ragelink
|
3651 |
self._request = $request; |
|
afe42d0…
|
ragelink
|
3652 |
} |
|
afe42d0…
|
ragelink
|
3653 |
|
|
afe42d0…
|
ragelink
|
3654 |
if (this.ajaxOptions.delay && params.term != null) { |
|
afe42d0…
|
ragelink
|
3655 |
if (this._queryTimeout) { |
|
afe42d0…
|
ragelink
|
3656 |
window.clearTimeout(this._queryTimeout); |
|
afe42d0…
|
ragelink
|
3657 |
} |
|
afe42d0…
|
ragelink
|
3658 |
|
|
afe42d0…
|
ragelink
|
3659 |
this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); |
|
afe42d0…
|
ragelink
|
3660 |
} else { |
|
afe42d0…
|
ragelink
|
3661 |
request(); |
|
afe42d0…
|
ragelink
|
3662 |
} |
|
afe42d0…
|
ragelink
|
3663 |
}; |
|
afe42d0…
|
ragelink
|
3664 |
|
|
afe42d0…
|
ragelink
|
3665 |
return AjaxAdapter; |
|
afe42d0…
|
ragelink
|
3666 |
}); |
|
afe42d0…
|
ragelink
|
3667 |
|
|
afe42d0…
|
ragelink
|
3668 |
S2.define('select2/data/tags',[ |
|
afe42d0…
|
ragelink
|
3669 |
'jquery' |
|
afe42d0…
|
ragelink
|
3670 |
], function ($) { |
|
afe42d0…
|
ragelink
|
3671 |
function Tags (decorated, $element, options) { |
|
afe42d0…
|
ragelink
|
3672 |
var tags = options.get('tags'); |
|
afe42d0…
|
ragelink
|
3673 |
|
|
afe42d0…
|
ragelink
|
3674 |
var createTag = options.get('createTag'); |
|
afe42d0…
|
ragelink
|
3675 |
|
|
afe42d0…
|
ragelink
|
3676 |
if (createTag !== undefined) { |
|
afe42d0…
|
ragelink
|
3677 |
this.createTag = createTag; |
|
afe42d0…
|
ragelink
|
3678 |
} |
|
afe42d0…
|
ragelink
|
3679 |
|
|
afe42d0…
|
ragelink
|
3680 |
var insertTag = options.get('insertTag'); |
|
afe42d0…
|
ragelink
|
3681 |
|
|
afe42d0…
|
ragelink
|
3682 |
if (insertTag !== undefined) { |
|
afe42d0…
|
ragelink
|
3683 |
this.insertTag = insertTag; |
|
afe42d0…
|
ragelink
|
3684 |
} |
|
afe42d0…
|
ragelink
|
3685 |
|
|
afe42d0…
|
ragelink
|
3686 |
decorated.call(this, $element, options); |
|
afe42d0…
|
ragelink
|
3687 |
|
|
afe42d0…
|
ragelink
|
3688 |
if ($.isArray(tags)) { |
|
afe42d0…
|
ragelink
|
3689 |
for (var t = 0; t < tags.length; t++) { |
|
afe42d0…
|
ragelink
|
3690 |
var tag = tags[t]; |
|
afe42d0…
|
ragelink
|
3691 |
var item = this._normalizeItem(tag); |
|
afe42d0…
|
ragelink
|
3692 |
|
|
afe42d0…
|
ragelink
|
3693 |
var $option = this.option(item); |
|
afe42d0…
|
ragelink
|
3694 |
|
|
afe42d0…
|
ragelink
|
3695 |
this.$element.append($option); |
|
afe42d0…
|
ragelink
|
3696 |
} |
|
afe42d0…
|
ragelink
|
3697 |
} |
|
afe42d0…
|
ragelink
|
3698 |
} |
|
afe42d0…
|
ragelink
|
3699 |
|
|
afe42d0…
|
ragelink
|
3700 |
Tags.prototype.query = function (decorated, params, callback) { |
|
afe42d0…
|
ragelink
|
3701 |
var self = this; |
|
afe42d0…
|
ragelink
|
3702 |
|
|
afe42d0…
|
ragelink
|
3703 |
this._removeOldTags(); |
|
afe42d0…
|
ragelink
|
3704 |
|
|
afe42d0…
|
ragelink
|
3705 |
if (params.term == null || params.page != null) { |
|
afe42d0…
|
ragelink
|
3706 |
decorated.call(this, params, callback); |
|
afe42d0…
|
ragelink
|
3707 |
return; |
|
afe42d0…
|
ragelink
|
3708 |
} |
|
afe42d0…
|
ragelink
|
3709 |
|
|
afe42d0…
|
ragelink
|
3710 |
function wrapper (obj, child) { |
|
afe42d0…
|
ragelink
|
3711 |
var data = obj.results; |
|
afe42d0…
|
ragelink
|
3712 |
|
|
afe42d0…
|
ragelink
|
3713 |
for (var i = 0; i < data.length; i++) { |
|
afe42d0…
|
ragelink
|
3714 |
var option = data[i]; |
|
afe42d0…
|
ragelink
|
3715 |
|
|
afe42d0…
|
ragelink
|
3716 |
var checkChildren = ( |
|
afe42d0…
|
ragelink
|
3717 |
option.children != null && |
|
afe42d0…
|
ragelink
|
3718 |
!wrapper({ |
|
afe42d0…
|
ragelink
|
3719 |
results: option.children |
|
afe42d0…
|
ragelink
|
3720 |
}, true) |
|
afe42d0…
|
ragelink
|
3721 |
); |
|
afe42d0…
|
ragelink
|
3722 |
|
|
afe42d0…
|
ragelink
|
3723 |
var optionText = (option.text || '').toUpperCase(); |
|
afe42d0…
|
ragelink
|
3724 |
var paramsTerm = (params.term || '').toUpperCase(); |
|
afe42d0…
|
ragelink
|
3725 |
|
|
afe42d0…
|
ragelink
|
3726 |
var checkText = optionText === paramsTerm; |
|
afe42d0…
|
ragelink
|
3727 |
|
|
afe42d0…
|
ragelink
|
3728 |
if (checkText || checkChildren) { |
|
afe42d0…
|
ragelink
|
3729 |
if (child) { |
|
afe42d0…
|
ragelink
|
3730 |
return false; |
|
afe42d0…
|
ragelink
|
3731 |
} |
|
afe42d0…
|
ragelink
|
3732 |
|
|
afe42d0…
|
ragelink
|
3733 |
obj.data = data; |
|
afe42d0…
|
ragelink
|
3734 |
callback(obj); |
|
afe42d0…
|
ragelink
|
3735 |
|
|
afe42d0…
|
ragelink
|
3736 |
return; |
|
afe42d0…
|
ragelink
|
3737 |
} |
|
afe42d0…
|
ragelink
|
3738 |
} |
|
afe42d0…
|
ragelink
|
3739 |
|
|
afe42d0…
|
ragelink
|
3740 |
if (child) { |
|
afe42d0…
|
ragelink
|
3741 |
return true; |
|
afe42d0…
|
ragelink
|
3742 |
} |
|
afe42d0…
|
ragelink
|
3743 |
|
|
afe42d0…
|
ragelink
|
3744 |
var tag = self.createTag(params); |
|
afe42d0…
|
ragelink
|
3745 |
|
|
afe42d0…
|
ragelink
|
3746 |
if (tag != null) { |
|
afe42d0…
|
ragelink
|
3747 |
var $option = self.option(tag); |
|
afe42d0…
|
ragelink
|
3748 |
$option.attr('data-select2-tag', true); |
|
afe42d0…
|
ragelink
|
3749 |
|
|
afe42d0…
|
ragelink
|
3750 |
self.addOptions([$option]); |
|
afe42d0…
|
ragelink
|
3751 |
|
|
afe42d0…
|
ragelink
|
3752 |
self.insertTag(data, tag); |
|
afe42d0…
|
ragelink
|
3753 |
} |
|
afe42d0…
|
ragelink
|
3754 |
|
|
afe42d0…
|
ragelink
|
3755 |
obj.results = data; |
|
afe42d0…
|
ragelink
|
3756 |
|
|
afe42d0…
|
ragelink
|
3757 |
callback(obj); |
|
afe42d0…
|
ragelink
|
3758 |
} |
|
afe42d0…
|
ragelink
|
3759 |
|
|
afe42d0…
|
ragelink
|
3760 |
decorated.call(this, params, wrapper); |
|
afe42d0…
|
ragelink
|
3761 |
}; |
|
afe42d0…
|
ragelink
|
3762 |
|
|
afe42d0…
|
ragelink
|
3763 |
Tags.prototype.createTag = function (decorated, params) { |
|
afe42d0…
|
ragelink
|
3764 |
var term = $.trim(params.term); |
|
afe42d0…
|
ragelink
|
3765 |
|
|
afe42d0…
|
ragelink
|
3766 |
if (term === '') { |
|
afe42d0…
|
ragelink
|
3767 |
return null; |
|
afe42d0…
|
ragelink
|
3768 |
} |
|
afe42d0…
|
ragelink
|
3769 |
|
|
afe42d0…
|
ragelink
|
3770 |
return { |
|
afe42d0…
|
ragelink
|
3771 |
id: term, |
|
afe42d0…
|
ragelink
|
3772 |
text: term |
|
afe42d0…
|
ragelink
|
3773 |
}; |
|
afe42d0…
|
ragelink
|
3774 |
}; |
|
afe42d0…
|
ragelink
|
3775 |
|
|
afe42d0…
|
ragelink
|
3776 |
Tags.prototype.insertTag = function (_, data, tag) { |
|
afe42d0…
|
ragelink
|
3777 |
data.unshift(tag); |
|
afe42d0…
|
ragelink
|
3778 |
}; |
|
afe42d0…
|
ragelink
|
3779 |
|
|
afe42d0…
|
ragelink
|
3780 |
Tags.prototype._removeOldTags = function (_) { |
|
afe42d0…
|
ragelink
|
3781 |
var $options = this.$element.find('option[data-select2-tag]'); |
|
afe42d0…
|
ragelink
|
3782 |
|
|
afe42d0…
|
ragelink
|
3783 |
$options.each(function () { |
|
afe42d0…
|
ragelink
|
3784 |
if (this.selected) { |
|
afe42d0…
|
ragelink
|
3785 |
return; |
|
afe42d0…
|
ragelink
|
3786 |
} |
|
afe42d0…
|
ragelink
|
3787 |
|
|
afe42d0…
|
ragelink
|
3788 |
$(this).remove(); |
|
afe42d0…
|
ragelink
|
3789 |
}); |
|
afe42d0…
|
ragelink
|
3790 |
}; |
|
afe42d0…
|
ragelink
|
3791 |
|
|
afe42d0…
|
ragelink
|
3792 |
return Tags; |
|
afe42d0…
|
ragelink
|
3793 |
}); |
|
afe42d0…
|
ragelink
|
3794 |
|
|
afe42d0…
|
ragelink
|
3795 |
S2.define('select2/data/tokenizer',[ |
|
afe42d0…
|
ragelink
|
3796 |
'jquery' |
|
afe42d0…
|
ragelink
|
3797 |
], function ($) { |
|
afe42d0…
|
ragelink
|
3798 |
function Tokenizer (decorated, $element, options) { |
|
afe42d0…
|
ragelink
|
3799 |
var tokenizer = options.get('tokenizer'); |
|
afe42d0…
|
ragelink
|
3800 |
|
|
afe42d0…
|
ragelink
|
3801 |
if (tokenizer !== undefined) { |
|
afe42d0…
|
ragelink
|
3802 |
this.tokenizer = tokenizer; |
|
afe42d0…
|
ragelink
|
3803 |
} |
|
afe42d0…
|
ragelink
|
3804 |
|
|
afe42d0…
|
ragelink
|
3805 |
decorated.call(this, $element, options); |
|
afe42d0…
|
ragelink
|
3806 |
} |
|
afe42d0…
|
ragelink
|
3807 |
|
|
afe42d0…
|
ragelink
|
3808 |
Tokenizer.prototype.bind = function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
3809 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
3810 |
|
|
afe42d0…
|
ragelink
|
3811 |
this.$search = container.dropdown.$search || container.selection.$search || |
|
afe42d0…
|
ragelink
|
3812 |
$container.find('.select2-search__field'); |
|
afe42d0…
|
ragelink
|
3813 |
}; |
|
afe42d0…
|
ragelink
|
3814 |
|
|
afe42d0…
|
ragelink
|
3815 |
Tokenizer.prototype.query = function (decorated, params, callback) { |
|
afe42d0…
|
ragelink
|
3816 |
var self = this; |
|
afe42d0…
|
ragelink
|
3817 |
|
|
afe42d0…
|
ragelink
|
3818 |
function createAndSelect (data) { |
|
afe42d0…
|
ragelink
|
3819 |
// Normalize the data object so we can use it for checks |
|
afe42d0…
|
ragelink
|
3820 |
var item = self._normalizeItem(data); |
|
afe42d0…
|
ragelink
|
3821 |
|
|
afe42d0…
|
ragelink
|
3822 |
// Check if the data object already exists as a tag |
|
afe42d0…
|
ragelink
|
3823 |
// Select it if it doesn't |
|
afe42d0…
|
ragelink
|
3824 |
var $existingOptions = self.$element.find('option').filter(function () { |
|
afe42d0…
|
ragelink
|
3825 |
return $(this).val() === item.id; |
|
afe42d0…
|
ragelink
|
3826 |
}); |
|
afe42d0…
|
ragelink
|
3827 |
|
|
afe42d0…
|
ragelink
|
3828 |
// If an existing option wasn't found for it, create the option |
|
afe42d0…
|
ragelink
|
3829 |
if (!$existingOptions.length) { |
|
afe42d0…
|
ragelink
|
3830 |
var $option = self.option(item); |
|
afe42d0…
|
ragelink
|
3831 |
$option.attr('data-select2-tag', true); |
|
afe42d0…
|
ragelink
|
3832 |
|
|
afe42d0…
|
ragelink
|
3833 |
self._removeOldTags(); |
|
afe42d0…
|
ragelink
|
3834 |
self.addOptions([$option]); |
|
afe42d0…
|
ragelink
|
3835 |
} |
|
afe42d0…
|
ragelink
|
3836 |
|
|
afe42d0…
|
ragelink
|
3837 |
// Select the item, now that we know there is an option for it |
|
afe42d0…
|
ragelink
|
3838 |
select(item); |
|
afe42d0…
|
ragelink
|
3839 |
} |
|
afe42d0…
|
ragelink
|
3840 |
|
|
afe42d0…
|
ragelink
|
3841 |
function select (data) { |
|
afe42d0…
|
ragelink
|
3842 |
self.trigger('select', { |
|
afe42d0…
|
ragelink
|
3843 |
data: data |
|
afe42d0…
|
ragelink
|
3844 |
}); |
|
afe42d0…
|
ragelink
|
3845 |
} |
|
afe42d0…
|
ragelink
|
3846 |
|
|
afe42d0…
|
ragelink
|
3847 |
params.term = params.term || ''; |
|
afe42d0…
|
ragelink
|
3848 |
|
|
afe42d0…
|
ragelink
|
3849 |
var tokenData = this.tokenizer(params, this.options, createAndSelect); |
|
afe42d0…
|
ragelink
|
3850 |
|
|
afe42d0…
|
ragelink
|
3851 |
if (tokenData.term !== params.term) { |
|
afe42d0…
|
ragelink
|
3852 |
// Replace the search term if we have the search box |
|
afe42d0…
|
ragelink
|
3853 |
if (this.$search.length) { |
|
afe42d0…
|
ragelink
|
3854 |
this.$search.val(tokenData.term); |
|
afe42d0…
|
ragelink
|
3855 |
this.$search.trigger('focus'); |
|
afe42d0…
|
ragelink
|
3856 |
} |
|
afe42d0…
|
ragelink
|
3857 |
|
|
afe42d0…
|
ragelink
|
3858 |
params.term = tokenData.term; |
|
afe42d0…
|
ragelink
|
3859 |
} |
|
afe42d0…
|
ragelink
|
3860 |
|
|
afe42d0…
|
ragelink
|
3861 |
decorated.call(this, params, callback); |
|
afe42d0…
|
ragelink
|
3862 |
}; |
|
afe42d0…
|
ragelink
|
3863 |
|
|
afe42d0…
|
ragelink
|
3864 |
Tokenizer.prototype.tokenizer = function (_, params, options, callback) { |
|
afe42d0…
|
ragelink
|
3865 |
var separators = options.get('tokenSeparators') || []; |
|
afe42d0…
|
ragelink
|
3866 |
var term = params.term; |
|
afe42d0…
|
ragelink
|
3867 |
var i = 0; |
|
afe42d0…
|
ragelink
|
3868 |
|
|
afe42d0…
|
ragelink
|
3869 |
var createTag = this.createTag || function (params) { |
|
afe42d0…
|
ragelink
|
3870 |
return { |
|
afe42d0…
|
ragelink
|
3871 |
id: params.term, |
|
afe42d0…
|
ragelink
|
3872 |
text: params.term |
|
afe42d0…
|
ragelink
|
3873 |
}; |
|
afe42d0…
|
ragelink
|
3874 |
}; |
|
afe42d0…
|
ragelink
|
3875 |
|
|
afe42d0…
|
ragelink
|
3876 |
while (i < term.length) { |
|
afe42d0…
|
ragelink
|
3877 |
var termChar = term[i]; |
|
afe42d0…
|
ragelink
|
3878 |
|
|
afe42d0…
|
ragelink
|
3879 |
if ($.inArray(termChar, separators) === -1) { |
|
afe42d0…
|
ragelink
|
3880 |
i++; |
|
afe42d0…
|
ragelink
|
3881 |
|
|
afe42d0…
|
ragelink
|
3882 |
continue; |
|
afe42d0…
|
ragelink
|
3883 |
} |
|
afe42d0…
|
ragelink
|
3884 |
|
|
afe42d0…
|
ragelink
|
3885 |
var part = term.substr(0, i); |
|
afe42d0…
|
ragelink
|
3886 |
var partParams = $.extend({}, params, { |
|
afe42d0…
|
ragelink
|
3887 |
term: part |
|
afe42d0…
|
ragelink
|
3888 |
}); |
|
afe42d0…
|
ragelink
|
3889 |
|
|
afe42d0…
|
ragelink
|
3890 |
var data = createTag(partParams); |
|
afe42d0…
|
ragelink
|
3891 |
|
|
afe42d0…
|
ragelink
|
3892 |
if (data == null) { |
|
afe42d0…
|
ragelink
|
3893 |
i++; |
|
afe42d0…
|
ragelink
|
3894 |
continue; |
|
afe42d0…
|
ragelink
|
3895 |
} |
|
afe42d0…
|
ragelink
|
3896 |
|
|
afe42d0…
|
ragelink
|
3897 |
callback(data); |
|
afe42d0…
|
ragelink
|
3898 |
|
|
afe42d0…
|
ragelink
|
3899 |
// Reset the term to not include the tokenized portion |
|
afe42d0…
|
ragelink
|
3900 |
term = term.substr(i + 1) || ''; |
|
afe42d0…
|
ragelink
|
3901 |
i = 0; |
|
afe42d0…
|
ragelink
|
3902 |
} |
|
afe42d0…
|
ragelink
|
3903 |
|
|
afe42d0…
|
ragelink
|
3904 |
return { |
|
afe42d0…
|
ragelink
|
3905 |
term: term |
|
afe42d0…
|
ragelink
|
3906 |
}; |
|
afe42d0…
|
ragelink
|
3907 |
}; |
|
afe42d0…
|
ragelink
|
3908 |
|
|
afe42d0…
|
ragelink
|
3909 |
return Tokenizer; |
|
afe42d0…
|
ragelink
|
3910 |
}); |
|
afe42d0…
|
ragelink
|
3911 |
|
|
afe42d0…
|
ragelink
|
3912 |
S2.define('select2/data/minimumInputLength',[ |
|
afe42d0…
|
ragelink
|
3913 |
|
|
afe42d0…
|
ragelink
|
3914 |
], function () { |
|
afe42d0…
|
ragelink
|
3915 |
function MinimumInputLength (decorated, $e, options) { |
|
afe42d0…
|
ragelink
|
3916 |
this.minimumInputLength = options.get('minimumInputLength'); |
|
afe42d0…
|
ragelink
|
3917 |
|
|
afe42d0…
|
ragelink
|
3918 |
decorated.call(this, $e, options); |
|
afe42d0…
|
ragelink
|
3919 |
} |
|
afe42d0…
|
ragelink
|
3920 |
|
|
afe42d0…
|
ragelink
|
3921 |
MinimumInputLength.prototype.query = function (decorated, params, callback) { |
|
afe42d0…
|
ragelink
|
3922 |
params.term = params.term || ''; |
|
afe42d0…
|
ragelink
|
3923 |
|
|
afe42d0…
|
ragelink
|
3924 |
if (params.term.length < this.minimumInputLength) { |
|
afe42d0…
|
ragelink
|
3925 |
this.trigger('results:message', { |
|
afe42d0…
|
ragelink
|
3926 |
message: 'inputTooShort', |
|
afe42d0…
|
ragelink
|
3927 |
args: { |
|
afe42d0…
|
ragelink
|
3928 |
minimum: this.minimumInputLength, |
|
afe42d0…
|
ragelink
|
3929 |
input: params.term, |
|
afe42d0…
|
ragelink
|
3930 |
params: params |
|
afe42d0…
|
ragelink
|
3931 |
} |
|
afe42d0…
|
ragelink
|
3932 |
}); |
|
afe42d0…
|
ragelink
|
3933 |
|
|
afe42d0…
|
ragelink
|
3934 |
return; |
|
afe42d0…
|
ragelink
|
3935 |
} |
|
afe42d0…
|
ragelink
|
3936 |
|
|
afe42d0…
|
ragelink
|
3937 |
decorated.call(this, params, callback); |
|
afe42d0…
|
ragelink
|
3938 |
}; |
|
afe42d0…
|
ragelink
|
3939 |
|
|
afe42d0…
|
ragelink
|
3940 |
return MinimumInputLength; |
|
afe42d0…
|
ragelink
|
3941 |
}); |
|
afe42d0…
|
ragelink
|
3942 |
|
|
afe42d0…
|
ragelink
|
3943 |
S2.define('select2/data/maximumInputLength',[ |
|
afe42d0…
|
ragelink
|
3944 |
|
|
afe42d0…
|
ragelink
|
3945 |
], function () { |
|
afe42d0…
|
ragelink
|
3946 |
function MaximumInputLength (decorated, $e, options) { |
|
afe42d0…
|
ragelink
|
3947 |
this.maximumInputLength = options.get('maximumInputLength'); |
|
afe42d0…
|
ragelink
|
3948 |
|
|
afe42d0…
|
ragelink
|
3949 |
decorated.call(this, $e, options); |
|
afe42d0…
|
ragelink
|
3950 |
} |
|
afe42d0…
|
ragelink
|
3951 |
|
|
afe42d0…
|
ragelink
|
3952 |
MaximumInputLength.prototype.query = function (decorated, params, callback) { |
|
afe42d0…
|
ragelink
|
3953 |
params.term = params.term || ''; |
|
afe42d0…
|
ragelink
|
3954 |
|
|
afe42d0…
|
ragelink
|
3955 |
if (this.maximumInputLength > 0 && |
|
afe42d0…
|
ragelink
|
3956 |
params.term.length > this.maximumInputLength) { |
|
afe42d0…
|
ragelink
|
3957 |
this.trigger('results:message', { |
|
afe42d0…
|
ragelink
|
3958 |
message: 'inputTooLong', |
|
afe42d0…
|
ragelink
|
3959 |
args: { |
|
afe42d0…
|
ragelink
|
3960 |
maximum: this.maximumInputLength, |
|
afe42d0…
|
ragelink
|
3961 |
input: params.term, |
|
afe42d0…
|
ragelink
|
3962 |
params: params |
|
afe42d0…
|
ragelink
|
3963 |
} |
|
afe42d0…
|
ragelink
|
3964 |
}); |
|
afe42d0…
|
ragelink
|
3965 |
|
|
afe42d0…
|
ragelink
|
3966 |
return; |
|
afe42d0…
|
ragelink
|
3967 |
} |
|
afe42d0…
|
ragelink
|
3968 |
|
|
afe42d0…
|
ragelink
|
3969 |
decorated.call(this, params, callback); |
|
afe42d0…
|
ragelink
|
3970 |
}; |
|
afe42d0…
|
ragelink
|
3971 |
|
|
afe42d0…
|
ragelink
|
3972 |
return MaximumInputLength; |
|
afe42d0…
|
ragelink
|
3973 |
}); |
|
afe42d0…
|
ragelink
|
3974 |
|
|
afe42d0…
|
ragelink
|
3975 |
S2.define('select2/data/maximumSelectionLength',[ |
|
afe42d0…
|
ragelink
|
3976 |
|
|
afe42d0…
|
ragelink
|
3977 |
], function (){ |
|
afe42d0…
|
ragelink
|
3978 |
function MaximumSelectionLength (decorated, $e, options) { |
|
afe42d0…
|
ragelink
|
3979 |
this.maximumSelectionLength = options.get('maximumSelectionLength'); |
|
afe42d0…
|
ragelink
|
3980 |
|
|
afe42d0…
|
ragelink
|
3981 |
decorated.call(this, $e, options); |
|
afe42d0…
|
ragelink
|
3982 |
} |
|
afe42d0…
|
ragelink
|
3983 |
|
|
afe42d0…
|
ragelink
|
3984 |
MaximumSelectionLength.prototype.bind = |
|
afe42d0…
|
ragelink
|
3985 |
function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
3986 |
var self = this; |
|
afe42d0…
|
ragelink
|
3987 |
|
|
afe42d0…
|
ragelink
|
3988 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
3989 |
|
|
afe42d0…
|
ragelink
|
3990 |
container.on('select', function () { |
|
afe42d0…
|
ragelink
|
3991 |
self._checkIfMaximumSelected(); |
|
afe42d0…
|
ragelink
|
3992 |
}); |
|
afe42d0…
|
ragelink
|
3993 |
}; |
|
afe42d0…
|
ragelink
|
3994 |
|
|
afe42d0…
|
ragelink
|
3995 |
MaximumSelectionLength.prototype.query = |
|
afe42d0…
|
ragelink
|
3996 |
function (decorated, params, callback) { |
|
afe42d0…
|
ragelink
|
3997 |
var self = this; |
|
afe42d0…
|
ragelink
|
3998 |
|
|
afe42d0…
|
ragelink
|
3999 |
this._checkIfMaximumSelected(function () { |
|
afe42d0…
|
ragelink
|
4000 |
decorated.call(self, params, callback); |
|
afe42d0…
|
ragelink
|
4001 |
}); |
|
afe42d0…
|
ragelink
|
4002 |
}; |
|
afe42d0…
|
ragelink
|
4003 |
|
|
afe42d0…
|
ragelink
|
4004 |
MaximumSelectionLength.prototype._checkIfMaximumSelected = |
|
afe42d0…
|
ragelink
|
4005 |
function (_, successCallback) { |
|
afe42d0…
|
ragelink
|
4006 |
var self = this; |
|
afe42d0…
|
ragelink
|
4007 |
|
|
afe42d0…
|
ragelink
|
4008 |
this.current(function (currentData) { |
|
afe42d0…
|
ragelink
|
4009 |
var count = currentData != null ? currentData.length : 0; |
|
afe42d0…
|
ragelink
|
4010 |
if (self.maximumSelectionLength > 0 && |
|
afe42d0…
|
ragelink
|
4011 |
count >= self.maximumSelectionLength) { |
|
afe42d0…
|
ragelink
|
4012 |
self.trigger('results:message', { |
|
afe42d0…
|
ragelink
|
4013 |
message: 'maximumSelected', |
|
afe42d0…
|
ragelink
|
4014 |
args: { |
|
afe42d0…
|
ragelink
|
4015 |
maximum: self.maximumSelectionLength |
|
afe42d0…
|
ragelink
|
4016 |
} |
|
afe42d0…
|
ragelink
|
4017 |
}); |
|
afe42d0…
|
ragelink
|
4018 |
return; |
|
afe42d0…
|
ragelink
|
4019 |
} |
|
afe42d0…
|
ragelink
|
4020 |
|
|
afe42d0…
|
ragelink
|
4021 |
if (successCallback) { |
|
afe42d0…
|
ragelink
|
4022 |
successCallback(); |
|
afe42d0…
|
ragelink
|
4023 |
} |
|
afe42d0…
|
ragelink
|
4024 |
}); |
|
afe42d0…
|
ragelink
|
4025 |
}; |
|
afe42d0…
|
ragelink
|
4026 |
|
|
afe42d0…
|
ragelink
|
4027 |
return MaximumSelectionLength; |
|
afe42d0…
|
ragelink
|
4028 |
}); |
|
afe42d0…
|
ragelink
|
4029 |
|
|
afe42d0…
|
ragelink
|
4030 |
S2.define('select2/dropdown',[ |
|
afe42d0…
|
ragelink
|
4031 |
'jquery', |
|
afe42d0…
|
ragelink
|
4032 |
'./utils' |
|
afe42d0…
|
ragelink
|
4033 |
], function ($, Utils) { |
|
afe42d0…
|
ragelink
|
4034 |
function Dropdown ($element, options) { |
|
afe42d0…
|
ragelink
|
4035 |
this.$element = $element; |
|
afe42d0…
|
ragelink
|
4036 |
this.options = options; |
|
afe42d0…
|
ragelink
|
4037 |
|
|
afe42d0…
|
ragelink
|
4038 |
Dropdown.__super__.constructor.call(this); |
|
afe42d0…
|
ragelink
|
4039 |
} |
|
afe42d0…
|
ragelink
|
4040 |
|
|
afe42d0…
|
ragelink
|
4041 |
Utils.Extend(Dropdown, Utils.Observable); |
|
afe42d0…
|
ragelink
|
4042 |
|
|
afe42d0…
|
ragelink
|
4043 |
Dropdown.prototype.render = function () { |
|
afe42d0…
|
ragelink
|
4044 |
var $dropdown = $( |
|
afe42d0…
|
ragelink
|
4045 |
'<span class="select2-dropdown">' + |
|
afe42d0…
|
ragelink
|
4046 |
'<span class="select2-results"></span>' + |
|
afe42d0…
|
ragelink
|
4047 |
'</span>' |
|
afe42d0…
|
ragelink
|
4048 |
); |
|
afe42d0…
|
ragelink
|
4049 |
|
|
afe42d0…
|
ragelink
|
4050 |
$dropdown.attr('dir', this.options.get('dir')); |
|
afe42d0…
|
ragelink
|
4051 |
|
|
afe42d0…
|
ragelink
|
4052 |
this.$dropdown = $dropdown; |
|
afe42d0…
|
ragelink
|
4053 |
|
|
afe42d0…
|
ragelink
|
4054 |
return $dropdown; |
|
afe42d0…
|
ragelink
|
4055 |
}; |
|
afe42d0…
|
ragelink
|
4056 |
|
|
afe42d0…
|
ragelink
|
4057 |
Dropdown.prototype.bind = function () { |
|
afe42d0…
|
ragelink
|
4058 |
// Should be implemented in subclasses |
|
afe42d0…
|
ragelink
|
4059 |
}; |
|
afe42d0…
|
ragelink
|
4060 |
|
|
afe42d0…
|
ragelink
|
4061 |
Dropdown.prototype.position = function ($dropdown, $container) { |
|
afe42d0…
|
ragelink
|
4062 |
// Should be implemented in subclasses |
|
afe42d0…
|
ragelink
|
4063 |
}; |
|
afe42d0…
|
ragelink
|
4064 |
|
|
afe42d0…
|
ragelink
|
4065 |
Dropdown.prototype.destroy = function () { |
|
afe42d0…
|
ragelink
|
4066 |
// Remove the dropdown from the DOM |
|
afe42d0…
|
ragelink
|
4067 |
this.$dropdown.remove(); |
|
afe42d0…
|
ragelink
|
4068 |
}; |
|
afe42d0…
|
ragelink
|
4069 |
|
|
afe42d0…
|
ragelink
|
4070 |
return Dropdown; |
|
afe42d0…
|
ragelink
|
4071 |
}); |
|
afe42d0…
|
ragelink
|
4072 |
|
|
afe42d0…
|
ragelink
|
4073 |
S2.define('select2/dropdown/search',[ |
|
afe42d0…
|
ragelink
|
4074 |
'jquery', |
|
afe42d0…
|
ragelink
|
4075 |
'../utils' |
|
afe42d0…
|
ragelink
|
4076 |
], function ($, Utils) { |
|
afe42d0…
|
ragelink
|
4077 |
function Search () { } |
|
afe42d0…
|
ragelink
|
4078 |
|
|
afe42d0…
|
ragelink
|
4079 |
Search.prototype.render = function (decorated) { |
|
afe42d0…
|
ragelink
|
4080 |
var $rendered = decorated.call(this); |
|
afe42d0…
|
ragelink
|
4081 |
|
|
afe42d0…
|
ragelink
|
4082 |
var $search = $( |
|
afe42d0…
|
ragelink
|
4083 |
'<span class="select2-search select2-search--dropdown">' + |
|
afe42d0…
|
ragelink
|
4084 |
'<input class="select2-search__field" type="search" tabindex="-1"' + |
|
afe42d0…
|
ragelink
|
4085 |
' autocomplete="off" autocorrect="off" autocapitalize="none"' + |
|
afe42d0…
|
ragelink
|
4086 |
' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + |
|
afe42d0…
|
ragelink
|
4087 |
'</span>' |
|
afe42d0…
|
ragelink
|
4088 |
); |
|
afe42d0…
|
ragelink
|
4089 |
|
|
afe42d0…
|
ragelink
|
4090 |
this.$searchContainer = $search; |
|
afe42d0…
|
ragelink
|
4091 |
this.$search = $search.find('input'); |
|
afe42d0…
|
ragelink
|
4092 |
|
|
afe42d0…
|
ragelink
|
4093 |
$rendered.prepend($search); |
|
afe42d0…
|
ragelink
|
4094 |
|
|
afe42d0…
|
ragelink
|
4095 |
return $rendered; |
|
afe42d0…
|
ragelink
|
4096 |
}; |
|
afe42d0…
|
ragelink
|
4097 |
|
|
afe42d0…
|
ragelink
|
4098 |
Search.prototype.bind = function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
4099 |
var self = this; |
|
afe42d0…
|
ragelink
|
4100 |
|
|
afe42d0…
|
ragelink
|
4101 |
var resultsId = container.id + '-results'; |
|
afe42d0…
|
ragelink
|
4102 |
|
|
afe42d0…
|
ragelink
|
4103 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
4104 |
|
|
afe42d0…
|
ragelink
|
4105 |
this.$search.on('keydown', function (evt) { |
|
afe42d0…
|
ragelink
|
4106 |
self.trigger('keypress', evt); |
|
afe42d0…
|
ragelink
|
4107 |
|
|
afe42d0…
|
ragelink
|
4108 |
self._keyUpPrevented = evt.isDefaultPrevented(); |
|
afe42d0…
|
ragelink
|
4109 |
}); |
|
afe42d0…
|
ragelink
|
4110 |
|
|
afe42d0…
|
ragelink
|
4111 |
// Workaround for browsers which do not support the `input` event |
|
afe42d0…
|
ragelink
|
4112 |
// This will prevent double-triggering of events for browsers which support |
|
afe42d0…
|
ragelink
|
4113 |
// both the `keyup` and `input` events. |
|
afe42d0…
|
ragelink
|
4114 |
this.$search.on('input', function (evt) { |
|
afe42d0…
|
ragelink
|
4115 |
// Unbind the duplicated `keyup` event |
|
afe42d0…
|
ragelink
|
4116 |
$(this).off('keyup'); |
|
afe42d0…
|
ragelink
|
4117 |
}); |
|
afe42d0…
|
ragelink
|
4118 |
|
|
afe42d0…
|
ragelink
|
4119 |
this.$search.on('keyup input', function (evt) { |
|
afe42d0…
|
ragelink
|
4120 |
self.handleSearch(evt); |
|
afe42d0…
|
ragelink
|
4121 |
}); |
|
afe42d0…
|
ragelink
|
4122 |
|
|
afe42d0…
|
ragelink
|
4123 |
container.on('open', function () { |
|
afe42d0…
|
ragelink
|
4124 |
self.$search.attr('tabindex', 0); |
|
afe42d0…
|
ragelink
|
4125 |
self.$search.attr('aria-controls', resultsId); |
|
afe42d0…
|
ragelink
|
4126 |
|
|
afe42d0…
|
ragelink
|
4127 |
self.$search.trigger('focus'); |
|
afe42d0…
|
ragelink
|
4128 |
|
|
afe42d0…
|
ragelink
|
4129 |
window.setTimeout(function () { |
|
afe42d0…
|
ragelink
|
4130 |
self.$search.trigger('focus'); |
|
afe42d0…
|
ragelink
|
4131 |
}, 0); |
|
afe42d0…
|
ragelink
|
4132 |
}); |
|
afe42d0…
|
ragelink
|
4133 |
|
|
afe42d0…
|
ragelink
|
4134 |
container.on('close', function () { |
|
afe42d0…
|
ragelink
|
4135 |
self.$search.attr('tabindex', -1); |
|
afe42d0…
|
ragelink
|
4136 |
self.$search.removeAttr('aria-controls'); |
|
afe42d0…
|
ragelink
|
4137 |
self.$search.removeAttr('aria-activedescendant'); |
|
afe42d0…
|
ragelink
|
4138 |
|
|
afe42d0…
|
ragelink
|
4139 |
self.$search.val(''); |
|
afe42d0…
|
ragelink
|
4140 |
self.$search.trigger('blur'); |
|
afe42d0…
|
ragelink
|
4141 |
}); |
|
afe42d0…
|
ragelink
|
4142 |
|
|
afe42d0…
|
ragelink
|
4143 |
container.on('focus', function () { |
|
afe42d0…
|
ragelink
|
4144 |
if (!container.isOpen()) { |
|
afe42d0…
|
ragelink
|
4145 |
self.$search.trigger('focus'); |
|
afe42d0…
|
ragelink
|
4146 |
} |
|
afe42d0…
|
ragelink
|
4147 |
}); |
|
afe42d0…
|
ragelink
|
4148 |
|
|
afe42d0…
|
ragelink
|
4149 |
container.on('results:all', function (params) { |
|
afe42d0…
|
ragelink
|
4150 |
if (params.query.term == null || params.query.term === '') { |
|
afe42d0…
|
ragelink
|
4151 |
var showSearch = self.showSearch(params); |
|
afe42d0…
|
ragelink
|
4152 |
|
|
afe42d0…
|
ragelink
|
4153 |
if (showSearch) { |
|
afe42d0…
|
ragelink
|
4154 |
self.$searchContainer.removeClass('select2-search--hide'); |
|
afe42d0…
|
ragelink
|
4155 |
} else { |
|
afe42d0…
|
ragelink
|
4156 |
self.$searchContainer.addClass('select2-search--hide'); |
|
afe42d0…
|
ragelink
|
4157 |
} |
|
afe42d0…
|
ragelink
|
4158 |
} |
|
afe42d0…
|
ragelink
|
4159 |
}); |
|
afe42d0…
|
ragelink
|
4160 |
|
|
afe42d0…
|
ragelink
|
4161 |
container.on('results:focus', function (params) { |
|
afe42d0…
|
ragelink
|
4162 |
if (params.data._resultId) { |
|
afe42d0…
|
ragelink
|
4163 |
self.$search.attr('aria-activedescendant', params.data._resultId); |
|
afe42d0…
|
ragelink
|
4164 |
} else { |
|
afe42d0…
|
ragelink
|
4165 |
self.$search.removeAttr('aria-activedescendant'); |
|
afe42d0…
|
ragelink
|
4166 |
} |
|
afe42d0…
|
ragelink
|
4167 |
}); |
|
afe42d0…
|
ragelink
|
4168 |
}; |
|
afe42d0…
|
ragelink
|
4169 |
|
|
afe42d0…
|
ragelink
|
4170 |
Search.prototype.handleSearch = function (evt) { |
|
afe42d0…
|
ragelink
|
4171 |
if (!this._keyUpPrevented) { |
|
afe42d0…
|
ragelink
|
4172 |
var input = this.$search.val(); |
|
afe42d0…
|
ragelink
|
4173 |
|
|
afe42d0…
|
ragelink
|
4174 |
this.trigger('query', { |
|
afe42d0…
|
ragelink
|
4175 |
term: input |
|
afe42d0…
|
ragelink
|
4176 |
}); |
|
afe42d0…
|
ragelink
|
4177 |
} |
|
afe42d0…
|
ragelink
|
4178 |
|
|
afe42d0…
|
ragelink
|
4179 |
this._keyUpPrevented = false; |
|
afe42d0…
|
ragelink
|
4180 |
}; |
|
afe42d0…
|
ragelink
|
4181 |
|
|
afe42d0…
|
ragelink
|
4182 |
Search.prototype.showSearch = function (_, params) { |
|
afe42d0…
|
ragelink
|
4183 |
return true; |
|
afe42d0…
|
ragelink
|
4184 |
}; |
|
afe42d0…
|
ragelink
|
4185 |
|
|
afe42d0…
|
ragelink
|
4186 |
return Search; |
|
afe42d0…
|
ragelink
|
4187 |
}); |
|
afe42d0…
|
ragelink
|
4188 |
|
|
afe42d0…
|
ragelink
|
4189 |
S2.define('select2/dropdown/hidePlaceholder',[ |
|
afe42d0…
|
ragelink
|
4190 |
|
|
afe42d0…
|
ragelink
|
4191 |
], function () { |
|
afe42d0…
|
ragelink
|
4192 |
function HidePlaceholder (decorated, $element, options, dataAdapter) { |
|
afe42d0…
|
ragelink
|
4193 |
this.placeholder = this.normalizePlaceholder(options.get('placeholder')); |
|
afe42d0…
|
ragelink
|
4194 |
|
|
afe42d0…
|
ragelink
|
4195 |
decorated.call(this, $element, options, dataAdapter); |
|
afe42d0…
|
ragelink
|
4196 |
} |
|
afe42d0…
|
ragelink
|
4197 |
|
|
afe42d0…
|
ragelink
|
4198 |
HidePlaceholder.prototype.append = function (decorated, data) { |
|
afe42d0…
|
ragelink
|
4199 |
data.results = this.removePlaceholder(data.results); |
|
afe42d0…
|
ragelink
|
4200 |
|
|
afe42d0…
|
ragelink
|
4201 |
decorated.call(this, data); |
|
afe42d0…
|
ragelink
|
4202 |
}; |
|
afe42d0…
|
ragelink
|
4203 |
|
|
afe42d0…
|
ragelink
|
4204 |
HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { |
|
afe42d0…
|
ragelink
|
4205 |
if (typeof placeholder === 'string') { |
|
afe42d0…
|
ragelink
|
4206 |
placeholder = { |
|
afe42d0…
|
ragelink
|
4207 |
id: '', |
|
afe42d0…
|
ragelink
|
4208 |
text: placeholder |
|
afe42d0…
|
ragelink
|
4209 |
}; |
|
afe42d0…
|
ragelink
|
4210 |
} |
|
afe42d0…
|
ragelink
|
4211 |
|
|
afe42d0…
|
ragelink
|
4212 |
return placeholder; |
|
afe42d0…
|
ragelink
|
4213 |
}; |
|
afe42d0…
|
ragelink
|
4214 |
|
|
afe42d0…
|
ragelink
|
4215 |
HidePlaceholder.prototype.removePlaceholder = function (_, data) { |
|
afe42d0…
|
ragelink
|
4216 |
var modifiedData = data.slice(0); |
|
afe42d0…
|
ragelink
|
4217 |
|
|
afe42d0…
|
ragelink
|
4218 |
for (var d = data.length - 1; d >= 0; d--) { |
|
afe42d0…
|
ragelink
|
4219 |
var item = data[d]; |
|
afe42d0…
|
ragelink
|
4220 |
|
|
afe42d0…
|
ragelink
|
4221 |
if (this.placeholder.id === item.id) { |
|
afe42d0…
|
ragelink
|
4222 |
modifiedData.splice(d, 1); |
|
afe42d0…
|
ragelink
|
4223 |
} |
|
afe42d0…
|
ragelink
|
4224 |
} |
|
afe42d0…
|
ragelink
|
4225 |
|
|
afe42d0…
|
ragelink
|
4226 |
return modifiedData; |
|
afe42d0…
|
ragelink
|
4227 |
}; |
|
afe42d0…
|
ragelink
|
4228 |
|
|
afe42d0…
|
ragelink
|
4229 |
return HidePlaceholder; |
|
afe42d0…
|
ragelink
|
4230 |
}); |
|
afe42d0…
|
ragelink
|
4231 |
|
|
afe42d0…
|
ragelink
|
4232 |
S2.define('select2/dropdown/infiniteScroll',[ |
|
afe42d0…
|
ragelink
|
4233 |
'jquery' |
|
afe42d0…
|
ragelink
|
4234 |
], function ($) { |
|
afe42d0…
|
ragelink
|
4235 |
function InfiniteScroll (decorated, $element, options, dataAdapter) { |
|
afe42d0…
|
ragelink
|
4236 |
this.lastParams = {}; |
|
afe42d0…
|
ragelink
|
4237 |
|
|
afe42d0…
|
ragelink
|
4238 |
decorated.call(this, $element, options, dataAdapter); |
|
afe42d0…
|
ragelink
|
4239 |
|
|
afe42d0…
|
ragelink
|
4240 |
this.$loadingMore = this.createLoadingMore(); |
|
afe42d0…
|
ragelink
|
4241 |
this.loading = false; |
|
afe42d0…
|
ragelink
|
4242 |
} |
|
afe42d0…
|
ragelink
|
4243 |
|
|
afe42d0…
|
ragelink
|
4244 |
InfiniteScroll.prototype.append = function (decorated, data) { |
|
afe42d0…
|
ragelink
|
4245 |
this.$loadingMore.remove(); |
|
afe42d0…
|
ragelink
|
4246 |
this.loading = false; |
|
afe42d0…
|
ragelink
|
4247 |
|
|
afe42d0…
|
ragelink
|
4248 |
decorated.call(this, data); |
|
afe42d0…
|
ragelink
|
4249 |
|
|
afe42d0…
|
ragelink
|
4250 |
if (this.showLoadingMore(data)) { |
|
afe42d0…
|
ragelink
|
4251 |
this.$results.append(this.$loadingMore); |
|
afe42d0…
|
ragelink
|
4252 |
this.loadMoreIfNeeded(); |
|
afe42d0…
|
ragelink
|
4253 |
} |
|
afe42d0…
|
ragelink
|
4254 |
}; |
|
afe42d0…
|
ragelink
|
4255 |
|
|
afe42d0…
|
ragelink
|
4256 |
InfiniteScroll.prototype.bind = function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
4257 |
var self = this; |
|
afe42d0…
|
ragelink
|
4258 |
|
|
afe42d0…
|
ragelink
|
4259 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
4260 |
|
|
afe42d0…
|
ragelink
|
4261 |
container.on('query', function (params) { |
|
afe42d0…
|
ragelink
|
4262 |
self.lastParams = params; |
|
afe42d0…
|
ragelink
|
4263 |
self.loading = true; |
|
afe42d0…
|
ragelink
|
4264 |
}); |
|
afe42d0…
|
ragelink
|
4265 |
|
|
afe42d0…
|
ragelink
|
4266 |
container.on('query:append', function (params) { |
|
afe42d0…
|
ragelink
|
4267 |
self.lastParams = params; |
|
afe42d0…
|
ragelink
|
4268 |
self.loading = true; |
|
afe42d0…
|
ragelink
|
4269 |
}); |
|
afe42d0…
|
ragelink
|
4270 |
|
|
afe42d0…
|
ragelink
|
4271 |
this.$results.on('scroll', this.loadMoreIfNeeded.bind(this)); |
|
afe42d0…
|
ragelink
|
4272 |
}; |
|
afe42d0…
|
ragelink
|
4273 |
|
|
afe42d0…
|
ragelink
|
4274 |
InfiniteScroll.prototype.loadMoreIfNeeded = function () { |
|
afe42d0…
|
ragelink
|
4275 |
var isLoadMoreVisible = $.contains( |
|
afe42d0…
|
ragelink
|
4276 |
document.documentElement, |
|
afe42d0…
|
ragelink
|
4277 |
this.$loadingMore[0] |
|
afe42d0…
|
ragelink
|
4278 |
); |
|
afe42d0…
|
ragelink
|
4279 |
|
|
afe42d0…
|
ragelink
|
4280 |
if (this.loading || !isLoadMoreVisible) { |
|
afe42d0…
|
ragelink
|
4281 |
return; |
|
afe42d0…
|
ragelink
|
4282 |
} |
|
afe42d0…
|
ragelink
|
4283 |
|
|
afe42d0…
|
ragelink
|
4284 |
var currentOffset = this.$results.offset().top + |
|
afe42d0…
|
ragelink
|
4285 |
this.$results.outerHeight(false); |
|
afe42d0…
|
ragelink
|
4286 |
var loadingMoreOffset = this.$loadingMore.offset().top + |
|
afe42d0…
|
ragelink
|
4287 |
this.$loadingMore.outerHeight(false); |
|
afe42d0…
|
ragelink
|
4288 |
|
|
afe42d0…
|
ragelink
|
4289 |
if (currentOffset + 50 >= loadingMoreOffset) { |
|
afe42d0…
|
ragelink
|
4290 |
this.loadMore(); |
|
afe42d0…
|
ragelink
|
4291 |
} |
|
afe42d0…
|
ragelink
|
4292 |
}; |
|
afe42d0…
|
ragelink
|
4293 |
|
|
afe42d0…
|
ragelink
|
4294 |
InfiniteScroll.prototype.loadMore = function () { |
|
afe42d0…
|
ragelink
|
4295 |
this.loading = true; |
|
afe42d0…
|
ragelink
|
4296 |
|
|
afe42d0…
|
ragelink
|
4297 |
var params = $.extend({}, {page: 1}, this.lastParams); |
|
afe42d0…
|
ragelink
|
4298 |
|
|
afe42d0…
|
ragelink
|
4299 |
params.page++; |
|
afe42d0…
|
ragelink
|
4300 |
|
|
afe42d0…
|
ragelink
|
4301 |
this.trigger('query:append', params); |
|
afe42d0…
|
ragelink
|
4302 |
}; |
|
afe42d0…
|
ragelink
|
4303 |
|
|
afe42d0…
|
ragelink
|
4304 |
InfiniteScroll.prototype.showLoadingMore = function (_, data) { |
|
afe42d0…
|
ragelink
|
4305 |
return data.pagination && data.pagination.more; |
|
afe42d0…
|
ragelink
|
4306 |
}; |
|
afe42d0…
|
ragelink
|
4307 |
|
|
afe42d0…
|
ragelink
|
4308 |
InfiniteScroll.prototype.createLoadingMore = function () { |
|
afe42d0…
|
ragelink
|
4309 |
var $option = $( |
|
afe42d0…
|
ragelink
|
4310 |
'<li ' + |
|
afe42d0…
|
ragelink
|
4311 |
'class="select2-results__option select2-results__option--load-more"' + |
|
afe42d0…
|
ragelink
|
4312 |
'role="option" aria-disabled="true"></li>' |
|
afe42d0…
|
ragelink
|
4313 |
); |
|
afe42d0…
|
ragelink
|
4314 |
|
|
afe42d0…
|
ragelink
|
4315 |
var message = this.options.get('translations').get('loadingMore'); |
|
afe42d0…
|
ragelink
|
4316 |
|
|
afe42d0…
|
ragelink
|
4317 |
$option.html(message(this.lastParams)); |
|
afe42d0…
|
ragelink
|
4318 |
|
|
afe42d0…
|
ragelink
|
4319 |
return $option; |
|
afe42d0…
|
ragelink
|
4320 |
}; |
|
afe42d0…
|
ragelink
|
4321 |
|
|
afe42d0…
|
ragelink
|
4322 |
return InfiniteScroll; |
|
afe42d0…
|
ragelink
|
4323 |
}); |
|
afe42d0…
|
ragelink
|
4324 |
|
|
afe42d0…
|
ragelink
|
4325 |
S2.define('select2/dropdown/attachBody',[ |
|
afe42d0…
|
ragelink
|
4326 |
'jquery', |
|
afe42d0…
|
ragelink
|
4327 |
'../utils' |
|
afe42d0…
|
ragelink
|
4328 |
], function ($, Utils) { |
|
afe42d0…
|
ragelink
|
4329 |
function AttachBody (decorated, $element, options) { |
|
afe42d0…
|
ragelink
|
4330 |
this.$dropdownParent = $(options.get('dropdownParent') || document.body); |
|
afe42d0…
|
ragelink
|
4331 |
|
|
afe42d0…
|
ragelink
|
4332 |
decorated.call(this, $element, options); |
|
afe42d0…
|
ragelink
|
4333 |
} |
|
afe42d0…
|
ragelink
|
4334 |
|
|
afe42d0…
|
ragelink
|
4335 |
AttachBody.prototype.bind = function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
4336 |
var self = this; |
|
afe42d0…
|
ragelink
|
4337 |
|
|
afe42d0…
|
ragelink
|
4338 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
4339 |
|
|
afe42d0…
|
ragelink
|
4340 |
container.on('open', function () { |
|
afe42d0…
|
ragelink
|
4341 |
self._showDropdown(); |
|
afe42d0…
|
ragelink
|
4342 |
self._attachPositioningHandler(container); |
|
afe42d0…
|
ragelink
|
4343 |
|
|
afe42d0…
|
ragelink
|
4344 |
// Must bind after the results handlers to ensure correct sizing |
|
afe42d0…
|
ragelink
|
4345 |
self._bindContainerResultHandlers(container); |
|
afe42d0…
|
ragelink
|
4346 |
}); |
|
afe42d0…
|
ragelink
|
4347 |
|
|
afe42d0…
|
ragelink
|
4348 |
container.on('close', function () { |
|
afe42d0…
|
ragelink
|
4349 |
self._hideDropdown(); |
|
afe42d0…
|
ragelink
|
4350 |
self._detachPositioningHandler(container); |
|
afe42d0…
|
ragelink
|
4351 |
}); |
|
afe42d0…
|
ragelink
|
4352 |
|
|
afe42d0…
|
ragelink
|
4353 |
this.$dropdownContainer.on('mousedown', function (evt) { |
|
afe42d0…
|
ragelink
|
4354 |
evt.stopPropagation(); |
|
afe42d0…
|
ragelink
|
4355 |
}); |
|
afe42d0…
|
ragelink
|
4356 |
}; |
|
afe42d0…
|
ragelink
|
4357 |
|
|
afe42d0…
|
ragelink
|
4358 |
AttachBody.prototype.destroy = function (decorated) { |
|
afe42d0…
|
ragelink
|
4359 |
decorated.call(this); |
|
afe42d0…
|
ragelink
|
4360 |
|
|
afe42d0…
|
ragelink
|
4361 |
this.$dropdownContainer.remove(); |
|
afe42d0…
|
ragelink
|
4362 |
}; |
|
afe42d0…
|
ragelink
|
4363 |
|
|
afe42d0…
|
ragelink
|
4364 |
AttachBody.prototype.position = function (decorated, $dropdown, $container) { |
|
afe42d0…
|
ragelink
|
4365 |
// Clone all of the container classes |
|
afe42d0…
|
ragelink
|
4366 |
$dropdown.attr('class', $container.attr('class')); |
|
afe42d0…
|
ragelink
|
4367 |
|
|
afe42d0…
|
ragelink
|
4368 |
$dropdown.removeClass('select2'); |
|
afe42d0…
|
ragelink
|
4369 |
$dropdown.addClass('select2-container--open'); |
|
afe42d0…
|
ragelink
|
4370 |
|
|
afe42d0…
|
ragelink
|
4371 |
$dropdown.css({ |
|
afe42d0…
|
ragelink
|
4372 |
position: 'absolute', |
|
afe42d0…
|
ragelink
|
4373 |
top: -999999 |
|
afe42d0…
|
ragelink
|
4374 |
}); |
|
afe42d0…
|
ragelink
|
4375 |
|
|
afe42d0…
|
ragelink
|
4376 |
this.$container = $container; |
|
afe42d0…
|
ragelink
|
4377 |
}; |
|
afe42d0…
|
ragelink
|
4378 |
|
|
afe42d0…
|
ragelink
|
4379 |
AttachBody.prototype.render = function (decorated) { |
|
afe42d0…
|
ragelink
|
4380 |
var $container = $('<span></span>'); |
|
afe42d0…
|
ragelink
|
4381 |
|
|
afe42d0…
|
ragelink
|
4382 |
var $dropdown = decorated.call(this); |
|
afe42d0…
|
ragelink
|
4383 |
$container.append($dropdown); |
|
afe42d0…
|
ragelink
|
4384 |
|
|
afe42d0…
|
ragelink
|
4385 |
this.$dropdownContainer = $container; |
|
afe42d0…
|
ragelink
|
4386 |
|
|
afe42d0…
|
ragelink
|
4387 |
return $container; |
|
afe42d0…
|
ragelink
|
4388 |
}; |
|
afe42d0…
|
ragelink
|
4389 |
|
|
afe42d0…
|
ragelink
|
4390 |
AttachBody.prototype._hideDropdown = function (decorated) { |
|
afe42d0…
|
ragelink
|
4391 |
this.$dropdownContainer.detach(); |
|
afe42d0…
|
ragelink
|
4392 |
}; |
|
afe42d0…
|
ragelink
|
4393 |
|
|
afe42d0…
|
ragelink
|
4394 |
AttachBody.prototype._bindContainerResultHandlers = |
|
afe42d0…
|
ragelink
|
4395 |
function (decorated, container) { |
|
afe42d0…
|
ragelink
|
4396 |
|
|
afe42d0…
|
ragelink
|
4397 |
// These should only be bound once |
|
afe42d0…
|
ragelink
|
4398 |
if (this._containerResultsHandlersBound) { |
|
afe42d0…
|
ragelink
|
4399 |
return; |
|
afe42d0…
|
ragelink
|
4400 |
} |
|
afe42d0…
|
ragelink
|
4401 |
|
|
afe42d0…
|
ragelink
|
4402 |
var self = this; |
|
afe42d0…
|
ragelink
|
4403 |
|
|
afe42d0…
|
ragelink
|
4404 |
container.on('results:all', function () { |
|
afe42d0…
|
ragelink
|
4405 |
self._positionDropdown(); |
|
afe42d0…
|
ragelink
|
4406 |
self._resizeDropdown(); |
|
afe42d0…
|
ragelink
|
4407 |
}); |
|
afe42d0…
|
ragelink
|
4408 |
|
|
afe42d0…
|
ragelink
|
4409 |
container.on('results:append', function () { |
|
afe42d0…
|
ragelink
|
4410 |
self._positionDropdown(); |
|
afe42d0…
|
ragelink
|
4411 |
self._resizeDropdown(); |
|
afe42d0…
|
ragelink
|
4412 |
}); |
|
afe42d0…
|
ragelink
|
4413 |
|
|
afe42d0…
|
ragelink
|
4414 |
container.on('results:message', function () { |
|
afe42d0…
|
ragelink
|
4415 |
self._positionDropdown(); |
|
afe42d0…
|
ragelink
|
4416 |
self._resizeDropdown(); |
|
afe42d0…
|
ragelink
|
4417 |
}); |
|
afe42d0…
|
ragelink
|
4418 |
|
|
afe42d0…
|
ragelink
|
4419 |
container.on('select', function () { |
|
afe42d0…
|
ragelink
|
4420 |
self._positionDropdown(); |
|
afe42d0…
|
ragelink
|
4421 |
self._resizeDropdown(); |
|
afe42d0…
|
ragelink
|
4422 |
}); |
|
afe42d0…
|
ragelink
|
4423 |
|
|
afe42d0…
|
ragelink
|
4424 |
container.on('unselect', function () { |
|
afe42d0…
|
ragelink
|
4425 |
self._positionDropdown(); |
|
afe42d0…
|
ragelink
|
4426 |
self._resizeDropdown(); |
|
afe42d0…
|
ragelink
|
4427 |
}); |
|
afe42d0…
|
ragelink
|
4428 |
|
|
afe42d0…
|
ragelink
|
4429 |
this._containerResultsHandlersBound = true; |
|
afe42d0…
|
ragelink
|
4430 |
}; |
|
afe42d0…
|
ragelink
|
4431 |
|
|
afe42d0…
|
ragelink
|
4432 |
AttachBody.prototype._attachPositioningHandler = |
|
afe42d0…
|
ragelink
|
4433 |
function (decorated, container) { |
|
afe42d0…
|
ragelink
|
4434 |
var self = this; |
|
afe42d0…
|
ragelink
|
4435 |
|
|
afe42d0…
|
ragelink
|
4436 |
var scrollEvent = 'scroll.select2.' + container.id; |
|
afe42d0…
|
ragelink
|
4437 |
var resizeEvent = 'resize.select2.' + container.id; |
|
afe42d0…
|
ragelink
|
4438 |
var orientationEvent = 'orientationchange.select2.' + container.id; |
|
afe42d0…
|
ragelink
|
4439 |
|
|
afe42d0…
|
ragelink
|
4440 |
var $watchers = this.$container.parents().filter(Utils.hasScroll); |
|
afe42d0…
|
ragelink
|
4441 |
$watchers.each(function () { |
|
afe42d0…
|
ragelink
|
4442 |
Utils.StoreData(this, 'select2-scroll-position', { |
|
afe42d0…
|
ragelink
|
4443 |
x: $(this).scrollLeft(), |
|
afe42d0…
|
ragelink
|
4444 |
y: $(this).scrollTop() |
|
afe42d0…
|
ragelink
|
4445 |
}); |
|
afe42d0…
|
ragelink
|
4446 |
}); |
|
afe42d0…
|
ragelink
|
4447 |
|
|
afe42d0…
|
ragelink
|
4448 |
$watchers.on(scrollEvent, function (ev) { |
|
afe42d0…
|
ragelink
|
4449 |
var position = Utils.GetData(this, 'select2-scroll-position'); |
|
afe42d0…
|
ragelink
|
4450 |
$(this).scrollTop(position.y); |
|
afe42d0…
|
ragelink
|
4451 |
}); |
|
afe42d0…
|
ragelink
|
4452 |
|
|
afe42d0…
|
ragelink
|
4453 |
$(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, |
|
afe42d0…
|
ragelink
|
4454 |
function (e) { |
|
afe42d0…
|
ragelink
|
4455 |
self._positionDropdown(); |
|
afe42d0…
|
ragelink
|
4456 |
self._resizeDropdown(); |
|
afe42d0…
|
ragelink
|
4457 |
}); |
|
afe42d0…
|
ragelink
|
4458 |
}; |
|
afe42d0…
|
ragelink
|
4459 |
|
|
afe42d0…
|
ragelink
|
4460 |
AttachBody.prototype._detachPositioningHandler = |
|
afe42d0…
|
ragelink
|
4461 |
function (decorated, container) { |
|
afe42d0…
|
ragelink
|
4462 |
var scrollEvent = 'scroll.select2.' + container.id; |
|
afe42d0…
|
ragelink
|
4463 |
var resizeEvent = 'resize.select2.' + container.id; |
|
afe42d0…
|
ragelink
|
4464 |
var orientationEvent = 'orientationchange.select2.' + container.id; |
|
afe42d0…
|
ragelink
|
4465 |
|
|
afe42d0…
|
ragelink
|
4466 |
var $watchers = this.$container.parents().filter(Utils.hasScroll); |
|
afe42d0…
|
ragelink
|
4467 |
$watchers.off(scrollEvent); |
|
afe42d0…
|
ragelink
|
4468 |
|
|
afe42d0…
|
ragelink
|
4469 |
$(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); |
|
afe42d0…
|
ragelink
|
4470 |
}; |
|
afe42d0…
|
ragelink
|
4471 |
|
|
afe42d0…
|
ragelink
|
4472 |
AttachBody.prototype._positionDropdown = function () { |
|
afe42d0…
|
ragelink
|
4473 |
var $window = $(window); |
|
afe42d0…
|
ragelink
|
4474 |
|
|
afe42d0…
|
ragelink
|
4475 |
var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); |
|
afe42d0…
|
ragelink
|
4476 |
var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); |
|
afe42d0…
|
ragelink
|
4477 |
|
|
afe42d0…
|
ragelink
|
4478 |
var newDirection = null; |
|
afe42d0…
|
ragelink
|
4479 |
|
|
afe42d0…
|
ragelink
|
4480 |
var offset = this.$container.offset(); |
|
afe42d0…
|
ragelink
|
4481 |
|
|
afe42d0…
|
ragelink
|
4482 |
offset.bottom = offset.top + this.$container.outerHeight(false); |
|
afe42d0…
|
ragelink
|
4483 |
|
|
afe42d0…
|
ragelink
|
4484 |
var container = { |
|
afe42d0…
|
ragelink
|
4485 |
height: this.$container.outerHeight(false) |
|
afe42d0…
|
ragelink
|
4486 |
}; |
|
afe42d0…
|
ragelink
|
4487 |
|
|
afe42d0…
|
ragelink
|
4488 |
container.top = offset.top; |
|
afe42d0…
|
ragelink
|
4489 |
container.bottom = offset.top + container.height; |
|
afe42d0…
|
ragelink
|
4490 |
|
|
afe42d0…
|
ragelink
|
4491 |
var dropdown = { |
|
afe42d0…
|
ragelink
|
4492 |
height: this.$dropdown.outerHeight(false) |
|
afe42d0…
|
ragelink
|
4493 |
}; |
|
afe42d0…
|
ragelink
|
4494 |
|
|
afe42d0…
|
ragelink
|
4495 |
var viewport = { |
|
afe42d0…
|
ragelink
|
4496 |
top: $window.scrollTop(), |
|
afe42d0…
|
ragelink
|
4497 |
bottom: $window.scrollTop() + $window.height() |
|
afe42d0…
|
ragelink
|
4498 |
}; |
|
afe42d0…
|
ragelink
|
4499 |
|
|
afe42d0…
|
ragelink
|
4500 |
var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); |
|
afe42d0…
|
ragelink
|
4501 |
var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); |
|
afe42d0…
|
ragelink
|
4502 |
|
|
afe42d0…
|
ragelink
|
4503 |
var css = { |
|
afe42d0…
|
ragelink
|
4504 |
left: offset.left, |
|
afe42d0…
|
ragelink
|
4505 |
top: container.bottom |
|
afe42d0…
|
ragelink
|
4506 |
}; |
|
afe42d0…
|
ragelink
|
4507 |
|
|
afe42d0…
|
ragelink
|
4508 |
// Determine what the parent element is to use for calculating the offset |
|
afe42d0…
|
ragelink
|
4509 |
var $offsetParent = this.$dropdownParent; |
|
afe42d0…
|
ragelink
|
4510 |
|
|
afe42d0…
|
ragelink
|
4511 |
// For statically positioned elements, we need to get the element |
|
afe42d0…
|
ragelink
|
4512 |
// that is determining the offset |
|
afe42d0…
|
ragelink
|
4513 |
if ($offsetParent.css('position') === 'static') { |
|
afe42d0…
|
ragelink
|
4514 |
$offsetParent = $offsetParent.offsetParent(); |
|
afe42d0…
|
ragelink
|
4515 |
} |
|
afe42d0…
|
ragelink
|
4516 |
|
|
afe42d0…
|
ragelink
|
4517 |
var parentOffset = { |
|
afe42d0…
|
ragelink
|
4518 |
top: 0, |
|
afe42d0…
|
ragelink
|
4519 |
left: 0 |
|
afe42d0…
|
ragelink
|
4520 |
}; |
|
afe42d0…
|
ragelink
|
4521 |
|
|
afe42d0…
|
ragelink
|
4522 |
if ( |
|
afe42d0…
|
ragelink
|
4523 |
$.contains(document.body, $offsetParent[0]) || |
|
afe42d0…
|
ragelink
|
4524 |
$offsetParent[0].isConnected |
|
afe42d0…
|
ragelink
|
4525 |
) { |
|
afe42d0…
|
ragelink
|
4526 |
parentOffset = $offsetParent.offset(); |
|
afe42d0…
|
ragelink
|
4527 |
} |
|
afe42d0…
|
ragelink
|
4528 |
|
|
afe42d0…
|
ragelink
|
4529 |
css.top -= parentOffset.top; |
|
afe42d0…
|
ragelink
|
4530 |
css.left -= parentOffset.left; |
|
afe42d0…
|
ragelink
|
4531 |
|
|
afe42d0…
|
ragelink
|
4532 |
if (!isCurrentlyAbove && !isCurrentlyBelow) { |
|
afe42d0…
|
ragelink
|
4533 |
newDirection = 'below'; |
|
afe42d0…
|
ragelink
|
4534 |
} |
|
afe42d0…
|
ragelink
|
4535 |
|
|
afe42d0…
|
ragelink
|
4536 |
if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { |
|
afe42d0…
|
ragelink
|
4537 |
newDirection = 'above'; |
|
afe42d0…
|
ragelink
|
4538 |
} else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { |
|
afe42d0…
|
ragelink
|
4539 |
newDirection = 'below'; |
|
afe42d0…
|
ragelink
|
4540 |
} |
|
afe42d0…
|
ragelink
|
4541 |
|
|
afe42d0…
|
ragelink
|
4542 |
if (newDirection == 'above' || |
|
afe42d0…
|
ragelink
|
4543 |
(isCurrentlyAbove && newDirection !== 'below')) { |
|
afe42d0…
|
ragelink
|
4544 |
css.top = container.top - parentOffset.top - dropdown.height; |
|
afe42d0…
|
ragelink
|
4545 |
} |
|
afe42d0…
|
ragelink
|
4546 |
|
|
afe42d0…
|
ragelink
|
4547 |
if (newDirection != null) { |
|
afe42d0…
|
ragelink
|
4548 |
this.$dropdown |
|
afe42d0…
|
ragelink
|
4549 |
.removeClass('select2-dropdown--below select2-dropdown--above') |
|
afe42d0…
|
ragelink
|
4550 |
.addClass('select2-dropdown--' + newDirection); |
|
afe42d0…
|
ragelink
|
4551 |
this.$container |
|
afe42d0…
|
ragelink
|
4552 |
.removeClass('select2-container--below select2-container--above') |
|
afe42d0…
|
ragelink
|
4553 |
.addClass('select2-container--' + newDirection); |
|
afe42d0…
|
ragelink
|
4554 |
} |
|
afe42d0…
|
ragelink
|
4555 |
|
|
afe42d0…
|
ragelink
|
4556 |
this.$dropdownContainer.css(css); |
|
afe42d0…
|
ragelink
|
4557 |
}; |
|
afe42d0…
|
ragelink
|
4558 |
|
|
afe42d0…
|
ragelink
|
4559 |
AttachBody.prototype._resizeDropdown = function () { |
|
afe42d0…
|
ragelink
|
4560 |
var css = { |
|
afe42d0…
|
ragelink
|
4561 |
width: this.$container.outerWidth(false) + 'px' |
|
afe42d0…
|
ragelink
|
4562 |
}; |
|
afe42d0…
|
ragelink
|
4563 |
|
|
afe42d0…
|
ragelink
|
4564 |
if (this.options.get('dropdownAutoWidth')) { |
|
afe42d0…
|
ragelink
|
4565 |
css.minWidth = css.width; |
|
afe42d0…
|
ragelink
|
4566 |
css.position = 'relative'; |
|
afe42d0…
|
ragelink
|
4567 |
css.width = 'auto'; |
|
afe42d0…
|
ragelink
|
4568 |
} |
|
afe42d0…
|
ragelink
|
4569 |
|
|
afe42d0…
|
ragelink
|
4570 |
this.$dropdown.css(css); |
|
afe42d0…
|
ragelink
|
4571 |
}; |
|
afe42d0…
|
ragelink
|
4572 |
|
|
afe42d0…
|
ragelink
|
4573 |
AttachBody.prototype._showDropdown = function (decorated) { |
|
afe42d0…
|
ragelink
|
4574 |
this.$dropdownContainer.appendTo(this.$dropdownParent); |
|
afe42d0…
|
ragelink
|
4575 |
|
|
afe42d0…
|
ragelink
|
4576 |
this._positionDropdown(); |
|
afe42d0…
|
ragelink
|
4577 |
this._resizeDropdown(); |
|
afe42d0…
|
ragelink
|
4578 |
}; |
|
afe42d0…
|
ragelink
|
4579 |
|
|
afe42d0…
|
ragelink
|
4580 |
return AttachBody; |
|
afe42d0…
|
ragelink
|
4581 |
}); |
|
afe42d0…
|
ragelink
|
4582 |
|
|
afe42d0…
|
ragelink
|
4583 |
S2.define('select2/dropdown/minimumResultsForSearch',[ |
|
afe42d0…
|
ragelink
|
4584 |
|
|
afe42d0…
|
ragelink
|
4585 |
], function () { |
|
afe42d0…
|
ragelink
|
4586 |
function countResults (data) { |
|
afe42d0…
|
ragelink
|
4587 |
var count = 0; |
|
afe42d0…
|
ragelink
|
4588 |
|
|
afe42d0…
|
ragelink
|
4589 |
for (var d = 0; d < data.length; d++) { |
|
afe42d0…
|
ragelink
|
4590 |
var item = data[d]; |
|
afe42d0…
|
ragelink
|
4591 |
|
|
afe42d0…
|
ragelink
|
4592 |
if (item.children) { |
|
afe42d0…
|
ragelink
|
4593 |
count += countResults(item.children); |
|
afe42d0…
|
ragelink
|
4594 |
} else { |
|
afe42d0…
|
ragelink
|
4595 |
count++; |
|
afe42d0…
|
ragelink
|
4596 |
} |
|
afe42d0…
|
ragelink
|
4597 |
} |
|
afe42d0…
|
ragelink
|
4598 |
|
|
afe42d0…
|
ragelink
|
4599 |
return count; |
|
afe42d0…
|
ragelink
|
4600 |
} |
|
afe42d0…
|
ragelink
|
4601 |
|
|
afe42d0…
|
ragelink
|
4602 |
function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { |
|
afe42d0…
|
ragelink
|
4603 |
this.minimumResultsForSearch = options.get('minimumResultsForSearch'); |
|
afe42d0…
|
ragelink
|
4604 |
|
|
afe42d0…
|
ragelink
|
4605 |
if (this.minimumResultsForSearch < 0) { |
|
afe42d0…
|
ragelink
|
4606 |
this.minimumResultsForSearch = Infinity; |
|
afe42d0…
|
ragelink
|
4607 |
} |
|
afe42d0…
|
ragelink
|
4608 |
|
|
afe42d0…
|
ragelink
|
4609 |
decorated.call(this, $element, options, dataAdapter); |
|
afe42d0…
|
ragelink
|
4610 |
} |
|
afe42d0…
|
ragelink
|
4611 |
|
|
afe42d0…
|
ragelink
|
4612 |
MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { |
|
afe42d0…
|
ragelink
|
4613 |
if (countResults(params.data.results) < this.minimumResultsForSearch) { |
|
afe42d0…
|
ragelink
|
4614 |
return false; |
|
afe42d0…
|
ragelink
|
4615 |
} |
|
afe42d0…
|
ragelink
|
4616 |
|
|
afe42d0…
|
ragelink
|
4617 |
return decorated.call(this, params); |
|
afe42d0…
|
ragelink
|
4618 |
}; |
|
afe42d0…
|
ragelink
|
4619 |
|
|
afe42d0…
|
ragelink
|
4620 |
return MinimumResultsForSearch; |
|
afe42d0…
|
ragelink
|
4621 |
}); |
|
afe42d0…
|
ragelink
|
4622 |
|
|
afe42d0…
|
ragelink
|
4623 |
S2.define('select2/dropdown/selectOnClose',[ |
|
afe42d0…
|
ragelink
|
4624 |
'../utils' |
|
afe42d0…
|
ragelink
|
4625 |
], function (Utils) { |
|
afe42d0…
|
ragelink
|
4626 |
function SelectOnClose () { } |
|
afe42d0…
|
ragelink
|
4627 |
|
|
afe42d0…
|
ragelink
|
4628 |
SelectOnClose.prototype.bind = function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
4629 |
var self = this; |
|
afe42d0…
|
ragelink
|
4630 |
|
|
afe42d0…
|
ragelink
|
4631 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
4632 |
|
|
afe42d0…
|
ragelink
|
4633 |
container.on('close', function (params) { |
|
afe42d0…
|
ragelink
|
4634 |
self._handleSelectOnClose(params); |
|
afe42d0…
|
ragelink
|
4635 |
}); |
|
afe42d0…
|
ragelink
|
4636 |
}; |
|
afe42d0…
|
ragelink
|
4637 |
|
|
afe42d0…
|
ragelink
|
4638 |
SelectOnClose.prototype._handleSelectOnClose = function (_, params) { |
|
afe42d0…
|
ragelink
|
4639 |
if (params && params.originalSelect2Event != null) { |
|
afe42d0…
|
ragelink
|
4640 |
var event = params.originalSelect2Event; |
|
afe42d0…
|
ragelink
|
4641 |
|
|
afe42d0…
|
ragelink
|
4642 |
// Don't select an item if the close event was triggered from a select or |
|
afe42d0…
|
ragelink
|
4643 |
// unselect event |
|
afe42d0…
|
ragelink
|
4644 |
if (event._type === 'select' || event._type === 'unselect') { |
|
afe42d0…
|
ragelink
|
4645 |
return; |
|
afe42d0…
|
ragelink
|
4646 |
} |
|
afe42d0…
|
ragelink
|
4647 |
} |
|
afe42d0…
|
ragelink
|
4648 |
|
|
afe42d0…
|
ragelink
|
4649 |
var $highlightedResults = this.getHighlightedResults(); |
|
afe42d0…
|
ragelink
|
4650 |
|
|
afe42d0…
|
ragelink
|
4651 |
// Only select highlighted results |
|
afe42d0…
|
ragelink
|
4652 |
if ($highlightedResults.length < 1) { |
|
afe42d0…
|
ragelink
|
4653 |
return; |
|
afe42d0…
|
ragelink
|
4654 |
} |
|
afe42d0…
|
ragelink
|
4655 |
|
|
afe42d0…
|
ragelink
|
4656 |
var data = Utils.GetData($highlightedResults[0], 'data'); |
|
afe42d0…
|
ragelink
|
4657 |
|
|
afe42d0…
|
ragelink
|
4658 |
// Don't re-select already selected resulte |
|
afe42d0…
|
ragelink
|
4659 |
if ( |
|
afe42d0…
|
ragelink
|
4660 |
(data.element != null && data.element.selected) || |
|
afe42d0…
|
ragelink
|
4661 |
(data.element == null && data.selected) |
|
afe42d0…
|
ragelink
|
4662 |
) { |
|
afe42d0…
|
ragelink
|
4663 |
return; |
|
afe42d0…
|
ragelink
|
4664 |
} |
|
afe42d0…
|
ragelink
|
4665 |
|
|
afe42d0…
|
ragelink
|
4666 |
this.trigger('select', { |
|
afe42d0…
|
ragelink
|
4667 |
data: data |
|
afe42d0…
|
ragelink
|
4668 |
}); |
|
afe42d0…
|
ragelink
|
4669 |
}; |
|
afe42d0…
|
ragelink
|
4670 |
|
|
afe42d0…
|
ragelink
|
4671 |
return SelectOnClose; |
|
afe42d0…
|
ragelink
|
4672 |
}); |
|
afe42d0…
|
ragelink
|
4673 |
|
|
afe42d0…
|
ragelink
|
4674 |
S2.define('select2/dropdown/closeOnSelect',[ |
|
afe42d0…
|
ragelink
|
4675 |
|
|
afe42d0…
|
ragelink
|
4676 |
], function () { |
|
afe42d0…
|
ragelink
|
4677 |
function CloseOnSelect () { } |
|
afe42d0…
|
ragelink
|
4678 |
|
|
afe42d0…
|
ragelink
|
4679 |
CloseOnSelect.prototype.bind = function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
4680 |
var self = this; |
|
afe42d0…
|
ragelink
|
4681 |
|
|
afe42d0…
|
ragelink
|
4682 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
4683 |
|
|
afe42d0…
|
ragelink
|
4684 |
container.on('select', function (evt) { |
|
afe42d0…
|
ragelink
|
4685 |
self._selectTriggered(evt); |
|
afe42d0…
|
ragelink
|
4686 |
}); |
|
afe42d0…
|
ragelink
|
4687 |
|
|
afe42d0…
|
ragelink
|
4688 |
container.on('unselect', function (evt) { |
|
afe42d0…
|
ragelink
|
4689 |
self._selectTriggered(evt); |
|
afe42d0…
|
ragelink
|
4690 |
}); |
|
afe42d0…
|
ragelink
|
4691 |
}; |
|
afe42d0…
|
ragelink
|
4692 |
|
|
afe42d0…
|
ragelink
|
4693 |
CloseOnSelect.prototype._selectTriggered = function (_, evt) { |
|
afe42d0…
|
ragelink
|
4694 |
var originalEvent = evt.originalEvent; |
|
afe42d0…
|
ragelink
|
4695 |
|
|
afe42d0…
|
ragelink
|
4696 |
// Don't close if the control key is being held |
|
afe42d0…
|
ragelink
|
4697 |
if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) { |
|
afe42d0…
|
ragelink
|
4698 |
return; |
|
afe42d0…
|
ragelink
|
4699 |
} |
|
afe42d0…
|
ragelink
|
4700 |
|
|
afe42d0…
|
ragelink
|
4701 |
this.trigger('close', { |
|
afe42d0…
|
ragelink
|
4702 |
originalEvent: originalEvent, |
|
afe42d0…
|
ragelink
|
4703 |
originalSelect2Event: evt |
|
afe42d0…
|
ragelink
|
4704 |
}); |
|
afe42d0…
|
ragelink
|
4705 |
}; |
|
afe42d0…
|
ragelink
|
4706 |
|
|
afe42d0…
|
ragelink
|
4707 |
return CloseOnSelect; |
|
afe42d0…
|
ragelink
|
4708 |
}); |
|
afe42d0…
|
ragelink
|
4709 |
|
|
afe42d0…
|
ragelink
|
4710 |
S2.define('select2/i18n/en',[],function () { |
|
afe42d0…
|
ragelink
|
4711 |
// English |
|
afe42d0…
|
ragelink
|
4712 |
return { |
|
afe42d0…
|
ragelink
|
4713 |
errorLoading: function () { |
|
afe42d0…
|
ragelink
|
4714 |
return 'The results could not be loaded.'; |
|
afe42d0…
|
ragelink
|
4715 |
}, |
|
afe42d0…
|
ragelink
|
4716 |
inputTooLong: function (args) { |
|
afe42d0…
|
ragelink
|
4717 |
var overChars = args.input.length - args.maximum; |
|
afe42d0…
|
ragelink
|
4718 |
|
|
afe42d0…
|
ragelink
|
4719 |
var message = 'Please delete ' + overChars + ' character'; |
|
afe42d0…
|
ragelink
|
4720 |
|
|
afe42d0…
|
ragelink
|
4721 |
if (overChars != 1) { |
|
afe42d0…
|
ragelink
|
4722 |
message += 's'; |
|
afe42d0…
|
ragelink
|
4723 |
} |
|
afe42d0…
|
ragelink
|
4724 |
|
|
afe42d0…
|
ragelink
|
4725 |
return message; |
|
afe42d0…
|
ragelink
|
4726 |
}, |
|
afe42d0…
|
ragelink
|
4727 |
inputTooShort: function (args) { |
|
afe42d0…
|
ragelink
|
4728 |
var remainingChars = args.minimum - args.input.length; |
|
afe42d0…
|
ragelink
|
4729 |
|
|
afe42d0…
|
ragelink
|
4730 |
var message = 'Please enter ' + remainingChars + ' or more characters'; |
|
afe42d0…
|
ragelink
|
4731 |
|
|
afe42d0…
|
ragelink
|
4732 |
return message; |
|
afe42d0…
|
ragelink
|
4733 |
}, |
|
afe42d0…
|
ragelink
|
4734 |
loadingMore: function () { |
|
afe42d0…
|
ragelink
|
4735 |
return 'Loading more results…'; |
|
afe42d0…
|
ragelink
|
4736 |
}, |
|
afe42d0…
|
ragelink
|
4737 |
maximumSelected: function (args) { |
|
afe42d0…
|
ragelink
|
4738 |
var message = 'You can only select ' + args.maximum + ' item'; |
|
afe42d0…
|
ragelink
|
4739 |
|
|
afe42d0…
|
ragelink
|
4740 |
if (args.maximum != 1) { |
|
afe42d0…
|
ragelink
|
4741 |
message += 's'; |
|
afe42d0…
|
ragelink
|
4742 |
} |
|
afe42d0…
|
ragelink
|
4743 |
|
|
afe42d0…
|
ragelink
|
4744 |
return message; |
|
afe42d0…
|
ragelink
|
4745 |
}, |
|
afe42d0…
|
ragelink
|
4746 |
noResults: function () { |
|
afe42d0…
|
ragelink
|
4747 |
return 'No results found'; |
|
afe42d0…
|
ragelink
|
4748 |
}, |
|
afe42d0…
|
ragelink
|
4749 |
searching: function () { |
|
afe42d0…
|
ragelink
|
4750 |
return 'Searching…'; |
|
afe42d0…
|
ragelink
|
4751 |
}, |
|
afe42d0…
|
ragelink
|
4752 |
removeAllItems: function () { |
|
afe42d0…
|
ragelink
|
4753 |
return 'Remove all items'; |
|
afe42d0…
|
ragelink
|
4754 |
} |
|
afe42d0…
|
ragelink
|
4755 |
}; |
|
afe42d0…
|
ragelink
|
4756 |
}); |
|
afe42d0…
|
ragelink
|
4757 |
|
|
afe42d0…
|
ragelink
|
4758 |
S2.define('select2/defaults',[ |
|
afe42d0…
|
ragelink
|
4759 |
'jquery', |
|
afe42d0…
|
ragelink
|
4760 |
'require', |
|
afe42d0…
|
ragelink
|
4761 |
|
|
afe42d0…
|
ragelink
|
4762 |
'./results', |
|
afe42d0…
|
ragelink
|
4763 |
|
|
afe42d0…
|
ragelink
|
4764 |
'./selection/single', |
|
afe42d0…
|
ragelink
|
4765 |
'./selection/multiple', |
|
afe42d0…
|
ragelink
|
4766 |
'./selection/placeholder', |
|
afe42d0…
|
ragelink
|
4767 |
'./selection/allowClear', |
|
afe42d0…
|
ragelink
|
4768 |
'./selection/search', |
|
afe42d0…
|
ragelink
|
4769 |
'./selection/eventRelay', |
|
afe42d0…
|
ragelink
|
4770 |
|
|
afe42d0…
|
ragelink
|
4771 |
'./utils', |
|
afe42d0…
|
ragelink
|
4772 |
'./translation', |
|
afe42d0…
|
ragelink
|
4773 |
'./diacritics', |
|
afe42d0…
|
ragelink
|
4774 |
|
|
afe42d0…
|
ragelink
|
4775 |
'./data/select', |
|
afe42d0…
|
ragelink
|
4776 |
'./data/array', |
|
afe42d0…
|
ragelink
|
4777 |
'./data/ajax', |
|
afe42d0…
|
ragelink
|
4778 |
'./data/tags', |
|
afe42d0…
|
ragelink
|
4779 |
'./data/tokenizer', |
|
afe42d0…
|
ragelink
|
4780 |
'./data/minimumInputLength', |
|
afe42d0…
|
ragelink
|
4781 |
'./data/maximumInputLength', |
|
afe42d0…
|
ragelink
|
4782 |
'./data/maximumSelectionLength', |
|
afe42d0…
|
ragelink
|
4783 |
|
|
afe42d0…
|
ragelink
|
4784 |
'./dropdown', |
|
afe42d0…
|
ragelink
|
4785 |
'./dropdown/search', |
|
afe42d0…
|
ragelink
|
4786 |
'./dropdown/hidePlaceholder', |
|
afe42d0…
|
ragelink
|
4787 |
'./dropdown/infiniteScroll', |
|
afe42d0…
|
ragelink
|
4788 |
'./dropdown/attachBody', |
|
afe42d0…
|
ragelink
|
4789 |
'./dropdown/minimumResultsForSearch', |
|
afe42d0…
|
ragelink
|
4790 |
'./dropdown/selectOnClose', |
|
afe42d0…
|
ragelink
|
4791 |
'./dropdown/closeOnSelect', |
|
afe42d0…
|
ragelink
|
4792 |
|
|
afe42d0…
|
ragelink
|
4793 |
'./i18n/en' |
|
afe42d0…
|
ragelink
|
4794 |
], function ($, require, |
|
afe42d0…
|
ragelink
|
4795 |
|
|
afe42d0…
|
ragelink
|
4796 |
ResultsList, |
|
afe42d0…
|
ragelink
|
4797 |
|
|
afe42d0…
|
ragelink
|
4798 |
SingleSelection, MultipleSelection, Placeholder, AllowClear, |
|
afe42d0…
|
ragelink
|
4799 |
SelectionSearch, EventRelay, |
|
afe42d0…
|
ragelink
|
4800 |
|
|
afe42d0…
|
ragelink
|
4801 |
Utils, Translation, DIACRITICS, |
|
afe42d0…
|
ragelink
|
4802 |
|
|
afe42d0…
|
ragelink
|
4803 |
SelectData, ArrayData, AjaxData, Tags, Tokenizer, |
|
afe42d0…
|
ragelink
|
4804 |
MinimumInputLength, MaximumInputLength, MaximumSelectionLength, |
|
afe42d0…
|
ragelink
|
4805 |
|
|
afe42d0…
|
ragelink
|
4806 |
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, |
|
afe42d0…
|
ragelink
|
4807 |
AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, |
|
afe42d0…
|
ragelink
|
4808 |
|
|
afe42d0…
|
ragelink
|
4809 |
EnglishTranslation) { |
|
afe42d0…
|
ragelink
|
4810 |
function Defaults () { |
|
afe42d0…
|
ragelink
|
4811 |
this.reset(); |
|
afe42d0…
|
ragelink
|
4812 |
} |
|
afe42d0…
|
ragelink
|
4813 |
|
|
afe42d0…
|
ragelink
|
4814 |
Defaults.prototype.apply = function (options) { |
|
afe42d0…
|
ragelink
|
4815 |
options = $.extend(true, {}, this.defaults, options); |
|
afe42d0…
|
ragelink
|
4816 |
|
|
afe42d0…
|
ragelink
|
4817 |
if (options.dataAdapter == null) { |
|
afe42d0…
|
ragelink
|
4818 |
if (options.ajax != null) { |
|
afe42d0…
|
ragelink
|
4819 |
options.dataAdapter = AjaxData; |
|
afe42d0…
|
ragelink
|
4820 |
} else if (options.data != null) { |
|
afe42d0…
|
ragelink
|
4821 |
options.dataAdapter = ArrayData; |
|
afe42d0…
|
ragelink
|
4822 |
} else { |
|
afe42d0…
|
ragelink
|
4823 |
options.dataAdapter = SelectData; |
|
afe42d0…
|
ragelink
|
4824 |
} |
|
afe42d0…
|
ragelink
|
4825 |
|
|
afe42d0…
|
ragelink
|
4826 |
if (options.minimumInputLength > 0) { |
|
afe42d0…
|
ragelink
|
4827 |
options.dataAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4828 |
options.dataAdapter, |
|
afe42d0…
|
ragelink
|
4829 |
MinimumInputLength |
|
afe42d0…
|
ragelink
|
4830 |
); |
|
afe42d0…
|
ragelink
|
4831 |
} |
|
afe42d0…
|
ragelink
|
4832 |
|
|
afe42d0…
|
ragelink
|
4833 |
if (options.maximumInputLength > 0) { |
|
afe42d0…
|
ragelink
|
4834 |
options.dataAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4835 |
options.dataAdapter, |
|
afe42d0…
|
ragelink
|
4836 |
MaximumInputLength |
|
afe42d0…
|
ragelink
|
4837 |
); |
|
afe42d0…
|
ragelink
|
4838 |
} |
|
afe42d0…
|
ragelink
|
4839 |
|
|
afe42d0…
|
ragelink
|
4840 |
if (options.maximumSelectionLength > 0) { |
|
afe42d0…
|
ragelink
|
4841 |
options.dataAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4842 |
options.dataAdapter, |
|
afe42d0…
|
ragelink
|
4843 |
MaximumSelectionLength |
|
afe42d0…
|
ragelink
|
4844 |
); |
|
afe42d0…
|
ragelink
|
4845 |
} |
|
afe42d0…
|
ragelink
|
4846 |
|
|
afe42d0…
|
ragelink
|
4847 |
if (options.tags) { |
|
afe42d0…
|
ragelink
|
4848 |
options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); |
|
afe42d0…
|
ragelink
|
4849 |
} |
|
afe42d0…
|
ragelink
|
4850 |
|
|
afe42d0…
|
ragelink
|
4851 |
if (options.tokenSeparators != null || options.tokenizer != null) { |
|
afe42d0…
|
ragelink
|
4852 |
options.dataAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4853 |
options.dataAdapter, |
|
afe42d0…
|
ragelink
|
4854 |
Tokenizer |
|
afe42d0…
|
ragelink
|
4855 |
); |
|
afe42d0…
|
ragelink
|
4856 |
} |
|
afe42d0…
|
ragelink
|
4857 |
|
|
afe42d0…
|
ragelink
|
4858 |
if (options.query != null) { |
|
afe42d0…
|
ragelink
|
4859 |
var Query = require(options.amdBase + 'compat/query'); |
|
afe42d0…
|
ragelink
|
4860 |
|
|
afe42d0…
|
ragelink
|
4861 |
options.dataAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4862 |
options.dataAdapter, |
|
afe42d0…
|
ragelink
|
4863 |
Query |
|
afe42d0…
|
ragelink
|
4864 |
); |
|
afe42d0…
|
ragelink
|
4865 |
} |
|
afe42d0…
|
ragelink
|
4866 |
|
|
afe42d0…
|
ragelink
|
4867 |
if (options.initSelection != null) { |
|
afe42d0…
|
ragelink
|
4868 |
var InitSelection = require(options.amdBase + 'compat/initSelection'); |
|
afe42d0…
|
ragelink
|
4869 |
|
|
afe42d0…
|
ragelink
|
4870 |
options.dataAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4871 |
options.dataAdapter, |
|
afe42d0…
|
ragelink
|
4872 |
InitSelection |
|
afe42d0…
|
ragelink
|
4873 |
); |
|
afe42d0…
|
ragelink
|
4874 |
} |
|
afe42d0…
|
ragelink
|
4875 |
} |
|
afe42d0…
|
ragelink
|
4876 |
|
|
afe42d0…
|
ragelink
|
4877 |
if (options.resultsAdapter == null) { |
|
afe42d0…
|
ragelink
|
4878 |
options.resultsAdapter = ResultsList; |
|
afe42d0…
|
ragelink
|
4879 |
|
|
afe42d0…
|
ragelink
|
4880 |
if (options.ajax != null) { |
|
afe42d0…
|
ragelink
|
4881 |
options.resultsAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4882 |
options.resultsAdapter, |
|
afe42d0…
|
ragelink
|
4883 |
InfiniteScroll |
|
afe42d0…
|
ragelink
|
4884 |
); |
|
afe42d0…
|
ragelink
|
4885 |
} |
|
afe42d0…
|
ragelink
|
4886 |
|
|
afe42d0…
|
ragelink
|
4887 |
if (options.placeholder != null) { |
|
afe42d0…
|
ragelink
|
4888 |
options.resultsAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4889 |
options.resultsAdapter, |
|
afe42d0…
|
ragelink
|
4890 |
HidePlaceholder |
|
afe42d0…
|
ragelink
|
4891 |
); |
|
afe42d0…
|
ragelink
|
4892 |
} |
|
afe42d0…
|
ragelink
|
4893 |
|
|
afe42d0…
|
ragelink
|
4894 |
if (options.selectOnClose) { |
|
afe42d0…
|
ragelink
|
4895 |
options.resultsAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4896 |
options.resultsAdapter, |
|
afe42d0…
|
ragelink
|
4897 |
SelectOnClose |
|
afe42d0…
|
ragelink
|
4898 |
); |
|
afe42d0…
|
ragelink
|
4899 |
} |
|
afe42d0…
|
ragelink
|
4900 |
} |
|
afe42d0…
|
ragelink
|
4901 |
|
|
afe42d0…
|
ragelink
|
4902 |
if (options.dropdownAdapter == null) { |
|
afe42d0…
|
ragelink
|
4903 |
if (options.multiple) { |
|
afe42d0…
|
ragelink
|
4904 |
options.dropdownAdapter = Dropdown; |
|
afe42d0…
|
ragelink
|
4905 |
} else { |
|
afe42d0…
|
ragelink
|
4906 |
var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); |
|
afe42d0…
|
ragelink
|
4907 |
|
|
afe42d0…
|
ragelink
|
4908 |
options.dropdownAdapter = SearchableDropdown; |
|
afe42d0…
|
ragelink
|
4909 |
} |
|
afe42d0…
|
ragelink
|
4910 |
|
|
afe42d0…
|
ragelink
|
4911 |
if (options.minimumResultsForSearch !== 0) { |
|
afe42d0…
|
ragelink
|
4912 |
options.dropdownAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4913 |
options.dropdownAdapter, |
|
afe42d0…
|
ragelink
|
4914 |
MinimumResultsForSearch |
|
afe42d0…
|
ragelink
|
4915 |
); |
|
afe42d0…
|
ragelink
|
4916 |
} |
|
afe42d0…
|
ragelink
|
4917 |
|
|
afe42d0…
|
ragelink
|
4918 |
if (options.closeOnSelect) { |
|
afe42d0…
|
ragelink
|
4919 |
options.dropdownAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4920 |
options.dropdownAdapter, |
|
afe42d0…
|
ragelink
|
4921 |
CloseOnSelect |
|
afe42d0…
|
ragelink
|
4922 |
); |
|
afe42d0…
|
ragelink
|
4923 |
} |
|
afe42d0…
|
ragelink
|
4924 |
|
|
afe42d0…
|
ragelink
|
4925 |
if ( |
|
afe42d0…
|
ragelink
|
4926 |
options.dropdownCssClass != null || |
|
afe42d0…
|
ragelink
|
4927 |
options.dropdownCss != null || |
|
afe42d0…
|
ragelink
|
4928 |
options.adaptDropdownCssClass != null |
|
afe42d0…
|
ragelink
|
4929 |
) { |
|
afe42d0…
|
ragelink
|
4930 |
var DropdownCSS = require(options.amdBase + 'compat/dropdownCss'); |
|
afe42d0…
|
ragelink
|
4931 |
|
|
afe42d0…
|
ragelink
|
4932 |
options.dropdownAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4933 |
options.dropdownAdapter, |
|
afe42d0…
|
ragelink
|
4934 |
DropdownCSS |
|
afe42d0…
|
ragelink
|
4935 |
); |
|
afe42d0…
|
ragelink
|
4936 |
} |
|
afe42d0…
|
ragelink
|
4937 |
|
|
afe42d0…
|
ragelink
|
4938 |
options.dropdownAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4939 |
options.dropdownAdapter, |
|
afe42d0…
|
ragelink
|
4940 |
AttachBody |
|
afe42d0…
|
ragelink
|
4941 |
); |
|
afe42d0…
|
ragelink
|
4942 |
} |
|
afe42d0…
|
ragelink
|
4943 |
|
|
afe42d0…
|
ragelink
|
4944 |
if (options.selectionAdapter == null) { |
|
afe42d0…
|
ragelink
|
4945 |
if (options.multiple) { |
|
afe42d0…
|
ragelink
|
4946 |
options.selectionAdapter = MultipleSelection; |
|
afe42d0…
|
ragelink
|
4947 |
} else { |
|
afe42d0…
|
ragelink
|
4948 |
options.selectionAdapter = SingleSelection; |
|
afe42d0…
|
ragelink
|
4949 |
} |
|
afe42d0…
|
ragelink
|
4950 |
|
|
afe42d0…
|
ragelink
|
4951 |
// Add the placeholder mixin if a placeholder was specified |
|
afe42d0…
|
ragelink
|
4952 |
if (options.placeholder != null) { |
|
afe42d0…
|
ragelink
|
4953 |
options.selectionAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4954 |
options.selectionAdapter, |
|
afe42d0…
|
ragelink
|
4955 |
Placeholder |
|
afe42d0…
|
ragelink
|
4956 |
); |
|
afe42d0…
|
ragelink
|
4957 |
} |
|
afe42d0…
|
ragelink
|
4958 |
|
|
afe42d0…
|
ragelink
|
4959 |
if (options.allowClear) { |
|
afe42d0…
|
ragelink
|
4960 |
options.selectionAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4961 |
options.selectionAdapter, |
|
afe42d0…
|
ragelink
|
4962 |
AllowClear |
|
afe42d0…
|
ragelink
|
4963 |
); |
|
afe42d0…
|
ragelink
|
4964 |
} |
|
afe42d0…
|
ragelink
|
4965 |
|
|
afe42d0…
|
ragelink
|
4966 |
if (options.multiple) { |
|
afe42d0…
|
ragelink
|
4967 |
options.selectionAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4968 |
options.selectionAdapter, |
|
afe42d0…
|
ragelink
|
4969 |
SelectionSearch |
|
afe42d0…
|
ragelink
|
4970 |
); |
|
afe42d0…
|
ragelink
|
4971 |
} |
|
afe42d0…
|
ragelink
|
4972 |
|
|
afe42d0…
|
ragelink
|
4973 |
if ( |
|
afe42d0…
|
ragelink
|
4974 |
options.containerCssClass != null || |
|
afe42d0…
|
ragelink
|
4975 |
options.containerCss != null || |
|
afe42d0…
|
ragelink
|
4976 |
options.adaptContainerCssClass != null |
|
afe42d0…
|
ragelink
|
4977 |
) { |
|
afe42d0…
|
ragelink
|
4978 |
var ContainerCSS = require(options.amdBase + 'compat/containerCss'); |
|
afe42d0…
|
ragelink
|
4979 |
|
|
afe42d0…
|
ragelink
|
4980 |
options.selectionAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4981 |
options.selectionAdapter, |
|
afe42d0…
|
ragelink
|
4982 |
ContainerCSS |
|
afe42d0…
|
ragelink
|
4983 |
); |
|
afe42d0…
|
ragelink
|
4984 |
} |
|
afe42d0…
|
ragelink
|
4985 |
|
|
afe42d0…
|
ragelink
|
4986 |
options.selectionAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
4987 |
options.selectionAdapter, |
|
afe42d0…
|
ragelink
|
4988 |
EventRelay |
|
afe42d0…
|
ragelink
|
4989 |
); |
|
afe42d0…
|
ragelink
|
4990 |
} |
|
afe42d0…
|
ragelink
|
4991 |
|
|
afe42d0…
|
ragelink
|
4992 |
// If the defaults were not previously applied from an element, it is |
|
afe42d0…
|
ragelink
|
4993 |
// possible for the language option to have not been resolved |
|
afe42d0…
|
ragelink
|
4994 |
options.language = this._resolveLanguage(options.language); |
|
afe42d0…
|
ragelink
|
4995 |
|
|
afe42d0…
|
ragelink
|
4996 |
// Always fall back to English since it will always be complete |
|
afe42d0…
|
ragelink
|
4997 |
options.language.push('en'); |
|
afe42d0…
|
ragelink
|
4998 |
|
|
afe42d0…
|
ragelink
|
4999 |
var uniqueLanguages = []; |
|
afe42d0…
|
ragelink
|
5000 |
|
|
afe42d0…
|
ragelink
|
5001 |
for (var l = 0; l < options.language.length; l++) { |
|
afe42d0…
|
ragelink
|
5002 |
var language = options.language[l]; |
|
afe42d0…
|
ragelink
|
5003 |
|
|
afe42d0…
|
ragelink
|
5004 |
if (uniqueLanguages.indexOf(language) === -1) { |
|
afe42d0…
|
ragelink
|
5005 |
uniqueLanguages.push(language); |
|
afe42d0…
|
ragelink
|
5006 |
} |
|
afe42d0…
|
ragelink
|
5007 |
} |
|
afe42d0…
|
ragelink
|
5008 |
|
|
afe42d0…
|
ragelink
|
5009 |
options.language = uniqueLanguages; |
|
afe42d0…
|
ragelink
|
5010 |
|
|
afe42d0…
|
ragelink
|
5011 |
options.translations = this._processTranslations( |
|
afe42d0…
|
ragelink
|
5012 |
options.language, |
|
afe42d0…
|
ragelink
|
5013 |
options.debug |
|
afe42d0…
|
ragelink
|
5014 |
); |
|
afe42d0…
|
ragelink
|
5015 |
|
|
afe42d0…
|
ragelink
|
5016 |
return options; |
|
afe42d0…
|
ragelink
|
5017 |
}; |
|
afe42d0…
|
ragelink
|
5018 |
|
|
afe42d0…
|
ragelink
|
5019 |
Defaults.prototype.reset = function () { |
|
afe42d0…
|
ragelink
|
5020 |
function stripDiacritics (text) { |
|
afe42d0…
|
ragelink
|
5021 |
// Used 'uni range + named function' from http://jsperf.com/diacritics/18 |
|
afe42d0…
|
ragelink
|
5022 |
function match(a) { |
|
afe42d0…
|
ragelink
|
5023 |
return DIACRITICS[a] || a; |
|
afe42d0…
|
ragelink
|
5024 |
} |
|
afe42d0…
|
ragelink
|
5025 |
|
|
afe42d0…
|
ragelink
|
5026 |
return text.replace(/[^\u0000-\u007E]/g, match); |
|
afe42d0…
|
ragelink
|
5027 |
} |
|
afe42d0…
|
ragelink
|
5028 |
|
|
afe42d0…
|
ragelink
|
5029 |
function matcher (params, data) { |
|
afe42d0…
|
ragelink
|
5030 |
// Always return the object if there is nothing to compare |
|
afe42d0…
|
ragelink
|
5031 |
if ($.trim(params.term) === '') { |
|
afe42d0…
|
ragelink
|
5032 |
return data; |
|
afe42d0…
|
ragelink
|
5033 |
} |
|
afe42d0…
|
ragelink
|
5034 |
|
|
afe42d0…
|
ragelink
|
5035 |
// Do a recursive check for options with children |
|
afe42d0…
|
ragelink
|
5036 |
if (data.children && data.children.length > 0) { |
|
afe42d0…
|
ragelink
|
5037 |
// Clone the data object if there are children |
|
afe42d0…
|
ragelink
|
5038 |
// This is required as we modify the object to remove any non-matches |
|
afe42d0…
|
ragelink
|
5039 |
var match = $.extend(true, {}, data); |
|
afe42d0…
|
ragelink
|
5040 |
|
|
afe42d0…
|
ragelink
|
5041 |
// Check each child of the option |
|
afe42d0…
|
ragelink
|
5042 |
for (var c = data.children.length - 1; c >= 0; c--) { |
|
afe42d0…
|
ragelink
|
5043 |
var child = data.children[c]; |
|
afe42d0…
|
ragelink
|
5044 |
|
|
afe42d0…
|
ragelink
|
5045 |
var matches = matcher(params, child); |
|
afe42d0…
|
ragelink
|
5046 |
|
|
afe42d0…
|
ragelink
|
5047 |
// If there wasn't a match, remove the object in the array |
|
afe42d0…
|
ragelink
|
5048 |
if (matches == null) { |
|
afe42d0…
|
ragelink
|
5049 |
match.children.splice(c, 1); |
|
afe42d0…
|
ragelink
|
5050 |
} |
|
afe42d0…
|
ragelink
|
5051 |
} |
|
afe42d0…
|
ragelink
|
5052 |
|
|
afe42d0…
|
ragelink
|
5053 |
// If any children matched, return the new object |
|
afe42d0…
|
ragelink
|
5054 |
if (match.children.length > 0) { |
|
afe42d0…
|
ragelink
|
5055 |
return match; |
|
afe42d0…
|
ragelink
|
5056 |
} |
|
afe42d0…
|
ragelink
|
5057 |
|
|
afe42d0…
|
ragelink
|
5058 |
// If there were no matching children, check just the plain object |
|
afe42d0…
|
ragelink
|
5059 |
return matcher(params, match); |
|
afe42d0…
|
ragelink
|
5060 |
} |
|
afe42d0…
|
ragelink
|
5061 |
|
|
afe42d0…
|
ragelink
|
5062 |
var original = stripDiacritics(data.text).toUpperCase(); |
|
afe42d0…
|
ragelink
|
5063 |
var term = stripDiacritics(params.term).toUpperCase(); |
|
afe42d0…
|
ragelink
|
5064 |
|
|
afe42d0…
|
ragelink
|
5065 |
// Check if the text contains the term |
|
afe42d0…
|
ragelink
|
5066 |
if (original.indexOf(term) > -1) { |
|
afe42d0…
|
ragelink
|
5067 |
return data; |
|
afe42d0…
|
ragelink
|
5068 |
} |
|
afe42d0…
|
ragelink
|
5069 |
|
|
afe42d0…
|
ragelink
|
5070 |
// If it doesn't contain the term, don't return anything |
|
afe42d0…
|
ragelink
|
5071 |
return null; |
|
afe42d0…
|
ragelink
|
5072 |
} |
|
afe42d0…
|
ragelink
|
5073 |
|
|
afe42d0…
|
ragelink
|
5074 |
this.defaults = { |
|
afe42d0…
|
ragelink
|
5075 |
amdBase: './', |
|
afe42d0…
|
ragelink
|
5076 |
amdLanguageBase: './i18n/', |
|
afe42d0…
|
ragelink
|
5077 |
closeOnSelect: true, |
|
afe42d0…
|
ragelink
|
5078 |
debug: false, |
|
afe42d0…
|
ragelink
|
5079 |
dropdownAutoWidth: false, |
|
afe42d0…
|
ragelink
|
5080 |
escapeMarkup: Utils.escapeMarkup, |
|
afe42d0…
|
ragelink
|
5081 |
language: {}, |
|
afe42d0…
|
ragelink
|
5082 |
matcher: matcher, |
|
afe42d0…
|
ragelink
|
5083 |
minimumInputLength: 0, |
|
afe42d0…
|
ragelink
|
5084 |
maximumInputLength: 0, |
|
afe42d0…
|
ragelink
|
5085 |
maximumSelectionLength: 0, |
|
afe42d0…
|
ragelink
|
5086 |
minimumResultsForSearch: 0, |
|
afe42d0…
|
ragelink
|
5087 |
selectOnClose: false, |
|
afe42d0…
|
ragelink
|
5088 |
scrollAfterSelect: false, |
|
afe42d0…
|
ragelink
|
5089 |
sorter: function (data) { |
|
afe42d0…
|
ragelink
|
5090 |
return data; |
|
afe42d0…
|
ragelink
|
5091 |
}, |
|
afe42d0…
|
ragelink
|
5092 |
templateResult: function (result) { |
|
afe42d0…
|
ragelink
|
5093 |
return result.text; |
|
afe42d0…
|
ragelink
|
5094 |
}, |
|
afe42d0…
|
ragelink
|
5095 |
templateSelection: function (selection) { |
|
afe42d0…
|
ragelink
|
5096 |
return selection.text; |
|
afe42d0…
|
ragelink
|
5097 |
}, |
|
afe42d0…
|
ragelink
|
5098 |
theme: 'default', |
|
afe42d0…
|
ragelink
|
5099 |
width: 'resolve' |
|
afe42d0…
|
ragelink
|
5100 |
}; |
|
afe42d0…
|
ragelink
|
5101 |
}; |
|
afe42d0…
|
ragelink
|
5102 |
|
|
afe42d0…
|
ragelink
|
5103 |
Defaults.prototype.applyFromElement = function (options, $element) { |
|
afe42d0…
|
ragelink
|
5104 |
var optionLanguage = options.language; |
|
afe42d0…
|
ragelink
|
5105 |
var defaultLanguage = this.defaults.language; |
|
afe42d0…
|
ragelink
|
5106 |
var elementLanguage = $element.prop('lang'); |
|
afe42d0…
|
ragelink
|
5107 |
var parentLanguage = $element.closest('[lang]').prop('lang'); |
|
afe42d0…
|
ragelink
|
5108 |
|
|
afe42d0…
|
ragelink
|
5109 |
var languages = Array.prototype.concat.call( |
|
afe42d0…
|
ragelink
|
5110 |
this._resolveLanguage(elementLanguage), |
|
afe42d0…
|
ragelink
|
5111 |
this._resolveLanguage(optionLanguage), |
|
afe42d0…
|
ragelink
|
5112 |
this._resolveLanguage(defaultLanguage), |
|
afe42d0…
|
ragelink
|
5113 |
this._resolveLanguage(parentLanguage) |
|
afe42d0…
|
ragelink
|
5114 |
); |
|
afe42d0…
|
ragelink
|
5115 |
|
|
afe42d0…
|
ragelink
|
5116 |
options.language = languages; |
|
afe42d0…
|
ragelink
|
5117 |
|
|
afe42d0…
|
ragelink
|
5118 |
return options; |
|
afe42d0…
|
ragelink
|
5119 |
}; |
|
afe42d0…
|
ragelink
|
5120 |
|
|
afe42d0…
|
ragelink
|
5121 |
Defaults.prototype._resolveLanguage = function (language) { |
|
afe42d0…
|
ragelink
|
5122 |
if (!language) { |
|
afe42d0…
|
ragelink
|
5123 |
return []; |
|
afe42d0…
|
ragelink
|
5124 |
} |
|
afe42d0…
|
ragelink
|
5125 |
|
|
afe42d0…
|
ragelink
|
5126 |
if ($.isEmptyObject(language)) { |
|
afe42d0…
|
ragelink
|
5127 |
return []; |
|
afe42d0…
|
ragelink
|
5128 |
} |
|
afe42d0…
|
ragelink
|
5129 |
|
|
afe42d0…
|
ragelink
|
5130 |
if ($.isPlainObject(language)) { |
|
afe42d0…
|
ragelink
|
5131 |
return [language]; |
|
afe42d0…
|
ragelink
|
5132 |
} |
|
afe42d0…
|
ragelink
|
5133 |
|
|
afe42d0…
|
ragelink
|
5134 |
var languages; |
|
afe42d0…
|
ragelink
|
5135 |
|
|
afe42d0…
|
ragelink
|
5136 |
if (!$.isArray(language)) { |
|
afe42d0…
|
ragelink
|
5137 |
languages = [language]; |
|
afe42d0…
|
ragelink
|
5138 |
} else { |
|
afe42d0…
|
ragelink
|
5139 |
languages = language; |
|
afe42d0…
|
ragelink
|
5140 |
} |
|
afe42d0…
|
ragelink
|
5141 |
|
|
afe42d0…
|
ragelink
|
5142 |
var resolvedLanguages = []; |
|
afe42d0…
|
ragelink
|
5143 |
|
|
afe42d0…
|
ragelink
|
5144 |
for (var l = 0; l < languages.length; l++) { |
|
afe42d0…
|
ragelink
|
5145 |
resolvedLanguages.push(languages[l]); |
|
afe42d0…
|
ragelink
|
5146 |
|
|
afe42d0…
|
ragelink
|
5147 |
if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) { |
|
afe42d0…
|
ragelink
|
5148 |
// Extract the region information if it is included |
|
afe42d0…
|
ragelink
|
5149 |
var languageParts = languages[l].split('-'); |
|
afe42d0…
|
ragelink
|
5150 |
var baseLanguage = languageParts[0]; |
|
afe42d0…
|
ragelink
|
5151 |
|
|
afe42d0…
|
ragelink
|
5152 |
resolvedLanguages.push(baseLanguage); |
|
afe42d0…
|
ragelink
|
5153 |
} |
|
afe42d0…
|
ragelink
|
5154 |
} |
|
afe42d0…
|
ragelink
|
5155 |
|
|
afe42d0…
|
ragelink
|
5156 |
return resolvedLanguages; |
|
afe42d0…
|
ragelink
|
5157 |
}; |
|
afe42d0…
|
ragelink
|
5158 |
|
|
afe42d0…
|
ragelink
|
5159 |
Defaults.prototype._processTranslations = function (languages, debug) { |
|
afe42d0…
|
ragelink
|
5160 |
var translations = new Translation(); |
|
afe42d0…
|
ragelink
|
5161 |
|
|
afe42d0…
|
ragelink
|
5162 |
for (var l = 0; l < languages.length; l++) { |
|
afe42d0…
|
ragelink
|
5163 |
var languageData = new Translation(); |
|
afe42d0…
|
ragelink
|
5164 |
|
|
afe42d0…
|
ragelink
|
5165 |
var language = languages[l]; |
|
afe42d0…
|
ragelink
|
5166 |
|
|
afe42d0…
|
ragelink
|
5167 |
if (typeof language === 'string') { |
|
afe42d0…
|
ragelink
|
5168 |
try { |
|
afe42d0…
|
ragelink
|
5169 |
// Try to load it with the original name |
|
afe42d0…
|
ragelink
|
5170 |
languageData = Translation.loadPath(language); |
|
afe42d0…
|
ragelink
|
5171 |
} catch (e) { |
|
afe42d0…
|
ragelink
|
5172 |
try { |
|
afe42d0…
|
ragelink
|
5173 |
// If we couldn't load it, check if it wasn't the full path |
|
afe42d0…
|
ragelink
|
5174 |
language = this.defaults.amdLanguageBase + language; |
|
afe42d0…
|
ragelink
|
5175 |
languageData = Translation.loadPath(language); |
|
afe42d0…
|
ragelink
|
5176 |
} catch (ex) { |
|
afe42d0…
|
ragelink
|
5177 |
// The translation could not be loaded at all. Sometimes this is |
|
afe42d0…
|
ragelink
|
5178 |
// because of a configuration problem, other times this can be |
|
afe42d0…
|
ragelink
|
5179 |
// because of how Select2 helps load all possible translation files |
|
afe42d0…
|
ragelink
|
5180 |
if (debug && window.console && console.warn) { |
|
afe42d0…
|
ragelink
|
5181 |
console.warn( |
|
afe42d0…
|
ragelink
|
5182 |
'Select2: The language file for "' + language + '" could ' + |
|
afe42d0…
|
ragelink
|
5183 |
'not be automatically loaded. A fallback will be used instead.' |
|
afe42d0…
|
ragelink
|
5184 |
); |
|
afe42d0…
|
ragelink
|
5185 |
} |
|
afe42d0…
|
ragelink
|
5186 |
} |
|
afe42d0…
|
ragelink
|
5187 |
} |
|
afe42d0…
|
ragelink
|
5188 |
} else if ($.isPlainObject(language)) { |
|
afe42d0…
|
ragelink
|
5189 |
languageData = new Translation(language); |
|
afe42d0…
|
ragelink
|
5190 |
} else { |
|
afe42d0…
|
ragelink
|
5191 |
languageData = language; |
|
afe42d0…
|
ragelink
|
5192 |
} |
|
afe42d0…
|
ragelink
|
5193 |
|
|
afe42d0…
|
ragelink
|
5194 |
translations.extend(languageData); |
|
afe42d0…
|
ragelink
|
5195 |
} |
|
afe42d0…
|
ragelink
|
5196 |
|
|
afe42d0…
|
ragelink
|
5197 |
return translations; |
|
afe42d0…
|
ragelink
|
5198 |
}; |
|
afe42d0…
|
ragelink
|
5199 |
|
|
afe42d0…
|
ragelink
|
5200 |
Defaults.prototype.set = function (key, value) { |
|
afe42d0…
|
ragelink
|
5201 |
var camelKey = $.camelCase(key); |
|
afe42d0…
|
ragelink
|
5202 |
|
|
afe42d0…
|
ragelink
|
5203 |
var data = {}; |
|
afe42d0…
|
ragelink
|
5204 |
data[camelKey] = value; |
|
afe42d0…
|
ragelink
|
5205 |
|
|
afe42d0…
|
ragelink
|
5206 |
var convertedData = Utils._convertData(data); |
|
afe42d0…
|
ragelink
|
5207 |
|
|
afe42d0…
|
ragelink
|
5208 |
$.extend(true, this.defaults, convertedData); |
|
afe42d0…
|
ragelink
|
5209 |
}; |
|
afe42d0…
|
ragelink
|
5210 |
|
|
afe42d0…
|
ragelink
|
5211 |
var defaults = new Defaults(); |
|
afe42d0…
|
ragelink
|
5212 |
|
|
afe42d0…
|
ragelink
|
5213 |
return defaults; |
|
afe42d0…
|
ragelink
|
5214 |
}); |
|
afe42d0…
|
ragelink
|
5215 |
|
|
afe42d0…
|
ragelink
|
5216 |
S2.define('select2/options',[ |
|
afe42d0…
|
ragelink
|
5217 |
'require', |
|
afe42d0…
|
ragelink
|
5218 |
'jquery', |
|
afe42d0…
|
ragelink
|
5219 |
'./defaults', |
|
afe42d0…
|
ragelink
|
5220 |
'./utils' |
|
afe42d0…
|
ragelink
|
5221 |
], function (require, $, Defaults, Utils) { |
|
afe42d0…
|
ragelink
|
5222 |
function Options (options, $element) { |
|
afe42d0…
|
ragelink
|
5223 |
this.options = options; |
|
afe42d0…
|
ragelink
|
5224 |
|
|
afe42d0…
|
ragelink
|
5225 |
if ($element != null) { |
|
afe42d0…
|
ragelink
|
5226 |
this.fromElement($element); |
|
afe42d0…
|
ragelink
|
5227 |
} |
|
afe42d0…
|
ragelink
|
5228 |
|
|
afe42d0…
|
ragelink
|
5229 |
if ($element != null) { |
|
afe42d0…
|
ragelink
|
5230 |
this.options = Defaults.applyFromElement(this.options, $element); |
|
afe42d0…
|
ragelink
|
5231 |
} |
|
afe42d0…
|
ragelink
|
5232 |
|
|
afe42d0…
|
ragelink
|
5233 |
this.options = Defaults.apply(this.options); |
|
afe42d0…
|
ragelink
|
5234 |
|
|
afe42d0…
|
ragelink
|
5235 |
if ($element && $element.is('input')) { |
|
afe42d0…
|
ragelink
|
5236 |
var InputCompat = require(this.get('amdBase') + 'compat/inputData'); |
|
afe42d0…
|
ragelink
|
5237 |
|
|
afe42d0…
|
ragelink
|
5238 |
this.options.dataAdapter = Utils.Decorate( |
|
afe42d0…
|
ragelink
|
5239 |
this.options.dataAdapter, |
|
afe42d0…
|
ragelink
|
5240 |
InputCompat |
|
afe42d0…
|
ragelink
|
5241 |
); |
|
afe42d0…
|
ragelink
|
5242 |
} |
|
afe42d0…
|
ragelink
|
5243 |
} |
|
afe42d0…
|
ragelink
|
5244 |
|
|
afe42d0…
|
ragelink
|
5245 |
Options.prototype.fromElement = function ($e) { |
|
afe42d0…
|
ragelink
|
5246 |
var excludedData = ['select2']; |
|
afe42d0…
|
ragelink
|
5247 |
|
|
afe42d0…
|
ragelink
|
5248 |
if (this.options.multiple == null) { |
|
afe42d0…
|
ragelink
|
5249 |
this.options.multiple = $e.prop('multiple'); |
|
afe42d0…
|
ragelink
|
5250 |
} |
|
afe42d0…
|
ragelink
|
5251 |
|
|
afe42d0…
|
ragelink
|
5252 |
if (this.options.disabled == null) { |
|
afe42d0…
|
ragelink
|
5253 |
this.options.disabled = $e.prop('disabled'); |
|
afe42d0…
|
ragelink
|
5254 |
} |
|
afe42d0…
|
ragelink
|
5255 |
|
|
afe42d0…
|
ragelink
|
5256 |
if (this.options.dir == null) { |
|
afe42d0…
|
ragelink
|
5257 |
if ($e.prop('dir')) { |
|
afe42d0…
|
ragelink
|
5258 |
this.options.dir = $e.prop('dir'); |
|
afe42d0…
|
ragelink
|
5259 |
} else if ($e.closest('[dir]').prop('dir')) { |
|
afe42d0…
|
ragelink
|
5260 |
this.options.dir = $e.closest('[dir]').prop('dir'); |
|
afe42d0…
|
ragelink
|
5261 |
} else { |
|
afe42d0…
|
ragelink
|
5262 |
this.options.dir = 'ltr'; |
|
afe42d0…
|
ragelink
|
5263 |
} |
|
afe42d0…
|
ragelink
|
5264 |
} |
|
afe42d0…
|
ragelink
|
5265 |
|
|
afe42d0…
|
ragelink
|
5266 |
$e.prop('disabled', this.options.disabled); |
|
afe42d0…
|
ragelink
|
5267 |
$e.prop('multiple', this.options.multiple); |
|
afe42d0…
|
ragelink
|
5268 |
|
|
afe42d0…
|
ragelink
|
5269 |
if (Utils.GetData($e[0], 'select2Tags')) { |
|
afe42d0…
|
ragelink
|
5270 |
if (this.options.debug && window.console && console.warn) { |
|
afe42d0…
|
ragelink
|
5271 |
console.warn( |
|
afe42d0…
|
ragelink
|
5272 |
'Select2: The `data-select2-tags` attribute has been changed to ' + |
|
afe42d0…
|
ragelink
|
5273 |
'use the `data-data` and `data-tags="true"` attributes and will be ' + |
|
afe42d0…
|
ragelink
|
5274 |
'removed in future versions of Select2.' |
|
afe42d0…
|
ragelink
|
5275 |
); |
|
afe42d0…
|
ragelink
|
5276 |
} |
|
afe42d0…
|
ragelink
|
5277 |
|
|
afe42d0…
|
ragelink
|
5278 |
Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags')); |
|
afe42d0…
|
ragelink
|
5279 |
Utils.StoreData($e[0], 'tags', true); |
|
afe42d0…
|
ragelink
|
5280 |
} |
|
afe42d0…
|
ragelink
|
5281 |
|
|
afe42d0…
|
ragelink
|
5282 |
if (Utils.GetData($e[0], 'ajaxUrl')) { |
|
afe42d0…
|
ragelink
|
5283 |
if (this.options.debug && window.console && console.warn) { |
|
afe42d0…
|
ragelink
|
5284 |
console.warn( |
|
afe42d0…
|
ragelink
|
5285 |
'Select2: The `data-ajax-url` attribute has been changed to ' + |
|
afe42d0…
|
ragelink
|
5286 |
'`data-ajax--url` and support for the old attribute will be removed' + |
|
afe42d0…
|
ragelink
|
5287 |
' in future versions of Select2.' |
|
afe42d0…
|
ragelink
|
5288 |
); |
|
afe42d0…
|
ragelink
|
5289 |
} |
|
afe42d0…
|
ragelink
|
5290 |
|
|
afe42d0…
|
ragelink
|
5291 |
$e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); |
|
afe42d0…
|
ragelink
|
5292 |
Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl')); |
|
afe42d0…
|
ragelink
|
5293 |
} |
|
afe42d0…
|
ragelink
|
5294 |
|
|
afe42d0…
|
ragelink
|
5295 |
var dataset = {}; |
|
afe42d0…
|
ragelink
|
5296 |
|
|
afe42d0…
|
ragelink
|
5297 |
function upperCaseLetter(_, letter) { |
|
afe42d0…
|
ragelink
|
5298 |
return letter.toUpperCase(); |
|
afe42d0…
|
ragelink
|
5299 |
} |
|
afe42d0…
|
ragelink
|
5300 |
|
|
afe42d0…
|
ragelink
|
5301 |
// Pre-load all of the attributes which are prefixed with `data-` |
|
afe42d0…
|
ragelink
|
5302 |
for (var attr = 0; attr < $e[0].attributes.length; attr++) { |
|
afe42d0…
|
ragelink
|
5303 |
var attributeName = $e[0].attributes[attr].name; |
|
afe42d0…
|
ragelink
|
5304 |
var prefix = 'data-'; |
|
afe42d0…
|
ragelink
|
5305 |
|
|
afe42d0…
|
ragelink
|
5306 |
if (attributeName.substr(0, prefix.length) == prefix) { |
|
afe42d0…
|
ragelink
|
5307 |
// Get the contents of the attribute after `data-` |
|
afe42d0…
|
ragelink
|
5308 |
var dataName = attributeName.substring(prefix.length); |
|
afe42d0…
|
ragelink
|
5309 |
|
|
afe42d0…
|
ragelink
|
5310 |
// Get the data contents from the consistent source |
|
afe42d0…
|
ragelink
|
5311 |
// This is more than likely the jQuery data helper |
|
afe42d0…
|
ragelink
|
5312 |
var dataValue = Utils.GetData($e[0], dataName); |
|
afe42d0…
|
ragelink
|
5313 |
|
|
afe42d0…
|
ragelink
|
5314 |
// camelCase the attribute name to match the spec |
|
afe42d0…
|
ragelink
|
5315 |
var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter); |
|
afe42d0…
|
ragelink
|
5316 |
|
|
afe42d0…
|
ragelink
|
5317 |
// Store the data attribute contents into the dataset since |
|
afe42d0…
|
ragelink
|
5318 |
dataset[camelDataName] = dataValue; |
|
afe42d0…
|
ragelink
|
5319 |
} |
|
afe42d0…
|
ragelink
|
5320 |
} |
|
afe42d0…
|
ragelink
|
5321 |
|
|
afe42d0…
|
ragelink
|
5322 |
// Prefer the element's `dataset` attribute if it exists |
|
afe42d0…
|
ragelink
|
5323 |
// jQuery 1.x does not correctly handle data attributes with multiple dashes |
|
afe42d0…
|
ragelink
|
5324 |
if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { |
|
afe42d0…
|
ragelink
|
5325 |
dataset = $.extend(true, {}, $e[0].dataset, dataset); |
|
afe42d0…
|
ragelink
|
5326 |
} |
|
afe42d0…
|
ragelink
|
5327 |
|
|
afe42d0…
|
ragelink
|
5328 |
// Prefer our internal data cache if it exists |
|
afe42d0…
|
ragelink
|
5329 |
var data = $.extend(true, {}, Utils.GetData($e[0]), dataset); |
|
afe42d0…
|
ragelink
|
5330 |
|
|
afe42d0…
|
ragelink
|
5331 |
data = Utils._convertData(data); |
|
afe42d0…
|
ragelink
|
5332 |
|
|
afe42d0…
|
ragelink
|
5333 |
for (var key in data) { |
|
afe42d0…
|
ragelink
|
5334 |
if ($.inArray(key, excludedData) > -1) { |
|
afe42d0…
|
ragelink
|
5335 |
continue; |
|
afe42d0…
|
ragelink
|
5336 |
} |
|
afe42d0…
|
ragelink
|
5337 |
|
|
afe42d0…
|
ragelink
|
5338 |
if ($.isPlainObject(this.options[key])) { |
|
afe42d0…
|
ragelink
|
5339 |
$.extend(this.options[key], data[key]); |
|
afe42d0…
|
ragelink
|
5340 |
} else { |
|
afe42d0…
|
ragelink
|
5341 |
this.options[key] = data[key]; |
|
afe42d0…
|
ragelink
|
5342 |
} |
|
afe42d0…
|
ragelink
|
5343 |
} |
|
afe42d0…
|
ragelink
|
5344 |
|
|
afe42d0…
|
ragelink
|
5345 |
return this; |
|
afe42d0…
|
ragelink
|
5346 |
}; |
|
afe42d0…
|
ragelink
|
5347 |
|
|
afe42d0…
|
ragelink
|
5348 |
Options.prototype.get = function (key) { |
|
afe42d0…
|
ragelink
|
5349 |
return this.options[key]; |
|
afe42d0…
|
ragelink
|
5350 |
}; |
|
afe42d0…
|
ragelink
|
5351 |
|
|
afe42d0…
|
ragelink
|
5352 |
Options.prototype.set = function (key, val) { |
|
afe42d0…
|
ragelink
|
5353 |
this.options[key] = val; |
|
afe42d0…
|
ragelink
|
5354 |
}; |
|
afe42d0…
|
ragelink
|
5355 |
|
|
afe42d0…
|
ragelink
|
5356 |
return Options; |
|
afe42d0…
|
ragelink
|
5357 |
}); |
|
afe42d0…
|
ragelink
|
5358 |
|
|
afe42d0…
|
ragelink
|
5359 |
S2.define('select2/core',[ |
|
afe42d0…
|
ragelink
|
5360 |
'jquery', |
|
afe42d0…
|
ragelink
|
5361 |
'./options', |
|
afe42d0…
|
ragelink
|
5362 |
'./utils', |
|
afe42d0…
|
ragelink
|
5363 |
'./keys' |
|
afe42d0…
|
ragelink
|
5364 |
], function ($, Options, Utils, KEYS) { |
|
afe42d0…
|
ragelink
|
5365 |
var Select2 = function ($element, options) { |
|
afe42d0…
|
ragelink
|
5366 |
if (Utils.GetData($element[0], 'select2') != null) { |
|
afe42d0…
|
ragelink
|
5367 |
Utils.GetData($element[0], 'select2').destroy(); |
|
afe42d0…
|
ragelink
|
5368 |
} |
|
afe42d0…
|
ragelink
|
5369 |
|
|
afe42d0…
|
ragelink
|
5370 |
this.$element = $element; |
|
afe42d0…
|
ragelink
|
5371 |
|
|
afe42d0…
|
ragelink
|
5372 |
this.id = this._generateId($element); |
|
afe42d0…
|
ragelink
|
5373 |
|
|
afe42d0…
|
ragelink
|
5374 |
options = options || {}; |
|
afe42d0…
|
ragelink
|
5375 |
|
|
afe42d0…
|
ragelink
|
5376 |
this.options = new Options(options, $element); |
|
afe42d0…
|
ragelink
|
5377 |
|
|
afe42d0…
|
ragelink
|
5378 |
Select2.__super__.constructor.call(this); |
|
afe42d0…
|
ragelink
|
5379 |
|
|
afe42d0…
|
ragelink
|
5380 |
// Set up the tabindex |
|
afe42d0…
|
ragelink
|
5381 |
|
|
afe42d0…
|
ragelink
|
5382 |
var tabindex = $element.attr('tabindex') || 0; |
|
afe42d0…
|
ragelink
|
5383 |
Utils.StoreData($element[0], 'old-tabindex', tabindex); |
|
afe42d0…
|
ragelink
|
5384 |
$element.attr('tabindex', '-1'); |
|
afe42d0…
|
ragelink
|
5385 |
|
|
afe42d0…
|
ragelink
|
5386 |
// Set up containers and adapters |
|
afe42d0…
|
ragelink
|
5387 |
|
|
afe42d0…
|
ragelink
|
5388 |
var DataAdapter = this.options.get('dataAdapter'); |
|
afe42d0…
|
ragelink
|
5389 |
this.dataAdapter = new DataAdapter($element, this.options); |
|
afe42d0…
|
ragelink
|
5390 |
|
|
afe42d0…
|
ragelink
|
5391 |
var $container = this.render(); |
|
afe42d0…
|
ragelink
|
5392 |
|
|
afe42d0…
|
ragelink
|
5393 |
this._placeContainer($container); |
|
afe42d0…
|
ragelink
|
5394 |
|
|
afe42d0…
|
ragelink
|
5395 |
var SelectionAdapter = this.options.get('selectionAdapter'); |
|
afe42d0…
|
ragelink
|
5396 |
this.selection = new SelectionAdapter($element, this.options); |
|
afe42d0…
|
ragelink
|
5397 |
this.$selection = this.selection.render(); |
|
afe42d0…
|
ragelink
|
5398 |
|
|
afe42d0…
|
ragelink
|
5399 |
this.selection.position(this.$selection, $container); |
|
afe42d0…
|
ragelink
|
5400 |
|
|
afe42d0…
|
ragelink
|
5401 |
var DropdownAdapter = this.options.get('dropdownAdapter'); |
|
afe42d0…
|
ragelink
|
5402 |
this.dropdown = new DropdownAdapter($element, this.options); |
|
afe42d0…
|
ragelink
|
5403 |
this.$dropdown = this.dropdown.render(); |
|
afe42d0…
|
ragelink
|
5404 |
|
|
afe42d0…
|
ragelink
|
5405 |
this.dropdown.position(this.$dropdown, $container); |
|
afe42d0…
|
ragelink
|
5406 |
|
|
afe42d0…
|
ragelink
|
5407 |
var ResultsAdapter = this.options.get('resultsAdapter'); |
|
afe42d0…
|
ragelink
|
5408 |
this.results = new ResultsAdapter($element, this.options, this.dataAdapter); |
|
afe42d0…
|
ragelink
|
5409 |
this.$results = this.results.render(); |
|
afe42d0…
|
ragelink
|
5410 |
|
|
afe42d0…
|
ragelink
|
5411 |
this.results.position(this.$results, this.$dropdown); |
|
afe42d0…
|
ragelink
|
5412 |
|
|
afe42d0…
|
ragelink
|
5413 |
// Bind events |
|
afe42d0…
|
ragelink
|
5414 |
|
|
afe42d0…
|
ragelink
|
5415 |
var self = this; |
|
afe42d0…
|
ragelink
|
5416 |
|
|
afe42d0…
|
ragelink
|
5417 |
// Bind the container to all of the adapters |
|
afe42d0…
|
ragelink
|
5418 |
this._bindAdapters(); |
|
afe42d0…
|
ragelink
|
5419 |
|
|
afe42d0…
|
ragelink
|
5420 |
// Register any DOM event handlers |
|
afe42d0…
|
ragelink
|
5421 |
this._registerDomEvents(); |
|
afe42d0…
|
ragelink
|
5422 |
|
|
afe42d0…
|
ragelink
|
5423 |
// Register any internal event handlers |
|
afe42d0…
|
ragelink
|
5424 |
this._registerDataEvents(); |
|
afe42d0…
|
ragelink
|
5425 |
this._registerSelectionEvents(); |
|
afe42d0…
|
ragelink
|
5426 |
this._registerDropdownEvents(); |
|
afe42d0…
|
ragelink
|
5427 |
this._registerResultsEvents(); |
|
afe42d0…
|
ragelink
|
5428 |
this._registerEvents(); |
|
afe42d0…
|
ragelink
|
5429 |
|
|
afe42d0…
|
ragelink
|
5430 |
// Set the initial state |
|
afe42d0…
|
ragelink
|
5431 |
this.dataAdapter.current(function (initialData) { |
|
afe42d0…
|
ragelink
|
5432 |
self.trigger('selection:update', { |
|
afe42d0…
|
ragelink
|
5433 |
data: initialData |
|
afe42d0…
|
ragelink
|
5434 |
}); |
|
afe42d0…
|
ragelink
|
5435 |
}); |
|
afe42d0…
|
ragelink
|
5436 |
|
|
afe42d0…
|
ragelink
|
5437 |
// Hide the original select |
|
afe42d0…
|
ragelink
|
5438 |
$element.addClass('select2-hidden-accessible'); |
|
afe42d0…
|
ragelink
|
5439 |
$element.attr('aria-hidden', 'true'); |
|
afe42d0…
|
ragelink
|
5440 |
|
|
afe42d0…
|
ragelink
|
5441 |
// Synchronize any monitored attributes |
|
afe42d0…
|
ragelink
|
5442 |
this._syncAttributes(); |
|
afe42d0…
|
ragelink
|
5443 |
|
|
afe42d0…
|
ragelink
|
5444 |
Utils.StoreData($element[0], 'select2', this); |
|
afe42d0…
|
ragelink
|
5445 |
|
|
afe42d0…
|
ragelink
|
5446 |
// Ensure backwards compatibility with $element.data('select2'). |
|
afe42d0…
|
ragelink
|
5447 |
$element.data('select2', this); |
|
afe42d0…
|
ragelink
|
5448 |
}; |
|
afe42d0…
|
ragelink
|
5449 |
|
|
afe42d0…
|
ragelink
|
5450 |
Utils.Extend(Select2, Utils.Observable); |
|
afe42d0…
|
ragelink
|
5451 |
|
|
afe42d0…
|
ragelink
|
5452 |
Select2.prototype._generateId = function ($element) { |
|
afe42d0…
|
ragelink
|
5453 |
var id = ''; |
|
afe42d0…
|
ragelink
|
5454 |
|
|
afe42d0…
|
ragelink
|
5455 |
if ($element.attr('id') != null) { |
|
afe42d0…
|
ragelink
|
5456 |
id = $element.attr('id'); |
|
afe42d0…
|
ragelink
|
5457 |
} else if ($element.attr('name') != null) { |
|
afe42d0…
|
ragelink
|
5458 |
id = $element.attr('name') + '-' + Utils.generateChars(2); |
|
afe42d0…
|
ragelink
|
5459 |
} else { |
|
afe42d0…
|
ragelink
|
5460 |
id = Utils.generateChars(4); |
|
afe42d0…
|
ragelink
|
5461 |
} |
|
afe42d0…
|
ragelink
|
5462 |
|
|
afe42d0…
|
ragelink
|
5463 |
id = id.replace(/(:|\.|\[|\]|,)/g, ''); |
|
afe42d0…
|
ragelink
|
5464 |
id = 'select2-' + id; |
|
afe42d0…
|
ragelink
|
5465 |
|
|
afe42d0…
|
ragelink
|
5466 |
return id; |
|
afe42d0…
|
ragelink
|
5467 |
}; |
|
afe42d0…
|
ragelink
|
5468 |
|
|
afe42d0…
|
ragelink
|
5469 |
Select2.prototype._placeContainer = function ($container) { |
|
afe42d0…
|
ragelink
|
5470 |
$container.insertAfter(this.$element); |
|
afe42d0…
|
ragelink
|
5471 |
|
|
afe42d0…
|
ragelink
|
5472 |
var width = this._resolveWidth(this.$element, this.options.get('width')); |
|
afe42d0…
|
ragelink
|
5473 |
|
|
afe42d0…
|
ragelink
|
5474 |
if (width != null) { |
|
afe42d0…
|
ragelink
|
5475 |
$container.css('width', width); |
|
afe42d0…
|
ragelink
|
5476 |
} |
|
afe42d0…
|
ragelink
|
5477 |
}; |
|
afe42d0…
|
ragelink
|
5478 |
|
|
afe42d0…
|
ragelink
|
5479 |
Select2.prototype._resolveWidth = function ($element, method) { |
|
afe42d0…
|
ragelink
|
5480 |
var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; |
|
afe42d0…
|
ragelink
|
5481 |
|
|
afe42d0…
|
ragelink
|
5482 |
if (method == 'resolve') { |
|
afe42d0…
|
ragelink
|
5483 |
var styleWidth = this._resolveWidth($element, 'style'); |
|
afe42d0…
|
ragelink
|
5484 |
|
|
afe42d0…
|
ragelink
|
5485 |
if (styleWidth != null) { |
|
afe42d0…
|
ragelink
|
5486 |
return styleWidth; |
|
afe42d0…
|
ragelink
|
5487 |
} |
|
afe42d0…
|
ragelink
|
5488 |
|
|
afe42d0…
|
ragelink
|
5489 |
return this._resolveWidth($element, 'element'); |
|
afe42d0…
|
ragelink
|
5490 |
} |
|
afe42d0…
|
ragelink
|
5491 |
|
|
afe42d0…
|
ragelink
|
5492 |
if (method == 'element') { |
|
afe42d0…
|
ragelink
|
5493 |
var elementWidth = $element.outerWidth(false); |
|
afe42d0…
|
ragelink
|
5494 |
|
|
afe42d0…
|
ragelink
|
5495 |
if (elementWidth <= 0) { |
|
afe42d0…
|
ragelink
|
5496 |
return 'auto'; |
|
afe42d0…
|
ragelink
|
5497 |
} |
|
afe42d0…
|
ragelink
|
5498 |
|
|
afe42d0…
|
ragelink
|
5499 |
return elementWidth + 'px'; |
|
afe42d0…
|
ragelink
|
5500 |
} |
|
afe42d0…
|
ragelink
|
5501 |
|
|
afe42d0…
|
ragelink
|
5502 |
if (method == 'style') { |
|
afe42d0…
|
ragelink
|
5503 |
var style = $element.attr('style'); |
|
afe42d0…
|
ragelink
|
5504 |
|
|
afe42d0…
|
ragelink
|
5505 |
if (typeof(style) !== 'string') { |
|
afe42d0…
|
ragelink
|
5506 |
return null; |
|
afe42d0…
|
ragelink
|
5507 |
} |
|
afe42d0…
|
ragelink
|
5508 |
|
|
afe42d0…
|
ragelink
|
5509 |
var attrs = style.split(';'); |
|
afe42d0…
|
ragelink
|
5510 |
|
|
afe42d0…
|
ragelink
|
5511 |
for (var i = 0, l = attrs.length; i < l; i = i + 1) { |
|
afe42d0…
|
ragelink
|
5512 |
var attr = attrs[i].replace(/\s/g, ''); |
|
afe42d0…
|
ragelink
|
5513 |
var matches = attr.match(WIDTH); |
|
afe42d0…
|
ragelink
|
5514 |
|
|
afe42d0…
|
ragelink
|
5515 |
if (matches !== null && matches.length >= 1) { |
|
afe42d0…
|
ragelink
|
5516 |
return matches[1]; |
|
afe42d0…
|
ragelink
|
5517 |
} |
|
afe42d0…
|
ragelink
|
5518 |
} |
|
afe42d0…
|
ragelink
|
5519 |
|
|
afe42d0…
|
ragelink
|
5520 |
return null; |
|
afe42d0…
|
ragelink
|
5521 |
} |
|
afe42d0…
|
ragelink
|
5522 |
|
|
afe42d0…
|
ragelink
|
5523 |
if (method == 'computedstyle') { |
|
afe42d0…
|
ragelink
|
5524 |
var computedStyle = window.getComputedStyle($element[0]); |
|
afe42d0…
|
ragelink
|
5525 |
|
|
afe42d0…
|
ragelink
|
5526 |
return computedStyle.width; |
|
afe42d0…
|
ragelink
|
5527 |
} |
|
afe42d0…
|
ragelink
|
5528 |
|
|
afe42d0…
|
ragelink
|
5529 |
return method; |
|
afe42d0…
|
ragelink
|
5530 |
}; |
|
afe42d0…
|
ragelink
|
5531 |
|
|
afe42d0…
|
ragelink
|
5532 |
Select2.prototype._bindAdapters = function () { |
|
afe42d0…
|
ragelink
|
5533 |
this.dataAdapter.bind(this, this.$container); |
|
afe42d0…
|
ragelink
|
5534 |
this.selection.bind(this, this.$container); |
|
afe42d0…
|
ragelink
|
5535 |
|
|
afe42d0…
|
ragelink
|
5536 |
this.dropdown.bind(this, this.$container); |
|
afe42d0…
|
ragelink
|
5537 |
this.results.bind(this, this.$container); |
|
afe42d0…
|
ragelink
|
5538 |
}; |
|
afe42d0…
|
ragelink
|
5539 |
|
|
afe42d0…
|
ragelink
|
5540 |
Select2.prototype._registerDomEvents = function () { |
|
afe42d0…
|
ragelink
|
5541 |
var self = this; |
|
afe42d0…
|
ragelink
|
5542 |
|
|
afe42d0…
|
ragelink
|
5543 |
this.$element.on('change.select2', function () { |
|
afe42d0…
|
ragelink
|
5544 |
self.dataAdapter.current(function (data) { |
|
afe42d0…
|
ragelink
|
5545 |
self.trigger('selection:update', { |
|
afe42d0…
|
ragelink
|
5546 |
data: data |
|
afe42d0…
|
ragelink
|
5547 |
}); |
|
afe42d0…
|
ragelink
|
5548 |
}); |
|
afe42d0…
|
ragelink
|
5549 |
}); |
|
afe42d0…
|
ragelink
|
5550 |
|
|
afe42d0…
|
ragelink
|
5551 |
this.$element.on('focus.select2', function (evt) { |
|
afe42d0…
|
ragelink
|
5552 |
self.trigger('focus', evt); |
|
afe42d0…
|
ragelink
|
5553 |
}); |
|
afe42d0…
|
ragelink
|
5554 |
|
|
afe42d0…
|
ragelink
|
5555 |
this._syncA = Utils.bind(this._syncAttributes, this); |
|
afe42d0…
|
ragelink
|
5556 |
this._syncS = Utils.bind(this._syncSubtree, this); |
|
afe42d0…
|
ragelink
|
5557 |
|
|
afe42d0…
|
ragelink
|
5558 |
if (this.$element[0].attachEvent) { |
|
afe42d0…
|
ragelink
|
5559 |
this.$element[0].attachEvent('onpropertychange', this._syncA); |
|
afe42d0…
|
ragelink
|
5560 |
} |
|
afe42d0…
|
ragelink
|
5561 |
|
|
afe42d0…
|
ragelink
|
5562 |
var observer = window.MutationObserver || |
|
afe42d0…
|
ragelink
|
5563 |
window.WebKitMutationObserver || |
|
afe42d0…
|
ragelink
|
5564 |
window.MozMutationObserver |
|
afe42d0…
|
ragelink
|
5565 |
; |
|
afe42d0…
|
ragelink
|
5566 |
|
|
afe42d0…
|
ragelink
|
5567 |
if (observer != null) { |
|
afe42d0…
|
ragelink
|
5568 |
this._observer = new observer(function (mutations) { |
|
afe42d0…
|
ragelink
|
5569 |
self._syncA(); |
|
afe42d0…
|
ragelink
|
5570 |
self._syncS(null, mutations); |
|
afe42d0…
|
ragelink
|
5571 |
}); |
|
afe42d0…
|
ragelink
|
5572 |
this._observer.observe(this.$element[0], { |
|
afe42d0…
|
ragelink
|
5573 |
attributes: true, |
|
afe42d0…
|
ragelink
|
5574 |
childList: true, |
|
afe42d0…
|
ragelink
|
5575 |
subtree: false |
|
afe42d0…
|
ragelink
|
5576 |
}); |
|
afe42d0…
|
ragelink
|
5577 |
} else if (this.$element[0].addEventListener) { |
|
afe42d0…
|
ragelink
|
5578 |
this.$element[0].addEventListener( |
|
afe42d0…
|
ragelink
|
5579 |
'DOMAttrModified', |
|
afe42d0…
|
ragelink
|
5580 |
self._syncA, |
|
afe42d0…
|
ragelink
|
5581 |
false |
|
afe42d0…
|
ragelink
|
5582 |
); |
|
afe42d0…
|
ragelink
|
5583 |
this.$element[0].addEventListener( |
|
afe42d0…
|
ragelink
|
5584 |
'DOMNodeInserted', |
|
afe42d0…
|
ragelink
|
5585 |
self._syncS, |
|
afe42d0…
|
ragelink
|
5586 |
false |
|
afe42d0…
|
ragelink
|
5587 |
); |
|
afe42d0…
|
ragelink
|
5588 |
this.$element[0].addEventListener( |
|
afe42d0…
|
ragelink
|
5589 |
'DOMNodeRemoved', |
|
afe42d0…
|
ragelink
|
5590 |
self._syncS, |
|
afe42d0…
|
ragelink
|
5591 |
false |
|
afe42d0…
|
ragelink
|
5592 |
); |
|
afe42d0…
|
ragelink
|
5593 |
} |
|
afe42d0…
|
ragelink
|
5594 |
}; |
|
afe42d0…
|
ragelink
|
5595 |
|
|
afe42d0…
|
ragelink
|
5596 |
Select2.prototype._registerDataEvents = function () { |
|
afe42d0…
|
ragelink
|
5597 |
var self = this; |
|
afe42d0…
|
ragelink
|
5598 |
|
|
afe42d0…
|
ragelink
|
5599 |
this.dataAdapter.on('*', function (name, params) { |
|
afe42d0…
|
ragelink
|
5600 |
self.trigger(name, params); |
|
afe42d0…
|
ragelink
|
5601 |
}); |
|
afe42d0…
|
ragelink
|
5602 |
}; |
|
afe42d0…
|
ragelink
|
5603 |
|
|
afe42d0…
|
ragelink
|
5604 |
Select2.prototype._registerSelectionEvents = function () { |
|
afe42d0…
|
ragelink
|
5605 |
var self = this; |
|
afe42d0…
|
ragelink
|
5606 |
var nonRelayEvents = ['toggle', 'focus']; |
|
afe42d0…
|
ragelink
|
5607 |
|
|
afe42d0…
|
ragelink
|
5608 |
this.selection.on('toggle', function () { |
|
afe42d0…
|
ragelink
|
5609 |
self.toggleDropdown(); |
|
afe42d0…
|
ragelink
|
5610 |
}); |
|
afe42d0…
|
ragelink
|
5611 |
|
|
afe42d0…
|
ragelink
|
5612 |
this.selection.on('focus', function (params) { |
|
afe42d0…
|
ragelink
|
5613 |
self.focus(params); |
|
afe42d0…
|
ragelink
|
5614 |
}); |
|
afe42d0…
|
ragelink
|
5615 |
|
|
afe42d0…
|
ragelink
|
5616 |
this.selection.on('*', function (name, params) { |
|
afe42d0…
|
ragelink
|
5617 |
if ($.inArray(name, nonRelayEvents) !== -1) { |
|
afe42d0…
|
ragelink
|
5618 |
return; |
|
afe42d0…
|
ragelink
|
5619 |
} |
|
afe42d0…
|
ragelink
|
5620 |
|
|
afe42d0…
|
ragelink
|
5621 |
self.trigger(name, params); |
|
afe42d0…
|
ragelink
|
5622 |
}); |
|
afe42d0…
|
ragelink
|
5623 |
}; |
|
afe42d0…
|
ragelink
|
5624 |
|
|
afe42d0…
|
ragelink
|
5625 |
Select2.prototype._registerDropdownEvents = function () { |
|
afe42d0…
|
ragelink
|
5626 |
var self = this; |
|
afe42d0…
|
ragelink
|
5627 |
|
|
afe42d0…
|
ragelink
|
5628 |
this.dropdown.on('*', function (name, params) { |
|
afe42d0…
|
ragelink
|
5629 |
self.trigger(name, params); |
|
afe42d0…
|
ragelink
|
5630 |
}); |
|
afe42d0…
|
ragelink
|
5631 |
}; |
|
afe42d0…
|
ragelink
|
5632 |
|
|
afe42d0…
|
ragelink
|
5633 |
Select2.prototype._registerResultsEvents = function () { |
|
afe42d0…
|
ragelink
|
5634 |
var self = this; |
|
afe42d0…
|
ragelink
|
5635 |
|
|
afe42d0…
|
ragelink
|
5636 |
this.results.on('*', function (name, params) { |
|
afe42d0…
|
ragelink
|
5637 |
self.trigger(name, params); |
|
afe42d0…
|
ragelink
|
5638 |
}); |
|
afe42d0…
|
ragelink
|
5639 |
}; |
|
afe42d0…
|
ragelink
|
5640 |
|
|
afe42d0…
|
ragelink
|
5641 |
Select2.prototype._registerEvents = function () { |
|
afe42d0…
|
ragelink
|
5642 |
var self = this; |
|
afe42d0…
|
ragelink
|
5643 |
|
|
afe42d0…
|
ragelink
|
5644 |
this.on('open', function () { |
|
afe42d0…
|
ragelink
|
5645 |
self.$container.addClass('select2-container--open'); |
|
afe42d0…
|
ragelink
|
5646 |
}); |
|
afe42d0…
|
ragelink
|
5647 |
|
|
afe42d0…
|
ragelink
|
5648 |
this.on('close', function () { |
|
afe42d0…
|
ragelink
|
5649 |
self.$container.removeClass('select2-container--open'); |
|
afe42d0…
|
ragelink
|
5650 |
}); |
|
afe42d0…
|
ragelink
|
5651 |
|
|
afe42d0…
|
ragelink
|
5652 |
this.on('enable', function () { |
|
afe42d0…
|
ragelink
|
5653 |
self.$container.removeClass('select2-container--disabled'); |
|
afe42d0…
|
ragelink
|
5654 |
}); |
|
afe42d0…
|
ragelink
|
5655 |
|
|
afe42d0…
|
ragelink
|
5656 |
this.on('disable', function () { |
|
afe42d0…
|
ragelink
|
5657 |
self.$container.addClass('select2-container--disabled'); |
|
afe42d0…
|
ragelink
|
5658 |
}); |
|
afe42d0…
|
ragelink
|
5659 |
|
|
afe42d0…
|
ragelink
|
5660 |
this.on('blur', function () { |
|
afe42d0…
|
ragelink
|
5661 |
self.$container.removeClass('select2-container--focus'); |
|
afe42d0…
|
ragelink
|
5662 |
}); |
|
afe42d0…
|
ragelink
|
5663 |
|
|
afe42d0…
|
ragelink
|
5664 |
this.on('query', function (params) { |
|
afe42d0…
|
ragelink
|
5665 |
if (!self.isOpen()) { |
|
afe42d0…
|
ragelink
|
5666 |
self.trigger('open', {}); |
|
afe42d0…
|
ragelink
|
5667 |
} |
|
afe42d0…
|
ragelink
|
5668 |
|
|
afe42d0…
|
ragelink
|
5669 |
this.dataAdapter.query(params, function (data) { |
|
afe42d0…
|
ragelink
|
5670 |
self.trigger('results:all', { |
|
afe42d0…
|
ragelink
|
5671 |
data: data, |
|
afe42d0…
|
ragelink
|
5672 |
query: params |
|
afe42d0…
|
ragelink
|
5673 |
}); |
|
afe42d0…
|
ragelink
|
5674 |
}); |
|
afe42d0…
|
ragelink
|
5675 |
}); |
|
afe42d0…
|
ragelink
|
5676 |
|
|
afe42d0…
|
ragelink
|
5677 |
this.on('query:append', function (params) { |
|
afe42d0…
|
ragelink
|
5678 |
this.dataAdapter.query(params, function (data) { |
|
afe42d0…
|
ragelink
|
5679 |
self.trigger('results:append', { |
|
afe42d0…
|
ragelink
|
5680 |
data: data, |
|
afe42d0…
|
ragelink
|
5681 |
query: params |
|
afe42d0…
|
ragelink
|
5682 |
}); |
|
afe42d0…
|
ragelink
|
5683 |
}); |
|
afe42d0…
|
ragelink
|
5684 |
}); |
|
afe42d0…
|
ragelink
|
5685 |
|
|
afe42d0…
|
ragelink
|
5686 |
this.on('keypress', function (evt) { |
|
afe42d0…
|
ragelink
|
5687 |
var key = evt.which; |
|
afe42d0…
|
ragelink
|
5688 |
|
|
afe42d0…
|
ragelink
|
5689 |
if (self.isOpen()) { |
|
afe42d0…
|
ragelink
|
5690 |
if (key === KEYS.ESC || key === KEYS.TAB || |
|
afe42d0…
|
ragelink
|
5691 |
(key === KEYS.UP && evt.altKey)) { |
|
afe42d0…
|
ragelink
|
5692 |
self.close(evt); |
|
afe42d0…
|
ragelink
|
5693 |
|
|
afe42d0…
|
ragelink
|
5694 |
evt.preventDefault(); |
|
afe42d0…
|
ragelink
|
5695 |
} else if (key === KEYS.ENTER) { |
|
afe42d0…
|
ragelink
|
5696 |
self.trigger('results:select', {}); |
|
afe42d0…
|
ragelink
|
5697 |
|
|
afe42d0…
|
ragelink
|
5698 |
evt.preventDefault(); |
|
afe42d0…
|
ragelink
|
5699 |
} else if ((key === KEYS.SPACE && evt.ctrlKey)) { |
|
afe42d0…
|
ragelink
|
5700 |
self.trigger('results:toggle', {}); |
|
afe42d0…
|
ragelink
|
5701 |
|
|
afe42d0…
|
ragelink
|
5702 |
evt.preventDefault(); |
|
afe42d0…
|
ragelink
|
5703 |
} else if (key === KEYS.UP) { |
|
afe42d0…
|
ragelink
|
5704 |
self.trigger('results:previous', {}); |
|
afe42d0…
|
ragelink
|
5705 |
|
|
afe42d0…
|
ragelink
|
5706 |
evt.preventDefault(); |
|
afe42d0…
|
ragelink
|
5707 |
} else if (key === KEYS.DOWN) { |
|
afe42d0…
|
ragelink
|
5708 |
self.trigger('results:next', {}); |
|
afe42d0…
|
ragelink
|
5709 |
|
|
afe42d0…
|
ragelink
|
5710 |
evt.preventDefault(); |
|
afe42d0…
|
ragelink
|
5711 |
} |
|
afe42d0…
|
ragelink
|
5712 |
} else { |
|
afe42d0…
|
ragelink
|
5713 |
if (key === KEYS.ENTER || key === KEYS.SPACE || |
|
afe42d0…
|
ragelink
|
5714 |
(key === KEYS.DOWN && evt.altKey)) { |
|
afe42d0…
|
ragelink
|
5715 |
self.open(); |
|
afe42d0…
|
ragelink
|
5716 |
|
|
afe42d0…
|
ragelink
|
5717 |
evt.preventDefault(); |
|
afe42d0…
|
ragelink
|
5718 |
} |
|
afe42d0…
|
ragelink
|
5719 |
} |
|
afe42d0…
|
ragelink
|
5720 |
}); |
|
afe42d0…
|
ragelink
|
5721 |
}; |
|
afe42d0…
|
ragelink
|
5722 |
|
|
afe42d0…
|
ragelink
|
5723 |
Select2.prototype._syncAttributes = function () { |
|
afe42d0…
|
ragelink
|
5724 |
this.options.set('disabled', this.$element.prop('disabled')); |
|
afe42d0…
|
ragelink
|
5725 |
|
|
afe42d0…
|
ragelink
|
5726 |
if (this.isDisabled()) { |
|
afe42d0…
|
ragelink
|
5727 |
if (this.isOpen()) { |
|
afe42d0…
|
ragelink
|
5728 |
this.close(); |
|
afe42d0…
|
ragelink
|
5729 |
} |
|
afe42d0…
|
ragelink
|
5730 |
|
|
afe42d0…
|
ragelink
|
5731 |
this.trigger('disable', {}); |
|
afe42d0…
|
ragelink
|
5732 |
} else { |
|
afe42d0…
|
ragelink
|
5733 |
this.trigger('enable', {}); |
|
afe42d0…
|
ragelink
|
5734 |
} |
|
afe42d0…
|
ragelink
|
5735 |
}; |
|
afe42d0…
|
ragelink
|
5736 |
|
|
afe42d0…
|
ragelink
|
5737 |
Select2.prototype._isChangeMutation = function (evt, mutations) { |
|
afe42d0…
|
ragelink
|
5738 |
var changed = false; |
|
afe42d0…
|
ragelink
|
5739 |
var self = this; |
|
afe42d0…
|
ragelink
|
5740 |
|
|
afe42d0…
|
ragelink
|
5741 |
// Ignore any mutation events raised for elements that aren't options or |
|
afe42d0…
|
ragelink
|
5742 |
// optgroups. This handles the case when the select element is destroyed |
|
afe42d0…
|
ragelink
|
5743 |
if ( |
|
afe42d0…
|
ragelink
|
5744 |
evt && evt.target && ( |
|
afe42d0…
|
ragelink
|
5745 |
evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' |
|
afe42d0…
|
ragelink
|
5746 |
) |
|
afe42d0…
|
ragelink
|
5747 |
) { |
|
afe42d0…
|
ragelink
|
5748 |
return; |
|
afe42d0…
|
ragelink
|
5749 |
} |
|
afe42d0…
|
ragelink
|
5750 |
|
|
afe42d0…
|
ragelink
|
5751 |
if (!mutations) { |
|
afe42d0…
|
ragelink
|
5752 |
// If mutation events aren't supported, then we can only assume that the |
|
afe42d0…
|
ragelink
|
5753 |
// change affected the selections |
|
afe42d0…
|
ragelink
|
5754 |
changed = true; |
|
afe42d0…
|
ragelink
|
5755 |
} else if (mutations.addedNodes && mutations.addedNodes.length > 0) { |
|
afe42d0…
|
ragelink
|
5756 |
for (var n = 0; n < mutations.addedNodes.length; n++) { |
|
afe42d0…
|
ragelink
|
5757 |
var node = mutations.addedNodes[n]; |
|
afe42d0…
|
ragelink
|
5758 |
|
|
afe42d0…
|
ragelink
|
5759 |
if (node.selected) { |
|
afe42d0…
|
ragelink
|
5760 |
changed = true; |
|
afe42d0…
|
ragelink
|
5761 |
} |
|
afe42d0…
|
ragelink
|
5762 |
} |
|
afe42d0…
|
ragelink
|
5763 |
} else if (mutations.removedNodes && mutations.removedNodes.length > 0) { |
|
afe42d0…
|
ragelink
|
5764 |
changed = true; |
|
afe42d0…
|
ragelink
|
5765 |
} else if ($.isArray(mutations)) { |
|
afe42d0…
|
ragelink
|
5766 |
$.each(mutations, function(evt, mutation) { |
|
afe42d0…
|
ragelink
|
5767 |
if (self._isChangeMutation(evt, mutation)) { |
|
afe42d0…
|
ragelink
|
5768 |
// We've found a change mutation. |
|
afe42d0…
|
ragelink
|
5769 |
// Let's escape from the loop and continue |
|
afe42d0…
|
ragelink
|
5770 |
changed = true; |
|
afe42d0…
|
ragelink
|
5771 |
return false; |
|
afe42d0…
|
ragelink
|
5772 |
} |
|
afe42d0…
|
ragelink
|
5773 |
}); |
|
afe42d0…
|
ragelink
|
5774 |
} |
|
afe42d0…
|
ragelink
|
5775 |
return changed; |
|
afe42d0…
|
ragelink
|
5776 |
}; |
|
afe42d0…
|
ragelink
|
5777 |
|
|
afe42d0…
|
ragelink
|
5778 |
Select2.prototype._syncSubtree = function (evt, mutations) { |
|
afe42d0…
|
ragelink
|
5779 |
var changed = this._isChangeMutation(evt, mutations); |
|
afe42d0…
|
ragelink
|
5780 |
var self = this; |
|
afe42d0…
|
ragelink
|
5781 |
|
|
afe42d0…
|
ragelink
|
5782 |
// Only re-pull the data if we think there is a change |
|
afe42d0…
|
ragelink
|
5783 |
if (changed) { |
|
afe42d0…
|
ragelink
|
5784 |
this.dataAdapter.current(function (currentData) { |
|
afe42d0…
|
ragelink
|
5785 |
self.trigger('selection:update', { |
|
afe42d0…
|
ragelink
|
5786 |
data: currentData |
|
afe42d0…
|
ragelink
|
5787 |
}); |
|
afe42d0…
|
ragelink
|
5788 |
}); |
|
afe42d0…
|
ragelink
|
5789 |
} |
|
afe42d0…
|
ragelink
|
5790 |
}; |
|
afe42d0…
|
ragelink
|
5791 |
|
|
afe42d0…
|
ragelink
|
5792 |
/** |
|
afe42d0…
|
ragelink
|
5793 |
* Override the trigger method to automatically trigger pre-events when |
|
afe42d0…
|
ragelink
|
5794 |
* there are events that can be prevented. |
|
afe42d0…
|
ragelink
|
5795 |
*/ |
|
afe42d0…
|
ragelink
|
5796 |
Select2.prototype.trigger = function (name, args) { |
|
afe42d0…
|
ragelink
|
5797 |
var actualTrigger = Select2.__super__.trigger; |
|
afe42d0…
|
ragelink
|
5798 |
var preTriggerMap = { |
|
afe42d0…
|
ragelink
|
5799 |
'open': 'opening', |
|
afe42d0…
|
ragelink
|
5800 |
'close': 'closing', |
|
afe42d0…
|
ragelink
|
5801 |
'select': 'selecting', |
|
afe42d0…
|
ragelink
|
5802 |
'unselect': 'unselecting', |
|
afe42d0…
|
ragelink
|
5803 |
'clear': 'clearing' |
|
afe42d0…
|
ragelink
|
5804 |
}; |
|
afe42d0…
|
ragelink
|
5805 |
|
|
afe42d0…
|
ragelink
|
5806 |
if (args === undefined) { |
|
afe42d0…
|
ragelink
|
5807 |
args = {}; |
|
afe42d0…
|
ragelink
|
5808 |
} |
|
afe42d0…
|
ragelink
|
5809 |
|
|
afe42d0…
|
ragelink
|
5810 |
if (name in preTriggerMap) { |
|
afe42d0…
|
ragelink
|
5811 |
var preTriggerName = preTriggerMap[name]; |
|
afe42d0…
|
ragelink
|
5812 |
var preTriggerArgs = { |
|
afe42d0…
|
ragelink
|
5813 |
prevented: false, |
|
afe42d0…
|
ragelink
|
5814 |
name: name, |
|
afe42d0…
|
ragelink
|
5815 |
args: args |
|
afe42d0…
|
ragelink
|
5816 |
}; |
|
afe42d0…
|
ragelink
|
5817 |
|
|
afe42d0…
|
ragelink
|
5818 |
actualTrigger.call(this, preTriggerName, preTriggerArgs); |
|
afe42d0…
|
ragelink
|
5819 |
|
|
afe42d0…
|
ragelink
|
5820 |
if (preTriggerArgs.prevented) { |
|
afe42d0…
|
ragelink
|
5821 |
args.prevented = true; |
|
afe42d0…
|
ragelink
|
5822 |
|
|
afe42d0…
|
ragelink
|
5823 |
return; |
|
afe42d0…
|
ragelink
|
5824 |
} |
|
afe42d0…
|
ragelink
|
5825 |
} |
|
afe42d0…
|
ragelink
|
5826 |
|
|
afe42d0…
|
ragelink
|
5827 |
actualTrigger.call(this, name, args); |
|
afe42d0…
|
ragelink
|
5828 |
}; |
|
afe42d0…
|
ragelink
|
5829 |
|
|
afe42d0…
|
ragelink
|
5830 |
Select2.prototype.toggleDropdown = function () { |
|
afe42d0…
|
ragelink
|
5831 |
if (this.isDisabled()) { |
|
afe42d0…
|
ragelink
|
5832 |
return; |
|
afe42d0…
|
ragelink
|
5833 |
} |
|
afe42d0…
|
ragelink
|
5834 |
|
|
afe42d0…
|
ragelink
|
5835 |
if (this.isOpen()) { |
|
afe42d0…
|
ragelink
|
5836 |
this.close(); |
|
afe42d0…
|
ragelink
|
5837 |
} else { |
|
afe42d0…
|
ragelink
|
5838 |
this.open(); |
|
afe42d0…
|
ragelink
|
5839 |
} |
|
afe42d0…
|
ragelink
|
5840 |
}; |
|
afe42d0…
|
ragelink
|
5841 |
|
|
afe42d0…
|
ragelink
|
5842 |
Select2.prototype.open = function () { |
|
afe42d0…
|
ragelink
|
5843 |
if (this.isOpen()) { |
|
afe42d0…
|
ragelink
|
5844 |
return; |
|
afe42d0…
|
ragelink
|
5845 |
} |
|
afe42d0…
|
ragelink
|
5846 |
|
|
afe42d0…
|
ragelink
|
5847 |
if (this.isDisabled()) { |
|
afe42d0…
|
ragelink
|
5848 |
return; |
|
afe42d0…
|
ragelink
|
5849 |
} |
|
afe42d0…
|
ragelink
|
5850 |
|
|
afe42d0…
|
ragelink
|
5851 |
this.trigger('query', {}); |
|
afe42d0…
|
ragelink
|
5852 |
}; |
|
afe42d0…
|
ragelink
|
5853 |
|
|
afe42d0…
|
ragelink
|
5854 |
Select2.prototype.close = function (evt) { |
|
afe42d0…
|
ragelink
|
5855 |
if (!this.isOpen()) { |
|
afe42d0…
|
ragelink
|
5856 |
return; |
|
afe42d0…
|
ragelink
|
5857 |
} |
|
afe42d0…
|
ragelink
|
5858 |
|
|
afe42d0…
|
ragelink
|
5859 |
this.trigger('close', { originalEvent : evt }); |
|
afe42d0…
|
ragelink
|
5860 |
}; |
|
afe42d0…
|
ragelink
|
5861 |
|
|
afe42d0…
|
ragelink
|
5862 |
/** |
|
afe42d0…
|
ragelink
|
5863 |
* Helper method to abstract the "enabled" (not "disabled") state of this |
|
afe42d0…
|
ragelink
|
5864 |
* object. |
|
afe42d0…
|
ragelink
|
5865 |
* |
|
afe42d0…
|
ragelink
|
5866 |
* @return {true} if the instance is not disabled. |
|
afe42d0…
|
ragelink
|
5867 |
* @return {false} if the instance is disabled. |
|
afe42d0…
|
ragelink
|
5868 |
*/ |
|
afe42d0…
|
ragelink
|
5869 |
Select2.prototype.isEnabled = function () { |
|
afe42d0…
|
ragelink
|
5870 |
return !this.isDisabled(); |
|
afe42d0…
|
ragelink
|
5871 |
}; |
|
afe42d0…
|
ragelink
|
5872 |
|
|
afe42d0…
|
ragelink
|
5873 |
/** |
|
afe42d0…
|
ragelink
|
5874 |
* Helper method to abstract the "disabled" state of this object. |
|
afe42d0…
|
ragelink
|
5875 |
* |
|
afe42d0…
|
ragelink
|
5876 |
* @return {true} if the disabled option is true. |
|
afe42d0…
|
ragelink
|
5877 |
* @return {false} if the disabled option is false. |
|
afe42d0…
|
ragelink
|
5878 |
*/ |
|
afe42d0…
|
ragelink
|
5879 |
Select2.prototype.isDisabled = function () { |
|
afe42d0…
|
ragelink
|
5880 |
return this.options.get('disabled'); |
|
afe42d0…
|
ragelink
|
5881 |
}; |
|
afe42d0…
|
ragelink
|
5882 |
|
|
afe42d0…
|
ragelink
|
5883 |
Select2.prototype.isOpen = function () { |
|
afe42d0…
|
ragelink
|
5884 |
return this.$container.hasClass('select2-container--open'); |
|
afe42d0…
|
ragelink
|
5885 |
}; |
|
afe42d0…
|
ragelink
|
5886 |
|
|
afe42d0…
|
ragelink
|
5887 |
Select2.prototype.hasFocus = function () { |
|
afe42d0…
|
ragelink
|
5888 |
return this.$container.hasClass('select2-container--focus'); |
|
afe42d0…
|
ragelink
|
5889 |
}; |
|
afe42d0…
|
ragelink
|
5890 |
|
|
afe42d0…
|
ragelink
|
5891 |
Select2.prototype.focus = function (data) { |
|
afe42d0…
|
ragelink
|
5892 |
// No need to re-trigger focus events if we are already focused |
|
afe42d0…
|
ragelink
|
5893 |
if (this.hasFocus()) { |
|
afe42d0…
|
ragelink
|
5894 |
return; |
|
afe42d0…
|
ragelink
|
5895 |
} |
|
afe42d0…
|
ragelink
|
5896 |
|
|
afe42d0…
|
ragelink
|
5897 |
this.$container.addClass('select2-container--focus'); |
|
afe42d0…
|
ragelink
|
5898 |
this.trigger('focus', {}); |
|
afe42d0…
|
ragelink
|
5899 |
}; |
|
afe42d0…
|
ragelink
|
5900 |
|
|
afe42d0…
|
ragelink
|
5901 |
Select2.prototype.enable = function (args) { |
|
afe42d0…
|
ragelink
|
5902 |
if (this.options.get('debug') && window.console && console.warn) { |
|
afe42d0…
|
ragelink
|
5903 |
console.warn( |
|
afe42d0…
|
ragelink
|
5904 |
'Select2: The `select2("enable")` method has been deprecated and will' + |
|
afe42d0…
|
ragelink
|
5905 |
' be removed in later Select2 versions. Use $element.prop("disabled")' + |
|
afe42d0…
|
ragelink
|
5906 |
' instead.' |
|
afe42d0…
|
ragelink
|
5907 |
); |
|
afe42d0…
|
ragelink
|
5908 |
} |
|
afe42d0…
|
ragelink
|
5909 |
|
|
afe42d0…
|
ragelink
|
5910 |
if (args == null || args.length === 0) { |
|
afe42d0…
|
ragelink
|
5911 |
args = [true]; |
|
afe42d0…
|
ragelink
|
5912 |
} |
|
afe42d0…
|
ragelink
|
5913 |
|
|
afe42d0…
|
ragelink
|
5914 |
var disabled = !args[0]; |
|
afe42d0…
|
ragelink
|
5915 |
|
|
afe42d0…
|
ragelink
|
5916 |
this.$element.prop('disabled', disabled); |
|
afe42d0…
|
ragelink
|
5917 |
}; |
|
afe42d0…
|
ragelink
|
5918 |
|
|
afe42d0…
|
ragelink
|
5919 |
Select2.prototype.data = function () { |
|
afe42d0…
|
ragelink
|
5920 |
if (this.options.get('debug') && |
|
afe42d0…
|
ragelink
|
5921 |
arguments.length > 0 && window.console && console.warn) { |
|
afe42d0…
|
ragelink
|
5922 |
console.warn( |
|
afe42d0…
|
ragelink
|
5923 |
'Select2: Data can no longer be set using `select2("data")`. You ' + |
|
afe42d0…
|
ragelink
|
5924 |
'should consider setting the value instead using `$element.val()`.' |
|
afe42d0…
|
ragelink
|
5925 |
); |
|
afe42d0…
|
ragelink
|
5926 |
} |
|
afe42d0…
|
ragelink
|
5927 |
|
|
afe42d0…
|
ragelink
|
5928 |
var data = []; |
|
afe42d0…
|
ragelink
|
5929 |
|
|
afe42d0…
|
ragelink
|
5930 |
this.dataAdapter.current(function (currentData) { |
|
afe42d0…
|
ragelink
|
5931 |
data = currentData; |
|
afe42d0…
|
ragelink
|
5932 |
}); |
|
afe42d0…
|
ragelink
|
5933 |
|
|
afe42d0…
|
ragelink
|
5934 |
return data; |
|
afe42d0…
|
ragelink
|
5935 |
}; |
|
afe42d0…
|
ragelink
|
5936 |
|
|
afe42d0…
|
ragelink
|
5937 |
Select2.prototype.val = function (args) { |
|
afe42d0…
|
ragelink
|
5938 |
if (this.options.get('debug') && window.console && console.warn) { |
|
afe42d0…
|
ragelink
|
5939 |
console.warn( |
|
afe42d0…
|
ragelink
|
5940 |
'Select2: The `select2("val")` method has been deprecated and will be' + |
|
afe42d0…
|
ragelink
|
5941 |
' removed in later Select2 versions. Use $element.val() instead.' |
|
afe42d0…
|
ragelink
|
5942 |
); |
|
afe42d0…
|
ragelink
|
5943 |
} |
|
afe42d0…
|
ragelink
|
5944 |
|
|
afe42d0…
|
ragelink
|
5945 |
if (args == null || args.length === 0) { |
|
afe42d0…
|
ragelink
|
5946 |
return this.$element.val(); |
|
afe42d0…
|
ragelink
|
5947 |
} |
|
afe42d0…
|
ragelink
|
5948 |
|
|
afe42d0…
|
ragelink
|
5949 |
var newVal = args[0]; |
|
afe42d0…
|
ragelink
|
5950 |
|
|
afe42d0…
|
ragelink
|
5951 |
if ($.isArray(newVal)) { |
|
afe42d0…
|
ragelink
|
5952 |
newVal = $.map(newVal, function (obj) { |
|
afe42d0…
|
ragelink
|
5953 |
return obj.toString(); |
|
afe42d0…
|
ragelink
|
5954 |
}); |
|
afe42d0…
|
ragelink
|
5955 |
} |
|
afe42d0…
|
ragelink
|
5956 |
|
|
afe42d0…
|
ragelink
|
5957 |
this.$element.val(newVal).trigger('input').trigger('change'); |
|
afe42d0…
|
ragelink
|
5958 |
}; |
|
afe42d0…
|
ragelink
|
5959 |
|
|
afe42d0…
|
ragelink
|
5960 |
Select2.prototype.destroy = function () { |
|
afe42d0…
|
ragelink
|
5961 |
this.$container.remove(); |
|
afe42d0…
|
ragelink
|
5962 |
|
|
afe42d0…
|
ragelink
|
5963 |
if (this.$element[0].detachEvent) { |
|
afe42d0…
|
ragelink
|
5964 |
this.$element[0].detachEvent('onpropertychange', this._syncA); |
|
afe42d0…
|
ragelink
|
5965 |
} |
|
afe42d0…
|
ragelink
|
5966 |
|
|
afe42d0…
|
ragelink
|
5967 |
if (this._observer != null) { |
|
afe42d0…
|
ragelink
|
5968 |
this._observer.disconnect(); |
|
afe42d0…
|
ragelink
|
5969 |
this._observer = null; |
|
afe42d0…
|
ragelink
|
5970 |
} else if (this.$element[0].removeEventListener) { |
|
afe42d0…
|
ragelink
|
5971 |
this.$element[0] |
|
afe42d0…
|
ragelink
|
5972 |
.removeEventListener('DOMAttrModified', this._syncA, false); |
|
afe42d0…
|
ragelink
|
5973 |
this.$element[0] |
|
afe42d0…
|
ragelink
|
5974 |
.removeEventListener('DOMNodeInserted', this._syncS, false); |
|
afe42d0…
|
ragelink
|
5975 |
this.$element[0] |
|
afe42d0…
|
ragelink
|
5976 |
.removeEventListener('DOMNodeRemoved', this._syncS, false); |
|
afe42d0…
|
ragelink
|
5977 |
} |
|
afe42d0…
|
ragelink
|
5978 |
|
|
afe42d0…
|
ragelink
|
5979 |
this._syncA = null; |
|
afe42d0…
|
ragelink
|
5980 |
this._syncS = null; |
|
afe42d0…
|
ragelink
|
5981 |
|
|
afe42d0…
|
ragelink
|
5982 |
this.$element.off('.select2'); |
|
afe42d0…
|
ragelink
|
5983 |
this.$element.attr('tabindex', |
|
afe42d0…
|
ragelink
|
5984 |
Utils.GetData(this.$element[0], 'old-tabindex')); |
|
afe42d0…
|
ragelink
|
5985 |
|
|
afe42d0…
|
ragelink
|
5986 |
this.$element.removeClass('select2-hidden-accessible'); |
|
afe42d0…
|
ragelink
|
5987 |
this.$element.attr('aria-hidden', 'false'); |
|
afe42d0…
|
ragelink
|
5988 |
Utils.RemoveData(this.$element[0]); |
|
afe42d0…
|
ragelink
|
5989 |
this.$element.removeData('select2'); |
|
afe42d0…
|
ragelink
|
5990 |
|
|
afe42d0…
|
ragelink
|
5991 |
this.dataAdapter.destroy(); |
|
afe42d0…
|
ragelink
|
5992 |
this.selection.destroy(); |
|
afe42d0…
|
ragelink
|
5993 |
this.dropdown.destroy(); |
|
afe42d0…
|
ragelink
|
5994 |
this.results.destroy(); |
|
afe42d0…
|
ragelink
|
5995 |
|
|
afe42d0…
|
ragelink
|
5996 |
this.dataAdapter = null; |
|
afe42d0…
|
ragelink
|
5997 |
this.selection = null; |
|
afe42d0…
|
ragelink
|
5998 |
this.dropdown = null; |
|
afe42d0…
|
ragelink
|
5999 |
this.results = null; |
|
afe42d0…
|
ragelink
|
6000 |
}; |
|
afe42d0…
|
ragelink
|
6001 |
|
|
afe42d0…
|
ragelink
|
6002 |
Select2.prototype.render = function () { |
|
afe42d0…
|
ragelink
|
6003 |
var $container = $( |
|
afe42d0…
|
ragelink
|
6004 |
'<span class="select2 select2-container">' + |
|
afe42d0…
|
ragelink
|
6005 |
'<span class="selection"></span>' + |
|
afe42d0…
|
ragelink
|
6006 |
'<span class="dropdown-wrapper" aria-hidden="true"></span>' + |
|
afe42d0…
|
ragelink
|
6007 |
'</span>' |
|
afe42d0…
|
ragelink
|
6008 |
); |
|
afe42d0…
|
ragelink
|
6009 |
|
|
afe42d0…
|
ragelink
|
6010 |
$container.attr('dir', this.options.get('dir')); |
|
afe42d0…
|
ragelink
|
6011 |
|
|
afe42d0…
|
ragelink
|
6012 |
this.$container = $container; |
|
afe42d0…
|
ragelink
|
6013 |
|
|
afe42d0…
|
ragelink
|
6014 |
this.$container.addClass('select2-container--' + this.options.get('theme')); |
|
afe42d0…
|
ragelink
|
6015 |
|
|
afe42d0…
|
ragelink
|
6016 |
Utils.StoreData($container[0], 'element', this.$element); |
|
afe42d0…
|
ragelink
|
6017 |
|
|
afe42d0…
|
ragelink
|
6018 |
return $container; |
|
afe42d0…
|
ragelink
|
6019 |
}; |
|
afe42d0…
|
ragelink
|
6020 |
|
|
afe42d0…
|
ragelink
|
6021 |
return Select2; |
|
afe42d0…
|
ragelink
|
6022 |
}); |
|
afe42d0…
|
ragelink
|
6023 |
|
|
afe42d0…
|
ragelink
|
6024 |
S2.define('select2/compat/utils',[ |
|
afe42d0…
|
ragelink
|
6025 |
'jquery' |
|
afe42d0…
|
ragelink
|
6026 |
], function ($) { |
|
afe42d0…
|
ragelink
|
6027 |
function syncCssClasses ($dest, $src, adapter) { |
|
afe42d0…
|
ragelink
|
6028 |
var classes, replacements = [], adapted; |
|
afe42d0…
|
ragelink
|
6029 |
|
|
afe42d0…
|
ragelink
|
6030 |
classes = $.trim($dest.attr('class')); |
|
afe42d0…
|
ragelink
|
6031 |
|
|
afe42d0…
|
ragelink
|
6032 |
if (classes) { |
|
afe42d0…
|
ragelink
|
6033 |
classes = '' + classes; // for IE which returns object |
|
afe42d0…
|
ragelink
|
6034 |
|
|
afe42d0…
|
ragelink
|
6035 |
$(classes.split(/\s+/)).each(function () { |
|
afe42d0…
|
ragelink
|
6036 |
// Save all Select2 classes |
|
afe42d0…
|
ragelink
|
6037 |
if (this.indexOf('select2-') === 0) { |
|
afe42d0…
|
ragelink
|
6038 |
replacements.push(this); |
|
afe42d0…
|
ragelink
|
6039 |
} |
|
afe42d0…
|
ragelink
|
6040 |
}); |
|
afe42d0…
|
ragelink
|
6041 |
} |
|
afe42d0…
|
ragelink
|
6042 |
|
|
afe42d0…
|
ragelink
|
6043 |
classes = $.trim($src.attr('class')); |
|
afe42d0…
|
ragelink
|
6044 |
|
|
afe42d0…
|
ragelink
|
6045 |
if (classes) { |
|
afe42d0…
|
ragelink
|
6046 |
classes = '' + classes; // for IE which returns object |
|
afe42d0…
|
ragelink
|
6047 |
|
|
afe42d0…
|
ragelink
|
6048 |
$(classes.split(/\s+/)).each(function () { |
|
afe42d0…
|
ragelink
|
6049 |
// Only adapt non-Select2 classes |
|
afe42d0…
|
ragelink
|
6050 |
if (this.indexOf('select2-') !== 0) { |
|
afe42d0…
|
ragelink
|
6051 |
adapted = adapter(this); |
|
afe42d0…
|
ragelink
|
6052 |
|
|
afe42d0…
|
ragelink
|
6053 |
if (adapted != null) { |
|
afe42d0…
|
ragelink
|
6054 |
replacements.push(adapted); |
|
afe42d0…
|
ragelink
|
6055 |
} |
|
afe42d0…
|
ragelink
|
6056 |
} |
|
afe42d0…
|
ragelink
|
6057 |
}); |
|
afe42d0…
|
ragelink
|
6058 |
} |
|
afe42d0…
|
ragelink
|
6059 |
|
|
afe42d0…
|
ragelink
|
6060 |
$dest.attr('class', replacements.join(' ')); |
|
afe42d0…
|
ragelink
|
6061 |
} |
|
afe42d0…
|
ragelink
|
6062 |
|
|
afe42d0…
|
ragelink
|
6063 |
return { |
|
afe42d0…
|
ragelink
|
6064 |
syncCssClasses: syncCssClasses |
|
afe42d0…
|
ragelink
|
6065 |
}; |
|
afe42d0…
|
ragelink
|
6066 |
}); |
|
afe42d0…
|
ragelink
|
6067 |
|
|
afe42d0…
|
ragelink
|
6068 |
S2.define('select2/compat/containerCss',[ |
|
afe42d0…
|
ragelink
|
6069 |
'jquery', |
|
afe42d0…
|
ragelink
|
6070 |
'./utils' |
|
afe42d0…
|
ragelink
|
6071 |
], function ($, CompatUtils) { |
|
afe42d0…
|
ragelink
|
6072 |
// No-op CSS adapter that discards all classes by default |
|
afe42d0…
|
ragelink
|
6073 |
function _containerAdapter (clazz) { |
|
afe42d0…
|
ragelink
|
6074 |
return null; |
|
afe42d0…
|
ragelink
|
6075 |
} |
|
afe42d0…
|
ragelink
|
6076 |
|
|
afe42d0…
|
ragelink
|
6077 |
function ContainerCSS () { } |
|
afe42d0…
|
ragelink
|
6078 |
|
|
afe42d0…
|
ragelink
|
6079 |
ContainerCSS.prototype.render = function (decorated) { |
|
afe42d0…
|
ragelink
|
6080 |
var $container = decorated.call(this); |
|
afe42d0…
|
ragelink
|
6081 |
|
|
afe42d0…
|
ragelink
|
6082 |
var containerCssClass = this.options.get('containerCssClass') || ''; |
|
afe42d0…
|
ragelink
|
6083 |
|
|
afe42d0…
|
ragelink
|
6084 |
if ($.isFunction(containerCssClass)) { |
|
afe42d0…
|
ragelink
|
6085 |
containerCssClass = containerCssClass(this.$element); |
|
afe42d0…
|
ragelink
|
6086 |
} |
|
afe42d0…
|
ragelink
|
6087 |
|
|
afe42d0…
|
ragelink
|
6088 |
var containerCssAdapter = this.options.get('adaptContainerCssClass'); |
|
afe42d0…
|
ragelink
|
6089 |
containerCssAdapter = containerCssAdapter || _containerAdapter; |
|
afe42d0…
|
ragelink
|
6090 |
|
|
afe42d0…
|
ragelink
|
6091 |
if (containerCssClass.indexOf(':all:') !== -1) { |
|
afe42d0…
|
ragelink
|
6092 |
containerCssClass = containerCssClass.replace(':all:', ''); |
|
afe42d0…
|
ragelink
|
6093 |
|
|
afe42d0…
|
ragelink
|
6094 |
var _cssAdapter = containerCssAdapter; |
|
afe42d0…
|
ragelink
|
6095 |
|
|
afe42d0…
|
ragelink
|
6096 |
containerCssAdapter = function (clazz) { |
|
afe42d0…
|
ragelink
|
6097 |
var adapted = _cssAdapter(clazz); |
|
afe42d0…
|
ragelink
|
6098 |
|
|
afe42d0…
|
ragelink
|
6099 |
if (adapted != null) { |
|
afe42d0…
|
ragelink
|
6100 |
// Append the old one along with the adapted one |
|
afe42d0…
|
ragelink
|
6101 |
return adapted + ' ' + clazz; |
|
afe42d0…
|
ragelink
|
6102 |
} |
|
afe42d0…
|
ragelink
|
6103 |
|
|
afe42d0…
|
ragelink
|
6104 |
return clazz; |
|
afe42d0…
|
ragelink
|
6105 |
}; |
|
afe42d0…
|
ragelink
|
6106 |
} |
|
afe42d0…
|
ragelink
|
6107 |
|
|
afe42d0…
|
ragelink
|
6108 |
var containerCss = this.options.get('containerCss') || {}; |
|
afe42d0…
|
ragelink
|
6109 |
|
|
afe42d0…
|
ragelink
|
6110 |
if ($.isFunction(containerCss)) { |
|
afe42d0…
|
ragelink
|
6111 |
containerCss = containerCss(this.$element); |
|
afe42d0…
|
ragelink
|
6112 |
} |
|
afe42d0…
|
ragelink
|
6113 |
|
|
afe42d0…
|
ragelink
|
6114 |
CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter); |
|
afe42d0…
|
ragelink
|
6115 |
|
|
afe42d0…
|
ragelink
|
6116 |
$container.css(containerCss); |
|
afe42d0…
|
ragelink
|
6117 |
$container.addClass(containerCssClass); |
|
afe42d0…
|
ragelink
|
6118 |
|
|
afe42d0…
|
ragelink
|
6119 |
return $container; |
|
afe42d0…
|
ragelink
|
6120 |
}; |
|
afe42d0…
|
ragelink
|
6121 |
|
|
afe42d0…
|
ragelink
|
6122 |
return ContainerCSS; |
|
afe42d0…
|
ragelink
|
6123 |
}); |
|
afe42d0…
|
ragelink
|
6124 |
|
|
afe42d0…
|
ragelink
|
6125 |
S2.define('select2/compat/dropdownCss',[ |
|
afe42d0…
|
ragelink
|
6126 |
'jquery', |
|
afe42d0…
|
ragelink
|
6127 |
'./utils' |
|
afe42d0…
|
ragelink
|
6128 |
], function ($, CompatUtils) { |
|
afe42d0…
|
ragelink
|
6129 |
// No-op CSS adapter that discards all classes by default |
|
afe42d0…
|
ragelink
|
6130 |
function _dropdownAdapter (clazz) { |
|
afe42d0…
|
ragelink
|
6131 |
return null; |
|
afe42d0…
|
ragelink
|
6132 |
} |
|
afe42d0…
|
ragelink
|
6133 |
|
|
afe42d0…
|
ragelink
|
6134 |
function DropdownCSS () { } |
|
afe42d0…
|
ragelink
|
6135 |
|
|
afe42d0…
|
ragelink
|
6136 |
DropdownCSS.prototype.render = function (decorated) { |
|
afe42d0…
|
ragelink
|
6137 |
var $dropdown = decorated.call(this); |
|
afe42d0…
|
ragelink
|
6138 |
|
|
afe42d0…
|
ragelink
|
6139 |
var dropdownCssClass = this.options.get('dropdownCssClass') || ''; |
|
afe42d0…
|
ragelink
|
6140 |
|
|
afe42d0…
|
ragelink
|
6141 |
if ($.isFunction(dropdownCssClass)) { |
|
afe42d0…
|
ragelink
|
6142 |
dropdownCssClass = dropdownCssClass(this.$element); |
|
afe42d0…
|
ragelink
|
6143 |
} |
|
afe42d0…
|
ragelink
|
6144 |
|
|
afe42d0…
|
ragelink
|
6145 |
var dropdownCssAdapter = this.options.get('adaptDropdownCssClass'); |
|
afe42d0…
|
ragelink
|
6146 |
dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter; |
|
afe42d0…
|
ragelink
|
6147 |
|
|
afe42d0…
|
ragelink
|
6148 |
if (dropdownCssClass.indexOf(':all:') !== -1) { |
|
afe42d0…
|
ragelink
|
6149 |
dropdownCssClass = dropdownCssClass.replace(':all:', ''); |
|
afe42d0…
|
ragelink
|
6150 |
|
|
afe42d0…
|
ragelink
|
6151 |
var _cssAdapter = dropdownCssAdapter; |
|
afe42d0…
|
ragelink
|
6152 |
|
|
afe42d0…
|
ragelink
|
6153 |
dropdownCssAdapter = function (clazz) { |
|
afe42d0…
|
ragelink
|
6154 |
var adapted = _cssAdapter(clazz); |
|
afe42d0…
|
ragelink
|
6155 |
|
|
afe42d0…
|
ragelink
|
6156 |
if (adapted != null) { |
|
afe42d0…
|
ragelink
|
6157 |
// Append the old one along with the adapted one |
|
afe42d0…
|
ragelink
|
6158 |
return adapted + ' ' + clazz; |
|
afe42d0…
|
ragelink
|
6159 |
} |
|
afe42d0…
|
ragelink
|
6160 |
|
|
afe42d0…
|
ragelink
|
6161 |
return clazz; |
|
afe42d0…
|
ragelink
|
6162 |
}; |
|
afe42d0…
|
ragelink
|
6163 |
} |
|
afe42d0…
|
ragelink
|
6164 |
|
|
afe42d0…
|
ragelink
|
6165 |
var dropdownCss = this.options.get('dropdownCss') || {}; |
|
afe42d0…
|
ragelink
|
6166 |
|
|
afe42d0…
|
ragelink
|
6167 |
if ($.isFunction(dropdownCss)) { |
|
afe42d0…
|
ragelink
|
6168 |
dropdownCss = dropdownCss(this.$element); |
|
afe42d0…
|
ragelink
|
6169 |
} |
|
afe42d0…
|
ragelink
|
6170 |
|
|
afe42d0…
|
ragelink
|
6171 |
CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter); |
|
afe42d0…
|
ragelink
|
6172 |
|
|
afe42d0…
|
ragelink
|
6173 |
$dropdown.css(dropdownCss); |
|
afe42d0…
|
ragelink
|
6174 |
$dropdown.addClass(dropdownCssClass); |
|
afe42d0…
|
ragelink
|
6175 |
|
|
afe42d0…
|
ragelink
|
6176 |
return $dropdown; |
|
afe42d0…
|
ragelink
|
6177 |
}; |
|
afe42d0…
|
ragelink
|
6178 |
|
|
afe42d0…
|
ragelink
|
6179 |
return DropdownCSS; |
|
afe42d0…
|
ragelink
|
6180 |
}); |
|
afe42d0…
|
ragelink
|
6181 |
|
|
afe42d0…
|
ragelink
|
6182 |
S2.define('select2/compat/initSelection',[ |
|
afe42d0…
|
ragelink
|
6183 |
'jquery' |
|
afe42d0…
|
ragelink
|
6184 |
], function ($) { |
|
afe42d0…
|
ragelink
|
6185 |
function InitSelection (decorated, $element, options) { |
|
afe42d0…
|
ragelink
|
6186 |
if (options.get('debug') && window.console && console.warn) { |
|
afe42d0…
|
ragelink
|
6187 |
console.warn( |
|
afe42d0…
|
ragelink
|
6188 |
'Select2: The `initSelection` option has been deprecated in favor' + |
|
afe42d0…
|
ragelink
|
6189 |
' of a custom data adapter that overrides the `current` method. ' + |
|
afe42d0…
|
ragelink
|
6190 |
'This method is now called multiple times instead of a single ' + |
|
afe42d0…
|
ragelink
|
6191 |
'time when the instance is initialized. Support will be removed ' + |
|
afe42d0…
|
ragelink
|
6192 |
'for the `initSelection` option in future versions of Select2' |
|
afe42d0…
|
ragelink
|
6193 |
); |
|
afe42d0…
|
ragelink
|
6194 |
} |
|
afe42d0…
|
ragelink
|
6195 |
|
|
afe42d0…
|
ragelink
|
6196 |
this.initSelection = options.get('initSelection'); |
|
afe42d0…
|
ragelink
|
6197 |
this._isInitialized = false; |
|
afe42d0…
|
ragelink
|
6198 |
|
|
afe42d0…
|
ragelink
|
6199 |
decorated.call(this, $element, options); |
|
afe42d0…
|
ragelink
|
6200 |
} |
|
afe42d0…
|
ragelink
|
6201 |
|
|
afe42d0…
|
ragelink
|
6202 |
InitSelection.prototype.current = function (decorated, callback) { |
|
afe42d0…
|
ragelink
|
6203 |
var self = this; |
|
afe42d0…
|
ragelink
|
6204 |
|
|
afe42d0…
|
ragelink
|
6205 |
if (this._isInitialized) { |
|
afe42d0…
|
ragelink
|
6206 |
decorated.call(this, callback); |
|
afe42d0…
|
ragelink
|
6207 |
|
|
afe42d0…
|
ragelink
|
6208 |
return; |
|
afe42d0…
|
ragelink
|
6209 |
} |
|
afe42d0…
|
ragelink
|
6210 |
|
|
afe42d0…
|
ragelink
|
6211 |
this.initSelection.call(null, this.$element, function (data) { |
|
afe42d0…
|
ragelink
|
6212 |
self._isInitialized = true; |
|
afe42d0…
|
ragelink
|
6213 |
|
|
afe42d0…
|
ragelink
|
6214 |
if (!$.isArray(data)) { |
|
afe42d0…
|
ragelink
|
6215 |
data = [data]; |
|
afe42d0…
|
ragelink
|
6216 |
} |
|
afe42d0…
|
ragelink
|
6217 |
|
|
afe42d0…
|
ragelink
|
6218 |
callback(data); |
|
afe42d0…
|
ragelink
|
6219 |
}); |
|
afe42d0…
|
ragelink
|
6220 |
}; |
|
afe42d0…
|
ragelink
|
6221 |
|
|
afe42d0…
|
ragelink
|
6222 |
return InitSelection; |
|
afe42d0…
|
ragelink
|
6223 |
}); |
|
afe42d0…
|
ragelink
|
6224 |
|
|
afe42d0…
|
ragelink
|
6225 |
S2.define('select2/compat/inputData',[ |
|
afe42d0…
|
ragelink
|
6226 |
'jquery', |
|
afe42d0…
|
ragelink
|
6227 |
'../utils' |
|
afe42d0…
|
ragelink
|
6228 |
], function ($, Utils) { |
|
afe42d0…
|
ragelink
|
6229 |
function InputData (decorated, $element, options) { |
|
afe42d0…
|
ragelink
|
6230 |
this._currentData = []; |
|
afe42d0…
|
ragelink
|
6231 |
this._valueSeparator = options.get('valueSeparator') || ','; |
|
afe42d0…
|
ragelink
|
6232 |
|
|
afe42d0…
|
ragelink
|
6233 |
if ($element.prop('type') === 'hidden') { |
|
afe42d0…
|
ragelink
|
6234 |
if (options.get('debug') && console && console.warn) { |
|
afe42d0…
|
ragelink
|
6235 |
console.warn( |
|
afe42d0…
|
ragelink
|
6236 |
'Select2: Using a hidden input with Select2 is no longer ' + |
|
afe42d0…
|
ragelink
|
6237 |
'supported and may stop working in the future. It is recommended ' + |
|
afe42d0…
|
ragelink
|
6238 |
'to use a `<select>` element instead.' |
|
afe42d0…
|
ragelink
|
6239 |
); |
|
afe42d0…
|
ragelink
|
6240 |
} |
|
afe42d0…
|
ragelink
|
6241 |
} |
|
afe42d0…
|
ragelink
|
6242 |
|
|
afe42d0…
|
ragelink
|
6243 |
decorated.call(this, $element, options); |
|
afe42d0…
|
ragelink
|
6244 |
} |
|
afe42d0…
|
ragelink
|
6245 |
|
|
afe42d0…
|
ragelink
|
6246 |
InputData.prototype.current = function (_, callback) { |
|
afe42d0…
|
ragelink
|
6247 |
function getSelected (data, selectedIds) { |
|
afe42d0…
|
ragelink
|
6248 |
var selected = []; |
|
afe42d0…
|
ragelink
|
6249 |
|
|
afe42d0…
|
ragelink
|
6250 |
if (data.selected || $.inArray(data.id, selectedIds) !== -1) { |
|
afe42d0…
|
ragelink
|
6251 |
data.selected = true; |
|
afe42d0…
|
ragelink
|
6252 |
selected.push(data); |
|
afe42d0…
|
ragelink
|
6253 |
} else { |
|
afe42d0…
|
ragelink
|
6254 |
data.selected = false; |
|
afe42d0…
|
ragelink
|
6255 |
} |
|
afe42d0…
|
ragelink
|
6256 |
|
|
afe42d0…
|
ragelink
|
6257 |
if (data.children) { |
|
afe42d0…
|
ragelink
|
6258 |
selected.push.apply(selected, getSelected(data.children, selectedIds)); |
|
afe42d0…
|
ragelink
|
6259 |
} |
|
afe42d0…
|
ragelink
|
6260 |
|
|
afe42d0…
|
ragelink
|
6261 |
return selected; |
|
afe42d0…
|
ragelink
|
6262 |
} |
|
afe42d0…
|
ragelink
|
6263 |
|
|
afe42d0…
|
ragelink
|
6264 |
var selected = []; |
|
afe42d0…
|
ragelink
|
6265 |
|
|
afe42d0…
|
ragelink
|
6266 |
for (var d = 0; d < this._currentData.length; d++) { |
|
afe42d0…
|
ragelink
|
6267 |
var data = this._currentData[d]; |
|
afe42d0…
|
ragelink
|
6268 |
|
|
afe42d0…
|
ragelink
|
6269 |
selected.push.apply( |
|
afe42d0…
|
ragelink
|
6270 |
selected, |
|
afe42d0…
|
ragelink
|
6271 |
getSelected( |
|
afe42d0…
|
ragelink
|
6272 |
data, |
|
afe42d0…
|
ragelink
|
6273 |
this.$element.val().split( |
|
afe42d0…
|
ragelink
|
6274 |
this._valueSeparator |
|
afe42d0…
|
ragelink
|
6275 |
) |
|
afe42d0…
|
ragelink
|
6276 |
) |
|
afe42d0…
|
ragelink
|
6277 |
); |
|
afe42d0…
|
ragelink
|
6278 |
} |
|
afe42d0…
|
ragelink
|
6279 |
|
|
afe42d0…
|
ragelink
|
6280 |
callback(selected); |
|
afe42d0…
|
ragelink
|
6281 |
}; |
|
afe42d0…
|
ragelink
|
6282 |
|
|
afe42d0…
|
ragelink
|
6283 |
InputData.prototype.select = function (_, data) { |
|
afe42d0…
|
ragelink
|
6284 |
if (!this.options.get('multiple')) { |
|
afe42d0…
|
ragelink
|
6285 |
this.current(function (allData) { |
|
afe42d0…
|
ragelink
|
6286 |
$.map(allData, function (data) { |
|
afe42d0…
|
ragelink
|
6287 |
data.selected = false; |
|
afe42d0…
|
ragelink
|
6288 |
}); |
|
afe42d0…
|
ragelink
|
6289 |
}); |
|
afe42d0…
|
ragelink
|
6290 |
|
|
afe42d0…
|
ragelink
|
6291 |
this.$element.val(data.id); |
|
afe42d0…
|
ragelink
|
6292 |
this.$element.trigger('input').trigger('change'); |
|
afe42d0…
|
ragelink
|
6293 |
} else { |
|
afe42d0…
|
ragelink
|
6294 |
var value = this.$element.val(); |
|
afe42d0…
|
ragelink
|
6295 |
value += this._valueSeparator + data.id; |
|
afe42d0…
|
ragelink
|
6296 |
|
|
afe42d0…
|
ragelink
|
6297 |
this.$element.val(value); |
|
afe42d0…
|
ragelink
|
6298 |
this.$element.trigger('input').trigger('change'); |
|
afe42d0…
|
ragelink
|
6299 |
} |
|
afe42d0…
|
ragelink
|
6300 |
}; |
|
afe42d0…
|
ragelink
|
6301 |
|
|
afe42d0…
|
ragelink
|
6302 |
InputData.prototype.unselect = function (_, data) { |
|
afe42d0…
|
ragelink
|
6303 |
var self = this; |
|
afe42d0…
|
ragelink
|
6304 |
|
|
afe42d0…
|
ragelink
|
6305 |
data.selected = false; |
|
afe42d0…
|
ragelink
|
6306 |
|
|
afe42d0…
|
ragelink
|
6307 |
this.current(function (allData) { |
|
afe42d0…
|
ragelink
|
6308 |
var values = []; |
|
afe42d0…
|
ragelink
|
6309 |
|
|
afe42d0…
|
ragelink
|
6310 |
for (var d = 0; d < allData.length; d++) { |
|
afe42d0…
|
ragelink
|
6311 |
var item = allData[d]; |
|
afe42d0…
|
ragelink
|
6312 |
|
|
afe42d0…
|
ragelink
|
6313 |
if (data.id == item.id) { |
|
afe42d0…
|
ragelink
|
6314 |
continue; |
|
afe42d0…
|
ragelink
|
6315 |
} |
|
afe42d0…
|
ragelink
|
6316 |
|
|
afe42d0…
|
ragelink
|
6317 |
values.push(item.id); |
|
afe42d0…
|
ragelink
|
6318 |
} |
|
afe42d0…
|
ragelink
|
6319 |
|
|
afe42d0…
|
ragelink
|
6320 |
self.$element.val(values.join(self._valueSeparator)); |
|
afe42d0…
|
ragelink
|
6321 |
self.$element.trigger('input').trigger('change'); |
|
afe42d0…
|
ragelink
|
6322 |
}); |
|
afe42d0…
|
ragelink
|
6323 |
}; |
|
afe42d0…
|
ragelink
|
6324 |
|
|
afe42d0…
|
ragelink
|
6325 |
InputData.prototype.query = function (_, params, callback) { |
|
afe42d0…
|
ragelink
|
6326 |
var results = []; |
|
afe42d0…
|
ragelink
|
6327 |
|
|
afe42d0…
|
ragelink
|
6328 |
for (var d = 0; d < this._currentData.length; d++) { |
|
afe42d0…
|
ragelink
|
6329 |
var data = this._currentData[d]; |
|
afe42d0…
|
ragelink
|
6330 |
|
|
afe42d0…
|
ragelink
|
6331 |
var matches = this.matches(params, data); |
|
afe42d0…
|
ragelink
|
6332 |
|
|
afe42d0…
|
ragelink
|
6333 |
if (matches !== null) { |
|
afe42d0…
|
ragelink
|
6334 |
results.push(matches); |
|
afe42d0…
|
ragelink
|
6335 |
} |
|
afe42d0…
|
ragelink
|
6336 |
} |
|
afe42d0…
|
ragelink
|
6337 |
|
|
afe42d0…
|
ragelink
|
6338 |
callback({ |
|
afe42d0…
|
ragelink
|
6339 |
results: results |
|
afe42d0…
|
ragelink
|
6340 |
}); |
|
afe42d0…
|
ragelink
|
6341 |
}; |
|
afe42d0…
|
ragelink
|
6342 |
|
|
afe42d0…
|
ragelink
|
6343 |
InputData.prototype.addOptions = function (_, $options) { |
|
afe42d0…
|
ragelink
|
6344 |
var options = $.map($options, function ($option) { |
|
afe42d0…
|
ragelink
|
6345 |
return Utils.GetData($option[0], 'data'); |
|
afe42d0…
|
ragelink
|
6346 |
}); |
|
afe42d0…
|
ragelink
|
6347 |
|
|
afe42d0…
|
ragelink
|
6348 |
this._currentData.push.apply(this._currentData, options); |
|
afe42d0…
|
ragelink
|
6349 |
}; |
|
afe42d0…
|
ragelink
|
6350 |
|
|
afe42d0…
|
ragelink
|
6351 |
return InputData; |
|
afe42d0…
|
ragelink
|
6352 |
}); |
|
afe42d0…
|
ragelink
|
6353 |
|
|
afe42d0…
|
ragelink
|
6354 |
S2.define('select2/compat/matcher',[ |
|
afe42d0…
|
ragelink
|
6355 |
'jquery' |
|
afe42d0…
|
ragelink
|
6356 |
], function ($) { |
|
afe42d0…
|
ragelink
|
6357 |
function oldMatcher (matcher) { |
|
afe42d0…
|
ragelink
|
6358 |
function wrappedMatcher (params, data) { |
|
afe42d0…
|
ragelink
|
6359 |
var match = $.extend(true, {}, data); |
|
afe42d0…
|
ragelink
|
6360 |
|
|
afe42d0…
|
ragelink
|
6361 |
if (params.term == null || $.trim(params.term) === '') { |
|
afe42d0…
|
ragelink
|
6362 |
return match; |
|
afe42d0…
|
ragelink
|
6363 |
} |
|
afe42d0…
|
ragelink
|
6364 |
|
|
afe42d0…
|
ragelink
|
6365 |
if (data.children) { |
|
afe42d0…
|
ragelink
|
6366 |
for (var c = data.children.length - 1; c >= 0; c--) { |
|
afe42d0…
|
ragelink
|
6367 |
var child = data.children[c]; |
|
afe42d0…
|
ragelink
|
6368 |
|
|
afe42d0…
|
ragelink
|
6369 |
// Check if the child object matches |
|
afe42d0…
|
ragelink
|
6370 |
// The old matcher returned a boolean true or false |
|
afe42d0…
|
ragelink
|
6371 |
var doesMatch = matcher(params.term, child.text, child); |
|
afe42d0…
|
ragelink
|
6372 |
|
|
afe42d0…
|
ragelink
|
6373 |
// If the child didn't match, pop it off |
|
afe42d0…
|
ragelink
|
6374 |
if (!doesMatch) { |
|
afe42d0…
|
ragelink
|
6375 |
match.children.splice(c, 1); |
|
afe42d0…
|
ragelink
|
6376 |
} |
|
afe42d0…
|
ragelink
|
6377 |
} |
|
afe42d0…
|
ragelink
|
6378 |
|
|
afe42d0…
|
ragelink
|
6379 |
if (match.children.length > 0) { |
|
afe42d0…
|
ragelink
|
6380 |
return match; |
|
afe42d0…
|
ragelink
|
6381 |
} |
|
afe42d0…
|
ragelink
|
6382 |
} |
|
afe42d0…
|
ragelink
|
6383 |
|
|
afe42d0…
|
ragelink
|
6384 |
if (matcher(params.term, data.text, data)) { |
|
afe42d0…
|
ragelink
|
6385 |
return match; |
|
afe42d0…
|
ragelink
|
6386 |
} |
|
afe42d0…
|
ragelink
|
6387 |
|
|
afe42d0…
|
ragelink
|
6388 |
return null; |
|
afe42d0…
|
ragelink
|
6389 |
} |
|
afe42d0…
|
ragelink
|
6390 |
|
|
afe42d0…
|
ragelink
|
6391 |
return wrappedMatcher; |
|
afe42d0…
|
ragelink
|
6392 |
} |
|
afe42d0…
|
ragelink
|
6393 |
|
|
afe42d0…
|
ragelink
|
6394 |
return oldMatcher; |
|
afe42d0…
|
ragelink
|
6395 |
}); |
|
afe42d0…
|
ragelink
|
6396 |
|
|
afe42d0…
|
ragelink
|
6397 |
S2.define('select2/compat/query',[ |
|
afe42d0…
|
ragelink
|
6398 |
|
|
afe42d0…
|
ragelink
|
6399 |
], function () { |
|
afe42d0…
|
ragelink
|
6400 |
function Query (decorated, $element, options) { |
|
afe42d0…
|
ragelink
|
6401 |
if (options.get('debug') && window.console && console.warn) { |
|
afe42d0…
|
ragelink
|
6402 |
console.warn( |
|
afe42d0…
|
ragelink
|
6403 |
'Select2: The `query` option has been deprecated in favor of a ' + |
|
afe42d0…
|
ragelink
|
6404 |
'custom data adapter that overrides the `query` method. Support ' + |
|
afe42d0…
|
ragelink
|
6405 |
'will be removed for the `query` option in future versions of ' + |
|
afe42d0…
|
ragelink
|
6406 |
'Select2.' |
|
afe42d0…
|
ragelink
|
6407 |
); |
|
afe42d0…
|
ragelink
|
6408 |
} |
|
afe42d0…
|
ragelink
|
6409 |
|
|
afe42d0…
|
ragelink
|
6410 |
decorated.call(this, $element, options); |
|
afe42d0…
|
ragelink
|
6411 |
} |
|
afe42d0…
|
ragelink
|
6412 |
|
|
afe42d0…
|
ragelink
|
6413 |
Query.prototype.query = function (_, params, callback) { |
|
afe42d0…
|
ragelink
|
6414 |
params.callback = callback; |
|
afe42d0…
|
ragelink
|
6415 |
|
|
afe42d0…
|
ragelink
|
6416 |
var query = this.options.get('query'); |
|
afe42d0…
|
ragelink
|
6417 |
|
|
afe42d0…
|
ragelink
|
6418 |
query.call(null, params); |
|
afe42d0…
|
ragelink
|
6419 |
}; |
|
afe42d0…
|
ragelink
|
6420 |
|
|
afe42d0…
|
ragelink
|
6421 |
return Query; |
|
afe42d0…
|
ragelink
|
6422 |
}); |
|
afe42d0…
|
ragelink
|
6423 |
|
|
afe42d0…
|
ragelink
|
6424 |
S2.define('select2/dropdown/attachContainer',[ |
|
afe42d0…
|
ragelink
|
6425 |
|
|
afe42d0…
|
ragelink
|
6426 |
], function () { |
|
afe42d0…
|
ragelink
|
6427 |
function AttachContainer (decorated, $element, options) { |
|
afe42d0…
|
ragelink
|
6428 |
decorated.call(this, $element, options); |
|
afe42d0…
|
ragelink
|
6429 |
} |
|
afe42d0…
|
ragelink
|
6430 |
|
|
afe42d0…
|
ragelink
|
6431 |
AttachContainer.prototype.position = |
|
afe42d0…
|
ragelink
|
6432 |
function (decorated, $dropdown, $container) { |
|
afe42d0…
|
ragelink
|
6433 |
var $dropdownContainer = $container.find('.dropdown-wrapper'); |
|
afe42d0…
|
ragelink
|
6434 |
$dropdownContainer.append($dropdown); |
|
afe42d0…
|
ragelink
|
6435 |
|
|
afe42d0…
|
ragelink
|
6436 |
$dropdown.addClass('select2-dropdown--below'); |
|
afe42d0…
|
ragelink
|
6437 |
$container.addClass('select2-container--below'); |
|
afe42d0…
|
ragelink
|
6438 |
}; |
|
afe42d0…
|
ragelink
|
6439 |
|
|
afe42d0…
|
ragelink
|
6440 |
return AttachContainer; |
|
afe42d0…
|
ragelink
|
6441 |
}); |
|
afe42d0…
|
ragelink
|
6442 |
|
|
afe42d0…
|
ragelink
|
6443 |
S2.define('select2/dropdown/stopPropagation',[ |
|
afe42d0…
|
ragelink
|
6444 |
|
|
afe42d0…
|
ragelink
|
6445 |
], function () { |
|
afe42d0…
|
ragelink
|
6446 |
function StopPropagation () { } |
|
afe42d0…
|
ragelink
|
6447 |
|
|
afe42d0…
|
ragelink
|
6448 |
StopPropagation.prototype.bind = function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
6449 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
6450 |
|
|
afe42d0…
|
ragelink
|
6451 |
var stoppedEvents = [ |
|
afe42d0…
|
ragelink
|
6452 |
'blur', |
|
afe42d0…
|
ragelink
|
6453 |
'change', |
|
afe42d0…
|
ragelink
|
6454 |
'click', |
|
afe42d0…
|
ragelink
|
6455 |
'dblclick', |
|
afe42d0…
|
ragelink
|
6456 |
'focus', |
|
afe42d0…
|
ragelink
|
6457 |
'focusin', |
|
afe42d0…
|
ragelink
|
6458 |
'focusout', |
|
afe42d0…
|
ragelink
|
6459 |
'input', |
|
afe42d0…
|
ragelink
|
6460 |
'keydown', |
|
afe42d0…
|
ragelink
|
6461 |
'keyup', |
|
afe42d0…
|
ragelink
|
6462 |
'keypress', |
|
afe42d0…
|
ragelink
|
6463 |
'mousedown', |
|
afe42d0…
|
ragelink
|
6464 |
'mouseenter', |
|
afe42d0…
|
ragelink
|
6465 |
'mouseleave', |
|
afe42d0…
|
ragelink
|
6466 |
'mousemove', |
|
afe42d0…
|
ragelink
|
6467 |
'mouseover', |
|
afe42d0…
|
ragelink
|
6468 |
'mouseup', |
|
afe42d0…
|
ragelink
|
6469 |
'search', |
|
afe42d0…
|
ragelink
|
6470 |
'touchend', |
|
afe42d0…
|
ragelink
|
6471 |
'touchstart' |
|
afe42d0…
|
ragelink
|
6472 |
]; |
|
afe42d0…
|
ragelink
|
6473 |
|
|
afe42d0…
|
ragelink
|
6474 |
this.$dropdown.on(stoppedEvents.join(' '), function (evt) { |
|
afe42d0…
|
ragelink
|
6475 |
evt.stopPropagation(); |
|
afe42d0…
|
ragelink
|
6476 |
}); |
|
afe42d0…
|
ragelink
|
6477 |
}; |
|
afe42d0…
|
ragelink
|
6478 |
|
|
afe42d0…
|
ragelink
|
6479 |
return StopPropagation; |
|
afe42d0…
|
ragelink
|
6480 |
}); |
|
afe42d0…
|
ragelink
|
6481 |
|
|
afe42d0…
|
ragelink
|
6482 |
S2.define('select2/selection/stopPropagation',[ |
|
afe42d0…
|
ragelink
|
6483 |
|
|
afe42d0…
|
ragelink
|
6484 |
], function () { |
|
afe42d0…
|
ragelink
|
6485 |
function StopPropagation () { } |
|
afe42d0…
|
ragelink
|
6486 |
|
|
afe42d0…
|
ragelink
|
6487 |
StopPropagation.prototype.bind = function (decorated, container, $container) { |
|
afe42d0…
|
ragelink
|
6488 |
decorated.call(this, container, $container); |
|
afe42d0…
|
ragelink
|
6489 |
|
|
afe42d0…
|
ragelink
|
6490 |
var stoppedEvents = [ |
|
afe42d0…
|
ragelink
|
6491 |
'blur', |
|
afe42d0…
|
ragelink
|
6492 |
'change', |
|
afe42d0…
|
ragelink
|
6493 |
'click', |
|
afe42d0…
|
ragelink
|
6494 |
'dblclick', |
|
afe42d0…
|
ragelink
|
6495 |
'focus', |
|
afe42d0…
|
ragelink
|
6496 |
'focusin', |
|
afe42d0…
|
ragelink
|
6497 |
'focusout', |
|
afe42d0…
|
ragelink
|
6498 |
'input', |
|
afe42d0…
|
ragelink
|
6499 |
'keydown', |
|
afe42d0…
|
ragelink
|
6500 |
'keyup', |
|
afe42d0…
|
ragelink
|
6501 |
'keypress', |
|
afe42d0…
|
ragelink
|
6502 |
'mousedown', |
|
afe42d0…
|
ragelink
|
6503 |
'mouseenter', |
|
afe42d0…
|
ragelink
|
6504 |
'mouseleave', |
|
afe42d0…
|
ragelink
|
6505 |
'mousemove', |
|
afe42d0…
|
ragelink
|
6506 |
'mouseover', |
|
afe42d0…
|
ragelink
|
6507 |
'mouseup', |
|
afe42d0…
|
ragelink
|
6508 |
'search', |
|
afe42d0…
|
ragelink
|
6509 |
'touchend', |
|
afe42d0…
|
ragelink
|
6510 |
'touchstart' |
|
afe42d0…
|
ragelink
|
6511 |
]; |
|
afe42d0…
|
ragelink
|
6512 |
|
|
afe42d0…
|
ragelink
|
6513 |
this.$selection.on(stoppedEvents.join(' '), function (evt) { |
|
afe42d0…
|
ragelink
|
6514 |
evt.stopPropagation(); |
|
afe42d0…
|
ragelink
|
6515 |
}); |
|
afe42d0…
|
ragelink
|
6516 |
}; |
|
afe42d0…
|
ragelink
|
6517 |
|
|
afe42d0…
|
ragelink
|
6518 |
return StopPropagation; |
|
afe42d0…
|
ragelink
|
6519 |
}); |
|
afe42d0…
|
ragelink
|
6520 |
|
|
afe42d0…
|
ragelink
|
6521 |
/*! |
|
afe42d0…
|
ragelink
|
6522 |
* jQuery Mousewheel 3.1.13 |
|
afe42d0…
|
ragelink
|
6523 |
* |
|
afe42d0…
|
ragelink
|
6524 |
* Copyright jQuery Foundation and other contributors |
|
afe42d0…
|
ragelink
|
6525 |
* Released under the MIT license |
|
afe42d0…
|
ragelink
|
6526 |
* http://jquery.org/license |
|
afe42d0…
|
ragelink
|
6527 |
*/ |
|
afe42d0…
|
ragelink
|
6528 |
|
|
afe42d0…
|
ragelink
|
6529 |
(function (factory) { |
|
afe42d0…
|
ragelink
|
6530 |
if ( typeof S2.define === 'function' && S2.define.amd ) { |
|
afe42d0…
|
ragelink
|
6531 |
// AMD. Register as an anonymous module. |
|
afe42d0…
|
ragelink
|
6532 |
S2.define('jquery-mousewheel',['jquery'], factory); |
|
afe42d0…
|
ragelink
|
6533 |
} else if (typeof exports === 'object') { |
|
afe42d0…
|
ragelink
|
6534 |
// Node/CommonJS style for Browserify |
|
afe42d0…
|
ragelink
|
6535 |
module.exports = factory; |
|
afe42d0…
|
ragelink
|
6536 |
} else { |
|
afe42d0…
|
ragelink
|
6537 |
// Browser globals |
|
afe42d0…
|
ragelink
|
6538 |
factory(jQuery); |
|
afe42d0…
|
ragelink
|
6539 |
} |
|
afe42d0…
|
ragelink
|
6540 |
}(function ($) { |
|
afe42d0…
|
ragelink
|
6541 |
|
|
afe42d0…
|
ragelink
|
6542 |
var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], |
|
afe42d0…
|
ragelink
|
6543 |
toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? |
|
afe42d0…
|
ragelink
|
6544 |
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], |
|
afe42d0…
|
ragelink
|
6545 |
slice = Array.prototype.slice, |
|
afe42d0…
|
ragelink
|
6546 |
nullLowestDeltaTimeout, lowestDelta; |
|
afe42d0…
|
ragelink
|
6547 |
|
|
afe42d0…
|
ragelink
|
6548 |
if ( $.event.fixHooks ) { |
|
afe42d0…
|
ragelink
|
6549 |
for ( var i = toFix.length; i; ) { |
|
afe42d0…
|
ragelink
|
6550 |
$.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; |
|
afe42d0…
|
ragelink
|
6551 |
} |
|
afe42d0…
|
ragelink
|
6552 |
} |
|
afe42d0…
|
ragelink
|
6553 |
|
|
afe42d0…
|
ragelink
|
6554 |
var special = $.event.special.mousewheel = { |
|
afe42d0…
|
ragelink
|
6555 |
version: '3.1.12', |
|
afe42d0…
|
ragelink
|
6556 |
|
|
afe42d0…
|
ragelink
|
6557 |
setup: function() { |
|
afe42d0…
|
ragelink
|
6558 |
if ( this.addEventListener ) { |
|
afe42d0…
|
ragelink
|
6559 |
for ( var i = toBind.length; i; ) { |
|
afe42d0…
|
ragelink
|
6560 |
this.addEventListener( toBind[--i], handler, false ); |
|
afe42d0…
|
ragelink
|
6561 |
} |
|
afe42d0…
|
ragelink
|
6562 |
} else { |
|
afe42d0…
|
ragelink
|
6563 |
this.onmousewheel = handler; |
|
afe42d0…
|
ragelink
|
6564 |
} |
|
afe42d0…
|
ragelink
|
6565 |
// Store the line height and page height for this particular element |
|
afe42d0…
|
ragelink
|
6566 |
$.data(this, 'mousewheel-line-height', special.getLineHeight(this)); |
|
afe42d0…
|
ragelink
|
6567 |
$.data(this, 'mousewheel-page-height', special.getPageHeight(this)); |
|
afe42d0…
|
ragelink
|
6568 |
}, |
|
afe42d0…
|
ragelink
|
6569 |
|
|
afe42d0…
|
ragelink
|
6570 |
teardown: function() { |
|
afe42d0…
|
ragelink
|
6571 |
if ( this.removeEventListener ) { |
|
afe42d0…
|
ragelink
|
6572 |
for ( var i = toBind.length; i; ) { |
|
afe42d0…
|
ragelink
|
6573 |
this.removeEventListener( toBind[--i], handler, false ); |
|
afe42d0…
|
ragelink
|
6574 |
} |
|
afe42d0…
|
ragelink
|
6575 |
} else { |
|
afe42d0…
|
ragelink
|
6576 |
this.onmousewheel = null; |
|
afe42d0…
|
ragelink
|
6577 |
} |
|
afe42d0…
|
ragelink
|
6578 |
// Clean up the data we added to the element |
|
afe42d0…
|
ragelink
|
6579 |
$.removeData(this, 'mousewheel-line-height'); |
|
afe42d0…
|
ragelink
|
6580 |
$.removeData(this, 'mousewheel-page-height'); |
|
afe42d0…
|
ragelink
|
6581 |
}, |
|
afe42d0…
|
ragelink
|
6582 |
|
|
afe42d0…
|
ragelink
|
6583 |
getLineHeight: function(elem) { |
|
afe42d0…
|
ragelink
|
6584 |
var $elem = $(elem), |
|
afe42d0…
|
ragelink
|
6585 |
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); |
|
afe42d0…
|
ragelink
|
6586 |
if (!$parent.length) { |
|
afe42d0…
|
ragelink
|
6587 |
$parent = $('body'); |
|
afe42d0…
|
ragelink
|
6588 |
} |
|
afe42d0…
|
ragelink
|
6589 |
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; |
|
afe42d0…
|
ragelink
|
6590 |
}, |
|
afe42d0…
|
ragelink
|
6591 |
|
|
afe42d0…
|
ragelink
|
6592 |
getPageHeight: function(elem) { |
|
afe42d0…
|
ragelink
|
6593 |
return $(elem).height(); |
|
afe42d0…
|
ragelink
|
6594 |
}, |
|
afe42d0…
|
ragelink
|
6595 |
|
|
afe42d0…
|
ragelink
|
6596 |
settings: { |
|
afe42d0…
|
ragelink
|
6597 |
adjustOldDeltas: true, // see shouldAdjustOldDeltas() below |
|
afe42d0…
|
ragelink
|
6598 |
normalizeOffset: true // calls getBoundingClientRect for each event |
|
afe42d0…
|
ragelink
|
6599 |
} |
|
afe42d0…
|
ragelink
|
6600 |
}; |
|
afe42d0…
|
ragelink
|
6601 |
|
|
afe42d0…
|
ragelink
|
6602 |
$.fn.extend({ |
|
afe42d0…
|
ragelink
|
6603 |
mousewheel: function(fn) { |
|
afe42d0…
|
ragelink
|
6604 |
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); |
|
afe42d0…
|
ragelink
|
6605 |
}, |
|
afe42d0…
|
ragelink
|
6606 |
|
|
afe42d0…
|
ragelink
|
6607 |
unmousewheel: function(fn) { |
|
afe42d0…
|
ragelink
|
6608 |
return this.unbind('mousewheel', fn); |
|
afe42d0…
|
ragelink
|
6609 |
} |
|
afe42d0…
|
ragelink
|
6610 |
}); |
|
afe42d0…
|
ragelink
|
6611 |
|
|
afe42d0…
|
ragelink
|
6612 |
|
|
afe42d0…
|
ragelink
|
6613 |
function handler(event) { |
|
afe42d0…
|
ragelink
|
6614 |
var orgEvent = event || window.event, |
|
afe42d0…
|
ragelink
|
6615 |
args = slice.call(arguments, 1), |
|
afe42d0…
|
ragelink
|
6616 |
delta = 0, |
|
afe42d0…
|
ragelink
|
6617 |
deltaX = 0, |
|
afe42d0…
|
ragelink
|
6618 |
deltaY = 0, |
|
afe42d0…
|
ragelink
|
6619 |
absDelta = 0, |
|
afe42d0…
|
ragelink
|
6620 |
offsetX = 0, |
|
afe42d0…
|
ragelink
|
6621 |
offsetY = 0; |
|
afe42d0…
|
ragelink
|
6622 |
event = $.event.fix(orgEvent); |
|
afe42d0…
|
ragelink
|
6623 |
event.type = 'mousewheel'; |
|
afe42d0…
|
ragelink
|
6624 |
|
|
afe42d0…
|
ragelink
|
6625 |
// Old school scrollwheel delta |
|
afe42d0…
|
ragelink
|
6626 |
if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; } |
|
afe42d0…
|
ragelink
|
6627 |
if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; } |
|
afe42d0…
|
ragelink
|
6628 |
if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; } |
|
afe42d0…
|
ragelink
|
6629 |
if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; } |
|
afe42d0…
|
ragelink
|
6630 |
|
|
afe42d0…
|
ragelink
|
6631 |
// Firefox < 17 horizontal scrolling related to DOMMouseScroll event |
|
afe42d0…
|
ragelink
|
6632 |
if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { |
|
afe42d0…
|
ragelink
|
6633 |
deltaX = deltaY * -1; |
|
afe42d0…
|
ragelink
|
6634 |
deltaY = 0; |
|
afe42d0…
|
ragelink
|
6635 |
} |
|
afe42d0…
|
ragelink
|
6636 |
|
|
afe42d0…
|
ragelink
|
6637 |
// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy |
|
afe42d0…
|
ragelink
|
6638 |
delta = deltaY === 0 ? deltaX : deltaY; |
|
afe42d0…
|
ragelink
|
6639 |
|
|
afe42d0…
|
ragelink
|
6640 |
// New school wheel delta (wheel event) |
|
afe42d0…
|
ragelink
|
6641 |
if ( 'deltaY' in orgEvent ) { |
|
afe42d0…
|
ragelink
|
6642 |
deltaY = orgEvent.deltaY * -1; |
|
afe42d0…
|
ragelink
|
6643 |
delta = deltaY; |
|
afe42d0…
|
ragelink
|
6644 |
} |
|
afe42d0…
|
ragelink
|
6645 |
if ( 'deltaX' in orgEvent ) { |
|
afe42d0…
|
ragelink
|
6646 |
deltaX = orgEvent.deltaX; |
|
afe42d0…
|
ragelink
|
6647 |
if ( deltaY === 0 ) { delta = deltaX * -1; } |
|
afe42d0…
|
ragelink
|
6648 |
} |
|
afe42d0…
|
ragelink
|
6649 |
|
|
afe42d0…
|
ragelink
|
6650 |
// No change actually happened, no reason to go any further |
|
afe42d0…
|
ragelink
|
6651 |
if ( deltaY === 0 && deltaX === 0 ) { return; } |
|
afe42d0…
|
ragelink
|
6652 |
|
|
afe42d0…
|
ragelink
|
6653 |
// Need to convert lines and pages to pixels if we aren't already in pixels |
|
afe42d0…
|
ragelink
|
6654 |
// There are three delta modes: |
|
afe42d0…
|
ragelink
|
6655 |
// * deltaMode 0 is by pixels, nothing to do |
|
afe42d0…
|
ragelink
|
6656 |
// * deltaMode 1 is by lines |
|
afe42d0…
|
ragelink
|
6657 |
// * deltaMode 2 is by pages |
|
afe42d0…
|
ragelink
|
6658 |
if ( orgEvent.deltaMode === 1 ) { |
|
afe42d0…
|
ragelink
|
6659 |
var lineHeight = $.data(this, 'mousewheel-line-height'); |
|
afe42d0…
|
ragelink
|
6660 |
delta *= lineHeight; |
|
afe42d0…
|
ragelink
|
6661 |
deltaY *= lineHeight; |
|
afe42d0…
|
ragelink
|
6662 |
deltaX *= lineHeight; |
|
afe42d0…
|
ragelink
|
6663 |
} else if ( orgEvent.deltaMode === 2 ) { |
|
afe42d0…
|
ragelink
|
6664 |
var pageHeight = $.data(this, 'mousewheel-page-height'); |
|
afe42d0…
|
ragelink
|
6665 |
delta *= pageHeight; |
|
afe42d0…
|
ragelink
|
6666 |
deltaY *= pageHeight; |
|
afe42d0…
|
ragelink
|
6667 |
deltaX *= pageHeight; |
|
afe42d0…
|
ragelink
|
6668 |
} |
|
afe42d0…
|
ragelink
|
6669 |
|
|
afe42d0…
|
ragelink
|
6670 |
// Store lowest absolute delta to normalize the delta values |
|
afe42d0…
|
ragelink
|
6671 |
absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) ); |
|
afe42d0…
|
ragelink
|
6672 |
|
|
afe42d0…
|
ragelink
|
6673 |
if ( !lowestDelta || absDelta < lowestDelta ) { |
|
afe42d0…
|
ragelink
|
6674 |
lowestDelta = absDelta; |
|
afe42d0…
|
ragelink
|
6675 |
|
|
afe42d0…
|
ragelink
|
6676 |
// Adjust older deltas if necessary |
|
afe42d0…
|
ragelink
|
6677 |
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { |
|
afe42d0…
|
ragelink
|
6678 |
lowestDelta /= 40; |
|
afe42d0…
|
ragelink
|
6679 |
} |
|
afe42d0…
|
ragelink
|
6680 |
} |
|
afe42d0…
|
ragelink
|
6681 |
|
|
afe42d0…
|
ragelink
|
6682 |
// Adjust older deltas if necessary |
|
afe42d0…
|
ragelink
|
6683 |
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { |
|
afe42d0…
|
ragelink
|
6684 |
// Divide all the things by 40! |
|
afe42d0…
|
ragelink
|
6685 |
delta /= 40; |
|
afe42d0…
|
ragelink
|
6686 |
deltaX /= 40; |
|
afe42d0…
|
ragelink
|
6687 |
deltaY /= 40; |
|
afe42d0…
|
ragelink
|
6688 |
} |
|
afe42d0…
|
ragelink
|
6689 |
|
|
afe42d0…
|
ragelink
|
6690 |
// Get a whole, normalized value for the deltas |
|
afe42d0…
|
ragelink
|
6691 |
delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta); |
|
afe42d0…
|
ragelink
|
6692 |
deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta); |
|
afe42d0…
|
ragelink
|
6693 |
deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta); |
|
afe42d0…
|
ragelink
|
6694 |
|
|
afe42d0…
|
ragelink
|
6695 |
// Normalise offsetX and offsetY properties |
|
afe42d0…
|
ragelink
|
6696 |
if ( special.settings.normalizeOffset && this.getBoundingClientRect ) { |
|
afe42d0…
|
ragelink
|
6697 |
var boundingRect = this.getBoundingClientRect(); |
|
afe42d0…
|
ragelink
|
6698 |
offsetX = event.clientX - boundingRect.left; |
|
afe42d0…
|
ragelink
|
6699 |
offsetY = event.clientY - boundingRect.top; |
|
afe42d0…
|
ragelink
|
6700 |
} |
|
afe42d0…
|
ragelink
|
6701 |
|
|
afe42d0…
|
ragelink
|
6702 |
// Add information to the event object |
|
afe42d0…
|
ragelink
|
6703 |
event.deltaX = deltaX; |
|
afe42d0…
|
ragelink
|
6704 |
event.deltaY = deltaY; |
|
afe42d0…
|
ragelink
|
6705 |
event.deltaFactor = lowestDelta; |
|
afe42d0…
|
ragelink
|
6706 |
event.offsetX = offsetX; |
|
afe42d0…
|
ragelink
|
6707 |
event.offsetY = offsetY; |
|
afe42d0…
|
ragelink
|
6708 |
// Go ahead and set deltaMode to 0 since we converted to pixels |
|
afe42d0…
|
ragelink
|
6709 |
// Although this is a little odd since we overwrite the deltaX/Y |
|
afe42d0…
|
ragelink
|
6710 |
// properties with normalized deltas. |
|
afe42d0…
|
ragelink
|
6711 |
event.deltaMode = 0; |
|
afe42d0…
|
ragelink
|
6712 |
|
|
afe42d0…
|
ragelink
|
6713 |
// Add event and delta to the front of the arguments |
|
afe42d0…
|
ragelink
|
6714 |
args.unshift(event, delta, deltaX, deltaY); |
|
afe42d0…
|
ragelink
|
6715 |
|
|
afe42d0…
|
ragelink
|
6716 |
// Clearout lowestDelta after sometime to better |
|
afe42d0…
|
ragelink
|
6717 |
// handle multiple device types that give different |
|
afe42d0…
|
ragelink
|
6718 |
// a different lowestDelta |
|
afe42d0…
|
ragelink
|
6719 |
// Ex: trackpad = 3 and mouse wheel = 120 |
|
afe42d0…
|
ragelink
|
6720 |
if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } |
|
afe42d0…
|
ragelink
|
6721 |
nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); |
|
afe42d0…
|
ragelink
|
6722 |
|
|
afe42d0…
|
ragelink
|
6723 |
return ($.event.dispatch || $.event.handle).apply(this, args); |
|
afe42d0…
|
ragelink
|
6724 |
} |
|
afe42d0…
|
ragelink
|
6725 |
|
|
afe42d0…
|
ragelink
|
6726 |
function nullLowestDelta() { |
|
afe42d0…
|
ragelink
|
6727 |
lowestDelta = null; |
|
afe42d0…
|
ragelink
|
6728 |
} |
|
afe42d0…
|
ragelink
|
6729 |
|
|
afe42d0…
|
ragelink
|
6730 |
function shouldAdjustOldDeltas(orgEvent, absDelta) { |
|
afe42d0…
|
ragelink
|
6731 |
// If this is an older event and the delta is divisable by 120, |
|
afe42d0…
|
ragelink
|
6732 |
// then we are assuming that the browser is treating this as an |
|
afe42d0…
|
ragelink
|
6733 |
// older mouse wheel event and that we should divide the deltas |
|
afe42d0…
|
ragelink
|
6734 |
// by 40 to try and get a more usable deltaFactor. |
|
afe42d0…
|
ragelink
|
6735 |
// Side note, this actually impacts the reported scroll distance |
|
afe42d0…
|
ragelink
|
6736 |
// in older browsers and can cause scrolling to be slower than native. |
|
afe42d0…
|
ragelink
|
6737 |
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false. |
|
afe42d0…
|
ragelink
|
6738 |
return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0; |
|
afe42d0…
|
ragelink
|
6739 |
} |
|
afe42d0…
|
ragelink
|
6740 |
|
|
afe42d0…
|
ragelink
|
6741 |
})); |
|
afe42d0…
|
ragelink
|
6742 |
|
|
afe42d0…
|
ragelink
|
6743 |
S2.define('jquery.select2',[ |
|
afe42d0…
|
ragelink
|
6744 |
'jquery', |
|
afe42d0…
|
ragelink
|
6745 |
'jquery-mousewheel', |
|
afe42d0…
|
ragelink
|
6746 |
|
|
afe42d0…
|
ragelink
|
6747 |
'./select2/core', |
|
afe42d0…
|
ragelink
|
6748 |
'./select2/defaults', |
|
afe42d0…
|
ragelink
|
6749 |
'./select2/utils' |
|
afe42d0…
|
ragelink
|
6750 |
], function ($, _, Select2, Defaults, Utils) { |
|
afe42d0…
|
ragelink
|
6751 |
if ($.fn.select2 == null) { |
|
afe42d0…
|
ragelink
|
6752 |
// All methods that should return the element |
|
afe42d0…
|
ragelink
|
6753 |
var thisMethods = ['open', 'close', 'destroy']; |
|
afe42d0…
|
ragelink
|
6754 |
|
|
afe42d0…
|
ragelink
|
6755 |
$.fn.select2 = function (options) { |
|
afe42d0…
|
ragelink
|
6756 |
options = options || {}; |
|
afe42d0…
|
ragelink
|
6757 |
|
|
afe42d0…
|
ragelink
|
6758 |
if (typeof options === 'object') { |
|
afe42d0…
|
ragelink
|
6759 |
this.each(function () { |
|
afe42d0…
|
ragelink
|
6760 |
var instanceOptions = $.extend(true, {}, options); |
|
afe42d0…
|
ragelink
|
6761 |
|
|
afe42d0…
|
ragelink
|
6762 |
var instance = new Select2($(this), instanceOptions); |
|
afe42d0…
|
ragelink
|
6763 |
}); |
|
afe42d0…
|
ragelink
|
6764 |
|
|
afe42d0…
|
ragelink
|
6765 |
return this; |
|
afe42d0…
|
ragelink
|
6766 |
} else if (typeof options === 'string') { |
|
afe42d0…
|
ragelink
|
6767 |
var ret; |
|
afe42d0…
|
ragelink
|
6768 |
var args = Array.prototype.slice.call(arguments, 1); |
|
afe42d0…
|
ragelink
|
6769 |
|
|
afe42d0…
|
ragelink
|
6770 |
this.each(function () { |
|
afe42d0…
|
ragelink
|
6771 |
var instance = Utils.GetData(this, 'select2'); |
|
afe42d0…
|
ragelink
|
6772 |
|
|
afe42d0…
|
ragelink
|
6773 |
if (instance == null && window.console && console.error) { |
|
afe42d0…
|
ragelink
|
6774 |
console.error( |
|
afe42d0…
|
ragelink
|
6775 |
'The select2(\'' + options + '\') method was called on an ' + |
|
afe42d0…
|
ragelink
|
6776 |
'element that is not using Select2.' |
|
afe42d0…
|
ragelink
|
6777 |
); |
|
afe42d0…
|
ragelink
|
6778 |
} |
|
afe42d0…
|
ragelink
|
6779 |
|
|
afe42d0…
|
ragelink
|
6780 |
ret = instance[options].apply(instance, args); |
|
afe42d0…
|
ragelink
|
6781 |
}); |
|
afe42d0…
|
ragelink
|
6782 |
|
|
afe42d0…
|
ragelink
|
6783 |
// Check if we should be returning `this` |
|
afe42d0…
|
ragelink
|
6784 |
if ($.inArray(options, thisMethods) > -1) { |
|
afe42d0…
|
ragelink
|
6785 |
return this; |
|
afe42d0…
|
ragelink
|
6786 |
} |
|
afe42d0…
|
ragelink
|
6787 |
|
|
afe42d0…
|
ragelink
|
6788 |
return ret; |
|
afe42d0…
|
ragelink
|
6789 |
} else { |
|
afe42d0…
|
ragelink
|
6790 |
throw new Error('Invalid arguments for Select2: ' + options); |
|
afe42d0…
|
ragelink
|
6791 |
} |
|
afe42d0…
|
ragelink
|
6792 |
}; |
|
afe42d0…
|
ragelink
|
6793 |
} |
|
afe42d0…
|
ragelink
|
6794 |
|
|
afe42d0…
|
ragelink
|
6795 |
if ($.fn.select2.defaults == null) { |
|
afe42d0…
|
ragelink
|
6796 |
$.fn.select2.defaults = Defaults; |
|
afe42d0…
|
ragelink
|
6797 |
} |
|
afe42d0…
|
ragelink
|
6798 |
|
|
afe42d0…
|
ragelink
|
6799 |
return Select2; |
|
afe42d0…
|
ragelink
|
6800 |
}); |
|
afe42d0…
|
ragelink
|
6801 |
|
|
afe42d0…
|
ragelink
|
6802 |
// Return the AMD loader configuration so it can be used outside of this file |
|
afe42d0…
|
ragelink
|
6803 |
return { |
|
afe42d0…
|
ragelink
|
6804 |
define: S2.define, |
|
afe42d0…
|
ragelink
|
6805 |
require: S2.require |
|
afe42d0…
|
ragelink
|
6806 |
}; |
|
afe42d0…
|
ragelink
|
6807 |
}()); |
|
afe42d0…
|
ragelink
|
6808 |
|
|
afe42d0…
|
ragelink
|
6809 |
// Autoload the jQuery bindings |
|
afe42d0…
|
ragelink
|
6810 |
// We know that all of the modules exist above this, so we're safe |
|
afe42d0…
|
ragelink
|
6811 |
var select2 = S2.require('jquery.select2'); |
|
afe42d0…
|
ragelink
|
6812 |
|
|
afe42d0…
|
ragelink
|
6813 |
// Hold the AMD module references on the jQuery function that was just loaded |
|
afe42d0…
|
ragelink
|
6814 |
// This allows Select2 to use the internal loader outside of this file, such |
|
afe42d0…
|
ragelink
|
6815 |
// as in the language files. |
|
afe42d0…
|
ragelink
|
6816 |
jQuery.fn.select2.amd = S2; |
|
afe42d0…
|
ragelink
|
6817 |
|
|
afe42d0…
|
ragelink
|
6818 |
// Return the Select2 instance for anyone who is importing it. |
|
afe42d0…
|
ragelink
|
6819 |
return select2; |
|
afe42d0…
|
ragelink
|
6820 |
})); |