1ASPx.IS(function(ASPx, dx, DevExpress){ 2(function() { 3var CheckingScriptObjectCommand = ASPx.CreateClass(null, { 4 constructor: function(scriptName, markerObjectName) { 5 this.scriptName = scriptName; 6 this.markerObjectName = markerObjectName; 7 this.isExisted = false; 8 }, 9 Run: function() { 10 var markerObj = this.GetMarkerObject(); 11 this.isExisted = !!markerObj; 12 if(this.isExisted) 13 markerObj.DXPatched = true; 14 }, 15 GetErrorMessage: function() { 16 return this.GetErrorMessageCore(true); 17 }, 18 GetErrorMessageCore: function(isScriptRequired){ 19 var markerObj = this.GetMarkerObject(); 20 if(this.isExisted && markerObj && markerObj.DXPatched || !isScriptRequired && !markerObj) 21 return null; 22 if(isScriptRequired && !this.GetMarkerObject()){ 23 if(this.isExisted) 24 return this.scriptName + " script was attached but has been overridden."; 25 else 26 return this.scriptName + " script was not attached."; 27 } 28 if(!this.isExisted) 29 return this.scriptName + " script was attached after DevExpress scripts."; 30 return this.scriptName + " script was attached multiple times and mixed up with DevExpress scripts."; 31 }, 32 GetMarkerObject: function() { 33 return ASPx.GetGlobalObject(this.markerObjectName); 34 } 35}); 36var PatchScriptCommand = ASPx.CreateClass(CheckingScriptObjectCommand, { 37 constructor: function(scriptName, markerObjectName, patchMethod, required) { 38 this.constructor.prototype.constructor.call(this, scriptName, markerObjectName); 39 this.required = required; 40 this.patchMethod = patchMethod; 41 }, 42 Run: function() { 43 CheckingScriptObjectCommand.prototype.Run.call(this); 44 if(this.isExisted) 45 this.patchMethod(); 46 }, 47 GetErrorMessage: function() { 48 return this.GetErrorMessageCore(this.required); 49 } 50});
51var ExternalScriptProcessor = ASPx.CreateClass(null, { 52 constructor: function() { 53 this.commands = {}; 54 }, 55 Process: function(scriptName, markerObjectName, patchMethod, required) { 56 var newCommand = this.CreateCommand(scriptName, markerObjectName, patchMethod, !!required); 57 var oldCommand = this.commands[markerObjectName]; 58 if(oldCommand) { 59 if(!oldCommand.patchMethod && !newCommand.patchMethod) 60 newCommand = null; 61 else if(newCommand.patchMethod && (!oldCommand.patchMethod || oldCommand.required)) 62 newCommand.required = true; 63 else if(oldCommand.patchMethod && !newCommand.patchMethod) { 64 oldCommand.required = true; 65 newCommand = null; 66 } 67 } 68 if(newCommand) { 69 this.commands[markerObjectName] = newCommand; 70 newCommand.Run(); 71 } 72 }, 73 CreateCommand: function(scriptName, markerObjectName, patchMethod, required) { 74 if(patchMethod) 75 return new PatchScriptCommand(scriptName, markerObjectName, patchMethod, required); 76 return new CheckingScriptObjectCommand(scriptName, markerObjectName); 77 }, 78 ShowErrorMessages: function() { 79 var messages = this.GetErrorMessages(); 80 var console = window.console; 81 if(!messages.length || !console || !ASPx.IsFunction(console.error)) 82 return; 83 for(var i = 0; i < messages.length; i++) { 84 console.error(messages[i]); 85 } 86 ASPx.ShowKBErrorMessage("Please check the correctness of script registration on the page. For details, see ", "T272309"); 87 }, 88 GetErrorMessages: function() { 89 var messages = []; 90 for (var key in this.commands) { 91 if (this.commands.hasOwnProperty(key)) { 92 var message = this.commands[key].GetErrorMessage(); 93 if (message) 94 messages.push(message); 95 } 96 } 97 return messages; 98 } 99}); 100ExternalScriptProcessor.Instance = null; 101ExternalScriptProcessor.getInstance = function() { 102 if(!ExternalScriptProcessor.Instance) 103 ExternalScriptProcessor.Instance = new ExternalScriptProcessor(); 104 return ExternalScriptProcessor.Instance; 105}; 106ASPx.ExternalScriptProcessor = ExternalScriptProcessor; 107})(); 108(function module(ASPx) { 109ASPx.modules.Controls = module; 110var ASPxClientBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 111 constructor: function(command){ 112 this.constructor.prototype.constructor.call(this); 113 this.command = command; 114 } 115}); 116var ASPxClientGlobalBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientBeginCallbackEventArgs, { 117 constructor: function(control, command){ 118 this.constructor.prototype.constructor.call(this, command); 119 this.control = control; 120 } 121}); 122var ASPxClientEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 123 constructor: function(command){ 124 this.constructor.prototype.constructor.call(this); 125 this.command = command; 126 } 127}); 128var ASPxClientGlobalEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEndCallbackEventArgs, { 129 constructor: function(control){ 130 this.constructor.prototype.constructor.call(this); 131 this.control = control; 132 } 133}); 134var ASPxClientCustomDataCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 135 constructor: function(result) { 136 this.constructor.prototype.constructor.call(this); 137 this.result = result; 138 } 139}); 140var ASPxClientCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 141 constructor: function (message, callbackId) { 142 this.constructor.prototype.constructor.call(this); 143 this.message = message; 144 this.handled = false; 145 this.callbackId = callbackId; 146 } 147}); 148var ASPxClientGlobalCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientCallbackErrorEventArgs, { 149 constructor: function (control, message, callbackId) { 150 this.constructor.prototype.constructor.call(this, message, callbackId); 151 this.control = control; 152 } 153}); 154var ASPxClientValidationCompletedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 155 constructor: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) { 156 this.constructor.prototype.constructor.call(this); 157 this.container = container; 158 this.validationGroup = validationGroup; 159 this.invisibleControlsValidated = invisibleControlsValidated; 160 this.isValid = isValid; 161 this.firstInvalidControl = firstInvalidControl;
162 this.firstVisibleInvalidControl = firstVisibleInvalidControl; 163 } 164}); 165var ASPxClientControlsInitializedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 166 constructor: function(isCallback) { 167 this.isCallback = isCallback; 168 } 169}); 170var ASPxClientControlBeforePronounceEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 171 constructor: function(messageParts, control){ 172 this.constructor.prototype.constructor.call(this); 173 this.messageParts = messageParts; 174 this.control = control; 175 } 176}); 177var ASPxClientControlUnloadEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 178 constructor: function(control){ 179 this.constructor.prototype.constructor.call(this); 180 this.control = control; 181 } 182}); 183var ASPxClientEndFocusEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 184 constructor: function(item) { 185 this.constructor.prototype.constructor.call(this); 186 this.item = item; 187 } 188}); 189var ASPxClientItemFocusedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 190 constructor: function(item) { 191 this.constructor.prototype.constructor.call(this); 192 this.item = item; 193 } 194}); 195var BeforeInitCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 196 constructor: function(callbackOwnerID){ 197 this.constructor.prototype.constructor.call(this); 198 this.callbackOwnerID = callbackOwnerID; 199 } 200}); 201var ASPxClientBrowserWindowResizedInternalEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 202 constructor: function(eventInfo) { 203 this.constructor.prototype.constructor.call(this); 204 this.htmlEvent = eventInfo.htmlEvent; 205 this.windowClientWidth = eventInfo.wndWidth; 206 this.windowClientHeigth = eventInfo.wndHeight; 207 this.previousWindowClientWidth = eventInfo.prevWndWidth; 208 this.previousWindowClientHeight = eventInfo.prevWndHeight; 209 this.virtualKeyboardShownOnAndroid = eventInfo.virtualKeyboardShownOnAndroid; 210 } 211}); 212ASPx.createControl = function(type, name, windowName, properties, events, setupMethod, data){ 213 var globalName = windowName && windowName.length > 0 ? windowName : name; 214 var dxo = new type(name); 215 var haveWrapper = ASPx.Platform === "NETCORE" && dxo.createWrapper && !DevExpress.AspNetCore.Internal.BackwardCompatibility.useLegacyClientAPI; 216 if(haveWrapper) { 217 window[globalName] = dxo.createWrapper(); 218 dxo.aspNetCoreWrapperInstance = window[globalName]; 219 } 220 else 221 dxo.InitGlobalVariable(globalName); 222 if(properties) 223 dxo.SetProperties(properties); 224 if(events) 225 dxo.SetEvents(events); 226 if(setupMethod) 227 setupMethod.call(dxo); 228 if(data) 229 dxo.SetData(data); 230 dxo.AfterCreate(); 231}; 232var ASPxClientControlBase = ASPx.CreateClass(null, { 233 constructor: function(name){ 234 this.name = name; 235 this.uniqueID = name; 236 this.globalName = name; 237 this.stateObject = null; 238 this.needEncodeState = true; 239 this.encodeHtml = true; 240 this.enabled = true; 241 this.clientEnabled = true; 242 this.savedClientEnabled = true; 243 this.clientVisible = true; 244 this.accessibilityCompliant = false; 245 this.parseJSPropertiesOnCallbackError = false; 246 this.autoPostBack = false; 247 this.allowMultipleCallbacks = true; 248 this.callBack = null; 249 this.enableCallbackAnimation = false; 250 this.enableSlideCallbackAnimation = false; 251 this.slideAnimationDirection = null;
252 this.beginCallbackAnimationProcessing = false; 253 this.endCallbackAnimationProcessing = false; 254 this.savedCallbackResult = null; 255 this.savedCallbacks = null; 256 this.isCallbackAnimationPrevented = false; 257 this.lpDelay = 300; 258 this.lpTimer = -1; 259 this.requestCount = 0; 260 this.enableSwipeGestures = false; 261 this.disableSwipeGestures = false; 262 this.supportGestures = false; 263 this.repeatedGestureValue = 0; 264 this.repeatedGestureCount = 0; 265 this.isInitialized = false; 266 this.initialFocused = false; 267 this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.None; 268 this.serverEvents = []; 269 this.loadingPanelElement = null; 270 this.loadingDivElement = null; 271 this.hasPhantomLoadingElements = false; 272 this.mainElement = null; 273 this.touchUIMouseScroller = null; 274 this.hiddenFields = {}; 275 this.scPrefix = "dx"; 276 this.callbackHandlersQueue = new ASPx.ControlCallbackHandlersQueue(this); 277 this.callbackCommand = {}; 278 this.currentCallbackID = -1; 279 this.InitializeIntersectionObserversManager(); 280 this.Init = new ASPxClientEvent(); 281 this.BeginCallback = new ASPxClientEvent(); 282 this.EndCallback = new ASPxClientEvent(); 283 this.EndCallbackAnimationStart = new ASPxClientEvent(); 284 this.CallbackError = new ASPxClientEvent(); 285 this.CustomDataCallback = new ASPxClientEvent(); 286 this.BeforePronounce = new ASPxClientEvent(); 287 this.Unload = new ASPxClientEvent(); 288 this.Disposed = new ASPxClientEvent(); 289 aspxGetControlCollection().Add(this); 290 }, 291 Initialize: function() { 292 if(this.callBack != null) 293 this.InitializeCallBackData(); 294 if (this.useCallbackQueue()) 295 this.callbackQueueHelper = new ASPx.ControlCallbackQueueHelper(this); 296 ASPx.AccessibilityUtils.createAccessibleBackgrounds(this); 297 if(this.accessibilityCompliant) 298 ASPx.AccessibilityPronouncer.EnsureInitialize(); 299 }, 300 FinalizeInitialization: function() { }, 301 InlineInitialize: function() { 302 this.savedClientEnabled = this.clientEnabled; 303 }, 304 InitializeGestures: function() { 305 if(this.isSwipeGesturesEnabled() && this.supportGestures) { 306 ASPx.GesturesHelper.AddSwipeGestureHandler(this.name, 307 function() { return this.GetCallbackAnimationElement(); }.aspxBind(this), 308 function(evt) { return this.CanHandleGestureCore(evt); }.aspxBind(this), 309 function(value) { return this.AllowStartGesture(value); }.aspxBind(this), 310 function(value) { return this.StartGesture(); }.aspxBind(this), 311 function(value) { return this.AllowExecuteGesture(value); }.aspxBind(this), 312 function(value) { this.ExecuteGesture(value); }.aspxBind(this), 313 function(value) { this.CancelGesture(value); }.aspxBind(this), 314 this.GetDefaultanimationEngineType(), 315 this.rtl 316 ); 317 if(ASPx.Browser.MSTouchUI) 318 this.touchUIMouseScroller = ASPx.MouseScroller.Create( 319 function() { return this.GetCallbackAnimationElement(); }.aspxBind(this), 320 function() { return null; }, 321 function() { return this.GetCallbackAnimationElement(); }.aspxBind(this), 322 function(element) { return this.NeedPreventTouchUIMouseScrolling(element); }.aspxBind(this), 323 true 324 ); 325 } 326 }, 327 isSwipeGesturesEnabled: function() { 328 return !this.disableSwipeGestures && (this.enableSwipeGestures || ASPx.Browser.TouchUI); 329 }, 330 isSlideCallbackAnimationEnabled: function() { 331 return this.enableSlideCallbackAnimation || this.isSwipeGesturesEnabled(); 332 }, 333 InitGlobalVariable: function(varName){ 334 if(!window) return; 335 this.globalName = varName; 336 window[varName] = this; 337 }, 338 SetElementDisplay: function(element, value, checkCurrentStyle, makeInline) { 339 ASPx.SetElementDisplay(element, value, checkCurrentStyle, makeInline); 340 }, 341 SetProperties: function(properties, obj){ 342 if(!obj) obj = this; 343 var isAspNetCoreWrapperInstanceExist = !!obj.aspNetCoreWrapperInstance; 344 for(var name in properties){ 345 if(!properties.hasOwnProperty(name)) continue; 346 obj[name] = properties[name]; 347 if(isAspNetCoreWrapperInstanceExist && name.indexOf("cp") === 0) 348 obj.aspNetCoreWrapperInstance[name] = properties[name]; 349 } 350 }, 351 SetEvents: function(events, obj){ 352 if(!obj) obj = this; 353 for(var name in events){ 354 if(events.hasOwnProperty(name) && obj[name] && obj[name].AddHandler) 355 obj[name].AddHandler(events[name]); 356 } 357 }, 358 SetData: function(data){ 359 }, 360 useCallbackQueue: function(){ 361 return false; 362 }, 363 NeedPreventTouchUIMouseScrolling: function(element) { 364 return false; 365 }, 366 InitializeFocus: function() { 367 if(this.initialFocused && this.IsVisible()) { 368 if(ASPxClientUtils.iOSPlatform || ASPxClientUtils.androidPlatform) 369 setTimeout(function() { this.Focus(); }.bind(this), ASPx.FOCUS_TIMEOUT); 370 else 371 this.Focus(); 372 } 373 }, 374 AfterCreate: function() { 375 this.AddDefaultStateControllerItems();
376 this.InlineInitialize(); 377 this.InitializeGestures(); 378 }, 379 AfterInitialize: function() { 380 this.initializeAriaDescriptor(); 381 this.InitializeFocus(); 382 this.isInitialized = true; 383 this.RaiseInit(); 384 if(this.savedCallbacks) { 385 for(var i = 0; i < this.savedCallbacks.length; i++) 386 this.CreateCallbackInternal(this.savedCallbacks[i].arg, this.savedCallbacks[i].command, 387 false, this.savedCallbacks[i].callbackInfo); 388 this.savedCallbacks = null; 389 } 390 }, 391 InitializeCallBackData: function() { 392 }, 393 AtlasPreInitialize: function() { 394 }, 395 AtlasInitialize: function() { 396 }, 397 IsDOMDisposed: function() { 398 return !ASPx.IsExistsElement(this.GetMainElement()); 399 }, 400 initializeAriaDescriptor: function() { 401 if(this.ariaDescription) { 402 var descriptionObject = ASPx.Json.Eval(this.ariaDescription); 403 if(descriptionObject) { 404 this.ariaDescriptor = new AriaDescriptor(this, descriptionObject); 405 this.applyAccessibilityAttributes(this.ariaDescriptor); 406 } 407 } 408 }, 409 applyAccessibilityAttributes: function() { }, 410 setAriaDescription: function(selector, argsList) { 411 if(this.ariaDescriptor) 412 this.ariaDescriptor.setDescription(selector, argsList || [[]]); 413 }, 414 allowRestoreFocusOnCallbacks: function(){ 415 return this.accessibilityCompliant; 416 }, 417 HtmlEncode: function(text) { 418 return this.encodeHtml ? ASPx.Str.EncodeHtml(text) : text; 419 }, 420 IsServerEventAssigned: function(eventName){ 421 return ASPx.Data.ArrayIndexOf(this.serverEvents, eventName) >= 0; 422 }, 423 OnPost: function(args){ 424 this.SerializeStateHiddenField(); 425 }, 426 SerializeStateHiddenField: function() { 427 this.UpdateStateObject(); 428 if(this.stateObject != null) 429 this.UpdateStateHiddenField(); 430 }, 431 OnPostFinalization: function(args){ 432 }, 433 UpdateStateObject: function(){ 434 }, 435 UpdateStateObjectWithObject: function(obj){ 436 if(!obj) return; 437 if(!this.stateObject) 438 this.stateObject = { }; 439 for(var key in obj) 440 if(obj.hasOwnProperty(key)) 441 this.stateObject[key] = obj[key]; 442 }, 443 UpdateStateHiddenField: function() { 444 var stateHiddenField = this.GetStateHiddenField(); 445 if(stateHiddenField) { 446 var stateObjectStr = ASPx.Json.ToJson(this.stateObject, !this.needEncodeState); 447 stateHiddenField.value = this.needEncodeState ? ASPx.Str.EncodeHtml(stateObjectStr) : stateObjectStr; 448 } 449 }, 450 GetStateHiddenField: function() { 451 return this.GetHiddenField(this.GetStateHiddenFieldName(), this.GetStateHiddenFieldID(), 452 this.GetStateHiddenFieldParent(), this.GetStateHiddenFieldOrigin()); 453 }, 454 GetStateHiddenFieldName: function() { 455 return this.uniqueID; 456 }, 457 GetStateHiddenFieldID: function() { 458 return this.name + "_State"; 459 }, 460 GetStateHiddenFieldOrigin: function() { 461 return this.GetMainElement(); 462 }, 463 GetStateHiddenFieldParent: function() { 464 var element = this.GetStateHiddenFieldOrigin(); 465 return element ? element.parentNode : null; 466 }, 467 GetHiddenField: function(name, id, parent, beforeElement) { 468 var hiddenField = this.hiddenFields[id]; 469 if(!hiddenField || !ASPx.IsValidElement(hiddenField)) { 470 if(parent) { 471 var existingHiddenField = ASPx.GetElementById(this.GetStateHiddenFieldID()); 472 this.hiddenFields[id] = hiddenField = existingHiddenField || ASPx.CreateHiddenField(name, id); 473 if(existingHiddenField) 474 return existingHiddenField; 475 if(beforeElement) 476 parent.insertBefore(hiddenField, beforeElement); 477 else 478 parent.appendChild(hiddenField); 479 } 480 } 481 return hiddenField; 482 }, 483 GetChildElement: function(idPostfix){ 484 var mainElement = this.GetMainElement(); 485 if(idPostfix.charAt && idPostfix.charAt(0) !== "_") 486 idPostfix = "_" + idPostfix; 487 return mainElement ? ASPx.CacheHelper.GetCachedChildById(this, mainElement, this.name + idPostfix) : null; 488 }, 489 getChildControl: function(idPostfix) { 490 var result = null; 491 var childControlId = this.getChildControlUniqueID(idPostfix); 492 ASPx.GetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) { 493 if(control.uniqueID == childControlId) 494 result = control; 495 }); 496 return result; 497 }, 498 getChildControlUniqueID: function(idPostfix) { 499 idPostfix = idPostfix.split("_").join("$"); 500 if(idPostfix.charAt && idPostfix.charAt(0) !== "$") 501 idPostfix = "$" + idPostfix; 502 return this.uniqueID + idPostfix; 503 }, 504 getInnerControl: function(idPostfix) { 505 var name = this.name + idPostfix; 506 var result = window[name]; 507 return result && Ident.IsASPxClientControl(result) 508 ? result 509 : null; 510 }, 511 GetParentForm: function(){ 512 return ASPx.GetParentByTagName(this.GetMainElement(), "FORM"); 513 }, 514 GetMainElement: function(){ 515 if(!ASPx.IsExistsElement(this.mainElement)) 516 this.mainElement = ASPx.GetElementById(this.GetMainElementId()); 517 return this.mainElement; 518 }, 519 GetMainElementId: function() { 520 return this.name; 521 }, 522 IsLoadingContainerVisible: function(){ 523 return this.IsVisible(); 524 }, 525 GetLoadingPanelElement: function(){ 526 return ASPx.GetElementById(this.name + "_LP"); 527 }, 528 GetClonedLoadingPanel: function(){ 529 return document.getElementById(this.GetLoadingPanelElement().id + "V"); 530 }, 531 CloneLoadingPanel: function(element, parent) { 532 var clone = element.cloneNode(true);
533 clone.id = element.id + "V"; 534 parent.appendChild(clone); 535 return clone; 536 }, 537 CreateLoadingPanelWithoutBordersInsideContainer: function(container) { 538 var loadingPanel = this.CreateLoadingPanelInsideContainer(container, false, true, true); 539 var contentStyle = ASPx.GetCurrentStyle(container); 540 if(!loadingPanel || !contentStyle) 541 return; 542 var elements = [ ]; 543 var table = (loadingPanel.tagName == "TABLE") ? loadingPanel : ASPx.GetNodeByTagName(loadingPanel, "TABLE", 0); 544 if(table != null) 545 elements.push(table); 546 else 547 elements.push(loadingPanel); 548 var cells = ASPx.GetNodesByTagName(loadingPanel, "TD"); 549 if(!cells) cells = [ ]; 550 for(var i = 0; i < cells.length; i++) 551 elements.push(cells[i]); 552 for(var i = 0; i < elements.length; i++) { 553 var el = elements[i]; 554 el.style.backgroundColor = contentStyle.backgroundColor; 555 ASPx.RemoveBordersAndShadows(el); 556 } 557 }, 558 CreateLoadingPanelInsideContainer: function(parentElement, hideContent, collapseHeight, collapseWidth) { 559 if(this.ShouldHideExistingLoadingElements()) 560 this.HideLoadingPanel(); 561 if(parentElement == null) 562 return null; 563 if(!this.IsLoadingContainerVisible()) { 564 this.hasPhantomLoadingElements = true; 565 return null; 566 } 567 var element = this.GetLoadingPanelElement(); 568 if(element != null){ 569 var width = collapseWidth ? 0 : ASPx.GetClearClientWidth(parentElement); 570 var height = collapseHeight ? 0 : ASPx.GetClearClientHeight(parentElement); 571 if(hideContent){ 572 for(var i = parentElement.childNodes.length - 1; i > -1; i--){ 573 if(parentElement.childNodes[i].style) 574 parentElement.childNodes[i].style.display = "none"; 575 else if(parentElement.childNodes[i].nodeType == 3) 576 parentElement.removeChild(parentElement.childNodes[i]); 577 } 578 } 579 else 580 parentElement.innerHTML = ""; 581 var table = document.createElement("TABLE"); 582 parentElement.appendChild(table); 583 table.border = 0; 584 table.cellPadding = 0; 585 table.cellSpacing = 0; 586 ASPx.SetStyles(table, { 587 width: (width > 0) ? width : "100%", 588 height: (height > 0) ? height : "100%" 589 }); 590 var tbody = document.createElement("TBODY"); 591 table.appendChild(tbody); 592 var tr = document.createElement("TR"); 593 tbody.appendChild(tr); 594 var td = document.createElement("TD"); 595 tr.appendChild(td); 596 td.align = "center"; 597 td.vAlign = "middle"; 598 element = this.CloneLoadingPanel(element, td); 599 ASPx.SetElementDisplay(element, true); 600 this.loadingPanelElement = element; 601 return element; 602 } else 603 parentElement.innerHTML = " "; 604 return null; 605 }, 606 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement) { 607 if(this.ShouldHideExistingLoadingElements()) 608 this.HideLoadingPanel(); 609 if(parentElement == null) 610 return null; 611 if(!this.IsLoadingContainerVisible()) { 612 this.hasPhantomLoadingElements = true; 613 return null; 614 } 615 if(!offsetElement) 616 offsetElement = parentElement; 617 var element = this.GetLoadingPanelElement(); 618 if(element != null) { 619 element = this.CloneLoadingPanel(element, parentElement); 620 ASPx.SetStyles(element, { 621 position: "absolute" 622 }); 623 ASPx.SetElementDisplay(element, true); 624 ASPx.Evt.AttachEventToElement(element, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent); 625 this.SetLoadingPanelLocation(offsetElement, element); 626 this.loadingPanelElement = element; 627 return element; 628 } 629 return null; 630 }, 631 CreateLoadingPanelInline: function(parentElement, centerInParent){ 632 if(this.ShouldHideExistingLoadingElements()) 633 this.HideLoadingPanel(); 634 if(parentElement == null) 635 return null; 636 if(!this.IsLoadingContainerVisible()) { 637 this.hasPhantomLoadingElements = true; 638 return null; 639 } 640 var element = this.GetLoadingPanelElement(); 641 if(element != null) { 642 element = this.CloneLoadingPanel(element, parentElement); 643 if(centerInParent){ 644 ASPx.SetElementDisplay(element, true); 645 parentElement.style.textAlign = "center"; 646 } 647 else 648 ASPx.SetElementDisplay(element, true); 649 this.loadingPanelElement = element; 650 return element; 651 } 652 return null; 653 }, 654 ShowLoadingPanel: function() { 655 }, 656 ShowLoadingElements: function() { 657 if(this.InCallback() || this.lpTimer > -1) return; 658 this.ShowLoadingDiv();
659 if(this.IsCallbackAnimationEnabled()) 660 this.StartBeginCallbackAnimation(); 661 else 662 this.ShowLoadingElementsInternal(); 663 }, 664 ShowLoadingElementsInternal: function() { 665 if(this.lpDelay > 0 && !this.IsCallbackAnimationEnabled()) 666 this.lpTimer = window.setTimeout(function() { 667 this.ShowLoadingPanelOnTimer(); 668 }.aspxBind(this), this.lpDelay); 669 else { 670 this.RestoreLoadingDivOpacity(); 671 this.ShowLoadingPanel(); 672 } 673 }, 674 GetLoadingPanelOffsetElement: function (baseElement) { 675 if(this.IsCallbackAnimationEnabled()) { 676 var element = this.GetLoadingPanelCallbackAnimationOffsetElement(); 677 if(element) { 678 var container = typeof(ASPx.AnimationHelper) != "undefined" ? ASPx.AnimationHelper.findSlideAnimationContainer(element) : null; 679 if(container) 680 return container.parentNode.parentNode; 681 else 682 return element; 683 } 684 } 685 return baseElement; 686 }, 687 GetLoadingPanelCallbackAnimationOffsetElement: function () { 688 return this.GetCallbackAnimationElement(); 689 }, 690 IsCallbackAnimationEnabled: function () { 691 return (this.enableCallbackAnimation || this.isSlideCallbackAnimationEnabled()) && !this.isCallbackAnimationPrevented; 692 }, 693 GetDefaultanimationEngineType: function() { 694 return ASPx.AnimationEngineType.DEFAULT; 695 },
696 StartBeginCallbackAnimation: function () { 697 this.beginCallbackAnimationProcessing = true; 698 this.isCallbackFinished = false; 699 var element = this.GetCallbackAnimationElement(); 700 if (element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 701 ASPx.AnimationHelper.slideOut(element, this.slideAnimationDirection, this.FinishBeginCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl); 702 else if(element && this.enableCallbackAnimation) 703 ASPx.AnimationHelper.fadeOut(element, this.FinishBeginCallbackAnimation.aspxBind(this), null, ASPx.AnimationEngineType.JS); 704 else 705 this.FinishBeginCallbackAnimation(); 706 }, 707 CancelBeginCallbackAnimation: function() { 708 if(this.beginCallbackAnimationProcessing) { 709 this.beginCallbackAnimationProcessing = false; 710 var element = this.GetCallbackAnimationElement(); 711 ASPx.AnimationHelper.cancelAnimation(element); 712 } 713 }, 714 FinishBeginCallbackAnimation: function () { 715 this.beginCallbackAnimationProcessing = false; 716 if(!this.isCallbackFinished) 717 this.ShowLoadingElementsInternal(); 718 else { 719 this.DoCallback(this.savedCallbackResult); 720 this.savedCallbackResult = null; 721 } 722 },
723 CheckBeginCallbackAnimationInProgress: function(callbackResult) { 724 if(this.beginCallbackAnimationProcessing) { 725 this.savedCallbackResult = callbackResult; 726 this.isCallbackFinished = true; 727 return true; 728 } 729 return false; 730 }, 731 StartEndCallbackAnimation: function () { 732 this.HideLoadingPanel(); 733 this.SetInitialLoadingDivOpacity(); 734 this.RaiseEndCallbackAnimationStart(); 735 this.endCallbackAnimationProcessing = true; 736 var element = this.GetCallbackAnimationElement(); 737 if(element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 738 ASPx.AnimationHelper.slideIn(element, this.slideAnimationDirection, this.FinishEndCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl); 739 else if(element && this.enableCallbackAnimation) 740 ASPx.AnimationHelper.fadeIn(element, this.FinishEndCallbackAnimation.aspxBind(this), null, ASPx.AnimationEngineType.JS); 741 else 742 this.FinishEndCallbackAnimation(); 743 this.slideAnimationDirection = null; 744 }, 745 FinishEndCallbackAnimation: function () { 746 this.DoEndCallback(); 747 this.endCallbackAnimationProcessing = false; 748 this.CheckRepeatGesture(); 749 }, 750 CheckEndCallbackAnimationNeeded: function() { 751 if(!this.endCallbackAnimationProcessing && this.requestCount == 1) { 752 this.StartEndCallbackAnimation(); 753 return true; 754 } 755 return false; 756 }, 757 PreventCallbackAnimation: function() { 758 this.isCallbackAnimationPrevented = true; 759 }, 760 GetCallbackAnimationElement: function() { 761 return null; 762 }, 763 AssignSlideAnimationDirectionByPagerArgument: function(arg, currentPageIndex) { 764 this.slideAnimationDirection = null; 765 if(this.isSlideCallbackAnimationEnabled() && typeof(ASPx.AnimationHelper) != "undefined") { 766 if(arg == PagerCommands.Next || arg == PagerCommands.Last) 767 this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION; 768 else if(arg == PagerCommands.First || arg == PagerCommands.Prev) 769 this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION; 770 else if(!isNaN(currentPageIndex) && arg.indexOf(PagerCommands.PageNumber) == 0) { 771 var newPageIndex = parseInt(arg.substring(2)); 772 if (!isNaN(newPageIndex)) { 773 var leftDir = this.rtl ? ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION : ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION; 774 var rightDir = this.rtl ? ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION : ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION; 775 this.slideAnimationDirection = newPageIndex < currentPageIndex ? leftDir : rightDir; 776 } 777 } 778 } 779 }, 780 TryShowPhantomLoadingElements: function () { 781 if(this.hasPhantomLoadingElements && this.InCallback()) { 782 this.hasPhantomLoadingElements = false; 783 this.ShowLoadingDivAndPanel(); 784 } 785 }, 786 ShowLoadingDivAndPanel: function () { 787 this.ShowLoadingDiv(); 788 this.RestoreLoadingDivOpacity(); 789 this.ShowLoadingPanel(); 790 }, 791 HideLoadingElements: function() {
792 this.CancelBeginCallbackAnimation(); 793 this.HideLoadingPanel(); 794 this.HideLoadingDiv(); 795 }, 796 ShowLoadingPanelOnTimer: function() { 797 this.ClearLoadingPanelTimer(); 798 if(!this.IsDOMDisposed()) { 799 this.RestoreLoadingDivOpacity(); 800 this.ShowLoadingPanel(); 801 } 802 }, 803 ClearLoadingPanelTimer: function() { 804 this.lpTimer = ASPx.Timer.ClearTimer(this.lpTimer); 805 }, 806 HideLoadingPanel: function() { 807 this.ClearLoadingPanelTimer(); 808 this.hasPhantomLoadingElements = false; 809 if(ASPx.IsExistsElement(this.loadingPanelElement)) { 810 ASPx.RemoveElement(this.loadingPanelElement); 811 this.loadingPanelElement = null; 812 } 813 }, 814 SetLoadingPanelLocation: function(offsetElement, loadingPanel, x, y, offsetX, offsetY) { 815 if(!ASPx.IsExists(x) || !ASPx.IsExists(y)){ 816 var x1 = ASPx.GetAbsoluteX(offsetElement); 817 var y1 = ASPx.GetAbsoluteY(offsetElement); 818 var x2 = x1; 819 var y2 = y1; 820 if(offsetElement == document.body) { 821 x1 = 0; 822 y1 = 0; 823 x2 = ASPx.GetDocumentMaxClientWidth(); 824 y2 = ASPx.GetDocumentMaxClientHeight(); 825 } 826 else{ 827 x2 += offsetElement.offsetWidth; 828 y2 += offsetElement.offsetHeight; 829 } 830 if(x1 < ASPx.GetDocumentScrollLeft()) 831 x1 = ASPx.GetDocumentScrollLeft(); 832 if(y1 < ASPx.GetDocumentScrollTop()) 833 y1 = ASPx.GetDocumentScrollTop(); 834 if(x2 > ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth()) 835 x2 = ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth(); 836 if(y2 > ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight()) 837 y2 = ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight(); 838 x = x1 + ((x2 - x1 - loadingPanel.offsetWidth) / 2); 839 y = y1 + ((y2 - y1 - loadingPanel.offsetHeight) / 2); 840 } 841 if(ASPx.IsExists(offsetX) && ASPx.IsExists(offsetY)){ 842 x += offsetX; 843 y += offsetY; 844 } 845 x = ASPx.PrepareClientPosForElement(x, loadingPanel, true); 846 y = ASPx.PrepareClientPosForElement(y, loadingPanel, false); 847 ASPx.SetStyles(loadingPanel, { left: x, top: y }); 848 }, 849 GetLoadingDiv: function(){ 850 return ASPx.GetElementById(this.name + "_LD"); 851 }, 852 CreateLoadingDiv: function(parentElement, offsetElement){ 853 if(this.ShouldHideExistingLoadingElements()) 854 this.HideLoadingDiv(); 855 if(parentElement == null) 856 return null; 857 if(!this.IsLoadingContainerVisible()) { 858 this.hasPhantomLoadingElements = true; 859 return null; 860 } 861 if(!offsetElement) 862 offsetElement = parentElement; 863 var div = this.GetLoadingDiv(); 864 if(div != null){ 865 div = div.cloneNode(true); 866 parentElement.appendChild(div); 867 ASPx.SetElementDisplay(div, true); 868 ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseDownEventName, ASPx.Evt.PreventEvent); 869 ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseMoveEventName, ASPx.Evt.PreventEvent); 870 ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseUpEventName, ASPx.Evt.PreventEvent); 871 ASPx.Evt.AttachEventToElement(div, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent); 872 this.SetLoadingDivBounds(offsetElement, div); 873 this.loadingDivElement = div; 874 this.SetInitialLoadingDivOpacity(); 875 return div; 876 } 877 return null; 878 }, 879 SetInitialLoadingDivOpacity: function() { 880 if(!this.loadingDivElement) return; 881 ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "opacity"); 882 ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "filter"); 883 ASPx.SetElementOpacity(this.loadingDivElement, 0.01); 884 }, 885 RestoreLoadingDivOpacity: function() { 886 if(!this.loadingDivElement) return; 887 ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "opacity"); 888 ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "filter"); 889 }, 890 SetLoadingDivBounds: function(offsetElement, loadingDiv) { 891 var absX = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteX(offsetElement); 892 var absY = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteY(offsetElement); 893 ASPx.SetStyles(loadingDiv, { 894 left: ASPx.PrepareClientPosForElement(absX, loadingDiv, true), 895 top: ASPx.PrepareClientPosForElement(absY, loadingDiv, false) 896 }); 897 var width = (offsetElement == document.body) ? ASPx.GetDocumentWidth() : offsetElement.offsetWidth; 898 var height = (offsetElement == document.body) ? ASPx.GetDocumentHeight() : offsetElement.offsetHeight; 899 if(height < 0) 900 height = 0; 901 ASPx.SetStyles(loadingDiv, { width: width, height: height });
902 var correctedWidth = 2 * width - loadingDiv.offsetWidth; 903 if(correctedWidth <= 0) correctedWidth = width; 904 var correctedHeight = 2 * height - loadingDiv.offsetHeight; 905 if(correctedHeight <= 0) correctedHeight = height; 906 ASPx.SetStyles(loadingDiv, { width: correctedWidth, height: correctedHeight }); 907 }, 908 ShowLoadingDiv: function() { 909 }, 910 HideLoadingDiv: function() { 911 this.hasPhantomLoadingElements = false; 912 if(ASPx.IsExistsElement(this.loadingDivElement)){ 913 ASPx.RemoveElement(this.loadingDivElement); 914 this.loadingDivElement = null; 915 } 916 }, 917 CanHandleGesture: function(evt) { 918 return false; 919 }, 920 CanHandleGestureCore: function(evt) { 921 var source = ASPx.Evt.GetEventSource(evt); 922 if(ASPx.GetIsParent(this.loadingPanelElement, source) || ASPx.GetIsParent(this.loadingDivElement, source)) 923 return true; 924 var callbackAnimationElement = this.GetCallbackAnimationElement(); 925 if(!callbackAnimationElement) 926 return false; 927 var animationContainer = ASPx.AnimationHelper.getSlideAnimationContainer(callbackAnimationElement, false, false); 928 if(animationContainer && ASPx.GetIsParent(animationContainer, source) && !ASPx.GetIsParent(animationContainer.childNodes[0], source)) 929 return true; 930 return this.CanHandleGesture(evt); 931 }, 932 AllowStartGesture: function() {
933 return !this.beginCallbackAnimationProcessing && !this.endCallbackAnimationProcessing; 934 }, 935 StartGesture: function() { 936 }, 937 AllowExecuteGesture: function(value) { 938 return false; 939 }, 940 ExecuteGesture: function(value) { 941 }, 942 CancelGesture: function(value) { 943 if(this.repeatedGestureCount === 0) { 944 this.repeatedGestureValue = value; 945 this.repeatedGestureCount = 1; 946 } 947 else { 948 if(this.repeatedGestureValue * value > 0) 949 this.repeatedGestureCount++; 950 else 951 this.repeatedGestureCount--; 952 if(this.repeatedGestureCount === 0) 953 this.repeatedGestureCount = 0; 954 } 955 }, 956 CheckRepeatGesture: function() { 957 if(this.repeatedGestureCount !== 0) { 958 if(this.AllowExecuteGesture(this.repeatedGestureValue)) 959 this.ExecuteGesture(this.repeatedGestureValue, this.repeatedGestureCount); 960 this.repeatedGestureValue = 0; 961 this.repeatedGestureCount = 0; 962 } 963 }, 964 AllowExecutePagerGesture: function (pageIndex, pageCount, value) { 965 if(pageIndex < 0) return false; 966 if(pageCount <= 1) return false; 967 if(value > 0 && pageIndex === 0) return false; 968 if(value < 0 && pageIndex === pageCount - 1) return false; 969 return true; 970 }, 971 ExecutePagerGesture: function(pageIndex, pageCount, value, count, method) { 972 if(!count) count = 1; 973 var pageIndex = pageIndex + (value < 0 ? count : -count); 974 if(pageIndex < 0) pageIndex = 0; 975 if(pageIndex > pageCount - 1) pageIndex = pageCount - 1; 976 method(PagerCommands.PageNumber + pageIndex); 977 }, 978 RaiseInit: function(){ 979 if(!this.Init.IsEmpty()){ 980 var args = new ASPxClientEventArgs(); 981 this.Init.FireEvent(this, args); 982 } 983 }, 984 RaiseBeginCallbackInternal: function(command){ 985 if(!this.BeginCallback.IsEmpty()){ 986 var args = new ASPxClientBeginCallbackEventArgs(command); 987 this.BeginCallback.FireEvent(this, args); 988 } 989 }, 990 RaiseEndCallbackInternal: function(command) { 991 if(!this.EndCallback.IsEmpty()){ 992 var args = new ASPxClientEndCallbackEventArgs(command); 993 this.EndCallback.FireEvent(this, args); 994 } 995 }, 996 RaiseCallbackErrorInternal: function(message, callbackId) { 997 if(!this.CallbackError.IsEmpty()) { 998 var args = new ASPxClientCallbackErrorEventArgs(message, callbackId); 999 this.CallbackError.FireEvent(this, args); 1000 if(args.handled) 1001 return { isHandled: true, errorMessage: args.message }; 1002 } 1003 }, 1004 RaiseBeginCallback: function(command){ 1005 this.RaiseBeginCallbackInternal(command); 1006 aspxGetControlCollection().RaiseBeginCallback(this, command); 1007 }, 1008 RaiseEndCallback: function(command){ 1009 this.RaiseEndCallbackInternal(command); 1010 aspxGetControlCollection().RaiseEndCallback(this, command); 1011 }, 1012 RaiseCallbackError: function (message, callbackId) { 1013 var result = this.RaiseCallbackErrorInternal(message, callbackId); 1014 if(!result) 1015 result = aspxGetControlCollection().RaiseCallbackError(this, message, callbackId); 1016 return result; 1017 }, 1018 RaiseEndCallbackAnimationStart: function(){ 1019 if(!this.EndCallbackAnimationStart.IsEmpty()){ 1020 var args = new ASPxClientEventArgs(); 1021 this.EndCallbackAnimationStart.FireEvent(this, args); 1022 } 1023 }, 1024 RaiseBeforePronounce: function(message) { 1025 var args = new ASPxClientControlBeforePronounceEventArgs(message, this); 1026 if(!this.BeforePronounce.IsEmpty()) 1027 this.BeforePronounce.FireEvent(this, args); 1028 return args; 1029 }, 1030 RaiseUnload: function() { 1031 var args = new ASPxClientControlUnloadEventArgs(this); 1032 if(!this.Unload.IsEmpty()) 1033 this.Unload.FireEvent(this, args); 1034 }, 1035 RaiseDisposed: function() { 1036 this.Disposed.FireEvent(this, new ASPxClientEventArgs(this)); 1037 }, 1038 SendMessageToAssistiveTechnology: function(message) { 1039 if(!this.accessibilityCompliant) 1040 return; 1041 this.PronounceMessageInternal(message, ASPx.AccessibilityPronouncerType.live); 1042 }, 1043 PronounceMessageInternal: function(messageArg, type) { 1044 var message = messageArg; 1045 if(!ASPx.Ident.IsArray(messageArg)) 1046 message = [messageArg]; 1047 var args = this.RaiseBeforePronounce(message); 1048 ASPx.AccessibilityPronouncer.Pronounce(args, type); 1049 }, 1050 IsVisible: function() { 1051 var element = this.GetMainElement(); 1052 return ASPx.IsElementVisible(element); 1053 }, 1054 IsDisplayedElement: function(element) { 1055 while(element && element.tagName != "BODY") { 1056 if(!ASPx.GetElementDisplay(element)) 1057 return false; 1058 element = element.parentNode; 1059 } 1060 return true; 1061 }, 1062 IsDisplayed: function() { 1063 return this.IsDisplayedElement(this.GetMainElement()); 1064 }, 1065 IsHiddenElement: function(element) { 1066 return element && element.offsetWidth == 0 && element.offsetHeight == 0; 1067 }, 1068 IsHidden: function() { 1069 return this.IsHiddenElement(this.GetMainElement()); 1070 }, 1071 IsDisposed: function() { 1072 return this.disposed; 1073 }, 1074 GetParentControl: function() { 1075 var mainElement = this.getActualMainElement(); 1076 var popupPostfix = ASPx.PCWIdSuffix + "-1"; 1077 var result = null; 1078 ASPx.GetParent(mainElement, function(element) {
1079 if(element === mainElement || !element.id) 1080 return false; 1081 var controlName = element.id.replace(popupPostfix, ""); 1082 result = ASPx.GetControlCollection().Get(controlName); 1083 return !!result; 1084 }); 1085 return result; 1086 }, 1087 getActualMainElement: function() { return this.GetMainElement(); }, 1088 findParentByType: function (type) { 1089 var ctrl = this; 1090 while (ctrl) { 1091 var parent = ctrl.GetParentControl(); 1092 if (parent && parent instanceof type) 1093 return parent; 1094 ctrl = parent; 1095 } 1096 return null; 1097 }, 1098 Focus: function() { 1099 }, 1100 GetClientVisible: function(){ 1101 return this.GetVisible(); 1102 }, 1103 SetClientVisible: function(visible){ 1104 this.SetVisible(visible); 1105 }, 1106 GetVisible: function(){ 1107 return this.clientVisible; 1108 }, 1109 SetVisible: function(visible){ 1110 if(this.clientVisible != visible){ 1111 this.clientVisible = visible; 1112 ASPx.SetElementDisplay(this.GetMainElement(), visible); 1113 if(visible) { 1114 this.AdjustControl(); 1115 var mainElement = this.GetMainElement(); 1116 if(mainElement) 1117 aspxGetControlCollection().AdjustControls(mainElement); 1118 } 1119 } 1120 }, 1121 GetEnabled: function() { 1122 return this.clientEnabled; 1123 }, 1124 SetEnabled: function(enabled) { 1125 this.clientEnabled = enabled; 1126 if(ASPxClientControl.setEnabledLocked) 1127 return; 1128 else
1129 ASPxClientControl.setEnabledLocked = true; 1130 this.savedClientEnabled = enabled; 1131 aspxGetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) { 1132 if(ASPx.IsFunction(control.SetEnabled)) 1133 control.SetEnabled(enabled && control.savedClientEnabled); 1134 }); 1135 delete ASPxClientControl.setEnabledLocked; 1136 }, 1137 InCallback: function() { 1138 return this.requestCount > 0; 1139 }, 1140 DoBeginCallback: function(command) { 1141 this.RaiseBeginCallback(command || ""); 1142 aspxGetControlCollection().Before_WebForm_InitCallback(this.name); 1143 if(typeof(WebForm_InitCallback) != "undefined" && WebForm_InitCallback) { 1144 __theFormPostData = ""; 1145 __theFormPostCollection = [ ]; 1146 this.ClearPostBackEventInput("__EVENTTARGET"); 1147 this.ClearPostBackEventInput("__EVENTARGUMENT"); 1148 WebForm_InitCallback(); 1149 this.savedFormPostData = __theFormPostData; 1150 this.savedFormPostCollection = __theFormPostCollection; 1151 } 1152 }, 1153 ClearPostBackEventInput: function(id){ 1154 var element = ASPx.GetElementById(id); 1155 if(element != null) element.value = ""; 1156 }, 1157 PerformDataCallback: function(arg, handler) { 1158 this.CreateCustomDataCallback(arg, "", handler); 1159 }, 1160 sendCallbackViaQueue: function (prefix, arg, showLoadingPanel, context, handler, onBeforeSend) { 1161 if (!this.useCallbackQueue()) 1162 return false; 1163 var context = context || this; 1164 var token = this.callbackQueueHelper.sendCallback(ASPx.FormatCallbackArg(prefix, arg), context, handler || context.OnCallback, prefix, onBeforeSend); 1165 if (showLoadingPanel) 1166 this.callbackQueueHelper.showLoadingElements(); 1167 return token; 1168 }, 1169 CreateCallback: function (arg, command, handler) { 1170 var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Common, handler || null); 1171 var callbackID = this.CreateCallbackByInfo(arg, command, callbackInfo); 1172 return callbackID; 1173 }, 1174 CreateCustomDataCallback: function(arg, command, handler) { 1175 var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Data, handler); 1176 this.CreateCallbackByInfo(arg, command, callbackInfo); 1177 }, 1178 CreateCallbackByInfo: function(arg, command, callbackInfo) { 1179 if(!this.CanCreateCallback()) return; 1180 var callbackID; 1181 if(typeof(WebForm_DoCallback) != "undefined" && WebForm_DoCallback && ASPx.documentLoaded || ASPx.Platform === "NETCORE") 1182 callbackID = this.CreateCallbackInternal(arg, command, true, callbackInfo); 1183 else { 1184 if(!this.savedCallbacks) 1185 this.savedCallbacks = []; 1186 var callbackInfo = { arg: arg, command: command, callbackInfo: callbackInfo }; 1187 if(this.allowMultipleCallbacks) 1188 this.savedCallbacks.push(callbackInfo); 1189 else 1190 this.savedCallbacks[0] = callbackInfo; 1191 } 1192 return callbackID; 1193 }, 1194 CreateCallbackInternal: function(arg, command, viaTimer, callbackInfo) { 1195 var watcher = ASPx.ControlUpdateWatcher.getInstance(); 1196 if(watcher && !watcher.CanSendCallback(this, arg)) { 1197 this.CancelCallbackInternal(); 1198 return; 1199 } 1200 this.requestCount++; 1201 this.DoBeginCallback(command); 1202 if(typeof(arg) == "undefined") 1203 arg = ""; 1204 if(typeof(command) == "undefined") 1205 command = ""; 1206 var callbackID = this.SaveCallbackInfo(callbackInfo, command), 1207 customArgs = this.GetCustomCallbackArgs(); 1208 if(viaTimer) 1209 window.setTimeout(function() { this.CreateCallbackCoreWithCustomArgs(arg, command, callbackID, customArgs); }.aspxBind(this), 0); 1210 else 1211 this.CreateCallbackCoreWithCustomArgs(arg, command, callbackID, customArgs); 1212 return callbackID; 1213 }, 1214 CreateCallbackCoreWithCustomArgs: function(arg, command, callbackID, customArgs) { 1215 this.CreateCallbackCore(arg, command, callbackID); 1216 }, 1217 GetCustomCallbackArgs: function() { 1218 return {}; 1219 }, 1220 CancelCallbackInternal: function() { 1221 this.CancelCallbackCore(); 1222 this.HideLoadingElements(); 1223 }, 1224 CancelCallbackCore: function() { 1225 }, 1226 CreateCallbackCore: function(arg, command, callbackID) { 1227 var callBackMethod = this.GetCallbackMethod(command); 1228 __theFormPostData = this.savedFormPostData; 1229 __theFormPostCollection = this.savedFormPostCollection; 1230 callBackMethod.call(this, this.GetSerializedCallbackInfoByID(callbackID) + arg); 1231 }, 1232 GetCallbackMethod: function(command){ 1233 return this.callBack; 1234 }, 1235 CanCreateCallback: function() { 1236 return !this.InCallback() || (this.allowMultipleCallbacks && !this.beginCallbackA
1236nimationProcessing && !this.endCallbackAnimationProcessing); 1237 }, 1238 DoLoadCallbackScripts: function() { 1239 ASPx.ProcessScriptsAndLinks(this.name, true); 1240 }, 1241 DoEndCallback: function() { 1242 if(this.IsCallbackAnimationEnabled() && this.CheckEndCallbackAnimationNeeded()) 1243 return; 1244 this.requestCount--; 1245 if (this.requestCount < 1) 1246 this.callbackHandlersQueue.executeCallbacksHandlers(); 1247 if(this.HideLoadingPanelOnCallback() && this.requestCount < 1) 1248 this.HideLoadingElements(); 1249 if(this.isSwipeGesturesEnabled() && this.supportGestures) { 1250 ASPx.GesturesHelper.UpdateSwipeAnimationContainer(this.name); 1251 if(this.touchUIMouseScroller) 1252 this.touchUIMouseScroller.update(); 1253 } 1254 this.isCallbackAnimationPrevented = false; 1255 this.OnCallbackFinalized(); 1256 this.AssignEllipsisTooltips(); 1257 var command = this.GetCallbackCommand(); 1258 this.RaiseEndCallback(command); 1259 this.InitializeIntersectionObserversManager(); 1260 this.currentCallbackID = -1; 1261 }, 1262 DoFinalizeCallback: function() { 1263 }, 1264 OnCallbackFinalized: function() { 1265 }, 1266 AssignEllipsisTooltips: function() { }, 1267 GetCallbackCommand: function() { 1268 var result = ""; 1269 if(this.currentCallbackID != -1) { 1270 var command = this.callbackCommand[this.currentCallbackID]; 1271 if(command) 1272 result = command; 1273 } 1274 return result; 1275 }, 1276 HideLoadingPanelOnCallback: function() { 1277 return true; 1278 }, 1279 ShouldHideExistingLoadingElements: function() { 1280 return true; 1281 }, 1282 EvalCallbackResult: function(resultString) { 1283 return eval(resultString); 1284 }, 1285 ParseJSProperties: function(resultObj) { 1286 if(resultObj.cp) { 1287 for(var name in resultObj.cp) 1288 if(resultObj.cp.hasOwnProperty(name)) { 1289 this[name] = resultObj.cp[name]; 1290 if(this.aspNetCoreWrapperInstance) 1291 this.aspNetCoreWrapperInstance[name] = resultObj.cp[name]; 1292 } 1293 } 1294 }, 1295 DoCallback: function(result) { 1296 if(this.IsCallbackAnimationEnabled() && this.CheckBeginCallbackA
1296nimationInProgress(result)) 1297 return; 1298 result = ASPx.Str.Trim(result); 1299 if(result instanceof ASPx.NetworkError || result.indexOf(ASPx.CallbackResultPrefix) != 0) 1300 this.ProcessCallbackGeneralError(result, false); 1301 else { 1302 var resultObj = null; 1303 try { 1304 resultObj = this.EvalCallbackResult(result); 1305 } 1306 catch(e) { 1307 } 1308 if(resultObj) { 1309 this.currentCallbackID = resultObj.id; 1310 ASPx.CacheHelper.DropCache(this); 1311 if(resultObj.redirect) { 1312 this.ParseJSProperties(resultObj); 1313 ASPx.Url.Redirect(resultObj.redirect); 1314 } 1315 else if(ASPx.IsExists(resultObj.generalError)) { 1316 this.ProcessCallbackGeneralError(resultObj.generalError, true); 1317 } 1318 else { 1319 var errorObj = resultObj.error; 1320 if(errorObj) { 1321 if(this.parseJSPropertiesOnCallbackError) 1322 this.ParseJSProperties(resultObj); 1323 this.ProcessCallbackError(errorObj,resultObj.id); 1324 } else { 1325 this.ParseJSProperties(resultObj); 1326 var callbackInfo = this.DequeueCallbackInfo(resultObj.id); 1327 if(callbackInfo && callbackInfo.type == ASPx.CallbackType.Data) 1328 this.ProcessCustomDataCallback(resultObj.result, callbackInfo); 1329 else { 1330 if (this.useCallbackQueue() && this.callbackQueueHelper.getCallbackInfoById(resultObj.id)) 1331 this.callbackQueueHelper.processCallback(resultObj.result, resultObj.id); 1332 else { 1333 this.ProcessCallback(resultObj.result, resultObj.id); 1334 if(callbackInfo && callbackInfo.handler) { 1335 var handlerInfo = { handler: callbackInfo.handler, result: resultObj.result.data }; 1336 this.callbackHandlersQueue.addCallbackHandler(handlerInfo); 1337 } 1338 } 1339 } 1340 } 1341 } 1342 } 1343 } 1344 this.DoLoadCallbackScripts(); 1345 }, 1346 DoCallbackError: function(result) { 1347 this.HideLoadingElements(); 1348 this.ProcessCallbackGeneralError(result, false); 1349 }, 1350 DoControlClick: function(evt) { 1351 this.OnControlClick(ASPx.Evt.GetEventSource(evt), evt); 1352 }, 1353 ProcessCallback: function (result, callbackId) { 1354 this.OnCallback(result, callbackId); 1355 }, 1356 ProcessCustomDataCallback: function(result, callbackInfo) { 1357 if(callbackInfo.handler != null) 1358 callbackInfo.handler(this, result); 1359 this.RaiseCustomDataCallback(result); 1360 }, 1361 RaiseCustomDataCallback: function(result) { 1362 if(!this.CustomDataCallback.IsEmpty()) { 1363 var arg = new ASPxClientCustomDataCallbackEventArgs(result); 1364 this.CustomDataCallback.FireEvent(this, arg); 1365 } 1366 }, 1367 OnCallback: function(result) { 1368 }, 1369 CreateCallbackInfo: function(type, handler) { 1370 return { type: type, handler: handler }; 1371 }, 1372 GetSerializedCallbackInfoByID: function(callbackID) { 1373 return this.GetCallbackInfoByID(callbackID).type + callbackID + ASPx.CallbackSeparator; 1374 }, 1375 SaveCallbackInfo: function(info, command) { 1376 var callbacks = this.GetActiveCallbacksInfo(); 1377 var index = callbacks.indexOf(null); 1378 if(index === -1) 1379 index = callbacks.length; 1380 callbacks[index] = info; 1381 this.callbackCommand[index] = command; 1382 return index; 1383 }, 1384 GetActiveCallbacksInfo: function() { 1385 var persistentProperties = this.GetPersistentProperties(); 1386 if(!persistentProperties.activeCallbacks) 1387 persistentProperties.activeCallbacks = [ ]; 1388 return persistentProperties.activeCallbacks; 1389 }, 1390 GetPersistentProperties: function() { 1391 var storage = _aspxGetPersistentControlPropertiesStorage(); 1392 var persistentProperties = storage[this.name]; 1393 if(!persistentProperties) { 1394 persistentProperties = { }; 1395 storage[this.name] = persistentProperties; 1396 } 1397 return persistentProperties; 1398 }, 1399 GetCallbackInfoByID: function(callbackID) { 1400 return this.GetActiveCallbacksInfo()[callbackID]; 1401 }, 1402 DequeueCallbackInfo: function(index) { 1403 var activeCallbacksInfo = this.GetActiveCallbacksInfo(); 1404 if(index < 0 || index >= activeCallbacksInfo.length) 1405 return null; 1406 var result = activeCallbacksInfo[index]; 1407 activeCallbacksInfo[index] = null; 1408 return result; 1409 }, 1410 ProcessCallbackError: function (errorObj, callbackId) { 1411 var data = ASPx.IsExists(errorObj.data) ? errorObj.data : null; 1412 var result = this.RaiseCallbackError(errorObj.message, callbackId); 1413 if(result.isHandled) 1414 this.OnCallbackErrorAfterUserHandle(result.errorMessage, data); 1415 else 1416 this.OnCallbackError(result.errorMessage, data); 1417 }, 1418 OnCallbackError: function(errorMessage, data) { 1419 if(errorMessage) 1420 ASPx.ShowErrorAlert(errorMessage); 1421 }, 1422 OnCallbackErrorAfterUserHandle: function(errorMessage, data) { 1423 }, 1424 ProcessCallbackGeneralError: function(error, serverExceptionOnLastCallback) { 1425 this.serverExceptionOnLastCallback = serverExceptionOnLastCallback; 1426 var isNetworkError = error instanceof ASPx.NetworkError; 1427 var errorMessage = isNetworkError ? error.message : error; 1428 var result = this.RaiseCallbackError(errorMessage); 1429 if(result.isHandled) 1430 this.OnCallbackGeneralErrorAfterUserHandle(result.errorMessage); 1431 else if(isNetworkError) 1432 this.OnCallbackNetworkError(result.errorMessage); 1433 else 1434 this.OnCallbackGeneralError(result.errorMessage); 1435 }, 1436 OnCallbackGeneralError: function(errorMessage) { 1437 this.OnCallbackError(errorMessage, null); 1438 }, 1439 OnCallbackNetworkError: function(errorMessage) { 1440 console.error(errorMessage); 1441 }, 1442 OnCallbackGeneralErrorAfterUserHandle: function (errorMessage) { 1443 },
1444 SendPostBack: function(params, preventConvertToUpdatePanelCallback) { 1445 if(preventConvertToUpdatePanelCallback) 1446 this.sendMSAjaxCompatPostBack(params); 1447 else 1448 this.sendPostBackInternal(params); 1449 }, 1450 sendPostBackInternal: function(params) { 1451 if(typeof(__doPostBack) != "undefined") 1452 __doPostBack(this.uniqueID, params); 1453 else{ 1454 var form = this.GetParentForm(); 1455 if(form) form.submit(); 1456 } 1457 }, 1458 sendMSAjaxCompatPostBack: function(params) { 1459 var rm = ASPx.GetMSAjaxRequestManager(); 1460 var triggers = rm ? rm._postBackControlClientIDs : null; 1461 var needRegister = triggers && ASPx.Ident.IsArray(triggers) && ASPx.Data.ArrayIndexOf(triggers, this.name) == -1; 1462 if(needRegister) 1463 triggers.unshift(this.name); 1464 this.sendPostBackInternal(params); 1465 if(needRegister) 1466 triggers.shift(); 1467 }, 1468 IsValidInstance: function () { 1469 return aspxGetControlCollection().GetByName(this.name) === this; 1470 }, 1471 OnDispose: function() { 1472 this.RaiseDisposed(); 1473 var varName = this.globalName; 1474 if(varName && varName !== "" && window && window[varName] && window[varName] == this){ 1475 try{ 1476 delete window[varName]; 1477 } 1478 catch(e){ } 1479 } 1480 if(this.callbackQueueHelper) 1481 this.callbackQueueHelper.detachEvents(); 1482 if (!this.IsDisposed()) 1483 this.disposed = true; 1484 }, 1485 OnGlobalControlsInitialized: function(args) { 1486 }, 1487 OnGlobalBrowserWindowResized: function(args) { 1488 }, 1489 OnGlobalBeginCallback: function(args) { 1490 }, 1491 OnGlobalEndCallback: function(args) { 1492 }, 1493 OnGlobalCallbackError: function(args) { 1494 }, 1495 OnGlobalValidationCompleted: function(args) { 1496 }, 1497 AddDefaultStateControllerItems: function() { 1498 var states = this.scStates; 1499 if(!states) return; 1500 var postfix = this.scPostfix ? ("_" + this.scPostfix) : ""; 1501 var mainElementId = this.GetMainElementId(); 1502 if(states & 2) 1503 this.AddDefaultReadOnlyStateControllerItem(this.scPrefix + "ReadOnly" + postfix, mainElementId); 1504 if(states & 4) 1505 this.AddDefaultDisabledStateControllerItem(this.scPrefix + "Disabled" + postfix, mainElementId); 1506 }, 1507 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) { throw "Not implemented"; }, 1508 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) { throw "Not implemented"; }, 1509 DOMContentLoaded: function() { }, 1510 IsStateControllerEnabled: function() { return false; }, 1511 InitializeDOM: function() { 1512 var mainElement = this.GetMainElement(); 1513 if(mainElement) 1514 ASPx.SetElementInitializedFlag(mainElement); 1515 }, 1516 IsDOMInitialized: function() { 1517 var mainElement = this.GetMainElement(); 1518 return mainElement && ASPx.GetElementInitializedFlag(mainElement); 1519 }, 1520 AdjustControl: function(nestedCall) { }, 1521 OnBrowserWindowResizeInternal: function(e) { }, 1522 RegisterInControlTree: function(tree) { }, 1523 InitializeIntersectionObserversManager: function () { 1524 var elementToObserve = this.getElementToObserveVisibilityChange(); 1525 if(elementToObserve) { 1526 ASPx.IntersectionObserversManager.SubscribeElemensVisibilityChangeInBrowserWindow(elementToObserve, this.processVisibilityChanged.bind(this)); 1527 } 1528 }, 1529 getElementToObserveVisibilityChange: function () { }, 1530 processVisibilityChanged: function (visible) { } 1531}); 1532ASPxClientControlBase.Cast = function(obj) { 1533 if(typeof obj == "string") 1534 return window[obj]; 1535 return obj; 1536}; 1537var persistentControlPropertiesStorage = null; 1538function _aspxGetPersistentControlPropertiesStorage() { 1539 if(persistentControlPropertiesStorage == null) 1540 persistentControlPropertiesStorage = { }; 1541 return persistentControlPropertiesStorage; 1542} 1543var ELLIPSIS_MARKER_CLASS = "dx-ellipsis"; 1544var ELLIPSIS_TOOLTIP_MARKER_ATTR = "dxEllipsisTitle"; 1545var ASPxClientControl = ASPx.CreateClass(ASPxClientControlBase, { 1546 constructor: function(name){ 1547 this.constructor.prototype.constructor.call(this, name); 1548 this.rtl = false; 1549 this.enableEllipsis = false; 1550 this.isNative = false; 1551 this.isControlCollapsed = false; 1552 this.isInsideHierarchyAdjustment = false; 1553 this.controlOwner = null; 1554 this.adjustedSizes = { }; 1555 this.dialogContentHashTable = { }; 1556 this.renderIFrameForPopupElements = false; 1557 this.widthValueSetInPercentage = false; 1558 this.heightValueSetInPercentage = false; 1559 this.verticalAlignedElements = { }; 1560 this.wrappedTextContainers = { }; 1561 this.scrollPositionState = { }; 1562 this.sizingConfig = { 1563 allowSetWidth: true, 1564 allowSetHeight: true, 1565 correction : false, 1566 adjustControl : false, 1567 supportPercentHeight: false, 1568 supportAutoHeight: false 1569 }; 1570 this.percentSizeConfig = { 1571 width: -1, 1572 height: -1, 1573 markerWidth: -1, 1574 markerHeight: -1 1575 }; 1576 }, 1577 querySelector: function(selector) { return this.querySelectorAll(selector)[0] || null; }, 1578 querySelectorAll: function(selector) { 1579 return ASPx.CacheHelper.GetCachedElement(this, "querySelectorAll_" + selector, 1580 function() { return Array.prototype.slice.call(this.GetMainElement().querySelectorAll(selector)); }); 1581 }, 1582 createAccessKey: function (popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing) { 1583 return new ASPx.AccessKey(popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing); 1584 }, 1585 InlineInitialize: function() { 1586 this.InitializeDOM(); 1587 ASPxClientControlBase.prototype.InlineInitialize.call(this); 1588 }, 1589 AfterCreate: function() { 1590 ASPxClientControlBase.prototype.AfterCreate.call(this); 1591 if(!this.CanInitializeAdjustmentOnDOMContentLoaded() || ASPx.IsStartupScriptsRunning()) 1592 this.InitializeAdjustment(); 1593 }, 1594 DOMContentLoaded: function() { 1595 if(this.CanInitializeAdjustmentOnDOMContentLoaded()) 1596 this.InitializeAdjustment(); 1597 }, 1598 CanInitializeAdjustmentOnDOMContentLoaded: function() { 1599 return true; 1600 }, 1601 InitializeAdjustment: function() { 1602 this.UpdateAdjustmentFlags(); 1603 this.AdjustControl(); 1604 }, 1605 AfterInitialize: function() { 1606 this.AdjustControl(); 1607 ASPxClientControlBase.prototype.AfterInitialize.call(this); 1608 }, 1609 IsStateControllerEnabled: function(){ 1610 return typeof(ASPx.GetStateController) != "undefined" && ASPx.GetStateController(); 1611 }, 1612 GetWidth: function() { 1613 return this.GetMainElement().offsetWidth; 1614 }, 1615 GetHeight: function() { 1616 return this.GetMainElement().offsetHeight; 1617 }, 1618 SetWidth: function(width) { 1619 if(this.sizingConfig.allowSetWidth)
1620 this.SetSizeCore("width", width, "GetWidth", false); 1621 }, 1622 SetHeight: function(height) { 1623 if(this.sizingConfig.allowSetHeight) 1624 this.SetSizeCore("height", height, "GetHeight", false); 1625 }, 1626 SetSizeCore: function(sizePropertyName, size, getFunctionName, corrected) { 1627 if(size < 0 || !this.GetMainElement()) 1628 return; 1629 this.GetMainElement().style[sizePropertyName] = size + "px"; 1630 this.UpdateAdjustmentFlags(sizePropertyName); 1631 if(this.sizingConfig.adjustControl) 1632 this.AdjustControl(true); 1633 if(this.sizingConfig.correction && !corrected) { 1634 var realSize = this[getFunctionName](); 1635 if(realSize != size) { 1636 var correctedSize = size - (realSize - size); 1637 this.SetSizeCore(sizePropertyName, correctedSize, getFunctionName, true); 1638 } 1639 } 1640 }, 1641 AdjustControl: function(nestedCall) { 1642 if(this.IsAdjustmentRequired() && (!ASPxClientControl.adjustControlLocked || nestedCall)) { 1643 ASPxClientControl.adjustControlLocked = true; 1644 try { 1645 if(!this.IsAdjustmentAllowed()) 1646 return; 1647 this.AdjustControlCore(); 1648 this.UpdateAdjustedSizes(); 1649 } 1650 finally { 1651 delete ASPxClientControl.adjustControlLocked; 1652 } 1653 } 1654 this.AssignEllipsisTooltips(); 1655 this.TryShowPhantomLoadingElements(); 1656 }, 1657 ResetControlAdjustment: function () { 1658 this.adjustedSizes = { }; 1659 }, 1660 UpdateAdjustmentFlags: function(sizeProperty) { 1661 var mainElement = this.GetMainElement(); 1662 if(mainElement) { 1663 var mainElementStyle = ASPx.GetCurrentStyle(mainElement); 1664 this.UpdatePercentSizeConfig([mainElementStyle.width, mainElement.style.width], [mainElementStyle.height, mainElement.style.height], sizeProperty); 1665 } 1666 }, 1667 UpdatePercentSizeConfig: function(widths, heights, modifyStyleProperty) { 1668 switch(modifyStyleProperty) { 1669 case "width": 1670 this.UpdatePercentWidthConfig(widths); 1671 break; 1672 case "height": 1673 this.UpdatePercentHeightConfig(heights); 1674 break; 1675 default: 1676 this.UpdatePercentWidthConfig(widths); 1677 this.UpdatePercentHeightConfig(heights); 1678 break; 1679 } 1680 this.ResetControlPercentMarkerSize(); 1681 }, 1682 UpdatePercentWidthConfig: function(widths) { 1683 this.widthValueSetInPercentage = false; 1684 for(var i = 0; i < widths.length; i++) { 1685 if(this.IsPercentageWidth(widths[i])) { 1686 this.percentSizeConfig.width = widths[i]; 1687 this.widthValueSetInPercentage = true; 1688 break; 1689 } 1690 } 1691 }, 1692 IsPercentageWidth: function(width) { return ASPx.IsPercentageSize(width); }, 1693 UpdatePercentHeightConfig: function(heights) { 1694 this.heightValueSetInPercentage = false; 1695 for(var i = 0; i < heights.length; i++) { 1696 if(ASPx.IsPercentageSize(heights[i])) { 1697 this.percentSizeConfig.height = heights[i]; 1698 this.heightValueSetInPercentage = true; 1699 break; 1700 } 1701 } 1702 }, 1703 GetAdjustedSizes: function() { 1704 var mainElement = this.GetMainElement(); 1705 if(mainElement) 1706 return { width: mainElement.offsetWidth, height: mainElement.offsetHeight }; 1707 return { width: 0, height: 0 }; 1708 }, 1709 IsAdjusted: function() { 1710 return (this.adjustedSizes.width && this.adjustedSizes.width > 0) && (this.adjustedSizes.height && this.adjustedSizes.height > 0); 1711 }, 1712 IsAdjustmentRequired: function() { 1713 if(!this.IsAdjusted()) 1714 return true; 1715 if(this.widthValueSetInPercentage) 1716 return true; 1717 if(this.heightValueSetInPercentage) 1718 return true; 1719 var sizes = this.GetAdjustedSizes(); 1720 for(var name in sizes){ 1721 if(this.adjustedSizes[name] !== sizes[name]) 1722 return true; 1723 } 1724 return false; 1725 }, 1726 IsAdjustmentAllowed: function() { 1727 var mainElement = this.GetMainElement(); 1728 return mainElement && this.IsDisplayed() && !this.IsHidden() && this.IsDOMInitialized(); 1729 }, 1730 UpdateAdjustedSizes: function() { 1731 var sizes = this.GetAdjustedSizes(); 1732 for(var name in sizes) 1733 if(sizes.hasOwnProperty(name)) 1734 this.adjustedSizes[name] = sizes[name]; 1735 }, 1736 AdjustControlCore: function() { 1737 }, 1738 AdjustAutoHeight: function() { 1739 }, 1740 IsControlCollapsed: function() { 1741 return this.isControlCollapsed; 1742 }, 1743 NeedCollapseControl: function() { 1744 return this.NeedCollapseControlCore() && this.IsAdjustmentRequired() && this.IsAdjustmentAllowed(); 1745 }, 1746 NeedCollapseControlCore: function() { 1747 return false; 1748 }, 1749 CollapseEditor: function() { 1750 }, 1751 CollapseControl: function() { 1752 this.SaveScrollPositions(); 1753 var mainElement = this.GetMainElement(), 1754 marker = this.GetControlPercentSizeMarker(); 1755 marker.style.height = this.heightValueSetInPercentage && this.sizingConfig.supp
1755ortPercentHeight 1756 ? this.percentSizeConfig.height 1757 : (mainElement.offsetHeight + "px"); 1758 mainElement.style.display = "none"; 1759 this.isControlCollapsed = true; 1760 }, 1761 ExpandControl: function() { 1762 var mainElement = this.GetMainElement(); 1763 mainElement.style.display = ""; 1764 this.GetControlPercentSizeMarker().style.height = "0px"; 1765 this.isControlCollapsed = false; 1766 this.RestoreScrollPositions(); 1767 }, 1768 CanCauseReadjustment: function() { 1769 return this.NeedCollapseControlCore(); 1770 }, 1771 IsExpandableByAdjustment: function() { 1772 return false; 1773 }, 1774 HasFixedPosition: function() { 1775 return false; 1776 }, 1777 SaveScrollPositions: function() { 1778 var mainElement = this.GetMainElement(); 1779 this.scrollPositionState.outer = ASPx.GetOuterScrollPosition(mainElement.parentNode); 1780 this.scrollPositionState.inner = ASPx.GetInnerScrollPositions(mainElement); 1781 }, 1782 RestoreScrollPositions: function() { 1783 ASPx.RestoreOuterScrollPosition(this.scrollPositionState.outer); 1784 ASPx.RestoreInnerScrollPositions(this.scrollPositionState.inner); 1785 }, 1786 GetControlPercentSizeMarker: function() { 1787 if(this.percentSizeMarker === undefined) { 1788 this.percentSizeMarker = ASPx.CreateHtmlElementFromString("<div style='height:0px;font-size:0px;line-height:0;width:100%;'></div>"); 1789 ASPx.InsertElementAfter(this.percentSizeMarker, this.GetMainElement()); 1790 } 1791 return this.percentSizeMarker; 1792 }, 1793 KeepControlPercentSizeMarker: function(needCollapse, needCalculateHeight) { 1794 var marker = this.GetControlPercentSizeMarker(), 1795 markerHeight; 1796 if(needCollapse) 1797 this.CollapseControl(); 1798 if(this.widthValueSetInPercentage && marker.style.width !== this.percentSizeConfig.width) 1799 marker.style.width = this.percentSizeConfig.width; 1800 if(needCalculateHeight) { 1801 if(this.IsControlCollapsed()) 1802 markerHeight = marker.style.height; 1803 marker.style.height = this.percentSizeConfig.height; 1804 } 1805 this.percentSizeConfig.markerWidth = marker.offsetWidth; 1806 if(needCalculateHeight) { 1807 this.percentSizeConfig.markerHeight = marker.offsetHeight; 1808 if(this.IsControlCollapsed()) 1809 marker.style.height = markerHeight; 1810 else 1811 marker.style.height = "0px"; 1812 } 1813 if(needCollapse) 1814 this.ExpandControl(); 1815 }, 1816 ResetControlPercentMarkerSize: function() { 1817 this.percentSizeConfig.markerWidth = -1; 1818 this.percentSizeConfig.markerHeight = -1; 1819 }, 1820 GetControlPercentMarkerSize: function(hideControl, force) { 1821 var needCalculateHeight = this.heightValueSetInPercentage && this.sizingConfig.supportPercentHeight; 1822 if(force || this.percentSizeConfig.markerWidth < 1 || (needCalculateHeight && this.percentSizeConfig.markerHeight < 1)) 1823 this.KeepControlPercentSizeMarker(hideControl && !this.IsControlCollapsed(), needCalculateHeight); 1824 return { 1825 width: this.percentSizeConfig.markerWidth, 1826 height: this.percentSizeConfig.markerHeight 1827 }; 1828 }, 1829 AssignEllipsisTooltips: function() { 1830 if(this.RequireAssignTooltips()) 1831 this.AssignEllipsisTooltipsCore(); 1832 }, 1833 AssignEllipsisTooltipsCore: function(rootElement, reassingExistingTooltips) { 1834 var requirePaddingManipulation = ASPx.Browser.Edge || ASPx.Browser.Firefox; 1835 rootElement = rootElement || this.GetMainElement(); 1836 var nodes = this.GetEllipsisNodes(rootElement); 1837 var nodeInfos = []; 1838 var nodesCount = nodes.length; 1839 for(var i = 0; i < nodesCount; i++) { 1840 var node = nodes[i]; 1841 var info = { node: node }; 1842 if(requirePaddingManipulation) { 1843 var style = ASPx.GetCurrentStyle(node); 1844 info.paddingLeft = node.style.paddingLeft; 1845 info.totalPadding = ASPx.GetLeftRightPaddings(node, style); 1846 } 1847 nodeInfos.push(info); 1848 } 1849 if(requirePaddingManipulation) { 1850 for(var i = 0; i < nodesCount; i++) { 1851 var info = nodeInfos[i]; 1852 ASPx.SetStyles(info.node, { paddingLeft: info.totalPadding }, true); 1853 } 1854 } 1855 for(var i = 0; i < nodesCount; i++) { 1856 var info = nodeInfos[i]; 1857 var node = info.node; 1858 info.isTextShortened = node.scrollWidth > node.clientWidth; 1859 info.hasTitle = ASPx.Attr.GetAttribute(node, "title") !== null; 1860 if(!info.hasTitle || reassingExistingTooltips) 1861 info.title = ASPx.GetEllipsisTooltipText(node); 1862 } 1863 for(var i = 0; i < nodesCount; i++) { 1864 var info = nodeInfos[i]; 1865 var node = info.node; 1866 if(info.isTextShortened && info.title) { 1867 ASPx.Attr.SetAttribute(node, "title", info.title); 1868 ASPx.Attr.SetAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR, true); 1869 } 1870 if(!info.isTextShortened && info.hasTitle) 1871 ASPx.Attr.RemoveAttribute(node, "title"); 1872 } 1873 if(requirePaddingManipulation) { 1874 for(var i = 0; i < nodesCount; i++) { 1875 var info = nodeInfos[i]; 1876 var node = info.node; 1877 node.style.paddingLeft = info.paddingLeft; 1878 } 1879 } 1880 }, 1881 GetEllipsisNodes: function(element) { 1882 var ellipsibleNodes = ASPx.Data.CollectionToArray(ASPx.GetNodesByClassName(element, ELLIPSIS_MARKER_CLASS)); 1883 if(ASPx.ElementHasCssClass(element, ELLIPSIS_MARKER_CLASS)) 1884 ellipsibleNodes.push(element); 1885 return ellipsibleNodes.filter(function(node) { 1886 return !ASPx.Attr.IsExistsAttribute(node, "title") || ASPx.Attr.IsExistsAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR); 1887 }); 1888 }, 1889 RequireAssignTooltips: function() { 1890 return this.enableEllipsis && !ASPx.Browser.MobileUI; 1891 }, 1892 RemoveEllipsisFromNode: function(node) { 1893 ASPx.RemoveClassNameFromElement(node, ELLIPSIS_MARKER_CLASS); 1894 this.RemoveEllipsisTooltip(node); 1895 }, 1896 RemoveEllipsisTooltip: function(node) { 1897 if(ASPx.Attr.IsExistsAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR)) { 1898 ASPx.Attr.RemoveAttribute(node, "title"); 1899 ASPx.Attr.RemoveAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR); 1900 } 1901 }, 1902 OnBrowserWindowResize: function(e) { 1903 }, 1904 OnBrowserWindowResizeInternal: function(e){
1905 if(this.BrowserWindowResizeSubscriber()) 1906 this.OnBrowserWindowResize(e); 1907 }, 1908 BrowserWindowResizeSubscriber: function() { 1909 return this.widthValueSetInPercentage || !this.IsAdjusted(); 1910 }, 1911 ShrinkWrappedText: function(getElements, key, reCorrect) { 1912 if(!ASPx.Browser.Safari) return; 1913 var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers); 1914 for(var i = 0; i < elements.length; i++) 1915 this.ShrinkWrappedTextInContainer(elements[i], reCorrect); 1916 }, 1917 ShrinkWrappedTextInContainer: function(container, reCorrect) { 1918 if(!ASPx.Browser.Safari || !container || (container.dxWrappedTextShrinked && !reCorrect) || container.offsetWidth === 0) return; 1919 ASPx.ShrinkWrappedTextInContainer(container); 1920 container.dxWrappedTextShrinked = true; 1921 }, 1922 CorrectWrappedText: function(getElements, key, reCorrect) { 1923 var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers); 1924 for(var i = 0; i < elements.length; i++) 1925 this.CorrectWrappedTextInContainer(elements[i], reCorrect); 1926 }, 1927 CorrectWrappedTextInContainer: function(container, reCorrect) { 1928 if(!container || (container.dxWrappedTextCorrected && !reCorrect) || container.offsetWidth === 0) return; 1929 ASPx.AdjustWrappedTextInContainer(container); 1930 container.dxWrappedTextCorrected = true; 1931 }, 1932 CorrectVerticalAlignment: function(alignMethod, getElements, key, reAlign) { 1933 var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.verticalAlignedElements); 1934 for(var i = 0; i < elements.length; i++) 1935 this.CorrectElementVerticalAlignment(alignMethod, elements[i], reAlign); 1936 }, 1937 CorrectElementVerticalAlignment: function(alignMethod, element, reAlign) { 1938 if(!element || (element.dxVerticalAligned && !reAlign) || element.offsetHeight === 0) return; 1939 alignMethod(element); 1940 element.dxVerticalAligned = true; 1941 }, 1942 ClearVerticalAlignedElementsCache: function() { 1943 ASPx.CacheHelper.DropCache(this.verticalAlignedElements); 1944 }, 1945 ClearWrappedTextContainersCache: function() { 1946 ASPx.CacheHelper.DropCache(this.wrappedTextContainers); 1947 }, 1948 AdjustPagerControls: function() { 1949 if(typeof(ASPx.GetPagersCollection) != "undefined") 1950 ASPx.GetPagersCollection().AdjustControls(this.GetMainElement()); 1951 }, 1952 RegisterInControlTree: function(tree) { 1953 var mainElement = this.GetMainElement(); 1954 if(mainElement && mainElement.id) 1955 tree.createNode(mainElement.id, this); 1956 }, 1957 GetItemElementName: function(element) { 1958 var name = ""; 1959 if(element.id) 1960 name = element.id.substring(this.name.length + 1); 1961 return name; 1962 }, 1963 GetLinkElement: function(element) { 1964 if(element == null) return null; 1965 return (element.tagName == "A") ? element : ASPx.GetNodeByTagName(element, "A", 0); 1966 }, 1967 GetInternalHyperlinkElement: function(parentElement, index) { 1968 var element = ASPx.GetNodeByTagName(parentElement, "A", index); 1969 if(element == null) 1970 element = ASPx.GetNodeByTagName(parentElement, "SPAN", index); 1971 return element; 1972 }, 1973 OnControlClick: function(clickedElement, htmlEvent) { 1974 } 1975}); 1976ASPxClientControl.Cast = function(obj) { 1977 if(typeof obj == "string") 1978 return window[obj]; 1979 return obj; 1980}; 1981ASPxClientControl.AdjustControls = function(container, collapseControls){ 1982 aspxGetControlCollection().AdjustControls(container, collapseControls); 1983}; 1984ASPxClientControl.GetControlCollection = function(){ 1985 return aspxGetControlCollection(); 1986}; 1987ASPxClientControl.LeadingAfterInitCallConsts = { 1988 None: 0, 1989 Direct: 1, 1990 Reverse: 2 1991}; 1992var ASPxClientComponent = ASPx.CreateClass(ASPxClientControl, { 1993 constructor: function (name) { 1994 this.constructor.prototype.constructor.call(this, name); 1995 }, 1996 IsDOMDisposed: function() { 1997 return false; 1998 } 1999}); 2000var ASPxClientControlCollection = ASPx.CreateClass(ASPx.CollectionBase, { 2001 constructor: function(){ 2002 this.constructor.prototype.constructor.call(this); 2003 this.prevWndWidth = ""; 2004 this.prevWndHeight = ""; 2005 this.requestCountInternal = 0; 2006 this.BeforeInitCallback = new ASPxClientEvent(); 2007 this.ControlsInitialized = new ASPxClientEvent(); 2008 this.BrowserWindowResized = new ASPxClientEvent(); 2009 this.BrowserWindowResizedInternal = new ASPxClientEvent(); 2010 this.BeginCallback = new ASPxClientEvent(); 2011 this.EndCallback = new ASPxClientEvent(); 2012 this.CallbackError = new ASPxClientEvent(); 2013 this.ValidationCompleted = new ASPxClientEvent(); 2014 aspxGetControlCollectionCollection().Add(this); 2015 }, 2016 Add: function(element) { 2017 var existsElement = this.Get(element.name); 2018 if(existsElement && existsElement !== element) 2019 this.Remove(existsElement);
2020 ASPx.CollectionBase.prototype.Add.call(this, element.name, element); 2021 }, 2022 Remove: function(element) { 2023 if(element && element instanceof ASPxClientControl && !element.IsDisposed()) 2024 element.OnDispose(); 2025 ASPx.CollectionBase.prototype.Remove.call(this, element.name); 2026 }, 2027 GetGlobal: function(name) { 2028 var result = window[name]; 2029 return result && Ident.IsASPxClientControl(result) 2030 ? result 2031 : null; 2032 }, 2033 GetByName: function(name){ 2034 return this.Get(name) || this.GetGlobal(name); 2035 }, 2036 GetCollectionType: function(){ 2037 return ASPxClientControlCollection.BaseCollectionType; 2038 }, 2039 GetControlsByPredicate: function(predicate) { 2040 var result = []; 2041 this.ForEachControl(function(control) { 2042 if(!predicate || predicate(control)) 2043 result.push(control); 2044 }); 2045 return result; 2046 }, 2047 GetControlsByType: function(type) { 2048 return this.GetControlsByPredicate(function(control) { 2049 return type && (control instanceof type); 2050 }); 2051 }, 2052 ForEachControl: function(action, context) { 2053 context = context || this; 2054 this.elementsMap.forEachEntry(function(name, control) { 2055 if(Ident.IsASPxClientControl(control) && (!this.filterPredicate || this.filterPredicate(control))) 2056 return action.call(context, control); 2057 }, context); 2058 }, 2059 ProcessActionByPredicate: function(action, predicate) { 2060 try { 2061 this.filterPredicate = predicate; 2062 action(this); 2063 } 2064 finally { 2065 this.filterPredicate = null; 2066 } 2067 }, 2068 adjustControlsInternal: function(container, context, collapseControls, adjustFunc) { 2069 context = context || this; 2070 var func = function(control) { 2071 adjustFunc.call(context, control); 2072 }; 2073 ASPx.GetControlAdjuster().adjustControlsInHierarchy(this, func, container, collapseControls); 2074 }, 2075 AdjustControls: function(container, collapseControls) { 2076 container = container || null; 2077 window.setTimeout(function() { 2078 this.AdjustControlsCore(container, collapseControls); 2079 }.aspxBind(this), 0); 2080 }, 2081 AdjustControlsCore: function(container, collapseControls) { 2082 var adjustFunction = function(control) { control.AdjustControl(); }; 2083 this.adjustControlsInternal(container, this, collapseControls, adjustFunction); 2084 }, 2085 CollapseControls: function(container) { 2086 this.ProcessControlsInContainer(container, function(control) { 2087 if(control.isASPxClientEdit) 2088 control.CollapseEditor(); 2089 else if(!!window.ASPxClientRibbon && control instanceof ASPxClientRibbon) 2090 control.CollapseControl(); 2091 }); 2092 }, 2093 AtlasInitialize: function(isCallback) { 2094 this.ForEachControl(function(control) { 2095 control.AtlasPreInitialize(); 2096 }); 2097 ASPx.ProcessScriptsAndLinks("", isCallback); 2098 this.ForEachControl(function(control) { 2099 control.AtlasInitialize(); 2100 }); 2101 }, 2102 DOMContentLoaded: function() { 2103 this.ForEachControl(function(control){ 2104 control.DOMContentLoaded(); 2105 }); 2106 }, 2107 OnDocumentUnload: function() { 2108 this.ForEachControl(function(control) { 2109 control.RaiseUnload(); 2110 }); 2111 }, 2112 Initialize: function() { 2113 ASPx.GetPostHandler().Post.AddHandler( 2114 function(s, e) { this.OnPost(e); }.aspxBind(this) 2115 ); 2116 ASPx.GetPostHandler().PostFinalization.AddHandler( 2117 function(s, e) { this.OnPostFinalization(e); }.aspxBind(this) 2118 ); 2119 this.InitializeElements(false ); 2120 if(typeof(Sys) != "undefined" && typeof(Sys.Application) != "undefined") { 2121 var checkIsInitialized = function() { 2122 if(Sys.Application.get_isInitialized()) 2123 Sys.Application.add_load(aspxCAInit); 2124 else 2125 setTimeout(checkIsInitialized, 0); 2126 }; 2127 checkIsInitialized(); 2128 } 2129 this.InitWindowSizeCache(); 2130 }, 2131 FinalizeInitialization: function() { 2132 this.ForEachControl(function(control) { 2133 control.FinalizeInitialization(); 2134 }); 2135 }, 2136 InitializeElements: function(isCallback) { 2137 this.ForEachControl(function(control){ 2138 if(!control.isInitialized) 2139 control.Initialize(); 2140 }); 2141 this.AfterInitializeElementsLeadingCall(); 2142 this.AfterInitializeElements(); 2143 this.RaiseControlsInitialized(isCallback); 2144 }, 2145 AfterInitializeElementsLeadingCall: function() { 2146 var controls = {}; 2147 controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct] = [];
2148 controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse] = []; 2149 this.ForEachControl(function(control) { 2150 if(control.leadingAfterInitCall != ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized) 2151 controls[control.leadingAfterInitCall].push(control); 2152 }); 2153 var directInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct], 2154 reverseInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse]; 2155 for(var i = 0, control; control = directInitControls[i]; i++) 2156 control.AfterInitialize(); 2157 for(var i = reverseInitControls.length - 1, control; control = reverseInitControls[i]; i--) 2158 control.AfterInitialize(); 2159 }, 2160 AfterInitializeElements: function() { 2161 this.ForEachControl(function(control) { 2162 if(control.leadingAfterInitCall == ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized) 2163 control.AfterInitialize(); 2164 }); 2165 ASPx.RippleHelper.Init(); 2166 }, 2167 DoFinalizeCallback: function() { 2168 this.ForEachControl(function(control){ 2169 control.DoFinalizeCallback(); 2170 }); 2171 }, 2172 ProcessControlsInContainer: function(container, processFunc, filterFunc) { 2173 this.ForEachControl(function(control){ 2174 if((!filterFunc || filterFunc(control)) && (!container || this.IsControlInContainer(container, control))) 2175 processFunc(control); 2176 }); 2177 }, 2178 IsControlInContainer: function(container, control) { 2179 if(control.GetMainElement) { 2180 var mainElement = control.GetMainElement(); 2181 if(mainElement && (mainElement != container)) { 2182 if(ASPx.GetIsParent(container, mainElement)) 2183 return true; 2184 } 2185 } 2186 return false; 2187 }, 2188 RaiseControlsInitialized: function(isCallback) { 2189 if(typeof(isCallback) == "undefined") 2190 isCallback = true; 2191 var args = new ASPxClientControlsInitializedEventArgs(isCallback); 2192 if(!this.ControlsInitialized.IsEmpty()) 2193 this.ControlsInitialized.FireEvent(this, args); 2194 this.ForEachControl(function(control){ 2195 control.OnGlobalControlsInitialized(args); 2196 }); 2197 }, 2198 RaiseBrowserWindowResized: function() { 2199 var args = new ASPxClientEventArgs(); 2200 if(!this.BrowserWindowResized.IsEmpty()) 2201 this.BrowserWindowResized.FireEvent(this, args); 2202 this.ForEachControl(function(control){ 2203 control.OnGlobalBrowserWindowResized(args); 2204 }); 2205 }, 2206 RaiseBrowserWindowResizedInternal: function(eventInfo) { 2207 var args = new ASPxClientBrowserWindowResizedInternalEventArgs(eventInfo); 2208 if(!this.BrowserWindowResizedInternal.IsEmpty()) 2209 this.BrowserWindowResizedInternal.FireEvent(this, args); 2210 }, 2211 RaiseBeginCallback: function (control, command) { 2212 var args = new ASPxClientGlobalBeginCallbackEventArgs(control, command); 2213 if(!this.BeginCallback.IsEmpty()) 2214 this.BeginCallback.FireEvent(this, args); 2215 this.ForEachControl(function(control){ 2216 control.OnGlobalBeginCallback(args); 2217 }); 2218 this.IncrementRequestCount(); 2219 }, 2220 RaiseEndCallback: function (control) { 2221 var args = new ASPxClientGlobalEndCallbackEventArgs(control); 2222 if (!this.EndCallback.IsEmpty()) 2223 this.EndCallback.FireEvent(this, args); 2224 this.ForEachControl(function(control){ 2225 control.OnGlobalEndCallback(args); 2226 }); 2227 this.DecrementRequestCount(); 2228 }, 2229 InCallback: function() { 2230 return this.requestCountInternal > 0; 2231 }, 2232 RaiseCallbackError: function (control, message, callbackId) { 2233 var args = new ASPxClientGlobalCallbackErrorEventArgs(control, message, callbackId); 2234 if (!this.CallbackError.IsEmpty()) 2235 this.CallbackError.FireEvent(this, args); 2236 this.ForEachControl(function(control){ 2237 control.OnGlobalCallbackError(args); 2238 }); 2239 if(args.handled) 2240 return { isHandled: true, errorMessage: args.message }; 2241 return { isHandled: false, errorMessage: message }; 2242 }, 2243 RaiseValidationCompleted: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) { 2244 var args = new ASPxClientValidationCompletedEventArgs(container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl); 2245 if (!this.ValidationCompleted.IsEmpty()) 2246 this.ValidationCompleted.FireEvent(this, args); 2247 this.ForEachControl(function(control){ 2248 control.OnGlobalValidationCompleted(args); 2249 }); 2250 return args.isValid; 2251 }, 2252 Before_WebForm_InitCallback: function(callbackOwnerID){ 2253 var args = new BeforeInitCallbackEventArgs(callbackOwnerID); 2254 this.BeforeInitCallback.FireEvent(this, args); 2255 }, 2256 InitWindowSizeCache: function(){ 2257 this.prevWndWidth = ASPx.GetDocumentClientWidth(); 2258 this.prevWndHeight = ASPx.GetDocumentClientHeight(); 2259 }, 2260 OnBrowserWindowResize: function(evt){ 2261 this.OnBrowserWindowResizeCore(evt); 2262 }, 2263 OnBrowserWindowResizeCore: function(htmlEvent){ 2264 var args = this.CreateOnBrowserWindowResizeEventArgs(htmlEvent); 2265 if(this.CalculateIsBrowserWindowSizeChanged()) { 2266 this.RaiseBrowserWindowResizedInternal(args); 2267 this.adjustControlsInternal(null, this, true, function(control) { 2268 if(control.IsDOMInitialized()) 2269 control.OnBrowserWindowResizeInternal(args); 2270 }); 2271 this.RaiseBrowserWindowResized(); 2272 } 2273 }, 2274 CreateOnBrowserWindowResizeEventArgs: function(htmlEvent) { 2275 return { 2276 htmlEvent: htmlEvent, 2277 wndWidth: ASPx.GetDocumentClientWidth(), 2278 wndHeight: ASPx.GetDocumentClientHeight(), 2279 prevWndWidth: this.prevWndWidth, 2280 prevWndHeight: this.prevWndHeight, 2281 virtualKeyboardShownOnAndroid: this.IsVirtualKeyboardShownOnAndroid() 2282 }; 2283 }, 2284 IsVirtualKeyboardShownOnAndroid: function() { 2285 if(!ASPx.Browser.AndroidMobilePlatform) 2286 return false; 2287 var documentClientWidth = ASPx.GetDocumentClientWidth(); 2288 var documentClientHeight = ASPx.GetDocumentClientHeight(); 2289 var isDocumentClientHeightChangedOnly = documentClientWidth === this.prevWndWidth && documentClientHeight !== this.prevWndHeight; 2290 return isDocumentClientHeightChangedOnly && this.IsElementSupportKeyboardInput(document.activeElement); 2291 },
2292 IsElementSupportKeyboardInput: function(element) { 2293 if(!element || !element.tagName) 2294 return false; 2295 var supportedKeyboardInputTagNames = ["INPUT", "TEXTAREA"]; 2296 return supportedKeyboardInputTagNames.indexOf(element.tagName) !== -1; 2297 }, 2298 CalculateIsBrowserWindowSizeChanged: function(){ 2299 var wndWidth = ASPx.GetDocumentClientWidth(); 2300 var wndHeight = ASPx.GetDocumentClientHeight(); 2301 var isBrowserWindowSizeChanged = (this.prevWndWidth != wndWidth) || (this.prevWndHeight != wndHeight); 2302 if(isBrowserWindowSizeChanged){ 2303 this.prevWndWidth = wndWidth; 2304 this.prevWndHeight = wndHeight; 2305 return true; 2306 } 2307 return false; 2308 }, 2309 OnPost: function(args){ 2310 this.ForEachControl(function(control) { 2311 control.OnPost(args); 2312 }, null); 2313 }, 2314 OnPostFinalization: function(args){ 2315 this.ForEachControl(function(control) { 2316 control.OnPostFinalization(args); 2317 }, null); 2318 }, 2319 IncrementRequestCount: function() { 2320 this.requestCountInternal++; 2321 }, 2322 DecrementRequestCount: function() { 2323 this.requestCountInternal--; 2324 }, 2325 ResetRequestCount: function() { 2326 this.requestCountInternal = 0; 2327 } 2328}); 2329ASPxClientControlCollection.BaseCollectionType = "Control"; 2330var controlCollection = null; 2331function aspxGetControlCollection(){ 2332 if(controlCollection == null) { 2333 controlCollection = new ASPxClientControlCollection(); 2334 if(ASPx.loadControlCollectionPreloadHandlers) 2335 ASPx.loadControlCollectionPreloadHandlers(controlCollection); 2336 } 2337 return controlCollection; 2338} 2339var ControlCollectionCollection = ASPx.CreateClass(ASPx.CollectionBase, { 2340 constructor: function(){ 2341 this.constructor.prototype.constructor.call(this); 2342 }, 2343 Add: function(element) { 2344 var key = element.GetCollectionType(); 2345 if(!key) throw "The collection type isn't specified."; 2346 if(this.Get(key)) throw "The collection with type='" + key + "' already exists."; 2347 ASPx.CollectionBase.prototype.Add.call(this, key, element); 2348 }, 2349 RemoveDisposedControls: function(){ 2350 var baseCollection = this.Get(ASPxClientControlCollection.BaseCollectionType); 2351 var disposedControls = []; 2352 baseCollection.elementsMap.forEachEntry(function(name, control) { 2353 if(!ASPx.Ident.IsASPxClientControl(control)) return; 2354 if(control.IsDOMDisposed()) 2355 disposedControls.push(control); 2356 }); 2357 this.RemoveControls(disposedControls); 2358 }, 2359 RemoveControls: function(controls){ 2360 for(var i = 0; i < controls.length; i++) { 2361 this.elementsMap.forEachEntry(function(key, collection) { 2362 if(ASPx.Ident.IsASPxClientCollection(collection)) 2363 collection.Remove(controls[i]); 2364 }); 2365 } 2366 } 2367}); 2368var controlCollectionCollection = null; 2369function aspxGetControlCollectionCollection(){ 2370 if(controlCollectionCollection == null) 2371 controlCollectionCollection = new ControlCollectionCollection(); 2372 return controlCollectionCollection; 2373} 2374var AriaDescriptionAttributes = { 2375 Role: "0", 2376 AriaLabel: "1", 2377 TabIndex: "2", 2378 AriaOwns: "3", 2379 AriaDescribedBy: "4", 2380 AriaDisabled: "5", 2381 AriaHasPopup: "6", 2382 AriaLevel: "7" 2383}; 2384var AriaDescriptor = ASPx.CreateClass(null, { 2385 constructor: function(ownerControl, description) { 2386 this.ownerControl = ownerControl; 2387 this.rootElement = ownerControl.GetMainElement(); 2388 this.description = description; 2389 }, 2390 setDescription: function(name, argList) { 2391 var description = this.findChildDescription(name); 2392 if(description) { 2393 var elements = name ? this.rootElement.querySelectorAll(this.getDescriptionSelector(description)) : [this.rootElement]; 2394 for(var i = 0; i < elements.length; i++) 2395 this.applyDescriptionToElement(elements[i], description, argList[i] || argList[0]); 2396 } 2397 }, 2398 getDescriptionName: function(description) { 2399 return description.n; 2400 }, 2401 getDescriptionSelector: function(description) { 2402 return description.s; 2403 }, 2404 findChildDescription: function(name) { 2405 if(name === this.getDescriptionName(this.description)) 2406 return this.description; 2407 var childCollection = this.description.c || []; 2408 for(var i = 0; i < childCollection.length; i++) { 2409 var childDescription = childCollection[i]; 2410 if(this.getDescriptionName(childDescription) === name) 2411 return childDescription; 2412 } 2413 return null; 2414 }, 2415 applyDescriptionToElement: function(element, description, args) { 2416 if(!description || !element) 2417 return; 2418 this.trySetAriaOwnsAttribute(element, description); 2419 this.trySetAriaDescribedByAttribute(element, description); 2420 this.trySetAttribute(element, description, AriaDescriptionAttributes.Role, "role"); 2421 this.trySetAttribute(element, description, AriaDescriptionAttributes.TabIndex, "tabindex"); 2422 this.trySetAttribute(element, description, AriaDescriptionAttributes.AriaLevel, "aria-level"); 2423 this.executeOnDescription(description, AriaDescriptionAttributes.AriaLabel, function(value) { 2424 ASPx.Attr.SetAttribute(element, "aria-label", ASPx.Str.ApplyReplacement(value, args
2424)); 2425 }); 2426 this.executeOnDescription(description, AriaDescriptionAttributes.AriaDisabled, function(value) { 2427 ASPx.Attr.SetAttribute(element, "aria-disabled", !!value); 2428 }); 2429 this.executeOnDescription(description, AriaDescriptionAttributes.AriaHasPopup, function(value) { 2430 ASPx.Attr.SetAttribute(element, "aria-haspopup", !!value); 2431 }); 2432 }, 2433 trySetAriaDescribedByAttribute: function(element, description) { 2434 this.executeOnDescription(description, AriaDescriptionAttributes.AriaDescribedBy, function(selectorInfo) { 2435 var descriptor = this.getNodesBySelector(element, selectorInfo.descriptorSelector)[0]; 2436 var target = this.getNodesBySelector(element, selectorInfo.targetSelector)[0]; 2437 if(!target || !descriptor) 2438 return; 2439 ASPx.Attr.SetAttribute(target, "aria-describedby", this.getNodeId(descriptor)); 2440 }); 2441 }, 2442 trySetAriaOwnsAttribute: function(element, description) { 2443 this.executeOnDescription(description, AriaDescriptionAttributes.AriaOwns, function(selector) { 2444 var ownedNodes = this.getNodesBySelector(element, selector); 2445 var ariaOwnsAttributeValue = ""; 2446 for(var i = 0; i < ownedNodes.length; i++) 2447 ariaOwnsAttributeValue += (this.getNodeId(ownedNodes[i]) + (i != ownedNodes.length - 1 ? " " : "")); 2448 ASPx.Attr.SetAttribute(element, "aria-owns", ariaOwnsAttributeValue); 2449 }); 2450 }, 2451 trySetAttribute: function(element, description, ariaAttribute, attributeName) { 2452 this.executeOnDescription(description, ariaAttribute, function(value) { 2453 ASPx.Attr.SetAttribute(element, attributeName, description[ariaAttribute]); 2454 }); 2455 }, 2456 executeOnDescription: function(description, ariaDescAttr, callback) { 2457 var descInfo = description[ariaDescAttr]; 2458 if(ASPx.IsExists(descInfo)) 2459 callback.aspxBind(this)(descInfo); 2460 }, 2461 getNodesBySelector: function(element, selector) { 2462 var id = element.id || ""; 2463 var childNodes = element.querySelectorAll("#" + this.getNodeId(element) + " > " + selector); 2464 ASPx.Attr.SetOrRemoveAttribute(element, "id", id); 2465 return childNodes; 2466 }, 2467 getNodeId: function(node) { 2468 if(!node.id) 2469 node.id = this.createRandomId(); 2470 return node.id; 2471 }, 2472 createRandomId: function() { 2473 return "r" + ASPx.CreateGuid(); 2474 } 2475}); 2476PagerCommands = { 2477 Next : "PBN", 2478 Prev : "PBP", 2479 Last : "PBL", 2480 First : "PBF", 2481 PageNumber : "PN", 2482 PageSize : "PSP" 2483}; 2484ASPx.callbackProcessed = false; 2485ASPx.Callback = function(result, context){ 2486 var collection = aspxGetControlCollection(); 2487 collection.DoFinalizeCallback(); 2488 var control = collection.Get(context); 2489 if(control != null) 2490 control.DoCallback(result); 2491 ASPx.RippleHelper.ReInit(); 2492 ASPx.callbackProcessed = true; 2493}; 2494ASPx.CallbackError = function(result, context){ 2495 var control = aspxGetControlCollection().Get(context); 2496 if(control != null) 2497 control.DoCallbackError(result, false); 2498 ASPx.callbackProcessed = true; 2499}; 2500ASPx.CClick = function(name, evt) { 2501 var control = aspxGetControlCollection().Get(name); 2502 if(control != null) control.DoControlClick(evt); 2503}; 2504function aspxCAInit() { 2505 var isAppInit = typeof(Sys$_Application$initialize) != "undefined" && 2506 ASPx.FunctionIsInCallstack(arguments.callee, Sys$_Application$initialize, 10 ); 2507 aspxGetControlCollection().AtlasInitialize(!isAppInit); 2508} 2509ASPx.Evt.AttachEventToElement(window, "resize", aspxGlobalWindowResize); 2510function aspxGlobalWindowResize(evt){ 2511 aspxGetControlCollection().OnBrowserWindowResize(evt); 2512} 2513ASPx.Evt.AttachEventToElement(window, "unload", aspxClassesUnload); 2514function aspxClassesUnload(evt) { 2515 aspxGetControlCollection().OnDocumentUnload(); 2516} 2517ASPx.attachToLoad(aspxClassesDOMContentLoaded); 2518function aspxClassesDOMContentLoaded(evt){ 2519 aspxGetControlCollection().DOMContentLoaded(); 2520} 2521ASPx.GetControlCollection = aspxGetControlCollection; 2522ASPx.GetControlCollectionCollection = aspxGetControlCollectionCollection; 2523ASPx.GetPersistentControlPropertiesStorage = _aspxGetPersistentControlPropertiesStorage; 2524ASPx.PagerCommands = PagerCommands; 2525ASPx.ELLIPSIS_MARKER_CLASS = ELLIPSIS_MARKER_CLASS; 2526window.ASPxClientBeginCallbackEventArgs = ASPxClientBeginCallbackEventArgs; 2527window.ASPxClientGlobalBeginCallbackEventArgs = ASPxClientGlobalBeginCallbackEventArgs; 2528window.ASPxClientEndCallbackEventArgs = ASPxClientEndCallbackEventArgs; 2529window.ASPxClientGlobalEndCallbackEventArgs = ASPxClientGlobalEndCallbackEventArgs; 2530window.ASPxClientCallbackErrorEventArgs = ASPxClientCallbackErrorEventArgs; 2531window.ASPxClientGlobalCallbackErrorEventArgs = ASPxClientGlobalCallbackErrorEventArgs; 2532window.ASPxClientCustomDataCallbackEventArgs = ASPxClientCustomDataCallbackEventArgs; 2533window.ASPxClientValidationCompletedEventArgs = ASPxClientValidationCompletedEventArgs; 2534window.ASPxClientControlsInitializedEventArgs = ASPxClientControlsInitializedEventArgs; 2535window.ASPxClientControlBeforePronounceEventArgs = ASPxClientControlBeforePronounceEventArgs; 2536window.ASPxClientControlUnloadEventArgs = ASPxClientControlUnloadEventArgs; 2537window.ASPxClientEndFocusEventArgs = ASPxClientEndFocusEventArgs; 2538window.ASPxClientItemFocusedEventArgs = ASPxClientItemFocusedEventArgs; 2539window.ASPxClientControlCollection = ASPxClientControlCollection; 2540window.ASPxClientControlBase = ASPxClientControlBase; 2541window.ASPxClientControl = ASPxClientControl; 2542window.ASPxClientComponent = ASPxClientComponent; 2543})(ASPx); 2544 2545(function () { 2546 var PositionAnimationTransition = ASPx.CreateClass(ASPx.AnimationTransitionBase, { 2547 constructor: function (element, options) { 2548 this.constructor.prototype.constructor.call(this, element, options); 2549 this.direction = options.direction; 2550 this.animationTransition = this.createAnimationTransition(); 2551 AnimationHelper.appendWKAnimationClassNameIfRequired(this.element); 2552 }, 2553 Start: function (to) { 2554 var from = this.GetValue(); 2555 if(ASPx.AnimationUtils.CanUseCssTransform()) { 2556 from = this.convertPosToCssTransformPos(from); 2557 to = this.convertPosToCssTransformPos(to); 2558 } 2559 this.animationTransition.Start(from, to); 2560 }, 2561 SetValue: function (value) { 2562 ASPx.AnimationUtils.SetTransformValue(this.element, value, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION); 2563 }, 2564 GetValue: function () { 2565 return ASPx.AnimationUtils.GetTransformValue(this.element, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION); 2566 }, 2567 createAnimationTransition: function () { 2568 var transition = ASPx.AnimationUtils.CanUseCssTransform() ? this.createTransformAnimationTransition() : this.createPositionAnimationTransition(); 2569 transition.transition = ASPx.AnimationConstants.Transitions.POW_EASE_OUT; 2570 return transition; 2571 }, 2572 createTransformAnimationTransition: function () { 2573 return ASPx.AnimationUtils.createCssAnimationTransition(this.element, { 2574 property: ASPx.AnimationUtils.CanUseCssTransform(), 2575 duration: this.duration, 2576 onComplete: this.onComplete 2577 }); 2578 }, 2579 createPositionAnimationTransition: function () { 2580 return AnimationHelper.createAnimationTransition(this.element, { 2581 property: this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION ? "top" : "left", 2582 unit: "px", 2583 duration: this.duration, 2584 onComplete: this.onComplete 2585 }); 2586 }, 2587 convertPosToCssTransformPos: function (position) { 2588 return ASPx.AnimationUtils.GetTransformCssText(position, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION); 2589 } 2590 }); 2591 var AnimationHelper = { 2592 SLIDE_HORIZONTAL_DIRECTION: 0, 2593 SLIDE_VERTICAL_DIRECTION: 1, 2594 SLIDE_TOP_DIRECTION: 0, 2595 SLIDE_RIGHT_DIRECTION: 1, 2596 SLIDE_BOTTOM_DIRECTION: 2, 2597 SLIDE_LEFT_DIRECTION: 3, 2598 SLIDE_CONTAINER_CLASS: "dxAC", 2599 MAXIMUM_DEPTH: 3, 2600 createAnimationTransition: function (element, options) { 2601 if(options.onStep) 2602 options.animationEngineType = AnimationEngineType.JS; 2603 switch(options.animationEngineType) { 2604 case AnimationEngineType.JS: 2605 return ASPx.AnimationUtils.createJsAnimationTransition(element, options); 2606 case AnimationEngineType.CSS: 2607 return ASPx.AnimationUtils.createCssAnimationTransition(element, options); 2608 default: 2609 return ASPx.AnimationUtils.CanUseCssTransition() ? ASPx.AnimationUtils.createCssAnimationTransition(element, options) : 2610 ASPx.AnimationUtils.createJsAnimationTransition(element, options); 2611 } 2612 }, 2613 createMultipleAnimationTransition: function (element, options) { 2614 return ASPx.AnimationUtils.createMultipleAnimationTransition(element, options); 2615 }, 2616 createSimpleAnimationTransition: function (options) { 2617 return ASPx.AnimationUtils.createSimpleAnimationTransition(options); 2618 }, 2619 cancelAnimation: function (element) { 2620 ASPx.AnimationTransitionBase.Cancel(element); 2621 }, 2622 fadeIn: function(element, onComplete, duration, animationEngineType) { 2623 AnimationHelper.fadeTo(element, { 2624 from: 0, to: 1, 2625 onComplete: onComplete, 2626 animationEngineType: animationEngineType || AnimationEngineType.DEFAULT, 2627 duration: duration || ASPx.AnimationConstants.Durations.DEFAULT 2628 }); 2629 }, 2630 fadeOut: function(element, onComplete, duration, animationEngineType) { 2631 AnimationHelper.fadeTo(element, { 2632 from: ASPx.GetElementOpacity(element), to: 0, 2633 onComplete: onComplete, 2634 animationEngineType: animationEngineType || AnimationEngineType.DEFAULT, 2635 duration: duration || ASPx.AnimationConstants.Durations.DEFAULT 2636 }); 2637 }, 2638 fadeTo: function (element, options) { 2639 options.property = "opacity"; 2640 if(!options.duration) 2641 options.duration = ASPx.AnimationConstants.Durations.SHORT; 2642 var transition = AnimationHelper.createAnimationTransition(element, options); 2643 if(!ASPx.IsExists(options.from)) 2644 options.from = transition.GetValue(); 2645 transition.Start(options.from, options.to); 2646 }, 2647 slideIn: function (element, direction, onComplete, animationEngineType, rtl) { 2648 AnimationHelper.setOpacity(element, 1); 2649 var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true); 2650 var pos = AnimationHelper.getSlideInStartPos(animationContainer, direction, rtl); 2651 var transition = AnimationHelper.createSlideTransition(animationContainer, direction, 2652 function (el) { 2653 AnimationHelper.resetSlideAnimationContainerSize(animationContainer); 2654 if(onComplete) 2655 onComplete(el); 2656 }, animationEngineType, rtl); 2657 transition.Start(pos, 0); 2658 }, 2659 slideOut: function (element, direction, onComplete, animationEngineType, rtl) { 2660 var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
2661 var pos = AnimationHelper.getSlideOutFinishPos(animationContainer, direction, rtl); 2662 var transition = AnimationHelper.createSlideTransition(animationContainer, direction, 2663 function (el) { 2664 AnimationHelper.setOpacity(el.firstChild, 0); 2665 if(onComplete) 2666 onComplete(el); 2667 }, animationEngineType, rtl); 2668 transition.Start(pos); 2669 }, 2670 slideTo: function (element, options) { 2671 if(!ASPx.IsExists(options.direction)) 2672 options.direction = AnimationHelper.SLIDE_HORIZONTAL_DIRECTION; 2673 var transition = new PositionAnimationTransition(element, options); 2674 transition.Start(options.to); 2675 }, 2676 setOpacity: function (element, value) { 2677 ASPx.AnimationUtils.setOpacity(element, value); 2678 }, 2679 appendWKAnimationClassNameIfRequired: function (element) { 2680 if(ASPx.AnimationUtils.CanUseCssTransform() && ASPx.Browser.WebKitFamily && !ASPx.ElementHasCssClass(element, "dx-wbv")) 2681 element.className += " dx-wbv"; 2682 }, 2683 findSlideAnimationContainer: function (element) { 2684 var container = element; 2685 for(var i = 0; i < AnimationHelper.MAXIMUM_DEPTH; i++) { 2686 if(container.tagName == "BODY") 2687 return null; 2688 if(ASPx.ElementHasCssClass(container, AnimationHelper.SLIDE_CONTAINER_CLASS)) 2689 return container; 2690 container = container.parentNode; 2691 } 2692 return null; 2693 }, 2694 createSlideAnimationContainer: function (element) { 2695 var rootContainer = document.createElement("DIV"); 2696 ASPx.SetStyles(rootContainer, { 2697 className: AnimationHelper.SLIDE_CONTAINER_CLASS, 2698 overflow: "hidden" 2699 }); 2700 var elementContainer = document.createElement("DIV"); 2701 rootContainer.appendChild(elementContainer); 2702 var parentNode = element.parentNode; 2703 parentNode.insertBefore(rootContainer, element); 2704 elementContainer.appendChild(element); 2705 return rootContainer; 2706 }, 2707 getSlideAnimationContainer: function (element, create, fixSize) { 2708 if(!element) return; 2709 var width = element.offsetWidth; 2710 var height = element.offsetHeight; 2711 var container; 2712 if(element.className == AnimationHelper.SLIDE_CONTAINER_CLASS) 2713 container = element; 2714 if(!container) 2715 container = AnimationHelper.findSlideAnimationContainer(element); 2716 if(!container && create) 2717 container = AnimationHelper.createSlideAnimationContainer(element); 2718 if(container && fixSize) { 2719 ASPx.SetStyles(container, { 2720 width: width, height: height 2721 }); 2722 ASPx.SetStyles(container.firstChild, { 2723 width: width, height: height 2724 }); 2725 } 2726 return container; 2727 }, 2728 resetSlideAnimationContainerSize: function (container) { 2729 ASPx.SetStyles(container, { 2730 width: "", height: "" 2731 }); 2732 ASPx.SetStyles(container.firstChild, { 2733 width: "", height: "" 2734 }); 2735 }, 2736 getModifyProperty: function (direction, rtl) { 2737 if(direction == AnimationHelper.SLIDE_TOP_DIRECTION || direction == AnimationHelper.SLIDE_BOTTOM_DIRECTION) 2738 return "marginTop"; 2739 return rtl ? "margin-right" : "margin-left"; 2740 }, 2741 createSlideTransition: function (animationContainer, direction, complete, animationEngineType, rtl) { 2742 if(rtl == undefined) 2743 rtl = false; 2744 return AnimationHelper.createAnimationTransition(animationContainer.firstChild, { 2745 unit: "px", 2746 property: AnimationHelper.getModifyProperty(direction, rtl), 2747 needForceTransitionEndByTimerFlag: true, 2748 onComplete: complete, 2749 animationEngineType: animationEngineType 2750 }); 2751 }, 2752 getSlideInStartPos: function (animationContainer, direction, rtl) { 2753 var dir = rtl ? -1 : 1; 2754 switch (direction) { 2755 case AnimationHelper.SLIDE_TOP_DIRECTION: 2756 return animationContainer.offsetHeight; 2757 case AnimationHelper.SLIDE_LEFT_DIRECTION: 2758 return animationContainer.offsetWidth * dir; 2759 case AnimationHelper.SLIDE_RIGHT_DIRECTION: 2760 return -animationContainer.offsetWidth * dir; 2761 case AnimationHelper.SLIDE_BOTTOM_DIRECTION: 2762 return -animationContainer.offsetHeight; 2763 } 2764 }, 2765 getSlideOutFinishPos: function (animationContainer, direction, rtl) { 2766 var dir = rtl ? -1 : 1; 2767 switch (direction) { 2768 case AnimationHelper.SLIDE_TOP_DIRECTION: 2769 return -animationContainer.offsetHeight; 2770 case AnimationHelper.SLIDE_LEFT_DIRECTION: 2771 return -animationContainer.offsetWidth * dir; 2772 case AnimationHelper.SLIDE_RIGHT_DIRECTION: 2773 return animationContainer.offsetWidth * dir; 2774 case AnimationHelper.SLIDE_BOTTOM_DIRECTION: 2775 return animationContainer.offsetHeight; 2776 } 2777 } 2778 }; 2779 var GestureHandler = ASPx.CreateClass(null, { 2780 constructor: function (getAnimationElement, canHandle, allowStart) { 2781 this.getAnimationElement = getAnimationElement; 2782 this.canHandle = canHandle; 2783 this.allowStart = allowStart; 2784 this.startMousePosX = 0; 2785 this.startMousePosY = 0; 2786 this.startTime = null; 2787 this.isEventsPrevented = false; 2788 this.savedElements = []; 2789 }, 2790 OnSelectStart: function(evt) { 2791 ASPx.Evt.PreventEvent(evt); 2792 }, 2793 OnDragStart: function(evt) { 2794 ASPx.Evt.PreventEvent(evt); 2795 }, 2796 OnMouseDown: function (evt) { 2797 this.startMousePosX = ASPx.Evt.GetEventX(evt); 2798 this.startMousePosY = ASPx.Evt.GetEventY(evt); 2799 this.startTime = new Date(); 2800 }, 2801 OnMouseMove: function(evt) { 2802 if(!ASPx.Browser.MobileUI) 2803 ASPx.Selection.Clear(); 2804 if(Math.abs(this.GetCurrentDistanceX(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE && Math.abs(this.GetCurrentDistanceY(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE) 2805 GesturesHelper.isExecutedGesture = false; 2806 }, 2807 OnMouseUp: function (evt) { 2808 }, 2809 CanHandleEvent: function (evt) { 2810 return !this.canHandle || this.canHandle(evt); 2811 }, 2812 IsStartAllowed: function(value) { 2813 return !this.allowStart || this.allowStart(value); 2814 }, 2815 RollbackGesture: function () { 2816 }, 2817 GetRubberPosition: function (position) { 2818 return position / GestureHandler.FACTOR_RUBBER; 2819 }, 2820 GetCurrentDistanceX: function (evt) { 2821 return ASPx.Evt.GetEventX(evt) - this.startMousePosX; 2822 }, 2823 GetCurrentDistanceY: function (evt) { 2824 return ASPx.Evt.GetEventY(evt) - this.startMousePosY; 2825 }, 2826 GetDistanceLimit: function () { 2827 return (new Date() - this.startTime) < GestureHandler.MAX_TIME_SPAN ? GestureHandler.MIN_DISTANCE_LIMIT : GestureHandler.MAX_DISTANCE_LIMIT; 2828 }, 2829 GetContainerElement: function () { 2830 }, 2831 AttachPreventEvents: function (evt) { 2832 if(!this.isEventsPrevented) { 2833 var element = ASPx.Evt.GetEventSource(evt); 2834 var container = this.GetContainerElement(); 2835 while(element && element != container) { 2836 ASPx.Evt.AttachEventToElement(element, "mouseup", ASPx.Evt.PreventEvent); 2837 ASPx.Evt.AttachEventToElement(element, "click", ASPx.Evt.PreventEvent); 2838 this.savedElements.push(element); 2839 element = element.parentNode; 2840 } 2841 this.isEventsPrevented = true; 2842 } 2843 }, 2844 DetachPreventEvents: function () { 2845 if(this.isEventsPrevented) { 2846 window.setTimeout(function () { 2847 while(this.savedElements.length > 0) { 2848 var element = this.savedElements.pop(); 2849 ASPx.Evt.DetachEventFromElement(element, "mouseup", ASPx.Evt.PreventEvent); 2850 ASPx.Evt.DetachEventFromElement(element, "click", ASPx.Evt.PreventEvent); 2851 } 2852 }.aspxBind(this), 0); 2853 this.isEventsPrevented = false; 2854 } 2855 } 2856 }); 2857 GestureHandler.MAX_DISTANCE_LIMIT = 70; 2858 GestureHandler.MIN_DISTANCE_LIMIT = 10; 2859 GestureHandler.MIN_START_DISTANCE = 0; 2860 GestureHandler.SLIDER_MIN_START_DISTANCE = 5; 2861 GestureHandler.MAX_TIME_SPAN = 300; 2862 GestureHandler.FACTOR_RUBBER = 4; 2863 GestureHandler.RETURN_ANIMATION_DURATION = 150; 2864 var SwipeSlideGestureHandler = ASPx.CreateClass(GestureHandler, { 2865 constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, move) { 2866 this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle); 2867 this.slideElement = this.getAnimationElement(); 2868 this.container = this.slideElement.parentNode; 2869 this.direction = direction; 2870 this.backward = backward; 2871 this.forward = forward; 2872 this.rollback = rollback; 2873 this.slideElementSize = 0; 2874 this.containerElementSize = 0; 2875 this.startSliderElementPosition = 0; 2876 this.centeredSlideElementPosition = 0; 2877 }, 2878 OnMouseDown: function (evt) { 2879 GestureHandler.prototype.OnMouseDown.call(this, evt); 2880 this.slideElementSize = this.GetElementSize(); 2881 this.startSliderElementPosition = this.GetElementPosition(); 2882 this.containerElementSize = this.GetContainerElementSize(); 2883 if(this.slideElementSize <= this.containerElementSize) 2884 this.centeredSlideElementPosition = (this.containerElementSize - this.slideElementSize) / 2; 2885 }, 2886 OnMouseMove: function (evt) { 2887 GestureHandler.prototype.OnMouseMove.call(this, evt); 2888 if(!ASPx.Browser.TouchUI && !ASPx.GetIsParent(this.container, ASPx.Evt.GetEventSource(evt))) { 2889 GesturesHelper.OnDocumentMouseUp(evt); 2890 return; 2891 } 2892 var distance = this.GetCurrentDistance(evt); 2893 if(Math.abs(distance) < GestureHandler.SLIDER_MIN_START_DISTANCE || ASPx.TouchUIHelper.isGesture) 2894 return; 2895 this.SetElementPosition(this.GetCalculatedPosition(distance)); 2896 this.AttachPreventEvents(evt); 2897 ASPx.Evt.PreventEvent(evt); 2898 }, 2899 GetCalculatedPosition: function (distance) { 2900 ASPx.AnimationTransitionBase.Cancel(this.slideElement); 2901 var position = this.startSliderElementPosition + distance, 2902 maxPosition = -(this.slideElementSize - this.containerElementSize), 2903 minPosition = 0; 2904 if(this.centeredSlideElementPosition > 0) 2905 position = this.GetRubberPosition(distance) + this.centeredSlideElementPosition; 2906 else if(position > minPosition) 2907 position = this.GetRubberPosition(distance); 2908 else if(position < maxPosition) 2909 position = this.GetRubberPosition(distance) + maxPosition; 2910 return position; 2911 }, 2912 OnMouseUp: function (evt) { 2913 this.DetachPreventEvents(); 2914 if(this.GetCurrentDistance(evt) != 0) 2915 this.OnMouseUpCore(evt); 2916 }, 2917 OnMouseUpCore: function (evt) { 2918 var distance = this.GetCurrentDistance(evt); 2919 if(this.centeredSlideElementPosition > 0 || this.CheckSlidePanelIsOutOfBounds()) 2920 this.PerformRollback(); 2921 else 2922 this.PerformAction(distance); 2923 }, 2924 PerformAction: function (distance) { 2925 if(Math.abs(distance) < this.GetDistanceLimit()) 2926 this.PerformRollback(); 2927 else if(distance < 0) 2928 this.PerformForward(); 2929 else 2930 this.PerformBackward(); 2931 }, 2932 PerformBackward: function () { 2933 this.backward(); 2934 }, 2935 PerformForward: function () { 2936 this.forward(); 2937 }, 2938 PerformRollback: function () { 2939 this.rollback(); 2940 }, 2941 CheckSlidePanelIsOutOfBounds: function () { 2942 var minOffset = -(this.slideElementSize - this.containerElementSize), maxOffset = 0; 2943 var slideElementPos = this.GetElementPosition(); 2944 if(slideElementPos > maxOffset || slideElementPos < minOffset) 2945 return true; 2946 return false; 2947 }, 2948 GetContainerElement: function () { 2949 return this.container; 2950 }, 2951 GetElementSize: function () { 2952 return this.IsHorizontalDirection() ? this.slideElement.offsetWidth : this.slideElement.offsetHeight; 2953 }, 2954 GetContainerElementSize: function () { 2955 return this.IsHorizontalDirection() ? ASPx.GetClearClientWidth(this.container) : ASPx.GetClearClientHeight(this.container); 2956 }, 2957 GetCurrentDistance: function (evt) { 2958 return this.IsHorizontalDirection() ? this.GetCurrentDistanceX(evt) : this.GetCurrentDistanceY(evt); 2959 }, 2960 GetElementPosition: function () { 2961 return ASPx.AnimationUtils.GetTransformValue(this.slideElement, !this.IsHorizontalDirection()); 2962 }, 2963 SetElementPosition: function (position) { 2964 ASPx.AnimationUtils.SetTransformValue(this.slideElement, position, !this.IsHorizontalDirection()); 2965 }, 2966 IsHorizontalDirection: function () { 2967 return this.direction == AnimationHelper.SLIDE_HORIZONTAL_DIRECTION; 2968 } 2969 }); 2970 var SwipeSimpleSlideGestureHandler = ASPx.CreateClass(SwipeSlideGestureHandler, { 2971 constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) { 2972 this.constructor.prototype.constructor.call(this, getAnimationElement, direction, canHandle, backward, forward, rollback); 2973 this.container = this.slideElement; 2974 this.updatePosition = updatePosition; 2975 this.prevDistance = 0; 2976 }, 2977 OnMouseDown: function (evt) { 2978 GestureHandler.prototype.OnMouseDown.call(this, evt); 2979 this.prevDistance = 0; 2980 }, 2981 OnMouseUpCore: function (evt) { 2982 this.PerformAction(this.GetCurrentDistance(evt)); 2983 }, 2984 PerformAction: function (distance) { 2985 if(Math.abs(distance) < this.GetDistanceLimit()) 2986 this.PerformRollback(); 2987 else if(distance < 0) 2988 this.PerformForward(); 2989 else 2990 this.PerformBackward(); 2991 }, 2992 GetCalculatedPosition: function (distance) { 2993 var position = distance - this.prevDistance; 2994 this.prevDistance = distance; 2995 return position; 2996 }, 2997 SetElementPosition: function (position) { 2998 this.updatePosition(position); 2999 } 3000 }); 3001 var SwipeGestureHandler = ASPx.CreateClass(GestureHandler, { 3002 constructor: function (getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) { 3003 this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle, allowStart); 3004 this.start = start; 3005 this.allowComplete = allowComplete; 3006 this.complete = complete; 3007 this.cancel = cancel; 3008 this.animationTween = null; 3009 this.currentDistanceX = 0; 3010 this.currentDistanceY = 0; 3011 this.tryStartGesture = false; 3012 this.tryStartScrolling = false; 3013 this.animationEngineType = animationEngineType; 3014 this.rtl = rtl; 3015 this.UpdateAnimationContainer(); 3016 }, 3017 UpdateAnimationContainer: function () { 3018 this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, false); 3019 }, 3020 CanHandleEvent: function (evt) { 3021 if(GestureHandler.prototype.CanHandleEvent.call(this, evt)) 3022 return true; 3023 return this.animationTween && this.animationContainer && ASPx.GetIsParent(this.animationContainer, ASPx.Evt.GetEventSource(evt)); 3024 }, 3025 OnMouseDown: function (evt) { 3026 GestureHandler.prototype.OnMouseDown.call(this, evt); 3027 if(this.animationTween) 3028 this.animationTween.Cancel(); 3029 this.currentDistanceX = 0; 3030 this.currentDistanceY = 0; 3031 this.tryStartGesture = false; 3032 this.tryStartScrolling = false; 3033 }, 3034 OnMouseMove: function (evt) { 3035 GestureHandler.prototype.OnMouseMove.call(this, evt);
3036 var isZoomGestureConflict = evt.touches && evt.touches.length > 1; 3037 if (isZoomGestureConflict) 3038 return false; 3039 this.currentDistanceX = this.GetCurrentDistanceX(evt); 3040 this.currentDistanceY = this.GetCurrentDistanceY(evt); 3041 if(this.rtl) 3042 this.currentDistanceX = -this.currentDistanceX; 3043 if(!this.animationTween && !this.tryStartScrolling && (Math.abs(this.currentDistanceX) > 3044 GestureHandler.MIN_START_DISTANCE || Math.abs(this.currentDistanceY) > GestureHandler.MIN_START_DISTANCE)) { 3045 if(Math.abs(this.currentDistanceY) < Math.abs(this.currentDistanceX)) { 3046 this.tryStartGesture = true; 3047 if(this.IsStartAllowed(this.currentDistanceX)) { 3048 this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, true); 3049 this.animationTween = AnimationHelper.createSlideTransition(this.animationContainer, AnimationHelper.SLIDE_LEFT_DIRECTION, 3050 function () { 3051 AnimationHelper.resetSlideAnimationContainerSize(this.animationContainer); 3052 this.animationContainer = null; 3053 this.animationTween = null; 3054 }.aspxBind(this), this.animationEngineType, this.rtl); 3055 this.PerformStart(this.currentDistanceX); 3056 this.AttachPreventEvents(evt); 3057 } 3058 } 3059 else 3060 this.tryStartScrolling = true; 3061 } 3062 if(this.animationTween) { 3063 if(this.allowComplete && !this.allowComplete(this.currentDistanceX)) 3064 this.currentDistanceX = this.GetRubberPosition(this.currentDistanceX); 3065 this.animationTween.SetValue(this.currentDistanceX); 3066 } 3067 if(!this.tryStartScrolling && !ASPx.TouchUIHelper.isGesture && evt.touches && evt.touches.length < 2) 3068 ASPx.Evt.PreventEvent(evt); 3069 }, 3070 OnMouseUp: function (evt) { 3071 if(!this.animationTween) { 3072 if(this.tryStartGesture) 3073 this.PerformCancel(this.currentDistanceX); 3074 } 3075 else { 3076 if(Math.abs(this.currentDistanceX) < this.GetDistanceLimit()) 3077 this.RollbackGesture(); 3078 else { 3079 if(this.IsCompleteAllowed(this.currentDistanceX)) { 3080 this.PerformComplete(this.currentDistanceX); 3081 this.animationContainer = null; 3082 this.animationTween = null; 3083 } 3084 else 3085 this.RollbackGesture(); 3086 } 3087 } 3088 this.DetachPreventEvents(); 3089 this.tryStartGesture = false; 3090 this.tryStartScrolling = false; 3091 }, 3092 PerformStart: function (value) { 3093 if(this.start) 3094 this.start(value); 3095 }, 3096 IsCompleteAllowed: function (value) { 3097 return !this.allowComplete || this.allowComplete(value); 3098 }, 3099 PerformComplete: function (value) { 3100 if(this.complete) 3101 this.complete(value); 3102 }, 3103 PerformCancel: function (value) { 3104 if(this.cancel) 3105 this.cancel(value); 3106 }, 3107 RollbackGesture: function () { 3108 this.animationTween.Start(this.currentDistanceX, 0); 3109 }, 3110 ResetGestureElementPosition: function () { 3111 if (this.currentDistanceX === 0) return; 3112 var container = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement()); 3113 var onComplete = function () { AnimationHelper.resetSlideAnimationContainerSize(container); }; 3114 var animation = AnimationHelper.createSlideTransition(container, AnimationHelper.SLIDE_LEFT_DIRECTION, onComplete, this.animationEngineType, this.rtl); 3115 animation.Start(this.currentDistanceX, 0); 3116 }, 3117 GetContainerElement: function () { 3118 return this.animationContainer; 3119 } 3120 }); 3121 var GesturesHelper = { 3122 handlers: {}, 3123 activeHandler: null, 3124 isAttachedEvents: false, 3125 isExecutedGesture: false, 3126 AddSwipeGestureHandler: function (id, getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) { 3127 this.handlers[id] = new SwipeGestureHandler(getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl); 3128 }, 3129 UpdateSwipeAnimationContainer: function (id) { 3130 if(this.handlers[id]) 3131 this.handlers[id].UpdateAnimationContainer(); 3132 }, 3133 AddSwipeSlideGestureHandler: function (id, getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) { 3134 if(updatePosition) 3135 this.handlers[id] = new SwipeSimpleSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition); 3136 else 3137 this.handlers[id] = new SwipeSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback); 3138 }, 3139 getParentDXEditorWithSwipeGestures: function(element) { 3140 return ASPx.GetParent(element, function(parent) {
3141 var parentObj = ASPx.GetControlCollection().Get(parent.id); 3142 return parentObj && parentObj.supportGestures && parentObj.isSwipeGesturesEnabled(); 3143 }); 3144 }, 3145 canHandleMouseDown: function(evt) { 3146 if(!ASPx.Evt.IsLeftButtonPressed(evt)) 3147 return false; 3148 var element = ASPx.Evt.GetEventSource(evt); 3149 var dxFocusedEditor = ASPx.Ident.scripts.ASPxClientEdit && ASPx.GetFocusedEditor(); 3150 if(dxFocusedEditor && dxFocusedEditor.IsEditorElement(element)) { 3151 var elementParentDXEditorWithSwipeGestures = GesturesHelper.getParentDXEditorWithSwipeGestures(element); 3152 if(!elementParentDXEditorWithSwipeGestures || !dxFocusedEditor.IsEditorElement(elementParentDXEditorWithSwipeGestures)) 3153 return false; 3154 } 3155 var isTextEditor = element.tagName == "TEXTAREA" || element.tagName == "INPUT" && ASPx.Attr.GetAttribute(element, "type") == "text"; 3156 if(isTextEditor && document.activeElement == element) 3157 return false; 3158 return true; 3159 }, 3160 OnDocumentDragStart: function(evt) { 3161 if(GesturesHelper.activeHandler) 3162 GesturesHelper.activeHandler.OnDragStart(evt); 3163 }, 3164 OnDocumentMouseDown: function (evt) { 3165 if(!GesturesHelper.canHandleMouseDown(evt)) 3166 return; 3167 GesturesHelper.activeHandler = GesturesHelper.FindHandler(evt); 3168 if(GesturesHelper.activeHandler) 3169 GesturesHelper.activeHandler.OnMouseDown(evt); 3170 }, 3171 OnDocumentMouseMove: function (evt) { 3172 if(GesturesHelper.activeHandler) { 3173 GesturesHelper.isExecutedGesture = true; 3174 GesturesHelper.activeHandler.OnMouseMove(evt); 3175 } 3176 }, 3177 OnDocumentMouseUp: function (evt) { 3178 if(GesturesHelper.activeHandler) { 3179 GesturesHelper.activeHandler.OnMouseUp(evt); 3180 GesturesHelper.activeHandler = null; 3181 window.setTimeout(function () { GesturesHelper.isExecutedGesture = false; }, 0); 3182 } 3183 }, 3184 AttachEvents: function () { 3185 if(!GesturesHelper.isAttachedEvents) { 3186 GesturesHelper.Attach(ASPx.Evt.AttachEventToElement); 3187 GesturesHelper.isAttachedEvents = true; 3188 } 3189 }, 3190 DetachEvents: function () { 3191 if(GesturesHelper.isAttachedEvents) { 3192 GesturesHelper.Attach(ASPx.Evt.DetachEventFromElement); 3193 GesturesHelper.isAttachedEvents = false; 3194 } 3195 }, 3196 Attach: function (changeEventsMethod) { 3197 var doc = window.document; 3198 changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseDownEventName, GesturesHelper.OnDocumentMouseDown); 3199 changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseMoveEventName, GesturesHelper.OnDocumentMouseMove); 3200 changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseUpEventName, GesturesHelper.OnDocumentMouseUp); 3201 if(!ASPx.Browser.MobileUI) { 3202 changeEventsMethod(doc, "dragstart", GesturesHelper.OnDocumentDragStart); 3203 } 3204 }, 3205 FindHandler: function (evt) { 3206 var handlers = []; 3207 for(var id in GesturesHelper.handlers) { 3208 if(GesturesHelper.handlers.hasOwnProperty(id)) { 3209 var handler = GesturesHelper.handlers[id]; 3210 if(handler.CanHandleEvent && handler.CanHandleEvent(evt)) 3211 handlers.push(handler); 3212 } 3213 } 3214 if(!handlers.length) 3215 return null; 3216 handlers.sort(function (a, b) { 3217 return ASPx.GetIsParent(a.getAnimationElement(), b.getAnimationElement()) ? 1 : -1; 3218 }); 3219 return handlers[0]; 3220 }, 3221 IsExecutedGesture: function () { 3222 return GesturesHelper.isExecutedGesture; 3223 } 3224 }; 3225 GesturesHelper.AttachEvents(); 3226 var AnimationEngineType = { 3227 "DEFAULT": 0, 3228 "CSS": 1, 3229 "JS": 2 3230 }; 3231 ASPx.AnimationEngineType = AnimationEngineType; 3232 ASPx.AnimationHelper = AnimationHelper; 3233 ASPx.GesturesHelper = GesturesHelper; 3234})(); 3235 3236(function () { 3237var PopupUtils = { 3238 NotSetAlignIndicator: "NotSet", 3239 InnerAlignIndicator: "Sides", 3240 OutsideLeftAlignIndicator: "OutsideLeft", 3241 LeftSidesAlignIndicator: "LeftSides", 3242 RightSidesAlignIndicator: "RightSides", 3243 OutsideRightAlignIndicator: "OutsideRight", 3244 CenterAlignIndicator: "Center", 3245 AboveAlignIndicator: "Above", 3246 TopSidesAlignIndicator: "TopSides", 3247 MiddleAlignIndicator: "Middle", 3248 BottomSidesAlignIndicator: "BottomSides", 3249 BelowAlignIndicator: "Below", 3250 WindowCenterAlignIndicator: "WindowCenter", 3251 LeftAlignIndicator: "Left", 3252 RightAlignIndicator: "Right", 3253 TopAlignIndicator: "Top", 3254 BottomAlignIndicator: "Bottom", 3255 WindowLeftAlignIndicator: "WindowLeft", 3256 WindowRightAlignIndicator: "WindowRight", 3257 WindowTopAlignIndicator: "WindowTop", 3258 WindowBottomAlignIndicator: "WindowBottom", 3259 IsAlignNotSet: function (align) { 3260 return align == PopupUtils.NotSetAlignIndicator; 3261 }, 3262 IsInnerAlign: function (align) { 3263 return align.indexOf(PopupUtils.InnerAlignIndicator) != -1; 3264 }, 3265 IsRightSidesAlign: function(align) { 3266 return align == PopupUtils.RightSidesAlignIndicator; 3267 }, 3268 IsOutsideRightAlign: function(align) { 3269 return align == PopupUtils.OutsideRightAlignIndicator; 3270 }, 3271 IsCenterAlign: function(align) { 3272 return align == PopupUtils.CenterAlignIndicator; 3273 }, 3274 FindPopupElementById: function (id) { 3275 if(id == "") 3276 return null; 3277 var popupElement = ASPx.GetElementById(id); 3278 if(!ASPx.IsExistsElement(popupElement)) { 3279 var idParts = id.split("_"); 3280 var uniqueId = idParts.join("$"); 3281 popupElement = ASPx.GetElementById(uniqueId); 3282 } 3283 return popupElement; 3284 }, 3285 FindEventSourceParentByTestFunc: function (evt, testFunc) { 3286 return ASPx.GetParent(ASPx.Evt.GetEventSource(evt), testFunc); 3287 }, 3288 PreventContextMenu: function (evt) { 3289 ASPx.Evt.PreventEventAndBubble(evt); 3290 if(ASPx.Browser.WebKitFamily) 3291 evt.returnValue = false; 3292 }, 3293 GetDocumentClientWidthForPopup: function() { 3294 return ASPx.Browser.WebKitTouchUI ? document.body.offsetWidth : ASPx.GetDocumentClientWidth(); 3295 }, 3296 GetDocumentClientHeightForPopup: function() { 3297 return ASPx.Browser.WebKitTouchUI ? document.body.offsetHeight : ASPx.GetDocumentClientHeight(); 3298 }, 3299 AdjustPositionToClientScreen: function (element, pos, rtl, isX) { 3300 var min = isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(), 3301 max = min + (isX ? ASPx.GetDocumentClientWidth() : ASPx.GetDocumentClientHeight()); 3302 max -= (isX ? element.offsetWidth : element.offsetHeight); 3303 if(rtl && isX) { 3304 if(pos < min) pos = min; 3305 if(pos > max) pos = max; 3306 } else { 3307 if(pos > max) pos = max; 3308 if(pos < min) pos = min; 3309 } 3310 return pos; 3311 }, 3312 GetPopupAbsoluteX: function(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn, showPopupInsideScreenBounds) { 3313 return PopupUtils.getPopupAbsolutePos(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn, false, false, true, showPopupInsideScreenBounds); 3314 }, 3315 GetPopupAbsoluteY: function(element, popupElement, vAlign, vOffset, y, top, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, showPopupInsideScreenBounds) { 3316 return PopupUtils.getPopupAbsolutePos(element, popupElement, vAlign, vOffset, y, top, false, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, false, showPopupInsideScreenBounds); 3317 }, 3318 getPopupAbsolutePos: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal, showPopupInsideScreenBounds) { 3319 var calculator = getPositionCalculator(); 3320 calculator.applyParams(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal, showPopupInsideScreenBounds); 3321 var position = calculator.getPopupAbsolutePos(); 3322 calculator.disposeState(); 3323 return position; 3324 }, 3325 InitAnimationProperties: function(element, onAnimStopCallString) { 3326 element.popuping = true; 3327 element.onAnimStopCallString = onAnimStopCallString; 3328 }, 3329 InitAnimationDiv: function (element, x, y, onAnimStopCallString, skipSizeInit) { 3330 PopupUtils.InitAnimationProperties(element, onAnimStopCallString); 3331 PopupUtils.InitAnimationDivCore(element); 3332 if(!skipSizeInit) { 3333 ASPx.SetStyles(element, { width: "", height: "" }); 3334 ASPx.SetStyles(element, { width: element.offsetWidth, height: element.offsetHeight });
3335 } 3336 ASPx.SetStyles(element, { left: x, top: y }); 3337 }, 3338 InitAnimationDivCore: function (element) { 3339 ASPx.SetStyles(element, { 3340 overflow: "hidden", 3341 position: "absolute" 3342 }); 3343 }, 3344 StartSlideAnimation: function (animationDivElement, element, iframeElement, duration, preventChangingWidth, preventChangingHeight) { 3345 if(iframeElement) { 3346 var endLeft = ASPx.PxToInt(iframeElement.style.left); 3347 var endTop = ASPx.PxToInt(iframeElement.style.top); 3348 var startLeft = ASPx.PxToInt(element.style.left) < 0 ? endLeft : animationDivElement.offsetLeft + animationDivElement.offsetWidth; 3349 var startTop = ASPx.PxToInt(element.style.top) < 0 ? endTop : animationDivElement.offsetTop + animationDivElement.offsetHeight; 3350 var properties = { 3351 left: { from: startLeft, to: endLeft, unit: "px" }, 3352 top: { from: startTop, to: endTop, unit: "px" } 3353 }; 3354 if(!preventChangingWidth) 3355 properties.width = { to: element.offsetWidth, unit: "px" }; 3356 if(!preventChangingHeight) 3357 properties.height = { to: element.offsetHeight, unit: "px" }; 3358 ASPx.AnimationHelper.createMultipleAnimationTransition(iframeElement, { 3359 duration: duration 3360 }).Start(properties); 3361 } 3362 ASPx.AnimationHelper.createMultipleAnimationTransition(element, { 3363 duration: duration, 3364 onComplete: function () { PopupUtils.AnimationFinished(animationDivElement, element); } 3365 }).Start({ 3366 left: { to: 0, unit: "px" }, 3367 top: { to: 0, unit: "px" } 3368 }); 3369 }, 3370 AnimationFinished: function (animationDivElement, element) { 3371 if(PopupUtils.StopAnimation(animationDivElement, element) && ASPx.IsExists(animationDivElement.onAnimStopCallString) && 3372 animationDivElement.onAnimStopCallString !== "") { 3373 window.setTimeout(animationDivElement.onAnimStopCallString, 0); 3374 } 3375 }, 3376 StopAnimation: function (animationDivElement, element) { 3377 if(animationDivElement.popuping) { 3378 ASPx.AnimationHelper.cancelAnimation(element); 3379 animationDivElement.popuping = false; 3380 animationDivElement.style.overflow = "visible"; 3381 return true; 3382 } 3383 return false; 3384 }, 3385 GetAnimationHorizontalDirection: function (popupPosition, horizontalAlign, verticalAlign, rtl) { 3386 if(PopupUtils.IsInnerAlign(horizontalAlign) 3387 && !PopupUtils.IsInnerAlign(verticalAlign) 3388 && !PopupUtils.IsAlignNotSet(verticalAlign)) 3389 return 0; 3390 var toTheLeft = (horizontalAlign == PopupUtils.OutsideLeftAlignIndicator || horizontalAlign == PopupUtils.RightSidesAlignIndicator || (horizontalAlign == PopupUtils.NotSetAlignIndicator && rtl)) ^ popupPosition.isInverted; 3391 return toTheLeft ? 1 : -1; 3392 }, 3393 GetAnimationVerticalDirection: function (popupPosition, horizontalAlign, verticalAlign) { 3394 if(PopupUtils.IsInnerAlign(verticalAlign) 3395 && !PopupUtils.IsInnerAlign(horizontalAlign) 3396 && !PopupUtils.IsAlignNotSet(horizontalAlign)) 3397 return 0; 3398 var toTheTop = (verticalAlign == PopupUtils.AboveAlignIndicator || verticalAlign == PopupUtils.BottomSidesAlignIndicator) ^ popupPosition.isInverted; 3399 return toTheTop ? 1 : -1; 3400 }, 3401 IsVerticalScrollExists: function () { 3402 var scrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden" && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden"; 3403 return (scrollIsNotHidden && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight()); 3404 }, 3405 CoordinatesInDocumentRect: function (x, y) { 3406 var docScrollLeft = ASPx.GetDocumentScrollLeft(); 3407 var docScrollTop = ASPx.GetDocumentScrollTop(); 3408 return (x > docScrollLeft && y > docScrollTop && 3409 x < ASPx.GetDocumentClientWidth() + docScrollLeft && 3410 y < ASPx.GetDocumentClientHeight() + docScrollTop); 3411 }, 3412 GetElementZIndexArray: function (element) { 3413 var currentElement = element; 3414 var zIndexesArray = [0]; 3415 while(currentElement && currentElement.tagName != "BODY") { 3416 if(currentElement.style) { 3417 if(typeof (currentElement.style.zIndex) != "undefined" && currentElement.style.zIndex != "") 3418 zIndexesArray.unshift(currentElement.style.zIndex); 3419 } 3420 currentElement = currentElement.parentNode; 3421 } 3422 return zIndexesArray; 3423 }, 3424 IsHigher: function (higherZIndexArrat, zIndexArray) { 3425 if(zIndexArray == null) return true; 3426 var count = (higherZIndexArrat.length >= zIndexArray.length) ? higherZIndexArrat.length : zIndexArray.length; 3427 for(var i = 0; i < count; i++) 3428 if(typeof (higherZIndexArrat[i]) != "undefined" && typeof (zIndexArray[i]) != "undefined") { 3429 var higherZIndexArrayCurrentElement = parseInt(higherZIndexArrat[i].toString()); 3430 var zIndexArrayCurrentElement = parseInt(zIndexArray[i].toString()); 3431 if(higherZIndexArrayCurrentElement != zIndexArrayCurrentElement) 3432 return higherZIndexArrayCurrentElement > zIndexArrayCurrentElement; 3433 } else return typeof (zIndexArray[i]) == "undefined"; 3434 return true; 3435 }, 3436 TestIsPopupElement: function (element) { 3437 return !!element.DXPopupElementControl; 3438 }, 3439 adjustViewportScrollWrapper: function(wrapper, wrapperScroll, windowElement) { 3440 var document = wrapper.ownerDocument; 3441 var window = document.defaultView || document.parentWindow; 3442 var isWindowElementDisplayed = ASPx.IsElementDisplayed(windowElement); 3443 if(!isWindowElementDisplayed) { 3444 wrapper.style.cssText = ""; 3445 wrapperScroll.style.cssText = ""; 3446 return; 3447 } 3448 var windowRect = windowElement.getBoundingClientRect(); 3449 var yAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.top, windowRect.top, windowElement.offsetHeight, window.innerHeight, wrapper.scrollTop); 3450 var xAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.left, windowRect.left, windowElement.offsetWidth, window.innerWidth, wrapper.scrollLeft); 3451 this.prepareViewPortScrollData(xAxis, yAxis); 3452 ASPx.SetStyles(windowElement, { 3453 top: yAxis.windowOffset,
3454 left: xAxis.windowOffset 3455 }); 3456 ASPx.SetStyles(wrapper, { 3457 width: xAxis.wrapperSize, 3458 height: yAxis.wrapperSize, 3459 position: "absolute", 3460 overflow: ASPx.Browser.MobileUI ? "scroll" : "auto", 3461 zIndex: windowElement.style.zIndex 3462 }); 3463 ASPx.SetAbsoluteX(wrapper, ASPx.GetDocumentScrollLeft()); 3464 ASPx.SetAbsoluteY(wrapper, ASPx.GetDocumentScrollTop()); 3465 ASPx.SetStyles(wrapperScroll, { 3466 width: xAxis.wrapperScrollSize, 3467 height: yAxis.wrapperScrollSize, 3468 position: "absolute", 3469 overflow: "hidden" 3470 }); 3471 wrapper.scrollLeft = xAxis.scrollSize; 3472 wrapper.scrollTop = yAxis.scrollSize; 3473 }, 3474 calculateViewPortScrollDataByAxis: function(wrapperOffsetStyle, windowOffset, windowSize, viewPortSize, scrollSize) { 3475 var isWindowOffsetNegative = windowOffset < 0; 3476 windowOffset = isWindowOffsetNegative ? 0 : windowOffset; 3477 var wrapperScrollSize = Math.max(viewPortSize + Math.abs(Math.min(0, windowOffset)), windowSize + Math.abs(windowOffset)); 3478 return { 3479 windowOffset: isWindowOffsetNegative ? 0 : windowOffset, 3480 wrapperSize: viewPortSize, 3481 wrapperScrollSize: wrapperScrollSize, 3482 scrollSize: isWindowOffsetNegative ? scrollSize + Math.abs(windowOffset) : 0, 3483 hasScroll: wrapperScrollSize > viewPortSize 3484 }; 3485 }, 3486 prepareViewPortScrollData: function(xAxis, yAxis) { 3487 var scrollBarSize = ASPx.GetVerticalScrollBarWidth(); 3488 if(yAxis.hasScroll && !xAxis.hasScroll) { 3489 xAxis.wrapperScrollSize = Math.min(xAxis.wrapperSize - scrollBarSize, xAxis.wrapperScrollSize); 3490 } else if(xAxis.hasScroll && !yAxis.hasScroll) { 3491 yAxis.wrapperScrollSize = Math.min(yAxis.wrapperSize - scrollBarSize, yAxis.wrapperScrollSize); 3492 } else if(yAxis.hasScroll && xAxis.hasScroll) { 3493 yAxis.wrapperScrollSize -= scrollBarSize; 3494 xAxis.wrapperScrollSize -= scrollBarSize; 3495 } 3496 } 3497}; 3498PopupUtils.OverControl = { 3499 GetPopupElementByEvt: function (evt) { 3500 return PopupUtils.FindEventSourceParentByTestFunc(evt, PopupUtils.TestIsPopupElement); 3501 }, 3502 OnMouseEvent: function (evt, mouseOver) { 3503 var popupElement = PopupUtils.OverControl.GetPopupElementByEvt(evt); 3504 if(mouseOver) 3505 popupElement.DXPopupElementControl.OnPopupElementMouseOver(evt, popupElement); 3506 else 3507 popupElement.DXPopupElementControl.OnPopupElementMouseOut(evt, popupElement); 3508 }, 3509 OnMouseOut: function (evt) { 3510 PopupUtils.OverControl.OnMouseEvent(evt, false); 3511 }, 3512 OnMouseOver: function (evt) { 3513 PopupUtils.OverControl.OnMouseEvent(evt, true); 3514 } 3515}; 3516PopupUtils.BodyScrollHelper = (function () { 3517 var windowScrollLock = {}, 3518 windowScroll = {}, 3519 hideScrollbarsClassName = "dxpc-hideScrollbars"; 3520 function lockWindowScroll(windowId) { 3521 windowScrollLock[windowId] = true; 3522 } 3523 function unlockWindowScroll(windowId) { 3524 delete windowScrollLock[windowId]; 3525 } 3526 function isLocked(windowId) { 3527 return !!windowScrollLock[windowId]; 3528 } 3529 function isAnyWindowScrollLocked() { 3530 for(var key in windowScrollLock) 3531 if (windowScrollLock.hasOwnProperty(key) && windowScrollLock[key] === true) 3532 return true; 3533 return false; 3534 } 3535 function replaceVerticalScrollByPadding() { 3536 var currentBodyStyle = ASPx.GetCurrentStyle(document.body), 3537 paddingWidth = ASPx.GetVerticalScrollBarWidth() + ASPx.PxToInt(currentBodyStyle.paddingRight); 3538 ASPx.Attr.ChangeStyleAttribute(document.body, "padding-right", paddingWidth + "px"); 3539 } 3540 function changeOverflow() { 3541 ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden"); 3542 if(ASPx.GetCurrentStyle(document.body).overflowY === "scroll") 3543 ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden"); 3544 resetOverflowCache(); 3545 } 3546 function restoreOverflow() { 3547 ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow"); 3548 ASPx.Attr.RestoreStyleAttribute(document.body, "overflow"); 3549 resetOverflowCache(); 3550 } 3551 function resetOverflowCache() { 3552 ASPx.verticalScrollIsNotHidden = null; 3553 ASPx.horizontalScrollIsNotHidden = null; 3554 } 3555 function saveScrollPosition(windowId) { 3556 windowScroll[windowId] = { 3557 x: window.pageXOffset, 3558 y: window.pageYOffset 3559 }; 3560 } 3561 function restoreScrollPosition(windowId) { 3562 var currentWindowScroll = windowScroll[windowId]; 3563 if(!!currentWindowScroll) 3564 window.scrollTo(currentWindowScroll.x, currentWindowScroll.y); 3565 } 3566 function restoreBodyScroll(windowId) { 3567 unlockWindowScroll(windowId); 3568 if(isAnyWindowScrollLocked()) 3569 return; 3570 if(ASPx.Browser.WebKitTouchUI) { 3571 ASPx.Attr.RestoreStyleAttribute(document.body, "position"); 3572 ASPx.Attr.RestoreStyleAttribute(document.body, "height"); 3573 ASPx.Attr.RestoreStyleAttribute(document.body, "margin"); 3574 ASPx.RemoveClassNameFromElement(document.documentElement, hideScrollbarsClassName); 3575 ASPx.Attr.RestoreStyleAttribute(document.body, "overflow"); 3576 restoreScrollPosition(windowId); 3577 } else { 3578 restoreOverflow(); 3579 restoreScrollPosition(windowId); 3580 } 3581 if(ASPx.Browser.Chrome) 3582 var dummy = document.documentElement.scrollTop; 3583 ASPx.Attr.RestoreStyleAttribute(document.body, "padding-right"); 3584 ASPx.Attr.RestoreStyleAttribute(document.body, "height"); 3585 ASPx.Attr.RestoreStyleAttribute(document.body, "width"); 3586 } 3587 return { 3588 RestoreIfLocked: function(windowId) { 3589 if(isLocked(windowId)) 3590 restoreBodyScroll(windowId); 3591 }, 3592 HideBodyScroll: function(windowId) { 3593 if(isAnyWindowScrollLocked()) { 3594 lockWindowScroll(windowId); 3595 return; 3596 } 3597 lockWindowScroll(windowId); 3598 if(PopupUtils.IsVerticalScrollExists()) 3599 replaceVerticalScrollByPadding(); 3600 if(ASPx.Browser.WebKitTouchUI) { 3601 saveScrollPosition(windowId); 3602 ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden"); 3603 ASPx.Attr.ChangeStyleAttribute(document.body, "position", "relative"); 3604 ASPx.Attr.ChangeStyleAttribute(document.body, "height", "100%"); 3605 ASPx.Attr.ChangeStyleAttribute(document.body, "margin", "0"); 3606 ASPx.AddClassNameToElement(document.documentElement, hideScrollbarsClassName); 3607 } else { 3608 saveScrollPosition(windowId); 3609 changeOverflow(); 3610 var documentHeight = ASPx.GetDocumentHeight(); 3611 var documentWidth = ASPx.GetDocumentWidth(); 3612 if(window.pageYOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentHeight) 3613 ASPx.Attr.ChangeStyleAttribute(document.body, "height", documentHeight + "px"); 3614 if(window.pageXOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentWidth) 3615 ASPx.Attr.ChangeStyleAttribute(document.body, "width", documentWidth + "px"); 3616 } 3617 }, 3618 RestoreBodyScroll: restoreBodyScroll 3619 }; 3620})(); 3621var PositionAlignConsts = { 3622 NOT_SET: 0, 3623 OUTSIDE_START: 1, 3624 NEAR_BOUND_START: 2, 3625 INNER_START: 3,
3626 CENTER: 4, 3627 INNER_END: 5, 3628 NEAR_BOUND_END: 6, 3629 OUTSIDE_END: 7, 3630 WINDOW_CENTER: 8, 3631 WINDOW_START: 9, 3632 WINDOW_END: 10 3633}; 3634var AlignIndicatorTable = {}; 3635var PositionCalculator = ASPx.CreateClass(null, { 3636 constructor: function() { 3637 this.element = null; 3638 this.popupElement = null; 3639 this.align = 0; 3640 this.offset = 0; 3641 this.startPos = 0; 3642 this.startPosInit = 0; 3643 this.rtl = false; 3644 this.isPopupFullCorrectionOn = false; 3645 this.isHorizontal = true; 3646 this.size = 0; 3647 this.bodySize = 0; 3648 this.actualBodySize = 0; 3649 this.elementStartPos = 0; 3650 this.scrollStartPos = 0; 3651 this.isInverted = false; 3652 this.popupElementSize = 0; 3653 this.boundStartPos = 0; 3654 this.boundEndPos = 0; 3655 this.innerBoundStartPos = 0; 3656 this.innerBoundEndPos = 0; 3657 this.isMoreFreeSpaceLeft = false; 3658 this.nearBoundOverlapRate = 0.25; 3659 this.functionsTable = {}; 3660 this.initializeFunctionsTable(); 3661 }, 3662 applyParams: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal, showPopupInsideScreenBounds) { 3663 this.isHorizontal = isHorizontal; 3664 this.element = element; 3665 this.popupElement = popupElement; 3666 this.align = this.getAlignValueFromIndicator(align); 3667 this.offset = offset; 3668 this.startPos = startPos; 3669 this.startPosInit = startPosInit; 3670 this.rtl = rtl; 3671 this.isPopupFullCorrectionOn = isPopupFullCorrectionOn; 3672 this.ignoreAlignWithoutScrollReserve = ignoreAlignWithoutScrollReserve; 3673 this.ignorePopupElementBorders = ignorePopupElementBorders; 3674 this.showPopupInsideScreenBounds = showPopupInsideScreenBounds; 3675 this.calculateParams(); 3676 }, 3677 disposeState: function() { 3678 this.element = null; 3679 this.popupElement = null; 3680 }, 3681 getPopupAbsolutePos: function() { 3682 if(this.isWindowAlign()) { 3683 var showAtPos = this.startPos != ASPx.InvalidPosition && !this.popupElement; 3684 if(showAtPos) 3685 this.align = PositionAlignConsts.NOT_SET; 3686 else 3687 return this.getWindowAlignPos(); 3688 } 3689 if(this.popupElement) 3690 this.calculatePopupElement(); 3691 else 3692 this.align = PositionAlignConsts.NOT_SET; 3693 return this.getPopupAbsolutePosCore(); 3694 }, 3695 initializeFunctionsTable: function() { 3696 var table = this.functionsTable; 3697 table[PositionAlignConsts.NOT_SET] = this.calculateNotSet; 3698 table[PositionAlignConsts.OUTSIDE_START] = this.calculateOutsideStart; 3699 table[PositionAlignConsts.INNER_START] = this.calculateInnerStart; 3700 table[PositionAlignConsts.CENTER] = this.calculateCenter; 3701 table[PositionAlignConsts.INNER_END] = this.calculateInnerEnd; 3702 table[PositionAlignConsts.OUTSIDE_END] = this.calculateOutsideEnd; 3703 table[PositionAlignConsts.NEAR_BOUND_START] = this.calculateNearBoundStart; 3704 table[PositionAlignConsts.NEAR_BOUND_END] = this.calculateNearBoundEnd; 3705 table[PositionAlignConsts.WINDOW_CENTER] = this.calculateWindowCenter; 3706 table[PositionAlignConsts.WINDOW_START] = this.calculateWindowStart; 3707 table[PositionAlignConsts.WINDOW_END] = this.calculateWindowEnd; 3708 }, 3709 calculateParams: function() { 3710 this.size = this.getElementSize(); 3711 if(this.isHorizontal) { 3712 this.bodySize = ASPx.GetDocumentClientWidth(); 3713 this.elementStartPos = ASPx.GetAbsoluteX(this.popupElement) + this.getBorderCorrection(); 3714 this.scrollStartPos = ASPx.GetDocumentScrollLeft(); 3715 } 3716 else { 3717 this.bodySize = ASPx.GetDocumentClientHeight(); 3718 this.elementStartPos = ASPx.GetAbsoluteY(this.popupElement) + this.getBorderCorrection(); 3719 this.scrollStartPos = ASPx.GetDocumentScrollTop(); 3720 } 3721 }, 3722 getBorderCorrection: function() { 3723 if(!this.ignorePopupElementBorders) 3724 return 0; 3725 var style = getComputedStyle(this.popupElement); 3726 return ASPx.PxToInt(this.isHorizontal ? style.borderLeftWidth : style.borderTopWidth); 3727 }, 3728 isWindowAlign: function() { 3729 return this.align == PositionAlignConsts.WINDOW_CENTER || this.align == PositionAlignConsts.WINDOW_START || 3730 this.align == PositionAlignConsts.WINDOW_END; 3731 }, 3732 getWindowAlignPos: function() { 3733 this.actualBodySize = ASPx.Browser.WebKitTouchUI ? this.getWindowInnerSize() : this.bodySize; 3734 return this.getPopupAbsolutePosCore(); 3735 }, 3736 getPopupAbsolutePosCore: function() { 3737 var calculationFunc = this.functionsTable[this.align]; 3738 calculationFunc.call(this); 3739 return new ASPx.PopupPosition(this.startPos, this.isInverted); 3740 }, 3741 calculateWindowCenter: function() { 3742 this.startPos = Math.max(Math.ceil(this.actualBodySize / 2 - this.size / 2), 0) + this.scrollStartPos + this.offset; 3743 }, 3744 calculateWindowStart: function() { 3745 this.startPos = this.scrollStartPos + this.offset; 3746 }, 3747 calculateWindowEnd: function() { 3748 this.startPos = this.scrollStartPos + this.actualBodySize - this.size + this.offset; 3749 }, 3750 calculatePopupElement: function() { 3751 this.popupElementSize = this.getPopupElementSize(); 3752 this.boundStartPos = this.elementStartPos - this.size; 3753 this.boundEndPos = this.elementStartPos + this.popupElementSize; 3754 this.innerBoundStartPos = this.elementStartPos; 3755 this.innerBoundEndPos = this.elementStartPos + this.popupElementSize - this.size; 3756 var hasLeftScrollReserve = this.boundStartPos >= 0;
3757 this.isMoreFreeSpaceLeft = (this.bodySize - (this.boundEndPos + this.size) < this.boundStartPos - 2 * this.scrollStartPos) && (!this.ignoreAlignWithoutScrollReserve || hasLeftScrollReserve); 3758 }, 3759 calculateOutsideStart: function() { 3760 this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundStartPos - this.scrollStartPos > 0 || this.isMoreFreeSpaceLeft)); 3761 if(this.isInverted) 3762 this.startPos = this.boundEndPos - this.offset; 3763 else 3764 this.startPos = this.boundStartPos + this.offset; 3765 }, 3766 calculateInnerStart: function() { 3767 this.startPos = this.innerBoundStartPos + this.offset; 3768 if(this.isPopupFullCorrectionOn) 3769 this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal); 3770 }, 3771 calculateCenter: function() { 3772 this.startPos = this.elementStartPos + Math.round((this.popupElementSize - this.size) / 2) + this.offset; 3773 if(this.showPopupInsideScreenBounds) { 3774 if(this.startPos < 0) 3775 this.startPos = 0; 3776 if(this.startPos + this.size > this.bodySize) 3777 this.startPos = this.bodySize - this.size; 3778 } 3779 }, 3780 calculateInnerEnd: function() { 3781 this.startPos = this.innerBoundEndPos + this.offset; 3782 if(this.isPopupFullCorrectionOn) 3783 this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal); 3784 }, 3785 calculateOutsideEnd: function() { 3786 this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundEndPos + this.size < this.bodySize + this.scrollStartPos || !this.isMoreFreeSpaceLeft)); 3787 if(this.isInverted) 3788 this.startPos = this.boundStartPos - this.offset; 3789 else 3790 this.startPos = this.boundEndPos + this.offset; 3791 }, 3792 calculateNotSet: function() { 3793 if(this.rtl) 3794 this.calculateNotSetRightToLeft(); 3795 else 3796 this.calculateNotSetLeftToRight(); 3797 }, 3798 calculateNotSetLeftToRight: function() { 3799 if(!ASPx.IsValidPosition(this.startPos)) { 3800 if(this.popupElement) 3801 this.startPos = this.elementStartPos; 3802 else if(this.offset) 3803 this.startPos = 0; 3804 else 3805 this.startPos = this.startPosInit; 3806 } 3807 this.isInverted = this.isPopupFullCorrectionOn && (this.startPos - this.scrollStartPos + this.size > this.bodySize && this.startPos - this.scrollStartPos > this.bodySize / 2); 3808 if(this.isInverted) 3809 this.startPos = this.startPos - this.size - this.offset; 3810 else 3811 this.startPos = this.startPos + this.offset; 3812 }, 3813 calculateNotSetRightToLeft: function() { 3814 if(!ASPx.IsValidPosition(this.startPos)) { 3815 if(this.popupElement) 3816 this.startPos = this.innerBoundEndPos; 3817 else if(this.offset) 3818 this.startPos = 0; 3819 else 3820 this.startPos = this.startPosInit; 3821 } 3822 else 3823 this.startPos -= this.size; 3824 this.isInverted = this.isPopupFullCorrectionOn && (this.startPos < this.scrollStartPos && this.startPos - this.scrollStartPos < this.bodySize / 2); 3825 if(this.isInverted) 3826 this.startPos = this.startPos + this.size + this.offset; 3827 else 3828 this.startPos = this.startPos - this.offset; 3829 }, 3830 calculateNearBoundStart: function() { 3831 this.startPos = this.boundStartPos + this.offset + this.size * this.nearBoundOverlapRate; 3832 if(this.isPopupFullCorrectionOn) 3833 this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal); 3834 }, 3835 calculateNearBoundEnd: function() { 3836 this.startPos = this.boundEndPos + this.offset - this.size * this.nearBoundOverlapRate; 3837 if(this.isPopupFullCorrectionOn) 3838 this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal); 3839 }, 3840 getAlignValueFromIndicator: function(alignIndicator) { 3841 var alignValue = AlignIndicatorTable[alignIndicator]; 3842 if(alignValue === undefined) 3843 throw "Incorrect align indicator."; 3844 return alignValue; 3845 }, 3846 getElementSize: function() { 3847 return this.getCustomElementSize(this.element, false); 3848 }, 3849 getPopupElementSize: function() { 3850 return this.getCustomElementSize(this.popupElement, this.ignorePopupElementBorders); 3851 }, 3852 getCustomElementSize: function(customElement, ignoreBorders) { 3853 if(ignoreBorders) { 3854 return this.isHorizontal ? ASPx.GetClearClientWidth(customElement) : ASPx.GetClearClientHeight(customElement); 3855 } 3856 return this.isHorizontal ? ASPx.GetElementOffsetWidth(customElement) : ASPx.GetElementOffsetHeight(customElement); 3857 }, 3858 getWindowInnerSize: function() { 3859 return this.isHorizontal ? window.innerWidth : window.innerHeight; 3860 } 3861}); 3862var positionCalculator = null; 3863function getPositionCalculator() { 3864 if(positionCalculator == null) 3865 positionCalculator = new PositionCalculator(); 3866 return positionCalculator; 3867} 3868function initializeAlignIndicatorTable() { 3869 AlignIndicatorTable[PopupUtils.NotSetAlignIndicator] = PositionAlignConsts.NOT_SET; 3870 AlignIndicatorTable[PopupUtils.OutsideLeftAlignIndicator] = PositionAlignConsts.OUT
3870SIDE_START; 3871 AlignIndicatorTable[PopupUtils.AboveAlignIndicator] = PositionAlignConsts.OUTSIDE_START; 3872 AlignIndicatorTable[PopupUtils.LeftAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START; 3873 AlignIndicatorTable[PopupUtils.TopAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START; 3874 AlignIndicatorTable[PopupUtils.LeftSidesAlignIndicator] = PositionAlignConsts.INNER_START; 3875 AlignIndicatorTable[PopupUtils.TopSidesAlignIndicator] = PositionAlignConsts.INNER_START; 3876 AlignIndicatorTable[PopupUtils.CenterAlignIndicator] = PositionAlignConsts.CENTER; 3877 AlignIndicatorTable[PopupUtils.MiddleAlignIndicator] = PositionAlignConsts.CENTER; 3878 AlignIndicatorTable[PopupUtils.RightSidesAlignIndicator] = PositionAlignConsts.INNER_END; 3879 AlignIndicatorTable[PopupUtils.BottomSidesAlignIndicator] = PositionAlignConsts.INNER_END; 3880 AlignIndicatorTable[PopupUtils.RightAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END; 3881 AlignIndicatorTable[PopupUtils.BottomAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END; 3882 AlignIndicatorTable[PopupUtils.OutsideRightAlignIndicator] = PositionAlignConsts.OUTSIDE_END; 3883 AlignIndicatorTable[PopupUtils.BelowAlignIndicator] = PositionAlignConsts.OUTSIDE_END; 3884 AlignIndicatorTable[PopupUtils.WindowCenterAlignIndicator] = PositionAlignConsts.WINDOW_CENTER; 3885 AlignIndicatorTable[PopupUtils.WindowLeftAlignIndicator] = PositionAlignConsts.WINDOW_START; 3886 AlignIndicatorTable[PopupUtils.WindowTopAlignIndicator] = PositionAlignConsts.WINDOW_START; 3887 AlignIndicatorTable[PopupUtils.WindowRightAlignIndicator] = PositionAlignConsts.WINDOW_END; 3888 AlignIndicatorTable[PopupUtils.WindowBottomAlignIndicator] = PositionAlignConsts.WINDOW_END; 3889} 3890initializeAlignIndicatorTable(); 3891ASPx.PopupPosition = function(position, isInverted) { 3892 this.position = position; 3893 this.isInverted = isInverted; 3894}; 3895ASPx.PopupSize = function(width, height) { 3896 this.width = width; 3897 this.height = height; 3898}; 3899ASPx.PopupUtils = PopupUtils; 3900ASPx.PositionCalculator = PositionCalculator; 3901})(); 3902 3903(function(){ 3904 var ScrollingManager = ASPx.CreateClass(null, { 3905 constructor: function(owner, options) { 3906 this.owner = owner; 3907 this.scrollableArea = options.scrollableArea; 3908 this.orientation = options.orientation; 3909 this.animationDelay = 1; 3910 this.animationStep = 2; 3911 this.animationOffset = 5; 3912 this.animationAcceleration = 0; 3913 this.scrollSessionInterval = 10; 3914 this.stopScrolling = true; 3915 this.busy = false; 3916 this.currentAcceleration = 0; 3917 this.startPos = 0; 3918 this.onBeforeScrolling = options.onBeforeScrolling; 3919 this.onAfterScrolling = options.onAfterScrolling; 3920 this.emulationMode = options.forseEmulation === true || !ASPx.Browser.TouchUI; 3921 this.useMarginForPosition = options.useMarginForPosition; 3922 this.handleMouseWheel = !!options.handleMouseWheel; 3923 this.Initialize(); 3924 }, 3925 Initialize: function(){ 3926 this.setParentNodeOverflow(); 3927 if(this.emulationMode) { 3928 this.wrapper = new ScrollingManager.scrollWrapper(this.scrollableArea, this.useMarginForPosition); 3929 } else { 3930 this.wrapper = new ScrollingManager.scrollWrapperTouchUI(this.scrollableArea, function(direction){ 3931 if(this.onAfterScrolling) 3932 this.onAfterScrolling(this, direction); 3933 }.aspxBind(this)); 3934 } 3935 if(this.handleMouseWheel) 3936 ASPx.Evt.AttachEventToElement(this.scrollableArea, ASPx.Evt.GetMouseWheelEventName(), this.onMouseWheel.aspxBind(this)); 3937 }, 3938 onMouseWheel: function(e) { 3939 ASPx.Evt.PreventEvent(e); 3940 var delta = ASPx.Evt.GetWheelDelta(e); 3941 if(ASPx.Browser.Firefox && ASPx.Browser.Version < 89) 3942 delta = delta / 0.03; 3943 this.DoScrollSessionToOffset(-delta); 3944 }, 3945 setParentNodeOverflow: function() { 3946 if(ASPx.Browser.MSTouchUI){ 3947 this.scrollableArea.parentNode.style.overflow = "auto"; 3948 this.scrollableArea.parentNode.style["-ms-overflow-style"] = "-ms-autohiding-scrollbar"; 3949 } 3950 }, 3951 GetScrolledAreaPosition: function() { 3952 return this.wrapper.GetScrollLeft() * this.orientation[0] 3953 + this.wrapper.GetScrollTop() * this.orientation[1]; 3954 }, 3955 SetScrolledAreaPosition: function(pos) { 3956 this.wrapper.SetScrollLeft(pos * this.orientation[0]); 3957 this.wrapper.SetScrollTop(pos * this.orientation[1]); 3958 }, 3959 PrepareForScrollAnimation: function() { 3960 if(!this.scrollableArea) 3961 return; 3962 this.currentAcceleration = 0; 3963 this.startPos = this.GetScrolledAreaPosition(); 3964 this.busy = false; 3965 }, 3966 GetAnimationStep: function(dir) { 3967 var step = dir * (this.animationStep + this.currentAcceleration); 3968 var newPos = this.GetScrolledAreaPosition() + step; 3969 var requiredPos = this.startPos + dir * this.animationOffset; 3970 if((dir == 1 && newPos >= requiredPos) || (dir == -1 && newPos <= requiredPos)) { 3971 step = requiredPos - this.GetScrolledAreaPosition(); 3972 } 3973 return step; 3974 }, 3975 DoScrollSessionToOffset: function(offset) { 3976 var newScrollPos = this.GetScrolledAreaPosition() - offset; 3977 this.stopScrolling = false; 3978 if(this.onBeforeScrolling) 3979 this.onBeforeScrolling(this, offset); 3980 if(this.stopScrolling) return; 3981 newScrollPos = Math.min(newScrollPos, 0); 3982 this.SetScrolledAreaPosition(newScrollPos); 3983 if(this.onAfterScrolling) 3984 this.onAfterScrolling(this, offset); 3985 }, 3986 DoScrollSessionAnimation: function(direction) { 3987 if(!this.scrollableArea) 3988 return; 3989 this.SetScrolledAreaPosition(this.GetScrolledAreaPosition() + this.GetAnimationStep(direction)); 3990 var self = this; 3991 if(!this.ShouldStopScrollSessionAnimation()) { 3992 this.busy = true; 3993 this.currentAcceleration += this.animationAcceleration; 3994 window.setTimeout(function() { self.DoScrollSessionAnimation(direction); }, this.animationDelay); 3995 } else { 3996 this.busy = false; 3997 if(this.onAfterScrolling) 3998 this.onAfterScrolling(this, -direction); 3999 this.currentAcceleration = 0; 4000 window.setTimeout(function() { self.DoScroll(direction); }, this.scrollSessionInterval); 4001 } 4002 }, 4003 ShouldStopScrollSessionAnimation: function() { 4004 return (Math.abs(this.GetScrolledAreaPosition() - this.startPos) >= Math.abs(this.animationOffset)); 4005 }, 4006 DoScroll: function(direction) { 4007 if(!this.scrollableArea) 4008 return; 4009 if(!this.busy && !this.stopScrolling) { 4010 if(this.onBeforeScrolling) 4011 this.onBeforeScrolling(this, -direction); 4012 if(this.stopScrolling) return; 4013 this.PrepareForScrollAnimation(); 4014 this.DoScrollSessionAnimation(direction); 4015 } 4016 }, 4017 StartScrolling: function(direction, delay, step) { 4018 this.stopScrolling = false; 4019 this.animationDelay = delay; 4020 this.animationStep = step; 4021 this.DoScroll(-direction); 4022 }, 4023 StopScrolling: function() { 4024 this.stopScrolling = true; 4025 }, 4026 IsStopped: function() { 4027 return this.stopScrolling; 4028 }, 4029 IsInProgress: function() { 4030 return this.busy; 4031 } 4032 }); 4033 var MouseScrollingManager = ASPx.CreateClass(ScrollingManager, { 4034 constructor: function(owner, options) { 4035 this.mouseEventsElement = options.mouseEventsElement; 4036 this.preventOuterScroll = options.preventOuterScroll; 4037 this.enableMouseScrollInternal = true; 4038 this.constructor.prototype.constructor.call(this, owner, options); 4039 }, 4040 Initialize: function() { 4041 ASPx.ScrollingManager.prototype.Initialize.call(this); 4042 this.initializeMouseScroll(); 4043 }, 4044 initializeMouseScroll: function() { 4045 this.mouseDown = false; 4046 this.vx = 0; 4047 this.prevX = 0; 4048 this.scrollTime = null; 4049 this.mouseScrollAcceleration = 0.7; 4050 this.mouseScrollTimeStep = 30; 4051 ASPx.Evt.AttachEventToElement(this.mouseEventsElement, ASPx.TouchUIHelper.touchMouseDownEventName, this.startMouseScroll.aspxBind(this)); 4052 }, 4053 scrollToOffset: function(mouseOffset) { 4054 var newOffset = this.GetScrolledAreaPosition() - mouseOffset; 4055 if(this.getValidNewScrollOffset) 4056 newOffset = this.getValidNewScrollOffset(newOffset); 4057 this.SetScrolledAreaPosition(newOffset); 4058 }, 4059 preventTextSelectionAndOuterDivScrollOnScroll: function(e) { 4060 if(this.preventOuterScroll) 4061 ASPx.Evt.PreventEvent(e); 4062 ASPx.Selection.Clear(); 4063 },
4064 mouseScroll: function(e) { 4065 if(!this.mouseDown) return; 4066 this.preventTextSelectionAndOuterDivScrollOnScroll(e); 4067 var x = ASPx.Evt.GetEventX(e), 4068 dx = this.prevX - x, 4069 dt = new Date() - this.scrollTime; 4070 if(dt < 1) dt = 1; 4071 this.vx = dx / dt; 4072 this.scrollToOffset(dx); 4073 this.prevX = x; 4074 this.scrollTime = new Date(); 4075 }, 4076 startMouseScroll: function(e) { 4077 if(!this.enableMouseScrollInternal) return; 4078 this.detachMouseEvents(); 4079 this.mouseMoveHandler = this.mouseScroll.aspxBind(this); 4080 this.mouseUpHandler = this.stopMouseScroll.aspxBind(this); 4081 ASPx.Evt.AttachEventToElement(document, ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler); 4082 ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler); 4083 this.mouseDown = true; 4084 window.clearTimeout(this.inertialStopTimerId); 4085 this.prevX = ASPx.Evt.GetEventX(e); 4086 this.scrollTime = new Date(); 4087 }, 4088 detachMouseEvents: function() { 4089 ASPx.Evt.DetachEventFromElement(document, ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler); 4090 ASPx.Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler); 4091 }, 4092 stopMouseScroll: function() { 4093 this.detachMouseEvents(); 4094 this.mouseDown = false; 4095 this.inertialStopTimerId = window.setTimeout(function() { 4096 this.vx *= this.mouseScrollAcceleration; 4097 if(Math.abs(this.vx) < 0.1) { 4098 this.vx = 0; 4099 if(this.onAfterScrolling) 4100 this.onAfterScrolling(this); 4101 return; 4102 } 4103 var dx = Math.ceil(this.vx * this.mouseScrollTimeStep); 4104 this.scrollToOffset(dx); 4105 this.stopMouseScroll(); 4106 }.aspxBind(this), this.mouseScrollTimeStep); 4107 } 4108 }); 4109 ScrollingManager.scrollWrapper = function(scrollableArea, useMarginForPosition) { 4110 this.scrollableArea = scrollableArea; 4111 this.useMarginForPosition = useMarginForPosition; 4112 this.Initialize(); 4113 }; 4114 ScrollingManager.scrollWrapper.prototype = { 4115 Initialize: function() { 4116 if(this.useMarginForPosition) { 4117 this.leftScrollProperty = "margin-left"; 4118 this.topScrollProperty = "margin-top"; 4119 } else { 4120 this.scrollableArea.style.position = "relative"; 4121 this.scrollableArea.parentNode.style.position = "relative"; 4122 this.leftScrollProperty = "left"; 4123 this.topScrollProperty = "top"; 4124 } 4125 }, 4126 GetScrollLeft: function() { return ASPx.PxToFloat(this.scrollableArea.style[this.leftScrollProperty]); }, 4127 GetScrollTop: function() { return ASPx.PxToFloat(this.scrollableArea.style[this.topScrollProperty]); }, 4128 SetScrollLeft: function(value) { 4129 this.scrollableArea.style[this.leftScrollProperty] = value + "px"; 4130 }, 4131 SetScrollTop: function(value) { 4132 this.scrollableArea.style[this.topScrollProperty] = value + "px"; 4133 } 4134 }; 4135 ScrollingManager.scrollWrapperTouchUI = function(scrollableArea, onScroll){ 4136 this.scrollableArea = scrollableArea; 4137 this.scrollTimerId = -1; 4138 this.onScroll = onScroll; 4139 this.Initialize(onScroll); 4140 }; 4141 ScrollingManager.scrollWrapperTouchUI.prototype = { 4142 Initialize: function(){ 4143 var div = this.scrollableArea.parentNode; 4144 var timeout = ASPx.Browser.MSTouchUI ? 500 : 1000; 4145 var nativeScrollSupported = ASPx.TouchUIHelper.nativeScrollingSupported(); 4146 this.onScrollCore = function(){ 4147 ASPx.Timer.ClearTimer(this.scrollTimerId); 4148 if(this.onScrollLocked) return; 4149 this.scrollTimerId = window.setTimeout(this.onScrollByTimer, timeout); 4150 }.aspxBind(this); 4151 this.onScrollByTimer = function(){ 4152 if(this.onScrollLocked) return; 4153 var direction = this.lastScrollTop < div.scrollTop ? 1 : -1; 4154 this.lastScrollTop = div.scrollTop; 4155 this.onScrollLocked = true; 4156 this.onScroll(direction); 4157 this.onScrollLocked = false; 4158 }.aspxBind(this); 4159 this.lastScrollTop = div.scrollTop; 4160 var onscroll = nativeScrollSupported ? this.onScrollCore : this.onScrollByTimer; 4161 ASPx.Evt.AttachEventToElement(div, "scroll", onscroll); 4162 if(ASPx.Browser.WebKitTouchUI) 4163 this.scrollExtender = ASPx.TouchUIHelper.MakeScrollable(div, {showHorizontalScrollbar: false}); 4164 }, 4165 GetScrollLeft: function(){ return -this.scrollableArea.parentNode.scrollLeft; }, 4166 GetScrollTop: function(){ return -this.scrollableArea.parentNode.scrollTop; }, 4167 SetScrollLeft: function(value){ 4168 this.onScrollLocked = true; 4169 this.scrollableArea.parentNode.scrollLeft = -value; 4170 this.onScrollLocked = false; 4171 }, 4172 SetScrollTop: function(value){ 4173 this.onScrollLocked = true; 4174 this.scrollableArea.parentNode.scrollTop = -value; 4175 this.onScrollLocked = false; 4176 } 4177 }; 4178 ASPx.ScrollingManager = ScrollingManager; 4179 ASPx.MouseScrollingManager = MouseScrollingManager; 4180})(); 4181(function() { 4182var Constants = { 4183 MIIdSuffix: "_DXI", 4184 MMIdSuffix: "_DXM", 4185 SBIdSuffix: "_DXSB", 4186 SBUIdEnd: "_U", 4187 SBDIdEnd: "_D", 4188 ATSIdSuffix: "_ATS", 4189 SampleCssClassNameForImageElement: "SAMPLE_CSS_CLASS", 4190 ImagePostfix: "Img", 4191 PopupImagePostfix: "PImg", 4192 ItemPopoutElementPostfix: "P", 4193 ItemContentElementPostfix: "T" 4194}; 4195var SLIDE_DURATION_VALUE = 300; 4196var SIDE_MENU_ZINDEX_VALUE = 10000; 4197var MENU_PREFIX_CLASS_NAME = 'dxm'; 4198var SLIDE_PANEL_EXPANDED_CLASS_NAME = MENU_PREFIX_CLASS_NAME + '-expanded'; 4199var BREAD_CRUMBS_CLASS_NAME = MENU_PREFIX_CLASS_NAME + '-bread-crumbs';
4200var OVERLAY_PANEL_CLASS_NAME = MENU_PREFIX_CLASS_NAME + '-overlay'; 4201var BURGER_CLASS_NAME = MENU_PREFIX_CLASS_NAME + '-side-menu-button'; 4202var BACK_ICON_CLASS_NAME = MENU_PREFIX_CLASS_NAME + '-back-icon'; 4203var NO_MAIN_POP_OUT_CLASS_NAME = MENU_PREFIX_CLASS_NAME + '-no-main-popout'; 4204var TEMPORARY_VISIBILITY_CLASS_NAME = MENU_PREFIX_CLASS_NAME + '-temp-visibility'; 4205var SIDE_MENU_CLASS_NAME = MENU_PREFIX_CLASS_NAME + '-side-menu-mode'; 4206var PRE_HOVERED_ELEMENT_CLASS_NAME = MENU_PREFIX_CLASS_NAME + '-pre-hovered'; 4207var PRE_SELECTED_ELEMENT_CLASS_NAME = MENU_PREFIX_CLASS_NAME + '-pre-selected'; 4208var MenuItemInfo = ASPx.CreateClass(null, { 4209 constructor: function(menu, indexPath) { 4210 var itemElement = menu.GetItemElement(indexPath); 4211 this.clientHeight = itemElement.clientHeight; 4212 this.clientWidth = itemElement.clientWidth; 4213 this.clientTop = ASPx.GetClientTop(itemElement); 4214 this.clientLeft = ASPx.GetClientLeft(itemElement); 4215 this.offsetHeight = itemElement.offsetHeight; 4216 this.offsetWidth = itemElement.offsetWidth; 4217 this.offsetTop = 0; 4218 this.offsetLeft = 0; 4219 } 4220}); 4221var MenuCssClasses = {}; 4222MenuCssClasses.Prefix = "dxm-"; 4223MenuCssClasses.Menu = "dxmLite"; 4224MenuCssClasses.BorderCorrector = "dxmBrdCor"; 4225MenuCssClasses.Disabled = MenuCssClasses.Prefix + "disabled"; 4226MenuCssClasses.MainMenu = MenuCssClasses.Prefix + "main"; 4227MenuCssClasses.PopupMenu = MenuCssClasses.Prefix + "popup"; 4228MenuCssClasses.ItemTemplate = MenuCssClasses.Prefix + "tmpl"; 4229MenuCssClasses.HorizontalMenu = MenuCssClasses.Prefix + "horizontal"; 4230MenuCssClasses.VerticalMenu = MenuCssClasses.Prefix + "vertical"; 4231MenuCssClasses.NoWrapMenu = MenuCssClasses.Prefix + "noWrap"; 4232MenuCssClasses.AutoWidthMenu = MenuCssClasses.Prefix + "autoWidth"; 4233MenuCssClasses.CalculateMenu = MenuCssClasses.Prefix + "calc"; 4234MenuCssClasses.DX = "dx"; 4235MenuCssClasses.Separator = MenuCssClasses.Prefix + "separator"; 4236MenuCssClasses.Spacing = MenuCssClasses.Prefix + "spacing"; 4237MenuCssClasses.AlignSpacing = MenuCssClasses.Prefix + "alignSpacing"; 4238MenuCssClasses.Gutter = MenuCssClasses.Prefix + "gutter"; 4239MenuCssClasses.WithoutImages = MenuCssClasses.Prefix + "noImages"; 4240MenuCssClasses.Item = MenuCssClasses.Prefix + "item"; 4241MenuCssClasses.ItemHovered = MenuCssClasses.Prefix + "hovered"; 4242MenuCssClasses.ItemSelected = MenuCssClasses.Prefix + "selected"; 4243MenuCssClasses.ItemChecked = MenuCssClasses.Prefix + "checked"; 4244MenuCssClasses.ItemWithoutImage = MenuCssClasses.Prefix + "noImage"; 4245MenuCssClasses.ItemWithSubMenu = MenuCssClasses.Prefix + "subMenu"; 4246MenuCssClasses.ItemDropDownMode = MenuCssClasses.Prefix + "dropDownMode"; 4247MenuCssClasses.ItemWithoutSubMenu = MenuCssClasses.Prefix + "noSubMenu"; 4248MenuCssClasses.AdaptiveMenuItem = MenuCssClasses.Prefix + "ami"; 4249MenuCssClasses.AdaptiveFakeMenuItem = MenuCssClasses.Prefix + "fami"; 4250MenuCssClasses.AdaptiveMenuItemSpacing = MenuCssClasses.Prefix + "amis"; 4251MenuCssClasses.AdaptiveMenu = MenuCssClasses.Prefix + "am"; 4252MenuCssClasses.AdaptiveMenuHiddenElement = MenuCssClasses.Prefix + "amhe"; 4253MenuCssClasses.ContentContainer = MenuCssClasses.Prefix + "content"; 4254MenuCssClasses.ContentContainerWithVerticalAlignment = MenuCssClasses.Prefix + "valign"; 4255MenuCssClasses.Image = MenuCssClasses.Prefix + "image"; 4256MenuCssClasses.PopOutContainer = MenuCssClasses.Prefix + "popOut"; 4257MenuCssClasses.PopOutImage = MenuCssClasses.Prefix + "pImage"; 4258MenuCssClasses.ImageLeft = MenuCssClasses.Prefix + "image-l"; 4259MenuCssClasses.ImageRight = MenuCssClasses.Prefix + "image-r"; 4260MenuCssClasses.ImageTop = MenuCssClasses.Prefix + "image-t"; 4261MenuCssClasses.ImageBottom = MenuCssClasses.Prefix + "image-b"; 4262MenuCssClasses.ScrollArea = MenuCssClasses.Prefix + "scrollArea"; 4263MenuCssClasses.ScrollUpButton = MenuCssClasses.Prefix + "scrollUpBtn"; 4264MenuCssClasses.ScrollDownButton = MenuCssClasses.Prefix + "scrollDownBtn"; 4265MenuCssClasses.ItemClearElement = MenuCssClasses.DX + "-clear"; 4266MenuCssClasses.ItemTextElement = MenuCssClasses.Prefix + "contentText"; 4267MenuCssClasses.SmallImage = MenuCssClasses.DX + "-small-image"; 4268var MenuRenderHelper = ASPx.CreateClass(null, { 4269 constructor: function(menu) { 4270 this.menu = menu; 4271 this.itemLinkMode = "ContentBounds"; 4272 this.elementsToHide = []; 4273 }, 4274 InlineInitializeElements: function() { 4275 if(!this.menu.isPopupMenu) 4276 this.InlineInitializeMainMenuElements(this.menu.GetMainElement()); 4277 else 4278 this.InlineInitializePopupMenuElements(this.menu.GetMainElement()); 4279 var popupMenuElements = this.GetPopupMenuElements(this.menu.GetMainElement()); 4280 for(var i = 0; i < popupMenuElements.length; i++) { 4281 if(popupMenuElements[i] == this.menu.GetMainElement()) continue; 4282 this.InlineInitializePopupMenuElements(popupMenuElements[i]); 4283 } 4284 }, 4285 InlineInitializeSubMenuElements: function(parentItemIndexPath) { 4286 var popupMenuElements = this.GetPopupMenuElements(this.menu.GetMainElement()); 4287 for(var i = 0; i < popupMenuElements.length; i++) { 4288 if(popupMenuElements[i].id.indexOf(Constants.MMIdSuffix + parentItemIndexPath + "_") > 0) 4289 this.InlineInitializePopupMenuElements(popupMenuElements[i]); 4290 } 4291 }, 4292 InlineInitializeScrollElements: function(indexPath, menuElement) { 4293 var scrollArea = ASPx.GetNodeByClassName(menuElement, MenuCssClasse
4293s.ScrollArea); 4294 if(scrollArea) scrollArea.id = this.menu.GetScrollAreaId(indexPath); 4295 this.InitializeScrollButton(menuElement, MenuCssClasses.ScrollUpButton, this.menu.GetScrollUpButtonId(indexPath)); 4296 this.InitializeScrollButton(menuElement, MenuCssClasses.ScrollDownButton, this.menu.GetScrollDownButtonId(indexPath)); 4297 }, 4298 InitializeScrollButton: function(menuElement, buttonClassName, id) { 4299 var scrollButton = ASPx.GetNodeByClassName(menuElement, buttonClassName); 4300 if(!scrollButton) return; 4301 scrollButton.id = id; 4302 if(this.menu.NeedCreateItemsOnClientSide()) { 4303 ASPx.GetStateController().AddHoverItem(id, ["dxm-scrollBtnHovered"], [""]); 4304 ASPx.GetStateController().AddPressedItem(id, ["dxm-scrollBtnPressed"], [""]); 4305 } 4306 }, 4307 InlineInitializeMainMenuElements: function(menuElement) { 4308 this.menu.CheckElementsCache(menuElement); 4309 var contentElement = this.GetContentElement(menuElement); 4310 if(contentElement.className.indexOf("dxm-ti") > 1) 4311 this.itemLinkMode = "TextAndImage"; 4312 else if(contentElement.className.indexOf("dxm-t") > -1) 4313 this.itemLinkMode = "TextOnly"; 4314 var itemElements = this.GetItemElements(menuElement); 4315 for(var i = 0; i < itemElements.length; i++) 4316 this.InlineInitializeItemElement(itemElements[i], "", i); 4317 this.InlineInitializeScrollElements("", menuElement); 4318 }, 4319 InlineInitializePopupMenuElements: function(parentElement) { 4320 parentElement.style.position = "absolute"; 4321 var indexPath = this.GetSubMenuIndexPathByMenuParentElement(parentElement); 4322 var borderCorrectorElement = ASPx.GetNodeByClassName(parentElement, MenuCssClasses.BorderCorrector); 4323 if(borderCorrectorElement != null) { 4324 borderCorrectorElement.id = this.menu.GetMenuBorderCorrectorElementId(indexPath); 4325 borderCorrectorElement.style.position = "absolute"; 4326 parentElement.removeChild(borderCorrectorElement); 4327 parentElement.parentNode.appendChild(borderCorrectorElement); 4328 } 4329 this.InlineInitializePopupMenuMenuElement(parentElement, indexPath); 4330 }, 4331 GetSubMenuIndexPathByMenuParentElement: function(element){ 4332 return this.menu.GetMenuIndexPathById(element.id); 4333 }, 4334 InlineInitializePopupMenuMenuElement: function(parentElement, indexPath) { 4335 var menuElement = ASPx.GetNodeByClassName(parentElement, MenuCssClasses.PopupMenu); 4336 menuElement.id = this.menu.GetMenuMainElementId(indexPath); 4337 this.InlineInitializePopupMenuContentElements(parentElement, menuElement, indexPath); 4338 }, 4339 InlineInitializePopupMenuContentElements: function(parentElement, menuElement, indexPath) { 4340 this.menu.CheckElementsCache(menuElement); 4341 var contentElement = this.GetContentElement(menuElement); 4342 if(contentElement != null) { 4343 var itemElements = this.GetItemElements(menuElement); 4344 var parentIndexPath = parentElement == this.menu.GetMainElement() ? "" : indexPath; 4345 for(var i = 0; i < itemElements.length; i++) { 4346 var itemElementId = itemElements[i].id; 4347 if(itemElementId && aspxGetMenuCollection().GetMenu(itemElementId) != this.menu) 4348 continue; 4349 this.InlineInitializeItemElement(itemElements[i], parentIndexPath, i); 4350 } 4351 } 4352 this.InlineInitializeScrollElements(indexPath, menuElement); 4353 }, 4354 HasSubMenuTemplate: function(menuElement) { 4355 var contentElement = this.GetContentElement(menuElement); 4356 return contentElement && (contentElement.tagName != "UL" || !ASPx.GetNodesByPartialClassName(contentElement, MenuCssClasses.ContentContainer).length); 4357 }, 4358 InlineInitializeItemElement: function(itemElement, parentIndexPath, visibleIndex) { 4359 function getItemIndex(visibleIndex) { 4360 var itemData = parentItemData[Math.max(visibleIndex, 0)]; 4361 return itemData.constructor == Array 4362 ? itemData[0] 4363 : itemData; 4364 } 4365 var parentItemData = this.menu.renderData[parentIndexPath], 4366 prepareItemOnClick = parentItemData[visibleIndex].constructor == Array, 4367 indexPathPrefix = parentIndexPath + (parentIndexPath != "" ? ASPx.ItemIndexSeparator : ""), 4368 indexPath = indexPathPrefix + getItemIndex(visibleIndex); 4369 itemElement.id = this.menu.GetItemElementId(indexPath); 4370 if(this.canAssignAccessibilityEventsToChildrenLinks()) 4371 ASPx.AssignAccessibilityEventsToChildrenLinks(itemElement, true); 4372 if(this.canContainSeparators()) { 4373 var separatorElement = itemElement.previousSibling; 4374 if(separatorElement && separatorElement.className) { 4375 if(ASPx.ElementContainsCssClass(separatorElement, MenuCssClasse
4375s.Spacing)) 4376 separatorElement.id = this.menu.GetItemIndentElementId(indexPath); 4377 else if(ASPx.ElementContainsCssClass(separatorElement, MenuCssClasses.Separator)) 4378 separatorElement.id = this.menu.GetItemSeparatorElementId(indexPath); 4379 } 4380 } 4381 var contentElement = this.GetItemContentElement(itemElement); 4382 if(contentElement != null) { 4383 contentElement.id = this.menu.GetItemContentElementId(indexPath); 4384 if (this.canContainImageElement()) { 4385 var imageElement = ASPx.GetNodeByClassName(contentElement, MenuCssClasses.Image); 4386 if(imageElement == null) { 4387 var hyperLinkElement = ASPx.GetNodeByClassName(contentElement, MenuCssClasses.DX); 4388 if(hyperLinkElement != null) 4389 imageElement = ASPx.GetNodeByClassName(hyperLinkElement, MenuCssClasses.Image); 4390 } 4391 if(imageElement != null) 4392 imageElement.id = this.menu.GetItemImageId(indexPath); 4393 } 4394 } 4395 else 4396 prepareItemOnClick = false; 4397 this.InlineInitializeItemPopOutElement(itemElement, indexPath); 4398 if(prepareItemOnClick) 4399 this.InlineInitializeItemOnClick(itemElement, indexPath); 4400 if(ASPx.ElementContainsCssClass(itemElement, MenuCssClasses.ItemSelected)) 4401 this.menu.serverSideSelectedItemPath = indexPath; 4402 }, 4403 canAssignAccessibilityEventsToChildrenLinks: function () { return true; }, 4404 canContainSeparators: function () { return true; }, 4405 canContainImageElement: function () { return true; }, 4406 InlineInitializeItemPopOutElement: function(itemElement, indexPath) { 4407 var popOutElement = this.GetItemPopOutElement(itemElement); 4408 if(popOutElement != null) { 4409 popOutElement.id = this.menu.GetItemPopOutElementId(indexPath); 4410 var popOutImageElement = ASPx.GetNodeByClassName(popOutElement, MenuCssClasses.PopOutImage); 4411 if(popOutImageElement != null) 4412 popOutImageElement.id = this.menu.GetItemPopOutImageId(indexPath); 4413 } 4414 }, 4415 InlineInitializeItemOnClick: function(itemElement, indexPath) { 4416 var name = this.menu.name; 4417 var onclick = this.GetItemOnClick(name, itemElement, indexPath); 4418 if(this.menu.IsDropDownItem(indexPath)) { 4419 var contentElement = this.menu.GetItemContentElement(indexPath); 4420 var dropDownElement = this.menu.GetItemPopOutElement(indexPath); 4421 var dropDownOnclick = this.GetItemDropdownOnClick(name, itemElement, indexPath); 4422 this.AssignItemOnClickToElement(contentElement, this.itemLinkMode, onclick); 4423 this.AssignItemOnClickToElement(dropDownElement, this.itemLinkMode, dropDownOnclick); 4424 } 4425 else 4426 this.AssignItemOnClickToElement(itemElement, this.itemLinkMode, onclick); 4427 }, 4428 AssignItemOnClickToElement: function(element, itemLinkMode, method) { 4429 switch(itemLinkMode){ 4430 case "ContentBounds": 4431 this.AssignItemOnClickToElementCore(element, method); 4432 break; 4433 case "TextOnly": 4434 var textElement = ASPx.GetNodeByTagName(element, "A"); 4435 if(!textElement) 4436 textElement = ASPx.GetNodeByTagName(element, "SPAN"); 4437 if(textElement) 4438 this.AssignItemOnClickToElementCore(textElement, method); 4439 break; 4440 case "TextAndImage": 4441 var linkElement = ASPx.GetNodeByTagName(element, "A"); 4442 if(linkElement) 4443 this.AssignItemOnClickToElementCore(linkElement, method); 4444 else{ 4445 var textElement = ASPx.GetNodeByTagName(element, "SPAN"); 4446 if(textElement) 4447 this.AssignItemOnClickToElementCore(textElement, method); 4448 var imageElement = ASPx.GetNodeByTagName(element, "IMG"); 4449 if(imageElement) 4450 this.AssignItemOnClickToElementCore(imageElement, method); 4451 } 4452 break; 4453 } 4454 }, 4455 AssignItemOnClickToElementCore: function(element, method) { 4456 ASPx.Evt.AttachEventToElement(element, "click", method); 4457 }, 4458 GetItemOnClick: function(name, itemElement, indexPath) { 4459 var menu = this.menu; 4460 var sendPostBackHandler = function() { 4461 menu.SendPostBack("CLICK:" + indexPath); 4462 }; 4463 var itemClickHandler = function(e) { 4464 ASPx.MIClick(e, name, indexPath); 4465 }; 4466 var itemLink = this.GetItemLinkElement(itemElement); 4467 var handler = menu.autoPostBack && !menu.IsClientSideEventsAssigned() && (!itemLink || itemLink.href === "") 4468 ? sendPostBackHandler 4469 : itemClickHandler; 4470 return function(e) { 4471 if(!itemElement.clientDisabled) 4472 handler(e); 4473 }; 4474 }, 4475 GetItemDropdownOnClick: function(name, itemElement, indexPath) { 4476 return function(e) { 4477 if(!itemElement.clientDisabled) 4478 ASPx.MIDDClick(e, name, indexPath); 4479 }; 4480 }, 4481 ChangeItemEnabledAttributes: function(itemElement, enabled, accessibilityCompliant) { 4482 if(!itemElement) return; 4483 itemElement.clientDisabled = !enabled; 4484 ASPx.Attr.ChangeStyleAttributesMethod(enabled)(itemElement, "cursor"); 4485 var hyperLink = this.GetItemLinkElement(itemElement); 4486 if(hyperLink) 4487 this.ChangeItemLinkEnabledAttributes(hyperLink, itemElement, enabled, accessibilityCompliant); 4488 }, 4489 ChangeItemLinkEnabledAttributes: function(hyperLink, itemElement, enabled, accessibilityCompliant) { 4490 if(accessibilityCompliant) { 4491 var action = enabled ? ASPx.Attr.RemoveAttribute : ASPx.Attr.SetAttribute; 4492 action(hyperLink, "aria-disabled", "true"); 4493 } 4494 ASPx.Attr.ChangeAttributesMethod(enabled)(hyperLink, "href");
4495 if(accessibilityCompliant && !enabled && itemElement.enabled) 4496 hyperLink.href = ASPx.AccessibilityEmptyUrl; 4497 }, 4498 GetPopupMenuElements: function(menuElement) { 4499 return ASPx.GetChildNodesByTagName(menuElement.parentNode, "DIV"); 4500 }, 4501 GetContentElement: function(menuElement) { 4502 return ASPx.CacheHelper.GetCachedElement(this, "contentElement", 4503 function() { 4504 var contentElement = ASPx.GetNodeByTagName(menuElement, "DIV", 0); 4505 if(contentElement && contentElement.className == MenuCssClasses.DX && contentElement.parentNode == menuElement) 4506 return contentElement; 4507 contentElement = ASPx.GetNodeByTagName(menuElement, "UL", 0); 4508 if(contentElement) 4509 return contentElement; 4510 return ASPx.GetNodeByTagName(menuElement, "TABLE", 0); 4511 }, menuElement); 4512 }, 4513 GetItemElements: function(menuElement) { 4514 return ASPx.CacheHelper.GetCachedElements(this, "itemElements", 4515 function() { 4516 var contentElement = this.GetContentElement(menuElement); 4517 return contentElement ? ASPx.GetNodesByClassName(contentElement, MenuCssClasses.Item) : null; 4518 }, menuElement); 4519 }, 4520 GetSpacingElements: function(menuElement) { 4521 return ASPx.CacheHelper.GetCachedElements(this, "spacingElements", 4522 function() { 4523 var contentElement = this.GetContentElement(menuElement); 4524 return contentElement ? ASPx.GetNodesByClassName(contentElement, MenuCssClasses.Spacing) : null; 4525 }, menuElement); 4526 }, 4527 GetAlignSpacingElements: function(menuElement) { 4528 return ASPx.CacheHelper.GetCachedElements(this, "alignSpacingElements", 4529 function() { 4530 var contentElement = this.GetContentElement(menuElement); 4531 return contentElement ? ASPx.GetNodesByClassName(contentElement, MenuCssClasses.AlignSpacing) : null; 4532 }, menuElement); 4533 }, 4534 GetSeparatorElements: function(menuElement) { 4535 return ASPx.CacheHelper.GetCachedElements(this, "separatorElements", 4536 function() { 4537 var contentElement = this.GetContentElement(menuElement); 4538 return contentElement ? ASPx.GetNodesByClassName(contentElement, MenuCssClasses.Separator) : null; 4539 }, menuElement); 4540 }, 4541 GetItemContentElement: function(itemElement) { 4542 return ASPx.CacheHelper.GetCachedElement(this, "contentElement", 4543 function() { 4544 return ASPx.GetNodeByClassName(itemElement, MenuCssClasses.ContentContainer); 4545 }, itemElement); 4546 }, 4547 GetItemPopOutElement: function(itemElement) { 4548 return ASPx.CacheHelper.GetCachedElement(this, "popOutElement", 4549 function() { 4550 return ASPx.GetNodeByClassName(itemElement, MenuCssClasses.PopOutContainer); 4551 }, itemElement); 4552 }, 4553 GetAdaptiveMenuItemElement: function(menuElement) { 4554 return ASPx.CacheHelper.GetCachedElement(this, "adaptiveMenuItemElement", 4555 function() { 4556 var contentElement = this.GetContentElement(menuElement); 4557 return contentElement ? ASPx.GetNodeByClassName(contentElement, this.menu.getAdaptiveMenuItemCssClass()) : null; 4558 }, menuElement); 4559 }, 4560 GetAdaptiveMenuItemSpacingElement: function(menuElement) { 4561 return ASPx.CacheHelper.GetCachedElement(this, "adaptiveMenuItemSpacingElement", 4562 function() { 4563 var contentElement = this.GetContentElement(menuElement); 4564 return contentElement ? ASPx.GetNodeByClassName(contentElement, this.menu.getAdaptiveMenuItemSpacingCssClass()) : null; 4565 }, menuElement); 4566 }, 4567 GetAdaptiveMenuElement: function(menuElement) { 4568 return ASPx.CacheHelper.GetCachedElement(this, "adaptiveMenuElement", 4569 function() { 4570 var adaptiveItemElement = this.GetAdaptiveMenuItemElement(menuElement); 4571 if(adaptiveItemElement){ 4572 var adaptiveItemIndexPath = this.menu.GetIndexPathById(adaptiveItemElement.id); 4573 var adaptiveMenuParentElement = this.menu.GetMenuElement(adaptiveItemIndexPath); 4574 if(adaptiveMenuParentElement) 4575 return this.menu.GetMenuMainElement(adaptiveMenuParentElement); 4576 } 4577 return null; 4578 }, menuElement); 4579 }, 4580 GetAdaptiveMenuContentElement: function(menuElement) { 4581 return ASPx.CacheHelper.GetCachedElement(this, "adaptiveMenuContentElement", 4582 function() { 4583 var adaptiveMenuElement = this.GetAdaptiveMenuElement(menuElement); 4584 return adaptiveMenuElement ? this.GetContentElement(adaptiveMenuElement) : null; 4585 }, menuElement); 4586 }, 4587 GetItemLinkElement: function(itemElement) { 4588 return ASPx.GetNodeByTagName(itemElement, "A", 0); 4589 }, 4590 CalculateMenuControl: function(menuElement, recalculate) { 4591 if(menuElement.offsetWidth === 0) return; 4592 this.PrecalculateMenuPopOuts(menuElement); 4593 var isVertical = this.menu.IsVertical(""); 4594 var isAutoWidth = ASPx.ElementContainsCssClass(menuElement, MenuCssClasse
4594s.AutoWidthMenu); 4595 var isNoWrap = ASPx.ElementContainsCssClass(menuElement, MenuCssClasses.NoWrapMenu); 4596 var contentElement = this.GetContentElement(menuElement); 4597 if(this.menu.enableAdaptivity) 4598 this.CalculateAdaptiveMainMenu(menuElement, contentElement, isVertical, isAutoWidth, isNoWrap, recalculate); 4599 else 4600 this.CalculateMainMenu(menuElement, contentElement, isVertical, isAutoWidth, isNoWrap, recalculate); 4601 }, 4602 CalculateMainMenu: function(menuElement, contentElement, isVertical, isAutoWidth, isNoWrap, recalculate) { 4603 var itemElements = this.GetItemElements(menuElement); 4604 this.PrecalculateMenuItems(menuElement, itemElements, recalculate); 4605 this.CalculateMenuItemsAutoWidth(menuElement, itemElements, isVertical, isAutoWidth); 4606 this.CalculateMinSize(menuElement, contentElement, itemElements, isVertical, isAutoWidth, isNoWrap, recalculate); 4607 this.CalculateMenuItems(menuElement, contentElement, itemElements, isVertical, recalculate); 4608 this.CalculateSeparatorsAndSpacers(menuElement, itemElements, contentElement, isVertical); 4609 }, 4610 PrecalculateMenuPopOuts: function(menuElement) { 4611 if(menuElement.popOutsPreCalculated) return; 4612 var elements = this.GetItemElements(menuElement); 4613 for(var i = 0; i < elements.length; i++) { 4614 var popOutElement = this.GetItemPopOutElement(elements[i]); 4615 if (popOutElement) 4616 popOutElement.style.display = "block"; 4617 } 4618 menuElement.popOutsPreCalculated = true; 4619 }, 4620 PrecalculateMenuItems: function(menuElement, itemElements, recalculate) { 4621 if(!recalculate) return; 4622 for(var i = 0; i < itemElements.length; i++) { 4623 var itemContentElement = this.GetItemContentElement(itemElements[i]); 4624 if(!itemContentElement || itemContentElement.offsetWidth === 0) continue; 4625 ASPx.SetElementFloat(itemContentElement, ""); 4626 ASPx.Attr.RestoreStyleAttribute(itemContentElement, "padding-left"); 4627 ASPx.Attr.RestoreStyleAttribute(itemContentElement, "padding-right"); 4628 this.ReCalculateMenuItemContent(itemElements[i], itemContentElement); 4629 } 4630 }, 4631 ReCalculateMenuItemContent: function(itemElement, itemContentElement) { 4632 for(var j = 0; j < itemElement.childNodes.length; j++) { 4633 var child = itemElement.childNodes[j]; 4634 if(!child.offsetWidth) continue; 4635 if(child !== itemContentElement) { 4636 ASPx.Attr.RestoreStyleAttribute(child, "margin-top"); 4637 ASPx.Attr.RestoreStyleAttribute(child, "margin-bottom"); 4638 } 4639 } 4640 }, 4641 CalculateMenuItemsAutoWidth: function(menuElement, itemElements, isVertical, isAutoWidth) { 4642 if(!isAutoWidth) return; 4643 for(var i = 0; i < itemElements.length; i++) 4644 ASPx.Attr.RestoreStyleAttribute(itemElements[i], "width"); 4645 if(!isVertical) { 4646 var autoWidthItemCount = 0; 4647 var adaptiveItemCssClass = this.menu.getAdaptiveMenuItemCssClass(); 4648 for(var i = 0; i < itemElements.length; i++) { 4649 if(ASPx.GetElementDisplay(itemElements[i]) && !ASPx.ElementHasCssClass(itemElements[i], adaptiveItemCssClass)) 4650 autoWidthItemCount++; 4651 } 4652 for(var i = 0; i < itemElements.length; i++) { 4653 if(autoWidthItemCount > 0 && !ASPx.ElementHasCssClass(itemElements[i], adaptiveItemCssClass) && (itemElements[i].style.width === "" || itemElements[i].autoWidth)) { 4654 ASPx.Attr.ChangeStyleAttribute(itemElements[i], "width", (100 / autoWidthItemCount) + "%"); 4655 itemElements[i].autoWidth = true; 4656 } 4657 } 4658 } 4659 }, 4660 CalculateMenuItems: function(menuElement, contentElement, itemElements, isVertical, recalculate) { 4661 if(contentElement.itemsCalculated && recalculate) 4662 contentElement.itemsCalculated = false; 4663 if(menuElement.offsetWidth === 0) return; 4664 if(contentElement.style.margin === "0px auto") 4665 ASPx.SetStyles(contentElement, { float: "none" }); 4666 var menuWidth = ASPx.GetCurrentStyle(menuElement).width; 4667 var menuRequireItemCorrection = isVertical && menuWidth; 4668 this.ApplyItemsVerticalAlignment(menuElement, itemElements); 4669 for(var i = 0; i < itemElements.length; i++) { 4670 if(!itemElements[i].style.width && !menuRequireItemCorrection) continue; 4671 if(ASPx.IsPercentageSize(itemElements[i].style.width) && contentElement.style.width === "") 4672 contentElement.style.width = "100%"; 4673 var itemContentElement = this.GetItemContentElement(itemElements[i]); 4674 if(!itemContentElement || itemContentElement.offsetWidth === 0) continue; 4675 if(!contentElement.itemsCalculated) { 4676 ASPx.Attr.RestoreStyleAttribute(itemContentElement, "padding-left"); 4677 ASPx.Attr.RestoreStyleAttribute(itemContentElement, "padding-right"); 4678 ASPx.SetElementFloat(itemContentElement, "none"); 4679 var itemContentCurrentStyle = ASPx.GetCurrentStyle(itemContentElement); 4680 if(!isVertical || (itemContentCurrentStyle.textAlign != "center" && menuWidth)) { 4681 var originalPaddingLeft = parseInt(itemContentCurrentStyle.paddingLeft); 4682 var originalPaddingRight = parseInt(itemContentCurrentStyle.paddingRight); 4683 var leftChildrenWidth = 0, rightChildrenWidth = 0;
4684 for(var j = 0; j < itemElements[i].childNodes.length; j++) { 4685 var child = itemElements[i].childNodes[j]; 4686 if(!child.offsetWidth) continue; 4687 if(child !== itemContentElement) { 4688 if(ASPx.GetElementFloat(child) === "right") 4689 rightChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child); 4690 else if(ASPx.GetElementFloat(child) === "left") 4691 leftChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child); 4692 } 4693 } 4694 if(leftChildrenWidth > 0 || rightChildrenWidth > 0){ 4695 ASPx.Attr.ChangeStyleAttribute(itemContentElement, "padding-left", (leftChildrenWidth + originalPaddingLeft) + "px"); 4696 ASPx.Attr.ChangeStyleAttribute(itemContentElement, "padding-right", (rightChildrenWidth + originalPaddingRight) + "px"); 4697 } 4698 } 4699 } 4700 ASPx.AdjustWrappedTextInContainer(itemContentElement); 4701 this.CalculateMenuItemContent(itemElements[i], itemContentElement); 4702 } 4703 contentElement.itemsCalculated = true; 4704 }, 4705 ApplyItemsVerticalAlignment: function(menuElement, itemElements) { 4706 var menuAlignmentInProgressClassName = "miva"; 4707 ASPx.AddClassNameToElement(menuElement, menuAlignmentInProgressClassName); 4708 if(!ASPx.IsExists(itemElements)) 4709 itemElements = this.GetItemElements(menuElement); 4710 for(var i = 0; i < itemElements.length; i++) { 4711 var itemContentElement = this.GetItemContentElement(itemElements[i]); 4712 if(itemContentElement && itemContentElement.offsetWidth !== 0 && itemContentElement.style.verticalAlign) { 4713 this.CalculateItemContentLineHeight(itemElements[i], itemContentElement); 4714 ASPx.RemoveClassNameFromElement(itemContentElement, MenuCssClasses.ContentContainerWithVerticalAlignment); 4715 } 4716 } 4717 ASPx.RemoveClassNameFromElement(menuElement, menuAlignmentInProgressClassName); 4718 }, 4719 CalculateItemContentLineHeight: function(itemElement, itemContentElement) { 4720 var lineHeight = 0; 4721 var maxHeight = itemElement.getBoundingClientRect().height - this.GetBordersAndPaddingSummaryHeight(itemElement); 4722 if(itemContentElement && itemContentElement.offsetHeight != maxHeight) 4723 lineHeight = maxHeight - this.GetBordersAndPaddingSummaryHeight(itemContentElement); 4724 if(lineHeight > 0) { 4725 var link = this.GetItemLinkElement(itemElement); 4726 if(link) 4727 ASPx.SetStyles(link, { lineHeight: lineHeight }, false); 4728 else 4729 ASPx.SetStyles(itemContentElement, { lineHeight: lineHeight }, false); 4730 } 4731 }, 4732 GetBordersAndPaddingSummaryHeight: function(element) { 4733 var elementStyle = getComputedStyle(element); 4734 return ASPx.GetVerticalBordersWidth(element, elementStyle) + ASPx.PxToFloat(elementStyle.paddingTop) + ASPx.PxToFloat(elementStyle.paddingBottom); 4735 }, 4736 CalculateMenuItemContent: function(itemElement, itemContentElement) { 4737 var itemContentFound = false; 4738 for(var j = 0; j < itemElement.childNodes.length; j++) { 4739 var child = itemElement.childNodes[j]; 4740 if(!child.offsetWidth) continue; 4741 var contentHeight = itemContentElement.offsetHeight; 4742 if(child !== itemContentElement) { 4743 if(itemContentFound) 4744 ASPx.Attr.ChangeStyleAttribute(child, "margin-top", "-" + contentHeight + "px"); 4745 else 4746 ASPx.Attr.ChangeStyleAttribute(child, "margin-bottom", "-" + contentHeight + "px"); 4747 } 4748 else 4749 itemContentFound = true; 4750 } 4751 }, 4752 CalculateSubMenu: function(parentElement, recalculate) { 4753 var menuElement = this.menu.GetMenuMainElement(parentElement); 4754 var contentElement = this.GetContentElement(menuElement); 4755 if(!parentElement.isSubMenuCalculated || recalculate) { 4756 menuElement.style.width = ""; 4757 menuElement.style.display = "table"; 4758 menuElement.style.borderSpacing = "0px"; 4759 parentElement.isSubMenuCalculated = true; 4760 if(contentElement.tagName === "UL") { 4761 if(contentElement.offsetWidth > 0) { 4762 menuElement.style.width = contentElement.offsetWidth + "px"; 4763 menuElement.style.display = ""; 4764 if(ASPx.IsPercentageSize(contentElement.style.width)) 4765 contentElement.style.width = menuElement.style.width; 4766 } 4767 else 4768 parentElement.isSubMenuCalculated = false; 4769 } 4770 } 4771 this.CalculateSubMenuItems(menuElement, contentElement, recalculate); 4772 }, 4773 CalculateSubMenuItems: function(menuElement, contentElement, recalculate) { 4774 var itemElements = this.GetItemElements(menuElement); 4775 this.PrecalculateMenuItems(menuElement, itemElements, recalculate); 4776 this.CalculateMenuItems(menuElement, contentElement, itemElements, true, recalculate); 4777 }, 4778 ResetMinSize: function() { 4779 var menuElement = this.menu.GetMainElement(); 4780 if(!menuElement.isMinSizeCalculated || this.menu.isVertical) return; 4781 var itemElements = this.GetItemElements(menuElement); 4782 var contentElement = this.GetContentElement(menuElement); 4783 if(!!contentElement.adaptiveInfo) 4784 itemElements = itemElements.concat(contentElement.adaptiveInfo.elements); 4785 for(var i = 0; i < itemElements.length; i++) 4786 this.ResetItemMinSize(itemElements[i]); 4787 menuElement.isMinSizeCalculated = false; 4788 }, 4789 ResetItemMinSize: function(itemElement) { 4790 itemElement.style.minWidth = ""; 4791 itemElement.isMinSizeCalculated = false; 4792 }, 4793 CalculateMinSize: function(menuElement, contentElement, itemElements, isVertical, isAutoWidth, isNoWrap, recalculate) { 4794 if(menuElement.isMinSizeCalculated && !recalculate) return; 4795 if(isVertical) { 4796 menuElement.style.minWidth = ""; 4797 if(!this.menu.IsSidePanelExpanded()) { 4798 ASPx.Attr.ChangeStyleAttribute(contentElement, "width", "1px"); 4799 for(var i = 0; i < itemElements.length; i++) { 4800 var itemContentElement = this.GetItemContentElement(itemElements[i]); 4801 if(!itemContentElement || itemElements[i].offsetWidth === 0) continue; 4802 this.CalculateItemMinSize(itemElements[i], recalculate); 4803 } 4804 ASPx.Attr.RestoreStyleAttribute(contentElement, "width"); 4805 } 4806 } 4807 else {
4808 ASPx.RemoveClassNameFromElement(menuElement, MenuCssClasses.NoWrapMenu); 4809 ASPx.RemoveClassNameFromElement(menuElement, MenuCssClasses.AutoWidthMenu); 4810 if(isAutoWidth || isNoWrap) 4811 menuElement.style.minWidth = ""; 4812 ASPx.Attr.ChangeStyleAttribute(menuElement, "width", "1px"); 4813 for(var i = 0; i < itemElements.length; i++) { 4814 var itemContentElement = this.GetItemContentElement(itemElements[i]); 4815 if((!itemContentElement || itemElements[i].offsetWidth === 0) && !ASPx.ElementHasCssClass(itemElements[i], MenuCssClasses.ItemTemplate)) continue; 4816 var textContainer = ASPx.GetNodeByTagName(itemContentElement, "SPAN", 0); 4817 if(textContainer && ASPx.GetCurrentStyle(textContainer).whiteSpace !== "nowrap") 4818 ASPx.AdjustWrappedTextInContainer(itemContentElement); 4819 this.CalculateItemMinSize(itemElements[i], recalculate); 4820 } 4821 if(isAutoWidth) 4822 ASPx.AddClassNameToElement(menuElement, MenuCssClasses.AutoWidthMenu); 4823 if(isNoWrap) 4824 ASPx.AddClassNameToElement(menuElement, MenuCssClasses.NoWrapMenu); 4825 if(isAutoWidth || isNoWrap) 4826 menuElement.style.minWidth = (contentElement.offsetWidth + ASPx.GetLeftRightBordersAndPaddingsSummaryValue(menuElement)) + "px"; 4827 ASPx.Attr.RestoreStyleAttribute(menuElement, "width"); 4828 } 4829 menuElement.isMinSizeCalculated = true; 4830 }, 4831 CalculateItemMinSize: function(itemElement, recalculate) { 4832 if(itemElement.isMinSizeCalculated && !recalculate) return; 4833 itemElement.style.minWidth = ""; 4834 var childrenWidth = 0; 4835 if(ASPx.ElementHasCssClass(itemElement, MenuCssClasses.ItemTemplate)) { 4836 ASPx.Attr.ChangeStyleAttribute(itemElement, "display", "table"); 4837 childrenWidth += itemElement.getBoundingClientRect().width; 4838 ASPx.Attr.RestoreStyleAttribute(itemElement, "display"); 4839 if(ASPx.Browser.Edge && ASPx.Browser.MajorVersion >= 16) 4840 var dummy = itemElement.clientWidth; 4841 } 4842 else { 4843 for(var j = 0; j < itemElement.childNodes.length; j++) { 4844 var child = itemElement.childNodes[j]; 4845 if(!child.offsetWidth) continue; 4846 var float = ASPx.GetElementFloat(child); 4847 if(float === "none") { 4848 childrenWidth = child.getBoundingClientRect().width; 4849 break; 4850 } 4851 else 4852 childrenWidth += child.getBoundingClientRect().width; 4853 } 4854 } 4855 itemElement.style.minWidth = Math.ceil(childrenWidth) + "px"; 4856 itemElement.isMinSizeCalculated = true; 4857 }, 4858 CalculateSeparatorsAndSpacers: function(menuElement, itemElements, contentElement, isVertical, isAutoWidth, isNoWrap) { 4859 var spacerElements = this.GetSpacingElements(menuElement); 4860 var spacerAndSeparatorElements = spacerElements.concat(this.GetSeparatorElements(menuElement)); 4861 for(var i = 0; i < spacerAndSeparatorElements.length; i++) { 4862 ASPx.Attr.RestoreStyleAttribute(spacerAndSeparatorElements[i], "height"); 4863 if(ASPx.Browser.Edge) { 4864 var savedDisplay = spacerAndSeparatorElements[i].style.display; 4865 spacerAndSeparatorElements[i].style.display = "none"; 4866 var temp = spacerAndSeparatorElements[i].offsetHeight; 4867 spacerAndSeparatorElements[i].style.display = savedDisplay; 4868 } 4869 } 4870 if(!isVertical && itemElements) { 4871 var menuHeight = 0; 4872 if(!isAutoWidth && !isNoWrap) { 4873 for(var i=0; i < itemElements.length; i++) { 4874 var newHeight = itemElements[i].getBoundingClientRect().height; 4875 if(newHeight > menuHeight) 4876 menuHeight = newHeight; 4877 } 4878 } 4879 for(var i = 0; i < spacerAndSeparatorElements.length; i++){ 4880 var separatorHeight = menuHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(spacerAndSeparatorElements[i]) - ASPx.GetTopBottomMargins(spacerAndSeparatorElements[i]); 4881 ASPx.Attr.ChangeStyleAttribute(spacerAndSeparatorElements[i], "height", separatorHeight + "px"); 4882 } 4883 for(var i = 0; i < spacerElements.length; i++){ 4884 if(!ASPx.ElementContainsCssClass(spacerElements[i], this.menu.getAdaptiveMenuItemSpacingCssClass())) 4885 spacerElements[i].style.minWidth = spacerElements[i].style.width; 4886 } 4887 this.calculateAlignSpacings(menuElement, contentElement); 4888 } 4889 }, 4890 calculateAlignSpacings: function(menuElement, contentElement) { 4891 var separatorElements = this.GetAlignSpacingElements(menuElement), 4892 separatorsCount = separatorElements.length; 4893 if(separatorsCount === 0) return; 4894 ASPx.Data.ForEach(separatorElements, function(separator) { 4895 separator.style.width = "0"; 4896 }); 4897 var unit = this.menu.enableAdaptivity ? "%" : "px"; 4898 var width = this.menu.enableAdaptivity ? 100 / separatorsCount : 4899 (ASPx.GetClearClientWidth(menuElement) - contentElement.offsetWidth) / separatorsCount; 4900 ASPx.Data.ForEach(separatorElements, function(separator) { 4901 separator.style.width = width + unit; 4902 }); 4903 if(!this.menu.enableAdaptivity) 4904 separatorElements[0].style.width = (width - 1) + unit; 4905 }, 4906 CalculateAdaptiveMainMenu: function(menuElement, contentElement, isVertical, isAutoWidth, isNoWrap, recalculate) { 4907 var adaptiveItemElement = this.GetAdaptiveMenuItemElement(menuElement); 4908 if(!adaptiveItemElement) return; 4909 var adaptiveItemSpacing = this.GetAdaptiveMenuItemSpacingElement(menuElement); 4910 if(adaptiveItemSpacing) adaptiveItemSpacing.style.width = ""; 4911 var adaptiveMenuElement = this.GetAdaptiveMenuElement(menuElement); 4912 if(!adaptiveMenuElement) return; 4913 var adaptiveMenuContentElement = this.GetAdaptiveMenuContentElement(menuElement); 4914 var adaptiveFakeMenuItem = ASPx.GetNodeByClassName(adaptiveMenuContentElement, MenuCssClasse
4914s.AdaptiveFakeMenuItem); 4915 if(adaptiveFakeMenuItem) ASPx.RemoveElement(adaptiveFakeMenuItem); 4916 if(!contentElement.adaptiveInfo) 4917 this.InitAdaptiveInfo(contentElement); 4918 var wasAdaptivity = contentElement.adaptiveInfo.hasAdaptivity; 4919 if(wasAdaptivity) { 4920 var previousSibling = this.GetAdaptiveItemElementPreviousSibling(adaptiveItemSpacing || adaptiveItemElement); 4921 this.RestoreAdaptiveItems(previousSibling, contentElement, isVertical); 4922 } 4923 if(!isVertical) { 4924 ASPx.SetElementDisplay(adaptiveItemElement, true); 4925 if(adaptiveItemSpacing) ASPx.SetElementDisplay(adaptiveItemSpacing, true); 4926 ASPx.AddClassNameToElement(menuElement, MenuCssClasses.CalculateMenu); 4927 ASPx.RemoveClassNameFromElement(menuElement, MenuCssClasses.NoWrapMenu); 4928 menuElement.style.minWidth = ""; 4929 var adaptiveItemWidth = adaptiveItemElement.offsetWidth; 4930 if(isAutoWidth) { 4931 ASPx.Attr.ChangeStyleAttribute(contentElement, "display", "none"); 4932 ASPx.Attr.ChangeStyleAttribute(menuElement, "min-width", ""); 4933 } 4934 var menuWidth = menuElement.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(menuElement) - adaptiveItemWidth; 4935 if(isAutoWidth) { 4936 ASPx.Attr.RestoreStyleAttribute(contentElement, "display"); 4937 ASPx.Attr.RestoreStyleAttribute(menuElement, "min-width"); 4938 } 4939 var additionalWidth = adaptiveItemWidth; 4940 if(adaptiveItemSpacing) { 4941 menuWidth -= adaptiveItemSpacing.offsetWidth; 4942 additionalWidth += adaptiveItemSpacing.offsetWidth; 4943 } 4944 var hasAdaptivity = this.HideAdaptiveItems(menuWidth, additionalWidth, contentElement, adaptiveMenuContentElement); 4945 contentElement.adaptiveInfo.hasAdaptivity = hasAdaptivity; 4946 this.SetAdaptiveItemElementVisibility(adaptiveItemElement, adaptiveItemSpacing, hasAdaptivity); 4947 contentElement.style.width = hasAdaptivity ? "100%" : ""; 4948 if(hasAdaptivity){ 4949 ASPx.CacheHelper.DropCache(adaptiveMenuElement); 4950 this.CalculateSubMenu(adaptiveMenuElement, true); 4951 this.CalculateSeparatorsAndSpacers(adaptiveMenuElement, null, adaptiveMenuContentElement, true); 4952 } 4953 if(isNoWrap) { 4954 ASPx.AddClassNameToElement(menuElement, MenuCssClasses.NoWrapMenu); 4955 if(adaptiveItemSpacing) adaptiveItemSpacing.style.width = hasAdaptivity ? "100%" : ""; 4956 } 4957 ASPx.RemoveClassNameFromElement(menuElement, MenuCssClasses.CalculateMenu); 4958 } 4959 else { 4960 this.SetAdaptiveItemElementVisibility(adaptiveItemElement, adaptiveItemSpacing, false); 4961 } 4962 if(wasAdaptivity || contentElement.adaptiveInfo.hasAdaptivity) 4963 ASPx.CacheHelper.DropCache(menuElement); 4964 if(!ASPx.GetNodesByTagName(adaptiveMenuContentElement, "li").length) 4965 adaptiveMenuContentElement.innerHTML = "<li class='" + MenuCssClasses.AdaptiveFakeMenuItem + "' role='menuitem'></li>"; 4966 this.CalculateMainMenu(menuElement, contentElement, isVertical, isAutoWidth, isNoWrap, wasAdaptivity || contentElement.adaptiveInfo.hasAdaptivity || recalculate); 4967 }, 4968 InitAdaptiveInfo: function(contentElement) { 4969 if(contentElement.adaptiveInfo) return; 4970 contentElement.adaptiveInfo = { }; 4971 contentElement.adaptiveInfo.elements = this.CreateAdaptiveElementsArray(contentElement); 4972 contentElement.adaptiveInfo.hasAdaptivity = false; 4973 }, 4974 GetAdaptiveItemElementByIndex: function(adaptiveInfo, index) { 4975 return adaptiveInfo.elements[index]; 4976 }, 4977 GetAdaptiveItemElementParent: function(adaptiveInfo, index) { 4978 return undefined; 4979 }, 4980 GetAdaptiveItemElementPreviousSibling: function(defaultPreviousSibling) { 4981 return defaultPreviousSibling; 4982 }, 4983 RestoreAdaptiveItems: function(previousSibling, contentElement, isVertical) { 4984 this.SetLastSeparatorsVisible(true, contentElement); 4985 for(var i = 0; i < contentElement.adaptiveInfo.elements.length; i++) { 4986 var element = this.GetAdaptiveItemElementByIndex(contentElement.adaptiveInfo, i); 4987 var isReplacedIndent = !element.parent; 4988 if(isReplacedIndent) 4989 ASPx.RemoveElement(ASPx.GetElementById(element.id)); 4990 var itemParentElement = this.GetAdaptiveItemElementParent(contentElement.adaptiveInfo, i) || contentElement; 4991 itemParentElement.insertBefore(element, previousSibling); 4992 ASPx.Attr.RestoreStyleAttribute(element, "width"); 4993 if(!isVertical) 4994 this.SetItemItemPopOutImageHorizontal(element);
4995 if(ASPx.ElementContainsCssClass(element, MenuCssClasses.Separator) || ASPx.ElementContainsCssClass(element, MenuCssClasses.Spacing)) 4996 ASPx.RemoveClassNameFromElement(element, MenuCssClasses.AdaptiveMenuHiddenElement); 4997 } 4998 if(this.menu.GetRootItem()) { 4999 for(var i = this.elementsToHide.length - 1; i >= 0; i--) { 5000 if(!this.elementsToHide[i]) continue; 5001 var indexPath = this.elementsToHide[i].indexPath; 5002 if(this.menu.GetItemByIndexPath(indexPath).GetVisible()) 5003 this.menu.UpdateItemCssClasses(indexPath, true); 5004 this.elementsToHide[i] = null; 5005 } 5006 } 5007 this.elementsToHide = []; 5008 }, 5009 SetLastSeparatorsVisible: function(isVisible, contentElement) { 5010 var elements = ASPx.GetChildElementNodes(contentElement); 5011 for(var i = 0; i < elements.length; i++) { 5012 var element = elements[i]; 5013 if(ASPx.ElementContainsCssClass(element, MenuCssClasses.Separator) || ASPx.ElementContainsCssClass(element, MenuCssClasses.Spacing)) 5014 ASPx.RemoveClassNameFromElement(element, MenuCssClasses.AdaptiveMenuHiddenElement); 5015 else 5016 break; 5017 } 5018 }, 5019 CreateAdaptiveElementsArray: function(contentElement) { 5020 var result = []; 5021 var elements = ASPx.GetChildElementNodes(contentElement); 5022 for(var i = 0; i < elements.length; i++) { 5023 if(this.CheckElementIsAdaptive(elements[i])) 5024 result.push(elements[i]); 5025 } 5026 return result; 5027 }, 5028 SetItemItemPopOutImageHorizontal: function(element) { 5029 var popOutElements = ASPx.GetNodesByPartialClassName(element, "dxWeb_mVerticalPopOut"); 5030 for(var i = 0; i < popOutElements.length; i++) 5031 popOutElements[i].className = popOutElements[i].className.replace("Vertical", "Horizontal"); 5032 }, 5033 CheckElementIsAdaptive: function(element) { 5034 return !ASPx.ElementHasCssClass(element, this.menu.getAdaptiveMenuItemCssClass()) && !ASPx.ElementHasCssClass(element, this.menu.getAdaptiveMenuItemSpacingCssClass()); 5035 }, 5036 CheckAdaptiveItemsWidth: function(contentElement, menuWidth, additionalWidth) { 5037 var itemsWidth = 0; 5038 var elements = ASPx.GetChildElementNodes(contentElement); 5039 for(var i = 0; i < elements.length; i++) { 5040 var element = elements[i]; 5041 if(this.CheckElementIsAdaptive(element) && element.offsetWidth > 0) 5042 itemsWidth += this.GetAdaptiveElementWidth(element); 5043 if(itemsWidth > menuWidth + additionalWidth) 5044 return false; 5045 } 5046 return true; 5047 }, 5048 GetAdaptiveElementWidth: function(element) { 5049 return element.style.minWidth !== "" ? 5050 parseInt(element.style.minWidth) + ASPx.GetHorizontalBordersWidth(element) + ASPx.GetLeftRightPaddings(element) : 5051 element.offsetWidth; 5052 }, 5053 HideAdaptiveItems: function(menuWidth, additionalWidth, contentElement, adaptiveMenuContentElement) { 5054 if(this.CheckAdaptiveItemsWidth(contentElement, menuWidth, additionalWidth)) 5055 return false; 5056 this.elementsToHide = []; 5057 var elementsToHide = this.elementsToHide; 5058 var adaptiveItemSpacingCssClass = this.menu.getAdaptiveMenuItemSpacingCssClass(); 5059 var addToHide = function(index, indexPath, itemElement, separatorElement, indentElement, insteadSeparatorElement) { 5060 if(!itemElement) return; 5061 if(separatorElement && ASPx.ElementHasCssClass(separatorElement, adaptiveItemSpacingCssClass)) 5062 separatorElement = null; 5063 if(indentElement && ASPx.ElementHasCssClass(indentElement, adaptiveItemSpacingCssClass)) 5064 indentElement = null; 5065 elementsToHide[index] = { indexPath: indexPath, itemElement: itemElement, separatorElement: separatorElement, indentElement: indentElement, insteadSeparatorElement: insteadSeparatorElement }; 5066 ASPx.Attr.ChangeStyleAttribute(itemElement, "display", "none"); 5067 if(separatorElement) { 5068 var elementForHide = insteadSeparatorElement || separatorElement; 5069 ASPx.Attr.ChangeStyleAttribute(elementForHide, "display", "none"); 5070 } 5071 if(indentElement) 5072 ASPx.Attr.ChangeStyleAttribute(indentElement, "display", "none"); 5073 }; 5074 for(var i = 0; i < this.menu.adaptiveItemsOrder.length; i++){ 5075 var indexPath = this.menu.adaptiveItemsOrder[i], 5076 index = parseInt(indexPath, 10), 5077 itemToKeepSeparator = this.menu.GetRootItem() ? this.GetItemForKeepSeparator(index) : null, 5078 insteadSeparatorElement = itemToKeepSeparator ? this.menu.GetItemIndentElement(itemToKeepSeparator.indexPath) : null; 5079 addToHide(index, indexPath, this.menu.GetItemElement(indexPath), this.menu.GetItemSeparatorElement(indexPath), this.menu.GetItemIndentElement(indexPath), insteadSeparatorElement); 5080 var actualAdditionalWidth = this.NeedShowAdaptiveItemForHiddenElements(elementsToHide) ? 0 : additionalWidth; 5081 if(this.CheckAdaptiveItemsWidth(contentElement, menuWidth, actualAdditionalWidth)) 5082 break; 5083 } 5084 var hasImages = false; 5085 for(var i = 0; i < elementsToHide.length; i++) { 5086 if(!elementsToHide[i]) continue; 5087 ASPx.Attr.RestoreStyleAttribute(elementsToHide[i].itemElement, "display"); 5088 if(elementsToHide[i].separatorElement) { 5089 var elementForRestore = elementsToHide[i].insteadSeparatorElement || elementsToHide[i].separatorElement;
5090 ASPx.Attr.RestoreStyleAttribute(elementForRestore, "display"); 5091 } 5092 if(elementsToHide[i].indentElement) 5093 ASPx.Attr.RestoreStyleAttribute(elementsToHide[i].indentElement, "display"); 5094 this.menu.UpdateItemCssClasses(elementsToHide[i].indexPath, false); 5095 if(elementsToHide[i].separatorElement) { 5096 if(this.menu.GetRootItem()) 5097 this.KeepSeparatorInRoot(i); 5098 adaptiveMenuContentElement.appendChild(elementsToHide[i].separatorElement); 5099 } 5100 else if(this.menu.GetRootItem()) 5101 this.InsertSeparatorInAdaptiveMenu(i, elementsToHide[i].indexPath); 5102 if(elementsToHide[i].indentElement) 5103 adaptiveMenuContentElement.appendChild(elementsToHide[i].indentElement); 5104 adaptiveMenuContentElement.appendChild(elementsToHide[i].itemElement); 5105 this.PrepareHiddenAdaptiveItemElement(elementsToHide[i].itemElement); 5106 if(ASPx.GetNodeByClassName(elementsToHide[i].itemElement, "dxm-image")) 5107 hasImages = true; 5108 } 5109 for(var i = 0; i < elementsToHide.length; i++) { 5110 if(!elementsToHide[i]) continue; 5111 if(elementsToHide[i].separatorElement) 5112 ASPx.AddClassNameToElement(elementsToHide[i].separatorElement, MenuCssClasses.AdaptiveMenuHiddenElement); 5113 if(elementsToHide[i].indentElement) 5114 ASPx.AddClassNameToElement(elementsToHide[i].indentElement, MenuCssClasses.AdaptiveMenuHiddenElement); 5115 break; 5116 } 5117 this.SetLastSeparatorsVisible(false, contentElement); 5118 this.PrepareAdaptiveMenuContentElement(adaptiveMenuContentElement, hasImages); 5119 return elementsToHide.length > 0; 5120 }, 5121 PrepareHiddenAdaptiveItemElement: function(itemElement) { 5122 ASPx.Attr.ChangeStyleAttribute(itemElement, "width", "auto"); 5123 this.SetItemPopOutImageVertical(itemElement); 5124 }, 5125 PrepareAdaptiveMenuContentElement: function(contentElement, hasImages) { 5126 if(hasImages) 5127 ASPx.RemoveClassNameFromElement(contentElement, MenuCssClasses.WithoutImages); 5128 else 5129 ASPx.AddClassNameToElement(contentElement, MenuCssClasses.WithoutImages); 5130 }, 5131 SetAdaptiveItemElementVisibility: function(adaptiveItemElement, adaptiveItemSpacing, visible) { 5132 ASPx.SetElementDisplay(adaptiveItemElement, visible); 5133 if(adaptiveItemSpacing) 5134 ASPx.SetElementDisplay(adaptiveItemSpacing, visible); 5135 }, 5136 NeedShowAdaptiveItemForHiddenElements: function(elementsToHide) { 5137 return true; 5138 }, 5139 KeepSeparatorInRoot: function(index) { 5140 var nextItemInGroup = this.GetItemForKeepSeparator(index); 5141 if(nextItemInGroup) { 5142 var separatorElement = this.elementsToHide[index].separatorElement; 5143 this.ReplaceIndentElement(nextItemInGroup.indexPath, separatorElement); 5144 } 5145 }, 5146 InsertSeparatorInAdaptiveMenu: function(index, indexPath) { 5147 var itemWithSeparator = this.GetItemWithSeparatorForAdaptiveMenu(index); 5148 if(itemWithSeparator) { 5149 var separatorElement = this.menu.GetItemSeparatorElement(itemWithSeparator.indexPath); 5150 if(!separatorElement) return; 5151 this.elementsToHide[index].indentElement = this.ReplaceIndentElement(indexPath, separatorElement); 5152 } 5153 }, 5154 ReplaceIndentElement: function(indexPath, separatorElement) { 5155 var itemElement = this.menu.GetItemElement(indexPath), 5156 itemIndent = this.menu.GetItemIndentElement(indexPath), 5157 newIndentElement = separatorElement.cloneNode(true), 5158 parentNode = itemElement.parentNode; 5159 newIndentElement.id = this.menu.GetItemIndentElementId(indexPath); 5160 if(itemIndent) 5161 itemIndent.parentNode.removeChild(itemIndent); 5162 parentNode.insertBefore(newIndentElement, itemElement); 5163 return newIndentElement; 5164 }, 5165 GetItemForKeepSeparator: function(index) { 5166 var rootItem = this.menu.GetRootItem(), 5167 nextItemInGroup = this.menu.GetNextVisibleItemInGroup(rootItem, index, true); 5168 if(nextItemInGroup && this.IsItemInAdaptiveMenu(nextItemInGroup.index)) { 5169 while(nextItemInGroup && this.IsItemInAdaptiveMenu(nextItemInGroup.index)) 5170 nextItemInGroup = this.menu.GetNextVisibleItemInGroup(rootItem, nextItemInGroup.index, true); 5171 } 5172 return nextItemInGroup; 5173 }, 5174 GetItemWithSeparatorForAdaptiveMenu: function(index) { 5175 var rootItem = this.menu.GetRootItem(), 5176 prevItemInGroup = this.menu.GetPrevVisibleItemInGroup(rootItem, index); 5177 if(prevItemInGroup && !this.IsItemInAdaptiveMenu(prevItemInGroup.index) && !this.menu.IsItemBeginsGroup(prevItemInGroup)) { 5178 while(prevItemInGroup && !this.IsItemInAdaptiveMenu(prevItemInGroup.index) && !this.menu.IsItemBeginsGroup(prevItemInGroup)) 5179 prevItemInGroup = this.menu.GetPrevVisibleItemInGroup(rootItem, prevItemInGroup.index); 5180 } 5181 return prevItemInGroup && !this.IsItemInAdaptiveMenu(prevItemInGroup.index) ? prevItemInGroup : null; 5182 }, 5183 IsItemInAdaptiveMenu: function(index) { 5184 return this.elementsToHide.length >= index ? !!this.elementsToHide[index] : false; 5185 }, 5186 SetItemPopOutImageVertical: function(element) { 5187 var popOutElements = ASPx.GetNodesByPartialClassName(element, "dxWeb_mHorizontalPopOut"); 5188 for(var i = 0; i < popOutElements.length; i++) 5189 popOutElements[i].className = popOutElements[i].className.replace("Horizontal", "Vertical"); 5190 }, 5191 ChangeItemsPopOutImages: function(menuElement, isVertical) { 5192 var itemElements = this.GetItemElements(menuElement); 5193 for(var i = 0; i < itemElements.length; i++){ 5194 if(isVertical) 5195 this.SetItemPopOutImageVertical(itemElements[i]); 5196 else 5197 this.SetItemItemPopOutImageHorizontal(itemElements[i]); 5198 } 5199 }, 5200 ChangeOrientaion: function(menuElement, isVertical) {
5201 var oldCssSelector = isVertical ? MenuCssClasses.HorizontalMenu : MenuCssClasses.VerticalMenu; 5202 var newCssSelector = isVertical ? MenuCssClasses.VerticalMenu : MenuCssClasses.HorizontalMenu; 5203 menuElement.className = menuElement.className.replace(oldCssSelector, newCssSelector); 5204 this.ChangeItemsPopOutImages(menuElement, isVertical); 5205 this.CalculateMenuControl(menuElement, true); 5206 this.ChangeItemsPopOutImages(menuElement, isVertical); 5207 } 5208}); 5209var MenuScrollingManager = ASPx.CreateClass(ASPx.ScrollingManager, { 5210 constructor: function(menuScrollHelper) { 5211 this.constructor.prototype.constructor.call(this, menuScrollHelper, { 5212 scrollableArea: menuScrollHelper.scrollingAreaElement, 5213 orientation: [0, 1], 5214 onBeforeScrolling: function(manager, direction) { 5215 manager.owner.OnBeforeScrolling(direction); 5216 }, 5217 onAfterScrolling: function(manager, direction) { 5218 manager.owner.OnAfterScrolling(direction); 5219 }, 5220 forseEmulation: false, 5221 useMarginForPosition: true, 5222 handleMouseWheel: menuScrollHelper.handleMouseWheel 5223 }); 5224 }, 5225 setParentNodeOverflow: function() { 5226 if(ASPx.Browser.MSTouchUI) { 5227 this.scrollableArea.parentNode.style.overflow = "auto"; 5228 this.scrollableArea.parentNode.style["-ms-overflow-style"] = "none"; 5229 } 5230 } 5231}); 5232var MenuScrollHelper = ASPx.CreateClass(null, { 5233 constructor: function(menu, indexPath) { 5234 this.menu = menu; 5235 this.indexPath = indexPath; 5236 this.scrollingAreaElement = null; 5237 this.manager = null; 5238 this.initialized = false; 5239 this.visibleItems = []; 5240 this.itemsHeight = 0; 5241 this.scrollHeight = 0; 5242 this.scrollUpButtonHeight = 0; 5243 this.scrollDownButtonHeight = 0; 5244 this.scrollAreaHeight = null; 5245 this.scrollUpButtonVisible = false; 5246 this.scrollDownButtonVisible = false; 5247 this.handleMouseWheel = true; 5248 }, 5249 Initialize: function() { 5250 if(this.initialized && !this.menu.NeedCreateItemsOnClientSide()) return; 5251 this.scrollingAreaElement = this.menu.GetScrollContentItemsContainer(this.indexPath); 5252 this.manager = new MenuScrollingManager(this); 5253 this.ShowScrollButtons(); 5254 var scrollUpButton = this.menu.GetScrollUpButtonElement(this.indexPath); 5255 if(scrollUpButton) { 5256 this.scrollUpButtonHeight = this.GetScrollButtonHeight(scrollUpButton); 5257 ASPx.Selection.SetElementSelectionEnabled(scrollUpButton, false); 5258 } 5259 var scrollDownButton = this.menu.GetScrollDownButtonElement(this.indexPath); 5260 if(scrollDownButton) { 5261 this.scrollDownButtonHeight = this.GetScrollButtonHeight(scrollDownButton); 5262 ASPx.Selection.SetElementSelectionEnabled(scrollDownButton, false); 5263 } 5264 if(ASPx.Browser.WebKitTouchUI) { 5265 var preventDefault = function(event) { event.preventDefault(); }; 5266 ASPx.Evt.AttachEventToElement(scrollUpButton, "touchstart", preventDefault); 5267 ASPx.Evt.AttachEventToElement(scrollDownButton, "touchstart", preventDefault); 5268 } 5269 this.HideScrollButtons(); 5270 this.initialized = true; 5271 }, 5272 GetScrollButtonHeight: function(button) { 5273 var style = ASPx.GetCurrentStyle(button); 5274 return button.offsetHeight + ASPx.PxToInt(style.marginTop) + ASPx.PxToInt(style.marginBottom); 5275 }, 5276 FillVisibleItemsList: function() { 5277 var index = 0; 5278 this.visibleItems = []; 5279 while(true) { 5280 var childIndexPath = (this.indexPath != "" ? this.indexPath + ASPx.ItemIndexSeparator : "") + index; 5281 var itemElement = this.menu.GetItemElement(childIndexPath); 5282 if(itemElement == null) 5283 break; 5284 if(ASPx.GetElementDisplay(itemElement)) 5285 this.visibleItems.push(itemElement); 5286 index++; 5287 } 5288 }, 5289 CanCalculate: function() { 5290 return this.scrollingAreaElement && ASPx.IsElementDisplayed(this.scrollingAreaElement); 5291 }, 5292 Calculate: function(scrollHeight) { 5293 if(!this.CanCalculate()) return; 5294 this.FillVisibleItemsList(); 5295 this.itemsHeight = 0; 5296 this.scrollHeight = scrollHeight; 5297 var itemsContainer = this.menu.GetScrollContentItemsContainer(this.indexPath); 5298 if(itemsContainer) this.itemsHeight = itemsContainer.offsetHeight; 5299 this.SetPosition(0); 5300 this.CalculateScrollingElements(-1); 5301 }, 5302 GetPosition: function() { 5303 return -this.manager.GetScrolledAreaPosition(); 5304 }, 5305 SetPosition: function(pos) { 5306 this.manager.SetScrolledAreaPosition(-pos); 5307 }, 5308 CalculateScrollingElements: function(direction) { 5309 if(this.itemsHeight <= this.scrollHeight) { 5310 this.scrollUpButtonVisible = false; 5311 this.scrollDownButtonVisible = false; 5312 this.scrollAreaHeight = null; 5313 this.SetPosition(0); 5314 } 5315 else { 5316 var scrollTop = this.GetPosition(); 5317 this.scrollAreaHeight = this.scrollHeight; 5318 if(direction > 0) { 5319 var showScrollUpButton = !this.scrollUpButtonVisible; 5320 this.scrollUpButtonVisible = true; 5321 this.scrollAreaHeight -= this.scrollUpButtonHeight; 5322 this.scrollDownButtonVisible = this.itemsHeight - this.scrollAreaHeight - scrollTop > this.scrollDownButtonHeight; 5323 if(this.scrollDownButtonVisible) { 5324 this.scrollAreaHeight -= this.scrollDownButtonHeight; 5325 if(showScrollUpButton) 5326 this.SetPosition(this.GetPosition() + this.scrollUpButtonHeight); 5327 } 5328 else { 5329 this.SetPosition(this.itemsHeight - this.scrollAreaHeight); 5330 } 5331 } 5332 else { 5333 this.scrollDownButtonVisible = true; 5334 this.scrollAreaHeight -= this.scrollDownButtonHeight; 5335 this.scrollUpButtonVisible = scrollTop > this.scrollUpButtonHeight; 5336 if(this.scrollUpButtonVisible) 5337 this.scrollAreaHeight -= this.scrollUpButtonHeight; 5338 else 5339 this.SetPosition(0); 5340 } 5341 if(this.scrollAreaHeight < 1) this.scrollAreaHeight = 1; 5342 } 5343 this.UpdateScrollingElements(); 5344 }, 5345 UpdateScrollingElements: function() { 5346 this.UpdateScrollAreaHeight(); 5347 this.UpdateScrollButtonsVisibility(); 5348 }, 5349 UpdateScrollAreaHeight: function() { 5350 var scrollAreaElement = this.menu.GetScrollAreaElement(this.indexPath); 5351 if(scrollAreaElement) 5352 scrollAreaElement.style.height = (this.scrollAreaHeight) ? (this.scrollAreaHeight + "px") : ""; 5353 }, 5354 UpdateScrollButtonsVisibility: function() { 5355 var scrollUpButton = this.menu.GetScrollUpButtonElement(this.indexPath); 5356 if(scrollUpButton) ASPx.SetElementDisplay(scrollUpButton, this.scrollUpButtonVisible); 5357 var scrollDownButton = this.menu.GetScrollDownButtonElement(this.indexPath); 5358 if(scrollDownButton) ASPx.SetElementDisplay(scrollDownButton, this.scrollDownButtonVisible); 5359 }, 5360 ChangeScrollButtonsVisibility: function(visible) { 5361 this.scrollUpButtonVisible = visible; 5362 this.scrollDownButtonVisible = visible; 5363 this.UpdateScrollButtonsVisibility(); 5364 }, 5365 ShowScrollButtons: function() { 5366 this.ChangeScrollButtonsVisibility(true); 5367 }, 5368 HideScrollButtons: function() { 5369 this.ChangeScrollButtonsVisibility(false); 5370 }, 5371 ResetScrolling: function() { 5372 if(!this.initialized) 5373 return; 5374 this.HideScrollButtons(); 5375 this.SetPosition(0); 5376 this.scrollAreaHeight = null; 5377 this.UpdateScrollAreaHeight(); 5378 }, 5379 GetScrollAreaHeight: function() { 5380 var scrollAreaElement = this.menu.GetScrollAreaElement(this.indexPath); 5381 if(scrollAreaElement) 5382 return scrollAreaElement.offsetHeight; 5383 return 0; 5384 }, 5385 OnAfterScrolling: function(direction) { 5386 this.CalculateScrollingElements(direction); 5387 }, 5388 OnBeforeScrolling: function(direction) { 5389 var scrollButton = (direction > 0) ? this.menu.GetScrollDownButtonElement(this.indexPath) : 5390 this.menu.GetScrollUpButtonElement(this.indexPath);
5391 if(!scrollButton || !ASPx.GetElementDisplay(scrollButton)) 5392 this.manager.StopScrolling(); 5393 }, 5394 StartScrolling: function(direction, delay, step) { 5395 this.manager.StartScrolling(direction, delay, step); 5396 }, 5397 StopScrolling: function() { 5398 this.manager.StopScrolling(); 5399 } 5400}); 5401MenuScrollHelper.GetMenuByScrollButtonId = function(id) { 5402 var menuName = aspxGetMenuCollection().GetMenuNameBySuffixes(id, [Constants.SBIdSuffix]); 5403 return aspxGetMenuCollection().Get(menuName); 5404}; 5405var ASPxClientMenuBase = ASPx.CreateClass(ASPxClientControl, { 5406 constructor: function(name) { 5407 this.constructor.prototype.constructor.call(this, name); 5408 this.renderData = null; 5409 this.renderHelper = this.CreateRenderHelper(); 5410 this.sampleItemsFlags = { 5411 TextOnly: 0, 5412 SubItems: 1, 5413 Image: 2, 5414 NavigateUrl: 4, 5415 DropDownMode: 8, 5416 CheckBox: 16, 5417 ImageClassName: 32, 5418 Svg: 64 5419 }; 5420 this.rootMenuSample = null; 5421 this.dropElementsCache = false; 5422 this.allowSelectItem = false; 5423 this.allowCheckItems = false; 5424 this.allowMultipleCallbacks = false; 5425 this.appearAfter = 300; 5426 this.slideAnimationDuration = 60; 5427 this.disappearAfter = 500; 5428 this.enableAnimation = true; 5429 this.enableAdaptivity = false; 5430 this.adaptiveItemsOrder = []; 5431 this.enableSubMenuFullWidth = false; 5432 this.checkedItems = []; 5433 this.isVertical = true; 5434 this.itemCheckedGroups = []; 5435 this.itemCheckedGroups.groupNames = {}; 5436 this.lockHoverEvents = false; 5437 this.popupToLeft = false; 5438 this.popupCount = 0; 5439 this.rootItem = null; 5440 this.showSubMenus = false; 5441 this.savedCallbackHoverItem = null; 5442 this.savedCallbackHoverElement = null; 5443 this.selectedItemIndexPath = ""; 5444 this.checkedState = null; 5445 this.scrollInfo = []; 5446 this.scrollHelpers = {}; 5447 this.scrollVertOffset = 1; 5448 this.keyboardHelper = null; 5449 this.isContextMenu = false; 5450 this.accessibleFocusElement = null; 5451 this.rootSubMenuFIXOffset = 0; 5452 this.rootSubMenuFIYOffset = 0; 5453 this.rootSubMenuLIXOffset = 0; 5454 this.rootSubMenuLIYOffset = 0; 5455 this.rootSubMenuXOffset = 0; 5456 this.rootSubMenuYOffset = 0; 5457 this.subMenuFIXOffset = 0; 5458 this.subMenuFIYOffset = 0; 5459 this.subMenuLIXOffset = 0; 5460 this.subMenuLIYOffset = 0; 5461 this.subMenuXOffset = 0; 5462 this.subMenuYOffset = 0; 5463 this.maxHorizontalOverlap = -3; 5464 this.sizingConfig.allowSetHeight = false; 5465 this.ItemClick = new ASPxClientEvent(); 5466 this.ItemMouseOver = new ASPxClientEvent(); 5467 this.ItemMouseOut = new ASPxClientEvent(); 5468 this.PopUp = new ASPxClientEvent(); 5469 this.CloseUp = new ASPxClientEvent(); 5470 aspxGetMenuCollection().Add(this); 5471 }, 5472 SetData: function(data) { 5473 if(data.items) 5474 this.CreateItems(data.items); 5475 }, 5476 InlineInitialize: function() { 5477 ASPxClientControl.prototype.InlineInitialize.call(this); 5478 if(!this.NeedCreateItemsOnClientSide()) 5479 this.renderHelper.InlineInitializeElements(); 5480 else 5481 this.renderHelper.InlineInitializeScrollElements("", this.GetMainElement()); 5482 this.InitializeInternal(true); 5483 if(this.IsCallbacksEnabled()) { 5484 this.showSubMenus = this.GetLoadingPanelElement() != null; 5485 this.CreateCallback("DXMENUCONTENT"); 5486 } 5487 else 5488 this.showSubMenus = true; 5489 this.popupToLeft = this.rtl; 5490 }, 5491 InitializeInternal: function(inline) { 5492 if(!this.NeedCreateItemsOnClientSide()) { 5493 this.InitializeCheckedItems(); 5494 this.InitializeSelectedItem(); 5495 } 5496 this.InitializeEnabledAndVisible(!inline || !this.IsCallbacksEnabled()); 5497 if(!this.IsCallbacksEnabled()) 5498 this.InitializeScrollableMenus(); 5499 this.InitializeKeyboardHelper(); 5500 }, 5501 InitializeEnabledAndVisible: function(recursive) { 5502 if(this.rootItem == null) return; 5503 for(var i = 0; i < this.rootItem.items.length; i++) 5504 this.rootItem.items[i].InitializeEnabledAndVisible(recursive); 5505 }, 5506 InitializeScrollableMenus: function() { 5507 var info = eval(this.scrollInfo); 5508 this.scrollHelpers = {}; 5509 for(var i = 0; i < info.length; i++) 5510 this.InitializeScrollableMenu(info[i]); 5511 }, 5512 InitializeScrollableMenu: function(indexPath) { 5513 if(!this.scrollHelpers[indexPath]) 5514 this.scrollHelpers[indexPath] = new MenuScrollHelper(this, indexPath); 5515 }, 5516 GetScrollHelper: function(indexPath) { 5517 var scrollsEnabledOnServer = this.scrollInfo.length > 0;
5518 if(this.NeedCreateItemsOnClientSide() && scrollsEnabledOnServer) 5519 this.InitializeScrollableMenu(indexPath); 5520 return this.scrollHelpers[indexPath]; 5521 }, 5522 InitializeKeyboardHelper: function() { 5523 this.keyboardHelper = new ASPxMenuKeyboardHelper(this); 5524 }, 5525 InitializeMenuSamples: function() { 5526 this.rootMenuSample = this.GetSampleNode(this.samples.root); 5527 this.samples.spacing = this.GetSampleNode(this.samples.spacing); 5528 this.samples.separator = this.GetSampleNode(this.samples.separator); 5529 this.InitializeItemsSamples(this.samples.rootItems); 5530 if(this.samples.submenu) { 5531 this.samples.submenu = this.GetSampleNode(this.samples.submenu); 5532 this.InitializeItemsSamples(this.samples.submenuItems); 5533 } 5534 }, 5535 InitializeItemsSamples: function(itemsSamples) { 5536 for(var sampleProperty in itemsSamples) { 5537 if(itemsSamples.hasOwnProperty(sampleProperty)) { 5538 itemsSamples[sampleProperty] = itemsSamples[sampleProperty].replace(/DXFAKE/, ""); 5539 itemsSamples[sampleProperty] = this.GetSampleNode(itemsSamples[sampleProperty]); 5540 } 5541 } 5542 }, 5543 CheckElementsCache: function(menuElement){ 5544 if(this.dropElementsCache) { 5545 ASPx.CacheHelper.DropCache(menuElement); 5546 this.dropElementsCache = false; 5547 } 5548 }, 5549 NeedCreateItemsOnClientSide: function() { 5550 return false; 5551 }, 5552 IsClientSideEventsAssigned: function() { 5553 return !this.ItemClick.IsEmpty() 5554 || !this.ItemMouseOver.IsEmpty() 5555 || !this.ItemMouseOut.IsEmpty() 5556 || !this.PopUp.IsEmpty() 5557 || !this.CloseUp.IsEmpty() 5558 || !this.Init.IsEmpty(); 5559 }, 5560 IsCallbacksEnabled: function() { 5561 return ASPx.IsFunction(this.callBack); 5562 }, 5563 ShouldHideExistingLoadingElements: function() { 5564 return false; 5565 }, 5566 CreateRenderHelper: function(){ 5567 return new MenuRenderHelper(this); 5568 }, 5569 IsSidePanelExpanded: function() { 5570 return false; 5571 }, 5572 GetMenuElementId: function(indexPath) { 5573 return this.name + Constants.MMIdSuffix + indexPath + "_"; 5574 }, 5575 GetMenuMainElementId: function(indexPath) { 5576 return this.name + "_DXME" + indexPath + "_"; 5577 }, 5578 GetMenuBorderCorrectorElementId: function(indexPath) { 5579 return this.name + "_DXMBC" + indexPath + "_"; 5580 }, 5581 GetMenuIFrameElementId: function(indexPath) { 5582 return this.name + "_DXMIF" + this.GetMenuLevel(indexPath); 5583 }, 5584 GetScrollAreaId: function(indexPath) { 5585 return this.name + "_DXSA" + indexPath; 5586 }, 5587 GetMenuTemplateContainerID: function(indexPath) { 5588 return this.name + "_MTCNT" + indexPath; 5589 }, 5590 GetItemTemplateContainerID: function(indexPath) { 5591 return this.name + "_ITCNT" + indexPath; 5592 }, 5593 GetScrollUpButtonId: function(indexPath) { 5594 return this.name + Constants.SBIdSuffix + indexPath + Constants.SBUIdEnd; 5595 }, 5596 GetScrollDownButtonId: function(indexPath) { 5597 return this.name + Constants.SBIdSuffix + indexPath + Constants.SBDIdEnd; 5598 }, 5599 GetItemElementId: function(indexPath) { 5600 return this.name + Constants.MIIdSuffix + indexPath + "_"; 5601 }, 5602 GetItemContentElementId: function(indexPath) { 5603 return this.GetItemElementId(indexPath) + Constants.ItemContentElementPostfix; 5604 }, 5605 GetItemPopOutElementId: function(indexPath) { 5606 return this.GetItemElementId(indexPath) + Constants.ItemPopoutElementPostfix; 5607 }, 5608 GetItemImageId: function(indexPath) { 5609 return this.GetItemElementId(indexPath) + Constants.ImagePostfix; 5610 }, 5611 GetItemPopOutImageId: function(indexPath) { 5612 return this.GetItemElementId(indexPath) + Constants.PopupImagePostfix; 5613 }, 5614 GetItemIndentElementId: function(indexPath) { 5615 return this.GetItemElementId(indexPath) + "II"; 5616 }, 5617 GetItemSeparatorElementId: function(indexPath) { 5618 return this.GetItemElementId(indexPath) + "IS"; 5619 }, 5620 GetMenuElement: function (indexPath) { 5621 if(indexPath == "") 5622 return this.GetMainElement(); 5623 return ASPx.CacheHelper.GetCachedElementById(this, this.GetMenuElementId(indexPath)); 5624 }, 5625 GetMenuIFrameElement: function(indexPath) { 5626 var elementId = this.GetMenuIFrameElementId(indexPath); 5627 var element = ASPx.GetElementById(elementId); 5628 if(!element && this.renderIFrameForPopupElements) 5629 return this.CreateIFrameElement(elementId); 5630 return element; 5631 },
5632 CreateIFrameElement: function(elementId) { 5633 var element = document.createElement("IFRAME"); 5634 ASPx.Attr.SetAttribute(element, "id", elementId); 5635 ASPx.Attr.SetAttribute(element, "src", "javascript:false"); 5636 ASPx.Attr.SetAttribute(element, "scrolling", "no"); 5637 ASPx.Attr.SetAttribute(element, "frameborder", "0"); 5638 if(this.accessibilityCompliant) 5639 ASPx.Attr.SetAttribute(element, "title", ASPx.AccessibilitySR.AccessibilityIFrameTitle); 5640 element.style.position = "absolute"; 5641 element.style.display = "none"; 5642 element.style.zIndex = "19997"; 5643 element.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Style=0, Opacity=0)"; 5644 ASPx.InsertElementAfter(element, this.GetMainElement()); 5645 return element; 5646 }, 5647 GetMenuBorderCorrectorElement: function(indexPath) { 5648 return ASPx.CacheHelper.GetCachedElementById(this, this.GetMenuBorderCorrectorElementId(indexPath)); 5649 }, 5650 GetMenuMainElement: function(element) { 5651 var indexPath = this.GetIndexPathById(element.id, true); 5652 return ASPx.CacheHelper.GetCachedElement(this, "menuMainElement" + indexPath, 5653 function() { 5654 var shadowTable = ASPx.GetElementById(this.GetMenuMainElementId(indexPath)); 5655 return shadowTable != null ? shadowTable : element; 5656 }); 5657 }, 5658 GetScrollAreaElement: function(indexPath) { 5659 return ASPx.CacheHelper.GetCachedElementById(this, this.GetScrollAreaId(indexPath)); 5660 }, 5661 GetScrollContentItemsContainer: function(indexPath) { 5662 return ASPx.CacheHelper.GetCachedElement(this, "scrollContentItemsContainer" + indexPath, 5663 function() { 5664 return ASPx.GetNodeByTagName(this.GetScrollAreaElement(indexPath), "UL", 0); 5665 }); 5666 }, 5667 GetScrollUpButtonElement: function(indexPath) { 5668 return ASPx.CacheHelper.GetCachedElementById(this, this.GetScrollUpButtonId(indexPath)); 5669 }, 5670 GetScrollDownButtonElement: function(indexPath) { 5671 return ASPx.CacheHelper.GetCachedElementById(this, this.GetScrollDownButtonId(indexPath)); 5672 }, 5673 GetItemElement: function(indexPath) { 5674 return ASPx.CacheHelper.GetCachedElementById(this, this.GetItemElementId(indexPath)); 5675 }, 5676 GetItemTemplateElement: function(indexPath) { 5677 return this.GetItemTextTemplateContainer(indexPath); 5678 }, 5679 GetItemTemplateContainer: function(indexPath) { 5680 return this.GetItemElement(indexPath); 5681 }, 5682 GetItemTextTemplateContainer: function(indexPath) { 5683 return this.GetItemContentElement(indexPath); 5684 }, 5685 GetItemContentElement: function(indexPath) { 5686 return ASPx.CacheHelper.GetCachedElementById(this, this.GetItemContentElementId(indexPath)); 5687 }, 5688 GetItemPopOutElement: function(indexPath) { 5689 return ASPx.CacheHelper.GetCachedElementById(this, this.GetItemPopOutElementId(indexPath)); 5690 }, 5691 GetPopOutElements: function() { 5692 return ASPx.GetNodesByClassName(this.GetMainElement().parentNode, "dxm-popOut"); 5693 }, 5694 GetPopOutImages: function() { 5695 return ASPx.GetNodesByClassName(this.GetMainElement().parentNode, "dxm-pImage"); 5696 }, 5697 GetSubMenuXPosition: function(indexPath, isVertical) { 5698 var itemElement = this.GetItemElement(indexPath); 5699 var pos = ASPx.GetAbsoluteX(itemElement) + (isVertical ? itemElement.clientWidth + itemElement.clientLeft : 0); 5700 if(ASPx.Browser.WebKitFamily && !this.IsParentElementPositionStatic(indexPath)) 5701 pos -= document.body.offsetLeft; 5702 return pos; 5703 }, 5704 GetSubMenuYPosition: function(indexPath, isVertical) { 5705 var position = 0; 5706 var element = this.GetItemElement(indexPath); 5707 if(element != null) { 5708 if(isVertical) { 5709 position = ASPx.GetAbsoluteY(element); 5710 } 5711 else { 5712 if(ASPx.Browser.Opera && ASPx.Browser.Version >= 9 || ASPx.Browser.AndroidDefaultBrowser) 5713 position = ASPx.GetAbsoluteY(element) + element.offsetHeight - ASPx.GetClientTop(element); 5714 else 5715 position = ASPx.GetAbsoluteY(element) + element.clientHeight + ASPx.GetClientTop(element); 5716 } 5717 } 5718 if(ASPx.Browser.WebKitFamily && !this.IsParentElementPositionStatic(indexPath)) 5719 position -= document.body.offsetTop; 5720 return position; 5721 }, 5722 GetClientSubMenuXPosition: function(element, x, indexPath, isVertical) { 5723 var docClientWidth = ASPx.GetDocumentClientWidth(); 5724 if(isVertical) 5725 return this.GetClientSubMenuXPositionVerticalCore(element, x, indexPath, isVertical, docClientWidth);
5726 return this.GetClientSubMenuXPositionHorizontalCore(element, x, indexPath, isVertical, docClientWidth); 5727 }, 5728 GetClientSubMenuXPositionVerticalCore: function(element, x, indexPath, isVertical, docClientWidth) { 5729 var itemInfo = new MenuItemInfo(this, indexPath); 5730 var itemWidth = itemInfo.clientWidth; 5731 var subMenuWidth = this.GetMenuMainElement(element).offsetWidth; 5732 var left = x - ASPx.GetDocumentScrollLeft(); 5733 var right = left + subMenuWidth; 5734 var toLeftX = x - subMenuWidth - itemWidth; 5735 var toLeftLeft = left - subMenuWidth - itemWidth; 5736 if(this.IsCorrectionDisableMethodRequired(indexPath)) 5737 return this.GetCorrectionDisabledResult(x, toLeftX); 5738 if(this.popupToLeft) { 5739 if(toLeftLeft > this.maxHorizontalOverlap) 5740 return toLeftX; 5741 if(docClientWidth - right > this.maxHorizontalOverlap || !this.rtl) { 5742 this.popupToLeft = false; 5743 return x; 5744 } 5745 return ASPx.InvalidPosition; 5746 } 5747 else { 5748 if(docClientWidth - right > this.maxHorizontalOverlap) 5749 return x; 5750 if(toLeftLeft > this.maxHorizontalOverlap || this.rtl) { 5751 this.popupToLeft = true; 5752 return toLeftX; 5753 } 5754 return ASPx.InvalidPosition; 5755 } 5756 }, 5757 GetClientSubMenuXPositionHorizontalCore: function(element, x, indexPath, isVertical, docClientWidth) { 5758 var itemInfo = new MenuItemInfo(this, indexPath); 5759 var itemOffsetWidth = itemInfo.offsetWidth; 5760 var subMenuWidth = this.GetMenuMainElement(element).offsetWidth; 5761 var left = x - ASPx.GetDocumentScrollLeft(); 5762 if(this.popupToLeft) { 5763 var rtlX = left - subMenuWidth + itemOffsetWidth; 5764 return rtlX < 0 ? 0 : rtlX; 5765 } 5766 else { 5767 if(docClientWidth - (left + subMenuWidth) < 0) { 5768 x = docClientWidth - subMenuWidth; 5769 if(x < 0) 5770 x = 0; 5771 return x; 5772 } 5773 return x; 5774 } 5775 }, 5776 GetClientSubMenuYPosition: function(element, y, indexPath, isVertical) { 5777 var itemInfo = new MenuItemInfo(this, indexPath); 5778 var itemHeight = itemInfo.offsetHeight; 5779 var subMenuHeight = this.GetMenuMainElement(element).offsetHeight; 5780 var menuItemTop = y - ASPx.GetDocumentScrollTop(); 5781 var subMenuBottom = menuItemTop + subMenuHeight; 5782 var docClientHeight = ASPx.GetDocumentClientHeight(); 5783 var clientSubMenuYPos = y; 5784 if(isVertical) { 5785 var notEnoughSpaceToShowDown = subMenuBottom > docClientHeight; 5786 var menuItemBottom = menuItemTop + itemHeight; 5787 if(menuItemBottom > docClientHeight) { 5788 menuItemBottom = docClientHeight; 5789 itemHeight = menuItemBottom - menuItemTop; 5790 } 5791 var notEnoughSpaceToShowUp = menuItemBottom < subMenuHeight; 5792 var subMenuIsFitToDisplayFrames = docClientHeight >= subMenuHeight; 5793 if(!subMenuIsFitToDisplayFrames) clientSubMenuYPos = y - menuItemTop; 5794 else if(notEnoughSpaceToShowDown) { 5795 if(notEnoughSpaceToShowUp) { 5796 var docClientBottom = ASPx.GetDocumentScrollTop() + docClientHeight; 5797 clientSubMenuYPos = docClientBottom - subMenuHeight; 5798 } else 5799 clientSubMenuYPos = y + itemHeight - subMenuHeight; 5800 } 5801 } 5802 else { 5803 if(this.IsHorizontalSubmenuNeedInversion(subMenuBottom, docClientHeight, menuItemTop, subMenuHeight, itemHeight)) 5804 clientSubMenuYPos = y - subMenuHeight - itemHeight; 5805 } 5806 return clientSubMenuYPos; 5807 }, 5808 IsHorizontalSubmenuNeedInversion: function(subMenuBottom, docClientHeight, menuItemTop, subMenuHeight, itemHeight) { 5809 return subMenuBottom > docClientHeight && menuItemTop - subMenuHeight - itemHeight > docClientHeight - subMenuBottom; 5810 }, 5811 IsCorrectionDisableMethodRequired: function(indexPath) { 5812 return false; 5813 }, 5814 HasChildren: function(indexPath) { 5815 return (this.GetMenuElement(indexPath) != null); 5816 }, 5817 IsVertical: function(indexPath) { 5818 return true; 5819 }, 5820 IsRootItem: function(indexPath) { 5821 return this.GetMenuLevel(indexPath) <= 1; 5822 }, 5823 IsParentElementPositionStatic: function(indexPath) { 5824 return this.IsRootItem(indexPath); 5825 }, 5826 GetItemIndexPath: function(indexes) { 5827 return aspxGetMenuCollection().GetItemIndexPath(indexes); 5828 }, 5829 GetItemIndexes: function(indexPath) { 5830 return aspxGetMenuCollection().GetItemIndexes(indexPath); 5831 }, 5832 GetItemIndexPathById: function(id) { 5833 return aspxGetMenuCollection().GetIndexPathById(id, Constants.MIIdSuffix); 5834 }, 5835 GetMenuIndexPathById: function(id) { 5836 return aspxGetMenuCollection().GetIndexPathById(id, Constants.MMIdSuffix); 5837 }, 5838 GetScrollButtonIndexPathById: function(id) { 5839 return aspxGetMenuCollection().GetIndexPathById(id, Constants.SBIdSuffix); 5840 }, 5841 GetIndexPathById: function(id, checkMenu) { 5842 var indexPath = this.GetItemIndexPathById(id); 5843 if(indexPath == "" && checkMenu) 5844 indexPath = this.GetMenuIndexPathById(id); 5845 return indexPath; 5846 }, 5847 GetMenuLevelInternal: function(indexPath) { 5848 if(indexPath == "") 5849 return 0; 5850 else { 5851 var indexes = this.GetItemIndexes(indexPath); 5852 return indexes.length; 5853 } 5854 }, 5855 GetMenuLevel: function(indexPath) { 5856 var level = this.GetMenuLevelInternal(indexPath); 5857 if(this.IsAdaptiveMenuItem(indexPath))
5858 level ++; 5859 return level; 5860 }, 5861 IsAdaptiveMenuItem: function(indexPath){ 5862 var level = this.GetMenuLevelInternal(indexPath); 5863 while(level > 1){ 5864 indexPath = this.GetParentIndexPath(indexPath); 5865 level = this.GetMenuLevelInternal(indexPath); 5866 } 5867 var itemElement = this.GetItemElement(indexPath); 5868 if(itemElement && ASPx.GetParentByClassName(itemElement, this.getAdaptiveMenuCssClass())) 5869 return true; 5870 return false; 5871 }, 5872 IsAdaptiveItem: function(indexPath){ 5873 var itemElement = this.GetItemElement(indexPath); 5874 if(itemElement && ASPx.ElementContainsCssClass(itemElement, this.getAdaptiveMenuItemCssClass())) 5875 return true; 5876 return false; 5877 }, 5878 GetParentIndexPath: function(indexPath) { 5879 var indexes = this.GetItemIndexes(indexPath); 5880 indexes.length--; 5881 return (indexes.length > 0) ? this.GetItemIndexPath(indexes) : ""; 5882 }, 5883 IsLastElement: function(element) { 5884 return element && (!element.nextSibling || !element.nextSibling.tagName); 5885 }, 5886 IsLastItem: function(indexPath) { 5887 var itemElement = this.GetItemElement(indexPath); 5888 return this.IsLastElement(itemElement); 5889 }, 5890 IsFirstElement: function(element) { 5891 return element && (!element.previousSibling || !element.previousSibling.tagName); 5892 }, 5893 IsFirstItem: function(indexPath) { 5894 var itemElement = this.GetItemElement(indexPath); 5895 return this.IsFirstElement(itemElement); 5896 }, 5897 IsItemElement: function(element) { 5898 return ASPx.ElementContainsCssClass(element, MenuCssClasses.Item); 5899 }, 5900 GetPreviousItem: function(itemPath, isItemNameUsed) { 5901 var indexPath = itemPath; 5902 if(isItemNameUsed) { 5903 var indexPath = this.GetMenuIndexPathById(itemPath); 5904 if(indexPath == "") 5905 indexPath = this.GetItemIndexPathById(itemPath); 5906 } 5907 var currentItem = this.GetItemByIndexPath(indexPath), 5908 previousItem = null; 5909 if(currentItem) { 5910 for(var i = currentItem.index - 1; i >= 0 && previousItem === null; i--) { 5911 if(currentItem.parent.items[i].GetVisible()) 5912 previousItem = currentItem.parent.items[i]; 5913 } 5914 } 5915 return previousItem; 5916 }, 5917 GetClientSubMenuPos: function(element, indexPath, pos, isVertical, isXPos) { 5918 if(!ASPx.IsValidPosition(pos)) { 5919 pos = isXPos ? this.GetSubMenuXPosition(indexPath, isVertical) : this.GetSubMenuYPosition(indexPath, isVertical); 5920 } 5921 var clientPos = isXPos ? this.GetClientSubMenuXPosition(element, pos, indexPath, isVertical) : this.GetClientSubMenuYPosition(element, pos, indexPath, isVertical); 5922 var isInverted = pos != clientPos; 5923 if(clientPos !== ASPx.InvalidPosition){ 5924 var offset = isXPos ? this.GetSubMenuXOffset(indexPath) : this.GetSubMenuYOffset(indexPath); 5925 clientPos += isInverted ? -offset : offset; 5926 clientPos -= ASPx.GetPositionElementOffset(this.GetMenuElement(indexPath), isXPos); 5927 } 5928 return new ASPx.PopupPosition(clientPos, isInverted); 5929 }, 5930 GetSubMenuXOffset: function(indexPath) { 5931 if(indexPath == "") 5932 return 0; 5933 else if(this.IsRootItem(indexPath)) { 5934 if(this.IsFirstItem(indexPath)) 5935 return this.rootSubMenuFIXOffset; 5936 else if(this.IsLastItem(indexPath)) 5937 return this.rootSubMenuLIXOffset; 5938 else 5939 return this.rootSubMenuXOffset; 5940 } 5941 else { 5942 if(this.IsFirstItem(indexPath)) 5943 return this.subMenuFIXOffset; 5944 else if(this.IsLastItem(indexPath)) 5945 return this.subMenuLIXOffset; 5946 else 5947 return this.subMenuXOffset; 5948 } 5949 }, 5950 GetSubMenuYOffset: function(indexPath) { 5951 if(indexPath == "") 5952 return 0; 5953 else if(this.IsRootItem(indexPath)) { 5954 if(this.IsFirstItem(indexPath)) 5955 return this.rootSubMenuFIYOffset; 5956 else if(this.IsLastItem(indexPath)) 5957 return this.rootSubMenuLIYOffset; 5958 else 5959 return this.rootSubMenuYOffset; 5960 } 5961 else { 5962 if(this.IsFirstItem(indexPath)) 5963 return this.subMenuFIYOffset; 5964 else if(this.IsLastItem(indexPath)) 5965 return this.subMenuLIYOffset; 5966 else 5967 return this.subMenuYOffset; 5968 } 5969 }, 5970 CalculateSubMenuPosition: function(element, x, y, indexPath, enableAnimation) { 5971 var isVertical = this.IsVertical(indexPath); 5972 var horizontalPopupPosition = this.GetClientSubMenuPos(element, indexPath, x, isVertical, true); 5973 if(horizontalPopupPosition.position === ASPx.InvalidPosition) { 5974 isVertical = !isVertical; 5975 horizontalPopupPosition = this.GetClientSubMenuPos(element, indexPath, x, isVertical, true); 5976 } 5977 var verticalPopupPosition = this.GetClientSubMenuPos(element, indexPath, y, isVertical, false); 5978 var clientX = horizontalPopupPosition.position; 5979 var clientY = verticalPopupPosition.position; 5980 var toTheLeft = horizontalPopupPosition.isInverted; 5981 var toTheTop = verticalPopupPosition.isInverted;
5982 clientY += this.GetScrollingCorrection(element, indexPath, clientY); 5983 verticalPopupPosition.position = clientY; 5984 var parentElement = this.GetItemContentElement(indexPath); 5985 var prevParentPos = ASPx.GetAbsoluteX(parentElement); 5986 ASPx.SetStyles(element, { 5987 left: clientX, top: clientY 5988 }); 5989 clientX += ASPx.GetAbsoluteX(parentElement) - prevParentPos; 5990 if(enableAnimation) { 5991 this.StartAnimation(element, indexPath, horizontalPopupPosition, verticalPopupPosition, isVertical); 5992 } 5993 else { 5994 ASPx.SetStyles(element, { left: clientX, top: clientY }); 5995 ASPx.SetElementVisibility(element, true); 5996 if(this.enableSubMenuFullWidth) 5997 this.ApplySubMenuFullWidth(element); 5998 this.DoShowPopupMenuIFrame(element, clientX, clientY, ASPx.InvalidDimension, ASPx.InvalidDimension, indexPath); 5999 this.DoShowPopupMenuBorderCorrector(element, clientX, clientY, indexPath, toTheLeft, toTheTop); 6000 } 6001 }, 6002 StartScrolling: function(buttonId, delay, step) { 6003 var indexPath = this.GetScrollButtonIndexPathById(buttonId); 6004 var level = this.GetMenuLevel(indexPath); 6005 aspxGetMenuCollection().DoHidePopupMenus(null, level, this.name, false, ""); 6006 var direction = (buttonId.lastIndexOf(Constants.SBDIdEnd) == buttonId.length - Constants.SBDIdEnd.length) ? 1 : -1; 6007 var scrollHelper = this.GetScrollHelper(indexPath); 6008 if(scrollHelper) scrollHelper.StartScrolling(direction, delay, step); 6009 }, 6010 StopScrolling: function(buttonId) { 6011 var indexPath = this.GetScrollButtonIndexPathById(buttonId); 6012 var scrollHelper = this.GetScrollHelper(indexPath); 6013 if(scrollHelper) scrollHelper.StopScrolling(); 6014 }, 6015 ClearAppearTimer: function() { 6016 aspxGetMenuCollection().ClearAppearTimer(); 6017 }, 6018 ClearDisappearTimer: function() { 6019 aspxGetMenuCollection().ClearDisappearTimer(); 6020 }, 6021 IsAppearTimerActive: function() { 6022 return aspxGetMenuCollection().IsAppearTimerActive(); 6023 }, 6024 IsDisappearTimerActive: function() { 6025 return aspxGetMenuCollection().IsDisappearTimerActive(); 6026 }, 6027 IsAdaptiveItemAnimationActive: function() { 6028 return this.inSubmenuShowAnimation; 6029 }, 6030 GetAppearAfter: function(indexPath) { 6031 return this.appearAfter; 6032 }, 6033 SetAppearTimer: function(indexPath, preventSubMenu) { 6034 aspxGetMenuCollection().SetAppearTimer(this.name, indexPath, this.GetAppearAfter(indexPath), preventSubMenu); 6035 }, 6036 GetDisappearAfter: function() { 6037 return this.disappearAfter; 6038 }, 6039 SetDisappearTimer: function() { 6040 aspxGetMenuCollection().SetDisappearTimer(this.name, this.GetDisappearAfter()); 6041 }, 6042 IsDropDownItem: function(indexPath) { 6043 return ASPx.ElementContainsCssClass(this.GetItemElement(indexPath), MenuCssClasses.ItemDropDownMode); 6044 }, 6045 DoItemClick: function(indexPath, hasItemLink, htmlEvent) { 6046 aspxGetMenuCollection().LockMenusVisibility(); 6047 var processOnServer = this.RaiseItemClick(indexPath, htmlEvent); 6048 if(processOnServer && !hasItemLink) { 6049 if(ASPx.Browser.Edge) { 6050 var activeElement = document.activeElement; 6051 if(activeElement) 6052 activeElement.blur(); 6053 } 6054 this.SendPostBack("CLICK:" + indexPath); 6055 } 6056 else { 6057 this.ClearDisappearTimer(); 6058 this.ClearAppearTimer(); 6059 if(this.CanCloseSubMenuOnClick(indexPath) && (!this.HasChildren(indexPath) || this.IsDropDownItem(indexPath))) 6060 aspxGetMenuCollection().DoHidePopupMenus(null, -1, this.name, false, ""); 6061 else if(this.IsItemEnabled(indexPath) && !this.IsDropDownItem(indexPath)) 6062 this.ShowSubMenu(indexPath); 6063 } 6064 aspxGetMenuCollection().UnlockMenusVisibility(); 6065 }, 6066 CanCloseSubMenuOnClick: function(indexPath) { 6067 return true; 6068 }, 6069 HasContent: function(mainCell) { 6070 for(var i = 0; i < mainCell.childNodes.length; i++) 6071 if(mainCell.childNodes[i].tagName) 6072 return true; 6073 return false; 6074 }, 6075 DoShowPopupMenu: function(element, x, y, indexPath) { 6076 var parent = this.GetItemByIndexPath(indexPath); 6077 var menuElement = this.GetMenuMainElement(element); 6078 var popupMenuHasVisibleContent = menuElement && (this.renderHelper.HasSubMenuTemplate(menuElement) || 6079 ASPx.ElementContainsCssClass(menuElement, this.getAdaptiveMenuCssClass())) || 6080 parent && this.HasVisibleItems(parent); 6081 if(popupMenuHasVisibleContent === false) 6082 return; 6083 if(element && this.IsCallbacksEnabled()) 6084 this.ShowLoadingPanelInMenu(element); 6085 if(ASPx.GetElementVisibility(element)) 6086 ASPx.SetStyles(element, { left: ASPx.InvalidPosition, top: ASPx.InvalidPosition }); 6087 ASPx.SetElementDisplay(element, true); 6088 if(parent) { 6089 for(var i = 0; i < parent.GetItemCount() ; i++) { 6090 var item = parent.GetItem(i); 6091 this.SetPopOutElementVisible(item.indexPath, this.HasVisibleItems(item)); 6092 } 6093 } 6094 this.renderHelper.CalculateSubMenu(element, false); 6095 if(this.popupCount == 0) this.popupToLeft = this.rtl; 6096 this.RaisePopUp(indexPath); 6097 this.CalculateSubMenuPosition(element, x, y, indexPath, this.enableAnimation); 6098 aspxGetMenuCollection().RegisterVisiblePopupMenu(this.name, element.i
6098d); 6099 this.popupCount++; 6100 ASPx.GetControlCollection().AdjustControls(element); 6101 this.CorrectVerticalAlignment(ASPx.AdjustHeight, this.GetPopOutElements, "PopOut"); 6102 this.CorrectVerticalAlignment(ASPx.AdjustVerticalMargins, this.GetPopOutImages, "PopOutImg"); 6103 }, 6104 ShowLoadingPanelInMenu: function(element) { 6105 var lpParent = this.GetMenuMainElement(element); 6106 if(lpParent && !this.HasContent(lpParent)) 6107 this.CreateLoadingPanelInsideContainer(lpParent); 6108 }, 6109 GetScrollSubMenuYCorrection: function(element, scrollHelper, clientY) { 6110 var absoluteClientY = clientY + ASPx.GetPositionElementOffset(element); 6111 var excessTop = this.GetScrollExcessTop(absoluteClientY); 6112 var excessBottom = this.GetScrollExcessBottom(element, absoluteClientY); 6113 var correction = 0; 6114 if(excessTop > 0) 6115 correction += excessTop + this.scrollVertOffset; 6116 if(excessBottom > 0 && (absoluteClientY + correction == ASPx.GetDocumentScrollTop())) { 6117 excessBottom += this.scrollVertOffset; 6118 correction += this.scrollVertOffset; 6119 } 6120 this.PrepareScrolling(element, scrollHelper, excessTop, excessBottom); 6121 return correction; 6122 }, 6123 GetScrollExcessTop: function(clientY) { 6124 return ASPx.GetDocumentScrollTop() - clientY; 6125 }, 6126 GetScrollExcessBottom: function(element, clientY) { 6127 ASPx.SetElementDisplay(element, false); 6128 var docHeight = ASPx.GetDocumentClientHeight(); 6129 ASPx.SetElementDisplay(element, true); 6130 return clientY + element.offsetHeight - ASPx.GetDocumentScrollTop() - docHeight; 6131 }, 6132 PrepareScrolling: function(element, scrollHelper, excessTop, excessBottom) { 6133 scrollHelper.Initialize(); 6134 var corrector = element.offsetHeight - scrollHelper.GetScrollAreaHeight() + this.scrollVertOffset; 6135 if(excessTop > 0) 6136 scrollHelper.Calculate(element.offsetHeight - excessTop - corrector); 6137 if(excessBottom > 0) 6138 scrollHelper.Calculate(element.offsetHeight - excessBottom - corrector); 6139 }, 6140 ApplySubMenuFullWidth: function(element) { 6141 ASPx.SetStyles(element, { left: 0, right: 0, width: "auto" }); 6142 var menuElement = this.GetMenuMainElement(element); 6143 ASPx.SetStyles(menuElement, { width: "100%", "box-sizing": "border-box" }); 6144 var templateElement = ASPx.GetChildByClassName(menuElement, "dx"); 6145 if(templateElement) ASPx.SetStyles(templateElement, { width: "100%" }); 6146 }, 6147 DoShowPopupMenuIFrame: function(element, x, y, width, height, indexPath) { 6148 if(!this.renderIFrameForPopupElements) return; 6149 var iFrame = element.overflowElement; 6150 if(!iFrame) { 6151 iFrame = this.GetMenuIFrameElement(indexPath); 6152 element.overflowElement = iFrame; 6153 } 6154 if(iFrame) { 6155 var menuElement = this.GetMenuMainElement(element); 6156 if(width < 0) 6157 width = menuElement.offsetWidth; 6158 if(height < 0) 6159 height = menuElement.offsetHeight; 6160 ASPx.SetStyles(iFrame, { 6161 width: width, height: height, 6162 left: x, top: y, display: "" 6163 }); 6164 } 6165 }, 6166 DoShowPopupMenuBorderCorrector: function(element, x, y, indexPath, toTheLeft, toTheTop) { 6167 var borderCorrectorElement = this.GetMenuBorderCorrectorElement(indexPath); 6168 if(borderCorrectorElement) { 6169 var params = this.GetPopupMenuBorderCorrectorPositionAndSize(element, x, y, indexPath, toTheLeft, toTheTop); 6170 ASPx.SetStyles(borderCorrectorElement, { 6171 width: params.width, height: params.height, 6172 left: params.left, top: params.top, 6173 display: "", visibility: "visible" 6174 }); 6175 element.borderCorrectorElement = borderCorrectorElement; 6176 } 6177 }, 6178 GetPopupMenuBorderCorrectorPositionAndSize: function(element, x, y, indexPath, toTheLeft, toTheTop) { 6179 var result = {}; 6180 var itemInfo = new MenuItemInfo(this, indexPath); 6181 var menuXOffset = ASPx.GetClientLeft(this.GetMenuMainElement(element)); 6182 var menuYOffset = ASPx.GetClientTop(this.GetMenuMainElement(element)); 6183 var menuElement = this.GetMenuMainElement(element); 6184 var menuClientWidth = menuElement.clientWidth; 6185 var menuClientHeight = menuElement.clientHeight; 6186 if(this.IsVertical(indexPath)) { 6187 var commonClientHeight = itemInfo.clientHeight < menuClientHeight 6188 ? itemInfo.clientHeight 6189 : menuClientHeight; 6190 result.width = menuXOffset; 6191 result.height = commonClientHeight + itemInfo.clientTop - menuYOffset; 6192 result.left = x; 6193 if(toTheLeft) 6194 result.left += menuClientWidth + menuXOffset; 6195 result.top = y + menuYOffset; 6196 if(toTheTop) 6197 result.top += menuClientHeight - result.height; 6198 } 6199 else { 6200 var itemWidth = itemInfo.clientWidth; 6201 if(this.IsDropDownItem(indexPath)) 6202 itemWidth = this.GetItemContentElement(indexPath).clientWidth; 6203 var commonClientWidth = itemWidth < menuClientWidth 6204 ? itemWidth 6205 : menuClientWidth; 6206 result.width = commonClientWidth + itemInfo.clientLeft - menuXOffset; 6207 result.height = menuYOffset; 6208 result.left = x + menuXOffset; 6209 if(toTheLeft) 6210 result.left += menuClientWidth - result.width; 6211 result.top = y; 6212 if(toTheTop) 6213 result.top += menuClientHeight + menuYOffset; 6214 } 6215 return result; 6216 }, 6217 DoHidePopupMenu: function(evt, element) { 6218 this.DoHidePopupMenuBorderCorrector(element); 6219 this.DoHidePopupMenuIFrame(element); 6220 var menuElement = this.GetMenuMainElement(element); 6221 ASPx.PopupUtils.StopAnimation(element, menuElement); 6222 ASPx.SetElementVisibility(element, false); 6223 ASPx.SetElementDisplay(element, false); 6224 ASPx.SetStyles(element, { 6225 width: 'unset', height: 'unset' 6226 }); 6227 this.CancelSubMenuItemHoverItem(element); 6228 aspxGetMenuCollection().UnregisterVisiblePopupMenu(this.name, element.i
6228d); 6229 this.popupCount--; 6230 var indexPath = this.GetIndexPathById(element.id, true); 6231 this.DoResetScrolling(element, indexPath); 6232 this.RaiseCloseUp(indexPath); 6233 }, 6234 DoResetScrolling: function(element, indexPath) { 6235 var scrollHelper = this.GetScrollHelper(indexPath); 6236 if(scrollHelper) { 6237 element.style.height = ""; 6238 scrollHelper.ResetScrolling(); 6239 } 6240 }, 6241 DoHidePopupMenuIFrame: function(element) { 6242 if(!this.renderIFrameForPopupElements) return; 6243 var iFrame = element.overflowElement; 6244 if(iFrame) 6245 ASPx.SetElementDisplay(iFrame, false); 6246 }, 6247 DoHidePopupMenuBorderCorrector: function(element) { 6248 var borderCorrectorElement = element.borderCorrectorElement; 6249 if(borderCorrectorElement) { 6250 ASPx.SetElementVisibility(borderCorrectorElement, false); 6251 ASPx.SetElementDisplay(borderCorrectorElement, false); 6252 element.borderCorrectorElement = null; 6253 } 6254 }, 6255 MarkPrecedingItem: function(currentItemName, className, isItemNameUsed) { 6256 this.MarkPrecedingItemCore(currentItemName, className, true, isItemNameUsed); 6257 }, 6258 UnmarkPrecedingItem: function(currentItemName, className, isItemNameUsed) { 6259 this.MarkPrecedingItemCore(currentItemName, className, false, isItemNameUsed); 6260 }, 6261 MarkPrecedingItemCore: function(currentItemName, className, addClass, isItemNameUsed) { 6262 var previousItem = this.GetPreviousItem(currentItemName, isItemNameUsed); 6263 if(previousItem) { 6264 var element = this.GetItemElement(previousItem.indexPath); 6265 if(addClass) 6266 ASPx.AddClassNameToElement(element, className); 6267 else 6268 ASPx.RemoveClassNameFromElement(element, className); 6269 } 6270 }, 6271 SetHoverElement: function(element) { 6272 if(!this.IsStateControllerEnabled()) return; 6273 this.lockHoverEvents = true; 6274 ASPx.GetStateController().SetCurrentHoverElementBySrcElement(element); 6275 this.lockHoverEvents = false; 6276 }, 6277 ApplySubMenuItemHoverItem: function(element, hoverItem, hoverElement) { 6278 if(!element.hoverItem && ASPx.GetElementDisplay(element)) { 6279 var newHoverItem = hoverItem.Clone(); 6280 element.hoverItem = newHoverItem; 6281 element.hoverElement = hoverElement; 6282 newHoverItem.Apply(hoverElement); 6283 } 6284 }, 6285 CancelSubMenuItemHoverItem: function(element) { 6286 if(element.hoverItem) { 6287 element.hoverItem.Cancel(element.hoverElement); 6288 element.hoverItem = null; 6289 element.hoverElement = null; 6290 } 6291 }, 6292 ShowSubMenu: function(indexPath) { 6293 var element = this.GetMenuElement(indexPath); 6294 if(element != null) { 6295 var level = this.GetMenuLevel(indexPath); 6296 aspxGetMenuCollection().DoHidePopupMenus(null, level - 1, this.name, false, this.getExceptIdsForShowSubMenu(indexPath, element.id)); 6297 if(!this.isSubMenuElementVisible(element) && this.IsItemEnabled(indexPath)) 6298 this.DoShowPopupMenu(element, ASPx.InvalidPosition, ASPx.InvalidPosition, indexPath); 6299 } 6300 this.ClearAppearTimer(); 6301 }, 6302 getExceptIdsForShowSubMenu: function (itemIndexPath, exceptId) { 6303 return [exceptId]; 6304 }, 6305 isSubMenuElementVisible: function(subMenuElement) { 6306 return ASPx.GetElementDisplay(subMenuElement); 6307 }, 6308 SelectItem: function(indexPath) { 6309 if(!this.IsStateControllerEnabled()) return; 6310 var element = this.GetItemContentElement(indexPath); 6311 if(element != null) { 6312 ASPx.GetStateController().SelectElementBySrcElement(element); 6313 if(this.sideMenuModeOn) 6314 this.MarkPrecedingItem(indexPath, PRE_SELECTED_ELEMENT_CLASS_NAME, false); 6315 } 6316 }, 6317 DeselectItem: function(indexPath) { 6318 if(!this.IsStateControllerEnabled()) return; 6319 var element = this.GetItemContentElement(indexPath); 6320 if(element != null) { 6321 var hoverItem = null; 6322 var hoverElement = null; 6323 var menuElement = this.GetMenuElement(indexPath); 6324 if(menuElement && menuElement.hoverItem) { 6325 hoverItem = menuElement.hoverItem; 6326 hoverElement = menuElement.hoverElement; 6327 this.CancelSubMenuItemHoverItem(menuElement); 6328 } 6329 ASPx.GetStateController().DeselectElementBySrcElement(element); 6330 if(menuElement != null && hoverItem != null) 6331 this.ApplySubMenuItemHoverItem(menuElement, hoverItem, hoverElement); 6332 if(this.sideMenuModeOn) 6333 this.UnmarkPrecedingItem(indexPath, PRE_SELECTED_ELEMENT_CLASS_NAME, false); 6334 } 6335 }, 6336 InitializeSelectedItem: function() { 6337 if(!this.allowSelectItem && !this.HasServerSideSelectedItem()) return; 6338 this.SelectItem(this.GetSelectedItemIndexPath()); 6339 this.InitializeServerSideSelectedItem(); 6340 }, 6341 InitializeServerSideSelectedItem: function() { 6342 if(!this.allowSelectItem && this.sideMenuModeOn && this.HasServerSideSelectedItem()) 6343 this.MarkPrecedingItem(this.serverSideSelectedItemPath, PRE_SELECTED_ELEMENT_CLASS_NAME, false); 6344 }, 6345 HasServerSideSelectedItem: function() { 6346 return typeof (this.serverSideSelectedItemPath) !== "undefined"; 6347 }, 6348 GetSelectedItemIndexPath: function() { 6349 return this.selectedItemIndexPath; 6350 }, 6351 SetSelectedItemInternal: function(indexPath, modifyHotTrackSelection) { 6352 if(modifyHotTrackSelection) 6353 this.SetHoverElement(null); 6354 this.DeselectItem(this.selectedItemIndexPath); 6355 this.selectedItemIndexPath = indexPath; 6356 var item = this.GetItemByIndexPath(indexPath); 6357 if(item == null || item.GetEnabled()) 6358 this.SelectItem(this.selectedItemIndexPath); 6359 if(modifyHotTrackSelection) { 6360 var element = this.GetItemContentElement(indexPath); 6361 if(element != null) 6362 this.SetHoverElement(element); 6363 } 6364 }, 6365 InitializeCheckedItems: function() { 6366 if(!this.allowCheckItems) return; 6367 var indexPathes = this.checkedState.split(";"); 6368 for(var i = 0; i < indexPathes.length; i++) { 6369 if(indexPathes[i] != "") { 6370 this.checkedItems.push(indexPathes[i]); 6371 this.SelectItem(indexPathes[i]); 6372 } 6373 } 6374 }, 6375 ChangeCheckedItem: function(indexPath) { 6376 this.SetHoverElement(null); 6377 var itemsGroup = this.GetItemsGroup(indexPath); 6378 if(itemsGroup != null) { 6379 if(itemsGroup.length > 1) { 6380 if(!this.IsCheckedItem(indexPath)) {
6381 for(var i = 0; i < itemsGroup.length; i++) { 6382 if(itemsGroup[i] == indexPath) continue; 6383 if(this.IsCheckedItem(itemsGroup[i])) { 6384 ASPx.Data.ArrayRemove(this.checkedItems, itemsGroup[i]); 6385 this.DeselectItem(itemsGroup[i]); 6386 } 6387 } 6388 this.SelectItem(indexPath); 6389 this.checkedItems.push(indexPath); 6390 } 6391 } 6392 else { 6393 if(this.IsCheckedItem(indexPath)) { 6394 ASPx.Data.ArrayRemove(this.checkedItems, indexPath); 6395 this.DeselectItem(indexPath); 6396 } 6397 else { 6398 this.SelectItem(indexPath); 6399 this.checkedItems.push(indexPath); 6400 } 6401 } 6402 } 6403 var element = this.GetItemContentElement(indexPath); 6404 if(element != null) 6405 this.SetHoverElement(element); 6406 }, 6407 GetItemsGroup: function(indexPath) { 6408 for(var i = 0; i < this.itemCheckedGroups.length; i++) { 6409 if(ASPx.Data.ArrayIndexOf(this.itemCheckedGroups[i], indexPath) > -1) 6410 return this.itemCheckedGroups[i]; 6411 } 6412 return null; 6413 }, 6414 IsCheckedItem: function(indexPath) { 6415 return ASPx.Data.ArrayIndexOf(this.checkedItems, indexPath) > -1; 6416 }, 6417 UpdateStateObject: function(){ 6418 this.UpdateStateObjectWithObject({ selectedItemIndexPath: this.selectedItemIndexPath, checkedState: this.GetCheckedState() }); 6419 }, 6420 GetCheckedState: function() { 6421 return this.checkedItems.map(function(checkedItem) { 6422 return this.GetCheckedItemInfo(checkedItem); 6423 }.bind(this)).join(";"); 6424 }, 6425 GetCheckedItemInfo: function(itemIndexPath) { 6426 return itemIndexPath; 6427 }, 6428 GetAnimationVerticalDirection: function(indexPath, popupPosition, isVertical) { 6429 var verticalDirection = (this.IsRootItem(indexPath) && !isVertical) ? -1 : 0; 6430 if(popupPosition.isInverted) verticalDirection *= -1; 6431 return verticalDirection; 6432 }, 6433 GetAnimationHorizontalDirection: function(indexPath, popupPosition, isVertical) { 6434 var horizontalDirection = (this.IsRootItem(indexPath) && !isVertical) ? 0 : -1; 6435 if(popupPosition.isInverted) horizontalDirection *= -1; 6436 return horizontalDirection; 6437 }, 6438 skipPopupMenuSizeInit: function() { 6439 return false; 6440 }, 6441 StartAnimation: function(animationDivElement, indexPath, horizontalPopupPosition, verticalPopupPosition, isVertical) { 6442 this.inSubmenuShowAnimation = true; 6443 var element = this.GetMenuMainElement(animationDivElement); 6444 var clientX = horizontalPopupPosition.position; 6445 var clientY = verticalPopupPosition.position; 6446 ASPx.PopupUtils.InitAnimationDiv(animationDivElement, clientX, clientY, this.OnAnimationFinished.aspxBind(this), this.skipPopupMenuSizeInit()); 6447 var verticalDirection = this.GetAnimationVerticalDirection(indexPath, verticalPopupPosition, isVertical); 6448 var horizontalDirection = this.GetAnimationHorizontalDirection(indexPath, horizontalPopupPosition, isVertical); 6449 var yPos = verticalDirection * element.offsetHeight; 6450 var xPos = horizontalDirection * element.offsetWidth; 6451 ASPx.SetStyles(element, { left: xPos, top: yPos }); 6452 ASPx.SetElementVisibility(animationDivElement, true); 6453 if(this.enableSubMenuFullWidth) 6454 this.ApplySubMenuFullWidth(animationDivElement); 6455 this.DoShowPopupMenuIFrame(animationDivElement, clientX, clientY, 0, 0, indexPath); 6456 this.DoShowPopupMenuBorderCorrector(animationDivElement, clientX, clientY, indexPath, 6457 horizontalPopupPosition.isInverted, verticalPopupPosition.isInverted); 6458 ASPx.PopupUtils.StartSlideAnimation(animationDivElement, element, this.GetMenuIFrameElement(indexPath), this.slideAnimationDuration, this.enableSubMenuFullWidth, false); 6459 }, 6460 OnAnimationFinished: function() { 6461 window.setTimeout(function() { this.inSubmenuShowAnimation = false; }.aspxBind(this), 100); 6462 }, 6463 OnItemClick: function(indexPath, evt) { 6464 var sourceElement = ASPx.Evt.GetEventSource(evt); 6465 var clickedLinkElement = ASPx.GetParentByTagName(sourceElement, "A"); 6466 var isLinkClicked = (clickedLinkElement != null && clickedLinkElement.href != ASPx.AccessibilityEmptyUrl); 6467 var element = this.GetItemContentElement(indexPath); 6468 var linkElement = (element != null) ? (element.tagName === "A" ? element : ASPx.GetNodeByTagName(element, "A", 0)) : null; 6469 if(linkElement != null && linkElement.href == ASPx.AccessibilityEmptyUrl) 6470 linkElement = null; 6471 if(this.allowSelectItem) 6472 this.SetSelectedItemInternal(indexPath, true); 6473 if(this.allowCheckItems || this.canCheckItem(element)) 6474 this.ChangeCheckedItem(indexPath); 6475 this.DoItemClick(indexPath, isLinkClicked || (linkElement != null), evt); 6476 if(!isLinkClicked && linkElement != null && !(ASPx.Browser.WebKitTouchUI && this.HasChildren(indexPath))) 6477 ASPx.Url.NavigateByLink(linkElement); 6478 }, 6479 canCheckItem: function (itemElement) { 6480 return false; 6481 }, 6482 OnItemDropDownClick: function(indexPath, evt) { 6483 if(this.IsItemEnabled(indexPath)) { 6484 if(this.IsAdaptiveItem(indexPath)) 6485 this.toggleAdaptiveSubmenu(indexPath); 6486 else 6487 this.keyboardHelper.ShowSubMenuAccessible(indexPath); 6488 } 6489 }, 6490 toggleAdaptiveSubmenu: function(indexPath) { 6491 var element = this.GetMenuElement(indexPath); 6492 if(ASPx.GetElementDisplay(element) && !this.IsAdaptiveItemAnimationActive()) 6493 this.DoHidePopupMenu(null, element); 6494 else 6495 this.keyboardHelper.ShowSubMenuAccessible(indexPath); 6496 }, 6497 AfterItemOverAllowed: function(hoverItem) { 6498 return hoverItem.name != "" && !this.lockHoverEvents; 6499 }, 6500 OnAfterItemOver: function(hoverItem, hoverElement) {
6501 if(!this.AfterItemOverAllowed(hoverItem)) return; 6502 if(!this.showSubMenus) { 6503 this.savedCallbackHoverItem = hoverItem; 6504 this.savedCallbackHoverElement = hoverElement; 6505 return; 6506 } 6507 this.ClearDisappearTimer(); 6508 this.ClearAppearTimer(); 6509 var indexPath = this.GetMenuIndexPathById(hoverItem.name); 6510 if(indexPath == "") { 6511 indexPath = this.GetItemIndexPathById(hoverItem.name); 6512 var canShowSubMenu = true; 6513 if(this.IsDropDownItem(indexPath)) { 6514 var popOutImageElement = this.GetItemPopOutElement(indexPath); 6515 if(popOutImageElement != null && popOutImageElement != hoverElement) { 6516 hoverItem.needRefreshBetweenElements = true; 6517 canShowSubMenu = false; 6518 } 6519 } 6520 var preventSubMenu = !(canShowSubMenu && hoverItem.enabled && hoverItem.kind == ASPx.HoverItemKind); 6521 this.SetAppearTimer(indexPath, preventSubMenu); 6522 this.RaiseItemMouseOver(indexPath); 6523 } 6524 }, 6525 OnBeforeItemOver: function(hoverItem, hoverElement) { 6526 if(ASPx.Browser.NetscapeFamily && ASPx.IsExists(hoverElement.offsetParent) && 6527 hoverElement.offsetParent.style.borderCollapse == "collapse") { 6528 hoverElement.offsetParent.style.borderCollapse = "separate"; 6529 hoverElement.offsetParent.style.borderCollapse = "collapse"; 6530 } 6531 var indexPath = this.GetItemIndexPathById(hoverItem.name); 6532 var element = this.GetMenuElement(indexPath); 6533 if(element) this.CancelSubMenuItemHoverItem(element); 6534 }, 6535 OnItemOverTimer: function(indexPath, preventSubMenu) { 6536 var element = this.GetMenuElement(indexPath); 6537 if(element == null || preventSubMenu) { 6538 var level = this.GetMenuLevel(indexPath); 6539 aspxGetMenuCollection().DoHidePopupMenus(null, level - 1, this.name, false, this.getExceptIdsForItemOverTimer(indexPath)); 6540 } 6541 if(this.IsAppearTimerActive() && !preventSubMenu) { 6542 this.ClearAppearTimer(); 6543 if(this.GetItemContentElement(indexPath) != null || this.GetItemPopOutElement(indexPath) != null) { 6544 this.ShowSubMenu(indexPath); 6545 } 6546 } 6547 }, 6548 getExceptIdsForItemOverTimer: function(indexPath) { 6549 var result = []; 6550 aspxGetMenuCollection().ForEachControl(function(menu) { 6551 var isPopupMenu = ASPx.IsExists(menu.popupAction) && ASPx.IsExists(menu.closeAction); 6552 if(isPopupMenu && menu.closeAction === "OuterMouseClick") 6553 result.push(menu.GetMainElementId()); 6554 }, this); 6555 return result; 6556 }, 6557 OnBeforeItemDisabled: function(disabledItem, disabledElement) { 6558 this.ClearAppearTimer(); 6559 var indexPath = this.GetItemIndexPathById(disabledElement.id); 6560 if(indexPath != "") { 6561 var element = this.GetMenuElement(indexPath); 6562 if(element != null) this.DoHidePopupMenu(null, element); 6563 } 6564 }, 6565 OnAfterItemOut: function(hoverItem, hoverElement, newHoverElement) { 6566 if(!this.showSubMenus) { 6567 this.savedCallbackHoverItem = null; 6568 this.savedCallbackHoverElement = null; 6569 } 6570 if(hoverItem.name == "" || this.lockHoverEvents) return; 6571 if(hoverItem.IsChildElement(newHoverElement)) return; 6572 var indexPath = this.GetItemIndexPathById(hoverItem.name); 6573 var element = this.GetMenuElement(indexPath); 6574 this.ClearDisappearTimer(); 6575 this.ClearAppearTimer(); 6576 if(element == null || !ASPx.GetIsParent(element, newHoverElement)) 6577 this.SetDisappearTimer(); 6578 if(element != null) 6579 this.ApplySubMenuItemHoverItem(element, hoverItem, hoverElement); 6580 if(indexPath != "") 6581 this.RaiseItemMouseOut(indexPath); 6582 }, 6583 OnItemOutTimer: function() { 6584 if(this.IsDisappearTimerActive()) { 6585 this.ClearDisappearTimer(); 6586 if(aspxGetMenuCollection().CheckFocusedElement()) 6587 this.SetDisappearTimer(); 6588 else 6589 this.OnHideByItemOut(); 6590 } 6591 }, 6592 OnHideByItemOut: function() { 6593 aspxGetMenuCollection().DoHidePopupMenus(null, 0, this.name, true, ""); 6594 }, 6595 TryFocusItem: function(itemIndex) { 6596 var item = this.GetItem(itemIndex); 6597 if(item.GetVisible() && item.GetEnabled()) { 6598 this.FocusItemByIndexPath(item.GetIndexPath()); 6599 return true; 6600 } 6601 return false; 6602 }, 6603 Focus: function() { 6604 if(this.rootItem != null) { 6605 for(var i = 0; i < this.GetItemCount() ; i++) { 6606 if(this.TryFocusItem(i)) 6607 return true; 6608 } 6609 } 6610 else 6611 this.keyboardHelper.FocusNextItem("-1"); 6612 }, 6613 FocusLastItem: function() { 6614 if(this.rootItem != null) { 6615 for(var i = this.GetItemCount() - 1; i >= 0; i--) { 6616 if(this.TryFocusItem(i)) 6617 return true; 6618 } 6619 } 6620 else 6621 this.keyboardHelper.FocusPrevItem(this.GetItemCount() - 1); 6622 }, 6623 FocusItemByIndexPath: function(indexPath) { 6624 this.keyboardHelper.FocusItemByIndexPath(indexPath); 6625 }, 6626 OnFocusedItemKeyDown: function(evt, focusedItem) { 6627 this.keyboardHelper.OnFocusedItemKeyDown(evt, focusedItem); 6628 }, 6629 ProcessLostFocus: function(evt) { 6630 if(!this.isContextMenu || !this.accessibilityCompliant) return; 6631 if(this.accessibleFocusElement) 6632 this.accessibleFocusElement.focus(); 6633 this.Hide(); 6634 if(evt) 6635 ASPx.Evt.PreventEventAndBubble(evt); 6636 }, 6637 OnCallback: function(result) { 6638 ASPx.InitializeScripts(); 6639 this.InitializeScrollableMenus(); 6640 for (var indexPath in result) { 6641 if(result.hasOwnProperty(indexPath)) { 6642 var menuElement = this.GetMenuElement(indexPath); 6643 if(menuElement) { 6644 var menuResult = result[indexPath]; 6645 if(aspxGetMenuCollection().IsSubMenuVisible(menuElement.id)) 6646 this.ShowPopupSubMenuAfterCallback(menuElement, menuResult); 6647 else 6648 this.SetSubMenuInnerHtml(menuElement, menuResult); 6649 } 6650 } 6651 } 6652 this.ClearVerticalAlignedElementsCache(); 6653 this.CorrectVerticalAlignment(ASPx.AdjustHeight, this.GetPopOutElements, "PopOut"); 6654 this.CorrectVerticalAlignment(ASPx.AdjustVerticalMargins, this.GetPopOutImages, "PopOutImg"); 6655 this.InitializeInternal(false); 6656 if(!this.showSubMenus) { 6657 this.showSubMenus = true; 6658 if(this.savedCallbackHoverItem != null && this.savedCallbackHoverElement != null) 6659 this.OnAfterItemOver(this.savedCallbackHoverItem, this.savedCallbackHoverElement); 6660 this.savedCallbackHoverItem = null; 6661 this.savedCallbackHoverElement = null; 6662 } 6663 }, 6664 SetSubMenuInnerHtml: function(menuElement, html) { 6665 ASPx.SetInnerHtml(this.GetMenuMainElement(menuElement), html); 6666 this.dropElementsCache = true; 6667 this.renderHelper.InlineInitializePopupMenuMenuElement(menuElement, this.GetIndexPathById(menuElement.id, true)); 6668 this.renderHelper.CalculateSubMenu(menuElement, true); 6669 }, 6670 ShowPopupSubMenuAfterCallback: function(element, callbackResult) {
6671 var indexPath = this.GetIndexPathById(element.id, true); 6672 var currentX = ASPx.PxToInt(element.style.left); 6673 var currentY = ASPx.PxToInt(element.style.top); 6674 var showedToTheTop = this.ShowedToTheTop(element, indexPath); 6675 var showedToTheLeft = this.ShowedToTheLeft(element, indexPath); 6676 ASPx.SetStyles(element, { 6677 left: ASPx.InvalidPosition, top: ASPx.InvalidPosition 6678 }); 6679 this.SetSubMenuInnerHtml(element, callbackResult); 6680 var vertPos = this.GetClientSubMenuPos(element, indexPath, ASPx.InvalidPosition, this.IsVertical(indexPath), false); 6681 var clientY = vertPos.position; 6682 var toTheTop = vertPos.isInverted; 6683 if(!this.IsVertical(indexPath) && showedToTheTop != toTheTop) { 6684 clientY = currentY; 6685 toTheTop = showedToTheTop; 6686 } 6687 clientY += this.GetScrollingCorrection(element, indexPath, clientY); 6688 ASPx.SetStyles(element, { left: currentX, top: clientY }); 6689 if(this.enableSubMenuFullWidth) 6690 this.ApplySubMenuFullWidth(element); 6691 this.DoShowPopupMenuIFrame(element, currentX, clientY, ASPx.InvalidDimension, ASPx.InvalidDimension, indexPath); 6692 this.DoShowPopupMenuBorderCorrector(element, currentX, clientY, indexPath, showedToTheLeft, toTheTop); 6693 ASPx.GetControlCollection().AdjustControls(element); 6694 }, 6695 GetScrollingCorrection: function(element, indexPath, clientY) { 6696 var scrollHelper = this.GetScrollHelper(indexPath); 6697 if(scrollHelper) { 6698 var yClientCorrection = this.GetScrollSubMenuYCorrection(element, scrollHelper, clientY); 6699 if(yClientCorrection > 0) 6700 return yClientCorrection; 6701 } 6702 return 0; 6703 }, 6704 ShowedToTheTop: function(element, indexPath) { 6705 var currentY = ASPx.PxToInt(element.style.top); 6706 var parentBottomY = this.GetSubMenuYPosition(indexPath, this.IsVertical(indexPath)); 6707 return currentY < parentBottomY; 6708 }, 6709 ShowedToTheLeft: function(element, indexPath) { 6710 var currentX = ASPx.PxToInt(element.style.left); 6711 var parentX = this.GetSubMenuXPosition(indexPath, this.IsVertical(indexPath)); 6712 return currentX < parentX; 6713 }, 6714 CreateItems: function(items) { 6715 if (items.length == 0) 6716 return; 6717 if(this.NeedCreateItemsOnClientSide()) 6718 this.CreateClientItems(items); 6719 else 6720 this.CreateServerItems(items); 6721 }, 6722 AddItem: function(item) { 6723 this.CreateClientItems([item]); 6724 }, 6725 CreateClientItems: function(items) { 6726 this.PreInitializeClientMenuItems(); 6727 this.rootItem.CreateItems(items); 6728 this.RenderItems(this.rootItem.items); 6729 this.InitializeClientItems(); 6730 }, 6731 CreateServerItems: function(items) { 6732 this.CreateRootItemIfRequired(); 6733 this.rootItem.CreateItems(items); 6734 }, 6735 PreInitializeClientMenuItems: function() { 6736 if(!this.rootMenuSample) 6737 this.InitializeMenuSamples(); 6738 this.CreateRootItemIfRequired(); 6739 if(!this.renderData) 6740 this.CreateRenderData(); 6741 }, 6742 InitializeClientItems: function() { 6743 this.dropElementsCache = true; 6744 this.renderHelper.InlineInitializeElements(); 6745 this.ApplyItemsProperties(this.rootItem.items); 6746 this.InitializeEnabledAndVisible(true); 6747 if(this.isPopupMenu) 6748 this.renderHelper.CalculateSubMenu(this.GetMainElement(), true); 6749 else 6750 this.renderHelper.CalculateMenuControl(this.GetMainElement(), true); 6751 }, 6752 ApplyItemsProperties: function(items) { 6753 var itemsCount = items.length; 6754 if(itemsCount == 0) 6755 return; 6756 for(var i = 0; i < itemsCount; i++) { 6757 var item = items[i]; 6758 this.ApplyItemProperties(item); 6759 this.ApplyItemsProperties(item.items); 6760 } 6761 }, 6762 ApplyItemProperties: function(item) { 6763 var indexPath = item.GetIndexPath(); 6764 if(item.imageUrl) 6765 this.SetItemImageUrl(indexPath, item.imageUrl); 6766 if(item.imageClassName) { 6767 this.AddItemImageClassName(indexPath, item.imageClassName); 6768 this.AddItemAdditionalImageClassName(indexPath, item.imageClassName); 6769 } 6770 if(item.navigateUrl) 6771 this.SetItemNavigateUrl(indexPath, item.navigateUrl, item.target); 6772 if(item.tooltip != "") 6773 this.SetItemTooltip(indexPath, item.tooltip); 6774 var textNode = this.FindTextNode(indexPath); 6775 if(textNode) 6776 textNode.parentNode.innerHTML = this.HtmlEncode(item.text); 6777 this.SetItemChecked(indexPath, item.checked); 6778 if(item.textTemplate) 6779 this.SetItemTextTemplate(indexPath, item.textTemplate); 6780 }, 6781 ProcessItemGroupName: function(item, groupName) { 6782 if(this.allowSelectItem || !groupName) 6783 return; 6784 this.allowCheckItems = true; 6785 var groupNames = this.itemCheckedGroups.groupNames; 6786 if(groupNames[groupName]) 6787 groupNames[groupName].push(item.indexPath); 6788 else { 6789 groupNames[groupName] = [item.indexPath]; 6790 this.itemCheckedGroups.push(groupNames[groupName]); 6791 } 6792 item.checkedGroup = groupNames[groupName]; 6793 }, 6794 CreateRootItemIfRequired: function() { 6795 if(!this.rootItem) { 6796 var itemType = this.GetClientItemType(); 6797 this.rootItem = new itemType(this, null, 0, ""); 6798 } 6799 }, 6800 ClearRootMenuElement: function() { 6801 var wrapperElement = this.GetMainElement().parentNode; 6802 wrapperElement.innerHTML = ""; 6803 wrapperElement.appendChild(this.rootMenuSample.cloneNode(true)); 6804 this.renderHelper.InlineInitializeScrollElements("", this.GetMainElement()); 6805 }, 6806 NeedAppendToRenderData: function(item) { 6807 return this.NeedCreateItemsOnClientSide() && item.visible || typeof(item.visible) == "undefined"; 6808 }, 6809 ClearItems: function() { 6810 this.PreInitializeClientMenuItems();
6811 this.ClearRootMenuElement(); 6812 this.ClearRenderData(); 6813 this.rootItem.items = []; 6814 this.checkedItems = []; 6815 }, 6816 GetSampleNode: function(sampleHtml) { 6817 return ASPx.CreateHtmlElementFromString(sampleHtml); 6818 }, 6819 GetParentItem: function(rootItemIndexPath) { 6820 if(!rootItemIndexPath) 6821 return this.rootItem; 6822 return this.GetItemByIndexPath(rootItemIndexPath); 6823 }, 6824 RenderItems: function(items) { 6825 for(var i=0; i < items.length; i++) { 6826 var item = items[i]; 6827 this.RenderItemIfRequired(item); 6828 this.RenderItems(item.items); 6829 } 6830 }, 6831 RenderItemIfRequired: function(item) { 6832 if(!this.GetItemElement(item.indexPath)) { 6833 var isRootItem = !this.GetItemElement(item.parent.indexPath); 6834 var rootMenuElement = this.GetOrRenderRootItem(item, isRootItem); 6835 this.RenderItemInternal(rootMenuElement, item, isRootItem); 6836 this.ApplyStylesToRenderItem(item, isRootItem); 6837 } 6838 }, 6839 ApplyStylesToRenderItem: function(item, isRootItem) { 6840 var styles = JSON.parse(JSON.stringify(isRootItem ? this.samples.itemsStyles : this.samples.subitemsStyles)); 6841 var hoverStyle = styles.hover; 6842 var disabledStyle = styles.disable; 6843 var selectedStyle = styles.select; 6844 var checkedStyle = styles.check; 6845 var itemElementId = this.GetItemElementId(item.indexPath); 6846 if(item.styles && item.styles.ho) { 6847 var itemHover = item.styles.ho; 6848 if(!!itemHover.style) 6849 hoverStyle.cssTexts[0] = itemHover.style; 6850 if(!!itemHover.cssClass) 6851 hoverStyle.classNames[0] += " " + itemHover.cssClass; 6852 } 6853 if(item.styles && item.styles.st) { 6854 var itemElement = this.GetItemElement(item.indexPath); 6855 var style = item.styles.st; 6856 itemElement.setAttribute("style", style.style); 6857 if(!!style.cssClass) 6858 ASPx.AddClassNameToElement(itemElement, style.cssClass); 6859 } 6860 ASPx.GetStateController().AddHoverItem(itemElementId, hoverStyle.classNames || [MenuCssClasses.ItemHovered], hoverStyle.cssTexts || [""], hoverStyle.postfixes || [""], item.imageHottrackSrc ? [item.imageHottrackSrc] : null, [Constants.ImagePostfix, Constants.PopupImagePostfix], false); 6861 ASPx.GetStateController().AddDisabledItem(itemElementId, disabledStyle.classNames || [MenuCssClasses.Disabled], disabledStyle.cssTexts || [""], disabledStyle.postfixes || [""], null, null, false); 6862 if(selectedStyle && this.allowSelectItem) 6863 ASPx.GetStateController().AddSelectedItem(itemElementId, selectedStyle.classNames || [MenuCssClasses.ItemSelected], selectedStyle.cssTexts || [""], selectedStyle.postfixes || [""], null, null, false); 6864 else if (checkedStyle && this.allowCheckItems && item.checkedGroup.length) { 6865 var checkedClassName = null; 6866 if(!item.imageClassName) 6867 checkedClassName = [this.samples.checkedClassName]; 6868 ASPx.GetStateController().AddSelectedItem(itemElementId, checkedStyle.classNames || [MenuCssClasses.ItemChecked], checkedStyle.cssTexts || [""], checkedStyle.postfixes || [""], checkedClassName, ['Img'], false); 6869 } 6870 }, 6871 GetOrRenderRootItem: function(item, isRootItem) { 6872 if(!isRootItem) { 6873 var rootMenuElement = this.GetMenuElement(item.parent.indexPath); 6874 return rootMenuElement ? rootMenuElement : this.RenderSubMenuItem(item.parent.indexPath); 6875 } else 6876 return this.GetMenuElement(""); 6877 }, 6878 RenderItemInternal: function(rootItem, item, isRootItem) { 6879 var contentElement = this.renderHelper.GetContentElement(rootItem); 6880 var element = this.CreateItemElement(item, isRootItem); 6881 this.RenderSeparatorElementIfRequired(contentElement, item); 6882 this.RenderSpaceElementIfRequired(contentElement, item); 6883 contentElement.appendChild(element); 6884 }, 6885 RenderSeparatorElementIfRequired: function(rootItem, item) { 6886 if(item.beginGroup && item.index > 0) { 6887 var separatorElement = this.CreateSeparatorElement(item.indexPath); 6888 rootItem.appendChild(separatorElement); 6889 } 6890 }, 6891 RenderSpaceElementIfRequired: function(rootItem, item) { 6892 if(!item.beginGroup && item.index > 0 && rootItem.childNodes.length > 0) { 6893 if(this.samples.spacing) { 6894 var spacingElement = this.CreateSpacingElement(item.indexPath); 6895 rootItem.appendChild(spacingElement); 6896 } 6897 } 6898 }, 6899 RenderSubMenuItem: function(indexPath) { 6900 var subMenuElement = this.CreateSubMenuElement(indexPath); 6901 this.GetMainElement().parentElement.appendChild(subMenuElement); 6902 return subMenuElement; 6903 }, 6904 HasSeparatorOnCurrentPosition: function(itemElements, position) { 6905 return itemElements[position - 1 >
6905 0 ? position - 1 : 0].className.indexOf(MenuCssClasses.Separator) > -1; 6906 }, 6907 CreateItemElement: function(item, isRootItem) { 6908 var itemSample = isRootItem ? this.GetRootItemSample(item) : this.GetSubitemSample(item); 6909 var itemElement = itemSample.cloneNode(true); 6910 itemElement.id = this.GetItemElementId(item.indexPath); 6911 return itemElement; 6912 }, 6913 GetRootItemSample: function(item) { 6914 return this.GetItemSample(this.samples.rootItems, item); 6915 }, 6916 GetSubitemSample: function(item) { 6917 return this.GetItemSample(this.samples.submenuItems, item); 6918 }, 6919 GetItemSample: function(samples, item) { 6920 var key = this.sampleItemsFlags.TextOnly; 6921 if(item.items.length > 0) 6922 key = key | this.sampleItemsFlags.SubItems; 6923 if(item.imageUrl) 6924 key = key | this.sampleItemsFlags.Image; 6925 if(item.navigateUrl) 6926 key = key | this.sampleItemsFlags.NavigateUrl; 6927 if(item.dropDownMode) 6928 key = key | this.sampleItemsFlags.DropDownMode; 6929 if(item.checkedGroup.length) 6930 key = key | this.sampleItemsFlags.CheckBox; 6931 if(item.imageClassName) 6932 key = key | this.sampleItemsFlags.ImageClassName; 6933 if(item.isSvg) 6934 key = key | this.sampleItemsFlags.Svg; 6935 return samples[key]; 6936 }, 6937 CreateSpacingElement: function(indexPath) { 6938 var item = this.samples.spacing.cloneNode(); 6939 item.id = this.GetItemIndentElementId(indexPath); 6940 return item; 6941 }, 6942 CreateSeparatorElement: function(indexPath) { 6943 var item = this.samples.separator.cloneNode(true); 6944 item.id = this.GetItemSeparatorElementId(indexPath); 6945 return item; 6946 }, 6947 CreateSubMenuElement: function(indexPath) { 6948 var subMenu = this.samples.submenu.cloneNode(true); 6949 subMenu.id = this.name + Constants.MMIdSuffix + indexPath + "_"; 6950 return subMenu; 6951 }, 6952 AppendToRenderData: function(rootItemIndexPath, index) { 6953 if(rootItemIndexPath) { 6954 if(!this.renderData[rootItemIndexPath]) 6955 this.renderData[rootItemIndexPath] = [[index]]; 6956 this.renderData[rootItemIndexPath][index] = [index]; 6957 } else { 6958 this.renderData[""].push([[index]]); 6959 } 6960 }, 6961 CreateRenderData: function() { 6962 this.renderData = {"" : []}; 6963 }, 6964 ClearRenderData: function() { 6965 this.renderData = null; 6966 }, 6967 GetClientItemType: function() { 6968 return ASPxClientMenuItem; 6969 }, 6970 GetItemByIndexPath: function(indexPath) { 6971 var item = this.rootItem; 6972 if(indexPath != "" && item != null) { 6973 var indexes = this.GetItemIndexes(indexPath); 6974 for(var i = 0; i < indexes.length; i++) 6975 item = item.GetItem(indexes[i]); 6976 } 6977 return item; 6978 }, 6979 GetLinkElementByIndexPath: function(indexPath) { 6980 var itemElement = this.GetItemElement(indexPath); 6981 return this.renderHelper.GetItemLinkElement(itemElement); 6982 }, 6983 SetItemChecked: function(indexPath, checked) { 6984 var itemsGroup = this.GetItemsGroup(indexPath); 6985 if(itemsGroup != null) { 6986 if(!checked && this.IsCheckedItem(indexPath)) { 6987 ASPx.Data.ArrayRemove(this.checkedItems, indexPath); 6988 this.DeselectItem(indexPath); 6989 } 6990 else if(checked && !this.IsCheckedItem(indexPath)) { 6991 if(itemsGroup.length > 1) { 6992 for(var i = 0; i < itemsGroup.length; i++) { 6993 if(itemsGroup[i] == indexPath) continue; 6994 if(this.IsCheckedItem(itemsGroup[i])) { 6995 ASPx.Data.ArrayRemove(this.checkedItems, itemsGroup[i]); 6996 this.DeselectItem(itemsGroup[i]); 6997 } 6998 } 6999 } 7000 this.SelectItem(indexPath); 7001 this.checkedItems.push(indexPath); 7002 } 7003 if(this.accessibilityCompliant) { 7004 var link = this.GetLinkElementByIndexPath(indexPath); 7005 if(link) 7006 ASPx.Attr.SetAttribute(link, "aria-checked", checked ? "true" : "false"); 7007 } 7008 } 7009 }, 7010 ChangeItemEnabledAttributes: function(indexPath, enabled) { 7011 this.renderHelper.ChangeItemEnabledAttributes(this.GetItemElement(indexPath), enabled, this.accessibilityCompliant); 7012 }, 7013 IsItemEnabled: function(indexPath) { 7014 var item = this.GetItemByIndexPath(indexPath); 7015 return (item != null) ? item.GetEnabled() : true; 7016 }, 7017 SetItemEnabled: function(indexPath, enabled, initialization) { 7018 if(indexPath == "" || !this.GetItemByIndexPath(indexPath).enabled) return; 7019 if(!enabled) { 7020 if(this.GetSelectedItemIndexPath() == indexPath) 7021 this.DeselectItem(indexPath); 7022 } 7023 if(!initialization || !enabled) 7024 this.ChangeItemEnabledStateItems(indexPath, enabled); 7025 this.ChangeItemEnabledAttributes(indexPath, enabled); 7026 if(enabled) { 7027 if(this.GetSelectedItemIndexPath() == indexPath) 7028 this.SelectItem(indexPath); 7029 } 7030 }, 7031 ChangeItemEnabledStateItems: function(indexPath, enabled) { 7032 if(!this.IsStateControllerEnabled()) return; 7033 this.UpdateHoverableItems(indexPath, enabled); 7034 var element = this.GetItemElement(indexPath); 7035 if(element) 7036 ASPx.GetStateController().SetElementEnabled(element, enabled); 7037 }, 7038 UpdateHoverableItems: function(indexPath, enabled) { 7039 var menuItemElement = this.GetItemElement(indexPath); 7040 if(menuItemElement) { 7041 var postfixes = ["", Constants.ItemPopoutElementPostfix, Constants.ItemContentElementPostfix]; 7042 for(var i = 0; i < postfixes.length; i++) { 7043 var element = ASPx.CacheHelper.GetCachedElementById(this, this.GetItemElementId(indexPath) + postfixes[i]); 7044 if(element) { 7045 if(enabled) { 7046 var hoverItem = element.savedHoverItem; 7047 if(hoverItem) 7048 ASPx.GetStateController().AddHoverItem(hoverItem.name, hoverItem.classNames, hoverItem.cssTexts, hoverItem.postfixes, hoverItem.imageObjs, hoverItem.imagePostfixes, hoverItem.disableApplyingStyleToLink); 7049 } 7050 else { 7051 element.savedHoverItem = ASPx.GetStateController().GetHoverItem(element); 7052 } 7053 } 7054 } 7055 ASPx.GetStateController().ClearElementCacheInContainer(menuItemElement); 7056 if(!enabled) 7057 ASPx.GetStateController().RemoveItem(ASPx.GetStateController().hoverItems, this.GetItemElementId(indexPath), postfixes); 7058 } 7059 }, 7060 GetItemImageUrl: function(indexPath) { 7061 var image = this.GetItemImage(indexPath); 7062 if(image) 7063 return image.src; 7064 return ""; 7065 }, 7066 SetItemImageUrl: function(indexPath, url) { 7067 var image = this.GetItemImage(indexPath); 7068 if(image) 7069 image.src = url; 7070 }, 7071 AddItemImageClassName: function(indexPath, className) { 7072 var image = this.GetItemImage(indexPath); 7073 if(image) { 7074 var accessibilityElement = image.parentNode; 7075 if(accessibilityElement.tagName == "SPAN") 7076 ASPx.AddClassNameToElement(accessibilityElement, className); 7077 else 7078 ASPx.AddClassNameToElement(image, className); 7079 } 7080 else {
7081 var svgElement = this.getSvgElement(indexPath); 7082 if(svgElement) { 7083 ASPx.AddClassNameToElement(svgElement, className); 7084 var useElement = ASPx.GetNodeByTagName(svgElement, "use", 0); 7085 useElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', "#" + className); 7086 } 7087 } 7088 }, 7089 AddItemAdditionalImageClassName: function(indexPath) { 7090 }, 7091 getSvgElement: function(indexPath) { 7092 var element = this.GetItemContentElement(indexPath); 7093 if(element != null) { 7094 var svgElement = ASPx.GetNodeByTagName(element, "svg", 0); 7095 if(svgElement != null) { 7096 return svgElement; 7097 } 7098 } 7099 }, 7100 GetItemImage: function(indexPath) { 7101 var element = this.GetItemContentElement(indexPath); 7102 if(element != null) { 7103 var img = ASPx.GetNodeByTagName(element, "IMG", 0); 7104 if(img != null) 7105 return img; 7106 } 7107 }, 7108 GetItemNavigateUrl: function(indexPath) { 7109 var element = this.GetItemContentElement(indexPath); 7110 if(element != null && element.tagName === "A") 7111 return ASPx.Attr.GetAttribute(element, "savedhref") || element.href; 7112 if(element != null) { 7113 var link = ASPx.GetNodeByTagName(element, "A", 0); 7114 if(link != null) 7115 return ASPx.Attr.GetAttribute(link, "savedhref") || link.href; 7116 } 7117 return ""; 7118 }, 7119 SetUrl: function(link, url, target) { 7120 if(link != null) { 7121 if(ASPx.Attr.IsExistsAttribute(link, "savedhref")) 7122 ASPx.Attr.SetAttribute(link, "savedhref", url); 7123 else if(ASPx.Attr.IsExistsAttribute(link, "href")) 7124 link.href = url; 7125 if(!!target) 7126 link.target = target; 7127 } 7128 }, 7129 SetItemNavigateUrl: function(indexPath, url, target) { 7130 var element = this.GetItemContentElement(indexPath); 7131 if(element != null) { 7132 if(element.tagName === "A") 7133 this.SetUrl(element, url, target); 7134 else { 7135 this.SetUrl(ASPx.GetNodeByTagName(element, "A", 0), url, target); 7136 this.SetUrl(ASPx.GetNodeByTagName(element, "A", 1), url, target); 7137 } 7138 } 7139 }, 7140 FindTextNode: function(indexPath) { 7141 var contentElement = this.GetItemContentElement(indexPath); 7142 if(contentElement) { 7143 var link = this.GetLinkElementByIndexPath(indexPath); 7144 if(link) 7145 return ASPx.GetNormalizedTextNode(link); 7146 var textElement = this.GetContentTextElement(contentElement); 7147 if(textElement) 7148 return ASPx.GetNormalizedTextNode(textElement); 7149 return ASPx.GetNormalizedTextNode(contentElement); 7150 } 7151 return null; 7152 }, 7153 GetContentTextElement: function(contentElement) { 7154 return ASPx.GetChildByClassName(contentElement, MenuCssClasses.ItemTextElement, 0); 7155 }, 7156 GetItemText: function(indexPath) { 7157 var textNode = this.FindTextNode(indexPath); 7158 return textNode 7159 ? ASPx.Str.Trim(textNode.nodeValue) 7160 : ""; 7161 }, 7162 SetItemText: function(indexPath, text) { 7163 var textNode = this.FindTextNode(indexPath); 7164 if(textNode) { 7165 textNode.nodeValue = text; 7166 var menuElement = this.GetMenuElement(this.GetParentIndexPath(indexPath)); 7167 if(menuElement && (!this.IsRootItem(indexPath) || this.isPopupMenu)) 7168 this.renderHelper.CalculateSubMenu(menuElement, true); 7169 if(this.IsRootItem(indexPath) && !this.isPopupMenu) { 7170 var itemElement = this.GetItemElement(indexPath); 7171 if(itemElement) 7172 this.renderHelper.CalculateItemMinSize(itemElement, true); 7173 } 7174 this.AdjustControl(); 7175 } 7176 }, 7177 SetItemTextTemplate: function(indexPath, textTemplate) { 7178 var contentElement = this.GetItemContentElement(indexPath); 7179 var textElement = this.GetContentTextElement(contentElement); 7180 if(textElement) { 7181 var container = document.createElement("DIV"); 7182 container.innerHTML = textTemplate; 7183 contentElement.replaceChild(container.firstChild, textElement); 7184 } 7185 }, 7186 SetItemTooltip: function(indexPath, tooltip) { 7187 var itemElement = this.GetItemElement(indexPath); 7188 if(itemElement && tooltip) 7189 itemElement.title = tooltip; 7190 }, 7191 SetItemVisible: function(indexPath, visible, initialization) { 7192 var item = this.GetItemByIndexPath(indexPath); 7193 if(indexPath == "" || !item.visible) return; 7194 if(visible && initialization) return; 7195 var element = this.GetItemElement(indexPath); 7196 if(element != null) 7197 this.SetElementDisplay(element, visible); 7198 this.SetIndentsVisiblility(indexPath); 7199 var parentIndexPath = this.GetParentIndexPath(indexPath); 7200 if(this.isPopupMenu && this.inPopUpHandler) 7201 this.postponeSetItemVisible(parentIndexPath); 7202 else 7203 this.SetSeparatorsVisiblility(parentIndexPath); 7204 if(!this.IsItemInAdaptiveMenu(item))
7205 this.UpdateItemCssClasses(indexPath, visible); 7206 var parent = this.GetItemByIndexPath(indexPath).parent; 7207 var parentHasVisibleItems = this.HasVisibleItems(parent); 7208 if(this.IsRootItem(indexPath) && !this.isPopupMenu) { 7209 if(this.clientVisible) 7210 this.SetElementDisplay(this.GetMainElement(), parentHasVisibleItems); 7211 } 7212 else 7213 this.SetPopOutElementVisible(parent.indexPath, parentHasVisibleItems); 7214 if(this.GetMenuLevel(parentIndexPath) !== 0 || this.isPopupMenu && !this.inPopUpHandler) 7215 this.calculateSubMenuByIndexPath(parentIndexPath); 7216 if(this.IsRootItem(indexPath) && !this.isPopupMenu) 7217 this.renderHelper.CalculateMenuControl(this.GetMainElement(), true); 7218 }, 7219 SetElementDisplay: function (element, visible) { 7220 ASPx.SetElementDisplay(element, visible); 7221 }, 7222 prepareSideMenuCssClasses: function(addClass) { 7223 if(this.sideMenuModeOn) { 7224 this.MarkPrecedingItemCore(this.GetSelectedItemIndexPath(), PRE_SELECTED_ELEMENT_CLASS_NAME, addClass, false); 7225 if(this.hoverItemName) 7226 this.MarkPrecedingItemCore(this.hoverItemName, PRE_HOVERED_ELEMENT_CLASS_NAME, addClass, true); 7227 } 7228 }, 7229 calculateSubMenuByIndexPath: function(indexPath) { 7230 var menuElement = this.GetMenuElement(indexPath); 7231 if(menuElement) 7232 this.renderHelper.CalculateSubMenu(menuElement, true); 7233 }, 7234 postponeSetItemVisible: function(indexPath) { 7235 if(!this.postponedIndexPath) 7236 this.postponedIndexPath = []; 7237 for(var i = 0; i < this.postponedIndexPath.length; i++) { 7238 if(this.postponedIndexPath[i] === indexPath) 7239 return; 7240 } 7241 this.postponedIndexPath.push(indexPath); 7242 }, 7243 postponedSetItemVisible: function() { 7244 if(!!this.postponedIndexPath && this.postponedIndexPath.length > 0) 7245 ASPx.Data.ForEach(this.postponedIndexPath, function(indexPath) { 7246 this.SetSeparatorsVisiblility(indexPath); 7247 this.calculateSubMenuByIndexPath(indexPath); 7248 }.aspxBind(this)); 7249 this.postponedIndexPath = []; 7250 }, 7251 SetIndentsVisiblility: function(indexPath) { 7252 var parent = this.GetItemByIndexPath(indexPath).parent; 7253 for(var i = 0; i < parent.GetItemCount(); i++) { 7254 var item = parent.GetItem(i); 7255 var separatorVisible = this.HasPrevVisibleItems(parent, i) && item.GetVisible(); 7256 var element = this.GetItemIndentElement(item.GetIndexPath()); 7257 if(element != null) ASPx.SetElementDisplay(element, separatorVisible); 7258 } 7259 }, 7260 SetSeparatorsVisiblility: function(indexPath) { 7261 var parent = this.GetItemByIndexPath(indexPath); 7262 for(var i = 0; i < parent.GetItemCount(); i++) { 7263 var item = parent.GetItem(i); 7264 var separatorVisible = this.HasPrevVisibleItems(parent, i) && (item.GetVisible() || this.HasNextVisibleItemInGroup(parent, i)); 7265 var element = this.GetItemSeparatorElement(item.GetIndexPath()); 7266 if(element != null) ASPx.SetElementDisplay(element, separatorVisible); 7267 } 7268 }, 7269 UpdateItemCssClasses: function(indexPath, visible) { 7270 }, 7271 SetPopOutElementVisible: function(indexPath, visible) { 7272 var popOutElement = this.GetItemPopOutElement(indexPath); 7273 if(popOutElement) 7274 popOutElement.style.display = visible ? 'block' : 'none'; 7275 }, 7276 GetPrevVisibleItemInGroup: function(parent, index, skipItemsInAdaptiveMenu) { 7277 if(this.IsItemBeginsGroup(parent.GetItem(index))) 7278 return null; 7279 for(var i = index - 1; i >= 0; i--) { 7280 var item = parent.GetItem(i); 7281 if(item.GetVisible() && !this.IsAdaptiveItem(item.indexPath) && (!skipItemsInAdaptiveMenu || !this.IsItemInAdaptiveMenu(item))) 7282 return item; 7283 if(this.IsItemBeginsGroup(item)) 7284 return null; 7285 } 7286 return null; 7287 }, 7288 GetNextVisibleItemInGroup: function(parent, index, skipItemsInAdaptiveMenu) { 7289 for(var i = index + 1; i < parent.GetItemCount(); i++) { 7290 var item = parent.GetItem(i); 7291 if(this.IsItemBeginsGroup(item)) 7292 return null; 7293 if(item.GetVisible() && !this.IsAdaptiveItem(item.indexPath) && (!skipItemsInAdaptiveMenu || !this.IsItemInAdaptiveMenu(item))) 7294 return item; 7295 } 7296 return null; 7297 }, 7298 HasNextVisibleItemInGroup: function(parent, index, skipItemsInAdaptiveMenu) { 7299 return !!this.GetNextVisibleItemInGroup(parent, index, skipItemsInAdaptiveMenu); 7300 }, 7301 IsItemBeginsGroup: function(item) { 7302 var itemSeparator = this.GetItemSeparatorElement(item.GetIndexPath()); 7303 return itemSeparator && ASPx.ElementContainsCssClass(itemSeparator, this.get
7303SeparatorCssClass()); 7304 }, 7305 getSeparatorCssClass: function() { 7306 return MenuCssClasses.Separator; 7307 }, 7308 getAdaptiveMenuItemCssClass: function() { 7309 return MenuCssClasses.AdaptiveMenuItem; 7310 }, 7311 getAdaptiveMenuItemSpacingCssClass: function() { 7312 return MenuCssClasses.AdaptiveMenuItemSpacing; 7313 }, 7314 getAdaptiveMenuCssClass: function() { 7315 return MenuCssClasses.AdaptiveMenu; 7316 }, 7317 IsItemInAdaptiveMenu: function(item) { 7318 return this.enableAdaptivity ? this.renderHelper.IsItemInAdaptiveMenu(item.index) : false; 7319 }, 7320 HasVisibleItems: function(parent) { 7321 for(var i = 0; i < parent.GetItemCount() ; i++) { 7322 if(parent.GetItem(i).GetVisible()) 7323 return true; 7324 } 7325 return false; 7326 }, 7327 HasNextVisibleItems: function(parent, index, skipItemsInAdaptiveMenu) { 7328 for(var i = index + 1; i < parent.GetItemCount() ; i++) { 7329 var item = parent.GetItem(i); 7330 if(item.GetVisible() && (!skipItemsInAdaptiveMenu || !this.IsItemInAdaptiveMenu(item))) 7331 return true; 7332 } 7333 return false; 7334 }, 7335 HasPrevVisibleItems: function(parent, index, skipItemsInAdaptiveMenu) { 7336 for(var i = index - 1; i >= 0; i--) { 7337 var item = parent.GetItem(i); 7338 if(item.GetVisible() && (!skipItemsInAdaptiveMenu || !this.IsItemInAdaptiveMenu(item))) 7339 return true; 7340 } 7341 return false; 7342 }, 7343 NeedCollapseControlCore: function() { 7344 return this.enableAdaptivity || ASPxClientControl.prototype.NeedCollapseControlCore.call(this); 7345 }, 7346 GetItemIndentElement: function(indexPath) { 7347 return ASPx.GetElementById(this.GetItemIndentElementId(indexPath)); 7348 }, 7349 GetItemSeparatorElement: function(indexPath) { 7350 return ASPx.GetElementById(this.GetItemSeparatorElementId(indexPath)); 7351 }, 7352 CreateItemClickEventArgs: function(processOnServer, item, htmlElement, htmlEvent) { 7353 return new ASPxClientMenuItemClickEventArgs(processOnServer, item, htmlElement, htmlEvent); 7354 }, 7355 CreateItemMouseEventArgs: function(item, htmlElement) { 7356 return new ASPxClientMenuItemMouseEventArgs(item, htmlElement); 7357 }, 7358 CreateItemEventArgs: function(item) { 7359 return new ASPxClientMenuItemEventArgs(item); 7360 }, 7361 RaiseItemClick: function(indexPath, htmlEvent) { 7362 var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ItemClick"); 7363 if(!this.ItemClick.IsEmpty()) { 7364 var item = this.GetItemByIndexPath(indexPath); 7365 var htmlElement = this.GetItemElement(indexPath); 7366 var args = this.CreateItemClickEventArgs(processOnServer, item, htmlElement, htmlEvent); 7367 this.ItemClick.FireEvent(this, args); 7368 processOnServer = args.processOnServer; 7369 } 7370 return processOnServer; 7371 }, 7372 RaiseItemMouseOver: function(indexPath) { 7373 if(!this.ItemMouseOver.IsEmpty()) { 7374 var item = this.GetItemByIndexPath(indexPath); 7375 var htmlElement = this.GetItemContentElement(indexPath); 7376 var args = this.CreateItemMouseEventArgs(item, htmlElement); 7377 this.ItemMouseOver.FireEvent(this, args); 7378 } 7379 }, 7380 RaiseItemMouseOut: function(indexPath) { 7381 if(!this.ItemMouseOut.IsEmpty()) { 7382 var item = this.GetItemByIndexPath(indexPath); 7383 var htmlElement = this.GetItemContentElement(indexPath); 7384 var args = this.CreateItemMouseEventArgs(item, htmlElement); 7385 this.ItemMouseOut.FireEvent(this, args); 7386 } 7387 }, 7388 RaisePopUp: function(indexPath) { 7389 var item = this.GetItemByIndexPath(indexPath); 7390 if(!this.PopUp.IsEmpty()) { 7391 var args = this.CreateItemEventArgs(item); 7392 this.inPopUpHandler = true; 7393 this.PopUp.FireEvent(this, args); 7394 this.inPopUpHandler = false; 7395 this.postponedSetItemVisible(); 7396 } 7397 }, 7398 RaiseCloseUp: function(indexPath) { 7399 var item = this.GetItemByIndexPath(indexPath); 7400 if(!this.CloseUp.IsEmpty()) { 7401 var args = this.CreateItemEventArgs(item); 7402 this.CloseUp.FireEvent(this, args); 7403 } 7404 }, 7405 SetEnabled: function(enabled) { 7406 for(var i = this.GetItemCount() - 1; i >= 0; i--) { 7407 var item = this.GetItem(i); 7408 item.SetEnabled(enabled); 7409 } 7410 }, 7411 SetVisible: function(visible) { 7412 ASPxClientControl.prototype.SetVisible.call(this, visible); 7413 if(visible && !this.HasVisibleItems(this)) 7414 ASPx.SetElementDisplay(this.GetMainElement(), false); 7415 }, 7416 GetItemCount: function() { 7417 return (this.rootItem != null) ? this.rootItem.GetItemCount() : 0; 7418 }, 7419 GetItem: function(index) { 7420 return (this.rootItem != null) ? this.rootItem.GetItem(index) : null; 7421 }, 7422 GetItemByName: function(name) { 7423 return (this.rootItem != null) ? this.rootItem.GetItemByName(name) : null; 7424 }, 7425 GetSelectedItem: function() { 7426 var indexPath = this.GetSelectedItemIndexPath(); 7427 if(indexPath != "") 7428 return this.GetItemByIndexPath(indexPath); 7429 return null; 7430 }, 7431 SetSelectedItem: function(item) { 7432 var indexPath = (item != null) ? item.GetIndexPath() : ""; 7433 this.SetSelectedItemInternal(indexPath, false); 7434 }, 7435 GetRootItem: function() { 7436 return this.rootItem; 7437 } 7438}); 7439ASPxClientMenuBase.GetMenuCollection = function() { 7440 return aspxGetMenuCollection(); 7441}; 7442var ASPxMenuKeyboardHelper = ASPx.CreateClass(null, { 7443 constructor: function(menu) { 7444 this.menu = menu; 7445 this.accessibilityCompliant = menu.accessibilityCompliant; 7446 this.isContextMenu = menu.isContextMenu; 7447 this.rtl = menu.rtl; 7448 }, 7449 OnFocusedItemKeyDown: function(evt, focusedItem) { 7450 var indexPath = this.menu.GetItemIndexPathById(focusedItem.name); 7451 if(!this.IsAllowedItemAction(evt, focusedItem.enabled, indexPath)) 7452 ASPx.Evt.PreventEventAndBubble(evt); 7453 else 7454 this.OnFocusedItemKeyDownInternal(evt, indexPath); 7455 }, 7456 OnFocusedItemKeyDownInternal: function(evt, indexPath) { 7457 if(!indexPath) 7458 return; 7459 var keyCode = ASPx.Evt.GetKeyCode(evt); 7460 switch(keyCode) { 7461 case ASPx.Key.Tab: 7462 this.OnTab(indexPath, evt); 7463 break; 7464 case ASPx.Key.Down: 7465 this.OnArrowDown(indexPath, evt); 7466 break; 7467 case ASPx.Key.Up: 7468 this.OnArrowUp(indexPath, evt); 7469 break; 7470 case ASPx.Key.Left: 7471 if(this.rtl) 7472 this.OnArrowRight(indexPath, evt); 7473 else 7474 this.OnArrowLeft(indexPath, evt); 7475 break; 7476 case ASPx.Key.Right: 7477 if(this.rtl) 7478 this.OnArrowLeft(indexPath, evt); 7479 else 7480 this.OnArrowRight(indexPath, evt); 7481 break; 7482 case ASPx.Key.Esc: 7483 this.OnEscape(indexPath, evt); 7484 break; 7485 case ASPx.Key.Space: break; 7486 case ASPx.Key.Enter: break; 7487 case ASPx.Key.Shift: break; 7488 case ASPx.Key.Alt: break; 7489 case ASPx.Key.Ctrl: break; 7490 default: 7491 ASPx.Evt.PreventEventAndBubble(evt); 7492 break; 7493 } 7494 }, 7495 OnTab: function(indexPath, evt) {
7496 var isRootItem = this.IsRootItem(indexPath); 7497 if(isRootItem && !this.accessibilityCompliant) return; 7498 if(this.IsLostFocus(indexPath, evt)) 7499 this.menu.ProcessLostFocus(evt); 7500 else 7501 this.ProcessTab(indexPath, evt); 7502 }, 7503 ProcessTab: function(indexPath, evt) { 7504 if(this.IsRootItem(indexPath)) 7505 this.FocusRootItem(indexPath, evt); 7506 else 7507 this.FocusSubmenuItem(indexPath, evt); 7508 }, 7509 OnArrowDown: function(indexPath, evt) { 7510 if(this.menu.IsVertical(indexPath)) 7511 this.FocusNextItem(indexPath); 7512 else 7513 this.ShowSubMenuAccessible(indexPath); 7514 ASPx.Evt.PreventEventAndBubble(evt); 7515 }, 7516 OnArrowUp: function(indexPath, evt) { 7517 if(this.menu.IsVertical(indexPath)) 7518 this.FocusPrevItem(indexPath); 7519 else 7520 this.ShowSubMenuAccessible(indexPath); 7521 ASPx.Evt.PreventEventAndBubble(evt); 7522 }, 7523 OnArrowLeft: function(indexPath, evt) { 7524 var isVertical = this.menu.IsVertical(indexPath); 7525 if(isVertical) { 7526 var isRootItem = this.IsRootItem(indexPath); 7527 if(isRootItem) 7528 this.FocusPrevItem(indexPath); 7529 else 7530 this.FocusItemByIndexPathAccessible(this.GetLeftParentIndexPath(indexPath)); 7531 } else 7532 this.FocusPrevItem(indexPath); 7533 ASPx.Evt.PreventEventAndBubble(evt); 7534 }, 7535 OnArrowRight: function(indexPath, evt) { 7536 var isVertical = this.menu.IsVertical(indexPath); 7537 if(isVertical) { 7538 var hasChildren = this.menu.HasChildren(indexPath); 7539 if(hasChildren) 7540 this.ShowSubMenuAccessible(indexPath); 7541 else 7542 this.FocusItemByIndexPathAccessible(this.GetRightRootParentIndexPath(indexPath)); 7543 } 7544 else 7545 this.FocusNextItem(indexPath); 7546 ASPx.Evt.PreventEventAndBubble(evt); 7547 }, 7548 OnEscape: function(indexPath, evt) { 7549 var needPreventEvent = true; 7550 if(this.IsRootItem(indexPath)) { 7551 aspxGetMenuCollection().DoHidePopupMenus(null, -1, this.name, false, ""); 7552 this.menu.ProcessLostFocus(evt); 7553 } 7554 else { 7555 var parentIndexPath = this.menu.GetParentIndexPath(indexPath); 7556 this.FocusItemByIndexPathAccessible(parentIndexPath); 7557 var element = this.menu.GetMenuElement(parentIndexPath); 7558 if(element != null) 7559 this.menu.DoHidePopupMenu(null, element); 7560 else 7561 needPreventEvent = false; 7562 } 7563 if(needPreventEvent) 7564 ASPx.Evt.PreventEventAndBubble(evt); 7565 }, 7566 IsLostFocus: function(indexPath, evt) { 7567 var keyCode = ASPx.Evt.GetKeyCode(evt); 7568 var isRootItem = this.IsRootItem(indexPath); 7569 if(keyCode !== ASPx.Key.Tab || !isRootItem) 7570 return false; 7571 var canPrevItemGetFocus = evt.shiftKey && this.GetPrevSiblingIndexPath(indexPath); 7572 var canNextItemGetFocus = !evt.shiftKey && this.GetNextSiblingIndexPath(indexPath); 7573 return !canPrevItemGetFocus && !canNextItemGetFocus; 7574 }, 7575 FocusRootItem: function(indexPath, evt) { 7576 if(evt.shiftKey) 7577 this.FocusPrevItem(indexPath, evt); 7578 else 7579 this.FocusNextItem(indexPath, evt); 7580 var isFocusElementChanged = ASPx.Evt.GetEventSource(evt) !== document.activeElement; 7581 if(isFocusElementChanged) 7582 ASPx.Evt.PreventEventAndBubble(evt); 7583 }, 7584 FocusSubmenuItem: function(indexPath, evt) { 7585 if(evt.shiftKey) 7586 this.FocusPreviousSubmenuItem(indexPath, evt); 7587 else 7588 this.FocusNextSubmenuItem(indexPath, evt); 7589 }, 7590 FocusPreviousSubmenuItem: function(indexPath, evt) { 7591 if(!this.GetPrevSiblingIndexPath(indexPath)) { 7592 var parentIndexPath = this.menu.GetParentIndexPath(indexPath); 7593 this.FocusItemByIndexPathAccessible(parentIndexPath); 7594 } else 7595 this.FocusPrevItem(indexPath); 7596 ASPx.Evt.PreventEventAndBubble(evt); 7597 }, 7598 FocusNextSubmenuItem: function(indexPath, evt) { 7599 var nextIndexPath = this.GetNextIndexPath(indexPath); 7600 if(nextIndexPath) { 7601 var isLevelChanged = this.IsLevelChanged(indexPath, nextIndexPath); 7602 this.FocusItemCore(nextIndexPath, isLevelChanged); 7603 ASPx.Evt.PreventEventAndBubble(evt); 7604 } else 7605 this.menu.ProcessLostFocus(evt); 7606 }, 7607 GetNextIndexPath: function(indexPath) { 7608 var result = this.GetNextSiblingIndexPath(indexPath); 7609 if(!result) { 7610 var parentIndexPath = this.menu.GetParentIndexPath(indexPath); 7611 if(parentIndexPath) 7612 result = this.GetNextIndexPath(parentIndexPath); 7613 } 7614 return result; 7615 }, 7616 GetRightRootParentIndexPath: function(indexPath) { 7617 var parentIndexPath = this.GetParentRootIndexPath(indexPath); 7618 return this.GetNextFocusableItemIndexPath(parentIndexPath); 7619 }, 7620 GetLeftParentIndexPath: function(indexPath) { 7621 var parentIndexPath = this.menu.GetParentIndexPath(indexPath); 7622 if(!this.menu.IsVertical(parentIndexPath)) 7623 parentIndexPath = this.GetPrevFocusableItemIndexPath(parentIndexPath); 7624 return parentIndexPath; 7625 }, 7626 GetParentRootIndexPath: function(indexPath) { 7627 while(!this.IsRootItem(indexPath)) 7628 indexPath = this.menu.GetParentIndexPath(indexPath); 7629 return indexPath; 7630 }, 7631 ShowSubMenuAccessible: function(indexPath) { 7632 var newIndexPath = this.GetFirstChildIndexPath(indexPath), 7633 element = this.menu.GetMenuElement(indexPath); 7634 if(element && !this.menu.isSubMenuElementVisible(element)) 7635 this.menu.ShowSubMenu(indexPath); 7636 if(!!newIndexPath) 7637 this.FocusItemByIndexPathAccessible(newIndexPath); 7638 }, 7639 FocusItemByIndexPathAccessible: function(indexPath) { 7640 this.FocusItemCore(indexPath, true); 7641 }, 7642 IsAllowedItemAction: function(evt, isEnabled, indexPath) { 7643 var isVertical = this.menu.IsVertical(indexPath); 7644 return !this.accessibilityCompliant || 7645 isEnabled || 7646 this.IsAllowedFocusMoving(evt) || 7647 this.IsAllowedHorizontalFocusMoving(evt, isVertical) || 7648 this.IsAllowedVerticalFocusMoving(evt, isVertical); 7649 }, 7650 IsAllowedFocusMoving: function(evt) { 7651 return evt.keyCode == ASPx.Key.Tab || evt.keyCode == ASPx.Key.Esc; 7652 }, 7653 IsAllowedHorizontalFocusMoving: function(evt, isVertical) { 7654 return !isVertical && (evt.keyCode == ASPx.Key.Left || evt.keyCode == ASPx.Key.Right); 7655 }, 7656 IsAllowedVerticalFocusMoving: function(evt, isVertical) { 7657 return isVertical && (evt.keyCode == ASPx.Key.Up || evt.keyCode == ASPx.Key.Down); 7658 }, 7659 FocusItemByIndexPath: function(indexPath) { 7660 var link = this.menu.GetLinkElementByIndexPath(indexPath); 7661 if(link != null) { 7662 if(this.accessibilityCompliant && !link.href) 7663 link.href = ASPx.AccessibilityEmptyUrl; 7664 ASPx.SetFocus(link); 7665 } else 7666 this.FocusTemplateItemActionElement(indexPath); 7667 }, 7668 FocusTemplateItemActionElement: function(indexPath) { 7669 var element = this.menu.GetItemElement(indexPath); 7670 var focusableElement = ASPx.FindFirstChildActionElement(element); 7671 if(focusableElement) 7672 ASPx.SetFocus(focusableElement); 7673 else { 7674 var parentIndexPath = this.menu.GetParentIndexPath(indexPath); 7675 this.tryFocusColorPickerByIndexPath(parentIndexPath); 7676 } 7677 }, 7678 tryFocusColorPickerByIndexPath: function(indexPath) { 7679 var colorPicker = this.getColorPickerByIndexPath(indexPath); 7680 if(colorPicker) 7681 colorPicker.Focus(); 7682 }, 7683 getColorPickerByIndexPath: function(indexPath) { 7684 var menuItem = this.menu.GetItemByIndexPath(indexPath); 7685 return menuItem.colorPicker; 7686 }, 7687 PronounceItemDescription: function(indexPath) { 7688 var link = this.menu.GetLinkElementByIndexPath(indexPath); 7689 var span = ASPx.GetNodeByTagName(link, "SPAN", 0); 7690 if(!link) return; 7691 if(!!span && !span.id) { 7692 var spanID = this.GetAccessibilityTextSpanID(indexPath); 7693 span.id = spanID; 7694 ASPx.Attr.SetAttribute(link, "aria-describedby", spanID); 7695 } 7696 ASPx.Attr.SetAttribute(link, "aria-label", this.GetAccessibilityItemDescription(indexPath)); 7697 }, 7698 RemoveAccessibilityDescription: function(indexPath) { 7699 var link = this.menu.GetLinkElementByIndexPath(indexPath); 7700 if(link && ASPx.Attr.GetAttribute(link, "aria-label")) 7701 ASPx.Attr.RemoveAttribute(link, "aria-label"); 7702 }, 7703 GetAccessibilityTextSpanID: function(indexPath) { 7704 return this.name + Constants.ATSIdSuffix + indexPath; 7705 }, 7706 GetAccessibilityItemDescription: function(indexPath) { 7707 var descriptionParts = []; 7708 descriptionParts.push(this.menu.IsVertical(indexPath) ? ASPx.AccessibilitySR.MenuVerticalText : ASPx.AccessibilitySR.MenuHorizontalText); 7709 descriptionParts.push(this.IsRootItem(indexPath) ? ASPx.AccessibilitySR.MenuBarText : ASPx.AccessibilitySR.MenuText); 7710 descriptionParts.push(this.menu.GetMenuLevel(indexPath)); 7711 descriptionParts.push(ASPx.AccessibilitySR.MenuLevelText); 7712 return descriptionParts.join(' '); 7713 }, 7714 FocusNextItem: function(indexPath) { 7715 var newIndexPath = this.GetNextFocusableItemIndexPath(indexPath); 7716 if(newIndexPath) 7717 this.FocusItemCore(newIndexPath, false); 7718 }, 7719 FocusPrevItem: function(indexPath) { 7720 var newIndexPath = this.GetPrevFocusableItemIndexPath(indexPath); 7721 if(newIndexPath) 7722 this.FocusItemCore(newIndexPath, false); 7723 }, 7724 FocusItemCore: function(indexPath, needDescription) { 7725 if(this.accessibilityCompliant) { 7726 if(needDescription) 7727 this.PronounceItemDescription(indexPath); 7728 else 7729 this.RemoveAccessibilityDescription(indexPath); 7730 } 7731 this.FocusItemByIndexPath(indexPath); 7732 }, 7733 GetNextFocusableItemIndexPath: function(indexPath) { 7734 var newIndexPath = this.GetNextSiblingIndexPath(indexPath); 7735 if(newIndexPath == null) 7736 newIndexPath = this.GetFirstSiblingIndexPath(indexPath); 7737 if(indexPath != newIndexPath) 7738 return newIndexPath; 7739 }, 7740 GetPrevFocusableItemIndexPath: function(indexPath) { 7741 var newIndexPath = this.GetPrevSiblingIndexPath(indexPath); 7742 if(newIndexPath == null) 7743 newIndexPath = this.GetLastSiblingIndexPath(indexPath); 7744 if(indexPath != newIndexPath) 7745 return newIndexPath; 7746 }, 7747 GetFirstChildIndexPath: function(indexPath) { 7748 var indexes = this.menu.GetItemIndexes(indexPath); 7749 indexes[indexes.length] = 0;
7750 var newIndexPath = this.menu.GetItemIndexPath(indexes); 7751 return this.GetFirstSiblingIndexPath(newIndexPath); 7752 }, 7753 GetFirstSiblingIndexPath: function(indexPath) { 7754 var indexes = this.menu.GetItemIndexes(indexPath); 7755 var i = 0; 7756 while(true) { 7757 indexes[indexes.length - 1] = i; 7758 var newIndexPath = this.menu.GetItemIndexPath(indexes); 7759 if(!this.IsItemExist(newIndexPath)) 7760 return null; 7761 if(this.IsFocusableItem(newIndexPath)) 7762 return newIndexPath; 7763 i++; 7764 } 7765 return null; 7766 }, 7767 GetLastSiblingIndexPath: function(indexPath) { 7768 var indexes = this.menu.GetItemIndexes(indexPath); 7769 var parentItem = this.menu.GetItemByIndexPath(this.menu.GetParentIndexPath(indexPath)); 7770 var i = parentItem ? parentItem.GetItemCount() - 1 : 0; 7771 while(true) { 7772 indexes[indexes.length - 1] = i; 7773 var newIndexPath = this.menu.GetItemIndexPath(indexes); 7774 if(!this.IsItemExist(newIndexPath)) 7775 return null; 7776 if(this.IsFocusableItem(newIndexPath)) 7777 return newIndexPath; 7778 i--; 7779 } 7780 return null; 7781 }, 7782 GetNextSiblingIndexPath: function(indexPath) { 7783 if(this.menu.IsLastItem(indexPath)) return null; 7784 var indexes = this.menu.GetItemIndexes(indexPath); 7785 var i = indexes[indexes.length - 1] + 1; 7786 while(true) { 7787 indexes[indexes.length - 1] = i; 7788 var newIndexPath = this.menu.GetItemIndexPath(indexes); 7789 if(!this.IsItemExist(newIndexPath)) 7790 return null; 7791 if(this.IsFocusableItem(newIndexPath)) 7792 return newIndexPath; 7793 i++; 7794 } 7795 return null; 7796 }, 7797 GetPrevSiblingIndexPath: function(indexPath) { 7798 if(this.menu.IsFirstItem(indexPath)) return null; 7799 var indexes = this.menu.GetItemIndexes(indexPath); 7800 var i = indexes[indexes.length - 1] - 1; 7801 while(true) { 7802 indexes[indexes.length - 1] = i; 7803 var newIndexPath = this.menu.GetItemIndexPath(indexes); 7804 if(!this.IsItemExist(newIndexPath)) 7805 return null; 7806 if(this.IsFocusableItem(newIndexPath)) 7807 return newIndexPath; 7808 i--; 7809 } 7810 return null; 7811 }, 7812 IsItemExist: function(indexPath) { 7813 return !!this.menu.GetItemByIndexPath(indexPath); 7814 }, 7815 IsItemVisible: function(indexPath) { 7816 var item = this.menu.GetItemByIndexPath(indexPath); 7817 return item ? item.GetVisible() : false; 7818 }, 7819 IsFocusableItem: function(indexPath) { 7820 return this.IsItemVisible(indexPath) && (this.menu.IsItemEnabled(indexPath) || this.IsItemAccessibleEnabled(indexPath)); 7821 }, 7822 IsRootItem: function(indexPath) { 7823 return this.menu.IsRootItem(indexPath); 7824 }, 7825 IsItemAccessibleEnabled: function(indexPath) { 7826 var item = this.menu.GetItemByIndexPath(indexPath); 7827 return this.accessibilityCompliant && item && item.enabled; 7828 }, 7829 IsLevelChanged: function(firstIndexPath, secondIndexPath) { 7830 return this.menu.GetMenuLevel(firstIndexPath) !== this.menu.GetMenuLevel(secondIndexPath); 7831 } 7832}); 7833var ASPxClientMenuCollection = ASPx.CreateClass(ASPxClientControlCollection, { 7834 constructor: function() { 7835 this.constructor.prototype.constructor.call(this); 7836 this.appearTimerID = -1; 7837 this.disappearTimerID = -1; 7838 this.currentShowingPopupMenuName = null; 7839 this.visibleSubMenusMenuName = ""; 7840 this.visibleSubMenuIds = []; 7841 this.overXPos = -1; 7842 this.overYPos = -1; 7843 }, 7844 GetCollectionType: function(){ 7845 return "Menu"; 7846 }, 7847 Remove: function(element) { 7848 if(element.name === this.visibleSubMenusMenuName) { 7849 this.visibleSubMenusMenuName = ""; 7850 this.visibleSubMenuIds = [ ]; 7851 } 7852 ASPxClientControlCollection.prototype.Remove.call(this, element); 7853 }, 7854 RegisterVisiblePopupMenu: function(name, id) { 7855 this.visibleSubMenuIds.push(id); 7856 this.visibleSubMenusMenuName = name; 7857 }, 7858 UnregisterVisiblePopupMenu: function(name, id) { 7859 ASPx.Data.ArrayRemove(this.visibleSubMenuIds, id); 7860 if(this.visibleSubMenuIds.length == 0) 7861 this.visibleSubMenusMenuName = ""; 7862 }, 7863 IsSubMenuVisible: function(subMenuId) { 7864 for(var i = 0; i < this.visibleSubMenuIds.length; i++) { 7865 if(this.visibleSubMenuIds[i] == subMenuId) 7866 return true; 7867 } 7868 return false; 7869 }, 7870 GetMenu: function(id) { 7871 return this.Get(this.GetMenuName(id)); 7872 }, 7873 GetMenuName: function(id) { 7874 return this.GetMenuNameBySuffixes(id, [Constants.MMIdSuffix, Constants.MIIdSuffix]); 7875 }, 7876 GetMenuNameBySuffixes: function(id, idSuffixes) { 7877 for(var i = 0; i < idSuffixes.length; i++) { 7878 var pos = id.lastIndexOf(idSuffixes[i]); 7879 if(pos > -1) 7880 return id.substring(0, pos); 7881 } 7882 return id; 7883 }, 7884 ClearCurrentShowingPopupMenuName: function() { 7885 this.SetCurrentShowingPopupMenuName(null); 7886 }, 7887 SetCurrentShowingPopupMenuName: function(value) { 7888 this.currentShowingPopupMenuName = value; 7889 }, 7890 NowPopupMenuIsShowing: function() { 7891 return this.currentShowingPopupMenuName != null; 7892 }, 7893 GetMenuLevelById: function(id) { 7894 var indexPath = this.GetIndexPathById(id, Constants.MMIdSuffix); 7895 var menu = this.GetMenu(id); 7896 return menu.GetMenuLevel(indexPath); 7897 }, 7898 GetIndexPathById: function(id, idSuffix) { 7899 var pos = id.lastIndexOf(idSuffix); 7900 if(pos > -1) { 7901 id = id.substring(pos + idSuffix.length); 7902 pos = id.lastIndexOf("_"); 7903 if(pos > -1) 7904 return id.substring(0, pos); 7905 } 7906 return ""; 7907 },
7908 GetItemIndexPath: function(indexes) { 7909 var indexPath = ""; 7910 for(var i = 0; i < indexes.length; i++) { 7911 indexPath += indexes[i]; 7912 if(i < indexes.length - 1) 7913 indexPath += ASPx.ItemIndexSeparator; 7914 } 7915 return indexPath; 7916 }, 7917 GetItemIndexes: function(indexPath) { 7918 var indexes = indexPath.split(ASPx.ItemIndexSeparator); 7919 for(var i = 0; i < indexes.length; i++) 7920 indexes[i] = parseInt(indexes[i]); 7921 return indexes; 7922 }, 7923 ClearAppearTimer: function() { 7924 this.appearTimerID = ASPx.Timer.ClearTimer(this.appearTimerID); 7925 }, 7926 ClearDisappearTimer: function() { 7927 this.disappearTimerID = ASPx.Timer.ClearTimer(this.disappearTimerID); 7928 }, 7929 IsAppearTimerActive: function() { 7930 return this.appearTimerID > -1; 7931 }, 7932 IsDisappearTimerActive: function() { 7933 return this.disappearTimerID > -1; 7934 }, 7935 SetAppearTimer: function(name, indexPath, timeout, preventSubMenu) { 7936 var menu = aspxGetMenuCollection().Get(name); 7937 if(menu && !menu.sideMenuModeOn) 7938 this.appearTimerID = window.setTimeout(function() { 7939 var menu = aspxGetMenuCollection().Get(name); 7940 if(menu != null) menu.OnItemOverTimer(indexPath, preventSubMenu); 7941 }, timeout); 7942 }, 7943 SetDisappearTimer: function(name, timeout) { 7944 var menu = aspxGetMenuCollection().Get(name); 7945 if(menu && !menu.sideMenuModeOn) 7946 this.disappearTimerID = window.setTimeout(function() { 7947 var menu = aspxGetMenuCollection().Get(name); 7948 if(menu != null) 7949 menu.OnItemOutTimer(); 7950 }, timeout); 7951 }, 7952 GetMouseDownMenuLevel: function(evt) { 7953 var srcElement = ASPx.Evt.GetEventSource(evt); 7954 for(var i = this.visibleSubMenuIds.length - 1; i >= 0; i--) { 7955 var element = ASPx.GetParentById(srcElement, this.visibleSubMenuIds[i]); 7956 var menu = this.GetMenu(this.visibleSubMenuIds[i]); 7957 if(element != null || srcElement == menu.mainElement) 7958 return this.GetMenuLevelById(this.visibleSubMenuIds[i]) + 1; 7959 } 7960 if(this.visibleSubMenusMenuName != "") { 7961 var element = ASPx.GetParentById(srcElement, this.visibleSubMenusMenuName); 7962 if(element != null) return 1; 7963 } 7964 if(ASPx.GetParentByClassName(srcElement, MenuCssClasses.AdaptiveMenuItem)) 7965 return 1; 7966 return -1; 7967 }, 7968 CheckFocusedElement: function() { 7969 var isValid = false; 7970 try { 7971 var activeElement = document.activeElement; 7972 if(activeElement != null) { 7973 for(var i = 0; i < this.visibleSubMenuIds.length; i++) { 7974 var menuElement = ASPx.GetElementById(this.visibleSubMenuIds[i]); 7975 if(menuElement != null && ASPx.GetIsParent(menuElement, activeElement)) { 7976 var tagName = activeElement.tagName; 7977 if(tagName != "A" || 7978 !ASPx.ElementHasCssClass(activeElement, MenuCssClasses.ContentContainer) || 7979 this.GetMenu(this.visibleSubMenusMenuName).accessibilityCompliant) 7980 isValid = true; 7981 break; 7982 } 7983 } 7984 } 7985 } catch (e) { 7986 } 7987 return isValid; 7988 }, 7989 LockMenusVisibility: function() { 7990 this.visibilityLocked = true; 7991 this.visibilityLockedIds = []; 7992 for(var i = this.visibleSubMenuIds.length - 1; i >= 0 ; i--) 7993 this.visibilityLockedIds.push(this.visibleSubMenuIds[i]); 7994 }, 7995 UnlockMenusVisibility: function() { 7996 this.visibilityLocked = false; 7997 this.visibilityLockedIds = []; 7998 }, 7999 CanHideSubMenu: function(subMenuId) { 8000 return !this.visibilityLocked || this.visibilityLocked && this.visibilityLockedIds.indexOf(subMenuId) > -1; 8001 }, 8002 DoHidePopupMenus: function(evt, level, name, leavePopups, exceptIds) { 8003 exceptIds = typeof exceptIds === 'string' ? [exceptIds] : (exceptIds || []); 8004 for(var i = this.visibleSubMenuIds.length - 1; i >= 0 ; i--) { 8005 var subMenuId = this.visibleSubMenuIds[i]; 8006 if(this.CanHideSubMenu(subMenuId)) { 8007 var menu = this.GetMenu(subMenuId); 8008 if(menu != null && !menu.sideMenuModeOn) { 8009 var menuLevel = this.GetMenuLevelById(subMenuId); 8010 if((!leavePopups || menuLevel > 0) && ASPx.Data.ArrayIndexOf(exceptIds, subMenuId) === -1) { 8011 if(menuLevel > level || (menu.name != name && name != "")) { 8012 var element = ASPx.GetElementById(subMenuId); 8013 if(element != null) 8014 menu.DoHidePopupMenu(evt, element); 8015 } 8016 } 8017 } 8018 } 8019 } 8020 }, 8021 DoShowAtCurrentPos: function(name, indexPath) { 8022 var pc = this.Get(name); 8023 var element = pc.GetMainElement(); 8024 if(pc != null && !ASPx.GetElementDisplay(element)) 8025 pc.DoShowPopupMenu(element, this.overXPos, this.overYPos, indexPath); 8026 }, 8027 SaveCurrentMouseOverPos: function(evt, popupElement) { 8028 if(!this.NowPopupMenuIsShowing()) return; 8029 var currentShowingPopupMenu = this.Get(this.currentShowingPopupMenuName); 8030 if(currentShowingPopupMenu.popupElement == popupElement) 8031 if(!currentShowingPopupMenu.IsMenuVisible()) { 8032 this.overXPos = ASPx.Evt.GetEventX(evt); 8033 this.overYPos = ASPx.Evt.GetEventY(evt); 8034 } 8035 }, 8036 OnMouseDown: function(evt) { 8037 var menuLevel = this.GetMouseDownMenuLevel(evt); 8038 this.DoHidePopupMenus(evt, menuLevel, "", false, ""); 8039 if (ASPx.Browser.TouchUI && menuLevel == -1) 8040 ASPx.SetHoverState(null); 8041 }, 8042 RecalculateAll: function() { 8043 var visibleSubMenusLength = this.visibleSubMenuIds.length; 8044 for(var i = 0; i < visibleSubMenusLength; i++) { 8045 var menu = this.GetMenu(this.visibleSubMenuIds[i]); 8046 if(menu != null) { 8047 var element = ASPx.GetElementById(this.visibleSubMenuIds[i]); 8048 if(element != null) { 8049 var indexPath = this.GetIndexPathById(this.visibleSubMenuIds[i], Constants.MMIdSuffix); 8050 menu.CalculateSubMenuPosition(element, ASPx.InvalidPosition, ASPx.InvalidPosition, indexPath, false); 8051 } 8052 } 8053 } 8054 }, 8055 HideAll: function() { 8056 this.DoHidePopupMenus(null, -1, "", false, ""); 8057 }, 8058 IsAnyMenuVisible: function() { 8059 return this.visibleSubMenuIds.length != 0; 8060 } 8061}); 8062var menuCollection = null; 8063function aspxGetMenuCollection() { 8064 if(menuCollection == null) 8065 menuCollection = new ASPxClientMenuCollection(); 8066 return menuCollection; 8067} 8068var ASPxClientMenuItem = ASPx.CreateClass(null, { 8069 constructor: function(menu, parent, index, name) { 8070 this.menu = menu; 8071 this.parent = parent; 8072 this.index = index; 8073 this.name = name; 8074 this.indexPath = ""; 8075 this.text = ""; 8076 this.imageUrl = ""; 8077 this.imageClassName = ""; 8078 this.tooltip = ""; 8079 this.target = ""; 8080 this.beginGroup = false; 8081 this.dropDownMode = false; 8082 if(parent) { 8083 this.indexPath = this.CreateItemIndexPath(parent); 8084 } 8085 this.enabled = true; 8086 this.clientEnabled = true; 8087 this.visible = true; 8088 this.clientVisible = true; 8089 this.items = []; 8090 this.colorPicker = null; 8091 this.checkedGroup = []; 8092 this.checked = false; 8093 }, 8094 CreateItemIndexPath: function(parent) { 8095 return parent.indexPath ? parent.indexPath + ASPx.ItemIndexSeparator + this.index.toString() : this.index.toString(); 8096 }, 8097 ClearRenderedChildItems: function() { 8098 if(this.items.length > 0) { 8099 var parentNode = this.menu.GetItemElement(this.items[0].indexPath).parentNode; 8100 parentNode.innerHTML = ""; 8101 this.items = []; 8102 } 8103 },
8104 CreateItems: function(itemsProperties) { 8105 for(var i = 0, len = itemsProperties.length; i < len; i++) { 8106 var itemProperties = itemsProperties[i], 8107 item = this.CreateItemInternal(itemProperties); 8108 if(itemProperties.items && itemProperties.items.length > 0) 8109 item.CreateItems(itemProperties.items); 8110 } 8111 }, 8112 CreateItemInternal: function(itemProperties) { 8113 var itemName = itemProperties.name || ""; 8114 var index = this.items.length; 8115 var itemType = this.menu.GetClientItemType(); 8116 var item = new itemType(this.menu, this, index, itemName); 8117 if(ASPx.IsExists(itemProperties.text)) 8118 item.text = itemProperties.text; 8119 if(ASPx.IsExists(itemProperties.imageUrl)) 8120 item.imageUrl = itemProperties.imageUrl; 8121 if(ASPx.IsExists(itemProperties.imageHottrackSrc)) 8122 item.imageHottrackSrc = itemProperties.imageHottrackSrc; 8123 if(ASPx.IsExists(itemProperties.imageClassName)) 8124 item.imageClassName = itemProperties.imageClassName; 8125 if(ASPx.IsExists(itemProperties.navigateUrl)) 8126 item.navigateUrl = itemProperties.navigateUrl; 8127 if(ASPx.IsExists(itemProperties.beginGroup)) 8128 item.beginGroup = itemProperties.beginGroup; 8129 if(ASPx.IsExists(itemProperties.enabled) && !this.menu.NeedCreateItemsOnClientSide()) 8130 item.enabled = itemProperties.enabled; 8131 if((ASPx.IsExists(itemProperties.clientEnabled) && !itemProperties.clientEnabled) || (ASPx.IsExists(itemProperties.enabled) && !itemProperties.enabled)) 8132 item.clientEnabled = false; 8133 if(ASPx.IsExists(itemProperties.visible)) 8134 item.visible = itemProperties.visible; 8135 if(ASPx.IsExists(itemProperties.clientVisible)) 8136 item.clientVisible = itemProperties.clientVisible; 8137 if(ASPx.IsExists(itemProperties.groupName)) { 8138 this.menu.ProcessItemGroupName(item, itemProperties.groupName); 8139 item.checked = !!itemProperties.checked; 8140 } 8141 if(ASPx.IsExists(itemProperties.tooltip)) 8142 item.tooltip = itemProperties.tooltip; 8143 if(ASPx.IsExists(itemProperties.target)) 8144 item.target = itemProperties.target; 8145 if(ASPx.IsExists(itemProperties.dropDownMode)) 8146 item.dropDownMode = itemProperties.dropDownMode; 8147 if(ASPx.IsExists(itemProperties.textTemplate)) 8148 item.textTemplate = itemProperties.textTemplate; 8149 if(ASPx.IsExists(itemProperties.styles)) 8150 item.styles = itemProperties.styles; 8151 if(ASPx.IsExists(itemProperties.isSvg)) 8152 item.isSvg = itemProperties.isSvg; 8153 if(this.menu.NeedAppendToRenderData(item)) 8154 this.menu.AppendToRenderData(this.indexPath, index); 8155 this.items.push(item); 8156 return item; 8157 }, 8158 GetIndexPath: function() { 8159 return this.indexPath; 8160 }, 8161 GetItemCount: function() { 8162 return this.items.length; 8163 }, 8164 GetItem: function(index) { 8165 return (0 <= index && index < this.items.length) ? this.items[index] : null; 8166 }, 8167 GetItemByName: function(name) { 8168 for(var i = 0; i < this.items.length; i++) 8169 if(this.items[i].name == name) return this.items[i]; 8170 for(var i = 0; i < this.items.length; i++) { 8171 var item = this.items[i].GetItemByName(name); 8172 if(item != null) return item; 8173 } 8174 return null; 8175 }, 8176 GetChecked: function() { 8177 var indexPath = this.GetIndexPath(); 8178 return this.menu.IsCheckedItem(indexPath); 8179 }, 8180 SetChecked: function(value) { 8181 var indexPath = this.GetIndexPath(); 8182 this.menu.SetItemChecked(indexPath, value); 8183 }, 8184 GetEnabled: function() { 8185 return this.enabled && this.clientEnabled; 8186 }, 8187 SetEnabled: function(value) { 8188 if(this.clientEnabled != value) { 8189 this.clientEnabled = value; 8190 this.menu.SetItemEnabled(this.GetIndexPath(), value, false); 8191 } 8192 }, 8193 GetImage: function() { 8194 return this.menu.GetItemImage(this.GetIndexPath()); 8195 }, 8196 GetImageUrl: function() { 8197 return this.menu.GetItemImageUrl(this.GetIndexPath()); 8198 }, 8199 SetImageUrl: function(value) { 8200 var indexPath = this.GetIndexPath(); 8201 this.menu.SetItemImageUrl(indexPath, value); 8202 }, 8203 GetNavigateUrl: function() { 8204 var indexPath = this.GetIndexPath(); 8205 return this.menu.GetItemNavigateUrl(indexPath); 8206 }, 8207 SetNavigateUrl: function(value) { 8208 var indexPath = this.GetIndexPath(); 8209 this.menu.SetItemNavigateUrl(indexPath, value); 8210 }, 8211 GetText: function() { 8212 var indexPath = this.GetIndexPath(); 8213 return this.menu.GetItemText(indexPath); 8214 }, 8215 SetText: function(value) { 8216 var indexPath = this.GetIndexPath(); 8217 this.menu.SetItemText(indexPath, value); 8218 }, 8219 GetVisible: function() { 8220 return this.visible && this.clientVisible; 8221 }, 8222 SetVisible: function(value) { 8223 if(this.clientVisible != value) { 8224 this.setClientVisibleInternal(value); 8225 this.menu.SetItemVisible(this.GetIndexPath(), value, false); 8226 } 8227 }, 8228 InitializeEnabledAndVisible: function(recursive) { 8229 this.menu.SetItemEnabled(this.GetIndexPath(), this.clientEnabled, true); 8230 this.menu.SetItemVisible(this.GetIndexPath(), this.clientVisible, true); 8231 if(recursive) { 8232 for(var i = 0; i < this.items.length; i++) 8233 this.items[i].InitializeEnabledAndVisible(recursive); 8234 } 8235 }, 8236 setClientVisibleInternal: function(value) {
8237 this.menu.prepareSideMenuCssClasses(false); 8238 this.clientVisible = value; 8239 this.menu.prepareSideMenuCssClasses(true); 8240 }, 8241 GetOwnProperties: function() { 8242 return { 8243 menuItem: this, 8244 focusableElement: this.GetFocusableElement() 8245 }; 8246 }, 8247 GetFocusableElement: function() { 8248 return this.menu.GetLinkElementByIndexPath(this.indexPath); 8249 } 8250}); 8251var subMenuStack = function() { 8252 this.stack = []; 8253 this.hasItems = function() { 8254 return this.stack.length > 1; 8255 }; 8256 this.count = function() { 8257 return this.stack.length; 8258 }; 8259 this.last = function() { 8260 return this.stack[this.stack.length - 1].element; 8261 }; 8262 this.push = function(element, text) { 8263 this.stack.push({element: element, text: text}); 8264 }; 8265 this.pop = function() { 8266 return this.stack.pop().element; 8267 }; 8268 this.text = function() { 8269 return this.stack[this.stack.length - 1].text; 8270 }; 8271}; 8272var appearPanelAction = ASPx.CreateClass({ 8273 constructor: function(menu) { 8274 this.menu = menu; 8275 this.expanded = false; 8276 this.cashedHtmlOverflow = ''; 8277 this.bodyLeftMargin = 0; 8278 this.clearWidth = 0; 8279 this.animationInProgress = false; 8280 this.panel = this.menu.GetMainElement().parentNode; 8281 this.burgerButton = this.createBurgerButton(); 8282 this.overlayPanel = this.createOverlayElement(); 8283 this.afterCollapsePanel = new ASPxClientEvent(); 8284 ASPx.Evt.AttachEventToElement(this.burgerButton, 'click', function() { this.toggleExpanded(); }.bind(this), true); 8285 ASPx.Evt.AttachEventToElement(this.overlayPanel, 'click', function() { this.toggleExpanded(); }.bind(this), true); 8286 }, 8287 get isLeftPosition() { 8288 return this.menu.position == 'left'; 8289 }, 8290 createBurgerButton: function() { 8291 var button = document.createElement('DIV'); 8292 button.className = BURGER_CLASS_NAME; 8293 if(!!this.menu.hamburgerClass) 8294 ASPx.AddClassNameToElement(button, this.menu.hamburgerClass); 8295 var line = document.createElement('DIV'); 8296 button.appendChild(line); 8297 this.panel.parentNode.appendChild(button); 8298 return button; 8299 }, 8300 createOverlayElement: function() { 8301 var panel = document.createElement('DIV'); 8302 panel.className = OVERLAY_PANEL_CLASS_NAME; 8303 this.panel.parentNode.appendChild(panel); 8304 return panel; 8305 }, 8306 toggleExpanded: function() { 8307 this.setExpanded(!this.getExpanded()); 8308 }, 8309 getExpanded: function() { 8310 return this.expanded; 8311 }, 8312 setExpanded: function(value) { 8313 if(this.expanded != value && !this.isAnimationInProgress()) { 8314 this.expanded = value; 8315 this.setExpandedCore(); 8316 } 8317 }, 8318 setExpandedCore: function() { 8319 if(this.expanded) { 8320 this.prepareForAnimateIn(); 8321 this.animateIn(); 8322 } 8323 else 8324 this.animateOut(); 8325 }, 8326 collapse: function() { 8327 this.expanded = false; 8328 this.rollbackAfterAnimateOut(); 8329 }, 8330 isAnimationInProgress: function() { 8331 return !!this.animationInProgress; 8332 }, 8333 prepareForAnimateIn: function() { 8334 this.prepareDocument(); 8335 this.prepareOverlayPanel(); 8336 this.prepareSlidePanel(); 8337 }, 8338 prepareDocument: function() { 8339 this.cashedHtmlOverflow = document.documentElement.style.overflow; 8340 document.documentElement.style.overflow = 'hidden'; 8341 }, 8342 prepareOverlayPanel: function() { 8343 ASPx.SetStyles(this.overlayPanel, { 8344 opacity: '0', 8345 zIndex: SIDE_MENU_ZINDEX_VALUE, 8346 display: 'block' 8347 }); 8348 ASPx.SetStyles(this.overlayPanel, { 8349 marginLeft: -ASPx.GetAbsoluteX(this.overlayPanel), 8350 marginTop: -ASPx.GetAbsoluteY(this.overlayPanel), 8351 }); 8352 }, 8353 prepareSlidePanel: function() { 8354 ASPx.SetStyles(this.panel, { display: 'block', width: '100%', zIndex: SIDE_MENU_ZINDEX_VALUE + 1 }); 8355 this.menu.AdjustControl(); 8356 var size = this.menu.calculateMaxSize(); 8357 this.clearWidth = size.width; 8358 var width = size.width; 8359 var overflowY = ''; 8360 if(size.height > window.innerHeight) { 8361 overflowY = 'scroll'; 8362 width = size.width + ASPx.GetVerticalScrollBarWidth(); 8363 } 8364 ASPx.SetStyles(this.panel, { 8365 className: this.panel.className + ' ' + SLIDE_PANEL_EXPANDED_CLASS_NAME, 8366 overflowY: overflowY, 8367 width: width 8368 }); 8369 }, 8370 createTransition: function(element, obj) { 8371 return transition = ASPx.AnimationHelper.createAnimationTransition(element, { 8372 property: obj.property, unit: obj.unit, duration: SLIDE_DURATION_VALUE, transition: ASPx.AnimationConstants.Transitions.POW_EASE_OUT, onComplete: obj.onComplete 8373 }); 8374 }, 8375 getInTransitions: function() { 8376 var arr = []; 8377 arr.push({ 8378 trans: this.createTransition(this.panel, { property: this.isLeftPosition ? 'left' : 'right', unit: 'px' }), 8379 start: -this.panel.offsetWidth, 8380 end: 0 8381 }); 8382 arr.push({ 8383 trans: this.createTransition(this.overlayPanel, { 8384 property: 'opacity', 8385 onComplete: function() { 8386 this.animationInProgress = false; 8387 }.aspxBind(this) 8388 }), 8389 start: 0, 8390 end: 100 8391 }); 8392 return arr; 8393 }, 8394 getOutTransitions: function() { 8395 var arr = []; 8396 arr.push({ 8397 trans: this.createTransition(this.panel, { property: this.isLeftPosition ? 'left' : 'right', unit: 'px' }), 8398 start: 0, 8399 end: -this.panel.offsetWidth 8400 }); 8401 arr.push({ 8402 trans: this.createTransition(this.overlayPanel, { 8403 property: 'opacity', 8404 onComplete: function() { 8405 window.setTimeout(function() { 8406 this.rollbackAfterAnimateOut(); 8407 this.animationInProgress = false; 8408 }.aspxBind(this), 0); 8409 }.aspxBind(this) 8410 }), 8411 start: 100, 8412 end: 0 8413 }); 8414 return arr; 8415 }, 8416 animateIn: function() { 8417 this.animate(this.getInTransitions()); 8418 }, 8419 animateOut: function() { 8420 this.animate(this.getOutTransitions()); 8421 }, 8422 animate: function(transitions) { 8423 this.animationInProgress = true; 8424 for(var i = 0, obj; obj = transitions[i]; i++) 8425 obj.trans.Start(obj.start, obj.end); 8426 }, 8427 resetPanelStyle: function() { 8428 ASPx.SetStyles(this.panel, { 8429 className: this.panel.className.replace(SLIDE_PANEL_EXPANDED_CLASS_NAME, ''),
8430 left: '', width: '', display: '', zIndex: '' 8431 }); 8432 }, 8433 resetOverlayPanelStyle: function() { 8434 ASPx.SetStyles(this.overlayPanel, { 8435 display: '', 8436 zIndex: '', 8437 marginLeft: 0, 8438 marginTop: 0 8439 }); 8440 }, 8441 rollbackAfterAnimateOut: function() { 8442 this.resetPanelStyle(); 8443 this.resetOverlayPanelStyle(); 8444 document.documentElement.style.overflow = this.cashedHtmlOverflow; 8445 this.afterCollapsePanel.FireEvent(); 8446 } 8447}); 8448var appearPanelWithShiftBodyAction = ASPx.CreateClass(appearPanelAction, { 8449 constructor: function(menu) { 8450 this.cashedBodyMargin = ''; 8451 this.cashedBodyWidth = ''; 8452 this.constructor.prototype.constructor.call(this, menu); 8453 }, 8454 getInTransitions: function() { 8455 var arr = appearPanelAction.prototype.getInTransitions.call(this); 8456 arr.push({ 8457 trans: this.createTransition(document.body, { property: 'marginLeft', unit: 'px' }), 8458 start: this.bodyLeftMargin, 8459 end: (this.isLeftPosition ? 1 : -1) * (this.bodyLeftMargin + this.panel.offsetWidth) 8460 }); 8461 return arr; 8462 }, 8463 getOutTransitions: function() { 8464 var arr = appearPanelAction.prototype.getOutTransitions.call(this); 8465 arr.push({ 8466 trans: this.createTransition(document.body, { property: 'marginLeft', unit: 'px' }), 8467 start: (this.isLeftPosition ? 1 : -1) * (this.bodyLeftMargin + this.panel.offsetWidth), 8468 end: this.bodyLeftMargin 8469 }); 8470 return arr; 8471 }, 8472 prepareForAnimateIn: function() { 8473 this.bodyLeftMargin = ASPx.PxToInt(ASPx.GetCurrentStyle(document.body).marginLeft); 8474 this.cashedBodyWidth = document.body.style.width; 8475 this.cashedBodyMargin = document.body.style.marginLeft; 8476 document.body.style.width = document.body.offsetWidth + 'px'; 8477 appearPanelAction.prototype.prepareForAnimateIn.call(this); 8478 }, 8479 rollbackAfterAnimateOut: function() { 8480 document.body.style.width = this.cashedBodyWidth; 8481 document.body.style.marginLeft = this.cashedBodyMargin; 8482 appearPanelAction.prototype.rollbackAfterAnimateOut.call(this); 8483 } 8484}); 8485var ASPxClientMenu = ASPx.CreateClass(ASPxClientMenuBase, { 8486 constructor: function(name) { 8487 this.constructor.prototype.constructor.call(this, name); 8488 this.isVertical = false; 8489 this.orientationChanged = false; 8490 this.firstSubMenuDirection = "Auto"; 8491 this.enableSideMenu = false; 8492 this.sideMenuWindowInnerWidth = ASPx.MaxMobileWindowWidth; 8493 this.enableCollapseToIcons = false; 8494 this.collapseToIconsWindowInnerWidth = ASPx.MaxMobileWindowWidth; 8495 this.showPopOutImages = false; 8496 this.sideMenuModeOn = false; 8497 this.iconsViewModeOn = false; 8498 this.position = 'left'; 8499 this.expandMode = 0; 8500 this.direction = this.position == 'left' ? 1 : -1; 8501 this.appearAction = null; 8502 this.subMenuStack = null; 8503 this.breadCrumb = null; 8504 }, 8505 InlineInitialize: function() { 8506 var mainElement = this.GetMainElement(); 8507 if(this.enableSideMenu) { 8508 mainElement.parentNode.className += ' dxm-' + this.position; 8509 this.subMenuStack = new subMenuStack(); 8510 this.subMenuStack.push(this.GetMainElement()); 8511 this.appearAction = this.createAppearAction(); 8512 this.breadCrumb = this.createBreadCrumbs(); 8513 this.updateBreadCrumbsText('TEMP'); 8514 this.switchMenuView(true); 8515 } 8516 this.switchBetweenTextAndIcons(); 8517 this.renderHelper.ApplyItemsVerticalAlignment(mainElement); 8518 ASPxClientMenuBase.prototype.InlineInitialize.call(this); 8519 }, 8520 BrowserWindowResizeSubscriber: function() { 8521 return ASPxClientMenuBase.prototype.BrowserWindowResizeSubscriber.call(this) || this.enableSideMenu || this.enableCollapseToIcons; 8522 }, 8523 SetData: function(data){ 8524 ASPxClientMenuBase.prototype.SetData.call(this, data); 8525 if(data.adaptiveModeData) 8526 this.SetAdaptiveMode(data.adaptiveModeData); 8527 }, 8528 IsVertical: function(indexPath) { 8529 return this.isVertical || !this.IsRootItem(indexPath) || this.IsAdaptiveMenuItem(indexPath); 8530 }, 8531 IsSidePanelExpanded: function() { 8532 return this.enableSideMenu && this.appearAction.getExpanded(); 8533 }, 8534 IsCorrectionDisableMethodRequired: function(indexPath) { 8535 return (indexPath.indexOf("i") == -1) && (this.firstSubMenuDirection == "RightOrBottom" || this.firstSubMenuDirection == "LeftOrTop"); 8536 }, 8537 SetAdaptiveMode: function(data) { 8538 this.enableAdaptivity = true; 8539 if(ASPx.Ident.IsArray(data)) 8540 this.adaptiveItemsOrder = data; 8541 else 8542 for(var i = data - 1; i >= 0; i--) 8543 this.adaptiveItemsOrder.push(i.toString()); 8544 }, 8545 OnBrowserWindowResize: function(e) { 8546 if(e && e.virtualKeyboardShownOnAndroid) return; 8547 this.switchMenuView(); 8548 this.switchBetweenTextAndIcons(); 8549 this.AdjustControl(); 8550 }, 8551 AdjustControlCore: function() { 8552 this.CorrectVerticalAlignment(ASPx.ClearHeight, this.GetPopOutElements, "PopOut", true); 8553 this.CorrectVerticalAlignment(ASPx.ClearVerticalMargins, this.GetPopOutImages, "PopOutImg", true); 8554 if(this.orientationChanged){ 8555 this.renderHelper.ChangeOrientaion(this.GetMainElement(), this.isVertical); 8556 this.orientationChanged = false; 8557 } 8558 else 8559 this.renderHelper.CalculateMenuControl(this.GetMainElement()); 8560 this.CorrectVerticalAlignment(ASPx.AdjustHeight, this.GetPopOutElements, "PopOut", true); 8561 this.CorrectVerticalAlignment(ASPx.AdjustVerticalMargins, this.GetPopOutImages, "PopOutImg", true); 8562 }, 8563 GetCorrectionDisabledResult: function(x, toLeftX) { 8564 switch (this.firstSubMenuDirection) { 8565 case "RightOrBottom": { 8566 this.popupToLeft = false; 8567 return x; 8568 } 8569 case "LeftOrTop": { 8570 this.popupToLeft = true; 8571 return toLeftX;
8572 } 8573 } 8574 }, 8575 IsHorizontalSubmenuNeedInversion: function(subMenuBottom, docClientHeight, menuItemTop, subMenuHeight, itemHeight) { 8576 if(this.firstSubMenuDirection == "Auto") 8577 return ASPxClientMenuBase.prototype.IsHorizontalSubmenuNeedInversion.call(this, subMenuBottom, docClientHeight, menuItemTop, subMenuHeight, itemHeight); 8578 return this.firstSubMenuDirection == "LeftOrTop"; 8579 }, 8580 createAppearAction: function() { 8581 var appearAction = this.expandMode == 0 ? new appearPanelWithShiftBodyAction(this) : new appearPanelAction(this); 8582 appearAction.afterCollapsePanel.AddHandler(function() { 8583 while(this.subMenuStack.hasItems()) 8584 this.performBack(true); 8585 ASPx.SetStyles(this.subMenuStack.last(), { left: '', opacity: '', display: '' }); 8586 ASPx.RemoveElement(this.breadCrumb); 8587 }.aspxBind(this)); 8588 return appearAction; 8589 }, 8590 createBreadCrumbs: function() { 8591 var element = document.createElement('DIV'); 8592 element.className = BREAD_CRUMBS_CLASS_NAME; 8593 ASPx.Evt.AttachEventToElement(element, 'click', function() { this.performBack(); }.bind(this), true); 8594 var breadCrumbsBackImage = document.createElement('IMG'); 8595 breadCrumbsBackImage.src = ASPx.EmptyImageUrl; 8596 breadCrumbsBackImage.className = BACK_ICON_CLASS_NAME; 8597 element.appendChild(breadCrumbsBackImage); 8598 var breadCrumbsTitle = document.createElement('SPAN'); 8599 element.appendChild(breadCrumbsTitle); 8600 return element; 8601 }, 8602 updateBreadCrumbsText: function() { 8603 var text = this.subMenuStack.text(); 8604 if(text) 8605 this.breadCrumb.children[1].innerHTML = this.subMenuStack.text(); 8606 }, 8607 calculateMaxSize: function() { 8608 var mainElement = this.GetMainElement(); 8609 var cachedWidth = mainElement.style.width; 8610 mainElement.style.width = ''; 8611 var size = { width: mainElement.offsetWidth, height: mainElement.offsetHeight }; 8612 this.foreachSubMenus(function(item, element) { 8613 if(!element) return; 8614 element.className += ' ' + TEMPORARY_VISIBILITY_CLASS_NAME; 8615 if(element.offsetWidth > size.width) 8616 size.width = element.offsetWidth; 8617 if(element.offsetHeight > size.height) 8618 size.height = element.offsetHeight; 8619 element.className = element.className.replace(' ' + TEMPORARY_VISIBILITY_CLASS_NAME, ''); 8620 }.bind(this)); 8621 mainElement.style.width = cachedWidth; 8622 return size; 8623 }, 8624 foreachSubMenus: function(menuItem, callback) { 8625 if(arguments.length == 1) { 8626 callback = menuItem; 8627 menuItem = this.GetRootItem(); 8628 } 8629 for(var i = 0, item; item = menuItem.items[i]; i++) 8630 this.foreachSubMenus(item, callback); 8631 if(menuItem.indexPath && menuItem.items.length) 8632 callback(menuItem, this.GetMenuElement(menuItem.indexPath)); 8633 }, 8634 switchMenuView: function(force) { 8635 if(this.enableSideMenu) { 8636 aspxGetMenuCollection().DoHidePopupMenus(null, 0, this.name, true, ""); 8637 var prevSideMenuOn = this.sideMenuModeOn; 8638 this.sideMenuModeOn = window.innerWidth < this.sideMenuWindowInnerWidth; 8639 if(this.sideMenuModeOn != prevSideMenuOn || force) 8640 this.switchMenuViewCore(); 8641 } 8642 }, 8643 switchBetweenTextAndIcons: function() { 8644 if(this.enableCollapseToIcons) { 8645 var newIconsViewModeOn = window.innerWidth <= this.collapseToIconsWindowInnerWidth; 8646 if(this.iconsViewModeOn != newIconsViewModeOn) 8647 this.ToggleRootItemsCollapsed(); 8648 } 8649 }, 8650 ToggleRootItemsCollapsed: function() { 8651 this.iconsViewModeOn = !this.iconsViewModeOn; 8652 ASPx.ToggleClassNameToElement(this.GetMainElement(), "dxm-onlyIcons", this.iconsViewModeOn); 8653 if(this.isInitialized) { 8654 this.renderHelper.ResetMinSize(); 8655 this.renderHelper.CalculateMenuControl(this.GetMainElement(), true); 8656 } 8657 }, 8658 switchMenuViewCore: function() { 8659 if(this.sideMenuModeOn) 8660 this.switchToSideMenuView(); 8661 else 8662 this.switchToDefaultMenuView(); 8663 }, 8664 switchToSideMenuView: function() { 8665 this.SetOrientation('Vertical'); 8666 this.switchSideMenuClass(); 8667 if(!this.showPopOutImages) { 8668 var mainElement = this.GetMainElement(); 8669 this.replacePopupOutImages(MenuCssClasses.ItemWithoutSubMenu, MenuCssClasses.ItemWithSubMenu); 8670 mainElement.className = mainElement.className.replace(NO_MAIN_POP_OUT_CLASS_NAME, ''); 8671 } 8672 }, 8673 switchToDefaultMenuView: function() { 8674 if(!this.showPopOutImages) { 8675 var mainElement = this.GetMainElement();
8676 this.replacePopupOutImages(MenuCssClasses.ItemWithSubMenu, MenuCssClasses.ItemWithoutSubMenu); 8677 if(mainElement.className.indexOf(NO_MAIN_POP_OUT_CLASS_NAME) == -1) 8678 mainElement.className += ' ' + NO_MAIN_POP_OUT_CLASS_NAME; 8679 } 8680 this.SetOrientation('Horizontal'); 8681 this.switchSideMenuClass(); 8682 this.appearAction.collapse(); 8683 }, 8684 switchSideMenuClass: function() { 8685 var rootElement = this.GetMainElement().parentNode.parentNode; 8686 if(this.sideMenuModeOn) { 8687 if(rootElement.className.indexOf(SIDE_MENU_CLASS_NAME) == -1) 8688 rootElement.className += ' ' + SIDE_MENU_CLASS_NAME; 8689 } 8690 else 8691 rootElement.className = rootElement.className.replace(' ' + SIDE_MENU_CLASS_NAME, ''); 8692 }, 8693 replacePopupOutImages: function(firstClass, secondClass) { 8694 var elements = this.renderHelper.GetItemElements(this.GetMainElement()); 8695 for(var i = 0, item = null; item = elements[i]; i++) { 8696 if(item.className.indexOf(firstClass)) 8697 item.className = item.className.replace(firstClass, secondClass); 8698 } 8699 }, 8700 CalculateSubMenuPosition: function(element, x, y, indexPath, enableAnimation) { 8701 if(this.sideMenuModeOn) 8702 this.performForward(indexPath); 8703 else { 8704 this.setSubMenuOffset(element, ''); 8705 ASPxClientMenuBase.prototype.CalculateSubMenuPosition.call(this, element, x, y, indexPath, enableAnimation); 8706 } 8707 }, 8708 startPanelAnimation: function(element, props, onComplete) { 8709 ASPx.AnimationHelper.createMultipleAnimationTransition(element, { 8710 duration: SLIDE_DURATION_VALUE, 8711 transition: ASPx.AnimationConstants.Transitions.POW_EASE_OUT, 8712 onComplete: onComplete 8713 }).Start(props); 8714 }, 8715 changeBreadCrumbsParent: function(parent) { 8716 if(this.subMenuStack.count() == 1 && !parent.querySelector('.' + BREAD_CRUMBS_CLASS_NAME)) 8717 parent.appendChild(this.breadCrumb); 8718 }, 8719 performForward: function(indexPath) { 8720 var element = this.GetMenuElement(indexPath); 8721 if(element != null) { 8722 var currentSubMenu = this.subMenuStack.last(); 8723 var currentSubMenuWidth = currentSubMenu.offsetWidth; 8724 var nextSubMenu = this.GetMenuElement(indexPath); 8725 this.setSubMenuVisible(nextSubMenu); 8726 this.changeBreadCrumbsParent(nextSubMenu); 8727 this.subMenuStack.push(nextSubMenu, this.GetItemByIndexPath(indexPath).GetText()); 8728 this.updateBreadCrumbsText(); 8729 this.setSubMenuSize(indexPath, nextSubMenu); 8730 this.startPanelAnimation(currentSubMenu, { 8731 left: { from: 0, to: this.direction * -(currentSubMenuWidth / 3), unit: "px" }, 8732 opacity: { from: 1, to: 0 } 8733 }, function(el) { el.style.display = 'none'; el.style.opacity = ''; }); 8734 window.setTimeout(function() { 8735 this.startPanelAnimation(nextSubMenu, { 8736 left: { from: this.direction * currentSubMenuWidth, to: 0, unit: "px" }, 8737 opacity: { from: 0, to: 1 } 8738 }, function(element) { this.onNextSubmenuAnimationEnd(element); }.bind(this)); 8739 }.bind(this), SLIDE_DURATION_VALUE / 3); 8740 } 8741 }, 8742 setSubMenuVisible: function(subMenu) { 8743 ASPx.SetStyles(subMenu, { 8744 top: '', display: '', visibility: '', opacity: 0 8745 }); 8746 }, 8747 setSubMenuSize: function(indexPath, subMenu) { 8748 var menuElement = this.GetMenuElement(indexPath); 8749 menuElement.style.width = this.appearAction.clearWidth + 'px'; 8750 this.setSubMenuOffset(subMenu, this.breadCrumb.offsetHeight + 'px'); 8751 }, 8752 setSubMenuOffset: function(subMenu, offset) { 8753 subMenu.children[0].style.top = offset; 8754 }, 8755 onNextSubmenuAnimationEnd: function(element) { 8756 if(element.children.length > 1) 8757 element.parentNode.appendChild(this.breadCrumb); 8758 }, 8759 performBack: function(skipAnimation) { 8760 if(this.subMenuStack.hasItems()) { 8761 var currentSubMenu = this.subMenuStack.pop(); 8762 var prevSubMenu = this.subMenuStack.last(); 8763 if(skipAnimation) 8764 this.performBackWithoutAnimation(currentSubMenu, prevSubMenu); 8765 else 8766 this.performBackWithAnimation(currentSubMenu, prevSubMenu); 8767 } 8768 }, 8769 performBackWithoutAnimation: function(currentSubMenu, prevSubMenu) { 8770 this.DoHidePopupMenu(null, currentSubMenu); 8771 }, 8772 performBackWithAnimation: function(currentSubMenu, prevSubMenu) { 8773 this.updateBreadCrumbsText(); 8774 this.changeBreadCrumbsParent(currentSubMenu); 8775 var width = currentSubMenu.offsetWidth; 8776 prevSubMenu.style.opacity = '0'; 8777 prevSubMenu.style.display = ''; 8778 this.startPanelAnimation(currentSubMenu, {
8779 left: { from: 0, to: this.direction * (width / 3), unit: "px" }, 8780 opacity: { from: 1, to: 0 } 8781 }, function(el) { el.style.opacity = ''; el.style.display = 'none'; this.DoHidePopupMenu(null, el); }.bind(this)); 8782 window.setTimeout(function() { 8783 this.startPanelAnimation(prevSubMenu, { 8784 left: { from: this.direction * -width, to: 0, unit: "px" }, 8785 opacity: { from: 0, to: 1 } 8786 }); 8787 }.bind(this), SLIDE_DURATION_VALUE / 3); 8788 }, 8789 GetOrientation: function() { 8790 return this.isVertical ? "Vertical" : "Horizontal"; 8791 }, 8792 SetOrientation: function(orientation) { 8793 var isVertical = orientation === "Vertical"; 8794 if(this.isVertical !== isVertical){ 8795 this.isVertical = isVertical; 8796 this.orientationChanged = true; 8797 this.ResetControlAdjustment(); 8798 this.AdjustControl(); 8799 } 8800 }, 8801 ToggleSideMenu: function() { 8802 if(this.sideMenuModeOn) 8803 this.appearAction.toggleExpanded(); 8804 } 8805}); 8806ASPx.Ident.scripts.ASPxClientMenu = true; 8807ASPxClientMenu.Cast = ASPxClientControl.Cast; 8808var ASPxClientMenuExt = ASPx.CreateClass(ASPxClientMenu, { 8809 constructor: function(name) { 8810 this.constructor.prototype.constructor.call(this, name); 8811 }, 8812 NeedCreateItemsOnClientSide: function() { 8813 return true; 8814 } 8815}); 8816var ASPxClientMenuItemEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 8817 constructor: function(item) { 8818 this.constructor.prototype.constructor.call(this); 8819 this.item = item; 8820 } 8821}); 8822var ASPxClientMenuItemMouseEventArgs = ASPx.CreateClass(ASPxClientMenuItemEventArgs, { 8823 constructor: function(item, htmlElement) { 8824 this.constructor.prototype.constructor.call(this, item); 8825 this.htmlElement = htmlElement; 8826 } 8827}); 8828var ASPxClientMenuItemClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, { 8829 constructor: function(processOnServer, item, htmlElement, htmlEvent) { 8830 this.constructor.prototype.constructor.call(this, processOnServer); 8831 this.item = item; 8832 this.htmlElement = htmlElement; 8833 this.htmlEvent = htmlEvent; 8834 } 8835}); 8836ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) { 8837 return aspxGetMenuCollection().OnMouseDown(evt); 8838}); 8839function aspxAMIMOver(source, args) { 8840 var menu = aspxGetMenuCollection().GetMenu(args.item.name); 8841 if(menu != null) menu.OnAfterItemOver(args.item, args.element); 8842} 8843function aspxBMIMOver(source, args) { 8844 var menu = aspxGetMenuCollection().GetMenu(args.item.name); 8845 if(menu != null) menu.OnBeforeItemOver(args.item, args.element); 8846} 8847function aspxAMIMOut(source, args) { 8848 var menu = aspxGetMenuCollection().GetMenu(args.item.name); 8849 if(menu != null) menu.OnAfterItemOut(args.item, args.element, args.toElement); 8850} 8851function aspxMSBOver(source, args) { 8852 var menu = MenuScrollHelper.GetMenuByScrollButtonId(args.element.id); 8853 if(menu != null) menu.ClearDisappearTimer(); 8854} 8855ASPx.AddAfterSetFocusedState(aspxAMIMOver); 8856ASPx.AddAfterClearFocusedState(aspxAMIMOut); 8857ASPx.AddAfterSetHoverState(aspxAMIMOver); 8858ASPx.AddAfterClearHoverState(aspxAMIMOut); 8859ASPx.AddBeforeSetFocusedState(aspxBMIMOver); 8860ASPx.AddBeforeSetHoverState(aspxBMIMOver); 8861ASPx.AddAfterSetHoverState(aspxMSBOver); 8862ASPx.AddAfterSetPressedState(aspxMSBOver); 8863ASPx.AddBeforeDisabled(function(source, args) { 8864 var menu = aspxGetMenuCollection().GetMenu(args.item.name); 8865 if(menu != null) 8866 menu.OnBeforeItemDisabled(args.item, args.element); 8867}); 8868ASPx.AddFocusedItemKeyDown(function(source, args) { 8869 var menu = aspxGetMenuCollection().GetMenu(args.item.name); 8870 if(menu != null) 8871 menu.OnFocusedItemKeyDown(args.htmlEvent, args.item); 8872}); 8873ASPx.AddAfterClearHoverState(function(source, args) { 8874 var menu = MenuScrollHelper.GetMenuByScrollButtonId(args.element.id); 8875 if(menu != null) menu.SetDisappearTimer(); 8876}); 8877ASPx.AddAfterSetPressedState(function(source, args) { 8878 var menu = MenuScrollHelper.GetMenuByScrollButtonId(args.element.id); 8879 if(menu) menu.StartScrolling(args.element.id, 1, 4); 8880}); 8881ASPx.AddAfterClearPressedState(function(source, args) { 8882 var menu = MenuScrollHelper.GetMenuByScrollButtonId(args.element.id);
8883 if(menu) menu.StopScrolling(args.element.id); 8884}); 8885if(!ASPx.Browser.TouchUI) { 8886 ASPx.AddAfterSetHoverState(function(source, args) { 8887 var menu = MenuScrollHelper.GetMenuByScrollButtonId(args.element.id); 8888 if(menu) menu.StartScrolling(args.element.id, 15, 1); 8889 if(!menu) 8890 menu = aspxGetMenuCollection().GetMenu(args.item.name); 8891 if(menu && menu.sideMenuModeOn && menu.IsItemElement(args.element)) { 8892 menu.hoverItemName = args.item.name; 8893 menu.MarkPrecedingItem(args.item.name, PRE_HOVERED_ELEMENT_CLASS_NAME, true); 8894 } 8895 }); 8896 ASPx.AddAfterClearHoverState(function(source, args) { 8897 var menu = MenuScrollHelper.GetMenuByScrollButtonId(args.element.id); 8898 if(menu) menu.StopScrolling(args.element.id); 8899 if(!menu) 8900 menu = aspxGetMenuCollection().GetMenu(args.item.name); 8901 if(menu && menu.sideMenuModeOn && menu.IsItemElement(args.element)) { 8902 menu.hoverItemName = null; 8903 menu.UnmarkPrecedingItem(args.item.name, PRE_HOVERED_ELEMENT_CLASS_NAME, true); 8904 } 8905 }); 8906} 8907ASPx.MIClick = function(evt, name, indexPath) { 8908 if(ASPx.TouchUIHelper.isMouseEventFromScrolling) return; 8909 var menu = aspxGetMenuCollection().Get(name); 8910 if(menu != null) menu.OnItemClick(indexPath, evt); 8911}; 8912ASPx.MIDDClick = function(evt, name, indexPath) { 8913 var menu = aspxGetMenuCollection().Get(name); 8914 if(menu != null) menu.OnItemDropDownClick(indexPath, evt); 8915 if(!ASPx.Browser.NetscapeFamily) 8916 evt.cancelBubble = true; 8917}; 8918ASPx.GetMenuCollection = aspxGetMenuCollection; 8919ASPx.MenuRenderHelper = MenuRenderHelper; 8920ASPx.MenuItemClasses = MenuCssClasses; 8921window.ASPxClientMenuBase = ASPxClientMenuBase; 8922window.ASPxClientMenuCollection = ASPxClientMenuCollection; 8923window.ASPxClientMenuItem = ASPxClientMenuItem; 8924window.ASPxClientMenu = ASPxClientMenu; 8925window.ASPxClientMenuExt = ASPxClientMenuExt; 8926window.ASPxClientMenuItemEventArgs = ASPxClientMenuItemEventArgs; 8927window.ASPxClientMenuItemMouseEventArgs = ASPxClientMenuItemMouseEventArgs; 8928window.ASPxClientMenuItemClickEventArgs = ASPxClientMenuItemClickEventArgs; 8929})(); 8930 8931(function(dx) { 8932 var Interactions = ASPx.CreateClass(null, { 8933 onSwipeLeft: function(selector, func) { 8934 }, 8935 onSwipeRight: function(selector, func) { 8936 } 8937 }); 8938 var BootstrapCore = {}; 8939 BootstrapCore.Interactions = new Interactions(); 8940 BootstrapCore.BootstrapMode = 'Bootstrap5'; 8941 BootstrapCore.IsBootstrap3 = BootstrapCore.BootstrapMode == "Bootstrap3"; 8942 BootstrapCore.IsBootstrap4 = BootstrapCore.BootstrapMode == "Bootstrap4"; 8943 BootstrapCore.IsBootstrap5 = BootstrapCore.BootstrapMode == "Bootstrap5"; 8944 BootstrapCore.CheckReferences = 'true'; 8945 BootstrapCore.zIndexCategories = { 8946 dropdown: 1000, 8947 sticky: 1020, 8948 fixed: 1030, 8949 modalBackdrop: 1040, 8950 modal: 1050, 8951 popover: 1060, 8952 tooltip: 1070 8953 }; 8954 var bsCssClass = "dxbs-" + BootstrapCore.BootstrapMode.charAt(BootstrapCore.BootstrapMode.length - 1); 8955 if(document && document.documentElement) 8956 ASPx.AddClassNameToElement(document.documentElement, bsCssClass); 8957 var BootstrapCssSelectors = {}; 8958 BootstrapCssSelectors.Table = "table"; 8959 BootstrapCssSelectors.TableBordered = "table-bordered"; 8960 BootstrapCssSelectors.TableSmall = BootstrapCore.IsBootstrap3 ? "table-condensed" : "table-sm"; 8961 BootstrapCssSelectors.TableActive = BootstrapCore.IsBootstrap3 ? "" : "table-active";
8962 BootstrapCssSelectors.BackgroundLight = BootstrapCore.IsBootstrap3 ? "" : "bg-light"; 8963 BootstrapCssSelectors.BackgroundPrimary = BootstrapCore.IsBootstrap3 ? "bg-primary" : "bg-primary text-white"; 8964 BootstrapCssSelectors.BackgroundDanger = "bg-danger"; 8965 BootstrapCssSelectors.Hidden = BootstrapCore.IsBootstrap3 ? "hidden" : "d-none"; 8966 BootstrapCssSelectors.Row = "row"; 8967 BootstrapCssSelectors.Column = "col"; 8968 BootstrapCssSelectors.ColumnAuto = BootstrapCore.IsBootstrap3 ? "" : "col-auto"; 8969 BootstrapCssSelectors.Panel = BootstrapCore.IsBootstrap3 ? "panel" : "card"; 8970 BootstrapCssSelectors.PanelDefault = BootstrapCore.IsBootstrap3 ? "panel-default" : ""; 8971 BootstrapCssSelectors.PanelHeading = BootstrapCore.IsBootstrap3 ? "panel-heading" : "card-header"; 8972 BootstrapCssSelectors.PanelTitle = BootstrapCore.IsBootstrap3 ? "panel-title" : "card-title"; 8973 BootstrapCssSelectors.PanelBody = BootstrapCore.IsBootstrap3 ? "panel-body" : "card-body"; 8974 BootstrapCssSelectors.PanelFooter = BootstrapCore.IsBootstrap3 ? "panel-footer" : "card-footer"; 8975 BootstrapCssSelectors.Radio = BootstrapCore.IsBootstrap3 ? "radio" : "form-check"; 8976 BootstrapCssSelectors.CheckBox = BootstrapCore.IsBootstrap3 ? "checkbox" : "form-check"; 8977 BootstrapCssSelectors.InlineCheckBox = BootstrapCore.IsBootstrap3 ? "checkbox-inline" : "form-check form-check-inline"; 8978 BootstrapCssSelectors.CheckBoxLabel = BootstrapCore.IsBootstrap3 ? "" : "form-check-label"; 8979 BootstrapCssSelectors.CheckBoxInput = BootstrapCore.IsBootstrap3 ? "" : "form-check-input"; 8980 BootstrapCssSelectors.CustomCheckBox = BootstrapCore.IsBootstrap3 ? "" : "custom-control custom-checkbox"; 8981 BootstrapCssSelectors.CustomInlineCheckBox = BootstrapCore.IsBootstrap3 ? "" : "custom-control custom-control-inline custom-checkbox"; 8982 BootstrapCssSelectors.CustomRadioButton = BootstrapCore.IsBootstrap3 ? "" : "custom-control custom-radio"; 8983 BootstrapCssSelectors.CustomInlineRadioButton = BootstrapCore.IsBootstrap3 ? "" : "custom-control custom-control-inline custom-radio"; 8984 BootstrapCssSelectors.CustomCheckLabel = BootstrapCore.IsBootstrap3 ? "" : "custom-control-label"; 8985 BootstrapCssSelectors.CustomCheckInput = BootstrapCore.IsBootstrap3 ? "" : "custom-control-input"; 8986 BootstrapCssSelectors.ControlLabel = BootstrapCore.IsBootstrap3 ? "control-label" : "col-form-label"; 8987 BootstrapCssSelectors.FormControlStatic = BootstrapCore.IsBootstrap3 ? "form-control-static" : "form-control-plaintext" ; 8988 BootstrapCssSelectors.HelpBlock = BootstrapCore.IsBootstrap3 ? "help-block" : "form-text"; 8989 BootstrapCssSelectors.HasError = BootstrapCore.IsBootstrap3 ? "has-error" : ""; 8990 BootstrapCssSelectors.FormControlFeedback = BootstrapCore.IsBootstrap3 ? "form-control-feedback" : "dxbs-feedback"; 8991 BootstrapCssSelectors.InvalidFormControl = BootstrapCore.IsBootstrap3 ? "" : "is-invalid"; 8992 BootstrapCssSelectors.InvalidFeedback = BootstrapCore.IsBootstrap3 ? "" : "invalid-feedback"; 8993 BootstrapCssSelectors.InputGroup = "input-group"; 8994 BootstrapCssSelectors.InputGroupAppendButton = BootstrapCore.IsBootstrap3 ? "input-group-btn" : "input-group-append"; 8995 BootstrapCssSelectors.InputGroupPrependButton = BootstrapCore.IsBootstrap3 ? "input-group-btn" : "input-group-prepend"; 8996 BootstrapCssSelectors.Divider = BootstrapCore.IsBootstrap3 ? "divider" : "dropdown-divider"; 8997 BootstrapCssSelectors.NavItem = BootstrapCore.IsBootstrap3 ? "" : "nav-item"; 8998 BootstrapCssSelectors.NavLink = BootstrapCore.IsBootstrap3 ? "" : "nav-link"; 8999 BootstrapCssSelectors.DropDownMenu = "dropdown-menu"; 9000 BootstrapCssSelectors.DropDownMenuItem = BootstrapCore.IsBootstrap3 ? "" : "dropdown-item"; 9001 BootstrapCssSelectors.ListBoxItemLink = BootstrapCore.IsBootstrap3 ? "list-group-item" : "list-group-item list-group-item-action"; 9002 BootstrapCssSelectors.ListGroupItem = selectClass("list-group-item"); 9003 BootstrapCssSelectors.ListGroup = selectClass("list-group"); 9004 BootstrapCssSelectors.Active = selectClass("active"); 9005 BootstrapCssSelectors.Disabled = selectClass("disabled"); 9006 BootstrapCssSelectors.HiddenLayout = "dxbs-hl"; 9007 BootstrapCssSelectors.Breabcrumb = "breadcrumb"; 9008 BootstrapCssSelectors.BreadcrumbItem = BootstrapCore.IsBootstrap3 ? "" : "breadcrumb-item"; 9009 BootstrapCssSelectors.Toolbar = "btn-toolbar"; 9010 BootstrapCssSelectors.Button = "btn"; 9011 BootstrapCssSelectors.ButtonGroup = "btn-group"; 9012 BootstrapCssSelectors.ButtonGroupVertical = "btn-group-vertical"; 9013 BootstrapCssSelectors.DropDown = "dropdown"; 9014 BootstrapCssSelectors.DropDownToggle = "dropdown-toggle"; 9015 BootstrapCssSelectors.Modal = "modal";
9016 BootstrapCssSelectors.ModalContent = "modal-content"; 9017 BootstrapCssSelectors.ModalBody = "modal-body"; 9018 BootstrapCssSelectors.ModalHeader = "modal-header"; 9019 BootstrapCssSelectors.ModalTitle = "modal-title"; 9020 BootstrapCssSelectors.ModalFooter = "modal-footer"; 9021 BootstrapCssSelectors.ModalBackdrop = "modal-backdrop " + (BootstrapCore.IsBootstrap3 ? "in" : "show"); 9022 BootstrapCssSelectors.Label = BootstrapCore.IsBootstrap3 ? "label" : "badge"; 9023 BootstrapCssSelectors.Alert = "alert"; 9024 function selectClass() { 9025 var argsCount = arguments.length; 9026 if (argsCount === 1 || BootstrapCore.IsBootstrap3) 9027 return arguments[0]; 9028 if (argsCount === 2 || BootstrapCore.IsBootstrap4) 9029 return arguments[1]; 9030 return arguments[2]; 9031 } 9032 BootstrapCssSelectors.Popover = selectClass("popover"); 9033 BootstrapCssSelectors.PopoverArrow = selectClass("arrow", "arrow", "popover-arrow"); 9034 BootstrapCssSelectors.PopoverBody = selectClass("popover-content", "popover-body"); 9035 BootstrapCssSelectors.PopoverHeader = selectClass("popover-title", "popover-header"); 9036 BootstrapCssSelectors.PopoverBottom = selectClass("bottom", "bs-popover-bottom"); 9037 BootstrapCssSelectors.PopoverLeft = selectClass("left", "bs-popover-left"); 9038 BootstrapCssSelectors.PopoverRight = selectClass("right", "bs-popover-right"); 9039 BootstrapCssSelectors.PopoverTop = selectClass("top", "bs-popover-top"); 9040 BootstrapCssSelectors.Tooltip = selectClass("tooltip"); 9041 BootstrapCssSelectors.TooltipArrow = selectClass("tooltip-arrow", "arrow", "tooltip-arrow"); 9042 BootstrapCssSelectors.TooltipContent = selectClass("tooltip-inner"); 9043 BootstrapCssSelectors.TooltipBottom = selectClass("bottom", "bs-tooltip-bottom"); 9044 BootstrapCssSelectors.TooltipLeft = selectClass("left", "bs-tooltip-left"); 9045 BootstrapCssSelectors.TooltipRigth = selectClass("right", "bs-tooltip-right"); 9046 BootstrapCssSelectors.TooltipTop = selectClass("top", "bs-tooltip-top"); 9047 BootstrapCssSelectors.Border = selectClass("dxbs-border", "border"); 9048 BootstrapCssSelectors.TableHeadLight = selectClass("", "thead-light", ""); 9049 BootstrapCssSelectors.PanelHeadingTabs = selectClass("panel-heading-tabs", "card-header-tabs"); 9050 BootstrapCssSelectors.Invisible = selectClass("invisible"); 9051 BootstrapCssSelectors.TextCenter = "text-center"; 9052 BootstrapCssSelectors.TextMuted = selectClass("text-muted"); 9053 BootstrapCssSelectors.TextRight = selectClass("text-right", "text-right", "text-end"); 9054 BootstrapCssSelectors.MarginStart = selectClass("", "ml", "ms"); 9055 BootstrapCssSelectors.MarginEnd = selectClass("", "mr", "me"); 9056 BootstrapCssSelectors.Badge = selectClass("badge"); 9057 BootstrapCssSelectors.BadgePill = selectClass("", "badge-pill", "rounded-pill"); 9058 BootstrapCssSelectors.BadgePrimary = selectClass("", "badge-primary", "bg-primary"); 9059 BootstrapCssSelectors.BadgeSecondary = selectClass("", "badge-secondary", "bg-secondary"); 9060 BootstrapCssSelectors.BadgeSuccess = selectClass("", "badge-success", "bg-success"); 9061 BootstrapCssSelectors.BadgeDanger = selectClass("", "badge-danger", "bg-danger"); 9062 BootstrapCssSelectors.BadgeWarning = selectClass("", "badge-warning", "bg-warning"); 9063 BootstrapCssSelectors.BadgeInfo = selectClass("", "badge-info", "bg-info"); 9064 BootstrapCssSelectors.BadgeLight = selectClass("", "badge-light", "bg-light"); 9065 BootstrapCssSelectors.BadgeDark = selectClass("", "badge-dark", "bg-dark"); 9066 BootstrapCssSelectors.TextPrimary = selectClass("text-primary"); 9067 BootstrapCssSelectors.TextSecondary = selectClass("", "text-secondary"); 9068 BootstrapCssSelectors.TextSuccess = selectClass("text-success"); 9069 BootstrapCssSelectors.TextDanger = selectClass("text-danger"); 9070 BootstrapCssSelectors.TextWarning = selectClass("text-warning"); 9071 BootstrapCssSelectors.TextInfo = selectClass("text-info"); 9072 BootstrapCssSelectors.TextLight = selectClass("", "text-light"); 9073 BootstrapCssSelectors.TextDark = selectClass("", "text-dark"); 9074 BootstrapCssSelectors.ButtonPrimary = selectClass("btn-primary"); 9075 BootstrapCssSelectors.ButtonSecondary = selectClass("btn-default", "btn-secondary"); 9076 BootstrapCssSelectors.ButtonSuccess = selectClass("btn-success"); 9077 BootstrapCssSelectors.ButtonDanger = selectClass("btn-danger"); 9078 BootstrapCssSelectors.ButtonWarning = selectClass("btn-warning"); 9079 BootstrapCssSelectors.ButtonInfo = selectClass("btn-info"); 9080 BootstrapCssSelectors.ButtonLight = selectClass("", "btn-light"); 9081 BootstrapCssSelectors.ButtonDark = selectClass("", "btn-dark"); 9082 BootstrapCssSelectors.ButtonLink = selectClass("btn-link"); 9083 BootstrapCssSelectors.ButtonOutlineSecondary = selectClass("", "btn-outline-secondary"); 9084 BootstrapCssSelectors.FormControl = selectClass("form-control"); 9085 BootstrapCssSelectors.FormGroup = selectClass("form-group", "form-group", ""); 9086 BootstrapCssSelectors.Pagination = selectClass("pagination"); 9087 BootstrapCssSelectors.AccordionItem = selectClass("panel", "card", "accordion-item"); 9088 BootstrapCssSelectors.AccordionHeader = selectClass("panel-heading", "card-header", "accordion-header"); 9089 BootstrapCssSelectors.AccordionBody = selectClass("panel-body", "card-body", "accordion-body"); 9090 var mediaQueryScreenSizesCache = {}; 9091 function createCssRuleForScreenSizeMediaQuery(cssVarName, fallbackWidth, cssRule) { 9092 var cache = mediaQueryScreenSizesCache;
9093 var minWidth = cache[cssVarName] || (cache[cssVarName] = (ASPx.GetCurrentStyle(document.body).getPropertyValue(cssVarName) || fallbackWidth)); 9094 if(minWidth) { 9095 var styleSheet = ASPx.GetCurrentStyleSheet(); 9096 if(styleSheet) 9097 styleSheet.insertRule("@media (min-width: " + minWidth + ") {\n" + cssRule + "\n}\n", styleSheet.cssRules.length); 9098 } 9099 } 9100 BootstrapCore.createCssRuleForLargeScreen = function(cssRule) { 9101 createCssRuleForScreenSizeMediaQuery("--breakpoint-lg", "992px", cssRule); 9102 }; 9103 function getTableCellStyleRuleCssText(cellElement, addBorders, addPaddings) { 9104 var cellStyleProperties = []; 9105 if(addBorders) { 9106 cellStyleProperties = cellStyleProperties.concat([ 9107 "border", "border-left", "border-top", "border-right", "border-bottom", 9108 "border-left-width", "border-left-style", "border-left-color", 9109 "border-top-width", "border-top-style", "border-top-color", 9110 "border-right-width", "border-right-style", "border-right-color", 9111 "border-bottom-width", "border-bottom-style", "border-bottom-color" 9112 ]); 9113 } 9114 if(addPaddings) 9115 cellStyleProperties = cellStyleProperties.concat(["padding", "padding-left", "padding-top", "padding-right", "padding-bottom"]); 9116 return getStyleRuleCssText(ASPx.GetCurrentStyle(cellElement), cellStyleProperties); 9117 } 9118 function getStyleRuleCssText(currentStyle, styleProperties) { 9119 var rules = []; 9120 if(currentStyle) { 9121 for(var i = 0; i < styleProperties.length; i++) { 9122 var stylePropertyValue = ASPx.Str.Trim(currentStyle.getPropertyValue(styleProperties[i])) + ""; 9123 if(stylePropertyValue) 9124 rules.push(styleProperties[i] + ": " + stylePropertyValue); 9125 } 9126 } 9127 return rules.join(";"); 9128 } 9129 function updateTableCellStyleSheetRule(tableClassName, styleSheet, cssText, isHeaderCell, forceAdd) { 9130 if(!cssText || !cssText.length) 9131 return; 9132 var selector = "." + tableClassName + " tr > " + (isHeaderCell ? "th" : "td"); 9133 updateStyleSheetRule(styleSheet, selector, cssText, forceAdd); 9134 } 9135 function updateStyleSheetRule(styleSheet, selector, cssText, forceAdd) { 9136 if(!forceAdd) { 9137 var rule = ASPx.GetStyleSheetRules(selector.substring(1)); 9138 if(rule) 9139 rule.style.cssText = cssText; 9140 else 9141 forceAdd = true; 9142 } 9143 if(forceAdd) 9144 ASPx.AddStyleSheetRule(styleSheet, selector, cssText); 9145 } 9146 BootstrapCore.updateTableCellStyleSheetRules = function(forceAdd) { 9147 if(BootstrapCore.IsBootstrap3) { 9148 var styleSheet = ASPx.GetCurrentStyleSheet(); 9149 if(styleSheet) { 9150 var container = createTestElement(); 9151 var tableElement = document.createElement("table"); 9152 var tableBody = document.createElement("tbody"); 9153 tableElement.appendChild(tableBody); 9154 container.appendChild(tableElement); 9155 var row = document.createElement("tr"); 9156 var cell = document.createElement("td"); 9157 row.appendChild(cell); 9158 tableBody.appendChild(row); 9159 var rowWithHeaderCell = document.createElement("tr"); 9160 var headerCell = document.createElement("th"); 9161 rowWithHeaderCell.appendChild(headerCell); 9162 tableBody.appendChild(rowWithHeaderCell); 9163 document.body.appendChild(container); 9164 var tableClassName = BootstrapCssSelectors.Table; 9165 var tableBorderedClassName = BootstrapCssSelectors.TableBordered; 9166 var tableSmallClassName = BootstrapCssSelectors.TableSmall; 9167 tableElement.className = tableClassName; 9168 updateTableCellStyleSheetRule(tableClassName, styleSheet, getTableCellStyleRuleCssText(cell, true, true), true, forceAdd); 9169 updateTableCellStyleSheetRule(tableClassName, styleSheet, getTableCellStyleRuleCssText(headerCell, true, true), false, forceAdd); 9170 cell.className = ASPx.BootstrapCssSelectors.Active; 9171 var tableActiveCssClass = "dxbs-table-active"; 9172 var tableActiveCssText = getStyleRuleCssText(ASPx.GetCurrentStyle(cell), ["background-color"]); 9173 updateStyleSheetRule(styleSheet, "." + tableActiveCssClass, tableActiveCssText, forceAdd); 9174 cell.className = ""; 9175 tableElement.className = tableBorderedClassName; 9176 updateTableCellStyleSheetRule(tableBorderedClassName, styleSheet, getTableCellStyleRuleCssText(cell, true, false), true, forceAdd); 9177 updateTableCellStyleSheetRule(tableBorderedClassName, styleSheet, getTableCellStyleRuleCssText(headerCell, true, false), false, forceAdd); 9178 tableElement.className = tableSmallClassName; 9179 updateTableCellStyleSheetRule(tableSmallClassName, styleSheet, getTableCellStyleRuleCssText(cell, false, true), true, forceAdd); 9180 updateTableCellStyleSheetRule(tableSmallClassName, styleSheet, getTableCellStyleRuleCssText(headerCell, false, true), false, forceAdd); 9181 document.body.removeChild(container); 9182 } 9183 } 9184 }; 9185 var existingColors = {}; 9186 BootstrapCore.createColorItemsRules = function () { 9187 var colorElements = document.querySelectorAll("[data-color]"); 9188 var cssText = ""; 9189 for (var i = 0; i < colorElements.length; i++) { 9190 var colorElement = colorElements[i]; 9191 var colorValue = ASPx.Attr.GetAttribute(colorElement, "data-color"); 9192 if(existingColors[colorValue]) 9193 continue; 9194 existingColors[colorValue] = true; 9195 cssText += "[data-color=\"" + colorValue + "\"],\n[data-item-color=\"" + colorValue + "\"]:before { background-color: " + colorValue + "; }\n"; 9196 } 9197 if (cssText) 9198 BootstrapCore.createStylesBlock(cssText, "colors" + ASPx.CreateGuid()); 9199 }; 9200 BootstrapCore.createColorRule = function(c) { 9201 if(existingColors[c]) 9202 return; 9203 existingColors[c] = true; 9204 ASPx.AddStyleSheetRule(ASPx.GetCurrentStyleSheet(), "[data-color=\"" + c + "\"],\n[data-item-color=\"" + c + "\"]:before", "background-color: " + c + ";"); 9205 }; 9206 BootstrapCore.getActualBgColor = function (el) { 9207 var color = ASPx.GetCurrentStyle(el).backgroundColor; 9208 var c = ASPx.Color.ColorToHexadecimal(color, true); 9209 if(c.a < 1) { 9210 var bgColor = ASPx.GetCurrentStyle(el.parentNode).backgroundColor; 9211 var bg; 9212 while(el.parentNode && el.parentNode.nodeType == 1 && (bg = ASPx.Color.ColorToHexadecimal(bgColor, true)).a === 0) 9213 bgColor = ASPx.GetCurrentStyle(el = el.parentNode).backgroundColor; 9214 c.r = Math.round(((1 - c.a) * bg.r) + (c.a * c.r)); 9215 c.g = Math.round(((1 - c.a) * bg.g) + (c.a * c.g)); 9216 c.b = Math.round(((1 - c.a) * bg.b) + (c.a * c.b)); 9217 } 9218 return "rgb(" + c.r + "," + c.g + "," + c.b + ")"; 9219 }; 9220 var createdStylesBlockKeys = {}; 9221 BootstrapCore.removeStylesBlock = function(key) { 9222 var stylesBlock = document.getElementById(key + "_styles"); 9223 if(stylesBlock) 9224 ASPx.RemoveElement(stylesBlock); 9225 }; 9226 BootstrapCore.createStylesBlock = function(cssText, key, container) { 9227 key = key + "_styles"; 9228 var styleElement = null; 9229 if(key) { 9230 if(createdStylesBlockKeys[key]) { 9231 styleElement = document.getElementById(key); 9232 if(styleElement) 9233 ASPx.RemoveElement(styleElement); 9234 } 9235 createdStylesBlockKeys[key] = true; 9236 } 9237 styleElement = document.createElement("STYLE"); 9238 styleElement.appendChild(document.createTextNode(cssText)); 9239 if(container === undefined) 9240 container = ASPx.GetHeadElementOrCreateIfNotExist(document);
9241 container.appendChild(styleElement); 9242 styleElement.id = key; 9243 }; 9244 BootstrapCore.initializeAccentColorRelatedSelectors = function(forceAddCssRule) { 9245 var linkEl = document.createElement("A"); 9246 linkEl.href = ASPx.AccessibilityEmptyUrl; 9247 linkEl.className = ASPx.BootstrapCssSelectors.HiddenLayout; 9248 ASPx.DOM.ChangeDOM(function () { 9249 document.body.appendChild(linkEl); 9250 ASPx.DOM.CalculateStyles(function () { 9251 var accentColor = ASPx.Color.ColorToHexadecimal(ASPx.GetCurrentStyle(linkEl).color); 9252 ASPx.DOM.ChangeDOM(function() { 9253 updateStyleSheetRule(ASPx.GetCurrentStyleSheet(), ".dx-accent-color", "color: " + accentColor, forceAddCssRule); 9254 ASPx.RemoveElement(linkEl); 9255 }); 9256 }); 9257 }); 9258 }; 9259 function createBootstrapStateItemClass() { 9260 var stateClass = ASPx.CreateClass(ASPx.StateItem, { 9261 Clone: function() { 9262 return new stateClass(this.name, this.classNames, this.cssTexts, this.postfixes, 9263 this.imageObjs, this.imagePostfixes, this.kind, this.disableApplyingStyleToLink); 9264 }, 9265 Apply: function(element) { 9266 this.changeState(element, true); 9267 }, 9268 Cancel: function(element) { 9269 this.changeState(element, false); 9270 }, 9271 changeState: function(element, condition) { 9272 if(!this.enabled) return; 9273 var elements = this.GetElements(element); 9274 for(var i = 0; i < elements.length; i++) { 9275 if(elements[i]) 9276 this.changeClassName(elements[i], this.GetResultClassName(i), condition); 9277 } 9278 }, 9279 changeClassName: function(el, className, condition) { 9280 if (!!className) 9281 ASPx.DOM.ToggleCssClass(el, className, condition); 9282 }, 9283 ForceRedrawAppearance: function() { } 9284 }); 9285 return stateClass; 9286 } 9287 var bootstrapStateItemClass; 9288 BootstrapCore.AddStateItems = function(callback) { 9289 ASPx.GetStateController().withCustomStateItemType(bootstrapStateItemClass || (bootstrapStateItemClass = createBootstrapStateItemClass()), callback); 9290 }; 9291 ASPx.BootstrapCore = BootstrapCore; 9292 ASPx.BootstrapCssSelectors = BootstrapCssSelectors; 9293 ASPx.BuildBSCssClass = function() { 9294 return ASPx.Data.CollectionToArray(arguments) 9295 .map(function (c) { return BootstrapCssSelectors[c] || c; }).join(" "); 9296 }; 9297 ASPx.CreatePatchedClass = function(baseClass, properties, patch) { 9298 var patchedBaseClass = ASPx.CreateClass(baseClass, patch); 9299 return ASPx.CreateClass(patchedBaseClass, properties || {}); 9300 }; 9301 if(BootstrapCore.CheckReferences) 9302 ASPx.attachToReady(detectBootstrapFramework); 9303 function detectBootstrapFramework() { 9304 var testElement = createTestElement(); 9305 testElement.className = "input-group ms-1"; 9306 document.body.appendChild(testElement); 9307 var style = ASPx.GetCurrentStyle(testElement); 9308 var exists = true; 9309 if (BootstrapCore.BootstrapMode === "Bootstrap3") { 9310 exists = style.display.indexOf("table") > -1; 9311 } 9312 else if (BootstrapCore.BootstrapMode === "Bootstrap4") { 9313 exists = style.display.indexOf("flex") > -1 && 9314 style["margin-left"].indexOf("0") > -1; 9315 } 9316 else if (BootstrapCore.BootstrapMode === "Bootstrap5") { 9317 exists = style.display.indexOf("flex") > -1 && 9318 style["margin-left"].indexOf("0") === -1; 9319 } 9320 document.body.removeChild(testElement); 9321 if (!exists) { 9322 var version = parseInt(ASPx.BootstrapCore.BootstrapMode.substr(9)); 9323 console.error("Bootstrap " + version + " required by DevExpress Bootstrap controls is not linked to the page. Add a bootstrap.css link to the page for the controls to work properly."); 9324 } 9325 } 9326 function createTestElement() { 9327 var testElement = document.createElement("div"); 9328 testElement.style.position = "absolute"; 9329 testElement.style.top = ASPx.InvalidPosition + "px"; 9330 testElement.style.left = ASPx.InvalidPosition + "px"; 9331 return testElement; 9332 } 9333 ASPx.attachToLoad(function() { 9334 ASPx.BootstrapCore.updateTableCellStyleSheetRules(true); 9335 ASPx.BootstrapCore.initializeAccentColorRelatedSelectors(true); 9336 }); 9337})(dx || (dx = {})); 9338 9339(function(dx) { 9340 (function (env) { 9341 var baseClass = env.CreateClass({ 9342 constructor: function (args) { 9343 Object.defineProperty(this, '__dx__', { value: args, enumerable: false, configurable: false, writable: false }); 9344 if(!args[1].getInstance) 9345 Object.defineProperty(args[1], 'getInstance', { value: args[2], enumerable: true, configurable: false, writable: false }); 9346 }, 9347 getType: function () { return this.__dx__[1]; }, 9348 clone: function (env) { return create(this.__dx__[0], env, env ? null : this.getType()); } 9349 }); 9350 function create(setupEnv, envObj, type, ret) { 9351 type = type || (type = env.CreateClass(baseClass, setupEnv(envObj || env))); 9352 return ret = new type([setupEnv, type, function () { return ret; }]); 9353 } 9354 env.CreateSingleton = create; 9355 })(ASPx); 9356 var BootstrapEventManager = {}; 9357 var globalContainersStorage = {}; 9358 function getEventAttachFunc(owner, key) { 9359 var cs = globalContainersStorage[owner.name]; 9360 if(!cs || cs.checkSum !== owner.checkSum) 9361 cs = globalContainersStorage[owner.name] = { checkSum: (owner.checkSum = ASPx.CreateGuid()), c: {} }; 9362 return cs.c[key] || (cs.c[key] = createEventHandlerContainer(
9363 owner.getEventContainers || function() { return [document.getElementById(owner.name)]; }, key)); 9364 } 9365 function createEventHandlerContainer(getEventContainers, eventName) { 9366 var elements = getEventContainers(); 9367 var queue = [], i = 0, order = [queue]; 9368 function addToHierarchy(el, handler) { 9369 var foundQueue = queue; 9370 var detachIndex = foundQueue.length; 9371 foundQueue.push({ target: el, handler: handler }); 9372 return function() { foundQueue.splice(detachIndex, 1); }; 9373 } 9374 function handleEvent(e) { 9375 if(e.cancelBubble) return; 9376 var srcEl = ASPx.Evt.GetEventSource(e); 9377 for(var i = 0; !e.cancelBubble && i < order.length; i++) { 9378 var q = order[i]; 9379 if(q && q.length) { 9380 for(var j = 0; !e.cancelBubble && j < q.length; j++) { 9381 if(ASPx.GetIsParent(q[j].target, srcEl)) { 9382 q[j].handler(e); 9383 break; 9384 } 9385 } 9386 } 9387 } 9388 } 9389 for(var i = 0; i < elements.length; i++) { 9390 ASPx.Evt.AttachEventToElement(elements[i], eventName, handleEvent); 9391 } 9392 return addToHierarchy; 9393 } 9394 BootstrapEventManager.attachEventToElement = function(owner, element, eventName, handler) { 9395 var detacherBagRef = element._detacherBagRef || (element._detacherBagRef = {}); 9396 detacherBagRef[eventName] = getEventAttachFunc(owner, eventName)(element, handler); 9397 }; 9398 BootstrapEventManager.detachEventFromElement = function(element, eventName, handler) { 9399 var detacherBagRef = element._detacherBagRef || (element._detacherBagRef = {}); 9400 if(detacherBagRef[eventName]) 9401 detacherBagRef[eventName](); 9402 }; 9403 BootstrapEventManager.EventsHub = ASPx.CreateSingleton(function (ASPx) { 9404 var eventListenersAttachedToDOM = false, eventListenersBuffer = [], handleOnEventBubbling = true, emptyEventListener = { attach: function () { }, detach: function () { } }; 9405 function ensureEventListenersActive() { 9406 if (eventListenersAttachedToDOM === true) 9407 return; 9408 eventListenersBuffer.forEach(function (f) { f(); }); 9409 eventListenersBuffer = null; 9410 eventListenersAttachedToDOM = true; 9411 } 9412 function getEventListener(eventName, targetGetter) { 9413 targetGetter = targetGetter || function () { return document; }; 9414 if (eventName === "mouseover" && ASPx.Browser.MobileUI) 9415 return emptyEventListener; 9416 var listeners = []; 9417 function getDepth(root, el) { return el !== root ? getDepth(root, el.parentNode) + 1 : 0; } 9418 function attachListenersToDOM() { 9419 ASPx.Evt.AttachEventToElement(targetGetter(), eventName, function (evt) { 9420 var evtSrc = ASPx.Evt.GetEventSource(evt); 9421 function invokeHandlerForListener(listener) { listener.handler(listener.el, evt, evtSrc, eventName); } 9422 function createListenerInfo(listener) { 9423 var p = ASPx.GetParentBySelector(evtSrc, listener.targetSelector); 9424 if (!p && !(listener.fallbackSelector && ASPx.ElementMatchesSelector(evtSrc, listener.fallbackSelector))) 9425 return null; 9426 return { isFallback: !p, handler: p ? listener.handler : listener.fallbackHandler, el: p || evtSrc, depth: p ? getDepth(p, evtSrc) : 0 }; 9427 } 9428 function processRelatedListeners(relatedListeners, isFallback) { 9429 relatedListeners.filter(function (rl) { return rl.isFallback === isFallback; }).sort(function (a, b) { return a.depth < b.depth; }).forEach(invokeHandlerForListener); 9430 } 9431 var relatedListeners = listeners.map(createListenerInfo).filter(function (rl) { return !!rl; }); 9432 processRelatedListeners(relatedListeners, false); 9433 processRelatedListeners(relatedListeners, true); 9434 }, handleOnEventBubbling); 9435 } 9436 function attach(eventListenerInfo) { 9437 var targetSelector, handler, fallbackSelector, fallbackHandler; 9438 for (var k in eventListenerInfo) { 9439 if (eventListenerInfo.hasOwnProperty(k)) { 9440 if (k === "*") { 9441 fallbackSelector = k; 9442 fallbackHandler = eventListenerInfo[k]; 9443 } else { 9444 targetSelector = k; 9445 handler = eventListenerInfo[k]; 9446 } 9447 } 9448 } 9449 listeners.push({ targetSelector: targetSelector, handler: handler, fallbackSelector: fallbackSelector, fallbackHandler: fallbackHandler, owner: eventListenerInfo }); 9450 } 9451 function detach(eventListenerInfo) { 9452 listeners = listeners.filter(function (l) { return l.owner !== eventListenerInfo; }); 9453 } 9454 eventListenersBuffer.push(attachListenersToDOM); 9455 return { 9456 attach: attach, 9457 detach: detach 9458 }; 9459 } 9460 return { 9461 getEventListener: getEventListener, 9462 ensureEventListenersActive: ensureEventListenersActive 9463 }; 9464 }); 9465 ASPx.BootstrapEventManager = BootstrapEventManager; 9466 var BootstrapPopupManager = {}; 9467 var visiblePopups; 9468 var popupInfo = function(elements, onHide){ 9469 this.elements = elements; 9470 this.onHide = onHide; 9471 }; 9472 BootstrapPopupManager.registerVisiblePopup = function(elements, onHide){ 9473 if(!visiblePopups) 9474 visiblePopups = []; 9475 if(!ASPx.Ident.IsArray(elements)) 9476 elements = [elements]; 9477 visiblePopups.push(new popupInfo(elements, onHide)); 9478 showPopup(elements); 9479 }; 9480 BootstrapPopupManager.correctPopupPositionForClientWindow = function(elements, hAlign, hOffset, vAlign, vOffset) {
9481 correctPopupForClientWindow(ASPx.Ident.IsArray(elements) ? elements : [elements], hAlign, hOffset, vAlign, vOffset); 9482 }; 9483 BootstrapPopupManager.unregisterVisiblePopup = function(elements){ 9484 if(visiblePopups && visiblePopups.length && elements && elements.length) { 9485 var popupInfo = this.findPopupInfo(elements); 9486 if(popupInfo) { 9487 hidePopup(popupInfo.elements); 9488 ASPx.Data.ArrayRemove(visiblePopups, popupInfo); 9489 if(popupInfo.onHide) 9490 popupInfo.onHide(); 9491 } 9492 } 9493 }; 9494 BootstrapPopupManager.findPopupInfo = function(elements){ 9495 for(var i = 0; i < visiblePopups.length; i++){ 9496 if(ASPx.Data.ArrayEqual(visiblePopups[i].elements, elements)) 9497 return visiblePopups[i]; 9498 } 9499 return null; 9500 }; 9501 BootstrapPopupManager.isPopupVisible = function(elements){ 9502 return visiblePopups && visiblePopups.length && elements && elements.length && this.findPopupInfo(elements); 9503 }; 9504 function showPopup(elements) { 9505 var originElement = getOriginElement(elements); 9506 var popupElement = getPopupElement(elements); 9507 var x = ASPx.GetAbsoluteX(originElement); 9508 var y = ASPx.GetAbsoluteY(originElement) + originElement.offsetHeight; 9509 ASPx.SetAbsoluteX(popupElement, x); 9510 ASPx.SetAbsoluteY(popupElement, y); 9511 ASPx.SetElementDisplay(popupElement, true); 9512 } 9513 function correctPopupForClientWindow(elements, hAlign, hOffset, vAlign, vOffset) { 9514 var originElement = getOriginElement(elements); 9515 var popupElement = getPopupElement(elements); 9516 ASPx.SetAbsoluteX(popupElement, correctPopupPositionToClientScreen(popupElement, originElement, true, hAlign, hOffset)); 9517 ASPx.SetAbsoluteY(popupElement, correctPopupPositionToClientScreen(popupElement, originElement, false, vAlign, vOffset)); 9518 } 9519 function hidePopup(elements){ 9520 var popupElement = getPopupElement(elements); 9521 if(popupElement) 9522 ASPx.SetElementDisplay(popupElement, false); 9523 } 9524 function getPopupElement(elements){ 9525 return elements && elements.length > 0 ? elements[0] : null; 9526 } 9527 function getOriginElement(elements){ 9528 return elements && elements.length > 1 ? elements[1] : null; 9529 } 9530 function correctPopupPositionToClientScreen(popupElement, originElement, isX, align, offset) { 9531 var startPos = ASPx.InvalidPosition; 9532 var startPosInit = isX ? ASPx.GetAbsoluteX(popupElement) : ASPx.GetAbsoluteY(popupElement); 9533 var popupPosition = isX ? ASPx.PopupUtils.GetPopupAbsoluteX(popupElement, originElement, align, offset, startPos, startPosInit, false, true) 9534 : ASPx.PopupUtils.GetPopupAbsoluteY(popupElement, originElement, align, offset, startPos, startPosInit, true, false); 9535 return popupPosition.position; 9536 } 9537 ASPx.Evt.AttachEventToDocument("mousedown", function(evt) { 9538 if(!visiblePopups || !visiblePopups.length) return; 9539 var eventSource = ASPx.Evt.GetEventSource(evt); 9540 if(typeof(ASPx.GetDropDownCollection) != "undefined") { 9541 var dropDownCollection = ASPx.GetDropDownCollection(); 9542 var dropDownControl = dropDownCollection.GetDroppedDropDown(); 9543 if(dropDownControl != null) { 9544 var modalWrapperElement = dropDownControl.GetMainElement().querySelector(".dxbs-ddmodal"); 9545 var isEventFromModalWrapper = ASPx.GetIsParent(modalWrapperElement, eventSource); 9546 var isEventFromDropDownWindow = ASPx.GetIsParent(dropDownControl.GetDropDownWindow(), eventSource); 9547 if(!(isEventFromModalWrapper || isEventFromDropDownWindow)) { 9548 var isEventFromDropDownControl = !dropDownCollection.IsEventNotFromControlSelf(evt, dropDownControl); 9549 if(isEventFromDropDownControl) 9550 return; 9551 } 9552 var isEventOutFromModalDialog = isEventFromModalWrapper && !isEventFromDropDownWindow; 9553 if(isEventOutFromModalDialog) { 9554 dropDownControl.CloseDropDownByDocumentOrWindowEvent(false); 9555 return; 9556 } 9557 if(!dropDownControl.QueryCloseUp.IsEmpty()) 9558 return; 9559 } 9560 } 9561 for(var i = visiblePopups.length - 1; i >= 0; i--) { 9562 var needHidePopup = true; 9563 var popupElements = visiblePopups[i].elements; 9564 for(var j = 0; j < popupElements.length; j++) { 9565 if(ASPx.GetIsParent(popupElements[j], eventSource)) 9566 needHidePopup = false; 9567 } 9568 if(needHidePopup) 9569 BootstrapPopupManager.unregisterVisiblePopup(popupElements); 9570 } 9571 }); 9572 BootstrapPopupManager.PopupZIndex = 500; 9573 BootstrapPopupManager.PopupModalZIndex = 1100; 9574 BootstrapPopupManager.PopupType = "bspopup"; 9575 BootstrapPopupManager.PopupModalType = "modalbspopup"; 9576 ASPx.BootstrapPopupManager = BootstrapPopupManager; 9577 var defaultDecorationStyles = { }; 9578 var BootstrapEditorStyleDecoration = ASPx.CreateClass(ASPx.TextEditorStyleDecoration, { 9579 constructor: function(editor) { 9580 this.constructor.prototype.constructor.call(this, editor);
9581 if(editor.cssClasses && editor.cssClasses.nt) 9582 this.innerStyles["N"] = editor.cssClasses.nt; 9583 }, 9584 InitializeNullTextClassName: function() { 9585 if(this.HasDecoration("N")) 9586 this.nullTextClassName = this.innerStyles["N"]; 9587 }, 9588 IsTimeEditDecorated: function() { 9589 return ASPx.Ident.IsASPxClientTimeEdit && ASPx.Ident.IsASPxClientTimeEdit(this.editor); 9590 }, 9591 HasDecoration: function(key) { 9592 var editor = this.editor; 9593 var validationEnabled = editor.customValidationEnabled; 9594 var hasNullTextDecoration = key == "N" && (!!editor.nullText || this.IsTimeEditDecorated()); 9595 var hasInvalidDecoration = key == "I" && validationEnabled; 9596 var hasFocusedDecoration = editor.needFocusedStyleDecoration && (key == "F" || key == "FI" && validationEnabled); 9597 var hasDecoration = hasNullTextDecoration || hasInvalidDecoration || hasFocusedDecoration; 9598 if(hasDecoration) { 9599 var needUpdateDefaultDecoration = !defaultDecorationStyles[key] || !defaultDecorationStyles[key].isValid; 9600 if(needUpdateDefaultDecoration) 9601 BootstrapEditorStyleDecoration.UpdateDefaultDecorationStyles([key]); 9602 if(!this.innerStyles[key] && defaultDecorationStyles[key]) 9603 this.innerStyles[key] = defaultDecorationStyles[key].className; 9604 } 9605 return hasDecoration; 9606 }, 9607 CanApplyNullTextStyleToElement: function(element) { 9608 var needApplyNullTextClassName = this.editor.focused && this.IsTimeEditDecorated(); 9609 return !needApplyNullTextClassName 9610 ? this.IsInputElement(element) && this.editor.GetInputElement() == element 9611 : false; 9612 }, 9613 CanApplyFocusedStyleToElement: function(element) { 9614 var tabIndex = parseInt(ASPx.Attr.GetAttribute(element, "tabindex")); 9615 return !this.IsInputElement(element) 9616 ? !isNaN(tabIndex) && tabIndex >= 0 || ASPx.ElementContainsCssClass(element, ASPx.BootstrapCssSelectors.FormControl) 9617 : false; 9618 }, 9619 CanApplyInvalidStyleToElement: function(element) { 9620 var editor = this.editor; 9621 var isEditorInputElement = editor.GetInputElement() == element 9622 || editor.GetPasswordNullTextInputElement && editor.GetPasswordNullTextInputElement() == element; 9623 var isFormControlElement = isEditorInputElement || ASPx.ElementContainsCssClass(element, ASPx.BootstrapCssSelectors.FormControl); 9624 var isCheckInputElement = ASPx.ElementContainsCssClass(element, "form-check-input") 9625 || ASPx.ElementContainsCssClass(element, "custom-control-input"); 9626 return (isFormControlElement || isCheckInputElement) != ASPx.BootstrapCore.IsBootstrap3; 9627 }, 9628 ApplyFocusedStyle: function(element, inner) { 9629 var focusedInvalidStyleApplied = !this.editor.GetIsValid() && this.editor.focused && this.editor.customValidationEnabled; 9630 if(!focusedInvalidStyleApplied && this.CanApplyFocusedStyleToElement(element)) 9631 ASPx.TextEditorStyleDecoration.prototype.ApplyFocusedStyle.call(this, element, true); 9632 }, 9633 ApplyFocusedInvalidStyle: function(element) { 9634 if(this.CanApplyFocusedStyleToElement(element) && this.HasDecoration("FI")) 9635 this.ApplyDecoration("FI", element, true, this.editor.focused && !this.editor.GetIsValid()); 9636 }, 9637 ApplyInvalidStyle: function(element, inner) { 9638 if(this.CanApplyInvalidStyleToElement(element)) 9639 ASPx.TextEditorStyleDecoration.prototype.ApplyInvalidStyle.call(this, element, true); 9640 this.ApplyFocusedInvalidStyle(element); 9641 }, 9642 ApplyNullTextStyle: function(element, inner) { 9643 if(this.CanApplyNullTextStyleToElement(element)) 9644 ASPx.TextEditorStyleDecoration.prototype.ApplyNullTextStyle.call(this, element, true); 9645 }, 9646 ApplyNullTextClassName: function(active) { 9647 var nullTextClassName = this.GetNullTextClassName(); 9648 var inputElement = this.editor.GetInputElement(); 9649 if(active) 9650 ASPx.AddClassNameToElement(inputElement, nullTextClassName); 9651 else 9652 ASPx.RemoveClassNameFromElement(inputElement, nullTextClassName); 9653 }, 9654 Update: function() { 9655 if(this.IsUpdateLocked()) 9656 return; 9657 var mainElement = this.editor.GetMainElement(); 9658 for(var i = 0; i < this.postfixList.length; i++) { 9659 var postfix = this.postfixList[i]; 9660 var elements = postfix.length ? mainElement.querySelectorAll(postfix) : [ mainElement ]; 9661 for(var j = 0; j < elements.length; j++) 9662 if(elements[j])
9663 this.ApplyStyles(elements[j], true); 9664 } 9665 }, 9666 IsInputElement: function(element) { 9667 var tagName = element.tagName.toUpperCase(); 9668 return tagName == "TEXTAREA" || tagName == "INPUT" || tagName == "SELECT"; 9669 } 9670 }); 9671 BootstrapEditorStyleDecoration.UpdateDefaultDecorationStyles = function(keys) { 9672 var container = document.createElement("DIV"); 9673 ASPx.Attr.SetAttribute(container, 9674 "style", "overflow:hidden;position:fixed;z-index:10000;top:0;left:0;opacity:0;"); 9675 document.body.appendChild(container); 9676 var inputElement = document.createElement("INPUT"); 9677 inputElement.type = "text"; 9678 ASPx.Attr.SetAttribute(inputElement, 9679 "style", "transition:none!important;-webkit-transition:none!important;-o-transition:none!important;"); 9680 container.appendChild(inputElement); 9681 resetDefaultDecorationStyles(keys); 9682 if(!keys || !keys.length) 9683 keys = ["N", "I", "F", "FI"]; 9684 for(var key, i = 0; key = keys[i]; i++) 9685 updateDefaultStyleDecoration(key, inputElement, container); 9686 document.body.removeChild(container); 9687 }; 9688 function resetDefaultDecorationStyles(keys) { 9689 if(!keys || !keys.length) 9690 keys = ASPx.GetObjectKeys(defaultDecorationStyles); 9691 for(var key, i = 0; key = keys[i]; i++) { 9692 if(defaultDecorationStyles[key]) 9693 defaultDecorationStyles[key].isValid = false; 9694 } 9695 } 9696 function updateDefaultStyleDecoration(key, input, inputContainer) { 9697 var defaultNullTextClassName = "text-muted"; 9698 var defaultInvalidClassName = ASPx.BootstrapCore.IsBootstrap3 ? ASPx.BootstrapCssSelectors.HasError : ASPx.BootstrapCssSelectors.InvalidFormControl; 9699 switch(key) { 9700 case "N": 9701 if(ASPx.BootstrapCore.IsBootstrap3) { 9702 ASPx.SetClassName(input, defaultNullTextClassName); 9703 setDefaultStyleDecoration(key, "", getDecorationStyleRuleCssText(ASPx.GetCurrentStyle(input), ["color", "opacity", "text-shadow"])); 9704 } 9705 else 9706 setDefaultStyleDecoration(key, defaultNullTextClassName); 9707 break; 9708 case "I": 9709 setDefaultStyleDecoration(key, defaultInvalidClassName); 9710 break; 9711 case "F": 9712 case "FI": 9713 if(document.hasFocus()) { 9714 ASPx.SetClassName(input, ASPx.BootstrapCssSelectors.FormControl); 9715 if(key == "FI") 9716 ASPx.AddClassNameToElement(ASPx.BootstrapCore.IsBootstrap3 ? inputContainer : input, defaultInvalidClassName); 9717 setDefaultStyleDecoration(key, "", getEditorFocusedStyleRuleCssText(input)); 9718 } 9719 break; 9720 default: 9721 break; 9722 } 9723 } 9724 function setDefaultStyleDecoration(key, cssClass, cssText) { 9725 if(defaultDecorationStyles[key]) { 9726 if(cssClass) 9727 defaultDecorationStyles[key].className = cssClass; 9728 else { 9729 var rule = ASPx.GetStyleSheetRules(defaultDecorationStyles[key].className); 9730 if(rule) 9731 rule.style.cssText = ASPx.CreateImportantCssText(cssText); 9732 } 9733 defaultDecorationStyles[key].isValid = true; 9734 } 9735 else { 9736 if(!cssClass && cssText) 9737 cssClass = ASPx.Str.Trim(ASPx.CreateImportantStyleRule(ASPx.GetCurrentStyleSheet(), cssText)); 9738 defaultDecorationStyles[key] = createDefaultStyleDecoration(cssClass); 9739 } 9740 } 9741 function createDefaultStyleDecoration(cssClass) { 9742 return { className: cssClass, isValid: true }; 9743 } 9744 function getEditorFocusedStyleRuleCssText(inputElement) { 9745 var focusedElement = ASPx.GetFocusedElement(); 9746 inputElement.focus(); 9747 var focusedStyle = ASPx.GetCurrentStyle(inputElement); 9748 var cssText = getDecorationStyleRuleCssText(focusedStyle, [ 9749 "border-top-width", "border-top-style", "border-top-color", 9750 "border-left-width", "border-left-style", "border-left-color", 9751 "border-bottom-width", "border-bottom-style", "border-bottom-color", 9752 "border-right-width", "border-right-style", "border-right-color", 9753 "outline-width", "outline-style", "outline-color", "outline-offset", 9754 "box-shadow", "-webkit-box-shadow" 9755 ]); 9756 inputElement.blur(); 9757 if(focusedElement) 9758 ASPx.SetFocus(focusedElement); 9759 return cssText; 9760 } 9761 function getDecorationStyleRuleCssText(currentStyle, styleProperties) { 9762 var rules = [ ]; 9763 for(var i = 0; i < styleProperties.length; i++) { 9764 var stylePropertyValue = ASPx.Str.Trim(currentStyle.getPropertyValue(styleProperties[i])
9764) + ""; 9765 if(stylePropertyValue) 9766 rules.push(styleProperties[i] + ": " + stylePropertyValue); 9767 } 9768 return rules.join(";"); 9769 } 9770 ASPx.BootstrapEditorStyleDecoration = BootstrapEditorStyleDecoration; 9771 var styleUpdateListeners = []; 9772 BootstrapClientUtils = {}; 9773 BootstrapClientUtils.UpdateDefaultStyles = function() { 9774 ASPx.BootstrapEditorStyleDecoration.UpdateDefaultDecorationStyles(); 9775 ASPx.BootstrapCore.updateTableCellStyleSheetRules(); 9776 ASPx.BootstrapCore.initializeAccentColorRelatedSelectors(); 9777 for(var i = 0; i < styleUpdateListeners.length; i++) 9778 styleUpdateListeners[i].beginStyleUpdate(); 9779 for(var i = 0; i < styleUpdateListeners.length; i++) 9780 styleUpdateListeners[i].updateStyle(); 9781 for(var i = 0; i < styleUpdateListeners.length; i++) 9782 styleUpdateListeners[i].endStyleUpdate(); 9783 }; 9784 BootstrapClientUtils.attachToUpdateDefaultStylesRequest = function(styleUpdateListener) { 9785 styleUpdateListeners.push(styleUpdateListener); 9786 }; 9787 BootstrapClientUtils.detachUpdateDefaultStylesRequestListener = function(styleUpdateListener) { 9788 ASPx.Data.ArrayRemove(styleUpdateListeners, styleUpdateListener); 9789 }; 9790 BootstrapClientUtils.GetChangeButtonEnabledAttributesMethod = function(enabled) { 9791 return enabled 9792 ? function(element, className) { 9793 if(element.tagName == "BUTTON") 9794 ASPx.Attr.RemoveAttribute(element, "disabled"); 9795 else 9796 ASPx.RemoveClassNameFromElement(element, className); 9797 } 9798 : function(element, className) { 9799 if(element.tagName == "BUTTON") 9800 ASPx.Attr.SetAttribute(element, "disabled", "disabled"); 9801 else 9802 ASPx.AddClassNameToElement(element, className); 9803 }; 9804 }; 9805 var BootstrapEditFeedbackRenderHelper = ASPx.CreateClass(null, { 9806 constructor: function(editor) { 9807 this.editor = editor; 9808 }, 9809 getErrorImage: function() { 9810 var editorElement = this.editor.GetMainElement(); 9811 return editorElement && editorElement.querySelector("[data-error-image]"); 9812 }, 9813 getClearButton: function() { 9814 var editorElement = this.editor.GetMainElement(); 9815 return editorElement && editorElement.querySelector(BootstrapEditFeedbackRenderHelper.FeedbackSelector + " > .dxbs-clear-btn"); 9816 }, 9817 getErrorTextElement: function() { 9818 var editorElement = this.editor.GetMainElement(); 9819 return editorElement && editorElement.querySelector(".dxbs-edit-error-text"); 9820 }, 9821 setElementVisible: function(element, value) { 9822 if(element && ASPx.ElementHasCssClass(element, ASPx.BootstrapCssSelectors.Hidden) == value) { 9823 var action = value ? ASPx.RemoveClassNameFromElement : ASPx.AddClassNameToElement; 9824 action(element, ASPx.BootstrapCssSelectors.Hidden); 9825 this.updateInputRightPadding(); 9826 } 9827 }, 9828 setClearButtonVisible: function(value) { 9829 var clearButton = this.getClearButton(); 9830 if(!clearButton) 9831 return; 9832 if(this.editor.clearButtonDisplayMode === 'Always' && ASPx.Attr.GetAttribute(clearButton, "role") == "button") 9833 this.editor.SetAccessibilityAnchorEnabled(clearButton, value); 9834 this.setElementVisible(clearButton, value); 9835 }, 9836 setErrorControlVisible: function(value) { 9837 var errorTextElement = this.getErrorTextElement(); 9838 if(errorTextElement) 9839 this.setElementVisible(errorTextElement, value); 9840 if(this.editor.errorDisplayMode == "i") 9841 this.setErrorImageVisible(value); 9842 }, 9843 setErrorImageVisible: function(value) { 9844 var errorImage = this.getErrorImage(); 9845 if(errorImage) { 9846 if(!this.getErrorTextElement() && !ASPx.BootstrapCore.IsBootstrap3) { 9847 var feedbackControl = this.editor.GetMainElement().querySelector(BootstrapEditFeedbackRenderHelper.FeedbackSelector); 9848 var action = value ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement; 9849 action(feedbackControl || errorImage, ASPx.BootstrapCssSelectors.InvalidFeedback); 9850 } 9851 this.setElementVisible(errorImage, value); 9852 if(!value) { 9853 ASPx.Attr.RemoveAttribute(errorImage, "title"); 9854 ASPx.Attr.RemoveAttribute(errorImage, "data-error-tooltip"); 9855 } 9856 else 9857 this.updateErrorText(); 9858 } 9859 }, 9860 updateErrorText: function() { 9861 var errorText = this.editor.HtmlEncode(this.editor.errorText); 9862 var errorTextElement = this.getErrorTextElement(); 9863 if(errorTextElement) { 9864 var textNode = ASPx.GetNormalizedTextNode(errorTextElement); 9865 if(textNode) { 9866 textNode.nodeValue = errorText; 9867 return; 9868 } 9869 } 9870 var errorImage = this.getErrorImage(); 9871 if(errorImage) { 9872 ASPx.Attr.SetAttribute(errorImage, "title", errorText); 9873 if(ASPx.Browser.TouchUI) { 9874 var x = ASPx.GetAbsolutePositionX(errorImage); 9875 var docWidth = ASPx.Browser.WebKitTouchUI ? window.innerWidth : ASPx.GetDocumentClientWidth(); 9876 var availableWidth = this.editor.isASPxClientCheckEdit ? docWidth - x - errorImage.offsetWidth : x; 9877 if(availableWidth > 0) { 9878 var fontSize = ASPx.GetCurrentStyle(errorImage).fontSize; 9879 ASPx.Attr.SetAttribute(errorImage, "data-error-tooltip", this.formatErrorText(errorText, availableWidth, fontSize)); 9880 } 9881 } 9882 } 9883 }, 9884 formatErrorText: function(errorText, availableWidth, fontSize) { 9885 var errorTextSize = ASPx.GetSizeOfText(errorText, { 9886 fontFamily: '"Helvetica Neue", Helvetica, Arial, sans-serif', 9887 fontSize: 'calc(0.75 * ' + fontSize + ')', 9888 fontWeight: "normal", 9889 letterSpacing: "normal", 9890 lineHeight: "2" 9891 }).width + 1.2 * ASPx.PxToInt(fontSize); 9892 if(errorTextSize > availableWidth) { 9893 var availableCharCount = Math.floor(errorText.length * availableWidth / errorTextSize); 9894 if(availableCharCount) { 9895 var errorTextRows = []; 9896 while(errorText && errorText.length) { 9897 var textRow = errorText.substr(0, availableCharCount); 9898 var spacesAtStart = /(^\s+)\S/.exec(textRow); 9899 if(spacesAtStart) 9900 textRow = errorText.substr(0, availableCharCount + spacesAtStart[1].length); 9901 var spacesAtEnd = /(\s+)\S{1,4}$/.exec(textRow);
9902 if(spacesAtEnd && spacesAtEnd.index) 9903 textRow = errorText.slice(0, spacesAtEnd.index + spacesAtEnd[1].length); 9904 errorTextRows.push(ASPx.Str.TrimStart(textRow)); 9905 errorText = errorText.replace(textRow, ""); 9906 } 9907 errorText = errorTextRows.join("\n"); 9908 } 9909 } 9910 return errorText; 9911 }, 9912 updateInputRightPadding: function() { 9913 if(this.editor.isASPxClientTextEdit) { 9914 var feedbackControl = this.editor.GetMainElement().querySelector(BootstrapEditFeedbackRenderHelper.FeedbackSelector); 9915 if(feedbackControl) { 9916 var feedbackWidth = feedbackControl.offsetWidth; 9917 var formControl = this.editor.GetFormControlElement ? this.editor.GetFormControlElement() : this.editor.GetInputElement(); 9918 formControl.style["padding-right"] = feedbackWidth ? feedbackWidth + "px" : ""; 9919 if(this.editor.UpdateDropDownOnFeedbackChanged) 9920 this.editor.UpdateDropDownOnFeedbackChanged(); 9921 } 9922 } 9923 } 9924 }); 9925 BootstrapEditFeedbackRenderHelper.FeedbackSelector = "." + ASPx.BootstrapCssSelectors.FormControlFeedback; 9926 ASPx.BootstrapEditFeedbackRenderHelper = BootstrapEditFeedbackRenderHelper; 9927 var BootstrapTextEditHelpText = ASPx.CreateClass(null, { 9928 constructor: function(editor, helpText, animationEnabled, isPopupDisplayMode) { 9929 this.editor = editor; 9930 this.isPopupDisplayMode = isPopupDisplayMode; 9931 this.animationEnabled = animationEnabled; 9932 this.createHelpTextElement(helpText); 9933 }, 9934 createHelpTextElement: function(helpText) { 9935 var helpTextElement = document.createElement("SPAN"); 9936 ASPx.SetClassName(helpTextElement, ASPx.BootstrapCssSelectors.HelpBlock); 9937 ASPx.Security.setInnerHtml(helpTextElement, helpText, ASPx.Security.DataType.Trusted); 9938 ASPx.InsertElementAfter(helpTextElement, this.editor.GetHelpTextElementPrevSibling()); 9939 if(this.isPopupDisplayMode) { 9940 var parentNode = helpTextElement.parentNode; 9941 if(parentNode) { 9942 var parentStyle = ASPx.GetCurrentStyle(parentNode); 9943 if(parentStyle.position != "relative") 9944 parentNode.style.position = "relative"; 9945 } 9946 ASPx.AddClassNameToElement(helpTextElement, "dxbs-popup-help-text mark"); 9947 ASPx.SetElementDisplay(helpTextElement, false); 9948 } 9949 else { 9950 ASPx.SetElementDisplay(helpTextElement, this.editor.clientVisible); 9951 if(!ASPx.BootstrapCore.IsBootstrap3) 9952 ASPx.AddClassNameToElement(helpTextElement, "text-muted"); 9953 } 9954 this.helpTextElement = helpTextElement; 9955 }, 9956 show: function() { 9957 if(this.isPopupDisplayMode) 9958 this.showPopup(); 9959 else 9960 ASPx.SetElementDisplay(this.helpTextElement, true); 9961 }, 9962 hide: function() { 9963 if(this.isPopupDisplayMode) 9964 this.hidePopup(); 9965 else 9966 ASPx.SetElementDisplay(this.helpTextElement, false); 9967 }, 9968 showPopup: function() { 9969 ASPx.SetElementDisplay(this.helpTextElement, true); 9970 if(this.animationEnabled) 9971 ASPx.AnimationHelper.fadeIn(this.helpTextElement); 9972 else 9973 ASPx.AnimationHelper.setOpacity(this.helpTextElement, 1); 9974 }, 9975 hidePopup: function() { 9976 var onHidePopupComplete = function() { 9977 ASPx.SetElementDisplay(this.helpTextElement, false); 9978 }.aspxBind(this); 9979 if(this.animationEnabled) 9980 ASPx.AnimationHelper.fadeOut(this.helpTextElement, onHidePopupComplete); 9981 else { 9982 ASPx.AnimationHelper.setOpacity(this.helpTextElement, 0); 9983 onHidePopupComplete(); 9984 } 9985 } 9986 }); 9987 ASPx.BootstrapTextEditHelpText = BootstrapTextEditHelpText; 9988 var BootstrapCheckBoxInternal = ASPx.CreateClass(null, { 9989 constructor: function(mainElement, allowGrayed, allowGrayedByClick, storeValueInInput, inputName) { 9990 this.mainElement = mainElement; 9991 this.allowGrayed = allowGrayed; 9992 this.allowGrayedByClick = allowGrayedByClick; 9993 this.storeValueInInput = storeValueInInput; 9994 if(this.storeValueInInput) 9995 this.stateInput = this.createStateInput(inputName); 9996 this.mainInput = this.findMainInput(); 9997 this.initializeSiblingLabelElement(); 9998 this.initializeIndeterminateState(); 9999 this.CheckedChanged = new ASPxClientEvent(); 10000 this.Focus = new ASPxClientEvent(); 10001 this.LostFocus = new ASPxClientEvent(); 10002 this.attachHtmlEvents(); 10003 this.updateState(); 10004 }, 10005 SetValue: function(value) { 10006 this.setValueCore(value); 10007 }, 10008 GetValue: function() { 10009 return this.getValueCore(); 10010 }, 10011 GetChecked: function() { 10012 return this.getValueCore() === true; 10013 }, 10014 SetChecked: function(checked) { 10015 this.setValueCore(!!checked); 10016 }, 10017 SetEnabled: function(enabled) {
10018 this.setEnabledCore(enabled); 10019 }, 10020 GetEnabled: function() { 10021 return this.getEnabledCore(); 10022 }, 10023 GetReadOnly: function() { 10024 return false; 10025 }, 10026 attachHtmlEvents: function() { 10027 var isMSBrowser = ASPx.Browser.Edge; 10028 ASPx.Evt.AttachEventToElement(this.mainInput, "change", function(evt) { 10029 if(this.allowGrayed && this.allowGrayedByClick && isMSBrowser) { 10030 ASPx.Evt.PreventEvent(evt); 10031 return false; 10032 } 10033 if(!this.correctNextValue()) 10034 this.updateState(); 10035 this.CheckedChanged.FireEvent(this, evt); 10036 }.bind(this)); 10037 ASPx.Evt.AttachEventToElement(this.mainInput, "focus", function(evt) { 10038 this.Focus.FireEvent(this, null); 10039 }.bind(this)); 10040 ASPx.Evt.AttachEventToElement(this.mainInput, "blur", function(evt) { 10041 this.LostFocus.FireEvent(this, null); 10042 }.bind(this)); 10043 ASPx.Evt.AttachEventToElement(this.mainInput, "click", function(evt) { 10044 if (this.GetReadOnly()) { 10045 ASPx.Evt.PreventEvent(evt); 10046 return false; 10047 } 10048 if(this.allowGrayed && isMSBrowser) { 10049 var raiseCheckedChanged = false; 10050 if(this.allowGrayedByClick && this.lastValue) { 10051 this.setValueCore(false); 10052 raiseCheckedChanged = true; 10053 } 10054 else if(this.correctNextValue()) { 10055 this.updateState(); 10056 raiseCheckedChanged = true; 10057 } 10058 if(raiseCheckedChanged) 10059 this.CheckedChanged.FireEvent(this, evt); 10060 } 10061 }.bind(this)); 10062 }, 10063 invokeClick: function() { 10064 if(this.mainInput){ 10065 this.mainInput.focus(); 10066 this.mainInput.click(); 10067 } 10068 }, 10069 correctNextValue: function() { 10070 if(!this.allowGrayed) 10071 return; 10072 if(this.allowGrayedByClick && this.lastValue === false){ 10073 this.setValueCore(null); 10074 return true; 10075 } 10076 if(this.lastValue === null) { 10077 this.setValueCore(true); 10078 return true; 10079 } 10080 }, 10081 findMainInput: function() { 10082 return this.mainElement.querySelectorAll("[type=checkbox]")[0] || this.mainElement.querySelectorAll("[type=radio]")[0]; 10083 }, 10084 createStateInput: function (inputName) { 10085 var input = ASPx.CreateHiddenField(inputName, this.mainElement.id + "_S"); 10086 this.mainElement.appendChild(input); 10087 return input; 10088 }, 10089 initializeIndeterminateState: function() { 10090 if(ASPx.Attr.GetAttribute(this.mainInput, "data-value") === "indeterminate") { 10091 ASPx.Attr.RemoveAttribute(this.mainInput, "data-value"); 10092 this.mainInput.indeterminate = true; 10093 } 10094 }, 10095 initializeSiblingLabelElement: function() { 10096 if(this.mainInput && this.mainInput.id) { 10097 var siblingLabel = this.mainElement.querySelectorAll("[type=checkbox]+label, label+[type=checkbox], [type=radio]+label, label+[type=radio]")[0]; 10098 if(siblingLabel) 10099 ASPx.Attr.SetAttribute(siblingLabel, "for", this.mainInput.id); 10100 } 10101 }, 10102 setValueCore: function(value) { 10103 if(value === true || value === ASPx.CheckBoxInputKey.Checked) { 10104 this.mainInput.checked = true; 10105 this.mainInput.indeterminate = false; 10106 this.updateState(true); 10107 } 10108 else if(value === false || value === ASPx.CheckBoxInputKey.Unchecked) { 10109 this.mainInput.checked = false; 10110 this.mainInput.indeterminate = false; 10111 this.updateState(false); 10112 } 10113 else if(value === null || value === ASPx.CheckBoxInputKey.Indeterminate) { 10114 this.mainInput.indeterminate = true; 10115 this.updateState(null); 10116 } 10117 }, 10118 getValueCore: function() { 10119 var mainInput = this.mainInput; 10120 if(mainInput.indeterminate) 10121 return null; 10122 return mainInput.checked; 10123 }, 10124 setEnabledCore: function(enabled) { 10125 if(enabled) { 10126 ASPx.RemoveClassNameFromElement(this.mainElement, ASPx.BootstrapCssSelectors.Disabled); 10127 ASPx.Attr.RemoveAttribute(this.mainInput, "disabled"); 10128 if(this.stateInput) 10129 ASPx.Attr.RemoveAttribute(this.stateInput, "disabled"); 10130 } 10131 else { 10132 ASPx.AddClassNameToElement(this.mainElement, ASPx.BootstrapCssSelectors.Disabled); 10133 ASPx.Attr.SetAttribute(this.mainInput, "disabled", "disabled"); 10134 if(this.stateInput) 10135 ASPx.Attr.SetAttribute(this.stateInput, "disabled", "disabled"); 10136 } 10137 }, 10138 getEnabledCore: function() { 10139 return !ASPx.Attr.GetAttribute(this.mainInput, "disabled"); 10140 }, 10141 updateState: function(value) { 10142 value = value === undefined ? this.getValueCore() : value; 10143 this.lastValue = value; 10144 var stateInput = this.stateInput; 10145 if(stateInput) { 10146 if(value === true) 10147 stateInput.value = ASPx.CheckBoxInputKey.Checked; 10148 else if(value === false) 10149 stateInput.value = ASPx.CheckBoxInputKey.Unchecked; 10150 else 10151 stateInput.value = ASPx.CheckBoxInputKey.Indeterminate; 10152 } 10153 } 10154 }); 10155 var BootstrapCheckBoxInternalCollection = ASPx.CreateClass(ASPx.CollectionBase, {
10156 constructor: function(allowGrayed, allowGrayedByClick, storeValueInInput) { 10157 this.constructor.prototype.constructor.call(this); 10158 this.allowGrayed = !!allowGrayed; 10159 this.allowGrayedByClick = !!allowGrayedByClick; 10160 this.storeValueInInput = !!storeValueInInput; 10161 }, 10162 Add: function(key, mainElement) { 10163 this.Remove(key); 10164 var checkBox = this.createInternalCheckBox(key, mainElement); 10165 ASPx.CollectionBase.prototype.Add.call(this, key, checkBox); 10166 return checkBox; 10167 }, 10168 createInternalCheckBox: function(key, mainElement) { 10169 return new BootstrapCheckBoxInternal(mainElement, this.allowGrayed, this.allowGrayedByClick, this.storeValueInInput); 10170 } 10171 }); 10172 ASPx.BootstrapCheckBoxInternal = BootstrapCheckBoxInternal; 10173 ASPx.BootstrapCheckBoxInternalCollection = BootstrapCheckBoxInternalCollection; 10174 var BootstrapLoadingPanelManager = {}; 10175 var loadingPanels = {}; 10176 var loadingDivs = {}; 10177 BootstrapLoadingPanelManager.getLoadingPanel = function(name, settings, inline) { 10178 if(!settings) return null; 10179 var lpID = name + "_LP"; 10180 if(!loadingPanels[lpID]){ 10181 var lp = document.createElement("DIV"); 10182 lp.id = lpID; 10183 ASPx.SetClassName(lp, ASPx.Str.Trim([ 10184 "dxbs-lp" + (inline ? " dxbs-lp-inline" : ""), 10185 ASPx.HiddenChangable, ASPx.BootstrapCssSelectors.Panel, ASPx.BootstrapCssSelectors.PanelDefault 10186 ].join(" "))); 10187 var lpBody = document.createElement("DIV"); 10188 ASPx.SetClassName(lpBody, ASPx.BootstrapCssSelectors.PanelBody); 10189 if(settings.showImage !== false) { 10190 var lpImg = document.createElement("SPAN"); 10191 var imgCssClass = settings.imageCssClass ? settings.imageCssClass : "dxbs-icon dxbs-icon-refresh"; 10192 ASPx.SetClassName(lpImg, "image " + imgCssClass); 10193 lpBody.appendChild(lpImg); 10194 } 10195 if(settings.text !== "") { 10196 var breakHtml = ""; 10197 var textHtml = "<span>" + (settings.text || "Loading…") + "</span>"; 10198 if(settings.imagePosition && (settings.imagePosition === "Top" || settings.imagePosition === "Bottom")) 10199 breakHtml = "<br />"; 10200 if(settings.imagePosition && (settings.imagePosition === "Right" || settings.imagePosition === "Bottom")) 10201 ASPx.Security.setInnerHtml(lpBody, textHtml + breakHtml + lpBody.innerHTML, ASPx.Security.DataType.Trusted); 10202 else 10203 ASPx.Security.setInnerHtml(lpBody, lpBody.innerHTML + breakHtml + textHtml, ASPx.Security.DataType.Trusted); 10204 } 10205 lp.appendChild(lpBody); 10206 loadingPanels[lpID] = lp; 10207 } 10208 return loadingPanels[lpID]; 10209 }; 10210 BootstrapLoadingPanelManager.getLoadingDiv = function(name, settings){ 10211 if(!settings || settings.fade === false) return null; 10212 var ldID = name + "_LD"; 10213 if(!loadingDivs[ldID]){ 10214 var ld = document.createElement("DIV"); 10215 ld.id = ldID; 10216 ASPx.SetClassName(ld, "dxbs-ld " + ASPx.HiddenChangable); 10217 loadingDivs[ldID] = ld; 10218 } 10219 return loadingDivs[ldID]; 10220 }; 10221 ASPx.BootstrapLoadingPanelManager = BootstrapLoadingPanelManager; 10222 var BootstrapOverlayManager = {}; 10223 BootstrapOverlayManager.createOverlay = function(name, settings) { 10224 var overlay = document.createElement("DIV"); 10225 overlay.id = name + "_OV"; 10226 ASPx.SetClassName(overlay, ASPx.BootstrapCssSelectors.ModalBackdrop + " dxbs-modal-back" + (settings.cssClass ? " " + settings.cssClass : "")); 10227 return overlay; 10228 }; 10229 ASPx.BootstrapOverlayManager = BootstrapOverlayManager; 10230 var BootstrapBadgeManager = ASPx.CreateClass(ASPx.BadgeManagerBase, { 10231 getBadgeClassName: function() { 10232 return ASPx.BootstrapCssSelectors.Badge; 10233 }, 10234 getBadgeIconDefaultClassName: function() { 10235 return "image"; 10236 }, 10237 createBadgeForButton: function(button, toLeftSide) { 10238 var badge = this.createBadge(); 10239 if(!ASPx.BootstrapCore.IsBootstrap3) { 10240 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgePill); 10241 if (ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonDanger)) { 10242 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgeLight); 10243 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.TextDanger); 10244 } 10245 else if(ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonSecondary) || ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonOutlineSecondary)) 10246 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgeDark); 10247 else if(ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonLink)) 10248 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgePrimary); 10249 else 10250 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.TextPrimary); 10251 } 10252 if(toLeftSide) 10253 button.insertBefore(badge, button.childNodes[0]); 10254 else 10255 button.appendChild(badge); 10256 return badge; 10257 }, 10258 updateToolbarItemBadge: function(item, count) { 10259 var button = item.menu.IsEnabledAdaptivity() ? item.itemViewModel.getElement() : item.menu.GetItemContentElement(item.indexPath); 10260 var badge = this.findBadge(button); 10261 if(!badge) 10262 badge = this.createBadgeForButton(button); 10263 if(badge) 10264 this.setBadgeText(badge, count > 0 ? count : ""); 10265 } 10266 }); 10267 ASPx.BootstrapBadgeManager = new BootstrapBadgeManager(); 10268 var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
10268+/="; 10269 var getBase64Char = function(index) { 10270 return BASE64_CHARS.charAt(index); 10271 }; 10272 var getIndexOfBase64Char = function(char) { 10273 return BASE64_CHARS.indexOf(char); 10274 }; 10275 var codeArrayToString = function(codes) { 10276 return codes.map(function(code) { return String.fromCharCode(code); }).join(""); 10277 }; 10278 var base64_encode = function(input) { 10279 var result = ""; 10280 if (!$.isArray(input)) 10281 input = stringToByteArray(String(input)); 10282 for (var i = 0; i < input.length; i += 3) { 10283 var octet1 = input[i], 10284 octet2 = input[i + 1], 10285 octet3 = input[i + 2]; 10286 result += $.map([octet1 >> 2, (3 & octet1) << 4 | octet2 >> 4, isNaN(octet2) ? 64 : (15 & octet2) << 2 | octet3 >> 6, isNaN(octet3) ? 64 : 63 & octet3], getBase64Char).join(""); 10287 } 10288 return result; 10289 }; 10290 var base64_decode = function(input) { 10291 var result = ""; 10292 input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); 10293 for (var i = 0; i < input.length; i += 4) { 10294 var bytes = []; 10295 var octet1 = getIndexOfBase64Char(input.charAt(i)), 10296 octet2 = getIndexOfBase64Char(input.charAt(i + 1)), 10297 octet3 = getIndexOfBase64Char(input.charAt(i + 2)), 10298 octet4 = getIndexOfBase64Char(input.charAt(i + 3)); 10299 bytes.push((octet1 << 2) | (octet2 >> 4)); 10300 if(octet3 != 64) 10301 bytes.push(((octet2 & 15) << 4) | (octet3 >> 2)); 10302 if(octet4 != 64) 10303 bytes.push(((octet3 & 3) << 6) | octet4); 10304 result += codeArrayToString(bytes); 10305 } 10306 return decodeText(result); 10307 }; 10308 var stringToByteArray = function(str) { 10309 var bytes = []; 10310 var code = 0; 10311 for (var i = 0; i < str.length; i++) { 10312 code = str.charCodeAt(i); 10313 if (code < 128) { 10314 bytes.push(code); 10315 } else { 10316 if (code < 2048) { 10317 bytes.push(192 + (code >> 6), 128 + (63 & code)); 10318 } else { 10319 if (code < 65536) { 10320 bytes.push(224 + (code >> 12), 128 + (code >> 6 & 63), 128 + (63 & code)); 10321 } else { 10322 if (code < 2097152) { 10323 bytes.push(240 + (code >> 18), 128 + (code >> 12 & 63), 128 + (code >> 6 & 63), 128 + (63 & code)); 10324 } 10325 } 10326 } 10327 } 10328 } 10329 return bytes; 10330 }; 10331 var decodeText = function(codeText) { 10332 var bytes = []; 10333 var code = 0, 10334 code2 = 0, 10335 code3 = 0; 10336 for (var i = 0; i < codeText.length; i++) { 10337 code = codeText.charCodeAt(i); 10338 if (code < 128) { 10339 bytes.push(code); 10340 } else { 10341 i += 1; 10342 code2 = codeText.charCodeAt(i); 10343 if((code > 191) && (code < 224)) { 10344 bytes.push(((code & 31) << 6) | (code2 & 63)); 10345 } else { 10346 i += 1; 10347 code3 = codeText.charCodeAt(i); 10348 bytes.push(((code & 15) << 12) | ((code2 & 63) << 6) | (code3 & 63));
10349 } 10350 } 10351 } 10352 return codeArrayToString(bytes); 10353 }; 10354 ASPx.Base64 = {}; 10355 ASPx.Base64.Encode = base64_encode; 10356 ASPx.Base64.Decode = base64_decode; 10357 dx.BootstrapClientUtils = BootstrapClientUtils; 10358 ASPx.BootstrapDockManager = ASPx.CreateSingleton(function(ASPx) { 10359 var showCssClass = "show", 10360 matrixRegex = "\\s*matrix\\(\\s*" + ([0, 0, 0, 0, 0, 0].map(function() { return "(\\-?\\d+\\.?\\d*)"; }).join(",\\s*")) + "\\)\\s*"; 10361 function parseTranslateInfo(styles) { 10362 var m = new RegExp(matrixRegex).exec(styles.transform); 10363 return m ? { left: parseInt(m[5]), top: parseInt(m[6]) } : { left: 0, top: 0 }; 10364 } 10365 function getBoundingBox(x, y, w, h) { return { left: x, top: y, right: x + w, bottom: y + h, width: w, height: h }; } 10366 function getSafeBoundingBox(element, roundLT, roundRB) { 10367 var box = element.getBoundingClientRect(); 10368 var safeBox = { left: roundLT(box.left), top: roundLT(box.top), right: roundRB(box.right), bottom: roundRB(box.bottom) }; 10369 safeBox.width = safeBox.right - safeBox.left; 10370 safeBox.height = safeBox.bottom - safeBox.top; 10371 return safeBox; 10372 } 10373 function getOuterBoundingBox(element) { 10374 return getSafeBoundingBox(element, Math.floor, Math.ceil); 10375 } 10376 function getInnerBoundingBox(element) { 10377 return getSafeBoundingBox(element, Math.ceil, Math.floor); 10378 } 10379 var DockPoint = ASPx.CreateClass(null, { 10380 constructor: function (key, info) { 10381 this.key = key; 10382 this.info = info; 10383 }, 10384 checkMargin: function () { return true; }, 10385 allowScroll: function () { return this.info.size === "height"; }, 10386 canApplyToElement: function(element) { return ASPx.GetClassName(element).indexOf("dxbs-align-" + this.key) > -1; }, 10387 getRange: function (dockInfo) { 10388 var c1 = this.getTargetBox(dockInfo)[this.info.to]; 10389 var c2 = c1 + this.info.sizeM * (dockInfo.elementBox[this.info.size] + (this.checkMargin() ? dockInfo.margin : 0)); 10390 return { 10391 from: Math.min(c1, c2), 10392 to: Math.max(c1, c2), 10393 windowOverflow: 0 10394 }; 10395 }, 10396 getTargetBox: function (dockInfo) { return null; }, 10397 validate: function (range, windowInfo) { 10398 var windowSize = windowInfo[this.info.size]; 10399 range.windowOverflow = Math.abs(Math.min(0, range.from - windowSize.from) + Math.min(0, windowSize.to - range.to)); 10400 range.validTo = Math.min(range.to, windowSize.to); 10401 range.validFrom = Math.max(range.from, windowSize.from); 10402 return range.windowOverflow === 0; 10403 }, 10404 applyRange: function (range, dockInfo) { 10405 dockInfo.appliedModifierKeys[this.info.size] = this.key; 10406 var side = this.info.size === "width" ? "left" : "top"; 10407 var style = dockInfo.styles; 10408 var from = range.from; 10409 if (this.allowScroll() && range.windowOverflow > 0) { 10410 if (!dockInfo.limitBox.scroll.width) { 10411 dockInfo.limitBox.scroll.width = true; 10412 dockInfo.limitBox.width.to -= ASPx.GetVerticalScrollBarWidth(); 10413 } 10414 if (dockInfo.isScrollable) { 10415 style["max-height"] = dockInfo.height - range.windowOverflow + "px"; 10416 dockInfo.width += ASPx.GetVerticalScrollBarWidth(); 10417 dockInfo.elementBox.width += ASPx.GetVerticalScrollBarWidth(); 10418 from = range.validFrom; 10419 } 10420 } 10421 style.width = dockInfo.width + "px"; 10422 if(this.checkMargin()) 10423 from += Math.max(0, this.info.sizeM) * dockInfo.margin; 10424 dockInfo.elementBox[side] += from; 10425 style["transform"] = 10426 "matrix(1, 0, 0, 1, " + dockInfo.elementBox.left + ", " + dockInfo.elementBox.top + ")"; 10427 }, 10428 dockElementToTarget: function (dockInfo) { 10429 var range1 = this.getRange(dockInfo); 10430 if (!this.dockElementToTargetInternal(range1, dockInfo)) 10431 this.applyRange(range1, dockInfo); 10432 }, 10433 dockElementToTargetInternal: function (range1, dockInfo) { } 10434 }); 10435 var OuterDockPoint = ASPx.CreateClass(DockPoint, { 10436 constructor: function (name, info, oppositePointName) { 10437 this.constructor.prototype.constructor.apply(this, arguments); 10438 this.oppositePointName = oppositePointName || null; 10439 }, 10440 getTargetBox: function (dockInfo) { return dockInfo.targetBox.outer; }, 10441 getOppositePoint: function () { 10442 return this._oppositePoint || (this._oppositePoint = dockPoints.filter(function (d) { 10443 return d.key === this.oppositePointName; 10444 }.bind(this))[0]); 10445 }, 10446 dockElementToTargetInternal: function (range1, dockInfo) { 10447 if (this.validate(range1, dockInfo.limitBox)) 10448 this.applyRange(range1, dockInfo); 10449 else { 10450 var oppositePoint = this.getOppositePoint(); 10451 var range2 = oppositePoint.getRange(dockInfo); 10452 if (oppositePoint.validate(range2, dockInfo.limitBox) || range2.windowOverflow < range1.windowOverflow) 10453 oppositePoint.applyRange(range2, dockInfo); 10454 else 10455 return false; 10456 } 10457 return true; 10458 } 10459 }); 10460 var InnerDockPoint = ASPx.CreateClass(DockPoint, { 10461 checkMargin: function () { return false; }, 10462 getTargetBox: function (dockInfo) { return dockInfo.targetBox.inner; }, 10463 dockElementToTargetInternal: function (range1, dockInfo) { 10464 this.validate(range1, dockInfo.limitBox); 10465 return false; 10466 },
10467 validate: function (range, windowInfo) { 10468 var toOverflow = Math.min(range.from, Math.max(0, range.to - windowInfo[this.info.size].to)); 10469 if (toOverflow > 0) { 10470 range.from -= toOverflow; 10471 range.to -= toOverflow; 10472 } 10473 return DockPoint.prototype.validate.call(this, range, windowInfo); 10474 } 10475 }); 10476 var dockPoints = [ 10477 new OuterDockPoint("above", { to: "top", from: "bottom", size: "height", sizeM: -1 }, "below"), 10478 new OuterDockPoint("below", { to: "bottom", from: "top", size: "height", sizeM: 1 }, "above"), 10479 new InnerDockPoint("top-sides", { to: "top", from: "top", size: "height", sizeM: 1 }), 10480 new InnerDockPoint("bottom-sides", { to: "bottom", from: "bottom", size: "height", sizeM: -1 }), 10481 new OuterDockPoint("outside-left", { to: "left", from: "right", size: "width", sizeM: -1 }, "outside-right"), 10482 new OuterDockPoint("outside-right", { to: "right", from: "left", size: "width", sizeM: 1 }, "outside-left"), 10483 new InnerDockPoint("left-sides", { to: "left", from: "left", size: "width", sizeM: 1 }), 10484 new InnerDockPoint("right-sides", { to: "right", from: "right", size: "width", sizeM: -1 }) 10485 ]; 10486 var defaultHorizontalItemDockPoints = [dockPoints[1], dockPoints[6]], 10487 defaultVerticalItemDockPoints = [dockPoints[2], dockPoints[5]]; 10488 function getElementPopupInfo(element, targetElement, isVertical, settings) { 10489 var elementStyle = ASPx.GetCurrentStyle(element); 10490 var box = getOuterBoundingBox(element); 10491 var docEl = element.ownerDocument.documentElement; 10492 var result = { 10493 isScrollable: ASPx.ElementHasCssClass(element, "dxbs-scrollable"), 10494 specifiedOffsetModifiers: dockPoints.filter(function (m) { return m.canApplyToElement(element); }), 10495 margin: ASPx.PxToInt(elementStyle.marginTop), 10496 width: settings ? Math.max(settings.width, Math.ceil(element.offsetWidth)) : Math.ceil(element.offsetWidth), 10497 height: Math.ceil(element.offsetHeight), 10498 appliedModifierKeys: { height: null, width: null } 10499 }; 10500 var styles = parseTranslateInfo(elementStyle); 10501 result.elementBox = getBoundingBox(styles.left - box.left, styles.top - box.top, box.width, box.height); 10502 result.targetBox = { outer: getOuterBoundingBox(targetElement), inner: getInnerBoundingBox(targetElement) }; 10503 result.limitBox = { 10504 scroll: { width: docEl.clientWidth < window.innerWidth, height: docEl.clientHeight < window.innerHeight }, 10505 width: { from: 0, to: docEl.clientWidth }, 10506 height: { from: 0, to: docEl.clientHeight } 10507 }; 10508 result.styles = {}; 10509 var highPriorityModifiersData = ASPx.Attr.GetAttribute(element, "data-popup-align") || settings && settings.align; 10510 if (highPriorityModifiersData) { 10511 var highPriorityModifiers = highPriorityModifiersData.split(/\s+/); 10512 result.offsetModifiers = dockPoints.filter(function (m) { 10513 return highPriorityModifiers.some(function (k) { return m.key === k; }); 10514 }); 10515 } else 10516 result.offsetModifiers = result.specifiedOffsetModifiers.filter(function (m) { return !isVertical; }); 10517 if (result.offsetModifiers.length === 0) 10518 result.offsetModifiers = isVertical ? defaultVerticalItemDockPoints : defaultHorizontalItemDockPoints; 10519 return result; 10520 } 10521 function hide(element) { 10522 if (ASPx.ElementHasCssClass(element, showCssClass)) { 10523 if (element.isDockedElementHidden) 10524 delete element.isDockedElementHidden; 10525 ASPx.DOM.ClearStyles(element); 10526 ASPx.DOM.ToggleCssClass(element, showCssClass, false); 10527 } else if (element.isDockedElementHidden) 10528 delete element.isDockedElementHidden; 10529 } 10530 function show(element, targetElement, isVertical) { 10531 ASPx.DOM.ClearStyles(element); 10532 ASPx.DOM.ToggleCssClass(element, showCssClass, true); 10533 preparePosition(element, targetElement, isVertical, null, function () { });
10534 } 10535 function preparePosition(element, targetElement, isVertical, settings, onShow) { 10536 ASPx.DOM.CalculateStyles(function () { 10537 var dockInfo = getElementPopupInfo(element, targetElement, isVertical, settings); 10538 for (var i = 0; i < dockInfo.offsetModifiers.length; i++) 10539 dockInfo.offsetModifiers[i].dockElementToTarget(dockInfo); 10540 ASPx.DOM.ChangeDOM(function () { onShow(dockInfo); }); 10541 ASPx.DOM.SetStyles(element, dockInfo.styles); 10542 }.bind(this)); 10543 } 10544 return { 10545 getElementPopupInfo: getElementPopupInfo, 10546 hide: hide, 10547 show: show, 10548 preparePosition: preparePosition 10549 }; 10550 }); 10551 ASPx.DOM = ASPx.CreateSingleton(function (ASPx) { 10552 var FrameContext = ASPx.CreateClass(null, { 10553 constructor: function (requestFrame) { 10554 this.requestFrame = requestFrame; 10555 this.cache = [[]]; 10556 this.isInFrame = false; 10557 this.isWaiting = false; 10558 }, 10559 getBuffer: function (order) { 10560 if (!order) order = 0; 10561 if (this.cache.length <= order) this.cache[order] = []; 10562 return this.cache[order]; 10563 }, 10564 execute: function (callback, order) { 10565 if (!this.isInFrame) 10566 return false; 10567 var buffer = this.cache[order || 0]; 10568 if (buffer === null) 10569 callback(requestFrameId); 10570 else 10571 (buffer = this.getBuffer(order)).push(callback); 10572 return true; 10573 }, 10574 runAll: function () { 10575 this.isWaiting = false; 10576 this.isInFrame = true; 10577 for (var i = 0; i < this.cache.length; i++) { 10578 var buffer = this.cache[i]; 10579 if (buffer) { 10580 this.cache[i] = null; 10581 while (buffer.length) 10582 buffer.shift()(requestFrameId); 10583 } 10584 } 10585 this.waitNextFrame(); 10586 }, 10587 waitNextFrame: function () { 10588 this.cache = [[]]; 10589 this.isInFrame = false; 10590 this.isWaiting = false; 10591 }, 10592 requestExecution: function (callback, order) { 10593 if (!this.execute(callback, order)) { 10594 this.getBuffer(order).push(callback); 10595 if (this.isWaiting === false) { 10596 this.isWaiting = true; 10597 this.requestFrame(this.runAll.bind(this)); 10598 } 10599 } 10600 } 10601 }); 10602 var requestFrameId = null; 10603 function requestAnimationFrame(callback) { return requestFrameId = ASPx.RequestAnimationFrame(callback); } 10604 function createAccumulator(requestFrame) { 10605 var context = new FrameContext(requestFrame); 10606 return context.requestExecution.bind(context); 10607 } 10608 var changeDom = createAccumulator(requestAnimationFrame); 10609 var calculateStyles = createAccumulator(function (callback) { changeDom(function () { setTimeout(callback); }); }); 10610 var observers = [], minimumIntervalBetweenChecks = 50; 10611 function itemObserver(element, callback, width) { 10612 return function () { 10613 if (element.compareDocumentPosition(document.body) & Node.DOCUMENT_POSITION_DISCONNECTED) 10614 return false; 10615 var currentStyle = ASPx.GetCurrentStyle(element); 10616 if (currentStyle.width === "auto") 10617 return true; 10618 var w = ASPx.PxToInt(currentStyle.width) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element); 10619 if (width !== w) 10620 callback(width = w); 10621 return true; 10622 }; 10623 } 10624 function subscribeElementContentWidth(el, callback) { 10625 if (observers.length === 0) { 10626 observers.push(itemObserver(el, callback, -1)); 10627 calculateStyles(updateTrackedElements); 10628 } else 10629 observers.push(itemObserver(el, callback, -1)); 10630 } 10631 function elementSizeObserver(element, callback, size) { 10632 return function() { 10633 if(element.compareDocumentPosition(document.body) & Node.DOCUMENT_POSITION_DISCONNECTED) 10634 return false; 10635 var currentStyle = ASPx.GetCurrentStyle(element); 10636 if(currentStyle.width === "auto") 10637 return true; 10638 var elementWidth = ASPx.PxToInt(currentStyle.width) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element); 10639 var elementHeight = ASPx.PxToInt(currentStyle.height) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element); 10640 if(size.width !== elementWidth || size.height !== elementHeight) { 10641 size.width = elementWidth; 10642 size.height = elementHeight; 10643 callback(size); 10644 } 10645 return true; 10646 }; 10647 } 10648 function subscribeElementContentSize(element, callback) { 10649 if(observers.length === 0) { 10650 observers.push(elementSizeObserver(element, callback, { width: -1, height: -1 })); 10651 calculateStyles(updateTrackedElements); 10652 } else 10653 observers.push(elementSizeObserver(element, callback, { width: -1, height: -1 })); 10654 } 10655 function updateTrackedElements() { 10656 observers = observers.filter(function (observer) { return observer(); }); 10657 if (observers.length > 0) { 10658 setTimeout(function () {
10659 calculateStyles(updateTrackedElements); 10660 }, minimumIntervalBetweenChecks); 10661 } 10662 } 10663 function applyStyles(element, styles) { 10664 var stylesArr = []; 10665 for (var property in styles) { 10666 if (styles.hasOwnProperty(property)) 10667 stylesArr.push({ attr: property, value: styles[property] }); 10668 } 10669 if (stylesArr.length === 1) { 10670 element.style[stylesArr[0].attr] = stylesArr[0].value; 10671 } else { 10672 var cssText = ""; 10673 if (element.style.cssText) { 10674 var oldStylesArr = element.style.cssText.split(';').map(function (nvp) { return nvp.trim().split(':'); }); 10675 for (var i = 0; i < oldStylesArr.length; i++) { 10676 var oldStyleArr = oldStylesArr[i]; 10677 if (oldStyleArr.length === 2 && styles[oldStyleArr[0]] === undefined) 10678 cssText += oldStyleArr[0] + ":" + oldStyleArr[1].trim() + ";"; 10679 } 10680 } 10681 for (var i = 0; i < stylesArr.length; i++) { 10682 var style = stylesArr[i]; 10683 if (style.value !== "") 10684 cssText += style.attr + ":" + style.value + ";"; 10685 } 10686 ASPx.Attr.SetOrRemoveAttribute(element, "style", cssText); 10687 } 10688 } 10689 function applyStateToElement(element, state) { 10690 if (state.inlineStyles === null) 10691 ASPx.Attr.RemoveAttribute(element, "style"); 10692 else 10693 applyStyles(element, state.inlineStyles); 10694 for (var attrName in state.attributes) { 10695 if (state.attributes.hasOwnProperty(attrName)) 10696 ASPx.Attr.SetOrRemoveAttribute(element, attrName, state.attributes[attrName]); 10697 }
10698 var allCssClasses = ASPx.GetClassNameList(state); 10699 if (allCssClasses) { 10700 var toggleInfo = state.cssClassToggleInfo; 10701 var cssClasses = allCssClasses.filter(function (c) { return toggleInfo[c] !== false; }); 10702 for (var c in toggleInfo) { 10703 if (toggleInfo.hasOwnProperty(c) && toggleInfo[c] && cssClasses.indexOf(c) === -1) 10704 cssClasses.push(c); 10705 } 10706 var cssClass = cssClasses.join(" "); 10707 if (cssClass) 10708 ASPx.SetClassName(element, cssClass); 10709 else 10710 ASPx.Attr.RemoveAttribute(element, "class"); 10711 } 10712 } 10713 function createElementState(element) { 10714 return { inlineStyles: {}, cssClassToggleInfo: {}, className: ASPx.GetClassName(element), attributes: {} }; 10715 } 10716 function updateElementState(elementOrCollection, callback) { 10717 if (elementOrCollection.length !== undefined) { 10718 for (var i = 0; i < elementOrCollection.length; i++) 10719 updateElementState(elementOrCollection[i], callback); 10720 return; 10721 } 10722 var element = elementOrCollection; 10723 if (!element._dxCurrentFrameElementStateInfo) { 10724 callback(element._dxCurrentFrameElementStateInfo = createElementState(element)); 10725 changeDom(function () { 10726 applyStateToElement(element, element._dxCurrentFrameElementStateInfo); 10727 element._dxCurrentFrameElementStateInfo = null; 10728 }, 1); 10729 } else 10730 callback(element._dxCurrentFrameElementStateInfo); 10731 } 10732 function setStyles(el, styles) { 10733 updateElementState(el, function (state) { 10734 if (state.inlineStyles === null) 10735 state.inlineStyles = styles; 10736 else { 10737 for (var i in styles) { 10738 if (styles.hasOwnProperty(i)) 10739 state.inlineStyles[i] = styles[i]; 10740 } 10741 } 10742 }); 10743 } 10744 function clearStyles(el) { 10745 updateElementState(el, function (state) { 10746 state.inlineStyles = null; 10747 }); 10748 } 10749 function toggleCssClass(el, cssClass, condition) { 10750 updateElementState(el, function (state) { 10751 state.cssClassToggleInfo[cssClass] = condition; 10752 }); 10753 } 10754 function setCssClassName(el, className) { 10755 updateElementState(el, function (state) { 10756 state.cssClassToggleInfo = {}; 10757 state.className = className; 10758 }); 10759 } 10760 function updateAttribute(el, attrName, attrValue) { 10761 updateElementState(el, function (state) { 10762 state.attributes[attrName] = attrValue; 10763 }); 10764 } 10765 function nextChangeDOM(callback) { 10766 changeDom(callback, 2); 10767 } 10768 return { 10769 ChangeDOM: changeDom, 10770 NextChangeDOM: nextChangeDOM, 10771 CalculateStyles: calculateStyles, 10772 SubscribeElementContentWidth: subscribeElementContentWidth, 10773 SubscribeElementContentSize: subscribeElementContentSize, 10774 SetStyles: setStyles, 10775 ClearStyles: clearStyles, 10776 ToggleCssClass: toggleCssClass, 10777 SetCssClassName: setCssClassName, 10778 UpdateAttribute: updateAttribute 10779 }; 10780 }); 10781 ASPx.DefaultDisplayNoneSelectors = ASPx.DefaultDisplayNoneSelectors.concat([ 10782 ASPx.BootstrapCssSelectors.Modal, 10783 ASPx.BootstrapCssSelectors.DropDownMenu, 10784 "dxbs-dropdown-area", 10785 ASPx.BootstrapCssSelectors.HiddenLayout 10786 ]); 10787 ASPx.DefaultDisplaySelectors = ASPx.DefaultDisplaySelectors.concat([ 10788 "dxbs-modal" 10789 ]); 10790 ASPx.ProcessStyleSheetRules(".dropdown-item", function(name, style, rule) { 10791 if(name.indexOf(":hover") > -1 && style.backgroundColor) { 10792 var cssText = "background-color: " + style.backgroundColor + ";"; 10793 if(style.color) 10794 cssText += "color: " + style.color + "; "; 10795 ASPx.AddStyleSheetRule(rule.parentStyleSheet, ".dxbs-item-hover", cssText); 10796 return true; 10797 } 10798 }); 10799})(dx || (dx = {})); 10800 10801(function(dx) { 10802 var NAVBAR_CLASS = "nav navbar-nav dxbs-navbar", 10803 ITEM_IMAGE_CLASS = "image", 10804 ITEM_TEXT_CLASS = "text", 10805 ITEM_POPOUT_CLASS = "popout", 10806 SUBMENU_TEMPLATE_CLASS = "dxbs-submenu"; 10807 var BootstrapMenuRenderHelper = ASPx.CreateClass(ASPx.MenuRenderHelper, { 10808 constructor: function(menu) { 10809 this.constructor.prototype.constructor.call(this, menu); 10810 }, 10811 InlineInitializeElements: function() { 10812 ASPx.MenuRenderHelper.prototype.InlineInitializeElements.call(this); 10813 if(this.menu.IsStateControllerEnabled()) 10814 this.InitializeStateControllerItems();
10815 }, 10816 InitializeStateControllerItems: function() { 10817 if(!this.menu.enabled) return; 10818 var itemPostfixes = ['', 'T']; 10819 var disabledItemPostfixes = ['', 'T', 'P']; 10820 var itemActiveRootStyles = this.IsStateControllerItemOnRootItemElement() ? ['active'] : ['', 'active']; 10821 var itemActiveStyles = ASPx.BootstrapCore.IsBootstrap3 ? ['active'] : ['', 'active']; 10822 var itemDisabledRootStyles = this.IsStateControllerItemOnRootItemElement() ? ['disabled'] : ['', 'disabled']; 10823 var itemDisabledStyles = ASPx.BootstrapCore.IsBootstrap3 ? ['disabled'] : ['', 'disabled']; 10824 var itemCheckedStyles = ['checked']; 10825 var itemSuffixes = []; 10826 var menuSuffixes = []; 10827 for(var key in this.menu.renderData) { 10828 if(!this.menu.renderData.hasOwnProperty(key)) continue; 10829 var rootIndexPath = key; 10830 var rootItemData = this.menu.renderData[key]; 10831 if(rootIndexPath !== "") { 10832 itemSuffixes.push("DXI" + rootIndexPath + "_"); 10833 menuSuffixes.push("DXME" + rootIndexPath + "_"); 10834 } 10835 for(var subKey in rootItemData) { 10836 if(!rootItemData.hasOwnProperty(subKey)) continue; 10837 var itemData = rootItemData[subKey]; 10838 var indexPath = ASPx.Ident.IsArray(itemData) ? itemData[0] : itemData; 10839 if(rootIndexPath !== "") 10840 indexPath = rootIndexPath + "i" + indexPath; 10841 var itemSuffix = "DXI" + indexPath + "_"; 10842 if(!ASPx.Data.ArrayContains(itemSuffixes, itemSuffix)) 10843 itemSuffixes.push(itemSuffix); 10844 } 10845 } 10846 ASPx.BootstrapCore.AddStateItems(function() { 10847 var menu = this.menu; 10848 ASPx.AddHoverItems(this.menu.name, [[[''], [''], itemSuffixes, ['', 'P']], [[''], [''], menuSuffixes, ['']]], true); 10849 if(this.menu.allowSelectItem) { 10850 ASPx.AddSelectedItems(this.menu.name, [[itemActiveRootStyles, [''], itemSuffixes.filter(function(indexPath) { return menu.IsRootItem(indexPath); }), itemPostfixes]], true); 10851 ASPx.AddSelectedItems(this.menu.name, [[itemActiveStyles, [''], itemSuffixes.filter(function(indexPath) { return !menu.IsRootItem(indexPath); }), itemPostfixes]], true); 10852 } 10853 else { 10854 ASPx.AddSelectedItems(menu.name, [[this.menu.isPopupMenu ? itemCheckedStyles : itemActiveRootStyles, [''], itemSuffixes.filter(function(indexPath) { return menu.IsRootItem(indexPath); }), itemPostfixes]], true); 10855 ASPx.AddSelectedItems(menu.name, [[itemCheckedStyles, [''], itemSuffixes.filter(function(indexPath) { return !menu.IsRootItem(indexPath); }), itemPostfixes]], true); 10856 } 10857 ASPx.AddDisabledItems(this.menu.name, [[itemDisabledRootStyles, [''], itemSuffixes.filter(function(indexPath){ return menu.IsRootItem(indexPath); }), disabledItemPostfixes]], true); 10858 ASPx.AddDisabledItems(this.menu.name, [[itemDisabledStyles, [''], itemSuffixes.filter(function(indexPath) { return !menu.IsRootItem(indexPath); }), disabledItemPostfixes]], true); 10859 var menuElements = this.GetPopupMenuElements(menu.GetMainElement()); 10860 var menuElementsSuffixes = []; 10861 for(var i = 0; i < menuElements.length; i++) 10862 menuElementsSuffixes.push(menuElements[i].id.replace(menu.name + "_", "")); 10863 ASPx.AddHoverItems(menu.name, [[[''], [''], menuElementsSuffixes, ['']], [[''], [''], [], ['']]], true); 10864 }.aspxBind(this)); 10865 }, 10866 IsStateControllerItemOnRootItemElement: function() { 10867 return ASPx.BootstrapCore.IsBootstrap3; 10868 }, 10869 HasSubMenuTemplate: function(menuElement) { 10870 var contentElement = this.GetContentElement(menuElement); 10871 return (contentElement && contentElement.tagName !== "UL") || (menuElement && ASPx.ElementHasCssClass(menuElement, SUBMENU_TEMPLATE_CLASS)); 10872 }, 10873 GetSubMenuIndexPathByMenuParentElement: function(element) { 10874 return this.menu.GetItemIndexPathById(element.parentNode.id); 10875 }, 10876 InlineInitializePopupMenuElements: function(parentElement) { 10877 var indexPath = this.GetSubMenuIndexPathByMenuParentElement(parentElement); 10878 this.InlineInitializePopupMenuMenuElement(parentElement, indexPath); 10879 }, 10880 InlineInitializePopupMenuMenuElement: function(parentElement, indexPath) { 10881 if(indexPath !== "") 10882 parentElement.id = this.menu.GetMenuElementId(indexPath); 10883 this.InlineInitializePopupMenuContentElements(parentElement, parentElement, indexPath); 10884 }, 10885 InlineInitializeItemElement: function(itemElement, parentIndexPath, visibleIndex) { 10886 ASPx.MenuRenderHelper.prototype.InlineInitializeItemElement.call(this, itemElement, parentIndexPath, visibleIndex); 10887 if(!this.IsItemDisabled(itemElement)) { 10888 var itemLink = ASPx.GetChildByTagName(itemElement, "A"); 10889 if(itemLink && itemLink.href === "") 10890 itemLink.href = ASPx.AccessibilityEmptyUrl; 10891 } 10892 var links = ASPx.GetNodesByTagName(itemElement, "A"); 10893 for(var i = 0; i < links.length; i++) 10894 this.attachAccessibilityEventsToLink(links[i]); 10895 }, 10896 InlineInitializeItemPopOutElement: function(itemElement, indexPath) { }, 10897 AssignItemOnClickToElement: function(element, itemLinkMode, method) { 10898 if(element && element.tagName !== "A") 10899 element = ASPx.GetNodeByTagName(element, "A"); 10900 ASPx.MenuRenderHelper.prototype.AssignItemOnClickToElement.call(this, element, itemLinkMode, method); 10901 }, 10902 IsItemDisabled: function(itemElement) { 10903 var element = ASPx.BootstrapCore.IsBootstrap3 ? itemElement : this.GetItemContentElement(itemElement); 10904 return ASPx.ElementContainsCssClass(element, ASPx.BootstrapCssSelectors.Disabled); 10905 }, 10906 SetItemIconCssClass: function(itemElement, iconCssClass) { 10907 var iconElement = this.GetItemIconElement(itemElement); 10908 if(iconElement) 10909 ASPx.SetClassName(iconElement, ITEM_IMAGE_CLASS + (iconCssClass ? " " + iconCssClass : "")); 10910 }, 10911 GetItemIconCssClass: function(itemElement) { 10912 var iconElement = this.GetItemIconElement(itemElement); 10913 var regEx = new RegExp("(?:^|\\s)" + ITEM_IMAGE_CLASS + "(?!\\S)"); 10914 return iconElement ? ASPx.Str.Trim(ASPx.GetClassName(iconElement).replace(regEx, "")) : ""; 10915 }, 10916 ChangeItemLinkEnabledAttributes: function(hyperLink, itemElement, enabled, accessibilityCompliant) { 10917 ASPx.MenuRenderHelper.prototype.ChangeItemLinkEnabledAttributes.call(this, hyperLink, itemElement, enabled, accessibilityCompliant); 10918 if(!ASPx.BootstrapCore.IsBootstrap3) { 10919 var action = enabled ? ASPx.Attr.RemoveAttribute : ASPx.Attr.SetAttribute; 10920 action(hyperLink, "tabIndex", "-1"); 10921 } 10922 }, 10923 convertToNavBar: function(menuElement) { 10924 ASPx.RemoveClassNameFromElement(menuElement, ASPx.BootstrapCssSelectors.DropDownMenu); 10925 ASPx.AddClassNameToElement(menuElement, NAVBAR_CLASS); 10926 var itemElements = ASPx.GetChildNodesByTagName(menuElement, "LI"); 10927 for(var i = 0; i < itemElements.length; i++) { 10928 ASPx.AddClassNameToElement(itemElements[i], ASPx.BootstrapCssSelectors.NavItem); 10929 var linkElement = ASPx.GetChildByTagName(itemElements[i], "A"); 10930 if(linkElement) { 10931 ASPx.RemoveClassNameFromElement(linkElement, ASPx.BootstrapCssSelectors.DropDownMenuItem); 10932 ASPx.AddClassNameToElement(linkElement, ASPx.BootstrapCssSelectors.NavLink); 10933 } 10934 } 10935 }, 10936 convertToMenu: function(menuElement) { 10937 ASPx.AddClassNameToElement(menuElement, ASPx.BootstrapCssSelectors.DropDownMenu); 10938 ASPx.RemoveClassNameFromElement(menuElement, NAVBAR_CLASS); 10939 var itemElements = ASPx.GetChildNodesByTagName(menuElement, "LI"); 10940 for(var i = 0; i < itemElements.length; i++) { 10941 ASPx.RemoveClassNameFromElement(itemElements[i], ASPx.BootstrapCssSelectors.NavItem); 10942 var linkElement = ASPx.GetChildByTagName(itemElements[i], "A"); 10943 if(linkElement) { 10944 ASPx.AddClassNameToElement(linkElement, ASPx.BootstrapCssSelectors.DropDownMenuItem); 10945 ASPx.RemoveClassNameFromElement(linkElement, ASPx.BootstrapCssSelectors.NavLink); 10946 } 10947 } 10948 }, 10949 PrepareElementScrolling: function(element, excessTop, excessBottom) { 10950 if(excessTop > 0 || excessBottom > 0) { 10951 element.style.overflowY = "auto"; 10952 element.style.overflowX = "hidden"; 10953 var height = element.offsetHeight; 10954 if(excessTop > 0) 10955 height -= excessTop; 10956 if(excessBottom > 0) 10957 height -= excessBottom; 10958 element.style.height = (height - 8) + "px"; 10959 } 10960 }, 10961 ResetElementScrolling: function(element) { 10962 element.style.height = "auto"; 10963 element.style.overflowX = "visible"; 10964 element.style.overflowY = "visible"; 10965 }, 10966 createScrollableMenusContainer: function(className) { 10967 var container = document.createElement("DIV"); 10968 ASPx.SetClassName(container, className); 10969 return container; 10970 }, 10971 GetContentElement: function(menuElement) { 10972 return ASPx.CacheHelper.GetCachedElement(this, "contentElement", 10973 function() { 10974 if(menuElement.tagName === "UL") 10975 return menuElement; 10976 var contentElement = ASPx.GetNodeByTagName(menuElement, "UL"); 10977 if(contentElement) 10978 return contentElement; 10979 return ASPx.GetNodeByTagName(menuElement, "DIV"); 10980 }, menuElement); 10981 }, 10982 GetItemElements: function(menuElement) { 10983 return ASPx.CacheHelper.GetCachedElements(this, "itemElements", 10984 function() { 10985 var contentElement = menuElement && !ASPx.ElementHasCssClass(menuElement, SUB
10985MENU_TEMPLATE_CLASS) ? this.GetContentElement(menuElement) : null; 10986 return contentElement ? ASPx.GetChildNodesByQuerySelector(contentElement, "li:not(.separator):not(." + ASPx.BootstrapCssSelectors.Divider + ")") : []; 10987 }, menuElement); 10988 }, 10989 GetPopupMenuElements: function(menuElement) { 10990 return ASPx.CacheHelper.GetCachedElements(this, "popupMenuElements", 10991 function() { 10992 var contentElement = this.GetContentElement(menuElement); 10993 return contentElement ? ASPx.GetNodesByClassName(contentElement, "dxbs-dm") : null; 10994 }, menuElement); 10995 }, 10996 GetItemContentElement: function(itemElement) { 10997 return ASPx.CacheHelper.GetCachedElement(this, "contentElement", 10998 function() { 10999 return ASPx.GetChildByTagName(itemElement, "A"); 11000 }, itemElement); 11001 }, 11002 GetItemPopOutElement: function(itemElement) { 11003 return ASPx.CacheHelper.GetCachedElement(this, "popOutElement", 11004 function() { 11005 return ASPx.GetNodeByClassName(itemElement, ITEM_POPOUT_CLASS); 11006 }, itemElement); 11007 }, 11008 GetItemIconElement: function(itemElement) { 11009 return ASPx.CacheHelper.GetCachedElement(this, "iconElement", 11010 function() { 11011 var imageNodes = ASPx.GetNodesByClassName(itemElement, ITEM_IMAGE_CLASS); 11012 return imageNodes[imageNodes.length - 1]; 11013 }, itemElement); 11014 }, 11015 getEventSyncObject: function() { 11016 if(!this.menu.getEventContainers) 11017 this.menu.getEventContainers = function() { return this.getEventContainersCore(); }.aspxBind(this.menu); 11018 return this.menu; 11019 }, 11020 CalculateMenuControl: function(menuElement, recalculate) { 11021 }, 11022 CalculateSubMenu: function(parentElement, recalculate) { 11023 }, 11024 PrecalculateMenuPopOuts: function(menuElement) { 11025 }, 11026 ApplyItemsVerticalAlignment: function() { }, 11027 AssignItemOnClickToElementCore: function(element, handler) { 11028 ASPx.BootstrapEventManager.attachEventToElement(this.getEventSyncObject(), element, "click", handler); 11029 }, 11030 attachAccessibilityEventsToLink: function(link) { 11031 } 11032 }); 11033 var BootstrapClientMenuItem = ASPx.CreateClass(ASPxClientMenuItem, { 11034 constructor: function(menu, parent, index, name) { 11035 this.constructor.prototype.constructor.call(this, menu, parent, index, name); 11036 }, 11037 GetFirstVisibleChild: function () { 11038 for (var i = 0; i < this.GetItemCount(); i++) { 11039 var child = this.GetItem(i); 11040 if (child.GetVisible()) 11041 return child; 11042 } 11043 return null; 11044 }, 11045 GetBadgeText: function() { 11046 var indexPath = this.GetIndexPath(); 11047 return this.menu.GetItemBadgeText(indexPath); 11048 }, 11049 SetBadgeText: function(text) { 11050 var indexPath = this.GetIndexPath(); 11051 this.menu.SetItemBadgeText(indexPath, text); 11052 }, 11053 GetBadgeIconCssClass: function() { 11054 var indexPath = this.GetIndexPath(); 11055 return this.menu.GetItemBadgeIconCssClass(indexPath); 11056 }, 11057 SetBadgeIconCssClass: function(cssClass) { 11058 var indexPath = this.GetIndexPath(); 11059 this.menu.SetItemBadgeIconCssClass(indexPath, cssClass); 11060 }, 11061 GetIconCssClass: function() { 11062 var indexPath = this.GetIndexPath(); 11063 return this.menu.GetItemIconCssClass(indexPath); 11064 }, 11065 SetIconCssClass: function(cssClass) { 11066 var indexPath = this.GetIndexPath(); 11067 this.menu.SetItemIconCssClass(indexPath, cssClass); 11068 } 11069 }); 11070 var BootstrapClientMenu = ASPx.CreateClass(ASPxClientMenu, { 11071 constructor: function(name) { 11072 this.constructor.prototype.constructor.call(this, name); 11073 }, 11074 InlineInitialize: function() { 11075 ASPxClientMenu.prototype.InlineInitialize.call(this); 11076 this.enableAnimation = false; 11077 }, 11078 CreateRenderHelper: function() { 11079 return new BootstrapMenuRenderHelper(this); 11080 }, 11081 RenderSubMenuItem: function(indexPath) { 11082 var subMenuElement = this.CreateSubMenuElement(indexPath); 11083 var itemElement = this.GetItemElement(indexPath); 11084 if(itemElement) { 11085 var sampleList = ASPx.GetChildByTagName(itemElement, "UL"); 11086 if(sampleList) itemElement.removeChild(sampleList); 11087 itemElement.appendChild(subMenuElement); 11088 } 11089 return subMenuElement; 11090 }, 11091 GetMenuMainElement: function(element) {
11092 var indexPath = this.GetIndexPathById(element.id, true); 11093 return this.GetMenuElement(indexPath); 11094 }, 11095 GetMenuListElement: function(indexPath) { 11096 var element = this.GetMenuElement(indexPath); 11097 if(element && element.tagName !== "UL") 11098 return ASPx.GetChildByTagName(element, "UL"); 11099 return element; 11100 }, 11101 GetItemSeparatorElement: function(indexPath) { 11102 var el = this.GetItemElement(indexPath); 11103 var separator = el && el.previousElementSibling; 11104 return separator && ASPx.ElementHasCssClass(separator, "separator") ? separator : null; 11105 }, 11106 getSeparatorCssClass: function() { 11107 return "separator"; 11108 }, 11109 getScrollableMenusContainer: function() { 11110 if(!this.scrollableMenusContainer) { 11111 this.scrollableMenusContainer = this.renderHelper.createScrollableMenusContainer("dxbs-menu"); 11112 this.GetMainElement().parentNode.appendChild(this.scrollableMenusContainer); 11113 } 11114 return this.scrollableMenusContainer; 11115 }, 11116 getEventContainersCore: function() { 11117 var obj = [this.GetMainElement()]; 11118 if(this.enableScrolling) 11119 obj.push(this.getScrollableMenusContainer()); 11120 return obj; 11121 }, 11122 DoShowPopupMenu: function(element, x, y, indexPath) { 11123 if(this.isNavBarModeActivated()) 11124 this.convertMenuToNavBarMode(element); 11125 if(this.enableScrolling) { 11126 var menuParent = this.getScrollableMenusContainer(); 11127 if(element.parentNode !== menuParent) 11128 menuParent.appendChild(element); 11129 } 11130 ASPxClientMenu.prototype.DoShowPopupMenu.call(this, element, x, y, indexPath); 11131 var itemLinkElement = this.GetLinkElementByIndexPath(indexPath); 11132 ASPx.Attr.Aria.SetExpanded(itemLinkElement, true); 11133 }, 11134 GetScrollingCorrection: function(element, indexPath, clientY) { 11135 if(this.enableScrolling) { 11136 var yClientCorrection = this.GetScrollSubMenuYCorrection(element, null, clientY); 11137 if(yClientCorrection > 0) 11138 return yClientCorrection; 11139 } 11140 return 0; 11141 }, 11142 DoHidePopupMenu: function(evt, element) { 11143 ASPxClientMenu.prototype.DoHidePopupMenu.call(this, evt, element); 11144 var indexPath = this.GetIndexPathById(element.id, true); 11145 var itemLinkElement = this.GetLinkElementByIndexPath(indexPath); 11146 ASPx.Attr.Aria.SetExpanded(itemLinkElement, false); 11147 if(this.navBarMode) 11148 this.restoreMenuFromNavBarMode(element); 11149 }, 11150 DoResetScrolling: function(element, indexPath) { 11151 if(this.enableScrolling) 11152 this.renderHelper.ResetElementScrolling(element); 11153 }, 11154 GetScrollHelper: function(indexPath) { 11155 return null; 11156 }, 11157 PrepareScrolling: function(element, scrollHelper, excessTop, excessBottom) { 11158 if(this.enableScrolling) 11159 this.renderHelper.PrepareElementScrolling(element, excessTop, excessBottom); 11160 }, 11161 OnItemClick: function(indexPath, evt) { 11162 var hideSubMenu = false, preventItemSelection = false; 11163 var menuElement = this.GetMenuElement(indexPath); 11164 if(menuElement && this.isNavBarModeActivated()) { 11165 if(ASPx.GetElementDisplay(menuElement)) 11166 hideSubMenu = true; 11167 if(ASPx.ElementHasCssClass(ASPx.Evt.GetEventSource(evt), ITEM_POPOUT_CLASS)) { 11168 ASPx.Evt.PreventEvent(evt); 11169 preventItemSelection = true; 11170 } 11171 } 11172 if(preventItemSelection) 11173 this.DoItemClick(indexPath, false, evt); 11174 else 11175 ASPxClientMenu.prototype.OnItemClick.call(this, indexPath, evt); 11176 if(menuElement && hideSubMenu) 11177 this.DoHidePopupMenu(evt, menuElement); 11178 }, 11179 CanCloseSubMenuOnClick: function(indexPath) { 11180 return !this.isNavBarModeActivated(); 11181 }, 11182 GetAppearAfter: function(indexPath) { 11183 if(this.isNavBarModeActivated()) 11184 return 120000; 11185 return ASPxClientMenu.prototype.GetAppearAfter.call(this); 11186 }, 11187 GetDisappearAfter: function() { 11188 if(this.isNavBarModeActivated()) 11189 return 120000; 11190 return ASPxClientMenu.prototype.GetDisappearAfter.call(this); 11191 }, 11192 isNavBarModeActivated: function(){ 11193 if(!this.navBarMode) return false; 11194 var menuElement = this.GetMenuListElement(""); 11195 if(ASPx.BootstrapCore.IsBootstrap3) 11196 return ASPx.GetCurrentStyle(menuElement).float === "none"; 11197 return ASPx.GetCurrentStyle(menuElement).flexDirection === "column"; 11198 }, 11199 convertMenuToNavBarMode: function(menuElement){ 11200 if(menuElement.navBarMode) return; 11201 this.renderHelper.convertToNavBar(menuElement); 11202 menuElement.navBarMode = true; 11203 }, 11204 restoreMenuFromNavBarMode: function(menuElement){ 11205 if(!menuElement.navBarMode) return; 11206 this.renderHelper.convertToMenu(menuElement); 11207 menuElement.navBarMode = false; 11208 }, 11209 BrowserWindowResizeSubscriber: function () { 11210 return this.navBarMode; 11211 }, 11212 OnBrowserWindowResize: function(e) { 11213 var isNavBarModeActivated = this.isNavBarModeActivated(); 11214 if(!isNavBarModeActivated && this.savedIsNavBarModeActivated || isNavBarModeActivated && !this.savedIsNavBarModeActivated) 11215 ASPx.GetMenuCollection().DoHidePopupMenus(null, 0, this.name, true, ""); 11216 this.savedIsNavBarModeActivated = isNavBarModeActivated; 11217 }, 11218 AdjustControlCore: function() { 11219 }, 11220 GetClientItemType: function() { 11221 return BootstrapClientMenuItem; 11222 }, 11223 GetItemBadgeText: function(indexPath) { 11224 return ASPx.BootstrapBadgeManager.getBadgeText(this.GetItemContentElement(indexPath)); 11225 }, 11226 SetItemBadgeText: function(indexPath, text) { 11227 var badgeText = this.HtmlEncode(text); 11228 var contentElement = this.GetItemContentElement(indexPath); 11229 var badge = ASPx.BootstrapBadgeManager.findBadge(contentElement); 11230 if(badge) 11231 ASPx.BootstrapBadgeManager.setBadgeText(badge, badgeText); 11232 else 11233 this.AddBadgeToItemContentElement(contentElement, ASPx.BootstrapBadgeManager.createBadge(badgeText)); 11234 }, 11235 GetItemBadgeIconCssClass: function(indexPath) { 11236 return ASPx.BootstrapBadgeManager.getBadgeIconCssClass(this.GetItemContentElement(indexPath)); 11237 }, 11238 SetItemBadgeIconCssClass: function(indexPath, cssClass) { 11239 var contentElement = this.GetItemContentElement(indexPath); 11240 var badge = ASPx.BootstrapBadgeManager.findBadge(contentElement); 11241 if(badge) 11242 ASPx.BootstrapBadgeManager.setBadgeIconCssClass(badge, cssClass); 11243 else 11244 this.AddBadgeToItemContentElement(contentElement, ASPx.BootstrapBadgeManager.createBadge("", cssClass)); 11245 }, 11246 AddBadgeToItemContentElement: function(contentElement, badgeElement) { 11247 var popOutElement = this.renderHelper.GetItemPopOutElement(contentElement); 11248 if(popOutElement) 11249 contentElement.insertBefore(badgeElement, popOutElement); 11250 else 11251 contentElement.appendChild(badgeElement); 11252 }, 11253 GetItemIconCssClass: function(indexPath) { 11254 return this.renderHelper.GetItemIconCssClass(this.GetItemContentElement(indexPath)); 11255 }, 11256 SetItemIconCssClass: function(indexPath, cssClass) { 11257 this.renderHelper.SetItemIconCssClass(this.GetItemContentElement(indexPath), cssClass); 11258 }, 11259 CreateItemClickEventArgs: function(processOnServer, item, htmlElement, htmlEvent) { 11260 return new BootstrapClientMenuItemClickEventArgs(processOnServer, item, htmlElement, htmlEvent); 11261 }, 11262 CreateItemMouseEventArgs: function(item, htmlElement) { 11263 return new BootstrapClientMenuItemMouseEventArgs(item, htmlElement); 11264 }, 11265 CreateItemEventArgs: function(item) { 11266 return new BootstrapClientMenuItemEventArgs(item); 11267 }, 11268 GetContentTextElement: function(contentElement) { 11269 return ASPx.GetChildByClassName(contentElement, ITEM_TEXT_CLASS, 0); 11270 }, 11271 }); 11272 var BootstrapClientMenuItemEventArgs = ASPx.CreateClass(ASPxClientMenuItemEventArgs, { 11273 constructor: function(item) { 11274 this.constructor.prototype.constructor.call(this, item); 11275 } 11276 }); 11277 var BootstrapClientMenuItemMouseEventArgs = ASPx.CreateClass(BootstrapClientMenuItemEventArgs, { 11278 constructor: function(item, htmlElement) { 11279 this.constructor.prototype.constructor.call(this, item, htmlElement); 11280 } 11281 }); 11282 var BootstrapClientMenuItemClickEventArgs = ASPx.CreateClass(ASPxClientMenuItemClickEventArgs, { 11283 constructor: function(processOnServer, item, htmlElement, htmlEvent) { 11284 this.constructor.prototype.constructor.call(this, processOnServer, item, htmlElement, htmlEvent); 11285 } 11286 }); 11287 ASPx.BootstrapMenuRenderHelper = BootstrapMenuRenderHelper; 11288 dx.BootstrapClientMenu = BootstrapClientMenu; 11289 dx.BootstrapClientMenuItem = BootstrapClientMenuItem; 11290 dx.BootstrapClientMenuItemEventArgs = BootstrapClientMenuItemEventArgs; 11291 dx.BootstrapClientMenuItemMouseEventArgs = BootstrapClientMenuItemMouseEventArgs; 11292 dx.BootstrapClientMenuItemClickEventArgs = BootstrapClientMenuItemClickEventArgs; 11293})(dx || (dx = {})); 11294 11295},1);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.