summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Churchill <damoxc@gmail.com>2011-06-12 23:49:08 +0100
committerDamien Churchill <damoxc@gmail.com>2011-10-05 01:31:14 +0100
commit6cdf9940d3635e9b83037e7f9d3b5f46f86d15d3 (patch)
treecf771a1eaed18f0dc6982802be4d1c792bf1f9b8
parent8b69d66baea1fff6129c6bc31cb778ca236c6be3 (diff)
downloaddeluge-6cdf9940d3635e9b83037e7f9d3b5f46f86d15d3.tar.gz
deluge-6cdf9940d3635e9b83037e7f9d3b5f46f86d15d3.tar.bz2
deluge-6cdf9940d3635e9b83037e7f9d3b5f46f86d15d3.zip
add extjs javascript files too
-rw-r--r--deluge/ui/web/js/ext-all-debug.js6304
-rw-r--r--deluge/ui/web/js/ext-all-dev.js129591
-rw-r--r--deluge/ui/web/js/ext-all.js18
-rw-r--r--deluge/ui/web/js/ext-debug.js2510
-rw-r--r--deluge/ui/web/js/ext-dev.js21679
-rw-r--r--deluge/ui/web/js/ext.js18
6 files changed, 156183 insertions, 3937 deletions
diff --git a/deluge/ui/web/js/ext-all-debug.js b/deluge/ui/web/js/ext-all-debug.js
index e5db5769e..ba428b546 100644
--- a/deluge/ui/web/js/ext-all-debug.js
+++ b/deluge/ui/web/js/ext-all-debug.js
@@ -1,15 +1,23 @@
/*
-Ext JS - JavaScript Library
-Copyright (c) 2006-2011, Sencha Inc.
-All rights reserved.
-licensing@sencha.com
+
+This file is part of Ext JS 4
+
+Copyright (c) 2011 Sencha Inc
+
+Contact: http://www.sencha.com/contact
+
+GNU General Public License Usage
+This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+
+If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
+
*/
(function() {
var global = this,
objectPrototype = Object.prototype,
- toString = Object.prototype.toString,
+ toString = objectPrototype.toString,
enumerables = true,
enumerablesTest = { toString: 1 },
i;
@@ -128,13 +136,6 @@ licensing@sencha.com
};
}
- if (!superclass) {
- Ext.Error.raise({
- sourceClass: 'Ext',
- sourceMethod: 'extend',
- msg: 'Attempting to extend from a class which has not been loaded on the page.'
- });
- }
var F = function() {},
@@ -228,11 +229,6 @@ licensing@sencha.com
return 'object';
}
- Ext.Error.raise({
- sourceClass: 'Ext',
- sourceMethod: 'typeOf',
- msg: 'Failed to determine the type of the specified value "' + value + '". This is most likely a bug.'
- });
},
@@ -253,7 +249,8 @@ licensing@sencha.com
isObject: (toString.call(null) === '[object Object]') ?
function(value) {
- return value !== null && value !== undefined && toString.call(value) === '[object Object]' && value.nodeType === undefined;
+
+ return value !== null && value !== undefined && toString.call(value) === '[object Object]' && value.ownerDocument === undefined;
} :
function(value) {
return toString.call(value) === '[object Object]';
@@ -378,7 +375,7 @@ licensing@sencha.com
var i = 0;
do {
- uniqueGlobalNamespace = 'ExtSandbox' + (++i);
+ uniqueGlobalNamespace = 'ExtBox' + (++i);
} while (Ext.global[uniqueGlobalNamespace] !== undefined);
Ext.global[uniqueGlobalNamespace] = Ext;
@@ -410,7 +407,7 @@ licensing@sencha.com
(function() {
-var version = '4.0.1', Version;
+var version = '4.0.2', Version;
Ext.Version = Version = Ext.extend(Object, {
@@ -736,6 +733,26 @@ Ext.Number = {
},
+ snap : function(value, increment, minValue, maxValue) {
+ var newValue = value,
+ m;
+
+ if (!(increment && value)) {
+ return value;
+ }
+ m = value % increment;
+ if (m !== 0) {
+ newValue -= m;
+ if (m * 2 >= increment) {
+ newValue += increment;
+ } else if (m * 2 < -increment) {
+ newValue -= increment;
+ }
+ }
+ return Ext.Number.constrain(newValue, minValue, maxValue);
+ },
+
+
toFixed: function(value, precision) {
if (isToFixedBroken) {
precision = precision || 0;
@@ -767,6 +784,34 @@ Ext.num = function() {
var arrayPrototype = Array.prototype,
slice = arrayPrototype.slice,
+ supportsSplice = function () {
+ var array = [],
+ lengthBefore,
+ j = 20;
+
+ if (!array.splice) {
+ return false;
+ }
+
+
+
+
+ while (j--) {
+ array.push("A");
+ }
+
+ array.splice(15, 0, "F", "F", "F", "F", "F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F");
+
+ lengthBefore = array.length;
+ array.splice(13, 0, "XXX");
+
+ if (lengthBefore+1 != array.length) {
+ return false;
+ }
+
+
+ return true;
+ }(),
supportsForEach = 'forEach' in arrayPrototype,
supportsMap = 'map' in arrayPrototype,
supportsIndexOf = 'indexOf' in arrayPrototype,
@@ -779,6 +824,7 @@ Ext.num = function() {
}(),
supportsSliceOnNodeList = true,
ExtArray;
+
try {
if (typeof document !== 'undefined') {
@@ -788,6 +834,99 @@ Ext.num = function() {
supportsSliceOnNodeList = false;
}
+ function fixArrayIndex (array, index) {
+ return (index < 0) ? Math.max(0, array.length + index)
+ : Math.min(array.length, index);
+ }
+
+
+ function replaceSim (array, index, removeCount, insert) {
+ var add = insert ? insert.length : 0,
+ length = array.length,
+ pos = fixArrayIndex(array, index);
+
+
+ if (pos === length) {
+ if (add) {
+ array.push.apply(array, insert);
+ }
+ } else {
+ var remove = Math.min(removeCount, length - pos),
+ tailOldPos = pos + remove,
+ tailNewPos = tailOldPos + add - remove,
+ tailCount = length - tailOldPos,
+ lengthAfterRemove = length - remove,
+ i;
+
+ if (tailNewPos < tailOldPos) {
+ for (i = 0; i < tailCount; ++i) {
+ array[tailNewPos+i] = array[tailOldPos+i];
+ }
+ } else if (tailNewPos > tailOldPos) {
+ for (i = tailCount; i--; ) {
+ array[tailNewPos+i] = array[tailOldPos+i];
+ }
+ }
+
+ if (add && pos === lengthAfterRemove) {
+ array.length = lengthAfterRemove;
+ array.push.apply(array, insert);
+ } else {
+ array.length = lengthAfterRemove + add;
+ for (i = 0; i < add; ++i) {
+ array[pos+i] = insert[i];
+ }
+ }
+ }
+
+ return array;
+ }
+
+ function replaceNative (array, index, removeCount, insert) {
+ if (insert && insert.length) {
+ if (index < array.length) {
+ array.splice.apply(array, [index, removeCount].concat(insert));
+ } else {
+ array.push.apply(array, insert);
+ }
+ } else {
+ array.splice(index, removeCount);
+ }
+ return array;
+ }
+
+ function eraseSim (array, index, removeCount) {
+ return replaceSim(array, index, removeCount);
+ }
+
+ function eraseNative (array, index, removeCount) {
+ array.splice(index, removeCount);
+ return array;
+ }
+
+ function spliceSim (array, index, removeCount) {
+ var pos = fixArrayIndex(array, index),
+ removed = array.slice(index, fixArrayIndex(array, pos+removeCount));
+
+ if (arguments.length < 4) {
+ replaceSim(array, pos, removeCount);
+ } else {
+ replaceSim(array, pos, removeCount, slice.call(arguments, 3));
+ }
+
+ return removed;
+ }
+
+ function spliceNative (array) {
+ return array.splice.apply(array, slice.call(arguments, 1));
+ }
+
+ var erase = supportsSplice ? eraseNative : eraseSim,
+ replace = supportsSplice ? replaceNative : replaceSim,
+ splice = supportsSplice ? spliceNative : spliceSim;
+
+
+
ExtArray = Ext.Array = {
each: function(array, fn, scope, reverse) {
@@ -922,9 +1061,6 @@ Ext.num = function() {
every: function(array, fn, scope) {
- if (!fn) {
- Ext.Error.raise('Ext.Array.every must have a callback function passed as second argument.');
- }
if (supportsEvery) {
return array.every(fn, scope);
}
@@ -943,9 +1079,6 @@ Ext.num = function() {
some: function(array, fn, scope) {
- if (!fn) {
- Ext.Error.raise('Ext.Array.some must have a callback function passed as second argument.');
- }
if (supportsSome) {
return array.some(fn, scope);
}
@@ -1039,7 +1172,7 @@ Ext.num = function() {
var index = ExtArray.indexOf(array, item);
if (index !== -1) {
- array.splice(index, 1);
+ erase(array, index, 1);
}
return array;
@@ -1088,8 +1221,8 @@ Ext.num = function() {
}
}
- minArray = Ext.Array.unique(minArray);
- arrays.splice(x, 1);
+ minArray = ExtArray.unique(minArray);
+ erase(arrays, x, 1);
@@ -1123,7 +1256,7 @@ Ext.num = function() {
for (i = 0,lnB = arrayB.length; i < lnB; i++) {
for (j = 0; j < ln; j++) {
if (clone[j] === arrayB[i]) {
- clone.splice(j, 1);
+ erase(clone, j, 1);
j--;
ln--;
}
@@ -1134,6 +1267,11 @@ Ext.num = function() {
},
+ slice: function(array, begin, end) {
+ return slice.call(array, begin, end);
+ },
+
+
sort: function(array, sortFn) {
if (supportsSort) {
if (sortFn) {
@@ -1256,48 +1394,61 @@ Ext.num = function() {
}
return sum;
- }
+ },
+
+
+
+ erase: erase,
+
+
+ insert: function (array, index, items) {
+ return replace(array, index, 0, items);
+ },
+
+
+ replace: replace,
+
+ splice: splice
};
- Ext.each = Ext.Array.each;
+ Ext.each = ExtArray.each;
- Ext.Array.union = Ext.Array.merge;
+ ExtArray.union = ExtArray.merge;
- Ext.min = Ext.Array.min;
+ Ext.min = ExtArray.min;
- Ext.max = Ext.Array.max;
+ Ext.max = ExtArray.max;
- Ext.sum = Ext.Array.sum;
+ Ext.sum = ExtArray.sum;
- Ext.mean = Ext.Array.mean;
+ Ext.mean = ExtArray.mean;
- Ext.flatten = Ext.Array.flatten;
+ Ext.flatten = ExtArray.flatten;
- Ext.clean = Ext.Array.clean;
+ Ext.clean = ExtArray.clean;
- Ext.unique = Ext.Array.unique;
+ Ext.unique = ExtArray.unique;
- Ext.pluck = Ext.Array.pluck;
+ Ext.pluck = ExtArray.pluck;
Ext.toArray = function() {
return ExtArray.toArray.apply(ExtArray, arguments);
- }
+ };
})();
-
Ext.Function = {
@@ -1332,22 +1483,21 @@ Ext.Function = {
};
},
-
+
bind: function(fn, scope, args, appendArgs) {
var method = fn,
- applyArgs;
+ slice = Array.prototype.slice;
return function() {
var callArgs = args || arguments;
if (appendArgs === true) {
- callArgs = Array.prototype.slice.call(arguments, 0);
+ callArgs = slice.call(arguments, 0);
callArgs = callArgs.concat(args);
}
else if (Ext.isNumber(appendArgs)) {
- callArgs = Array.prototype.slice.call(arguments, 0);
- applyArgs = [appendArgs, 0].concat(args);
- Array.prototype.splice.apply(callArgs, applyArgs);
+ callArgs = slice.call(arguments, 0);
+ Ext.Array.insert(callArgs, appendArgs, args);
}
return method.apply(scope || window, callArgs);
@@ -1584,15 +1734,6 @@ var ExtObject = Ext.Object = {
matchedKeys = name.match(/(\[):?([^\]]*)\]/g);
matchedName = name.match(/^([^\[]+)/);
- if (!matchedName) {
- Ext.Error.raise({
- sourceClass: "Ext.Object",
- sourceMethod: "fromQueryString",
- queryString: queryString,
- recursive: recursive,
- msg: 'Malformed query string given, failed parsing name from "' + part + '"'
- });
- }
name = matchedName[0];
keys = [];
@@ -2681,13 +2822,6 @@ var Base = Ext.Base = function() {};
parentClass, methodName;
if (!method.$owner) {
- if (!method.caller) {
- Ext.Error.raise({
- sourceClass: Ext.getClassName(this),
- sourceMethod: "callParent",
- msg: "Attempting to call a protected method from the public scope, which is not allowed"
- });
- }
method = method.caller;
}
@@ -2695,14 +2829,6 @@ var Base = Ext.Base = function() {};
parentClass = method.$owner.superclass;
methodName = method.$name;
- if (!(methodName in parentClass)) {
- Ext.Error.raise({
- sourceClass: Ext.getClassName(this),
- sourceMethod: methodName,
- msg: "this.callParent() was called but there's no such method (" + methodName +
- ") found in the parent class (" + (Ext.getClassName(parentClass) || 'Object') + ")"
- });
- }
return parentClass[methodName].apply(this, args || []);
},
@@ -2724,22 +2850,6 @@ var Base = Ext.Base = function() {};
callOverridden: function(args) {
var method = this.callOverridden.caller;
- if (!method.$owner) {
- Ext.Error.raise({
- sourceClass: Ext.getClassName(this),
- sourceMethod: "callOverridden",
- msg: "Attempting to call a protected method from the public scope, which is not allowed"
- });
- }
-
- if (!method.$previous) {
- Ext.Error.raise({
- sourceClass: Ext.getClassName(this),
- sourceMethod: "callOverridden",
- msg: "this.callOverridden was called in '" + method.$name +
- "' but this method has never been overridden"
- });
- }
return method.$previous.apply(this, args || []);
},
@@ -2776,11 +2886,6 @@ var Base = Ext.Base = function() {};
};
}
- var className;
- className = Ext.getClassName(this);
- if (className) {
- fn.displayName = className + '#' + name;
- }
fn.$owner = this;
fn.$name = name;
@@ -2802,7 +2907,6 @@ var Base = Ext.Base = function() {};
implement: function(members) {
var prototype = this.prototype,
name, i, member, previous;
- var className = Ext.getClassName(this);
for (name in members) {
if (members.hasOwnProperty(name)) {
member = members[name];
@@ -2810,9 +2914,6 @@ var Base = Ext.Base = function() {};
if (typeof member === 'function') {
member.$owner = this;
member.$name = name;
- if (className) {
- member.displayName = className + '#' + name;
- }
}
prototype[name] = member;
@@ -3097,13 +3198,14 @@ var Base = Ext.Base = function() {};
index = Ext.Array.indexOf(defaultPreprocessors, relativeName);
if (index !== -1) {
- defaultPreprocessors.splice(Math.max(0, index + offset), 0, name);
+ Ext.Array.splice(defaultPreprocessors, Math.max(0, index + offset), 0, name);
}
return this;
}
});
+
Class.registerPreprocessor('extend', function(cls, data) {
var extend = data.extend,
base = Ext.Base,
@@ -3170,6 +3272,7 @@ var Base = Ext.Base = function() {};
}, true);
+
Class.registerPreprocessor('statics', function(cls, data) {
var statics = data.statics,
name;
@@ -3183,6 +3286,7 @@ var Base = Ext.Base = function() {};
delete data.statics;
});
+
Class.registerPreprocessor('inheritableStatics', function(cls, data) {
var statics = data.inheritableStatics,
inheritableStatics,
@@ -3205,12 +3309,14 @@ var Base = Ext.Base = function() {};
delete data.inheritableStatics;
});
+
Class.registerPreprocessor('mixins', function(cls, data) {
cls.mixin(data.mixins);
delete data.mixins;
});
+
Class.registerPreprocessor('config', function(cls, data) {
var prototype = cls.prototype;
@@ -3324,20 +3430,11 @@ var Base = Ext.Base = function() {};
instantiators: [],
-
- instantiationCounts: {},
isCreated: function(className) {
var i, ln, part, root, parts;
- if (typeof className !== 'string' || className.length < 1) {
- Ext.Error.raise({
- sourceClass: "Ext.ClassManager",
- sourceMethod: "exist",
- msg: "Invalid classname, must be a string and must not be empty"
- });
- }
if (this.classes.hasOwnProperty(className) || this.existCache.hasOwnProperty(className)) {
return true;
@@ -3369,13 +3466,6 @@ var Base = Ext.Base = function() {};
parseNamespace: function(namespace) {
- if (typeof namespace !== 'string') {
- Ext.Error.raise({
- sourceClass: "Ext.ClassManager",
- sourceMethod: "parseNamespace",
- msg: "Invalid namespace, must be a string"
- });
- }
var cache = this.namespaceParseCache;
@@ -3523,10 +3613,6 @@ var Base = Ext.Base = function() {};
}
if (alias && aliasToNameMap[alias] !== className) {
- if (aliasToNameMap.hasOwnProperty(alias) && Ext.isDefined(Ext.global.console)) {
- Ext.global.console.log("[Ext.ClassManager] Overriding existing alias: '" + alias + "' " +
- "of: '" + aliasToNameMap[alias] + "' with: '" + className + "'. Be sure it's intentional.");
- }
aliasToNameMap[alias] = className;
}
@@ -3576,13 +3662,6 @@ var Base = Ext.Base = function() {};
create: function(className, data, createdFn) {
var manager = this;
- if (typeof className !== 'string') {
- Ext.Error.raise({
- sourceClass: "Ext",
- sourceMethod: "define",
- msg: "Invalid class name '" + className + "' specified, must be a non-empty string"
- });
- }
data.$className = className;
@@ -3648,18 +3727,7 @@ var Base = Ext.Base = function() {};
if (!className) {
className = this.maps.aliasToName[alias];
- if (!className) {
- Ext.Error.raise({
- sourceClass: "Ext",
- sourceMethod: "createByAlias",
- msg: "Cannot create an instance of unrecognized alias: " + alias
- });
- }
- if (Ext.global.console) {
- Ext.global.console.warn("[Ext.Loader] Synchronously loading '" + className + "'; consider adding " +
- "Ext.require('" + alias + "') above Ext.onReady");
- }
Ext.syncRequire(className);
}
@@ -3677,13 +3745,6 @@ var Base = Ext.Base = function() {};
possibleName, cls;
if (typeof name !== 'function') {
- if ((typeof name !== 'string' || name.length < 1)) {
- Ext.Error.raise({
- sourceClass: "Ext",
- sourceMethod: "create",
- msg: "Invalid class name or alias '" + name + "' specified, must be a non-empty string"
- });
- }
cls = this.get(name);
}
@@ -3715,37 +3776,13 @@ var Base = Ext.Base = function() {};
if (!cls) {
- if (Ext.global.console) {
- Ext.global.console.warn("[Ext.Loader] Synchronously loading '" + name + "'; consider adding " +
- "Ext.require('" + ((possibleName) ? alias : name) + "') above Ext.onReady");
- }
Ext.syncRequire(name);
cls = this.get(name);
}
- if (!cls) {
- Ext.Error.raise({
- sourceClass: "Ext",
- sourceMethod: "create",
- msg: "Cannot create an instance of unrecognized class name / alias: " + alias
- });
- }
-
- if (typeof cls !== 'function') {
- Ext.Error.raise({
- sourceClass: "Ext",
- sourceMethod: "create",
- msg: "'" + name + "' is a singleton and cannot be instantiated"
- });
- }
-
- if (!this.instantiationCounts[name]) {
- this.instantiationCounts[name] = 0;
- }
- this.instantiationCounts[name]++;
return this.getInstantiator(args.length)(cls, args);
},
@@ -3821,7 +3858,7 @@ var Base = Ext.Base = function() {};
index = Ext.Array.indexOf(defaultPostprocessors, relativeName);
if (index !== -1) {
- defaultPostprocessors.splice(Math.max(0, index + offset), 0, name);
+ Ext.Array.splice(defaultPostprocessors, Math.max(0, index + offset), 0, name);
}
return this;
@@ -3833,13 +3870,6 @@ var Base = Ext.Base = function() {};
names = [],
name, alias, aliases, possibleName, regex, i, ln;
- if (typeof expression !== 'string' || expression.length < 1) {
- Ext.Error.raise({
- sourceClass: "Ext.ClassManager",
- sourceMethod: "getNamesByExpression",
- msg: "Expression " + expression + " is invalid, must be a non-empty string"
- });
- }
if (expression.indexOf('*') !== -1) {
expression = expression.replace(/\*/g, '(.*?)');
@@ -3885,6 +3915,7 @@ var Base = Ext.Base = function() {};
}
};
+
Manager.registerPostprocessor('alias', function(name, cls, data) {
var aliases = data.alias,
widgetPrefix = 'widget.',
@@ -3897,13 +3928,6 @@ var Base = Ext.Base = function() {};
for (i = 0, ln = aliases.length; i < ln; i++) {
alias = aliases[i];
- if (typeof alias !== 'string') {
- Ext.Error.raise({
- sourceClass: "Ext",
- sourceMethod: "define",
- msg: "Invalid alias of: '" + alias + "' for class: '" + name + "'; must be a valid string"
- });
- }
this.setAlias(cls, alias);
}
@@ -3920,11 +3944,13 @@ var Base = Ext.Base = function() {};
}
});
+
Manager.registerPostprocessor('singleton', function(name, cls, data, fn) {
fn.call(this, name, new cls(), data);
return false;
});
+
Manager.registerPostprocessor('alternateClassName', function(name, cls, data) {
var alternates = data.alternateClassName,
i, ln, alternate;
@@ -3936,13 +3962,6 @@ var Base = Ext.Base = function() {};
for (i = 0, ln = alternates.length; i < ln; i++) {
alternate = alternates[i];
- if (typeof alternate !== 'string') {
- Ext.Error.raise({
- sourceClass: "Ext",
- sourceMethod: "define",
- msg: "Invalid alternate of: '" + alternate + "' for class: '" + name + "'; must be a valid string"
- });
- }
this.set(alternate, cls);
}
@@ -4035,6 +4054,7 @@ var Base = Ext.Base = function() {};
namespace: alias(Manager, 'createNamespaces')
});
+
Ext.createWidget = Ext.widget;
@@ -4043,7 +4063,6 @@ var Base = Ext.Base = function() {};
Class.registerPreprocessor('className', function(cls, data) {
if (data.$className) {
cls.$className = data.$className;
- cls.displayName = cls.$className;
}
}, true);
@@ -4052,7 +4071,6 @@ var Base = Ext.Base = function() {};
})(Ext.Class, Ext.Function.alias);
-
(function(Manager, Class, flexSetter, alias) {
var
@@ -4210,7 +4228,7 @@ var Base = Ext.Base = function() {};
do {
if (Manager.isCreated(requires[j])) {
- requires.splice(j, 1);
+ Ext.Array.erase(requires, j, 1);
}
else {
j++;
@@ -4218,7 +4236,7 @@ var Base = Ext.Base = function() {};
} while (j < requires.length);
if (item.requires.length === 0) {
- this.queue.splice(i, 1);
+ Ext.Array.erase(this.queue, i, 1);
item.callback.call(item.scope);
this.refreshQueue();
break;
@@ -4466,48 +4484,7 @@ var Base = Ext.Base = function() {};
this.refreshQueue();
}
- if (this.numPendingFiles <= 1) {
- window.status = "Finished loading all dependencies, onReady fired!";
- }
- else {
- window.status = "Loading dependencies, " + this.numPendingFiles + " files left...";
- }
-
- if (!this.syncModeEnabled && this.numPendingFiles === 0 && this.isLoading && !this.hasFileLoadError) {
- var queue = this.queue,
- requires,
- i, ln, j, subLn, missingClasses = [], missingPaths = [];
- for (i = 0, ln = queue.length; i < ln; i++) {
- requires = queue[i].requires;
-
- for (j = 0, subLn = requires.length; j < ln; j++) {
- if (this.isFileLoaded[requires[j]]) {
- missingClasses.push(requires[j]);
- }
- }
- }
-
- if (missingClasses.length < 1) {
- return;
- }
-
- missingClasses = Ext.Array.filter(missingClasses, function(item) {
- return !this.requiresMap.hasOwnProperty(item);
- }, this);
-
- for (i = 0,ln = missingClasses.length; i < ln; i++) {
- missingPaths.push(this.classNameToFilePathMap[missingClasses[i]]);
- }
-
- Ext.Error.raise({
- sourceClass: "Ext.Loader",
- sourceMethod: "onFileLoaded",
- msg: "The following classes are not declared even if their files have been " +
- "loaded: '" + missingClasses.join("', '") + "'. Please check the source code of their " +
- "corresponding files for possible typos: '" + missingPaths.join("', '") + "'"
- });
- }
},
@@ -4515,13 +4492,6 @@ var Base = Ext.Base = function() {};
this.numPendingFiles--;
this.hasFileLoadError = true;
- Ext.Error.raise({
- sourceClass: "Ext.Loader",
- classToLoad: className,
- loadPath: filePath,
- loadingType: isSynchronous ? 'synchronous' : 'async',
- msg: errorMessage
- });
},
@@ -4619,6 +4589,7 @@ var Base = Ext.Base = function() {};
Loader.onReady(fn, scope, true, options);
};
+
Class.registerPreprocessor('loader', function(cls, data, continueFn) {
var me = this,
dependencies = [],
@@ -4664,37 +4635,6 @@ var Base = Ext.Base = function() {};
return;
}
- var deadlockPath = [],
- requiresMap = Loader.requiresMap,
- detectDeadlock;
-
-
-
- if (className) {
- requiresMap[className] = dependencies;
-
- detectDeadlock = function(cls) {
- deadlockPath.push(cls);
-
- if (requiresMap[cls]) {
- if (Ext.Array.contains(requiresMap[cls], className)) {
- Ext.Error.raise({
- sourceClass: "Ext.Loader",
- msg: "Deadlock detected while loading dependencies! '" + className + "' and '" +
- deadlockPath[1] + "' " + "mutually require each other. Path: " +
- deadlockPath.join(' -> ') + " -> " + deadlockPath[0]
- });
- }
-
- for (i = 0, ln = requiresMap[cls].length; i < ln; i++) {
- detectDeadlock(requiresMap[cls][i]);
- }
- }
- };
-
- detectDeadlock(className);
- }
-
Loader.require(dependencies, function() {
for (i = 0, ln = dependencyProperties.length; i < ln; i++) {
@@ -4737,6 +4677,7 @@ var Base = Ext.Base = function() {};
Class.setDefaultPreprocessorPosition('loader', 'after', 'className');
+
Manager.registerPostprocessor('uses', function(name, cls, data) {
var uses = Ext.Array.from(data.uses),
items = [],
@@ -4833,73 +4774,6 @@ Ext.Error = Ext.extend(Error, {
});
-(function () {
- var prevOnError, timer, errors = 0,
- extraordinarilyBad = /(out of stack)|(too much recursion)|(stack overflow)|(out of memory)/i,
- win = Ext.global;
-
- if (typeof window === 'undefined') {
- return;
- }
-
-
- function notify () {
- var counters = Ext.log.counters,
- supports = Ext.supports,
- hasOnError = supports && supports.WindowOnError;
-
-
- if (counters && (counters.error + counters.warn + counters.info + counters.log)) {
- var msg = [ 'Logged Errors:',counters.error, 'Warnings:',counters.warn,
- 'Info:',counters.info, 'Log:',counters.log].join(' ');
- if (errors) {
- msg = '*** Errors: ' + errors + ' - ' + msg;
- } else if (counters.error) {
- msg = '*** ' + msg;
- }
- win.status = msg;
- }
-
-
- if (!Ext.isDefined(Ext.Error.notify)) {
- Ext.Error.notify = Ext.isIE6 || Ext.isIE7;
- }
- if (Ext.Error.notify && (hasOnError ? errors : (counters && counters.error))) {
- Ext.Error.notify = false;
-
- if (timer) {
- win.clearInterval(timer);
- timer = null;
- }
-
- alert('Unhandled error on page: See console or log');
- poll();
- }
- }
-
-
-
-
- function poll () {
- timer = win.setInterval(notify, 1000);
- }
-
-
-
- prevOnError = win.onerror || Ext.emptyFn;
- win.onerror = function (message) {
- ++errors;
-
- if (!extraordinarilyBad.test(message)) {
-
-
- notify();
- }
-
- return prevOnError.apply(this, arguments);
- };
- poll();
-})();
@@ -5028,7 +4902,7 @@ Ext.JSON = new(function() {
Ext.Error.raise({
sourceClass: "Ext.JSON",
sourceMethod: "decode",
- msg: "You're trying to decode and invalid JSON String: " + json
+ msg: "You're trying to decode an invalid JSON String: " + json
});
}
};
@@ -5062,15 +4936,23 @@ Ext.apply(Ext, {
id: function(el, prefix) {
+ var me = this,
+ sandboxPrefix = '';
el = Ext.getDom(el, true) || {};
if (el === document) {
- el.id = this.documentId;
+ el.id = me.documentId;
}
else if (el === window) {
- el.id = this.windowId;
+ el.id = me.windowId;
}
if (!el.id) {
- el.id = (prefix || "ext-gen") + (++Ext.idSeed);
+ if (me.isSandboxed) {
+ if (!me.uniqueGlobalNamespace) {
+ me.getUniqueGlobalNamespace();
+ }
+ sandboxPrefix = me.uniqueGlobalNamespace + '-';
+ }
+ el.id = sandboxPrefix + (prefix || "ext-gen") + (++Ext.idSeed);
}
return el.id;
},
@@ -5195,7 +5077,7 @@ window.undefined = window.undefined;
isWindows = check(/windows|win32/),
isMac = check(/macintosh|mac os x/),
isLinux = check(/linux/),
- scrollWidth = null,
+ scrollbarSize = null,
webKitVersion = isWebKit && (/webkit\/(\d+\.\d+)/.exec(Ext.userAgent));
@@ -5203,7 +5085,7 @@ window.undefined = window.undefined;
document.execCommand("BackgroundImageCache", false, true);
} catch(e) {}
- Ext.setVersion('extjs', '4.0.1');
+ Ext.setVersion('extjs', '4.0.2');
Ext.apply(Ext, {
SSL_SECURE_URL : Ext.isSecure && isIE ? 'javascript:""' : 'about:blank',
@@ -5372,27 +5254,37 @@ window.undefined = window.undefined;
},
- getScrollBarWidth: function(force){
+ getScrollbarSize: function (force) {
if(!Ext.isReady){
return 0;
}
- if(force === true || scrollWidth === null){
+ if(force === true || scrollbarSize === null){
- var cssClass = Ext.isIE9 ? '' : Ext.baseCSSPrefix + 'hide-offsets';
+ var cssClass = Ext.isIE9 ? '' : Ext.baseCSSPrefix + 'hide-offsets',
- var div = Ext.getBody().createChild('<div class="' + cssClass + '" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'),
- child = div.child('div', true);
- var w1 = child.offsetWidth;
+ div = Ext.getBody().createChild('<div class="' + cssClass + '" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'),
+ child = div.child('div', true),
+ w1 = child.offsetWidth;
+
div.setStyle('overflow', (Ext.isWebKit || Ext.isGecko) ? 'auto' : 'scroll');
- var w2 = child.offsetWidth;
+
+ var w2 = child.offsetWidth, width = w1 - w2;
div.remove();
+
- scrollWidth = w1 - w2 + 2;
+ scrollbarSize = { width: width, height: width };
}
- return scrollWidth;
+
+ return scrollbarSize;
+ },
+
+
+ getScrollBarWidth: function(force){
+ var size = Ext.getScrollbarSize(force);
+ return size.width + 2;
},
@@ -5409,7 +5301,7 @@ window.undefined = window.undefined;
},
- destroyMembers : function(o, arg1, arg2, etc){
+ destroyMembers : function(o){
for (var i = 1, a = arguments, len = a.length; i < len; i++) {
Ext.destroy(o[a[i]]);
delete o[a[i]];
@@ -5418,104 +5310,6 @@ window.undefined = window.undefined;
log : function (message) {
- var options, dump,
- con = Ext.global.console,
- log = Ext.log,
- level = 'log',
- stack,
- members,
- member;
-
- if (!Ext.isString(message)) {
- options = message;
- message = options.msg || '';
- level = options.level || level;
- dump = options.dump;
- stack = options.stack;
-
- if (dump && !(con && con.dir)) {
- members = [];
-
-
-
- Ext.Object.each(dump, function (name, value) {
- if (typeof(value) === "function") {
- return;
- }
-
- if (!Ext.isDefined(value) || value === null ||
- Ext.isDate(value) ||
- Ext.isString(value) || (typeof(value) == "number") ||
- Ext.isBoolean(value)) {
- member = Ext.encode(value);
- } else if (Ext.isArray(value)) {
- member = '[ ]';
- } else if (Ext.isObject(value)) {
- member = '{ }';
- } else {
- member = 'undefined';
- }
- members.push(Ext.encode(name) + ': ' + member);
- });
-
- if (members.length) {
- message += ' \nData: {\n ' + members.join(',\n ') + '\n}';
- }
- dump = null;
- }
- }
-
- if (arguments.length > 1) {
- message += Array.prototype.slice.call(arguments, 1).join('');
- }
-
-
-
-
- if (con) {
- if (con[level]) {
- con[level](message);
- } else {
- con.log(message);
- }
-
- if (dump) {
- con.dir(dump);
- }
-
- if (stack && con.trace) {
-
- if (!con.firebug || level != 'error') {
- con.trace();
- }
- }
- } else {
-
- if (level != 'log') {
- message = level.toUpperCase() + ': ' + message;
- }
-
- if (Ext.isOpera) {
- opera.postError(message);
- } else {
- var out = log.out || (log.out = []),
- max = log.max || (log.max = 100);
-
- if (out.length >= max) {
-
-
- out.splice(0, out.length - 3 * Math.floor(max / 4));
- }
-
- out.push(message);
- }
- }
-
-
- var counters = log.counters ||
- (log.counters = { error: 0, warn: 0, info: 0, log: 0 });
-
- ++counters[level];
},
@@ -5738,8 +5532,7 @@ Ext.application = function(config) {
},
- number:
- function(v, formatString) {
+ number: function(v, formatString) {
if (!formatString) {
return v;
}
@@ -5776,13 +5569,6 @@ Ext.application = function(config) {
if (1 < psplit.length) {
v = v.toFixed(psplit[1].length);
} else if(2 < psplit.length) {
- Ext.Error.raise({
- sourceClass: "Ext.util.Format",
- sourceMethod: "number",
- value: v,
- formatString: formatString,
- msg: "Invalid number format, should have no more than 1 decimal"
- });
} else {
v = v.toFixed(0);
}
@@ -5816,6 +5602,11 @@ Ext.application = function(config) {
fnum = psplit[0] + dec + psplit[1];
}
}
+
+ if (neg) {
+
+ neg = fnum.replace(/[^1-9]/g, '') !== '';
+ }
return (neg ? '-' : '') + formatString.replace(/[\d,?\.?]+/, fnum);
},
@@ -6703,13 +6494,6 @@ Ext.core.DomHelper = function(){
return el[rangeEl];
}
}
- Ext.Error.raise({
- sourceClass: 'Ext.core.DomHelper',
- sourceMethod: 'insertHtml',
- htmlToInsert: html,
- targetElement: el,
- msg: 'Illegal insertion point reached: "' + where + '"'
- });
},
@@ -7188,11 +6972,6 @@ Ext.core.DomQuery = Ext.DomQuery = function(){
}
if(!matched){
- Ext.Error.raise({
- sourceClass: 'Ext.DomQuery',
- sourceMethod: 'compile',
- msg: 'Error parsing selector. Parsing failed at "' + path + '"'
- });
}
}
if(modeMatch[1]){
@@ -7226,11 +7005,6 @@ Ext.core.DomQuery = Ext.DomQuery = function(){
if(!cache[subPath]){
cache[subPath] = Ext.DomQuery.compile(subPath);
if(!cache[subPath]){
- Ext.Error.raise({
- sourceClass: 'Ext.DomQuery',
- sourceMethod: 'jsSelect',
- msg: subPath + ' is not a valid selector'
- });
}
}
var result = cache[subPath](root);
@@ -7733,9 +7507,6 @@ Ext.query = Ext.DomQuery.select;
if (!unitPattern.test(size)) {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.warn("Warning, size detected as NaN on Element.addUnits.");
- }
return size || '';
}
return size;
@@ -8321,11 +8092,11 @@ Ext.core.Element.addMethods({
cls = [],
space = ((me.dom.className.replace(trimRe, '') == '') ? "" : " "),
i, len, v;
- if (!Ext.isDefined(className)) {
+ if (className === undefined) {
return me;
}
- if (!Ext.isArray(className)) {
+ if (Object.prototype.toString.call(className) !== '[object Array]') {
if (typeof className === 'string') {
className = className.replace(trimRe, '').split(spacesRe);
if (className.length === 1) {
@@ -8355,10 +8126,10 @@ Ext.core.Element.addMethods({
removeCls : function(className){
var me = this,
i, idx, len, cls, elClasses;
- if (!Ext.isDefined(className)) {
+ if (className === undefined) {
return me;
}
- if (!Ext.isArray(className)){
+ if (Object.prototype.toString.call(className) !== '[object Array]') {
className = className.replace(trimRe, '').split(spacesRe);
}
if (me.dom && me.dom.className) {
@@ -8369,7 +8140,7 @@ Ext.core.Element.addMethods({
cls = cls.replace(trimRe, '');
idx = Ext.Array.indexOf(elClasses, cls);
if (idx != -1) {
- elClasses.splice(idx, 1);
+ Ext.Array.erase(elClasses, idx, 1);
}
}
}
@@ -8515,8 +8286,7 @@ Ext.core.Element.addMethods({
if (!me.dom) {
return me;
}
-
- if (!Ext.isObject(prop)) {
+ if (typeof prop === 'string') {
tmp = {};
tmp[prop] = value;
prop = tmp;
@@ -8869,7 +8639,8 @@ Ext.core.Element.addMethods({
setSize : function(width, height, animate){
var me = this;
- if (Ext.isObject(width)){
+ if (Ext.isObject(width)) {
+ animate = height;
height = width.height;
width = width.width;
}
@@ -8880,7 +8651,7 @@ Ext.core.Element.addMethods({
me.dom.style.height = me.addUnits(height);
}
else {
- if (!Ext.isObject(animate)) {
+ if (animate === true) {
animate = {};
}
me.animate(Ext.applyIf({
@@ -10241,7 +10012,7 @@ Ext.CompositeElementLite.prototype = {
d.parentNode.insertBefore(replacement, d);
Ext.removeNode(d);
}
- this.elements.splice(index, 1, replacement);
+ Ext.Array.splice(this.elements, index, 1, replacement);
}
return this;
},
@@ -10286,13 +10057,6 @@ Ext.core.Element.select = function(selector, root){
}else if(selector.length !== undefined){
els = selector;
}else{
- Ext.Error.raise({
- sourceClass: "Ext.core.Element",
- sourceMethod: "select",
- selector: selector,
- root: root,
- msg: "Invalid selector specified: " + selector
- });
}
return new Ext.CompositeElementLite(els);
};
@@ -10368,13 +10132,6 @@ Ext.require('Ext.util.DelayedTask', function() {
listener;
scope = scope || me.observable;
- if (!fn) {
- Ext.Error.raise({
- sourceClass: Ext.getClassName(this.observable),
- sourceMethod: "addListener",
- msg: "The specified callback function is undefined"
- });
- }
if (!me.isListening(fn, scope)) {
listener = me.createListener(fn, scope, options);
@@ -10466,7 +10223,7 @@ Ext.require('Ext.util.DelayedTask', function() {
}
- me.listeners.splice(index, 1);
+ Ext.Array.erase(me.listeners, index, 1);
return true;
}
@@ -10734,7 +10491,7 @@ Ext.EventManager = {
addListener: function(element, eventName, fn, scope, options){
- if (Ext.isObject(eventName)) {
+ if (typeof eventName !== 'string') {
this.prepareListenerConfig(element, eventName);
return;
}
@@ -10743,24 +10500,6 @@ Ext.EventManager = {
bind,
wrap;
- if (!dom){
- Ext.Error.raise({
- sourceClass: 'Ext.EventManager',
- sourceMethod: 'addListener',
- targetElement: element,
- eventName: eventName,
- msg: 'Error adding "' + eventName + '\" listener for nonexistent element "' + element + '"'
- });
- }
- if (!fn) {
- Ext.Error.raise({
- sourceClass: 'Ext.EventManager',
- sourceMethod: 'addListener',
- targetElement: element,
- eventName: eventName,
- msg: 'Error adding "' + eventName + '\" listener. The handler function is undefined.'
- });
- }
options = options || {};
@@ -10790,7 +10529,7 @@ Ext.EventManager = {
removeListener : function(element, eventName, fn, scope) {
- if (Ext.isObject(eventName)) {
+ if (typeof eventName !== 'string') {
this.prepareListenerConfig(element, eventName, true);
return;
}
@@ -10834,7 +10573,7 @@ Ext.EventManager = {
}
- cache.splice(i, 1);
+ Ext.Array.erase(cache, i, 1);
}
}
},
@@ -10877,7 +10616,7 @@ Ext.EventManager = {
createListenerWrap : function(dom, ename, fn, scope, options) {
- options = !Ext.isObject(options) ? {} : options;
+ options = options || {};
var f, gen;
@@ -10952,12 +10691,19 @@ Ext.EventManager = {
getEventListenerCache : function(element, eventName) {
+ if (!element) {
+ return [];
+ }
+
var eventCache = this.getElementEventCache(element);
return eventCache[eventName] || (eventCache[eventName] = []);
},
getElementEventCache : function(element) {
+ if (!element) {
+ return {};
+ }
var elementCache = Ext.cache[this.getId(element)];
return elementCache.events || (elementCache.events = {});
},
@@ -11172,7 +10918,7 @@ Ext.EventManager.un = Ext.EventManager.removeListener;
var bd = document.body || document.getElementsByTagName('body')[0],
baseCSSPrefix = Ext.baseCSSPrefix,
- cls = [],
+ cls = [baseCSSPrefix + 'body'],
htmlCls = [],
html;
@@ -11448,6 +11194,44 @@ Ext.define('Ext.EventObjectImpl', {
F11: 122,
F12: 123,
+
+ WHEEL_SCALE: (function () {
+ var scale;
+
+ if (Ext.isGecko) {
+
+ scale = 3;
+ } else if (Ext.isMac) {
+
+
+
+
+ if (Ext.isSafari && Ext.webKitVersion >= 532.0) {
+
+
+
+
+
+
+ scale = 120;
+ } else {
+
+
+ scale = 12;
+ }
+
+
+
+
+
+ scale *= 3;
+ } else {
+
+ scale = 120;
+ }
+
+ return scale;
+ })(),
clickRe: /(dbl)?click/,
@@ -11613,16 +11397,58 @@ Ext.define('Ext.EventObjectImpl', {
},
- getWheelDelta : function(){
- var event = this.browserEvent,
- delta = 0;
+ correctWheelDelta : function (delta) {
+ var scale = this.WHEEL_SCALE,
+ ret = Math.round(delta / scale + 0.5);
+
+ if (!ret && delta) {
+ ret = (delta < 0) ? -1 : 1;
+ }
+
+ return ret;
+ },
+
+
+ getWheelDeltas : function () {
+ var me = this,
+ event = me.browserEvent,
+ dx = 0, dy = 0;
- if (event.wheelDelta) {
- delta = event.wheelDelta / 120;
- } else if (event.detail){
- delta = -event.detail / 3;
+ if (Ext.isDefined(event.wheelDeltaX)) {
+ dx = event.wheelDeltaX;
+ dy = event.wheelDeltaY;
+ } else if (event.wheelDelta) {
+ dy = event.wheelDelta;
+ } else if (event.detail) {
+ dy = -event.detail;
+
+
+
+ if (dy > 100) {
+ dy = 3;
+ } else if (dy < -100) {
+ dy = -3;
+ }
+
+
+
+ if (Ext.isDefined(event.axis) && event.axis === event.HORIZONTAL_AXIS) {
+ dx = dy;
+ dy = 0;
+ }
}
- return delta;
+
+ return {
+ x: me.correctWheelDelta(dx),
+ y: me.correctWheelDelta(dy)
+ };
+ },
+
+
+ getWheelDelta : function(){
+ var deltas = this.getWheelDeltas();
+
+ return deltas.y;
},
@@ -11743,7 +11569,7 @@ Ext.define('Ext.EventObjectImpl', {
return target;
}
- }
+ };
} else if (document.createEventObject) {
var crazyIEButtons = { 0: 1, 1: 4, 2: 2 };
@@ -11871,7 +11697,6 @@ Ext.define('Ext.EventObjectImpl', {
}
function cannotInject (target, srcEvent) {
-
}
return function (target) {
@@ -12446,11 +12271,6 @@ Ext.core.Element.addMethods({
el = Ext.get(el);
if(!el || !el.dom){
- Ext.Error.raise({
- sourceClass: 'Ext.core.Element',
- sourceMethod: 'getAlignVector',
- msg: 'Attempted to align an element that doesn\'t exist'
- });
}
elRegion = el.getRegion();
@@ -12461,11 +12281,6 @@ Ext.core.Element.addMethods({
el = Ext.get(el);
if(!el || !el.dom){
- Ext.Error.raise({
- sourceClass: 'Ext.core.Element',
- sourceMethod: 'getAlignToXY',
- msg: 'Attempted to align an element that doesn\'t exist'
- });
}
o = o || [0,0];
@@ -12500,14 +12315,6 @@ Ext.core.Element.addMethods({
m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);
if(!m){
- Ext.Error.raise({
- sourceClass: 'Ext.core.Element',
- sourceMethod: 'getAlignToXY',
- el: el,
- position: p,
- offset: o,
- msg: 'Attemmpted to align an element with an invalid position: "' + p + '"'
- });
}
p1 = m[1];
@@ -13381,7 +13188,7 @@ Ext.apply(Ext.CompositeElementLite.prototype, {
Ext.removeNode(el);
}
}
- els.splice(val, 1);
+ Ext.Array.erase(els, val, 1);
}
});
return this;
@@ -13422,14 +13229,6 @@ Ext.core.Element.select = function(selector, unique, root){
}else if(selector.length !== undefined){
els = selector;
}else{
- Ext.Error.raise({
- sourceClass: "Ext.core.Element",
- sourceMethod: "select",
- selector: selector,
- unique: unique,
- root: root,
- msg: "Invalid selector specified: " + selector
- });
}
return (unique === true) ? new Ext.CompositeElement(els) : new Ext.CompositeElementLite(els);
};
@@ -13440,7 +13239,6 @@ Ext.select = Ext.core.Element.select;
-
Ext.define('Ext.util.Observable', {
@@ -13503,7 +13301,7 @@ Ext.define('Ext.util.Observable', {
managedListeners = me.managedListeners = me.managedListeners || [],
config;
- if (Ext.isObject(ename)) {
+ if (typeof ename !== 'string') {
options = ename;
for (ename in options) {
if (options.hasOwnProperty(ename)) {
@@ -13528,7 +13326,7 @@ Ext.define('Ext.util.Observable', {
},
- removeManagedListener : function(item, ename, fn, scope) {
+ removeManagedListener : function(item, ename, fn, scope) {
var me = this,
options,
config,
@@ -13536,7 +13334,7 @@ Ext.define('Ext.util.Observable', {
length,
i;
- if (Ext.isObject(ename)) {
+ if (typeof ename !== 'string') {
options = ename;
for (ename in options) {
if (options.hasOwnProperty(ename)) {
@@ -13569,20 +13367,23 @@ Ext.define('Ext.util.Observable', {
if (queue) {
queue.push(args);
}
- } else if (event && Ext.isObject(event) && event.bubble) {
- if (event.fire.apply(event, args.slice(1)) === false) {
- return false;
- }
- parent = me.getBubbleTarget && me.getBubbleTarget();
- if (parent && parent.isObservable) {
- if (!parent.events[ename] || !Ext.isObject(parent.events[ename]) || !parent.events[ename].bubble) {
- parent.enableBubble(ename);
+ } else if (event && event !== true) {
+ if (event.bubble) {
+ if (event.fire.apply(event, args.slice(1)) === false) {
+ return false;
}
- return parent.fireEvent.apply(parent, args);
+ parent = me.getBubbleTarget && me.getBubbleTarget();
+ if (parent && parent.isObservable) {
+ if (!parent.events[ename] || parent.events[ename] === true || !parent.events[ename].bubble) {
+ parent.enableBubble(ename);
+ }
+ return parent.fireEvent.apply(parent, args);
+ }
+ }
+ else {
+ args.shift();
+ ret = event.fire.apply(event, args);
}
- } else if (event && Ext.isObject(event)) {
- args.shift();
- ret = event.fire.apply(event, args);
}
return ret;
},
@@ -13593,7 +13394,7 @@ Ext.define('Ext.util.Observable', {
config,
event;
- if (Ext.isObject(ename)) {
+ if (typeof ename !== 'string') {
options = ename;
for (ename in options) {
if (options.hasOwnProperty(ename)) {
@@ -13622,7 +13423,7 @@ Ext.define('Ext.util.Observable', {
event,
options;
- if (Ext.isObject(ename)) {
+ if (typeof ename !== 'string') {
options = ename;
for (ename in options) {
if (options.hasOwnProperty(ename)) {
@@ -13659,12 +13460,6 @@ Ext.define('Ext.util.Observable', {
this.clearManagedListeners();
},
- purgeListeners : function() {
- if (Ext.global.console) {
- Ext.global.console.warn('Observable: purgeListeners has been deprecated. Please use clearListeners.');
- }
- return this.clearListeners.apply(this, arguments);
- },
clearManagedListeners : function() {
@@ -13689,12 +13484,6 @@ Ext.define('Ext.util.Observable', {
}
},
- purgeManagedListeners : function() {
- if (Ext.global.console) {
- Ext.global.console.warn('Observable: purgeManagedListeners has been deprecated. Please use clearManagedListeners.');
- }
- return this.clearManagedListeners.apply(this, arguments);
- },
addEvents: function(o) {
@@ -13787,14 +13576,15 @@ Ext.define('Ext.util.Observable', {
}
}
}, function() {
-
-
-
this.createAlias({
+
on: 'addListener',
+
un: 'removeListener',
+
mon: 'addManagedListener',
+
mun: 'removeManagedListener'
});
@@ -13894,13 +13684,13 @@ Ext.define('Ext.util.Observable', {
i, len;
for(i = 0, len = e.before.length; i < len; i++){
if(e.before[i].fn == fn && e.before[i].scope == scope){
- e.before.splice(i, 1);
+ Ext.Array.erase(e.before, i, 1);
return;
}
}
for(i = 0, len = e.after.length; i < len; i++){
if(e.after[i].fn == fn && e.after[i].scope == scope){
- e.after.splice(i, 1);
+ Ext.Array.erase(e.after, i, 1);
return;
}
}
@@ -13984,11 +13774,13 @@ Ext.define('Ext.util.Animate', {
getActiveAnimation: function() {
return Ext.fx.Manager.getActiveAnimation(this.id);
}
+}, function(){
+
+ Ext.applyIf(Ext.core.Element.prototype, this.prototype);
+
+ Ext.CompositeElementLite.importElementMethods();
});
-
-Ext.applyIf(Ext.core.Element.prototype, Ext.util.Animate.prototype);
-
Ext.define('Ext.state.Provider', {
mixins: {
observable: 'Ext.util.Observable'
@@ -14129,8 +13921,12 @@ Ext.define('Ext.util.HashMap', {
observable: 'Ext.util.Observable'
},
+
constructor: function(config) {
- var me = this;
+ config = config || {};
+
+ var me = this,
+ keyFn = config.keyFn;
me.addEvents(
@@ -14145,6 +13941,10 @@ Ext.define('Ext.util.HashMap', {
me.mixins.observable.constructor.call(me, config);
me.clear(true);
+
+ if (keyFn) {
+ me.getKey = keyFn;
+ }
},
@@ -14431,7 +14231,6 @@ Ext.define('Ext.Template', {
/**
* Compiles the template into an internal function, eliminating the RegEx overhead.
* @return {Ext.Template} this
- * @hide repeat doc
*/
compile: function() {
var me = this,
@@ -14546,78 +14345,73 @@ Ext.define('Ext.Template', {
/**
* @class Ext.ComponentQuery
* @extends Object
+ * @singleton
*
* Provides searching of Components within Ext.ComponentManager (globally) or a specific
* Ext.container.Container on the document with a similar syntax to a CSS selector.
*
* Components can be retrieved by using their {@link Ext.Component xtype} with an optional . prefix
-<ul>
- <li>component or .component</li>
- <li>gridpanel or .gridpanel</li>
-</ul>
+ *
+ * - `component` or `.component`
+ * - `gridpanel` or `.gridpanel`
*
* An itemId or id must be prefixed with a #
-<ul>
- <li>#myContainer</li>
-</ul>
*
+ * - `#myContainer`
*
* Attributes must be wrapped in brackets
-<ul>
- <li>component[autoScroll]</li>
- <li>panel[title="Test"]</li>
-</ul>
*
- * Member expressions from candidate Components may be tested. If the expression returns a <i>truthy</i> value,
- * the candidate Component will be included in the query:<pre><code>
-var disabledFields = myFormPanel.query("{isDisabled()}");
-</code></pre>
+ * - `component[autoScroll]`
+ * - `panel[title="Test"]`
+ *
+ * Member expressions from candidate Components may be tested. If the expression returns a *truthy* value,
+ * the candidate Component will be included in the query:
+ *
+ * var disabledFields = myFormPanel.query("{isDisabled()}");
+ *
+ * Pseudo classes may be used to filter results in the same way as in {@link Ext.DomQuery DomQuery}:
+ *
+ * // Function receives array and returns a filtered array.
+ * Ext.ComponentQuery.pseudos.invalid = function(items) {
+ * var i = 0, l = items.length, c, result = [];
+ * for (; i < l; i++) {
+ * if (!(c = items[i]).isValid()) {
+ * result.push(c);
+ * }
+ * }
+ * return result;
+ * };
+ *
+ * var invalidFields = myFormPanel.query('field:invalid');
+ * if (invalidFields.length) {
+ * invalidFields[0].getEl().scrollIntoView(myFormPanel.body);
+ * for (var i = 0, l = invalidFields.length; i < l; i++) {
+ * invalidFields[i].getEl().frame("red");
+ * }
+ * }
+ *
+ * Default pseudos include:
*
- * Pseudo classes may be used to filter results in the same way as in {@link Ext.DomQuery DomQuery}:<code><pre>
-// Function receives array and returns a filtered array.
-Ext.ComponentQuery.pseudos.invalid = function(items) {
- var i = 0, l = items.length, c, result = [];
- for (; i < l; i++) {
- if (!(c = items[i]).isValid()) {
- result.push(c);
- }
- }
- return result;
-};
-
-var invalidFields = myFormPanel.query('field:invalid');
-if (invalidFields.length) {
- invalidFields[0].getEl().scrollIntoView(myFormPanel.body);
- for (var i = 0, l = invalidFields.length; i < l; i++) {
- invalidFields[i].getEl().frame("red");
- }
-}
-</pre></code>
- * <p>
- * Default pseudos include:<br />
* - not
- * </p>
*
* Queries return an array of components.
* Here are some example queries.
-<pre><code>
- // retrieve all Ext.Panels in the document by xtype
- var panelsArray = Ext.ComponentQuery.query('panel');
-
- // retrieve all Ext.Panels within the container with an id myCt
- var panelsWithinmyCt = Ext.ComponentQuery.query('#myCt panel');
-
- // retrieve all direct children which are Ext.Panels within myCt
- var directChildPanel = Ext.ComponentQuery.query('#myCt > panel');
-
- // retrieve all gridpanels and listviews
- var gridsAndLists = Ext.ComponentQuery.query('gridpanel, listview');
-</code></pre>
-
-For easy access to queries based from a particular Container see the {@link Ext.container.Container#query},
-{@link Ext.container.Container#down} and {@link Ext.container.Container#child} methods. Also see
-{@link Ext.Component#up}.
- * @singleton
+ *
+ * // retrieve all Ext.Panels in the document by xtype
+ * var panelsArray = Ext.ComponentQuery.query('panel');
+ *
+ * // retrieve all Ext.Panels within the container with an id myCt
+ * var panelsWithinmyCt = Ext.ComponentQuery.query('#myCt panel');
+ *
+ * // retrieve all direct children which are Ext.Panels within myCt
+ * var directChildPanel = Ext.ComponentQuery.query('#myCt > panel');
+ *
+ * // retrieve all grids and trees
+ * var gridsAndTrees = Ext.ComponentQuery.query('gridpanel, treepanel');
+ *
+ * For easy access to queries based from a particular Container see the {@link Ext.container.Container#query},
+ * {@link Ext.container.Container#down} and {@link Ext.container.Container#child} methods. Also see
+ * {@link Ext.Component#up}.
*/
Ext.define('Ext.ComponentQuery', {
singleton: true,
@@ -14896,15 +14690,20 @@ Ext.define('Ext.ComponentQuery', {
},
/**
- * <p>Returns an array of matched Components from within the passed root object.</p>
- * <p>This method filters returned Components in a similar way to how CSS selector based DOM
- * queries work using a textual selector string.</p>
- * <p>See class summary for details.</p>
- * @param selector The selector string to filter returned Components
- * @param root <p>The Container within which to perform the query. If omitted, all Components
- * within the document are included in the search.</p>
- * <p>This parameter may also be an array of Components to filter according to the selector.</p>
- * @returns {Array} The matched Components.
+ * Returns an array of matched Components from within the passed root object.
+ *
+ * This method filters returned Components in a similar way to how CSS selector based DOM
+ * queries work using a textual selector string.
+ *
+ * See class summary for details.
+ *
+ * @param {String} selector The selector string to filter returned Components
+ * @param {Ext.container.Container} root The Container within which to perform the query.
+ * If omitted, all Components within the document are included in the search.
+ *
+ * This parameter may also be an array of Components to filter according to the selector.</p>
+ * @returns {[Ext.Component]} The matched Components.
+ *
* @member Ext.ComponentQuery
*/
query: function(selector, root) {
@@ -14943,8 +14742,8 @@ Ext.define('Ext.ComponentQuery', {
/**
* Tests whether the passed Component matches the selector string.
- * @param component The Component to test
- * @param selector The selector string to test against.
+ * @param {Ext.Component} component The Component to test
+ * @param {String} selector The selector string to test against.
* @return {Boolean} True if the Component matches the selector.
* @member Ext.ComponentQuery
*/
@@ -15036,10 +14835,6 @@ Ext.define('Ext.ComponentQuery', {
selector = selector.replace(selectorMatch[0], '');
break; // Break on match
}
- // Exhausted all matches: It's an error
- if (i === (length - 1)) {
- Ext.Error.raise('Invalid ComponentQuery selector: "' + arguments[0] + '"');
- }
}
}
@@ -15098,8 +14893,6 @@ var longNames = allNames.filter(longNameFilter);
//a new MixedCollection with the 2 people of age 24:
var youngFolk = allNames.filter(ageFilter);
</code></pre>
- * @constructor
- * @param {Object} config Config object
*/
Ext.define('Ext.util.Filter', {
@@ -15107,7 +14900,7 @@ Ext.define('Ext.util.Filter', {
/* End Definitions */
/**
- * @cfg {String} property The property to filter on. Required unless a {@link #filter} is passed
+ * @cfg {String} property The property to filter on. Required unless a {@link #filterFn} is passed
*/
/**
@@ -15135,7 +14928,11 @@ Ext.define('Ext.util.Filter', {
* @cfg {String} root Optional root property. This is mostly useful when filtering a Store, in which case we set the
* root to 'data' to make the filter pull the {@link #property} out of the data object of each item
*/
-
+
+ /**
+ * Creates new Filter.
+ * @param {Object} config (optional) Config object
+ */
constructor: function(config) {
Ext.apply(this, config);
@@ -15213,16 +15010,76 @@ Ext.define('Ext.util.Filter', {
/**
* @class Ext.util.Sorter
* @extends Object
- * Represents a single sorter that can be applied to a Store
+
+Represents a single sorter that can be applied to a Store. The sorter is used
+to compare two values against each other for the purpose of ordering them. Ordering
+is achieved by specifying either:
+- {@link #property A sorting property}
+- {@link #sorterFn A sorting function}
+
+As a contrived example, we can specify a custom sorter that sorts by rank:
+
+ Ext.define('Person', {
+ extend: 'Ext.data.Model',
+ fields: ['name', 'rank']
+ });
+
+ Ext.create('Ext.data.Store', {
+ model: 'Person',
+ proxy: 'memory',
+ sorters: [{
+ sorterFn: function(o1, o2){
+ var getRank = function(o){
+ var name = o.get('rank');
+ if (name === 'first') {
+ return 1;
+ } else if (name === 'second') {
+ return 2;
+ } else {
+ return 3;
+ }
+ },
+ rank1 = getRank(o1),
+ rank2 = getRank(o2);
+
+ if (rank1 === rank2) {
+ return 0;
+ }
+
+ return rank1 < rank2 ? -1 : 1;
+ }
+ }],
+ data: [{
+ name: 'Person1',
+ rank: 'second'
+ }, {
+ name: 'Person2',
+ rank: 'third'
+ }, {
+ name: 'Person3',
+ rank: 'first'
+ }]
+ });
+
+ * @markdown
*/
Ext.define('Ext.util.Sorter', {
/**
- * @cfg {String} property The property to sort by. Required unless {@link #sorter} is provided
+ * @cfg {String} property The property to sort by. Required unless {@link #sorterFn} is provided.
+ * The property is extracted from the object directly and compared for sorting using the built in
+ * comparison operators.
*/
/**
- * @cfg {Function} sorterFn A specific sorter function to execute. Can be passed instead of {@link #property}
+ * @cfg {Function} sorterFn A specific sorter function to execute. Can be passed instead of {@link #property}.
+ * This sorter function allows for any kind of custom/complex comparisons.
+ * The sorterFn receives two arguments, the objects being compared. The function should return:
+ * <ul>
+ * <li>-1 if o1 is "less than" o2</li>
+ * <li>0 if o1 is "equal" to o2</li>
+ * <li>1 if o1 is "greater than" o2</li>
+ * </ul>
*/
/**
@@ -15246,9 +15103,6 @@ Ext.define('Ext.util.Sorter', {
Ext.apply(me, config);
- if (me.property == undefined && me.sorterFn == undefined) {
- Ext.Error.raise("A Sorter requires either a property or a sorter function");
- }
me.updateSortFunction();
},
@@ -15296,25 +15150,37 @@ Ext.define('Ext.util.Sorter', {
* @return {Object} The root property of the object
*/
getRoot: function(item) {
- return this.root == undefined ? item : item[this.root];
+ return this.root === undefined ? item : item[this.root];
},
- // @TODO: Add docs for these three methods
+ /**
+ * Set the sorting direction for this sorter.
+ * @param {String} direction The direction to sort in. Should be either 'ASC' or 'DESC'.
+ */
setDirection: function(direction) {
var me = this;
me.direction = direction;
me.updateSortFunction();
},
+ /**
+ * Toggles the sorting direction for this sorter.
+ */
toggle: function() {
var me = this;
me.direction = Ext.String.toggle(me.direction, "ASC", "DESC");
me.updateSortFunction();
},
- updateSortFunction: function() {
+ /**
+ * Update the sort function for this sorter.
+ * @param {Function} fn (Optional) A new sorter function for this sorter. If not specified it will use the
+ * default sorting function.
+ */
+ updateSortFunction: function(fn) {
var me = this;
- me.sort = me.createSortFunction(me.sorterFn || me.defaultSorterFn);
+ fn = fn || me.sorterFn || me.defaultSorterFn;
+ me.sort = me.createSortFunction(fn);
}
});
/**
@@ -15534,9 +15400,6 @@ Ext.define('Ext.ElementLoader', {
* class defaults.
*/
load: function(options) {
- if (!this.target) {
- Ext.Error.raise('A valid target is required when loading content');
- }
options = Ext.apply({}, options);
@@ -15559,9 +15422,6 @@ Ext.define('Ext.ElementLoader', {
url: me.url
});
- if (!options.url) {
- Ext.Error.raise('You must specify the URL from which content should be loaded');
- }
Ext.apply(options, {
scope: me,
@@ -15691,10 +15551,8 @@ Ext.define('Ext.ElementLoader', {
/**
* @class Ext.layout.Layout
* @extends Object
- * @private
* Base Layout class - extended by ComponentLayout and ContainerLayout
*/
-
Ext.define('Ext.layout.Layout', {
/* Begin Definitions */
@@ -15710,12 +15568,12 @@ Ext.define('Ext.layout.Layout', {
if (layout instanceof Ext.layout.Layout) {
return Ext.createByAlias('layout.' + layout);
} else {
- if (Ext.isObject(layout)) {
- type = layout.type;
+ if (!layout || typeof layout === 'string') {
+ type = layout || defaultType;
+ layout = {};
}
else {
- type = layout || defaultType;
- layout = {};
+ type = layout.type;
}
return Ext.createByAlias('layout.' + type, layout || {});
}
@@ -15796,10 +15654,17 @@ Ext.define('Ext.layout.Layout', {
* @param {Number} position The position within the target to render the item to
*/
renderItem : function(item, target, position) {
+ var me = this;
if (!item.rendered) {
+ if (me.itemCls) {
+ item.addCls(me.itemCls);
+ }
+ if (me.owner.itemCls) {
+ item.addCls(me.owner.itemCls);
+ }
item.render(target, position);
- this.configureItem(item);
- this.childrenChanged = true;
+ me.configureItem(item);
+ me.childrenChanged = true;
}
},
@@ -15844,19 +15709,9 @@ Ext.define('Ext.layout.Layout', {
/**
* @private
* Applies itemCls
+ * Empty template method
*/
- configureItem: function(item) {
- var me = this,
- el = item.el,
- owner = me.owner;
-
- if (me.itemCls) {
- el.addCls(me.itemCls);
- }
- if (owner.itemCls) {
- el.addCls(owner.itemCls);
- }
- },
+ configureItem: Ext.emptyFn,
// Placeholder empty functions for subclasses to extend
onLayout : Ext.emptyFn,
@@ -15874,6 +15729,7 @@ Ext.define('Ext.layout.Layout', {
el = item.el,
owner = me.owner;
+ // Clear managed dimensions flag when removed from the layout.
if (item.rendered) {
if (me.itemCls) {
el.removeCls(me.itemCls);
@@ -15882,6 +15738,12 @@ Ext.define('Ext.layout.Layout', {
el.removeCls(owner.itemCls);
}
}
+
+ // These flags are set at the time a child item is added to a layout.
+ // The layout must decide if it is managing the item's width, or its height, or both.
+ // See AbstractComponent for docs on these properties.
+ delete item.layoutManagedWidth;
+ delete item.layoutManagedHeight;
},
/*
@@ -15940,7 +15802,7 @@ Ext.define('Ext.layout.component.Component', {
me.callParent(arguments);
},
- beforeLayout : function(width, height, isSetSize, layoutOwner) {
+ beforeLayout : function(width, height, isSetSize, callingContainer) {
this.callParent(arguments);
var me = this,
@@ -15951,14 +15813,11 @@ Ext.define('Ext.layout.component.Component', {
ownerElChild = owner.el.child,
layoutCollection;
- /*
- * Do not layout calculatedSized components for fixedLayouts unless the ownerCt == layoutOwner
- * fixedLayouts means layouts which are never auto/auto in the sizing that comes from their ownerCt.
- * Currently 3 layouts MAY be auto/auto (Auto, Border, and Box)
- * The reason for not allowing component layouts is to stop component layouts from things such as Updater and
- * form Validation.
- */
- if (!isSetSize && !(Ext.isNumber(width) && Ext.isNumber(height)) && ownerCt && ownerCt.layout && ownerCt.layout.fixedLayout && ownerCt != layoutOwner) {
+ // Cache the size we began with so we can see if there has been any effect.
+ me.previousComponentSize = me.lastComponentSize;
+
+ //Do not allow autoing of any dimensions which are fixed, unless we are being told to do so by the ownerCt's layout.
+ if (!isSetSize && ((!Ext.isNumber(width) && owner.isFixedWidth()) || (!Ext.isNumber(height) && owner.isFixedHeight())) && callingContainer !== ownerCt) {
me.doContainerLayout();
return false;
}
@@ -15979,9 +15838,7 @@ Ext.define('Ext.layout.component.Component', {
}
if (isVisible && this.needsLayout(width, height)) {
- me.rawWidth = width;
- me.rawHeight = height;
- return owner.beforeComponentLayout(width, height, isSetSize, layoutOwner);
+ return owner.beforeComponentLayout(width, height, isSetSize, callingContainer);
}
else {
return false;
@@ -15995,11 +15852,23 @@ Ext.define('Ext.layout.component.Component', {
* @param {Mixed} height The new height to set.
*/
needsLayout : function(width, height) {
- this.lastComponentSize = this.lastComponentSize || {
- width: -Infinity,
- height: -Infinity
- };
- return (this.childrenChanged || this.lastComponentSize.width !== width || this.lastComponentSize.height !== height);
+ var me = this,
+ widthBeingChanged,
+ heightBeingChanged;
+ me.lastComponentSize = me.lastComponentSize || {
+ width: -Infinity,
+ height: -Infinity
+ };
+
+ // If autoWidthing, or an explicitly different width is passed, then the width is being changed.
+ widthBeingChanged = !Ext.isDefined(width) || me.lastComponentSize.width !== width;
+
+ // If autoHeighting, or an explicitly different height is passed, then the height is being changed.
+ heightBeingChanged = !Ext.isDefined(height) || me.lastComponentSize.height !== height;
+
+
+ // isSizing flag added to prevent redundant layouts when going up the layout chain
+ return !me.isSizing && (me.childrenChanged || widthBeingChanged || heightBeingChanged);
},
/**
@@ -16101,22 +15970,32 @@ Ext.define('Ext.layout.component.Component', {
doOwnerCtLayouts: function() {
var owner = this.owner,
ownerCt = owner.ownerCt,
- ownerCtComponentLayout, ownerCtContainerLayout;
+ ownerCtComponentLayout, ownerCtContainerLayout,
+ curSize = this.lastComponentSize,
+ prevSize = this.previousComponentSize,
+ widthChange = (prevSize && curSize && curSize.width) ? curSize.width !== prevSize.width : true,
+ heightChange = (prevSize && curSize && curSize.height) ? curSize.height !== prevSize.height : true;
+
- if (!ownerCt) {
+ // If size has not changed, do not inform upstream layouts
+ if (!ownerCt || (!widthChange && !heightChange)) {
return;
}
-
+
ownerCtComponentLayout = ownerCt.componentLayout;
ownerCtContainerLayout = ownerCt.layout;
if (!owner.floating && ownerCtComponentLayout && ownerCtComponentLayout.monitorChildren && !ownerCtComponentLayout.layoutBusy) {
if (!ownerCt.suspendLayout && ownerCtContainerLayout && !ownerCtContainerLayout.layoutBusy) {
- // AutoContainer Layout and Dock with auto in some dimension
- if (ownerCtContainerLayout.bindToOwnerCtComponent === true) {
+
+ // If the owning Container may be adjusted in any of the the dimension which have changed, perform its Component layout
+ if (((widthChange && !ownerCt.isFixedWidth()) || (heightChange && !ownerCt.isFixedHeight()))) {
+ // Set the isSizing flag so that the upstream Container layout (called after a Component layout) can omit this component from sizing operations
+ this.isSizing = true;
ownerCt.doComponentLayout();
+ this.isSizing = false;
}
- // Box Layouts
+ // Execute upstream Container layout
else if (ownerCtContainerLayout.bindToOwnerCtContainer === true) {
ownerCtContainerLayout.layout();
}
@@ -16133,7 +16012,7 @@ Ext.define('Ext.layout.component.Component', {
// Run the container layout if it exists (layout for child items)
// **Unless automatic laying out is suspended, or the layout is currently running**
- if (!owner.suspendLayout && layout && layout.isLayout && !layout.layoutBusy) {
+ if (!owner.suspendLayout && layout && layout.isLayout && !layout.layoutBusy && !layout.isAutoDock) {
layout.layout();
}
@@ -16224,27 +16103,27 @@ Ext.define('Ext.state.Manager', {
});
/**
* @class Ext.state.Stateful
- * A mixin for being able to save the state of an object to an underlying
+ * A mixin for being able to save the state of an object to an underlying
* {@link Ext.state.Provider}.
*/
Ext.define('Ext.state.Stateful', {
-
+
/* Begin Definitions */
-
+
mixins: {
observable: 'Ext.util.Observable'
},
-
+
requires: ['Ext.state.Manager'],
-
+
/* End Definitions */
-
+
/**
* @cfg {Boolean} stateful
* <p>A flag which causes the object to attempt to restore the state of
* internal properties from a saved state on startup. The object must have
- * a <code>{@link #stateId}</code> for state to be managed.
- * Auto-generated ids are not guaranteed to be stable across page loads and
+ * a <code>{@link #stateId}</code> for state to be managed.
+ * Auto-generated ids are not guaranteed to be stable across page loads and
* cannot be relied upon to save and restore the same state for a object.<p>
* <p>For state saving to work, the state manager's provider must have been
* set to an implementation of {@link Ext.state.Provider} which overrides the
@@ -16265,7 +16144,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
* object hash which represents the restorable state of the object.</p>
* <p>The value yielded by getState is passed to {@link Ext.state.Manager#set}
* which uses the configured {@link Ext.state.Provider} to save the object
- * keyed by the <code>{@link stateId}</code></p>.
+ * keyed by the <code>{@link #stateId}</code></p>.
* <p>During construction, a stateful object attempts to <i>restore</i>
* its state by calling {@link Ext.state.Manager#get} passing the
* <code>{@link #stateId}</code></p>
@@ -16278,13 +16157,13 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
* {@link #beforestatesave} and {@link #statesave} events.</p>
*/
stateful: true,
-
+
/**
* @cfg {String} stateId
* The unique id for this object to use for state management purposes.
* <p>See {@link #stateful} for an explanation of saving and restoring state.</p>
*/
-
+
/**
* @cfg {Array} stateEvents
* <p>An array of events that, when fired, should trigger this object to
@@ -16294,18 +16173,18 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
* <p>See <code>{@link #stateful}</code> for an explanation of saving and
* restoring object state.</p>
*/
-
+
/**
* @cfg {Number} saveBuffer A buffer to be applied if many state events are fired within
* a short period. Defaults to 100.
*/
saveDelay: 100,
-
+
autoGenIdRe: /^((\w+-)|(ext-comp-))\d{4,}$/i,
-
+
constructor: function(config) {
var me = this;
-
+
config = config || {};
if (Ext.isDefined(config.stateful)) {
me.stateful = config.stateful;
@@ -16313,8 +16192,8 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
if (Ext.isDefined(config.saveDelay)) {
me.saveDelay = config.saveDelay;
}
- me.stateId = config.stateId;
-
+ me.stateId = me.stateId || config.stateId;
+
if (!me.stateEvents) {
me.stateEvents = [];
}
@@ -16332,7 +16211,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
* provide custom state restoration.
*/
'beforestaterestore',
-
+
/**
* @event staterestore
* Fires after the state of the object is restored.
@@ -16342,7 +16221,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
* object. The method maybe overriden to provide custom state restoration.
*/
'staterestore',
-
+
/**
* @event beforestatesave
* Fires before the state of the object is saved to the configured state provider. Return false to stop the save.
@@ -16353,7 +16232,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
* has a null implementation.
*/
'beforestatesave',
-
+
/**
* @event statesave
* Fires after the state of the object is saved to the configured state provider.
@@ -16371,7 +16250,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
me.initState();
}
},
-
+
/**
* Initializes any state events for this object.
* @private
@@ -16379,7 +16258,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
initStateEvents: function() {
this.addStateEvents(this.stateEvents);
},
-
+
/**
* Add events that will trigger the state to be saved.
* @param {String/Array} events The event name or an array of event names.
@@ -16388,16 +16267,16 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
if (!Ext.isArray(events)) {
events = [events];
}
-
+
var me = this,
i = 0,
len = events.length;
-
+
for (; i < len; ++i) {
me.on(events[i], me.onStateChange, me);
}
},
-
+
/**
* This method is called when any of the {@link #stateEvents} are fired.
* @private
@@ -16405,7 +16284,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
onStateChange: function(){
var me = this,
delay = me.saveDelay;
-
+
if (delay > 0) {
if (!me.stateTask) {
me.stateTask = Ext.create('Ext.util.DelayedTask', me.saveState, me);
@@ -16415,7 +16294,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
me.saveState();
}
},
-
+
/**
* Saves the state of the object to the persistence store.
* @private
@@ -16424,7 +16303,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
var me = this,
id,
state;
-
+
if (me.stateful !== false) {
id = me.getStateId();
if (id) {
@@ -16436,16 +16315,16 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
}
}
},
-
+
/**
* Gets the current state of the object. By default this function returns null,
* it should be overridden in subclasses to implement methods for getting the state.
* @return {Object} The current state
*/
getState: function(){
- return null;
+ return null;
},
-
+
/**
* Applies the state to the object. This should be overridden in subclasses to do
* more complex state operations. By default it applies the state properties onto
@@ -16457,7 +16336,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
Ext.apply(this, state);
}
},
-
+
/**
* Gets the state id for this object.
* @return {String} The state id, null if not found.
@@ -16465,13 +16344,13 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
getStateId: function() {
var me = this,
id = me.stateId;
-
+
if (!id) {
id = me.autoGenIdRe.test(String(me.id)) ? null : me.id;
}
return id;
},
-
+
/**
* Initializes the state of the object upon construction.
* @private
@@ -16480,7 +16359,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
var me = this,
id = me.getStateId(),
state;
-
+
if (me.stateful !== false) {
if (id) {
state = Ext.state.Manager.get(id);
@@ -16494,7 +16373,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
}
}
},
-
+
/**
* Destroys this stateful object.
*/
@@ -16504,18 +16383,16 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
task.cancel();
}
this.clearListeners();
-
+
}
-
+
});
/**
* @class Ext.AbstractManager
* @extends Object
- * @ignore
* Base Manager class
*/
-
Ext.define('Ext.AbstractManager', {
/* Begin Definitions */
@@ -16594,9 +16471,6 @@ Ext.define('Ext.AbstractManager', {
var type = config[this.typeName] || config.type || defaultType,
Constructor = this.types[type];
- if (Constructor == undefined) {
- Ext.Error.raise("The '" + type + "' type has not been registered with this manager");
- }
return new Constructor(config);
},
@@ -17467,11 +17341,11 @@ Ext.define('Ext.util.AbstractMixedCollection', {
return me.add(myKey, myObj);
}
me.length++;
- me.items.splice(index, 0, myObj);
+ Ext.Array.splice(me.items, index, 0, myObj);
if (typeof myKey != 'undefined' && myKey !== null) {
me.map[myKey] = myObj;
}
- me.keys.splice(index, 0, myKey);
+ Ext.Array.splice(me.keys, index, 0, myKey);
me.fireEvent('add', index, myObj, myKey);
return myObj;
},
@@ -17499,12 +17373,12 @@ Ext.define('Ext.util.AbstractMixedCollection', {
if (index < me.length && index >= 0) {
me.length--;
o = me.items[index];
- me.items.splice(index, 1);
+ Ext.Array.erase(me.items, index, 1);
key = me.keys[index];
if (typeof key != 'undefined') {
delete me.map[key];
}
- me.keys.splice(index, 1);
+ Ext.Array.erase(me.keys, index, 1);
me.fireEvent('remove', o, key);
return o;
}
@@ -17788,7 +17662,6 @@ Ext.define("Ext.util.Sortable", {
],
- sortRoot: null,
initSortable: function() {
@@ -17955,6 +17828,7 @@ Ext.define('Ext.util.MixedCollection', {
sortable: 'Ext.util.Sortable'
},
+
constructor: function() {
var me = this;
me.callParent(arguments);
@@ -18208,6 +18082,7 @@ Ext.define('Ext.LoadMask', {
disabled: false,
+
constructor : function(el, config) {
var me = this;
@@ -18371,12 +18246,6 @@ Ext.define('Ext.ComponentLoader', {
target = loader.getTarget(),
items = [];
- if (!target.isContainer) {
- Ext.Error.raise({
- target: target,
- msg: 'Components can only be loaded into a container'
- });
- }
try {
items = Ext.decode(response.responseText);
@@ -18518,12 +18387,17 @@ Ext.define('Ext.AbstractComponent', {
return ++Ext.AbstractComponent.AUTO_ID;
},
+
+
+
+
+
@@ -18560,10 +18434,10 @@ Ext.define('Ext.AbstractComponent', {
ui: 'default',
-
+
uiCls: [],
-
+
@@ -18630,11 +18504,12 @@ Ext.define('Ext.AbstractComponent', {
trimRe: /^\s+|\s+$/g,
spacesRe: /\s+/,
+
+
-
-
maskOnDisable: true,
+
constructor : function(config) {
var me = this,
i, len;
@@ -18697,7 +18572,7 @@ Ext.define('Ext.AbstractComponent', {
me.plugins[i] = me.constructPlugin(me.plugins[i]);
}
}
-
+
me.initComponent();
@@ -18708,6 +18583,9 @@ Ext.define('Ext.AbstractComponent', {
me.mixins.state.constructor.call(me, config);
+ this.addStateEvents('resize');
+
+
if (me.plugins) {
me.plugins = [].concat(me.plugins);
for (i = 0, len = me.plugins.length; i < len; i++) {
@@ -18727,17 +18605,78 @@ Ext.define('Ext.AbstractComponent', {
if (me.autoShow) {
me.show();
}
+
+ },
+
+ initComponent: Ext.emptyFn,
+
+
+ getState: function() {
+ var me = this,
+ layout = me.ownerCt ? (me.shadowOwnerCt || me.ownerCt).getLayout() : null,
+ state = {
+ collapsed: me.collapsed
+ },
+ width = me.width,
+ height = me.height,
+ cm = me.collapseMemento,
+ anchors;
+
- if (Ext.isDefined(me.disabledClass)) {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.warn('Ext.Component: disabledClass has been deprecated. Please use disabledCls.');
+
+ if (me.collapsed && cm) {
+ if (Ext.isDefined(cm.data.width)) {
+ width = cm.width;
+ }
+ if (Ext.isDefined(cm.data.height)) {
+ height = cm.height;
}
- me.disabledCls = me.disabledClass;
- delete me.disabledClass;
}
- },
- initComponent: Ext.emptyFn,
+
+ if (layout && me.flex) {
+ state.flex = me.flex;
+ state[layout.perpendicularPrefix] = me['get' + layout.perpendicularPrefixCap]();
+ }
+
+ else if (layout && me.anchor) {
+ state.anchor = me.anchor;
+ anchors = me.anchor.split(' ').concat(null);
+ if (!anchors[0]) {
+ if (me.width) {
+ state.width = width;
+ }
+ }
+ if (!anchors[1]) {
+ if (me.height) {
+ state.height = height;
+ }
+ }
+ }
+
+ else {
+ if (me.width) {
+ state.width = width;
+ }
+ if (me.height) {
+ state.height = height;
+ }
+ }
+
+
+ if (state.width == me.initialConfig.width) {
+ delete state.width;
+ }
+ if (state.height == me.initialConfig.height) {
+ delete state.height;
+ }
+
+
+ if (layout && layout.align && (layout.align.indexOf('stretch') !== -1)) {
+ delete state[layout.perpendicularPrefix];
+ }
+ return state;
+ },
show: Ext.emptyFn,
@@ -18893,7 +18832,6 @@ Ext.define('Ext.AbstractComponent', {
onRender : function(container, position) {
var me = this,
el = me.el,
- cls = me.initCls(),
styles = me.initStyles(),
renderTpl, renderData, i;
@@ -18928,7 +18866,9 @@ Ext.define('Ext.AbstractComponent', {
}
}
- el.addCls(cls);
+ me.setUI(me.ui);
+
+ el.addCls(me.initCls());
el.setStyle(styles);
@@ -18943,14 +18883,7 @@ Ext.define('Ext.AbstractComponent', {
me.el = el;
-
- me.rendered = true;
- me.addUIToElement(true);
-
- for (i = 0; i < me.uiCls.length; i++) {
- me.addUIClsToElement(me.uiCls[i], true);
- }
- me.rendered = false;
+
me.initFrame();
renderTpl = me.initRenderTpl();
@@ -18960,10 +18893,8 @@ Ext.define('Ext.AbstractComponent', {
}
me.applyRenderSelectors();
-
+
me.rendered = true;
-
- me.setUI(me.ui);
},
@@ -19004,6 +18935,18 @@ Ext.define('Ext.AbstractComponent', {
frameCls: Ext.baseCSSPrefix + 'frame',
+ frameElementCls: {
+ tl: [],
+ tc: [],
+ tr: [],
+ ml: [],
+ mc: [],
+ mr: [],
+ bl: [],
+ bc: [],
+ br: []
+ },
+
frameTpl: [
'<tpl if="top">',
'<tpl if="left"><div class="{frameCls}-tl {baseCls}-tl {baseCls}-{ui}-tl<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tl</tpl></tpl>" style="background-position: {tl}; padding-left: {frameWidth}px" role="presentation"></tpl>',
@@ -19049,18 +18992,18 @@ Ext.define('Ext.AbstractComponent', {
'</tpl>',
'</tbody></table>'
],
-
+
initFrame : function() {
if (Ext.supports.CSS3BorderRadius) {
return false;
}
-
+
var me = this,
frameInfo = me.getFrameInfo(),
frameWidth = frameInfo.width,
frameTpl = me.getFrameTpl(frameInfo.table);
-
+
if (me.frame) {
frameTpl.insertFirst(me.el, Ext.apply({}, {
@@ -19077,7 +19020,7 @@ Ext.define('Ext.AbstractComponent', {
me.frameBody = me.el.down('.' + me.frameCls + '-mc');
-
+
Ext.apply(me.renderSelectors, {
frameTL: '.' + me.baseCls + '-tl',
@@ -19092,12 +19035,12 @@ Ext.define('Ext.AbstractComponent', {
});
}
},
-
+
updateFrame: function() {
if (Ext.supports.CSS3BorderRadius) {
return false;
}
-
+
var me = this,
wasTable = this.frameSize && this.frameSize.table,
oldFrameTL = this.frameTL,
@@ -19105,11 +19048,11 @@ Ext.define('Ext.AbstractComponent', {
oldFrameML = this.frameML,
oldFrameMC = this.frameMC,
newMCClassName;
-
+
this.initFrame();
-
+
if (oldFrameMC) {
- if (me.frame) {
+ if (me.frame) {
delete me.frameTL;
delete me.frameTC;
@@ -19119,26 +19062,26 @@ Ext.define('Ext.AbstractComponent', {
delete me.frameMR;
delete me.frameBL;
delete me.frameBC;
- delete me.frameBR;
+ delete me.frameBR;
this.applyRenderSelectors();
-
+
newMCClassName = this.frameMC.dom.className;
-
+
oldFrameMC.insertAfter(this.frameMC);
this.frameMC.remove();
-
+
this.frameBody = this.frameMC = oldFrameMC;
-
+
oldFrameMC.dom.className = newMCClassName;
-
+
if (wasTable) {
me.el.query('> table')[1].remove();
- }
+ }
else {
if (oldFrameTL) {
oldFrameTL.remove();
@@ -19151,19 +19094,19 @@ Ext.define('Ext.AbstractComponent', {
}
else {
-
+
}
}
else if (me.frame) {
this.applyRenderSelectors();
}
},
-
+
getFrameInfo: function() {
if (Ext.supports.CSS3BorderRadius) {
return false;
}
-
+
var me = this,
left = me.el.getStyle('background-position-x'),
top = me.el.getStyle('background-position-y'),
@@ -19176,62 +19119,59 @@ Ext.define('Ext.AbstractComponent', {
left = info[0];
top = info[1];
}
-
+
if (parseInt(left, 10) >= 1000000 && parseInt(top, 10) >= 1000000) {
max = Math.max;
-
+
frameInfo = {
table: left.substr(0, 3) == '110',
-
+
vertical: top.substr(0, 3) == '110',
-
+
top: max(left.substr(3, 2), left.substr(5, 2)),
right: max(left.substr(5, 2), top.substr(3, 2)),
bottom: max(top.substr(3, 2), top.substr(5, 2)),
left: max(top.substr(5, 2), left.substr(3, 2))
};
-
+
frameInfo.width = max(frameInfo.top, frameInfo.right, frameInfo.bottom, frameInfo.left);
me.el.setStyle('background-image', 'none');
- }
-
+ }
+
if (me.frame === true && !frameInfo) {
- Ext.Error.raise("You have set frame: true explicity on this component while it doesn't have any " +
- "framing defined in the CSS template. In this case IE can't figure out what sizes " +
- "to use and thus framing on this component will be disabled.");
}
-
+
me.frame = me.frame || !!frameInfo;
me.frameSize = frameInfo || false;
-
+
return frameInfo;
},
-
+
getFramePositions: function(frameInfo) {
var me = this,
frameWidth = frameInfo.width,
dock = me.dock,
positions, tc, bc, ml, mr;
-
+
if (frameInfo.vertical) {
tc = '0 -' + (frameWidth * 0) + 'px';
bc = '0 -' + (frameWidth * 1) + 'px';
-
+
if (dock && dock == "right") {
tc = 'right -' + (frameWidth * 0) + 'px';
bc = 'right -' + (frameWidth * 1) + 'px';
}
-
+
positions = {
tl: '0 -' + (frameWidth * 0) + 'px',
tr: '0 -' + (frameWidth * 1) + 'px',
@@ -19247,12 +19187,12 @@ Ext.define('Ext.AbstractComponent', {
} else {
ml = '-' + (frameWidth * 0) + 'px 0';
mr = 'right 0';
-
+
if (dock && dock == "bottom") {
ml = 'left bottom';
mr = 'right bottom';
}
-
+
positions = {
tl: '0 -' + (frameWidth * 2) + 'px',
tr: 'right -' + (frameWidth * 3) + 'px',
@@ -19266,10 +19206,10 @@ Ext.define('Ext.AbstractComponent', {
bc: '0 -' + (frameWidth * 1) + 'px'
};
}
-
+
return positions;
},
-
+
getFrameTpl : function(table) {
return table ? this.getTpl('frameTableTpl') : this.getTpl('frameTpl');
@@ -19302,174 +19242,228 @@ Ext.define('Ext.AbstractComponent', {
return cls.concat(me.additionalCls);
},
-
+
setUI: function(ui) {
var me = this,
oldUICls = Ext.Array.clone(me.uiCls),
newUICls = [],
+ classes = [],
cls,
i;
-
+
for (i = 0; i < oldUICls.length; i++) {
cls = oldUICls[i];
-
- me.removeClsWithUI(cls);
+
+ classes = classes.concat(me.removeClsWithUI(cls, true));
newUICls.push(cls);
}
-
+
+ if (classes.length) {
+ me.removeCls(classes);
+ }
+
me.removeUIFromElement();
-
+
me.ui = ui;
-
+
me.addUIToElement();
+
-
+ classes = [];
for (i = 0; i < newUICls.length; i++) {
cls = newUICls[i];
-
- me.addClsWithUI(cls);
+ classes = classes.concat(me.addClsWithUI(cls, true));
+ }
+
+ if (classes.length) {
+ me.addCls(classes);
}
},
+
-
- addClsWithUI: function(cls) {
+ addClsWithUI: function(cls, skip) {
var me = this,
+ classes = [],
i;
-
+
if (!Ext.isArray(cls)) {
cls = [cls];
}
-
+
for (i = 0; i < cls.length; i++) {
if (cls[i] && !me.hasUICls(cls[i])) {
me.uiCls = Ext.Array.clone(me.uiCls);
me.uiCls.push(cls[i]);
- me.addUIClsToElement(cls[i]);
+
+ classes = classes.concat(me.addUIClsToElement(cls[i]));
}
}
+
+ if (skip !== true) {
+ me.addCls(classes);
+ }
+
+ return classes;
},
+
-
- removeClsWithUI: function(cls) {
+ removeClsWithUI: function(cls, skip) {
var me = this,
+ classes = [],
i;
-
+
if (!Ext.isArray(cls)) {
cls = [cls];
}
-
+
for (i = 0; i < cls.length; i++) {
if (cls[i] && me.hasUICls(cls[i])) {
me.uiCls = Ext.Array.remove(me.uiCls, cls[i]);
- me.removeUIClsFromElement(cls[i]);
+
+ classes = classes.concat(me.removeUIClsFromElement(cls[i]));
}
}
+
+ if (skip !== true) {
+ me.removeCls(classes);
+ }
+
+ return classes;
},
-
+
hasUICls: function(cls) {
var me = this,
uiCls = me.uiCls || [];
-
+
return Ext.Array.contains(uiCls, cls);
},
-
+
addUIClsToElement: function(cls, force) {
- var me = this;
+ var me = this,
+ result = [],
+ frameElementCls = me.frameElementCls;
- me.addCls(Ext.baseCSSPrefix + cls);
- me.addCls(me.baseCls + '-' + cls);
- me.addCls(me.baseCls + '-' + me.ui + '-' + cls);
+ result.push(Ext.baseCSSPrefix + cls);
+ result.push(me.baseCls + '-' + cls);
+ result.push(me.baseCls + '-' + me.ui + '-' + cls);
- if (!force && me.rendered && me.frame && !Ext.supports.CSS3BorderRadius) {
+ if (!force && me.frame && !Ext.supports.CSS3BorderRadius) {
var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
- i, el;
-
+ classes, i, j, el;
+
for (i = 0; i < els.length; i++) {
el = me['frame' + els[i].toUpperCase()];
-
+ classes = [me.baseCls + '-' + me.ui + '-' + els[i], me.baseCls + '-' + me.ui + '-' + cls + '-' + els[i]];
if (el && el.dom) {
- el.addCls(me.baseCls + '-' + me.ui + '-' + els[i]);
- el.addCls(me.baseCls + '-' + me.ui + '-' + cls + '-' + els[i]);
+ el.addCls(classes);
+ } else {
+ for (j = 0; j < classes.length; j++) {
+ if (Ext.Array.indexOf(frameElementCls[els[i]], classes[j]) == -1) {
+ frameElementCls[els[i]].push(classes[j]);
+ }
+ }
}
}
}
+
+ me.frameElementCls = frameElementCls;
+
+ return result;
},
-
+
removeUIClsFromElement: function(cls, force) {
- var me = this;
+ var me = this,
+ result = [],
+ frameElementCls = me.frameElementCls;
- me.removeCls(Ext.baseCSSPrefix + cls);
- me.removeCls(me.baseCls + '-' + cls);
- me.removeCls(me.baseCls + '-' + me.ui + '-' + cls);
+ result.push(Ext.baseCSSPrefix + cls);
+ result.push(me.baseCls + '-' + cls);
+ result.push(me.baseCls + '-' + me.ui + '-' + cls);
- if (!force &&me.rendered && me.frame && !Ext.supports.CSS3BorderRadius) {
+ if (!force && me.frame && !Ext.supports.CSS3BorderRadius) {
var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
i, el;
-
+ cls = me.baseCls + '-' + me.ui + '-' + cls + '-' + els[i];
for (i = 0; i < els.length; i++) {
el = me['frame' + els[i].toUpperCase()];
if (el && el.dom) {
- el.removeCls(me.baseCls + '-' + me.ui + '-' + cls + '-' + els[i]);
+ el.removeCls(cls);
+ } else {
+ Ext.Array.remove(frameElementCls[els[i]], cls);
}
}
}
+
+ me.frameElementCls = frameElementCls;
+
+ return result;
},
-
+
addUIToElement: function(force) {
- var me = this;
+ var me = this,
+ frameElementCls = me.frameElementCls;
me.addCls(me.baseCls + '-' + me.ui);
- if (me.rendered && me.frame && !Ext.supports.CSS3BorderRadius) {
+ if (me.frame && !Ext.supports.CSS3BorderRadius) {
var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
- i, el;
+ i, el, cls;
for (i = 0; i < els.length; i++) {
el = me['frame' + els[i].toUpperCase()];
-
+ cls = me.baseCls + '-' + me.ui + '-' + els[i];
if (el) {
- el.addCls(me.baseCls + '-' + me.ui + '-' + els[i]);
+ el.addCls(cls);
+ } else {
+ if (!Ext.Array.contains(frameElementCls[els[i]], cls)) {
+ frameElementCls[els[i]].push(cls);
+ }
}
}
}
},
-
+
removeUIFromElement: function() {
- var me = this;
+ var me = this,
+ frameElementCls = me.frameElementCls;
me.removeCls(me.baseCls + '-' + me.ui);
- if (me.rendered && me.frame && !Ext.supports.CSS3BorderRadius) {
+ if (me.frame && !Ext.supports.CSS3BorderRadius) {
var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
- i, el;
-
+ i, j, el, cls;
+
for (i = 0; i < els.length; i++) {
el = me['frame' + els[i].toUpperCase()];
+ cls = me.baseCls + '-' + me.ui + '-' + els[i];
+
if (el) {
- el.removeCls(me.baseCls + '-' + me.ui + '-' + els[i]);
+ el.removeCls(cls);
+ } else {
+ Ext.Array.remove(frameElementCls[els[i]], cls);
}
}
}
},
-
+
getElConfig : function() {
var result = this.autoEl || {tag: 'div'};
result.id = this.id;
@@ -19527,15 +19521,18 @@ Ext.define('Ext.AbstractComponent', {
getTpl: function(name) {
- var prototype = this.self.prototype,
- ownerPrototype;
+ var me = this,
+ prototype = me.self.prototype,
+ ownerPrototype,
+ tpl;
- if (this.hasOwnProperty(name)) {
- if (!(this[name] instanceof Ext.XTemplate)) {
- this[name] = Ext.ClassManager.dynInstantiate('Ext.XTemplate', this[name]);
+ if (me.hasOwnProperty(name)) {
+ tpl = me[name];
+ if (tpl && !(tpl instanceof Ext.XTemplate)) {
+ me[name] = Ext.ClassManager.dynInstantiate('Ext.XTemplate', tpl);
}
- return this[name];
+ return me[name];
}
if (!(prototype[name] instanceof Ext.XTemplate)) {
@@ -19543,8 +19540,11 @@ Ext.define('Ext.AbstractComponent', {
do {
if (ownerPrototype.hasOwnProperty(name)) {
- ownerPrototype[name] = Ext.ClassManager.dynInstantiate('Ext.XTemplate', ownerPrototype[name]);
- break;
+ tpl = ownerPrototype[name];
+ if (tpl && !(tpl instanceof Ext.XTemplate)) {
+ ownerPrototype[name] = Ext.ClassManager.dynInstantiate('Ext.XTemplate', tpl);
+ break;
+ }
}
ownerPrototype = ownerPrototype.superclass;
@@ -19621,13 +19621,17 @@ Ext.define('Ext.AbstractComponent', {
initEvents : function() {
var me = this,
afterRenderEvents = me.afterRenderEvents,
- property, listeners;
+ el,
+ property,
+ fn = function(listeners){
+ me.mon(el, listeners);
+ };
if (afterRenderEvents) {
for (property in afterRenderEvents) {
if (afterRenderEvents.hasOwnProperty(property)) {
- listeners = afterRenderEvents[property];
- if (me[property] && me[property].on) {
- me.mon(me[property], listeners);
+ el = me[property];
+ if (el && el.on) {
+ Ext.each(afterRenderEvents[property], fn);
}
}
}
@@ -19924,12 +19928,12 @@ Ext.define('Ext.AbstractComponent', {
return me;
},
-
+
onEnable: function() {
if (this.maskOnDisable) {
this.el.unmask();
- }
+ }
},
@@ -19938,7 +19942,7 @@ Ext.define('Ext.AbstractComponent', {
this.el.mask();
}
},
-
+
isDisabled : function() {
return this.disabled;
@@ -19998,12 +20002,6 @@ Ext.define('Ext.AbstractComponent', {
return me;
},
- removeClass : function() {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.warn('Ext.Component: removeClass has been deprecated. Please use removeCls.');
- }
- return this.removeCls.apply(this, arguments);
- },
addOverCls: function() {
var me = this;
@@ -20047,18 +20045,21 @@ Ext.define('Ext.AbstractComponent', {
me.mon(me[element], listeners);
} else {
me.afterRenderEvents = me.afterRenderEvents || {};
- me.afterRenderEvents[element] = listeners;
+ if (!me.afterRenderEvents[element]) {
+ me.afterRenderEvents[element] = [];
+ }
+ me.afterRenderEvents[element].push(listeners);
}
}
return me.mixins.observable.addListener.apply(me, arguments);
},
-
+
removeManagedListenerItem: function(isClear, managedListener, item, ename, fn, scope){
var me = this,
element = managedListener.options ? managedListener.options.element : null;
-
+
if (element) {
element = me[element];
if (element && element.un) {
@@ -20156,13 +20157,39 @@ Ext.define('Ext.AbstractComponent', {
return me;
},
- setCalculatedSize : function(width, height, ownerCt) {
+ isFixedWidth: function() {
+ var me = this,
+ layoutManagedWidth = me.layoutManagedWidth;
+
+ if (Ext.isDefined(me.width) || layoutManagedWidth == 1) {
+ return true;
+ }
+ if (layoutManagedWidth == 2) {
+ return false;
+ }
+ return (me.ownerCt && me.ownerCt.isFixedWidth());
+ },
+
+ isFixedHeight: function() {
+ var me = this,
+ layoutManagedHeight = me.layoutManagedHeight;
+
+ if (Ext.isDefined(me.height) || layoutManagedHeight == 1) {
+ return true;
+ }
+ if (layoutManagedHeight == 2) {
+ return false;
+ }
+ return (me.ownerCt && me.ownerCt.isFixedHeight());
+ },
+
+ setCalculatedSize : function(width, height, callingContainer) {
var me = this,
layoutCollection;
if (Ext.isObject(width)) {
- ownerCt = width.ownerCt;
+ callingContainer = width.ownerCt;
height = width.height;
width = width.width;
}
@@ -20186,37 +20213,60 @@ Ext.define('Ext.AbstractComponent', {
width: width,
height: height,
isSetSize: false,
- ownerCt: ownerCt
+ ownerCt: callingContainer
};
return me;
}
- me.doComponentLayout(width, height, false, ownerCt);
+ me.doComponentLayout(width, height, false, callingContainer);
return me;
},
- doComponentLayout : function(width, height, isSetSize, ownerCt) {
+ doComponentLayout : function(width, height, isSetSize, callingContainer) {
var me = this,
- componentLayout = me.getComponentLayout();
+ componentLayout = me.getComponentLayout(),
+ lastComponentSize = componentLayout.lastComponentSize || {
+ width: undefined,
+ height: undefined
+ };
if (me.rendered && componentLayout) {
- width = (width !== undefined) ? width : me.width;
- height = (height !== undefined) ? height : me.height;
+
+
+
+ if (!Ext.isDefined(width)) {
+ if (me.isFixedWidth()) {
+ width = Ext.isDefined(me.width) ? me.width : lastComponentSize.width;
+ }
+ }
+
+
+ if (!Ext.isDefined(height)) {
+ if (me.isFixedHeight()) {
+ height = Ext.isDefined(me.height) ? me.height : lastComponentSize.height;
+ }
+ }
+
if (isSetSize) {
me.width = width;
me.height = height;
}
- componentLayout.layout(width, height, isSetSize, ownerCt);
+ componentLayout.layout(width, height, isSetSize, callingContainer);
}
return me;
},
+ forceComponentLayout: function () {
+ this.doComponentLayout();
+ },
+
+
setComponentLayout : function(layout) {
var currentLayout = this.componentLayout;
if (currentLayout && currentLayout.isLayout && currentLayout != layout) {
@@ -20236,12 +20286,12 @@ Ext.define('Ext.AbstractComponent', {
},
- afterComponentLayout: function(width, height, isSetSize, layoutOwner) {
+ afterComponentLayout: function(width, height, isSetSize, callingContainer) {
this.fireEvent('resize', this, width, height);
},
- beforeComponentLayout: function(width, height, isSetSize, layoutOwner) {
+ beforeComponentLayout: function(width, height, isSetSize, callingContainer) {
return true;
},
@@ -20382,15 +20432,15 @@ Ext.define('Ext.AbstractComponent', {
me.ownerCt.remove(me, false);
}
- if (me.rendered) {
- me.el.remove();
- }
-
me.onDestroy();
Ext.destroy(me.plugins);
+ if (me.rendered) {
+ me.el.remove();
+ }
+
Ext.ComponentManager.unregister(me);
me.fireEvent('destroy', me);
@@ -20414,7 +20464,7 @@ Ext.define('Ext.AbstractComponent', {
}
}
},
-
+
isDescendantOf: function(container) {
return !!this.findParentBy(function(p){
@@ -20432,14 +20482,11 @@ Ext.define('Ext.AbstractComponent', {
Ext.define('Ext.AbstractPlugin', {
disabled: false,
-
+
constructor: function(config) {
- if (!config.cmp && Ext.global.console) {
- Ext.global.console.warn("Attempted to attach a plugin ");
- }
Ext.apply(this, config);
},
-
+
getCmp: function() {
return this.cmp;
},
@@ -20461,7 +20508,6 @@ Ext.define('Ext.AbstractPlugin', {
}
});
-
Ext.define('Ext.data.Connection', {
mixins: {
observable: 'Ext.util.Observable'
@@ -20717,12 +20763,6 @@ Ext.define('Ext.data.Connection', {
url = this.setupUrl(options, url);
- if (!url) {
- Ext.Error.raise({
- options: options,
- msg: 'No URL specified'
- });
- }
data = options.rawData || options.xmlData || jsonData || null;
@@ -20930,9 +20970,20 @@ Ext.define('Ext.data.Connection', {
onComplete : function(request) {
var me = this,
options = request.options,
- result = me.parseStatus(request.xhr.status),
- success = result.success,
+ result,
+ success,
response;
+
+ try {
+ result = me.parseStatus(request.xhr.status);
+ } catch (e) {
+
+ result = {
+ success : false,
+ isException : false
+ };
+ }
+ success = result.success;
if (success) {
response = me.createResponse(request);
@@ -21088,13 +21139,13 @@ Ext.define('Ext.data.Association', {
default:
- Ext.Error.raise('Unknown Association type: "' + association.type + '"');
}
}
return association;
}
},
+
constructor: function(config) {
Ext.apply(this, config);
@@ -21105,12 +21156,6 @@ Ext.define('Ext.data.Association', {
associatedModel = types[associatedName],
ownerProto;
- if (ownerModel === undefined) {
- Ext.Error.raise("The configured ownerModel was not valid (you tried " + ownerName + ")");
- }
- if (associatedModel === undefined) {
- Ext.Error.raise("The configured associatedModel was not valid (you tried " + associatedName + ")");
- }
this.ownerModel = ownerModel;
this.associatedModel = associatedModel;
@@ -21228,21 +21273,19 @@ Ext.define('Ext.ModelManager', {
Ext.regModel = function() {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.warn('Ext.regModel has been deprecated. Models can now be created by extending Ext.data.Model: Ext.define("MyModel", {extend: "Ext.data.Model", fields: []});.');
- }
return this.ModelManager.registerType.apply(this.ModelManager, arguments);
};
});
Ext.define('Ext.app.Controller', {
-
mixins: {
observable: 'Ext.util.Observable'
},
+
+
onClassExtended: function(cls, data) {
var className = Ext.getClassName(cls),
match = className.match(/^(.*)\.controller\./);
@@ -21282,6 +21325,7 @@ Ext.define('Ext.app.Controller', {
}
},
+
constructor: function(config) {
this.mixins.observable.constructor.call(this, config);
@@ -21364,22 +21408,27 @@ Ext.define('Ext.app.Controller', {
return cached;
},
+
control: function(selectors, listeners) {
this.application.control(selectors, listeners, this);
},
+
getController: function(name) {
return this.application.getController(name);
},
+
getStore: function(name) {
return this.application.getStore(name);
},
+
getModel: function(model) {
return this.application.getModel(model);
},
+
getView: function(view) {
return this.application.getView(view);
}
@@ -21505,6 +21554,7 @@ Ext.define('Ext.data.Operation', {
error: undefined,
+
constructor: function(config) {
Ext.apply(this, config || {});
@@ -21663,6 +21713,7 @@ Ext.define('Ext.data.ResultSet', {
+
constructor: function(config) {
Ext.apply(this, config);
@@ -21685,6 +21736,7 @@ Ext.define('Ext.data.writer.Writer', {
nameProperty: 'name',
+
constructor: function(config) {
Ext.apply(this, config);
},
@@ -21808,8 +21860,10 @@ Ext.define('Ext.util.Floating', {
},
onFloatParentHide: function() {
- this.showOnParentShow = this.isVisible();
- this.hide();
+ if (this.hideOnParentHide !== false) {
+ this.showOnParentShow = this.isVisible();
+ this.hide();
+ }
},
onFloatParentShow: function() {
@@ -21868,13 +21922,13 @@ Ext.define('Ext.util.Floating', {
me.setPosition(xy);
}
},
-
-
+
+
getConstrainVector: function(constrainTo){
var me = this,
el;
-
+
if (me.constrain || me.constrainHeader) {
el = me.constrainHeader ? me.header.el : me.el;
constrainTo = constrainTo || (me.floatParent && me.floatParent.getTargetEl()) || me.container;
@@ -21973,13 +22027,6 @@ Ext.define('Ext.layout.container.AbstractContainer', {
type: 'container',
- fixedLayout: true,
-
-
- managedHeight: true,
-
- managedWidth: true,
-
bindToOwnerCtComponent: false,
@@ -21988,37 +22035,6 @@ Ext.define('Ext.layout.container.AbstractContainer', {
- isManaged: function(dimension) {
- dimension = Ext.String.capitalize(dimension);
- var me = this,
- child = me,
- managed = me['managed' + dimension],
- ancestor = me.owner.ownerCt;
-
- if (ancestor && ancestor.layout) {
- while (ancestor && ancestor.layout) {
- if (managed === false || ancestor.layout['managed' + dimension] === false) {
- managed = false;
- break;
- }
- ancestor = ancestor.ownerCt;
- }
- }
- return managed;
- },
-
- layout: function() {
- var me = this,
- owner = me.owner;
- if (Ext.isNumber(owner.height) || owner.isViewport) {
- me.managedHeight = false;
- }
- if (Ext.isNumber(owner.width) || owner.isViewport) {
- me.managedWidth = false;
- }
- me.callParent(arguments);
- },
-
setItemSize: function(item, width, height) {
if (Ext.isObject(width)) {
@@ -22404,6 +22420,7 @@ Ext.define('Ext.layout.container.boxOverflow.None', {
Ext.define('Ext.util.KeyMap', {
alternateClassName: 'Ext.KeyMap',
+
constructor: function(el, binding, eventName){
var me = this;
@@ -22589,10 +22606,10 @@ Ext.define('Ext.util.KeyMap', {
}
});
-
Ext.define('Ext.util.ClickRepeater', {
extend: 'Ext.util.Observable',
+
constructor : function(el, config){
this.el = Ext.get(el);
this.el.unselectable();
@@ -22797,6 +22814,8 @@ Ext.define('Ext.layout.component.Button', {
ownerEl = owner.el,
btnEl = owner.btnEl,
btnInnerEl = owner.btnInnerEl,
+ btnIconEl = owner.btnIconEl,
+ sizeIconEl = (owner.icon || owner.iconCls) && (owner.iconAlign == "top" || owner.iconAlign == "bottom"),
minWidth = owner.minWidth,
maxWidth = owner.maxWidth,
ownerWidth, btnFrameWidth, metrics;
@@ -22817,11 +22836,16 @@ Ext.define('Ext.layout.component.Button', {
ownerEl.setWidth(metrics.width + btnFrameWidth + me.adjWidth);
btnEl.setWidth(metrics.width + btnFrameWidth);
btnInnerEl.setWidth(metrics.width + btnFrameWidth);
+
+ if (sizeIconEl) {
+ btnIconEl.setWidth(metrics.width + btnFrameWidth);
+ }
} else {
ownerEl.setWidth(null);
btnEl.setWidth(null);
btnInnerEl.setWidth(null);
+ btnIconEl.setWidth(null);
}
@@ -23321,9 +23345,6 @@ Ext.define('Ext.util.Offset', {
},
equals: function(offset) {
- if(!(offset instanceof this.statics())) {
- Ext.Error.raise('Offset must be an instance of Ext.util.Offset');
- }
return (this.x == offset.x && this.y == offset.y);
},
@@ -23369,6 +23390,7 @@ Ext.define('Ext.util.KeyNav', {
tab: 9
}
},
+
constructor: function(el, config){
this.setConfig(el, config || {});
@@ -23566,11 +23588,11 @@ Ext.define('Ext.fx.Queue', {
}
});
-
Ext.define('Ext.fx.target.Target', {
isAnimTarget: true,
+
constructor: function(target) {
this.target = target;
this.id = this.getId();
@@ -24120,6 +24142,7 @@ Ext.define('Ext.draw.Color', {
Ext.define('Ext.dd.StatusProxy', {
animRepair: false,
+
constructor: function(config){
Ext.apply(this, config);
this.id = this.id || Ext.id();
@@ -24256,6 +24279,7 @@ Ext.define('Ext.dd.StatusProxy', {
Ext.define('Ext.panel.Proxy', {
alternateClassName: 'Ext.dd.PanelProxy',
+
constructor: function(panel, config){
@@ -24462,6 +24486,8 @@ Ext.define('Ext.layout.component.AbstractDock', {
},
bodyBox: {}
};
+
+ delete layout.isAutoDock;
Ext.applyIf(info, me.getTargetInfo());
@@ -24507,6 +24533,8 @@ Ext.define('Ext.layout.component.AbstractDock', {
if (layout && layout.isLayout) {
layout.bindToOwnerCtComponent = true;
+
+ layout.isAutoDock = layout.autoSize !== true;
layout.layout();
@@ -24710,6 +24738,7 @@ Ext.define('Ext.layout.component.AbstractDock', {
adjustAutoBox : function (box, index) {
var info = this.info,
+ owner = this.owner,
bodyBox = info.bodyBox,
size = info.size,
boxes = info.boxes,
@@ -24740,33 +24769,43 @@ Ext.define('Ext.layout.component.AbstractDock', {
box.y = bodyBox.y;
if (!box.overlay) {
bodyBox.y += box.height;
+ if (owner.isFixedHeight()) {
+ bodyBox.height -= box.height;
+ } else {
+ size.height += box.height;
+ }
}
- size.height += box.height;
break;
case 'bottom':
+ if (!box.overlay) {
+ if (owner.isFixedHeight()) {
+ bodyBox.height -= box.height;
+ } else {
+ size.height += box.height;
+ }
+ }
box.y = (bodyBox.y + bodyBox.height);
- size.height += box.height;
break;
case 'left':
box.x = bodyBox.x;
if (!box.overlay) {
bodyBox.x += box.width;
- if (autoSizedCtLayout) {
- size.width += box.width;
- } else {
+ if (owner.isFixedWidth()) {
bodyBox.width -= box.width;
+ } else {
+ size.width += box.width;
}
}
break;
case 'right':
if (!box.overlay) {
- if (autoSizedCtLayout) {
- size.width += box.width;
- } else {
+ if (owner.isFixedWidth()) {
bodyBox.width -= box.width;
+ } else {
+ size.width += box.width;
}
}
box.x = (bodyBox.x + bodyBox.width);
@@ -24955,6 +24994,13 @@ Ext.define('Ext.layout.component.AbstractDock', {
configureItem : function(item, pos) {
this.callParent(arguments);
+ if (item.dock == 'top' || item.dock == 'bottom') {
+ item.layoutManagedWidth = 1;
+ item.layoutManagedHeight = 2;
+ } else {
+ item.layoutManagedWidth = 2;
+ item.layoutManagedHeight = 1;
+ }
item.addCls(Ext.baseCSSPrefix + 'docked');
item.addClsWithUI('docked-' + item.dock);
@@ -24974,6 +25020,95 @@ Ext.define('Ext.layout.component.AbstractDock', {
}
});
+Ext.define('Ext.util.Memento', function () {
+
+ function captureOne (src, target, prop) {
+ src[prop] = target[prop];
+ }
+
+ function removeOne (src, target, prop) {
+ delete src[prop];
+ }
+
+ function restoreOne (src, target, prop) {
+ var value = src[prop];
+ if (value || src.hasOwnProperty(prop)) {
+ restoreValue(target, prop, value);
+ }
+ }
+
+ function restoreValue (target, prop, value) {
+ if (Ext.isDefined(value)) {
+ target[prop] = value;
+ } else {
+ delete target[prop];
+ }
+ }
+
+ function doMany (doOne, src, target, props) {
+ if (src) {
+ if (Ext.isArray(props)) {
+ Ext.each(props, function (prop) {
+ doOne(src, target, prop);
+ });
+ } else {
+ doOne(src, target, props);
+ }
+ }
+ }
+
+ return {
+
+ data: null,
+
+
+ target: null,
+
+
+ constructor: function (target, props) {
+ if (target) {
+ this.target = target;
+ if (props) {
+ this.capture(props);
+ }
+ }
+ },
+
+
+ capture: function (props, target) {
+ doMany(captureOne, this.data || (this.data = {}), target || this.target, props);
+ },
+
+
+ remove: function (props) {
+ doMany(removeOne, this.data, null, props);
+ },
+
+
+ restore: function (props, clear, target) {
+ doMany(restoreOne, this.data, target || this.target, props);
+ if (clear !== false) {
+ this.remove(props);
+ }
+ },
+
+
+ restoreAll: function (clear, target) {
+ var me = this,
+ t = target || this.target;
+
+ Ext.Object.each(me.data, function (prop, value) {
+ restoreValue(t, prop, value);
+ });
+
+ if (clear !== false) {
+ delete me.data;
+ }
+ }
+ };
+}());
+
+
Ext.define('Ext.app.EventBus', {
requires: [
'Ext.util.Event'
@@ -25016,7 +25151,9 @@ Ext.define('Ext.app.EventBus', {
for (i = 0, ln = events.length; i < ln; i++) {
event = events[i];
- return event.fire.apply(event, Array.prototype.slice.call(args, 1));
+ if (event.fire.apply(event, Array.prototype.slice.call(args, 1)) === false) {
+ return false;
+ };
}
}
}
@@ -25250,6 +25387,7 @@ Ext.define('Ext.data.reader.Reader', {
isReader: true,
+
constructor: function(config) {
var me = this;
@@ -25449,7 +25587,6 @@ Ext.define('Ext.data.reader.Reader', {
getResponseData: function(response) {
- Ext.Error.raise("getResponseData must be implemented in the Ext.data.reader.Reader subclass");
},
@@ -25593,9 +25730,6 @@ Ext.define('Ext.data.reader.Json', {
msg: 'Unable to parse the JSON returned by the server: ' + ex.toString()
});
}
- if (!data) {
- Ext.Error.raise('JSON object not found');
- }
return data;
},
@@ -25685,7 +25819,6 @@ Ext.define('Ext.data.writer.Json', {
request.params[root] = Ext.encode(data);
} else {
- Ext.Error.raise('Must specify a root when using encode');
}
} else {
@@ -25733,6 +25866,7 @@ Ext.define('Ext.data.proxy.Proxy', {
isProxy: true,
+
constructor: function(config) {
config = config || {};
@@ -26158,9 +26292,6 @@ Ext.define('Ext.data.proxy.Server', {
var me = this,
url = me.getUrl(request);
- if (!url) {
- Ext.Error.raise("You are using a ServerProxy but have not supplied it with a url.");
- }
if (me.noCache) {
url = Ext.urlAppend(url, Ext.String.format("{0}={1}", me.cacheString, Ext.Date.now()));
@@ -26176,7 +26307,6 @@ Ext.define('Ext.data.proxy.Server', {
doRequest: function(operation, callback, scope) {
- Ext.Error.raise("The doRequest function has not been implemented on your Ext.data.proxy.Server subclass. See src/data/ServerProxy.js for details");
},
@@ -26470,7 +26600,7 @@ Ext.define('Ext.data.Model', {
dirty : false,
- persistanceProperty: 'data',
+ persistenceProperty: 'data',
evented: false,
isModel: true,
@@ -26512,7 +26642,11 @@ Ext.define('Ext.data.Model', {
me.modified = {};
- me[me.persistanceProperty] = {};
+
+ if (me.persistanceProperty) {
+ me.persistenceProperty = me.persistanceProperty;
+ }
+ me[me.persistenceProperty] = {};
me.mixins.observable.constructor.call(me);
@@ -26548,13 +26682,11 @@ Ext.define('Ext.data.Model', {
}
me.id = me.modelName + '-' + me.internalId;
-
- Ext.ModelManager.register(me);
},
get: function(field) {
- return this[this.persistanceProperty][field];
+ return this[this.persistenceProperty][field];
},
@@ -26596,11 +26728,28 @@ Ext.define('Ext.data.Model', {
}
}
currentValue = me.get(fieldName);
- me[me.persistanceProperty][fieldName] = value;
+ me[me.persistenceProperty][fieldName] = value;
if (field && field.persist && !me.isEqual(currentValue, value)) {
- me.dirty = true;
- me.modified[fieldName] = currentValue;
+ if (me.isModified(fieldName)) {
+ if (me.isEqual(modified[fieldName], value)) {
+
+
+ delete modified[fieldName];
+
+
+ me.dirty = false;
+ for (key in modified) {
+ if (modified.hasOwnProperty(key)){
+ me.dirty = true;
+ break;
+ }
+ }
+ }
+ } else {
+ me.dirty = true;
+ modified[fieldName] = currentValue;
+ }
}
if (!me.editing) {
@@ -26623,7 +26772,7 @@ Ext.define('Ext.data.Model', {
if (!me.editing) {
me.editing = true;
me.dirtySave = me.dirty;
- me.dataSave = Ext.apply({}, me[me.persistanceProperty]);
+ me.dataSave = Ext.apply({}, me[me.persistenceProperty]);
me.modifiedSave = Ext.apply({}, me.modified);
}
},
@@ -26635,7 +26784,7 @@ Ext.define('Ext.data.Model', {
me.editing = false;
me.modified = me.modifiedSave;
- me[me.persistanceProperty] = me.dataSave;
+ me[me.persistenceProperty] = me.dataSave;
me.dirty = me.dirtySave;
delete me.modifiedSave;
delete me.dataSave;
@@ -26692,12 +26841,6 @@ Ext.define('Ext.data.Model', {
}, me);
},
- markDirty : function() {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.warn('Ext.data.Model: markDirty has been deprecated. Use setDirty instead.');
- }
- return this.setDirty.apply(this, arguments);
- },
reject : function(silent) {
@@ -26708,7 +26851,7 @@ Ext.define('Ext.data.Model', {
for (field in modified) {
if (modified.hasOwnProperty(field)) {
if (typeof modified[field] != "function") {
- me[me.persistanceProperty][field] = modified[field];
+ me[me.persistenceProperty][field] = modified[field];
}
}
}
@@ -26740,7 +26883,7 @@ Ext.define('Ext.data.Model', {
copy : function(newId) {
var me = this;
- return new me.self(Ext.apply({}, me[me.persistanceProperty]), newId || me.internalId);
+ return new me.self(Ext.apply({}, me[me.persistenceProperty]), newId || me.internalId);
},
@@ -27007,7 +27150,9 @@ Ext.define('Ext.Component', {
DIRECTION_TOP: 'top',
DIRECTION_RIGHT: 'right',
DIRECTION_BOTTOM: 'bottom',
- DIRECTION_LEFT: 'left'
+ DIRECTION_LEFT: 'left',
+
+ VERTICAL_DIRECTION: /^(?:top|bottom)$/
},
@@ -27751,11 +27896,6 @@ Ext.define('Ext.layout.container.Container', {
}
},
- afterLayout: function() {
- this.owner.afterLayout(arguments);
- this.callParent(arguments);
- },
-
getRenderedItems: function() {
var me = this,
@@ -27807,8 +27947,6 @@ Ext.define('Ext.layout.container.Auto', {
type: 'autocontainer',
- fixedLayout: false,
-
bindToOwnerCtComponent: true,
@@ -27835,6 +27973,18 @@ Ext.define('Ext.layout.container.Auto', {
me.setItemSize(items[i]);
}
}
+ },
+
+ configureItem: function(item) {
+
+
+
+ if (this.type === 'autocontainer') {
+ item.layoutManagedHeight = 2;
+ item.layoutManagedWidth = 2;
+ }
+
+ this.callParent(arguments);
}
});
@@ -27951,7 +28101,7 @@ Ext.define('Ext.container.AbstractContainer', {
if (me.rendered && layout && !me.suspendLayout) {
- if ((!Ext.isNumber(me.width) || !Ext.isNumber(me.height)) && me.componentLayout.type !== 'autocomponent') {
+ if (!me.isFixedWidth() || !me.isFixedHeight()) {
if (me.componentLayout.layoutBusy !== true) {
me.doComponentLayout();
@@ -28068,9 +28218,6 @@ Ext.define('Ext.container.AbstractContainer', {
for (i = 0, ln = items.length; i < ln; i++) {
item = items[i];
- if (!item) {
- Ext.Error.raise("Trying to add a null item as a child of Container with itemId/id: " + me.getItemId());
- }
if (index != -1) {
item = me.add(index + i, item);
@@ -28152,9 +28299,6 @@ Ext.define('Ext.container.AbstractContainer', {
remove : function(comp, autoDestroy) {
var me = this,
c = me.getComponent(comp);
- if (Ext.isDefined(Ext.global.console) && !c) {
- console.warn("Attempted to remove a component that does not exist. Ext.container.Container: remove takes an argument of the component to remove. cmp.remove() is incorrect usage.");
- }
if (c && me.fireEvent('beforeremove', me, c) !== false) {
me.doRemove(c, autoDestroy);
@@ -28214,7 +28358,9 @@ Ext.define('Ext.container.AbstractContainer', {
me.suspendLayout = false;
- me.doLayout();
+ if (len) {
+ me.doLayout();
+ }
return items;
},
@@ -28735,7 +28881,10 @@ Ext.define('Ext.button.Button', {
'<em class="{splitCls}">' +
'<tpl if="href">' +
'<a href="{href}" target="{target}"<tpl if="tabIndex"> tabIndex="{tabIndex}"</tpl> role="link">' +
- '<span class="{baseCls}-inner">{text}</span>' +
+ '<span class="{baseCls}-inner">' +
+ '{text}' +
+ '</span>' +
+ '<span class="{baseCls}-icon"></span>' +
'</a>' +
'</tpl>' +
'<tpl if="!href">' +
@@ -28743,7 +28892,10 @@ Ext.define('Ext.button.Button', {
'<tpl if="tabIndex"> tabIndex="{tabIndex}"</tpl> role="button" autocomplete="off">' +
- '<span class="{baseCls}-inner" style="{innerSpanStyle}">{text}</span>' +
+ '<span class="{baseCls}-inner" style="{innerSpanStyle}">' +
+ '{text}' +
+ '</span>' +
+ '<span class="{baseCls}-icon"></span>' +
'</button>' +
'</tpl>' +
'</em>' ,
@@ -28892,7 +29044,8 @@ Ext.define('Ext.button.Button', {
Ext.applyIf(me.renderSelectors, {
btnEl : me.href ? 'a' : 'button',
btnWrap: 'em',
- btnInnerEl: '.' + me.baseCls + '-inner'
+ btnInnerEl: '.' + me.baseCls + '-inner',
+ btnIconEl: '.'+ me.baseCls + '-icon'
});
if (me.scale) {
@@ -29031,11 +29184,11 @@ Ext.define('Ext.button.Button', {
setIconCls: function(cls) {
var me = this,
- btnInnerEl = me.btnInnerEl;
- if (btnInnerEl) {
+ btnIconEl = me.btnIconEl;
+ if (btnIconEl) {
- btnInnerEl.removeCls(me.iconCls);
- btnInnerEl.addCls(cls || '');
+ btnIconEl.removeCls(me.iconCls);
+ btnIconEl.addCls(cls || '');
me.setButtonCls();
}
me.iconCls = cls;
@@ -29728,7 +29881,6 @@ Ext.define('Ext.layout.container.boxOverflow.Menu', {
me.menu = Ext.create('Ext.menu.Menu', {
- hideMode: 'offsets',
listeners: {
scope: me,
beforeshow: me.beforeMenuShow
@@ -30018,7 +30170,6 @@ Ext.define('Ext.util.Region', {
return "Region[" + this.top + "," + this.right + "," + this.bottom + "," + this.left + "]";
},
-
translateBy: function(x, y) {
if (arguments.length == 1) {
@@ -30916,8 +31067,6 @@ Ext.define('Ext.layout.container.Box', {
bindToOwnerCtContainer: true,
- fixedLayout: false,
-
availableSpaceOffset: 0,
@@ -30959,11 +31108,12 @@ Ext.define('Ext.layout.container.Box', {
getChildBox: function(child) {
child = child.el || this.owner.getComponent(child).el;
+ var size = child.getBox(false, true);
return {
- left: child.getLeft(true),
- top: child.getTop(true),
- width: child.getWidth(),
- height: child.getHeight()
+ left: size.left,
+ top: size.top,
+ width: size.width,
+ height: size.height
};
},
@@ -31007,6 +31157,8 @@ Ext.define('Ext.layout.container.Box', {
paddingPerpendicular = perpendicularOffset + padding[me.perpendicularRightBottom],
availPerpendicularSize = mmax(0, perpendicularSize - paddingPerpendicular),
+ innerCtBorderWidth = me.innerCt.getBorderWidth(me.perpendicularLT + me.perpendicularRB),
+
isStart = me.pack == 'start',
isCenter = me.pack == 'center',
isEnd = me.pack == 'end',
@@ -31223,7 +31375,7 @@ Ext.define('Ext.layout.container.Box', {
- diff = mmax(availPerpendicularSize, maxSize) - me.innerCt.getBorderWidth(me.perpendicularLT + me.perpendicularRB) - calcs[perpendicularPrefix];
+ diff = mmax(availPerpendicularSize, maxSize) - innerCtBorderWidth - calcs[perpendicularPrefix];
if (diff > 0) {
calcs[me.perpendicularLeftTop] = perpendicularOffset + Math.round(diff / 2);
}
@@ -31310,7 +31462,7 @@ Ext.define('Ext.layout.container.Box', {
}
if (results.recalculate) {
- items = me.getVisibleItems(owner);
+ items = me.getVisibleItems();
calcs = me.calculateChildBoxes(items, targetSize);
boxes = calcs.boxes;
}
@@ -31614,7 +31766,21 @@ Ext.define('Ext.layout.container.HBox', {
perpendicularRB: 'b',
perpendicularLeftTop: 'top',
perpendicularRightBottom: 'bottom',
- perpendicularPosition: 'y'
+ perpendicularPosition: 'y',
+ configureItem: function(item) {
+ if (item.flex) {
+ item.layoutManagedWidth = 1;
+ } else {
+ item.layoutManagedWidth = 2;
+ }
+
+ if (this.align === 'stretch' || this.align === 'stretchmax') {
+ item.layoutManagedHeight = 1;
+ } else {
+ item.layoutManagedHeight = 2;
+ }
+ this.callParent(arguments);
+ }
});
Ext.define('Ext.layout.container.VBox', {
@@ -31657,7 +31823,21 @@ Ext.define('Ext.layout.container.VBox', {
perpendicularRB: 'r',
perpendicularLeftTop: 'left',
perpendicularRightBottom: 'right',
- perpendicularPosition: 'x'
+ perpendicularPosition: 'x',
+ configureItem: function(item) {
+ if (item.flex) {
+ item.layoutManagedHeight = 1;
+ } else {
+ item.layoutManagedHeight = 2;
+ }
+
+ if (this.align === 'stretch' || this.align === 'stretchmax') {
+ item.layoutManagedWidth = 1;
+ } else {
+ item.layoutManagedWidth = 2;
+ }
+ this.callParent(arguments);
+ }
});
Ext.define('Ext.FocusManager', {
@@ -31996,10 +32176,14 @@ Ext.define('Ext.FocusManager', {
if (!me.focusedCmp || !(parent = me.focusedCmp.up(':focusable'))) {
me.focusEl.focus();
- return;
+ } else {
+ parent.focus();
}
- parent.focus();
+
+
+
+ return true;
},
navigateSiblings: function(e, source, parent) {
@@ -32454,7 +32638,8 @@ Ext.define('Ext.toolbar.Toolbar', {
type: me.layout
} : me.layout || {}, {
type: me.vertical ? 'vbox' : 'hbox',
- align: me.vertical ? 'stretchmax' : 'middle'
+ align: me.vertical ? 'stretchmax' : 'middle',
+ clearInnerCtOnLayout: true
});
if (me.vertical) {
@@ -32603,25 +32788,28 @@ Ext.define('Ext.panel.AbstractPanel', {
+
-
-
+
isPanel: true,
componentLayout: 'dock',
+
+ defaultDockWeights: { top: 1, left: 3, right: 5, bottom: 7 },
+
renderTpl: ['<div class="{baseCls}-body<tpl if="bodyCls"> {bodyCls}</tpl> {baseCls}-body-{ui}<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-body-{parent.ui}-{.}</tpl></tpl>"<tpl if="bodyStyle"> style="{bodyStyle}"</tpl>></div>'],
-
+
border: true,
initComponent : function() {
var me = this;
-
+
me.addEvents(
'bodyresize'
@@ -32634,17 +32822,17 @@ Ext.define('Ext.panel.AbstractPanel', {
Ext.applyIf(me.renderSelectors, {
body: '.' + me.baseCls + '-body'
});
+
-
-
+
if (me.frame && me.border && me.bodyBorder === undefined) {
me.bodyBorder = false;
}
if (me.frame && me.border && (me.bodyBorder === false || me.bodyBorder === 0)) {
me.manageBodyBorders = true;
}
-
+
me.callParent();
},
@@ -32652,7 +32840,7 @@ Ext.define('Ext.panel.AbstractPanel', {
initItems : function() {
var me = this,
items = me.dockedItems;
-
+
me.callParent();
me.dockedItems = Ext.create('Ext.util.MixedCollection', false, me.getComponentId);
if (items) {
@@ -32711,13 +32899,13 @@ Ext.define('Ext.panel.AbstractPanel', {
delete me.bodyStyle;
return styles.length ? styles.join(';') : undefined;
},
-
+
initBodyCls: function() {
var me = this,
cls = '',
bodyCls = me.bodyCls;
-
+
if (bodyCls) {
Ext.each(bodyCls, function(v) {
cls += " " + v;
@@ -32726,7 +32914,7 @@ Ext.define('Ext.panel.AbstractPanel', {
}
return cls.length > 0 ? cls : undefined;
},
-
+
initRenderData: function() {
return Ext.applyIf(this.callParent(), {
@@ -32762,6 +32950,9 @@ Ext.define('Ext.panel.AbstractPanel', {
item.onAdded(me, i);
me.onDockedAdd(item);
}
+
+
+ me.componentLayout.childrenChanged = true;
if (me.rendered && !me.suspendLayout) {
me.doComponentLayout();
}
@@ -32782,7 +32973,7 @@ Ext.define('Ext.panel.AbstractPanel', {
var me = this,
layout,
hasLayout;
-
+
if (!me.dockedItems.contains(item)) {
return item;
}
@@ -32805,8 +32996,11 @@ Ext.define('Ext.panel.AbstractPanel', {
if (hasLayout && !autoDestroy) {
layout.afterRemove(item);
}
+
+
- if (!this.destroying) {
+ me.componentLayout.childrenChanged = true;
+ if (!me.destroying && !me.suspendLayout) {
me.doComponentLayout();
}
@@ -32816,9 +33010,7 @@ Ext.define('Ext.panel.AbstractPanel', {
getDockedItems : function(cqSelector) {
var me = this,
-
-
- defaultWeight = { top: 1, left: 3, right: 5, bottom: 7 },
+ defaultWeight = me.defaultDockWeights,
dockedItems;
if (me.dockedItems && me.dockedItems.items.length) {
@@ -32831,7 +33023,6 @@ Ext.define('Ext.panel.AbstractPanel', {
Ext.Array.sort(dockedItems, function(a, b) {
-
var aw = a.weight || defaultWeight[a.dock],
bw = b.weight || defaultWeight[b.dock];
if (Ext.isNumber(aw) && Ext.isNumber(bw)) {
@@ -32839,57 +33030,123 @@ Ext.define('Ext.panel.AbstractPanel', {
}
return 0;
});
-
+
return dockedItems;
}
return [];
},
-
+
addUIClsToElement: function(cls, force) {
- var me = this;
-
- me.callParent(arguments);
-
+ var me = this,
+ result = me.callParent(arguments),
+ classes = [Ext.baseCSSPrefix + cls, me.baseCls + '-body-' + cls, me.baseCls + '-body-' + me.ui + '-' + cls],
+ array, i;
+
if (!force && me.rendered) {
- me.body.addCls(Ext.baseCSSPrefix + cls);
- me.body.addCls(me.baseCls + '-body-' + cls);
- me.body.addCls(me.baseCls + '-body-' + me.ui + '-' + cls);
+ if (me.bodyCls) {
+ me.body.addCls(me.bodyCls);
+ } else {
+ me.body.addCls(classes);
+ }
+ } else {
+ if (me.bodyCls) {
+ array = me.bodyCls.split(' ');
+
+ for (i = 0; i < classes.length; i++) {
+ if (!Ext.Array.contains(array, classes[i])) {
+ array.push(classes[i]);
+ }
+ }
+
+ me.bodyCls = array.join(' ');
+ } else {
+ me.bodyCls = classes.join(' ');
+ }
}
+
+ return result;
},
-
+
removeUIClsFromElement: function(cls, force) {
- var me = this;
-
- me.callParent(arguments);
-
+ var me = this,
+ result = me.callParent(arguments),
+ classes = [Ext.baseCSSPrefix + cls, me.baseCls + '-body-' + cls, me.baseCls + '-body-' + me.ui + '-' + cls],
+ array, i;
+
if (!force && me.rendered) {
- me.body.removeCls(Ext.baseCSSPrefix + cls);
- me.body.removeCls(me.baseCls + '-body-' + cls);
- me.body.removeCls(me.baseCls + '-body-' + me.ui + '-' + cls);
+ if (me.bodyCls) {
+ me.body.removeCls(me.bodyCls);
+ } else {
+ me.body.removeCls(classes);
+ }
+ } else {
+ if (me.bodyCls) {
+ array = me.bodyCls.split(' ');
+
+ for (i = 0; i < classes.length; i++) {
+ Ext.Array.remove(array, classes[i]);
+ }
+
+ me.bodyCls = array.join(' ');
+ }
}
+
+ return result;
},
-
+
addUIToElement: function(force) {
- var me = this;
-
+ var me = this,
+ cls = me.baseCls + '-body-' + me.ui,
+ array;
+
me.callParent(arguments);
-
+
if (!force && me.rendered) {
- me.body.addCls(me.baseCls + '-body-' + me.ui);
+ if (me.bodyCls) {
+ me.body.addCls(me.bodyCls);
+ } else {
+ me.body.addCls(cls);
+ }
+ } else {
+ if (me.bodyCls) {
+ array = me.bodyCls.split(' ');
+
+ if (!Ext.Array.contains(array, cls)) {
+ array.push(cls);
+ }
+
+ me.bodyCls = array.join(' ');
+ } else {
+ me.bodyCls = cls;
+ }
}
},
-
+
removeUIFromElement: function() {
- var me = this;
-
+ var me = this,
+ cls = me.baseCls + '-body-' + me.ui,
+ array;
+
me.callParent(arguments);
-
+
if (me.rendered) {
- me.body.removeCls(me.baseCls + '-body-' + me.ui);
+ if (me.bodyCls) {
+ me.body.removeCls(me.bodyCls);
+ } else {
+ me.body.removeCls(cls);
+ }
+ } else {
+ if (me.bodyCls) {
+ array = me.bodyCls.split(' ');
+ Ext.Array.remove(array, cls);
+ me.bodyCls = array.join(' ');
+ } else {
+ me.bodyCls = cls;
+ }
}
},
@@ -32905,7 +33162,7 @@ Ext.define('Ext.panel.AbstractPanel', {
ln = dockedItems.length,
i = 0,
item;
-
+
for (; i < ln; i++) {
item = dockedItems[i];
@@ -32913,11 +33170,11 @@ Ext.define('Ext.panel.AbstractPanel', {
break;
}
}
+
-
- return dockedItems.splice(0, i).concat(items).concat(dockedItems);
+ return Ext.Array.splice(dockedItems, 0, i).concat(items).concat(dockedItems);
},
beforeDestroy: function(){
@@ -32931,7 +33188,7 @@ Ext.define('Ext.panel.AbstractPanel', {
}
this.callParent();
},
-
+
setBorder: function(border) {
var me = this;
me.border = (border !== undefined) ? border : true;
@@ -33025,6 +33282,7 @@ Ext.define('Ext.panel.Header', {
ariaRole : 'heading',
focusable: false,
viewBox: false,
+ flex : 1,
autoSize: true,
margins: '5 0 0 0',
items: [ me.textConfig ],
@@ -33043,6 +33301,7 @@ Ext.define('Ext.panel.Header', {
xtype : 'component',
ariaRole : 'heading',
focusable: false,
+ flex : 1,
renderTpl : ['<span class="{cls}-text {cls}-text-{ui}">{title}</span>'],
renderData: {
title: me.title,
@@ -33057,14 +33316,6 @@ Ext.define('Ext.panel.Header', {
me.items.push(me.titleCmp);
- me.items.push({
- xtype: 'component',
- html : '&nbsp;',
- flex : 1,
- focusable: false
- });
-
-
me.items = me.items.concat(me.tools);
this.callParent();
},
@@ -33112,36 +33363,90 @@ Ext.define('Ext.panel.Header', {
addUIClsToElement: function(cls, force) {
- var me = this;
-
- me.callParent(arguments);
+ var me = this,
+ result = me.callParent(arguments),
+ classes = [me.baseCls + '-body-' + cls, me.baseCls + '-body-' + me.ui + '-' + cls],
+ array, i;
if (!force && me.rendered) {
- me.body.addCls(me.baseCls + '-body-' + cls);
- me.body.addCls(me.baseCls + '-body-' + me.ui + '-' + cls);
+ if (me.bodyCls) {
+ me.body.addCls(me.bodyCls);
+ } else {
+ me.body.addCls(classes);
+ }
+ } else {
+ if (me.bodyCls) {
+ array = me.bodyCls.split(' ');
+
+ for (i = 0; i < classes.length; i++) {
+ if (!Ext.Array.contains(array, classes[i])) {
+ array.push(classes[i]);
+ }
+ }
+
+ me.bodyCls = array.join(' ');
+ } else {
+ me.bodyCls = classes.join(' ');
+ }
}
+
+ return result;
},
removeUIClsFromElement: function(cls, force) {
- var me = this;
-
- me.callParent(arguments);
+ var me = this,
+ result = me.callParent(arguments),
+ classes = [me.baseCls + '-body-' + cls, me.baseCls + '-body-' + me.ui + '-' + cls],
+ array, i;
if (!force && me.rendered) {
- me.body.removeCls(me.baseCls + '-body-' + cls);
- me.body.removeCls(me.baseCls + '-body-' + me.ui + '-' + cls);
+ if (me.bodyCls) {
+ me.body.removeCls(me.bodyCls);
+ } else {
+ me.body.removeCls(classes);
+ }
+ } else {
+ if (me.bodyCls) {
+ array = me.bodyCls.split(' ');
+
+ for (i = 0; i < classes.length; i++) {
+ Ext.Array.remove(array, classes[i]);
+ }
+
+ me.bodyCls = array.join(' ');
+ }
}
+
+ return result;
},
addUIToElement: function(force) {
- var me = this;
+ var me = this,
+ array, cls;
me.callParent(arguments);
+ cls = me.baseCls + '-body-' + me.ui;
if (!force && me.rendered) {
- me.body.addCls(me.baseCls + '-body-' + me.ui);
+ if (me.bodyCls) {
+ me.body.addCls(me.bodyCls);
+ } else {
+ me.body.addCls(cls);
+ }
+ } else {
+ if (me.bodyCls) {
+ array = me.bodyCls.split(' ');
+
+ if (!Ext.Array.contains(array, cls)) {
+ array.push(cls);
+ }
+
+ me.bodyCls = array.join(' ');
+ } else {
+ me.bodyCls = cls;
+ }
}
if (!force && me.titleCmp && me.titleCmp.rendered && me.titleCmp.textEl) {
@@ -33151,12 +33456,26 @@ Ext.define('Ext.panel.Header', {
removeUIFromElement: function() {
- var me = this;
+ var me = this,
+ array, cls;
me.callParent(arguments);
+ cls = me.baseCls + '-body-' + me.ui;
if (me.rendered) {
- me.body.removeCls(me.baseCls + '-body-' + me.ui);
+ if (me.bodyCls) {
+ me.body.removeCls(me.bodyCls);
+ } else {
+ me.body.removeCls(cls);
+ }
+ } else {
+ if (me.bodyCls) {
+ array = me.bodyCls.split(' ');
+ Ext.Array.remove(array, cls);
+ me.bodyCls = array.join(' ');
+ } else {
+ me.bodyCls = cls;
+ }
}
if (me.titleCmp && me.titleCmp.rendered && me.titleCmp.textEl) {
@@ -33959,7 +34278,6 @@ Ext.require('Ext.fx.CubicBezier', function() {
});
});
-
Ext.define('Ext.draw.Draw', {
@@ -34053,12 +34371,12 @@ Ext.define('Ext.draw.Draw', {
b && params.push(+b);
});
if (name == "m" && params.length > 2) {
- data.push([b].concat(params.splice(0, 2)));
+ data.push([b].concat(Ext.Array.splice(params, 0, 2)));
name = "l";
b = (b == "m") ? "l" : "L";
}
while (params.length >= paramCounts[name]) {
- data.push([b].concat(params.splice(0, paramCounts[name])));
+ data.push([b].concat(Ext.Array.splice(params, 0, paramCounts[name])));
if (!paramCounts[name]) {
break;
}
@@ -34288,9 +34606,9 @@ Ext.define('Ext.draw.Draw', {
points[i].shift();
point = points[i];
while (point.length) {
- points.splice(i++, 0, ["C"].concat(point.splice(0, 6)));
+ Ext.Array.splice(points, i++, 0, ["C"].concat(Ext.Array.splice(point, 0, 6)));
}
- points.splice(i, 1);
+ Ext.Array.erase(points, i, 1);
ln = points.length;
}
seg = points[i];
@@ -34314,15 +34632,15 @@ Ext.define('Ext.draw.Draw', {
pp[i].shift();
var pi = pp[i];
while (pi.length) {
- pp.splice(i++, 0, ["C"].concat(pi.splice(0, 6)));
+ Ext.Array.splice(pp, i++, 0, ["C"].concat(Ext.Array.splice(pi, 0, 6)));
}
- pp.splice(i, 1);
+ Ext.Array.erase(pp, i, 1);
ii = Math.max(p.length, p2.length || 0);
}
},
fixM = function (path1, path2, a1, a2, i) {
if (path1 && path2 && path1[i][0] == "M" && path2[i][0] != "M") {
- path2.splice(i, 0, ["M", a2.x, a2.y]);
+ Ext.Array.splice(path2, i, 0, ["M", a2.x, a2.y]);
a1.bx = 0;
a1.by = 0;
a1.x = path1[i][1];
@@ -34723,27 +35041,74 @@ Ext.define('Ext.draw.Draw', {
};
},
- getAnchors: function (p1x, p1y, p2x, p2y, p3x, p3y, value) {
+
+ getAnchors: function (prevX, prevY, curX, curY, nextX, nextY, value) {
value = value || 4;
- var l = Math.min(Math.sqrt(Math.pow(p1x - p2x, 2) + Math.pow(p1y - p2y, 2)) / value, Math.sqrt(Math.pow(p3x - p2x, 2) + Math.pow(p3y - p2y, 2)) / value),
- a = Math.atan((p2x - p1x) / Math.abs(p2y - p1y)),
- b = Math.atan((p3x - p2x) / Math.abs(p2y - p3y)),
- pi = Math.PI;
- a = p1y < p2y ? pi - a : a;
- b = p3y < p2y ? pi - b : b;
- var alpha = pi / 2 - ((a + b) % (pi * 2)) / 2;
- alpha > pi / 2 && (alpha -= pi);
- var dx1 = l * Math.sin(alpha + a),
- dy1 = l * Math.cos(alpha + a),
- dx2 = l * Math.sin(alpha + b),
- dy2 = l * Math.cos(alpha + b),
- out = {
- x1: p2x - dx1,
- y1: p2y + dy1,
- x2: p2x + dx2,
- y2: p2y + dy2
- };
- return out;
+ var M = Math,
+ PI = M.PI,
+ halfPI = PI / 2,
+ abs = M.abs,
+ sin = M.sin,
+ cos = M.cos,
+ atan = M.atan,
+ control1Length, control2Length, control1Angle, control2Angle,
+ control1X, control1Y, control2X, control2Y, alpha;
+
+
+
+ control1Length = (curX - prevX) / value;
+ control2Length = (nextX - curX) / value;
+
+
+
+
+
+ if ((curY >= prevY && curY >= nextY) || (curY <= prevY && curY <= nextY)) {
+ control1Angle = control2Angle = halfPI;
+ } else {
+ control1Angle = atan((curX - prevX) / abs(curY - prevY));
+ if (prevY < curY) {
+ control1Angle = PI - control1Angle;
+ }
+ control2Angle = atan((nextX - curX) / abs(curY - nextY));
+ if (nextY < curY) {
+ control2Angle = PI - control2Angle;
+ }
+ }
+
+
+ alpha = halfPI - ((control1Angle + control2Angle) % (PI * 2)) / 2;
+ if (alpha > halfPI) {
+ alpha -= PI;
+ }
+ control1Angle += alpha;
+ control2Angle += alpha;
+
+
+ control1X = curX - control1Length * sin(control1Angle);
+ control1Y = curY + control1Length * cos(control1Angle);
+ control2X = curX + control2Length * sin(control2Angle);
+ control2Y = curY + control2Length * cos(control2Angle);
+
+
+
+
+
+ if ((curY > prevY && control1Y < prevY) || (curY < prevY && control1Y > prevY)) {
+ control1X += abs(prevY - control1Y) * (control1X - curX) / (control1Y - curY);
+ control1Y = prevY;
+ }
+ if ((curY > nextY && control2Y < nextY) || (curY < nextY && control2Y > nextY)) {
+ control2X -= abs(nextY - control2Y) * (control2X - curX) / (control2Y - curY);
+ control2Y = nextY;
+ }
+
+ return {
+ x1: control1X,
+ y1: control1Y,
+ x2: control2X,
+ y2: control2Y
+ };
},
@@ -34939,23 +35304,25 @@ Ext.define('Ext.fx.PropertyHandler', {
statics: {
defaultHandler: {
- pixelDefaults: ['width', 'height', 'top', 'left'],
+ pixelDefaultsRE: /width|height|top$|bottom$|left$|right$/i,
unitRE: /^(-?\d*\.?\d*){1}(em|ex|px|in|cm|mm|pt|pc|%)*$/,
+ scrollRE: /^scroll/i,
computeDelta: function(from, end, damper, initial, attr) {
damper = (typeof damper == 'number') ? damper : 1;
- var match = this.unitRE.exec(from),
+ var unitRE = this.unitRE,
+ match = unitRE.exec(from),
start, units;
if (match) {
from = match[1];
units = match[2];
- if (!units && Ext.Array.contains(this.pixelDefaults, attr)) {
+ if (!this.scrollRE.test(attr) && !units && this.pixelDefaultsRE.test(attr)) {
units = 'px';
}
}
from = +from || 0;
- match = this.unitRE.exec(end);
+ match = unitRE.exec(end);
if (match) {
end = match[1];
units = match[2] || units;
@@ -35501,9 +35868,10 @@ Ext.enableFx = true;
-
Ext.define('Ext.dd.DragDrop', {
requires: ['Ext.dd.DragDropManager'],
+
+
constructor: function(id, sGroup, config) {
if(id) {
this.init(id, sGroup, config);
@@ -35725,7 +36093,6 @@ Ext.define('Ext.dd.DragDrop', {
initTarget: function(id, sGroup, config) {
-
this.config = config || {};
@@ -35782,7 +36149,7 @@ Ext.define('Ext.dd.DragDrop', {
this.onAvailable();
},
-
+
setPadding: function(iTop, iRight, iBot, iLeft) {
if (!iRight && 0 !== iRight) {
@@ -36141,6 +36508,8 @@ Ext.define('Ext.dd.DragDrop', {
Ext.define('Ext.dd.DD', {
extend: 'Ext.dd.DragDrop',
requires: ['Ext.dd.DragDropManager'],
+
+
constructor: function(id, sGroup, config) {
if (id) {
this.init(id, sGroup, config);
@@ -36350,6 +36719,7 @@ Ext.define('Ext.dd.DDProxy', {
dragElId: "ygddfdiv"
},
+
constructor: function(id, sGroup, config) {
if (id) {
this.init(id, sGroup, config);
@@ -36509,6 +36879,7 @@ Ext.define('Ext.dd.DragSource', {
repairHighlightColor: 'c3daf9',
+
constructor: function(el, config) {
this.el = Ext.get(el);
if(!this.dragData){
@@ -36833,7 +37204,8 @@ Ext.define('Ext.panel.Panel', {
'Ext.util.KeyMap',
'Ext.panel.DD',
'Ext.XTemplate',
- 'Ext.layout.component.Dock'
+ 'Ext.layout.component.Dock',
+ 'Ext.util.Memento'
],
alias: 'widget.panel',
alternateClassName: 'Ext.Panel',
@@ -36865,9 +37237,9 @@ Ext.define('Ext.panel.Panel', {
floatable: true,
+
-
-
+
collapsible: false,
@@ -36895,24 +37267,41 @@ Ext.define('Ext.panel.Panel', {
+
initComponent: function() {
var me = this,
cls;
me.addEvents(
-
+
+ "beforeexpand",
+
+
+ "beforecollapse",
+
+
+ "expand",
+
+
+ "collapse",
+
+
'titlechange',
-
+
+
'iconchange'
);
+
+ this.addStateEvents('expand', 'collapse');
+
if (me.unstyled) {
me.setUI('plain');
}
if (me.frame) {
- me.setUI('default-framed');
+ me.setUI(me.ui + '-framed');
}
me.callParent();
@@ -36939,7 +37328,7 @@ Ext.define('Ext.panel.Panel', {
-
+
this.callParent(arguments);
},
@@ -37006,7 +37395,7 @@ Ext.define('Ext.panel.Panel', {
fbarDefaults,
minButtonWidth = me.minButtonWidth;
- function initToolbar (toolbar, pos) {
+ function initToolbar (toolbar, pos, useButtonAlign) {
if (Ext.isArray(toolbar)) {
toolbar = {
xtype: 'toolbar',
@@ -37020,11 +37409,21 @@ Ext.define('Ext.panel.Panel', {
if (pos == 'left' || pos == 'right') {
toolbar.vertical = true;
}
+
+
+ if (useButtonAlign) {
+ toolbar.layout = Ext.applyIf(toolbar.layout || {}, {
+
+ pack: { left:'start', center:'center' }[me.buttonAlign] || 'end'
+ });
+ }
return toolbar;
}
+
+
if (me.tbar) {
me.addDocked(initToolbar(me.tbar, 'top'));
@@ -37045,7 +37444,7 @@ Ext.define('Ext.panel.Panel', {
if (me.fbar) {
- fbar = initToolbar(me.fbar, 'bottom');
+ fbar = initToolbar(me.fbar, 'bottom', true);
fbar.ui = 'footer';
@@ -37061,12 +37460,7 @@ Ext.define('Ext.panel.Panel', {
};
}
- fbar = me.addDocked(fbar)[0];
- fbar.insert(0, {
- flex: 1,
- xtype: 'component',
- focusable: false
- });
+ me.addDocked(fbar);
me.fbar = null;
}
@@ -37153,28 +37547,16 @@ Ext.define('Ext.panel.Panel', {
me.updateHeader();
-
+ me.callParent(arguments);
+ },
+
+ afterRender: function() {
+ var me = this;
+ me.callParent(arguments);
if (me.collapsed) {
me.collapsed = false;
- topContainer = me.findLayoutController();
- if (!me.hidden && topContainer) {
- topContainer.on({
- afterlayout: function() {
- me.collapse(null, false, true);
- },
- single: true
- });
- } else {
- me.afterComponentLayout = function() {
- delete me.afterComponentLayout;
- Ext.getClass(me).prototype.afterComponentLayout.apply(me, arguments);
- me.collapse(null, false, true);
- };
- }
+ me.collapse(null, false, true);
}
-
-
- me.callParent(arguments);
},
@@ -37401,13 +37783,13 @@ Ext.define('Ext.panel.Panel', {
}
frameInfo = reExpander.getFrameInfo();
-
+
newSize = reExpander[getDimension]() + (frameInfo ? frameInfo[direction] : 0);
reExpander.removeClsWithUI(me.collapsedCls);
- reExpander.removeClsWithUI(me.collapsedCls + '-' + reExpander.dock);
+ reExpander.removeClsWithUI(me.collapsedCls + '-' + reExpander.dock);
if (me.border && (!me.frame || (me.frame && Ext.supports.CSS3BorderRadius))) {
reExpander.removeClsWithUI(me.collapsedCls + '-border-' + reExpander.dock);
}
@@ -37467,9 +37849,17 @@ Ext.define('Ext.panel.Panel', {
anim.to[collapseDimension] = newSize;
+
+
+
+
+ if (!me.collapseMemento) {
+ me.collapseMemento = new Ext.util.Memento(me);
+ }
+ me.collapseMemento.capture(['width', 'height', 'minWidth', 'minHeight']);
+
+
me.savedFlex = me.flex;
- me.savedMinWidth = me.minWidth;
- me.savedMinHeight = me.minHeight;
me.minWidth = 0;
me.minHeight = 0;
delete me.flex;
@@ -37477,10 +37867,6 @@ Ext.define('Ext.panel.Panel', {
if (animate) {
me.animate(anim);
} else {
-
-
- me.uncollapsedSize = { width: me.width, height: me.height };
-
me.setSize(anim.to.width, anim.to.height);
if (Ext.isDefined(anim.to.left) || Ext.isDefined(anim.to.top)) {
me.setPosition(anim.to.left, anim.to.top);
@@ -37495,8 +37881,7 @@ Ext.define('Ext.panel.Panel', {
i = 0,
l = me.hiddenDocked.length;
- me.minWidth = me.savedMinWidth;
- me.minHeight = me.savedMinHeight;
+ me.collapseMemento.restore(['minWidth', 'minHeight']);
me.body.hide();
for (; i < l; i++) {
@@ -37517,6 +37902,13 @@ Ext.define('Ext.panel.Panel', {
}
+ if (Ext.Component.VERTICAL_DIRECTION.test(me.expandDirection)) {
+ me.collapseMemento.restore('width');
+ } else {
+ me.collapseMemento.restore('height');
+ }
+
+
if (me.collapseTool) {
me.collapseTool.setType('expand-' + me.expandDirection);
}
@@ -37532,29 +37924,17 @@ Ext.define('Ext.panel.Panel', {
expand: function(animate) {
- if (!this.collapsed || this.fireEvent('beforeexpand', this, animate) === false) {
+ var me = this;
+ if (!me.collapsed || me.fireEvent('beforeexpand', me, animate) === false) {
return false;
}
-
- if (this.uncollapsedSize) {
- Ext.Object.each(this.uncollapsedSize, function (name, value) {
- if (Ext.isDefined(value)) {
- this[name] = value;
- } else {
- delete this[name];
- }
- }, this);
- delete this.uncollapsedSize;
- }
-
- var me = this,
- i = 0,
+ var i = 0,
l = me.hiddenDocked.length,
direction = me.expandDirection,
height = me.getHeight(),
width = me.getWidth(),
- pos, anim, satisfyJSLint;
+ pos, anim;
if (animate && me.collapseTool) {
@@ -37671,7 +38051,7 @@ Ext.define('Ext.panel.Panel', {
if (animate) {
me.animate(anim);
} else {
- me.setSize(anim.to.width, anim.to.height);
+ me.setCalculatedSize(anim.to.width, anim.to.height);
if (anim.to.x) {
me.setLeft(anim.to.x);
}
@@ -37686,6 +38066,14 @@ Ext.define('Ext.panel.Panel', {
afterExpand: function(animated) {
var me = this;
+
+ if (me.collapseMemento) {
+
+
+
+ me.collapseMemento.restoreAll();
+ }
+
me.setAutoScroll(me.initialConfig.autoScroll);
@@ -37699,7 +38087,9 @@ Ext.define('Ext.panel.Panel', {
delete me.suspendLayout;
if (animated && me.ownerCt) {
- me.ownerCt.doLayout();
+
+
+ Ext.defer(me.ownerCt.doLayout, Ext.isIE6 ? 1 : 0, me);
}
if (me.resizer) {
@@ -37936,6 +38326,7 @@ Ext.define('Ext.tip.Tip', {
focusOnToFront: false,
componentLayout: 'tip',
+
closeAction: 'hide',
ariaRole: 'tooltip',
@@ -38192,9 +38583,6 @@ Ext.define('Ext.tip.ToolTip', {
me.tipAnchor = me.anchor.charAt(0);
} else {
m = me.defaultAlign.match(/^([a-z]+)-([a-z]+)(\?)?$/);
- if (!m) {
- Ext.Error.raise('The AnchorTip.defaultAlign value "' + me.defaultAlign + '" is invalid.');
- }
me.tipAnchor = m[1].charAt(0);
}
@@ -38767,13 +39155,6 @@ Ext.define('Ext.tip.QuickTipManager', function() {
if (autoRender !== false) {
tipConfig.renderTo = document.body;
- if (tipConfig.renderTo.tagName != 'BODY') {
- Ext.Error.raise({
- sourceClass: 'Ext.tip.QuickTipManager',
- sourceMethod: 'init',
- msg: 'Cannot init QuickTipManager: no document body'
- });
- }
}
tip = Ext.create(className || 'Ext.tip.QuickTip', tipConfig);
@@ -38876,6 +39257,7 @@ Ext.define('Ext.app.Application', {
autoCreateViewport: false,
+
constructor: function(config) {
config = config || {};
Ext.apply(this, config);
@@ -39427,7 +39809,6 @@ Ext.define('Ext.chart.theme.Theme', {
return;
}
}
- Ext.Error.raise('No theme found named "' + theme + '"');
}
}
},
@@ -39531,6 +39912,7 @@ function() {
Ext.define('Ext.chart.Mask', {
+
constructor: function(config) {
var me = this;
@@ -39943,14 +40325,16 @@ Ext.define('Ext.draw.Surface', {
zIndex: 0
},
-
-
+
+
+
container: undefined,
height: 352,
width: 512,
x: 0,
y: 0,
+
constructor: function(config) {
var me = this;
config = config || {};
@@ -40804,6 +41188,7 @@ Ext.define('Ext.chart.Legend', {
boxZIndex: 100,
+
constructor: function(config) {
var me = this;
if (config) {
@@ -40995,7 +41380,6 @@ Ext.define('Ext.chart.Legend', {
}
});
-
Ext.define('Ext.chart.Chart', {
@@ -41635,10 +42019,7 @@ Ext.define('Ext.chart.Highlight', {
opts = me.highlightCfg,
surface = me.chart.surface,
animate = me.chart.animate,
- p,
- from,
- to,
- pi;
+ p, from, to, pi;
if (!me.highlight || !sprite || sprite._highlighted) {
return;
@@ -41648,8 +42029,7 @@ Ext.define('Ext.chart.Highlight', {
}
sprite._highlighted = true;
if (!sprite._defaults) {
- sprite._defaults = Ext.apply(sprite._defaults || {},
- sprite.attr);
+ sprite._defaults = Ext.apply({}, sprite.attr);
from = {};
to = {};
for (p in opts) {
@@ -41679,6 +42059,7 @@ Ext.define('Ext.chart.Highlight', {
}
sprite._from = from;
sprite._to = to;
+ sprite._endStyle = to;
}
if (animate) {
sprite._anim = Ext.create('Ext.fx.Anim', {
@@ -41704,9 +42085,7 @@ Ext.define('Ext.chart.Highlight', {
opts = me.highlightCfg,
animate = me.chart.animate,
i = 0,
- obj,
- p,
- sprite;
+ obj, p, sprite;
for (; i < len; i++) {
if (!items[i]) {
@@ -41728,6 +42107,8 @@ Ext.define('Ext.chart.Highlight', {
}
}
if (animate) {
+
+ sprite._endStyle = obj;
sprite._anim = Ext.create('Ext.fx.Anim', {
target: sprite,
to: obj,
@@ -41817,7 +42198,6 @@ Ext.define('Ext.chart.Label', {
var me = this,
chart = me.chart,
gradients = chart.gradients,
- gradient,
items = me.items,
animate = chart.animate,
config = me.label,
@@ -41827,14 +42207,12 @@ Ext.define('Ext.chart.Label', {
group = me.labelsGroup,
store = me.chart.store,
len = store.getCount(),
- ratio = items.length / len,
- i, count, index, j,
- k, gradientsCount = (gradients || 0) && gradients.length,
- colorStopTotal, colorStopIndex, colorStop,
- item, label, storeItem,
- sprite, spriteColor, spriteBrightness, labelColor,
+ itemLength = (items || 0) && items.length,
+ ratio = itemLength / len,
+ gradientsCount = (gradients || 0) && gradients.length,
Color = Ext.draw.Color,
- colorString;
+ gradient, i, count, index, j, k, colorStopTotal, colorStopIndex, colorStop, item, label,
+ storeItem, sprite, spriteColor, spriteBrightness, labelColor, colorString;
if (display == 'none') {
return;
@@ -41865,7 +42243,18 @@ Ext.define('Ext.chart.Label', {
if (config.contrast && item.sprite) {
sprite = item.sprite;
- colorString = sprite._to && sprite._to.fill || sprite.attr.fill;
+
+ if (sprite._endStyle) {
+ colorString = sprite._endStyle.fill;
+ }
+ else if (sprite._to) {
+ colorString = sprite._to.fill;
+ }
+ else {
+ colorString = sprite.attr.fill;
+ }
+ colorString = colorString || sprite.attr.fill;
+
spriteColor = Color.fromString(colorString);
if (colorString && !spriteColor) {
@@ -41887,9 +42276,11 @@ Ext.define('Ext.chart.Label', {
else {
spriteBrightness = spriteColor.getGrayscale() / 255;
}
+ if (label.isOutside) {
+ spriteBrightness = 1;
+ }
labelColor = Color.fromString(label.attr.color || label.attr.fill).getHSL();
-
- labelColor[2] = spriteBrightness > 0.5? 0.2 : 0.8;
+ labelColor[2] = spriteBrightness > 0.5 ? 0.2 : 0.8;
label.setAttributes({
fill: String(Color.fromHSL.apply({}, labelColor))
}, true);
@@ -42091,6 +42482,7 @@ Ext.define('Ext.chart.axis.Abstract', {
+
constructor: function(config) {
config = config || {};
@@ -42144,6 +42536,8 @@ Ext.define('Ext.chart.axis.Axis', {
+
+
//@private force min/max values from store
@@ -43062,22 +43456,20 @@ Ext.define('Ext.chart.axis.Numeric', {
alias: 'axis.numeric',
constructor: function(config) {
- var me = this, label, f;
+ var me = this,
+ hasLabel = !!(config.label && config.label.renderer),
+ label;
+
me.callParent([config]);
label = me.label;
if (me.roundToDecimal === false) {
return;
}
- if (label.renderer) {
- f = label.renderer;
- label.renderer = function(v) {
- return me.roundToDecimal( f(v), me.decimals );
- };
- } else {
+ if (!hasLabel) {
label.renderer = function(v) {
return me.roundToDecimal(v, me.decimals);
};
- }
+ }
},
roundToDecimal: function(v, dec) {
@@ -44562,7 +44954,7 @@ Ext.define('Ext.data.Store', {
if (!options.addRecords) {
delete me.snapshot;
- me.data.clear();
+ me.clearData();
}
me.data.addAll(records);
@@ -44766,9 +45158,6 @@ Ext.define('Ext.data.Store', {
for (; i < end; i++) {
if (!me.prefetchData.getByKey(i)) {
satisfied = false;
- if (end - i > me.pageSize) {
- Ext.Error.raise("A single page prefetch could never satisfy this request.");
- }
break;
}
}
@@ -44790,9 +45179,6 @@ Ext.define('Ext.data.Store', {
record,
i = start;
- if (start > end) {
- Ext.Error.raise("Start (" + start + ") was greater than end (" + end + ")");
- }
if (start !== me.guaranteedStart && end !== me.guaranteedEnd) {
me.guaranteedStart = start;
@@ -44800,9 +45186,6 @@ Ext.define('Ext.data.Store', {
for (; i <= end; i++) {
record = me.prefetchData.getByKey(i);
- if (!record) {
- Ext.Error.raise("Record was not found and store said it was guaranteed");
- }
range.push(record);
}
me.fireEvent('guaranteedrange', range, start, end);
@@ -44842,16 +45225,6 @@ Ext.define('Ext.data.Store', {
guaranteeRange: function(start, end, cb, scope) {
- if (start && end) {
- if (end - start > this.pageSize) {
- Ext.Error.raise({
- start: start,
- end: end,
- pageSize: this.pageSize,
- msg: "Requested a bigger range than the specified pageSize"
- });
- }
- }
end = (end > this.totalCount) ? this.totalCount - 1 : end;
@@ -46998,6 +47371,7 @@ Ext.define('Ext.chart.series.Bar', {
text: text
});
+ label.isOutside = false;
if (column) {
if (display == outside) {
if (height + offsetY + attr.height > (yValue >= 0 ? zero - chartBBox.y : chartBBox.y + chartBBox.height - zero)) {
@@ -47006,6 +47380,7 @@ Ext.define('Ext.chart.series.Bar', {
} else {
if (height + offsetY > attr.height) {
display = outside;
+ label.isOutside = true;
}
}
x = attr.x + groupBarWidth / 2;
@@ -47023,6 +47398,7 @@ Ext.define('Ext.chart.series.Bar', {
else {
if (width + offsetX > attr.width) {
display = outside;
+ label.isOutside = true;
}
}
x = display == insideStart ?
@@ -47151,8 +47527,29 @@ Ext.define('Ext.chart.series.Bar', {
getLegendColor: function(index) {
- var me = this;
- return me.colorArrayStyle[index % me.colorArrayStyle.length];
+ var me = this,
+ colorLength = me.colorArrayStyle.length;
+
+ if (me.style && me.style.fill) {
+ return me.style.fill;
+ } else {
+ return me.colorArrayStyle[index % colorLength];
+ }
+ },
+
+ highlightItem: function(item) {
+ this.callParent(arguments);
+ this.renderLabels();
+ },
+
+ unHighlightItem: function() {
+ this.callParent(arguments);
+ this.renderLabels();
+ },
+
+ cleanHighlights: function() {
+ this.callParent(arguments);
+ this.renderLabels();
}
});
@@ -47607,6 +48004,9 @@ Ext.define('Ext.chart.series.Line', {
smooth: false,
+ defaultSmoothness: 3,
+
+
fill: false,
constructor: function(config) {
@@ -47698,7 +48098,8 @@ Ext.define('Ext.chart.series.Line', {
markerGroup = me.markerGroup,
enableShadows = chart.shadow,
shadowGroups = me.shadowGroups,
- shadowAttributes = this.shadowAttributes,
+ shadowAttributes = me.shadowAttributes,
+ smooth = me.smooth,
lnsh = shadowGroups.length,
dummyPath = ["M"],
path = ["M"],
@@ -47708,6 +48109,7 @@ Ext.define('Ext.chart.series.Line', {
shadowBarAttr,
xValues = [],
yValues = [],
+ storeIndices = [],
numericAxis = true,
axisCount = 0,
onbreak = false,
@@ -47722,10 +48124,11 @@ Ext.define('Ext.chart.series.Line', {
'top': 'bottom',
'bottom': 'top'
},
+ isNumber = Ext.isNumber,
seriesIdx = me.seriesIdx, shadows, shadow, shindex, fromPath, fill, fillPath, rendererAttributes,
x, y, prevX, prevY, firstY, markerCount, i, j, ln, axis, ends, marker, markerAux, item, xValue,
yValue, coords, xScale, yScale, minX, maxX, minY, maxY, line, animation, endMarkerStyle,
- endLineStyle, type, props, firstMarker, count;
+ endLineStyle, type, props, firstMarker, count, smoothPath, renderPath;
if (!store || !store.getCount()) {
@@ -47805,7 +48208,7 @@ Ext.define('Ext.chart.series.Line', {
- if (me.xField && !Ext.isNumber(minX)) {
+ if (me.xField && !isNumber(minX)) {
if (me.axis == 'bottom' || me.axis == 'top') {
axis = Ext.create('Ext.chart.axis.Axis', {
chart: chart,
@@ -47824,7 +48227,7 @@ Ext.define('Ext.chart.series.Line', {
}
}
- if (me.yField && !Ext.isNumber(minY)) {
+ if (me.yField && !isNumber(minY)) {
if (me.axis == 'right' || me.axis == 'left') {
axis = Ext.create('Ext.chart.axis.Axis', {
chart: chart,
@@ -47848,7 +48251,10 @@ Ext.define('Ext.chart.series.Line', {
xScale = bbox.width / (store.getCount() - 1);
}
else {
- xScale = bbox.width / (maxX - minX);
+
+
+
+ xScale = bbox.width / ((maxX - minX) || (store.getCount() - 1));
}
if (isNaN(minY)) {
@@ -47856,7 +48262,10 @@ Ext.define('Ext.chart.series.Line', {
yScale = bbox.height / (store.getCount() - 1);
}
else {
- yScale = bbox.height / (maxY - minY);
+
+
+
+ yScale = bbox.height / ((maxY - minY) || (store.getCount() - 1));
}
store.each(function(record, i) {
@@ -47864,9 +48273,6 @@ Ext.define('Ext.chart.series.Line', {
yValue = record.get(me.yField);
if (typeof yValue == 'undefined' || (typeof yValue == 'string' && !yValue)) {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.warn("[Ext.chart.series.Line] Skipping a store element with an undefined value at ", record, xValue, yValue);
- }
return;
}
@@ -47880,6 +48286,7 @@ Ext.define('Ext.chart.series.Line', {
|| (me.axis != 'left' && me.axis != 'right' && !numericAxis)) {
yValue = i;
}
+ storeIndices.push(i);
xValues.push(xValue);
yValues.push(yValue);
}, me);
@@ -47974,12 +48381,13 @@ Ext.define('Ext.chart.series.Line', {
};
}
}
+
me.items.push({
series: me,
value: [xValue, yValue],
point: [x, y],
sprite: marker,
- storeItem: store.getAt(i)
+ storeItem: store.getAt(storeIndices[i])
});
prevX = x;
prevY = y;
@@ -47989,19 +48397,23 @@ Ext.define('Ext.chart.series.Line', {
return;
}
-
- if (me.smooth) {
- path = Ext.draw.Draw.smooth(path, 6);
+
+ if (smooth) {
+ smoothPath = Ext.draw.Draw.smooth(path, isNumber(smooth) ? smooth : me.defaultSmoothness);
}
+ renderPath = smooth ? smoothPath : path;
+
if (chart.markerIndex && me.previousPath) {
fromPath = me.previousPath;
- fromPath.splice(1, 2);
+ if (!smooth) {
+ Ext.Array.erase(fromPath, 1, 2);
+ }
} else {
fromPath = path;
}
-
+
if (!me.line) {
me.line = surface.add(Ext.apply({
@@ -48034,7 +48446,7 @@ Ext.define('Ext.chart.series.Line', {
}
}
if (me.fill) {
- fillPath = path.concat([
+ fillPath = renderPath.concat([
["L", x, bbox.y + bbox.height],
["L", bbox.x, bbox.y + bbox.height],
["L", bbox.x, firstY]
@@ -48044,7 +48456,7 @@ Ext.define('Ext.chart.series.Line', {
group: group,
type: 'path',
opacity: endLineStyle.opacity || 0.3,
- fill: colorArrayStyle[seriesIdx % colorArrayLength] || endLineStyle.fill,
+ fill: endLineStyle.fill || colorArrayStyle[seriesIdx % colorArrayLength],
path: dummyPath
});
}
@@ -48054,7 +48466,7 @@ Ext.define('Ext.chart.series.Line', {
fill = me.fill;
line = me.line;
- rendererAttributes = me.renderer(line, false, { path: path }, i, store);
+ rendererAttributes = me.renderer(line, false, { path: renderPath }, i, store);
Ext.apply(rendererAttributes, endLineStyle || {}, {
stroke: endLineStyle.stroke || endLineStyle.fill
});
@@ -48078,12 +48490,12 @@ Ext.define('Ext.chart.series.Line', {
for(j = 0; j < lnsh; j++) {
if (chart.markerIndex && me.previousPath) {
me.onAnimate(shadows[j], {
- to: { path: path },
+ to: { path: renderPath },
from: { path: fromPath }
});
} else {
me.onAnimate(shadows[j], {
- to: { path: path }
+ to: { path: renderPath }
});
}
}
@@ -48093,7 +48505,7 @@ Ext.define('Ext.chart.series.Line', {
me.onAnimate(me.fillPath, {
to: Ext.apply({}, {
path: fillPath,
- fill: colorArrayStyle[seriesIdx % colorArrayLength] || endLineStyle.fill
+ fill: endLineStyle.fill || colorArrayStyle[seriesIdx % colorArrayLength]
}, endLineStyle || {})
});
}
@@ -48117,7 +48529,7 @@ Ext.define('Ext.chart.series.Line', {
}
}
} else {
- rendererAttributes = me.renderer(me.line, false, { path: path, hidden: false }, i, store);
+ rendererAttributes = me.renderer(me.line, false, { path: renderPath, hidden: false }, i, store);
Ext.apply(rendererAttributes, endLineStyle || {}, {
stroke: endLineStyle.stroke || endLineStyle.fill
});
@@ -48129,7 +48541,7 @@ Ext.define('Ext.chart.series.Line', {
shadows = me.line.shadows;
for(j = 0; j < lnsh; j++) {
shadows[j].setAttributes({
- path: path
+ path: renderPath
}, true);
}
}
@@ -48157,7 +48569,11 @@ Ext.define('Ext.chart.series.Line', {
}
if (chart.markerIndex) {
- path.splice(1, 0, path[1], path[2]);
+ if (me.smooth) {
+ Ext.Array.erase(path, 1, 2);
+ } else {
+ Ext.Array.splice(path, 1, 0, path[1], path[2]);
+ }
me.previousPath = path;
}
me.renderLabels();
@@ -49394,7 +49810,7 @@ Ext.define('Ext.chart.series.Pie', {
getLegendColor: function(index) {
var me = this;
- return me.colorArrayStyle[index % me.colorArrayStyle.length];
+ return (me.colorSet && me.colorSet[index % me.colorSet.length]) || me.colorArrayStyle[index % me.colorArrayStyle.length];
}
});
@@ -49870,9 +50286,6 @@ Ext.define('Ext.chart.series.Scatter', {
yValue = record.get(me.yField);
if (typeof yValue == 'undefined' || (typeof yValue == 'string' && !yValue)) {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.warn("[Ext.chart.series.Scatter] Skipping a store element with an undefined value at ", record, xValue, yValue);
- }
return;
}
@@ -50460,7 +50873,6 @@ Ext.define('Ext.data.ArrayStore', {
alias: 'store.array',
uses: ['Ext.data.reader.Array'],
-
constructor: function(config) {
config = config || {};
@@ -50522,6 +50934,7 @@ Ext.define('Ext.data.Batch', {
pauseOnException: true,
+
constructor: function(config) {
var me = this;
@@ -50680,38 +51093,37 @@ Ext.define('Ext.data.BelongsToAssociation', {
return function(options, scope) {
options = options || {};
- var foreignKeyId = this.get(foreignKey),
- instance, callbackFn;
+ var model = this,
+ foreignKeyId = model.get(foreignKey),
+ instance,
+ args;
- if (this[instanceName] === undefined) {
+ if (model[instanceName] === undefined) {
instance = Ext.ModelManager.create({}, associatedName);
instance.set(primaryKey, foreignKeyId);
if (typeof options == 'function') {
options = {
callback: options,
- scope: scope || this
+ scope: scope || model
};
}
associatedModel.load(foreignKeyId, options);
+ model[instanceName] = associatedModel;
+ return associatedModel;
} else {
- instance = this[instanceName];
-
+ instance = model[instanceName];
+ args = [instance];
+ scope = scope || model;
- if (typeof options == 'function') {
- options.call(scope || this, instance);
- }
-
- if (options.success) {
- options.success.call(scope || this, instance);
- }
-
- if (options.callback) {
- options.callback.call(scope || this, instance);
- }
+
+ Ext.callback(options, scope, args);
+ Ext.callback(options.success, scope, args);
+ Ext.callback(options.failure, scope, args);
+ Ext.callback(options.callback, scope, args);
return instance;
}
@@ -50914,9 +51326,6 @@ Ext.define('Ext.data.proxy.Direct', {
i = 0,
len;
- if (!fn) {
- Ext.Error.raise('No direct function specified for this proxy');
- }
if (operation.allowWrite()) {
request = writer.write(request);
@@ -50992,8 +51401,9 @@ Ext.define('Ext.data.DirectStore', {
requires: ['Ext.data.proxy.Direct'],
-
- constructor : function(config){
+
+
+ constructor : function(config){
config = Ext.apply({}, config);
if (!config.proxy) {
var proxy = {
@@ -51364,9 +51774,6 @@ Ext.define('Ext.data.JsonP', {
request: function(options){
options = Ext.apply({}, options);
- if (!options.url) {
- Ext.Error.raise('A url must be specified for a JSONP request.');
- }
var me = this,
disableCaching = Ext.isDefined(options.disableCaching) ? options.disableCaching : me.disableCaching,
@@ -51516,47 +51923,41 @@ Ext.define('Ext.data.NodeInterface', {
modelName = record.modelName,
modelClass = mgr.getModel(modelName),
idName = modelClass.prototype.idProperty,
- instances = Ext.Array.filter(mgr.all.getArray(), function(item) {
- return item.modelName == modelName;
- }),
- iln = instances.length,
newFields = [],
- i, instance, jln, j, newField;
+ i, newField, len;
modelClass.override(this.getPrototypeBody());
newFields = this.applyFields(modelClass, [
- {name: idName, type: 'string', defaultValue: null},
- {name: 'parentId', type: 'string', defaultValue: null},
- {name: 'index', type: 'int', defaultValue: null},
- {name: 'depth', type: 'int', defaultValue: 0},
- {name: 'expanded', type: 'bool', defaultValue: false, persist: false},
- {name: 'checked', type: 'auto', defaultValue: null},
- {name: 'leaf', type: 'bool', defaultValue: false, persist: false},
- {name: 'cls', type: 'string', defaultValue: null, persist: false},
- {name: 'iconCls', type: 'string', defaultValue: null, persist: false},
- {name: 'root', type: 'boolean', defaultValue: false, persist: false},
- {name: 'isLast', type: 'boolean', defaultValue: false, persist: false},
- {name: 'isFirst', type: 'boolean', defaultValue: false, persist: false},
- {name: 'allowDrop', type: 'boolean', defaultValue: true, persist: false},
- {name: 'allowDrag', type: 'boolean', defaultValue: true, persist: false},
- {name: 'loaded', type: 'boolean', defaultValue: false, persist: false},
- {name: 'loading', type: 'boolean', defaultValue: false, persist: false},
- {name: 'href', type: 'string', defaultValue: null, persist: false},
- {name: 'hrefTarget',type: 'string', defaultValue: null, persist: false},
- {name: 'qtip', type: 'string', defaultValue: null, persist: false},
- {name: 'qtitle', type: 'string', defaultValue: null, persist: false}
+ {name: idName, type: 'string', defaultValue: null},
+ {name: 'parentId', type: 'string', defaultValue: null},
+ {name: 'index', type: 'int', defaultValue: null},
+ {name: 'depth', type: 'int', defaultValue: 0},
+ {name: 'expanded', type: 'bool', defaultValue: false, persist: false},
+ {name: 'expandable', type: 'bool', defaultValue: true, persist: false},
+ {name: 'checked', type: 'auto', defaultValue: null},
+ {name: 'leaf', type: 'bool', defaultValue: false, persist: false},
+ {name: 'cls', type: 'string', defaultValue: null, persist: false},
+ {name: 'iconCls', type: 'string', defaultValue: null, persist: false},
+ {name: 'root', type: 'boolean', defaultValue: false, persist: false},
+ {name: 'isLast', type: 'boolean', defaultValue: false, persist: false},
+ {name: 'isFirst', type: 'boolean', defaultValue: false, persist: false},
+ {name: 'allowDrop', type: 'boolean', defaultValue: true, persist: false},
+ {name: 'allowDrag', type: 'boolean', defaultValue: true, persist: false},
+ {name: 'loaded', type: 'boolean', defaultValue: false, persist: false},
+ {name: 'loading', type: 'boolean', defaultValue: false, persist: false},
+ {name: 'href', type: 'string', defaultValue: null, persist: false},
+ {name: 'hrefTarget', type: 'string', defaultValue: null, persist: false},
+ {name: 'qtip', type: 'string', defaultValue: null, persist: false},
+ {name: 'qtitle', type: 'string', defaultValue: null, persist: false}
]);
- jln = newFields.length;
+ len = newFields.length;
- for (i = 0; i < iln; i++) {
- instance = instances[i];
- for (j = 0; j < jln; j++) {
- newField = newFields[j];
- if (instance.get(newField.name) === undefined) {
- instance.data[newField.name] = newField.defaultValue;
- }
+ for (i = 0; i < len; ++i) {
+ newField = newFields[i];
+ if (record.get(newField.name) === undefined) {
+ record.data[newField.name] = newField.defaultValue;
}
}
}
@@ -51718,7 +52119,12 @@ Ext.define('Ext.data.NodeInterface', {
isExpandable : function() {
- return this.get('expandable') || this.hasChildNodes();
+ var me = this;
+
+ if (me.get('expandable')) {
+ return !(me.isLeaf() || (me.isLoaded() && !me.hasChildNodes()));
+ }
+ return false;
},
@@ -51811,7 +52217,7 @@ Ext.define('Ext.data.NodeInterface', {
}
- me.childNodes.splice(index, 1);
+ Ext.Array.erase(me.childNodes, index, 1);
if (me.firstChild == node) {
@@ -51939,7 +52345,7 @@ Ext.define('Ext.data.NodeInterface', {
me.setFirstChild(node);
}
- me.childNodes.splice(refIndex, 0, node);
+ Ext.Array.splice(me.childNodes, refIndex, 0, node);
node.parentNode = me;
node.nextSibling = refNode;
@@ -52200,7 +52606,7 @@ Ext.define('Ext.data.NodeInterface', {
- me.fireEvent('beforeexpand', me, function(records) {
+ me.fireEvent('beforeexpand', me, function() {
me.set('expanded', true);
me.fireEvent('expand', me, me.childNodes, false);
@@ -52247,15 +52653,14 @@ Ext.define('Ext.data.NodeInterface', {
nodes[i].expand(recursive, function () {
expanding--;
if (callback && !expanding) {
- Ext.callback(callback, scope || me, me.childNodes);
+ Ext.callback(callback, scope || me, [me.childNodes]);
}
});
}
}
if (!expanding && callback) {
- Ext.callback(callback, scope || me, me.childNodes);
- }
+ Ext.callback(callback, scope || me, [me.childNodes]); }
},
@@ -52266,7 +52671,7 @@ Ext.define('Ext.data.NodeInterface', {
if (!me.isLeaf()) {
if (!me.collapsing && me.isExpanded()) {
- me.fireEvent('beforecollapse', me, function(records) {
+ me.fireEvent('beforecollapse', me, function() {
me.set('expanded', false);
me.fireEvent('collapse', me, me.childNodes, false);
@@ -52286,7 +52691,7 @@ Ext.define('Ext.data.NodeInterface', {
}
else {
- Ext.callback(callback, scope || me, me.childNodes);
+ Ext.callback(callback, scope || me, [me.childNodes]);
}
},
@@ -52306,14 +52711,14 @@ Ext.define('Ext.data.NodeInterface', {
nodes[i].collapse(recursive, function () {
collapsing--;
if (callback && !collapsing) {
- Ext.callback(callback, scope || me, me.childNodes);
+ Ext.callback(callback, scope || me, [me.childNodes]);
}
});
}
}
if (!collapsing && callback) {
- Ext.callback(callback, scope || me, me.childNodes);
+ Ext.callback(callback, scope || me, [me.childNodes]);
}
}
};
@@ -52342,10 +52747,6 @@ Ext.define('Ext.data.NodeStore', {
config = config || {};
Ext.apply(me, config);
- if (Ext.isDefined(me.proxy)) {
- Ext.Error.raise("A NodeStore cannot be bound to a proxy. Instead bind it to a record " +
- "decorated with the NodeInterface by setting the node config.");
- }
config.proxy = {type: 'proxy'};
me.callParent([config]);
@@ -52561,6 +52962,7 @@ Ext.define('Ext.data.Request', {
url: undefined,
+
constructor: function(config) {
Ext.apply(this, config);
}
@@ -52575,7 +52977,8 @@ Ext.define('Ext.data.Tree', {
root: null,
-
+
+
constructor: function(root) {
var me = this;
@@ -52721,6 +53124,8 @@ Ext.define('Ext.data.TreeStore', {
requires: ['Ext.data.Tree', 'Ext.data.NodeInterface', 'Ext.data.NodeStore'],
+
+
clearOnLoad : true,
@@ -52739,7 +53144,6 @@ Ext.define('Ext.data.TreeStore', {
var me = this,
root,
fields;
-
config = Ext.apply({}, config);
@@ -52753,23 +53157,6 @@ Ext.define('Ext.data.TreeStore', {
me.tree = Ext.create('Ext.data.Tree');
-
- me.tree.on({
- scope: me,
- remove: me.onNodeRemove,
- beforeexpand: me.onBeforeNodeExpand,
- beforecollapse: me.onBeforeNodeCollapse,
- append: me.onNodeAdded,
- insert: me.onNodeAdded
- });
-
- me.onBeforeSort();
-
- root = me.root;
- if (root) {
- delete me.root;
- me.setRootNode(root);
- }
me.relayEvents(me.tree, [
@@ -52814,6 +53201,25 @@ Ext.define('Ext.data.TreeStore', {
"rootchange"
]);
+
+ me.tree.on({
+ scope: me,
+ remove: me.onNodeRemove,
+
+
+ beforeexpand: me.onBeforeNodeExpand,
+ beforecollapse: me.onBeforeNodeCollapse,
+ append: me.onNodeAdded,
+ insert: me.onNodeAdded
+ });
+
+ me.onBeforeSort();
+
+ root = me.root;
+ if (root) {
+ delete me.root;
+ me.setRootNode(root);
+ }
me.addEvents(
@@ -53150,7 +53556,6 @@ Ext.define('Ext.data.proxy.Client', {
clear: function() {
- Ext.Error.raise("The Ext.data.proxy.Client subclass that you are using has not defined a 'clear' function. See src/data/ClientProxy.js for details.");
}
});
@@ -53308,16 +53713,10 @@ Ext.define('Ext.data.proxy.WebStorage', {
this.cache = {};
- if (this.getStorageObject() === undefined) {
- Ext.Error.raise("Local Storage is not supported in this browser, please use another type of data proxy");
- }
this.id = this.id || (this.store ? this.store.storeId : undefined);
- if (this.id === undefined) {
- Ext.Error.raise("No unique id was provided to the local storage proxy. See Ext.data.proxy.LocalStorage documentation for details");
- }
this.initialize();
},
@@ -53620,7 +54019,6 @@ Ext.define('Ext.data.proxy.WebStorage', {
getStorageObject: function() {
- Ext.Error.raise("The getStorageObject function has not been defined in your Ext.data.proxy.WebStorage subclass");
}
});
@@ -53783,31 +54181,21 @@ Ext.define('Ext.data.reader.Xml', {
}
return function(root) {
- var node = Ext.DomQuery.selectNode(expr, root),
- val = me.getNodeValue(node);
-
- return Ext.isEmpty(val) ? null : val;
+ return me.getNodeValue(Ext.DomQuery.selectNode(expr, root));
};
},
getNodeValue: function(node) {
- var val;
if (node && node.firstChild) {
- val = node.firstChild.nodeValue;
+ return node.firstChild.nodeValue;
}
- return val || null;
+ return undefined;
},
getResponseData: function(response) {
var xml = response.responseXML;
- if (!xml) {
- Ext.Error.raise({
- response: response,
- msg: 'XML data not found in the response'
- });
- }
return xml;
},
@@ -53836,9 +54224,6 @@ Ext.define('Ext.data.reader.Xml', {
extractData: function(root) {
var recordName = this.record;
- if (!recordName) {
- Ext.Error.raise('Record is a required parameter');
- }
if (recordName != root.nodeName) {
root = Ext.DomQuery.select(recordName, root);
@@ -53866,7 +54251,6 @@ Ext.define('Ext.data.reader.Xml', {
}
});
-
Ext.define('Ext.data.writer.Xml', {
@@ -53945,6 +54329,7 @@ Ext.define('Ext.direct.Event', {
status: true,
+
constructor: function(config) {
Ext.apply(this, config);
@@ -54154,7 +54539,6 @@ Ext.define('Ext.direct.PollingProvider', {
});
me.fireEvent('connect', me);
} else if (!url) {
- Ext.Error.raise('Error initializing PollingProvider, no url configured.');
}
},
@@ -54267,7 +54651,8 @@ Ext.define('Ext.direct.Transaction', {
},
-
+
+
constructor: function(config){
var me = this;
@@ -54399,7 +54784,6 @@ Ext.define('Ext.direct.RemotingProvider', {
me.connected = true;
me.fireEvent('connect', me);
} else if(!me.url) {
- Ext.Error.raise('Error initializing RemotingProvider, no url configured.');
}
},
@@ -54899,6 +55283,37 @@ Ext.define('Ext.draw.SpriteDD', {
Ext.define('Ext.draw.Sprite', {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
mixins: {
observable: 'Ext.util.Observable',
@@ -55191,6 +55606,8 @@ Ext.define('Ext.draw.engine.Svg', {
strokeOpacity: "stroke-opacity",
strokeLinejoin: "stroke-linejoin"
},
+
+ parsers: {},
minDefaults: {
circle: {
@@ -55594,6 +56011,12 @@ Ext.define('Ext.draw.engine.Svg', {
el = sprite.el,
group = sprite.group,
sattr = sprite.attr,
+ parsers = me.parsers,
+
+
+
+ gradientsMap = me.gradientsMap || {},
+ safariFix = Ext.isSafari && !Ext.isStrict,
groups, i, ln, attrs, font, key, style, name, rect;
if (group) {
@@ -55619,7 +56042,6 @@ Ext.define('Ext.draw.engine.Svg', {
}
else if (sprite.type == "path" && attrs.d) {
attrs.d = Ext.draw.Draw.pathToString(Ext.draw.Draw.pathToAbsolute(attrs.d));
-
}
sprite.dirtyPath = false;
@@ -55646,9 +56068,22 @@ Ext.define('Ext.draw.engine.Svg', {
}
for (key in attrs) {
if (attrs.hasOwnProperty(key) && attrs[key] != null) {
- el.dom.setAttribute(key, attrs[key]);
+
+
+
+
+
+ if (safariFix && ('color|stroke|fill'.indexOf(key) > -1) && (attrs[key] in gradientsMap)) {
+ attrs[key] = gradientsMap[attrs[key]];
+ }
+ if (key in parsers) {
+ el.dom.setAttribute(key, parsers[key](attrs[key], sprite, me));
+ } else {
+ el.dom.setAttribute(key, attrs[key]);
+ }
}
}
+
if (sprite.type == 'text') {
me.tuneText(sprite, attrs);
}
@@ -55723,40 +56158,49 @@ Ext.define('Ext.draw.engine.Svg', {
addGradient: function(gradient) {
gradient = Ext.draw.Draw.parseGradient(gradient);
- var ln = gradient.stops.length,
+ var me = this,
+ ln = gradient.stops.length,
vector = gradient.vector,
- gradientEl,
- stop,
- stopEl,
- i;
- if (gradient.type == "linear") {
- gradientEl = this.createSvgElement("linearGradient");
- gradientEl.setAttribute("x1", vector[0]);
- gradientEl.setAttribute("y1", vector[1]);
- gradientEl.setAttribute("x2", vector[2]);
- gradientEl.setAttribute("y2", vector[3]);
- }
- else {
- gradientEl = this.createSvgElement("radialGradient");
- gradientEl.setAttribute("cx", gradient.centerX);
- gradientEl.setAttribute("cy", gradient.centerY);
- gradientEl.setAttribute("r", gradient.radius);
- if (Ext.isNumber(gradient.focalX) && Ext.isNumber(gradient.focalY)) {
- gradientEl.setAttribute("fx", gradient.focalX);
- gradientEl.setAttribute("fy", gradient.focalY);
+
+
+
+ usePlain = Ext.isSafari && !Ext.isStrict,
+ gradientEl, stop, stopEl, i, gradientsMap;
+
+ gradientsMap = me.gradientsMap || {};
+
+ if (!usePlain) {
+ if (gradient.type == "linear") {
+ gradientEl = me.createSvgElement("linearGradient");
+ gradientEl.setAttribute("x1", vector[0]);
+ gradientEl.setAttribute("y1", vector[1]);
+ gradientEl.setAttribute("x2", vector[2]);
+ gradientEl.setAttribute("y2", vector[3]);
}
- }
- gradientEl.id = gradient.id;
- this.getDefs().appendChild(gradientEl);
-
- for (i = 0; i < ln; i++) {
- stop = gradient.stops[i];
- stopEl = this.createSvgElement("stop");
- stopEl.setAttribute("offset", stop.offset + "%");
- stopEl.setAttribute("stop-color", stop.color);
- stopEl.setAttribute("stop-opacity",stop.opacity);
- gradientEl.appendChild(stopEl);
+ else {
+ gradientEl = me.createSvgElement("radialGradient");
+ gradientEl.setAttribute("cx", gradient.centerX);
+ gradientEl.setAttribute("cy", gradient.centerY);
+ gradientEl.setAttribute("r", gradient.radius);
+ if (Ext.isNumber(gradient.focalX) && Ext.isNumber(gradient.focalY)) {
+ gradientEl.setAttribute("fx", gradient.focalX);
+ gradientEl.setAttribute("fy", gradient.focalY);
+ }
+ }
+ gradientEl.id = gradient.id;
+ me.getDefs().appendChild(gradientEl);
+ for (i = 0; i < ln; i++) {
+ stop = gradient.stops[i];
+ stopEl = me.createSvgElement("stop");
+ stopEl.setAttribute("offset", stop.offset + "%");
+ stopEl.setAttribute("stop-color", stop.color);
+ stopEl.setAttribute("stop-opacity",stop.opacity);
+ gradientEl.appendChild(stopEl);
+ }
+ } else {
+ gradientsMap['url(#' + gradient.id + ')'] = gradient.stops[0].color;
}
+ me.gradientsMap = gradientsMap;
},
@@ -55806,7 +56250,7 @@ Ext.define('Ext.draw.engine.Svg', {
cls = cls.replace(me.trimRe, '');
idx = Ext.Array.indexOf(elClasses, cls);
if (idx != -1) {
- elClasses.splice(idx, 1);
+ Ext.Array.erase(elClasses, idx, 1);
}
}
}
@@ -56415,64 +56859,74 @@ Ext.define('Ext.draw.engine.Vml', {
},
setSize: function(width, height) {
- var me = this,
- viewBox = me.viewBox,
- scaleX, scaleY, items, i, len;
+ var me = this;
width = width || me.width;
height = height || me.height;
me.width = width;
me.height = height;
- if (!me.el) {
- return;
- }
+ if (me.el) {
+
+ if (width != undefined) {
+ me.el.setWidth(width);
+ }
+ if (height != undefined) {
+ me.el.setHeight(height);
+ }
-
- if (width != undefined) {
- me.el.setWidth(width);
- }
- if (height != undefined) {
- me.el.setHeight(height);
+
+ me.applyViewBox();
+
+ me.callParent(arguments);
}
+ },
+
+ setViewBox: function(x, y, width, height) {
+ this.callParent(arguments);
+ this.viewBox = {
+ x: x,
+ y: y,
+ width: width,
+ height: height
+ };
+ this.applyViewBox();
+ },
+
+
+ applyViewBox: function() {
+ var me = this,
+ viewBox = me.viewBox,
+ width = me.width,
+ height = me.height,
+ viewBoxX, viewBoxY, viewBoxWidth, viewBoxHeight,
+ relativeHeight, relativeWidth, size;
-
if (viewBox && (width || height)) {
- var viewBoxX = viewBox.x,
- viewBoxY = viewBox.y,
- viewBoxWidth = viewBox.width,
- viewBoxHeight = viewBox.height,
- relativeHeight = height / viewBoxHeight,
- relativeWidth = width / viewBoxWidth,
- size;
+ viewBoxX = viewBox.x;
+ viewBoxY = viewBox.y;
+ viewBoxWidth = viewBox.width;
+ viewBoxHeight = viewBox.height;
+ relativeHeight = height / viewBoxHeight;
+ relativeWidth = width / viewBoxWidth;
+
if (viewBoxWidth * relativeHeight < width) {
viewBoxX -= (width - viewBoxWidth * relativeHeight) / 2 / relativeHeight;
}
if (viewBoxHeight * relativeWidth < height) {
viewBoxY -= (height - viewBoxHeight * relativeWidth) / 2 / relativeWidth;
}
+
size = 1 / Math.max(viewBoxWidth / width, viewBoxHeight / height);
-
+
me.viewBoxShift = {
dx: -viewBoxX,
dy: -viewBoxY,
scale: size
};
- items = me.items.items;
- for (i = 0, len = items.length; i < len; i++) {
- me.transform(items[i]);
- }
+ me.items.each(function(item) {
+ me.transform(item);
+ });
}
- this.callParent(arguments);
- },
-
- setViewBox: function(x, y, width, height) {
- this.callParent(arguments);
- this.viewBox = {
- x: x,
- y: y,
- width: width,
- height: height
- };
},
onAdd: function(item) {
@@ -56842,18 +57296,27 @@ Ext.define('Ext.layout.container.Fit', {
setItemBox : function(item, box) {
var me = this;
if (item && box.height > 0) {
- if (me.isManaged('width') === true) {
+ if (!me.owner.isFixedWidth()) {
box.width = undefined;
}
- if (me.isManaged('height') === true) {
+ if (!me.owner.isFixedHeight()) {
box.height = undefined;
}
me.setItemSize(item, box.width, box.height);
}
+ },
+
+ configureItem: function(item) {
+
+
+
+ item.layoutManagedHeight = 0;
+ item.layoutManagedWidth = 0;
+
+ this.callParent(arguments);
}
});
-
Ext.define('Ext.layout.container.AbstractCard', {
@@ -56968,38 +57431,38 @@ Ext.define('Ext.layout.container.AbstractCard', {
},
- getNext: function(wrap) {
-
+ getNext: function() {
+ var wrap = arguments[0];
var items = this.getLayoutItems(),
index = Ext.Array.indexOf(items, this.activeItem);
return items[index + 1] || (wrap ? items[0] : false);
},
- next: function(anim, wrap) {
-
+ next: function() {
+ var anim = arguments[0], wrap = arguments[1];
return this.setActiveItem(this.getNext(wrap), anim);
},
- getPrev: function(wrap) {
-
+ getPrev: function() {
+ var wrap = arguments[0];
var items = this.getLayoutItems(),
index = Ext.Array.indexOf(items, this.activeItem);
return items[index - 1] || (wrap ? items[items.length - 1] : false);
},
- prev: function(anim, wrap) {
-
+ prev: function() {
+ var anim = arguments[0], wrap = arguments[1];
return this.setActiveItem(this.getPrev(wrap), anim);
}
});
@@ -57007,28 +57470,28 @@ Ext.define('Ext.layout.container.AbstractCard', {
Ext.define('Ext.selection.Model', {
extend: 'Ext.util.Observable',
- alternateClassName: 'Ext.AbstractStoreSelectionModel',
+ alternateClassName: 'Ext.AbstractSelectionModel',
requires: ['Ext.data.StoreManager'],
-
+
allowDeselect: false,
selected: null,
-
-
+
+
pruneRemoved: true,
constructor: function(cfg) {
var me = this;
-
+
cfg = cfg || {};
Ext.apply(me, cfg);
-
+
me.addEvents(
'selectionchange'
@@ -57045,14 +57508,14 @@ Ext.define('Ext.selection.Model', {
me.selected = Ext.create('Ext.util.MixedCollection');
-
+
me.callParent(arguments);
},
bind : function(store, initial){
var me = this;
-
+
if(!initial && me.store){
if(store !== me.store && me.store.autoDestroy){
me.store.destroy();
@@ -57086,7 +57549,7 @@ Ext.define('Ext.selection.Model', {
i = 0,
len = selections.length,
start = me.getSelection().length;
-
+
me.bulkChange = true;
for (; i < len; i++) {
me.doSelect(selections[i], true, suppressEvent);
@@ -57103,7 +57566,7 @@ Ext.define('Ext.selection.Model', {
i = 0,
len = selections.length,
start = me.getSelection().length;
-
+
me.bulkChange = true;
for (; i < len; i++) {
me.doDeselect(selections[i], suppressEvent);
@@ -57116,9 +57579,9 @@ Ext.define('Ext.selection.Model', {
- selectWithEvent: function(record, e) {
+ selectWithEvent: function(record, e, keepExisting) {
var me = this;
-
+
switch (me.selectionMode) {
case 'MULTI':
if (e.ctrlKey && me.isSelected(record)) {
@@ -57128,7 +57591,7 @@ Ext.define('Ext.selection.Model', {
} else if (e.ctrlKey) {
me.doSelect(record, true, false);
} else if (me.isSelected(record) && !e.shiftKey && !e.ctrlKey && me.selected.getCount() > 1) {
- me.doSelect(record, false, false);
+ me.doSelect(record, keepExisting, false);
} else {
me.doSelect(record, false);
}
@@ -57161,22 +57624,22 @@ Ext.define('Ext.selection.Model', {
tmp,
dontDeselect,
records = [];
-
+
if (me.isLocked()){
return;
}
-
+
if (!keepExisting) {
- me.clearSelections();
+ me.deselectAll(true);
}
-
+
if (!Ext.isNumber(startRow)) {
startRow = store.indexOf(startRow);
- }
+ }
if (!Ext.isNumber(endRow)) {
endRow = store.indexOf(endRow);
}
-
+
if (startRow > endRow){
tmp = endRow;
@@ -57195,7 +57658,7 @@ Ext.define('Ext.selection.Model', {
} else {
dontDeselect = (dir == 'up') ? startRow : endRow;
}
-
+
for (i = startRow; i <= endRow; i++){
if (selectedCount == (endRow - startRow + 1)) {
if (i != dontDeselect) {
@@ -57207,7 +57670,7 @@ Ext.define('Ext.selection.Model', {
}
me.doMultiSelect(records, true);
},
-
+
select: function(records, keepExisting, suppressEvent) {
this.doSelect(records, keepExisting, suppressEvent);
@@ -57217,11 +57680,11 @@ Ext.define('Ext.selection.Model', {
deselect: function(records, suppressEvent) {
this.doDeselect(records, suppressEvent);
},
-
+
doSelect: function(records, keepExisting, suppressEvent) {
var me = this,
record;
-
+
if (me.locked) {
return;
}
@@ -57242,17 +57705,24 @@ Ext.define('Ext.selection.Model', {
change = false,
i = 0,
len, record;
-
+
if (me.locked) {
return;
}
-
+
records = !Ext.isArray(records) ? [records] : records;
len = records.length;
if (!keepExisting && selected.getCount() > 0) {
+ if (me.doDeselect(me.getSelection(), suppressEvent) === false) {
+ return;
+ }
+
+ }
+
+ function commit () {
+ selected.add(record);
change = true;
- me.doDeselect(me.getSelection(), suppressEvent);
}
for (; i < len; i++) {
@@ -57260,11 +57730,9 @@ Ext.define('Ext.selection.Model', {
if (keepExisting && me.isSelected(record)) {
continue;
}
- change = true;
me.lastSelected = record;
- selected.add(record);
- me.onSelectChange(record, true, suppressEvent);
+ me.onSelectChange(record, true, suppressEvent, commit);
}
me.setLastFocused(record, suppressEvent);
@@ -57275,38 +57743,49 @@ Ext.define('Ext.selection.Model', {
doDeselect: function(records, suppressEvent) {
var me = this,
selected = me.selected,
- change = false,
i = 0,
- len, record;
-
+ len, record,
+ attempted = 0,
+ accepted = 0;
+
if (me.locked) {
- return;
+ return false;
}
if (typeof records === "number") {
records = [me.store.getAt(records)];
+ } else if (!Ext.isArray(records)) {
+ records = [records];
+ }
+
+ function commit () {
+ ++accepted;
+ selected.remove(record);
}
- records = !Ext.isArray(records) ? [records] : records;
len = records.length;
+
for (; i < len; i++) {
record = records[i];
- if (selected.remove(record)) {
+ if (me.isSelected(record)) {
if (me.lastSelected == record) {
me.lastSelected = selected.last();
}
- me.onSelectChange(record, false, suppressEvent);
- change = true;
+ ++attempted;
+ me.onSelectChange(record, false, suppressEvent, commit);
}
}
+
- me.maybeFireSelectionChange(change && !suppressEvent);
+ me.maybeFireSelectionChange(accepted > 0 && !suppressEvent);
+ return accepted === attempted;
},
doSingleSelect: function(record, suppressEvent) {
var me = this,
+ changed = false,
selected = me.selected;
-
+
if (me.locked) {
return;
}
@@ -57315,16 +57794,28 @@ Ext.define('Ext.selection.Model', {
if (me.isSelected(record)) {
return;
}
- if (selected.getCount() > 0) {
- me.doDeselect(me.lastSelected, suppressEvent);
+
+ function commit () {
+ me.bulkChange = true;
+ if (selected.getCount() > 0 && me.doDeselect(me.lastSelected, suppressEvent) === false) {
+ delete me.bulkChange;
+ return false;
+ }
+ delete me.bulkChange;
+
+ selected.add(record);
+ me.lastSelected = record;
+ changed = true;
}
- selected.add(record);
- me.lastSelected = record;
- me.onSelectChange(record, true, suppressEvent);
- if (!suppressEvent) {
- me.setLastFocused(record);
+
+ me.onSelectChange(record, true, suppressEvent, commit);
+
+ if (changed) {
+ if (!suppressEvent) {
+ me.setLastFocused(record);
+ }
+ me.maybeFireSelectionChange(!suppressEvent);
}
- me.maybeFireSelectionChange(!suppressEvent);
},
@@ -57334,7 +57825,7 @@ Ext.define('Ext.selection.Model', {
me.lastFocused = record;
me.onLastFocusChanged(recordBeforeLast, record, supressFocus);
},
-
+
isFocused: function(record) {
return record === this.getLastFocused();
@@ -57354,7 +57845,7 @@ Ext.define('Ext.selection.Model', {
getLastSelected: function() {
return this.lastSelected;
},
-
+
getLastFocused: function() {
return this.lastFocused;
},
@@ -57392,7 +57883,7 @@ Ext.define('Ext.selection.Model', {
record = Ext.isNumber(record) ? this.store.getAt(record) : record;
return this.selected.indexOf(record) !== -1;
},
-
+
hasSelection: function() {
return this.selected.getCount() > 0;
@@ -57425,7 +57916,7 @@ Ext.define('Ext.selection.Model', {
}
me.clearSelections();
-
+
if (me.store.indexOf(lastFocused) !== -1) {
this.setLastFocused(lastFocused, true);
@@ -57435,17 +57926,16 @@ Ext.define('Ext.selection.Model', {
me.doSelect(toBeSelected, false, true);
}
-
+
me.maybeFireSelectionChange(change);
},
clearSelections: function() {
- var me = this;
- me.selected.clear();
- me.lastSelected = null;
- me.setLastFocused(null);
+ this.selected.clear();
+ this.lastSelected = null;
+ this.setLastFocused(null);
},
@@ -57456,14 +57946,9 @@ Ext.define('Ext.selection.Model', {
onStoreClear: function() {
- var me = this,
- selected = this.selected;
-
- if (selected.getCount > 0) {
- selected.clear();
- me.lastSelected = null;
- me.setLastFocused(null);
- me.maybeFireSelectionChange(true);
+ if (this.selected.getCount > 0) {
+ this.clearSelections();
+ this.maybeFireSelectionChange(true);
}
},
@@ -57473,7 +57958,7 @@ Ext.define('Ext.selection.Model', {
onStoreRemove: function(store, record) {
var me = this,
selected = me.selected;
-
+
if (me.locked || !me.pruneRemoved) {
return;
}
@@ -57489,6 +57974,7 @@ Ext.define('Ext.selection.Model', {
}
},
+
getCount: function() {
return this.selected.getCount();
},
@@ -57526,25 +58012,31 @@ Ext.define('Ext.selection.Model', {
Ext.define('Ext.selection.DataViewModel', {
extend: 'Ext.selection.Model',
-
+
requires: ['Ext.util.KeyNav'],
deselectOnContainerClick: true,
-
+
enableKeyNav: true,
-
+
constructor: function(cfg){
this.addEvents(
- 'deselect',
+ 'beforedeselect',
+
+ 'beforeselect',
+
+
+ 'deselect',
+
'select'
);
this.callParent(arguments);
},
-
+
bindComponent: function(view) {
var me = this,
eventListeners = {
@@ -57574,15 +58066,15 @@ Ext.define('Ext.selection.DataViewModel', {
this.deselectAll();
}
},
-
+
initKeyNav: function(view) {
var me = this;
-
+
if (!view.rendered) {
view.on('render', Ext.Function.bind(me.initKeyNav, me, [view], 0), me, {single: true});
return;
}
-
+
view.el.set({
tabIndex: -1
});
@@ -57594,7 +58086,7 @@ Ext.define('Ext.selection.DataViewModel', {
scope: me
});
},
-
+
onNavKey: function(step) {
step = step || 1;
var me = this,
@@ -57602,42 +58094,39 @@ Ext.define('Ext.selection.DataViewModel', {
selected = me.getSelection()[0],
numRecords = me.view.store.getCount(),
idx;
-
+
if (selected) {
idx = view.indexOf(view.getNode(selected)) + step;
} else {
idx = 0;
}
-
+
if (idx < 0) {
idx = numRecords - 1;
} else if (idx >= numRecords) {
idx = 0;
}
-
+
me.select(idx);
},
- onSelectChange: function(record, isSelected, suppressEvent) {
+ onSelectChange: function(record, isSelected, suppressEvent, commitFn) {
var me = this,
view = me.view,
- allowSelect = true;
-
- if (isSelected) {
- if (!suppressEvent) {
- allowSelect = me.fireEvent('beforeselect', me, record) !== false;
- }
- if (allowSelect) {
+ eventName = isSelected ? 'select' : 'deselect';
+
+ if ((suppressEvent || me.fireEvent('before' + eventName, me, record)) !== false &&
+ commitFn() !== false) {
+
+ if (isSelected) {
view.onItemSelect(record);
- if (!suppressEvent) {
- me.fireEvent('select', me, record);
- }
+ } else {
+ view.onItemDeselect(record);
}
- } else {
- view.onItemDeselect(record);
+
if (!suppressEvent) {
- me.fireEvent('deselect', me, record);
+ me.fireEvent(eventName, me, record);
}
}
}
@@ -57647,6 +58136,7 @@ Ext.define('Ext.selection.DataViewModel', {
Ext.define('Ext.state.CookieProvider', {
extend: 'Ext.state.Provider',
+
constructor : function(config){
var me = this;
me.path = "/";
@@ -57718,6 +58208,8 @@ Ext.define('Ext.state.CookieProvider', {
}
});
+
+
Ext.define('Ext.state.LocalStorageProvider', {
@@ -57778,7 +58270,6 @@ Ext.define('Ext.state.LocalStorageProvider', {
} catch (e) {
return false;
}
- Ext.Error.raise('LocalStorage is not supported by the current browser');
}
});
@@ -57847,25 +58338,25 @@ Ext.define('Ext.view.AbstractView', {
'Ext.DomQuery',
'Ext.selection.DataViewModel'
],
-
+
inheritableStatics: {
getRecord: function(node) {
return this.getBoundView(node).getRecord(node);
},
-
+
getBoundView: function(node) {
return Ext.getCmp(node.boundView);
}
},
-
+
-
+
itemCls: Ext.baseCSSPrefix + 'dataview-item',
-
+
@@ -57874,10 +58365,13 @@ Ext.define('Ext.view.AbstractView', {
loadingText: 'Loading...',
+ loadMask: true,
+
+
loadingUseMsg: true,
-
+
@@ -57901,12 +58395,12 @@ Ext.define('Ext.view.AbstractView', {
last: false,
-
+
triggerEvent: 'itemclick',
triggerCtEvent: 'containerclick',
-
+
addCmpEvents: function() {
-
+
},
@@ -57915,7 +58409,7 @@ Ext.define('Ext.view.AbstractView', {
isDef = Ext.isDefined,
itemTpl = me.itemTpl,
memberFn = {};
-
+
if (itemTpl) {
if (Ext.isArray(itemTpl)) {
@@ -57925,53 +58419,22 @@ Ext.define('Ext.view.AbstractView', {
memberFn = Ext.apply(memberFn, itemTpl.initialConfig);
itemTpl = itemTpl.html;
}
-
+
if (!me.itemSelector) {
me.itemSelector = '.' + me.itemCls;
}
-
+
itemTpl = Ext.String.format('<tpl for="."><div class="{0}">{1}</div></tpl>', me.itemCls, itemTpl);
me.tpl = Ext.create('Ext.XTemplate', itemTpl, memberFn);
}
- if (!isDef(me.tpl) || !isDef(me.itemSelector)) {
- Ext.Error.raise({
- sourceClass: 'Ext.view.View',
- tpl: me.tpl,
- itemSelector: me.itemSelector,
- msg: "DataView requires both tpl and itemSelector configurations to be defined."
- });
- }
me.callParent();
if(Ext.isString(me.tpl) || Ext.isArray(me.tpl)){
me.tpl = Ext.create('Ext.XTemplate', me.tpl);
}
-
-
- if (isDef(me.overCls) || isDef(me.overClass)) {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.warn('Ext.view.View: Using the deprecated overCls or overClass configuration. Use overItemCls instead.');
- }
- me.overItemCls = me.overCls || me.overClass;
- delete me.overCls;
- delete me.overClass;
- }
- if (me.overItemCls) {
- me.trackOver = true;
- }
-
- if (isDef(me.selectedCls) || isDef(me.selectedClass)) {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.warn('Ext.view.View: Using the deprecated selectedCls or selectedClass configuration. Use selectedItemCls instead.');
- }
- me.selectedItemCls = me.selectedCls || me.selectedClass;
- delete me.selectedCls;
- delete me.selectedClass;
- }
-
me.addEvents(
'beforerefresh',
@@ -57991,45 +58454,62 @@ Ext.define('Ext.view.AbstractView', {
me.store = Ext.data.StoreManager.lookup(me.store);
}
me.all = new Ext.CompositeElementLite();
- me.getSelectionModel().bindComponent(me);
},
onRender: function() {
var me = this,
- loadingText = me.loadingText,
- loadingHeight = me.loadingHeight,
- undef;
+ mask = me.loadMask,
+ cfg = {
+ msg: me.loadingText,
+ msgCls: me.loadingCls,
+ useMsg: me.loadingUseMsg
+ };
me.callParent(arguments);
- if (loadingText) {
+
+ if (mask) {
+ if (Ext.isObject(mask)) {
+ cfg = Ext.apply(cfg, mask);
+ }
- me.loadMask = Ext.create('Ext.LoadMask', me.floating ? me : me.ownerCt || me, {
- msg: loadingText,
- msgCls: me.loadingCls,
- useMsg: me.loadingUseMsg,
- listeners: {
- beforeshow: function() {
- me.getTargetEl().update('');
- me.getSelectionModel().deselectAll();
- me.all.clear();
- if (loadingHeight) {
- me.setCalculatedSize(undef, loadingHeight);
- }
- },
- hide: function() {
- if (loadingHeight) {
- me.setHeight(me.height);
- }
- }
- }
+ me.loadMask = Ext.create('Ext.LoadMask', me.floating ? me : me.ownerCt || me, cfg);
+ me.loadMask.on({
+ scope: me,
+ beforeshow: me.onMaskBeforeShow,
+ hide: me.onMaskHide
});
}
},
+
+ onMaskBeforeShow: function(){
+ var me = this;
+ me.getSelectionModel().deselectAll();
+ me.all.clear();
+ if (me.loadingHeight) {
+ me.setCalculatedSize(undefined, me.loadingHeight);
+ }
+ },
+
+ onMaskHide: function(){
+ if (!this.destroying && this.loadingHeight) {
+ this.setHeight(this.height);
+ }
+ },
+
+ afterRender: function() {
+ this.callParent(arguments);
+
+
+
+ this.getSelectionModel().bindComponent(this);
+ },
+
+
getSelectionModel: function(){
var me = this,
mode = 'SINGLE';
@@ -58054,7 +58534,9 @@ Ext.define('Ext.view.AbstractView', {
}
if (!me.selModel.hasRelaySetup) {
- me.relayEvents(me.selModel, ['selectionchange', 'beforeselect', 'select', 'deselect']);
+ me.relayEvents(me.selModel, [
+ 'selectionchange', 'beforeselect', 'beforedeselect', 'select', 'deselect'
+ ]);
me.selModel.hasRelaySetup = true;
}
@@ -58072,11 +58554,11 @@ Ext.define('Ext.view.AbstractView', {
var me = this,
el,
records;
-
+
if (!me.rendered) {
return;
}
-
+
me.fireEvent('beforerefresh', me);
el = me.getTargetEl();
records = me.store.getRange();
@@ -58092,7 +58574,7 @@ Ext.define('Ext.view.AbstractView', {
me.all.fill(Ext.query(me.getItemSelector(), el.dom));
me.updateIndexes(0);
}
-
+
me.selModel.refresh();
me.hasSkippedEmptyText = true;
me.fireEvent('refresh', me);
@@ -58100,22 +58582,23 @@ Ext.define('Ext.view.AbstractView', {
prepareData: function(data, index, record) {
- if (record) {
- Ext.apply(data, record.getAssociatedData());
+ if (record) {
+ Ext.apply(data, record.getAssociatedData());
}
return data;
},
-
+
collectData : function(records, startIndex){
var r = [],
i = 0,
- len = records.length;
+ len = records.length,
+ record;
for(; i < len; i++){
- r[r.length] = this.prepareData(records[i].data, startIndex + i, records[i]);
+ record = records[i];
+ r[r.length] = this.prepareData(record[record.persistenceProperty], startIndex + i, record);
}
-
return r;
},
@@ -58130,11 +58613,9 @@ Ext.define('Ext.view.AbstractView', {
onUpdate : function(ds, record){
var me = this,
index = me.store.indexOf(record),
- original,
node;
if (index > -1){
- original = me.all.elements[index];
node = me.bufferRender([record], index)[0];
me.all.replaceElement(index, node, true);
@@ -58152,12 +58633,12 @@ Ext.define('Ext.view.AbstractView', {
onAdd : function(ds, records, index) {
var me = this,
nodes;
-
+
if (me.all.getCount() === 0) {
me.refresh();
return;
}
-
+
nodes = me.bufferRender(records, index);
me.doAdd(nodes, records, index);
@@ -58167,21 +58648,22 @@ Ext.define('Ext.view.AbstractView', {
},
doAdd: function(nodes, records, index) {
- var n, a = this.all.elements;
- if (index < this.all.getCount()) {
- n = this.all.item(index).insertSibling(nodes, 'before', true);
- a.splice.apply(a, [index, 0].concat(nodes));
- }
+ var all = this.all;
+
+ if (index < all.getCount()) {
+ all.item(index).insertSibling(nodes, 'before', true);
+ }
else {
- n = this.all.last().insertSibling(nodes, 'after', true);
- a.push.apply(a, nodes);
- }
+ all.last().insertSibling(nodes, 'after', true);
+ }
+
+ Ext.Array.insert(all.elements, index, nodes);
},
-
+
onRemove : function(ds, record, index) {
var me = this;
-
+
me.doRemove(record, index);
me.updateIndexes(index);
if (me.store.getCount() === 0){
@@ -58189,7 +58671,7 @@ Ext.define('Ext.view.AbstractView', {
}
me.fireEvent('itemremove', record, index);
},
-
+
doRemove: function(record, index) {
this.all.removeElement(index, true);
},
@@ -58222,11 +58704,11 @@ Ext.define('Ext.view.AbstractView', {
bindStore : function(store, initial) {
var me = this;
-
+
if (!initial && me.store) {
if (store !== me.store && me.store.autoDestroy) {
me.store.destroy();
- }
+ }
else {
me.mun(me.store, {
scope: me,
@@ -58258,12 +58740,12 @@ Ext.define('Ext.view.AbstractView', {
me.loadMask.bindStore(store);
}
}
-
+
me.store = store;
me.getSelectionModel().bind(store);
-
- if (store) {
+
+ if (store && (!initial || store.getCount())) {
me.refresh(true);
}
},
@@ -58279,7 +58761,7 @@ Ext.define('Ext.view.AbstractView', {
findItemByChild: function(node){
return Ext.fly(node).findParent(this.getItemSelector(), this.getTargetEl());
},
-
+
findTargetByEvent: function(e) {
return e.getTarget(this.getItemSelector(), this.getTargetEl());
@@ -58318,7 +58800,7 @@ Ext.define('Ext.view.AbstractView', {
getRecord: function(node){
return this.store.data.getByKey(Ext.getDom(node).viewRecordId);
},
-
+
isSelected : function(node) {
@@ -58326,7 +58808,7 @@ Ext.define('Ext.view.AbstractView', {
var r = this.getRecord(node);
return this.selModel.isSelected(r);
},
-
+
select: function(records, keepExisting, suppressEvent) {
this.selModel.select(records, keepExisting, suppressEvent);
@@ -58348,22 +58830,22 @@ Ext.define('Ext.view.AbstractView', {
}
return nodeInfo;
},
-
+
getNodeByRecord: function(record) {
var ns = this.all.elements,
ln = ns.length,
i = 0;
-
+
for (; i < ln; i++) {
if (ns[i].viewRecordId === record.internalId) {
return ns[i];
}
}
-
+
return null;
},
-
+
getNodes: function(start, end) {
var ns = this.all.elements,
@@ -58395,7 +58877,7 @@ Ext.define('Ext.view.AbstractView', {
onDestroy : function() {
var me = this;
-
+
me.all.clear();
me.callParent();
me.bindStore(null);
@@ -58413,7 +58895,7 @@ Ext.define('Ext.view.AbstractView', {
var node = this.getNode(record);
Ext.fly(node).removeCls(this.selectedItemCls);
},
-
+
getItemSelector: function() {
return this.itemSelector;
}
@@ -58427,7 +58909,7 @@ Ext.define('Ext.view.AbstractView', {
-
+
getSelectionCount : function(){
if (Ext.global.console) {
@@ -58435,7 +58917,7 @@ Ext.define('Ext.view.AbstractView', {
}
return this.selModel.getSelection().length;
},
-
+
getSelectedRecords : function(){
if (Ext.global.console) {
@@ -58443,7 +58925,7 @@ Ext.define('Ext.view.AbstractView', {
}
return this.selModel.getSelection();
},
-
+
select: function(records, keepExisting, supressEvents) {
if (Ext.global.console) {
Ext.global.console.warn("DataView: select will be removed, please access select through a DataView's SelectionModel, ie: view.getSelectionModel().select()");
@@ -58451,7 +58933,7 @@ Ext.define('Ext.view.AbstractView', {
var sm = this.getSelectionModel();
return sm.select.apply(sm, arguments);
},
-
+
clearSelections: function() {
if (Ext.global.console) {
Ext.global.console.warn("DataView: clearSelections will be removed, please access deselectAll through DataView's SelectionModel, ie: view.getSelectionModel().deselectAll()");
@@ -58459,7 +58941,7 @@ Ext.define('Ext.view.AbstractView', {
var sm = this.getSelectionModel();
return sm.deselectAll();
}
- });
+ });
});
});
@@ -58478,6 +58960,7 @@ Ext.define('Ext.Action', {
+
constructor : function(config){
this.initialConfig = config;
this.itemId = config.itemId = (config.itemId || config.id || Ext.id());
@@ -58988,6 +59471,7 @@ Ext.define('Ext.Layer', {
extend: 'Ext.core.Element',
+
constructor: function(config, existingEl) {
config = config || {};
var me = this,
@@ -59658,6 +60142,7 @@ Ext.define('Ext.ShadowPool', {
Ext.define('Ext.Shadow', {
requires: ['Ext.ShadowPool'],
+
constructor: function(config) {
Ext.apply(this, config);
if (typeof this.mode != "string") {
@@ -59822,7 +60307,6 @@ Ext.define('Ext.Shadow', {
}
});
-
Ext.define('Ext.button.Split', {
@@ -59877,7 +60361,6 @@ Ext.define('Ext.button.Split', {
}
});
-
Ext.define('Ext.button.Cycle', {
@@ -60069,12 +60552,22 @@ Ext.define('Ext.container.ButtonGroup', {
if (me.header) {
+
+ delete me.header.items.items[0].flex;
+
+
+ me.suspendLayout = true;
+ me.header.insert(1, {
+ xtype: 'component',
+ ui : me.ui,
+ flex : 1
+ });
me.header.insert(0, {
xtype: 'component',
ui : me.ui,
- html : '&nbsp;',
flex : 1
});
+ me.suspendLayout = false;
}
me.callParent(arguments);
@@ -60148,16 +60641,15 @@ Ext.define('Ext.container.Viewport', {
el.setSize = Ext.emptyFn;
el.dom.scroll = 'no';
me.allowDomMove = false;
-
-
Ext.EventManager.onWindowResize(me.fireResize, me);
me.renderTo = me.el;
+ me.width = Ext.core.Element.getViewportWidth();
+ me.height = Ext.core.Element.getViewportHeight();
},
fireResize : function(w, h){
this.setSize(w, h);
-
}
});
@@ -60167,6 +60659,8 @@ Ext.define('Ext.container.Viewport', {
Ext.define('Ext.dd.DDTarget', {
extend: 'Ext.dd.DragDrop',
+
+
constructor: function(id, sGroup, config) {
if (id) {
this.initTarget(id, sGroup, config);
@@ -60461,9 +60955,6 @@ Ext.define('Ext.dd.DragTracker', {
this.mouseIsDown = false;
- delete e.dragTracked;
-
-
if (this.mouseIsOut) {
this.mouseIsOut = false;
this.onMouseOut(e);
@@ -60489,6 +60980,9 @@ Ext.define('Ext.dd.DragTracker', {
}
delete this._constrainRegion;
+
+
+ delete Ext.EventObject.dragTracked;
},
triggerStart: function(e) {
@@ -60630,6 +61124,7 @@ Ext.define('Ext.dd.DragZone', {
extend: 'Ext.dd.DragSource',
+
constructor : function(el, config){
this.callParent([el, config]);
if (this.containerScroll) {
@@ -60852,6 +61347,7 @@ Ext.define('Ext.dd.DropTarget', {
extend: 'Ext.dd.DDTarget',
requires: ['Ext.dd.ScrollManager'],
+
constructor : function(el, config){
this.el = Ext.get(el);
@@ -61122,12 +61618,6 @@ Ext.define('Ext.flash.Component', {
renderTpl: ['<div id="{swfId}"></div>'],
initComponent: function() {
- if (!('swfobject' in window)) {
- Ext.Error.raise('The SWFObject library is not loaded. Ext.flash.Component requires SWFObject version 2.2 or later: http://code.google.com/p/swfobject/');
- }
- if (!this.url) {
- Ext.Error.raise('The "url" config is required for Ext.flash.Component');
- }
this.callParent();
this.addEvents(
@@ -61253,8 +61743,7 @@ Ext.define('Ext.form.action.Action', {
-
-
+
constructor: function(config) {
if (config) {
Ext.apply(this, config);
@@ -61511,6 +62000,7 @@ Ext.define('Ext.util.ComponentDragger', {
autoStart: 500,
+
constructor: function(comp, config) {
this.comp = comp;
this.initialConstrainTo = config.constrainTo;
@@ -62546,8 +63036,8 @@ Ext.define('Ext.layout.container.Anchor', {
components = me.getVisibleItems(owner),
len = components.length,
boxes = [],
- box, newTargetSize, anchorWidth, anchorHeight, component, anchorSpec, calcWidth, calcHeight,
- anchorsArray, anchor, i, el, cleaner;
+ box, newTargetSize, component, anchorSpec, calcWidth, calcHeight,
+ i, el, cleaner;
if (ownerWidth < 20 && ownerHeight < 20) {
return;
@@ -62564,21 +63054,6 @@ Ext.define('Ext.layout.container.Anchor', {
}
- if (owner.anchorSize) {
- if (typeof owner.anchorSize == 'number') {
- anchorWidth = owner.anchorSize;
- }
- else {
- anchorWidth = owner.anchorSize.width;
- anchorHeight = owner.anchorSize.height;
- }
- }
- else {
- anchorWidth = owner.initialConfig.width;
- anchorHeight = owner.initialConfig.height;
- }
-
-
if (!Ext.supports.RightMargin) {
cleaner = Ext.core.Element.getRightMarginFixCleaner(target);
target.addCls(Ext.baseCSSPrefix + 'inline-children');
@@ -62587,24 +63062,19 @@ Ext.define('Ext.layout.container.Anchor', {
for (i = 0; i < len; i++) {
component = components[i];
el = component.el;
- anchor = component.anchor;
-
- if (!component.anchor && component.items && !Ext.isNumber(component.width) && !(Ext.isIE6 && Ext.isStrict)) {
- component.anchor = anchor = me.defaultAnchor;
- }
- if (anchor) {
- anchorSpec = component.anchorSpec;
-
- if (!anchorSpec) {
- anchorsArray = anchor.split(' ');
- component.anchorSpec = anchorSpec = {
- right: me.parseAnchor(anchorsArray[0], component.initialConfig.width, anchorWidth),
- bottom: me.parseAnchor(anchorsArray[1], component.initialConfig.height, anchorHeight)
- };
+ anchorSpec = component.anchorSpec;
+ if (anchorSpec) {
+ if (anchorSpec.right) {
+ calcWidth = me.adjustWidthAnchor(anchorSpec.right(ownerWidth) - el.getMargin('lr'), component);
+ } else {
+ calcWidth = undefined;
+ }
+ if (anchorSpec.bottom) {
+ calcHeight = me.adjustHeightAnchor(anchorSpec.bottom(ownerHeight) - el.getMargin('tb'), component);
+ } else {
+ calcHeight = undefined;
}
- calcWidth = anchorSpec.right ? me.adjustWidthAnchor(anchorSpec.right(ownerWidth) - el.getMargin('lr'), component) : undefined;
- calcHeight = anchorSpec.bottom ? me.adjustHeightAnchor(anchorSpec.bottom(ownerHeight) - el.getMargin('tb'), component) : undefined;
boxes.push({
component: component,
@@ -62681,6 +63151,60 @@ Ext.define('Ext.layout.container.Anchor', {
adjustHeightAnchor: function(value, comp) {
return value;
+ },
+
+ configureItem: function(item) {
+ var me = this,
+ owner = me.owner,
+ anchor= item.anchor,
+ anchorsArray,
+ anchorSpec,
+ anchorWidth,
+ anchorHeight;
+
+ if (!item.anchor && item.items && !Ext.isNumber(item.width) && !(Ext.isIE6 && Ext.isStrict)) {
+ item.anchor = anchor = me.defaultAnchor;
+ }
+
+
+ if (owner.anchorSize) {
+ if (typeof owner.anchorSize == 'number') {
+ anchorWidth = owner.anchorSize;
+ }
+ else {
+ anchorWidth = owner.anchorSize.width;
+ anchorHeight = owner.anchorSize.height;
+ }
+ }
+ else {
+ anchorWidth = owner.initialConfig.width;
+ anchorHeight = owner.initialConfig.height;
+ }
+
+ if (anchor) {
+
+ anchorsArray = anchor.split(' ');
+ item.anchorSpec = anchorSpec = {
+ right: me.parseAnchor(anchorsArray[0], item.initialConfig.width, anchorWidth),
+ bottom: me.parseAnchor(anchorsArray[1], item.initialConfig.height, anchorHeight)
+ };
+
+ if (anchorSpec.right) {
+ item.layoutManagedWidth = 1;
+ } else {
+ item.layoutManagedWidth = 2;
+ }
+
+ if (anchorSpec.bottom) {
+ item.layoutManagedHeight = 1;
+ } else {
+ item.layoutManagedHeight = 2;
+ }
+ } else {
+ item.layoutManagedWidth = 2;
+ item.layoutManagedHeight = 2;
+ }
+ this.callParent(arguments);
}
});
@@ -63057,9 +63581,15 @@ Ext.define('Ext.window.Window', {
afterShow: function(animateTarget) {
- var me = this;
+ var me = this,
+ animating = animateTarget || me.animateTarget;
+ if (animating) {
+
+ me.doConstrain();
+ }
+
me.callParent(arguments);
@@ -63068,7 +63598,9 @@ Ext.define('Ext.window.Window', {
}
me.syncMonitorWindowResize();
- me.doConstrain();
+ if (!animating) {
+ me.doConstrain();
+ }
if (me.keyMap) {
me.keyMap.enable();
@@ -64759,15 +65291,13 @@ Ext.define('Ext.window.MessageBox', {
Ext.MessageBox = Ext.Msg = new this();
});
-
-
-
Ext.define('Ext.form.Basic', {
extend: 'Ext.util.Observable',
alternateClassName: 'Ext.form.BasicForm',
requires: ['Ext.util.MixedCollection', 'Ext.form.action.Load', 'Ext.form.action.Submit',
'Ext.window.MessageBox', 'Ext.data.Errors', 'Ext.util.DelayedTask'],
+
constructor: function(owner, config) {
var me = this,
onItemAddOrRemove = me.onItemAddOrRemove;
@@ -66684,7 +67214,7 @@ Ext.define('Ext.layout.component.field.Trigger', {
Ext.define('Ext.view.View', {
extend: 'Ext.view.AbstractView',
- alternateClassName: 'Ext.view.View',
+ alternateClassName: 'Ext.DataView',
alias: 'widget.dataview',
inheritableStatics: {
@@ -66698,7 +67228,8 @@ Ext.define('Ext.view.View', {
mouseout: 'MouseOut',
mouseenter: 'MouseEnter',
mouseleave: 'MouseLeave',
- keydown: 'KeyDown'
+ keydown: 'KeyDown',
+ focus: 'Focus'
}
},
@@ -66782,6 +67313,8 @@ Ext.define('Ext.view.View', {
listeners = {
scope: me,
+
+ freezeEvent: true,
click: me.handleEvent,
mousedown: me.handleEvent,
mouseup: me.handleEvent,
@@ -66935,12 +67468,14 @@ Ext.define('Ext.view.View', {
onItemMouseDown: Ext.emptyFn,
onItemMouseUp: Ext.emptyFn,
+ onItemFocus: Ext.emptyFn,
onItemClick: Ext.emptyFn,
onItemDblClick: Ext.emptyFn,
onItemContextMenu: Ext.emptyFn,
onItemKeyDown: Ext.emptyFn,
onBeforeItemMouseDown: Ext.emptyFn,
onBeforeItemMouseUp: Ext.emptyFn,
+ onBeforeItemFocus: Ext.emptyFn,
onBeforeItemMouseEnter: Ext.emptyFn,
onBeforeItemMouseLeave: Ext.emptyFn,
onBeforeItemClick: Ext.emptyFn,
@@ -66986,8 +67521,12 @@ Ext.define('Ext.view.View', {
},
refresh: function() {
- this.clearHighlight();
- this.callParent(arguments);
+ var me = this;
+ me.clearHighlight();
+ me.callParent(arguments);
+ if (!me.isFixedHeight()) {
+ me.doComponentLayout();
+ }
}
});
@@ -67892,7 +68431,11 @@ Ext.define('Ext.form.field.Number', {
},
rawToValue: function(rawValue) {
- return this.fixPrecision(this.parseValue(rawValue)) || rawValue || null;
+ var value = this.fixPrecision(this.parseValue(rawValue));
+ if (value === null) {
+ value = rawValue || null;
+ }
+ return value;
},
valueToRaw: function(value) {
@@ -68170,7 +68713,6 @@ Ext.define('Ext.toolbar.Paging', {
total : totalCount,
currentPage : store.currentPage,
pageCount: Math.ceil(totalCount / store.pageSize),
-
fromRecord: ((store.currentPage - 1) * store.pageSize) + 1,
toRecord: Math.min(store.currentPage * store.pageSize, totalCount)
@@ -68209,17 +68751,17 @@ Ext.define('Ext.toolbar.Paging', {
onPagingKeyDown : function(field, e){
- var k = e.getKey(),
- pageData = this.getPageData(),
+ var me = this,
+ k = e.getKey(),
+ pageData = me.getPageData(),
increment = e.shiftKey ? 10 : 1,
- pageNum,
- me = this;
+ pageNum;
if (k == e.RETURN) {
e.stopEvent();
pageNum = me.readPageFromInput(pageData);
if (pageNum !== false) {
- pageNum = Math.min(Math.max(1, pageNum), pageData.total);
+ pageNum = Math.min(Math.max(1, pageNum), pageData.pageCount);
if(me.fireEvent('beforechange', me, pageNum) !== false){
me.store.loadPage(pageNum);
}
@@ -68259,9 +68801,8 @@ Ext.define('Ext.toolbar.Paging', {
moveFirst : function(){
- var me = this;
- if(me.fireEvent('beforechange', me, 1) !== false){
- me.store.loadPage(1);
+ if (this.fireEvent('beforechange', this, 1) !== false){
+ this.store.loadPage(1);
}
},
@@ -68270,25 +68811,32 @@ Ext.define('Ext.toolbar.Paging', {
var me = this,
prev = me.store.currentPage - 1;
- if(me.fireEvent('beforechange', me, prev) !== false){
- me.store.previousPage();
+ if (prev > 0) {
+ if (me.fireEvent('beforechange', me, prev) !== false) {
+ me.store.previousPage();
+ }
}
},
moveNext : function(){
- var me = this;
- if(me.fireEvent('beforechange', me, me.store.currentPage + 1) !== false){
- me.store.nextPage();
+ var me = this,
+ total = me.getPageData().pageCount,
+ next = me.store.currentPage + 1;
+
+ if (next <= total) {
+ if (me.fireEvent('beforechange', me, next) !== false) {
+ me.store.nextPage();
+ }
}
},
moveLast : function(){
var me = this,
- last = this.getPageData().pageCount;
+ last = me.getPageData().pageCount;
- if(me.fireEvent('beforechange', me, last) !== false){
+ if (me.fireEvent('beforechange', me, last) !== false) {
me.store.loadPage(last);
}
},
@@ -68298,7 +68846,7 @@ Ext.define('Ext.toolbar.Paging', {
var me = this,
current = me.store.currentPage;
- if(me.fireEvent('beforechange', me, current) !== false){
+ if (me.fireEvent('beforechange', me, current) !== false) {
me.store.loadPage(current);
}
},
@@ -68387,13 +68935,17 @@ Ext.define('Ext.view.BoundList', {
me.addCls(baseCls + '-floating');
}
-
-
- me.tpl = Ext.create('Ext.XTemplate',
- '<ul><tpl for=".">',
- '<li role="option" class="' + itemCls + '">' + me.getInnerTpl(me.displayField) + '</li>',
- '</tpl></ul>'
- );
+ if (!me.tpl) {
+
+
+ me.tpl = Ext.create('Ext.XTemplate',
+ '<ul><tpl for=".">',
+ '<li role="option" class="' + itemCls + '">' + me.getInnerTpl(me.displayField) + '</li>',
+ '</tpl></ul>'
+ );
+ } else if (Ext.isString(me.tpl)) {
+ me.tpl = Ext.create('Ext.XTemplate', me.tpl);
+ }
if (me.pageSize) {
me.pagingToolbar = me.createPagingToolbar();
@@ -68449,14 +69001,14 @@ Ext.define('Ext.view.BoundList', {
me.refreshed--;
}
},
-
+
initAria: function() {
this.callParent();
-
+
var selModel = this.getSelectionModel(),
mode = selModel.getSelectionMode(),
actionEl = this.getActionEl();
-
+
if (mode !== 'SINGLE') {
actionEl.dom.setAttribute('aria-multiselectable', true);
@@ -68635,18 +69187,6 @@ Ext.define('Ext.form.field.ComboBox', {
transform = me.transform,
transformSelect, isLocalMode;
- if (!store && !transform) {
- Ext.Error.raise('Either a valid store, or a HTML select to transform, must be configured on the combo.');
- }
- if (me.typeAhead && me.multiSelect) {
- Ext.Error.raise('typeAhead and multiSelect are mutually exclusive options -- please remove one of them.');
- }
- if (me.typeAhead && !me.editable) {
- Ext.Error.raise('If typeAhead is enabled the combo must be editable: true -- please change one of those settings.');
- }
- if (me.selectOnFocus && !me.editable) {
- Ext.Error.raise('If selectOnFocus is enabled the combo must be editable: true -- please change one of those settings.');
- }
this.addEvents(
@@ -68875,12 +69415,19 @@ Ext.define('Ext.form.field.ComboBox', {
if (!me.queryCaching || me.lastQuery !== queryString) {
me.lastQuery = queryString;
- store.clearFilter(!forceAll);
+
if (isLocalMode) {
- if (!forceAll) {
+
+ if (forceAll) {
+ store.clearFilter();
+ } else {
+
+ store.clearFilter(true);
store.filter(me.displayField, queryString);
}
} else {
+
+
store.load({
params: me.getParams(queryString)
});
@@ -68909,11 +69456,11 @@ Ext.define('Ext.form.field.ComboBox', {
var p = {},
pageSize = this.pageSize,
param = this.queryParam;
-
+
if (param) {
p[param] = queryString;
}
-
+
if (pageSize) {
p.start = 0;
p.limit = pageSize;
@@ -68979,7 +69526,7 @@ Ext.define('Ext.form.field.ComboBox', {
me.doQueryTask.delay(me.queryDelay);
}
}
-
+
if (me.enableKeyEvents) {
me.callParent(arguments);
}
@@ -69010,7 +69557,8 @@ Ext.define('Ext.form.field.ComboBox', {
store: me.store,
displayField: me.displayField,
focusOnToFront: false,
- pageSize: me.pageSize
+ pageSize: me.pageSize,
+ tpl: me.tpl
}, me.listConfig, me.defaultListConfig);
picker = me.picker = Ext.create('Ext.view.BoundList', opts);
@@ -69021,10 +69569,7 @@ Ext.define('Ext.form.field.ComboBox', {
scope: me
});
- me.mon(picker.getSelectionModel(), {
- selectionChange: me.onListSelectionChange,
- scope: me
- });
+ me.mon(picker.getSelectionModel(), 'selectionchange', me.onListSelectionChange, me);
return picker;
},
@@ -69033,32 +69578,37 @@ Ext.define('Ext.form.field.ComboBox', {
this.alignPicker();
this.syncSelection();
},
-
+
onItemClick: function(picker, record){
var me = this,
lastSelection = me.lastSelection,
valueField = me.valueField,
selected;
-
+
if (!me.multiSelect && lastSelection) {
selected = lastSelection[0];
- if (record.get(valueField) === selected.get(valueField)) {
+ if (selected && (record.get(valueField) === selected.get(valueField))) {
me.collapse();
}
- }
+ }
},
onListSelectionChange: function(list, selectedRecords) {
- var me = this;
+ var me = this,
+ isMulti = me.multiSelect,
+ hasRecords = selectedRecords.length > 0;
if (!me.ignoreSelection && me.isExpanded) {
- if (!me.multiSelect) {
+ if (!isMulti) {
Ext.defer(me.collapse, 1, me);
}
- me.setValue(selectedRecords, false);
- if (selectedRecords.length > 0) {
+
+ if (isMulti || hasRecords) {
+ me.setValue(selectedRecords, false);
+ }
+ if (hasRecords) {
me.fireEvent('select', me, selectedRecords);
}
me.inputEl.focus();
@@ -69322,11 +69872,10 @@ Ext.define('Ext.picker.Month', {
-
- width: 175,
-
- height: 195,
-
+ width: 178,
+
+
+ smallCls: Ext.baseCSSPrefix + 'monthpicker-small',
totalYears: 10,
@@ -69360,7 +69909,9 @@ Ext.define('Ext.picker.Month', {
'yeardblclick'
);
-
+ if (me.small) {
+ me.addCls(me.smallCls);
+ }
me.setValue(me.value);
me.activeYear = me.getYear(new Date().getFullYear() - 4, -4);
this.callParent();
@@ -70047,6 +70598,7 @@ Ext.define('Ext.picker.Date', {
renderTo: me.el,
floating: true,
shadow: false,
+ small: me.showToday === false,
listeners: {
scope: me,
cancelclick: me.onCancelClick,
@@ -71420,7 +71972,7 @@ Ext.define('Ext.form.field.HtmlEditor', {
getDocMarkup: function() {
var me = this,
h = me.iframeEl.getHeight() - me.iframePad * 2;
- return Ext.String.format('<html><head><style type="text/css">body{border:0;margin:0;padding:{0}px;height:{1}px;cursor:text}</style></head><body></body></html>', me.iframePad, h);
+ return Ext.String.format('<html><head><style type="text/css">body{border:0;margin:0;padding:{0}px;height:{1}px;box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box;cursor:text}</style></head><body></body></html>', me.iframePad, h);
},
@@ -72271,7 +72823,7 @@ Ext.define('Ext.picker.Time', {
componentCls: Ext.baseCSSPrefix + 'timepicker',
- loadingText: '',
+ loadMask: false,
initComponent: function() {
var me = this,
@@ -72588,7 +73140,11 @@ Ext.define('Ext.form.field.Time', {
forceKeyDown: true,
tab: function(e) {
if (selectOnTab) {
- this.selectHighlighted(e);
+ if(me.picker.highlightedItem) {
+ this.selectHighlighted(e);
+ } else {
+ me.collapse();
+ }
me.triggerBlur();
}
@@ -72623,6 +73179,17 @@ Ext.define('Ext.form.field.Time', {
},
+ onChange: function() {
+ var me = this,
+ picker = me.picker;
+
+ me.callParent(arguments);
+ if(picker) {
+ picker.clearHighlight();
+ }
+ },
+
+
onListSelect: function(list, recordArray) {
var me = this,
record = recordArray[0],
@@ -72640,13 +73207,17 @@ Ext.define('Ext.form.field.Time', {
Ext.define('Ext.grid.CellEditor', {
extend: 'Ext.Editor',
constructor: function(config) {
+ config = Ext.apply({}, config);
+
if (config.field) {
config.field.monitorTab = false;
}
- config.autoSize = {
- width: 'boundEl'
- };
- this.callParent(arguments);
+ if (!Ext.isDefined(config.autoSize)) {
+ config.autoSize = {
+ width: 'boundEl'
+ };
+ }
+ this.callParent([config]);
},
@@ -72700,23 +73271,24 @@ Ext.define('Ext.grid.ColumnLayout', {
alias: 'layout.gridcolumn',
type : 'column',
+ reserveOffset: false,
+
clearInnerCtOnLayout: false,
- constructor: function() {
- var me = this;
- me.callParent(arguments);
- if (!Ext.isDefined(me.availableSpaceOffset)) {
- me.availableSpaceOffset = (Ext.getScrollBarWidth() - 2);
- }
- },
-
beforeLayout: function() {
var me = this,
i = 0,
items = me.getLayoutItems(),
len = items.length,
- item, returnValue;
+ item, returnValue,
+ s;
+
+
+ if (!Ext.isDefined(me.availableSpaceOffset)) {
+ s = me.owner.up('tablepanel').verticalScroller;
+ me.availableSpaceOffset = s ? s.width-1 : 0;
+ }
returnValue = me.callParent(arguments);
@@ -72786,7 +73358,7 @@ Ext.define('Ext.grid.ColumnLayout', {
me.callParent(arguments);
- if (me.align == 'stretchmax') {
+ if (!me.owner.hideHeaders && me.align == 'stretchmax') {
for (; i < len; i++) {
items[i].setPadding();
}
@@ -72796,26 +73368,21 @@ Ext.define('Ext.grid.ColumnLayout', {
updateInnerCtSize: function(tSize, calcs) {
- var me = this,
- extra = 0;
+ var me = this,
+ extra;
- if (!me.isColumn && calcs.meta.tooNarrow) {
- if (
- Ext.isWebKit ||
- Ext.isGecko ||
- (Ext.isIEQuirks && (Ext.isIE6 || Ext.isIE7 || Ext.isIE8))
- ) {
- extra = 1;
-
- } else if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8) {
- extra = 2;
+ if (!me.isColumn) {
+ me.tooNarrow = calcs.meta.tooNarrow;
+ extra = (me.reserveOffset ? me.availableSpaceOffset : 0);
+
+ if (calcs.meta.tooNarrow) {
+ tSize.width = calcs.meta.desiredSize + extra;
+ } else {
+ tSize.width += extra;
}
-
-
- extra++;
- tSize.width = calcs.meta.desiredSize + (me.reserveOffset ? me.availableSpaceOffset : 0) + extra;
}
+
return me.callParent(arguments);
},
@@ -72881,6 +73448,24 @@ Ext.define('Ext.grid.LockingView', {
return cols.concat(this.normalGrid.headerCt.getGridColumns());
},
+ getEl: function(column){
+ return this.getViewForColumn(column).getEl();
+ },
+
+ getViewForColumn: function(column) {
+ var view = this.lockedView,
+ inLocked;
+
+ view.headerCt.cascade(function(col){
+ if (col === column) {
+ inLocked = true;
+ return false;
+ }
+ });
+
+ return inLocked ? view : this.normalView;
+ },
+
onItemMouseEnter: function(view, record){
var me = this,
locked = me.lockedView,
@@ -72932,14 +73517,9 @@ Ext.define('Ext.grid.LockingView', {
},
getCell: function(record, column){
- var view = this.lockedView,
+ var view = this.getViewForColumn(column),
row;
-
-
- if (view.getHeaderAtIndex(column) === -1) {
- view = this.normalView;
- }
-
+
row = view.getNode(record);
return Ext.fly(row).down(column.getCellSelector());
},
@@ -73171,9 +73751,6 @@ Ext.define('Ext.grid.Lockable', {
column.processed = true;
if (column.locked) {
- if (column.flex) {
- Ext.Error.raise("Columns which are locked do NOT support a flex width. You must set a width on the " + columns[i].text + "column.");
- }
lockedWidth += column.width;
lockedHeaders.push(column);
} else {
@@ -73529,60 +74106,79 @@ Ext.define('Ext.grid.Scroller', {
weight: 110,
cls: Ext.baseCSSPrefix + 'scroller',
focusable: false,
-
- renderTpl: ['<div class="' + Ext.baseCSSPrefix + 'stretcher"></div>'],
-
+ reservedSpace: 0,
+
+ renderTpl: [
+ '<div class="' + Ext.baseCSSPrefix + 'scroller-ct" id="{baseId}_ct">',
+ '<div class="' + Ext.baseCSSPrefix + 'stretcher" id="{baseId}_stretch"></div>',
+ '</div>'
+ ],
+
initComponent: function() {
var me = this,
dock = me.dock,
cls = Ext.baseCSSPrefix + 'scroller-vertical',
- sizeProp = 'width',
-
-
-
-
-
- scrollbarWidth = Ext.getScrollBarWidth() + (Ext.isIE ? 1 : -1);
+ sizeProp = 'width';
me.offsets = {bottom: 0};
+ me.scrollProp = 'scrollTop';
+ me.vertical = true;
if (dock === 'top' || dock === 'bottom') {
cls = Ext.baseCSSPrefix + 'scroller-horizontal';
sizeProp = 'height';
+ me.scrollProp = 'scrollLeft';
+ me.vertical = false;
+ me.weight += 5;
}
- me[sizeProp] = scrollbarWidth;
-
+
+ me[sizeProp] = me.scrollerSize = Ext.getScrollbarSize()[sizeProp];
+
me.cls += (' ' + cls);
-
+
Ext.applyIf(me.renderSelectors, {
- stretchEl: '.' + Ext.baseCSSPrefix + 'stretcher'
+ stretchEl: '.' + Ext.baseCSSPrefix + 'stretcher',
+ scrollEl: '.' + Ext.baseCSSPrefix + 'scroller-ct'
});
me.callParent();
},
-
-
+
+ initRenderData: function () {
+ var me = this,
+ ret = me.callParent(arguments) || {};
+
+ ret.baseId = me.id;
+
+ return ret;
+ },
+
afterRender: function() {
var me = this;
me.callParent();
- me.ownerCt.on('afterlayout', me.onOwnerAfterLayout, me);
- me.mon(me.el, 'scroll', me.onElScroll, me);
+
+ me.mon(me.scrollEl, 'scroll', me.onElScroll, me);
Ext.cache[me.el.id].skipGarbageCollection = true;
},
-
+
+ onAdded: function(container) {
+
+ this.ownerGrid = container;
+ this.callParent(arguments);
+ },
+
getSizeCalculation: function() {
- var owner = this.getPanel(),
- dock = this.dock,
- elDom = this.el.dom,
+ var me = this,
+ owner = me.getPanel(),
width = 1,
height = 1,
view, tbl;
-
- if (dock === 'top' || dock === 'bottom') {
+
+ if (!me.vertical) {
var items = owner.query('tableview'),
center = items[1] || items[0];
-
+
if (!center) {
return false;
}
@@ -73590,25 +74186,23 @@ Ext.define('Ext.grid.Scroller', {
width = center.headerCt.getFullWidth();
-
+
if (Ext.isIEQuirks) {
width--;
}
-
- width--;
- } else {
+ } else {
view = owner.down('tableview:not([lockableInjected])');
- if (!view) {
+ if (!view || !view.el) {
return false;
}
- tbl = view.el;
+ tbl = view.el.child('table', true);
if (!tbl) {
return false;
}
+
-
- height = tbl.dom.scrollHeight;
+ height = tbl.offsetHeight;
}
if (isNaN(width)) {
width = 1;
@@ -73621,64 +74215,124 @@ Ext.define('Ext.grid.Scroller', {
height: height
};
},
-
+
invalidate: function(firstPass) {
- if (!this.stretchEl || !this.ownerCt) {
+ var me = this,
+ stretchEl = me.stretchEl;
+
+ if (!stretchEl || !me.ownerCt) {
return;
}
- var size = this.getSizeCalculation(),
- elDom = this.el.dom;
+
+ var size = me.getSizeCalculation(),
+ scrollEl = me.scrollEl,
+ elDom = scrollEl.dom,
+ reservedSpace = me.reservedSpace,
+ pos,
+ extra = 5;
+
if (size) {
- this.stretchEl.setSize(size);
-
+ stretchEl.setSize(size);
+
+ size = me.el.getSize(true);
+
+ if (me.vertical) {
+ size.width += extra;
+ size.height -= reservedSpace;
+ pos = 'left';
+ } else {
+ size.width -= reservedSpace;
+ size.height += extra;
+ pos = 'top';
+ }
+
+ scrollEl.setSize(size);
+ elDom.style[pos] = (-extra) + 'px';
+
elDom.scrollTop = elDom.scrollTop;
}
},
- onOwnerAfterLayout: function(owner, layout) {
+ afterComponentLayout: function() {
+ this.callParent(arguments);
this.invalidate();
},
+ restoreScrollPos: function () {
+ var me = this,
+ el = this.scrollEl,
+ elDom = el && el.dom;
+
+ if (me._scrollPos !== null && elDom) {
+ elDom[me.scrollProp] = me._scrollPos;
+ me._scrollPos = null;
+ }
+ },
+
+ setReservedSpace: function (reservedSpace) {
+ var me = this;
+ if (me.reservedSpace !== reservedSpace) {
+ me.reservedSpace = reservedSpace;
+ me.invalidate();
+ }
+ },
+
+ saveScrollPos: function () {
+ var me = this,
+ el = this.scrollEl,
+ elDom = el && el.dom;
+
+ me._scrollPos = elDom ? elDom[me.scrollProp] : null;
+ },
+
setScrollTop: function(scrollTop) {
- if (this.el) {
- var elDom = this.el.dom;
+ var el = this.scrollEl,
+ elDom = el && el.dom;
+
+ if (elDom) {
return elDom.scrollTop = Ext.Number.constrain(scrollTop, 0, elDom.scrollHeight - elDom.clientHeight);
}
},
setScrollLeft: function(scrollLeft) {
- if (this.el) {
- var elDom = this.el.dom;
+ var el = this.scrollEl,
+ elDom = el && el.dom;
+
+ if (elDom) {
return elDom.scrollLeft = Ext.Number.constrain(scrollLeft, 0, elDom.scrollWidth - elDom.clientWidth);
}
},
scrollByDeltaY: function(delta) {
- if (this.el) {
- var elDom = this.el.dom;
+ var el = this.scrollEl,
+ elDom = el && el.dom;
+
+ if (elDom) {
return this.setScrollTop(elDom.scrollTop + delta);
}
},
scrollByDeltaX: function(delta) {
- if (this.el) {
- var elDom = this.el.dom;
+ var el = this.scrollEl,
+ elDom = el && el.dom;
+
+ if (elDom) {
return this.setScrollLeft(elDom.scrollLeft + delta);
}
},
-
-
+
+
scrollToTop : function(){
this.setScrollTop(0);
},
-
+
onElScroll: function(event, target) {
this.fireEvent('bodyscroll', event, target);
@@ -73706,17 +74360,17 @@ Ext.define('Ext.grid.PagingScroller', {
percentageFromEdge: 0.35,
-
+
scrollToLoadBuffer: 200,
-
+
activePrefetch: true,
-
+
chunkSize: 50,
snapIncrement: 25,
-
+
syncScroll: true,
-
+
initComponent: function() {
var me = this,
ds = me.store;
@@ -73724,8 +74378,7 @@ Ext.define('Ext.grid.PagingScroller', {
ds.on('guaranteedrange', this.onGuaranteedRange, this);
this.callParent(arguments);
},
-
-
+
onGuaranteedRange: function(range, start, end) {
var me = this,
ds = me.store,
@@ -73734,7 +74387,7 @@ Ext.define('Ext.grid.PagingScroller', {
if (range.length && me.visibleStart < range[0].index) {
return;
}
-
+
ds.loadRecords(range);
if (!me.firstLoad) {
@@ -73749,19 +74402,19 @@ Ext.define('Ext.grid.PagingScroller', {
me.syncTo();
}
},
-
+
syncTo: function() {
var me = this,
pnl = me.getPanel(),
store = pnl.store,
- scrollerElDom = this.el.dom,
+ scrollerElDom = this.scrollEl.dom,
rowOffset = me.visibleStart - store.guaranteedStart,
scrollBy = rowOffset * me.rowHeight,
scrollHeight = scrollerElDom.scrollHeight,
clientHeight = scrollerElDom.clientHeight,
scrollTop = scrollerElDom.scrollTop,
useMaximum;
-
+
if (Ext.isIE9 && Ext.isStrict) {
@@ -73773,12 +74426,12 @@ Ext.define('Ext.grid.PagingScroller', {
useMaximum = (scrollHeight - clientHeight - scrollTop <= 0);
this.setViewScrollTop(scrollBy, useMaximum);
},
-
+
getPageData : function(){
var panel = this.getPanel(),
store = panel.store,
totalCount = store.getTotalCount();
-
+
return {
total : totalCount,
currentPage : store.currentPage,
@@ -73787,7 +74440,7 @@ Ext.define('Ext.grid.PagingScroller', {
toRecord: Math.min(store.currentPage * store.pageSize, totalCount)
};
},
-
+
onElScroll: function(e, t) {
var me = this,
panel = me.getPanel(),
@@ -73814,8 +74467,7 @@ Ext.define('Ext.grid.PagingScroller', {
me.visibleStart = visibleStart;
me.visibleEnd = visibleEnd;
-
-
+
me.syncScroll = true;
if (totalCount >= pageSize) {
@@ -73844,29 +74496,29 @@ Ext.define('Ext.grid.PagingScroller', {
store.prefetchPage(nextPage);
}
}
-
-
+
if (me.syncScroll) {
me.syncTo();
}
},
-
+
getSizeCalculation: function() {
- var owner = this.ownerCt,
+ var owner = this.ownerGrid,
view = owner.getView(),
store = this.store,
dock = this.dock,
elDom = this.el.dom,
width = 1,
height = 1;
-
+
if (!this.rowHeight) {
this.rowHeight = view.el.down(view.getItemSelector()).getHeight(false, true);
}
- height = store.getTotalCount() * this.rowHeight;
+
+ height = store[(!store.remoteFilter && store.isFiltered()) ? 'getCount' : 'getTotalCount']() * this.rowHeight;
if (isNaN(width)) {
width = 1;
@@ -73879,7 +74531,7 @@ Ext.define('Ext.grid.PagingScroller', {
height: height
};
},
-
+
attemptLoad: function(start, end) {
var me = this;
if (!me.loadTask) {
@@ -73887,18 +74539,18 @@ Ext.define('Ext.grid.PagingScroller', {
}
me.loadTask.delay(me.scrollToLoadBuffer, me.doAttemptLoad, me, [start, end]);
},
-
+
cancelLoad: function() {
if (this.loadTask) {
this.loadTask.cancel();
}
},
-
+
doAttemptLoad: function(start, end) {
var store = this.getPanel().store;
store.guaranteeRange(start, end);
},
-
+
setViewScrollTop: function(scrollTop, useMax) {
var owner = this.getPanel(),
items = owner.query('tableview'),
@@ -73909,12 +74561,12 @@ Ext.define('Ext.grid.PagingScroller', {
calcScrollTop,
maxScrollTop,
scrollerElDom = this.el.dom;
-
+
owner.virtualScrollTop = scrollTop;
-
+
center = items[1] || items[0];
centerEl = center.el.dom;
-
+
maxScrollTop = ((owner.store.pageSize * this.rowHeight) - centerEl.clientHeight);
calcScrollTop = (scrollTop % ((owner.store.pageSize * this.rowHeight) + 1));
if (useMax) {
@@ -73931,8 +74583,6 @@ Ext.define('Ext.grid.PagingScroller', {
}
});
-
-
Ext.define('Ext.panel.Table', {
extend: 'Ext.panel.Panel',
@@ -73969,6 +74619,8 @@ Ext.define('Ext.panel.Table', {
+
+
sortableColumns: true,
verticalScrollDock: 'right',
@@ -73982,21 +74634,17 @@ Ext.define('Ext.panel.Table', {
scrollerOwner: true,
invalidateScrollerOnRefresh: true,
+
enableColumnMove: true,
+
+
enableColumnResize: true,
+
+ enableColumnHide: true,
initComponent: function() {
- if (!this.viewType) {
- Ext.Error.raise("You must specify a viewType config.");
- }
- if (!this.store) {
- Ext.Error.raise("You must specify a store config");
- }
- if (this.headers) {
- Ext.Error.raise("The headers config is not supported. Please specify columns instead.");
- }
var me = this,
scroll = me.scroll,
@@ -74008,9 +74656,13 @@ Ext.define('Ext.panel.Table', {
border = me.border;
- me.determineScrollbars = Ext.Function.createBuffered(me.determineScrollbars, 30);
- me.invalidateScroller = Ext.Function.createBuffered(me.invalidateScroller, 30);
- me.injectView = Ext.Function.createBuffered(me.injectView, 30);
+
+
+
+
+
+
+ me.injectView = Ext.Function.createThrottled(me.injectView, 30, me);
if (me.hideHeaders) {
border = false;
@@ -74034,6 +74686,7 @@ Ext.define('Ext.panel.Table', {
sortable: me.sortableColumns,
enableColumnMove: me.enableColumnMove,
enableColumnResize: me.enableColumnResize,
+ enableColumnHide: me.enableColumnHide,
border: border
});
me.columns = headerCtCfg.items;
@@ -74049,6 +74702,8 @@ Ext.define('Ext.panel.Table', {
me.store = Ext.data.StoreManager.lookup(me.store);
me.addEvents(
+ 'reconfigure',
+
'scrollerhide',
'scrollershow'
@@ -74100,13 +74755,7 @@ Ext.define('Ext.panel.Table', {
}
if (vertical) {
- me.verticalScroller = me.verticalScroller || {};
- Ext.applyIf(me.verticalScroller, {
- dock: me.verticalScrollDock,
- xtype: me.verticalScrollerType,
- store: me.store
- });
- me.verticalScroller = Ext.ComponentManager.create(me.verticalScroller);
+ me.verticalScroller = Ext.ComponentManager.create(me.initVerticalScroller());
me.mon(me.verticalScroller, {
bodyscroll: me.onVerticalScroll,
scope: me
@@ -74114,12 +74763,7 @@ Ext.define('Ext.panel.Table', {
}
if (horizontal) {
- me.horizontalScroller = Ext.ComponentManager.create({
- xtype: 'gridscroller',
- section: me,
- dock: 'bottom',
- store: me.store
- });
+ me.horizontalScroller = Ext.ComponentManager.create(me.initHorizontalScroller());
me.mon(me.horizontalScroller, {
bodyscroll: me.onHorizontalScroll,
scope: me
@@ -74144,12 +74788,7 @@ Ext.define('Ext.panel.Table', {
scope: me
});
me.mon(view, {
- refresh: {
- fn: this.onViewRefresh,
- scope: me,
- buffer: 50
- },
- itemupdate: me.onViewItemUpdate,
+ refresh: me.onViewRefresh,
scope: me
});
this.relayEvents(view, [
@@ -74230,21 +74869,68 @@ Ext.define('Ext.panel.Table', {
this.callParent();
},
- getState: function(){
- var state = {
- columns: []
- },
- sorter = this.store.sorters.first();
-
- this.headerCt.items.each(function(header){
- state.columns.push({
- id: header.headerId,
- width: header.flex ? undefined : header.width,
- hidden: header.hidden,
- sortable: header.sortable
- });
+
+ initHorizontalScroller: function () {
+ var me = this,
+ ret = {
+ xtype: 'gridscroller',
+ dock: 'bottom',
+ section: me,
+ store: me.store
+ };
+
+ return ret;
+ },
+
+
+ initVerticalScroller: function () {
+ var me = this,
+ ret = me.verticalScroller || {};
+
+ Ext.applyIf(ret, {
+ xtype: me.verticalScrollerType,
+ dock: me.verticalScrollDock,
+ store: me.store
});
+ return ret;
+ },
+
+ getState: function(){
+ var state = this.callParent(),
+ sorter = this.store.sorters.first(),
+ headers = this.headerCt.items.items,
+ header,
+ len = headers.length,
+ i = 0;
+
+ state.columns = [];
+ for (; i < len; i++) {
+ header = headers[i];
+ state.columns[i] = {
+ id: header.headerId
+ };
+
+
+
+
+ if (header.hidden !== (header.initialConfig.hidden||header.self.prototype.hidden)) {
+ state.columns[i].hidden = header.hidden;
+ }
+ if (header.sortable !== header.initialConfig.sortable) {
+ state.columns[i].sortable = header.sortable;
+ }
+ if (header.flex) {
+ if (header.flex !== header.initialConfig.flex) {
+ state.columns[i].flex = header.flex;
+ }
+ } else {
+ if (header.width !== header.initialConfig.width) {
+ state.columns[i].width = header.width;
+ }
+ }
+ }
+
if (sorter) {
state.sort = {
property: sorter.property,
@@ -74266,6 +74952,12 @@ Ext.define('Ext.panel.Table', {
headerState,
header;
+ headerCt.suspendLayout = true;
+
+
+
+ this.callParent(arguments);
+
for (; i < length; ++i) {
headerState = headers[i];
header = headerCt.down('gridcolumn[headerId=' + headerState.id + ']');
@@ -74273,17 +74965,32 @@ Ext.define('Ext.panel.Table', {
if (i !== index) {
headerCt.moveHeader(index, i);
}
- header.sortable = headerState.sortable;
- if (Ext.isDefined(headerState.width)) {
+
+
+
+ if (Ext.isDefined(headerState.hidden)) {
+ header.hidden = headerState.hidden;
+ }
+ if (Ext.isDefined(headerState.sortable)) {
+ header.sortable = headerState.sortable;
+ }
+ if (Ext.isDefined(headerState.flex)) {
+ delete header.width;
+ header.flex = headerState.flex;
+ } else if (Ext.isDefined(headerState.width)) {
delete header.flex;
+ header.minWidth = headerState.width;
if (header.rendered) {
header.setWidth(headerState.width);
} else {
- header.minWidth = header.width = headerState.width;
+ header.width = headerState.width;
}
}
- header.hidden = headerState.hidden;
}
+ headerCt.suspendLayout = false;
+
+
+ headerCt.doLayout();
if (sorter) {
if (store.remoteSort) {
@@ -74311,6 +75018,7 @@ Ext.define('Ext.panel.Table', {
if (!me.view) {
sm = me.getSelectionModel();
me.view = me.createComponent(Ext.apply({}, me.viewConfig, {
+ deferRowRender: me.deferRowRender,
xtype: me.viewType,
store: me.store,
headerCt: me.headerCt,
@@ -74351,12 +75059,6 @@ Ext.define('Ext.panel.Table', {
scroller.scrollByDeltaX(distance);
}
},
-
- afterLayout: function() {
- this.callParent(arguments);
- this.injectView();
- },
-
injectView: function() {
@@ -74367,18 +75069,33 @@ Ext.define('Ext.panel.Table', {
me.hasView = true;
me.add(view);
-
- view.el.scroll = Ext.Function.bind(me.elScroll, me);
-
-
- me.mon(view.el, {
- mousewheel: me.onMouseWheel,
- scope: me
- });
+ function viewReady () {
+
+ view.el.scroll = Ext.Function.bind(me.elScroll, me);
+
+
+ me.mon(view.el, {
+ mousewheel: me.onMouseWheel,
+ scope: me
+ });
+ if (!me.height) {
+ me.doComponentLayout();
+ }
+ }
+
+ if (view.rendered) {
+ viewReady();
+ } else {
+ view.on({
+ afterrender: viewReady,
+ single: true
+ });
+ }
}
},
afterExpand: function() {
+
this.callParent(arguments);
if (!this.hasView) {
this.injectView();
@@ -74399,46 +75116,105 @@ Ext.define('Ext.panel.Table', {
determineScrollbars: function() {
var me = this,
- viewElDom,
- centerScrollWidth,
- centerClientWidth,
+ box,
+ tableEl,
+ scrollWidth,
+ clientWidth,
scrollHeight,
- clientHeight;
+ clientHeight,
+ verticalScroller = me.verticalScroller,
+ horizontalScroller = me.horizontalScroller,
+ curScrollbars = (verticalScroller && verticalScroller.ownerCt === me ? 1 : 0) |
+ (horizontalScroller && horizontalScroller.ownerCt === me ? 2 : 0),
+ reqScrollbars = 0;
+
+
+ if (!me.collapsed && me.view && me.view.el && me.view.el.dom.firstChild) {
+
+
+
+ box = me.layout.getLayoutTargetSize();
+ clientWidth = box.width + ((curScrollbars & 1) ? verticalScroller.width : 0);
+ clientHeight = box.height + ((curScrollbars & 2) ? horizontalScroller.height : 0);
- if (!me.collapsed && me.view && me.view.el) {
- viewElDom = me.view.el.dom;
- centerScrollWidth = me.headerCt.getFullWidth();
- centerClientWidth = viewElDom.offsetWidth;
- if (me.verticalScroller && me.verticalScroller.el) {
- scrollHeight = me.verticalScroller.getSizeCalculation().height;
+
+ scrollWidth = (me.headerCt.query('[flex]').length && !me.headerCt.layout.tooNarrow) ? 0 : me.headerCt.getFullWidth();
+
+
+ if (verticalScroller && verticalScroller.el) {
+ scrollHeight = verticalScroller.getSizeCalculation().height;
} else {
- scrollHeight = viewElDom.scrollHeight;
+ tableEl = me.view.el.child('table', true);
+ scrollHeight = tableEl ? tableEl.offsetHeight : 0;
}
- clientHeight = viewElDom.clientHeight;
+
+
+ if (scrollHeight > clientHeight) {
+ reqScrollbars = 1;
- me.suspendLayout = true;
- me.scrollbarChanged = false;
- if (!me.collapsed && scrollHeight > clientHeight) {
- me.showVerticalScroller();
- } else {
- me.hideVerticalScroller();
+
+ if (horizontalScroller && ((clientWidth - scrollWidth) < verticalScroller.width)) {
+ reqScrollbars = 3;
+ }
}
- if (!me.collapsed && centerScrollWidth > (centerClientWidth + Ext.getScrollBarWidth() - 2)) {
- me.showHorizontalScroller();
- } else {
- me.hideHorizontalScroller();
+
+ else {
+
+
+ if (scrollWidth > clientWidth) {
+ reqScrollbars = 2;
+
+
+ if (verticalScroller && ((clientHeight - scrollHeight) < horizontalScroller.height)) {
+ reqScrollbars = 3;
+ }
+ }
}
- me.suspendLayout = false;
- if (me.scrollbarChanged) {
- me.doComponentLayout();
+
+
+ if (reqScrollbars !== curScrollbars) {
+
+
+ me.suspendLayout = true;
+ if (reqScrollbars & 1) {
+ me.showVerticalScroller();
+ } else {
+ me.hideVerticalScroller();
+ }
+ if (reqScrollbars & 2) {
+ me.showHorizontalScroller();
+ } else {
+ me.hideHorizontalScroller();
+ }
+ me.suspendLayout = false;
+
+
+
+ me.changingScrollBars = true;
+ me.doComponentLayout(me.getWidth(), me.getHeight(), false, me.ownerCt);
+ me.changingScrollBars = false;
}
}
},
+ afterComponentLayout: function() {
+ var me = this;
+ me.callParent(arguments);
+
+
+ me.injectView();
+
+
+ if (!me.changingScrollBars) {
+ me.determineScrollbars();
+ }
+ me.invalidateScroller();
+ },
+
onHeaderResize: function() {
if (this.view && this.view.rendered) {
this.determineScrollbars();
@@ -74446,13 +75222,34 @@ Ext.define('Ext.panel.Table', {
}
},
+ afterCollapse: function() {
+ var me = this;
+ if (me.verticalScroller) {
+ me.verticalScroller.saveScrollPos();
+ }
+ if (me.horizontalScroller) {
+ me.horizontalScroller.saveScrollPos();
+ }
+ me.callParent(arguments);
+ },
+
+ afterExpand: function() {
+ var me = this;
+ me.callParent(arguments);
+ if (me.verticalScroller) {
+ me.verticalScroller.restoreScrollPos();
+ }
+ if (me.horizontalScroller) {
+ me.horizontalScroller.restoreScrollPos();
+ }
+ },
+
hideHorizontalScroller: function() {
var me = this;
if (me.horizontalScroller && me.horizontalScroller.ownerCt === me) {
- me.scrollbarChanged = true;
- me.verticalScroller.offsets.bottom = 0;
+ me.verticalScroller.setReservedSpace(0);
me.removeDocked(me.horizontalScroller, false);
me.removeCls(me.horizontalScrollerPresentCls);
me.fireEvent('scrollerhide', me.horizontalScroller, 'horizontal');
@@ -74465,10 +75262,9 @@ Ext.define('Ext.panel.Table', {
var me = this;
if (me.verticalScroller) {
- me.verticalScroller.offsets.bottom = Ext.getScrollBarWidth() - 2;
+ me.verticalScroller.setReservedSpace(Ext.getScrollbarSize().height - 1);
}
if (me.horizontalScroller && me.horizontalScroller.ownerCt !== me) {
- me.scrollbarChanged = true;
me.addDocked(me.horizontalScroller);
me.addCls(me.horizontalScrollerPresentCls);
me.fireEvent('scrollershow', me.horizontalScroller, 'horizontal');
@@ -74477,16 +75273,10 @@ Ext.define('Ext.panel.Table', {
hideVerticalScroller: function() {
- var me = this,
- headerCt = me.headerCt;
+ var me = this;
-
- if (headerCt && headerCt.layout.reserveOffset) {
- headerCt.layout.reserveOffset = false;
- headerCt.doLayout();
- }
+ me.setHeaderReserveOffset(false);
if (me.verticalScroller && me.verticalScroller.ownerCt === me) {
- me.scrollbarChanged = true;
me.removeDocked(me.verticalScroller, false);
me.removeCls(me.verticalScrollerPresentCls);
me.fireEvent('scrollerhide', me.verticalScroller, 'vertical');
@@ -74495,22 +75285,27 @@ Ext.define('Ext.panel.Table', {
showVerticalScroller: function() {
- var me = this,
- headerCt = me.headerCt;
+ var me = this;
-
- if (headerCt && !headerCt.layout.reserveOffset) {
- headerCt.layout.reserveOffset = true;
- headerCt.doLayout();
- }
+ me.setHeaderReserveOffset(true);
if (me.verticalScroller && me.verticalScroller.ownerCt !== me) {
- me.scrollbarChanged = true;
me.addDocked(me.verticalScroller);
me.addCls(me.verticalScrollerPresentCls);
me.fireEvent('scrollershow', me.verticalScroller, 'vertical');
}
},
+ setHeaderReserveOffset: function (reserveOffset) {
+ var headerCt = this.headerCt,
+ layout = headerCt.layout;
+
+
+ if (layout && layout.reserveOffset !== reserveOffset) {
+ layout.reserveOffset = reserveOffset;
+ headerCt.doLayout();
+ }
+ },
+
invalidateScroller: function() {
var me = this,
@@ -74549,11 +75344,12 @@ Ext.define('Ext.panel.Table', {
onMouseWheel: function(e) {
var me = this,
- browserEvent = e.browserEvent,
vertScroller = me.getVerticalScroller(),
horizScroller = me.getHorizontalScroller(),
- scrollDelta = me.scrollDelta,
- deltaY, deltaX,
+ scrollDelta = me.scrollDelta / -5,
+ deltas = e.getWheelDeltas(),
+ deltaX = scrollDelta * deltas.x,
+ deltaY = scrollDelta * deltas.y,
vertScrollerEl, horizScrollerEl,
vertScrollerElDom, horizScrollerElDom,
horizontalCanScrollLeft, horizontalCanScrollRight,
@@ -74561,7 +75357,7 @@ Ext.define('Ext.panel.Table', {
if (horizScroller) {
- horizScrollerEl = horizScroller.el;
+ horizScrollerEl = horizScroller.scrollEl;
if (horizScrollerEl) {
horizScrollerElDom = horizScrollerEl.dom;
horizontalCanScrollRight = horizScrollerElDom.scrollLeft !== horizScrollerElDom.scrollWidth - horizScrollerElDom.clientWidth;
@@ -74569,7 +75365,7 @@ Ext.define('Ext.panel.Table', {
}
}
if (vertScroller) {
- vertScrollerEl = vertScroller.el;
+ vertScrollerEl = vertScroller.scrollEl;
if (vertScrollerEl) {
vertScrollerElDom = vertScrollerEl.dom;
verticalCanScrollDown = vertScrollerElDom.scrollTop !== vertScrollerElDom.scrollHeight - vertScrollerElDom.clientHeight;
@@ -74577,19 +75373,6 @@ Ext.define('Ext.panel.Table', {
}
}
-
- if (browserEvent.wheelDeltaX || browserEvent.wheelDeltaY) {
- deltaX = -browserEvent.wheelDeltaX / 120 * scrollDelta / 3;
- deltaY = -browserEvent.wheelDeltaY / 120 * scrollDelta / 3;
- } else {
-
- if (browserEvent.axis && browserEvent.axis === 1) {
- deltaX = -(scrollDelta * e.getWheelDelta()) / 3;
- } else {
- deltaY = -(scrollDelta * e.getWheelDelta() / 3);
- }
- }
-
if (horizScroller) {
if ((deltaX < 0 && horizontalCanScrollLeft) || (deltaX > 0 && horizontalCanScrollRight)) {
e.stopEvent();
@@ -74599,76 +75382,19 @@ Ext.define('Ext.panel.Table', {
if (vertScroller) {
if ((deltaY < 0 && verticalCanScrollUp) || (deltaY > 0 && verticalCanScrollDown)) {
e.stopEvent();
- vertScroller.scrollByDeltaY(deltaY);
+ vertScroller.scrollByDeltaY(deltaY);
}
}
},
onViewRefresh: function() {
- if (Ext.isIE) {
- this.syncCellHeight();
- }
this.determineScrollbars();
if (this.invalidateScrollerOnRefresh) {
this.invalidateScroller();
}
},
- onViewItemUpdate: function(record, index, tr) {
- if (Ext.isIE) {
- this.syncCellHeight([tr]);
- }
- },
-
-
-
-
- syncCellHeight: function(trs) {
- var me = this,
- i = 0,
- tds,
- j, tdsLn,
- tr, td,
- trsLn,
- rowHeights = [],
- cellHeights,
- cellClsSelector = ('.' + Ext.baseCSSPrefix + 'grid-cell');
-
- trs = trs || me.view.getNodes();
-
- trsLn = trs.length;
-
- for (; i < trsLn; i++) {
- tr = trs[i];
- tds = Ext.fly(tr).query(cellClsSelector);
- tdsLn = tds.length;
- cellHeights = [];
- for (j = 0; j < tdsLn; j++) {
- td = tds[j];
- cellHeights.push(td.clientHeight);
- }
- rowHeights.push(Ext.Array.max(cellHeights));
- }
-
-
- for (i = 0; i < trsLn; i++) {
- tr = trs[i];
- tdsLn = tr.childNodes.length;
- for (j = 0; j < tdsLn; j++) {
- td = Ext.fly(tr.childNodes[j]);
- if (rowHeights[i]) {
- if (td.is(cellClsSelector)) {
- td.setHeight(rowHeights[i]);
- } else {
- td.down(cellClsSelector).setHeight(rowHeights[i]);
- }
- }
-
- }
- }
- },
-
setScrollTop: function(top) {
var me = this,
@@ -74679,7 +75405,6 @@ Ext.define('Ext.panel.Table', {
if (verticalScroller) {
verticalScroller.setScrollTop(top);
}
-
},
getScrollerOwner: function() {
@@ -74692,18 +75417,20 @@ Ext.define('Ext.panel.Table', {
scrollByDeltaY: function(deltaY) {
- var rootCmp = this.getScrollerOwner(),
- scrollerRight;
- scrollerRight = rootCmp.down('gridscroller[dock=' + this.verticalScrollDock + ']');
- if (scrollerRight) {
- scrollerRight.scrollByDeltaY(deltaY);
+ var verticalScroller = this.getVerticalScroller();
+
+ if (verticalScroller) {
+ verticalScroller.scrollByDeltaY(deltaY);
}
},
-
scrollByDeltaX: function(deltaX) {
- this.horizontalScroller.scrollByDeltaX(deltaX);
+ var horizontalScroller = this.getVerticalScroller();
+
+ if (horizontalScroller) {
+ horizontalScroller.scrollByDeltaX(deltaX);
+ }
},
@@ -74755,7 +75482,9 @@ Ext.define('Ext.panel.Table', {
}
if (!this.selModel.hasRelaySetup) {
- this.relayEvents(this.selModel, ['selectionchange', 'select', 'deselect']);
+ this.relayEvents(this.selModel, [
+ 'selectionchange', 'beforeselect', 'beforedeselect', 'select', 'deselect'
+ ]);
this.selModel.hasRelaySetup = true;
}
@@ -74781,21 +75510,9 @@ Ext.define('Ext.panel.Table', {
onHorizontalScroll: function(event, target) {
var owner = this.getScrollerOwner(),
items = owner.query('tableview'),
- i = 0,
- len = items.length,
- center,
- centerEl,
- centerScrollWidth,
- centerClientWidth,
- width;
-
- center = items[1] || items[0];
- centerEl = center.el.dom;
- centerScrollWidth = centerEl.scrollWidth;
- centerClientWidth = centerEl.offsetWidth;
- width = this.horizontalScroller.getWidth();
+ center = items[1] || items[0];
- centerEl.scrollLeft = target.scrollLeft;
+ center.el.dom.scrollLeft = target.scrollLeft;
this.headerCt.el.dom.scrollLeft = target.scrollLeft;
},
@@ -74812,31 +75529,32 @@ Ext.define('Ext.panel.Table', {
me.getView().bindStore(store);
},
+
reconfigure: function(store, columns) {
- var me = this;
+ var me = this,
+ headerCt = me.headerCt;
if (me.lockable) {
me.reconfigureLockable(store, columns);
- return;
- }
-
- if (columns) {
- me.headerCt.removeAll();
- me.headerCt.add(columns);
- }
- if (store) {
- store = Ext.StoreManager.lookup(store);
- me.bindStore(store);
} else {
- me.getView().refresh();
+ headerCt.suspendLayout = true;
+ headerCt.removeAll();
+ if (columns) {
+ headerCt.add(columns);
+ } else {
+ headerCt.doLayout();
+ }
+ if (store) {
+ store = Ext.StoreManager.lookup(store);
+ me.bindStore(store);
+ } else {
+ me.getView().refresh();
+ }
+ if (columns) {
+ me.forceComponentLayout();
+ }
}
- },
-
- afterComponentLayout: function() {
- var me = this;
- me.callParent(arguments);
- me.determineScrollbars();
- me.invalidateScroller();
+ me.fireEvent('reconfigure', me);
}
});
@@ -74872,7 +75590,16 @@ Ext.define('Ext.view.Table', {
initComponent: function() {
var me = this;
-
+
+ if (me.deferRowRender !== false) {
+ me.refresh = function() {
+ delete me.refresh;
+ setTimeout(function() {
+ me.refresh();
+ }, 0);
+ };
+ }
+
me.scrollState = {};
me.selModel.view = me;
me.headerCt.view = me;
@@ -74898,7 +75625,7 @@ Ext.define('Ext.view.Table', {
onStoreLoad: function(){
var me = this;
-
+
if (me.invalidateScrollerOnRefresh) {
if (Ext.isGecko) {
if (!me.scrollToTopTask) {
@@ -74913,24 +75640,24 @@ Ext.define('Ext.view.Table', {
scrollToTop: Ext.emptyFn,
-
+
addElListener: function(eventName, fn, scope){
this.mon(this, eventName, fn, scope, {
element: 'el'
});
},
-
+
getGridColumns: function() {
- return this.headerCt.getGridColumns();
+ return this.headerCt.getGridColumns();
},
-
+
getHeaderAtIndex: function(index) {
return this.headerCt.getHeaderAtIndex(index);
},
-
+
getCell: function(record, column) {
var row = this.getNode(record);
@@ -74951,7 +75678,7 @@ Ext.define('Ext.view.Table', {
i = 0,
features,
len;
-
+
me.features = me.features || [];
features = me.features;
len = features.length;
@@ -74983,7 +75710,7 @@ Ext.define('Ext.view.Table', {
afterRender: function() {
var me = this;
-
+
me.callParent();
me.mon(me.el, {
scroll: me.fireBodyScroll,
@@ -75041,24 +75768,6 @@ Ext.define('Ext.view.Table', {
for (; j < jln; j++) {
rowParams = {};
preppedRecords[j]['rowCls'] = this.getRowClass(records[j], j, rowParams, this.store);
- if (rowParams.alt) {
- Ext.Error.raise("The getRowClass alt property is no longer supported.");
- }
- if (rowParams.tstyle) {
- Ext.Error.raise("The getRowClass tstyle property is no longer supported.");
- }
- if (rowParams.cells) {
- Ext.Error.raise("The getRowClass cells property is no longer supported.");
- }
- if (rowParams.body) {
- Ext.Error.raise("The getRowClass body property is no longer supported. Use the getAdditionalData method of the rowbody feature.");
- }
- if (rowParams.bodyStyle) {
- Ext.Error.raise("The getRowClass bodyStyle property is no longer supported.");
- }
- if (rowParams.cols) {
- Ext.Error.raise("The getRowClass cols property is no longer supported.");
- }
}
}
@@ -75078,11 +75787,21 @@ Ext.define('Ext.view.Table', {
onHeaderResize: function(header, w, suppressFocus) {
var me = this,
el = me.el;
+
if (el) {
me.saveScrollState();
+
+
+
+
+ if (Ext.isIE6 || Ext.isIE7) {
+ if (header.el.hasCls(Ext.baseCSSPrefix + 'column-header-first')) {
+ w += 1;
+ }
+ }
el.select('.' + Ext.baseCSSPrefix + 'grid-col-resizer-'+header.id).setWidth(w);
el.select('.' + Ext.baseCSSPrefix + 'grid-table-resizer').setWidth(me.headerCt.getFullWidth());
me.restoreScrollState();
@@ -75117,7 +75836,7 @@ Ext.define('Ext.view.Table', {
setNewTemplate: function() {
var me = this,
columns = me.headerCt.getColumnsForTpl(true);
-
+
me.tpl = me.getTableChunker().getTableTpl({
columns: columns,
features: me.features
@@ -75153,31 +75872,31 @@ Ext.define('Ext.view.Table', {
onRowDeselect : function(rowIdx) {
var me = this;
-
+
me.removeRowCls(rowIdx, me.selectedItemCls);
me.removeRowCls(rowIdx, me.focusedItemCls);
},
-
+
onCellSelect: function(position) {
var cell = this.getCellByPosition(position);
if (cell) {
cell.addCls(this.selectedCellCls);
}
},
-
+
onCellDeselect: function(position) {
var cell = this.getCellByPosition(position);
if (cell) {
cell.removeCls(this.selectedCellCls);
}
-
+
},
-
+
onCellFocus: function(position) {
this.focusCell(position);
},
-
+
getCellByPosition: function(position) {
var row = position.row,
column = position.column,
@@ -75186,7 +75905,7 @@ Ext.define('Ext.view.Table', {
header = this.headerCt.getHeaderAtIndex(column),
cellSelector,
cell = false;
-
+
if (header && node) {
cellSelector = header.getCellSelector();
cell = Ext.fly(node).down(cellSelector);
@@ -75221,7 +75940,7 @@ Ext.define('Ext.view.Table', {
rowRegion,
elRegion,
record;
-
+
if (row && el) {
elRegion = el.getRegion();
rowRegion = Ext.fly(row).getRegion();
@@ -75315,21 +76034,9 @@ Ext.define('Ext.view.Table', {
},
- refresh: function(firstPass) {
- var me = this,
- table;
-
-
- me.setNewTemplate();
-
- me.callParent(arguments);
-
-
-
- if (me.rendered && !firstPass) {
-
-
- }
+ refresh: function() {
+ this.setNewTemplate();
+ this.callParent(arguments);
},
processItemEvent: function(record, row, rowIndex, e) {
@@ -75396,7 +76103,7 @@ Ext.define('Ext.view.Table', {
beforeArgs = feature.getFireEventArgs('before' + prefix + type, me, featureTarget, e);
args = feature.getFireEventArgs(prefix + type, me, featureTarget, e);
-
+
if (
(me.fireEvent.apply(me, beforeArgs) === false) ||
@@ -75430,9 +76137,11 @@ Ext.define('Ext.view.Table', {
expandToFit: function(header) {
- var maxWidth = this.getMaxContentWidth(header);
- delete header.flex;
- header.setWidth(maxWidth);
+ if (header) {
+ var maxWidth = this.getMaxContentWidth(header);
+ delete header.flex;
+ header.setWidth(maxWidth);
+ }
},
@@ -76454,10 +77163,10 @@ Ext.define('Ext.grid.header.Container', {
sortable: true,
-
+
initComponent: function() {
var me = this;
-
+
me.headerCounter = 0;
me.plugins = me.plugins || [];
@@ -76471,7 +77180,7 @@ Ext.define('Ext.grid.header.Container', {
me.reorderer = Ext.create('Ext.grid.plugin.HeaderReorderer');
if (!me.enableColumnResize) {
me.resizer.disable();
- }
+ }
if (!me.enableColumnMove) {
me.reorderer.disable();
}
@@ -76581,7 +77290,7 @@ Ext.define('Ext.grid.header.Container', {
firstHeaderEl.addCls(me.firstHeaderCls);
me.pastFirstHeaderEl = firstHeaderEl;
}
-
+
lastHeaderEl = topHeaders[topHeaders.length - 1].el;
if (lastHeaderEl !== me.pastLastHeaderEl) {
if (me.pastLastHeaderEl) {
@@ -76592,7 +77301,7 @@ Ext.define('Ext.grid.header.Container', {
}
}
}
-
+
},
onHeaderShow: function(header) {
@@ -76708,6 +77417,10 @@ Ext.define('Ext.grid.header.Container', {
for (i = 0; i < len; i++) {
itemToDisable = itemsToDisable[i];
if (!Ext.Array.contains(me.disabledMenuItems, itemToDisable)) {
+
+
+
+ itemToDisable.disabled = false;
itemToDisable[itemToDisable.menu ? 'disableCheckChange' : 'disable']();
me.disabledMenuItems.push(itemToDisable);
}
@@ -76806,6 +77519,7 @@ Ext.define('Ext.grid.header.Container', {
if (!me.menu) {
me.menu = Ext.create('Ext.menu.Menu', {
+ hideOnParentHide: false,
items: me.getMenuItems(),
listeners: {
deactivate: me.onMenuDeactivate,
@@ -76821,15 +77535,11 @@ Ext.define('Ext.grid.header.Container', {
getMenuItems: function() {
var me = this,
- menuItems = [{
- itemId: 'columnItem',
- text: me.columnsText,
- cls: Ext.baseCSSPrefix + 'cols-icon',
- menu: me.getColumnMenu(me)
- }];
+ menuItems = [],
+ hideableColumns = me.enableColumnHide ? me.getColumnMenu(me) : null;
if (me.sortable) {
- menuItems.unshift({
+ menuItems = [{
itemId: 'ascItem',
text: me.sortAscText,
cls: 'xg-hmenu-sort-asc',
@@ -76841,7 +77551,15 @@ Ext.define('Ext.grid.header.Container', {
cls: 'xg-hmenu-sort-desc',
handler: me.onSortDescClick,
scope: me
- },'-');
+ }];
+ };
+ if (hideableColumns && hideableColumns.length) {
+ menuItems.push('-', {
+ itemId: 'columnItem',
+ text: me.columnsText,
+ cls: Ext.baseCSSPrefix + 'cols-icon',
+ menu: hideableColumns
+ });
}
return menuItems;
},
@@ -76907,14 +77625,27 @@ Ext.define('Ext.grid.header.Container', {
headers = this.getGridColumns(flushCache),
headersLn = headers.length,
i = 0,
- header;
+ header,
+ width;
for (; i < headersLn; i++) {
header = headers[i];
+
+ if (header.hidden) {
+ width = 0;
+ } else {
+ width = header.getDesiredWidth();
+
+
+
+ if ((i == 0) && (Ext.isIE6 || Ext.isIE7)) {
+ width += 1;
+ }
+ }
cols.push({
dataIndex: header.dataIndex,
align: header.align,
- width: header.hidden ? 0 : header.getDesiredWidth(),
+ width: width,
id: header.id,
cls: header.tdCls,
columnId: header.getItemId()
@@ -77031,7 +77762,7 @@ Ext.define('Ext.grid.header.Container', {
if (typeof renderer === "string") {
header.renderer = renderer = Ext.util.Format[renderer];
}
-
+
if (typeof renderer === "function") {
value = renderer.call(
header.scope || this.ownerCt,
@@ -77047,14 +77778,8 @@ Ext.define('Ext.grid.header.Container', {
);
}
- if (metaData.css) {
-
- obj.cssWarning = true;
- metaData.tdCls = metaData.css;
- delete metaData.css;
- }
-
- obj[headerId+'-modified'] = record.modified[header.dataIndex] ? Ext.baseCSSPrefix + 'grid-dirty-cell' : '';
+
+ obj[headerId+'-modified'] = record.isModified(header.dataIndex) ? Ext.baseCSSPrefix + 'grid-dirty-cell' : '';
obj[headerId+'-tdCls'] = metaData.tdCls;
obj[headerId+'-tdAttr'] = metaData.tdAttr;
obj[headerId+'-style'] = metaData.style;
@@ -77109,10 +77834,14 @@ Ext.define('Ext.grid.column.Column', {
sortable: true,
+
+
+
+
hideable: true,
@@ -77144,7 +77873,7 @@ Ext.define('Ext.grid.column.Column', {
var me = this,
i,
len;
-
+
if (Ext.isDefined(me.header)) {
me.text = me.header;
delete me.header;
@@ -77170,12 +77899,6 @@ Ext.define('Ext.grid.column.Column', {
if (Ext.isDefined(me.columns)) {
me.isGroupHeader = true;
- if (me.dataIndex) {
- Ext.Error.raise('Ext.grid.column.Column: Group header may not accept a dataIndex');
- }
- if ((me.width && me.width !== Ext.grid.header.Container.prototype.defaultWidth) || me.flex) {
- Ext.Error.raise('Ext.grid.column.Column: Group header does not support setting explicit widths or flexs. The group header width is calculated by the sum of its children.');
- }
me.items = me.columns;
@@ -77186,9 +77909,6 @@ Ext.define('Ext.grid.column.Column', {
for (i = 0, len = me.items.length; i < len; i++) {
me.width += me.items[i].width || Ext.grid.header.Container.prototype.defaultWidth;
- if (me.items[i].flex) {
- Ext.Error.raise('Ext.grid.column.Column: items of a grouped header do not support flexed values. Each item must explicitly define its width.');
- }
}
me.minWidth = me.width;
@@ -77220,7 +77940,7 @@ Ext.define('Ext.grid.column.Column', {
initRenderData: function() {
var me = this;
-
+
Ext.applyIf(me.renderData, {
text: me.text,
menuDisabled: me.menuDisabled
@@ -77233,7 +77953,7 @@ Ext.define('Ext.grid.column.Column', {
this.text = text;
if (this.rendered) {
this.textEl.update(text);
- }
+ }
},
@@ -77260,7 +77980,7 @@ Ext.define('Ext.grid.column.Column', {
dblclick: me.onElDblClick,
scope: me
});
-
+
if (!Ext.isIE8 || !Ext.isStrict) {
@@ -77291,22 +78011,32 @@ Ext.define('Ext.grid.column.Column', {
siblings,
len, i,
oldWidth = me.getWidth(),
- newWidth = 0;
+ newWidth = 0,
+ readyForSizing = true,
+ hidden,
+ sibling;
if (width !== oldWidth) {
if (headerCt.isGroupHeader) {
-
siblings = headerCt.items.items;
len = siblings.length;
- if (siblings[len - 1].rendered) {
-
- for (i = 0; i < len; i++) {
- newWidth += (siblings[i] === me) ? width : siblings[i].getWidth();
+ for (i = 0; i < len; i++) {
+ sibling = siblings[i];
+ hidden = sibling.hidden;
+ if (!sibling.rendered && !hidden) {
+ readyForSizing = false;
+ break;
+ }
+ if (!hidden) {
+ newWidth += (sibling === me) ? width : sibling.getWidth();
}
+ }
+
+ if (readyForSizing) {
headerCt.minWidth = newWidth;
headerCt.setWidth(newWidth);
}
@@ -77420,7 +78150,7 @@ Ext.define('Ext.grid.column.Column', {
var me = this,
idx,
nextIdx;
-
+
if (me.sortable) {
idx = Ext.Array.indexOf(me.possibleSortStates, me.sortState);
@@ -77610,12 +78340,12 @@ Ext.define('Ext.grid.column.Column', {
isOnRightEdge: function(e) {
return (this.el.getRight() - e.getXY()[0] <= this.handleWidth);
}
+
-
-
-
+
+
});
@@ -77688,9 +78418,12 @@ Ext.define('Ext.view.DropZone', {
fireViewEvent: function() {
- this.lock();
- var result = this.view.fireEvent.apply(this.view, arguments);
- this.unlock();
+ var me = this,
+ result;
+
+ me.lock();
+ result = me.view.fireEvent.apply(me.view, arguments);
+ me.unlock();
return result;
},
@@ -77794,41 +78527,46 @@ Ext.define('Ext.view.DropZone', {
onNodeOver: function(node, dragZone, e, data) {
- if (!Ext.Array.contains(data.records, this.view.getRecord(node))) {
- this.positionIndicator(node, data, e);
+ var me = this;
+
+ if (!Ext.Array.contains(data.records, me.view.getRecord(node))) {
+ me.positionIndicator(node, data, e);
}
- return this.valid ? this.dropAllowed : this.dropNotAllowed;
+ return me.valid ? me.dropAllowed : me.dropNotAllowed;
},
notifyOut: function(node, dragZone, e, data) {
- this.callParent(arguments);
- delete this.overRecord;
- delete this.currentPosition;
- if (this.indicator) {
- this.indicator.hide();
+ var me = this;
+
+ me.callParent(arguments);
+ delete me.overRecord;
+ delete me.currentPosition;
+ if (me.indicator) {
+ me.indicator.hide();
}
},
onContainerOver : function(dd, e, data) {
- var v = this.view,
- c = v.store.getCount();
+ var me = this,
+ view = me.view,
+ count = view.store.getCount();
- if (c) {
- this.positionIndicator(v.getNode(c - 1), data, e);
+ if (count) {
+ me.positionIndicator(view.getNode(count - 1), data, e);
}
else {
- delete this.overRecord;
- delete this.currentPosition;
- this.getIndicator().setWidth(Ext.fly(v.el).getWidth()).showAt(0, 0);
- this.valid = true;
+ delete me.overRecord;
+ delete me.currentPosition;
+ me.getIndicator().setWidth(Ext.fly(view.el).getWidth()).showAt(0, 0);
+ me.valid = true;
}
- return this.dropAllowed;
+ return me.dropAllowed;
},
onContainerDrop : function(dd, e, data) {
@@ -77849,23 +78587,18 @@ Ext.define('Ext.view.DropZone', {
dropped = true;
me.fireViewEvent('drop', node, data, me.overRecord, me.currentPosition);
},
- performOperation;
+ performOperation = false;
if (me.valid) {
performOperation = me.fireViewEvent('beforedrop', node, data, me.overRecord, me.currentPosition, processDrop);
- if (performOperation === 0) {
- return;
- } else if (performOperation !== false) {
+ if (performOperation !== false) {
if (!dropped) {
processDrop();
}
- } else {
- return false;
}
- } else {
- return false;
}
+ return performOperation;
}
});
@@ -77893,7 +78626,9 @@ Ext.define('Ext.grid.ViewDropZone', {
}
index = store.indexOf(record);
- if (position == 'after') {
+
+
+ if (position !== 'before') {
index++;
}
store.insert(index, data.records);
@@ -77947,7 +78682,7 @@ Ext.define('Ext.grid.column.Action', {
meta.tdCls += ' ' + Ext.baseCSSPrefix + 'action-col-cell';
for (i = 0; i < l; i++) {
item = items[i];
- v += '<img alt="' + me.altText + '" src="' + (item.icon || Ext.BLANK_IMAGE_URL) +
+ v += '<img alt="' + (item.altText || me.altText) + '" src="' + (item.icon || Ext.BLANK_IMAGE_URL) +
'" class="' + Ext.baseCSSPrefix + 'action-col-icon ' + Ext.baseCSSPrefix + 'action-col-' + String(i) + ' ' + (item.iconCls || '') +
' ' + (Ext.isFunction(item.getClass) ? item.getClass.apply(item.scope||me.scope||me, arguments) : (me.iconCls || '')) + '"' +
((item.tooltip) ? ' data-qtip="' + item.tooltip + '"' : '') + ' />';
@@ -78203,7 +78938,7 @@ Ext.define('Ext.grid.feature.AbstractSummary', {
getColumnValue: function(column, summaryData){
var comp = Ext.getCmp(column.id),
- value = summaryData[column.dataIndex],
+ value = summaryData[column.id],
renderer = comp.summaryRenderer;
if (renderer) {
@@ -78799,6 +79534,7 @@ Ext.define('Ext.grid.feature.GroupingSummary', {
reader = store.proxy.reader,
groups = me.summaryGroups,
columns = me.view.headerCt.getColumnsForTpl(),
+ remote,
i,
length,
fieldData,
@@ -78817,8 +79553,7 @@ Ext.define('Ext.grid.feature.GroupingSummary', {
reader.root = me.remoteRoot;
reader.buildExtractors(true);
Ext.Array.each(reader.getRoot(reader.rawData), function(value) {
- data[value[groupField]] = value;
- data[value[groupField]]._remote = true;
+ remoteData[value[groupField]] = value;
});
reader.root = root;
@@ -78831,8 +79566,15 @@ Ext.define('Ext.grid.feature.GroupingSummary', {
for (key in fieldData) {
if (fieldData.hasOwnProperty(key)) {
- if (!data[key]._remote) {
- data[key][comp.dataIndex] = fieldData[key];
+ data[key][comp.id] = fieldData[key];
+ }
+ }
+
+ for (key in remoteData) {
+ if (remoteData.hasOwnProperty(key)) {
+ remote = remoteData[key][comp.dataIndex];
+ if (remote !== undefined) {
+ data[key][comp.id] = remote;
}
}
}
@@ -79027,7 +79769,7 @@ Ext.define('Ext.grid.feature.Summary', {
for (i = 0, length = columns.length; i < length; ++i) {
comp = Ext.getCmp(columns[i].id);
- data[comp.dataIndex] = me.getSummary(store, comp.summaryType, comp.dataIndex, false);
+ data[comp.id] = me.getSummary(store, comp.summaryType, comp.dataIndex, false);
}
return data;
}
@@ -79396,7 +80138,8 @@ Ext.define('Ext.grid.plugin.Editing', {
me.grid = grid;
me.view = grid.view;
me.initEvents();
- me.initFieldAccessors(me.view.getGridColumns());
+ me.mon(grid, 'reconfigure', me.onReconfigure, me);
+ me.onReconfigure();
grid.relayEvents(me, ['beforeedit', 'edit', 'validateedit']);
@@ -79404,6 +80147,11 @@ Ext.define('Ext.grid.plugin.Editing', {
grid.isEditable = true;
grid.editingPlugin = grid.view.editingPlugin = me;
},
+
+
+ onReconfigure: function(){
+ this.initFieldAccessors(this.view.getGridColumns());
+ },
destroy: function() {
@@ -79647,7 +80395,7 @@ Ext.define('Ext.grid.plugin.Editing', {
Ext.define('Ext.grid.plugin.CellEditing', {
alias: 'plugin.cellediting',
extend: 'Ext.grid.plugin.Editing',
- requires: ['Ext.grid.CellEditor'],
+ requires: ['Ext.grid.CellEditor', 'Ext.util.DelayedTask'],
constructor: function() {
@@ -79657,11 +80405,18 @@ Ext.define('Ext.grid.plugin.CellEditing', {
this.editors = Ext.create('Ext.util.MixedCollection', false, function(editor) {
return editor.editorId;
});
+ this.editTask = Ext.create('Ext.util.DelayedTask');
+ },
+
+ onReconfigure: function(){
+ this.editors.clear();
+ this.callParent();
},
destroy: function() {
var me = this;
+ me.editTask.cancel();
me.editors.each(Ext.destroy, Ext);
me.editors.clear();
me.callParent(arguments);
@@ -79725,13 +80480,13 @@ Ext.define('Ext.grid.plugin.CellEditing', {
me.setActiveColumn(columnHeader);
- Ext.defer(ed.startEdit, 15, ed, [me.getCell(record, columnHeader), value]);
+ me.editTask.delay(15, ed.startEdit, ed, [me.getCell(record, columnHeader), value]);
} else {
- me.grid.getView().el.focus((Ext.isWebKit || Ext.isIE) ? 10 : false);
+ me.grid.getView().getEl(columnHeader).focus((Ext.isWebKit || Ext.isIE) ? 10 : false);
}
},
@@ -79770,7 +80525,7 @@ Ext.define('Ext.grid.plugin.CellEditing', {
getEditor: function(record, column) {
var me = this,
editors = me.editors,
- editorId = column.itemId || column.id,
+ editorId = column.getItemId(),
editor = editors.getByKey(editorId);
if (editor) {
@@ -79842,7 +80597,7 @@ Ext.define('Ext.grid.plugin.CellEditing', {
me.context.record.set(dataIndex, value);
} else {
- grid.getView().el.focus();
+ grid.getView().getEl(activeColumn).focus();
}
me.context.value = value;
me.fireEvent('edit', me, me.context);
@@ -79855,7 +80610,7 @@ Ext.define('Ext.grid.plugin.CellEditing', {
cancelEdit: function() {
var me = this,
activeEd = me.getActiveEditor(),
- viewEl = me.grid.getView().el;
+ viewEl = me.grid.getView().getEl(me.getActiveColumn());
me.setActiveEditor(null);
me.setActiveColumn(null);
@@ -80068,7 +80823,7 @@ Ext.define('Ext.grid.plugin.HeaderResizer', {
resizeHeader = resizeHeader[resizeHeader.length - 1];
}
- if (resizeHeader && !resizeHeader.fixed) {
+ if (resizeHeader && !(resizeHeader.fixed || this.disabled)) {
this.activeHd = resizeHeader;
overHeader.el.dom.style.cursor = this.eResizeCursor;
}
@@ -80474,7 +81229,7 @@ Ext.define('Ext.grid.plugin.RowEditing', {
Ext.define('Ext.grid.property.Grid', {
extend: 'Ext.grid.Panel',
-
+
alias: 'widget.propertygrid',
alternateClassName: 'Ext.grid.PropertyGrid',
@@ -80507,6 +81262,8 @@ Ext.define('Ext.grid.property.Grid', {
nameField: 'name',
+
+
enableColumnMove: false,
columnLines: true,
stripeRows: false,
@@ -80528,7 +81285,7 @@ Ext.define('Ext.grid.property.Grid', {
startEdit: function(record, column) {
- Ext.grid.plugin.CellEditing.prototype.startEdit.call(this, record, me.headerCt.child('#' + me.valueField));
+ return this.self.prototype.startEdit.call(this, record, me.headerCt.child('#' + me.valueField));
}
}));
@@ -80537,8 +81294,8 @@ Ext.define('Ext.grid.property.Grid', {
onCellSelect: function(position) {
if (position.column != 1) {
position.column = 1;
- Ext.selection.CellModel.prototype.onCellSelect.call(this, position);
}
+ return this.self.prototype.onCellSelect.call(this, position);
}
};
me.customRenderers = me.customRenderers || {};
@@ -80575,7 +81332,7 @@ Ext.define('Ext.grid.property.Grid', {
};
- this.store.on('update', me.onUpdate, me);
+ me.store.on('update', me.onUpdate, me);
},
@@ -80616,7 +81373,7 @@ Ext.define('Ext.grid.property.Grid', {
getCellEditor : function(record, column) {
var me = this,
- propName = record.get(me.nameField),
+ propName = record.get(me.nameField),
val = record.get(me.valueField),
editor = me.customEditors[propName];
@@ -80692,6 +81449,8 @@ Ext.define('Ext.grid.property.HeaderContainer', {
extend: 'Ext.grid.header.Container',
alternateClassName: 'Ext.grid.PropertyColumnModel',
+
+ nameWidth: 115,
nameText : 'Name',
@@ -80702,27 +81461,27 @@ Ext.define('Ext.grid.property.HeaderContainer', {
nameColumnCls: Ext.baseCSSPrefix + 'grid-property-name',
+
constructor : function(grid, store) {
-
- this.grid = grid;
- this.store = store;
- this.callParent([{
+ var me = this;
+
+ me.grid = grid;
+ me.store = store;
+ me.callParent([{
items: [{
- header: this.nameText,
- width: 115,
+ header: me.nameText,
+ width: grid.nameColumnWidth || me.nameWidth,
sortable: true,
dataIndex: grid.nameField,
- renderer: Ext.Function.bind(this.renderProp, this),
+ renderer: Ext.Function.bind(me.renderProp, me),
itemId: grid.nameField,
menuDisabled :true,
- tdCls: this.nameColumnCls
+ tdCls: me.nameColumnCls
}, {
- header: this.valueText,
- renderer: Ext.Function.bind(this.renderCell, this),
- getEditor: function(record) {
- return grid.getCellEditor(record, this);
- },
+ header: me.valueText,
+ renderer: Ext.Function.bind(me.renderCell, me),
+ getEditor: Ext.Function.bind(me.getCellEditor, me),
flex: 1,
fixed: true,
dataIndex: grid.valueField,
@@ -80731,6 +81490,10 @@ Ext.define('Ext.grid.property.HeaderContainer', {
}]
}]);
},
+
+ getCellEditor: function(record){
+ return this.grid.getCellEditor(record, this);
+ },
@@ -80742,16 +81505,16 @@ Ext.define('Ext.grid.property.HeaderContainer', {
renderCell : function(val, meta, rec) {
var me = this,
- renderer = this.grid.customRenderers[rec.get(me.grid.nameField)],
+ renderer = me.grid.customRenderers[rec.get(me.grid.nameField)],
result = val;
if (renderer) {
- return renderer.apply(this, arguments);
+ return renderer.apply(me, arguments);
}
if (Ext.isDate(val)) {
- result = this.renderDate(val);
+ result = me.renderDate(val);
} else if (Ext.isBoolean(val)) {
- result = this.renderBool(val);
+ result = me.renderBool(val);
}
return Ext.util.Format.htmlEncode(result);
},
@@ -80794,6 +81557,7 @@ Ext.define('Ext.grid.property.Store', {
uses: ['Ext.data.reader.Reader', 'Ext.data.proxy.Proxy', 'Ext.data.ResultSet', 'Ext.grid.property.Property'],
+
constructor : function(grid, source){
var me = this;
@@ -80891,7 +81655,7 @@ Ext.define('Ext.grid.property.Store', {
me.source[prop] = value;
rec = new Ext.grid.property.Property({name: prop, value: value}, prop);
- me.store.add(rec);
+ me.add(rec);
}
},
@@ -80899,7 +81663,7 @@ Ext.define('Ext.grid.property.Store', {
remove : function(prop) {
var rec = this.getRec(prop);
if (rec) {
- store.remove(rec);
+ this.callParent([rec]);
delete this.source[prop];
}
},
@@ -81118,7 +81882,7 @@ Ext.define('Ext.layout.container.Accordion', {
extend: 'Ext.layout.container.VBox',
alias: ['layout.accordion'],
alternateClassName: 'Ext.layout.AccordionLayout',
-
+
align: 'stretch',
@@ -81160,7 +81924,7 @@ Ext.define('Ext.layout.container.Accordion', {
me.callParent(arguments);
if (me.fill) {
- if (!me.owner.el.dom.style.height) {
+ if (!me.owner.el.dom.style.height || !me.getLayoutTargetSize().height) {
return false;
}
} else {
@@ -81199,7 +81963,6 @@ Ext.define('Ext.layout.container.Accordion', {
delete comp.hideHeader;
comp.collapsible = true;
comp.title = comp.title || '&#160;';
- comp.setBorder(false);
comp.width = targetSize.width;
@@ -81212,12 +81975,19 @@ Ext.define('Ext.layout.container.Accordion', {
comp.collapsed = true;
}
- else if (comp.collapsed === false) {
+ else if (comp.hasOwnProperty('collapsed') && comp.collapsed === false) {
comp.flex = 1;
me.expandedItem = i;
} else {
comp.collapsed = true;
}
+
+ me.owner.mon(comp, {
+ show: me.onComponentShow,
+ beforeexpand: me.onComponentExpand,
+ beforecollapse: me.onComponentCollapse,
+ scope: me
+ });
} else {
delete comp.flex;
comp.animCollapse = me.initialAnimate;
@@ -81236,10 +82006,10 @@ Ext.define('Ext.layout.container.Accordion', {
comp.flex = 1;
}
}
-
+
me.callParent(arguments);
-
+
ln = renderedPanels.length;
for (i = 0; i < ln; i++) {
@@ -81250,24 +82020,13 @@ Ext.define('Ext.layout.container.Accordion', {
comp.header.addCls(Ext.baseCSSPrefix + 'accordion-hd');
comp.body.addCls(Ext.baseCSSPrefix + 'accordion-body');
-
-
- if (me.fill) {
- me.owner.mon(comp, {
- show: me.onComponentShow,
- beforeexpand: me.onComponentExpand,
- beforecollapse: me.onComponentCollapse,
- scope: me
- });
- }
}
},
onLayout: function() {
var me = this;
-
- me.updatePanelClasses();
-
+
+
if (me.fill) {
me.callParent(arguments);
} else {
@@ -81285,24 +82044,27 @@ Ext.define('Ext.layout.container.Accordion', {
}
}
}
-
+ me.updatePanelClasses();
+
return me;
},
-
+
updatePanelClasses: function() {
var children = this.getLayoutItems(),
ln = children.length,
siblingCollapsed = true,
i, child;
-
+
for (i = 0; i < ln; i++) {
child = children[i];
- if (!siblingCollapsed) {
- child.header.addCls(Ext.baseCSSPrefix + 'accordion-hd-sibling-expanded');
+
+ if (siblingCollapsed) {
+ child.header.removeCls(Ext.baseCSSPrefix + 'accordion-hd-sibling-expanded');
}
else {
- child.header.removeCls(Ext.baseCSSPrefix + 'accordion-hd-sibling-expanded');
+ child.header.addCls(Ext.baseCSSPrefix + 'accordion-hd-sibling-expanded');
}
+
if (i + 1 == ln && child.collapsed) {
child.header.addCls(Ext.baseCSSPrefix + 'accordion-hd-last-collapsed');
}
@@ -81331,7 +82093,7 @@ Ext.define('Ext.layout.container.Accordion', {
me.setCollapsed(comp);
}
}
-
+
me.animate = me.initialAnimate;
me.layout();
me.animate = false;
@@ -81353,7 +82115,7 @@ Ext.define('Ext.layout.container.Accordion', {
if (expanded.length === 1 && expanded[0] === comp) {
me.setExpanded(toExpand);
}
-
+
me.animate = me.initialAnimate;
me.layout();
me.animate = false;
@@ -81437,7 +82199,7 @@ Ext.define('Ext.resizer.Splitter', {
],
baseCls: Ext.baseCSSPrefix + 'splitter',
- collapsedCls: Ext.baseCSSPrefix + 'splitter-collapsed',
+ collapsedClsInternal: Ext.baseCSSPrefix + 'splitter-collapsed',
collapsible: false,
@@ -81452,6 +82214,8 @@ Ext.define('Ext.resizer.Splitter', {
defaultSplitMax: 1000,
+
+
width: 5,
height: 5,
@@ -81525,15 +82289,17 @@ Ext.define('Ext.resizer.Splitter', {
},
getCollapseTarget: function() {
- return this.collapseTarget.isComponent ? this.collapseTarget : this.collapseTarget == 'prev' ? this.previousSibling() : this.nextSibling();
+ var me = this;
+
+ return me.collapseTarget.isComponent ? me.collapseTarget : me.collapseTarget == 'prev' ? me.previousSibling() : me.nextSibling();
},
onTargetCollapse: function(target) {
- this.el.addCls(this.collapsedCls);
+ this.el.addCls([this.collapsedClsInternal, this.collapsedCls]);
},
onTargetExpand: function(target) {
- this.el.removeCls(this.collapsedCls);
+ this.el.removeCls([this.collapsedClsInternal, this.collapsedCls]);
},
toggleTargetCmp: function(e, t) {
@@ -81574,8 +82340,6 @@ Ext.define('Ext.layout.container.Border', {
bindToOwnerCtContainer: true,
- fixedLayout: false,
-
percentageRe: /(\d+)%/,
slideDirection: {
@@ -81634,11 +82398,14 @@ Ext.define('Ext.layout.container.Border', {
},
renderItems: function(items, target) {
- Ext.Error.raise('This should not be called');
},
renderItem: function(item) {
- Ext.Error.raise('This should not be called');
+ },
+
+
+ getVisibleItems: function() {
+ return Ext.ComponentQuery.query(':not([slideOutAnim])', this.callParent(arguments));
},
initializeBorderLayout: function() {
@@ -81677,9 +82444,6 @@ Ext.define('Ext.layout.container.Border', {
me.setupState(comp);
}
}
- if (!regions.center) {
- Ext.Error.raise("You must specify a center region when defining a BorderLayout.");
- }
comp = regions.center;
if (!comp.flex) {
comp.flex = 1;
@@ -81729,7 +82493,8 @@ Ext.define('Ext.layout.container.Border', {
maintainFlex: true,
layout: {
type: 'hbox',
- align: 'stretch'
+ align: 'stretch',
+ getVisibleItems: me.getVisibleItems
}
}));
hBoxItems.push(regions.center);
@@ -81783,7 +82548,8 @@ Ext.define('Ext.layout.container.Border', {
el: me.getTarget(),
layout: Ext.applyIf({
type: 'vbox',
- align: 'stretch'
+ align: 'stretch',
+ getVisibleItems: me.getVisibleItems
}, me.initialConfig)
});
me.createItems(me.shadowContainer, vBoxItems);
@@ -81927,6 +82693,7 @@ Ext.define('Ext.layout.container.Border', {
if (comp.collapseMode == 'mini') {
comp.placeholder = resizer;
+ resizer.collapsedCls = comp.collapsedCls;
}
@@ -82020,7 +82787,7 @@ Ext.define('Ext.layout.container.Border', {
baseCls: comp.baseCls + '-header',
ui: comp.ui,
indicateDrag: comp.draggable,
- cls: Ext.baseCSSPrefix + 'region-collapsed-placeholder ' + Ext.baseCSSPrefix + 'region-collapsed-' + comp.collapseDirection + '-placeholder',
+ cls: Ext.baseCSSPrefix + 'region-collapsed-placeholder ' + Ext.baseCSSPrefix + 'region-collapsed-' + comp.collapseDirection + '-placeholder ' + comp.collapsedCls,
listeners: comp.floatable ? {
click: {
fn: function(e) {
@@ -82517,15 +83284,13 @@ Ext.define('Ext.layout.container.Card', {
+
setActiveItem: function(newCard) {
var me = this,
owner = me.owner,
oldCard = me.activeItem,
newIndex;
-
- me.layoutBusy = true;
-
newCard = me.parseActiveItem(newCard);
newIndex = owner.items.indexOf(newCard);
@@ -82547,22 +83312,22 @@ Ext.define('Ext.layout.container.Card', {
if (newCard.fireEvent('beforeactivate', newCard, oldCard) === false) {
- me.layoutBusy = false;
return false;
}
if (oldCard && oldCard.fireEvent('beforedeactivate', oldCard, newCard) === false) {
- me.layoutBusy = false;
return false;
}
- if (!me.sizeAllCards) {
- me.setItemBox(newCard, me.getTargetBox());
- }
- else {
+ if (me.sizeAllCards) {
me.onLayout();
}
+ else {
+ me.setItemBox(newCard, me.getTargetBox());
+ }
+
+ me.owner.suspendLayout = true;
if (oldCard) {
if (me.hideInactive) {
@@ -82572,26 +83337,29 @@ Ext.define('Ext.layout.container.Card', {
}
+ me.owner.suspendLayout = false;
if (newCard.hidden) {
newCard.show();
+ } else {
+ me.onLayout();
}
newCard.fireEvent('activate', newCard, oldCard);
- me.layoutBusy = false;
-
- if (!me.sizeAllCards) {
- if (!owner.componentLayout.layoutBusy) {
- me.onLayout();
- }
- }
return newCard;
}
-
- me.layoutBusy = false;
return false;
- }
-});
+ },
+
+ configureItem: function(item) {
+
+
+
+ item.layoutManagedHeight = 0;
+ item.layoutManagedWidth = 0;
+
+ this.callParent(arguments);
+ }});
Ext.define('Ext.layout.container.Column', {
@@ -82708,6 +83476,16 @@ Ext.define('Ext.layout.container.Column', {
}
}
delete me.adjustmentPass;
+ },
+
+ configureItem: function(item) {
+ if (item.columnWidth) {
+ item.layoutManagedWidth = 1;
+ } else {
+ item.layoutManagedWidth = 2;
+ }
+ item.layoutManagedHeight = 2;
+ this.callParent(arguments);
}
});
@@ -82743,6 +83521,10 @@ Ext.define('Ext.layout.container.Table', {
tableAttrs:null,
+
+
+
+
renderItems: function(items) {
var tbody = this.getTable().tBodies[0],
rows = tbody.rows,
@@ -82766,6 +83548,9 @@ Ext.define('Ext.layout.container.Table', {
trEl = rows[rowIdx];
if (!trEl) {
trEl = tbody.insertRow(rowIdx);
+ if (this.trAttrs) {
+ trEl.set(this.trAttrs);
+ }
}
@@ -82784,6 +83569,9 @@ Ext.define('Ext.layout.container.Table', {
}
+ if (this.tdAttrs) {
+ tdEl.set(this.tdAttrs);
+ }
tdEl.set({
colSpan: item.colspan || 1,
rowSpan: item.rowspan || 1,
@@ -82859,9 +83647,11 @@ Ext.define('Ext.layout.container.Table', {
});
- rowspans[colIdx] = item.rowspan || 1;
- colIdx += item.colspan || 1;
- cellIdx++;
+ for (j = item.colspan || 1; j; --j) {
+ rowspans[colIdx] = item.rowspan || 1;
+ ++colIdx;
+ }
+ ++cellIdx;
}
return cells;
@@ -82895,53 +83685,53 @@ Ext.define('Ext.menu.Item', {
extend: 'Ext.Component',
alias: 'widget.menuitem',
alternateClassName: 'Ext.menu.TextItem',
-
+
activeCls: Ext.baseCSSPrefix + 'menu-item-active',
-
+
ariaRole: 'menuitem',
-
+
canActivate: true,
-
+
clickHideDelay: 1,
-
+
destroyMenu: true,
-
+
disabledCls: Ext.baseCSSPrefix + 'menu-item-disabled',
+
-
-
+
-
+
hideOnClick: true,
+
+
-
-
-
+
isMenuItem: true,
+
-
-
+
menuAlign: 'tl-tr?',
-
+
menuExpandDelay: 200,
-
+
menuHideDelay: 200,
+
-
-
+
renderTpl: [
'<tpl if="plain">',
'{text}',
@@ -82956,14 +83746,14 @@ Ext.define('Ext.menu.Item', {
'</a>',
'</tpl>'
],
-
+
maskOnDisable: false,
+
-
-
+
activate: function() {
var me = this;
-
+
if (!me.activated && me.canActivate && me.rendered && !me.isDisabled() && me.isVisible()) {
me.el.addCls(me.activeCls);
me.focus();
@@ -82971,15 +83761,15 @@ Ext.define('Ext.menu.Item', {
me.fireEvent('activate', me);
}
},
-
+
blur: function() {
this.$focused = false;
this.callParent(arguments);
},
-
+
deactivate: function() {
var me = this;
-
+
if (me.activated) {
me.el.removeCls(me.activeCls);
me.blur();
@@ -82988,10 +83778,10 @@ Ext.define('Ext.menu.Item', {
me.fireEvent('deactivate', me);
}
},
-
+
deferExpandMenu: function() {
var me = this;
-
+
if (!me.menu.rendered || !me.menu.isVisible()) {
me.parentMenu.activeChild = me.menu;
me.menu.parentItem = me;
@@ -82999,20 +83789,20 @@ Ext.define('Ext.menu.Item', {
me.menu.showBy(me, me.menuAlign);
}
},
-
+
deferHideMenu: function() {
if (this.menu.isVisible()) {
this.menu.hide();
}
},
-
+
deferHideParentMenus: function() {
Ext.menu.Manager.hideAll();
},
-
+
expandMenu: function(delay) {
var me = this;
-
+
if (me.menu) {
clearTimeout(me.hideMenuTimer);
if (delay === 0) {
@@ -83022,95 +83812,95 @@ Ext.define('Ext.menu.Item', {
}
}
},
-
+
focus: function() {
this.$focused = true;
this.callParent(arguments);
},
-
+
getRefItems: function(deep){
var menu = this.menu,
items;
-
+
if (menu) {
items = menu.getRefItems(deep);
items.unshift(menu);
- }
- return items || [];
+ }
+ return items || [];
},
-
+
hideMenu: function(delay) {
var me = this;
-
+
if (me.menu) {
clearTimeout(me.expandMenuTimer);
me.hideMenuTimer = Ext.defer(me.deferHideMenu, Ext.isNumber(delay) ? delay : me.menuHideDelay, me);
}
},
-
+
initComponent: function() {
var me = this,
prefix = Ext.baseCSSPrefix,
cls = [prefix + 'menu-item'];
-
+
me.addEvents(
'activate',
-
+
'click',
-
+
'deactivate'
);
-
+
if (me.plain) {
cls.push(prefix + 'menu-item-plain');
}
-
+
if (me.cls) {
cls.push(me.cls);
}
-
+
me.cls = cls.join(' ');
-
+
if (me.menu) {
me.menu = Ext.menu.Manager.get(me.menu);
}
-
+
me.callParent(arguments);
},
-
+
onClick: function(e) {
var me = this;
-
+
if (!me.href) {
e.stopEvent();
}
-
+
if (me.disabled) {
return;
}
-
+
if (me.hideOnClick) {
me.deferHideParentMenusTimer = Ext.defer(me.deferHideParentMenus, me.clickHideDelay, me);
}
-
+
Ext.callback(me.handler, me.scope || me, [me, e]);
me.fireEvent('click', me, e);
-
+
if (!me.hideOnClick) {
me.focus();
}
},
-
+
onDestroy: function() {
var me = this;
-
+
clearTimeout(me.expandMenuTimer);
clearTimeout(me.hideMenuTimer);
clearTimeout(me.deferHideParentMenusTimer);
-
+
if (me.menu) {
delete me.menu.parentItem;
delete me.menu.parentMenu;
@@ -83121,80 +83911,70 @@ Ext.define('Ext.menu.Item', {
}
me.callParent(arguments);
},
-
+
onRender: function(ct, pos) {
var me = this,
prefix = '.' + Ext.baseCSSPrefix;
-
+
Ext.applyIf(me.renderData, {
href: me.href || '#',
hrefTarget: me.hrefTarget,
icon: me.icon || Ext.BLANK_IMAGE_URL,
- iconCls: me.iconCls,
+ iconCls: me.iconCls + (me.checkChangeDisabled ? ' ' + me.disabledCls : ''),
menu: Ext.isDefined(me.menu),
plain: me.plain,
text: me.text
});
-
+
Ext.applyIf(me.renderSelectors, {
itemEl: prefix + 'menu-item-link',
iconEl: prefix + 'menu-item-icon',
textEl: prefix + 'menu-item-text',
arrowEl: prefix + 'menu-item-arrow'
});
-
+
me.callParent(arguments);
},
-
+
setHandler: function(fn, scope) {
this.handler = fn || null;
this.scope = scope;
},
-
+
setIconCls: function(iconCls) {
var me = this;
-
+
if (me.iconEl) {
if (me.iconCls) {
me.iconEl.removeCls(me.iconCls);
}
-
+
if (iconCls) {
me.iconEl.addCls(iconCls);
}
}
-
+
me.iconCls = iconCls;
},
-
+
setText: function(text) {
var me = this,
- el = me.textEl || me.el,
- newWidth;
-
- if (text && el) {
- el.update(text);
-
- if (me.textEl) {
-
- newWidth = me.textEl.getWidth() + me.iconEl.getWidth() + 25 + (me.arrowEl ? me.arrowEl.getWidth() : 0);
- if (newWidth > me.itemEl.getWidth()) {
- me.parentMenu.setWidth(newWidth);
- }
- }
- } else if (el) {
- el.update('');
- }
-
+ el = me.textEl || me.el;
+
me.text = text;
+
+ if (me.rendered) {
+ el.update(text || '');
+
+ me.ownerCt.redoComponentLayout();
+ }
}
});
-
Ext.define('Ext.menu.CheckItem', {
extend: 'Ext.menu.Item',
alias: 'widget.menucheckitem',
@@ -83244,7 +84024,9 @@ Ext.define('Ext.menu.CheckItem', {
disableCheckChange: function() {
var me = this;
- me.iconEl.addCls(me.disabledCls);
+ if (me.iconEl) {
+ me.iconEl.addCls(me.disabledCls);
+ }
me.checkChangeDisabled = true;
},
@@ -83501,11 +84283,13 @@ Ext.define('Ext.menu.Menu', {
floating: true,
- constrain: false,
+ constrain: true,
hidden: true,
+ hideMode: 'visibility',
+
ignoreParentClicks: false,
@@ -83675,6 +84459,47 @@ Ext.define('Ext.menu.Menu', {
}
},
+ clearStretch: function () {
+
+
+ if (this.rendered) {
+ this.items.each(function (item) {
+
+ if (item.componentLayout) {
+ delete item.componentLayout.lastComponentSize;
+ }
+ if (item.el) {
+ item.el.setWidth(null);
+ }
+ });
+ }
+ },
+
+ onAdd: function () {
+ var me = this;
+
+ me.clearStretch();
+ me.callParent(arguments);
+
+ if (Ext.isIE6 || Ext.isIE7) {
+
+ Ext.Function.defer(me.doComponentLayout, 10, me);
+ }
+ },
+
+ onRemove: function () {
+ this.clearStretch();
+ this.callParent(arguments);
+
+ },
+
+ redoComponentLayout: function () {
+ if (this.rendered) {
+ this.clearStretch();
+ this.doComponentLayout();
+ }
+ },
+
getFocusEl: function() {
return this.focusEl;
@@ -83870,7 +84695,9 @@ Ext.define('Ext.menu.Menu', {
if (me.floating && cmp) {
me.layout.autoSize = true;
- me.show();
+
+
+ me.doAutoRender();
cmp = cmp.el || cmp;
@@ -83935,7 +84762,7 @@ Ext.define('Ext.menu.Menu', {
me.iconSepEl.setHeight(me.layout.getRenderTarget().dom.scrollHeight);
}
}
- vector = me.getConstrainVector();
+ vector = me.getConstrainVector(me.el.dom.parentNode);
if (vector) {
me.setPosition(me.getPosition()[0] + vector[0]);
}
@@ -84026,6 +84853,8 @@ Ext.define('Ext.menu.Menu', {
Ext.apply(me, {
showSeparator: false,
plain: true,
+ border: false,
+ bodyPadding: 0,
items: Ext.applyIf({
cls: Ext.baseCSSPrefix + 'menu-date-item',
id: me.pickerId,
@@ -84079,37 +84908,6 @@ Ext.define('Ext.panel.Tool', {
'click'
);
- var types = [
- 'close',
- 'collapse',
- 'down',
- 'expand',
- 'gear',
- 'help',
- 'left',
- 'maximize',
- 'minimize',
- 'minus',
- 'move',
- 'next',
- 'pin',
- 'plus',
- 'prev',
- 'print',
- 'refresh',
- 'resize',
- 'restore',
- 'right',
- 'save',
- 'search',
- 'toggle',
- 'unpin',
- 'up'
- ];
-
- if (me.id && Ext.Array.indexOf(types, me.id) > -1 && Ext.global.console) {
- Ext.global.console.warn('When specifying a tool you should use the type option, the id can conflict now that tool is a Component');
- }
me.type = me.type || me.id;
@@ -84263,6 +85061,12 @@ Ext.define('Ext.resizer.Resizer', {
width : null,
+ heightIncrement : 0,
+
+
+ widthIncrement : 0,
+
+
minHeight : 20,
@@ -84397,6 +85201,8 @@ Ext.define('Ext.resizer.Resizer', {
delegate: '.' + me.handleCls,
dynamic: me.dynamic,
preserveRatio: me.preserveRatio,
+ heightIncrement: me.heightIncrement,
+ widthIncrement: me.widthIncrement,
minHeight: me.minHeight,
maxHeight: me.maxHeight,
minWidth: me.minWidth,
@@ -84516,11 +85322,11 @@ Ext.define('Ext.resizer.Resizer', {
var me = this,
handle;
if (Ext.isIE6) {
- handle = me.east;
+ handle = me.east;
if (handle) {
handle.setHeight(me.el.getHeight());
}
- handle = me.west;
+ handle = me.west;
if (handle) {
handle.setHeight(me.el.getHeight());
}
@@ -84628,6 +85434,8 @@ Ext.define('Ext.resizer.ResizeTracker', {
ratio,
widthAdjust = 0,
heightAdjust = 0,
+ snappedWidth,
+ snappedHeight,
adjustX = 0,
adjustY = 0,
dragRatio,
@@ -84693,15 +85501,48 @@ Ext.define('Ext.resizer.ResizeTracker', {
};
+ snappedWidth = Ext.Number.snap(newBox.width, me.widthIncrement);
+ snappedHeight = Ext.Number.snap(newBox.height, me.heightIncrement);
+ if (snappedWidth != newBox.width || snappedHeight != newBox.height){
+ switch (region) {
+ case 'northeast':
+ newBox.y -= snappedHeight - newBox.height;
+ break;
+ case 'north':
+ newBox.y -= snappedHeight - newBox.height;
+ break;
+ case 'southwest':
+ newBox.x -= snappedWidth - newBox.width;
+ break;
+ case 'west':
+ newBox.x -= snappedWidth - newBox.width;
+ break;
+ case 'northwest':
+ newBox.x -= snappedWidth - newBox.width;
+ newBox.y -= snappedHeight - newBox.height;
+ }
+ newBox.width = snappedWidth;
+ newBox.height = snappedHeight;
+ }
+
+
if (newBox.width < me.minWidth || newBox.width > me.maxWidth) {
newBox.width = Ext.Number.constrain(newBox.width, me.minWidth, me.maxWidth);
- newBox.x = me.lastX || newBox.x;
+
+
+ if (adjustX) {
+ newBox.x = box.x + (box.width - newBox.width);
+ }
} else {
me.lastX = newBox.x;
}
if (newBox.height < me.minHeight || newBox.height > me.maxHeight) {
newBox.height = Ext.Number.constrain(newBox.height, me.minHeight, me.maxHeight);
- newBox.y = me.lastY || newBox.y;
+
+
+ if (adjustY) {
+ newBox.y = box.y + (box.height - newBox.height);
+ }
} else {
me.lastY = newBox.y;
}
@@ -84815,13 +85656,28 @@ Ext.define('Ext.resizer.SplitterTracker', {
onBeforeStart: function(e) {
var me = this,
prevCmp = me.getPrevCmp(),
- nextCmp = me.getNextCmp();
+ nextCmp = me.getNextCmp(),
+ collapseEl = me.getSplitter().collapseEl,
+ overlay;
+
+ if (collapseEl && (e.getTarget() === me.getSplitter().collapseEl.dom)) {
+ return false;
+ }
if (nextCmp.collapsed || prevCmp.collapsed) {
return false;
}
+ overlay = me.overlay = Ext.getBody().createChild({
+ cls: me.overlayCls,
+ html: '&#160;'
+ });
+ overlay.unselectable();
+ overlay.setSize(Ext.core.Element.getViewWidth(true), Ext.core.Element.getViewHeight(true));
+ overlay.show();
+
+
me.prevBox = prevCmp.getEl().getBox();
me.nextBox = nextCmp.getEl().getBox();
me.constrainTo = me.calculateConstrainRegion();
@@ -84829,17 +85685,8 @@ Ext.define('Ext.resizer.SplitterTracker', {
onStart: function(e) {
- var splitter = this.getSplitter(),
- overlay;
-
+ var splitter = this.getSplitter();
splitter.addCls(splitter.baseCls + '-active');
- overlay = this.overlay = Ext.getBody().createChild({
- cls: this.overlayCls,
- html: '&#160;'
- });
- overlay.unselectable();
- overlay.setSize(Ext.core.Element.getViewWidth(true), Ext.core.Element.getViewHeight(true));
- overlay.show();
},
@@ -84952,15 +85799,25 @@ Ext.define('Ext.resizer.SplitterTracker', {
},
+
+
+ endDrag: function () {
+ var me = this;
+
+ if (me.overlay) {
+ me.overlay.remove();
+ delete me.overlay;
+ }
+
+ me.callParent(arguments);
+ },
+
+
onEnd: function(e) {
var me = this,
splitter = me.getSplitter();
splitter.removeCls(splitter.baseCls + '-active');
- if (me.overlay) {
- me.overlay.remove();
- delete me.overlay;
- }
me.performResize();
},
@@ -85177,27 +86034,33 @@ Ext.define('Ext.selection.RowModel', {
extend: 'Ext.selection.Model',
alias: 'selection.rowmodel',
requires: ['Ext.util.KeyNav'],
-
+
deltaScroll: 5,
-
+
enableKeyNav: true,
-
+
constructor: function(){
this.addEvents(
- 'deselect',
+ 'beforedeselect',
+
+
+ 'beforeselect',
+
+ 'deselect',
+
'select'
);
- this.callParent(arguments);
+ this.callParent(arguments);
},
bindComponent: function(view) {
var me = this;
-
+
me.views = me.views || [];
me.views.push(view);
me.bind(view.getStore(), true);
@@ -85214,7 +86077,7 @@ Ext.define('Ext.selection.RowModel', {
initKeyNav: function(view) {
var me = this;
-
+
if (!view.rendered) {
view.on('render', Ext.Function.bind(me.initKeyNav, me, [view], 0), me, {single: true});
return;
@@ -85262,7 +86125,7 @@ Ext.define('Ext.selection.RowModel', {
onKeyEnd: function(e, t) {
var me = this,
last = me.store.getAt(me.store.getCount() - 1);
-
+
if (last) {
if (e.shiftKey) {
me.selectRange(last, me.lastFocused || 0);
@@ -85279,7 +86142,7 @@ Ext.define('Ext.selection.RowModel', {
onKeyHome: function(e, t) {
var me = this,
first = me.store.getAt(0);
-
+
if (first) {
if (e.shiftKey) {
me.selectRange(first, me.lastFocused || 0);
@@ -85300,7 +86163,7 @@ Ext.define('Ext.selection.RowModel', {
prevIdx,
prevRecord,
currRec;
-
+
if (rowsVisible) {
selIdx = me.lastFocused ? me.store.indexOf(me.lastFocused) : 0;
prevIdx = selIdx - rowsVisible;
@@ -85330,7 +86193,7 @@ Ext.define('Ext.selection.RowModel', {
nextIdx,
nextRecord,
currRec;
-
+
if (rowsVisible) {
selIdx = me.lastFocused ? me.store.indexOf(me.lastFocused) : 0;
nextIdx = selIdx + rowsVisible;
@@ -85360,7 +86223,7 @@ Ext.define('Ext.selection.RowModel', {
e.stopEvent();
var me = this,
record = me.lastFocused;
-
+
if (record) {
if (me.isSelected(record)) {
me.doDeselect(record, false);
@@ -85379,7 +86242,7 @@ Ext.define('Ext.selection.RowModel', {
view = me.views[0],
idx = me.store.indexOf(me.lastFocused),
record;
-
+
if (idx > 0) {
@@ -85418,7 +86281,7 @@ Ext.define('Ext.selection.RowModel', {
view = me.views[0],
idx = me.store.indexOf(me.lastFocused),
record;
-
+
if (idx + 1 < me.store.getCount()) {
@@ -85444,21 +86307,21 @@ Ext.define('Ext.selection.RowModel', {
}
}
},
-
+
scrollByDeltaX: function(delta) {
var view = this.views[0],
section = view.up(),
hScroll = section.horizontalScroller;
-
+
if (hScroll) {
hScroll.scrollByDeltaX(delta);
}
},
-
+
onKeyLeft: function(e, t) {
this.scrollByDeltaX(-this.deltaScroll);
},
-
+
onKeyRight: function(e, t) {
this.scrollByDeltaX(this.deltaScroll);
},
@@ -85472,26 +86335,29 @@ Ext.define('Ext.selection.RowModel', {
- onSelectChange: function(record, isSelected, suppressEvent) {
+ onSelectChange: function(record, isSelected, suppressEvent, commitFn) {
var me = this,
views = me.views,
viewsLn = views.length,
store = me.store,
rowIdx = store.indexOf(record),
+ eventName = isSelected ? 'select' : 'deselect',
i = 0;
-
- for (; i < viewsLn; i++) {
- if (isSelected) {
- views[i].onRowSelect(rowIdx, suppressEvent);
- if (!suppressEvent) {
- me.fireEvent('select', me, record, rowIdx);
- }
- } else {
- views[i].onRowDeselect(rowIdx, suppressEvent);
- if (!suppressEvent) {
- me.fireEvent('deselect', me, record, rowIdx);
+
+ if ((suppressEvent || me.fireEvent('before' + eventName, me, record, rowIdx)) !== false &&
+ commitFn() !== false) {
+
+ for (; i < viewsLn; i++) {
+ if (isSelected) {
+ views[i].onRowSelect(rowIdx, suppressEvent);
+ } else {
+ views[i].onRowDeselect(rowIdx, suppressEvent);
}
}
+
+ if (!suppressEvent) {
+ me.fireEvent(eventName, me, record, rowIdx);
+ }
}
},
@@ -85503,7 +86369,7 @@ Ext.define('Ext.selection.RowModel', {
store = this.store,
rowIdx,
i = 0;
-
+
if (oldFocused) {
rowIdx = store.indexOf(oldFocused);
if (rowIdx != -1) {
@@ -85522,7 +86388,7 @@ Ext.define('Ext.selection.RowModel', {
}
}
},
-
+
onEditorTab: function(editingPlugin, e) {
var me = this,
view = me.views[0],
@@ -85531,12 +86397,12 @@ Ext.define('Ext.selection.RowModel', {
position = view.getPosition(record, header),
direction = e.shiftKey ? 'left' : 'right',
newPosition = view.walkCells(position, direction, e, this.preventWrap);
-
+
if (newPosition) {
editingPlugin.startEditByPosition(newPosition);
}
},
-
+
selectByPosition: function(position) {
var record = this.store.getAt(position.row);
this.select(record);
@@ -85655,8 +86521,9 @@ Ext.define('Ext.selection.CheckboxModel', {
},
- onSelectChange: function(record, isSelected) {
- this.callParent([record, isSelected]);
+ onSelectChange: function() {
+ this.callParent(arguments);
+
var hdSelectStatus = this.selected.getCount() === this.store.getCount();
this.toggleUiHeader(hdSelectStatus);
@@ -85743,6 +86610,7 @@ Ext.define('Ext.slider.Thumb', {
topZIndex: 10000,
+
constructor: function(config) {
var me = this;
@@ -86062,7 +86930,7 @@ Ext.define('Ext.slider.Multi', {
var me = this,
tipPlug,
hasTip;
-
+
me.thumbs = [];
@@ -86134,7 +87002,7 @@ Ext.define('Ext.slider.Multi', {
var thumbs = this.thumbs,
ln = thumbs.length,
zIndex, thumb, i;
-
+
for (i = 0; i < ln; i++) {
thumb = thumbs[i];
@@ -86188,7 +87056,7 @@ Ext.define('Ext.slider.Multi', {
initEvents : function() {
var me = this;
-
+
me.mon(me.el, {
scope : me,
mousedown: me.onMouseDown,
@@ -86207,7 +87075,7 @@ Ext.define('Ext.slider.Multi', {
thumbs = me.thumbs,
len = thumbs.length,
local;
-
+
if (me.disabled) {
return;
}
@@ -86228,7 +87096,7 @@ Ext.define('Ext.slider.Multi', {
onClickChange : function(local) {
var me = this,
thumb, index;
-
+
if (local.top > me.clickRange[0] && local.top < me.clickRange[1]) {
thumb = me.getNearest(local, 'left');
@@ -86274,13 +87142,13 @@ Ext.define('Ext.slider.Multi', {
var me = this,
k,
val;
-
+
if(me.disabled || me.thumbs.length !== 1) {
e.preventDefault();
return;
}
k = e.getKey();
-
+
switch(k) {
case e.UP:
case e.RIGHT:
@@ -86300,27 +87168,6 @@ Ext.define('Ext.slider.Multi', {
},
- doSnap : function(value) {
- var newValue = value,
- inc = this.increment,
- m;
-
- if (!(inc && value)) {
- return value;
- }
- m = value % inc;
- if (m !== 0) {
- newValue -= m;
- if (m * 2 >= inc) {
- newValue += inc;
- } else if (m * 2 < -inc) {
- newValue -= inc;
- }
- }
- return Ext.Number.constrain(newValue, this.minValue, this.maxValue);
- },
-
-
afterRender : function() {
var me = this,
i = 0,
@@ -86328,7 +87175,7 @@ Ext.define('Ext.slider.Multi', {
len = thumbs.length,
thumb,
v;
-
+
me.callParent(arguments);
for (; i < len; i++) {
@@ -86356,8 +87203,8 @@ Ext.define('Ext.slider.Multi', {
normalizeValue : function(v) {
var me = this;
-
- v = me.doSnap(v);
+
+ v = Ext.Number.snap(v, this.increment, this.minValue, this.maxValue);
v = Ext.util.Format.round(v, me.decimalPrecision);
v = Ext.Number.constrain(v, me.minValue, me.maxValue);
return v;
@@ -86370,7 +87217,7 @@ Ext.define('Ext.slider.Multi', {
thumbs = me.thumbs,
len = thumbs.length,
t;
-
+
me.minValue = val;
me.inputEl.dom.setAttribute('aria-valuemin', val);
@@ -86388,7 +87235,7 @@ Ext.define('Ext.slider.Multi', {
thumbs = me.thumbs,
len = thumbs.length,
t;
-
+
me.maxValue = val;
me.inputEl.dom.setAttribute('aria-valuemax', val);
@@ -86453,7 +87300,7 @@ Ext.define('Ext.slider.Multi', {
thumb,
el,
xy;
-
+
me.callParent();
for (; i < len; i++) {
@@ -86487,7 +87334,7 @@ Ext.define('Ext.slider.Multi', {
len = thumbs.length,
thumb,
el;
-
+
this.callParent();
for (; i < len; i++) {
@@ -86560,7 +87407,7 @@ Ext.define('Ext.slider.Multi', {
beforeDestroy : function() {
var me = this;
-
+
Ext.destroyMembers(me.innerEl, me.endEl, me.focusEl);
Ext.each(me.thumbs, function(thumb) {
Ext.destroy(thumb);
@@ -86795,7 +87642,7 @@ Ext.define('Ext.tab.Tab', {
tag: 'a',
cls: me.baseCls + '-close-btn',
href: '#',
- html: me.closeText,
+
title: me.closeText
}).on('click', Ext.EventManager.preventDefault);
}
@@ -87189,16 +88036,22 @@ Ext.define('Ext.tab.Panel', {
onAdd: function(item, index) {
- var me = this;
-
- item.tab = me.tabBar.insert(index, {
- xtype: 'tab',
- card: item,
- disabled: item.disabled,
- closable: item.closable,
- hidden: item.hidden,
- tabBar: me.tabBar
- });
+ var me = this,
+ cfg = item.tabConfig || {},
+ defaultConfig = {
+ xtype: 'tab',
+ card: item,
+ disabled: item.disabled,
+ closable: item.closable,
+ hidden: item.hidden,
+ tabBar: me.tabBar
+ };
+
+ if (item.closeText) {
+ defaultConfig.closeText = item.closeText;
+ }
+ cfg = Ext.applyIf(cfg, defaultConfig);
+ item.tab = me.tabBar.insert(index, cfg);
item.on({
scope : me,
@@ -87344,17 +88197,17 @@ Ext.define('Ext.tree.Column', {
}
}
if (record.isLast()) {
- if (record.isLeaf() || (record.isLoaded() && !record.hasChildNodes())) {
- buf.unshift(format(imgText, (elbowPrefix + 'end'), Ext.BLANK_IMAGE_URL));
- } else {
+ if (record.isExpandable()) {
buf.unshift(format(imgText, (elbowPrefix + 'end-plus ' + expanderCls), Ext.BLANK_IMAGE_URL));
+ } else {
+ buf.unshift(format(imgText, (elbowPrefix + 'end'), Ext.BLANK_IMAGE_URL));
}
} else {
- if (record.isLeaf() || (record.isLoaded() && !record.hasChildNodes())) {
- buf.unshift(format(imgText, (treePrefix + 'elbow'), Ext.BLANK_IMAGE_URL));
- } else {
+ if (record.isExpandable()) {
buf.unshift(format(imgText, (elbowPrefix + 'plus ' + expanderCls), Ext.BLANK_IMAGE_URL));
+ } else {
+ buf.unshift(format(imgText, (treePrefix + 'elbow'), Ext.BLANK_IMAGE_URL));
}
}
} else {
@@ -87586,14 +88439,9 @@ Ext.define('Ext.tree.View', {
Ext.fly(children[relativeIndex + 1]).insertSibling(nodes, 'before', true);
}
+
-
- if (index < a.length) {
- a.splice.apply(a, [index, 0].concat(nodes));
- }
- else {
- a.push.apply(a, nodes);
- }
+ Ext.Array.insert(a, index, nodes);
@@ -87855,7 +88703,9 @@ Ext.define('Ext.tree.Panel', {
selType: 'treemodel',
treeCls: Ext.baseCSSPrefix + 'tree-panel',
-
+
+ deferRowRender: false,
+
lines: true,
@@ -88129,7 +88979,7 @@ Ext.define('Ext.tree.Panel', {
keys = path.split(separator);
last = keys.pop();
- me.expandPath(keys.join('/'), field, separator, function(success, node){
+ me.expandPath(keys.join(separator), field, separator, function(success, node){
var doSuccess = false;
if (success && node) {
node = node.findChild(field, last);
@@ -88146,6 +88996,7 @@ Ext.define('Ext.tree.Panel', {
}
});
+
Ext.define('Ext.view.DragZone', {
extend: 'Ext.dd.DragZone',
containerScroll: false,
@@ -88188,6 +89039,12 @@ Ext.define('Ext.view.DragZone', {
onItemMouseDown: function(view, record, item, index, e) {
if (!this.isPreventDrag(e, record, item, index)) {
this.handleMouseDown(e);
+
+
+
+ if (view.getSelectionModel().selectionMode == 'MULTI' && !e.ctrlKey && view.getSelectionModel().isSelected(record)) {
+ return false;
+ }
}
},
@@ -88228,7 +89085,7 @@ Ext.define('Ext.view.DragZone', {
if (!selectionModel.isSelected(record) || e.hasModifier()) {
- selectionModel.selectWithEvent(record, e);
+ selectionModel.selectWithEvent(record, e, true);
}
data.records = selectionModel.getSelection();
@@ -88390,10 +89247,10 @@ Ext.define('Ext.tree.ViewDropZone', {
}
- if (position === 'append' && targetNode.get('allowDrop') == false) {
+ if (position === 'append' && targetNode.get('allowDrop') === false) {
return false;
}
- else if (position != 'append' && targetNode.parentNode.get('allowDrop') == false) {
+ else if (position != 'append' && targetNode.parentNode.get('allowDrop') === false) {
return false;
}
@@ -88422,6 +89279,7 @@ Ext.define('Ext.tree.ViewDropZone', {
this.queueExpand(targetNode);
}
+
if (this.isValidDropPoint(node, position, dragZone, e, data)) {
this.valid = true;
this.currentPosition = position;
@@ -88430,24 +89288,22 @@ Ext.define('Ext.tree.ViewDropZone', {
indicator.setWidth(Ext.fly(node).getWidth());
indicatorY = Ext.fly(node).getY() - Ext.fly(view.el).getY() - 1;
+
if (position == 'before') {
returnCls = targetNode.isFirst() ? Ext.baseCSSPrefix + 'tree-drop-ok-above' : Ext.baseCSSPrefix + 'tree-drop-ok-between';
indicator.showAt(0, indicatorY);
- indicator.toFront();
- }
- else if (position == 'after') {
+ dragZone.proxy.show();
+ } else if (position == 'after') {
returnCls = targetNode.isLast() ? Ext.baseCSSPrefix + 'tree-drop-ok-below' : Ext.baseCSSPrefix + 'tree-drop-ok-between';
indicatorY += Ext.fly(node).getHeight();
indicator.showAt(0, indicatorY);
- indicator.toFront();
- }
- else {
+ dragZone.proxy.show();
+ } else {
returnCls = Ext.baseCSSPrefix + 'tree-drop-ok-append';
indicator.hide();
}
- }
- else {
+ } else {
this.valid = false;
}
@@ -88534,7 +89390,9 @@ Ext.define('Ext.tree.ViewDropZone', {
Ext.Array.forEach(recordDomNodes, function(n) {
- Ext.fly(n.firstChild ? n.firstChild : n).highlight(me.dropHighlightColor);
+ if (n) {
+ Ext.fly(n.firstChild ? n.firstChild : n).highlight(me.dropHighlightColor);
+ }
});
}
};
@@ -89036,7 +89894,7 @@ Ext.define('Ext.view.TableChunker', {
'{[this.openTableWrap()]}',
'<table class="' + Ext.baseCSSPrefix + 'grid-table ' + Ext.baseCSSPrefix + 'grid-table-resizer" border="0" cellspacing="0" cellpadding="0" {[this.embedFullWidth()]}>',
'<tbody>',
- '<tr>',
+ '<tr class="' + Ext.baseCSSPrefix + 'grid-header-row">',
'<tpl for="columns">',
'<th class="' + Ext.baseCSSPrefix + 'grid-col-resizer-{id}" style="width: {width}px; height: 0px;"></th>',
'</tpl>',
diff --git a/deluge/ui/web/js/ext-all-dev.js b/deluge/ui/web/js/ext-all-dev.js
new file mode 100644
index 000000000..2dc6de6ad
--- /dev/null
+++ b/deluge/ui/web/js/ext-all-dev.js
@@ -0,0 +1,129591 @@
+/*
+
+This file is part of Ext JS 4
+
+Copyright (c) 2011 Sencha Inc
+
+Contact: http://www.sencha.com/contact
+
+GNU General Public License Usage
+This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+
+If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
+
+*/
+/**
+ * @class Ext
+ * @singleton
+ */
+(function() {
+ var global = this,
+ objectPrototype = Object.prototype,
+ toString = objectPrototype.toString,
+ enumerables = true,
+ enumerablesTest = { toString: 1 },
+ i;
+
+ if (typeof Ext === 'undefined') {
+ global.Ext = {};
+ }
+
+ Ext.global = global;
+
+ for (i in enumerablesTest) {
+ enumerables = null;
+ }
+
+ if (enumerables) {
+ enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable',
+ 'toLocaleString', 'toString', 'constructor'];
+ }
+
+ /**
+ * An array containing extra enumerables for old browsers
+ * @type Array
+ */
+ Ext.enumerables = enumerables;
+
+ /**
+ * Copies all the properties of config to the specified object.
+ * Note that if recursive merging and cloning without referencing the original objects / arrays is needed, use
+ * {@link Ext.Object#merge} instead.
+ * @param {Object} object The receiver of the properties
+ * @param {Object} config The source of the properties
+ * @param {Object} defaults A different object that will also be applied for default values
+ * @return {Object} returns obj
+ */
+ Ext.apply = function(object, config, defaults) {
+ if (defaults) {
+ Ext.apply(object, defaults);
+ }
+
+ if (object && config && typeof config === 'object') {
+ var i, j, k;
+
+ for (i in config) {
+ object[i] = config[i];
+ }
+
+ if (enumerables) {
+ for (j = enumerables.length; j--;) {
+ k = enumerables[j];
+ if (config.hasOwnProperty(k)) {
+ object[k] = config[k];
+ }
+ }
+ }
+ }
+
+ return object;
+ };
+
+ Ext.buildSettings = Ext.apply({
+ baseCSSPrefix: 'x-',
+ scopeResetCSS: false
+ }, Ext.buildSettings || {});
+
+ Ext.apply(Ext, {
+ /**
+ * A reusable empty function
+ */
+ emptyFn: function() {},
+
+ baseCSSPrefix: Ext.buildSettings.baseCSSPrefix,
+
+ /**
+ * Copies all the properties of config to object if they don't already exist.
+ * @param {Object} object The receiver of the properties
+ * @param {Object} config The source of the properties
+ * @return {Object} returns obj
+ */
+ applyIf: function(object, config) {
+ var property;
+
+ if (object) {
+ for (property in config) {
+ if (object[property] === undefined) {
+ object[property] = config[property];
+ }
+ }
+ }
+
+ return object;
+ },
+
+ /**
+ * Iterates either an array or an object. This method delegates to
+ * {@link Ext.Array#each Ext.Array.each} if the given value is iterable, and {@link Ext.Object#each Ext.Object.each} otherwise.
+ *
+ * @param {Object/Array} object The object or array to be iterated.
+ * @param {Function} fn The function to be called for each iteration. See and {@link Ext.Array#each Ext.Array.each} and
+ * {@link Ext.Object#each Ext.Object.each} for detailed lists of arguments passed to this function depending on the given object
+ * type that is being iterated.
+ * @param {Object} scope (Optional) The scope (`this` reference) in which the specified function is executed.
+ * Defaults to the object being iterated itself.
+ * @markdown
+ */
+ iterate: function(object, fn, scope) {
+ if (Ext.isEmpty(object)) {
+ return;
+ }
+
+ if (scope === undefined) {
+ scope = object;
+ }
+
+ if (Ext.isIterable(object)) {
+ Ext.Array.each.call(Ext.Array, object, fn, scope);
+ }
+ else {
+ Ext.Object.each.call(Ext.Object, object, fn, scope);
+ }
+ }
+ });
+
+ Ext.apply(Ext, {
+
+ /**
+ * This method deprecated. Use {@link Ext#define Ext.define} instead.
+ * @method
+ * @param {Function} superclass
+ * @param {Object} overrides
+ * @return {Function} The subclass constructor from the <tt>overrides</tt> parameter, or a generated one if not provided.
+ * @deprecated 4.0.0 Use {@link Ext#define Ext.define} instead
+ */
+ extend: function() {
+ // inline overrides
+ var objectConstructor = objectPrototype.constructor,
+ inlineOverrides = function(o) {
+ for (var m in o) {
+ if (!o.hasOwnProperty(m)) {
+ continue;
+ }
+ this[m] = o[m];
+ }
+ };
+
+ return function(subclass, superclass, overrides) {
+ // First we check if the user passed in just the superClass with overrides
+ if (Ext.isObject(superclass)) {
+ overrides = superclass;
+ superclass = subclass;
+ subclass = overrides.constructor !== objectConstructor ? overrides.constructor : function() {
+ superclass.apply(this, arguments);
+ };
+ }
+
+ if (!superclass) {
+ Ext.Error.raise({
+ sourceClass: 'Ext',
+ sourceMethod: 'extend',
+ msg: 'Attempting to extend from a class which has not been loaded on the page.'
+ });
+ }
+
+ // We create a new temporary class
+ var F = function() {},
+ subclassProto, superclassProto = superclass.prototype;
+
+ F.prototype = superclassProto;
+ subclassProto = subclass.prototype = new F();
+ subclassProto.constructor = subclass;
+ subclass.superclass = superclassProto;
+
+ if (superclassProto.constructor === objectConstructor) {
+ superclassProto.constructor = superclass;
+ }
+
+ subclass.override = function(overrides) {
+ Ext.override(subclass, overrides);
+ };
+
+ subclassProto.override = inlineOverrides;
+ subclassProto.proto = subclassProto;
+
+ subclass.override(overrides);
+ subclass.extend = function(o) {
+ return Ext.extend(subclass, o);
+ };
+
+ return subclass;
+ };
+ }(),
+
+ /**
+ * Proxy to {@link Ext.Base#override}. Please refer {@link Ext.Base#override} for further details.
+
+ Ext.define('My.cool.Class', {
+ sayHi: function() {
+ alert('Hi!');
+ }
+ }
+
+ Ext.override(My.cool.Class, {
+ sayHi: function() {
+ alert('About to say...');
+
+ this.callOverridden();
+ }
+ });
+
+ var cool = new My.cool.Class();
+ cool.sayHi(); // alerts 'About to say...'
+ // alerts 'Hi!'
+
+ * Please note that `this.callOverridden()` only works if the class was previously
+ * created with {@link Ext#define)
+ *
+ * @param {Object} cls The class to override
+ * @param {Object} overrides The list of functions to add to origClass. This should be specified as an object literal
+ * containing one or more methods.
+ * @method override
+ * @markdown
+ */
+ override: function(cls, overrides) {
+ if (cls.prototype.$className) {
+ return cls.override(overrides);
+ }
+ else {
+ Ext.apply(cls.prototype, overrides);
+ }
+ }
+ });
+
+ // A full set of static methods to do type checking
+ Ext.apply(Ext, {
+
+ /**
+ * Returns the given value itself if it's not empty, as described in {@link Ext#isEmpty}; returns the default
+ * value (second argument) otherwise.
+ *
+ * @param {Mixed} value The value to test
+ * @param {Mixed} defaultValue The value to return if the original value is empty
+ * @param {Boolean} allowBlank (optional) true to allow zero length strings to qualify as non-empty (defaults to false)
+ * @return {Mixed} value, if non-empty, else defaultValue
+ */
+ valueFrom: function(value, defaultValue, allowBlank){
+ return Ext.isEmpty(value, allowBlank) ? defaultValue : value;
+ },
+
+ /**
+ * Returns the type of the given variable in string format. List of possible values are:
+ *
+ * - `undefined`: If the given value is `undefined`
+ * - `null`: If the given value is `null`
+ * - `string`: If the given value is a string
+ * - `number`: If the given value is a number
+ * - `boolean`: If the given value is a boolean value
+ * - `date`: If the given value is a `Date` object
+ * - `function`: If the given value is a function reference
+ * - `object`: If the given value is an object
+ * - `array`: If the given value is an array
+ * - `regexp`: If the given value is a regular expression
+ * - `element`: If the given value is a DOM Element
+ * - `textnode`: If the given value is a DOM text node and contains something other than whitespace
+ * - `whitespace`: If the given value is a DOM text node and contains only whitespace
+ *
+ * @param {Mixed} value
+ * @return {String}
+ * @markdown
+ */
+ typeOf: function(value) {
+ if (value === null) {
+ return 'null';
+ }
+
+ var type = typeof value;
+
+ if (type === 'undefined' || type === 'string' || type === 'number' || type === 'boolean') {
+ return type;
+ }
+
+ var typeToString = toString.call(value);
+
+ switch(typeToString) {
+ case '[object Array]':
+ return 'array';
+ case '[object Date]':
+ return 'date';
+ case '[object Boolean]':
+ return 'boolean';
+ case '[object Number]':
+ return 'number';
+ case '[object RegExp]':
+ return 'regexp';
+ }
+
+ if (type === 'function') {
+ return 'function';
+ }
+
+ if (type === 'object') {
+ if (value.nodeType !== undefined) {
+ if (value.nodeType === 3) {
+ return (/\S/).test(value.nodeValue) ? 'textnode' : 'whitespace';
+ }
+ else {
+ return 'element';
+ }
+ }
+
+ return 'object';
+ }
+
+ Ext.Error.raise({
+ sourceClass: 'Ext',
+ sourceMethod: 'typeOf',
+ msg: 'Failed to determine the type of the specified value "' + value + '". This is most likely a bug.'
+ });
+ },
+
+ /**
+ * Returns true if the passed value is empty, false otherwise. The value is deemed to be empty if it is either:
+ *
+ * - `null`
+ * - `undefined`
+ * - a zero-length array
+ * - a zero-length string (Unless the `allowEmptyString` parameter is set to `true`)
+ *
+ * @param {Mixed} value The value to test
+ * @param {Boolean} allowEmptyString (optional) true to allow empty strings (defaults to false)
+ * @return {Boolean}
+ * @markdown
+ */
+ isEmpty: function(value, allowEmptyString) {
+ return (value === null) || (value === undefined) || (!allowEmptyString ? value === '' : false) || (Ext.isArray(value) && value.length === 0);
+ },
+
+ /**
+ * Returns true if the passed value is a JavaScript Array, false otherwise.
+ *
+ * @param {Mixed} target The target to test
+ * @return {Boolean}
+ * @method
+ */
+ isArray: ('isArray' in Array) ? Array.isArray : function(value) {
+ return toString.call(value) === '[object Array]';
+ },
+
+ /**
+ * Returns true if the passed value is a JavaScript Date object, false otherwise.
+ * @param {Object} object The object to test
+ * @return {Boolean}
+ */
+ isDate: function(value) {
+ return toString.call(value) === '[object Date]';
+ },
+
+ /**
+ * Returns true if the passed value is a JavaScript Object, false otherwise.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ * @method
+ */
+ isObject: (toString.call(null) === '[object Object]') ?
+ function(value) {
+ // check ownerDocument here as well to exclude DOM nodes
+ return value !== null && value !== undefined && toString.call(value) === '[object Object]' && value.ownerDocument === undefined;
+ } :
+ function(value) {
+ return toString.call(value) === '[object Object]';
+ },
+
+ /**
+ * Returns true if the passed value is a JavaScript 'primitive', a string, number or boolean.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isPrimitive: function(value) {
+ var type = typeof value;
+
+ return type === 'string' || type === 'number' || type === 'boolean';
+ },
+
+ /**
+ * Returns true if the passed value is a JavaScript Function, false otherwise.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ * @method
+ */
+ isFunction:
+ // Safari 3.x and 4.x returns 'function' for typeof <NodeList>, hence we need to fall back to using
+ // Object.prorotype.toString (slower)
+ (typeof document !== 'undefined' && typeof document.getElementsByTagName('body') === 'function') ? function(value) {
+ return toString.call(value) === '[object Function]';
+ } : function(value) {
+ return typeof value === 'function';
+ },
+
+ /**
+ * 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(value) {
+ return typeof value === 'number' && isFinite(value);
+ },
+
+ /**
+ * Validates that a value is numeric.
+ * @param {Mixed} value Examples: 1, '1', '2.34'
+ * @return {Boolean} True if numeric, false otherwise
+ */
+ isNumeric: function(value) {
+ return !isNaN(parseFloat(value)) && isFinite(value);
+ },
+
+ /**
+ * Returns true if the passed value is a string.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isString: function(value) {
+ return typeof value === 'string';
+ },
+
+ /**
+ * Returns true if the passed value is a boolean.
+ *
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isBoolean: function(value) {
+ return typeof value === 'boolean';
+ },
+
+ /**
+ * Returns true if the passed value is an HTMLElement
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isElement: function(value) {
+ return value ? value.nodeType === 1 : false;
+ },
+
+ /**
+ * Returns true if the passed value is a TextNode
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isTextNode: function(value) {
+ return value ? value.nodeName === "#text" : false;
+ },
+
+ /**
+ * Returns true if the passed value is defined.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isDefined: function(value) {
+ return typeof value !== 'undefined';
+ },
+
+ /**
+ * Returns true if the passed value is iterable, false otherwise
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isIterable: function(value) {
+ return (value && typeof value !== 'string') ? value.length !== undefined : false;
+ }
+ });
+
+ Ext.apply(Ext, {
+
+ /**
+ * Clone almost any type of variable including array, object, DOM nodes and Date without keeping the old reference
+ * @param {Mixed} item The variable to clone
+ * @return {Mixed} clone
+ */
+ clone: function(item) {
+ if (item === null || item === undefined) {
+ return item;
+ }
+
+ // DOM nodes
+ // TODO proxy this to Ext.Element.clone to handle automatic id attribute changing
+ // recursively
+ if (item.nodeType && item.cloneNode) {
+ return item.cloneNode(true);
+ }
+
+ var type = toString.call(item);
+
+ // Date
+ if (type === '[object Date]') {
+ return new Date(item.getTime());
+ }
+
+ var i, j, k, clone, key;
+
+ // Array
+ if (type === '[object Array]') {
+ i = item.length;
+
+ clone = [];
+
+ while (i--) {
+ clone[i] = Ext.clone(item[i]);
+ }
+ }
+ // Object
+ else if (type === '[object Object]' && item.constructor === Object) {
+ clone = {};
+
+ for (key in item) {
+ clone[key] = Ext.clone(item[key]);
+ }
+
+ if (enumerables) {
+ for (j = enumerables.length; j--;) {
+ k = enumerables[j];
+ clone[k] = item[k];
+ }
+ }
+ }
+
+ return clone || item;
+ },
+
+ /**
+ * @private
+ * Generate a unique reference of Ext in the global scope, useful for sandboxing
+ */
+ getUniqueGlobalNamespace: function() {
+ var uniqueGlobalNamespace = this.uniqueGlobalNamespace;
+
+ if (uniqueGlobalNamespace === undefined) {
+ var i = 0;
+
+ do {
+ uniqueGlobalNamespace = 'ExtBox' + (++i);
+ } while (Ext.global[uniqueGlobalNamespace] !== undefined);
+
+ Ext.global[uniqueGlobalNamespace] = Ext;
+ this.uniqueGlobalNamespace = uniqueGlobalNamespace;
+ }
+
+ return uniqueGlobalNamespace;
+ },
+
+ /**
+ * @private
+ */
+ functionFactory: function() {
+ var args = Array.prototype.slice.call(arguments);
+
+ if (args.length > 0) {
+ args[args.length - 1] = 'var Ext=window.' + this.getUniqueGlobalNamespace() + ';' +
+ args[args.length - 1];
+ }
+
+ return Function.prototype.constructor.apply(Function.prototype, args);
+ }
+ });
+
+ /**
+ * Old alias to {@link Ext#typeOf}
+ * @deprecated 4.0.0 Use {@link Ext#typeOf} instead
+ * @method
+ * @alias Ext#typeOf
+ */
+ Ext.type = Ext.typeOf;
+
+})();
+
+/**
+ * @author Jacky Nguyen <jacky@sencha.com>
+ * @docauthor Jacky Nguyen <jacky@sencha.com>
+ * @class Ext.Version
+ *
+ * A utility class that wrap around a string version number and provide convenient
+ * method to perform comparison. See also: {@link Ext.Version#compare compare}. Example:
+
+ var version = new Ext.Version('1.0.2beta');
+ console.log("Version is " + version); // Version is 1.0.2beta
+
+ console.log(version.getMajor()); // 1
+ console.log(version.getMinor()); // 0
+ console.log(version.getPatch()); // 2
+ console.log(version.getBuild()); // 0
+ console.log(version.getRelease()); // beta
+
+ console.log(version.isGreaterThan('1.0.1')); // True
+ console.log(version.isGreaterThan('1.0.2alpha')); // True
+ console.log(version.isGreaterThan('1.0.2RC')); // False
+ console.log(version.isGreaterThan('1.0.2')); // False
+ console.log(version.isLessThan('1.0.2')); // True
+
+ console.log(version.match(1.0)); // True
+ console.log(version.match('1.0.2')); // True
+
+ * @markdown
+ */
+(function() {
+
+// Current core version
+var version = '4.0.2', Version;
+ Ext.Version = Version = Ext.extend(Object, {
+
+ /**
+ * @param {String/Number} version The version number in the follow standard format: major[.minor[.patch[.build[release]]]]
+ * Examples: 1.0 or 1.2.3beta or 1.2.3.4RC
+ * @return {Ext.Version} this
+ */
+ constructor: function(version) {
+ var parts, releaseStartIndex;
+
+ if (version instanceof Version) {
+ return version;
+ }
+
+ this.version = this.shortVersion = String(version).toLowerCase().replace(/_/g, '.').replace(/[\-+]/g, '');
+
+ releaseStartIndex = this.version.search(/([^\d\.])/);
+
+ if (releaseStartIndex !== -1) {
+ this.release = this.version.substr(releaseStartIndex, version.length);
+ this.shortVersion = this.version.substr(0, releaseStartIndex);
+ }
+
+ this.shortVersion = this.shortVersion.replace(/[^\d]/g, '');
+
+ parts = this.version.split('.');
+
+ this.major = parseInt(parts.shift() || 0, 10);
+ this.minor = parseInt(parts.shift() || 0, 10);
+ this.patch = parseInt(parts.shift() || 0, 10);
+ this.build = parseInt(parts.shift() || 0, 10);
+
+ return this;
+ },
+
+ /**
+ * Override the native toString method
+ * @private
+ * @return {String} version
+ */
+ toString: function() {
+ return this.version;
+ },
+
+ /**
+ * Override the native valueOf method
+ * @private
+ * @return {String} version
+ */
+ valueOf: function() {
+ return this.version;
+ },
+
+ /**
+ * Returns the major component value
+ * @return {Number} major
+ */
+ getMajor: function() {
+ return this.major || 0;
+ },
+
+ /**
+ * Returns the minor component value
+ * @return {Number} minor
+ */
+ getMinor: function() {
+ return this.minor || 0;
+ },
+
+ /**
+ * Returns the patch component value
+ * @return {Number} patch
+ */
+ getPatch: function() {
+ return this.patch || 0;
+ },
+
+ /**
+ * Returns the build component value
+ * @return {Number} build
+ */
+ getBuild: function() {
+ return this.build || 0;
+ },
+
+ /**
+ * Returns the release component value
+ * @return {Number} release
+ */
+ getRelease: function() {
+ return this.release || '';
+ },
+
+ /**
+ * Returns whether this version if greater than the supplied argument
+ * @param {String/Number} target The version to compare with
+ * @return {Boolean} True if this version if greater than the target, false otherwise
+ */
+ isGreaterThan: function(target) {
+ return Version.compare(this.version, target) === 1;
+ },
+
+ /**
+ * Returns whether this version if smaller than the supplied argument
+ * @param {String/Number} target The version to compare with
+ * @return {Boolean} True if this version if smaller than the target, false otherwise
+ */
+ isLessThan: function(target) {
+ return Version.compare(this.version, target) === -1;
+ },
+
+ /**
+ * Returns whether this version equals to the supplied argument
+ * @param {String/Number} target The version to compare with
+ * @return {Boolean} True if this version equals to the target, false otherwise
+ */
+ equals: function(target) {
+ return Version.compare(this.version, target) === 0;
+ },
+
+ /**
+ * Returns whether this version matches the supplied argument. Example:
+ * <pre><code>
+ * var version = new Ext.Version('1.0.2beta');
+ * console.log(version.match(1)); // True
+ * console.log(version.match(1.0)); // True
+ * console.log(version.match('1.0.2')); // True
+ * console.log(version.match('1.0.2RC')); // False
+ * </code></pre>
+ * @param {String/Number} target The version to compare with
+ * @return {Boolean} True if this version matches the target, false otherwise
+ */
+ match: function(target) {
+ target = String(target);
+ return this.version.substr(0, target.length) === target;
+ },
+
+ /**
+ * Returns this format: [major, minor, patch, build, release]. Useful for comparison
+ * @return {Array}
+ */
+ toArray: function() {
+ return [this.getMajor(), this.getMinor(), this.getPatch(), this.getBuild(), this.getRelease()];
+ },
+
+ /**
+ * Returns shortVersion version without dots and release
+ * @return {String}
+ */
+ getShortVersion: function() {
+ return this.shortVersion;
+ }
+ });
+
+ Ext.apply(Version, {
+ // @private
+ releaseValueMap: {
+ 'dev': -6,
+ 'alpha': -5,
+ 'a': -5,
+ 'beta': -4,
+ 'b': -4,
+ 'rc': -3,
+ '#': -2,
+ 'p': -1,
+ 'pl': -1
+ },
+
+ /**
+ * Converts a version component to a comparable value
+ *
+ * @static
+ * @param {Mixed} value The value to convert
+ * @return {Mixed}
+ */
+ getComponentValue: function(value) {
+ return !value ? 0 : (isNaN(value) ? this.releaseValueMap[value] || value : parseInt(value, 10));
+ },
+
+ /**
+ * Compare 2 specified versions, starting from left to right. If a part contains special version strings,
+ * they are handled in the following order:
+ * 'dev' < 'alpha' = 'a' < 'beta' = 'b' < 'RC' = 'rc' < '#' < 'pl' = 'p' < 'anything else'
+ *
+ * @static
+ * @param {String} current The current version to compare to
+ * @param {String} target The target version to compare to
+ * @return {Number} Returns -1 if the current version is smaller than the target version, 1 if greater, and 0 if they're equivalent
+ */
+ compare: function(current, target) {
+ var currentValue, targetValue, i;
+
+ current = new Version(current).toArray();
+ target = new Version(target).toArray();
+
+ for (i = 0; i < Math.max(current.length, target.length); i++) {
+ currentValue = this.getComponentValue(current[i]);
+ targetValue = this.getComponentValue(target[i]);
+
+ if (currentValue < targetValue) {
+ return -1;
+ } else if (currentValue > targetValue) {
+ return 1;
+ }
+ }
+
+ return 0;
+ }
+ });
+
+ Ext.apply(Ext, {
+ /**
+ * @private
+ */
+ versions: {},
+
+ /**
+ * @private
+ */
+ lastRegisteredVersion: null,
+
+ /**
+ * Set version number for the given package name.
+ *
+ * @param {String} packageName The package name, for example: 'core', 'touch', 'extjs'
+ * @param {String/Ext.Version} version The version, for example: '1.2.3alpha', '2.4.0-dev'
+ * @return {Ext}
+ */
+ setVersion: function(packageName, version) {
+ Ext.versions[packageName] = new Version(version);
+ Ext.lastRegisteredVersion = Ext.versions[packageName];
+
+ return this;
+ },
+
+ /**
+ * Get the version number of the supplied package name; will return the last registered version
+ * (last Ext.setVersion call) if there's no package name given.
+ *
+ * @param {String} packageName (Optional) The package name, for example: 'core', 'touch', 'extjs'
+ * @return {Ext.Version} The version
+ */
+ getVersion: function(packageName) {
+ if (packageName === undefined) {
+ return Ext.lastRegisteredVersion;
+ }
+
+ return Ext.versions[packageName];
+ },
+
+ /**
+ * Create a closure for deprecated code.
+ *
+ // This means Ext.oldMethod is only supported in 4.0.0beta and older.
+ // If Ext.getVersion('extjs') returns a version that is later than '4.0.0beta', for example '4.0.0RC',
+ // the closure will not be invoked
+ Ext.deprecate('extjs', '4.0.0beta', function() {
+ Ext.oldMethod = Ext.newMethod;
+
+ ...
+ });
+
+ * @param {String} packageName The package name
+ * @param {String} since The last version before it's deprecated
+ * @param {Function} closure The callback function to be executed with the specified version is less than the current version
+ * @param {Object} scope The execution scope (<tt>this</tt>) if the closure
+ * @markdown
+ */
+ deprecate: function(packageName, since, closure, scope) {
+ if (Version.compare(Ext.getVersion(packageName), since) < 1) {
+ closure.call(scope);
+ }
+ }
+ }); // End Versioning
+
+ Ext.setVersion('core', version);
+
+})();
+
+/**
+ * @class Ext.String
+ *
+ * A collection of useful static methods to deal with strings
+ * @singleton
+ */
+
+Ext.String = {
+ trimRegex: /^[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]+|[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]+$/g,
+ escapeRe: /('|\\)/g,
+ formatRe: /\{(\d+)\}/g,
+ escapeRegexRe: /([-.*+?^${}()|[\]\/\\])/g,
+
+ /**
+ * Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
+ * @param {String} value The string to encode
+ * @return {String} The encoded text
+ * @method
+ */
+ htmlEncode: (function() {
+ var entities = {
+ '&': '&amp;',
+ '>': '&gt;',
+ '<': '&lt;',
+ '"': '&quot;'
+ }, keys = [], p, regex;
+
+ for (p in entities) {
+ keys.push(p);
+ }
+
+ regex = new RegExp('(' + keys.join('|') + ')', 'g');
+
+ return function(value) {
+ return (!value) ? value : String(value).replace(regex, function(match, capture) {
+ return entities[capture];
+ });
+ };
+ })(),
+
+ /**
+ * Convert certain characters (&, <, >, and ') from their HTML character equivalents.
+ * @param {String} value The string to decode
+ * @return {String} The decoded text
+ * @method
+ */
+ htmlDecode: (function() {
+ var entities = {
+ '&amp;': '&',
+ '&gt;': '>',
+ '&lt;': '<',
+ '&quot;': '"'
+ }, keys = [], p, regex;
+
+ for (p in entities) {
+ keys.push(p);
+ }
+
+ regex = new RegExp('(' + keys.join('|') + '|&#[0-9]{1,5};' + ')', 'g');
+
+ return function(value) {
+ return (!value) ? value : String(value).replace(regex, function(match, capture) {
+ if (capture in entities) {
+ return entities[capture];
+ } else {
+ return String.fromCharCode(parseInt(capture.substr(2), 10));
+ }
+ });
+ };
+ })(),
+
+ /**
+ * 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} string The content to append to the URL.
+ * @return (String) The resulting URL
+ */
+ urlAppend : function(url, string) {
+ if (!Ext.isEmpty(string)) {
+ return url + (url.indexOf('?') === -1 ? '?' : '&') + string;
+ }
+
+ return url;
+ },
+
+ /**
+ * Trims whitespace from either end of a string, leaving spaces within the string intact. Example:
+ * @example
+var s = ' foo bar ';
+alert('-' + s + '-'); //alerts "- foo bar -"
+alert('-' + Ext.String.trim(s) + '-'); //alerts "-foo bar-"
+
+ * @param {String} string The string to escape
+ * @return {String} The trimmed string
+ */
+ trim: function(string) {
+ return string.replace(Ext.String.trimRegex, "");
+ },
+
+ /**
+ * Capitalize the given string
+ * @param {String} string
+ * @return {String}
+ */
+ capitalize: function(string) {
+ return string.charAt(0).toUpperCase() + string.substr(1);
+ },
+
+ /**
+ * Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length
+ * @param {String} value The string to truncate
+ * @param {Number} length The maximum length to allow before truncating
+ * @param {Boolean} word True to try to find a common word break
+ * @return {String} The converted text
+ */
+ ellipsis: function(value, len, word) {
+ if (value && value.length > len) {
+ if (word) {
+ var vs = value.substr(0, len - 2),
+ index = Math.max(vs.lastIndexOf(' '), vs.lastIndexOf('.'), vs.lastIndexOf('!'), vs.lastIndexOf('?'));
+ if (index !== -1 && index >= (len - 15)) {
+ return vs.substr(0, index) + "...";
+ }
+ }
+ return value.substr(0, len - 3) + "...";
+ }
+ return value;
+ },
+
+ /**
+ * Escapes the passed string for use in a regular expression
+ * @param {String} string
+ * @return {String}
+ */
+ escapeRegex: function(string) {
+ return string.replace(Ext.String.escapeRegexRe, "\\$1");
+ },
+
+ /**
+ * Escapes the passed string for ' and \
+ * @param {String} string The string to escape
+ * @return {String} The escaped string
+ */
+ escape: function(string) {
+ return string.replace(Ext.String.escapeRe, "\\$1");
+ },
+
+ /**
+ * Utility function that allows you to easily switch a string between two alternating values. The passed value
+ * is compared to the current string, and if they are equal, the other value that was passed in is returned. If
+ * they are already different, the first value passed in is returned. Note that this method returns the new value
+ * but does not change the current string.
+ * <pre><code>
+ // alternate sort directions
+ sort = Ext.String.toggle(sort, 'ASC', 'DESC');
+
+ // instead of conditional logic:
+ sort = (sort == 'ASC' ? 'DESC' : 'ASC');
+ </code></pre>
+ * @param {String} string The current string
+ * @param {String} value The value to compare to the current string
+ * @param {String} other The new value to use if the string already equals the first value passed in
+ * @return {String} The new value
+ */
+ toggle: function(string, value, other) {
+ return string === value ? other : value;
+ },
+
+ /**
+ * Pads the left side of a string with a specified character. This is especially useful
+ * for normalizing number and date strings. Example usage:
+ *
+ * <pre><code>
+var s = Ext.String.leftPad('123', 5, '0');
+// s now contains the string: '00123'
+ </code></pre>
+ * @param {String} string The original string
+ * @param {Number} size The total length of the output string
+ * @param {String} character (optional) The character with which to pad the original string (defaults to empty string " ")
+ * @return {String} The padded string
+ */
+ leftPad: function(string, size, character) {
+ var result = String(string);
+ character = character || " ";
+ while (result.length < size) {
+ result = character + result;
+ }
+ return result;
+ },
+
+ /**
+ * Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
+ * token must be unique, and must increment in the format {0}, {1}, etc. Example usage:
+ * <pre><code>
+var cls = 'my-class', text = 'Some text';
+var s = Ext.String.format('&lt;div class="{0}">{1}&lt;/div>', cls, text);
+// s now contains the string: '&lt;div class="my-class">Some text&lt;/div>'
+ </code></pre>
+ * @param {String} string The tokenized string to be formatted
+ * @param {String} value1 The value to replace token {0}
+ * @param {String} value2 Etc...
+ * @return {String} The formatted string
+ */
+ format: function(format) {
+ var args = Ext.Array.toArray(arguments, 1);
+ return format.replace(Ext.String.formatRe, function(m, i) {
+ return args[i];
+ });
+ }
+};
+
+/**
+ * @class Ext.Number
+ *
+ * A collection of useful static methods to deal with numbers
+ * @singleton
+ */
+
+(function() {
+
+var isToFixedBroken = (0.9).toFixed() !== '1';
+
+Ext.Number = {
+ /**
+ * Checks whether or not the passed number is within a desired range. If the number is already within the
+ * range it is returned, otherwise the min or max value is returned depending on which side of the range is
+ * exceeded. Note that this method returns the constrained value but does not change the current number.
+ * @param {Number} number The number to check
+ * @param {Number} min The minimum number in the range
+ * @param {Number} max The maximum number in the range
+ * @return {Number} The constrained value if outside the range, otherwise the current value
+ */
+ constrain: function(number, min, max) {
+ number = parseFloat(number);
+
+ if (!isNaN(min)) {
+ number = Math.max(number, min);
+ }
+ if (!isNaN(max)) {
+ number = Math.min(number, max);
+ }
+ return number;
+ },
+
+ /**
+ * Snaps the passed number between stopping points based upon a passed increment value.
+ * @param {Number} value The unsnapped value.
+ * @param {Number} increment The increment by which the value must move.
+ * @param {Number} minValue The minimum value to which the returned value must be constrained. Overrides the increment..
+ * @param {Number} maxValue The maximum value to which the returned value must be constrained. Overrides the increment..
+ * @return {Number} The value of the nearest snap target.
+ */
+ snap : function(value, increment, minValue, maxValue) {
+ var newValue = value,
+ m;
+
+ if (!(increment && value)) {
+ return value;
+ }
+ m = value % increment;
+ if (m !== 0) {
+ newValue -= m;
+ if (m * 2 >= increment) {
+ newValue += increment;
+ } else if (m * 2 < -increment) {
+ newValue -= increment;
+ }
+ }
+ return Ext.Number.constrain(newValue, minValue, maxValue);
+ },
+
+ /**
+ * Formats a number using fixed-point notation
+ * @param {Number} value The number to format
+ * @param {Number} precision The number of digits to show after the decimal point
+ */
+ toFixed: function(value, precision) {
+ if (isToFixedBroken) {
+ precision = precision || 0;
+ var pow = Math.pow(10, precision);
+ return (Math.round(value * pow) / pow).toFixed(precision);
+ }
+
+ return value.toFixed(precision);
+ },
+
+ /**
+ * Validate that a value is numeric and convert it to a number if necessary. Returns the specified default value if
+ * it is not.
+
+Ext.Number.from('1.23', 1); // returns 1.23
+Ext.Number.from('abc', 1); // returns 1
+
+ * @param {Mixed} value
+ * @param {Number} defaultValue The value to return if the original value is non-numeric
+ * @return {Number} value, if numeric, defaultValue otherwise
+ */
+ from: function(value, defaultValue) {
+ if (isFinite(value)) {
+ value = parseFloat(value);
+ }
+
+ return !isNaN(value) ? value : defaultValue;
+ }
+};
+
+})();
+
+/**
+ * This method is deprecated, please use {@link Ext.Number#from Ext.Number.from} instead
+ *
+ * @deprecated 4.0.0 Replaced by Ext.Number.from
+ * @member Ext
+ * @method num
+ */
+Ext.num = function() {
+ return Ext.Number.from.apply(this, arguments);
+};
+/**
+ * @author Jacky Nguyen <jacky@sencha.com>
+ * @docauthor Jacky Nguyen <jacky@sencha.com>
+ * @class Ext.Array
+ *
+ * A set of useful static methods to deal with arrays; provide missing methods for older browsers.
+
+ * @singleton
+ * @markdown
+ */
+(function() {
+
+ var arrayPrototype = Array.prototype,
+ slice = arrayPrototype.slice,
+ supportsSplice = function () {
+ var array = [],
+ lengthBefore,
+ j = 20;
+
+ if (!array.splice) {
+ return false;
+ }
+
+ // This detects a bug in IE8 splice method:
+ // see http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/6e946d03-e09f-4b22-a4dd-cd5e276bf05a/
+
+ while (j--) {
+ array.push("A");
+ }
+
+ array.splice(15, 0, "F", "F", "F", "F", "F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F");
+
+ lengthBefore = array.length; //41
+ array.splice(13, 0, "XXX"); // add one element
+
+ if (lengthBefore+1 != array.length) {
+ return false;
+ }
+ // end IE8 bug
+
+ return true;
+ }(),
+ supportsForEach = 'forEach' in arrayPrototype,
+ supportsMap = 'map' in arrayPrototype,
+ supportsIndexOf = 'indexOf' in arrayPrototype,
+ supportsEvery = 'every' in arrayPrototype,
+ supportsSome = 'some' in arrayPrototype,
+ supportsFilter = 'filter' in arrayPrototype,
+ supportsSort = function() {
+ var a = [1,2,3,4,5].sort(function(){ return 0; });
+ return a[0] === 1 && a[1] === 2 && a[2] === 3 && a[3] === 4 && a[4] === 5;
+ }(),
+ supportsSliceOnNodeList = true,
+ ExtArray;
+
+ try {
+ // IE 6 - 8 will throw an error when using Array.prototype.slice on NodeList
+ if (typeof document !== 'undefined') {
+ slice.call(document.getElementsByTagName('body'));
+ }
+ } catch (e) {
+ supportsSliceOnNodeList = false;
+ }
+
+ function fixArrayIndex (array, index) {
+ return (index < 0) ? Math.max(0, array.length + index)
+ : Math.min(array.length, index);
+ }
+
+ /*
+ Does the same work as splice, but with a slightly more convenient signature. The splice
+ method has bugs in IE8, so this is the implementation we use on that platform.
+
+ The rippling of items in the array can be tricky. Consider two use cases:
+
+ index=2
+ removeCount=2
+ /=====\
+ +---+---+---+---+---+---+---+---+
+ | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+ +---+---+---+---+---+---+---+---+
+ / \/ \/ \/ \
+ / /\ /\ /\ \
+ / / \/ \/ \ +--------------------------+
+ / / /\ /\ +--------------------------+ \
+ / / / \/ +--------------------------+ \ \
+ / / / /+--------------------------+ \ \ \
+ / / / / \ \ \ \
+ v v v v v v v v
+ +---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+---+
+ | 0 | 1 | 4 | 5 | 6 | 7 | | 0 | 1 | a | b | c | 4 | 5 | 6 | 7 |
+ +---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+---+
+ A B \=========/
+ insert=[a,b,c]
+
+ In case A, it is obvious that copying of [4,5,6,7] must be left-to-right so
+ that we don't end up with [0,1,6,7,6,7]. In case B, we have the opposite; we
+ must go right-to-left or else we would end up with [0,1,a,b,c,4,4,4,4].
+ */
+ function replaceSim (array, index, removeCount, insert) {
+ var add = insert ? insert.length : 0,
+ length = array.length,
+ pos = fixArrayIndex(array, index);
+
+ // we try to use Array.push when we can for efficiency...
+ if (pos === length) {
+ if (add) {
+ array.push.apply(array, insert);
+ }
+ } else {
+ var remove = Math.min(removeCount, length - pos),
+ tailOldPos = pos + remove,
+ tailNewPos = tailOldPos + add - remove,
+ tailCount = length - tailOldPos,
+ lengthAfterRemove = length - remove,
+ i;
+
+ if (tailNewPos < tailOldPos) { // case A
+ for (i = 0; i < tailCount; ++i) {
+ array[tailNewPos+i] = array[tailOldPos+i];
+ }
+ } else if (tailNewPos > tailOldPos) { // case B
+ for (i = tailCount; i--; ) {
+ array[tailNewPos+i] = array[tailOldPos+i];
+ }
+ } // else, add == remove (nothing to do)
+
+ if (add && pos === lengthAfterRemove) {
+ array.length = lengthAfterRemove; // truncate array
+ array.push.apply(array, insert);
+ } else {
+ array.length = lengthAfterRemove + add; // reserves space
+ for (i = 0; i < add; ++i) {
+ array[pos+i] = insert[i];
+ }
+ }
+ }
+
+ return array;
+ }
+
+ function replaceNative (array, index, removeCount, insert) {
+ if (insert && insert.length) {
+ if (index < array.length) {
+ array.splice.apply(array, [index, removeCount].concat(insert));
+ } else {
+ array.push.apply(array, insert);
+ }
+ } else {
+ array.splice(index, removeCount);
+ }
+ return array;
+ }
+
+ function eraseSim (array, index, removeCount) {
+ return replaceSim(array, index, removeCount);
+ }
+
+ function eraseNative (array, index, removeCount) {
+ array.splice(index, removeCount);
+ return array;
+ }
+
+ function spliceSim (array, index, removeCount) {
+ var pos = fixArrayIndex(array, index),
+ removed = array.slice(index, fixArrayIndex(array, pos+removeCount));
+
+ if (arguments.length < 4) {
+ replaceSim(array, pos, removeCount);
+ } else {
+ replaceSim(array, pos, removeCount, slice.call(arguments, 3));
+ }
+
+ return removed;
+ }
+
+ function spliceNative (array) {
+ return array.splice.apply(array, slice.call(arguments, 1));
+ }
+
+ var erase = supportsSplice ? eraseNative : eraseSim,
+ replace = supportsSplice ? replaceNative : replaceSim,
+ splice = supportsSplice ? spliceNative : spliceSim;
+
+ // NOTE: from here on, use erase, replace or splice (not native methods)...
+
+ ExtArray = Ext.Array = {
+ /**
+ * Iterates an array or an iterable value and invoke the given callback function for each item.
+ *
+ * var countries = ['Vietnam', 'Singapore', 'United States', 'Russia'];
+ *
+ * Ext.Array.each(countries, function(name, index, countriesItSelf) {
+ * console.log(name);
+ * });
+ *
+ * var sum = function() {
+ * var sum = 0;
+ *
+ * Ext.Array.each(arguments, function(value) {
+ * sum += value;
+ * });
+ *
+ * return sum;
+ * };
+ *
+ * sum(1, 2, 3); // returns 6
+ *
+ * The iteration can be stopped by returning false in the function callback.
+ *
+ * Ext.Array.each(countries, function(name, index, countriesItSelf) {
+ * if (name === 'Singapore') {
+ * return false; // break here
+ * }
+ * });
+ *
+ * {@link Ext#each Ext.each} is alias for {@link Ext.Array#each Ext.Array.each}
+ *
+ * @param {Array/NodeList/Mixed} iterable The value to be iterated. If this
+ * argument is not iterable, the callback function is called once.
+ * @param {Function} fn The callback function. If it returns false, the iteration stops and this method returns
+ * the current `index`. Arguments passed to this callback function are:
+ *
+ * - `item` : Mixed - The item at the current `index` in the passed `array`
+ * - `index` : Number - The current `index` within the `array`
+ * - `allItems` : Array/NodeList/Mixed - The `array` passed as the first argument to `Ext.Array.each`
+ *
+ * @param {Object} scope (Optional) The scope (`this` reference) in which the specified function is executed.
+ * @param {Boolean} reverse (Optional) Reverse the iteration order (loop from the end to the beginning)
+ * Defaults false
+ * @return {Boolean} See description for the `fn` parameter.
+ */
+ each: function(array, fn, scope, reverse) {
+ array = ExtArray.from(array);
+
+ var i,
+ ln = array.length;
+
+ if (reverse !== true) {
+ for (i = 0; i < ln; i++) {
+ if (fn.call(scope || array[i], array[i], i, array) === false) {
+ return i;
+ }
+ }
+ }
+ else {
+ for (i = ln - 1; i > -1; i--) {
+ if (fn.call(scope || array[i], array[i], i, array) === false) {
+ return i;
+ }
+ }
+ }
+
+ return true;
+ },
+
+ /**
+ * Iterates an array and invoke the given callback function for each item. Note that this will simply
+ * delegate to the native Array.prototype.forEach method if supported.
+ * It doesn't support stopping the iteration by returning false in the callback function like
+ * {@link Ext.Array#each}. However, performance could be much better in modern browsers comparing with
+ * {@link Ext.Array#each}
+ *
+ * @param {Array} array The array to iterate
+ * @param {Function} fn The function callback, to be invoked these arguments:
+ *
+ * - `item` : Mixed - The item at the current `index` in the passed `array`
+ * - `index` : Number - The current `index` within the `array`
+ * - `allItems` : Array - The `array` itself which was passed as the first argument
+ *
+ * @param {Object} scope (Optional) The execution scope (`this`) in which the specified function is executed.
+ */
+ forEach: function(array, fn, scope) {
+ if (supportsForEach) {
+ return array.forEach(fn, scope);
+ }
+
+ var i = 0,
+ ln = array.length;
+
+ for (; i < ln; i++) {
+ fn.call(scope, array[i], i, array);
+ }
+ },
+
+ /**
+ * Get the index of the provided `item` in the given `array`, a supplement for the
+ * missing arrayPrototype.indexOf in Internet Explorer.
+ *
+ * @param {Array} array The array to check
+ * @param {Mixed} item The item to look for
+ * @param {Number} from (Optional) The index at which to begin the search
+ * @return {Number} The index of item in the array (or -1 if it is not found)
+ */
+ indexOf: function(array, item, from) {
+ if (supportsIndexOf) {
+ return array.indexOf(item, from);
+ }
+
+ var i, length = array.length;
+
+ for (i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++) {
+ if (array[i] === item) {
+ return i;
+ }
+ }
+
+ return -1;
+ },
+
+ /**
+ * Checks whether or not the given `array` contains the specified `item`
+ *
+ * @param {Array} array The array to check
+ * @param {Mixed} item The item to look for
+ * @return {Boolean} True if the array contains the item, false otherwise
+ */
+ contains: function(array, item) {
+ if (supportsIndexOf) {
+ return array.indexOf(item) !== -1;
+ }
+
+ var i, ln;
+
+ for (i = 0, ln = array.length; i < ln; i++) {
+ if (array[i] === item) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ /**
+ * Converts any iterable (numeric indices and a length property) into a true array.
+ *
+ * function test() {
+ * var args = Ext.Array.toArray(arguments),
+ * fromSecondToLastArgs = Ext.Array.toArray(arguments, 1);
+ *
+ * alert(args.join(' '));
+ * alert(fromSecondToLastArgs.join(' '));
+ * }
+ *
+ * test('just', 'testing', 'here'); // alerts 'just testing here';
+ * // alerts 'testing here';
+ *
+ * Ext.Array.toArray(document.getElementsByTagName('div')); // will convert the NodeList into an array
+ * Ext.Array.toArray('splitted'); // returns ['s', 'p', 'l', 'i', 't', 't', 'e', 'd']
+ * Ext.Array.toArray('splitted', 0, 3); // returns ['s', 'p', 'l', 'i']
+ *
+ * {@link Ext#toArray Ext.toArray} is alias for {@link Ext.Array#toArray Ext.Array.toArray}
+ *
+ * @param {Mixed} iterable the iterable object to be turned into a true Array.
+ * @param {Number} start (Optional) a zero-based index that specifies the start of extraction. Defaults to 0
+ * @param {Number} end (Optional) a zero-based index that specifies the end of extraction. Defaults to the last
+ * index of the iterable value
+ * @return {Array} array
+ */
+ toArray: function(iterable, start, end){
+ if (!iterable || !iterable.length) {
+ return [];
+ }
+
+ if (typeof iterable === 'string') {
+ iterable = iterable.split('');
+ }
+
+ if (supportsSliceOnNodeList) {
+ return slice.call(iterable, start || 0, end || iterable.length);
+ }
+
+ var array = [],
+ i;
+
+ start = start || 0;
+ end = end ? ((end < 0) ? iterable.length + end : end) : iterable.length;
+
+ for (i = start; i < end; i++) {
+ array.push(iterable[i]);
+ }
+
+ return array;
+ },
+
+ /**
+ * Plucks the value of a property from each item in the Array. Example:
+ *
+ * Ext.Array.pluck(Ext.query("p"), "className"); // [el1.className, el2.className, ..., elN.className]
+ *
+ * @param {Array|NodeList} array The Array of items to pluck the value from.
+ * @param {String} propertyName The property name to pluck from each element.
+ * @return {Array} The value from each item in the Array.
+ */
+ pluck: function(array, propertyName) {
+ var ret = [],
+ i, ln, item;
+
+ for (i = 0, ln = array.length; i < ln; i++) {
+ item = array[i];
+
+ ret.push(item[propertyName]);
+ }
+
+ return ret;
+ },
+
+ /**
+ * Creates a new array with the results of calling a provided function on every element in this array.
+ *
+ * @param {Array} array
+ * @param {Function} fn Callback function for each item
+ * @param {Object} scope Callback function scope
+ * @return {Array} results
+ */
+ map: function(array, fn, scope) {
+ if (supportsMap) {
+ return array.map(fn, scope);
+ }
+
+ var results = [],
+ i = 0,
+ len = array.length;
+
+ for (; i < len; i++) {
+ results[i] = fn.call(scope, array[i], i, array);
+ }
+
+ return results;
+ },
+
+ /**
+ * Executes the specified function for each array element until the function returns a falsy value.
+ * If such an item is found, the function will return false immediately.
+ * Otherwise, it will return true.
+ *
+ * @param {Array} array
+ * @param {Function} fn Callback function for each item
+ * @param {Object} scope Callback function scope
+ * @return {Boolean} True if no false value is returned by the callback function.
+ */
+ every: function(array, fn, scope) {
+ if (!fn) {
+ Ext.Error.raise('Ext.Array.every must have a callback function passed as second argument.');
+ }
+ if (supportsEvery) {
+ return array.every(fn, scope);
+ }
+
+ var i = 0,
+ ln = array.length;
+
+ for (; i < ln; ++i) {
+ if (!fn.call(scope, array[i], i, array)) {
+ return false;
+ }
+ }
+
+ return true;
+ },
+
+ /**
+ * Executes the specified function for each array element until the function returns a truthy value.
+ * If such an item is found, the function will return true immediately. Otherwise, it will return false.
+ *
+ * @param {Array} array
+ * @param {Function} fn Callback function for each item
+ * @param {Object} scope Callback function scope
+ * @return {Boolean} True if the callback function returns a truthy value.
+ */
+ some: function(array, fn, scope) {
+ if (!fn) {
+ Ext.Error.raise('Ext.Array.some must have a callback function passed as second argument.');
+ }
+ if (supportsSome) {
+ return array.some(fn, scope);
+ }
+
+ var i = 0,
+ ln = array.length;
+
+ for (; i < ln; ++i) {
+ if (fn.call(scope, array[i], i, array)) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ /**
+ * Filter through an array and remove empty item as defined in {@link Ext#isEmpty Ext.isEmpty}
+ *
+ * See {@link Ext.Array#filter}
+ *
+ * @param {Array} array
+ * @return {Array} results
+ */
+ clean: function(array) {
+ var results = [],
+ i = 0,
+ ln = array.length,
+ item;
+
+ for (; i < ln; i++) {
+ item = array[i];
+
+ if (!Ext.isEmpty(item)) {
+ results.push(item);
+ }
+ }
+
+ return results;
+ },
+
+ /**
+ * Returns a new array with unique items
+ *
+ * @param {Array} array
+ * @return {Array} results
+ */
+ unique: function(array) {
+ var clone = [],
+ i = 0,
+ ln = array.length,
+ item;
+
+ for (; i < ln; i++) {
+ item = array[i];
+
+ if (ExtArray.indexOf(clone, item) === -1) {
+ clone.push(item);
+ }
+ }
+
+ return clone;
+ },
+
+ /**
+ * Creates a new array with all of the elements of this array for which
+ * the provided filtering function returns true.
+ *
+ * @param {Array} array
+ * @param {Function} fn Callback function for each item
+ * @param {Object} scope Callback function scope
+ * @return {Array} results
+ */
+ filter: function(array, fn, scope) {
+ if (supportsFilter) {
+ return array.filter(fn, scope);
+ }
+
+ var results = [],
+ i = 0,
+ ln = array.length;
+
+ for (; i < ln; i++) {
+ if (fn.call(scope, array[i], i, array)) {
+ results.push(array[i]);
+ }
+ }
+
+ return results;
+ },
+
+ /**
+ * Converts a value to an array if it's not already an array; returns:
+ *
+ * - An empty array if given value is `undefined` or `null`
+ * - Itself if given value is already an array
+ * - An array copy if given value is {@link Ext#isIterable iterable} (arguments, NodeList and alike)
+ * - An array with one item which is the given value, otherwise
+ *
+ * @param {Array/Mixed} value The value to convert to an array if it's not already is an array
+ * @param {Boolean} (Optional) newReference True to clone the given array and return a new reference if necessary,
+ * defaults to false
+ * @return {Array} array
+ */
+ from: function(value, newReference) {
+ if (value === undefined || value === null) {
+ return [];
+ }
+
+ if (Ext.isArray(value)) {
+ return (newReference) ? slice.call(value) : value;
+ }
+
+ if (value && value.length !== undefined && typeof value !== 'string') {
+ return Ext.toArray(value);
+ }
+
+ return [value];
+ },
+
+ /**
+ * Removes the specified item from the array if it exists
+ *
+ * @param {Array} array The array
+ * @param {Mixed} item The item to remove
+ * @return {Array} The passed array itself
+ */
+ remove: function(array, item) {
+ var index = ExtArray.indexOf(array, item);
+
+ if (index !== -1) {
+ erase(array, index, 1);
+ }
+
+ return array;
+ },
+
+ /**
+ * Push an item into the array only if the array doesn't contain it yet
+ *
+ * @param {Array} array The array
+ * @param {Mixed} item The item to include
+ */
+ include: function(array, item) {
+ if (!ExtArray.contains(array, item)) {
+ array.push(item);
+ }
+ },
+
+ /**
+ * Clone a flat array without referencing the previous one. Note that this is different
+ * from Ext.clone since it doesn't handle recursive cloning. It's simply a convenient, easy-to-remember method
+ * for Array.prototype.slice.call(array)
+ *
+ * @param {Array} array The array
+ * @return {Array} The clone array
+ */
+ clone: function(array) {
+ return slice.call(array);
+ },
+
+ /**
+ * Merge multiple arrays into one with unique items.
+ *
+ * {@link Ext.Array#union} is alias for {@link Ext.Array#merge}
+ *
+ * @param {Array} array1
+ * @param {Array} array2
+ * @param {Array} etc
+ * @return {Array} merged
+ */
+ merge: function() {
+ var args = slice.call(arguments),
+ array = [],
+ i, ln;
+
+ for (i = 0, ln = args.length; i < ln; i++) {
+ array = array.concat(args[i]);
+ }
+
+ return ExtArray.unique(array);
+ },
+
+ /**
+ * Merge multiple arrays into one with unique items that exist in all of the arrays.
+ *
+ * @param {Array} array1
+ * @param {Array} array2
+ * @param {Array} etc
+ * @return {Array} intersect
+ */
+ intersect: function() {
+ var intersect = [],
+ arrays = slice.call(arguments),
+ i, j, k, minArray, array, x, y, ln, arraysLn, arrayLn;
+
+ if (!arrays.length) {
+ return intersect;
+ }
+
+ // Find the smallest array
+ for (i = x = 0,ln = arrays.length; i < ln,array = arrays[i]; i++) {
+ if (!minArray || array.length < minArray.length) {
+ minArray = array;
+ x = i;
+ }
+ }
+
+ minArray = ExtArray.unique(minArray);
+ erase(arrays, x, 1);
+
+ // Use the smallest unique'd array as the anchor loop. If the other array(s) do contain
+ // an item in the small array, we're likely to find it before reaching the end
+ // of the inner loop and can terminate the search early.
+ for (i = 0,ln = minArray.length; i < ln,x = minArray[i]; i++) {
+ var count = 0;
+
+ for (j = 0,arraysLn = arrays.length; j < arraysLn,array = arrays[j]; j++) {
+ for (k = 0,arrayLn = array.length; k < arrayLn,y = array[k]; k++) {
+ if (x === y) {
+ count++;
+ break;
+ }
+ }
+ }
+
+ if (count === arraysLn) {
+ intersect.push(x);
+ }
+ }
+
+ return intersect;
+ },
+
+ /**
+ * Perform a set difference A-B by subtracting all items in array B from array A.
+ *
+ * @param {Array} arrayA
+ * @param {Array} arrayB
+ * @return {Array} difference
+ */
+ difference: function(arrayA, arrayB) {
+ var clone = slice.call(arrayA),
+ ln = clone.length,
+ i, j, lnB;
+
+ for (i = 0,lnB = arrayB.length; i < lnB; i++) {
+ for (j = 0; j < ln; j++) {
+ if (clone[j] === arrayB[i]) {
+ erase(clone, j, 1);
+ j--;
+ ln--;
+ }
+ }
+ }
+
+ return clone;
+ },
+
+ /**
+ * Returns a shallow copy of a part of an array. This is equivalent to the native
+ * call "Array.prototype.slice.call(array, begin, end)". This is often used when "array"
+ * is "arguments" since the arguments object does not supply a slice method but can
+ * be the context object to Array.prototype.slice.
+ *
+ * @param {Array} array The array (or arguments object).
+ * @param {Number} begin The index at which to begin. Negative values are offsets from
+ * the end of the array.
+ * @param {Number} end The index at which to end. The copied items do not include
+ * end. Negative values are offsets from the end of the array. If end is omitted,
+ * all items up to the end of the array are copied.
+ * @return {Array} The copied piece of the array.
+ */
+ slice: function(array, begin, end) {
+ return slice.call(array, begin, end);
+ },
+
+ /**
+ * Sorts the elements of an Array.
+ * By default, this method sorts the elements alphabetically and ascending.
+ *
+ * @param {Array} array The array to sort.
+ * @param {Function} sortFn (optional) The comparison function.
+ * @return {Array} The sorted array.
+ */
+ sort: function(array, sortFn) {
+ if (supportsSort) {
+ if (sortFn) {
+ return array.sort(sortFn);
+ } else {
+ return array.sort();
+ }
+ }
+
+ var length = array.length,
+ i = 0,
+ comparison,
+ j, min, tmp;
+
+ for (; i < length; i++) {
+ min = i;
+ for (j = i + 1; j < length; j++) {
+ if (sortFn) {
+ comparison = sortFn(array[j], array[min]);
+ if (comparison < 0) {
+ min = j;
+ }
+ } else if (array[j] < array[min]) {
+ min = j;
+ }
+ }
+ if (min !== i) {
+ tmp = array[i];
+ array[i] = array[min];
+ array[min] = tmp;
+ }
+ }
+
+ return array;
+ },
+
+ /**
+ * Recursively flattens into 1-d Array. Injects Arrays inline.
+ *
+ */
+ flatten: function(array) {
+ var worker = [];
+
+ function rFlatten(a) {
+ var i, ln, v;
+
+ for (i = 0, ln = a.length; i < ln; i++) {
+ v = a[i];
+
+ if (Ext.isArray(v)) {
+ rFlatten(v);
+ } else {
+ worker.push(v);
+ }
+ }
+
+ return worker;
+ }
+
+ return rFlatten(array);
+ },
+
+ /**
+ * Returns the minimum value in the Array.
+ *
+ * @param {Array|NodeList} array The Array from which to select the minimum value.
+ * @param {Function} comparisonFn (optional) a function to perform the comparision which determines minimization.
+ * If omitted the "<" operator will be used. Note: gt = 1; eq = 0; lt = -1
+ * @return {Mixed} minValue The minimum value
+ */
+ min: function(array, comparisonFn) {
+ var min = array[0],
+ i, ln, item;
+
+ for (i = 0, ln = array.length; i < ln; i++) {
+ item = array[i];
+
+ if (comparisonFn) {
+ if (comparisonFn(min, item) === 1) {
+ min = item;
+ }
+ }
+ else {
+ if (item < min) {
+ min = item;
+ }
+ }
+ }
+
+ return min;
+ },
+
+ /**
+ * Returns the maximum value in the Array.
+ *
+ * @param {Array|NodeList} array The Array from which to select the maximum value.
+ * @param {Function} comparisonFn (optional) a function to perform the comparision which determines maximization.
+ * If omitted the ">" operator will be used. Note: gt = 1; eq = 0; lt = -1
+ * @return {Mixed} maxValue The maximum value
+ */
+ max: function(array, comparisonFn) {
+ var max = array[0],
+ i, ln, item;
+
+ for (i = 0, ln = array.length; i < ln; i++) {
+ item = array[i];
+
+ if (comparisonFn) {
+ if (comparisonFn(max, item) === -1) {
+ max = item;
+ }
+ }
+ else {
+ if (item > max) {
+ max = item;
+ }
+ }
+ }
+
+ return max;
+ },
+
+ /**
+ * Calculates the mean of all items in the array.
+ *
+ * @param {Array} array The Array to calculate the mean value of.
+ * @return {Number} The mean.
+ */
+ mean: function(array) {
+ return array.length > 0 ? ExtArray.sum(array) / array.length : undefined;
+ },
+
+ /**
+ * Calculates the sum of all items in the given array.
+ *
+ * @param {Array} array The Array to calculate the sum value of.
+ * @return {Number} The sum.
+ */
+ sum: function(array) {
+ var sum = 0,
+ i, ln, item;
+
+ for (i = 0,ln = array.length; i < ln; i++) {
+ item = array[i];
+
+ sum += item;
+ }
+
+ return sum;
+ },
+
+ _replaceSim: replaceSim, // for unit testing
+ _spliceSim: spliceSim,
+
+ /**
+ * Removes items from an array. This is functionally equivalent to the splice method
+ * of Array, but works around bugs in IE8's splice method and does not copy the
+ * removed elements in order to return them (because very often they are ignored).
+ *
+ * @param {Array} array The Array on which to replace.
+ * @param {Number} index The index in the array at which to operate.
+ * @param {Number} removeCount The number of items to remove at index.
+ * @return {Array} The array passed.
+ * @method
+ */
+ erase: erase,
+
+ /**
+ * Inserts items in to an array.
+ *
+ * @param {Array} array The Array on which to replace.
+ * @param {Number} index The index in the array at which to operate.
+ * @param {Array} items The array of items to insert at index.
+ * @return {Array} The array passed.
+ */
+ insert: function (array, index, items) {
+ return replace(array, index, 0, items);
+ },
+
+ /**
+ * Replaces items in an array. This is functionally equivalent to the splice method
+ * of Array, but works around bugs in IE8's splice method and is often more convenient
+ * to call because it accepts an array of items to insert rather than use a variadic
+ * argument list.
+ *
+ * @param {Array} array The Array on which to replace.
+ * @param {Number} index The index in the array at which to operate.
+ * @param {Number} removeCount The number of items to remove at index (can be 0).
+ * @param {Array} insert An optional array of items to insert at index.
+ * @return {Array} The array passed.
+ * @method
+ */
+ replace: replace,
+
+ /**
+ * Replaces items in an array. This is equivalent to the splice method of Array, but
+ * works around bugs in IE8's splice method. The signature is exactly the same as the
+ * splice method except that the array is the first argument. All arguments following
+ * removeCount are inserted in the array at index.
+ *
+ * @param {Array} array The Array on which to replace.
+ * @param {Number} index The index in the array at which to operate.
+ * @param {Number} removeCount The number of items to remove at index (can be 0).
+ * @return {Array} An array containing the removed items.
+ * @method
+ */
+ splice: splice
+ };
+
+ /**
+ * @method
+ * @member Ext
+ * @alias Ext.Array#each
+ */
+ Ext.each = ExtArray.each;
+
+ /**
+ * @method
+ * @member Ext.Array
+ * @alias Ext.Array#merge
+ */
+ ExtArray.union = ExtArray.merge;
+
+ /**
+ * Old alias to {@link Ext.Array#min}
+ * @deprecated 4.0.0 Use {@link Ext.Array#min} instead
+ * @method
+ * @member Ext
+ * @alias Ext.Array#min
+ */
+ Ext.min = ExtArray.min;
+
+ /**
+ * Old alias to {@link Ext.Array#max}
+ * @deprecated 4.0.0 Use {@link Ext.Array#max} instead
+ * @method
+ * @member Ext
+ * @alias Ext.Array#max
+ */
+ Ext.max = ExtArray.max;
+
+ /**
+ * Old alias to {@link Ext.Array#sum}
+ * @deprecated 4.0.0 Use {@link Ext.Array#sum} instead
+ * @method
+ * @member Ext
+ * @alias Ext.Array#sum
+ */
+ Ext.sum = ExtArray.sum;
+
+ /**
+ * Old alias to {@link Ext.Array#mean}
+ * @deprecated 4.0.0 Use {@link Ext.Array#mean} instead
+ * @method
+ * @member Ext
+ * @alias Ext.Array#mean
+ */
+ Ext.mean = ExtArray.mean;
+
+ /**
+ * Old alias to {@link Ext.Array#flatten}
+ * @deprecated 4.0.0 Use {@link Ext.Array#flatten} instead
+ * @method
+ * @member Ext
+ * @alias Ext.Array#flatten
+ */
+ Ext.flatten = ExtArray.flatten;
+
+ /**
+ * Old alias to {@link Ext.Array#clean}
+ * @deprecated 4.0.0 Use {@link Ext.Array#clean} instead
+ * @method
+ * @member Ext
+ * @alias Ext.Array#clean
+ */
+ Ext.clean = ExtArray.clean;
+
+ /**
+ * Old alias to {@link Ext.Array#unique}
+ * @deprecated 4.0.0 Use {@link Ext.Array#unique} instead
+ * @method
+ * @member Ext
+ * @alias Ext.Array#unique
+ */
+ Ext.unique = ExtArray.unique;
+
+ /**
+ * Old alias to {@link Ext.Array#pluck Ext.Array.pluck}
+ * @deprecated 4.0.0 Use {@link Ext.Array#pluck Ext.Array.pluck} instead
+ * @method
+ * @member Ext
+ * @alias Ext.Array#pluck
+ */
+ Ext.pluck = ExtArray.pluck;
+
+ /**
+ * @method
+ * @member Ext
+ * @alias Ext.Array#toArray
+ */
+ Ext.toArray = function() {
+ return ExtArray.toArray.apply(ExtArray, arguments);
+ };
+})();
+
+/**
+ * @class Ext.Function
+ *
+ * A collection of useful static methods to deal with function callbacks
+ * @singleton
+ */
+Ext.Function = {
+
+ /**
+ * A very commonly used method throughout the framework. It acts as a wrapper around another method
+ * which originally accepts 2 arguments for `name` and `value`.
+ * The wrapped function then allows "flexible" value setting of either:
+ *
+ * - `name` and `value` as 2 arguments
+ * - one single object argument with multiple key - value pairs
+ *
+ * For example:
+ *
+ * var setValue = Ext.Function.flexSetter(function(name, value) {
+ * this[name] = value;
+ * });
+ *
+ * // Afterwards
+ * // Setting a single name - value
+ * setValue('name1', 'value1');
+ *
+ * // Settings multiple name - value pairs
+ * setValue({
+ * name1: 'value1',
+ * name2: 'value2',
+ * name3: 'value3'
+ * });
+ *
+ * @param {Function} setter
+ * @returns {Function} flexSetter
+ */
+ flexSetter: function(fn) {
+ return function(a, b) {
+ var k, i;
+
+ if (a === null) {
+ return this;
+ }
+
+ if (typeof a !== 'string') {
+ for (k in a) {
+ if (a.hasOwnProperty(k)) {
+ fn.call(this, k, a[k]);
+ }
+ }
+
+ if (Ext.enumerables) {
+ for (i = Ext.enumerables.length; i--;) {
+ k = Ext.enumerables[i];
+ if (a.hasOwnProperty(k)) {
+ fn.call(this, k, a[k]);
+ }
+ }
+ }
+ } else {
+ fn.call(this, a, b);
+ }
+
+ return this;
+ };
+ },
+
+ /**
+ * Create a new function from the provided `fn`, change `this` to the provided scope, optionally
+ * overrides arguments for the call. (Defaults to the arguments passed by the caller)
+ *
+ * {@link Ext#bind Ext.bind} is alias for {@link Ext.Function#bind Ext.Function.bind}
+ *
+ * @param {Function} fn The function to delegate.
+ * @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
+ * @return {Function} The new function
+ */
+ bind: function(fn, scope, args, appendArgs) {
+ var method = fn,
+ slice = Array.prototype.slice;
+
+ return function() {
+ var callArgs = args || arguments;
+
+ if (appendArgs === true) {
+ callArgs = slice.call(arguments, 0);
+ callArgs = callArgs.concat(args);
+ }
+ else if (Ext.isNumber(appendArgs)) {
+ callArgs = slice.call(arguments, 0); // copy arguments first
+ Ext.Array.insert(callArgs, appendArgs, args);
+ }
+
+ return method.apply(scope || window, callArgs);
+ };
+ },
+
+ /**
+ * Create a new function from the provided `fn`, the arguments of which are pre-set to `args`.
+ * New arguments passed to the newly created callback when it's invoked are appended after the pre-set ones.
+ * This is especially useful when creating callbacks.
+ *
+ * For example:
+ *
+ * var originalFunction = function(){
+ * alert(Ext.Array.from(arguments).join(' '));
+ * };
+ *
+ * var callback = Ext.Function.pass(originalFunction, ['Hello', 'World']);
+ *
+ * callback(); // alerts 'Hello World'
+ * callback('by Me'); // alerts 'Hello World by Me'
+ *
+ * {@link Ext#pass Ext.pass} is alias for {@link Ext.Function#pass Ext.Function.pass}
+ *
+ * @param {Function} fn The original function
+ * @param {Array} args The arguments to pass to new callback
+ * @param {Object} scope (optional) The scope (`this` reference) in which the function is executed.
+ * @return {Function} The new callback function
+ */
+ pass: function(fn, args, scope) {
+ if (args) {
+ args = Ext.Array.from(args);
+ }
+
+ return function() {
+ return fn.apply(scope, args.concat(Ext.Array.toArray(arguments)));
+ };
+ },
+
+ /**
+ * Create an alias to the provided method property with name `methodName` of `object`.
+ * Note that the execution scope will still be bound to the provided `object` itself.
+ *
+ * @param {Object/Function} object
+ * @param {String} methodName
+ * @return {Function} aliasFn
+ */
+ alias: function(object, methodName) {
+ return function() {
+ return object[methodName].apply(object, arguments);
+ };
+ },
+
+ /**
+ * 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 function is called with the parameters of the original function. Example usage:
+ *
+ * var sayHi = function(name){
+ * alert('Hi, ' + name);
+ * }
+ *
+ * sayHi('Fred'); // alerts "Hi, Fred"
+ *
+ * // create a new function that validates input without
+ * // directly modifying the original function:
+ * var sayHiToFriend = Ext.Function.createInterceptor(sayHi, function(name){
+ * return name == 'Brian';
+ * });
+ *
+ * sayHiToFriend('Fred'); // no alert
+ * sayHiToFriend('Brian'); // alerts "Hi, Brian"
+ *
+ * @param {Function} origFn The original function.
+ * @param {Function} newFn The function to call before the original
+ * @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.**
+ * @param {Mixed} returnValue (optional) The value to return if the passed function return false (defaults to null).
+ * @return {Function} The new function
+ */
+ createInterceptor: function(origFn, newFn, scope, returnValue) {
+ var method = origFn;
+ if (!Ext.isFunction(newFn)) {
+ return origFn;
+ }
+ else {
+ return function() {
+ var me = this,
+ args = arguments;
+ newFn.target = me;
+ newFn.method = origFn;
+ return (newFn.apply(scope || me || window, args) !== false) ? origFn.apply(me || window, args) : returnValue || null;
+ };
+ }
+ },
+
+ /**
+ * Creates a delegate (callback) which, when called, executes after a specific delay.
+ *
+ * @param {Function} fn The function which will be called on a delay when the returned function is called.
+ * Optionally, a replacement (or additional) argument list may be specified.
+ * @param {Number} delay The number of milliseconds to defer execution by whenever called.
+ * @param {Object} scope (optional) The scope (`this` reference) used by the function at execution time.
+ * @param {Array} args (optional) Override 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.
+ * @return {Function} A function which, when called, executes the original function after the specified delay.
+ */
+ createDelayed: function(fn, delay, scope, args, appendArgs) {
+ if (scope || args) {
+ fn = Ext.Function.bind(fn, scope, args, appendArgs);
+ }
+ return function() {
+ var me = this;
+ setTimeout(function() {
+ fn.apply(me, arguments);
+ }, delay);
+ };
+ },
+
+ /**
+ * Calls this function after the number of millseconds specified, optionally in a specific scope. Example usage:
+ *
+ * var sayHi = function(name){
+ * alert('Hi, ' + name);
+ * }
+ *
+ * // executes immediately:
+ * sayHi('Fred');
+ *
+ * // executes after 2 seconds:
+ * Ext.Function.defer(sayHi, 2000, this, ['Fred']);
+ *
+ * // this syntax is sometimes useful for deferring
+ * // execution of an anonymous function:
+ * Ext.Function.defer(function(){
+ * alert('Anonymous');
+ * }, 100);
+ *
+ * {@link Ext#defer Ext.defer} is alias for {@link Ext.Function#defer Ext.Function.defer}
+ *
+ * @param {Function} fn The function to defer.
+ * @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} 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
+ * @return {Number} The timeout id that can be used with clearTimeout
+ */
+ defer: function(fn, millis, obj, args, appendArgs) {
+ fn = Ext.Function.bind(fn, obj, args, appendArgs);
+ if (millis > 0) {
+ return setTimeout(fn, millis);
+ }
+ fn();
+ return 0;
+ },
+
+ /**
+ * Create a combined function call sequence of the original function + the passed function.
+ * The resulting function returns the results of the original function.
+ * The passed function is called with the parameters of the original function. Example usage:
+ *
+ * var sayHi = function(name){
+ * alert('Hi, ' + name);
+ * }
+ *
+ * sayHi('Fred'); // alerts "Hi, Fred"
+ *
+ * var sayGoodbye = Ext.Function.createSequence(sayHi, function(name){
+ * alert('Bye, ' + name);
+ * });
+ *
+ * sayGoodbye('Fred'); // both alerts show
+ *
+ * @param {Function} origFn The original function.
+ * @param {Function} newFn The function to sequence
+ * @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(origFn, newFn, scope) {
+ if (!Ext.isFunction(newFn)) {
+ return origFn;
+ }
+ else {
+ return function() {
+ var retval = origFn.apply(this || window, arguments);
+ newFn.apply(scope || this || window, arguments);
+ return retval;
+ };
+ }
+ },
+
+ /**
+ * Creates a delegate function, optionally with a bound scope which, when called, buffers
+ * the execution of the passed function for the configured number of milliseconds.
+ * If called again within that period, the impending invocation will be canceled, and the
+ * timeout period will begin again.
+ *
+ * @param {Function} fn The function to invoke on a buffered timer.
+ * @param {Number} buffer The number of milliseconds by which to buffer the invocation of the
+ * function.
+ * @param {Object} scope (optional) The scope (`this` reference) in which
+ * the passed function is executed. If omitted, defaults to the scope specified by the caller.
+ * @param {Array} args (optional) Override arguments for the call. Defaults to the arguments
+ * passed by the caller.
+ * @return {Function} A function which invokes the passed function after buffering for the specified time.
+ */
+ createBuffered: function(fn, buffer, scope, args) {
+ return function(){
+ var timerId;
+ return function() {
+ var me = this;
+ if (timerId) {
+ clearInterval(timerId);
+ timerId = null;
+ }
+ timerId = setTimeout(function(){
+ fn.apply(scope || me, args || arguments);
+ }, buffer);
+ };
+ }();
+ },
+
+ /**
+ * Creates a throttled version of the passed function which, when called repeatedly and
+ * rapidly, invokes the passed function only after a certain interval has elapsed since the
+ * previous invocation.
+ *
+ * This is useful for wrapping functions which may be called repeatedly, such as
+ * a handler of a mouse move event when the processing is expensive.
+ *
+ * @param {Function} fn The function to execute at a regular time interval.
+ * @param {Number} interval The interval **in milliseconds** on which the passed function is executed.
+ * @param {Object} scope (optional) The scope (`this` reference) in which
+ * the passed function is executed. If omitted, defaults to the scope specified by the caller.
+ * @returns {Function} A function which invokes the passed function at the specified interval.
+ */
+ createThrottled: function(fn, interval, scope) {
+ var lastCallTime, elapsed, lastArgs, timer, execute = function() {
+ fn.apply(scope || this, lastArgs);
+ lastCallTime = new Date().getTime();
+ };
+
+ return function() {
+ elapsed = new Date().getTime() - lastCallTime;
+ lastArgs = arguments;
+
+ clearTimeout(timer);
+ if (!lastCallTime || (elapsed >= interval)) {
+ execute();
+ } else {
+ timer = setTimeout(execute, interval - elapsed);
+ }
+ };
+ }
+};
+
+/**
+ * @method
+ * @member Ext
+ * @alias Ext.Function#defer
+ */
+Ext.defer = Ext.Function.alias(Ext.Function, 'defer');
+
+/**
+ * @method
+ * @member Ext
+ * @alias Ext.Function#pass
+ */
+Ext.pass = Ext.Function.alias(Ext.Function, 'pass');
+
+/**
+ * @method
+ * @member Ext
+ * @alias Ext.Function#bind
+ */
+Ext.bind = Ext.Function.alias(Ext.Function, 'bind');
+
+/**
+ * @author Jacky Nguyen <jacky@sencha.com>
+ * @docauthor Jacky Nguyen <jacky@sencha.com>
+ * @class Ext.Object
+ *
+ * A collection of useful static methods to deal with objects
+ *
+ * @singleton
+ */
+
+(function() {
+
+var ExtObject = Ext.Object = {
+
+ /**
+ * Convert a `name` - `value` pair to an array of objects with support for nested structures; useful to construct
+ * query strings. For example:
+
+ var objects = Ext.Object.toQueryObjects('hobbies', ['reading', 'cooking', 'swimming']);
+
+ // objects then equals:
+ [
+ { name: 'hobbies', value: 'reading' },
+ { name: 'hobbies', value: 'cooking' },
+ { name: 'hobbies', value: 'swimming' },
+ ];
+
+ var objects = Ext.Object.toQueryObjects('dateOfBirth', {
+ day: 3,
+ month: 8,
+ year: 1987,
+ extra: {
+ hour: 4
+ minute: 30
+ }
+ }, true); // Recursive
+
+ // objects then equals:
+ [
+ { name: 'dateOfBirth[day]', value: 3 },
+ { name: 'dateOfBirth[month]', value: 8 },
+ { name: 'dateOfBirth[year]', value: 1987 },
+ { name: 'dateOfBirth[extra][hour]', value: 4 },
+ { name: 'dateOfBirth[extra][minute]', value: 30 },
+ ];
+
+ * @param {String} name
+ * @param {Mixed} value
+ * @param {Boolean} recursive
+ * @markdown
+ */
+ toQueryObjects: function(name, value, recursive) {
+ var self = ExtObject.toQueryObjects,
+ objects = [],
+ i, ln;
+
+ if (Ext.isArray(value)) {
+ for (i = 0, ln = value.length; i < ln; i++) {
+ if (recursive) {
+ objects = objects.concat(self(name + '[' + i + ']', value[i], true));
+ }
+ else {
+ objects.push({
+ name: name,
+ value: value[i]
+ });
+ }
+ }
+ }
+ else if (Ext.isObject(value)) {
+ for (i in value) {
+ if (value.hasOwnProperty(i)) {
+ if (recursive) {
+ objects = objects.concat(self(name + '[' + i + ']', value[i], true));
+ }
+ else {
+ objects.push({
+ name: name,
+ value: value[i]
+ });
+ }
+ }
+ }
+ }
+ else {
+ objects.push({
+ name: name,
+ value: value
+ });
+ }
+
+ return objects;
+ },
+
+ /**
+ * Takes an object and converts it to an encoded query string
+
+- Non-recursive:
+
+ Ext.Object.toQueryString({foo: 1, bar: 2}); // returns "foo=1&bar=2"
+ Ext.Object.toQueryString({foo: null, bar: 2}); // returns "foo=&bar=2"
+ Ext.Object.toQueryString({'some price': '$300'}); // returns "some%20price=%24300"
+ Ext.Object.toQueryString({date: new Date(2011, 0, 1)}); // returns "date=%222011-01-01T00%3A00%3A00%22"
+ Ext.Object.toQueryString({colors: ['red', 'green', 'blue']}); // returns "colors=red&colors=green&colors=blue"
+
+- Recursive:
+
+ Ext.Object.toQueryString({
+ username: 'Jacky',
+ dateOfBirth: {
+ day: 1,
+ month: 2,
+ year: 1911
+ },
+ hobbies: ['coding', 'eating', 'sleeping', ['nested', 'stuff']]
+ }, true); // returns the following string (broken down and url-decoded for ease of reading purpose):
+ // username=Jacky
+ // &dateOfBirth[day]=1&dateOfBirth[month]=2&dateOfBirth[year]=1911
+ // &hobbies[0]=coding&hobbies[1]=eating&hobbies[2]=sleeping&hobbies[3][0]=nested&hobbies[3][1]=stuff
+
+ *
+ * @param {Object} object The object to encode
+ * @param {Boolean} recursive (optional) Whether or not to interpret the object in recursive format.
+ * (PHP / Ruby on Rails servers and similar). Defaults to false
+ * @return {String} queryString
+ * @markdown
+ */
+ toQueryString: function(object, recursive) {
+ var paramObjects = [],
+ params = [],
+ i, j, ln, paramObject, value;
+
+ for (i in object) {
+ if (object.hasOwnProperty(i)) {
+ paramObjects = paramObjects.concat(ExtObject.toQueryObjects(i, object[i], recursive));
+ }
+ }
+
+ for (j = 0, ln = paramObjects.length; j < ln; j++) {
+ paramObject = paramObjects[j];
+ value = paramObject.value;
+
+ if (Ext.isEmpty(value)) {
+ value = '';
+ }
+ else if (Ext.isDate(value)) {
+ value = Ext.Date.toString(value);
+ }
+
+ params.push(encodeURIComponent(paramObject.name) + '=' + encodeURIComponent(String(value)));
+ }
+
+ return params.join('&');
+ },
+
+ /**
+ * Converts a query string back into an object.
+ *
+- Non-recursive:
+
+ Ext.Object.fromQueryString(foo=1&bar=2); // returns {foo: 1, bar: 2}
+ Ext.Object.fromQueryString(foo=&bar=2); // returns {foo: null, bar: 2}
+ Ext.Object.fromQueryString(some%20price=%24300); // returns {'some price': '$300'}
+ Ext.Object.fromQueryString(colors=red&colors=green&colors=blue); // returns {colors: ['red', 'green', 'blue']}
+
+- Recursive:
+
+ Ext.Object.fromQueryString("username=Jacky&dateOfBirth[day]=1&dateOfBirth[month]=2&dateOfBirth[year]=1911&hobbies[0]=coding&hobbies[1]=eating&hobbies[2]=sleeping&hobbies[3][0]=nested&hobbies[3][1]=stuff", true);
+
+ // returns
+ {
+ username: 'Jacky',
+ dateOfBirth: {
+ day: '1',
+ month: '2',
+ year: '1911'
+ },
+ hobbies: ['coding', 'eating', 'sleeping', ['nested', 'stuff']]
+ }
+
+ * @param {String} queryString The query string to decode
+ * @param {Boolean} recursive (Optional) Whether or not to recursively decode the string. This format is supported by
+ * PHP / Ruby on Rails servers and similar. Defaults to false
+ * @return {Object}
+ */
+ fromQueryString: function(queryString, recursive) {
+ var parts = queryString.replace(/^\?/, '').split('&'),
+ object = {},
+ temp, components, name, value, i, ln,
+ part, j, subLn, matchedKeys, matchedName,
+ keys, key, nextKey;
+
+ for (i = 0, ln = parts.length; i < ln; i++) {
+ part = parts[i];
+
+ if (part.length > 0) {
+ components = part.split('=');
+ name = decodeURIComponent(components[0]);
+ value = (components[1] !== undefined) ? decodeURIComponent(components[1]) : '';
+
+ if (!recursive) {
+ if (object.hasOwnProperty(name)) {
+ if (!Ext.isArray(object[name])) {
+ object[name] = [object[name]];
+ }
+
+ object[name].push(value);
+ }
+ else {
+ object[name] = value;
+ }
+ }
+ else {
+ matchedKeys = name.match(/(\[):?([^\]]*)\]/g);
+ matchedName = name.match(/^([^\[]+)/);
+
+ if (!matchedName) {
+ Ext.Error.raise({
+ sourceClass: "Ext.Object",
+ sourceMethod: "fromQueryString",
+ queryString: queryString,
+ recursive: recursive,
+ msg: 'Malformed query string given, failed parsing name from "' + part + '"'
+ });
+ }
+
+ name = matchedName[0];
+ keys = [];
+
+ if (matchedKeys === null) {
+ object[name] = value;
+ continue;
+ }
+
+ for (j = 0, subLn = matchedKeys.length; j < subLn; j++) {
+ key = matchedKeys[j];
+ key = (key.length === 2) ? '' : key.substring(1, key.length - 1);
+ keys.push(key);
+ }
+
+ keys.unshift(name);
+
+ temp = object;
+
+ for (j = 0, subLn = keys.length; j < subLn; j++) {
+ key = keys[j];
+
+ if (j === subLn - 1) {
+ if (Ext.isArray(temp) && key === '') {
+ temp.push(value);
+ }
+ else {
+ temp[key] = value;
+ }
+ }
+ else {
+ if (temp[key] === undefined || typeof temp[key] === 'string') {
+ nextKey = keys[j+1];
+
+ temp[key] = (Ext.isNumeric(nextKey) || nextKey === '') ? [] : {};
+ }
+
+ temp = temp[key];
+ }
+ }
+ }
+ }
+ }
+
+ return object;
+ },
+
+ /**
+ * Iterate through an object and invoke the given callback function for each iteration. The iteration can be stop
+ * by returning `false` in the callback function. For example:
+
+ var person = {
+ name: 'Jacky'
+ hairColor: 'black'
+ loves: ['food', 'sleeping', 'wife']
+ };
+
+ Ext.Object.each(person, function(key, value, myself) {
+ console.log(key + ":" + value);
+
+ if (key === 'hairColor') {
+ return false; // stop the iteration
+ }
+ });
+
+ * @param {Object} object The object to iterate
+ * @param {Function} fn The callback function. Passed arguments for each iteration are:
+
+- {String} `key`
+- {Mixed} `value`
+- {Object} `object` The object itself
+
+ * @param {Object} scope (Optional) The execution scope (`this`) of the callback function
+ * @markdown
+ */
+ each: function(object, fn, scope) {
+ for (var property in object) {
+ if (object.hasOwnProperty(property)) {
+ if (fn.call(scope || object, property, object[property], object) === false) {
+ return;
+ }
+ }
+ }
+ },
+
+ /**
+ * Merges any number of objects recursively without referencing them or their children.
+
+ var extjs = {
+ companyName: 'Ext JS',
+ products: ['Ext JS', 'Ext GWT', 'Ext Designer'],
+ isSuperCool: true
+ office: {
+ size: 2000,
+ location: 'Palo Alto',
+ isFun: true
+ }
+ };
+
+ var newStuff = {
+ companyName: 'Sencha Inc.',
+ products: ['Ext JS', 'Ext GWT', 'Ext Designer', 'Sencha Touch', 'Sencha Animator'],
+ office: {
+ size: 40000,
+ location: 'Redwood City'
+ }
+ };
+
+ var sencha = Ext.Object.merge(extjs, newStuff);
+
+ // extjs and sencha then equals to
+ {
+ companyName: 'Sencha Inc.',
+ products: ['Ext JS', 'Ext GWT', 'Ext Designer', 'Sencha Touch', 'Sencha Animator'],
+ isSuperCool: true
+ office: {
+ size: 30000,
+ location: 'Redwood City'
+ isFun: true
+ }
+ }
+
+ * @param {Object} object,...
+ * @return {Object} merged The object that is created as a result of merging all the objects passed in.
+ * @markdown
+ */
+ merge: function(source, key, value) {
+ if (typeof key === 'string') {
+ if (value && value.constructor === Object) {
+ if (source[key] && source[key].constructor === Object) {
+ ExtObject.merge(source[key], value);
+ }
+ else {
+ source[key] = Ext.clone(value);
+ }
+ }
+ else {
+ source[key] = value;
+ }
+
+ return source;
+ }
+
+ var i = 1,
+ ln = arguments.length,
+ object, property;
+
+ for (; i < ln; i++) {
+ object = arguments[i];
+
+ for (property in object) {
+ if (object.hasOwnProperty(property)) {
+ ExtObject.merge(source, property, object[property]);
+ }
+ }
+ }
+
+ return source;
+ },
+
+ /**
+ * Returns the first matching key corresponding to the given value.
+ * If no matching value is found, null is returned.
+
+ var person = {
+ name: 'Jacky',
+ loves: 'food'
+ };
+
+ alert(Ext.Object.getKey(sencha, 'loves')); // alerts 'food'
+
+ * @param {Object} object
+ * @param {Object} value The value to find
+ * @markdown
+ */
+ getKey: function(object, value) {
+ for (var property in object) {
+ if (object.hasOwnProperty(property) && object[property] === value) {
+ return property;
+ }
+ }
+
+ return null;
+ },
+
+ /**
+ * Gets all values of the given object as an array.
+
+ var values = Ext.Object.getValues({
+ name: 'Jacky',
+ loves: 'food'
+ }); // ['Jacky', 'food']
+
+ * @param {Object} object
+ * @return {Array} An array of values from the object
+ * @markdown
+ */
+ getValues: function(object) {
+ var values = [],
+ property;
+
+ for (property in object) {
+ if (object.hasOwnProperty(property)) {
+ values.push(object[property]);
+ }
+ }
+
+ return values;
+ },
+
+ /**
+ * Gets all keys of the given object as an array.
+
+ var values = Ext.Object.getKeys({
+ name: 'Jacky',
+ loves: 'food'
+ }); // ['name', 'loves']
+
+ * @param {Object} object
+ * @return {Array} An array of keys from the object
+ * @method
+ */
+ getKeys: ('keys' in Object.prototype) ? Object.keys : function(object) {
+ var keys = [],
+ property;
+
+ for (property in object) {
+ if (object.hasOwnProperty(property)) {
+ keys.push(property);
+ }
+ }
+
+ return keys;
+ },
+
+ /**
+ * Gets the total number of this object's own properties
+
+ var size = Ext.Object.getSize({
+ name: 'Jacky',
+ loves: 'food'
+ }); // size equals 2
+
+ * @param {Object} object
+ * @return {Number} size
+ * @markdown
+ */
+ getSize: function(object) {
+ var size = 0,
+ property;
+
+ for (property in object) {
+ if (object.hasOwnProperty(property)) {
+ size++;
+ }
+ }
+
+ return size;
+ }
+};
+
+
+/**
+ * A convenient alias method for {@link Ext.Object#merge}
+ *
+ * @member Ext
+ * @method merge
+ */
+Ext.merge = Ext.Object.merge;
+
+/**
+ * A convenient alias method for {@link Ext.Object#toQueryString}
+ *
+ * @member Ext
+ * @method urlEncode
+ * @deprecated 4.0.0 Use {@link Ext.Object#toQueryString Ext.Object.toQueryString} instead
+ */
+Ext.urlEncode = function() {
+ var args = Ext.Array.from(arguments),
+ prefix = '';
+
+ // Support for the old `pre` argument
+ if ((typeof args[1] === 'string')) {
+ prefix = args[1] + '&';
+ args[1] = false;
+ }
+
+ return prefix + Ext.Object.toQueryString.apply(Ext.Object, args);
+};
+
+/**
+ * A convenient alias method for {@link Ext.Object#fromQueryString}
+ *
+ * @member Ext
+ * @method urlDecode
+ * @deprecated 4.0.0 Use {@link Ext.Object#fromQueryString Ext.Object.fromQueryString} instead
+ */
+Ext.urlDecode = function() {
+ return Ext.Object.fromQueryString.apply(Ext.Object, arguments);
+};
+
+})();
+
+/**
+ * @class Ext.Date
+ * A set of useful static methods to deal with date
+ * Note that if Ext.Date is required and loaded, it will copy all methods / properties to
+ * this object for convenience
+ *
+ * The date parsing and formatting syntax contains a subset of
+ * <a href="http://www.php.net/date">PHP's date() function</a>, and the formats that are
+ * supported will provide results equivalent to their PHP versions.
+ *
+ * The following is a list of all currently supported formats:
+ * <pre class="">
+Format Description Example returned values
+------ ----------------------------------------------------------------------- -----------------------
+ d Day of the month, 2 digits with leading zeros 01 to 31
+ D A short textual representation of the day of the week Mon to Sun
+ j Day of the month without leading zeros 1 to 31
+ l A full textual representation of the day of the week Sunday to Saturday
+ N ISO-8601 numeric representation of the day of the week 1 (for Monday) through 7 (for Sunday)
+ S English ordinal suffix for the day of the month, 2 characters st, nd, rd or th. Works well with j
+ w Numeric representation of the day of the week 0 (for Sunday) to 6 (for Saturday)
+ z The day of the year (starting from 0) 0 to 364 (365 in leap years)
+ W ISO-8601 week number of year, weeks starting on Monday 01 to 53
+ F A full textual representation of a month, such as January or March January to December
+ m Numeric representation of a month, with leading zeros 01 to 12
+ M A short textual representation of a month Jan to Dec
+ n Numeric representation of a month, without leading zeros 1 to 12
+ t Number of days in the given month 28 to 31
+ L Whether it&#39;s a leap year 1 if it is a leap year, 0 otherwise.
+ o ISO-8601 year number (identical to (Y), but if the ISO week number (W) Examples: 1998 or 2004
+ belongs to the previous or next year, that year is used instead)
+ Y A full numeric representation of a year, 4 digits Examples: 1999 or 2003
+ y A two digit representation of a year Examples: 99 or 03
+ a Lowercase Ante meridiem and Post meridiem am or pm
+ A Uppercase Ante meridiem and Post meridiem AM or PM
+ g 12-hour format of an hour without leading zeros 1 to 12
+ G 24-hour format of an hour without leading zeros 0 to 23
+ h 12-hour format of an hour with leading zeros 01 to 12
+ H 24-hour format of an hour with leading zeros 00 to 23
+ i Minutes, with leading zeros 00 to 59
+ s Seconds, with leading zeros 00 to 59
+ u Decimal fraction of a second Examples:
+ (minimum 1 digit, arbitrary number of digits allowed) 001 (i.e. 0.001s) or
+ 100 (i.e. 0.100s) or
+ 999 (i.e. 0.999s) or
+ 999876543210 (i.e. 0.999876543210s)
+ O Difference to Greenwich time (GMT) in hours and minutes Example: +1030
+ P Difference to Greenwich time (GMT) with colon between hours and minutes Example: -08:00
+ T Timezone abbreviation of the machine running the code Examples: EST, MDT, PDT ...
+ Z Timezone offset in seconds (negative if west of UTC, positive if east) -43200 to 50400
+ c ISO 8601 date
+ Notes: Examples:
+ 1) If unspecified, the month / day defaults to the current month / day, 1991 or
+ the time defaults to midnight, while the timezone defaults to the 1992-10 or
+ browser's timezone. If a time is specified, it must include both hours 1993-09-20 or
+ and minutes. The "T" delimiter, seconds, milliseconds and timezone 1994-08-19T16:20+01:00 or
+ are optional. 1995-07-18T17:21:28-02:00 or
+ 2) The decimal fraction of a second, if specified, must contain at 1996-06-17T18:22:29.98765+03:00 or
+ least 1 digit (there is no limit to the maximum number 1997-05-16T19:23:30,12345-0400 or
+ of digits allowed), and may be delimited by either a '.' or a ',' 1998-04-15T20:24:31.2468Z or
+ Refer to the examples on the right for the various levels of 1999-03-14T20:24:32Z or
+ date-time granularity which are supported, or see 2000-02-13T21:25:33
+ http://www.w3.org/TR/NOTE-datetime for more info. 2001-01-12 22:26:34
+ U Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) 1193432466 or -2138434463
+ MS Microsoft AJAX serialized dates \/Date(1238606590509)\/ (i.e. UTC milliseconds since epoch) or
+ \/Date(1238606590509+0800)\/
+</pre>
+ *
+ * Example usage (note that you must escape format specifiers with '\\' to render them as character literals):
+ * <pre><code>
+// Sample date:
+// 'Wed Jan 10 2007 15:05:01 GMT-0600 (Central Standard Time)'
+
+var dt = new Date('1/10/2007 03:05:01 PM GMT-0600');
+console.log(Ext.Date.format(dt, 'Y-m-d')); // 2007-01-10
+console.log(Ext.Date.format(dt, 'F j, Y, g:i a')); // January 10, 2007, 3:05 pm
+console.log(Ext.Date.format(dt, 'l, \\t\\he jS \\of F Y h:i:s A')); // Wednesday, the 10th of January 2007 03:05:01 PM
+</code></pre>
+ *
+ * Here are some standard date/time patterns that you might find helpful. They
+ * are not part of the source of Ext.Date, but to use them you can simply copy this
+ * block of code into any script that is included after Ext.Date and they will also become
+ * globally available on the Date object. Feel free to add or remove patterns as needed in your code.
+ * <pre><code>
+Ext.Date.patterns = {
+ ISO8601Long:"Y-m-d H:i:s",
+ ISO8601Short:"Y-m-d",
+ ShortDate: "n/j/Y",
+ LongDate: "l, F d, Y",
+ FullDateTime: "l, F d, Y g:i:s A",
+ MonthDay: "F d",
+ ShortTime: "g:i A",
+ LongTime: "g:i:s A",
+ SortableDateTime: "Y-m-d\\TH:i:s",
+ UniversalSortableDateTime: "Y-m-d H:i:sO",
+ YearMonth: "F, Y"
+};
+</code></pre>
+ *
+ * Example usage:
+ * <pre><code>
+var dt = new Date();
+console.log(Ext.Date.format(dt, Ext.Date.patterns.ShortDate));
+</code></pre>
+ * <p>Developer-written, custom formats may be used by supplying both a formatting and a parsing function
+ * which perform to specialized requirements. The functions are stored in {@link #parseFunctions} and {@link #formatFunctions}.</p>
+ * @singleton
+ */
+
+/*
+ * Most of the date-formatting functions below are the excellent work of Baron Schwartz.
+ * (see http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/)
+ * They generate precompiled functions from format patterns instead of parsing and
+ * processing each pattern every time a date is formatted. These functions are available
+ * on every Date object.
+ */
+
+(function() {
+
+// create private copy of Ext's Ext.util.Format.format() method
+// - to remove unnecessary dependency
+// - to resolve namespace conflict with MS-Ajax's implementation
+function xf(format) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ return format.replace(/\{(\d+)\}/g, function(m, i) {
+ return args[i];
+ });
+}
+
+Ext.Date = {
+ /**
+ * Returns the current timestamp
+ * @return {Date} The current timestamp
+ * @method
+ */
+ now: Date.now || function() {
+ return +new Date();
+ },
+
+ /**
+ * @private
+ * Private for now
+ */
+ toString: function(date) {
+ var pad = Ext.String.leftPad;
+
+ return date.getFullYear() + "-"
+ + pad(date.getMonth() + 1, 2, '0') + "-"
+ + pad(date.getDate(), 2, '0') + "T"
+ + pad(date.getHours(), 2, '0') + ":"
+ + pad(date.getMinutes(), 2, '0') + ":"
+ + pad(date.getSeconds(), 2, '0');
+ },
+
+ /**
+ * Returns the number of milliseconds between two dates
+ * @param {Date} dateA The first date
+ * @param {Date} dateB (optional) The second date, defaults to now
+ * @return {Number} The difference in milliseconds
+ */
+ getElapsed: function(dateA, dateB) {
+ return Math.abs(dateA - (dateB || new Date()));
+ },
+
+ /**
+ * Global flag which determines if strict date parsing should be used.
+ * Strict date parsing will not roll-over invalid dates, which is the
+ * default behaviour of javascript Date objects.
+ * (see {@link #parse} for more information)
+ * Defaults to <tt>false</tt>.
+ * @static
+ * @type Boolean
+ */
+ useStrict: false,
+
+ // private
+ formatCodeToRegex: function(character, currentGroup) {
+ // Note: currentGroup - position in regex result array (see notes for Ext.Date.parseCodes below)
+ var p = utilDate.parseCodes[character];
+
+ if (p) {
+ p = typeof p == 'function'? p() : p;
+ utilDate.parseCodes[character] = p; // reassign function result to prevent repeated execution
+ }
+
+ return p ? Ext.applyIf({
+ c: p.c ? xf(p.c, currentGroup || "{0}") : p.c
+ }, p) : {
+ g: 0,
+ c: null,
+ s: Ext.String.escapeRegex(character) // treat unrecognised characters as literals
+ };
+ },
+
+ /**
+ * <p>An object hash in which each property is a date parsing function. The property name is the
+ * format string which that function parses.</p>
+ * <p>This object is automatically populated with date parsing functions as
+ * date formats are requested for Ext standard formatting strings.</p>
+ * <p>Custom parsing functions may be inserted into this object, keyed by a name which from then on
+ * may be used as a format string to {@link #parse}.<p>
+ * <p>Example:</p><pre><code>
+Ext.Date.parseFunctions['x-date-format'] = myDateParser;
+</code></pre>
+ * <p>A parsing function should return a Date object, and is passed the following parameters:<div class="mdetail-params"><ul>
+ * <li><code>date</code> : String<div class="sub-desc">The date string to parse.</div></li>
+ * <li><code>strict</code> : Boolean<div class="sub-desc">True to validate date strings while parsing
+ * (i.e. prevent javascript Date "rollover") (The default must be false).
+ * Invalid date strings should return null when parsed.</div></li>
+ * </ul></div></p>
+ * <p>To enable Dates to also be <i>formatted</i> according to that format, a corresponding
+ * formatting function must be placed into the {@link #formatFunctions} property.
+ * @property parseFunctions
+ * @static
+ * @type Object
+ */
+ parseFunctions: {
+ "MS": function(input, strict) {
+ // note: the timezone offset is ignored since the MS Ajax server sends
+ // a UTC milliseconds-since-Unix-epoch value (negative values are allowed)
+ var re = new RegExp('\\/Date\\(([-+])?(\\d+)(?:[+-]\\d{4})?\\)\\/');
+ var r = (input || '').match(re);
+ return r? new Date(((r[1] || '') + r[2]) * 1) : null;
+ }
+ },
+ parseRegexes: [],
+
+ /**
+ * <p>An object hash in which each property is a date formatting function. The property name is the
+ * format string which corresponds to the produced formatted date string.</p>
+ * <p>This object is automatically populated with date formatting functions as
+ * date formats are requested for Ext standard formatting strings.</p>
+ * <p>Custom formatting functions may be inserted into this object, keyed by a name which from then on
+ * may be used as a format string to {@link #format}. Example:</p><pre><code>
+Ext.Date.formatFunctions['x-date-format'] = myDateFormatter;
+</code></pre>
+ * <p>A formatting function should return a string representation of the passed Date object, and is passed the following parameters:<div class="mdetail-params"><ul>
+ * <li><code>date</code> : Date<div class="sub-desc">The Date to format.</div></li>
+ * </ul></div></p>
+ * <p>To enable date strings to also be <i>parsed</i> according to that format, a corresponding
+ * parsing function must be placed into the {@link #parseFunctions} property.
+ * @property formatFunctions
+ * @static
+ * @type Object
+ */
+ formatFunctions: {
+ "MS": function() {
+ // UTC milliseconds since Unix epoch (MS-AJAX serialized date format (MRSF))
+ return '\\/Date(' + this.getTime() + ')\\/';
+ }
+ },
+
+ y2kYear : 50,
+
+ /**
+ * Date interval constant
+ * @static
+ * @type String
+ */
+ MILLI : "ms",
+
+ /**
+ * Date interval constant
+ * @static
+ * @type String
+ */
+ SECOND : "s",
+
+ /**
+ * Date interval constant
+ * @static
+ * @type String
+ */
+ MINUTE : "mi",
+
+ /** Date interval constant
+ * @static
+ * @type String
+ */
+ HOUR : "h",
+
+ /**
+ * Date interval constant
+ * @static
+ * @type String
+ */
+ DAY : "d",
+
+ /**
+ * Date interval constant
+ * @static
+ * @type String
+ */
+ MONTH : "mo",
+
+ /**
+ * Date interval constant
+ * @static
+ * @type String
+ */
+ YEAR : "y",
+
+ /**
+ * <p>An object hash containing default date values used during date parsing.</p>
+ * <p>The following properties are available:<div class="mdetail-params"><ul>
+ * <li><code>y</code> : Number<div class="sub-desc">The default year value. (defaults to undefined)</div></li>
+ * <li><code>m</code> : Number<div class="sub-desc">The default 1-based month value. (defaults to undefined)</div></li>
+ * <li><code>d</code> : Number<div class="sub-desc">The default day value. (defaults to undefined)</div></li>
+ * <li><code>h</code> : Number<div class="sub-desc">The default hour value. (defaults to undefined)</div></li>
+ * <li><code>i</code> : Number<div class="sub-desc">The default minute value. (defaults to undefined)</div></li>
+ * <li><code>s</code> : Number<div class="sub-desc">The default second value. (defaults to undefined)</div></li>
+ * <li><code>ms</code> : Number<div class="sub-desc">The default millisecond value. (defaults to undefined)</div></li>
+ * </ul></div></p>
+ * <p>Override these properties to customize the default date values used by the {@link #parse} method.</p>
+ * <p><b>Note: In countries which experience Daylight Saving Time (i.e. DST), the <tt>h</tt>, <tt>i</tt>, <tt>s</tt>
+ * and <tt>ms</tt> properties may coincide with the exact time in which DST takes effect.
+ * It is the responsiblity of the developer to account for this.</b></p>
+ * Example Usage:
+ * <pre><code>
+// set default day value to the first day of the month
+Ext.Date.defaults.d = 1;
+
+// parse a February date string containing only year and month values.
+// setting the default day value to 1 prevents weird date rollover issues
+// when attempting to parse the following date string on, for example, March 31st 2009.
+Ext.Date.parse('2009-02', 'Y-m'); // returns a Date object representing February 1st 2009
+</code></pre>
+ * @property defaults
+ * @static
+ * @type Object
+ */
+ defaults: {},
+
+ /**
+ * An array of textual day names.
+ * Override these values for international dates.
+ * Example:
+ * <pre><code>
+Ext.Date.dayNames = [
+ 'SundayInYourLang',
+ 'MondayInYourLang',
+ ...
+];
+</code></pre>
+ * @type Array
+ * @static
+ */
+ dayNames : [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday"
+ ],
+
+ /**
+ * An array of textual month names.
+ * Override these values for international dates.
+ * Example:
+ * <pre><code>
+Ext.Date.monthNames = [
+ 'JanInYourLang',
+ 'FebInYourLang',
+ ...
+];
+</code></pre>
+ * @type Array
+ * @static
+ */
+ monthNames : [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"
+ ],
+
+ /**
+ * An object hash of zero-based javascript month numbers (with short month names as keys. note: keys are case-sensitive).
+ * Override these values for international dates.
+ * Example:
+ * <pre><code>
+Ext.Date.monthNumbers = {
+ 'ShortJanNameInYourLang':0,
+ 'ShortFebNameInYourLang':1,
+ ...
+};
+</code></pre>
+ * @type Object
+ * @static
+ */
+ monthNumbers : {
+ Jan:0,
+ Feb:1,
+ Mar:2,
+ Apr:3,
+ May:4,
+ Jun:5,
+ Jul:6,
+ Aug:7,
+ Sep:8,
+ Oct:9,
+ Nov:10,
+ Dec:11
+ },
+ /**
+ * <p>The date format string that the {@link Ext.util.Format#dateRenderer}
+ * and {@link Ext.util.Format#date} functions use. See {@link Ext.Date} for details.</p>
+ * <p>This defaults to <code>m/d/Y</code>, but may be overridden in a locale file.</p>
+ * @property defaultFormat
+ * @static
+ * @type String
+ */
+ defaultFormat : "m/d/Y",
+ /**
+ * Get the short month name for the given month number.
+ * Override this function for international dates.
+ * @param {Number} month A zero-based javascript month number.
+ * @return {String} The short month name.
+ * @static
+ */
+ getShortMonthName : function(month) {
+ return utilDate.monthNames[month].substring(0, 3);
+ },
+
+ /**
+ * Get the short day name for the given day number.
+ * Override this function for international dates.
+ * @param {Number} day A zero-based javascript day number.
+ * @return {String} The short day name.
+ * @static
+ */
+ getShortDayName : function(day) {
+ return utilDate.dayNames[day].substring(0, 3);
+ },
+
+ /**
+ * Get the zero-based javascript month number for the given short/full month name.
+ * Override this function for international dates.
+ * @param {String} name The short/full month name.
+ * @return {Number} The zero-based javascript month number.
+ * @static
+ */
+ getMonthNumber : function(name) {
+ // handle camel casing for english month names (since the keys for the Ext.Date.monthNumbers hash are case sensitive)
+ return utilDate.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
+ },
+
+ /**
+ * Checks if the specified format contains hour information
+ * @param {String} format The format to check
+ * @return {Boolean} True if the format contains hour information
+ * @static
+ * @method
+ */
+ formatContainsHourInfo : (function(){
+ var stripEscapeRe = /(\\.)/g,
+ hourInfoRe = /([gGhHisucUOPZ]|MS)/;
+ return function(format){
+ return hourInfoRe.test(format.replace(stripEscapeRe, ''));
+ };
+ })(),
+
+ /**
+ * Checks if the specified format contains information about
+ * anything other than the time.
+ * @param {String} format The format to check
+ * @return {Boolean} True if the format contains information about
+ * date/day information.
+ * @static
+ * @method
+ */
+ formatContainsDateInfo : (function(){
+ var stripEscapeRe = /(\\.)/g,
+ dateInfoRe = /([djzmnYycU]|MS)/;
+
+ return function(format){
+ return dateInfoRe.test(format.replace(stripEscapeRe, ''));
+ };
+ })(),
+
+ /**
+ * The base format-code to formatting-function hashmap used by the {@link #format} method.
+ * Formatting functions are strings (or functions which return strings) which
+ * will return the appropriate value when evaluated in the context of the Date object
+ * from which the {@link #format} method is called.
+ * Add to / override these mappings for custom date formatting.
+ * Note: Ext.Date.format() treats characters as literals if an appropriate mapping cannot be found.
+ * Example:
+ * <pre><code>
+Ext.Date.formatCodes.x = "Ext.util.Format.leftPad(this.getDate(), 2, '0')";
+console.log(Ext.Date.format(new Date(), 'X'); // returns the current day of the month
+</code></pre>
+ * @type Object
+ * @static
+ */
+ formatCodes : {
+ d: "Ext.String.leftPad(this.getDate(), 2, '0')",
+ D: "Ext.Date.getShortDayName(this.getDay())", // get localised short day name
+ j: "this.getDate()",
+ l: "Ext.Date.dayNames[this.getDay()]",
+ N: "(this.getDay() ? this.getDay() : 7)",
+ S: "Ext.Date.getSuffix(this)",
+ w: "this.getDay()",
+ z: "Ext.Date.getDayOfYear(this)",
+ W: "Ext.String.leftPad(Ext.Date.getWeekOfYear(this), 2, '0')",
+ F: "Ext.Date.monthNames[this.getMonth()]",
+ m: "Ext.String.leftPad(this.getMonth() + 1, 2, '0')",
+ M: "Ext.Date.getShortMonthName(this.getMonth())", // get localised short month name
+ n: "(this.getMonth() + 1)",
+ t: "Ext.Date.getDaysInMonth(this)",
+ L: "(Ext.Date.isLeapYear(this) ? 1 : 0)",
+ o: "(this.getFullYear() + (Ext.Date.getWeekOfYear(this) == 1 && this.getMonth() > 0 ? +1 : (Ext.Date.getWeekOfYear(this) >= 52 && this.getMonth() < 11 ? -1 : 0)))",
+ Y: "Ext.String.leftPad(this.getFullYear(), 4, '0')",
+ y: "('' + this.getFullYear()).substring(2, 4)",
+ a: "(this.getHours() < 12 ? 'am' : 'pm')",
+ A: "(this.getHours() < 12 ? 'AM' : 'PM')",
+ g: "((this.getHours() % 12) ? this.getHours() % 12 : 12)",
+ G: "this.getHours()",
+ h: "Ext.String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",
+ H: "Ext.String.leftPad(this.getHours(), 2, '0')",
+ i: "Ext.String.leftPad(this.getMinutes(), 2, '0')",
+ s: "Ext.String.leftPad(this.getSeconds(), 2, '0')",
+ u: "Ext.String.leftPad(this.getMilliseconds(), 3, '0')",
+ O: "Ext.Date.getGMTOffset(this)",
+ P: "Ext.Date.getGMTOffset(this, true)",
+ T: "Ext.Date.getTimezone(this)",
+ Z: "(this.getTimezoneOffset() * -60)",
+
+ c: function() { // ISO-8601 -- GMT format
+ for (var c = "Y-m-dTH:i:sP", code = [], i = 0, l = c.length; i < l; ++i) {
+ var e = c.charAt(i);
+ code.push(e == "T" ? "'T'" : utilDate.getFormatCode(e)); // treat T as a character literal
+ }
+ return code.join(" + ");
+ },
+ /*
+ c: function() { // ISO-8601 -- UTC format
+ return [
+ "this.getUTCFullYear()", "'-'",
+ "Ext.util.Format.leftPad(this.getUTCMonth() + 1, 2, '0')", "'-'",
+ "Ext.util.Format.leftPad(this.getUTCDate(), 2, '0')",
+ "'T'",
+ "Ext.util.Format.leftPad(this.getUTCHours(), 2, '0')", "':'",
+ "Ext.util.Format.leftPad(this.getUTCMinutes(), 2, '0')", "':'",
+ "Ext.util.Format.leftPad(this.getUTCSeconds(), 2, '0')",
+ "'Z'"
+ ].join(" + ");
+ },
+ */
+
+ U: "Math.round(this.getTime() / 1000)"
+ },
+
+ /**
+ * Checks if the passed Date parameters will cause a javascript Date "rollover".
+ * @param {Number} year 4-digit year
+ * @param {Number} month 1-based month-of-year
+ * @param {Number} day Day of month
+ * @param {Number} hour (optional) Hour
+ * @param {Number} minute (optional) Minute
+ * @param {Number} second (optional) Second
+ * @param {Number} millisecond (optional) Millisecond
+ * @return {Boolean} true if the passed parameters do not cause a Date "rollover", false otherwise.
+ * @static
+ */
+ isValid : function(y, m, d, h, i, s, ms) {
+ // setup defaults
+ h = h || 0;
+ i = i || 0;
+ s = s || 0;
+ ms = ms || 0;
+
+ // Special handling for year < 100
+ var dt = utilDate.add(new Date(y < 100 ? 100 : y, m - 1, d, h, i, s, ms), utilDate.YEAR, y < 100 ? y - 100 : 0);
+
+ return y == dt.getFullYear() &&
+ m == dt.getMonth() + 1 &&
+ d == dt.getDate() &&
+ h == dt.getHours() &&
+ i == dt.getMinutes() &&
+ s == dt.getSeconds() &&
+ ms == dt.getMilliseconds();
+ },
+
+ /**
+ * Parses the passed string using the specified date format.
+ * Note that this function expects normal calendar dates, meaning that months are 1-based (i.e. 1 = January).
+ * The {@link #defaults} hash will be used for any date value (i.e. year, month, day, hour, minute, second or millisecond)
+ * which cannot be found in the passed string. If a corresponding default date value has not been specified in the {@link #defaults} hash,
+ * the current date's year, month, day or DST-adjusted zero-hour time value will be used instead.
+ * Keep in mind that the input date string must precisely match the specified format string
+ * in order for the parse operation to be successful (failed parse operations return a null value).
+ * <p>Example:</p><pre><code>
+//dt = Fri May 25 2007 (current date)
+var dt = new Date();
+
+//dt = Thu May 25 2006 (today&#39;s month/day in 2006)
+dt = Ext.Date.parse("2006", "Y");
+
+//dt = Sun Jan 15 2006 (all date parts specified)
+dt = Ext.Date.parse("2006-01-15", "Y-m-d");
+
+//dt = Sun Jan 15 2006 15:20:01
+dt = Ext.Date.parse("2006-01-15 3:20:01 PM", "Y-m-d g:i:s A");
+
+// attempt to parse Sun Feb 29 2006 03:20:01 in strict mode
+dt = Ext.Date.parse("2006-02-29 03:20:01", "Y-m-d H:i:s", true); // returns null
+</code></pre>
+ * @param {String} input The raw date string.
+ * @param {String} format The expected date string format.
+ * @param {Boolean} strict (optional) True to validate date strings while parsing (i.e. prevents javascript Date "rollover")
+ (defaults to false). Invalid date strings will return null when parsed.
+ * @return {Date} The parsed Date.
+ * @static
+ */
+ parse : function(input, format, strict) {
+ var p = utilDate.parseFunctions;
+ if (p[format] == null) {
+ utilDate.createParser(format);
+ }
+ return p[format](input, Ext.isDefined(strict) ? strict : utilDate.useStrict);
+ },
+
+ // Backwards compat
+ parseDate: function(input, format, strict){
+ return utilDate.parse(input, format, strict);
+ },
+
+
+ // private
+ getFormatCode : function(character) {
+ var f = utilDate.formatCodes[character];
+
+ if (f) {
+ f = typeof f == 'function'? f() : f;
+ utilDate.formatCodes[character] = f; // reassign function result to prevent repeated execution
+ }
+
+ // note: unknown characters are treated as literals
+ return f || ("'" + Ext.String.escape(character) + "'");
+ },
+
+ // private
+ createFormat : function(format) {
+ var code = [],
+ special = false,
+ ch = '';
+
+ for (var i = 0; i < format.length; ++i) {
+ ch = format.charAt(i);
+ if (!special && ch == "\\") {
+ special = true;
+ } else if (special) {
+ special = false;
+ code.push("'" + Ext.String.escape(ch) + "'");
+ } else {
+ code.push(utilDate.getFormatCode(ch));
+ }
+ }
+ utilDate.formatFunctions[format] = Ext.functionFactory("return " + code.join('+'));
+ },
+
+ // private
+ createParser : (function() {
+ var code = [
+ "var dt, y, m, d, h, i, s, ms, o, z, zz, u, v,",
+ "def = Ext.Date.defaults,",
+ "results = String(input).match(Ext.Date.parseRegexes[{0}]);", // either null, or an array of matched strings
+
+ "if(results){",
+ "{1}",
+
+ "if(u != null){", // i.e. unix time is defined
+ "v = new Date(u * 1000);", // give top priority to UNIX time
+ "}else{",
+ // create Date object representing midnight of the current day;
+ // this will provide us with our date defaults
+ // (note: clearTime() handles Daylight Saving Time automatically)
+ "dt = Ext.Date.clearTime(new Date);",
+
+ // date calculations (note: these calculations create a dependency on Ext.Number.from())
+ "y = Ext.Number.from(y, Ext.Number.from(def.y, dt.getFullYear()));",
+ "m = Ext.Number.from(m, Ext.Number.from(def.m - 1, dt.getMonth()));",
+ "d = Ext.Number.from(d, Ext.Number.from(def.d, dt.getDate()));",
+
+ // time calculations (note: these calculations create a dependency on Ext.Number.from())
+ "h = Ext.Number.from(h, Ext.Number.from(def.h, dt.getHours()));",
+ "i = Ext.Number.from(i, Ext.Number.from(def.i, dt.getMinutes()));",
+ "s = Ext.Number.from(s, Ext.Number.from(def.s, dt.getSeconds()));",
+ "ms = Ext.Number.from(ms, Ext.Number.from(def.ms, dt.getMilliseconds()));",
+
+ "if(z >= 0 && y >= 0){",
+ // both the year and zero-based day of year are defined and >= 0.
+ // these 2 values alone provide sufficient info to create a full date object
+
+ // create Date object representing January 1st for the given year
+ // handle years < 100 appropriately
+ "v = Ext.Date.add(new Date(y < 100 ? 100 : y, 0, 1, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
+
+ // then add day of year, checking for Date "rollover" if necessary
+ "v = !strict? v : (strict === true && (z <= 364 || (Ext.Date.isLeapYear(v) && z <= 365))? Ext.Date.add(v, Ext.Date.DAY, z) : null);",
+ "}else if(strict === true && !Ext.Date.isValid(y, m + 1, d, h, i, s, ms)){", // check for Date "rollover"
+ "v = null;", // invalid date, so return null
+ "}else{",
+ // plain old Date object
+ // handle years < 100 properly
+ "v = Ext.Date.add(new Date(y < 100 ? 100 : y, m, d, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
+ "}",
+ "}",
+ "}",
+
+ "if(v){",
+ // favour UTC offset over GMT offset
+ "if(zz != null){",
+ // reset to UTC, then add offset
+ "v = Ext.Date.add(v, Ext.Date.SECOND, -v.getTimezoneOffset() * 60 - zz);",
+ "}else if(o){",
+ // reset to GMT, then add offset
+ "v = Ext.Date.add(v, Ext.Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));",
+ "}",
+ "}",
+
+ "return v;"
+ ].join('\n');
+
+ return function(format) {
+ var regexNum = utilDate.parseRegexes.length,
+ currentGroup = 1,
+ calc = [],
+ regex = [],
+ special = false,
+ ch = "";
+
+ for (var i = 0; i < format.length; ++i) {
+ ch = format.charAt(i);
+ if (!special && ch == "\\") {
+ special = true;
+ } else if (special) {
+ special = false;
+ regex.push(Ext.String.escape(ch));
+ } else {
+ var obj = utilDate.formatCodeToRegex(ch, currentGroup);
+ currentGroup += obj.g;
+ regex.push(obj.s);
+ if (obj.g && obj.c) {
+ calc.push(obj.c);
+ }
+ }
+ }
+
+ utilDate.parseRegexes[regexNum] = new RegExp("^" + regex.join('') + "$", 'i');
+ utilDate.parseFunctions[format] = Ext.functionFactory("input", "strict", xf(code, regexNum, calc.join('')));
+ };
+ })(),
+
+ // private
+ parseCodes : {
+ /*
+ * Notes:
+ * g = {Number} calculation group (0 or 1. only group 1 contributes to date calculations.)
+ * c = {String} calculation method (required for group 1. null for group 0. {0} = currentGroup - position in regex result array)
+ * s = {String} regex pattern. all matches are stored in results[], and are accessible by the calculation mapped to 'c'
+ */
+ d: {
+ g:1,
+ c:"d = parseInt(results[{0}], 10);\n",
+ s:"(\\d{2})" // day of month with leading zeroes (01 - 31)
+ },
+ j: {
+ g:1,
+ c:"d = parseInt(results[{0}], 10);\n",
+ s:"(\\d{1,2})" // day of month without leading zeroes (1 - 31)
+ },
+ D: function() {
+ for (var a = [], i = 0; i < 7; a.push(utilDate.getShortDayName(i)), ++i); // get localised short day names
+ return {
+ g:0,
+ c:null,
+ s:"(?:" + a.join("|") +")"
+ };
+ },
+ l: function() {
+ return {
+ g:0,
+ c:null,
+ s:"(?:" + utilDate.dayNames.join("|") + ")"
+ };
+ },
+ N: {
+ g:0,
+ c:null,
+ s:"[1-7]" // ISO-8601 day number (1 (monday) - 7 (sunday))
+ },
+ S: {
+ g:0,
+ c:null,
+ s:"(?:st|nd|rd|th)"
+ },
+ w: {
+ g:0,
+ c:null,
+ s:"[0-6]" // javascript day number (0 (sunday) - 6 (saturday))
+ },
+ z: {
+ g:1,
+ c:"z = parseInt(results[{0}], 10);\n",
+ s:"(\\d{1,3})" // day of the year (0 - 364 (365 in leap years))
+ },
+ W: {
+ g:0,
+ c:null,
+ s:"(?:\\d{2})" // ISO-8601 week number (with leading zero)
+ },
+ F: function() {
+ return {
+ g:1,
+ c:"m = parseInt(Ext.Date.getMonthNumber(results[{0}]), 10);\n", // get localised month number
+ s:"(" + utilDate.monthNames.join("|") + ")"
+ };
+ },
+ M: function() {
+ for (var a = [], i = 0; i < 12; a.push(utilDate.getShortMonthName(i)), ++i); // get localised short month names
+ return Ext.applyIf({
+ s:"(" + a.join("|") + ")"
+ }, utilDate.formatCodeToRegex("F"));
+ },
+ m: {
+ g:1,
+ c:"m = parseInt(results[{0}], 10) - 1;\n",
+ s:"(\\d{2})" // month number with leading zeros (01 - 12)
+ },
+ n: {
+ g:1,
+ c:"m = parseInt(results[{0}], 10) - 1;\n",
+ s:"(\\d{1,2})" // month number without leading zeros (1 - 12)
+ },
+ t: {
+ g:0,
+ c:null,
+ s:"(?:\\d{2})" // no. of days in the month (28 - 31)
+ },
+ L: {
+ g:0,
+ c:null,
+ s:"(?:1|0)"
+ },
+ o: function() {
+ return utilDate.formatCodeToRegex("Y");
+ },
+ Y: {
+ g:1,
+ c:"y = parseInt(results[{0}], 10);\n",
+ s:"(\\d{4})" // 4-digit year
+ },
+ y: {
+ g:1,
+ c:"var ty = parseInt(results[{0}], 10);\n"
+ + "y = ty > Ext.Date.y2kYear ? 1900 + ty : 2000 + ty;\n", // 2-digit year
+ s:"(\\d{1,2})"
+ },
+ /*
+ * In the am/pm parsing routines, we allow both upper and lower case
+ * even though it doesn't exactly match the spec. It gives much more flexibility
+ * in being able to specify case insensitive regexes.
+ */
+ a: {
+ g:1,
+ c:"if (/(am)/i.test(results[{0}])) {\n"
+ + "if (!h || h == 12) { h = 0; }\n"
+ + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
+ s:"(am|pm|AM|PM)"
+ },
+ A: {
+ g:1,
+ c:"if (/(am)/i.test(results[{0}])) {\n"
+ + "if (!h || h == 12) { h = 0; }\n"
+ + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
+ s:"(AM|PM|am|pm)"
+ },
+ g: function() {
+ return utilDate.formatCodeToRegex("G");
+ },
+ G: {
+ g:1,
+ c:"h = parseInt(results[{0}], 10);\n",
+ s:"(\\d{1,2})" // 24-hr format of an hour without leading zeroes (0 - 23)
+ },
+ h: function() {
+ return utilDate.formatCodeToRegex("H");
+ },
+ H: {
+ g:1,
+ c:"h = parseInt(results[{0}], 10);\n",
+ s:"(\\d{2})" // 24-hr format of an hour with leading zeroes (00 - 23)
+ },
+ i: {
+ g:1,
+ c:"i = parseInt(results[{0}], 10);\n",
+ s:"(\\d{2})" // minutes with leading zeros (00 - 59)
+ },
+ s: {
+ g:1,
+ c:"s = parseInt(results[{0}], 10);\n",
+ s:"(\\d{2})" // seconds with leading zeros (00 - 59)
+ },
+ u: {
+ g:1,
+ c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",
+ s:"(\\d+)" // decimal fraction of a second (minimum = 1 digit, maximum = unlimited)
+ },
+ O: {
+ g:1,
+ c:[
+ "o = results[{0}];",
+ "var sn = o.substring(0,1),", // get + / - sign
+ "hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60),", // get hours (performs minutes-to-hour conversion also, just in case)
+ "mn = o.substring(3,5) % 60;", // get minutes
+ "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n" // -12hrs <= GMT offset <= 14hrs
+ ].join("\n"),
+ s: "([+\-]\\d{4})" // GMT offset in hrs and mins
+ },
+ P: {
+ g:1,
+ c:[
+ "o = results[{0}];",
+ "var sn = o.substring(0,1),", // get + / - sign
+ "hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60),", // get hours (performs minutes-to-hour conversion also, just in case)
+ "mn = o.substring(4,6) % 60;", // get minutes
+ "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n" // -12hrs <= GMT offset <= 14hrs
+ ].join("\n"),
+ s: "([+\-]\\d{2}:\\d{2})" // GMT offset in hrs and mins (with colon separator)
+ },
+ T: {
+ g:0,
+ c:null,
+ s:"[A-Z]{1,4}" // timezone abbrev. may be between 1 - 4 chars
+ },
+ Z: {
+ g:1,
+ c:"zz = results[{0}] * 1;\n" // -43200 <= UTC offset <= 50400
+ + "zz = (-43200 <= zz && zz <= 50400)? zz : null;\n",
+ s:"([+\-]?\\d{1,5})" // leading '+' sign is optional for UTC offset
+ },
+ c: function() {
+ var calc = [],
+ arr = [
+ utilDate.formatCodeToRegex("Y", 1), // year
+ utilDate.formatCodeToRegex("m", 2), // month
+ utilDate.formatCodeToRegex("d", 3), // day
+ utilDate.formatCodeToRegex("h", 4), // hour
+ utilDate.formatCodeToRegex("i", 5), // minute
+ utilDate.formatCodeToRegex("s", 6), // second
+ {c:"ms = results[7] || '0'; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"}, // decimal fraction of a second (minimum = 1 digit, maximum = unlimited)
+ {c:[ // allow either "Z" (i.e. UTC) or "-0530" or "+08:00" (i.e. UTC offset) timezone delimiters. assumes local timezone if no timezone is specified
+ "if(results[8]) {", // timezone specified
+ "if(results[8] == 'Z'){",
+ "zz = 0;", // UTC
+ "}else if (results[8].indexOf(':') > -1){",
+ utilDate.formatCodeToRegex("P", 8).c, // timezone offset with colon separator
+ "}else{",
+ utilDate.formatCodeToRegex("O", 8).c, // timezone offset without colon separator
+ "}",
+ "}"
+ ].join('\n')}
+ ];
+
+ for (var i = 0, l = arr.length; i < l; ++i) {
+ calc.push(arr[i].c);
+ }
+
+ return {
+ g:1,
+ c:calc.join(""),
+ s:[
+ arr[0].s, // year (required)
+ "(?:", "-", arr[1].s, // month (optional)
+ "(?:", "-", arr[2].s, // day (optional)
+ "(?:",
+ "(?:T| )?", // time delimiter -- either a "T" or a single blank space
+ arr[3].s, ":", arr[4].s, // hour AND minute, delimited by a single colon (optional). MUST be preceded by either a "T" or a single blank space
+ "(?::", arr[5].s, ")?", // seconds (optional)
+ "(?:(?:\\.|,)(\\d+))?", // decimal fraction of a second (e.g. ",12345" or ".98765") (optional)
+ "(Z|(?:[-+]\\d{2}(?::)?\\d{2}))?", // "Z" (UTC) or "-0530" (UTC offset without colon delimiter) or "+08:00" (UTC offset with colon delimiter) (optional)
+ ")?",
+ ")?",
+ ")?"
+ ].join("")
+ };
+ },
+ U: {
+ g:1,
+ c:"u = parseInt(results[{0}], 10);\n",
+ s:"(-?\\d+)" // leading minus sign indicates seconds before UNIX epoch
+ }
+ },
+
+ //Old Ext.Date prototype methods.
+ // private
+ dateFormat: function(date, format) {
+ return utilDate.format(date, format);
+ },
+
+ /**
+ * Formats a date given the supplied format string.
+ * @param {Date} date The date to format
+ * @param {String} format The format string
+ * @return {String} The formatted date
+ */
+ format: function(date, format) {
+ if (utilDate.formatFunctions[format] == null) {
+ utilDate.createFormat(format);
+ }
+ var result = utilDate.formatFunctions[format].call(date);
+ return result + '';
+ },
+
+ /**
+ * Get the timezone abbreviation of the current date (equivalent to the format specifier 'T').
+ *
+ * Note: The date string returned by the javascript Date object's toString() method varies
+ * between browsers (e.g. FF vs IE) and system region settings (e.g. IE in Asia vs IE in America).
+ * For a given date string e.g. "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)",
+ * getTimezone() first tries to get the timezone abbreviation from between a pair of parentheses
+ * (which may or may not be present), failing which it proceeds to get the timezone abbreviation
+ * from the GMT offset portion of the date string.
+ * @param {Date} date The date
+ * @return {String} The abbreviated timezone name (e.g. 'CST', 'PDT', 'EDT', 'MPST' ...).
+ */
+ getTimezone : function(date) {
+ // the following list shows the differences between date strings from different browsers on a WinXP SP2 machine from an Asian locale:
+ //
+ // Opera : "Thu, 25 Oct 2007 22:53:45 GMT+0800" -- shortest (weirdest) date string of the lot
+ // Safari : "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)" -- value in parentheses always gives the correct timezone (same as FF)
+ // FF : "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)" -- value in parentheses always gives the correct timezone
+ // IE : "Thu Oct 25 22:54:35 UTC+0800 2007" -- (Asian system setting) look for 3-4 letter timezone abbrev
+ // IE : "Thu Oct 25 17:06:37 PDT 2007" -- (American system setting) look for 3-4 letter timezone abbrev
+ //
+ // this crazy regex attempts to guess the correct timezone abbreviation despite these differences.
+ // step 1: (?:\((.*)\) -- find timezone in parentheses
+ // step 2: ([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?) -- if nothing was found in step 1, find timezone from timezone offset portion of date string
+ // step 3: remove all non uppercase characters found in step 1 and 2
+ return date.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
+ },
+
+ /**
+ * Get the offset from GMT of the current date (equivalent to the format specifier 'O').
+ * @param {Date} date The date
+ * @param {Boolean} colon (optional) true to separate the hours and minutes with a colon (defaults to false).
+ * @return {String} The 4-character offset string prefixed with + or - (e.g. '-0600').
+ */
+ getGMTOffset : function(date, colon) {
+ var offset = date.getTimezoneOffset();
+ return (offset > 0 ? "-" : "+")
+ + Ext.String.leftPad(Math.floor(Math.abs(offset) / 60), 2, "0")
+ + (colon ? ":" : "")
+ + Ext.String.leftPad(Math.abs(offset % 60), 2, "0");
+ },
+
+ /**
+ * Get the numeric day number of the year, adjusted for leap year.
+ * @param {Date} date The date
+ * @return {Number} 0 to 364 (365 in leap years).
+ */
+ getDayOfYear: function(date) {
+ var num = 0,
+ d = Ext.Date.clone(date),
+ m = date.getMonth(),
+ i;
+
+ for (i = 0, d.setDate(1), d.setMonth(0); i < m; d.setMonth(++i)) {
+ num += utilDate.getDaysInMonth(d);
+ }
+ return num + date.getDate() - 1;
+ },
+
+ /**
+ * Get the numeric ISO-8601 week number of the year.
+ * (equivalent to the format specifier 'W', but without a leading zero).
+ * @param {Date} date The date
+ * @return {Number} 1 to 53
+ * @method
+ */
+ getWeekOfYear : (function() {
+ // adapted from http://www.merlyn.demon.co.uk/weekcalc.htm
+ var ms1d = 864e5, // milliseconds in a day
+ ms7d = 7 * ms1d; // milliseconds in a week
+
+ return function(date) { // return a closure so constants get calculated only once
+ var DC3 = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate() + 3) / ms1d, // an Absolute Day Number
+ AWN = Math.floor(DC3 / 7), // an Absolute Week Number
+ Wyr = new Date(AWN * ms7d).getUTCFullYear();
+
+ return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;
+ };
+ })(),
+
+ /**
+ * Checks if the current date falls within a leap year.
+ * @param {Date} date The date
+ * @return {Boolean} True if the current date falls within a leap year, false otherwise.
+ */
+ isLeapYear : function(date) {
+ var year = date.getFullYear();
+ return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
+ },
+
+ /**
+ * Get the first day of the current month, adjusted for leap year. The returned value
+ * is the numeric day index within the week (0-6) which can be used in conjunction with
+ * the {@link #monthNames} array to retrieve the textual day name.
+ * Example:
+ * <pre><code>
+var dt = new Date('1/10/2007'),
+ firstDay = Ext.Date.getFirstDayOfMonth(dt);
+console.log(Ext.Date.dayNames[firstDay]); //output: 'Monday'
+ * </code></pre>
+ * @param {Date} date The date
+ * @return {Number} The day number (0-6).
+ */
+ getFirstDayOfMonth : function(date) {
+ var day = (date.getDay() - (date.getDate() - 1)) % 7;
+ return (day < 0) ? (day + 7) : day;
+ },
+
+ /**
+ * Get the last day of the current month, adjusted for leap year. The returned value
+ * is the numeric day index within the week (0-6) which can be used in conjunction with
+ * the {@link #monthNames} array to retrieve the textual day name.
+ * Example:
+ * <pre><code>
+var dt = new Date('1/10/2007'),
+ lastDay = Ext.Date.getLastDayOfMonth(dt);
+console.log(Ext.Date.dayNames[lastDay]); //output: 'Wednesday'
+ * </code></pre>
+ * @param {Date} date The date
+ * @return {Number} The day number (0-6).
+ */
+ getLastDayOfMonth : function(date) {
+ return utilDate.getLastDateOfMonth(date).getDay();
+ },
+
+
+ /**
+ * Get the date of the first day of the month in which this date resides.
+ * @param {Date} date The date
+ * @return {Date}
+ */
+ getFirstDateOfMonth : function(date) {
+ return new Date(date.getFullYear(), date.getMonth(), 1);
+ },
+
+ /**
+ * Get the date of the last day of the month in which this date resides.
+ * @param {Date} date The date
+ * @return {Date}
+ */
+ getLastDateOfMonth : function(date) {
+ return new Date(date.getFullYear(), date.getMonth(), utilDate.getDaysInMonth(date));
+ },
+
+ /**
+ * Get the number of days in the current month, adjusted for leap year.
+ * @param {Date} date The date
+ * @return {Number} The number of days in the month.
+ * @method
+ */
+ getDaysInMonth: (function() {
+ var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+
+ return function(date) { // return a closure for efficiency
+ var m = date.getMonth();
+
+ return m == 1 && utilDate.isLeapYear(date) ? 29 : daysInMonth[m];
+ };
+ })(),
+
+ /**
+ * Get the English ordinal suffix of the current day (equivalent to the format specifier 'S').
+ * @param {Date} date The date
+ * @return {String} 'st, 'nd', 'rd' or 'th'.
+ */
+ getSuffix : function(date) {
+ switch (date.getDate()) {
+ case 1:
+ case 21:
+ case 31:
+ return "st";
+ case 2:
+ case 22:
+ return "nd";
+ case 3:
+ case 23:
+ return "rd";
+ default:
+ return "th";
+ }
+ },
+
+ /**
+ * Creates and returns a new Date instance with the exact same date value as the called instance.
+ * Dates are copied and passed by reference, so if a copied date variable is modified later, the original
+ * variable will also be changed. When the intention is to create a new variable that will not
+ * modify the original instance, you should create a clone.
+ *
+ * Example of correctly cloning a date:
+ * <pre><code>
+//wrong way:
+var orig = new Date('10/1/2006');
+var copy = orig;
+copy.setDate(5);
+console.log(orig); //returns 'Thu Oct 05 2006'!
+
+//correct way:
+var orig = new Date('10/1/2006'),
+ copy = Ext.Date.clone(orig);
+copy.setDate(5);
+console.log(orig); //returns 'Thu Oct 01 2006'
+ * </code></pre>
+ * @param {Date} date The date
+ * @return {Date} The new Date instance.
+ */
+ clone : function(date) {
+ return new Date(date.getTime());
+ },
+
+ /**
+ * Checks if the current date is affected by Daylight Saving Time (DST).
+ * @param {Date} date The date
+ * @return {Boolean} True if the current date is affected by DST.
+ */
+ isDST : function(date) {
+ // adapted from http://sencha.com/forum/showthread.php?p=247172#post247172
+ // courtesy of @geoffrey.mcgill
+ return new Date(date.getFullYear(), 0, 1).getTimezoneOffset() != date.getTimezoneOffset();
+ },
+
+ /**
+ * Attempts to clear all time information from this Date by setting the time to midnight of the same day,
+ * automatically adjusting for Daylight Saving Time (DST) where applicable.
+ * (note: DST timezone information for the browser's host operating system is assumed to be up-to-date)
+ * @param {Date} date The date
+ * @param {Boolean} clone true to create a clone of this date, clear the time and return it (defaults to false).
+ * @return {Date} this or the clone.
+ */
+ clearTime : function(date, clone) {
+ if (clone) {
+ return Ext.Date.clearTime(Ext.Date.clone(date));
+ }
+
+ // get current date before clearing time
+ var d = date.getDate();
+
+ // clear time
+ date.setHours(0);
+ date.setMinutes(0);
+ date.setSeconds(0);
+ date.setMilliseconds(0);
+
+ if (date.getDate() != d) { // account for DST (i.e. day of month changed when setting hour = 0)
+ // note: DST adjustments are assumed to occur in multiples of 1 hour (this is almost always the case)
+ // refer to http://www.timeanddate.com/time/aboutdst.html for the (rare) exceptions to this rule
+
+ // increment hour until cloned date == current date
+ for (var hr = 1, c = utilDate.add(date, Ext.Date.HOUR, hr); c.getDate() != d; hr++, c = utilDate.add(date, Ext.Date.HOUR, hr));
+
+ date.setDate(d);
+ date.setHours(c.getHours());
+ }
+
+ return date;
+ },
+
+ /**
+ * Provides a convenient method for performing basic date arithmetic. This method
+ * does not modify the Date instance being called - it creates and returns
+ * a new Date instance containing the resulting date value.
+ *
+ * Examples:
+ * <pre><code>
+// Basic usage:
+var dt = Ext.Date.add(new Date('10/29/2006'), Ext.Date.DAY, 5);
+console.log(dt); //returns 'Fri Nov 03 2006 00:00:00'
+
+// Negative values will be subtracted:
+var dt2 = Ext.Date.add(new Date('10/1/2006'), Ext.Date.DAY, -5);
+console.log(dt2); //returns 'Tue Sep 26 2006 00:00:00'
+
+ * </code></pre>
+ *
+ * @param {Date} date The date to modify
+ * @param {String} interval A valid date interval enum value.
+ * @param {Number} value The amount to add to the current date.
+ * @return {Date} The new Date instance.
+ */
+ add : function(date, interval, value) {
+ var d = Ext.Date.clone(date),
+ Date = Ext.Date;
+ if (!interval || value === 0) return d;
+
+ switch(interval.toLowerCase()) {
+ case Ext.Date.MILLI:
+ d.setMilliseconds(d.getMilliseconds() + value);
+ break;
+ case Ext.Date.SECOND:
+ d.setSeconds(d.getSeconds() + value);
+ break;
+ case Ext.Date.MINUTE:
+ d.setMinutes(d.getMinutes() + value);
+ break;
+ case Ext.Date.HOUR:
+ d.setHours(d.getHours() + value);
+ break;
+ case Ext.Date.DAY:
+ d.setDate(d.getDate() + value);
+ break;
+ case Ext.Date.MONTH:
+ var day = date.getDate();
+ if (day > 28) {
+ day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), 'mo', value)).getDate());
+ }
+ d.setDate(day);
+ d.setMonth(date.getMonth() + value);
+ break;
+ case Ext.Date.YEAR:
+ d.setFullYear(date.getFullYear() + value);
+ break;
+ }
+ return d;
+ },
+
+ /**
+ * Checks if a date falls on or between the given start and end dates.
+ * @param {Date} date The date to check
+ * @param {Date} start Start date
+ * @param {Date} end End date
+ * @return {Boolean} true if this date falls on or between the given start and end dates.
+ */
+ between : function(date, start, end) {
+ var t = date.getTime();
+ return start.getTime() <= t && t <= end.getTime();
+ },
+
+ //Maintains compatibility with old static and prototype window.Date methods.
+ compat: function() {
+ var nativeDate = window.Date,
+ p, u,
+ statics = ['useStrict', 'formatCodeToRegex', 'parseFunctions', 'parseRegexes', 'formatFunctions', 'y2kYear', 'MILLI', 'SECOND', 'MINUTE', 'HOUR', 'DAY', 'MONTH', 'YEAR', 'defaults', 'dayNames', 'monthNames', 'monthNumbers', 'getShortMonthName', 'getShortDayName', 'getMonthNumber', 'formatCodes', 'isValid', 'parseDate', 'getFormatCode', 'createFormat', 'createParser', 'parseCodes'],
+ proto = ['dateFormat', 'format', 'getTimezone', 'getGMTOffset', 'getDayOfYear', 'getWeekOfYear', 'isLeapYear', 'getFirstDayOfMonth', 'getLastDayOfMonth', 'getDaysInMonth', 'getSuffix', 'clone', 'isDST', 'clearTime', 'add', 'between'];
+
+ //Append statics
+ Ext.Array.forEach(statics, function(s) {
+ nativeDate[s] = utilDate[s];
+ });
+
+ //Append to prototype
+ Ext.Array.forEach(proto, function(s) {
+ nativeDate.prototype[s] = function() {
+ var args = Array.prototype.slice.call(arguments);
+ args.unshift(this);
+ return utilDate[s].apply(utilDate, args);
+ };
+ });
+ }
+};
+
+var utilDate = Ext.Date;
+
+})();
+
+/**
+ * @author Jacky Nguyen <jacky@sencha.com>
+ * @docauthor Jacky Nguyen <jacky@sencha.com>
+ * @class Ext.Base
+ *
+ * The root of all classes created with {@link Ext#define}
+ * All prototype and static members of this class are inherited by any other class
+ *
+ */
+(function(flexSetter) {
+
+var Base = Ext.Base = function() {};
+ Base.prototype = {
+ $className: 'Ext.Base',
+
+ $class: Base,
+
+ /**
+ * Get the reference to the current class from which this object was instantiated. Unlike {@link Ext.Base#statics},
+ * `this.self` is scope-dependent and it's meant to be used for dynamic inheritance. See {@link Ext.Base#statics}
+ * for a detailed comparison
+ *
+ * Ext.define('My.Cat', {
+ * statics: {
+ * speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
+ * },
+ *
+ * constructor: function() {
+ * alert(this.self.speciesName); / dependent on 'this'
+ *
+ * return this;
+ * },
+ *
+ * clone: function() {
+ * return new this.self();
+ * }
+ * });
+ *
+ *
+ * Ext.define('My.SnowLeopard', {
+ * extend: 'My.Cat',
+ * statics: {
+ * speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'
+ * }
+ * });
+ *
+ * var cat = new My.Cat(); // alerts 'Cat'
+ * var snowLeopard = new My.SnowLeopard(); // alerts 'Snow Leopard'
+ *
+ * var clone = snowLeopard.clone();
+ * alert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'
+ *
+ * @type Class
+ * @protected
+ */
+ self: Base,
+
+ // Default constructor, simply returns `this`
+ constructor: function() {
+ return this;
+ },
+
+ /**
+ * Initialize configuration for this class. a typical example:
+ *
+ * Ext.define('My.awesome.Class', {
+ * // The default config
+ * config: {
+ * name: 'Awesome',
+ * isAwesome: true
+ * },
+ *
+ * constructor: function(config) {
+ * this.initConfig(config);
+ *
+ * return this;
+ * }
+ * });
+ *
+ * var awesome = new My.awesome.Class({
+ * name: 'Super Awesome'
+ * });
+ *
+ * alert(awesome.getName()); // 'Super Awesome'
+ *
+ * @protected
+ * @param {Object} config
+ * @return {Object} mixins The mixin prototypes as key - value pairs
+ */
+ initConfig: function(config) {
+ if (!this.$configInited) {
+ this.config = Ext.Object.merge({}, this.config || {}, config || {});
+
+ this.applyConfig(this.config);
+
+ this.$configInited = true;
+ }
+
+ return this;
+ },
+
+ /**
+ * @private
+ */
+ setConfig: function(config) {
+ this.applyConfig(config || {});
+
+ return this;
+ },
+
+ /**
+ * @private
+ */
+ applyConfig: flexSetter(function(name, value) {
+ var setter = 'set' + Ext.String.capitalize(name);
+
+ if (typeof this[setter] === 'function') {
+ this[setter].call(this, value);
+ }
+
+ return this;
+ }),
+
+ /**
+ * Call the parent's overridden method. For example:
+ *
+ * Ext.define('My.own.A', {
+ * constructor: function(test) {
+ * alert(test);
+ * }
+ * });
+ *
+ * Ext.define('My.own.B', {
+ * extend: 'My.own.A',
+ *
+ * constructor: function(test) {
+ * alert(test);
+ *
+ * this.callParent([test + 1]);
+ * }
+ * });
+ *
+ * Ext.define('My.own.C', {
+ * extend: 'My.own.B',
+ *
+ * constructor: function() {
+ * alert("Going to call parent's overriden constructor...");
+ *
+ * this.callParent(arguments);
+ * }
+ * });
+ *
+ * var a = new My.own.A(1); // alerts '1'
+ * var b = new My.own.B(1); // alerts '1', then alerts '2'
+ * var c = new My.own.C(2); // alerts "Going to call parent's overriden constructor..."
+ * // alerts '2', then alerts '3'
+ *
+ * @protected
+ * @param {Array/Arguments} args The arguments, either an array or the `arguments` object
+ * from the current method, for example: `this.callParent(arguments)`
+ * @return {Mixed} Returns the result from the superclass' method
+ */
+ callParent: function(args) {
+ var method = this.callParent.caller,
+ parentClass, methodName;
+
+ if (!method.$owner) {
+ if (!method.caller) {
+ Ext.Error.raise({
+ sourceClass: Ext.getClassName(this),
+ sourceMethod: "callParent",
+ msg: "Attempting to call a protected method from the public scope, which is not allowed"
+ });
+ }
+
+ method = method.caller;
+ }
+
+ parentClass = method.$owner.superclass;
+ methodName = method.$name;
+
+ if (!(methodName in parentClass)) {
+ Ext.Error.raise({
+ sourceClass: Ext.getClassName(this),
+ sourceMethod: methodName,
+ msg: "this.callParent() was called but there's no such method (" + methodName +
+ ") found in the parent class (" + (Ext.getClassName(parentClass) || 'Object') + ")"
+ });
+ }
+
+ return parentClass[methodName].apply(this, args || []);
+ },
+
+
+ /**
+ * Get the reference to the class from which this object was instantiated. Note that unlike {@link Ext.Base#self},
+ * `this.statics()` is scope-independent and it always returns the class from which it was called, regardless of what
+ * `this` points to during run-time
+ *
+ * Ext.define('My.Cat', {
+ * statics: {
+ * totalCreated: 0,
+ * speciesName: 'Cat' // My.Cat.speciesName = 'Cat'
+ * },
+ *
+ * constructor: function() {
+ * var statics = this.statics();
+ *
+ * alert(statics.speciesName); // always equals to 'Cat' no matter what 'this' refers to
+ * // equivalent to: My.Cat.speciesName
+ *
+ * alert(this.self.speciesName); // dependent on 'this'
+ *
+ * statics.totalCreated++;
+ *
+ * return this;
+ * },
+ *
+ * clone: function() {
+ * var cloned = new this.self; // dependent on 'this'
+ *
+ * cloned.groupName = this.statics().speciesName; // equivalent to: My.Cat.speciesName
+ *
+ * return cloned;
+ * }
+ * });
+ *
+ *
+ * Ext.define('My.SnowLeopard', {
+ * extend: 'My.Cat',
+ *
+ * statics: {
+ * speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'
+ * },
+ *
+ * constructor: function() {
+ * this.callParent();
+ * }
+ * });
+ *
+ * var cat = new My.Cat(); // alerts 'Cat', then alerts 'Cat'
+ *
+ * var snowLeopard = new My.SnowLeopard(); // alerts 'Cat', then alerts 'Snow Leopard'
+ *
+ * var clone = snowLeopard.clone();
+ * alert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'
+ * alert(clone.groupName); // alerts 'Cat'
+ *
+ * alert(My.Cat.totalCreated); // alerts 3
+ *
+ * @protected
+ * @return {Class}
+ */
+ statics: function() {
+ var method = this.statics.caller,
+ self = this.self;
+
+ if (!method) {
+ return self;
+ }
+
+ return method.$owner;
+ },
+
+ /**
+ * Call the original method that was previously overridden with {@link Ext.Base#override}
+ *
+ * Ext.define('My.Cat', {
+ * constructor: function() {
+ * alert("I'm a cat!");
+ *
+ * return this;
+ * }
+ * });
+ *
+ * My.Cat.override({
+ * constructor: function() {
+ * alert("I'm going to be a cat!");
+ *
+ * var instance = this.callOverridden();
+ *
+ * alert("Meeeeoooowwww");
+ *
+ * return instance;
+ * }
+ * });
+ *
+ * var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
+ * // alerts "I'm a cat!"
+ * // alerts "Meeeeoooowwww"
+ *
+ * @param {Array/Arguments} args The arguments, either an array or the `arguments` object
+ * @return {Mixed} Returns the result after calling the overridden method
+ */
+ callOverridden: function(args) {
+ var method = this.callOverridden.caller;
+
+ if (!method.$owner) {
+ Ext.Error.raise({
+ sourceClass: Ext.getClassName(this),
+ sourceMethod: "callOverridden",
+ msg: "Attempting to call a protected method from the public scope, which is not allowed"
+ });
+ }
+
+ if (!method.$previous) {
+ Ext.Error.raise({
+ sourceClass: Ext.getClassName(this),
+ sourceMethod: "callOverridden",
+ msg: "this.callOverridden was called in '" + method.$name +
+ "' but this method has never been overridden"
+ });
+ }
+
+ return method.$previous.apply(this, args || []);
+ },
+
+ destroy: function() {}
+ };
+
+ // These static properties will be copied to every newly created class with {@link Ext#define}
+ Ext.apply(Ext.Base, {
+ /**
+ * Create a new instance of this Class.
+ *
+ * Ext.define('My.cool.Class', {
+ * ...
+ * });
+ *
+ * My.cool.Class.create({
+ * someConfig: true
+ * });
+ *
+ * All parameters are passed to the constructor of the class.
+ *
+ * @return {Object} the created instance.
+ * @static
+ */
+ create: function() {
+ return Ext.create.apply(Ext, [this].concat(Array.prototype.slice.call(arguments, 0)));
+ },
+
+ /**
+ * @private
+ */
+ own: flexSetter(function(name, value) {
+ if (typeof value === 'function') {
+ this.ownMethod(name, value);
+ }
+ else {
+ this.prototype[name] = value;
+ }
+ }),
+
+ /**
+ * @private
+ */
+ ownMethod: function(name, fn) {
+ var originalFn;
+
+ if (fn.$owner !== undefined && fn !== Ext.emptyFn) {
+ originalFn = fn;
+
+ fn = function() {
+ return originalFn.apply(this, arguments);
+ };
+ }
+
+ var className;
+ className = Ext.getClassName(this);
+ if (className) {
+ fn.displayName = className + '#' + name;
+ }
+ fn.$owner = this;
+ fn.$name = name;
+
+ this.prototype[name] = fn;
+ },
+
+ /**
+ * Add / override static properties of this class.
+ *
+ * Ext.define('My.cool.Class', {
+ * ...
+ * });
+ *
+ * My.cool.Class.addStatics({
+ * someProperty: 'someValue', // My.cool.Class.someProperty = 'someValue'
+ * method1: function() { ... }, // My.cool.Class.method1 = function() { ... };
+ * method2: function() { ... } // My.cool.Class.method2 = function() { ... };
+ * });
+ *
+ * @param {Object} members
+ * @return {Ext.Base} this
+ * @static
+ */
+ addStatics: function(members) {
+ for (var name in members) {
+ if (members.hasOwnProperty(name)) {
+ this[name] = members[name];
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Add methods / properties to the prototype of this class.
+ *
+ * Ext.define('My.awesome.Cat', {
+ * constructor: function() {
+ * ...
+ * }
+ * });
+ *
+ * My.awesome.Cat.implement({
+ * meow: function() {
+ * alert('Meowww...');
+ * }
+ * });
+ *
+ * var kitty = new My.awesome.Cat;
+ * kitty.meow();
+ *
+ * @param {Object} members
+ * @static
+ */
+ implement: function(members) {
+ var prototype = this.prototype,
+ name, i, member, previous;
+ var className = Ext.getClassName(this);
+ for (name in members) {
+ if (members.hasOwnProperty(name)) {
+ member = members[name];
+
+ if (typeof member === 'function') {
+ member.$owner = this;
+ member.$name = name;
+ if (className) {
+ member.displayName = className + '#' + name;
+ }
+ }
+
+ prototype[name] = member;
+ }
+ }
+
+ if (Ext.enumerables) {
+ var enumerables = Ext.enumerables;
+
+ for (i = enumerables.length; i--;) {
+ name = enumerables[i];
+
+ if (members.hasOwnProperty(name)) {
+ member = members[name];
+ member.$owner = this;
+ member.$name = name;
+ prototype[name] = member;
+ }
+ }
+ }
+ },
+
+ /**
+ * Borrow another class' members to the prototype of this class.
+ *
+ * Ext.define('Bank', {
+ * money: '$$$',
+ * printMoney: function() {
+ * alert('$$$$$$$');
+ * }
+ * });
+ *
+ * Ext.define('Thief', {
+ * ...
+ * });
+ *
+ * Thief.borrow(Bank, ['money', 'printMoney']);
+ *
+ * var steve = new Thief();
+ *
+ * alert(steve.money); // alerts '$$$'
+ * steve.printMoney(); // alerts '$$$$$$$'
+ *
+ * @param {Ext.Base} fromClass The class to borrow members from
+ * @param {Array/String} members The names of the members to borrow
+ * @return {Ext.Base} this
+ * @static
+ * @private
+ */
+ borrow: function(fromClass, members) {
+ var fromPrototype = fromClass.prototype,
+ i, ln, member;
+
+ members = Ext.Array.from(members);
+
+ for (i = 0, ln = members.length; i < ln; i++) {
+ member = members[i];
+
+ this.own(member, fromPrototype[member]);
+ }
+
+ return this;
+ },
+
+ /**
+ * Override prototype members of this class. Overridden methods can be invoked via
+ * {@link Ext.Base#callOverridden}
+ *
+ * Ext.define('My.Cat', {
+ * constructor: function() {
+ * alert("I'm a cat!");
+ *
+ * return this;
+ * }
+ * });
+ *
+ * My.Cat.override({
+ * constructor: function() {
+ * alert("I'm going to be a cat!");
+ *
+ * var instance = this.callOverridden();
+ *
+ * alert("Meeeeoooowwww");
+ *
+ * return instance;
+ * }
+ * });
+ *
+ * var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
+ * // alerts "I'm a cat!"
+ * // alerts "Meeeeoooowwww"
+ *
+ * @param {Object} members
+ * @return {Ext.Base} this
+ * @static
+ */
+ override: function(members) {
+ var prototype = this.prototype,
+ name, i, member, previous;
+
+ for (name in members) {
+ if (members.hasOwnProperty(name)) {
+ member = members[name];
+
+ if (typeof member === 'function') {
+ if (typeof prototype[name] === 'function') {
+ previous = prototype[name];
+ member.$previous = previous;
+ }
+
+ this.ownMethod(name, member);
+ }
+ else {
+ prototype[name] = member;
+ }
+ }
+ }
+
+ if (Ext.enumerables) {
+ var enumerables = Ext.enumerables;
+
+ for (i = enumerables.length; i--;) {
+ name = enumerables[i];
+
+ if (members.hasOwnProperty(name)) {
+ if (prototype[name] !== undefined) {
+ previous = prototype[name];
+ members[name].$previous = previous;
+ }
+
+ this.ownMethod(name, members[name]);
+ }
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Used internally by the mixins pre-processor
+ * @private
+ */
+ mixin: flexSetter(function(name, cls) {
+ var mixin = cls.prototype,
+ my = this.prototype,
+ i, fn;
+
+ for (i in mixin) {
+ if (mixin.hasOwnProperty(i)) {
+ if (my[i] === undefined) {
+ if (typeof mixin[i] === 'function') {
+ fn = mixin[i];
+
+ if (fn.$owner === undefined) {
+ this.ownMethod(i, fn);
+ }
+ else {
+ my[i] = fn;
+ }
+ }
+ else {
+ my[i] = mixin[i];
+ }
+ }
+ else if (i === 'config' && my.config && mixin.config) {
+ Ext.Object.merge(my.config, mixin.config);
+ }
+ }
+ }
+
+ if (my.mixins === undefined) {
+ my.mixins = {};
+ }
+
+ my.mixins[name] = mixin;
+ }),
+
+ /**
+ * Get the current class' name in string format.
+ *
+ * Ext.define('My.cool.Class', {
+ * constructor: function() {
+ * alert(this.self.getName()); // alerts 'My.cool.Class'
+ * }
+ * });
+ *
+ * My.cool.Class.getName(); // 'My.cool.Class'
+ *
+ * @return {String} className
+ */
+ getName: function() {
+ return Ext.getClassName(this);
+ },
+
+ /**
+ * Create aliases for existing prototype methods. Example:
+ *
+ * Ext.define('My.cool.Class', {
+ * method1: function() { ... },
+ * method2: function() { ... }
+ * });
+ *
+ * var test = new My.cool.Class();
+ *
+ * My.cool.Class.createAlias({
+ * method3: 'method1',
+ * method4: 'method2'
+ * });
+ *
+ * test.method3(); // test.method1()
+ *
+ * My.cool.Class.createAlias('method5', 'method3');
+ *
+ * test.method5(); // test.method3() -> test.method1()
+ *
+ * @param {String/Object} alias The new method name, or an object to set multiple aliases. See
+ * {@link Ext.Function#flexSetter flexSetter}
+ * @param {String/Object} origin The original method name
+ * @static
+ * @method
+ */
+ createAlias: flexSetter(function(alias, origin) {
+ this.prototype[alias] = this.prototype[origin];
+ })
+ });
+
+})(Ext.Function.flexSetter);
+
+/**
+ * @author Jacky Nguyen <jacky@sencha.com>
+ * @docauthor Jacky Nguyen <jacky@sencha.com>
+ * @class Ext.Class
+ *
+ * Handles class creation throughout the whole framework. Note that most of the time {@link Ext#define Ext.define} should
+ * be used instead, since it's a higher level wrapper that aliases to {@link Ext.ClassManager#create}
+ * to enable namespacing and dynamic dependency resolution.
+ *
+ * # Basic syntax: #
+ *
+ * Ext.define(className, properties);
+ *
+ * in which `properties` is an object represent a collection of properties that apply to the class. See
+ * {@link Ext.ClassManager#create} for more detailed instructions.
+ *
+ * Ext.define('Person', {
+ * name: 'Unknown',
+ *
+ * constructor: function(name) {
+ * if (name) {
+ * this.name = name;
+ * }
+ *
+ * return this;
+ * },
+ *
+ * eat: function(foodType) {
+ * alert("I'm eating: " + foodType);
+ *
+ * return this;
+ * }
+ * });
+ *
+ * var aaron = new Person("Aaron");
+ * aaron.eat("Sandwich"); // alert("I'm eating: Sandwich");
+ *
+ * Ext.Class has a powerful set of extensible {@link Ext.Class#registerPreprocessor pre-processors} which takes care of
+ * everything related to class creation, including but not limited to inheritance, mixins, configuration, statics, etc.
+ *
+ * # Inheritance: #
+ *
+ * Ext.define('Developer', {
+ * extend: 'Person',
+ *
+ * constructor: function(name, isGeek) {
+ * this.isGeek = isGeek;
+ *
+ * // Apply a method from the parent class' prototype
+ * this.callParent([name]);
+ *
+ * return this;
+ *
+ * },
+ *
+ * code: function(language) {
+ * alert("I'm coding in: " + language);
+ *
+ * this.eat("Bugs");
+ *
+ * return this;
+ * }
+ * });
+ *
+ * var jacky = new Developer("Jacky", true);
+ * jacky.code("JavaScript"); // alert("I'm coding in: JavaScript");
+ * // alert("I'm eating: Bugs");
+ *
+ * See {@link Ext.Base#callParent} for more details on calling superclass' methods
+ *
+ * # Mixins: #
+ *
+ * Ext.define('CanPlayGuitar', {
+ * playGuitar: function() {
+ * alert("F#...G...D...A");
+ * }
+ * });
+ *
+ * Ext.define('CanComposeSongs', {
+ * composeSongs: function() { ... }
+ * });
+ *
+ * Ext.define('CanSing', {
+ * sing: function() {
+ * alert("I'm on the highway to hell...")
+ * }
+ * });
+ *
+ * Ext.define('Musician', {
+ * extend: 'Person',
+ *
+ * mixins: {
+ * canPlayGuitar: 'CanPlayGuitar',
+ * canComposeSongs: 'CanComposeSongs',
+ * canSing: 'CanSing'
+ * }
+ * })
+ *
+ * Ext.define('CoolPerson', {
+ * extend: 'Person',
+ *
+ * mixins: {
+ * canPlayGuitar: 'CanPlayGuitar',
+ * canSing: 'CanSing'
+ * },
+ *
+ * sing: function() {
+ * alert("Ahem....");
+ *
+ * this.mixins.canSing.sing.call(this);
+ *
+ * alert("[Playing guitar at the same time...]");
+ *
+ * this.playGuitar();
+ * }
+ * });
+ *
+ * var me = new CoolPerson("Jacky");
+ *
+ * me.sing(); // alert("Ahem...");
+ * // alert("I'm on the highway to hell...");
+ * // alert("[Playing guitar at the same time...]");
+ * // alert("F#...G...D...A");
+ *
+ * # Config: #
+ *
+ * Ext.define('SmartPhone', {
+ * config: {
+ * hasTouchScreen: false,
+ * operatingSystem: 'Other',
+ * price: 500
+ * },
+ *
+ * isExpensive: false,
+ *
+ * constructor: function(config) {
+ * this.initConfig(config);
+ *
+ * return this;
+ * },
+ *
+ * applyPrice: function(price) {
+ * this.isExpensive = (price > 500);
+ *
+ * return price;
+ * },
+ *
+ * applyOperatingSystem: function(operatingSystem) {
+ * if (!(/^(iOS|Android|BlackBerry)$/i).test(operatingSystem)) {
+ * return 'Other';
+ * }
+ *
+ * return operatingSystem;
+ * }
+ * });
+ *
+ * var iPhone = new SmartPhone({
+ * hasTouchScreen: true,
+ * operatingSystem: 'iOS'
+ * });
+ *
+ * iPhone.getPrice(); // 500;
+ * iPhone.getOperatingSystem(); // 'iOS'
+ * iPhone.getHasTouchScreen(); // true;
+ * iPhone.hasTouchScreen(); // true
+ *
+ * iPhone.isExpensive; // false;
+ * iPhone.setPrice(600);
+ * iPhone.getPrice(); // 600
+ * iPhone.isExpensive; // true;
+ *
+ * iPhone.setOperatingSystem('AlienOS');
+ * iPhone.getOperatingSystem(); // 'Other'
+ *
+ * # Statics: #
+ *
+ * Ext.define('Computer', {
+ * statics: {
+ * factory: function(brand) {
+ * // 'this' in static methods refer to the class itself
+ * return new this(brand);
+ * }
+ * },
+ *
+ * constructor: function() { ... }
+ * });
+ *
+ * var dellComputer = Computer.factory('Dell');
+ *
+ * Also see {@link Ext.Base#statics} and {@link Ext.Base#self} for more details on accessing
+ * static properties within class methods
+ *
+ */
+(function() {
+
+ var Class,
+ Base = Ext.Base,
+ baseStaticProperties = [],
+ baseStaticProperty;
+
+ for (baseStaticProperty in Base) {
+ if (Base.hasOwnProperty(baseStaticProperty)) {
+ baseStaticProperties.push(baseStaticProperty);
+ }
+ }
+
+ /**
+ * @method constructor
+ * Creates new class.
+ * @param {Object} classData An object represent the properties of this class
+ * @param {Function} createdFn Optional, the callback function to be executed when this class is fully created.
+ * Note that the creation process can be asynchronous depending on the pre-processors used.
+ * @return {Ext.Base} The newly created class
+ */
+ Ext.Class = Class = function(newClass, classData, onClassCreated) {
+ if (typeof newClass !== 'function') {
+ onClassCreated = classData;
+ classData = newClass;
+ newClass = function() {
+ return this.constructor.apply(this, arguments);
+ };
+ }
+
+ if (!classData) {
+ classData = {};
+ }
+
+ var preprocessorStack = classData.preprocessors || Class.getDefaultPreprocessors(),
+ registeredPreprocessors = Class.getPreprocessors(),
+ index = 0,
+ preprocessors = [],
+ preprocessor, preprocessors, staticPropertyName, process, i, j, ln;
+
+ for (i = 0, ln = baseStaticProperties.length; i < ln; i++) {
+ staticPropertyName = baseStaticProperties[i];
+ newClass[staticPropertyName] = Base[staticPropertyName];
+ }
+
+ delete classData.preprocessors;
+
+ for (j = 0, ln = preprocessorStack.length; j < ln; j++) {
+ preprocessor = preprocessorStack[j];
+
+ if (typeof preprocessor === 'string') {
+ preprocessor = registeredPreprocessors[preprocessor];
+
+ if (!preprocessor.always) {
+ if (classData.hasOwnProperty(preprocessor.name)) {
+ preprocessors.push(preprocessor.fn);
+ }
+ }
+ else {
+ preprocessors.push(preprocessor.fn);
+ }
+ }
+ else {
+ preprocessors.push(preprocessor);
+ }
+ }
+
+ classData.onClassCreated = onClassCreated;
+
+ classData.onBeforeClassCreated = function(cls, data) {
+ onClassCreated = data.onClassCreated;
+
+ delete data.onBeforeClassCreated;
+ delete data.onClassCreated;
+
+ cls.implement(data);
+
+ if (onClassCreated) {
+ onClassCreated.call(cls, cls);
+ }
+ };
+
+ process = function(cls, data) {
+ preprocessor = preprocessors[index++];
+
+ if (!preprocessor) {
+ data.onBeforeClassCreated.apply(this, arguments);
+ return;
+ }
+
+ if (preprocessor.call(this, cls, data, process) !== false) {
+ process.apply(this, arguments);
+ }
+ };
+
+ process.call(Class, newClass, classData);
+
+ return newClass;
+ };
+
+ Ext.apply(Class, {
+
+ /** @private */
+ preprocessors: {},
+
+ /**
+ * Register a new pre-processor to be used during the class creation process
+ *
+ * @member Ext.Class registerPreprocessor
+ * @param {String} name The pre-processor's name
+ * @param {Function} fn The callback function to be executed. Typical format:
+
+ function(cls, data, fn) {
+ // Your code here
+
+ // Execute this when the processing is finished.
+ // Asynchronous processing is perfectly ok
+ if (fn) {
+ fn.call(this, cls, data);
+ }
+ });
+
+ * Passed arguments for this function are:
+ *
+ * - `{Function} cls`: The created class
+ * - `{Object} data`: The set of properties passed in {@link Ext.Class} constructor
+ * - `{Function} fn`: The callback function that <b>must</b> to be executed when this pre-processor finishes,
+ * regardless of whether the processing is synchronous or aynchronous
+ *
+ * @return {Ext.Class} this
+ * @markdown
+ */
+ registerPreprocessor: function(name, fn, always) {
+ this.preprocessors[name] = {
+ name: name,
+ always: always || false,
+ fn: fn
+ };
+
+ return this;
+ },
+
+ /**
+ * Retrieve a pre-processor callback function by its name, which has been registered before
+ *
+ * @param {String} name
+ * @return {Function} preprocessor
+ */
+ getPreprocessor: function(name) {
+ return this.preprocessors[name];
+ },
+
+ getPreprocessors: function() {
+ return this.preprocessors;
+ },
+
+ /**
+ * Retrieve the array stack of default pre-processors
+ *
+ * @return {Function} defaultPreprocessors
+ */
+ getDefaultPreprocessors: function() {
+ return this.defaultPreprocessors || [];
+ },
+
+ /**
+ * Set the default array stack of default pre-processors
+ *
+ * @param {Array} preprocessors
+ * @return {Ext.Class} this
+ */
+ setDefaultPreprocessors: function(preprocessors) {
+ this.defaultPreprocessors = Ext.Array.from(preprocessors);
+
+ return this;
+ },
+
+ /**
+ * Insert this pre-processor at a specific position in the stack, optionally relative to
+ * any existing pre-processor. For example:
+
+ Ext.Class.registerPreprocessor('debug', function(cls, data, fn) {
+ // Your code here
+
+ if (fn) {
+ fn.call(this, cls, data);
+ }
+ }).insertDefaultPreprocessor('debug', 'last');
+
+ * @param {String} name The pre-processor name. Note that it needs to be registered with
+ * {@link Ext#registerPreprocessor registerPreprocessor} before this
+ * @param {String} offset The insertion position. Four possible values are:
+ * 'first', 'last', or: 'before', 'after' (relative to the name provided in the third argument)
+ * @param {String} relativeName
+ * @return {Ext.Class} this
+ * @markdown
+ */
+ setDefaultPreprocessorPosition: function(name, offset, relativeName) {
+ var defaultPreprocessors = this.defaultPreprocessors,
+ index;
+
+ if (typeof offset === 'string') {
+ if (offset === 'first') {
+ defaultPreprocessors.unshift(name);
+
+ return this;
+ }
+ else if (offset === 'last') {
+ defaultPreprocessors.push(name);
+
+ retu