Files
SIG/Scripts/AjaxControlToolkit/Release/UpdatePanelAnimation.js
2024-11-05 10:47:20 -07:00

1 line
6.2 KiB
JavaScript

Type.registerNamespace("Sys.Extended.UI.Animation"),Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior=function(t){Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.initializeBase(this,[t]),this._onUpdating=new Sys.Extended.UI.Animation.GenericAnimationBehavior(t),this._onUpdated=new Sys.Extended.UI.Animation.GenericAnimationBehavior(t),this._postBackPending=null,this._pageLoadedHandler=null,this._alwaysFinishOnUpdatingAnimation=null,this._triggerControlsClientID=null,this._updatePanelID="",this._updatePanelClientID="",this._childrenAsTriggers=!1},Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.prototype={initialize:function(){Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.callBaseMethod(this,"initialize");var t=this.get_element(),e=document.createElement(t.tagName);t.parentNode.insertBefore(e,t),e.appendChild(t),Array.remove(t._behaviors,this),Array.remove(t._behaviors,this._onUpdating),Array.remove(t._behaviors,this._onUpdated),e._behaviors?(Array.add(e._behaviors,this),Array.add(e._behaviors,this._onUpdating),Array.add(e._behaviors,this._onUpdated)):e._behaviors=[this,this._onUpdating,this._onUpdated],this._element=this._onUpdating._element=this._onUpdated._element=e,this._onUpdating.initialize(),this._onUpdated.initialize(),this.registerPartialUpdateEvents(),this._pageLoadedHandler=Function.createDelegate(this,this._pageLoaded),this._pageRequestManager.add_pageLoaded(this._pageLoadedHandler)},dispose:function(){this._pageRequestManager&&this._pageLoadedHandler&&(this._pageRequestManager.remove_pageLoaded(this._pageLoadedHandler),this._pageLoadedHandler=null),Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.callBaseMethod(this,"dispose")},_partialUpdateBeginRequest:function(t,e){Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.callBaseMethod(this,"_partialUpdateBeginRequest",[t,e]),this._postBackPending||(this._isTriggeredByTriggerControl(e._postBackElement.id)||this._isTriggeredByChildControl(t,e))&&(this._postBackPending=!0,this._onUpdated.quit(),this._onUpdating.play())},_isTriggeredByTriggerControl:function(t){return this._triggerControlsClientID.length&&this._triggerControlsClientID.indexOf(t)!=-1},_isTriggeredByChildControl:function(t,e){if(!this.get_childrenAsTriggers())return!1;if(!e._updatePanelsToUpdate)return!1;if(e._updatePanelsToUpdate.indexOf(this.get_updatePanelID())===-1)return!1;var n=t._updatePanelIDs.indexOf(this.get_updatePanelID());if(!t._updatePanelHasChildrenAsTriggers[n])return!1;var i=document.getElementById(e._postBackElement.id);return i.parentElement.id===this.get_updatePanelClientID()},_pageLoaded:function(t,e){if(this._postBackPending){this._postBackPending=!1;for(var n=this.get_element(),i=e.get_panelsUpdated(),a=0;a<i.length;a++)if(i[a].parentNode==n){this._alwaysFinishOnUpdatingAnimation?this._tryAndStopOnUpdating():(this._onUpdating.quit(),this._onUpdated.play());break}}},_tryAndStopOnUpdating:function(){if(this._onUpdating.get_animation().get_isPlaying()){var t=this;window.setTimeout(function(){t._tryAndStopOnUpdating.apply(t)},200)}else this._onUpdating.quit(),this._onUpdated.play()},get_onUpdating:function(){return this._onUpdating.get_json()},set_onUpdating:function(t){this._onUpdating.set_json(t),this.raisePropertyChanged("onUpdating")},get_OnUpdating:function(){return Sys.Extended.Deprecated("get_OnUpdating()","get_onUpdating()"),this.get_onUpdating()},set_OnUpdating:function(t){Sys.Extended.Deprecated("set_OnUpdating(value)","set_onUpdating(value)"),this.set_onUpdating()},get_onUpdatingBehavior:function(){return this._onUpdating},get_OnUpdatingBehavior:function(){return Sys.Extended.Deprecated("get_OnUpdatingBehavior()","get_onUpdatingBehavior()"),this.get_onUpdatingBehavior()},get_onUpdated:function(){return this._onUpdated.get_json()},set_onUpdated:function(t){this._onUpdated.set_json(t),this.raisePropertyChanged("onUpdated")},get_OnUpdated:function(){return Sys.Extended.Deprecated("get_OnUpdated()","get_onUpdated()"),this.get_onUpdated()},set_OnUpdated:function(t){Sys.Extended.Deprecated("set_OnUpdated(value)","set_onUpdated(value)"),this.set_onUpdated(t)},get_onUpdatedBehavior:function(){return this._onUpdated},get_OnUpdatedBehavior:function(){return Sys.Extended.Deprecated("get_OnUpdatedBehavior()","get_onUpdatedBehavior()"),this.get_onUpdatedBehavior()},get_alwaysFinishOnUpdatingAnimation:function(){return this._alwaysFinishOnUpdatingAnimation},set_alwaysFinishOnUpdatingAnimation:function(t){this._alwaysFinishOnUpdatingAnimation!=t&&(this._alwaysFinishOnUpdatingAnimation=t,this.raisePropertyChanged("alwaysFinishOnUpdatingAnimation"))},get_AlwaysFinishOnUpdatingAnimation:function(){return Sys.Extended.Deprecated("get_AlwaysFinishOnUpdatingAnimation()","get_alwaysFinishOnUpdatingAnimation()"),this.get_alwaysFinishOnUpdatingAnimation()},set_AlwaysFinishOnUpdatingAnimation:function(t){Sys.Extended.Deprecated("set_AlwaysFinishOnUpdatingAnimation(value)","set_alwaysFinishOnUpdatingAnimation(value)"),this.set_alwaysFinishOnUpdatingAnimation(t)},get_triggerControlsClientID:function(){return this._triggerControlsClientID},set_triggerControlsClientID:function(t){this._triggerControlsClientID!=t&&(this._triggerControlsClientID=t,this.raisePropertyChanged("triggerControlsClientID"))},get_TriggerControlsClientID:function(){return Sys.Extended.Deprecated("get_TriggerControlsClientID()","get_triggerControlsClientID()"),this._triggerControlsClientID},set_TriggerControlsClientID:function(t){Sys.Extended.Deprecated("set_TriggerControlsClientID(value)","set_triggerControlsClientID(value)"),this.set_triggerControlsClientID(t)},get_updatePanelID:function(){return this._updatePanelID},set_updatePanelID:function(t){this._updatePanelID!=t&&(this._updatePanelID=t,this.raisePropertyChanged("updatePanelID"))},get_updatePanelClientID:function(){return this._updatePanelClientID},set_updatePanelClientID:function(t){this._updatePanelClientID!=t&&(this._updatePanelClientID=t,this.raisePropertyChanged("updatePanelClientID"))},get_childrenAsTriggers:function(){return this._childrenAsTriggers},set_childrenAsTriggers:function(t){this._childrenAsTriggers!=t&&(this._childrenAsTriggers=t,this.raisePropertyChanged("childrenAsTriggers"))}},Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.registerClass("Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior",Sys.Extended.UI.BehaviorBase);