Permalink
Browse files

Upgrade from Sencha Touch 1.0.1a to 1.1.0.

  • Loading branch information...
1 parent 46f3955 commit fa39b8088173e65bd6c6230f97ee147d606656a5 @nelstrom committed Mar 25, 2011
Showing with 807 additions and 420 deletions.
  1. +805 −418 public/lib/sencha-touch-debug.js
  2. +1 −1 public/lib/sencha-touch.css
  3. +1 −1 public/lib/sencha-touch.js
View
1,223 public/lib/sencha-touch-debug.js
@@ -50,7 +50,7 @@ Ext.apply(Ext, {
platformVersionDetail: {
major: 1,
minor: 0,
- patch: 2
+ patch: 3
},
userAgent: navigator.userAgent.toLowerCase(),
cache: {},
@@ -2199,117 +2199,6 @@ Ext.util.GeoLocation = Ext.extend(Ext.util.Observable, {
}
});
-
-Ext.util.Point = Ext.extend(Object, {
- constructor: function(x, y) {
- this.x = (x != null && !isNaN(x)) ? x : 0;
- this.y = (y != null && !isNaN(y)) ? y : 0;
-
- return this;
- },
-
-
- copy: function() {
- return new Ext.util.Point(this.x, this.y);
- },
-
-
- copyFrom: function(p) {
- this.x = p.x;
- this.y = p.y;
-
- return this;
- },
-
-
- toString: function() {
- return "Point[" + this.x + "," + this.y + "]";
- },
-
-
- equals: function(p) {
- return (this.x == p.x && this.y == p.y);
- },
-
-
- isWithin: function(p, threshold) {
- if (!Ext.isObject(threshold)) {
- threshold = {x: threshold};
- threshold.y = threshold.x;
- }
-
- return (this.x <= p.x + threshold.x && this.x >= p.x - threshold.x &&
- this.y <= p.y + threshold.y && this.y >= p.y - threshold.y);
- },
-
-
- translate: function(x, y) {
- if (x != null && !isNaN(x))
- this.x += x;
-
- if (y != null && !isNaN(y))
- this.y += y;
- },
-
-
- roundedEquals: function(p) {
- return (Math.round(this.x) == Math.round(p.x) && Math.round(this.y) == Math.round(p.y));
- }
-});
-
-
-Ext.util.Point.fromEvent = function(e) {
- var a = (e.changedTouches && e.changedTouches.length > 0) ? e.changedTouches[0] : e;
- return new Ext.util.Point(a.pageX, a.pageY);
-};
-Ext.util.Offset = Ext.extend(Object, {
- constructor: function(x, y) {
- this.x = (x != null && !isNaN(x)) ? x : 0;
- this.y = (y != null && !isNaN(y)) ? y : 0;
-
- return this;
- },
-
- copy: function() {
- return new Ext.util.Offset(this.x, this.y);
- },
-
- copyFrom: function(p) {
- this.x = p.x;
- this.y = p.y;
- },
-
- toString: function() {
- return "Offset[" + this.x + "," + this.y + "]";
- },
-
- equals: function(offset) {
- if(!(offset instanceof Ext.util.Offset))
- throw new Error('offset must be an instance of Ext.util.Offset');
-
- return (this.x == offset.x && this.y == offset.y);
- },
-
- round: function(to) {
- if (!isNaN(to)) {
- var factor = Math.pow(10, to);
- this.x = Math.round(this.x * factor) / factor;
- this.y = Math.round(this.y * factor) / factor;
- } else {
- this.x = Math.round(this.x);
- this.y = Math.round(this.y);
- }
- },
-
- isZero: function() {
- return this.x == 0 && this.y == 0;
- }
-});
-
-Ext.util.Offset.fromObject = function(obj) {
- return new Ext.util.Offset(obj.x, obj.y);
-};
-
Ext.util.Region = Ext.extend(Object, {
constructor : function(t, r, b, l) {
@@ -2559,6 +2448,117 @@ Ext.util.Region.from = function(o) {
return new Ext.util.Region(o.top, o.right, o.bottom, o.left);
};
+
+Ext.util.Point = Ext.extend(Object, {
+ constructor: function(x, y) {
+ this.x = (x != null && !isNaN(x)) ? x : 0;
+ this.y = (y != null && !isNaN(y)) ? y : 0;
+
+ return this;
+ },
+
+
+ copy: function() {
+ return new Ext.util.Point(this.x, this.y);
+ },
+
+
+ copyFrom: function(p) {
+ this.x = p.x;
+ this.y = p.y;
+
+ return this;
+ },
+
+
+ toString: function() {
+ return "Point[" + this.x + "," + this.y + "]";
+ },
+
+
+ equals: function(p) {
+ return (this.x == p.x && this.y == p.y);
+ },
+
+
+ isWithin: function(p, threshold) {
+ if (!Ext.isObject(threshold)) {
+ threshold = {x: threshold};
+ threshold.y = threshold.x;
+ }
+
+ return (this.x <= p.x + threshold.x && this.x >= p.x - threshold.x &&
+ this.y <= p.y + threshold.y && this.y >= p.y - threshold.y);
+ },
+
+
+ translate: function(x, y) {
+ if (x != null && !isNaN(x))
+ this.x += x;
+
+ if (y != null && !isNaN(y))
+ this.y += y;
+ },
+
+
+ roundedEquals: function(p) {
+ return (Math.round(this.x) == Math.round(p.x) && Math.round(this.y) == Math.round(p.y));
+ }
+});
+
+
+Ext.util.Point.fromEvent = function(e) {
+ var a = (e.changedTouches && e.changedTouches.length > 0) ? e.changedTouches[0] : e;
+ return new Ext.util.Point(a.pageX, a.pageY);
+};
+Ext.util.Offset = Ext.extend(Object, {
+ constructor: function(x, y) {
+ this.x = (x != null && !isNaN(x)) ? x : 0;
+ this.y = (y != null && !isNaN(y)) ? y : 0;
+
+ return this;
+ },
+
+ copy: function() {
+ return new Ext.util.Offset(this.x, this.y);
+ },
+
+ copyFrom: function(p) {
+ this.x = p.x;
+ this.y = p.y;
+ },
+
+ toString: function() {
+ return "Offset[" + this.x + "," + this.y + "]";
+ },
+
+ equals: function(offset) {
+ if(!(offset instanceof Ext.util.Offset))
+ throw new Error('offset must be an instance of Ext.util.Offset');
+
+ return (this.x == offset.x && this.y == offset.y);
+ },
+
+ round: function(to) {
+ if (!isNaN(to)) {
+ var factor = Math.pow(10, to);
+ this.x = Math.round(this.x * factor) / factor;
+ this.y = Math.round(this.y * factor) / factor;
+ } else {
+ this.x = Math.round(this.x);
+ this.y = Math.round(this.y);
+ }
+ },
+
+ isZero: function() {
+ return this.x == 0 && this.y == 0;
+ }
+});
+
+Ext.util.Offset.fromObject = function(obj) {
+ return new Ext.util.Offset(obj.x, obj.y);
+};
+
Ext.Template = Ext.extend(Object, {
constructor: function(html) {
var me = this,
@@ -3602,24 +3602,24 @@ Ext.util.Format = {
Ext.LoadMask = Ext.extend(Ext.util.Observable, {
-
+
msg : 'Loading...',
msgCls : 'x-mask-loading',
disabled: false,
-
+
constructor : function(el, config) {
this.el = Ext.get(el);
Ext.apply(this, config);
-
+
this.addEvents('show', 'hide');
if (this.store) {
this.bindStore(this.store, true);
}
- Ext.LoadMask.superclass.constructor.call(this);
+ Ext.LoadMask.superclass.constructor.call(this);
},
@@ -3643,7 +3643,7 @@ Ext.LoadMask = Ext.extend(Ext.util.Observable, {
load: this.onLoad,
exception: this.onLoad
});
-
+
}
this.store = store;
if (store && store.isLoading()) {
@@ -3665,7 +3665,7 @@ Ext.LoadMask = Ext.extend(Ext.util.Observable, {
isDisabled : function() {
return this.disabled;
},
-
+
onLoad : function() {
this.el.unmask();
@@ -3675,7 +3675,7 @@ Ext.LoadMask = Ext.extend(Ext.util.Observable, {
onBeforeLoad : function() {
if (!this.disabled) {
- this.el.mask('<div class="x-loading-spinner"><span class="x-loading-top"></span><span class="x-loading-right"></span><span class="x-loading-bottom"></span><span class="x-loading-left"></span></div><div class="x-loading-msg">' + this.msg + '</div>', this.msgCls, false);
+ this.el.mask(Ext.LoadingSpinner + '<div class="x-loading-msg">' + this.msg + '</div>', this.msgCls, false);
this.fireEvent('show', this, this.el, this.store);
}
},
@@ -3697,6 +3697,9 @@ Ext.LoadMask = Ext.extend(Ext.util.Observable, {
}
});
+Ext.LoadingSpinner = '<div class="x-loading-spinner"><span class="x-loading-top"></span><span class="x-loading-right"></span><span class="x-loading-bottom"></span><span class="x-loading-left"></span></div>';
+
+
Ext.applyIf(Array.prototype, {
@@ -8703,15 +8706,28 @@ Ext.data.AjaxProxy = Ext.extend(Ext.data.ServerProxy, {
return function(options, success, response) {
if (success === true) {
- var reader = me.getReader(),
- result = reader.read(response);
+ var reader = me.getReader(),
+ result = reader.read(response),
+ records = result.records,
+ length = records.length,
+ mc = new Ext.util.MixedCollection(true, function(r) {return r.getId();}),
+ record, i;
+
+ mc.addAll(operation.records);
+ for (i = 0; i < length; i++) {
+ record = mc.get(records[i].getId());
+
+ if (record) {
+ record.set(record.data);
+ }
+ }
Ext.apply(operation, {
response : response,
resultSet: result
});
-
+
operation.setCompleted();
operation.setSuccessful();
} else {
@@ -9220,7 +9236,7 @@ Ext.data.WebStorageProxy = Ext.extend(Ext.data.ClientProxy, {
}
}
- record = new Model(data);
+ record = new Model(data, id);
record.phantom = false;
this.cache[id] = record;
@@ -9436,11 +9452,11 @@ Ext.data.Reader = Ext.extend(Object, {
read: function(response) {
var data = response;
- if (response) {
- if (response.responseText) {
- data = this.getResponseData(response);
- }
-
+ if (response && response.responseText) {
+ data = this.getResponseData(response);
+ }
+
+ if (data) {
return this.readRecords(data);
} else {
return this.nullResultSet;
@@ -9795,7 +9811,7 @@ Ext.data.JsonReader = Ext.extend(Ext.data.Reader, {
data = root;
}
- return Ext.data.XmlReader.superclass.extractData.call(this, data, returnRecords);
+ return Ext.data.JsonReader.superclass.extractData.call(this, data, returnRecords);
},
@@ -10687,6 +10703,7 @@ Ext.util.Router = Ext.extend(Ext.util.Observable, {
}
});
+
Ext.Router = new Ext.util.Router();
Ext.util.Route = Ext.extend(Object, {
@@ -11228,7 +11245,7 @@ var El = Ext.Element = Ext.extend(Object, {
return mode;
},
- setDisplayMode : function(mode) {
+ setVisibilityMode : function(mode) {
El.data(this.dom, 'visibilityMode', mode);
return this;
}
@@ -13292,11 +13309,19 @@ Ext.Anim = Ext.extend(Object, {
el = Ext.get(el);
config = config || {};
+
var me = this,
style = el.dom.style,
property,
after = config.after;
+ if (me.running[el.id]) {
+ me.onTransitionEnd(null, el, {
+ config: config,
+ after: after
+ });
+ }
+
config = this.initConfig(el, config);
if (this.disableAnimations) {
@@ -13363,9 +13388,14 @@ Ext.Anim = Ext.extend(Object, {
onTransitionEnd: function(ev, el, o) {
el = Ext.get(el);
- var style = el.dom.style,
- config = o.config,
- property,
+
+ if (this.running[el.id] === undefined) {
+ return;
+ }
+
+ var style = el.dom.style,
+ config = o.config,
+ property,
me = this;
if (config.autoClear) {
@@ -13730,11 +13760,11 @@ Ext.apply(Ext.anims, {
Ext.apply(Ext, {
- version : '1.0.1',
+ version : '1.1.0',
versionDetail : {
major : 1,
- minor : 0,
- patch : 1
+ minor : 1,
+ patch : 0
},
@@ -13867,7 +13897,6 @@ Ext.apply(Ext, {
});
-
(function() {
var initExt = function() {
@@ -13975,7 +14004,12 @@ Ext.Viewport = new (Ext.extend(Ext.util.Observable, {
scrollToTop: function() {
if (Ext.is.iOS) {
- document.body.scrollTop = document.body.scrollHeight;
+ if (Ext.is.Phone) {
+ document.body.scrollTop = document.body.scrollHeight;
+ }
+ }
+ else if (Ext.is.Blackberry) {
+ window.scrollTo(0, 1000);
}
else {
window.scrollTo(0, 1);
@@ -14001,6 +14035,20 @@ Ext.Viewport = new (Ext.extend(Ext.util.Observable, {
var me = this,
body = Ext.getBody();
+ if (!Ext.is.Phone) {
+ body.setHeight(body.getWidth());
+
+ this.updateOrientation();
+
+ this.fireEvent('orientationchange', this, this.orientation);
+ me.scrollToTop();
+ me.updateBodySize();
+ me.fireResizeEvent();
+ Ext.repaint();
+
+ return;
+ }
+
Ext.gesture.Manager.freeze();
body.setHeight(body.getWidth());
@@ -14011,11 +14059,14 @@ Ext.Viewport = new (Ext.extend(Ext.util.Observable, {
setTimeout(function() {
me.scrollToTop();
+
setTimeout(function() {
me.updateBodySize();
me.fireResizeEvent();
Ext.gesture.Manager.thaw();
+
+ Ext.repaint();
}, 200);
}, 200);
},
@@ -14096,6 +14147,7 @@ Ext.Viewport = new (Ext.extend(Ext.util.Observable, {
}));
+
Ext.util.TapRepeater = Ext.extend(Ext.util.Observable, {
constructor: function(el, config) {
@@ -14607,6 +14659,8 @@ Ext.util.Draggable = Ext.extend(Ext.util.Observable, {
direction: 'both',
+ fps: Ext.is.Blackberry ? 25 : ((Ext.is.iOS || Ext.is.Desktop) ? 80 : 50),
+
constrain: window,
@@ -14671,7 +14725,9 @@ Ext.util.Draggable = Ext.extend(Ext.util.Observable, {
this.addEvents(
- 'offsetchange'
+ 'offsetchange',
+
+ 'offsetboundaryupdate'
);
Ext.util.Draggable.superclass.constructor.call(this, config);
@@ -14797,7 +14853,7 @@ Ext.util.Draggable = Ext.extend(Ext.util.Observable, {
if (!(offset instanceof Ext.util.Offset)) {
offset = Ext.util.Offset.fromObject(offset);
}
-
+
offset.round();
if (!this.offset.equals(offset)) {
@@ -14843,13 +14899,18 @@ Ext.util.Draggable = Ext.extend(Ext.util.Observable, {
setStyleOffset: function(offset) {
- this.getProxyEl().setLeft(offset.x);
- this.getProxyEl().setTop(offset.y);
+ var el = this.getProxyEl();
+
+ el.dom.style.left = offset.x + 'px';
+ el.dom.style.top = offset.y + 'px';
+
return this;
},
startAnimation: function(offset, animate) {
+ var me = this;
+
this.stopAnimation();
var currentTime = Date.now();
@@ -14870,14 +14931,22 @@ Ext.util.Draggable = Ext.extend(Ext.util.Observable, {
});
this.isAnimating = true;
- this.animationTimer = Ext.defer(this.handleAnimationFrame, 0, this);
+
+ this.animationTimer = setInterval(function(){
+ me.handleAnimationFrame();
+ }, this.getFrameDuration());
return this;
},
+ getFrameDuration: function() {
+ return 1000 / this.fps;
+ },
+
+
stopAnimation: function() {
if (this.isAnimating) {
- clearTimeout(this.animationTimer);
+ clearInterval(this.animationTimer);
this.isAnimating = false;
this.setDragging(false);
}
@@ -14897,8 +14966,6 @@ Ext.util.Draggable = Ext.extend(Ext.util.Observable, {
this.setOffset(newOffset);
- this.animationTimer = Ext.defer(this.handleAnimationFrame, 10, this);
-
if ((newOffset.x === this.linearAnimation.x.endOffset) && (newOffset.y === this.linearAnimation.y.endOffset)) {
this.stopAnimation();
}
@@ -14995,16 +15062,18 @@ Ext.util.Draggable = Ext.extend(Ext.util.Observable, {
this.offsetBoundary = offsetBoundary;
+ this.fireEvent('offsetboundaryupdate', this, this.offsetBoundary);
+
var currentComputedOffset;
if (this.useCssTransform) {
currentComputedOffset = Ext.Element.getComputedTransformOffset(this.getProxyEl());
- } else {
- currentComputedOffset = new Ext.util.Offset(this.getProxyEl().getLeft(), this.getProxyEl().getTop());
- }
- if(!this.offset.equals(currentComputedOffset) || init) {
- this.setOffset(currentComputedOffset);
+
+
+ if (!this.offset.equals(currentComputedOffset) || init) {
+ this.setOffset(currentComputedOffset);
+ }
}
return this;
@@ -15023,10 +15092,6 @@ Ext.util.Draggable = Ext.extend(Ext.util.Observable, {
this.stopAnimation();
- if (this.dragging) {
- this.onDragEnd(e);
- }
-
this.setDragging(true);
this.startTouchPoint = new Ext.util.Point(e.startX, e.startY);
@@ -15220,6 +15285,7 @@ Ext.util.Draggable.Animation.Linear = Ext.extend(Ext.util.Draggable.Animation.Ab
}
});
+
Ext.util.Droppable = Ext.extend(Ext.util.Observable, {
baseCls: 'x-droppable',
@@ -15435,6 +15501,7 @@ Ext.util.ScrollView = Ext.extend(Ext.util.Observable, {
}
this.indicators = {};
+ this.indicatorOffsetExtras = {};
indicators.forEach(function(i) {
this.indicators[i] = new Ext.util.Scroller.Indicator(this.scroller.container, Ext.apply({}, this.indicatorConfig, {type: i}));
@@ -15505,8 +15572,8 @@ Ext.util.ScrollView = Ext.extend(Ext.util.Observable, {
} else {
this.indicatorOffsets[axis] = 0;
}
-
- indicator.setOffset(this.indicatorOffsets[axis] + this.indicatorMargin);
+
+ indicator.setOffset(this.indicatorOffsetExtras[axis] + this.indicatorOffsets[axis] + this.indicatorMargin);
indicator.setSize(this.indicatorSizes[axis] - (this.indicatorMargin * 2));
}, this);
},
@@ -15515,6 +15582,7 @@ Ext.util.ScrollView = Ext.extend(Ext.util.Observable, {
showIndicators : function() {
Ext.iterate(this.indicators, function(axis, indicator) {
indicator.show();
+ this.indicatorOffsetExtras[axis] = indicator.el.dom.parentNode[axis === 'vertical' ? 'scrollTop' : 'scrollLeft'];
}, this);
return this;
@@ -15559,12 +15627,12 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
outOfBoundRestrictFactor: 0.5,
- acceleration: 30,
+ acceleration: 20,
+
- fps: Ext.is.Blackberry ? 22 : 80,
- autoAdjustFps: !Ext.is.Blackberry,
+ autoAdjustFps: false,
friction: 0.5,
@@ -15585,7 +15653,7 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
momentum: true,
cancelRevert: true,
-
+
threshold: 5,
constructor: function(el, config) {
@@ -15608,7 +15676,7 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
'bouncestart',
- 'bounceend'
+ 'bounceend'
);
this.on({
@@ -15634,6 +15702,8 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
}
this.theta = Math.log(1 - (this.friction / 10));
+ this.bouncingVelocityFactor = this.springTension * Math.E;
+ this.bouncingTimeFactor = ((1 / this.springTension) * this.acceleration);
if (!this.decelerationAnimation) {
this.decelerationAnimation = {};
@@ -15662,15 +15732,11 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
return this;
},
- getFrameDuration: function() {
- return 1000 / this.fps;
- },
-
- updateBoundary: function() {
+ updateBoundary: function(animate) {
Ext.util.Scroller.superclass.updateBoundary.apply(this, arguments);
-
- this.snapToBoundary();
+
+ this.snapToBoundary(animate);
return this;
},
@@ -15740,7 +15806,7 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
onOrientationChange: function() {
Ext.util.Scroller.superclass.onOrientationChange.apply(this, arguments);
-
+
this.snapToBoundary();
},
@@ -15750,7 +15816,7 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
this.isMomentumAnimating = false;
this.snapToBoundary();
this.fireEvent('scrollend', this, this.getOffset());
-
+
this.snapToSlot();
},
@@ -15791,17 +15857,17 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
},
- snapToBoundary: function() {
+ snapToBoundary: function(animate) {
var offset = this.offsetBoundary.restrict(this.offset);
- this.setOffset(offset);
+ this.setOffset(offset, animate);
return this;
},
snapToSlot: function() {
var offset = this.offsetBoundary.restrict(this.offset);
offset.round();
-
+
if (this.snap) {
if (this.snap === true) {
this.snap = {
@@ -15830,8 +15896,11 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
startMomentumAnimation: function(e) {
- var originalTime = (e.event.originalTimeStamp) ? e.event.originalTimeStamp : e.time,
- duration = originalTime - this.originalStartTime;
+ var me = this,
+ originalTime = (e.event.originalTimeStamp) ? e.event.originalTimeStamp : e.time,
+ duration = Math.max(40, originalTime - this.originalStartTime);
+
+ this.fireEvent('beforemomentumanimationstart');
if (
(!this.momentum || !(duration <= this.startMomentumResetTime)) &&
@@ -15844,19 +15913,21 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
var minVelocity = this.minVelocityForAnimation,
currentVelocity,
currentOffset = this.offset.copy(),
- restrictedOffset;
+ restrictedOffset,
+ acceleration = (duration / this.acceleration);
this.isBouncing = {x: false, y: false};
this.isDecelerating = {x: false, y: false};
this.momentumAnimationStartTime = e.time;
this.momentumAnimationProcessingTime = 0;
-
+ this.bouncingData = {x: null, y: null};
+
this.momentumAnimationStartVelocity = {
- x: (this.offset.x - this.startTimeOffset.x) / (duration / this.acceleration),
- y: (this.offset.y - this.startTimeOffset.y) / (duration / this.acceleration)
+ x: (this.offset.x - this.startTimeOffset.x) / acceleration,
+ y: (this.offset.y - this.startTimeOffset.y) / acceleration
};
-
+
this.momentumAnimationStartOffset = currentOffset;
['x', 'y'].forEach(function(axis) {
@@ -15865,25 +15936,30 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
if (this.bounces && this.bounces[axis]) {
restrictedOffset = this.offsetBoundary.restrict(axis, currentOffset[axis]);
-
- if (restrictedOffset != currentOffset[axis]) {
- currentVelocity = (currentOffset[axis] - restrictedOffset) * this.springTension * Math.E;
- this.bouncingAnimation[axis].set({
- startTime: this.momentumAnimationStartTime - ((1 / this.springTension) * this.acceleration),
- startOffset: restrictedOffset,
- startVelocity: currentVelocity
- });
- this.isBouncing[axis] = true;
- this.fireEvent('bouncestart', this, {
+
+ if (restrictedOffset !== currentOffset[axis]) {
+ currentVelocity = (currentOffset[axis] - restrictedOffset) * this.bouncingVelocityFactor;
+
+ this.bouncingData[axis] = {
axis: axis,
offset: restrictedOffset,
time: this.momentumAnimationStartTime,
velocity: currentVelocity
- });
+ };
+
+ this.isBouncing[axis] = true;
this.isDecelerating[axis] = false;
+
+ this.fireEvent('bouncestart', this, this.bouncingData[axis]);
+
+ this.bouncingAnimation[axis].set({
+ startTime: this.bouncingData[axis].time - this.bouncingTimeFactor,
+ startOffset: this.bouncingData[axis].offset,
+ startVelocity: this.bouncingData[axis].velocity
+ });
}
}
-
+
if (this.isDecelerating[axis]) {
this.decelerationAnimation[axis].set({
startVelocity: this.momentumAnimationStartVelocity[axis],
@@ -15892,12 +15968,16 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
});
}
}, this);
-
+
if (this.isDecelerating.x || this.isDecelerating.y || this.isBouncing.x || this.isBouncing.y) {
this.isMomentumAnimating = true;
this.momentumAnimationFramesHandled = 0;
this.fireEvent('momentumanimationstart');
- this.momentumAnimationTimer = Ext.defer(this.handleMomentumAnimationFrame, this.getFrameDuration(), this);
+
+ me.handleMomentumAnimationFrame();
+ this.momentumAnimationTimer = setInterval(function() {
+ me.handleMomentumAnimationFrame();
+ }, this.getFrameDuration());
return true;
}
@@ -15908,7 +15988,7 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
stopMomentumAnimation: function() {
if (this.isMomentumAnimating) {
if (this.momentumAnimationTimer) {
- clearTimeout(this.momentumAnimationTimer);
+ clearInterval(this.momentumAnimationTimer);
}
this.momentumAnimationEndTime = Date.now();
@@ -15921,7 +16001,7 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
if (this.autoAdjustFps) {
this.fps = this.maxFps;
}
-
+
this.isDecelerating = {};
this.isBouncing = {};
@@ -15933,50 +16013,47 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
return this;
},
-
-
-
-
-
-
-
handleMomentumAnimationFrame : function() {
if (!this.isMomentumAnimating) {
return;
}
- this.momentumAnimationTimer = Ext.defer(this.handleMomentumAnimationFrame, this.getFrameDuration(), this);
-
var currentTime = Date.now(),
newOffset = this.offset.copy(),
+ offsetBoundary = this.offsetBoundary,
currentVelocity,
restrictedOffset,
outOfBoundDistance;
-
+
['x', 'y'].forEach(function(axis) {
if (this.isDecelerating[axis]) {
newOffset[axis] = this.decelerationAnimation[axis].getOffset();
currentVelocity = this.momentumAnimationStartVelocity[axis] * this.decelerationAnimation[axis].getFrictionFactor();
- outOfBoundDistance = this.offsetBoundary.getOutOfBoundOffset(axis, newOffset[axis]);
+ outOfBoundDistance = offsetBoundary.getOutOfBoundOffset(axis, newOffset[axis]);
- if (outOfBoundDistance != 0) {
- restrictedOffset = this.offsetBoundary.restrict(axis, newOffset[axis]);
+ if (outOfBoundDistance !== 0) {
+ restrictedOffset = offsetBoundary.restrict(axis, newOffset[axis]);
+
if (this.bounces && this.bounces[axis]) {
- this.bouncingAnimation[axis].set({
- startTime: currentTime,
- startOffset: restrictedOffset,
- startVelocity: currentVelocity
- });
- this.isBouncing[axis] = true;
- this.fireEvent('bouncestart', this, {
+ this.bouncingData[axis] = {
axis: axis,
offset: restrictedOffset,
time: currentTime,
velocity: currentVelocity
+ };
+
+ this.fireEvent('bouncestart', this, this.bouncingData[axis]);
+
+ this.bouncingAnimation[axis].set({
+ startTime: this.bouncingData[axis].time,
+ startOffset: this.bouncingData[axis].offset,
+ startVelocity: this.bouncingData[axis].velocity
});
+ this.isBouncing[axis] = true;
}
+
this.isDecelerating[axis] = false;
}
else if (Math.abs(currentVelocity) <= 1) {
@@ -15985,19 +16062,14 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
}
else if (this.isBouncing[axis]) {
newOffset[axis] = this.bouncingAnimation[axis].getOffset();
- restrictedOffset = this.offsetBoundary.restrict(axis, newOffset[axis]);
+ restrictedOffset = offsetBoundary.restrict(axis, newOffset[axis]);
if (Math.abs(newOffset[axis] - restrictedOffset) <= 1) {
this.isBouncing[axis] = false;
- this.fireEvent('bounceend', this, {
- axis: axis,
- offset: restrictedOffset,
- time: currentTime,
- velocity: 0
- });
+ this.fireEvent('bounceend', this, {axis: axis});
newOffset[axis] = restrictedOffset;
}
- }
+ }
}, this);
if (!this.isDecelerating.x && !this.isDecelerating.y && !this.isBouncing.x && !this.isBouncing.y) {
@@ -16007,12 +16079,13 @@ Ext.util.Scroller = Ext.extend(Ext.util.Draggable, {
this.momentumAnimationFramesHandled++;
this.momentumAnimationProcessingTime += Date.now() - currentTime;
-
+
this.setOffset(newOffset);
},
destroy: function() {
+ Ext.ScrollManager.unregister(this);
return Ext.util.Scroller.superclass.destroy.apply(this, arguments);
}
});
@@ -16023,11 +16096,11 @@ Ext.util.Scroller.Animation.Deceleration = Ext.extend(Ext.util.Draggable.Animati
acceleration: 30,
theta: null,
startVelocity: null,
-
+
getOffset: function() {
return this.startOffset - this.startVelocity * (1 - this.getFrictionFactor()) / this.theta;
},
-
+
getFrictionFactor : function() {
var deltaTime = Date.now() - this.startTime;
@@ -16039,7 +16112,7 @@ Ext.util.Scroller.Animation.Bouncing = Ext.extend(Ext.util.Draggable.Animation.A
springTension: 0.3,
acceleration: 30,
startVelocity: null,
-
+
getOffset: function() {
var deltaTime = (Date.now() - this.startTime),
powTime = (deltaTime / this.acceleration) * Math.pow(Math.E, -this.springTension * (deltaTime / this.acceleration));
@@ -16053,13 +16126,13 @@ Ext.util.Scroller.Indicator = Ext.extend(Object, {
baseCls: 'x-scrollbar',
ui: 'dark',
-
+
type: 'horizontal',
constructor: function(container, config) {
this.container = container;
-
+
Ext.apply(this, config);
this.el = this.container.createChild({
@@ -16107,7 +16180,7 @@ Ext.util.Scroller.Indicator = Ext.extend(Object, {
if (this.size && size > this.size) {
size = Math.round(size);
}
-
+
this.el.dom.style[(this.type == 'horizontal') ? 'width' : 'height'] = size + 'px';
@@ -16136,7 +16209,7 @@ Ext.util.Scroller.Indicator = Ext.extend(Object, {
return this;
}
-
+
});
})();
@@ -16223,14 +16296,14 @@ Ext.util.Sortable = Ext.extend(Ext.util.Observable, {
}
this.el.addCls(this.baseCls);
-
+ this.startEventName = (this.delay > 0) ? 'taphold' : 'tapstart';
if (!this.disabled) {
this.enable();
}
},
- onTouchStart : function(e, t) {
+ onStart : function(e, t) {
if (this.cancelSelector && e.getTarget(this.cancelSelector)) {
return;
}
@@ -16247,22 +16320,21 @@ Ext.util.Sortable = Ext.extend(Ext.util.Observable, {
onSortStart : function(e, t) {
this.sorting = true;
var draggable = new Ext.util.Draggable(t, {
- delay: this.delay,
+ threshold: 0,
revert: this.revert,
direction: this.direction,
constrain: this.constrain === true ? this.el : this.constrain,
animationDuration: 100
});
draggable.on({
- dragThreshold: 0,
drag: this.onDrag,
dragend: this.onDragEnd,
scope: this
});
this.dragEl = t;
this.calculateBoxes();
-
+
if (!draggable.dragging) {
draggable.onStart(e);
}
@@ -16343,13 +16415,13 @@ Ext.util.Sortable = Ext.extend(Ext.util.Observable, {
enable : function() {
- this.el.on('touchstart', this.onTouchStart, this, {delegate: this.itemSelector});
+ this.el.on(this.startEventName, this.onStart, this, {delegate: this.itemSelector, holdThreshold: this.delay});
this.disabled = false;
},
disable : function() {
- this.el.un('touchstart', this.onTouchStart, this);
+ this.el.un(this.startEventName, this.onStart, this);
this.disabled = true;
},
@@ -16377,7 +16449,6 @@ Ext.util.Sortable = Ext.extend(Ext.util.Observable, {
-
(function() {
@@ -17417,11 +17488,11 @@ Ext.data.Connection = Ext.extend(Ext.util.Observable, {
abort : function(r) {
if (r && this.isLoading(r)) {
+ if (!request.timedout) {
+ request.aborted = true;
+ }
+
r.xhr.abort();
- clearTimeout(r.timeout);
- delete(r.timeout);
- r.aborted = true;
- this.onComplete(r);
}
else if (!r) {
var id;
@@ -18016,10 +18087,10 @@ Ext.gesture.Manager = new Ext.AbstractManager({
defaultPreventedMouseEvents: ['click'],
clickMoveThreshold: 5,
-
+
init: function() {
- this.targets = [];
-
+ this.targets = [];
+
this.followTouches = [];
this.currentGestures = [];
this.currentTargets = [];
@@ -18031,7 +18102,7 @@ Ext.gesture.Manager = new Ext.AbstractManager({
end: 'mouseup'
});
}
-
+
this.listenerWrappers = {
start: Ext.createDelegate(this.onTouchStart, this),
move: Ext.createDelegate(this.onTouchMove, this),
@@ -18060,24 +18131,24 @@ Ext.gesture.Manager = new Ext.AbstractManager({
attachListeners: function() {
Ext.iterate(this.eventNames, function(key, name) {
- document.body.addEventListener(name, this.listenerWrappers[key], false);
+ document.addEventListener(name, this.listenerWrappers[key], false);
}, this);
if (Ext.supports.Touch) {
this.defaultPreventedMouseEvents.forEach(function(name) {
- document.body.addEventListener(name, this.listenerWrappers['mouse'], true);
+ document.addEventListener(name, this.listenerWrappers['mouse'], true);
}, this);
}
},
detachListeners: function() {
Ext.iterate(this.eventNames, function(key, name) {
- document.body.removeEventListener(name, this.listenerWrappers[key], false);
+ document.removeEventListener(name, this.listenerWrappers[key], false);
}, this);
if (Ext.supports.Touch) {
this.defaultPreventedMouseEvents.forEach(function(name) {
- document.body.removeEventListener(name, this.listenerWrappers['mouse'], true);
+ document.removeEventListener(name, this.listenerWrappers['mouse'], true);
}, this);
}
},
@@ -18091,14 +18162,13 @@ Ext.gesture.Manager = new Ext.AbstractManager({
onTouchStart: function(e) {
var targets = [],
- target = e.target,
- me = this;
+ target = e.target;
if (e.stopped === true) {
return;
}
- if (!Ext.is.iOS) {
+ if (Ext.is.Android) {
if (!(target.tagName && ['input', 'textarea', 'select'].indexOf(target.tagName.toLowerCase()) !== -1)) {
e.preventDefault();
}
@@ -18107,7 +18177,7 @@ Ext.gesture.Manager = new Ext.AbstractManager({
if (this.isFrozen) {
return;
}
-
+
@@ -18116,18 +18186,18 @@ Ext.gesture.Manager = new Ext.AbstractManager({
}
this.locks = {};
-
+
this.currentTargets = [target];
-
+
while (target) {
if (this.targets.indexOf(target) !== -1) {
targets.unshift(target);
}
-
+
target = target.parentNode;
this.currentTargets.push(target);
}
-
+
this.startEvent = e;
this.startPoint = Ext.util.Point.fromEvent(e);
this.lastMovePoint = null;
@@ -18136,6 +18206,10 @@ Ext.gesture.Manager = new Ext.AbstractManager({
},
onTouchMove: function(e) {
+ if (!Ext.is.Android) {
+ e.preventDefault();
+ }
+
if (!this.startEvent) {
return;
}
@@ -18144,10 +18218,6 @@ Ext.gesture.Manager = new Ext.AbstractManager({
e.target = this.startEvent.target;
}
- if (Ext.is.iOS) {
- e.preventDefault();
- }
-
if (this.isFrozen) {
return;
}
@@ -18177,10 +18247,14 @@ Ext.gesture.Manager = new Ext.AbstractManager({
onTouchEnd: function(e) {
+ if (Ext.is.Blackberry) {
+ e.preventDefault();
+ }
+
if (this.isFrozen) {
return;
}
-
+
var gestures = this.currentGestures.slice(0),
ln = gestures.length,
i, gesture, endPoint,
@@ -18238,15 +18312,15 @@ Ext.gesture.Manager = new Ext.AbstractManager({
if (e.stopped) {
break;
}
-
+
this.handleTarget(targets[i], e, true);
}
for (i = ln - 1; i >= 0; i--) {
if (e.stopped) {
break;
}
-
+
this.handleTarget(targets[i], e, false);
}
@@ -18293,6 +18367,7 @@ Ext.gesture.Manager = new Ext.AbstractManager({
addEventListener: function(target, eventName, listener, options) {
target = Ext.getDom(target);
+ options = options || {};
var targets = this.targets,
name = this.getGestureName(eventName),
@@ -18303,21 +18378,21 @@ Ext.gesture.Manager = new Ext.AbstractManager({
gestures = [];
Ext.Element.data(target, 'x-gestures', gestures);
}
-
+
if (!name) {
throw new Error('Trying to subscribe to unknown event ' + eventName);
}
-
+
if (targets.indexOf(target) === -1) {
this.targets.push(target);
}
-
+
gesture = this.get(target.id + '-' + name);
-
+
if (!gesture) {
- gesture = this.create(Ext.apply({}, options || {}, {
+ gesture = this.create(Ext.apply({}, options, {
target: target,
type: name
}));
@@ -18326,58 +18401,58 @@ Ext.gesture.Manager = new Ext.AbstractManager({
}
-
+
gesture.addListener(eventName, listener);
-
+
if (this.startedChangedTouch && this.currentTargets.contains(target) && !gesture.started && !options.subsequent) {
this.startGesture(gesture);
if (gesture.listenForStart) {
- gesture.onTouchStart(this.startEvent, this.startedTouches[0]);
+ gesture.onTouchStart(this.startEvent, this.startedTouches[0]);
}
}
},
-
+
removeEventListener: function(target, eventName, listener) {
target = Ext.getDom(target);
-
+
var name = this.getGestureName(eventName),
gestures = Ext.Element.data(target, 'x-gestures') || [],
gesture;
-
+
gesture = this.get(target.id + '-' + name);
-
+
if (gesture) {
gesture.removeListener(eventName, listener);
for (name in gesture.listeners) {
return;
}
-
+
gesture.destroy();
gestures.remove(gesture);
Ext.Element.data(target, 'x-gestures', gestures);
}
},
-
+
getGestureName: function(ename) {
return this.names && this.names[ename];
},
-
+
registerType: function(type, cls) {
var handles = cls.prototype.handles,
i, ln;
this.types[type] = cls;
cls[this.typeName] = type;
-
+
if (!handles) {
handles = cls.prototype.handles = [type];
}
-
+
this.names = this.names || {};
-
+
for (i = 0, ln = handles.length; i < ln; i++) {
this.names[handles[i]] = type;
}
@@ -18387,6 +18462,7 @@ Ext.gesture.Manager = new Ext.AbstractManager({
Ext.regGesture = function() {
return Ext.gesture.Manager.registerType.apply(Ext.gesture.Manager, arguments);
};
+
Ext.TouchEventObjectImpl = Ext.extend(Object, {
constructor : function(e, args) {
if (e) {
@@ -18492,7 +18568,7 @@ Ext.gesture.Gesture = Ext.extend(Object, {
},
fire: function(type, e, args) {
- var listeners = this.listeners[type],
+ var listeners = this.listeners && this.listeners[type],
ln = listeners && listeners.length,
i;
@@ -18735,9 +18811,14 @@ Ext.gesture.Tap = Ext.extend(Ext.gesture.Gesture, {
},
getInfo : function(touch) {
+ var x = touch.pageX,
+ y = touch.pageY;
+
return {
- pageX: touch.pageX,
- pageY: touch.pageY
+ pageX: x,
+ pageY: y,
+ startX: x,
+ startY: y
};
},
@@ -18772,7 +18853,7 @@ Ext.gesture.Swipe = Ext.extend(Ext.gesture.Gesture, {
if (absDeltaY - absDeltaX > 3 || deltaTime > this.swipeTime) {
- this.unlock('scroll', 'scrollstart', 'scrollend');
+ this.unlock('drag', 'dragstart', 'dragend');
this.stop();
}
else if (absDeltaX > this.swipeThreshold && absDeltaX > absDeltaY) {
@@ -18835,6 +18916,7 @@ Ext.gesture.Drag = Ext.extend(Ext.gesture.Touch, {
if (this.isDragging(info) && this.fire('dragstart', e, info)) {
this.dragging = true;
this.lock('drag', 'dragstart', 'dragend');
+ this.fire('drag', e, info);
}
}
else {
@@ -20404,34 +20486,38 @@ Ext.Component = Ext.extend(Ext.lib.Component, {
setScrollable : function(config) {
- if (!this.rendered) {
- this.scroll = config;
+ var me = this,
+ direction;
+
+ if (!me.rendered) {
+ me.scroll = config;
return;
}
- Ext.destroy(this.scroller);
- this.scroller = null;
+ Ext.destroy(me.scroller);
+ me.scroller = null;
+
+
+ if (me.originalGetTargetEl) {
+ me.getTargetEl = me.originalGetTargetEl;
+ }
if (config !== false) {
- var direction = Ext.isObject(config) ? config.direction: config;
+ direction = Ext.isObject(config) ? config.direction: config;
config = Ext.apply({},
Ext.isObject(config) ? config: {}, {
direction: direction
});
- if (!this.scrollEl) {
- this.scrollEl = this.getTargetEl().createChild();
- this.originalGetTargetEl = this.getTargetEl;
- this.getTargetEl = function() {
- return this.scrollEl;
- };
+ if (!me.scrollEl) {
+ me.scrollEl = me.getTargetEl().createChild();
}
-
- this.scroller = (new Ext.util.ScrollView(this.scrollEl, config)).scroller;
- }
- else {
- this.getTargetEl = this.originalGetTargetEl;
+ me.originalGetTargetEl = me.getTargetEl;
+ me.getTargetEl = function() {
+ return me.scrollEl;
+ };
+ me.scroller = (new Ext.util.ScrollView(me.scrollEl, config)).scroller;
}
},
@@ -20936,19 +21022,21 @@ Ext.Container = Ext.extend(Ext.lib.Container, {
if (this.scroll) {
this.fields = new Ext.util.MixedCollection();
- this.fields.on({
- add: this.onFieldAdd,
- remove: this.onFieldRemove,
- scope: this
- });
+ if (!Ext.is.Blackberry) {
+ this.fields.on({
+ add: this.onFieldAdd,
+ remove: this.onFieldRemove,
+ scope: this
+ });
+ }
this.on({
add: this.onItemAdd,
remove: this.onItemRemove,
scope: this
});
}
-
+
Ext.Container.superclass.initComponent.apply(this, arguments);
},
@@ -20957,10 +21045,10 @@ Ext.Container = Ext.extend(Ext.lib.Container, {
Ext.Container.superclass.afterRender.apply(this, arguments);
if (this.scroller) {
- if (Ext.is.Android && this.containsFormFields) {
+ if ((Ext.is.Android) && this.containsFormFields) {
this.scroller.setUseCssTransform(false);
}
-
+
this.scroller.on('scrollstart', this.onFieldScrollStart, this);
}
},
@@ -20993,7 +21081,7 @@ Ext.Container = Ext.extend(Ext.lib.Container, {
handleFieldEventListener: function(isAdding, item) {
if (!this.fieldEventWrap)
this.fieldEventWrap = {};
-
+
if (['textfield', 'passwordfield', 'emailfield',
'textareafield', 'searchfield', 'urlfield',
'numberfield', 'spinnerfield'].indexOf(item.xtype) !== -1) {
@@ -21018,7 +21106,9 @@ Ext.Container = Ext.extend(Ext.lib.Container, {
},
onFieldKeyUp: function(field, e) {
- this.resetLastWindowScroll();
+ if (Ext.is.iOS || Ext.is.Desktop) {
+ this.resetLastWindowScroll();
+ }
},
onFieldBeforeFocus: function(field, e) {
@@ -21048,73 +21138,79 @@ Ext.Container = Ext.extend(Ext.lib.Container, {
if (Ext.is.iOS) {
-
-
window.scrollTo(windowScroll.x, windowScroll.y);
}
this.resetLastWindowScroll();
},
onFieldFocus: function(field, e) {
+ if (!Ext.is.iOS && !Ext.is.Desktop) {
+ var dom = field.fieldEl.dom;
- var scroller = this.getClosestScroller(),
- containerRegion = Ext.util.Region.from(scroller.containerBox),
- fieldRegion = field.fieldEl.getPageBox(true);
-
-
- if (this.focusingField == field || !Ext.is.iOS) {
- if (Ext.is.iOS && window.pageYOffset == 0) {
- window.scrollTo(0, 0);
+ if (dom.scrollIntoViewIfNeeded) {
+ dom .scrollIntoViewIfNeeded(true);
}
+ }
+ else {
+ var scroller = this.getClosestScroller(),
+ containerRegion = Ext.util.Region.from(scroller.containerBox),
+ fieldRegion = field.fieldEl.getPageBox(true);
- var adjustment = new Ext.util.Offset();
+
+ if (this.focusingField == field || !Ext.is.iOS) {
+ if (Ext.is.iOS && window.pageYOffset == 0) {
+ window.scrollTo(0, 0);
+ }
- if (fieldRegion.left < containerRegion.left) {
- adjustment.x = containerRegion.left - fieldRegion.left;
- }
+ var adjustment = new Ext.util.Offset();
- if (fieldRegion.top < containerRegion.top) {
- adjustment.y = containerRegion.top - fieldRegion.top;
- }
+ if (fieldRegion.left < containerRegion.left) {
+ adjustment.x = containerRegion.left - fieldRegion.left;
+ }
- if (!adjustment.isZero()) {
- var windowScroll = this.getLastWindowScroll();
+ if (fieldRegion.top < containerRegion.top) {
+ adjustment.y = containerRegion.top - fieldRegion.top;
+ }
- scroller.scrollBy(adjustment);
+ if (!adjustment.isZero()) {
+ var windowScroll = this.getLastWindowScroll();
- if (Ext.is.iOS) {
- window.scrollTo(windowScroll.x, windowScroll.y);
- }
+ scroller.scrollBy(adjustment);
- this.resetLastWindowScroll();
- }
- }
-
- else {
- if (this.lastFocusedField) {
- var deltaY = fieldRegion.top - this.lastFocusedField.fieldEl.getY(),
- offsetY = scroller.offset.y - deltaY,
- selfHandling = false;
+ if (Ext.is.iOS) {
+ window.scrollTo(windowScroll.x, windowScroll.y);
+ }
- if (!containerRegion.contains(fieldRegion) &&
- (offsetY != 0 || (offsetY == 0 && scroller.offset.y != 0))) {
- selfHandling = true;
+ this.resetLastWindowScroll();
}
+ }
+
+ else {
+ if (this.lastFocusedField) {
+ var deltaY = fieldRegion.top - this.lastFocusedField.fieldEl.getY(),
+ offsetY = scroller.offset.y - deltaY,
+ selfHandling = false;
+
+ if (!containerRegion.contains(fieldRegion) &&
+ (offsetY != 0 || (offsetY == 0 && scroller.offset.y != 0))) {
+ selfHandling = true;
+ }
- if (offsetY > 0) {
- offsetY = 0;
- }
+ if (offsetY > 0) {
+ offsetY = 0;
+ }
- if (selfHandling) {
- this.adjustScroller(new Ext.util.Offset(
- scroller.offset.x, offsetY
- ));
+ if (selfHandling) {
+ this.adjustScroller(new Ext.util.Offset(
+ scroller.offset.x, offsetY
+ ));
+ }
}
}
- }
- this.resetLastWindowScroll();
+ this.resetLastWindowScroll();
+ }
this.lastFocusedField = field;
this.focusedField = field;
@@ -21166,7 +21262,7 @@ Ext.Container = Ext.extend(Ext.lib.Container, {
this.layout.setActiveItem(card, animation);
return this;
},
-
+
onBeforeCardSwitch : function(newCard, oldCard, newIndex, animated) {
@@ -22461,6 +22557,13 @@ Ext.DataView = Ext.extend(Ext.Component, {
throw "Using the deprecated selectedCls or selectedClass configuration. Use selectedItemCls.";
}
+ this.addEvents(
+
+ 'beforerefresh',
+
+ 'refresh'
+ );
+
this.addCmpEvents();
this.store = Ext.StoreMgr.lookup(this.store)
@@ -22527,6 +22630,7 @@ Ext.DataView = Ext.extend(Ext.Component, {
return;
}
+ this.fireEvent('beforerefresh', this);
var el = this.getTargetEl(),
records = this.store.getRange();
@@ -22542,7 +22646,7 @@ Ext.DataView = Ext.extend(Ext.Component, {
this.updateIndexes(0);
}
this.hasSkippedEmptyText = true;
- this.fireEvent('refresh');
+ this.fireEvent('refresh', this);
},
@@ -23088,6 +23192,9 @@ Ext.List = Ext.extend(Ext.DataView, {
itemSelector: '.x-list-item',
+ itemCls: '',
+
+
onItemDisclosure: false,
@@ -23100,9 +23207,6 @@ Ext.List = Ext.extend(Ext.DataView, {
-
-
-
var memberFnsCombo = {};
if (Ext.isArray(this.itemTpl)) {
@@ -23121,7 +23225,7 @@ Ext.List = Ext.extend(Ext.DataView, {
throw new Error("Ext.List: Using a CSS class of x-list-item within your own tpl will break Ext.Lists. Remove the x-list-item from the tpl/itemTpl");
}
- this.tpl = '<tpl for="."><div class="x-list-item"><div class="x-list-item-body">' + this.itemTpl + '</div>';
+ this.tpl = '<tpl for="."><div class="x-list-item ' + this.itemCls + '"><div class="x-list-item-body">' + this.itemTpl + '</div>';
if (this.onItemDisclosure) {
this.tpl += '<div class="x-list-disclosure"></div>';
}
@@ -23152,6 +23256,10 @@ Ext.List = Ext.extend(Ext.DataView, {
};
}
+
+
+
+
Ext.List.superclass.initComponent.call(this);
if (this.onItemDisclosure) {
@@ -23167,9 +23275,12 @@ Ext.List = Ext.extend(Ext.DataView, {
this.on('deactivate', this.onDeactivate, this);
- this.addEvents(
+ this.addEvents(
- 'disclose'
+ 'disclose',
+
+
+ 'update'
);
},
@@ -23186,7 +23297,7 @@ Ext.List = Ext.extend(Ext.DataView, {
});
}
}
-
+
Ext.List.superclass.onRender.apply(this, arguments);
},
@@ -23306,14 +23417,19 @@ Ext.List = Ext.extend(Ext.DataView, {
updateIndexes : function() {
Ext.List.superclass.updateIndexes.apply(this, arguments);
- this.updateOffsets();
+ this.updateList();
},
afterComponentLayout : function() {
Ext.List.superclass.afterComponentLayout.apply(this, arguments);
- this.updateOffsets();
+ this.updateList();
},
+ updateList : function() {
+ this.fireEvent('update', this);
+ this.updateOffsets();
+ },
+
updateOffsets : function() {
if (this.grouped) {
this.groupOffsets = [];
@@ -23324,7 +23440,7 @@ Ext.List = Ext.extend(Ext.DataView, {
for (i = 0; i < ln; i++) {
header = Ext.get(headers[i]);
- header.setDisplayMode(Ext.Element.VISIBILITY);
+ header.setVisibilityMode(Ext.Element.VISIBILITY);
this.groupOffsets.push({
header: header,
offset: header.dom.offsetTop
@@ -23400,7 +23516,7 @@ Ext.List = Ext.extend(Ext.DataView, {
this.scroller.scrollTo({x: 0, y: closest.getOffsetsTo(this.scrollEl)[1]}, false, null, true);
}
},
-
+
getGroupId : function(group) {
return group.name.toLowerCase();
},
@@ -23899,7 +24015,7 @@ Ext.Sheet = Ext.extend(Ext.Panel, {
afterRender : function() {
Ext.Sheet.superclass.afterRender.apply(this, arguments);
- this.el.setDisplayMode(Ext.Element.OFFSETS);
+ this.el.setVisibilityMode(Ext.Element.OFFSETS);
},
@@ -24193,8 +24309,10 @@ Ext.TabPanel = Ext.extend(Ext.Panel, {
onRemove: function(cmp, autoDestroy) {
- this.tabBar.remove(cmp.tab, autoDestroy);
- this.tabBar.doLayout();
+ if (!this.destroying) {
+ this.tabBar.remove(cmp.tab, autoDestroy);
+ this.tabBar.doLayout();
+ }
}
});
@@ -24679,7 +24797,7 @@ Ext.Map = Ext.extend(Ext.Component, {
onRender : function(container, position) {
Ext.Map.superclass.onRender.apply(this, arguments);
- this.el.setDisplayMode(Ext.Element.OFFSETS);
+ this.el.setVisibilityMode(Ext.Element.OFFSETS);
},
@@ -24920,6 +25038,7 @@ Ext.NestedList = Ext.extend(Ext.Panel, {
},
+
useToolbar: true,
@@ -25292,7 +25411,6 @@ Ext.Picker = Ext.extend(Ext.Sheet, {
toolbarItems.push(
Ext.apply(
{
- ui: 'decline',
handler: this.onCancelButtonTap,
scope: this
},
@@ -25592,6 +25710,10 @@ Ext.Picker.Slot = Ext.extend(Ext.DataView, {
onItemTap: function(node) {
Ext.Picker.Slot.superclass.onItemTap.apply(this, arguments);
this.setSelectedNode(node);
+
+ this.selectedNode = node;
+ this.selectedIndex = this.indexOf(node);
+ this.fireEvent('slotpick', this, this.getValue(), this.selectedNode);
},
@@ -25662,9 +25784,9 @@ Ext.DatePicker = Ext.extend(Ext.Picker, {
yearText: 'Year',
+
-
-
+
slotOrder: ['month', 'day', 'year'],
@@ -25708,7 +25830,7 @@ Ext.DatePicker = Ext.extend(Ext.Picker, {
}
this.slots = [];
-
+
this.slotOrder.forEach(function(item){
this.slots.push(this.createSlot(item, days, months, years));
}, this);
@@ -25718,10 +25840,10 @@ Ext.DatePicker = Ext.extend(Ext.Picker, {
afterRender: function() {
Ext.DatePicker.superclass.afterRender.apply(this, arguments);
-
+
this.setValue(this.value);
},
-
+
createSlot: function(name, days, months, years){
switch (name) {
case 'year':
@@ -25814,6 +25936,7 @@ Ext.DatePicker = Ext.extend(Ext.Picker, {
Ext.reg('datepicker', Ext.DatePicker);
+
Ext.Media = Ext.extend(Ext.Component, {
@@ -26003,9 +26126,7 @@ Ext.MessageBox = Ext.extend(Ext.Sheet, {
exitAnimation: 'pop',
-
-
-
+ autoHeight : true,
defaultTextHeight : 75,
@@ -26884,7 +27005,7 @@ Ext.form.Field = Ext.extend(Ext.Component, {
if (this.fieldEl) {
if (this.useMask && this.mask) {
this.mon(this.mask, {
- tap: this.onMaskTap,
+ click: this.onMaskTap,
scope: this
});
}
@@ -26955,12 +27076,12 @@ Ext.form.Field = Ext.extend(Ext.Component, {
return false;
}
- if (Ext.is.iOS && e.browserEvent && !e.browserEvent.isSimulated && !e.browserEvent.isSimulated) {
- console.log('onMaskTap prevented');
- e.preventDefault();
- e.stopPropagation();
- return false;
- }
+
+
+
+
+
+
return true;
},
@@ -27022,7 +27143,7 @@ Ext.form.Slider = Ext.extend(Ext.form.Field, {
inputCls: 'x-slider',
-
+
inputType: 'slider',
@@ -27036,12 +27157,12 @@ Ext.form.Slider = Ext.extend(Ext.form.Field, {
value: 0,
-
+
trackWidth: null,
monitorOrientation: true,
-
+
renderTpl: [
'<tpl if="label">',
'<div class="x-form-label"><span>{label}</span></div>',
@@ -27087,7 +27208,7 @@ Ext.form.Slider = Ext.extend(Ext.form.Field, {
}
this.increment = Math.abs(this.increment);
-
+
this.values = [this.value];
@@ -27131,12 +27252,15 @@ Ext.form.Slider = Ext.extend(Ext.form.Field, {
onOrientationChange: function() {
Ext.form.Slider.superclass.onOrientationChange.apply(this, arguments);
-
- var thumb = this.getThumb();
+
+ var me = this,
+ thumb = this.getThumb();
if (thumb.dragObj) {
- thumb.dragObj.updateBoundary();
- this.moveThumb(thumb, this.getPixelValue(thumb.getValue(), thumb), 0);
+ setTimeout(function() {
+ thumb.dragObj.updateBoundary();
+ me.moveThumb(thumb, me.getPixelValue(thumb.getValue(), thumb), 0);
+ }, 100);
}
},
@@ -27151,7 +27275,7 @@ Ext.form.Slider = Ext.extend(Ext.form.Field, {
}
moveThumb = !!moveThumb;
-
+
var thumb = this.getThumb(),
oldValue = thumb.getValue(),
@@ -27161,7 +27285,7 @@ Ext.form.Slider = Ext.extend(Ext.form.Field, {
if (moveThumb) {
this.moveThumb(thumb, this.getPixelValue(newValue, thumb), animationDuration);
}
-
+
thumb.setValue(newValue);
this.doComponentLayout();
@@ -27276,7 +27400,7 @@ Ext.form.Slider = Ext.extend(Ext.form.Field, {
afterRender: function(ct) {
var me = this;
-
+
me.renderThumbs();
Ext.form.Slider.superclass.afterRender.apply(me, arguments);
@@ -27292,7 +27416,7 @@ Ext.form.Slider = Ext.extend(Ext.form.Field, {
return this.thumbs[0];
},
-
+
setThumbsDisabled: function(disable) {
var thumbs = this.thumbs,
@@ -27303,13 +27427,13 @@ Ext.form.Slider = Ext.extend(Ext.form.Field, {
thumbs[i].dragObj[disable ? 'disable' : 'enable']();
}
},
-
+
disable: function() {
Ext.form.Slider.superclass.disable.call(this);
this.setThumbsDisabled(true);
},
-
+
enable: function() {
Ext.form.Slider.superclass.enable.call(this);
@@ -28103,7 +28227,7 @@ Ext.form.Checkbox = Ext.extend(Ext.form.Field, {
e = e.browserEvent;
}
- if (!e.isSimulated) {
+ if (Ext.supports.Touch && !e.isSimulated) {
e.preventDefault();
e.stopPropagation();
return;
@@ -28381,7 +28505,7 @@ Ext.form.Select = Ext.extend(Ext.form.Text, {
onOrientationChange: function() {
- if (this.isActive && !Ext.is.Phone) {
+ if (this.listPanel && !this.listPanel.hidden && !Ext.is.Phone) {
this.listPanel.showBy(this.el, false, false);
}
},
@@ -28407,8 +28531,6 @@ Ext.form.Select = Ext.extend(Ext.form.Text, {
listPanel.showBy(this.el, 'fade', false);
listPanel.down('#list').getSelectionModel().select(index != -1 ? index: 0, false, true);
}
-
- this.isActive = true;
},
@@ -28423,8 +28545,6 @@ Ext.form.Select = Ext.extend(Ext.form.Text, {
out: true,
scope: this
});
-
- this.isActive = false;
},
@@ -28436,8 +28556,6 @@ Ext.form.Select = Ext.extend(Ext.form.Text, {
this.setValue(newValue);
this.fireEvent('change', this, newValue);
}
-
- this.isActive = false;
},
@@ -28559,7 +28677,7 @@ Ext.form.DatePicker = Ext.extend(Ext.form.Field, {
initComponent: function() {
this.addEvents(
- 'select'
+ 'change'
);
this.tabIndex = -1;
@@ -28601,7 +28719,7 @@ Ext.form.DatePicker = Ext.extend(Ext.form.Field, {
onPickerChange : function(picker, value) {
this.setValue(value);
- this.fireEvent('select', this, this.getValue());
+ this.fireEvent('change', this, this.getValue());
},
@@ -29694,7 +29812,11 @@ Ext.layout.BoxLayout = Ext.extend(Ext.layout.ContainerLayout, {
pack : 'start',
align: 'center',
-
+
+ notifyOwnerCtContainer: true,
+
+ fixedLayout: false,
+
direction: 'normal',
@@ -29833,3 +29955,268 @@ Ext.regLayout('vbox', Ext.layout.VBoxLayout);
+Ext.plugins.ListPagingPlugin = Ext.extend(Ext.util.Observable, {
+
+ autoPaging: false,
+
+
+ loadMoreText: 'Load More...',
+
+ init: function(list) {
+ this.list = list;
+
+ list.onBeforeLoad = Ext.util.Functions.createInterceptor(list.onBeforeLoad, this.onBeforeLoad, this);
+
+
+ this.mon(list, 'update', this.onListUpdate, this);
+ },
+
+ onListUpdate : function() {
+ if (!this.rendered) {
+ this.render();
+ }
+
+ this.el.appendTo(this.list.getTargetEl());
+ if (!this.autoPaging) {
+ this.el.removeCls('x-loading');
+ }
+ this.loading = false;
+ },
+
+ render : function() {
+ var list = this.list,
+ targetEl = list.getTargetEl(),
+ html = '';
+
+ if (!this.autoPaging) {
+ html += '<div class="x-list-paging-msg">' + this.loadMoreText + '</div>';
+ }
+
+ this.el = targetEl.createChild({
+ cls: 'x-list-paging' + (this.autoPaging ? ' x-loading' : ''),
+ html: html + Ext.LoadingSpinner
+ });
+
+ if (this.autoPaging) {
+ this.mon(targetEl.getScrollParent(), 'scrollend', this.onScrollEnd, this);
+ }
+ else {
+ this.mon(this.el, 'tap', this.onPagingTap, this);
+ }
+
+ this.rendered = true;
+ },
+
+ onBeforeLoad : function() {
+ if (this.loading && this.list.store.getCount() > 0) {
+ this.list.loadMask.disable();
+ return false;
+ }
+ },
+
+
+ onPagingTap : function(e) {
+ if (!this.loading) {
+ this.loading = true;
+ this.list.store.nextPage();
+ this.el.addCls('x-loading');
+ }
+ },
+
+ onScrollEnd : function(scroller, pos) {
+ if (pos.y >= Math.abs(scroller.offsetBoundary.top)) {
+ this.loading = true;
+ this.list.store.nextPage();
+ }
+ }
+});
+
+Ext.preg('listpaging', Ext.plugins.ListPagingPlugin);
+
+
+Ext.plugins.PullRefreshPlugin = Ext.extend(Ext.util.Observable, {
+
+ pullRefreshText: 'Pull down to refresh...',
+
+
+ releaseRefreshText: 'Release to refresh...',
+
+
+ loadingText: 'Loading...',
+
+