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 onComplete: complete, 2748 animationEngineType: animationEngineType 2749 }); 2750 }, 2751 getSlideInStartPos: function (animationContainer, direction, rtl) { 2752 var dir = rtl ? -1 : 1; 2753 switch (direction) { 2754 case AnimationHelper.SLIDE_TOP_DIRECTION: 2755 return animationContainer.offsetHeight; 2756 case AnimationHelper.SLIDE_LEFT_DIRECTION: 2757 return animationContainer.offsetWidth * dir; 2758 case AnimationHelper.SLIDE_RIGHT_DIRECTION: 2759 return -animationContainer.offsetWidth * dir; 2760 case AnimationHelper.SLIDE_BOTTOM_DIRECTION: 2761 return -animationContainer.offsetHeight; 2762 } 2763 }, 2764 getSlideOutFinishPos: function (animationContainer, direction, rtl) { 2765 var dir = rtl ? -1 : 1; 2766 switch (direction) { 2767 case AnimationHelper.SLIDE_TOP_DIRECTION: 2768 return -animationContainer.offsetHeight; 2769 case AnimationHelper.SLIDE_LEFT_DIRECTION: 2770 return -animationContainer.offsetWidth * dir; 2771 case AnimationHelper.SLIDE_RIGHT_DIRECTION: 2772 return animationContainer.offsetWidth * dir; 2773 case AnimationHelper.SLIDE_BOTTOM_DIRECTION: 2774 return animationContainer.offsetHeight; 2775 } 2776 } 2777 }; 2778 var GestureHandler = ASPx.CreateClass(null, { 2779 constructor: function (getAnimationElement, canHandle, allowStart) { 2780 this.getAnimationElement = getAnimationElement; 2781 this.canHandle = canHandle; 2782 this.allowStart = allowStart; 2783 this.startMousePosX = 0; 2784 this.startMousePosY = 0; 2785 this.startTime = null; 2786 this.isEventsPrevented = false; 2787 this.savedElements = []; 2788 }, 2789 OnSelectStart: function(evt) { 2790 ASPx.Evt.PreventEvent(evt); 2791 }, 2792 OnDragStart: function(evt) { 2793 ASPx.Evt.PreventEvent(evt); 2794 }, 2795 OnMouseDown: function (evt) { 2796 this.startMousePosX = ASPx.Evt.GetEventX(evt); 2797 this.startMousePosY = ASPx.Evt.GetEventY(evt); 2798 this.startTime = new Date(); 2799 }, 2800 OnMouseMove: function(evt) { 2801 if(!ASPx.Browser.MobileUI) 2802 ASPx.Selection.Clear(); 2803 if(Math.abs(this.GetCurrentDistanceX(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE && Math.abs(this.GetCurrentDistanceY(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE) 2804 GesturesHelper.isExecutedGesture = false; 2805 }, 2806 OnMouseUp: function (evt) { 2807 }, 2808 CanHandleEvent: function (evt) { 2809 return !this.canHandle || this.canHandle(evt); 2810 }, 2811 IsStartAllowed: function(value) { 2812 return !this.allowStart || this.allowStart(value); 2813 }, 2814 RollbackGesture: function () { 2815 }, 2816 GetRubberPosition: function (position) { 2817 return position / GestureHandler.FACTOR_RUBBER; 2818 }, 2819 GetCurrentDistanceX: function (evt) { 2820 return ASPx.Evt.GetEventX(evt) - this.startMousePosX; 2821 }, 2822 GetCurrentDistanceY: function (evt) { 2823 return ASPx.Evt.GetEventY(evt) - this.startMousePosY; 2824 }, 2825 GetDistanceLimit: function () { 2826 return (new Date() - this.startTime) < GestureHandler.MAX_TIME_SPAN ? GestureHandler.MIN_DISTANCE_LIMIT : GestureHandler.MAX_DISTANCE_LIMIT; 2827 }, 2828 GetContainerElement: function () { 2829 }, 2830 AttachPreventEvents: function (evt) { 2831 if(!this.isEventsPrevented) { 2832 var element = ASPx.Evt.GetEventSource(evt); 2833 var container = this.GetContainerElement(); 2834 while(element && element != container) { 2835 ASPx.Evt.AttachEventToElement(element, "mouseup", ASPx.Evt.PreventEvent); 2836 ASPx.Evt.AttachEventToElement(element, "click", ASPx.Evt.PreventEvent); 2837 this.savedElements.push(element); 2838 element = element.parentNode; 2839 } 2840 this.isEventsPrevented = true; 2841 } 2842 }, 2843 DetachPreventEvents: function () { 2844 if(this.isEventsPrevented) { 2845 window.setTimeout(function () { 2846 while(this.savedElements.length > 0) { 2847 var element = this.savedElements.pop(); 2848 ASPx.Evt.DetachEventFromElement(element, "mouseup", ASPx.Evt.PreventEvent); 2849 ASPx.Evt.DetachEventFromElement(element, "click", ASPx.Evt.PreventEvent); 2850 } 2851 }.aspxBind(this), 0); 2852 this.isEventsPrevented = false; 2853 } 2854 } 2855 }); 2856 GestureHandler.MAX_DISTANCE_LIMIT = 70; 2857 GestureHandler.MIN_DISTANCE_LIMIT = 10; 2858 GestureHandler.MIN_START_DISTANCE = 0; 2859 GestureHandler.SLIDER_MIN_START_DISTANCE = 5; 2860 GestureHandler.MAX_TIME_SPAN = 300; 2861 GestureHandler.FACTOR_RUBBER = 4; 2862 GestureHandler.RETURN_ANIMATION_DURATION = 150; 2863 var SwipeSlideGestureHandler = ASPx.CreateClass(GestureHandler, { 2864 constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, move) { 2865 this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle); 2866 this.slideElement = this.getAnimationElement(); 2867 this.container = this.slideElement.parentNode; 2868 this.direction = direction; 2869 this.backward = backward; 2870 this.forward = forward; 2871 this.rollback = rollback; 2872 this.slideElementSize = 0; 2873 this.containerElementSize = 0; 2874 this.startSliderElementPosition = 0; 2875 this.centeredSlideElementPosition = 0; 2876 }, 2877 OnMouseDown: function (evt) { 2878 GestureHandler.prototype.OnMouseDown.call(this, evt); 2879 this.slideElementSize = this.GetElementSize(); 2880 this.startSliderElementPosition = this.GetElementPosition(); 2881 this.containerElementSize = this.GetContainerElementSize(); 2882 if(this.slideElementSize <= this.containerElementSize) 2883 this.centeredSlideElementPosition = (this.containerElementSize - this.slideElementSize) / 2; 2884 }, 2885 OnMouseMove: function (evt) { 2886 GestureHandler.prototype.OnMouseMove.call(this, evt); 2887 if(!ASPx.Browser.TouchUI && !ASPx.GetIsParent(this.container, ASPx.Evt.GetEventSource(evt))) { 2888 GesturesHelper.OnDocumentMouseUp(evt); 2889 return; 2890 } 2891 var distance = this.GetCurrentDistance(evt); 2892 if(Math.abs(distance) < GestureHandler.SLIDER_MIN_START_DISTANCE || ASPx.TouchUIHelper.isGesture) 2893 return; 2894 this.SetElementPosition(this.GetCalculatedPosition(distance)); 2895 this.AttachPreventEvents(evt); 2896 ASPx.Evt.PreventEvent(evt); 2897 }, 2898 GetCalculatedPosition: function (distance) { 2899 ASPx.AnimationTransitionBase.Cancel(this.slideElement); 2900 var position = this.startSliderElementPosition + distance, 2901 maxPosition = -(this.slideElementSize - this.containerElementSize), 2902 minPosition = 0; 2903 if(this.centeredSlideElementPosition > 0) 2904 position = this.GetRubberPosition(distance) + this.centeredSlideElementPosition; 2905 else if(position > minPosition) 2906 position = this.GetRubberPosition(distance); 2907 else if(position < maxPosition) 2908 position = this.GetRubberPosition(distance) + maxPosition; 2909 return position; 2910 }, 2911 OnMouseUp: function (evt) { 2912 this.DetachPreventEvents(); 2913 if(this.GetCurrentDistance(evt) != 0) 2914 this.OnMouseUpCore(evt); 2915 }, 2916 OnMouseUpCore: function (evt) { 2917 var distance = this.GetCurrentDistance(evt); 2918 if(this.centeredSlideElementPosition > 0 || this.CheckSlidePanelIsOutOfBounds()) 2919 this.PerformRollback(); 2920 else 2921 this.PerformAction(distance); 2922 }, 2923 PerformAction: function (distance) { 2924 if(Math.abs(distance) < this.GetDistanceLimit()) 2925 this.PerformRollback(); 2926 else if(distance < 0) 2927 this.PerformForward(); 2928 else 2929 this.PerformBackward(); 2930 }, 2931 PerformBackward: function () { 2932 this.backward(); 2933 }, 2934 PerformForward: function () { 2935 this.forward(); 2936 }, 2937 PerformRollback: function () { 2938 this.rollback(); 2939 }, 2940 CheckSlidePanelIsOutOfBounds: function () { 2941 var minOffset = -(this.slideElementSize - this.containerElementSize), maxOffset = 0; 2942 var slideElementPos = this.GetElementPosition(); 2943 if(slideElementPos > maxOffset || slideElementPos < minOffset) 2944 return true; 2945 return false; 2946 }, 2947 GetContainerElement: function () { 2948 return this.container; 2949 }, 2950 GetElementSize: function () { 2951 return this.IsHorizontalDirection() ? this.slideElement.offsetWidth : this.slideElement.offsetHeight; 2952 }, 2953 GetContainerElementSize: function () { 2954 return this.IsHorizontalDirection() ? ASPx.GetClearClientWidth(this.container) : ASPx.GetClearClientHeight(this.container); 2955 }, 2956 GetCurrentDistance: function (evt) { 2957 return this.IsHorizontalDirection() ? this.GetCurrentDistanceX(evt) : this.GetCurrentDistanceY(evt); 2958 }, 2959 GetElementPosition: function () { 2960 return ASPx.AnimationUtils.GetTransformValue(this.slideElement, !this.IsHorizontalDirection()); 2961 }, 2962 SetElementPosition: function (position) { 2963 ASPx.AnimationUtils.SetTransformValue(this.slideElement, position, !this.IsHorizontalDirection()); 2964 }, 2965 IsHorizontalDirection: function () { 2966 return this.direction == AnimationHelper.SLIDE_HORIZONTAL_DIRECTION; 2967 } 2968 }); 2969 var SwipeSimpleSlideGestureHandler = ASPx.CreateClass(SwipeSlideGestureHandler, { 2970 constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) { 2971 this.constructor.prototype.constructor.call(this, getAnimationElement, direction, canHandle, backward, forward, rollback); 2972 this.container = this.slideElement; 2973 this.updatePosition = updatePosition; 2974 this.prevDistance = 0; 2975 }, 2976 OnMouseDown: function (evt) { 2977 GestureHandler.prototype.OnMouseDown.call(this, evt); 2978 this.prevDistance = 0; 2979 }, 2980 OnMouseUpCore: function (evt) { 2981 this.PerformAction(this.GetCurrentDistance(evt)); 2982 }, 2983 PerformAction: function (distance) { 2984 if(Math.abs(distance) < this.GetDistanceLimit()) 2985 this.PerformRollback(); 2986 else if(distance < 0) 2987 this.PerformForward(); 2988 else 2989 this.PerformBackward(); 2990 }, 2991 GetCalculatedPosition: function (distance) { 2992 var position = distance - this.prevDistance; 2993 this.prevDistance = distance; 2994 return position; 2995 }, 2996 SetElementPosition: function (position) { 2997 this.updatePosition(position); 2998 } 2999 }); 3000 var SwipeGestureHandler = ASPx.CreateClass(GestureHandler, { 3001 constructor: function (getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) { 3002 this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle, allowStart); 3003 this.start = start; 3004 this.allowComplete = allowComplete; 3005 this.complete = complete; 3006 this.cancel = cancel; 3007 this.animationTween = null; 3008 this.currentDistanceX = 0; 3009 this.currentDistanceY = 0; 3010 this.tryStartGesture = false; 3011 this.tryStartScrolling = false; 3012 this.animationEngineType = animationEngineType; 3013 this.rtl = rtl; 3014 this.UpdateAnimationContainer(); 3015 }, 3016 UpdateAnimationContainer: function () { 3017 this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, false); 3018 }, 3019 CanHandleEvent: function (evt) { 3020 if(GestureHandler.prototype.CanHandleEvent.call(this, evt)) 3021 return true; 3022 return this.animationTween && this.animationContainer && ASPx.GetIsParent(this.animationContainer, ASPx.Evt.GetEventSource(evt)); 3023 }, 3024 OnMouseDown: function (evt) { 3025 GestureHandler.prototype.OnMouseDown.call(this, evt); 3026 if(this.animationTween) 3027 this.animationTween.Cancel(); 3028 this.currentDistanceX = 0; 3029 this.currentDistanceY = 0; 3030 this.tryStartGesture = false; 3031 this.tryStartScrolling = false; 3032 }, 3033 OnMouseMove: function (evt) { 3034 GestureHandler.prototype.OnMouseMove.call(this, evt);
3035 var isZoomGestureConflict = evt.touches && evt.touches.length > 1; 3036 if (isZoomGestureConflict) 3037 return false; 3038 this.currentDistanceX = this.GetCurrentDistanceX(evt); 3039 this.currentDistanceY = this.GetCurrentDistanceY(evt); 3040 if(this.rtl) 3041 this.currentDistanceX = -this.currentDistanceX; 3042 if(!this.animationTween && !this.tryStartScrolling && (Math.abs(this.currentDistanceX) > 3043 GestureHandler.MIN_START_DISTANCE || Math.abs(this.currentDistanceY) > GestureHandler.MIN_START_DISTANCE)) { 3044 if(Math.abs(this.currentDistanceY) < Math.abs(this.currentDistanceX)) { 3045 this.tryStartGesture = true; 3046 if(this.IsStartAllowed(this.currentDistanceX)) { 3047 this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, true); 3048 this.animationTween = AnimationHelper.createSlideTransition(this.animationContainer, AnimationHelper.SLIDE_LEFT_DIRECTION, 3049 function () { 3050 AnimationHelper.resetSlideAnimationContainerSize(this.animationContainer); 3051 this.animationContainer = null; 3052 this.animationTween = null; 3053 }.aspxBind(this), this.animationEngineType, this.rtl); 3054 this.PerformStart(this.currentDistanceX); 3055 this.AttachPreventEvents(evt); 3056 } 3057 } 3058 else 3059 this.tryStartScrolling = true; 3060 } 3061 if(this.animationTween) { 3062 if(this.allowComplete && !this.allowComplete(this.currentDistanceX)) 3063 this.currentDistanceX = this.GetRubberPosition(this.currentDistanceX); 3064 this.animationTween.SetValue(this.currentDistanceX); 3065 } 3066 if(!this.tryStartScrolling && !ASPx.TouchUIHelper.isGesture && evt.touches && evt.touches.length < 2) 3067 ASPx.Evt.PreventEvent(evt); 3068 }, 3069 OnMouseUp: function (evt) { 3070 if(!this.animationTween) { 3071 if(this.tryStartGesture) 3072 this.PerformCancel(this.currentDistanceX); 3073 } 3074 else { 3075 if(Math.abs(this.currentDistanceX) < this.GetDistanceLimit()) 3076 this.RollbackGesture(); 3077 else { 3078 if(this.IsCompleteAllowed(this.currentDistanceX)) { 3079 this.PerformComplete(this.currentDistanceX); 3080 this.animationContainer = null; 3081 this.animationTween = null; 3082 } 3083 else 3084 this.RollbackGesture(); 3085 } 3086 } 3087 this.DetachPreventEvents(); 3088 this.tryStartGesture = false; 3089 this.tryStartScrolling = false; 3090 }, 3091 PerformStart: function (value) { 3092 if(this.start) 3093 this.start(value); 3094 }, 3095 IsCompleteAllowed: function (value) { 3096 return !this.allowComplete || this.allowComplete(value); 3097 }, 3098 PerformComplete: function (value) { 3099 if(this.complete) 3100 this.complete(value); 3101 }, 3102 PerformCancel: function (value) { 3103 if(this.cancel) 3104 this.cancel(value); 3105 }, 3106 RollbackGesture: function () { 3107 this.animationTween.Start(this.currentDistanceX, 0); 3108 }, 3109 ResetGestureElementPosition: function () { 3110 if (this.currentDistanceX === 0) return; 3111 var container = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement()); 3112 var onComplete = function () { AnimationHelper.resetSlideAnimationContainerSize(container); }; 3113 var animation = AnimationHelper.createSlideTransition(container, AnimationHelper.SLIDE_LEFT_DIRECTION, onComplete, this.animationEngineType, this.rtl); 3114 animation.Start(this.currentDistanceX, 0); 3115 }, 3116 GetContainerElement: function () { 3117 return this.animationContainer; 3118 } 3119 }); 3120 var GesturesHelper = { 3121 handlers: {}, 3122 activeHandler: null, 3123 isAttachedEvents: false, 3124 isExecutedGesture: false, 3125 AddSwipeGestureHandler: function (id, getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) { 3126 this.handlers[id] = new SwipeGestureHandler(getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl); 3127 }, 3128 UpdateSwipeAnimationContainer: function (id) { 3129 if(this.handlers[id]) 3130 this.handlers[id].UpdateAnimationContainer(); 3131 }, 3132 AddSwipeSlideGestureHandler: function (id, getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) { 3133 if(updatePosition) 3134 this.handlers[id] = new SwipeSimpleSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition); 3135 else 3136 this.handlers[id] = new SwipeSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback); 3137 }, 3138 getParentDXEditorWithSwipeGestures: function(element) { 3139 return ASPx.GetParent(element, function(parent) {
3140 var parentObj = ASPx.GetControlCollection().Get(parent.id); 3141 return parentObj && parentObj.supportGestures && parentObj.isSwipeGesturesEnabled(); 3142 }); 3143 }, 3144 canHandleMouseDown: function(evt) { 3145 if(!ASPx.Evt.IsLeftButtonPressed(evt)) 3146 return false; 3147 var element = ASPx.Evt.GetEventSource(evt); 3148 var dxFocusedEditor = ASPx.Ident.scripts.ASPxClientEdit && ASPx.GetFocusedEditor(); 3149 if(dxFocusedEditor && dxFocusedEditor.IsEditorElement(element)) { 3150 var elementParentDXEditorWithSwipeGestures = GesturesHelper.getParentDXEditorWithSwipeGestures(element); 3151 if(!elementParentDXEditorWithSwipeGestures || !dxFocusedEditor.IsEditorElement(elementParentDXEditorWithSwipeGestures)) 3152 return false; 3153 } 3154 var isTextEditor = element.tagName == "TEXTAREA" || element.tagName == "INPUT" && ASPx.Attr.GetAttribute(element, "type") == "text"; 3155 if(isTextEditor && document.activeElement == element) 3156 return false; 3157 return true; 3158 }, 3159 OnDocumentDragStart: function(evt) { 3160 if(GesturesHelper.activeHandler) 3161 GesturesHelper.activeHandler.OnDragStart(evt); 3162 }, 3163 OnDocumentMouseDown: function (evt) { 3164 if(!GesturesHelper.canHandleMouseDown(evt)) 3165 return; 3166 GesturesHelper.activeHandler = GesturesHelper.FindHandler(evt); 3167 if(GesturesHelper.activeHandler) 3168 GesturesHelper.activeHandler.OnMouseDown(evt); 3169 }, 3170 OnDocumentMouseMove: function (evt) { 3171 if(GesturesHelper.activeHandler) { 3172 GesturesHelper.isExecutedGesture = true; 3173 GesturesHelper.activeHandler.OnMouseMove(evt); 3174 } 3175 }, 3176 OnDocumentMouseUp: function (evt) { 3177 if(GesturesHelper.activeHandler) { 3178 GesturesHelper.activeHandler.OnMouseUp(evt); 3179 GesturesHelper.activeHandler = null; 3180 window.setTimeout(function () { GesturesHelper.isExecutedGesture = false; }, 0); 3181 } 3182 }, 3183 AttachEvents: function () { 3184 if(!GesturesHelper.isAttachedEvents) { 3185 GesturesHelper.Attach(ASPx.Evt.AttachEventToElement); 3186 GesturesHelper.isAttachedEvents = true; 3187 } 3188 }, 3189 DetachEvents: function () { 3190 if(GesturesHelper.isAttachedEvents) { 3191 GesturesHelper.Attach(ASPx.Evt.DetachEventFromElement); 3192 GesturesHelper.isAttachedEvents = false; 3193 } 3194 }, 3195 Attach: function (changeEventsMethod) { 3196 var doc = window.document; 3197 changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseDownEventName, GesturesHelper.OnDocumentMouseDown); 3198 changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseMoveEventName, GesturesHelper.OnDocumentMouseMove); 3199 changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseUpEventName, GesturesHelper.OnDocumentMouseUp); 3200 if(!ASPx.Browser.MobileUI) { 3201 changeEventsMethod(doc, "dragstart", GesturesHelper.OnDocumentDragStart); 3202 } 3203 }, 3204 FindHandler: function (evt) { 3205 var handlers = []; 3206 for(var id in GesturesHelper.handlers) { 3207 if(GesturesHelper.handlers.hasOwnProperty(id)) { 3208 var handler = GesturesHelper.handlers[id]; 3209 if(handler.CanHandleEvent && handler.CanHandleEvent(evt)) 3210 handlers.push(handler); 3211 } 3212 } 3213 if(!handlers.length) 3214 return null; 3215 handlers.sort(function (a, b) { 3216 return ASPx.GetIsParent(a.getAnimationElement(), b.getAnimationElement()) ? 1 : -1; 3217 }); 3218 return handlers[0]; 3219 }, 3220 IsExecutedGesture: function () { 3221 return GesturesHelper.isExecutedGesture; 3222 } 3223 }; 3224 GesturesHelper.AttachEvents(); 3225 var AnimationEngineType = { 3226 "DEFAULT": 0, 3227 "CSS": 1, 3228 "JS": 2 3229 }; 3230 ASPx.AnimationEngineType = AnimationEngineType; 3231 ASPx.AnimationHelper = AnimationHelper; 3232 ASPx.GesturesHelper = GesturesHelper; 3233})(); 3234 3235(function() { 3236var ASPxClientButton = ASPx.CreateClass(ASPxClientControl, { 3237 constructor: function(name) { 3238 this.constructor.prototype.constructor.call(this, name); 3239 this.isASPxClientButton = true; 3240 this.allowFocus = true; 3241 this.autoPostBackFunction = null; 3242 this.causesValidation = true; 3243 this.checked = false; 3244 this.clickLocked = false; 3245 this.groupName = ""; 3246 this.focusElementSelected = false; 3247 this.pressed = false; 3248 this.useSubmitBehavior = true; 3249 this.validationGroup = ""; 3250 this.validationContainerID = null; 3251 this.validateInvisibleEditors = false; 3252 this.originalWidth = null; 3253 this.originalHeight = null; 3254 this.needUpdateBounds = true; 3255 this.isTextEmpty = false; 3256 this.isImage = false; 3257 this.CheckedChanged = new ASPxClientEvent(); 3258 this.GotFocus = new ASPxClientEvent(); 3259 this.LostFocus = new ASPxClientEvent(); 3260 this.Click = new ASPxClientEvent(); 3261 }, 3262 InlineInitialize: function() { 3263 var mainElement = this.GetMainElement(); 3264 this.originalWidth = mainElement.style.width; 3265 this.originalHeight = mainElement.style.height; 3266 ASPxClientControl.prototype.InlineInitialize.call(this); 3267 this.InitializeElementIDs(); 3268 this.InitializeEvents(); 3269 this.InitializeEnabled(); 3270 this.InitializeChecked(); 3271 if(this.IsLink()) 3272 this.InitializeLink(); 3273 this.PreventButtonImageDragging(); 3274 this.EnsureBoundsAdjusted(); 3275 }, 3276 InitializeElementIDs: function(){ 3277 var mainElement = this.GetMainElement(); 3278 var contentElement = ASPx.GetNodeByTagName(mainElement, "DIV", 0); 3279 if(contentElement) contentElement.id = this.name + "_CD"; 3280 var imageElement = ASPx.GetNodeByTagName(mainElement, "IMG", 0); 3281 if(imageElement) imageElement.id = this.name + "Img"; 3282 }, 3283 InitializeEnabled: function(){ 3284 this.SetEnabledInternal(this.clientEnabled, true); 3285 }, 3286 InitializeChecked: function(){ 3287 this.SetCheckedInternal(this.checked, true); 3288 }, 3289 InitializeLink: function(){ 3290 var mainElement = this.GetMainElement(); 3291 if(this.enabled) 3292 mainElement.href = "javascript:;"; 3293 if(!this.allowFocus) 3294 mainElement.style.outline = 0; 3295 if(!this.isImage && !this.GetTextContainer()) 3296 mainElement.style.fontSize = "0pt"; 3297 }, 3298 InitializeEvents: function(){ 3299 if(!this.isNative && !this.IsLink()) { 3300 var element = this.GetInternalButton(); 3301 if(element) 3302 element.onfocus = null; 3303 var textControl = this.GetTextControl(); 3304 if(textControl) 3305 ASPx.Evt.PreventElementDragAndSelect(textControl, false); 3306 } 3307 this.onClick = function(evt) { 3308 var processOnServer = ASPx.BClick(this.name, evt); 3309 if(!processOnServer) 3310 ASPx.Evt.PreventEvent(evt); 3311 return processOnServer; 3312 }.aspxBind(this); 3313 this.onImageMoseDown = function() { var el = ASPx.GetFocusedElement(); if(el) el.blur(); }; 3314 this.onGotFocus = function() { this.OnFocus(); }.aspxBind(this); 3315 this.onLostFocus = function() { this.OnLostFocus(); }.aspxBind(this); 3316 this.onKeyUp = function(evt) { this.OnKeyUp(evt); }.aspxBind(this); 3317 this.onKeyDown = function(evt) { this.OnKeyDown(evt); }.aspxBind(this); 3318 if(!this.isNative && !this.IsLink()) 3319 this.InitializeNativeHandlers(); 3320 }, 3321 InitializeNativeHandlers: function() { 3322 this.AttachNativeHandlerToMainElement("focus", "SetFocus"); 3323 this.AttachNativeHandlerToMainElement("click", "DoClick"); 3324 }, 3325 EnsureBoundsAdjusted: function() { 3326 var mainElement = this.GetMainElement(); 3327 this.needUpdateBounds = ASPx.GetCurrentStyle(mainElement).display === "block"; 3328 if(this.needUpdateBounds) 3329 mainElement.className = mainElement.className.replace("dxbTSys", ""); 3330 }, 3331 AdjustControlCore: function () { 3332 if(this.isNative || this.IsLink()) return; 3333 var buttonImage = this.GetButtonImage(); 3334 if(buttonImage && buttonImage.offsetHeight === 0 && buttonImage.offsetWidth === 0) 3335 buttonImage.onload = function() { this.UpdateSize(); }.aspxBind(this); 3336 else 3337 this.UpdateSize(); 3338 this.UpdateVerticalAlign(); 3339 }, 3340 UpdateSize: function() { 3341 if(this.needUpdateBounds) { 3342 this.UpdateWidth(); 3343 this.UpdateHeight(); 3344 } else 3345 this.CorrectWrappedText(this.GetContentDiv, "Text", true); 3346 }, 3347 UpdateVerticalAlign: function() { 3348 var contentElement = this.GetContentDiv(); 3349 var verticalAlign = this.GetMainElement().style.verticalAlign; 3350 if(ASPx.IsExistsElement(contentElement) && verticalAlign) 3351 contentElement.style.verticalAlign = verticalAlign; 3352 }, 3353 UpdateHeight: function(){ 3354 if(this.isNative || this.IsLink() || this.originalHeight === null || ASPx.IsPercentageSize(this.originalHeight)) return; 3355 var height; 3356 var mainElement = this.GetMainElement(); 3357 var contentDiv = this.GetContentDiv(); 3358 var borderAndPadding = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement); 3359 var contentHasExcessiveHeight = contentDiv.offsetHeight > mainElement.offsetHeight - borderAndPadding;
3360 var needSetAutoHeight = !this.originalHeight || (ASPx.Browser.Safari && contentHasExcessiveHeight); 3361 if(needSetAutoHeight) { 3362 mainElement.style.height = ""; 3363 height = mainElement.offsetHeight - borderAndPadding; 3364 } 3365 else 3366 height = (ASPx.PxToInt(this.originalHeight) - borderAndPadding); 3367 if(height){ 3368 mainElement.style.height = height + "px"; 3369 if(contentDiv && contentDiv.offsetHeight > 0){ 3370 var contentDivCurrentStyle = ASPx.GetCurrentStyle(contentDiv); 3371 var paddingTop = parseInt(contentDivCurrentStyle.paddingTop) || 0; 3372 var paddingBottom = parseInt(contentDivCurrentStyle.paddingBottom) || 0; 3373 var clientHeightDiff = height - contentDiv.offsetHeight; 3374 var verticalAlign = ASPx.GetCurrentStyle(mainElement).verticalAlign; 3375 if(verticalAlign == "top") 3376 paddingBottom = paddingBottom + clientHeightDiff; 3377 else if(verticalAlign == "bottom") 3378 paddingTop = paddingTop + clientHeightDiff; 3379 else { 3380 var halfClientHeightDiff = Math.floor(clientHeightDiff / 2); 3381 paddingTop = paddingTop + halfClientHeightDiff; 3382 paddingBottom = paddingBottom + (clientHeightDiff - halfClientHeightDiff); 3383 } 3384 contentDiv.style.paddingTop = (paddingTop > 0 ? paddingTop : 0) + "px"; 3385 contentDiv.style.paddingBottom = (paddingBottom > 0 ? paddingBottom : 0) + "px"; 3386 } 3387 } 3388 }, 3389 UpdateWidth: function(){ 3390 if(this.isNative || this.IsLink() || this.originalWidth === null) return; 3391 if(!ASPx.IsPercentageSize(this.originalWidth)) { 3392 var mainElement = this.GetMainElement(); 3393 var borderAndPadding = ASPx.GetLeftRightBordersAndPaddingsSummaryValue(mainElement); 3394 if(this.originalWidth && ASPx.IsTextWrapped(this.GetTextContainer())) 3395 mainElement.style.width = (ASPx.PxToInt(this.originalWidth) - borderAndPadding) + "px"; 3396 else 3397 mainElement.style.width = "auto"; 3398 var width = mainElement.offsetWidth - borderAndPadding; 3399 if(this.originalWidth && width < ASPx.PxToInt(this.originalWidth) - borderAndPadding) 3400 width = ASPx.PxToInt(this.originalWidth) - borderAndPadding; 3401 if(width) 3402 mainElement.style.width = (width > 0 ? width : 0) + "px"; 3403 } 3404 this.CorrectWrappedText(this.GetContentDiv, "Text", true); 3405 }, 3406 GetAdjustedSizes: function() { 3407 var sizes = ASPxClientControl.prototype.GetAdjustedSizes.call(this); 3408 var image = this.GetButtonImage(); 3409 if(image) { 3410 sizes.imageWidth = image.offsetWidth; 3411 sizes.imageHeight = image.offsetHeight; 3412 } 3413 return sizes; 3414 }, 3415 PreventButtonImageDragging: function() { 3416 ASPx.Evt.PreventImageDragging(this.GetButtonImage()); 3417 }, 3418 AttachNativeHandlerToMainElement: function(handlerName, correspondingMethodName) { 3419 var mainElement = this.GetMainElement(); 3420 if(!ASPx.IsExistsElement(mainElement)) 3421 return; 3422 mainElement[handlerName] = function() { _aspxBCallButtonMethod(this.name, correspondingMethodName); }.aspxBind(this); 3423 }, 3424 GetContentDiv: function(){ 3425 return this.GetChildElement("CD"); 3426 }, 3427 GetButtonImage: function(){ 3428 return ASPx.CacheHelper.GetCachedElement(this, "buttonImage", 3429 function() { 3430 return ASPx.GetNodeByTagName(this.GetMainElement(), "IMG", 0); 3431 }); 3432 }, 3433 GetInternalButton: function() { 3434 return ASPx.CacheHelper.GetCachedElement(this, "internalButton", 3435 function() { 3436 return this.isNative || this.IsLink() ? this.GetMainElement() : ASPx.GetNodeByTagName(this.GetMainElement(), "INPUT", 0); 3437 }); 3438 }, 3439 GetTextContainer: function() { 3440 return ASPx.CacheHelper.GetCachedElement(this, "textContainer", 3441 function() { 3442 if(this.isNative) 3443 return this.GetMainElement(); 3444 else{ 3445 var textElement = this.IsLink() ? this.GetMainElement() : this.GetContentDiv(); 3446 return this.accessibilityCompliant ? ASPx.GetElementById(this.name + "_BTC") : ASPx.GetNodeByTagName(textElement, "SPAN", 0); 3447 } 3448 }); 3449 }, 3450 GetTextControl: function(){ 3451 return ASPx.CacheHelper.GetCachedElement(this, "textControl", 3452 function() { 3453 var element = ASPx.GetParentByTagName(this.GetContentDiv(), "DIV");
3454 if(!ASPx.IsExistsElement(element) || (element.id == this.name)) 3455 element = this.GetContentDiv(); 3456 return element; 3457 }); 3458 }, 3459 IsLink: function(){ 3460 if (this.GetMainElement()) 3461 return this.GetMainElement().tagName === "A"; 3462 return false; 3463 }, 3464 IsHovered: function(){ 3465 var hoverElement = this.GetMainElement(); 3466 return ASPx.GetStateController().currentHoverItemName == hoverElement.id; 3467 }, 3468 SetEnabledInternal: function(enabled, initialization) { 3469 if(!this.enabled) 3470 return; 3471 if(!initialization || !enabled) 3472 this.ChangeEnabledStateItems(enabled); 3473 this.ChangeEnabledAttributes(enabled); 3474 }, 3475 ChangeEnabledAttributes: function(enabled) { 3476 var element = this.GetInternalButton(); 3477 if(element) { 3478 if(this.IsLink()){ 3479 var method = ASPx.Attr.ChangeAttributesMethod(enabled); 3480 var link = this.GetMainElement(); 3481 method(link, "href"); 3482 if(this.accessibilityCompliant) 3483 ASPx.Attr.SetOrRemoveAttribute(link, ASPx.Attr.GetTabIndexAttributeName(), enabled ? null : "0"); 3484 } else { 3485 if(this.accessibilityCompliant) 3486 ASPx.Attr.Aria.SetOrRemoveDisabled(element, !enabled); 3487 else 3488 element.disabled = !enabled; 3489 } 3490 } 3491 this.ChangeEnabledEventsAttributes(ASPx.Attr.ChangeEventsMethod(enabled)); 3492 var isFocusable = enabled || this.accessibilityCompliant; 3493 this.ChangeEnabledFocusEvents(ASPx.Attr.ChangeEventsMethod(isFocusable)); 3494 }, 3495 ChangeEnabledEventsAttributes: function(method) { 3496 var element = this.GetMainElement(); 3497 method(element, "click", this.onClick); 3498 if(this.allowFocus){ 3499 if(!this.isNative && !this.IsLink()) { 3500 element = this.GetInternalButton(); 3501 if(element) { 3502 method(element, "keyup", this.onKeyUp); 3503 method(element, "blur", this.onKeyUp); 3504 method(element, "keydown", this.onKeyDown); 3505 } 3506 } 3507 if(ASPx.Browser.Firefox){ 3508 var image = this.GetButtonImage(); 3509 if(image) 3510 method(image, "mousedown", this.onImageMoseDown); 3511 } 3512 } 3513 }, 3514 ChangeEnabledFocusEvents: function(method) { 3515 if(!this.allowFocus) 3516 return; 3517 var element = !this.isNative && !this.IsLink() ? this.GetInternalButton() : this.GetMainElement(); 3518 if(element) { 3519 method(element, "focus", this.onGotFocus); 3520 method(element, "blur", this.onLostFocus); 3521 } 3522 }, 3523 ChangeEnabledStateItems: function(enabled){ 3524 if(this.isNative) return; 3525 ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled); 3526 this.UpdateFocusedStyle(); 3527 }, 3528 RequiredPreventDoublePostback: function(){ 3529 return ASPx.Browser.Firefox && !this.isNative; 3530 }, 3531 OnFocus: function() { 3532 if(!this.allowFocus) 3533 return false; 3534 this.focused = true; 3535 if(this.isInitialized) 3536 this.RaiseFocus(); 3537 this.UpdateFocusedStyle(); 3538 }, 3539 OnLostFocus: function() { 3540 if(!this.allowFocus) 3541 return false; 3542 this.focused = false; 3543 if(this.isInitialized) 3544 this.RaiseLostFocus(); 3545 this.UpdateFocusedStyle(); 3546 }, 3547 CauseValidation: function() { 3548 if(this.causesValidation && ASPx.Ident.scripts.ASPxClientEdit) 3549 return this.validationContainerID != null ? 3550 ASPxClientEdit.ValidateEditorsInContainerById(this.validationContainerID, this.validationGroup, this.validateInvisibleEditors) : 3551 ASPxClientEdit.ValidateGroup(this.validationGroup, this.validateInvisibleEditors); 3552 else 3553 return true; 3554 }, 3555 OnClick: function(evt) { 3556 if(this.clickLocked) return true; 3557 if(this.checked && this.groupName != "" && this.GetCheckedGroupList().length > 1) return; 3558 this.SetFocus(); 3559 var isValid = this.CauseValidation(); 3560 var processOnServer = this.autoPostBack; 3561 if(this.groupName != "") { 3562 if(this.GetCheckedGroupList().length == 1) 3563 this.SetCheckedInternal(!this.checked, false); 3564 else { 3565 this.SetCheckedInternal(true, false); 3566 this.ClearButtonGroupChecked(true); 3567 } 3568 processOnServer = this.RaiseCheckedChanged(); 3569 if(processOnServer && isValid) 3570 this.SendPostBack("CheckedChanged"); 3571 } 3572 var params = this.RaiseClick(); 3573 if(evt && params.cancelEventAndBubble) 3574 ASPx.Evt.PreventEventAndBubble(evt); 3575 if(params.processOnServer && isValid) 3576 return this.ProcessClick(); 3577 return false; 3578 }, 3579 ProcessClick: function() { 3580 var requiredPreventDoublePostback = this.RequiredPreventDoublePostback(); 3581 var postponePostback = ASPx.Browser.AndroidMobilePlatform; 3582 if(requiredPreventDoublePostback || postponePostback) 3583 window.setTimeout(function() { _aspxBCallButtonMethod(this.name, "SendPostBack", "Click"); }.aspxBind(this), 0); 3584 else 3585 this.SendPostBack("Click"); 3586 return !requiredPreventDoublePostback; 3587 }, 3588 OnKeyUp: function(evt) { 3589 if(!this.pressed) 3590 return; 3591 this.pressed = false; 3592 ASPx.GetStateController().OnKeyUpOnElement(evt); 3593 }, 3594 OnKeyDown: function(evt) { 3595 if(evt.keyCode == ASPx.Key.Enter || evt.keyCode == ASPx.Key.Space) 3596 this.SetPressed(); 3597 }, 3598 GetCheckedGroupList: function(){ 3599 var result = [ ]; 3600 ASPx.GetControlCollection().ForEachControl(function(control) { 3601 if(ASPx.Ident.IsASPxClientButton(control) && (control.groupName == this.groupName) && !control.IsDOMDisposed()) 3602 result.push(control); 3603 }, this); 3604 return result; 3605 }, 3606 ClearButtonGroupChecked: function(raiseCheckedChanged){ 3607 var list = this.GetCheckedGroupList(); 3608 for(var i = 0; i < list.length; i ++){ 3609 if(list[i] != this && list[i].checked) { 3610 list[i].SetCheckedInternal(false, false); 3611 if(raiseCheckedChanged) 3612 list[i].RaiseCheckedChanged(); 3613 } 3614 } 3615 }, 3616 ApplyCheckedStyle: function(){ 3617 var stateController = ASPx.GetStateController(); 3618 if(this.IsHovered()) 3619 stateController.SetCurrentHoverElement(null); 3620 stateController.SelectElementBySrcElement(this.GetMainElement()); 3621 }, 3622 ApplyUncheckedStyle: function(){ 3623 var stateController = ASPx.GetStateController(); 3624 if(this.IsHovered()) 3625 stateController.SetCurrentHoverElement(null); 3626 stateController.DeselectElementBySrcElement(this.GetMainElement()); 3627 }, 3628 SetCheckedInternal: function(checked, initialization){ 3629 if(initialization && checked || (this.checked != checked)){ 3630 this.checked = checked; 3631 if(checked)
3632 this.ApplyCheckedStyle(); 3633 else 3634 this.ApplyUncheckedStyle(); 3635 } 3636 }, 3637 UpdateStateObject: function(){ 3638 if(this.groupName != "") 3639 this.UpdateStateObjectWithObject({ checked: this.checked }); 3640 }, 3641 GetStateHiddenFieldName: function() { 3642 return this.uniqueID + "$State"; 3643 }, 3644 ApplyPressedStyle: function(){ 3645 ASPx.GetStateController().OnMouseDownOnElement(this.GetMainElement()); 3646 }, 3647 ApplyUnpressedStyle: function(){ 3648 ASPx.GetStateController().OnMouseUpOnElement(this.GetMainElement()); 3649 }, 3650 SetPressed: function(){ 3651 this.pressed = true; 3652 this.ApplyPressedStyle(); 3653 }, 3654 SetUnpressed: function(){ 3655 this.pressed = false; 3656 this.ApplyUnpressedStyle(); 3657 }, 3658 SetFocus: function(){ 3659 if(!this.allowFocus || this.focused) 3660 return; 3661 var element = this.GetInternalButton(); 3662 if(element) { 3663 var hiddenInternalButtonRequiresVisibilityToGetFocused = ASPx.Browser.WebKitFamily && !this.isNative && !this.IsLink(); 3664 if(hiddenInternalButtonRequiresVisibilityToGetFocused) 3665 ASPxClientButton.MakeHiddenElementFocusable(element); 3666 if(ASPx.IsFocusable(element) && ASPx.GetActiveElement() != element) 3667 element.focus(); 3668 if(hiddenInternalButtonRequiresVisibilityToGetFocused) 3669 ASPxClientButton.RestoreHiddenElementAppearance(element); 3670 } 3671 }, 3672 ApplyFocusedStyle: function(){ 3673 if(this.focusElementSelected) return; 3674 if(typeof(ASPx.GetStateController) != "undefined") 3675 ASPx.GetStateController().SelectElementBySrcElement(this.GetContentDiv()); 3676 this.focusElementSelected = true; 3677 }, 3678 ApplyUnfocusedStyle: function(){ 3679 if(!this.focusElementSelected) return; 3680 if(typeof(ASPx.GetStateController) != "undefined") 3681 ASPx.GetStateController().DeselectElementBySrcElement(this.GetContentDiv()); 3682 this.focusElementSelected = false; 3683 }, 3684 UpdateFocusedStyle: function(){ 3685 if(this.isNative || this.IsLink()) return; 3686 var isFocusable = this.enabled && this.allowFocus && this.focused && (this.clientEnabled || this.accessibilityCompliant); 3687 if(isFocusable) 3688 this.ApplyFocusedStyle(); 3689 else 3690 this.ApplyUnfocusedStyle(); 3691 }, 3692 SendPostBack: function(postBackArg){ 3693 if(!this.enabled || !this.clientEnabled) 3694 return; 3695 var arg = postBackArg || ""; 3696 if(this.autoPostBackFunction) 3697 this.autoPostBackFunction(arg); 3698 else if(!this.useSubmitBehavior || this.IsLink()) 3699 ASPxClientControl.prototype.SendPostBack.call(this, arg); 3700 if(this.useSubmitBehavior && !this.isNative) 3701 this.ClickInternalButton(); 3702 }, 3703 ClickInternalButton: function(){ 3704 var element = this.GetInternalButton(); 3705 if(element) { 3706 this.clickLocked = true; 3707 if(ASPx.Browser.NetscapeFamily) 3708 this.CreateUniqueIDCarrier(); 3709 var postHandler = ASPx.GetPostHandler(); 3710 postHandler.SetLastSubmitElementName(element.name); 3711 ASPx.Evt.DoElementClick(element); 3712 postHandler.SetLastSubmitElementName(null); 3713 if(ASPx.Browser.NetscapeFamily) 3714 this.RemoveUniqueIDCarrier(); 3715 this.clickLocked = false; 3716 } 3717 }, 3718 CreateUniqueIDCarrier: function() { 3719 var name = this.uniqueID; 3720 var id = this.GetUniqueIDCarrierID(); 3721 var field = ASPx.CreateHiddenField(name, id);
3722 var form = this.GetParentForm(); 3723 if(form) form.appendChild(field); 3724 }, 3725 RemoveUniqueIDCarrier: function() { 3726 var field = document.getElementById(this.GetUniqueIDCarrierID()); 3727 if(field) 3728 field.parentNode.removeChild(field); 3729 }, 3730 GetUniqueIDCarrierID: function() { 3731 return this.uniqueID + "_UIDC"; 3732 }, 3733 DoClick: function(){ 3734 if(!this.enabled || !this.clientEnabled) 3735 return; 3736 var button = (this.isNative || this.IsLink()) ? this.GetMainElement() : this.GetInternalButton(); 3737 if(button) 3738 ASPx.Evt.DoElementClick(button); 3739 else 3740 this.OnClick(); 3741 }, 3742 GetChecked: function(){ 3743 return this.checked; 3744 }, 3745 SetChecked: function(checked){ 3746 this.SetCheckedInternal(checked, false); 3747 this.ClearButtonGroupChecked(false); 3748 }, 3749 GetText: function(){ 3750 if(!this.isTextEmpty) 3751 return this.isNative ? this.GetTextContainer().value : this.GetTextContainer().innerHTML; 3752 return ""; 3753 }, 3754 SetText: function(text){ 3755 this.isTextEmpty = (text == null || text == ""); 3756 var textContainer = this.GetTextContainer(); 3757 if(textContainer){ 3758 if(this.isNative) 3759 textContainer.value = (text != null) ? text : ""; 3760 else { 3761 var value = this.isTextEmpty ? " " : text; 3762 textContainer.innerHTML = value; 3763 var element = this.GetInternalButton(); 3764 if(element) 3765 element.value = value; 3766 } 3767 this.UpdateSize(); 3768 } 3769 }, 3770 GetImageUrl: function(){ 3771 var img = this.GetButtonImage(); 3772 return img ? img.src : ""; 3773 }, 3774 SetImageUrl: function(url){ 3775 var img = this.GetButtonImage(); 3776 if(img) { 3777 img.src = url; 3778 this.UpdateSize(); 3779 } 3780 }, 3781 SetEnabled: function(enabled){ 3782 if(this.clientEnabled != enabled) { 3783 if(!enabled && this.focused) 3784 this.OnLostFocus(); 3785 this.clientEnabled = enabled; 3786 this.SetEnabledInternal(enabled, false); 3787 } 3788 }, 3789 GetEnabled: function(){ 3790 return this.enabled && this.clientEnabled; 3791 }, 3792 Focus: function(){ 3793 this.SetFocus(); 3794 }, 3795 RaiseCheckedChanged: function(){ 3796 var processOnServer = this.autoPostBack || this.IsServerEventAssigned("CheckedChanged"); 3797 if(!this.CheckedChanged.IsEmpty()){ 3798 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 3799 this.CheckedChanged.FireEvent(this, args); 3800 processOnServer = args.processOnServer; 3801 } 3802 return processOnServer; 3803 }, 3804 RaiseFocus: function(){ 3805 if(!this.GotFocus.IsEmpty()){ 3806 var args = new ASPxClientEventArgs(); 3807 this.GotFocus.FireEvent(this, args); 3808 } 3809 }, 3810 RaiseLostFocus: function(){ 3811 if(!this.LostFocus.IsEmpty()){ 3812 var args = new ASPxClientEventArgs(); 3813 this.LostFocus.FireEvent(this, args); 3814 } 3815 }, 3816 RaiseClick: function() { 3817 var processOnServer = this.autoPostBack || this.IsServerEventAssigned("Click"); 3818 var cancelEventAndBubble = false; 3819 if(!this.Click.IsEmpty()) { 3820 var args = new ASPxClientButtonClickEventArgs(processOnServer, cancelEventAndBubble); 3821 this.Click.FireEvent(this, args); 3822 cancelEventAndBubble = args.cancelEventAndBubble; 3823 processOnServer = args.processOnServer; 3824 } 3825 return { 3826 processOnServer: processOnServer, 3827 cancelEventAndBubble: cancelEventAndBubble 3828 }; 3829 } 3830}); 3831ASPxClientButton.Cast = ASPxClientControl.Cast; 3832var ASPxClientButtonClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, { 3833 constructor: function(processOnServer, cancelEventAndBubble) { 3834 this.constructor.prototype.constructor.call(this, processOnServer); 3835 this.cancelEventAndBubble = cancelEventAndBubble; 3836 } 3837}); 3838ASPxClientButton.MakeHiddenElementFocusable = function(element) { 3839 element.__dxHiddenElementState = { 3840 parentDisplay: element.parentNode.style.display, 3841 height: element.style.height, 3842 width: element.style.width 3843 }; 3844 element.parentNode.style.display = "block"; 3845 element.style.height = "1px"; 3846 element.style.width = "1px"; 3847}; 3848ASPxClientButton.RestoreHiddenElementAppearance = function(element) { 3849 var state = element.__dxHiddenElementState; 3850 element.parentNode.style.display = state.parentDisplay; 3851 element.style.height = state.height; 3852 element.style.width = state.width; 3853 delete element.__dxHiddenElementState; 3854}; 3855ASPx.Ident.IsASPxClientButton = function(obj) { 3856 return !!obj.isASPxClientButton; 3857};
3858function _aspxBCallButtonMethod(name, methodName, arg) { 3859 var button = ASPx.GetControlCollection().Get(name); 3860 if(button != null) 3861 button[methodName](arg); 3862} 3863ASPx.BClick = function(name, evt) { 3864 var button = ASPx.GetControlCollection().Get(name); 3865 if(button != null) 3866 return button.OnClick(evt); 3867}; 3868window.ASPxClientButton = ASPxClientButton; 3869})(); 3870 3871(function() { 3872var ASPxClientEditBase = ASPx.CreateClass(ASPxClientControl, { 3873 constructor: function(name) { 3874 this.constructor.prototype.constructor.call(this, name); 3875 this.EnabledChanged = new ASPxClientEvent(); 3876 this.captionPosition = ASPx.Position.Left; 3877 this.showCaptionColon = true; 3878 this.scPrefix = "dxe"; 3879 }, 3880 InlineInitialize: function(){ 3881 ASPxClientControl.prototype.InlineInitialize.call(this); 3882 this.InitializeEnabled(); 3883 this.InitializeEvents(); 3884 }, 3885 InitializeEnabled: function() { 3886 this.SetEnabledInternal(this.clientEnabled, true); 3887 }, 3888 InitializeEvents: function() { }, 3889 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) { 3890 ASPx.AddReadOnlyItems(mainElementId, [[[cssClass], [''], ['']]]); 3891 }, 3892 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) { 3893 ASPx.AddDisabledItems(mainElementId, [[[cssClass], [''], ['']]]); 3894 }, 3895 GetValue: function() { 3896 var element = this.GetMainElement(); 3897 if(ASPx.IsExistsElement(element)) 3898 return element.innerHTML; 3899 return ""; 3900 }, 3901 GetValueString: function(){ 3902 var value = this.GetValue(); 3903 return (value == null) ? null : value.toString(); 3904 }, 3905 EnsureValueStringIsActual: function() { 3906 if(this.maskInfo != null) 3907 this.ParseValue(); 3908 }, 3909 SetValue: function(value) { 3910 if(value == null) 3911 value = ""; 3912 var element = this.GetMainElement(); 3913 if(ASPx.IsExistsElement(element)) 3914 element.innerHTML = value; 3915 }, 3916 GetEnabled: function(){ 3917 return this.enabled && this.clientEnabled; 3918 }, 3919 SetEnabled: function(enabled){ 3920 if(this.clientEnabled != enabled) { 3921 var errorFrameRequiresUpdate = this.GetIsValid && !this.GetIsValid(); 3922 if(errorFrameRequiresUpdate && !enabled) 3923 this.UpdateErrorFrameAndFocus(false , null , true ); 3924 this.clientEnabled = enabled; 3925 this.SetEnabledInternal(enabled, false); 3926 if(errorFrameRequiresUpdate && enabled) 3927 this.UpdateErrorFrameAndFocus(false ); 3928 this.RaiseEnabledChangedEvent(); 3929 } 3930 }, 3931 SetEnabledInternal: function(enabled, initialization){ 3932 if(!this.enabled) return; 3933 if(!initialization || !enabled) 3934 this.ChangeEnabledStateItems(enabled); 3935 this.ChangeEnabledAttributes(enabled); 3936 if(ASPx.Browser.Chrome) { 3937 var mainElement = this.GetMainElement(); 3938 if(mainElement) 3939 mainElement.className = mainElement.className; 3940 } 3941 }, 3942 ChangeEnabledAttributes: function(enabled){ 3943 }, 3944 ChangeEnabledStateItems: function(enabled){ 3945 }, 3946 RaiseEnabledChangedEvent: function(){ 3947 if(!this.EnabledChanged.IsEmpty()){ 3948 var args = new ASPxClientEventArgs(); 3949 this.EnabledChanged.FireEvent(this, args); 3950 } 3951 }, 3952 GetDecodeValue: function (value) { 3953 if(typeof (value) == "string" && value.length > 1) 3954 value = this.SimpleDecodeHtml(value); 3955 return value; 3956 }, 3957 SimpleDecodeHtml: function (html) { 3958 return ASPx.Str.ApplyReplacement(html, [ 3959 [/</g, '<'], 3960 [/&/g, '&'], 3961 [/"/g, '"'], 3962 [/'/g, '\''], 3963 [/ /g, ' '] 3964 ]); 3965 }, 3966 GetCachedElementById: function(idSuffix) { 3967 return ASPx.CacheHelper.GetCachedElementById(this, this.name + idSuffix); 3968 }, 3969 GetCaptionCell: function() { 3970 return this.GetCachedElementById(EditElementSuffix.CaptionCell); 3971 }, 3972 GetExternalTable: function() { 3973 return this.GetCachedElementById(EditElementSuffix.ExternalTable); 3974 }, 3975 getCaptionRelatedCellCount: function() { 3976 if(!this.captionRelatedCellCount) 3977 this.captionRelatedCellCount = ASPx.GetNodesByClassName(this.GetExternalTable(), CaptionRelatedCellClassName).length; 3978 return this.captionRelatedCellCount; 3979 }, 3980 addCssClassToCaptionRelatedCells: function() { 3981 if(this.captionPosition == ASPx.Position.Left || this.captionPosition == ASPx.Position.Right) { 3982 var captionRelatedCellsIndex = this.captionPosition == ASPx.Position.Left ? 0 : this.GetCaptionCell().cellIndex; 3983 for(var i = 0; i < this.GetExternalTable().rows.length; i++) 3984 ASPx.AddClassNameToElement(this.GetExternalTable().rows[i].cells[captionRelatedCellsIndex], CaptionRelatedCellClassName); 3985 } 3986 if(this.captionPosition == ASPx.Position.Top || this.captionPosition == ASPx.Position.Bottom) 3987 for(var i = 0; i < this.GetCaptionCell().parentNode.cells.length; i++) 3988 ASPx.AddClassNameToElement(this.GetCaptionCell().parentNode.cells[i], CaptionRelatedCellClassName); 3989 }, 3990 GetCaption: function() { 3991 if(ASPx.IsExists(this.GetCaptionCell())) 3992 return this.getCaptionInternal(); 3993 return ""; 3994 }, 3995 SetCaption: function(caption) { 3996 if(!ASPx.IsExists(this.GetCaptionCell())) 3997 return; 3998 if(this.getCaptionRelatedCellCount() == 0) 3999 this.addCssClassToCaptionRelatedCells();
4000 if(caption !== "") 4001 ASPx.RemoveClassNameFromElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName); 4002 else 4003 ASPx.AddClassNameToElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName); 4004 this.setCaptionInternal(caption); 4005 }, 4006 getCaptionTextNode: function() { 4007 var captionElement = ASPx.GetNodesByPartialClassName(this.GetCaptionCell(), CaptionElementPartialClassName)[0]; 4008 return ASPx.GetNormalizedTextNode(captionElement); 4009 }, 4010 getCaptionInternal: function() { 4011 var captionText = this.getCaptionTextNode().nodeValue; 4012 if(captionText !== "" && captionText[captionText.length - 1] == ":") 4013 captionText = captionText.substring(0, captionText.length - 1); 4014 return captionText; 4015 }, 4016 setCaptionInternal: function(caption) { 4017 caption = ASPx.Str.Trim(caption); 4018 var captionTextNode = this.getCaptionTextNode(); 4019 if(this.showCaptionColon && caption[caption.length - 1] != ":" && caption !== "") 4020 caption += ":"; 4021 captionTextNode.nodeValue = caption; 4022 }, 4023 onVirtualKeyboardUITouchStart: function(evt) { } 4024}); 4025var ValidationPattern = ASPx.CreateClass(null, { 4026 constructor: function(errorText) { 4027 this.errorText = errorText; 4028 } 4029}); 4030var RequiredFieldValidationPattern = ASPx.CreateClass(ValidationPattern, { 4031 constructor: function(errorText) { 4032 this.constructor.prototype.constructor.call(this, errorText); 4033 }, 4034 EvaluateIsValid: function(value) { 4035 return value != null && (value.constructor == Array || ASPx.Str.Trim(value.toString()) != ""); 4036 } 4037}); 4038var RegularExpressionValidationPattern = ASPx.CreateClass(ValidationPattern, { 4039 constructor: function(errorText, pattern) { 4040 this.constructor.prototype.constructor.call(this, errorText); 4041 this.pattern = pattern; 4042 }, 4043 EvaluateIsValid: function(value) { 4044 if(value == null) 4045 return true; 4046 var strValue = value.toString(); 4047 if(ASPx.Str.Trim(strValue).length == 0) 4048 return true; 4049 var regEx = new RegExp(this.pattern); 4050 var matches = regEx.exec(strValue); 4051 return matches != null && strValue == matches[0]; 4052 } 4053}); 4054function _aspxIsEditorFocusable(inputElement) { 4055 return ASPx.IsFocusableCore(inputElement, function(container) { 4056 return container.getAttribute("errorFrame") == "errorFrame"; 4057 }); 4058} 4059var invalidEditorToBeFocused = null; 4060var ValidationType = { 4061 PersonalOnValueChanged: "ValueChanged", 4062 PersonalViaScript: "CalledViaScript", 4063 MassValidation: "MassValidation" 4064}; 4065var ErrorFrameDisplay = { 4066 None: "None", 4067 Static: "Static", 4068 Dynamic: "Dynamic" 4069}; 4070var EditElementSuffix = { 4071 ExternalTable: "_ET", 4072 ControlCell: "_CC", 4073 ErrorCell: "_EC", 4074 ErrorTextCell: "_ETC", 4075 ErrorImage: "_EI", 4076 CaptionCell: "_CapC", 4077 AccessibilityAdditionalTextRow: "_AHTR" 4078}; 4079var ASPxEditExternalTableClassNames = { 4080 ValidStaticTableClassName: "dxeValidStEditorTable", 4081 ValidDynamicTableClassName: "dxeValidDynEditorTable", 4082 TableWithEmptyCaptionClassName: "tableWithEmptyCaption" 4083}; 4084var CaptionRelatedCellClassName = "dxeCaptionRelatedCell"; 4085var CaptionElementPartialClassName = "dxeCaption"; 4086var AccessibilityAssistantID = "AcAs"; 4087var ASPxClientEdit = ASPx.CreateClass(ASPxClientEditBase, { 4088 constructor: function(name) { 4089 this.constructor.prototype.constructor.call(this, name); 4090 this.isASPxClientEdit = true; 4091 this.inputElement = null; 4092 this.convertEmptyStringToNull = true; 4093 this.readOnly = false; 4094 this.clientReadOnly = false; 4095 this.focused = false; 4096 this.focusEventsLocked = false; 4097 this.focusEventsLockCount = 0; 4098 this.receiveGlobalMouseWheel = true; 4099 this.styleDecoration = null; 4100 this.heightCorrectionRequired = false; 4101 this.customValidationEnabled = false; 4102 this.display = ErrorFrameDisplay.Static; 4103 this.initialErrorText = ""; 4104 this.causesValidation = false; 4105 this.validateOnLeave = true; 4106 this.validationGroup = ""; 4107 this.sendPostBackWithValidation = null; 4108 this.validationPatterns = []; 4109 this.setFocusOnError = false; 4110 this.errorDisplayMode = "it"; 4111 this.errorText = ""; 4112 this.isValid = true; 4113 this.errorImageIsAssigned = false; 4114 this.notifyValidationSummariesToAcceptNewError = false; 4115 this.isErrorFrameRequired = false; 4116 this.enterProcessed = false; 4117 this.keyDownHandlers = {}; 4118 this.keyPressHandlers = {}; 4119 this.keyUpHandlers = {};
4120 this.onKeyDownHandler = null; 4121 this.onKeyPressHandler = null; 4122 this.onKeyUpHandler = null; 4123 this.onGotFocusHandler = null; 4124 this.onLostFocusHandler = null; 4125 this.GotFocus = new ASPxClientEvent(); 4126 this.LostFocus = new ASPxClientEvent(); 4127 this.Validation = new ASPxClientEvent(); 4128 this.ValueChanged = new ASPxClientEvent(); 4129 this.KeyDown = new ASPxClientEvent(); 4130 this.KeyPress = new ASPxClientEvent(); 4131 this.KeyUp = new ASPxClientEvent(); 4132 this.eventHandlersInitialized = false; 4133 this.errorCellVisibilityChanged = new ASPxClientEvent(); 4134 this.ariaExplanatoryTextManager = null; 4135 this.InitializeEventHandlers(); 4136 }, 4137 SetData: function(data){ 4138 if(data.decorationStyles){ 4139 for(var i = 0; i < data.decorationStyles.length; i++) 4140 this.AddDecorationStyle(data.decorationStyles[i].key, 4141 data.decorationStyles[i].className, 4142 data.decorationStyles[i].cssText); 4143 } 4144 }, 4145 Initialize: function() { 4146 this.initialErrorText = this.errorText; 4147 ASPxClientEditBase.prototype.Initialize.call(this); 4148 this.InitializeKeyHandlers(); 4149 this.UpdateClientValidationState(); 4150 this.UpdateValidationSummaries(null , true ); 4151 }, 4152 InlineInitialize: function() { 4153 if(this.UseDelayedSpecialFocus()) 4154 this.InitializeDelayedSpecialFocus(); 4155 ASPxClientEditBase.prototype.InlineInitialize.call(this); 4156 this.UpdateStyleDecorations(); 4157 var externalTable = this.GetExternalTable(); 4158 if(externalTable && ASPx.IsPercentageSize(externalTable.style.width)) { 4159 this.width = "100%"; 4160 this.GetMainElement().style.width = "100%"; 4161 if(this.isErrorFrameRequired) 4162 externalTable.setAttribute("errorFrame", "errorFrame"); 4163 } 4164 this.ariaExplanatoryTextManager = this.CreateAriaExplanatoryTextManager(); 4165 if(this.clientReadOnly) 4166 this.SetReadOnlyInternal(true); 4167 this.UpdateErrorCellParentRowVisibility(); 4168 }, 4169 AfterInitialize: function() { 4170 this.ariaExplanatoryTextManager.SetCaptionAssociating(); 4171 this.ariaExplanatoryTextManager.UpdateText(); 4172 this.ariaExplanatoryTextManager.UpdateValidationState(); 4173 ASPxClientEditBase.prototype.AfterInitialize.call(this); 4174 }, 4175 UpdateStyleDecorations: function() { 4176 if(this.styleDecoration) 4177 this.styleDecoration.Update(); 4178 }, 4179 UseSpecialKeyboardHandling: function() { 4180 return false; 4181 }, 4182 InitializeKeyHandlers: function() { 4183 }, 4184 AddKeyDownHandler: function(key, handler) { 4185 this.keyDownHandlers[key] = handler; 4186 }, 4187 AddKeyPressHandler: function(key, handler) { 4188 this.keyPressHandlers[key] = handler; 4189 }, 4190 InitializeEventHandlers: function() { 4191 this.onGotFocusHandler = function(evt) { ASPx.EGotFocus(this.name); }.bind(this); 4192 this.onLostFocusHandler = function(evt) { ASPx.ELostFocus(this.name); }.bind(this); 4193 if(this.UseSpecialKeyboardHandling()) { 4194 this.onKeyDownHandler = function(evt) { ASPx.KBSIKeyDown(this.name, evt); }.bind(this); 4195 this.onKeyPressHandler = function(evt) { ASPx.KBSIKeyPress(this.name, evt); }.bind(this); 4196 this.onKeyUpHandler = function(evt) { ASPx.KBSIKeyUp(this.name, evt); }.bind(this); 4197 } 4198 }, 4199 ChangeSpecialInputEnabledAttributes: function(element, method, doNotChangeAutoComplete) { 4200 if(!doNotChangeAutoComplete) 4201 element.autocomplete = "off"; 4202 if(this.onKeyDownHandler != null) 4203 method(element, "keydown", this.onKeyDownHandler); 4204 if(this.onKeyPressHandler != null) 4205 method(element, "keypress", this.onKeyPressHandler); 4206 if(this.onKeyUpHandler != null) 4207 method(element, "keyup", this.onKeyUpHandler); 4208 if(this.onGotFocusHandler != null) 4209 method(element, "focus", this.onGotFocusHandler); 4210 if(this.onLostFocusHandler != null) 4211 method(element, "blur", this.onLostFocusHandler); 4212 }, 4213 CreateAriaExplanatoryTextManager: function() { 4214 if(this.accessibilityCompliant) 4215 return new EditAccessibilityExplanatoryTextManager(this); 4216 else 4217 return new DisableAccessibilityExplanatoryTextManager(this); 4218 }, 4219 UpdateClientValidationState: function() { 4220 if(!this.customValidationEnabled) 4221 return; 4222 var mainElement = this.GetMainElement(); 4223 if(mainElement) { 4224 var validationState = !this.GetIsValid() ? ("-" + this.GetErrorText()) : ""; 4225 this.UpdateStateObjectWithObject({ validationState: validationState }); 4226 } 4227 },
4228 UpdateValidationSummaries: function(validationType, initializing) { 4229 if(ASPx.Ident.scripts.ASPxClientValidationSummary) { 4230 var summaryCollection = ASPx.GetClientValidationSummaryCollection(); 4231 summaryCollection.OnEditorIsValidStateChanged(this, validationType, initializing && this.notifyValidationSummariesToAcceptNewError); 4232 } 4233 }, 4234 FindInputElement: function(){ 4235 return null; 4236 }, 4237 GetInputElement: function(){ 4238 if(!ASPx.IsExistsElement(this.inputElement)) 4239 this.inputElement = this.FindInputElement(); 4240 return this.inputElement; 4241 }, 4242 GetFocusableInputElement: function() { 4243 return this.GetInputElement(); 4244 }, 4245 GetAccessibilityActiveElements: function() { 4246 return [this.GetInputElement()]; 4247 }, 4248 GetAccessibilityFirstActiveElement: function() { 4249 return this.accessibilityHelper ? 4250 this.accessibilityHelper.getMainElement() : 4251 this.GetAccessibilityActiveElements()[0]; 4252 }, 4253 GetAccessibilityAssistantElement: function() { 4254 return this.GetChildElement(AccessibilityAssistantID); 4255 }, 4256 GetErrorImage: function() { 4257 return this.GetCachedElementById(EditElementSuffix.ErrorImage); 4258 }, 4259 GetControlCell: function() { 4260 return this.GetCachedElementById(EditElementSuffix.ControlCell); 4261 }, 4262 GetErrorCell: function() { 4263 return this.GetCachedElementById(EditElementSuffix.ErrorCell); 4264 }, 4265 GetErrorTextCell: function() { 4266 return this.GetCachedElementById(this.errorImageIsAssigned ? EditElementSuffix.ErrorTextCell : EditElementSuffix.ErrorCell); 4267 }, 4268 GetReadOnly: function() { 4269 return this.readOnly || this.clientReadOnly; 4270 }, 4271 SetReadOnly: function(readOnly) { 4272 readOnly = !!readOnly; 4273 if(this.clientReadOnly === readOnly || this.readOnly) 4274 return; 4275 this.SetReadOnlyInternal(readOnly); 4276 }, 4277 SetReadOnlyInternal: function(readOnly) { 4278 this.clientReadOnly = readOnly; 4279 this.ChangeReadOnlyStateItems(readOnly); 4280 }, 4281 ChangeReadOnlyStateItems: function(readOnly) { 4282 ASPx.GetStateController().SetElementReadOnly(this.GetMainElement(), readOnly); 4283 }, 4284 SetVisible: function (isVisible) { 4285 if(this.clientVisible == isVisible) 4286 return; 4287 var externalTable = this.GetExternalTable(); 4288 if(externalTable) { 4289 ASPx.SetElementDisplay(externalTable, isVisible); 4290 if(this.customValidationEnabled) { 4291 var isValid = !isVisible ? true : void (0); 4292 this.UpdateErrorFrameAndFocus(false , true , isValid ); 4293 } 4294 } 4295 ASPxClientControl.prototype.SetVisible.call(this, isVisible); 4296 }, 4297 GetStateHiddenFieldName: function() { 4298 return this.uniqueID + "$State"; 4299 }, 4300 GetValueInputToValidate: function() { 4301 return this.GetInputElement(); 4302 }, 4303 IsVisible: function() { 4304 if(!this.clientVisible) 4305 return false; 4306 var element = this.GetMainElement(); 4307 if(!element) 4308 return false; 4309 while(element && element.tagName != "BODY") { 4310 if(element.getAttribute("errorFrame") != "errorFrame" && (!ASPx.GetElementVisibility(element) || !ASPx.GetElementDisplay(element))) 4311 return false; 4312 element = element.parentNode; 4313 } 4314 return true; 4315 }, 4316 AdjustControlCore: function() { 4317 this.CollapseEditor(); 4318 this.UnstretchInputElement(); 4319 if(this.heightCorrectionRequired) 4320 this.CorrectEditorHeight(); 4321 }, 4322 CorrectEditorHeight: function() { 4323 }, 4324 UnstretchInputElement: function() { 4325 }, 4326 UseDelayedSpecialFocus: function() { 4327 return false; 4328 }, 4329 GetInnerEditors: function() { 4330 return []; 4331 }, 4332 GetDelayedSpecialFocusTriggers: function() { 4333 return [ this.GetMainElement() ]; 4334 }, 4335 InitializeDelayedSpecialFocus: function() { 4336 this.specialFocusTimer = -1; 4337 var handler = function(evt) { this.OnDelayedSpecialFocusMouseDown(evt); }.aspxBind(this); 4338 var triggers = this.GetDelayedSpecialFocusTriggers(); 4339 for(var i = 0; i < triggers.length; i++) 4340 ASPx.Evt.AttachEventToElement(triggers[i], "mousedown", handler); 4341 }, 4342 OnDelayedSpecialFocusMouseDown: function(evt) { 4343 window.setTimeout(function() { this.SetFocus(); }.aspxBind(this), 0); 4344 }, 4345 IsFocusEventsLocked: function() { 4346 return this.focusEventsLocked || this.focusEventsLockCount !== 0; 4347 }, 4348 BeginFocusUpdate: function() { 4349 this.focusEventsLockCount++; 4350 }, 4351 EndFocusUpdate: function() { 4352 this.focusEventsLockCount--; 4353 if(this.focusEventsLockCount === 0) 4354 if(this.focused && !this.IsEditorElement(document.activeElement)) 4355 this.OnLostFocus(); 4356 }, 4357 LockFocusEvents: function() { 4358 if(!this.focused) return; 4359 this.focusEventsLocked = true; 4360 }, 4361 UnlockFocusEvents: function() { 4362 this.focusEventsLocked = false; 4363 }, 4364 ForceRefocusEditor: function(evt, isNativeFocus) { 4365 if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) { 4366 var focusedEditor = ASPx.VirtualKeyboardUI.getFocusedEditor(); 4367 if(ASPx.VirtualKeyboardUI.getInputNativeFocusLocked() && (!focusedEditor || focusedEditor === this)) 4368 return; 4369 ASPx.VirtualKeyboardUI.setInputNativeFocusLocked(!isNativeFocus); 4370 }
4371 this.LockFocusEvents(); 4372 this.BlurInputElement(); 4373 window.setTimeout(function() { 4374 if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) { 4375 ASPx.VirtualKeyboardUI.setFocusToEditor(this); 4376 } else { 4377 this.SetFocus(); 4378 } 4379 }.aspxBind(this), 0); 4380 }, 4381 BlurInputElement: function() { 4382 var inputElement = this.GetFocusableInputElement(); 4383 if(inputElement && inputElement.blur) 4384 inputElement.blur(); 4385 }, 4386 IsEditorElement: function(element) { 4387 return this.GetMainElement() == element || ASPx.GetIsParent(this.GetMainElement(), element); 4388 }, 4389 IsClearButtonElement: function(element) { 4390 return false; 4391 }, 4392 IsElementBelongToInputElement: function(element) { 4393 return this.GetInputElement() == element; 4394 }, 4395 OnFocusCore: function() { 4396 if(this.UseDelayedSpecialFocus()) 4397 this.specialFocusTimer = ASPx.Timer.ClearTimer(this.specialFocusTimer); 4398 if(!this.IsFocusEventsLocked()){ 4399 this.focused = true; 4400 ASPx.SetFocusedEditor(this); 4401 if(this.styleDecoration) 4402 this.styleDecoration.Update(); 4403 if(this.isInitialized) 4404 this.RaiseFocus(); 4405 } 4406 else 4407 this.UnlockFocusEvents(); 4408 }, 4409 OnLostFocusCore: function() { 4410 if(!this.IsFocusEventsLocked()){ 4411 this.focused = false; 4412 if(ASPx.GetFocusedEditor() === this) 4413 ASPx.SetFocusedEditor(null); 4414 if(this.styleDecoration) 4415 this.styleDecoration.Update(); 4416 this.RaiseLostFocus(); 4417 } 4418 }, 4419 OnFocus: function() { 4420 var focusedEditor = ASPx.GetFocusedEditor(); 4421 if(focusedEditor && focusedEditor.UseDelayedSpecialFocus() && focusedEditor !== this && focusedEditor.GetInnerEditors().indexOf(this) === -1 && ASPx.IsElementVisible(focusedEditor.GetMainElement())) { 4422 var lostFocusHandler = function() { 4423 focusedEditor.LostFocus.RemoveHandler(lostFocusHandler); 4424 this.OnFocusCore(); 4425 }.bind(this); 4426 focusedEditor.LostFocus.AddHandler(lostFocusHandler); 4427 } 4428 else { 4429 this.OnFocusCore(); 4430 } 4431 }, 4432 OnLostFocus: function() { 4433 if(this.isInitialized) 4434 this.OnLostFocusCore(); 4435 }, 4436 OnMouseWheel: function(evt){ 4437 }, 4438 OnValidation: function(validationType) { 4439 if(this.customValidationEnabled && this.isInitialized && ASPx.IsExistsElement(this.GetMainElement()) && 4440 (!this.IsErrorFrameDisplayed() || this.GetElementRequiredForErrorFrame())) { 4441 this.BeginErrorFrameUpdate(); 4442 try { 4443 if(this.validateOnLeave || validationType != ValidationType.PersonalOnValueChanged) { 4444 this.SetIsValid(true, true ); 4445 this.SetErrorText(this.initialErrorText, true ); 4446 this.ValidateWithPatterns(); 4447 this.RaiseValidation(); 4448 } 4449 this.UpdateErrorFrameAndFocus(this.editorFocusingRequired(validationType)); 4450 } finally { 4451 this.EndErrorFrameUpdate(); 4452 } 4453 this.UpdateValidationSummaries(validationType); 4454 this.ariaExplanatoryTextManager.UpdateValidationState(validationType); 4455 } 4456 }, 4457 GetElementRequiredForErrorFrame: function() { 4458 return this.GetExternalTable(); 4459 }, 4460 editorFocusingRequired: function(validationType) { 4461 return !this.GetIsValid() && 4462 validationType == ValidationType.PersonalViaScript && this.setFocusOnError; 4463 }, 4464 OnValueChanged: function() { 4465 if(this.getProcessOnServerOnValueChanged()) 4466 this.SendPostBackInternal(""); 4467 }, 4468 getProcessOnServerOnValueChanged: function() { 4469 var processOnServer = this.RaiseValidationInternal(); 4470 return this.RaiseValueChangedEvent() && processOnServer; 4471 }, 4472 ParseValue: function() { 4473 }, 4474 RaisePersonalStandardValidation: function() { 4475 if(ASPx.IsFunction(window.ValidatorOnChange)) { 4476 var inputElement = this.GetValueInputToValidate(); 4477 if(inputElement && inputElement.Validators) 4478 window.ValidatorOnChange({ srcElement: inputElement }); 4479 } 4480 }, 4481 RaiseValidationInternal: function() { 4482 if(this.isPostBackAllowed() && this.causesValidation && this.validateOnLeave) 4483 return ASPxClientEdit.ValidateGroup(this.validationGroup); 4484 else { 4485 this.OnValidation(ValidationType.PersonalOnValueChanged); 4486 return this.GetIsValid(); 4487 } 4488 }, 4489 RaiseValueChangedEvent: function(){ 4490 return this.RaiseValueChanged(); 4491 }, 4492 SendPostBackInternal: function(postBackArg) { 4493 if(ASPx.IsFunction(this.sendPostBackWithValidation)) 4494 this.sendPostBackWithValidation(postBackArg); 4495 else 4496 this.SendPostBack(postBackArg); 4497 }, 4498 SetElementToBeFocused: function() { 4499 if(this.IsVisible()) 4500 invalidEditorToBeFocused = this; 4501 }, 4502 GetFocusSelectAction: function() { 4503 return null; 4504 }, 4505 SetFocus: function() { 4506 var inputElement = this.GetFocusableInputElement(); 4507 if(!inputElement) return; 4508 if((ASPx.GetActiveElement() != inputElement) && _aspxIsEditorFocusable(inputElement)) 4509 ASPx.SetFocus(inputElement, this.GetFocusSelectAction()); 4510 }, 4511 SetFocusOnError: function() { 4512 if(invalidEditorToBeFocused == this) { 4513 this.SetFocus(); 4514 invalidEditorToBeFocused = null; 4515 } 4516 }, 4517 BeginErrorFrameUpdate: function() { 4518 if(!this.errorFrameUpdateLocked) 4519 this.errorFrameUpdateLocked = true; 4520 }, 4521 EndErrorFrameUpdate: function() { 4522 this.errorFrameUpdateLocked = false; 4523 var args = this.updateErrorFrameAndFocusLastCallArgs; 4524 if(args) { 4525 this.UpdateErrorFrameAndFocus(args[0], args[1]); 4526 delete this.updateErrorFrameAndFocusLastCallArgs; 4527 } 4528 }, 4529 UpdateErrorFrameAndFocus: function(setFocusOnError, ignoreVisibilityCheck, isValid) { 4530 if(!ignoreVisibilityCheck && !this.GetVisible()) 4531 return; 4532 if(this.errorFrameUpdateLocked) { 4533 this.updateErrorFrameAndFocusLastCallArgs = [ setFocusOnError, ignoreVisibilityCheck ]; 4534 return; 4535 } 4536 if(this.styleDecoration) 4537 this.styleDecoration.Update(); 4538 if(typeof(isValid) == "undefined") 4539 isValid = this.GetIsValid(); 4540 if(isValid && this.IsErrorFrameDisplayed()) 4541 this.ChangeErrorFrameVisibility(false); 4542 else { 4543 var editorLocatedWithinVisibleContainer = this.IsVisible(); 4544 if(this.IsErrorFrameDisplayed()) { 4545 this.UpdateErrorCellContent(); 4546 this.ChangeErrorFrameVisibility(true); 4547 } 4548 if(editorLocatedWithinVisibleContainer) { 4549 if(setFocusOnError && this.setFocusOnError && invalidEditorToBeFocused == null) { 4550 this.SetElementToBeFocused(); 4551 this.SetFocusOnError(); 4552 } 4553 } 4554 } 4555 }, 4556 ChangeErrorFrameVisibility: function(visible) { 4557 var externalTable = this.GetExternalTable(); 4558 var isStaticDisplay = this.display == ErrorFrameDisplay.Static; 4559 if(!isStaticDisplay && visible) { 4560 this.EnsureControlCellStylesLoaded(); 4561 this.RestoreControlCellStyles(); 4562 } 4563 this.ChangeErrorCellVisibility(visible, isStaticDisplay); 4564 if(!isStaticDisplay && !visible) { 4565 this.EnsureControlCellStylesLoaded(); 4566 this.ClearControlCellStyles(); 4567 }
4568 var validExternalTableClassName = isStaticDisplay ? ASPxEditExternalTableClassNames.ValidStaticTableClassName 4569 : ASPxEditExternalTableClassNames.ValidDynamicTableClassName; 4570 ASPx.ToggleClassNameToElement(externalTable, validExternalTableClassName, !visible); 4571 this.UpdateErrorCellParentRowVisibility(); 4572 }, 4573 ChangeErrorCellVisibility: function(visible, useVisibilityAttribute) { 4574 var errorCell = this.GetErrorCell(); 4575 if(errorCell) { 4576 if(useVisibilityAttribute) 4577 ASPx.SetElementVisibility(errorCell, visible); 4578 else { 4579 ASPx.SetElementDisplay(errorCell, visible); 4580 this.raiseErrorCellVisibilityChanged(); 4581 } 4582 } 4583 }, 4584 raiseErrorCellVisibilityChanged: function() { 4585 if(!this.errorCellVisibilityChanged.IsEmpty()) 4586 this.errorCellVisibilityChanged.FireEvent(this); 4587 }, 4588 UpdateErrorCellParentRowVisibility: function() { 4589 var errorCell = this.GetErrorCell(); 4590 if(!errorCell || this.display == ErrorFrameDisplay.Static) 4591 return; 4592 var displayedCellCount = 0; 4593 var errorCellParentRow = errorCell.parentNode; 4594 for(var i = 0; i < errorCellParentRow.cells.length; i++) { 4595 var cell = errorCellParentRow.cells[i]; 4596 if(ASPx.GetElementDisplay(cell)) 4597 displayedCellCount++; 4598 } 4599 ASPx.SetElementDisplay(errorCellParentRow, displayedCellCount > 0); 4600 }, 4601 EnsureControlCellStylesLoaded: function() { 4602 if(typeof(this.controlCellStyles) == "undefined") { 4603 var controlCell = this.GetControlCell(); 4604 this.controlCellStyles = { 4605 cssClass: controlCell.className,
4606 style: this.ExtractElementStyleStringIgnoringVisibilityProps(controlCell) 4607 }; 4608 } 4609 }, 4610 ClearControlCellStyles: function() { 4611 this.ClearElementStyle(this.GetControlCell()); 4612 }, 4613 RestoreControlCellStyles: function() { 4614 var controlCell = this.GetControlCell(); 4615 controlCell.className = this.controlCellStyles.cssClass; 4616 controlCell.style.cssText = this.controlCellStyles.style; 4617 }, 4618 ExtractElementStyleStringIgnoringVisibilityProps: function(element) { 4619 var savedVisibility = element.style.visibility; 4620 var savedDisplay = element.style.display; 4621 element.style.visibility = ""; 4622 element.style.display = ""; 4623 var styleStr = element.style.cssText; 4624 element.style.visibility = savedVisibility; 4625 element.style.display = savedDisplay; 4626 return styleStr; 4627 }, 4628 ClearElementStyle: function(element) { 4629 if(!element) 4630 return; 4631 element.className = ""; 4632 var excludedAttrNames = [ 4633 "width", "display", "visibility", 4634 "position", "left", "top", "z-index", 4635 "margin", "margin-top", "margin-right", "margin-bottom", "margin-left", 4636 "float", "clear" 4637 ]; 4638 var savedAttrValues = { }; 4639 for(var i = 0; i < excludedAttrNames.length; i++) { 4640 var attrName = excludedAttrNames[i]; 4641 var attrValue = element.style[attrName]; 4642 if(attrValue) 4643 savedAttrValues[attrName] = attrValue; 4644 } 4645 element.style.cssText = ""; 4646 for(var styleAttrName in savedAttrValues) 4647 if(savedAttrValues.hasOwnProperty(styleAttrName)) 4648 element.style[styleAttrName] = savedAttrValues[styleAttrName]; 4649 }, 4650 Clear: function() { 4651 this.SetValue(null); 4652 this.SetIsValid(true); 4653 return true; 4654 }, 4655 ResetEditorState: function() { }, 4656 UpdateErrorCellContent: function() { 4657 if(this.errorDisplayMode.indexOf("t") > -1) 4658 this.UpdateErrorText(); 4659 if(this.errorDisplayMode == "i") 4660 this.UpdateErrorImage(); 4661 }, 4662 UpdateErrorImage: function() { 4663 var image = this.GetErrorImage(); 4664 if(ASPx.IsExistsElement(image)) { 4665 if(this.accessibilityCompliant) { 4666 ASPx.Attr.SetAttribute(image, "aria-label", this.errorText); 4667 var innerImg = ASPx.GetNodeByTagName(image, "IMG", 0); 4668 if(ASPx.IsExists(innerImg)) 4669 innerImg.alt = this.errorText; 4670 } 4671 image.alt = this.errorText; 4672 image.title = this.errorText; 4673 } else { 4674 this.UpdateErrorText(); 4675 } 4676 }, 4677 UpdateErrorText: function() { 4678 var errorTextCell = this.GetErrorTextCell(); 4679 if(ASPx.IsExistsElement(errorTextCell)) 4680 errorTextCell.innerHTML = this.HtmlEncode(this.errorText); 4681 }, 4682 ValidateWithPatterns: function() { 4683 if(this.validationPatterns.length > 0) { 4684 var value = this.GetValue(); 4685 for(var i = 0; i < this.validationPatterns.length; i++) { 4686 var validator = this.validationPatterns[i]; 4687 if(!validator.EvaluateIsValid(value)) { 4688 this.SetIsValid(false, true ); 4689 this.SetErrorText(validator.errorText, true ); 4690 return; 4691 } 4692 } 4693 } 4694 }, 4695 OnSpecialKeyDown: function(evt){ 4696 this.RaiseKeyDown(evt); 4697 var handler = this.keyDownHandlers[evt.keyCode]; 4698 if(handler) 4699 return this[handler](evt); 4700 return false; 4701 }, 4702 OnSpecialKeyPress: function(evt){ 4703 this.RaiseKeyPress(evt); 4704 var handler = this.keyPressHandlers[evt.keyCode]; 4705 if(handler) 4706 return this[handler](evt); 4707 if(ASPx.Browser.NetscapeFamily || ASPx.Browser.Opera){ 4708 if(evt.keyCode == ASPx.Key.Enter) 4709 return this.enterProcessed; 4710 } 4711 return false; 4712 }, 4713 OnSpecialKeyUp: function(evt){ 4714 this.RaiseKeyUp(evt); 4715 var handler = this.keyUpHandlers[evt.keyCode]; 4716 if(handler) 4717 return this[handler](evt); 4718 return false; 4719 }, 4720 OnKeyDown: function(evt) { 4721 if(!this.UseSpecialKeyboardHandling()) 4722 this.RaiseKeyDown(evt); 4723 }, 4724 OnKeyPress: function(evt) { 4725 if(!this.UseSpecialKeyboardHandling()) 4726 this.RaiseKeyPress(evt); 4727 }, 4728 OnKeyUp: function(evt) { 4729 if(!this.UseSpecialKeyboardHandling()) 4730 this.RaiseKeyUp(evt); 4731 }, 4732 RaiseKeyDown: function(evt){ 4733 if(!this.KeyDown.IsEmpty()){ 4734 var args = new ASPxClientEditKeyEventArgs(evt); 4735 this.KeyDown.FireEvent(this, args); 4736 } 4737 }, 4738 RaiseKeyPress: function(evt){ 4739 if(!this.KeyPress.IsEmpty()){ 4740 var args = new ASPxClientEditKeyEventArgs(evt); 4741 this.KeyPress.FireEvent(this, args); 4742 } 4743 }, 4744 RaiseKeyUp: function(evt){ 4745 if(!this.KeyUp.IsEmpty()){ 4746 var args = new ASPxClientEditKeyEventArgs(evt); 4747 this.KeyUp.FireEvent(this, args); 4748 } 4749 }, 4750 RaiseFocus: function(){ 4751 if(!this.GotFocus.IsEmpty()){ 4752 var args = new ASPxClientEventArgs(); 4753 this.GotFocus.FireEvent(this, args); 4754 } 4755 }, 4756 RaiseLostFocus: function(){ 4757 if(!this.LostFocus.IsEmpty()){ 4758 var args = new ASPxClientEventArgs(); 4759 this.LostFocus.FireEvent(this, args); 4760 } 4761 }, 4762 RaiseValidation: function() { 4763 if(this.customValidationEnabled && !this.Validation.IsEmpty()) { 4764 var currentValue = this.GetValue(); 4765 var args = new ASPxClientEditValidationEventArgs(currentValue, this.errorText, this.GetIsValid()); 4766 this.Validation.FireEvent(this, args); 4767 this.SetErrorText(args.errorText, true ); 4768 this.SetIsValid(args.isValid, true ); 4769 if(args.value != currentValue) 4770 this.SetValue(args.value); 4771 } 4772 }, 4773 RaiseValueChanged: function(){ 4774 var processOnServer = this.isPostBackAllowed(); 4775 if(!this.ValueChanged.IsEmpty()){ 4776 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 4777 this.ValueChanged.FireEvent(this, args); 4778 processOnServer = args.processOnServer; 4779 } 4780 return processOnServer; 4781 }, 4782 isPostBackAllowed: function() { 4783 return this.autoPostBack; 4784 }, 4785 AddDecorationStyle: function(key, className, cssText) { 4786 if(!this.styleDecoration) 4787 this.RequireStyleDecoration(); 4788 this.styleDecoration.AddStyle(key, className, cssText); 4789 }, 4790 RequireStyleDecoration: function() { 4791 this.styleDecoration = this.CreateStyleDecoration(); 4792 this.PopulateStyleDecorationPostfixes(); 4793 }, 4794 CreateStyleDecoration: function() { 4795 return new ASPx.EditorStyleDecoration(this); 4796 }, 4797 PopulateStyleDecorationPostfixes: function() { 4798 this.styleDecoration.AddPostfix(""); 4799 }, 4800 LockStyleDecorationUpdate: function() { 4801 if(this.styleDecoration) 4802 this.styleDecoration.LockUpdate(); 4803 }, 4804 UnlockStyleDecorationUpdate: function() { 4805 if(this.styleDecoration) 4806 this.styleDecoration.UnlockUpdate(); 4807 }, 4808 Focus: function(){ 4809 this.SetFocus(); 4810 }, 4811 GetIsValid: function() { 4812 var hasRequiredInputElement = !this.RequireInputElementToValidate() || ASPx.IsExistsElement(this.GetInputElement()); 4813 if(!hasRequiredInputElement || this.IsErrorFrameDisplayed() && !ASPx.IsExistsElement(this.GetElementRequiredForErrorFrame())) 4814 return true; 4815 return this.isValid; 4816 }, 4817 RequireInputElementToValidate: function() { 4818 return true; 4819 }, 4820 IsErrorFrameDisplayed: function() { 4821 return this.display !== ErrorFrameDisplay.None; 4822 }, 4823 GetErrorText: function(){ 4824 return this.errorText; 4825 }, 4826 SetIsValid: function(isValid, validating){ 4827 if(this.customValidationEnabled && this.isValid != isValid) { 4828 this.isValid = isValid; 4829 this.UpdateErrorFrameAndFocus(false );
4830 this.UpdateClientValidationState(); 4831 if(!validating) 4832 this.UpdateValidationSummaries(ValidationType.PersonalViaScript); 4833 } 4834 }, 4835 SetErrorText: function(errorText, validating){ 4836 if(this.customValidationEnabled && this.errorText != errorText) { 4837 this.errorText = errorText; 4838 this.UpdateErrorFrameAndFocus(false ); 4839 this.UpdateClientValidationState(); 4840 if(!validating) 4841 this.UpdateValidationSummaries(ValidationType.PersonalViaScript); 4842 } 4843 }, 4844 Validate: function(){ 4845 this.ParseValue(); 4846 this.OnValidation(ValidationType.PersonalViaScript); 4847 }, 4848 GetModifyEvent: function() { 4849 return this.ValueChanged; 4850 }, 4851 EnsureRequiredNativeAttributesExists: function() { } 4852}); 4853ASPx.Ident.scripts.ASPxClientEdit = true; 4854ASPx.focusedEditorName = ""; 4855ASPx.GetFocusedEditor = function() { 4856 var focusedEditor = ASPx.GetControlCollection().Get(ASPx.focusedEditorName); 4857 if(focusedEditor && !focusedEditor.focused){ 4858 ASPx.SetFocusedEditor(null); 4859 focusedEditor = null; 4860 } 4861 return focusedEditor; 4862}; 4863ASPx.SetFocusedEditor = function(editor) { 4864 ASPx.focusedEditorName = editor ? editor.name : ""; 4865}; 4866ASPx.FindAssociatedLabelElements = function(editor) { 4867 var assocciatedLabels = []; 4868 var inputElement = editor.GetInputElement(); 4869 if(!ASPx.IsExists(inputElement) || !inputElement.id) 4870 return assocciatedLabels; 4871 var labels = ASPx.GetNodesByTagName(document, "LABEL"); 4872 for(var i = 0; i < labels.length; i++) { 4873 if(!!labels[i].htmlFor && labels[i].htmlFor === inputElement.id) 4874 assocciatedLabels.push(labels[i]); 4875 } 4876 return assocciatedLabels; 4877}; 4878var DisableAccessibilityExplanatoryTextManager = ASPx.CreateClass(null, { 4879 constructor: function(editor) { 4880 this.editor = editor; 4881 }, 4882 GetAdditionalTextRowId: function() { 4883 return this.editor.name + EditElementSuffix.AccessibilityAdditionalTextRow; 4884 }, 4885 GetErrorTextElement: function () { 4886 return !!this.editor.GetErrorTextCell() ? this.editor.GetErrorTextCell() : this.editor.GetErrorImage(); 4887 }, 4888 GetTextElement: function() { return null; }, 4889 SetCaptionAssociating: function() { }, 4890 UpdateText: function() { }, 4891 UpdateValidationState: function(validationType) { }, 4892 ToggleErrorAlert: function() { }, 4893 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) { } 4894}); 4895var EditAccessibilityExplanatoryTextManager = ASPx.CreateClass(DisableAccessibilityExplanatoryTextManager, { 4896 constructor: function(editor) { 4897 this.constructor.prototype.constructor.call(this, editor); 4898 this.invisibleRowCssClassName = "dxAIR"; 4899 }, 4900 GetTextElement: function() { 4901 var mainElement = this.editor.GetMainElement(); 4902 if(!mainElement) return null; 4903 var explanatoryText = ""; 4904 var explanatoryTextElement = null; 4905 if(!!this.editor.nullText) 4906 explanatoryText = this.editor.nullText; 4907 else if(!!this.editor.helpTextObj) 4908 explanatoryTextElement = this.editor.helpTextObj.helpTextElement; 4909 else if(!!mainElement.title) 4910 explanatoryText = mainElement.title; 4911 if(explanatoryText && mainElement.tagName == "TABLE") { 4912 var assistantElement = this.editor.GetAccessibilityFirstActiveElement(); 4913 if(assistantElement) 4914 ASPx.Attr.Aria.AppendLabel(assistantElement, explanatoryText, true); 4915 } 4916 return explanatoryTextElement; 4917 }, 4918 SetCaptionAssociating: function() { 4919 var captionCell = this.editor.GetCaptionCell(); 4920 if(!captionCell || captionCell.childNodes[0].tagName == "LABEL") return; 4921 var labelElement = captionCell.childNodes[0]; 4922 ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating(this.editor, this.editor.GetAccessibilityFirstActiveElement(), labelElement); 4923 }, 4924 UpdateText: function() { 4925 var additionalTextElement = this.GetTextElement(); 4926 if(ASPx.IsExists(additionalTextElement)) { 4927 var pronounceElement = this.editor.GetAccessibilityFirstActiveElement(); 4928 var hasAnyLabel = !!ASPx.Attr.GetAttribute(pronounceElement, "aria-label") || 4929 !!ASPx.Attr.GetAttribute(pronounceElement, "aria-labelledby") || 4930 ASPx.FindAssociatedLabelElements(this.editor).length > 0; 4931 this.SetOrRemoveText([pronounceElement], additionalTextElement, true, !hasAnyLabel, false); 4932 } 4933 },
4934 UpdateValidationState: function(validationType) { 4935 if(validationType == ValidationType.PersonalOnValueChanged && this.editor.accessibilityHelper) return; 4936 var accessibilityElements = this.editor.GetAccessibilityActiveElements(); 4937 var errorTextElement = this.GetErrorTextElement(); 4938 this.SetOrRemoveText(accessibilityElements, errorTextElement, !this.editor.isValid, false, true); 4939 if(accessibilityElements.length > 0 && !!errorTextElement) { 4940 for(var i = 0; i < accessibilityElements.length; i++) { 4941 if(!ASPx.IsExists(accessibilityElements[i])) continue; 4942 ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], "aria-invalid", !this.editor.isValid); 4943 } 4944 } 4945 }, 4946 ToggleErrorAlert: function() { 4947 var errorTextElement = this.GetErrorTextElement(); 4948 ASPx.SetElementDisplay(errorTextElement, false); 4949 ASPx.Attr.SetAttribute(errorTextElement, 'role', 'alert'); 4950 ASPx.SetElementDisplay(errorTextElement, true); 4951 setTimeout(function() { ASPx.Attr.RemoveAttribute(errorTextElement, 'role'); }, 500); 4952 }, 4953 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) { 4954 var idsRefAttribute = isLabel ? ASPx.Attr.Aria.labelled : ASPx.Attr.Aria.described; 4955 if(!textElement) return; 4956 var textId = !!textElement.id ? textElement.id : textElement.parentNode.id; 4957 for(var i = 0; i < accessibilityElements.length; i++) { 4958 if(!accessibilityElements[i]) continue; 4959 var descRefString = ASPx.Attr.GetAttribute(accessibilityElements[i], idsRefAttribute); 4960 var descRefIds = !!descRefString ? descRefString.split(" ") : [ ]; 4961 var descIndex = descRefIds.indexOf(textId); 4962 if(setText && descIndex == -1) { 4963 if(isFirst) 4964 descRefIds.unshift(textId); 4965 else 4966 descRefIds.push(textId); 4967 } 4968 else if(!setText && descIndex > -1) 4969 descRefIds.splice(descIndex, 1); 4970 ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], idsRefAttribute, descRefIds.join(" ")); 4971 } 4972 } 4973}); 4974ASPx.DisableAccessibilityExplanatoryTextManager = DisableAccessibilityExplanatoryTextManager; 4975ASPx.EditAccessibilityExplanatoryTextManager = EditAccessibilityExplanatoryTextManager; 4976ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating = function(editor, activeElement, labelElement) { 4977 var clickHandler = function(evt) { 4978 if(editor && editor.OnAssociatedLabelClick) 4979 editor.OnAssociatedLabelClick(evt); 4980 else 4981 activeElement.click(); 4982 }; 4983 ASPx.Evt.AttachEventToElement(labelElement, "click", clickHandler); 4984 if(!!editor) { 4985 var hasAriaLabel = !!ASPx.Attr.GetAttribute(activeElement, "aria-label"); 4986 editor.ariaExplanatoryTextManager.SetOrRemoveText([activeElement], labelElement, true, !hasAriaLabel, true); 4987 } 4988}; 4989ASPxClientEdit.ClearEditorsInContainer = function(container, validationGroup, clearInvisibleEditors) { 4990 invalidEditorToBeFocused = null; 4991 ASPx.ProcessEditorsInContainer(container, ASPx.ClearProcessingProc, ASPx.ClearChoiceCondition, validationGroup, clearInvisibleEditors, true ); 4992 ASPxClientEdit.ClearExternalControlsInContainer(container, validationGroup, clearInvisibleEditors, true ); 4993}; 4994ASPxClientEdit.ClearEditorsInContainerById = function(containerId, validationGroup, clearInvisibleEditors) { 4995 var container = document.getElementById(containerId); 4996 this.ClearEditorsInContainer(container, validationGroup, clearInvisibleEditors); 4997}; 4998ASPxClientEdit.ClearGroup = function(validationGroup, clearInvisibleEditors) { 4999 return this.ClearEditorsInContainer(null, validationGroup, clearInvisibleEditors); 5000}; 5001ASPxClientEdit.ValidateEditorsInContainer = function(container, validationGroup, validateInvisibleEditors) { 5002 var summaryCollection; 5003 if(ASPx.Ident.scripts.ASPxClientValidationSummary) { 5004 summaryCollection = ASPx.GetClientValidationSummaryCollection(); 5005 summaryCollection.AllowNewErrorsAccepting(validationGroup); 5006 } 5007 var validationResult = ASPx.ProcessEditorsInContainer(container, ASPx.ValidateProcessingProc, _aspxValidateChoiceCondition, validationGroup, validateInvisibleEditors, 5008 false ); 5009 validationResult.isValid = ASPxClientEdit.ValidateExternalControlsInContainer(container, validationGroup, validateInvisibleEditors, 5010 false ) && validationResult.isValid; 5011 if(typeof(validateInvisibleEditors) == "undefined") 5012 validateInvisibleEditors = false; 5013 if(typeof(validationGroup) == "undefined") 5014 validationGroup = null; 5015 validationResult.isValid = ASPx.GetControlCollection().RaiseValidationCompleted(container, validationGroup, 5016 validateInvisibleEditors, validationResult.isValid, validationResult.firstInvalid, validationResult.firstVisibleInvalid); 5017 if(summaryCollection) 5018 summaryCollection.ForbidNewErrorsAccepting(validationGroup); 5019 if(!validationResult.isValid && !!validationResult.firstVisibleInvalid && validationResult.firstVisibleInvalid.accessibilityCompliant && !validationResult.firstVisibleInvalid.setFocusOnError) { 5020 var accessInvalidControl = validationResult.firstVisibleInvalid; 5021 if(!summaryCollection && !accessInvalidControl.focused) { 5022 var beforeDelayActiveElement = ASPx.GetActiveElement(); 5023 setTimeout(function() { 5024 var currentActiveElement = ASPx.GetActiveElement(); 5025 if(accessInvalidControl.focused || (currentActiveElement != beforeDelayActiveElement && ASPx.Attr.IsExistsAttribute(currentActiveElement, 'role'))) 5026 return; 5027 accessInvalidControl.ariaExplanatoryTextManager.ToggleErrorAlert(); 5028 }, 500); 5029 } 5030 } 5031 return validationResult.isValid; 5032}; 5033ASPxClientEdit.ValidateEditorsInContainerById = function(containerId, validationGroup, validateInvisibleEditors) { 5034 var container = document.getElementById(containerId); 5035 return this.ValidateEditorsInContainer(container, validationGroup, validateInvisibleEditors); 5036};
5037ASPxClientEdit.ValidateGroup = function(validationGroup, validateInvisibleEditors) { 5038 return this.ValidateEditorsInContainer(null, validationGroup, validateInvisibleEditors); 5039}; 5040ASPxClientEdit.AreEditorsValid = function(containerOrContainerId, validationGroup, checkInvisibleEditors) { 5041 var container = typeof(containerOrContainerId) == "string" ? document.getElementById(containerOrContainerId) : containerOrContainerId; 5042 var checkResult = ASPx.ProcessEditorsInContainer(container, ASPx.EditorsValidProcessingProc, _aspxEditorsValidChoiceCondition, validationGroup, 5043 checkInvisibleEditors, false ); 5044 checkResult.isValid = ASPxClientEdit.AreExternalControlsValidInContainer(containerOrContainerId, validationGroup, 5045 checkInvisibleEditors, false ) && checkResult.isValid; 5046 return checkResult.isValid; 5047}; 5048ASPxClientEdit.AreExternalControlsValidInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) { 5049 if(ASPx.Ident.scripts.ASPxClientHtmlEditor) 5050 return ASPxClientHtmlEditor.AreEditorsValidInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors); 5051 return true; 5052}; 5053ASPxClientEdit.ClearExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) { 5054 if(ASPx.Ident.scripts.ASPxClientHtmlEditor) 5055 return ASPxClientHtmlEditor.ClearEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors); 5056 return true; 5057}; 5058ASPxClientEdit.ValidateExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) { 5059 if(ASPx.Ident.scripts.ASPxClientHtmlEditor) 5060 return ASPxClientHtmlEditor.ValidateEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors); 5061 return true; 5062}; 5063ASPxClientEdit.AttachEditorModificationListener = function(handler, predicate) { 5064 var processAction = function(event) { event.AddHandler(handler); }; 5065 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate); 5066}; 5067ASPxClientEdit.DetachEditorModificationListener = function(handler, predicate) { 5068 var processAction = function(event) { event.RemoveHandler(handler); }; 5069 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate); 5070}; 5071ASPxClientEdit.ProcessEditorModificationListener = function(handler, action, predicate) { 5072 ASPx.GetControlCollection().ForEachControl(function(control) { 5073 if(control.GetModifyEvent && predicate(control)) { 5074 if(control.isNative) 5075 control.EnsureRequiredNativeAttributesExists(); 5076 action(control.GetModifyEvent()); 5077 } 5078 }); 5079}; 5080var ASPxClientEditKeyEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 5081 constructor: function(htmlEvent) { 5082 this.constructor.prototype.constructor.call(this); 5083 this.htmlEvent = htmlEvent; 5084 } 5085}); 5086var ASPxClientEditValidationEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 5087 constructor: function(value, errorText, isValid) { 5088 this.constructor.prototype.constructor.call(this); 5089 this.errorText = errorText; 5090 this.isValid = isValid; 5091 this.value = value; 5092 } 5093}); 5094ASPx.ProcessEditorsInContainer = function(container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) { 5095 var allProcessedSuccessfull = true; 5096 var firstInvalid = null; 5097 var firstVisibleInvalid = null; 5098 var invalidEditorToBeFocused = null; 5099 ASPx.GetControlCollection().ForEachControl(function(control) { 5100 var canValidate = ASPx.CanValidateControl(control, container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors); 5101 if(!canValidate) return; 5102 var isSuccess = processingProc(control); 5103 if(!isSuccess) { 5104 allProcessedSuccessfull = false; 5105 if(firstInvalid == null) 5106 firstInvalid = control; 5107 var isVisible = control.IsVisible(); 5108 if(isVisible && firstVisibleInvalid == null) 5109 firstVisibleInvalid = control; 5110 if(control.setFocusOnError && invalidEditorToBeFocused == null && isVisible) 5111 invalidEditorToBeFocused = control; 5112 } 5113 }, this); 5114 if(invalidEditorToBeFocused != null) 5115 invalidEditorToBeFocused.SetFocus(); 5116 return new ASPxValidationResult(allProcessedSuccessfull, firstInvalid, firstVisibleInvalid); 5117}; 5118ASPx.CanValidateControl = function(control, container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) { 5119 var needToProcessRatingControl = window.ASPxClientRatingControl && (control instanceof ASPxClientRatingControl) && processingProc === ASPx.ClearProcessingProc; 5120 var mainElement = control.GetMainElement(); 5121 if(!ASPx.Ident.IsASPxClientEdit(control) && !needToProcessRatingControl) 5122 return false; 5123 if(ASPx.Ident.isDialogInvisibleControl(control) || ASPx.Ident.isBatchEditUnusedEditor(control)) 5124 return false; 5125 if(!processDisabledEditors && !control.GetEnabled()) 5126 return false; 5127 if(!mainElement || (container && !ASPx.GetIsParent(container, mainElement))) 5128 return false; 5129 if(!processInvisibleEditors && !control.IsVisible()) 5130 return false; 5131 if(choiceCondition && !choiceCondition(control, validationGroup)) 5132 return false; 5133 return true; 5134}; 5135var ASPxValidationResult = ASPx.CreateClass(null, { 5136 constructor: function(isValid, firstInvalid, firstVisibleInvalid) { 5137 this.isValid = isValid; 5138 this.firstInvalid = firstInvalid;
5139 this.firstVisibleInvalid = firstVisibleInvalid; 5140 } 5141}); 5142ASPx.ClearChoiceCondition = function(edit, validationGroup) { 5143 return !ASPx.IsExists(validationGroup) || (edit.validationGroup == validationGroup); 5144}; 5145function _aspxValidateChoiceCondition(edit, validationGroup) { 5146 return ASPx.ClearChoiceCondition(edit, validationGroup) && edit.customValidationEnabled; 5147} 5148function _aspxEditorsValidChoiceCondition(edit, validationGroup) { 5149 return _aspxValidateChoiceCondition(edit, validationGroup); 5150} 5151function wrapLostFocusHandler(handler) { 5152 if(ASPx.Browser.Edge) { 5153 return function(name) { 5154 var edit = ASPx.GetControlCollection().Get(name); 5155 if(edit && !ASPx.IsElementVisible(edit.GetMainElement())) 5156 setTimeout(handler, 0, name); 5157 else 5158 handler(name); 5159 }; 5160 } 5161 return handler; 5162} 5163ASPx.EGotFocus = function(name) { 5164 var edit = ASPx.GetControlCollection().Get(name); 5165 if(edit) { 5166 if(edit.isInitialized) { 5167 if(ASPx.Browser.VirtualKeyboardSupported && !edit.ownerListBox) 5168 ASPx.VirtualKeyboardUI.processEditorGotFocus(edit); 5169 else 5170 edit.OnFocus(); 5171 } 5172 else { 5173 var inputElement = edit.GetFocusableInputElement(); 5174 if(inputElement && inputElement === document.activeElement) { 5175 if(ASPx.Browser.Firefox) 5176 window.setTimeout(function() { document.activeElement.blur(); }, 0); 5177 else 5178 document.activeElement.blur(); 5179 } 5180 } 5181 } 5182}; 5183ASPx.ELostFocusCore = function(name) { 5184 var edit = ASPx.GetControlCollection().Get(name); 5185 if(ASPx.Browser.VirtualKeyboardSupported && (!edit || !edit.ownerListBox)) { 5186 var supressLostFocus = ASPx.VirtualKeyboardUI.isInputNativeBluring(); 5187 if(!supressLostFocus) 5188 ASPx.VirtualKeyboardUI.resetFocusedEditorCore(); 5189 else 5190 return; 5191 } 5192 if(edit && edit.focused) { 5193 if(edit.UseDelayedSpecialFocus()) { 5194 if(edit.specialFocusTimer === -1) 5195 edit.specialFocusTimer = ASPx.Timer.SetControlBoundTimeout(function() { edit.OnLostFocus(); }, edit, 30); 5196 } 5197 else { 5198 edit.OnLostFocus(); 5199 } 5200 } 5201}; 5202ASPx.ELostFocus = wrapLostFocusHandler(ASPx.ELostFocusCore); 5203ASPx.EValueChanged = function(name) { 5204 var edit = ASPx.GetControlCollection().Get(name); 5205 if(edit != null) 5206 edit.OnValueChanged(); 5207}; 5208ASPx.VirtualKeyboardUI = (function() { 5209 var result = { 5210 focusedEditor: null, 5211 inputNativeFocusLocked: false, 5212 elementBelongsToEditor: function(element) { 5213 if(!element) return false; 5214 var isBelongsToEditor = false; 5215 ASPx.GetControlCollection().ForEachControl(function(control) { 5216 if(ASPx.Ident.IsASPxClientEdit(control) && control.IsEditorElement(element)) { 5217 isBelongsToEditor = true; 5218 return true; 5219 } 5220 }, this); 5221 return isBelongsToEditor; 5222 }, 5223 elementBelongsToFocusedEditor: function (element) { 5224 return this.focusedEditor && this.focusedEditor.IsEditorElement(element); 5225 }, 5226 onTouchStart: function (evt) { 5227 if (!ASPx.Browser.VirtualKeyboardSupported || this.isGooglePlaceAutocompleteElementTap(evt)) return; 5228 this.setInputNativeFocusLocked(false); 5229 if(this.focusedEditor) 5230 this.focusedEditor.onVirtualKeyboardUITouchStart(evt); 5231 }, 5232 onTouchEnd: function(evt) { 5233 if(ASPx.TouchUIHelper.pointerEnabled) { 5234 if(!window.testingTouchMode) { 5235 if(evt.pointerType !== ASPx.TouchUIHelper.pointerType.Touch) 5236 return; 5237 } 5238 this.processFocusEditorControl(evt); 5239 } else 5240 ASPx.TouchUIHelper.handleFastTapIfRequired(evt, 5241 function() { 5242 this.processFocusEditorControl(evt); 5243 }.aspxBind(this), false); 5244 }, 5245 processFocusEditorControl: function(evt) { 5246 var evtSource = ASPx.Evt.GetEventSource(evt); 5247 var focusedEditorIsTimeEdit = this.focusedEditor && (ASPx.Ident.IsASPxClientTimeEdit && ASPx.Ident.IsASPxClientTimeEdit(this.focusedEditor)); 5248 var focusedTimeEditBelongsToDateEdit = focusedEditorIsTimeEdit && this.focusedEditor.OwnerDateEdit && this.focusedEditor.OwnerDateEdit.GetShowTimeSection(); 5249 if(focusedTimeEditBelongsToDateEdit) { 5250 this.focusedEditor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource); 5251 return; 5252 } 5253 var elementWithNativeFocus = ASPx.GetActiveElement(); 5254 var someEditorInputIsFocused = this.elementBelongsToEditor(elementWithNativeFocus); 5255 var touchKeyboardIsVisible = someEditorInputIsFocused;
5256 var tapOutsideEditorAndInputs = !this.elementBelongsToEditor(evtSource) && !ASPx.Ident.IsFocusableElementRegardlessTabIndex(evtSource) 5257 && !this.isGooglePlaceAutocompleteElementTap(evt); 5258 var blurToHideTouchKeyboard = touchKeyboardIsVisible && tapOutsideEditorAndInputs; 5259 if(blurToHideTouchKeyboard) { 5260 elementWithNativeFocus.blur(); 5261 return; 5262 } 5263 var tapOutsideFocusedEditor = this.focusedEditor && !this.elementBelongsToFocusedEditor(evtSource); 5264 if(tapOutsideFocusedEditor) { 5265 if(!this.elementBelongsToFocusedEditor(elementWithNativeFocus)) 5266 this.resetFocusedEditor(); 5267 } 5268 }, 5269 focusEditor: function(edit) { 5270 if(!edit.focused) { 5271 this.setInputNativeFocusLocked(true); 5272 this.setFocusToEditor(edit); 5273 } else { 5274 edit.ForceRefocusEditor(); 5275 } 5276 }, 5277 setFocusToEditor: function(edit) { 5278 if(ASPx.Browser.MacOSMobilePlatform) { 5279 var timeoutDuration = ASPx.Browser.Chrome ? 250 : 30; 5280 window.setTimeout(function() { 5281 edit.SetFocus(); 5282 }, timeoutDuration); 5283 } else { 5284 edit.SetFocus(); 5285 } 5286 }, 5287 processEditorGotFocus: function(edit) { 5288 if(this.focusedEditor === edit) { 5289 this.focusedEditor.UnlockFocusEvents(); 5290 if(this.focusedEditor.EnsureClearButtonVisibility) 5291 this.focusedEditor.EnsureClearButtonVisibility(); 5292 } 5293 else { 5294 this.setFocusedEditor(edit); 5295 if(this.getInputNativeFocusLocked()) 5296 edit.BlurInputElement(); 5297 } 5298 }, 5299 setFocusedEditor: function(edit) { 5300 this.resetFocusedEditor(); 5301 this.focusedEditor = edit; 5302 this.focusedEditor.Disposed.AddHandler(this.onFocusedEditorDisposed); 5303 this.focusedEditor.OnFocus(); 5304 ASPx.SetFocusedEditor(this.focusedEditor); 5305 }, 5306 isInputNativeBluring: function() { 5307 return this.focusedEditor && this.getInputNativeFocusLocked(); 5308 }, 5309 setInputNativeFocusLocked: function(locked) { 5310 this.inputNativeFocusLocked = locked; 5311 }, 5312 getInputNativeFocusLocked: function() { 5313 return this.inputNativeFocusLocked; 5314 }, 5315 resetFocusedEditor: function() { 5316 if(this.focusedEditor) { 5317 var curEditorName = this.focusedEditor.name; 5318 var focusedEditorInputElementExists = this.focusedEditor.GetInputElement(); 5319 this.resetFocusedEditorCore(); 5320 if(focusedEditorInputElementExists) 5321 ASPx.ELostFocusCore(curEditorName); 5322 } 5323 }, 5324 resetFocusedEditorCore: function() { 5325 if(this.focusedEditor) 5326 this.focusedEditor.Disposed.RemoveHandler(this.onFocusedEditorDisposed); 5327 this.focusedEditor = null; 5328 }, 5329 getFocusedEditor: function() { 5330 return this.focusedEditor; 5331 }, 5332 focusableInputElementIsActive: function(edit) { 5333 var inputElement = edit.GetFocusableInputElement(); 5334 return !!inputElement ? ASPx.GetActiveElement() === inputElement : false; 5335 }, 5336 isGooglePlaceAutocompleteElementTap: function(evt) { 5337 var googlePlaceAutocompleteContainer = ASPx.GetNodeByClassName(document.body, "pac-container", 0); 5338 if(!googlePlaceAutocompleteContainer) 5339 return false; 5340 return ASPx.GetParentByClassName(ASPx.Evt.GetEventSource(evt), "pac-container") != null; 5341 } 5342 }; 5343 result.onFocusedEditorDisposed = function() { 5344 this.resetFocusedEditor(); 5345 }.bind(result); 5346 return result; 5347})(); 5348if(ASPx.Browser.VirtualKeyboardSupported) { 5349 var touchStartEventName = ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerDownEventName : 'touchstart'; 5350 var touchEndEventName = ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerUpEventName : 'touchend'; 5351 ASPx.Evt.AttachEventToDocument(touchStartEventName, function(evt) { ASPx.VirtualKeyboardUI.onTouchStart(evt); }); 5352 ASPx.Evt.AttachEventToDocument(touchEndEventName, function(evt) { ASPx.VirtualKeyboardUI.onTouchEnd(evt); }); 5353} 5354ASPx.Evt.AttachEventToDocument("mousedown", function(evt) { 5355 var editor = ASPx.GetFocusedEditor(); 5356 if(!editor) 5357 return; 5358 var evtSource = ASPx.Evt.GetEventSource(evt); 5359 if(editor.IsClearButtonElement(evtSource)) 5360 return; 5361 if(editor.OwnerDateEdit && editor.OwnerDateEdit.GetShowTimeSection()) { 5362 editor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource); 5363 return; 5364 } 5365 if(editor.ownerListBox && editor.ownerListBox.IsEditorElement(evtSource) && !editor.IsEditorElement(evtSource)) { 5366 editor.ownerListBox.ForceRefocusEditor(evt); 5367 ASPx.SetFocusedEditor(editor.ownerListBox); 5368 return; 5369 } 5370 if(editor.IsEditorElement(evtSource) && !editor.IsElementBelongToInputElement(evtSource)) 5371 editor.ForceRefocusEditor(evt); 5372}); 5373ASPx.Evt.AttachEventToDocument(ASPx.Evt.GetMouseWheelEventName(), function(evt) { 5374 var editor = ASPx.GetFocusedEditor(); 5375 if(editor != null && ASPx.IsExistsElement(editor.GetMainElement()) && editor.focused && editor.receiveGlobalMouseWheel) 5376 editor.OnMouseWheel(evt); 5377}); 5378ASPx.KBSIKeyDown = function(name, evt){ 5379 var control = ASPx.GetControlCollection().Get(name); 5380 if(control != null){ 5381 var isProcessed = control.OnSpecialKeyDown(evt); 5382 if(isProcessed) 5383 return ASPx.Evt.PreventEventAndBubble(evt); 5384 } 5385}; 5386ASPx.KBSIKeyPress = function(name, evt){ 5387 var control = ASPx.GetControlCollection().Get(name); 5388 if(control != null){ 5389 var isProcessed = control.OnSpecialKeyPress(evt); 5390 if(isProcessed) 5391 return ASPx.Evt.PreventEventAndBubble(evt); 5392 } 5393}; 5394ASPx.KBSIKeyUp = function(name, evt){ 5395 var control = ASPx.GetControlCollection().Get(name); 5396 if(control != null){ 5397 var isProcessed = control.OnSpecialKeyUp(evt); 5398 if(isProcessed) 5399 return ASPx.Evt.PreventEventAndBubble(evt); 5400 } 5401}; 5402ASPx.ClearProcessingProc = function(edit) { 5403 return edit.Clear(); 5404}; 5405ASPx.ValidateProcessingProc = function(edit) { 5406 edit.OnValidation(ValidationType.MassValidation); 5407 return edit.GetIsValid(); 5408}; 5409ASPx.EditorsValidProcessingProc = function(edit) { 5410 return edit.GetIsValid(); 5411}; 5412var CheckEditElementHelper = ASPx.CreateClass(ASPx.CheckableElementHelper, { 5413 AttachToMainElement: function(internalCheckBox) { 5414 ASPx.CheckableElementHelper.prototype.AttachToMainElement.call(this, internalCheckBox); 5415 this.AttachToLabelElement(this.GetLabelElement(internalCheckBox.container), internalCheckBox); 5416 }, 5417 AttachToLabelElement: function(labelElement, internalCheckBox) { 5418 var _this = this; 5419 if(labelElement) { 5420 ASPx.Evt.AttachEventToElement(labelElement, "click", 5421 function (evt) { 5422 _this.InvokeClick(internalCheckBox, evt); 5423 } 5424 ); 5425 ASPx.Evt.AttachEventToElement(labelElement, "mousedown", 5426 function (evt) { 5427 internalCheckBox.Refocus(); 5428 } 5429 ); 5430 } 5431 }, 5432 GetLabelElement: function(container) { 5433 var labelElement = ASPx.GetNodeByTagName(container, "LABEL", 0); 5434 if(!labelElement) { 5435 var labelCell = ASPx.GetNodeByClassName(container, "dxichTextCellSys", 0); 5436 labelElement = ASPx.GetNodeByTagName(labelCell, "SPAN", 0); 5437 } 5438 return labelElement; 5439 } 5440}); 5441CheckEditElementHelper.Instance = new CheckEditElementHelper(); 5442var CalendarSharedParameters = ASPx.CreateClass(null, { 5443 updateCalendarCallbackCommand: "UPDATE", 5444 constructor: function() { 5445 this.minDate = null; 5446 this.maxDate = null; 5447 this.disabledDates = []; 5448 this.calendarCustomDraw = false; 5449 this.hasCustomDisabledDatesViaCallback = false; 5450 this.dateRangeMode = false; 5451 this.currentDateEdit = null; 5452 this.DaysSelectingOnMouseOver = new ASPxClientEvent(); 5453 this.VisibleDaysMouseOut = new ASPxClientEvent(); 5454 this.CalendarSelectionChangedInternal = new ASPxClientEvent(); 5455 }, 5456 Assign: function(source) { 5457 this.minDate = source.minDate ? source.minDate : null; 5458 this.maxDate = source.maxDate ? source.maxDate : null; 5459 this.calendarCustomDraw = source.calendarCustomDraw ? source.calendarCustomDraw : false;
5460 this.hasCustomDisabledDatesViaCallback = source.hasCustomDisabledDatesViaCallback ? source.hasCustomDisabledDatesViaCallback : false; 5461 this.disabledDates = source.disabledDates ? source.disabledDates : []; 5462 this.currentDateEdit = source.currentDateEdit ? source.currentDateEdit : null; 5463 }, 5464 GetUpdateCallbackParameters: function() { 5465 var callbackArgs = this.GetCallbackArgs(); 5466 callbackArgs = this.FormatCallbackArg(this.updateCalendarCallbackCommand, callbackArgs); 5467 return callbackArgs; 5468 }, 5469 GetCallbackArgs: function() { 5470 var args = {}; 5471 if(this.minDate) 5472 args.clientMinDate = ASPx.DateUtils.GetInvariantDateString(this.minDate); 5473 if(this.maxDate) 5474 args.clientMaxDate = ASPx.DateUtils.GetInvariantDateString(this.maxDate); 5475 if(args.clientMinDate || args.clientMaxDate) { 5476 var jsonArgs = JSON.stringify(args); 5477 return ASPx.Str.EncodeHtml(jsonArgs); 5478 } 5479 return null; 5480 }, 5481 FormatCallbackArg: function(prefix, arg) { 5482 if(!arg) return prefix; 5483 return [prefix, '|', arg.length, ';', arg, ';'].join(''); 5484 } 5485}); 5486ASPx.CalendarSharedParameters = CalendarSharedParameters; 5487ASPx.ValidationType = ValidationType; 5488ASPx.ErrorFrameDisplay = ErrorFrameDisplay; 5489ASPx.EditElementSuffix = EditElementSuffix; 5490ASPx.ValidationPattern = ValidationPattern; 5491ASPx.RequiredFieldValidationPattern = RequiredFieldValidationPattern; 5492ASPx.RegularExpressionValidationPattern = RegularExpressionValidationPattern; 5493ASPx.CheckEditElementHelper = CheckEditElementHelper; 5494ASPx.IsEditorFocusable = _aspxIsEditorFocusable; 5495window.ASPxClientEditBase = ASPxClientEditBase; 5496window.ASPxClientEdit = ASPxClientEdit; 5497window.ASPxClientEditKeyEventArgs = ASPxClientEditKeyEventArgs; 5498window.ASPxClientEditValidationEventArgs = ASPxClientEditValidationEventArgs; 5499})(); 5500 5501(function() { 5502ASPx.TEInputSuffix = "_I"; 5503ASPx.PasteCheckInterval = 50; 5504ASPx.CheckUserInputInterval = 10; 5505ASPx.TEHelpTextElementSuffix = "_HTE"; 5506ASPx.TempHiddenInputSuffix = "_THI"; 5507var passwordInputClonedSuffix = "_CLND"; 5508var CHROME_AUTOFILL_SELECTOR = ":-webkit-autofill"; 5509var BrowserHelper = { 5510 SAFARI_SYSTEM_CLASS_NAME: "dxeSafariSys", 5511 MOBILE_SAFARI_SYSTEM_CLASS_NAME: "dxeIPadSys", 5512 GetBrowserSpecificSystemClassName: function() { 5513 if(ASPx.Browser.Safari) 5514 return ASPx.Browser.MacOSMobilePlatform ? this.MOBILE_SAFARI_SYSTEM_CLASS_NAME : this.SAFARI_SYSTEM_CLASS_NAME; 5515 return ""; 5516 } 5517}; 5518var focusedNullTextClassName = "dxeFNTextSys"; 5519var NullTextDisplayMode = { 5520 Unfocused: "Unfocused", 5521 UnfocusedAndFocused: "UnfocusedAndFocused" 5522}; 5523ASPx.NullTextDisplayMode = NullTextDisplayMode; 5524var ASPxClientTextEdit = ASPx.CreateClass(ASPxClientEdit, { 5525 constructor: function(name) { 5526 this.constructor.prototype.constructor.call(this, name); 5527 this.isASPxClientTextEdit = true; 5528 this.nullText = ""; 5529 this.nullTextDisplayMode = NullTextDisplayMode.Unfocused; 5530 this.nullTextOnFocusCssText = ""; 5531 this.focusedNullTextTimerID = -1; 5532 this.escCount = 0; 5533 this.raiseValueChangedOnEnter = true; 5534 this.autoResizeWithContainer = false; 5535 this.lastChangedValue = null; 5536 this.autoCompleteAttribute = null; 5537 this.isTextSelectionOnClickEnabled = false; 5538 this.trySelectInputTextOnClick = true; 5539 this.passwordNullTextIntervalID = -1; 5540 this.nullTextInputElement = null; 5541 this.helpText = ""; 5542 this.helpTextObj = null; 5543 this.helpTextStyle = []; 5544 this.externalTableStyle = []; 5545 this.helpTextPosition = ASPx.Position.Right; 5546 this.helpTextMargins = null; 5547 this.helpTextHAlign = ASPxClientTextEditHelpTextHAlign.Left; 5548 this.helpTextVAlign = ASPxClientTextEditHelpTextVAlign.Top; 5549 this.enableHelpTextPopupAnimation = true; 5550 this.helpTextDisplayMode = ASPxClientTextEditHelpTextDisplayMode.Inline; 5551 this.maskInfo = null; 5552 this.maskValueBeforeUserInput = ""; 5553 this.maskValueChangedByPassKeyPressOnAndroid = false; 5554 this.maskPasteTimerID = -1; 5555 this.maskPasteLock = false; 5556 this.maskPasteCounter = 0; 5557 this.maskTextBeforePaste = ""; 5558 this.maskHintHtml = ""; 5559 this.maskHintTimerID = -1; 5560 this.errorCellPosition = ASPx.Position.Right; 5561 this.inlineInitializeInputValue = null; 5562 this.initializeInputValue = null; 5563 this.displayFormat = null; 5564 this.TextChanged = new ASPxClientEvent(); 5565 this.UserInput = new ASPxClientEvent(); 5566 this.userInputEventTimerID = -1; 5567 }, 5568 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) { 5569 ASPx.AddReadOnlyItems(mainElementId, [[[cssClass], [''], ['', 'I']]]); 5570 }, 5571 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) { 5572 ASPx.AddDisabledItems(mainElementId, [[[cssClass], [''], ['', 'I']]]); 5573 }, 5574 SetData: function(data){ 5575 ASPxClientEdit.prototype.SetData.call(this, data);
5576 if(data.maskInfo) { 5577 var maskProperties = data.maskInfo.properties; 5578 var useInvariantCultureDecimalSymbol = maskProperties && maskProperties.useInvariantCultureDecimalSymbol || false; 5579 this.maskInfo = ASPx.MaskInfo.Create(data.maskInfo.maskText, data.maskInfo.dateTimeOnly, data.maskInfo.allowEscapingInEnums, useInvariantCultureDecimalSymbol); 5580 this.SetProperties(data.maskInfo.properties, this.maskInfo); 5581 } 5582 }, 5583 InlineInitialize: function() { 5584 this.SaveInputValue(true); 5585 ASPxClientEdit.prototype.InlineInitialize.call(this); 5586 if(this.maskInfo != null) 5587 this.InitMask(); 5588 this.ApplyBrowserSpecificClassName(); 5589 this.helpTextInitialize(); 5590 }, 5591 Initialize: function(){ 5592 this.SaveInputValue(false); 5593 this.SaveChangedValue(); 5594 ASPxClientEdit.prototype.Initialize.call(this); 5595 if(ASPx.Browser.WebKitFamily) 5596 this.CorrectMainElementWhiteSpaceStyle(); 5597 this.InitializeTextDecoration(); 5598 this.InitializeAutocompleteAttribute(); 5599 if(this.IsValueRestoredByBrowser()) 5600 this.SynchronizeRestoredValue(); 5601 }, 5602 InitializeEvents: function() { 5603 ASPxClientEdit.prototype.InitializeEvents.call(this); 5604 ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keydown", this.OnKeyDown.aspxBind(this)); 5605 ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keyup", this.OnKeyUp.aspxBind(this)); 5606 ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keypress", this.OnKeyPress.aspxBind(this)); 5607 if(this.isTextSelectionOnClickEnabled) { 5608 ASPx.Evt.AttachEventToElement(this.GetInputElement(), ASPx.TouchUIHelper.touchMouseDownEventName, this.OnMouseDown.aspxBind(this)); 5609 ASPx.Evt.AttachEventToElement(this.GetInputElement(), "click", this.OnClick.aspxBind(this)); 5610 } 5611 this.Unload.AddHandler(this.OnUnload.aspxBind(this)); 5612 }, 5613 InitializeTextDecoration: function() { 5614 var input = this.GetInputElement(); 5615 if(input.type === "password" && !this.IsInputPasswordFilledAutomaticallyByChrome()) 5616 this.ToggleTextDecoration(); 5617 }, 5618 IsInputPasswordFilledAutomaticallyByChrome: function() { 5619 if(!ASPx.Browser.Chrome) 5620 return false; 5621 var input = this.GetInputElement(); 5622 return ASPx.ElementMatchesSelector(input, CHROME_AUTOFILL_SELECTOR); 5623 }, 5624 OnMouseDown: function() { 5625 this.trySelectInputTextOnClick = ASPx.GetActiveElement() !== this.GetInputElement() && !this.IsFocusEventsLocked(); 5626 }, 5627 OnClick: function() { 5628 if(this.trySelectInputTextOnClick) { 5629 var input = this.GetInputElement(); 5630 setTimeout(function() { 5631 var inputSelection = ASPx.Selection.GetInfo(input); 5632 if (inputSelection.startPos === inputSelection.endPos) 5633 ASPx.Selection.Set(input); 5634 }, 0); 5635 } 5636 }, 5637 InitializeAutocompleteAttribute: function() { 5638 var input = this.GetInputElement(); 5639 if(this.IsVCardAttributeRequired()) 5640 ASPx.Attr.SetAttribute(input, this.autoCompleteAttribute.name, this.autoCompleteAttribute.value); 5641 else if(this.IsAutocompleteOffRequiredOnInitialize()) 5642 ASPx.Attr.SetAttribute(input, "autocomplete", "off"); 5643 }, 5644 SaveInputValue: function(isInlineInitialize) { 5645 var input = this.GetInputElement(); 5646 if(!input) 5647 return; 5648 var inputValue = input.value; 5649 if(inputValue === null) 5650 inputValue = ""; 5651 if(isInlineInitialize) 5652 this.inlineInitializeInputValue = inputValue; 5653 else 5654 this.initializeInputValue = inputValue; 5655 }, 5656 IsValueRestoredByBrowser: function() { 5657 if(this.displayFormat || this.isNative || this.inlineInitializeInputValue === null || this.initializeInputValue === null) 5658 return false; 5659 if(ASPx.Browser.Chrome) 5660 return this.IsValueRestoredByChrome(); 5661 else if(ASPx.Browser.Firefox) 5662 return this.IsValueRestoredByFirefox(); 5663 else 5664 return this.IsValueRestoredByBrowserCore(); 5665 }, 5666 IsValueRestoredByBrowserCore: function() { 5667 return this.IsValueChangedBeforeInitialize() || this.IsClientValueNotExists() || this.IsValueChangedOnMaskInitialize(); 5668 }, 5669 IsValueRestoredByChrome: function() { 5670 return this.IsValueRestoredByBrowserCore(); 5671 }, 5672 IsValueRestoredByFirefox: function() { 5673 return this.IsValueRestoredByBrowserCore(); 5674 }, 5675 IsValueChangedBeforeInitialize: function() { 5676 return this.inlineInitializeInputValue !== this.initializeInputValue; 5677 }, 5678 IsClientValueNotExists: function() { 5679 return this.inlineInitializeInputValue !== "" && 5680 this.inlineInitializeInputValue !== this.nullText && 5681 this.inlineInitializeInputValue !== this.GetValue() && 5682 this.inlineInitializeInputValue !== this.GetText(); 5683 }, 5684 IsValueChangedOnMaskInitialize: function() { 5685 return this.maskInfo && this.inlineInitializeInputValue !== this.GetInputElement().value; 5686 }, 5687 SynchronizeRestoredValue: function() { 5688 this.SetText(this.initializeInputValue); 5689 }, 5690 AdjustControl: function() { 5691 ASPxClientEdit.prototype.AdjustControl.call(this); 5692 this.ensureAdjustFocusedNullTextElement(); 5693 }, 5694 correctInputElementHeight: function() { 5695 var mainElement = this.GetMainElement(); 5696 if(mainElement) { 5697 var mainElementHeight = mainElement.style.height; 5698 var mainElementHeightSpecified = mainElementHeight && mainElementHeight.indexOf('px') !== -1; 5699 if(mainElementHeightSpecified) { 5700 var inputElement = this.GetInputElement(); 5701 var inputElementHeight = this.getInputElementHeight(); 5702 inputElement.style.height = inputElementHeight + "px"; 5703 if(!ASPx.Ident.IsASPxClientMemo(this)) 5704 inputElement.style.lineHeight = inputElementHeight + "px"; 5705 } 5706 } 5707 }, 5708 getInputElementHeight: function() { 5709 var mainElement = this.GetMainElement(), 5710 inputElement = this.GetInputElement(); 5711 var inputElementHeight = ASPx.PxToInt(mainElement.style.height) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement); 5712 var inputElementContainer = inputElement.parentNode, 5713 inputContainerStyle = ASPx.GetCurrentStyle(inputElementContainer); 5714 inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElementContainer, inputContainerStyle) 5715 + ASPx.GetTopBottomMargins(inputElementContainer, inputContainerStyle); 5716 var mainElementCellspacing = ASPx.GetCellSpacing(mainElement); 5717 if(mainElementCellspacing) 5718 inputElementHeight -= mainElementCellspacing * 2; 5719 var inputStyle = ASPx.GetCurrentStyle(inputElement); 5720 inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElement, inputStyle) 5721 + ASPx.GetTopBottomMargins(inputElement, inputStyle); 5722 return inputElementHeight; 5723 }, 5724 getInputCell: function() { 5725 var inputElement = this.GetInputElement(); 5726 if(inputElement) 5727 return inputElement.parentNode; 5728 }, 5729 ensureOutOfRangeWarningManager: function (minValue, maxValue, defaultMinValue, defaultMaxValue, valueFormatter) { 5730 if (!this.outOfRangeWarningManager) 5731 this.outOfRangeWarningManager = new ASPxOutOfRangeWarningManager(this, minValue, maxValue, defaultMinValue, defaultMaxValue, 5732 this.showOutOfRangeWarningElementAtBottom() ? ASPx.Position.Bottom : ASPx.Position.Right, valueFormatter); 5733 }, 5734 showOutOfRangeWarningElementAtBottom: function() { 5735 return this.hasRightPopupHelpText(); 5736 }, 5737 GetOutOfRangeWarningElementPrevSibling: function() { 5738 return this.GetMainElement(); 5739 }, 5740 helpTextInitialize: function () { 5741 if(this.helpText) { 5742 this.helpTextObj = new ASPxClientTextEditHelpText(this, this.helpTextStyle, this.helpText, this.helpTextPosition, 5743 this.helpTextHAlign, this.helpTextVAlign, this.helpTextMargins, this.enableHelpTextPopupAnimation, this.helpTextDisplayMode); 5744 } 5745 }, 5746 hasPopupHelpText: function() { 5747 return this.helpText && this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup; 5748 }, 5749 hasRightPopupHelpText: function() { 5750 return this.hasPopupHelpText() && this.helpTextPosition === ASPx.Position.Right; 5751 }, 5752 showHelpText: function () { 5753 if(this.helpTextObj) 5754 this.helpTextObj.show(); 5755 }, 5756 hideHelpText: function () { 5757 if(this.helpTextObj) 5758 this.helpTextObj.hide(); 5759 }, 5760 ApplyBrowserSpecificClassName: function() { 5761 var mainElement = this.GetMainElement(); 5762 if(ASPx.IsExistsElement(mainElement)) { 5763 var className = BrowserHelper.GetBrowserSpecificSystemClassName(); 5764 if(className) 5765 mainElement.className += " " + className; 5766 } 5767 }, 5768 CorrectMainElementWhiteSpaceStyle: function() { 5769 var inputElement = this.GetInputElement(); 5770 if(inputElement && inputElement.parentNode) { 5771 if(this.IsElementHasWhiteSpaceStyle(inputElement.parentNode)) 5772 inputElement.parentNode.style.whiteSpace = "normal"; 5773 } 5774 }, 5775 IsElementHasWhiteSpaceStyle: function(element) { 5776 var currentStyle = ASPx.GetCurrentStyle(element); 5777 return currentStyle.whiteSpace == "nowrap" || currentStyle.whiteSpace == "pre"; 5778 }, 5779 FindInputElement: function(){ 5780 return this.isNative ? this.GetMainElement() : ASPx.GetElementById(this.name + ASPx.TEInputSuffix); 5781 }, 5782 DecodeRawInputValue: function(value) { 5783 return value; 5784 }, 5785 GetRawValue: function(value){ 5786 return ASPx.IsExists(this.stateObject) ? this.stateObject.rawValue : null; 5787 }, 5788 SetRawValue: function(value){ 5789 if(ASPx.IsExists(value)) 5790 value = value.toString(); 5791 this.UpdateStateObjectWithObject({ rawValue: value });
5792 }, 5793 SyncRawValue: function() { 5794 if(this.maskInfo != null) 5795 this.SetRawValue(this.maskInfo.GetValue(true)); 5796 else 5797 this.SetRawValue(this.GetInputElement().value); 5798 }, 5799 HasTextDecorators: function() { 5800 return this.nullText != "" || this.displayFormat != null; 5801 }, 5802 CanApplyTextDecorators: function(){ 5803 return !this.focused; 5804 }, 5805 CreateStyleDecoration: function () { 5806 return new ASPx.TextEditorStyleDecoration(this); 5807 }, 5808 CanApplyNullTextDecoration: function() { 5809 var value = this.GetValue(); 5810 return this.IsNull(value); 5811 }, 5812 GetDecoratedText: function(value) { 5813 var result = value; 5814 if(this.IsNull(value) && this.nullText != "" && this.CanApplyNullTextDecoration()) 5815 result = this.nullText; 5816 else if(this.displayFormat != null) 5817 result = this.GetDisplayFormatText(value); 5818 else if(this.maskInfo != null) 5819 result = this.maskInfo.GetText(); 5820 else if(value == null) 5821 result = ""; 5822 return result; 5823 }, 5824 GetDisplayFormatText: function(value) { 5825 return ASPx.Formatter.Format(this.displayFormat, value); 5826 }, 5827 ToggleTextDecoration: function() { 5828 if(this.HasTextDecorators()) { 5829 if(this.focused) { 5830 var input = this.GetInputElement(); 5831 var oldValue = input.value; 5832 var sel = ASPx.Selection.GetExtInfo(input); 5833 this.ToggleTextDecorationCore(); 5834 this.ensureActivateFocusedNullTextMechanism(); 5835 if(oldValue != input.value || !ASPx.Selection.AreEqual(sel, ASPx.Selection.GetExtInfo(input))) { 5836 if(sel.startPos == 0 && sel.endPos == oldValue.length) 5837 sel.endPos = input.value.length; 5838 else 5839 sel.endPos = sel.startPos; 5840 if(!this.accessibilityCompliant || ASPx.GetActiveElement() == input) 5841 this.SetSelectionOnToggleTextDecoration(input, sel); 5842 } 5843 } else { 5844 this.ToggleTextDecorationCore(); 5845 this.ensureDeactivateFocusedNullTextMechanism(); 5846 } 5847 } 5848 }, 5849 SetSelectionOnToggleTextDecoration: function(input, sel) { 5850 ASPx.Selection.Set(input, sel.startPos, sel.endPos); 5851 }, 5852 ToggleTextDecorationCore: function() { 5853 if(this.maskInfo != null) { 5854 this.ApplyMaskInfo(false); 5855 } else { 5856 var input = this.GetInputElement(); 5857 var rawValue = this.GetRawValue(); 5858 var value = this.CanApplyTextDecorators() ? this.GetDecoratedText(rawValue) : rawValue; 5859 if(input.value != value) { 5860 if(input.type == "password") 5861 this.TogglePasswordInputTextDecoration(value); 5862 else 5863 input.value = value; 5864 } 5865 } 5866 }, 5867 GetPasswordNullTextInputElement: function() { 5868 if(!this.isPasswordNullTextInputElementExists()) 5869 this.nullTextInputElement = this.createPasswordNullTextInputElement(); 5870 return this.nullTextInputElement; 5871 }, 5872 createPasswordNullTextInputElement: function() { 5873 var inputElement = this.GetInputElement(), 5874 nullTextInputElement = document.createElement("INPUT"); 5875 nullTextInputElement.className = inputElement.className; 5876 nullTextInputElement.style.cssText = inputElement.style.cssText; 5877 nullTextInputElement.id = inputElement.id + passwordInputClonedSuffix; 5878 nullTextInputElement.type = "text"; 5879 if(ASPx.IsExists(inputElement.tabIndex)) 5880 nullTextInputElement.tabIndex = inputElement.tabIndex; 5881 nullTextInputElement.disabled = inputElement.disabled; 5882 var onFocusEventHandler = function() { 5883 var inputElement = this.GetInputElement(), 5884 nullTextInputElement = this.GetPasswordNullTextInputElement(); 5885 if(inputElement) { 5886 this.LockFocusEvents(); 5887 ASPx.SetElementDisplay(inputElement, true); 5888 if((ASPx.Browser.MacOSMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 14) || (ASPx.Browser.MacOSPlatform && ASPx.Browser.Safari && ASPx.Browser.Version >= 14)) { 5889 ASPx.GetCurrentStyle(inputElement).display; 5890 } 5891 inputElement.focus(); 5892 ASPx.SetElementDisplay(nullTextInputElement, false); 5893 this.ensureAdjustFocusedNullTextElement(); 5894 this.ReplaceAssociatedIdInLabels(nullTextInputElement.id, inputElement.id); 5895 } 5896 }.aspxBind(this); 5897 ASPx.Evt.AttachEventToElement(nullTextInputElement, "focus", onFocusEventHandler); 5898 return nullTextInputElement; 5899 }, 5900 isPasswordNullTextInputElementExists: function() { 5901 return ASPx.IsExistsElement(this.nullTextInputElement); 5902 }, 5903 TogglePasswordNullTextTimeoutChecker: function() { 5904 if(this.passwordNullTextIntervalID < 0) { 5905 var timeoutChecker = function() { 5906 var inputElement = this.GetInputElement(); 5907 if(ASPx.GetControlCollection().GetByName(this.name) !== this || inputElement == null) { 5908 window.clearTimeout(this.passwordNullTextIntervalID); 5909 this.passwordNullTextIntervalID = -1; 5910 return; 5911 } else { 5912 if(!this.focused) { 5913 var passwordNullTextInputElement = this.GetPasswordNullTextInputElement(); 5914 if(passwordNullTextInputElement.value != this.nullText && inputElement.value == "") { 5915 passwordNullTextInputElement.value = this.nullText; 5916 this.SetValue(null); 5917 } 5918 if(inputElement.value != "") { 5919 if(inputElement.style.display == "none") { 5920 this.SetValue(inputElement.value); 5921 this.UnhidePasswordInput(); 5922 } 5923 } else { 5924 if(inputElement.style.display != "none") { 5925 this.SetValue(null); 5926 this.HidePasswordInput(); 5927 } 5928 } 5929 } 5930 else { 5931 var passwordNullTextInputElement = this.GetPasswordNullTextInputElement(); 5932 if(passwordNullTextInputElement.value !== this.nullText && passwordNullTextInputElement.value !== "") { 5933 if(inputElement.value === "") 5934 inputElement.value = passwordNullTextInputElement.value; 5935 passwordNullTextInputElement.value = this.nullText; 5936 } 5937 } 5938 } 5939 }.aspxBind(this); 5940 timeoutChecker(); 5941 this.passwordNullTextIntervalID = window.setInterval(timeoutChecker, 100); 5942 } 5943 }, 5944 TogglePasswordInputTextDecoration: function(value) { 5945 var inputElement = this.GetInputElement(); 5946 var nullTextInputElement = this.GetPasswordNullTextInputElement(); 5947 nullTextInputElement.value = value; 5948 var parentNode = inputElement.parentNode; 5949 if(ASPx.Data.ArrayIndexOf(parentNode.childNodes, nullTextInputElement) < 0) { 5950 ASPx.Attr.ChangeStyleAttribute(nullTextInputElement, "display", "none"); 5951 ASPx.InsertElementAfter(nullTextInputElement, inputElement); 5952 } 5953 this.HidePasswordInput(); 5954 this.TogglePasswordNullTextTimeoutChecker(); 5955 },
5956 HidePasswordInput: function() { 5957 ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "none"); 5958 ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", ""); 5959 this.ReplaceAssociatedIdInLabels(this.GetInputElement().id, this.GetPasswordNullTextInputElement().id); 5960 }, 5961 UnhidePasswordInput: function() { 5962 ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", ""); 5963 ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "none"); 5964 this.ReplaceAssociatedIdInLabels(this.GetPasswordNullTextInputElement().id, this.GetInputElement().id); 5965 }, 5966 ReplaceAssociatedIdInLabels: function(oldId, newId) { 5967 var labels = document.getElementsByTagName("LABEL"); 5968 for(var i = 0; i < labels.length; i++) { 5969 if(labels[i].attributes["for"] && labels[i].attributes["for"].value == oldId) 5970 labels[i].attributes["for"].value = newId; 5971 } 5972 }, 5973 GetFormattedText: function() { 5974 var value = this.GetValue(); 5975 if(this.IsNull(value) && this.nullText != "") 5976 return this.GetText(); 5977 return this.GetDecoratedText(value); 5978 }, 5979 IsNull: function(value) { 5980 return value == null || value === ""; 5981 }, 5982 PopulateStyleDecorationPostfixes: function() { 5983 ASPxClientEdit.prototype.PopulateStyleDecorationPostfixes.call(this); 5984 this.styleDecoration.AddPostfix(ASPx.TEInputSuffix); 5985 if(this.GetInputElement().type === "password" && this.nullText !== "") 5986 this.styleDecoration.AddPostfix(ASPx.TEInputSuffix + passwordInputClonedSuffix); 5987 }, 5988 GetValue: function() { 5989 var value = null; 5990 if(this.maskInfo != null) 5991 value = this.maskInfo.GetValue(); 5992 else if(this.HasTextDecorators()) 5993 value = this.GetRawValue(); 5994 else { 5995 var input = this.GetInputElement(); 5996 value = input ? input.value : null; 5997 } 5998 return (value == "" && this.convertEmptyStringToNull) ? null : value; 5999 }, 6000 SetValue: function(value) { 6001 if(value == null || value === undefined) 6002 value = ""; 6003 if(this.maskInfo != null) { 6004 this.maskInfo.SetValue(value.toString()); 6005 this.ApplyMaskInfo(false); 6006 this.SavePrevMaskValue(); 6007 } 6008 else if(this.HasTextDecorators()) { 6009 this.SetRawValue(value); 6010 this.GetInputElement().value = this.CanApplyTextDecorators() && this.GetInputElement().type != "password" ? this.GetDecoratedText(value) : value; 6011 } 6012 else 6013 this.GetInputElement().value = value; 6014 this.UpdateStyleDecorations(); 6015 this.SaveChangedValue(); 6016 }, 6017 SetVisible: function(visible) { 6018 ASPxClientEdit.prototype.SetVisible.call(this, visible); 6019 if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) { 6020 if(visible) 6021 this.showHelpText(); 6022 else 6023 this.hideHelpText(); 6024 } 6025 }, 6026 UnstretchInputElement: function(){ 6027 var inputElement = this.GetInputElement(); 6028 var mainElement = this.GetMainElement(); 6029 var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement); 6030 if(ASPx.IsExistsElement(mainElement) && ASPx.IsExistsElement(inputElement) && ASPx.IsExists(mainElementCurStyle) && 6031 inputElement.style.width == "100%" && 6032 (mainElementCurStyle.width == "" || mainElementCurStyle.width == "auto")) 6033 inputElement.style.width = ""; 6034 }, 6035 RestoreActiveElement: function(activeElement) { 6036 if(activeElement && activeElement.setActive && activeElement.tagName != "IFRAME") 6037 activeElement.setActive(); 6038 }, 6039 RaiseValueChangedEvent: function() { 6040 var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this); 6041 processOnServer = this.RaiseTextChanged(processOnServer); 6042 return processOnServer; 6043 }, 6044 InitMask: function() { 6045 var rawValue = this.GetRawValue(); 6046 this.SetValue(rawValue.length ? this.DecodeRawInputValue(rawValue) : this.maskInfo.GetValue()); 6047 this.validationPatterns.unshift(new MaskValidationPattern(this.maskInfo.errorText, this.maskInfo)); 6048 }, 6049 SetMaskPasteTimer: function() { 6050 this.ClearMaskPasteTimer(); 6051 this.maskPasteTimerID = ASPx.Timer.SetControlBoundInterval(this.MaskPasteTimerProc, this, ASPx.PasteCheckInterval); 6052 }, 6053 ClearMaskPasteTimer: function() { 6054 this.maskPasteTimerID = ASPx.Timer.ClearInterval(this.maskPasteTimerID); 6055 }, 6056 SavePrevMaskValue: function() { 6057 this.maskValueBeforeUserInput = this.maskInfo.GetValue(); 6058 }, 6059 FillMaskInfo: function() { 6060 var input = this.GetInputElement(); 6061 if(!input) return; 6062 var sel = ASPx.Selection.GetInfo(input); 6063 this.maskInfo.SetCaret(sel.startPos, sel.endPos - sel.startPos); 6064 }, 6065 ApplyMaskInfo: function(applyCaret) { 6066 this.SyncRawValue(); 6067 var input = this.GetInputElement(); 6068 var text = this.GetMaskDisplayText(); 6069 this.maskTextBeforePaste = text; 6070 if(input.value != text) 6071 input.value = text; 6072 if(applyCaret) 6073 ASPx.Selection.Set(input, this.maskInfo.caretPos, this.maskInfo.caretPos + this.maskInfo.selectionLength); 6074 }, 6075 GetMaskDisplayText: function() { 6076 if(!this.focused && this.HasTextDecorators()) 6077 return this.GetDecoratedText(this.maskInfo.GetValue()); 6078 return this.maskInfo.GetText(); 6079 }, 6080 ShouldCancelMaskKeyProcessing: function(htmlEvent, keyDownInfo) { 6081 return ASPx.Evt.IsEventPrevented(htmlEvent); 6082 }, 6083 HandleMaskKeyDown: function(evt) { 6084 var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt); 6085 ASPx.MaskManager.keyCancelled = this.ShouldCancelMaskKeyProcessing(evt, keyInfo); 6086 if(ASPx.MaskManager.keyCancelled) { 6087 ASPx.Evt.PreventEvent(evt); 6088 return; 6089 } 6090 this.maskPasteLock = true; 6091 this.FillMaskInfo(); 6092 var canHandle = ASPx.MaskManager.CanHandleControlKey(keyInfo); 6093 ASPx.MaskManager.savedKeyDownKeyInfo = keyInfo; 6094 if(canHandle) { 6095 ASPx.MaskManager.OnKeyDown(this.maskInfo, keyInfo);
6096 this.ApplyMaskInfo(true); 6097 ASPx.Evt.PreventEvent(evt); 6098 } 6099 ASPx.MaskManager.keyDownHandled = canHandle; 6100 this.maskPasteLock = false; 6101 this.UpdateMaskHintHtml(); 6102 }, 6103 HandleMaskKeyPress: function(evt) { 6104 var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt); 6105 ASPx.MaskManager.keyCancelled = ASPx.MaskManager.keyCancelled || this.ShouldCancelMaskKeyProcessing(evt, ASPx.MaskManager.savedKeyDownKeyInfo); 6106 if(ASPx.MaskManager.keyCancelled) { 6107 ASPx.Evt.PreventEvent(evt); 6108 return; 6109 } 6110 this.maskPasteLock = true; 6111 var printable = ASPx.MaskManager.savedKeyDownKeyInfo != null && ASPx.MaskManager.IsPrintableKeyCode(ASPx.MaskManager.savedKeyDownKeyInfo); 6112 if(printable) { 6113 ASPx.MaskManager.OnKeyPress(this.maskInfo, keyInfo); 6114 this.ApplyMaskInfo(true); 6115 } 6116 if(printable || ASPx.MaskManager.keyDownHandled) 6117 ASPx.Evt.PreventEvent(evt); 6118 this.maskPasteLock = false; 6119 this.UpdateMaskHintHtml(); 6120 }, 6121 MaskPasteTimerProc: function() { 6122 if(this.maskPasteLock || !this.maskInfo) return; 6123 this.maskPasteCounter++; 6124 var inputElement = this.inputElement; 6125 if(!inputElement || this.maskPasteCounter > 40) { 6126 this.maskPasteCounter = 0; 6127 inputElement = this.GetInputElement(); 6128 if(!ASPx.IsExistsElement(inputElement)) { 6129 this.ClearMaskPasteTimer(); 6130 return; 6131 } 6132 } 6133 if(this.maskTextBeforePaste !== inputElement.value) 6134 this.ProcessInputValueChangedOnTimer(); 6135 if(!this.focused) 6136 this.ClearMaskPasteTimer(); 6137 }, 6138 ProcessInputValueChangedOnTimer: function() { 6139 var inputElement = this.inputElement; 6140 var selectionInfo = ASPx.Selection.GetInfo(inputElement); 6141 var startCaretPosition = selectionInfo.startPos; 6142 var endCaretPosition = selectionInfo.endPos; 6143 var oldText = this.maskTextBeforePaste; 6144 var newText = inputElement.value; 6145 var isAndroidBackSpacePressed = this.isAndroidBackSpacePressed(oldText, newText, startCaretPosition, endCaretPosition); 6146 var isLastTypedCharacter = newText.indexOf(oldText) == 0 && newText.length > oldText.length; 6147 if(isAndroidBackSpacePressed || isLastTypedCharacter) { 6148 this.SetText(newText); 6149 this.SetCaretPosition(endCaretPosition); 6150 this.maskValueChangedByPassKeyPressOnAndroid = true; 6151 } else { 6152 this.maskInfo.ProcessPaste(newText, endCaretPosition); 6153 this.ApplyMaskInfo(true); 6154 } 6155 }, 6156 isAndroidBackSpacePressed: function(oldText, newText, startCaretPosition, endCaretPosition) { 6157 if(!ASPx.Browser.AndroidMobilePlatform || startCaretPosition !== endCaretPosition || newText.length >= oldText.length) 6158 return false; 6159 var startSubstring = newText.substring(0, startCaretPosition); 6160 var endSubstring = newText.substring(startCaretPosition); 6161 var isStartSubstringMatches = oldText.indexOf(startSubstring) == 0; 6162 var isEndSubstringMatches = endSubstring == "" || oldText.lastIndexOf(endSubstring) == oldText.length - endSubstring.length; 6163 return isStartSubstringMatches && isEndSubstringMatches; 6164 }, 6165 BeginShowMaskHint: function() { 6166 if(!this.GetReadOnly() && this.maskHintTimerID == -1) 6167 this.maskHintTimerID = window.setInterval(ASPx.MaskHintTimerProc, 500); 6168 }, 6169 EndShowMaskHint: function() { 6170 window.clearInterval(this.maskHintTimerID); 6171 this.maskHintTimerID = -1; 6172 }, 6173 MaskHintTimerProc: function() { 6174 if(this.maskInfo) { 6175 this.FillMaskInfo(); 6176 this.UpdateMaskHintHtml(); 6177 } else { 6178 this.EndShowMaskHint(); 6179 } 6180 }, 6181 UpdateMaskHintHtml: function() { 6182 var hint = this.GetMaskHintElement(); 6183 if(!ASPx.IsExistsElement(hint)) 6184 return; 6185 var html = ASPx.MaskManager.GetHintHtml(this.maskInfo); 6186 if(html == this.maskHintHtml) 6187 return; 6188 if(html != "") { 6189 var mainElement = this.GetMainElement(); 6190 if(ASPx.IsExistsElement(mainElement)) { 6191 hint.innerHTML = html; 6192 hint.style.position = "absolute"; 6193 hint.style.left = ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteX(mainElement), mainElement, true) + "px"; 6194 hint.style.top = (ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteY(mainElement), mainElement, false) + mainElement.offsetHeight + 2) + "px"; 6195 hint.style.display = "block"; 6196 } 6197 } else { 6198 hint.style.display = "none"; 6199 } 6200 this.maskHintHtml = html; 6201 }, 6202 HideMaskHint: function() { 6203 var hint = this.GetMaskHintElement(); 6204 if(ASPx.IsExistsElement(hint)) 6205 hint.style.display = "none"; 6206 this.maskHintHtml = ""; 6207 }, 6208 GetMaskHintElement: function() { 6209 return ASPx.GetElementById(this.name + "_MaskHint"); 6210 }, 6211 OnLostFocus: function() { 6212 if(this.IsAutocompleteOffRequiredOnLostFocus()) 6213 ASPx.Attr.SetAttribute(this.GetInputElement(), "autocomplete", "off"); 6214 ASPxClientEdit.prototype.OnLostFocus.call(this); 6215 }, 6216 OnMouseWheel: function(evt){ 6217 if(this.GetReadOnly() || this.maskInfo == null || !this.maskInfo.allowMouseWheel) 6218 return; 6219 this.FillMaskInfo(); 6220 ASPx.MaskManager.OnMouseWheel(this.maskInfo, ASPx.Evt.GetWheelDelta(evt) < 0 ? -1 : 1);
6221 this.ApplyMaskInfo(true); 6222 ASPx.Evt.PreventEvent(evt); 6223 this.UpdateMaskHintHtml(); 6224 }, 6225 OnBrowserWindowResize: function(e) { 6226 if(!this.autoResizeWithContainer) 6227 this.AdjustControl(); 6228 }, 6229 IsValueChanged: function() { 6230 return this.GetValue() != this.lastChangedValue; 6231 }, 6232 OnKeyDown: function(evt) { 6233 if(this.NeedPreventBrowserUndoBehaviour(evt)) 6234 return ASPx.Evt.PreventEvent(evt); 6235 if(this.RequireHandleMaxlenManually()) { 6236 this.onKeyDownInputValue = this.GetInputElement().value; 6237 var selectionInfo = ASPx.Selection.GetExtInfo(this.GetInputElement()); 6238 this.onKeyDownCursorPos = selectionInfo.startPos; 6239 } 6240 this.escCount = 0; 6241 ASPxClientEdit.prototype.OnKeyDown.call(this, evt); 6242 if(!this.IsRaiseStandardOnChange(evt)) { 6243 if(!this.GetReadOnly() && this.maskInfo != null) 6244 this.HandleMaskKeyDown(evt); 6245 } 6246 }, 6247 IsCtrlZ: function(evt) { 6248 return evt.ctrlKey && !evt.altKey && !evt.shiftKey && (ASPx.Evt.GetKeyCode(evt) == 122 || ASPx.Evt.GetKeyCode(evt) == 90); 6249 }, 6250 NeedPreventBrowserUndoBehaviour: function(evt) { 6251 var inputElement = this.GetInputElement(); 6252 return this.IsCtrlZ(evt) && !!inputElement && !inputElement.value; 6253 }, 6254 OnKeyPress: function(evt) { 6255 ASPxClientEdit.prototype.OnKeyPress.call(this, evt); 6256 if(!this.GetReadOnly() && this.maskInfo != null && !this.IsRaiseStandardOnChange(evt)) 6257 this.HandleMaskKeyPress(evt); 6258 if(this.NeedOnKeyEventEnd(evt, true)) 6259 this.OnKeyEventEnd(evt); 6260 }, 6261 OnKeyUp: function(evt) { 6262 if(ASPx.Browser.Firefox && !this.focused && ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab) 6263 return; 6264 if(this.NeedOnKeyEventEnd(evt, false)) { 6265 var proccessNextCommingPress = ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Alt; 6266 this.OnKeyEventEnd(evt, proccessNextCommingPress); 6267 } 6268 if(this.RequireHandleMaxlenManually()) { 6269 var inputValueLength = this.GetInputElement().value.length; 6270 var maxLength = this.GetInputMaxLength(); 6271 if(inputValueLength > maxLength && inputValueLength > this.onKeyDownInputValue.length) { 6272 this.GetInputElement().value = this.onKeyDownInputValue; 6273 this.SetCaretPosition(this.onKeyDownCursorPos); 6274 } 6275 } 6276 ASPxClientEdit.prototype.OnKeyUp.call(this, evt); 6277 }, 6278 RequireHandleMaxlenManually: function() { 6279 return ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.SamsungAndroidDevice && ASPx.Browser.PlaformMajorVersion < 6 && this.GetInputMaxLength() !== -1; 6280 }, 6281 GetInputMaxLength: function() { 6282 var input = this.GetInputElement(); 6283 if(ASPx.Attr.IsExistsAttribute(input, "maxlength")) 6284 return input.maxLength; 6285 return -1; 6286 }, 6287 NeedOnKeyEventEnd: function(evt, isKeyPress) { 6288 var handleKeyPress = this.maskInfo != null && evt.keyCode == ASPx.Key.Enter; 6289 return handleKeyPress == isKeyPress; 6290 }, 6291 OnKeyEventEnd: function(evt, withDelay){ 6292 if(!this.GetReadOnly()) { 6293 if(this.IsRaiseStandardOnChange(evt)) 6294 this.RaiseStandardOnChange(); 6295 this.SyncRawValueIfHasTextDecorators(withDelay); 6296 } 6297 }, 6298 SyncRawValueIfHasTextDecorators: function(withDelay) { 6299 if(this.HasTextDecorators()) { 6300 if(withDelay) { 6301 window.setTimeout(function() { 6302 this.SyncRawValue(); 6303 }.aspxBind(this), 0); 6304 } else 6305 this.SyncRawValue(); 6306 } 6307 }, 6308 IsRaiseStandardOnChange: function(evt){ 6309 return !this.UseSpecialKeyboardHandling() && this.raiseValueChangedOnEnter && evt.keyCode == ASPx.Key.Enter; 6310 }, 6311 GetFocusSelectAction: function() { 6312 if (this.maskInfo) 6313 return this.maskInfo.IsEmpty() ? null : "start"; 6314 return "all"; 6315 }, 6316 CorrectFocusWhenDisabled: function() { 6317 if(!this.GetEnabled()) { 6318 var inputElement = this.GetInputElement(); 6319 if(inputElement) 6320 inputElement.blur(); 6321 return true; 6322 } 6323 return false; 6324 }, 6325 EnsureShowPopupHelpText: function() { 6326 if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup) 6327 this.showHelpText(); 6328 }, 6329 EnsureHidePopupHelpText: function() { 6330 if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup) 6331 this.hideHelpText(); 6332 }, 6333 OnFocusCore: function() { 6334 if(this.maskInfo != null && !ASPx.GetControlCollection().InCallback()) { 6335 this.TrySetCursorToStartPosition(); 6336 this.SetMaskPasteTimer(); 6337 } 6338 if(this.IsAutocompleteDropDownListRequiredOnFocus()) 6339 ASPx.Attr.RemoveAttribute(this.GetInputElement(), "autocomplete"); 6340 if(this.CorrectFocusWhenDisabled()) 6341 return;
6342 var wasLocked = this.IsFocusEventsLocked(); 6343 ASPxClientEdit.prototype.OnFocusCore.call(this); 6344 if(this.maskInfo != null) { 6345 this.SavePrevMaskValue(); 6346 this.BeginShowMaskHint(); 6347 } 6348 if(!wasLocked) { 6349 this.ToggleTextDecoration(); 6350 this.startUserInputEventTimerIfRequired(); 6351 } 6352 if(this.isPasswordNullTextInputElementExists()) 6353 setTimeout(function() { this.EnsureShowPopupHelpText(); }.aspxBind(this), 0); 6354 else 6355 this.EnsureShowPopupHelpText(); 6356 }, 6357 startUserInputEventTimerIfRequired: function () { 6358 if(this.shouldStartUserInputTimer() && this.userInputEventTimerID === -1) { 6359 this.prevInputValue = this.GetInputElement().value; 6360 this.userInputEventTimerID = ASPx.Timer.SetControlBoundInterval(this.processUserInputEventTimer, this, ASPx.CheckUserInputInterval); 6361 } 6362 }, 6363 shouldStartUserInputTimer: function() { 6364 return !this.UserInput.IsEmpty(); 6365 }, 6366 restartCurrentUserInputTimer: function() { 6367 if(this.userInputEventTimerID !== -1) { 6368 this.processUserInputEventTimer(true); 6369 this.clearUserInputEventTimerIfRequired(); 6370 this.startUserInputEventTimerIfRequired(); 6371 } 6372 }, 6373 clearUserInputEventTimerIfRequired: function () { 6374 if (this.userInputEventTimerID !== -1) 6375 this.userInputEventTimerID = ASPx.Timer.ClearInterval(this.userInputEventTimerID); 6376 }, 6377 processUserInputEventTimer: function(onRestart) { 6378 var currentInputValue = this.GetInputElement().value; 6379 if(currentInputValue !== this.prevInputValue) { 6380 this.onInputChangedOnUserInputTimer(onRestart); 6381 this.prevInputValue = currentInputValue; 6382 } 6383 }, 6384 onInputChangedOnUserInputTimer: function(onRestart) { 6385 if(this.raiseUserInputTimeout > -1) 6386 clearTimeout(this.raiseUserInputTimeout); 6387 this.raiseUserInputTimeout = setTimeout(function() { 6388 this.RaiseUserInput(); 6389 this.raiseUserInputTimeout = -1; 6390 }.bind(this), 0); 6391 }, 6392 ensureFocusedNullTextElement: function () { 6393 if(!this.focusedNullTextElement) 6394 this.createFocusedNullTextElement(); 6395 }, 6396 getFocusedNullTextElementClassName: function() { 6397 return focusedNullTextClassName; 6398 }, 6399 getFocusedNullTextElementTagName: function() { 6400 return "INPUT"; 6401 }, 6402 getCopyFromInputElementStyles: function() { 6403 return [ "paddingLeft", "paddingTop", "paddingRight", "paddingBottom", "borderCollapse", "borderLeftWidth", "borderTopWidth", "borderRightWidth", "borderBottomWidth" ]; 6404 }, 6405 copyStylesFromInputElementToFocusedNullTextElement: function() { 6406 var input = this.GetInputElement(); 6407 var inputStyle = ASPx.GetCurrentStyle(input); 6408 var stylesToCopy = this.getCopyFromInputElementStyles(); 6409 for(var i = 0; i < stylesToCopy.length; i++) 6410 this.focusedNullTextElement.style[stylesToCopy[i]] = inputStyle[stylesToCopy[i]]; 6411 }, 6412 createFocusedNullTextElement: function() { 6413 this.focusedNullTextElement = document.createElement(this.getFocusedNullTextElementTagName()); 6414 this.focusedNullTextElement.value = this.nullText; 6415 this.focusedNullTextElement.className = this.getFocusedNullTextElementClassName(); 6416 this.focusedNullTextElement.tabIndex = -1; 6417 ASPx.SetElementDisplay(this.focusedNullTextElement, false); 6418 if(this.accessibilityCompliant) { 6419 ASPx.Attr.SetAttribute(this.focusedNullTextElement, "aria-label", this.nullText); 6420 ASPx.Attr.SetAttribute(this.focusedNullTextElement, "aria-hidden", true); 6421 } 6422 this.copyStylesFromInputElementToFocusedNullTextElement(); 6423 if (this.nullTextOnFocusCssText) { 6424 var styleSheet = ASPx.GetCurrentStyleSheet(); 6425 this.focusedNullTextElement.className += " " + ASPx.CreateImportantStyleRule(styleSheet, this.nullTextOnFocusCssText); 6426 } 6427 var inputElement = this.GetInputElement(); 6428 inputElement.parentNode.insertBefore(this.focusedNullTextElement, inputElement.nextSibling); 6429 }, 6430 ensureActivateFocusedNullTextMechanism: function() { 6431 if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) { 6432 if(this.IsNull(this.GetValue())) 6433 this.changeFocusedNullTextElementVisibility(true); 6434 this.setFocusedNullTextTimer(); 6435 } 6436 }, 6437 ensureDeactivateFocusedNullTextMechanism: function () { 6438 if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) { 6439 this.clearFocusedNullTextTimer(); 6440 this.changeFocusedNullTextElementVisibility(false); 6441 } 6442 }, 6443 setFocusedNullTextTimer: function () { 6444 if(this.focusedNullTextTimerID === -1) 6445 this.focusedNullTextTimerID = ASPx.Timer.SetControlBoundInterval(this.onFocusedNullTextVisibilityCheck, this, ASPx.PasteCheckInterval); 6446 }, 6447 clearFocusedNullTextTimer: function () { 6448 this.focusedNullTextTimerID = ASPx.Timer.ClearInterval(this.focusedNullTextTimerID); 6449 }, 6450 onFocusedNullTextVisibilityCheck: function (evt) { 6451 if(!this.needShowFocusedNullText() && this.isFocusedNullTextElementDisplayed()) 6452 this.changeFocusedNullTextElementVisibility(false); 6453 else if(this.needShowFocusedNullText() && !this.isFocusedNullTextElementDisplayed()) 6454 this.changeFocusedNullTextElementVisibility(true); 6455 }, 6456 isFocusedNullTextElementDisplayed: function() { 6457 return this.focusedNullTextElement && ASPx.GetElementDisplay(this.focusedNullTextElement); 6458 }, 6459 needShowFocusedNullText: function() { 6460 if(this.focusedNullTextTimerID === -1) 6461 return this.IsNull(this.GetValue()); 6462 var result = this.GetInputElement().value === ""; 6463 if(this.CanApplyNullTextDecoration) 6464 result = result && this.CanApplyNullTextDecoration(); 6465 return result; 6466 }, 6467 changeFocusedNullTextElementVisibility: function (visible) { 6468 this.ensureFocusedNullTextElement(); 6469 ASPx.SetElementDisplay(this.focusedNullTextElement, visible); 6470 if(visible) 6471 this.adjustFocusedNullTextElement(); 6472 }, 6473 getInputElementAbsoluteX: function(input) { 6474 var result = ASPx.GetAbsoluteX(input); 6475 if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 6476 result++; 6477 return result; 6478 }, 6479 getInputElementAbsoluteY: function (input) { 6480 var result = ASPx.GetAbsoluteY(input); 6481 if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 6482 result++; 6483 return result; 6484 }, 6485 adjustFocusedNullTextElement: function() { 6486 var input = this.GetInputElement(); 6487 this.focusedNullTextElement.style.width = input.offsetWidth + "px"; 6488 this.focusedNullTextElement.style.height = input.offsetHeight + "px"; 6489 var inputXPos = this.getInputElementAbsoluteX(input);
6490 var inputYPos = this.getInputElementAbsoluteY(input); 6491 ASPx.SetAbsoluteX(this.focusedNullTextElement, inputXPos); 6492 ASPx.SetAbsoluteY(this.focusedNullTextElement, inputYPos); 6493 var shiftByX = inputXPos - ASPx.GetAbsoluteX(this.focusedNullTextElement); 6494 var shiftByY = inputYPos - ASPx.GetAbsoluteY(this.focusedNullTextElement); 6495 if (shiftByX !== 0) 6496 this.focusedNullTextElement.style.left = ASPx.PxToFloat(this.focusedNullTextElement.style.left) + shiftByX + "px"; 6497 if (shiftByY !== 0) 6498 this.focusedNullTextElement.style.top = ASPx.PxToFloat(this.focusedNullTextElement.style.top) + shiftByY + "px"; 6499 }, 6500 ensureAdjustFocusedNullTextElement: function () { 6501 if(this.isFocusedNullTextElementDisplayed()) 6502 this.adjustFocusedNullTextElement(this.focusedNullTextElement); 6503 }, 6504 TrySetCursorToStartPosition: function() { 6505 var input = this.GetInputElement(); 6506 var sel = ASPx.Selection.GetInfo(input); 6507 if (sel.startPos === sel.endPos && this.IsMaskInfoEmpty()) { 6508 var pos = this.maskInfo.GetFirstNonLiteralPosition(); 6509 var setCaret = ASPx.Selection.SetCaretPosition.bind(this, input, pos); 6510 setTimeout(function() { 6511 if (document.activeElement === input) { 6512 setCaret(); 6513 setTimeout(setCaret, 50); 6514 } 6515 }, 0); 6516 } 6517 }, 6518 IsMaskInfoEmpty: function() { 6519 return this.maskInfo.IsEmpty(); 6520 }, 6521 OnLostFocusCore: function() { 6522 var wasLocked = this.IsFocusEventsLocked(); 6523 ASPxClientEdit.prototype.OnLostFocusCore.call(this); 6524 if(this.maskInfo != null) { 6525 this.EndShowMaskHint(); 6526 this.HideMaskHint(); 6527 if(this.maskInfo.ApplyFixes(null)) 6528 this.ApplyMaskInfo(false); 6529 this.RaiseStandardOnChange(); 6530 } 6531 if(!wasLocked) { 6532 this.clearUserInputEventTimerIfRequired(); 6533 this.ToggleTextDecoration(); 6534 } 6535 this.escCount = 0; 6536 this.EnsureHidePopupHelpText(); 6537 }, 6538 SetFocus: function() { 6539 if(this.isPasswordNullTextInputElementExists()) { 6540 this.GetPasswordNullTextInputElement().focus(); 6541 } else { 6542 ASPxClientEdit.prototype.SetFocus.call(this); 6543 } 6544 }, 6545 OnValueChanged: function() { 6546 if(this.maskInfo != null) { 6547 if(!this.maskValueChangedByPassKeyPressOnAndroid && this.maskInfo.GetValue() == this.maskValueBeforeUserInput && !this.IsValueChangeForced()) 6548 return; 6549 if(this.maskValueChangedByPassKeyPressOnAndroid) 6550 this.maskValueChangedByPassKeyPressOnAndroid = false; 6551 this.SavePrevMaskValue(); 6552 } 6553 if(this.HasTextDecorators()) 6554 this.SyncRawValue(); 6555 if(!this.IsValueChanged() && !this.IsValueChangeForced()) 6556 return; 6557 this.SaveChangedValue(); 6558 ASPxClientEdit.prototype.OnValueChanged.call(this); 6559 }, 6560 IsValueChangeForced: function() { 6561 return false; 6562 }, 6563 OnTextChanged: function() { 6564 }, 6565 ForceTextChanged: function() { 6566 this.OnTextChanged(); 6567 }, 6568 SaveChangedValue: function() { 6569 this.lastChangedValue = this.GetValue(); 6570 }, 6571 RaiseStandardOnChange: function(){ 6572 var element = this.GetInputElement(); 6573 if(element && element.onchange) { 6574 element.onchange({ target: this.GetInputElement() }); 6575 } 6576 else if(this.ValueChanged) { 6577 this.ValueChanged.FireEvent(this); 6578 } 6579 }, 6580 RaiseTextChanged: function(processOnServer){ 6581 if(!this.TextChanged.IsEmpty()){ 6582 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 6583 this.TextChanged.FireEvent(this, args); 6584 processOnServer = args.processOnServer; 6585 } 6586 return processOnServer; 6587 }, 6588 RaiseUserInput: function () { 6589 if(!this.UserInput.IsEmpty()) { 6590 var args = new ASPxClientEventArgs(); 6591 this.UserInput.FireEvent(this, args); 6592 } 6593 }, 6594 GetText: function(){ 6595 if(this.maskInfo != null) { 6596 return this.maskInfo.GetText(); 6597 } else { 6598 var value = this.GetValue(); 6599 return value != null ? value : ""; 6600 } 6601 }, 6602 SetText: function (value){ 6603 if(this.maskInfo != null) { 6604 this.maskInfo.SetText(value); 6605 this.ApplyMaskInfo(false); 6606 this.SavePrevMaskValue(); 6607 } else { 6608 this.SetValue(value); 6609 } 6610 }, 6611 SelectAll: function() { 6612 this.SetSelection(0, -1, false); 6613 }, 6614 SetCaretPosition: function(pos) { 6615 var inputElement = this.GetInputElement(); 6616 ASPx.Selection.SetCaretPosition(inputElement, pos); 6617 }, 6618 GetCaretPosition: function() { 6619 var inputElement = this.GetInputElement(); 6620 return ASPx.Selection.GetCaretPosition(inputElement); 6621 }, 6622 SetSelection: function(startPos, endPos, scrollToSelection) { 6623 var inputElement = this.GetInputElement(); 6624 ASPx.Selection.Set(inputElement, startPos, endPos, scrollToSelection, true); 6625 }, 6626 ChangeEnabledAttributes: function(enabled){ 6627 var inputElement = this.GetInputElement(); 6628 if(inputElement){ 6629 this.ChangeInputEnabledAttributes(inputElement, ASPx.Attr.ChangeAttributesMethod(enabled), enabled); 6630 this.ChangeSpecialInputEnabledAttributes(inputElement, ASPx.Attr.ChangeEventsMethod(enabled), true); 6631 this.ChangeInputEnabled(inputElement, enabled, this.GetReadOnly()); 6632 if(this.isPasswordNullTextInputElementExists()) 6633 this.GetPasswordNullTextInputElement().disabled = inputElement.disabled; 6634 } 6635 }, 6636 SetReadOnlyInternal: function(readOnly) { 6637 ASPxClientEdit.prototype.SetReadOnlyInternal.call(this, readOnly); 6638 this.ChangeInputReadOnly(readOnly); 6639 }, 6640 ChangeReadOnlyStateItems: function(readOnly) { 6641 ASPxClientEdit.prototype.ChangeReadOnlyStateItems.call(this, readOnly); 6642 ASPx.GetStateController().SetElementReadOnly(this.GetInputElement(), readOnly); 6643 if(this.isPasswordNullTextInputElementExists()) 6644 ASPx.GetStateController().SetElementReadOnly(this.GetPasswordNullTextInputElement(), readOnly); 6645 }, 6646 ChangeInputReadOnly: function(readOnly) { 6647 var inputElement = this.GetInputElement(); 6648 if(inputElement) 6649 inputElement.readOnly = readOnly || !this.GetEnabled() && this.UseReadOnlyForDisabled(); 6650 }, 6651 ChangeEnabledStateItems: function(enabled){ 6652 if(!this.isNative) { 6653 var sc = ASPx.GetStateController(); 6654 sc.SetElementEnabled(this.GetMainElement(), enabled); 6655 sc.SetElementEnabled(this.GetInputElement(), enabled); 6656 if(this.isPasswordNullTextInputElementExists()) 6657 sc.SetElementEnabled(this.GetPasswordNullTextInputElement(), enabled); 6658 } 6659 }, 6660 ChangeInputEnabled: function(element, enabled, readOnly) { 6661 if(this.UseReadOnlyForDisabled()) 6662 element.readOnly = !enabled || readOnly; 6663 else 6664 element.disabled = !enabled; 6665 }, 6666 ChangeInputEnabledAttributes: function(element, method, enabled) { 6667 method(element, "tabIndex"); 6668 if(!enabled) element.tabIndex = -1; 6669 method(element, "onclick"); 6670 method(element, "onkeydown"); 6671 method(element, "onkeypress"); 6672 method(element, "onkeyup"); 6673 }, 6674 UseReadOnlyForDisabled: function() { 6675 return false; 6676 }, 6677 OnPostFinalization: function(args) {
6678 this.TryRestoreDisabledOnPost(args); 6679 this.TryClearInputTextDecorationOnPost(args); 6680 }, 6681 TryRestoreDisabledOnPost: function(args) { 6682 if(this.GetEnabled() || !this.UseReadOnlyForDisabled() || args.isDXCallback) 6683 return; 6684 var inputElement = this.GetInputElement(); 6685 if(inputElement) { 6686 var inputDisabled = inputElement.disabled; 6687 inputElement.disabled = true; 6688 window.setTimeout(function() { 6689 inputElement.disabled = inputDisabled; 6690 }, 0); 6691 } 6692 }, 6693 GetTempHiddenInputID: function() { 6694 return this.name + ASPx.TempHiddenInputSuffix; 6695 }, 6696 TryClearInputTextDecorationOnPost: function(args) { 6697 if(ASPx.Platform === "NETCORE") 6698 return; 6699 if(this.HasTextDecorators() && !ASPx.IsExists(this.GetValue())) { 6700 var inputElement = this.GetInputElement(); 6701 if(inputElement) { 6702 var name = ASPx.Attr.GetAttribute(inputElement, "name"); 6703 if(name) 6704 this.TryClearInputTextDecorationOnPostCore(inputElement, name); 6705 } 6706 } 6707 }, 6708 TryClearInputTextDecorationOnPostCore: function(inputElement, name) { 6709 var hiddenInput = ASPx.CreateHiddenField(name, this.GetTempHiddenInputID(), inputElement.parentNode); 6710 ASPx.Attr.SetAttribute(inputElement, "data-name", name); 6711 ASPx.Attr.RemoveAttribute(inputElement, "name"); 6712 setTimeout(function() { 6713 ASPx.Attr.SetAttribute(inputElement, "name", name); 6714 ASPx.Attr.RemoveAttribute(inputElement, "data-name"); 6715 ASPx.RemoveElement(hiddenInput); 6716 }, 0); 6717 }, 6718 OnUnload: function() { 6719 var input = this.GetInputElement(); 6720 if(!input) 6721 return; 6722 if(this.IsAutocompleteOffNotRequiredOnUnload()) 6723 ASPx.Attr.RemoveAttribute(input, "autocomplete"); 6724 if(this.focusedNullTextElement) 6725 ASPx.RemoveElement(this.focusedNullTextElement); 6726 }, 6727 IsVCardAttributeRequired: function() { 6728 return this.autoCompleteAttribute && this.autoCompleteAttribute.name !== "autocomplete"; 6729 }, 6730 IsAutocompleteDropDownListRequiredOnFocus: function() { 6731 return !this.autoCompleteAttribute || this.IsVCardAttributeRequired(); 6732 }, 6733 IsAutocompleteOffRequiredOnInitialize: function() { 6734 return !this.isNative && (this.autoCompleteAttribute && this.autoCompleteAttribute.name === "autocomplete" || ASPx.Browser.WebKitFamily); 6735 }, 6736 IsAutocompleteOffRequiredOnLostFocus: function() { 6737 return !this.autoCompleteAttribute && this.IsNullTextVisible() && !this.IsVCardAttributeRequired(); 6738 }, 6739 IsAutocompleteOffNotRequiredOnUnload: function() { 6740 return !this.IsNullTextVisible() || this.IsVCardAttributeRequired() || (this.maskInfo != null && this.GetValue() == null); 6741 }, 6742 IsNullTextVisible: function() { 6743 return this.nullText && !this.GetValue() && !this.GetText(); 6744 }, 6745 GetModifyEvent: function() { 6746 return this.UserInput; 6747 } 6748}); 6749MaskValidationPattern = ASPx.CreateClass(ASPx.ValidationPattern, { 6750 constructor: function(errorText, maskInfo) { 6751 this.constructor.prototype.constructor.call(this, errorText); 6752 this.maskInfo = maskInfo; 6753 }, 6754 EvaluateIsValid: function(value) { 6755 return this.maskInfo.IsValid(); 6756 } 6757}); 6758ASPx.Ident.IsASPxClientTextEdit = function(obj) { 6759 return !!obj.isASPxClientTextEdit; 6760}; 6761var ASPxClientTextBoxBase = ASPx.CreateClass(ASPxClientTextEdit, { 6762 constructor: function(name) { 6763 this.constructor.prototype.constructor.call(this, name); 6764 this.sizingConfig.allowSetHeight = false; 6765 this.sizingConfig.adjustControl = true; 6766 } 6767}); 6768var ASPxClientTextBox = ASPx.CreateClass(ASPxClientTextBoxBase, { 6769 constructor: function(name) { 6770 this.constructor.prototype.constructor.call(this, name); 6771 this.isASPxClientTextBox = true; 6772 this.isCaptchaTextBox = false; 6773 }, 6774 NeedProcessUnload: function() { 6775 return ASPxClientTextBoxBase.prototype.NeedProcessUnload.call(this) && !this.isCaptchaTextBox; 6776 }, 6777 IsValueRestoredByBrowser: function() { 6778 if(this.isCaptchaTextBox) 6779 return this.initializeInputValue !== "" && this.initializeInputValue !== this.nullText; 6780 return ASPxClientTextBoxBase.prototype.IsValueRestoredByBrowser.call(this); 6781 }, 6782 SynchronizeRestoredValue: function() { 6783 if(this.isCaptchaTextBox) 6784 this.SetText(null); 6785 else 6786 ASPxClientTextBoxBase.prototype.SynchronizeRestoredValue.call(this); 6787 }, 6788}); 6789ASPxClientTextBox.Cast = ASPxClientControl.Cast; 6790ASPx.Ident.IsASPxClientTextBox = function(obj) { 6791 return !!obj.isASPxClientTextBox; 6792}; 6793var ASPxClientMemo = ASPx.CreateClass(ASPxClientTextEdit, { 6794 constructor: function(name) { 6795 this.constructor.prototype.constructor.call(this, name); 6796 this.isASPxClientMemo = true; 6797 this.raiseValueChangedOnEnter = false; 6798 this.maxLength = 0; 6799 this.pasteTimerID = -1; 6800 this.pasteTimerActivatorCount = 0; 6801 }, 6802 Initialize: function() { 6803 ASPxClientTextEdit.prototype.Initialize.call(this); 6804 this.SaveChangedValue(); 6805 this.maxLengthRestricted = this.maxLength > 0;
6806 }, 6807 CutString: function() { 6808 var text = this.GetText(); 6809 if(text.length > this.maxLength) { 6810 text = text.substring(0, this.maxLength); 6811 this.SetText(text); 6812 } 6813 }, 6814 EventKeyCodeChangesTheInput: function(evt) { 6815 if(ASPx.IsPasteShortcut(evt)) 6816 return true; 6817 else if(evt.ctrlKey) 6818 return false; 6819 var keyCode = ASPx.Evt.GetKeyCode(evt); 6820 var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu; 6821 var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 6822 return ASPx.Key.Delete < keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Enter || keyCode == ASPx.Key.Space; 6823 }, 6824 OnTextChangingCheck: function() { 6825 if(this.maxLengthRestricted) 6826 this.CutString(); 6827 }, 6828 StartTextChangingTimer: function() { 6829 if(this.maxLengthRestricted) { 6830 if(this.pasteTimerActivatorCount == 0) 6831 this.SetTextChangingTimer(); 6832 this.pasteTimerActivatorCount ++; 6833 } 6834 }, 6835 EndTextChangingTimer: function() { 6836 if(this.maxLengthRestricted) { 6837 this.pasteTimerActivatorCount --; 6838 if(this.pasteTimerActivatorCount == 0) 6839 this.ClearTextChangingTimer(); 6840 } 6841 }, 6842 CollapseEditor: function() { 6843 if(!this.IsAdjustmentRequired()) return; 6844 var mainElement = this.GetMainElement(); 6845 var inputElement = this.GetInputElement(); 6846 if(!ASPx.IsExistsElement(mainElement) || !ASPx.IsExistsElement(inputElement)) 6847 return; 6848 ASPxClientTextEdit.prototype.CollapseEditor.call(this); 6849 var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement); 6850 if(this.heightCorrectionRequired && mainElement && inputElement) { 6851 if(mainElement.style.height == "100%" || mainElementCurStyle.height == "100%") { 6852 mainElement.style.height = "0"; 6853 mainElement.wasCollapsed = true; 6854 } 6855 inputElement.style.height = "0"; 6856 } 6857 }, 6858 SetWidth: function(width) { 6859 ASPxClientTextEdit.prototype.SetWidth.call(this, width); 6860 }, 6861 ClearErrorFrameElementsStyles: function() { 6862 var textarea = this.GetInputElement(); 6863 if(!textarea) 6864 return; 6865 var scrollBarPosition = textarea.scrollTop; 6866 ASPxClientTextEdit.prototype.ClearErrorFrameElementsStyles.call(this); 6867 if(ASPx.Browser.Firefox) 6868 textarea.scrollTop = scrollBarPosition; 6869 }, 6870 OnMouseOver: function() { 6871 this.StartTextChangingTimer(); 6872 }, 6873 OnMouseOut: function() { 6874 this.EndTextChangingTimer(); 6875 }, 6876 OnFocusCore: function() { 6877 this.StartTextChangingTimer(); 6878 ASPxClientTextEdit.prototype.OnFocusCore.call(this); 6879 }, 6880 OnLostFocus: function() { 6881 this.EndTextChangingTimer(); 6882 ASPxClientTextEdit.prototype.OnLostFocus.call(this); 6883 }, 6884 OnKeyDown: function(evt) { 6885 if(this.NeedPreventBrowserUndoBehaviour(evt)) 6886 return ASPx.Evt.PreventEvent(evt); 6887 if(this.maxLengthRestricted){ 6888 var selection = ASPx.Selection.GetInfo(this.GetInputElement()); 6889 var noCharToReplace = selection.startPos == selection.endPos; 6890 if(this.GetText().length >= this.maxLength && noCharToReplace && this.EventKeyCodeChangesTheInput(evt)) { 6891 return ASPx.Evt.PreventEvent(evt); 6892 } 6893 } 6894 ASPxClientEdit.prototype.OnKeyDown.call(this, evt); 6895 }, 6896 SetTextChangingTimer: function() { 6897 this.pasteTimerID = ASPx.Timer.SetControlBoundInterval(this.OnTextChangingCheck, this, ASPx.PasteCheckInterval); 6898 }, 6899 ClearTextChangingTimer: function() { 6900 this.pasteTimerID = ASPx.Timer.ClearInterval(this.pasteTimerID); 6901 }, 6902 getFocusedNullTextElementTagName: function() { 6903 return "TEXTAREA"; 6904 }, 6905 getCopyFromInputElementStyles: function() { 6906 var result = ASPxClientTextEdit.prototype.getCopyFromInputElementStyles.call(this); 6907 result.push("resize"); 6908 return result; 6909 } 6910}); 6911ASPxClientMemo.Cast = ASPxClientControl.Cast; 6912ASPx.Ident.IsASPxClientMemo = function(obj) { return obj && !!obj.isASPxClientMemo; }; 6913var CLEAR_BUTTON_INDEX = -100; 6914var HIDE_CONTENT_CSS_CLASS_NAME = "dxHideContent"; 6915var setContentVisibility = function(clearButtonElement, value) { 6916 var action = value ? ASPx.RemoveClassNameFromElement : ASPx.AddClassNameToElement; 6917 action(clearButtonElement, HIDE_CONTENT_CSS_CLASS_NAME); 6918}; 6919var CLEAR_BUTTON_DISPLAY_MODE = { 6920 AUTO: 'Auto', 6921 ALWAYS: 'Always', 6922 NEVER: 'Never', 6923 ON_HOVER: 'OnHover' 6924}; 6925var AccessibilityFocusedButtonClassName = "dxAFB"; 6926var ButtonEditButtonLeftSystemClassName = "dxeButtonLeft"; 6927var ASPxClientButtonEditBase = ASPx.CreateClass(ASPxClientTextBoxBase, { 6928 constructor: function(name) { 6929 this.constructor.prototype.constructor.call(this, name); 6930 this.allowUserInput = true; 6931 this.isValueChanging = false; 6932 this.allowMouseWheel = true; 6933 this.isMouseOver = false; 6934 this.buttonCount = 0; 6935 this.emptyValueMaskDisplayText = ""; 6936 this.clearButtonDisplayMode = CLEAR_BUTTON_DISPLAY_MODE.AUTO; 6937 this.forceShowClearButtonAlways = false; 6938 this.recoverClearButtonVisibility = false; 6939 this.ButtonClick = new ASPxClientEvent(); 6940 }, 6941 Initialize: function() { 6942 ASPxClientTextBoxBase.prototype.Initialize.call(this); 6943 this.EnsureEmptyValueMaskDisplayText(); 6944 if(this.HasClearButton()) 6945 this.InitializeClearButton(); 6946 this.InitAccessibilityCompliant(); 6947 }, 6948 InlineInitialize: function() { 6949 ASPxClientTextBoxBase.prototype.InlineInitialize.call(this); 6950 if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.AUTO) { 6951 this.clearButtonDisplayMode = this.IsClearButtonVisibleAuto() || this.forceShowClearButtonAlways ? 6952 CLEAR_BUTTON_DISPLAY_MODE.ALWAYS : CLEAR_BUTTON_DISPLAY_MODE.NEVER; 6953 } 6954 this.EnsureClearButtonVisibility(); 6955 }, 6956 InitializeClearButton: function() { 6957 if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER) { 6958 ASPx.Evt.AttachMouseEnterToElement(this.GetHoverElementToShowClearButton(), this.OnMouseOver.aspxBind(this), this.OnMouseOut.aspxBind(this)); 6959 } 6960 }, 6961 GetHoverElementToShowClearButton: function() { 6962 return this.GetMainElement(); 6963 }, 6964 IsClearButtonVisibleAuto: function() { 6965 return ASPx.Browser.MobileUI; 6966 }, 6967 SetEnabled: function(enabled) { 6968 ASPxClientTextBoxBase.prototype.SetEnabled.call(this, enabled); 6969 this.EnsureClearButtonVisibility(); 6970 }, 6971 EnsureEmptyValueMaskDisplayText: function() { 6972 if(this.maskInfo && this.HasClearButton()) { 6973 var savedText = this.maskInfo.GetText(); 6974 this.maskInfo.SetText(""); 6975 this.emptyValueMaskDisplayText = this.maskInfo.GetText(); 6976 this.maskInfo.SetText(savedText); 6977 } 6978 }, 6979 GetButton: function(number) { 6980 return this.GetChildElement("B" + number); 6981 }, 6982 GetCustomButtonCollection: function() { 6983 var buttonElements = []; 6984 for(var i = 0; i < this.buttonCount; i++) { 6985 var button = this.GetButton(i); 6986 if(!!button) 6987 buttonElements.push(button); 6988 } 6989 return buttonElements; 6990 }, 6991 GetButtonCollection: function() { 6992 var buttonElements = []; 6993 var clearButton = this.GetClearButton(); 6994 if(!!clearButton) 6995 buttonElements.push(clearButton); 6996 return buttonElements.concat(this.GetCustomButtonCollection()); 6997 }, 6998 GetAccessibilityAnchor: function(buttonElement) { 6999 var firstChild = buttonElement.firstElementChild; 7000 var isExistsAnchorElement = ASPx.Attr.GetAttribute(firstChild, "role") === "button"; 7001 return isExistsAnchorElement ? firstChild : null; 7002 }, 7003 GetButtonByAccessibilityAnchor: function(anchorElement) { 7004 return anchorElement.parentNode; 7005 }, 7006 SetAccessibilityAnchorEnabled: function(buttonElement, enabled) { 7007 var anchorElement = this.GetAccessibilityAnchor(buttonElement); 7008 if(ASPx.IsExists(anchorElement)) 7009 ASPx.Attr.SetOrRemoveAttribute(anchorElement, "tabindex", enabled ? "0" : ""); 7010 }, 7011 InitAccessibilityCompliant: function() { 7012 if(!this.accessibilityCompliant) return; 7013 var buttonElements = this.GetButtonCollection(); 7014 var labelElements = ASPx.FindAssociatedLabelElements(this); 7015 for(var i = 0; i < buttonElements.length; i++) { 7016 this.InitAccessibilityAnchor(this.GetAccessibilityAnchor(buttonElements[i]), labelElements); 7017 ASPx.Evt.AttachEventToElement(buttonElements[i], "mousedown", this.Button_MouseDown.bind(this)); 7018 } 7019 }, 7020 InitAccessibilityAnchor: function(anchorElement, labelElements) { 7021 if(!ASPx.IsExists(anchorElement)) 7022 return; 7023 for(var i = 0; i < labelElements.length; i++) 7024 this.ariaExplanatoryTextManager.SetOrRemoveText([anchorElement], labelElements[i], true, false, false); 7025 this.InitAccessibilityAnchorEvents(anchorElement); 7026 }, 7027 InitAccessibilityAnchorEvents: function(anchorElement) { 7028 ASPx.Evt.AttachEventToElement(anchorElement, "keydown", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this)); 7029 ASPx.Evt.AttachEventToElement(anchorElement, "keyup", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this)); 7030 ASPx.Evt.AttachEventToElement(anchorElement, "focus", function(evt) { this.OnButtonGotFocus(evt); }.aspxBind(this)); 7031 ASPx.Evt.AttachEventToElement(anchorElement, "blur", function(evt) { this.OnButtonLostFocus(evt); }.aspxBind(this)); 7032 }, 7033 EmulateButtonMouseEvent: function(sourceElement) { 7034 var buttonElement = this.GetButtonByAccessibilityAnchor(sourceElement); 7035 var mouseEvent = buttonElement.onclick || buttonElement.onmousedown || buttonElement.ontouchstart || buttonElement.onpointerdown; 7036 var emulateMouseEvtArgs = { button: 0, which: 1, srcElement: buttonElement, target: buttonElement }; 7037 if(!!mouseEvent) { 7038 ASPx.Attr.SetAttribute(sourceElement, "aria-pressed", true); 7039 setTimeout(function() { 7040 mouseEvent(emulateMouseEvtArgs); 7041 ASPx.Attr.RemoveAttribute(sourceElement, "aria-pressed"); 7042 }, 300); 7043 } 7044 }, 7045 OnButtonKeysHandling: function(evt) { 7046 var isKeyUp = evt.type == "keyup"; 7047 var keyCode = ASPx.Evt.GetKeyCode(evt); 7048 var sourceElement = ASPx.Evt.GetEventSource(evt); 7049 if((keyCode == ASPx.Key.Space && isKeyUp) || (keyCode == ASPx.Key.Enter && !isKeyUp)) 7050 this.EmulateButtonMouseEvent(sourceElement); 7051 if(keyCode != ASPx.Key.Tab) 7052 ASPx.Evt.PreventEventAndBubble(evt); 7053 return false; 7054 }, 7055 OnButtonGotFocus: function(evt) { 7056 this.UnlockFocusEvents(); 7057 var editor = ASPx.GetControlCollection().Get(this.name); 7058 var sourceElement = ASPx.Evt.GetEventSource(evt);
7059 if(!!editor && !editor.CorrectAccessibilityButtonFocus(sourceElement)) { 7060 var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement); 7061 ASPx.AddClassNameToElement(buttonElement, this.GetAccessibilityFocusedButtonClassName()); 7062 ASPx.EGotFocus(editor.name); 7063 } 7064 }, 7065 OnButtonLostFocus: function(evt) { 7066 var editor = ASPx.GetControlCollection().Get(this.name); 7067 var sourceElement = ASPx.Evt.GetEventSource(evt); 7068 if(!!editor) { 7069 var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement); 7070 ASPx.RemoveClassNameFromElement(buttonElement, this.GetAccessibilityFocusedButtonClassName()); 7071 } 7072 setTimeout(function() { 7073 if(!!editor && !editor.IsEditorElement(ASPx.GetActiveElement())) { 7074 ASPx.ELostFocus(editor.name); 7075 } 7076 }.aspxBind(this), 0); 7077 }, 7078 Button_MouseDown: function(evt) { 7079 var editor = ASPx.GetControlCollection().Get(this.name); 7080 if(!!editor) { 7081 var sourceElement = ASPx.Evt.GetEventSource(evt); 7082 if(document.activeElement !== sourceElement) 7083 this.LockFocusEvents(); 7084 } 7085 }, 7086 ForceRefocusEditor: function(evt, isNativeFocus) { 7087 if(this.accessibilityCompliant) { 7088 var srcElement = ASPx.Evt.GetEventSource(evt); 7089 var customButtons = this.GetCustomButtonCollection(); 7090 for(var i = 0; i < customButtons.length; i++) 7091 if(customButtons[i] == srcElement || ASPx.GetIsParent(customButtons[i], srcElement)) 7092 return; 7093 } 7094 ASPxClientEdit.prototype.ForceRefocusEditor.call(this, evt, isNativeFocus); 7095 if(this.GetInputElement().type == "password") { 7096 window.setTimeout(function() { this.GetInputElement().focus(); }.bind(this), 0); 7097 } 7098 },
7099 CorrectAccessibilityButtonFocus: function(sourceElement) { 7100 if(ASPx.Attr.IsExistsAttribute(sourceElement, "tabindex")) 7101 return false; 7102 setTimeout(function() { 7103 var buttonElements = this.GetButtonCollection(); 7104 for(var i = 0; i < buttonElements.length; i++) 7105 if(ASPx.GetIsParent(buttonElements[i], sourceElement)) 7106 this.GetAccessibilityAnchor(buttonElements[i]).focus(); 7107 }.aspxBind(this), 0); 7108 return true; 7109 }, 7110 OnKeyDown: function(evt) { 7111 if(this.NeedEnsureClearButtonVisibilityOnKeyDown()) { 7112 var hasClearButtonOnHover = this.HasClearButton() && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER; 7113 this.recoverClearButtonVisibility = hasClearButtonOnHover && ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Tab && !evt.shiftKey; 7114 } 7115 if(this.accessibilityCompliant) { 7116 var hasVisibleFocusableButtonToTheRIGHT = this.GetButtonCollection().some(function(buttonElement) { 7117 return this.IsButtonVisible(buttonElement) 7118 && !ASPx.ElementHasCssClass(buttonElement, ButtonEditButtonLeftSystemClassName) 7119 && this.GetAccessibilityAnchor(buttonElement) !== null; 7120 }, this); 7121 var hasVisibleFocusableButtonToTheLEFT = this.GetButtonCollection().some(function(buttonElement) { 7122 return this.IsButtonVisible(buttonElement) 7123 && ASPx.ElementHasCssClass(buttonElement, ButtonEditButtonLeftSystemClassName) 7124 && this.GetAccessibilityAnchor(buttonElement) !== null; 7125 }, this); 7126 if((ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab && !evt.shiftKey && hasVisibleFocusableButtonToTheRIGHT) || 7127 (ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab && evt.shiftKey && hasVisibleFocusableButtonToTheLEFT )) 7128 this.LockFocusEvents(); 7129 } 7130 ASPxClientTextBoxBase.prototype.OnKeyDown.call(this, evt); 7131 }, 7132 NeedEnsureClearButtonVisibilityOnKeyDown: function() { 7133 return this.accessibilityCompliant; 7134 }, 7135 GetAccessibilityFocusedButtonClassName: function() { 7136 return AccessibilityFocusedButtonClassName; 7137 }, 7138 SetButtonVisible: function(number, value) { 7139 var button = this.GetButton(number); 7140 if(!button) 7141 return; 7142 var isClearButton = number === CLEAR_BUTTON_INDEX; 7143 var visibilityModifier = isClearButton ? setContentVisibility : ASPx.SetElementDisplay; 7144 if(isClearButton && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS && this.accessibilityCompliant && this.enabled)
7145 this.SetAccessibilityAnchorEnabled(button, value); 7146 visibilityModifier(button, value); 7147 }, 7148 GetButtonVisible: function(number) { 7149 var button = this.GetButton(number); 7150 return this.IsButtonVisible(button); 7151 }, 7152 IsButtonVisible: function(button) { 7153 var result = false; 7154 if(button) { 7155 if(this.IsClearButtonElement(button) && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS) 7156 result = !ASPx.ElementHasCssClass(button, this.GetHideContentCssClassName()); 7157 else 7158 result = ASPx.IsElementVisible(button); 7159 } 7160 return result; 7161 }, 7162 GetHideContentCssClassName: function() { 7163 return HIDE_CONTENT_CSS_CLASS_NAME; 7164 }, 7165 ProcessInternalButtonClick: function(buttonIndex) { 7166 return false; 7167 }, 7168 OnButtonClick: function(number) { 7169 var processOnServer = this.RaiseButtonClick(number); 7170 if(!this.ProcessInternalButtonClick(number) && processOnServer) 7171 this.SendPostBack('BC:' + number); 7172 }, 7173 GetLastSuccesfullValue: function() { 7174 return this.lastChangedValue; 7175 }, 7176 OnClear: function() { 7177 this.startUserInputEventTimerIfRequired(); 7178 this.ClearEditorValueAndForceOnChange(); 7179 this.ForceRefocusEditor(null, true); 7180 window.setTimeout(this.EnsureClearButtonVisibility.aspxBind(this), 0); 7181 }, 7182 ClearEditorValueAndForceOnChange: function() { 7183 if(this.GetReadOnly() || !this.GetButtonVisible(CLEAR_BUTTON_INDEX)) 7184 return; 7185 var raiseOnChange = this.ClearEditorValueByClearButton(); 7186 if(raiseOnChange) 7187 this.ForceStandardOnChange(); 7188 }, 7189 ClearEditorValueByClearButton: function() { 7190 var prevValue = this.GetLastSuccesfullValue(); 7191 this.ClearEditorValueByClearButtonCore(); 7192 return prevValue !== this.GetValue(); 7193 }, 7194 ClearEditorValueByClearButtonCore: function() { 7195 this.Clear(); 7196 this.GetInputElement().value = ''; 7197 }, 7198 ForceStandardOnChange: function() { 7199 this.forceValueChanged = true; 7200 this.RaiseStandardOnChange(); 7201 this.forceValueChanged = false; 7202 }, 7203 IsValueChangeForced: function() { 7204 return this.forceValueChanged || ASPxClientTextBoxBase.prototype.IsValueChangeForced.call(this); 7205 }, 7206 IsValueChanging: function() { return this.isValueChanging; }, 7207 StartValueChanging: function() { this.isValueChanging = true; }, 7208 EndValueChanging: function() { this.isValueChanging = false; }, 7209 IsClearButtonElement: function(element) { 7210 return ASPx.GetIsParent(this.GetClearButton(), element); 7211 }, 7212 OnFocusCore: function() { 7213 if(this.accessibilityCompliant) { 7214 if(this.focused) 7215 this.UnlockFocusEvents(); 7216 else 7217 ASPxClientTextBoxBase.prototype.OnFocusCore.call(this); 7218 } 7219 else 7220 ASPxClientTextBoxBase.prototype.OnFocusCore.call(this); 7221 this.EnsureClearButtonVisibility(); 7222 }, 7223 OnLostFocusCore: function() { 7224 ASPxClientTextBoxBase.prototype.OnLostFocusCore.call(this); 7225 this.EnsureClearButtonVisibility(); 7226 this.recoverClearButtonVisibility = false; 7227 }, 7228 GetClearButton: function() { 7229 return this.GetButton(CLEAR_BUTTON_INDEX); 7230 }, 7231 HasClearButton: function() { 7232 return !!this.GetClearButton(); 7233 }, 7234 RequireShowClearButton: function() { 7235 return !this.IsClearButtonDisabled() && !this.IsClearButtonNotRequired() && this.RequireShowClearButtonInternal(); 7236 }, 7237 IsClearButtonDisabled: function() { 7238 return !this.clientEnabled || !this.HasClearButton() || this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.NEVER; 7239 }, 7240 IsClearButtonNotRequired: function() { 7241 return !this.IsFocused() && !this.isMouseOver && this.clearButtonDisplayMode !== CLEAR_BUTTON_DISPLAY_MODE.ALWAYS && !this.recoverClearButtonVisibility; 7242 }, 7243 RequireShowClearButtonInternal: function () { 7244 return this.IsFocused() && this.RequireShowClearButtonCore() || !this.IsNullState(); 7245 }, 7246 RequireShowClearButtonCore: function() { 7247 var inputText = this.GetInputElement().value; 7248 return inputText !== this.GetEmptyValueDisplayText(); 7249 }, 7250 IsFocused: function() { 7251 return this === ASPx.GetFocusedEditor(); 7252 }, 7253 IsNullState: function() { 7254 var value = this.GetValue(); 7255 return this.IsNull(value) || value === this.GetEmptyValueDisplayText(); 7256 }, 7257 GetEmptyValueDisplayText: function() { 7258 return this.maskInfo ? this.emptyValueMaskDisplayText : ""; 7259 }, 7260 EnsureClearButtonVisibility: function() { 7261 this.SetButtonVisible(CLEAR_BUTTON_INDEX, this.RequireShowClearButton()); 7262 }, 7263 OnMouseOver: function() { 7264 this.isMouseOver = true; 7265 this.EnsureClearButtonVisibility(); 7266 }, 7267 OnMouseOut: function() { 7268 this.isMouseOver = false; 7269 this.EnsureClearButtonVisibility(); 7270 }, 7271 OnKeyPress: function(evt) { 7272 if(this.allowUserInput) 7273 ASPxClientTextBoxBase.prototype.OnKeyPress.call(this, evt); 7274 }, 7275 OnKeyEventEnd: function(evt, withDelay) { 7276 ASPxClientTextBoxBase.prototype.OnKeyEventEnd.call(this, evt, withDelay); 7277 this.EnsureClearButtonVisibility(); 7278 }, 7279 RaiseButtonClick: function(number){
7280 var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ButtonClick"); 7281 if(!this.ButtonClick.IsEmpty()){ 7282 var args = new ASPxClientButtonEditClickEventArgs(processOnServer, number); 7283 this.ButtonClick.FireEvent(this, args); 7284 processOnServer = args.processOnServer; 7285 } 7286 return processOnServer; 7287 }, 7288 ChangeEnabledAttributes: function(enabled){ 7289 ASPxClientTextEdit.prototype.ChangeEnabledAttributes.call(this, enabled); 7290 for(var i = 0; i < this.buttonCount; i++){ 7291 var element = this.GetButton(i); 7292 if(element) 7293 this.ChangeButtonEnabledAttributes(element, this.GetChangeButtonEnabledAttributesMethod(enabled)); 7294 } 7295 if(this.accessibilityCompliant) 7296 this.ChangeAccessibilityButtonEnabledAttributes(enabled); 7297 }, 7298 ChangeEnabledStateItems: function(enabled){ 7299 ASPxClientTextEdit.prototype.ChangeEnabledStateItems.call(this, enabled); 7300 for(var i = 0; i < this.buttonCount; i++){ 7301 var element = this.GetButton(i); 7302 if(element) 7303 ASPx.GetStateController().SetElementEnabled(element, enabled); 7304 } 7305 }, 7306 GetChangeButtonEnabledAttributesMethod: function(enabled) { 7307 return ASPx.Attr.ChangeAttributesMethod(enabled); 7308 }, 7309 ChangeButtonEnabledAttributes: function(element, method){ 7310 method(element, "onclick"); 7311 method(element, "ondblclick"); 7312 if(ASPx.Browser.Edge) 7313 method(element, "onmousedown"); 7314 method(element, "on" + ASPx.TouchUIHelper.touchMouseDownEventName); 7315 method(element, "on" + ASPx.TouchUIHelper.touchMouseUpEventName); 7316 }, 7317 ChangeInputEnabled: function(element, enabled, readOnly) { 7318 ASPxClientTextEdit.prototype.ChangeInputEnabled.call(this, element, enabled, readOnly || !this.allowUserInput); 7319 }, 7320 ChangeAccessibilityButtonEnabledAttributes: function(enabled) { 7321 var buttonElements = this.GetButtonCollection(); 7322 for(var i = 0; i < buttonElements.length; i++)
7323 this.SetAccessibilityAnchorEnabled(buttonElements[i], enabled); 7324 }, 7325 SetValue: function(value) { 7326 ASPxClientTextEdit.prototype.SetValue.call(this, value); 7327 if(!this.IsFocused()) 7328 this.EnsureClearButtonVisibility(); 7329 }, 7330 OnAssociatedLabelClick: function(focusableElement) { 7331 var isValidElement = focusableElement && ASPx.IsActionElement(focusableElement) && ASPx.GetIsParent(this.GetMainElement(), focusableElement) && ASPx.IsElementVisible(focusableElement); 7332 if(isValidElement) 7333 focusableElement.focus(); 7334 else 7335 this.SetFocus(); 7336 }, 7337 onClearButtonClick: function() { 7338 var requireFocus = !ASPx.Browser.VirtualKeyboardSupported || ASPx.Browser.MSTouchUI; 7339 if(this.ownerListBox) 7340 this.ownerListBox.ForceLockFocusEvents(); 7341 if((requireFocus && !this.IsFocused()) || this.accessibilityCompliant) 7342 this.GetInputElement().focus(); 7343 if(this.IsFocused() || !requireFocus) { 7344 if(this.ownerListBox) 7345 this.ownerListBox.UnlockFocusEvents(); 7346 else if(this.accessibilityCompliant) 7347 this.UnlockFocusEvents(); 7348 this.OnClear(); 7349 } 7350 else 7351 window.setTimeout(this.onClearButtonClick.bind(this), 100); 7352 } 7353}); 7354var ASPxClientButtonEdit = ASPx.CreateClass(ASPxClientButtonEditBase, { 7355}); 7356ASPxClientButtonEdit.Cast = ASPxClientControl.Cast; 7357var ASPxClientButtonEditClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, { 7358 constructor: function(processOnServer, buttonIndex){ 7359 this.constructor.prototype.constructor.call(this, processOnServer); 7360 this.buttonIndex = buttonIndex; 7361 } 7362}); 7363var ASPxClientTextEditHelpTextHAlign = { 7364 Left: "Left", 7365 Right: "Right", 7366 Center: "Center" 7367}; 7368var ASPxClientTextEditHelpTextVAlign = { 7369 Top: "Top", 7370 Bottom: "Bottom", 7371 Middle: "Middle" 7372}; 7373var ASPxClientTextEditHelpTextDisplayMode = { 7374 Inline: "Inline", 7375 Popup: "Popup" 7376}; 7377var ASPxClientTextEditHelpTextConsts = { 7378 VERTICAL_ORIENTATION_CLASS_NAME: "dxeVHelpTextSys", 7379 HORIZONTAL_ORIENTATION_CLASS_NAME: "dxeHHelpTextSys" 7380}; 7381var ASPxClientTextEditHelpText = ASPx.CreateClass(null, { 7382 constructor: function (editor, helpTextStyle, helpText, position, hAlign, vAlign, margins, animationEnabled, helpTextDisplayMode) { 7383 this.hAlign = hAlign; 7384 this.vAlign = vAlign; 7385 this.animationEnabled = animationEnabled; 7386 this.displayMode = helpTextDisplayMode; 7387 this.editor = editor; 7388 this.editorMainElement = editor.GetMainElement(); 7389 this.margins = margins ? { Top: margins[0], Right: margins[1], Bottom: margins[2], Left: margins[3] } : null; 7390 this.defaultMargins = { Top: 10, Right: 10, Bottom: 10, Left: 10 }; 7391 this.position = position; 7392 this.helpTextElement = this.createHelpTextElement(); 7393 this.setHelpTextZIndex(true); 7394 this.prepareHelpTextElement(helpTextStyle, helpText); 7395 }, 7396 getRows: function (table) { 7397 return ASPx.GetChildNodesByTagName(table, "TR"); 7398 }, 7399 getCells: function (row) { 7400 return ASPx.GetChildNodesByTagName(row, "TD"); 7401 }, 7402 getCellByIndex: function(row, cellIndex) { 7403 return this.getCells(row)[cellIndex]; 7404 }, 7405 getCellIndex: function(row, cell) { 7406 var cells = this.getCells(row); 7407 for(var i = 0; i < cells.length; i++) { 7408 if(cells[i] === cell) 7409 return i; 7410 } 7411 }, 7412 isHorizontal: function(position) { 7413 return position === ASPx.Position.Left || position === ASPx.Position.Right; 7414 }, 7415 isVertical: function (position) { 7416 return position === ASPx.Position.Top || position === ASPx.Position.Bottom; 7417 }, 7418 createEmptyCell: function(assignClassName) { 7419 var cell = document.createElement("TD"); 7420 if(assignClassName) 7421 cell.className = "dxeFakeEmptyCell"; 7422 return cell; 7423 }, 7424 addHelpTextCellToExternalTableWithTwoCells: function (captionCell, errorCell, helpTextCell, errorTableBody, tableRows) { 7425 var captionPosition = this.editor.captionPosition; 7426 var errorCellPosition = this.editor.errorCellPosition; 7427 var helpTextRow = this.isVertical(this.position) ? document.createElement("TR") : null; 7428 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition)) 7429 captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling); 7430 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition)) 7431 captionCell.parentNode.insertBefore(helpTextCell, captionCell); 7432 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition)) 7433 tableRows[0].appendChild(helpTextCell); 7434 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition)) 7435 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 7436 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) { 7437 helpTextRow.appendChild(helpTextCell); 7438 errorTableBody.appendChild(helpTextRow); 7439 } 7440 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) { 7441 helpTextRow.appendChild(helpTextCell); 7442 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7443 } 7444 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) { 7445 helpTextRow.appendChild(helpTextCell); 7446 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling); 7447 } 7448 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) { 7449 helpTextRow.appendChild(helpTextCell); 7450 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode); 7451 } 7452 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) { 7453 helpTextRow.appendChild(helpTextCell); 7454 helpTextRow.appendChild(this.createEmptyCell()); 7455 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7456 } 7457 if(this.position === ASPx.Position.Bottom) { 7458 if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) { 7459 helpTextRow.appendChild(helpTextCell); 7460 helpTextRow.appendChild(this.createEmptyCell()); 7461 errorTableBody.appendChild(helpTextRow); 7462 } 7463 } 7464 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) { 7465 helpTextRow.appendChild(this.createEmptyCell()); 7466 helpTextRow.appendChild(helpTextCell); 7467 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7468 } 7469 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) { 7470 helpTextRow.appendChild(this.createEmptyCell()); 7471 helpTextRow.appendChild(helpTextCell); 7472 errorTableBody.appendChild(helpTextRow); 7473 } 7474 if(this.position === ASPx.Position.Right) { 7475 if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Top 7476 || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) { 7477 tableRows[1].appendChild(helpTextCell); 7478 tableRows[0].appendChild(this.createEmptyCell()); 7479 } 7480 if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Bottom || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) { 7481 tableRows[0].appendChild(helpTextCell); 7482 tableRows[1].appendChild(this.createEmptyCell()); 7483 } 7484 } 7485 if(this.position === ASPx.Position.Left) { 7486 if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right 7487 || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left) { 7488 tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]); 7489 tableRows[0].insertBefore(this.createEmptyCell(), tableRows[0].childNodes[0]); 7490 } 7491 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) { 7492 tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]); 7493 tableRows[0].insertBefore(this.createEmptyCell(errorCellPosition === ASPx.Position.Top), tableRows[0].childNodes[0]); 7494 tableRows[2].insertBefore(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top), tableRows[2].childNodes[0]); 7495 } 7496 if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) { 7497 tableRows[2].insertBefore(helpTextCell, tableRows[2].childNodes[0]); 7498 tableRows[0].insertBefore(this.createEmptyCell(false), tableRows[0].childNodes[0]); 7499 tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]); 7500 } 7501 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) { 7502 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 7503 tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]); 7504 tableRows[2].insertBefore(this.createEmptyCell(false), tableRows[2].childNodes[0]); 7505 } 7506 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Bottom 7507 || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) { 7508 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 7509 tableRows[1].insertBefore(this.createEmptyCell(), tableRows[1].childNodes[0]); 7510 } 7511 if(captionPosition === ASPx.Position.Left && this.isVertical(errorCellPosition)) { 7512 captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling); 7513 var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1]; 7514 var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell); 7515 emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex)); 7516 } 7517 } 7518 if(this.position === ASPx.Position.Right) { 7519 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) { 7520 tableRows[1].appendChild(helpTextCell); 7521 tableRows[0].appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Top)); 7522 tableRows[2].appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top)); 7523 } 7524 if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) { 7525 tableRows[2].appendChild(helpTextCell); 7526 tableRows[0].appendChild(this.createEmptyCell(false)); 7527 tableRows[1].appendChild(this.createEmptyCell(true)); 7528 } 7529 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) { 7530 tableRows[0].appendChild(helpTextCell); 7531 tableRows[1].appendChild(this.createEmptyCell(true)); 7532 tableRows[2].appendChild(this.createEmptyCell(false)); 7533 } 7534 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) { 7535 tableRows[0].appendChild(helpTextCell); 7536 tableRows[1].appendChild(this.createEmptyCell()); 7537 } 7538 if(captionPosition === ASPx.Position.Right && this.isVertical(errorCellPosition)) { 7539 captionCell.parentNode.insertBefore(helpTextCell, captionCell); 7540 var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1]; 7541 var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell); 7542 emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex)); 7543 } 7544 } 7545 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) { 7546 if(errorCellPosition === ASPx.Position.Left) { 7547 helpTextRow.appendChild(this.createEmptyCell(true)); 7548 helpTextRow.appendChild(helpTextCell); 7549 } 7550 else { 7551 helpTextRow.appendChild(helpTextCell); 7552 helpTextRow.appendChild(this.createEmptyCell()); 7553 } 7554 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling); 7555 } 7556 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) { 7557 if(errorCellPosition === ASPx.Position.Left) { 7558 helpTextRow.appendChild(this.createEmptyCell(true)); 7559 helpTextRow.appendChild(helpTextCell); 7560 } 7561 else { 7562 helpTextRow.appendChild(helpTextCell); 7563 helpTextRow.appendChild(this.createEmptyCell()); 7564 } 7565 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7566 } 7567 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isHorizontal(errorCellPosition)) { 7568 if(errorCellPosition === ASPx.Position.Left) { 7569 helpTextRow.appendChild(this.createEmptyCell(true)); 7570 helpTextRow.appendChild(helpTextCell); 7571 } 7572 else { 7573 helpTextRow.appendChild(helpTextCell); 7574 helpTextRow.appendChild(this.createEmptyCell()); 7575 } 7576 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode); 7577 } 7578 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) { 7579 helpTextRow.appendChild(this.createEmptyCell(true)); 7580 helpTextRow.appendChild(helpTextCell); 7581 errorTableBody.appendChild(helpTextRow); 7582 } 7583 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) { 7584 helpTextRow.appendChild(helpTextCell); 7585 helpTextRow.appendChild(this.createEmptyCell()); 7586 errorTableBody.appendChild(helpTextRow); 7587 } 7588 if(this.position === ASPx.Position.Bottom) { 7589 if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) { 7590 helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right)); 7591 helpTextRow.appendChild(helpTextCell); 7592 helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right)); 7593 errorTableBody.appendChild(helpTextRow); 7594 } 7595 if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) { 7596 helpTextRow.appendChild(this.createEmptyCell(false)); 7597 helpTextRow.appendChild(this.createEmptyCell(true)); 7598 helpTextRow.appendChild(helpTextCell); 7599 errorTableBody.appendChild(helpTextRow); 7600 } 7601 if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) { 7602 helpTextRow.appendChild(helpTextCell); 7603 helpTextRow.appendChild(this.createEmptyCell(true)); 7604 helpTextRow.appendChild(this.createEmptyCell(false)); 7605 errorTableBody.appendChild(helpTextRow); 7606 } 7607 } 7608 if(this.position === ASPx.Position.Top) { 7609 if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) { 7610 helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right)); 7611 helpTextRow.appendChild(helpTextCell); 7612 helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right)); 7613 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7614 } 7615 if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) { 7616 helpTextRow.appendChild(this.createEmptyCell(false)); 7617 helpTextRow.appendChild(this.createEmptyCell(true)); 7618 helpTextRow.appendChild(helpTextCell); 7619 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7620 } 7621 if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) { 7622 helpTextRow.appendChild(helpTextCell); 7623 helpTextRow.appendChild(this.createEmptyCell(true)); 7624 helpTextRow.appendChild(this.createEmptyCell(false)); 7625 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7626 } 7627 } 7628 }, 7629 addHelpTextCellToExternalTableWithErrorCell
7629: function (errorCell, helpTextCell, errorTableBody, tableRows) { 7630 var errorCellPosition = this.editor.errorCellPosition; 7631 var helpTextRow = document.createElement("TR"); 7632 if(this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition)) 7633 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 7634 if(this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition)) 7635 tableRows[0].appendChild(helpTextCell); 7636 if(this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) { 7637 helpTextRow.appendChild(helpTextCell); 7638 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7639 } 7640 if(this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) { 7641 helpTextRow.appendChild(helpTextCell); 7642 errorTableBody.appendChild(helpTextRow); 7643 } 7644 if(errorCellPosition === ASPx.Position.Left && this.isVertical(this.position)) { 7645 helpTextRow.appendChild(this.createEmptyCell(true)); 7646 helpTextRow.appendChild(helpTextCell); 7647 if(this.position === ASPx.Position.Top) 7648 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7649 else 7650 errorTableBody.appendChild(helpTextRow); 7651 } 7652 if(errorCellPosition === ASPx.Position.Right && this.isVertical(this.position)) { 7653 helpTextRow.appendChild(helpTextCell); 7654 helpTextRow.appendChild(this.createEmptyCell(true)); 7655 if(this.position === ASPx.Position.Top) 7656 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7657 else 7658 errorTableBody.appendChild(helpTextRow); 7659 } 7660 if(this.position === ASPx.Position.Left && this.isVertical(errorCellPosition)) { 7661 var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0; 7662 var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0; 7663 tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]); 7664 tableRows[emptyCellRowIndex].insertBefore(this.createEmptyCell(true), tableRows[emptyCellRowIndex].childNodes[0]); 7665 } 7666 if(this.position === ASPx.Position.Right && this.isVertical(errorCellPosition)) { 7667 var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0; 7668 var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0; 7669 tableRows[helpTextParentRowIndex].appendChild(helpTextCell); 7670 tableRows[emptyCellRowIndex].appendChild(this.createEmptyCell(true)); 7671 } 7672 }, 7673 addHelpTextCellToExternalTableWithCaption: function (captionCell, helpTextCell, errorTableBody, tableRows) { 7674 var captionPosition = this.editor.captionPosition; 7675 var helpTextRow = document.createElement("TR"); 7676 if(captionPosition === ASPx.Position.Left && this.isVertical(this.position)) { 7677 helpTextRow.appendChild(this.createEmptyCell()); 7678 helpTextRow.appendChild(helpTextCell); 7679 if(this.position === ASPx.Position.Top) 7680 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7681 else 7682 errorTableBody.appendChild(helpTextRow); 7683 } 7684 if(this.position === ASPx.Position.Left && this.isVertical(captionPosition)) { 7685 var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0; 7686 var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0; 7687 tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]); 7688 tableRows[emptyCellParentRowIndex].insertBefore(this.createEmptyCell(), tableRows[emptyCellParentRowIndex].childNodes[0]); 7689 } 7690 if(this.position === ASPx.Position.Right && this.isVertical(captionPosition)) { 7691 var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0; 7692 var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0; 7693 tableRows[helpTextParentRowIndex].appendChild(helpTextCell); 7694 tableRows[emptyCellParentRowIndex].appendChild(this.createEmptyCell()); 7695 } 7696 if(captionPosition === ASPx.Position.Right && this.isVertical(this.position)) { 7697 helpTextRow.appendChild(helpTextCell); 7698 helpTextRow.appendChild(this.createEmptyCell()); 7699 if(this.position === ASPx.Position.Top) 7700 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7701 else 7702 errorTableBody.appendChild(helpTextRow); 7703 } 7704 if(this.isVertical(captionPosition) && this.isVertical(this.position)) { 7705 helpTextRow.appendChild(helpTextCell); 7706 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top) 7707 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling); 7708 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom) 7709 errorTableBody.appendChild(helpTextRow); 7710 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top) 7711 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7712 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom) 7713 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode); 7714 } 7715 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left) 7716 captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling); 7717 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right) 7718 captionCell.parentNode.insertBefore(helpTextCell, captionCell); 7719 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right) 7720 tableRows[0].appendChild(helpTextCell); 7721 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left) 7722 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 7723 }, 7724 addHelpTextCellToExternalTableWithEditorOnly: function (helpTextCell, errorTableBody, tableRows) { 7725 if(this.isHorizontal(this.position)) { 7726 if(this.position === ASPx.Position.Left) 7727 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 7728 else 7729 tableRows[0].appendChild(helpTextCell); 7730 } 7731 else { 7732 var helpTextRow = document.createElement("TR"); 7733 helpTextRow.appendChild(helpTextCell); 7734 if(this.position === ASPx.Position.Top) 7735 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 7736 else 7737 errorTableBody.appendChild(helpTextRow); 7738 } 7739 }, 7740 addHelpTextCellToExternalTable: function (errorTable, helpTextCell) { 7741 var errorTableBody = ASPx.GetNodeByTagName(errorTable, "TBODY", 0); 7742 var tableRows = this.getRows(errorTableBody); 7743 var captionCell = this.editor.GetCaptionCell();
7744 var errorCell = this.editor.GetErrorCell(); 7745 if(captionCell) { 7746 if(errorCell) 7747 this.addHelpTextCellToExternalTableWithTwoCells(captionCell, errorCell, helpTextCell, errorTableBody, tableRows); 7748 else 7749 this.addHelpTextCellToExternalTableWithCaption(captionCell, helpTextCell, errorTableBody, tableRows); 7750 } 7751 else if(errorCell) 7752 this.addHelpTextCellToExternalTableWithErrorCell(errorCell, helpTextCell, errorTableBody, tableRows); 7753 else 7754 this.addHelpTextCellToExternalTableWithEditorOnly(helpTextCell, errorTableBody, tableRows); 7755 }, 7756 createExternalTable: function () { 7757 var externalTable = document.createElement("TABLE"); 7758 externalTable.id = this.editor.name + ASPx.EditElementSuffix.ExternalTable; 7759 externalTable.cellPadding = 0; 7760 externalTable.cellSpacing = 0; 7761 this.applyExternalTableStyle(externalTable); 7762 var editorWidth = this.editorMainElement.style.width; 7763 if(ASPx.IsPercentageSize(editorWidth)) { 7764 externalTable.style.width = editorWidth; 7765 this.editorMainElement.style.width = "100%"; 7766 this.editor.width = "100%"; 7767 } 7768 var externalTableBody = document.createElement("TBODY"); 7769 var externalTableRow = document.createElement("TR"); 7770 var externalTableCell = document.createElement("TD"); 7771 externalTable.appendChild(externalTableBody); 7772 externalTableBody.appendChild(externalTableRow); 7773 externalTableRow.appendChild(externalTableCell); 7774 this.editorMainElement.parentNode.appendChild(externalTable); 7775 ASPx.ChangeElementContainer(this.editorMainElement, externalTableCell, true); 7776 if(this.editor.accessibilityCompliant) 7777 ASPx.Attr.SetAttribute(externalTable, "role", "presentation"); 7778 return externalTable; 7779 }, 7780 applyExternalTableStyle: function (externalTable) { 7781 var externalTableStyle = this.editor.externalTableStyle; 7782 if(externalTableStyle.length > 0) { 7783 this.applyStyleToElement(externalTable, externalTableStyle); 7784 } 7785 }, 7786 applyStyleToElement: function(element, style) { 7787 element.className = style[0]; 7788 if(style[1]) { 7789 var styleSheet = ASPx.GetCurrentStyleSheet(); 7790 element.className += " " + ASPx.CreateImportantStyleRule(styleSheet, style[1]); 7791 } 7792 }, 7793 createInlineHelpTextElement: function () { 7794 var helpTextElement = document.createElement("TD"); 7795 var externalTable = this.editor.GetExternalTable(); 7796 if(!externalTable) 7797 externalTable = this.createExternalTable(); 7798 this.addHelpTextCellToExternalTable(externalTable, helpTextElement); 7799 return helpTextElement; 7800 }, 7801 createPopupHelpTextElement: function () { 7802 var helpTextElement = document.createElement("DIV"); 7803 ASPx.InsertElementAfter(helpTextElement, this.editor.GetMainElement()); 7804 ASPx.AnimationHelper.setOpacity(helpTextElement, 0); 7805 ASPx.SetElementDisplay(helpTextElement, false); 7806 return helpTextElement; 7807 }, 7808 createHelpTextElement: function () { 7809 return this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup ? 7810 this.createPopupHelpTextElement() : this.createInlineHelpTextElement(); 7811 }, 7812 prepareHelpTextElement: function (helpTextStyle, helpText) { 7813 this.helpTextElement.id = this.getHelpTextElementId(); 7814 this.applyStyleToElement(this.helpTextElement, helpTextStyle); 7815 ASPx.SetInnerHtml(this.helpTextElement, "<SPAN>" + helpText + "</SPAN>"); 7816 if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup) 7817 this.updatePopupHelpTextPosition(); 7818 else { 7819 var isVerticalOrientation = this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom; 7820 var orientationClassName = isVerticalOrientation ? ASPxClientTextEditHelpTextConsts.VERTICAL_ORIENTATION_CLASS_NAME : 7821 ASPxClientTextEditHelpTextConsts.HORIZONTAL_ORIENTATION_CLASS_NAME; 7822 this.helpTextElement.className += " " + orientationClassName; 7823 this.setInlineHelpTextElementAlign(); 7824 ASPx.SetElementDisplay(this.helpTextElement, this.editor.clientVisible); 7825 } 7826 }, 7827 getHelpTextElementId: function() { 7828 return this.editor.name + ASPx.TEHelpTextElementSuffix; 7829 }, 7830 setInlineHelpTextElementAlign: function() { 7831 var hAlignValue = "", vAlignValue = ""; 7832 switch(this.hAlign) { 7833 case ASPxClientTextEditHelpTextHAlign.Left: hAlignValue = "left"; break; 7834 case ASPxClientTextEditHelpTextHAlign.Right: hAlignValue = "right"; break; 7835 case ASPxClientTextEditHelpTextHAlign.Center: hAlignValue = "center"; break; 7836 } 7837 switch(this.vAlign) { 7838 case ASPxClientTextEditHelpTextVAlign.Top: vAlignValue = "top"; break; 7839 case ASPxClientTextEditHelpTextVAlign.Bottom: vAlignValue = "bottom"; break; 7840 case ASPxClientTextEditHelpTextVAlign.Middle: vAlignValue = "middle"; break; 7841 } 7842 this.helpTextElement.style.textAlign = hAlignValue; 7843 this.helpTextElement.style.verticalAlign = vAlignValue; 7844 }, 7845 getHelpTextMargins: function() { 7846 if(this.margins) 7847 return this.margins; 7848 var result = this.defaultMargins; 7849 if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom) 7850 result.Left = result.Right = 0; 7851 else 7852 result.Top = result.Bottom = 0; 7853 return result; 7854 }, 7855 updatePopupHelpTextPosition: function (editorMainElement) { 7856 var editorWidth = this.editorMainElement.offsetWidth; 7857 var editorHeight = this.editorMainElement.offsetHeight; 7858 var helpTextWidth = this.helpTextElement.offsetWidth; 7859 var helpTextHeight = this.helpTextElement.offsetHeight; 7860 var editorX = ASPx.GetAbsoluteX(this.editorMainElement); 7861 var editorY = ASPx.GetAbsoluteY(this.editorMainElement); 7862 var helpTextX = 0, helpTextY = 0; 7863 var margins = this.getHelpTextMargins(); 7864 if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom) { 7865 if(this.position === ASPx.Position.Top) 7866 helpTextY = editorY - margins.Bottom - helpTextHeight; 7867 else if(this.position === ASPx.Position.Bottom) 7868 helpTextY = editorY + editorHeight + margins.Top; 7869 if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Left) 7870 helpTextX = editorX + margins.Left; 7871 else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Right) 7872 helpTextX = editorX + editorWidth - helpTextWidth - margins.Right; 7873 else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Center) { 7874 var editorCenterX = editorX + editorWidth / 2; 7875 var helpTextWidthWithMargins = helpTextWidth + margins.Left + margins.Right; 7876 helpTextX = editorCenterX - helpTextWidthWithMargins / 2 + margins.Left; 7877 } 7878 } else { 7879 if(this.position === ASPx.Position.Left) 7880 helpTextX = editorX - margins.Right - helpTextWidth; 7881 else if(this.position === ASPx.Position.Right) 7882 helpTextX = editorX + editorWidth + margins.Left; 7883 if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Top) 7884 helpTextY = editorY + margins.Top; 7885 else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Bottom) 7886 helpTextY = editorY + editorHeight - helpTextHeight - margins.Bottom; 7887 else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Middle) { 7888 var editorCenterY = editorY + editorHeight / 2; 7889 var helpTextHeightWithMargins = helpTextHeight + margins.Top + margins.Bottom; 7890 helpTextY = editorCenterY - helpTextHeightWithMargins / 2 + margins.Top; 7891 } 7892 } 7893 helpTextX = helpTextX < 0 ? 0 : helpTextX; 7894 helpTextY = helpTextY < 0 ? 0 : helpTextY; 7895 ASPx.SetAbsoluteX(this.helpTextElement, helpTextX); 7896 ASPx.SetAbsoluteY(this.helpTextElement, helpTextY); 7897 }, 7898 setHelpTextZIndex: function (hide) { 7899 var newZIndex = 41998 * (hide ? -1 : 1); 7900 if(this.helpTextElement.style.zIndex != newZIndex) 7901 this.helpTextElement.style.zIndex = newZIndex; 7902 }, 7903 hide: function () { 7904 if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) { 7905 ASPx.SetElementDisplay(this.helpTextElement, false); 7906 } 7907 else 7908 this.hidePopupHelpText(); 7909 }, 7910 hidePopupHelpText: function() { 7911 var onHidePopupHelpTextComplete = function () { 7912 this.setHelpTextZIndex(true); 7913 ASPx.SetElementDisplay(this.helpTextElement, false); 7914 }.aspxBind(this); 7915 if(this.animationEnabled) 7916 ASPx.AnimationHelper.fadeOut(this.helpTextElement, onHidePopupHelpTextComplete); 7917 else { 7918 ASPx.AnimationHelper.setOpacity(this.helpTextElement, 0); 7919 onHidePopupHelpTextComplete(); 7920 } 7921 }, 7922 show: function () { 7923 if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) { 7924 ASPx.SetElementDisplay(this.helpTextElement, true); 7925 } 7926 else 7927 this.showPopupHelpText(); 7928 }, 7929 showPopupHelpText: function () { 7930 ASPx.SetElementDisplay(this.helpTextElement, true); 7931 this.updatePopupHelpTextPosition(); 7932 if(this.animationEnabled) 7933 ASPx.AnimationHelper.fadeIn(this.helpTextElement); 7934 else 7935 ASPx.AnimationHelper.setOpacity(this.helpTextElement, 1); 7936 this.setHelpTextZIndex(false); 7937 } 7938}); 7939var ASPxOutOfRangeWarningManager = ASPx.CreateClass(null, { 7940 constructor: function (editor, minValue, maxValue, defaultMinValue, defaultMaxValue, outOfRangeWarningElementPosition, valueFormatter) { 7941 this.editor = editor; 7942 this.outOfRangeWarningElementPosition = outOfRangeWarningElementPosition; 7943 this.minValue = minValue; 7944 this.maxValue = maxValue; 7945 this.defaultMinValue = defaultMinValue; 7946 this.defaultMaxValue = defaultMaxValue; 7947 this.minMaxValueFormatter = valueFormatter; 7948 this.animationDuration = 150; 7949 this.CreateOutOfRangeWarningElement(); 7950 }, 7951 SetMinValue: function (minValue) { 7952 this.minValue = minValue; 7953 this.UpdateOutOfRangeWarningElementText(); 7954 }, 7955 SetMaxValue: function (maxValue) { 7956 this.maxValue = maxValue; 7957 this.UpdateOutOfRangeWarningElementText(); 7958 }, 7959 CreateOutOfRangeWarningElement: function () { 7960 this.outOfRangeWarningElement = document.createElement("DIV"); 7961 this.outOfRangeWarningElement.id = this.editor.name + "OutOfRWarn"; 7962 ASPx.InsertElementAfter(this.outOfRangeWarningElement, this.editor.GetOutOfRangeWarningElementPrevSibling()); 7963 ASPx.AnimationHelper.setOpacity(this.outOfRangeWarningElement, 0); 7964 this.outOfRangeWarningElement.className = this.editor.outOfRangeWarningClassName; 7965 this.UpdateOutOfRangeWarningElementText(); 7966 }, 7967 IsValueInRange: function (value) { 7968 return (!this.IsMinValueExists() || value >= this.minValue)
7969 && (!this.IsMaxValueExists() || value <= this.maxValue); 7970 }, 7971 IsMinValueExists: function() { 7972 return ASPx.IsExists(this.minValue) && !isNaN(this.minValue) && this.minValue !== this.defaultMinValue; 7973 }, 7974 IsMaxValueExists: function () { 7975 return ASPx.IsExists(this.maxValue) && !isNaN(this.maxValue) && this.maxValue !== this.defaultMaxValue; 7976 }, 7977 GetFormattedTextByValue: function(value) { 7978 if (this.minMaxValueFormatter) 7979 return this.minMaxValueFormatter.Format(value); 7980 return value; 7981 }, 7982 GetWarningText: function() { 7983 var textTemplate = arguments[0]; 7984 var valueTexts = []; 7985 for (var i = 1; i < arguments.length; i++) { 7986 var valueText = this.GetFormattedTextByValue(arguments[i]); 7987 valueTexts.push(valueText); 7988 } 7989 return ASPx.Formatter.Format(textTemplate, valueTexts); 7990 }, 7991 UpdateOutOfRangeWarningElementText: function () { 7992 var text = ""; 7993 if (this.IsMinValueExists() && this.IsMaxValueExists()) 7994 text = this.GetWarningText(this.editor.outOfRangeWarningMessages[0], this.minValue, this.maxValue); 7995 if (this.IsMinValueExists() && !this.IsMaxValueExists()) 7996 text = this.GetWarningText(this.editor.outOfRangeWarningMessages[1], this.minValue); 7997 if (!this.IsMinValueExists() && this.IsMaxValueExists()) 7998 text = this.GetWarningText(this.editor.outOfRangeWarningMessages[2], this.maxValue); 7999 ASPx.SetInnerHtml(this.outOfRangeWarningElement, "<LABEL>" + text + "</LABEL>"); 8000 }, 8001 UpdateOutOfRangeWarningElementVisibility: function (currentValue) { 8002 var isValidValue = currentValue == null || this.IsValueInRange(currentValue); 8003 if (!isValidValue && !this.outOfRangeWarningElementShown) 8004 this.ShowOutOfRangeWarningElement(); 8005 if (isValidValue && this.outOfRangeWarningElementShown) 8006 this.HideOutOfRangeWarningElement(); 8007 }, 8008 GetOutOfRangeWarningElementCoordinates: function() { 8009 var editorMainElement = this.editor.GetMainElement(); 8010 var editorWidth = editorMainElement.offsetWidth; 8011 var editorHeight = editorMainElement.offsetHeight; 8012 var editorX = ASPx.GetAbsoluteX(editorMainElement); 8013 var editorY = ASPx.GetAbsoluteY(editorMainElement); 8014 var outOfRangeWarningElementX = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorX + editorWidth : editorX; 8015 var outOfRangeWarningElementY = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorY : editorY + editorHeight; 8016 outOfRangeWarningElementX = outOfRangeWarningElementX < 0 ? 0 : outOfRangeWarningElementX; 8017 outOfRangeWarningElementY = outOfRangeWarningElementY < 0 ? 0 : outOfRangeWarningElementY; 8018 return { 8019 x: outOfRangeWarningElementX, 8020 y: outOfRangeWarningElementY 8021 }; 8022 }, 8023 ShowOutOfRangeWarningElement: function () { 8024 this.outOfRangeWarningElement.style.display = "inline"; 8025 var outOfRangeWarningElementCoordinates = this.GetOutOfRangeWarningElementCoordinates(); 8026 ASPx.SetAbsoluteX(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.x); 8027 ASPx.SetAbsoluteY(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.y); 8028 ASPx.AnimationHelper.fadeIn(this.outOfRangeWarningElement, null, this.animationDuration); 8029 this.ScrollToWarningElementIfRequired(outOfRangeWarningElementCoordinates); 8030 this.outOfRangeWarningElementShown = true; 8031 }, 8032 HideOutOfRangeWarningElement: function () { 8033 ASPx.AnimationHelper.fadeOut(this.outOfRangeWarningElement, function () { 8034 ASPx.SetElementDisplay(this.outOfRangeWarningElement, false); 8035 }.aspxBind(this), this.animationDuration); 8036 this.outOfRangeWarningElementShown = false; 8037 }, 8038 ScrollToWarningElementIfRequired: function (outOfRangeWarningElementCoordinates) { 8039 if(this.outOfRangeWarningElementPosition === ASPx.Position.Right) { 8040 var warnElementRightPos = outOfRangeWarningElementCoordinates.x 8041 + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginLeft) 8042 + this.outOfRangeWarningElement.offsetWidth; 8043 if(warnElementRightPos > ASPx.GetDocumentClientWidth() + ASPx.GetDocumentScrollLeft()) 8044 ASPx.SetDocumentScrollLeft(warnElementRightPos - ASPx.GetDocumentClientWidth()); 8045 } 8046 if(this.outOfRangeWarningElementPosition === ASPx.Position.Bottom) { 8047 var warnElementBottomPos = outOfRangeWarningElementCoordinates.y 8048 + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginTop) 8049 + this.outOfRangeWarningElement.offsetHeight; 8050 if(warnElementBottomPos > ASPx.GetDocumentClientHeight() + ASPx.GetDocumentScrollTop()) 8051 ASPx.SetDocumentScrollTop(warnElementBottomPos - ASPx.GetDocumentClientHeight()); 8052 } 8053 } 8054}); 8055ASPx.MMMouseOut = function(name, evt) { 8056 var edit = ASPx.GetControlCollection().Get(name);
8057 if(edit != null) edit.OnMouseOut(evt); 8058}; 8059ASPx.MMMouseOver = function(name, evt) { 8060 var edit = ASPx.GetControlCollection().Get(name); 8061 if(edit != null) edit.OnMouseOver(evt); 8062}; 8063ASPx.MaskHintTimerProc = function() { 8064 var focusedEditor = ASPx.GetFocusedEditor(); 8065 if(focusedEditor != null && ASPx.IsFunction(focusedEditor.MaskHintTimerProc)) 8066 focusedEditor.MaskHintTimerProc(); 8067}; 8068ASPx.ETextChanged = function(name) { 8069 var edit = ASPx.GetControlCollection().Get(name); 8070 if(edit != null) edit.OnTextChanged(); 8071}; 8072ASPx.BEClick = function(name,number){ 8073 var edit = ASPx.GetControlCollection().Get(name); 8074 if(edit != null) edit.OnButtonClick(number); 8075}; 8076ASPx.BEClear = function(name, evt) { 8077 var edit = ASPx.GetControlCollection().Get(name); 8078 if(edit && (evt.button === 0 || ASPx.Browser.TouchUI)) 8079 edit.onClearButtonClick(); 8080}; 8081ASPx.SetFocusToTextEditWithDelay = function(name) { 8082 window.setTimeout(function() { 8083 var edit = ASPx.GetControlCollection().Get(name); 8084 if(edit) 8085 edit.SetFocus(); 8086 }, 500); 8087}; 8088window.ASPxClientTextEdit = ASPxClientTextEdit; 8089window.ASPxClientTextBoxBase = ASPxClientTextBoxBase; 8090window.ASPxClientTextBox = ASPxClientTextBox; 8091window.ASPxClientMemo = ASPxClientMemo; 8092window.ASPxClientButtonEditBase = ASPxClientButtonEditBase; 8093window.ASPxClientButtonEdit = ASPxClientButtonEdit; 8094window.ASPxClientButtonEditClickEventArgs = ASPxClientButtonEditClickEventArgs; 8095})(); 8096 8097(function(dx) { 8098 var Interactions = ASPx.CreateClass(null, { 8099 onSwipeLeft: function(selector, func) { 8100 }, 8101 onSwipeRight: function(selector, func) { 8102 } 8103 }); 8104 var BootstrapCore = {}; 8105 BootstrapCore.Interactions = new Interactions(); 8106 BootstrapCore.BootstrapMode = 'Bootstrap4'; 8107 BootstrapCore.IsBootstrap3 = BootstrapCore.BootstrapMode == "Bootstrap3"; 8108 BootstrapCore.IsBootstrap4 = BootstrapCore.BootstrapMode == "Bootstrap4"; 8109 BootstrapCore.IsBootstrap5 = BootstrapCore.BootstrapMode == "Bootstrap5"; 8110 BootstrapCore.CheckReferences = 'true'; 8111 BootstrapCore.zIndexCategories = { 8112 dropdown: 1000, 8113 sticky: 1020, 8114 fixed: 1030, 8115 modalBackdrop: 1040, 8116 modal: 1050, 8117 popover: 1060, 8118 tooltip: 1070 8119 }; 8120 var bsCssClass = "dxbs-" + BootstrapCore.BootstrapMode.charAt(BootstrapCore.BootstrapMode.length - 1); 8121 if(document && document.documentElement) 8122 ASPx.AddClassNameToElement(document.documentElement, bsCssClass); 8123 var BootstrapCssSelectors = {}; 8124 BootstrapCssSelectors.Table = "table"; 8125 BootstrapCssSelectors.TableBordered = "table-bordered"; 8126 BootstrapCssSelectors.TableSmall = BootstrapCore.IsBootstrap3 ? "table-condensed" : "table-sm"; 8127 BootstrapCssSelectors.TableActive = BootstrapCore.IsBootstrap3 ? "" : "table-active";
8128 BootstrapCssSelectors.BackgroundLight = BootstrapCore.IsBootstrap3 ? "" : "bg-light"; 8129 BootstrapCssSelectors.BackgroundPrimary = BootstrapCore.IsBootstrap3 ? "bg-primary" : "bg-primary text-white"; 8130 BootstrapCssSelectors.BackgroundDanger = "bg-danger"; 8131 BootstrapCssSelectors.Hidden = BootstrapCore.IsBootstrap3 ? "hidden" : "d-none"; 8132 BootstrapCssSelectors.Row = "row"; 8133 BootstrapCssSelectors.Column = "col"; 8134 BootstrapCssSelectors.ColumnAuto = BootstrapCore.IsBootstrap3 ? "" : "col-auto"; 8135 BootstrapCssSelectors.Panel = BootstrapCore.IsBootstrap3 ? "panel" : "card"; 8136 BootstrapCssSelectors.PanelDefault = BootstrapCore.IsBootstrap3 ? "panel-default" : ""; 8137 BootstrapCssSelectors.PanelHeading = BootstrapCore.IsBootstrap3 ? "panel-heading" : "card-header"; 8138 BootstrapCssSelectors.PanelTitle = BootstrapCore.IsBootstrap3 ? "panel-title" : "card-title"; 8139 BootstrapCssSelectors.PanelBody = BootstrapCore.IsBootstrap3 ? "panel-body" : "card-body"; 8140 BootstrapCssSelectors.PanelFooter = BootstrapCore.IsBootstrap3 ? "panel-footer" : "card-footer"; 8141 BootstrapCssSelectors.Radio = BootstrapCore.IsBootstrap3 ? "radio" : "form-check"; 8142 BootstrapCssSelectors.CheckBox = BootstrapCore.IsBootstrap3 ? "checkbox" : "form-check"; 8143 BootstrapCssSelectors.InlineCheckBox = BootstrapCore.IsBootstrap3 ? "checkbox-inline" : "form-check form-check-inline"; 8144 BootstrapCssSelectors.CheckBoxLabel = BootstrapCore.IsBootstrap3 ? "" : "form-check-label"; 8145 BootstrapCssSelectors.CheckBoxInput = BootstrapCore.IsBootstrap3 ? "" : "form-check-input"; 8146 BootstrapCssSelectors.CustomCheckBox = BootstrapCore.IsBootstrap3 ? "" : "custom-control custom-checkbox"; 8147 BootstrapCssSelectors.CustomInlineCheckBox = BootstrapCore.IsBootstrap3 ? "" : "custom-control custom-control-inline custom-checkbox"; 8148 BootstrapCssSelectors.CustomRadioButton = BootstrapCore.IsBootstrap3 ? "" : "custom-control custom-radio"; 8149 BootstrapCssSelectors.CustomInlineRadioButton = BootstrapCore.IsBootstrap3 ? "" : "custom-control custom-control-inline custom-radio"; 8150 BootstrapCssSelectors.CustomCheckLabel = BootstrapCore.IsBootstrap3 ? "" : "custom-control-label"; 8151 BootstrapCssSelectors.CustomCheckInput = BootstrapCore.IsBootstrap3 ? "" : "custom-control-input"; 8152 BootstrapCssSelectors.ControlLabel = BootstrapCore.IsBootstrap3 ? "control-label" : "col-form-label"; 8153 BootstrapCssSelectors.FormControlStatic = BootstrapCore.IsBootstrap3 ? "form-control-static" : "form-control-plaintext" ; 8154 BootstrapCssSelectors.HelpBlock = BootstrapCore.IsBootstrap3 ? "help-block" : "form-text"; 8155 BootstrapCssSelectors.HasError = BootstrapCore.IsBootstrap3 ? "has-error" : ""; 8156 BootstrapCssSelectors.FormControlFeedback = BootstrapCore.IsBootstrap3 ? "form-control-feedback" : "dxbs-feedback"; 8157 BootstrapCssSelectors.InvalidFormControl = BootstrapCore.IsBootstrap3 ? "" : "is-invalid"; 8158 BootstrapCssSelectors.InvalidFeedback = BootstrapCore.IsBootstrap3 ? "" : "invalid-feedback"; 8159 BootstrapCssSelectors.InputGroup = "input-group"; 8160 BootstrapCssSelectors.InputGroupAppendButton = BootstrapCore.IsBootstrap3 ? "input-group-btn" : "input-group-append"; 8161 BootstrapCssSelectors.InputGroupPrependButton = BootstrapCore.IsBootstrap3 ? "input-group-btn" : "input-group-prepend"; 8162 BootstrapCssSelectors.Divider = BootstrapCore.IsBootstrap3 ? "divider" : "dropdown-divider"; 8163 BootstrapCssSelectors.NavItem = BootstrapCore.IsBootstrap3 ? "" : "nav-item"; 8164 BootstrapCssSelectors.NavLink = BootstrapCore.IsBootstrap3 ? "" : "nav-link"; 8165 BootstrapCssSelectors.DropDownMenu = "dropdown-menu"; 8166 BootstrapCssSelectors.DropDownMenuItem = BootstrapCore.IsBootstrap3 ? "" : "dropdown-item"; 8167 BootstrapCssSelectors.ListBoxItemLink = BootstrapCore.IsBootstrap3 ? "list-group-item" : "list-group-item list-group-item-action"; 8168 BootstrapCssSelectors.ListGroupItem = selectClass("list-group-item"); 8169 BootstrapCssSelectors.ListGroup = selectClass("list-group"); 8170 BootstrapCssSelectors.Active = selectClass("active"); 8171 BootstrapCssSelectors.Disabled = selectClass("disabled"); 8172 BootstrapCssSelectors.HiddenLayout = "dxbs-hl"; 8173 BootstrapCssSelectors.Breabcrumb = "breadcrumb"; 8174 BootstrapCssSelectors.BreadcrumbItem = BootstrapCore.IsBootstrap3 ? "" : "breadcrumb-item"; 8175 BootstrapCssSelectors.Toolbar = "btn-toolbar"; 8176 BootstrapCssSelectors.Button = "btn"; 8177 BootstrapCssSelectors.ButtonGroup = "btn-group"; 8178 BootstrapCssSelectors.ButtonGroupVertical = "btn-group-vertical"; 8179 BootstrapCssSelectors.DropDown = "dropdown"; 8180 BootstrapCssSelectors.DropDownToggle = "dropdown-toggle"; 8181 BootstrapCssSelectors.Modal = "modal";
8182 BootstrapCssSelectors.ModalContent = "modal-content"; 8183 BootstrapCssSelectors.ModalBody = "modal-body"; 8184 BootstrapCssSelectors.ModalHeader = "modal-header"; 8185 BootstrapCssSelectors.ModalTitle = "modal-title"; 8186 BootstrapCssSelectors.ModalFooter = "modal-footer"; 8187 BootstrapCssSelectors.ModalBackdrop = "modal-backdrop " + (BootstrapCore.IsBootstrap3 ? "in" : "show"); 8188 BootstrapCssSelectors.Label = BootstrapCore.IsBootstrap3 ? "label" : "badge"; 8189 BootstrapCssSelectors.Alert = "alert"; 8190 function selectClass() { 8191 var argsCount = arguments.length; 8192 if (argsCount === 1 || BootstrapCore.IsBootstrap3) 8193 return arguments[0]; 8194 if (argsCount === 2 || BootstrapCore.IsBootstrap4) 8195 return arguments[1]; 8196 return arguments[2]; 8197 } 8198 BootstrapCssSelectors.Popover = selectClass("popover"); 8199 BootstrapCssSelectors.PopoverArrow = selectClass("arrow", "arrow", "popover-arrow"); 8200 BootstrapCssSelectors.PopoverBody = selectClass("popover-content", "popover-body"); 8201 BootstrapCssSelectors.PopoverHeader = selectClass("popover-title", "popover-header"); 8202 BootstrapCssSelectors.PopoverBottom = selectClass("bottom", "bs-popover-bottom"); 8203 BootstrapCssSelectors.PopoverLeft = selectClass("left", "bs-popover-left"); 8204 BootstrapCssSelectors.PopoverRight = selectClass("right", "bs-popover-right"); 8205 BootstrapCssSelectors.PopoverTop = selectClass("top", "bs-popover-top"); 8206 BootstrapCssSelectors.Tooltip = selectClass("tooltip"); 8207 BootstrapCssSelectors.TooltipArrow = selectClass("tooltip-arrow", "arrow", "tooltip-arrow"); 8208 BootstrapCssSelectors.TooltipContent = selectClass("tooltip-inner"); 8209 BootstrapCssSelectors.TooltipBottom = selectClass("bottom", "bs-tooltip-bottom"); 8210 BootstrapCssSelectors.TooltipLeft = selectClass("left", "bs-tooltip-left"); 8211 BootstrapCssSelectors.TooltipRigth = selectClass("right", "bs-tooltip-right"); 8212 BootstrapCssSelectors.TooltipTop = selectClass("top", "bs-tooltip-top"); 8213 BootstrapCssSelectors.Border = selectClass("dxbs-border", "border"); 8214 BootstrapCssSelectors.TableHeadLight = selectClass("", "thead-light", ""); 8215 BootstrapCssSelectors.PanelHeadingTabs = selectClass("panel-heading-tabs", "card-header-tabs"); 8216 BootstrapCssSelectors.Invisible = selectClass("invisible"); 8217 BootstrapCssSelectors.TextCenter = "text-center"; 8218 BootstrapCssSelectors.TextMuted = selectClass("text-muted"); 8219 BootstrapCssSelectors.TextRight = selectClass("text-right", "text-right", "text-end"); 8220 BootstrapCssSelectors.MarginStart = selectClass("", "ml", "ms"); 8221 BootstrapCssSelectors.MarginEnd = selectClass("", "mr", "me"); 8222 BootstrapCssSelectors.Badge = selectClass("badge"); 8223 BootstrapCssSelectors.BadgePill = selectClass("", "badge-pill", "rounded-pill"); 8224 BootstrapCssSelectors.BadgePrimary = selectClass("", "badge-primary", "bg-primary"); 8225 BootstrapCssSelectors.BadgeSecondary = selectClass("", "badge-secondary", "bg-secondary"); 8226 BootstrapCssSelectors.BadgeSuccess = selectClass("", "badge-success", "bg-success"); 8227 BootstrapCssSelectors.BadgeDanger = selectClass("", "badge-danger", "bg-danger"); 8228 BootstrapCssSelectors.BadgeWarning = selectClass("", "badge-warning", "bg-warning"); 8229 BootstrapCssSelectors.BadgeInfo = selectClass("", "badge-info", "bg-info"); 8230 BootstrapCssSelectors.BadgeLight = selectClass("", "badge-light", "bg-light"); 8231 BootstrapCssSelectors.BadgeDark = selectClass("", "badge-dark", "bg-dark"); 8232 BootstrapCssSelectors.TextPrimary = selectClass("text-primary"); 8233 BootstrapCssSelectors.TextSecondary = selectClass("", "text-secondary"); 8234 BootstrapCssSelectors.TextSuccess = selectClass("text-success"); 8235 BootstrapCssSelectors.TextDanger = selectClass("text-danger"); 8236 BootstrapCssSelectors.TextWarning = selectClass("text-warning"); 8237 BootstrapCssSelectors.TextInfo = selectClass("text-info"); 8238 BootstrapCssSelectors.TextLight = selectClass("", "text-light"); 8239 BootstrapCssSelectors.TextDark = selectClass("", "text-dark"); 8240 BootstrapCssSelectors.ButtonPrimary = selectClass("btn-primary"); 8241 BootstrapCssSelectors.ButtonSecondary = selectClass("btn-default", "btn-secondary"); 8242 BootstrapCssSelectors.ButtonSuccess = selectClass("btn-success"); 8243 BootstrapCssSelectors.ButtonDanger = selectClass("btn-danger"); 8244 BootstrapCssSelectors.ButtonWarning = selectClass("btn-warning"); 8245 BootstrapCssSelectors.ButtonInfo = selectClass("btn-info"); 8246 BootstrapCssSelectors.ButtonLight = selectClass("", "btn-light"); 8247 BootstrapCssSelectors.ButtonDark = selectClass("", "btn-dark"); 8248 BootstrapCssSelectors.ButtonLink = selectClass("btn-link"); 8249 BootstrapCssSelectors.ButtonOutlineSecondary = selectClass("", "btn-outline-secondary"); 8250 BootstrapCssSelectors.FormControl = selectClass("form-control"); 8251 BootstrapCssSelectors.FormGroup = selectClass("form-group", "form-group", ""); 8252 BootstrapCssSelectors.Pagination = selectClass("pagination"); 8253 BootstrapCssSelectors.AccordionItem = selectClass("panel", "card", "accordion-item"); 8254 BootstrapCssSelectors.AccordionHeader = selectClass("panel-heading", "card-header", "accordion-header"); 8255 BootstrapCssSelectors.AccordionBody = selectClass("panel-body", "card-body", "accordion-body"); 8256 var mediaQueryScreenSizesCache = {}; 8257 function createCssRuleForScreenSizeMediaQuery(cssVarName, fallbackWidth, cssRule) { 8258 var cache = mediaQueryScreenSizesCache;
8259 var minWidth = cache[cssVarName] || (cache[cssVarName] = (ASPx.GetCurrentStyle(document.body).getPropertyValue(cssVarName) || fallbackWidth)); 8260 if(minWidth) { 8261 var styleSheet = ASPx.GetCurrentStyleSheet(); 8262 if(styleSheet) 8263 styleSheet.insertRule("@media (min-width: " + minWidth + ") {\n" + cssRule + "\n}\n", styleSheet.cssRules.length); 8264 } 8265 } 8266 BootstrapCore.createCssRuleForLargeScreen = function(cssRule) { 8267 createCssRuleForScreenSizeMediaQuery("--breakpoint-lg", "992px", cssRule); 8268 }; 8269 function getTableCellStyleRuleCssText(cellElement, addBorders, addPaddings) { 8270 var cellStyleProperties = []; 8271 if(addBorders) { 8272 cellStyleProperties = cellStyleProperties.concat([ 8273 "border", "border-left", "border-top", "border-right", "border-bottom", 8274 "border-left-width", "border-left-style", "border-left-color", 8275 "border-top-width", "border-top-style", "border-top-color", 8276 "border-right-width", "border-right-style", "border-right-color", 8277 "border-bottom-width", "border-bottom-style", "border-bottom-color" 8278 ]); 8279 } 8280 if(addPaddings) 8281 cellStyleProperties = cellStyleProperties.concat(["padding", "padding-left", "padding-top", "padding-right", "padding-bottom"]); 8282 return getStyleRuleCssText(ASPx.GetCurrentStyle(cellElement), cellStyleProperties); 8283 } 8284 function getStyleRuleCssText(currentStyle, styleProperties) { 8285 var rules = []; 8286 if(currentStyle) { 8287 for(var i = 0; i < styleProperties.length; i++) { 8288 var stylePropertyValue = ASPx.Str.Trim(currentStyle.getPropertyValue(styleProperties[i])) + ""; 8289 if(stylePropertyValue) 8290 rules.push(styleProperties[i] + ": " + stylePropertyValue); 8291 } 8292 } 8293 return rules.join(";"); 8294 } 8295 function updateTableCellStyleSheetRule(tableClassName, styleSheet, cssText, isHeaderCell, forceAdd) { 8296 if(!cssText || !cssText.length) 8297 return; 8298 var selector = "." + tableClassName + " tr > " + (isHeaderCell ? "th" : "td"); 8299 updateStyleSheetRule(styleSheet, selector, cssText, forceAdd); 8300 } 8301 function updateStyleSheetRule(styleSheet, selector, cssText, forceAdd) { 8302 if(!forceAdd) { 8303 var rule = ASPx.GetStyleSheetRules(selector.substring(1)); 8304 if(rule) 8305 rule.style.cssText = cssText; 8306 else 8307 forceAdd = true; 8308 } 8309 if(forceAdd) 8310 ASPx.AddStyleSheetRule(styleSheet, selector, cssText); 8311 } 8312 BootstrapCore.updateTableCellStyleSheetRules = function(forceAdd) { 8313 if(BootstrapCore.IsBootstrap3) { 8314 var styleSheet = ASPx.GetCurrentStyleSheet(); 8315 if(styleSheet) { 8316 var container = createTestElement(); 8317 var tableElement = document.createElement("table"); 8318 var tableBody = document.createElement("tbody"); 8319 tableElement.appendChild(tableBody); 8320 container.appendChild(tableElement); 8321 var row = document.createElement("tr"); 8322 var cell = document.createElement("td"); 8323 row.appendChild(cell); 8324 tableBody.appendChild(row); 8325 var rowWithHeaderCell = document.createElement("tr"); 8326 var headerCell = document.createElement("th"); 8327 rowWithHeaderCell.appendChild(headerCell); 8328 tableBody.appendChild(rowWithHeaderCell); 8329 document.body.appendChild(container); 8330 var tableClassName = BootstrapCssSelectors.Table; 8331 var tableBorderedClassName = BootstrapCssSelectors.TableBordered; 8332 var tableSmallClassName = BootstrapCssSelectors.TableSmall; 8333 tableElement.className = tableClassName; 8334 updateTableCellStyleSheetRule(tableClassName, styleSheet, getTableCellStyleRuleCssText(cell, true, true), true, forceAdd); 8335 updateTableCellStyleSheetRule(tableClassName, styleSheet, getTableCellStyleRuleCssText(headerCell, true, true), false, forceAdd); 8336 cell.className = ASPx.BootstrapCssSelectors.Active; 8337 var tableActiveCssClass = "dxbs-table-active"; 8338 var tableActiveCssText = getStyleRuleCssText(ASPx.GetCurrentStyle(cell), ["background-color"]); 8339 updateStyleSheetRule(styleSheet, "." + tableActiveCssClass, tableActiveCssText, forceAdd); 8340 cell.className = ""; 8341 tableElement.className = tableBorderedClassName; 8342 updateTableCellStyleSheetRule(tableBorderedClassName, styleSheet, getTableCellStyleRuleCssText(cell, true, false), true, forceAdd); 8343 updateTableCellStyleSheetRule(tableBorderedClassName, styleSheet, getTableCellStyleRuleCssText(headerCell, true, false), false, forceAdd); 8344 tableElement.className = tableSmallClassName; 8345 updateTableCellStyleSheetRule(tableSmallClassName, styleSheet, getTableCellStyleRuleCssText(cell, false, true), true, forceAdd); 8346 updateTableCellStyleSheetRule(tableSmallClassName, styleSheet, getTableCellStyleRuleCssText(headerCell, false, true), false, forceAdd); 8347 document.body.removeChild(container); 8348 } 8349 } 8350 }; 8351 var existingColors = {}; 8352 BootstrapCore.createColorItemsRules = function () { 8353 var colorElements = document.querySelectorAll("[data-color]"); 8354 var cssText = ""; 8355 for (var i = 0; i < colorElements.length; i++) { 8356 var colorElement = colorElements[i]; 8357 var colorValue = ASPx.Attr.GetAttribute(colorElement, "data-color"); 8358 if(existingColors[colorValue]) 8359 continue; 8360 existingColors[colorValue] = true; 8361 cssText += "[data-color=\"" + colorValue + "\"],\n[data-item-color=\"" + colorValue + "\"]:before { background-color: " + colorValue + "; }\n"; 8362 } 8363 if (cssText) 8364 BootstrapCore.createStylesBlock(cssText, "colors" + ASPx.CreateGuid()); 8365 }; 8366 BootstrapCore.createColorRule = function(c) { 8367 if(existingColors[c]) 8368 return; 8369 existingColors[c] = true; 8370 ASPx.AddStyleSheetRule(ASPx.GetCurrentStyleSheet(), "[data-color=\"" + c + "\"],\n[data-item-color=\"" + c + "\"]:before", "background-color: " + c + ";"); 8371 }; 8372 BootstrapCore.getActualBgColor = function (el) { 8373 var color = ASPx.GetCurrentStyle(el).backgroundColor; 8374 var c = ASPx.Color.ColorToHexadecimal(color, true); 8375 if(c.a < 1) { 8376 var bgColor = ASPx.GetCurrentStyle(el.parentNode).backgroundColor; 8377 var bg; 8378 while(el.parentNode && el.parentNode.nodeType == 1 && (bg = ASPx.Color.ColorToHexadecimal(bgColor, true)).a === 0) 8379 bgColor = ASPx.GetCurrentStyle(el = el.parentNode).backgroundColor; 8380 c.r = Math.round(((1 - c.a) * bg.r) + (c.a * c.r)); 8381 c.g = Math.round(((1 - c.a) * bg.g) + (c.a * c.g)); 8382 c.b = Math.round(((1 - c.a) * bg.b) + (c.a * c.b)); 8383 } 8384 return "rgb(" + c.r + "," + c.g + "," + c.b + ")"; 8385 }; 8386 var createdStylesBlockKeys = {}; 8387 BootstrapCore.removeStylesBlock = function(key) { 8388 var stylesBlock = document.getElementById(key + "_styles"); 8389 if(stylesBlock) 8390 ASPx.RemoveElement(stylesBlock); 8391 }; 8392 BootstrapCore.createStylesBlock = function(cssText, key, container) { 8393 key = key + "_styles"; 8394 var styleElement = null; 8395 if(key) { 8396 if(createdStylesBlockKeys[key]) { 8397 styleElement = document.getElementById(key); 8398 if(styleElement) 8399 ASPx.RemoveElement(styleElement); 8400 } 8401 createdStylesBlockKeys[key] = true; 8402 } 8403 styleElement = document.createElement("STYLE"); 8404 styleElement.appendChild(document.createTextNode(cssText)); 8405 if(container === undefined) 8406 container = ASPx.GetHeadElementOrCreateIfNotExist(document);
8407 container.appendChild(styleElement); 8408 styleElement.id = key; 8409 }; 8410 BootstrapCore.initializeAccentColorRelatedSelectors = function(forceAddCssRule) { 8411 var linkEl = document.createElement("A"); 8412 linkEl.href = ASPx.AccessibilityEmptyUrl; 8413 linkEl.className = ASPx.BootstrapCssSelectors.HiddenLayout; 8414 ASPx.DOM.ChangeDOM(function () { 8415 document.body.appendChild(linkEl); 8416 ASPx.DOM.CalculateStyles(function () { 8417 var accentColor = ASPx.Color.ColorToHexadecimal(ASPx.GetCurrentStyle(linkEl).color); 8418 ASPx.DOM.ChangeDOM(function() { 8419 updateStyleSheetRule(ASPx.GetCurrentStyleSheet(), ".dx-accent-color", "color: " + accentColor, forceAddCssRule); 8420 ASPx.RemoveElement(linkEl); 8421 }); 8422 }); 8423 }); 8424 }; 8425 function createBootstrapStateItemClass() { 8426 var stateClass = ASPx.CreateClass(ASPx.StateItem, { 8427 Clone: function() { 8428 return new stateClass(this.name, this.classNames, this.cssTexts, this.postfixes, 8429 this.imageObjs, this.imagePostfixes, this.kind, this.disableApplyingStyleToLink); 8430 }, 8431 Apply: function(element) { 8432 this.changeState(element, true); 8433 }, 8434 Cancel: function(element) { 8435 this.changeState(element, false); 8436 }, 8437 changeState: function(element, condition) { 8438 if(!this.enabled) return; 8439 var elements = this.GetElements(element); 8440 for(var i = 0; i < elements.length; i++) { 8441 if(elements[i]) 8442 this.changeClassName(elements[i], this.GetResultClassName(i), condition); 8443 } 8444 }, 8445 changeClassName: function(el, className, condition) { 8446 if (!!className) 8447 ASPx.DOM.ToggleCssClass(el, className, condition); 8448 }, 8449 ForceRedrawAppearance: function() { } 8450 }); 8451 return stateClass; 8452 } 8453 var bootstrapStateItemClass; 8454 BootstrapCore.AddStateItems = function(callback) { 8455 ASPx.GetStateController().withCustomStateItemType(bootstrapStateItemClass || (bootstrapStateItemClass = createBootstrapStateItemClass()), callback); 8456 }; 8457 ASPx.BootstrapCore = BootstrapCore; 8458 ASPx.BootstrapCssSelectors = BootstrapCssSelectors; 8459 ASPx.BuildBSCssClass = function() { 8460 return ASPx.Data.CollectionToArray(arguments) 8461 .map(function (c) { return BootstrapCssSelectors[c] || c; }).join(" "); 8462 }; 8463 ASPx.CreatePatchedClass = function(baseClass, properties, patch) { 8464 var patchedBaseClass = ASPx.CreateClass(baseClass, patch); 8465 return ASPx.CreateClass(patchedBaseClass, properties || {}); 8466 }; 8467 if(BootstrapCore.CheckReferences) 8468 ASPx.attachToReady(detectBootstrapFramework); 8469 function detectBootstrapFramework() { 8470 var testElement = createTestElement(); 8471 testElement.className = "input-group ms-1"; 8472 document.body.appendChild(testElement); 8473 var style = ASPx.GetCurrentStyle(testElement); 8474 var exists = true; 8475 if (BootstrapCore.BootstrapMode === "Bootstrap3") { 8476 exists = style.display.indexOf("table") > -1; 8477 } 8478 else if (BootstrapCore.BootstrapMode === "Bootstrap4") { 8479 exists = style.display.indexOf("flex") > -1 && 8480 style["margin-left"].indexOf("0") > -1; 8481 } 8482 else if (BootstrapCore.BootstrapMode === "Bootstrap5") { 8483 exists = style.display.indexOf("flex") > -1 && 8484 style["margin-left"].indexOf("0") === -1; 8485 } 8486 document.body.removeChild(testElement); 8487 if (!exists) { 8488 var version = parseInt(ASPx.BootstrapCore.BootstrapMode.substr(9)); 8489 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."); 8490 } 8491 } 8492 function createTestElement() { 8493 var testElement = document.createElement("div"); 8494 testElement.style.position = "absolute"; 8495 testElement.style.top = ASPx.InvalidPosition + "px"; 8496 testElement.style.left = ASPx.InvalidPosition + "px"; 8497 return testElement; 8498 } 8499 ASPx.attachToLoad(function() { 8500 ASPx.BootstrapCore.updateTableCellStyleSheetRules(true); 8501 ASPx.BootstrapCore.initializeAccentColorRelatedSelectors(true); 8502 }); 8503})(dx || (dx = {})); 8504 8505(function(dx) { 8506 (function (env) { 8507 var baseClass = env.CreateClass({ 8508 constructor: function (args) { 8509 Object.defineProperty(this, '__dx__', { value: args, enumerable: false, configurable: false, writable: false }); 8510 if(!args[1].getInstance) 8511 Object.defineProperty(args[1], 'getInstance', { value: args[2], enumerable: true, configurable: false, writable: false }); 8512 }, 8513 getType: function () { return this.__dx__[1]; }, 8514 clone: function (env) { return create(this.__dx__[0], env, env ? null : this.getType()); } 8515 }); 8516 function create(setupEnv, envObj, type, ret) { 8517 type = type || (type = env.CreateClass(baseClass, setupEnv(envObj || env))); 8518 return ret = new type([setupEnv, type, function () { return ret; }]); 8519 } 8520 env.CreateSingleton = create; 8521 })(ASPx); 8522 var BootstrapEventManager = {}; 8523 var globalContainersStorage = {}; 8524 function getEventAttachFunc(owner, key) { 8525 var cs = globalContainersStorage[owner.name]; 8526 if(!cs || cs.checkSum !== owner.checkSum) 8527 cs = globalContainersStorage[owner.name] = { checkSum: (owner.checkSum = ASPx.CreateGuid()), c: {} }; 8528 return cs.c[key] || (cs.c[key] = createEventHandlerContainer(
8529 owner.getEventContainers || function() { return [document.getElementById(owner.name)]; }, key)); 8530 } 8531 function createEventHandlerContainer(getEventContainers, eventName) { 8532 var elements = getEventContainers(); 8533 var queue = [], i = 0, order = [queue]; 8534 function addToHierarchy(el, handler) { 8535 var foundQueue = queue; 8536 var detachIndex = foundQueue.length; 8537 foundQueue.push({ target: el, handler: handler }); 8538 return function() { foundQueue.splice(detachIndex, 1); }; 8539 } 8540 function handleEvent(e) { 8541 if(e.cancelBubble) return; 8542 var srcEl = ASPx.Evt.GetEventSource(e); 8543 for(var i = 0; !e.cancelBubble && i < order.length; i++) { 8544 var q = order[i]; 8545 if(q && q.length) { 8546 for(var j = 0; !e.cancelBubble && j < q.length; j++) { 8547 if(ASPx.GetIsParent(q[j].target, srcEl)) { 8548 q[j].handler(e); 8549 break; 8550 } 8551 } 8552 } 8553 } 8554 } 8555 for(var i = 0; i < elements.length; i++) { 8556 ASPx.Evt.AttachEventToElement(elements[i], eventName, handleEvent); 8557 } 8558 return addToHierarchy; 8559 } 8560 BootstrapEventManager.attachEventToElement = function(owner, element, eventName, handler) { 8561 var detacherBagRef = element._detacherBagRef || (element._detacherBagRef = {}); 8562 detacherBagRef[eventName] = getEventAttachFunc(owner, eventName)(element, handler); 8563 }; 8564 BootstrapEventManager.detachEventFromElement = function(element, eventName, handler) { 8565 var detacherBagRef = element._detacherBagRef || (element._detacherBagRef = {}); 8566 if(detacherBagRef[eventName]) 8567 detacherBagRef[eventName](); 8568 }; 8569 BootstrapEventManager.EventsHub = ASPx.CreateSingleton(function (ASPx) { 8570 var eventListenersAttachedToDOM = false, eventListenersBuffer = [], handleOnEventBubbling = true, emptyEventListener = { attach: function () { }, detach: function () { } }; 8571 function ensureEventListenersActive() { 8572 if (eventListenersAttachedToDOM === true) 8573 return; 8574 eventListenersBuffer.forEach(function (f) { f(); }); 8575 eventListenersBuffer = null; 8576 eventListenersAttachedToDOM = true; 8577 } 8578 function getEventListener(eventName, targetGetter) { 8579 targetGetter = targetGetter || function () { return document; }; 8580 if (eventName === "mouseover" && ASPx.Browser.MobileUI) 8581 return emptyEventListener; 8582 var listeners = []; 8583 function getDepth(root, el) { return el !== root ? getDepth(root, el.parentNode) + 1 : 0; } 8584 function attachListenersToDOM() { 8585 ASPx.Evt.AttachEventToElement(targetGetter(), eventName, function (evt) { 8586 var evtSrc = ASPx.Evt.GetEventSource(evt); 8587 function invokeHandlerForListener(listener) { listener.handler(listener.el, evt, evtSrc, eventName); } 8588 function createListenerInfo(listener) { 8589 var p = ASPx.GetParentBySelector(evtSrc, listener.targetSelector); 8590 if (!p && !(listener.fallbackSelector && ASPx.ElementMatchesSelector(evtSrc, listener.fallbackSelector))) 8591 return null; 8592 return { isFallback: !p, handler: p ? listener.handler : listener.fallbackHandler, el: p || evtSrc, depth: p ? getDepth(p, evtSrc) : 0 }; 8593 } 8594 function processRelatedListeners(relatedListeners, isFallback) { 8595 relatedListeners.filter(function (rl) { return rl.isFallback === isFallback; }).sort(function (a, b) { return a.depth < b.depth; }).forEach(invokeHandlerForListener); 8596 } 8597 var relatedListeners = listeners.map(createListenerInfo).filter(function (rl) { return !!rl; }); 8598 processRelatedListeners(relatedListeners, false); 8599 processRelatedListeners(relatedListeners, true); 8600 }, handleOnEventBubbling); 8601 } 8602 function attach(eventListenerInfo) { 8603 var targetSelector, handler, fallbackSelector, fallbackHandler; 8604 for (var k in eventListenerInfo) { 8605 if (eventListenerInfo.hasOwnProperty(k)) { 8606 if (k === "*") { 8607 fallbackSelector = k; 8608 fallbackHandler = eventListenerInfo[k]; 8609 } else { 8610 targetSelector = k; 8611 handler = eventListenerInfo[k]; 8612 } 8613 } 8614 } 8615 listeners.push({ targetSelector: targetSelector, handler: handler, fallbackSelector: fallbackSelector, fallbackHandler: fallbackHandler, owner: eventListenerInfo }); 8616 } 8617 function detach(eventListenerInfo) { 8618 listeners = listeners.filter(function (l) { return l.owner !== eventListenerInfo; }); 8619 } 8620 eventListenersBuffer.push(attachListenersToDOM); 8621 return { 8622 attach: attach, 8623 detach: detach 8624 }; 8625 } 8626 return { 8627 getEventListener: getEventListener, 8628 ensureEventListenersActive: ensureEventListenersActive 8629 }; 8630 }); 8631 ASPx.BootstrapEventManager = BootstrapEventManager; 8632 var BootstrapPopupManager = {}; 8633 var visiblePopups; 8634 var popupInfo = function(elements, onHide){ 8635 this.elements = elements; 8636 this.onHide = onHide; 8637 }; 8638 BootstrapPopupManager.registerVisiblePopup = function(elements, onHide){ 8639 if(!visiblePopups) 8640 visiblePopups = []; 8641 if(!ASPx.Ident.IsArray(elements)) 8642 elements = [elements]; 8643 visiblePopups.push(new popupInfo(elements, onHide)); 8644 showPopup(elements); 8645 }; 8646 BootstrapPopupManager.correctPopupPositionForClientWindow = function(elements, hAlign, hOffset, vAlign, vOffset) {
8647 correctPopupForClientWindow(ASPx.Ident.IsArray(elements) ? elements : [elements], hAlign, hOffset, vAlign, vOffset); 8648 }; 8649 BootstrapPopupManager.unregisterVisiblePopup = function(elements){ 8650 if(visiblePopups && visiblePopups.length && elements && elements.length) { 8651 var popupInfo = this.findPopupInfo(elements); 8652 if(popupInfo) { 8653 hidePopup(popupInfo.elements); 8654 ASPx.Data.ArrayRemove(visiblePopups, popupInfo); 8655 if(popupInfo.onHide) 8656 popupInfo.onHide(); 8657 } 8658 } 8659 }; 8660 BootstrapPopupManager.findPopupInfo = function(elements){ 8661 for(var i = 0; i < visiblePopups.length; i++){ 8662 if(ASPx.Data.ArrayEqual(visiblePopups[i].elements, elements)) 8663 return visiblePopups[i]; 8664 } 8665 return null; 8666 }; 8667 BootstrapPopupManager.isPopupVisible = function(elements){ 8668 return visiblePopups && visiblePopups.length && elements && elements.length && this.findPopupInfo(elements); 8669 }; 8670 function showPopup(elements) { 8671 var originElement = getOriginElement(elements); 8672 var popupElement = getPopupElement(elements); 8673 var x = ASPx.GetAbsoluteX(originElement); 8674 var y = ASPx.GetAbsoluteY(originElement) + originElement.offsetHeight; 8675 ASPx.SetAbsoluteX(popupElement, x); 8676 ASPx.SetAbsoluteY(popupElement, y); 8677 ASPx.SetElementDisplay(popupElement, true); 8678 } 8679 function correctPopupForClientWindow(elements, hAlign, hOffset, vAlign, vOffset) { 8680 var originElement = getOriginElement(elements); 8681 var popupElement = getPopupElement(elements); 8682 ASPx.SetAbsoluteX(popupElement, correctPopupPositionToClientScreen(popupElement, originElement, true, hAlign, hOffset)); 8683 ASPx.SetAbsoluteY(popupElement, correctPopupPositionToClientScreen(popupElement, originElement, false, vAlign, vOffset)); 8684 } 8685 function hidePopup(elements){ 8686 var popupElement = getPopupElement(elements); 8687 if(popupElement) 8688 ASPx.SetElementDisplay(popupElement, false); 8689 } 8690 function getPopupElement(elements){ 8691 return elements && elements.length > 0 ? elements[0] : null; 8692 } 8693 function getOriginElement(elements){ 8694 return elements && elements.length > 1 ? elements[1] : null; 8695 } 8696 function correctPopupPositionToClientScreen(popupElement, originElement, isX, align, offset) { 8697 var startPos = ASPx.InvalidPosition; 8698 var startPosInit = isX ? ASPx.GetAbsoluteX(popupElement) : ASPx.GetAbsoluteY(popupElement); 8699 var popupPosition = isX ? ASPx.PopupUtils.GetPopupAbsoluteX(popupElement, originElement, align, offset, startPos, startPosInit, false, true) 8700 : ASPx.PopupUtils.GetPopupAbsoluteY(popupElement, originElement, align, offset, startPos, startPosInit, true, false); 8701 return popupPosition.position; 8702 } 8703 ASPx.Evt.AttachEventToDocument("mousedown", function(evt) { 8704 if(!visiblePopups || !visiblePopups.length) return; 8705 var eventSource = ASPx.Evt.GetEventSource(evt); 8706 if(typeof(ASPx.GetDropDownCollection) != "undefined") { 8707 var dropDownCollection = ASPx.GetDropDownCollection(); 8708 var dropDownControl = dropDownCollection.GetDroppedDropDown(); 8709 if(dropDownControl != null) { 8710 var modalWrapperElement = dropDownControl.GetMainElement().querySelector(".dxbs-ddmodal"); 8711 var isEventFromModalWrapper = ASPx.GetIsParent(modalWrapperElement, eventSource); 8712 var isEventFromDropDownWindow = ASPx.GetIsParent(dropDownControl.GetDropDownWindow(), eventSource); 8713 if(!(isEventFromModalWrapper || isEventFromDropDownWindow)) { 8714 var isEventFromDropDownControl = !dropDownCollection.IsEventNotFromControlSelf(evt, dropDownControl); 8715 if(isEventFromDropDownControl) 8716 return; 8717 } 8718 var isEventOutFromModalDialog = isEventFromModalWrapper && !isEventFromDropDownWindow; 8719 if(isEventOutFromModalDialog) { 8720 dropDownControl.CloseDropDownByDocumentOrWindowEvent(false); 8721 return; 8722 } 8723 if(!dropDownControl.QueryCloseUp.IsEmpty()) 8724 return; 8725 } 8726 } 8727 for(var i = visiblePopups.length - 1; i >= 0; i--) { 8728 var needHidePopup = true; 8729 var popupElements = visiblePopups[i].elements; 8730 for(var j = 0; j < popupElements.length; j++) { 8731 if(ASPx.GetIsParent(popupElements[j], eventSource)) 8732 needHidePopup = false; 8733 } 8734 if(needHidePopup) 8735 BootstrapPopupManager.unregisterVisiblePopup(popupElements); 8736 } 8737 }); 8738 BootstrapPopupManager.PopupZIndex = 500; 8739 BootstrapPopupManager.PopupModalZIndex = 1100; 8740 BootstrapPopupManager.PopupType = "bspopup"; 8741 BootstrapPopupManager.PopupModalType = "modalbspopup"; 8742 ASPx.BootstrapPopupManager = BootstrapPopupManager; 8743 var defaultDecorationStyles = { }; 8744 var BootstrapEditorStyleDecoration = ASPx.CreateClass(ASPx.TextEditorStyleDecoration, { 8745 constructor: function(editor) { 8746 this.constructor.prototype.constructor.call(this, editor);
8747 if(editor.cssClasses && editor.cssClasses.nt) 8748 this.innerStyles["N"] = editor.cssClasses.nt; 8749 }, 8750 InitializeNullTextClassName: function() { 8751 if(this.HasDecoration("N")) 8752 this.nullTextClassName = this.innerStyles["N"]; 8753 }, 8754 IsTimeEditDecorated: function() { 8755 return ASPx.Ident.IsASPxClientTimeEdit && ASPx.Ident.IsASPxClientTimeEdit(this.editor); 8756 }, 8757 HasDecoration: function(key) { 8758 var editor = this.editor; 8759 var validationEnabled = editor.customValidationEnabled; 8760 var hasNullTextDecoration = key == "N" && (!!editor.nullText || this.IsTimeEditDecorated()); 8761 var hasInvalidDecoration = key == "I" && validationEnabled; 8762 var hasFocusedDecoration = editor.needFocusedStyleDecoration && (key == "F" || key == "FI" && validationEnabled); 8763 var hasDecoration = hasNullTextDecoration || hasInvalidDecoration || hasFocusedDecoration; 8764 if(hasDecoration) { 8765 var needUpdateDefaultDecoration = !defaultDecorationStyles[key] || !defaultDecorationStyles[key].isValid; 8766 if(needUpdateDefaultDecoration) 8767 BootstrapEditorStyleDecoration.UpdateDefaultDecorationStyles([key]); 8768 if(!this.innerStyles[key] && defaultDecorationStyles[key]) 8769 this.innerStyles[key] = defaultDecorationStyles[key].className; 8770 } 8771 return hasDecoration; 8772 }, 8773 CanApplyNullTextStyleToElement: function(element) { 8774 var needApplyNullTextClassName = this.editor.focused && this.IsTimeEditDecorated(); 8775 return !needApplyNullTextClassName 8776 ? this.IsInputElement(element) && this.editor.GetInputElement() == element 8777 : false; 8778 }, 8779 CanApplyFocusedStyleToElement: function(element) { 8780 var tabIndex = parseInt(ASPx.Attr.GetAttribute(element, "tabindex")); 8781 return !this.IsInputElement(element) 8782 ? !isNaN(tabIndex) && tabIndex >= 0 || ASPx.ElementContainsCssClass(element, ASPx.BootstrapCssSelectors.FormControl) 8783 : false; 8784 }, 8785 CanApplyInvalidStyleToElement: function(element) { 8786 var editor = this.editor; 8787 var isEditorInputElement = editor.GetInputElement() == element 8788 || editor.GetPasswordNullTextInputElement && editor.GetPasswordNullTextInputElement() == element; 8789 var isFormControlElement = isEditorInputElement || ASPx.ElementContainsCssClass(element, ASPx.BootstrapCssSelectors.FormControl); 8790 var isCheckInputElement = ASPx.ElementContainsCssClass(element, "form-check-input") 8791 || ASPx.ElementContainsCssClass(element, "custom-control-input"); 8792 return (isFormControlElement || isCheckInputElement) != ASPx.BootstrapCore.IsBootstrap3; 8793 }, 8794 ApplyFocusedStyle: function(element, inner) { 8795 var focusedInvalidStyleApplied = !this.editor.GetIsValid() && this.editor.focused && this.editor.customValidationEnabled; 8796 if(!focusedInvalidStyleApplied && this.CanApplyFocusedStyleToElement(element)) 8797 ASPx.TextEditorStyleDecoration.prototype.ApplyFocusedStyle.call(this, element, true); 8798 }, 8799 ApplyFocusedInvalidStyle: function(element) { 8800 if(this.CanApplyFocusedStyleToElement(element) && this.HasDecoration("FI")) 8801 this.ApplyDecoration("FI", element, true, this.editor.focused && !this.editor.GetIsValid()); 8802 }, 8803 ApplyInvalidStyle: function(element, inner) { 8804 if(this.CanApplyInvalidStyleToElement(element)) 8805 ASPx.TextEditorStyleDecoration.prototype.ApplyInvalidStyle.call(this, element, true); 8806 this.ApplyFocusedInvalidStyle(element); 8807 }, 8808 ApplyNullTextStyle: function(element, inner) { 8809 if(this.CanApplyNullTextStyleToElement(element)) 8810 ASPx.TextEditorStyleDecoration.prototype.ApplyNullTextStyle.call(this, element, true); 8811 }, 8812 ApplyNullTextClassName: function(active) { 8813 var nullTextClassName = this.GetNullTextClassName(); 8814 var inputElement = this.editor.GetInputElement(); 8815 if(active) 8816 ASPx.AddClassNameToElement(inputElement, nullTextClassName); 8817 else 8818 ASPx.RemoveClassNameFromElement(inputElement, nullTextClassName); 8819 }, 8820 Update: function() { 8821 if(this.IsUpdateLocked()) 8822 return; 8823 var mainElement = this.editor.GetMainElement(); 8824 for(var i = 0; i < this.postfixList.length; i++) { 8825 var postfix = this.postfixList[i]; 8826 var elements = postfix.length ? mainElement.querySelectorAll(postfix) : [ mainElement ]; 8827 for(var j = 0; j < elements.length; j++) 8828 if(elements[j])
8829 this.ApplyStyles(elements[j], true); 8830 } 8831 }, 8832 IsInputElement: function(element) { 8833 var tagName = element.tagName.toUpperCase(); 8834 return tagName == "TEXTAREA" || tagName == "INPUT" || tagName == "SELECT"; 8835 } 8836 }); 8837 BootstrapEditorStyleDecoration.UpdateDefaultDecorationStyles = function(keys) { 8838 var container = document.createElement("DIV"); 8839 ASPx.Attr.SetAttribute(container, 8840 "style", "overflow:hidden;position:fixed;z-index:10000;top:0;left:0;opacity:0;"); 8841 document.body.appendChild(container); 8842 var inputElement = document.createElement("INPUT"); 8843 inputElement.type = "text"; 8844 ASPx.Attr.SetAttribute(inputElement, 8845 "style", "transition:none!important;-webkit-transition:none!important;-o-transition:none!important;"); 8846 container.appendChild(inputElement); 8847 resetDefaultDecorationStyles(keys); 8848 if(!keys || !keys.length) 8849 keys = ["N", "I", "F", "FI"]; 8850 for(var key, i = 0; key = keys[i]; i++) 8851 updateDefaultStyleDecoration(key, inputElement, container); 8852 document.body.removeChild(container); 8853 }; 8854 function resetDefaultDecorationStyles(keys) { 8855 if(!keys || !keys.length) 8856 keys = ASPx.GetObjectKeys(defaultDecorationStyles); 8857 for(var key, i = 0; key = keys[i]; i++) { 8858 if(defaultDecorationStyles[key]) 8859 defaultDecorationStyles[key].isValid = false; 8860 } 8861 } 8862 function updateDefaultStyleDecoration(key, input, inputContainer) { 8863 var defaultNullTextClassName = "text-muted"; 8864 var defaultInvalidClassName = ASPx.BootstrapCore.IsBootstrap3 ? ASPx.BootstrapCssSelectors.HasError : ASPx.BootstrapCssSelectors.InvalidFormControl; 8865 switch(key) { 8866 case "N": 8867 if(ASPx.BootstrapCore.IsBootstrap3) { 8868 ASPx.SetClassName(input, defaultNullTextClassName); 8869 setDefaultStyleDecoration(key, "", getDecorationStyleRuleCssText(ASPx.GetCurrentStyle(input), ["color", "opacity", "text-shadow"])); 8870 } 8871 else 8872 setDefaultStyleDecoration(key, defaultNullTextClassName); 8873 break; 8874 case "I": 8875 setDefaultStyleDecoration(key, defaultInvalidClassName); 8876 break; 8877 case "F": 8878 case "FI": 8879 if(document.hasFocus()) { 8880 ASPx.SetClassName(input, ASPx.BootstrapCssSelectors.FormControl); 8881 if(key == "FI") 8882 ASPx.AddClassNameToElement(ASPx.BootstrapCore.IsBootstrap3 ? inputContainer : input, defaultInvalidClassName); 8883 setDefaultStyleDecoration(key, "", getEditorFocusedStyleRuleCssText(input)); 8884 } 8885 break; 8886 default: 8887 break; 8888 } 8889 } 8890 function setDefaultStyleDecoration(key, cssClass, cssText) { 8891 if(defaultDecorationStyles[key]) { 8892 if(cssClass) 8893 defaultDecorationStyles[key].className = cssClass; 8894 else { 8895 var rule = ASPx.GetStyleSheetRules(defaultDecorationStyles[key].className); 8896 if(rule) 8897 rule.style.cssText = ASPx.CreateImportantCssText(cssText); 8898 } 8899 defaultDecorationStyles[key].isValid = true; 8900 } 8901 else { 8902 if(!cssClass && cssText) 8903 cssClass = ASPx.Str.Trim(ASPx.CreateImportantStyleRule(ASPx.GetCurrentStyleSheet(), cssText)); 8904 defaultDecorationStyles[key] = createDefaultStyleDecoration(cssClass); 8905 } 8906 } 8907 function createDefaultStyleDecoration(cssClass) { 8908 return { className: cssClass, isValid: true }; 8909 } 8910 function getEditorFocusedStyleRuleCssText(inputElement) { 8911 var focusedElement = ASPx.GetFocusedElement(); 8912 inputElement.focus(); 8913 var focusedStyle = ASPx.GetCurrentStyle(inputElement); 8914 var cssText = getDecorationStyleRuleCssText(focusedStyle, [ 8915 "border-top-width", "border-top-style", "border-top-color", 8916 "border-left-width", "border-left-style", "border-left-color", 8917 "border-bottom-width", "border-bottom-style", "border-bottom-color", 8918 "border-right-width", "border-right-style", "border-right-color", 8919 "outline-width", "outline-style", "outline-color", "outline-offset", 8920 "box-shadow", "-webkit-box-shadow" 8921 ]); 8922 inputElement.blur(); 8923 if(focusedElement) 8924 ASPx.SetFocus(focusedElement); 8925 return cssText; 8926 } 8927 function getDecorationStyleRuleCssText(currentStyle, styleProperties) { 8928 var rules = [ ]; 8929 for(var i = 0; i < styleProperties.length; i++) { 8930 var stylePropertyValue = ASPx.Str.Trim(currentStyle.getPropertyValue(styleProperties[i])
8930) + ""; 8931 if(stylePropertyValue) 8932 rules.push(styleProperties[i] + ": " + stylePropertyValue); 8933 } 8934 return rules.join(";"); 8935 } 8936 ASPx.BootstrapEditorStyleDecoration = BootstrapEditorStyleDecoration; 8937 var styleUpdateListeners = []; 8938 BootstrapClientUtils = {}; 8939 BootstrapClientUtils.UpdateDefaultStyles = function() { 8940 ASPx.BootstrapEditorStyleDecoration.UpdateDefaultDecorationStyles(); 8941 ASPx.BootstrapCore.updateTableCellStyleSheetRules(); 8942 ASPx.BootstrapCore.initializeAccentColorRelatedSelectors(); 8943 for(var i = 0; i < styleUpdateListeners.length; i++) 8944 styleUpdateListeners[i].beginStyleUpdate(); 8945 for(var i = 0; i < styleUpdateListeners.length; i++) 8946 styleUpdateListeners[i].updateStyle(); 8947 for(var i = 0; i < styleUpdateListeners.length; i++) 8948 styleUpdateListeners[i].endStyleUpdate(); 8949 }; 8950 BootstrapClientUtils.attachToUpdateDefaultStylesRequest = function(styleUpdateListener) { 8951 styleUpdateListeners.push(styleUpdateListener); 8952 }; 8953 BootstrapClientUtils.detachUpdateDefaultStylesRequestListener = function(styleUpdateListener) { 8954 ASPx.Data.ArrayRemove(styleUpdateListeners, styleUpdateListener); 8955 }; 8956 BootstrapClientUtils.GetChangeButtonEnabledAttributesMethod = function(enabled) { 8957 return enabled 8958 ? function(element, className) { 8959 if(element.tagName == "BUTTON") 8960 ASPx.Attr.RemoveAttribute(element, "disabled"); 8961 else 8962 ASPx.RemoveClassNameFromElement(element, className); 8963 } 8964 : function(element, className) { 8965 if(element.tagName == "BUTTON") 8966 ASPx.Attr.SetAttribute(element, "disabled", "disabled"); 8967 else 8968 ASPx.AddClassNameToElement(element, className); 8969 }; 8970 }; 8971 var BootstrapEditFeedbackRenderHelper = ASPx.CreateClass(null, { 8972 constructor: function(editor) { 8973 this.editor = editor; 8974 }, 8975 getErrorImage: function() { 8976 var editorElement = this.editor.GetMainElement(); 8977 return editorElement && editorElement.querySelector("[data-error-image]"); 8978 }, 8979 getClearButton: function() { 8980 var editorElement = this.editor.GetMainElement(); 8981 return editorElement && editorElement.querySelector(BootstrapEditFeedbackRenderHelper.FeedbackSelector + " > .dxbs-clear-btn"); 8982 }, 8983 getErrorTextElement: function() { 8984 var editorElement = this.editor.GetMainElement(); 8985 return editorElement && editorElement.querySelector(".dxbs-edit-error-text"); 8986 }, 8987 setElementVisible: function(element, value) { 8988 if(element && ASPx.ElementHasCssClass(element, ASPx.BootstrapCssSelectors.Hidden) == value) { 8989 var action = value ? ASPx.RemoveClassNameFromElement : ASPx.AddClassNameToElement; 8990 action(element, ASPx.BootstrapCssSelectors.Hidden); 8991 this.updateInputRightPadding(); 8992 } 8993 }, 8994 setClearButtonVisible: function(value) { 8995 var clearButton = this.getClearButton(); 8996 if(!clearButton) 8997 return; 8998 if(this.editor.clearButtonDisplayMode === 'Always' && ASPx.Attr.GetAttribute(clearButton, "role") == "button") 8999 this.editor.SetAccessibilityAnchorEnabled(clearButton, value); 9000 this.setElementVisible(clearButton, value); 9001 }, 9002 setErrorControlVisible: function(value) { 9003 var errorTextElement = this.getErrorTextElement(); 9004 if(errorTextElement) 9005 this.setElementVisible(errorTextElement, value); 9006 if(this.editor.errorDisplayMode == "i") 9007 this.setErrorImageVisible(value); 9008 }, 9009 setErrorImageVisible: function(value) { 9010 var errorImage = this.getErrorImage(); 9011 if(errorImage) { 9012 if(!this.getErrorTextElement() && !ASPx.BootstrapCore.IsBootstrap3) { 9013 var feedbackControl = this.editor.GetMainElement().querySelector(BootstrapEditFeedbackRenderHelper.FeedbackSelector); 9014 var action = value ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement; 9015 action(feedbackControl || errorImage, ASPx.BootstrapCssSelectors.InvalidFeedback); 9016 } 9017 this.setElementVisible(errorImage, value); 9018 if(!value) { 9019 ASPx.Attr.RemoveAttribute(errorImage, "title"); 9020 ASPx.Attr.RemoveAttribute(errorImage, "data-error-tooltip"); 9021 } 9022 else 9023 this.updateErrorText(); 9024 } 9025 }, 9026 updateErrorText: function() { 9027 var errorText = this.editor.HtmlEncode(this.editor.errorText); 9028 var errorTextElement = this.getErrorTextElement(); 9029 if(errorTextElement) { 9030 var textNode = ASPx.GetNormalizedTextNode(errorTextElement); 9031 if(textNode) { 9032 textNode.nodeValue = errorText; 9033 return; 9034 } 9035 } 9036 var errorImage = this.getErrorImage(); 9037 if(errorImage) { 9038 ASPx.Attr.SetAttribute(errorImage, "title", errorText); 9039 if(ASPx.Browser.TouchUI) { 9040 var x = ASPx.GetAbsolutePositionX(errorImage); 9041 var docWidth = ASPx.Browser.WebKitTouchUI ? window.innerWidth : ASPx.GetDocumentClientWidth(); 9042 var availableWidth = this.editor.isASPxClientCheckEdit ? docWidth - x - errorImage.offsetWidth : x; 9043 if(availableWidth > 0) { 9044 var fontSize = ASPx.GetCurrentStyle(errorImage).fontSize; 9045 ASPx.Attr.SetAttribute(errorImage, "data-error-tooltip", this.formatErrorText(errorText, availableWidth, fontSize)); 9046 } 9047 } 9048 } 9049 }, 9050 formatErrorText: function(errorText, availableWidth, fontSize) { 9051 var errorTextSize = ASPx.GetSizeOfText(errorText, { 9052 fontFamily: '"Helvetica Neue", Helvetica, Arial, sans-serif', 9053 fontSize: 'calc(0.75 * ' + fontSize + ')', 9054 fontWeight: "normal", 9055 letterSpacing: "normal", 9056 lineHeight: "2" 9057 }).width + 1.2 * ASPx.PxToInt(fontSize); 9058 if(errorTextSize > availableWidth) { 9059 var availableCharCount = Math.floor(errorText.length * availableWidth / errorTextSize); 9060 if(availableCharCount) { 9061 var errorTextRows = []; 9062 while(errorText && errorText.length) { 9063 var textRow = errorText.substr(0, availableCharCount); 9064 var spacesAtStart = /(^\s+)\S/.exec(textRow); 9065 if(spacesAtStart) 9066 textRow = errorText.substr(0, availableCharCount + spacesAtStart[1].length); 9067 var spacesAtEnd = /(\s+)\S{1,4}$/.exec(textRow);
9068 if(spacesAtEnd && spacesAtEnd.index) 9069 textRow = errorText.slice(0, spacesAtEnd.index + spacesAtEnd[1].length); 9070 errorTextRows.push(ASPx.Str.TrimStart(textRow)); 9071 errorText = errorText.replace(textRow, ""); 9072 } 9073 errorText = errorTextRows.join("\n"); 9074 } 9075 } 9076 return errorText; 9077 }, 9078 updateInputRightPadding: function() { 9079 if(this.editor.isASPxClientTextEdit) { 9080 var feedbackControl = this.editor.GetMainElement().querySelector(BootstrapEditFeedbackRenderHelper.FeedbackSelector); 9081 if(feedbackControl) { 9082 var feedbackWidth = feedbackControl.offsetWidth; 9083 var formControl = this.editor.GetFormControlElement ? this.editor.GetFormControlElement() : this.editor.GetInputElement(); 9084 formControl.style["padding-right"] = feedbackWidth ? feedbackWidth + "px" : ""; 9085 if(this.editor.UpdateDropDownOnFeedbackChanged) 9086 this.editor.UpdateDropDownOnFeedbackChanged(); 9087 } 9088 } 9089 } 9090 }); 9091 BootstrapEditFeedbackRenderHelper.FeedbackSelector = "." + ASPx.BootstrapCssSelectors.FormControlFeedback; 9092 ASPx.BootstrapEditFeedbackRenderHelper = BootstrapEditFeedbackRenderHelper; 9093 var BootstrapTextEditHelpText = ASPx.CreateClass(null, { 9094 constructor: function(editor, helpText, animationEnabled, isPopupDisplayMode) { 9095 this.editor = editor; 9096 this.isPopupDisplayMode = isPopupDisplayMode; 9097 this.animationEnabled = animationEnabled; 9098 this.createHelpTextElement(helpText); 9099 }, 9100 createHelpTextElement: function(helpText) { 9101 var helpTextElement = document.createElement("SPAN"); 9102 ASPx.SetClassName(helpTextElement, ASPx.BootstrapCssSelectors.HelpBlock); 9103 ASPx.Security.setInnerHtml(helpTextElement, helpText, ASPx.Security.DataType.Trusted); 9104 ASPx.InsertElementAfter(helpTextElement, this.editor.GetHelpTextElementPrevSibling()); 9105 if(this.isPopupDisplayMode) { 9106 var parentNode = helpTextElement.parentNode; 9107 if(parentNode) { 9108 var parentStyle = ASPx.GetCurrentStyle(parentNode); 9109 if(parentStyle.position != "relative") 9110 parentNode.style.position = "relative"; 9111 } 9112 ASPx.AddClassNameToElement(helpTextElement, "dxbs-popup-help-text mark"); 9113 ASPx.SetElementDisplay(helpTextElement, false); 9114 } 9115 else { 9116 ASPx.SetElementDisplay(helpTextElement, this.editor.clientVisible); 9117 if(!ASPx.BootstrapCore.IsBootstrap3) 9118 ASPx.AddClassNameToElement(helpTextElement, "text-muted"); 9119 } 9120 this.helpTextElement = helpTextElement; 9121 }, 9122 show: function() { 9123 if(this.isPopupDisplayMode) 9124 this.showPopup(); 9125 else 9126 ASPx.SetElementDisplay(this.helpTextElement, true); 9127 }, 9128 hide: function() { 9129 if(this.isPopupDisplayMode) 9130 this.hidePopup(); 9131 else 9132 ASPx.SetElementDisplay(this.helpTextElement, false); 9133 }, 9134 showPopup: function() { 9135 ASPx.SetElementDisplay(this.helpTextElement, true); 9136 if(this.animationEnabled) 9137 ASPx.AnimationHelper.fadeIn(this.helpTextElement); 9138 else 9139 ASPx.AnimationHelper.setOpacity(this.helpTextElement, 1); 9140 }, 9141 hidePopup: function() { 9142 var onHidePopupComplete = function() { 9143 ASPx.SetElementDisplay(this.helpTextElement, false); 9144 }.aspxBind(this); 9145 if(this.animationEnabled) 9146 ASPx.AnimationHelper.fadeOut(this.helpTextElement, onHidePopupComplete); 9147 else { 9148 ASPx.AnimationHelper.setOpacity(this.helpTextElement, 0); 9149 onHidePopupComplete(); 9150 } 9151 } 9152 }); 9153 ASPx.BootstrapTextEditHelpText = BootstrapTextEditHelpText; 9154 var BootstrapCheckBoxInternal = ASPx.CreateClass(null, { 9155 constructor: function(mainElement, allowGrayed, allowGrayedByClick, storeValueInInput, inputName) { 9156 this.mainElement = mainElement; 9157 this.allowGrayed = allowGrayed; 9158 this.allowGrayedByClick = allowGrayedByClick; 9159 this.storeValueInInput = storeValueInInput; 9160 if(this.storeValueInInput) 9161 this.stateInput = this.createStateInput(inputName); 9162 this.mainInput = this.findMainInput(); 9163 this.initializeSiblingLabelElement(); 9164 this.initializeIndeterminateState(); 9165 this.CheckedChanged = new ASPxClientEvent(); 9166 this.Focus = new ASPxClientEvent(); 9167 this.LostFocus = new ASPxClientEvent(); 9168 this.attachHtmlEvents(); 9169 this.updateState(); 9170 }, 9171 SetValue: function(value) { 9172 this.setValueCore(value); 9173 }, 9174 GetValue: function() { 9175 return this.getValueCore(); 9176 }, 9177 GetChecked: function() { 9178 return this.getValueCore() === true; 9179 }, 9180 SetChecked: function(checked) { 9181 this.setValueCore(!!checked); 9182 }, 9183 SetEnabled: function(enabled) {
9184 this.setEnabledCore(enabled); 9185 }, 9186 GetEnabled: function() { 9187 return this.getEnabledCore(); 9188 }, 9189 GetReadOnly: function() { 9190 return false; 9191 }, 9192 attachHtmlEvents: function() { 9193 var isMSBrowser = ASPx.Browser.Edge; 9194 ASPx.Evt.AttachEventToElement(this.mainInput, "change", function(evt) { 9195 if(this.allowGrayed && this.allowGrayedByClick && isMSBrowser) { 9196 ASPx.Evt.PreventEvent(evt); 9197 return false; 9198 } 9199 if(!this.correctNextValue()) 9200 this.updateState(); 9201 this.CheckedChanged.FireEvent(this, evt); 9202 }.bind(this)); 9203 ASPx.Evt.AttachEventToElement(this.mainInput, "focus", function(evt) { 9204 this.Focus.FireEvent(this, null); 9205 }.bind(this)); 9206 ASPx.Evt.AttachEventToElement(this.mainInput, "blur", function(evt) { 9207 this.LostFocus.FireEvent(this, null); 9208 }.bind(this)); 9209 ASPx.Evt.AttachEventToElement(this.mainInput, "click", function(evt) { 9210 if (this.GetReadOnly()) { 9211 ASPx.Evt.PreventEvent(evt); 9212 return false; 9213 } 9214 if(this.allowGrayed && isMSBrowser) { 9215 var raiseCheckedChanged = false; 9216 if(this.allowGrayedByClick && this.lastValue) { 9217 this.setValueCore(false); 9218 raiseCheckedChanged = true; 9219 } 9220 else if(this.correctNextValue()) { 9221 this.updateState(); 9222 raiseCheckedChanged = true; 9223 } 9224 if(raiseCheckedChanged) 9225 this.CheckedChanged.FireEvent(this, evt); 9226 } 9227 }.bind(this)); 9228 }, 9229 invokeClick: function() { 9230 if(this.mainInput){ 9231 this.mainInput.focus(); 9232 this.mainInput.click(); 9233 } 9234 }, 9235 correctNextValue: function() { 9236 if(!this.allowGrayed) 9237 return; 9238 if(this.allowGrayedByClick && this.lastValue === false){ 9239 this.setValueCore(null); 9240 return true; 9241 } 9242 if(this.lastValue === null) { 9243 this.setValueCore(true); 9244 return true; 9245 } 9246 }, 9247 findMainInput: function() { 9248 return this.mainElement.querySelectorAll("[type=checkbox]")[0] || this.mainElement.querySelectorAll("[type=radio]")[0]; 9249 }, 9250 createStateInput: function (inputName) { 9251 var input = ASPx.CreateHiddenField(inputName, this.mainElement.id + "_S"); 9252 this.mainElement.appendChild(input); 9253 return input; 9254 }, 9255 initializeIndeterminateState: function() { 9256 if(ASPx.Attr.GetAttribute(this.mainInput, "data-value") === "indeterminate") { 9257 ASPx.Attr.RemoveAttribute(this.mainInput, "data-value"); 9258 this.mainInput.indeterminate = true; 9259 } 9260 }, 9261 initializeSiblingLabelElement: function() { 9262 if(this.mainInput && this.mainInput.id) { 9263 var siblingLabel = this.mainElement.querySelectorAll("[type=checkbox]+label, label+[type=checkbox], [type=radio]+label, label+[type=radio]")[0]; 9264 if(siblingLabel) 9265 ASPx.Attr.SetAttribute(siblingLabel, "for", this.mainInput.id); 9266 } 9267 }, 9268 setValueCore: function(value) { 9269 if(value === true || value === ASPx.CheckBoxInputKey.Checked) { 9270 this.mainInput.checked = true; 9271 this.mainInput.indeterminate = false; 9272 this.updateState(true); 9273 } 9274 else if(value === false || value === ASPx.CheckBoxInputKey.Unchecked) { 9275 this.mainInput.checked = false; 9276 this.mainInput.indeterminate = false; 9277 this.updateState(false); 9278 } 9279 else if(value === null || value === ASPx.CheckBoxInputKey.Indeterminate) { 9280 this.mainInput.indeterminate = true; 9281 this.updateState(null); 9282 } 9283 }, 9284 getValueCore: function() { 9285 var mainInput = this.mainInput; 9286 if(mainInput.indeterminate) 9287 return null; 9288 return mainInput.checked; 9289 }, 9290 setEnabledCore: function(enabled) { 9291 if(enabled) { 9292 ASPx.RemoveClassNameFromElement(this.mainElement, ASPx.BootstrapCssSelectors.Disabled); 9293 ASPx.Attr.RemoveAttribute(this.mainInput, "disabled"); 9294 if(this.stateInput) 9295 ASPx.Attr.RemoveAttribute(this.stateInput, "disabled"); 9296 } 9297 else { 9298 ASPx.AddClassNameToElement(this.mainElement, ASPx.BootstrapCssSelectors.Disabled); 9299 ASPx.Attr.SetAttribute(this.mainInput, "disabled", "disabled"); 9300 if(this.stateInput) 9301 ASPx.Attr.SetAttribute(this.stateInput, "disabled", "disabled"); 9302 } 9303 }, 9304 getEnabledCore: function() { 9305 return !ASPx.Attr.GetAttribute(this.mainInput, "disabled"); 9306 }, 9307 updateState: function(value) { 9308 value = value === undefined ? this.getValueCore() : value; 9309 this.lastValue = value; 9310 var stateInput = this.stateInput; 9311 if(stateInput) { 9312 if(value === true) 9313 stateInput.value = ASPx.CheckBoxInputKey.Checked; 9314 else if(value === false) 9315 stateInput.value = ASPx.CheckBoxInputKey.Unchecked; 9316 else 9317 stateInput.value = ASPx.CheckBoxInputKey.Indeterminate; 9318 } 9319 } 9320 }); 9321 var BootstrapCheckBoxInternalCollection = ASPx.CreateClass(ASPx.CollectionBase, {
9322 constructor: function(allowGrayed, allowGrayedByClick, storeValueInInput) { 9323 this.constructor.prototype.constructor.call(this); 9324 this.allowGrayed = !!allowGrayed; 9325 this.allowGrayedByClick = !!allowGrayedByClick; 9326 this.storeValueInInput = !!storeValueInInput; 9327 }, 9328 Add: function(key, mainElement) { 9329 this.Remove(key); 9330 var checkBox = this.createInternalCheckBox(key, mainElement); 9331 ASPx.CollectionBase.prototype.Add.call(this, key, checkBox); 9332 return checkBox; 9333 }, 9334 createInternalCheckBox: function(key, mainElement) { 9335 return new BootstrapCheckBoxInternal(mainElement, this.allowGrayed, this.allowGrayedByClick, this.storeValueInInput); 9336 } 9337 }); 9338 ASPx.BootstrapCheckBoxInternal = BootstrapCheckBoxInternal; 9339 ASPx.BootstrapCheckBoxInternalCollection = BootstrapCheckBoxInternalCollection; 9340 var BootstrapLoadingPanelManager = {}; 9341 var loadingPanels = {}; 9342 var loadingDivs = {}; 9343 BootstrapLoadingPanelManager.getLoadingPanel = function(name, settings, inline) { 9344 if(!settings) return null; 9345 var lpID = name + "_LP"; 9346 if(!loadingPanels[lpID]){ 9347 var lp = document.createElement("DIV"); 9348 lp.id = lpID; 9349 ASPx.SetClassName(lp, ASPx.Str.Trim([ 9350 "dxbs-lp" + (inline ? " dxbs-lp-inline" : ""), 9351 ASPx.HiddenChangable, ASPx.BootstrapCssSelectors.Panel, ASPx.BootstrapCssSelectors.PanelDefault 9352 ].join(" "))); 9353 var lpBody = document.createElement("DIV"); 9354 ASPx.SetClassName(lpBody, ASPx.BootstrapCssSelectors.PanelBody); 9355 if(settings.showImage !== false) { 9356 var lpImg = document.createElement("SPAN"); 9357 var imgCssClass = settings.imageCssClass ? settings.imageCssClass : "dxbs-icon dxbs-icon-refresh"; 9358 ASPx.SetClassName(lpImg, "image " + imgCssClass); 9359 lpBody.appendChild(lpImg); 9360 } 9361 if(settings.text !== "") { 9362 var breakHtml = ""; 9363 var textHtml = "<span>" + (settings.text || "Loading…") + "</span>"; 9364 if(settings.imagePosition && (settings.imagePosition === "Top" || settings.imagePosition === "Bottom")) 9365 breakHtml = "<br />"; 9366 if(settings.imagePosition && (settings.imagePosition === "Right" || settings.imagePosition === "Bottom")) 9367 ASPx.Security.setInnerHtml(lpBody, textHtml + breakHtml + lpBody.innerHTML, ASPx.Security.DataType.Trusted); 9368 else 9369 ASPx.Security.setInnerHtml(lpBody, lpBody.innerHTML + breakHtml + textHtml, ASPx.Security.DataType.Trusted); 9370 } 9371 lp.appendChild(lpBody); 9372 loadingPanels[lpID] = lp; 9373 } 9374 return loadingPanels[lpID]; 9375 }; 9376 BootstrapLoadingPanelManager.getLoadingDiv = function(name, settings){ 9377 if(!settings || settings.fade === false) return null; 9378 var ldID = name + "_LD"; 9379 if(!loadingDivs[ldID]){ 9380 var ld = document.createElement("DIV"); 9381 ld.id = ldID; 9382 ASPx.SetClassName(ld, "dxbs-ld " + ASPx.HiddenChangable); 9383 loadingDivs[ldID] = ld; 9384 } 9385 return loadingDivs[ldID]; 9386 }; 9387 ASPx.BootstrapLoadingPanelManager = BootstrapLoadingPanelManager; 9388 var BootstrapOverlayManager = {}; 9389 BootstrapOverlayManager.createOverlay = function(name, settings) { 9390 var overlay = document.createElement("DIV"); 9391 overlay.id = name + "_OV"; 9392 ASPx.SetClassName(overlay, ASPx.BootstrapCssSelectors.ModalBackdrop + " dxbs-modal-back" + (settings.cssClass ? " " + settings.cssClass : "")); 9393 return overlay; 9394 }; 9395 ASPx.BootstrapOverlayManager = BootstrapOverlayManager; 9396 var BootstrapBadgeManager = ASPx.CreateClass(ASPx.BadgeManagerBase, { 9397 getBadgeClassName: function() { 9398 return ASPx.BootstrapCssSelectors.Badge; 9399 }, 9400 getBadgeIconDefaultClassName: function() { 9401 return "image"; 9402 }, 9403 createBadgeForButton: function(button, toLeftSide) { 9404 var badge = this.createBadge(); 9405 if(!ASPx.BootstrapCore.IsBootstrap3) { 9406 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgePill); 9407 if (ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonDanger)) { 9408 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgeLight); 9409 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.TextDanger); 9410 } 9411 else if(ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonSecondary) || ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonOutlineSecondary)) 9412 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgeDark); 9413 else if(ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonLink)) 9414 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgePrimary); 9415 else 9416 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.TextPrimary); 9417 } 9418 if(toLeftSide) 9419 button.insertBefore(badge, button.childNodes[0]); 9420 else 9421 button.appendChild(badge); 9422 return badge; 9423 }, 9424 updateToolbarItemBadge: function(item, count) { 9425 var button = item.menu.IsEnabledAdaptivity() ? item.itemViewModel.getElement() : item.menu.GetItemContentElement(item.indexPath); 9426 var badge = this.findBadge(button); 9427 if(!badge) 9428 badge = this.createBadgeForButton(button); 9429 if(badge) 9430 this.setBadgeText(badge, count > 0 ? count : ""); 9431 } 9432 }); 9433 ASPx.BootstrapBadgeManager = new BootstrapBadgeManager(); 9434 var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
9434+/="; 9435 var getBase64Char = function(index) { 9436 return BASE64_CHARS.charAt(index); 9437 }; 9438 var getIndexOfBase64Char = function(char) { 9439 return BASE64_CHARS.indexOf(char); 9440 }; 9441 var codeArrayToString = function(codes) { 9442 return codes.map(function(code) { return String.fromCharCode(code); }).join(""); 9443 }; 9444 var base64_encode = function(input) { 9445 var result = ""; 9446 if (!$.isArray(input)) 9447 input = stringToByteArray(String(input)); 9448 for (var i = 0; i < input.length; i += 3) { 9449 var octet1 = input[i], 9450 octet2 = input[i + 1], 9451 octet3 = input[i + 2]; 9452 result += $.map([octet1 >> 2, (3 & octet1) << 4 | octet2 >> 4, isNaN(octet2) ? 64 : (15 & octet2) << 2 | octet3 >> 6, isNaN(octet3) ? 64 : 63 & octet3], getBase64Char).join(""); 9453 } 9454 return result; 9455 }; 9456 var base64_decode = function(input) { 9457 var result = ""; 9458 input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); 9459 for (var i = 0; i < input.length; i += 4) { 9460 var bytes = []; 9461 var octet1 = getIndexOfBase64Char(input.charAt(i)), 9462 octet2 = getIndexOfBase64Char(input.charAt(i + 1)), 9463 octet3 = getIndexOfBase64Char(input.charAt(i + 2)), 9464 octet4 = getIndexOfBase64Char(input.charAt(i + 3)); 9465 bytes.push((octet1 << 2) | (octet2 >> 4)); 9466 if(octet3 != 64) 9467 bytes.push(((octet2 & 15) << 4) | (octet3 >> 2)); 9468 if(octet4 != 64) 9469 bytes.push(((octet3 & 3) << 6) | octet4); 9470 result += codeArrayToString(bytes); 9471 } 9472 return decodeText(result); 9473 }; 9474 var stringToByteArray = function(str) { 9475 var bytes = []; 9476 var code = 0; 9477 for (var i = 0; i < str.length; i++) { 9478 code = str.charCodeAt(i); 9479 if (code < 128) { 9480 bytes.push(code); 9481 } else { 9482 if (code < 2048) { 9483 bytes.push(192 + (code >> 6), 128 + (63 & code)); 9484 } else { 9485 if (code < 65536) { 9486 bytes.push(224 + (code >> 12), 128 + (code >> 6 & 63), 128 + (63 & code)); 9487 } else { 9488 if (code < 2097152) { 9489 bytes.push(240 + (code >> 18), 128 + (code >> 12 & 63), 128 + (code >> 6 & 63), 128 + (63 & code)); 9490 } 9491 } 9492 } 9493 } 9494 } 9495 return bytes; 9496 }; 9497 var decodeText = function(codeText) { 9498 var bytes = []; 9499 var code = 0, 9500 code2 = 0, 9501 code3 = 0; 9502 for (var i = 0; i < codeText.length; i++) { 9503 code = codeText.charCodeAt(i); 9504 if (code < 128) { 9505 bytes.push(code); 9506 } else { 9507 i += 1; 9508 code2 = codeText.charCodeAt(i); 9509 if((code > 191) && (code < 224)) { 9510 bytes.push(((code & 31) << 6) | (code2 & 63)); 9511 } else { 9512 i += 1; 9513 code3 = codeText.charCodeAt(i); 9514 bytes.push(((code & 15) << 12) | ((code2 & 63) << 6) | (code3 & 63));
9515 } 9516 } 9517 } 9518 return codeArrayToString(bytes); 9519 }; 9520 ASPx.Base64 = {}; 9521 ASPx.Base64.Encode = base64_encode; 9522 ASPx.Base64.Decode = base64_decode; 9523 dx.BootstrapClientUtils = BootstrapClientUtils; 9524 ASPx.BootstrapDockManager = ASPx.CreateSingleton(function(ASPx) { 9525 var showCssClass = "show", 9526 matrixRegex = "\\s*matrix\\(\\s*" + ([0, 0, 0, 0, 0, 0].map(function() { return "(\\-?\\d+\\.?\\d*)"; }).join(",\\s*")) + "\\)\\s*"; 9527 function parseTranslateInfo(styles) { 9528 var m = new RegExp(matrixRegex).exec(styles.transform); 9529 return m ? { left: parseInt(m[5]), top: parseInt(m[6]) } : { left: 0, top: 0 }; 9530 } 9531 function getBoundingBox(x, y, w, h) { return { left: x, top: y, right: x + w, bottom: y + h, width: w, height: h }; } 9532 function getSafeBoundingBox(element, roundLT, roundRB) { 9533 var box = element.getBoundingClientRect(); 9534 var safeBox = { left: roundLT(box.left), top: roundLT(box.top), right: roundRB(box.right), bottom: roundRB(box.bottom) }; 9535 safeBox.width = safeBox.right - safeBox.left; 9536 safeBox.height = safeBox.bottom - safeBox.top; 9537 return safeBox; 9538 } 9539 function getOuterBoundingBox(element) { 9540 return getSafeBoundingBox(element, Math.floor, Math.ceil); 9541 } 9542 function getInnerBoundingBox(element) { 9543 return getSafeBoundingBox(element, Math.ceil, Math.floor); 9544 } 9545 var DockPoint = ASPx.CreateClass(null, { 9546 constructor: function (key, info) { 9547 this.key = key; 9548 this.info = info; 9549 }, 9550 checkMargin: function () { return true; }, 9551 allowScroll: function () { return this.info.size === "height"; }, 9552 canApplyToElement: function(element) { return ASPx.GetClassName(element).indexOf("dxbs-align-" + this.key) > -1; }, 9553 getRange: function (dockInfo) { 9554 var c1 = this.getTargetBox(dockInfo)[this.info.to]; 9555 var c2 = c1 + this.info.sizeM * (dockInfo.elementBox[this.info.size] + (this.checkMargin() ? dockInfo.margin : 0)); 9556 return { 9557 from: Math.min(c1, c2), 9558 to: Math.max(c1, c2), 9559 windowOverflow: 0 9560 }; 9561 }, 9562 getTargetBox: function (dockInfo) { return null; }, 9563 validate: function (range, windowInfo) { 9564 var windowSize = windowInfo[this.info.size]; 9565 range.windowOverflow = Math.abs(Math.min(0, range.from - windowSize.from) + Math.min(0, windowSize.to - range.to)); 9566 range.validTo = Math.min(range.to, windowSize.to); 9567 range.validFrom = Math.max(range.from, windowSize.from); 9568 return range.windowOverflow === 0; 9569 }, 9570 applyRange: function (range, dockInfo) { 9571 dockInfo.appliedModifierKeys[this.info.size] = this.key; 9572 var side = this.info.size === "width" ? "left" : "top"; 9573 var style = dockInfo.styles; 9574 var from = range.from; 9575 if (this.allowScroll() && range.windowOverflow > 0) { 9576 if (!dockInfo.limitBox.scroll.width) { 9577 dockInfo.limitBox.scroll.width = true; 9578 dockInfo.limitBox.width.to -= ASPx.GetVerticalScrollBarWidth(); 9579 } 9580 if (dockInfo.isScrollable) { 9581 style["max-height"] = dockInfo.height - range.windowOverflow + "px"; 9582 dockInfo.width += ASPx.GetVerticalScrollBarWidth(); 9583 dockInfo.elementBox.width += ASPx.GetVerticalScrollBarWidth(); 9584 from = range.validFrom; 9585 } 9586 } 9587 style.width = dockInfo.width + "px"; 9588 if(this.checkMargin()) 9589 from += Math.max(0, this.info.sizeM) * dockInfo.margin; 9590 dockInfo.elementBox[side] += from; 9591 style["transform"] = 9592 "matrix(1, 0, 0, 1, " + dockInfo.elementBox.left + ", " + dockInfo.elementBox.top + ")"; 9593 }, 9594 dockElementToTarget: function (dockInfo) { 9595 var range1 = this.getRange(dockInfo); 9596 if (!this.dockElementToTargetInternal(range1, dockInfo)) 9597 this.applyRange(range1, dockInfo); 9598 }, 9599 dockElementToTargetInternal: function (range1, dockInfo) { } 9600 }); 9601 var OuterDockPoint = ASPx.CreateClass(DockPoint, { 9602 constructor: function (name, info, oppositePointName) { 9603 this.constructor.prototype.constructor.apply(this, arguments); 9604 this.oppositePointName = oppositePointName || null; 9605 }, 9606 getTargetBox: function (dockInfo) { return dockInfo.targetBox.outer; }, 9607 getOppositePoint: function () { 9608 return this._oppositePoint || (this._oppositePoint = dockPoints.filter(function (d) { 9609 return d.key === this.oppositePointName; 9610 }.bind(this))[0]); 9611 }, 9612 dockElementToTargetInternal: function (range1, dockInfo) { 9613 if (this.validate(range1, dockInfo.limitBox)) 9614 this.applyRange(range1, dockInfo); 9615 else { 9616 var oppositePoint = this.getOppositePoint(); 9617 var range2 = oppositePoint.getRange(dockInfo); 9618 if (oppositePoint.validate(range2, dockInfo.limitBox) || range2.windowOverflow < range1.windowOverflow) 9619 oppositePoint.applyRange(range2, dockInfo); 9620 else 9621 return false; 9622 } 9623 return true; 9624 } 9625 }); 9626 var InnerDockPoint = ASPx.CreateClass(DockPoint, { 9627 checkMargin: function () { return false; }, 9628 getTargetBox: function (dockInfo) { return dockInfo.targetBox.inner; }, 9629 dockElementToTargetInternal: function (range1, dockInfo) { 9630 this.validate(range1, dockInfo.limitBox); 9631 return false; 9632 },
9633 validate: function (range, windowInfo) { 9634 var toOverflow = Math.min(range.from, Math.max(0, range.to - windowInfo[this.info.size].to)); 9635 if (toOverflow > 0) { 9636 range.from -= toOverflow; 9637 range.to -= toOverflow; 9638 } 9639 return DockPoint.prototype.validate.call(this, range, windowInfo); 9640 } 9641 }); 9642 var dockPoints = [ 9643 new OuterDockPoint("above", { to: "top", from: "bottom", size: "height", sizeM: -1 }, "below"), 9644 new OuterDockPoint("below", { to: "bottom", from: "top", size: "height", sizeM: 1 }, "above"), 9645 new InnerDockPoint("top-sides", { to: "top", from: "top", size: "height", sizeM: 1 }), 9646 new InnerDockPoint("bottom-sides", { to: "bottom", from: "bottom", size: "height", sizeM: -1 }), 9647 new OuterDockPoint("outside-left", { to: "left", from: "right", size: "width", sizeM: -1 }, "outside-right"), 9648 new OuterDockPoint("outside-right", { to: "right", from: "left", size: "width", sizeM: 1 }, "outside-left"), 9649 new InnerDockPoint("left-sides", { to: "left", from: "left", size: "width", sizeM: 1 }), 9650 new InnerDockPoint("right-sides", { to: "right", from: "right", size: "width", sizeM: -1 }) 9651 ]; 9652 var defaultHorizontalItemDockPoints = [dockPoints[1], dockPoints[6]], 9653 defaultVerticalItemDockPoints = [dockPoints[2], dockPoints[5]]; 9654 function getElementPopupInfo(element, targetElement, isVertical, settings) { 9655 var elementStyle = ASPx.GetCurrentStyle(element); 9656 var box = getOuterBoundingBox(element); 9657 var docEl = element.ownerDocument.documentElement; 9658 var result = { 9659 isScrollable: ASPx.ElementHasCssClass(element, "dxbs-scrollable"), 9660 specifiedOffsetModifiers: dockPoints.filter(function (m) { return m.canApplyToElement(element); }), 9661 margin: ASPx.PxToInt(elementStyle.marginTop), 9662 width: settings ? Math.max(settings.width, Math.ceil(element.offsetWidth)) : Math.ceil(element.offsetWidth), 9663 height: Math.ceil(element.offsetHeight), 9664 appliedModifierKeys: { height: null, width: null } 9665 }; 9666 var styles = parseTranslateInfo(elementStyle); 9667 result.elementBox = getBoundingBox(styles.left - box.left, styles.top - box.top, box.width, box.height); 9668 result.targetBox = { outer: getOuterBoundingBox(targetElement), inner: getInnerBoundingBox(targetElement) }; 9669 result.limitBox = { 9670 scroll: { width: docEl.clientWidth < window.innerWidth, height: docEl.clientHeight < window.innerHeight }, 9671 width: { from: 0, to: docEl.clientWidth }, 9672 height: { from: 0, to: docEl.clientHeight } 9673 }; 9674 result.styles = {}; 9675 var highPriorityModifiersData = ASPx.Attr.GetAttribute(element, "data-popup-align") || settings && settings.align; 9676 if (highPriorityModifiersData) { 9677 var highPriorityModifiers = highPriorityModifiersData.split(/\s+/); 9678 result.offsetModifiers = dockPoints.filter(function (m) { 9679 return highPriorityModifiers.some(function (k) { return m.key === k; }); 9680 }); 9681 } else 9682 result.offsetModifiers = result.specifiedOffsetModifiers.filter(function (m) { return !isVertical; }); 9683 if (result.offsetModifiers.length === 0) 9684 result.offsetModifiers = isVertical ? defaultVerticalItemDockPoints : defaultHorizontalItemDockPoints; 9685 return result; 9686 } 9687 function hide(element) { 9688 if (ASPx.ElementHasCssClass(element, showCssClass)) { 9689 if (element.isDockedElementHidden) 9690 delete element.isDockedElementHidden; 9691 ASPx.DOM.ClearStyles(element); 9692 ASPx.DOM.ToggleCssClass(element, showCssClass, false); 9693 } else if (element.isDockedElementHidden) 9694 delete element.isDockedElementHidden; 9695 } 9696 function show(element, targetElement, isVertical) { 9697 ASPx.DOM.ClearStyles(element); 9698 ASPx.DOM.ToggleCssClass(element, showCssClass, true); 9699 preparePosition(element, targetElement, isVertical, null, function () { });
9700 } 9701 function preparePosition(element, targetElement, isVertical, settings, onShow) { 9702 ASPx.DOM.CalculateStyles(function () { 9703 var dockInfo = getElementPopupInfo(element, targetElement, isVertical, settings); 9704 for (var i = 0; i < dockInfo.offsetModifiers.length; i++) 9705 dockInfo.offsetModifiers[i].dockElementToTarget(dockInfo); 9706 ASPx.DOM.ChangeDOM(function () { onShow(dockInfo); }); 9707 ASPx.DOM.SetStyles(element, dockInfo.styles); 9708 }.bind(this)); 9709 } 9710 return { 9711 getElementPopupInfo: getElementPopupInfo, 9712 hide: hide, 9713 show: show, 9714 preparePosition: preparePosition 9715 }; 9716 }); 9717 ASPx.DOM = ASPx.CreateSingleton(function (ASPx) { 9718 var FrameContext = ASPx.CreateClass(null, { 9719 constructor: function (requestFrame) { 9720 this.requestFrame = requestFrame; 9721 this.cache = [[]]; 9722 this.isInFrame = false; 9723 this.isWaiting = false; 9724 }, 9725 getBuffer: function (order) { 9726 if (!order) order = 0; 9727 if (this.cache.length <= order) this.cache[order] = []; 9728 return this.cache[order]; 9729 }, 9730 execute: function (callback, order) { 9731 if (!this.isInFrame) 9732 return false; 9733 var buffer = this.cache[order || 0]; 9734 if (buffer === null) 9735 callback(requestFrameId); 9736 else 9737 (buffer = this.getBuffer(order)).push(callback); 9738 return true; 9739 }, 9740 runAll: function () { 9741 this.isWaiting = false; 9742 this.isInFrame = true; 9743 for (var i = 0; i < this.cache.length; i++) { 9744 var buffer = this.cache[i]; 9745 if (buffer) { 9746 this.cache[i] = null; 9747 while (buffer.length) 9748 buffer.shift()(requestFrameId); 9749 } 9750 } 9751 this.waitNextFrame(); 9752 }, 9753 waitNextFrame: function () { 9754 this.cache = [[]]; 9755 this.isInFrame = false; 9756 this.isWaiting = false; 9757 }, 9758 requestExecution: function (callback, order) { 9759 if (!this.execute(callback, order)) { 9760 this.getBuffer(order).push(callback); 9761 if (this.isWaiting === false) { 9762 this.isWaiting = true; 9763 this.requestFrame(this.runAll.bind(this)); 9764 } 9765 } 9766 } 9767 }); 9768 var requestFrameId = null; 9769 function requestAnimationFrame(callback) { return requestFrameId = ASPx.RequestAnimationFrame(callback); } 9770 function createAccumulator(requestFrame) { 9771 var context = new FrameContext(requestFrame); 9772 return context.requestExecution.bind(context); 9773 } 9774 var changeDom = createAccumulator(requestAnimationFrame); 9775 var calculateStyles = createAccumulator(function (callback) { changeDom(function () { setTimeout(callback); }); }); 9776 var observers = [], minimumIntervalBetweenChecks = 50; 9777 function itemObserver(element, callback, width) { 9778 return function () { 9779 if (element.compareDocumentPosition(document.body) & Node.DOCUMENT_POSITION_DISCONNECTED) 9780 return false; 9781 var currentStyle = ASPx.GetCurrentStyle(element); 9782 if (currentStyle.width === "auto") 9783 return true; 9784 var w = ASPx.PxToInt(currentStyle.width) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element); 9785 if (width !== w) 9786 callback(width = w); 9787 return true; 9788 }; 9789 } 9790 function subscribeElementContentWidth(el, callback) { 9791 if (observers.length === 0) { 9792 observers.push(itemObserver(el, callback, -1)); 9793 calculateStyles(updateTrackedElements); 9794 } else 9795 observers.push(itemObserver(el, callback, -1)); 9796 } 9797 function elementSizeObserver(element, callback, size) { 9798 return function() { 9799 if(element.compareDocumentPosition(document.body) & Node.DOCUMENT_POSITION_DISCONNECTED) 9800 return false; 9801 var currentStyle = ASPx.GetCurrentStyle(element); 9802 if(currentStyle.width === "auto") 9803 return true; 9804 var elementWidth = ASPx.PxToInt(currentStyle.width) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element); 9805 var elementHeight = ASPx.PxToInt(currentStyle.height) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element); 9806 if(size.width !== elementWidth || size.height !== elementHeight) { 9807 size.width = elementWidth; 9808 size.height = elementHeight; 9809 callback(size); 9810 } 9811 return true; 9812 }; 9813 } 9814 function subscribeElementContentSize(element, callback) { 9815 if(observers.length === 0) { 9816 observers.push(elementSizeObserver(element, callback, { width: -1, height: -1 })); 9817 calculateStyles(updateTrackedElements); 9818 } else 9819 observers.push(elementSizeObserver(element, callback, { width: -1, height: -1 })); 9820 } 9821 function updateTrackedElements() { 9822 observers = observers.filter(function (observer) { return observer(); }); 9823 if (observers.length > 0) { 9824 setTimeout(function () {
9825 calculateStyles(updateTrackedElements); 9826 }, minimumIntervalBetweenChecks); 9827 } 9828 } 9829 function applyStyles(element, styles) { 9830 var stylesArr = []; 9831 for (var property in styles) { 9832 if (styles.hasOwnProperty(property)) 9833 stylesArr.push({ attr: property, value: styles[property] }); 9834 } 9835 if (stylesArr.length === 1) { 9836 element.style[stylesArr[0].attr] = stylesArr[0].value; 9837 } else { 9838 var cssText = ""; 9839 if (element.style.cssText) { 9840 var oldStylesArr = element.style.cssText.split(';').map(function (nvp) { return nvp.trim().split(':'); }); 9841 for (var i = 0; i < oldStylesArr.length; i++) { 9842 var oldStyleArr = oldStylesArr[i]; 9843 if (oldStyleArr.length === 2 && styles[oldStyleArr[0]] === undefined) 9844 cssText += oldStyleArr[0] + ":" + oldStyleArr[1].trim() + ";"; 9845 } 9846 } 9847 for (var i = 0; i < stylesArr.length; i++) { 9848 var style = stylesArr[i]; 9849 if (style.value !== "") 9850 cssText += style.attr + ":" + style.value + ";"; 9851 } 9852 ASPx.Attr.SetOrRemoveAttribute(element, "style", cssText); 9853 } 9854 } 9855 function applyStateToElement(element, state) { 9856 if (state.inlineStyles === null) 9857 ASPx.Attr.RemoveAttribute(element, "style"); 9858 else 9859 applyStyles(element, state.inlineStyles); 9860 for (var attrName in state.attributes) { 9861 if (state.attributes.hasOwnProperty(attrName)) 9862 ASPx.Attr.SetOrRemoveAttribute(element, attrName, state.attributes[attrName]); 9863 }
9864 var allCssClasses = ASPx.GetClassNameList(state); 9865 if (allCssClasses) { 9866 var toggleInfo = state.cssClassToggleInfo; 9867 var cssClasses = allCssClasses.filter(function (c) { return toggleInfo[c] !== false; }); 9868 for (var c in toggleInfo) { 9869 if (toggleInfo.hasOwnProperty(c) && toggleInfo[c] && cssClasses.indexOf(c) === -1) 9870 cssClasses.push(c); 9871 } 9872 var cssClass = cssClasses.join(" "); 9873 if (cssClass) 9874 ASPx.SetClassName(element, cssClass); 9875 else 9876 ASPx.Attr.RemoveAttribute(element, "class"); 9877 } 9878 } 9879 function createElementState(element) { 9880 return { inlineStyles: {}, cssClassToggleInfo: {}, className: ASPx.GetClassName(element), attributes: {} }; 9881 } 9882 function updateElementState(elementOrCollection, callback) { 9883 if (elementOrCollection.length !== undefined) { 9884 for (var i = 0; i < elementOrCollection.length; i++) 9885 updateElementState(elementOrCollection[i], callback); 9886 return; 9887 } 9888 var element = elementOrCollection; 9889 if (!element._dxCurrentFrameElementStateInfo) { 9890 callback(element._dxCurrentFrameElementStateInfo = createElementState(element)); 9891 changeDom(function () { 9892 applyStateToElement(element, element._dxCurrentFrameElementStateInfo); 9893 element._dxCurrentFrameElementStateInfo = null; 9894 }, 1); 9895 } else 9896 callback(element._dxCurrentFrameElementStateInfo); 9897 } 9898 function setStyles(el, styles) { 9899 updateElementState(el, function (state) { 9900 if (state.inlineStyles === null) 9901 state.inlineStyles = styles; 9902 else { 9903 for (var i in styles) { 9904 if (styles.hasOwnProperty(i)) 9905 state.inlineStyles[i] = styles[i]; 9906 } 9907 } 9908 }); 9909 } 9910 function clearStyles(el) { 9911 updateElementState(el, function (state) { 9912 state.inlineStyles = null; 9913 }); 9914 } 9915 function toggleCssClass(el, cssClass, condition) { 9916 updateElementState(el, function (state) { 9917 state.cssClassToggleInfo[cssClass] = condition; 9918 }); 9919 } 9920 function setCssClassName(el, className) { 9921 updateElementState(el, function (state) { 9922 state.cssClassToggleInfo = {}; 9923 state.className = className; 9924 }); 9925 } 9926 function updateAttribute(el, attrName, attrValue) { 9927 updateElementState(el, function (state) { 9928 state.attributes[attrName] = attrValue; 9929 }); 9930 } 9931 function nextChangeDOM(callback) { 9932 changeDom(callback, 2); 9933 } 9934 return { 9935 ChangeDOM: changeDom, 9936 NextChangeDOM: nextChangeDOM, 9937 CalculateStyles: calculateStyles, 9938 SubscribeElementContentWidth: subscribeElementContentWidth, 9939 SubscribeElementContentSize: subscribeElementContentSize, 9940 SetStyles: setStyles, 9941 ClearStyles: clearStyles, 9942 ToggleCssClass: toggleCssClass, 9943 SetCssClassName: setCssClassName, 9944 UpdateAttribute: updateAttribute 9945 }; 9946 }); 9947 ASPx.DefaultDisplayNoneSelectors = ASPx.DefaultDisplayNoneSelectors.concat([ 9948 ASPx.BootstrapCssSelectors.Modal, 9949 ASPx.BootstrapCssSelectors.DropDownMenu, 9950 "dxbs-dropdown-area", 9951 ASPx.BootstrapCssSelectors.HiddenLayout 9952 ]); 9953 ASPx.DefaultDisplaySelectors = ASPx.DefaultDisplaySelectors.concat([ 9954 "dxbs-modal" 9955 ]); 9956 ASPx.ProcessStyleSheetRules(".dropdown-item", function(name, style, rule) { 9957 if(name.indexOf(":hover") > -1 && style.backgroundColor) { 9958 var cssText = "background-color: " + style.backgroundColor + ";"; 9959 if(style.color) 9960 cssText += "color: " + style.color + "; "; 9961 ASPx.AddStyleSheetRule(rule.parentStyleSheet, ".dxbs-item-hover", cssText); 9962 return true; 9963 } 9964 }); 9965})(dx || (dx = {})); 9966 9967(function(dx) { 9968 var BootstrapClientTextBox = ASPx.CreateClass(ASPxClientTextBox, { 9969 constructor: function(name) { 9970 this.constructor.prototype.constructor.call(this, name); 9971 this.feedbackRenderHelper = new ASPx.BootstrapEditFeedbackRenderHelper(this); 9972 }, 9973 InlineInitialize: function() { 9974 this.RequireStyleDecoration(); 9975 ASPxClientTextBox.prototype.InlineInitialize.call(this); 9976 this.feedbackRenderHelper.updateInputRightPadding(); 9977 if(ASPx.Browser.TouchUI && !this.GetIsValid()) 9978 this.UpdateErrorText(); 9979 }, 9980 InitializeEvents: function() { 9981 ASPxClientTextBox.prototype.InitializeEvents.call(this); 9982 var inputElement = this.GetInputElement(); 9983 if(inputElement) 9984 ASPx.Evt.AttachEventToElement(inputElement, "change", function() { ASPx.EValueChanged(this.name); }.bind(this)); 9985 if(ASPx.Browser.MacOSMobilePlatform) { 9986 var errorImage = this.GetErrorImage(); 9987 if(errorImage) 9988 ASPx.Evt.AttachEventToElement(errorImage, "touchstart", function() { });
9989 } 9990 }, 9991 RaiseStandardOnChange: function() { 9992 var element = this.GetInputElement(); 9993 if(element) 9994 ASPx.Evt.DispatchEvent(element, "change", true, false); 9995 else 9996 ASPxClientTextBox.prototype.RaiseStandardOnChange.call(this); 9997 }, 9998 ChangeEnabledStateItems: function(enabled) { }, 9999 GetControlCell: function() { 10000 return this.GetInputContainerElement(); 10001 }, 10002 EnsureControlCellStylesLoaded: function() { }, 10003 ClearControlCellStyles: function() { }, 10004 RestoreControlCellStyles: function() { }, 10005 GetElementRequiredForErrorFrame: function() { 10006 return this.GetInputContainerElement(); 10007 }, 10008 GetErrorImage: function() { 10009 return this.feedbackRenderHelper.getErrorImage(); 10010 }, 10011 UpdateErrorText: function() { 10012 this.feedbackRenderHelper.updateErrorText(); 10013 }, 10014 ChangeErrorCellVisibility: function(visible, useVisibilityAttribute) { 10015 this.feedbackRenderHelper.setErrorControlVisible(visible); 10016 }, 10017 PopulateStyleDecorationPostfixes: function() { 10018 this.styleDecoration.AddPostfix(""); 10019 this.styleDecoration.AddPostfix("div > .form-control"); 10020 }, 10021 CreateStyleDecoration: function() { 10022 return new ASPx.BootstrapEditorStyleDecoration(this); 10023 }, 10024 GetInputContainerElement: function() { 10025 var inputElement = this.GetInputElement(); 10026 return inputElement ? inputElement.parentNode : null; 10027 }, 10028 GetCaptionCell: function() { 10029 return ASPx.CacheHelper.GetCachedElement(this, "captionElement", 10030 function() { 10031 var mainElement = this.GetMainElement(); 10032 return mainElement && mainElement.querySelector(".dxbs-edit-caption"); 10033 } 10034 ); 10035 }, 10036 getCaptionTextNode: function() { 10037 return ASPx.GetNormalizedTextNode(this.GetCaptionCell()); 10038 }, 10039 getCaptionRelatedCellCount: function() { 10040 return undefined; 10041 }, 10042 helpTextInitialize: function() { 10043 if(this.helpText) 10044 this.helpTextObj = new ASPx.BootstrapTextEditHelpText(this, this.helpText, this.enableHelpTextPopupAnimation, this.hasPopupHelpText()); 10045 }, 10046 GetHelpTextElementPrevSibling: function() { 10047 return this.feedbackRenderHelper.getErrorTextElement() || this.GetInputContainerElement(); 10048 }, 10049 getFocusedNullTextElementClassName: function() { 10050 return "dxbs-null-text text-muted" + (this.cssClasses.nt ? " " + this.cssClasses.nt : ""); 10051 } 10052 }); 10053 dx.BootstrapClientTextBox = BootstrapClientTextBox; 10054 var BootstrapClientMemo = ASPx.CreateClass(ASPxClientMemo, { 10055 constructor: function(name) { 10056 this.constructor.prototype.constructor.call(this, name); 10057 this.feedbackRenderHelper = new ASPx.BootstrapEditFeedbackRenderHelper(this); 10058 }, 10059 InlineInitialize: function() { 10060 this.RequireStyleDecoration(); 10061 ASPxClientMemo.prototype.InlineInitialize.call(this); 10062 this.feedbackRenderHelper.updateInputRightPadding(); 10063 if(ASPx.Browser.TouchUI && !this.GetIsValid()) 10064 this.UpdateErrorText(); 10065 }, 10066 InitializeEvents: function() { 10067 ASPxClientMemo.prototype.InitializeEvents.call(this); 10068 var inputElement = this.GetInputElement(); 10069 if(inputElement) { 10070 if(this.maxLengthRestricted) { 10071 ASPx.Evt.AttachEventToElement(inputElement, "mouseout", function(evt) { ASPx.MMMouseOut(this.name, evt); }.bind(this)); 10072 ASPx.Evt.AttachEventToElement(inputElement, "mouseover", function(evt) { ASPx.MMMouseOver(this.name, evt); }.bind(this)); 10073 } 10074 ASPx.Evt.AttachEventToElement(inputElement, "change", function () { ASPx.EValueChanged(this.name); }.bind(this)); 10075 } 10076 if(ASPx.Browser.MacOSMobilePlatform) { 10077 var errorImage = this.GetErrorImage(); 10078 if(errorImage) 10079 ASPx.Evt.AttachEventToElement(errorImage, "touchstart", function() { }); 10080 } 10081 }, 10082 RaiseStandardOnChange: function() { 10083 var element = this.GetInputElement(); 10084 if(element) 10085 ASPx.Evt.DispatchEvent(element, "change", true, false); 10086 else 10087 ASPxClientMemo.prototype.RaiseStandardOnChange.call(this); 10088 }, 10089 ChangeEnabledStateItems: function (enabled) { }, 10090 IsAdjustmentRequired: function() { 10091 return false; 10092 }, 10093 AdjustControl: function() { }, 10094 GetControlCell: function() { 10095 return this.GetInputContainerElement(); 10096 }, 10097 EnsureControlCellStylesLoaded: function() { }, 10098 ClearControlCellStyles: function() { }, 10099 RestoreControlCellStyles: function() { }, 10100 GetElementRequiredForErrorFrame: function() { 10101 return this.GetInputContainerElement(); 10102 }, 10103 GetErrorImage: function() { 10104 return this.feedbackRenderHelper.getErrorImage(); 10105 }, 10106 UpdateErrorText: function() { 10107 this.feedbackRenderHelper.updateErrorText(); 10108 }, 10109 ChangeErrorCellVisibility: function(visible, useVisibilityAttribute) { 10110 this.feedbackRenderHelper.setErrorControlVisible(visible); 10111 }, 10112 PopulateStyleDecorationPostfixes: function() { 10113 this.styleDecoration.AddPostfix(""); 10114 this.styleDecoration.AddPostfix("div > .form-control"); 10115 }, 10116 CreateStyleDecoration: function() { 10117 return new ASPx.BootstrapEditorStyleDecoration(this); 10118 }, 10119 GetInputContainerElement: function() { 10120 var inputElement = this.GetInputElement(); 10121 return inputElement ? inputElement.parentNode : null; 10122 }, 10123 GetCaptionCell: function() { 10124 return ASPx.CacheHelper.GetCachedElement(this, "captionElement", 10125 function() { 10126 var mainElement = this.GetMainElement(); 10127 return mainElement && mainElement.querySelector(".dxbs-edit-caption"); 10128 } 10129 ); 10130 }, 10131 getCaptionTextNode: function() { 10132 return ASPx.GetNormalizedTextNode(this.GetCaptionCell()); 10133 }, 10134 getCaptionRelatedCellCount: function() { 10135 return undefined; 10136 }, 10137 helpTextInitialize: function() { 10138 if(this.helpText) 10139 this.helpTextObj = new ASPx.BootstrapTextEditHelpText(this, this.helpText, this.enableHelpTextPopupAnimation, this.hasPopupHelpText()); 10140 }, 10141 GetHelpTextElementPrevSibling: function() { 10142 return this.feedbackRenderHelper.getErrorTextElement() || this.GetInputContainerElement(); 10143 }, 10144 getFocusedNullTextElementClassName: function() {
10145 return "dxbs-null-text text-muted" + (this.cssClasses.nt ? " " + this.cssClasses.nt : ""); 10146 } 10147 }); 10148 dx.BootstrapClientMemo = BootstrapClientMemo; 10149 var BootstrapClientButtonEdit = ASPx.CreateClass(ASPxClientButtonEdit, { 10150 constructor: function(name) { 10151 this.constructor.prototype.constructor.call(this, name); 10152 this.feedbackRenderHelper = new ASPx.BootstrapEditFeedbackRenderHelper(this); 10153 }, 10154 InlineInitialize: function() { 10155 this.RequireStyleDecoration(); 10156 ASPxClientButtonEdit.prototype.InlineInitialize.call(this); 10157 this.feedbackRenderHelper.updateInputRightPadding(); 10158 if(ASPx.Browser.TouchUI && !this.GetIsValid()) 10159 this.UpdateErrorText(); 10160 }, 10161 InitializeEvents: function() { 10162 ASPxClientButtonEdit.prototype.InitializeEvents.call(this); 10163 var inputElement = this.GetInputElement(); 10164 if(inputElement) 10165 ASPx.Evt.AttachEventToElement(inputElement, "change", function() { ASPx.EValueChanged(this.name); }.bind(this)); 10166 var buttonElements = this.GetCustomButtonCollection(); 10167 for(var i = 0; i < buttonElements.length; i++) 10168 this.InitializeButtonEvents(buttonElements[i], i); 10169 var clearButton = this.GetClearButton(); 10170 if(clearButton) { 10171 ASPx.Evt.AttachEventToElement(clearButton, "mousedown", function(evt) { ASPx.BEClear(this.name, evt); }.bind(this)); 10172 if(this.IsAccessibleButton(clearButton)) 10173 this.InitAccessibilityAnchorEvents(clearButton); 10174 } 10175 if(ASPx.Browser.MacOSMobilePlatform) { 10176 var errorImage = this.GetErrorImage(); 10177 if(errorImage) 10178 ASPx.Evt.AttachEventToElement(errorImage, "touchstart", function() { }); 10179 } 10180 }, 10181 InitializeButtonEvents: function(element, number){ 10182 ASPx.Evt.AttachEventToElement(element, "click", function() { 10183 this.OnButtonClick(number); 10184 }.bind(this)); 10185 if(this.IsAccessibleButton(element)) 10186 this.InitAccessibilityAnchorEvents(element); 10187 }, 10188 SetButtonVisible: function(number, value) { 10189 if(number == -100) { 10190 this.feedbackRenderHelper.setClearButtonVisible(value); 10191 return; 10192 } 10193 if(ASPx.BootstrapCore.IsBootstrap3 || ASPx.BootstrapCore.IsBootstrap4) { 10194 var inputGroupButton = ASPxClientButtonEdit.prototype.GetButton.call(this, number); 10195 if(inputGroupButton) 10196 ASPx.SetElementDisplay(inputGroupButton.parentNode, value); 10197 } 10198 ASPxClientButtonEdit.prototype.SetButtonVisible.call(this, number, value); 10199 }, 10200 ChangeEnabledAttributes: function(enabled) { 10201 ASPxClientButtonEdit.prototype.ChangeEnabledAttributes.call(this, enabled); 10202 var clearButton = this.GetClearButton(); 10203 if(clearButton) 10204 this.ChangeButtonEnabledAttributes(clearButton, this.GetChangeButtonEnabledAttributesMethod(enabled)); 10205 }, 10206 GetChangeButtonEnabledAttributesMethod: function(enabled) { 10207 return dx.BootstrapClientUtils.GetChangeButtonEnabledAttributesMethod(enabled); 10208 }, 10209 ChangeButtonEnabledAttributes: function(element, method) { 10210 if(ASPx.Attr.IsExistsAttribute(element, "disabledOnServer")) 10211 return; 10212 method(element, ASPx.BootstrapCssSelectors.Disabled); 10213 }, 10214 NeedEnsureClearButtonVisibilityOnKeyDown: function() { 10215 return this.IsAccessibleButton(this.GetClearButton()); 10216 }, 10217 GetAccessibilityFocusedButtonClassName: function() { 10218 return ""; 10219 }, 10220 IsAccessibleButton: function(button) { 10221 return !!button && (button.tagName.toUpperCase() == "BUTTON" || ASPx.Attr.GetAttribute(button, "role") == "button"); 10222 }, 10223 GetButtonByAccessibilityAnchor: function(anchorElement) { 10224 return anchorElement; 10225 }, 10226 GetAccessibilityAnchor: function(buttonElement) { 10227 return buttonElement; 10228 }, 10229 SetAccessibilityAnchorEnabled: function(buttonElement, enabled) { 10230 if(buttonElement.tagName.toUpperCase() == "BUTTON") 10231 return; 10232 ASPxClientButtonEdit.prototype.SetAccessibilityAnchorEnabled.call(this, buttonElement, enabled); 10233 }, 10234 EmulateButtonMouseEvent: function(sourceElement) { 10235 ASPx.Evt.EmulateMouseClick(sourceElement); 10236 }, 10237 RaiseStandardOnChange: function() { 10238 var element = this.GetInputElement(); 10239 if(element) 10240 ASPx.Evt.DispatchEvent(element, "change", true, false); 10241 else 10242 ASPxClientButtonEdit.prototype.RaiseStandardOnChange.call(this); 10243 }, 10244 ChangeEnabledStateItems: function(enabled) { }, 10245 GetControlCell: function() { 10246 return this.GetInputContainerElement(); 10247 }, 10248 EnsureControlCellStylesLoaded: function() { }, 10249 ClearControlCellStyles: function() { }, 10250 RestoreControlCellStyles: function() { }, 10251 GetElementRequiredForErrorFrame: function() { 10252 return this.GetInputContainerElement(); 10253 }, 10254 GetErrorImage: function() { 10255 return this.feedbackRenderHelper.getErrorImage(); 10256 }, 10257 UpdateErrorText: function() { 10258 this.feedbackRenderHelper.updateErrorText(); 10259 }, 10260 ChangeErrorCellVisibility: function(visible, useVisibilityAttribute) { 10261 this.feedbackRenderHelper.setErrorControlVisible(visible); 10262 }, 10263 PopulateStyleDecorationPostfixes: function() { 10264 var inputContainerSelector = this.GetInputContainerSelector(); 10265 this.styleDecoration.AddPostfix(""); 10266 this.styleDecoration.AddPostfix(inputContainerSelector); 10267 this.styleDecoration.AddPostfix(inputContainerSelector + " .form-control"); 10268 }, 10269 GetInputContainerSelector: function() { 10270 var selector = ""; 10271 if(!!this.GetInputGroupElement()) 10272 selector = ".input-group"; 10273 else { 10274 var invalidSelectors = ASPx.Data.GetDistinctArray(["." + ASPx.BootstrapCssSelectors.InputGroupAppendButton, 10275 "." + ASPx.BootstrapCssSelectors.InputGroupPrependButton]); 10276 selector = "div"; 10277 for(var i = 0; i < invalidSelectors.length; i++) 10278 selector += ":not(" + invalidSelectors[i] + ")"; 10279 } 10280 return selector; 10281 }, 10282 CreateStyleDecoration: function() { 10283 return new ASPx.BootstrapEditorStyleDecoration(this); 10284 }, 10285 GetHideContentCssClassName: function() { 10286 return ASPx.BootstrapCssSelectors.Hidden; 10287 }, 10288 GetHoverElementToShowClearButton: function() { 10289 return this.GetInputGroupElement() || this.GetInputContainerElement(); 10290 }, 10291 GetInputGroupElement: function() { 10292 var mainElement = this.GetMainElement(); 10293 return mainElement && mainElement.querySelector(".input-group"); 10294 }, 10295 GetInputContainerElement: function() { 10296 var inputElement = this.GetInputElement(); 10297 return inputElement ? inputElement.parentNode : null; 10298 }, 10299 GetCaptionCell: function() { 10300 return ASPx.CacheHelper.GetCachedElement(this, "captionElement", 10301 function() { 10302 var mainElement = this.GetMainElement(); 10303 return mainElement && mainElement.querySelector(".dxbs-edit-caption"); 10304 } 10305 ); 10306 }, 10307 getCaptionTextNode: function () { 10308 return ASPx.GetNormalizedTextNode(this.GetCaptionCell()); 10309 }, 10310 getCaptionRelatedCellCount: function () { 10311 return undefined; 10312 }, 10313 GetClearButton: function() { 10314 return this.feedbackRenderHelper.getClearButton(); 10315 }, 10316 GetButton: function (number) { 10317 var inputGroupButton = ASPxClientButtonEdit.prototype.GetButton.call(this, number); 10318 return number == -100 ? this.GetClearButton() : 10319 inputGroupButton && (inputGroupButton.querySelector(".dxbs-edit-btn") || inputGroupButton.querySelector(".btn") || inputGroupButton); 10320 }, 10321 helpTextInitialize: function() { 10322 if(this.helpText) 10323 this.helpTextObj = new ASPx.BootstrapTextEditHelpText(this, this.helpText, this.enableHelpTextPopupAnimation, this.hasPopupHelpText()); 10324 }, 10325 GetHelpTextElementPrevSibling: function() { 10326 var errorTextElement = this.feedbackRenderHelper.getErrorTextElement(); 10327 return errorTextElement || this.GetInputGroupElement() || this.GetInputContainerElement(); 10328 }, 10329 getFocusedNullTextElementClassName: function() {
10330 return "dxbs-null-text text-muted" + (this.cssClasses.nt ? " " + this.cssClasses.nt : ""); 10331 } 10332 }); 10333 dx.BootstrapClientButtonEdit = BootstrapClientButtonEdit; 10334})(dx || (dx = {})); 10335(function() { 10336var serializingSeparator = "|"; 10337var serializingSeparatorLength = serializingSeparator.length; 10338var lbIPostfixes = ['C', 'I', 'T']; 10339var lbIIdSuffix = "LBI"; 10340var lbSIIdSuffix = lbIIdSuffix + "-1"; 10341var lbAIRIdSuffix = "AIR"; 10342var lbAIRTIdSuffix = lbAIRIdSuffix + "-1"; 10343var lbTSIdSuffix = "_TS"; 10344var lbBSIdSuffix = "_BS"; 10345var lbHeaderDivIdSuffix = "_H"; 10346var lTableIdSuffix = "_LBT"; 10347var leVISuffix = "_VI"; 10348var lbDSuffix = "_D"; 10349var emptyItemsRange = "0:-1"; 10350var nbsp = " "; 10351var nameSeparator = "_"; 10352var nbspChar = String.fromCharCode(160); 10353var NullSizeCellClassName = "dxlbNullSizeCell"; 10354var itemCellTextAttributeName = "data-item-cell-text"; 10355var itemSerializedTextsAttributeName = "data-item-serialized-texts"; 10356var FIRST_CELL_MARKER_CSS_CLASS_NAME = "dxeFTM"; 10357var LAST_CELL_MARKER_CSS_CLASS_NAME = "dxeLTM"; 10358var selectAllMainElementID = "LBSAME"; 10359var selectAllCheckBoxID = "LBSACB"; 10360var filterMainElementID = "LBF"; 10361var filteringTextBoxID = "LBFE"; 10362var showFilterButtonID = "LBSFEB"; 10363var inactiveFilterElementClassName = "dxeLBInactiveFilterPanelSys"; 10364var listTableCollapsedClassName = "dxeLBTCollapsed"; 10365var ListBoxSelectionMode = { Single : 0, Multiple : 1, CheckColumn : 2 }; 10366var ListBoxVirtualScrollTableContainerIDPostfix = "LBVSTC"; 10367var CONSTANTS = { 10368 CALLBACK_PREFIXES: { 10369 CUSTOM: "LECC", 10370 CUSTOMPERFORM: "LECCP", 10371 LOAD_RANGE_ITEMS: "LBCRI", 10372 FILTERING: "CBLF", 10373 FILTERING_CORRECT: "CBCF" 10374 }, 10375 CALLBACK_RESULTS: { 10376 ITEMS: "i", 10377 FILTER_CUSTOMHIGHLIGHTING: "fCH", 10378 FILTER_LENGTH: "fL" 10379 } 10380}; 10381var ListBoxStateControllerManagerBase = ASPx.CreateClass(null, { 10382 constructor: function(listBox) { 10383 this.listBox = listBox; 10384 }, 10385 Initialize: function() { 10386 this.AddStateItems(false, false); 10387 }, 10388 AddStateItems: function(clearCache, hoverItemOnly) { 10389 if(typeof (ASPx.GetStateController) !== "undefined") { 10390 var itemCellsIdSuffixes = this.listBox.GetItemCellsIdPostfixes(); 10391 this.AddStateItemsCore(ASPx.GetStateController(), clearCache, itemCellsIdSuffixes, hoverItemOnly); 10392 } 10393 }, 10394 AddStateItemsCore: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) { 10395 if(this.HasSampleItemStateItems()) 10396 this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly,-1); 10397 }, 10398 AddItemStateItems: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, index) { 10399 var name = this.listBox.name + "_" + lbIIdSuffix + index; 10400 if(clearCache) 10401 this.listBox.ClearStateItemCache(controller, name, itemCellsIdSuffixes); 10402 if(this.NeedAddHoverStateToItem()) 10403 controller.AddHoverItem(name, this.listBox.hoverClasses, this.listBox.hoverCssArray, itemCellsIdSuffixes, null, null, true); 10404 if(!hoverItemOnly) { 10405 this.AddFunctionalStates(controller, name, itemCellsIdSuffixes); 10406 } 10407 }, 10408 NeedAddHoverStateToItem: function() { 10409 return !ASPx.Browser.WebKitTouchUI; 10410 }, 10411 AddFunctionalStates: function(controller, name, itemCellsIdSuffixes) { 10412 controller.AddSelectedItem(name, this.listBox.selectedClasses, this.listBox.selectedCssArray, itemCellsIdSuffixes, null, null, true); 10413 controller.AddDisabledItem(name, this.listBox.disabledClasses, this.listBox.disabledCssArray, itemCellsIdSuffixes, null, null, true); 10414 }, 10415 RemoveHoverStateItem: function() { 10416 if(typeof (ASPx.GetStateController) !== "undefined") { 10417 var itemCellsIdSuffixes = this.listBox.GetItemCellsIdPostfixes(); 10418 this.RemoveHoverStateItemCore(ASPx.GetStateController(), itemCellsIdSuffixes); 10419 } 10420 }, 10421 RemoveHoverStateItemCore: function(controller, itemCellsIdSuffixes) { 10422 if(this.HasSampleItemStateItems()) 10423 this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, -1); 10424 }, 10425 RemoveItemStateHoverItem: function(controller, itemCellsIdSuffixes, index) { 10426 var name = this.listBox.name + "_" + lbIIdSuffix + index; 10427 this.listBox.ClearStateItemCache(controller, name, itemCellsIdSuffixes); 10428 if(!ASPx.Browser.WebKitTouchUI)
10429 controller.RemoveHoverItem(name, itemCellsIdSuffixes); 10430 }, 10431 HasSampleItemStateItems: function() { 10432 return this.listBox.hasSampleItem; 10433 }, 10434}); 10435var VirtualRenderListBoxStateControllerManager = ASPx.CreateClass(ListBoxStateControllerManagerBase, { 10436 constructor: function(listBox, virtualRenderItemsManager) { 10437 this.constructor.prototype.constructor.call(this, listBox); 10438 this.virtualRenderItemsManager = virtualRenderItemsManager; 10439 }, 10440 AddStateItemsCore: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) { 10441 ListBoxStateControllerManagerBase.prototype.AddStateItemsCore.call(this, controller, clearCache, itemCellsIdSuffixes, hoverItemOnly); 10442 var range = this.virtualRenderItemsManager.GetRenderedItemRange(); 10443 for(var i = range.startIndex;i <= range.endIndex;i++) { 10444 if(i >= 0) 10445 this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, i); 10446 } 10447 }, 10448 RemoveHoverStateItemCore: function(controller, itemCellsIdSuffixes) { 10449 ListBoxStateControllerManagerBase.prototype.RemoveHoverStateItemCore.call(this, controller, itemCellsIdSuffixes); 10450 var range = this.virtualRenderItemsManager.GetRenderedItemRange(); 10451 for(var i = range.startIndex; i <= range.endIndex; i++) { 10452 if(i >= 0) 10453 this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, i); 10454 } 10455 }, 10456}); 10457var DefaultListBoxStateControllerManager = ASPx.CreateClass(ListBoxStateControllerManagerBase, { 10458 constructor: function(listBox) { 10459 this.constructor.prototype.constructor.call(this, listBox); 10460 }, 10461 AddStateItemsCore: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) { 10462 ListBoxStateControllerManagerBase.prototype.AddStateItemsCore.call(this, controller, clearCache, itemCellsIdSuffixes, hoverItemOnly); 10463 var count = this.listBox.GetItemCount(); 10464 for(var i = 0;i < count;i++) 10465 this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, i); 10466 }, 10467 RemoveHoverStateItemCore: function(controller, itemCellsIdSuffixes) { 10468 ListBoxStateControllerManagerBase.prototype.RemoveHoverStateItemCore.call(this, controller, itemCellsIdSuffixes); 10469 var count = this.listBox.GetItemCount(); 10470 for(var i = 0; i < count; i++) 10471 this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, i); 10472 }, 10473}); 10474var ListBoxItemsManagerBase = ASPx.CreateClass(null, { 10475 constructor: function(listBox) { 10476 this.listBox = listBox; 10477 this.listTable = listBox.GetListTable(); 10478 }, 10479 Initialize: function() { 10480 }, 10481 GetListTableRows: function() { 10482 return this.listTable ? this.listTable.rows : []; 10483 }, 10484 GetItemHtmlContent: function(index) { return null; }, 10485 GetItem: function () { return null; }, 10486 GetItemIndexByRow: function (itemRow) { return null; }, 10487 GetItemCount: function () { return 0; }, 10488 GetItemRow: function (index) { 10489 if (this.listTable && index >= 0) { 10490 var rowIndex = this.ConvertItemIndexToRowIndex(index); 10491 var itemRow = this.listTable.rows[rowIndex]; 10492 if (itemRow && ASPx.ElementContainsCssClass(itemRow, "dxeListBoxItemRow")) 10493 return itemRow; 10494 } 10495 return null; 10496 }, 10497 GetItemElement: function (index) { 10498 var result = null; 10499 var itemRow = this.GetItemRow(index); 10500 if (itemRow) 10501 result = this.GetFirstVisibleCell(itemRow) || itemRow.cells[0]; 10502 return result; 10503 }, 10504 GetFirstVisibleCell: function (itemRow) { 10505 for (var i = 0; i < itemRow.cells.length; i++) 10506 if (ASPx.GetElementDisplay(itemRow.cells[i])) 10507 return itemRow.cells[i]; 10508 return null; 10509 }, 10510 GetItemHeight: function(index) { 10511 throw new Error("this method is abstract"); 10512 }, 10513 GetTotalItemsHeight: function(firstItemIndex, lastItemIndex) { 10514 throw new Error("this method is abstract"); 10515 }, 10516 GetItemsHeight: function() { return 0; }, 10517 GetItemsWidth: function() { return 0; }, 10518 GetVisibleItemCount: function () { return 0; }, 10519 GetTopSpacersHeight: function() { 10520 return this.listBox.GetTopScrollSpacerHeight(); 10521 }, 10522 GetItemTopOffset: function(index) { 10523 return this.GetItemTopOffsetCore(index); 10524 }, 10525 GetItemTopOffsetCore: function(index) { 10526 var itemElement = this.GetItemElement(index); 10527 return itemElement ? itemElement.offsetTop + this.GetTopSpacersHeight() : 0; 10528 }, 10529 IsItemVisible: function(index) { 10530 return this.IsItemEdgeVisible(index, true, true); 10531 }, 10532 IsItemEdgeVisible: function(index, checkTop, checkBottom) { 10533 var result = false; 10534 var itemElement = this.GetItemElement(index); 10535 if(itemElement != null) { 10536 var scrollDiv = this.listBox.GetScrollDivElement(); 10537 var topScrollDivEdge = scrollDiv.scrollTop; 10538 var bottomScrollDivEdge = scrollDiv.scrollTop + scrollDiv.clientHeight; 10539 var topItemElementEdge = this.GetItemTopOffset(index); 10540 var bottomItemElementEdge = topItemElementEdge + itemElement.getBoundingClientRect().height; 10541 var checkTopVisibleResult = !checkTop || this.IsVisibleOffset(topItemElementEdge, topScrollDivEdge, bottomScrollDivEdge); 10542 var checkBottomVisibleResult = !checkBottom || this.IsVisibleOffset(bottomItemElementEdge, topScrollDivEdge, bottomScrollDivEdge); 10543 result = checkTopVisibleResult && checkBottomVisibleResult; 10544 } 10545 return result; 10546 }, 10547 IsVisibleOffset: function(offset, topScrollDivEdge, bottomScrollDivEdge) { 10548 return offset >= topScrollDivEdge && offset <= bottomScrollDivEdge; 10549 }, 10550 GetFirstVisibleItem: function () { return null; }, 10551 GetFirstVisibleItemRow: function() { 10552 var firstVisibleItemIndex = this.GetFirstVisibleItem(); 10553 return this.listTable.rows[this.ConvertItemIndexToRowIndex(firstVisibleItemIndex)]; 10554 }, 10555 GetFirstRenderedItem: function () { }, 10556 GetLastRenderedItem: function () { }, 10557 InitializeInternalCheckBoxCollection: function () { }, 10558 GetScrollDivChildElementHeight: function () { return null; }, 10559 RemoveItem: function(index) { this.RemoveItemCore(index); }, 10560 RemoveItemCore: function(index) { 10561 this.listBox.RemoveItemRow(index); 10562 }, 10563 InsertItem: function () { }, 10564 CreateNewItemRow: function (index) { 10565 var newItemRow = this.listBox.GetSampleItemRow(); 10566 if (ASPx.IsExistsElement(newItemRow)) 10567 newItemRow = newItemRow.cloneNode(true); 10568 return newItemRow; 10569 }, 10570 ClearItems: function () { 10571 this.ClearItemsCore(); 10572 }, 10573 ClearItemsCore: function() { 10574 var tBody = this.listBox.GetListTableRowParent(); 10575 tBody.innerHTML = ""; 10576 }, 10577 IsItemFiltered: function (index) { return false; }, 10578 ConvertItemIndexToRowIndex: function () { return null; }, 10579 Adjust: function () { }, 10580 BeforeClientFiltering: function () { }, 10581 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) { }, 10582 RestorePrevFilteredState: function (index) { }, 10583 OnEndItemsFiltering: function () { }, 10584 ChangeItemsFilteredState: function(action) { 10585 var count = this.GetItemCount(); 10586 for (var i = 0; i < count; i++) { 10587 action(i);
10588 this.AfterChangeItemFilteredStateAction(i); 10589 } 10590 }, 10591 AfterChangeItemFilteredStateAction: function() { }, 10592 MakeAllItemsVisible: function () { 10593 this.ChangeItemsFilteredState(function (index) { 10594 this.ApplyFilterToItem(index, true, false, true); 10595 }.aspxBind(this)); 10596 }, 10597 MakeItemVisibleAtTop: function(index) { 10598 var scrollDiv = this.listBox.GetScrollDivElement(); 10599 scrollDiv.scrollTop = this.GetItemTopOffset(index); 10600 }, 10601 MakeItemVisible: function(index) { 10602 if(!this.IsItemVisible(index)) { 10603 var scrollDiv = this.listBox.GetScrollDivElement(); 10604 var scrollTop = scrollDiv.scrollTop; 10605 var scrollDivHeight = scrollDiv.clientHeight; 10606 var itemOffsetTop = this.GetItemTopOffset(index); 10607 var itemHeight = this.GetItemHeight(index); 10608 var itemAbove = scrollTop > itemOffsetTop; 10609 var itemBelow = scrollTop + scrollDivHeight < itemOffsetTop + itemHeight; 10610 if(itemAbove) { 10611 this.MakeItemVisibleAtTop(index); 10612 } 10613 else if(itemBelow) { 10614 var scrollDivChildElementHeight = this.listBox.GetScrollDivChildElementHeight(); 10615 var scrollPaddings = scrollDiv.scrollHeight - scrollDivChildElementHeight; 10616 scrollDiv.scrollTop = itemOffsetTop + itemHeight - scrollDivHeight + scrollPaddings; 10617 } 10618 } 10619 }, 10620 RewriteFilteredItemIndices: function(newFilteredItemIndices) { }, 10621 OnScrollSpacerVisibilityChanged: function () { }, 10622 SetItemHtml: function (index, html) { }, 10623 SetItemTooltip: function(index, tooltip) { }, 10624 SetItemAttribute: function(index, attrName, attrValue) { }, 10625 AddItemCssClass: function (index, className) { }, 10626 RemoveItemCssClass: function (index, className) { }, 10627 SetItemTextCellHtml: function (itemIndex, textCellIndex, html) { }, 10628 SetItemTextCellTooltip: function(itemIndex, textCellIndex, tooltip) { }, 10629 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attrName, attrValue) { }, 10630 AddItemTextCellCssClass: function (itemIndex, textCellIndex, className) { }, 10631 RemoveItemTextCellCssClass: function (itemIndex, textCellIndex, className) { }, 10632 OnDecoratedItemsRendering: function () { }, 10633 DeactivateScrollHandler: function() { }, 10634 ActivateScrollHandler: function() { }, 10635 IsScrollActivated: function() { return true; }, 10636 CorrectItemsHeight: function() {}, 10637 BeginUpdate: function() { }, 10638 EndUpdate: function() { } 10639}); 10640var ListBoxItemsDefaultManager = ASPx.CreateClass(ListBoxItemsManagerBase, { 10641 constructor: function (listBox) { 10642 this.constructor.prototype.constructor.call(this, listBox); 10643 }, 10644 GetItemIndexByRow: function (itemRow) { 10645 var result = itemRow.rowIndex; 10646 if (this.listBox.ContainsFixWidthRow()) 10647 result--; 10648 return result; 10649 }, 10650 GetItemCount: function () { 10651 if (this.listTable) { 10652 var rowLength = this.listTable.rows.length; 10653 if (!!this.listBox.GetAccessibilityHeaderRow()) 10654 rowLength--; 10655 if (this.listBox.ContainsFixWidthRow()) 10656 rowLength--; 10657 return rowLength; 10658 } 10659 return 0; 10660 }, 10661 GetItem: function (index) { 10662 var rowLength = this.GetItemCount(); 10663 if (!this.listTable || index < 0 || index >= rowLength) 10664 return null; 10665 var row = this.listBox.GetItemRow(index); 10666 var image = this.listBox.imageCellExists ? ASPx.GetNodeByTagName(row.cells[this.listBox.GetImageCellIndex()], "IMG", 0) : null; 10667 var src = image == null ? "" : ASPx.ImageUtils.GetImageSrc(image); 10668 var itemValue = this.listBox.itemsValue[index] !== undefined ? this.listBox.itemsValue[index] : null; 10669 return new ASPxClientListBoxItem(this.listBox, index, this.listBox.GetItemRowTexts(row), itemValue, src, this.listBox.GetIsItemSelected(index)); 10670 }, 10671 GetVisibleItemCount: function () { 10672 var count = this.GetItemCount(); 10673 var visibleItemCount = 0; 10674 for (var i = 0; i < count; i++) { 10675 if (ASPx.GetElementDisplay(this.GetItemRow(i))) 10676 visibleItemCount++; 10677 } 10678 return visibleItemCount; 10679 }, 10680 GetFirstVisibleItem: function () { 10681 var itemCount = this.GetItemCount(); 10682 for (var i = 0; i < itemCount; i++) 10683 if (this.GetItemRow(i) && this.IsItemFiltered(i)) 10684 return i; 10685 return -1; 10686 }, 10687 GetFirstFilteredItemIndex: function () { 10688 return this.GetFirstVisibleItem(); 10689 }, 10690 GetLastFilteredItemIndex: function() { 10691 var itemCount = this.GetItemCount(); 10692 for(var i = itemCount - 1; i >= 0; i--) 10693 if(this.GetItemRow(i) && this.IsItemFiltered(i)) 10694 return i; 10695 return -1; 10696 }, 10697 GetNextFilteredItemIndex: function(currentIndex) { 10698 var itemCount = this.GetItemCount(); 10699 for(var i = currentIndex + 1; i < itemCount; i++) 10700 if(this.GetItemRow(i) && this.IsItemFiltered(i)) 10701 return i; 10702 return -1; 10703 }, 10704 GetPrevFilteredItemIndex: function(currentIndex) { 10705 for(var i = currentIndex - 1; i >= 0; i--) 10706 if(this.GetItemRow(i) && this.IsItemFiltered(i)) 10707 return i; 10708 return -1; 10709 }, 10710 GetFirstRenderedItem: function () { 10711 return this.GetItemCount() > 0 ? this.GetItem(0) : null; 10712 }, 10713 GetLastRenderedItem: function () { 10714 return this.GetItemCount() > 0 ? this.GetItem(this.GetItemCount() - 1) : null; 10715 }, 10716 ConvertItemIndexToRowIndex: function (itemIndex) { 10717 return this.listBox.ContainsFixWidthRow() ? itemIndex + 1 : itemIndex; 10718 }, 10719 GetScrollDivChildElementHeight: function () { 10720 return this.listBox.GetListTableHeight() + this.listBox.GetTopScrollSpacerHeight() + this.listBox.GetBottomScrollSpacerHeight(); 10721 }, 10722 IsItemFiltered: function (index) { 10723 return ASPx.GetElementDisplay(this.GetItemRow(index)); 10724 }, 10725 InsertItem: function (index, itemProperties) { 10726 this.listBox.InsertItemRow(index, itemProperties); 10727 }, 10728 InitializeInternalCheckBoxCollection: function () { 10729 var count = this.GetItemCount(); 10730 var enabled = this.listBox.GetEnabled(); 10731 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled); 10732 for (var i = 0; i < count; i++) 10733 this.listBox.AddInternalCheckBoxToCollectionCore(i, enabled, changeEventMethod); 10734 }, 10735 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) { 10736 var itemRow = this.GetItemRow(index); 10737 if (savePrevState) { 10738 var newDisplayValue = isSatisfy ? "" : "none"; 10739 ASPx.Attr.ChangeStyleAttribute(itemRow, "display", newDisplayValue); 10740 } 10741 else 10742 ASPx.SetElementDisplay(itemRow, isSatisfy); 10743 }, 10744 RestorePrevFilteredState: function (index) { 10745 ASPx.Attr.RestoreStyleAttribute(this.GetItemRow(index), "display"); 10746 }, 10747 GetItemsHeight: function () { 10748 return this.listBox.GetListTableHeight(); 10749 }, 10750 GetTotalItemsHeight: function(firstItemIndex, lastItemIndex) { 10751 var result = 0; 10752 var rows = Array.prototype.slice.call(this.listBox.GetItemElements()); 10753 var visibleRowsIndexes = []; 10754 rows.forEach(function(row, index) { 10755 if(ASPx.GetElementDisplay(row)) 10756 visibleRowsIndexes.push(index); 10757 }); 10758 if(firstItemIndex > visibleRowsIndexes.length) 10759 lastItemIndex = visibleRowsIndexes.length - 1; 10760 if(lastItemIndex > visibleRowsIndexes.length) 10761 lastItemIndex = visibleRowsIndexes.length - 1; 10762 for(var i = firstItemIndex;i <= lastItemIndex;i++) 10763 result += this.GetItemHeight(visibleRowsIndexes[i]); 10764 return result; 10765 }, 10766 GetItemHeight: function(index) { 10767 if((isNaN(index))) throw new Error("index must be a number"); 10768 var itemElement = this.GetItemElement(index); 10769 return itemElement != null ? itemElement.getBoundingClientRect().height : 0; 10770 }, 10771 GetItemsWidth: function() { 10772 return this.listTable.offsetWidth; 10773 }, 10774 GetNewItemIndexInFilteredRange: function(selectedIndex, step) { 10775 var rows = Array.prototype.slice.call(this.listTable.rows); 10776 var filteredRows = rows.filter(function(row) { 10777 return ASPx.GetElementDisplay(row);
10778 }); 10779 var selectedRow = this.GetItemRow(selectedIndex); 10780 var itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(filteredRows, selectedRow); 10781 var newItemIndexInFilteredRange = itemIndexInFilteredRange + step; 10782 if(newItemIndexInFilteredRange >= filteredRows.length) 10783 newItemIndexInFilteredRange = filteredRows.length - 1; 10784 else if(newItemIndexInFilteredRange < 0) 10785 newItemIndexInFilteredRange = 0; 10786 var newSelectedRow = filteredRows[newItemIndexInFilteredRange]; 10787 return this.GetItemIndexByRow(newSelectedRow); 10788 } 10789}); 10790var ListBoxItemsVirtualManager = ASPx.CreateClass(ListBoxItemsManagerBase, { 10791 constructor: function(listBox) { 10792 this.constructor.prototype.constructor.call(this, listBox); 10793 this.smallestItemHeight = 0; 10794 this.smallestItemWidth = 0; 10795 this.previousScrollPosition = 0; 10796 }, 10797 Initialize: function () { 10798 ListBoxItemsManagerBase.prototype.Initialize.call(this); 10799 this.virtualScrollTopInvisibleItemsCount = 1; 10800 this.virtualScrollBottomInvisibleItemsCount = 1; 10801 this.showFilterButtonWidthCounted = false; 10802 this.isScrollProcessingActivated = true; 10803 this.InitializeItemRows(); 10804 this.virtualScrollVisibleItemIndices = []; 10805 this.updateSmallestItemSize(); 10806 this.UpdateScrollTableContainerHeight(); 10807 }, 10808 GetItemIndexByRow: function (itemRow) { 10809 return itemRow.itemIndex; 10810 }, 10811 GetItemCount: function () { 10812 return this.deserializedItems.length; 10813 }, 10814 GetItem: function(index, preventEncodeText) { 10815 if (index < 0 || index >= this.GetItemCount()) 10816 return null; 10817 var deserializedItem = this.deserializedItems[index]; 10818 var itemTexts = this.AdjustItemTexts(deserializedItem, preventEncodeText); 10819 var result = new ASPxClientListBoxItem(this.listBox, index, itemTexts, deserializedItem.value, 10820 deserializedItem.imageUrl, this.listBox.GetIsItemSelected(index)); 10821 result.insertOrderIndex = deserializedItem.insertOrderIndex; 10822 return result; 10823 }, 10824 GetItemHtmlContent: function(index) { 10825 return this.deserializedItems[index] && this.deserializedItems[index].htmlContent; 10826 }, 10827 AdjustItemTexts: function (item, preventEncodeText) { 10828 var itemInnerTexts = this.GetItemInnerTexts(item, preventEncodeText); 10829 if (this.listBox.IsMultiColumn()) { 10830 for (var i = itemInnerTexts.length; i < this.listBox.columnFieldNames.length; i++) 10831 itemInnerTexts.push(""); 10832 } 10833 return itemInnerTexts; 10834 }, 10835 GetItemInnerTexts: function(item, preventEncodeText) { 10836 if(!item.texts) 10837 return item.texts; 10838 var adjustedItemTexts = []; 10839 for(var i = 0; i < item.texts.length; i++) { 10840 var itemText = item.texts[i] || ""; 10841 if(!this.listBox.encodeHtml && !preventEncodeText) 10842 itemText = this.GetEncodedItemInnerText(itemText); 10843 adjustedItemTexts[i] = itemText; 10844 } 10845 return adjustedItemTexts; 10846 }, 10847 GetEncodedItemInnerText: function(itemText) { 10848 var result = itemText; 10849 var encodedItemText = ASPx.Str.EncodeHtml(itemText); 10850 if(itemText !== encodedItemText) { 10851 var div = document.createElement("DIV"); 10852 ASPx.SetInnerHtml(div, itemText); 10853 result = ASPx.GetInnerText(div); 10854 } 10855 return result; 10856 }, 10857 GetVisibleItemCount: function () { 10858 return this.filteredItemIndices.length; 10859 }, 10860 GetItemsHeight: function () { 10861 var result = 0; 10862 ASPx.Data.ForEach(this.filteredItemIndices, function(itemIndex) { 10863 result += this.GetItemHeight(itemIndex); 10864 }.bind(this)); 10865 return result; 10866 }, 10867 GetTotalItemsHeight: function(firstItemIndex, lastItemIndex) { 10868 var result = 0; 10869 if(lastItemIndex >= this.filteredItemIndices.length) 10870 lastItemIndex = this.filteredItemIndices.length - 1; 10871 for(var i = firstItemIndex;i <= lastItemIndex;i++) { 10872 result += this.GetItemHeight(this.filteredItemIndices[i]); 10873 } 10874 return result; 10875 }, 10876 GetItemHeight: function(index) { 10877 return this.deserializedItems[index].calculatedHeight ? this.deserializedItems[index].calculatedHeight : this.smallestItemHeight; 10878 }, 10879 GetItemsWidth: function() { 10880 var listTableOffsetWidth = this.listTable.offsetWidth; 10881 var showFilterButton = this.listBox.GetShowFilterButton();
10882 if(showFilterButton && !this.showFilterButtonWidthCounted) { 10883 listTableOffsetWidth += showFilterButton.GetMainElement().offsetWidth; 10884 this.showFilterButtonWidthCounted = true; 10885 } 10886 var itemsWidth = this.UseVirtualItemWidth() ? 10887 Math.max(this.visibleItemTextMaxWidth + this.smallestItemWidth, listTableOffsetWidth) 10888 : listTableOffsetWidth; 10889 return itemsWidth; 10890 }, 10891 UseVirtualItemWidth: function() { 10892 return !this.IsFixedWidth() && !this.listBox.hasDecoratedItems && !this.IsItemTextWrapEnabled(); 10893 }, 10894 IsFixedWidth: function() { 10895 return this.listBox.IsMultiColumn() || this.IsStandaloneListBoxWithFixedWidth(); 10896 }, 10897 IsStandaloneListBoxWithFixedWidth: function() { 10898 return !this.listBox.isComboBoxList && this.listBox.width !== ""; 10899 }, 10900 GetFirstRenderedItem: function () { 10901 for (var i = 0; i < this.listTable.rows.length; i++) 10902 if (this.listTable.rows[i].itemIndex !== undefined) 10903 return this.GetItem(this.listTable.rows[i].itemIndex); 10904 return null; 10905 }, 10906 GetLastRenderedItem: function () { 10907 for (var i = this.listTable.rows.length - 1; i >= 0; i--) 10908 if (this.listTable.rows[i].itemIndex !== undefined) 10909 return this.GetItem(this.listTable.rows[i].itemIndex); 10910 return null; 10911 }, 10912 GetTopSpacersHeight: function () { 10913 return ListBoxItemsManagerBase.prototype.GetTopSpacersHeight.call(this) + this.GetVirtualScrollTopSpacer().clientHeight; 10914 }, 10915 GetItemTopOffset: function (index) { 10916 var result = this.GetItemTopOffsetCore(index); 10917 if(result === 0) { 10918 var renderedItemRange = this.GetRenderedItemRange(); 10919 if((renderedItemRange.startIndex >= 0 && renderedItemRange.endIndex >= 0) && (index < renderedItemRange.startIndex || index > renderedItemRange.endIndex)) { 10920 itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(this.filteredItemIndices, index); 10921 if(itemIndexInFilteredRange !== -1) { 10922 result = this.GetTotalItemsHeight(0, itemIndexInFilteredRange) - this.GetItemHeight(itemIndexInFilteredRange); 10923 } 10924 } 10925 } 10926 return result; 10927 }, 10928 IsItemVisible: function (index) { 10929 return this.IsItemRendered(index) ? ListBoxItemsManagerBase.prototype.IsItemVisible.call(this, index) : false; 10930 }, 10931 AreAllItemsVisible: function() { 10932 return this.filteredItemIndices.length === this.GetItemCount(); 10933 }, 10934 IsLastItemBottomEdgeVisible: function() { 10935 return this.IsItemEdgeVisible(this.GetLastFilteredItemIndex(), false, true); 10936 }, 10937 ConvertItemIndexToRowIndex: function (itemIndex) { 10938 if(this.listTable.rows.length < 1) 10939 return -1; 10940 if(this.AreAllItemsVisible() && this.listBox.syncLockCount < 1 && !this.listBox.hasItemTemplate) { 10941 var rawIndex = itemIndex - this.listTable.rows[0].itemIndex; 10942 return rawIndex >= 0 && rawIndex < this.listTable.rows.length 10943 ? rawIndex 10944 : ASPx.Data.ArrayIndexOf(this.listTable.rows, itemIndex, function(element) {return element.itemIndex === itemIndex;}); 10945 } 10946 return ASPx.Data.ArrayIndexOf(this.listTable.rows, itemIndex, function (element) { return element.itemIndex === itemIndex; }); 10947 }, 10948 GetScrollDivChildElementHeight: function () { 10949 return this.GetVirtualScrollTableContainer().getBoundingClientRect().height; 10950 }, 10951 IsItemFiltered: function (index) { 10952 return this.deserializedItems[index] && this.deserializedItems[index].filtered; 10953 }, 10954 GetFirstVisibleItem: function () { 10955 for(var i = 0; i < this.listTable.rows.length; i++) 10956 if (this.listTable.rows[i] && ASPx.ElementContainsCssClass(this.listTable.rows[i], "dxeListBoxItemRow")) 10957 return this.listTable.rows[i].itemIndex; 10958 return -1; 10959 }, 10960 GetFirstFilteredItemIndex: function() { 10961 return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[0] : -1; 10962 }, 10963 GetLastFilteredItemIndex: function() { 10964 return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[this.filteredItemIndices.length - 1] :
10964-1; 10965 }, 10966 GetNextFilteredItemIndex: function(currentFilteredItemIndex) { 10967 return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[ASPx.Data.ArrayIndexOf(this.filteredItemIndices, currentFilteredItemIndex) + 1] : -1; 10968 }, 10969 GetPrevFilteredItemIndex: function(currentFilteredItemIndex) { 10970 return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[ASPx.Data.ArrayIndexOf(this.filteredItemIndices, currentFilteredItemIndex) - 1] : -1; 10971 }, 10972 GetNewItemIndexInFilteredRange: function(selectedIndex, step) { 10973 var itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(this.filteredItemIndices, selectedIndex); 10974 var newItemIndexInFilteredRange = itemIndexInFilteredRange + step; 10975 if(newItemIndexInFilteredRange >= this.filteredItemIndices.length) 10976 newItemIndexInFilteredRange = this.filteredItemIndices.length - 1; 10977 else if(newItemIndexInFilteredRange < 0) 10978 newItemIndexInFilteredRange = 0; 10979 return this.filteredItemIndices[newItemIndexInFilteredRange]; 10980 }, 10981 ShouldRenderItemOnInsert: function(index) { 10982 if (!this.listBox.IsDisplayed()) 10983 return false; 10984 if (this.GetFirstVisibleItemRow() == null) 10985 return true; 10986 if (this.IsIndexInRenderedItemRange(index)) 10987 return true; 10988 if (this.filteredItemIndices.length > 0) { 10989 var startFilteredItemIndex = this.filteredItemIndices[0]; 10990 var endFilteredItemIndex = this.filteredItemIndices[this.filteredItemIndices.length - 1]; 10991 return index < startFilteredItemIndex && this.IsItemVisible(startFilteredItemIndex) 10992 || index > endFilteredItemIndex && this.IsItemVisible(endFilteredItemIndex); 10993 } 10994 return false; 10995 }, 10996 InsertItem: function(index, itemProperties) { 10997 var isInsertToEnd = index === this.GetItemCount(); 10998 var isInsertToEndWithLock = isInsertToEnd && this.updateLock; 10999 var shouldRenderItemOnInsert = !isInsertToEndWithLock && this.ShouldRenderItemOnInsert(index); 11000 var isItemInsertedToTop = this.virtualScrollVisibleItemIndices.length > 0 && index < this.virtualScrollVisibleItemIndices[0]; 11001 ASPx.Data.ArrayInsert(this.deserializedItems, this.listBox.CreateItem(index, itemProperties), index); 11002 this.deserializedItems[index].filtered = true; 11003 this.deserializedItems[index].insertOrderIndex = this.listBox.FindFreeIndex(); 11004 if(!isInsertToEnd) { 11005 for(var i = 0; i < this.deserializedItems.length; i++) 11006 this.deserializedItems[i].index = i; 11007 var requiredItemIndexInFilteredRange = -1; 11008 for(var i = 0; i < this.filteredItemIndices.length; i++) 11009 if(this.filteredItemIndices[i] >= index) { 11010 this.filteredItemIndices[i]++; 11011 if(requiredItemIndexInFilteredRange == -1) 11012 requiredItemIndexInFilteredRange = i; 11013 } 11014 ASPx.Data.ArrayInsert(this.filteredItemIndices, index, requiredItemIndexInFilteredRange); 11015 } 11016 else 11017 this.filteredItemIndices.push(index); 11018 if(shouldRenderItemOnInsert) { 11019 this.updateSmallestItemSize(); 11020 } 11021 if(!isInsertToEndWithLock) { 11022 this.virtualScrollVisibleItemIndices = []; 11023 var rows = this.GetListTableRows(); 11024 for(var i = 0; i < rows.length; i++) { 11025 var row = rows[i]; 11026 if(row.itemIndex !== undefined) { 11027 if(row.itemIndex >= index) 11028 row.itemIndex++; 11029 this.virtualScrollVisibleItemIndices.push(row.itemIndex); 11030 } 11031 } 11032 if(shouldRenderItemOnInsert) { 11033 ASPx.Data.ArrayInsert(this.virtualScrollVisibleItemIndices, index, 11034 ASPx.Data.ArrayIndexOf(this.virtualScrollVisibleItemIndices, index, 11035 function(element) { return element > index; })); 11036 this.listBox.InsertItemRow(index, itemProperties); 11037 this.RecreateItemRowsCompletelly(this.getScrollPosition()); 11038 } 11039 this.UpdateScrollTableContainerHeight(); 11040 if(isItemInsertedToTop) 11041 this.UpdateVirtualScrollSpacerHeight(this.virtualScrollVisibleItemIndices, 0); 11042 if(!this.listBox.IsDisplayed()) 11043 this.listBox.ResetControlAdjustment(); 11044 } 11045 this.UpdateItemTextMaxWidth(this.GetItem(index).text); 11046 }, 11047 BeginUpdate: function() { 11048 this.updateLock = true; 11049 }, 11050 EndUpdate: function() { 11051 this.updateLock = false; 11052 this.updateSmallestItemSize(); 11053 this.RecreateItemRowsCompletelly(this.getScrollPosition()); 11054 this.UpdateScrollTableContainerHeight(); 11055 if(!this.listBox.IsDisplayed()) 11056 this.listBox.ResetControlAdjustment(); 11057 }, 11058 RemoveItem: function(index) { 11059 var shouldRecreateItemRows = this.listBox.IsDisplayed() && this.IsIndexInRenderedItemRange(index); 11060 var shouldRemoveFromRender = this.GetItemRow(index); 11061 var isItemRemovedFromTop = this.virtualScrollVisibleItemIndices.length > 0 && index < this.virtualScrollVisibleItemIndices[0]; 11062 var needUpdateItemTextMaxWidth = this.NeedUpdateItemTextMaxWidthOnRemoveItem(index); 11063 ASPx.Data.ArrayRemoveAt(this.deserializedItems, index); 11064 ASPx.Data.ArrayRemove(this.filteredItemIndices, index); 11065 for (var i = 0; i < this.deserializedItems.length; i++) 11066 this.deserializedItems[i].index = i; 11067 for (var i = 0; i < this.filteredItemIndices.length; i++) 11068 if (this.filteredItemIndices[i] > index) 11069 this.filteredItemIndices[i]--; 11070 this.virtualScrollVisibleItemIndices = []; 11071 if (shouldRemoveFromRender) 11072 this.RemoveItemCore(index); 11073 var rows = this.GetListTableRows(); 11074 for (var i = 0; i < rows.length; i++) { 11075 var row = rows[i]; 11076 if (row.itemIndex !== undefined) { 11077 if(row.itemIndex > index) 11078 row.itemIndex--; 11079 this.virtualScrollVisibleItemIndices.push(row.itemIndex); 11080 } 11081 } 11082 if (shouldRecreateItemRows) 11083 this.RecreateItemRowsCompletelly(this.getScrollPosition()); 11084 this.UpdateScrollTableContainerHeight(); 11085 if (isItemRemovedFromTop) 11086 this.UpdateVirtualScrollSpacerHeight(this.virtualScrollVisibleItemIndices, 0
11086); 11087 if (needUpdateItemTextMaxWidth) { 11088 this.itemTextMaxWidth = 0; 11089 this.visibleItemTextMaxWidth = 0; 11090 for (var i = 0; i < this.GetItemCount() ; i++) 11091 this.UpdateItemTextMaxWidth(this.GetItem(i).text); 11092 } 11093 if (!this.listBox.IsDisplayed()) 11094 this.listBox.ResetControlAdjustment(); 11095 }, 11096 ClearItems: function () { 11097 this.ClearItemsCore(); 11098 this.deserializedItems = []; 11099 this.filteredItemIndices = []; 11100 this.virtualScrollVisibleItemIndices = []; 11101 if (this.listBox.isComboBoxList) { 11102 this.itemTextMaxWidth = 0; 11103 this.visibleItemTextMaxWidth = 0; 11104 } 11105 this.UpdateScrollTableContainerHeight(); 11106 if (!this.listBox.IsDisplayed()) 11107 this.listBox.ResetControlAdjustment(); 11108 }, 11109 CreateNewItemRow: function (index) { 11110 var newItemRow = ListBoxItemsManagerBase.prototype.CreateNewItemRow.call(this, index); 11111 newItemRow.itemIndex = index; 11112 return newItemRow; 11113 }, 11114 Adjust: function() { 11115 if (this.GetItemCount() == 0 || !this.listBox.IsDisplayed()) 11116 return; 11117 if(this.smallestItemHeight === 0) { 11118 this.updateSmallestItemSize(); 11119 this.UpdateScrollTableContainerHeight(); 11120 } 11121 if(this.smallestItemHeight !== 0) { 11122 if(this.IsItemTextWrapEnabled()) 11123 this.CorrectItemsHeight(); 11124 this.RecreateItemRowsCompletelly(this.getScrollPosition()); 11125 this.listBox.InitializePageSize(); 11126 if(!this.listBox.isComboBoxList) 11127 this.listBox.CorrectWidth(); 11128 } 11129 }, 11130 UpdateItemTextMaxWidth: function (itemText, isFiltering) { 11131 if (!this.UseVirtualItemWidth()) 11132 return; 11133 if (!ASPx.IsExists(this.visibleItemTextMaxWidth)) 11134 this.visibleItemTextMaxWidth = 0; 11135 this.visibleItemTextMaxWidth = Math.max(this.GetItemTextWidth(itemText), this.visibleItemTextMaxWidth); 11136 if (!isFiltering) 11137 this.itemTextMaxWidth = this.visibleItemTextMaxWidth; 11138 }, 11139 GetItemTextWidth: function (itemText) { 11140 return Math.round(this.GetItemTextMeasureContext().measureText(itemText).width); 11141 }, 11142 GetItemTextMeasureContext: function() { 11143 if (!this.itemTextMeasureContext) { 11144 var itemTextMeasureCanvas = document.createElement("canvas"); 11145 this.itemTextMeasureContext = itemTextMeasureCanvas.getContext("2d"); 11146 var mainElementStyle = ASPx.GetCurrentStyle(this.listBox.GetMainElement()); 11147 var mainElementFont = mainElementStyle.font ? mainElementStyle.font : 11148 mainElementStyle.fontStyle + " " + mainElementStyle.fontVariant + " " + mainElementStyle.fontWeight + " " 11149 + mainElementStyle.fontSize + " / " + mainElementStyle.lineHeight + " " + mainElementStyle.fontFamily; 11150 this.itemTextMeasureContext.font = mainElementFont; 11151 } 11152 return this.itemTextMeasureContext; 11153 }, 11154 NeedUpdateItemTextMaxWidthOnRemoveItem: function(index) { 11155 return this.UseVirtualItemWidth() && this.listBox.isComboBoxList && this.IsItemWithMaxText(this.GetItem(index).text); 11156 }, 11157 BeforeClientFiltering: function () { 11158 if (this.listBox.isComboBoxList) 11159 this.visibleItemTextMaxWidth = 0; 11160 }, 11161 IsItemWithMaxText: function(itemText) { 11162 return this.GetItemTextWidth(itemText) === this.itemTextMaxWidth; 11163 }, 11164 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) { 11165 if (savePrevState && !ASPx.IsExists(this.deserializedItems[index].savedFiltered)) 11166 this.deserializedItems[index].savedFiltered = this.deserializedItems[index].filtered; 11167 this.ChangeItemFilteredFlag(index, isSatisfy, isFilterReset); 11168 }, 11169 RestorePrevFilteredState: function (index) { 11170 var savedFilteredState = this.deserializedItems[index].savedFiltered; 11171 if (ASPx.IsExists(savedFilteredState)) { 11172 this.ChangeItemFilteredFlag(index, savedFilteredState); 11173 delete this.deserializedItems[index].savedFiltered; 11174 } 11175 }, 11176 ChangeItemFilteredFlag: function (index, newValue, isFilterReset) { 11177 var item = this.deserializedItems[index]; 11178 item.filtered = newValue; 11179 if (!isFilterReset && this.listBox.isComboBoxList && newValue) 11180 this.UpdateItemTextMaxWidth(item.text); 11181 }, 11182 OnEndItemsFiltering: function() { 11183 if(this.listBox.IsDisplayed()) { 11184 this.RecreateItemRowsCompletelly(0); 11185 } 11186 }, 11187 ChangeItemsFilteredState: function (action) { 11188 this.filteredItemIndices = []; 11189 ListBoxItemsManagerBase.prototype.ChangeItemsFilteredState.call(this, action); 11190 }, 11191 AfterChangeItemFilteredStateAction: function (index) { 11192 if (this.IsItemFiltered(index)) 11193 this.filteredItemIndices.push(index); 11194 }, 11195 RewriteFilteredItemIndices: function (newFilteredItemIndices) { 11196 this.filteredItemIndices = newFilteredItemIndices; 11197 }, 11198 MakeAllItemsVisible: function () { 11199 ListBoxItemsManagerBase.prototype.MakeAllItemsVisible.call(this); 11200 this.visibleItemTextMaxWidth = this.itemTextMaxWidth; 11201 }, 11202 MakeItemVisible: function(index) { 11203 if(index < 0) { 11204 index = 0; 11205 } 11206 ListBoxItemsManagerBase.prototype.MakeItemVisible.call(this, index); 11207 }, 11208 InsertTempFirstItemRow: function() { 11209 try { 11210 this.listBox.LockRunStartupSciptsInItemRow(); 11211 if(this.deserializedItems.length > 0) 11212 this.listBox.InsertItemRow(0, this.deserializedItems[0]); 11213 } 11214 finally { 11215 this.listBox.UnlockRunStartupSciptsInItemRow(); 11216 } 11217 }, 11218 RemoveFirstTempRow: function () { 11219 if (this.deserializedItems.length > 0) 11220 this.listBox.RemoveItemRow(0); 11221 }, 11222 GetVirtualScrollItemHeight: function(virtualScrollItemRow) { 11223 return virtualScrollItemRow.getBoundingClientRect().height; 11224 }, 11225 updateSmallestItemSize: function() { 11226 if(this.smallestItemHeight == 0 && this.GetItemCount() !== 0) { 11227 this.InsertTempFirstItemRow(); 11228 var firstItemRow = this.GetFirstVisibleItemRow(); 11229 var itemTextCell = this.listBox.GetItemFirstTextCell(0); 11230 var cellDisplay = itemTextCell.style.display; 11231 itemTextCell.style.display = ""; 11232 ASPx.SetInnerHtml(itemTextCell,"."); 11233 this.smallestItemHeight = firstItemRow.getBoundingClientRect().height; 11234 ASPx.AddClassNameToElement(this.listTable, listTableCollapsedClassName); 11235 ASPx.SetInnerHtml(itemTextCell,""); 11236 if(this.UseVirtualItemWidth() && this.smallestItemWidth === 0) { 11237 this.smallestItemWidth = firstItemRow.offsetWidth; 11238 } 11239 itemTextCell.style.display = cellDisplay; 11240 ASPx.RemoveClassNameFromElement(this.listTable, listTableCollapsedClassName); 11241 this.RemoveFirstTempRow(); 11242 } 11243 }, 11244 UpdateScrollTableContainerHeight: function () { 11245 var virtualScrollTableContainer = this.GetVirtualScrollTableContainer(); 11246 if (virtualScrollTableContainer) 11247 ASPx.SetStyles(virtualScrollTableContainer, { 11248 height: this.GetItemsHeight() 11249 + this.listBox.GetTopScrollSpacerHeight() 11250 + this.listBox.GetBottomScrollSpacerHeight() 11251 }); 11252 }, 11253 UpdateVirtualScrollSpacerHeight: function(visibleIndices, scrollableContainerHeightDelta) { 11254 var firstVisibleIndex = visibleIndices.length > 0 && this.filteredItemIndices.length > 0 ? ASPx.Data.ArrayIndexOf(this.filteredItemIndices, visibleIndices[0]) : 0; 11255 var topSpacerHeight = 0; 11256 if(firstVisibleIndex > 0) { 11257 topSpacerHeight = this.GetTotalItemsHeight(0, firstVisibleIndex - 1); 11258 } 11259 if(!scrollableContainerHeightDelta) 11260 scrollableContainerHeightDelta = 0; 11261 ASPx.SetStyles(this.GetVirtualScrollTopSpacer(), { height: topSpacerHeight - scrollableContainerHeightDelta }); 11262 }, 11263 OnScrollSpacerVisibilityChanged: function() { 11264 this.UpdateScrollTableContainerHeight(); 11265 }, 11266 SetItemHtml: function(index, html) { 11267 this.deserializedItems[index].htmlContent = html; 11268 }, 11269 SetItemTooltip: function (index, tooltip) { 11270 this.deserializedItems[index].tooltip = tooltip; 11271 }, 11272 SetItemAttribute: function(index, attrName, attrValue) { 11273 if(!this.deserializedItems[index].attributes) 11274 this.deserializedItems[index].attributes = {}; 11275 this.deserializedItems[index].attributes[attrName] = attrValue; 11276 }, 11277 AddClassNameToCssClass: function(cssClass, className) { 11278 return (cssClass == "" || cssClass == undefined) ? className : cssClass + " " + className; 11279 }, 11280 RemoveClassNameFromCssClass: function (cssClass, className) { 11281 var updClassName = " " + cssClass + " "; 11282 var newClassName = updClassName.replace(" " + className + " ", " "); 11283 return updClassName.length != newClassName.length ? ASPx.Str.Trim(newClassName) : cssClass; 11284 }, 11285 AddItemCssClass: function (index, className) { 11286 this.deserializedItems[index].cssClass = this.AddClassNameToCssClass(this.deserializedItems[index].cssClass, className); 11287 }, 11288 RemoveItemCssClass: function (index, className) { 11289 this.deserializedItems[index].cssClass = this.RemoveClassNameFromCssClass(this.deserializedItems[index].cssClass, className); 11290 }, 11291 SetItemTextCellHtml: function (itemIndex, textCellIndex, html) { 11292 if (!this.deserializedItems[itemIndex].htmlContents) 11293 this.deserializedItems[itemIndex].htmlContents = []; 11294 this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].htmlContents, textCellIndex, html); 11295 }, 11296 SetItemTextCellTooltip: function (itemIndex, textCellIndex, tooltip) { 11297 if (!this.deserializedItems[itemIndex].cellTooltips) 11298 this.deserializedItems[itemIndex].cellTooltips = []; 11299 this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellTooltips, textCellIndex, tooltip); 11300 }, 11301 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attrName, attrValue) { 11302 if(!this.deserializedItems[itemIndex].cellAttributes) 11303 this.deserializedItems[itemIndex].cellAttributes = []; 11304 var setValueAction = function(itemInfo, value) { 11305 if(!itemInfo.value) 11306 itemInfo.value = {}; 11307 itemInfo.value[value.attrName] = value.attrValue; 11308 }; 11309 this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellAttributes, textCellIndex, 11310 { attrName: attrName, attrValue: attrValue }, setValueAction); 11311 }, 11312 AddItemTextCellCssClass: function (itemIndex, textCellIndex, className) {
11313 if (!this.deserializedItems[itemIndex].cellCssClasses) 11314 this.deserializedItems[itemIndex].cellCssClasses = []; 11315 var newCssClass = this.AddClassNameToCssClass(this.deserializedItems[itemIndex].cellCssClasses[textCellIndex], className); 11316 this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellCssClasses, textCellIndex, newCssClass); 11317 }, 11318 RemoveItemTextCellCssClass: function (itemIndex, textCellIndex, className) { 11319 if (!this.deserializedItems[itemIndex].cellCssClasses) 11320 this.deserializedItems[itemIndex].cellCssClasses = []; 11321 var newCssClass = this.RemoveClassNameFromCssClass(this.deserializedItems[itemIndex].cellCssClasses[textCellIndex], className); 11322 this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellCssClasses, textCellIndex, newCssClass); 11323 }, 11324 SetItemTextCellInfoValue: function (infoArray, textCellIndex, value, setValueAction) { 11325 var itemInfo = null; 11326 var filteredArray = infoArray.filter(function (info) { return info.index === textCellIndex; }); 11327 if (filteredArray.length == 0) { 11328 itemInfo = { index: textCellIndex }; 11329 infoArray.push(itemInfo); 11330 } 11331 else 11332 itemInfo = filteredArray[0]; 11333 if(setValueAction) 11334 setValueAction(itemInfo, value); 11335 else 11336 itemInfo.value = value; 11337 }, 11338 InitializeItems: function(items, itemsValue) { 11339 this.deserializedItems = this.listBox.DeserializeItems(items); 11340 this.filteredItemIndices = []; 11341 this.visibleItemTextMaxWidth = 0; 11342 this.itemTextMaxWidth = 0; 11343 for (var i = 0; i < this.deserializedItems.length; i++) { 11344 this.listBox.AdjustItemProperties(this.deserializedItems[i]); 11345 itemsValue[i] = this.deserializedItems[i].value; 11346 this.filteredItemIndices[i] = this.deserializedItems[i].index; 11347 this.deserializedItems[i].filtered = true; 11348 this.deserializedItems[i].insertOrderIndex = this.listBox.FindFreeIndex(); 11349 this.UpdateItemTextMaxWidth(this.deserializedItems[i].text); 11350 } 11351 }, 11352 InitializeItemRows: function () { 11353 var topSpacer = ASPx.CreateHtmlElement("DIV"); 11354 topSpacer.id = this.listBox.name + "VirtualScrollTopSpacer"; 11355 var tableContainer = ASPx.CreateHtmlElement("DIV"); 11356 tableContainer.id = this.listBox.name + ListBoxVirtualScrollTableContainerIDPostfix; 11357 tableContainer.appendChild(topSpacer); 11358 var scrollDiv = this.listBox.GetScrollDivElement(); 11359 ASPx.MoveChildrenToElement(scrollDiv, tableContainer); 11360 scrollDiv.appendChild(tableContainer); 11361 ASPx.SetStyles(tableContainer, { overflow: "hidden", width: "100%" }); 11362 ASPx.Evt.AttachEventToElement(scrollDiv, "scroll", this.onScroll.bind(this)); 11363 }, 11364 getScrollPosition: function() { 11365 var scrollDiv = this.listBox.GetScrollDivElement(); 11366 var scrollTop = scrollDiv.scrollTop - this.listBox.GetTopScrollSpacerHeight(); 11367 if(scrollTop < 0) 11368 scrollTop = 0; 11369 return scrollTop; 11370 }, 11371 onScroll: function() { 11372 var scrollTop = this.getScrollPosition(); 11373 if(this.IsScrollActivated()) { 11374 var scrollDiv = this.listBox.GetScrollDivElement(); 11375 if(!scrollDiv) return; 11376 var scrollDivHeight = scrollDiv.clientHeight; 11377 var scrollContainerHeight = this.GetScrollDivChildElementHeight(); 11378 var scrollToBottom = scrollContainerHeight <= scrollDivHeight ? false : scrollTop >= scrollContainerHeight - scrollDivHeight; 11379 var virtualScrollTopSpacerHeight = this.GetVirtualScrollTopSpacer().getBoundingClientRect().height; 11380 var isSmallScroll = Math.abs(scrollTop - this.previousScrollPosition) < scrollDivHeight; 11381 if(isSmallScroll && virtualScrollTopSpacerHeight > scrollTop) 11382 isSmallScroll = false; 11383 if(isSmallScroll) 11384 this.RecreateItemRowsPartially(scrollTop); 11385 else 11386 this.RecreateItemRowsCompletelly(scrollTop); 11387 if(scrollToBottom) { 11388 this.DeactivateScrollHandler(); 11389 scrollDiv.scrollTop = this.GetScrollDivChildElementHeight() - scrollDivHeight; 11390 } 11391 } 11392 else { 11393 this.ActivateScrollHandler(); 11394 } 11395 this.previousScrollPosition = scrollTop; 11396 }, 11397 RecreateItemRowsCompletelly: function(scrollTop) { 11398 this.RecreateItemRows(scrollTop, false); 11399 }, 11400 RecreateItemRowsPartially: function(scrollTop) { 11401 this.RecreateItemRows(scrollTop, true); 11402 }, 11403 RecreateItemRows: function(scrollTop, recreateItemsPartially) { 11404 if(recreateItemsPartially == "undefined") throw new Error("recreateItemsPartially"); 11405 if(this.listBox.IsDisplayed()) { 11406 var firstVisibleItemIndex = this.getFirstVisibleItemIndex(scrollTop); 11407 var lastVisibleItemIndex = this.getLastVisibleItemIndex(scrollTop); 11408 this.RecreateItemRowsCore(firstVisibleItemIndex, lastVisibleItemIndex, recreateItemsPartially); 11409 if(typeof (ASPxClientHint) != "undefined") 11410 this.UpdateHintControl(); 11411 this.listBox.AssignEllipsisTooltips(); 11412 } 11413 }, 11414 RecreateItemRowsCore: function(topRenderedItemIndex, bottomRenderedItemIndex, recreateItemsPartially) { 11415 if(topRenderedItemIndex > bottomRenderedItemIndex && this.filteredItemIndices.length > 0) 11416 return; 11417 var newVisibleIndices = this.filteredItemIndices.slice(topRenderedItemIndex, bottomRenderedItemIndex + 1); 11418 this.RecreateItemRowsByVisibleIndices(newVisibleIndices, false, recreateItemsPartially); 11419 this.OnDecoratedItemsRendering(); 11420 if(this.listBox.NeedToHandleCellWidth()) 11421 this.listBox.CorrectCellNullWidthStyle(this.GetFirstVisibleItemRow()); 11422 }, 11423 getFirstVisibleItemIndex: function(scrollTop) { 11424 var result = -1; 11425 var scrollDiv = this.listBox.GetScrollDivElement(); 11426 var scrollDivHeight = scrollDiv.clientHeight; 11427 var scrollContainerHeight = this.GetScrollDivChildElementHeight();
11428 var scrollToBottom = scrollContainerHeight <= scrollDivHeight ? false : scrollTop >= scrollContainerHeight - scrollDivHeight; 11429 var height = 0; 11430 if(scrollToBottom) { 11431 for(var i = this.filteredItemIndices.length - 1;i >= 0;i--) { 11432 height += this.GetItemHeight(this.filteredItemIndices[i]); 11433 if(height > scrollDivHeight) { 11434 result = i; 11435 break; 11436 } 11437 } 11438 } 11439 else { 11440 for(var i = 0;i < this.filteredItemIndices.length;i++) { 11441 height += this.GetItemHeight(this.filteredItemIndices[i]); 11442 if(height > scrollTop) { 11443 result = i > 1 ? i - 1 : 0; 11444 break; 11445 } 11446 } 11447 } 11448 return result; 11449 }, 11450 getLastVisibleItemIndex: function(scrollTop) { 11451 var result = -1; 11452 var scrollDiv = this.listBox.GetScrollDivElement(); 11453 var scrollDivHeight = scrollDiv.clientHeight; 11454 var scrollContainerHeight = this.GetScrollDivChildElementHeight(); 11455 var scrollToBottom = scrollContainerHeight <= scrollDivHeight ? false : scrollTop >= scrollContainerHeight - scrollDivHeight; 11456 if(scrollToBottom) { 11457 result = this.filteredItemIndices[this.filteredItemIndices.length - 1]; 11458 } 11459 else { 11460 var height = 0; 11461 result = this.filteredItemIndices.length - 1; 11462 if(this.filteredItemIndices) { 11463 for(var i = 0;i < this.filteredItemIndices.length;i++) { 11464 height += this.GetItemHeight(this.filteredItemIndices[i]); 11465 if(height >= (scrollTop + scrollDivHeight)) { 11466 result = i; 11467 break; 11468 } 11469 } 11470 } 11471 } 11472 return result == this.filteredItemIndices.length - 1 ? result : result + 1; 11473 }, 11474 UpdateHintControl: function() { 11475 ASPxClientHint.hideByTargetsContainerElement(this.listTable, true); 11476 ASPxClientHint.Update(); 11477 }, 11478 GetScrollContentHeight: function() { 11479 return this.GetVirtualScrollTopSpacer().getBoundingClientRect().height 11480 + this.listBox.GetTopScrollSpacerHeight() + this.listBox.GetBottomScrollSpacerHeight() 11481 + this.listTable.getBoundingClientRect().height; 11482 }, 11483 removeItems: function(indicesToRemove) { 11484 var renderedItemIndexesBeforeModification = this.virtualScrollVisibleItemIndices; 11485 var removedFromTopItemsHeight = 0; 11486 for(var i = 0;i < indicesToRemove.length;i++) { 11487 var itemIndex = indicesToRemove[i]; 11488 if(renderedItemIndexesBeforeModification.indexOf(itemIndex) === 0) { 11489 removedFromTopItemsHeight += this.GetItemHeight(itemIndex); 11490 renderedItemIndexesBeforeModification = renderedItemIndexesBeforeModification.slice(1); 11491 } 11492 this.listBox.RemoveItemRow(itemIndex); 11493 } 11494 return removedFromTopItemsHeight; 11495 }, 11496 insertItems: function(indicesToInsert) { 11497 var firstVisibleItemIndexBeforeInsert = this.GetFirstVisibleItem(); 11498 var scrollableContainerHeightDelta = 0; 11499 var insertedToTopItemsHeight = 0; 11500 for(var i = 0;i < indicesToInsert.length;i++) { 11501 var itemIndex = indicesToInsert[i]; 11502 if(itemIndex < firstVisibleItemIndexBeforeInsert) { 11503 insertedToTopItemsHeight += this.GetItemHeight(itemIndex); 11504 } 11505 this.listBox.InsertItemRow(itemIndex, this.deserializedItems[itemIndex]); 11506 if(!this.deserializedItems[itemIndex].calculatedHeight) { 11507 var itemRowElement = this.GetItemRow(itemIndex); 11508 var imageElements = itemRowElement.querySelectorAll("img"); 11509 var updateCalculatedHeightFunction = function(itemIndex, itemRowElement) { 11510 this.deserializedItems[itemIndex].calculatedHeight = this.GetVirtualScrollItemHeight(itemRowElement); 11511 this.RecreateItemRows(this.getScrollPosition(),true); 11512 }; 11513 for(var j = 0;j < imageElements.length;j++) { 11514 var img = imageElements[j]; 11515 if(!img.complete) { 11516 ASPx.Evt.AttachEventToElement(img, "load", updateCalculatedHeightFunction.bind(this, itemIndex, itemRowElement)); 11517 ASPx.Evt.AttachEventToElement(img, "error", updateCalculatedHeightFunction.bind(this, itemIndex, itemRowElement)); 11518 } 11519 } 11520 this.deserializedItems[itemIndex].calculatedHeight = this.GetVirtualScrollItemHeight(itemRowElement); 11521 if(itemIndex < firstVisibleItemIndexBeforeInsert) { 11522 scrollableContainerHeightDelta += this.deserializedItems[itemIndex].calculatedHeight - this.smallestItemHeight; 11523 } 11524 } 11525 var isItemSelected = this.listBox.GetIsItemSelected(itemIndex); 11526 var stateController = typeof (ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null; 11527 this.listBox.SetItemSelectionAppearance(itemIndex, isItemSelected, stateController, false); 11528 if (this.listBox.GetIsCheckColumnExists()) 11529 this.listBox.SetCheckBoxChecked(itemIndex, isItemSelected); 11530 this.listBox.ChangeEnabledStateItem(itemIndex, this.listBox.GetEnabled(), stateController); 11531 } 11532 return { 11533 scrollableContainerHeightDelta: scrollableContainerHeightDelta, 11534 insertedToTopItemsHeight: insertedToTopItemsHeight 11535 }; 11536 }, 11537 RecreateItemRowsByVisibleIndices: function(newVisibleIndices, keepTopSpacerHeight, recreateItemsPartially) { 11538 if(recreateItemsPartially == "undefined") throw new Error("recreateItemsPartially"); 11539 if(keepTopSpacerHeight == "undefined") throw new Error("keepTopSpacerHeight"); 11540 newVisibleIndices = newVisibleIndices || []; 11541 var indicesToRemove = this.virtualScrollVisibleItemIndices.filter(function(index) { 11542 return newVisibleIndices.indexOf(index) === -1; 11543 }); 11544 var indicesToInsert = newVisibleIndices.filter(function(index) { 11545 return this.virtualScrollVisibleItemIndices.indexOf(index) === -1; 11546 }.bind(this)); 11547 this.listBox.LockSynchronization(); 11548 var removedFromTopItemsHeight = this.removeItems(indicesToRemove); 11549 var insertionInfo = this.insertItems(indicesToInsert); 11550 var scrollableContainerHeightDelta = insertionInfo.scrollableContainerHeightDelta; 11551 var insertedToTopItemsHeight = insertionInfo.insertedToTopItemsHeight; 11552 this.virtualScrollVisibleItemIndices = newVisibleIndices; 11553 this.UpdateScrollTableContainerHeight();
11554 this.listBox.TryApplyHighlighting(); 11555 this.listBox.UnlockSynchronization(); 11556 if(recreateItemsPartially) { 11557 var virtualScrollTopSpacer = this.GetVirtualScrollTopSpacer(); 11558 var newHeight = virtualScrollTopSpacer.getBoundingClientRect().height - insertedToTopItemsHeight + removedFromTopItemsHeight; 11559 newHeight = newHeight >= 0 ? newHeight : 0; 11560 this.setScrollSpacerHeight(virtualScrollTopSpacer, newHeight); 11561 if(scrollableContainerHeightDelta !== 0) { 11562 this.DeactivateScrollHandler(); 11563 this.listBox.GetScrollDivElement().scrollTop += scrollableContainerHeightDelta; 11564 } 11565 } 11566 else if(!keepTopSpacerHeight) 11567 this.UpdateVirtualScrollSpacerHeight(newVisibleIndices); 11568 this.listBox.InitDXTextAttributes(); 11569 }, 11570 setScrollSpacerHeight: function(scrollSpacer, newHeight) { 11571 var scrollDiv = this.listBox.GetScrollDivElement(); 11572 var oldScrollTop = scrollDiv.scrollTop; 11573 ASPx.SetStyles(scrollSpacer, { height: newHeight }); 11574 if(ASPx.Browser.Firefox && scrollDiv.scrollTop != oldScrollTop) 11575 scrollDiv.scrollTop = oldScrollTop; 11576 }, 11577 GetVirtualScrollTableContainer: function () { 11578 return this.listBox.tempCache.Get("virtualScrollTableContainer", this.GetVirtualScrollTableContainerCore.aspxBind(this), this.listBox); 11579 }, 11580 GetVirtualScrollTableContainerCore: function () { 11581 if (!ASPx.IsExistsElement(this.listBox.virtualScrollTableContainer)) 11582 this.listBox.virtualScrollTableContainer = ASPx.GetElementById(this.listBox.name + ListBoxVirtualScrollTableContainerIDPostfix); 11583 return this.listBox.virtualScrollTableContainer; 11584 }, 11585 GetVirtualScrollTopSpacer: function () { 11586 return this.listBox.tempCache.Get("virtualScrollTopSpacer", this.GetVirtualScrollTopSpacerCore.aspxBind(this), this.listBox); 11587 }, 11588 GetVirtualScrollTopSpacerCore: function () { 11589 if (!ASPx.IsExistsElement(this.listBox.virtualScrollTopSpacer)) 11590 this.listBox.virtualScrollTopSpacer = ASPx.GetElementById(this.listBox.name + "VirtualScrollTopSpacer"); 11591 return this.listBox.virtualScrollTopSpacer; 11592 }, 11593 GetRenderedItemRange: function () { 11594 var firstRenderedItem = this.GetFirstRenderedItem(); 11595 var lastRenderedItem = this.GetLastRenderedItem(); 11596 return { 11597 startIndex: firstRenderedItem ? firstRenderedItem.index : -1, 11598 endIndex: lastRenderedItem ? lastRenderedItem.index : -1 11599 }; 11600 }, 11601 IsIndexInRenderedItemRange: function(index) { 11602 var renderedItemRange = this.GetRenderedItemRange(); 11603 return index >= renderedItemRange.startIndex && index <= renderedItemRange.endIndex; 11604 }, 11605 IsItemRendered: function (itemIndex) { 11606 return this.GetItemRow(itemIndex) !== null; 11607 }, 11608 IsItemTextWrapEnabled: function() { 11609 if(!ASPx.IsExists(this.enableItemTextWrap)) { 11610 var sampleItemFirstTextCell = this.listBox.GetSampleItemFirstTextCell(); 11611 this.enableItemTextWrap = sampleItemFirstTextCell && ASPx.GetCurrentStyle(sampleItemFirstTextCell).whiteSpace !== "nowrap"; 11612 } 11613 return this.enableItemTextWrap; 11614 }, 11615 OnDecoratedItemsRendering: function () { 11616 if(this.listBox.hasDecoratedItems && !this.IsFixedWidth() && this.listBox.IsDisplayed() && !this.IsItemTextWrapEnabled()) 11617 this.listBox.CorrectWidth(); 11618 }, 11619 DeactivateScrollHandler: function() { 11620 this.isScrollProcessingActivated = false; 11621 }, 11622 ActivateScrollHandler: function() { 11623 this.isScrollProcessingActivated = true; 11624 }, 11625 CorrectItemsHeight: function() { 11626 var needUpdateSmallestItemSize = false; 11627 var rows = this.GetListTableRows(); 11628 for(var i = 0; i < rows.length; i++) { 11629 var row = rows[i]; 11630 var index = row.itemIndex; 11631 if(index != undefined) { 11632 var deserializedItem = this.GetDeserializedItemByIndex(index); 11633 var rowHeight = this.GetVirtualScrollItemHeight(row); 11634 if(deserializedItem.calculatedHeight != rowHeight) { 11635 this.deserializedItems[index].calculatedHeight = rowHeight; 11636 needUpdateSmallestItemSize = true; 11637 } 11638 } 11639 } 11640 if(needUpdateSmallestItemSize) { 11641 this.smallestItemHeight = 0; 11642 this.updateSmallestItemSize(); 11643 } 11644 }, 11645 GetDeserializedItemByIndex: function(itemIndex) { 11646 return this.deserializedItems.filter(function(item) { return item.index == itemIndex; })[0]; 11647 }, 11648 IsScrollActivated: function() { 11649 return this.isScrollProcessingActivated; 11650 } 11651}); 11652var ASPxClientListEdit = ASPx.CreateClass(ASPxClientEdit, { 11653 constructor: function(name) { 11654 this.constructor.prototype.constructor.call(this, name); 11655 this.SelectedIndexChanged = new ASPxClientEvent(); 11656 this.savedSelectedIndex = -1; 11657 }, 11658 FindInputElement: function() { 11659 return this.FindStateInputElement(); 11660 }, 11661 FindStateInputElement: function(){ 11662 return document.getElementById(this.name + leVISuffix); 11663 }, 11664 GetItem: function(index) { 11665 throw "Not implemented"; 11666 },
11667 GetItemValue: function(index) { 11668 throw "Not implemented"; 11669 }, 11670 GetValue: function(){ 11671 return this.GetItemValue(this.GetSelectedIndex()); 11672 }, 11673 GetSelectedIndexInternal: function(){ 11674 return this.savedSelectedIndex; 11675 }, 11676 SetSelectedIndexInternal: function(index){ 11677 this.savedSelectedIndex = index; 11678 }, 11679 FindItemIndexByValue: function(value){ 11680 for(var i = 0; i < this.GetItemCount(); i++){ 11681 if(this.GetItemValue(i) == value) 11682 return i; 11683 } 11684 return -1; 11685 }, 11686 RaiseItemClick: function() { 11687 var processOnServer = this.autoPostBack; 11688 if(!this.ItemClick.IsEmpty()){ 11689 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 11690 this.ItemClick.FireEvent(this, args); 11691 processOnServer = args.processOnServer; 11692 } 11693 return processOnServer; 11694 }, 11695 RaiseItemDoubleClick: function() { 11696 var processOnServer = this.autoPostBack; 11697 if(!this.ItemDoubleClick.IsEmpty()){ 11698 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 11699 this.ItemDoubleClick.FireEvent(this, args); 11700 processOnServer = args.processOnServer; 11701 } 11702 return processOnServer; 11703 }, 11704 RaiseValueChangedEvent: function() { 11705 if(!this.isInitialized) return false; 11706 var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this); 11707 processOnServer = this.RaiseValueChangedAdditionalEvents(processOnServer); 11708 return processOnServer; 11709 }, 11710 RaiseValueChangedAdditionalEvents: function(processOnServer){ 11711 return this.RaiseSelectedIndexChanged(processOnServer); 11712 }, 11713 RaiseSelectedIndexChanged: function (processOnServer) { 11714 this.RaiseValidationInternal(); 11715 if(!this.SelectedIndexChanged.IsEmpty()){ 11716 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 11717 this.SelectedIndexChanged.FireEvent(this, args); 11718 processOnServer = args.processOnServer; 11719 } 11720 return processOnServer; 11721 }, 11722 UpdateHiddenInputs: function(){ 11723 var element = this.FindStateInputElement(); 11724 if(ASPx.IsExistsElement(element)) { 11725 var value = this.GetValue(); 11726 if(value == null) 11727 value = ""; 11728 element.value = value; 11729 } 11730 }, 11731 GetModifyEvent: function () { 11732 return this.SelectedIndexChanged; 11733 }, 11734 GetSelectedItem: function(){ 11735 var index = this.GetSelectedIndexInternal(); 11736 return this.GetItem(index); 11737 }, 11738 GetSelectedIndex: function(){ 11739 return this.GetSelectedIndexInternal(); 11740 }, 11741 SetSelectedItem: function(item){ 11742 var index = (item != null) ? item.index : -1; 11743 this.SetSelectedIndex(index); 11744 }, 11745 SetSelectedIndex: function(index){ 11746 this.SelectIndexSilent(index); 11747 }, 11748 SelectIndexSilent: function(index){ 11749 throw "Not implemented"; 11750 }, 11751 OnValueChanged: function () { 11752 var processOnServer = this.RaiseValueChangedEvent() && this.GetIsValid(); 11753 if(processOnServer) 11754 this.SendPostBackInternal(""); 11755 }, 11756 getElementToObserveVisibilityChange: function () { 11757 return this.GetMainElement(); 11758 }, 11759 processVisibilityChanged: function (visible) { 11760 var focusHandlingInputForKeyboardSupport = this.GetMainElement().querySelector(".dxKBSI"); 11761 ASPx.ToggleClassNameToElement(focusHandlingInputForKeyboardSupport, "dx-position-fixed", visible); 11762 } 11763}); 11764var ASPxClientListEditItem = ASPx.CreateClass(null, { 11765 constructor: function(listEditBase, index, text, value, imageUrl){ 11766 this.listEditBase = listEditBase; 11767 this.index = index; 11768 this.imageUrl = imageUrl; 11769 this.text = text; 11770 this.value = value; 11771 } 11772}); 11773var ASPxClientListBoxItem = ASPx.CreateClass(ASPxClientListEditItem, { 11774 constructor: function(listEditBase, index, texts, value, imageUrl, selected, cellStyles, cellCssClasses, cellTooltips, cellAttributes, htmlContents, style, cssClass, tooltip, attributes, htmlContent) { 11775 this.constructor.prototype.constructor.call(this, listEditBase, index, null, value, imageUrl); 11776 this.selected = !!selected; 11777 this.texts = texts; 11778 this.text = listEditBase.FormatText(texts, value); 11779 this.cellStyles = cellStyles; 11780 this.cellCssClasses = cellCssClasses; 11781 this.cellTooltips = cellTooltips; 11782 this.cellAttributes = cellAttributes; 11783 this.htmlContents = htmlContents; 11784 this.style = style; 11785 this.cssClass = cssClass; 11786 this.tooltip = tooltip; 11787 this.attributes = attributes; 11788 this.htmlContent = htmlContent; 11789 }, 11790 GetColumnText: function(columnIndexOrFieldName){ 11791 var columnIndex = -1; 11792 if(typeof(columnIndexOrFieldName) == "string") 11793 columnIndex = ASPx.Data.ArrayIndexOf(this.listEditBase.columnFieldNames, columnIndexOrFieldName); 11794 else if(typeof(columnIndexOrFieldName) == "number") 11795 columnIndex = columnIndexOrFieldName; 11796 return this.GetColumnTextByIndex(columnIndex); 11797 }, 11798 GetColumnTextByIndex: function(columnIndex){ 11799 if(0 <= columnIndex && columnIndex < this.texts.length) 11800 return this.texts[columnIndex]; 11801 else 11802 return null; 11803 } 11804}); 11805var ListBoxScrollCallbackHelperBase = ASPx.CreateClass(null, { 11806 constructor: function(listBoxControl) { 11807 this.listBoxControl = listBoxControl; 11808 this.itemsRange = ""; 11809 this.defaultItemsRange = "0:" + (this.listBoxControl.callbackPageSize - 1); 11810 }, 11811 OnScroll: function(){ }, 11812 Reset: function(){ }, 11813 IsScrolledToTopSpacer: function(){ return false; }, 11814 IsScrolledToBottomSpacer: function(){ return false; }, 11815 GetIsNeedToHideTopSpacer: function(){ return false; }, 11816 GetIsNeedCallback: function(){ return false; }, 11817 GetIsAnySpacerVisible: function() { return false; }, 11818 GetItemsRangeForLoad: function(){ return this.defaultItemsRange; }, 11819 SetItemsRangeForLoad: function(){} 11820}); 11821var ListBoxScrollCallbackHelper = ASPx.CreateClass(ListBoxScrollCallbackHelperBase, { 11822 constructor: function(listBoxControl) { 11823 this.constructor.prototype.constructor.call(this, listBoxControl); 11824 this.isScrolledToTopSpacer = false; 11825 this.isScrolledToBottomSpacer = false; 11826 }, 11827 OnScroll: function(){ 11828 this.DetectScrollDirection(); 11829 this.ResetItemsRange(); 11830 if(this.GetIsAnySpacerVisible()) 11831 this.RecalcItemsRangeForLoad(); 11832 }, 11833 DetectScrollDirection: function(){ 11834 var listBoxControl = this.listBoxControl; 11835 var divElement = listBoxControl.GetScrollDivElement(); 11836 var scrollTop = divElement.scrollTop; 11837 var scrollBottom = divElement.scrollTop + divElement.clientHeight; 11838 var isTopSpacerVisible = listBoxControl.GetScrollSpacerVisibility(true); 11839 var isBottomSpacerVisible = listBoxControl.GetScrollSpacerVisibility(false); 11840 this.isScrolledToTopSpacer = (scrollTop < parseInt(listBoxControl.GetTopSpacersHeight())) && isTopSpacerVisible; 11841 var listHeight = this.GetListHeight(); 11842 this.isScrolledToBottomSpacer = (scrollBottom >= listBoxControl.GetTopSpacersHeight() + listHeight) && isBottomSpacerVisible; 11843 }, 11844 GetListHeight: function () { 11845 var listTable = this.listBoxControl.GetListTable(); 11846 return listTable.clientHeight; 11847 }, 11848 Reset: function(){ 11849 this.ResetItemsRange(); 11850 this.isScrolledToTopSpacer = false; 11851 this.isScrolledToBottomSpacer = false; 11852 }, 11853 ResetItemsRange: function(){ 11854 this.itemsRange = ""; 11855 }, 11856 RecalcItemsRangeForLoad: function(){ 11857 if(this.listBoxControl.isCallbackMode) { 11858 if(this.isScrolledToTopSpacer || this.isScrolledToBottomSpacer) 11859 this.SetItemsRangeForLoad(this.isScrolledToTopSpacer); 11860 } 11861 }, 11862 IsScrolledToTopSpacer: function(){ 11863 return this.isScrolledToTopSpacer; 11864 }, 11865 IsScrolledToBottomSpacer: function(){ 11866 return this.isScrolledToBottomSpacer; 11867 }, 11868 GetIsAnySpacerVisible: function(){ 11869 return this.isScrolledToTopSpacer || this.isScrolledToBottomSpacer; 11870 }, 11871 GetIsNeedCallback: function(){ 11872 return !this.GetIsItemsRangeEmpty(); 11873 }, 11874 GetIsNeedToHideTopSpacer: function(){ 11875 return this.isScrolledToTopSpacer && this.GetIsItemsRangeEmpty(); 11876 }, 11877 GetItemsRangeForLoad: function(){ 11878 return (!this.GetIsItemsRangeEmpty() ? this.itemsRange : this.defaultItemsRange); 11879 }, 11880 SetItemsRangeForLoad: function(isForTop){ 11881 var listbox = this.listBoxControl; 11882 var beginIndex = isForTop ? 11883 listbox.serverIndexOfFirstItem - listbox.callbackPageSize : 11884 listbox.serverIndexOfFirstItem + listbox.GetItemCount(); 11885 beginIndex = beginIndex < 0 ? 0 : beginIndex; 11886 var endIndex = isForTop ? 11887 listbox.serverIndexOfFirstItem - 1 : 11888 beginIndex + listbox.callbackPageSize - 1; 11889 this.itemsRange = beginIndex + ":" + endIndex; 11890 this.isScrolledToTopSpacer = isForTop; 11891 this.isScrolledToBottomSpacer = !isForTop; 11892 }, 11893 GetIsItemsRangeEmpty: function(){ 11894 return (this.itemsRange == "" || this.itemsRange == emptyItemsRange); 11895 } 11896}); 11897var ASPxClientListBoxBase = ASPx.CreateClass(ASPxClientListEdit, { 11898 constructor: function(name) { 11899 this.constructor.prototype.constructor.call(this, name); 11900 this.APILockCount = 0; 11901 this.updateSelectAllElementsLockCount = 0; 11902 this.enableSyncOnPerfCallback = false; 11903 this.scrollOnKBNavigationLockCount = 0; 11904 this.isComboBoxList = false; 11905 this.isSyncEnabled = true; 11906 this.ownerName = ""; 11907 this.selectionEventsLockCount = 0; 11908 this.syncLockCount = 0; 11909 this.encodeHtml = true; 11910 this.useCaseInsensitiveSearch = true; 11911 this.serializingHelper = null; 11912 this.deletedItems = []; 11913 this.insertedItems = []; 11914 this.itemsValue = []; 11915 this.ItemDoubleClick = new ASPxClientEvent();
11916 this.ItemClick = new ASPxClientEvent(); 11917 }, 11918 InlineInitialize: function () { 11919 ASPxClientListEdit.prototype.InlineInitialize.call(this); 11920 for(var i = 0; i < this.itemsValue.length; i++) 11921 this.itemsValue[i] = this.GetDecodeValue(this.itemsValue[i]); 11922 }, 11923 LockScrollOnKBNavigation: function(){ 11924 this.scrollOnKBNavigationLockCount++; 11925 }, 11926 UnlockScrollOnKBNavigation: function(){ 11927 this.scrollOnKBNavigationLockCount--; 11928 }, 11929 IsScrollOnKBNavigationLocked: function() { 11930 return this.scrollOnKBNavigationLockCount > 0; 11931 }, 11932 LockSelectionEvents: function(){ 11933 this.selectionEventsLockCount++; 11934 }, 11935 UnlockSelectionEvents: function(){ 11936 this.selectionEventsLockCount--; 11937 }, 11938 IsSelectionEventsLocked: function(){ 11939 return this.selectionEventsLockCount > 0; 11940 }, 11941 LockSynchronizationOnInternalCallback: function(){ 11942 if(!this.enableSyncOnPerfCallback) 11943 this.LockSynchronization(); 11944 }, 11945 UnlockSynchronizationOnInternalCallback: function (){ 11946 if(!this.enableSyncOnPerfCallback) 11947 this.UnlockSynchronization(); 11948 }, 11949 GetItemCount: function(){ 11950 return 0; 11951 }, 11952 GetItemValue: function(index){ 11953 if(0 <= index && index < this.GetItemCount()) 11954 return this.PrepareItemValue(this.itemsValue[index]); 11955 return null; 11956 }, 11957 GetItemTexts: function(item) { 11958 return item.text; 11959 }, 11960 PrepareItemValue: function(value) { 11961 return (typeof(value) == "string" && value == "" && this.convertEmptyStringToNull) ? null : value; 11962 }, 11963 LoadItemsFromCallback: function(isToTop, itemStrings){ 11964 }, 11965 SetValue: function(value){ 11966 var index = this.FindItemIndexByValue(value); 11967 this.SelectIndexSilentAndMakeVisible(index); 11968 }, 11969 FindItemIndexByText: function(text){ 11970 var transformText = function(text) { return text; }; 11971 var textIsString = typeof(text) === "string"; 11972 if(this.useCaseInsensitiveSearch && textIsString) 11973 transformText = function(text) { return text.toUpperCase(); }; 11974 text = transformText(text); 11975 for(var i = 0; i < this.GetItemCount(); i ++){ 11976 if(transformText(this.GetItem(i).text) == text) 11977 return i; 11978 } 11979 return -1; 11980 }, 11981 SelectIndex: function (index){ 11982 if(this.SelectIndexSilentAndMakeVisible(index, false)){ 11983 this.RaisePersonalStandardValidation(); 11984 this.OnValueChanged(); 11985 } 11986 }, 11987 SelectIndexSilentAndMakeVisible: function(index, lockScrollingToItem){ 11988 var selectionChanged = this.SelectIndexSilent(index); 11989 if(!this.IsScrollOnKBNavigationLocked() && !lockScrollingToItem && selectionChanged) 11990 this.MakeItemVisible(index); 11991 return selectionChanged; 11992 }, 11993 FormatText: function (texts) { 11994 return texts; 11995 }, 11996 MakeItemVisible: function(index){ 11997 }, 11998 InitOnContainerMadeVisible: function(){ 11999 }, 12000 AddItem: function(texts, value, imageUrl) { 12001 return this.AddItemInternal(this.CreateItemProperties(texts, value, imageUrl)); 12002 }, 12003 AddItemInternal: function(itemProperties) { 12004 var index = this.GetItemCount(); 12005 this.InsertItemInternal(index, itemProperties); 12006 if(!ASPx.IsExists(this.GetItem(index))) 12007 index = -1; 12008 return index; 12009 }, 12010 InsertItem: function(index, texts, value, imageUrl) { 12011 this.InsertItemInternal(index, this.CreateItemProperties(texts, value, imageUrl)); 12012 }, 12013 CreateItemProperties: function(texts, value, imageUrl, htmlContent, cssClass, tooltip) { 12014 return { 12015 texts: texts, 12016 value: value, 12017 imageUrl: imageUrl, 12018 htmlContent: htmlContent, 12019 cssClass: cssClass, 12020 tooltip: tooltip 12021 }; 12022 }, 12023 InsertItemInternal: function(index, itemProperties) { 12024 }, 12025 BeginUpdate: function(){ 12026 this.APILockCount ++; 12027 }, 12028 EndUpdate: function(){ 12029 this.APILockCount --; 12030 this.Synchronize(); 12031 }, 12032 LockUpdateSelectAllElements: function() { 12033 this.updateSelectAllElementsLockCount++; 12034 }, 12035 UnlockUpdateSelectAllElements: function () { 12036 this.updateSelectAllElementsLockCount--; 12037 }, 12038 IsUpdateSelectAllElementsLocked: function() { 12039 return this.updateSelectAllElementsLockCount > 0; 12040 }, 12041 ClearItems: function(){ 12042 this.BeginUpdate(); 12043 this.UpdateArraysItemsCleared(); 12044 this.ClearItemsCore(); 12045 this.EndUpdate(); 12046 }, 12047 ClearItemsCore: function(){ 12048 }, 12049 ClearItemsForPerformCallback: function(){ 12050 this.itemsValue = []; 12051 this.ClearItemsCore(); 12052 }, 12053 RemoveItem: function(index){ 12054 }, 12055 FindItemByText: function(text){ 12056 var index = this.FindItemIndexByText(text); 12057 return this.GetItem(index); 12058 }, 12059 FindItemByValue: function(value){ 12060 var index = this.FindItemIndexByValue(value); 12061 return this.GetItem(index); 12062 }, 12063 PerformCallback: function(arg) { 12064 }, 12065 GetCallbackArguments: function(){ 12066 var args = this.GetCustomCallbackArg(); 12067 args += this.GetLoadItemsRangeCallbackArg(); 12068 if(this.filterStrategy) 12069 args += this.filterStrategy.GetCallbackArguments(); 12070 return args; 12071 }, 12072 GetLoadItemsRangeCallbackArg: function(){ 12073 return this.GetLoadItemsRangeCallbackArgCore(this.GetItemsRangeForLoad()); 12074 }, 12075 GetLoadCustomItemsRangeCallbackArguments: function(beginIndex, endIndex, value) { 12076 var itemsRange = beginIndex + ":" + endIndex; 12077 if(ASPx.IsExists(value)) 12078 itemsRange = itemsRange + ":" + ASPx.Json.ToJson(value); 12079 var args = this.GetCustomCallbackArg(); 12080 args += this.GetLoadItemsRangeCallbackArgCore(itemsRange); 12081 return args; 12082 }, 12083 GetLoadItemsRangeCallbackArgCore: function(itemsRange) { 12084 return this.FormatCallbackArg(CONSTANTS.CALLBACK_PREFIXES.LOAD_RANGE_ITEMS, itemsRange); 12085 }, 12086 FormatCallbackArg: function(prefix, arg) { 12087 arg = arg.toString(); 12088 return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : ""); 12089 }, 12090 GetItemsRangeForLoad: function(){ 12091 return emptyItemsRange; 12092 }, 12093 GetCallbackOwnerControl: function(){ 12094 if(this.ownerName && !this.ownerControl) 12095 this.ownerControl = ASPx.GetControlCollection().Get(this.ownerName); 12096 return this.ownerControl; 12097 }, 12098 GetCustomCallbackArg: function(){ 12099 return this.stateObject["CustomCallback"]; 12100 }, 12101 SetCustomCallbackArg: function(arg){ 12102 this.UpdateStateObjectWithObject({ CustomCallback: arg }); 12103 }, 12104 FormatAndSetCustomCallbackArg: function(arg, onPerformCallback){ 12105 arg = ASPx.IsExists(arg) ? arg.toString() : ""; 12106 var formatArg = this.FormatCallbackArg(onPerformCallback ? CONSTANTS.CALLBACK_PREFIXES.CUSTOMPERFORM : CONSTANTS.CALLBACK_PREFIXES.CUSTOM, arg); 12107 this.SetCustomCallbackArg(formatArg); 12108 }, 12109 SendCallback: function(){ 12110 }, 12111 LockSynchronization: function(){ 12112 this.syncLockCount++; 12113 }, 12114 UnlockSynchronization: function(){ 12115 this.syncLockCount--; 12116 }, 12117 IsSyncLocked: function(){ 12118 return this.syncLockCount > 0; 12119 }, 12120 IsSyncEnabled: function(){ 12121 return this.isSyncEnabled && !this.IsSyncLocked(); 12122 }, 12123 RegisterInsertedItem: function(index, itemProperties){ 12124 if(this.IsSyncEnabled()){ 12125 this.RefreshSynchroArraysIndex(index, true); 12126 var item = this.CreateItem(index, itemProperties); 12127 this.insertedItems.push(item); 12128 this.Synchronize(); 12129 } 12130 }, 12131 CreateItem: function(index, itemProperties) { 12132 return new ASPxClientListBoxItem(this, index, itemProperties.texts || [itemProperties.text], itemProperties.value, itemProperties.imageUrl, 12133 itemProperties.selected, itemProperties.cellStyles, itemProperties.cellCssClasse
12133s, itemProperties.cellTooltips, itemProperties.cellAttributes, itemProperties.htmlContents, 12134 itemProperties.style, itemProperties.cssClass, itemProperties.tooltip, itemProperties.attributes, itemProperties.htmlContent); 12135 }, 12136 UpdateSyncArraysItemDeleted: function(item, isValueRemovingRequired){ 12137 if(isValueRemovingRequired) 12138 ASPx.Data.ArrayRemoveAt(this.itemsValue, item.index); 12139 if(this.IsSyncEnabled()){ 12140 var index = this.FindItemInArray(this.insertedItems, item); 12141 if(index == -1){ 12142 this.RefreshSynchroArraysIndex(item.index, false); 12143 this.deletedItems.push(item); 12144 } else { 12145 this.RefreshSynchroArraysIndex(item.index, false); 12146 ASPx.Data.ArrayRemoveAt(this.insertedItems, index); 12147 } 12148 this.Synchronize(); 12149 } 12150 }, 12151 UpdateArraysItemsCleared: function(){ 12152 if(this.IsSyncEnabled()){ 12153 for(var i = this.GetItemCount() - 1; i >= 0; i --) 12154 this.UpdateSyncArraysItemDeleted(this.GetItem(i), false); 12155 } 12156 this.itemsValue = []; 12157 }, 12158 RefreshSynchroArraysIndex: function(startIndex, isIncrease){ 12159 this.RefreshSynchroArrayIndexIndex(this.deletedItems, startIndex, isIncrease); 12160 this.RefreshSynchroArrayIndexIndex(this.insertedItems, startIndex, isIncrease); 12161 }, 12162 RefreshSynchroArrayIndexIndex: function(array, startIndex, isIncrease){ 12163 var delta = isIncrease ? 1 : -1; 12164 for(var i = 0; i < array.length; i ++){ 12165 if(array[i].index >= startIndex) 12166 array[i].index += delta; 12167 } 12168 }, 12169 FindItemInArray: function(array, item){ 12170 for(var i = array.length - 1; i >= 0; i--){ 12171 var currentItem = array[i]; 12172 if((!this.encodeHtml || currentItem.text == item.text) && currentItem.value == item.value && 12173 currentItem.imageUrl == item.imageUrl) 12174 break; 12175 } 12176 return i; 12177 }, 12178 Synchronize: function(){ 12179 if(this.APILockCount == 0){ 12180 if(this.IsSyncEnabled()){ 12181 this.SynchronizeItems(this.deletedItems, "DeletedItems"); 12182 this.SynchronizeItems(this.insertedItems, "InsertedItems"); 12183 } 12184 this.CorrectSizeByTimer(); 12185 } 12186 }, 12187 CorrectSizeByTimer: function(){ 12188 }, 12189 SynchronizeItems: function(items, syncType){ 12190 var itemsObj = { }; 12191 itemsObj[syncType] = this.SerializeItems(items); 12192 this.UpdateStateObjectWithObject(itemsObj); 12193 }, 12194 GetSerializingHelper: function(){ 12195 if(this.serializingHelper == null) 12196 this.serializingHelper = this.CreateSerializingHelper(); 12197 return this.serializingHelper; 12198 }, 12199 CreateSerializingHelper: function(){ 12200 return new ListBoxBaseItemsSerializingHelper(this); 12201 }, 12202 SerializeItems: function(items){ 12203 var serialiser = this.GetSerializingHelper(); 12204 return serialiser.SerializeItems(items); 12205 }, 12206 DeserializeItems: function(items) { 12207 return items.map(function(itemProperties, index) { 12208 return this.CreateItem(index, itemProperties); 12209 }.bind(this)); 12210 } 12211}); 12212var ListBoxBaseItemsSerializingHelper = ASPx.CreateClass(null, { 12213 constructor: function(listBoxControl) { 12214 this.listBoxControl = listBoxControl; 12215 this.startPos = 0; 12216 }, 12217 SerializeItems: function(items){ 12218 var sb = [ ]; 12219 for(var i = 0; i < items.length; i++) 12220 this.SerializeItem(sb, items[i]); 12221 return sb.join(""); 12222 }, 12223 SerializeItem: function(sb, item) { 12224 if(!item) 12225 return; 12226 this.SerializeAtomValue(sb, item.index); 12227 this.SerializeAtomValue(sb, item.value); 12228 this.SerializeAtomValue(sb, item.imageUrl); 12229 var texts = this.listBoxControl.GetItemTexts(item); 12230 if(typeof(texts) == "string") 12231 this.SerializeAtomValue(sb, texts); 12232 else { 12233 for(var i = 0; i < texts.length; i++) 12234 this.SerializeAtomValue(sb, texts[i]); 12235 } 12236 }, 12237 SerializeAtomValue: function(sb, value) { 12238 var valueStr = ASPx.IsExists(value) ? value.toString() : ""; 12239 sb.push(valueStr.length); 12240 sb.push('|'); 12241 sb.push(valueStr); 12242 }, 12243 ParseItemIndex: function(serializedItem){ 12244 return parseInt(this.ParseString(serializedItem)); 12245 }, 12246 ParseItemValue: function(serializedItem){ 12247 return this.ParseString(serializedItem); 12248 }, 12249 ParseString: function(str){ 12250 var indexOfSeparator = str.indexOf(serializingSeparator, this.startPos); 12251 var strLength = parseInt(str.substring(this.startPos, indexOfSeparator)); 12252 var strStartPos = indexOfSeparator + serializingSeparatorLength; 12253 this.startPos = strStartPos + strLength; 12254 return str.substring(strStartPos, strStartPos + strLength); 12255 }, 12256 ParseTexts: function(serializedItems){ 12257 return this.ParseString(serializedItems); 12258 }, 12259 DeserializeValues: function(serializedValues){ 12260 var deserializedValues = []; 12261 this.startPos = 0; 12262 while(this.startPos < serializedValues.length){
12263 deserializedValues.push(this.ParseItemValue(serializedValues)); 12264 } 12265 return deserializedValues; 12266 } 12267}); 12268var ListBoxItemsSerializingHelper = ASPx.CreateClass(ListBoxBaseItemsSerializingHelper, { 12269 constructor: function(listBoxControl) { 12270 this.constructor.prototype.constructor.call(this, listBoxControl); 12271 }, 12272 ParseTexts: function(serializedItems){ 12273 var textColumnCount = this.listBoxControl.GetItemTextCellCount(); 12274 return (textColumnCount > 1) ? this.DeserializeItemTexts(serializedItems, textColumnCount) 12275 : ListBoxBaseItemsSerializingHelper.prototype.ParseTexts.call(this, serializedItems); 12276 }, 12277 DeserializeItemTexts: function(serializedItem, textColumnCount){ 12278 var texts = []; 12279 for(var i = 0; i < textColumnCount; i++) 12280 texts.push(this.ParseString(serializedItem)); 12281 return texts; 12282 } 12283}); 12284var ListBoxSingleSelectionHelper = ASPx.CreateClass(null, { 12285 constructor: function(listBoxControl) { 12286 this.listBoxControl = listBoxControl; 12287 this.savedSelectedIndex = listBoxControl.savedSelectedIndex; 12288 this.updateHiddenInputsLockCount = 0; 12289 this.cachedSelectionChangedArgs = []; 12290 }, 12291 ClearSelection: function(){ 12292 this.SetSelectedIndexCore(-1); 12293 this.OnSelectionCleared(); 12294 }, 12295 OnSelectionCleared: function(){ 12296 this.cachedSelectionChangedArgs = []; 12297 }, 12298 GetSelectedIndexInternal: function(){ 12299 return this.savedSelectedIndex; 12300 }, 12301 SetSelectedIndexInternal: function(index){ 12302 this.savedSelectedIndex = index; 12303 }, 12304 SetSelectedIndexCore: function(index){ 12305 if(index != this.savedSelectedIndex && -1 <= index && index < this.GetItemCount()){ 12306 this.BeginSelectionUpdate(); 12307 this.SetSelectedIndexInternal(index); 12308 this.EndSelectionUpdate(); 12309 return true; 12310 } 12311 return false; 12312 }, 12313 GetSelectedIndex: function(){ 12314 return this.GetSelectedIndexInternal(); 12315 }, 12316 SetSelectedIndex: function(index){ 12317 this.ChangeSelectedItem(index); 12318 this.SetSelectedIndexCore(index); 12319 this.OnItemSelectionChanged(index, true); 12320 }, 12321 GetSelectedIndices: function(){ 12322 var selectedIndex = this.GetSelectedIndexInternal(); 12323 return selectedIndex != -1 ? [selectedIndex] : []; 12324 }, 12325 GetSelectedValues: function(){ 12326 var selectedValue = this.listBoxControl.GetValue(); 12327 return selectedValue != null ? [selectedValue] : []; 12328 }, 12329 GetSelectedItems: function(){ 12330 var selectedItem = this.listBoxControl.GetSelectedItem(); 12331 return selectedItem != null? [selectedItem] : []; 12332 }, 12333 SelectIndices: function(indices){}, 12334 SelectItems: function(items){}, 12335 SelectValues: function(values){}, 12336 UnselectIndices: function (selected) { this.SetSelectedIndex(-1); }, 12337 UnselectItems: function(items){}, 12338 UnselectValues: function(values){}, 12339 GetIsItemSelected: function(index){ return index == this.GetSelectedIndexInternal(); }, 12340 ResetSelectionCollectionsCache: function(){ }, 12341 OnItemClick: function(index, evt){ 12342 var selected = true; 12343 this.BeginSelectionUpdate(); 12344 this.ChangeSelectedItem(index); 12345 var selectedIndexChanged = this.SetSelectedIndexCore(index); 12346 this.EndSelectionUpdate(); 12347 if(selectedIndexChanged) 12348 this.OnItemSelectionChanged(index, selected); 12349 }, 12350 ChangeSelectedItem: function(newSelectedIndex){ 12351 var selected = true; 12352 var oldSelectedIndex = this.GetSelectedIndexInternal(); 12353 this.BeginSelectionUpdate(); 12354 this.SetItemSelectionState(oldSelectedIndex, !selected); 12355 this.SetItemSelectionState(newSelectedIndex, selected); 12356 this.EndSelectionUpdate(); 12357 }, 12358 SetItemSelectionState: function (itemIndex, selected, controller) { 12359 this.BeginSelectionUpdate(); 12360 this.listBoxControl.SetItemSelectionAppearance(itemIndex, selected, controller, true); 12361 this.EndSelectionUpdate(); 12362 }, 12363 GetFocusedIndex: function(){ 12364 return this.GetSelectedIndexInternal(); 12365 }, 12366 BeginSelectionUpdate: function(){ 12367 this.updateHiddenInputsLockCount++; 12368 }, 12369 EndSelectionUpdate: function(){ 12370 this.updateHiddenInputsLockCount--; 12371 if(!this.IsUpdateInternalSelectionStateLocked()){ 12372 this.listBoxControl.UpdateInternalState(); 12373 this.FlushSelectionChanged(); 12374 } 12375 }, 12376 IsUpdateInternalSelectionStateLocked: function(){
12377 return this.updateHiddenInputsLockCount > 0; 12378 }, 12379 GetItemCount: function(){ 12380 return this.listBoxControl.GetItemCount(); 12381 }, 12382 OnItemSelectionChanged: function(index, selected){ 12383 if(this.IsUpdateInternalSelectionStateLocked()){ 12384 var a = {Index: index, Selected: selected}; 12385 this.cachedSelectionChangedArgs.push(a); 12386 } 12387 else 12388 this.listBoxControl.OnItemSelectionChanged(index, selected); 12389 }, 12390 FlushSelectionChanged: function(){ 12391 if(this.IsUpdateInternalSelectionStateLocked()) 12392 return; 12393 for(var i = 0; i < this.cachedSelectionChangedArgs.length; i++) 12394 this.listBoxControl.OnItemSelectionChanged(this.cachedSelectionChangedArgs[i].Index, this.cachedSelectionChangedArgs[i].Selected); 12395 this.cachedSelectionChangedArgs = []; 12396 }, 12397 OnItemInserted: function(index){ 12398 if(index <= this.savedSelectedIndex && this.savedSelectedIndex != -1) 12399 this.SetSelectedIndexInternal(this.savedSelectedIndex + 1); 12400 }, 12401 OnItemRemoved: function(index){ 12402 if(index < this.savedSelectedIndex) 12403 this.SetSelectedIndexInternal( this.savedSelectedIndex - 1); 12404 else if(index == this.savedSelectedIndex) 12405 this.SetSelectedIndexInternal(-1); 12406 }, 12407 OnItemsCleared: function(){ 12408 this.ClearSelection(); 12409 } 12410}); 12411var ListBoxMultiSelectionHelper = ASPx.CreateClass(ListBoxSingleSelectionHelper, { 12412 constructor: function(listBoxControl) { 12413 this.constructor.prototype.constructor.call(this, listBoxControl); 12414 this.selectedValuesCache = []; 12415 this.selectedItemsCache = []; 12416 this.savedSelectedIndices = []; 12417 this.selectedIndicesSortingRequired = false; 12418 this.focusedIndex = -1; 12419 this.lastIndexFocusedWithoutShift = -1; 12420 }, 12421 SetSelectedIndex: function(index){ 12422 this.SingleIndexSelection(index); 12423 }, 12424 SetSelectedIndexCore: function(index){ 12425 ListBoxSingleSelectionHelper.prototype.SetSelectedIndexCore.call(this, index); 12426 this.updateSelectAllElementsState(); 12427 }, 12428 updateSelectAllElementsState: function() { 12429 this.listBoxControl.updateSelectAllElementsState(); 12430 }, 12431 ResetSelectionCollectionsCache: function(){ 12432 this.selectedIndicesSortingRequired = true; 12433 this.selectedItemsCache = []; 12434 this.selectedValuesCache = []; 12435 }, 12436 GetSelectedIndices: function(){ 12437 return this.GetSortedSelectedIndices().slice(); 12438 }, 12439 GetSortedSelectedIndices: function() { 12440 if(this.savedSelectedIndices.length > 1 && this.selectedIndicesSortingRequired) 12441 this.SortSelectedIndices(); 12442 return this.savedSelectedIndices; 12443 }, 12444 GetSelectedValues: function(){ 12445 if(this.savedSelectedIndices.length == 0) 12446 return []; 12447 if(this.selectedValuesCache.length == 0) 12448 this.selectedValuesCache = this.GetSelectedValuesCore(); 12449 return this.selectedValuesCache; 12450 }, 12451 GetSelectedValuesCore: function(){ 12452 var selectedValues = []; 12453 var selectedIndices = this.GetSortedSelectedIndices(); 12454 if(selectedIndices.length == 0) 12455 return selectedValues; 12456 for(var i = 0; i < selectedIndices.length; i++) 12457 selectedValues.push(this.listBoxControl.GetItemValue([selectedIndices[i]])); 12458 return selectedValues; 12459 }, 12460 GetSelectedItems: function(){ 12461 if(this.savedSelectedIndices.length == 0) 12462 return []; 12463 if(this.selectedItemsCache.length == 0) 12464 this.selectedItemsCache = this.GetSelectedItemsCore(); 12465 return this.selectedItemsCache; 12466 }, 12467 GetSelectedItemsCore: function(){ 12468 var selectedItems = []; 12469 for(var i = 0; i < this.savedSelectedIndices.length; i++) 12470 selectedItems.push(this.listBoxControl.GetItem(this.savedSelectedIndices[i])); 12471 return selectedItems; 12472 }, 12473 SetIndicesSelectionState: function(indices, selected){ 12474 this.BeginSelectionUpdate(); 12475 var controller = typeof(ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null; 12476 if(indices){ 12477 var itemCount = this.listBoxControl.GetItemCount(); 12478 for(var i = 0; i < indices.length; i++) { 12479 var index = indices[i]; 12480 if(index >= 0 && index < itemCount) 12481 this.SetItemSelectionState(indices[i], selected, controller); 12482 } 12483 } else if(this.IsClientFilterApplied()) 12484 this.SetAllFilteredItemsSelectionState(selected, controller); 12485 else 12486 this.SetAllItemsSelectionState(selected, controller); 12487 this.SetSelectedIndexCore(this.GetFirstSelectedIndex()); 12488 this.EndSelectionUpdate(); 12489 }, 12490 IsClientFilterApplied: function() { 12491 return this.listBoxControl.IsClientFilterApplied(); 12492 }, 12493 SetAllFilteredItemsSelectionState: function (selected, controller) { 12494 for (var i = 0; i < this.listBoxControl.GetItemCount() ; i++) { 12495 if (this.listBoxControl.IsItemFiltered && !this.listBoxControl.IsItemFiltered(i)) 12496 continue; 12497 this.SetItemSelectionState(i, selected, controller); 12498 } 12499 }, 12500 SetItemsSelectionState: function(items, selected){ 12501 var indices = items ? this.ConvertItemsToIndices(items) : null; 12502 this.SetIndicesSelectionState(indices, selected); 12503 }, 12504 SetValuesSelectionState: function(values, selected){ 12505 var indices = values ? this.ConvertValuesToIndices(values) : null; 12506 this.SetIndicesSelectionState(indices, selected); 12507 }, 12508 ConvertValuesToIndices: function(values){ 12509 var indices = []; 12510 for(var i = 0; i < values.length; i++) 12511 indices.push(this.listBoxControl.FindItemIndexByValue(values[i])); 12512 return indices; 12513 }, 12514 ConvertItemsToIndices: function(items){ 12515 var indices = []; 12516 for(var i = 0; i < items.length; i++) 12517 indices.push(items[i].index); 12518 return indices; 12519 }, 12520 SelectIndices: function(indices){ 12521 this.SetIndicesSelectionState(indices, true); 12522 }, 12523 SelectItems: function(items){ 12524 this.SetItemsSelectionState(items, true); 12525 }, 12526 SelectValues: function(values){ 12527 this.SetValuesSelectionState(values, true); 12528 }, 12529 UnselectIndices: function(indices){ 12530 this.SetIndicesSelectionState(indices, false); 12531 }, 12532 UnselectItems: function(items){ 12533 this.SetItemsSelectionState(items, false); 12534 }, 12535 UnselectValues: function(values){ 12536 this.SetValuesSelectionState(values, false); 12537 }, 12538 GetIsItemSelected: function(index){ 12539 return ASPx.Data.ArrayBinarySearch(this.GetSortedSelectedIndices(), index) > -1; 12540 }, 12541 OnItemClick: function(index, evt){ 12542 this.BeginSelectionUpdate(); 12543 var ctrlKey = evt.ctrlKey || evt.metaKey; 12544 var shift = evt.shiftKey; 12545 if(ctrlKey) 12546 this.AddSelectedIndex(index); 12547 else if(shift){ 12548 var startIndex = index > this.lastIndexFocusedWithoutShift ? this.lastIndexFocusedWithoutShift + 1 : index; 12549 var endIndex = index > this.lastIndexFocusedWithoutShift ? index : this.lastIndexFocusedWithoutShift - 1; 12550 this.SelectRangeIndicesOnly(startIndex, endIndex); 12551 this.SetFocusedIndexInternal(index, true); 12552 }else 12553 this.SingleIndexSelection(index); 12554 this.EndSelectionUpdate(); 12555 }, 12556 OnItemCheckBoxClick: function(index, evt){ 12557 this.BeginSelectionUpdate(); 12558 this.AddSelectedIndex(index); 12559 this.EndSelectionUpdate(); 12560 }, 12561 AddSelectedIndex: function(index){ 12562 this.SetFocusedIndexInternal(index, false); 12563 var indexInSelectedIndices = ASPx.Data.ArrayIndexOf(this.savedSelectedIndices, index); 12564 var selectionOperation = indexInSelectedIndices == -1; 12565 this.SetItemSelectionState(index, selectionOperation); 12566 this.SetSelectedIndexCore(this.GetFirstSelectedIndex()); 12567 }, 12568 SelectRangeIndicesOnly: function(startIndex, endIndex){ 12569 this.BeginSelectionUpdate(); 12570 var controller = typeof(ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null; 12571 var itemCount = this.GetItemCount(); 12572 for(var i = 0; i < itemCount; i ++) { 12573 if(i == this.lastIndexFocusedWithoutShift) 12574 continue; 12575 if(startIndex !== endIndex && this.listBoxControl.IsItemFiltered && !this.listBoxControl.IsItemFiltered(i)) 12576 continue; 12577 this.SetItemSelectionState(i, i >= startIndex && i <= endIndex, controller); 12578 } 12579 this.SetSelectedIndexCore(this.GetFirstSelectedIndex()); 12580 this.EndSelectionUpdate(); 12581 }, 12582 SingleIndexSelection: function(index){ 12583 this.SetFocusedIndexInternal(-1, false); 12584 this.SelectRangeIndicesOnly(index, index); 12585 this.SetFocusedIndexInternal(index, false); 12586 }, 12587 SetAllItemsSelectionState: function(selected, controller){ 12588 this.BeginSelectionUpdate(); 12589 this.savedSelectedIndices = [ ]; 12590 var itemCount = this.GetItemCount(); 12591 for (var i = 0; i < itemCount; i++) { 12592 this.SetItemSelectionStateCore(i, selected, controller); 12593 if(selected) 12594 this.PushSelectedIndex(i); 12595 this.OnItemSelectionChanged(i, selected); 12596 } 12597 this.ResetSelectionCollectionsCache(); 12598 this.EndSelectionUpdate(); 12599 }, 12600 SetItemSelectionState: function(itemIndex, selected, controller){ 12601 this.SetItemSelectionStateCore(itemIndex, selected, controller); 12602 this.ResetSelectionCollectionsCache(); 12603 var indexInSelectionArray = this.savedSelectedIndices.indexOf(itemIndex); 12604 if(selected && indexInSelectionArray == -1){ 12605 this.PushSelectedIndex(itemIndex); 12606 this.OnItemSelectionChanged(itemIndex, true); 12607 } 12608 if(!selected && indexInSelectionArray != -1){ 12609 this.RemoveSelectedIndexAt(indexInSelectionArray);
12610 this.OnItemSelectionChanged(itemIndex, false); 12611 } 12612 }, 12613 GetFirstSelectedIndex: function(){ 12614 var selectedIndices = this.GetSelectedIndices(); 12615 var selectedIndicesCount = selectedIndices.length; 12616 var firstSelectedIndex = -1; 12617 if(selectedIndicesCount > 0){ 12618 firstSelectedIndex = selectedIndices[0]; 12619 for(var i = 1; i < selectedIndices.length; i++){ 12620 if(firstSelectedIndex > selectedIndices[i]) 12621 firstSelectedIndex = selectedIndices[i]; 12622 } 12623 } 12624 return firstSelectedIndex; 12625 }, 12626 PushSelectedIndex: function(index){ 12627 this.savedSelectedIndices.push(index); 12628 }, 12629 RemoveSelectedIndex: function(index){ 12630 ASPx.Data.ArrayRemove(this.savedSelectedIndices, index); 12631 }, 12632 RemoveSelectedIndexAt: function(indexInArray){ 12633 ASPx.Data.ArrayRemoveAt(this.savedSelectedIndices, indexInArray); 12634 }, 12635 SortSelectedIndices: function(){ 12636 ASPx.Data.ArrayIntegerAscendingSort(this.savedSelectedIndices); 12637 this.selectedIndicesSortingRequired = false; 12638 }, 12639 SetItemSelectionStateCore: function(itemIndex, selected, controller){ 12640 ListBoxSingleSelectionHelper.prototype.SetItemSelectionState.call(this, itemIndex, selected, controller); 12641 }, 12642 GetFocusedIndex: function(){ 12643 return this.focusedIndex; 12644 }, 12645 SetFocusedIndexInternal: function(index, isShiftPressed){ 12646 if(!isShiftPressed) 12647 this.lastIndexFocusedWithoutShift = index; 12648 this.focusedIndex = index; 12649 }, 12650 OnItemInserted: function(index){ 12651 this.ResetSelectionCollectionsCache(); 12652 ListBoxSingleSelectionHelper.prototype.OnItemInserted.call(this, index); 12653 if(this.focusedIndex >= index) 12654 this.focusedIndex ++; 12655 for(var i = 0; i < this.savedSelectedIndices.length; i++){ 12656 if(this.savedSelectedIndices[i] >= index) 12657 this.savedSelectedIndices[i]++; 12658 } 12659 this.updateSelectAllElementsState(); 12660 }, 12661 OnItemRemoved: function(index){ 12662 this.ResetSelectionCollectionsCache(); 12663 ListBoxSingleSelectionHelper.prototype.OnItemRemoved.call(this, index); 12664 if(this.focusedIndex == index) 12665 this.focusedIndex = -1; 12666 else if(this.focusedIndex > index) 12667 this.focusedIndex --; 12668 if(this.GetIsItemSelected(index)) 12669 this.RemoveSelectedIndex(index); 12670 for(var i = 0; i < this.savedSelectedIndices.length; i++){ 12671 if(this.savedSelectedIndices[i] > index) 12672 this.savedSelectedIndices[i]--; 12673 } 12674 if(this.GetSelectedIndex() == -1) 12675 this.SetSelectedIndexCore(this.GetFirstSelectedIndex()); 12676 this.updateSelectAllElementsState(); 12677 }, 12678 ClearSelection: function(){ 12679 this.ResetSelectionCollectionsCache(); 12680 ASPx.Data.ArrayClear(this.savedSelectedIndices); 12681 this.OnSelectionCleared(); 12682 this.SetSelectedIndexCore(-1); 12683 } 12684}); 12685var CheckBoxListMultiSelectionHelper = ASPx.CreateClass(ListBoxMultiSelectionHelper, { 12686 OnItemClick: function(index){ 12687 this.BeginSelectionUpdate(); 12688 this.AddSelectedIndex(index); 12689 this.EndSelectionUpdate(); 12690 }, 12691 GetFocusedItemIndex: function(){ 12692 return this.lastIndexFocusedWithoutShift; 12693 }, 12694 updateSelectAllElementsState: function () { }, 12695 IsClientFilterApplied: function() { return false; } 12696}); 12697var ListBoxCheckSelectionHelper = ASPx.CreateClass(ListBoxMultiSelectionHelper, { 12698 OnItemClick: function(index, evt){ 12699 this.BeginSelectionUpdate(); 12700 if(evt.shiftKey) 12701 ListBoxMultiSelectionHelper.prototype.OnItemClick.call(this, index, evt); 12702 else 12703 this.AddSelectedIndex(index); 12704 this.EndSelectionUpdate(); 12705 } 12706}); 12707var ASPxClientListBox = ASPx.CreateClass(ASPxClientListBoxBase, { 12708 constructor: function(name) { 12709 this.constructor.prototype.constructor.call(this, name); 12710 this.freeUniqIndex = -1; 12711 this.isHasFakeRow = false; 12712 this.headerDiv = null; 12713 this.headerTable = null; 12714 this.listTable = null; 12715 this.sampleItemFirstTextCell = null; 12716 this.width = ""; 12717 this.defaultHeight = ""; 12718 this.hasSampleItem = false; 12719 this.hoverClasses = [""]; 12720 this.hoverCssArray = [""]; 12721 this.selectAllHoverClasses = [""]; 12722 this.selectAllHoverCssArray = [""]; 12723 this.selectAllDisabledClasses = [""]; 12724 this.selectAllDisabledCssArray = [""]; 12725 this.selectedClasses = [""]; 12726 this.selectedCssArray = [""]; 12727 this.disabledClasses = [""]; 12728 this.disabledCssArray = [""]; 12729 this.imageCellExists = false; 12730 this.scrollHandlerLockCount = 0; 12731 this.columnFieldNames = []; 12732 this.textFormatString = "";
12733 this.nullValueItemDisplayText = null; 12734 this.defaultImageUrl = ""; 12735 this.selectionMode = 0; 12736 this.initSelectedIndices = []; 12737 this.itemHorizontalAlign = ""; 12738 this.emptyTextRowCellIndices = null; 12739 this.accessibilityHelper = null; 12740 this.accessibilityHelperID = ""; 12741 this.allowMultipleCallbacks = false; 12742 this.isCallbackMode = false; 12743 this.callbackPageSize = -1; 12744 this.isTopSpacerVisible = false; 12745 this.isBottomSpacerVisible = false; 12746 this.serverIndexOfFirstItem = 0; 12747 this.scrollHelper = null; 12748 this.changeSelectAfterCallback = 0; 12749 this.ownerControl = null; 12750 this.SampleItem = null; 12751 this.sampleHeaderRow = null; 12752 this.scrollDivElement = null; 12753 this.scrollPageSize = 4; 12754 this.itemsValue = []; 12755 this.cachedValue = null; 12756 this.tempCache = new ListBoxTemporaryCache(); 12757 this.sizingConfig.adjustControl = true; 12758 this.disableScrolling = false; 12759 this.icbFocusedStyle = null; 12760 this.icbImageProperties = null; 12761 this.internalCheckBoxCollection = null; 12762 this.focusableCheckInput = null; 12763 this.nativeCheckOnFocusHandler = null; 12764 this.enableSelectAll = false; 12765 this.enableFiltering = false; 12766 this.filteringDelay = 100; 12767 this.filterMinLength = 1; 12768 this.filterTimerID = -1; 12769 this.customFilteringEditorID = ""; 12770 this.filteringTextBox = null; 12771 this.filteringTextBoxInput = null; 12772 this.showFilterButtonInput = null; 12773 this.highlighting = this.CreateHighlightingHelper(); 12774 this.hasDecoratedItems = false; 12775 this.scrollDivMinWidth = 0; 12776 this.ItemFiltering = new ASPxClientEvent(); 12777 this.CustomHighlighting = new ASPxClientEvent(); 12778 }, 12779 Initialize: function() { 12780 this.LockScrollHandler(); 12781 if(this.isCallbackMode) 12782 this.InitScrollPos(); 12783 if(ASPx.Browser.WebKitTouchUI && !this.disableScrolling) 12784 ASPx.TouchUIHelper.MakeScrollable(this.GetScrollDivElement(), {showHorizontalScrollbar: false}); 12785 this.CreateInternalCheckBoxCollection(); 12786 this.InitSelection(); 12787 if(!this.isComboBoxList) 12788 this.AdjustControlCore(); 12789 this.InitializeLoadOnDemand(); 12790 this.UnlockScrollHandler(); 12791 if(!this.HasVirtualScrolling()) 12792 this.freeUniqIndex = this.GetItemCount(); 12793 ASPxClientEdit.prototype.Initialize.call(this); 12794 if(this.NeedUnfocusableScrollDivElement()) 12795 ASPx.Attr.SetAttribute(this.GetScrollDivElement(), "tabIndex", "-1"); 12796 this.EnsureFilteringElements(); 12797 }, 12798 InitDXTextAttributes: function(){ 12799 if(this.emptyTextRowCellIndices != null){ 12800 var itemWithDXTextCount = this.emptyTextRowCellIndices.length; 12801 for(var i = 0; i < itemWithDXTextCount; i++){ 12802 var itemIndex = this.emptyTextRowCellIndices[i][0]; 12803 var cellIndices = this.emptyTextRowCellIndices[i][1]; 12804 var itemRow = this.GetItemRow(itemIndex); 12805 if(!itemRow) continue; 12806 for(var j = 0; j < cellIndices.length; j++){ 12807 ASPx.Attr.SetAttribute(itemRow.cells[cellIndices[j]], "DXText", ""); 12808 } 12809 } 12810 } 12811 }, 12812 InitSelection: function(){ 12813 var valueFromLastTime = this.GetValueFromValueInput(); 12814 if(this.MultiSelectionMode()){ 12815 if(valueFromLastTime != ""){ 12816 var serialiser = this.GetSerializingHelper(); 12817 var selectedValuesFromLastTime = serialiser.DeserializeValues(valueFromLastTime); 12818 var selectedIdicesFromLastTime = []; 12819 for(var i = 0; i < selectedValuesFromLastTime.length; i++) 12820 selectedIdicesFromLastTime.push(this.FindItemIndexByValue(selectedValuesFromLastTime[i])); 12821 this.SelectIndices(selectedIdicesFromLastTime); 12822 } else 12823 this.SelectIndices(this.initSelectedIndices); 12824 } else { 12825 var selectedIndex = (valueFromLastTime != "") ? 12826 this.FindItemIndexByValue(valueFromLastTime) : this.GetSelectedIndexInternal(); 12827 this.SetSelectedIndexInternal(selectedIndex); 12828 this.SelectIndexSilent(selectedIndex); 12829 this.GetItemSelectionHelper().SetSelectedIndexInternal(selectedIndex); 12830 } 12831 this.CacheValue(); 12832 }, 12833 BeginUpdate: function() { 12834 ASPxClientListBoxBase.prototype.BeginUpdate.call(this); 12835 if(this.isInitialized) 12836 this.itemsManager.BeginUpdate(); 12837 }, 12838 EndUpdate: function() { 12839 ASPxClientListBoxBase.prototype.EndUpdate.call(this); 12840 if(this.isInitialized) 12841 this.itemsManager.EndUpdate(); 12842 }, 12843 GetShowFilterButton: function() { 12844 return ASPx.GetControlCollection().Get(this.name + "_" + showFilterButtonID); 12845 }, 12846 GetAccessibilityHelper: function() { 12847 var result = null; 12848 if(this.accessibilityCompliant) { 12849 if(!this.accessibilityHelper) { 12850 this.accessibilityHelper = new AccessibilityHelperListBox(this); 12851 } 12852 result = this.accessibilityHelper; 12853 } 12854 return result; 12855 }, 12856 CreateHighlightingHelper: function() { 12857 return new ASPx.ListBoxHighlightingHelper(this, "em"); 12858 }, 12859 CreateInternalCheckBoxCollection: function() { 12860 if(this.IsNativeCheckBoxes() || this.internalCheckBoxCollection) 12861 return; 12862 this.internalCheckBoxCollection = new ASPx.CheckBoxInternalCollection(this.icbImageProperties, false, false, null, true, this.accessibilityCompliant); 12863 this.itemsManager.InitializeInternalCheckBoxCollection(); 12864 }, 12865 AddInternalCheckBoxToCollection: function(index) { 12866 if(!this.internalCheckBoxCollection) 12867 return; 12868 var enabled = this.GetEnabled(); 12869 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled); 12870 this.AddInternalCheckBoxToCollectionCore(index, enabled, changeEventMethod); 12871 }, 12872 AddInternalCheckBoxToCollectionCore: function(index, enabled, changeEventMethod) { 12873 var inputElement = this.GetItemCheckBoxInput(index); 12874 if(inputElement) { 12875 var internalCheckBox = this.internalCheckBoxCollection.Add(this.GetInternalCheckBoxKey(index), inputElement); 12876 internalCheckBox.CreateFocusDecoration(this.icbFocusedStyle); 12877 internalCheckBox.SetEnabled(enabled); 12878 internalCheckBox.autoSwitchEnabled = false; 12879 var checkBoxFocusableElement = this.GetCheckBoxFocusableElement(index); 12880 this.ChangeSpecialInputEnabledAttributes(checkBoxFocusableElement, changeEventMethod, true); 12881 if(this.accessibilityCompliant) { 12882 this.SetupCheckBoxAccessibilityAttributes(checkBoxFocusableElement, index); 12883 } 12884 internalCheckBox.CheckedChanged.AddHandler( 12885 function(s, e) { 12886 if(ASPx.Evt.GetKeyCode(e) == ASPx.Key.Space) { 12887 var element = ASPx.Evt.GetEventSource(e);
12888 this.GetItemSelectionHelper().OnItemCheckBoxClick(this.FindInternalCheckBoxIndex(element), e); 12889 } 12890 }.aspxBind(this) 12891 ); 12892 internalCheckBox.Focus.AddHandler( 12893 function(s, e) { 12894 var index = this.FindInternalCheckBoxIndex(s.mainElement); 12895 window.setTimeout(function() { this.MakeItemVisible(index); }.aspxBind(this),50); 12896 }.aspxBind(this) 12897 ); 12898 } 12899 }, 12900 SetupCheckBoxAccessibilityAttributes: function(checkBox, index) { 12901 if(index !== -1) { 12902 ASPx.Attr.SetAttribute(checkBox, "aria-label", this.GetAccessibilityHelper().getTextForScreenReader(this.GetItem(index))); 12903 } 12904 }, 12905 ClearInternalCheckBoxCollection: function() { 12906 if(this.internalCheckBoxCollection) 12907 this.internalCheckBoxCollection.Clear(); 12908 }, 12909 RemoveInternalCheckBoxFromCollecntion: function(index) { 12910 if(this.internalCheckBoxCollection) 12911 this.internalCheckBoxCollection.Remove(this.GetInternalCheckBoxKey(index)); 12912 }, 12913 GetInternalCheckBoxKey: function(index) { 12914 return this.name + nameSeparator + this.GetItemValue(index); 12915 }, 12916 GetInternalCheckBox: function (index) { 12917 if(this.internalCheckBoxCollection == null) 12918 this.CreateInternalCheckBoxCollection(); 12919 if(this.internalCheckBoxCollection) 12920 return this.internalCheckBoxCollection.Get(this.GetInternalCheckBoxKey(index)); 12921 return null; 12922 }, 12923 IsNativeCheckBoxes: function() { 12924 return !this.icbImageProperties; 12925 }, 12926 SetCheckBoxChecked: function(index, checked) { 12927 var checkBox = this.IsNativeCheckBoxes() ? this.GetItemCheckBoxInput(index) : this.GetInternalCheckBox(index); 12928 if(checkBox) 12929 this.SetCheckBoxCheckedCore(checkBox, checked); 12930 if(this.accessibilityCompliant) { 12931 setTimeout(function() { this.GetAccessibilityHelper().SetCheckBoxesValidationAttributes(); }.bind(this), 0); 12932 } 12933 }, 12934 SetCheckBoxCheckedCore: function (checkBox, checked) { 12935 if(this.IsNativeCheckBoxes()) 12936 checkBox.checked = checked; 12937 else 12938 checkBox.SetValue(checked ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked); 12939 }, 12940 SetCheckBoxEnabled: function (index, enabled) { 12941 var checkBox = this.IsNativeCheckBoxes() ? this.GetItemCheckBoxInput(index) : this.GetInternalCheckBox(index); 12942 if (checkBox) 12943 this.SetCheckBoxEnabledCore(checkBox, enabled); 12944 }, 12945 SetCheckBoxEnabledCore: function (checkbox, enabled) { 12946 if (this.IsNativeCheckBoxes()) { 12947 checkbox.disabled = !enabled; 12948 this.ChangeNativeCheckEnabledAttributes(checkbox, ASPx.Attr.ChangeEventsMethod(this.GetEnabled())); 12949 } 12950 else 12951 checkbox.SetEnabled(enabled); 12952 this.ChangeSpecialInputEnabledAttributes(this.IsNativeCheckBoxes() ? 12953 checkbox : checkbox.inputElement, ASPx.Attr.ChangeEventsMethod(enabled)); 12954 }, 12955 ClearItems: function() { 12956 ASPxClientListBoxBase.prototype.ClearItems.call(this); 12957 this.ClearInternalCheckBoxCollection(); 12958 this.freeUniqIndex = this.GetItemCount(); 12959 }, 12960 OnDelayedSpecialFocusMouseDown: function (evt) { 12961 if(this.filteringTextBox) { 12962 var isEventFromFilteringTextBox = ASPx.Evt.GetEventSource(evt) == this.filteringTextBox.GetInputElement(); 12963 this.filteringTextBoxInput = isEventFromFilteringTextBox ? this.filteringTextBox.GetInputElement() : null; 12964 } 12965 if(this.showFilterButton) { 12966 var isEventFromShowFilterButton = ASPx.GetIsParent(this.showFilterButton.GetMainElement(), ASPx.Evt.GetEventSource(evt)); 12967 this.showFilterButtonInput = isEventFromShowFilterButton ? this.showFilterButton.GetInternalButton() : null; 12968 this.isFilterEditorShowing = isEventFromShowFilterButton; 12969 } 12970 if(this.GetIsCheckColumnExists()) 12971 this.SetFocusableCheckInput(this.GetCheckBoxInputFromEvent(evt)); 12972 ASPxClientListBoxBase.prototype.OnDelayedSpecialFocusMouseDown.call(this, evt); 12973 var shiftPressed = evt.shiftKey; 12974 var ctrlKey = evt.ctrlKey || evt.metaKey; 12975 if(shiftPressed || ctrlKey) 12976 ASPx.Selection.Clear(); 12977 }, 12978 GetCheckBoxInputFromEvent: function(evt) { 12979 var element = ASPx.Evt.GetEventSource(evt); 12980 if(this.IsNativeCheckBoxes()) 12981 return element.type == "checkbox" ? element : null; 12982 var index = this.FindInternalCheckBoxIndex(element); 12983 if(index > -1) 12984 return this.GetCheckBoxFocusableElement(index); 12985 else if(this.IsSelectAllCheckBoxClicked(element)) 12986 return this.GetSelectAllCheckBoxFocusableElement(); 12987 return null; 12988 }, 12989 IsSelectAllCheckBoxClicked: function(eventSource) { 12990 return this.selectAllCheckBox && ASPx.GetIsParent(this.selectAllCheckBox.container, eventSource) 12991 && (eventSource == this.selectAllCheckBox.mainElement || eventSource.tagName == "LABEL"); 12992 }, 12993 IsNativeSelectAllCheckBoxClicked: function (eventSource) { 12994 return this.nativeSelectAllCheckBox && ASPx.GetIsParent(this.nativeSelectAllCheckBox, eventSource); 12995 }, 12996 GetSelectAllClickableElement: function() { 12997 return this.IsMultiColumn() ? this.selectAllMainElement.parentNode : this.selectAllMainElement; 12998 }, 12999 GetSelectAllCheckBoxFocusableElement: function() { 13000 return this.accessibilityCompliant ? this.selectAllCheckBox.mainElement : this.selectAllCheckBox.inputElement; 13001 }, 13002 GetCheckBoxFocusableElement: function(index) { 13003 var internalCheckBox = this.GetInternalCheckBox(index); 13004 if(!internalCheckBox) 13005 return null; 13006 return this.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement; 13007 }, 13008 FindInternalCheckBoxIndex: function(element) { 13009 var level = 5; 13010 while(level > 0) {
13011 var id = element.id; 13012 if(id && element.tagName == "TD" && id.slice(-1) == lbIPostfixes[0]) 13013 return this.GetItemIndexByRow(element.parentNode); 13014 element = element.parentNode; 13015 level--; 13016 } 13017 return -1; 13018 }, 13019 IsCheckBoxClicked: function(evt) { 13020 return !!this.GetCheckBoxInputFromEvent(evt); 13021 }, 13022 GetFocusableInputElement: function() { 13023 return this.showFilterButtonInput || this.filteringTextBoxInput || this.focusableCheckInput || this.GetInputElement(); 13024 }, 13025 IsElementBelongToInputElement: function (element) { 13026 return ASPxClientEdit.prototype.IsElementBelongToInputElement.call(this, element) 13027 || this.filteringTextBox && this.filteringTextBox.ownerListBox == this && this.filteringTextBox.IsElementBelongToInputElement(element); 13028 }, 13029 SetFocusableCheckInput: function(element) { 13030 this.focusableCheckInput = element; 13031 }, 13032 OnFocusCore: function() { 13033 if(this.UseDelayedSpecialFocus()) 13034 this.specialFocusTimer = ASPx.Timer.ClearTimer(this.specialFocusTimer); 13035 if(this.focused) 13036 this.UnlockFocusEvents(); 13037 else 13038 ASPxClientListBoxBase.prototype.OnFocusCore.call(this); 13039 }, 13040 OnLostFocusCore: function() { 13041 if(!this.IsFocusEventsLocked()) { 13042 this.SetFocusableCheckInput(null); 13043 this.filteringTextBoxInput = null; 13044 this.showFilterButtonInput = null; 13045 } 13046 ASPxClientListBoxBase.prototype.OnLostFocusCore.call(this); 13047 }, 13048 IsFocusEventsLocked: function() { 13049 var result = ASPxClientEdit.prototype.IsFocusEventsLocked.call(this) || 13050 this.IsInternalFilteringTextBoxFocusEventsLocked() || 13051 this.isFilterEditorShowing; 13052 if(this.accessibilityCompliant) 13053 result = this.focused && (result || this.HasInternalFilteringTextBoxFocus()); 13054 return result; 13055 }, 13056 HasInternalFilteringTextBoxFocus: function() { 13057 return !this.customFilteringEditorID && this.filteringTextBox && ASPx.GetIsParent(this.filteringTextBox.GetMainElement(), ASPx.GetActiveElement()); 13058 }, 13059 IsInternalFilteringTextBoxFocusEventsLocked: function() { 13060 return !this.customFilteringEditorID && this.filteringTextBox && this.filteringTextBox.IsFocusEventsLocked(); 13061 }, 13062 ForceLockFocusEvents: function() { 13063 this.focusEventsLocked = true; 13064 }, 13065 GetValueFromValueInput: function(){ 13066 var valueInput = this.FindStateInputElement(); 13067 if(ASPx.IsExistsElement(valueInput)) 13068 return valueInput.value; 13069 return ""; 13070 }, 13071 NeedUnfocusableScrollDivElement: function() { 13072 return ASPx.Browser.Firefox; 13073 }, 13074 GetInitSelectedIndex: function(){ 13075 return this.savedSelectedIndex; 13076 }, 13077 CacheValue: function(){ 13078 this.cachedValue = this.GetValue(); 13079 }, 13080 InitScrollPos: function() { 13081 if(!this.isComboBoxList && this.GetInitSelectedIndex() == -1) 13082 this.GetScrollDivElement().scrollTop = 0; 13083 }, 13084 InitializeLoadOnDemand: function(){ 13085 var loadOnDemandRequired = this.isCallbackMode && this.GetEnabledByServer(); 13086 this.scrollHelper = this.CreateScrollHelper(loadOnDemandRequired); 13087 }, 13088 CreateScrollHelper: function (loadOnDemandRequired) { 13089 if (loadOnDemandRequired) 13090 return new ListBoxScrollCallbackHelper(this); 13091 return new ListBoxScrollCallbackHelperBase(this); 13092 }, 13093 HasVirtualScrolling: function() { return !!this.itemsInfo || this.itemsManager instanceof ListBoxItemsVirtualManager; }, 13094 CreateItemsManager: function() { 13095 if (this.HasVirtualScrolling()) { 13096 var manager = new ListBoxItemsVirtualManager(this); 13097 manager.InitializeItems(this.itemsInfo, this.itemsValue); 13098 delete this.itemsInfo; 13099 return manager; 13100 } 13101 return new ListBoxItemsDefaultManager(this); 13102 }, 13103 CreateStateControllerManager: function() { 13104 var result = null; 13105 if(this.HasVirtualScrolling()) { 13106 result = this.CreateVirtualRenderStateControllerManager(); 13107 } 13108 else { 13109 result = this.CreateDefaultRenderStateControllerManager(); 13110 } 13111 return result; 13112 }, 13113 CreateVirtualRenderStateControllerManager: function() { 13114 return new VirtualRenderListBoxStateControllerManager(this, this.itemsManager); 13115 }, 13116 CreateDefaultRenderStateControllerManager: function() { 13117 return new DefaultListBoxStateControllerManager(this); 13118 }, 13119 InlineInitialize: function(){ 13120 if(this.HasVirtualScrolling()) 13121 this.freeUniqIndex = 0; 13122 this.itemsManager = this.CreateItemsManager(); 13123 this.stateControllerManager = this.CreateStateControllerManager(); 13124 this.filterStrategy = this.isComboBoxList ? null : this.CreateFilterStrategy(); 13125 this.EnsureFixWidthRow(); 13126 this.InitializeNativeCheckHandlers(); 13127 this.LockScrollHandler(); 13128 this.InitializeItemsAttributes(); 13129 this.InitDXTextAttributes(); 13130 this.stateControllerManager.Initialize(); 13131 this.itemsManager.Initialize(); 13132 this.AddSelectAllStateItems(true); 13133 this.UnlockScrollHandler(); 13134 if(this.NeedToHandleCellWidth()) { 13135 var headerTable = this.GetHeaderTableElement(); 13136 var firstHeaderRow = !!headerTable && headerTable.rows[0]; 13137 this.CorrectCellNullWidthStyle(firstHeaderRow); 13138 this.CorrectCellNullWidthStyle(this.itemsManager.GetFirstVisibleItemRow()); 13139 } 13140 ASPxClientListBoxBase.prototype.InlineInitialize.call(this); 13141 this.EnsureSelectAllElements(); 13142 }, 13143 IsItemVisible: function(index) { 13144 return this.itemsManager.IsItemVisible(index); 13145 }, 13146 UseSpecialKeyboardHandling: function() { 13147 return true; 13148 }, 13149 GetItemIndexByInsertionOrder: function (itemIndex) { 13150 return this.HasVirtualScrolling() ? this.GetItem(itemIndex).insertOrderIndex : this.FindFreeIndex(); 13151 }, 13152 InsertItemRow: function (index, itemProperties) { 13153 var newItemRow = this.itemsManager.CreateNewItemRow(index); 13154 ASPx.Attr.RemoveAttribute(newItemRow, "id"); 13155 var listTable = this.GetListTable(); 13156 var tbody = this.GetTableRowParent(listTable); 13157 var rowBeforeNewItemRow = this.GetListTableRowBeforeNewItemRow(index, listTable); 13158 var scrollDiv = this.GetScrollDivElement(); 13159 var oldScrollTop = scrollDiv.scrollTop; 13160 if(rowBeforeNewItemRow) 13161 tbody.insertBefore(newItemRow, rowBeforeNewItemRow); 13162 else 13163 tbody.appendChild(newItemRow); 13164 if(ASPx.Browser.Firefox && scrollDiv.scrollTop != oldScrollTop) 13165 scrollDiv.scrollTop = oldScrollTop; 13166 var newIndex = this.GetItemIndexByInsertionOrder(index); 13167 var newId = this.CreateItemId(newIndex); 13168 var newClientId = this.CreateItemClientId(newIndex); 13169 this.InitializeItemAttributes(newItemRow, newClientId, true); 13170 this.AddStateControllerClasses(newId); 13171 this.PrepareItem(newItemRow, itemProperties); 13172 if (this.needUnselectableItemRows) 13173 this.SetItemRowUnselectable(newItemRow); 13174 if (this.GetIsCheckColumnExists() && !this.IsNativeCheckBoxes()) { 13175 if (!this.internalCheckBoxCollection) 13176 this.CreateInternalCheckBoxCollection(); 13177 this.AddInternalCheckBoxToCollection(index); 13178 } 13179 }, 13180 RemoveItemRow: function (index) { 13181 if (this.GetIsCheckColumnExists() && !this.IsNativeCheckBoxes()) 13182 this.RemoveInternalCheckBoxFromCollecntion(index); 13183 var row = this.GetItemRow(index); 13184 if (ASPx.IsExistsElement(row)) { 13185 var firstCellId = this.GetItemElement(index).id; 13186 var itemId = firstCellId.match(/LBI\d+/)[0]; 13187 this.RemoveStateControllerClasses(itemId); 13188 row.parentNode.removeChild(row);
13189 } 13190 }, 13191 SetItemRowsUnselectable: function() { 13192 var count = this.GetItemCount(); 13193 for (var i = 0; i < count; i++) { 13194 var itemRow = this.GetItemRow(i); 13195 if (itemRow) 13196 this.SetItemRowUnselectable(itemRow); 13197 } 13198 this.needUnselectableItemRows = true; 13199 }, 13200 SetItemRowUnselectable: function (itemRow) { 13201 for (var j = 0; j < itemRow.cells.length; j++) 13202 ASPx.Selection.SetElementAsUnselectable(itemRow.cells[j], true); 13203 }, 13204 GetInactiveFilterElementClassName: function() { 13205 return inactiveFilterElementClassName; 13206 }, 13207 GetAnimatedFilterElementClassName: function() { 13208 return "dxeLBAnimatedFilterPanelSys"; 13209 }, 13210 GetCompactViewFilterAdjacentScrollDivSelector: function() { 13211 return "*[class*=\"dxeListBoxFilter\"]:not(.dxeLBInactiveFilterPanelSys) + *[class*=\"dxeListBoxSelectAll\"] + .dxlbd"; 13212 }, 13213 GetCompactViewInactiveFilterAdjacentScrollDivSelector: function() { 13214 return ".dxeLBInactiveFilterPanelSys + *[class*=\"dxeListBoxSelectAll\"] + .dxlbd"; 13215 }, 13216 EnsureFilteringElements: function () { 13217 if(this.enableFiltering) { 13218 this.EnsureFilteringTextBox(); 13219 if(!this.customFilteringEditorID) { 13220 this.filterMainElement = this.GetChildElement(filterMainElementID); 13221 this.showFilterButton = this.GetShowFilterButton(); 13222 if(this.showFilterButton) { 13223 this.showFilterButton.ownerListBox = this; 13224 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled()); 13225 var showFilterButtonInternalButton = this.showFilterButton.GetInternalButton(); 13226 if(showFilterButtonInternalButton) 13227 this.ChangeSpecialInputEnabledAttributes(showFilterButtonInternalButton, changeEventMethod, true); 13228 this.showFilterButton.SetEnabled(this.GetEnabled()); 13229 this.UpdateFilterButtonHeight(); 13230 this.UpdateShowHideFilterElementCssRules(); 13231 } 13232 } 13233 } 13234 }, 13235 CreateFilterStrategy: function() { 13236 if(this.enableFiltering) 13237 return new ListBoxFilterStrategy(this); 13238 return new ListEditFilterStrategyBase(); 13239 }, 13240 UpdateShowHideFilterElementCssRules: function() { 13241 var scrollDiv = this.GetScrollDivElement(); 13242 var scrollDivClientHeight = scrollDiv.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(scrollDiv); 13243 var filterMainElementOffsetHeight = this.GetFilterMainElementHeight(); 13244 if (ASPx.GetElementVisibility(this.filteringTextBox.GetMainElement(), true)) 13245 scrollDivClientHeight += filterMainElementOffsetHeight; 13246 var showHideFilterStyle = this.EnsureShowHideFilterStyle(); 13247 var mainElementSelector = "#" + this.name; 13248 var styleContent = [ 13249 mainElementSelector + " " + this.GetCompactViewFilterAdjacentScrollDivSelector() 13250 + " { max-height: " + (scrollDivClientHeight - filterMainElementOffsetHeight) + "px; }", 13251 mainElementSelector + " " + this.GetCompactViewInactiveFilterAdjacentScrollDivSelector() 13252 + " { max-height: " + scrollDivClientHeight + "px; }" 13253 ]; 13254 showHideFilterStyle.innerHTML = styleContent.join('\n'); 13255 }, 13256 EnsureShowHideFilterStyle: function() { 13257 if(!this.showHideFilterStyle) { 13258 this.showHideFilterStyle = this.FindShowHideFilterStyle(); 13259 if(!this.showHideFilterStyle) { 13260 this.showHideFilterStyle = document.createElement('style'); 13261 this.showHideFilterStyle.id = this.GetShowHideFilterStyleID(); 13262 ASPx.Attr.AppendStyleType(this.showHideFilterStyle); 13263 document.getElementsByTagName('head')[0].appendChild(this.showHideFilterStyle); 13264 } 13265 } 13266 return this.showHideFilterStyle; 13267 }, 13268 FindShowHideFilterStyle: function() { 13269 return ASPx.GetChildById(document.getElementsByTagName('head')[0], this.GetShowHideFilterStyleID()); 13270 }, 13271 GetShowHideFilterStyleID: function() { 13272 return this.name + "ShowHideFilterStyle"; 13273 }, 13274 GetFilterMainElementHeight: function() { 13275 if(!this.filterMainElementHeight) { 13276 var filteringTextBoxClone = this.filteringTextBox.GetMainElement().cloneNode(true); 13277 filteringTextBoxClone.style.position = "absolute"; 13278 filteringTextBoxClone.style.visibility = "hidden"; 13279 document.body.appendChild(filteringTextBoxClone); 13280 this.filterMainElementHeight = filteringTextBoxClone.offsetHeight;
13281 document.body.removeChild(filteringTextBoxClone); 13282 var filterMainElementClone = this.filterMainElement.cloneNode(false); 13283 filterMainElementClone.style.position = "absolute"; 13284 filterMainElementClone.style.visibility = "hidden"; 13285 ASPx.RemoveClassNameFromElement(filterMainElementClone, this.GetInactiveFilterElementClassName()); 13286 ASPx.RemoveClassNameFromElement(filterMainElementClone, this.GetAnimatedFilterElementClassName()); 13287 document.body.appendChild(filterMainElementClone); 13288 this.filterMainElementHeight += ASPx.GetTopBottomBordersAndPaddingsSummaryValue(filterMainElementClone); 13289 document.body.removeChild(filterMainElementClone); 13290 } 13291 return this.filterMainElementHeight; 13292 }, 13293 RemoveShowHideFilterCssRules: function () { 13294 var showHideFilterStyle = this.FindShowHideFilterStyle(); 13295 if(showHideFilterStyle) 13296 showHideFilterStyle.innerHTML = ""; 13297 }, 13298 UpdateFilterButtonHeight: function() { 13299 setTimeout(function () { 13300 this.showFilterButton.SetHeight(this.selectAllMainElement.offsetHeight - ASPx.GetVerticalBordersWidth(this.selectAllMainElement)); 13301 }.aspxBind(this), 0); 13302 }, 13303 EnsureFilteringTextBox: function() { 13304 this.filteringTextBox = this.FindFilteringTextBox(); 13305 if(this.filteringTextBox) { 13306 this.filteringTextBox.UserInput.AddHandler(this.filterStrategy.OnInput.bind(this.filterStrategy)); 13307 if(!this.customFilteringEditorID) { 13308 this.filteringTextBox.ownerListBox = this; 13309 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled()); 13310 this.ChangeSpecialInputEnabledAttributes(this.filteringTextBox.GetInputElement(), changeEventMethod, true); 13311 this.filteringTextBox.SetEnabled(this.GetEnabled()); 13312 this.filteringTextBox.KeyDown.AddHandler(function(sender, args) { 13313 if(ASPx.Evt.GetKeyCode(args.htmlEvent) === ASPx.Key.Esc) 13314 sender.GetInputElement().value = ""; 13315 }); 13316 } 13317 } 13318 }, 13319 FindFilteringTextBox: function() { 13320 var actualFilteringTextBoxID = this.customFilteringEditorID ? this.customFilteringEditorID : this.name + "_" + filteringTextBoxID; 13321 return ASPx.GetControlCollection().Get(actualFilteringTextBoxID); 13322 }, 13323 CollectionChanged: function(isFiltering) { 13324 if(isFiltering) 13325 this.itemsManager.OnEndItemsFiltering(); 13326 }, 13327 ChangeItemsFilteredState: function(action) { 13328 this.itemsManager.ChangeItemsFilteredState(action); 13329 }, 13330 RewriteFilteredItemIndices: function (newFilteredItemIndices) { 13331 this.itemsManager.RewriteFilteredItemIndices(newFilteredItemIndices); 13332 }, 13333 BeforeClientFiltering: function () { 13334 this.itemsManager.BeforeClientFiltering(); 13335 }, 13336 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) { 13337 this.itemsManager.ApplyFilterToItem(index, isSatisfy, savePrevState, isFilterReset); 13338 }, 13339 RestorePrevFilteredState: function (index) { 13340 this.itemsManager.RestorePrevFilteredState(index); 13341 }, 13342 IsItemFiltered: function (index) { 13343 return this.itemsManager.IsItemFiltered(index); 13344 }, 13345 IsClientFilterApplied: function() { 13346 return !this.isComboBoxList && this.filterStrategy.filter != "" && !this.isCallbackMode; 13347 }, 13348 MakeAllItemsVisible: function () { 13349 this.itemsManager.MakeAllItemsVisible(); 13350 }, 13351 ShowFilterElement: function() { 13352 ASPx.RemoveClassNameFromElement(this.filterMainElement, this.GetInactiveFilterElementClassName()); 13353 this.showFilterButton.SetVisible(false); 13354 if(ASPx.Browser.VirtualKeyboardSupported) { 13355 this.ReplaceFilteringTextBoxShowNullTextOnFocusFunction(); 13356 this.isFilterEditorShowing = false; 13357 this.filteringTextBox.GetInputElement().focus(); 13358 } 13359 else 13360 setTimeout(function () { 13361 this.isFilterEditorShowing = false; 13362 this.filteringTextBox.GetInputElement().focus(); 13363 }.aspxBind(this), 200); 13364 }, 13365 HideFilterElement: function () { 13366 ASPx.AddClassNameToElement(this.filterMainElement, this.GetInactiveFilterElementClassName()); 13367 this.showFilterButton.SetVisible(true); 13368 this.UpdateFilterButtonHeight(); 13369 this.CorrectHeight(true); 13370 setTimeout(function () { 13371 this.filteringTextBox.UnlockFocusEvents(); 13372 this.showFilterButton.GetInternalButton().focus(); 13373 }.aspxBind(this), 0); 13374 }, 13375 ReplaceFilteringTextBoxShowNullTextOnFocusFunction: function () { 13376 if(this.filteringTextBox.nullTextDisplayMode === ASPx.NullTextDisplayMode.UnfocusedAndFocused) { 13377 var origin = this.filteringTextBox.ensureActivateFocusedNullTextMechanism; 13378 var filteringTextBox = this.filteringTextBox; 13379 this.filteringTextBox.ensureActivateFocusedNullTextMechanism = function() { 13380 setTimeout(function() { 13381 origin.call(filteringTextBox); 13382 filteringTextBox.ensureActivateFocusedNullTextMechanism = origin; 13383 setTimeout(function () { 13384 if(filteringTextBox.isFocusedNullTextElementDisplayed()) 13385 filteringTextBox.adjustFocusedNullTextElement(); 13386 }, 300); 13387 }, 400); 13388 }; 13389 } 13390 }, 13391 EnsureSelectAllElements: function () { 13392 if(this.enableSelectAll && !this.selectAllMainElement) { 13393 this.EnsureSelectAllCheckElement(); 13394 this.selectAllMainElement = this.GetChildElement(selectAllMainElementID); 13395 var selectAllClickableElement = this.GetSelectAllClickableElement(); 13396 ASPx.Evt.AttachEventToElement(selectAllClickableElement, "click", this.onSelectAllClickableElementClick.bind(this)); 13397 } 13398 }, 13399 EnsureSelectAllCheckElement: function () { 13400 var selectAllCheckBoxInput = null; 13401 if(!this.IsNativeCheckBoxes()) { 13402 this.CreateSelectAllCheckBox(); 13403 selectAllCheckBoxInput = this.GetSelectAllCheckBoxFocusableElement(); 13404 } 13405 else { 13406 this.nativeSelectAllCheckBox = this.GetChildElement(selectAllCheckBoxID + "_I"); 13407 this.nativeSelectAllCheckBox.disabled = !this.GetEnabled(); 13408 selectAllCheckBoxInput = this.nativeSelectAllCheckBox; 13409 } 13410 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled()); 13411 this.ChangeSpecialInputEnabledAttributes(selectAllCheckBoxInput, changeEventMethod, true); 13412 }, 13413 CreateSelectAllCheckBox: function () { 13414 var selectAllCheckBoxElement = this.GetChildElement(selectAllCheckBoxID); 13415 var selectAllCheckBoxInputElement = this.GetChildElement(selectAllCheckBoxID + "_S"); 13416 var selectAllStateController = ASPx.CheckableElementStateController.Create(this.icbImageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked, CheckBoxInputKey.Indeterminate, true); 13417 this.selectAllCheckBox = new ASPx.CheckBoxInternal(selectAllCheckBoxInputElement, selectAllStateController, true, false, 13418 ASPx.CheckEditElementHelper.Instance, selectAllCheckBoxElement, true, undefined, undefined, this.accessibilityCompliant); 13419 this.selectAllCheckBox.CreateFocusDecoration(this.icbFocusedStyle); 13420 this.selectAllCheckBox.SetEnabled(this.GetEnabled()); 13421 this.selectAllCheckBox.GetReadOnly = this.GetReadOnly.bind(this); 13422 this.selectAllCheckBox.CheckedChanged.AddHandler(this.onSelectAll.as
13422pxBind(this)); 13423 if(ASPx.Browser.WebKitFamily) 13424 ASPx.Evt.AttachEventToElement(this.selectAllCheckBox.mainElement.parentNode, "selectstart", ASPx.Evt.PreventEventAndBubble); 13425 }, 13426 onSelectAllClickableElementClick: function (evt) { 13427 if (!this.GetEnabled() || this.GetReadOnly()) { 13428 if (this.IsNativeCheckBoxes() || this.isNative) 13429 ASPx.Evt.PreventEvent(evt); 13430 return false; 13431 } 13432 if(this.IsSelectAllCheckBoxClicked(ASPx.Evt.GetEventSource(evt))) 13433 return; 13434 if(!this.IsNativeSelectAllCheckBoxClicked(ASPx.Evt.GetEventSource(evt))) { 13435 var currentCheckState = this.getSelectAllCheckElementState(); 13436 var newCheckState = currentCheckState != ASPx.CheckBoxCheckState.Checked ? 13437 ASPx.CheckBoxCheckState.Checked : ASPx.CheckBoxCheckState.Unchecked; 13438 this.updateSelectAllCheckElementState(newCheckState); 13439 } 13440 this.onSelectAll(); 13441 }, 13442 onSelectAll: function () { 13443 this.LockUpdateSelectAllElements(); 13444 var selectAllCheckState = this.getSelectAllCheckElementState(); 13445 this.onSelectAllCore(selectAllCheckState); 13446 this.UnlockUpdateSelectAllElements(); 13447 }, 13448 onSelectAllCore: function (currentCheckState) { 13449 var toSelect = currentCheckState == ASPx.CheckBoxCheckState.Checked; 13450 var valueBeforeSelectAll = this.GetValue(); 13451 var selectionBeforeSelectAll = this.GetValueFromValueInput(); 13452 if (toSelect) 13453 this.SelectAll(); 13454 else 13455 this.UnselectAll(); 13456 if(selectionBeforeSelectAll !== this.GetValueFromValueInput()) 13457 this.OnItemSelectionChanged(-1, toSelect, true, valueBeforeSelectAll !== this.GetValue()); 13458 }, 13459 getSelectAllCheckElementState: function () { 13460 if(this.selectAllCheckBox) 13461 return this.selectAllCheckBox.GetCurrentCheckState(); 13462 if(this.nativeSelectAllCheckBox) 13463 return this.nativeSelectAllCheckBox.checked ? ASPx.CheckBoxCheckState.Checked : ASPx.CheckBoxCheckState.Unchecked; 13464 return null; 13465 }, 13466 updateSelectAllCheckElementState: function (checkState) { 13467 if(this.selectAllCheckBox) { 13468 var checkValue = this.selectAllCheckBox.stateController.GetValueByCheckState(checkState); 13469 this.selectAllCheckBox.SetValue(checkValue, !this.isInitialized); 13470 } else if(this.nativeSelectAllCheckBox) 13471 this.nativeSelectAllCheckBox.checked = checkState === ASPx.CheckBoxCheckState.Checked; 13472 }, 13473 updateSelectAllElementsState: function() { 13474 if(!this.IsUpdateSelectAllElementsLocked() && this.enableSelectAll) { 13475 this.EnsureSelectAllElements(); 13476 this.updateSelectAllElementsStateCore(); 13477 } 13478 }, 13479 updateSelectAllElementsStateCore: function() { 13480 var selectAllCheckState = ASPx.CheckBoxCheckState.Unchecked; 13481 var isFilteredSelectedItemFound = false; 13482 var isFilteredUnselectedItemFound = false; 13483 var itemCount = this.GetItemCount(); 13484 for(var i = 0; i < itemCount; i++) { 13485 if(this.IsItemFiltered(i)) { 13486 if(this.GetIsItemSelected(i)) 13487 isFilteredSelectedItemFound = true; 13488 else 13489 isFilteredUnselectedItemFound = true; 13490 } 13491 if (isFilteredSelectedItemFound && isFilteredUnselectedItemFound) { 13492 selectAllCheckState = ASPx.CheckBoxCheckState.Indeterminate; 13493 break; 13494 } 13495 if(i == itemCount - 1 && isFilteredSelectedItemFound && !isFilteredUnselectedItemFound) 13496 selectAllCheckState = ASPx.CheckBoxCheckState.Checked; 13497 } 13498 this.updateSelectAllCheckElementState(selectAllCheckState); 13499 }, 13500 changeSelectAllElementsEnabledState: function(enabled) { 13501 var selectAllCheckBoxInput = null; 13502 if(this.selectAllCheckBox) { 13503 this.selectAllCheckBox.SetEnabled(enabled); 13504 selectAllCheckBoxInput = this.GetSelectAllCheckBoxFocusableElement(); 13505 } 13506 else if(this.nativeSelectAllCheckBox) { 13507 this.nativeSelectAllCheckBox.disabled = !enabled; 13508 selectAllCheckBoxInput = this.nativeSelectAllCheckBox; 13509 } 13510 if(selectAllCheckBoxInput) { 13511 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled); 13512 this.ChangeSpecialInputEnabledAttributes(selectAllCheckBoxInput, changeEventMethod, true); 13513 } 13514 ASPx.GetStateController().SetElementEnabled(this.selectAllMainElement, enabled); 13515 }, 13516 NeedToHandleCellWidth: function() { 13517 return this.IsMultiColumn() && (ASPx.Browser.Firefox || ASPx.Browser.Edge); 13518 }, 13519 CorrectCellNullWidthStyle: function(row) { 13520 if(!row) return; 13521 var cellCount = row.cells.length; 13522 for(var i = 0; i < cellCount; i++) { 13523 var cellStyle = !!window.getComputedStyle ? window.getComputedStyle(row.cells[i]) : ASPx.GetCurrentStyle(row.cells[i]); 13524 var originalWidth = parseInt(cellStyle.width); 13525 var needToApply = originalWidth === 0 || originalWidth <= ASPx.PxToInt(cellStyle.paddingLeft) || originalWidth <= ASPx.PxToInt(cellStyle.paddingRight); 13526 var action = needToApply ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement; 13527 action(row.cells[i], NullSizeCellClassName); 13528 } 13529 }, 13530 InitializeNativeCheckHandlers: function() { 13531 this.nativeCheckOnFocusHandler = function(evt) { 13532 this.SetFocusableCheckInput(ASPx.Evt.GetEventSource(evt)); 13533 }.aspxBind(this); 13534 }, 13535 ChangeNativeCheckEnabledAttributes: function(element, method) { 13536 if(this.nativeCheckOnFocusHandler) 13537 method(element, "focus", this.nativeCheckOnFocusHandler); 13538 }, 13539 InitializeItemsAttributes: function() { 13540 var listTable = this.GetListTable(); 13541 if(this.isHasFakeRow){ 13542 this.LockSynchronization(); 13543 this.ClearItems();
13544 this.UnlockSynchronization(); 13545 } 13546 listTable.ListBoxId = this.name; 13547 var rowIdConst = this.name + "_"; 13548 if(this.hasSampleItem) 13549 this.InitializeItemAttributes(this.GetSampleItemRow(), rowIdConst + lbSIIdSuffix); 13550 if(!this.HasVirtualScrolling()) { 13551 rowIdConst += lbIIdSuffix; 13552 var count = this.GetItemCount(); 13553 if(this.HasAccessibilityHeaderRow()) 13554 count--; 13555 for (var i = 0; i < count; i++) 13556 this.InitializeItemAttributes(this.GetItemRow(i), rowIdConst + i); 13557 } 13558 var rows = listTable.rows; 13559 if(this.HasAccessibilityHeaderRow() && rows[rows.length - 1]) 13560 rows[rows.length - 1].id = this.GetAccessibilityHeaderRowID(); 13561 }, 13562 InitializeItemAttributes: function(row, rowId) { 13563 var cells = row.cells; 13564 var itemCellsIdSuffixes = this.GetItemCellsIdPostfixes(); 13565 for(var i = 0; i < row.cells.length; i++) { 13566 cells[i].style.textAlign = this.itemHorizontalAlign; 13567 cells[i].id = rowId + itemCellsIdSuffixes[i]; 13568 } 13569 if(this.GetIsCheckColumnExists() && this.IsNativeCheckBoxes() && rowId != this.GetSampleItemRowID()) { 13570 var input = this.GetItemCheckBoxInput(this.GetItemIndexByRow(row)); 13571 this.ChangeNativeCheckEnabledAttributes(input, ASPx.Attr.ChangeEventsMethod(this.GetEnabled())); 13572 this.ChangeSpecialInputEnabledAttributes(input, ASPx.Attr.ChangeEventsMethod(this.GetEnabled())); 13573 } 13574 }, 13575 InitializePageSize: function(){ 13576 var divElement = this.GetScrollDivElement(); 13577 var count = this.GetItemCount(); 13578 if (divElement && count > 0) { 13579 var firstVisibleRow = this.itemsManager.GetFirstVisibleItemRow(); 13580 if(firstVisibleRow) 13581 this.scrollPageSize = Math.round(divElement.clientHeight / firstVisibleRow.offsetHeight) - 1; 13582 } 13583 }, 13584 AddSelectAllStateItems: function(isInitialization) { 13585 if (this.enableSelectAll && typeof (ASPx.GetStateController) !== "undefined") { 13586 var stateController = ASPx.GetStateController(); 13587 var name = this.name + "_" + selectAllMainElementID; 13588 if (!isInitialization) 13589 this.ClearStateItemCache(stateController, name, [""]); 13590 stateController.AddHoverItem(name, this.selectAllHoverClasses, this.selectAllHoverCssArray, "", null, null, true); 13591 stateController.AddDisabledItem(name, this.selectAllDisabledClasses, this.selectAllDisabledCssArray, "", null, null, true); 13592 } 13593 }, 13594 RemoveSelectAllStateItems: function() { 13595 if (this.enableSelectAll && typeof (ASPx.GetStateController) !== "undefined") { 13596 var stateController = ASPx.GetStateController(); 13597 var name = this.name + "_" + selectAllMainElementID; 13598 this.ClearStateItemCache(stateController, name, [""]); 13599 stateController.RemoveHoverItem(name, ""); 13600 stateController.RemoveDisabledItem(name, ""); 13601 } 13602 }, 13603 ClearStateItemCache: function(stateController, name, suffixes) { 13604 for (var i = 0; i < suffixes.length; i++) { 13605 var element = document.getElementById(name + suffixes[i]); 13606 var elements = ASPx.GetNodes(element); 13607 elements.push(element); 13608 ASPx.Data.ForEach(elements, stateController.ClearElementCache.bind(stateController)); 13609 } 13610 }, 13611 AfterInitialize: function() { 13612 if(this.disableScrolling) { 13613 var scrollDiv = this.GetScrollDivElement(); 13614 var mainElement = this.GetMainElement(); 13615 var listTable = this.GetListTable(); 13616 scrollDiv.style.height = mainElement.style.height = (listTable 13617 ? ASPx.GetClearClientHeight(listTable) 13618 : this.GetListTableHeight() - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement)) + "px"; 13619 } 13620 this.CallbackSpaceInit(true); 13621 ASPxClientListBoxBase.prototype.AfterInitialize.call(this); 13622 }, 13623 GetEnabledByServer: function(){ 13624 return this.enabled; 13625 }, 13626 SetEnabled: function(enabled){ 13627 ASPxClientListBoxBase.prototype.SetEnabled.call(this, enabled); 13628 this.CallbackSpaceInit(false); 13629 }, 13630 SetReadOnlyInternal: function(readOnly) { 13631 ASPxClientListBoxBase.prototype.SetReadOnlyInternal.call(this, readOnly); 13632 if (readOnly) { 13633 this.RemoveSelectAllStateItems(); 13634 this.stateControllerManager.RemoveHoverStateItem(); 13635 } 13636 else { 13637 this.AddSelectAllStateItems(false); 13638 this.stateControllerManager.AddStateItems(true, true); 13639 } 13640 }, 13641 CallbackSpaceInit: function(isInitialization){ 13642 if(this.isCallbackMode){ 13643 this.SetBottomScrollSpacerVisibility(this.GetScrollSpacerVisibility(false)); 13644 this.SetTopScrollSpacerVisibility(this.GetScrollSpacerVisibility(true)); 13645 if(isInitialization || this.isComboBoxList){ 13646 this.EnsureSelectedItemVisible(); 13647 ASPx.Evt.AttachEventToElement(this.GetScrollDivElement(), "scroll", aspxLBScroll); 13648 } 13649 } 13650 }, 13651 GetListTable: function() { 13652 return this.tempCache.Get("ListTable", this.GetListTableCore, this); 13653 }, 13654 GetListTableCore: function(){ 13655 if(!ASPx.IsExistsElement(this.listTable)) 13656 this.listTable = ASPx.GetElementById(this.name + lTableIdSuffix); 13657 return this.listTable; 13658 }, 13659 GetItemElements: function() { 13660 return this.GetListTable().rows; 13661 }, 13662 GetListTableHeight: function(){ 13663 return this.GetListTable().offsetHeight; 13664 }, 13665 GetHeaderDivElement: function(){ 13666 if(!ASPx.IsExistsElement(this.headerDiv)) 13667 this.headerDiv = ASPx.GetElementById(this.name + lbHeaderDivIdSuffix); 13668 return this.headerDiv; 13669 }, 13670 GetHeaderTableElement: function(){ 13671 if(!ASPx.IsExistsElement(this.headerTable)){ 13672 var headerDiv = this.GetHeaderDivElement(); 13673 this.headerTable = ASPx.GetNodeByTagName(headerDiv, "table", 0); 13674 } 13675 return this.headerTable; 13676 }, 13677 GetScrollDivElement: function(){ 13678 if(!ASPx.IsExistsElement(this.scrollDivElement)) 13679 this.scrollDivElement = document.getElementById(this.name + lbDSuffix); 13680 return this.scrollDivElement; 13681 }, 13682 GetItemElement: function(index) { 13683 return this.itemsManager.GetItemElement(index); 13684 }, 13685 GetItemRow: function(index){ 13686 return this.itemsManager.GetItemRow(index); 13687 }, 13688 GetItemIndexByRow: function (itemRow) { 13689 return this.itemsManager.GetItemIndexByRow(itemRow); 13690 }, 13691 GetItemSelectableElementsByRow: function(row) { 13692 return row.cells; 13693 }, 13694 GetItemTexts: function(item) { 13695 return item.texts ? item.texts : [ item.text ]; 13696 }, 13697 GetItemHtmlContent: function(index) { 13698 return this.itemsManager.GetItemHtmlContent(index); 13699 }, 13700 GetItemCount: function(){ 13701 return this.itemsManager.GetItemCount(); 13702 }, 13703 GetListTableRowParent: function() { 13704 var listTable = this.GetListTable(); 13705 return this.GetTableRowParent(listTable); 13706 }, 13707 EnsureFixWidthRow: function (isSetItemHtmlProcessing) { 13708 var needfixWidthRow = !this.ContainsFixWidthRow() && this.IsMultiColumn() && (isSetItemHtmlProcessing || this.hasItemTemplate); 13709 if (needfixWidthRow) 13710 this.CreateFixWidthRow(); 13711 }, 13712 CreateFixWidthRow: function() { 13713 this.fixWidthRow = document.createElement("TR"); 13714 var etalonRow = this.GetSampleItemRow(); 13715 for(var i = 0; i < etalonRow.cells.length; i++) { 13716 var fixWidthCell = document.createElement("TD"); 13717 var etalonCell = etalonRow.cells[i]; 13718 var etalonCellStyle = ASPx.GetCurrentStyle(etalonCell); 13719 fixWidthCell.style.width = etalonCell.style.width || etalonCellStyle.width; 13720 fixWidthCell.style.borderLeftWidth = etalonCellStyle.borderLeftWidth; 13721 fixWidthCell.style.borderRightWidth = etalonCellStyle.borderRightWidth; 13722 fixWidthCell.style.borderLeftStyle = etalonCellStyle.borderLeftStyle; 13723 fixWidthCell.style.borderRightStyle = etalonCellStyle.borderRightStyle; 13724 fixWidthCell.style.paddingLeft = etalonCellStyle.paddingLeft; 13725 fixWidthCell.style.paddingRight = etalonCellStyle.paddingRight; 13726 fixWidthCell.style.boxSizing = etalonCellStyle.boxSizing; 13727 fixWidthCell.style.display = etalonCellStyle.display; 13728 this.fixWidthRow.appendChild(fixWidthCell); 13729 } 13730 ASPx.SetElementVisibility(this.fixWidthRow, "hidden"); 13731 this.fixWidthRow.style.height = "0px"; 13732 var listTableBody = this.GetListTableRowParent(); 13733 listTableBody.insertBefore(this.fixWidthRow, listTableBody.childNodes[0]); 13734 }, 13735 ContainsFixWidthRow: function() { 13736 return this.fixWidthRow && this.fixWidthRow.parentNode === this.GetListTableRowParent(); 13737 }, 13738 GetVisibleItemCount: function () { 13739 return this.itemsManager.GetVisibleItemCount(); 13740 }, 13741 GetIndexVisibleItem: function(item) { 13742 var count = this.GetItemCount(); 13743 var visibleItemCount = 0; 13744 for(var i = 0; i < count; i ++){ 13745 if(this.IsItemFiltered(i)) 13746 visibleItemCount++; 13747 var curItem = this.GetItem(i); 13748 if(item.value === curItem.value && item.text === curItem.text) 13749 break; 13750 } 13751 return visibleItemCount; 13752 }, 13753 GetItemCellCount: function(){ 13754 if(this.hasSampleItem) 13755 return this.GetSampleItemRow().cells.length; 13756 if(this.GetItemCount() > 0) 13757 return this.itemsManager.GetFirstVisibleItemRow().cells.length; 13758 return 0; 13759 }, 13760 GetItemTextCellCount: function(){ 13761 return this.GetItemCellCount() - this.GetItemFirstTextCellIndex(); 13762 }, 13763 GetItemFirstTextCellIndex: function(){ 13764 var itemFirstTextCellIndex = 0; 13765 if(this.GetIsCheckColumnExists()) 13766 itemFirstTextCellIndex++; 13767 if(this.imageCellExists) 13768 itemFirstTextCellIndex++; 13769 return itemFirstTextCellIndex; 13770 }, 13771 GetItemFirstTextCell: function(index){ 13772 return this.GetItemTextCell(index, 0); 13773 }, 13774 GetItemTextCell: function(itemIndex, textCellIndex) { 13775 var rowElement = this.GetItemRow(itemIndex); 13776 if(rowElement == null) 13777 return null; 13778 return rowElement.cells[this.GetItemFirstTextCellIndex() + textCellIndex]; 13779 }, 13780 GetItemTextCells: function(item) { 13781 var firstTextCellIndex = this.GetItemFirstTextCellIndex(); 13782 return Array.prototype.slice.call(this.GetItemSelectableElementsByRow(item), firstTextCellIndex); 13783 }, 13784 GetItemTopOffset: function(index){ 13785 return this.itemsManager.GetItemTopOffset(index); 13786 }, 13787 GetItemHeight: function(index){ 13788 return this.itemsManager.GetItemHeight(index); 13789 }, 13790 GetItemsHeight: function(){ 13791 return this.itemsManager.GetItemsHeight(); 13792 }, 13793 GetItemsWidth: function () { 13794 return this.itemsManager.GetItemsWidth(); 13795 }, 13796 GetItemCheckBoxInput: function(index){ 13797 var itemRow = this.GetItemRow(index); 13798 var checkBoxCell = itemRow ? itemRow.cells[this.GetCheckBoxCellIndex()] : null; 13799 return checkBoxCell ? ASPx.GetNodesByTagName(checkBoxCell, "input")[0] : null; 13800 }, 13801 GetIsCheckColumnExists: function(){ 13802 if(!this.checkCellExists) 13803 this.checkCellExists = this.CheckColumnSelectionMode(); 13804 return this.checkCellExists; 13805 }, 13806 GetCheckBoxCellIndex: function(){ 13807 return 0; 13808 }, 13809 GetImageCellIndex: function(){ 13810 return this.GetIsCheckColumnExists() ? 1 : 0; 13811 },
13812 GetItemCellsIdPostfixes: function(){ 13813 if(this.itemCellsIdPostfixes == null){ 13814 this.itemCellsIdPostfixes = []; 13815 var i = 0; 13816 if(this.GetIsCheckColumnExists()) { 13817 this.itemCellsIdPostfixes.push(lbIPostfixes[0]); 13818 i++; 13819 } 13820 if(this.imageCellExists){ 13821 this.itemCellsIdPostfixes.push(lbIPostfixes[1]); 13822 i++; 13823 } 13824 var cellCount = this.GetItemCellCount(); 13825 for(; i < cellCount; i++) 13826 this.itemCellsIdPostfixes.push(lbIPostfixes[2] + i); 13827 } 13828 return this.itemCellsIdPostfixes; 13829 }, 13830 AdjustControl: function (nestedCall) { 13831 if(this.IsAdjustmentRequired()) 13832 this.heightCorrected = false; 13833 ASPxClientEdit.prototype.AdjustControl.call(this, nestedCall); 13834 }, 13835 AdjustControlCore: function(){ 13836 this.RemoveShowHideFilterCssRules(); 13837 if(this.disableScrolling) 13838 return; 13839 ASPxClientEdit.prototype.AdjustControlCore.call(this); 13840 this.CorrectSize(); 13841 this.itemsManager.Adjust(); 13842 this.EnsureSelectedItemVisible(); 13843 if(this.showFilterButton) { 13844 this.UpdateFilterButtonHeight(); 13845 this.UpdateShowHideFilterElementCssRules(); 13846 } 13847 }, 13848 CorrectSize: function() { 13849 if(this.isComboBoxList || this.disableScrolling || this.filterStrategy.currentCallbackIsFiltration) 13850 return; 13851 this.LockScrollHandler(); 13852 this.CorrectHeight(); 13853 this.CorrectWidth(); 13854 this.InitializePageSize(); 13855 this.UnlockScrollHandler(); 13856 }, 13857 OnCorrectSizeByTimer: function() { 13858 if(this.IsVisible()) 13859 this.CorrectSize(); 13860 }, 13861 SetProtectionFromFlick_inFF: function(changeVisibility, changeDisplay){ 13862 if(!ASPx.Browser.Firefox) return; 13863 var listTable = this.GetListTable(); 13864 if(changeVisibility) 13865 listTable.style.visibility = "hidden"; 13866 if(changeDisplay) 13867 listTable.style.display = "none"; 13868 }, 13869 ResetProtectionFromFlick_inFF: function(){ 13870 if(!ASPx.Browser.Firefox) return; 13871 var listTable = this.GetListTable(); 13872 listTable.style.visibility = ""; 13873 listTable.style.display = ""; 13874 }, 13875 CorrectHeight: function(force){ 13876 if(ASPx.Browser.Firefox && this.heightCorrected && !force) return; 13877 this.heightCorrected = true; 13878 var mainElement = this.GetMainElement(); 13879 var divElement = this.GetScrollDivElement(); 13880 divElement.style.height = "0px"; 13881 var height = mainElement.offsetHeight; 13882 divElement.style.height = height + "px"; 13883 var extrudedHeight = mainElement.offsetHeight; 13884 var heightCorrection = extrudedHeight - height; 13885 if(heightCorrection > 0){ 13886 var divHeight = divElement.offsetHeight; 13887 this.SetProtectionFromFlick_inFF(true, false); 13888 divElement.style.height = (divHeight - heightCorrection) + "px"; 13889 this.ResetProtectionFromFlick_inFF(); 13890 extrudedHeight = mainElement.offsetHeight; 13891 var paddingsHeightCorrection = extrudedHeight - height; 13892 if(paddingsHeightCorrection > 0) 13893 divElement.style.height = (divHeight - heightCorrection - paddingsHeightCorrection) + "px"; 13894 } 13895 }, 13896 IsMultiColumn: function(){ 13897 return this.columnFieldNames.length > 0; 13898 }, 13899 IsCorrectWidthRequired: function(){ 13900 return true; 13901 }, 13902 GetVisibleColumnCount: function() { 13903 if (!this.visibleColumnCount) { 13904 this.visibleColumnCount = this.IsMultiColumn() ? 13905 ASPx.Data.CollectionToArray(this.GetSampleItemRow().cells) 13906 .slice(this.GetItemFirstTextCellIndex()) 13907 .filter(function (cell) { return ASPx.GetElementDisplay(cell); }).length 13908 : -1; 13909 } 13910 return this.visibleColumnCount; 13911 }, 13912 CorrectWidth: function () { 13913 if(!this.IsCorrectWidthRequired()) return; 13914 if(this.IsMultiColumn()) 13915 this.CorrectMultiColumnWidth(); 13916 else 13917 this.CorrectNonMultiColumnWidth(); 13918 }, 13919 CorrectMultiColumnWidth: function(){ 13920 var scrollBarWidth = this.GetVerticalScrollBarWidth(); 13921 this.CorrectMultiColumnHeaderWidth(scrollBarWidth); 13922 }, 13923 CollapseMultiColumnHeaderWidth:function(){ 13924 var headerDivElement = this.GetHeaderDivElement(); 13925 headerDivElement.style.width = "0px"; 13926 }, 13927 CorrectMultiColumnHeaderWidth: function(scrollBarWidth){ 13928 var headerDivElement = this.GetHeaderDivElement(); 13929 if(ASPx.IsExistsElement(headerDivElement)){ 13930 var headerTable; 13931 if(ASPx.Browser.WebKitFamily){ 13932 headerTable = this.GetHeaderTableElement(); 13933 if(!ASPx.IsExistsElement(headerTable)) 13934 headerTable = null; 13935 } 13936 if(this.rtl) 13937 headerDivElement.style.paddingLeft = scrollBarWidth + "px"; 13938 else 13939 headerDivElement.style.paddingRight = scrollBarWidth + "px"; 13940 if(headerTable) 13941 window.setTimeout(function() { headerTable.style.width = "100%"; }, 0); 13942 } 13943 }, 13944 CorrectNonMultiColumnWidth: function(){ 13945 var mainElement = this.GetMainElement(), 13946 divElement = this.GetScrollDivElement(); 13947 if(this.width == ""){ 13948 var itemsWidth = this.GetItemsWidth(); 13949 if (itemsWidth != 0 || !ASPx.Browser.NetscapeFamily) { 13950 divElement.style.width = Math.max((itemsWidth + this.GetVerticalScrollBarWidth()), this.scrollDivMinWidth) + "px"; 13951 if(ASPx.Browser.Firefox) 13952 mainElement.style.width = divElement.offsetWidth + "px"; 13953 } 13954 } else { 13955 mainElement.style.width = this.width; 13956 if(this.width !== "100%") { 13957 var scrollDivWidth = ASPx.Browser.WebKitFamily ? 1 : 0; 13958 var oldScrollTop = divElement.scrollTop; 13959 divElement.style.width = scrollDivWidth + "px"; 13960 scrollDivWidth = ASPx.Browser.Edge ? mainElement.clientWidth - ASPx.GetHorizontalBordersWidth(mainElement) : mainElement.clientWidth; 13961 divElement.style.width = scrollDivWidth + "px"; 13962 var isScrollEventWillRaised = divElement.scrollTop != oldScrollTop; 13963 if(isScrollEventWillRaised) 13964 this.itemsManager.DeactivateScrollHandler(); 13965 divElement.scrollTop = oldScrollTop; 13966 } 13967 } 13968 }, 13969 UpdateAdjustmentFlags: function() { 13970 var mainElement = this.GetMainElement(); 13971 if(mainElement) { 13972 var mainElementStyle = ASPx.GetCurrentStyle(mainElement); 13973 this.UpdatePercentSizeConfig([this.width], [mainElementStyle.height, mainElement.style.height]); 13974 } 13975 }, 13976 EnsureSelectedItemVisible: function() { 13977 var index = this.GetSelectedIndex(); 13978 if(index != -1) 13979 this.itemsManager.MakeItemVisibleAtTop(index); 13980 }, 13981 MakeItemVisible: function(index) { 13982 if(!this.itemsManager.IsItemVisible(index)) 13983 this.itemsManager.MakeItemVisibleAtTop(index); 13984 }, 13985 ScrollItemToTop: function(index) { 13986 this.LockScrollHandler(); 13987 this.SetScrollTop(this.GetItemTopOffset(index)); 13988 this.UnlockScrollHandler(); 13989 }, 13990 GetScrollDivChildElementHeight: function() { 13991 return this.itemsManager.GetScrollDivChildElementHeight(); 13992 }, 13993 SetScrollTop: function(scrollTop){ 13994 var scrollDiv = this.GetScrollDivElement(); 13995 if(scrollDiv){ 13996 scrollDiv.scrollTop = scrollTop; 13997 if(ASPx.Browser.Opera) 13998 this.CachedScrollTop(); 13999 } 14000 }, 14001 CachedScrollTop: function(){ 14002 var scrollDiv = this.GetScrollDivElement(); 14003 scrollDiv.cachedScrollTop = scrollDiv.scrollTop; 14004 }, 14005 RestoreScrollTopFromCache: function(){ 14006 var scrollDiv = this.GetScrollDivElement(); 14007 if(scrollDiv && ASPx.IsExists(scrollDiv.cachedScrollTop)) 14008 scrollDiv.scrollTop = scrollDiv.cachedScrollTop; 14009 }, 14010 IsListBoxWidthLessThenList: function(){ 14011 var divElement = this.GetScrollDivElement(); 14012 var listTable = this.GetListTable(); 14013 var listTabelWidth = listTable.style.width; 14014 var isLess = false; 14015 listTable.style.width = ""; 14016 isLess = listTable.offsetWidth < divElement.offsetWidth; 14017 listTable.style.width = listTabelWidth; 14018 return isLess; 14019 }, 14020 GetVerticalScrollBarWidth: function(){ 14021 if(!this.verticalScrollBarWidth || this.verticalScrollBarWidth <= 0){ 14022 this.verticalScrollBarWidth = this.GetVerticalScrollBarWidthCore(); 14023 return this.verticalScrollBarWidth; 14024 } else 14025 return this.GetIsVerticalScrollBarVisible() ? this.verticalScrollBarWidth : 0; 14026 }, 14027 GetIsVerticalScrollBarVisible: function() { 14028 var divElement = this.GetScrollDivElement(); 14029 var verticalOverflow = this.GetVerticalOverflow(divElement); 14030 if(verticalOverflow != "auto"){ 14031 return divElement.clientHeight < this.GetListTableHeight(); 14032 } else { 14033 var borderWidthWithScroll = this.getCountedScrollBarWidth(divElement); 14034 return borderWidthWithScroll == this.scrollDivBordersWidthWithScroll; 14035 } 14036 }, 14037 GetVerticalScrollBarWidthCore: function() { 14038 var divElement = this.GetScrollDivElement(); 14039 var overflowYReserv = this.GetVerticalOverflow(divElement); 14040 this.SetVerticalOverflow(divElement, "auto"); 14041 this.scrollDivBordersWidthWithScroll = this.getCountedScrollBarWidth(divElement); 14042 this.SetProtectionFromFlick_inFF(false, true); 14043 this.SetVerticalOverflow(divElement, "hidden"); 14044 var bordersWidthWithoutScroll = this.getCountedScrollBarWidth(divElement); 14045 this.SetVerticalOverflow(divElement, overflowYReserv); 14046 this.ResetProtectionFromFlick_inFF(); 14047 return this.scrollDivBordersWidthWithScroll - bordersWidthWithoutScroll; 14048 }, 14049 getCountedScrollBarWidth: function(divElement) { 14050 var divElementWidth = divElement.getBoundingClientRect().width; 14051 var tempElement = ASPx.CreateHtmlElement("DIV"); 14052 ASPx.SetStyles(tempElement, { height: "0px", width: "100%" });
14053 divElement.appendChild(tempElement); 14054 var result = Math.round(divElementWidth - tempElement.getBoundingClientRect().width); 14055 divElement.removeChild(tempElement); 14056 return result; 14057 }, 14058 GetVerticalOverflowPropertyName: function() { 14059 if(ASPx.Browser.WebKitFamily || ASPx.Browser.AndroidDefaultBrowser || ASPx.Browser.Firefox && ASPx.Browser.Version >= 3) 14060 return "overflowY"; 14061 return "overflow"; 14062 }, 14063 GetVerticalOverflow: function(element){ 14064 return element.style[this.GetVerticalOverflowPropertyName()]; 14065 }, 14066 SetVerticalOverflow: function(element, value) { 14067 element.style[this.GetVerticalOverflowPropertyName()] = value; 14068 }, 14069 MultiSelectionMode: function(){ 14070 return this.selectionMode != ListBoxSelectionMode.Single; 14071 }, 14072 CheckColumnSelectionMode: function(){ 14073 return this.selectionMode == ListBoxSelectionMode.CheckColumn; 14074 }, 14075 OnItemClick: function(index, evt){ 14076 if(!this.isInitialized) 14077 return; 14078 if (this.GetReadOnly()) { 14079 ASPx.Evt.PreventEvent(evt); 14080 return this.OnItemClickOrDblClickReadOnly(); 14081 } 14082 if(this.CheckColumnSelectionMode() && this.IsCheckBoxClicked(evt)) 14083 this.GetItemSelectionHelper().OnItemCheckBoxClick(index, evt); 14084 else 14085 this.GetItemSelectionHelper().OnItemClick(index, evt); 14086 this.SetFocus(); 14087 this.RaiseItemClick(); 14088 }, 14089 OnItemClickOrDblClickReadOnly: function(){ 14090 return false; 14091 }, 14092 OnItemDblClick: function(){ 14093 if (this.GetReadOnly()) 14094 return this.OnItemClickOrDblClickReadOnly(); 14095 return this.RaiseItemDoubleClick(); 14096 }, 14097 CanChangeSelection: function(){ 14098 return !this.GetReadOnly() || !this.isInitialized; 14099 }, 14100 SelectIndexSilent: function(index){ 14101 return this.SetItemSelectionStateSilent(index); 14102 }, 14103 SetItemSelectionStateSilent: function(index) { 14104 if(!this.CanChangeSelection()) 14105 return; 14106 var oldSelectionIndex = this.GetSelectedIndex(); 14107 this.LockSelectionEvents(); 14108 this.SetSelectedIndexCore(index); 14109 this.UnlockSelectionEvents(); 14110 return index !== oldSelectionIndex; 14111 }, 14112 SetItemSelectionAppearance: function (index, selected, controller, checkCanChangeSelection) { 14113 if (checkCanChangeSelection && !this.CanChangeSelection()) 14114 return; 14115 if(!controller) 14116 controller = ASPx.GetStateController(); 14117 var itemFirstTextCell = this.GetItemFirstTextCell(index); 14118 if(selected) 14119 controller.SelectElementBySrcElement(itemFirstTextCell); 14120 else 14121 controller.DeselectElementBySrcElement(itemFirstTextCell); 14122 }, 14123 GetItemSelectionHelper: function(){ 14124 if(!this.itemSelectionHelper) 14125 this.itemSelectionHelper = this.CreateItemSelectionHelper(); 14126 return this.itemSelectionHelper; 14127 }, 14128 CreateItemSelectionHelper: function(){ 14129 if(this.selectionMode == ListBoxSelectionMode.Single) 14130 return new ListBoxSingleSelectionHelper(this); 14131 else if(this.selectionMode == ListBoxSelectionMode.Multiple) 14132 return new ListBoxMultiSelectionHelper(this); 14133 else if(this.selectionMode == ListBoxSelectionMode.CheckColumn) 14134 return new ListBoxCheckSelectionHelper(this); 14135 }, 14136 GetValue: function(){ 14137 var index = this.GetSelectedIndex(); 14138 if(0 <= index && index < this.itemsValue.length) 14139 return this.itemsValue[index]; 14140 return null; 14141 }, 14142 SetValue: function(value){ 14143 var index = this.FindItemIndexByValue(value); 14144 this.SetSelectedIndex(index); 14145 }, 14146 GetSelectedItem: function(){ 14147 var index = this.GetSelectedIndex(); 14148 return this.GetItem(index); 14149 }, 14150 GetSelectedIndex: function(){ 14151 if(!this.itemSelectionHelper) 14152 return this.GetSelectedIndexInternal(); 14153 return this.GetItemSelectionHelper().GetSelectedIndex(); 14154 }, 14155 SetSelectedIndex: function(index){ 14156 this.LockSelectionEvents(); 14157 this.SetSelectedIndexCore(index); 14158 this.EnsureSelectedItemVisible(index); 14159 this.UnlockSelectionEvents(); 14160 }, 14161 SetSelectedIndexCore: function(index){ 14162 this.GetItemSelectionHelper().SetSelectedIndex(index); 14163 }, 14164 GetSelectedIndices: function(){ 14165 return this.GetItemSelectionHelper().GetSelectedIndices(); 14166 }, 14167 GetSelectedValues: function(){ 14168 return this.GetItemSelectionHelper().GetSelectedValues(); 14169 }, 14170 GetSelectedItems: function(){ 14171 return this.GetItemSelectionHelper().GetSelectedItems();
14172 }, 14173 SelectAll: function(){ 14174 this.SelectIndices(); 14175 }, 14176 UnselectAll: function(){ 14177 this.UnselectIndices(); 14178 }, 14179 SelectIndices: function(indices){ 14180 this.LockSelectionEvents(); 14181 this.GetItemSelectionHelper().SelectIndices(indices); 14182 this.UnlockSelectionEvents(); 14183 }, 14184 SelectItems: function(items){ 14185 this.LockSelectionEvents(); 14186 this.GetItemSelectionHelper().SelectItems(items); 14187 this.UnlockSelectionEvents(); 14188 }, 14189 SelectValues: function(values){ 14190 this.LockSelectionEvents(); 14191 this.GetItemSelectionHelper().SelectValues(values); 14192 this.UnlockSelectionEvents(); 14193 }, 14194 UnselectIndices: function(indices){ 14195 this.LockSelectionEvents(); 14196 this.GetItemSelectionHelper().UnselectIndices(indices); 14197 this.UnlockSelectionEvents(); 14198 }, 14199 UnselectItems: function(items){ 14200 this.LockSelectionEvents(); 14201 this.GetItemSelectionHelper().UnselectItems(items); 14202 this.UnlockSelectionEvents(); 14203 }, 14204 UnselectValues: function(values){ 14205 this.LockSelectionEvents(); 14206 this.GetItemSelectionHelper().UnselectValues(values); 14207 this.UnlockSelectionEvents(); 14208 }, 14209 GetIsItemSelected: function(index){ 14210 return this.GetItemSelectionHelper().GetIsItemSelected(index); 14211 }, 14212 GetFocusedIndex: function(){ 14213 return this.GetItemSelectionHelper().GetFocusedIndex(); 14214 }, 14215 UpdateInternalState: function(){ 14216 this.UpdateHiddenInputs(); 14217 }, 14218 IsUpdateHiddenInputsLocked: function(){ 14219 return this.GetItemSelectionHelper().IsUpdateInternalSelectionStateLocked(); 14220 }, 14221 UpdateHiddenInputs: function(){ 14222 if(this.IsUpdateHiddenInputsLocked()) 14223 return; 14224 if(this.MultiSelectionMode()){ 14225 var element = this.FindStateInputElement(); 14226 if(ASPx.IsExistsElement(element)) { 14227 var sb = [ ]; 14228 var serialiser = this.GetSerializingHelper(); 14229 var selectedIndices = this.GetSelectedIndices(); 14230 for(var i = 0; i < selectedIndices.length; i++) 14231 serialiser.SerializeAtomValue(sb, this.GetItemValue(selectedIndices[i])); 14232 element.value = sb.join(""); 14233 } 14234 } else 14235 ASPxClientListBoxBase.prototype.UpdateHiddenInputs.call(this); 14236 }, 14237 UseDelayedSpecialFocus: function() { 14238 return true; 14239 }, 14240 GetInnerEditors: function() { 14241 var result = ASPxClientListBoxBase.prototype.GetInnerEditors(); 14242 if(this.filteringTextBox) { 14243 result.push(this.filteringTextBox); 14244 } 14245 return result; 14246 }, 14247 AdjustWidthInDropDown: function(parentComboBoxMainElement, isCallbackMode, customWidth) { 14248 var lbScrollDiv = this.GetScrollDivElement(); 14249 var lbMainElement = this.GetMainElement(); 14250 var scrollWidth = 0; 14251 if (this.IsMultiColumn() && isCallbackMode && this.GetScrollSpacerVisibility(false) && this.GetBottomScrollSpacerHeight() == 0) 14252 this.SetBottomScrollSpacerVisibility(true); 14253 var keepCurrentWidth = this.HasVirtualScrolling() && this.hasDecoratedItems && this.isComboBoxScrollingCallbackProcessing; 14254 if(!keepCurrentWidth) { 14255 lbMainElement.style.width = ""; 14256 lbScrollDiv.style.paddingRight = "0px"; 14257 lbScrollDiv.style.width = "100%"; 14258 } 14259 else 14260 this.isComboBoxScrollingCallbackProcessing = false; 14261 if (customWidth != "") { 14262 lbMainElement.style.width = customWidth; 14263 var width = lbMainElement.clientWidth; 14264 var scrollInfo = this.SetScrollDivAndCorrectionForScroll(width, false); 14265 width = scrollInfo.scrollDivWidth; 14266 scrollWidth = scrollInfo.scrollWidth; 14267 if(!this.enableEllipsis) { 14268 var difference = this.GetItemsWidth() - lbScrollDiv.clientWidth; 14269 if (difference > 0) { 14270 lbMainElement.style.width = (lbMainElement.offsetWidth + difference) + "px"; 14271 lbScrollDiv.style.width = (lbMainElement.clientWidth) + "px"; 14272 } 14273 } 14274 } else { 14275 var width = this.GetItemsWidth(); 14276 var scrollInfo = this.SetScrollDivAndCorrectionForScroll(width, true); 14277 width = scrollInfo.scrollDivWidth; 14278 scrollWidth = scrollInfo.scrollWidth; 14279 if (ASPx.Browser.Firefox && lbMainElement.offsetWidth < lbScrollDiv.offsetWidth) 14280 lbMainElement.style.width = "0%"; 14281 if (parentComboBoxMainElement) { 14282 var widthDifference = parentComboBoxMainElement.offsetWidth - lbMainElement.offsetWidth; 14283 if (widthDifference > 0) { 14284 this.scrollDivMinWidth = width + widthDifference; 14285 lbScrollDiv.style.width = this.scrollDivMinWidth + "px"; 14286 var twoBorderSize = (lbMainElement.offsetWidth - lbMainElement.clientWidth);
14287 lbMainElement.style.width = (width + widthDifference + twoBorderSize) + "px"; 14288 } 14289 } 14290 } 14291 if (this.IsMultiColumn()) 14292 this.CorrectMultiColumnHeaderWidth(scrollWidth); 14293 if (this.NeedToHandleCellWidth()) 14294 this.CorrectCellNullWidthStyle(this.itemsManager.GetFirstVisibleItemRow()); 14295 if (this.ContainsFixWidthRow()) { 14296 var lbHeaderDiv = this.GetHeaderDivElement(); 14297 if (lbHeaderDiv) 14298 lbScrollDiv.style.width = lbHeaderDiv.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(lbScrollDiv) + "px"; 14299 } 14300 return lbScrollDiv.offsetWidth; 14301 }, 14302 SetScrollDivAndCorrectionForScroll: function(width, widthByContent) { 14303 var lbScrollDiv = this.GetScrollDivElement(); 14304 var scrollWidth = this.GetVerticalScrollBarWidth(); 14305 var browserCanHaveScroll = this.GetVerticalOverflow(lbScrollDiv) == "auto"; 14306 if (widthByContent && browserCanHaveScroll) 14307 width += scrollWidth; 14308 lbScrollDiv.style.width = width + "px"; 14309 return { scrollDivWidth: width, scrollWidth: scrollWidth }; 14310 }, 14311 BeforeAdjustHeightInDropDown: function() { 14312 this.GetMainElement().style.height = "0px"; 14313 }, 14314 AdjustHeightInDropDown: function(customHeight, visibleRowCount) { 14315 this.BeforeAdjustHeightInDropDown(); 14316 if(this.itemsManager.smallestItemHeight === 0) 14317 this.itemsManager.updateSmallestItemSize(); 14318 var lbHeight = 0; 14319 if (customHeight == "") 14320 lbHeight = this.GetHeightByContent(visibleRowCount); 14321 else 14322 lbHeight = this.GetHeightByServerValue(customHeight); 14323 this.itemsManager.Adjust(); 14324 this.InitializePageSize(); 14325 return lbHeight; 14326 }, 14327 GetHeightByContent: function(visibleRowCount) { 14328 var lbScrollDiv = this.GetScrollDivElement(), 14329 itemCount = this.GetVisibleItemCount(), 14330 hasVerticalScrollbar = itemCount > visibleRowCount; 14331 lbScrollDiv.style.height = ""; 14332 var height = 0; 14333 if (hasVerticalScrollbar) 14334 height = this.itemsManager.GetTotalItemsHeight(0, visibleRowCount - 1); 14335 else { 14336 if(itemCount !== 0) { 14337 height = this.GetItemsHeight(); 14338 } 14339 } 14340 height += "px"; 14341 lbScrollDiv.style.height = height; 14342 height = lbScrollDiv.offsetHeight; 14343 height += ASPx.GetTopBottomBordersAndPaddingsSummaryValue(this.GetMainElement()); 14344 var lbHeaderDiv = this.GetHeaderDivElement(); 14345 if (ASPx.IsExists(lbHeaderDiv)) 14346 height += lbHeaderDiv.offsetHeight; 14347 return height; 14348 }, 14349 GetHeightByServerValue: function(customHeight) { 14350 var lbMainElement = this.GetMainElement(); 14351 var lbScrollDiv = this.GetScrollDivElement(); 14352 var height = customHeight; 14353 lbMainElement.style.height = "0px"; 14354 lbScrollDiv.style.height = "0px"; 14355 lbMainElement.style.height = height; 14356 var trueLbOffsetHeight = lbMainElement.offsetHeight; 14357 var trueLbClientHeight = lbMainElement.clientHeight; 14358 lbScrollDiv.style.height = lbMainElement.clientHeight + "px"; 14359 var lbHeightCorrection = lbMainElement.offsetHeight - trueLbOffsetHeight; 14360 lbScrollDiv.style.height = (trueLbClientHeight - lbHeightCorrection) + "px"; 14361 height = lbMainElement.offsetHeight; 14362 return height; 14363 }, 14364 GetLoadingParentElement: function() { 14365 return this.GetScrollDivElement().parentNode; 14366 }, 14367 ShowLoadingPanel: function() { 14368 if(!this.isComboBoxList){ 14369 var loadingParentElement = this.GetLoadingParentElement(); 14370 var lp = this.CreateLoadingPanelWithAbsolutePosition(loadingParentElement); 14371 this.PreventMouseWheelOnElement(lp); 14372 } 14373 }, 14374 ShowLoadingDiv: function () { 14375 if(!this.isComboBoxList){ 14376 var loadingParentElement = this.GetLoadingParentElement(); 14377 var ld = this.CreateLoadingDiv(loadingParentElement); 14378 this.PreventMouseWheelOnElement(ld); 14379 } 14380 }, 14381 PreventMouseWheelOnElement: function(element) { 14382 if(!element) return; 14383 var wheelEventName = ASPx.Evt.GetMouseWheelEventName(); 14384 ASPx.Evt.AttachEventToElement(element, wheelEventName, function(evt) { 14385 if(this.scrollHelper.GetIsAnySpacerVisible()) 14386 ASPx.Evt.PreventEvent(evt); 14387 }.aspxBind(this)); 14388 }, 14389 ParseCallbackResult: function(result, shouldSelectSilentDelegate){ 14390 var gottenEgdeOfCollection = false; 14391 var isLoadindToTopByScroll = this.scrollHelper.IsScrolledToTopSpacer(); 14392 if(result[CONSTANTS.CALLBACK_RESULTS.ITEMS].length) { 14393 var deserializedItems = this.DeserializeItems(result[CONSTANTS.CALLBACK_RESULTS.ITEMS]); 14394 this.LoadItemsFromCallback(isLoadindToTopByScroll, deserializedItems, shouldSelectSilentDelegate); 14395 gottenEgdeOfCollection = deserializedItems.length < this.callbackPageSize; 14396 }
14397 var noMoreItemsForLoadThisDirection = !result[CONSTANTS.CALLBACK_RESULTS.ITEMS].length || gottenEgdeOfCollection; 14398 this.SetScrollSpacerVisibility(isLoadindToTopByScroll, !noMoreItemsForLoadThisDirection); 14399 this.scrollHelper.Reset(); 14400 }, 14401 LoadItemsFromCallback: function(isToTop, deserializedItems, shouldSelectSilentDelegate){ 14402 this.LockSynchronizationOnInternalCallback(); 14403 this.BeginUpdate(); 14404 var isMultiSelect = this.MultiSelectionMode(); 14405 this.RemoveAccessibilityHeaderRow(); 14406 if(isToTop){ 14407 var scrollHeightCorrection = 0; 14408 for(var i = deserializedItems.length - 1; i >= 0; i--) { 14409 this.InsertItemInternal(0, deserializedItems[i]); 14410 scrollHeightCorrection += this.GetItemHeight(0); 14411 } 14412 this.GetScrollDivElement().scrollTop += scrollHeightCorrection; 14413 this.serverIndexOfFirstItem -= deserializedItems.length; 14414 if(this.serverIndexOfFirstItem < 0) this.serverIndexOfFirstItem = 0; 14415 } else { 14416 for(var i = 0; i < deserializedItems.length; i++) { 14417 var itemIndex = this.AddItemInternal(deserializedItems[i]); 14418 var shouldSelectSilent = shouldSelectSilentDelegate && shouldSelectSilentDelegate(deserializedItems[i].value, deserializedItems[i].text); 14419 this.SelectValueOnLoad(itemIndex, deserializedItems[i].selected, shouldSelectSilent, isMultiSelect); 14420 } 14421 } 14422 if(this.changeSelectAfterCallback != 0) { 14423 var newIndex = this.GetSelectedIndex() + this.changeSelectAfterCallback; 14424 newIndex = this.GetAdjustedIndex(newIndex); 14425 this.SelectIndexSilent(newIndex); 14426 if(this.scrollHelper.isScrolledToTopSpacer) 14427 this.ScrollItemToTop(newIndex); 14428 else 14429 this.MakeItemVisible(newIndex); 14430 } 14431 this.AddAccessibilityHeaderRow(); 14432 this.EndUpdate(); 14433 this.UnlockSynchronizationOnInternalCallback(); 14434 }, 14435 SelectValueOnLoad: function (index, selected, shouldSelectSilent, isMultiSelect) { 14436 if(selected && this.changeSelectAfterCallback == 0) { 14437 if(isMultiSelect) { 14438 this.SelectIndices([index]); 14439 } else { 14440 if(shouldSelectSilent) 14441 this.SelectIndexSilent(index); 14442 else 14443 this.SelectIndex(index); 14444 } 14445 } 14446 }, 14447 CreateSerializingHelper: function(){ 14448 return new ListBoxItemsSerializingHelper(this); 14449 }, 14450 InCallback: function(){ 14451 var callbackOwner = this.GetCallbackOwnerControl(); 14452 if(callbackOwner != null) 14453 return callbackOwner.InCallback(); 14454 return ASPxClientListEdit.prototype.InCallback.call(this); 14455 }, 14456 GetItemsRangeForLoad: function(){ 14457 return this.scrollHelper.GetItemsRangeForLoad(); 14458 }, 14459 GetScrollSpacerElement: function(isTop){ 14460 return document.getElementById(this.name + (isTop ? lbTSIdSuffix : lbBSIdSuffix)); 14461 }, 14462 GetScrollSpacerVisibility: function(isTop){ 14463 if(!this.clientEnabled) 14464 return false; 14465 return isTop ? this.isTopSpacerVisible : this.isBottomSpacerVisible; 14466 }, 14467 SetScrollSpacerVisibility: function(isTop, visibility){ 14468 this.LockScrollHandler(); 14469 var spacer = this.GetScrollSpacerElement(isTop); 14470 if(spacer){ 14471 if(visibility) 14472 spacer.style.height = this.GetRequiredScrollSpacerHeight() + "px"; 14473 if(this.clientEnabled){ 14474 if(isTop) 14475 this.isTopSpacerVisible = visibility; 14476 else 14477 this.isBottomSpacerVisible = visibility; 14478 } 14479 if(ASPx.GetElementDisplay(spacer) != visibility){ 14480 ASPx.SetElementDisplay(spacer, visibility); 14481 ASPx.GetElementVisibility(spacer, visibility); 14482 } 14483 } 14484 this.itemsManager.OnScrollSpacerVisibilityChanged(); 14485 this.UnlockScrollHandler(); 14486 }, 14487 GetRequiredScrollSpacerHeight: function() { 14488 return this.GetScrollDivElement().clientHeight; 14489 }, 14490 SetTopScrollSpacerVisibility: function(visibility){ 14491 this.SetScrollSpacerVisibility(true, visibility); 14492 }, 14493 SetBottomScrollSpacerVisibility: function(visibility){ 14494 this.SetScrollSpacerVisibility(false, visibility); 14495 }, 14496 GetTopScrollSpacerHeight: function(){ 14497 return this.GetScrollSpacerVisibility(true) ? this.GetScrollSpacerElement(true).clientHeight : 0; 14498 }, 14499 GetBottomScrollSpacerHeight: function(){ 14500 return this.GetScrollSpacerVisibility(false) ? this.GetScrollSpacerElement(false).clientHeight : 0; 14501 }, 14502 GetTopSpacersHeight: function() { 14503 return this.itemsManager.GetTopSpacersHeight(); 14504 }, 14505 SendCallback: function(onSuccess) { 14506 if(!this.InCallback()){ 14507 this.ShowLoadingElements(); 14508 var callbackOwner = this.GetCallbackOwnerControl(); 14509 if(callbackOwner != null) 14510 callbackOwner.SendCallback(onSuccess); 14511 else { 14512 var argument = this.GetCallbackArguments(); 14513 this.CreateCallback(argument, null, onSuccess); 14514 } 14515 } 14516 }, 14517 OnCallback: function(result, shouldSelectSilentDelegate) { 14518 if(result.serverMode) 14519 this.UpdateStateObjectWithObject({serverMode: true}); 14520 if(!this.filterStrategy || !this.filterStrategy.ShouldDiscardCallbackResult()) { 14521 this.ParseCallbackResult(result, shouldSelectSilentDelegate); 14522 if(!this.isComboBoxList) 14523 this.filterStrategy.OnCallback(result); 14524 this.OnCallbackFinally(); 14525 } 14526 }, 14527 OnCallbackError: function(result){ 14528 ASPxClientListBoxBase.prototype.OnCallbackError.call(this, result); 14529 this.OnCallbackFinally(); 14530 }, 14531 OnCallbackFinally: function () { 14532 this.HideLoadingPanel(); 14533 this.changeSelectAfterCallback = 0; 14534 }, 14535 DoEndCallback: function() { 14536 this.filterStrategy.OnBeforeDoEndCallback(); 14537 ASPxClientListBoxBase.prototype.DoEndCallback.call(this); 14538 this.filterStrategy.OnAfterDoEndCallback(); 14539 }, 14540 RaiseEndCallback: function() { 14541 if(this.preventEndCallbackRising) 14542 this.preventEndCallbackRising = false; 14543 else 14544 ASPxClientListBoxBase.prototype.RaiseEndCallback.call(this); 14545 }, 14546 LockScrollHandler: function(){ 14547 this.scrollHandlerLockCount ++; 14548 }, 14549 UnlockScrollHandler: function(){ 14550 this.scrollHandlerLockCount --; 14551 }, 14552 IsScrollHandlerLocked: function(){ 14553 return this.scrollHandlerLockCount > 0; 14554 }, 14555 OnScroll: function(){ 14556 if(this.IsScrollHandlerLocked()) return; 14557 if(this.IsVisible() && !this.InCallback() && ( this.GetScrollSpacerVisibility(true) || this.GetScrollSpacerVisibility(false))) { 14558 this.scrollHelper.OnScroll(); 14559 if(this.scrollHelper.GetIsNeedToHideTopSpacer()) 14560 this.SetTopScrollSpacerVisibility(false); 14561 if(this.scrollHelper.GetIsNeedCallback()) { 14562 this.isComboBoxScrollingCallbackProcessing = this.isComboBoxList; 14563 this.SendCallback(); 14564 } 14565 } 14566 }, 14567 OnBrowserWindowResize: function(e) { 14568 if(this.IsVisible()) 14569 this.CorrectSize(); 14570 }, 14571 KeyboardSupportAllowed: function(){ 14572 return !this.CheckColumnSelectionMode(); 14573 }, 14574 InitializeKeyHandlers: function() { 14575 if(this.KeyboardSupportAllowed()){ 14576 this.AddKeyDownHandler(ASPx.Key.PageUp, "OnPageUp"); 14577 this.AddKeyDownHandler(ASPx.Key.PageDown, "OnPageDown"); 14578 this.AddKeyDownHandler(ASPx.Key.End, "OnEndKeyDown"); 14579 this.AddKeyDownHandler(ASPx.Key.Home, "OnHomeKeyDown"); 14580 this.AddKeyDownHandler(ASPx.Key.Up, "OnArrowUp"); 14581 this.AddKeyDownHandler(ASPx.Key.Down, "OnArrowDown"); 14582 } else if(this.accessibilityCompliant && !this.IsNativeCheckBoxes()) { 14583 this.AddKeyDownHandler(ASPx.Key.Up, "OnAccessArrowUp"); 14584 this.AddKeyDownHandler(ASPx.Key.Down, "OnAccessArrowDown"); 14585 } 14586 }, 14587 OnArrowUp: function(evt){ 14588 if(this.isInitialized) 14589 this.SelectNeighbour(-1); 14590 return true; 14591 }, 14592 OnArrowDown: function(evt){ 14593 if(this.isInitialized) 14594 this.SelectNeighbour(1); 14595 return true; 14596 }, 14597 OnAccessArrowUp: function(evt){ 14598 if(!this.isInitialized) return true; 14599 var index = this.GetFocusedIndex(); 14600 var isItemCheckBoxFocused = this.GetInternalCheckBox(index) && this.GetInternalCheckBox(index).focused; 14601 var isSelectAllCheckBoxFocused = this.selectAllCheckBox && this.selectAllCheckBox.focused; 14602 if(index > this.GetFirstFilteredItemIndex() && isItemCheckBoxFocused) 14603 this.SetFocusedIndex(this.GetPrevFilteredItemIndex(index)); 14604 else if(index == this.GetFirstFilteredItemIndex() && this.selectAllCheckBox && !isSelectAllCheckBoxFocused) { 14605 this.selectAllCheckBox.mainElement.focus(); 14606 this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false); 14607 } 14608 else 14609 this.SetFocusedIndex(this.GetLastFilteredItemIndex()); 14610 return true; 14611 }, 14612 OnAccessArrowDown: function(evt){ 14613 if(!this.isInitialized) return true; 14614 var index = this.GetFocusedIndex(); 14615 var isItemCheckBoxFocused = this.GetInternalCheckBox(index) && this.GetInternalCheckBox(index).focused; 14616 var isSelectAllCheckBoxFocused = this.selectAllCheckBox && this.selectAllCheckBox.focused; 14617 if(index < this.GetLastFilteredItemIndex() && isItemCheckBoxFocused) 14618 this.SetFocusedIndex(this.GetNextFilteredItemIndex(index)); 14619 else if(index == this.GetLastFilteredItemIndex() && this.selectAllCheckBox && !isSelectAllCheckBoxFocused) { 14620 this.selectAllCheckBox.mainElement.focus(); 14621 this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false); 14622 } 14623 else 14624 this.SetFocusedIndex(this.GetFirstFilteredItemIndex()); 14625 return true; 14626 }, 14627 SetFocusedIndex: function(index) { 14628 if(this.GetIsCheckColumnExists()) { 14629 this.MakeItemVisible(index); 14630 setTimeout(function () { this.GetInternalCheckBox(index).mainElement.focus(); }.aspxBind(this), 0); 14631 } 14632 this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false); 14633 }, 14634 OnPageUp: function(evt){ 14635 if(this.isInitialized) 14636 this.SelectNeighbour(-this.scrollPageSize); 14637 return true; 14638 }, 14639 OnPageDown: function(evt){ 14640 if(this.isInitialized) 14641 this.SelectNeighbour(this.scrollPageSize); 14642 return true; 14643 }, 14644 OnHomeKeyDown: function(evt){ 14645 if(this.isInitialized) 14646 this.SelectNeighbour(-this.GetItemCount()); 14647 return true; 14648 }, 14649 OnEndKeyDown: function(evt){ 14650 if(this.isInitialized) 14651 this.SelectNeighbour(this.GetItemCount()); 14652 return true; 14653 }, 14654 GetAdjustedIndex: function(index){ 14655 if(index < 0) index = 0; 14656 else{ 14657 var itemCount = this.GetItemCount(); 14658 if(index >= itemCount) index = itemCount - 1; 14659 } 14660 return index; 14661 }, 14662 SelectNeighbour: function (step) { 14663 var itemCount = this.GetItemCount(); 14664 if(itemCount > 0) { 14665 this.changeSelectAfterCallback = 0; 14666 var selectedIndex = this.GetFocusedIndex(); 14667 var newSelectedIndex = this.GetNewSelectedIndex(selectedIndex, step); 14668 newSelectedIndex = this.GetAdjustedIndex(newSelectedIndex); 14669 if(selectedIndex != newSelectedIndex && this.IsItemFiltered(newSelectedIndex)) { 14670 this.LockScrollOnKBNavigation(); 14671 this.SetSelectedIndexCore(newSelectedIndex); 14672 this.UnlockScrollOnKBNavigation(); 14673 } 14674 if(this.GetIsNeedToCallbackLoadItemsToTop(newSelectedIndex, step, itemCount)) { 14675 this.LoadItemsOnCallback(true, newSelectedIndex); 14676 } else if(this.GetIsNeedToCallbackLoadItemsToBottom(newSelectedIndex, step, itemCount)) { 14677 this.LoadItemsOnCallback(false, newSelectedIndex); 14678 } 14679 this.itemsManager.MakeItemVisible(newSelectedIndex); 14680 } 14681 }, 14682 GetNewSelectedIndex: function(selectedIndex, step) { 14683 var pageDownSize = step == 1 ? this.scrollPageSize + 1 : this.scrollPageSize; 14684 var isFirstPageDown = selectedIndex == -1 && step == pageDownSize && step > 1; 14685 if(isFirstPageDown) 14686 step++; 14687 var newSelectedIndex = 0; 14688 var areThereUnfilteredItems = this.GetVisibleItemCount() < this.GetItemCount(); 14689 if(areThereUnfilteredItems) 14690 newSelectedIndex = this.itemsManager.GetNewItemIndexInFilteredRange(selectedIndex, step); 14691 else 14692 newSelectedIndex = selectedIndex + step; 14693 return newSelectedIndex; 14694 }, 14695 GetIsNeedToCallbackLoadItemsToTop: function(selectedIndex, step, itemCount){ 14696 return this.isCallbackMode && this.GetScrollSpacerVisibility(true) && 14697 this.serverIndexOfFirstItem > 0 && ((step < 0 && selectedIndex <= 0) || step <= -itemCount); 14698 }, 14699 GetIsNeedToCallbackLoadItemsToBottom: function(selectedIndex, step, itemCount){ 14700 return this.isCallbackMode && this.GetScrollSpacerVisibility(false) && 14701 ((step > 0 && selectedIndex >= itemCount - 1) || step >= itemCount); 14702 }, 14703 LoadItemsOnCallback: function(isToTop, index){ 14704 this.changeSelectAfterCallback = index - this.GetSelectedIndex(); 14705 this.scrollHelper.SetItemsRangeForLoad(isToTop); 14706 this.isComboBoxScrollingCallbackProcessing = this.isComboBoxList; 14707 this.SendCallback(); 14708 }, 14709 FindInputElement: function(){ 14710 if(this.accessibilityCompliant) 14711 return this.isComboBoxList ? null : this.GetAccessibilityAssistantElement(); 14712 return this.GetKBSInput(); 14713 },
14714 GetKBSInput: function() { 14715 return this.GetChildElement("KBS"); 14716 }, 14717 GetAccessibilityActiveElements: function() { 14718 var accessibilityElements = []; 14719 if(this.CheckColumnSelectionMode()) { 14720 for(var i = 0; i < this.GetItemCount() ; i++) { 14721 var checkBoxFocusableElement = this.GetCheckBoxFocusableElement(i); 14722 if(checkBoxFocusableElement) 14723 accessibilityElements.push(checkBoxFocusableElement); 14724 } 14725 } 14726 accessibilityElements.push(this.accessibilityCompliant ? this.GetAccessibilityHelper().GetActiveElement() : this.GetInputElement()); 14727 return accessibilityElements; 14728 }, 14729 SetHoverElement: function(element){ 14730 ASPx.GetStateController().SetCurrentHoverElementBySrcElement(element); 14731 }, 14732 InitOnContainerMadeVisible: function(){ 14733 this.AdjustControl(); 14734 }, 14735 ClearItemsCore: function(){ 14736 this.itemsManager.ClearItems(); 14737 this.EnsureFixWidthRow(); 14738 this.AddAccessibilityHeaderRow(); 14739 this.OnItemsCleared(); 14740 this.SetValue(null); 14741 }, 14742 OnItemsCleared: function(){ 14743 this.GetItemSelectionHelper().OnItemsCleared(); 14744 }, 14745 CorrectCellWidthsOnFirstRowItemReplacement: function(oldFirstRowItemIndex, newFirstRowItemIndex) { 14746 if (!this.ContainsFixWidthRow() && !this.HasVirtualScrolling()) { 14747 var oldFirstRowItemHasTemplate = this.ItemRowHasTemplate(oldFirstRowItemIndex); 14748 var newFirstRowItemHasTemplate = this.ItemRowHasTemplate(newFirstRowItemIndex); 14749 if(!oldFirstRowItemHasTemplate && !newFirstRowItemHasTemplate) 14750 this.CopyCellWidths(oldFirstRowItemIndex, newFirstRowItemIndex); 14751 } 14752 }, 14753 CopyCellWidths: function(sourceRowIndex, destinationRowIndex){ 14754 var cellCount = this.GetItemCellCount(); 14755 var sourceRow = this.GetItemRow(sourceRowIndex); 14756 var destRow = this.GetItemRow(destinationRowIndex); 14757 if (!sourceRow || !destRow) return; 14758 var lastDestCellIndex = destRow.cells.length - 1; 14759 for(var i = 0; i < lastDestCellIndex; i++) { 14760 destRow.cells[i].style.width = sourceRow.cells[i].style.width; 14761 } 14762 if(destRow.cells.length === cellCount) { 14763 destRow.cells[lastDestCellIndex].style.width = sourceRow.cells[lastDestCellIndex].style.width; 14764 } else { 14765 var cellWidths = ASPx.Data.CollectionToArray(sourceRow.cells) 14766 .slice(lastDestCellIndex) 14767 .map(function(cell) { return ASPx.PxToInt(cell.style.width); }) 14768 .reduce(function(accumulator, current) { return accumulator + current; }, 0); 14769 destRow.cells[lastDestCellIndex].style.width = cellWidths + "px"; 14770 } 14771 if(this.NeedToHandleCellWidth()) 14772 this.CorrectCellNullWidthStyle(destRow); 14773 }, 14774 RemoveItem: function (index) { 14775 var firstRenderedItem = this.itemsManager.GetFirstRenderedItem(); 14776 if (firstRenderedItem && index == firstRenderedItem.index && this.GetItemRow(firstRenderedItem.index + 1) !== null) 14777 this.CorrectCellWidthsOnFirstRowItemReplacement(firstRenderedItem.index, firstRenderedItem.index + 1); 14778 if (0 <= index && index < this.GetItemCount()) { 14779 this.UpdateSyncArraysItemDeleted(this.GetItem(index), true); 14780 this.itemsManager.RemoveItem(index); 14781 this.OnItemRemoved(index); 14782 } 14783 }, 14784 GetItem: function(index, preventEncodeText) { 14785 return this.itemsManager.GetItem(index, preventEncodeText); 14786 }, 14787 GetItemRowTexts: function(row) { 14788 var serializedTexts = this.GetTextsDataAttribute(row); 14789 if(ASPx.IsExists(serializedTexts)) 14790 return JSON.parse(serializedTexts); 14791 var texts = []; 14792 var i = this.GetItemFirstTextCellIndex(); 14793 var cellsLength = this.IsMultiColumn() ? row.cells.length : i + 1; 14794 for(; i < cellsLength; i++) { 14795 var textCell = row.cells[i]; 14796 texts.push(ASPxClientListBox.GetItemCellInnerText(textCell)); 14797 } 14798 return texts; 14799 }, 14800 ItemRowHasTemplate: function(itemIndex) { 14801 var itemRow = this.GetItemRow(itemIndex); 14802 return itemRow ? this.ItemRowHasTemplateCore(itemRow) : false; 14803 }, 14804 ItemRowHasTemplateCore: function(itemRow) { 14805 return this.ItemRowHasSerializedTextsAttr(itemRow); 14806 }, 14807 ItemRowHasSerializedTextsAttr: function(itemRow) { 14808 return ASPx.Attr.IsExistsAttribute(itemRow, itemSerializedTextsAttributeName); 14809 }, 14810 ItemCellHasTextAttr: function(itemTextCell) { 14811 return ASPx.Attr.IsExistsAttribute(itemTextCell, itemCellTextAttributeName); 14812 }, 14813 GetFirstVisibleItem: function() { 14814 return this.itemsManager.GetFirstVisibleItem(); 14815 }, 14816 GetFirstFilteredItemIndex: function () { 14817 return this.itemsManager.GetFirstFilteredItemIndex(); 14818 }, 14819 GetLastFilteredItemIndex: function() { 14820 return this.itemsManager.GetLastFilteredItemIndex(); 14821 }, 14822 GetNextFilteredItemIndex: function(currentFilteredItemIndex) { 14823 return this.itemsManager.GetNextFilteredItemIndex(currentFilteredItemIndex); 14824 }, 14825 GetPrevFilteredItemIndex: function(currentFilteredItemIndex) { 14826 return this.itemsManager.GetPrevFilteredItemIndex(currentFilteredItemIndex); 14827 }, 14828 PerformCallback: function(arg, onSuccess) { 14829 this.SetScrollSpacerVisibility(true, false); 14830 this.SetScrollSpacerVisibility(false, false); 14831 this.ClearItemsForPerformCallback(); 14832 this.serverIndexOfFirstItem = 0; 14833 this.SetScrollSpacerVisibility(true, false); 14834 this.SetScrollSpacerVisibility(false, false); 14835 this.FormatAndSetCustomCallbackArg(arg, true); 14836 this.SendCallback(onSuccess); 14837 this.FormatAndSetCustomCallbackArg(arg, false); 14838 }, 14839 GetTableRowParent: function(table){ 14840 if(table.tBodies.length > 0) 14841 return table.tBodies[0]; 14842 return table; 14843 }, 14844 ProtectWhitespaceSerieses: function(text){ 14845 if(text == "") 14846 text = nbsp; 14847 else { 14848 if(text.charAt(0) == ' ') 14849 text = nbsp + text.slice(1); 14850 if(text.charAt(text.length - 1) == ' ') 14851 text = text.slice(0, -1) + nbsp; 14852 text = text.replace(new RegExp(" ", "g"), " "); 14853 } 14854 return text; 14855 }, 14856 InsertItemInternal: function(index, itemProperties) { 14857 if(!this.hasSampleItem) 14858 return; 14859 this.AdjustItemProperties(itemProperties); 14860 ASPx.Data.ArrayInsert(this.itemsValue, itemProperties.value, index); 14861 this.itemsManager.InsertItem(index, itemProperties); 14862 this.RegisterInsertedItem(index, itemProperties); 14863 this.OnItemInserted(index); 14864 }, 14865 GetListTableRowBeforeNewItemRow: function (newItemIndex, listTable) { 14866 var lastRenderedItem = this.itemsManager.GetLastRenderedItem(); 14867 if (!lastRenderedItem || lastRenderedItem.index < newItemIndex) { 14868 var lastItemRow = lastRenderedItem ? this.GetItemRow(lastRenderedItem.index) : null; 14869 var lastListTableRow = listTable.rows[listTable.rows.length - 1]; 14870 if (lastItemRow) 14871 return lastItemRow === lastListTableRow ? null : lastItemRow.nextSibling; 14872 if (!!this.GetAccessibilityHeaderRow()) 14873 return this.ContainsFixWidthRow() ? listTable.rows[1] : listTable.rows[0]; 14874 return null; 14875 } 14876 for (var i = 0; i < listTable.rows.length; i++) 14877 if (this.GetItemIndexByRow(listTable.rows[i]) >= newItemIndex) 14878 return listTable.rows[i]; 14879 return null; 14880 }, 14881 AdjustItemProperties: function(itemProperties) { 14882 if(!itemProperties.texts || itemProperties.texts.length == 0) 14883 itemProperties.texts = [""]; 14884 else if(typeof (itemProperties.texts) === "string") 14885 itemProperties.texts = [itemProperties.texts]; 14886 if(typeof (itemProperties.value) === "undefined") 14887 itemProperties.value = itemProperties.texts[0]; 14888 if(!ASPx.IsExists(itemProperties.imageUrl) || itemProperties.imageUrl === "") 14889 itemProperties.imageUrl = this.defaultImageUrl; 14890 }, 14891 AddStateControllerClasses: function(itemId){
14892 var itemCellsIdPostfixes = this.GetItemCellsIdPostfixes(); 14893 var sampleItemFirstTextCell = this.GetSampleItemFirstTextCell(); 14894 var styleController = ASPx.GetStateController(); 14895 var hoverStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 14896 styleController.GetHoverElement(sampleItemFirstTextCell), ASPx.HoverItemKind); 14897 var selectedStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 14898 styleController.GetSelectedElement(sampleItemFirstTextCell), ASPx.SelectedItemKind); 14899 var disabledStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 14900 styleController.GetDisabledElement(sampleItemFirstTextCell), ASPx.DisabledItemKind); 14901 ASPx.AddHoverItems(this.name, hoverStyleClasses, true); 14902 ASPx.AddSelectedItems(this.name, selectedStyleClasses, true); 14903 ASPx.AddDisabledItems(this.name, disabledStyleClasses, true); 14904 ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.HoverItemKind); 14905 ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.SelectedItemKind); 14906 ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.DisabledItemKind); 14907 }, 14908 RemoveStateControllerClasses: function(itemId){ 14909 var itemCellsIdPostfixes = this.GetItemCellsIdPostfixes(); 14910 var classes = []; 14911 classes[0] = []; 14912 classes[0][0] = [itemId]; 14913 classes[0][1] = itemCellsIdPostfixes; 14914 ASPx.RemoveHoverItems(this.name, classes); 14915 ASPx.RemoveSelectedItems(this.name, classes); 14916 ASPx.RemoveDisabledItems(this.name, classes); 14917 }, 14918 GetCellInfo: function(index, infoArray) { 14919 if(!infoArray) return null; 14920 var filteredArray = infoArray.filter(function(info) { return info.index === index; }); 14921 return filteredArray.length ? filteredArray[0].value : null; 14922 }, 14923 PrepareItem: function(newItemRow, itemProperties) { 14924 var i = 0; 14925 if(this.GetIsCheckColumnExists()) 14926 i++; 14927 if(this.imageCellExists) { 14928 this.PrepareItemImage(newItemRow, i, itemProperties.imageUrl); 14929 i++; 14930 } 14931 if(itemProperties.htmlContent) { 14932 this.SetItemHtmlContent(newItemRow, itemProperties.htmlContent); 14933 this.SetTextsDataAttribute(newItemRow, itemProperties.texts); 14934 } else { 14935 this.SetItemTextContent(i, newItemRow, itemProperties); 14936 } 14937 this.AssignDecorationSettingsToElement(newItemRow, itemProperties.style, itemProperties.cssClass, itemProperties.tooltip, itemProperties.attributes); 14938 }, 14939 LockRunStartupSciptsInItemRow: function() { 14940 this.lockRunStartupScipts = true; 14941 }, 14942 UnlockRunStartupSciptsInItemRow: function() { 14943 this.lockRunStartupScipts = false; 14944 }, 14945 IsRunStartupSciptsInItemRowLocked: function() { 14946 return this.lockRunStartupScipts; 14947 }, 14948 EnsureStartupScriptsInContainer: function(container) { 14949 if(!this.InCallback() && !this.IsRunStartupSciptsInItemRowLocked()) 14950 ASPx.RunStartupScripts(false, container); 14951 }, 14952 SetItemHtml: function(index, html) { 14953 this.hasDecoratedItems = true; 14954 this.hasItemTemplate = true; 14955 this.EnsureFixWidthRow(true); 14956 this.itemsManager.SetItemHtml(index, html); 14957 this.ProcessItemRow(index, function(itemRow) { 14958 if(!this.ItemRowHasSerializedTextsAttr(itemRow)) 14959 this.SetTextsDataAttribute(itemRow, this.GetItem(index).texts); 14960 this.SetItemHtmlContent(itemRow, html); 14961 this.itemsManager.OnDecoratedItemsRendering(); 14962 }.bind(this)); 14963 }, 14964 SetTextsDataAttribute: function(itemRow, texts) { ASPx.Attr.SetAttribute(itemRow, itemSerializedTextsAttributeName, JSON.stringify(texts)); }, 14965 GetTextsDataAttribute: function(itemRow) { return ASPx.Attr.GetAttribute(itemRow, itemSerializedTextsAttributeName); }, 14966 SetItemTooltip: function(index, tooltip) { 14967 this.itemsManager.SetItemTooltip(index, tooltip); 14968 this.ProcessItemRow(index, function(itemRow) { this.SetElementTooltip(itemRow, tooltip); }.aspxBind(this)); 14969 }, 14970 SetItemAttribute: function(index, attributeName, attributeValue) { 14971 this.itemsManager.SetItemAttribute(index, attributeName, attributeValue); 14972 this.ProcessItemRow(index, function(itemRow) { ASPx.Attr.SetAttribute(itemRow, attributeName, attributeValue); }.aspxBind(this)); 14973 }, 14974 AddItemCssClass: function(index, className) { 14975 this.hasDecoratedItems = true; 14976 this.itemsManager.AddItemCssClass(index, className); 14977 this.ProcessItemRow(index, function(itemRow) { 14978 ASPx.AddClassNameToElement(itemRow, className); 14979 this.itemsManager.OnDecoratedItemsRendering(); 14980 }.bind(this)); 14981 }, 14982 RemoveItemCssClass: function(index, className) { 14983 this.hasDecoratedItems = true; 14984 this.itemsManager.RemoveItemCssClass(index, className); 14985 this.ProcessItemRow(index, function(itemRow) { 14986 ASPx.RemoveClassNameFromElement(itemRow, className); 14987 this.itemsManager.OnDecoratedItemsRendering(); 14988 }.bind(this)); 14989 }, 14990 SetItemTextCellHtml: function(itemIndex, textCellIndex, html) { 14991 this.hasDecoratedItems = true; 14992 this.itemsManager.SetItemTextCellHtml(itemIndex, textCellIndex, html); 14993 this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) {
14994 if(!this.ItemCellHasTextAttr(textCell)) 14995 this.SetItemCellTextDataAttribute(textCell, this.GetItem(itemIndex).texts[textCellIndex]); 14996 this.SetItemTextCellHtmlContent(textCell, html); 14997 this.itemsManager.OnDecoratedItemsRendering(); 14998 }.aspxBind(this)); 14999 }, 15000 SetItemCellTextDataAttribute: function(textCell, text) { 15001 ASPx.Attr.SetAttribute(textCell, itemCellTextAttributeName, text); 15002 }, 15003 SetItemTextCellTooltip: function(itemIndex, textCellIndex, tooltip) { 15004 this.itemsManager.SetItemTextCellTooltip(itemIndex, textCellIndex, tooltip); 15005 this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { this.SetElementTooltip(textCell, tooltip); }.aspxBind(this)); 15006 }, 15007 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attributeName, attributeValue) { 15008 this.itemsManager.SetItemTextCellAttribute(itemIndex, textCellIndex, attributeName, attributeValue); 15009 this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { ASPx.Attr.SetAttribute(textCell, attributeName, attributeValue); }.aspxBind(this)); 15010 }, 15011 AddItemTextCellCssClass: function(itemIndex, textCellIndex, className) { 15012 this.hasDecoratedItems = true; 15013 this.itemsManager.AddItemTextCellCssClass(itemIndex, textCellIndex, className); 15014 this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { 15015 ASPx.AddClassNameToElement(textCell, className); 15016 this.itemsManager.OnDecoratedItemsRendering(); 15017 }.bind(this)); 15018 }, 15019 RemoveItemTextCellCssClass: function(itemIndex, textCellIndex, className) { 15020 this.hasDecoratedItems = true; 15021 this.itemsManager.RemoveItemTextCellCssClass(itemIndex, textCellIndex, className); 15022 this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { 15023 ASPx.RemoveClassNameFromElement(textCell, className); 15024 this.itemsManager.OnDecoratedItemsRendering(); 15025 }.bind(this)); 15026 }, 15027 ProcessItemRow: function(index, action) { 15028 var itemRow = this.GetItemRow(index); 15029 if(itemRow) 15030 action(itemRow); 15031 }, 15032 ProcessItemTextCell: function(itemIndex, textCellIndex, action) { 15033 var itemTextCell = this.GetItemTextCell(itemIndex, textCellIndex); 15034 if(itemTextCell && !this.ItemRowHasTemplateCore(itemTextCell.parentNode)) 15035 action(itemTextCell); 15036 }, 15037 SetItemHtmlContent: function(itemRow, html) { 15038 var redundantCells = ASPx.Data.CollectionToArray(itemRow.cells) 15039 .slice(this.GetItemFirstTextCellIndex(), itemRow.cells.length - 1); 15040 redundantCells.forEach(function(cell) { itemRow.removeChild(cell); }); 15041 var itemHtmlContainerCell = itemRow.cells[itemRow.cells.length - 1]; 15042 ASPx.SetElementDisplay(itemHtmlContainerCell, this.GetVisibleColumnCount() !== 0); 15043 itemHtmlContainerCell.colSpan = Math.max(itemHtmlContainerCell.colSpan, this.GetVisibleColumnCount()); 15044 if(this.IsMultiColumn()) { 15045 if(this.GetItemFirstTextCellIndex() === 0) 15046 ASPx.AddClassNameToElement(itemHtmlContainerCell, FIRST_CELL_MARKER_CSS_CLASS_NAME); 15047 ASPx.AddClassNameToElement(itemHtmlContainerCell, LAST_CELL_MARKER_CSS_CLASS_NAME); 15048 } 15049 itemHtmlContainerCell.style.width = ""; 15050 itemHtmlContainerCell.innerHTML = html; 15051 this.RemoveEllipsisFromNode(itemHtmlContainerCell); 15052 this.EnsureStartupScriptsInContainer(itemHtmlContainerCell); 15053 }, 15054 SetItemTextContent: function(textCellIndex, newItemRow, itemProperties) { 15055 var cellCount = this.GetItemCellCount(); 15056 for(var j = 0; textCellIndex < cellCount; textCellIndex++, j++) { 15057 var cellStyle = this.GetCellInfo(j, itemProperties.cellStyles); 15058 var cellCssClass = this.GetCellInfo(j, itemProperties.cellCssClasses); 15059 var cellTooltip = this.GetCellInfo(j, itemProperties.cellTooltips); 15060 var cellAttributes = this.GetCellInfo(j, itemProperties.cellAttributes); 15061 var htmlContent = this.GetCellInfo(j, itemProperties.htmlContents); 15062 this.PrepareItemTextCell(newItemRow.cells[textCellIndex], itemProperties.texts[j], cellStyle, cellCssClass, cellTooltip, cellAttributes, htmlContent); 15063 } 15064 }, 15065 SetItemTextCellHtmlContent: function(cell, html) { 15066 cell.innerHTML = html; 15067 this.RemoveEllipsisFromNode(cell); 15068 this.EnsureStartupScriptsInContainer(cell); 15069 }, 15070 PrepareItemImage: function(newItemRow, imageCellIndex, imageUrl){ 15071 var imageCell = newItemRow.cells[imageCellIndex]; 15072 var image = ASPx.GetNodeByTagName(imageCell, "IMG", 0); 15073 if(!imageUrl) { 15074 if(image) 15075 ASPx.RemoveElement(image); 15076 imageCell.innerHTML = " "; 15077 } else { 15078 if(!image) { 15079 image = document.createElement("IMG"); 15080 imageCell.innerHTML = "";
15081 imageCell.appendChild(image); 15082 } 15083 ASPx.ImageUtils.SetImageSrc(image, imageUrl); 15084 } 15085 }, 15086 PrepareItemTextCell: function(cell, text, style, cssClass, tooltip, attributes, htmlContent) { 15087 if(!ASPx.IsExists(text)) 15088 text = ""; 15089 if(this.encodeHtml) 15090 text = ASPx.Str.EncodeHtml(text); 15091 if(htmlContent) { 15092 this.SetItemTextCellHtmlContent(cell, htmlContent); 15093 this.SetItemCellTextDataAttribute(cell, this.ProtectWhitespaceSerieses(text)); 15094 } 15095 else { 15096 cell.innerHTML = this.ProtectWhitespaceSerieses(text); 15097 if(this.enableEllipsis) 15098 ASPx.AddClassNameToElement(cell, ASPx.ELLIPSIS_MARKER_CLASS); 15099 } 15100 this.AssignDecorationSettingsToElement(cell, style, cssClass, tooltip, attributes); 15101 if(text == "") 15102 ASPx.Attr.SetAttribute(cell, "DXText", text); 15103 }, 15104 AssignDecorationSettingsToElement: function(element, style, cssClass, tooltip, attributes) { 15105 if(cssClass) 15106 ASPx.AddClassNameToElement(element, cssClass); 15107 if(style) { 15108 var styleSheet = ASPx.GetCurrentStyleSheet(); 15109 ASPx.AddClassNameToElement(element, ASPx.CreateImportantStyleRule(styleSheet, style)); 15110 } 15111 if(tooltip) 15112 this.SetElementTooltip(element, tooltip); 15113 if(attributes) 15114 for(var key in attributes) 15115 if(attributes.hasOwnProperty(key)) 15116 ASPx.Attr.SetAttribute(element, key, attributes[key]); 15117 }, 15118 SetElementTooltip: function(element, tooltip) { 15119 this.RemoveEllipsisTooltip(element); 15120 ASPx.Attr.SetAttribute(element, "title", tooltip); 15121 }, 15122 FormatText: function(texts, value) { 15123 if(typeof(texts) === "string") 15124 return texts; 15125 else if(!this.IsMultiColumn()) 15126 return texts[0]; 15127 else 15128 return this.FormatTextCore(texts, value); 15129 }, 15130 FormatTextCore: function(texts, value) { 15131 var result = ""; 15132 if(this.isComboBoxList) { 15133 if(this.nullValueItemDisplayText !== null && value === null) 15134 result = this.nullValueItemDisplayText; 15135 else 15136 result = ASPx.Formatter.Format(this.textFormatString, texts); 15137 } else 15138 result = texts.join("; "); 15139 return result; 15140 }, 15141 OnItemInserted: function(index){ 15142 this.GetItemSelectionHelper().OnItemInserted(index); 15143 }, 15144 OnItemRemoved: function(index){ 15145 this.GetItemSelectionHelper().OnItemRemoved(index); 15146 }, 15147 CreateItemId: function(index){ 15148 return lbIIdSuffix + index; 15149 }, 15150 CreateItemClientId: function(index){ 15151 return this.name + "_" + lbIIdSuffix + index; 15152 }, 15153 CreateStyleClasses: function(id, postfixes, item, kind){ 15154 var classes = []; 15155 if(item && item[kind]){ 15156 classes[0] = []; 15157 classes[0][0] = item[kind].classNames; 15158 classes[0][1] = item[kind].cssTexts; 15159 classes[0][2] = []; 15160 classes[0][2][0] = id; 15161 classes[0][3] = postfixes; 15162 } 15163 return classes; 15164 }, 15165 CorrectSizeByTimer: function(){ 15166 if(this.APILockCount == 0 && this.IsDisplayed()) 15167 window.setTimeout(function() { this.OnCorrectSizeByTimer(); }.aspxBind(this), 0); 15168 }, 15169 FindFreeIndex: function(){ 15170 return this.freeUniqIndex ++; 15171 }, 15172 GetSampleItemRowID: function(){ 15173 return this.name + "_" + lbSIIdSuffix; 15174 }, 15175 GetAccessibilitySampleHeaderRowID: function() { 15176 return this.name + "_" + lbAIRTIdSuffix; 15177 }, 15178 GetSampleItemRow: function(){ 15179 if(this.SampleItem == null) 15180 this.SampleItem = ASPx.GetElementById(this.GetSampleItemRowID()); 15181 return this.SampleItem; 15182 }, 15183 GetAccessibilitySampleHeaderRow: function() { 15184 if(this.sampleHeaderRow == null) 15185 this.sampleHeaderRow = ASPx.GetElementById(this.GetAccessibilitySampleHeaderRowID()); 15186 return this.sampleHeaderRow; 15187 }, 15188 AddAccessibilityHeaderRow: function() { 15189 if(!this.HasAccessibilityHeaderRow()) return; 15190 var listTableBody = ASPx.GetChildByTagName(this.GetListTable(), "TBODY", 0); 15191 var headerRow = this.GetAccessibilitySampleHeaderRow().cloneNode(true); 15192 headerRow.id = this.GetAccessibilityHeaderRowID(); 15193 listTableBody.appendChild(headerRow); 15194 }, 15195 HasAccessibilityHeaderRow: function() { 15196 return this.accessibilityCompliant && this.IsMultiColumn(); 15197 }, 15198 GetAccessibilityHeaderRow: function() { 15199 return this.GetChildElement(lbAIRIdSuffix); 15200 }, 15201 RemoveAccessibilityHeaderRow: function() { 15202 var headerRow = this.GetAccessibilityHeaderRow(); 15203 if(headerRow) 15204 ASPx.RemoveElement(headerRow); 15205 }, 15206 GetAccessibilityHeaderRowID: function() { 15207 return this.name + "_" + lbAIRIdSuffix; 15208 }, 15209 GetSampleItemFirstTextCell: function(){ 15210 if(!ASPx.IsExistsElement(this.sampleItemFirstTextCell)){ 15211 var sampleItemRow = this.GetSampleItemRow(); 15212 if(ASPx.IsExistsElement(sampleItemRow)) 15213 this.sampleItemFirstTextCell = sampleItemRow.cells[this.imageCellExists ? 1 : 0]; 15214 } 15215 return this.sampleItemFirstTextCell; 15216 }, 15217 ChangeEnabledAttributes: function(enabled){ 15218 this.ChangeListTableEvents(this.GetListTable(), ASPx.Attr.ChangeEventsMethod(enabled)); 15219 var focusableElement = this.GetInputElement(); 15220 if(focusableElement) { 15221 this.ChangeSpecialInputEnabledAttributes(focusableElement, ASPx.Attr.ChangeEventsMethod(enabled)); 15222 if(this.accessibilityCompliant) 15223 this.ChangeFocusableElementTabIndex(focusableElement, enabled); 15224 else if(!this.isComboBoxList) { 15225 var changeMethod = enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset; 15226 changeMethod(focusableElement); 15227 } 15228 } 15229 }, 15230 ChangeFocusableElementTabIndex: function(focusableElement, enabled) { 15231 if(!this.isComboBoxList) { 15232 if(enabled) 15233 ASPx.Attr.SetAttribute(focusableElement, "tabindex", "0"); 15234 else 15235 focusableElement.removeAttribute("tabindex"); 15236 } 15237 }, 15238 ChangeEnabledStateItems: function(enabled){ 15239 var controller = ASPx.GetStateController(); 15240 controller.SetElementEnabled(this.GetMainElement(), enabled); 15241 var count = this.GetItemCount(); 15242 var i = this.hasSampleItem ? -1 : 0 ; 15243 for(; i < count; i ++){ 15244 this.ChangeEnabledStateItem(i, enabled, controller); 15245 }
15246 this.changeSelectAllElementsEnabledState(enabled); 15247 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled); 15248 if(this.filteringTextBox && !this.customFilteringEditorID) { 15249 this.filteringTextBox.SetEnabled(enabled); 15250 this.ChangeSpecialInputEnabledAttributes(this.filteringTextBox.GetInputElement(), changeEventMethod, true); 15251 } 15252 if(this.showFilterButton) { 15253 this.showFilterButton.SetEnabled(enabled); 15254 this.ChangeSpecialInputEnabledAttributes(this.showFilterButton.GetInternalButton(), changeEventMethod, true); 15255 } 15256 }, 15257 ChangeEnabledStateItem: function (index, enabled, controller) { 15258 var element = this.GetItemFirstTextCell(index); 15259 if (element) 15260 controller.SetElementEnabled(element, enabled); 15261 if (this.GetIsCheckColumnExists() && index >= 0) 15262 this.SetCheckBoxEnabled(index, enabled); 15263 }, 15264 ChangeListTableEvents: function(listTable, method){ 15265 if(this.isComboBoxList){ 15266 method(listTable, "mouseup", aspxLBIClick); 15267 if(ASPx.Browser.Firefox) 15268 method(listTable, "mousedown", ASPx.Evt.PreventEvent); 15269 } 15270 else{ 15271 method(listTable, "click", aspxLBIClick); 15272 method(listTable, "dblclick", aspxLBIClick); 15273 if(this.MultiSelectionMode()) 15274 this.AttachSelectStartHandlerToElement(listTable); 15275 } 15276 }, 15277 AttachSelectStartHandlerToElement: function(element) { 15278 ASPx.Evt.AttachEventToElement(element, "selectstart", aspxLBTSelectStart); 15279 }, 15280 IsValueChanged: function(){ 15281 return this.cachedValue != this.GetValue(); 15282 }, 15283 OnItemSelectionChanged: function(index, selected, fromSelectAllClick, forceValueChanged){ 15284 if(this.CheckColumnSelectionMode() && !fromSelectAllClick) 15285 this.SetCheckBoxChecked(index, selected); 15286 if(!this.IsSelectionEventsLocked()) { 15287 this.SetRaiseSelectedIndexChangedArguments(this.autoPostBack, index, selected); 15288 var valueChanged = this.IsValueChanged() || forceValueChanged; 15289 if(valueChanged) { 15290 this.RaisePersonalStandardValidation(); 15291 this.OnValueChanged(); 15292 } else { 15293 if(this.RaiseSelectedIndexChanged()) 15294 this.SendPostBackInternal(""); 15295 } 15296 } 15297 this.CacheValue(); 15298 if(this.accessibilityCompliant && !fromSelectAllClick) 15299 this.GetAccessibilityHelper().OnSelectedIndexChanged(index); 15300 }, 15301 SetRaiseSelectedIndexChangedArguments: function(processOnServer, index, selected){ 15302 this.selectedIndexChangedArguments = { 15303 processOnServer: processOnServer, 15304 index: index, 15305 selected: selected 15306 }; 15307 }, 15308 GetRaiseSelectedIndexChangedArguments: function(){ 15309 if(!this.selectedIndexChangedArguments) 15310 this.SetRaiseSelectedIndexChangedArguments(false, this.GetSelectedIndex(), true); 15311 return this.selectedIndexChangedArguments; 15312 }, 15313 RaiseSelectedIndexChanged: function (processOnServer) { 15314 this.RaiseValidationInternal(); 15315 var savedArgs = this.GetRaiseSelectedIndexChangedArguments(); 15316 processOnServer = savedArgs.processOnServer || processOnServer; 15317 if(!this.SelectedIndexChanged.IsEmpty()){ 15318 var args = new ASPxClientListEditItemSelectedChangedEventArgs(savedArgs.index, savedArgs.selected, processOnServer); 15319 this.SelectedIndexChanged.FireEvent(this, args); 15320 processOnServer = args.processOnServer; 15321 } 15322 return processOnServer; 15323 }, 15324 RaiseItemFiltering: function(item, filter, isFit) { 15325 if(!this.ItemFiltering.IsEmpty()) { 15326 var args = new ASPxClientListEditItemFilteringEventArgs(item, filter, isFit); 15327 this.ItemFiltering.FireEvent(this, args); 15328 isFit = args.isFit; 15329 } 15330 return isFit; 15331 }, 15332 RaiseCustomHighlighting: function(filter, callbackHighlighting) { 15333 if(!this.CustomHighlighting.IsEmpty()) { 15334 var args = new ASPxClientListEditCustomHighlightingEventArgs(filter); 15335 args.highlighting = callbackHighlighting; 15336 this.CustomHighlighting.FireEvent(this, args); 15337 return args.highlighting; 15338 } 15339 return callbackHighlighting; 15340 }, 15341 SetWidth: function(width) { 15342 this.width = width + "px"; 15343 this.GetScrollDivElement().style.width = "100%"; 15344 ASPxClientListBoxBase.prototype.SetWidth.call(this, width); 15345 }, 15346 SetHeight: function(height) { 15347 this.heightCorrected = false; 15348 ASPxClientListBoxBase.prototype.SetHeight.call(this, height); 15349 this.CorrectHeight(); 15350 }, 15351 OnAssociatedLabelClick: function(focusableElement) { 15352 var isValidElement = focusableElement && ASPx.IsActionElement(focusableElement) && ASPx.GetIsParent(this.GetMainElement(), focusableElement); 15353 if(isValidElement) 15354 focusableElement.focus(); 15355 else 15356 ASPxClientListBoxBase.prototype.OnDelayedSpecialFocusMouseDown.call(this, null); 15357 }, 15358 TryApplyHighlighting: function() { 15359 var ownerControl = this.GetCallbackOwnerControl(); 15360 var filterStrategy = ownerControl && ownerControl.filterStrategy ? ownerControl.filterStrategy : this.filterStrategy; 15361 if(filterStrategy && filterStrategy.ApplyHighlighting)
15362 filterStrategy.ApplyHighlighting(); 15363 }, 15364 onDropDownModalChanged: function(enabled) { 15365 if(!this.IsMultiColumn()) 15366 return; 15367 if(enabled && !this.itemsManager.GetFirstVisibleItemRow()) 15368 return; 15369 this.updateCellWidthsOnDropDownChanged(enabled); 15370 }, 15371 updateCellWidthsOnDropDownChanged: function(enabled) { 15372 var applyFunction = this.getUpdateCellWidthsFunctionOnDropDownChanged(enabled); 15373 var sampleRow = this.GetSampleItemRow(); 15374 var headerRow = this.GetHeaderTableElement().rows[0]; 15375 var dataRows = this.itemsManager.GetListTableRows(); 15376 for(var i = this.columnFieldNames.length - 1; i >= 0; i--) { 15377 applyFunction(sampleRow, i); 15378 applyFunction(headerRow, i); 15379 for(var row, j = 0; row = dataRows[j]; j++) 15380 applyFunction(row, i); 15381 } 15382 }, 15383 getUpdateCellWidthsFunctionOnDropDownChanged: function(enabled) { 15384 if(enabled) { 15385 var row = this.itemsManager.GetFirstVisibleItemRow(); 15386 var widths = Array.prototype.slice.call(row.cells, 0).map(function(cell) { return cell.offsetWidth; }); 15387 var commonWidth = widths.reduce(function(a, b) { return a + b; }, 0); 15388 widths = widths.map(function(w) { return (w * 100) / commonWidth; }); 15389 return function(row, cellIndex) { 15390 ASPx.Attr.ChangeStyleAttribute(row.cells[cellIndex], "width", widths[cellIndex] + "%"); 15391 }; 15392 } 15393 return function(row, cellIndex) { 15394 ASPx.Attr.RestoreStyleAttribute(row.cells[cellIndex], "width"); 15395 }; 15396 } 15397}); 15398ASPxClientListBox.GetItemCellInnerText = function(itemTextCell) { 15399 var text; 15400 if(typeof(itemTextCell.attributes["DXText"]) != "undefined") 15401 text = ASPx.Attr.GetAttribute(itemTextCell, "DXText"); 15402 else { 15403 var itemCellTextAttribute = ASPx.Attr.GetAttribute(itemTextCell, itemCellTextAttributeName); 15404 text = ASPx.IsExists(itemCellTextAttribute) ? itemCellTextAttribute : ASPx.GetInnerText(itemTextCell); 15405 } 15406 text = text.replace(new RegExp(nbspChar, "g"), " "); 15407 return text; 15408}; 15409var ASPxClientNativeListBox = ASPx.CreateClass(ASPxClientListBoxBase, { 15410 constructor: function(name) { 15411 this.constructor.prototype.constructor.call(this, name); 15412 }, 15413 InitializeEvents: function() { 15414 ASPxClientListBoxBase.prototype.InitializeEvents.call(this); 15415 if(!!this.GetMainElement()) { 15416 ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keydown", this.OnKeyDown.aspxBind(this)); 15417 ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keyup", this.OnKeyUp.aspxBind(this)); 15418 ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keypress", this.OnKeyPress.aspxBind(this)); 15419 } 15420 }, 15421 SetReadOnlyInternal: function(readOnly) { 15422 ASPxClientListBoxBase.prototype.SetReadOnlyInternal.call(this, readOnly); 15423 var options = this.GetMainElement().querySelectorAll("option"); 15424 for (var i = 0, option; option = options[i]; i++) { 15425 if (readOnly) 15426 ASPx.Attr.SetAttribute(option, "disabled", "disabled"); 15427 else 15428 ASPx.Attr.RemoveAttribute(option, "disabled"); 15429 } 15430 }, 15431 SetMainElement: function(mainElement){ 15432 this.mainElement = mainElement; 15433 }, 15434 FindInputElement: function(){ 15435 return this.GetMainElement(); 15436 }, 15437 GetOptionCount: function(){ 15438 return this.GetMainElement().options.length; 15439 }, 15440 GetOption: function(index){ 15441 return this.GetMainElement().options[index]; 15442 }, 15443 GetItemCount: function(){ 15444 return this.GetOptionCount(); 15445 }, 15446 SelectIndexSilent: function(index){ 15447 var selectedIndex = this.GetSelectedIndexInternal(); 15448 var isValidIndex = (-1 <= index && index < this.GetItemCount()); 15449 if((selectedIndex != index && isValidIndex) || !this.isInitialized){ 15450 this.SetSelectedIndexInternal(index); 15451 return true; 15452 } 15453 return false; 15454 }, 15455 GetSelectedIndexInternal: function(){ 15456 return this.GetMainElement().selectedIndex; 15457 }, 15458 SetSelectedIndexInternal: function(index){ 15459 this.GetMainElement().selectedIndex = index; 15460 }, 15461 ClearItemsCore: function(){ 15462 this.GetMainElement().innerHTML = ""; 15463 }, 15464 RemoveItem: function(index){ 15465 if(0 <= index && index < this.GetItemCount()){ 15466 var oldSelectedIndex = this.GetSelectedIndexInternal(); 15467 this.UpdateSyncArraysItemDeleted(this.GetItem(index), true); 15468 var option = this.GetOption(index); 15469 this.GetMainElement().removeChild(option); 15470 this.UpdateOptionValues();
15471 this.OnItemRemoved(oldSelectedIndex, index); 15472 } 15473 }, 15474 OnItemRemoved: function(oldSelectedIndex, newSelectedIndex){ 15475 if(newSelectedIndex == oldSelectedIndex && !this.MultiSelectionMode()) 15476 this.SetSelectedIndexInternal(-1); 15477 }, 15478 MultiSelectionMode: function(){ 15479 return this.GetMainElement().multiple; 15480 }, 15481 GetItem: function(index){ 15482 if(0 <= index && index < this.GetOptionCount()) { 15483 var text = this.GetOption(index).text; 15484 var selected = this.GetMainElement().options[index].selected; 15485 var itemValue = this.itemsValue[index] !== undefined ? this.itemsValue[index] : null; 15486 if(ASPx.IsExists(text)) 15487 return new ASPxClientListBoxItem(this, index, text, itemValue, "", selected); 15488 } 15489 return null; 15490 }, 15491 PerformCallback: function(arg) { 15492 this.ClearItemsForPerformCallback(); 15493 this.FormatAndSetCustomCallbackArg(arg, true); 15494 this.SendCallback(); 15495 this.FormatAndSetCustomCallbackArg(arg, false); 15496 }, 15497 SendCallback: function(){ 15498 if(!this.InCallback()){ 15499 var callbackOwner = this.GetCallbackOwnerControl(); 15500 if(callbackOwner != null) 15501 callbackOwner.SendCallback(); 15502 else { 15503 var argument = this.GetCallbackArguments(); 15504 this.CreateCallback(argument); 15505 } 15506 } 15507 }, 15508 ParseCallbackResult: function(result){ 15509 var deserializedItems = this.DeserializeItems(result[CONSTANTS.CALLBACK_RESULTS.ITEMS]); 15510 this.LoadItemsFromCallback(true, deserializedItems); 15511 }, 15512 InsertItemInternal: function(index, itemProperties) { 15513 if(typeof (itemProperties.value) == "undefined") 15514 itemProperties.value = itemProperties.texts; 15515 var oldSelectedIndex = this.GetSelectedIndexInternal(); 15516 var isAdd = this.GetOptionCount() <= index; 15517 var newOption = document.createElement("OPTION"); 15518 if(isAdd) 15519 this.GetMainElement().appendChild(newOption); 15520 else 15521 this.GetMainElement().insertBefore(newOption, this.GetOption(index)); 15522 newOption.innerHTML = itemProperties.texts; 15523 this.UpdateOptionValues(); 15524 ASPx.Data.ArrayInsert(this.itemsValue, itemProperties.value, index); 15525 this.RegisterInsertedItem(index, itemProperties); 15526 if(index == oldSelectedIndex && index != -1) 15527 this.SetSelectedIndex(index + 1); 15528 }, 15529 UpdateOptionValues: function() { 15530 if(this.APILockCount == 0){ 15531 for(var i = 0; i < this.GetOptionCount(); i++) 15532 this.GetOption(i).value = i; 15533 } 15534 }, 15535 ChangeEnabledAttributes: function(enabled){ 15536 if(!this.isComboBoxList) { 15537 this.GetMainElement().disabled = !enabled; 15538 this.ChangeSpecialInputEnabledAttributes(this.GetMainElement(), ASPx.Attr.ChangeEventsMethod(enabled), true); 15539 } 15540 }, 15541 OnCallback: function(result) { 15542 this.ParseCallbackResult(result); 15543 }, 15544 OnItemDblClick: function(){ 15545 this.RaiseItemDoubleClick(); 15546 }, 15547 LoadItemsFromCallback: function(isToTop, deserializedItems){ 15548 this.BeginUpdate(); 15549 this.LockSynchronizationOnInternalCallback(); 15550 var mainElement = this.GetMainElement(); 15551 for(var i = deserializedItems.length - 1; i >= 0; i--) { 15552 this.InsertItemInternal(0, deserializedItems[i]); 15553 if(deserializedItems[i].selected) 15554 mainElement.options[0].selected = true; 15555 } 15556 this.UnlockSynchronizationOnInternalCallback(); 15557 this.EndUpdate(); 15558 }, 15559 EndUpdate: function(){ 15560 ASPxClientListBoxBase.prototype.EndUpdate.call(this); 15561 this.UpdateOptionValues(); 15562 }, 15563 GetSelectedIndices: function(){ 15564 var selectedIndices = []; 15565 var mainElement = this.GetMainElement(); 15566 for(var i = 0; i < mainElement.options.length; i++){ 15567 if(mainElement.options[i].selected) 15568 selectedIndices.push(i); 15569 } 15570 return selectedIndices; 15571 }, 15572 GetSelectedValues: function(){ 15573 var selectedValues = []; 15574 var selectedIndices = this.GetSelectedIndices(); 15575 for(var i = 0; i < selectedIndices.length; i++) 15576 selectedValues.push(this.GetItemValue(selectedIndices[i])); 15577 return selectedValues; 15578 }, 15579 GetSelectedItems: function(){ 15580 var selectedItems = []; 15581 var selectedIndices = this.GetSelectedIndices(); 15582 for(var i = 0; i < selectedIndices.length; i++) 15583 selectedItems.push(this.GetItem(selectedIndices[i])); 15584 return selectedItems; 15585 }, 15586 SelectAll: function(){ 15587 this.SetAllItemsSelectedValue(true); 15588 }, 15589 UnselectAll: function(){ 15590 this.SetAllItemsSelectedValue(false); 15591 }, 15592 SetAllItemsSelectedValue: function(selected){ 15593 var mainElement = this.GetMainElement(); 15594 for(var i = 0; i < mainElement.options.length; i++) 15595 mainElement.options[i].selected = selected; 15596 }, 15597 SelectIndices: function(indices){ 15598 this.SetIndicesSelectionState(indices, true); 15599 }, 15600 UnselectIndices: function(indices){ 15601 this.SetIndicesSelectionState(indices, false); 15602 }, 15603 SetIndicesSelectionState: function(indices, selected){ 15604 var mainElement = this.GetMainElement(); 15605 for(var i = 0; i < indices.length; i++){ 15606 mainElement.options[indices[i]].selected = selected; 15607 } 15608 }, 15609 SelectItems: function(items){ 15610 if(ASPx.IsExists(items)) 15611 this.SetItemsSelectionState(items, true); 15612 else 15613 this.SelectAll(); 15614 }, 15615 UnselectItems: function(items){ 15616 if(ASPx.IsExists(items)) 15617 this.SetItemsSelectionState(items, false); 15618 else 15619 this.UnselectAll(); 15620 }, 15621 SetItemsSelectionState: function(items, selected){ 15622 var mainElement = this.GetMainElement(); 15623 for(var i = 0; i < items.length; i++){ 15624 mainElement.options[items[i].index].selected = selected; 15625 } 15626 }, 15627 SelectValues: function(values){ 15628 this.SetValuesSelectedState(values, true); 15629 }, 15630 UnselectValues: function(values){ 15631 this.SetValuesSelectedState(values, false); 15632 }, 15633 SetValuesSelectedState: function(values, selected){ 15634 var mainElement = this.GetMainElement(); 15635 var index; 15636 for(var i = 0; i < values.length; i++){ 15637 index = this.FindItemIndexByValue(values[i]); 15638 mainElement.options[index].selected = selected; 15639 } 15640 }, 15641 EnsureRequiredNativeAttributesExists: function() { 15642 var input = this.GetInputElement(); 15643 if(!input.onchange) 15644 ASPx.Evt.AttachEventToElement(input, "change", function() { ASPx.EValueChanged(this.name); }.aspxBind(this)); 15645 } 15646}); 15647var AccessibilityHelperListBox = ASPx.CreateClass(ASPx.AccessibilityHelper, { 15648 constructor: function(listBox) { 15649 this.constructor.prototype.constructor.call(this, listBox); 15650 this.checkBoxRefocusTimeout = 1000; 15651 this.firstReadingColumnIndex = this.control.CheckColumnSelectionMode() ? 1 : 0; 15652 this.Initialize(); 15653 }, 15654 Initialize: function() { 15655 if(this.control.CheckColumnSelectionMode() && !this.control.IsNativeCheckBoxes())
15656 this.control.GotFocus.AddHandler(function() { this.SetActionElementFocus(); }.aspxBind(this)); 15657 this.control.GotFocus.AddHandler(function() { this.OnSelectedIndexChanged(this.control.GetSelectedIndex()); }.aspxBind(this)); 15658 this.control.LostFocus.AddHandler(function() { 15659 setTimeout(function() { 15660 this.changeActivityAttributes(this.getMainElement(), { "aria-activedescendant": "" }); 15661 }.aspxBind(this), 200); 15662 }.aspxBind(this)); 15663 }, 15664 OnSelectedIndexChanged: function(index) { 15665 var stateSelected = index != -1 && this.control.GetItem(index) && this.control.GetItem(index).selected; 15666 var selectedIndex = this.control.GetSelectedIndex(); 15667 if(this.control.CheckColumnSelectionMode() || stateSelected || selectedIndex == -1) 15668 this.setSelectionAttributes(index, stateSelected); 15669 }, 15670 getPronounceTimeout: function() { 15671 if(ASPx.Browser.WebKitFamily && this.control.CheckColumnSelectionMode()) 15672 return 1000; 15673 return ASPx.AccessibilityHelper.prototype.getPronounceTimeout.call(this); 15674 }, 15675 getHeaderCellCaptionText: function(index) { 15676 var headerDiv = this.control.GetHeaderDivElement(); 15677 if(!headerDiv) return ""; 15678 var headerTable = headerDiv.firstElementChild; 15679 return headerTable.rows[0].cells[this.firstReadingColumnIndex + index].textContent; 15680 }, 15681 isItemCheckBoxFocused: function() { 15682 for(var i = 0; i < this.control.GetItemCount() ; i++) { 15683 var internalCheckBox = this.control.GetInternalCheckBox(i); 15684 if(internalCheckBox && internalCheckBox.focused) 15685 return true; 15686 } 15687 return false; 15688 }, 15689 isSelectAllCheckBoxFocused: function() { 15690 return this.control.selectAllCheckBox && this.control.selectAllCheckBox.focused; 15691 }, 15692 SetActionElementFocus: function() { 15693 if(this.control.enableFiltering) { 15694 if(!this.control.HasInternalFilteringTextBoxFocus()) 15695 this.SetFilterPanelFocus(); 15696 } 15697 else 15698 this.SetCheckBoxFocus(); 15699 }, 15700 SetCheckBoxFocus: function () { 15701 var isCheckBoxFocused = this.isItemCheckBoxFocused() || this.isSelectAllCheckBoxFocused(); 15702 if(!isCheckBoxFocused) 15703 this.ProcessRefocusHandler(function() { 15704 this.control.SetFocusedIndex(0); 15705 }.aspxBind(this)); 15706 }, 15707 SetFilterPanelFocus: function() { 15708 if(this.control.customFilteringEditorID || ASPx.ElementHasCssClass(this.control.filterMainElement, this.control.GetInactiveFilterElementClassName())) { 15709 if(this.control.showFilterButton) 15710 this.ProcessRefocusHandler(function() { 15711 this.control.showFilterButton.Focus(); 15712 }.aspxBind(this)); 15713 } else 15714 this.ProcessRefocusHandler(function() { 15715 ASPx.FindFirstChildActionElement(this.control.filterMainElement).focus(); 15716 }.aspxBind(this)); 15717 }, 15718 ProcessRefocusHandler: function(handler) { 15719 setTimeout(function() { 15720 if(!this.control.focused) return; 15721 handler(); 15722 }.aspxBind(this), this.checkBoxRefocusTimeout); 15723 }, 15724 getTextForScreenReader: function(item) { 15725 var result = ""; 15726 if(!this.control.IsMultiColumn()) { 15727 result= item.text; 15728 } else { 15729 var columnsCount = this.control.columnFieldNames.length; 15730 var formatString = ASPx.AccessibilitySR.TableItemFormatString; 15731 for(var i = 0; i < columnsCount; i++) 15732 result += ASPx.Str.ApplyReplacement(formatString, [["{0}", this.getHeaderCellCaptionText(i)], ["{1}", item.texts[i]]]); 15733 } 15734 return result; 15735 }, 15736 setSelectionAttributes: function(index, stateSelected) { 15737 if(index == -1) index = 0; 15738 var item = this.control.GetItem(index); 15739 if(!item) return; 15740 var assistText = this.getTextForScreenReader(item); 15741 var activeItemArgs = { 15742 "role" : "option", 15743 "aria-posinset" : index + 1, 15744 "aria-setsize" : this.control.itemTotalCount, 15745 "aria-selected" : stateSelected 15746 }; 15747 var inactiveItemArgs = { 15748 "role" : "", 15749 "aria-posinset" : "", 15750 "aria-setsize" : "", 15751 "aria-selected" : "" 15752 }; 15753 this.PronounceMessage(assistText, activeItemArgs, inactiveItemArgs); 15754 }, 15755 SetCheckBoxesValidationAttributes: function() { 15756 if(!this.control.CheckColumnSelectionMode() || !this.control.GetErrorCell()) return; 15757 var errorTextElement = this.control.ariaExplanatoryTextManager.GetErrorTextElement(); 15758 for (var i = 0; i < this.control.GetItemCount() ; i++) { 15759 var checkBoxFocusableElement = this.control.GetCheckBoxFocusableElement(i); 15760 if(checkBoxFocusableElement) { 15761 ASPx.Attr.SetOrRemoveAttribute(checkBoxFocusableElement, "aria-describedby", !this.control.isValid ? errorTextElement.id : null); 15762 ASPx.Attr.SetOrRemoveAttribute(checkBoxFocusableElement, "aria-invalid", !this.control.isValid); 15763 } 15764 } 15765 } 15766}); 15767ASPxClientListBox.Cast = ASPxClientControl.Cast; 15768var ASPxClientCheckListBase = ASPx.CreateClass(ASPxClientListEdit, { 15769 constructor: function(name) { 15770 this.constructor.prototype.constructor.call(this, name); 15771 this.imageProperties = null; 15772 this.internalButtonCollection = null; 15773 this.icbFocusedStyle = []; 15774 this.items = []; 15775 }, 15776 SetData: function(data){ 15777 ASPxClientEdit.prototype.SetData.call(this, data);
15778 if(data.items) 15779 this.CreateItems(data.items); 15780 }, 15781 Initialize: function() { 15782 ASPxClientListEdit.prototype.Initialize.call(this); 15783 this.UpdateInternalSelectedIndex(); 15784 }, 15785 UpdateInternalSelectedIndex: function() { 15786 var selectedIndexFromServer = this.GetSelectedIndex(); 15787 var stateInput = this.FindStateInputElement(); 15788 if(stateInput) { 15789 var restoredSelectedIndex = stateInput.value; 15790 if(restoredSelectedIndex != '' && restoredSelectedIndex != selectedIndexFromServer) { 15791 this.SetSelectedIndex(selectedIndexFromServer); 15792 this.SetSelectedIndex(restoredSelectedIndex); 15793 } 15794 } 15795 }, 15796 CreateButtonInternalCollection: function() { 15797 this.internalButtonCollection = this.CreateCheckBoxInternalCollection(); 15798 for(var i = 0; i < this.GetItemCount(); i++) { 15799 var icbInputElement = this.GetItemInput(i); 15800 var internalButton = this.internalButtonCollection.Add(icbInputElement.id, icbInputElement, this.GetItemElement(i)); 15801 internalButton.CreateFocusDecoration(this.icbFocusedStyle); 15802 internalButton.SetEnabled(this.GetEnabled()); 15803 internalButton.GetReadOnly = this.GetReadOnly.bind(this); 15804 internalButton.CheckedChanged.AddHandler(function(s, e) { 15805 this.OnItemClick(this.GetItemIndexByElement(ASPx.Evt.GetEventSource(e))); 15806 }.aspxBind(this)); 15807 internalButton.Focus.AddHandler(function(s, e) { 15808 if(!this.focused) 15809 this.OnFocus(); 15810 }.bind(this)); 15811 internalButton.LostFocus.AddHandler(function(s, e) { this.OnLostFocus(); }.aspxBind(this)); 15812 this.attachToCellsClick(i); 15813 this.PrepareInternalButton(internalButton, i); 15814 } 15815 this.attachToMainElementMouseDown(); 15816 }, 15817 CreateCheckBoxInternalCollection: function () { 15818 return new ASPx.CheckBoxInternalCollection(this.imageProperties, false, true, ASPx.CheckEditElementHelper.Instance, undefined, 15819 this.accessibilityCompliant); 15820 }, 15821 CheckableElementsExist: function() { 15822 return !!this.imageProperties; 15823 }, 15824 SetEnabled: function(enabled){ 15825 ASPxClientListEdit.prototype.SetEnabled.call(this, enabled); 15826 var stateInput = this.FindStateInputElement(); 15827 if(enabled) 15828 ASPx.Attr.RemoveAttribute(stateInput, "disabled"); 15829 else 15830 ASPx.Attr.SetAttribute(stateInput, "disabled", "disabled"); 15831 }, 15832 SetFocus: function() { 15833 this.UpdateFocus(); 15834 }, 15835 UpdateFocus: function() { 15836 }, 15837 IsElementBelongToInputElement: function(element) { 15838 return this.GetItemIndexByElement(element) != -1; 15839 }, 15840 attachToCellsClick: function(index) { 15841 var element = this.GetItemElement(index); 15842 ASPx.Evt.AttachEventToElement(element, "click", function(evt) { 15843 var src = ASPx.Evt.GetEventSource(evt); 15844 var label = ASPx.CheckEditElementHelper.Instance.GetLabelElement(element); 15845 var button = this.internalButtonCollection.Get(this.GetItemInput(index).id); 15846 if(!ASPx.GetIsParent(button.mainElement, src) && src !== label && src.parentElement !== label) { 15847 ASPx.CheckEditElementHelper.Instance.InvokeClick(button, evt); 15848 } 15849 }.aspxBind(this)); 15850 }, 15851 attachToMainElementMouseDown: function() { 15852 var mainElement = this.GetMainElement(); 15853 ASPx.Evt.AttachEventToElement(mainElement, "mousedown", function() { 15854 if(!this.enabled || this.readOnly) 15855 return;
15856 this.LockFocusEvents(); 15857 setTimeout(function() { this.UnlockFocusEvents(); }.aspxBind(this), 0); 15858 }.aspxBind(this)); 15859 }, 15860 GetItemIndexByElement: function(element) { 15861 for(var i = 0; i < this.GetItemCount(); i++) { 15862 var itemElement = this.GetItemElement(i); 15863 if(ASPx.GetIsParent(itemElement, element)) 15864 return i; 15865 } 15866 return -1; 15867 }, 15868 GetItemInput: function(index) { 15869 return this.GetChildElement("RB" + index + "_I"); 15870 }, 15871 GetItemElement: function(index) { 15872 return this.GetChildElement("RB" + index); 15873 }, 15874 GetItemFocusableElement: function(index) { 15875 return this.accessibilityCompliant ? this.GetChildElement("RB" + index + "_I_D") : this.GetItemInput(index); 15876 }, 15877 GetAccessibilityActiveElements: function() { 15878 var accessibilityElements = []; 15879 for(var i = 0; i < this.GetItemCount(); i++) 15880 accessibilityElements.push(this.GetItemFocusableElement(i)); 15881 return accessibilityElements; 15882 }, 15883 GetItemCount: function() { 15884 return this.items.length; 15885 }, 15886 OnItemClick: function(index) { 15887 }, 15888 OnItemClickReadonly: function() { 15889 var index = this.GetSelectedIndexInternal(); 15890 this.SelectIndexSilent(index); 15891 }, 15892 UpdateHiddenInputs: function(index) { 15893 var stateInput = this.FindStateInputElement(); 15894 if(ASPx.IsExistsElement(stateInput)) 15895 stateInput.value = index; 15896 var valueInput = this.GetValueInputElement(); 15897 if(ASPx.IsExistsElement(valueInput)) { 15898 var value = this.GetValue(); 15899 valueInput.value = ASPx.IsExists(value) ? value : " "; 15900 } 15901 }, 15902 GetItemValue: function(index){ 15903 if(index > -1 && index < this.items.length) { 15904 if(typeof(this.items[index].value) == "string" && this.items[index].value == "" && this.convertEmptyStringToNull) 15905 return null; 15906 else 15907 return this.items[index].value; 15908 } 15909 return null; 15910 }, 15911 SetValue: function(value) { 15912 for(var i = 0; i < this.items.length; i++) { 15913 if(this.GetItemValue(i) == value) { 15914 this.SelectIndexSilent(i); 15915 return; 15916 } 15917 } 15918 this.SelectIndexSilent(-1); 15919 }, 15920 CreateItems: function(itemsProperties){ 15921 for(var i = 0; i < itemsProperties.length; i++) 15922 this.CreateItem(i, { 15923 texts: itemsProperties[i][0], 15924 value: this.GetDecodeValue(itemsProperties[i][1]), 15925 imageUrl: itemsProperties[i][2] 15926 }); 15927 }, 15928 CreateItem: function(index, itemProperties){ 15929 var item = new ASPxClientListEditItem(this, index, itemProperties.texts, itemProperties.value, itemProperties.imageUrl); 15930 this.items.push(item); 15931 }, 15932 GetItem: function(index){ 15933 return (0 <= index && index < this.items.length) ? this.items[index] : null; 15934 }, 15935 ChangeEnabledAttributes: function(enabled){ 15936 if(!this.CheckableElementsExist()) { 15937 for(var i = 0; i < this.GetItemCount(); i++){ 15938 var element = this.GetItemInput(i); 15939 if(element){ 15940 this.ChangeItemEnabledAttributes(element, ASPx.Attr.ChangeAttributesMethod(enabled)); 15941 this.ChangeSpecialInputEnabledAttributes(element, ASPx.Attr.ChangeEventsMethod(enabled), true); 15942 element.disabled = !enabled; 15943 } 15944 } 15945 } else { 15946 var selectedIndex = this.GetSelectedIndexInternal(); 15947 this.UpdateCheckableElementDecorations(selectedIndex, enabled); 15948 } 15949 }, 15950 ChangeEnabledStateItems: function(enabled){ 15951 ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled); 15952 if(this.isNative){ 15953 for(var i = 0; i < this.GetItemCount(); i++){ 15954 var element = this.GetItemInput(i); 15955 if(element) 15956 ASPx.GetStateController().SetElementEnabled(element, enabled); 15957 } 15958 } 15959 }, 15960 ChangeItemEnabledAttributes: function(element, method){ 15961 method(element, "onclick"); 15962 } 15963}); 15964var ASPxClientRadioButtonList = ASPx.CreateClass(ASPxClientCheckListBase, { 15965 constructor: function(name) { 15966 this.constructor.prototype.constructor.call(this, name); 15967 }, 15968 InlineInitialize: function() { 15969 if(this.CheckableElementsExist()) 15970 this.CreateButtonInternalCollection(); 15971 ASPxClientCheckListBase.prototype.InlineInitialize.call(this); 15972 }, 15973 Initialize: function() { 15974 ASPxClientCheckListBase.prototype.Initialize.call(this);
15975 this.UpdateHiddenInputs(this.GetSelectedIndex()); 15976 this.SetSelectedIndex(this.GetSelectedIndex()); 15977 }, 15978 PrepareInternalButton: function(internalRadioButton){ 15979 internalRadioButton.autoSwitchEnabled = false; 15980 }, 15981 GetInputElement: function() { 15982 if(this.isNative) { 15983 var index = this.GetSelectedIndexInternal(); 15984 return this.GetItemInput(index); 15985 } else 15986 return this.GetValueInputElement(); 15987 }, 15988 GetValueInputElement: function() { 15989 if(this.valueInput == null) { 15990 var stateInput = this.FindStateInputElement(); 15991 this.valueInput = this.GetHiddenField(null, this.name + "_ValueInput", stateInput.parentNode, stateInput); 15992 } 15993 return this.valueInput; 15994 }, 15995 GetValueInputToValidate: function() { 15996 return this.GetValueInputElement(); 15997 }, 15998 SelectIndexSilent: function(index) { 15999 var itemCount = this.GetItemCount(); 16000 var isValidIndex = (-1 <= index && index < itemCount); 16001 if(isValidIndex) { 16002 if(this.CheckableElementsExist()) 16003 this.UpdateCheckableElementDecorations(index, this.GetEnabled()); 16004 else { 16005 for(var i = 0; i < itemCount; i++) { 16006 var element = this.GetItemInput(i); 16007 if(element) 16008 element.checked = (i == index); 16009 } 16010 } 16011 this.SetSelectedIndexInternal(index); 16012 this.UpdateHiddenInputs(index); 16013 } 16014 }, 16015 UpdateCheckableElementDecorations: function(selectedIndex, enabled) { 16016 if(this.CheckableElementsExist()) { 16017 for(var i = 0; i < this.items.length; i++) { 16018 var inputElement = this.GetItemInput(i); 16019 var internalButton = this.internalButtonCollection.Get(inputElement.id); 16020 internalButton.SetEnabled(enabled); 16021 internalButton.SetValue(i == selectedIndex ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked); 16022 } 16023 } 16024 }, 16025 UpdateFocus: function() { 16026 var index = this.GetSelectedIndexInternal(); 16027 if(index == -1) 16028 index = 0; 16029 var itemElement = this.GetItemFocusableElement(index); 16030 if(itemElement != null && ASPx.GetActiveElement() != itemElement && ASPx.IsEditorFocusable(itemElement)) 16031 ASPx.SetFocus(itemElement); 16032 }, 16033 OnItemClick: function(index) { 16034 if(this.GetSelectedIndexInternal() != index) { 16035 this.SelectIndexSilent(index); 16036 this.RaisePersonalStandardValidation(); 16037 this.OnValueChanged(); 16038 } 16039 this.UpdateFocus(); 16040 }, 16041 RequireInputElementToValidate: function() { 16042 return false; 16043 }, 16044 GetItem: function(index){ 16045 var item = ASPxClientCheckListBase.prototype.GetItem.call(this, index); 16046 if(item) 16047 item.selected = index == this.GetSelectedIndexInternal(); 16048 return item; 16049 } 16050}); 16051ASPxClientRadioButtonList.Cast = ASPxClientControl.Cast; 16052var ASPxClientCheckBoxList = ASPx.CreateClass(ASPxClientCheckListBase, { 16053 constructor: function(name) { 16054 this.constructor.prototype.constructor.call(this, name); 16055 this.selectionEventsLockCount = 0; 16056 this.initializeInputValue = null; 16057 this.restoredSelectedIndices = null; 16058 }, 16059 InlineInitialize: function() { 16060 if(this.CheckableElementsExist()) 16061 this.CreateButtonInternalCollection(); 16062 ASPxClientCheckListBase.prototype.InlineInitialize.call(this); 16063 }, 16064 Initialize: function() { 16065 this.initializeInputValue = this.GetInputElement().value; 16066 ASPxClientCheckListBase.prototype.Initialize.call(this); 16067 this.SaveRestoredIndices(); 16068 this.InitSelection(); 16069 }, 16070 SaveRestoredIndices: function() { 16071 var value = this.initializeInputValue; 16072 if(!ASPx.IsExists(value) || value === "") 16073 return; 16074 var serializer = this.GetSerializingHelper(); 16075 var itemStringIndices = serializer.DeserializeValues(value); 16076 var itemIndices = []; 16077 for(var i = 0; i < itemStringIndices.length; i++) { 16078 var itemIndex = parseInt(itemStringIndices[i]); 16079 itemIndices.push(itemIndex); 16080 } 16081 this.restoredSelectedIndices = itemIndices; 16082 }, 16083 InitSelection: function() { 16084 if(this.restoredSelectedIndices) 16085 this.UnselectAll(); 16086 var selectedIndices = this.restoredSelectedIndices || this.initSelectedIndices; 16087 this.SelectIndices(selectedIndices); 16088 this.CacheValue(); 16089 }, 16090 PrepareInternalButton: function(internalCheckBox, index){ 16091 internalCheckBox.autoSwitchEnabled = true; 16092 internalCheckBox.SetChecked(this.GetItemSelectionHelper().GetIsItemSelected(index)); 16093 }, 16094 SelectIndexSilent: function(index) { 16095 var itemCount = this.GetItemCount(); 16096 var isValidIndex = (-1 <= index && index < itemCount); 16097 if(isValidIndex) 16098 this.SelectIndices([index]); 16099 }, 16100 UpdateCheckableElementDecorations: function(selectedIndex, enabled) {
16101 if(this.CheckableElementsExist()) { 16102 for(var i = 0; i < this.items.length; i++) { 16103 var inputElement = this.GetItemInput(i); 16104 var internalButton = this.internalButtonCollection.Get(inputElement.id); 16105 internalButton.SetEnabled(enabled); 16106 } 16107 } 16108 }, 16109 SetSelectionDecoration: function(index, selected){ 16110 if(this.CheckableElementsExist()){ 16111 var inputElement = this.GetItemInput(index); 16112 var internalButton = this.internalButtonCollection.Get(inputElement.id); 16113 internalButton.SetValue(selected ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked); 16114 } else { 16115 var element = this.GetItemInput(index); 16116 if(element) 16117 element.checked = (selected); 16118 } 16119 }, 16120 OnItemClick: function(index) { 16121 this.GetItemSelectionHelper().OnItemClick(index); 16122 }, 16123 UpdateFocus: function() { 16124 var index = this.GetItemSelectionHelper().GetFocusedItemIndex(); 16125 if(index == -1) 16126 index = this.GetSelectedIndexInternal(); 16127 if(index == -1) 16128 index = 0; 16129 var itemElement = this.GetItemFocusableElement(index); 16130 if(itemElement != null && ASPx.GetActiveElement() != itemElement && ASPx.IsEditorFocusable(itemElement)) 16131 ASPx.SetFocus(itemElement); 16132 }, 16133 UpdateInternalState: function(){ 16134 this.UpdateHiddenInputs(); 16135 }, 16136 IsUpdateHiddenInputsLocked: function(){ 16137 return this.GetItemSelectionHelper().IsUpdateInternalSelectionStateLocked(); 16138 }, 16139 UpdateHiddenInputs: function(){ 16140 if(this.IsUpdateHiddenInputsLocked()) 16141 return; 16142 var element = this.FindStateInputElement(); 16143 if(ASPx.IsExistsElement(element)) { 16144 var sb = [ ]; 16145 var serialiser = this.GetSerializingHelper(); 16146 var selectedIndices = this.GetSelectedIndices(); 16147 for(var i = 0; i < selectedIndices.length; i++) 16148 serialiser.SerializeAtomValue(sb, selectedIndices[i]); 16149 element.value = sb.join(""); 16150 } 16151 }, 16152 GetSerializingHelper: function(){ 16153 if(this.serializingHelper == null) 16154 this.serializingHelper = new ListBoxBaseItemsSerializingHelper(this); 16155 return this.serializingHelper; 16156 }, 16157 SetItemSelectionAppearance: function(index, selected, controller, checkCanChangeSelection){ 16158 }, 16159 LockSelectionEvents: function(){ 16160 this.selectionEventsLockCount++; 16161 }, 16162 UnlockSelectionEvents: function(){ 16163 this.selectionEventsLockCount--; 16164 }, 16165 IsSelectionEventsLocked: function(){ 16166 return this.selectionEventsLockCount > 0; 16167 }, 16168 CacheValue: function(){ 16169 this.cachedValue = this.GetValue(); 16170 }, 16171 IsValueChanged: function(){ 16172 return this.cachedValue != this.GetValue(); 16173 }, 16174 OnItemSelectionChanged: function(index, selected){ 16175 this.SetSelectionDecoration(index, selected); 16176 if(!this.IsSelectionEventsLocked()) { 16177 this.SetRaiseSelectedIndexChangedArguments(this.autoPostBack, index, selected); 16178 var valueChanged = this.IsValueChanged(); 16179 if(valueChanged) { 16180 this.RaisePersonalStandardValidation(); 16181 this.OnValueChanged(); 16182 } else { 16183 if(this.RaiseSelectedIndexChanged()) 16184 this.SendPostBackInternal(""); 16185 } 16186 } 16187 this.CacheValue(); 16188 }, 16189 SetRaiseSelectedIndexChangedArguments: function(processOnServer, index, selected){ 16190 this.selectedIndexChangedArguments = { 16191 processOnServer: processOnServer, 16192 index: index, 16193 selected: selected 16194 }; 16195 }, 16196 GetRaiseSelectedIndexChangedArguments: function(){ 16197 if(!this.selectedIndexChangedArguments) 16198 this.SetRaiseSelectedIndexChangedArguments(false, this.GetSelectedIndex(), true); 16199 return this.selectedIndexChangedArguments; 16200 }, 16201 RaiseSelectedIndexChanged: function (processOnServer) { 16202 this.RaiseValidationInternal(); 16203 var savedArgs = this.GetRaiseSelectedIndexChangedArguments(); 16204 processOnServer = savedArgs.processOnServer || processOnServer; 16205 if(!this.SelectedIndexChanged.IsEmpty()){ 16206 var args = new ASPxClientListEditItemSelectedChangedEventArgs(savedArgs.index, savedArgs.selected, processOnServer); 16207 this.SelectedIndexChanged.FireEvent(this, args); 16208 processOnServer = args.processOnServer; 16209 } 16210 return processOnServer; 16211 }, 16212 GetItemSelectionHelper: function(){ 16213 if(!this.itemSelectionHelper) 16214 this.itemSelectionHelper = this.CreateItemSelectionHelper(); 16215 return this.itemSelectionHelper; 16216 }, 16217 CreateItemSelectionHelper: function(){ 16218 return new CheckBoxListMultiSelectionHelper(this); 16219 }, 16220 GetItem: function(index){ 16221 var item = ASPxClientCheckListBase.prototype.GetItem.call(this, index); 16222 item.selected = this.GetItemSelectionHelper().GetIsItemSelected(index); 16223 return item; 16224 }, 16225 SetValue: function(value){ 16226 var index = this.FindItemIndexByValue(value); 16227 this.SetSelectedIndex(index); 16228 }, 16229 GetSelectedIndexInternal: function(){ 16230 if(!this.isInitialized) 16231 return ASPxClientCheckListBase.prototype.GetSelectedIndexInternal.call(this); 16232 return this.GetItemSelectionHelper().GetSelectedIndex(); 16233 }, 16234 SetSelectedIndex: function(index){ 16235 this.LockSelectionEvents(); 16236 this.GetItemSelectionHelper().SetSelectedIndex(index); 16237 this.UnlockSelectionEvents(); 16238 }, 16239 GetSelectedIndices: function(){ 16240 return this.GetItemSelectionHelper().GetSelectedIndices(); 16241 }, 16242 GetSelectedValues: function(){ 16243 return this.GetItemSelectionHelper().GetSelectedValues();
16244 }, 16245 GetSelectedItems: function(){ 16246 return this.GetItemSelectionHelper().GetSelectedItems(); 16247 }, 16248 SelectAll: function(){ 16249 this.SelectIndices(); 16250 }, 16251 UnselectAll: function(){ 16252 this.UnselectIndices(); 16253 }, 16254 SelectIndices: function(indices){ 16255 this.LockSelectionEvents(); 16256 this.GetItemSelectionHelper().SelectIndices(indices); 16257 this.UnlockSelectionEvents(); 16258 }, 16259 SelectItems: function(items){ 16260 this.LockSelectionEvents(); 16261 this.GetItemSelectionHelper().SelectItems(items); 16262 this.UnlockSelectionEvents(); 16263 }, 16264 SelectValues: function(values){ 16265 this.LockSelectionEvents(); 16266 this.GetItemSelectionHelper().SelectValues(values); 16267 this.UnlockSelectionEvents(); 16268 }, 16269 UnselectIndices: function(indices){ 16270 this.LockSelectionEvents(); 16271 this.GetItemSelectionHelper().UnselectIndices(indices); 16272 this.UnlockSelectionEvents(); 16273 }, 16274 UnselectItems: function(items){ 16275 this.LockSelectionEvents(); 16276 this.GetItemSelectionHelper().UnselectItems(items); 16277 this.UnlockSelectionEvents(); 16278 }, 16279 UnselectValues: function(values){ 16280 this.LockSelectionEvents(); 16281 this.GetItemSelectionHelper().UnselectValues(values); 16282 this.UnlockSelectionEvents(); 16283 } 16284}); 16285ASPxClientCheckBoxList.Cast = ASPxClientControl.Cast; 16286var ASPxClientListEditItemSelectedChangedEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, { 16287 constructor: function(index, isSelected, processOnServer){ 16288 this.constructor.prototype.constructor.call(this, processOnServer); 16289 this.index = index; 16290 this.isSelected = isSelected; 16291 } 16292}); 16293function aspxLBTSelectStart(evt){ 16294 var shiftPressed = evt.shiftKey; 16295 var ctrlKey = evt.ctrlKey || evt.metaKey; 16296 if(shiftPressed || ctrlKey){ 16297 ASPx.Selection.Clear(); 16298 ASPx.Evt.PreventEventAndBubble(evt); 16299 } 16300} 16301function aspxLBIClick(evt){ 16302 if(ASPx.TouchUIHelper.isMouseEventFromScrolling) return; 16303 var element = ASPx.Evt.GetEventSource(evt); 16304 while(element != null && element.tagName != "BODY"){ 16305 if(element.tagName == "TR"){ 16306 var table = element.offsetParent; 16307 if(table && table.ListBoxId){ 16308 var lb = ASPx.GetControlCollection().Get(table.ListBoxId); 16309 if(lb != null) { 16310 var retValue; 16311 if(evt.type == "dblclick") 16312 retValue =lb.OnItemDblClick(); 16313 else if(!lb.isComboBoxList || ASPx.Evt.IsLeftButtonPressed(evt)) { 16314 var itemIndex = lb.GetItemIndexByRow(element); 16315 retValue = lb.OnItemClick(itemIndex, evt); 16316 } 16317 if(typeof(retValue) != "undefined") 16318 return retValue; 16319 } 16320 break; 16321 } 16322 } 16323 element = element.parentNode; 16324 } 16325} 16326function aspxLBScroll(evt){ 16327 var sourceId = ASPx.Evt.GetEventSource(evt).id; 16328 if(sourceId.slice(-lbDSuffix.length) == lbDSuffix){ 16329 var name = sourceId.slice(0, -2); 16330 var lb = ASPx.GetControlCollection().Get(name); 16331 if(lb != null && lb.isInitialized) 16332 lb.OnScroll(); 16333 } 16334} 16335ASPx.NLBIDClick = function(evt) { 16336 var element = ASPx.Evt.GetEventSource(evt); 16337 if(element != null && element.tagName == "SELECT"){ 16338 var lb = ASPx.GetControlCollection().Get(element.id); 16339 if(lb != null) 16340 lb.OnItemDblClick(); 16341 } 16342}; 16343ASPx.ERBLIClick = function(name, index) { 16344 var list = ASPx.GetControlCollection().Get(name); 16345 if(list != null) { 16346 if(list.GetReadOnly()) 16347 return false; 16348 list.OnItemClick(index); 16349 } 16350}; 16351ASPx.ERBLICancel = function(name) { 16352 var list = ASPx.GetControlCollection().Get(name); 16353 if(list != null) 16354 list.OnItemClickReadonly(); 16355}; 16356ASPx.ShowListBoxFilter = function(name) { 16357 var list = ASPx.GetControlCollection().Get(name); 16358 if(list != null) 16359 list.ShowFilterElement(); 16360}; 16361ASPx.HideListBoxFilter = function(name) { 16362 var list = ASPx.GetControlCollection().Get(name); 16363 if (list != null) 16364 list.HideFilterElement(); 16365}; 16366var highlightingOpeningGuid = "680fb6b5-de5f-4af1-b444-2617b6dc5aab"; 16367var highlightingClosingGuid = "ee51e3d2-fb72-45fc-b737-6d3432008053"; 16368ASPx.ListBoxHighlightingHelper = ASPx.CreateClass(null, { 16369 constructor: function(listBox, tagName) { 16370 this.listBox = listBox; 16371 this.tagName = tagName; 16372 this.highlightingOpeningTag = "<" + tagName + ">"; 16373 this.highlightingClosingTag = "</" + tagName + ">"; 16374 this.highlightingOpeningTagPlaceholder = new RegExp(highlightingOpeningGuid, "g"); 16375 this.highlightingClosingTagPlaceholder = new RegExp(highlightingClosingGuid, "g"); 16376 this.customReplacer = highlightingOpeningGuid + "$&" + highlightingClosingGuid; 16377 }, 16378 Apply: function(text, isCustom) { 16379 if(text == "" || !this.listBox.encodeHtml) return; 16380 if(isCustom) 16381 this.applyCustom(text); 16382 else
16383 this.apply(text, ASPx.ContainsFilteringUtils.SelectContainsTextInElement, false); 16384 }, 16385 Remove: function(text, isCustom) { 16386 if(isCustom) 16387 this.removeCustom(text); 16388 else 16389 this.apply(text, ASPx.ContainsFilteringUtils.UnselectContainsTextInElement, true); 16390 }, 16391 Refresh: function(text, isCustom) { 16392 if(text == "") return; 16393 if(isCustom) 16394 this.applyCustom(text, true); 16395 else 16396 this.apply(text, ASPx.ContainsFilteringUtils.ReselectContainsTextInElement, false); 16397 }, 16398 applyCustom: function(highlighting, refreshing) { 16399 var count = this.listBox.GetItemCount(); 16400 var highlightingRegExpxByColumns = this.getCustomHighlightingRegExpsByColumns(highlighting); 16401 for(var i = 0; i < count; i++) { 16402 var item = this.listBox.GetItemRow(i); 16403 if(!item || this.listBox.ItemRowHasTemplate(i)) continue; 16404 this.applyCustomCore(item, highlightingRegExpxByColumns, refreshing); 16405 } 16406 }, 16407 applyCustomCore: function(item, highlightingRegExpxByColumns, refreshing) { 16408 var elements = this.getTextCellElements(item); 16409 for(var i = 0, el; el = elements[i]; i++) { 16410 if(refreshing) 16411 this.removeCustomFromItem(el); 16412 this.applyCustomToItem(el, highlightingRegExpxByColumns[i]); 16413 } 16414 }, 16415 applyCustomToItem: function(element, regexp) { 16416 if(!regexp) 16417 return; 16418 var currentText = ASPx.Attr.GetAttribute(element, "DXText"); 16419 if(!ASPx.IsExists(currentText)) ASPx.Attr.SetAttribute(element, "DXText", ASPx.GetInnerText(element)); 16420 var oldInnerText = ASPx.GetInnerText(element); 16421 var newInnerText = oldInnerText.replace(regexp, this.customReplacer); 16422 newInnerText = ASPx.ContainsFilteringUtils.PrepareElementText(newInnerText) 16423 .replace(this.highlightingOpeningTagPlaceholder, this.highlightingOpeningTag) 16424 .replace(this.highlightingClosingTagPlaceholder, this.highlightingClosingTag); 16425 if(newInnerText !== oldInnerText) 16426 ASPx.SetInnerHtml(element, newInnerText); 16427 }, 16428 removeCustomFromItem: function(element) { 16429 var currentText = ASPx.Attr.GetAttribute(element, "DXText"); 16430 if(ASPx.IsExists(currentText)) { 16431 currentText = ASPx.ContainsFilteringUtils.PrepareElementText(currentText); 16432 ASPx.SetInnerHtml(element, currentText === "" ? " " : currentText); 16433 } 16434 }, 16435 removeCustom: function() { 16436 var count = this.listBox.GetItemCount(); 16437 for(var i = 0; i < count; i++) { 16438 var item = this.listBox.GetItemRow(i); 16439 if(!item || this.listBox.ItemRowHasTemplate(i)) continue; 16440 this.removeCustomCore(item); 16441 } 16442 }, 16443 removeCustomCore: function(item) { 16444 var elements = this.getTextCellElements(item); 16445 for(var i = 0, el; el = elements[i]; i++) 16446 this.removeCustomFromItem(el); 16447 }, 16448 getCustomHighlightingRegExpsByColumns: function(highlighting) { 16449 var columns = this.listBox.IsMultiColumn() ? this.listBox.columnFieldNames : [""]; 16450 return columns.map(function(fieldName) { 16451 if(typeof (highlighting) === "string" || Array.isArray(highlighting) || highlighting instanceof RegExp) 16452 return this.arrayToRegEx(highlighting); 16453 if(typeof (highlighting) === "object") 16454 return this.arrayToRegEx(highlighting[fieldName]); 16455 return null; 16456 }.bind(this)); 16457 }, 16458 arrayToRegEx: function(texts) { 16459 if(texts instanceof RegExp) 16460 return texts; 16461 if(typeof (texts) === "string") 16462 return this.arrayToRegEx([texts]); 16463 if(Array.isArray(texts)) { 16464 texts = texts 16465 .filter(function(t) { return typeof (t) === "string" && t.length; }) 16466 .sort(function(a, b) { return b.length - a.length; }) 16467 .map(ASPx.Str.EscapeForRegEx); 16468 if(texts.length) 16469 return new RegExp("(" + texts.join("|") + ")", "gi"); 16470 } 16471 return null; 16472 }, 16473 apply: function(text, func, allColumns) { 16474 var count = this.listBox.GetItemCount(); 16475 for (var i = 0; i < count; i++) { 16476 var item = this.listBox.GetItemRow(i); 16477 if (item && (allColumns || ASPx.GetElementDisplay(item)) && this.canApply(item)) { 16478 var elements = this.listBox.GetItemSelectableElementsByRow(item); 16479 this.applyToItem(text, elements, func, allColumns); 16480 } 16481 } 16482 }, 16483 applyToItem: function(text, elements, func, allColumns) {
16484 var itemValues = this.getItemValues(elements); 16485 var itemSelection = this.getItemSelection(itemValues, this.listBox.textFormatString, text); 16486 var firstTextCellIndex = this.getFirstTextCellIndex(); 16487 if (allColumns) { 16488 for (var i = 0; i < elements.length; i++) 16489 this.applyToItemCore(func, elements[i], itemSelection[i]); 16490 } else 16491 this.applyToTextCells(func, firstTextCellIndex, elements, itemSelection); 16492 }, 16493 getItemSelection: function (itemValues, textFormatString, text) { 16494 return ASPx.ContainsFilteringUtils.GetColumnSelectionsForItem(itemValues, textFormatString, text); 16495 }, 16496 applyToTextCells: function(func, firstTextCellIndex, elements, itemSelection) { 16497 for(var i = 0; i < itemSelection.length; i++) 16498 this.applyToItemCore(func, elements[itemSelection[i].index + firstTextCellIndex], itemSelection[i]); 16499 }, 16500 applyToItemCore: function (func, itemElement, itemSelection) { 16501 if (!this.listBox.ItemCellHasTextAttr(itemElement)) 16502 func(itemElement, itemSelection, this.tagName); 16503 }, 16504 getItemValues: function (elements) { 16505 var result = []; 16506 for (var i = this.getFirstTextCellIndex() ; i < elements.length; i++) 16507 result.push(ASPxClientListBox.GetItemCellInnerText(elements[i])); 16508 return result; 16509 }, 16510 canApply: function (item) { 16511 return !this.listBox.ItemRowHasTemplateCore(item); 16512 }, 16513 getFirstTextCellIndex: function () { 16514 return this.listBox.GetItemFirstTextCellIndex(); 16515 }, 16516 getTextCellElements: function(item) { 16517 return this.listBox.GetItemTextCells(item); 16518 } 16519}); 16520var ListEditFilterStrategyBase = ASPx.CreateClass(null, { 16521 OnPaste: function(evt) { }, 16522 OnInput: function() { }, 16523 OnClearButtonClick: function() { }, 16524 OnTextChanged: function() { }, 16525 OnEscape: function() { }, 16526 OnKeyDown: function(evt) { }, 16527 OnAfterEnter: function() { }, 16528 OnSelectedIndexChanged: function() { }, 16529 OnLostFocus: function() { }, 16530 OnCallback: function(result) { }, 16531 OnBeforeDoEndCallback: function() { }, 16532 OnAfterDoEndCallback: function() { }, 16533 OnBeforeCallbackFinally: function() { }, 16534 OnAfterCallbackFinally: function() { }, 16535 OnPerformCallback: function() { }, 16536 Filtering: function() { }, 16537 CancelFiltering: function() { }, 16538 ShouldDiscardCallbackResult: function() { }, 16539 GetCallbackArguments: function() { return ""; }, 16540 CanNavigateByKbd: function() { return true; }, 16541 IsFilterMeetRequirementForMinLength: function (filter) { return true; }, 16542 ResetCallbackState: function() { }, 16543 ClearFilterApplied: function() { }, 16544 OnDropDownHideArea: function() { }, 16545 OnDropDownButtonClick: function() { }, 16546 OnDropDownCloseByDocumentOrWindowEvent: function() { }, 16547 OnApplyChanges: function() { }, 16548 OnCancelChanges: function() { }, 16549 OnUndo: function() { } 16550}); 16551var ListEditIncrementalFilterStrategyBase = ASPx.CreateClass(ListEditFilterStrategyBase, { 16552 constructor: function(filterDelay, filterMinLength, isCallbackMode) { 16553 this.filterTimeoutId = -1; 16554 this.filterDelay = filterDelay; 16555 this.filterMinLength = filterMinLength; 16556 this.isCallbackMode = isCallbackMode; 16557 this.filter = ""; 16558 this.highlighting = ""; 16559 this.filterInitialized = false; 16560 this.needEmptyFilterBeforeFiltering = false; 16561 this.currentCallbackIsFiltration = false; 16562 this.refiltrationRequired = false; 16563 }, 16564 GetInputFilterValue: function() { throw "Not Implemented"; }, 16565 GetListBoxControl: function() { throw "Not Implemented"; }, 16566 IsSatisfy: function(text, filter) { throw "Not Implemented"; }, 16567 InCallback: function() { throw "Not Implemented"; }, 16568 IsEnabled: function() { throw "Not Implemented"; }, 16569 SendCallbackCore: function() { throw "Not Implemented"; }, 16570 PreventEndCallbackRising: function() { throw "Not Implemented"; }, 16571 GetSelectedIndex: function() { throw "Not Implemented"; }, 16572 NotifyCollectionChanged: function() { throw "Not Implemented"; }, 16573 OnCallbackCore: function(highlighting, newFilterLength) { throw "Not Implemented"; }, 16574 RaiseItemFilteringEvent: function(item, filter, isFit) { throw "Not Implemented"; }, 16575 RaiseCustomHighlightingEvent: function(filter, highlighting) { throw "Not Implemented"; }, 16576 OnBeforeFilteringOnClient: function(filter) { }, 16577 OnAfterFilteringOnClientCore: function (filter, firstSatisfyItemIndex) { throw "Not Implemented"; }, 16578 SupportsFilterCorrection: function() { throw "Not Implemented"; }, 16579 OnFirstSatisfiedItemFound: function(index, text, isTextClearing) { }, 16580 TryProcessFilterLessMinLength: function() { return true; }, 16581 AllowEmptyFilterResults: function() { return true; }, 16582 OnBeforeFiltering: function() { }, 16583 OnAfterFiltering: function() { }, 16584 OnFilteringCancelled: function() { }, 16585 OnTextChanged: function() { }, 16586 OnFilterRollback: function() { }, 16587 CanStartFilterOnInput: function() { 16588 return this.IsEnabled() && !this.InCallback(); 16589 }, 16590 OnAfterFilteringOnClient: function (filter, satisfyItemIndices) { 16591 this.GetListBoxControl().RewriteFilteredItemIndices(satisfyItemIndices); 16592 var firstSatisfyItemIndex = satisfyItemIndices.length > 0 ? satisfyItemIndices[0] : -1; 16593 this.OnAfterFilteringOnClientCore(filter, firstSatisfyItemIndex); 16594 this.GetListBoxControl().InitScrollPos(); 16595 }, 16596 ShouldClearFilterBeforeFiltering: function(filter) { return false; }, 16597 OnInput: function() { 16598 if(this.CanStartFilterOnInput()) { 16599 this.FilterStopTimer(); 16600 this.FilterStartTimer(); 16601 } 16602 }, 16603 OnCallback: function(result) { 16604 this.OnCallbackCore(result[CONSTANTS.CALLBACK_RESULTS.FILTER_CUSTOMHIGHLIGHTING], result[CONSTANTS.CALLBACK_RESULTS.FILTER_LENGTH]); 16605 this.currentCallbackIsFiltration = false; 16606 }, 16607 CancelFiltering: function() { 16608 this.FilterStopTimer(); 16609 }, 16610 Filtering: function(fromApi) { 16611 this.FilterStopTimer(); 16612 var inputValue = this.GetInputFilterValue(); 16613 this.needEmptyFilterBeforeFiltering = this.ShouldClearFilterBeforeFiltering(inputValue); 16614 var newFilter = this.needEmptyFilterBeforeFiltering ? "" : inputValue; 16615 var oldFilter = this.filter; 16616 if(!this.FilterCompare(newFilter)) { 16617 this.SetFilter(newFilter); 16618 if(!this.IsFilterMeetRequirementForMinLength() && this.TryProcessFilterLessMinLength(oldFilter)) 16619 return; 16620 else { 16621 this.OnBeforeFiltering(); 16622 if(this.isCallbackMode) 16623 this.FilteringOnServer(); 16624 else 16625 this.FilteringOnClient(); 16626 this.OnAfterFiltering(); 16627 } 16628 } 16629 else 16630 this.OnFilteringCancelled(fromApi); 16631 }, 16632 FilteringOnClient: function() { 16633 var listBox = this.GetListBoxControl(), 16634 count = listBox.GetItemCount(), 16635 filter = this.filter, 16636 visibleItems = [], 16637 visibleItemFound = false;
16638 this.DiscardHighlighting(); 16639 while(true) { 16640 var preparedFilter = ASPx.Str.PrepareStringForFilter(filter); 16641 listBox.BeforeClientFiltering(); 16642 for(var i = 0; i < count; i++) { 16643 var item = listBox.GetItem(i); 16644 var isFit = this.IsSatisfy(item.text, preparedFilter); 16645 isFit = this.RaiseItemFilteringEvent(item, filter, isFit); 16646 if(isFit) { 16647 if(!visibleItemFound) { 16648 this.OnBeforeFilteringOnClient(filter); 16649 for(var j = 0; j < i; j++) 16650 listBox.ApplyFilterToItem(j, false); 16651 var isTextClearing = filter == "" && this.filter != item.text; 16652 this.OnFirstSatisfiedItemFound(i, item.text, isTextClearing); 16653 visibleItemFound = true; 16654 } 16655 visibleItems.push(i); 16656 } 16657 if(visibleItemFound) 16658 listBox.ApplyFilterToItem(i, isFit); 16659 } 16660 if(visibleItemFound || this.AllowEmptyFilterResults() || !filter) 16661 break; 16662 filter = filter.substr(0, filter.length - 1); 16663 } 16664 if(!visibleItemFound) { 16665 this.OnBeforeFilteringOnClient(filter); 16666 if(this.AllowEmptyFilterResults()) { 16667 for(var i = 0; i < count; i++) 16668 listBox.ApplyFilterToItem(i, false); 16669 } 16670 } 16671 this.OnAfterFilteringOnClient(filter, visibleItems); 16672 this.SetHighlighting(filter); 16673 this.OnEndFiltering(visibleItemFound || this.AllowEmptyFilterResults()); 16674 }, 16675 FilteringOnServer: function() { 16676 if(!this.InCallback()) { 16677 var listBox = this.GetListBoxControl(); 16678 listBox.ClearItems(); 16679 listBox.serverIndexOfFirstItem = 0; 16680 listBox.SetScrollSpacerVisibility(true, false); 16681 listBox.SetScrollSpacerVisibility(false, false); 16682 } 16683 this.SendFilteringCallback(); 16684 }, 16685 SendFilteringCallback: function(owner) { 16686 this.currentCallbackIsFiltration = true; 16687 this.SendCallbackCore(); 16688 }, 16689 OnEndFiltering: function(visibleCollectionChanged) { 16690 if(visibleCollectionChanged) 16691 this.NotifyCollectionChanged(); 16692 this.ApplyHighlighting(); 16693 }, 16694 IsFilterTimerActive: function() { 16695 return this.filterTimeoutId !== -1; 16696 }, 16697 FilterStopTimer: function() { 16698 this.filterTimeoutId = ASPx.Timer.ClearTimer(this.filterTimeoutId); 16699 }, 16700 FilterStartTimer: function() { 16701 this.filterTimeoutId = ASPx.Timer.SetControlBoundTimeout(function() { 16702 this.filterTimeoutId = -1; 16703 this.Filtering(); 16704 }.bind(this), this.GetListBoxControl(), this.filterDelay); 16705 }, 16706 IsFilterMeetRequirementForMinLength: function(filter) { 16707 if(typeof (filter) !== "string") 16708 filter = this.GetInputFilterValue(); 16709 return typeof (filter) === "string" ? filter.length >= this.filterMinLength : true; 16710 }, 16711 GetCallbackArguments: function() { 16712 if(this.filter) { 16713 var callbackPrefix = this.SupportsFilterCorrection() ? CONSTANTS.CALLBACK_PREFIXES.FILTERING_CORRECT : CONSTANTS.CALLBACK_PREFIXES.FILTERING; 16714 return ASPx.FilteringUtils.FormatCallbackArg(callbackPrefix, this.filter); 16715 } 16716 return ""; 16717 }, 16718 OnAfterDoEndCallback: function() { 16719 if(this.refiltrationRequired) { 16720 this.refiltrationRequired = false; 16721 window.setTimeout(this.Filtering.bind(this), 0); 16722 } 16723 }, 16724 OnBeforeDoEndCallback: function() { 16725 if(this.refiltrationRequired) 16726 this.PreventEndCallbackRising(); 16727 }, 16728 OnSelectedIndexChanged: function() { 16729 this.ClearFilterApplied(); 16730 }, 16731 SetHighlighting: function(filter, callbackHighlighting) { 16732 callbackHighlighting = this.ProcessCallbackHighlighting(callbackHighlighting); 16733 var customHighlighting = this.RaiseCustomHighlightingEvent(filter, callbackHighlighting); 16734 this.isCustomHighlighting = customHighlighting !== null && customHighlighting !== undefined; 16735 this.highlighting = this.isCustomHighlighting ? customHighlighting : filter; 16736 }, 16737 ProcessCallbackHighlighting: function(obj) { 16738 if(obj === undefined || obj === null) 16739 return undefined; 16740 var val = obj.val; 16741 var regEx = !!obj.regEx; 16742 if(regEx) { 16743 if(typeof (val) === "string") 16744 val = new RegExp(val, "gi"); 16745 if(!Array.isArray(val) && typeof (val) === "object") { 16746 for(var col in val) { 16747 if(!val.hasOwnProperty(col)) continue; 16748 if(typeof (val[col]) === "string") 16749 val[col] = new RegExp(val[col], "gi"); 16750 } 16751 } 16752 } 16753 return val; 16754 }, 16755 IsEmptyFilter: function() { 16756 return !this.filterInitialized || this.filter === ""; 16757 }, 16758 ShouldDiscardCallbackResult: function() { 16759 var discardCallbackResult = !this.needEmptyFilterBeforeFiltering && !this.IsFilterEqualInputValue() && this.currentCallbackIsFiltration;
16760 if(discardCallbackResult) 16761 this.refiltrationRequired = true; 16762 return discardCallbackResult; 16763 }, 16764 IsFilterEqualInputValue: function() { 16765 var currentFilter = this.GetInputFilterValue(); 16766 return this.FilterCompareLower(ASPx.Str.PrepareStringForFilter(currentFilter)); 16767 }, 16768 FilterCompare: function(value) { 16769 return this.filterInitialized && this.filter === value; 16770 }, 16771 FilterCompareLower: function(value) { 16772 if(!this.filterInitialized) 16773 return false; 16774 return ASPx.Str.PrepareStringForFilter(this.filter) == value; 16775 }, 16776 DiscardHighlighting: function() { 16777 this.GetListBoxControl().highlighting.Remove(this.highlighting, this.isCustomHighlighting); 16778 }, 16779 ApplyHighlighting: function() { 16780 this.GetListBoxControl().highlighting.Apply(this.highlighting, this.isCustomHighlighting); 16781 }, 16782 RefreshHighlighting: function() { 16783 this.GetListBoxControl().highlighting.Refresh(this.highlighting, this.isCustomHighlighting); 16784 }, 16785 MakeAllItemsVisible: function() { 16786 this.GetListBoxControl().MakeAllItemsVisible(); 16787 }, 16788 SetFilter: function(newFilter) { 16789 this.filter = newFilter; 16790 this.highlighting = ""; 16791 this.isCustomHighlighting = undefined; 16792 this.filterInitialized = true; 16793 }, 16794 ClearFilter: function() { 16795 this.filter = ""; 16796 this.highlighting = ""; 16797 this.isCustomHighlighting = undefined; 16798 this.filterInitialized = false; 16799 }, 16800 ClearFilterApplied: function() { 16801 this.filterInitialized = false; 16802 }, 16803 FilteringBackspace: function() { 16804 throw "Not Implemented"; 16805 }, 16806}); 16807var ListBoxFilterStrategy = ASPx.CreateClass(ListEditIncrementalFilterStrategyBase, { 16808 constructor: function(listBox) { 16809 this.constructor.prototype.constructor.call(this, listBox.filteringDelay, listBox.filterMinLength, listBox.isCallbackMode); 16810 this.listBox = listBox; 16811 }, 16812 SupportsFilterCorrection: function() { 16813 return false; 16814 }, 16815 IsEnabled: function() { 16816 return this.listBox.GetEnabled(); 16817 }, 16818 GetInputFilterValue: function() { 16819 return this.listBox.filteringTextBox.GetInputElement().value; 16820 }, 16821 NotifyCollectionChanged: function() { 16822 this.listBox.CollectionChanged(true); 16823 }, 16824 TryProcessFilterLessMinLength: function(oldFilter) { 16825 this.SetFilter(""); 16826 return !oldFilter; 16827 }, 16828 IsSatisfy: function(text, filter) { 16829 return ASPx.Str.PrepareStringForFilter(text).indexOf(filter) !== -1; 16830 }, 16831 GetListBoxControl: function() { 16832 return this.listBox; 16833 }, 16834 OnAfterFilteringOnClientCore: function (filter, firstSatisfyItemIndex) { 16835 if(firstSatisfyItemIndex !== -1) 16836 this.listBox.CorrectCellWidthsOnFirstRowItemReplacement(0, firstSatisfyItemIndex); 16837 }, 16838 OnEndFiltering: function(visibleCollectionChanged) { 16839 ListEditIncrementalFilterStrategyBase.prototype.OnEndFiltering.call(this, visibleCollectionChanged); 16840 if(this.listBox.IsMultiColumn()) 16841 this.listBox.CorrectWidth(); 16842 this.listBox.updateSelectAllElementsState(); 16843 }, 16844 SendCallbackCore: function() { 16845 this.listBox.SendCallback(); 16846 }, 16847 InCallback: function() { 16848 return this.listBox.InCallback(); 16849 }, 16850 PreventEndCallbackRising: function() { 16851 this.listBox.preventEndCallbackRising = true; 16852 }, 16853 GetSelectedIndex: function() { 16854 return this.listBox.GetSelectedIndex(); 16855 }, 16856 OnCallbackCore: function(highlighting, newFilterLength) { 16857 if(this.currentCallbackIsFiltration) 16858 this.SetHighlighting(this.filter, highlighting); 16859 if(this.filter) 16860 this.OnEndFiltering(); 16861 }, 16862 FilteringBackspace: function() { 16863 var textBox = this.listBox.filteringTextBox; 16864 if(textBox) 16865 ASPx.StartWithFilteringUtils.RollbackOneSuggestedChar(textBox.GetInputElement()); 16866 this.FilterStartTimer(); 16867 }, 16868 RaiseItemFilteringEvent: function(item, filter, isFit) { 16869 return this.listBox.RaiseItemFiltering(item, filter, isFit); 16870 }, 16871 RaiseCustomHighlightingEvent: function(filter, callbackHighlighting) { 16872 return this.listBox.RaiseCustomHighlighting(filter, callbackHighlighting); 16873 } 16874}); 16875ASPx.ListBoxItemsDefaultManager = ListBoxItemsDefaultManager; 16876ASPx.ListBoxItemsVirtualManager = ListBoxItemsVirtualManager; 16877ASPx.VirtualRenderListBoxStateControllerManager = VirtualRenderListBoxStateControllerManager;
16878ASPx.DefaultListBoxStateControllerManager = DefaultListBoxStateControllerManager; 16879ASPx.ListEditIncrementalFilterStrategyBase = ListEditIncrementalFilterStrategyBase; 16880ASPx.ListBoxFilterStrategy = ListBoxFilterStrategy; 16881ASPx.ListEditFilterStrategyBase = ListEditFilterStrategyBase; 16882var ASPxClientListEditItemFilteringEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 16883 constructor: function(item, filter, isFit) { 16884 this.constructor.prototype.constructor.call(this); 16885 this.item = item; 16886 this.isFit = isFit; 16887 this.filter = filter; 16888 } 16889}); 16890var ASPxClientListEditCustomHighlightingEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 16891 constructor: function(filter) { 16892 this.constructor.prototype.constructor.call(this); 16893 this.highlighting = null; 16894 this.filter = filter; 16895 } 16896}); 16897ASPx.ListBoxScrollCallbackHelper = ListBoxScrollCallbackHelper; 16898window.ASPxClientListEdit = ASPxClientListEdit; 16899window.ASPxClientListEdit.CONSTANTS = CONSTANTS; 16900window.ASPxClientListEditItem = ASPxClientListEditItem; 16901window.ASPxClientListBoxItem = ASPxClientListBoxItem; 16902window.ASPxClientListBoxBase = ASPxClientListBoxBase; 16903window.ASPxClientListBox = ASPxClientListBox; 16904window.ASPxClientNativeListBox = ASPxClientNativeListBox; 16905window.ASPxClientCheckListBase = ASPxClientCheckListBase; 16906window.ASPxClientRadioButtonList = ASPxClientRadioButtonList; 16907window.ASPxClientCheckBoxList = ASPxClientCheckBoxList; 16908window.ASPxClientListEditItemSelectedChangedEventArgs = ASPxClientListEditItemSelectedChangedEventArgs; 16909window.ASPxClientListEditItemFilteringEventArgs = ASPxClientListEditItemFilteringEventArgs; 16910window.ASPxClientListEditCustomHighlightingEventArgs = ASPxClientListEditCustomHighlightingEventArgs; 16911})(); 16912 16913(function(dx) { 16914 var BootstrapClientListBoxItem = ASPx.CreateClass(ASPxClientListBoxItem, { 16915 constructor: function(listEditBase, index, texts, value, imageUrl, selected, cellStyles, cellCssClasses, cellTooltips, 16916 cellAttributes, htmlContents, style, cssClass, tooltip, attributes, htmlContent, badge, textCssClass) { 16917 this.constructor.prototype.constructor.call(this, listEditBase, index, texts, value, imageUrl, 16918 selected, cellStyles, cellCssClasses, cellTooltips, cellAttributes, htmlContents, style, cssClass, tooltip, attributes, htmlContent); 16919 this.iconCssClass = this.imageUrl; 16920 this.badge = badge; 16921 this.textCssClass = textCssClass; 16922 }, 16923 GetFieldText: function(fieldIndexOrName) { 16924 return this.GetColumnText(fieldIndexOrName); 16925 } 16926 }); 16927 var BSLISTBOX_CLASS = "dxbs-listbox", 16928 SELECTED_CLASS = ASPx.BootstrapCssSelectors.Active, 16929 DISABLED_CLASS = ASPx.BootstrapCssSelectors.Disabled, 16930 TABLE_ROW_SELECTED_CLASS = ASPx.BootstrapCssSelectors.TableActive, 16931 TABLE_ROW_WITH_CHECK_CLASS = "dxbs-check-row", 16932 CHECKBOX_COL_CLASS = "dxbs-check-col", 16933 HIDDEN_ROW_CLASS = "dxbs-hidden-row", 16934 EXTRA_ROW_CLASS = "dxbs-extra-row", 16935 TEMPLATED_ROW_CLASS = "dxbs-templated-row", 16936 LAST_ROW_CLASS = "dxbs-last-data-row", 16937 DROPDOWN_ITEM_LINK_CLASS = ASPx.BootstrapCssSelectors.DropDownMenuItem, 16938 ITEM_LINK_CLASS = ASPx.BootstrapCssSelectors.ListBoxItemLink, 16939 CHECKBOX_CONTAINER_CLASS = ASPx.BootstrapCssSelectors.CheckBox, 16940 ITEM_CLASS = ASPx.BootstrapCssSelectors.ListGroupItem, 16941 ITEM_CHECKBOX_CLASS = ITEM_CLASS + " " + CHECKBOX_CONTAINER_CLASS, 16942 DROPDOWN_ITEM_CHECKBOX_CLASS = ASPx.BootstrapCore.IsBootstrap3 ? ITEM_CHECKBOX_CLASS : DROPDOWN_ITEM_LINK_CLASS + " " + CHECKBOX_CONTAINER_CLASS, 16943 ITEM_CHECKBOX_LABEL_CLASS = ASPx.BootstrapCssSelectors.CheckBoxLabel, 16944 ITEM_CHECKBOX_INPUT_CLASS = ASPx.BootstrapCssSelectors.CheckBoxInput, 16945 ITEM_IMAGE_CLASS = "image", 16946 ITEM_BADGE_CLASS = ASPx.BootstrapCssSelectors.Badge, 16947 DIVIDER_ITEM_CLASS = ASPx.BootstrapCssSelectors.Divider, 16948 STANDALONE_CLASS = ASPx.BootstrapCssSelectors.FormControl, 16949 INACTIVE_FILTER_CLASS = "collapsed", 16950 ANIMATED_FILTER_CLASS = "animated", 16951 lbILdSuffix = "LBL", 16952 lbICdSuffix = "LBC", 16953 lbSelectAllCbIdSuffix = "LBSACB", 16954 CONTENT_TABLE_ID_SUFFIX = "_ContentTable"; 16955 var BootstrapDefaultListBoxStateControllerManager = ASPx.CreateClass(ASPx.DefaultListBoxStateControllerManager, { 16956 constructor: function(listBox) { 16957 this.constructor.prototype.constructor.call(this, listBox); 16958 }, 16959 HasSampleItemStateItems: function() { 16960 return false; 16961 }, 16962 NeedAddHoverStateToItem: function() { 16963 return false; 16964 },
16965 AddFunctionalStates: function(controller, name, itemCellsIdSuffixes) { 16966 controller.AddSelectedItem(name, [SELECTED_CLASS], this.listBox.selectedCssArray, itemCellsIdSuffixes, null, null, true); 16967 controller.AddDisabledItem(name, [DISABLED_CLASS], this.listBox.disabledCssArray, itemCellsIdSuffixes, null, null, true); 16968 }, 16969 }); 16970 var BootstrapVirtualRenderListBoxStateControllerManager = ASPx.CreateClass(ASPx.VirtualRenderListBoxStateControllerManager, { 16971 constructor: function(listBox, virtualRenderItemsManager) { 16972 this.constructor.prototype.constructor.call(this, listBox, virtualRenderItemsManager); 16973 }, 16974 HasSampleItemStateItems: function() { 16975 return false; 16976 }, 16977 }); 16978 var BootstrapListBoxItemsManager = ASPx.CreateClass(ASPx.ListBoxItemsDefaultManager, { 16979 HasSampleItemStateItems: function() { 16980 return false; 16981 }, 16982 GetListTableRows: function() { 16983 return this.listBox.GetItemElements(); 16984 }, 16985 GetItemElement: function(index) { 16986 return this.listBox.GetItemElements()[index]; 16987 }, 16988 GetItemRow: function(index) { 16989 return this.GetItemElement(index); 16990 }, 16991 GetFirstVisibleItemRow: function() { 16992 var firstVisibleItemIndex = this.GetFirstVisibleItem(); 16993 return this.GetItemElement(this.ConvertItemIndexToRowIndex(firstVisibleItemIndex)); 16994 }, 16995 GetItem: function(index) { 16996 var itemElement = this.GetItemElement(index); 16997 if(!itemElement) 16998 return null; 16999 var image = this.listBox.imageCellExists ? itemElement.querySelector("." + ITEM_IMAGE_CLASS) : null; 17000 var iconCssClass = image == null ? "" : ASPx.Str.Trim(ASPx.GetClassName(image).replace(ITEM_IMAGE_CLASS, "")); 17001 var itemValue = this.listBox.itemsValue[index] !== undefined ? this.listBox.itemsValue[index] : null; 17002 return new BootstrapClientListBoxItem(this.listBox, index, this.listBox.GetItemRowTexts(itemElement), itemValue, iconCssClass, this.listBox.GetIsItemSelected(index)); 17003 }, 17004 GetItemIndexByRow: function(itemRow) { 17005 return this.listBox.GetItemIndexByElement(itemRow); 17006 }, 17007 GetItemCount: function() { 17008 return this.listBox.GetItemElements().length; 17009 }, 17010 GetVisibleItemCount: function() { 17011 return this.listBox.GetVisibleItemElements().length; 17012 }, 17013 GetItemTopOffsetCore: function(index) { 17014 return this.listBox.GetElementTopOffset(this.GetItemElement(index)); 17015 }, 17016 GetFirstVisibleItem: function() { 17017 var itemCount = this.GetItemCount(); 17018 for(var i = 0; i < itemCount; i++) { 17019 var itemElement = this.GetItemElement(i); 17020 if(itemElement && ASPx.GetElementDisplay(itemElement)) 17021 return i; 17022 } 17023 return -1; 17024 }, 17025 ConvertItemIndexToRowIndex: function(itemIndex) { 17026 return itemIndex; 17027 }, 17028 InitializeInternalCheckBoxCollection: function () { }, 17029 CreateNewItemRow: function(index) { 17030 return this.listBox.CreateNewItem(); 17031 }, 17032 ClearItemsCore: function() { 17033 var itemElements = this.listBox.GetItemElements(); 17034 for(var i = itemElements.length - 1; i >= 0; i--) 17035 ASPx.RemoveElement(itemElements[i]); 17036 }, 17037 SetItemBadgeText: function(index, text) { }, 17038 SetItemBadgeIconCssClass: function(index, cssClass) { }, 17039 getFirstNthItemsHeight: function(listBoxRows) { 17040 var result = 0; 17041 var itemsCount = this.GetItemCount(); 17042 var extraRows = this.listBox.getExtraRows(); 17043 if(this.GetItemCount() > 0 && listBoxRows > this.GetItemCount()) { 17044 result = this.GetTotalItemsHeight(0, itemsCount - 1); 17045 var extraItemsCount = listBoxRows - itemsCount; 17046 result += extraItemsCount * this.GetItemHeight(0); 17047 } 17048 else if(this.GetItemCount() > 0) 17049 result = this.GetTotalItemsHeight(0, listBoxRows - 1); 17050 else if(extraRows.length > 0) 17051 result = extraRows[0].getBoundingClientRect().height * listBoxRows; 17052 return result; 17053 } 17054 }); 17055 var BootstrapListBoxItemsVirtualManager = ASPx.CreateClass(ASPx.ListBoxItemsVirtualManager, { 17056 InitializeItemRows: function() { 17057 var renderHelper = this.listBox.listBoxRenderHelper; 17058 var itemsContainer = renderHelper.GetItemsContainer(); 17059 var virtualScrollTopSpacer = renderHelper.CreateNewItemElement(); 17060 virtualScrollTopSpacer.setAttribute("id", this.listBox.name + "VirtualScrollTopSpacer"); 17061 virtualScrollTopSpacer.setAttribute("data-type", "spacer"); 17062 itemsContainer.insertBefore(virtualScrollTopSpacer, itemsContainer.childNodes[0]); 17063 var virtualScrollBottomSpacer = renderHelper.CreateNewItemElement(); 17064 virtualScrollBottomSpacer.setAttribute("id", this.listBox.name + "VirtualScrollBottomSpacer"); 17065 virtualScrollBottomSpacer.setAttribute("data-type", "spacer"); 17066 itemsContainer.appendChild(virtualScrollBottomSpacer); 17067 var scrollDiv = renderHelper.GetScrollDivElement(); 17068 ASPx.Evt.AttachEventToElement(scrollDiv, "scroll", this.onScroll.bind(this)); 17069 }, 17070 UseVirtualItemWidth: function() { 17071 return false; 17072 }, 17073 GetItemsWidth: function() { 17074 return this.listTable.offsetWidth; 17075 }, 17076 Adjust: function() { 17077 if(this.GetItemCount() == 0) { 17078 this.UpdateVirtualScrollSpacerVisibility(this.GetVirtualScrollTopSpacer()); 17079 this.UpdateVirtualScrollSpacerVisibility(this.GetVirtualScrollBottomSpacer()); 17080 } 17081 ASPx.ListBoxItemsVirtualManager.prototype.Adjust.call(this); 17082 }, 17083 GetVirtualScrollBottomSpacer: function() { 17084 return document.getElementById(this.listBox.name + "VirtualScrollBottomSpacer"); 17085 }, 17086 UpdateScrollTableContainerHeight: function() { 17087 this.UpdateVirtualScrollBottomSpacerHeight(this.virtualScrollVisibleItemIndices); 17088 }, 17089 UpdateVirtualScrollSpacerHeight: function(visibleIndices) { 17090 ASPx.ListBoxItemsVirtualManager.prototype.UpdateVirtualScrollSpacerHeight.call(this, visibleIndices); 17091 this.UpdateVirtualScrollSpacerVisibility(this.GetVirtualScrollTopSpacer()); 17092 this.UpdateVirtualScrollBottomSpacerHeight(visibleIndices); 17093 }, 17094 UpdateVirtualScrollBottomSpacerHeight: function(visibleIndices) { 17095 var bottomSpacerElement = this.GetVirtualScrollBottomSpacer(); 17096 if(bottomSpacerElement) { 17097 var virtualBottomSpacerHeight = 0; 17098 if(visibleIndices.length > 0 && this.filteredItemIndices.length > 0) { 17099 virtualBottomSpacerHeight = this.GetTotalItemsHeight(ASPx.Data.ArrayIndexOf(this.filteredItemIndices, visibleIndices[0]), this.filteredItemIndices.length - 1); 17100 } 17101 else { 17102 virtualBottomSpacerHeight = this.GetTotalItemsHeight(0, this.filteredItemIndices.length - 1); 17103 } 17104 var visibleItemsHeight = visibleIndices.length > 0 17105 ? this.GetTotalItemsHeight(visibleIndices[0], visibleIndices[visibleIndices.length - 1]) 17106 : 0; 17107 var visibleItemsHeightDiff = (isNaN(this.itemHeightDiff) 17108 ? 0 17109 : this.itemHeightDiff) * visibleIndices.length; 17110 virtualBottomSpacerHeight -= visibleItemsHeight + visibleItemsHeightDiff; 17111 virtualBottomSpacerHeight -= this.listBox.GetTopScrollSpacerHeight() + this.listBox.GetBottomScrollSpacerHeight(); 17112 if(!isNaN(virtualBottomSpacerHeight)) { 17113 if (virtualBottomSpacerHeight < 0) 17114 virtualBottomSpacerHeight = 0; 17115 ASPx.SetStyles(bottomSpacerElement, { height: virtualBottomSpacerHeight });
17116 this.UpdateVirtualScrollSpacerVisibility(bottomSpacerElement); 17117 } 17118 } 17119 }, 17120 UpdateVirtualScrollSpacerVisibility: function(spacerElement) { 17121 var height = parseInt(spacerElement.style.height); 17122 var isDisplayed = !isNaN(height) && height > 0; 17123 if(ASPx.GetElementDisplay(spacerElement) != isDisplayed) 17124 ASPx.SetElementDisplay(spacerElement, isDisplayed); 17125 }, 17126 GetListTableRows: function() { 17127 return this.listBox.GetItemElements(); 17128 }, 17129 GetItemElement: function(index) { 17130 if(index > -1) { 17131 var itemElements = this.listBox.GetItemElements(); 17132 return itemElements && itemElements.length ? itemElements[index] : null; 17133 } 17134 return null; 17135 }, 17136 GetItemRow: function(index) { 17137 return this.GetItemElement(this.ConvertItemIndexToRowIndex(index)); 17138 }, 17139 GetFirstVisibleItemRow: function() { 17140 var firstVisibleItemIndex = this.GetFirstVisibleItem(); 17141 return this.GetItemElement(this.ConvertItemIndexToRowIndex(firstVisibleItemIndex)); 17142 }, 17143 GetItem: function(index) { 17144 if(index < 0 || index >= this.GetItemCount()) 17145 return null; 17146 var deserializedItem = this.deserializedItems[index]; 17147 var itemTexts = this.AdjustItemTexts(deserializedItem); 17148 var result = new BootstrapClientListBoxItem(this.listBox, index, itemTexts, deserializedItem.value, 17149 deserializedItem.imageUrl, this.listBox.GetIsItemSelected(index)); 17150 result.insertOrderIndex = deserializedItem.insertOrderIndex; 17151 return result; 17152 }, 17153 GetItemsHeight: function() { 17154 var itemsHeight = ASPx.ListBoxItemsVirtualManager.prototype.GetItemsHeight.call(this); 17155 return itemsHeight + ASPx.GetTopBottomBordersAndPaddingsSummaryValue(this.listBox.GetListTable()); 17156 }, 17157 GetVisibleItemCount: function() { 17158 return this.filteredItemIndices.length; 17159 }, 17160 GetItemTopOffsetCore: function(index) { 17161 return this.listBox.GetElementTopOffset(this.GetItemRow(index)); 17162 }, 17163 GetFirstVisibleItem: function() { 17164 var itemCount = this.GetItemCount(); 17165 for(var i = 0; i < itemCount; i++) { 17166 var itemElement = this.GetItemElement(i); 17167 if(itemElement && itemElement.itemIndex >= 0) 17168 return itemElement.itemIndex; 17169 } 17170 return -1; 17171 }, 17172 GetScrollDivChildElementHeight: function() { 17173 var itemsHeight = 0; 17174 var itemElements = this.listBox.GetItemElements(); 17175 for(var i = 0; i < itemElements.length; i++) 17176 itemsHeight += itemElements[i].offsetHeight + ASPx.GetTopBottomMargins(itemElements[i]); 17177 var bottomSpacerElement = document.getElementById(this.listBox.name + "VirtualScrollBottomSpacer"); 17178 var spacersHeight = this.listBox.GetTopSpacersHeight() + this.listBox.GetBottomScrollSpacerHeight() + bottomSpacerElement.clientHeight; 17179 return itemsHeight + spacersHeight; 17180 }, 17181 ConvertItemIndexToRowIndex: function(itemIndex) { 17182 var result = ASPx.Data.ArrayIndexOf(this.listBox.GetItemElements(), itemIndex, function(element) { return element.itemIndex === itemIndex; }); 17183 return result; 17184 }, 17185 GetFirstRenderedItem: function() { 17186 if(this.GetItemCount() > 0) { 17187 var itemElements = this.listBox.GetItemElements(); 17188 for(var i = 0; i < itemElements.length; i++) 17189 if(itemElements[i].itemIndex !== undefined) 17190 return this.GetItem(itemElements[i].itemIndex); 17191 } 17192 return null; 17193 }, 17194 GetLastRenderedItem: function() { 17195 var itemElements = this.listBox.GetItemElements(); 17196 for(var i = itemElements.length - 1; i >= 0; i--) 17197 if(itemElements[i].itemIndex !== undefined) 17198 return this.GetItem(itemElements[i].itemIndex); 17199 return null; 17200 }, 17201 GetRenderedItemRange: function () { 17202 var itemElements = this.listBox.GetItemElements(); 17203 return { 17204 startIndex: itemElements.length > 0 ? this.GetFirstRenderedItem().index : -1, 17205 endIndex: itemElements.length > 0 ? this.GetLastRenderedItem().index : -1 17206 }; 17207 }, 17208 RemoveItemCore: function(index) { 17209 ASPx.ListBoxItemsVirtualManager.prototype.RemoveItemCore.call(this, index); 17210 this.listBox.DropCachedItemElements(); 17211 }, 17212 CreateNewItemRow: function(index) { 17213 var newItemElement = this.listBox.CreateNewItem(); 17214 newItemElement.itemIndex = index; 17215 return newItemElement; 17216 }, 17217 ClearItemsCore: function() { 17218 var itemElements = this.listBox.GetItemElements(); 17219 for(var i = itemElements.length - 1; i >= 0; i--) 17220 ASPx.RemoveElement(itemElements[i]); 17221 }, 17222 SetItemBadgeText: function(index, text) { 17223 var item = this.deserializedItems[index]; 17224 if(item) { 17225 if(!item.badge) 17226 item.badge = { text: text }; 17227 else 17228 item.badge.text = text; 17229 } 17230 }, 17231 SetItemBadgeIconCssClass: function(index, cssClass) { 17232 var item = this.deserializedItems[index]; 17233 if(item) { 17234 if(!item.badge) 17235 item.badge = { iconCssClass: cssClass }; 17236 else 17237 item.badge.iconCssClass = cssClass; 17238 } 17239 }, 17240 RecreateItemRowsByVisibleIndices: function (newVisibleIndices, keepTopSpacerHeight, recreateItemsPartially) { 17241 ASPx.ListBoxItemsVirtualManager.prototype.RecreateItemRowsByVisibleIndices.c
17241all(this, newVisibleIndices, keepTopSpacerHeight, recreateItemsPartially); 17242 this.UpdateVirtualScrollSpacerVisibility(this.GetVirtualScrollTopSpacer()); 17243 this.listBox.listBoxRenderHelper.UpdateVisibleItemsLastRowCssClass(); 17244 }, 17245 setScrollSpacerHeight: function(scrollSpacer, newHeight) { 17246 ASPx.SetStyles(scrollSpacer, { height: newHeight }); 17247 }, 17248 IsItemTextWrapEnabled: function() { 17249 return true; 17250 }, 17251 getFirstNthItemsHeight: function(listBoxRows) { 17252 var result = 0; 17253 if(this.filteredItemIndices.length > 0) { 17254 for(var i = 0; i < listBoxRows; i++) { 17255 if(!this.deserializedItems[this.filteredItemIndices[i]].calculatedHeight) { 17256 this.RecreateItemRowsByVisibleIndices(this.filteredItemIndices.slice(0, listBoxRows), false, false); 17257 break; 17258 } 17259 } 17260 } 17261 var extraRows = this.listBox.getExtraRows(); 17262 if(this.filteredItemIndices.length > 0 && listBoxRows > this.filteredItemIndices.length) { 17263 result = this.GetTotalItemsHeight(0, this.filteredItemIndices.length - 1); 17264 var extraItemsCount = listBoxRows - this.filteredItemIndices.length; 17265 result += extraItemsCount * this.GetItemHeight(0); 17266 } else if(this.filteredItemIndices.length > 0) 17267 result = this.GetTotalItemsHeight(0, listBoxRows - 1); 17268 else if(extraRows.length > 0) 17269 result = extraRows[0].getBoundingClientRect().height * listBoxRows; 17270 return result; 17271 } 17272 }); 17273 var BootstrapListBoxScrollCallbackHelper = ASPx.CreateClass(ASPx.ListBoxScrollCallbackHelper, { 17274 constructor: function(listBoxControl) { 17275 this.constructor.prototype.constructor.call(this, listBoxControl); 17276 }, 17277 GetListHeight: function () { 17278 var itemElements = this.listBoxControl.GetItemElements(); 17279 var listHeight = 0; 17280 for(var i = 0; i < itemElements.length; i++) 17281 listHeight += itemElements[i].clientHeight; 17282 return listHeight; 17283 } 17284 }); 17285 var BootstrapListBoxRenderHelper = ASPx.CreateClass(null, { 17286 constructor: function(listBox) { 17287 this.listBox = listBox; 17288 }, 17289 GetListElement: function() { return null; }, 17290 GetItemsContainer: function() { return null; }, 17291 GetRowElements: function() { return null; }, 17292 GetScrollDivElement: function() { return null; }, 17293 GetItemSelectableElementsByRow: function(row) { return null; }, 17294 CreateNewItemElement: function() { return null; }, 17295 CreateNewItemCheckBoxContainer: function() { return null; }, 17296 GetListTableHeight: function() { return 0; }, 17297 GetRowsExtraHeight: function() { return 0; }, 17298 AddItemContent: function(itemElement, itemProperties) { }, 17299 AddItemStateItems: function(name) { }, 17300 UpdateVisibleItemsLastRowCssClass: function() { }, 17301 SetItemTabIndexAttribute: function(item) { }, 17302 ReplaceItemHtmlContent: function (itemRow, html) { }, 17303 SetItemHtmlContent: function (itemRow, html) { }, 17304 CreateItemWithHtmlContent: function (newItemElement, itemProperties) { }, 17305 UpdateItemStateAfterSetHtml: function (index) { }, 17306 GetItemTextCell: function (itemIndex, textCellIndex) { return null; }, 17307 SetItemTextCellHtml: function (itemIndex, textCellIndex, html) { }, 17308 GetItemTextGivenContents: function (itemProperties) { return ""; }, 17309 GetItemCellsIdPostfixes: function () { return []; }, 17310 GetRowElementsCore: function(itemTagName) { 17311 var itemsContainer = this.GetItemsContainer(); 17312 return itemsContainer ? ASPx.GetChildNodesByQuerySelector(itemsContainer, itemTagName + ":not(.separator):not(." + DIVIDER_ITEM_CLASS + "):not([data-type='spacer'])") : []; 17313 }, 17314 GetItemHtmlContent: function(text) { 17315 text = this.listBox.FormatText(text); 17316 if(!ASPx.IsExists(text)) 17317 text = ""; 17318 if(this.listBox.encodeHtml) 17319 text = ASPx.Str.EncodeHtml(text); 17320 return this.listBox.ProtectWhitespaceSerieses(text); 17321 }, 17322 CreateNewItemCheckBoxContainerCore: function(containerTagName, containerCssClass) { 17323 var checkBoxContainer = document.createElement(containerTagName); 17324 if(containerCssClass) 17325 ASPx.SetClassName(checkBoxContainer, containerCssClass); 17326 var checkBoxInput = document.createElement("INPUT"); 17327 checkBoxInput.type = "checkbox"; 17328 if(ITEM_CHECKBOX_INPUT_CLASS) 17329 ASPx.SetClassName(checkBoxInput, ITEM_CHECKBOX_INPUT_CLASS); 17330 checkBoxContainer.appendChild(checkBoxInput); 17331 return checkBoxContainer; 17332 } 17333 }); 17334 var BootstrapListBoxListRenderHelper = ASPx.CreateClass(BootstrapListBoxRenderHelper, { 17335 constructor: function(listBox) { 17336 this.constructor.prototype.constructor.call(this, listBox); 17337 }, 17338 GetListElement: function() { 17339 var mainElement = this.listBox.GetMainElement(); 17340 return mainElement && mainElement.querySelector("UL") || null; 17341 }, 17342 GetItemsContainer: function() { return this.GetListElement(); }, 17343 GetRowElements: function() { return this.GetRowElementsCore("li"); }, 17344 GetScrollDivElement: function() { return this.GetListElement(); }, 17345 CreateNewItemElement: function() { 17346 return document.createElement("LI"); 17347 }, 17348 AddItemContent: function(itemElement, itemProperties) { 17349 var htmlContent = this.GetItemTextGivenContents(itemProperties); 17350 var internalElement = document.createElement(this.listBox.GetItemInternalElementTagName()); 17351 itemElement.appendChild(internalElement); 17352 var textElement = document.createElement("SPAN"); 17353 ASPx.Security.setInnerHtml(textElement, htmlContent, ASPx.Security.DataType.Trusted); 17354 var checkBoxLabel = null; 17355 if(this.listBox.GetIsCheckColumnExists()) { 17356 if(ASPx.BootstrapCore.IsBootstrap3) { 17357 ASPx.SetClassName(internalElement, this.listBox.GetItemCheckBoxClassName()); 17358 checkBoxLabel = this.CreateNewItemCheckBoxContainer(); 17359 internalElement.appendChild(checkBoxLabel); 17360 } else { 17361 ASPx.SetClassName(internalElement, ITEM_CLASS); 17362 var formCheckElement = document.createElement("div"); 17363 ASPx.SetClassName(formCheckElement, CHECKBOX_CONTAINER_CLASS); 17364 internalElement.appendChild(formCheckElement); 17365 var checkBoxInput = document.createElement("INPUT"); 17366 checkBoxInput.type = "checkbox"; 17367 ASPx.SetClassName(checkBoxInput, ITEM_CHECKBOX_INPUT_CLASS); 17368 formCheckElement.appendChild(checkBoxInput); 17369 checkBoxLabel = document.createElement("LABEL"); 17370 ASPx.SetClassName(checkBoxLabel, ITEM_CHECKBOX_LABEL_CLASS); 17371 formCheckElement.appendChild(checkBoxLabel); 17372 } 17373 checkBoxLabel.appendChild(textElement); 17374 } 17375 else {
17376 var linkCssClasses = []; 17377 if(!this.listBox.IsDropDown()) 17378 linkCssClasses.push(ITEM_LINK_CLASS); 17379 else if(DROPDOWN_ITEM_LINK_CLASS) 17380 linkCssClasses.push(DROPDOWN_ITEM_LINK_CLASS); 17381 if(this.cssClasses && this.listBox.cssClasses.lbi) 17382 linkCssClasses.push(this.listBox.cssClasses.lbi); 17383 if(linkCssClasses.length) 17384 ASPx.SetClassName(internalElement, linkCssClasses.join(" ")); 17385 internalElement.appendChild(textElement); 17386 } 17387 if(itemProperties) { 17388 if(this.listBox.isComboBoxList && this.listBox.IsMultiColumn()) { 17389 var needTextsDataAttribute = this.listBox.ownerControl && this.listBox.ownerControl.displayFormat != null 17390 || itemProperties.texts.join("; ") != this.listBox.FormatText(itemProperties.texts); 17391 if(needTextsDataAttribute) 17392 this.listBox.SetTextsDataAttribute(itemElement, itemProperties.texts); 17393 } 17394 this.listBox.PrepareItem(checkBoxLabel || internalElement, itemProperties); 17395 var badgeInfo = itemProperties.badge; 17396 if(badgeInfo) { 17397 var badge = ASPx.BootstrapBadgeManager.createBadge(badgeInfo.text, badgeInfo.iconCssClass); 17398 if(badgeInfo.cssClass && badgeInfo.cssClass.length) 17399 ASPx.AddClassNameToElement(badge, badgeInfo.cssClass); 17400 internalElement.appendChild(badge); 17401 } 17402 var itemTextCssClass = itemProperties.textCssClass; 17403 if(itemTextCssClass) 17404 ASPx.AddClassNameToElement(textElement, itemTextCssClass); 17405 } 17406 }, 17407 AddItemStateItems: function(name) { 17408 var itemCellsIdSuffixes = this.GetItemCellsIdPostfixes(); 17409 var controller = ASPx.GetStateController(); 17410 controller.AddSelectedItem(name, [SELECTED_CLASS], this.listBox.selectedCssArray, itemCellsIdSuffixes, null, null, true); 17411 controller.AddDisabledItem(name, [DISABLED_CLASS], this.listBox.disabledCssArray, itemCellsIdSuffixes, null, null, true); 17412 }, 17413 GetItemCellsIdPostfixes: function() { 17414 var idPostfixes = []; 17415 var firstRenderedItem = this.listBox.itemsManager.GetFirstRenderedItem(); 17416 var hasItemTemplate = firstRenderedItem ? this.listBox.ItemRowHasTemplate(firstRenderedItem.index) : false; 17417 var isBootstrap3DropDownMenuItem = !this.listBox.IsStandAlone() && ASPx.BootstrapCore.IsBootstrap3; 17418 var hasCheckColumn = this.listBox.GetIsCheckColumnExists(); 17419 if(hasCheckColumn) 17420 idPostfixes.push(lbICdSuffix); 17421 else { 17422 if(hasItemTemplate || isBootstrap3DropDownMenuItem) 17423 idPostfixes.push(''); 17424 if(!hasItemTemplate) 17425 idPostfixes.push(lbILdSuffix); 17426 } 17427 return idPostfixes; 17428 }, 17429 CreateNewItemCheckBoxContainer: function() { 17430 return this.CreateNewItemCheckBoxContainerCore("LABEL", ITEM_CHECKBOX_LABEL_CLASS); 17431 }, 17432 GetItemSelectableElementsByRow: function(row) { 17433 return ASPx.GetChildElementNodesByPredicate(this.listBox.GetItemContentElement(row), 17434 function(child) { return !ASPx.ElementContainsCssClass(child, ITEM_BADGE_CLASS); }); 17435 }, 17436 GetListTableHeight: function() { 17437 var result = 0; 17438 var itemElements = this.listBox.GetItemElements(); 17439 for (var i = 0; i < itemElements.length; i++) 17440 result += itemElements[i].offsetHeight + ASPx.GetTopBottomMargins(itemElements[i]); 17441 result += ASPx.GetTopBottomBordersAndPaddingsSummaryValue(this.listBox.GetListTable()); 17442 return result; 17443 }, 17444 CreateItemWithHtmlContent: function (newItemElement, itemProperties) { 17445 if (this.listBox.GetIsCheckColumnExists()) { 17446 var internalElement = document.createElement(this.listBox.GetItemInternalElementTagName()); 17447 ASPx.SetClassName(internalElement, this.listBox.GetItemCheckBoxClassName()); 17448 newItemElement.appendChild(internalElement); 17449 ASPx.Security.setInnerHtml(internalElement, itemProperties.htmlContent, ASPx.Security.DataType.Trusted); 17450 var checkBoxLabel = this.CreateNewItemCheckBoxContainer(); 17451 checkBoxLabel.innerHTML += " "; 17452 internalElement.insertBefore(checkBoxLabel, internalElement.childNodes[0]); 17453 this.listBox.EnsureStartupScriptsInContainer(internalElement); 17454 } 17455 else 17456 this.ReplaceItemHtmlContent(newItemElement, itemProperties.htmlContent); 17457 this.listBox.SetTextsDataAttribute(newItemElement, itemProperties.texts); 17458 ASPx.AddClassNameToElement(newItemElement, TEMPLATED_ROW_CLASS); 17459 }, 17460 ReplaceItemHtmlContent: function (itemRow, html) { 17461 if (this.listBox.IsDropDown())
17462 ASPx.AddClassNameToElement(itemRow, DROPDOWN_ITEM_LINK_CLASS); 17463 else 17464 ASPx.AddClassNameToElement(itemRow, ITEM_CLASS); 17465 ASPx.Security.setInnerHtml(itemRow, html, ASPx.Security.DataType.Trusted); 17466 this.listBox.EnsureStartupScriptsInContainer(itemRow); 17467 }, 17468 SetItemHtmlContent: function (itemRow, html) { 17469 if (this.listBox.GetIsCheckColumnExists()) { 17470 var checkboxContainer = ASPx.GetChildByPartialClassName(itemRow, CHECKBOX_CONTAINER_CLASS); 17471 var checkboxLabel = ASPx.GetChildByTagName(checkboxContainer, "LABEL", 0); 17472 var checkboxInput = checkboxLabel.querySelector('input[type="checkbox"]'); 17473 while (checkboxInput.nextSibling) 17474 checkboxLabel.removeChild(checkboxInput.nextSibling); 17475 checkboxLabel.innerHTML += " "; 17476 while (checkboxLabel.nextSibling) 17477 checkboxContainer.removeChild(checkboxLabel.nextSibling); 17478 checkboxContainer.innerHTML += html; 17479 this.listBox.EnsureStartupScriptsInContainer(checkboxContainer); 17480 } 17481 else 17482 this.ReplaceItemHtmlContent(itemRow, html); 17483 }, 17484 UpdateItemStateAfterSetHtml: function (index) { 17485 var itemRow = this.listBox.GetItemRow(index); 17486 ASPx.AddClassNameToElement(itemRow, TEMPLATED_ROW_CLASS); 17487 var controller = ASPx.GetStateController(); 17488 controller.AddSelectedItem(itemRow.id, [SELECTED_CLASS], this.listBox.selectedCssArray, null, null, null, true); 17489 }, 17490 GetItemTextCell: function (itemIndex, textCellIndex) { 17491 return this.listBox.GetItemFirstTextCell(itemIndex); 17492 }, 17493 SetItemTextCellHtml: function (itemIndex, textCellIndex, html) { 17494 this.listBox.hasDecoratedItems = true; 17495 this.listBox.itemsManager.SetItemTextCellHtml(itemIndex, textCellIndex, html); 17496 var itemText = this.GetItemTextGivenContents(this.listBox.itemsManager.deserializedItems[itemIndex]); 17497 this.listBox.ProcessItemTextCell(itemIndex, textCellIndex, function (textCell) { 17498 var itemTexts = this.listBox.GetItem(itemIndex).texts; 17499 var itemRow = ASPx.GetParentByTagName(textCell, "LI"); 17500 if (this.listBox.GetIsCheckColumnExists() && textCell == itemRow) 17501 this.listBox.SetItemHtmlContent(itemRow, itemText); 17502 else { 17503 ASPx.Security.setInnerHtml(textCell, itemText, ASPx.Security.DataType.Trusted); 17504 this.listBox.EnsureStartupScriptsInContainer(textCell); 17505 } 17506 if (!this.listBox.ItemRowHasSerializedTextsAttr(itemRow)) { 17507 if (typeof (itemTexts) == "string") 17508 itemTexts = [itemTexts]; 17509 this.listBox.SetTextsDataAttribute(itemRow, itemTexts); 17510 } 17511 ASPx.AddClassNameToElement(itemRow, TEMPLATED_ROW_CLASS); 17512 this.listBox.itemsManager.OnDecoratedItemsRendering(); 17513 }.aspxBind(this)); 17514 }, 17515 GetItemTextGivenContents: function (itemProperties) { 17516 var texts = itemProperties.texts; 17517 if (itemProperties.htmlContents) 17518 for (var i = 0; i < itemProperties.htmlContents.length; i++) { 17519 var index = itemProperties.htmlContents[i].index; 17520 texts[index] = itemProperties.htmlContents[i].value; 17521 } 17522 return this.GetItemHtmlContent(texts); 17523 } 17524 }); 17525 var BootstrapListBoxTableRenderHelper = ASPx.CreateClass(BootstrapListBoxRenderHelper, { 17526 constructor: function(listBox) { 17527 this.constructor.prototype.constructor.call(this, listBox); 17528 }, 17529 GetListElement: function() { return this.listBox.GetChildElement(CONTENT_TABLE_ID_SUFFIX); }, 17530 GetItemsContainer: function() { 17531 var listElement = this.GetListElement(); 17532 return listElement && listElement.querySelector("tbody"); 17533 }, 17534 GetRowElements: function() { return this.GetRowElementsCore("tr"); }, 17535 GetScrollDivElement: function() { 17536 var listElement = this.GetListElement(); 17537 return listElement && listElement.parentNode || null; 17538 }, 17539 CreateNewItemElement: function() { 17540 var cellsCount = this.listBox.columnFieldNames.length; 17541 if(this.listBox.GetIsCheckColumnExists()) 17542 cellsCount++; 17543 var tableRow = document.createElement("TR"); 17544 for (var i = 0; i < cellsCount; i++) { 17545 var tableCell = document.createElement('TD'); 17546 tableRow.appendChild(tableCell); 17547 } 17548 return tableRow; 17549 }, 17550 AddItemContent: function(itemElement, itemProperties) { 17551 if(this.listBox.GetIsCheckColumnExists()) { 17552 checkBoxContainer = this.CreateNewItemCheckBoxContainer(); 17553 var checkCol = itemElement.cells[0]; 17554 ASPx.SetClassName(checkCol, CHECKBOX_COL_CLASS); 17555 checkCol.appendChild(checkBoxContainer); 17556 } 17557 var fieldsCount = this.listBox.columnFieldNames.length || 1; 17558 for(var i = 0; i < fieldsCount; i++){ 17559 var cellIndex = this.GetCellIndex(i); 17560 var htmlContent = this.listBox.GetCellInfo(i, itemProperties.htmlContents); 17561 var text = htmlContent ? htmlContent : this.GetItemHtmlContent(itemProperties.texts[i]); 17562 ASPx.Security.setInnerHtml(itemElement.cells[cellIndex], text, ASPx.Security.DataType.Trusted); 17563 } 17564 }, 17565 AddItemStateItems: function(name) { 17566 var controller = ASPx.GetStateController(); 17567 var selectedClass = TABLE_ROW_SELECTED_CLASS; 17568 if(this.listBox.GetIsCheckColumnExists()) 17569 selectedClass += " " + TABLE_ROW_WITH_CHECK_CLASS; 17570 controller.AddSelectedItem(name, [selectedClass], this.listBox.selectedCssArray, null, null, null, true); 17571 }, 17572 CreateNewItemCheckBoxContainer: function() { 17573 if(!ASPx.BootstrapCore.IsBootstrap3) 17574 return this.CreateNewItemCheckBoxContainerCore("DIV", CHECKBOX_CONTAINER_CLASS); 17575 var divContainer = document.createElement("DIV");
17576 ASPx.SetClassName(divContainer, CHECKBOX_CONTAINER_CLASS); 17577 divContainer.appendChild(this.CreateNewItemCheckBoxContainerCore("LABEL", "")); 17578 return divContainer; 17579 }, 17580 GetCellIndex: function(itemIndex) { 17581 if(this.listBox.GetIsCheckColumnExists()) 17582 return itemIndex + 1; 17583 return itemIndex; 17584 }, 17585 GetItemSelectableElementsByRow: function(row) { 17586 return row.cells; 17587 }, 17588 UpdateVisibleItemsLastRowCssClass: function () { 17589 if (this.listBox.IsStandAlone()) 17590 return; 17591 var visibleItems = this.listBox.GetItemElements(); 17592 if (!visibleItems.length) 17593 return; 17594 var lastVisibleItemIndex = visibleItems.length - 1; 17595 if (lastVisibleItemIndex > 0) { 17596 for (var i = 0; i < lastVisibleItemIndex; i++) { 17597 ASPx.RemoveClassNameFromElement(visibleItems[i], LAST_ROW_CLASS); 17598 } 17599 } 17600 ASPx.AddClassNameToElement(visibleItems[lastVisibleItemIndex], LAST_ROW_CLASS); 17601 }, 17602 SetItemTabIndexAttribute: function(item) { 17603 if(this.listBox.IsStandAlone() && !this.listBox.GetIsCheckColumnExists()) 17604 ASPx.Attr.SetAttribute(item, "tabindex", 0); 17605 }, 17606 GetListTableHeight: function() { 17607 return this.listBox.GetListTable().offsetHeight; 17608 }, 17609 GetRowsExtraHeight: function() { return 1; }, 17610 SetItemHtmlContent: function (itemRow, html) { 17611 var redundantCells = ASPx.Data.CollectionToArray(itemRow.cells) 17612 .slice(this.listBox.GetItemFirstTextCellIndex(), itemRow.cells.length - 1); 17613 redundantCells.forEach(function (cell) { itemRow.removeChild(cell); }); 17614 var itemHtmlContainerCell = itemRow.cells[itemRow.cells.length - 1]; 17615 var headerCellsCount = this.listBox.GetHeaderTableElement().rows[0].cells.length; 17616 var visibleDataColumnCount = this.listBox.GetIsCheckColumnExists() ? headerCellsCount - 1 : headerCellsCount; 17617 itemHtmlContainerCell.colSpan = visibleDataColumnCount; 17618 ASPx.Security.setInnerHtml(itemHtmlContainerCell, html, ASPx.Security.DataType.Trusted); 17619 }, 17620 CreateItemWithHtmlContent: function (newItemElement, itemProperties) { 17621 if (this.listBox.GetIsCheckColumnExists()) { 17622 checkBoxContainer = this.CreateNewItemCheckBoxContainer(); 17623 var checkCol = newItemElement.cells[0]; 17624 ASPx.SetClassName(checkCol, CHECKBOX_COL_CLASS); 17625 checkCol.appendChild(checkBoxContainer); 17626 } 17627 this.SetItemHtmlContent(newItemElement, itemProperties.htmlContent); 17628 this.listBox.SetTextsDataAttribute(newItemElement, itemProperties.texts); 17629 }, 17630 GetItemTextCell: function (itemIndex, textCellIndex) { 17631 var rowElement = this.listBox.GetItemRow(itemIndex); 17632 if (rowElement == null) 17633 return null; 17634 return rowElement.cells[this.listBox.GetItemFirstTextCellIndex() + textCellIndex]; 17635 }, 17636 GetItemCellsIdPostfixes: function() { 17637 return [""]; 17638 }, 17639 SetItemTextCellHtml: function (itemIndex, textCellIndex, html) { 17640 this.listBox.hasDecoratedItems = true; 17641 this.listBox.itemsManager.SetItemTextCellHtml(itemIndex, textCellIndex, html); 17642 this.listBox.ProcessItemTextCell(itemIndex, textCellIndex, function (textCell) { 17643 if (!this.listBox.ItemCellHasTextAttr(textCell)) 17644 this.listBox.SetItemCellTextDataAttribute(textCell, this.listBox.GetItem(itemIndex).texts[textCellIndex]); 17645 this.listBox.SetItemTextCellHtmlContent(textCell, html); 17646 this.listBox.itemsManager.OnDecoratedItemsRendering(); 17647 }.aspxBind(this)); 17648 } 17649 }); 17650 var BootstrapClientListBox = ASPx.CreateClass(ASPxClientListBox, { 17651 constructor: function(name) { 17652 this.constructor.prototype.constructor.call(this, name); 17653 this.heightInitialized = false; 17654 this.isSyncEnabled = false; 17655 this.itemClickHandler = function(evt) { 17656 if(ASPx.Evt.IsLeftButtonPressed(evt) || !this.isComboBoxList) 17657 return this.OnListBoxItemClick(evt); 17658 }.bind(this); 17659 this.itemKeyUpHandler = function(evt) { 17660 if(evt.keyCode === ASPx.Key.Enter) 17661 return this.OnListBoxItemClick(evt); 17662 }.bind(this); 17663 this.itemDblClickHandler = function() { this.OnItemDblClick(); }.bind(this); 17664 this.feedbackRenderHelper = new ASPx.BootstrapEditFeedbackRenderHelper(this); 17665 this.listBoxRenderHelper = this.IsEnableMultiColumn() ? new BootstrapListBoxTableRenderHelper(this) : new BootstrapListBoxListRenderHelper(this); 17666 if(ASPx.Browser.WebKitTouchUI && !this.GetIsValid()) 17667 this.UpdateErrorText(); 17668 }, 17669 CreateVirtualRenderStateControllerManager: function() { 17670 return new BootstrapVirtualRenderListBoxStateControllerManager(this, this.itemsManager); 17671 }, 17672 CreateDefaultRenderStateControllerManager: function() { 17673 return new BootstrapDefaultListBoxStateControllerManager(this); 17674 }, 17675 CreateHighlightingHelper: function() { 17676 return new ASPx.BootstrapListBoxHighlightingHelper(this, "mark"); 17677 }, 17678 OnListBoxItemClick: function(evt) { 17679 return this.OnItemClick(this.GetItemIndexByElement(ASPx.Evt.GetEventSource(evt)), evt); 17680 }, 17681 InlineInitialize: function() { 17682 this.CreateValueInput(); 17683 var itemsContainer = this.listBoxRenderHelper.GetItemsContainer(); 17684 if(this.isCallbackMode && this.GetEnabled()) { 17685 var topSpacerElement = this.listBoxRenderHelper.CreateNewItemElement(); 17686 topSpacerElement.setAttribute("id", this.name + "_TS"); 17687 topSpacerElement.setAttribute("data-type", "spacer"); 17688 itemsContainer.insertBefore(topSpacerElement, itemsContainer.childNodes[0]); 17689 var bottomSpacerElement = this.listBoxRenderHelper.CreateNewItemElement(); 17690 bottomSpacerElement.setAttribute("id", this.name + "_BS"); 17691 bottomSpacerElement.setAttribute("data-type", "spacer"); 17692 itemsContainer.appendChild(bottomSpacerElement); 17693 } 17694 var isStandAlone = this.IsStandAlone(); 17695 this.needFocusedStyleDecoration = isStandAlone && this.enableFiltering; 17696 if(isStandAlone) 17697 this.RequireStyleDecoration(); 17698 ASPxClientListBox.prototype.InlineInitialize.call(this); 17699 }, 17700 CreateValueInput: function(){ 17701 var input = ASPx.CreateHiddenField(this.uniqueID, this.name + "_VI"); 17702 var listElement = this.GetListElement(); 17703 var captionElement = this.GetCaptionCell(); 17704 listElement.parentNode.insertBefore(input, (captionElement && captionElement === listElement.nextSibling 17705 ? captionElement : listElement).nextSibling); 17706 }, 17707 CreateItemsManager: function() { 17708 if(this.HasVirtualScrolling()) { 17709 var manager = new BootstrapListBoxItemsVirtualManager(this); 17710 manager.InitializeItems(this.itemsInfo, this.itemsValue); 17711 delete this.itemsInfo; 17712 return manager; 17713 } 17714 return new BootstrapListBoxItemsManager(this); 17715 }, 17716 EnsureSelectAllCheckElement: function() { 17717 this.CreateSelectAllCheckBox(); 17718 var selectAllCheckBoxInput = this.GetSelectAllCheckBoxFocusableElement(); 17719 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled()); 17720 this.ChangeSpecialInputEnabledAttributes(selectAllCheckBoxInput, changeEventMethod, true); 17721 }, 17722 CreateSelectAllCheckBox: function() { 17723 var selectAllCheckBoxElement = this.GetChildElement(lbSelectAllCbIdSuffix); 17724 this.selectAllCheckBox = new ASPx.BootstrapCheckBoxInternal(selectAllCheckBoxElement, true, false, true, this.uniqueID + "$" + lbSelectAllCbIdSuffix); 17725 this.selectAllCheckBox.mainInput.id = selectAllCheckBoxElement.id + "_I"; 17726 if(!ASPx.BootstrapCore.IsBootstrap3) 17727 this.selectAllCheckBox.initializeSiblingLabelElement(); 17728 this.selectAllCheckBox.SetEnabled(this.GetEnabled()); 17729 this.selectAllCheckBox.GetReadOnly = this.GetReadOnly.bind(this); 17730 this.selectAllCheckBox.CheckedChanged.AddHandler(this.onSelectAll.as
17730pxBind(this)); 17731 if(ASPx.Browser.WebKitFamily) 17732 ASPx.Evt.AttachEventToElement(this.selectAllCheckBox.mainElement.parentNode, "selectstart", ASPx.Evt.PreventEventAndBubble); 17733 }, 17734 CreateScrollHelper: function (loadOnDemandRequired) { 17735 if(loadOnDemandRequired) 17736 return new BootstrapListBoxScrollCallbackHelper(this); 17737 return ASPxClientListBox.prototype.CreateScrollHelper.call(this, loadOnDemandRequired); 17738 }, 17739 GetSelectAllClickableElement: function() { 17740 return this.selectAllMainElement; 17741 }, 17742 GetSelectAllCheckBoxFocusableElement: function() { 17743 return this.selectAllCheckBox.mainInput; 17744 }, 17745 InitializeEvents: function() { 17746 ASPxClientListBox.prototype.InitializeEvents.call(this); 17747 if(ASPx.Browser.MacOSMobilePlatform) { 17748 var errorImage = this.GetErrorImage(); 17749 if(errorImage) 17750 ASPx.Evt.AttachEventToElement(errorImage, "touchstart", function() { }); 17751 } 17752 }, 17753 BeforeAdjustHeightInDropDown: function () { }, 17754 NeedUnfocusableScrollDivElement: function() { 17755 return false; 17756 }, 17757 NeedToHandleCellWidth: function() { 17758 return false; 17759 }, 17760 PopulateStyleDecorationPostfixes: function() { 17761 this.styleDecoration.AddPostfix(""); 17762 if(ASPx.BootstrapCore.IsBootstrap4) 17763 this.styleDecoration.AddPostfix(".form-control"); 17764 }, 17765 CreateStyleDecoration: function() { 17766 return new ASPx.BootstrapEditorStyleDecoration(this); 17767 }, 17768 ChangeListTableEvents: function(listTable, method) { 17769 var itemElements = this.GetItemElements(); 17770 for(var i = 0; i < itemElements.length; i++) 17771 this.ChangeItemEvents(itemElements[i], method); 17772 }, 17773 ChangeItemEvents: function(itemElement, method) { 17774 method(itemElement, this.isComboBoxList ? "mouseup" : "click", this.itemClickHandler); 17775 method(itemElement, "keyup", this.itemKeyUpHandler); 17776 if(!this.isComboBoxList) { 17777 method(itemElement, "dblclick", this.itemDblClickHandler); 17778 var textControl = ASPx.GetTextNode(itemElement, 0); 17779 if(textControl) 17780 ASPx.Evt.PreventElementDragAndSelect(textControl, false); 17781 } 17782 if(this.MultiSelectionMode()) { 17783 this.AttachSelectStartHandlerToElement(itemElement); 17784 var link = ASPx.GetChildByTagName(itemElement, "A"); 17785 if(link) { 17786 ASPx.Evt.AttachEventToElement(link, 17787 "click", function(evt) { 17788 var shiftPressed = evt.shiftKey; 17789 var ctrlKey = evt.ctrlKey || evt.metaKey; 17790 if(shiftPressed || ctrlKey) 17791 ASPx.Evt.PreventEvent(evt); 17792 }); 17793 } 17794 } 17795 if(this.GetIsCheckColumnExists()) { 17796 var labelElement = this.GetItemContentElement(itemElement); 17797 if(labelElement) { 17798 ASPx.Evt.AttachEventToElement(labelElement, 17799 "click", function(evt) { 17800 if(ASPx.Evt.GetEventSource(evt).type !== "checkbox") 17801 return ASPx.Evt.PreventEvent(evt); 17802 }); 17803 } 17804 } 17805 }, 17806 ChangeEnabledAttributes: function(enabled){ 17807 ASPxClientListBox.prototype.ChangeEnabledAttributes.call(this, enabled); 17808 if(!this.isComboBoxList) { 17809 var changeMethod = enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset; 17810 changeMethod(this.GetListElement()); 17811 } 17812 }, 17813 GetLoadingPanelElement: function(){ 17814 return ASPx.BootstrapLoadingPanelManager.getLoadingPanel(this.name, this.loadingPanel); 17815 }, 17816 GetLoadingDiv: function(){ 17817 return ASPx.BootstrapLoadingPanelManager.getLoadingDiv(this.name, this.loadingPanel); 17818 }, 17819 FindInputElement: function() { 17820 if(this.isComboBoxList) 17821 return ASPxClientListBox.prototype.FindInputElement.call(this); 17822 if(ASPx.ElementHasCssClass(this.GetMainElement(), BSLISTBOX_CLASS)) 17823 return this.GetMainElement(); 17824 return this.GetMainElement().querySelector("." + BSLISTBOX_CLASS); 17825 }, 17826 GetControlCell: function() { 17827 return this.GetListElement(); 17828 }, 17829 EnsureControlCellStylesLoaded: function() { }, 17830 ClearControlCellStyles: function() { }, 17831 RestoreControlCellStyles: function() { }, 17832 GetElementRequiredForErrorFrame: function() { 17833 return this.GetMainElement(); 17834 }, 17835 GetErrorImage: function() { 17836 return this.feedbackRenderHelper.getErrorImage(); 17837 }, 17838 UpdateErrorText: function() { 17839 this.feedbackRenderHelper.updateErrorText(); 17840 }, 17841 ChangeErrorCellVisibility: function(visible, useVisibilityAttribute) { 17842 this.feedbackRenderHelper.setErrorControlVisible(visible); 17843 }, 17844 AdjustControlCore: function() { 17845 this.RemoveShowHideFilterCssRules();
17846 if(this.isInitialized && this.heightInitialized) 17847 this.CorrectSize(); 17848 else 17849 this.InitializeHeight(); 17850 this.itemsManager.Adjust(); 17851 this.EnsureSelectedItemVisible(); 17852 this.AdjustFilterElements(); 17853 }, 17854 AdjustFilterElements: function() { 17855 if(this.showFilterButton) { 17856 this.UpdateFilterButtonHeight(); 17857 this.UpdateShowHideFilterElementCssRules(); 17858 } 17859 }, 17860 IsVisible: function() { 17861 return this.isComboBoxList ? this.IsMainElementVisible() : ASPxClientListBox.prototype.IsVisible.call(this); 17862 }, 17863 IsDisplayedElement: function(element) { 17864 while(element && element.tagName != "BODY") { 17865 if(!ASPx.GetElementDisplay(element)) { 17866 if(ASPx.ElementHasCssClass(element, ASPx.BootstrapCssSelectors.DropDownMenu) && !ASPx.ElementHasCssClass(element, "show")) 17867 return false; 17868 } 17869 element = element.parentNode; 17870 } 17871 return true; 17872 }, 17873 IsEnableMultiColumn: function () { 17874 var mainElement = this.GetMainElement(); 17875 return !mainElement.querySelector("UL"); 17876 }, 17877 IsMainElementVisible: function() { 17878 var element = this.GetMainElement(); 17879 return element && ASPx.IsElementVisible(element, true); 17880 }, 17881 IsCorrectWidthRequired: function () { 17882 return this.IsEnableMultiColumn(); 17883 }, 17884 CorrectHeight: function() { 17885 if(this.IsMainElementVisible() && this.IsStandAlone()) { 17886 if(this.rows) { 17887 var rowsHeight = this.itemsManager.getFirstNthItemsHeight(this.rows); 17888 if(rowsHeight !== 0) { 17889 var scrollElement = this.listBoxRenderHelper.GetScrollDivElement(); 17890 rowsHeight = (rowsHeight + this.listBoxRenderHelper.GetRowsExtraHeight()) + "px"; 17891 if(scrollElement.style.height != rowsHeight) 17892 scrollElement.style.height = rowsHeight; 17893 } 17894 } 17895 } 17896 }, 17897 InitializeHeight: function() { 17898 if(this.heightInitialized) 17899 return; 17900 var itemsContainer = this.listBoxRenderHelper.GetItemsContainer(); 17901 var hiddenParents = []; 17902 var needVisibleListElement = this.IsStandAlone(); 17903 if(needVisibleListElement) { 17904 var element = itemsContainer; 17905 var testParentFunc = function(parent) { return !ASPx.GetElementDisplay(parent); }; 17906 while(element && element.tagName != "BODY") { 17907 var hiddenParentElement = ASPx.GetParent(element, testParentFunc); 17908 if(hiddenParentElement) 17909 hiddenParents.push({ element: hiddenParentElement, display: hiddenParentElement.style.display }); 17910 element = !!hiddenParentElement ? hiddenParentElement.parentNode : null; 17911 } 17912 hiddenParents.forEach(function(hiddenParent) { 17913 var element = hiddenParent.element; 17914 if(hiddenParent.display.length) 17915 ASPx.SetElementDisplay(element, ""); 17916 element.style.cssText = ASPx.CreateImportantCssText("display: block") + element.style.cssText; 17917 }); 17918 } 17919 this.CorrectHeight(); 17920 var hiddenRows = ASPx.GetChildNodesByClassName(itemsContainer, HIDDEN_ROW_CLASS); 17921 hiddenRows.forEach(function(row) { ASPx.RemoveClassNameFromElement(row, HIDDEN_ROW_CLASS); }); 17922 var extraRows = this.getExtraRows(); 17923 extraRows.forEach(function(extraRow) { itemsContainer.removeChild(extraRow); }); 17924 if(hiddenParents.length) { 17925 this.EnsureSelectedItemVisible(); 17926 hiddenParents.forEach(function(hiddenParent) { 17927 if(hiddenParent.display.length) 17928 ASPx.SetElementDisplay(hiddenParent.element, ""); 17929 ASPx.SetElementDisplay(hiddenParent.element, hiddenParent.display); 17930 }); 17931 } 17932 this.heightInitialized = true; 17933 }, 17934 InitializeItemsAttributes: function() { 17935 var itemElements = this.GetItemElements(); 17936 for(var i = 0; i < itemElements.length; i++) 17937 this.InitializeItemAttributes(itemElements[i], i); 17938 }, 17939 InitializeItemAttributes: function(item, index) { 17940 item.id = this.CreateItemClientId(index); 17941 var link = ASPx.GetChildByTagName(item, "A"); 17942 if(link != null) { 17943 link.id = item.id + lbILdSuffix; 17944 if(link.href === "") 17945 link.href = ASPx.AccessibilityEmptyUrl; 17946 } 17947 if(this.GetIsCheckColumnExists()) { 17948 var checkboxContainerClass = this.IsEnableMultiColumn() ? CHECKBOX_CONTAINER_CLASS : IT
17948EM_CLASS; 17949 var checkboxContainer = ASPx.NodeListToArray(item.querySelectorAll('div'), 17950 function(element) {return ASPx.ElementHasCssClass(element, checkboxContainerClass);} 17951 )[0]; 17952 if(checkboxContainer) 17953 checkboxContainer.id = item.id + lbICdSuffix; 17954 var input = checkboxContainer.querySelector('input[type="checkbox"]'); 17955 this.ChangeNativeCheckEnabledAttributes(input, ASPx.Attr.ChangeEventsMethod(this.GetEnabled())); 17956 this.ChangeSpecialInputEnabledAttributes(input, ASPx.Attr.ChangeEventsMethod(this.GetEnabled())); 17957 } 17958 this.listBoxRenderHelper.SetItemTabIndexAttribute(item); 17959 }, 17960 InitializePageSize: function() { 17961 var divElement = this.GetScrollDivElement(); 17962 var items = this.GetItemElements(); 17963 if(divElement && items.length > 0) 17964 this.scrollPageSize = Math.round(divElement.clientHeight / items[0].offsetHeight) - 1; 17965 }, 17966 SetProtectionFromFlick_inFF: function(changeVisibility, changeDisplay) { }, 17967 ResetProtectionFromFlick_inFF: function() { }, 17968 CreateItem: function(index, itemProperties) { 17969 return new BootstrapClientListBoxItem(this, index, itemProperties.texts || [itemProperties.text], itemProperties.value, itemProperties.imageUrl, 17970 itemProperties.selected, itemProperties.cellStyles, itemProperties.cellCssClasses, itemProperties.cellTooltips, itemProperties.cellAttributes, itemProperties.htmlContents, 17971 itemProperties.style, itemProperties.cssClass, itemProperties.tooltip, itemProperties.attributes, itemProperties.htmlContent, itemProperties.badge, itemProperties.textCssClass); 17972 }, 17973 CreateNewItem: function() { 17974 var itemElement = this.CreateNewItemElement();
17975 var cssClasses = []; 17976 if(this.cssClasses && this.cssClasses.lbi) 17977 cssClasses.push(this.cssClasses.lbi); 17978 if(cssClasses.length) 17979 ASPx.SetClassName(itemElement, cssClasses.join(" ")); 17980 return itemElement; 17981 }, 17982 CreateNewItemElement: function() { 17983 return this.listBoxRenderHelper.CreateNewItemElement(); 17984 }, 17985 CreateNewItemInternalElement: function(itemElement, itemProperties) { 17986 this.listBoxRenderHelper.AddItemContent(itemElement, itemProperties); 17987 }, 17988 GetItemRowTexts: function(row) { 17989 var serializedTexts = this.GetTextsDataAttribute(row); 17990 var texts = []; 17991 if(ASPx.IsExists(serializedTexts)) 17992 texts = JSON.parse(serializedTexts); 17993 else { 17994 var innerText = ASPxClientListBox.GetItemCellInnerText(this.GetItemFirstTextCellCore(row)); 17995 texts = this.IsMultiColumn() ? innerText.split("; ") : innerText; 17996 } 17997 return texts; 17998 }, 17999 ItemRowHasTemplateCore: function(itemRow) { 18000 return ASPx.ElementHasCssClass(itemRow, TEMPLATED_ROW_CLASS) && ASPxClientListBox.prototype.ItemRowHasTemplateCore.call(this, itemRow); 18001 }, 18002 GetListTableRowBeforeNewItemRow: function(newItemIndex, listTable) { 18003 var listTableRows = this.GetItemElements(); 18004 var lastRenderedItem = this.itemsManager.GetLastRenderedItem(); 18005 if(!lastRenderedItem || lastRenderedItem.index < newItemIndex) { 18006 var lastItemRow = lastRenderedItem ? this.GetItemRow(lastRenderedItem.index) : null; 18007 var lastListTableRow = listTableRows[listTableRows.length - 1]; 18008 if(lastItemRow) 18009 return lastItemRow === lastListTableRow ? null : lastItemRow.nextSibling; 18010 return null; 18011 } 18012 for(var i = 0; i < listTableRows.length; i++) 18013 if(this.GetItemIndexByRow(listTableRows[i]) >= newItemIndex) 18014 return listTableRows[i]; 18015 return null; 18016 }, 18017 InsertItemRow: function(index, itemProperties) { 18018 var newItemElement = this.itemsManager.CreateNewItemRow(index); 18019 var itemsContainer = this.listBoxRenderHelper.GetItemsContainer(); 18020 var rowBeforeNewItemRow = this.GetListTableRowBeforeNewItemRow(index, itemsContainer); 18021 if(rowBeforeNewItemRow) 18022 itemsContainer.insertBefore(newItemElement, rowBeforeNewItemRow); 18023 else { 18024 var bottomSpacer = this.GetScrollSpacerElement(false) || document.getElementById(this.name + "VirtualScrollBottomSpacer"); 18025 if(bottomSpacer) 18026 itemsContainer.insertBefore(newItemElement, bottomSpacer); 18027 else 18028 itemsContainer.appendChild(newItemElement); 18029 } 18030 if(!itemProperties.htmlContent) 18031 this.CreateNewItemInternalElement(newItemElement, itemProperties); 18032 else 18033 this.listBoxRenderHelper.CreateItemWithHtmlContent(newItemElement, itemProperties); 18034 var newIndex = this.GetItemIndexByInsertionOrder(index); 18035 this.InitializeItemAttributes(newItemElement, newIndex); 18036 this.listBoxRenderHelper.AddItemStateItems(newItemElement.id); 18037 this.AssignDecorationSettingsToElement(newItemElement, itemProperties.style, itemProperties.cssClass, itemProperties.tooltip); 18038 this.ChangeItemEvents(newItemElement, ASPx.Attr.ChangeEventsMethod(this.GetEnabled())); 18039 }, 18040 RemoveItemRow: function(index) { 18041 var row = this.GetItemRow(index); 18042 if(ASPx.IsExistsElement(row)) { 18043 if(index > -1) { 18044 var firstCell = this.GetItemElement(index); 18045 if(firstCell) { 18046 var firstCellId = firstCell.id; 18047 var itemId = firstCellId.match(/LBI\d+/) && firstCellId.match(/LBI\d+/)[0]; 18048 this.RemoveStateControllerClasses(itemId); 18049 } 18050 } 18051 row.parentNode.removeChild(row); 18052 } 18053 }, 18054 OnItemInserted: function(index) { 18055 this.DropCachedItemElements(); 18056 ASPxClientListBox.prototype.OnItemInserted.call(this, index); 18057 }, 18058 OnItemRemoved: function(index) { 18059 if(!this.HasVirtualScrolling()) 18060 this.DropCachedItemElements(); 18061 ASPxClientListBox.prototype.OnItemRemoved.call(this, index); 18062 }, 18063 PrepareItem: function(newItemRow, itemProperties) { 18064 var i = 0; 18065 if(this.GetIsCheckColumnExists()) 18066 i++; 18067 if(this.imageCellExists) { 18068 this.PrepareItemImage(newItemRow, i, itemProperties.imageUrl); 18069 i++; 18070 } 18071 }, 18072 PrepareItemImage: function(newItemRow, imageCellIndex, imageUrl) { 18073 var imageElement = newItemRow.querySelector("." + ITEM_IMAGE_CLASS); 18074 if(!imageElement) { 18075 imageElement = document.createElement("SPAN"); 18076 newItemRow.insertBefore(imageElement, newItemRow.childNodes[imageCellIndex]); 18077 } 18078 ASPx.SetClassName(imageElement, ITEM_IMAGE_CLASS); 18079 if(imageUrl && imageUrl.length) 18080 ASPx.AddClassNameToElement(imageElement, imageUrl); 18081 }, 18082 PrepareItemTextCell: function(cell, text, style, cssClass, tooltip, htmlContent) { }, 18083 SetItemTextCellHtml: function(itemIndex, textCellIndex, html) { 18084 this.listBoxRenderHelper.SetItemTextCellHtml(itemIndex, textCellIndex, html); 18085 }, 18086 SetItemHtml: function(index, html) { 18087 this.hasDecoratedItems = true; 18088 this.itemsManager.SetItemHtml(index, html); 18089 this.ProcessItemRow(index, function(itemRow) { 18090 var itemTexts = this.GetItem(index).texts; 18091 this.SetItemHtmlContent(itemRow, html); 18092 if(!this.ItemRowHasSerializedTextsAttr(itemRow)) { 18093 if(typeof(itemTexts) == "string") 18094 itemTexts = [ itemTexts ]; 18095 this.SetTextsDataAttribute(itemRow, itemTexts); 18096 } 18097 this.itemsManager.OnDecoratedItemsRendering(); 18098 this.listBoxRenderHelper.UpdateItemStateAfterSetHtml(index); 18099 }.bind(this)); 18100 }, 18101 SetItemHtmlContent: function(itemRow, html) { 18102 this.listBoxRenderHelper.SetItemHtmlContent(itemRow, html); 18103 }, 18104 GetItemBadgeText: function(index) { 18105 var itemElement = this.GetItemElement(index); 18106 return itemElement ? ASPx.BootstrapBadgeManager.getBadgeText(this.GetItemBadgeContainer(itemElement)) : ""; 18107 }, 18108 SetItemBadgeText: function(index, text) { 18109 this.ProcessItemRow(index, function(itemRow) { 18110 var badgeContainer = this.GetItemBadgeContainer(itemRow); 18111 if(!badgeContainer) 18112 return; 18113 var badgeText = this.HtmlEncode(text);
18114 var badge = ASPx.BootstrapBadgeManager.findBadge(badgeContainer); 18115 if(badge) 18116 ASPx.BootstrapBadgeManager.setBadgeText(badge, badgeText); 18117 else 18118 badgeContainer.appendChild(ASPx.BootstrapBadgeManager.createBadge(badgeText)); 18119 this.itemsManager.SetItemBadgeText(index, badgeText); 18120 }.aspxBind(this)); 18121 }, 18122 GetItemBadgeIconCssClass: function(index) { 18123 var itemElement = this.GetItemElement(index); 18124 return itemElement ? ASPx.BootstrapBadgeManager.getBadgeIconCssClass(this.GetItemBadgeContainer(itemElement)) : ""; 18125 }, 18126 SetItemBadgeIconCssClass: function(index, cssClass) { 18127 this.ProcessItemRow(index, function(itemRow) { 18128 var badgeContainer = this.GetItemBadgeContainer(itemRow); 18129 if(!badgeContainer) 18130 return; 18131 var badge = ASPx.BootstrapBadgeManager.findBadge(badgeContainer); 18132 if(badge) 18133 ASPx.BootstrapBadgeManager.setBadgeIconCssClass(badge, cssClass); 18134 else 18135 badgeContainer.appendChild(ASPx.BootstrapBadgeManager.createBadge("", cssClass)); 18136 this.itemsManager.SetItemBadgeIconCssClass(index, cssClass); 18137 }.aspxBind(this)); 18138 }, 18139 DropCachedItemElements: function() { 18140 if(!!this.cache) 18141 ASPx.CacheHelper.DropCachedValue(this, "itemElements"); 18142 }, 18143 GetItemElements: function() { 18144 var getItemElements = function() { 18145 return this.GetRowElements().filter(function(element) { return !ASPx.ElementHasCssClass(element, EXTRA_ROW_CLASS); }); 18146 }.aspxBind(this); 18147 return this.HasVirtualScrolling() ? getItemElements() : ASPx.CacheHelper.GetCachedElements(this, "itemElements", getItemElements); 18148 }, 18149 GetRowElements: function() { 18150 return this.listBoxRenderHelper.GetRowElements(); 18151 }, 18152 GetItemIndexByElement: function(element) { 18153 var itemElements = this.GetItemElements(); 18154 for(var i = 0; i < itemElements.length; i++) { 18155 var itemElement = itemElements[i]; 18156 if(ASPx.GetIsParent(itemElement, element)) 18157 return itemElement.itemIndex !== undefined ? itemElement.itemIndex : i; 18158 } 18159 return -1; 18160 }, 18161 GetVisibleItemElements: function() { 18162 return this.GetItemElements().filter(function(element) { return ASPx.GetElementDisplay(element); }); 18163 }, 18164 GetIndexVisibleItem: function(item) { 18165 var itemElements = this.GetItemElements(); 18166 var visibleItemCount = 0; 18167 for(var i = 0; i < count; i++) { 18168 if(ASPx.GetElementDisplay(itemElements[i], true)) 18169 visibleItemCount++; 18170 var curItem = this.GetItem(i); 18171 if(item.value === curItem.value && item.text === curItem.text) 18172 break; 18173 } 18174 return visibleItemCount; 18175 }, 18176 GetItemCellCount: function() { 18177 var cellCount = this.IsEnableMultiColumn() ? this.columnFieldNames.length : 1; 18178 if(this.GetIsCheckColumnExists()) 18179 cellCount++; 18180 if(this.imageCellExists) 18181 cellCount++; 18182 return cellCount; 18183 }, 18184 CopyCellWidths: function(sourceRowIndex, destinationRowIndex){ }, 18185 GetItemFirstTextCell: function(index) { 18186 var row = this.GetItemRow(index); 18187 return row ? this.GetItemFirstTextCellCore(row) : null; 18188 }, 18189 GetItemFirstTextCellCore: function(itemRow) { 18190 if(this.GetIsCheckColumnExists() && this.ItemRowHasTemplateCore(itemRow)) { 18191 var internalElement = ASPx.GetChildByTagName(itemRow, this.GetItemInternalElementTagName(), 0
18191); 18192 if(internalElement) 18193 return internalElement; 18194 } 18195 var selectableElements = this.GetItemSelectableElementsByRow(itemRow); 18196 if(selectableElements && selectableElements.length) { 18197 var firstTextCell = selectableElements[this.GetItemFirstTextCellIndex()]; 18198 if(firstTextCell) 18199 return firstTextCell; 18200 } 18201 return itemRow; 18202 }, 18203 GetItemTextCell: function(itemIndex, textCellIndex) { 18204 return this.listBoxRenderHelper.GetItemTextCell(itemIndex, textCellIndex); 18205 }, 18206 GetElementTopOffset: function(element) { 18207 var topOffset = 0; 18208 if(element) { 18209 topOffset = element.offsetTop; 18210 if(element.offsetParent) { 18211 var offsetParent = ASPx.FindOffsetParent(element); 18212 if(offsetParent.tagName != "BODY" && element.offsetParent !== offsetParent) 18213 topOffset -= offsetParent.offsetTop; 18214 } 18215 } 18216 return topOffset; 18217 }, 18218 GetItemSelectableElementsByRow: function(row) { 18219 return this.listBoxRenderHelper.GetItemSelectableElementsByRow(row); 18220 }, 18221 GetItemBadgeContainer: function(itemElement) { 18222 return this.GetIsCheckColumnExists() 18223 ? ASPx.GetChildByPartialClassName(itemElement, CHECKBOX_CONTAINER_CLASS) 18224 : this.GetItemContentElement(itemElement); 18225 }, 18226 GetItemInternalElementTagName: function() { 18227 return this.GetIsCheckColumnExists() ? "DIV" : "A"; 18228 }, 18229 GetItemContentElement: function(itemElement) { 18230 var internalElement = ASPx.GetChildByTagName(itemElement, this.GetItemInternalElementTagName(), 0
18230); 18231 if(this.GetIsCheckColumnExists()) 18232 if(ASPx.BootstrapCore.IsBootstrap3) 18233 return ASPx.GetChildByTagName(internalElement, "LABEL", 0); 18234 else 18235 return ASPx.GetChildByClassName(internalElement, CHECKBOX_CONTAINER_CLASS, 0); 18236 return internalElement; 18237 }, 18238 GetScrollDivElement: function() { 18239 return this.listBoxRenderHelper.GetScrollDivElement(); 18240 }, 18241 GetLoadingParentElement: function() { 18242 var listElement = this.GetListElement(); 18243 return this.isComboBoxList && ASPx.GetElementDisplay(listElement) ? listElement.parentNode : listElement; 18244 }, 18245 GetLoadingOffsetElement: function() { 18246 return this.GetListElement(); 18247 }, 18248 GetListTableHeight: function() { 18249 return this.listBoxRenderHelper.GetListTableHeight(); 18250 }, 18251 GetRequiredScrollSpacerHeight: function() { 18252 return this.GetScrollDivElement().clientHeight - 1; 18253 }, 18254 CallbackSpaceInit: function(isInitialization) { 18255 if(this.isCallbackMode) { 18256 var scrollDivElement = this.GetScrollDivElement(); 18257 var needMakeScrollDivVisible = !isInitialization && !A
18257SPx.GetElementDisplay(scrollDivElement); 18258 if(needMakeScrollDivVisible) 18259 ASPx.SetElementDisplay(scrollDivElement, true); 18260 var scrollDivHeight = scrollDivElement.style.height; 18261 var scrollDivClientHeight = scrollDivElement.clientHeight; 18262 var needSetScrollDivHeight = this.IsStandAlone() && scrollDivClientHeight && (!scrollDivHeight.length || scrollDivHeight === "unset"); 18263 ASPxClientListBox.prototype.CallbackSpaceInit.call(this, isInitialization); 18264 if(isInitialization || this.isComboBoxList) 18265 ASPx.Evt.AttachEventToElement(scrollDivElement, "scroll", this.OnScroll.bind(this)); 18266 if(needSetScrollDivHeight) { 18267 this.LockScrollHandler(); 18268 scrollDivElement.style.height = scrollDivClientHeight + "px"; 18269 this.EnsureSelectedItemVisible(); 18270 this.UnlockScrollHandler(); 18271 } 18272 if(needMakeScrollDivVisible) 18273 ASPx.SetElementDisplay(scrollDivElement, false); 18274 } 18275 }, 18276 GetListElement: function() { 18277 return this.listBoxRenderHelper.GetListElement(); 18278 }, 18279 GetListTableCore: function() { 18280 return this.GetListElement(); 18281 }, 18282 GetCaptionCell: function() { 18283 return ASPx.CacheHelper.GetCachedElement(this, "captionElement", 18284 function() { 18285 var editCaptionCssClass = "dxbs-edit-caption"; 18286 var mainElement = this.GetMainElement(); 18287 if(!mainElement) 18288 return null; 18289 var captionElement = mainElement.querySelector("." + editCaptionCssClass); 18290 if(!captionElement && mainElement === this.GetListElement()) { 18291 if(mainElement.previousSibling && ASPx.ElementHasCssClass(mainElement.previousSibling, editCaptionCssClass)) 18292 captionElement = mainElement.previousSibling; 18293 else if(mainElement.nextSibling && ASPx.ElementHasCssClass(mainElement.nextSibling, editCaptionCssClass)) 18294 captionElement = mainElement.nextSibling; 18295 } 18296 return captionElement; 18297 } 18298 ); 18299 }, 18300 getCaptionTextNode: function() { 18301 return ASPx.GetNormalizedTextNode(this.GetCaptionCell()); 18302 }, 18303 getCaptionRelatedCellCount: function() { 18304 return undefined; 18305 }, 18306 IsNativeCheckBoxes: function() { 18307 return true; 18308 }, 18309 GetItemCheckBoxInput: function(index) { 18310 var row = this.GetItemRow(index); 18311 return row ? row.querySelector('input[type="checkbox"]') : null; 18312 }, 18313 GetItemCheckBoxClassName: function() {
18314 var cssClasses = []; 18315 cssClasses.push(this.IsDropDown() ? DROPDOWN_ITEM_CHECKBOX_CLASS : ITEM_CHECKBOX_CLASS); 18316 if(this.cssClasses && this.cssClasses.lbc) 18317 cssClasses.push(this.cssClasses.lbc); 18318 return cssClasses.join(" "); 18319 }, 18320 IsSelectAllCheckBoxClicked: function(eventSource) { 18321 return this.selectAllCheckBox && ASPx.GetIsParent(this.selectAllCheckBox.mainElement, eventSource); 18322 }, 18323 IsNativeSelectAllCheckBoxClicked: function(eventSource) { 18324 return false; 18325 }, 18326 getSelectAllCheckElementState: function() { 18327 if(this.selectAllCheckBox) { 18328 var value = this.selectAllCheckBox.GetValue(); 18329 if(value === true) 18330 return ASPx.CheckBoxCheckState.Checked; 18331 if(value === false) 18332 return ASPx.CheckBoxCheckState.Unchecked; 18333 if(value === null) 18334 return ASPx.CheckBoxCheckState.Indeterminate; 18335 } 18336 return null; 18337 }, 18338 getExtraRows: function() { 18339 var itemsContainer = this.listBoxRenderHelper.GetItemsContainer(); 18340 return ASPx.GetChildNodesByClassName(itemsContainer, EXTRA_ROW_CLASS); 18341 }, 18342 updateSelectAllCheckElementState: function(checkState) { 18343 this.updateSelectAllCheckElementStateInternal(checkState); 18344 }, 18345 updateSelectAllCheckElementStateInternal: function(checkState) { 18346 if(this.selectAllCheckBox) { 18347 if(checkState === ASPx.CheckBoxCheckState.Checked) 18348 this.selectAllCheckBox.SetValue(true); 18349 else if(checkState === ASPx.CheckBoxCheckState.Unchecked) 18350 this.selectAllCheckBox.SetValue(false); 18351 else 18352 this.selectAllCheckBox.SetValue(null); 18353 } 18354 }, 18355 SetVisible: function(visible) { 18356 if(this.clientVisible != visible && this.GetMainElement() === this.GetListElement()) 18357 ASPx.SetElementDisplay(this.GetCaptionCell(), visible); 18358 ASPxClientListBox.prototype.SetVisible.call(this, visible); 18359 }, 18360 IsStandAlone: function() { 18361 if (this.isComboBoxList) 18362 return false; 18363 return ASPx.ElementHasCssClass(this.GetMainElement(), STANDALONE_CLASS) || !!this.GetMainElement().querySelector("." + BSLISTBOX_CLASS + "." + STANDALONE_CLASS); 18364 }, 18365 IsDropDown: function() { 18366 return ASPx.ElementHasCssClass(this.GetMainElement(), ASPx.BootstrapCssSelectors.DropDownMenu); 18367 }, 18368 IsElementBelongToInputElement: function(element) { 18369 return this.isComboBoxList ? ASPxClientListBox.prototype.IsElementBelongToInputElement.call(this, element) : this.IsEditorElement(element); 18370 }, 18371 UpdateShowHideFilterElementCssRules: function() { 18372 var animatedClassName = this.GetAnimatedFilterElementClassName(); 18373 var isFilterAnimated = ASPx.ElementHasCssClass(this.filterMainElement, animatedClassName); 18374 this.ToggleFilterMainElementClassName(animatedClassName, false); 18375 ASPxClientListBox.prototype.UpdateShowHideFilterElementCssRules.call(this); 18376 this.ToggleFilterMainElementClassName(animatedClassName, isFilterAnimated); 18377 }, 18378 GetFilterMainElementHeight: function() { 18379 if(!this.filterMainElementHeight) { 18380 var isFilterInactive = ASPx.ElementHasCssClass(this.filterMainElement, this.GetInactiveFilterElementClassName()); 18381 if(isFilterInactive) { 18382 this.filterMainElement.style.position = "absolute"; 18383 this.filterMainElement.style.visibility = "hidden"; 18384 } 18385 this.ToggleFilterMainElementClassName("calculating", true); 18386 this.filterMainElementHeight = this.filteringTextBox.GetMainElement().offsetHeight + ASPx.GetTopBottomBordersAndPaddingsSummaryValue(this.filterMainElement); 18387 this.ToggleFilterMainElementClassName("calculating", false); 18388 if(isFilterInactive) { 18389 this.filterMainElement.style.position = ""; 18390 this.filterMainElement.style.visibility = ""; 18391 } 18392 } 18393 return this.filterMainElementHeight; 18394 }, 18395 ToggleFilterMainElementClassName: function(className, contains) { 18396 ASPx.ToggleClassNameToElement(this.filterMainElement, className, contains); 18397 }, 18398 GetInactiveFilterElementClassName: function() { 18399 return INACTIVE_FILTER_CLASS; 18400 }, 18401 GetAnimatedFilterElementClassName: function() { 18402 return ANIMATED_FILTER_CLASS; 18403 }, 18404 GetCompactViewFilterAdjacentScrollDivSelector: function() { 18405 return "*[class*=\"dxbs-list-filter\"]:not(.collapsed) + *[class*=\"dxbs-list-selectall\"] + .list-group"; 18406 }, 18407 GetCompactViewInactiveFilterAdjacentScrollDivSelector: function() { 18408 return ".dxbs-list-filter.collapsed + *[class*=\"dxbs-list-selectall\"] + .list-group"; 18409 },
18410 GetItemCellsIdPostfixes: function() { 18411 return this.listBoxRenderHelper.GetItemCellsIdPostfixes(); 18412 }, 18413 CreateFixWidthRow: function() { } 18414 }); 18415 var CHECKLIST_ITEM_INPUT_SELECTOR = "." + ASPx.BootstrapCssSelectors.CheckBoxInput + ",." + ASPx.BootstrapCssSelectors.CustomCheckInput; 18416 var BootstrapClientCheckBoxList = ASPx.CreateClass(ASPxClientCheckBoxList, { 18417 constructor: function (name) { 18418 this.constructor.prototype.constructor.call(this, name); 18419 this.formLayoutElement = null; 18420 this.feedbackRenderHelper = new ASPx.BootstrapEditFeedbackRenderHelper(this); 18421 }, 18422 InlineInitialize: function() { 18423 this.RequireStyleDecoration(); 18424 ASPxClientCheckBoxList.prototype.InlineInitialize.call(this); 18425 if(ASPx.Browser.TouchUI && !this.GetIsValid()) 18426 this.UpdateErrorText(); 18427 }, 18428 GetItemInput: function(index) { 18429 var itemElement = this.GetItemElement(index); 18430 return itemElement ? itemElement.querySelector('input[type="checkbox"]') : itemElement; 18431 }, 18432 GetItemElement: function (index) { 18433 return ASPx.GetElementById(this.name + "_RB" + index); 18434 }, 18435 GetItemFocusableElement: function (index) { 18436 return this.accessibilityCompliant ? this.GetChildElement("RB" + index + "_I_D") : this.GetItemInput(index); 18437 }, 18438 GetFormLayoutElement: function () { 18439 if (!this.formLayoutElement) 18440 this.formLayoutElement = ASPx.GetChildByClassName(this.GetMainElement(), "dxbs-fl"); 18441 return this.formLayoutElement; 18442 }, 18443 CreateCheckBoxInternalCollection: function() { 18444 return new ASPx.BootstrapCheckBoxInternalCollection(true, false, true); 18445 }, 18446 CreateButtonInternalCollection: function() { 18447 this.internalButtonCollection = this.CreateCheckBoxInternalCollection(); 18448 var internalButtonInputNamePrefix = this.uniqueID + "$RB"; 18449 var instance = this; 18450 var checkedChangedHandler = function(s, e) { instance.OnItemClick(instance.GetItemIndexByElement(ASPx.Evt.GetEventSource(e))); }; 18451 var focusHandler = function(s, e) { instance.OnFocus(); }; 18452 var lostFocusHandler = function(s, e) { instance.OnLostFocus(); }; 18453 for (var i = 0; i < this.GetItemCount() ; i++) { 18454 var itemElement = this.GetItemElement(i); 18455 var icbInputElement = this.GetItemInput(i); 18456 icbInputElement.id = itemElement.id + "_I"; 18457 var internalButton = this.internalButtonCollection.Add(icbInputElement.id, itemElement); 18458 internalButton.stateInput.name = internalButtonInputNamePrefix + i; 18459 internalButton.SetEnabled(this.GetEnabled()); 18460 internalButton.GetReadOnly = this.GetReadOnly.bind(this); 18461 internalButton.CheckedChanged.AddHandler(checkedChangedHandler); 18462 internalButton.Focus.AddHandler(focusHandler); 18463 internalButton.LostFocus.AddHandler(lostFocusHandler); 18464 this.attachToCellsClick(i); 18465 this.PrepareInternalButton(internalButton, i); 18466 } 18467 this.attachToMainElementMouseDown(); 18468 }, 18469 CheckableElementsExist: function() { 18470 return true; 18471 }, 18472 GetItemIndexByElement: function (element) { 18473 for (var i = 0; i < this.GetItemCount() ; i++) { 18474 var itemElement = this.GetItemElement(i); 18475 if (ASPx.GetIsParent(itemElement, element)) 18476 return i; 18477 } 18478 return -1; 18479 }, 18480 SetSelectionDecoration: function (index, selected) { 18481 if (this.CheckableElementsExist()) { 18482 var inputElement = this.GetItemInput(index); 18483 if(inputElement) { 18484 var internalButton = this.internalButtonCollection.Get(inputElement.id); 18485 internalButton.SetValue(selected); 18486 } 18487 } else { 18488 var element = this.GetItemInput(index); 18489 if (element) 18490 element.checked = (selected); 18491 } 18492 }, 18493 PopulateStyleDecorationPostfixes: function() { 18494 this.styleDecoration.AddPostfix(""); 18495 if(ASPx.BootstrapCore.IsBootstrap4) 18496 this.styleDecoration.AddPostfix(CHECKLIST_ITEM_INPUT_SELECTOR); 18497 }, 18498 CreateStyleDecoration: function() { 18499 return new ASPx.BootstrapEditorStyleDecoration(this); 18500 }, 18501 GetCaptionCell: function() { 18502 return ASPx.CacheHelper.GetCachedElement(this, "captionElement", 18503 function() { 18504 var editCaptionCssClass = "dxbs-edit-caption"; 18505 var mainElement = this.GetMainElement(); 18506 var captionElement = mainElement && mainElement.querySelector("." + editCaptionCssClass); 18507 return captionElement; 18508 } 18509 ); 18510 }, 18511 getCaptionTextNode: function() { 18512 return ASPx.GetNormalizedTextNode(this.GetCaptionCell()); 18513 }, 18514 getCaptionRelatedCellCount: function() { 18515 return undefined; 18516 }, 18517 GetControlCell: function() { 18518 return this.GetMainElement(); 18519 }, 18520 EnsureControlCellStylesLoaded: function() { }, 18521 ClearControlCellStyles: function() { }, 18522 RestoreControlCellStyles: function() { }, 18523 GetElementRequiredForErrorFrame: function () { 18524 return this.GetMainElement(); 18525 }, 18526 GetErrorImage: function() { 18527 return this.feedbackRenderHelper.getErrorImage(); 18528 }, 18529 UpdateErrorText: function() { 18530 this.feedbackRenderHelper.updateErrorText(); 18531 }, 18532 ChangeErrorCellVisibility: function(visible, useVisibilityAttribute) { 18533 this.feedbackRenderHelper.setErrorControlVisible(visible); 18534 } 18535 }); 18536 var BootstrapClientRadioButtonList = ASPx.CreateClass(ASPxClientRadioButtonList, { 18537 constructor: function (name) { 18538 this.constructor.prototype.constructor.call(this, name); 18539 this.formLayoutElement = null; 18540 this.feedbackRenderHelper = new ASPx.BootstrapEditFeedbackRenderHelper(this); 18541 }, 18542 InlineInitialize: function() { 18543 this.RequireStyleDecoration(); 18544 ASPxClientRadioButtonList.prototype.InlineInitialize.call(this); 18545 for(var i = 0; i < this.GetItemCount(); i++) { 18546 var radioButton = this.GetItemRadioButton(i); 18547 if(radioButton) 18548 radioButton.groupName = this.uniqueID; 18549 } 18550 if(ASPx.Browser.TouchUI && !this.GetIsValid()) 18551 this.UpdateErrorText(); 18552 }, 18553 GetItemInput: function(index) { 18554 var itemElement = this.GetItemElement(index); 18555 return itemElement ? itemElement.querySelector('input[type="radio"]') : itemElement; 18556 }, 18557 GetItemElement: function (index) { 18558 return ASPx.GetElementById(this.name + "_RB" + index); 18559 }, 18560 GetItemRadioButton: function(index) { 18561 return ASPx.GetControlCollection().Get(this.name + "_RB" + index); 18562 }, 18563 GetItemFocusableElement: function (index) { 18564 return this.accessibilityCompliant ? this.GetChildElement("RB" + index + "_I_D") : this.GetItemInput(index); 18565 }, 18566 GetFormLayoutElement: function () { 18567 if (!this.formLayoutElement) 18568 this.formLayoutElement = ASPx.GetChildByClassName(this.GetMainElement(), "dxbs-fl"); 18569 return this.formLayoutElement; 18570 }, 18571 CreateCheckBoxInternalCollection: function() { 18572 return new ASPx.BootstrapCheckBoxInternalCollection(true, false, true); 18573 }, 18574 CreateButtonInternalCollection: function() { 18575 this.internalButtonCollection = this.CreateCheckBoxInternalCollection(); 18576 var internalButtonInputNamePrefix = this.uniqueID + "$RB"; 18577 var instance = this;
18578 var checkedChangedHandler = function(s, e) { instance.OnItemClick(instance.GetItemIndexByElement(ASPx.Evt.GetEventSource(e))); }; 18579 var focusHandler = function(s, e) { instance.OnFocus(); }; 18580 var lostFocusHandler = function(s, e) { instance.OnLostFocus(); }; 18581 for(var i = 0; i < this.GetItemCount() ; i++) { 18582 var itemElement = this.GetItemElement(i); 18583 var icbInputElement = this.GetItemInput(i); 18584 icbInputElement.id = itemElement.id + "_I"; 18585 var internalButton = this.internalButtonCollection.Add(icbInputElement.id, itemElement); 18586 internalButton.stateInput.name = internalButtonInputNamePrefix + i; 18587 internalButton.SetEnabled(this.GetEnabled()); 18588 internalButton.GetReadOnly = this.GetReadOnly.bind(this); 18589 internalButton.CheckedChanged.AddHandler(checkedChangedHandler); 18590 internalButton.Focus.AddHandler(focusHandler); 18591 internalButton.LostFocus.AddHandler(lostFocusHandler); 18592 this.attachToCellsClick(i); 18593 this.PrepareInternalButton(internalButton, i); 18594 } 18595 this.attachToMainElementMouseDown(); 18596 }, 18597 CheckableElementsExist: function() { 18598 return true; 18599 }, 18600 GetItemIndexByElement: function (element) { 18601 for (var i = 0; i < this.GetItemCount() ; i++) { 18602 var itemElement = this.GetItemElement(i); 18603 if (ASPx.GetIsParent(itemElement, element)) 18604 return i; 18605 } 18606 return -1; 18607 }, 18608 UpdateCheckableElementDecorations: function (selectedIndex, enabled) { 18609 if (this.CheckableElementsExist()) { 18610 for (var i = 0; i < this.items.length; i++) { 18611 var inputElement = this.GetItemInput(i); 18612 var internalButton = this.internalButtonCollection.Get(inputElement.id); 18613 internalButton.SetEnabled(enabled); 18614 internalButton.SetValue(i == selectedIndex); 18615 } 18616 } 18617 }, 18618 PopulateStyleDecorationPostfixes: function() { 18619 this.styleDecoration.AddPostfix(""); 18620 if(ASPx.BootstrapCore.IsBootstrap4) 18621 this.styleDecoration.AddPostfix(CHECKLIST_ITEM_INPUT_SELECTOR); 18622 }, 18623 CreateStyleDecoration: function() { 18624 return new ASPx.BootstrapEditorStyleDecoration(this); 18625 }, 18626 GetCaptionCell: function() { 18627 return ASPx.CacheHelper.GetCachedElement(this, "captionElement", 18628 function() { 18629 var editCaptionCssClass = "dxbs-edit-caption"; 18630 var mainElement = this.GetMainElement(); 18631 var captionElement = mainElement && mainElement.querySelector("." + editCaptionCssClass); 18632 return captionElement; 18633 } 18634 ); 18635 }, 18636 getCaptionTextNode: function() { 18637 return ASPx.GetNormalizedTextNode(this.GetCaptionCell()); 18638 }, 18639 getCaptionRelatedCellCount: function() { 18640 return undefined; 18641 }, 18642 GetControlCell: function() { 18643 return this.GetMainElement(); 18644 }, 18645 EnsureControlCellStylesLoaded: function() { }, 18646 ClearControlCellStyles: function() { }, 18647 RestoreControlCellStyles: function() { }, 18648 GetElementRequiredForErrorFrame: function() { 18649 return this.GetMainElement(); 18650 }, 18651 GetErrorImage: function() { 18652 return this.feedbackRenderHelper.getErrorImage(); 18653 }, 18654 UpdateErrorText: function() { 18655 this.feedbackRenderHelper.updateErrorText(); 18656 }, 18657 ChangeErrorCellVisibility: function(visible, useVisibilityAttribute) { 18658 this.feedbackRenderHelper.setErrorControlVisible(visible); 18659 } 18660 }); 18661 ASPx.BootstrapListBoxHighlightingHelper = ASPx.CreateClass(ASPx.ListBoxHighlightingHelper, { 18662 applyToTextCells: function (func, firstTextCellIndex, elements, itemSelection) { 18663 for(var i = 0; i < itemSelection.length; i++){ 18664 var element = this.listBox.IsEnableMultiColumn() ? elements[itemSelection[i].index + firstTextCellIndex] : elements[firstTextCellIndex]; 18665 this.applyToItemCore(func, element, itemSelection[i]); 18666 } 18667 }, 18668 getItemSelection: function(itemValues, textFormatString, text) { 18669 var itemSelectionBase = ASPx.ListBoxHighlightingHelper.prototype.getItemSelection.call(this, itemValues, textFormatString, text); 18670 if (this.listBox.IsEnableMultiColumn()) 18671 return itemSelectionBase; 18672 var formattedText = this.listBox.FormatText(itemValues); 18673 var itemSelection = []; 18674 for(var i = 0; i < itemSelectionBase.length; i++) { 18675 var selectionIndex = itemSelectionBase[i].index; 18676 var selectionLength = itemSelectionBase[i].length; 18677 var highlightedText = itemValues[selectionIndex].substr(itemSelectionBase[i].startIndex, selectionLength); 18678 var selectionStartIndex = ASPx.Str.PrepareStringForFilter(formattedText).indexOf(ASPx.Str.PrepareStringForFilter(highlightedText)); 18679 var selection = new ASPx.ContainsFilteringUtils.ColumnSelectionStruct(selectionIndex, selectionStartIndex, selectionLength); 18680 itemSelection.push(selection); 18681 } 18682 return itemSelection; 18683 } 18684 }); 18685 dx.BootstrapClientListBoxItem = BootstrapClientListBoxItem; 18686 dx.BootstrapClientListBox = BootstrapClientListBox; 18687 dx.BootstrapClientCheckBoxList = BootstrapClientCheckBoxList; 18688 dx.BootstrapClientRadioButtonList = BootstrapClientRadioButtonList; 18689}
18689)(dx || (dx = {})); 18690 18691(function(dx) { 18692 var BootstrapClientButton = ASPx.CreateClass(ASPxClientButton, { 18693 constructor: function(name) { 18694 this.constructor.prototype.constructor.call(this, name); 18695 }, 18696 InitializeNativeHandlers: function() { }, 18697 InitializeElementIDs: function() { }, 18698 InitializeLink: function() { }, 18699 UpdateSize: function() { }, 18700 UpdateHeight: function() { }, 18701 UpdateWidth: function() { }, 18702 AdjustControlCore: function() { }, 18703 ApplyCheckedStyle: function() { 18704 var btn = this.GetInternalButton(); 18705 ASPx.AddClassNameToElement(btn, ASPx.BootstrapCssSelectors.Active); 18706 ASPx.Attr.SetAttribute(btn, "aria-pressed", true); 18707 }, 18708 ApplyUncheckedStyle: function() { 18709 var btn = this.GetInternalButton(); 18710 ASPx.RemoveClassNameFromElement(btn, ASPx.BootstrapCssSelectors.Active); 18711 ASPx.Attr.SetAttribute(btn, "aria-pressed", false); 18712 }, 18713 ApplyPressedStyle: function() { }, 18714 ApplyUnpressedStyle: function() { }, 18715 ApplyFocusedStyle: function() { }, 18716 ApplyUnfocusedStyle: function() { }, 18717 ChangeEnabledStateItems: function(enabled) { }, 18718 SetFocus: function () { 18719 if (!this.allowFocus || this.focused) 18720 return; 18721 this.focused = true; 18722 var element = this.GetInternalButton(); 18723 if (element) { 18724 if (ASPx.IsFocusable(element) && ASPx.GetActiveElement() != element) 18725 element.focus(); 18726 } 18727 }, 18728 ClickInternalButton: function() { }, 18729 GetContentDiv: function() { 18730 return null; 18731 }, 18732 GetInternalButton: function() { 18733 return this.GetMainElement(); 18734 }, 18735 GetButtonImage: function() { 18736 return null; 18737 }, 18738 GetTextContainer: function() { 18739 var buttonElement = this.GetMainElement(); 18740 var textNode = ASPx.GetNormalizedTextNode(buttonElement); 18741 return textNode ? textNode.parentNode : buttonElement; 18742 }, 18743 GetTextControl: function() { 18744 return null; 18745 }, 18746 GetBadgeControl: function() { 18747 return ASPx.BootstrapBadgeManager.findBadge(this.GetMainElement()); 18748 }, 18749 RequiredPreventDoublePostback: function() { 18750 return false; 18751 }, 18752 ProcessClick: function() { 18753 if(!this.useSubmitBehavior) 18754 return ASPxClientButton.prototype.ProcessClick.call(this); 18755 this.SendPostBack("Click"); 18756 return true; 18757 }, 18758 GetText: function() { 18759 return this.GetMainElement().value; 18760 }, 18761 SetText: function(text) { 18762 var buttonText = this.HtmlEncode(text); 18763 var buttonElement = this.GetMainElement(); 18764 buttonElement.value = (buttonText != null) ? buttonText : ""; 18765 var textNode = ASPx.GetNormalizedTextNode(buttonElement); 18766 if(textNode && textNode.parentNode == buttonElement) 18767 textNode.nodeValue = buttonText; 18768 else { 18769 textNode = document.createTextNode(buttonText); 18770 var badgeControl = this.GetBadgeControl(); 18771 if(badgeControl) 18772 buttonElement.insertBefore(textNode, badgeControl); 18773 else 18774 buttonElement.appendChild(textNode); 18775 } 18776 }, 18777 GetBadgeText: function() { 18778 return ASPx.BootstrapBadgeManager.getBadgeText(this.GetMainElement()); 18779 }, 18780 SetBadgeText: function(text) { 18781 var badgeText = this.HtmlEncode(text); 18782 var badgeControl = this.GetBadgeControl(); 18783 if(badgeControl) 18784 ASPx.BootstrapBadgeManager.setBadgeText(badgeControl, badgeText); 18785 else 18786 this.GetMainElement().appendChild(ASPx.BootstrapBadgeManager.createBadge(badgeText)); 18787 }, 18788 GetBadgeIconCssClass: function() { 18789 return ASPx.BootstrapBadgeManager.getBadgeIconCssClass(this.GetMainElement()); 18790 }, 18791 SetBadgeIconCssClass: function(cssClass) { 18792 var badgeControl = this.GetBadgeControl(); 18793 if(badgeControl) 18794 ASPx.BootstrapBadgeManager.setBadgeIconCssClass(badgeControl, cssClass); 18795 else 18796 this.GetMainElement().appendChild(ASPx.BootstrapBadgeManager.createBadge("", cssClass)); 18797 } 18798 }); 18799 dx.BootstrapClientButton = BootstrapClientButton; 18800})(dx || (dx = {})); 18801},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.