summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Churchill <damoxc@gmail.com>2011-10-29 01:28:58 +0100
committerDamien Churchill <damoxc@gmail.com>2011-10-29 01:28:58 +0100
commitfea0b41425d55b95564de5b95813ddc9594b9917 (patch)
tree678ded2880a4d56f19b92375176b79e9895adeac
parentd37c3e0213c4bcc260f32bab66bbe8e04d6aaa1f (diff)
downloaddeluge-fea0b41425d55b95564de5b95813ddc9594b9917.tar.gz
deluge-fea0b41425d55b95564de5b95813ddc9594b9917.tar.bz2
deluge-fea0b41425d55b95564de5b95813ddc9594b9917.zip
web: update extjs to 4.0.7
-rw-r--r--deluge/ui/web/js/ext-all-debug.js19374
-rw-r--r--deluge/ui/web/js/ext-all-dev.js51142
-rw-r--r--deluge/ui/web/js/ext-all.js2
-rw-r--r--deluge/ui/web/js/ext-debug.js5537
-rw-r--r--deluge/ui/web/js/ext-dev.js5818
-rw-r--r--deluge/ui/web/js/ext.js2
-rw-r--r--deluge/ui/web/resources/css/ext-all-access.css2
-rw-r--r--deluge/ui/web/resources/css/ext-all-gray.css2
-rw-r--r--deluge/ui/web/resources/css/ext-all-scoped.css2
-rw-r--r--deluge/ui/web/resources/css/ext-all.css2
-rw-r--r--deluge/ui/web/resources/css/ext-ie-scoped.css2
-rw-r--r--deluge/ui/web/resources/css/ext-ie.css2
-rw-r--r--deluge/ui/web/resources/css/ext-sandbox.css2
-rw-r--r--deluge/ui/web/resources/css/ext-standard-scoped.css2
-rw-r--r--deluge/ui/web/resources/css/ext-standard.css2
-rw-r--r--deluge/ui/web/resources/themes/images/access/boundlist/trigger-arrow.pngbin0 -> 2869 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/access/grid/refresh-disabled.gifbin0 -> 577 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/access/tab-bar/tab-bar-bg.pngbin314 -> 0 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/access/tab-bar/tab-bar-default-bg.gif (renamed from deluge/ui/web/resources/themes/images/access/tab-bar/tab-bar-bg.gif)bin1841 -> 1841 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/access/tree/drop-above.gifbin0 -> 911 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/access/tree/drop-append.gifbin0 -> 1001 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/access/tree/drop-below.gifbin0 -> 911 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-large-focus-corners.gifbin1621 -> 1621 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-large-over-corners.gifbin1621 -> 1621 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-large-pressed-corners.gifbin1620 -> 1619 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-medium-focus-corners.gifbin1622 -> 1622 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-medium-over-corners.gifbin1622 -> 1622 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-medium-pressed-corners.gifbin1619 -> 1619 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-small-focus-corners.gifbin1622 -> 1622 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-small-over-corners.gifbin1621 -> 1621 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-small-pressed-corners.gifbin1622 -> 1621 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-toolbar-large-focus-corners.gifbin1622 -> 1621 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-toolbar-large-over-corners.gifbin1622 -> 1621 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-toolbar-large-pressed-corners.gifbin1623 -> 1623 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-toolbar-medium-focus-corners.gifbin1622 -> 1622 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-toolbar-medium-over-corners.gifbin1622 -> 1622 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-toolbar-medium-pressed-corners.gifbin1621 -> 1621 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-toolbar-small-focus-corners.gifbin1623 -> 1622 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-toolbar-small-over-corners.gifbin1623 -> 1622 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/btn/btn-default-toolbar-small-pressed-corners.gifbin1624 -> 1624 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/form-invalid-tip/form-invalid-tip-corners.gifbin0 -> 1688 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/form-invalid-tip/form-invalid-tip-sides.gifbin0 -> 1647 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/tab-bar/tab-bar-default-bg.gifbin1750 -> 1829 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/tab/tab-default-bottom-disabled-bg.gifbin1749 -> 1798 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/tab/tab-default-bottom-disabled-corners.gifbin1616 -> 1648 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/tab/tab-default-bottom-disabled-sides.gifbin1930 -> 1984 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/tab/tab-default-top-disabled-bg.gifbin1749 -> 1794 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/tab/tab-default-top-disabled-corners.gifbin1623 -> 1649 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/tab/tab-default-top-disabled-sides.gifbin1930 -> 1979 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/tip/tip-corners.gifbin1621 -> 1621 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/window-header/window-header-default-bottom-sides.gifbin1620 -> 1624 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/window-header/window-header-default-left-sides.gifbin1607 -> 1610 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/window-header/window-header-default-right-sides.gifbin1607 -> 1610 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/window-header/window-header-default-top-corners.gifbin1668 -> 1668 bytes
-rw-r--r--deluge/ui/web/resources/themes/images/default/window-header/window-header-default-top-sides.gifbin1620 -> 1624 bytes
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/_all.scss3
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/_mixins.scss9
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/core/_core.scss34
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/core/_reset.scss24
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/layout/_layout.scss16
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/mixins/_frame.scss8
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/mixins/_reset-extras.scss144
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/mixins/_theme-background-image.scss12
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/util/_dragdrop.scss6
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/util/_messagebox.scss10
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/util/_resizable.scss12
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/util/_splitter.scss16
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/util/_tool.scss2
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/variables/_core.scss2
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/variables/_menu.scss1
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_button.scss65
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_datepicker.scss14
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_drawcomponent.scss6
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_grid.scss113
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_loadmask.scss2
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_menu.scss38
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_panel.scss14
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_progress-bar.scss3
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_qtip.scss2
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_slider.scss20
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_tab.scss111
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_tabbar.scss2
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_toolbar.scss6
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/_tree.scss79
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/form/_all.scss6
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/form/_checkbox.scss5
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/form/_checkboxgroup.scss5
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/form/_field.scss6
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/form/_fieldset.scss6
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/form/_htmleditor.scss31
-rw-r--r--deluge/ui/web/resources/themes/stylesheets/ext4/default/widgets/form/_triggerfield.scss20
-rw-r--r--deluge/ui/web/resources/themes/templates/resources/css/my-ext-theme.css59
-rw-r--r--deluge/ui/web/resources/themes/templates/resources/sass/config.rb6
-rw-r--r--deluge/ui/web/resources/themes/templates/resources/sass/my-ext-theme.scss1
94 files changed, 46253 insertions, 36559 deletions
diff --git a/deluge/ui/web/js/ext-all-debug.js b/deluge/ui/web/js/ext-all-debug.js
index 74e25af2c..8fc6dc004 100644
--- a/deluge/ui/web/js/ext-all-debug.js
+++ b/deluge/ui/web/js/ext-all-debug.js
@@ -407,7 +407,7 @@ If you are unsure which license is appropriate for your use, please contact the
(function() {
-var version = '4.0.2a', Version;
+var version = '4.0.7', Version;
Ext.Version = Version = Ext.extend(Object, {
@@ -592,7 +592,7 @@ Ext.String = {
escapeRegexRe: /([-.*+?^${}()|[\]\/\\])/g,
/**
- * Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
+ * 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
@@ -618,7 +618,12 @@ Ext.String = {
};
})(),
-
+ /**
+ * 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;': '&',
@@ -709,6 +714,14 @@ Ext.String = {
return format.replace(Ext.String.formatRe, function(m, i) {
return args[i];
});
+ },
+
+
+ repeat: function(pattern, count, sep) {
+ for (var buf = [], i = count; i--; ) {
+ buf.push(pattern);
+ }
+ return buf.join(sep || '');
}
};
@@ -1267,9 +1280,24 @@ Ext.num = function() {
},
- slice: function(array, begin, end) {
- return slice.call(array, begin, end);
- },
+
+ slice: ([1,2].slice(1, undefined).length ?
+ function (array, begin, end) {
+ return slice.call(array, begin, end);
+ } :
+
+ function (array, begin, end) {
+
+
+ if (typeof begin === 'undefined') {
+ return slice.call(array);
+ }
+ if (typeof end === 'undefined') {
+ return slice.call(array, begin);
+ }
+ return slice.call(array, begin, end);
+ }
+ ),
sort: function(array, sortFn) {
@@ -1485,6 +1513,12 @@ Ext.Function = {
bind: function(fn, scope, args, appendArgs) {
+ if (arguments.length === 2) {
+ return function() {
+ return fn.apply(scope, arguments);
+ }
+ }
+
var method = fn,
slice = Array.prototype.slice;
@@ -1495,7 +1529,7 @@ Ext.Function = {
callArgs = slice.call(arguments, 0);
callArgs = callArgs.concat(args);
}
- else if (Ext.isNumber(appendArgs)) {
+ else if (typeof appendArgs == 'number') {
callArgs = slice.call(arguments, 0);
Ext.Array.insert(callArgs, appendArgs, args);
}
@@ -1583,7 +1617,7 @@ Ext.Function = {
return function() {
var me = this;
if (timerId) {
- clearInterval(timerId);
+ clearTimeout(timerId);
timerId = null;
}
timerId = setTimeout(function(){
@@ -1611,6 +1645,28 @@ Ext.Function = {
timer = setTimeout(execute, interval - elapsed);
}
};
+ },
+
+
+ interceptBefore: function(object, methodName, fn) {
+ var method = object[methodName] || Ext.emptyFn;
+
+ return object[methodName] = function() {
+ var ret = fn.apply(this, arguments);
+ method.apply(this, arguments);
+
+ return ret;
+ };
+ },
+
+
+ interceptAfter: function(object, methodName, fn) {
+ var method = object[methodName] || Ext.emptyFn;
+
+ return object[methodName] = function() {
+ method.apply(this, arguments);
+ return fn.apply(this, arguments);
+ };
}
};
@@ -2786,6 +2842,7 @@ var Base = Ext.Base = function() {};
},
+
initConfig: function(config) {
if (!this.$configInited) {
this.config = Ext.Object.merge({}, this.config || {}, config || {});
@@ -2815,6 +2872,7 @@ var Base = Ext.Base = function() {};
return this;
}),
+
callParent: function(args) {
@@ -2865,20 +2923,20 @@ var Base = Ext.Base = function() {};
},
- own: flexSetter(function(name, value) {
- if (typeof value === 'function') {
+ own: function(name, value) {
+ if (typeof value == 'function') {
this.ownMethod(name, value);
}
else {
this.prototype[name] = value;
}
- }),
+ },
ownMethod: function(name, fn) {
var originalFn;
- if (fn.$owner !== undefined && fn !== Ext.emptyFn) {
+ if (typeof fn.$owner !== 'undefined' && fn !== Ext.emptyFn) {
originalFn = fn;
fn = function() {
@@ -2904,9 +2962,41 @@ var Base = Ext.Base = function() {};
},
+ addInheritableStatics: function(members) {
+ var inheritableStatics,
+ hasInheritableStatics,
+ prototype = this.prototype,
+ name, member;
+
+ inheritableStatics = prototype.$inheritableStatics;
+ hasInheritableStatics = prototype.$hasInheritableStatics;
+
+ if (!inheritableStatics) {
+ inheritableStatics = prototype.$inheritableStatics = [];
+ hasInheritableStatics = prototype.$hasInheritableStatics = {};
+ }
+
+
+ for (name in members) {
+ if (members.hasOwnProperty(name)) {
+ member = members[name];
+ this[name] = member;
+
+ if (!hasInheritableStatics[name]) {
+ hasInheritableStatics[name] = true;
+ inheritableStatics.push(name);
+ }
+ }
+ }
+
+ return this;
+ },
+
+
implement: function(members) {
var prototype = this.prototype,
- name, i, member, previous;
+ enumerables = Ext.enumerables,
+ name, i, member;
for (name in members) {
if (members.hasOwnProperty(name)) {
member = members[name];
@@ -2920,9 +3010,7 @@ var Base = Ext.Base = function() {};
}
}
- if (Ext.enumerables) {
- var enumerables = Ext.enumerables;
-
+ if (enumerables) {
for (i = enumerables.length; i--;) {
name = enumerables[i];
@@ -2955,8 +3043,28 @@ var Base = Ext.Base = function() {};
override: function(members) {
var prototype = this.prototype,
+ enumerables = Ext.enumerables,
name, i, member, previous;
+ if (arguments.length === 2) {
+ name = members;
+ member = arguments[1];
+
+ if (typeof member == 'function') {
+ if (typeof prototype[name] == 'function') {
+ previous = prototype[name];
+ member.$previous = previous;
+ }
+
+ this.ownMethod(name, member);
+ }
+ else {
+ prototype[name] = member;
+ }
+
+ return this;
+ }
+
for (name in members) {
if (members.hasOwnProperty(name)) {
member = members[name];
@@ -2975,14 +3083,12 @@ var Base = Ext.Base = function() {};
}
}
- if (Ext.enumerables) {
- var enumerables = Ext.enumerables;
-
+ if (enumerables) {
for (i = enumerables.length; i--;) {
name = enumerables[i];
if (members.hasOwnProperty(name)) {
- if (prototype[name] !== undefined) {
+ if (typeof prototype[name] !== 'undefined') {
previous = prototype[name];
members[name].$previous = previous;
}
@@ -2996,40 +3102,53 @@ var Base = Ext.Base = function() {};
},
- mixin: flexSetter(function(name, cls) {
+
+ mixin: function(name, cls) {
var mixin = cls.prototype,
my = this.prototype,
- i, fn;
+ key, fn;
- for (i in mixin) {
- if (mixin.hasOwnProperty(i)) {
- if (my[i] === undefined) {
- if (typeof mixin[i] === 'function') {
- fn = mixin[i];
+ for (key in mixin) {
+ if (mixin.hasOwnProperty(key)) {
+ if (typeof my[key] === 'undefined' && key !== 'mixins' && key !== 'mixinId') {
+ if (typeof mixin[key] === 'function') {
+ fn = mixin[key];
- if (fn.$owner === undefined) {
- this.ownMethod(i, fn);
+ if (typeof fn.$owner === 'undefined') {
+ this.ownMethod(key, fn);
}
else {
- my[i] = fn;
+ my[key] = fn;
}
}
else {
- my[i] = mixin[i];
+ my[key] = mixin[key];
}
}
- else if (i === 'config' && my.config && mixin.config) {
+
+ else if (key === 'config' && my.config && mixin.config) {
Ext.Object.merge(my.config, mixin.config);
}
+
}
}
- if (my.mixins === undefined) {
- my.mixins = {};
+ if (typeof mixin.onClassMixedIn !== 'undefined') {
+ mixin.onClassMixedIn.call(cls, this);
+ }
+
+ if (!my.hasOwnProperty('mixins')) {
+ if ('mixins' in my) {
+ my.mixins = Ext.Object.merge({}, my.mixins);
+ }
+ else {
+ my.mixins = {};
+ }
}
my.mixins[name] = mixin;
- }),
+ },
+
getName: function() {
@@ -3038,7 +3157,9 @@ var Base = Ext.Base = function() {};
createAlias: flexSetter(function(alias, origin) {
- this.prototype[alias] = this.prototype[origin];
+ this.prototype[alias] = function() {
+ return this[origin].apply(this, arguments);
+ }
})
});
@@ -3060,7 +3181,7 @@ var Base = Ext.Base = function() {};
Ext.Class = Class = function(newClass, classData, onClassCreated) {
- if (typeof newClass !== 'function') {
+ if (typeof newClass != 'function') {
onClassCreated = classData;
classData = newClass;
newClass = function() {
@@ -3076,7 +3197,7 @@ var Base = Ext.Base = function() {};
registeredPreprocessors = Class.getPreprocessors(),
index = 0,
preprocessors = [],
- preprocessor, preprocessors, staticPropertyName, process, i, j, ln;
+ preprocessor, staticPropertyName, process, i, j, ln;
for (i = 0, ln = baseStaticProperties.length; i < ln; i++) {
staticPropertyName = baseStaticProperties[i];
@@ -3088,7 +3209,7 @@ var Base = Ext.Base = function() {};
for (j = 0, ln = preprocessorStack.length; j < ln; j++) {
preprocessor = preprocessorStack[j];
- if (typeof preprocessor === 'string') {
+ if (typeof preprocessor == 'string') {
preprocessor = registeredPreprocessors[preprocessor];
if (!preprocessor.always) {
@@ -3105,7 +3226,7 @@ var Base = Ext.Base = function() {};
}
}
- classData.onClassCreated = onClassCreated;
+ classData.onClassCreated = onClassCreated || Ext.emptyFn;
classData.onBeforeClassCreated = function(cls, data) {
onClassCreated = data.onClassCreated;
@@ -3115,9 +3236,7 @@ var Base = Ext.Base = function() {};
cls.implement(data);
- if (onClassCreated) {
- onClassCreated.call(cls, cls);
- }
+ onClassCreated.call(cls, cls);
};
process = function(cls, data) {
@@ -3180,7 +3299,7 @@ var Base = Ext.Base = function() {};
var defaultPreprocessors = this.defaultPreprocessors,
index;
- if (typeof offset === 'string') {
+ if (typeof offset == 'string') {
if (offset === 'first') {
defaultPreprocessors.unshift(name);
@@ -3241,6 +3360,7 @@ var Base = Ext.Base = function() {};
delete data.extend;
+
parentStatics = parentPrototype.$inheritableStatics;
if (parentStatics) {
@@ -3252,15 +3372,19 @@ var Base = Ext.Base = function() {};
}
}
}
+
+
if (parentPrototype.config) {
clsPrototype.config = Ext.Object.merge({}, parentPrototype.config);
}
else {
clsPrototype.config = {};
}
+
+
if (clsPrototype.$onExtended) {
clsPrototype.$onExtended.call(cls, cls, data);
}
@@ -3269,54 +3393,30 @@ var Base = Ext.Base = function() {};
clsPrototype.$onExtended = data.onClassExtended;
delete data.onClassExtended;
}
+
}, true);
+
Class.registerPreprocessor('statics', function(cls, data) {
- var statics = data.statics,
- name;
-
- for (name in statics) {
- if (statics.hasOwnProperty(name)) {
- cls[name] = statics[name];
- }
- }
+ cls.addStatics(data.statics);
delete data.statics;
});
+
+
Class.registerPreprocessor('inheritableStatics', function(cls, data) {
- var statics = data.inheritableStatics,
- inheritableStatics,
- prototype = cls.prototype,
- name;
-
- inheritableStatics = prototype.$inheritableStatics;
-
- if (!inheritableStatics) {
- inheritableStatics = prototype.$inheritableStatics = [];
- }
-
- for (name in statics) {
- if (statics.hasOwnProperty(name)) {
- cls[name] = statics[name];
- inheritableStatics.push(name);
- }
- }
+ cls.addInheritableStatics(data.inheritableStatics);
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;
@@ -3337,7 +3437,7 @@ var Base = Ext.Base = function() {};
data[setter] = function(val) {
var ret = this[apply].call(this, val, this[pName]);
- if (ret !== undefined) {
+ if (typeof ret != 'undefined') {
this[pName] = ret;
}
@@ -3355,9 +3455,54 @@ var Base = Ext.Base = function() {};
Ext.Object.merge(prototype.config, data.config);
delete data.config;
});
+
+
+
+
+ Class.registerPreprocessor('mixins', function(cls, data) {
+ var mixins = data.mixins,
+ name, mixin, i, ln;
+
+ delete data.mixins;
+
+ Ext.Function.interceptBefore(data, 'onClassCreated', function(cls) {
+ if (mixins instanceof Array) {
+ for (i = 0,ln = mixins.length; i < ln; i++) {
+ mixin = mixins[i];
+ name = mixin.prototype.mixinId || mixin.$className;
+
+ cls.mixin(name, mixin);
+ }
+ }
+ else {
+ for (name in mixins) {
+ if (mixins.hasOwnProperty(name)) {
+ cls.mixin(name, mixins[name]);
+ }
+ }
+ }
+ });
+ });
- Class.setDefaultPreprocessors(['extend', 'statics', 'inheritableStatics', 'mixins', 'config']);
+
+ Class.setDefaultPreprocessors([
+ 'extend'
+
+ ,'statics'
+
+
+ ,'inheritableStatics'
+
+
+ ,'config'
+
+
+ ,'mixins'
+
+ ]);
+
+
Ext.extend = function(subclass, superclass, members) {
if (arguments.length === 2 && Ext.isObject(superclass)) {
@@ -3373,7 +3518,21 @@ var Base = Ext.Base = function() {};
}
members.extend = superclass;
- members.preprocessors = ['extend', 'mixins', 'config', 'statics'];
+ members.preprocessors = [
+ 'extend'
+
+ ,'statics'
+
+
+ ,'inheritableStatics'
+
+
+ ,'mixins'
+
+
+ ,'config'
+
+ ];
if (subclass) {
cls = new Class(subclass, members);
@@ -3392,6 +3551,7 @@ var Base = Ext.Base = function() {};
return cls;
};
+
})();
@@ -3512,10 +3672,11 @@ var Base = Ext.Base = function() {};
setNamespace: function(name, value) {
var root = Ext.global,
parts = this.parseNamespace(name),
- leaf = parts.pop(),
- i, ln, part;
+ ln = parts.length - 1,
+ leaf = parts[ln],
+ i, part;
- for (i = 0, ln = parts.length; i < ln; i++) {
+ for (i = 0; i < ln; i++) {
part = parts[i];
if (typeof part !== 'string') {
@@ -3670,7 +3831,7 @@ var Base = Ext.Base = function() {};
registeredPostprocessors = manager.postprocessors,
index = 0,
postprocessors = [],
- postprocessor, postprocessors, process, i, ln;
+ postprocessor, process, i, ln;
delete data.postprocessors;
@@ -3915,33 +4076,21 @@ var Base = Ext.Base = function() {};
}
};
+ var defaultPostprocessors = Manager.defaultPostprocessors;
+
+
Manager.registerPostprocessor('alias', function(name, cls, data) {
var aliases = data.alias,
- widgetPrefix = 'widget.',
- i, ln, alias;
+ i, ln;
- if (!(aliases instanceof Array)) {
- aliases = [aliases];
- }
+ delete data.alias;
for (i = 0, ln = aliases.length; i < ln; i++) {
alias = aliases[i];
-
this.setAlias(cls, alias);
}
-
-
- for (i = 0, ln = aliases.length; i < ln; i++) {
- alias = aliases[i];
-
- if (alias.substring(0, widgetPrefix.length) === widgetPrefix) {
-
- cls.xtype = cls.$xtype = alias.substring(widgetPrefix.length);
- break;
- }
- }
});
@@ -4025,7 +4174,71 @@ var Base = Ext.Base = function() {};
createByAlias: alias(Manager, 'instantiateByAlias'),
- define: alias(Manager, 'create'),
+
+
+ define: function (className, data, createdFn) {
+ if (!data.override) {
+ return Manager.create.apply(Manager, arguments);
+ }
+
+ var requires = data.requires,
+ uses = data.uses,
+ overrideName = className;
+
+ className = data.override;
+
+
+ data = Ext.apply({}, data);
+ delete data.requires;
+ delete data.uses;
+ delete data.override;
+
+
+ if (typeof requires == 'string') {
+ requires = [ className, requires ];
+ } else if (requires) {
+ requires = requires.slice(0);
+ requires.unshift(className);
+ } else {
+ requires = [ className ];
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ return Manager.create(overrideName, {
+ requires: requires,
+ uses: uses,
+ isPartial: true,
+ constructor: function () {
+ }
+ }, function () {
+ var cls = Manager.get(className);
+ if (cls.override) {
+ cls.override(data);
+ } else {
+ cls.self.override(data);
+ }
+
+ if (createdFn) {
+
+
+
+ createdFn.call(cls);
+ }
+ });
+ },
getClassName: alias(Manager, 'getName'),
@@ -4068,6 +4281,56 @@ var Base = Ext.Base = function() {};
Class.setDefaultPreprocessorPosition('className', 'first');
+ Class.registerPreprocessor('xtype', function(cls, data) {
+ var xtypes = Ext.Array.from(data.xtype),
+ widgetPrefix = 'widget.',
+ aliases = Ext.Array.from(data.alias),
+ i, ln, xtype;
+
+ data.xtype = xtypes[0];
+ data.xtypes = xtypes;
+
+ aliases = data.alias = Ext.Array.from(data.alias);
+
+ for (i = 0,ln = xtypes.length; i < ln; i++) {
+ xtype = xtypes[i];
+
+
+ aliases.push(widgetPrefix + xtype);
+ }
+
+ data.alias = aliases;
+ });
+
+ Class.setDefaultPreprocessorPosition('xtype', 'last');
+
+ Class.registerPreprocessor('alias', function(cls, data) {
+ var aliases = Ext.Array.from(data.alias),
+ xtypes = Ext.Array.from(data.xtypes),
+ widgetPrefix = 'widget.',
+ widgetPrefixLength = widgetPrefix.length,
+ i, ln, alias, xtype;
+
+ for (i = 0, ln = aliases.length; i < ln; i++) {
+ alias = aliases[i];
+
+
+ if (alias.substring(0, widgetPrefixLength) === widgetPrefix) {
+ xtype = alias.substring(widgetPrefixLength);
+ Ext.Array.include(xtypes, xtype);
+
+ if (!cls.xtype) {
+ cls.xtype = data.xtype = xtype;
+ }
+ }
+ }
+
+ data.alias = aliases;
+ data.xtypes = xtypes;
+ });
+
+ Class.setDefaultPreprocessorPosition('alias', 'last');
+
})(Ext.Class, Ext.Function.alias);
@@ -4616,7 +4879,7 @@ var Base = Ext.Base = function() {};
}
}
}
- else {
+ else if (typeof propertyValue != 'function') {
for (j in propertyValue) {
if (propertyValue.hasOwnProperty(j)) {
value = propertyValue[j];
@@ -4655,7 +4918,7 @@ var Base = Ext.Base = function() {};
}
}
}
- else {
+ else if (typeof propertyValue != 'function') {
for (var k in propertyValue) {
if (propertyValue.hasOwnProperty(k)) {
value = propertyValue[k];
@@ -4864,7 +5127,7 @@ Ext.JSON = new(function() {
this.encodeDate = function(o) {
- return '"' + o.getFullYear() + "-"
+ return '"' + o.getFullYear() + "-"
+ pad(o.getMonth() + 1) + "-"
+ pad(o.getDate()) + "T"
+ pad(o.getHours()) + ":"
@@ -4920,8 +5183,6 @@ Ext.apply(Ext, {
userAgent: navigator.userAgent.toLowerCase(),
cache: {},
idSeed: 1000,
- BLANK_IMAGE_URL : 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
- isStrict: document.compatMode == "CSS1Compat",
windowId: 'ext-window',
documentId: 'ext-document',
@@ -5051,9 +5312,15 @@ window.undefined = window.undefined;
(function(){
+
var check = function(regex){
return regex.test(Ext.userAgent);
},
+ isStrict = document.compatMode == "CSS1Compat",
+ version = function (is, regex) {
+ var m;
+ return (is && (m = regex.exec(Ext.userAgent))) ? parseFloat(m[1]) : 0;
+ },
docMode = document.documentMode,
isOpera = check(/opera/),
isOpera10_5 = isOpera && check(/version\/10\.5/),
@@ -5063,6 +5330,7 @@ window.undefined = window.undefined;
isSafari2 = isSafari && check(/applewebkit\/4/),
isSafari3 = isSafari && check(/version\/3/),
isSafari4 = isSafari && check(/version\/4/),
+ isSafari5 = isSafari && check(/version\/5/),
isIE = !isOpera && check(/msie/),
isIE7 = isIE && (check(/msie 7/) || docMode == 7),
isIE8 = isIE && (check(/msie 8/) && docMode != 7 && docMode != 9 || docMode == 8),
@@ -5071,6 +5339,7 @@ window.undefined = window.undefined;
isGecko = !isWebKit && check(/gecko/),
isGecko3 = isGecko && check(/rv:1\.9/),
isGecko4 = isGecko && check(/rv:2\.0/),
+ isGecko5 = isGecko && check(/rv:5\./),
isFF3_0 = isGecko3 && check(/rv:1\.9\.0/),
isFF3_5 = isGecko3 && check(/rv:1\.9\.1/),
isFF3_6 = isGecko3 && check(/rv:1\.9\.2/),
@@ -5078,17 +5347,24 @@ window.undefined = window.undefined;
isMac = check(/macintosh|mac os x/),
isLinux = check(/linux/),
scrollbarSize = null,
- webKitVersion = isWebKit && (/webkit\/(\d+\.\d+)/.exec(Ext.userAgent));
+ chromeVersion = version(true, /\bchrome\/(\d+\.\d+)/),
+ firefoxVersion = version(true, /\bfirefox\/(\d+\.\d+)/),
+ ieVersion = version(isIE, /msie (\d+\.\d+)/),
+ operaVersion = version(isOpera, /version\/(\d+\.\d+)/),
+ safariVersion = version(isSafari, /version\/(\d+\.\d+)/),
+ webKitVersion = version(isWebKit, /webkit\/(\d+\.\d+)/),
+ isSecure = /^https/i.test(window.location.protocol);
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(e) {}
- Ext.setVersion('extjs', '4.0.2a');
+
+ Ext.setVersion('extjs', '4.0.7');
Ext.apply(Ext, {
- SSL_SECURE_URL : Ext.isSecure && isIE ? 'javascript:""' : 'about:blank',
+ SSL_SECURE_URL : isSecure && isIE ? 'javascript:""' : 'about:blank',
@@ -5147,6 +5423,10 @@ window.undefined = window.undefined;
}
},
+ isStrict: isStrict,
+
+ isIEQuirks: isIE && !isStrict,
+
isOpera : isOpera,
@@ -5169,6 +5449,9 @@ window.undefined = window.undefined;
isSafari4 : isSafari4,
+ isSafari5 : isSafari5,
+
+
isSafari2 : isSafari2,
@@ -5196,15 +5479,24 @@ window.undefined = window.undefined;
isGecko4 : isGecko4,
+ isGecko5 : isGecko5,
- isFF3_0 : isFF3_0,
+ isFF3_0 : isFF3_0,
+
isFF3_5 : isFF3_5,
+
isFF3_6 : isFF3_6,
+ isFF4 : 4 <= firefoxVersion && firefoxVersion < 5,
+
+
+ isFF5 : 5 <= firefoxVersion && firefoxVersion < 6,
+
+
isLinux : isLinux,
@@ -5214,10 +5506,28 @@ window.undefined = window.undefined;
isMac : isMac,
- webKitVersion: webKitVersion ? parseFloat(webKitVersion[1]) : -1,
+ chromeVersion: chromeVersion,
+
+
+ firefoxVersion: firefoxVersion,
+
+
+ ieVersion: ieVersion,
+
+
+ operaVersion: operaVersion,
+
+
+ safariVersion: safariVersion,
- BLANK_IMAGE_URL : (isIE6 || isIE7) ? 'http:/' + '/www.sencha.com/s.gif' : 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
+ webKitVersion: webKitVersion,
+
+
+ isSecure: isSecure,
+
+
+ BLANK_IMAGE_URL : (isIE6 || isIE7) ? '/' + '/www.sencha.com/s.gif' : 'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
value : function(v, defaultValue, allowBlank){
@@ -5309,8 +5619,8 @@ window.undefined = window.undefined;
},
- log : function (message) {
- },
+ log :
+ Ext.emptyFn,
partition : function(arr, truth){
@@ -5462,7 +5772,7 @@ Ext.application = function(config) {
for (; i < decimals; i++) {
format += '0';
}
- v = UtilFormat.number(v, format);
+ v = UtilFormat.number(v, format);
if ((end || UtilFormat.currencyAtEnd) === true) {
return Ext.String.format("{0}{1}{2}", negativeSign, v, currencySign || UtilFormat.currencySign);
} else {
@@ -5602,7 +5912,7 @@ Ext.application = function(config) {
fnum = psplit[0] + dec + psplit[1];
}
}
-
+
if (neg) {
neg = fnum.replace(/[^1-9]/g, '') !== '';
@@ -6202,7 +6512,7 @@ Ext.supports = {
Ext.ns('Ext.core');
-Ext.core.DomHelper = function(){
+Ext.core.DomHelper = Ext.DomHelper = function(){
var tempTableEl = null,
emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,
tableRe = /^table|tbody|tr|td$/i,
@@ -6234,11 +6544,11 @@ Ext.core.DomHelper = function(){
(sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el);
}
} else {
- newNode = Ext.core.DomHelper.insertHtml(pos, el, Ext.core.DomHelper.createHtml(o));
+ newNode = Ext.DomHelper.insertHtml(pos, el, Ext.DomHelper.createHtml(o));
}
return returnElement ? Ext.get(newNode, true) : newNode;
}
-
+
function createDom(o, parentNode){
var el,
doc = document,
@@ -6271,7 +6581,7 @@ Ext.core.DomHelper = function(){
}
}
}
- Ext.core.DomHelper.applyStyles(el, o.style);
+ Ext.DomHelper.applyStyles(el, o.style);
if ((cn = o.children || o.cn)) {
createDom(cn, el);
@@ -6386,14 +6696,14 @@ Ext.core.DomHelper = function(){
el.insertBefore(node, before);
return node;
}
+
-
function createContextualFragment(html){
var div = document.createElement("div"),
fragment = document.createDocumentFragment(),
i = 0,
length, childNodes;
-
+
div.innerHTML = html;
childNodes = div.childNodes;
length = childNodes.length;
@@ -6404,7 +6714,7 @@ Ext.core.DomHelper = function(){
return fragment;
}
-
+
pub = {
markup : function(o){
@@ -6419,7 +6729,7 @@ Ext.core.DomHelper = function(){
styles = styles.call();
}
if (typeof styles == "string") {
- styles = Ext.core.Element.parseStyles(styles);
+ styles = Ext.Element.parseStyles(styles);
}
if (typeof styles == "object") {
el.setStyle(styles);
@@ -6441,13 +6751,13 @@ Ext.core.DomHelper = function(){
hash[beforebegin] = ['BeforeBegin', 'previousSibling'];
hash[afterend] = ['AfterEnd', 'nextSibling'];
-
+
if (el.insertAdjacentHTML) {
if(tableRe.test(el.tagName) && (rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html))){
return rs;
}
-
+
hash[afterbegin] = ['AfterBegin', 'firstChild'];
hash[beforeend] = ['BeforeEnd', 'lastChild'];
@@ -6459,7 +6769,7 @@ Ext.core.DomHelper = function(){
} else {
if (Ext.isTextNode(el)) {
- where = where === 'afterbegin' ? 'beforebegin' : where;
+ where = where === 'afterbegin' ? 'beforebegin' : where;
where = where === 'beforeend' ? 'afterend' : where;
}
range = Ext.supports.CreateContextualFragment ? el.ownerDocument.createRange() : undefined;
@@ -6482,7 +6792,7 @@ Ext.core.DomHelper = function(){
} else {
frag = createContextualFragment(html);
}
-
+
if(where == afterbegin){
el.insertBefore(frag, el.firstChild);
}else{
@@ -6524,16 +6834,16 @@ Ext.core.DomHelper = function(){
},
createHtml : createHtml,
-
+
createDom: createDom,
-
+
useDom : false,
-
+
createTemplate : function(o){
- var html = Ext.core.DomHelper.createHtml(o);
+ var html = Ext.DomHelper.createHtml(o);
return Ext.create('Ext.Template', html);
}
};
@@ -6555,6 +6865,7 @@ Ext.core.DomQuery = Ext.DomQuery = function(){
tagTokenRe = /^(#)?([\w-\*]+)/,
nthRe = /(\d*)n\+?(\d*)/,
nthRe2 = /\D/,
+ startIdRe = /^\s*\#/,
@@ -7029,12 +7340,22 @@ Ext.core.DomQuery = Ext.DomQuery = function(){
select : document.querySelectorAll ? function(path, root, type) {
root = root || document;
- if (!Ext.DomQuery.isXml(root)) {
- try {
- var cs = root.querySelectorAll(path);
- return Ext.Array.toArray(cs);
- }
- catch (ex) {}
+
+ if (!Ext.DomQuery.isXml(root) && !(Ext.isSafari3 && !Ext.isStrict)) {
+ try {
+
+ var isDocumentRoot = root.nodeType === 9,
+ _path = path,
+ _root = root;
+
+ if (!isDocumentRoot && path.indexOf(',') === -1 && !startIdRe.test(path)) {
+ _path = '#' + Ext.id(root) + ' ' + path;
+ _root = root.parentNode;
+ }
+ return Ext.Array.toArray(_root.querySelectorAll(_path));
+ }
+ catch (e) {
+ }
}
return Ext.DomQuery.jsSelect.call(this, path, root, type);
} : function(path, root, type) {
@@ -7353,8 +7674,8 @@ Ext.query = Ext.DomQuery.select;
this.id = id || Ext.id(dom);
};
- var DH = Ext.core.DomHelper,
- El = Ext.core.Element;
+ var DH = Ext.DomHelper,
+ El = Ext.Element;
El.prototype = {
@@ -7501,7 +7822,7 @@ Ext.query = Ext.DomQuery.select;
}
- if (size === "" || size == "auto" || size === undefined || size === null) {
+ if (size === "" || size == "auto" || size == null) {
return size || '';
}
@@ -7538,7 +7859,7 @@ Ext.query = Ext.DomQuery.select;
contains: function(el) {
- return ! el ? false: Ext.core.Element.isAncestor(this.dom, el.dom ? el.dom: el);
+ return ! el ? false: Ext.Element.isAncestor(this.dom, el.dom ? el.dom: el);
},
@@ -7665,6 +7986,31 @@ Ext.query = Ext.DomQuery.select;
return null;
};
+
+ ep.getById = (!Ext.isIE6 && !Ext.isIE7 && !Ext.isIE8) ? El.get :
+ function (id) {
+ var dom = this.dom,
+ cached, el, ret;
+
+ if (dom) {
+ el = dom.all[id];
+ if (el) {
+
+
+ cached = EC[id];
+ if (cached && cached.el) {
+ ret = cached.el;
+ ret.dom = el;
+ } else {
+ ret = El.addToCache(new El(el));
+ }
+ return ret;
+ }
+ }
+
+ return El.get(id);
+ };
+
El.addToCache = function(el, id) {
if (el) {
id = id || el.id;
@@ -7796,7 +8142,7 @@ Ext.query = Ext.DomQuery.select;
})();
-Ext.core.Element.addMethods({
+Ext.Element.addMethods({
findParent : function(simpleSelector, maxDepth, returnEl) {
var p = this.dom,
@@ -7818,7 +8164,7 @@ Ext.core.Element.addMethods({
}
return null;
},
-
+
findParentNode : function(simpleSelector, maxDepth, returnEl) {
var p = Ext.fly(this.dom.parentNode, '_internal');
@@ -7832,7 +8178,7 @@ Ext.core.Element.addMethods({
select : function(selector) {
- return Ext.core.Element.select(selector, false, this.dom);
+ return Ext.Element.select(selector, false, this.dom);
},
@@ -7888,7 +8234,7 @@ Ext.core.Element.addMethods({
if (!this.dom) {
return null;
}
-
+
var n = this.dom[start];
while (n) {
if (n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))) {
@@ -7901,7 +8247,7 @@ Ext.core.Element.addMethods({
});
-Ext.core.Element.addMethods({
+Ext.Element.addMethods({
appendChild : function(el) {
return Ext.get(el).appendTo(this);
@@ -7966,9 +8312,9 @@ Ext.core.Element.addMethods({
}
}else{
if (isAfter && !me.dom.nextSibling) {
- rt = Ext.core.DomHelper.append(me.dom.parentNode, el, !returnDom);
+ rt = Ext.DomHelper.append(me.dom.parentNode, el, !returnDom);
} else {
- rt = Ext.core.DomHelper[isAfter ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);
+ rt = Ext.DomHelper[isAfter ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);
}
}
return rt;
@@ -7990,13 +8336,13 @@ Ext.core.Element.addMethods({
el = Ext.get(el);
me.dom.parentNode.insertBefore(el, me.dom);
}else{
- el = Ext.core.DomHelper.insertBefore(me.dom, el);
+ el = Ext.DomHelper.insertBefore(me.dom, el);
}
delete Ext.cache[me.id];
Ext.removeNode(me.dom);
me.id = Ext.id(me.dom = el);
- Ext.core.Element.addToCache(me.isFlyweight ? new Ext.core.Element(me.dom) : me);
+ Ext.Element.addToCache(me.isFlyweight ? new Ext.Element(me.dom) : me);
return me;
},
@@ -8004,16 +8350,16 @@ Ext.core.Element.addMethods({
createChild : function(config, insertBefore, returnDom) {
config = config || {tag:'div'};
if (insertBefore) {
- return Ext.core.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
+ return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
}
else {
- return Ext.core.DomHelper[!this.dom.firstChild ? 'insertFirst' : 'append'](this.dom, config, returnDom !== true);
+ return Ext.DomHelper[!this.dom.firstChild ? 'insertFirst' : 'append'](this.dom, config, returnDom !== true);
}
},
wrap : function(config, returnDom) {
- var newEl = Ext.core.DomHelper.insertBefore(this.dom, config || {tag: "div"}, !returnDom),
+ var newEl = Ext.DomHelper.insertBefore(this.dom, config || {tag: "div"}, !returnDom),
d = newEl.dom || newEl;
d.appendChild(this.dom);
@@ -8022,16 +8368,16 @@ Ext.core.Element.addMethods({
insertHtml : function(where, html, returnEl) {
- var el = Ext.core.DomHelper.insertHtml(where, this.dom, html);
+ var el = Ext.DomHelper.insertHtml(where, this.dom, html);
return returnEl ? Ext.get(el) : el;
}
});
(function(){
- Ext.core.Element.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';
- var supports = Ext.supports,
+ var ELEMENT = Ext.Element,
+ supports = Ext.supports,
view = document.defaultView,
opacityRe = /alpha\(opacity=(.*)\)/i,
trimRe = /^\s+|\s+$/g,
@@ -8058,16 +8404,26 @@ Ext.core.Element.addMethods({
borders = {l: BORDER + LEFT + WIDTH, r: BORDER + RIGHT + WIDTH, t: BORDER + TOP + WIDTH, b: BORDER + BOTTOM + WIDTH},
paddings = {l: PADDING + LEFT, r: PADDING + RIGHT, t: PADDING + TOP, b: PADDING + BOTTOM},
margins = {l: MARGIN + LEFT, r: MARGIN + RIGHT, t: MARGIN + TOP, b: MARGIN + BOTTOM},
- data = Ext.core.Element.data;
+ data = ELEMENT.data;
+
+ ELEMENT.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';
+
+
+
+ ELEMENT.inheritedProps = {
+ fontSize: 1,
+ fontStyle: 1,
+ opacity: 1
+ };
+
+ Ext.override(ELEMENT, {
- Ext.override(Ext.core.Element, {
-
adjustWidth : function(width) {
var me = this,
isNum = (typeof width == 'number');
-
+
if(isNum && me.autoBoxAdjust && !me.isBorderBox()){
width -= (me.getBorderWidth("lr") + me.getPadding("lr"));
}
@@ -8078,7 +8434,7 @@ Ext.core.Element.addMethods({
adjustHeight : function(height) {
var me = this,
isNum = (typeof height == "number");
-
+
if(isNum && me.autoBoxAdjust && !me.isBorderBox()){
height -= (me.getBorderWidth("tb") + me.getPadding("tb"));
}
@@ -8203,7 +8559,7 @@ Ext.core.Element.addMethods({
},
- getStyle : function(){
+ getStyle : function() {
return view && view.getComputedStyle ?
function(prop){
var el = this.dom,
@@ -8212,49 +8568,74 @@ Ext.core.Element.addMethods({
if(el == document){
return null;
}
- prop = Ext.core.Element.normalize(prop);
+ prop = ELEMENT.normalize(prop);
out = (v = el.style[prop]) ? v :
(cs = view.getComputedStyle(el, "")) ? cs[prop] : null;
-
+
if(prop == 'marginRight' && out != '0px' && !supports.RightMargin){
- cleaner = Ext.core.Element.getRightMarginFixCleaner(el);
+ cleaner = ELEMENT.getRightMarginFixCleaner(el);
display = this.getStyle('display');
el.style.display = 'inline-block';
out = view.getComputedStyle(el, '').marginRight;
el.style.display = display;
cleaner();
}
-
+
if(prop == 'backgroundColor' && out == 'rgba(0, 0, 0, 0)' && !supports.TransparentColor){
out = 'transparent';
}
return out;
} :
- function(prop){
+ function (prop) {
var el = this.dom,
m, cs;
if (el == document) {
return null;
}
-
- if (prop == 'opacity') {
- if (el.style.filter.match) {
- m = el.style.filter.match(opacityRe);
- if(m){
- var fv = parseFloat(m[1]);
- if(!isNaN(fv)){
- return fv ? fv / 100 : 0;
+ prop = ELEMENT.normalize(prop);
+
+ do {
+ if (prop == 'opacity') {
+ if (el.style.filter.match) {
+ m = el.style.filter.match(opacityRe);
+ if(m){
+ var fv = parseFloat(m[1]);
+ if(!isNaN(fv)){
+ return fv ? fv / 100 : 0;
+ }
}
}
+ return 1;
}
- return 1;
- }
- prop = Ext.core.Element.normalize(prop);
- return el.style[prop] || ((cs = el.currentStyle) ? cs[prop] : null);
- };
+
+
+
+ if (!Ext.isIE6) {
+ return el.style[prop] || ((cs = el.currentStyle) ? cs[prop] : null);
+ }
+
+ try {
+ return el.style[prop] || ((cs = el.currentStyle) ? cs[prop] : null);
+ } catch (e) {
+
+
+ }
+
+ if (!ELEMENT.inheritedProps[prop]) {
+ break;
+ }
+
+ el = el.parentNode;
+
+
+
+ } while (el);
+
+ return null;
+ }
}(),
@@ -8298,7 +8679,7 @@ Ext.core.Element.addMethods({
me.setOpacity(value);
}
else {
- me.dom.style[Ext.core.Element.normalize(style)] = value;
+ me.dom.style[ELEMENT.normalize(style)] = value;
}
}
}
@@ -8360,7 +8741,7 @@ Ext.core.Element.addMethods({
}
return this;
},
-
+
adjustDirect2DDimension: function(dimension) {
var me = this,
@@ -8370,7 +8751,7 @@ Ext.core.Element.addMethods({
inlinePosition = dom.style['position'],
originIndex = dimension === 'width' ? 0 : 1,
floating;
-
+
if (display === 'inline') {
dom.style['display'] = 'inline-block';
}
@@ -8380,16 +8761,16 @@ Ext.core.Element.addMethods({
floating = (parseFloat(me.getStyle(dimension)) || parseFloat(dom.currentStyle.msTransformOrigin.split(' ')[originIndex]) * 2) % 1;
-
+
dom.style['position'] = inlinePosition;
-
+
if (display === 'inline') {
dom.style['display'] = inlineDisplay;
}
return floating;
},
-
+
getHeight: function(contentHeight, preciseHeight) {
var me = this,
@@ -8433,7 +8814,7 @@ Ext.core.Element.addMethods({
}
return height;
},
-
+
getWidth: function(contentWidth, preciseWidth) {
var me = this,
@@ -8448,7 +8829,7 @@ Ext.core.Element.addMethods({
overflow = style.overflow;
me.setStyle({overflow: 'hidden'});
}
-
+
if (Ext.isOpera10_5) {
if (dom.parentNode.currentStyle.position === 'relative') {
@@ -8458,7 +8839,7 @@ Ext.core.Element.addMethods({
dom.parentNode.style.position = parentPosition;
}
width = Math.max(width || 0, dom.offsetWidth);
-
+
@@ -8484,11 +8865,11 @@ Ext.core.Element.addMethods({
width++;
}
}
-
+
if (contentWidth) {
width -= (me.getBorderWidth("lr") + me.getPadding("lr"));
}
-
+
if (Ext.isIEQuirks) {
me.setStyle({ overflow: overflow});
}
@@ -8577,14 +8958,14 @@ Ext.core.Element.addMethods({
if(data(dom, ISCLIPPED)){
data(dom, ISCLIPPED, false);
clip = data(dom, ORIGINALCLIP);
- if(o.o){
- me.setStyle(OVERFLOW, o.o);
+ if(clip.o){
+ me.setStyle(OVERFLOW, clip.o);
}
- if(o.x){
- me.setStyle(OVERFLOWX, o.x);
+ if(clip.x){
+ me.setStyle(OVERFLOWX, clip.x);
}
- if(o.y){
- me.setStyle(OVERFLOWY, o.y);
+ if(clip.y){
+ me.setStyle(OVERFLOWY, clip.y);
}
}
return me;
@@ -8608,10 +8989,10 @@ Ext.core.Element.addMethods({
},
margins : margins,
-
+
applyStyles : function(style){
- Ext.core.DomHelper.applyStyles(this.dom, style);
+ Ext.DomHelper.applyStyles(this.dom, style);
return this;
},
@@ -8620,7 +9001,7 @@ Ext.core.Element.addMethods({
var styles = {},
len = arguments.length,
i = 0, style;
-
+
for(; i < len; ++i) {
style = arguments[i];
styles[style] = this.getStyle(style);
@@ -8631,7 +9012,7 @@ Ext.core.Element.addMethods({
boxWrap : function(cls){
cls = cls || Ext.baseCSSPrefix + 'box';
- var el = Ext.get(this.insertHtml("beforeBegin", "<div class='" + cls + "'>" + Ext.String.format(Ext.core.Element.boxMarkup, cls) + "</div>"));
+ var el = Ext.get(this.insertHtml("beforeBegin", "<div class='" + cls + "'>" + Ext.String.format(ELEMENT.boxMarkup, cls) + "</div>"));
Ext.DomQuery.selectNode('.' + cls + '-mc', el.dom).appendChild(this.dom);
return el;
},
@@ -8647,6 +9028,11 @@ Ext.core.Element.addMethods({
width = me.adjustWidth(width);
height = me.adjustHeight(height);
if(!animate || !me.anim){
+
+
+ if (!Ext.isIEQuirks && (Ext.isIE6 || Ext.isIE7)) {
+ me.dom.offsetTop;
+ }
me.dom.style.width = me.addUnits(width);
me.dom.style.height = me.addUnits(height);
}
@@ -8681,7 +9067,7 @@ Ext.core.Element.addMethods({
getComputedWidth : function(){
var me = this,
w = Math.max(me.dom.offsetWidth, me.dom.clientWidth);
-
+
if(!w){
w = parseFloat(me.getStyle('width')) || 0;
if(!me.isBorderBox()){
@@ -8749,8 +9135,8 @@ Ext.core.Element.addMethods({
if (isDoc) {
ret = {
- width : Ext.core.Element.getViewWidth(),
- height : Ext.core.Element.getViewHeight()
+ width : ELEMENT.getViewWidth(),
+ height : ELEMENT.getViewHeight()
};
@@ -8787,8 +9173,8 @@ Ext.core.Element.addMethods({
if (isDoc) {
return {
- width : Ext.core.Element.getViewWidth(),
- height : Ext.core.Element.getViewHeight()
+ width : ELEMENT.getViewWidth(),
+ height : ELEMENT.getViewHeight()
};
}
@@ -8825,14 +9211,28 @@ Ext.core.Element.addMethods({
},
+ selectable : function() {
+ var me = this;
+ me.dom.unselectable = "off";
+
+ me.on('selectstart', function (e) {
+ e.stopPropagation();
+ return true;
+ });
+ me.applyStyles("-moz-user-select: text; -khtml-user-select: text;");
+ me.removeCls(Ext.baseCSSPrefix + 'unselectable');
+ return me;
+ },
+
+
unselectable : function(){
var me = this;
me.dom.unselectable = "on";
me.swallowEvent("selectstart", true);
- me.applyStyles("-moz-user-select:none;-khtml-user-select:none;");
+ me.applyStyles("-moz-user-select:-moz-none;-khtml-user-select:none;");
me.addCls(Ext.baseCSSPrefix + 'unselectable');
-
+
return me;
},
@@ -8856,21 +9256,21 @@ Ext.core.Element.addMethods({
})();
-Ext.core.Element.VISIBILITY = 1;
+Ext.Element.VISIBILITY = 1;
-Ext.core.Element.DISPLAY = 2;
+Ext.Element.DISPLAY = 2;
-Ext.core.Element.OFFSETS = 3;
+Ext.Element.OFFSETS = 3;
-Ext.core.Element.ASCLASS = 4;
+Ext.Element.ASCLASS = 4;
-Ext.core.Element.visibilityCls = Ext.baseCSSPrefix + 'hide-nosize';
+Ext.Element.visibilityCls = Ext.baseCSSPrefix + 'hide-nosize';
-Ext.core.Element.addMethods(function(){
- var El = Ext.core.Element,
+Ext.Element.addMethods(function(){
+ var El = Ext.Element,
OPACITY = "opacity",
VISIBILITY = "visibility",
DISPLAY = "display",
@@ -9074,7 +9474,7 @@ Ext.core.Element.addMethods(function(){
};
}());
-Ext.applyIf(Ext.core.Element.prototype, {
+Ext.applyIf(Ext.Element.prototype, {
animate: function(config) {
var me = this;
@@ -9152,7 +9552,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
},
- slideIn: function(anchor, obj, slideOut) {
+ slideIn: function(anchor, obj, slideOut) {
var me = this,
elStyle = me.dom.style,
beforeAnim, wrapAnim;
@@ -9170,13 +9570,13 @@ Ext.applyIf(Ext.core.Element.prototype, {
}
box = me.getBox();
- if ((anchor == 't' || anchor == 'b') && box.height == 0) {
+ if ((anchor == 't' || anchor == 'b') && box.height === 0) {
box.height = me.dom.scrollHeight;
}
- else if ((anchor == 'l' || anchor == 'r') && box.width == 0) {
+ else if ((anchor == 'l' || anchor == 'r') && box.width === 0) {
box.width = me.dom.scrollWidth;
}
-
+
position = me.getPositioning();
me.setSize(box.width, box.height);
@@ -9340,7 +9740,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
if (obj.useDisplay) {
me.setDisplayed(false);
} else {
- me.hide();
+ me.hide();
}
}
else {
@@ -9348,7 +9748,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
me.setPositioning(position);
}
if (wrap.dom) {
- wrap.dom.parentNode.insertBefore(me.dom, wrap.dom);
+ wrap.dom.parentNode.insertBefore(me.dom, wrap.dom);
wrap.remove();
}
me.setSize(box.width, box.height);
@@ -9378,14 +9778,13 @@ Ext.applyIf(Ext.core.Element.prototype, {
return me;
},
-
+
slideOut: function(anchor, o) {
return this.slideIn(anchor, o, true);
},
-
puff: function(obj) {
var me = this,
beforeAnim;
@@ -9417,7 +9816,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
} else {
me.hide();
}
- me.clearOpacity();
+ me.clearOpacity();
me.setPositioning(position);
me.setStyle({fontSize: fontSize});
}
@@ -9440,7 +9839,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
switchOff: function(obj) {
var me = this,
beforeAnim;
-
+
obj = Ext.applyIf(obj || {}, {
easing: 'ease-in',
duration: 500,
@@ -9480,7 +9879,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
me.setDisplayed(false);
} else {
me.hide();
- }
+ }
me.clearOpacity();
me.setPositioning(position);
me.setSize(size);
@@ -9498,7 +9897,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
return me;
},
-
+
frame : function(color, count, obj){
var me = this,
beforeAnim;
@@ -9624,7 +10023,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
return me;
},
-
+
highlight: function(color, o) {
var me = this,
dom = me.dom,
@@ -9635,7 +10034,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
lns = o.listeners || {};
attr = o.attr || 'backgroundColor';
from[attr] = color || 'ffff9c';
-
+
if (!o.to) {
to = {};
to[attr] = o.endColor || me.getColor(attr, 'ffffff', '');
@@ -9643,14 +10042,14 @@ Ext.applyIf(Ext.core.Element.prototype, {
else {
to = o.to;
}
-
+
o.listeners = Ext.apply(Ext.apply({}, lns), {
beforeanimate: function() {
restore = dom.style[attr];
me.clearOpacity();
me.show();
-
+
event = lns.beforeanimate;
if (event) {
fn = event.fn || event;
@@ -9661,7 +10060,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
if (dom) {
dom.style[attr] = restore;
}
-
+
event = lns.afteranimate;
if (event) {
fn = event.fn || event;
@@ -9688,7 +10087,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
return me;
},
-
+
fadeIn: function(o) {
this.animate(Ext.apply({}, o, {
opacity: 1
@@ -9696,7 +10095,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
return this;
},
-
+
fadeOut: function(o) {
this.animate(Ext.apply({}, o, {
opacity: 0
@@ -9704,7 +10103,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
return this;
},
-
+
scale: function(w, h, o) {
this.animate(Ext.apply({}, o, {
width: w,
@@ -9713,7 +10112,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
return this;
},
-
+
shift: function(config) {
this.animate(config);
return this;
@@ -9721,7 +10120,7 @@ Ext.applyIf(Ext.core.Element.prototype, {
});
-Ext.applyIf(Ext.core.Element, {
+Ext.applyIf(Ext.Element, {
unitRe: /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,
camelRe: /(-[a-z])/gi,
opacityRe: /alpha\(opacity=(.*)\)/i,
@@ -9733,7 +10132,7 @@ Ext.applyIf(Ext.core.Element, {
margins: {l: 'margin-left', r: 'margin-right', t: 'margin-top', b: 'margin-bottom'},
- addUnits : Ext.core.Element.prototype.addUnits,
+ addUnits : Ext.Element.prototype.addUnits,
parseBox : function(box) {
@@ -9864,7 +10263,7 @@ Ext.CompositeElementLite = function(els, root){
this.elements = [];
this.add(els, root);
- this.el = new Ext.core.Element.Flyweight();
+ this.el = new Ext.Element.Flyweight();
};
Ext.CompositeElementLite.prototype = {
@@ -9896,7 +10295,7 @@ Ext.CompositeElementLite.prototype = {
return this;
}
if(typeof els == "string"){
- els = Ext.core.Element.selectorFunction(els, root);
+ els = Ext.Element.selectorFunction(els, root);
}else if(els.isComposite){
els = els.elements;
}else if(!Ext.isIterable(els)){
@@ -9919,7 +10318,7 @@ Ext.CompositeElementLite.prototype = {
for(i = 0; i < len; i++) {
e = els[i];
if(e){
- Ext.core.Element.prototype[fn].apply(me.getElement(e), args);
+ Ext.Element.prototype[fn].apply(me.getElement(e), args);
}
}
return me;
@@ -9991,7 +10390,7 @@ Ext.CompositeElementLite.prototype = {
els[els.length] = me.transformElement(el);
}
});
-
+
me.elements = els;
return me;
},
@@ -10028,7 +10427,7 @@ Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addLi
Ext.CompositeElementLite.importElementMethods = function() {
var fnName,
- ElProto = Ext.core.Element.prototype,
+ ElProto = Ext.Element.prototype,
CelProto = Ext.CompositeElementLite.prototype;
for (fnName in ElProto) {
@@ -10046,14 +10445,14 @@ Ext.CompositeElementLite.importElementMethods = function() {
Ext.CompositeElementLite.importElementMethods();
if(Ext.DomQuery){
- Ext.core.Element.selectorFunction = Ext.DomQuery.select;
+ Ext.Element.selectorFunction = Ext.DomQuery.select;
}
-Ext.core.Element.select = function(selector, root){
+Ext.Element.select = function(selector, root){
var els;
if(typeof selector == "string"){
- els = Ext.core.Element.selectorFunction(selector, root);
+ els = Ext.Element.selectorFunction(selector, root);
}else if(selector.length !== undefined){
els = selector;
}else{
@@ -10061,7 +10460,7 @@ Ext.core.Element.select = function(selector, root){
return new Ext.CompositeElementLite(els);
};
-Ext.select = Ext.core.Element.select;
+Ext.select = Ext.Element.select;
Ext.util.DelayedTask = function(fn, scope, args) {
@@ -10294,6 +10693,7 @@ Ext.EventManager = {
if(window.attachEvent){
+
if (window != top) {
return false;
}
@@ -10398,9 +10798,9 @@ Ext.EventManager = {
getId : function(element) {
var skipGarbageCollection = false,
id;
-
+
element = Ext.getDom(element);
-
+
if (element === document || element === window) {
id = element === document ? Ext.documentId : Ext.windowId;
}
@@ -10411,9 +10811,9 @@ Ext.EventManager = {
if (element && (element.getElementById || element.navigator)) {
skipGarbageCollection = true;
}
-
+
if (!Ext.cache[id]){
- Ext.core.Element.addToCache(new Ext.core.Element(element), id);
+ Ext.Element.addToCache(new Ext.Element(element), id);
if (skipGarbageCollection) {
Ext.cache[id].skipGarbageCollection = true;
}
@@ -10694,7 +11094,7 @@ Ext.EventManager = {
if (!element) {
return [];
}
-
+
var eventCache = this.getElementEventCache(element);
return eventCache[eventName] || (eventCache[eventName] = []);
},
@@ -10829,8 +11229,8 @@ Ext.EventManager = {
fireResize: function(){
var me = this,
- w = Ext.core.Element.getViewWidth(),
- h = Ext.core.Element.getViewHeight();
+ w = Ext.Element.getViewWidth(),
+ h = Ext.Element.getViewHeight();
if(me.curHeight != h || me.curWidth != w){
@@ -10928,66 +11328,107 @@ Ext.EventManager.un = Ext.EventManager.removeListener;
html = bd.parentNode;
+ function add (c) {
+ cls.push(baseCSSPrefix + c);
+ }
+
if (Ext.isIE) {
- cls.push(baseCSSPrefix + 'ie');
- }
- if (Ext.isIE6) {
- cls.push(baseCSSPrefix + 'ie6');
- }
- if (Ext.isIE7) {
- cls.push(baseCSSPrefix + 'ie7');
- }
- if (Ext.isIE8) {
- cls.push(baseCSSPrefix + 'ie8');
- }
- if (Ext.isIE9) {
- cls.push(baseCSSPrefix + 'ie9');
+ add('ie');
+
+
+
+
+
+
+
+
+
+
+
+
+ if (Ext.isIE6) {
+ add('ie6');
+ } else {
+ add('ie7p');
+
+ if (Ext.isIE7) {
+ add('ie7');
+ } else {
+ add('ie8p');
+
+ if (Ext.isIE8) {
+ add('ie8');
+ } else {
+ add('ie9p');
+
+ if (Ext.isIE9) {
+ add('ie9');
+ }
+ }
+ }
+ }
+
+ if (Ext.isIE6 || Ext.isIE7) {
+ add('ie7m');
+ }
+ if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8) {
+ add('ie8m');
+ }
+ if (Ext.isIE7 || Ext.isIE8) {
+ add('ie78');
+ }
}
if (Ext.isGecko) {
- cls.push(baseCSSPrefix + 'gecko');
- }
- if (Ext.isGecko3) {
- cls.push(baseCSSPrefix + 'gecko3');
- }
- if (Ext.isGecko4) {
- cls.push(baseCSSPrefix + 'gecko4');
+ add('gecko');
+ if (Ext.isGecko3) {
+ add('gecko3');
+ }
+ if (Ext.isGecko4) {
+ add('gecko4');
+ }
+ if (Ext.isGecko5) {
+ add('gecko5');
+ }
}
if (Ext.isOpera) {
- cls.push(baseCSSPrefix + 'opera');
+ add('opera');
}
if (Ext.isWebKit) {
- cls.push(baseCSSPrefix + 'webkit');
+ add('webkit');
}
if (Ext.isSafari) {
- cls.push(baseCSSPrefix + 'safari');
- }
- if (Ext.isSafari2) {
- cls.push(baseCSSPrefix + 'safari2');
- }
- if (Ext.isSafari3) {
- cls.push(baseCSSPrefix + 'safari3');
- }
- if (Ext.isSafari4) {
- cls.push(baseCSSPrefix + 'safari4');
+ add('safari');
+ if (Ext.isSafari2) {
+ add('safari2');
+ }
+ if (Ext.isSafari3) {
+ add('safari3');
+ }
+ if (Ext.isSafari4) {
+ add('safari4');
+ }
+ if (Ext.isSafari5) {
+ add('safari5');
+ }
}
if (Ext.isChrome) {
- cls.push(baseCSSPrefix + 'chrome');
+ add('chrome');
}
if (Ext.isMac) {
- cls.push(baseCSSPrefix + 'mac');
+ add('mac');
}
if (Ext.isLinux) {
- cls.push(baseCSSPrefix + 'linux');
+ add('linux');
}
if (!Ext.supports.CSS3BorderRadius) {
- cls.push(baseCSSPrefix + 'nbr');
+ add('nbr');
}
if (!Ext.supports.CSS3LinearGradient) {
- cls.push(baseCSSPrefix + 'nlg');
+ add('nlg');
}
if (!Ext.scopeResetCSS) {
- cls.push(baseCSSPrefix + 'reset');
+ add('reset');
}
@@ -11002,9 +11443,6 @@ Ext.EventManager.un = Ext.EventManager.removeListener;
htmlCls.push(baseCSSPrefix + (Ext.isBorderBox ? 'border-box' : 'strict'));
if (!Ext.isStrict) {
htmlCls.push(baseCSSPrefix + 'quirks');
- if (Ext.isIE && !Ext.isStrict) {
- Ext.isIEQuirks = true;
- }
}
Ext.fly(html, '_internal').addCls(htmlCls);
}
@@ -11360,17 +11798,17 @@ Ext.define('Ext.EventObjectImpl', {
getPageY: function(){
return this.getY();
},
-
+
getX: function() {
return this.getXY()[0];
- },
-
+ },
+
getY: function() {
return this.getXY()[1];
},
-
+
getXY: function() {
if (!this.xy) {
@@ -11399,7 +11837,7 @@ Ext.define('Ext.EventObjectImpl', {
correctWheelDelta : function (delta) {
var scale = this.WHEEL_SCALE,
- ret = Math.round(delta / scale + 0.5);
+ ret = Math.round(delta / scale);
if (!ret && delta) {
ret = (delta < 0) ? -1 : 1;
@@ -11721,10 +12159,10 @@ Ext.EventObject = new Ext.EventObjectImpl();
var doc = document,
activeElement = null,
isCSS1 = doc.compatMode == "CSS1Compat",
- ELEMENT = Ext.core.Element,
+ ELEMENT = Ext.Element,
fly = function(el){
if (!_fly) {
- _fly = new Ext.core.Element.Flyweight();
+ _fly = new Ext.Element.Flyweight();
}
_fly.dom = el;
return _fly;
@@ -11842,6 +12280,17 @@ Ext.EventObject = new Ext.EventObjectImpl();
return ELEMENT.getXY(el)[0];
},
+ getOffsetParent: function (el) {
+ el = Ext.getDom(el);
+ try {
+
+ return el.offsetParent;
+ } catch (e) {
+ var body = document.body;
+ return (el == body) ? null : body;
+ }
+ },
+
getXY : function(el) {
var p,
pe,
@@ -11854,7 +12303,7 @@ Ext.EventObject = new Ext.EventObjectImpl();
scroll,
hasAbsolute,
bd = (doc.body || doc.documentElement),
- ret = [0,0];
+ ret;
el = Ext.getDom(el);
@@ -11862,13 +12311,17 @@ Ext.EventObject = new Ext.EventObjectImpl();
hasAbsolute = fly(el).isStyle("position", "absolute");
if (el.getBoundingClientRect) {
- b = el.getBoundingClientRect();
- scroll = fly(document).getScroll();
- ret = [Math.round(b.left + scroll.left), Math.round(b.top + scroll.top)];
- } else {
- p = el;
+ try {
+ b = el.getBoundingClientRect();
+ scroll = fly(document).getScroll();
+ ret = [ Math.round(b.left + scroll.left), Math.round(b.top + scroll.top) ];
+ } catch (e) {
+
+ }
+ }
- while (p) {
+ if (!ret) {
+ for (p = el; p; p = ELEMENT.getOffsetParent(p)) {
pe = fly(p);
x += p.offsetLeft;
y += p.offsetTop;
@@ -11884,7 +12337,6 @@ Ext.EventObject = new Ext.EventObjectImpl();
y += bt;
}
}
- p = p.offsetParent;
}
if (Ext.isSafari && hasAbsolute) {
@@ -11909,7 +12361,7 @@ Ext.EventObject = new Ext.EventObjectImpl();
ret = [x,y];
}
}
- return ret;
+ return ret || [0,0];
},
setXY : function(el, xy) {
@@ -11971,207 +12423,232 @@ Ext.EventObject = new Ext.EventObjectImpl();
-Ext.core.Element.addMethods({
+Ext.Element.addMethods((function(){
+ var focusRe = /button|input|textarea|select|object/;
+ return {
+
+ monitorMouseLeave: function(delay, handler, scope) {
+ var me = this,
+ timer,
+ listeners = {
+ mouseleave: function(e) {
+ timer = setTimeout(Ext.Function.bind(handler, scope||me, [e]), delay);
+ },
+ mouseenter: function() {
+ clearTimeout(timer);
+ },
+ freezeEvent: true
+ };
-
- monitorMouseLeave: function(delay, handler, scope) {
- var me = this,
- timer,
- listeners = {
- mouseleave: function(e) {
- timer = setTimeout(Ext.Function.bind(handler, scope||me, [e]), delay);
- },
- mouseenter: function() {
- clearTimeout(timer);
- },
- freezeEvent: true
- };
+ me.on(listeners);
+ return listeners;
+ },
- me.on(listeners);
- return listeners;
- },
+
+ swallowEvent : function(eventName, preventDefault) {
+ var me = this;
+ function fn(e) {
+ e.stopPropagation();
+ if (preventDefault) {
+ e.preventDefault();
+ }
+ }
-
- swallowEvent : function(eventName, preventDefault) {
- var me = this;
- function fn(e) {
- e.stopPropagation();
- if (preventDefault) {
- e.preventDefault();
+ if (Ext.isArray(eventName)) {
+ Ext.each(eventName, function(e) {
+ me.on(e, fn);
+ });
+ return me;
}
- }
-
- if (Ext.isArray(eventName)) {
- Ext.each(eventName, function(e) {
- me.on(e, fn);
- });
+ me.on(eventName, fn);
return me;
- }
- me.on(eventName, fn);
- return me;
- },
+ },
-
- relayEvent : function(eventName, observable) {
- this.on(eventName, function(e) {
- observable.fireEvent(eventName, e);
- });
- },
+
+ relayEvent : function(eventName, observable) {
+ this.on(eventName, function(e) {
+ observable.fireEvent(eventName, e);
+ });
+ },
+
+ clean : function(forceReclean) {
+ var me = this,
+ dom = me.dom,
+ n = dom.firstChild,
+ nx,
+ ni = -1;
- clean : function(forceReclean) {
- var me = this,
- dom = me.dom,
- n = dom.firstChild,
- nx,
- ni = -1;
-
- if (Ext.core.Element.data(dom, 'isCleaned') && forceReclean !== true) {
- return me;
- }
+ if (Ext.Element.data(dom, 'isCleaned') && forceReclean !== true) {
+ return me;
+ }
- while (n) {
- nx = n.nextSibling;
- if (n.nodeType == 3) {
-
- if (!(/\S/.test(n.nodeValue))) {
- dom.removeChild(n);
-
- } else if (nx && nx.nodeType == 3) {
- n.appendData(Ext.String.trim(nx.data));
- dom.removeChild(nx);
- nx = n.nextSibling;
+ while (n) {
+ nx = n.nextSibling;
+ if (n.nodeType == 3) {
+
+ if (!(/\S/.test(n.nodeValue))) {
+ dom.removeChild(n);
+
+ } else if (nx && nx.nodeType == 3) {
+ n.appendData(Ext.String.trim(nx.data));
+ dom.removeChild(nx);
+ nx = n.nextSibling;
+ n.nodeIndex = ++ni;
+ }
+ } else {
+
+ Ext.fly(n).clean();
n.nodeIndex = ++ni;
}
- } else {
-
- Ext.fly(n).clean();
- n.nodeIndex = ++ni;
+ n = nx;
}
- n = nx;
- }
- Ext.core.Element.data(dom, 'isCleaned', true);
- return me;
- },
+ Ext.Element.data(dom, 'isCleaned', true);
+ return me;
+ },
-
- load : function(options) {
- this.getLoader().load(options);
- return this;
- },
+
+ load : function(options) {
+ this.getLoader().load(options);
+ return this;
+ },
+
+ getLoader : function() {
+ var dom = this.dom,
+ data = Ext.Element.data,
+ loader = data(dom, 'loader');
- getLoader : function() {
- var dom = this.dom,
- data = Ext.core.Element.data,
- loader = data(dom, 'loader');
-
- if (!loader) {
- loader = Ext.create('Ext.ElementLoader', {
- target: this
- });
- data(dom, 'loader', loader);
- }
- return loader;
- },
+ if (!loader) {
+ loader = Ext.create('Ext.ElementLoader', {
+ target: this
+ });
+ data(dom, 'loader', loader);
+ }
+ return loader;
+ },
-
- update : function(html, loadScripts, callback) {
- var me = this,
- id,
- dom,
- interval;
-
- if (!me.dom) {
- return me;
- }
- html = html || '';
- dom = me.dom;
+
+ update : function(html, loadScripts, callback) {
+ var me = this,
+ id,
+ dom,
+ interval;
- if (loadScripts !== true) {
- dom.innerHTML = html;
- Ext.callback(callback, me);
- return me;
- }
+ if (!me.dom) {
+ return me;
+ }
+ html = html || '';
+ dom = me.dom;
- id = Ext.id();
- html += '<span id="' + id + '"></span>';
-
- interval = setInterval(function(){
- if (!document.getElementById(id)) {
- return false;
- }
- clearInterval(interval);
- var DOC = document,
- hd = DOC.getElementsByTagName("head")[0],
- re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,
- srcRe = /\ssrc=([\'\"])(.*?)\1/i,
- typeRe = /\stype=([\'\"])(.*?)\1/i,
- match,
- attrs,
- srcMatch,
- typeMatch,
- el,
- s;
+ if (loadScripts !== true) {
+ dom.innerHTML = html;
+ Ext.callback(callback, me);
+ return me;
+ }
- while ((match = re.exec(html))) {
- attrs = match[1];
- srcMatch = attrs ? attrs.match(srcRe) : false;
- if (srcMatch && srcMatch[2]) {
- s = DOC.createElement("script");
- s.src = srcMatch[2];
- typeMatch = attrs.match(typeRe);
- if (typeMatch && typeMatch[2]) {
- s.type = typeMatch[2];
- }
- hd.appendChild(s);
- } else if (match[2] && match[2].length > 0) {
- if (window.execScript) {
- window.execScript(match[2]);
- } else {
- window.eval(match[2]);
+ id = Ext.id();
+ html += '<span id="' + id + '"></span>';
+
+ interval = setInterval(function(){
+ if (!document.getElementById(id)) {
+ return false;
+ }
+ clearInterval(interval);
+ var DOC = document,
+ hd = DOC.getElementsByTagName("head")[0],
+ re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,
+ srcRe = /\ssrc=([\'\"])(.*?)\1/i,
+ typeRe = /\stype=([\'\"])(.*?)\1/i,
+ match,
+ attrs,
+ srcMatch,
+ typeMatch,
+ el,
+ s;
+
+ while ((match = re.exec(html))) {
+ attrs = match[1];
+ srcMatch = attrs ? attrs.match(srcRe) : false;
+ if (srcMatch && srcMatch[2]) {
+ s = DOC.createElement("script");
+ s.src = srcMatch[2];
+ typeMatch = attrs.match(typeRe);
+ if (typeMatch && typeMatch[2]) {
+ s.type = typeMatch[2];
+ }
+ hd.appendChild(s);
+ } else if (match[2] && match[2].length > 0) {
+ if (window.execScript) {
+ window.execScript(match[2]);
+ } else {
+ window.eval(match[2]);
+ }
}
}
- }
-
- el = DOC.getElementById(id);
- if (el) {
- Ext.removeNode(el);
- }
- Ext.callback(callback, me);
- }, 20);
- dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, '');
- return me;
- },
-
- removeAllListeners : function() {
- this.removeAnchor();
- Ext.EventManager.removeAll(this.dom);
- return this;
- },
+ el = DOC.getElementById(id);
+ if (el) {
+ Ext.removeNode(el);
+ }
+ Ext.callback(callback, me);
+ }, 20);
+ dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, '');
+ return me;
+ },
+
+ removeAllListeners : function() {
+ this.removeAnchor();
+ Ext.EventManager.removeAll(this.dom);
+ return this;
+ },
- createProxy : function(config, renderTo, matchBox) {
- config = (typeof config == 'object') ? config : {tag : "div", cls: config};
+
+ getScopeParent: function(){
+ var parent = this.dom.parentNode;
+ return Ext.scopeResetCSS ? parent.parentNode : parent;
+ },
- var me = this,
- proxy = renderTo ? Ext.core.DomHelper.append(renderTo, config, true) :
- Ext.core.DomHelper.insertBefore(me.dom, config, true);
+
+ createProxy : function(config, renderTo, matchBox) {
+ config = (typeof config == 'object') ? config : {tag : "div", cls: config};
- proxy.setVisibilityMode(Ext.core.Element.DISPLAY);
- proxy.hide();
- if (matchBox && me.setBox && me.getBox) {
- proxy.setBox(me.getBox());
- }
- return proxy;
- }
-});
-Ext.core.Element.prototype.clearListeners = Ext.core.Element.prototype.removeAllListeners;
+ var me = this,
+ proxy = renderTo ? Ext.DomHelper.append(renderTo, config, true) :
+ Ext.DomHelper.insertBefore(me.dom, config, true);
+
+ proxy.setVisibilityMode(Ext.Element.DISPLAY);
+ proxy.hide();
+ if (matchBox && me.setBox && me.getBox) {
+ proxy.setBox(me.getBox());
+ }
+ return proxy;
+ },
+
+
+ focusable: function(){
+ var dom = this.dom,
+ nodeName = dom.nodeName.toLowerCase(),
+ canFocus = false,
+ hasTabIndex = !isNaN(dom.tabIndex);
+
+ if (!dom.disabled) {
+ if (focusRe.test(nodeName)) {
+ canFocus = true;
+ } else {
+ canFocus = nodeName == 'a' ? dom.href || hasTabIndex : hasTabIndex;
+ }
+ }
+ return canFocus && this.isVisible(true);
+ }
+ };
+})());
+Ext.Element.prototype.clearListeners = Ext.Element.prototype.removeAllListeners;
-Ext.core.Element.addMethods({
+Ext.Element.addMethods({
getAnchorXY : function(anchor, local, s){
@@ -12181,8 +12658,8 @@ Ext.core.Element.addMethods({
var me = this,
vp = me.dom == document.body || me.dom == document,
- w = s.width || vp ? Ext.core.Element.getViewWidth() : me.getWidth(),
- h = s.height || vp ? Ext.core.Element.getViewHeight() : me.getHeight(),
+ w = s.width || vp ? Ext.Element.getViewWidth() : me.getWidth(),
+ h = s.height || vp ? Ext.Element.getViewHeight() : me.getHeight(),
xy,
r = Math.round,
o = me.getXY(),
@@ -12250,7 +12727,7 @@ Ext.core.Element.addMethods({
getAnchor : function(){
- var data = Ext.core.Element.data,
+ var data = Ext.Element.data,
dom = this.dom;
if (!dom) {
return;
@@ -12296,8 +12773,8 @@ Ext.core.Element.addMethods({
w,
h,
r,
- dw = Ext.core.Element.getViewWidth() -10,
- dh = Ext.core.Element.getViewHeight()-10,
+ dw = Ext.Element.getViewWidth() -10,
+ dh = Ext.Element.getViewHeight()-10,
p1y,
p1x,
p2y,
@@ -12434,7 +12911,7 @@ Ext.core.Element.addMethods({
(function(){
-var ELEMENT = Ext.core.Element,
+var ELEMENT = Ext.Element,
LEFT = "left",
RIGHT = "right",
TOP = "top",
@@ -12445,7 +12922,7 @@ var ELEMENT = Ext.core.Element,
AUTO = "auto",
ZINDEX = "z-index";
-Ext.override(Ext.core.Element, {
+Ext.override(Ext.Element, {
getX : function(){
return ELEMENT.getX(this.dom);
@@ -12742,14 +13219,14 @@ Ext.override(Ext.core.Element, {
var me = this,
isBody = me.dom === document.body,
scroll, pos, top, left, width, height;
-
+
if (isBody) {
scroll = me.getScroll();
left = scroll.left;
top = scroll.top;
- width = Ext.core.Element.getViewportWidth();
- height = Ext.core.Element.getViewportHeight();
+ width = Ext.Element.getViewportWidth();
+ height = Ext.Element.getViewportHeight();
}
else {
pos = me.getXY();
@@ -12767,8 +13244,8 @@ Ext.override(Ext.core.Element, {
var me = this,
el = me.dom,
isDoc = el === document.body,
- w = isDoc ? Ext.core.Element.getViewWidth() : el.offsetWidth,
- h = isDoc ? Ext.core.Element.getViewHeight() : el.offsetHeight,
+ w = isDoc ? Ext.Element.getViewWidth() : el.offsetWidth,
+ h = isDoc ? Ext.Element.getViewHeight() : el.offsetHeight,
xy = me.getXY(),
t = xy[1],
r = xy[0] + w,
@@ -12820,7 +13297,7 @@ Ext.override(Ext.core.Element, {
})();
-Ext.override(Ext.core.Element, {
+Ext.override(Ext.Element, {
isScrollable : function(){
var dom = this.dom;
@@ -12954,7 +13431,7 @@ Ext.override(Ext.core.Element, {
}
});
-Ext.core.Element.addMethods(
+Ext.Element.addMethods(
function() {
var VISIBILITY = "visibility",
DISPLAY = "display",
@@ -12962,7 +13439,7 @@ Ext.core.Element.addMethods(
NONE = "none",
XMASKED = Ext.baseCSSPrefix + "masked",
XMASKEDRELATIVE = Ext.baseCSSPrefix + "masked-relative",
- data = Ext.core.Element.data;
+ data = Ext.Element.data;
return {
@@ -12990,7 +13467,7 @@ Ext.core.Element.addMethods(
enableDisplayMode : function(display) {
- this.setVisibilityMode(Ext.core.Element.DISPLAY);
+ this.setVisibilityMode(Ext.Element.DISPLAY);
if (!Ext.isEmpty(display)) {
data(this.dom, 'originalDisplay', display);
@@ -13004,7 +13481,7 @@ Ext.core.Element.addMethods(
var me = this,
dom = me.dom,
setExpression = dom.style.setExpression,
- dh = Ext.core.DomHelper,
+ dh = Ext.DomHelper,
EXTELMASKMSG = Ext.baseCSSPrefix + "mask-msg",
el,
mask;
@@ -13110,7 +13587,7 @@ Ext.core.Element.addMethods(
}()
);
-Ext.core.Element.addMethods({
+Ext.Element.addMethods({
addKeyListener : function(key, fn, scope){
var config;
@@ -13150,7 +13627,7 @@ Ext.apply(Ext.CompositeElementLite.prototype, {
return this;
}
if(typeof els == "string"){
- els = Ext.core.Element.selectorFunction(els, root);
+ els = Ext.Element.selectorFunction(els, root);
}
var yels = this.elements;
Ext.each(els, function(e) {
@@ -13197,35 +13674,29 @@ Ext.apply(Ext.CompositeElementLite.prototype, {
Ext.CompositeElement = Ext.extend(Ext.CompositeElementLite, {
-
+
constructor : function(els, root){
this.elements = [];
this.add(els, root);
},
-
+
getElement : function(el){
return el;
},
-
+
transformElement : function(el){
return Ext.get(el);
}
-
-
-
-
-
-
});
-Ext.core.Element.select = function(selector, unique, root){
+Ext.Element.select = function(selector, unique, root){
var els;
if(typeof selector == "string"){
- els = Ext.core.Element.selectorFunction(selector, root);
+ els = Ext.Element.selectorFunction(selector, root);
}else if(selector.length !== undefined){
els = selector;
}else{
@@ -13234,7 +13705,7 @@ Ext.core.Element.select = function(selector, unique, root){
};
-Ext.select = Ext.core.Element.select;
+Ext.select = Ext.Element.select;
@@ -13293,7 +13764,7 @@ Ext.define('Ext.util.Observable', {
},
- eventOptionsRe : /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate|element|vertical|horizontal)$/,
+ eventOptionsRe : /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate|element|vertical|horizontal|freezeEvent)$/,
addManagedListener : function(item, ename, fn, scope, options) {
@@ -13354,41 +13825,51 @@ Ext.define('Ext.util.Observable', {
},
- fireEvent: function() {
- var me = this,
- args = Ext.Array.toArray(arguments),
- ename = args[0].toLowerCase(),
- ret = true,
- event = me.events[ename],
- queue = me.eventQueue,
- parent;
+ fireEvent: function(eventName) {
+ var name = eventName.toLowerCase(),
+ events = this.events,
+ event = events && events[name],
+ bubbles = event && event.bubble;
- if (me.eventsSuspended === true) {
- if (queue) {
- queue.push(args);
- }
- } else if (event && event !== true) {
- if (event.bubble) {
- if (event.fire.apply(event, args.slice(1)) === false) {
- return false;
+ return this.continueFireEvent(name, Ext.Array.slice(arguments, 1), bubbles);
+ },
+
+
+ continueFireEvent: function(eventName, args, bubbles) {
+ var target = this,
+ queue, event,
+ ret = true;
+
+ do {
+ if (target.eventsSuspended === true) {
+ if ((queue = target.eventQueue)) {
+ queue.push([eventName, args, bubbles]);
}
- 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 ret;
+ } else {
+ event = target.events[eventName];
+
+
+ if (event && event != true) {
+ if ((ret = event.fire.apply(event, args)) === false) {
+ break;
}
- return parent.fireEvent.apply(parent, args);
- }
- }
- else {
- args.shift();
- ret = event.fire.apply(event, args);
+ }
}
- }
+ } while (bubbles && (target = target.getBubbleParent()));
return ret;
},
+ getBubbleParent: function(){
+ var me = this, parent = me.getBubbleTarget && me.getBubbleTarget();
+ if (parent && parent.isObservable) {
+ return parent;
+ }
+ return null;
+ },
+
+
addListener: function(ename, fn, scope, options) {
var me = this,
config,
@@ -13473,14 +13954,14 @@ Ext.define('Ext.util.Observable', {
this.managedListeners = [];
},
-
+
removeManagedListenerItem: function(isClear, managedListener, item, ename, fn, scope){
if (isClear || (managedListener.item === item && managedListener.ename === ename && (!fn || managedListener.fn === fn) && (!scope || managedListener.scope === scope))) {
managedListener.item.un(managedListener.ename, managedListener.fn, managedListener.scope);
if (!isClear) {
Ext.Array.remove(this.managedListeners, managedListener);
- }
+ }
}
},
@@ -13491,12 +13972,12 @@ Ext.define('Ext.util.Observable', {
args,
len,
i;
-
+
me.events = me.events || {};
if (Ext.isString(o)) {
args = arguments;
i = args.length;
-
+
while (i--) {
me.events[args[i]] = me.events[args[i]] || true;
}
@@ -13522,15 +14003,16 @@ Ext.define('Ext.util.Observable', {
resumeEvents: function() {
var me = this,
- queued = me.eventQueue || [];
+ queued = me.eventQueue;
me.eventsSuspended = false;
delete me.eventQueue;
- Ext.each(queued,
- function(e) {
- me.fireEvent.apply(me, e);
- });
+ if (queued) {
+ Ext.each(queued, function(e) {
+ me.continueFireEvent.apply(me, e);
+ });
+ }
},
@@ -13776,7 +14258,7 @@ Ext.define('Ext.util.Animate', {
}
}, function(){
- Ext.applyIf(Ext.core.Element.prototype, this.prototype);
+ Ext.applyIf(Ext.Element.prototype, this.prototype);
Ext.CompositeElementLite.importElementMethods();
});
@@ -13913,506 +14395,6 @@ Ext.define('Ext.state.Provider', {
}
});
-Ext.define('Ext.util.HashMap', {
-
-
-
- mixins: {
- observable: 'Ext.util.Observable'
- },
-
-
- constructor: function(config) {
- config = config || {};
-
- var me = this,
- keyFn = config.keyFn;
-
- me.addEvents(
-
- 'add',
-
- 'clear',
-
- 'remove',
-
- 'replace'
- );
-
- me.mixins.observable.constructor.call(me, config);
- me.clear(true);
-
- if (keyFn) {
- me.getKey = keyFn;
- }
- },
-
-
- getCount: function() {
- return this.length;
- },
-
-
- getData: function(key, value) {
-
- if (value === undefined) {
- value = key;
- key = this.getKey(value);
- }
-
- return [key, value];
- },
-
-
- getKey: function(o) {
- return o.id;
- },
-
-
- add: function(key, value) {
- var me = this,
- data;
-
- if (arguments.length === 1) {
- value = key;
- key = me.getKey(value);
- }
-
- if (me.containsKey(key)) {
- me.replace(key, value);
- }
-
- data = me.getData(key, value);
- key = data[0];
- value = data[1];
- me.map[key] = value;
- ++me.length;
- me.fireEvent('add', me, key, value);
- return value;
- },
-
-
- replace: function(key, value) {
- var me = this,
- map = me.map,
- old;
-
- if (!me.containsKey(key)) {
- me.add(key, value);
- }
- old = map[key];
- map[key] = value;
- me.fireEvent('replace', me, key, value, old);
- return value;
- },
-
-
- remove: function(o) {
- var key = this.findKey(o);
- if (key !== undefined) {
- return this.removeAtKey(key);
- }
- return false;
- },
-
-
- removeAtKey: function(key) {
- var me = this,
- value;
-
- if (me.containsKey(key)) {
- value = me.map[key];
- delete me.map[key];
- --me.length;
- me.fireEvent('remove', me, key, value);
- return true;
- }
- return false;
- },
-
-
- get: function(key) {
- return this.map[key];
- },
-
-
- clear: function( initial) {
- var me = this;
- me.map = {};
- me.length = 0;
- if (initial !== true) {
- me.fireEvent('clear', me);
- }
- return me;
- },
-
-
- containsKey: function(key) {
- return this.map[key] !== undefined;
- },
-
-
- contains: function(value) {
- return this.containsKey(this.findKey(value));
- },
-
-
- getKeys: function() {
- return this.getArray(true);
- },
-
-
- getValues: function() {
- return this.getArray(false);
- },
-
-
- getArray: function(isKey) {
- var arr = [],
- key,
- map = this.map;
- for (key in map) {
- if (map.hasOwnProperty(key)) {
- arr.push(isKey ? key: map[key]);
- }
- }
- return arr;
- },
-
-
- each: function(fn, scope) {
-
- var items = Ext.apply({}, this.map),
- key,
- length = this.length;
-
- scope = scope || this;
- for (key in items) {
- if (items.hasOwnProperty(key)) {
- if (fn.call(scope, key, items[key], length) === false) {
- break;
- }
- }
- }
- return this;
- },
-
-
- clone: function() {
- var hash = new this.self(),
- map = this.map,
- key;
-
- hash.suspendEvents();
- for (key in map) {
- if (map.hasOwnProperty(key)) {
- hash.add(key, map[key]);
- }
- }
- hash.resumeEvents();
- return hash;
- },
-
-
- findKey: function(value) {
- var key,
- map = this.map;
-
- for (key in map) {
- if (map.hasOwnProperty(key) && map[key] === value) {
- return key;
- }
- }
- return undefined;
- }
-});
-
-
-
-Ext.define('Ext.Template', {
-
-
-
- requires: ['Ext.core.DomHelper', 'Ext.util.Format'],
-
- statics: {
-
- from: function(el, config) {
- el = Ext.getDom(el);
- return new this(el.value || el.innerHTML, config || '');
- }
- },
-
-
-
- constructor: function(html) {
- var me = this,
- args = arguments,
- buffer = [],
- i = 0,
- length = args.length,
- value;
-
- me.initialConfig = {};
-
- if (length > 1) {
- for (; i < length; i++) {
- value = args[i];
- if (typeof value == 'object') {
- Ext.apply(me.initialConfig, value);
- Ext.apply(me, value);
- } else {
- buffer.push(value);
- }
- }
- html = buffer.join('');
- } else {
- if (Ext.isArray(html)) {
- buffer.push(html.join(''));
- } else {
- buffer.push(html);
- }
- }
-
-
- me.html = buffer.join('');
-
- if (me.compiled) {
- me.compile();
- }
- },
- isTemplate: true,
-
- disableFormats: false,
-
- re: /\{([\w\-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
-
- applyTemplate: function(values) {
- var me = this,
- useFormat = me.disableFormats !== true,
- fm = Ext.util.Format,
- tpl = me;
-
- if (me.compiled) {
- return me.compiled(values);
- }
- function fn(m, name, format, args) {
- if (format && useFormat) {
- if (args) {
- args = [values[name]].concat(Ext.functionFactory('return ['+ args +'];')());
- } else {
- args = [values[name]];
- }
- if (format.substr(0, 5) == "this.") {
- return tpl[format.substr(5)].apply(tpl, args);
- }
- else {
- return fm[format].apply(fm, args);
- }
- }
- else {
- return values[name] !== undefined ? values[name] : "";
- }
- }
- return me.html.replace(me.re, fn);
- },
-
-
- set: function(html, compile) {
- var me = this;
- me.html = html;
- me.compiled = null;
- return compile ? me.compile() : me;
- },
-
- compileARe: /\\/g,
- compileBRe: /(\r\n|\n)/g,
- compileCRe: /'/g,
- /**
- * Compiles the template into an internal function, eliminating the RegEx overhead.
- * @return {Ext.Template} this
- */
- compile: function() {
- var me = this,
- fm = Ext.util.Format,
- useFormat = me.disableFormats !== true,
- body, bodyReturn;
-
- function fn(m, name, format, args) {
- if (format && useFormat) {
- args = args ? ',' + args: "";
- if (format.substr(0, 5) != "this.") {
- format = "fm." + format + '(';
- }
- else {
- format = 'this.' + format.substr(5) + '(';
- }
- }
- else {
- args = '';
- format = "(values['" + name + "'] == undefined ? '' : ";
- }
- return "'," + format + "values['" + name + "']" + args + ") ,'";
- }
-
- bodyReturn = me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn);
- body = "this.compiled = function(values){ return ['" + bodyReturn + "'].join('');};";
- eval(body);
- return me;
- },
-
- /**
- * Applies the supplied values to the template and inserts the new node(s) as the first child of el.
- * @param {Mixed} el The context element
- * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
- * @param {Boolean} returnElement (optional) true to return a Ext.core.Element (defaults to undefined)
- * @return {HTMLElement/Ext.core.Element} The new node or Element
- */
- insertFirst: function(el, values, returnElement) {
- return this.doInsert('afterBegin', el, values, returnElement);
- },
-
- /**
- * Applies the supplied values to the template and inserts the new node(s) before el.
- * @param {Mixed} el The context element
- * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
- * @param {Boolean} returnElement (optional) true to return a Ext.core.Element (defaults to undefined)
- * @return {HTMLElement/Ext.core.Element} The new node or Element
- */
- insertBefore: function(el, values, returnElement) {
- return this.doInsert('beforeBegin', el, values, returnElement);
- },
-
- /**
- * Applies the supplied values to the template and inserts the new node(s) after el.
- * @param {Mixed} el The context element
- * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
- * @param {Boolean} returnElement (optional) true to return a Ext.core.Element (defaults to undefined)
- * @return {HTMLElement/Ext.core.Element} The new node or Element
- */
- insertAfter: function(el, values, returnElement) {
- return this.doInsert('afterEnd', el, values, returnElement);
- },
-
- /**
- * Applies the supplied <code>values</code> to the template and appends
- * the new node(s) to the specified <code>el</code>.
- * <p>For example usage {@link #Template see the constructor}.</p>
- * @param {Mixed} el The context element
- * @param {Object/Array} values
- * The template values. Can be an array if the params are numeric (i.e. <code>{0}</code>)
- * or an object (i.e. <code>{foo: 'bar'}</code>).
- * @param {Boolean} returnElement (optional) true to return an Ext.core.Element (defaults to undefined)
- * @return {HTMLElement/Ext.core.Element} The new node or Element
- */
- append: function(el, values, returnElement) {
- return this.doInsert('beforeEnd', el, values, returnElement);
- },
-
- doInsert: function(where, el, values, returnEl) {
- el = Ext.getDom(el);
- var newNode = Ext.core.DomHelper.insertHtml(where, el, this.applyTemplate(values));
- return returnEl ? Ext.get(newNode, true) : newNode;
- },
-
- /**
- * Applies the supplied values to the template and overwrites the content of el with the new node(s).
- * @param {Mixed} el The context element
- * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
- * @param {Boolean} returnElement (optional) true to return a Ext.core.Element (defaults to undefined)
- * @return {HTMLElement/Ext.core.Element} The new node or Element
- */
- overwrite: function(el, values, returnElement) {
- el = Ext.getDom(el);
- el.innerHTML = this.applyTemplate(values);
- return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
- }
-}, function() {
-
- /**
- * Alias for {@link #applyTemplate}
- * Returns an HTML fragment of this template with the specified <code>values</code> applied.
- * @param {Object/Array} values
- * The template values. Can be an array if the params are numeric (i.e. <code>{0}</code>)
- * or an object (i.e. <code>{foo: 'bar'}</code>).
- * @return {String} The HTML fragment
- * @member Ext.Template
- * @method apply
- */
- this.createAlias('apply', 'applyTemplate');
-});
-
-/**
- * @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
- *
- * - `component` or `.component`
- * - `gridpanel` or `.gridpanel`
- *
- * An itemId or id must be prefixed with a #
- *
- * - `#myContainer`
- *
- * Attributes must be wrapped in brackets
- *
- * - `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:
- *
- * - not
- *
- * Queries return an array of components.
- * Here are some example queries.
- *
- * // 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,
uses: ['Ext.ComponentManager']
@@ -14420,8 +14402,8 @@ Ext.define('Ext.ComponentQuery', {
var cq = this,
- // A function source code pattern with a placeholder which accepts an expression which yields a truth value when applied
- // as a member on each item in the passed array.
+
+
filterFnPattern = [
'var r = [],',
'i = 0,',
@@ -14438,9 +14420,9 @@ Ext.define('Ext.ComponentQuery', {
].join(''),
filterItems = function(items, operation) {
- // Argument list for the operation is [ itemsArray, operationArg1, operationArg2...]
- // The operation's method loops over each item in the candidate array and
- // returns an array of items which match its criteria
+
+
+
return operation.method.apply(this, [ items ].concat(operation.args));
},
@@ -14474,7 +14456,7 @@ Ext.define('Ext.ComponentQuery', {
return result;
},
- // Filters the passed candidate array and returns only items which match the passed xtype
+
filterByXType = function(items, xtype, shallow) {
if (xtype === '*') {
return items.slice();
@@ -14494,7 +14476,7 @@ Ext.define('Ext.ComponentQuery', {
}
},
- // Filters the passed candidate array and returns only items which have the passed className
+
filterByClassName = function(items, className) {
var EA = Ext.Array,
result = [],
@@ -14510,7 +14492,7 @@ Ext.define('Ext.ComponentQuery', {
return result;
},
- // Filters the passed candidate array and returns only items which have the specified property match
+
filterByAttribute = function(items, property, operator, value) {
var result = [],
i = 0,
@@ -14525,7 +14507,7 @@ Ext.define('Ext.ComponentQuery', {
return result;
},
- // Filters the passed candidate array and returns only items which have the specified itemId or id
+
filterById = function(items, id) {
var result = [],
i = 0,
@@ -14540,62 +14522,56 @@ Ext.define('Ext.ComponentQuery', {
return result;
},
- // Filters the passed candidate array and returns only items which the named pseudo class matcher filters in
+
filterByPseudo = function(items, name, value) {
return cq.pseudos[name](items, value);
},
- // Determines leading mode
- // > for direct child, and ^ to switch to ownerCt axis
+
+
modeRe = /^(\s?([>\^])\s?|\s|$)/,
- // Matches a token with possibly (true|false) appended for the "shallow" parameter
+
tokenRe = /^(#)?([\w\-]+|\*)(?:\((true|false)\))?/,
matchers = [{
- // Checks for .xtype with possibly (true|false) appended for the "shallow" parameter
+
re: /^\.([\w\-]+)(?:\((true|false)\))?/,
method: filterByXType
},{
- // checks for [attribute=value]
+
re: /^(?:[\[](?:@)?([\w\-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]])/,
method: filterByAttribute
}, {
- // checks for #cmpItemId
+
re: /^#([\w\-]+)/,
method: filterById
}, {
- // checks for :<pseudo_class>(<selector>)
+
re: /^\:([\w\-]+)(?:\(((?:\{[^\}]+\})|(?:(?!\{)[^\s>\/]*?(?!\})))\))?/,
method: filterByPseudo
}, {
- // checks for {<member_expression>}
+
re: /^(?:\{([^\}]+)\})/,
method: filterFnPattern
}];
- /**
- * @class Ext.ComponentQuery.Query
- * @extends Object
- * @private
- */
+
+
cq.Query = Ext.extend(Object, {
constructor: function(cfg) {
cfg = cfg || {};
Ext.apply(this, cfg);
},
- /**
- * @private
- * Executes this Query upon the selected root.
- * The root provides the initial source of candidate Component matches which are progressively
- * filtered by iterating through this Query's operations cache.
- * If no root is provided, all registered Components are searched via the ComponentManager.
- * root may be a Container who's descendant Components are filtered
- * root may be a Component with an implementation of getRefItems which provides some nested Components such as the
- * docked items within a Panel.
- * root may be an array of candidate Components to filter using this Query.
- */
+
+
+
+
+
+
+
+
execute : function(root) {
var operations = this.operations,
i = 0,
@@ -14603,26 +14579,26 @@ Ext.define('Ext.ComponentQuery', {
operation,
workingItems;
- // no root, use all Components in the document
+
if (!root) {
workingItems = Ext.ComponentManager.all.getArray();
}
- // Root is a candidate Array
+
else if (Ext.isArray(root)) {
workingItems = root;
}
- // We are going to loop over our operations and take care of them
- // one by one.
+
+
for (; i < length; i++) {
operation = operations[i];
- // The mode operation requires some custom handling.
- // All other operations essentially filter down our current
- // working items, while mode replaces our current working
- // items by getting children from each one of our current
- // working items. The type of mode determines the type of
- // children we get. (e.g. > only gets direct children)
+
+
+
+
+
+
if (operation.mode === '^') {
workingItems = getAncestors(workingItems || [root]);
}
@@ -14633,8 +14609,8 @@ Ext.define('Ext.ComponentQuery', {
workingItems = filterItems(workingItems || getItems([root]), operation);
}
- // If this is the last operation, it means our current working
- // items are the final matched items. Thus return them!
+
+
if (i === length -1) {
return workingItems;
}
@@ -14666,10 +14642,10 @@ Ext.define('Ext.ComponentQuery', {
Ext.apply(this, {
- // private cache of selectors and matching ComponentQuery.Query objects
+
cache: {},
- // private cache of pseudo class filter functions
+
pseudos: {
not: function(components, selector){
var CQ = Ext.ComponentQuery,
@@ -14686,26 +14662,13 @@ Ext.define('Ext.ComponentQuery', {
}
}
return results;
+ },
+ last: function(components) {
+ return components[components.length - 1];
}
},
- /**
- * 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) {
var selectors = selector.split(','),
length = selectors.length,
@@ -14724,8 +14687,8 @@ Ext.define('Ext.ComponentQuery', {
results = results.concat(query.execute(root));
}
- // multiple selectors, potential to find duplicates
- // lets filter them out.
+
+
if (length > 1) {
resultsLn = results.length;
for (i = 0; i < resultsLn; i++) {
@@ -14740,13 +14703,7 @@ Ext.define('Ext.ComponentQuery', {
return results;
},
- /**
- * Tests whether the passed Component matches the selector string.
- * @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
- */
+
is: function(component, selector) {
if (!selector) {
return true;
@@ -14768,35 +14725,35 @@ Ext.define('Ext.ComponentQuery', {
selectorMatch,
i, matcher, method;
- // We are going to parse the beginning of the selector over and
- // over again, slicing off the selector any portions we converted into an
- // operation, until it is an empty string.
+
+
+
while (selector && lastSelector !== selector) {
lastSelector = selector;
- // First we check if we are dealing with a token like #, * or an xtype
+
tokenMatch = selector.match(tokenRe);
if (tokenMatch) {
matchedChar = tokenMatch[1];
- // If the token is prefixed with a # we push a filterById operation to our stack
+
if (matchedChar === '#') {
operations.push({
method: filterById,
args: [Ext.String.trim(tokenMatch[2])]
});
}
- // If the token is prefixed with a . we push a filterByClassName operation to our stack
- // FIXME: Not enabled yet. just needs \. adding to the tokenRe prefix
+
+
else if (matchedChar === '.') {
operations.push({
method: filterByClassName,
args: [Ext.String.trim(tokenMatch[2])]
});
}
- // If the token is a * or an xtype string, we push a filterByXType
- // operation to the stack.
+
+
else {
operations.push({
method: filterByXType,
@@ -14804,45 +14761,45 @@ Ext.define('Ext.ComponentQuery', {
});
}
- // Now we slice of the part we just converted into an operation
+
selector = selector.replace(tokenMatch[0], '');
}
- // If the next part of the query is not a space or > or ^, it means we
- // are going to check for more things that our current selection
- // has to comply to.
+
+
+
while (!(modeMatch = selector.match(modeRe))) {
- // Lets loop over each type of matcher and execute it
- // on our current selector.
+
+
for (i = 0; selector && i < length; i++) {
matcher = matchers[i];
selectorMatch = selector.match(matcher.re);
method = matcher.method;
- // If we have a match, add an operation with the method
- // associated with this matcher, and pass the regular
- // expression matches are arguments to the operation.
+
+
+
if (selectorMatch) {
operations.push({
method: Ext.isString(matcher.method)
- // Turn a string method into a function by formatting the string with our selector matche expression
- // A new method is created for different match expressions, eg {id=='textfield-1024'}
- // Every expression may be different in different selectors.
+
+
+
? Ext.functionFactory('items', Ext.String.format.apply(Ext.String, [method].concat(selectorMatch.slice(1))))
: matcher.method,
args: selectorMatch.slice(1)
});
selector = selector.replace(selectorMatch[0], '');
- break; // Break on match
+ break;
}
}
}
- // Now we are going to check for a mode change. This means a space
- // or a > to determine if we are going to select all the children
- // of the currently matched items, or a ^ if we are going to use the
- // ownerCt axis as the candidate source.
- if (modeMatch[1]) { // Assignment, and test for truthiness!
+
+
+
+
+ if (modeMatch[1]) {
operations.push({
mode: modeMatch[2]||modeMatch[1]
});
@@ -14850,1211 +14807,229 @@ Ext.define('Ext.ComponentQuery', {
}
}
- // Now that we have all our operations in an array, we are going
- // to create a new Query using these operations.
+
+
return new cq.Query({
operations: operations
});
}
});
});
-/**
- * @class Ext.util.Filter
- * @extends Object
- * <p>Represents a filter that can be applied to a {@link Ext.util.MixedCollection MixedCollection}. Can either simply
- * filter on a property/value pair or pass in a filter function with custom logic. Filters are always used in the context
- * of MixedCollections, though {@link Ext.data.Store Store}s frequently create them when filtering and searching on their
- * records. Example usage:</p>
-<pre><code>
-//set up a fictional MixedCollection containing a few people to filter on
-var allNames = new Ext.util.MixedCollection();
-allNames.addAll([
- {id: 1, name: 'Ed', age: 25},
- {id: 2, name: 'Jamie', age: 37},
- {id: 3, name: 'Abe', age: 32},
- {id: 4, name: 'Aaron', age: 26},
- {id: 5, name: 'David', age: 32}
-]);
-
-var ageFilter = new Ext.util.Filter({
- property: 'age',
- value : 32
-});
-
-var longNameFilter = new Ext.util.Filter({
- filterFn: function(item) {
- return item.name.length > 4;
- }
-});
-
-//a new MixedCollection with the 3 names longer than 4 characters
-var longNames = allNames.filter(longNameFilter);
-
-//a new MixedCollection with the 2 people of age 24:
-var youngFolk = allNames.filter(ageFilter);
-</code></pre>
- */
-Ext.define('Ext.util.Filter', {
-
- /* Begin Definitions */
-
- /* End Definitions */
- /**
- * @cfg {String} property The property to filter on. Required unless a {@link #filterFn} is passed
- */
-
- /**
- * @cfg {Function} filterFn A custom filter function which is passed each item in the {@link Ext.util.MixedCollection}
- * in turn. Should return true to accept each item or false to reject it
- */
-
- /**
- * @cfg {Boolean} anyMatch True to allow any match - no regex start/end line anchors will be added. Defaults to false
- */
- anyMatch: false,
-
- /**
- * @cfg {Boolean} exactMatch True to force exact match (^ and $ characters added to the regex). Defaults to false.
- * Ignored if anyMatch is true.
- */
- exactMatch: false,
-
- /**
- * @cfg {Boolean} caseSensitive True to make the regex case sensitive (adds 'i' switch to regex). Defaults to false.
- */
- caseSensitive: false,
-
- /**
- * @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);
-
- //we're aliasing filter to filterFn mostly for API cleanliness reasons, despite the fact it dirties the code here.
- //Ext.util.Sorter takes a sorterFn property but allows .sort to be called - we do the same here
- this.filter = this.filter || this.filterFn;
-
- if (this.filter == undefined) {
- if (this.property == undefined || this.value == undefined) {
- // Commented this out temporarily because it stops us using string ids in models. TODO: Remove this once
- // Model has been updated to allow string ids
-
- // Ext.Error.raise("A Filter requires either a property or a filterFn to be set");
- } else {
- this.filter = this.createFilterFn();
- }
-
- this.filterFn = this.filter;
- }
- },
-
- /**
- * @private
- * Creates a filter function for the configured property/value/anyMatch/caseSensitive options for this Filter
- */
- createFilterFn: function() {
- var me = this,
- matcher = me.createValueMatcher(),
- property = me.property;
-
- return function(item) {
- return matcher.test(me.getRoot.call(me, item)[property]);
- };
- },
-
- /**
- * @private
- * Returns the root property of the given item, based on the configured {@link #root} property
- * @param {Object} item The item
- * @return {Object} The root property of the object
- */
- getRoot: function(item) {
- return this.root == undefined ? item : item[this.root];
+Ext.define('Ext.util.HashMap', {
+ mixins: {
+ observable: 'Ext.util.Observable'
},
-
- /**
- * @private
- * Returns a regular expression based on the given value and matching options
- */
- createValueMatcher : function() {
- var me = this,
- value = me.value,
- anyMatch = me.anyMatch,
- exactMatch = me.exactMatch,
- caseSensitive = me.caseSensitive,
- escapeRe = Ext.String.escapeRegex;
-
- if (!value.exec) { // not a regex
- value = String(value);
-
- if (anyMatch === true) {
- value = escapeRe(value);
- } else {
- value = '^' + escapeRe(value);
- if (exactMatch === true) {
- value += '$';
- }
- }
- value = new RegExp(value, caseSensitive ? '' : 'i');
- }
-
- return value;
- }
-});
-/**
- * @class Ext.util.Sorter
- * @extends Object
-
-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 #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}.
- * 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>
- */
-
- /**
- * @cfg {String} root Optional root property. This is mostly useful when sorting 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
- */
-
- /**
- * @cfg {Function} transform A function that will be run on each value before
- * it is compared in the sorter. The function will receive a single argument,
- * the value.
- */
- /**
- * @cfg {String} direction The direction to sort by. Defaults to ASC
- */
- direction: "ASC",
+
constructor: function(config) {
- var me = this;
-
- Ext.apply(me, config);
-
-
- me.updateSortFunction();
- },
-
- /**
- * @private
- * Creates and returns a function which sorts an array by the given property and direction
- * @return {Function} A function which sorts by the property/direction combination provided
- */
- createSortFunction: function(sorterFn) {
- var me = this,
- property = me.property,
- direction = me.direction || "ASC",
- modifier = direction.toUpperCase() == "DESC" ? -1 : 1;
+ config = config || {};
- //create a comparison function. Takes 2 objects, returns 1 if object 1 is greater,
- //-1 if object 2 is greater or 0 if they are equal
- return function(o1, o2) {
- return modifier * sorterFn.call(me, o1, o2);
- };
- },
-
- /**
- * @private
- * Basic default sorter function that just compares the defined property of each object
- */
- defaultSorterFn: function(o1, o2) {
var me = this,
- transform = me.transform,
- v1 = me.getRoot(o1)[me.property],
- v2 = me.getRoot(o2)[me.property];
-
- if (transform) {
- v1 = transform(v1);
- v2 = transform(v2);
- }
-
- return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
- },
-
- /**
- * @private
- * Returns the root property of the given item, based on the configured {@link #root} property
- * @param {Object} item The item
- * @return {Object} The root property of the object
- */
- getRoot: function(item) {
- return this.root === undefined ? item : item[this.root];
- },
-
- /**
- * 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();
- },
-
- /**
- * 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;
- fn = fn || me.sorterFn || me.defaultSorterFn;
- me.sort = me.createSortFunction(fn);
- }
-});
-/**
- * @class Ext.ElementLoader
- * A class used to load remote content to an Element. Sample usage:
- * <pre><code>
-Ext.get('el').load({
- url: 'myPage.php',
- scripts: true,
- params: {
- id: 1
- }
-});
- * </code></pre>
- * <p>
- * In general this class will not be instanced directly, rather the {@link Ext.core.Element#load} method
- * will be used.
- * </p>
- */
-Ext.define('Ext.ElementLoader', {
+ keyFn = config.keyFn;
- /* Begin Definitions */
+ me.addEvents(
+
+ 'add',
+
+ 'clear',
+
+ 'remove',
+
+ 'replace'
+ );
- mixins: {
- observable: 'Ext.util.Observable'
+ me.mixins.observable.constructor.call(me, config);
+ me.clear(true);
+
+ if (keyFn) {
+ me.getKey = keyFn;
+ }
},
- uses: [
- 'Ext.data.Connection',
- 'Ext.Ajax'
- ],
- statics: {
- Renderer: {
- Html: function(loader, response, active){
- loader.getTarget().update(response.responseText, active.scripts === true);
- return true;
- }
- }
+ getCount: function() {
+ return this.length;
},
- /* End Definitions */
-
- /**
- * @cfg {String} url The url to retrieve the content from. Defaults to <tt>null</tt>.
- */
- url: null,
-
- /**
- * @cfg {Object} params Any params to be attached to the Ajax request. These parameters will
- * be overridden by any params in the load options. Defaults to <tt>null</tt>.
- */
- params: null,
-
- /**
- * @cfg {Object} baseParams Params that will be attached to every request. These parameters
- * will not be overridden by any params in the load options. Defaults to <tt>null</tt>.
- */
- baseParams: null,
-
- /**
- * @cfg {Boolean/Object} autoLoad True to have the loader make a request as soon as it is created. Defaults to <tt>false</tt>.
- * This argument can also be a set of options that will be passed to {@link #load} is called.
- */
- autoLoad: false,
-
- /**
- * @cfg {Mixed} target The target element for the loader. It can be the DOM element, the id or an Ext.Element.
- */
- target: null,
-
- /**
- * @cfg {Mixed} loadMask True or a string to show when the element is loading.
- */
- loadMask: false,
-
- /**
- * @cfg {Object} ajaxOptions Any additional options to be passed to the request, for example timeout or headers. Defaults to <tt>null</tt>.
- */
- ajaxOptions: null,
-
- /**
- * @cfg {Boolean} scripts True to parse any inline script tags in the response.
- */
- scripts: false,
-
- /**
- * @cfg {Function} success A function to be called when a load request is successful.
- */
-
- /**
- * @cfg {Function} failure A function to be called when a load request fails.
- */
-
- /**
- * @cfg {Object} scope The scope to execute the {@link #success} and {@link #failure} functions in.
- */
- /**
- * @cfg {Function} renderer A custom function to render the content to the element. The passed parameters
- * are
- * <ul>
- * <li>The loader</li>
- * <li>The response</li>
- * <li>The active request</li>
- * </ul>
- */
-
- isLoader: true,
-
- constructor: function(config) {
- var me = this,
- autoLoad;
+ getData: function(key, value) {
- config = config || {};
- Ext.apply(me, config);
- me.setTarget(me.target);
- me.addEvents(
- /**
- * @event beforeload
- * Fires before a load request is made to the server.
- * Returning false from an event listener can prevent the load
- * from occurring.
- * @param {Ext.ElementLoader} this
- * @param {Object} options The options passed to the request
- */
- 'beforeload',
-
- /**
- * @event exception
- * Fires after an unsuccessful load.
- * @param {Ext.ElementLoader} this
- * @param {Object} response The response from the server
- * @param {Object} options The options passed to the request
- */
- 'exception',
-
- /**
- * @event exception
- * Fires after a successful load.
- * @param {Ext.ElementLoader} this
- * @param {Object} response The response from the server
- * @param {Object} options The options passed to the request
- */
- 'load'
- );
-
- // don't pass config because we have already applied it.
- me.mixins.observable.constructor.call(me);
-
- if (me.autoLoad) {
- autoLoad = me.autoLoad;
- if (autoLoad === true) {
- autoLoad = {};
- }
- me.load(autoLoad);
- }
- },
-
- /**
- * Set an {Ext.Element} as the target of this loader. Note that if the target is changed,
- * any active requests will be aborted.
- * @param {Mixed} target The element
- */
- setTarget: function(target){
- var me = this;
- target = Ext.get(target);
- if (me.target && me.target != target) {
- me.abort();
+ if (value === undefined) {
+ value = key;
+ key = this.getKey(value);
}
- me.target = target;
- },
- /**
- * Get the target of this loader.
- * @return {Ext.Component} target The target, null if none exists.
- */
- getTarget: function(){
- return this.target || null;
+ return [key, value];
},
- /**
- * Aborts the active load request
- */
- abort: function(){
- var active = this.active;
- if (active !== undefined) {
- Ext.Ajax.abort(active.request);
- if (active.mask) {
- this.removeMask();
- }
- delete this.active;
- }
- },
- /**
- * Remove the mask on the target
- * @private
- */
- removeMask: function(){
- this.target.unmask();
- },
-
- /**
- * Add the mask on the target
- * @private
- * @param {Mixed} mask The mask configuration
- */
- addMask: function(mask){
- this.target.mask(mask === true ? null : mask);
+ getKey: function(o) {
+ return o.id;
},
- /**
- * Load new data from the server.
- * @param {Object} options The options for the request. They can be any configuration option that can be specified for
- * the class, with the exception of the target option. Note that any options passed to the method will override any
- * class defaults.
- */
- load: function(options) {
-
- options = Ext.apply({}, options);
-
- var me = this,
- target = me.target,
- mask = Ext.isDefined(options.loadMask) ? options.loadMask : me.loadMask,
- params = Ext.apply({}, options.params),
- ajaxOptions = Ext.apply({}, options.ajaxOptions),
- callback = options.callback || me.callback,
- scope = options.scope || me.scope || me,
- request;
-
- Ext.applyIf(ajaxOptions, me.ajaxOptions);
- Ext.applyIf(options, ajaxOptions);
-
- Ext.applyIf(params, me.params);
- Ext.apply(params, me.baseParams);
-
- Ext.applyIf(options, {
- url: me.url
- });
-
-
- Ext.apply(options, {
- scope: me,
- params: params,
- callback: me.onComplete
- });
-
- if (me.fireEvent('beforeload', me, options) === false) {
- return;
- }
-
- if (mask) {
- me.addMask(mask);
- }
-
- request = Ext.Ajax.request(options);
- me.active = {
- request: request,
- options: options,
- mask: mask,
- scope: scope,
- callback: callback,
- success: options.success || me.success,
- failure: options.failure || me.failure,
- renderer: options.renderer || me.renderer,
- scripts: Ext.isDefined(options.scripts) ? options.scripts : me.scripts
- };
- me.setOptions(me.active, options);
- },
- /**
- * Set any additional options on the active request
- * @private
- * @param {Object} active The active request
- * @param {Object} options The initial options
- */
- setOptions: Ext.emptyFn,
-
- /**
- * Parse the response after the request completes
- * @private
- * @param {Object} options Ajax options
- * @param {Boolean} success Success status of the request
- * @param {Object} response The response object
- */
- onComplete: function(options, success, response) {
+ add: function(key, value) {
var me = this,
- active = me.active,
- scope = active.scope,
- renderer = me.getRenderer(active.renderer);
-
-
- if (success) {
- success = renderer.call(me, me, response, active);
- }
+ data;
- if (success) {
- Ext.callback(active.success, scope, [me, response, options]);
- me.fireEvent('load', me, response, options);
- } else {
- Ext.callback(active.failure, scope, [me, response, options]);
- me.fireEvent('exception', me, response, options);
+ if (arguments.length === 1) {
+ value = key;
+ key = me.getKey(value);
}
- Ext.callback(active.callback, scope, [me, success, response, options]);
- if (active.mask) {
- me.removeMask();
+ if (me.containsKey(key)) {
+ return me.replace(key, value);
}
- delete me.active;
+ data = me.getData(key, value);
+ key = data[0];
+ value = data[1];
+ me.map[key] = value;
+ ++me.length;
+ me.fireEvent('add', me, key, value);
+ return value;
},
- /**
- * Gets the renderer to use
- * @private
- * @param {String/Function} renderer The renderer to use
- * @return {Function} A rendering function to use.
- */
- getRenderer: function(renderer){
- if (Ext.isFunction(renderer)) {
- return renderer;
- }
- return this.statics().Renderer.Html;
- },
- /**
- * Automatically refreshes the content over a specified period.
- * @param {Number} interval The interval to refresh in ms.
- * @param {Object} options (optional) The options to pass to the load method. See {@link #load}
- */
- startAutoRefresh: function(interval, options){
- var me = this;
- me.stopAutoRefresh();
- me.autoRefresh = setInterval(function(){
- me.load(options);
- }, interval);
- },
-
- /**
- * Clears any auto refresh. See {@link #startAutoRefresh}.
- */
- stopAutoRefresh: function(){
- clearInterval(this.autoRefresh);
- delete this.autoRefresh;
- },
-
- /**
- * Checks whether the loader is automatically refreshing. See {@link #startAutoRefresh}.
- * @return {Boolean} True if the loader is automatically refreshing
- */
- isAutoRefreshing: function(){
- return Ext.isDefined(this.autoRefresh);
- },
-
- /**
- * Destroys the loader. Any active requests will be aborted.
- */
- destroy: function(){
- var me = this;
- me.stopAutoRefresh();
- delete me.target;
- me.abort();
- me.clearListeners();
- }
-});
-
-/**
- * @class Ext.layout.Layout
- * @extends Object
- * Base Layout class - extended by ComponentLayout and ContainerLayout
- */
-Ext.define('Ext.layout.Layout', {
-
- /* Begin Definitions */
-
- /* End Definitions */
-
- isLayout: true,
- initialized: false,
+ replace: function(key, value) {
+ var me = this,
+ map = me.map,
+ old;
- statics: {
- create: function(layout, defaultType) {
- var type;
- if (layout instanceof Ext.layout.Layout) {
- return Ext.createByAlias('layout.' + layout);
- } else {
- if (!layout || typeof layout === 'string') {
- type = layout || defaultType;
- layout = {};
- }
- else {
- type = layout.type;
- }
- return Ext.createByAlias('layout.' + type, layout || {});
- }
+ if (!me.containsKey(key)) {
+ me.add(key, value);
}
+ old = map[key];
+ map[key] = value;
+ me.fireEvent('replace', me, key, value, old);
+ return value;
},
- constructor : function(config) {
- this.id = Ext.id(null, this.type + '-');
- Ext.apply(this, config);
- },
-
- /**
- * @private
- */
- layout : function() {
- var me = this;
- me.layoutBusy = true;
- me.initLayout();
-
- if (me.beforeLayout.apply(me, arguments) !== false) {
- me.layoutCancelled = false;
- me.onLayout.apply(me, arguments);
- me.childrenChanged = false;
- me.owner.needsLayout = false;
- me.layoutBusy = false;
- me.afterLayout.apply(me, arguments);
- }
- else {
- me.layoutCancelled = true;
+
+ remove: function(o) {
+ var key = this.findKey(o);
+ if (key !== undefined) {
+ return this.removeAtKey(key);
}
- me.layoutBusy = false;
- me.doOwnerCtLayouts();
- },
-
- beforeLayout : function() {
- this.renderChildren();
- return true;
- },
-
- renderChildren: function () {
- var me = this;
- me.renderItems(me.getLayoutItems(), me.getRenderTarget());
+ return false;
},
- /**
- * @private
- * Iterates over all passed items, ensuring they are rendered. If the items are already rendered,
- * also determines if the items are in the proper place dom.
- */
- renderItems : function(items, target) {
- var ln = items.length,
- i = 0,
- item;
-
- for (; i < ln; i++) {
- item = items[i];
- if (item && !item.rendered) {
- this.renderItem(item, target, i);
- }
- else if (!this.isValidParent(item, target, i)) {
- this.moveItem(item, target, i);
- }
- }
- },
+
+ removeAtKey: function(key) {
+ var me = this,
+ value;
- // @private - Validates item is in the proper place in the dom.
- isValidParent : function(item, target, position) {
- var dom = item.el ? item.el.dom : Ext.getDom(item);
- if (dom && target && target.dom) {
- if (Ext.isNumber(position) && dom !== target.dom.childNodes[position]) {
- return false;
- }
- return (dom.parentNode == (target.dom || target));
+ if (me.containsKey(key)) {
+ value = me.map[key];
+ delete me.map[key];
+ --me.length;
+ me.fireEvent('remove', me, key, value);
+ return true;
}
return false;
},
- /**
- * @private
- * Renders the given Component into the target Element.
- * @param {Ext.Component} item The Component to render
- * @param {Ext.core.Element} target The target Element
- * @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);
- me.configureItem(item);
- me.childrenChanged = true;
- }
- },
-
- /**
- * @private
- * Moved Component to the provided target instead.
- */
- moveItem : function(item, target, position) {
- // Make sure target is a dom element
- target = target.dom || target;
- if (typeof position == 'number') {
- position = target.childNodes[position];
- }
- target.insertBefore(item.el.dom, position || null);
- item.container = Ext.get(target);
- this.configureItem(item);
- this.childrenChanged = true;
+
+ get: function(key) {
+ return this.map[key];
},
- /**
- * @private
- * Adds the layout's targetCls if necessary and sets
- * initialized flag when complete.
- */
- initLayout : function() {
- if (!this.initialized && !Ext.isEmpty(this.targetCls)) {
- this.getTarget().addCls(this.targetCls);
+
+ clear: function( initial) {
+ var me = this;
+ me.map = {};
+ me.length = 0;
+ if (initial !== true) {
+ me.fireEvent('clear', me);
}
- this.initialized = true;
+ return me;
},
- // @private Sets the layout owner
- setOwner : function(owner) {
- this.owner = owner;
+
+ containsKey: function(key) {
+ return this.map[key] !== undefined;
},
- // @private - Returns empty array
- getLayoutItems : function() {
- return [];
+
+ contains: function(value) {
+ return this.containsKey(this.findKey(value));
},
- /**
- * @private
- * Applies itemCls
- * Empty template method
- */
- configureItem: Ext.emptyFn,
- // Placeholder empty functions for subclasses to extend
- onLayout : Ext.emptyFn,
- afterLayout : Ext.emptyFn,
- onRemove : Ext.emptyFn,
- onDestroy : Ext.emptyFn,
- doOwnerCtLayouts : Ext.emptyFn,
-
- /**
- * @private
- * Removes itemCls
- */
- afterRemove : function(item) {
- var me = this,
- 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);
- }
- if (owner.itemCls) {
- 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;
+ getKeys: function() {
+ return this.getArray(true);
},
- /*
- * Destroys this layout. This is a template method that is empty by default, but should be implemented
- * by subclasses that require explicit destruction to purge event handlers or remove DOM nodes.
- * @protected
- */
- destroy : function() {
- if (!Ext.isEmpty(this.targetCls)) {
- var target = this.getTarget();
- if (target) {
- target.removeCls(this.targetCls);
- }
- }
- this.onDestroy();
- }
-});
-/**
- * @class Ext.layout.component.Component
- * @extends Ext.layout.Layout
- * @private
- * <p>This class is intended to be extended or created via the <tt><b>{@link Ext.Component#componentLayout layout}</b></tt>
- * configuration property. See <tt><b>{@link Ext.Component#componentLayout}</b></tt> for additional details.</p>
- */
-
-Ext.define('Ext.layout.component.Component', {
-
- /* Begin Definitions */
-
- extend: 'Ext.layout.Layout',
-
- /* End Definitions */
-
- type: 'component',
-
- monitorChildren: true,
-
- initLayout : function() {
- var me = this,
- owner = me.owner,
- ownerEl = owner.el;
-
- if (!me.initialized) {
- if (owner.frameSize) {
- me.frameSize = owner.frameSize;
- }
- else {
- owner.frameSize = me.frameSize = {
- top: 0,
- left: 0,
- bottom: 0,
- right: 0
- };
- }
- }
- me.callParent(arguments);
+
+ getValues: function() {
+ return this.getArray(false);
},
- beforeLayout : function(width, height, isSetSize, callingContainer) {
- this.callParent(arguments);
-
- var me = this,
- owner = me.owner,
- ownerCt = owner.ownerCt,
- layout = owner.layout,
- isVisible = owner.isVisible(true),
- ownerElChild = owner.el.child,
- layoutCollection;
-
- // 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;
- }
-
- // If an ownerCt is hidden, add my reference onto the layoutOnShow stack. Set the needsLayout flag.
- // If the owner itself is a directly hidden floater, set the needsLayout object on that for when it is shown.
- if (!isVisible && (owner.hiddenAncestor || owner.floating)) {
- if (owner.hiddenAncestor) {
- layoutCollection = owner.hiddenAncestor.layoutOnShow;
- layoutCollection.remove(owner);
- layoutCollection.add(owner);
+
+ getArray: function(isKey) {
+ var arr = [],
+ key,
+ map = this.map;
+ for (key in map) {
+ if (map.hasOwnProperty(key)) {
+ arr.push(isKey ? key: map[key]);
}
- owner.needsLayout = {
- width: width,
- height: height,
- isSetSize: false
- };
- }
-
- if (isVisible && this.needsLayout(width, height)) {
- return owner.beforeComponentLayout(width, height, isSetSize, callingContainer);
- }
- else {
- return false;
}
+ return arr;
},
- /**
- * Check if the new size is different from the current size and only
- * trigger a layout if it is necessary.
- * @param {Mixed} width The new width to set.
- * @param {Mixed} height The new height to set.
- */
- needsLayout : function(width, height) {
- var me = this,
- widthBeingChanged,
- heightBeingChanged;
- me.lastComponentSize = me.lastComponentSize || {
- width: -Infinity,
- height: -Infinity
- };
+
+ each: function(fn, scope) {
- // 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);
- },
-
- /**
- * Set the size of any element supporting undefined, null, and values.
- * @param {Mixed} width The new width to set.
- * @param {Mixed} height The new height to set.
- */
- setElementSize: function(el, width, height) {
- if (width !== undefined && height !== undefined) {
- el.setSize(width, height);
- }
- else if (height !== undefined) {
- el.setHeight(height);
- }
- else if (width !== undefined) {
- el.setWidth(width);
- }
- },
-
- /**
- * Returns the owner component's resize element.
- * @return {Ext.core.Element}
- */
- getTarget : function() {
- return this.owner.el;
- },
-
- /**
- * <p>Returns the element into which rendering must take place. Defaults to the owner Component's encapsulating element.</p>
- * May be overridden in Component layout managers which implement an inner element.
- * @return {Ext.core.Element}
- */
- getRenderTarget : function() {
- return this.owner.el;
- },
-
- /**
- * Set the size of the target element.
- * @param {Mixed} width The new width to set.
- * @param {Mixed} height The new height to set.
- */
- setTargetSize : function(width, height) {
- var me = this;
- me.setElementSize(me.owner.el, width, height);
-
- if (me.owner.frameBody) {
- var targetInfo = me.getTargetInfo(),
- padding = targetInfo.padding,
- border = targetInfo.border,
- frameSize = me.frameSize;
-
- me.setElementSize(me.owner.frameBody,
- Ext.isNumber(width) ? (width - frameSize.left - frameSize.right - padding.left - padding.right - border.left - border.right) : width,
- Ext.isNumber(height) ? (height - frameSize.top - frameSize.bottom - padding.top - padding.bottom - border.top - border.bottom) : height
- );
- }
-
- me.autoSized = {
- width: !Ext.isNumber(width),
- height: !Ext.isNumber(height)
- };
-
- me.lastComponentSize = {
- width: width,
- height: height
- };
- },
-
- getTargetInfo : function() {
- if (!this.targetInfo) {
- var target = this.getTarget(),
- body = this.owner.getTargetEl();
+ var items = Ext.apply({}, this.map),
+ key,
+ length = this.length;
- this.targetInfo = {
- padding: {
- top: target.getPadding('t'),
- right: target.getPadding('r'),
- bottom: target.getPadding('b'),
- left: target.getPadding('l')
- },
- border: {
- top: target.getBorderWidth('t'),
- right: target.getBorderWidth('r'),
- bottom: target.getBorderWidth('b'),
- left: target.getBorderWidth('l')
- },
- bodyMargin: {
- top: body.getMargin('t'),
- right: body.getMargin('r'),
- bottom: body.getMargin('b'),
- left: body.getMargin('l')
- }
- };
+ scope = scope || this;
+ for (key in items) {
+ if (items.hasOwnProperty(key)) {
+ if (fn.call(scope, key, items[key], length) === false) {
+ break;
+ }
+ }
}
- return this.targetInfo;
+ return this;
},
- // Start laying out UP the ownerCt's layout when flagged to do so.
- doOwnerCtLayouts: function() {
- var owner = this.owner,
- ownerCt = owner.ownerCt,
- 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 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) {
+
+ clone: function() {
+ var hash = new this.self(),
+ map = this.map,
+ key;
- // 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;
- }
- // Execute upstream Container layout
- else if (ownerCtContainerLayout.bindToOwnerCtContainer === true) {
- ownerCtContainerLayout.layout();
- }
+ hash.suspendEvents();
+ for (key in map) {
+ if (map.hasOwnProperty(key)) {
+ hash.add(key, map[key]);
}
}
+ hash.resumeEvents();
+ return hash;
},
- doContainerLayout: function() {
- var me = this,
- owner = me.owner,
- ownerCt = owner.ownerCt,
- layout = owner.layout,
- ownerCtComponentLayout;
-
- // 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 && !layout.isAutoDock) {
- layout.layout();
- }
+
+ findKey: function(value) {
+ var key,
+ map = this.map;
- // Tell the ownerCt that it's child has changed and can be re-layed by ignoring the lastComponentSize cache.
- if (ownerCt && ownerCt.componentLayout) {
- ownerCtComponentLayout = ownerCt.componentLayout;
- if (!owner.floating && ownerCtComponentLayout.monitorChildren && !ownerCtComponentLayout.layoutBusy) {
- ownerCtComponentLayout.childrenChanged = true;
+ for (key in map) {
+ if (map.hasOwnProperty(key) && map[key] === value) {
+ return key;
}
}
- },
-
- afterLayout : function(width, height, isSetSize, layoutOwner) {
- this.doContainerLayout();
- this.owner.afterComponentLayout(width, height, isSetSize, layoutOwner);
+ return undefined;
}
});
-/**
- * @class Ext.state.Manager
- * This is the global state manager. By default all components that are "state aware" check this class
- * for state information if you don't pass them a custom state provider. In order for this class
- * to be useful, it must be initialized with a provider when your application initializes. Example usage:
- <pre><code>
-// in your initialization function
-init : function(){
- Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
- var win = new Window(...);
- win.restoreState();
-}
- </code></pre>
- * This class passes on calls from components to the underlying {@link Ext.state.Provider} so that
- * there is a common interface that can be used without needing to refer to a specific provider instance
- * in every component.
- * @singleton
- * @docauthor Evan Trimboli <evan@sencha.com>
- */
+
Ext.define('Ext.state.Manager', {
singleton: true,
requires: ['Ext.state.Provider'],
@@ -16063,57 +15038,35 @@ Ext.define('Ext.state.Manager', {
},
- /**
- * Configures the default state provider for your application
- * @param {Provider} stateProvider The state provider to set
- */
+
setProvider : function(stateProvider){
this.provider = stateProvider;
},
- /**
- * Returns the current value for a key
- * @param {String} name The key name
- * @param {Mixed} defaultValue The default value to return if the key lookup does not match
- * @return {Mixed} The state data
- */
+
get : function(key, defaultValue){
return this.provider.get(key, defaultValue);
},
- /**
- * Sets the value for a key
- * @param {String} name The key name
- * @param {Mixed} value The state data
- */
+
set : function(key, value){
this.provider.set(key, value);
},
- /**
- * Clears a value from the state
- * @param {String} name The key name
- */
+
clear : function(key){
this.provider.clear(key);
},
- /**
- * Gets the currently configured state provider
- * @return {Provider} The state provider
- */
+
getProvider : function(){
return this.provider;
}
});
-/**
- * @class Ext.state.Stateful
- * 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'
@@ -16121,68 +15074,16 @@ Ext.define('Ext.state.Stateful', {
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
- * 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
- * {@link Ext.state.Provider#set set} and {@link Ext.state.Provider#get get}
- * methods to save and recall name/value pairs. A built-in implementation,
- * {@link Ext.state.CookieProvider} is available.</p>
- * <p>To set the state provider for the current page:</p>
- * <pre><code>
-Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
- expires: new Date(new Date().getTime()+(1000*60*60*24*7)), //7 days from now
-}));
- * </code></pre>
- * <p>A stateful object attempts to save state when one of the events
- * listed in the <code>{@link #stateEvents}</code> configuration fires.</p>
- * <p>To save state, a stateful object first serializes its state by
- * calling <b><code>{@link #getState}</code></b>. By default, this function does
- * nothing. The developer must provide an implementation which returns an
- * 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>.
- * <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>
- * <p>The resulting object is passed to <b><code>{@link #applyState}</code></b>.
- * The default implementation of <code>{@link #applyState}</code> simply copies
- * properties into the object, but a developer may override this to support
- * more behaviour.</p>
- * <p>You can perform extra processing on state save and restore by attaching
- * handlers to the {@link #beforestaterestore}, {@link #staterestore},
- * {@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
- * save its state (defaults to none). <code>stateEvents</code> may be any type
- * of event supported by this object, including browser or custom events
- * (e.g., <tt>['click', 'customerchange']</tt>).</p>
- * <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,
@@ -16206,47 +15107,16 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
me.stateEvents.concat(config.stateEvents);
}
this.addEvents(
- /**
- * @event beforestaterestore
- * Fires before the state of the object is restored. Return false from an event handler to stop the restore.
- * @param {Ext.state.Stateful} this
- * @param {Object} state The hash of state values returned from the StateProvider. If this
- * event is not vetoed, then the state object is passed to <b><tt>applyState</tt></b>. By default,
- * that simply copies property values into this object. The method maybe overriden to
- * provide custom state restoration.
- */
+
'beforestaterestore',
- /**
- * @event staterestore
- * Fires after the state of the object is restored.
- * @param {Ext.state.Stateful} this
- * @param {Object} state The hash of state values returned from the StateProvider. This is passed
- * to <b><tt>applyState</tt></b>. By default, that simply copies property values into this
- * 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.
- * @param {Ext.state.Stateful} this
- * @param {Object} state The hash of state values. This is determined by calling
- * <b><tt>getState()</tt></b> on the object. This method must be provided by the
- * developer to return whetever representation of state is required, by default, Ext.state.Stateful
- * has a null implementation.
- */
+
'beforestatesave',
- /**
- * @event statesave
- * Fires after the state of the object is saved to the configured state provider.
- * @param {Ext.state.Stateful} this
- * @param {Object} state The hash of state values. This is determined by calling
- * <b><tt>getState()</tt></b> on the object. This method must be provided by the
- * developer to return whetever representation of state is required, by default, Ext.state.Stateful
- * has a null implementation.
- */
+
'statesave'
);
me.mixins.observable.constructor.call(me);
@@ -16256,18 +15126,12 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
}
},
- /**
- * Initializes any state events for this object.
- * @private
- */
+
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.
- */
+
addStateEvents: function(events){
if (!Ext.isArray(events)) {
events = [events];
@@ -16282,10 +15146,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
}
},
- /**
- * This method is called when any of the {@link #stateEvents} are fired.
- * @private
- */
+
onStateChange: function(){
var me = this,
delay = me.saveDelay;
@@ -16300,10 +15161,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
}
},
- /**
- * Saves the state of the object to the persistence store.
- * @private
- */
+
saveState: function() {
var me = this,
id,
@@ -16321,31 +15179,19 @@ 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;
},
- /**
- * 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
- * the current object.
- * @param {Object} state The state
- */
+
applyState: function(state) {
if (state) {
Ext.apply(this, state);
}
},
- /**
- * Gets the state id for this object.
- * @return {String} The state id, null if not found.
- */
+
getStateId: function() {
var me = this,
id = me.stateId;
@@ -16356,10 +15202,7 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
return id;
},
- /**
- * Initializes the state of the object upon construction.
- * @private
- */
+
initState: function(){
var me = this,
id = me.getStateId(),
@@ -16379,9 +15222,32 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
}
},
- /**
- * Destroys this stateful object.
- */
+
+ savePropToState: function (propName, state, stateName) {
+ var me = this,
+ value = me[propName],
+ config = me.initialConfig;
+
+ if (me.hasOwnProperty(propName)) {
+ if (!config || config[propName] !== value) {
+ if (state) {
+ state[stateName || propName] = value;
+ }
+ return true;
+ }
+ }
+ return false;
+ },
+
+ savePropsToState: function (propNames, state) {
+ var me = this;
+ Ext.each(propNames, function (propName) {
+ me.savePropToState(propName, state);
+ });
+ return state;
+ },
+
+
destroy: function(){
var task = this.stateTask;
if (task) {
@@ -16393,85 +15259,53 @@ Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
});
-/**
- * @class Ext.AbstractManager
- * @extends Object
- * Base Manager class
- */
+
Ext.define('Ext.AbstractManager', {
- /* Begin Definitions */
+
requires: ['Ext.util.HashMap'],
- /* End Definitions */
+
typeName: 'type',
constructor: function(config) {
Ext.apply(this, config || {});
- /**
- * Contains all of the items currently managed
- * @property all
- * @type Ext.util.MixedCollection
- */
+
this.all = Ext.create('Ext.util.HashMap');
this.types = {};
},
- /**
- * Returns an item by id.
- * For additional details see {@link Ext.util.HashMap#get}.
- * @param {String} id The id of the item
- * @return {Mixed} The item, <code>undefined</code> if not found.
- */
+
get : function(id) {
return this.all.get(id);
},
- /**
- * Registers an item to be managed
- * @param {Mixed} item The item to register
- */
+
register: function(item) {
this.all.add(item);
},
- /**
- * Unregisters an item by removing it from this manager
- * @param {Mixed} item The item to unregister
- */
+
unregister: function(item) {
this.all.remove(item);
},
- /**
- * <p>Registers a new item constructor, keyed by a type key.
- * @param {String} type The mnemonic string by which the class may be looked up.
- * @param {Constructor} cls The new instance class.
- */
+
registerType : function(type, cls) {
this.types[type] = cls;
cls[this.typeName] = type;
},
- /**
- * Checks if an item type is registered.
- * @param {String} type The mnemonic string by which the class may be looked up
- * @return {Boolean} Whether the type is registered.
- */
+
isRegistered : function(type){
return this.types[type] !== undefined;
},
- /**
- * Creates and returns an instance of whatever this manager manages, based on the supplied type and config object
- * @param {Object} config The config object
- * @param {String} defaultType If no type is discovered in the config object, we fall back to this type
- * @return {Mixed} The instance of whatever this manager is managing
- */
+
create: function(config, defaultType) {
var type = config[this.typeName] || config.type || defaultType,
Constructor = this.types[type];
@@ -16480,12 +15314,7 @@ Ext.define('Ext.AbstractManager', {
return new Constructor(config);
},
- /**
- * Registers a function that will be called when an item with the specified id is added to the manager. This will happen on instantiation.
- * @param {String} id The item id
- * @param {Function} fn The callback function. Called with a single parameter, the item.
- * @param {Object} scope The scope (<code>this</code> reference) in which the callback is executed. Defaults to the item.
- */
+
onAvailable : function(id, fn, scope){
var all = this.all,
item;
@@ -16503,145 +15332,18 @@ Ext.define('Ext.AbstractManager', {
}
},
- /**
- * Executes the specified function once for each item in the collection.
- * Returning false from the function will cease iteration.
- *
- * The paramaters passed to the function are:
- * <div class="mdetail-params"><ul>
- * <li><b>key</b> : String<p class="sub-desc">The key of the item</p></li>
- * <li><b>value</b> : Number<p class="sub-desc">The value of the item</p></li>
- * <li><b>length</b> : Number<p class="sub-desc">The total number of items in the collection</p></li>
- * </ul></div>
- * @param {Object} fn The function to execute.
- * @param {Object} scope The scope to execute in. Defaults to <tt>this</tt>.
- */
+
each: function(fn, scope){
this.all.each(fn, scope || this);
},
- /**
- * Gets the number of items in the collection.
- * @return {Number} The number of items in the collection.
- */
+
getCount: function(){
return this.all.getCount();
}
});
-/**
- * @class Ext.PluginManager
- * @extends Ext.AbstractManager
- * <p>Provides a registry of available Plugin <i>classes</i> indexed by a mnemonic code known as the Plugin's ptype.
- * The <code>{@link Ext.Component#xtype xtype}</code> provides a way to avoid instantiating child Components
- * when creating a full, nested config object for a complete Ext page.</p>
- * <p>A child Component may be specified simply as a <i>config object</i>
- * as long as the correct <code>{@link Ext.Component#xtype xtype}</code> is specified so that if and when the Component
- * needs rendering, the correct type can be looked up for lazy instantiation.</p>
- * <p>For a list of all available <code>{@link Ext.Component#xtype xtypes}</code>, see {@link Ext.Component}.</p>
- * @singleton
- */
-Ext.define('Ext.PluginManager', {
- extend: 'Ext.AbstractManager',
- alternateClassName: 'Ext.PluginMgr',
- singleton: true,
- typeName: 'ptype',
-
- /**
- * Creates a new Plugin from the specified config object using the
- * config object's ptype to determine the class to instantiate.
- * @param {Object} config A configuration object for the Plugin you wish to create.
- * @param {Constructor} defaultType The constructor to provide the default Plugin type if
- * the config object does not contain a <code>ptype</code>. (Optional if the config contains a <code>ptype</code>).
- * @return {Ext.Component} The newly instantiated Plugin.
- */
- //create: function(plugin, defaultType) {
- // if (plugin instanceof this) {
- // return plugin;
- // } else {
- // var type, config = {};
- //
- // if (Ext.isString(plugin)) {
- // type = plugin;
- // }
- // else {
- // type = plugin[this.typeName] || defaultType;
- // config = plugin;
- // }
- //
- // return Ext.createByAlias('plugin.' + type, config);
- // }
- //},
-
- create : function(config, defaultType){
- if (config.init) {
- return config;
- } else {
- return Ext.createByAlias('plugin.' + (config.ptype || defaultType), config);
- }
-
- // Prior system supported Singleton plugins.
- //var PluginCls = this.types[config.ptype || defaultType];
- //if (PluginCls.init) {
- // return PluginCls;
- //} else {
- // return new PluginCls(config);
- //}
- },
-
- /**
- * Returns all plugins registered with the given type. Here, 'type' refers to the type of plugin, not its ptype.
- * @param {String} type The type to search for
- * @param {Boolean} defaultsOnly True to only return plugins of this type where the plugin's isDefault property is truthy
- * @return {Array} All matching plugins
- */
- findByType: function(type, defaultsOnly) {
- var matches = [],
- types = this.types;
-
- for (var name in types) {
- if (!types.hasOwnProperty(name)) {
- continue;
- }
- var item = types[name];
-
- if (item.type == type && (!defaultsOnly || (defaultsOnly === true && item.isDefault))) {
- matches.push(item);
- }
- }
-
- return matches;
- }
-}, function() {
- /**
- * Shorthand for {@link Ext.PluginManager#registerType}
- * @param {String} ptype The ptype mnemonic string by which the Plugin class
- * may be looked up.
- * @param {Constructor} cls The new Plugin class.
- * @member Ext
- * @method preg
- */
- Ext.preg = function() {
- return Ext.PluginManager.registerType.apply(Ext.PluginManager, arguments);
- };
-});
-/**
- * @class Ext.ComponentManager
- * @extends Ext.AbstractManager
- * <p>Provides a registry of all Components (instances of {@link Ext.Component} or any subclass
- * thereof) on a page so that they can be easily accessed by {@link Ext.Component component}
- * {@link Ext.Component#id id} (see {@link #get}, or the convenience method {@link Ext#getCmp Ext.getCmp}).</p>
- * <p>This object also provides a registry of available Component <i>classes</i>
- * indexed by a mnemonic code known as the Component's {@link Ext.Component#xtype xtype}.
- * The <code>xtype</code> provides a way to avoid instantiating child Components
- * when creating a full, nested config object for a complete Ext page.</p>
- * <p>A child Component may be specified simply as a <i>config object</i>
- * as long as the correct <code>{@link Ext.Component#xtype xtype}</code> is specified so that if and when the Component
- * needs rendering, the correct type can be looked up for lazy instantiation.</p>
- * <p>For a list of all available <code>{@link Ext.Component#xtype xtypes}</code>, see {@link Ext.Component}.</p>
- * @singleton
- */
Ext.define('Ext.ComponentManager', {
extend: 'Ext.AbstractManager',
alternateClassName: 'Ext.ComponentMgr',
@@ -16650,14 +15352,7 @@ Ext.define('Ext.ComponentManager', {
typeName: 'xtype',
- /**
- * Creates a new Component from the specified config object using the
- * config object's xtype to determine the class to instantiate.
- * @param {Object} config A configuration object for the Component you wish to create.
- * @param {Constructor} defaultType The constructor to provide the default Component type if
- * the config object does not contain a <code>xtype</code>. (Optional if the config contains a <code>xtype</code>).
- * @return {Ext.Component} The newly instantiated Component.
- */
+
create: function(component, defaultType){
if (component instanceof Ext.AbstractComponent) {
return component;
@@ -16679,1704 +15374,35 @@ Ext.define('Ext.ComponentManager', {
cls.prototype[this.typeName] = type;
}
});
-/**
- * @class Ext.XTemplate
- * @extends Ext.Template
- * <p>A template class that supports advanced functionality like:<div class="mdetail-params"><ul>
- * <li>Autofilling arrays using templates and sub-templates</li>
- * <li>Conditional processing with basic comparison operators</li>
- * <li>Basic math function support</li>
- * <li>Execute arbitrary inline code with special built-in template variables</li>
- * <li>Custom member functions</li>
- * <li>Many special tags and built-in operators that aren't defined as part of
- * the API, but are supported in the templates that can be created</li>
- * </ul></div></p>
- * <p>XTemplate provides the templating mechanism built into:<div class="mdetail-params"><ul>
- * <li>{@link Ext.view.View}</li>
- * </ul></div></p>
- *
- * The {@link Ext.Template} describes
- * the acceptable parameters to pass to the constructor. The following
- * examples demonstrate all of the supported features.</p>
- *
- * <div class="mdetail-params"><ul>
- *
- * <li><b><u>Sample Data</u></b>
- * <div class="sub-desc">
- * <p>This is the data object used for reference in each code example:</p>
- * <pre><code>
-var data = {
-name: 'Tommy Maintz',
-title: 'Lead Developer',
-company: 'Sencha Inc.',
-email: 'tommy@sencha.com',
-address: '5 Cups Drive',
-city: 'Palo Alto',
-state: 'CA',
-zip: '44102',
-drinks: ['Coffee', 'Soda', 'Water'],
-kids: [{
- name: 'Joshua',
- age:3
- },{
- name: 'Matthew',
- age:2
- },{
- name: 'Solomon',
- age:0
-}]
-};
- </code></pre>
- * </div>
- * </li>
- *
- *
- * <li><b><u>Auto filling of arrays</u></b>
- * <div class="sub-desc">
- * <p>The <b><tt>tpl</tt></b> tag and the <b><tt>for</tt></b> operator are used
- * to process the provided data object:
- * <ul>
- * <li>If the value specified in <tt>for</tt> is an array, it will auto-fill,
- * repeating the template block inside the <tt>tpl</tt> tag for each item in the
- * array.</li>
- * <li>If <tt>for="."</tt> is specified, the data object provided is examined.</li>
- * <li>While processing an array, the special variable <tt>{#}</tt>
- * will provide the current array index + 1 (starts at 1, not 0).</li>
- * </ul>
- * </p>
- * <pre><code>
-&lt;tpl <b>for</b>=".">...&lt;/tpl> // loop through array at root node
-&lt;tpl <b>for</b>="foo">...&lt;/tpl> // loop through array at foo node
-&lt;tpl <b>for</b>="foo.bar">...&lt;/tpl> // loop through array at foo.bar node
- </code></pre>
- * Using the sample data above:
- * <pre><code>
-var tpl = new Ext.XTemplate(
- '&lt;p>Kids: ',
- '&lt;tpl <b>for</b>=".">', // process the data.kids node
- '&lt;p>{#}. {name}&lt;/p>', // use current array index to autonumber
- '&lt;/tpl>&lt;/p>'
-);
-tpl.overwrite(panel.body, data.kids); // pass the kids property of the data object
- </code></pre>
- * <p>An example illustrating how the <b><tt>for</tt></b> property can be leveraged
- * to access specified members of the provided data object to populate the template:</p>
- * <pre><code>
-var tpl = new Ext.XTemplate(
- '&lt;p>Name: {name}&lt;/p>',
- '&lt;p>Title: {title}&lt;/p>',
- '&lt;p>Company: {company}&lt;/p>',
- '&lt;p>Kids: ',
- '&lt;tpl <b>for="kids"</b>>', // interrogate the kids property within the data
- '&lt;p>{name}&lt;/p>',
- '&lt;/tpl>&lt;/p>'
-);
-tpl.overwrite(panel.body, data); // pass the root node of the data object
- </code></pre>
- * <p>Flat arrays that contain values (and not objects) can be auto-rendered
- * using the special <b><tt>{.}</tt></b> variable inside a loop. This variable
- * will represent the value of the array at the current index:</p>
- * <pre><code>
-var tpl = new Ext.XTemplate(
- '&lt;p>{name}\&#39;s favorite beverages:&lt;/p>',
- '&lt;tpl for="drinks">',
- '&lt;div> - {.}&lt;/div>',
- '&lt;/tpl>'
-);
-tpl.overwrite(panel.body, data);
- </code></pre>
- * <p>When processing a sub-template, for example while looping through a child array,
- * you can access the parent object's members via the <b><tt>parent</tt></b> object:</p>
- * <pre><code>
-var tpl = new Ext.XTemplate(
- '&lt;p>Name: {name}&lt;/p>',
- '&lt;p>Kids: ',
- '&lt;tpl for="kids">',
- '&lt;tpl if="age &amp;gt; 1">',
- '&lt;p>{name}&lt;/p>',
- '&lt;p>Dad: {<b>parent</b>.name}&lt;/p>',
- '&lt;/tpl>',
- '&lt;/tpl>&lt;/p>'
-);
-tpl.overwrite(panel.body, data);
- </code></pre>
- * </div>
- * </li>
- *
- *
- * <li><b><u>Conditional processing with basic comparison operators</u></b>
- * <div class="sub-desc">
- * <p>The <b><tt>tpl</tt></b> tag and the <b><tt>if</tt></b> operator are used
- * to provide conditional checks for deciding whether or not to render specific
- * parts of the template. Notes:<div class="sub-desc"><ul>
- * <li>Double quotes must be encoded if used within the conditional</li>
- * <li>There is no <tt>else</tt> operator &mdash; if needed, two opposite
- * <tt>if</tt> statements should be used.</li>
- * </ul></div>
- * <pre><code>
-&lt;tpl if="age &gt; 1 &amp;&amp; age &lt; 10">Child&lt;/tpl>
-&lt;tpl if="age >= 10 && age < 18">Teenager&lt;/tpl>
-&lt;tpl <b>if</b>="this.isGirl(name)">...&lt;/tpl>
-&lt;tpl <b>if</b>="id==\'download\'">...&lt;/tpl>
-&lt;tpl <b>if</b>="needsIcon">&lt;img src="{icon}" class="{iconCls}"/>&lt;/tpl>
-// no good:
-&lt;tpl if="name == "Tommy"">Hello&lt;/tpl>
-// encode &#34; if it is part of the condition, e.g.
-&lt;tpl if="name == &#38;quot;Tommy&#38;quot;">Hello&lt;/tpl>
- * </code></pre>
- * Using the sample data above:
- * <pre><code>
-var tpl = new Ext.XTemplate(
- '&lt;p>Name: {name}&lt;/p>',
- '&lt;p>Kids: ',
- '&lt;tpl for="kids">',
- '&lt;tpl if="age &amp;gt; 1">',
- '&lt;p>{name}&lt;/p>',
- '&lt;/tpl>',
- '&lt;/tpl>&lt;/p>'
-);
-tpl.overwrite(panel.body, data);
- </code></pre>
- * </div>
- * </li>
- *
- *
- * <li><b><u>Basic math support</u></b>
- * <div class="sub-desc">
- * <p>The following basic math operators may be applied directly on numeric
- * data values:</p><pre>
- * + - * /
- * </pre>
- * For example:
- * <pre><code>
-var tpl = new Ext.XTemplate(
- '&lt;p>Name: {name}&lt;/p>',
- '&lt;p>Kids: ',
- '&lt;tpl for="kids">',
- '&lt;tpl if="age &amp;gt; 1">', // <-- Note that the &gt; is encoded
- '&lt;p>{#}: {name}&lt;/p>', // <-- Auto-number each item
- '&lt;p>In 5 Years: {age+5}&lt;/p>', // <-- Basic math
- '&lt;p>Dad: {parent.name}&lt;/p>',
- '&lt;/tpl>',
- '&lt;/tpl>&lt;/p>'
-);
-tpl.overwrite(panel.body, data);
- </code></pre>
- * </div>
- * </li>
- *
- *
- * <li><b><u>Execute arbitrary inline code with special built-in template variables</u></b>
- * <div class="sub-desc">
- * <p>Anything between <code>{[ ... ]}</code> is considered code to be executed
- * in the scope of the template. There are some special variables available in that code:
- * <ul>
- * <li><b><tt>values</tt></b>: The values in the current scope. If you are using
- * scope changing sub-templates, you can change what <tt>values</tt> is.</li>
- * <li><b><tt>parent</tt></b>: The scope (values) of the ancestor template.</li>
- * <li><b><tt>xindex</tt></b>: If you are in a looping template, the index of the
- * loop you are in (1-based).</li>
- * <li><b><tt>xcount</tt></b>: If you are in a looping template, the total length
- * of the array you are looping.</li>
- * </ul>
- * This example demonstrates basic row striping using an inline code block and the
- * <tt>xindex</tt> variable:</p>
- * <pre><code>
-var tpl = new Ext.XTemplate(
- '&lt;p>Name: {name}&lt;/p>',
- '&lt;p>Company: {[values.company.toUpperCase() + ", " + values.title]}&lt;/p>',
- '&lt;p>Kids: ',
- '&lt;tpl for="kids">',
- '&lt;div class="{[xindex % 2 === 0 ? "even" : "odd"]}">',
- '{name}',
- '&lt;/div>',
- '&lt;/tpl>&lt;/p>'
- );
-tpl.overwrite(panel.body, data);
- </code></pre>
- * </div>
- * </li>
- *
- * <li><b><u>Template member functions</u></b>
- * <div class="sub-desc">
- * <p>One or more member functions can be specified in a configuration
- * object passed into the XTemplate constructor for more complex processing:</p>
- * <pre><code>
-var tpl = new Ext.XTemplate(
- '&lt;p>Name: {name}&lt;/p>',
- '&lt;p>Kids: ',
- '&lt;tpl for="kids">',
- '&lt;tpl if="this.isGirl(name)">',
- '&lt;p>Girl: {name} - {age}&lt;/p>',
- '&lt;/tpl>',
- // use opposite if statement to simulate 'else' processing:
- '&lt;tpl if="this.isGirl(name) == false">',
- '&lt;p>Boy: {name} - {age}&lt;/p>',
- '&lt;/tpl>',
- '&lt;tpl if="this.isBaby(age)">',
- '&lt;p>{name} is a baby!&lt;/p>',
- '&lt;/tpl>',
- '&lt;/tpl>&lt;/p>',
- {
- // XTemplate configuration:
- compiled: true,
- // member functions:
- isGirl: function(name){
- return name == 'Sara Grace';
- },
- isBaby: function(age){
- return age < 1;
- }
- }
-);
-tpl.overwrite(panel.body, data);
- </code></pre>
- * </div>
- * </li>
- *
- * </ul></div>
- *
- * @param {Mixed} config
- */
-
-Ext.define('Ext.XTemplate', {
-
- /* Begin Definitions */
-
- extend: 'Ext.Template',
-
- statics: {
- /**
- * Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.
- * @param {String/HTMLElement} el A DOM element or its id
- * @return {Ext.Template} The created template
- * @static
- */
- from: function(el, config) {
- el = Ext.getDom(el);
- return new this(el.value || el.innerHTML, config || {});
- }
- },
-
-
-
- argsRe: /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/,
- nameRe: /^<tpl\b[^>]*?for="(.*?)"/,
- ifRe: /^<tpl\b[^>]*?if="(.*?)"/,
- execRe: /^<tpl\b[^>]*?exec="(.*?)"/,
- constructor: function() {
- this.callParent(arguments);
-
- var me = this,
- html = me.html,
- argsRe = me.argsRe,
- nameRe = me.nameRe,
- ifRe = me.ifRe,
- execRe = me.execRe,
- id = 0,
- tpls = [],
- VALUES = 'values',
- PARENT = 'parent',
- XINDEX = 'xindex',
- XCOUNT = 'xcount',
- RETURN = 'return ',
- WITHVALUES = 'with(values){ ',
- m, matchName, matchIf, matchExec, exp, fn, exec, name, i;
-
- html = ['<tpl>', html, '</tpl>'].join('');
-
- while ((m = html.match(argsRe))) {
- exp = null;
- fn = null;
- exec = null;
- matchName = m[0].match(nameRe);
- matchIf = m[0].match(ifRe);
- matchExec = m[0].match(execRe);
-
- exp = matchIf ? matchIf[1] : null;
- if (exp) {
- fn = Ext.functionFactory(VALUES, PARENT, XINDEX, XCOUNT, WITHVALUES + 'try{' + RETURN + Ext.String.htmlDecode(exp) + ';}catch(e){return;}}');
- }
-
- exp = matchExec ? matchExec[1] : null;
- if (exp) {
- exec = Ext.functionFactory(VALUES, PARENT, XINDEX, XCOUNT, WITHVALUES + Ext.String.htmlDecode(exp) + ';}');
- }
-
- name = matchName ? matchName[1] : null;
- if (name) {
- if (name === '.') {
- name = VALUES;
- } else if (name === '..') {
- name = PARENT;
- }
- name = Ext.functionFactory(VALUES, PARENT, 'try{' + WITHVALUES + RETURN + name + ';}}catch(e){return;}');
- }
-
- tpls.push({
- id: id,
- target: name,
- exec: exec,
- test: fn,
- body: m[1] || ''
- });
-
- html = html.replace(m[0], '{xtpl' + id + '}');
- id = id + 1;
- }
-
- for (i = tpls.length - 1; i >= 0; --i) {
- me.compileTpl(tpls[i]);
- }
- me.master = tpls[tpls.length - 1];
- me.tpls = tpls;
- },
-
-
- applySubTemplate: function(id, values, parent, xindex, xcount) {
- var me = this, t = me.tpls[id];
- return t.compiled.call(me, values, parent, xindex, xcount);
- },
-
- codeRe: /\{\[((?:\\\]|.|\n)*?)\]\}/g,
-
- re: /\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\/]\s?[\d\.\+\-\*\/\(\)]+)?\}/g,
-
-
- compileTpl: function(tpl) {
- var fm = Ext.util.Format,
- me = this,
- useFormat = me.disableFormats !== true,
- body, bodyReturn, evaluatedFn;
-
- function fn(m, name, format, args, math) {
- var v;
-
-
- if (name.substr(0, 4) == 'xtpl') {
- return "',this.applySubTemplate(" + name.substr(4) + ", values, parent, xindex, xcount),'";
- }
-
- if (name == '.') {
-
- v = 'Ext.Array.indexOf(["string", "number", "boolean"], typeof values) > -1 || Ext.isDate(values) ? values : ""';
- }
-
-
- else if (name == '#') {
- v = 'xindex';
- }
- else if (name.substr(0, 7) == "parent.") {
- v = name;
- }
-
- else if (name.indexOf('.') != -1) {
- v = "values." + name;
- }
-
-
- else {
- v = "values['" + name + "']";
- }
- if (math) {
- v = '(' + v + math + ')';
- }
- if (format && useFormat) {
- args = args ? ',' + args : "";
- if (format.substr(0, 5) != "this.") {
- format = "fm." + format + '(';
- }
- else {
- format = 'this.' + format.substr(5) + '(';
- }
- }
- else {
- args = '';
- format = "(" + v + " === undefined ? '' : ";
- }
- return "'," + format + v + args + "),'";
- }
-
- function codeFn(m, code) {
-
- return "',(" + code.replace(me.compileARe, "'") + "),'";
- }
-
- bodyReturn = tpl.body.replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn).replace(me.codeRe, codeFn);
- body = "evaluatedFn = function(values, parent, xindex, xcount){return ['" + bodyReturn + "'].join('');};";
- eval(body);
-
- tpl.compiled = function(values, parent, xindex, xcount) {
- var vs,
- length,
- buffer,
- i;
-
- if (tpl.test && !tpl.test.call(me, values, parent, xindex, xcount)) {
- return '';
- }
-
- vs = tpl.target ? tpl.target.call(me, values, parent) : values;
- if (!vs) {
- return '';
- }
-
- parent = tpl.target ? values : parent;
- if (tpl.target && Ext.isArray(vs)) {
- buffer = [];
- length = vs.length;
- if (tpl.exec) {
- for (i = 0; i < length; i++) {
- buffer[buffer.length] = evaluatedFn.call(me, vs[i], parent, i + 1, length);
- tpl.exec.call(me, vs[i], parent, i + 1, length);
- }
- } else {
- for (i = 0; i < length; i++) {
- buffer[buffer.length] = evaluatedFn.call(me, vs[i], parent, i + 1, length);
- }
- }
- return buffer.join('');
- }
-
- if (tpl.exec) {
- tpl.exec.call(me, vs, parent, xindex, xcount);
- }
- return evaluatedFn.call(me, vs, parent, xindex, xcount);
- };
-
- return this;
- },
-
-
- applyTemplate: function(values) {
- return this.master.compiled.call(this, values, {}, 1, 1);
- },
-
-
- compile: function() {
- return this;
- }
-}, function() {
-
- this.createAlias('apply', 'applyTemplate');
-});
-
-
-Ext.define('Ext.util.AbstractMixedCollection', {
- requires: ['Ext.util.Filter'],
-
- mixins: {
- observable: 'Ext.util.Observable'
- },
-
- constructor: function(allowFunctions, keyFn) {
- var me = this;
-
- me.items = [];
- me.map = {};
- me.keys = [];
- me.length = 0;
-
- me.addEvents(
-
- 'clear',
-
-
- 'add',
-
-
- 'replace',
-
-
- 'remove'
- );
-
- me.allowFunctions = allowFunctions === true;
-
- if (keyFn) {
- me.getKey = keyFn;
- }
-
- me.mixins.observable.constructor.call(me);
- },
-
-
- allowFunctions : false,
-
-
- add : function(key, obj){
- var me = this,
- myObj = obj,
- myKey = key,
- old;
-
- if (arguments.length == 1) {
- myObj = myKey;
- myKey = me.getKey(myObj);
- }
- if (typeof myKey != 'undefined' && myKey !== null) {
- old = me.map[myKey];
- if (typeof old != 'undefined') {
- return me.replace(myKey, myObj);
- }
- me.map[myKey] = myObj;
- }
- me.length++;
- me.items.push(myObj);
- me.keys.push(myKey);
- me.fireEvent('add', me.length - 1, myObj, myKey);
- return myObj;
- },
-
-
- getKey : function(o){
- return o.id;
- },
-
-
- replace : function(key, o){
- var me = this,
- old,
- index;
-
- if (arguments.length == 1) {
- o = arguments[0];
- key = me.getKey(o);
- }
- old = me.map[key];
- if (typeof key == 'undefined' || key === null || typeof old == 'undefined') {
- return me.add(key, o);
- }
- index = me.indexOfKey(key);
- me.items[index] = o;
- me.map[key] = o;
- me.fireEvent('replace', key, old, o);
- return o;
- },
-
-
- addAll : function(objs){
- var me = this,
- i = 0,
- args,
- len,
- key;
-
- if (arguments.length > 1 || Ext.isArray(objs)) {
- args = arguments.length > 1 ? arguments : objs;
- for (len = args.length; i < len; i++) {
- me.add(args[i]);
- }
- } else {
- for (key in objs) {
- if (objs.hasOwnProperty(key)) {
- if (me.allowFunctions || typeof objs[key] != 'function') {
- me.add(key, objs[key]);
- }
- }
- }
- }
- },
-
-
- each : function(fn, scope){
- var items = [].concat(this.items),
- i = 0,
- len = items.length,
- item;
-
- for (; i < len; i++) {
- item = items[i];
- if (fn.call(scope || item, item, i, len) === false) {
- break;
- }
- }
- },
-
-
- eachKey : function(fn, scope){
- var keys = this.keys,
- items = this.items,
- i = 0,
- len = keys.length;
-
- for (; i < len; i++) {
- fn.call(scope || window, keys[i], items[i], i, len);
- }
- },
-
-
- findBy : function(fn, scope) {
- var keys = this.keys,
- items = this.items,
- i = 0,
- len = items.length;
-
- for (; i < len; i++) {
- if (fn.call(scope || window, items[i], keys[i])) {
- return items[i];
- }
- }
- return null;
- },
-
- find : function() {
- if (Ext.isDefined(Ext.global.console)) {
- Ext.global.console.warn('Ext.util.MixedCollection: find has been deprecated. Use findBy instead.');
- }
- return this.findBy.apply(this, arguments);
- },
-
-
- insert : function(index, key, obj){
- var me = this,
- myKey = key,
- myObj = obj;
-
- if (arguments.length == 2) {
- myObj = myKey;
- myKey = me.getKey(myObj);
- }
- if (me.containsKey(myKey)) {
- me.suspendEvents();
- me.removeAtKey(myKey);
- me.resumeEvents();
- }
- if (index >= me.length) {
- return me.add(myKey, myObj);
- }
- me.length++;
- Ext.Array.splice(me.items, index, 0, myObj);
- if (typeof myKey != 'undefined' && myKey !== null) {
- me.map[myKey] = myObj;
- }
- Ext.Array.splice(me.keys, index, 0, myKey);
- me.fireEvent('add', index, myObj, myKey);
- return myObj;
- },
-
-
- remove : function(o){
- return this.removeAt(this.indexOf(o));
- },
-
-
- removeAll : function(items){
- Ext.each(items || [], function(item) {
- this.remove(item);
- }, this);
-
- return this;
- },
-
-
- removeAt : function(index){
- var me = this,
- o,
- key;
-
- if (index < me.length && index >= 0) {
- me.length--;
- o = me.items[index];
- Ext.Array.erase(me.items, index, 1);
- key = me.keys[index];
- if (typeof key != 'undefined') {
- delete me.map[key];
- }
- Ext.Array.erase(me.keys, index, 1);
- me.fireEvent('remove', o, key);
- return o;
- }
- return false;
- },
-
-
- removeAtKey : function(key){
- return this.removeAt(this.indexOfKey(key));
- },
-
-
- getCount : function(){
- return this.length;
- },
-
-
- indexOf : function(o){
- return Ext.Array.indexOf(this.items, o);
- },
-
-
- indexOfKey : function(key){
- return Ext.Array.indexOf(this.keys, key);
- },
-
-
- get : function(key) {
- var me = this,
- mk = me.map[key],
- item = mk !== undefined ? mk : (typeof key == 'number') ? me.items[key] : undefined;
- return typeof item != 'function' || me.allowFunctions ? item : null;
- },
-
-
- getAt : function(index) {
- return this.items[index];
- },
-
-
- getByKey : function(key) {
- return this.map[key];
- },
-
-
- contains : function(o){
- return Ext.Array.contains(this.items, o);
- },
-
-
- containsKey : function(key){
- return typeof this.map[key] != 'undefined';
- },
-
-
- clear : function(){
- var me = this;
-
- me.length = 0;
- me.items = [];
- me.keys = [];
- me.map = {};
- me.fireEvent('clear');
- },
-
-
- first : function() {
- return this.items[0];
- },
-
-
- last : function() {
- return this.items[this.length - 1];
- },
-
-
- sum: function(property, root, start, end) {
- var values = this.extractValues(property, root),
- length = values.length,
- sum = 0,
- i;
-
- start = start || 0;
- end = (end || end === 0) ? end : length - 1;
-
- for (i = start; i <= end; i++) {
- sum += values[i];
- }
-
- return sum;
- },
-
-
- collect: function(property, root, allowNull) {
- var values = this.extractValues(property, root),
- length = values.length,
- hits = {},
- unique = [],
- value, strValue, i;
-
- for (i = 0; i < length; i++) {
- value = values[i];
- strValue = String(value);
-
- if ((allowNull || !Ext.isEmpty(value)) && !hits[strValue]) {
- hits[strValue] = true;
- unique.push(value);
- }
- }
-
- return unique;
- },
-
-
- extractValues: function(property, root) {
- var values = this.items;
-
- if (root) {
- values = Ext.Array.pluck(values, root);
- }
-
- return Ext.Array.pluck(values, property);
- },
-
-
- getRange : function(start, end){
- var me = this,
- items = me.items,
- range = [],
- i;
-
- if (items.length < 1) {
- return range;
- }
-
- start = start || 0;
- end = Math.min(typeof end == 'undefined' ? me.length - 1 : end, me.length - 1);
- if (start <= end) {
- for (i = start; i <= end; i++) {
- range[range.length] = items[i];
- }
- } else {
- for (i = start; i >= end; i--) {
- range[range.length] = items[i];
- }
- }
- return range;
- },
-
-
- filter : function(property, value, anyMatch, caseSensitive) {
- var filters = [],
- filterFn;
-
-
- if (Ext.isString(property)) {
- filters.push(Ext.create('Ext.util.Filter', {
- property : property,
- value : value,
- anyMatch : anyMatch,
- caseSensitive: caseSensitive
- }));
- } else if (Ext.isArray(property) || property instanceof Ext.util.Filter) {
- filters = filters.concat(property);
- }
-
-
-
- filterFn = function(record) {
- var isMatch = true,
- length = filters.length,
- i;
-
- for (i = 0; i < length; i++) {
- var filter = filters[i],
- fn = filter.filterFn,
- scope = filter.scope;
-
- isMatch = isMatch && fn.call(scope, record);
- }
-
- return isMatch;
- };
-
- return this.filterBy(filterFn);
- },
-
-
- filterBy : function(fn, scope) {
- var me = this,
- newMC = new this.self(),
- keys = me.keys,
- items = me.items,
- length = items.length,
- i;
-
- newMC.getKey = me.getKey;
-
- for (i = 0; i < length; i++) {
- if (fn.call(scope || me, items[i], keys[i])) {
- newMC.add(keys[i], items[i]);
- }
- }
-
- return newMC;
- },
-
-
- findIndex : function(property, value, start, anyMatch, caseSensitive){
- if(Ext.isEmpty(value, false)){
- return -1;
- }
- value = this.createValueMatcher(value, anyMatch, caseSensitive);
- return this.findIndexBy(function(o){
- return o && value.test(o[property]);
- }, null, start);
- },
-
-
- findIndexBy : function(fn, scope, start){
- var me = this,
- keys = me.keys,
- items = me.items,
- i = start || 0,
- len = items.length;
-
- for (; i < len; i++) {
- if (fn.call(scope || me, items[i], keys[i])) {
- return i;
- }
- }
- return -1;
- },
-
-
- createValueMatcher : function(value, anyMatch, caseSensitive, exactMatch) {
- if (!value.exec) {
- var er = Ext.String.escapeRegex;
- value = String(value);
-
- if (anyMatch === true) {
- value = er(value);
- } else {
- value = '^' + er(value);
- if (exactMatch === true) {
- value += '$';
- }
- }
- value = new RegExp(value, caseSensitive ? '' : 'i');
- }
- return value;
- },
-
-
- clone : function() {
- var me = this,
- copy = new this.self(),
- keys = me.keys,
- items = me.items,
- i = 0,
- len = items.length;
-
- for(; i < len; i++){
- copy.add(keys[i], items[i]);
- }
- copy.getKey = me.getKey;
- return copy;
- }
-});
+Ext.define('Ext.AbstractComponent', {
-Ext.define("Ext.util.Sortable", {
-
- isSortable: true,
-
-
- defaultSortDirection: "ASC",
requires: [
- 'Ext.util.Sorter'
+ 'Ext.ComponentQuery',
+ 'Ext.ComponentManager'
],
-
-
-
- initSortable: function() {
- var me = this,
- sorters = me.sorters;
-
-
- me.sorters = Ext.create('Ext.util.AbstractMixedCollection', false, function(item) {
- return item.id || item.property;
- });
-
- if (sorters) {
- me.sorters.addAll(me.decodeSorters(sorters));
- }
- },
-
-
- sort: function(sorters, direction, where, doSort) {
- var me = this,
- sorter, sorterFn,
- newSorters;
-
- if (Ext.isArray(sorters)) {
- doSort = where;
- where = direction;
- newSorters = sorters;
- }
- else if (Ext.isObject(sorters)) {
- doSort = where;
- where = direction;
- newSorters = [sorters];
- }
- else if (Ext.isString(sorters)) {
- sorter = me.sorters.get(sorters);
-
- if (!sorter) {
- sorter = {
- property : sorters,
- direction: direction
- };
- newSorters = [sorter];
- }
- else if (direction === undefined) {
- sorter.toggle();
- }
- else {
- sorter.setDirection(direction);
- }
- }
-
- if (newSorters && newSorters.length) {
- newSorters = me.decodeSorters(newSorters);
- if (Ext.isString(where)) {
- if (where === 'prepend') {
- sorters = me.sorters.clone().items;
-
- me.sorters.clear();
- me.sorters.addAll(newSorters);
- me.sorters.addAll(sorters);
- }
- else {
- me.sorters.addAll(newSorters);
- }
- }
- else {
- me.sorters.clear();
- me.sorters.addAll(newSorters);
- }
-
- if (doSort !== false) {
- me.onBeforeSort(newSorters);
- }
- }
-
- if (doSort !== false) {
- sorters = me.sorters.items;
- if (sorters.length) {
-
- sorterFn = function(r1, r2) {
- var result = sorters[0].sort(r1, r2),
- length = sorters.length,
- i;
-
-
- for (i = 1; i < length; i++) {
- result = result || sorters[i].sort.call(this, r1, r2);
- }
-
- return result;
- };
-
- me.doSort(sorterFn);
- }
- }
-
- return sorters;
- },
-
- onBeforeSort: Ext.emptyFn,
-
-
- decodeSorters: function(sorters) {
- if (!Ext.isArray(sorters)) {
- if (sorters === undefined) {
- sorters = [];
- } else {
- sorters = [sorters];
- }
- }
-
- var length = sorters.length,
- Sorter = Ext.util.Sorter,
- fields = this.model ? this.model.prototype.fields : null,
- field,
- config, i;
-
- for (i = 0; i < length; i++) {
- config = sorters[i];
-
- if (!(config instanceof Sorter)) {
- if (Ext.isString(config)) {
- config = {
- property: config
- };
- }
-
- Ext.applyIf(config, {
- root : this.sortRoot,
- direction: "ASC"
- });
-
-
- if (config.fn) {
- config.sorterFn = config.fn;
- }
-
-
- if (typeof config == 'function') {
- config = {
- sorterFn: config
- };
- }
-
-
- if (fields && !config.transform) {
- field = fields.get(config.property);
- config.transform = field ? field.sortType : undefined;
- }
- sorters[i] = Ext.create('Ext.util.Sorter', config);
- }
- }
-
- return sorters;
- },
-
- getSorters: function() {
- return this.sorters.items;
- }
-});
-
-Ext.define('Ext.util.MixedCollection', {
- extend: 'Ext.util.AbstractMixedCollection',
- mixins: {
- sortable: 'Ext.util.Sortable'
- },
-
-
- constructor: function() {
- var me = this;
- me.callParent(arguments);
- me.addEvents('sort');
- me.mixins.sortable.initSortable.call(me);
- },
-
- doSort: function(sorterFn) {
- this.sortBy(sorterFn);
- },
-
-
- _sort : function(property, dir, fn){
- var me = this,
- i, len,
- dsc = String(dir).toUpperCase() == 'DESC' ? -1 : 1,
-
-
- c = [],
- keys = me.keys,
- items = me.items;
-
-
- fn = fn || function(a, b) {
- return a - b;
- };
-
-
- for(i = 0, len = items.length; i < len; i++){
- c[c.length] = {
- key : keys[i],
- value: items[i],
- index: i
- };
- }
-
-
- Ext.Array.sort(c, function(a, b){
- var v = fn(a[property], b[property]) * dsc;
- if(v === 0){
- v = (a.index < b.index ? -1 : 1);
- }
- return v;
- });
-
-
- for(i = 0, len = c.length; i < len; i++){
- items[i] = c[i].value;
- keys[i] = c[i].key;
- }
-
- me.fireEvent('sort', me);
- },
-
-
- sortBy: function(sorterFn) {
- var me = this,
- items = me.items,
- keys = me.keys,
- length = items.length,
- temp = [],
- i;
-
-
- for (i = 0; i < length; i++) {
- temp[i] = {
- key : keys[i],
- value: items[i],
- index: i
- };
- }
-
- Ext.Array.sort(temp, function(a, b) {
- var v = sorterFn(a.value, b.value);
- if (v === 0) {
- v = (a.index < b.index ? -1 : 1);
- }
-
- return v;
- });
-
-
- for (i = 0; i < length; i++) {
- items[i] = temp[i].value;
- keys[i] = temp[i].key;
- }
-
- me.fireEvent('sort', me, items, keys);
- },
-
-
- reorder: function(mapping) {
- var me = this,
- items = me.items,
- index = 0,
- length = items.length,
- order = [],
- remaining = [],
- oldIndex;
-
- me.suspendEvents();
-
-
- for (oldIndex in mapping) {
- order[mapping[oldIndex]] = items[oldIndex];
- }
-
- for (index = 0; index < length; index++) {
- if (mapping[index] == undefined) {
- remaining.push(items[index]);
- }
- }
-
- for (index = 0; index < length; index++) {
- if (order[index] == undefined) {
- order[index] = remaining.shift();
- }
- }
-
- me.clear();
- me.addAll(order);
-
- me.resumeEvents();
- me.fireEvent('sort', me);
- },
-
-
- sortByKey : function(dir, fn){
- this._sort('key', dir, fn || function(a, b){
- var v1 = String(a).toUpperCase(), v2 = String(b).toUpperCase();
- return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
- });
- }
-});
-
-
-Ext.define('Ext.data.StoreManager', {
- extend: 'Ext.util.MixedCollection',
- alternateClassName: ['Ext.StoreMgr', 'Ext.data.StoreMgr', 'Ext.StoreManager'],
- singleton: true,
- uses: ['Ext.data.ArrayStore'],
-
-
-
-
- register : function() {
- for (var i = 0, s; (s = arguments[i]); i++) {
- this.add(s);
- }
- },
-
-
- unregister : function() {
- for (var i = 0, s; (s = arguments[i]); i++) {
- this.remove(this.lookup(s));
- }
- },
-
-
- lookup : function(store) {
-
- if (Ext.isArray(store)) {
- var fields = ['field1'],
- expand = !Ext.isArray(store[0]),
- data = store,
- i,
- len;
-
- if(expand){
- data = [];
- for (i = 0, len = store.length; i < len; ++i) {
- data.push([store[i]]);
- }
- } else {
- for(i = 2, len = store[0].length; i <= len; ++i){
- fields.push('field' + i);
- }
- }
- return Ext.create('Ext.data.ArrayStore', {
- data : data,
- fields: fields,
- autoDestroy: true,
- autoCreated: true,
- expanded: expand
- });
- }
-
- if (Ext.isString(store)) {
-
- return this.get(store);
- } else {
-
- return Ext.data.AbstractStore.create(store);
- }
- },
-
-
- getKey : function(o) {
- return o.storeId;
- }
-}, function() {
-
- Ext.regStore = function(name, config) {
- var store;
-
- if (Ext.isObject(name)) {
- config = name;
- } else {
- config.storeId = name;
- }
-
- if (config instanceof Ext.data.Store) {
- store = config;
- } else {
- store = Ext.create('Ext.data.Store', config);
- }
-
- return Ext.data.StoreManager.register(store);
- };
-
-
- Ext.getStore = function(name) {
- return Ext.data.StoreManager.lookup(name);
- };
-});
-
-
-
-Ext.define('Ext.LoadMask', {
-
-
-
- mixins: {
- observable: 'Ext.util.Observable'
- },
-
- requires: ['Ext.data.StoreManager'],
-
-
-
-
-
-
- msg : 'Loading...',
-
- msgCls : Ext.baseCSSPrefix + 'mask-loading',
-
-
- useMsg: true,
-
-
- disabled: false,
-
-
- constructor : function(el, config) {
- var me = this;
-
- if (el.isComponent) {
- me.bindComponent(el);
- } else {
- me.el = Ext.get(el);
- }
- Ext.apply(me, config);
-
- me.addEvents('beforeshow', 'show', 'hide');
- if (me.store) {
- me.bindStore(me.store, true);
- }
- me.mixins.observable.constructor.call(me, config);
- },
-
- bindComponent: function(comp) {
- var me = this,
- listeners = {
- resize: me.onComponentResize,
- scope: me
- };
-
- if (comp.el) {
- me.onComponentRender(comp);
- } else {
- listeners.render = {
- fn: me.onComponentRender,
- scope: me,
- single: true
- };
- }
- me.mon(comp, listeners);
- },
-
-
- onComponentRender: function(comp) {
- this.el = comp.getContentTarget();
- },
-
-
- onComponentResize: function(comp, w, h) {
- this.el.isMasked();
- },
-
-
- bindStore : function(store, initial) {
- var me = this;
-
- if (!initial && me.store) {
- me.mun(me.store, {
- scope: me,
- beforeload: me.onBeforeLoad,
- load: me.onLoad,
- exception: me.onLoad
- });
- if(!store) {
- me.store = null;
- }
- }
- if (store) {
- store = Ext.data.StoreManager.lookup(store);
- me.mon(store, {
- scope: me,
- beforeload: me.onBeforeLoad,
- load: me.onLoad,
- exception: me.onLoad
- });
-
- }
- me.store = store;
- if (store && store.isLoading()) {
- me.onBeforeLoad();
- }
- },
-
-
- disable : function() {
- var me = this;
-
- me.disabled = true;
- if (me.loading) {
- me.onLoad();
- }
- },
-
-
- enable : function() {
- this.disabled = false;
- },
-
-
- isDisabled : function() {
- return this.disabled;
- },
-
-
- onLoad : function() {
- var me = this;
-
- me.loading = false;
- me.el.unmask();
- me.fireEvent('hide', me, me.el, me.store);
- },
-
-
- onBeforeLoad : function() {
- var me = this;
-
- if (!me.disabled && !me.loading && me.fireEvent('beforeshow', me, me.el, me.store) !== false) {
- if (me.useMsg) {
- me.el.mask(me.msg, me.msgCls, false);
- } else {
- me.el.mask();
- }
-
- me.fireEvent('show', me, me.el, me.store);
- me.loading = true;
- }
- },
-
-
- show: function() {
- this.onBeforeLoad();
- },
-
-
- hide: function() {
- this.onLoad();
- },
-
-
- destroy : function() {
- this.hide();
- this.clearListeners();
- }
-});
-
-
-Ext.define('Ext.ComponentLoader', {
-
-
-
- extend: 'Ext.ElementLoader',
-
- statics: {
- Renderer: {
- Data: function(loader, response, active){
- var success = true;
- try {
- loader.getTarget().update(Ext.decode(response.responseText));
- } catch (e) {
- success = false;
- }
- return success;
- },
-
- Component: function(loader, response, active){
- var success = true,
- target = loader.getTarget(),
- items = [];
-
-
- try {
- items = Ext.decode(response.responseText);
- } catch (e) {
- success = false;
- }
-
- if (success) {
- if (active.removeAll) {
- target.removeAll();
- }
- target.add(items);
- }
- return success;
- }
- }
- },
-
-
-
-
- target: null,
-
-
- loadMask: false,
-
-
-
-
- renderer: 'html',
-
-
- setTarget: function(target){
- var me = this;
-
- if (Ext.isString(target)) {
- target = Ext.getCmp(target);
- }
-
- if (me.target && me.target != target) {
- me.abort();
- }
- me.target = target;
- },
-
-
- removeMask: function(){
- this.target.setLoading(false);
- },
-
-
- addMask: function(mask){
- this.target.setLoading(mask);
- },
-
-
-
- setOptions: function(active, options){
- active.removeAll = Ext.isDefined(options.removeAll) ? options.removeAll : this.removeAll;
- },
-
-
- getRenderer: function(renderer){
- if (Ext.isFunction(renderer)) {
- return renderer;
- }
-
- var renderers = this.statics().Renderer;
- switch (renderer) {
- case 'component':
- return renderers.Component;
- case 'data':
- return renderers.Data;
- default:
- return Ext.ElementLoader.Renderer.Html;
- }
- }
-});
-
-
-
-Ext.define('Ext.layout.component.Auto', {
-
-
-
- alias: 'layout.autocomponent',
-
- extend: 'Ext.layout.component.Component',
-
-
-
- type: 'autocomponent',
-
- onLayout : function(width, height) {
- this.setTargetSize(width, height);
- }
-});
-
-
-Ext.define('Ext.AbstractComponent', {
-
-
-
mixins: {
observable: 'Ext.util.Observable',
animate: 'Ext.util.Animate',
state: 'Ext.state.Stateful'
},
- requires: [
+
+
+ uses: [
'Ext.PluginManager',
'Ext.ComponentManager',
- 'Ext.core.Element',
- 'Ext.core.DomHelper',
+ 'Ext.Element',
+ 'Ext.DomHelper',
'Ext.XTemplate',
'Ext.ComponentQuery',
- 'Ext.LoadMask',
'Ext.ComponentLoader',
'Ext.EventManager',
'Ext.layout.Layout',
- 'Ext.layout.component.Auto'
- ],
-
-
-
- uses: [
+ 'Ext.layout.component.Auto',
+ 'Ext.LoadMask',
'Ext.ZIndexManager'
],
@@ -18399,9 +15425,9 @@ Ext.define('Ext.AbstractComponent', {
-
+
-
+
@@ -18423,6 +15449,12 @@ Ext.define('Ext.AbstractComponent', {
+
+
+
+
+
+
tplWriteMode: 'overwrite',
@@ -18489,16 +15521,16 @@ Ext.define('Ext.AbstractComponent', {
-
- allowDomMove: true,
-
-
- autoShow: false,
+
+ autoShow: false,
- autoRender: false,
+ autoRender: false,
- needsLayout: false,
+ needsLayout: false,
+
+
+ allowDomMove: true,
@@ -18528,43 +15560,43 @@ Ext.define('Ext.AbstractComponent', {
me.addEvents(
- 'beforeactivate',
+ 'beforeactivate',
- 'activate',
+ 'activate',
- 'beforedeactivate',
+ 'beforedeactivate',
- 'deactivate',
+ 'deactivate',
- 'added',
+ 'added',
- 'disable',
+ 'disable',
- 'enable',
+ 'enable',
- 'beforeshow',
+ 'beforeshow',
- 'show',
+ 'show',
- 'beforehide',
+ 'beforehide',
- 'hide',
+ 'hide',
- 'removed',
+ 'removed',
- 'beforerender',
+ 'beforerender',
- 'render',
+ 'render',
- 'afterrender',
+ 'afterrender',
- 'beforedestroy',
+ 'beforedestroy',
- 'destroy',
+ 'destroy',
- 'resize',
+ 'resize',
- 'move'
+ 'move'
);
me.getId();
@@ -18576,9 +15608,7 @@ Ext.define('Ext.AbstractComponent', {
if (me.plugins) {
me.plugins = [].concat(me.plugins);
- for (i = 0, len = me.plugins.length; i < len; i++) {
- me.plugins[i] = me.constructPlugin(me.plugins[i]);
- }
+ me.constructPlugins();
}
me.initComponent();
@@ -18616,7 +15646,11 @@ Ext.define('Ext.AbstractComponent', {
},
- initComponent: Ext.emptyFn,
+ initComponent: function () {
+
+
+ this.constructPlugins();
+ },
getState: function() {
@@ -18771,6 +15805,20 @@ Ext.define('Ext.AbstractComponent', {
},
+ constructPlugins: function() {
+ var me = this,
+ plugins = me.plugins,
+ i, len;
+
+ if (plugins) {
+ for (i = 0, len = plugins.length; i < len; i++) {
+
+ plugins[i] = me.constructPlugin(plugins[i]);
+ }
+ }
+ },
+
+
initPlugin : function(plugin) {
plugin.init(this);
@@ -18792,6 +15840,11 @@ Ext.define('Ext.AbstractComponent', {
var me = this;
if (!me.rendered && me.fireEvent('beforerender', me) !== false) {
+
+
+
+ me.rendering = true;
+
if (me.el) {
@@ -18809,7 +15862,7 @@ Ext.define('Ext.AbstractComponent', {
- me.el.setVisibilityMode(Ext.core.Element[me.hideMode.toUpperCase()]);
+ me.el.setVisibilityMode(Ext.Element[me.hideMode.toUpperCase()]);
if (me.overCls) {
me.el.hover(me.addOverCls, me.removeOverCls, me);
@@ -18835,6 +15888,9 @@ Ext.define('Ext.AbstractComponent', {
me.disable(true);
}
+
+
+ delete me.rendering;
}
return me;
},
@@ -18850,10 +15906,10 @@ Ext.define('Ext.AbstractComponent', {
if (!el) {
if (position) {
- el = Ext.core.DomHelper.insertBefore(position, me.getElConfig(), true);
+ el = Ext.DomHelper.insertBefore(position, me.getElConfig(), true);
}
else {
- el = Ext.core.DomHelper.append(container, me.getElConfig(), true);
+ el = Ext.DomHelper.append(container, me.getElConfig(), true);
}
}
else if (me.allowDomMove !== false) {
@@ -18917,7 +15973,9 @@ Ext.define('Ext.AbstractComponent', {
me.getComponentLayout();
- if (!me.ownerCt || (me.height || me.width)) {
+
+
+ if (me.collapsed || (!me.ownerCt || (me.height || me.width))) {
me.setSize(me.width, me.height);
} else {
@@ -18950,6 +16008,15 @@ Ext.define('Ext.AbstractComponent', {
}
},
+
+ registerFloatingItem: function(cmp) {
+ var me = this;
+ if (!me.floatingItems) {
+ me.floatingItems = Ext.create('Ext.ZIndexManager', me);
+ }
+ me.floatingItems.register(cmp);
+ },
+
renderChildren: function () {
var me = this,
layout = me.getComponentLayout();
@@ -18961,6 +16028,8 @@ Ext.define('Ext.AbstractComponent', {
frameCls: Ext.baseCSSPrefix + 'frame',
+ frameIdRegex: /[-]frame\d+[TMB][LCR]$/,
+
frameElementCls: {
tl: [],
tc: [],
@@ -18975,21 +16044,21 @@ Ext.define('Ext.AbstractComponent', {
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>',
- '<tpl if="right"><div class="{frameCls}-tr {baseCls}-tr {baseCls}-{ui}-tr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tr</tpl></tpl>" style="background-position: {tr}; padding-right: {frameWidth}px" role="presentation"></tpl>',
- '<div class="{frameCls}-tc {baseCls}-tc {baseCls}-{ui}-tc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tc</tpl></tpl>" style="background-position: {tc}; height: {frameWidth}px" role="presentation"></div>',
+ '<tpl if="left"><div id="{fgid}TL" 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>',
+ '<tpl if="right"><div id="{fgid}TR" class="{frameCls}-tr {baseCls}-tr {baseCls}-{ui}-tr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tr</tpl></tpl>" style="background-position: {tr}; padding-right: {frameWidth}px" role="presentation"></tpl>',
+ '<div id="{fgid}TC" class="{frameCls}-tc {baseCls}-tc {baseCls}-{ui}-tc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tc</tpl></tpl>" style="background-position: {tc}; height: {frameWidth}px" role="presentation"></div>',
'<tpl if="right"></div></tpl>',
'<tpl if="left"></div></tpl>',
'</tpl>',
- '<tpl if="left"><div class="{frameCls}-ml {baseCls}-ml {baseCls}-{ui}-ml<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-ml</tpl></tpl>" style="background-position: {ml}; padding-left: {frameWidth}px" role="presentation"></tpl>',
- '<tpl if="right"><div class="{frameCls}-mr {baseCls}-mr {baseCls}-{ui}-mr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mr</tpl></tpl>" style="background-position: {mr}; padding-right: {frameWidth}px" role="presentation"></tpl>',
- '<div class="{frameCls}-mc {baseCls}-mc {baseCls}-{ui}-mc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mc</tpl></tpl>" role="presentation"></div>',
+ '<tpl if="left"><div id="{fgid}ML" class="{frameCls}-ml {baseCls}-ml {baseCls}-{ui}-ml<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-ml</tpl></tpl>" style="background-position: {ml}; padding-left: {frameWidth}px" role="presentation"></tpl>',
+ '<tpl if="right"><div id="{fgid}MR" class="{frameCls}-mr {baseCls}-mr {baseCls}-{ui}-mr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mr</tpl></tpl>" style="background-position: {mr}; padding-right: {frameWidth}px" role="presentation"></tpl>',
+ '<div id="{fgid}MC" class="{frameCls}-mc {baseCls}-mc {baseCls}-{ui}-mc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mc</tpl></tpl>" role="presentation"></div>',
'<tpl if="right"></div></tpl>',
'<tpl if="left"></div></tpl>',
'<tpl if="bottom">',
- '<tpl if="left"><div class="{frameCls}-bl {baseCls}-bl {baseCls}-{ui}-bl<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bl</tpl></tpl>" style="background-position: {bl}; padding-left: {frameWidth}px" role="presentation"></tpl>',
- '<tpl if="right"><div class="{frameCls}-br {baseCls}-br {baseCls}-{ui}-br<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-br</tpl></tpl>" style="background-position: {br}; padding-right: {frameWidth}px" role="presentation"></tpl>',
- '<div class="{frameCls}-bc {baseCls}-bc {baseCls}-{ui}-bc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bc</tpl></tpl>" style="background-position: {bc}; height: {frameWidth}px" role="presentation"></div>',
+ '<tpl if="left"><div id="{fgid}BL" class="{frameCls}-bl {baseCls}-bl {baseCls}-{ui}-bl<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bl</tpl></tpl>" style="background-position: {bl}; padding-left: {frameWidth}px" role="presentation"></tpl>',
+ '<tpl if="right"><div id="{fgid}BR" class="{frameCls}-br {baseCls}-br {baseCls}-{ui}-br<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-br</tpl></tpl>" style="background-position: {br}; padding-right: {frameWidth}px" role="presentation"></tpl>',
+ '<div id="{fgid}BC" class="{frameCls}-bc {baseCls}-bc {baseCls}-{ui}-bc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bc</tpl></tpl>" style="background-position: {bc}; height: {frameWidth}px" role="presentation"></div>',
'<tpl if="right"></div></tpl>',
'<tpl if="left"></div></tpl>',
'</tpl>'
@@ -18999,21 +16068,21 @@ Ext.define('Ext.AbstractComponent', {
'<table><tbody>',
'<tpl if="top">',
'<tr>',
- '<tpl if="left"><td 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"></td></tpl>',
- '<td class="{frameCls}-tc {baseCls}-tc {baseCls}-{ui}-tc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tc</tpl></tpl>" style="background-position: {tc}; height: {frameWidth}px" role="presentation"></td>',
- '<tpl if="right"><td class="{frameCls}-tr {baseCls}-tr {baseCls}-{ui}-tr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tr</tpl></tpl>" style="background-position: {tr}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
+ '<tpl if="left"><td id="{fgid}TL" 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"></td></tpl>',
+ '<td id="{fgid}TC" class="{frameCls}-tc {baseCls}-tc {baseCls}-{ui}-tc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tc</tpl></tpl>" style="background-position: {tc}; height: {frameWidth}px" role="presentation"></td>',
+ '<tpl if="right"><td id="{fgid}TR" class="{frameCls}-tr {baseCls}-tr {baseCls}-{ui}-tr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tr</tpl></tpl>" style="background-position: {tr}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
'</tr>',
'</tpl>',
'<tr>',
- '<tpl if="left"><td class="{frameCls}-ml {baseCls}-ml {baseCls}-{ui}-ml<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-ml</tpl></tpl>" style="background-position: {ml}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
- '<td class="{frameCls}-mc {baseCls}-mc {baseCls}-{ui}-mc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mc</tpl></tpl>" style="background-position: 0 0;" role="presentation"></td>',
- '<tpl if="right"><td class="{frameCls}-mr {baseCls}-mr {baseCls}-{ui}-mr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mr</tpl></tpl>" style="background-position: {mr}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
+ '<tpl if="left"><td id="{fgid}ML" class="{frameCls}-ml {baseCls}-ml {baseCls}-{ui}-ml<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-ml</tpl></tpl>" style="background-position: {ml}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
+ '<td id="{fgid}MC" class="{frameCls}-mc {baseCls}-mc {baseCls}-{ui}-mc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mc</tpl></tpl>" style="background-position: 0 0;" role="presentation"></td>',
+ '<tpl if="right"><td id="{fgid}MR" class="{frameCls}-mr {baseCls}-mr {baseCls}-{ui}-mr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mr</tpl></tpl>" style="background-position: {mr}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
'</tr>',
'<tpl if="bottom">',
'<tr>',
- '<tpl if="left"><td class="{frameCls}-bl {baseCls}-bl {baseCls}-{ui}-bl<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bl</tpl></tpl>" style="background-position: {bl}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
- '<td class="{frameCls}-bc {baseCls}-bc {baseCls}-{ui}-bc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bc</tpl></tpl>" style="background-position: {bc}; height: {frameWidth}px" role="presentation"></td>',
- '<tpl if="right"><td class="{frameCls}-br {baseCls}-br {baseCls}-{ui}-br<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-br</tpl></tpl>" style="background-position: {br}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
+ '<tpl if="left"><td id="{fgid}BL" class="{frameCls}-bl {baseCls}-bl {baseCls}-{ui}-bl<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bl</tpl></tpl>" style="background-position: {bl}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
+ '<td id="{fgid}BC" class="{frameCls}-bc {baseCls}-bc {baseCls}-{ui}-bc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bc</tpl></tpl>" style="background-position: {bc}; height: {frameWidth}px" role="presentation"></td>',
+ '<tpl if="right"><td id="{fgid}BR" class="{frameCls}-br {baseCls}-br {baseCls}-{ui}-br<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-br</tpl></tpl>" style="background-position: {br}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
'</tr>',
'</tpl>',
'</tbody></table>'
@@ -19028,11 +16097,18 @@ Ext.define('Ext.AbstractComponent', {
var me = this,
frameInfo = me.getFrameInfo(),
frameWidth = frameInfo.width,
- frameTpl = me.getFrameTpl(frameInfo.table);
+ frameTpl = me.getFrameTpl(frameInfo.table),
+ frameGenId;
if (me.frame) {
+
+ me.frameGenId = frameGenId = (me.frameGenId || 0) + 1;
+ frameGenId = me.id + '-frame' + frameGenId;
+
+
frameTpl.insertFirst(me.el, Ext.apply({}, {
+ fgid: frameGenId,
ui: me.ui,
uiCls: me.uiCls,
frameCls: me.frameCls,
@@ -19048,16 +16124,13 @@ Ext.define('Ext.AbstractComponent', {
me.frameBody = me.el.down('.' + me.frameCls + '-mc');
- Ext.apply(me.renderSelectors, {
- frameTL: '.' + me.baseCls + '-tl',
- frameTC: '.' + me.baseCls + '-tc',
- frameTR: '.' + me.baseCls + '-tr',
- frameML: '.' + me.baseCls + '-ml',
- frameMC: '.' + me.baseCls + '-mc',
- frameMR: '.' + me.baseCls + '-mr',
- frameBL: '.' + me.baseCls + '-bl',
- frameBC: '.' + me.baseCls + '-bc',
- frameBR: '.' + me.baseCls + '-br'
+ me.removeChildEls(function (c) {
+ return c.id && me.frameIdRegex.test(c.id);
+ });
+
+
+ Ext.each(['TL','TC','TR','ML','MC','MR','BL','BC','BR'], function (suffix) {
+ me.childEls.push({ name: 'frame' + suffix, id: frameGenId + suffix });
});
}
},
@@ -19375,11 +16448,11 @@ Ext.define('Ext.AbstractComponent', {
var me = this,
result = [],
frameElementCls = me.frameElementCls;
-
+
result.push(Ext.baseCSSPrefix + cls);
result.push(me.baseCls + '-' + cls);
result.push(me.baseCls + '-' + me.ui + '-' + cls);
-
+
if (!force && me.frame && !Ext.supports.CSS3BorderRadius) {
var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
@@ -19411,11 +16484,11 @@ Ext.define('Ext.AbstractComponent', {
var me = this,
result = [],
frameElementCls = me.frameElementCls;
-
+
result.push(Ext.baseCSSPrefix + cls);
result.push(me.baseCls + '-' + cls);
result.push(me.baseCls + '-' + me.ui + '-' + cls);
-
+
if (!force && me.frame && !Ext.supports.CSS3BorderRadius) {
var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
@@ -19441,14 +16514,14 @@ Ext.define('Ext.AbstractComponent', {
addUIToElement: function(force) {
var me = this,
frameElementCls = me.frameElementCls;
-
+
me.addCls(me.baseCls + '-' + me.ui);
-
+
if (me.frame && !Ext.supports.CSS3BorderRadius) {
var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
i, el, cls;
-
+
for (i = 0; i < els.length; i++) {
el = me['frame' + els[i].toUpperCase()];
@@ -19468,14 +16541,14 @@ Ext.define('Ext.AbstractComponent', {
removeUIFromElement: function() {
var me = this,
frameElementCls = me.frameElementCls;
-
+
me.removeCls(me.baseCls + '-' + me.ui);
-
+
if (me.frame && !Ext.supports.CSS3BorderRadius) {
var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
i, j, el, cls;
-
+
for (i = 0; i < els.length; i++) {
el = me['frame' + els[i].toUpperCase()];
@@ -19491,6 +16564,12 @@ Ext.define('Ext.AbstractComponent', {
},
getElConfig : function() {
+ if (Ext.isString(this.autoEl)) {
+ this.autoEl = {
+ tag: this.autoEl
+ };
+ }
+
var result = this.autoEl || {tag: 'div'};
result.id = this.id;
return result;
@@ -19537,6 +16616,7 @@ Ext.define('Ext.AbstractComponent', {
var me = this;
return Ext.applyIf(me.renderData, {
+ id: me.id,
ui: me.ui,
uiCls: me.uiCls,
baseCls: me.baseCls,
@@ -19589,7 +16669,7 @@ Ext.define('Ext.AbstractComponent', {
initStyles: function() {
var style = {},
me = this,
- Element = Ext.core.Element;
+ Element = Ext.Element;
if (Ext.isString(me.style)) {
style = Element.parseStyles(me.style);
@@ -19619,7 +16699,7 @@ Ext.define('Ext.AbstractComponent', {
pre;
if (me.html) {
- target.update(Ext.core.DomHelper.markup(me.html));
+ target.update(Ext.DomHelper.markup(me.html));
delete me.html;
}
@@ -19665,14 +16745,62 @@ Ext.define('Ext.AbstractComponent', {
},
+ addChildEls: function () {
+ var me = this,
+ childEls = me.childEls || (me.childEls = []);
+
+ childEls.push.apply(childEls, arguments);
+ },
+
+
+ removeChildEls: function (testFn) {
+ var me = this,
+ old = me.childEls,
+ keepers = (me.childEls = []),
+ n, i, cel;
+
+ for (i = 0, n = old.length; i < n; ++i) {
+ cel = old[i];
+ if (!testFn(cel)) {
+ keepers.push(cel);
+ }
+ }
+ },
+
+
applyRenderSelectors: function() {
- var selectors = this.renderSelectors || {},
- el = this.el.dom,
- selector;
+ var me = this,
+ childEls = me.childEls,
+ selectors = me.renderSelectors,
+ el = me.el,
+ dom = el.dom,
+ baseId, childName, childId, i, selector;
+
+ if (childEls) {
+ baseId = me.id + '-';
+ for (i = childEls.length; i--; ) {
+ childName = childId = childEls[i];
+ if (typeof(childName) != 'string') {
+ childId = childName.id || (baseId + childName.itemId);
+ childName = childName.name;
+ } else {
+ childId = baseId + childId;
+ }
- for (selector in selectors) {
- if (selectors.hasOwnProperty(selector) && selectors[selector]) {
- this[selector] = Ext.get(Ext.DomQuery.selectNode(selectors[selector], el));
+
+
+ me[childName] = el.getById(childId);
+ }
+ }
+
+
+
+
+ if (selectors) {
+ for (selector in selectors) {
+ if (selectors.hasOwnProperty(selector) && selectors[selector]) {
+ me[selector] = Ext.get(Ext.DomQuery.selectNode(selectors[selector], dom));
+ }
}
}
},
@@ -19836,16 +16964,17 @@ Ext.define('Ext.AbstractComponent', {
getXTypes: function() {
var self = this.self,
- xtypes = [],
- parentPrototype = this,
- xtype;
+ xtypes, parentPrototype, parentXtypes;
if (!self.xtypes) {
- while (parentPrototype && Ext.getClass(parentPrototype)) {
- xtype = Ext.getClass(parentPrototype).xtype;
+ xtypes = [];
+ parentPrototype = this;
+
+ while (parentPrototype) {
+ parentXtypes = parentPrototype.xtypes;
- if (xtype !== undefined) {
- xtypes.unshift(xtype);
+ if (parentXtypes !== undefined) {
+ xtypes.unshift.apply(xtypes, parentXtypes);
}
parentPrototype = parentPrototype.superclass;
@@ -19868,7 +16997,7 @@ Ext.define('Ext.AbstractComponent', {
me.tpl[me.tplWriteMode](me.getTargetEl(), htmlOrData || {});
}
} else {
- me.html = Ext.isObject(htmlOrData) ? Ext.core.DomHelper.markup(htmlOrData) : htmlOrData;
+ me.html = Ext.isObject(htmlOrData) ? Ext.DomHelper.markup(htmlOrData) : htmlOrData;
if (me.rendered) {
me.getTargetEl().update(me.html, loadScripts, cb);
}
@@ -20261,15 +17390,12 @@ Ext.define('Ext.AbstractComponent', {
if (me.rendered && componentLayout) {
-
-
if (!Ext.isDefined(width)) {
if (me.isFixedWidth()) {
width = Ext.isDefined(me.width) ? me.width : lastComponentSize.width;
}
}
-
if (!Ext.isDefined(height)) {
if (me.isFixedHeight()) {
@@ -20284,6 +17410,7 @@ Ext.define('Ext.AbstractComponent', {
componentLayout.layout(width, height, isSetSize, callingContainer);
}
+
return me;
},
@@ -20313,12 +17440,19 @@ Ext.define('Ext.AbstractComponent', {
afterComponentLayout: function(width, height, isSetSize, callingContainer) {
- ++this.componentLayoutCounter;
- this.fireEvent('resize', this, width, height);
+ var me = this,
+ layout = me.componentLayout,
+ oldSize = me.preLayoutSize;
+
+ ++me.componentLayoutCounter;
+ if (!oldSize || ((width !== oldSize.width) || (height !== oldSize.height))) {
+ me.fireEvent('resize', me, width, height);
+ }
},
beforeComponentLayout: function(width, height, isSetSize, callingContainer) {
+ this.preLayoutSize = this.componentLayout.lastComponentSize;
return true;
},
@@ -20436,7 +17570,46 @@ Ext.define('Ext.AbstractComponent', {
if (me.monitorResize && Ext.EventManager.resizeEvent) {
Ext.EventManager.resizeEvent.removeListener(me.setSize, me);
}
- Ext.destroy(me.componentLayout, me.loadMask);
+
+ Ext.destroy(
+ me.componentLayout,
+ me.loadMask,
+ me.floatingItems
+ );
+ },
+
+
+ cleanElementRefs: function(){
+ var me = this,
+ i = 0,
+ childEls = me.childEls,
+ selectors = me.renderSelectors,
+ selector,
+ name,
+ len;
+
+ if (me.rendered) {
+ if (childEls) {
+ for (len = childEls.length; i < len; ++i) {
+ name = childEls[i];
+ if (typeof(name) != 'string') {
+ name = name.name;
+ }
+ delete me[name];
+ }
+ }
+
+ if (selectors) {
+ for (selector in selectors) {
+ if (selectors.hasOwnProperty(selector)) {
+ delete me[selector];
+ }
+ }
+ }
+ }
+ delete me.rendered;
+ delete me.el;
+ delete me.frameBody;
},
@@ -20468,12 +17641,14 @@ Ext.define('Ext.AbstractComponent', {
me.el.remove();
}
- Ext.ComponentManager.unregister(me);
me.fireEvent('destroy', me);
+ Ext.ComponentManager.unregister(me);
me.mixins.state.destroy.call(me);
me.clearListeners();
+
+ me.cleanElementRefs();
me.destroying = false;
me.isDestroyed = true;
}
@@ -20554,6 +17729,12 @@ Ext.define('Ext.data.Connection', {
disableCaching: true,
+ withCredentials: false,
+
+
+ cors: false,
+
+
disableCachingParam: '_dc',
@@ -20610,7 +17791,12 @@ Ext.define('Ext.data.Connection', {
}
- xhr = this.getXhrInstance();
+
+ if ((options.cors === true || me.cors === true) && Ext.isIe && Ext.ieVersion >= 8) {
+ xhr = new XDomainRequest();
+ } else {
+ xhr = this.getXhrInstance();
+ }
async = options.async !== false ? (options.async || me.async) : false;
@@ -20621,6 +17807,10 @@ Ext.define('Ext.data.Connection', {
xhr.open(requestOptions.method, requestOptions.url, async);
}
+ if (options.withCredentials === true || me.withCredentials === true) {
+ xhr.withCredentials = true;
+ }
+
headers = me.setupHeaders(xhr, options, requestOptions.data, requestOptions.params);
@@ -20636,7 +17826,7 @@ Ext.define('Ext.data.Connection', {
}, options.timeout || me.timeout)
};
me.requests[request.id] = request;
-
+ me.latestId = request.id;
if (async) {
xhr.onreadystatechange = Ext.Function.bind(me.onStateChange, me, [request]);
@@ -20655,7 +17845,7 @@ Ext.define('Ext.data.Connection', {
},
- upload: function(form, url, params, options){
+ upload: function(form, url, params, options) {
form = Ext.getDom(form);
options = options || {};
@@ -20717,7 +17907,8 @@ Ext.define('Ext.data.Connection', {
});
},
- onUploadComplete: function(frame, options){
+
+ onUploadComplete: function(frame, options) {
var me = this,
response = {
@@ -20726,7 +17917,7 @@ Ext.define('Ext.data.Connection', {
}, doc, firstChild;
try {
- doc = frame.contentWindow.document || frame.contentDocument || window.frames[id].document;
+ doc = frame.contentWindow.document || frame.contentDocument || window.frames[frame.id].document;
if (doc) {
if (doc.body) {
if (/textarea/i.test((firstChild = doc.body.firstChild || {}).tagName)) {
@@ -20856,7 +18047,7 @@ Ext.define('Ext.data.Connection', {
var form = this.getForm(options),
serializedForm;
if (form && !this.isFormUpload(options)) {
- serializedForm = Ext.core.Element.serializeForm(form);
+ serializedForm = Ext.Element.serializeForm(form);
params = params ? (params + '&' + serializedForm) : serializedForm;
}
return params;
@@ -20939,6 +18130,9 @@ Ext.define('Ext.data.Connection', {
isLoading : function(request) {
+ if (!request) {
+ request = this.getLatest();
+ }
if (!(request && request.xhr)) {
return false;
}
@@ -20949,9 +18143,11 @@ Ext.define('Ext.data.Connection', {
abort : function(request) {
- var me = this,
- requests = me.requests,
- id;
+ var me = this;
+
+ if (!request) {
+ request = me.getLatest();
+ }
if (request && me.isLoading(request)) {
@@ -20963,14 +18159,31 @@ Ext.define('Ext.data.Connection', {
}
me.onComplete(request);
me.cleanup(request);
- } else if (!request) {
- for(id in requests) {
- if (requests.hasOwnProperty(id)) {
- me.abort(requests[id]);
- }
+ }
+ },
+
+
+ abortAll: function(){
+ var requests = this.requests,
+ id;
+
+ for (id in requests) {
+ if (requests.hasOwnProperty(id)) {
+ this.abort(requests[id]);
}
}
},
+
+
+ getLatest: function(){
+ var id = this.latestId,
+ request;
+
+ if (id) {
+ request = this.requests[id];
+ }
+ return request || null;
+ },
onStateChange : function(request) {
@@ -21000,14 +18213,14 @@ Ext.define('Ext.data.Connection', {
result,
success,
response;
-
+
try {
result = me.parseStatus(request.xhr.status);
} catch (e) {
result = {
- success : false,
- isException : false
+ success : false,
+ isException : false
};
}
success = result.success;
@@ -21134,6 +18347,360 @@ Ext.define('Ext.Ajax', {
autoAbort : false
});
+Ext.define('Ext.ElementLoader', {
+
+
+
+ mixins: {
+ observable: 'Ext.util.Observable'
+ },
+
+ uses: [
+ 'Ext.data.Connection',
+ 'Ext.Ajax'
+ ],
+
+ statics: {
+ Renderer: {
+ Html: function(loader, response, active){
+ loader.getTarget().update(response.responseText, active.scripts === true);
+ return true;
+ }
+ }
+ },
+
+
+
+
+ url: null,
+
+
+ params: null,
+
+
+ baseParams: null,
+
+
+ autoLoad: false,
+
+
+ target: null,
+
+
+ loadMask: false,
+
+
+ ajaxOptions: null,
+
+
+ scripts: false,
+
+
+
+
+
+
+
+
+
+
+
+ isLoader: true,
+
+ constructor: function(config) {
+ var me = this,
+ autoLoad;
+
+ config = config || {};
+ Ext.apply(me, config);
+ me.setTarget(me.target);
+ me.addEvents(
+
+ 'beforeload',
+
+
+ 'exception',
+
+
+ 'load'
+ );
+
+
+ me.mixins.observable.constructor.call(me);
+
+ if (me.autoLoad) {
+ autoLoad = me.autoLoad;
+ if (autoLoad === true) {
+ autoLoad = {};
+ }
+ me.load(autoLoad);
+ }
+ },
+
+
+ setTarget: function(target){
+ var me = this;
+ target = Ext.get(target);
+ if (me.target && me.target != target) {
+ me.abort();
+ }
+ me.target = target;
+ },
+
+
+ getTarget: function(){
+ return this.target || null;
+ },
+
+
+ abort: function(){
+ var active = this.active;
+ if (active !== undefined) {
+ Ext.Ajax.abort(active.request);
+ if (active.mask) {
+ this.removeMask();
+ }
+ delete this.active;
+ }
+ },
+
+
+ removeMask: function(){
+ this.target.unmask();
+ },
+
+
+ addMask: function(mask){
+ this.target.mask(mask === true ? null : mask);
+ },
+
+
+ load: function(options) {
+
+ options = Ext.apply({}, options);
+
+ var me = this,
+ target = me.target,
+ mask = Ext.isDefined(options.loadMask) ? options.loadMask : me.loadMask,
+ params = Ext.apply({}, options.params),
+ ajaxOptions = Ext.apply({}, options.ajaxOptions),
+ callback = options.callback || me.callback,
+ scope = options.scope || me.scope || me,
+ request;
+
+ Ext.applyIf(ajaxOptions, me.ajaxOptions);
+ Ext.applyIf(options, ajaxOptions);
+
+ Ext.applyIf(params, me.params);
+ Ext.apply(params, me.baseParams);
+
+ Ext.applyIf(options, {
+ url: me.url
+ });
+
+
+ Ext.apply(options, {
+ scope: me,
+ params: params,
+ callback: me.onComplete
+ });
+
+ if (me.fireEvent('beforeload', me, options) === false) {
+ return;
+ }
+
+ if (mask) {
+ me.addMask(mask);
+ }
+
+ request = Ext.Ajax.request(options);
+ me.active = {
+ request: request,
+ options: options,
+ mask: mask,
+ scope: scope,
+ callback: callback,
+ success: options.success || me.success,
+ failure: options.failure || me.failure,
+ renderer: options.renderer || me.renderer,
+ scripts: Ext.isDefined(options.scripts) ? options.scripts : me.scripts
+ };
+ me.setOptions(me.active, options);
+ },
+
+
+ setOptions: Ext.emptyFn,
+
+
+ onComplete: function(options, success, response) {
+ var me = this,
+ active = me.active,
+ scope = active.scope,
+ renderer = me.getRenderer(active.renderer);
+
+
+ if (success) {
+ success = renderer.call(me, me, response, active);
+ }
+
+ if (success) {
+ Ext.callback(active.success, scope, [me, response, options]);
+ me.fireEvent('load', me, response, options);
+ } else {
+ Ext.callback(active.failure, scope, [me, response, options]);
+ me.fireEvent('exception', me, response, options);
+ }
+ Ext.callback(active.callback, scope, [me, success, response, options]);
+
+ if (active.mask) {
+ me.removeMask();
+ }
+
+ delete me.active;
+ },
+
+
+ getRenderer: function(renderer){
+ if (Ext.isFunction(renderer)) {
+ return renderer;
+ }
+ return this.statics().Renderer.Html;
+ },
+
+
+ startAutoRefresh: function(interval, options){
+ var me = this;
+ me.stopAutoRefresh();
+ me.autoRefresh = setInterval(function(){
+ me.load(options);
+ }, interval);
+ },
+
+
+ stopAutoRefresh: function(){
+ clearInterval(this.autoRefresh);
+ delete this.autoRefresh;
+ },
+
+
+ isAutoRefreshing: function(){
+ return Ext.isDefined(this.autoRefresh);
+ },
+
+
+ destroy: function(){
+ var me = this;
+ me.stopAutoRefresh();
+ delete me.target;
+ me.abort();
+ me.clearListeners();
+ }
+});
+
+
+Ext.define('Ext.ComponentLoader', {
+
+
+
+ extend: 'Ext.ElementLoader',
+
+ statics: {
+ Renderer: {
+ Data: function(loader, response, active){
+ var success = true;
+ try {
+ loader.getTarget().update(Ext.decode(response.responseText));
+ } catch (e) {
+ success = false;
+ }
+ return success;
+ },
+
+ Component: function(loader, response, active){
+ var success = true,
+ target = loader.getTarget(),
+ items = [];
+
+
+ try {
+ items = Ext.decode(response.responseText);
+ } catch (e) {
+ success = false;
+ }
+
+ if (success) {
+ if (active.removeAll) {
+ target.removeAll();
+ }
+ target.add(items);
+ }
+ return success;
+ }
+ }
+ },
+
+
+
+
+ target: null,
+
+
+ loadMask: false,
+
+
+
+
+ renderer: 'html',
+
+
+ setTarget: function(target){
+ var me = this;
+
+ if (Ext.isString(target)) {
+ target = Ext.getCmp(target);
+ }
+
+ if (me.target && me.target != target) {
+ me.abort();
+ }
+ me.target = target;
+ },
+
+
+ removeMask: function(){
+ this.target.setLoading(false);
+ },
+
+
+ addMask: function(mask){
+ this.target.setLoading(mask);
+ },
+
+
+
+ setOptions: function(active, options){
+ active.removeAll = Ext.isDefined(options.removeAll) ? options.removeAll : this.removeAll;
+ },
+
+
+ getRenderer: function(renderer){
+ if (Ext.isFunction(renderer)) {
+ return renderer;
+ }
+
+ var renderers = this.statics().Renderer;
+ switch (renderer) {
+ case 'component':
+ return renderers.Component;
+ case 'data':
+ return renderers.Data;
+ default:
+ return Ext.ElementLoader.Renderer.Html;
+ }
+ }
+});
+
+
Ext.define('Ext.data.Association', {
@@ -21228,14 +18795,14 @@ Ext.define('Ext.ModelManager', {
extend: 'Ext.AbstractManager',
alternateClassName: 'Ext.ModelMgr',
requires: ['Ext.data.Association'],
-
+
singleton: true,
-
+
typeName: 'mtype',
-
+
associationStack: [],
-
+
registerType: function(name, config) {
var proto = config.prototype,
@@ -21253,34 +18820,34 @@ Ext.define('Ext.ModelManager', {
this.types[name] = model;
return model;
},
-
+
onModelDefined: function(model) {
var stack = this.associationStack,
length = stack.length,
create = [],
association, i, created;
-
+
for (i = 0; i < length; i++) {
association = stack[i];
-
+
if (association.associatedModel == model.modelName) {
create.push(association);
}
}
-
+
for (i = 0, length = create.length; i < length; i++) {
created = create[i];
this.types[created.ownerModel].prototype.associations.add(Ext.data.Association.create(created));
Ext.Array.remove(stack, created);
}
},
-
+
registerDeferredAssociation: function(association){
this.associationStack.push(association);
},
-
+
getModel: function(id) {
var model = id;
@@ -21289,22 +18856,755 @@ Ext.define('Ext.ModelManager', {
}
return model;
},
-
+
create: function(config, name, id) {
var con = typeof name == 'function' ? name : this.types[name || config.name];
-
+
return new con(config, id);
}
}, function() {
-
+
Ext.regModel = function() {
return this.ModelManager.registerType.apply(this.ModelManager, arguments);
};
});
-
+
+Ext.define('Ext.PluginManager', {
+ extend: 'Ext.AbstractManager',
+ alternateClassName: 'Ext.PluginMgr',
+ singleton: true,
+ typeName: 'ptype',
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ create : function(config, defaultType){
+ if (config.init) {
+ return config;
+ } else {
+ return Ext.createByAlias('plugin.' + (config.ptype || defaultType), config);
+ }
+
+
+
+
+
+
+
+
+ },
+
+
+ findByType: function(type, defaultsOnly) {
+ var matches = [],
+ types = this.types;
+
+ for (var name in types) {
+ if (!types.hasOwnProperty(name)) {
+ continue;
+ }
+ var item = types[name];
+
+ if (item.type == type && (!defaultsOnly || (defaultsOnly === true && item.isDefault))) {
+ matches.push(item);
+ }
+ }
+
+ return matches;
+ }
+}, function() {
+
+ Ext.preg = function() {
+ return Ext.PluginManager.registerType.apply(Ext.PluginManager, arguments);
+ };
+});
+
+
+Ext.define('Ext.Template', {
+
+
+
+ requires: ['Ext.DomHelper', 'Ext.util.Format'],
+
+ inheritableStatics: {
+
+ from: function(el, config) {
+ el = Ext.getDom(el);
+ return new this(el.value || el.innerHTML, config || '');
+ }
+ },
+
+
+
+
+ constructor: function(html) {
+ var me = this,
+ args = arguments,
+ buffer = [],
+ i = 0,
+ length = args.length,
+ value;
+
+ me.initialConfig = {};
+
+ if (length > 1) {
+ for (; i < length; i++) {
+ value = args[i];
+ if (typeof value == 'object') {
+ Ext.apply(me.initialConfig, value);
+ Ext.apply(me, value);
+ } else {
+ buffer.push(value);
+ }
+ }
+ html = buffer.join('');
+ } else {
+ if (Ext.isArray(html)) {
+ buffer.push(html.join(''));
+ } else {
+ buffer.push(html);
+ }
+ }
+
+
+ me.html = buffer.join('');
+
+ if (me.compiled) {
+ me.compile();
+ }
+ },
+
+ isTemplate: true,
+
+
+
+
+ disableFormats: false,
+
+ re: /\{([\w\-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
+
+
+ applyTemplate: function(values) {
+ var me = this,
+ useFormat = me.disableFormats !== true,
+ fm = Ext.util.Format,
+ tpl = me;
+
+ if (me.compiled) {
+ return me.compiled(values);
+ }
+ function fn(m, name, format, args) {
+ if (format && useFormat) {
+ if (args) {
+ args = [values[name]].concat(Ext.functionFactory('return ['+ args +'];')());
+ } else {
+ args = [values[name]];
+ }
+ if (format.substr(0, 5) == "this.") {
+ return tpl[format.substr(5)].apply(tpl, args);
+ }
+ else {
+ return fm[format].apply(fm, args);
+ }
+ }
+ else {
+ return values[name] !== undefined ? values[name] : "";
+ }
+ }
+ return me.html.replace(me.re, fn);
+ },
+
+
+ set: function(html, compile) {
+ var me = this;
+ me.html = html;
+ me.compiled = null;
+ return compile ? me.compile() : me;
+ },
+
+ compileARe: /\\/g,
+ compileBRe: /(\r\n|\n)/g,
+ compileCRe: /'/g,
+
+ /**
+ * Compiles the template into an internal function, eliminating the RegEx overhead.
+ * @return {Ext.Template} this
+ */
+ compile: function() {
+ var me = this,
+ fm = Ext.util.Format,
+ useFormat = me.disableFormats !== true,
+ body, bodyReturn;
+
+ function fn(m, name, format, args) {
+ if (format && useFormat) {
+ args = args ? ',' + args: "";
+ if (format.substr(0, 5) != "this.") {
+ format = "fm." + format + '(';
+ }
+ else {
+ format = 'this.' + format.substr(5) + '(';
+ }
+ }
+ else {
+ args = '';
+ format = "(values['" + name + "'] == undefined ? '' : ";
+ }
+ return "'," + format + "values['" + name + "']" + args + ") ,'";
+ }
+
+ bodyReturn = me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn);
+ body = "this.compiled = function(values){ return ['" + bodyReturn + "'].join('');};";
+ eval(body);
+ return me;
+ },
+
+ /**
+ * Applies the supplied values to the template and inserts the new node(s) as the first child of el.
+ *
+ * @param {String/HTMLElement/Ext.Element} el The context element
+ * @param {Object/Array} values The template values. See {@link #applyTemplate} for details.
+ * @param {Boolean} returnElement (optional) true to return a Ext.Element.
+ * @return {HTMLElement/Ext.Element} The new node or Element
+ */
+ insertFirst: function(el, values, returnElement) {
+ return this.doInsert('afterBegin', el, values, returnElement);
+ },
+
+ /**
+ * Applies the supplied values to the template and inserts the new node(s) before el.
+ *
+ * @param {String/HTMLElement/Ext.Element} el The context element
+ * @param {Object/Array} values The template values. See {@link #applyTemplate} for details.
+ * @param {Boolean} returnElement (optional) true to return a Ext.Element.
+ * @return {HTMLElement/Ext.Element} The new node or Element
+ */
+ insertBefore: function(el, values, returnElement) {
+ return this.doInsert('beforeBegin', el, values, returnElement);
+ },
+
+ /**
+ * Applies the supplied values to the template and inserts the new node(s) after el.
+ *
+ * @param {String/HTMLElement/Ext.Element} el The context element
+ * @param {Object/Array} values The template values. See {@link #applyTemplate} for details.
+ * @param {Boolean} returnElement (optional) true to return a Ext.Element.
+ * @return {HTMLElement/Ext.Element} The new node or Element
+ */
+ insertAfter: function(el, values, returnElement) {
+ return this.doInsert('afterEnd', el, values, returnElement);
+ },
+
+ /**
+ * Applies the supplied `values` to the template and appends the new node(s) to the specified `el`.
+ *
+ * For example usage see {@link Ext.Template Ext.Template class docs}.
+ *
+ * @param {String/HTMLElement/Ext.Element} el The context element
+ * @param {Object/Array} values The template values. See {@link #applyTemplate} for details.
+ * @param {Boolean} returnElement (optional) true to return an Ext.Element.
+ * @return {HTMLElement/Ext.Element} The new node or Element
+ */
+ append: function(el, values, returnElement) {
+ return this.doInsert('beforeEnd', el, values, returnElement);
+ },
+
+ doInsert: function(where, el, values, returnEl) {
+ el = Ext.getDom(el);
+ var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));
+ return returnEl ? Ext.get(newNode, true) : newNode;
+ },
+
+ /**
+ * Applies the supplied values to the template and overwrites the content of el with the new node(s).
+ *
+ * @param {String/HTMLElement/Ext.Element} el The context element
+ * @param {Object/Array} values The template values. See {@link #applyTemplate} for details.
+ * @param {Boolean} returnElement (optional) true to return a Ext.Element.
+ * @return {HTMLElement/Ext.Element} The new node or Element
+ */
+ overwrite: function(el, values, returnElement) {
+ el = Ext.getDom(el);
+ el.innerHTML = this.applyTemplate(values);
+ return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
+ }
+}, function() {
+
+ /**
+ * @method apply
+ * @member Ext.Template
+ * Alias for {@link #applyTemplate}.
+ * @alias Ext.Template#applyTemplate
+ */
+ this.createAlias('apply', 'applyTemplate');
+});
+
+/**
+ * A template class that supports advanced functionality like:
+ *
+ * - Autofilling arrays using templates and sub-templates
+ * - Conditional processing with basic comparison operators
+ * - Basic math function support
+ * - Execute arbitrary inline code with special built-in template variables
+ * - Custom member functions
+ * - Many special tags and built-in operators that aren't defined as part of the API, but are supported in the templates that can be created
+ *
+ * XTemplate provides the templating mechanism built into:
+ *
+ * - {@link Ext.view.View}
+ *
+ * The {@link Ext.Template} describes the acceptable parameters to pass to the constructor. The following examples
+ * demonstrate all of the supported features.
+ *
+ * # Sample Data
+ *
+ * This is the data object used for reference in each code example:
+ *
+ * var data = {
+ * name: 'Tommy Maintz',
+ * title: 'Lead Developer',
+ * company: 'Sencha Inc.',
+ * email: 'tommy@sencha.com',
+ * address: '5 Cups Drive',
+ * city: 'Palo Alto',
+ * state: 'CA',
+ * zip: '44102',
+ * drinks: ['Coffee', 'Soda', 'Water'],
+ * kids: [
+ * {
+ * name: 'Joshua',
+ * age:3
+ * },
+ * {
+ * name: 'Matthew',
+ * age:2
+ * },
+ * {
+ * name: 'Solomon',
+ * age:0
+ * }
+ * ]
+ * };
+ *
+ * # Auto filling of arrays
+ *
+ * The **tpl** tag and the **for** operator are used to process the provided data object:
+ *
+ * - If the value specified in for is an array, it will auto-fill, repeating the template block inside the tpl
+ * tag for each item in the array.
+ * - If for="." is specified, the data object provided is examined.
+ * - While processing an array, the special variable {#} will provide the current array index + 1 (starts at 1, not 0).
+ *
+ * Examples:
+ *
+ * <tpl for=".">...</tpl> // loop through array at root node
+ * <tpl for="foo">...</tpl> // loop through array at foo node
+ * <tpl for="foo.bar">...</tpl> // loop through array at foo.bar node
+ *
+ * Using the sample data above:
+ *
+ * var tpl = new Ext.XTemplate(
+ * '<p>Kids: ',
+ * '<tpl for=".">', // process the data.kids node
+ * '<p>{#}. {name}</p>', // use current array index to autonumber
+ * '</tpl></p>'
+ * );
+ * tpl.overwrite(panel.body, data.kids); // pass the kids property of the data object
+ *
+ * An example illustrating how the **for** property can be leveraged to access specified members of the provided data
+ * object to populate the template:
+ *
+ * var tpl = new Ext.XTemplate(
+ * '<p>Name: {name}</p>',
+ * '<p>Title: {title}</p>',
+ * '<p>Company: {company}</p>',
+ * '<p>Kids: ',
+ * '<tpl for="kids">', // interrogate the kids property within the data
+ * '<p>{name}</p>',
+ * '</tpl></p>'
+ * );
+ * tpl.overwrite(panel.body, data); // pass the root node of the data object
+ *
+ * Flat arrays that contain values (and not objects) can be auto-rendered using the special **`{.}`** variable inside a
+ * loop. This variable will represent the value of the array at the current index:
+ *
+ * var tpl = new Ext.XTemplate(
+ * '<p>{name}\'s favorite beverages:</p>',
+ * '<tpl for="drinks">',
+ * '<div> - {.}</div>',
+ * '</tpl>'
+ * );
+ * tpl.overwrite(panel.body, data);
+ *
+ * When processing a sub-template, for example while looping through a child array, you can access the parent object's
+ * members via the **parent** object:
+ *
+ * var tpl = new Ext.XTemplate(
+ * '<p>Name: {name}</p>',
+ * '<p>Kids: ',
+ * '<tpl for="kids">',
+ * '<tpl if="age &gt; 1">',
+ * '<p>{name}</p>',
+ * '<p>Dad: {parent.name}</p>',
+ * '</tpl>',
+ * '</tpl></p>'
+ * );
+ * tpl.overwrite(panel.body, data);
+ *
+ * # Conditional processing with basic comparison operators
+ *
+ * The **tpl** tag and the **if** operator are used to provide conditional checks for deciding whether or not to render
+ * specific parts of the template. Notes:
+ *
+ * - Double quotes must be encoded if used within the conditional
+ * - There is no else operator -- if needed, two opposite if statements should be used.
+ *
+ * Examples:
+ *
+ * <tpl if="age > 1 && age < 10">Child</tpl>
+ * <tpl if="age >= 10 && age < 18">Teenager</tpl>
+ * <tpl if="this.isGirl(name)">...</tpl>
+ * <tpl if="id==\'download\'">...</tpl>
+ * <tpl if="needsIcon"><img src="{icon}" class="{iconCls}"/></tpl>
+ * // no good:
+ * <tpl if="name == "Tommy"">Hello</tpl>
+ * // encode " if it is part of the condition, e.g.
+ * <tpl if="name == &quot;Tommy&quot;">Hello</tpl>
+ *
+ * Using the sample data above:
+ *
+ * var tpl = new Ext.XTemplate(
+ * '<p>Name: {name}</p>',
+ * '<p>Kids: ',
+ * '<tpl for="kids">',
+ * '<tpl if="age &gt; 1">',
+ * '<p>{name}</p>',
+ * '</tpl>',
+ * '</tpl></p>'
+ * );
+ * tpl.overwrite(panel.body, data);
+ *
+ * # Basic math support
+ *
+ * The following basic math operators may be applied directly on numeric data values:
+ *
+ * + - * /
+ *
+ * For example:
+ *
+ * var tpl = new Ext.XTemplate(
+ * '<p>Name: {name}</p>',
+ * '<p>Kids: ',
+ * '<tpl for="kids">',
+ * '<tpl if="age &gt; 1">', // <-- Note that the > is encoded
+ * '<p>{#}: {name}</p>', // <-- Auto-number each item
+ * '<p>In 5 Years: {age+5}</p>', // <-- Basic math
+ * '<p>Dad: {parent.name}</p>',
+ * '</tpl>',
+ * '</tpl></p>'
+ * );
+ * tpl.overwrite(panel.body, data);
+ *
+ * # Execute arbitrary inline code with special built-in template variables
+ *
+ * Anything between `{[ ... ]}` is considered code to be executed in the scope of the template. There are some special
+ * variables available in that code:
+ *
+ * - **values**: The values in the current scope. If you are using scope changing sub-templates,
+ * you can change what values is.
+ * - **parent**: The scope (values) of the ancestor template.
+ * - **xindex**: If you are in a looping template, the index of the loop you are in (1-based).
+ * - **xcount**: If you are in a looping template, the total length of the array you are looping.
+ *
+ * This example demonstrates basic row striping using an inline code block and the xindex variable:
+ *
+ * var tpl = new Ext.XTemplate(
+ * '<p>Name: {name}</p>',
+ * '<p>Company: {[values.company.toUpperCase() + ", " + values.title]}</p>',
+ * '<p>Kids: ',
+ * '<tpl for="kids">',
+ * '<div class="{[xindex % 2 === 0 ? "even" : "odd"]}">',
+ * '{name}',
+ * '</div>',
+ * '</tpl></p>'
+ * );
+ * tpl.overwrite(panel.body, data);
+ *
+ * # Template member functions
+ *
+ * One or more member functions can be specified in a configuration object passed into the XTemplate constructor for
+ * more complex processing:
+ *
+ * var tpl = new Ext.XTemplate(
+ * '<p>Name: {name}</p>',
+ * '<p>Kids: ',
+ * '<tpl for="kids">',
+ * '<tpl if="this.isGirl(name)">',
+ * '<p>Girl: {name} - {age}</p>',
+ * '</tpl>',
+ * // use opposite if statement to simulate 'else' processing:
+ * '<tpl if="this.isGirl(name) == false">',
+ * '<p>Boy: {name} - {age}</p>',
+ * '</tpl>',
+ * '<tpl if="this.isBaby(age)">',
+ * '<p>{name} is a baby!</p>',
+ * '</tpl>',
+ * '</tpl></p>',
+ * {
+ * // XTemplate configuration:
+ * disableFormats: true,
+ * // member functions:
+ * isGirl: function(name){
+ * return name == 'Sara Grace';
+ * },
+ * isBaby: function(age){
+ * return age < 1;
+ * }
+ * }
+ * );
+ * tpl.overwrite(panel.body, data);
+ */
+Ext.define('Ext.XTemplate', {
+
+ /* Begin Definitions */
+
+ extend: 'Ext.Template',
+
+ /* End Definitions */
+
+ argsRe: /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/,
+ nameRe: /^<tpl\b[^>]*?for="(.*?)"/,
+ ifRe: /^<tpl\b[^>]*?if="(.*?)"/,
+ execRe: /^<tpl\b[^>]*?exec="(.*?)"/,
+ constructor: function() {
+ this.callParent(arguments);
+
+ var me = this,
+ html = me.html,
+ argsRe = me.argsRe,
+ nameRe = me.nameRe,
+ ifRe = me.ifRe,
+ execRe = me.execRe,
+ id = 0,
+ tpls = [],
+ VALUES = 'values',
+ PARENT = 'parent',
+ XINDEX = 'xindex',
+ XCOUNT = 'xcount',
+ RETURN = 'return ',
+ WITHVALUES = 'with(values){ ',
+ m, matchName, matchIf, matchExec, exp, fn, exec, name, i;
+
+ html = ['<tpl>', html, '</tpl>'].join('');
+
+ while ((m = html.match(argsRe))) {
+ exp = null;
+ fn = null;
+ exec = null;
+ matchName = m[0].match(nameRe);
+ matchIf = m[0].match(ifRe);
+ matchExec = m[0].match(execRe);
+
+ exp = matchIf ? matchIf[1] : null;
+ if (exp) {
+ fn = Ext.functionFactory(VALUES, PARENT, XINDEX, XCOUNT, WITHVALUES + 'try{' + RETURN + Ext.String.htmlDecode(exp) + ';}catch(e){return;}}');
+ }
+
+ exp = matchExec ? matchExec[1] : null;
+ if (exp) {
+ exec = Ext.functionFactory(VALUES, PARENT, XINDEX, XCOUNT, WITHVALUES + Ext.String.htmlDecode(exp) + ';}');
+ }
+
+ name = matchName ? matchName[1] : null;
+ if (name) {
+ if (name === '.') {
+ name = VALUES;
+ } else if (name === '..') {
+ name = PARENT;
+ }
+ name = Ext.functionFactory(VALUES, PARENT, 'try{' + WITHVALUES + RETURN + name + ';}}catch(e){return;}');
+ }
+
+ tpls.push({
+ id: id,
+ target: name,
+ exec: exec,
+ test: fn,
+ body: m[1] || ''
+ });
+
+ html = html.replace(m[0], '{xtpl' + id + '}');
+ id = id + 1;
+ }
+
+ for (i = tpls.length - 1; i >= 0; --i) {
+ me.compileTpl(tpls[i]);
+ }
+ me.master = tpls[tpls.length - 1];
+ me.tpls = tpls;
+ },
+
+ // @private
+ applySubTemplate: function(id, values, parent, xindex, xcount) {
+ var me = this, t = me.tpls[id];
+ return t.compiled.call(me, values, parent, xindex, xcount);
+ },
+
+ /**
+ * @cfg {RegExp} codeRe
+ * The regular expression used to match code variables. Default: matches {[expression]}.
+ */
+ codeRe: /\{\[((?:\\\]|.|\n)*?)\]\}/g,
+
+ /**
+ * @cfg {Boolean} compiled
+ * Only applies to {@link Ext.Template}, XTemplates are compiled automatically.
+ */
+
+ re: /\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\/]\s?[\d\.\+\-\*\/\(\)]+)?\}/g,
+
+ // @private
+ compileTpl: function(tpl) {
+ var fm = Ext.util.Format,
+ me = this,
+ useFormat = me.disableFormats !== true,
+ body, bodyReturn, evaluatedFn;
+
+ function fn(m, name, format, args, math) {
+ var v;
+ // name is what is inside the {}
+ // Name begins with xtpl, use a Sub Template
+ if (name.substr(0, 4) == 'xtpl') {
+ return "',this.applySubTemplate(" + name.substr(4) + ", values, parent, xindex, xcount),'";
+ }
+ // name = "." - Just use the values object.
+ if (name == '.') {
+ // filter to not include arrays/objects/nulls
+ v = 'Ext.Array.indexOf(["string", "number", "boolean"], typeof values) > -1 || Ext.isDate(values) ? values : ""';
+ }
+
+ // name = "#" - Use the xindex
+ else if (name == '#') {
+ v = 'xindex';
+ }
+ else if (name.substr(0, 7) == "parent.") {
+ v = name;
+ }
+ // name has a . in it - Use object literal notation, starting from values
+ else if (name.indexOf('.') != -1) {
+ v = "values." + name;
+ }
+
+ // name is a property of values
+ else {
+ v = "values['" + name + "']";
+ }
+ if (math) {
+ v = '(' + v + math + ')';
+ }
+ if (format && useFormat) {
+ args = args ? ',' + args : "";
+ if (format.substr(0, 5) != "this.") {
+ format = "fm." + format + '(';
+ }
+ else {
+ format = 'this.' + format.substr(5) + '(';
+ }
+ }
+ else {
+ args = '';
+ format = "(" + v + " === undefined ? '' : ";
+ }
+ return "'," + format + v + args + "),'";
+ }
+
+ function codeFn(m, code) {
+ // Single quotes get escaped when the template is compiled, however we want to undo this when running code.
+ return "',(" + code.replace(me.compileARe, "'") + "),'";
+ }
+
+ bodyReturn = tpl.body.replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn).replace(me.codeRe, codeFn);
+ body = "evaluatedFn = function(values, parent, xindex, xcount){return ['" + bodyReturn + "'].join('');};";
+ eval(body);
+
+ tpl.compiled = function(values, parent, xindex, xcount) {
+ var vs,
+ length,
+ buffer,
+ i;
+
+ if (tpl.test && !tpl.test.call(me, values, parent, xindex, xcount)) {
+ return '';
+ }
+
+ vs = tpl.target ? tpl.target.call(me, values, parent) : values;
+ if (!vs) {
+ return '';
+ }
+
+ parent = tpl.target ? values : parent;
+ if (tpl.target && Ext.isArray(vs)) {
+ buffer = [];
+ length = vs.length;
+ if (tpl.exec) {
+ for (i = 0; i < length; i++) {
+ buffer[buffer.length] = evaluatedFn.call(me, vs[i], parent, i + 1, length);
+ tpl.exec.call(me, vs[i], parent, i + 1, length);
+ }
+ } else {
+ for (i = 0; i < length; i++) {
+ buffer[buffer.length] = evaluatedFn.call(me, vs[i], parent, i + 1, length);
+ }
+ }
+ return buffer.join('');
+ }
+
+ if (tpl.exec) {
+ tpl.exec.call(me, vs, parent, xindex, xcount);
+ }
+ return evaluatedFn.call(me, vs, parent, xindex, xcount);
+ };
+
+ return this;
+ },
+
+ // inherit docs from Ext.Template
+ applyTemplate: function(values) {
+ return this.master.compiled.call(this, values, {}, 1, 1);
+ },
+
+ /**
+ * Does nothing. XTemplates are compiled automatically, so this function simply returns this.
+ * @return {Ext.XTemplate} this
+ */
+ compile: function() {
+ return this;
+ }
+}, function() {
+ // re-create the alias, inheriting it from Ext.Template doesn't work as intended.
+ this.createAlias('apply', 'applyTemplate');
+});
+
+
Ext.define('Ext.app.Controller', {
mixins: {
@@ -21312,6 +19612,12 @@ Ext.define('Ext.app.Controller', {
},
+
+
+
+
+
+
onClassExtended: function(cls, data) {
var className = Ext.getClassName(cls),
@@ -21369,6 +19675,7 @@ Ext.define('Ext.app.Controller', {
init: function(application) {},
+
onLaunch: function(application) {},
@@ -21462,6 +19769,60 @@ Ext.define('Ext.app.Controller', {
});
+Ext.define('Ext.data.IdGenerator', {
+
+ isGenerator: true,
+
+
+ constructor: function(config) {
+ var me = this;
+
+ Ext.apply(me, config);
+
+ if (me.id) {
+ Ext.data.IdGenerator.all[me.id] = me;
+ }
+ },
+
+
+
+ getRecId: function (rec) {
+ return rec.modelName + '-' + rec.internalId;
+ },
+
+
+
+ statics: {
+
+ all: {},
+
+
+ get: function (config) {
+ var generator,
+ id,
+ type;
+
+ if (typeof config == 'string') {
+ id = type = config;
+ config = null;
+ } else if (config.isGenerator) {
+ return config;
+ } else {
+ id = config.id || config.type;
+ type = config.type;
+ }
+
+ generator = this.all[id];
+ if (!generator) {
+ generator = Ext.create('idgen.' + type, config);
+ }
+
+ return generator;
+ }
+ }
+});
+
+
Ext.define('Ext.data.SortTypes', {
singleton: true,
@@ -21513,97 +19874,285 @@ Ext.define('Ext.data.SortTypes', {
}
});
-Ext.define('Ext.data.Errors', {
- extend: 'Ext.util.MixedCollection',
+Ext.define('Ext.util.Filter', {
+
+
+
- isValid: function() {
- return this.length === 0;
- },
- getByField: function(fieldName) {
- var errors = [],
- error, field, i;
+
+
+ anyMatch: false,
+
+
+ exactMatch: false,
+
+
+ caseSensitive: false,
+
+
+
+
+ constructor: function(config) {
+ var me = this;
+ Ext.apply(me, config);
+
+
+
+ me.filter = me.filter || me.filterFn;
+
+ if (me.filter === undefined) {
+ if (me.property === undefined || me.value === undefined) {
+
+
+
+
+ } else {
+ me.filter = me.createFilterFn();
+ }
- for (i = 0; i < this.length; i++) {
- error = this.items[i];
+ me.filterFn = me.filter;
+ }
+ },
+
+
+ createFilterFn: function() {
+ var me = this,
+ matcher = me.createValueMatcher(),
+ property = me.property;
+
+ return function(item) {
+ var value = me.getRoot.call(me, item)[property];
+ return matcher === null ? value === null : matcher.test(value);
+ };
+ },
+
+
+ getRoot: function(item) {
+ var root = this.root;
+ return root === undefined ? item : item[root];
+ },
+
+
+ createValueMatcher : function() {
+ var me = this,
+ value = me.value,
+ anyMatch = me.anyMatch,
+ exactMatch = me.exactMatch,
+ caseSensitive = me.caseSensitive,
+ escapeRe = Ext.String.escapeRegex;
- if (error.field == fieldName) {
- errors.push(error);
- }
+ if (value === null) {
+ return value;
}
- return errors;
+ if (!value.exec) {
+ value = String(value);
+
+ if (anyMatch === true) {
+ value = escapeRe(value);
+ } else {
+ value = '^' + escapeRe(value);
+ if (exactMatch === true) {
+ value += '$';
+ }
+ }
+ value = new RegExp(value, caseSensitive ? '' : 'i');
+ }
+
+ return value;
}
});
+Ext.define('Ext.util.Sorter', {
+
+
+
+
+
+
+
+
+
+
+ direction: "ASC",
+
+ constructor: function(config) {
+ var me = this;
+
+ Ext.apply(me, config);
+
+
+ me.updateSortFunction();
+ },
+
+
+ createSortFunction: function(sorterFn) {
+ var me = this,
+ property = me.property,
+ direction = me.direction || "ASC",
+ modifier = direction.toUpperCase() == "DESC" ? -1 : 1;
+
+
+
+ return function(o1, o2) {
+ return modifier * sorterFn.call(me, o1, o2);
+ };
+ },
+
+
+ defaultSorterFn: function(o1, o2) {
+ var me = this,
+ transform = me.transform,
+ v1 = me.getRoot(o1)[me.property],
+ v2 = me.getRoot(o2)[me.property];
+
+ if (transform) {
+ v1 = transform(v1);
+ v2 = transform(v2);
+ }
+
+ return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
+ },
+
+
+ getRoot: function(item) {
+ return this.root === undefined ? item : item[this.root];
+ },
+
+
+ setDirection: function(direction) {
+ var me = this;
+ me.direction = direction;
+ me.updateSortFunction();
+ },
+
+
+ toggle: function() {
+ var me = this;
+ me.direction = Ext.String.toggle(me.direction, "ASC", "DESC");
+ me.updateSortFunction();
+ },
+
+
+ updateSortFunction: function(fn) {
+ var me = this;
+ fn = fn || me.sorterFn || me.defaultSorterFn;
+ me.sort = me.createSortFunction(fn);
+ }
+});
Ext.define('Ext.data.Operation', {
synchronous: true,
-
+
action: undefined,
-
+
filters: undefined,
-
+
sorters: undefined,
-
+
group: undefined,
-
+
start: undefined,
-
+
limit: undefined,
-
+
batch: undefined,
-
+
- started: false,
+ callback: undefined,
+
+ scope: undefined,
+
- running: false,
+ started: false,
+
+ running: false,
+
complete: false,
-
+
success: undefined,
-
+
exception: false,
-
+
error: undefined,
+ actionCommitRecordsRe: /^(?:create|update)$/i,
+
+
+ actionSkipSyncRe: /^destroy$/i,
+
+
constructor: function(config) {
Ext.apply(this, config || {});
},
+
+ commitRecords: function (serverRecords) {
+ var me = this,
+ mc, index, clientRecords, serverRec, clientRec;
+
+ if (!me.actionSkipSyncRe.test(me.action)) {
+ clientRecords = me.records;
+
+ if (clientRecords && clientRecords.length) {
+ mc = Ext.create('Ext.util.MixedCollection', true, function(r) {return r.getId();});
+ mc.addAll(clientRecords);
+
+ for (index = serverRecords ? serverRecords.length : 0; index--; ) {
+ serverRec = serverRecords[index];
+ clientRec = mc.get(serverRec.getId());
+
+ if (clientRec) {
+ clientRec.beginEdit();
+ clientRec.set(serverRec.data);
+ clientRec.endEdit(true);
+ }
+ }
+
+ if (me.actionCommitRecordsRe.test(me.action)) {
+ for (index = clientRecords.length; index--; ) {
+ clientRecords[index].commit();
+ }
+ }
+ }
+ }
+ },
+
setStarted: function() {
this.started = true;
this.running = true;
},
-
+
setCompleted: function() {
this.complete = true;
this.running = false;
},
-
+
setSuccessful: function() {
this.success = true;
},
-
+
setException: function(error) {
this.exception = true;
@@ -21611,54 +20160,54 @@ Ext.define('Ext.data.Operation', {
this.running = false;
this.error = error;
},
-
+
hasException: function() {
return this.exception === true;
},
-
+
getError: function() {
return this.error;
},
-
+
getRecords: function() {
var resultSet = this.getResultSet();
-
+
return (resultSet === undefined ? this.records : resultSet.records);
},
-
+
getResultSet: function() {
return this.resultSet;
},
-
+
isStarted: function() {
return this.started === true;
},
-
+
isRunning: function() {
return this.running === true;
},
-
+
isComplete: function() {
return this.complete === true;
},
-
+
wasSuccessful: function() {
return this.isComplete() && this.success === true;
},
-
+
setBatch: function(batch) {
this.batch = batch;
},
-
+
allowWrite: function() {
return this.action != 'read';
@@ -21684,17 +20233,24 @@ Ext.define('Ext.data.validations', {
exclusionMessage: 'is not an acceptable value',
+ emailMessage: 'is not a valid email address',
+
+
+ emailRe: /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,
+
+
presence: function(config, value) {
if (value === undefined) {
value = config;
}
- return !!value;
+
+ return !!value || value === 0;
},
length: function(config, value) {
- if (value === undefined) {
+ if (value === undefined || value === null) {
return false;
}
@@ -21710,6 +20266,11 @@ Ext.define('Ext.data.validations', {
},
+ email: function(config, email) {
+ return Ext.data.validations.emailRe.test(email);
+ },
+
+
format: function(config, value) {
return !!(config.matcher && config.matcher.test(value));
},
@@ -21728,25 +20289,25 @@ Ext.define('Ext.data.validations', {
Ext.define('Ext.data.ResultSet', {
loaded: true,
-
+
count: 0,
-
+
total: 0,
-
+
success: false,
-
+
constructor: function(config) {
Ext.apply(this, config);
-
+
this.totalRecords = this.total;
-
+
if (config.count === undefined) {
this.count = this.records.length;
}
@@ -21832,15 +20393,17 @@ Ext.define('Ext.util.Floating', {
shadow: 'sides',
constructor: function(config) {
- this.floating = true;
- this.el = Ext.create('Ext.Layer', Ext.apply({}, config, {
- hideMode: this.hideMode,
- hidden: this.hidden,
- shadow: Ext.isDefined(this.shadow) ? this.shadow : 'sides',
- shadowOffset: this.shadowOffset,
+ var me = this;
+
+ me.floating = true;
+ me.el = Ext.create('Ext.Layer', Ext.apply({}, config, {
+ hideMode: me.hideMode,
+ hidden: me.hidden,
+ shadow: Ext.isDefined(me.shadow) ? me.shadow : 'sides',
+ shadowOffset: me.shadowOffset,
constrain: false,
- shim: this.shim === false ? false : undefined
- }), this.el);
+ shim: me.shim === false ? false : undefined
+ }), me.el);
},
onFloatRender: function() {
@@ -21887,9 +20450,11 @@ Ext.define('Ext.util.Floating', {
},
onFloatParentHide: function() {
- if (this.hideOnParentHide !== false) {
- this.showOnParentShow = this.isVisible();
- this.hide();
+ var me = this;
+
+ if (me.hideOnParentHide !== false) {
+ me.showOnParentShow = me.isVisible();
+ me.hide();
}
},
@@ -21923,7 +20488,7 @@ Ext.define('Ext.util.Floating', {
setZIndex: function(index) {
var me = this;
- this.el.setZIndex(index);
+ me.el.setZIndex(index);
index += 10;
@@ -21939,7 +20504,7 @@ Ext.define('Ext.util.Floating', {
doConstrain: function(constrainTo) {
var me = this,
- vector = me.getConstrainVector(constrainTo),
+ vector = me.getConstrainVector(constrainTo || me.el.getScopeParent()),
xy;
if (vector) {
@@ -21998,18 +20563,20 @@ Ext.define('Ext.util.Floating', {
setActive: function(active, newActive) {
+ var me = this;
+
if (active) {
- if ((this instanceof Ext.window.Window) && !this.maximized) {
- this.el.enableShadow(true);
+ if (me.el.shadow && !me.maximized) {
+ me.el.enableShadow(true);
}
- this.fireEvent('activate', this);
+ me.fireEvent('activate', me);
} else {
- if ((this instanceof Ext.window.Window) && (newActive instanceof Ext.window.Window)) {
- this.el.disableShadow();
+ if ((me instanceof Ext.window.Window) && (newActive instanceof Ext.window.Window)) {
+ me.el.disableShadow();
}
- this.fireEvent('deactivate', this);
+ me.fireEvent('deactivate', me);
}
},
@@ -22021,9 +20588,10 @@ Ext.define('Ext.util.Floating', {
center: function() {
- var xy = this.el.getAlignToXY(this.container, 'c-c');
- this.setPagePosition(xy);
- return this;
+ var me = this,
+ xy = me.el.getAlignToXY(me.container, 'c-c');
+ me.setPagePosition(xy);
+ return me;
},
@@ -22043,52 +20611,198 @@ Ext.define('Ext.util.Floating', {
}
});
+Ext.define('Ext.layout.Layout', {
-Ext.define('Ext.layout.container.AbstractContainer', {
+
- extend: 'Ext.layout.Layout',
+ isLayout: true,
+ initialized: false,
+
+ statics: {
+ create: function(layout, defaultType) {
+ var type;
+ if (layout instanceof Ext.layout.Layout) {
+ return Ext.createByAlias('layout.' + layout);
+ } else {
+ if (!layout || typeof layout === 'string') {
+ type = layout || defaultType;
+ layout = {};
+ }
+ else {
+ type = layout.type || defaultType;
+ }
+ return Ext.createByAlias('layout.' + type, layout || {});
+ }
+ }
+ },
+
+ constructor : function(config) {
+ this.id = Ext.id(null, this.type + '-');
+ Ext.apply(this, config);
+ },
+ layout : function() {
+ var me = this;
+ me.layoutBusy = true;
+ me.initLayout();
- type: 'container',
+ if (me.beforeLayout.apply(me, arguments) !== false) {
+ me.layoutCancelled = false;
+ me.onLayout.apply(me, arguments);
+ me.childrenChanged = false;
+ me.owner.needsLayout = false;
+ me.layoutBusy = false;
+ me.afterLayout.apply(me, arguments);
+ }
+ else {
+ me.layoutCancelled = true;
+ }
+ me.layoutBusy = false;
+ me.doOwnerCtLayouts();
+ },
+
+ beforeLayout : function() {
+ this.renderChildren();
+ return true;
+ },
+
+ renderChildren: function () {
+ this.renderItems(this.getLayoutItems(), this.getRenderTarget());
+ },
- bindToOwnerCtComponent: false,
+ renderItems : function(items, target) {
+ var me = this,
+ ln = items.length,
+ i = 0,
+ item;
+
+ for (; i < ln; i++) {
+ item = items[i];
+ if (item && !item.rendered) {
+ me.renderItem(item, target, i);
+ } else if (!me.isValidParent(item, target, i)) {
+ me.moveItem(item, target, i);
+ } else {
+
+ me.configureItem(item);
+ }
+ }
+ },
- bindToOwnerCtContainer: false,
+ isValidParent : function(item, target, position) {
+ var dom = item.el ? item.el.dom : Ext.getDom(item);
+ if (dom && target && target.dom) {
+ if (Ext.isNumber(position) && dom !== target.dom.childNodes[position]) {
+ return false;
+ }
+ return (dom.parentNode == (target.dom || target));
+ }
+ return false;
+ },
+ 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);
+ me.configureItem(item);
+ me.childrenChanged = true;
+ }
+ },
- setItemSize: function(item, width, height) {
- if (Ext.isObject(width)) {
- height = width.height;
- width = width.width;
+ moveItem : function(item, target, position) {
+
+ target = target.dom || target;
+ if (typeof position == 'number') {
+ position = target.childNodes[position];
}
- item.setCalculatedSize(width, height, this.owner);
+ target.insertBefore(item.el.dom, position || null);
+ item.container = Ext.get(target);
+ this.configureItem(item);
+ this.childrenChanged = true;
},
- getLayoutItems: function() {
- return this.owner && this.owner.items && this.owner.items.items || [];
+ initLayout : function() {
+ var me = this,
+ targetCls = me.targetCls;
+
+ if (!me.initialized && !Ext.isEmpty(targetCls)) {
+ me.getTarget().addCls(targetCls);
+ }
+ me.initialized = true;
},
- afterLayout: function() {
- this.owner.afterLayout(this);
+
+ setOwner : function(owner) {
+ this.owner = owner;
},
+
- getTarget: function() {
- return this.owner.getTargetEl();
- },
+ getLayoutItems : function() {
+ return [];
+ },
+
- getRenderTarget: function() {
- return this.owner.getTargetEl();
- }
-});
+ configureItem: Ext.emptyFn,
+
+
+ onLayout : Ext.emptyFn,
+ afterLayout : Ext.emptyFn,
+ onRemove : Ext.emptyFn,
+ onDestroy : Ext.emptyFn,
+ doOwnerCtLayouts : Ext.emptyFn,
+
+
+ afterRemove : function(item) {
+ var el = item.el,
+ owner = this.owner,
+ itemCls = this.itemCls,
+ ownerCls = owner.itemCls;
+
+
+ if (item.rendered && !item.isDestroyed) {
+ if (itemCls) {
+ el.removeCls(itemCls);
+ }
+ if (ownerCls) {
+ el.removeCls(ownerCls);
+ }
+ }
+
+
+
+
+ delete item.layoutManagedWidth;
+ delete item.layoutManagedHeight;
+ },
+
+ destroy : function() {
+ var targetCls = this.targetCls,
+ target;
+
+ if (!Ext.isEmpty(targetCls)) {
+ target = this.getTarget();
+ if (target) {
+ target.removeCls(targetCls);
+ }
+ }
+ this.onDestroy();
+ }
+});
Ext.define('Ext.ZIndexManager', {
@@ -22170,7 +20884,7 @@ Ext.define('Ext.ZIndexManager', {
_setActiveChild: function(comp) {
- if (comp != this.front) {
+ if (comp !== this.front) {
if (this.front) {
this.front.setActive(false, comp);
@@ -22179,7 +20893,7 @@ Ext.define('Ext.ZIndexManager', {
if (comp) {
comp.setActive(true);
if (comp.modal) {
- this._showModalMask(comp.el.getStyle('zIndex') - 4);
+ this._showModalMask(comp);
}
}
}
@@ -22204,7 +20918,7 @@ Ext.define('Ext.ZIndexManager', {
if (comp.modal) {
- this._showModalMask(comp.el.getStyle('zIndex') - 4);
+ this._showModalMask(comp);
return;
}
}
@@ -22218,23 +20932,36 @@ Ext.define('Ext.ZIndexManager', {
}
},
- _showModalMask: function(zIndex) {
+ _showModalMask: function(comp) {
+ var zIndex = comp.el.getStyle('zIndex') - 4,
+ maskTarget = comp.floatParent ? comp.floatParent.getTargetEl() : Ext.get(comp.getEl().dom.parentNode),
+ parentBox;
+
+ if (!maskTarget) {
+ return;
+ }
+
+ parentBox = maskTarget.getBox();
+
if (!this.mask) {
- this.mask = this.targetEl.createChild({
+ this.mask = Ext.getBody().createChild({
cls: Ext.baseCSSPrefix + 'mask'
});
- this.mask.setVisibilityMode(Ext.core.Element.DISPLAY);
+ this.mask.setVisibilityMode(Ext.Element.DISPLAY);
this.mask.on('click', this._onMaskClick, this);
}
- Ext.getBody().addCls(Ext.baseCSSPrefix + 'body-masked');
- this.mask.setSize(this.targetEl.getViewSize(true));
+ if (maskTarget.dom === document.body) {
+ parentBox.height = Ext.Element.getViewHeight();
+ }
+ maskTarget.addCls(Ext.baseCSSPrefix + 'body-masked');
+ this.mask.setBox(parentBox);
this.mask.setStyle('zIndex', zIndex);
this.mask.show();
},
_hideModalMask: function() {
- if (this.mask) {
- Ext.getBody().removeCls(Ext.baseCSSPrefix + 'body-masked');
+ if (this.mask && this.mask.dom.parentNode) {
+ Ext.get(this.mask.dom.parentNode).removeCls(Ext.baseCSSPrefix + 'body-masked');
this.mask.hide();
}
},
@@ -22247,7 +20974,7 @@ Ext.define('Ext.ZIndexManager', {
_onContainerResize: function() {
if (this.mask && this.mask.isVisible()) {
- this.mask.setSize(this.targetEl.getViewSize(true));
+ this.mask.setSize(Ext.get(this.mask.dom.parentNode).getViewSize(true));
}
},
@@ -22284,16 +21011,14 @@ Ext.define('Ext.ZIndexManager', {
bringToFront : function(comp) {
comp = this.get(comp);
- if (comp != this.front) {
+ if (comp !== this.front) {
Ext.Array.remove(this.zIndexStack, comp);
this.zIndexStack.push(comp);
this.assignZIndices();
return true;
}
if (comp.modal) {
- Ext.getBody().addCls(Ext.baseCSSPrefix + 'body-masked');
- this.mask.setSize(Ext.core.Element.getViewWidth(true), Ext.core.Element.getViewHeight(true));
- this.mask.show();
+ this._showModalMask(comp);
}
return false;
},
@@ -22411,6 +21136,9 @@ Ext.define('Ext.ZIndexManager', {
},
destroy: function() {
+ this.each(function(c) {
+ c.destroy();
+ });
delete this.zIndexStack;
delete this.list;
delete this.container;
@@ -22451,7 +21179,7 @@ Ext.define('Ext.util.KeyMap', {
constructor: function(el, binding, eventName){
var me = this;
-
+
Ext.apply(me, {
el: Ext.get(el),
eventName: eventName || me.eventName,
@@ -22462,7 +21190,7 @@ Ext.define('Ext.util.KeyMap', {
}
me.enable();
},
-
+
eventName: 'keydown',
@@ -22471,7 +21199,7 @@ Ext.define('Ext.util.KeyMap', {
Ext.each(binding, this.addBinding, this);
return;
}
-
+
var keyCode = binding.key,
processed = false,
key,
@@ -22482,52 +21210,52 @@ Ext.define('Ext.util.KeyMap', {
if (Ext.isString(keyCode)) {
keys = [];
- keyString = keyCode.toLowerCase();
-
+ keyString = keyCode.toUpperCase();
+
for (i = 0, len = keyString.length; i < len; ++i){
keys.push(keyString.charCodeAt(i));
}
keyCode = keys;
processed = true;
}
-
+
if (!Ext.isArray(keyCode)) {
keyCode = [keyCode];
}
-
+
if (!processed) {
for (i = 0, len = keyCode.length; i < len; ++i) {
key = keyCode[i];
if (Ext.isString(key)) {
- keyCode[i] = key.toLowerCase().charCodeAt(0);
+ keyCode[i] = key.toUpperCase().charCodeAt(0);
}
}
}
-
+
this.bindings.push(Ext.apply({
keyCode: keyCode
}, binding));
},
-
+
handleKeyDown: function(event) {
if (this.enabled) {
var bindings = this.bindings,
i = 0,
len = bindings.length;
-
+
event = this.processEvent(event);
for(; i < len; ++i){
this.processBinding(bindings[i], event);
}
}
},
-
+
processEvent: function(event){
return event;
},
-
+
processBinding: function(binding, event){
if (this.checkModifiers(binding, event)) {
@@ -22539,8 +21267,8 @@ Ext.define('Ext.util.KeyMap', {
i,
len,
keydownEvent = new Ext.EventObjectImpl(event);
-
-
+
+
for (i = 0, len = keyCode.length; i < len; ++i) {
if (key === keyCode[i]) {
if (handler.call(scope, key, event) !== true && defaultEventAction) {
@@ -22551,14 +21279,14 @@ Ext.define('Ext.util.KeyMap', {
}
}
},
-
+
checkModifiers: function(binding, e){
var keys = ['shift', 'ctrl', 'alt'],
i = 0,
len = keys.length,
val, key;
-
+
for (; i < len; ++i){
key = keys[i];
val = binding[key];
@@ -22597,17 +21325,21 @@ Ext.define('Ext.util.KeyMap', {
enable: function(){
- if(!this.enabled){
- this.el.on(this.eventName, this.handleKeyDown, this);
- this.enabled = true;
+ var me = this;
+
+ if (!me.enabled) {
+ me.el.on(me.eventName, me.handleKeyDown, me);
+ me.enabled = true;
}
},
disable: function(){
- if(this.enabled){
- this.el.removeListener(this.eventName, this.handleKeyDown, this);
- this.enabled = false;
+ var me = this;
+
+ if (me.enabled) {
+ me.el.removeListener(me.eventName, me.handleKeyDown, me);
+ me.enabled = false;
}
},
@@ -22619,11 +21351,11 @@ Ext.define('Ext.util.KeyMap', {
this.enable();
}
},
-
+
destroy: function(removeEl){
var me = this;
-
+
me.bindings = [];
me.disable();
if (removeEl === true) {
@@ -22814,140 +21546,253 @@ Ext.define('Ext.util.ClickRepeater', {
});
-Ext.define('Ext.layout.component.Button', {
+Ext.define('Ext.layout.component.Component', {
- alias: ['layout.button'],
-
- extend: 'Ext.layout.component.Component',
+ extend: 'Ext.layout.Layout',
- type: 'button',
-
- cellClsRE: /-btn-(tl|br)\b/,
- htmlRE: /<.*>/,
+ type: 'component',
- beforeLayout: function() {
- return this.callParent(arguments) || this.lastText !== this.owner.text;
- },
+ monitorChildren: true,
-
- onLayout: function(width, height) {
+ initLayout : function() {
var me = this,
- isNum = Ext.isNumber,
owner = me.owner,
- 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;
+ ownerEl = owner.el;
- me.getTargetInfo();
+ if (!me.initialized) {
+ if (owner.frameSize) {
+ me.frameSize = owner.frameSize;
+ }
+ else {
+ owner.frameSize = me.frameSize = {
+ top: 0,
+ left: 0,
+ bottom: 0,
+ right: 0
+ };
+ }
+ }
me.callParent(arguments);
+ },
- btnInnerEl.unclip();
- me.setTargetSize(width, height);
+ beforeLayout : function(width, height, isSetSize, callingContainer) {
+ this.callParent(arguments);
- if (!isNum(width)) {
-
-
-
- if (owner.text && Ext.isIE7 && Ext.isStrict && btnEl && btnEl.getWidth() > 20) {
- btnFrameWidth = me.btnFrameWidth;
- metrics = Ext.util.TextMetrics.measure(btnInnerEl, owner.text);
- ownerEl.setWidth(metrics.width + btnFrameWidth + me.adjWidth);
- btnEl.setWidth(metrics.width + btnFrameWidth);
- btnInnerEl.setWidth(metrics.width + btnFrameWidth);
+ var me = this,
+ owner = me.owner,
+ ownerCt = owner.ownerCt,
+ layout = owner.layout,
+ isVisible = owner.isVisible(true),
+ ownerElChild = owner.el.child,
+ layoutCollection;
- if (sizeIconEl) {
- btnIconEl.setWidth(metrics.width + btnFrameWidth);
- }
- } else {
-
- ownerEl.setWidth(null);
- btnEl.setWidth(null);
- btnInnerEl.setWidth(null);
- btnIconEl.setWidth(null);
- }
+
+ me.previousComponentSize = me.lastComponentSize;
+
+ if (!isSetSize
+ && ((!Ext.isNumber(width) && owner.isFixedWidth()) ||
+ (!Ext.isNumber(height) && owner.isFixedHeight()))
- if (minWidth || maxWidth) {
- ownerWidth = ownerEl.getWidth();
- if (minWidth && (ownerWidth < minWidth)) {
- me.setTargetSize(minWidth, height);
- }
- else if (maxWidth && (ownerWidth > maxWidth)) {
- btnInnerEl.clip();
- me.setTargetSize(maxWidth, height);
- }
+ && callingContainer && callingContainer !== ownerCt) {
+
+ me.doContainerLayout();
+ return false;
+ }
+
+
+
+ if (!isVisible && (owner.hiddenAncestor || owner.floating)) {
+ if (owner.hiddenAncestor) {
+ layoutCollection = owner.hiddenAncestor.layoutOnShow;
+ layoutCollection.remove(owner);
+ layoutCollection.add(owner);
}
+ owner.needsLayout = {
+ width: width,
+ height: height,
+ isSetSize: false
+ };
}
- this.lastText = owner.text;
+ if (isVisible && this.needsLayout(width, height)) {
+ return owner.beforeComponentLayout(width, height, isSetSize, callingContainer);
+ }
+ else {
+ return false;
+ }
},
- setTargetSize: function(width, height) {
+
+ needsLayout : function(width, height) {
var me = this,
- owner = me.owner,
- isNum = Ext.isNumber,
- btnInnerEl = owner.btnInnerEl,
- btnWidth = (isNum(width) ? width - me.adjWidth : width),
- btnHeight = (isNum(height) ? height - me.adjHeight : height),
- btnFrameHeight = me.btnFrameHeight,
- text = owner.getText(),
- textHeight;
-
- me.callParent(arguments);
- me.setElementSize(owner.btnEl, btnWidth, btnHeight);
- me.setElementSize(btnInnerEl, btnWidth, btnHeight);
- if (isNum(btnHeight)) {
- btnInnerEl.setStyle('line-height', btnHeight - btnFrameHeight + 'px');
- }
+ widthBeingChanged,
+ heightBeingChanged;
+ me.lastComponentSize = me.lastComponentSize || {
+ width: -Infinity,
+ height: -Infinity
+ };
+ widthBeingChanged = !Ext.isDefined(width) || me.lastComponentSize.width !== width;
+
+ heightBeingChanged = !Ext.isDefined(height) || me.lastComponentSize.height !== height;
+
+
+ return !me.isSizing && (me.childrenChanged || widthBeingChanged || heightBeingChanged);
+ },
+
+
+ setElementSize: function(el, width, height) {
+ if (width !== undefined && height !== undefined) {
+ el.setSize(width, height);
+ }
+ else if (height !== undefined) {
+ el.setHeight(height);
+ }
+ else if (width !== undefined) {
+ el.setWidth(width);
+ }
+ },
+
+
+ getTarget : function() {
+ return this.owner.el;
+ },
+
+
+ getRenderTarget : function() {
+ return this.owner.el;
+ },
+
+
+ setTargetSize : function(width, height) {
+ var me = this;
+ me.setElementSize(me.owner.el, width, height);
+
+ if (me.owner.frameBody) {
+ var targetInfo = me.getTargetInfo(),
+ padding = targetInfo.padding,
+ border = targetInfo.border,
+ frameSize = me.frameSize;
+
+ me.setElementSize(me.owner.frameBody,
+ Ext.isNumber(width) ? (width - frameSize.left - frameSize.right - padding.left - padding.right - border.left - border.right) : width,
+ Ext.isNumber(height) ? (height - frameSize.top - frameSize.bottom - padding.top - padding.bottom - border.top - border.bottom) : height
+ );
+ }
+
+ me.autoSized = {
+ width: !Ext.isNumber(width),
+ height: !Ext.isNumber(height)
+ };
+
+ me.lastComponentSize = {
+ width: width,
+ height: height
+ };
+ },
+
+ getTargetInfo : function() {
+ if (!this.targetInfo) {
+ var target = this.getTarget(),
+ body = this.owner.getTargetEl();
+
+ this.targetInfo = {
+ padding: {
+ top: target.getPadding('t'),
+ right: target.getPadding('r'),
+ bottom: target.getPadding('b'),
+ left: target.getPadding('l')
+ },
+ border: {
+ top: target.getBorderWidth('t'),
+ right: target.getBorderWidth('r'),
+ bottom: target.getBorderWidth('b'),
+ left: target.getBorderWidth('l')
+ },
+ bodyMargin: {
+ top: body.getMargin('t'),
+ right: body.getMargin('r'),
+ bottom: body.getMargin('b'),
+ left: body.getMargin('l')
+ }
+ };
+ }
+ return this.targetInfo;
+ },
+
+
+ doOwnerCtLayouts: function() {
+ var owner = this.owner,
+ ownerCt = owner.ownerCt,
+ ownerCtComponentLayout, ownerCtContainerLayout,
+ curSize = this.lastComponentSize,
+ prevSize = this.previousComponentSize,
+ widthChange = (prevSize && curSize && Ext.isNumber(curSize.width )) ? curSize.width !== prevSize.width : true,
+ heightChange = (prevSize && curSize && Ext.isNumber(curSize.height)) ? curSize.height !== prevSize.height : true;
+
-
- if (text && this.htmlRE.test(text)) {
- btnInnerEl.setStyle('line-height', 'normal');
- textHeight = Ext.util.TextMetrics.measure(btnInnerEl, text).height;
- btnInnerEl.setStyle('padding-top', me.btnFrameTop + Math.max(btnInnerEl.getHeight() - btnFrameHeight - textHeight, 0) / 2 + 'px');
- me.setElementSize(btnInnerEl, btnWidth, btnHeight);
+ 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) {
+
+
+ if (((widthChange && !ownerCt.isFixedWidth()) || (heightChange && !ownerCt.isFixedHeight()))) {
+
+ this.isSizing = true;
+ ownerCt.doComponentLayout();
+ this.isSizing = false;
+ }
+
+ else if (ownerCtContainerLayout.bindToOwnerCtContainer === true) {
+ ownerCtContainerLayout.layout();
+ }
+ }
}
},
- getTargetInfo: function() {
+ doContainerLayout: function() {
var me = this,
owner = me.owner,
- ownerEl = owner.el,
- frameSize = me.frameSize,
- frameBody = owner.frameBody,
- btnWrap = owner.btnWrap,
- innerEl = owner.btnInnerEl;
+ ownerCt = owner.ownerCt,
+ layout = owner.layout,
+ ownerCtComponentLayout;
- if (!('adjWidth' in me)) {
- Ext.apply(me, {
-
- adjWidth: frameSize.left + frameSize.right + ownerEl.getBorderWidth('lr') + ownerEl.getPadding('lr') +
- btnWrap.getPadding('lr') + (frameBody ? frameBody.getFrameWidth('lr') : 0),
- adjHeight: frameSize.top + frameSize.bottom + ownerEl.getBorderWidth('tb') + ownerEl.getPadding('tb') +
- btnWrap.getPadding('tb') + (frameBody ? frameBody.getFrameWidth('tb') : 0),
- btnFrameWidth: innerEl.getFrameWidth('lr'),
- btnFrameHeight: innerEl.getFrameWidth('tb'),
- btnFrameTop: innerEl.getFrameWidth('t')
- });
+
+
+ if (!owner.suspendLayout && layout && layout.isLayout && !layout.layoutBusy && !layout.isAutoDock) {
+ layout.layout();
}
- return me.callParent();
+
+ if (ownerCt && ownerCt.componentLayout) {
+ ownerCtComponentLayout = ownerCt.componentLayout;
+ if (!owner.floating && ownerCtComponentLayout.monitorChildren && !ownerCtComponentLayout.layoutBusy) {
+ ownerCtComponentLayout.childrenChanged = true;
+ }
+ }
+ },
+
+ afterLayout : function(width, height, isSetSize, layoutOwner) {
+ this.doContainerLayout();
+ this.owner.afterComponentLayout(width, height, isSetSize, layoutOwner);
}
});
+
Ext.define('Ext.util.TextMetrics', {
statics: {
shared: null,
@@ -23033,7 +21878,7 @@ Ext.define('Ext.util.TextMetrics', {
delete me.measure;
}
}, function(){
- Ext.core.Element.addMethods({
+ Ext.Element.addMethods({
getTextWidth : function(text, min, max){
return Ext.Number.constrain(Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width, min || 0, max || 1000000);
@@ -23047,7 +21892,7 @@ Ext.define('Ext.layout.container.boxOverflow.Scroller', {
extend: 'Ext.layout.container.boxOverflow.None',
- requires: ['Ext.util.ClickRepeater', 'Ext.core.Element'],
+ requires: ['Ext.util.ClickRepeater', 'Ext.Element'],
alternateClassName: 'Ext.layout.boxOverflow.Scroller',
mixins: {
observable: 'Ext.util.Observable'
@@ -23185,8 +22030,8 @@ Ext.define('Ext.layout.container.boxOverflow.Scroller', {
before.addClsOnOver(this.beforeScrollerCls + '-hover');
after.addClsOnOver(this.afterScrollerCls + '-hover');
- before.setVisibilityMode(Ext.core.Element.DISPLAY);
- after.setVisibilityMode(Ext.core.Element.DISPLAY);
+ before.setVisibilityMode(Ext.Element.DISPLAY);
+ after.setVisibilityMode(Ext.Element.DISPLAY);
this.beforeRepeater = Ext.create('Ext.util.ClickRepeater', before, {
interval: this.scrollRepeatInterval,
@@ -23829,7 +22674,7 @@ Ext.define('Ext.fx.target.Component', {
o = meth.setPagePosition;
o.target.setPagePosition(o.x, o.y);
}
- if (meth.setSize.target) {
+ if (meth.setSize.target && meth.setSize.target.el) {
o = meth.setSize;
w = (o.width === undefined) ? o.target.getWidth() : parseInt(o.width, 10);
@@ -24175,6 +23020,7 @@ Ext.define('Ext.dd.StatusProxy', {
this.id = this.id || Ext.id();
this.proxy = Ext.createWidget('component', {
floating: true,
+ stateful: false,
id: this.id,
html: '<div class="' + Ext.baseCSSPrefix + 'dd-drop-icon"></div>' +
'<div class="' + Ext.baseCSSPrefix + 'dd-drag-ghost"></div>',
@@ -24185,7 +23031,7 @@ Ext.define('Ext.dd.StatusProxy', {
this.el = this.proxy.el;
this.el.show();
- this.el.setVisibilityMode(Ext.core.Element.VISIBILITY);
+ this.el.setVisibilityMode(Ext.Element.VISIBILITY);
this.el.hide();
this.ghost = Ext.get(this.el.dom.childNodes[1]);
@@ -24223,7 +23069,7 @@ Ext.define('Ext.dd.StatusProxy', {
html.style.margin = "0";
this.ghost.dom.appendChild(html);
}
- var el = this.ghost.dom.firstChild;
+ var el = this.ghost.dom.firstChild;
if(el){
Ext.fly(el).setStyle('float', 'none');
}
@@ -24304,7 +23150,7 @@ Ext.define('Ext.dd.StatusProxy', {
});
Ext.define('Ext.panel.Proxy', {
-
+
alternateClassName: 'Ext.dd.PanelProxy',
@@ -24358,7 +23204,7 @@ Ext.define('Ext.panel.Proxy', {
show: function(){
if (!this.ghost) {
var panelSize = this.panel.getSize();
- this.panel.el.setVisibilityMode(Ext.core.Element.DISPLAY);
+ this.panel.el.setVisibilityMode(Ext.Element.DISPLAY);
this.ghost = this.panel.ghost();
if (this.insertProxy) {
@@ -24495,6 +23341,10 @@ Ext.define('Ext.layout.component.AbstractDock', {
onLayout: function(width, height) {
+ if (this.onLayout_running) {
+ return;
+ }
+ this.onLayout_running = true;
var me = this,
owner = me.owner,
body = owner.body,
@@ -24529,20 +23379,20 @@ Ext.define('Ext.layout.component.AbstractDock', {
}
- if (height === undefined || height === null || width === undefined || width === null) {
+ if (height == null || width == null) {
padding = info.padding;
border = info.border;
frameSize = me.frameSize;
- if ((height === undefined || height === null) && (width === undefined || width === null)) {
+ if ((height == null) && (width == null)) {
autoHeight = true;
autoWidth = true;
me.setTargetSize(null);
me.setBodyBox({width: null, height: null});
}
- else if (height === undefined || height === null) {
+ else if (height == null) {
autoHeight = true;
me.setTargetSize(width);
@@ -24577,6 +23427,8 @@ Ext.define('Ext.layout.component.AbstractDock', {
info.autoSizedCtLayout = layout.autoSize === true;
+ info.autoHeight = autoHeight;
+ info.autoWidth = autoWidth;
}
@@ -24584,7 +23436,7 @@ Ext.define('Ext.layout.component.AbstractDock', {
- me.dockItems(autoWidth, autoHeight);
+ me.dockItems();
me.setTargetSize(info.size.width, info.size.height);
}
else {
@@ -24592,28 +23444,32 @@ Ext.define('Ext.layout.component.AbstractDock', {
me.dockItems();
}
me.callParent(arguments);
+ this.onLayout_running = false;
},
- dockItems : function(autoWidth, autoHeight) {
- this.calculateDockBoxes(autoWidth, autoHeight);
+ dockItems : function() {
+ this.calculateDockBoxes();
var info = this.info,
+ autoWidth = info.autoWidth,
+ autoHeight = info.autoHeight,
boxes = info.boxes,
ln = boxes.length,
- dock, i;
+ dock, i, item;
for (i = 0; i < ln; i++) {
dock = boxes[i];
- dock.item.setPosition(dock.x, dock.y);
- if ((autoWidth || autoHeight) && dock.layout && dock.layout.isLayout) {
+ item = dock.item;
+ item.setPosition(dock.x, dock.y);
+ if ((autoWidth || autoHeight) && item.layout && item.layout.isLayout) {
- dock.layout.bindToOwnerCtComponent = true;
+ item.layout.bindToOwnerCtComponent = true;
}
}
@@ -24634,7 +23490,12 @@ Ext.define('Ext.layout.component.AbstractDock', {
},
- calculateDockBoxes : function(autoWidth, autoHeight) {
+ calculateDockBoxes : function() {
+ if (this.calculateDockBoxes_running) {
+
+ return;
+ }
+ this.calculateDockBoxes_running = true;
@@ -24644,6 +23505,8 @@ Ext.define('Ext.layout.component.AbstractDock', {
owner = me.owner,
bodyEl = owner.body,
info = me.info,
+ autoWidth = info.autoWidth,
+ autoHeight = info.autoHeight,
size = info.size,
ln = items.length,
padding = info.padding,
@@ -24693,6 +23556,7 @@ Ext.define('Ext.layout.component.AbstractDock', {
info.boxes.push(box);
}
+ this.calculateDockBoxes_running = false;
},
@@ -24796,20 +23660,20 @@ 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 {
+ if (info.autoHeight) {
size.height += box.height;
+ } else {
+ bodyBox.height -= box.height;
}
}
break;
case 'bottom':
if (!box.overlay) {
- if (owner.isFixedHeight()) {
- bodyBox.height -= box.height;
- } else {
+ if (info.autoHeight) {
size.height += box.height;
+ } else {
+ bodyBox.height -= box.height;
}
}
box.y = (bodyBox.y + bodyBox.height);
@@ -24819,20 +23683,20 @@ Ext.define('Ext.layout.component.AbstractDock', {
box.x = bodyBox.x;
if (!box.overlay) {
bodyBox.x += box.width;
- if (owner.isFixedWidth()) {
- bodyBox.width -= box.width;
- } else {
+ if (info.autoWidth) {
size.width += box.width;
+ } else {
+ bodyBox.width -= box.width;
}
}
break;
case 'right':
if (!box.overlay) {
- if (owner.isFixedWidth()) {
- bodyBox.width -= box.width;
- } else {
+ if (info.autoWidth) {
size.width += box.width;
+ } else {
+ bodyBox.width -= box.width;
}
}
box.x = (bodyBox.x + bodyBox.width);
@@ -24870,7 +23734,7 @@ Ext.define('Ext.layout.component.AbstractDock', {
item: item,
overlay: item.overlay,
type: item.dock,
- offsets: Ext.core.Element.parseBox(item.offsets || {}),
+ offsets: Ext.Element.parseBox(item.offsets || {}),
ignoreFrame: item.ignoreParentFrame
};
@@ -24912,10 +23776,10 @@ Ext.define('Ext.layout.component.AbstractDock', {
- if (box.width == undefined) {
+ if (box.width === undefined) {
box.width = item.getWidth() + item.el.getMargin('lr');
}
- if (box.height == undefined) {
+ if (box.height === undefined) {
box.height = item.getHeight() + item.el.getMargin('tb');
}
@@ -24949,7 +23813,7 @@ Ext.define('Ext.layout.component.AbstractDock', {
cn = Ext.get(cns[i]);
for (j = 0; j < ln; j++) {
item = items[j];
- if (item.rendered && (cn.id == item.el.id || cn.down('#' + item.el.id))) {
+ if (item.rendered && (cn.id == item.el.id || cn.contains(item.el.id))) {
break;
}
}
@@ -25143,12 +24007,12 @@ Ext.define('Ext.app.EventBus', {
mixins: {
observable: 'Ext.util.Observable'
},
-
+
constructor: function() {
this.mixins.observable.constructor.call(this);
-
+
this.bus = {};
-
+
var me = this;
Ext.override(Ext.Component, {
fireEvent: function(ev) {
@@ -25164,7 +24028,7 @@ Ext.define('Ext.app.EventBus', {
var bus = this.bus,
selectors = bus[ev],
selector, controllers, id, events, event, i, ln;
-
+
if (selectors) {
for (selector in selectors) {
@@ -25187,11 +24051,11 @@ Ext.define('Ext.app.EventBus', {
}
}
},
-
+
control: function(selectors, listeners, controller) {
var bus = this.bus,
selector, fn;
-
+
if (Ext.isString(selectors)) {
selector = selectors;
selectors = {};
@@ -25199,13 +24063,13 @@ Ext.define('Ext.app.EventBus', {
this.control(selectors, null, controller);
return;
}
-
+
Ext.Object.each(selectors, function(selector, listeners) {
Ext.Object.each(listeners, function(ev, listener) {
- var options = {},
+ var options = {},
scope = controller,
event = Ext.create('Ext.util.Event', controller, ev);
-
+
if (Ext.isObject(listener)) {
options = listener;
@@ -25214,14 +24078,14 @@ Ext.define('Ext.app.EventBus', {
delete options.fn;
delete options.scope;
}
-
+
event.addListener(listener, scope, options);
bus[ev] = bus[ev] || {};
bus[ev][selector] = bus[ev][selector] || {};
- bus[ev][selector][controller.id] = bus[ev][selector][controller.id] || [];
-
+ bus[ev][selector][controller.id] = bus[ev][selector][controller.id] || [];
+
bus[ev][selector][controller.id].push(event);
});
@@ -25234,11 +24098,11 @@ Ext.define('Ext.data.Types', {
requires: ['Ext.data.SortTypes']
}, function() {
var st = Ext.data.SortTypes;
-
+
Ext.apply(Ext.data.Types, {
stripRe: /[\$,%]/g,
-
+
AUTO: {
convert: function(v) {
@@ -25267,7 +24131,7 @@ Ext.define('Ext.data.Types', {
sortType: st.none,
type: 'int'
},
-
+
FLOAT: {
convert: function(v) {
@@ -25277,11 +24141,11 @@ Ext.define('Ext.data.Types', {
sortType: st.none,
type: 'float'
},
-
+
BOOL: {
convert: function(v) {
- if (this.useNull && v === undefined || v === null || v === '') {
+ if (this.useNull && (v === undefined || v === null || v === '')) {
return null;
}
return v === true || v === 'true' || v == 1;
@@ -25289,11 +24153,13 @@ Ext.define('Ext.data.Types', {
sortType: st.none,
type: 'bool'
},
-
+
DATE: {
convert: function(v) {
- var df = this.dateFormat;
+ var df = this.dateFormat,
+ parsed;
+
if (!v) {
return null;
}
@@ -25309,24 +24175,24 @@ Ext.define('Ext.data.Types', {
}
return Ext.Date.parse(v, df);
}
-
- var parsed = Date.parse(v);
+
+ parsed = Date.parse(v);
return parsed ? new Date(parsed) : null;
},
sortType: st.asDate,
type: 'date'
}
});
-
+
Ext.apply(Ext.data.Types, {
BOOLEAN: this.BOOL,
-
+
INTEGER: this.INT,
+
-
- NUMBER: this.FLOAT
+ NUMBER: this.FLOAT
});
});
@@ -25370,6 +24236,7 @@ Ext.define('Ext.data.Field', {
+
dateFormat: null,
@@ -25378,20 +24245,856 @@ Ext.define('Ext.data.Field', {
defaultValue: "",
+
mapping: null,
+
sortType : null,
+
sortDir : "ASC",
+
allowBlank : true,
-
+
persist: true
});
+Ext.define('Ext.util.AbstractMixedCollection', {
+ requires: ['Ext.util.Filter'],
+
+ mixins: {
+ observable: 'Ext.util.Observable'
+ },
+
+ constructor: function(allowFunctions, keyFn) {
+ var me = this;
+
+ me.items = [];
+ me.map = {};
+ me.keys = [];
+ me.length = 0;
+
+ me.addEvents(
+
+ 'clear',
+
+
+ 'add',
+
+
+ 'replace',
+
+
+ 'remove'
+ );
+
+ me.allowFunctions = allowFunctions === true;
+
+ if (keyFn) {
+ me.getKey = keyFn;
+ }
+
+ me.mixins.observable.constructor.call(me);
+ },
+
+
+ allowFunctions : false,
+
+
+ add : function(key, obj){
+ var me = this,
+ myObj = obj,
+ myKey = key,
+ old;
+
+ if (arguments.length == 1) {
+ myObj = myKey;
+ myKey = me.getKey(myObj);
+ }
+ if (typeof myKey != 'undefined' && myKey !== null) {
+ old = me.map[myKey];
+ if (typeof old != 'undefined') {
+ return me.replace(myKey, myObj);
+ }
+ me.map[myKey] = myObj;
+ }
+ me.length++;
+ me.items.push(myObj);
+ me.keys.push(myKey);
+ me.fireEvent('add', me.length - 1, myObj, myKey);
+ return myObj;
+ },
+
+
+ getKey : function(o){
+ return o.id;
+ },
+
+
+ replace : function(key, o){
+ var me = this,
+ old,
+ index;
+
+ if (arguments.length == 1) {
+ o = arguments[0];
+ key = me.getKey(o);
+ }
+ old = me.map[key];
+ if (typeof key == 'undefined' || key === null || typeof old == 'undefined') {
+ return me.add(key, o);
+ }
+ index = me.indexOfKey(key);
+ me.items[index] = o;
+ me.map[key] = o;
+ me.fireEvent('replace', key, old, o);
+ return o;
+ },
+
+
+ addAll : function(objs){
+ var me = this,
+ i = 0,
+ args,
+ len,
+ key;
+
+ if (arguments.length > 1 || Ext.isArray(objs)) {
+ args = arguments.length > 1 ? arguments : objs;
+ for (len = args.length; i < len; i++) {
+ me.add(args[i]);
+ }
+ } else {
+ for (key in objs) {
+ if (objs.hasOwnProperty(key)) {
+ if (me.allowFunctions || typeof objs[key] != 'function') {
+ me.add(key, objs[key]);
+ }
+ }
+ }
+ }
+ },
+
+
+ each : function(fn, scope){
+ var items = [].concat(this.items),
+ i = 0,
+ len = items.length,
+ item;
+
+ for (; i < len; i++) {
+ item = items[i];
+ if (fn.call(scope || item, item, i, len) === false) {
+ break;
+ }
+ }
+ },
+
+
+ eachKey : function(fn, scope){
+ var keys = this.keys,
+ items = this.items,
+ i = 0,
+ len = keys.length;
+
+ for (; i < len; i++) {
+ fn.call(scope || window, keys[i], items[i], i, len);
+ }
+ },
+
+
+ findBy : function(fn, scope) {
+ var keys = this.keys,
+ items = this.items,
+ i = 0,
+ len = items.length;
+
+ for (; i < len; i++) {
+ if (fn.call(scope || window, items[i], keys[i])) {
+ return items[i];
+ }
+ }
+ return null;
+ },
+
+ find : function() {
+ if (Ext.isDefined(Ext.global.console)) {
+ Ext.global.console.warn('Ext.util.MixedCollection: find has been deprecated. Use findBy instead.');
+ }
+ return this.findBy.apply(this, arguments);
+ },
+
+
+ insert : function(index, key, obj){
+ var me = this,
+ myKey = key,
+ myObj = obj;
+
+ if (arguments.length == 2) {
+ myObj = myKey;
+ myKey = me.getKey(myObj);
+ }
+ if (me.containsKey(myKey)) {
+ me.suspendEvents();
+ me.removeAtKey(myKey);
+ me.resumeEvents();
+ }
+ if (index >= me.length) {
+ return me.add(myKey, myObj);
+ }
+ me.length++;
+ Ext.Array.splice(me.items, index, 0, myObj);
+ if (typeof myKey != 'undefined' && myKey !== null) {
+ me.map[myKey] = myObj;
+ }
+ Ext.Array.splice(me.keys, index, 0, myKey);
+ me.fireEvent('add', index, myObj, myKey);
+ return myObj;
+ },
+
+
+ remove : function(o){
+ return this.removeAt(this.indexOf(o));
+ },
+
+
+ removeAll : function(items){
+ Ext.each(items || [], function(item) {
+ this.remove(item);
+ }, this);
+
+ return this;
+ },
+
+
+ removeAt : function(index){
+ var me = this,
+ o,
+ key;
+
+ if (index < me.length && index >= 0) {
+ me.length--;
+ o = me.items[index];
+ Ext.Array.erase(me.items, index, 1);
+ key = me.keys[index];
+ if (typeof key != 'undefined') {
+ delete me.map[key];
+ }
+ Ext.Array.erase(me.keys, index, 1);
+ me.fireEvent('remove', o, key);
+ return o;
+ }
+ return false;
+ },
+
+
+ removeAtKey : function(key){
+ return this.removeAt(this.indexOfKey(key));
+ },
+
+
+ getCount : function(){
+ return this.length;
+ },
+
+
+ indexOf : function(o){
+ return Ext.Array.indexOf(this.items, o);
+ },
+
+
+ indexOfKey : function(key){
+ return Ext.Array.indexOf(this.keys, key);
+ },
+
+
+ get : function(key) {
+ var me = this,
+ mk = me.map[key],
+ item = mk !== undefined ? mk : (typeof key == 'number') ? me.items[key] : undefined;
+ return typeof item != 'function' || me.allowFunctions ? item : null;
+ },
+
+
+ getAt : function(index) {
+ return this.items[index];
+ },
+
+
+ getByKey : function(key) {
+ return this.map[key];
+ },
+
+
+ contains : function(o){
+ return Ext.Array.contains(this.items, o);
+ },
+
+
+ containsKey : function(key){
+ return typeof this.map[key] != 'undefined';
+ },
+
+
+ clear : function(){
+ var me = this;
+
+ me.length = 0;
+ me.items = [];
+ me.keys = [];
+ me.map = {};
+ me.fireEvent('clear');
+ },
+
+
+ first : function() {
+ return this.items[0];
+ },
+
+
+ last : function() {
+ return this.items[this.length - 1];
+ },
+
+
+ sum: function(property, root, start, end) {
+ var values = this.extractValues(property, root),
+ length = values.length,
+ sum = 0,
+ i;
+
+ start = start || 0;
+ end = (end || end === 0) ? end : length - 1;
+
+ for (i = start; i <= end; i++) {
+ sum += values[i];
+ }
+
+ return sum;
+ },
+
+
+ collect: function(property, root, allowNull) {
+ var values = this.extractValues(property, root),
+ length = values.length,
+ hits = {},
+ unique = [],
+ value, strValue, i;
+
+ for (i = 0; i < length; i++) {
+ value = values[i];
+ strValue = String(value);
+
+ if ((allowNull || !Ext.isEmpty(value)) && !hits[strValue]) {
+ hits[strValue] = true;
+ unique.push(value);
+ }
+ }
+
+ return unique;
+ },
+
+
+ extractValues: function(property, root) {
+ var values = this.items;
+
+ if (root) {
+ values = Ext.Array.pluck(values, root);
+ }
+
+ return Ext.Array.pluck(values, property);
+ },
+
+
+ getRange : function(start, end){
+ var me = this,
+ items = me.items,
+ range = [],
+ i;
+
+ if (items.length < 1) {
+ return range;
+ }
+
+ start = start || 0;
+ end = Math.min(typeof end == 'undefined' ? me.length - 1 : end, me.length - 1);
+ if (start <= end) {
+ for (i = start; i <= end; i++) {
+ range[range.length] = items[i];
+ }
+ } else {
+ for (i = start; i >= end; i--) {
+ range[range.length] = items[i];
+ }
+ }
+ return range;
+ },
+
+
+ filter : function(property, value, anyMatch, caseSensitive) {
+ var filters = [],
+ filterFn;
+
+
+ if (Ext.isString(property)) {
+ filters.push(Ext.create('Ext.util.Filter', {
+ property : property,
+ value : value,
+ anyMatch : anyMatch,
+ caseSensitive: caseSensitive
+ }));
+ } else if (Ext.isArray(property) || property instanceof Ext.util.Filter) {
+ filters = filters.concat(property);
+ }
+
+
+
+ filterFn = function(record) {
+ var isMatch = true,
+ length = filters.length,
+ i;
+
+ for (i = 0; i < length; i++) {
+ var filter = filters[i],
+ fn = filter.filterFn,
+ scope = filter.scope;
+
+ isMatch = isMatch && fn.call(scope, record);
+ }
+
+ return isMatch;
+ };
+
+ return this.filterBy(filterFn);
+ },
+
+
+ filterBy : function(fn, scope) {
+ var me = this,
+ newMC = new this.self(),
+ keys = me.keys,
+ items = me.items,
+ length = items.length,
+ i;
+
+ newMC.getKey = me.getKey;
+
+ for (i = 0; i < length; i++) {
+ if (fn.call(scope || me, items[i], keys[i])) {
+ newMC.add(keys[i], items[i]);
+ }
+ }
+
+ return newMC;
+ },
+
+
+ findIndex : function(property, value, start, anyMatch, caseSensitive){
+ if(Ext.isEmpty(value, false)){
+ return -1;
+ }
+ value = this.createValueMatcher(value, anyMatch, caseSensitive);
+ return this.findIndexBy(function(o){
+ return o && value.test(o[property]);
+ }, null, start);
+ },
+
+
+ findIndexBy : function(fn, scope, start){
+ var me = this,
+ keys = me.keys,
+ items = me.items,
+ i = start || 0,
+ len = items.length;
+
+ for (; i < len; i++) {
+ if (fn.call(scope || me, items[i], keys[i])) {
+ return i;
+ }
+ }
+ return -1;
+ },
+
+
+ createValueMatcher : function(value, anyMatch, caseSensitive, exactMatch) {
+ if (!value.exec) {
+ var er = Ext.String.escapeRegex;
+ value = String(value);
+
+ if (anyMatch === true) {
+ value = er(value);
+ } else {
+ value = '^' + er(value);
+ if (exactMatch === true) {
+ value += '$';
+ }
+ }
+ value = new RegExp(value, caseSensitive ? '' : 'i');
+ }
+ return value;
+ },
+
+
+ clone : function() {
+ var me = this,
+ copy = new this.self(),
+ keys = me.keys,
+ items = me.items,
+ i = 0,
+ len = items.length;
+
+ for(; i < len; i++){
+ copy.add(keys[i], items[i]);
+ }
+ copy.getKey = me.getKey;
+ return copy;
+ }
+});
+
+
+Ext.define("Ext.util.Sortable", {
+
+ isSortable: true,
+
+
+ defaultSortDirection: "ASC",
+
+ requires: [
+ 'Ext.util.Sorter'
+ ],
+
+
+
+
+ initSortable: function() {
+ var me = this,
+ sorters = me.sorters;
+
+
+ me.sorters = Ext.create('Ext.util.AbstractMixedCollection', false, function(item) {
+ return item.id || item.property;
+ });
+
+ if (sorters) {
+ me.sorters.addAll(me.decodeSorters(sorters));
+ }
+ },
+
+
+ sort: function(sorters, direction, where, doSort) {
+ var me = this,
+ sorter, sorterFn,
+ newSorters;
+
+ if (Ext.isArray(sorters)) {
+ doSort = where;
+ where = direction;
+ newSorters = sorters;
+ }
+ else if (Ext.isObject(sorters)) {
+ doSort = where;
+ where = direction;
+ newSorters = [sorters];
+ }
+ else if (Ext.isString(sorters)) {
+ sorter = me.sorters.get(sorters);
+
+ if (!sorter) {
+ sorter = {
+ property : sorters,
+ direction: direction
+ };
+ newSorters = [sorter];
+ }
+ else if (direction === undefined) {
+ sorter.toggle();
+ }
+ else {
+ sorter.setDirection(direction);
+ }
+ }
+
+ if (newSorters && newSorters.length) {
+ newSorters = me.decodeSorters(newSorters);
+ if (Ext.isString(where)) {
+ if (where === 'prepend') {
+ sorters = me.sorters.clone().items;
+
+ me.sorters.clear();
+ me.sorters.addAll(newSorters);
+ me.sorters.addAll(sorters);
+ }
+ else {
+ me.sorters.addAll(newSorters);
+ }
+ }
+ else {
+ me.sorters.clear();
+ me.sorters.addAll(newSorters);
+ }
+ }
+
+ if (doSort !== false) {
+ me.onBeforeSort(newSorters);
+
+ sorters = me.sorters.items;
+ if (sorters.length) {
+
+ sorterFn = function(r1, r2) {
+ var result = sorters[0].sort(r1, r2),
+ length = sorters.length,
+ i;
+
+
+ for (i = 1; i < length; i++) {
+ result = result || sorters[i].sort.call(this, r1, r2);
+ }
+
+ return result;
+ };
+
+ me.doSort(sorterFn);
+ }
+ }
+
+ return sorters;
+ },
+
+ onBeforeSort: Ext.emptyFn,
+
+
+ decodeSorters: function(sorters) {
+ if (!Ext.isArray(sorters)) {
+ if (sorters === undefined) {
+ sorters = [];
+ } else {
+ sorters = [sorters];
+ }
+ }
+
+ var length = sorters.length,
+ Sorter = Ext.util.Sorter,
+ fields = this.model ? this.model.prototype.fields : null,
+ field,
+ config, i;
+
+ for (i = 0; i < length; i++) {
+ config = sorters[i];
+
+ if (!(config instanceof Sorter)) {
+ if (Ext.isString(config)) {
+ config = {
+ property: config
+ };
+ }
+
+ Ext.applyIf(config, {
+ root : this.sortRoot,
+ direction: "ASC"
+ });
+
+
+ if (config.fn) {
+ config.sorterFn = config.fn;
+ }
+
+
+ if (typeof config == 'function') {
+ config = {
+ sorterFn: config
+ };
+ }
+
+
+ if (fields && !config.transform) {
+ field = fields.get(config.property);
+ config.transform = field ? field.sortType : undefined;
+ }
+ sorters[i] = Ext.create('Ext.util.Sorter', config);
+ }
+ }
+
+ return sorters;
+ },
+
+ getSorters: function() {
+ return this.sorters.items;
+ }
+});
+
+Ext.define('Ext.util.MixedCollection', {
+ extend: 'Ext.util.AbstractMixedCollection',
+ mixins: {
+ sortable: 'Ext.util.Sortable'
+ },
+
+
+ constructor: function() {
+ var me = this;
+ me.callParent(arguments);
+ me.addEvents('sort');
+ me.mixins.sortable.initSortable.call(me);
+ },
+
+ doSort: function(sorterFn) {
+ this.sortBy(sorterFn);
+ },
+
+
+ _sort : function(property, dir, fn){
+ var me = this,
+ i, len,
+ dsc = String(dir).toUpperCase() == 'DESC' ? -1 : 1,
+
+
+ c = [],
+ keys = me.keys,
+ items = me.items;
+
+
+ fn = fn || function(a, b) {
+ return a - b;
+ };
+
+
+ for(i = 0, len = items.length; i < len; i++){
+ c[c.length] = {
+ key : keys[i],
+ value: items[i],
+ index: i
+ };
+ }
+
+
+ Ext.Array.sort(c, function(a, b){
+ var v = fn(a[property], b[property]) * dsc;
+ if(v === 0){
+ v = (a.index < b.index ? -1 : 1);
+ }
+ return v;
+ });
+
+
+ for(i = 0, len = c.length; i < len; i++){
+ items[i] = c[i].value;
+ keys[i] = c[i].key;
+ }
+
+ me.fireEvent('sort', me);
+ },
+
+
+ sortBy: function(sorterFn) {
+ var me = this,
+ items = me.items,
+ keys = me.keys,
+ length = items.length,
+ temp = [],
+ i;
+
+
+ for (i = 0; i < length; i++) {
+ temp[i] = {
+ key : keys[i],
+ value: items[i],
+ index: i
+ };
+ }
+
+ Ext.Array.sort(temp, function(a, b) {
+ var v = sorterFn(a.value, b.value);
+ if (v === 0) {
+ v = (a.index < b.index ? -1 : 1);
+ }
+
+ return v;
+ });
+
+
+ for (i = 0; i < length; i++) {
+ items[i] = temp[i].value;
+ keys[i] = temp[i].key;
+ }
+
+ me.fireEvent('sort', me, items, keys);
+ },
+
+
+ reorder: function(mapping) {
+ var me = this,
+ items = me.items,
+ index = 0,
+ length = items.length,
+ order = [],
+ remaining = [],
+ oldIndex;
+
+ me.suspendEvents();
+
+
+ for (oldIndex in mapping) {
+ order[mapping[oldIndex]] = items[oldIndex];
+ }
+
+ for (index = 0; index < length; index++) {
+ if (mapping[index] == undefined) {
+ remaining.push(items[index]);
+ }
+ }
+
+ for (index = 0; index < length; index++) {
+ if (order[index] == undefined) {
+ order[index] = remaining.shift();
+ }
+ }
+
+ me.clear();
+ me.addAll(order);
+
+ me.resumeEvents();
+ me.fireEvent('sort', me);
+ },
+
+
+ sortByKey : function(dir, fn){
+ this._sort('key', dir, fn || function(a, b){
+ var v1 = String(a).toUpperCase(), v2 = String(b).toUpperCase();
+ return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
+ });
+ }
+});
+
+
+Ext.define('Ext.data.Errors', {
+ extend: 'Ext.util.MixedCollection',
+
+
+ isValid: function() {
+ return this.length === 0;
+ },
+
+
+ getByField: function(fieldName) {
+ var errors = [],
+ error, field, i;
+
+ for (i = 0; i < this.length; i++) {
+ error = this.items[i];
+
+ if (error.field == fieldName) {
+ errors.push(error);
+ }
+ }
+
+ return errors;
+ }
+});
+
+
Ext.define('Ext.data.reader.Reader', {
requires: ['Ext.data.ResultSet'],
alternateClassName: ['Ext.data.Reader', 'Ext.data.DataReader'],
@@ -25724,14 +25427,14 @@ Ext.define('Ext.data.reader.Json', {
extend: 'Ext.data.reader.Reader',
alternateClassName: 'Ext.data.JsonReader',
alias : 'reader.json',
-
+
root: '',
+
-
-
+
useSimpleAccessors: false,
-
+
readRecords: function(data) {
@@ -25746,8 +25449,9 @@ Ext.define('Ext.data.reader.Json', {
getResponseData: function(response) {
+ var data;
try {
- var data = Ext.decode(response.responseText);
+ data = Ext.decode(response.responseText);
}
catch (ex) {
Ext.Error.raise({
@@ -25764,7 +25468,7 @@ Ext.define('Ext.data.reader.Json', {
buildExtractors : function() {
var me = this;
-
+
me.callParent(arguments);
if (me.root) {
@@ -25775,16 +25479,21 @@ Ext.define('Ext.data.reader.Json', {
};
}
},
-
+
extractData: function(root) {
var recordName = this.record,
data = [],
length, i;
-
+
if (recordName) {
length = root.length;
+ if (!length && Ext.isObject(root)) {
+ length = 1;
+ root = [root];
+ }
+
for (i = 0; i < length; i++) {
data[i] = root[i][recordName];
}
@@ -25797,7 +25506,7 @@ Ext.define('Ext.data.reader.Json', {
createAccessor: function() {
var re = /[\[\.]/;
-
+
return function(expr) {
if (Ext.isEmpty(expr)) {
return Ext.emptyFn;
@@ -25891,6 +25600,10 @@ Ext.define('Ext.data.proxy.Proxy', {
+
+
+
+
isProxy: true,
@@ -26046,97 +25759,92 @@ Ext.define('Ext.data.proxy.Server', {
alias : 'proxy.server',
alternateClassName: 'Ext.data.ServerProxy',
uses : ['Ext.data.Request'],
+
-
-
-
-
-
-
+
pageParam: 'page',
-
+
startParam: 'start',
limitParam: 'limit',
-
+
groupParam: 'group',
-
+
sortParam: 'sort',
-
+
filterParam: 'filter',
-
+
directionParam: 'dir',
-
+
simpleSortMode: false,
-
+
noCache : true,
-
+
cacheString: "_dc",
-
+
timeout : 30000,
+
-
-
-
+
constructor: function(config) {
var me = this;
-
+
config = config || {};
this.addEvents(
'exception'
);
me.callParent([config]);
-
+
me.extraParams = config.extraParams || {};
-
+
me.api = config.api || {};
-
+
me.nocache = me.noCache;
},
-
+
create: function() {
return this.doRequest.apply(this, arguments);
},
-
+
read: function() {
return this.doRequest.apply(this, arguments);
},
-
+
update: function() {
return this.doRequest.apply(this, arguments);
},
-
+
destroy: function() {
return this.doRequest.apply(this, arguments);
},
-
+
buildRequest: function(operation) {
var params = Ext.applyIf(operation.params || {}, this.extraParams || {}),
request;
+
-
- params = Ext.applyIf(params, this.getParams(params, operation));
-
+ params = Ext.applyIf(params, this.getParams(operation));
+
if (operation.id && !params.id) {
params.id = operation.id;
}
-
+
request = Ext.create('Ext.data.Request', {
params : params,
action : operation.action,
@@ -26144,51 +25852,33 @@ Ext.define('Ext.data.proxy.Server', {
operation: operation,
url : operation.url
});
-
+
request.url = this.buildUrl(request);
-
+
operation.request = request;
-
+
return request;
},
-
+
processResponse: function(success, operation, request, response, callback, scope){
var me = this,
reader,
- result,
- records,
- length,
- mc,
- record,
- i;
-
+ result;
+
if (success === true) {
reader = me.getReader();
result = reader.read(me.extractResponseData(response));
- records = result.records;
- length = records.length;
-
+
if (result.success !== false) {
- mc = Ext.create('Ext.util.MixedCollection', true, function(r) {return r.getId();});
- mc.addAll(operation.records);
- for (i = 0; i < length; i++) {
- record = mc.get(records[i].getId());
-
- if (record) {
- record.beginEdit();
- record.set(record.data);
- record.endEdit(true);
- }
- }
-
Ext.apply(operation, {
response: response,
resultSet: result
});
-
+
+ operation.commitRecords(result.records);
operation.setCompleted();
operation.setSuccessful();
} else {
@@ -26197,41 +25887,41 @@ Ext.define('Ext.data.proxy.Server', {
}
} else {
me.setException(operation, response);
- me.fireEvent('exception', this, response, operation);
+ me.fireEvent('exception', this, response, operation);
}
-
+
if (typeof callback == 'function') {
callback.call(scope || me, operation);
}
-
+
me.afterRequest(request, success);
},
-
+
setException: function(operation, response){
operation.setException({
status: response.status,
statusText: response.statusText
- });
+ });
},
-
+
extractResponseData: function(response){
- return response;
+ return response;
},
-
+
applyEncoding: function(value){
return Ext.encode(value);
},
-
+
encodeSorters: function(sorters) {
var min = [],
length = sorters.length,
i = 0;
-
+
for (; i < length; i++) {
min[i] = {
property : sorters[i].property,
@@ -26239,15 +25929,15 @@ Ext.define('Ext.data.proxy.Server', {
};
}
return this.applyEncoding(min);
-
+
},
-
+
encodeFilters: function(filters) {
var min = [],
length = filters.length,
i = 0;
-
+
for (; i < length; i++) {
min[i] = {
property: filters[i].property,
@@ -26256,12 +25946,11 @@ Ext.define('Ext.data.proxy.Server', {
}
return this.applyEncoding(min);
},
+
-
- getParams: function(params, operation) {
- params = params || {};
-
+ getParams: function(operation) {
var me = this,
+ params = {},
isDef = Ext.isDefined,
groupers = operation.groupers,
sorters = operation.sorters,
@@ -26269,34 +25958,34 @@ Ext.define('Ext.data.proxy.Server', {
page = operation.page,
start = operation.start,
limit = operation.limit,
-
+
simpleSortMode = me.simpleSortMode,
-
+
pageParam = me.pageParam,
startParam = me.startParam,
limitParam = me.limitParam,
groupParam = me.groupParam,
sortParam = me.sortParam,
filterParam = me.filterParam,
- directionParam = me.directionParam;
-
+ directionParam = me.directionParam;
+
if (pageParam && isDef(page)) {
params[pageParam] = page;
}
-
+
if (startParam && isDef(start)) {
params[startParam] = start;
}
-
+
if (limitParam && isDef(limit)) {
params[limitParam] = limit;
}
-
+
if (groupParam && groupers && groupers.length > 0) {
params[groupParam] = me.encodeSorters(groupers);
}
-
+
if (sortParam && sorters && sorters.length > 0) {
if (simpleSortMode) {
params[sortParam] = sorters[0].property;
@@ -26304,41 +25993,41 @@ Ext.define('Ext.data.proxy.Server', {
} else {
params[sortParam] = me.encodeSorters(sorters);
}
-
+
}
-
+
if (filterParam && filters && filters.length > 0) {
params[filterParam] = me.encodeFilters(filters);
}
-
+
return params;
},
-
+
buildUrl: function(request) {
var me = this,
url = me.getUrl(request);
-
-
+
+
if (me.noCache) {
url = Ext.urlAppend(url, Ext.String.format("{0}={1}", me.cacheString, Ext.Date.now()));
}
-
+
return url;
},
-
+
getUrl: function(request){
return request.url || this.api[request.action] || this.url;
},
-
+
doRequest: function(operation, callback, scope) {
},
-
+
afterRequest: Ext.emptyFn,
-
+
onDestroy: function() {
Ext.destroy(this.reader, this.writer);
}
@@ -26405,13 +26094,14 @@ Ext.define('Ext.data.proxy.Ajax', {
Ext.define('Ext.data.Model', {
alternateClassName: 'Ext.data.Record',
-
+
mixins: {
observable: 'Ext.util.Observable'
},
requires: [
'Ext.ModelManager',
+ 'Ext.data.IdGenerator',
'Ext.data.Field',
'Ext.data.Errors',
'Ext.data.Operation',
@@ -26434,6 +26124,7 @@ Ext.define('Ext.data.Model', {
associations = data.associations || [],
belongsTo = data.belongsTo,
hasMany = data.hasMany,
+ idgen = data.idgen,
fieldsMixedCollection = new Ext.util.MixedCollection(false, function(field) {
return field.name;
@@ -26472,6 +26163,10 @@ Ext.define('Ext.data.Model', {
data.fields = fieldsMixedCollection;
+ if (idgen) {
+ data.idgen = Ext.data.IdGenerator.get(idgen);
+ }
+
if (belongsTo) {
@@ -26619,7 +26314,20 @@ Ext.define('Ext.data.Model', {
return id;
}
},
+
+ idgen: {
+ isGenerator: true,
+ type: 'default',
+
+ generate: function () {
+ return null;
+ },
+ getRecId: function (rec) {
+ return rec.modelName + '-' + rec.internalId;
+ }
+ },
+
editing : false,
@@ -26642,30 +26350,43 @@ Ext.define('Ext.data.Model', {
defaultProxyType: 'ajax',
+
+
+
+
+
+
+
+
+
+
+
+
constructor: function(data, id, raw) {
data = data || {};
-
+
var me = this,
fields,
length,
field,
name,
i,
+ newId,
isArray = Ext.isArray(data),
newData = isArray ? {} : null;
me.internalId = (id || id === 0) ? id : Ext.data.Model.id(me);
-
+
me.raw = raw;
Ext.applyIf(me, {
- data: {}
+ data: {}
});
-
+
me.modified = {};
@@ -26685,7 +26406,7 @@ Ext.define('Ext.data.Model', {
field = fields[i];
name = field.name;
- if (isArray){
+ if (isArray){
newData[name] = data[i];
@@ -26696,39 +26417,47 @@ Ext.define('Ext.data.Model', {
}
me.set(newData || data);
-
- me.dirty = false;
- me.modified = {};
if (me.getId()) {
me.phantom = false;
+ } else if (me.phantom) {
+ newId = me.idgen.generate();
+ if (newId !== null) {
+ me.setId(newId);
+ }
}
+
+ me.dirty = false;
+ me.modified = {};
+
if (typeof me.init == 'function') {
me.init();
}
- me.id = me.modelName + '-' + me.internalId;
+ me.id = me.idgen.getRecId(me);
},
-
+
get: function(field) {
return this[this.persistenceProperty][field];
},
-
+
set: function(fieldName, value) {
var me = this,
fields = me.fields,
modified = me.modified,
convertFields = [],
- field, key, i, currentValue;
+ field, key, i, currentValue, notEditing, count, length;
if (arguments.length == 1 && Ext.isObject(fieldName)) {
+ notEditing = !me.editing;
+ count = 0;
for (key in fieldName) {
if (fieldName.hasOwnProperty(key)) {
-
+
field = fields.get(key);
@@ -26736,16 +26465,30 @@ Ext.define('Ext.data.Model', {
convertFields.push(key);
continue;
}
-
+
+ if (!count && notEditing) {
+ me.beginEdit();
+ }
+ ++count;
me.set(key, fieldName[key]);
}
}
- for (i = 0; i < convertFields.length; i++) {
- field = convertFields[i];
- me.set(field, fieldName[field]);
+ length = convertFields.length;
+ if (length) {
+ if (!count && notEditing) {
+ me.beginEdit();
+ }
+ count += length;
+ for (i = 0; i < length; i++) {
+ field = convertFields[i];
+ me.set(field, fieldName[field]);
+ }
}
+ if (notEditing && count) {
+ me.endEdit();
+ }
} else {
if (fields) {
field = fields.get(fieldName);
@@ -26756,7 +26499,7 @@ Ext.define('Ext.data.Model', {
}
currentValue = me.get(fieldName);
me[me.persistenceProperty][fieldName] = value;
-
+
if (field && field.persist && !me.isEqual(currentValue, value)) {
if (me.isModified(fieldName)) {
if (me.isEqual(modified[fieldName], value)) {
@@ -26784,7 +26527,7 @@ Ext.define('Ext.data.Model', {
}
}
},
-
+
isEqual: function(a, b){
if (Ext.isDate(a) && Ext.isDate(b)) {
@@ -26792,7 +26535,7 @@ Ext.define('Ext.data.Model', {
}
return a === b;
},
-
+
beginEdit : function(){
var me = this;
@@ -26803,7 +26546,7 @@ Ext.define('Ext.data.Model', {
me.modifiedSave = Ext.apply({}, me.modified);
}
},
-
+
cancelEdit : function(){
var me = this;
@@ -26818,22 +26561,42 @@ Ext.define('Ext.data.Model', {
delete me.dirtySave;
}
},
-
+
endEdit : function(silent){
- var me = this;
+ var me = this,
+ didChange;
+
if (me.editing) {
me.editing = false;
+ didChange = me.dirty || me.changedWhileEditing();
delete me.modifiedSave;
delete me.dataSave;
delete me.dirtySave;
- if (silent !== true && me.dirty) {
+ if (silent !== true && didChange) {
me.afterEdit();
}
}
},
+ changedWhileEditing: function(){
+ var me = this,
+ saved = me.dataSave,
+ data = me[me.persistenceProperty],
+ key;
+
+ for (key in data) {
+ if (data.hasOwnProperty(key)) {
+ if (!me.isEqual(data[key], saved[key])) {
+ return true;
+ }
+ }
+ }
+ return false;
+ },
+
+
getChanges : function(){
var modified = this.modified,
changes = {},
@@ -26847,17 +26610,17 @@ Ext.define('Ext.data.Model', {
return changes;
},
-
+
isModified : function(fieldName) {
return this.modified.hasOwnProperty(fieldName);
},
-
+
setDirty : function() {
var me = this,
name;
-
+
me.dirty = true;
me.fields.each(function(field) {
@@ -26868,7 +26631,7 @@ Ext.define('Ext.data.Model', {
}, me);
},
-
+
reject : function(silent) {
var me = this,
@@ -26895,10 +26658,8 @@ Ext.define('Ext.data.Model', {
commit : function(silent) {
var me = this;
-
- me.dirty = false;
- me.editing = false;
+ me.phantom = me.dirty = me.editing = false;
me.modified = {};
if (silent !== true) {
@@ -26909,7 +26670,7 @@ Ext.define('Ext.data.Model', {
copy : function(newId) {
var me = this;
-
+
return new me.self(Ext.apply({}, me[me.persistenceProperty]), newId || me.internalId);
},
@@ -27053,7 +26814,7 @@ Ext.define('Ext.data.Model', {
},
- unjoin: function() {
+ unjoin: function(store) {
delete this.store;
},
@@ -27149,6 +26910,96 @@ Ext.define('Ext.data.Model', {
});
+Ext.define('Ext.data.StoreManager', {
+ extend: 'Ext.util.MixedCollection',
+ alternateClassName: ['Ext.StoreMgr', 'Ext.data.StoreMgr', 'Ext.StoreManager'],
+ singleton: true,
+ uses: ['Ext.data.ArrayStore'],
+
+
+
+
+ register : function() {
+ for (var i = 0, s; (s = arguments[i]); i++) {
+ this.add(s);
+ }
+ },
+
+
+ unregister : function() {
+ for (var i = 0, s; (s = arguments[i]); i++) {
+ this.remove(this.lookup(s));
+ }
+ },
+
+
+ lookup : function(store) {
+
+ if (Ext.isArray(store)) {
+ var fields = ['field1'],
+ expand = !Ext.isArray(store[0]),
+ data = store,
+ i,
+ len;
+
+ if(expand){
+ data = [];
+ for (i = 0, len = store.length; i < len; ++i) {
+ data.push([store[i]]);
+ }
+ } else {
+ for(i = 2, len = store[0].length; i <= len; ++i){
+ fields.push('field' + i);
+ }
+ }
+ return Ext.create('Ext.data.ArrayStore', {
+ data : data,
+ fields: fields,
+ autoDestroy: true,
+ autoCreated: true,
+ expanded: expand
+ });
+ }
+
+ if (Ext.isString(store)) {
+
+ return this.get(store);
+ } else {
+
+ return Ext.data.AbstractStore.create(store);
+ }
+ },
+
+
+ getKey : function(o) {
+ return o.storeId;
+ }
+}, function() {
+
+ Ext.regStore = function(name, config) {
+ var store;
+
+ if (Ext.isObject(name)) {
+ config = name;
+ } else {
+ config.storeId = name;
+ }
+
+ if (config instanceof Ext.data.Store) {
+ store = config;
+ } else {
+ store = Ext.create('Ext.data.Store', config);
+ }
+
+ return Ext.data.StoreManager.register(store);
+ };
+
+
+ Ext.getStore = function(name) {
+ return Ext.data.StoreManager.lookup(name);
+ };
+});
+
Ext.define('Ext.Component', {
@@ -27179,7 +27030,11 @@ Ext.define('Ext.Component', {
DIRECTION_BOTTOM: 'bottom',
DIRECTION_LEFT: 'left',
- VERTICAL_DIRECTION: /^(?:top|bottom)$/
+ VERTICAL_DIRECTION_Re: /^(?:top|bottom)$/,
+
+
+
+ INVALID_ID_CHARS_Re: /[\.,\s]/g
},
@@ -27199,7 +27054,7 @@ Ext.define('Ext.Component', {
-
+
@@ -27222,13 +27077,17 @@ Ext.define('Ext.Component', {
+
+
constructor: function(config) {
+ var me = this;
+
config = config || {};
if (config.initialConfig) {
if (config.isAction) {
- this.baseAction = config;
+ me.baseAction = config;
}
config = config.initialConfig;
@@ -27241,18 +27100,21 @@ Ext.define('Ext.Component', {
};
}
- this.callParent([config]);
+ me.callParent([config]);
- if (this.baseAction){
- this.baseAction.addComponent(this);
+ if (me.baseAction){
+ me.baseAction.addComponent(me);
}
},
+
initComponent: function() {
var me = this;
+ me.callParent();
+
if (me.listeners) {
me.on(me.listeners);
delete me.listeners;
@@ -27269,7 +27131,7 @@ Ext.define('Ext.Component', {
if (me.floating) {
me.makeFloating(me.floating);
} else {
- me.el.setVisibilityMode(Ext.core.Element[me.hideMode.toUpperCase()]);
+ me.el.setVisibilityMode(Ext.Element[me.hideMode.toUpperCase()]);
}
if (Ext.isDefined(me.autoScroll)) {
@@ -27324,14 +27186,16 @@ Ext.define('Ext.Component', {
},
initResizable: function(resizable) {
+ var me = this;
+
resizable = Ext.apply({
- target: this,
+ target: me,
dynamic: false,
- constrainTo: this.constrainTo,
- handles: this.resizeHandles
+ constrainTo: me.constrainTo || (me.floatParent ? me.floatParent.getTargetEl() : me.el.getScopeParent()),
+ handles: me.resizeHandles
}, resizable);
- resizable.target = this;
- this.resizer = Ext.create('Ext.resizer.Resizer', resizable);
+ resizable.target = me;
+ me.resizer = Ext.create('Ext.resizer.Resizer', resizable);
},
getDragEl: function() {
@@ -27341,9 +27205,9 @@ Ext.define('Ext.Component', {
initDraggable: function() {
var me = this,
ddConfig = Ext.applyIf({
- el: this.getDragEl(),
- constrainTo: me.constrainTo || (me.floatParent ? me.floatParent.getTargetEl() : me.el.dom.parentNode)
- }, this.draggable);
+ el: me.getDragEl(),
+ constrainTo: me.constrain ? (me.constrainTo || (me.floatParent ? me.floatParent.getTargetEl() : me.el.getScopeParent())) : undefined
+ }, me.draggable);
if (me.constrain || me.constrainDelegate) {
@@ -27351,7 +27215,7 @@ Ext.define('Ext.Component', {
ddConfig.constrainDelegate = me.constrainDelegate;
}
- this.dd = Ext.create('Ext.util.ComponentDragger', this, ddConfig);
+ me.dd = Ext.create('Ext.util.ComponentDragger', me, ddConfig);
},
@@ -27419,14 +27283,16 @@ Ext.define('Ext.Component', {
this.fireEvent('move', this, ax, ay);
},
+
showAt: function(x, y, animate) {
-
- if (this.floating) {
- this.setPosition(x, y, animate);
+ var me = this;
+
+ if (me.floating) {
+ me.setPosition(x, y, animate);
} else {
- this.setPagePosition(x, y, animate);
+ me.setPagePosition(x, y, animate);
}
- this.show();
+ me.show();
},
@@ -27460,11 +27326,12 @@ Ext.define('Ext.Component', {
getBox : function(local){
- var pos = this.getPosition(local);
- var s = this.getSize();
- s.x = pos[0];
- s.y = pos[1];
- return s;
+ var pos = this.getPosition(local),
+ size = this.getSize();
+
+ size.x = pos[0];
+ size.y = pos[1];
+ return size;
},
@@ -27484,22 +27351,6 @@ Ext.define('Ext.Component', {
},
- adjustSize: function(w, h) {
- if (this.autoWidth) {
- w = 'auto';
- }
-
- if (this.autoHeight) {
- h = 'auto';
- }
-
- return {
- width: w,
- height: h
- };
- },
-
-
adjustPosition: function(x, y) {
@@ -27517,26 +27368,36 @@ Ext.define('Ext.Component', {
getPosition: function(local) {
- var el = this.el,
- xy;
+ var me = this,
+ el = me.el,
+ xy,
+ o;
- if (local === true) {
+
+ if ((local === true) || (me.floating && !me.floatParent)) {
return [el.getLeft(true), el.getTop(true)];
}
- xy = this.xy || el.getXY();
+ xy = me.xy || el.getXY();
- if (this.floating && this.floatParent) {
- var o = this.floatParent.getTargetEl().getViewRegion();
+ if (me.floating) {
+ o = me.floatParent.getTargetEl().getViewRegion();
xy[0] -= o.left;
xy[1] -= o.top;
}
return xy;
},
-
getId: function() {
- return this.id || (this.id = (this.getXType() || 'ext-comp') + '-' + this.getAutoId());
+ var me = this,
+ xtype;
+
+ if (!me.id) {
+ xtype = me.getXType();
+ xtype = xtype ? xtype.replace(Ext.Component.INVALID_ID_CHARS_Re, '-') : 'ext-comp';
+ me.id = xtype + '-' + me.getAutoId();
+ }
+ return me.id;
},
onEnable: function() {
@@ -27555,30 +27416,32 @@ Ext.define('Ext.Component', {
show: function(animateTarget, cb, scope) {
- if (this.rendered && this.isVisible()) {
- if (this.toFrontOnShow && this.floating) {
- this.toFront();
+ var me = this;
+
+ if (me.rendered && me.isVisible()) {
+ if (me.toFrontOnShow && me.floating) {
+ me.toFront();
}
- } else if (this.fireEvent('beforeshow', this) !== false) {
- this.hidden = false;
+ } else if (me.fireEvent('beforeshow', me) !== false) {
+ me.hidden = false;
- if (!this.rendered && (this.autoRender || this.floating)) {
- this.doAutoRender();
+ if (!me.rendered && (me.autoRender || me.floating)) {
+ me.doAutoRender();
}
- if (this.rendered) {
- this.beforeShow();
- this.onShow.apply(this, arguments);
+ if (me.rendered) {
+ me.beforeShow();
+ me.onShow.apply(me, arguments);
- if (this.ownerCt && !this.floating && !(this.ownerCt.suspendLayout || this.ownerCt.layout.layoutBusy)) {
- this.ownerCt.doLayout();
+ if (me.ownerCt && !me.floating && !(me.ownerCt.suspendLayout || me.ownerCt.layout.layoutBusy)) {
+ me.ownerCt.doLayout();
}
- this.afterShow.apply(this, arguments);
+ me.afterShow.apply(me, arguments);
}
}
- return this;
+ return me;
},
beforeShow: Ext.emptyFn,
@@ -27588,10 +27451,10 @@ Ext.define('Ext.Component', {
var me = this;
me.el.show();
- if (this.floating && this.constrain) {
- this.doConstrain();
- }
me.callParent(arguments);
+ if (me.floating && me.constrain) {
+ me.doConstrain();
+ }
},
afterShow: function(animateTarget, cb, scope) {
@@ -27612,14 +27475,13 @@ Ext.define('Ext.Component', {
animateTarget = animateTarget.el ? animateTarget.el : Ext.get(animateTarget);
toBox = me.el.getBox();
fromBox = animateTarget.getBox();
- fromBox.width += 'px';
- fromBox.height += 'px';
- toBox.width += 'px';
- toBox.height += 'px';
me.el.addCls(Ext.baseCSSPrefix + 'hide-offsets');
ghostPanel = me.ghost();
ghostPanel.el.stopAnimation();
+
+ ghostPanel.el.setX(-10000);
+
ghostPanel.el.animate({
from: fromBox,
to: toBox,
@@ -27628,43 +27490,46 @@ Ext.define('Ext.Component', {
delete ghostPanel.componentLayout.lastComponentSize;
me.unghost();
me.el.removeCls(Ext.baseCSSPrefix + 'hide-offsets');
- if (me.floating) {
- me.toFront();
- }
- Ext.callback(cb, scope || me);
+ me.onShowComplete(cb, scope);
}
}
});
}
else {
- if (me.floating) {
- me.toFront();
- }
- Ext.callback(cb, scope || me);
+ me.onShowComplete(cb, scope);
+ }
+ },
+
+ onShowComplete: function(cb, scope) {
+ var me = this;
+ if (me.floating) {
+ me.toFront();
}
+ Ext.callback(cb, scope || me);
me.fireEvent('show', me);
},
hide: function() {
+ var me = this;
- this.showOnParentShow = false;
+ me.showOnParentShow = false;
- if (!(this.rendered && !this.isVisible()) && this.fireEvent('beforehide', this) !== false) {
- this.hidden = true;
- if (this.rendered) {
- this.onHide.apply(this, arguments);
+ if (!(me.rendered && !me.isVisible()) && me.fireEvent('beforehide', me) !== false) {
+ me.hidden = true;
+ if (me.rendered) {
+ me.onHide.apply(me, arguments);
- if (this.ownerCt && !this.floating && !(this.ownerCt.suspendLayout || this.ownerCt.layout.layoutBusy)) {
- this.ownerCt.doLayout();
+ if (me.ownerCt && !me.floating && !(me.ownerCt.suspendLayout || me.ownerCt.layout.layoutBusy)) {
+ me.ownerCt.doLayout();
}
}
}
- return this;
+ return me;
},
@@ -27718,6 +27583,7 @@ Ext.define('Ext.Component', {
if (me.rendered) {
Ext.destroy(
me.proxy,
+ me.proxyWrap,
me.resizer
);
@@ -27821,11 +27687,13 @@ Ext.define('Ext.Component', {
cloneConfig: function(overrides) {
overrides = overrides || {};
- var id = overrides.id || Ext.id();
- var cfg = Ext.applyIf(overrides, this.initialConfig);
+ var id = overrides.id || Ext.id(),
+ cfg = Ext.applyIf(overrides, this.initialConfig),
+ self;
+
cfg.id = id;
- var self = Ext.getClass(this);
+ self = Ext.getClass(this);
return new self(cfg);
@@ -27868,22 +27736,82 @@ Ext.define('Ext.Component', {
},
getProxy: function() {
- if (!this.proxy) {
- this.proxy = this.el.createProxy(Ext.baseCSSPrefix + 'proxy-el', Ext.getBody(), true);
+ var me = this,
+ target;
+
+ if (!me.proxy) {
+ target = Ext.getBody();
+ if (Ext.scopeResetCSS) {
+ me.proxyWrap = target = Ext.getBody().createChild({
+ cls: Ext.baseCSSPrefix + 'reset'
+ });
+ }
+ me.proxy = me.el.createProxy(Ext.baseCSSPrefix + 'proxy-el', target, true);
}
- return this.proxy;
+ return me.proxy;
}
});
+Ext.define('Ext.layout.container.AbstractContainer', {
+
+
+
+ extend: 'Ext.layout.Layout',
+
+
+
+ type: 'container',
+
+
+ bindToOwnerCtComponent: false,
+
+
+ bindToOwnerCtContainer: false,
+
+
+
+
+ setItemSize: function(item, width, height) {
+ if (Ext.isObject(width)) {
+ height = width.height;
+ width = width.width;
+ }
+ item.setCalculatedSize(width, height, this.owner);
+ },
+
+
+ getLayoutItems: function() {
+ return this.owner && this.owner.items && this.owner.items.items || [];
+ },
+
+
+ beforeLayout: function() {
+ return !this.owner.collapsed && this.callParent(arguments);
+ },
+
+ afterLayout: function() {
+ this.owner.afterLayout(this);
+ },
+
+ getTarget: function() {
+ return this.owner.getTargetEl();
+ },
+
+ getRenderTarget: function() {
+ return this.owner.getTargetEl();
+ }
+});
+
+
Ext.define('Ext.layout.container.Container', {
extend: 'Ext.layout.container.AbstractContainer',
alternateClassName: 'Ext.layout.ContainerLayout',
-
+
layoutItem: function(item, box) {
@@ -27961,7 +27889,6 @@ Ext.define('Ext.layout.container.Container', {
}
});
-
Ext.define('Ext.layout.container.Auto', {
@@ -28048,7 +27975,7 @@ Ext.define('Ext.container.AbstractContainer', {
bubbleEvents: ['add', 'remove'],
-
+
initComponent : function(){
var me = this;
@@ -28062,11 +27989,7 @@ Ext.define('Ext.container.AbstractContainer', {
'add',
- 'remove',
-
- 'beforecardswitch',
-
- 'cardswitch'
+ 'remove'
);
@@ -28200,12 +28123,8 @@ Ext.define('Ext.container.AbstractContainer', {
if (Ext.isString(config)) {
config = Ext.ComponentManager.get(config);
- Ext.applyIf(config, defaults);
- } else if (!config.isComponent) {
- Ext.applyIf(config, defaults);
- } else {
- Ext.applyIf(config, defaults);
}
+ Ext.applyIf(config, defaults);
}
return config;
@@ -28258,8 +28177,8 @@ Ext.define('Ext.container.AbstractContainer', {
me.suspendLayout = true;
for (i = 0, ln = items.length; i < ln; i++) {
item = items[i];
-
-
+
+
if (index != -1) {
item = me.add(index + i, item);
} else {
@@ -28293,15 +28212,6 @@ Ext.define('Ext.container.AbstractContainer', {
return cmp;
},
-
- registerFloatingItem: function(cmp) {
- var me = this;
- if (!me.floatingItems) {
- me.floatingItems = Ext.create('Ext.ZIndexManager', me);
- }
- me.floatingItems.register(cmp);
- },
-
onAdd : Ext.emptyFn,
onRemove : Ext.emptyFn,
@@ -28326,7 +28236,7 @@ Ext.define('Ext.container.AbstractContainer', {
onBeforeAdd : function(item) {
var me = this;
-
+
if (item.ownerCt) {
item.ownerCt.remove(item, false);
}
@@ -28473,11 +28383,13 @@ Ext.define('Ext.container.AbstractContainer', {
query : function(selector) {
+ selector = selector || '*';
return Ext.ComponentQuery.query(selector, this);
},
child : function(selector) {
+ selector = selector || '';
return this.query('> ' + selector)[0] || null;
},
@@ -28511,8 +28423,8 @@ Ext.define('Ext.container.AbstractContainer', {
}
}
layoutCollection.clear();
- },
-
+ },
+
//@private
@@ -28520,12 +28432,12 @@ Ext.define('Ext.container.AbstractContainer', {
Ext.Array.each(this.query('[isFormField]'), function(item) {
if (item.resetDisable) {
item.enable();
- delete item.resetDisable;
+ delete item.resetDisable;
}
});
this.callParent();
},
-
+
onDisable: function() {
@@ -28556,13 +28468,13 @@ Ext.define('Ext.container.AbstractContainer', {
}
Ext.destroy(
- me.layout,
- me.floatingItems
+ me.layout
);
me.callParent();
}
});
+
Ext.define('Ext.container.Container', {
extend: 'Ext.container.AbstractContainer',
alias: 'widget.container',
@@ -28709,10 +28621,16 @@ Ext.define('Ext.menu.Manager', {
onMouseDown: function(e) {
var me = this,
active = me.active,
- lastShow = me.lastShow;
+ lastShow = me.lastShow,
+ target = e.target;
if (Ext.Date.getElapsed(lastShow) > 50 && active.length > 0 && !e.getTarget('.' + Ext.baseCSSPrefix + 'menu')) {
me.hideAll();
+
+
+ if (Ext.isIE && Ext.fly(target).focusable()) {
+ target.focus();
+ }
}
},
@@ -28814,6 +28732,140 @@ Ext.define('Ext.menu.Manager', {
}
});
+Ext.define('Ext.layout.component.Button', {
+
+
+
+ alias: ['layout.button'],
+
+ extend: 'Ext.layout.component.Component',
+
+
+
+ type: 'button',
+
+ cellClsRE: /-btn-(tl|br)\b/,
+ htmlRE: /<.*>/,
+
+ beforeLayout: function() {
+ return this.callParent(arguments) || this.lastText !== this.owner.text;
+ },
+
+
+ onLayout: function(width, height) {
+ var me = this,
+ isNum = Ext.isNumber,
+ owner = me.owner,
+ 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;
+
+ me.getTargetInfo();
+ me.callParent(arguments);
+
+ btnInnerEl.unclip();
+ me.setTargetSize(width, height);
+
+ if (!isNum(width)) {
+
+
+
+ if (owner.text && (Ext.isIE6 || Ext.isIE7) && Ext.isStrict && btnEl && btnEl.getWidth() > 20) {
+ btnFrameWidth = me.btnFrameWidth;
+ metrics = Ext.util.TextMetrics.measure(btnInnerEl, owner.text);
+ 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);
+ }
+
+
+ if (minWidth || maxWidth) {
+ ownerWidth = ownerEl.getWidth();
+ if (minWidth && (ownerWidth < minWidth)) {
+ me.setTargetSize(minWidth, height);
+ }
+ else if (maxWidth && (ownerWidth > maxWidth)) {
+ btnInnerEl.clip();
+ me.setTargetSize(maxWidth, height);
+ }
+ }
+ }
+
+ this.lastText = owner.text;
+ },
+
+ setTargetSize: function(width, height) {
+ var me = this,
+ owner = me.owner,
+ isNum = Ext.isNumber,
+ btnInnerEl = owner.btnInnerEl,
+ btnWidth = (isNum(width) ? width - me.adjWidth : width),
+ btnHeight = (isNum(height) ? height - me.adjHeight : height),
+ btnFrameHeight = me.btnFrameHeight,
+ text = owner.getText(),
+ textHeight;
+
+ me.callParent(arguments);
+ me.setElementSize(owner.btnEl, btnWidth, btnHeight);
+ me.setElementSize(btnInnerEl, btnWidth, btnHeight);
+ if (btnHeight >= 0) {
+ btnInnerEl.setStyle('line-height', btnHeight - btnFrameHeight + 'px');
+ }
+
+
+
+
+
+
+ if (text && this.htmlRE.test(text)) {
+ btnInnerEl.setStyle('line-height', 'normal');
+ textHeight = Ext.util.TextMetrics.measure(btnInnerEl, text).height;
+ btnInnerEl.setStyle('padding-top', me.btnFrameTop + Math.max(btnInnerEl.getHeight() - btnFrameHeight - textHeight, 0) / 2 + 'px');
+ me.setElementSize(btnInnerEl, btnWidth, btnHeight);
+ }
+ },
+
+ getTargetInfo: function() {
+ var me = this,
+ owner = me.owner,
+ ownerEl = owner.el,
+ frameSize = me.frameSize,
+ frameBody = owner.frameBody,
+ btnWrap = owner.btnWrap,
+ innerEl = owner.btnInnerEl;
+
+ if (!('adjWidth' in me)) {
+ Ext.apply(me, {
+
+ adjWidth: frameSize.left + frameSize.right + ownerEl.getBorderWidth('lr') + ownerEl.getPadding('lr') +
+ btnWrap.getPadding('lr') + (frameBody ? frameBody.getFrameWidth('lr') : 0),
+ adjHeight: frameSize.top + frameSize.bottom + ownerEl.getBorderWidth('tb') + ownerEl.getPadding('tb') +
+ btnWrap.getPadding('tb') + (frameBody ? frameBody.getFrameWidth('tb') : 0),
+ btnFrameWidth: innerEl.getFrameWidth('lr'),
+ btnFrameHeight: innerEl.getFrameWidth('tb'),
+ btnFrameTop: innerEl.getFrameWidth('t')
+ });
+ }
+
+ return me.callParent();
+ }
+});
+
Ext.define('Ext.button.Button', {
@@ -28878,6 +28930,9 @@ Ext.define('Ext.button.Button', {
menuAlign: 'tl-bl?',
+ textAlign: 'center',
+
+
@@ -28886,7 +28941,7 @@ Ext.define('Ext.button.Button', {
clickEvent: 'click',
-
+
preventDefault: true,
@@ -28901,52 +28956,54 @@ Ext.define('Ext.button.Button', {
pressedCls: 'pressed',
-
+
overCls: 'over',
-
+
focusCls: 'focus',
-
+
menuActiveCls: 'menu-active',
+
+
-
+
ariaRole: 'button',
renderTpl:
- '<em class="{splitCls}">' +
+ '<em id="{id}-btnWrap" class="{splitCls}">' +
'<tpl if="href">' +
- '<a href="{href}" target="{target}"<tpl if="tabIndex"> tabIndex="{tabIndex}"</tpl> role="link">' +
- '<span class="{baseCls}-inner">' +
+ '<a id="{id}-btnEl" href="{href}" target="{target}"<tpl if="tabIndex"> tabIndex="{tabIndex}"</tpl> role="link">' +
+ '<span id="{id}-btnInnerEl" class="{baseCls}-inner">' +
'{text}' +
'</span>' +
- '<span class="{baseCls}-icon"></span>' +
+ '<span id="{id}-btnIconEl" class="{baseCls}-icon"></span>' +
'</a>' +
'</tpl>' +
'<tpl if="!href">' +
- '<button type="{type}" hidefocus="true"' +
+ '<button id="{id}-btnEl" type="{type}" hidefocus="true"' +
'<tpl if="tabIndex"> tabIndex="{tabIndex}"</tpl> role="button" autocomplete="off">' +
- '<span class="{baseCls}-inner" style="{innerSpanStyle}">' +
+ '<span id="{id}-btnInnerEl" class="{baseCls}-inner" style="{innerSpanStyle}">' +
'{text}' +
'</span>' +
- '<span class="{baseCls}-icon"></span>' +
+ '<span id="{id}-btnIconEl" class="{baseCls}-icon {iconCls}">&#160;</span>' +
'</button>' +
'</tpl>' +
'</em>' ,
scale: 'small',
-
+
allowedScales: ['small', 'medium', 'large'],
-
+
@@ -28965,7 +29022,7 @@ Ext.define('Ext.button.Button', {
-
+
maskOnDisable: false,
@@ -29046,15 +29103,16 @@ Ext.define('Ext.button.Button', {
setButtonCls: function() {
var me = this,
- el = me.el,
- cls = [];
+ cls = [],
+ btnIconEl = me.btnIconEl,
+ hide = 'x-hide-display';
if (me.useSetClass) {
if (!Ext.isEmpty(me.oldCls)) {
me.removeClsWithUI(me.oldCls);
me.removeClsWithUI(me.pressedCls);
}
-
+
if (me.iconCls || me.icon) {
if (me.text) {
@@ -29062,33 +29120,35 @@ Ext.define('Ext.button.Button', {
} else {
cls.push('icon');
}
- } else if (me.text) {
- cls.push('noicon');
+ if (btnIconEl) {
+ btnIconEl.removeCls(hide);
+ }
+ } else {
+ if (me.text) {
+ cls.push('noicon');
+ }
+ if (btnIconEl) {
+ btnIconEl.addCls(hide);
+ }
}
-
+
me.oldCls = cls;
me.addClsWithUI(cls);
me.addClsWithUI(me.pressed ? me.pressedCls : null);
}
},
-
+
onRender: function(ct, position) {
var me = this,
repeater, btn;
-
+
Ext.applyIf(me.renderData, me.getTemplateArgs());
-
- Ext.applyIf(me.renderSelectors, {
- btnEl : me.href ? 'a' : 'button',
- btnWrap: 'em',
- btnInnerEl: '.' + me.baseCls + '-inner',
- btnIconEl: '.'+ me.baseCls + '-icon'
- });
-
+ me.addChildEls('btnEl', 'btnWrap', 'btnInnerEl', 'btnIconEl');
+
if (me.scale) {
me.ui = me.ui + '-' + me.scale;
}
@@ -29098,7 +29158,7 @@ Ext.define('Ext.button.Button', {
if (me.split && me.arrowTooltip) {
- me.arrowEl.dom[me.tooltipType] = me.arrowTooltip;
+ me.arrowEl.dom.setAttribute(me.getTipAttr(), me.arrowTooltip);
}
@@ -29123,6 +29183,10 @@ Ext.define('Ext.button.Button', {
me.setTooltip(me.tooltip, true);
}
+ if (me.textAlign) {
+ me.setTextAlign(me.textAlign);
+ }
+
if (me.handleMouseEvents) {
me.mon(btn, {
@@ -29186,6 +29250,7 @@ Ext.define('Ext.button.Button', {
type : me.type,
splitCls : me.getSplitCls(),
cls : me.cls,
+ iconCls : me.iconCls || '',
text : me.text || '&#160;',
tabIndex : me.tabIndex,
innerSpanStyle: innerSpanStyle
@@ -29196,7 +29261,7 @@ Ext.define('Ext.button.Button', {
getHref: function() {
var me = this,
params = Ext.apply({}, me.baseParams);
-
+
params = Ext.apply(params, me.params);
return me.href ? Ext.urlAppend(me.href, Ext.Object.toQueryString(params)) : false;
@@ -29225,14 +29290,16 @@ Ext.define('Ext.button.Button', {
setIconCls: function(cls) {
var me = this,
- btnIconEl = me.btnIconEl;
+ btnIconEl = me.btnIconEl,
+ oldCls = me.iconCls;
+
+ me.iconCls = cls;
if (btnIconEl) {
- btnIconEl.removeCls(me.iconCls);
+ btnIconEl.removeCls(oldCls);
btnIconEl.addCls(cls || '');
me.setButtonCls();
}
- me.iconCls = cls;
return me;
},
@@ -29251,7 +29318,7 @@ Ext.define('Ext.button.Button', {
tooltip));
me.tooltip = tooltip;
} else {
- me.btnEl.dom.setAttribute('data-' + this.tooltipType, tooltip);
+ me.btnEl.dom.setAttribute(me.getTipAttr(), tooltip);
}
} else {
me.tooltip = tooltip;
@@ -29260,10 +29327,27 @@ Ext.define('Ext.button.Button', {
},
+ setTextAlign: function(align) {
+ var me = this,
+ btnEl = me.btnEl;
+
+ if (btnEl) {
+ btnEl.removeCls(me.baseCls + '-' + me.textAlign);
+ btnEl.addCls(me.baseCls + '-' + align);
+ }
+ me.textAlign = align;
+ return me;
+ },
+
+ getTipAttr: function(){
+ return this.tooltipType == 'qtip' ? 'data-qtip' : 'title';
+ },
+
+
getRefItems: function(deep){
var menu = this.menu,
items;
-
+
if (menu) {
items = menu.getRefItems(deep);
items.unshift(menu);
@@ -29285,9 +29369,10 @@ Ext.define('Ext.button.Button', {
me.clearTip();
}
if (me.menu && me.destroyMenu !== false) {
- Ext.destroy(me.btnEl, me.btnInnerEl, me.menu);
+ Ext.destroy(me.menu);
}
- Ext.destroy(me.repeater);
+ Ext.destroy(me.btnInnerEl, me.repeater);
+ me.callParent();
},
@@ -29297,10 +29382,8 @@ Ext.define('Ext.button.Button', {
me.doc.un('mouseover', me.monitorMouseOver, me);
me.doc.un('mouseup', me.onMouseUp, me);
delete me.doc;
- delete me.btnEl;
- delete me.btnInnerEl;
Ext.ButtonToggleManager.unregister(me);
-
+
Ext.destroy(me.keyMap);
delete me.keyMap;
}
@@ -29329,10 +29412,11 @@ Ext.define('Ext.button.Button', {
setIcon: function(icon) {
var me = this,
- btnInnerEl = me.btnInnerEl;
+ iconEl = me.btnIconEl;
+
me.icon = icon;
- if (btnInnerEl) {
- btnInnerEl.setStyle('background-image', icon ? 'url(' + icon + ')': '');
+ if (iconEl) {
+ iconEl.setStyle('background-image', icon ? 'url(' + icon + ')': '');
me.setButtonCls();
}
return me;
@@ -29346,7 +29430,7 @@ Ext.define('Ext.button.Button', {
toggle: function(state, suppressEvent) {
var me = this;
- state = state === undefined ? !me.pressed: !!state;
+ state = state === undefined ? !me.pressed : !!state;
if (state !== me.pressed) {
if (me.rendered) {
me[state ? 'addClsWithUI': 'removeClsWithUI'](me.pressedCls);
@@ -29360,12 +29444,19 @@ Ext.define('Ext.button.Button', {
}
return me;
},
+
+ maybeShowMenu: function(){
+ var me = this;
+ if (me.menu && !me.hasVisibleMenu() && !me.ignoreNextClick) {
+ me.showMenu();
+ }
+ },
showMenu: function() {
var me = this;
if (me.rendered && me.menu) {
- if (me.tooltip) {
+ if (me.tooltip && me.getTipAttr() != 'title') {
Ext.tip.QuickTipManager.getQuickTip().cancelShow(me.btnEl);
}
if (me.menu.isVisible()) {
@@ -29406,17 +29497,27 @@ Ext.define('Ext.button.Button', {
return;
}
if (!me.disabled) {
- if (me.enableToggle && (me.allowDepress !== false || !me.pressed)) {
- me.toggle();
- }
- if (me.menu && !me.hasVisibleMenu() && !me.ignoreNextClick) {
- me.showMenu();
- }
- me.fireEvent('click', me, e);
- if (me.handler) {
- me.handler.call(me.scope || me, me, e);
- }
- me.onBlur();
+ me.doToggle();
+ me.maybeShowMenu();
+ me.fireHandler(e);
+ }
+ },
+
+ fireHandler: function(e){
+ var me = this,
+ handler = me.handler;
+
+ me.fireEvent('click', me, e);
+ if (handler) {
+ handler.call(me.scope || me, me, e);
+ }
+ me.onBlur();
+ },
+
+ doToggle: function(){
+ var me = this;
+ if (me.enableToggle && (me.allowDepress !== false || !me.pressed)) {
+ me.toggle();
}
},
@@ -29472,7 +29573,7 @@ Ext.define('Ext.button.Button', {
var me = this,
size = me.triggerSize,
side, sideFirstLetter, undef;
-
+
if (size === undef) {
side = me.arrowAlign;
sideFirstLetter = side.charAt(0);
@@ -29508,13 +29609,13 @@ Ext.define('Ext.button.Button', {
delete me.overMenuTrigger;
me.fireEvent('menutriggerout', me, me.menu, e);
},
-
+
enable : function(silent) {
var me = this;
me.callParent(arguments);
-
+
me.removeClsWithUI('disabled');
return me;
@@ -29523,43 +29624,44 @@ Ext.define('Ext.button.Button', {
disable : function(silent) {
var me = this;
-
+
me.callParent(arguments);
-
+
me.addClsWithUI('disabled');
+ me.removeClsWithUI(me.overCls);
return me;
},
-
+
setScale: function(scale) {
var me = this,
ui = me.ui.replace('-' + me.scale, '');
-
+
if (!Ext.Array.contains(me.allowedScales, scale)) {
throw('#setScale: scale must be an allowed scale (' + me.allowedScales.join(', ') + ')');
}
-
+
me.scale = scale;
me.setUI(ui);
},
-
+
setUI: function(ui) {
var me = this;
-
+
if (me.scale && !ui.match(me.scale)) {
ui = ui + '-' + me.scale;
}
-
+
me.callParent([ui]);
-
+
},
-
+
onFocus: function(e) {
var me = this;
@@ -29658,10 +29760,10 @@ Ext.define('Ext.button.Button', {
}
}, function() {
- var groups = {},
- g, i, l;
+ var groups = {};
function toggleGroup(btn, state) {
+ var g, i, l;
if (state) {
g = groups[btn.toggleGroup];
for (i = 0, l = g.length; i < l; i++) {
@@ -29671,6 +29773,7 @@ Ext.define('Ext.button.Button', {
}
}
}
+
Ext.ButtonToggleManager = {
register: function(btn) {
@@ -29931,7 +30034,7 @@ Ext.define('Ext.layout.container.boxOverflow.Menu', {
me.menuTrigger = Ext.create('Ext.button.Button', {
ownerCt : me.layout.owner,
- iconCls : Ext.baseCSSPrefix + layout.owner.getXType() + '-more-icon',
+ iconCls : me.layout.owner.menuTriggerCls,
ui : layout.owner instanceof Ext.toolbar.Toolbar ? 'default-toolbar' : 'default',
menu : me.menu,
getSplitCls: function() { return '';},
@@ -29970,7 +30073,6 @@ Ext.define('Ext.layout.container.boxOverflow.Menu', {
}
});
-
Ext.define('Ext.util.Region', {
@@ -30256,7 +30358,7 @@ Ext.define('Ext.dd.DragDropManager', {
alternateClassName: ['Ext.dd.DragDropMgr', 'Ext.dd.DDM'],
-
+
ids: {},
@@ -30472,7 +30574,7 @@ Ext.define('Ext.dd.DragDropManager', {
this.handleMouseUp(e);
}
-
+
this.currentTarget = e.getTarget();
this.dragCurrent = oDD;
@@ -30508,7 +30610,7 @@ Ext.define('Ext.dd.DragDropManager', {
handleMouseUp: function(e) {
- if(Ext.tip.QuickTipManager){
+ if(Ext.tip && Ext.tip.QuickTipManager){
Ext.tip.QuickTipManager.ddEnable();
}
if (! this.dragCurrent) {
@@ -30812,7 +30914,7 @@ Ext.define('Ext.dd.DragDropManager', {
var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
try {
- pos= Ext.core.Element.getXY(el);
+ pos= Ext.Element.getXY(el);
} catch (e) { }
if (!pos) {
@@ -30932,22 +31034,25 @@ Ext.define('Ext.dd.DragDropManager', {
ElementWrapper: function(el) {
-
- this.el = el || null;
-
- this.id = this.el && el.id;
-
- this.css = this.el && el.style;
- },
+
+ this.el = el || null;
+
+ this.id = this.el && el.id;
+
+ this.css = this.el && el.style;
+ },
+
+
+
getPosX: function(el) {
- return Ext.core.Element.getX(el);
+ return Ext.Element.getX(el);
},
getPosY: function(el) {
- return Ext.core.Element.getY(el);
+ return Ext.Element.getY(el);
},
@@ -30976,7 +31081,7 @@ Ext.define('Ext.dd.DragDropManager', {
body = doc.body,
top = 0,
left = 0;
-
+
if (Ext.isGecko4) {
top = window.scrollYOffset;
left = window.scrollXOffset;
@@ -30987,7 +31092,7 @@ Ext.define('Ext.dd.DragDropManager', {
} else if (body) {
top = body.scrollTop;
left = body.scrollLeft;
- }
+ }
}
return {
top: top,
@@ -31012,8 +31117,8 @@ Ext.define('Ext.dd.DragDropManager', {
moveToEl: function (moveEl, targetEl) {
- var aCoord = Ext.core.Element.getXY(targetEl);
- Ext.core.Element.setXY(moveEl, aCoord);
+ var aCoord = Ext.Element.getXY(targetEl);
+ Ext.Element.setXY(moveEl, aCoord);
},
@@ -31071,7 +31176,7 @@ Ext.define('Ext.layout.container.Box', {
alias: ['layout.box'],
extend: 'Ext.layout.container.Container',
alternateClassName: 'Ext.layout.BoxLayout',
-
+
requires: [
'Ext.layout.container.boxOverflow.None',
'Ext.layout.container.boxOverflow.Menu',
@@ -31111,10 +31216,13 @@ Ext.define('Ext.layout.container.Box', {
availableSpaceOffset: 0,
-
+
reserveOffset: true,
+
+ shrinkToFit: true,
+
clearInnerCtOnLayout: false,
@@ -31199,7 +31307,7 @@ Ext.define('Ext.layout.container.Box', {
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',
@@ -31215,9 +31323,9 @@ Ext.define('Ext.layout.container.Box', {
minSizes = [],
calculatedWidth,
- i, child, childParallel, childPerpendicular, childMargins, childSize, minParallel, tmpObj, shortfall,
- tooNarrow, availableSpace, minSize, item, length, itemIndex, box, oldSize, newSize, reduction, diff,
- flexedBoxes, remainingSpace, remainingFlex, flexedSize, parallelMargins, calcs, offset,
+ i, child, childParallel, childPerpendicular, childMargins, childSize, minParallel, tmpObj, shortfall,
+ tooNarrow, availableSpace, minSize, item, length, itemIndex, box, oldSize, newSize, reduction, diff,
+ flexedBoxes, remainingSpace, remainingFlex, flexedSize, parallelMargins, calcs, offset,
perpendicularMargins, stretchSize;
@@ -31265,14 +31373,20 @@ Ext.define('Ext.layout.container.Box', {
}
- maxSize = mmax(maxSize, childPerpendicular + childMargins[me.perpendicularLeftTop] + childMargins[me.perpendicularRightBottom]);
+
+ maxSize = mmax(maxSize, mmax(childPerpendicular, child[perpendicularMinString]||0) + childMargins[me.perpendicularLeftTop] + childMargins[me.perpendicularRightBottom]);
tmpObj[parallelPrefix] = childParallel || undefinedValue;
+ tmpObj.dirtySize = child.componentLayout.lastComponentSize ? (tmpObj[parallelPrefix] !== child.componentLayout.lastComponentSize[parallelPrefix]) : false;
tmpObj[perpendicularPrefix] = childPerpendicular || undefinedValue;
boxes.push(tmpObj);
}
- shortfall = desiredSize - parallelSize;
- tooNarrow = minimumSize > parallelSize;
+
+
+ if (!me.autoSize) {
+ shortfall = desiredSize - parallelSize;
+ tooNarrow = minimumSize > parallelSize;
+ }
availableSpace = mmax(0, parallelSize - nonFlexSize - paddingParallel - (me.reserveOffset ? me.availableSpaceOffset : 0));
@@ -31300,8 +31414,7 @@ Ext.define('Ext.layout.container.Box', {
box = boxes[i];
box.dirtySize = box.dirtySize || box[parallelPrefix] != minSize;
box[parallelPrefix] = minSize;
- }
- else {
+ } else if (me.shrinkToFit) {
minSizes.push({
minSize: minSize,
available: boxes[i][parallelPrefix] - minSize,
@@ -31332,6 +31445,7 @@ Ext.define('Ext.layout.container.Box', {
box[parallelPrefix] = newSize;
shortfall -= reduction;
}
+ tooNarrow = (shortfall > 0);
}
else {
remainingSpace = availableSpace;
@@ -31444,7 +31558,7 @@ Ext.define('Ext.layout.container.Box', {
}
};
},
-
+
onRemove: function(comp){
this.callParent(arguments);
if (this.overflowHandler) {
@@ -31527,6 +31641,8 @@ Ext.define('Ext.layout.container.Box', {
me.updateChildBoxes(boxes);
me.handleTargetOverflow(targetSize);
},
+
+ animCallback: Ext.emptyFn,
updateChildBoxes: function(boxes) {
@@ -31615,6 +31731,7 @@ Ext.define('Ext.layout.container.Box', {
length -= 1;
if (!length) {
+ me.animCallback(anim);
me.layoutBusy = false;
if (Ext.isFunction(animCallback)) {
animCallback();
@@ -31759,6 +31876,8 @@ Ext.define('Ext.layout.container.Box', {
margins.right += itemEl.getMargin('r');
margins.bottom += itemEl.getMargin('b');
margins.left += itemEl.getMargin('l');
+ margins.height = margins.top + margins.bottom;
+ margins.width = margins.left + margins.right;
style.marginTop = style.marginRight = style.marginBottom = style.marginLeft = '0';
@@ -31767,7 +31886,7 @@ Ext.define('Ext.layout.container.Box', {
destroy: function() {
- Ext.destroy(this.overflowHandler);
+ Ext.destroy(this.innerCt, this.overflowHandler);
this.callParent(arguments);
}
});
@@ -31779,7 +31898,7 @@ Ext.define('Ext.layout.container.HBox', {
alias: ['layout.hbox'],
extend: 'Ext.layout.container.Box',
alternateClassName: 'Ext.layout.HBoxLayout',
-
+
@@ -31836,7 +31955,7 @@ Ext.define('Ext.layout.container.VBox', {
alias: ['layout.vbox'],
extend: 'Ext.layout.container.Box',
alternateClassName: 'Ext.layout.VBoxLayout',
-
+
@@ -32175,8 +32294,8 @@ Ext.define('Ext.FocusManager', {
],
style: 'top: -100px; left: -100px;'
});
- me.focusFrame.setVisibilityMode(Ext.core.Element.DISPLAY);
- me.focusFrameWidth = me.focusFrame.child('.' + cls + '-top').getHeight();
+ me.focusFrame.setVisibilityMode(Ext.Element.DISPLAY);
+ me.focusFrameWidth = 2;
me.focusFrame.hide().setLeftTop(0, 0);
}
},
@@ -32348,10 +32467,10 @@ Ext.define('Ext.FocusManager', {
fl = ff.child(cls + 'left'),
fr = ff.child(cls + 'right');
- ft.setWidth(bw - 2).setLeftTop(bl + 1, bt);
- fb.setWidth(bw - 2).setLeftTop(bl + 1, bt + bh - fw);
- fl.setHeight(bh - 2).setLeftTop(bl, bt + 1);
- fr.setHeight(bh - 2).setLeftTop(bl + bw - fw, bt + 1);
+ ft.setWidth(bw).setLeftTop(bl, bt);
+ fb.setWidth(bw).setLeftTop(bl, bt + bh - fw);
+ fl.setHeight(bh - fw - fw).setLeftTop(bl, bt + fw);
+ fr.setHeight(bh - fw - fw).setLeftTop(bl + bw - fw, bt + fw);
ff.show();
}
@@ -32647,13 +32766,13 @@ Ext.define('Ext.toolbar.Toolbar', {
],
alias: 'widget.toolbar',
alternateClassName: 'Ext.Toolbar',
-
+
isToolbar: true,
baseCls : Ext.baseCSSPrefix + 'toolbar',
ariaRole : 'toolbar',
-
+
defaultType: 'button',
-
+
vertical: false,
@@ -32661,12 +32780,15 @@ Ext.define('Ext.toolbar.Toolbar', {
enableOverflow: false,
+
+ menuTriggerCls: Ext.baseCSSPrefix + 'toolbar-more-icon',
- trackMenus: true,
+ trackMenus: true,
+
itemCls: Ext.baseCSSPrefix + 'toolbar-item',
-
+
initComponent: function() {
var me = this,
keys;
@@ -32675,7 +32797,7 @@ Ext.define('Ext.toolbar.Toolbar', {
if (!me.layout && me.enableOverflow) {
me.layout = { overflowHandler: 'Menu' };
}
-
+
if (me.dock === 'right' || me.dock === 'left') {
me.vertical = true;
}
@@ -32687,21 +32809,21 @@ Ext.define('Ext.toolbar.Toolbar', {
align: me.vertical ? 'stretchmax' : 'middle',
clearInnerCtOnLayout: true
});
-
+
if (me.vertical) {
me.addClsWithUI('vertical');
}
-
+
if (me.ui === 'footer') {
me.ignoreBorderManagement = true;
}
-
+
me.callParent();
me.addEvents('overflowchange');
-
+
keys = me.vertical ? ['up', 'down'] : ['left', 'right'];
Ext.FocusManager.subscribe(me, {
@@ -32709,6 +32831,21 @@ Ext.define('Ext.toolbar.Toolbar', {
});
},
+ getRefItems: function(deep) {
+ var me = this,
+ items = me.callParent(arguments),
+ layout = me.layout,
+ handler;
+
+ if (deep && me.enableOverflow) {
+ handler = layout.overflowHandler;
+ if (handler && handler.menu) {
+ items = items.concat(handler.menu.getRefItems(deep));
+ }
+ }
+ return items;
+ },
+
@@ -32751,7 +32888,7 @@ Ext.define('Ext.toolbar.Toolbar', {
var method = remove ? 'mun' : 'mon',
me = this;
- me[method](item, 'menutriggerover', me.onButtonTriggerOver, me);
+ me[method](item, 'mouseover', me.onButtonOver, me);
me[method](item, 'menushow', me.onButtonMenuShow, me);
me[method](item, 'menuhide', me.onButtonMenuHide, me);
}
@@ -32767,12 +32904,12 @@ Ext.define('Ext.toolbar.Toolbar', {
if (component.is('field') || (component.is('button') && this.ui != 'footer')) {
component.ui = component.ui + '-toolbar';
}
-
+
if (component instanceof Ext.toolbar.Separator) {
component.setUI((this.vertical) ? 'vertical' : 'horizontal');
}
-
+
this.callParent(arguments);
},
@@ -32793,7 +32930,7 @@ Ext.define('Ext.toolbar.Toolbar', {
},
- onButtonTriggerOver: function(btn){
+ onButtonOver: function(btn){
if (this.activeMenuBtn && this.activeMenuBtn != btn) {
this.activeMenuBtn.hideMenu();
btn.showMenu();
@@ -32824,7 +32961,7 @@ Ext.define('Ext.panel.AbstractPanel', {
extend: 'Ext.container.Container',
- requires: ['Ext.util.MixedCollection', 'Ext.core.Element', 'Ext.toolbar.Toolbar'],
+ requires: ['Ext.util.MixedCollection', 'Ext.Element', 'Ext.toolbar.Toolbar'],
@@ -32846,7 +32983,13 @@ Ext.define('Ext.panel.AbstractPanel', {
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>'],
+ renderTpl: [
+ '<div id="{id}-body" 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>'
+ ],
@@ -32865,9 +33008,7 @@ Ext.define('Ext.panel.AbstractPanel', {
);
- Ext.applyIf(me.renderSelectors, {
- body: '.' + me.baseCls + '-body'
- });
+ me.addChildEls('body');
@@ -32917,7 +33058,7 @@ Ext.define('Ext.panel.AbstractPanel', {
var me = this,
bodyStyle = me.bodyStyle,
styles = [],
- Element = Ext.core.Element,
+ Element = Ext.Element,
prop;
if (Ext.isFunction(bodyStyle)) {
@@ -33037,10 +33178,9 @@ Ext.define('Ext.panel.AbstractPanel', {
if (autoDestroy === true || (autoDestroy !== false && me.autoDestroy)) {
item.destroy();
- }
-
- if (hasLayout && !autoDestroy) {
- layout.afterRemove(item);
+ } else if (hasLayout) {
+
+ layout.afterRemove(item);
}
@@ -33254,10 +33394,20 @@ Ext.define('Ext.panel.Header', {
indicateDrag : false,
weight : -1,
- renderTpl: ['<div class="{baseCls}-body<tpl if="bodyCls"> {bodyCls}</tpl><tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-body-{parent.ui}-{.}</tpl></tpl>"<tpl if="bodyStyle"> style="{bodyStyle}"</tpl>></div>'],
+ renderTpl: [
+ '<div id="{id}-body" class="{baseCls}-body<tpl if="bodyCls"> {bodyCls}</tpl>',
+ '<tpl if="uiCls">',
+ '<tpl for="uiCls"> {parent.baseCls}-body-{parent.ui}-{.}</tpl>',
+ '</tpl>"',
+ '<tpl if="bodyStyle"> style="{bodyStyle}"</tpl>></div>'],
+
+
+
+
initComponent: function() {
var me = this,
+ ruleStyle,
rule,
style,
titleTextEl,
@@ -33275,9 +33425,7 @@ Ext.define('Ext.panel.Header', {
me.addClsWithUI(me.orientation);
me.addClsWithUI(me.dock);
- Ext.applyIf(me.renderSelectors, {
- body: '.' + me.baseCls + '-body'
- });
+ me.addChildEls('body');
if (!Ext.isEmpty(me.iconCls)) {
@@ -33312,7 +33460,11 @@ Ext.define('Ext.panel.Header', {
if (Ext.isArray(ui)) {
ui = ui[0];
}
- rule = Ext.util.CSS.getRule('.' + me.baseCls + '-text-' + ui);
+ ruleStyle = '.' + me.baseCls + '-text-' + ui;
+ if (Ext.scopeResetCSS) {
+ ruleStyle = '.' + Ext.baseCSSPrefix + 'reset ' + ruleStyle;
+ }
+ rule = Ext.util.CSS.getRule(ruleStyle);
if (rule) {
style = rule.style;
}
@@ -33332,6 +33484,8 @@ Ext.define('Ext.panel.Header', {
autoSize: true,
margins: '5 0 0 0',
items: [ me.textConfig ],
+
+
renderSelectors: {
textEl: '.' + me.baseCls + '-text'
}
@@ -33348,15 +33502,16 @@ Ext.define('Ext.panel.Header', {
ariaRole : 'heading',
focusable: false,
flex : 1,
- renderTpl : ['<span class="{cls}-text {cls}-text-{ui}">{title}</span>'],
+ cls: me.baseCls + '-text-container',
+ renderTpl : [
+ '<span id="{id}-textEl" class="{cls}-text {cls}-text-{ui}">{title}</span>'
+ ],
renderData: {
title: me.title,
cls : me.baseCls,
ui : me.ui
},
- renderSelectors: {
- textEl: '.' + me.baseCls + '-text'
- }
+ childEls: ['textEl']
});
}
me.items.push(me.titleCmp);
@@ -33369,16 +33524,16 @@ Ext.define('Ext.panel.Header', {
initIconCmp: function() {
this.iconCmp = Ext.create('Ext.Component', {
focusable: false,
- renderTpl : ['<img alt="" src="{blank}" class="{cls}-icon {iconCls}"/>'],
+ renderTpl : [
+ '<img id="{id}-iconEl" alt="" src="{blank}" class="{cls}-icon {iconCls}"/>'
+ ],
renderData: {
blank : Ext.BLANK_IMAGE_URL,
cls : this.baseCls,
iconCls: this.iconCls,
orientation: this.orientation
},
- renderSelectors: {
- iconEl: '.' + this.baseCls + '-icon'
- },
+ childEls: ['iconEl'],
iconCls: this.iconCls
});
},
@@ -33435,7 +33590,7 @@ Ext.define('Ext.panel.Header', {
me.bodyCls = classes.join(' ');
}
}
-
+
return result;
},
@@ -33584,19 +33739,20 @@ Ext.define('Ext.panel.Header', {
setIconCls: function(cls) {
- this.iconCls = cls;
- if (!this.iconCmp) {
- this.initIconCmp();
- this.insert(0, this.iconCmp);
- }
- else {
- if (!cls || !cls.length) {
- this.iconCmp.destroy();
- }
- else {
- var iconCmp = this.iconCmp,
- el = iconCmp.iconEl;
-
+ var me = this,
+ isEmpty = !cls || !cls.length,
+ iconCmp = me.iconCmp,
+ el;
+
+ me.iconCls = cls;
+ if (!me.iconCmp && !isEmpty) {
+ me.initIconCmp();
+ me.insert(0, me.iconCmp);
+ } else if (iconCmp) {
+ if (isEmpty) {
+ me.iconCmp.destroy();
+ } else {
+ el = iconCmp.iconEl;
el.removeCls(iconCmp.iconCls);
el.addCls(cls);
iconCmp.iconCls = cls;
@@ -35223,7 +35379,11 @@ Ext.define('Ext.draw.Draw', {
};
},
+
snapEnds: function (from, to, stepsMax) {
+ if (Ext.isDate(from)) {
+ return this.snapEndsByDate(from, to, stepsMax);
+ }
var step = (to - from) / stepsMax,
level = Math.floor(Math.log(step) / Math.LN10) + 1,
m = Math.pow(10, level),
@@ -35261,6 +35421,90 @@ Ext.define('Ext.draw.Draw', {
};
},
+
+ snapEndsByDate: function (from, to, stepsMax, lockEnds) {
+ var selectedStep = false, scales = [
+ [Ext.Date.MILLI, [1, 2, 3, 5, 10, 20, 30, 50, 100, 200, 300, 500]],
+ [Ext.Date.SECOND, [1, 2, 3, 5, 10, 15, 30]],
+ [Ext.Date.MINUTE, [1, 2, 3, 5, 10, 20, 30]],
+ [Ext.Date.HOUR, [1, 2, 3, 4, 6, 12]],
+ [Ext.Date.DAY, [1, 2, 3, 7, 14]],
+ [Ext.Date.MONTH, [1, 2, 3, 4, 6]]
+ ], j, yearDiff;
+
+
+ Ext.each(scales, function(scale, i) {
+ for (j = 0; j < scale[1].length; j++) {
+ if (to < Ext.Date.add(from, scale[0], scale[1][j] * stepsMax)) {
+ selectedStep = [scale[0], scale[1][j]];
+ return false;
+ }
+ }
+ });
+ if (!selectedStep) {
+ yearDiff = this.snapEnds(from.getFullYear(), to.getFullYear() + 1, stepsMax, lockEnds);
+ selectedStep = [Date.YEAR, Math.round(yearDiff.step)];
+ }
+ return this.snapEndsByDateAndStep(from, to, selectedStep, lockEnds);
+ },
+
+
+
+ snapEndsByDateAndStep: function(from, to, step, lockEnds) {
+ var fromStat = [from.getFullYear(), from.getMonth(), from.getDate(),
+ from.getHours(), from.getMinutes(), from.getSeconds(), from.getMilliseconds()],
+ steps = 0, testFrom, testTo;
+ if (lockEnds) {
+ testFrom = from;
+ } else {
+ switch (step[0]) {
+ case Ext.Date.MILLI:
+ testFrom = new Date(fromStat[0], fromStat[1], fromStat[2], fromStat[3],
+ fromStat[4], fromStat[5], Math.floor(fromStat[6] / step[1]) * step[1]);
+ break;
+ case Ext.Date.SECOND:
+ testFrom = new Date(fromStat[0], fromStat[1], fromStat[2], fromStat[3],
+ fromStat[4], Math.floor(fromStat[5] / step[1]) * step[1], 0);
+ break;
+ case Ext.Date.MINUTE:
+ testFrom = new Date(fromStat[0], fromStat[1], fromStat[2], fromStat[3],
+ Math.floor(fromStat[4] / step[1]) * step[1], 0, 0);
+ break;
+ case Ext.Date.HOUR:
+ testFrom = new Date(fromStat[0], fromStat[1], fromStat[2],
+ Math.floor(fromStat[3] / step[1]) * step[1], 0, 0, 0);
+ break;
+ case Ext.Date.DAY:
+ testFrom = new Date(fromStat[0], fromStat[1],
+ Math.floor(fromStat[2] - 1 / step[1]) * step[1] + 1, 0, 0, 0, 0);
+ break;
+ case Ext.Date.MONTH:
+ testFrom = new Date(fromStat[0], Math.floor(fromStat[1] / step[1]) * step[1], 1, 0, 0, 0, 0);
+ break;
+ default:
+ testFrom = new Date(Math.floor(fromStat[0] / step[1]) * step[1], 0, 1, 0, 0, 0, 0);
+ break;
+ }
+ }
+
+ testTo = testFrom;
+
+ while (testTo < to) {
+ testTo = Ext.Date.add(testTo, step[0], step[1]);
+ steps++;
+ }
+
+ if (lockEnds) {
+ testTo = to;
+ }
+ return {
+ from : +testFrom,
+ to : +testTo,
+ step : (testTo - testFrom) / steps,
+ steps : steps
+ };
+ },
+
sorter: function (a, b) {
return a.offset - b.offset;
},
@@ -35342,6 +35586,7 @@ Ext.define('Ext.draw.Draw', {
});
+
Ext.define('Ext.fx.PropertyHandler', {
@@ -35684,6 +35929,11 @@ Ext.define('Ext.fx.Anim', {
isAnimation: true,
+
+
+
+
+
duration: 250,
@@ -35738,7 +35988,9 @@ Ext.define('Ext.fx.Anim', {
constructor: function(config) {
- var me = this;
+ var me = this,
+ curve;
+
config = config || {};
if (config.keyframes) {
@@ -35758,8 +36010,8 @@ Ext.define('Ext.fx.Anim', {
if (!me.easingFn) {
me.easingFn = String(me.easing).match(me.bezierRE);
if (me.easingFn && me.easingFn.length == 5) {
- var curve = me.easingFn;
- me.easingFn = Ext.fx.cubicBezier(+curve[1], +curve[2], +curve[3], +curve[4]);
+ curve = me.easingFn;
+ me.easingFn = Ext.fx.CubicBezier.cubicBezier(+curve[1], +curve[2], +curve[3], +curve[4]);
}
}
me.id = Ext.id(null, 'ext-anim-');
@@ -35916,14 +36168,14 @@ Ext.enableFx = true;
Ext.define('Ext.dd.DragDrop', {
requires: ['Ext.dd.DragDropManager'],
-
+
constructor: function(id, sGroup, config) {
if(id) {
this.init(id, sGroup, config);
}
},
-
+
@@ -36092,10 +36344,10 @@ Ext.define('Ext.dd.DragDrop', {
var b = Ext.get(this.getEl()).getBox(),
ce = Ext.get(constrainTo),
s = ce.getScroll(),
- c,
+ c,
cd = ce.dom;
if(cd == document.body){
- c = { x: s.left, y: s.top, width: Ext.core.Element.getViewWidth(), height: Ext.core.Element.getViewHeight()};
+ c = { x: s.left, y: s.top, width: Ext.Element.getViewWidth(), height: Ext.Element.getViewHeight()};
}else{
var xy = ce.getXY();
c = {x : xy[0], y: xy[1], width: cd.clientWidth, height: cd.clientHeight};
@@ -36218,7 +36470,7 @@ Ext.define('Ext.dd.DragDrop', {
var dx = diffX || 0;
var dy = diffY || 0;
- var p = Ext.core.Element.getXY( el );
+ var p = Ext.Element.getXY( el );
this.initPageX = p[0] - dx;
this.initPageY = p[1] - dy;
@@ -36231,7 +36483,7 @@ Ext.define('Ext.dd.DragDrop', {
setStartPosition: function(pos) {
- var p = pos || Ext.core.Element.getXY( this.getEl() );
+ var p = pos || Ext.Element.getXY( this.getEl() );
this.deltaSetXY = null;
this.startPageX = p[0];
@@ -36592,7 +36844,7 @@ Ext.define('Ext.dd.DD', {
var oCoord = this.getTargetCoord(iPageX, iPageY),
fly = el.dom ? el : Ext.fly(el, '_dd'),
elSize = fly.getSize(),
- EL = Ext.core.Element,
+ EL = Ext.Element,
vpSize;
if (!this.deltaSetXY) {
@@ -36624,7 +36876,7 @@ Ext.define('Ext.dd.DD', {
this.lastPageX = iPageX;
this.lastPageY = iPageY;
} else {
- var aCoord = Ext.core.Element.getXY(this.getEl());
+ var aCoord = Ext.Element.getXY(this.getEl());
this.lastPageX = aCoord[0];
this.lastPageY = aCoord[1];
}
@@ -36635,10 +36887,10 @@ Ext.define('Ext.dd.DD', {
if (this.scroll) {
- var clientH = Ext.core.Element.getViewHeight();
+ var clientH = Ext.Element.getViewHeight();
- var clientW = Ext.core.Element.getViewWidth();
+ var clientW = Ext.Element.getViewWidth();
var st = this.DDMInstance.getScrollTop();
@@ -36914,7 +37166,6 @@ Ext.define('Ext.dd.DragSource', {
-
dropAllowed : Ext.baseCSSPrefix + 'dd-drop-ok',
dropNotAllowed : Ext.baseCSSPrefix + 'dd-drop-nodrop',
@@ -37315,11 +37566,17 @@ Ext.define('Ext.panel.Panel', {
+
+
initComponent: function() {
var me = this,
cls;
me.addEvents(
+
+
+ 'beforeclose',
+
"beforeexpand",
@@ -37350,12 +37607,11 @@ Ext.define('Ext.panel.Panel', {
me.setUI(me.ui + '-framed');
}
- me.callParent();
-
- me.collapseDirection = me.collapseDirection || me.headerPosition || Ext.Component.DIRECTION_TOP;
-
me.bridgeToolbars();
+
+ me.callParent();
+ me.collapseDirection = me.collapseDirection || me.headerPosition || Ext.Component.DIRECTION_TOP;
},
setBorder: function(border) {
@@ -37437,6 +37693,7 @@ Ext.define('Ext.panel.Panel', {
bridgeToolbars: function() {
var me = this,
+ docked = [],
fbar,
fbarDefaults,
minButtonWidth = me.minButtonWidth;
@@ -37468,17 +37725,17 @@ Ext.define('Ext.panel.Panel', {
-
+
if (me.tbar) {
- me.addDocked(initToolbar(me.tbar, 'top'));
+ docked.push(initToolbar(me.tbar, 'top'));
me.tbar = null;
}
if (me.bbar) {
- me.addDocked(initToolbar(me.bbar, 'bottom'));
+ docked.push(initToolbar(me.bbar, 'bottom'));
me.bbar = null;
}
@@ -37506,28 +37763,37 @@ Ext.define('Ext.panel.Panel', {
};
}
- me.addDocked(fbar);
+ docked.push(fbar);
me.fbar = null;
}
if (me.lbar) {
- me.addDocked(initToolbar(me.lbar, 'left'));
+ docked.push(initToolbar(me.lbar, 'left'));
me.lbar = null;
}
if (me.rbar) {
- me.addDocked(initToolbar(me.rbar, 'right'));
+ docked.push(initToolbar(me.rbar, 'right'));
me.rbar = null;
}
+
+ if (me.dockedItems) {
+ if (!Ext.isArray(me.dockedItems)) {
+ me.dockedItems = [me.dockedItems];
+ }
+ me.dockedItems = me.dockedItems.concat(docked);
+ } else {
+ me.dockedItems = docked;
+ }
},
initTools: function() {
var me = this;
- me.tools = me.tools || [];
+ me.tools = me.tools ? Ext.Array.clone(me.tools) : [];
@@ -37596,14 +37862,15 @@ Ext.define('Ext.panel.Panel', {
me.callParent(arguments);
},
- afterComponentLayout: function() {
+ afterRender: function() {
var me = this;
+
me.callParent(arguments);
- if (me.collapsed && me.componentLayoutCounter == 1) {
+ if (me.collapsed) {
me.collapsed = false;
me.collapse(null, false, true);
}
@@ -37670,13 +37937,52 @@ Ext.define('Ext.panel.Panel', {
return this.body || this.frameBody || this.el;
},
+
+
+
+ isVisible: function(deep){
+ var me = this;
+ if (me.collapsed && me.placeholder) {
+ return me.placeholder.isVisible(deep);
+ }
+ return me.callParent(arguments);
+ },
+
+
+ onHide: function(){
+ var me = this;
+ if (me.collapsed && me.placeholder) {
+ me.placeholder.hide();
+ } else {
+ me.callParent(arguments);
+ }
+ },
+
+
+ onShow: function(){
+ var me = this;
+ if (me.collapsed && me.placeholder) {
+
+ me.hidden = true;
+ me.placeholder.show();
+ } else {
+ me.callParent(arguments);
+ }
+ },
+
addTool: function(tool) {
- this.tools.push(tool);
- var header = this.header;
+ var me = this,
+ header = me.header;
+
+ if (Ext.isArray(tool)) {
+ Ext.each(tool, me.addTool, me);
+ return;
+ }
+ me.tools.push(tool);
if (header) {
header.addTool(tool);
}
- this.updateHeader();
+ me.updateHeader();
},
getOppositeDirection: function(d) {
@@ -37725,7 +38031,6 @@ Ext.define('Ext.panel.Panel', {
reExpanderOrientation,
reExpanderDock,
getDimension,
- setDimension,
collapseDimension;
if (!direction) {
@@ -37748,23 +38053,22 @@ Ext.define('Ext.panel.Panel', {
switch (direction) {
case c.DIRECTION_TOP:
case c.DIRECTION_BOTTOM:
- me.expandedSize = me.getHeight();
reExpanderOrientation = 'horizontal';
collapseDimension = 'height';
getDimension = 'getHeight';
- setDimension = 'setHeight';
-
for (; i < dockedItemCount; i++) {
comp = dockedItems[i];
if (comp.isVisible()) {
- if (comp.isHeader && (!comp.dock || comp.dock == 'top' || comp.dock == 'bottom')) {
+ if (comp.isXType('header', true) && (!comp.dock || comp.dock == 'top' || comp.dock == 'bottom')) {
reExpander = comp;
} else {
me.hiddenDocked.push(comp);
}
+ } else if (comp === me.reExpander) {
+ reExpander = comp;
}
}
@@ -37776,15 +38080,12 @@ Ext.define('Ext.panel.Panel', {
case c.DIRECTION_LEFT:
case c.DIRECTION_RIGHT:
- me.expandedSize = me.getWidth();
reExpanderOrientation = 'vertical';
collapseDimension = 'width';
getDimension = 'getWidth';
- setDimension = 'setWidth';
-
for (; i < dockedItemCount; i++) {
comp = dockedItems[i];
if (comp.isVisible()) {
@@ -37793,6 +38094,8 @@ Ext.define('Ext.panel.Panel', {
} else {
me.hiddenDocked.push(comp);
}
+ } else if (comp === me.reExpander) {
+ reExpander = comp;
}
}
@@ -37807,12 +38110,6 @@ Ext.define('Ext.panel.Panel', {
}
-
- me.setAutoScroll(false);
- me.suspendLayout = true;
- me.body.setVisibilityMode(Ext.core.Element.DISPLAY);
-
-
if (animate && me.collapseTool) {
me.collapseTool.disable();
}
@@ -37824,7 +38121,8 @@ Ext.define('Ext.panel.Panel', {
- if (reExpander) {
+ if (reExpander && reExpander.rendered) {
+
reExpander.addClsWithUI(me.collapsedCls);
reExpander.addClsWithUI(me.collapsedCls + '-' + reExpander.dock);
@@ -37906,13 +38204,14 @@ Ext.define('Ext.panel.Panel', {
if (!me.collapseMemento) {
me.collapseMemento = new Ext.util.Memento(me);
}
- me.collapseMemento.capture(['width', 'height', 'minWidth', 'minHeight']);
+ me.collapseMemento.capture(['width', 'height', 'minWidth', 'minHeight', 'layoutManagedHeight', 'layoutManagedWidth']);
me.savedFlex = me.flex;
me.minWidth = 0;
me.minHeight = 0;
delete me.flex;
+ me.suspendLayout = true;
if (animate) {
me.animate(anim);
@@ -37933,7 +38232,22 @@ Ext.define('Ext.panel.Panel', {
me.collapseMemento.restore(['minWidth', 'minHeight']);
- me.body.hide();
+
+
+
+ if (Ext.Component.VERTICAL_DIRECTION_Re.test(me.expandDirection)) {
+ me.layoutManagedHeight = 2;
+ me.collapseMemento.restore('width', false);
+ } else {
+ me.layoutManagedWidth = 2;
+ me.collapseMemento.restore('height', false);
+ }
+
+
+
+ me.saveScrollTop = me.body.dom.scrollTop;
+ me.body.setStyle('display', 'none');
+
for (; i < l; i++) {
me.hiddenDocked[i].hide();
}
@@ -37942,9 +38256,18 @@ Ext.define('Ext.panel.Panel', {
me.reExpander.show();
}
me.collapsed = true;
+ me.suspendLayout = false;
if (!internal) {
- me.doComponentLayout();
+ if (me.ownerCt) {
+
+
+ if (animated) {
+ me.ownerCt.layout.layout();
+ }
+ } else if (me.reExpander.temporary) {
+ me.doComponentLayout();
+ }
}
if (me.resizer) {
@@ -37952,13 +38275,6 @@ 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);
}
@@ -38016,10 +38332,11 @@ Ext.define('Ext.panel.Panel', {
}
- me.collapsed = false;
+ me.body.setStyle('display', '');
+ me.body.dom.scrollTop = me.saveScrollTop;
- me.body.show();
+ me.collapsed = false;
me.removeClsWithUI(me.collapsedCls);
@@ -38043,7 +38360,11 @@ Ext.define('Ext.panel.Panel', {
if ((direction == Ext.Component.DIRECTION_TOP) || (direction == Ext.Component.DIRECTION_BOTTOM)) {
- if (me.autoHeight) {
+
+ me.collapseMemento.restore('height', false);
+
+
+ if (me.height === undefined) {
me.setCalculatedSize(me.width, null);
anim.to.height = me.getHeight();
@@ -38059,7 +38380,7 @@ Ext.define('Ext.panel.Panel', {
}
else {
- anim.to.height = me.expandedSize;
+ anim.to.height = me.height;
}
@@ -38071,7 +38392,11 @@ Ext.define('Ext.panel.Panel', {
} else if ((direction == Ext.Component.DIRECTION_LEFT) || (direction == Ext.Component.DIRECTION_RIGHT)) {
- if (me.autoWidth) {
+
+ me.collapseMemento.restore('width', false);
+
+
+ if (me.width === undefined) {
me.setCalculatedSize(null, me.height);
anim.to.width = me.getWidth();
@@ -38087,7 +38412,7 @@ Ext.define('Ext.panel.Panel', {
}
else {
- anim.to.width = me.expandedSize;
+ anim.to.width = me.width;
}
@@ -38117,15 +38442,6 @@ Ext.define('Ext.panel.Panel', {
afterExpand: function(animated) {
var me = this;
- if (me.collapseMemento) {
-
-
-
- me.collapseMemento.restoreAll();
- }
-
- me.setAutoScroll(me.initialConfig.autoScroll);
-
if (me.savedFlex) {
me.flex = me.savedFlex;
@@ -38135,7 +38451,10 @@ Ext.define('Ext.panel.Panel', {
}
- delete me.suspendLayout;
+ if (me.collapseMemento) {
+ me.collapseMemento.restoreAll();
+ }
+
if (animated && me.ownerCt) {
@@ -38181,10 +38500,10 @@ Ext.define('Ext.panel.Panel', {
ghostTools : function() {
var tools = [],
- origTools = this.initialConfig.tools;
+ headerTools = this.header.query('tool[hidden=false]');
- if (origTools) {
- Ext.each(origTools, function(tool) {
+ if (headerTools.length) {
+ Ext.each(headerTools, function(tool) {
@@ -38193,8 +38512,7 @@ Ext.define('Ext.panel.Panel', {
type: tool.type
});
});
- }
- else {
+ } else {
tools = [{
type: 'placeholder'
}];
@@ -38206,23 +38524,19 @@ Ext.define('Ext.panel.Panel', {
ghost: function(cls) {
var me = this,
ghostPanel = me.ghostPanel,
- box = me.getBox();
+ box = me.getBox(),
+ header;
if (!ghostPanel) {
ghostPanel = Ext.create('Ext.panel.Panel', {
- renderTo: document.body,
+ renderTo: me.floating ? me.el.dom.parentNode : document.body,
floating: {
shadow: false
},
frame: Ext.supports.CSS3BorderRadius ? me.frame : false,
- title: me.title,
overlapHeader: me.overlapHeader,
headerPosition: me.headerPosition,
- width: me.getWidth(),
- height: me.getHeight(),
- iconCls: me.iconCls,
baseCls: me.baseCls,
- tools: me.ghostTools(),
cls: me.baseCls + '-ghost ' + (cls ||'')
});
me.ghostPanel = ghostPanel;
@@ -38233,6 +38547,19 @@ Ext.define('Ext.panel.Panel', {
} else {
ghostPanel.toFront();
}
+ header = ghostPanel.header;
+
+ if (header) {
+ header.suspendLayout = true;
+ Ext.Array.forEach(header.query('tool'), function(tool){
+ header.remove(tool);
+ });
+ header.suspendLayout = false;
+ }
+ ghostPanel.addTool(me.ghostTools());
+ ghostPanel.setTitle(me.title);
+ ghostPanel.setIconCls(me.iconCls);
+
ghostPanel.el.show();
ghostPanel.setPosition(box.x, box.y);
ghostPanel.setSize(box.width, box.height);
@@ -38268,6 +38595,8 @@ Ext.define('Ext.panel.Panel', {
}
this.callParent([resizable]);
}
+}, function(){
+ this.prototype.animCollapse = Ext.enableFx;
});
@@ -38382,16 +38711,19 @@ Ext.define('Ext.tip.Tip', {
ariaRole: 'tooltip',
initComponent: function() {
- this.callParent(arguments);
+ var me = this;
+
+ me.floating = Ext.apply({}, {shadow: me.shadow}, me.self.prototype.floating);
+ me.callParent(arguments);
- this.constrain = this.constrain || this.constrainPosition;
+ me.constrain = me.constrain || me.constrainPosition;
},
showAt : function(xy){
var me = this;
- this.callParent();
+ this.callParent(arguments);
if (me.isVisible()) {
me.setPagePosition(xy[0], xy[1]);
@@ -38414,7 +38746,7 @@ Ext.define('Ext.tip.Tip', {
el: me.getDragEl(),
delegate: me.header.el,
constrain: me,
- constrainTo: me.el.dom.parentNode
+ constrainTo: me.el.getScopeParent()
};
Ext.Component.prototype.initDraggable.call(me);
@@ -38479,7 +38811,7 @@ Ext.define('Ext.tip.ToolTip', {
me.callParent(arguments);
zIndex = parseInt(me.el.getZIndex(), 10) || 0;
- me.anchorEl.setStyle('z-index', zIndex + 1).setVisibilityMode(Ext.core.Element.DISPLAY);
+ me.anchorEl.setStyle('z-index', zIndex + 1).setVisibilityMode(Ext.Element.DISPLAY);
},
@@ -38494,10 +38826,10 @@ Ext.define('Ext.tip.ToolTip', {
me.mun(tg, 'mouseout', me.onTargetOut, me);
me.mun(tg, 'mousemove', me.onMouseMove, me);
}
-
+
me.target = t;
if (t) {
-
+
me.mon(t, {
@@ -38525,7 +38857,7 @@ Ext.define('Ext.tip.ToolTip', {
if (!me.hidden && me.trackMouse) {
xy = me.getTargetXY();
if (me.constrainPosition) {
- xy = me.el.adjustForConstraints(xy, me.el.dom.parentNode);
+ xy = me.el.adjustForConstraints(xy, me.el.getScopeParent());
}
me.setPagePosition(xy);
}
@@ -38550,8 +38882,8 @@ Ext.define('Ext.tip.ToolTip', {
me.targetCounter++;
var offsets = me.getOffsets(),
xy = (me.anchorToTarget && !me.trackMouse) ? me.el.getAlignToXY(me.anchorTarget, me.getAnchorAlign()) : me.targetXY,
- dw = Ext.core.Element.getViewWidth() - 5,
- dh = Ext.core.Element.getViewHeight() - 5,
+ dw = Ext.Element.getViewWidth() - 5,
+ dh = Ext.Element.getViewHeight() - 5,
de = document.documentElement,
bd = document.body,
scrollX = (de.scrollLeft || bd.scrollLeft || 0) + 5,
@@ -38963,7 +39295,7 @@ Ext.define('Ext.tip.QuickTip', {
initComponent : function(){
var me = this;
-
+
me.target = me.target || Ext.getDoc();
me.targets = me.targets || {};
me.callParent();
@@ -38975,7 +39307,7 @@ Ext.define('Ext.tip.QuickTip', {
i = 0,
len = configs.length,
target, j, targetLen;
-
+
for (; i < len; i++) {
config = configs[i];
target = config.target;
@@ -38995,12 +39327,12 @@ Ext.define('Ext.tip.QuickTip', {
unregister : function(el){
delete this.targets[Ext.id(el)];
},
-
+
cancelShow: function(el){
var me = this,
activeTarget = me.activeTarget;
-
+
el = Ext.get(el).dom;
if (me.isVisible()) {
if (activeTarget && activeTarget.el == el) {
@@ -39010,26 +39342,31 @@ Ext.define('Ext.tip.QuickTip', {
me.clearTimer('show');
}
},
+
getTipCfg: function(e) {
var t = e.getTarget(),
- ttp,
+ titleText = t.title,
cfg;
-
- if(this.interceptTitles && t.title && Ext.isString(t.title)){
- ttp = t.title;
- t.qtip = ttp;
+
+ if (this.interceptTitles && titleText && Ext.isString(titleText)) {
+ t.qtip = titleText;
t.removeAttribute("title");
e.preventDefault();
- }
- else {
+ return {
+ text: titleText
+ };
+ }
+ else {
cfg = this.tagConfig;
t = e.getTarget('[' + cfg.namespace + cfg.attribute + ']');
if (t) {
- ttp = t.getAttribute(cfg.namespace + cfg.attribute);
+ return {
+ target: t,
+ text: t.getAttribute(cfg.namespace + cfg.attribute)
+ };
}
}
- return ttp;
},
@@ -39039,9 +39376,9 @@ Ext.define('Ext.tip.QuickTip', {
elTarget,
cfg,
ns,
- ttp,
+ tipConfig,
autoHide;
-
+
if (me.disabled) {
return;
}
@@ -39054,13 +39391,13 @@ Ext.define('Ext.tip.QuickTip', {
if(!target || target.nodeType !== 1 || target == document || target == document.body){
return;
}
-
+
if (me.activeTarget && ((target == me.activeTarget.el) || Ext.fly(me.activeTarget.el).contains(target))) {
me.clearTimer('hide');
me.show();
return;
}
-
+
if (target) {
Ext.Object.each(me.targets, function(key, value) {
var targetEl = Ext.fly(value.target);
@@ -39083,21 +39420,28 @@ Ext.define('Ext.tip.QuickTip', {
elTarget = Ext.get(target);
cfg = me.tagConfig;
- ns = cfg.namespace;
- ttp = me.getTipCfg(e);
-
- if (ttp) {
+ ns = cfg.namespace;
+ tipConfig = me.getTipCfg(e);
+
+ if (tipConfig) {
+
+
+
+ if (tipConfig.target) {
+ target = tipConfig.target;
+ elTarget = Ext.get(target);
+ }
autoHide = elTarget.getAttribute(ns + cfg.hide);
-
+
me.activeTarget = {
el: target,
- text: ttp,
+ text: tipConfig.text,
width: +elTarget.getAttribute(ns + cfg.width) || null,
autoHide: autoHide != "user" && autoHide !== 'false',
title: elTarget.getAttribute(ns + cfg.title),
cls: elTarget.getAttribute(ns + cfg.cls),
align: elTarget.getAttribute(ns + cfg.align)
-
+
};
me.anchor = elTarget.getAttribute(ns + cfg.anchor);
if (me.anchor) {
@@ -39110,7 +39454,7 @@ Ext.define('Ext.tip.QuickTip', {
onTargetOut : function(e){
var me = this;
-
+
if (me.activeTarget && e.within(me.activeTarget.el) && !me.getTipCfg(e)) {
return;
@@ -39126,7 +39470,7 @@ Ext.define('Ext.tip.QuickTip', {
showAt : function(xy){
var me = this,
target = me.activeTarget;
-
+
if (target) {
if (!me.rendered) {
me.render(Ext.getBody());
@@ -39151,7 +39495,7 @@ Ext.define('Ext.tip.QuickTip', {
}
me.setWidth(target.width);
-
+
if (me.anchor) {
me.constrainPosition = false;
} else if (target.align) {
@@ -39653,7 +39997,7 @@ Ext.define('Ext.draw.CompositeSprite', {
mouseout: me.onMouseOut,
click: me.onClick
});
- me.callParent(arguments);
+ return me.callParent(arguments);
},
@@ -39809,21 +40153,20 @@ Ext.define('Ext.draw.CompositeSprite', {
-Ext.define('Ext.layout.component.Draw', {
+Ext.define('Ext.layout.component.Auto', {
- alias: 'layout.draw',
+ alias: 'layout.autocomponent',
- extend: 'Ext.layout.component.Auto',
+ extend: 'Ext.layout.component.Component',
- type: 'draw',
+ type: 'autocomponent',
onLayout : function(width, height) {
- this.owner.surface.setSize(width, height);
- this.callParent(arguments);
+ this.setTargetSize(width, height);
}
});
@@ -39962,6 +40305,7 @@ function() {
Ext.define('Ext.chart.Mask', {
+ require: ['Ext.chart.MaskLayer'],
constructor: function(config) {
var me = this;
@@ -40105,12 +40449,7 @@ Ext.define('Ext.chart.Mask', {
width: abs(width),
height: abs(height)
};
- me.mask.updateBox({
- x: posX - abs(width),
- y: posY - abs(height),
- width: abs(width),
- height: abs(height)
- });
+ me.mask.updateBox(me.maskSelection);
me.mask.show();
me.maskSprite.setAttributes({
hidden: true
@@ -40151,50 +40490,46 @@ Ext.define('Ext.chart.Navigation', {
constructor: function() {
this.originalStore = this.store;
},
-
+
setZoom: function(zoomConfig) {
var me = this,
- store = me.substore || me.store,
+ axes = me.axes,
bbox = me.chartBBox,
- len = store.getCount(),
- from = (zoomConfig.x / bbox.width * len) >> 0,
- to = Math.ceil(((zoomConfig.x + zoomConfig.width) / bbox.width * len)),
- recFieldsLen, recFields = [], curField, json = [], obj;
-
- store.each(function(rec, i) {
- if (i < from || i > to) {
- return;
- }
- obj = {};
-
- if (!recFields.length) {
- rec.fields.each(function(f) {
- recFields.push(f.name);
- });
- recFieldsLen = recFields.length;
- }
-
- for (i = 0; i < recFieldsLen; i++) {
- curField = recFields[i];
- obj[curField] = rec.get(curField);
+ xScale = 1 / bbox.width,
+ yScale = 1 / bbox.height,
+ zoomer = {
+ x : zoomConfig.x * xScale,
+ y : zoomConfig.y * yScale,
+ width : zoomConfig.width * xScale,
+ height : zoomConfig.height * yScale
+ };
+ axes.each(function(axis) {
+ var ends = axis.calcEnds();
+ if (axis.position == 'bottom' || axis.position == 'top') {
+ var from = (ends.to - ends.from) * zoomer.x + ends.from,
+ to = (ends.to - ends.from) * zoomer.width + from;
+ axis.minimum = from;
+ axis.maximum = to;
+ } else {
+ var to = (ends.to - ends.from) * (1 - zoomer.y) + ends.from,
+ from = to - (ends.to - ends.from) * zoomer.height;
+ axis.minimum = from;
+ axis.maximum = to;
}
- json.push(obj);
- });
- me.store = me.substore = Ext.create('Ext.data.JsonStore', {
- fields: recFields,
- data: json
});
- me.redraw(true);
+ me.redraw(false);
},
+
restoreZoom: function() {
this.store = this.substore = this.originalStore;
this.redraw(true);
}
-
+
});
+
Ext.define('Ext.chart.Shape', {
@@ -40385,13 +40720,17 @@ Ext.define('Ext.draw.Surface', {
y: 0,
+ orderSpritesByZIndex: true,
+
+
+
constructor: function(config) {
var me = this;
config = config || {};
Ext.apply(me, config);
me.domRef = Ext.getDoc().dom;
-
+
me.customAttributes = {};
me.addEvents(
@@ -40429,7 +40768,12 @@ Ext.define('Ext.draw.Surface', {
renderItems: Ext.emptyFn,
- setViewBox: Ext.emptyFn,
+ setViewBox: function (x, y, width, height) {
+ if (isFinite(x) && isFinite(y) && isFinite(width) && isFinite(height)) {
+ this.viewBox = {x: x, y: y, width: width, height: height};
+ this.applyViewBox();
+ }
+ },
addCls: Ext.emptyFn,
@@ -40457,7 +40801,7 @@ Ext.define('Ext.draw.Surface', {
this.add(items);
}
},
-
+
initBackground: function(config) {
var me = this,
@@ -40498,7 +40842,7 @@ Ext.define('Ext.draw.Surface', {
}
}
},
-
+
setSize: function(w, h) {
if (this.background) {
@@ -40508,6 +40852,7 @@ Ext.define('Ext.draw.Surface', {
hidden: false
}, true);
}
+ this.applyViewBox();
},
@@ -40516,7 +40861,7 @@ Ext.define('Ext.draw.Surface', {
attrs = {},
exclude = {},
sattr = sprite.attr;
- for (i in sattr) {
+ for (i in sattr) {
if (this.translateAttrs.hasOwnProperty(i)) {
@@ -40591,28 +40936,45 @@ Ext.define('Ext.draw.Surface', {
return results;
}
sprite = this.prepareItems(args[0], true)[0];
- this.normalizeSpriteCollection(sprite);
+ this.insertByZIndex(sprite);
this.onAdd(sprite);
return sprite;
},
- normalizeSpriteCollection: function(sprite) {
- var items = this.items,
+ insertByZIndex: function(sprite) {
+ var me = this,
+ sprites = me.items.items,
+ len = sprites.length,
+ ceil = Math.ceil,
zIndex = sprite.attr.zIndex,
- idx = items.indexOf(sprite);
+ idx = len,
+ high = idx - 1,
+ low = 0,
+ otherZIndex;
- if (idx < 0 || (idx > 0 && items.getAt(idx - 1).attr.zIndex > zIndex) ||
- (idx < items.length - 1 && items.getAt(idx + 1).attr.zIndex < zIndex)) {
- items.removeAt(idx);
- idx = items.findIndexBy(function(otherSprite) {
- return otherSprite.attr.zIndex > zIndex;
- });
- if (idx < 0) {
- idx = items.length;
+ if (me.orderSpritesByZIndex && len && zIndex < sprites[high].attr.zIndex) {
+
+ while (low <= high) {
+ idx = ceil((low + high) / 2);
+ otherZIndex = sprites[idx].attr.zIndex;
+ if (otherZIndex > zIndex) {
+ high = idx - 1;
+ }
+ else if (otherZIndex < zIndex) {
+ low = idx + 1;
+ }
+ else {
+ break;
+ }
+ }
+
+ while (idx < len && sprites[idx].attr.zIndex <= zIndex) {
+ idx++;
}
- items.insert(idx, sprite);
}
+
+ me.items.insert(idx, sprite);
return idx;
},
@@ -40663,6 +41025,49 @@ Ext.define('Ext.draw.Surface', {
onDestroy: Ext.emptyFn,
+ 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)) {
+ 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.min(viewBoxWidth, relativeHeight);
+
+ me.viewBoxShift = {
+ dx: -viewBoxX,
+ dy: -viewBoxY,
+ scale: size
+ };
+ }
+ },
+
+ transformToViewBox: function (x, y) {
+ if (this.viewBoxShift) {
+ var me = this, shift = me.viewBoxShift;
+ return [x * shift.scale - shift.dx, y * shift.scale - shift.dy];
+ } else {
+ return [x, y];
+ }
+ },
+
+
applyTransformations: function(sprite) {
sprite.bbox.transform = 0;
this.transform(sprite);
@@ -40837,10 +41242,10 @@ Ext.define('Ext.draw.Surface', {
}
return items;
},
-
+
setText: Ext.emptyFn,
-
+
//@private Creates an item and appends it to the surface. Called
@@ -40858,6 +41263,25 @@ Ext.define('Ext.draw.Surface', {
}
});
+
+Ext.define('Ext.layout.component.Draw', {
+
+
+
+ alias: 'layout.draw',
+
+ extend: 'Ext.layout.component.Auto',
+
+
+
+ type: 'draw',
+
+ onLayout : function(width, height) {
+ this.owner.surface.setSize(width, height);
+ this.callParent(arguments);
+ }
+});
+
Ext.define('Ext.draw.Component', {
@@ -40885,9 +41309,8 @@ Ext.define('Ext.draw.Component', {
autoSize: false,
-
-
+
initComponent: function() {
this.callParent(arguments);
@@ -40909,22 +41332,22 @@ Ext.define('Ext.draw.Component', {
bbox, items, width, height, x, y;
me.callParent(arguments);
- me.createSurface();
+ if (me.createSurface() !== false) {
+ items = me.surface.items;
- items = me.surface.items;
-
- if (viewBox || autoSize) {
- bbox = items.getBBox();
- width = bbox.width;
- height = bbox.height;
- x = bbox.x;
- y = bbox.y;
- if (me.viewBox) {
- me.surface.setViewBox(x, y, width, height);
- }
- else {
-
- me.autoSizeSurface();
+ if (viewBox || autoSize) {
+ bbox = items.getBBox();
+ width = bbox.width;
+ height = bbox.height;
+ x = bbox.x;
+ y = bbox.y;
+ if (me.viewBox) {
+ me.surface.setViewBox(x, y, width, height);
+ }
+ else {
+
+ me.autoSizeSurface();
+ }
}
}
},
@@ -40961,8 +41384,13 @@ Ext.define('Ext.draw.Component', {
height: this.height,
renderTo: this.el
}, this.initialConfig));
+ if (!surface) {
+
+ return false;
+ }
this.surface = surface;
+
function refire(eventName) {
return function(e) {
this.fireEvent(eventName, e);
@@ -41192,6 +41620,7 @@ Ext.define('Ext.chart.LegendItem', {
}
});
+
Ext.define('Ext.chart.Legend', {
@@ -41247,7 +41676,7 @@ Ext.define('Ext.chart.Legend', {
me.items = [];
me.isVertical = ("left|right|float".indexOf(me.position) !== -1);
-
+
me.origX = me.x;
me.origY = me.y;
@@ -41256,9 +41685,9 @@ Ext.define('Ext.chart.Legend', {
create: function() {
var me = this;
+ me.createBox();
me.createItems();
if (!me.created && me.isDisplayed()) {
- me.createBox();
me.created = true;
@@ -41293,8 +41722,8 @@ Ext.define('Ext.chart.Legend', {
math = Math,
mfloor = math.floor,
mmax = math.max,
- index = 0,
- i = 0,
+ index = 0,
+ i = 0,
len = items ? items.length : 0,
x, y, spacing, item, bbox, height, width;
@@ -41320,7 +41749,7 @@ Ext.define('Ext.chart.Legend', {
bbox = item.getBBox();
- width = bbox.width;
+ width = bbox.width;
height = bbox.height;
if (i + j === 0) {
@@ -41367,13 +41796,20 @@ Ext.define('Ext.chart.Legend', {
createBox: function() {
var me = this,
- box = me.boxSprite = me.chart.surface.add(Ext.apply({
- type: 'rect',
- stroke: me.boxStroke,
- "stroke-width": me.boxStrokeWidth,
- fill: me.boxFill,
- zIndex: me.boxZIndex
- }, me.getBBox()));
+ box;
+
+ if (me.boxSprite) {
+ me.boxSprite.destroy();
+ }
+
+ box = me.boxSprite = me.chart.surface.add(Ext.apply({
+ type: 'rect',
+ stroke: me.boxStroke,
+ "stroke-width": me.boxStrokeWidth,
+ fill: me.boxFill,
+ zIndex: me.boxZIndex
+ }, me.getBBox()));
+
box.redraw();
},
@@ -41393,7 +41829,7 @@ Ext.define('Ext.chart.Legend', {
chartY = chartBBox.y + insets,
surface = chart.surface,
mfloor = Math.floor;
-
+
if (me.isDisplayed()) {
switch(me.position) {
@@ -41430,6 +41866,7 @@ Ext.define('Ext.chart.Legend', {
}
});
+
Ext.define('Ext.chart.Chart', {
@@ -41475,10 +41912,17 @@ Ext.define('Ext.chart.Chart', {
+
+
+
+
+
constructor: function(config) {
var me = this,
defaultAnim;
+
+ config = Ext.apply({}, config);
me.initTheme(config.theme || me.theme);
if (me.gradients) {
Ext.apply(config, { gradients: me.gradients });
@@ -41502,6 +41946,10 @@ Ext.define('Ext.chart.Chart', {
me.mixins.navigation.constructor.call(me, config);
me.callParent([config]);
},
+
+ getChartStore: function(){
+ return this.substore || this.store;
+ },
initComponent: function() {
var me = this,
@@ -41778,7 +42226,7 @@ Ext.define('Ext.chart.Chart', {
refresh: function() {
var me = this;
- if (me.rendered && me.curWidth != undefined && me.curHeight != undefined) {
+ if (me.rendered && me.curWidth !== undefined && me.curHeight !== undefined) {
if (me.fireEvent('beforerefresh', me) !== false) {
me.redraw();
me.fireEvent('refresh', me);
@@ -41791,7 +42239,7 @@ Ext.define('Ext.chart.Chart', {
var me = this;
if (!initial && me.store) {
if (store !== me.store && me.store.autoDestroy) {
- me.store.destroy();
+ me.store.destroyStore();
}
else {
me.store.un('datachanged', me.refresh, me);
@@ -42022,7 +42470,7 @@ Ext.define('Ext.chart.Chart', {
destroy: function() {
- this.surface.destroy();
+ Ext.destroy(this.surface);
this.bindStore(null);
this.callParent(arguments);
}
@@ -42199,18 +42647,6 @@ Ext.define('Ext.chart.Label', {
requires: ['Ext.draw.Color'],
-
-
-
-
-
-
-
-
-
-
-
-
@@ -42219,7 +42655,7 @@ Ext.define('Ext.chart.Label', {
//@private a regex to parse url type colors.
colorStringRe: /url\s*\(\s*#([^\/)]+)\s*\)/,
-
+
//@private the mixin constructor. Used internally by Series.
constructor: function(config) {
@@ -42255,104 +42691,111 @@ Ext.define('Ext.chart.Label', {
color = config.color,
field = [].concat(config.field),
group = me.labelsGroup,
+ groupLength = (group || 0) && group.length,
store = me.chart.store,
len = store.getCount(),
itemLength = (items || 0) && items.length,
ratio = itemLength / len,
gradientsCount = (gradients || 0) && gradients.length,
Color = Ext.draw.Color,
- gradient, i, count, index, j, k, colorStopTotal, colorStopIndex, colorStop, item, label,
+ hides = [],
+ gradient, i, count, groupIndex, index, j, k, colorStopTotal, colorStopIndex, colorStop, item, label,
storeItem, sprite, spriteColor, spriteBrightness, labelColor, colorString;
if (display == 'none') {
return;
}
+
+ if(itemLength == 0){
+ while(groupLength--)
+ hides.push(groupLength);
+ }else{
+ for (i = 0, count = 0, groupIndex = 0; i < len; i++) {
+ index = 0;
+ for (j = 0; j < ratio; j++) {
+ item = items[count];
+ label = group.getAt(groupIndex);
+ storeItem = store.getAt(i);
+
+ while(this.__excludes && this.__excludes[index] && ratio > 1) {
+ if(field[j]){
+ hides.push(groupIndex);
+ }
+ index++;
- for (i = 0, count = 0; i < len; i++) {
- index = 0;
- for (j = 0; j < ratio; j++) {
- item = items[count];
- label = group.getAt(count);
- storeItem = store.getAt(i);
-
-
- while(this.__excludes && this.__excludes[index]) {
- index++;
- }
-
- if (!item && label) {
- label.hide(true);
- }
+ }
- if (item && field[j]) {
- if (!label) {
- label = me.onCreateLabel(storeItem, item, i, display, j, index);
+ if (!item && label) {
+ label.hide(true);
+ groupIndex++;
}
- me.onPlaceLabel(label, storeItem, item, i, display, animate, j, index);
-
- if (config.contrast && item.sprite) {
- sprite = item.sprite;
-
- if (sprite._endStyle) {
- colorString = sprite._endStyle.fill;
- }
- else if (sprite._to) {
- colorString = sprite._to.fill;
- }
- else {
- colorString = sprite.attr.fill;
+ if (item && field[j]) {
+ if (!label) {
+ label = me.onCreateLabel(storeItem, item, i, display, j, index);
}
- colorString = colorString || sprite.attr.fill;
-
- spriteColor = Color.fromString(colorString);
+ me.onPlaceLabel(label, storeItem, item, i, display, animate, j, index);
+ groupIndex++;
+
- if (colorString && !spriteColor) {
- colorString = colorString.match(me.colorStringRe)[1];
- for (k = 0; k < gradientsCount; k++) {
- gradient = gradients[k];
- if (gradient.id == colorString) {
-
- colorStop = 0; colorStopTotal = 0;
- for (colorStopIndex in gradient.stops) {
- colorStop++;
- colorStopTotal += Color.fromString(gradient.stops[colorStopIndex].color).getGrayscale();
+ if (config.contrast && item.sprite) {
+ sprite = item.sprite;
+
+ 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) {
+ colorString = colorString.match(me.colorStringRe)[1];
+ for (k = 0; k < gradientsCount; k++) {
+ gradient = gradients[k];
+ if (gradient.id == colorString) {
+
+ colorStop = 0; colorStopTotal = 0;
+ for (colorStopIndex in gradient.stops) {
+ colorStop++;
+ colorStopTotal += Color.fromString(gradient.stops[colorStopIndex].color).getGrayscale();
+ }
+ spriteBrightness = (colorStopTotal / colorStop) / 255;
+ break;
}
- spriteBrightness = (colorStopTotal / colorStop) / 255;
- break;
}
}
+ 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;
+ label.setAttributes({
+ fill: String(Color.fromHSL.apply({}, labelColor))
+ }, true);
}
- 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;
- label.setAttributes({
- fill: String(Color.fromHSL.apply({}, labelColor))
- }, true);
+
}
+ count++;
+ index++;
}
- count++;
- index++;
}
}
- me.hideLabels(count);
+ me.hideLabels(hides);
},
-
- //@private a method to hide labels.
-
- hideLabels: function(index) {
- var labelsGroup = this.labelsGroup, len;
- if (labelsGroup) {
- len = labelsGroup.getCount();
- while (len-->index) {
- labelsGroup.getAt(len).hide(true);
- }
- }
+ hideLabels: function(hides){
+ var labelsGroup = this.labelsGroup,
+ hlen = hides.length;
+ while(hlen--)
+ labelsGroup.getAt(hides[hlen]).hide(true);
}
});
Ext.define('Ext.chart.MaskLayer', {
@@ -42462,7 +42905,10 @@ Ext.define('Ext.chart.Tip', {
constrainPosition: false
});
me.tooltip = Ext.create('Ext.tip.ToolTip', me.tipConfig);
- Ext.getBody().on('mousemove', me.tooltip.onMouseMove, me.tooltip);
+ me.chart.surface.on('mousemove', me.tooltip.onMouseMove, me.tooltip);
+ me.chart.surface.on('mouseleave', function() {
+ me.hideTip();
+ });
if (me.tipConfig.surface) {
surface = me.tipConfig.surface;
@@ -42588,53 +43034,56 @@ Ext.define('Ext.chart.axis.Axis', {
+
+
//@private force min/max values from store
forceMinMax: false,
-
+
dashSize: 3,
-
+
position: 'bottom',
-
+
skipFirst: false,
-
+
length: 0,
-
+
width: 0,
-
+
majorTickSteps: false,
applyData: Ext.emptyFn,
-
- calcEnds: function() {
+ getRange: function () {
var me = this,
+ store = me.chart.getChartStore(),
+ fields = me.fields,
+ ln = fields.length,
math = Math,
mmax = math.max,
mmin = math.min,
- store = me.chart.substore || me.chart.store,
- series = me.chart.series.items,
- fields = me.fields,
- ln = fields.length,
+ aggregate = false,
min = isNaN(me.minimum) ? Infinity : me.minimum,
max = isNaN(me.maximum) ? -Infinity : me.maximum,
- prevMin = me.prevMin,
- prevMax = me.prevMax,
- aggregate = false,
- total = 0,
+ total = 0, i, l, value, values, rec,
excludes = [],
- outfrom, outto,
- i, l, values, rec, out;
+ series = me.chart.series.items;
+
+
+
+
+
+
for (i = 0, l = series.length; !aggregate && i < l; i++) {
aggregate = aggregate || series[i].stacked;
excludes = series[i].__excludes || excludes;
@@ -42651,8 +43100,8 @@ Ext.define('Ext.chart.axis.Axis', {
rec = record.get(fields[i]);
values[+(rec > 0)] += math.abs(rec);
}
- max = mmax(max, -values[0], values[1]);
- min = mmin(min, -values[0], values[1]);
+ max = mmax(max, -values[0], +values[1]);
+ min = mmin(min, -values[0], +values[1]);
}
else {
for (i = 0; i < ln; i++) {
@@ -42660,8 +43109,8 @@ Ext.define('Ext.chart.axis.Axis', {
continue;
}
value = record.get(fields[i]);
- max = mmax(max, value);
- min = mmin(min, value);
+ max = mmax(max, +value);
+ min = mmin(min, +value);
}
}
});
@@ -42672,9 +43121,30 @@ Ext.define('Ext.chart.axis.Axis', {
min = me.prevMin || 0;
}
- if (min != max && (max != (max >> 0))) {
- max = (max >> 0) + 1;
+ if (min != max && (max != Math.floor(max))) {
+ max = Math.floor(max) + 1;
+ }
+
+ if (!isNaN(me.minimum)) {
+ min = me.minimum;
+ }
+
+ if (!isNaN(me.maximum)) {
+ max = me.maximum;
}
+
+ return {min: min, max: max};
+ },
+
+
+ calcEnds: function() {
+ var me = this,
+ fields = me.fields,
+ range = me.getRange(),
+ min = range.min,
+ max = range.max,
+ outfrom, outto, out;
+
out = Ext.draw.Draw.snapEnds(min, max, me.majorTickSteps !== false ? (me.majorTickSteps +1) : me.steps);
outfrom = out.from;
outto = out.to;
@@ -42696,10 +43166,10 @@ Ext.define('Ext.chart.axis.Axis', {
out.from = me.minimum;
}
-
+
out.step = (out.to - out.from) / (outto - outfrom) * out.step;
-
+
if (me.adjustMaximumByMajorUnit) {
out.to += out.step;
}
@@ -42739,7 +43209,7 @@ Ext.define('Ext.chart.axis.Axis', {
dashesX,
dashesY,
delta;
-
+
@@ -42759,11 +43229,11 @@ Ext.define('Ext.chart.axis.Axis', {
path = ["M", x, currentY, "l", length, 0];
trueLength = length - (gutterX * 2);
}
-
+
delta = trueLength / (steps || 1);
dashesX = Math.max(subDashesX +1, 0);
dashesY = Math.max(subDashesY +1, 0);
- if (me.type == 'Numeric') {
+ if (me.type == 'Numeric' || me.type == 'Time') {
calcLabels = true;
me.labels = [stepCalcs.from];
}
@@ -42846,7 +43316,7 @@ Ext.define('Ext.chart.axis.Axis', {
drawGrid: function() {
var me = this,
- surface = me.chart.surface,
+ surface = me.chart.surface,
grid = me.grid,
odd = grid.odd,
even = grid.even,
@@ -42860,7 +43330,7 @@ Ext.define('Ext.chart.axis.Axis', {
i = 1,
path = [], styles, lineWidth, dlineWidth,
oddPath = [], evenPath = [];
-
+
if ((gutter[1] !== 0 && (position == 'left' || position == 'right')) ||
(gutter[0] !== 0 && (position == 'top' || position == 'bottom'))) {
i = 0;
@@ -42875,25 +43345,25 @@ Ext.define('Ext.chart.axis.Axis', {
lineWidth = (styles.lineWidth || styles['stroke-width'] || 0) / 2;
dlineWidth = 2 * lineWidth;
if (position == 'left') {
- path.push("M", prevPoint[0] + 1 + lineWidth, prevPoint[1] + 0.5 - lineWidth,
+ path.push("M", prevPoint[0] + 1 + lineWidth, prevPoint[1] + 0.5 - lineWidth,
"L", prevPoint[0] + 1 + width - lineWidth, prevPoint[1] + 0.5 - lineWidth,
"L", point[0] + 1 + width - lineWidth, point[1] + 0.5 + lineWidth,
"L", point[0] + 1 + lineWidth, point[1] + 0.5 + lineWidth, "Z");
}
else if (position == 'right') {
- path.push("M", prevPoint[0] - lineWidth, prevPoint[1] + 0.5 - lineWidth,
+ path.push("M", prevPoint[0] - lineWidth, prevPoint[1] + 0.5 - lineWidth,
"L", prevPoint[0] - width + lineWidth, prevPoint[1] + 0.5 - lineWidth,
"L", point[0] - width + lineWidth, point[1] + 0.5 + lineWidth,
"L", point[0] - lineWidth, point[1] + 0.5 + lineWidth, "Z");
}
else if (position == 'top') {
- path.push("M", prevPoint[0] + 0.5 + lineWidth, prevPoint[1] + 1 + lineWidth,
+ path.push("M", prevPoint[0] + 0.5 + lineWidth, prevPoint[1] + 1 + lineWidth,
"L", prevPoint[0] + 0.5 + lineWidth, prevPoint[1] + 1 + width - lineWidth,
"L", point[0] + 0.5 - lineWidth, point[1] + 1 + width - lineWidth,
"L", point[0] + 0.5 - lineWidth, point[1] + 1 + lineWidth, "Z");
}
else {
- path.push("M", prevPoint[0] + 0.5 + lineWidth, prevPoint[1] - lineWidth,
+ path.push("M", prevPoint[0] + 0.5 + lineWidth, prevPoint[1] - lineWidth,
"L", prevPoint[0] + 0.5 + lineWidth, prevPoint[1] - width + lineWidth,
"L", point[0] + 0.5 - lineWidth, point[1] - width + lineWidth,
"L", point[0] + 0.5 - lineWidth, point[1] - lineWidth, "Z");
@@ -42932,7 +43402,7 @@ Ext.define('Ext.chart.axis.Axis', {
type: 'path',
path: evenPath
});
- }
+ }
me.gridEven.setAttributes(Ext.apply({
path: evenPath,
hidden: false
@@ -42990,8 +43460,8 @@ Ext.define('Ext.chart.axis.Axis', {
if (me.label.rotation) {
textLabel.setAttributes({
rotation: {
- degrees: 0
- }
+ degrees: 0
+ }
}, true);
textLabel._ubbox = textLabel.getBBox();
textLabel.setAttributes(me.label, true);
@@ -43000,7 +43470,7 @@ Ext.define('Ext.chart.axis.Axis', {
}
return textLabel;
},
-
+
rect2pointArray: function(sprite) {
var surface = this.chart.surface,
rect = surface.getBBox(sprite, true),
@@ -43016,24 +43486,24 @@ Ext.define('Ext.chart.axis.Axis', {
p1[0] = matrix.x.apply(matrix, p1p);
p1[1] = matrix.y.apply(matrix, p1p);
-
+
p2[0] = matrix.x.apply(matrix, p2p);
p2[1] = matrix.y.apply(matrix, p2p);
-
+
p3[0] = matrix.x.apply(matrix, p3p);
p3[1] = matrix.y.apply(matrix, p3p);
-
+
p4[0] = matrix.x.apply(matrix, p4p);
p4[1] = matrix.y.apply(matrix, p4p);
return [p1, p2, p3, p4];
},
-
+
intersect: function(l1, l2) {
var r1 = this.rect2pointArray(l1),
r2 = this.rect2pointArray(l2);
return !!Ext.draw.Draw.intersect(r1, r2).length;
},
-
+
drawHorizontalLabels: function() {
var me = this,
labelConf = me.label,
@@ -43057,8 +43527,8 @@ Ext.define('Ext.chart.axis.Axis', {
point = inflections[0];
firstLabel = me.getOrCreateLabel(0, me.label.renderer(labels[0]));
- ratio = Math.abs(Math.sin(labelConf.rotate && (labelConf.rotate.degrees * Math.PI / 180) || 0)) >> 0;
-
+ ratio = Math.floor(Math.abs(Math.sin(labelConf.rotate && (labelConf.rotate.degrees * Math.PI / 180) || 0)));
+
for (i = 0; i < ln; i++) {
point = inflections[i];
text = me.label.renderer(labels[i]);
@@ -43080,7 +43550,7 @@ Ext.define('Ext.chart.axis.Axis', {
else {
y = point[1] + (me.dashSize * 2) + me.label.padding + (bbox.height / 2);
}
-
+
textLabel.setAttributes({
hidden: false,
x: x,
@@ -43093,13 +43563,13 @@ Ext.define('Ext.chart.axis.Axis', {
textLabel.hide(true);
continue;
}
-
+
prevLabel = textLabel;
}
return maxHeight;
},
-
+
drawVerticalLabels: function() {
var me = this,
inflections = me.inflections,
@@ -43123,7 +43593,7 @@ Ext.define('Ext.chart.axis.Axis', {
text = me.label.renderer(labels[i]);
textLabel = me.getOrCreateLabel(i, text);
bbox = textLabel._bbox;
-
+
maxWidth = max(maxWidth, bbox.width + me.dashSize + me.label.padding);
y = point[1];
if (gutterY < bbox.height / 2) {
@@ -43139,7 +43609,7 @@ Ext.define('Ext.chart.axis.Axis', {
}
else {
x = point[0] + me.dashSize + me.label.padding + 2;
- }
+ }
textLabel.setAttributes(Ext.apply({
hidden: false,
x: x,
@@ -43152,7 +43622,7 @@ Ext.define('Ext.chart.axis.Axis', {
}
prevLabel = textLabel;
}
-
+
return maxWidth;
},
@@ -43167,7 +43637,7 @@ Ext.define('Ext.chart.axis.Axis', {
ln, i;
if (position == 'left' || position == 'right') {
- maxWidth = me.drawVerticalLabels();
+ maxWidth = me.drawVerticalLabels();
} else {
maxHeight = me.drawHorizontalLabels();
}
@@ -43334,7 +43804,9 @@ Ext.define('Ext.chart.axis.Gauge', {
extend: 'Ext.chart.axis.Abstract',
+
+
@@ -43403,7 +43875,7 @@ Ext.define('Ext.chart.axis.Gauge', {
this.drawTitle();
}
},
-
+
drawTitle: function() {
var me = this,
chart = me.chart,
@@ -43411,12 +43883,12 @@ Ext.define('Ext.chart.axis.Gauge', {
bbox = chart.chartBBox,
labelSprite = me.titleSprite,
labelBBox;
-
+
if (!labelSprite) {
me.titleSprite = labelSprite = surface.add({
type: 'text',
zIndex: 2
- });
+ });
}
labelSprite.setAttributes(Ext.apply({
text: me.title
@@ -43509,7 +43981,7 @@ Ext.define('Ext.chart.axis.Numeric', {
var me = this,
hasLabel = !!(config.label && config.label.renderer),
label;
-
+
me.callParent([config]);
label = me.label;
if (me.roundToDecimal === false) {
@@ -43519,14 +43991,14 @@ Ext.define('Ext.chart.axis.Numeric', {
label.renderer = function(v) {
return me.roundToDecimal(v, me.decimals);
};
- }
+ }
},
-
+
roundToDecimal: function(v, dec) {
var val = Math.pow(10, dec || 0);
- return ((v * val) >> 0) / val;
+ return Math.floor(v * val) / val;
},
-
+
minimum: NaN,
@@ -43807,6 +44279,8 @@ Ext.define('Ext.data.AbstractStore', {
+
+
sortRoot: 'data',
@@ -43832,6 +44306,9 @@ Ext.define('Ext.data.AbstractStore', {
'load',
+
+
+ 'write',
'beforesync',
@@ -43865,6 +44342,7 @@ Ext.define('Ext.data.AbstractStore', {
me.implicitModel = true;
}
+
me.setProxy(me.proxy || me.model.getProxy());
@@ -44256,7 +44734,7 @@ Ext.define('Ext.data.AbstractStore', {
isLoading: function() {
- return this.loading;
+ return !!this.loading;
}
});
@@ -44281,7 +44759,7 @@ Ext.define('Ext.data.Store', {
alias: 'store.store',
- requires: ['Ext.ModelManager', 'Ext.data.Model', 'Ext.util.Grouper'],
+ requires: ['Ext.data.StoreManager', 'Ext.ModelManager', 'Ext.data.Model', 'Ext.util.Grouper'],
uses: ['Ext.data.proxy.Memory'],
@@ -44289,11 +44767,9 @@ Ext.define('Ext.data.Store', {
remoteFilter: false,
-
-
- remoteGroup : false,
+ remoteGroup : false,
@@ -44319,36 +44795,53 @@ Ext.define('Ext.data.Store', {
sortOnFilter: true,
-
+
buffered: false,
-
+
purgePageCount: 5,
isStore: true,
+ onClassExtended: function(cls, data) {
+ var model = data.model;
+
+ if (typeof model == 'string') {
+ var onBeforeClassCreated = data.onBeforeClassCreated;
+
+ data.onBeforeClassCreated = function(cls, data) {
+ var me = this;
+
+ Ext.require(model, function() {
+ onBeforeClassCreated.call(me, cls, data);
+ });
+ };
+ }
+ },
+
constructor: function(config) {
- config = config || {};
+
+ config = Ext.Object.merge({}, config);
var me = this,
groupers = config.groupers || me.groupers,
groupField = config.groupField || me.groupField,
proxy,
data;
-
+
if (config.buffered || me.buffered) {
me.prefetchData = Ext.create('Ext.util.MixedCollection', false, function(record) {
return record.index;
});
me.pendingRequests = [];
me.pagesRequested = [];
-
+
me.sortOnLoad = false;
me.filterOnLoad = false;
}
-
+
me.addEvents(
'beforeprefetch',
@@ -44368,7 +44861,7 @@ Ext.define('Ext.data.Store', {
me.inlineData = data;
delete config.data;
}
-
+
if (!groupers && groupField) {
groupers = [{
property : groupField,
@@ -44376,14 +44869,14 @@ Ext.define('Ext.data.Store', {
}];
}
delete config.groupers;
-
+
me.groupers = Ext.create('Ext.util.MixedCollection');
me.groupers.addAll(me.decodeGroupers(groupers));
this.callParent([config]);
-
+
if (me.groupers.items.length) {
me.sort(me.groupers.items, 'prepend', false);
}
@@ -44407,11 +44900,14 @@ Ext.define('Ext.data.Store', {
}
},
-
+
onBeforeSort: function() {
- this.sort(this.groupers.items, 'prepend', false);
+ var groupers = this.groupers;
+ if (groupers.getCount() > 0) {
+ this.sort(groupers.items, 'prepend', false);
+ }
},
-
+
decodeGroupers: function(groupers) {
if (!Ext.isArray(groupers)) {
@@ -44435,7 +44931,7 @@ Ext.define('Ext.data.Store', {
property: config
};
}
-
+
Ext.applyIf(config, {
root : 'data',
direction: "ASC"
@@ -44459,13 +44955,14 @@ Ext.define('Ext.data.Store', {
return groupers;
},
-
+
group: function(groupers, direction) {
var me = this,
+ hasNew = false,
grouper,
newGroupers;
-
+
if (Ext.isArray(groupers)) {
newGroupers = groupers;
} else if (Ext.isObject(groupers)) {
@@ -44485,24 +44982,26 @@ Ext.define('Ext.data.Store', {
grouper.setDirection(direction);
}
}
-
+
if (newGroupers && newGroupers.length) {
+ hasNew = true;
newGroupers = me.decodeGroupers(newGroupers);
me.groupers.clear();
me.groupers.addAll(newGroupers);
}
-
+
if (me.remoteGroup) {
me.load({
scope: me,
callback: me.fireGroupChange
});
} else {
- me.sort();
- me.fireEvent('groupchange', me, me.groupers);
+
+ me.sort(null, null, null, hasNew);
+ me.fireGroupChange();
}
},
-
+
clearGrouping: function(){
var me = this;
@@ -44521,15 +45020,15 @@ Ext.define('Ext.data.Store', {
me.fireEvent('groupchange', me, me.groupers);
}
},
-
+
isGrouped: function() {
- return this.groupers.getCount() > 0;
+ return this.groupers.getCount() > 0;
},
-
+
fireGroupChange: function(){
- this.fireEvent('groupchange', this, this.groupers);
+ this.fireEvent('groupchange', this, this.groupers);
},
@@ -44649,7 +45148,7 @@ Ext.define('Ext.data.Store', {
record.set(me.modelDefaults);
records[i] = record;
-
+
me.data.insert(index + i, record);
record.join(me);
@@ -44723,11 +45222,11 @@ Ext.define('Ext.data.Store', {
for (; i < length; i++) {
record = records[i];
index = me.data.indexOf(record);
-
+
if (me.snapshot) {
me.snapshot.remove(record);
}
-
+
if (index > -1) {
isPhantom = record.phantom === true;
if (!isMove && !isPhantom) {
@@ -44761,7 +45260,7 @@ Ext.define('Ext.data.Store', {
load: function(options) {
var me = this;
-
+
options = options || {};
if (Ext.isFunction(options)) {
@@ -44776,7 +45275,7 @@ Ext.define('Ext.data.Store', {
start: (me.currentPage - 1) * me.pageSize,
limit: me.pageSize,
addRecords: false
- });
+ });
return me.callParent([options]);
},
@@ -44806,7 +45305,7 @@ Ext.define('Ext.data.Store', {
Ext.callback(operation.callback, operation.scope || me, [records, operation, successful]);
},
-
+
onCreateRecords: function(records, operation, success) {
if (success) {
@@ -44978,6 +45477,7 @@ Ext.define('Ext.data.Store', {
loadData: function(data, append) {
var model = this.model,
length = data.length,
+ newData = [],
i,
record;
@@ -44985,14 +45485,29 @@ Ext.define('Ext.data.Store', {
for (i = 0; i < length; i++) {
record = data[i];
- if (! (record instanceof Ext.data.Model)) {
- data[i] = Ext.ModelManager.create(record, model);
+ if (!(record instanceof Ext.data.Model)) {
+ record = Ext.ModelManager.create(record, model);
}
+ newData.push(record);
}
- this.loadRecords(data, {addRecords: append});
+ this.loadRecords(newData, {addRecords: append});
},
+
+
+ loadRawData : function(data, append) {
+ var me = this,
+ result = me.proxy.reader.read(data),
+ records = result.records;
+
+ if (result.success) {
+ me.loadRecords(records, { addRecords: append });
+ me.fireEvent('load', me, records, true);
+ }
+ },
+
+
loadRecords: function(records, options) {
var me = this,
@@ -45035,38 +45550,40 @@ Ext.define('Ext.data.Store', {
- loadPage: function(page) {
+ loadPage: function(page, options) {
var me = this;
+ options = Ext.apply({}, options);
me.currentPage = page;
- me.read({
+ me.read(Ext.applyIf(options, {
page: page,
start: (page - 1) * me.pageSize,
limit: me.pageSize,
addRecords: !me.clearOnPageLoad
- });
+ }));
},
- nextPage: function() {
- this.loadPage(this.currentPage + 1);
+ nextPage: function(options) {
+ this.loadPage(this.currentPage + 1, options);
},
- previousPage: function() {
- this.loadPage(this.currentPage - 1);
+ previousPage: function(options) {
+ this.loadPage(this.currentPage - 1, options);
},
clearData: function() {
- this.data.each(function(record) {
- record.unjoin();
+ var me = this;
+ me.data.each(function(record) {
+ record.unjoin(me);
});
- this.data.clear();
+ me.data.clear();
},
-
+
prefetch: function(options) {
@@ -45094,17 +45611,17 @@ Ext.define('Ext.data.Store', {
me.loading = true;
me.proxy.read(operation, me.onProxyPrefetch, me);
}
-
+
return me;
},
-
+
prefetchPage: function(page, options) {
var me = this,
pageSize = me.pageSize,
start = (page - 1) * me.pageSize,
end = start + pageSize;
-
+
if (Ext.Array.indexOf(me.pagesRequested, page) === -1 && !me.rangeSatisfied(start, end)) {
options = options || {};
@@ -45116,31 +45633,31 @@ Ext.define('Ext.data.Store', {
callback: me.onWaitForGuarantee,
scope: me
});
-
+
me.prefetch(options);
}
-
+
},
-
+
getRequestId: function() {
this.requestSeed = this.requestSeed || 1;
return this.requestSeed++;
},
-
+
onProxyPrefetch: function(operation) {
var me = this,
resultSet = operation.getResultSet(),
records = operation.getRecords(),
-
+
successful = operation.wasSuccessful();
-
+
if (resultSet) {
me.totalCount = resultSet.total;
me.fireEvent('totalcountchange', me.totalCount);
}
-
+
if (successful) {
me.cacheRecords(records, operation);
}
@@ -45148,10 +45665,10 @@ Ext.define('Ext.data.Store', {
if (operation.page) {
Ext.Array.remove(me.pagesRequested, operation.page);
}
-
+
me.loading = false;
me.fireEvent('prefetch', me, records, successful, operation);
-
+
if (operation.blocking) {
me.fireEvent('load', me, records, successful);
@@ -45160,32 +45677,32 @@ Ext.define('Ext.data.Store', {
Ext.callback(operation.callback, operation.scope || me, [records, operation, successful]);
},
-
+
cacheRecords: function(records, operation) {
var me = this,
i = 0,
length = records.length,
start = operation ? operation.start : 0;
-
+
if (!Ext.isDefined(me.totalCount)) {
me.totalCount = records.length;
me.fireEvent('totalcountchange', me.totalCount);
}
-
+
for (; i < length; i++) {
records[i].index = start + i;
}
-
+
me.prefetchData.addAll(records);
if (me.purgePageCount) {
me.purgeRecords();
}
-
+
},
-
-
+
+
purgeRecords: function() {
var me = this,
@@ -45198,7 +45715,7 @@ Ext.define('Ext.data.Store', {
me.prefetchData.removeAt(0);
}
},
-
+
rangeSatisfied: function(start, end) {
var me = this,
@@ -45213,12 +45730,12 @@ Ext.define('Ext.data.Store', {
}
return satisfied;
},
-
+
getPageFromRecordIndex: function(index) {
return Math.floor(index / this.pageSize) + 1;
},
-
+
onGuaranteedRange: function() {
var me = this,
@@ -45228,56 +45745,60 @@ Ext.define('Ext.data.Store', {
range = [],
record,
i = start;
-
-
+
+ end = Math.max(0, end);
+
+
if (start !== me.guaranteedStart && end !== me.guaranteedEnd) {
me.guaranteedStart = start;
me.guaranteedEnd = end;
-
+
for (; i <= end; i++) {
record = me.prefetchData.getByKey(i);
- range.push(record);
+ if (record) {
+ range.push(record);
+ }
}
me.fireEvent('guaranteedrange', range, start, end);
if (me.cb) {
me.cb.call(me.scope || me, range);
}
}
-
+
me.unmask();
},
-
+
mask: function() {
this.masked = true;
this.fireEvent('beforeload');
},
-
+
unmask: function() {
if (this.masked) {
this.fireEvent('load');
}
},
-
+
hasPendingRequests: function() {
return this.pendingRequests.length;
},
-
-
+
+
onWaitForGuarantee: function() {
if (!this.hasPendingRequests()) {
this.onGuaranteedRange();
}
},
-
+
guaranteeRange: function(start, end, cb, scope) {
-
+
end = (end > this.totalCount) ? this.totalCount - 1 : end;
-
+
var me = this,
i = start,
prefetchData = me.prefetchData,
@@ -45286,7 +45807,7 @@ Ext.define('Ext.data.Store', {
endLoaded = !!prefetchData.getByKey(end),
startPage = me.getPageFromRecordIndex(start),
endPage = me.getPageFromRecordIndex(end);
-
+
me.cb = cb;
me.scope = scope;
@@ -45321,7 +45842,7 @@ Ext.define('Ext.data.Store', {
me.onGuaranteedRange();
}
},
-
+
sort: function() {
@@ -45331,7 +45852,7 @@ Ext.define('Ext.data.Store', {
start,
end,
range;
-
+
if (me.buffered) {
if (me.remoteSort) {
prefetchData.clear();
@@ -45340,7 +45861,7 @@ Ext.define('Ext.data.Store', {
sorters = me.getSorters();
start = me.guaranteedStart;
end = me.guaranteedEnd;
-
+
if (sorters.length) {
prefetchData.sort(sorters);
range = prefetchData.getRange();
@@ -45378,7 +45899,7 @@ Ext.define('Ext.data.Store', {
me.fireEvent('datachanged', me);
}
},
-
+
find: function(property, value, start, anyMatch, caseSensitive, exactMatch) {
var fn = this.createFilterFn(property, value, anyMatch, caseSensitive, exactMatch);
@@ -45406,7 +45927,7 @@ Ext.define('Ext.data.Store', {
findExact: function(property, value, start) {
return this.data.findIndexBy(function(rec) {
- return rec.get(property) === value;
+ return rec.get(property) == value;
},
this, start);
},
@@ -45459,14 +45980,18 @@ Ext.define('Ext.data.Store', {
indexOfTotal: function(record) {
- return record.index || this.indexOf(record);
+ var index = record.index;
+ if (index || index === 0) {
+ return index;
+ }
+ return this.indexOf(record);
},
indexOfId: function(id) {
- return this.data.indexOfKey(id);
+ return this.indexOf(this.getById(id));
},
-
+
removeAll: function(silent) {
var me = this;
@@ -45651,6 +46176,11 @@ Ext.define('Ext.data.Store', {
return fn.apply(scope || this, [this.data.items].concat(args));
}
}
+}, function() {
+
+
+
+ Ext.regStore('ext-empty-store', {fields: [], proxy: 'proxy'});
});
@@ -45679,7 +46209,7 @@ Ext.define('Ext.chart.axis.Time', {
- extend: 'Ext.chart.axis.Category',
+ extend: 'Ext.chart.axis.Numeric',
alternateClassName: 'Ext.chart.TimeAxis',
@@ -45689,263 +46219,106 @@ Ext.define('Ext.chart.axis.Time', {
-
- calculateByLabelSize: true,
-
dateFormat: false,
-
-
- groupBy: 'year,month,day',
-
-
- aggregateOp: 'sum',
-
+
fromDate: false,
-
+
toDate: false,
-
+
step: [Ext.Date.DAY, 1],
constrain: false,
+
+ roundToDecimal: false,
- dateMethods: {
- 'year': function(date) {
- return date.getFullYear();
- },
- 'month': function(date) {
- return date.getMonth() + 1;
- },
- 'day': function(date) {
- return date.getDate();
- },
- 'hour': function(date) {
- return date.getHours();
- },
- 'minute': function(date) {
- return date.getMinutes();
- },
- 'second': function(date) {
- return date.getSeconds();
- },
- 'millisecond': function(date) {
- return date.getMilliseconds();
- }
- },
-
-
- aggregateFn: (function() {
- var etype = (function() {
- var rgxp = /^\[object\s(.*)\]$/,
- toString = Object.prototype.toString;
- return function(e) {
- return toString.call(e).match(rgxp)[1];
- };
- })();
- return {
- 'sum': function(list) {
- var i = 0, l = list.length, acum = 0;
- if (!list.length || etype(list[0]) != 'Number') {
- return list[0];
- }
- for (; i < l; i++) {
- acum += list[i];
- }
- return acum;
- },
- 'max': function(list) {
- if (!list.length || etype(list[0]) != 'Number') {
- return list[0];
- }
- return Math.max.apply(Math, list);
- },
- 'min': function(list) {
- if (!list.length || etype(list[0]) != 'Number') {
- return list[0];
- }
- return Math.min.apply(Math, list);
- },
- 'avg': function(list) {
- var i = 0, l = list.length, acum = 0;
- if (!list.length || etype(list[0]) != 'Number') {
- return list[0];
- }
- for (; i < l; i++) {
- acum += list[i];
- }
- return acum / l;
+ constructor: function (config) {
+ var me = this, label, f, df;
+ me.callParent([config]);
+ label = me.label || {};
+ df = this.dateFormat;
+ if (df) {
+ if (label.renderer) {
+ f = label.renderer;
+ label.renderer = function(v) {
+ v = f(v);
+ return Ext.Date.format(new Date(f(v)), df);
+ };
+ } else {
+ label.renderer = function(v) {
+ return Ext.Date.format(new Date(v >> 0), df);
+ };
}
- };
- })(),
-
-
- constrainDates: function() {
- var fromDate = Ext.Date.clone(this.fromDate),
- toDate = Ext.Date.clone(this.toDate),
- step = this.step,
- field = this.fields,
- store = this.chart.store,
- record, recObj, fieldNames = [],
- newStore = Ext.create('Ext.data.Store', {
- model: store.model
- });
-
- var getRecordByDate = (function() {
- var index = 0, l = store.getCount();
- return function(date) {
- var rec, recDate;
- for (; index < l; index++) {
- rec = store.getAt(index);
- recDate = rec.get(field);
- if (+recDate > +date) {
- return false;
- } else if (+recDate == +date) {
- return rec;
- }
- }
- return false;
- };
- })();
-
- if (!this.constrain) {
- this.chart.filteredStore = this.chart.store;
- return;
}
+ },
- while(+fromDate <= +toDate) {
- record = getRecordByDate(fromDate);
- recObj = {};
- if (record) {
- newStore.add(record.data);
- } else {
- newStore.model.prototype.fields.each(function(f) {
- recObj[f.name] = false;
- });
- recObj.date = fromDate;
- newStore.add(recObj);
- }
- fromDate = Ext.Date.add(fromDate, step[0], step[1]);
+ doConstrain: function () {
+ var me = this,
+ store = me.chart.store,
+ data = [],
+ series = me.chart.series.items,
+ math = Math,
+ mmax = math.max,
+ mmin = math.min,
+ fields = me.fields,
+ ln = fields.length,
+ range = me.getRange(),
+ min = range.min, max = range.max, i, l, excludes = [],
+ value, values, rec, data = [];
+ for (i = 0, l = series.length; i < l; i++) {
+ excludes[i] = series[i].__excludes;
}
-
- this.chart.filteredStore = newStore;
- },
-
-
- aggregate: function() {
- var aggStore = {},
- aggKeys = [], key, value,
- op = this.aggregateOp,
- field = this.fields, i,
- fields = this.groupBy.split(','),
- curField,
- recFields = [],
- recFieldsLen = 0,
- obj,
- dates = [],
- json = [],
- l = fields.length,
- dateMethods = this.dateMethods,
- aggregateFn = this.aggregateFn,
- store = this.chart.filteredStore || this.chart.store;
-
- store.each(function(rec) {
-
- if (!recFields.length) {
- rec.fields.each(function(f) {
- recFields.push(f.name);
- });
- recFieldsLen = recFields.length;
- }
-
- value = rec.get(field);
-
- for (i = 0; i < l; i++) {
- if (i == 0) {
- key = String(dateMethods[fields[i]](value));
- } else {
- key += '||' + dateMethods[fields[i]](value);
- }
- }
-
- if (key in aggStore) {
- obj = aggStore[key];
- } else {
- obj = aggStore[key] = {};
- aggKeys.push(key);
- dates.push(value);
- }
-
- for (i = 0; i < recFieldsLen; i++) {
- curField = recFields[i];
- if (!obj[curField]) {
- obj[curField] = [];
- }
- if (rec.get(curField) !== undefined) {
- obj[curField].push(rec.get(curField));
+ store.each(function(record) {
+ for (i = 0; i < ln; i++) {
+ if (excludes[i]) {
+ continue;
}
+ value = record.get(fields[i]);
+ if (+value < +min) return;
+ if (+value > +max) return;
}
- });
-
- for (key in aggStore) {
- obj = aggStore[key];
- for (i = 0; i < recFieldsLen; i++) {
- curField = recFields[i];
- obj[curField] = aggregateFn[op](obj[curField]);
- }
- json.push(obj);
- }
- this.chart.substore = Ext.create('Ext.data.JsonStore', {
- fields: recFields,
- data: json
- });
-
- this.dates = dates;
+ data.push(record);
+ })
+ me.chart.substore = Ext.create('Ext.data.JsonStore', { model: store.model, data: data });
},
+
-
- setLabels: function() {
- var store = this.chart.substore,
- fields = this.fields,
- format = this.dateFormat,
- labels, i, dates = this.dates,
- formatFn = Ext.Date.format;
- this.labels = labels = [];
- store.each(function(record, i) {
- if (!format) {
- labels.push(record.get(fields));
- } else {
- labels.push(formatFn(dates[i], format));
- }
- }, this);
+ processView: function () {
+ var me = this;
+ if (me.fromDate) {
+ me.minimum = +me.fromDate;
+ }
+ if (me.toDate) {
+ me.maximum = +me.toDate;
+ }
+ if (me.constrain) {
+ me.doConstrain();
+ }
},
- processView: function() {
-
- if (this.constrain) {
- this.constrainDates();
- this.aggregate();
- this.chart.substore = this.chart.filteredStore;
- } else {
- this.aggregate();
- }
- },
-
-
- applyData: function() {
- this.setLabels();
- var count = this.chart.substore.getCount();
- return {
- from: 0,
- to: count,
- steps: count - 1,
- step: 1
- };
- }
+
+ calcEnds: function() {
+ var me = this, range, step = me.step;
+ if (step) {
+ range = me.getRange();
+ range = Ext.draw.Draw.snapEndsByDateAndStep(new Date(range.min), new Date(range.max), Ext.isNumber(step) ? [Date.MILLI, step]: step);
+ if (me.minimum) {
+ range.from = me.minimum;
+ }
+ if (me.maximum) {
+ range.to = me.maximum;
+ }
+ range.step = (range.to - range.from) / range.steps;
+ return range;
+ } else {
+ return me.callParent(arguments);
+ }
+ }
});
@@ -45984,21 +46357,21 @@ Ext.define('Ext.chart.series.Series', {
shadowAttributes: null,
-
+
//@private triggerdrawlistener flag
triggerAfterDraw: false,
-
+
constructor: function(config) {
var me = this;
if (config) {
Ext.apply(me, config);
}
-
+
me.shadowGroups = [];
-
+
me.mixins.labels.constructor.call(me, config);
me.mixins.highlights.constructor.call(me, config);
me.mixins.tips.constructor.call(me, config);
@@ -46026,6 +46399,25 @@ Ext.define('Ext.chart.series.Series', {
mouseleave: me.onMouseLeave
});
},
+
+
+ eachRecord: function(fn, scope) {
+ var chart = this.chart;
+ (chart.substore || chart.store).each(fn, scope);
+ },
+
+
+ getRecordCount: function() {
+ var chart = this.chart,
+ store = chart.substore || chart.store;
+ return store ? store.getCount() : 0;
+ },
+
+
+ isExcluded: function(index) {
+ var excludes = this.__excludes;
+ return !!(excludes && excludes[index]);
+ },
setBBox: function(noGutter) {
@@ -46066,19 +46458,19 @@ Ext.define('Ext.chart.series.Series', {
'afteranimate': function() {
me.triggerAfterDraw = false;
me.fireEvent('afterrender');
- }
- }
+ }
+ }
}));
}
},
-
+
getGutters: function() {
return [0, 0];
},
- onItemMouseOver: function(item) {
+ onItemMouseOver: function(item) {
var me = this;
if (item.series === me) {
if (me.highlight) {
@@ -46129,10 +46521,10 @@ Ext.define('Ext.chart.series.Series', {
return items[i];
}
}
-
+
return null;
},
-
+
isItemInPoint: function(x, y, item, i) {
return false;
},
@@ -46141,7 +46533,7 @@ Ext.define('Ext.chart.series.Series', {
hideAll: function() {
var me = this,
items = me.items,
- item, len, i, sprite;
+ item, len, i, j, l, sprite, shadows;
me.seriesIsHidden = true;
me._prevShowMarkers = me.showMarkers;
@@ -46158,6 +46550,15 @@ Ext.define('Ext.chart.series.Series', {
hidden: true
}, true);
}
+
+ if (sprite && sprite.shadows) {
+ shadows = sprite.shadows;
+ for (j = 0, l = shadows.length; j < l; ++j) {
+ shadows[j].setAttributes({
+ hidden: true
+ }, true);
+ }
+ }
}
},
@@ -46171,7 +46572,7 @@ Ext.define('Ext.chart.series.Series', {
me.drawSeries();
me.chart.animate = prevAnimate;
},
-
+
getLegendColor: function(index) {
var me = this, fill, stroke;
@@ -46185,7 +46586,7 @@ Ext.define('Ext.chart.series.Series', {
}
return '#000';
},
-
+
visibleInLegend: function(index){
var excludes = this.__excludes;
@@ -46233,7 +46634,193 @@ Ext.define('Ext.chart.series.Cartesian', {
yField: null,
- axis: 'left'
+ axis: 'left',
+
+ getLegendLabels: function() {
+ var me = this,
+ labels = [],
+ combinations = me.combinations;
+
+ Ext.each([].concat(me.yField), function(yField, i) {
+ var title = me.title;
+
+ labels.push((Ext.isArray(title) ? title[i] : title) || yField);
+ });
+
+
+ if (combinations) {
+ Ext.each(combinations, function(combo) {
+ var label0 = labels[combo[0]],
+ label1 = labels[combo[1]];
+ labels[combo[1]] = label0 + ' & ' + label1;
+ labels.splice(combo[0], 1);
+ });
+ }
+
+ return labels;
+ },
+
+
+ eachYValue: function(record, fn, scope) {
+ Ext.each(this.getYValueAccessors(), function(accessor, i) {
+ fn.call(scope, accessor(record), i);
+ });
+ },
+
+
+ getYValueCount: function() {
+ return this.getYValueAccessors().length;
+ },
+
+ combine: function(index1, index2) {
+ var me = this,
+ accessors = me.getYValueAccessors(),
+ accessor1 = accessors[index1],
+ accessor2 = accessors[index2];
+
+
+ accessors[index2] = function(record) {
+ return accessor1(record) + accessor2(record);
+ };
+ accessors.splice(index1, 1);
+
+ me.callParent([index1, index2]);
+ },
+
+ clearCombinations: function() {
+
+ delete this.yValueAccessors;
+ this.callParent();
+ },
+
+
+ getYValueAccessors: function() {
+ var me = this,
+ accessors = me.yValueAccessors;
+ if (!accessors) {
+ accessors = me.yValueAccessors = [];
+ Ext.each([].concat(me.yField), function(yField) {
+ accessors.push(function(record) {
+ return record.get(yField);
+ });
+ });
+ }
+ return accessors;
+ },
+
+
+ getMinMaxXValues: function() {
+ var me = this,
+ min, max,
+ xField = me.xField;
+
+ if (me.getRecordCount() > 0) {
+ min = Infinity;
+ max = -min;
+ me.eachRecord(function(record) {
+ var xValue = record.get(xField);
+ if (xValue > max) {
+ max = xValue;
+ }
+ if (xValue < min) {
+ min = xValue;
+ }
+ });
+ } else {
+ min = max = 0;
+ }
+ return [min, max];
+ },
+
+
+ getMinMaxYValues: function() {
+ var me = this,
+ stacked = me.stacked,
+ min, max,
+ positiveTotal, negativeTotal;
+
+ function eachYValueStacked(yValue, i) {
+ if (!me.isExcluded(i)) {
+ if (yValue < 0) {
+ negativeTotal += yValue;
+ } else {
+ positiveTotal += yValue;
+ }
+ }
+ }
+
+ function eachYValue(yValue, i) {
+ if (!me.isExcluded(i)) {
+ if (yValue > max) {
+ max = yValue;
+ }
+ if (yValue < min) {
+ min = yValue;
+ }
+ }
+ }
+
+ if (me.getRecordCount() > 0) {
+ min = Infinity;
+ max = -min;
+ me.eachRecord(function(record) {
+ if (stacked) {
+ positiveTotal = 0;
+ negativeTotal = 0;
+ me.eachYValue(record, eachYValueStacked);
+ if (positiveTotal > max) {
+ max = positiveTotal;
+ }
+ if (negativeTotal < min) {
+ min = negativeTotal;
+ }
+ } else {
+ me.eachYValue(record, eachYValue);
+ }
+ });
+ } else {
+ min = max = 0;
+ }
+ return [min, max];
+ },
+
+ getAxesForXAndYFields: function() {
+ var me = this,
+ axes = me.chart.axes,
+ axis = [].concat(me.axis),
+ xAxis, yAxis;
+
+ if (Ext.Array.indexOf(axis, 'top') > -1) {
+ xAxis = 'top';
+ } else if (Ext.Array.indexOf(axis, 'bottom') > -1) {
+ xAxis = 'bottom';
+ } else {
+ if (axes.get('top')) {
+ xAxis = 'top';
+ } else if (axes.get('bottom')) {
+ xAxis = 'bottom';
+ }
+ }
+
+ if (Ext.Array.indexOf(axis, 'left') > -1) {
+ yAxis = 'left';
+ } else if (Ext.Array.indexOf(axis, 'right') > -1) {
+ yAxis = 'right';
+ } else {
+ if (axes.get('left')) {
+ yAxis = 'left';
+ } else if (axes.get('right')) {
+ yAxis = 'right';
+ }
+ }
+
+ return {
+ xAxis: xAxis,
+ yAxis: yAxis
+ };
+ }
+
+
});
@@ -46242,7 +46829,7 @@ Ext.define('Ext.chart.series.Area', {
extend: 'Ext.chart.series.Cartesian',
-
+
alias: 'series.area',
requires: ['Ext.chart.axis.Axis', 'Ext.draw.Color', 'Ext.fx.Anim'],
@@ -46328,7 +46915,7 @@ Ext.define('Ext.chart.series.Area', {
getBounds: function() {
var me = this,
chart = me.chart,
- store = chart.substore || chart.store,
+ store = chart.getChartStore(),
areas = [].concat(me.yField),
areasLen = areas.length,
xValues = [],
@@ -46395,8 +46982,8 @@ Ext.define('Ext.chart.series.Area', {
yValues.push(yValue);
}, me);
- xScale = bbox.width / (maxX - minX);
- yScale = bbox.height / (maxY - minY);
+ xScale = bbox.width / ((maxX - minX) || 1);
+ yScale = bbox.height / ((maxY - minY) || 1);
ln = xValues.length;
if ((ln > bbox.width) && me.areas) {
@@ -46421,7 +47008,7 @@ Ext.define('Ext.chart.series.Area', {
getPaths: function() {
var me = this,
chart = me.chart,
- store = chart.substore || chart.store,
+ store = chart.getChartStore(),
first = true,
bounds = me.getBounds(),
bbox = bounds.bbox,
@@ -46466,7 +47053,7 @@ Ext.define('Ext.chart.series.Area', {
items[areaIndex].pointsUp.push([x, y]);
}
}
-
+
for (areaIndex = 0; areaIndex < bounds.areasLen; areaIndex++) {
@@ -46506,7 +47093,7 @@ Ext.define('Ext.chart.series.Area', {
drawSeries: function() {
var me = this,
chart = me.chart,
- store = chart.substore || chart.store,
+ store = chart.getChartStore(),
surface = chart.surface,
animate = chart.animate,
group = me.group,
@@ -46521,7 +47108,7 @@ Ext.define('Ext.chart.series.Area', {
if (!store || !store.getCount()) {
return;
}
-
+
paths = me.getPaths();
if (!me.areas) {
@@ -46547,7 +47134,7 @@ Ext.define('Ext.chart.series.Area', {
path = paths.paths[areaIndex];
if (animate) {
- rendererAttributes = me.renderer(areaElem, false, {
+ rendererAttributes = me.renderer(areaElem, false, {
path: path,
fill: colorArrayStyle[areaIndex % colorArrayLength],
@@ -46558,7 +47145,7 @@ Ext.define('Ext.chart.series.Area', {
to: rendererAttributes
});
} else {
- rendererAttributes = me.renderer(areaElem, false, {
+ rendererAttributes = me.renderer(areaElem, false, {
path: path,
hidden: false,
@@ -46607,16 +47194,16 @@ Ext.define('Ext.chart.series.Area', {
x = item.point[0],
y = item.point[1],
bb, width, height;
-
+
label.setAttributes({
text: format(storeItem.get(field[index])),
hidden: true
}, true);
-
+
bb = label.getBBox();
width = bb.width / 2;
height = bb.height / 2;
-
+
x = x - width < bbox.x? bbox.x + width : x;
x = (x + width > bbox.x + bbox.width) ? (x - (x + width - bbox.x - bbox.width)) : x;
y = y - height < bbox.y? bbox.y + height : y;
@@ -46675,11 +47262,11 @@ Ext.define('Ext.chart.series.Area', {
a = (next[1] - prev[1]) / (next[0] - prev[0]);
aprev = (cur[1] - prev[1]) / (cur[0] - prev[0]);
anext = (next[1] - cur[1]) / (next[0] - cur[0]);
-
+
norm = Math.sqrt(1 + a * a);
dir = [1 / norm, a / norm];
normal = [-dir[1], dir[0]];
-
+
if (aprev > 0 && anext < 0 && normal[1] < 0 || aprev < 0 && anext > 0 && normal[1] > 0) {
normal[0] *= -1;
@@ -46692,13 +47279,13 @@ Ext.define('Ext.chart.series.Area', {
x = cur[0] + normal[0] * offsetFromViz;
y = cur[1] + normal[1] * offsetFromViz;
-
+
boxx = x + (normal[0] > 0? 0 : -(bbox.width + 2 * offsetBox));
boxy = y - bbox.height /2 - offsetBox;
boxw = bbox.width + 2 * offsetBox;
boxh = bbox.height + 2 * offsetBox;
-
+
if (boxx < clipRect[0] || (boxx + boxw) > (clipRect[0] + clipRect[2])) {
@@ -46711,13 +47298,651 @@ Ext.define('Ext.chart.series.Area', {
x = cur[0] + normal[0] * offsetFromViz;
y = cur[1] + normal[1] * offsetFromViz;
+
+
+ boxx = x + (normal[0] > 0? 0 : -(bbox.width + 2 * offsetBox));
+ boxy = y - bbox.height /2 - offsetBox;
+ boxw = bbox.width + 2 * offsetBox;
+ boxh = bbox.height + 2 * offsetBox;
+
+
+ callout.lines.setAttributes({
+ path: ["M", cur[0], cur[1], "L", x, y, "Z"]
+ }, true);
+
+ callout.box.setAttributes({
+ x: boxx,
+ y: boxy,
+ width: boxw,
+ height: boxh
+ }, true);
+
+ callout.label.setAttributes({
+ x: x + (normal[0] > 0? offsetBox : -(bbox.width + offsetBox)),
+ y: y
+ }, true);
+ for (p in callout) {
+ callout[p].show(true);
+ }
+ },
+
+ isItemInPoint: function(x, y, item, i) {
+ var me = this,
+ pointsUp = item.pointsUp,
+ pointsDown = item.pointsDown,
+ abs = Math.abs,
+ dist = Infinity, p, pln, point;
+
+ for (p = 0, pln = pointsUp.length; p < pln; p++) {
+ point = [pointsUp[p][0], pointsUp[p][1]];
+ if (dist > abs(x - point[0])) {
+ dist = abs(x - point[0]);
+ } else {
+ point = pointsUp[p -1];
+ if (y >= point[1] && (!pointsDown.length || y <= (pointsDown[p -1][1]))) {
+ item.storeIndex = p -1;
+ item.storeField = me.yField[i];
+ item.storeItem = me.chart.store.getAt(p -1);
+ item._points = pointsDown.length? [point, pointsDown[p -1]] : [point];
+ return true;
+ } else {
+ break;
+ }
+ }
+ }
+ return false;
+ },
+
+
+ highlightSeries: function() {
+ var area, to, fillColor;
+ if (this._index !== undefined) {
+ area = this.areas[this._index];
+ if (area.__highlightAnim) {
+ area.__highlightAnim.paused = true;
+ }
+ area.__highlighted = true;
+ area.__prevOpacity = area.__prevOpacity || area.attr.opacity || 1;
+ area.__prevFill = area.__prevFill || area.attr.fill;
+ area.__prevLineWidth = area.__prevLineWidth || area.attr.lineWidth;
+ fillColor = Ext.draw.Color.fromString(area.__prevFill);
+ to = {
+ lineWidth: (area.__prevLineWidth || 0) + 2
+ };
+ if (fillColor) {
+ to.fill = fillColor.getLighter(0.2).toString();
+ }
+ else {
+ to.opacity = Math.max(area.__prevOpacity - 0.3, 0);
+ }
+ if (this.chart.animate) {
+ area.__highlightAnim = Ext.create('Ext.fx.Anim', Ext.apply({
+ target: area,
+ to: to
+ }, this.chart.animate));
+ }
+ else {
+ area.setAttributes(to, true);
+ }
+ }
+ },
+
+
+ unHighlightSeries: function() {
+ var area;
+ if (this._index !== undefined) {
+ area = this.areas[this._index];
+ if (area.__highlightAnim) {
+ area.__highlightAnim.paused = true;
+ }
+ if (area.__highlighted) {
+ area.__highlighted = false;
+ area.__highlightAnim = Ext.create('Ext.fx.Anim', {
+ target: area,
+ to: {
+ fill: area.__prevFill,
+ opacity: area.__prevOpacity,
+ lineWidth: area.__prevLineWidth
+ }
+ });
+ }
+ }
+ },
+
+
+ highlightItem: function(item) {
+ var me = this,
+ points, path;
+ if (!item) {
+ this.highlightSeries();
+ return;
+ }
+ points = item._points;
+ path = points.length == 2? ['M', points[0][0], points[0][1], 'L', points[1][0], points[1][1]]
+ : ['M', points[0][0], points[0][1], 'L', points[0][0], me.bbox.y + me.bbox.height];
+ me.highlightSprite.setAttributes({
+ path: path,
+ hidden: false
+ }, true);
+ },
+
+
+ unHighlightItem: function(item) {
+ if (!item) {
+ this.unHighlightSeries();
+ }
+
+ if (this.highlightSprite) {
+ this.highlightSprite.hide(true);
+ }
+ },
+
+
+ hideAll: function() {
+ if (!isNaN(this._index)) {
+ this.__excludes[this._index] = true;
+ this.areas[this._index].hide(true);
+ this.drawSeries();
+ }
+ },
+
+
+ showAll: function() {
+ if (!isNaN(this._index)) {
+ this.__excludes[this._index] = false;
+ this.areas[this._index].show(true);
+ this.drawSeries();
+ }
+ },
+
+
+ getLegendColor: function(index) {
+ var me = this;
+ return me.colorArrayStyle[index % me.colorArrayStyle.length];
+ }
+});
+
+Ext.define('Ext.chart.series.Area', {
+
+
+
+ extend: 'Ext.chart.series.Cartesian',
+
+ alias: 'series.area',
+
+ requires: ['Ext.chart.axis.Axis', 'Ext.draw.Color', 'Ext.fx.Anim'],
+
+
+
+ type: 'area',
+
+
+ stacked: true,
+
+
+ style: {},
+
+ constructor: function(config) {
+ this.callParent(arguments);
+ var me = this,
+ surface = me.chart.surface,
+ i, l;
+ Ext.apply(me, config, {
+ __excludes: [],
+ highlightCfg: {
+ lineWidth: 3,
+ stroke: '#55c',
+ opacity: 0.8,
+ color: '#f00'
+ }
+ });
+ if (me.highlight) {
+ me.highlightSprite = surface.add({
+ type: 'path',
+ path: ['M', 0, 0],
+ zIndex: 1000,
+ opacity: 0.3,