|
@@ -1,5 +1,5 @@
|
|
/*!
|
|
/*!
|
|
- * Select2 4.0.3
|
|
|
|
|
|
+ * Select2 4.0.4
|
|
* https://select2.github.io
|
|
* https://select2.github.io
|
|
*
|
|
*
|
|
* Released under the MIT license
|
|
* Released under the MIT license
|
|
@@ -44,13 +44,11 @@
|
|
var S2;(function () { if (!S2 || !S2.requirejs) {
|
|
var S2;(function () { if (!S2 || !S2.requirejs) {
|
|
if (!S2) { S2 = {}; } else { require = S2; }
|
|
if (!S2) { S2 = {}; } else { require = S2; }
|
|
/**
|
|
/**
|
|
- * @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
|
|
|
|
- * Available via the MIT or new BSD license.
|
|
|
|
- * see: http://github.com/jrburke/almond for details
|
|
|
|
|
|
+ * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
|
|
|
|
+ * Released under MIT license, http://github.com/requirejs/almond/LICENSE
|
|
*/
|
|
*/
|
|
//Going sloppy to avoid 'use strict' string cost, but strict practices should
|
|
//Going sloppy to avoid 'use strict' string cost, but strict practices should
|
|
//be followed.
|
|
//be followed.
|
|
-/*jslint sloppy: true */
|
|
|
|
/*global setTimeout: false */
|
|
/*global setTimeout: false */
|
|
|
|
|
|
var requirejs, require, define;
|
|
var requirejs, require, define;
|
|
@@ -78,60 +76,58 @@ var requirejs, require, define;
|
|
*/
|
|
*/
|
|
function normalize(name, baseName) {
|
|
function normalize(name, baseName) {
|
|
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
|
|
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
|
|
- foundI, foundStarMap, starI, i, j, part,
|
|
|
|
|
|
+ foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
|
|
baseParts = baseName && baseName.split("/"),
|
|
baseParts = baseName && baseName.split("/"),
|
|
map = config.map,
|
|
map = config.map,
|
|
starMap = (map && map['*']) || {};
|
|
starMap = (map && map['*']) || {};
|
|
|
|
|
|
//Adjust any relative paths.
|
|
//Adjust any relative paths.
|
|
- if (name && name.charAt(0) === ".") {
|
|
|
|
- //If have a base name, try to normalize against it,
|
|
|
|
- //otherwise, assume it is a top-level require that will
|
|
|
|
- //be relative to baseUrl in the end.
|
|
|
|
- if (baseName) {
|
|
|
|
- name = name.split('/');
|
|
|
|
- lastIndex = name.length - 1;
|
|
|
|
-
|
|
|
|
- // Node .js allowance:
|
|
|
|
- if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
|
|
|
|
- name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
|
|
|
|
- }
|
|
|
|
|
|
+ if (name) {
|
|
|
|
+ name = name.split('/');
|
|
|
|
+ lastIndex = name.length - 1;
|
|
|
|
+
|
|
|
|
+ // If wanting node ID compatibility, strip .js from end
|
|
|
|
+ // of IDs. Have to do this here, and not in nameToUrl
|
|
|
|
+ // because node allows either .js or non .js to map
|
|
|
|
+ // to same file.
|
|
|
|
+ if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
|
|
|
|
+ name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
|
|
|
|
+ }
|
|
|
|
|
|
- //Lop off the last part of baseParts, so that . matches the
|
|
|
|
- //"directory" and not name of the baseName's module. For instance,
|
|
|
|
- //baseName of "one/two/three", maps to "one/two/three.js", but we
|
|
|
|
- //want the directory, "one/two" for this normalization.
|
|
|
|
- name = baseParts.slice(0, baseParts.length - 1).concat(name);
|
|
|
|
-
|
|
|
|
- //start trimDots
|
|
|
|
- for (i = 0; i < name.length; i += 1) {
|
|
|
|
- part = name[i];
|
|
|
|
- if (part === ".") {
|
|
|
|
- name.splice(i, 1);
|
|
|
|
- i -= 1;
|
|
|
|
- } else if (part === "..") {
|
|
|
|
- if (i === 1 && (name[2] === '..' || name[0] === '..')) {
|
|
|
|
- //End of the line. Keep at least one non-dot
|
|
|
|
- //path segment at the front so it can be mapped
|
|
|
|
- //correctly to disk. Otherwise, there is likely
|
|
|
|
- //no path mapping for a path starting with '..'.
|
|
|
|
- //This can still fail, but catches the most reasonable
|
|
|
|
- //uses of ..
|
|
|
|
- break;
|
|
|
|
- } else if (i > 0) {
|
|
|
|
- name.splice(i - 1, 2);
|
|
|
|
- i -= 2;
|
|
|
|
- }
|
|
|
|
|
|
+ // Starts with a '.' so need the baseName
|
|
|
|
+ if (name[0].charAt(0) === '.' && baseParts) {
|
|
|
|
+ //Convert baseName to array, and lop off the last part,
|
|
|
|
+ //so that . matches that 'directory' and not name of the baseName's
|
|
|
|
+ //module. For instance, baseName of 'one/two/three', maps to
|
|
|
|
+ //'one/two/three.js', but we want the directory, 'one/two' for
|
|
|
|
+ //this normalization.
|
|
|
|
+ normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
|
|
|
|
+ name = normalizedBaseParts.concat(name);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //start trimDots
|
|
|
|
+ for (i = 0; i < name.length; i++) {
|
|
|
|
+ part = name[i];
|
|
|
|
+ if (part === '.') {
|
|
|
|
+ name.splice(i, 1);
|
|
|
|
+ i -= 1;
|
|
|
|
+ } else if (part === '..') {
|
|
|
|
+ // If at the start, or previous value is still ..,
|
|
|
|
+ // keep them so that when converted to a path it may
|
|
|
|
+ // still work when converted to a path, even though
|
|
|
|
+ // as an ID it is less than ideal. In larger point
|
|
|
|
+ // releases, may be better to just kick out an error.
|
|
|
|
+ if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
|
|
|
|
+ continue;
|
|
|
|
+ } else if (i > 0) {
|
|
|
|
+ name.splice(i - 1, 2);
|
|
|
|
+ i -= 2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //end trimDots
|
|
|
|
-
|
|
|
|
- name = name.join("/");
|
|
|
|
- } else if (name.indexOf('./') === 0) {
|
|
|
|
- // No baseName, so this is ID is resolved relative
|
|
|
|
- // to baseUrl, pull off the leading dot.
|
|
|
|
- name = name.substring(2);
|
|
|
|
}
|
|
}
|
|
|
|
+ //end trimDots
|
|
|
|
+
|
|
|
|
+ name = name.join('/');
|
|
}
|
|
}
|
|
|
|
|
|
//Apply map config if available.
|
|
//Apply map config if available.
|
|
@@ -244,32 +240,39 @@ var requirejs, require, define;
|
|
return [prefix, name];
|
|
return [prefix, name];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //Creates a parts array for a relName where first part is plugin ID,
|
|
|
|
+ //second part is resource ID. Assumes relName has already been normalized.
|
|
|
|
+ function makeRelParts(relName) {
|
|
|
|
+ return relName ? splitPrefix(relName) : [];
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Makes a name map, normalizing the name, and using a plugin
|
|
* Makes a name map, normalizing the name, and using a plugin
|
|
* for normalization if necessary. Grabs a ref to plugin
|
|
* for normalization if necessary. Grabs a ref to plugin
|
|
* too, as an optimization.
|
|
* too, as an optimization.
|
|
*/
|
|
*/
|
|
- makeMap = function (name, relName) {
|
|
|
|
|
|
+ makeMap = function (name, relParts) {
|
|
var plugin,
|
|
var plugin,
|
|
parts = splitPrefix(name),
|
|
parts = splitPrefix(name),
|
|
- prefix = parts[0];
|
|
|
|
|
|
+ prefix = parts[0],
|
|
|
|
+ relResourceName = relParts[1];
|
|
|
|
|
|
name = parts[1];
|
|
name = parts[1];
|
|
|
|
|
|
if (prefix) {
|
|
if (prefix) {
|
|
- prefix = normalize(prefix, relName);
|
|
|
|
|
|
+ prefix = normalize(prefix, relResourceName);
|
|
plugin = callDep(prefix);
|
|
plugin = callDep(prefix);
|
|
}
|
|
}
|
|
|
|
|
|
//Normalize according
|
|
//Normalize according
|
|
if (prefix) {
|
|
if (prefix) {
|
|
if (plugin && plugin.normalize) {
|
|
if (plugin && plugin.normalize) {
|
|
- name = plugin.normalize(name, makeNormalize(relName));
|
|
|
|
|
|
+ name = plugin.normalize(name, makeNormalize(relResourceName));
|
|
} else {
|
|
} else {
|
|
- name = normalize(name, relName);
|
|
|
|
|
|
+ name = normalize(name, relResourceName);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- name = normalize(name, relName);
|
|
|
|
|
|
+ name = normalize(name, relResourceName);
|
|
parts = splitPrefix(name);
|
|
parts = splitPrefix(name);
|
|
prefix = parts[0];
|
|
prefix = parts[0];
|
|
name = parts[1];
|
|
name = parts[1];
|
|
@@ -316,13 +319,14 @@ var requirejs, require, define;
|
|
};
|
|
};
|
|
|
|
|
|
main = function (name, deps, callback, relName) {
|
|
main = function (name, deps, callback, relName) {
|
|
- var cjsModule, depName, ret, map, i,
|
|
|
|
|
|
+ var cjsModule, depName, ret, map, i, relParts,
|
|
args = [],
|
|
args = [],
|
|
callbackType = typeof callback,
|
|
callbackType = typeof callback,
|
|
usingExports;
|
|
usingExports;
|
|
|
|
|
|
//Use name if no relName
|
|
//Use name if no relName
|
|
relName = relName || name;
|
|
relName = relName || name;
|
|
|
|
+ relParts = makeRelParts(relName);
|
|
|
|
|
|
//Call the callback to define the module, if necessary.
|
|
//Call the callback to define the module, if necessary.
|
|
if (callbackType === 'undefined' || callbackType === 'function') {
|
|
if (callbackType === 'undefined' || callbackType === 'function') {
|
|
@@ -331,7 +335,7 @@ var requirejs, require, define;
|
|
//Default to [require, exports, module] if no deps
|
|
//Default to [require, exports, module] if no deps
|
|
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
|
|
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
|
|
for (i = 0; i < deps.length; i += 1) {
|
|
for (i = 0; i < deps.length; i += 1) {
|
|
- map = makeMap(deps[i], relName);
|
|
|
|
|
|
+ map = makeMap(deps[i], relParts);
|
|
depName = map.f;
|
|
depName = map.f;
|
|
|
|
|
|
//Fast path CommonJS standard dependencies.
|
|
//Fast path CommonJS standard dependencies.
|
|
@@ -387,7 +391,7 @@ var requirejs, require, define;
|
|
//deps arg is the module name, and second arg (if passed)
|
|
//deps arg is the module name, and second arg (if passed)
|
|
//is just the relName.
|
|
//is just the relName.
|
|
//Normalize module name, if it contains . or ..
|
|
//Normalize module name, if it contains . or ..
|
|
- return callDep(makeMap(deps, callback).f);
|
|
|
|
|
|
+ return callDep(makeMap(deps, makeRelParts(callback)).f);
|
|
} else if (!deps.splice) {
|
|
} else if (!deps.splice) {
|
|
//deps is a config object, not an array.
|
|
//deps is a config object, not an array.
|
|
config = deps;
|
|
config = deps;
|
|
@@ -3958,7 +3962,7 @@ S2.define('select2/dropdown/search',[
|
|
});
|
|
});
|
|
|
|
|
|
container.on('focus', function () {
|
|
container.on('focus', function () {
|
|
- if (container.isOpen()) {
|
|
|
|
|
|
+ if (!container.isOpen()) {
|
|
self.$search.focus();
|
|
self.$search.focus();
|
|
}
|
|
}
|
|
});
|
|
});
|