X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/adapter/jquery/ext-jquery-adapter-debug.js diff --git a/adapter/jquery/ext-jquery-adapter-debug.js b/adapter/jquery/ext-jquery-adapter-debug.js index 5725e48d..5295c6ab 100644 --- a/adapter/jquery/ext-jquery-adapter-debug.js +++ b/adapter/jquery/ext-jquery-adapter-debug.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.0.0 + * Ext JS Library 3.0.3 * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license @@ -19,7 +19,7 @@ Ext = { * The version of the framework * @type String */ - version : '3.0' + version : '3.0.3' }; /** @@ -46,20 +46,6 @@ Ext.apply = function(o, c, defaults){ (function(){ var idSeed = 0, toString = Object.prototype.toString, - //assume it's not null and not an array - isIterable = function(v){ - //check for array or arguments - if(Ext.isArray(v) || v.callee){ - return true; - } - //check for node list type - if(/NodeList|HTMLCollection/.test(toString.call(v))){ - return true; - } - //NodeList has an item and length property - //IXMLDOMNodeList has nextNode method, needs to be checked first. - return ((v.nextNode || v.item) && Ext.isNumber(v.length)); - }, ua = navigator.userAgent.toLowerCase(), check = function(r){ return r.test(ua); @@ -97,10 +83,10 @@ Ext.apply = function(o, c, defaults){ Ext.apply(Ext, { /** * URL to a blank file used by Ext when in secure mode for iframe src and onReady src to prevent - * the IE insecure content warning (defaults to javascript:false). + * the IE insecure content warning ('about:blank', except for IE in secure mode, which is 'javascript:""'). * @type String */ - SSL_SECURE_URL : 'javascript:false', + SSL_SECURE_URL : isSecure && isIE ? 'javascript:""' : 'about:blank', /** * True if the browser is in strict (standards-compliant) mode, as opposed to quirks mode * @type Boolean @@ -154,7 +140,7 @@ Ext.apply = function(o, c, defaults){ applyIf : function(o, c){ if(o){ for(var p in c){ - if(Ext.isEmpty(o[p])){ + if(!Ext.isDefined(o[p])){ o[p] = c[p]; } } @@ -173,30 +159,27 @@ Ext.apply = function(o, c, defaults){ }, /** - * Extends one class with another class and optionally overrides members with the passed literal. This class - * also adds the function "override()" to the class that can be used to override - * members on an instance. - * *

- * This function also supports a 2-argument call in which the subclass's constructor is - * not passed as an argument. In this form, the parameters are as follows:

- *

- * For example, to create a subclass of the Ext GridPanel: + *

Extends one class to create a subclass and optionally overrides members with the passed literal. This method + * also adds the function "override()" to the subclass that can be used to override members of the class.

+ * For example, to create a subclass of Ext GridPanel: *

 MyGridPanel = Ext.extend(Ext.grid.GridPanel, {
     constructor: function(config) {
-        // Your preprocessing here
-        MyGridPanel.superclass.constructor.apply(this, arguments);
-        // Your postprocessing here
+
+//      Create configuration for this Grid.
+        var store = new Ext.data.Store({...});
+        var colModel = new Ext.grid.ColumnModel({...});
+
+//      Create a new config object containing our computed properties
+//      *plus* whatever was in the config parameter.
+        config = Ext.apply({
+            store: store,
+            colModel: colModel
+        }, config);
+
+        MyGridPanel.superclass.constructor.call(this, config);
+
+//      Your postprocessing here
     },
 
     yourMethod: function() {
@@ -204,13 +187,25 @@ MyGridPanel = Ext.extend(Ext.grid.GridPanel, {
     }
 });
 
- *

- * @param {Function} subclass The class inheriting the functionality - * @param {Function} superclass The class being extended - * @param {Object} overrides (optional) A literal with members which are copied into the subclass's - * prototype, and are therefore shared between all instances of the new class. + * + *

This function also supports a 3-argument call in which the subclass's constructor is + * passed as an argument. In this form, the parameters are as follows:

+ *
+ * + * @param {Function} subclass The constructor of class being extended. + * @param {Object} overrides

A literal with members which are copied into the subclass's + * prototype, and are therefore shared between all instances of the new class.

+ *

This may contain a special member named constructor. This is used + * to define the constructor of the new class, and is returned. If this property is + * not specified, a constructor is generated and returned which just calls the + * superclass's constructor passing on its parameters.

+ *

It is essential that you call the superclass constructor in any provided constructor. See example code.

* @return {Function} The subclass constructor. - * @method extend */ extend : function(){ // inline overrides @@ -246,7 +241,7 @@ MyGridPanel = Ext.extend(Ext.grid.GridPanel, { }); sbp.override = io; Ext.override(sb, overrides); - sb.extend = function(o){Ext.extend(sb, o);}; + sb.extend = function(o){return Ext.extend(sb, o);}; return sb; }; }(), @@ -290,6 +285,7 @@ Company.data.CustomStore = function(config) { ... } * @param {String} namespace1 * @param {String} namespace2 * @param {String} etc + * @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created) * @method namespace */ namespace : function(){ @@ -310,18 +306,20 @@ Company.data.CustomStore = function(config) { ... } * @param {String} pre (optional) A prefix to add to the url encoded string * @return {String} */ - urlEncode: function(o, pre){ - var undef, buf = [], key, e = encodeURIComponent; + urlEncode : function(o, pre){ + var empty, + buf = [], + e = encodeURIComponent; - for(key in o){ - undef = !Ext.isDefined(o[key]); - Ext.each(undef ? key : o[key], function(val, i){ - buf.push("&", e(key), "=", (val != key || !undef) ? e(val) : ""); + Ext.iterate(o, function(key, item){ + empty = Ext.isEmpty(item); + Ext.each(empty ? key : item, function(val){ + buf.push('&', e(key), '=', (!Ext.isEmpty(val) && (val != key || !empty)) ? (Ext.isDate(val) ? Ext.encode(val).replace(/"/g, '') : e(val)) : ''); }); - } + }); if(!pre){ buf.shift(); - pre = ""; + pre = ''; } return pre + buf.join(''); }, @@ -336,6 +334,9 @@ Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", false); // returns {foo: "1", bar: ["2" * @return {Object} A literal with members */ urlDecode : function(string, overwrite){ + if(Ext.isEmpty(string)){ + return {}; + } var obj = {}, pairs = string.split('&'), d = decodeURIComponent, @@ -352,11 +353,11 @@ Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", false); // returns {foo: "1", bar: ["2" }, /** - * Appends content to the query string of a URL, which handles logic for whether to place + * Appends content to the query string of a URL, handling logic for whether to place * a question mark or ampersand. - * @param {String} url The url to append to. - * @@param {String} s The content to append to the url. - * @return (String) The appended string + * @param {String} url The URL to append to. + * @param {String} s The content to append to the URL. + * @return (String) The resulting URL */ urlAppend : function(url, s){ if(!Ext.isEmpty(s)){ @@ -386,19 +387,48 @@ Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", false); // returns {foo: "1", bar: ["2" } }(), + isIterable : function(v){ + //check for array or arguments + if(Ext.isArray(v) || v.callee){ + return true; + } + //check for node list type + if(/NodeList|HTMLCollection/.test(toString.call(v))){ + return true; + } + //NodeList has an item and length property + //IXMLDOMNodeList has nextNode method, needs to be checked first. + return ((v.nextNode || v.item) && Ext.isNumber(v.length)); + }, + /** - * Iterates an array calling the passed function with each item, stopping if your function returns false. If the - * passed array is not really an array, your function is called once with it. - * The supplied function is called with (Object item, Number index, Array allItems). - * @param {Array/NodeList/Mixed} array - * @param {Function} fn - * @param {Object} scope + * Iterates an array calling the supplied function. + * @param {Array/NodeList/Mixed} array The array to be iterated. If this + * argument is not really an array, the supplied function is called once. + * @param {Function} fn The function to be called with each item. If the + * supplied function returns false, iteration stops and this method returns + * the current index. This function is called with + * the following arguments: + *
+ * @param {Object} scope The scope (this reference) in which the specified function is executed. + * Defaults to the item at the current index + * within the passed array. + * @return See description for the fn parameter. */ - each: function(array, fn, scope){ + each : function(array, fn, scope){ if(Ext.isEmpty(array, true)){ return; } - if(!isIterable(array) || Ext.isPrimitive(array)){ + if(!Ext.isIterable(array) || Ext.isPrimitive(array)){ array = [array]; } for(var i = 0, len = array.length; i < len; i++){ @@ -425,11 +455,14 @@ Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", false); // returns {foo: "1", bar: ["2" * When iterating an object, the supplied function is called with each key-value pair in * the object. * - * @param {Object} scope The scope to call the supplied function with, defaults to - * the specified object + * @param {Object} scope The scope (this reference) in which the specified function is executed. Defaults to + * the object being iterated. */ iterate : function(obj, fn, scope){ - if(isIterable(obj)){ + if(Ext.isEmpty(obj)){ + return; + } + if(Ext.isIterable(obj)){ Ext.each(obj, fn, scope); return; }else if(Ext.isObject(obj)){ @@ -515,8 +548,8 @@ function(el){ }, /** - * Returns true if the passed object is a JavaScript array, otherwise false. - * @param {Object} object The object to test + * Returns true if the passed value is a JavaScript array, otherwise false. + * @param {Mixed} value The value to test * @return {Boolean} */ isArray : function(v){ @@ -524,16 +557,25 @@ function(el){ }, /** - * Returns true if the passed object is a JavaScript Object, otherwise false. + * Returns true if the passed object is a JavaScript date object, otherwise false. * @param {Object} object The object to test * @return {Boolean} */ + isDate : function(v){ + return toString.apply(v) === '[object Date]'; + }, + + /** + * Returns true if the passed value is a JavaScript Object, otherwise false. + * @param {Mixed} value The value to test + * @return {Boolean} + */ isObject : function(v){ return v && typeof v == "object"; }, /** - * Returns true if the passed object is a JavaScript 'primitive', a string, number or boolean. + * Returns true if the passed value is a JavaScript 'primitive', a string, number or boolean. * @param {Mixed} value The value to test * @return {Boolean} */ @@ -542,8 +584,8 @@ function(el){ }, /** - * Returns true if the passed object is a JavaScript Function, otherwise false. - * @param {Object} object The object to test + * Returns true if the passed value is a JavaScript Function, otherwise false. + * @param {Mixed} value The value to test * @return {Boolean} */ isFunction : function(v){ @@ -551,38 +593,38 @@ function(el){ }, /** - * Returns true if the passed object is a number. Returns false for non-finite numbers. - * @param {Object} v The object to test + * Returns true if the passed value is a number. Returns false for non-finite numbers. + * @param {Mixed} value The value to test * @return {Boolean} */ - isNumber: function(v){ + isNumber : function(v){ return typeof v === 'number' && isFinite(v); }, /** - * Returns true if the passed object is a string. - * @param {Object} v The object to test + * Returns true if the passed value is a string. + * @param {Mixed} value The value to test * @return {Boolean} */ - isString: function(v){ + isString : function(v){ return typeof v === 'string'; }, /** - * Returns true if the passed object is a boolean. - * @param {Object} v The object to test + * Returns true if the passed value is a boolean. + * @param {Mixed} value The value to test * @return {Boolean} */ - isBoolean: function(v){ + isBoolean : function(v){ return typeof v === 'boolean'; }, /** - * Returns true if the passed object is not undefined. - * @param {Object} v The object to test + * Returns true if the passed value is not undefined. + * @param {Mixed} value The value to test * @return {Boolean} */ - isDefined: function(v){ + isDefined : function(v){ return typeof v !== 'undefined'; }, @@ -595,7 +637,7 @@ function(el){ * True if the detected browser uses WebKit. * @type Boolean */ - isWebKit: isWebKit, + isWebKit : isWebKit, /** * True if the detected browser is Chrome. * @type Boolean @@ -695,7 +737,8 @@ Company.data.CustomStore = function(config) { ... } * @param {String} namespace1 * @param {String} namespace2 * @param {String} etc - * @method namespace + * @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created) + * @method ns */ Ext.ns = Ext.namespace; })(); @@ -709,9 +752,9 @@ Ext.ns("Ext", "Ext.util", "Ext.lib", "Ext.data"); */ Ext.apply(Function.prototype, { /** - * Creates an interceptor function. The passed fcn is called before the original one. If it returns false, + * Creates an interceptor function. The passed function is called before the original one. If it returns false, * the original one is not called. The resulting function returns the results of the original function. - * The passed fcn is called with the parameters of the original function. Example usage: + * The passed function is called with the parameters of the original function. Example usage: *

 var sayHi = function(name){
     alert('Hi, ' + name);
@@ -729,7 +772,8 @@ sayHiToFriend('Fred');  // no alert
 sayHiToFriend('Brian'); // alerts "Hi, Brian"
 
* @param {Function} fcn The function to call before the original - * @param {Object} scope (optional) The scope of the passed fcn (Defaults to scope of original function or window) + * @param {Object} scope (optional) The scope (this reference) in which the passed function is executed. + * If omitted, defaults to the scope in which the original function is called or the browser window. * @return {Function} The new function */ createInterceptor : function(fcn, scope){ @@ -804,10 +848,11 @@ var btn = new Ext.Button({ // "Hi, Fred. You clicked the "Say Hi" button." btn.on('click', sayHi.createDelegate(btn, ['Fred'])); - * @param {Object} obj (optional) The object for which the scope is set + * @param {Object} scope (optional) The scope (this reference) in which the function is executed. + * If omitted, defaults to the browser window. * @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller) * @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding, - * if a number the args are inserted at the specified position + * if a number the args are inserted at the specified position * @return {Function} The new function */ createDelegate : function(obj, args, appendArgs){ @@ -846,10 +891,11 @@ sayHi.defer(2000, this, ['Fred']); }).defer(100); * @param {Number} millis The number of milliseconds for the setTimeout call (if less than or equal to 0 the function is executed immediately) - * @param {Object} obj (optional) The object for which the scope is set + * @param {Object} scope (optional) The scope (this reference) in which the function is executed. + * If omitted, defaults to the browser window. * @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller) * @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding, - * if a number the args are inserted at the specified position + * if a number the args are inserted at the specified position * @return {Number} The timeout id that can be used with clearTimeout */ defer : function(millis, obj, args, appendArgs){ @@ -896,12 +942,16 @@ Ext.applyIf(Array.prototype, { /** * Checks whether or not the specified object exists in the array. * @param {Object} o The object to check for + * @param {Number} from (Optional) The index at which to begin the search * @return {Number} The index of o in the array (or -1 if it is not found) */ - indexOf : function(o){ - for (var i = 0, len = this.length; i < len; i++){ - if(this[i] == o){ - return i; + indexOf : function(o, from){ + var len = this.length; + from = from || 0; + from += (from < 0) ? len : 0; + for (; from < len; ++from){ + if(this[from] === o){ + return from; } } return -1; @@ -933,7 +983,9 @@ Ext.ns("Ext.grid", "Ext.dd", "Ext.tree", "Ext.form", "Ext.menu", */ Ext.apply(Ext, function(){ - var E = Ext, idSeed = 0; + var E = Ext, + idSeed = 0, + scrollWidth = null; return { /** @@ -949,7 +1001,7 @@ Ext.apply(Ext, function(){ * For other browsers it uses an inline data URL. * @type String */ - BLANK_IMAGE_URL : Ext.isIE6 || Ext.isIE7 ? + BLANK_IMAGE_URL : Ext.isIE6 || Ext.isIE7 || Ext.isAir ? 'http:/' + '/extjs.com/s.gif' : 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', @@ -965,15 +1017,6 @@ Ext.apply(Ext, function(){ return Ext.get(document); }, - /** - * Returns true if the passed object is a JavaScript date object, otherwise false. - * @param {Object} object The object to test - * @return {Boolean} - */ - isDate : function(v){ - return Object.prototype.toString.apply(v) === '[object Date]'; - }, - /** * Utility method for validating that a value is numeric, returning the specified default value if it is not. * @param {Mixed} value Should be a number, but any type will be handled appropriately @@ -981,7 +1024,7 @@ Ext.apply(Ext, function(){ * @return {Number} Value, if numeric, else defaultValue */ num : function(v, defaultValue){ - v = Number(v === null || typeof v == 'boolean'? NaN : v); + v = Number(Ext.isEmpty(v) || Ext.isBoolean(v) ? NaN : v); return isNaN(v)? defaultValue : v; }, @@ -1008,7 +1051,7 @@ Ext.apply(Ext, function(){ * @return {String} */ escapeRe : function(s) { - return s.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1"); + return s.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1"); }, sequence : function(o, name, fn, scope){ @@ -1055,6 +1098,31 @@ Ext.addBehaviors({ cache = null; } }, + + /** + * Utility method for getting the width of the browser scrollbar. This can differ depending on + * operating system settings, such as the theme or font size. + * @param {Boolean} force (optional) true to force a recalculation of the value. + * @return {Number} The width of the scrollbar. + */ + getScrollBarWidth: function(force){ + if(!Ext.isReady){ + return 0; + } + + if(force === true || scrollWidth === null){ + // Append our div, do our calculation and then remove it + var div = Ext.getBody().createChild('
'), + child = div.child('div', true); + var w1 = child.offsetWidth; + div.setStyle('overflow', (Ext.isWebKit || Ext.isGecko) ? 'auto' : 'scroll'); + var w2 = child.offsetWidth; + div.remove(); + // Need to add 2 to ensure we leave enough space + scrollWidth = w1 - w2 + 2; + } + return scrollWidth; + }, // deprecated @@ -1091,7 +1159,7 @@ ImageComponent = Ext.extend(Ext.BoxComponent, { * @return {Object} The modified object. */ copyTo : function(dest, source, names){ - if(typeof names == 'string'){ + if(Ext.isString(names)){ names = names.split(/[,;\s]/); } Ext.each(names, function(name){ @@ -1293,7 +1361,7 @@ Ext.invoke(Ext.query("p"), "getAttribute", "id"); var ret = [], args = Array.prototype.slice.call(arguments, 2); Ext.each(arr, function(v,i) { - if (v && typeof v[methodName] == "function") { + if (v && Ext.isFunction(v[methodName])) { ret.push(v[methodName].apply(v, args)); } else { ret.push(undefined); @@ -1417,7 +1485,7 @@ Ext.zip( case RegExp: return 'regexp'; case Date: return 'date'; } - if(typeof o.length == 'number' && typeof o.item == 'function') { + if(Ext.isNumber(o.length) && Ext.isFunction(o.item)) { return 'nodelist'; } } @@ -1464,7 +1532,8 @@ var sayGoodbye = sayHi.createSequence(function(name){ sayGoodbye('Fred'); // both alerts show * @param {Function} fcn The function to sequence - * @param {Object} scope (optional) The scope of the passed fcn (Defaults to scope of original function or window) + * @param {Object} scope (optional) The scope (this reference) in which the passed function is executed. + * If omitted, defaults to the scope in which the original function is called or the browser window. * @return {Function} The new function */ createSequence : function(fcn, scope){ @@ -1769,27 +1838,22 @@ Ext.lib.Dom = { }, isAncestor : function(p, c){ + var ret = false; + p = Ext.getDom(p); c = Ext.getDom(c); - if (!p || !c) {return false;} - - if(p.contains && !Ext.isSafari) { - return p.contains(c); - }else if(p.compareDocumentPosition) { - return !!(p.compareDocumentPosition(c) & 16); - }else{ - var parent = c.parentNode; - while (parent) { - if (parent == p) { - return true; - } - else if (!parent.tagName || parent.tagName.toUpperCase() == "HTML") { - return false; + if (p && c) { + if (p.contains) { + return p.contains(c); + } else if (p.compareDocumentPosition) { + return !!(p.compareDocumentPosition(c) & 16); + } else { + while (c = c.parentNode) { + ret = c == p || ret; } - parent = parent.parentNode; - } - return false; - } + } + } + return ret; }, getRegion : function(el){ @@ -1978,12 +2042,17 @@ Ext.lib.Event = { var iid = setInterval(f, 50); }, - resolveTextNode: function(node) { - if (node && 3 == node.nodeType) { - return node.parentNode; - } else { - return node; + resolveTextNode: Ext.isGecko ? function(node){ + if(!node){ + return; } + var s = HTMLElement.prototype.toString.call(node); + if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){ + return; + } + return node.nodeType == 3 ? node.parentNode : node; + } : function(node){ + return node && node.nodeType == 3 ? node.parentNode : node; }, getRelatedTarget: function(ev) { @@ -2005,20 +2074,43 @@ Ext.lib.Ajax = function(){ var createComplete = function(cb){ return function(xhr, status){ if((status == 'error' || status == 'timeout') && cb.failure){ - cb.failure.call(cb.scope||window, { - responseText: xhr.responseText, - responseXML : xhr.responseXML, - argument: cb.argument - }); + cb.failure.call(cb.scope||window, createResponse(cb, xhr)); }else if(cb.success){ - cb.success.call(cb.scope||window, { - responseText: xhr.responseText, - responseXML : xhr.responseXML, - argument: cb.argument - }); + cb.success.call(cb.scope||window, createResponse(cb, xhr)); } }; }; + + var createResponse = function(cb, xhr){ + var headerObj = {}, + headerStr, + t, + s; + + try { + headerStr = xhr.getAllResponseHeaders(); + Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){ + t = v.indexOf(':'); + if(t >= 0){ + s = v.substr(0, t).toLowerCase(); + if(v.charAt(t + 1) == ' '){ + ++t; + } + headerObj[s] = v.substr(t + 1); + } + }); + } catch(e) {} + + return { + responseText: xhr.responseText, + responseXML : xhr.responseXML, + argument: cb.argument, + status: xhr.status, + statusText: xhr.statusText, + getResponseHeader : function(header){return headerObj[header.toLowerCase()];}, + getAllResponseHeaders : function(){return headerStr} + }; + }; return { request : function(method, uri, cb, data, options){ var o = { @@ -2178,6 +2270,11 @@ Ext.lib.Anim = function(){ if (args.top.from) e.setTop(args.top.from); break; + case 'callback': + case 'scope': + // jQuery can't handle callback and scope arguments, so break here + break; + default: o[k] = args[k].to; if (args[k].from)