Files
SIG/Scripts/AjaxControlToolkit/Release/DropDown.js
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

1 line
13 KiB
JavaScript

Type.registerNamespace("Sys.Extended.UI");Sys.Extended.UI.DropDownBehavior=function(n){Sys.Extended.UI.DropDownBehavior.initializeBase(this,[n]);this._dropDownControl=null;this._highlightBorderColor="#2353B2";this._highlightBackgroundColor="#FFF3DB";this._dropArrowBackgroundColor="#C6E1FF";this._dropArrowImageUrl=null;this._dropArrowWidth="16px";this._oldBackgroundColor=null;this._dropFrame=null;this._dropArrow=null;this._dropArrowImage=null;this._dropWrapper=null;this._isOpen=!1;this._isOver=!1;this._wasClicked=null;this._dropWrapperHoverBehavior=null;this._dropPopupPopupBehavior=null;this._onShowJson=null;this._onHideJson=null;this._dropDownControl$delegates={click:Function.createDelegate(this,this._dropDownControl_onclick),contextmenu:Function.createDelegate(this,this._dropDownControl_oncontextmenu)};this._dropFrame$delegates={click:Function.createDelegate(this,this._dropFrame_onclick),contextmenu:Function.createDelegate(this,this._dropFrame_oncontextmenu)};this._dropWrapper$delegates={click:Function.createDelegate(this,this._dropWrapper_onclick),contextmenu:Function.createDelegate(this,this._dropWrapper_oncontextmenu)};this._document$delegates={click:Function.createDelegate(this,this._document_onclick),contextmenu:Function.createDelegate(this,this._document_oncontextmenu)};this._dropWrapperHoverBehavior$delegates={hover:Function.createDelegate(this,this._dropWrapperHoverBehavior_onhover),unhover:Function.createDelegate(this,this._dropWrapperHoverBehavior_onunhover)}};Sys.Extended.UI.DropDownBehavior.prototype={initialize:function(){var n,t,i;Sys.Extended.UI.DropDownBehavior.callBaseMethod(this,"initialize");n=this.get_element();t=n.parentNode;this._dropDownControl==null&&$common.createElementFromTemplate({parent:t,nameTable:this,name:"_dropDownControl",nodeName:"div",visible:!1,cssClasses:this._dropDownControl?null:["ajax__dropdown_panel"],properties:{__GENERATED:!0}});$addHandlers(this._dropDownControl,this._dropDownControl$delegates);i={};this._dropArrowImageUrl&&(i.src=this._dropArrowImageUrl);$common.createElementFromTemplate({parent:t,nameTable:this,name:"_dropFrame",nodeName:"span",visible:!1,children:[{name:"_dropFrameTop",nodeName:"div",cssClasses:["ajax__dropdown_frame_line"]},{name:"_dropFrameRight",nodeName:"div",cssClasses:["ajax__dropdown_frame_line"]},{name:"_dropFrameBottom",nodeName:"div",cssClasses:["ajax__dropdown_frame_line"]},{name:"_dropFrameLeft",nodeName:"div",cssClasses:["ajax__dropdown_frame_line"]},{name:"_dropArrow",nodeName:"div",cssClasses:this._dropArrowImageUrl?["ajax__dropdown_arrow"]:["ajax__dropdown_arrow","ajax__dropdown_arrow_image"],properties:{style:{width:this._dropArrowWidth,backgroundColor:this._dropArrowBackgroundColor}},events:this._dropFrame$delegates,children:[{name:"_dropArrowWrapper",nodeName:"div",visible:!!this._dropArrowImageUrl,cssClasses:["ajax__dropdown_arrow_wrapper"],children:[{name:"_dropArrowImage",nodeName:"img",properties:i}]}]}]});$common.createElementFromTemplate({parent:null,nameTable:this,name:"_dropWrapper",nodeName:"span",properties:{id:n.id+"_dropWrapper",style:{cursor:"default"}},events:this._dropWrapper$delegates,content:n});this._dropPopupPopupBehavior=$create(Sys.Extended.UI.PopupBehavior,{positioningMode:Sys.Extended.UI.PositioningMode.BottomRight,parentElement:n,y:-1},null,null,this._dropDownControl);this._onShowJson&&this._dropPopupPopupBehavior.set_onShow(this._onShowJson);this._onHideJson&&this._dropPopupPopupBehavior.set_onHide(this._onHideJson);this._dropWrapperHoverBehavior=$create(Sys.Extended.UI.HoverBehavior,{hoverElement:this._dropFrame},this._dropWrapperHoverBehavior$delegates,null,this._dropWrapper);$addHandlers(document,this._document$delegates)},dispose:function(){var n=this.get_element();this._isOpen&&(this.hide(),this.unhover(),this._isOpen=!1);$common.removeHandlers(document,this._document$delegates);this._onShowJson=null;this._onHideJson=null;this._dropPopupPopupBehavior&&(this._dropPopupPopupBehavior.dispose(),this._dropPopupPopupBehavior=null);this._dropWrapperHoverBehavior&&(this._dropWrapperHoverBehavior.dispose(),this._dropWrapperHoverBehavior=null);this._dropFrame&&($common.removeElement(this._dropFrame),this._dropFrame=null,this._dropFrameTop=null,this._dropFrameRight=null,this._dropFrameBottom=null,this._dropFrameLeft=null,this._dropArrow=null,this._dropArrowWrapper=null,this._dropArrowImage=null);this._dropWrapper&&($common.removeHandlers(this._dropWrapper,this._dropWrapper$delegates),$common.unwrapElement(n,this._dropWrapper),this._dropWrapper=null);this._dropDownControl&&($common.removeHandlers(this._dropDownControl,this._dropDownControl$delegates),this._dropDownControl.__GENERATED&&$common.removeElement(this._dropDownControl),this._dropDownControl=null);Sys.Extended.UI.DropDownBehavior.callBaseMethod(this,"dispose")},hover:function(){var t=this.get_element(),n,i,r;this._isOver||(this._isOver=!0,this.raiseHoverOver(Sys.EventArgs.Empty),n=$common.getBounds(t),$common.setLocation(this._dropFrame,{x:0,y:0}),$common.setVisible(this._dropFrame,!0),i=$common.getLocation(this._dropFrame),$common.setVisible(this._dropFrame,!1),n.x-=i.x,n.y-=i.y,$common.setBounds(this._dropFrameTop,{x:n.x,y:n.y,width:n.width,height:1}),$common.setBounds(this._dropFrameRight,{x:n.x+n.width-1,y:n.y,width:1,height:n.height}),$common.setBounds(this._dropFrameBottom,{x:n.x,y:n.y+n.height-1,width:n.width,height:1}),$common.setBounds(this._dropFrameLeft,{x:n.x,y:n.y,width:1,height:n.height}),$common.setBounds(this._dropArrow,{x:n.x+n.width-17,y:n.y+1,width:16,height:n.height-2}),this._dropFrameTop.style.backgroundColor=this._highlightBorderColor,this._dropFrameRight.style.backgroundColor=this._highlightBorderColor,this._dropFrameBottom.style.backgroundColor=this._highlightBorderColor,this._dropFrameLeft.style.backgroundColor=this._highlightBorderColor,$common.setVisible(this._dropFrame,!0),this._oldBackgroundColor||(this._oldBackgroundColor=$common.getCurrentStyle(t,"backgroundColor")),r=/\d{0,3},\s*\d{0,3},\s*\d{0,3}/,t.style.backgroundColor=r.test(this._highlightBackgroundColor)?"rgb("+this._highlightBackgroundColor+")":this._highlightBackgroundColor)},unhover:function(){var n=this.get_element();(this._isOver||!this._isOpen)&&(this._isOver=!1,this._isOpen||($common.setVisible(this._dropFrame,!1),this._oldBackgroundColor?(n.style.backgroundColor=this._oldBackgroundColor,this._oldBackgroundColor=null):n.style.backgroundColor="transparent"),this.raise_hoverOut(Sys.EventArgs.Empty))},show:function(){if(!this._isOpen){this.hover();var n=new Sys.CancelEventArgs;if(this.raise_showing(n),this.raise_popup(n),n.get_cancel())return;this._isOpen=!0;this.populate();(!this._dynamicPopulateBehavior||this._dynamicPopulateBehavior._populated&&this._cacheDynamicResults)&&this._showPopup()}},_showPopup:function(){this._dropPopupPopupBehavior.show();this.raise_shown(Sys.EventArgs.Empty)},hide:function(){if(this._isOpen){var n=new Sys.CancelEventArgs;if(this.raise_hiding(n),n.get_cancel())return;this._isOpen=!1;this._dropPopupPopupBehavior.hide();this.raise_hidden(Sys.EventArgs.Empty)}},_dropWrapperHoverBehavior_onhover:function(){this.hover()},_dropWrapperHoverBehavior_onunhover:function(){this.unhover()},_dropWrapper_onclick:function(n){n.target.tagName!="A"&&(this._isOpen?this.hide():this.show(),this._wasClicked=!0)},_dropWrapper_oncontextmenu:function(n){n.target.tagName!="A"&&(this._wasClicked=!0,n.preventDefault(),this.show())},_dropFrame_onclick:function(){this._isOpen?this.hide():this.show();this._wasClicked=!0},_dropFrame_oncontextmenu:function(n){this._wasClicked=!0;n.preventDefault();this.show()},_dropDownControl_onclick:function(){},_dropDownControl_oncontextmenu:function(n){this._wasClicked=!0;n.preventDefault()},_document_onclick:function(){this._wasClicked?this._wasClicked=!1:this._isOpen&&(this.hide(),this.unhover())},_document_oncontextmenu:function(){this._wasClicked?this._wasClicked=!1:this._isOpen&&(this.hide(),this.unhover())},_onPopulated:function(n,t){Sys.Extended.UI.DropDownBehavior.callBaseMethod(this,"_onPopulated",[n,t]);this._isOpen&&this._showPopup()},get_onShow:function(){return this._dropPopupPopupBehavior?this._dropPopupPopupBehavior.get_onShow():this._onShowJson},set_onShow:function(n){this._dropPopupPopupBehavior?this._dropPopupPopupBehavior.set_onShow(n):this._onShowJson=n;this.raisePropertyChanged("onShow")},get_onShowBehavior:function(){return this._dropPopupPopupBehavior?this._dropPopupPopupBehavior.get_onShowBehavior():null},onShow:function(){this._dropPopupPopupBehavior&&this._dropPopupPopupBehavior.onShow()},get_onHide:function(){return this._dropPopupPopupBehavior?this._dropPopupPopupBehavior.get_onHide():this._onHideJson},set_onHide:function(n){this._dropPopupPopupBehavior?this._dropPopupPopupBehavior.set_onHide(n):this._onHideJson=n;this.raisePropertyChanged("onHide")},get_onHideBehavior:function(){return this._dropPopupPopupBehavior?this._dropPopupPopupBehavior.get_onHideBehavior():null},onHide:function(){this._dropPopupPopupBehavior&&this._dropPopupPopupBehavior.onHide()},get_dropDownControl:function(){return this._dropDownControl},set_dropDownControl:function(n){this._dropDownControl!=n&&(this._dropDownControl=n,this.raisePropertyChanged("dropDownControl"))},get_highlightBorderColor:function(){return this._highlightBorderColor},set_highlightBorderColor:function(n){this._highlightBorderColor!=n&&(this._highlightBorderColor=n,this.raisePropertyChanged("highlightBorderColor"))},get_highlightBackgroundColor:function(){return this._highlightBackgroundColor},set_highlightBackgroundColor:function(n){this._highlightBackgroundColor!=n&&(this._highlightBackgroundColor=n,this.get_isInitialized()&&this._isOpen&&(this._dropWrapper.style.backgroundColor=n),this.raisePropertyChanged("highlightBackgroundColor"))},get_dropArrowBackgroundColor:function(){return this._dropArrowBackgroundColor},set_dropArrowBackgroundColor:function(n){this._dropArrowBackgroundColor!=n&&(this._dropArrowBackgroundColor=n,this.get_isInitialized()&&(this._dropArrow.style.backgroundColor=n),this.raisePropertyChanged("dropArrowBackgroundColor"))},get_dropArrowImageUrl:function(){return this._dropArrowImageUrl},set_dropArrowImageUrl:function(n){this._dropArrowImageUrl!=n&&(this._dropArrowImageUrl=n,this.get_isInitialized()&&(this._dropArrow.className&&(this._dropArrow.className="",this._dropArrowWrapper.style.display="block"),this._dropArrowImage.src=n),this.raisePropertyChanged("dropArrowImageUrl"))},get_dropArrowWidth:function(){return this._dropArrowWidth},set_dropArrowWidth:function(n){this._dropArrowWidth!=n&&(this._dropArrowWidth=n,this.get_isInitialized()&&(this._dropArrow.style.width=n),this.raisePropertyChanged("dropArrowWidth"))},get_isOver:function(){return this._isOver},get_isOpen:function(){return this._isOpen},add_showing:function(n){this.get_events().addHandler("showing",n)},remove_showing:function(n){this.get_events().removeHandler("showing",n)},raise_showing:function(n){var t=this.get_events().getHandler("showing");t&&t(this,n)},raiseShowing:function(n){Sys.Extended.Deprecated("raiseShowing(eventArgs)","raise_showing(eventArgs)");this.raise_showing(n)},add_shown:function(n){this.get_events().addHandler("shown",n)},remove_shown:function(n){this.get_events().removeHandler("shown",n)},raise_shown:function(n){var t=this.get_events().getHandler("shown");t&&t(this,n)},raiseShown:function(n){Sys.Extended.Deprecated("raiseShown(eventArgs)","raise_shown(eventArgs)");this.raise_shown(n)},add_popup:function(n){this.get_events().addHandler("popup",n)},remove_popup:function(n){this.get_events().removeHandler("popup",n)},raise_popup:function(n){var t=this.get_events().getHandler("popup");t&&t(this,n)},raisePopup:function(n){Sys.Extended.Deprecated("raisePopup(eventArgs)","raise_popup(eventArgs)");this.raise_popup(n)},add_hiding:function(n){this.get_events().addHandler("hiding",n)},remove_hiding:function(n){this.get_events().removeHandler("hiding",n)},raise_hiding:function(n){var t=this.get_events().getHandler("hiding");t&&t(this,n)},raiseHiding:function(n){Sys.Extended.Deprecated("raiseHiding(eventArgs)","raise_hiding(eventArgs)");this.raise_hiding(n)},add_hidden:function(n){this.get_events().addHandler("hidden",n)},remove_hidden:function(n){this.get_events().removeHandler("hidden",n)},raise_hidden:function(n){var t=this.get_events().getHandler("hidden");t&&t(this,n)},raiseHidden:function(n){Sys.Extended.Deprecated("raiseHidden(eventArgs)","raise_hidden(eventArgs)");this.raise_hidden(n)},add_hoverOver:function(n){this.get_events().addHandler("hoverOver",n)},remove_hoverOver:function(n){this.get_events().removeHandler("hoverOver",n)},raise_hoverOver:function(n){var t=this.get_events().getHandler("hoverOver");t&&t(this,n)},raiseHoverOver:function(n){Sys.Extended.Deprecated("raiseHoverOver(eventArgs)","raise_hoverOver(eventArgs)");this.raise_hoverOver(n)},add_hoverOut:function(n){this.get_events().addHandler("hoverOut",n)},remove_hoverOut:function(n){this.get_events().removeHandler("hoverOut",n)},raise_hoverOut:function(n){var t=this.get_events().getHandler("hoverOut");t&&t(this,n)},raiseHoverOut:function(n){Sys.Extended.Deprecated("raiseHoverOut(eventArgs)","raise_hoverOut(eventArgs)");this.raise_hoverOut(n)}};Sys.Extended.UI.DropDownBehavior.registerClass("Sys.Extended.UI.DropDownBehavior",Sys.Extended.UI.DynamicPopulateBehaviorBase);