1var ASPx = ASPx || {}; 2var dx = dx || {}; 3(function module(ASPx, dx) { 4ASPx.modules = { Utils: module }; 5if(!ASPx.attachToReady) 6 ASPx.attachToReady = function (callback) { ASPx.Evt.AttachEventToElement(window, "load", callback); }; 7if(!ASPx.attachToLoad) 8 ASPx.attachToLoad = function(callback) { ASPx.Evt.AttachEventToDocumentCore("DOMContentLoaded", callback); }; 9ASPx.EmptyObject = { }; 10ASPx.FalseFunction = function() { return false; }; 11ASPx.SSLSecureBlankUrl = '/DXR.axd?r=1_86-8BuBq'; 12ASPx.EmptyImageUrl = '/DXR.axd?r=1_87-8BuBq'; 13ASPx.VersionInfo = 'Version=\'22.2.5.0\', File Version=\'22.2.5.0\', Date Modified=\'4/11/2023 11:02:14 PM\''; 14ASPx.Platform = 'ASP'; 15ASPx.DoctypeMode = 'Xhtml'; 16ASPx.InvalidDimension = -10000; 17ASPx.InvalidPosition = -10000; 18ASPx.AbsoluteLeftPosition = -10000; 19ASPx.EmptyGuid = "00000000-0000-0000-0000-000000000000"; 20ASPx.CallbackSeparator = ":"; 21ASPx.ItemIndexSeparator = "i"; 22ASPx.CallbackResultPrefix = "/*DX*/"; 23ASPx.StyleValueEncodedSemicolon = "DXsmcln"; 24ASPx.AccessibilityEmptyUrl = "javascript:;"; 25ASPx.AccessibilityPronounceTimeout = 500; 26ASPx.MaxMobileWindowWidth = 576; 27ASPx.PossibleNumberDecimalSeparators = [",", "."]; 28ASPx.CultureInfo = { 29 twoDigitYearMax: 2029, 30 ts: ":", 31 ds: "/", 32 am: "AM", 33 pm: "PM", 34 monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
34November", "December", ""], 35 genMonthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""], 36 abbrMonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""], 37 abbrDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 38 dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], 39 invariantCultureDecimalPoint: ".", 40 numDecimalPoint: ".", 41 numPrec: 2, 42 numGroupSeparator: ",", 43 numGroups: [ 3 ], 44 numNegPattern: 1, 45 numPosInf: "Infinity", 46 numNegInf: "-Infinity", 47 numNan: "NaN", 48 currency: "$", 49 currDecimalPoint: ".", 50 currPrec: 2, 51 currGroupSeparator: ",", 52 currGroups: [ 3 ], 53 currPosPattern: 0, 54 currNegPattern: 0, 55 percentPattern: 0, 56 shortTime: "h:mm tt", 57 longTime: "h:mm:ss tt", 58 shortDate: "M/d/yyyy", 59 longDate: "dddd, MMMM d, yyyy", 60 monthDay: "MMMM d", 61 yearMonth: "MMMM yyyy" 62}; 63ASPx.CultureInfo.genMonthNames = ASPx.CultureInfo.monthNames; 64ASPx.Position = { 65 Left: "Left", 66 Right: "Right", 67 Top: "Top", 68 Bottom: "Bottom" 69};
70ASPx.FOCUS_TIMEOUT = 100; 71function setInnerHtmlInternal(el, trustedHtmlString) { 72 el.innerHTML = trustedHtmlString; 73} 74var DateUtils = { }; 75DateUtils.GetInvariantDateString = function(date) { 76 if(!date) 77 return "01/01/0001"; 78 var day = date.getDate(); 79 var month = date.getMonth() + 1; 80 var year = date.getFullYear(); 81 var result = ""; 82 if(month < 10) 83 result += "0"; 84 result += month.toString() + "/"; 85 if(day < 10) 86 result += "0"; 87 result += day.toString() + "/"; 88 if(year < 1000) 89 result += "0"; 90 result += year.toString(); 91 return result; 92}; 93DateUtils.GetInvariantDateTimeString = function(date) { 94 var dateTimeString = DateUtils.GetInvariantDateString(date); 95 var time = { 96 h: date.getHours(), 97 m: date.getMinutes(), 98 s: date.getSeconds() 99 }; 100 for(var key in time) { 101 if(time.hasOwnProperty(key)) { 102 var str = time[key].toString(); 103 if(str.length < 2) 104 str = "0" + str; 105 time[key] = str; 106 } 107 } 108 dateTimeString += " " + time.h + ":" + time.m + ":" + time.s; 109 var msec = date.getMilliseconds(); 110 if(msec > 0) 111 dateTimeString += "." + ("000" + msec.toString()).substr(-3); 112 return dateTimeString; 113}; 114DateUtils.ExpandTwoDigitYear = function(value) { 115 value += 1900; 116 if(value + 99 < ASPx.CultureInfo.twoDigitYearMax) 117 value += 100; 118 return value; 119}; 120DateUtils.GetTimeZoneOffsetDifference = function(firstDate, secondDate) { 121 if(!secondDate) 122 secondDate = DateUtils.GetUtcDate(firstDate); 123 return 60000 * (firstDate.getTimezoneOffset() - secondDate.getTimezoneOffset()); 124}; 125DateUtils.GetTimeZoneOffset = function(date) { 126 var isECMA262Support = (ASPx.Browser.Chrome && ASPx.Browser.Version >= 67) || ASPx.Browser.EdgeWebKit; 127 if(!isECMA262Support) 128 return date.getTimezoneOffset() * 60000; 129 var utcDate = DateUtils.GetUtcDate(date); 130 var utcTimezoneOffsetDifference = DateUtils.GetTimeZoneOffsetDifference(date); 131 if(utcTimezoneOffsetDifference !== 0) 132 utcDate.setTime(utcDate.valueOf() + utcTimezoneOffsetDifference); 133 return utcDate - date; 134}; 135DateUtils.GetUtcDate = function(date) { 136 var utcFullYear = date.getUTCFullYear(); 137 var result = new Date(utcFullYear, date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds()); 138 if(utcFullYear < 100) 139 result.setFullYear(utcFullYear); 140 return result; 141}; 142DateUtils.ToUtcTime = function(date) { 143 var result = new Date(); 144 result.setTime(date.valueOf() + ASPx.DateUtils.GetTimeZoneOffset(date)); 145 return result; 146}; 147DateUtils.ToLocalTime = function(date) { 148 var result = new Date(); 149 result.setTime(date.valueOf() - ASPx.DateUtils.GetTimeZoneOffset(date)); 150 return result; 151}; 152DateUtils.AreDatesEqualExact = function(date1, date2) { 153 if(date1 == null && date2 == null) 154 return true; 155 if(date1 == null || date2 == null) 156 return false; 157 return date1.getTime() == date2.getTime(); 158}; 159DateUtils.FixTimezoneGap = function(oldDate, newDate) { 160 var diff = newDate.getHours() - oldDate.getHours(); 161 if(diff == 0) 162 return; 163 var sign = (diff == 1 || diff == -23) ? -1 : 1; 164 var trial = new Date(newDate.getTime() + sign * 3600000); 165 var isDateChangedAsExpected = newDate.getHours() - trial.getHours() === diff; 166 if(isDateChangedAsExpected && (sign > 0 || trial.getDate() == newDate.getDate())) 167 newDate.setTime(trial.getTime()); 168}; 169DateUtils.GetDecadeStartYear = function(year) { 170 return 10 * Math.floor(year / 10); 171}; 172DateUtils.GetCenturyStartYear = function(year) { 173 return 100 * Math.floor(year / 100); 174}; 175DateUtils.GetCorrectedYear = function(date, pickerType) { 176 var year = date.getFullYear(); 177 return pickerType != ASPx.DatePickerType.Decades ? year : DateUtils.GetDecadeStartYear(year); 178}; 179DateUtils.GetCorrectedMonth = function(date, pickerType) { 180 return pickerType < ASPx.DatePickerType.Years ? date.getMonth() : 0; 181}; 182DateUtils.GetCorrectedDay = function(date, pickerType) { 183 return pickerType == ASPx.DatePickerType.Days ? date.getDate() : 1; 184}; 185DateUtils.CorrectDateByPickerType = function(date, pickerType) { 186 if(!ASPx.IsExists(pickerType)) 187 pickerType = ASPx.DatePickerType.Days; 188 if(!date || pickerType == ASPx.DatePickerType.Days) 189 return date; 190 var correctedYear = DateUtils.GetCorrectedYear(date, pickerType); 191 var result = new Date( 192 correctedYear, 193 DateUtils.GetCorrectedMonth(date, pickerType), 194 DateUtils.GetCorrectedDay(date, pickerType), 195 date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds() 196 ); 197 result.setFullYear(correctedYear); 198 return result; 199}; 200DateUtils.GetYearRangeFormatString = function(startYear, rangeLength) { 201 return startYear + " - " + (startYear + rangeLength - 1); 202}; 203ASPx.DateUtils = DateUtils; 204var Timer = { }; 205Timer.ClearTimer = function(timerID){ 206 if(timerID > -1) 207 window.clearTimeout(timerID); 208 return -1; 209};
210Timer.ClearInterval = function(timerID){ 211 if(timerID > -1) 212 window.clearInterval(timerID); 213 return -1; 214}; 215var setControlBoundTimer = function(handler, control, setTimerFunction, clearTimerFunction, delay) { 216 var timerId; 217 var getTimerId = function() { return timerId; }; 218 var controlMainElement = control.GetMainElement(); 219 var boundHandler = function() { 220 var controlExists = control && ASPx.GetControlCollection().Get(control.name) === control && control.GetMainElement() === controlMainElement; 221 if(controlExists) 222 handler.aspxBind(control)(); 223 else { 224 clearTimerFunction(getTimerId()); 225 controlMainElement = null; 226 } 227 }; 228 timerId = setTimerFunction(boundHandler, delay); 229 return timerId; 230}; 231Timer.SetControlBoundTimeout = function(handler, control, delay) { 232 return setControlBoundTimer(handler, control, window.setTimeout, Timer.ClearTimer, delay); 233}; 234Timer.SetControlBoundInterval = function(handler, control, delay) { 235 return setControlBoundTimer(handler, control, window.setInterval, Timer.ClearInterval, delay); 236}; 237Timer.Throttle = function(func, delay) { 238 var isThrottled = false, 239 savedArgs, 240 savedThis = this; 241 function wrapper() { 242 if(isThrottled) { 243 savedArgs = arguments; 244 savedThis = this; 245 return; 246 } 247 func.apply(this, arguments); 248 isThrottled = true; 249 setTimeout(function() { 250 isThrottled = false; 251 if(savedArgs) { 252 wrapper.apply(savedThis, savedArgs); 253 savedArgs = null; 254 } 255 }, delay); 256 } 257 wrapper.cancel = function() { 258 clearTimeout(delay); 259 delay = savedArgs = savedThis = null; 260 }; 261 return wrapper; 262}; 263ASPx.Timer = Timer; 264var Browser = { }; 265Browser.UserAgent = navigator.userAgent.toLowerCase(); 266Browser.Mozilla = false; 267Browser.IE = false; 268Browser.Firefox = false; 269Browser.Netscape = false; 270Browser.Safari = false; 271Browser.Chrome = false; 272Browser.Opera = false; 273Browser.Edge = false; 274Browser.EdgeWebKit = false; 275Browser.Version = undefined; 276Browser.MajorVersion = undefined; 277Browser.WindowsPlatform = false; 278Browser.MacOSPlatform = false; 279Browser.MacOSMobilePlatform = false; 280Browser.AndroidMobilePlatform = false; 281Browser.PlaformMajorVersion = false; 282Browser.WindowsPhonePlatform = false; 283Browser.AndroidDefaultBrowser = false; 284Browser.AndroidChromeBrowser = false; 285Browser.SamsungAndroidDevice = false; 286Browser.WebKitTouchUI = false; 287Browser.MSTouchUI = false; 288Browser.TouchUI = false; 289Browser.WebKitFamily = false; 290Browser.NetscapeFamily = false; 291Browser.VirtualKeyboardSupported = false; 292Browser.Info = ""; 293Browser.IsQuirksMode = document.compatMode === "BackCompat"; 294function indentPlatformMajorVersion(userAgent) { 295 var regex = /(?:(?:windows nt|macintosh|mac os|cpu os|cpu iphone os|android|windows phone|linux) )(\d+)(?:[-0-9_.])*/; 296 var matches = regex.exec(userAgent); 297 if(matches) 298 Browser.PlaformMajorVersion = matches[1]; 299} 300function getIECompatibleVersionString() { 301 if(document.compatible) { 302 for(var i = 0; i < document.compatible.length; i++) 303 if(document.compatible[i].userAgent === "IE" && document.compatible[i].version) 304 return document.compatible[i].version.toLowerCase(); 305 } 306 return ""; 307} 308Browser.IdentUserAgent = function(userAgent, ignoreDocumentMode) { 309 var browserTypesOrderedList = ["Mozilla", "IE", "Firefox", "Netscape", "Safari", "Chrome", "Opera", "Opera10", "EdgeWebKit", "Edge" ]; 310 var defaultBrowserType = "IE"; 311 var defaultPlatform = "Win"; 312 var defaultVersions = { Safari: 2, Chrome: 0.1, Mozilla: 1.9, Netscape: 8, Firefox: 2, Opera: 9, IE: 6, Edge: 12 }; 313 if(!userAgent || userAgent.length == 0) { 314 fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform); 315 return; 316 } 317 userAgent = userAgent.toLowerCase(); 318 indentPlatformMajorVersion(userAgent); 319 try { 320 var platformIdentStrings = { 321 "Windows": "Win", 322 "Macintosh": "Mac", 323 "Mac OS": "Mac", 324 "Mac_PowerPC": "Mac", 325 "cpu os": "MacMobile", 326 "cpu iphone os": "MacMobile", 327 "Android": "Android", 328 "!Windows Phone": "WinPhone", 329 "!WPDesktop": "WinPhone", 330 "!ZuneWP": "WinPhone" 331 }; 332 var optSlashOrSpace = "(?:/|\\s*)?"; 333 var version = "(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)0*?)?"; 334 var optComma = "(?:,)?"; 335 var appleVersion = "(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)" + optComma + "0*?)?"; 336 var optVersion = "(?:" + version + ")?"; 337 var patterns = { 338 Safari: "applewebkit(?:.*?(?:version/" + appleVersion + "[\\.\\w\\d]*?(?:\\s+mobile\/\\S*)?\\s+safari))?", 339 Chrome: "(?:chrome|crios)(?!frame)" + optSlashOrSpace + optVersion, 340 Mozilla: "mozilla(?:.*rv:" + optVersion + ".*Gecko)?", 341 Netscape: "(?:netscape|navigator)\\d*/?\\s*" + optVersion, 342 Firefox: "firefox" + optSlashOrSpace + optVersion, 343 Opera: "(?:opera|\sopr)" + optSlashOrSpace + optVersion, 344 Opera10: "opera.*\\s*version" + optSlashOrSpace + optVersion, 345 IE: "msie\\s*" + optVersion, 346 EdgeWebKit: "edg" + optSlashOrSpace + optVersion, 347 Edge: "edge" + optSlashOrSpace + optVersion 348 }; 349 var browserType; 350 var version = -1; 351 for(var i = 0; i < browserTypesOrderedList.length; i++) { 352 var browserTypeCandidate = browserTypesOrderedList[i]; 353 var regExp = new RegExp(patterns[browserTypeCandidate], "i"); 354 if(regExp.compile) 355 regExp.compile(patterns[browserTypeCandidate], "i"); 356 var matches = regExp.exec(userAgent); 357 if(matches && matches.index >= 0) { 358 if(browserType == "IE" && version >= 11 && browserTypeCandidate == "Safari") 359 continue; 360 browserType = browserTypeCandidate; 361 if(browserType == "Opera10") 362 browserType = "Opera"; 363 var tridentPattern = "trident" + optSlashOrSpace + optVersion; 364 version = Browser.GetBrowserVersion(userAgent, matches, tridentPattern, getIECompatibleVersionString()); 365 if(browserType == "Mozilla" && version >= 11) 366 browserType = "IE"; 367 } 368 } 369 if(!browserType) 370 browserType = defaultBrowserType; 371 var browserVersionDetected = version != -1; 372 if(!browserVersionDetected) 373 version = defaultVersions[browserType]; 374 var platform; 375 var minOccurenceIndex = Number.MAX_VALUE;
376 for(var identStr in platformIdentStrings) { 377 if(!platformIdentStrings.hasOwnProperty(identStr)) continue; 378 var importantIdent = identStr.substr(0,1) == "!"; 379 var occurenceIndex = userAgent.indexOf((importantIdent ? identStr.substr(1) : identStr).toLowerCase()); 380 if(occurenceIndex >= 0 && (occurenceIndex < minOccurenceIndex || importantIdent)) { 381 minOccurenceIndex = importantIdent ? 0 : occurenceIndex; 382 platform = platformIdentStrings[identStr]; 383 } 384 } 385 var samsungPattern = "SM-[A-Z]"; 386 var matches = userAgent.toUpperCase().match(samsungPattern); 387 var isSamsungAndroidDevice = matches && matches.length > 0; 388 if(platform == "WinPhone" && version < 9) 389 version = Math.floor(getVersionFromTrident(userAgent, "trident" + optSlashOrSpace + optVersion)); 390 if(!ignoreDocumentMode && browserType == "IE" && version > 7 && document.documentMode < version) 391 version = document.documentMode; 392 if(platform == "WinPhone") 393 version = Math.max(9, version); 394 if(!platform) 395 platform = defaultPlatform; 396 if(platform == platformIdentStrings["cpu os"] && !browserVersionDetected) 397 version = 4; 398 fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice); 399 } catch(e) { 400 fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform); 401 } 402}; 403function getVersionFromMatches(matches) { 404 var result = -1; 405 var versionStr = ""; 406 if(matches[1]) { 407 versionStr += matches[1]; 408 if(matches[2]) 409 versionStr += "." + matches[2]; 410 } 411 if(versionStr != "") { 412 result = parseFloat(versionStr); 413 if(isNaN(result)) 414 result = -1; 415 } 416 return result; 417} 418function getVersionFromTrident(userAgent, tridentPattern) { 419 var tridentDiffFromVersion = 4; 420 var matches = new RegExp(tridentPattern, "i").exec(userAgent); 421 return getVersionFromMatches(matches) + tridentDiffFromVersion; 422} 423Browser.GetBrowserVersion = function(userAgent, matches, tridentPattern, ieCompatibleVersionString) { 424 var version = getVersionFromMatches(matches); 425 if(ieCompatibleVersionString) { 426 var versionFromTrident = getVersionFromTrident(userAgent, tridentPattern); 427 if(ieCompatibleVersionString === "edge" || parseInt(ieCompatibleVersionString) === versionFromTrident) 428 return versionFromTrident; 429 } 430 return version; 431}; 432function fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice) { 433 for(var i = 0; i < browserTypesOrderedList.length; i++) { 434 var type = browserTypesOrderedList[i]; 435 Browser[type] = type == browserType; 436 } 437 Browser.Version = Math.floor(10.0 * version) / 10.0; 438 Browser.MajorVersion = Math.floor(Browser.Version); 439 Browser.WindowsPlatform = platform == "Win" || platform == "WinPhone"; 440 Browser.MacOSPlatform = platform == "Mac"; 441 var isMacWithTouchSupport = platform == "Mac" && (!!window.ontouchstart || getMaxTouchPoints() > 0); 442 Browser.MacOSMobilePlatform = platform == "MacMobile" || isMacWithTouchSupport; 443 if(Browser.MacOSMobilePlatform) 444 Browser.MacOSPlatform = false; 445 Browser.AndroidMobilePlatform = platform == "Android"; 446 Browser.WindowsPhonePlatform = platform == "WinPhone"; 447 Browser.WebKitFamily = Browser.Safari || Browser.Chrome || Browser.Opera && Browser.MajorVersion >= 15 || Browser.EdgeWebKit; 448 Browser.NetscapeFamily = Browser.Netscape || Browser.Mozilla || Browser.Firefox; 449 Browser.WebKitTouchUI = Browser.MacOSMobilePlatform || Browser.AndroidMobilePlatform; 450 var isIETouchUI = Browser.IE && Browser.MajorVersion > 9 && Browser.WindowsPlatform && Browser.UserAgent.toLowerCase().indexOf("touch") >= 0; 451 Browser.MSTouchUI = isIETouchUI || ((Browser.Edge || (Browser.EdgeWebKit && !Browser.AndroidMobilePlatform)) && !!getMaxTouchPoints()); 452 Browser.TouchUI = Browser.WebKitTouchUI || Browser.MSTouchUI; 453 Browser.MobileUI = Browser.WebKitTouchUI || Browser.WindowsPhonePlatform; 454 Browser.AndroidDefaultBrowser = Browser.AndroidMobilePlatform && !Browser.Chrome; 455 Browser.AndroidChromeBrowser = Browser.AndroidMobilePlatform && Browser.Chrome; 456 if(isSamsungAndroidDevice) 457 Browser.SamsungAndroidDevice = isSamsungAndroidDevice; 458 if(Browser.MSTouchUI) { 459 var isARMArchitecture = Browser.UserAgent.toLowerCase().indexOf("arm;") > -1; 460 Browser.VirtualKeyboardSupported = isARMArchitecture || Browser.WindowsPhonePlatform; 461 } else { 462 Browser.VirtualKeyboardSupported = Browser.MobileUI; 463 } 464 fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList); 465} 466function getMaxTouchPoints() { 467 var result = navigator.maxTouchPoints;
468 if(window.testingTouchMode) 469 result = 10; 470 return result; 471} 472function fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList) { 473 var documentElementClassName = ""; 474 var browserTypeslist = browserTypesOrderedList.concat(["WindowsPlatform", "MacOSPlatform", "MacOSMobilePlatform", "AndroidMobilePlatform", 475 "WindowsPhonePlatform", "WebKitFamily", "WebKitTouchUI", "MSTouchUI", "TouchUI", "AndroidDefaultBrowser", "MobileUI"]); 476 for(var i = 0; i < browserTypeslist.length; i++) { 477 var type = browserTypeslist[i]; 478 if(Browser[type]) 479 documentElementClassName += "dx" + type + " "; 480 } 481 documentElementClassName += "dxBrowserVersion-" + Browser.MajorVersion; 482 if(document && document.documentElement) { 483 if(document.documentElement.className != "") 484 documentElementClassName = " " + documentElementClassName; 485 document.documentElement.className += documentElementClassName; 486 Browser.Info = documentElementClassName; 487 } 488} 489Browser.SupportsStickyPositioning = function() { 490 return this.Chrome && this.MajorVersion >= 56 491 || this.Firefox && this.MajorVersion >= 32 492 || this.Safari && this.MajorVersion >= 6 && this.Version !== "6" 493 || this.Opera && this.MajorVersion >= 42; 494}; 495Browser.IdentUserAgent(Browser.UserAgent); 496ASPx.Browser = Browser; 497ASPx.BlankUrl = Browser.Opera ? "about:blank" : ""; 498ASPx.FillDocumentElementDXThemeCssClassName = function(dxThemeName) { 499 document.documentElement.className += " dxTheme-" + dxThemeName; 500}; 501var Data = { }; 502Data.ArrayInsert = function(array, element, position){ 503 if(0 <= position && position < array.length){ 504 for(var i = array.length; i > position; i --) 505 array[i] = array[i - 1]; 506 array[position] = element; 507 } 508 else 509 array.push(element); 510}; 511Data.ArrayRemove = function(array, element){ 512 var index = Data.ArrayIndexOf(array, element); 513 if(index > -1) Data.ArrayRemoveAt(array, index); 514}; 515Data.ArrayRemoveAt = function(array, index){ 516 if(index >= 0 && index < array.length){ 517 for(var i = index; i < array.length - 1; i++) 518 array[i] = array[i + 1]; 519 array.pop(); 520 } 521}; 522Data.ArrayClear = function(array){ 523 while(array.length > 0) 524 array.pop(); 525}; 526Data.ArrayIndexOf = function(array, element, comparer) { 527 if(!comparer) { 528 for(var i = 0; i < array.length; i++) { 529 if(array[i] == element) 530 return i; 531 } 532 } else { 533 for(var i = 0; i < array.length; i++) { 534 if(comparer(array[i], element)) 535 return i; 536 } 537 } 538 return -1; 539}; 540Data.ArrayContains = function(array, element) { 541 return Data.ArrayIndexOf(array, element) >= 0; 542}; 543Data.ArrayEqual = function(array1, array2) { 544 var count1 = array1.length; 545 var count2 = array2.length; 546 if(count1 != count2) 547 return false; 548 for(var i = 0; i < count1; i++) 549 if(array1[i] != array2[i]) 550 return false; 551 return true; 552}; 553Data.ArraySame = function(array1, array2) { 554 if(array1.length !== array2.length) 555 return false; 556 return array1.every(function(elem) { return Data.ArrayContains(array2, elem); }); 557}; 558Data.ArrayGetIntegerEdgeValues = function(array) { 559 var arrayToSort = Data.CollectionToArray(array); 560 Data.ArrayIntegerAscendingSort(arrayToSort); 561 return { 562 start: arrayToSort[0], 563 end: arrayToSort[arrayToSort.length - 1] 564 }; 565}; 566Data.ArrayIntegerAscendingSort = function(array){ 567 Data.ArrayIntegerSort(array); 568}; 569Data.ArrayIntegerSort = function(array, desc) { 570 array.sort(function(i1, i2) { 571 var res = 0; 572 if(i1 > i2) 573 res = 1; 574 else if(i1 < i2) 575 res = -1; 576 if(desc) 577 res *= -1; 578 return res; 579 }); 580}; 581Data.CollectionsUnionToArray = function(firstCollection, secondCollection) { 582 var result = []; 583 var firstCollectionLength = firstCollection.length; 584 var secondCollectionLength = secondCollection.length; 585 for(var i = 0; i < firstCollectionLength + secondCollectionLength; i++) { 586 if(i < firstCollectionLength) 587 result.push(firstCollection[i]); 588 else 589 result.push(secondCollection[i - firstCollectionLength]); 590 } 591 return result; 592}; 593Data.CollectionToArray = function(collection) { 594 var array = []; 595 for(var i = 0; i < collection.length; i++) 596 array.push(collection[i]); 597 return array; 598};
599Data.CreateHashTableFromArray = function(array) { 600 var hash = []; 601 for(var i = 0; i < array.length; i++) 602 hash[array[i]] = 1; 603 return hash; 604}; 605Data.CreateIndexHashTableFromArray = function(array) { 606 var hash = []; 607 for(var i = 0; i < array.length; i++) 608 hash[array[i]] = i; 609 return hash; 610}; 611Data.ArrayToHash = function(array, getKeyFunc, getValueFunc) { 612 if(!(array instanceof Array)) 613 return { }; 614 return array.reduce(function(map, element, index) { 615 var key = getKeyFunc(element, index); 616 var value = getValueFunc(element, index); 617 map[key] = value; 618 return map; 619 }, { }); 620}; 621Data.Sum = function(array, getValueFunc) { 622 if(!(array instanceof Array)) 623 return 0; 624 return array.reduce(function(prevValue, item) { 625 var value = getValueFunc ? getValueFunc(item) : item; 626 if(!ASPx.IsNumber(value)) 627 value = 0; 628 return prevValue + value; 629 }, 0); 630}; 631Data.Min = function(array, getValueFunc) { return CalculateArrayMinMax(array, getValueFunc, false); }; 632Data.Max = function(array, getValueFunc) { return CalculateArrayMinMax(array, getValueFunc, true); }; 633var CalculateArrayMinMax = function(array, getValueFunc, isMax) { 634 if(!(array instanceof Array)) 635 return 0; 636 var startValue = isMax ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY; 637 return array.reduce(function(prevValue, item) { 638 var value = getValueFunc ? getValueFunc(item) : item; 639 if(!ASPx.IsNumber(value)) 640 value = startValue; 641 var func = isMax ? Math.max : Math.min; 642 return func(value, prevValue); 643 }, startValue); 644}; 645var defaultBinarySearchComparer = function(array, index, value) { 646 var arrayElement = array[index]; 647 if(arrayElement == value) 648 return 0; 649 else 650 return arrayElement < value ? -1 : 1; 651}; 652Data.NearestLeftBinarySearchComparer = function(array, index, value) { 653 var arrayElement = array[index]; 654 var leftPoint = arrayElement < value; 655 var lastLeftPoint = leftPoint && index == array.length - 1; 656 var nearestLeftPoint = lastLeftPoint || (leftPoint && array[index + 1] >= value); 657 if(nearestLeftPoint) 658 return 0; 659 else 660 return arrayElement < value ? -1 : 1; 661}; 662Data.ArrayBinarySearch = function(array, value, binarySearchComparer, startIndex, length) { 663 if(!binarySearchComparer) 664 binarySearchComparer = defaultBinarySearchComparer; 665 if(!ASPx.IsExists(startIndex)) 666 startIndex = 0; 667 if(!ASPx.IsExists(length)) 668 length = array.length - startIndex; 669 var endIndex = (startIndex + length) - 1; 670 while(startIndex <= endIndex) { 671 var middle = (startIndex + ((endIndex - startIndex) >> 1)); 672 var compareResult = binarySearchComparer(array, middle, value); 673 if(compareResult == 0) 674 return middle; 675 if(compareResult < 0) 676 startIndex = middle + 1; 677 else 678 endIndex = middle - 1; 679 } 680 return -(startIndex + 1); 681}; 682Data.ArrayFlatten = function(arrayOfArrays) { 683 return [].concat.apply([], arrayOfArrays); 684}; 685Data.GetDistinctArray = function(array) { 686 var resultArray = []; 687 for(var i = 0; i < array.length; i++) { 688 var currentEntry = array[i]; 689 if(Data.ArrayIndexOf(resultArray, currentEntry) == -1) { 690 resultArray.push(currentEntry); 691 } 692 } 693 return resultArray; 694}; 695Data.ForEach = function(arr, callback) { 696 if(Array.prototype.forEach) { 697 Array.prototype.forEach.call(arr, callback); 698 } else { 699 for(var i = 0, len = arr.length; i < len; i++) { 700 callback(arr[i], i, arr); 701 } 702 } 703}; 704Data.MergeHashTables = function(target, object) { 705 if(!object || typeof (object) == "string") 706 return target; 707 if(!target) 708 target = {}; 709 for(var key in object) 710 if(key && !(key in target)) 711 target[key] = object[key]; 712 return target; 713}; 714Data.Range = function(count, start) { 715 count = parseInt(count) || 0; 716 start = parseInt(start) || 0; 717 if(count < 0) count = 0; 718 if(start < 0) start = 0; 719 return Array.apply(null, Array(count)).map(function(val, i) { return start + i; }); 720}; 721ASPx.Data = Data; 722var Cookie = { }; 723Cookie.DelCookie = function(name){ 724 setCookieInternal(name, "", new Date(1970, 1, 1)); 725}; 726Cookie.GetCookie = function(name) { 727 name = escape(name); 728 var cookies = document.cookie.split(';'); 729 for(var i = 0; i < cookies.length; i++) { 730 var cookie = Str.Trim(cookies[i]); 731 if(cookie.indexOf(name + "=") == 0) 732 return unescape(cookie.substring(name.length + 1, cookie.length)); 733 else if(cookie.indexOf(name + ";") == 0 || cookie === name) 734 return ""; 735 } 736 return null; 737}; 738Cookie.SetCookie = function(name, value, expirationDate){ 739 if(!ASPx.IsExists(value)) { 740 Cookie.DelCookie(name); 741 return; 742 } 743 if(!ASPx.Ident.IsDate(expirationDate)) { 744 expirationDate = new Date(); 745 expirationDate.setFullYear(expirationDate.getFullYear() + 1); 746 } 747 setCookieInternal(name, value, expirationDate); 748}; 749function setCookieInternal(name, value, date){ 750 document.cookie = escape(name) + "=" + escape(value.toString()) + "; expires=" + date.toGMTString() + "; path=/"; 751} 752ASPx.Cookie = Cookie;
753ASPx.ImageUtils = { 754 GetImageSrc: function (image){ 755 return image.src; 756 }, 757 SetImageSrc: function(image, src){ 758 image.src = src; 759 }, 760 SetSize: function(image, width, height){ 761 image.style.width = width + "px"; 762 image.style.height = height + "px"; 763 }, 764 GetSize: function(image, isWidth) { 765 return (isWidth ? ASPx.GetElementOffsetWidth(image) : ASPx.GetElementOffsetHeight(image)); 766 } 767}; 768var Str = { }; 769Str.ApplyReplacement = function(text, replecementTable) { 770 if(typeof(text) != "string") 771 text = text.toString(); 772 for(var i = 0; i < replecementTable.length; i++) { 773 var replacement = replecementTable[i]; 774 text = text.replace(replacement[0], replacement[1]); 775 } 776 return text; 777}; 778Str.CompleteReplace = function(text, regexp, newSubStr) { 779 if(typeof(text) != "string") 780 text = text.toString(); 781 var textPrev; 782 do { 783 textPrev = text; 784 text = text.replace(regexp, newSubStr); 785 } while(text != textPrev); 786 return text; 787}; 788Str.EncodeHtml = function(html) { 789 return Str.ApplyReplacement(html, [ 790 [ /&/g, '&x;' ], [ /&/g, '&' ], 791 [ /"/g, '"x;' ], [ /"/g, '"' ], 792 [ /</g, '<x;' ], [ /</g, '<' ], 793 [ />/g, '>x;' ], [ />/g, '>' ] 794 ]); 795}; 796Str.DecodeHtml = function(html) { 797 return Str.ApplyReplacement(html, [ 798 [ />/g, '>' ], [ />x;/g, '>' ], 799 [ /</g, '<' ], [ /<x;/g, '<' ], 800 [ /"/g, '"' ], [ /"x;/g,'"' ], 801 [ /&/g, '&' ], [ /&x;/g, '&' ] 802 ]); 803}; 804Str.DecodeHtmlViaTextArea = function(html) { 805 var textArea = document.createElement("TEXTAREA"); 806 setInnerHtmlInternal(textArea, html); 807 return textArea.value; 808}; 809Str.TrimStart = function(str) { 810 return trimInternal(str, true); 811}; 812Str.TrimEnd = function(str) { 813 return trimInternal(str, false, true); 814}; 815Str.Trim = function(str) { 816 return trimInternal(str, true, true); 817}; 818Str.EscapeForRegEx = function(str) { 819 return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); 820};
821var whiteSpaces = { 822 0x0009: 1, 0x000a: 1, 0x000b: 1, 0x000c: 1, 0x000d: 1, 0x0020: 1, 0x0085: 1, 823 0x00a0: 1, 0x1680: 1, 0x180e: 1, 0x2000: 1, 0x2001: 1, 0x2002: 1, 0x2003: 1, 824 0x2004: 1, 0x2005: 1, 0x2006: 1, 0x2007: 1, 0x2008: 1, 0x2009: 1, 0x200a: 1, 825 0x200b: 1, 0x2028: 1, 0x2029: 1, 0x202f: 1, 0x205f: 1, 0x3000: 1, 0xfeff: 1 826}; 827var caretWidth = 1; 828function trimInternal(source, trimStart, trimEnd) { 829 var len = source.length; 830 if(!len) 831 return source; 832 var result = ""; 833 if(len < 0xBABA1) 834 result = trimSource(source, trimStart, trimEnd); 835 else 836 result = trimLargeSource(source, len, trimStart, trimEnd); 837 return Str.ClearString(result); 838} 839function trimSource(source, trimStart, trimEnd) { 840 var result = source; 841 if(trimStart) 842 result = result.replace(/^\s+/, ""); 843 if(trimEnd) 844 result = result.replace(/\s+$/, ""); 845 return result; 846} 847function trimLargeSource(source, len, trimStart, trimEnd) { 848 var start = 0; 849 if(trimEnd) { 850 while(len > 0 && whiteSpaces[source.charCodeAt(len - 1)]) { 851 len--; 852 } 853 } 854 if(trimStart && len > 0) { 855 while(start < len && whiteSpaces[source.charCodeAt(start)]) { 856 start++; 857 } 858 } 859 return source.substring(start, len); 860} 861var inlineStringLength = 12; 862Str.ClearString = function(str) { 863 if(!ASPx.Browser.Chrome) 864 return str; 865 return str.length < inlineStringLength ? str : JSON.parse(JSON.stringify(str)); 866}; 867Str.Insert = function(str, subStr, index) { 868 var leftText = str.slice(0, index); 869 var rightText = str.slice(index); 870 return leftText + subStr + rightText; 871}; 872Str.InsertEx = function(str, subStr, startIndex, endIndex) { 873 var leftText = str.slice(0, startIndex); 874 var rightText = str.slice(endIndex); 875 return leftText + subStr + rightText; 876}; 877var greekSLFSigmaChar = String.fromCharCode(962); 878var greekSLSigmaChar = String.fromCharCode(963); 879Str.PrepareStringForFilter = function(s, saveCaseSensitive){ 880 if(!saveCaseSensitive) 881 s = s.toLowerCase(); 882 if(ASPx.Browser.WebKitFamily) { 883 return s.replace(new RegExp(greekSLFSigmaChar, "g"), greekSLSigmaChar); 884 } 885 return s; 886}; 887Str.GetCoincideCharCount = function(text, filter, textMatchingDelegate) { 888 var coincideText = ASPx.Str.PrepareStringForFilter(filter); 889 var originText = ASPx.Str.PrepareStringForFilter(text); 890 while(coincideText != "" && !textMatchingDelegate(originText, coincideText)) { 891 coincideText = coincideText.slice(0, -1); 892 } 893 return coincideText.length; 894}; 895Str.EndsWith = function(str, suffix) { 896 return str.indexOf(suffix, str.length - suffix.length) !== -1; 897}; 898ASPx.Str = Str; 899var Xml = { }; 900Xml.Parse = function(xmlStr) { 901 if(window.DOMParser) { 902 var parser = new DOMParser(); 903 return parser.parseFromString(xmlStr, "text/xml"); 904 } 905 else if(window.ActiveXObject) { 906 var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM"); 907 if(xmlDoc) { 908 xmlDoc.async = false; 909 xmlDoc.loadXML(xmlStr); 910 return xmlDoc; 911 } 912 } 913 return null; 914}; 915ASPx.Xml = Xml; 916ASPx.Key = { 917 F1 : 112, 918 F2 : 113, 919 F3 : 114, 920 F4 : 115, 921 F5 : 116, 922 F6 : 117, 923 F7 : 118, 924 F8 : 119,
925 F9 : 120, 926 F10 : 121, 927 F11 : 122, 928 F12 : 123, 929 Ctrl : 17, 930 Shift : 16, 931 Alt : 18, 932 Enter : 13, 933 Home : 36, 934 End : 35, 935 Left : 37, 936 Right : 39, 937 Up : 38, 938 Down : 40, 939 PageUp : 33, 940 PageDown : 34, 941 Esc : 27, 942 Space : 32, 943 Tab : 9, 944 Backspace : 8, 945 Delete : 46, 946 Insert : 45, 947 ContextMenu : 93, 948 Windows : 91, 949 Decimal : 110, 950 CapsLock : 20 951}; 952ASPx.ModifierKey = { 953 None: 0, 954 Ctrl: 1 << (0 + 16), 955 Shift: 1 << (2 + 16), 956 Alt: 1 << (4 + 16), 957 Meta: 1 << (8 + 16) 958}; 959ASPx.KeyCode = { 960 Backspace : 8, 961 Tab : 9, 962 Enter : 13, 963 Pause : 19, 964 CapsLock : 20, 965 Esc : 27, 966 Space : 32, 967 PageUp : 33, 968 PageDown : 34, 969 End : 35, 970 Home : 36, 971 Left : 37, 972 Up : 38, 973 Right : 39, 974 Down : 40, 975 Insert : 45, 976 Delete : 46, 977 Key_0 : 48, 978 Key_1 : 49, 979 Key_2 : 50, 980 Key_3 : 51, 981 Key_4 : 52, 982 Key_5 : 53, 983 Key_6 : 54, 984 Key_7 : 55, 985 Key_8 : 56, 986 Key_9 : 57, 987 Key_a : 65, 988 Key_b : 66, 989 Key_c : 67, 990 Key_d : 68, 991 Key_e : 69, 992 Key_f : 70, 993 Key_g : 71, 994 Key_h : 72, 995 Key_i : 73, 996 Key_j : 74, 997 Key_k : 75, 998 Key_l : 76, 999 Key_m : 77, 1000 Key_n : 78, 1001 Key_o : 79, 1002 Key_p : 80, 1003 Key_q : 81, 1004 Key_r : 82, 1005 Key_s : 83, 1006 Key_t : 84, 1007 Key_u : 85, 1008 Key_v : 86, 1009 Key_w : 87, 1010 Key_x : 88, 1011 Key_y : 89, 1012 Key_z : 90, 1013 Windows : 91, 1014 ContextMenu : 93, 1015 Numpad_0 : 96, 1016 Numpad_1 : 97, 1017 Numpad_2 : 98, 1018 Numpad_3 : 99, 1019 Numpad_4 : 100, 1020 Numpad_5 : 101, 1021 Numpad_6 : 102, 1022 Numpad_7 : 103, 1023 Numpad_8 : 104, 1024 Numpad_9 : 105, 1025 Multiply : 106, 1026 Add : 107, 1027 Subtract : 109, 1028 Decimal : 110, 1029 Divide : 111, 1030 F1 : 112, 1031 F2 : 113, 1032 F3 : 114, 1033 F4 : 115, 1034 F5 : 116, 1035 F6 : 117, 1036 F7 : 118, 1037 F8 : 119,
1038 F9 : 120, 1039 F10 : 121, 1040 F11 : 122, 1041 F12 : 123, 1042 NumLock : 144, 1043 ScrollLock : 145, 1044 Semicolon : 186, 1045 Equals : 187, 1046 Comma : 188, 1047 Dash : 189, 1048 Period : 190, 1049 ForwardSlash : 191, 1050 GraveAccent : 192, 1051 OpenBracket : 219, 1052 BackSlash : 220, 1053 CloseBracket : 221, 1054 SingleQuote : 222 1055}; 1056ASPx.ScrollBarMode = { Hidden: 0, Visible: 1, Auto: 2 }; 1057ASPx.ColumnResizeMode = { None: 0, Control: 1, NextColumn: 2 }; 1058var Selection = { }; 1059Selection.Set = function(input, startPos, endPos, scrollToSelection, isApi) { 1060 if(!ASPx.IsExistsElement(input)) 1061 return; 1062 var isInputFocused = ASPx.GetActiveElement() === input; 1063 var isInputNativeFocusLocked = ASPx.VirtualKeyboardUI.getInputNativeFocusLocked(); 1064 if(!isApi && Browser.VirtualKeyboardSupported && (!isInputFocused || isInputNativeFocusLocked)) 1065 return; 1066 var textLen = input.value.length; 1067 startPos = ASPx.GetDefinedValue(startPos, 0); 1068 endPos = ASPx.GetDefinedValue(endPos, textLen); 1069 if(startPos < 0) 1070 startPos = 0; 1071 if(endPos < 0 || endPos > textLen) 1072 endPos = textLen; 1073 if(startPos > endPos) 1074 startPos = endPos; 1075 var makeReadOnly = false; 1076 if(Browser.WebKitFamily && input.readOnly) { 1077 input.readOnly = false; 1078 makeReadOnly = true; 1079 } 1080 try { 1081 if(Browser.Firefox && Browser.Version >= 8) 1082 input.setSelectionRange(startPos, endPos, "backward"); 1083 else { 1084 forceScrollToSelectionRange(input, startPos, endPos); 1085 input.setSelectionRange(startPos, endPos); 1086 } 1087 if(Browser.Opera || Browser.Firefox || Browser.Chrome || Browser.Edge || Browser.EdgeWebKit) 1088 input.focus(); 1089 } catch(e) { } 1090 if(scrollToSelection && input.tagName == 'TEXTAREA') { 1091 var scrollHeight = input.scrollHeight; 1092 var approxCaretPos = startPos; 1093 var scrollTop = Math.max(Math.round(approxCaretPos * scrollHeight / textLen - input.clientHeight / 2), 0); 1094 input.scrollTop = scrollTop; 1095 } 1096 if(makeReadOnly) 1097 input.readOnly = true; 1098}; 1099var getTextWidthBeforePos = function(input, pos) { 1100 return ASPx.GetSizeOfText(input.value.toString().substr(0, pos), ASPx.GetCurrentStyle(input)).width; 1101}; 1102var forceScrollToSelectionRange = function(input, startPos, endPos) { 1103 if(endPos === input.value.length) 1104 input.scrollLeft = input.scrollWidth; 1105 else if(startPos === 0 && endPos === 0) 1106 input.scrollLeft = 0; 1107 else { 1108 var inputRawWidth = ASPx.GetElementOffsetWidth(input) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(input); 1109 if(inputRawWidth < input.scrollWidth) { 1110 var widthBeforeEndPos = getTextWidthBeforePos(input, endPos) + caretWidth; 1111 if(input.scrollLeft < widthBeforeEndPos - inputRawWidth) 1112 input.scrollLeft = widthBeforeEndPos - inputRawWidth; 1113 else { 1114 var widthBeforeStartPos = getTextWidthBeforePos(input, startPos) - caretWidth; 1115 if(input.scrollLeft > widthBeforeStartPos) 1116 input.scrollLeft = widthBeforeStartPos; 1117 } 1118 } 1119 } 1120}; 1121Selection.GetInfo = function(input) { 1122 var start, end; 1123 try { 1124 start = input.selectionStart; 1125 end = input.selectionEnd; 1126 } catch (e) { 1127 } 1128 return { startPos: start, endPos: end }; 1129}; 1130Selection.GetExtInfo = function(input) { 1131 var start = 0, end = 0; 1132 try { 1133 start = input.selectionStart; 1134 end = input.selectionEnd; 1135 } catch (e) { 1136 } 1137 return {startPos: start, endPos: end}; 1138}; 1139Selection.SetCaretPosition = function(input, caretPos) { 1140 if(typeof caretPos === "undefined" || caretPos < 0) 1141 caretPos = input.value.length; 1142 Selection.Set(input, caretPos, caretPos, true); 1143}; 1144Selection.GetCaretPosition = function(element, isDialogMode) { 1145 var pos = 0; 1146 if("selectionStart" in element) { 1147 pos = element.selectionStart; 1148 } else if("selection" in document) { 1149 element.focus(); 1150 var sel = document.selection.createRange(), 1151 selLength = document.selection.createRange().text.length; 1152 sel.moveStart("character", -element.value.length); 1153 pos = sel.text.length - selLength; 1154 } 1155 if(isDialogMode && !pos) { 1156 pos = element.value.length - 1; 1157 } 1158 return pos; 1159}; 1160Selection.Clear = function() { 1161 try { 1162 if(window.getSelection) { 1163 window.getSelection().removeAllRanges(); 1164 } 1165 else if(document.selection) { 1166 if(document.selection.empty) 1167 document.selection.empty(); 1168 else if(document.selection.clear) 1169 document.selection.clear(); 1170 } 1171 } catch(e) { 1172 } 1173}; 1174Selection.ClearOnMouseMove = function(evt) { 1175 Selection.Clear(); 1176}; 1177Selection.SetElementSelectionEnabled = function(element, value) { 1178 var userSelectValue = value ? "" : "none"; 1179 var func = value ? Evt.DetachEventFromElement : Evt.AttachEventToElement; 1180 if(Browser.Firefox) 1181 element.style.MozUserSelect = userSelectValue; 1182 else if(Browser.WebKitFamily) 1183 element.style.webkitUserSelect = userSelectValue; 1184 else if(Browser.Edge) 1185 element.style.msUserSelect = userSelectValue; 1186 else if(Browser.Opera) 1187 func(element, "mousemove", Selection.Clear); 1188 else { 1189 func(element, "selectstart", ASPx.FalseFunction); 1190 func(element, "mousemove", Selection.Clear); 1191 } 1192}; 1193Selection.SetElementAsUnselectable = function(element, isWithChild, recursive) { 1194 if(element && element.nodeType == 1) { 1195 element.unselectable = "on"; 1196 if(Browser.NetscapeFamily) 1197 element.onmousedown = ASPx.FalseFunction; 1198 if(Browser.WebKitFamily) 1199 Evt.AttachEventToElement(element, "mousedown", Evt.PreventEventAndBubble);
1200 if(isWithChild === true){ 1201 for(var j = 0; j < element.childNodes.length; j ++) 1202 Selection.SetElementAsUnselectable(element.childNodes[j], (!!recursive ? true : false), (!!recursive)); 1203 } 1204 } 1205}; 1206Selection.AreEqual = function(selection1, selection2) { 1207 return selection1.startPos === selection2.startPos && selection1.endPos === selection2.endPos; 1208}; 1209ASPx.Selection = Selection; 1210var MouseScroller = { }; 1211MouseScroller.MinimumOffset = 10; 1212MouseScroller.Create = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) { 1213 var element = getElement(); 1214 if(!element) 1215 return; 1216 if(!element.dxMouseScroller) 1217 element.dxMouseScroller = new MouseScroller.Extender(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed); 1218 return element.dxMouseScroller; 1219}; 1220MouseScroller.Extender = function(getElement, getScrollXElement, getScrollYElement, needPreventScrolling, vertRecursive, onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) { 1221 this.getElement = getElement; 1222 this.getScrollXElement = getScrollXElement; 1223 this.getScrollYElement = getScrollYElement; 1224 this.needPreventScrolling = needPreventScrolling; 1225 this.vertRecursive = !!vertRecursive; 1226 this.createHandlers(onMouseDown || function() { }, onMouseMove || function() { }, onMouseUp || function() { }, onMouseUpMissed || function() { }); 1227 this.update(); 1228}; 1229MouseScroller.Extender.prototype = { 1230 update: function() { 1231 if(this.element) 1232 Evt.DetachEventFromElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler); 1233 this.element = this.getElement(); 1234 Evt.AttachEventToElement(this.element, ASPx.TouchUIHelper.touchMouseDownEventName, this.mouseDownHandler); 1235 Evt.AttachEventToElement(this.element, "click", this.mouseClickHandler); 1236 if(Browser.MSTouchUI && this.element.className.indexOf(ASPx.TouchUIHelper.msTouchDraggableClassName) < 0) 1237 this.element.className += " " + ASPx.TouchUIHelper.msTouchDraggableClassName; 1238 this.scrollXElement = this.getScrollXElement(); 1239 this.scrollYElement = this.getScrollYElement(); 1240 }, 1241 createHandlers: function(onMouseDown, onMouseMove, onMouseUp, onMouseUpMissed) { 1242 var mouseDownCounter = 0; 1243 this.onMouseDown = onMouseDown; 1244 this.onMouseMove = onMouseMove; 1245 this.onMouseUp = onMouseUp; 1246 this.mouseDownHandler = function(e) { 1247 if(mouseDownCounter++ > 0) { 1248 this.finishScrolling(); 1249 onMouseUpMissed(); 1250 } 1251 var eventSource = Evt.GetEventSource(e); 1252 var requirePreventCustonScroll = ASPx.IsExists(ASPx.TouchUIHelper.RequirePreventCustomScroll) && ASPx.TouchUIHelper.RequirePreventCustomScroll(eventSource, this.element); 1253 this.requirePreventScroll = requirePreventCustonScroll || this.needPreventScrolling && this.needPreventScrolling(eventSource); 1254 if(this.requirePreventScroll) 1255 return; 1256 this.scrollableTreeLine = this.GetScrollableElements(); 1257 this.firstX = this.prevX = Evt.GetEventX(e); 1258 this.firstY = this.prevY = Evt.GetEventY(e); 1259 Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler); 1260 Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler); 1261 this.onMouseDown(e); 1262 }.aspxBind(this); 1263 this.mouseMoveHandler = function(e) { 1264 if(ASPx.TouchUIHelper.isGesture) 1265 return; 1266 var x = Evt.GetEventX(e); 1267 var y = Evt.GetEventY(e); 1268 var xDiff = this.prevX - x; 1269 var yDiff = this.prevY - y; 1270 if(this.vertRecursive) { 1271 var isTopDirection = yDiff < 0; 1272 this.scrollYElement = this.GetElementForVertScrolling(isTopDirection, this.prevIsTopDirection, this.scrollYElement); 1273 this.prevIsTopDirection = isTopDirection; 1274 } 1275 if(this.scrollXElement && xDiff != 0) 1276 this.scrollXElement.scrollLeft += xDiff; 1277 if(this.scrollYElement && yDiff != 0) { 1278 this.scrollYElement.scrollTop += yDiff; 1279 var isOuterScrollableElement = this.scrollableTreeLine[this.scrollableTreeLine.length - 1] == this.scrollYElement; 1280 if(isOuterScrollableElement) 1281 y += yDiff; 1282 } 1283 this.prevX = x; 1284 this.prevY = y; 1285 Evt.PreventEvent(e); 1286 this.onMouseMove(e); 1287 }.aspxBind(this); 1288 this.mouseUpHandler = function(e) { 1289 this.finishScrolling(); 1290 this.onMouseUp(e); 1291 }.aspxBind(this); 1292 this.mouseClickHandler = function(e){
1293 if(this.requirePreventScroll || (ASPx.IsExists(e.isTrusted) && !e.isTrusted)) 1294 return; 1295 var xDiff = this.firstX - Evt.GetEventX(e); 1296 var yDiff = this.firstY - Evt.GetEventY(e); 1297 if(xDiff > MouseScroller.MinimumOffset || yDiff > MouseScroller.MinimumOffset) 1298 return Evt.PreventEventAndBubble(e); 1299 }.aspxBind(this); 1300 this.finishScrolling = function() { 1301 Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseMoveEventName, this.mouseMoveHandler); 1302 Evt.DetachEventFromDocument(ASPx.TouchUIHelper.touchMouseUpEventName, this.mouseUpHandler); 1303 this.scrollableTreeLine = []; 1304 this.prevIsTopDirection = null; 1305 mouseDownCounter--; 1306 }; 1307 }, 1308 GetScrollableElements: function() { 1309 if(!this.vertRecursive) return [ ]; 1310 var isHtmlScrollableElement = !ASPx.Browser.IsQuirksMode && !ASPx.Browser.Safari; 1311 var outerScrollableElementTag = isHtmlScrollableElement ? "HTML" : "BODY"; 1312 return ASPx.GetElementTreeLine(this.element, null, function(el) { return el == document; }) 1313 .filter(function(el) { 1314 var tagName = el.tagName; 1315 if(isHtmlScrollableElement && tagName == "BODY") 1316 return false; 1317 return ASPx.IsScrollableElement(el, false, true) || tagName == outerScrollableElementTag || el.dxScrollable; 1318 }.bind(this)); 1319 }, 1320 GetElementForVertScrolling: function(currentIsTop, prevIsTop, prevElement) { 1321 if(prevElement && currentIsTop === prevIsTop && this.GetVertScrollExcess(prevElement, currentIsTop) > 0) 1322 return prevElement; 1323 for(var i = 0; i < this.scrollableTreeLine.length; i++) { 1324 var element = this.scrollableTreeLine[i]; 1325 var excess = this.GetVertScrollExcess(element, currentIsTop); 1326 if(excess > 0) 1327 return element; 1328 } 1329 return null; 1330 }, 1331 GetVertScrollExcess: function(element, isTop) { 1332 if(isTop) 1333 return element.scrollTop; 1334 var isDocument = element.tagName == "HTML" || ASPx.Browser.Safari && !ASPx.Browser.IsQuirksMode && element.tagName == "BODY"; 1335 var clientHeight = isDocument ? ASPx.GetDocumentClientHeight() : element.clientHeight; 1336 return element.scrollHeight - clientHeight - element.scrollTop; 1337 } 1338}; 1339ASPx.MouseScroller = MouseScroller; 1340var Evt = { }; 1341Evt.GetEvent = function(evt){ 1342 return evt; 1343}; 1344Evt.IsEventPrevented = function(evt) { 1345 return evt.defaultPrevented || evt.returnValue === false; 1346}; 1347Evt.PreventEvent = function(evt){ 1348 if(evt.preventDefault) { 1349 if(evt.cancelable) 1350 evt.preventDefault(); 1351 } 1352 else 1353 evt.returnValue = false; 1354 return false; 1355}; 1356Evt.PreventEventAndBubble = function(evt){ 1357 Evt.PreventEvent(evt); 1358 if(evt.stopPropagation) 1359 evt.stopPropagation(); 1360 evt.cancelBubble = true; 1361 return false; 1362}; 1363Evt.CancelBubble = function(evt){ 1364 evt.stopPropagation(); 1365 return false; 1366}; 1367Evt.PreventImageDragging = function(image) { 1368 if(image) 1369 image.ondragstart = function() { return false; }; 1370}; 1371Evt.PreventDragStart = function(evt) { 1372 evt = Evt.GetEvent(evt); 1373 var element = Evt.GetEventSource(evt); 1374 if(element.releaseCapture) 1375 element.releaseCapture(); 1376 return false; 1377}; 1378Evt.PreventElementDrag = function(element) { 1379 Evt.AttachEventToElement(element, "mousedown", Evt.PreventEvent); 1380}; 1381Evt.PreventElementDragAndSelect = function(element, skipMouseMove, skipIESelect){ 1382 if(Browser.WebKitFamily) 1383 Evt.AttachEventToElement(element, "selectstart", Evt.PreventEventAndBubble); 1384}; 1385Evt.GetEventSource = function(evt){ 1386 if(!ASPx.IsExists(evt)) return null; 1387 return evt.srcElement ? evt.srcElement : evt.target; 1388}; 1389Evt.GetKeyCode = function(srcEvt) { 1390 return Browser.NetscapeFamily || Browser.Opera ? srcEvt.which : srcEvt.keyCode; 1391}; 1392function clientEventRequiresDocScrollCorrection() { 1393 var isSafariVerLess3 = Browser.Safari && Browser.Version < 3, 1394 isMacOSMobileVerLess51 = Browser.MacOSMobilePlatform && Browser.Version < 5.1; 1395 return Browser.AndroidDefaultBrowser || Browser.AndroidChromeBrowser || !(isSafariVerLess3 || isMacOSMobileVerLess51); 1396} 1397Evt.GetEventX = function(evt){ 1398 if(ASPx.TouchUIHelper.isTouchEvent(evt)) 1399 return ASPx.TouchUIHelper.getEventX(evt); 1400 return evt.clientX + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollLeft() : 0); 1401}; 1402Evt.GetEventY = function(evt){ 1403 if(ASPx.TouchUIHelper.isTouchEvent(evt)) 1404 return ASPx.TouchUIHelper.getEventY(evt); 1405 return evt.clientY + (clientEventRequiresDocScrollCorrection() ? ASPx.GetDocumentScrollTop() : 0 ); 1406};
1407Evt.IsLeftButtonPressed = function(evt) { 1408 if(ASPx.TouchUIHelper.isTouchEvent(evt)) 1409 return true; 1410 evt = Evt.GetEvent(evt); 1411 if(!evt) return false; 1412 if(Browser.WebKitFamily) { 1413 if(evt.type === "pointermove") 1414 return evt.buttons === 1; 1415 return evt.which == 1; 1416 } else if(Browser.NetscapeFamily || Browser.Edge) { 1417 if(evt.type === ASPx.TouchUIHelper.touchMouseMoveEventName) 1418 return evt.buttons === 1; 1419 return evt.which == 1; 1420 } else if(Browser.Opera) 1421 return evt.button == 0; 1422 return true; 1423}; 1424Evt.IsRightButtonPressed = function(evt){ 1425 evt = Evt.GetEvent(evt); 1426 if(!ASPx.IsExists(evt)) return false; 1427 if(Browser.IE || Browser.Edge) { 1428 if(evt.type === "pointermove") 1429 return evt.buttons === 2; 1430 return evt.button == 2; 1431 } 1432 else if(Browser.NetscapeFamily || Browser.WebKitFamily) 1433 return evt.which == 3; 1434 else if (Browser.Opera) 1435 return evt.button == 1; 1436 return true; 1437}; 1438Evt.GetWheelDelta = function(evt) { 1439 var ret; 1440 if(Browser.NetscapeFamily && Browser.MajorVersion < 17) 1441 ret = -evt.detail; 1442 else if(Browser.Safari) 1443 ret = evt.wheelDelta; 1444 else 1445 ret = -evt.deltaY; 1446 if(Browser.Opera && Browser.Version < 9) 1447 ret = -ret; 1448 return ret; 1449}; 1450Evt.IsWheelEventWithDirection = function(evt) { 1451 return ASPx.Data.ArrayContains(["wheel", "mousewheel"], evt.type); 1452}; 1453Evt.GetWheelDeltaX = function(evt) { 1454 if(evt.type === "wheel") 1455 return -evt.deltaX; 1456 if(evt.type === "mousewheel") 1457 return evt.wheelDeltaX; 1458}; 1459Evt.GetWheelDeltaY = function(evt) { 1460 if(evt.type === "wheel") 1461 return -evt.deltaY; 1462 if(evt.type === "mousewheel") 1463 return evt.wheelDeltaY; 1464}; 1465Evt.IsPassiveListenersSupported = function() { 1466 if(Browser.Chrome && Browser.MajorVersion > 69 || Browser.Edge && Browser.MajorVersion > 15 || Browser.Firefox && Browser.MajorVersion > 62) 1467 return true; 1468 if(Evt.isPassiveListenersSupported === undefined) { 1469 Evt.isPassiveListenersSupported = false; 1470 try { 1471 var options = Object.defineProperty({}, "passive", { get: function() { Evt.isPassiveListenersSupported = true; } }); 1472 window.addEventListener("test", options, options); 1473 window.removeEventListener("test", options, options); 1474 } 1475 catch(err) { Evt.isPassiveListenersSupported = false; } 1476 } 1477 return !!Evt.isPassiveListenersSupported; 1478}; 1479Evt.AttachEventToElement = function(element, eventName, func, onlyBubbling, passive) { 1480 if(element.addEventListener) 1481 element.addEventListener(eventName, func, Evt.IsPassiveListenersSupported() ? { capture: !onlyBubbling, passive: !!passive } : !onlyBubbling); 1482 else 1483 element.attachEvent("on" + eventName, func); 1484}; 1485Evt.DetachEventFromElement = function(element, eventName, func, onlyBubbling) { 1486 if(element.removeEventListener) 1487 element.removeEventListener(eventName, func, Evt.IsPassiveListenersSupported() ? { capture: !onlyBubbling } : !onlyBubbling); 1488 else 1489 element.detachEvent("on" + eventName, func); 1490}; 1491Evt.AttachEventToDocument = function(eventName, func) { 1492 var attachingAllowed = ASPx.TouchUIHelper.onEventAttachingToDocument(eventName, func); 1493 if(attachingAllowed) 1494 Evt.AttachEventToDocumentCore(eventName, func); 1495}; 1496Evt.AttachEventToDocumentCore = function(eventName, func) { 1497 Evt.AttachEventToElement(document, eventName, func); 1498}; 1499Evt.DetachEventFromDocument = function(eventName, func) { 1500 Evt.DetachEventFromDocumentCore(eventName, func); 1501 ASPx.TouchUIHelper.onEventDettachedFromDocument(eventName, func); 1502}; 1503Evt.DetachEventFromDocumentCore = function(eventName, func){ 1504 Evt.DetachEventFromElement(document, eventName, func); 1505}; 1506Evt.GetMouseWheelEventName = function() { 1507 if(Browser.Safari) 1508 return "mousewheel"; 1509 if(Browser.NetscapeFamily && Browser.MajorVersion < 17) 1510 return "DOMMouseScroll"; 1511 return "wheel"; 1512}; 1513Evt.AttachMouseEnterToElement = function (element, onMouseOverHandler, onMouseOutHandler) { 1514 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOverEventName : "mouseover", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); }); 1515 Evt.AttachEventToElement(element, ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerOutEventName : "mouseout", function (evt) { mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler); }); 1516}; 1517Evt.GetEventRelatedTarget = function(evt, isMouseOverEvent) { 1518 return evt.relatedTarget || (isMouseOverEvent ? evt.srcElement : evt.toElement); 1519}; 1520function mouseEnterHandler(evt, element, onMouseOverHandler, onMouseOutHandler) { 1521 var isMouseOverExecuted = !!element.dxMouseOverExecuted; 1522 var isMouseOverEvent = (evt.type == "mouseover" || evt.type == ASPx.TouchUIHelper.pointerOverEventName); 1523 if(isMouseOverEvent && isMouseOverExecuted || !isMouseOverEvent && !isMouseOverExecuted) 1524 return; 1525 var source = Evt.GetEventRelatedTarget(evt, isMouseOverEvent); 1526 if(!ASPx.GetIsParent(element, source)) { 1527 element.dxMouseOverExecuted = isMouseOverEvent; 1528 if(isMouseOverEvent) 1529 onMouseOverHandler(element); 1530 else 1531 onMouseOutHandler(element); 1532 } 1533 else if(isMouseOverEvent && !isMouseOverExecuted) { 1534 element.dxMouseOverExecuted = true; 1535 onMouseOverHandler(element); 1536 } 1537} 1538Evt.DispatchEvent = function(target, eventName, canBubble, cancellable) { 1539 var event = document.createEvent("Event"); 1540 event.initEvent(eventName, canBubble || false, cancellable || false); 1541 target.dispatchEvent(event); 1542}; 1543Evt.EmulateDocumentOnMouseDown = function(evt) { 1544 Evt.EmulateOnMouseDown(document, evt); 1545};
1546Evt.EmulateOnMouseDown = function(element, evt) { 1547 if(!Browser.WebKitFamily){ 1548 var emulatedEvt = document.createEvent("MouseEvents"); 1549 emulatedEvt.initMouseEvent("mousedown", true, true, window, 0, evt.screenX, evt.screenY, 1550 evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null); 1551 element.dispatchEvent(emulatedEvt); 1552 } 1553}; 1554Evt.EmulateOnMouseEvent = function (type, element, evt) { 1555 evt.type = type; 1556 var emulatedEvt = document.createEvent("MouseEvents"); 1557 emulatedEvt.initMouseEvent(type, true, true, window, 0, evt.screenX, evt.screenY, 1558 evt.clientX, evt.clientY, evt.ctrlKey, evt.altKey, evt.shiftKey, false, 0, null); 1559 emulatedEvt.target = element; 1560 element.dispatchEvent(emulatedEvt); 1561}; 1562Evt.EmulateMouseClick = function (element, evt) { 1563 var x = ASPx.GetElementOffsetWidth(element) / 2; 1564 var y = ASPx.GetElementOffsetHeight(element) / 2; 1565 if (!evt) 1566 evt = { 1567 bubbles: true, 1568 cancelable: true, 1569 view: window, 1570 detail: 1, 1571 screenX: 0, 1572 screenY: 0, 1573 clientX: x, 1574 clientY: y, 1575 ctrlKey: false, 1576 altKey: false, 1577 shiftKey: false, 1578 metaKey: false, 1579 button: 0, 1580 relatedTarget: null 1581 }; 1582 Evt.EmulateOnMouseEvent("mousedown", element, evt); 1583 Evt.EmulateOnMouseEvent("mouseup", element, evt); 1584 Evt.EmulateOnMouseEvent("click", element, evt); 1585}; 1586Evt.DoElementClick = function(element) { 1587 try{ 1588 element.click(); 1589 } 1590 catch(e){ 1591 } 1592}; 1593Evt.IsActionKeyPressed = function(evt) { 1594 return evt.keyCode === ASPx.Key.Space || 1595 evt.keyCode === ASPx.Key.Enter || 1596 (evt.keyCode === ASPx.Key.Down && evt.altKey); 1597}; 1598Evt.InvokeMouseClickByKeyDown = function(evt, handler) { 1599 if(Evt.IsActionKeyPressed(evt)) { 1600 ASPx.Evt.PreventEvent(evt); 1601 if(!handler) 1602 ASPx.Evt.GetEventSource(evt).onclick(); 1603 else 1604 handler(evt); 1605 } 1606}; 1607Evt.AttachContextMenuToElement = function (element, handler, onlyBubbling) { 1608 if (ASPx.TouchUIHelper.useLongTapHelper()) 1609 element.detachContextMenuEventHandler = ASPx.TouchUIHelper.attachLongTapHandler(element, handler, onlyBubbling); 1610 else 1611 Evt.AttachEventToElement(element, "contextmenu", handler, onlyBubbling); 1612}; 1613Evt.DetachContextMenuFromElement = function (element, handler) { 1614 if (element.detachContextMenuEventHandler) 1615 element.detachContextMenuEventHandler(); 1616 else 1617 Evt.DetachEventFromElement(element, "contextmenu", handler); 1618}; 1619Evt.PreventContextMenuOnElement = function(element) { 1620 Evt.AttachContextMenuToElement(element, function(evt) { 1621 Evt.PreventEvent(evt); 1622 }); 1623}; 1624ASPx.Evt = Evt; 1625var Attr = { }; 1626Attr.GetAttribute = function(obj, attrName){ 1627 if(obj.getAttribute) 1628 return obj.getAttribute(attrName); 1629 else if(obj.getPropertyValue) { 1630 if(Browser.Firefox) { 1631 try { 1632 return obj.getPropertyValue(attrName); 1633 } catch(e) { 1634 return obj[attrName]; 1635 } 1636 } 1637 return obj.getPropertyValue(attrName); 1638 } 1639 return null; 1640}; 1641Attr.SetAttribute = function(obj, attrName, value){ 1642 if(obj.setAttribute) 1643 obj.setAttribute(attrName, value); 1644 else if(obj.setProperty) 1645 obj.setProperty(attrName, value, ""); 1646}; 1647Attr.ToggleAttribute = function(obj, attrName, value, condition) { 1648 if(condition) 1649 Attr.SetAttribute(obj, attrName, value); 1650 else 1651 Attr.RemoveAttribute(obj, attrName); 1652}; 1653Attr.RemoveAttribute = function(obj, attrName){ 1654 if(obj.removeAttribute) 1655 obj.removeAttribute(attrName); 1656 else if(obj.removeProperty) 1657 obj.removeProperty(attrName); 1658}; 1659Attr.IsExistsAttribute = function(obj, attrName){ 1660 var value = Attr.GetAttribute(obj, attrName); 1661 return (value != null) && (value !== ""); 1662}; 1663Attr.SetOrRemoveAttribute = function(obj, attrName, value) { 1664 if(!value) 1665 Attr.RemoveAttribute(obj, attrName); 1666 else 1667 Attr.SetAttribute(obj, attrName, value); 1668}; 1669Attr.SaveAttribute = function(obj, attrName, savedObj, savedAttrName){ 1670 if(!Attr.IsExistsAttribute(savedObj, savedAttrName)){ 1671 var oldValue = Attr.IsExistsAttribute(obj, attrName) ? Attr.GetAttribute(obj, attrName) : ASPx.EmptyObject; 1672 Attr.SetAttribute(savedObj, savedAttrName, oldValue); 1673 } 1674}; 1675Attr.SaveStyleAttribute = function(obj, attrName){ 1676 Attr.SaveAttribute(obj.style, attrName, obj, "saved" + attrName); 1677}; 1678Attr.ChangeAttributeExtended = function(obj, attrName, savedObj, savedAttrName, newValue){ 1679 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName); 1680 Attr.SetAttribute(obj, attrName, newValue); 1681}; 1682Attr.ChangeAttribute = function(obj, attrName, newValue){ 1683 Attr.ChangeAttributeExtended(obj, attrName, obj, "saved" + attrName, newValue); 1684}; 1685Attr.ChangeStyleAttribute = function(obj, attrName, newValue){ 1686 Attr.ChangeAttributeExtended(obj.style, attrName, obj, "saved" + attrName, newValue); 1687}; 1688Attr.ResetAttributeExtended = function(obj, attrName, savedObj, savedAttrName){ 1689 Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName); 1690 Attr.SetAttribute(obj, attrName, ""); 1691 Attr.RemoveAttribute(obj, attrName); 1692}; 1693Attr.ResetAttribute = function(obj, attrName){ 1694 Attr.ResetAttributeExtended(obj, attrName, obj, "saved" + attrName); 1695}; 1696Attr.ResetStyleAttribute = function(obj, attrName){ 1697 Attr.ResetAttributeExtended(obj.style, attrName, obj, "saved" + attrName); 1698}; 1699Attr.RestoreAttributeExtended = function(obj, attrName, savedObj, savedAttrName){ 1700 if(Attr.IsExistsAttribute(savedObj, savedAttrName)){ 1701 var oldValue = Attr.GetAttribute(savedObj, savedAttrName); 1702 if(oldValue != ASPx.EmptyObject) 1703 Attr.SetAttribute(obj, attrName, oldValue); 1704 else 1705 Attr.RemoveAttribute(obj, attrName); 1706 Attr.RemoveAttribute(savedObj, savedAttrName); 1707 return true; 1708 } 1709 return false; 1710}; 1711Attr.RestoreAttribute = function(obj, attrName){ 1712 return Attr.RestoreAttributeExtended(obj, attrName, obj, "saved" + attrName); 1713}; 1714Attr.RestoreStyleAttribute = function(obj, attrName){ 1715 return Attr.RestoreAttributeExtended(obj.style, attrName, obj, "saved" + attrName); 1716}; 1717Attr.CopyAllAttributes = function(sourceElem, destElement) { 1718 var attrs = sourceElem.attributes; 1719 for(var n = 0; n < attrs.length; n++) { 1720 var attr = attrs[n]; 1721 if(attr.specified) { 1722 var attrName = attr.nodeName; 1723 var attrValue = sourceElem.getAttribute(attrName, 2); 1724 if(attrValue == null) 1725 attrValue = attr.nodeValue; 1726 destElement.setAttribute(attrName, attrValue, 0); 1727 } 1728 } 1729 if(sourceElem.style.cssText !== '') 1730 destElement.style.cssText = sourceElem.style.cssText; 1731}; 1732Attr.RemoveAllAttributes = function(element, excludedAttributes) { 1733 var excludedAttributesHashTable = {}; 1734 if(excludedAttributes) 1735 excludedAttributesHashTable = Data.CreateHashTableFromArray(excludedAttributes); 1736 if(element.attributes) { 1737 var attrArray = element.attributes; 1738 for(var i = 0; i < attrArray.length; i++) { 1739 var attrName = attrArray[i].name; 1740 if(!ASPx.IsExists(excludedAttributesHashTable[attrName.toLowerCase()])) { 1741 try { 1742 attrArray.removeNamedItem(attrName); 1743 } catch (e) { } 1744 } 1745 } 1746 } 1747}; 1748Attr.RemoveStyleAttribute = function(element, attrName) { 1749 if(element.style) { 1750 if(Browser.Firefox && element.style[attrName]) 1751 element.style[attrName] = ""; 1752 if(element.style.removeAttribute && element.style.removeAttribute != "") 1753 element.style.removeAttribute(attrName); 1754 else if(element.style.removeProperty && element.style.removeProperty != "") 1755 element.style.removeProperty(attrName); 1756 } 1757}; 1758Attr.RemoveAllStyles = function(element) { 1759 if(element.style) { 1760 for(var key in element.style) 1761 Attr.RemoveStyleAttribute(element, key); 1762 Attr.RemoveAttribute(element, "style"); 1763 } 1764}; 1765Attr.GetTabIndexAttributeName = function(){ 1766 return "tabindex"; 1767}; 1768Attr.ChangeTabIndexAttribute = function(element){ 1769 var attribute = Attr.GetTabIndexAttributeName(); 1770 if(Attr.GetAttribute(element, attribute) != -1) 1771 Attr.ChangeAttribute(element, attribute, -1); 1772}; 1773Attr.SaveTabIndexAttributeAndReset = function(element) { 1774 var attribute = Attr.GetTabIndexAttributeName(); 1775 Attr.SaveAttribute(element, attribute, element, "saved" + attribute); 1776 Attr.SetAttribute(element, attribute, -1); 1777}; 1778Attr.RestoreTabIndexAttribute = function(element){ 1779 var attribute = Attr.GetTabIndexAttributeName(); 1780 if(Attr.IsExistsAttribute(element, attribute)) { 1781 if(Attr.GetAttribute(element, attribute) == -1) { 1782 if(Attr.IsExistsAttribute(element, "saved" + attribute)){ 1783 var oldValue = Attr.GetAttribute(element, "saved" + attribute); 1784 if(oldValue != ASPx.EmptyObject) 1785 Attr.SetAttribute(element, attribute, oldValue); 1786 else { 1787 if(Browser.WebKitFamily) 1788 Attr.SetAttribute(element, attribute, 0); 1789 Attr.RemoveAttribute(element, attribute); 1790 } 1791 Attr.RemoveAttribute(element, "saved" + attribute); 1792 } 1793 } 1794 } 1795}; 1796Attr.ChangeAttributesMethod = function(enabled){ 1797 return enabled ? Attr.RestoreAttribute : Attr.ResetAttribute; 1798}; 1799Attr.InitiallyChangeAttributesMethod = function(enabled){ 1800 return enabled ? Attr.ChangeAttribute : Attr.ResetAttribute; 1801}; 1802Attr.ChangeStyleAttributesMethod = function(enabled){ 1803 return enabled ? Attr.RestoreStyleAttribute : Attr.ResetStyleAttribute; 1804}; 1805Attr.InitiallyChangeStyleAttributesMethod = function(enabled){ 1806 return enabled ? Attr.ChangeStyleAttribute : Attr.ResetStyleAttribute; 1807}; 1808Attr.ChangeEventsMethod = function(enabled){ 1809 return enabled ? Evt.AttachEventToElement : Evt.DetachEventFromElement; 1810}; 1811Attr.ChangeDocumentEventsMethod = function(enabled){ 1812 return enabled ? Evt.AttachEventToDocument : Evt.DetachEventFromDocument; 1813}; 1814Attr.ChangeCellSpanCount = function(cell, value, isColumnSpan) { 1815 if(!cell) return; 1816 var propertyKey = isColumnSpan ? "colSpan" : "rowSpan"; 1817 var prevValue = cell[propertyKey]; 1818 if(value > 1) 1819 cell[propertyKey] = value; 1820 else if(prevValue !== 1) 1821 Attr.RemoveAttribute(cell, propertyKey); 1822}; 1823Attr.AppendScriptType = function(script) { 1824 if(!isHtml5Mode()) 1825 script.type = "text/javascript"; 1826}; 1827Attr.AppendStyleType = function(style) { 1828 if(!isHtml5Mode()) 1829 style.type = "text/css"; 1830}; 1831function isHtml5Mode() { 1832 return ASPx.DoctypeMode === "Html5"; 1833} 1834ASPx.Attr = Attr; 1835var Aria = { 1836 atomic: "aria-atomic", 1837 checked: "aria-checked", 1838 descendant: "aria-activedescendant", 1839 described: "aria-describedby", 1840 disabled: "aria-disabled", 1841 expanded: "aria-expanded", 1842 haspopup: "aria-haspopup", 1843 invalid: "aria-invalid", 1844 label: "aria-label", 1845 labelled: "aria-labelledby", 1846 level: "aria-level", 1847 owns: "aria-owns", 1848 posinset: "aria-posinset", 1849 role: "role", 1850 selected: "aria-selected", 1851 setsize: "aria-setsize", 1852 valuemax: "aria-valuemax", 1853 valuemin: "aria-valuemin", 1854 valuenow: "aria-valuenow" 1855}; 1856Aria.SetOrRemoveDescendant = function(obj, value) { 1857 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.descendant, value); 1858}; 1859Aria.SetOrRemoveLabel = function(obj, value) { 1860 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.label, value); 1861}; 1862Aria.SetOrRemoveDisabled = function(obj, value) { 1863 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.disabled, value); 1864}; 1865Aria.AppendLabel = function(obj, value, checkExists) { 1866 var currentValue = ASPx.Attr.GetAttribute(obj, Aria.label) || ""; 1867 var resultParts = [ ]; 1868 if(currentValue) 1869 resultParts.push(currentValue); 1870 var needAppendValue = value && (!checkExists || currentValue.indexOf(value) == -1); 1871 if(needAppendValue) 1872 resultParts.push(value); 1873 ASPx.Attr.SetAttribute(obj, Aria.label, resultParts.join(" ")); 1874}; 1875Aria.SetOrRemoveLabelled = function(obj, value) { 1876 ASPx.Attr.SetOrRemoveAttribute(obj, Aria.labelled, value); 1877}; 1878Aria.SetApplicationRole = function(obj) { 1879 ASPx.Attr.SetAttribute(obj, Aria.role, "application"); 1880}; 1881Aria.SetSilence = function(obj) { 1882 ASPx.Attr.SetAttribute(obj, Aria.label, ";"); 1883};
1884Aria.SetExpanded = function(obj, expanded) { 1885 if(!obj || !ASPx.Attr.GetAttribute(obj, Aria.expanded)) return; 1886 Aria.SetBoolAttribute(obj, Aria.expanded, expanded); 1887}; 1888Aria.SetAtomic = function(obj, value) { 1889 Aria.SetBoolAttribute(obj, Aria.atomic, value); 1890}; 1891Aria.SetBoolAttribute = function(obj, attribute, value) { 1892 if(value) 1893 ASPx.Attr.SetAttribute(obj, attribute, true); 1894 else 1895 ASPx.Attr.SetAttribute(obj, attribute, false); 1896}; 1897ASPx.Attr.Aria = Aria; 1898var Color = { }; 1899function _aspxToHex(d) { 1900 return (d < 16) ? ("0" + d.toString(16)) : d.toString(16); 1901} 1902Color.RGBRegexp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/; 1903Color.RGBARegexp = /rgba?\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*,?\s*([0-9]*\.?[0-9]*)\s*\)/; 1904Color.ColorToHexadecimal = function(colorValue, isRGBA) { 1905 if(typeof(colorValue) == "number") { 1906 var r = colorValue & 0xFF; 1907 var g = (colorValue >> 8) & 0xFF; 1908 var b = (colorValue >> 16) & 0xFF; 1909 return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b); 1910 } 1911 if(colorValue && (colorValue.substr(0, 3).toLowerCase() == "rgb")) { 1912 var regResult = colorValue.toLowerCase().match(isRGBA ? Color.RGBARegexp : Color.RGBRegexp); 1913 if(regResult) { 1914 var r = parseInt(regResult[1]); 1915 var g = parseInt(regResult[2]); 1916 var b = parseInt(regResult[3]); 1917 if (isRGBA) 1918 return { r: r, g: g, b: b, a: regResult[4] !== undefined ? parseFloat(regResult[4]) : 1 }; 1919 return "#" + _aspxToHex(r) + _aspxToHex(g) + _aspxToHex(b); 1920 } 1921 return null; 1922 } 1923 if(colorValue && (colorValue.charAt(0) == "#")) 1924 return colorValue; 1925 return null; 1926}; 1927Color.Names = { 1928 AddColorNames: function(stringResourcesObj) { 1929 if(stringResourcesObj) { 1930 for(var key in stringResourcesObj) 1931 if(stringResourcesObj.hasOwnProperty(key)) 1932 this[key] = stringResourcesObj[key]; 1933 } 1934 } 1935}; 1936ASPx.Color = Color; 1937var Url = { }; 1938Url.Navigate = function(url, target) { 1939 var javascriptPrefix = "javascript:"; 1940 if(!url || url === "") 1941 return; 1942 else if(url.indexOf(javascriptPrefix) != -1) 1943 eval(url.substr(javascriptPrefix.length)); 1944 else { 1945 try { 1946 if(target != "") 1947 navigateTo(url, target); 1948 else 1949 location.href = url; 1950 } 1951 catch(e) { 1952 } 1953 } 1954}; 1955Url.NavigateByLink = function(linkElement) { 1956 Url.Navigate(Attr.GetAttribute(linkElement, "href"), linkElement.target); 1957}; 1958Url.GetAbsoluteUrl = function(url) { 1959 if(url) 1960 url = Url.getURLObject(url).href; 1961 return url; 1962}; 1963Url.Redirect = function(url) { 1964 window.location.href = url; 1965}; 1966var absolutePathPrefixes = 1967 [ "about:", "file:///", "ftp://", "gopher://", "http://", "https://", "javascript:", "mailto:", "news:", "res://", "telnet://", "view-source:" ]; 1968Url.isAbsoluteUrl = function(url) { 1969 if (url) { 1970 for (var i = 0; i < absolutePathPrefixes.length; i++) { 1971 if(url.indexOf(absolutePathPrefixes[i]) == 0) 1972 return true; 1973 } 1974 } 1975 return false; 1976}; 1977Url.getURLObject = function(url) { 1978 var link = document.createElement('A'); 1979 link.href = url || ""; 1980 return { 1981 href: link.href, 1982 protocol: link.protocol, 1983 host: link.host, 1984 port: link.port, 1985 pathname: link.pathname, 1986 search: link.search, 1987 hash: link.hash 1988 }; 1989}; 1990Url.getRootRelativeUrl = function(url) { 1991 return getRelativeUrl(url, !Url.isRootRelativeUrl(url), true); 1992}; 1993Url.getPathRelativeUrl = function(url) { 1994 return getRelativeUrl(url, !Url.isPathRelativeUrl(url), false); 1995}; 1996function getRelativeUrl(url, isValid, isRootRelative) { 1997 if(url && !(/data:([^;]+\/?[^;]*)(;charset=[^;]*)?(;base64,)/.test(url)) && isValid) { 1998 var urlObject = Url.getURLObject(url); 1999 var baseUrlObject = Url.getURLObject(); 2000 if(!Url.isAbsoluteUrl(url) || urlObject.host === baseUrlObject.host && urlObject.protocol === baseUrlObject.protocol) { 2001 url = urlObject.pathname; 2002 if(!isRootRelative) 2003 url = getPathRelativeUrl(baseUrlObject.pathname, url); 2004 url = url + urlObject.search + urlObject.hash; 2005 } 2006 } 2007 return url; 2008} 2009function getPathRelativeUrl(baseUrl, url) { 2010 var requestSegments = getSegments(baseUrl, false); 2011 var urlSegments = getSegments(url, true); 2012 return buildPathRelativeUrl(requestSegments, urlSegments, 0, 0, ""); 2013} 2014function getSegments(url, addTail) { 2015 var segments = []; 2016 var startIndex = 0; 2017 var endIndex = -1; 2018 while ((endIndex = url.indexOf("/", startIndex)) != -1) { 2019 segments.push(url.substring(startIndex, ++endIndex)); 2020 startIndex = endIndex; 2021 } 2022 if(addTail && startIndex < url.length) 2023 segments.push(url.substring(startIndex, url.length)); 2024 return segments; 2025} 2026function buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex, buffer) { 2027 if(urlIndex >= urlSegments.length) 2028 return buffer; 2029 if(reqIndex >= requestSegments.length) 2030 return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex, urlIndex + 1, buffer + urlSegments[urlIndex]); 2031 if(requestSegments[reqIndex] === urlSegments[urlIndex] && urlIndex === reqIndex) 2032 return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex + 1, buffer); 2033 return buildPathRelativeUrl(requestSegments, urlSegments, reqIndex + 1, urlIndex, buffer + "../"); 2034} 2035Url.isPathRelativeUrl = function(url) { 2036 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") != 0; 2037}; 2038Url.isRootRelativeUrl = function(url) { 2039 return !!url && !Url.isAbsoluteUrl(url) && url.indexOf("/") == 0 && url.indexOf("//") != 0; 2040}; 2041function navigateTo(url, target) { 2042 var lowerCaseTarget = target.toLowerCase(); 2043 if("_top" == lowerCaseTarget) 2044 top.location.href = url; 2045 else if("_self" == lowerCaseTarget) 2046 location.href = url; 2047 else if("_search" == lowerCaseTarget) 2048 openInNewWindow(url); 2049 else if("_media" == lowerCaseTarget) 2050 openInNewWindow(url); 2051 else if("_parent" == lowerCaseTarget) 2052 window.parent.location.href = url; 2053 else if("_blank" == lowerCaseTarget) 2054 openInNewWindow(url); 2055 else { 2056 var frame = getFrame(top.frames, target); 2057 if(frame != null) 2058 frame.location.href = url; 2059 else 2060 openInNewWindow(url); 2061 } 2062} 2063function openInNewWindow(url) { 2064 if(ASPx.Browser.Safari) 2065 openInNewWindowViaIframe(url); 2066 else { 2067 var newWindow = window.open(); 2068 newWindow.opener = null; 2069 newWindow.location = url; 2070 } 2071} 2072function openInNewWindowViaIframe(url) { 2073 var iframe = document.createElement('iframe');
2074 iframe.style.display = 'none'; 2075 document.body.appendChild(iframe); 2076 var iframeDoc = iframe.contentDocument || iframe.contentWindow.document; 2077 var openArgs = '"' + url + '"'; 2078 var script = iframeDoc.createElement('script'); 2079 script.type = 'text/javascript'; 2080 script.text = 'window.parent = null; ' + 2081 'window.top = null;' + 2082 'window.frameElement = null;' + 2083 'var child = window.open(' + openArgs + ');' + 2084 'child.opener = null'; 2085 iframeDoc.body.appendChild(script); 2086 document.body.removeChild(iframe); 2087} 2088ASPx.Url = Url; 2089var Json = { }; 2090function isValid(JsonString) { 2091 return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(JsonString.replace(/"(\\.|[^"\\])*"/g, ''))); 2092} 2093Json.Eval = function(jsonString, controlName) { 2094 if(isValid(jsonString)) { 2095 return eval("(" + jsonString + ")"); 2096 } else { 2097 throw new Error(controlName + " received incorrect JSON-data: " + jsonString); 2098 } 2099}; 2100Json.ToJson = function(param, skipEncodeHtml){ 2101 var paramType = typeof(param); 2102 if((paramType == "undefined") || (param == null)) 2103 return null; 2104 if((paramType == "object") && (typeof(param.__toJson) == "function")) 2105 return param.__toJson(); 2106 if((paramType == "number") || (paramType == "boolean")) 2107 return param; 2108 if(param.constructor == Date) 2109 return dateToJson(param); 2110 if(paramType == "string") { 2111 var result = param.replace(/\\/g, "\\\\"); 2112 result = result.replace(/"/g, "\\\""); 2113 result = result.replace(/\n/g, "\\n"); 2114 result = result.replace(/\r/g, "\\r"); 2115 if(!skipEncodeHtml) { 2116 result = result.replace(/</g, "\\u003c"); 2117 result = result.replace(/>/g, "\\u003e"); 2118 } 2119 return "\"" + result + "\""; 2120 } 2121 if(param.constructor == Array){ 2122 var values = []; 2123 for(var i = 0; i < param.length; i++) { 2124 var jsonValue = Json.ToJson(param[i], skipEncodeHtml); 2125 if(jsonValue === null) 2126 jsonValue = "null"; 2127 values.push(jsonValue); 2128 } 2129 return "[" + values.join(",") + "]"; 2130 } 2131 var exceptKeys = {}; 2132 if(ASPx.Ident.IsArray(param.__toJsonExceptKeys)) 2133 exceptKeys = Data.CreateHashTableFromArray(param.__toJsonExceptKeys); 2134 exceptKeys["__toJsonExceptKeys"] = 1; 2135 var values = []; 2136 for(var key in param) { 2137 if(param.hasOwnProperty(key)) { 2138 if(ASPx.IsFunction(param[key])) 2139 continue; 2140 if(exceptKeys[key] == 1) 2141 continue; 2142 values.push(Json.ToJson(key) + ":" + Json.ToJson(param[key], skipEncodeHtml)); 2143 } 2144 } 2145 return "{" + values.join(",") + "}"; 2146}; 2147function dateToJson(date) { 2148 var result = [ 2149 date.getFullYear(), 2150 date.getMonth(), 2151 date.getDate() 2152 ]; 2153 var time = { 2154 h: date.getHours(), 2155 m: date.getMinutes(), 2156 s: date.getSeconds(), 2157 ms: date.getMilliseconds() 2158 }; 2159 if(time.h || time.m || time.s || time.ms) 2160 result.push(time.h); 2161 if(time.m || time.s || time.ms) 2162 result.push(time.m); 2163 if(time.s || time.ms) 2164 result.push(time.s); 2165 if(time.ms) 2166 result.push(time.ms); 2167 return "new Date(" + result.join() + ")"; 2168} 2169ASPx.Json = Json; 2170ASPx.CreateClass = function(parentClass, properties) { 2171 if(arguments.length == 1) { 2172 properties = parentClass; 2173 parentClass = null; 2174 } 2175 var ret = function() { 2176 if(ret.preparing) 2177 return delete(ret.preparing); 2178 if(ret.constr) { 2179 this.constructor = ret; 2180 ret.constr.apply(this, arguments); 2181 } 2182 }; 2183 ret.prototype = {}; 2184 if(parentClass) { 2185 parentClass.preparing = true; 2186 for(var name in parentClass) { 2187 if(parentClass.hasOwnProperty(name) && name != 'constr' && ASPx.IsFunction(parentClass[name]) && !ret[name]) 2188 ret[name] = parentClass[name].aspxBind(parentClass); 2189 } 2190 ret.prototype = new parentClass; 2191 ret.prototype.constructor = parentClass; 2192 ret.constr = parentClass; 2193 } 2194 if(properties) { 2195 var constructorName = "constructor"; 2196 for(var name in properties) { 2197 if(!properties.hasOwnProperty(name)) 2198 continue; 2199 var getter = Object.getOwnPropertyDescriptor(properties, name).get; 2200 var setter = Object.getOwnPropertyDescriptor(properties, name).set; 2201 if(getter || setter) 2202 Object.defineProperty(ret.prototype, name, { 2203 set: setter, 2204 get: getter, 2205 enumerable: true, 2206 configurable: true 2207 });
2208 if(name != constructorName && !getter && !setter) 2209 ret.prototype[name] = properties[name]; 2210 } 2211 if(properties[constructorName] && properties[constructorName] != Object) 2212 ret.constr = properties[constructorName]; 2213 } 2214 return ret; 2215}; 2216var registeredMixins = {}; 2217ASPx.GetMixin = function (name, baseClass) { 2218 var mixinCache = baseClass._mixins || (baseClass._mixins = {}); 2219 var resultClass = mixinCache[name]; 2220 if (!resultClass) { 2221 var mixinCodeBuilder = registeredMixins[name]; 2222 if (!mixinCodeBuilder) 2223 throw new Error("mixin with the '" + name + "' is not registered"); 2224 var mixinCode = mixinCodeBuilder(baseClass); 2225 mixinCode.mixinName = name; 2226 resultClass = ASPx.CreateClass(baseClass, mixinCode); 2227 mixinCache[name] = resultClass; 2228 } 2229 return resultClass; 2230}; 2231ASPx.RegisterMixin = function() { 2232 var name = arguments.length == 1 ? "mixin_" + ASPx.CreateGuid() : arguments[0]; 2233 var mixinCodeBuilder = arguments[arguments.length - 1]; 2234 if (registeredMixins[name]) 2235 throw new Error("mixin with the '" + name + "' name is already defined"); 2236 registeredMixins[name] = mixinCodeBuilder; 2237 return function(baseClass) { return ASPx.GetMixin(name, baseClass); }; 2238}; 2239ASPx.FormatCallbackArg = function(prefix, arg) { 2240 if(prefix == null && arg == null) 2241 return ""; 2242 if(prefix == null) prefix = ""; 2243 if(arg == null) arg = ""; 2244 if(arg != null && !ASPx.IsExists(arg.length) && ASPx.IsExists(arg.value)) 2245 arg = arg.value; 2246 arg = arg.toString(); 2247 return [prefix, '|', arg.length, '|' , arg].join(''); 2248}; 2249ASPx.FormatCallbackArgs = function(callbackData) { 2250 var sb = [ ]; 2251 for(var i = 0; i < callbackData.length; i++) 2252 sb.push(ASPx.FormatCallbackArg(callbackData[i][0], callbackData[i][1])); 2253 return sb.join(""); 2254}; 2255ASPx.ParseShortcutString = function(shortcutString) { 2256 if(!shortcutString) 2257 return 0; 2258 var isCtrlKey = false; 2259 var isShiftKey = false; 2260 var isAltKey = false; 2261 var isMetaKey = false; 2262 var keyCode = null; 2263 var shcKeys = shortcutString.toString().split("+"); 2264 if(shcKeys.length > 0) { 2265 for(var i = 0; i < shcKeys.length; i++) { 2266 var key = Str.Trim(shcKeys[i].toUpperCase()); 2267 switch (key) { 2268 case "CONTROL": 2269 case "CONTROLKEY": 2270 case "CTRL": 2271 isCtrlKey = true; 2272 break; 2273 case "SHIFT": 2274 case "SHIFTKEY": 2275 isShiftKey = true; 2276 break; 2277 case "ALT": 2278 isAltKey = true; 2279 break; 2280 case "CMD": 2281 isMetaKey = true; 2282 break; 2283 case "F1": keyCode = ASPx.Key.F1; break; 2284 case "F2": keyCode = ASPx.Key.F2; break; 2285 case "F3": keyCode = ASPx.Key.F3; break; 2286 case "F4": keyCode = ASPx.Key.F4; break; 2287 case "F5": keyCode = ASPx.Key.F5; break; 2288 case "F6": keyCode = ASPx.Key.F6; break; 2289 case "F7": keyCode = ASPx.Key.F7; break; 2290 case "F8": keyCode = ASPx.Key.F8; break; 2291 case "F9": keyCode = ASPx.Key.F9; break; 2292 case "F10": keyCode = ASPx.Key.F10; break; 2293 case "F11": keyCode = ASPx.Key.F11; break; 2294 case "F12": keyCode = ASPx.Key.F12; break; 2295 case "RETURN": 2296 case "ENTER": keyCode = ASPx.Key.Enter; break; 2297 case "HOME": keyCode = ASPx.Key.Home; break; 2298 case "END": keyCode = ASPx.Key.End; break; 2299 case "LEFT": keyCode = ASPx.Key.Left; break; 2300 case "RIGHT": keyCode = ASPx.Key.Right; break; 2301 case "UP": keyCode = ASPx.Key.Up; break; 2302 case "DOWN": keyCode = ASPx.Key.Down; break; 2303 case "PAGEUP": keyCode = ASPx.Key.PageUp; break; 2304 case "PAGEDOWN": keyCode = ASPx.Key.PageDown; break; 2305 case "SPACE": keyCode = ASPx.Key.Space; break; 2306 case "TAB": keyCode = ASPx.Key.Tab; break; 2307 case "BACKSPACE": 2308 case "BACK": keyCode = ASPx.Key.Backspace; break; 2309 case "CONTEXT": keyCode = ASPx.Key.ContextMenu; break; 2310 case "ESCAPE": 2311 case "ESC": 2312 keyCode = ASPx.Key.Esc; 2313 break; 2314 case "DELETE": 2315 case "DEL": 2316 keyCode = ASPx.Key.Delete; 2317 break; 2318 case "INSERT": 2319 case "INS": 2320 keyCode = ASPx.Key.Insert; 2321 break; 2322 case "PLUS": 2323 keyCode = "+".charCodeAt(0); 2324 break; 2325 default: 2326 keyCode = key.charCodeAt(0); 2327 break; 2328 } 2329 } 2330 } else 2331 ASPx.ShowErrorAlert("Invalid shortcut"); 2332 return ASPx.GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey); 2333}; 2334ASPx.GetShortcutCode = function(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey) { 2335 var value = keyCode; 2336 value |= isCtrlKey ? ASPx.ModifierKey.Ctrl : 0; 2337 value |= isShiftKey ? ASPx.ModifierKey.Shift : 0; 2338 value |= isAltKey ? ASPx.ModifierKey.Alt : 0; 2339 value |= isMetaKey ? ASPx.ModifierKey.Meta : 0; 2340 return value; 2341}; 2342ASPx.GetShortcutCodeByEvent = function(evt) { 2343 return ASPx.GetShortcutCode(Evt.GetKeyCode(evt), evt.ctrlKey, evt.shiftKey, evt.altKey, ASPx.Browser.MacOSPlatform ? evt.metaKey : false); 2344};
2345ASPx.IsPasteShortcut = function(evt) { 2346 if(evt.type === "paste") 2347 return true; 2348 var keyCode = Evt.GetKeyCode(evt); 2349 if(Browser.NetscapeFamily && evt.which == 0) 2350 keyCode = evt.keyCode; 2351 return (evt.ctrlKey && (keyCode == 118 || (keyCode == 86))) || 2352 (evt.shiftKey && !evt.ctrlKey && !evt.altKey && 2353 (keyCode == ASPx.Key.Insert)) ; 2354}; 2355var NotPrintableKeyCodes = null; 2356ASPx.IsPrintableKey = function(keyCode) { 2357 if (!NotPrintableKeyCodes) 2358 NotPrintableKeyCodes = Object.keys(ASPx.Key).map(function(key) { return ASPx.Key[key]; }); 2359 return !ASPx.Data.ArrayContains(NotPrintableKeyCodes, keyCode); 2360}; 2361ASPx.SetFocus = function(element, selectAction) { 2362 function focusCore(element, selectAction){ 2363 try { 2364 element.focus(); 2365 if(selectAction) { 2366 var currentSelection = Selection.GetInfo(element); 2367 if(currentSelection.startPos == currentSelection.endPos) { 2368 switch(selectAction) { 2369 case "start": 2370 Selection.SetCaretPosition(element, 0); 2371 break; 2372 case "all": 2373 Selection.Set(element); 2374 break; 2375 } 2376 } 2377 } 2378 } catch (e) { 2379 } 2380 } 2381 if(ASPxClientUtils.iOSPlatform || ASPxClientUtils.androidPlatform) 2382 focusCore(element, selectAction); 2383 else { 2384 window.setTimeout(function() { 2385 focusCore(element, selectAction); 2386 }, ASPx.FOCUS_TIMEOUT); 2387 } 2388}; 2389ASPx.IsFocusableCore = function(element, skipContainerVisibilityCheck) { 2390 var current = element; 2391 while(current && current.nodeType == 1) { 2392 if(current == element || !skipContainerVisibilityCheck(current)) { 2393 var tagName = current.tagName.toUpperCase(); 2394 if(tagName == "BODY") 2395 return true; 2396 var disabledElementTags = ["INPUT", "BUTTON", "TEXTAREA", "SELECT", "OPTION"]; 2397 if(disabledElementTags.indexOf(tagName) !== -1 && current.disabled || !ASPx.GetElementDisplay(current) || !ASPx.GetElementVisibility(current)) 2398 return false; 2399 } 2400 current = current.parentNode; 2401 } 2402 return true; 2403}; 2404ASPx.IsFocusable = function(element) { 2405 return ASPx.IsFocusableCore(element, ASPx.FalseFunction); 2406}; 2407ASPx.RemoveFocus = function(parent) { 2408 var div = document.createElement('div'); 2409 div.tabIndex = "-1"; 2410 concealDivElement(div); 2411 parent.appendChild(div); 2412 if(ASPx.IsFocusable(div)) 2413 div.focus(); 2414 ASPx.RemoveElement(div); 2415}; 2416function concealDivElement(div){ 2417 div.style.position = "absolute"; 2418 div.style.left = 0; 2419 div.style.top = 0; 2420 if(ASPx.Browser.WebKitFamily) { 2421 div.style.opacity = 0; 2422 div.style.width = 1; 2423 div.style.height = 1; 2424 } else { 2425 div.style.border = 0; 2426 div.style.width = 0; 2427 div.style.height = 0; 2428 } 2429} 2430var ActionElementsCache = ASPx.CreateClass(null, { 2431 constructor: function() { 2432 this.usageCounter = 0; 2433 this.elements = [ ]; 2434 this.values = [ ]; 2435 }, 2436 IsActive: function() { return this.usageCounter > 0; }, 2437 BeginUsage: function() { 2438 this.usageCounter++; 2439 }, 2440 EndUsage: function() { 2441 this.usageCounter--; 2442 if(this.usageCounter === 0) 2443 this.Clear(); 2444 }, 2445 Add: function(element, value) { 2446 var index = this.elements.length; 2447 this.elements[index] = element; 2448 this.values[index] = value; 2449 }, 2450 Get: function(element) { 2451 var index = this.elements.indexOf(element); 2452 var hasValue = index > -1; 2453 var value = hasValue ? this.values[index] : undefined; 2454 return { hasValue: hasValue, value: value }; 2455 }, 2456 Clear: function() { 2457 this.elements = [ ]; 2458 this.values = [ ]; 2459 } 2460}); 2461ASPx.ActionElementsCache = new ActionElementsCache(); 2462ASPx.IsActionElement = function(element) { 2463 if(!ASPx.IsExistsElement(element)) 2464 return false; 2465 var useCache = ASPx.ActionElementsCache.IsActive(); 2466 if(useCache) { 2467 var cacheValue = ASPx.ActionElementsCache.Get(element); 2468 if(cacheValue.hasValue) 2469 return cacheValue.value; 2470 } 2471 var isActionElement = ASPx.IsActionElementCore(element); 2472 if(useCache) 2473 ASPx.ActionElementsCache.Add(element, isActionElement); 2474 return isActionElement; 2475}; 2476ASPx.IsActionElementCore = function(element) { 2477 var tabIndex = parseInt(ASPx.Attr.GetAttribute(element, ASPx.Attr.GetTabIndexAttributeName())); 2478 var hasTabIndex = !isNaN(tabIndex); 2479 var hasNonNegativeTabIndex = hasTabIndex && tabIndex > -1; 2480 var hasNegativeTabIndex = hasTabIndex && tabIndex < 0; 2481 var tagName = element.tagName; 2482 var focusableElementTags = ["BUTTON", "SELECT", "TEXTAREA", "OPTION", "IFRAME"]; 2483 var isFocusableCore = ASPx.IsFocusable(element); 2484 var isFocusableTag = focusableElementTags.indexOf(tagName) !== -1; 2485 var isFocusableLink = tagName === "A" && (!!element.href || hasNonNegativeTabIndex); 2486 var isFocusableInput = tagName === "INPUT" && element.type.toLowerCase() !== "hidden"; 2487 var isFocusableByTabIndex = tagName !== "INPUT" && hasNonNegativeTabIndex; 2488 var isEditableDiv = tagName == "DIV" && element.contentEditable === "true"; 2489 return isFocusableCore && !hasNegativeTabIndex && (isFocusableTag || isFocusableLink || isFocusableInput || isFocusableByTabIndex || isEditableDiv); 2490};
2491ASPx.GetCanBeActiveElementsInContainer = function(container) { 2492 var canBeActiveTags = ["INPUT", "A", "UL", "BUTTON", "TEXTAREA", "SELECT", "IFRAME"], 2493 canBeActiveElements = []; 2494 Data.ForEach(canBeActiveTags, function(tag) { 2495 var elements = container.getElementsByTagName(tag); 2496 canBeActiveElements = canBeActiveElements.concat([].slice.call(elements)); 2497 }); 2498 return canBeActiveElements; 2499}; 2500function isActionElementAllowedByPredicate(element, predicate) { 2501 var allowedByPredicate = !predicate || predicate(element); 2502 return allowedByPredicate && ASPx.IsActionElement(element); 2503} 2504ASPx.FindChildActionElements = function(container, predicate) { 2505 return ASPx.GetNodes(container, function(el) { 2506 return isActionElementAllowedByPredicate(el, predicate); 2507 }); 2508}; 2509ASPx.FindAllSortedActionElements = function(container, predicate) { 2510 var result = [ ]; 2511 if(!container || !container.getElementsByTagName) return result; 2512 var actionElements = ASPx.FindChildActionElements(container, predicate); 2513 var getTabOrderValue = function(el) { 2514 var tabIndex = parseInt(ASPx.Attr.GetAttribute(el, ASPx.Attr.GetTabIndexAttributeName())); 2515 return isNaN(tabIndex) ? 0 : tabIndex; 2516 }; 2517 var positiveTabIndexElements = actionElements.filter(function(x) { return getTabOrderValue(x) > 0; }); 2518 var nonPositiveTabIndexElements = actionElements.filter(function(x) { return getTabOrderValue(x) === 0; }); 2519 var sortedTabIndexElements = positiveTabIndexElements.sort(function(x, y) { return getTabOrderValue(x) - getTabOrderValue(y); }); 2520 result = sortedTabIndexElements.concat(nonPositiveTabIndexElements); 2521 return result; 2522}; 2523ASPx.FindFirstChildActionElement = function(container, predicate) { 2524 if(!container || isActionElementAllowedByPredicate(container, predicate)) 2525 return !container ? null : container; 2526 var sortedActionElements = ASPx.FindAllSortedActionElements(container, predicate); 2527 return sortedActionElements[0]; 2528}; 2529ASPx.FindLastChildActionElement = function(container, predicate) { 2530 if(!container) 2531 return null; 2532 var sortedActionElements = ASPx.FindAllSortedActionElements(container, predicate); 2533 var actionElement = sortedActionElements[sortedActionElements.length - 1]; 2534 if(!actionElement && isActionElementAllowedByPredicate(container, predicate)) 2535 actionElement = container; 2536 return actionElement; 2537}; 2538ASPx.GetParentClientControls = function(name) { 2539 var nameParts = name.split("_"); 2540 var result = [ ]; 2541 var controlCollection = ASPx.GetControlCollection(); 2542 for(var i = 1; i <= nameParts.length; i++) { 2543 var controlName = nameParts.slice(0, i).join("_"); 2544 var control = controlCollection.Get(controlName); 2545 if(control) 2546 result.push(control); 2547 } 2548 return result; 2549}; 2550ASPx.GetRootClientControl = function(childControlName) { 2551 var parentControls = ASPx.GetParentClientControls(childControlName); 2552 return parentControls[0]; 2553}; 2554ASPx.GetClientControlByElementID = function(elementID) { 2555 var parentControls = ASPx.GetParentClientControls(elementID); 2556 return parentControls[parentControls.length - 1]; 2557}; 2558ASPx.IsExists = function(obj){ 2559 return (typeof(obj) != "undefined") && (obj != null); 2560}; 2561ASPx.IsFunction = function(obj){ 2562 return typeof(obj) == "function"; 2563}; 2564ASPx.IsNumber = function(str) { 2565 return !isNaN(parseFloat(str)) && isFinite(str); 2566}; 2567ASPx.GetDefinedValue = function(value, defaultValue){ 2568 return (typeof(value) != "undefined") ? value : defaultValue; 2569}; 2570ASPx.CorrectJSFloatNumber = function(number) { 2571 var ret = 21; 2572 var numString = number.toPrecision(21); 2573 numString = numString.replace("-", ""); 2574 var integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[0]); 2575 if(integerDigitsCount < 0) 2576 integerDigitsCount = numString.indexOf(ASPx.PossibleNumberDecimalSeparators[1]); 2577 var floatDigitsCount = numString.length - integerDigitsCount - 1; 2578 if(floatDigitsCount < 10) 2579 return number; 2580 if(integerDigitsCount > 0) { 2581 ret = integerDigitsCount + 12; 2582 } 2583 var toPrecisionNumber = Math.min(ret, 21); 2584 var newValueString = number.toPrecision(toPrecisionNumber); 2585 return parseFloat(newValueString, 10); 2586}; 2587ASPx.CorrectRounding = function(number, step) { 2588 var regex = /[,|.](.*)/, 2589 isFloatValue = regex.test(number), 2590 isFloatStep = regex.test(step); 2591 if(isFloatValue || isFloatStep) { 2592 var valueAccuracy = (isFloatValue) ? regex.exec(number)[0].length - 1 : 0, 2593 stepAccuracy = (isFloatStep) ? regex.exec(step)[0].length - 1 : 0, 2594 accuracy = Math.max(valueAccuracy, stepAccuracy); 2595 var multiplier = Math.pow(10, accuracy); 2596 number = Math.round((number + step) * multiplier) / multiplier; 2597 return number; 2598 } 2599 return number + step; 2600};
2601ASPx.GetActiveElement = function() { 2602 try{ return document.activeElement; } catch(e) { return null; } 2603}; 2604var verticalScrollBarWidth; 2605ASPx.GetVerticalScrollBarWidth = function(nonZero) { 2606 if(typeof(verticalScrollBarWidth) === "undefined") { 2607 var container = document.createElement("DIV"); 2608 container.style.cssText = "position: absolute; top: 0px; left: 0px; visibility: hidden; width: 200px; height: 150px; overflow: hidden; box-sizing: content-box"; 2609 document.body.appendChild(container); 2610 var child = document.createElement("P"); 2611 container.appendChild(child); 2612 child.style.cssText = "width: 100%; height: 200px;"; 2613 var widthWithoutScrollBar = child.offsetWidth; 2614 container.style.overflow = "scroll"; 2615 var widthWithScrollBar = child.offsetWidth; 2616 if(widthWithoutScrollBar == widthWithScrollBar) 2617 widthWithScrollBar = container.clientWidth; 2618 verticalScrollBarWidth = widthWithoutScrollBar - widthWithScrollBar; 2619 document.body.removeChild(container); 2620 } 2621 if(nonZero && verticalScrollBarWidth === 0) { 2622 if(ASPx.Browser.MacOSPlatform || ASPx.Browser.Firefox) 2623 return 12; 2624 } 2625 return verticalScrollBarWidth; 2626}; 2627function hideScrollBarCore(element, scrollName) { 2628 if(element.tagName == "IFRAME") { 2629 if((element.scrolling == "yes") || (element.scrolling == "auto")) { 2630 Attr.ChangeAttribute(element, "scrolling", "no"); 2631 return true; 2632 } 2633 } 2634 else if(element.tagName == "DIV") { 2635 if((element.style[scrollName] == "scroll") || (element.style[scrollName] == "auto")) { 2636 Attr.ChangeStyleAttribute(element, scrollName, "hidden"); 2637 return true; 2638 } 2639 } 2640 return false; 2641} 2642function restoreScrollBarCore(element, scrollName) { 2643 if(element.tagName == "IFRAME") 2644 return Attr.RestoreAttribute(element, "scrolling"); 2645 else if(element.tagName == "DIV") 2646 return Attr.RestoreStyleAttribute(element, scrollName); 2647 return false; 2648} 2649ASPx.SetScrollBarVisibilityCore = function(element, scrollName, isVisible) { 2650 return isVisible ? restoreScrollBarCore(element, scrollName) : hideScrollBarCore(element, scrollName); 2651}; 2652ASPx.SetScrollBarVisibility = function(element, isVisible) { 2653 if(ASPx.SetScrollBarVisibilityCore(element, "overflow", isVisible)) 2654 return true; 2655 var result = ASPx.SetScrollBarVisibilityCore(element, "overflowX", isVisible) 2656 || ASPx.SetScrollBarVisibilityCore(element, "overflowY", isVisible); 2657 return result; 2658}; 2659ASPx.SetInnerHtml = function(element, html) { 2660 setInnerHtmlInternal(element, html); 2661}; 2662ASPx.GetInnerText = function(container) { 2663 if(Browser.Safari && Browser.MajorVersion <= 5) { 2664 var filter = getHtml2PlainTextFilter(); 2665 setInnerHtmlInternal(filter, container.innerHTML); 2666 ASPx.SetElementDisplay(filter, true); 2667 var innerText = filter.innerText; 2668 ASPx.SetElementDisplay(filter, false); 2669 return innerText; 2670 } else if(Browser.NetscapeFamily || Browser.WebKitFamily || (Browser.IE && Browser.Version >= 9) || Browser.Edge) { 2671 return container.textContent; 2672 } else 2673 return container.innerText; 2674}; 2675ASPx.GetEllipsisTooltipText = function(element) { 2676 var innerText = ASPx.GetInnerText(element); 2677 innerText = ASPx.RemoveComment(innerText); 2678 return innerText; 2679}; 2680ASPx.RemoveComment = function(text) { 2681 var result = text; 2682 var commentStart = "<!--"; 2683 var commentEnd = "//-->"; 2684 var positionStart = result.indexOf(commentStart); 2685 while(positionStart > -1) { 2686 var positionEnd = result.indexOf(commentEnd); 2687 var startStr = result.substring(0, positionStart); 2688 var endStr = result.substring(positionEnd + commentEnd.length); 2689 result = startStr + endStr; 2690 positionStart = result.indexOf(commentStart); 2691 } 2692 return result; 2693}; 2694var html2PlainTextFilter = null; 2695function getHtml2PlainTextFilter() { 2696 if(html2PlainTextFilter == null) { 2697 html2PlainTextFilter = document.createElement("DIV"); 2698 html2PlainTextFilter.style.width = "0"; 2699 html2PlainTextFilter.style.height = "0"; 2700 html2PlainTextFilter.style.overflow = "visible"; 2701 ASPx.SetElementDisplay(html2PlainTextFilter, false); 2702 document.body.appendChild(html2PlainTextFilter); 2703 } 2704 return html2PlainTextFilter; 2705} 2706ASPx.CreateHiddenField = function(name, id, parent) { 2707 var input = document.createElement("INPUT"); 2708 input.setAttribute("type", "hidden"); 2709 if(name) 2710 input.setAttribute("name", name); 2711 if(id) 2712 input.setAttribute("id", id); 2713 if(parent) 2714 parent.appendChild(input); 2715 return input; 2716}; 2717ASPx.CloneObject = function(srcObject) { 2718 if(typeof(srcObject) != 'object' || srcObject == null) 2719 return srcObject; 2720 var newObject = {}; 2721 for(var i in srcObject) 2722 newObject[i] = srcObject[i]; 2723 return newObject; 2724}; 2725ASPx.InsertRowsBefore = function(table, rowsHtml, index) { 2726 var row = null; 2727 if(index >= 0 && index < table.rows.length) 2728 row = table.rows[index]; 2729 insertRowsBefore(table, rowsHtml, row); 2730}; 2731var insertRowsBefore = function(table, rowsHtml, row) { 2732 if(!row && table.tBodies.length > 0) { 2733 row = document.createElement("TR"); 2734 table.tBodies[0].appendChild(row);
2735 row.shouldRemove = true; 2736 } 2737 if(row) { 2738 row.insertAdjacentHTML("beforeBegin", rowsHtml); 2739 if(row.shouldRemove) 2740 ASPx.RemoveElement(row); 2741 } 2742}; 2743ASPx.IsPercentageSize = function(size) { 2744 return size && size.indexOf('%') != -1; 2745}; 2746ASPx.GetElementById = function(id) { 2747 if(document.getElementById) 2748 return document.getElementById(id); 2749 else 2750 return document.all[id]; 2751}; 2752ASPx.GetElementByIdInDocument = function(documentObj, id) { 2753 if(documentObj.getElementById) 2754 return documentObj.getElementById(id); 2755 else 2756 return documentObj.all[id]; 2757}; 2758ASPx.GetIsParent = function(parentElement, element) { 2759 if(!parentElement || !element) 2760 return false; 2761 while(element){ 2762 if(element === parentElement) 2763 return true; 2764 if(element.tagName === "BODY") 2765 return false; 2766 element = element.parentNode; 2767 } 2768 return false; 2769}; 2770ASPx.GetParentById = function(element, id) { 2771 element = element.parentNode; 2772 while(element){ 2773 if(element.id === id) 2774 return element; 2775 element = element.parentNode; 2776 } 2777 return null; 2778}; 2779ASPx.GetParentByPartialId = function(element, idPart){ 2780 while(element && element.tagName != "BODY") { 2781 if(element.id && element.id.match(idPart)) 2782 return element; 2783 element = element.parentNode; 2784 } 2785 return null; 2786}; 2787ASPx.GetParentByTagName = function(element, tagName) { 2788 tagName = tagName.toUpperCase(); 2789 while(element) { 2790 if(element.tagName === "BODY") 2791 return null; 2792 if(element.tagName === tagName) 2793 return element; 2794 element = element.parentNode; 2795 } 2796 return null; 2797}; 2798function getParentByCondition(element, conditionArg, condition) { 2799 while(element != null) { 2800 if(element.tagName == "BODY" || element.nodeName == "#document") 2801 return null; 2802 if (condition(element, conditionArg)) 2803 return element; 2804 element = element.parentNode; 2805 } 2806 return null; 2807} 2808ASPx.GetParentByPartialClassName = function(element, className) { 2809 return getParentByCondition(element, className, ASPx.ElementContainsCssClass); 2810}; 2811ASPx.GetParentByClassName = function(element, className) { 2812 return getParentByCondition(element, className, ASPx.ElementHasCssClass); 2813}; 2814ASPx.GetParentBySelector = function (element, selector) { 2815 return getParentByCondition(element, selector, ASPx.ElementMatchesSelector); 2816}; 2817ASPx.GetParentByTagNameAndAttributeValue = function(element, tagName, attrName, attrValue) { 2818 tagName = tagName.toUpperCase(); 2819 while(element != null) { 2820 if(element.tagName == "BODY") 2821 return null; 2822 if(element.tagName == tagName && element[attrName] == attrValue) 2823 return element; 2824 element = element.parentNode; 2825 } 2826 return null; 2827}; 2828ASPx.GetParent = function(element, testFunc){ 2829 if (!ASPx.IsExists(testFunc)) return null; 2830 while(element != null && element.tagName != "BODY"){ 2831 if(testFunc(element)) 2832 return element; 2833 element = element.parentNode; 2834 } 2835 return null; 2836}; 2837ASPx.GetElementTreeLine = function(element, stopTagName, stopFunc) { 2838 var result = []; 2839 stopTagName = stopTagName || "BODY"; 2840 while(element != null) { 2841 if(!stopFunc && element.tagName == stopTagName) 2842 break; 2843 if(stopFunc && stopFunc(element)) 2844 break; 2845 result.push(element); 2846 element = element.parentNode; 2847 } 2848 return result; 2849}; 2850ASPx.IsScrollableElement = function(element, isHorzScrollable, isVertScrollable) { 2851 isHorzScrollable = ASPx.IsExists(isHorzScrollable) ? isHorzScrollable : true; 2852 isVertScrollable = ASPx.IsExists(isVertScrollable) ? isVertScrollable : true; 2853 var style = ASPx.GetCurrentStyle(element); 2854 var overflowStyleNames = ["overflow"]; 2855 if(isHorzScrollable) 2856 overflowStyleNames.push("overflowX"); 2857 if(isVertScrollable) 2858 overflowStyleNames.push("overflowY"); 2859 for(var i = 0; i < overflowStyleNames.length; i++) 2860 if(style[overflowStyleNames[i]] == "scroll" || style[overflowStyleNames[i]] == "auto") 2861 return true; 2862 return false; 2863}; 2864ASPx.GetPreviousSibling = function(el) { 2865 if(el.previousElementSibling) { 2866 return el.previousElementSibling; 2867 } else { 2868 while(el = el.previousSibling) { 2869 if(el.nodeType === 1) 2870 return el; 2871 } 2872 } 2873}; 2874ASPx.ElementMatchesSelector = (function (e) { 2875 return (function (matches) { 2876 return function (el, selector) { return !!el && !!selector && matches.call(el, selector); }; 2877 })(e.matches || e.matchesSelector || e.webkitMatchesSelector || e.mozMatchesSelector || e.msMatchesSelector || e.oMatchesSelector); 2878})(Element.prototype); 2879ASPx.ElementHasCssClass = function(element, className) { 2880 try { 2881 var elementClasses; 2882 var classList = ASPx.GetClassNameList(element); 2883 if(!classList) { 2884 var elementClassName = ASPx.GetClassName(element); 2885 if(!elementClassName) { 2886 return false; 2887 } 2888 elementClasses = elementClassName.split(" "); 2889 } 2890 var classNames = className.split(" "); 2891 for(var i = classNames.length - 1; i >= 0; i--) { 2892 if(classList) { 2893 if(classList.indexOf(classNames[i]) === -1) 2894 return false; 2895 continue; 2896 } 2897 if(Data.ArrayIndexOf(elementClasses, classNames[i]) < 0) 2898 return false; 2899 } 2900 return true; 2901 } catch(e) { 2902 return false; 2903 } 2904}; 2905ASPx.ElementContainsCssClass = function(element, className) { 2906 try { 2907 var elementClassName = ASPx.GetClassName(element); 2908 if(!elementClassName) { 2909 return false; 2910 } 2911 return elementClassName.indexOf(className) != -1; 2912 } catch(e) { 2913 return false; 2914 } 2915}; 2916ASPx.AddClassNameToElement = function (element, className) { 2917 if(!element || typeof(className) !== "string" ) return; 2918 className = className.trim(); 2919 if(!ASPx.ElementHasCssClass(element, className) && className !== "") { 2920 var oldClassName = ASPx.GetClassName(element); 2921 ASPx.SetClassName(element, (oldClassName === "") ? className : oldClassName + " " + className); 2922 } 2923}; 2924ASPx.AddClassNamesToElement = function(element, classNames) { 2925 Data.ForEach(classNames, function(className) { ASPx.AddClassNameToElement(element, className); }); 2926};
2927ASPx.CombineCssClasses = function() { 2928 return Array.prototype.slice.call(arguments).join(" "); 2929}; 2930ASPx.RemoveClassNameFromElement = function(element, className) { 2931 if(!element) return; 2932 var elementClassName = ASPx.GetClassName(element); 2933 var updClassName = " " + elementClassName + " "; 2934 var newClassName = updClassName.replace(" " + className + " ", " "); 2935 if(updClassName.length != newClassName.length) 2936 ASPx.SetClassName(element, Str.Trim(newClassName)); 2937}; 2938ASPx.RemoveClassNamesFromElement = function(element, classNames) { 2939 if(!element) return; 2940 for(var i = 0; i < classNames.length; i++) { 2941 var className = classNames[i]; 2942 element.classList.remove(className); 2943 } 2944}; 2945ASPx.ToggleClassNameToElement = function(element, className, toggleState) { 2946 if(!toggleState) 2947 ASPx.RemoveClassNameFromElement(element, className); 2948 if(toggleState && !ASPx.ElementHasCssClass(element, className)) 2949 ASPx.AddClassNameToElement(element, className); 2950}; 2951ASPx.GetClassNameList = function(element) { 2952 var result = []; 2953 if(element) { 2954 if(element.tagName === "svg") { 2955 result = ASPx.GetClassName(element).replace(/^\s+|\s+$/g, '').split(/\s+/); 2956 } 2957 else { 2958 result = element.classList ? [].slice.call(element.classList) : ASPx.GetClassName(element).replace(/^\s+|\s+$/g, '').split(/\s+/); 2959 } 2960 } 2961 return result; 2962}; 2963ASPx.GetClassName = function(element) { 2964 var result = ""; 2965 if(element) { 2966 if(element.tagName === "svg") { 2967 result = element.className.baseVal; 2968 } 2969 else { 2970 result = element.className ? element.className : ""; 2971 } 2972 } 2973 return result; 2974}; 2975ASPx.SetClassName = function(element, className) { 2976 if(element.tagName === "svg") { 2977 element.className.baseVal = Str.Trim(className); 2978 } 2979 else { 2980 element.className = Str.Trim(className); 2981 } 2982}; 2983ASPx.GetElementOffsetWidth = function(element) { 2984 if(element.tagName === "svg") { 2985 return element.getBoundingClientRect().width; 2986 } 2987 else { 2988 return element.offsetWidth; 2989 } 2990}; 2991ASPx.GetElementOffsetHeight = function(element) { 2992 if(element.tagName === "svg") { 2993 return element.getBoundingClientRect().height; 2994 } 2995 else { 2996 return element.offsetHeight; 2997 } 2998}; 2999function nodeListToArray(nodeList, filter) { 3000 var result = []; 3001 for(var i = 0, element; element = nodeList[i]; i++) { 3002 if(filter && !filter(element)) 3003 continue; 3004 result.push(element); 3005 } 3006 return result; 3007} 3008ASPx.NodeListToArray = nodeListToArray; 3009function getItemByIndex(collection, index) { 3010 if(!index) index = 0; 3011 if(collection != null && collection.length > index) 3012 return collection[index]; 3013 return null; 3014} 3015ASPx.GetChildNodesByQuerySelector = function (parent, selector) { 3016 return nodeListToArray(parent.querySelectorAll(selector), function (el) { return el.parentNode === parent; }); 3017}; 3018ASPx.GetChildNodesByClassName = function(parent, className) { 3019 if(!parent) return []; 3020 if(parent.querySelectorAll) { 3021 var children = parent.querySelectorAll('.' + className); 3022 return nodeListToArray(children, function(element) { 3023 return element.parentNode === parent; 3024 }); 3025 } 3026 return ASPx.GetChildNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); }); 3027}; 3028ASPx.GetChildNodesByPartialClassName = function(element, className) { 3029 return ASPx.GetChildElementNodesByPredicate(element, 3030 function(child) { 3031 return ASPx.ElementContainsCssClass(child, className); 3032 }); 3033}; 3034ASPx.GetChildByPartialClassName = function(element, className, index) { 3035 if(element != null){ 3036 var collection = ASPx.GetChildNodesByPartialClassName(element, className); 3037 return getItemByIndex(collection, index); 3038 } 3039 return null; 3040}; 3041ASPx.GetChildByClassName = function(element, className, index) { 3042 if(element != null){ 3043 var collection = ASPx.GetChildNodesByClassName(element, className); 3044 return getItemByIndex(collection, index); 3045 } 3046 return null; 3047}; 3048ASPx.GetNodesByPartialClassName = function(element, className) { 3049 if(element.querySelectorAll) { 3050 var list = element.querySelectorAll('*[class*=' + className + ']'); 3051 return nodeListToArray(list); 3052 } 3053 var collection = element.all || element.getElementsByTagName('*'); 3054 var ret = [ ]; 3055 if(collection != null) { 3056 for(var i = 0; i < collection.length; i ++) { 3057 if(ASPx.ElementContainsCssClass(collection[i], className))
3058 ret.push(collection[i]); 3059 } 3060 } 3061 return ret; 3062}; 3063ASPx.GetNodesByClassName = function(parent, className) { 3064 if(parent.querySelectorAll) { 3065 var children = parent.querySelectorAll('.' + className); 3066 return nodeListToArray(children); 3067 } 3068 return ASPx.GetNodes(parent, function(elem) { return elem.className && ASPx.ElementHasCssClass(elem, className); }); 3069}; 3070ASPx.GetNodeByClassName = function(element, className, index) { 3071 if(element != null){ 3072 var collection = ASPx.GetNodesByClassName(element, className); 3073 return getItemByIndex(collection, index); 3074 } 3075 return null; 3076}; 3077ASPx.GetChildById = function(element, id) { 3078 if(element.all) { 3079 var child = element.all[id]; 3080 if(!child) { 3081 child = element.all(id); 3082 if(!child) 3083 return null; 3084 } 3085 if(!ASPx.IsExists(child.length)) 3086 return child; 3087 else 3088 return ASPx.GetElementById(id); 3089 } 3090 else 3091 return ASPx.GetElementById(id); 3092}; 3093ASPx.GetNodesByPartialId = function(element, partialName, list) { 3094 if(element.id && element.id.indexOf(partialName) > -1) 3095 list.push(element); 3096 if(element.childNodes) { 3097 for(var i = 0; i < element.childNodes.length; i ++) 3098 ASPx.GetNodesByPartialId(element.childNodes[i], partialName, list); 3099 } 3100}; 3101ASPx.GetNodesByTagName = function(element, tagName) { 3102 var tagNameToUpper = tagName.toUpperCase(); 3103 var result = null; 3104 if(element) { 3105 if(element.getElementsByTagName) { 3106 result = element.getElementsByTagName(tagNameToUpper); 3107 if(result.length === 0) { 3108 result = element.getElementsByTagName(tagName); 3109 } 3110 } 3111 else if(element.all && element.all.tags !== undefined) 3112 result = Browser.Netscape ? element.all.tags[tagNameToUpper] : element.all.tags(tagNameToUpper); 3113 } 3114 return result; 3115}; 3116ASPx.GetNodeByTagName = function(element, tagName, index) { 3117 if(element != null){ 3118 var collection = ASPx.GetNodesByTagName(element, tagName); 3119 return getItemByIndex(collection, index); 3120 } 3121 return null; 3122}; 3123ASPx.GetChildNodesByTagName = function(parent, tagName) { 3124 return ASPx.GetChildNodes(parent, function (child) { return child.tagName === tagName; }); 3125}; 3126ASPx.GetChildByTagName = function(element, tagName, index) { 3127 if(element != null){ 3128 var collection = ASPx.GetChildNodesByTagName(element, tagName); 3129 return getItemByIndex(collection, index); 3130 } 3131 return null; 3132}; 3133ASPx.RetrieveByPredicate = function(scourceCollection, predicate) { 3134 var result = []; 3135 for(var i = 0; i < scourceCollection.length; i++) { 3136 var element = scourceCollection[i]; 3137 if(!predicate || predicate(element)) 3138 result.push(element); 3139 } 3140 return result; 3141}; 3142ASPx.GetChildNodes = function(parent, predicate) { 3143 return ASPx.RetrieveByPredicate(parent.childNodes, predicate); 3144}; 3145ASPx.GetNodes = function(parent, predicate) { 3146 var c = parent.all || parent.getElementsByTagName('*'); 3147 return ASPx.RetrieveByPredicate(c, predicate); 3148}; 3149ASPx.GetChildElementNodes = function(parent) { 3150 if(!parent) return null; 3151 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1; }); 3152}; 3153ASPx.GetChildElementNodesByPredicate = function(parent, predicate) { 3154 if(!parent) return null; 3155 if(!predicate) return ASPx.GetChildElementNodes(parent); 3156 return ASPx.GetChildNodes(parent, function(e) { return e.nodeType == 1 && predicate(e); }); 3157}; 3158ASPx.GetTextNode = function(element, index) { 3159 if(element != null){ 3160 var collection = [ ]; 3161 ASPx.GetTextNodes(element, collection); 3162 return getItemByIndex(collection, index); 3163 } 3164 return null; 3165}; 3166ASPx.GetTextNodes = function(element, collection) { 3167 if(element.tagName === "svg") 3168 return; 3169 for(var i = 0; i < element.childNodes.length; i ++){ 3170 var childNode = element.childNodes[i]; 3171 if(ASPx.IsExists(childNode.nodeValue)) 3172 collection.push(childNode); 3173 ASPx.GetTextNodes(childNode, collection); 3174 } 3175}; 3176ASPx.GetNormalizedTextNode = function(element, index) { 3177 var textNode = ASPx.GetTextNode(element, index); 3178 if(textNode != null) 3179 ASPx.MergeAdjacentTextNodes(textNode); 3180 return textNode; 3181}; 3182ASPx.MergeAdjacentTextNodes = function(firstTextNode) { 3183 if(!ASPx.IsExists(firstTextNode.nodeValue)) 3184 return; 3185 var textNode = firstTextNode; 3186 while(textNode.nextSibling && ASPx.IsExists(textNode.nextSibling.nodeValue)) { 3187 textNode.nodeValue += textNode.nextSibling.nodeValue; 3188 textNode.parentNode.removeChild(textNode.nextSibling); 3189 } 3190}; 3191ASPx.GetElementDocument = function(element) { 3192 return element.document || element.ownerDocument; 3193}; 3194ASPx.RemoveElement = function(element) { 3195 if(element && element.parentNode) 3196 element.parentNode.removeChild(element); 3197}; 3198ASPx.ReplaceTagName = function(element, newTagName, cloneChilds) { 3199 if(element.nodeType != 1) 3200 return null; 3201 if(element.nodeName == newTagName) 3202 return element; 3203 cloneChilds = cloneChilds !== undefined ? cloneChilds : true; 3204 var doc = element.ownerDocument; 3205 var newElem = doc.createElement(newTagName); 3206 Attr.CopyAllAttributes(element, newElem); 3207 if(cloneChilds) { 3208 for(var i = 0; i < element.childNodes.length; i++) 3209 newElem.appendChild(element.childNodes[i].cloneNode(true)); 3210 } 3211 else { 3212 for(var child; child = element.firstChild; ) 3213 newElem.appendChild(child); 3214 } 3215 element.parentNode.replaceChild(newElem, element); 3216 return newElem; 3217}; 3218ASPx.RemoveOuterTags = function(element) { 3219 var docFragment = element.ownerDocument.createDocumentFragment(); 3220 for(var i = 0; i < element.childNodes.length; i++) 3221 docFragment.appendChild(element.childNodes[i].cloneNode(true)); 3222 element.parentNode.replaceChild(docFragment, element); 3223}; 3224ASPx.WrapElementInNewElement = function(element, newElementTagName) { 3225 var wrapElement = null; 3226 var docFragment = element.ownerDocument.createDocumentFragment(); 3227 wrapElement = element.ownerDocument.createElement(newElementTagName); 3228 docFragment.appendChild(wrapElement); 3229 wrapElement.appendChild(element.cloneNode(true)); 3230 element.parentNode.replaceChild(docFragment, element); 3231 return wrapElement; 3232}; 3233ASPx.InsertElementAfter = function(newElement, targetElement) { 3234 var parentElem = targetElement.parentNode; 3235 if(parentElem.childNodes[parentElem.childNodes.length - 1] == targetElement) 3236 parentElem.appendChild(newElement); 3237 else if(newElement !== targetElement.nextSibling) 3238 parentElem.insertBefore(newElement, targetElement.nextSibling); 3239}; 3240ASPx.SetElementOpacity = function(element, value) { 3241 element.style.opacity = value; 3242}; 3243ASPx.GetElementOpacity = function(element) { 3244 return parseFloat(ASPx.GetCurrentStyle(element).opacity); 3245}; 3246ASPx.HiddenChangable = "dx-hc"; 3247ASPx.DefaultDisplayNoneSelectors = [ "dxmodalSys" ]; 3248ASPx.DefaultDisplaySelectors = ["show"]; 3249function getIsDefaultDisplayNone(element) { 3250 for(var i = 0; i < ASPx.DefaultDisplayNoneSelectors.length; i++) { 3251 if(ASPx.ElementHasCssClass(element, ASPx.DefaultDisplayNoneSelectors[i])) 3252 return true; 3253 } 3254 return false; 3255} 3256ASPx.GetElementDisplay = function(element, isCurrentStyle) { 3257 if(isCurrentStyle) { 3258 var currentStyle = ASPx.GetCurrentStyle(element); 3259 if(currentStyle) 3260 return currentStyle.display != "none"; 3261 } 3262 if(getIsDefaultDisplayNone(element)) 3263 return element.style.display != "none" && element.style.display != "" || ASPx.DefaultDisplaySelectors.some(function(s) { return ASPx.ElementHasCssClass(element, s); }); 3264 return element.style.display != "none" && !ASPx.ElementHasCssClass(element, ASPx.HiddenChangable); 3265}; 3266ASPx.SetElementDisplay = function(element, value) { 3267 if(!element) return; 3268 if(ASPx.ElementHasCssClass(element, ASPx.HiddenChangable)) 3269 ASPx.RemoveClassNameFromElement(element, ASPx.HiddenChangable); 3270 if(typeof(value) === "string") 3271 element.style.display = value; 3272 else if(getIsDefaultDisplayNone(element)) 3273 element.style.display = value ? (element.tagName === "TABLE" ? "table" : "block") : ""; 3274 else if(!value) 3275 element.style.display = "none"; 3276 else
3277 element.style.display = ""; 3278}; 3279ASPx.GetElementVisibility = function(element, isCurrentStyle) { 3280 if(isCurrentStyle) { 3281 var currentStyle = ASPx.GetCurrentStyle(element); 3282 if(currentStyle) 3283 return currentStyle.visibility != "hidden"; 3284 } 3285 return element.style.visibility != "hidden"; 3286}; 3287ASPx.SetElementVisibility = function(element, value) { 3288 if(!element) return; 3289 if(typeof(value) === "string") 3290 element.style.visibility = value; 3291 else 3292 element.style.visibility = value ? "visible" : "hidden"; 3293}; 3294ASPx.IsElementVisible = function(element, isCurrentStyle) { 3295 if(!element) return false; 3296 while(element && element.tagName != "BODY") { 3297 if(!ASPx.GetElementDisplay(element, isCurrentStyle) || (!ASPx.GetElementVisibility(element, isCurrentStyle) && !Attr.IsExistsAttribute(element, "errorFrame"))) 3298 return false; 3299 element = element.parentNode; 3300 } 3301 return true; 3302}; 3303ASPx.IsElementDisplayed = function(element) { 3304 if(!element) return false; 3305 while(element && element.tagName != "BODY") { 3306 if(!ASPx.GetElementDisplay(element)) 3307 return false; 3308 element = element.parentNode; 3309 } 3310 return true; 3311}; 3312ASPx.GetElementInitializedFlag = function(element) { 3313 return element["dxinit"]; 3314}; 3315ASPx.SetElementInitializedFlag = function(element) { 3316 element["dxinit"] = true; 3317}; 3318ASPx.AddStyleSheetLinkToDocument = function(doc, linkUrl) { 3319 var newLink = createStyleLink(doc, linkUrl); 3320 var head = ASPx.GetHeadElementOrCreateIfNotExist(doc); 3321 head.appendChild(newLink); 3322 return newLink; 3323}; 3324ASPx.GetHeadElementOrCreateIfNotExist = function(doc) { 3325 var elements = ASPx.GetNodesByTagName(doc, "head"); 3326 var head = null; 3327 if(elements.length == 0) { 3328 head = doc.createElement("head"); 3329 head.visibility = "hidden"; 3330 doc.insertBefore(head, doc.body); 3331 } else 3332 head = elements[0]; 3333 return head; 3334}; 3335function createStyleLink(doc, url) { 3336 var newLink = doc.createElement("link"); 3337 Attr.SetAttribute(newLink, "href", url); 3338 Attr.SetAttribute(newLink, "rel", "stylesheet"); 3339 Attr.AppendStyleType(newLink); 3340 return newLink; 3341} 3342ASPx.GetCurrentStyle = function(element) { 3343 if(document.defaultView && document.defaultView.getComputedStyle) { 3344 var result = document.defaultView.getComputedStyle(element, null); 3345 if(!result && Browser.Firefox && window.frameElement) { 3346 var changes = []; 3347 var curElement = window.frameElement; 3348 while(!(result = document.defaultView.getComputedStyle(element, null))) { 3349 changes.push([curElement, curElement.style.display]); 3350 ASPx.SetStylesCore(curElement, "display", "block", true); 3351 curElement = curElement.tagName == "BODY" ? curElement.ownerDocument.defaultView.frameElement : curElement.parentNode; 3352 } 3353 result = ASPx.CloneObject(result); 3354 for(var ch, i = 0; ch = changes[i]; i++) 3355 ASPx.SetStylesCore(ch[0], "display", ch[1]); 3356 var dummy = document.body.offsetWidth; 3357 } 3358 if(Browser.Firefox && Browser.MajorVersion >= 62 && window.frameElement && result.length === 0) { 3359 result = ASPx.CloneObject(result); 3360 result.display = element.style.display; 3361 } 3362 return result; 3363 } 3364 return window.getComputedStyle(element, null); 3365}; 3366ASPx.CreateStyleSheetInDocument = function(doc) { 3367 if(doc.createStyleSheet) { 3368 try { 3369 return doc.createStyleSheet(); 3370 } 3371 catch(e) { 3372 var message = "The CSS link limit (31) has been exceeded. Please enable CSS merging or reduce the number of CSS files on the page. For details, see http://www.devexpress.com/Support/Center/p/K18487.aspx."; 3373 throw new Error(message); 3374 } 3375 } 3376 else { 3377 var styleSheet = doc.createElement("STYLE"); 3378 ASPx.GetNodeByTagName(doc, "HEAD", 0).appendChild(styleSheet); 3379 return styleSheet.sheet; 3380 } 3381}; 3382ASPx.currentStyleSheet = null; 3383ASPx.GetCurrentStyleSheet = function() { 3384 if(!ASPx.currentStyleSheet) 3385 ASPx.currentStyleSheet = ASPx.CreateStyleSheetInDocument(document); 3386 return ASPx.currentStyleSheet; 3387}; 3388function getStyleSheetRules(styleSheet){ 3389 try { 3390 if (styleSheet.href && styleSheet.href.indexOf("file:///") === 0) 3391 return null; 3392 return styleSheet.cssRules; 3393 } 3394 catch(e) { 3395 return null; 3396 } 3397} 3398ASPx.cachedCssRules = { }; 3399ASPx.GetStyleSheetRules = function (className, stylesStorageDocument) { 3400 if(ASPx.cachedCssRules[className]) { 3401 if(ASPx.cachedCssRules[className] != ASPx.EmptyObject) 3402 return ASPx.cachedCssRules[className]; 3403 return null; 3404 } 3405 var result = iterateStyleSheetRules(stylesStorageDocument, function(rule) { 3406 if(rule.selectorText == "." + className){ 3407 ASPx.cachedCssRules[className] = rule; 3408 return rule; 3409 } 3410 }); 3411 if(ASPx.IsExists(result)) 3412 return result; 3413 ASPx.cachedCssRules[className] = ASPx.EmptyObject; 3414 return null; 3415}; 3416function iterateStyleSheetRules(stylesStorageDocument, callback) { 3417 var doc = stylesStorageDocument || document; 3418 for(var i = 0; i < doc.styleSheets.length; i ++){ 3419 var styleSheet = doc.styleSheets[i];
3420 var rules = getStyleSheetRules(styleSheet); 3421 if(rules != null){ 3422 for(var j = 0; j < rules.length; j ++) { 3423 var result = callback(rules[j]); 3424 if(result !== undefined) 3425 return result; 3426 } 3427 } 3428 } 3429} 3430ASPx.ProcessStyleSheetRules = function(prefix, callback) { 3431 iterateStyleSheetRules(null, function(rule) { 3432 if(!!rule.selectorText && rule.selectorText.indexOf(prefix) === 0) { 3433 var name = rule.selectorText.substring(prefix.length); 3434 var result = callback(name, rule.style, rule); 3435 if(result !== undefined) 3436 return result; 3437 } 3438 }); 3439}; 3440ASPx.ClearCachedCssRules = function(){ 3441 ASPx.cachedCssRules = { }; 3442}; 3443var styleCount = 0; 3444var styleNameCache = { }; 3445ASPx.CreateImportantStyleRule = function(styleSheet, cssText, postfix, prefix) { 3446 styleSheet = styleSheet || ASPx.GetCurrentStyleSheet(); 3447 var cacheKey = (postfix ? postfix + "||" : "") + cssText + (prefix ? "||" + prefix : ""); 3448 if(styleNameCache[cacheKey]) 3449 return styleNameCache[cacheKey]; 3450 prefix = prefix ? prefix + " " : ""; 3451 var className = "dxh" + styleCount + (postfix ? postfix : ""); 3452 ASPx.AddStyleSheetRule(styleSheet, prefix + "." + className, ASPx.CreateImportantCssText(cssText)); 3453 styleCount++; 3454 styleNameCache[cacheKey] = className; 3455 return className; 3456}; 3457ASPx.CreateImportantCssText = function(cssText) { 3458 var newText = ""; 3459 var hasEncodedSemicolon = cssText.indexOf(ASPx.StyleValueEncodedSemicolon) > -1; 3460 var attributes = cssText.split(";"); 3461 for(var i = 0; i < attributes.length; i++) { 3462 var rule = attributes[i]; 3463 if(rule != "") 3464 newText += ASPx.CreateImportantCssRule(rule, hasEncodedSemicolon); 3465 } 3466 return newText; 3467}; 3468ASPx.CreateImportantCssRule = function(rule, hasEncodedSemicolon) { 3469 var result = rule; 3470 if(hasEncodedSemicolon) { 3471 var regex = new RegExp(ASPx.StyleValueEncodedSemicolon, "g"); 3472 result = result.replace(regex, ";"); 3473 } 3474 result = result + " !important;"; 3475 return result; 3476}; 3477ASPx.AddStyleSheetRule = function(styleSheet, selector, cssText){ 3478 if(!cssText) return; 3479 var index = styleSheet.cssRules.length; 3480 styleSheet.insertRule(selector + " { " + cssText + " }", index); 3481 return styleSheet.cssRules[index]; 3482}; 3483ASPx.GetPointerCursor = function() { 3484 return "pointer"; 3485}; 3486ASPx.SetPointerCursor = function(element) { 3487 if(element.style.cursor == "") 3488 element.style.cursor = ASPx.GetPointerCursor(); 3489}; 3490ASPx.SetElementFloat = function(element, value) { 3491 if(ASPx.IsExists(element.style.cssFloat)) 3492 element.style.cssFloat = value; 3493 else if(ASPx.IsExists(element.style.styleFloat)) 3494 element.style.styleFloat = value; 3495 else 3496 Attr.SetAttribute(element.style, "float", value); 3497}; 3498ASPx.GetElementFloat = function(element) { 3499 var currentStyle = ASPx.GetCurrentStyle(element); 3500 if(ASPx.IsExists(currentStyle.cssFloat)) 3501 return currentStyle.cssFloat; 3502 if(ASPx.IsExists(currentStyle.styleFloat)) 3503 return currentStyle.styleFloat; 3504 return Attr.GetAttribute(currentStyle, "float"); 3505}; 3506function getElementDirection(element) { 3507 return ASPx.GetCurrentStyle(element).direction; 3508} 3509ASPx.IsElementRightToLeft = function(element) { 3510 return getElementDirection(element) == "rtl"; 3511}; 3512ASPx.AdjustVerticalMarginsInContainer = function(container) { 3513 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container); 3514 var flowElements = [], floatElements = [], floatTextElements = []; 3515 var maxHeight = 0, maxFlowHeight = 0; 3516 for(var i = 0; i < container.childNodes.length; i++) { 3517 var element = container.childNodes[i]; 3518 if(!element.offsetHeight) continue; 3519 ASPx.ClearVerticalMargins(element); 3520 } 3521 for(var i = 0; i < container.childNodes.length; i++) { 3522 var element = container.childNodes[i]; 3523 if(!element.offsetHeight) continue; 3524 var float = ASPx.GetElementFloat(element); 3525 var isFloat = (float === "left" || float === "right"); 3526 if(isFloat) 3527 floatElements.push(element); 3528 else { 3529 flowElements.push(element); 3530 if(element.tagName !== "IMG"){ 3531 if(!ASPx.IsTextWrapped(element)) 3532 element.style.verticalAlign = 'baseline'; 3533 floatTextElements.push(element); 3534 } 3535 if(element.tagName === "DIV") 3536 Attr.ChangeStyleAttribute(element, "float", "left"); 3537 } 3538 if(element.offsetHeight > maxHeight) 3539 maxHeight = element.offsetHeight; 3540 if(!isFloat && element.offsetHeight > maxFlowHeight) 3541 maxFlowHeight = element.offsetHeight; 3542 } 3543 for(var i = 0; i < flowElements.length; i++) 3544 Attr.RestoreStyleAttribute(flowElements[i], "float"); 3545 var containerBorderAndPaddings = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container); 3546 var containerHeight = container.offsetHeight - containerBorderAndPaddings; 3547 if(maxHeight == containerHeight) { 3548 var verticalAlign = ASPx.GetCurrentStyle(container).verticalAlign; 3549 for(var i = 0; i < floatTextElements.length; i++) 3550 floatTextElements[i].style.verticalAlign = ''; 3551 containerHeight = container.offsetHeight - containerBorderAndPaddings; 3552 for(var i = 0; i < floatElements.length; i++) 3553 adjustVerticalMarginsCore(floatElements[i], containerHeight, verticalAlign, true); 3554 for(var i = 0; i < flowElements.length; i++) { 3555 if(maxFlowHeight != maxHeight) 3556 adjustVerticalMarginsCore(flowElements[i], containerHeight, verticalAlign); 3557 } 3558 } 3559}; 3560ASPx.AdjustVerticalMargins = function(element) { 3561 ASPx.ClearVerticalMargins(element); 3562 var parentElement = element.parentNode; 3563 var parentHeight = parentElement.getBoundingClientRect().height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement); 3564 adjustVerticalMarginsCore(element, parentHeight, ASPx.GetCurrentStyle(parentElement).verticalAlign); 3565}; 3566function adjustVerticalMarginsCore(element, parentHeight, verticalAlign, toBottom) { 3567 var marginTop; 3568 if(verticalAlign == "top") 3569 marginTop = 0; 3570 else if(verticalAlign == "bottom") 3571 marginTop = parentHeight - element.getBoundingClientRect().height; 3572 else
3573 marginTop = (parentHeight - element.getBoundingClientRect().height) / 2; 3574 if(marginTop !== 0){ 3575 element.style.marginTop = marginTop + "px"; 3576 } 3577} 3578ASPx.ClearVerticalMargins = function(element) { 3579 element.style.marginTop = ""; 3580 element.style.marginBottom = ""; 3581}; 3582ASPx.AdjustHeightInContainer = function(container) { 3583 var height = container.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(container); 3584 for(var i = 0; i < container.childNodes.length; i++) { 3585 var element = container.childNodes[i]; 3586 if(!element.offsetHeight) continue; 3587 ASPx.ClearHeight(element); 3588 } 3589 var elements = []; 3590 var childrenHeight = 0; 3591 for(var i = 0; i < container.childNodes.length; i++) { 3592 var element = container.childNodes[i]; 3593 if(!element.offsetHeight) continue; 3594 childrenHeight += element.offsetHeight + ASPx.GetTopBottomMargins(element); 3595 elements.push(element); 3596 } 3597 if(elements.length > 0 && childrenHeight < height) { 3598 var correctedHeight = 0; 3599 for(var i = 0; i < elements.length; i++) { 3600 var elementHeight = 0; 3601 if(i < elements.length - 1){ 3602 var elementHeight = Math.floor(height / elements.length); 3603 correctedHeight += elementHeight; 3604 } 3605 else{ 3606 var elementHeight = height - correctedHeight; 3607 if(elementHeight < 0) elementHeight = 0; 3608 } 3609 adjustHeightCore(elements[i], elementHeight); 3610 } 3611 } 3612}; 3613ASPx.AdjustHeight = function(element) { 3614 ASPx.ClearHeight(element); 3615 var parentElement = element.parentNode; 3616 var height = parentElement.getBoundingClientRect().height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(parentElement); 3617 adjustHeightCore(element, height); 3618}; 3619function adjustHeightCore(element, height) { 3620 var height = height - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element); 3621 if(height < 0) height = 0; 3622 element.style.height = height + "px"; 3623} 3624ASPx.ClearHeight = function(element) { 3625 element.style.height = ""; 3626}; 3627ASPx.ShrinkWrappedTextInContainer = function(container) { 3628 if(!container) return; 3629 for(var i = 0; i < container.childNodes.length; i++){ 3630 var child = container.childNodes[i]; 3631 if(child.style && ASPx.IsTextWrapped(child)) { 3632 Attr.ChangeStyleAttribute(child, "width", "1px"); 3633 child.shrinkedTextContainer = true; 3634 } 3635 } 3636}; 3637ASPx.AdjustWrappedTextInContainer = function(container) { 3638 if(!container) return; 3639 var textContainer, leftWidth = 0, rightWidth = 0; 3640 for(var i = 0; i < container.childNodes.length; i++){ 3641 var child = container.childNodes[i]; 3642 if(child.tagName === "BR") 3643 return; 3644 if(!child.tagName) 3645 continue; 3646 if(child.tagName !== "IMG"){ 3647 textContainer = child; 3648 if(ASPx.IsTextWrapped(textContainer)){ 3649 if(!textContainer.shrinkedTextContainer) 3650 textContainer.style.width = ""; 3651 textContainer.style.marginRight = ""; 3652 } 3653 } 3654 else { 3655 if(ASPx.GetElementOffsetWidth(child)=== 0) 3656 Evt.AttachEventToElement(child, "load", function(evt) { ASPx.AdjustWrappedTextInContainer(container); }); 3657 else { 3658 var width = ASPx.GetElementOffsetWidth(child) + ASPx.GetLeftRightMargins(child); 3659 if(textContainer) 3660 rightWidth += width; 3661 else 3662 leftWidth += width; 3663 } 3664 } 3665 } 3666 if(textContainer && ASPx.IsTextWrapped(textContainer)) { 3667 var containerWidth = ASPx.GetElementOffsetWidth(container) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(container); 3668 if(textContainer.shrinkedTextContainer) { 3669 Attr.RestoreStyleAttribute(textContainer, "width"); 3670 Attr.ChangeStyleAttribute(container, "width", containerWidth + "px"); 3671 } 3672 if(ASPx.GetElementOffsetWidth(textContainer) + leftWidth + rightWidth >= containerWidth) { 3673 if(rightWidth > 0 && !textContainer.shrinkedTextContainer) 3674 textContainer.style.width = (containerWidth - rightWidth) + "px"; 3675 else if(leftWidth > 0){ 3676 if(ASPx.IsElementRightToLeft(container)) 3677 textContainer.style.marginLeft = leftWidth + "px"; 3678 else 3679 textContainer.style.marginRight = leftWidth + "px"; 3680 } 3681 } 3682 } 3683}; 3684ASPx.IsTextWrapped = function(element) { 3685 return element && ASPx.GetCurrentStyle(element).whiteSpace !== "nowrap"; 3686}; 3687ASPx.IsValidPosition = function(pos){ 3688 return pos != ASPx.InvalidPosition && pos != -ASPx.InvalidPosition; 3689}; 3690ASPx.getSpriteMainElement = function(element) { 3691 var cssClassMarker = "dx-acc"; 3692 if(ASPx.ElementContainsCssClass(element, cssClassMarker)) 3693 return element; 3694 if(element.parentNode && ASPx.ElementContainsCssClass(element.parentNode, cssClassMarker)) 3695 return element.parentNode; 3696 return element; 3697}; 3698ASPx.GetAbsoluteX = function(curEl){ 3699 return ASPx.GetAbsolutePositionX(curEl); 3700};
3701ASPx.GetAbsoluteY = function(curEl){ 3702 return ASPx.GetAbsolutePositionY(curEl); 3703}; 3704ASPx.SetAbsoluteX = function(element, x){ 3705 element.style.left = ASPx.PrepareClientPosForElement(x, element, true) + "px"; 3706}; 3707ASPx.SetAbsoluteY = function(element, y){ 3708 element.style.top = ASPx.PrepareClientPosForElement(y, element, false) + "px"; 3709}; 3710ASPx.GetAbsolutePositionX = function(element){ 3711 if(Browser.Firefox && Browser.Version >= 3) 3712 return getAbsolutePositionX_FF3(element); 3713 else if(Browser.Opera) 3714 return getAbsolutePositionX_Opera(element); 3715 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3)) 3716 return getAbsolutePositionX_NS(element); 3717 else if(Browser.WebKitFamily || Browser.Edge) 3718 return getAbsolutePositionX_FF3(element); 3719 else 3720 return getAbsolutePositionX_Other(element); 3721}; 3722function getAbsolutePositionX_Opera(curEl){ 3723 var isFirstCycle = true; 3724 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true); 3725 while(curEl != null) { 3726 pos += curEl.offsetLeft; 3727 if(!isFirstCycle) 3728 pos -= curEl.scrollLeft; 3729 curEl = curEl.offsetParent; 3730 isFirstCycle = false; 3731 } 3732 pos += document.body.scrollLeft; 3733 return pos; 3734} 3735function getAbsolutePositionX_FF3(element){ 3736 if(element == null) return 0; 3737 var x = element.getBoundingClientRect().left + ASPx.GetDocumentScrollLeft(); 3738 return x; 3739} 3740function getAbsolutePositionX_NS(curEl){ 3741 var pos = getAbsoluteScrollOffset_OperaFF(curEl, true); 3742 var isFirstCycle = true; 3743 while(curEl != null) { 3744 pos += curEl.offsetLeft; 3745 if(!isFirstCycle && curEl.offsetParent != null) 3746 pos -= curEl.scrollLeft; 3747 if(!isFirstCycle && Browser.Firefox){ 3748 var style = ASPx.GetCurrentStyle(curEl); 3749 if(curEl.tagName == "DIV" && style.overflow != "visible") 3750 pos += ASPx.PxToInt(style.borderLeftWidth); 3751 } 3752 isFirstCycle = false; 3753 curEl = curEl.offsetParent; 3754 } 3755 return pos; 3756} 3757function getAbsolutePositionX_Other(curEl){ 3758 var pos = 0; 3759 var isFirstCycle = true; 3760 while(curEl != null) { 3761 pos += curEl.offsetLeft; 3762 if(!isFirstCycle && curEl.offsetParent != null) 3763 pos -= curEl.scrollLeft; 3764 isFirstCycle = false; 3765 curEl = curEl.offsetParent; 3766 } 3767 return pos; 3768} 3769ASPx.GetAbsolutePositionY = function(element){ 3770 if(Browser.Firefox && Browser.Version >= 3) 3771 return getAbsolutePositionY_FF3(element); 3772 else if(Browser.Opera) 3773 return getAbsolutePositionY_Opera(element); 3774 else if(Browser.NetscapeFamily && (!Browser.Firefox || Browser.Version < 3)) 3775 return getAbsolutePositionY_NS(element); 3776 else if(Browser.WebKitFamily || Browser.Edge) 3777 return getAbsolutePositionY_FF3(element); 3778 else 3779 return getAbsolutePositionY_Other(element); 3780}; 3781function getAbsolutePositionY_Opera(curEl){ 3782 var isFirstCycle = true; 3783 if(curEl && curEl.tagName == "TR" && curEl.cells.length > 0) 3784 curEl = curEl.cells[0]; 3785 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false); 3786 while(curEl != null) { 3787 pos += curEl.offsetTop; 3788 if(!isFirstCycle) 3789 pos -= curEl.scrollTop; 3790 curEl = curEl.offsetParent; 3791 isFirstCycle = false; 3792 } 3793 pos += document.body.scrollTop; 3794 return pos; 3795} 3796function getAbsolutePositionY_FF3(element){ 3797 if(element == null) return 0; 3798 var y = element.getBoundingClientRect().top + ASPx.GetDocumentScrollTop(); 3799 return y; 3800} 3801function getAbsolutePositionY_NS(curEl){ 3802 var pos = getAbsoluteScrollOffset_OperaFF(curEl, false); 3803 var isFirstCycle = true; 3804 while(curEl != null) { 3805 pos += curEl.offsetTop; 3806 if(!isFirstCycle && curEl.offsetParent != null) 3807 pos -= curEl.scrollTop; 3808 if(!isFirstCycle && Browser.Firefox){ 3809 var style = ASPx.GetCurrentStyle(curEl); 3810 if(curEl.tagName == "DIV" && style.overflow != "visible") 3811 pos += ASPx.PxToInt(style.borderTopWidth); 3812 } 3813 isFirstCycle = false; 3814 curEl = curEl.offsetParent; 3815 } 3816 return pos; 3817} 3818function getAbsoluteScrollOffset_OperaFF(curEl, isX) { 3819 var pos = 0; 3820 var isFirstCycle = true; 3821 while(curEl != null) { 3822 if(curEl.tagName == "BODY") 3823 break; 3824 var style = ASPx.GetCurrentStyle(curEl); 3825 if(style.position == "absolute") 3826 break; 3827 if(!isFirstCycle && curEl.tagName == "DIV" && (style.position == "" || style.position == "static")) 3828 pos -= isX ? curEl.scrollLeft : curEl.scrollTop; 3829 curEl = curEl.parentNode; 3830 isFirstCycle = false; 3831 } 3832 return pos; 3833} 3834function getAbsolutePositionY_Other(curEl){ 3835 var pos = 0; 3836 var isFirstCycle = true; 3837 while(curEl != null) { 3838 pos += curEl.offsetTop; 3839 if(!isFirstCycle && curEl.offsetParent != null) 3840 pos -= curEl.scrollTop; 3841 isFirstCycle = false; 3842 curEl = curEl.offsetParent; 3843 } 3844 return pos; 3845} 3846function createElementMock(element) { 3847 var div = document.createElement('DIV'); 3848 div.style.top = "0px";
3849 div.style.left = "0px"; 3850 div.visibility = "hidden"; 3851 div.style.position = ASPx.GetCurrentStyle(element).position; 3852 return div; 3853} 3854ASPx.PrepareClientPosElementForOtherParent = function(pos, element, otherParent, isX) { 3855 if(element.parentNode == otherParent) 3856 return ASPx.PrepareClientPosForElement(pos, element, isX); 3857 var elementMock = createElementMock(element); 3858 otherParent.appendChild(elementMock); 3859 var preparedPos = ASPx.PrepareClientPosForElement(pos, elementMock, isX); 3860 otherParent.removeChild(elementMock); 3861 return preparedPos; 3862}; 3863ASPx.PrepareClientPosForElement = function(pos, element, isX) { 3864 pos -= ASPx.GetPositionElementOffset(element, isX); 3865 return pos; 3866}; 3867function getExperimentalPositionOffset(element, isX) { 3868 var div = createElementMock(element); 3869 if(div.style.position == "static") 3870 div.style.position = "absolute"; 3871 element.parentNode.appendChild(div); 3872 var realPos = isX ? ASPx.GetAbsoluteX(div) : ASPx.GetAbsoluteY(div); 3873 element.parentNode.removeChild(div); 3874 return realPos; 3875} 3876ASPx.GetPositionElementOffset = function(element, isX) { 3877 return getExperimentalPositionOffset(element, isX); 3878}; 3879ASPx.GetSizeOfText = function(text, textCss) { 3880 var testContainer = document.createElement("tester"); 3881 var defaultLineHeight = ASPx.Browser.Firefox ? "1" : ""; 3882 testContainer.style.fontSize = textCss.fontSize; 3883 testContainer.style.fontFamily = textCss.fontFamily; 3884 testContainer.style.fontWeight = textCss.fontWeight; 3885 testContainer.style.letterSpacing = textCss.letterSpacing; 3886 testContainer.style.lineHeight = textCss.lineHeight || defaultLineHeight; 3887 testContainer.style.position = "absolute"; 3888 testContainer.style.top = ASPx.InvalidPosition + "px"; 3889 testContainer.style.left = ASPx.InvalidPosition + "px"; 3890 testContainer.style.width = "auto"; 3891 testContainer.style.whiteSpace = "nowrap"; 3892 testContainer.appendChild(document.createTextNode(text)); 3893 var testElement = document.body.appendChild(testContainer); 3894 var size = { 3895 "width": testElement.offsetWidth, 3896 "height": testElement.offsetHeight 3897 }; 3898 document.body.removeChild(testElement); 3899 return size; 3900}; 3901ASPx.PointToPixel = function(points, addPx) { 3902 var result = 0; 3903 try { 3904 var indexOfPt = points.toLowerCase().indexOf("pt"); 3905 if(indexOfPt > -1) 3906 result = parseInt(points.substr(0, indexOfPt)) * 96 / 72; 3907 else 3908 result = parseInt(points) * 96 / 72; 3909 if(addPx) 3910 result = result + "px"; 3911 } catch(e) {} 3912 return result; 3913}; 3914ASPx.PixelToPoint = function(pixels, addPt) { 3915 var result = 0; 3916 try { 3917 var indexOfPx = pixels.toLowerCase().indexOf("px"); 3918 if(indexOfPx > -1) 3919 result = parseInt(pixels.substr(0, indexOfPx)) * 72 / 96; 3920 else 3921 result = parseInt(pixels) * 72 / 96; 3922 if(addPt) 3923 result = result + "pt"; 3924 } catch(e) {} 3925 return result; 3926}; 3927ASPx.PxToInt = function(px) { 3928 return pxToNumber(px, parseInt); 3929}; 3930ASPx.PxToFloat = function(px) { 3931 return pxToNumber(px, parseFloat); 3932}; 3933function pxToNumber(px, parseFunction) { 3934 var result = 0; 3935 if(px != null && px != "") { 3936 try { 3937 var indexOfPx = px.indexOf("px"); 3938 if(indexOfPx > -1) 3939 result = parseFunction(px.substr(0, indexOfPx)); 3940 } catch(e) { } 3941 } 3942 return result; 3943} 3944ASPx.PercentageToFloat = function(perc) { 3945 var result = 0; 3946 if(perc != null && perc != "") { 3947 try { 3948 var indexOfPerc = perc.indexOf("%"); 3949 if(indexOfPerc > -1) 3950 result = parseFloat(perc.substr(0, indexOfPerc)) / 100; 3951 } catch(e) { } 3952 } 3953 return result; 3954}; 3955ASPx.CreateGuid = function() { 3956 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { 3957 var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8; 3958 return v.toString(16); 3959 }); 3960}; 3961ASPx.GetLeftRightBordersAndPaddingsSummaryValue = function(element, currentStyle) { 3962 return ASPx.GetLeftRightPaddings(element, currentStyle) + ASPx.GetHorizontalBordersWidth(element, currentStyle); 3963}; 3964ASPx.GetTopBottomBordersAndPaddingsSummaryValue = function(element, currentStyle) { 3965 return ASPx.GetTopBottomPaddings(element, currentStyle) + ASPx.GetVerticalBordersWidth(element, currentStyle); 3966}; 3967ASPx.GetVerticalBordersWidth = function(element, style) { 3968 if(!ASPx.IsExists(style)) 3969 style = ASPx.GetCurrentStyle(element); 3970 var res = 0; 3971 if(style.borderTopStyle != "none") 3972 res += ASPx.PxToFloat(style.borderTopWidth); 3973 if(style.borderBottomStyle != "none") 3974 res += ASPx.PxToFloat(style.borderBottomWidth);
3975 return res; 3976}; 3977ASPx.GetHorizontalBordersWidth = function(element, style) { 3978 if(!ASPx.IsExists(style)) 3979 style = ASPx.GetCurrentStyle(element); 3980 var res = 0; 3981 if(style.borderLeftStyle != "none") 3982 res += ASPx.PxToFloat(style.borderLeftWidth); 3983 if(style.borderRightStyle != "none") 3984 res += ASPx.PxToFloat(style.borderRightWidth); 3985 return res; 3986}; 3987ASPx.GetTopBottomPaddings = function(element, style) { 3988 var currentStyle = style ? style : ASPx.GetCurrentStyle(element); 3989 return ASPx.PxToInt(currentStyle.paddingTop) + ASPx.PxToInt(currentStyle.paddingBottom); 3990}; 3991ASPx.GetTopPaddings = function(element, style) { 3992 var currentStyle = style ? style : ASPx.GetCurrentStyle(element); 3993 return ASPx.PxToInt(currentStyle.paddingTop); 3994}; 3995ASPx.GetBottomPaddings = function(element, style) { 3996 var currentStyle = style ? style : ASPx.GetCurrentStyle(element); 3997 return ASPx.PxToInt(currentStyle.paddingBottom); 3998}; 3999ASPx.GetLeftRightPaddings = function(element, style) { 4000 var currentStyle = style ? style : ASPx.GetCurrentStyle(element); 4001 return ASPx.PxToInt(currentStyle.paddingLeft) + ASPx.PxToInt(currentStyle.paddingRight); 4002}; 4003ASPx.GetTopBottomMargins = function(element, style) { 4004 var currentStyle = style ? style : ASPx.GetCurrentStyle(element); 4005 return ASPx.PxToInt(currentStyle.marginTop) + ASPx.PxToInt(currentStyle.marginBottom); 4006}; 4007ASPx.GetLeftRightMargins = function(element, style) { 4008 var currentStyle = style ? style : ASPx.GetCurrentStyle(element); 4009 return ASPx.PxToInt(currentStyle.marginLeft) + ASPx.PxToInt(currentStyle.marginRight); 4010}; 4011ASPx.GetClearClientWidth = function(element) { 4012 return ASPx.GetElementOffsetWidth(element)- ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element); 4013}; 4014ASPx.GetClearClientHeight = function(element) { 4015 return ASPx.GetElementOffsetHeight(element) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element); 4016}; 4017ASPx.SetOffsetWidth = function(element, widthValue, currentStyle) { 4018 if(!ASPx.IsExists(currentStyle)) 4019 currentStyle = ASPx.GetCurrentStyle(element); 4020 var value = widthValue - ASPx.PxToInt(currentStyle.marginLeft) - ASPx.PxToInt(currentStyle.marginRight); 4021 value -= ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element, currentStyle); 4022 if(value > -1) 4023 element.style.width = value + "px"; 4024}; 4025ASPx.SetOffsetHeight = function(element, heightValue, currentStyle) { 4026 if(!ASPx.IsExists(currentStyle)) 4027 currentStyle = ASPx.GetCurrentStyle(element); 4028 var value = heightValue - ASPx.PxToInt(currentStyle.marginTop) - ASPx.PxToInt(currentStyle.marginBottom); 4029 value -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle); 4030 if(value > -1) 4031 element.style.height = value + "px"; 4032}; 4033ASPx.FindOffsetParent = function(element) { 4034 var currentElement = element.parentNode; 4035 while(ASPx.IsExistsElement(currentElement) && currentElement.tagName != "BODY") { 4036 if(ASPx.GetElementOffsetWidth(currentElement) > 0 && ASPx.GetElementOffsetHeight(currentElement) > 0) 4037 return currentElement; 4038 currentElement = currentElement.parentNode; 4039 } 4040 return document.body; 4041}; 4042ASPx.GetDocumentScrollTop = function(){ 4043 if(Browser.WebKitFamily || Browser.Edge) { 4044 if(Browser.MacOSMobilePlatform) 4045 return window.pageYOffset; 4046 if(Browser.WebKitFamily) 4047 return document.documentElement.scrollTop || document.body.scrollTop; 4048 return document.body.scrollTop; 4049 } 4050 else 4051 return document.documentElement.scrollTop; 4052}; 4053ASPx.SetDocumentScrollTop = function(scrollTop) { 4054 if(!Browser.MacOSMobilePlatform && (Browser.Safari || (Browser.Chrome && Browser.Version < 60) || (Browser.Opera && Browser.MajorVersion >= 15) || Browser.Edge)) 4055 document.body.scrollTop = scrollTop; 4056 else 4057 document.documentElement.scrollTop = scrollTop; 4058}; 4059ASPx.GetDocumentScrollLeft = function(){ 4060 if(Browser.Edge) 4061 return document.body ? document.body.scrollLeft : document.documentElement.scrollLeft; 4062 if(Browser.WebKitFamily) 4063 return document.documentElement.scrollLeft || document.body.scrollLeft; 4064 return document.documentElement.scrollLeft; 4065}; 4066ASPx.SetDocumentScrollLeft = function (scrollLeft) { 4067 if(!Browser.MacOSMobilePlatform && (Browser.Safari || (Browser.Chrome && Browser.Version < 60) || (Browser.Opera && Browser.MajorVersion >= 15) || Browser.Edge)) 4068 document.body.scrollLeft = scrollLeft; 4069 else
4070 document.documentElement.scrollLeft = scrollLeft; 4071}; 4072ASPx.GetDocumentClientWidth = function(){ 4073 if(document.documentElement.clientWidth == 0) 4074 return document.body.clientWidth; 4075 else 4076 return document.documentElement.clientWidth; 4077}; 4078ASPx.GetDocumentClientHeight = function() { 4079 if(Browser.Firefox && window.innerHeight - document.documentElement.clientHeight > ASPx.GetVerticalScrollBarWidth()) { 4080 return window.innerHeight; 4081 } else if(Browser.Opera && Browser.Version < 9.6 || document.documentElement.clientHeight == 0) { 4082 return document.body.clientHeight; 4083 } 4084 return document.documentElement.clientHeight; 4085}; 4086ASPx.GetDocumentWidth = function(){ 4087 var bodyWidth = document.body.offsetWidth; 4088 var docWidth = document.documentElement.offsetWidth; 4089 var bodyScrollWidth = document.body.scrollWidth; 4090 var docScrollWidth = document.documentElement.scrollWidth; 4091 return getMaxDimensionOf(bodyWidth, docWidth, bodyScrollWidth, docScrollWidth); 4092}; 4093ASPx.GetDocumentHeight = function(){ 4094 var bodyHeight = document.body.offsetHeight; 4095 var docHeight = document.documentElement.offsetHeight; 4096 var bodyScrollHeight = document.body.scrollHeight; 4097 var docScrollHeight = document.documentElement.scrollHeight; 4098 var maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight, docScrollHeight); 4099 if(Browser.Opera && Browser.Version >= 9.6){ 4100 if(Browser.Version < 10) 4101 maxHeight = getMaxDimensionOf(bodyHeight, docHeight, bodyScrollHeight); 4102 var visibleHeightOfDocument = document.documentElement.clientHeight; 4103 if(maxHeight > visibleHeightOfDocument) 4104 maxHeight = getMaxDimensionOf(window.outerHeight, maxHeight); 4105 else 4106 maxHeight = document.documentElement.clientHeight; 4107 return maxHeight; 4108 } 4109 return maxHeight; 4110}; 4111ASPx.GetDocumentMaxClientWidth = function(){ 4112 var bodyWidth = document.body.offsetWidth; 4113 var docWidth = document.documentElement.offsetWidth; 4114 var docClientWidth = document.documentElement.clientWidth; 4115 return getMaxDimensionOf(bodyWidth, docWidth, docClientWidth); 4116}; 4117ASPx.GetDocumentMaxClientHeight = function(){ 4118 var bodyHeight = document.body.offsetHeight; 4119 var docHeight = document.documentElement.offsetHeight; 4120 var docClientHeight = document.documentElement.clientHeight; 4121 return getMaxDimensionOf(bodyHeight, docHeight, docClientHeight); 4122}; 4123ASPx.verticalScrollIsNotHidden = null; 4124ASPx.horizontalScrollIsNotHidden = null; 4125ASPx.GetVerticalScrollIsNotHidden = function() { 4126 if(!ASPx.IsExists(ASPx.verticalScrollIsNotHidden)) 4127 ASPx.verticalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden" 4128 && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden"; 4129 return ASPx.verticalScrollIsNotHidden; 4130}; 4131ASPx.GetHorizontalScrollIsNotHidden = function() { 4132 if(!ASPx.IsExists(ASPx.horizontalScrollIsNotHidden)) 4133 ASPx.horizontalScrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowX !== "hidden" 4134 && ASPx.GetCurrentStyle(document.documentElement).overflowX !== "hidden"; 4135 return ASPx.horizontalScrollIsNotHidden; 4136}; 4137ASPx.GetCurrentDocumentWidth = function() { 4138 var result = ASPx.GetDocumentClientWidth(); 4139 if(!ASPx.Browser.Safari && ASPx.GetVerticalScrollIsNotHidden() && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight()) 4140 result += ASPx.GetVerticalScrollBarWidth(); 4141 return result; 4142}; 4143ASPx.GetCurrentDocumentHeight = function() { 4144 var result = ASPx.GetDocumentClientHeight(); 4145 if(!ASPx.Browser.Safari && ASPx.GetHorizontalScrollIsNotHidden() && ASPx.GetDocumentWidth() > ASPx.GetDocumentClientWidth()) 4146 result += ASPx.GetVerticalScrollBarWidth(); 4147 return result; 4148}; 4149function getMaxDimensionOf(){ 4150 var max = ASPx.InvalidDimension; 4151 for(var i = 0; i < arguments.length; i++){ 4152 if(max < arguments[i]) 4153 max = arguments[i]; 4154 } 4155 return max; 4156} 4157ASPx.GetClientLeft = function(element) { 4158 return ASPx.IsExists(element.clientLeft) ? element.clientLeft : (ASPx.GetElementOffsetWidth(element)- element.clientWidth) / 2; 4159}; 4160ASPx.GetClientTop = function(element) { 4161 return ASPx.IsExists(element.clientTop) ? element.clientTop : (ASPx.GetElementOffsetHeight(element) - element.clientHeight) / 2; 4162}; 4163var requestAnimationFrameFunc = window.requestAnimationFrame || function(callback) { callback(); }; 4164var cancelAnimationFrameFunc = window.cancelAnimationFrame || function(id) { }; 4165ASPx.CancelAnimationFrame = function(id) { cancelAnimationFrameFunc(id); }; 4166ASPx.RequestAnimationFrame = function (callback) { return requestAnimationFrameFunc(callback); }; 4167ASPx.SetStyles = function(element, styles, makeImportant) { 4168 if(ASPx.IsExists(styles.cssText)) 4169 element.style.cssText = styles.cssText; 4170 if(ASPx.IsExists(styles.className)) { 4171 ASPx.SetClassName(element, styles.className); 4172 } 4173 for(var property in styles) { 4174 if(!styles.hasOwnProperty(property)) 4175 continue; 4176 var value = styles[property]; 4177 switch (property) { 4178 case "cssText": 4179 case "className": 4180 break; 4181 case "float": 4182 ASPx.SetElementFloat(element, value); 4183 break; 4184 case "opacity": 4185 ASPx.SetElementOpacity(element, value); 4186 break; 4187 case "zIndex": 4188 ASPx.SetStylesCore(element, property, value, makeImportant); 4189 break; 4190 default: 4191 ASPx.SetStylesCore(element, property, value + (typeof (value) == "number" ? "px" : ""), makeImportant); 4192 } 4193 } 4194}; 4195ASPx.SetStylesCore = function(element, property, value, makeImportant) { 4196 if(makeImportant) { 4197 var index = property.search("[A-Z]"); 4198 if(index != -1) 4199 property = property.replace(property.charAt(index), "-" + property.charAt(index).toLowerCase()); 4200 if(element.style.setProperty) 4201 element.style.setProperty(property, value, "important"); 4202 else 4203 element.style.cssText += ";" + property + ":" + value + "!important"; 4204 } 4205 else 4206 element.style[property] = value; 4207}; 4208ASPx.RemoveBordersAndShadows = function(el) { 4209 if(!el || !el.style) 4210 return; 4211 el.style.borderWidth = 0; 4212 if(ASPx.IsExists(el.style.boxShadow)) 4213 el.style.boxShadow = "none"; 4214 else if(ASPx.IsExists(el.style.MozBoxShadow)) 4215 el.style.MozBoxShadow = "none"; 4216 else if(ASPx.IsExists(el.style.webkitBoxShadow)) 4217 el.style.webkitBoxShadow = "none"; 4218}; 4219ASPx.GetCellSpacing = function(element) { 4220 var val = parseInt(element.cellSpacing); 4221 if(!isNaN(val)) return val; 4222 val = parseInt(ASPx.GetCurrentStyle(element).borderSpacing); 4223 if(!isNaN(val)) return val; 4224 return 0; 4225}; 4226ASPx.GetInnerScrollPositions = function(element) { 4227 var scrolls = []; 4228 getInnerScrollPositionsCore(element, scrolls); 4229 return scrolls; 4230}; 4231function getInnerScrollPositionsCore(element, scrolls) { 4232 for(var child = element.firstChild; child; child = child.nextSibling) { 4233 var scrollTop = child.scrollTop, 4234 scrollLeft = child.scrollLeft; 4235 if(scrollTop > 0 || scrollLeft > 0) 4236 scrolls.push([child, scrollTop, scrollLeft]); 4237 getInnerScrollPositionsCore(child, scrolls); 4238 } 4239} 4240ASPx.RestoreInnerScrollPositions = function(scrolls) { 4241 for(var i = 0, scrollArr; scrollArr = scrolls[i]; i++) { 4242 if(scrollArr[1] > 0) 4243 scrollArr[0].scrollTop = scrollArr[1]; 4244 if(scrollArr[2] > 0) 4245 scrollArr[0].scrollLeft = scrollArr[2]; 4246 } 4247}; 4248ASPx.GetOuterScrollPosition = function(element) { 4249 while(element && element.tagName !== "BODY") { 4250 var scrollTop = element.scrollTop, 4251 scrollLeft = element.scrollLeft; 4252 if(scrollTop > 0 || scrollLeft > 0) { 4253 return { 4254 scrollTop: scrollTop, 4255 scrollLeft: scrollLeft, 4256 element: element 4257 }; 4258 } 4259 element = element.parentNode; 4260 } 4261 return { 4262 scrollTop: ASPx.GetDocumentScrollTop(), 4263 scrollLeft: ASPx.GetDocumentScrollLeft() 4264 }; 4265}; 4266ASPx.RestoreOuterScrollPosition = function(scrollInfo) { 4267 if(scrollInfo.element) { 4268 if(scrollInfo.scrollTop > 0) 4269 scrollInfo.element.scrollTop = scrollInfo.scrollTop; 4270 if(scrollInfo.scrollLeft > 0) 4271 scrollInfo.element.scrollLeft = scrollInfo.scrollLeft; 4272 } 4273 else { 4274 if(scrollInfo.scrollTop > 0) 4275 ASPx.SetDocumentScrollTop(scrollInfo.scrollTop); 4276 if(scrollInfo.scrollLeft > 0) 4277 ASPx.SetDocumentScrollLeft(scrollInfo.scrollLeft); 4278 } 4279}; 4280ASPx.ChangeElementContainer = function(element, container, savePreviousContainer) { 4281 if(element.parentNode != container) { 4282 var parentNode = element.parentNode; 4283 parentNode.removeChild(element);
4284 container.appendChild(element); 4285 if(savePreviousContainer) 4286 element.previousContainer = parentNode; 4287 } 4288}; 4289ASPx.RestoreElementContainer = function(element) { 4290 if(element.previousContainer) { 4291 ASPx.ChangeElementContainer(element, element.previousContainer, false); 4292 element.previousContainer = null; 4293 } 4294}; 4295ASPx.MoveChildrenToElement = function(sourceElement, destinationElement){ 4296 while(sourceElement.childNodes.length > 0) 4297 destinationElement.appendChild(sourceElement.childNodes[0]); 4298}; 4299ASPx.GetScriptCode = function(script) { 4300 var useFirstChildElement = Browser.Chrome && Browser.Version < 11 || Browser.Safari && Browser.Version < 5; 4301 var text = useFirstChildElement ? script.firstChild.data : script.text; 4302 var comment = "<!--"; 4303 var pos = text.indexOf(comment); 4304 if(pos > -1) 4305 text = text.substr(pos + comment.length); 4306 return text; 4307}; 4308ASPx.AppendScript = function(script) { 4309 var parent = document.getElementsByTagName("head")[0]; 4310 if(!parent) 4311 parent = document.body; 4312 if(parent) 4313 parent.appendChild(script); 4314}; 4315function getFrame(frames, name) { 4316 if(frames[name]) 4317 return frames[name]; 4318 for(var i = 0; i < frames.length; i++) { 4319 try { 4320 var frame = frames[i]; 4321 if(frame.name == name) 4322 return frame; 4323 frame = getFrame(frame.frames, name); 4324 if(frame != null) 4325 return frame; 4326 } catch(e) { 4327 } 4328 } 4329 return null; 4330} 4331ASPx.IsValidElement = function(element) { 4332 if(!element) 4333 return false; 4334 if(!(Browser.Firefox && Browser.Version < 4)) { 4335 if(element.ownerDocument && element.ownerDocument.body && element.ownerDocument.body.compareDocumentPosition) 4336 return element.ownerDocument.body.compareDocumentPosition(element) % 2 === 0; 4337 } 4338 if(!Browser.Opera && element.offsetParent && element.parentNode.tagName) 4339 return true; 4340 while(element != null){ 4341 if(element.tagName == "BODY") 4342 return true; 4343 element = element.parentNode; 4344 } 4345 return false; 4346}; 4347ASPx.IsValidElements = function(elements) { 4348 if(!elements) 4349 return false; 4350 for(var i = 0; i < elements.length; i++) { 4351 if(elements[i] && !ASPx.IsValidElement(elements[i])) 4352 return false; 4353 } 4354 return true; 4355}; 4356ASPx.IsExistsElement = function(element) { 4357 return element && ASPx.IsValidElement(element); 4358}; 4359ASPx.CreateHtmlElementFromString = function(str) { 4360 var dummy = ASPx.CreateHtmlElement(); 4361 setInnerHtmlInternal(dummy, str); 4362 return dummy.firstChild; 4363}; 4364ASPx.CreateHtmlElement = function(tagName, styles) { 4365 var element = document.createElement(tagName || "DIV"); 4366 if(styles) 4367 ASPx.SetStyles(element, styles); 4368 return element; 4369}; 4370ASPx.RestoreElementOriginalWidth = function(element) { 4371 if(!ASPx.IsExistsElement(element)) 4372 return; 4373 element.style.width = element.dxOrigWidth = ASPx.GetElementOriginalWidth(element); 4374}; 4375ASPx.GetElementOriginalWidth = function(element) { 4376 if(!ASPx.IsExistsElement(element)) 4377 return null; 4378 var width; 4379 if(!ASPx.IsExists(element.dxOrigWidth)) { 4380 width = String(element.style.width).length > 0 4381 ? element.style.width 4382 : ASPx.GetElementOffsetWidth(element) + "px"; 4383 } else { 4384 width = element.dxOrigWidth; 4385 } 4386 return width; 4387}; 4388ASPx.DropElementOriginalWidth = function(element) { 4389 if(ASPx.IsExists(element.dxOrigWidth)) 4390 element.dxOrigWidth = null; 4391}; 4392ASPx.GetObjectKeys = function(obj) { 4393 if(!obj) return [ ]; 4394 if(Object.keys) 4395 return Object.keys(obj); 4396 var keys = [ ]; 4397 for(var key in obj) { 4398 if(obj.hasOwnProperty(key)) 4399 keys.push(key); 4400 } 4401 return keys; 4402}; 4403ASPx.ShowErrorAlert = function(message) { 4404 message = ASPx.Str.DecodeHtmlViaTextArea(message); 4405 if(ASPx.IsExists(message) && message !== "") 4406 alert(message); 4407}; 4408ASPx.ShowKBErrorMessage = function(text, kbid) { 4409 ASPx.ShowErrorMessage(text + "https://www.devexpress.com/kbid=" + kbid + "."); 4410}; 4411ASPx.ShowErrorMessage = function(errorMessage) { 4412 var console = window.console; 4413 if(!console || !ASPx.IsFunction(console.error)) 4414 return; 4415 console.error(errorMessage); 4416}; 4417ASPx.IsInteractiveControl = function(element, extremeParent) { 4418 return Data.ArrayIndexOf(["A", "INPUT", "SELECT", "OPTION", "TEXTAREA", "BUTTON", "IFRAME"], element.tagName) > -1; 4419};
4420ASPx.IsUrlContainsClientScript = function(url) { 4421 return url.toLowerCase().indexOf("javascript:") !== -1; 4422}; 4423ASPx.GetMSAjaxRequestManager = function() { 4424 if(window.Sys && Sys.WebForms && Sys.WebForms.PageRequestManager && Sys.WebForms.PageRequestManager.getInstance) 4425 return Sys.WebForms.PageRequestManager.getInstance(); 4426 return null; 4427}; 4428Function.prototype.aspxBind = function(scope) { 4429 var func = this; 4430 return function() { 4431 return func.apply(scope, arguments); 4432 }; 4433}; 4434var FilteringUtils = { }; 4435FilteringUtils.EventKeyCodeChangesTheInput = function(evt) { 4436 if(ASPx.IsPasteShortcut(evt)) 4437 return true; 4438 else if(evt.ctrlKey && !evt.altKey) 4439 return false; 4440 if(ASPx.Browser.AndroidMobilePlatform || ASPx.Browser.MacOSMobilePlatform) return true; 4441 var keyCode = ASPx.Evt.GetKeyCode(evt); 4442 var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu; 4443 var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 4444 return ASPx.Key.Delete <= keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Backspace || keyCode == ASPx.Key.Space; 4445}; 4446FilteringUtils.FormatCallbackArg = function(prefix, arg) { 4447 return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : ""); 4448}; 4449ASPx.FilteringUtils = FilteringUtils; 4450var FormatStringHelper = { }; 4451FormatStringHelper.PlaceHolderTemplateStruct = function(startIndex, length, index, placeHolderString){ 4452 this.startIndex = startIndex; 4453 this.realStartIndex = 0; 4454 this.length = length; 4455 this.realLength = 0; 4456 this.index = index; 4457 this.placeHolderString = placeHolderString; 4458}; 4459FormatStringHelper.GetPlaceHolderTemplates = function(formatString){ 4460 formatString = this.CollapseDoubleBrackets(formatString); 4461 var templates = this.CreatePlaceHolderTemplates(formatString); 4462 return templates; 4463}; 4464FormatStringHelper.CreatePlaceHolderTemplates = function(formatString){ 4465 var templates = []; 4466 var templateStrings = formatString.match(/{[^}]+}/g); 4467 if(templateStrings != null){ 4468 var pos = 0; 4469 for(var i = 0; i < templateStrings.length; i++){ 4470 var tempString = templateStrings[i]; 4471 var startIndex = formatString.indexOf(tempString, pos); 4472 var length = tempString.length; 4473 var indexString = tempString.slice(1).match(/^[0-9]+/); 4474 var index = parseInt(indexString); 4475 templates.push(new this.PlaceHolderTemplateStruct(startIndex, length, index, tempString)); 4476 pos = startIndex + length; 4477 } 4478 } 4479 return templates; 4480}; 4481FormatStringHelper.CollapseDoubleBrackets = function(formatString){ 4482 formatString = this.CollapseOpenDoubleBrackets(formatString); 4483 formatString = this.CollapseCloseDoubleBrackets(formatString); 4484 return formatString; 4485}; 4486FormatStringHelper.CollapseOpenDoubleBrackets = function(formatString){ 4487 return formatString.replace(/{{/g, "_"); 4488};
4489FormatStringHelper.CollapseCloseDoubleBrackets = function(formatString){ 4490 while(true){ 4491 var index = formatString.lastIndexOf("}}"); 4492 if(index == -1) 4493 break; 4494 else 4495 formatString = formatString.substr(0, index) + "_" + formatString.substr(index + 2); 4496 } 4497 return formatString; 4498}; 4499ASPx.FormatStringHelper = FormatStringHelper; 4500var StartWithFilteringUtils = { }; 4501StartWithFilteringUtils.HighlightSuggestedText = function(input, suggestedText, control, onChangeInput){ 4502 if(this.NeedToLockAndoidKeyEvents(control)) 4503 control.LockAndroidKeyEvents(); 4504 var selInfo = ASPx.Selection.GetInfo(input); 4505 var currentTextLenght = ASPx.Str.GetCoincideCharCount(suggestedText, input.value, 4506 function(text, filter) { 4507 return text.indexOf(filter) == 0; 4508 }); 4509 var suggestedTextLenght = suggestedText.length; 4510 var isSelected = selInfo.startPos == 0 && selInfo.endPos == currentTextLenght && 4511 selInfo.endPos == suggestedTextLenght && input.value == suggestedText; 4512 if(!isSelected) { 4513 input.value = suggestedText; 4514 if(onChangeInput) 4515 onChangeInput(); 4516 if(this.NeedToLockAndoidKeyEvents(control)) { 4517 window.setTimeout(function() { 4518 this.SelectText(input, currentTextLenght, suggestedTextLenght); 4519 control.UnlockAndroidKeyEvents(); 4520 }.aspxBind(this), control.adroidSamsungBugTimeout); 4521 } else 4522 this.SelectText(input, currentTextLenght, suggestedTextLenght); 4523 } 4524}; 4525StartWithFilteringUtils.SelectText = function(input, startPos, stopPos) { 4526 if(startPos < stopPos) 4527 ASPx.Selection.Set(input, startPos, stopPos); 4528}; 4529StartWithFilteringUtils.RollbackOneSuggestedChar = function(input){ 4530 var currentText = input.value; 4531 var cutText = currentText.slice(0, -1); 4532 if(cutText != currentText) 4533 input.value = cutText; 4534}; 4535StartWithFilteringUtils.NeedToLockAndoidKeyEvents = function(control) { 4536 return ASPx.Browser.AndroidMobilePlatform && control && control.LockAndroidKeyEvents; 4537}; 4538ASPx.StartWithFilteringUtils = StartWithFilteringUtils; 4539var ContainsFilteringUtils = { }; 4540ContainsFilteringUtils.ColumnSelectionStruct = function(index, startIndex, length){ 4541 this.index = index; 4542 this.length = length; 4543 this.startIndex = startIndex; 4544}; 4545ContainsFilteringUtils.IsFilterCrossPlaseHolder = function(filterStartIndex, filterEndIndex, template) { 4546 var left = Math.max(filterStartIndex, template.realStartIndex); 4547 var right = Math.min(filterEndIndex, template.realStartIndex + template.realLength); 4548 return left < right; 4549}; 4550ContainsFilteringUtils.GetColumnSelectionsForItem = function(itemValues, formatString, filterString) { 4551 if(formatString == "") 4552 return this.GetSelectionForSingleColumnItem(itemValues, filterString); 4553 var result = []; 4554 var formatedString = ASPx.Formatter.Format(formatString, itemValues); 4555 var filterStartIndex = ASPx.Str.PrepareStringForFilter(formatedString).indexOf(ASPx.Str.PrepareStringForFilter(filterString)); 4556 if(filterStartIndex == -1) return result; 4557 var filterEndIndex = filterStartIndex + filterString.length; 4558 var templates = FormatStringHelper.GetPlaceHolderTemplates(formatString); 4559 this.SupplyTemplatesWithRealValues(itemValues, templates); 4560 for(var i = 0; i < templates.length ; i++) { 4561 if(this.IsFilterCrossPlaseHolder(filterStartIndex, filterEndIndex, templates[i])) 4562 result.push(this.GetColumnSelectionsForItemValue(templates[i], filterStartIndex, filterEndIndex)); 4563 } 4564 return result; 4565}; 4566ContainsFilteringUtils.GetColumnSelectionsForItemValue = function(template, filterStartIndex, filterEndIndex) { 4567 var selectedTextStartIndex = filterStartIndex < template.realStartIndex ? 0 : 4568 filterStartIndex - template.realStartIndex; 4569 var selectedTextEndIndex = filterEndIndex > template.realStartIndex + template.realLength ? template.realLength : 4570 filterEndIndex - template.realStartIndex; 4571 var selectedTextLength = selectedTextEndIndex - selectedTextStartIndex; 4572 return new this.ColumnSelectionStruct(template.index, selectedTextStartIndex, selectedTextLength); 4573}; 4574ContainsFilteringUtils.GetSelectionForSingleColumnItem = function(itemValues, filterString) { 4575 var selectedTextStartIndex = ASPx.Str.PrepareStringForFilter(itemValues[0]).indexOf(ASPx.Str.PrepareStringForFilter(filterString)); 4576 var selectedTextLength = filterString.length; 4577 return [new this.ColumnSelectionStruct(0, selectedTextStartIndex, selectedTextLength)];
4578}; 4579ContainsFilteringUtils.ResetFormatStringIndex = function(formatString, index) { 4580 if(index != 0) 4581 return formatString.replace(index.toString(), "0"); 4582 return formatString; 4583}; 4584ContainsFilteringUtils.SupplyTemplatesWithRealValues = function(itemValues, templates) { 4585 var shift = 0; 4586 for(var i = 0; i < templates.length; i++) { 4587 var formatString = this.ResetFormatStringIndex(templates[i].placeHolderString, templates[i].index); 4588 var currentItemValue = itemValues[templates[i].index]; 4589 templates[i].realLength = ASPx.Formatter.Format(formatString, currentItemValue).length; 4590 templates[i].realStartIndex += templates[i].startIndex + shift; 4591 shift += templates[i].realLength - templates[i].placeHolderString.length; 4592 } 4593}; 4594ContainsFilteringUtils.PrepareElementText = function(itemText) { 4595 return itemText ? itemText.replace(/\&/g, "&").replace(/</g, "<").replace(/>/g, ">") : ''; 4596}; 4597ContainsFilteringUtils.UnselectContainsTextInElement = function(element, selection, highlightTagName) { 4598 var currentText = ASPx.Attr.GetAttribute (element, "DXText"); 4599 if(ASPx.IsExists(currentText)) { 4600 currentText = ContainsFilteringUtils.PrepareElementText(currentText); 4601 ASPx.Security.setInnerHtml(element, currentText === "" ? " " : currentText, ASPx.Security.DataType.Trusted); 4602 } 4603}; 4604ContainsFilteringUtils.ReselectContainsTextInElement = function(element, selection, highlightTagName) { 4605 var currentText = ASPx.GetInnerText(element); 4606 if(!highlightTagName) 4607 highlightTagName = "em"; 4608 highlightTagName = highlightTagName.toLowerCase(); 4609 if(currentText.indexOf("</" + highlightTagName + ">") != -1) 4610 ContainsFilteringUtils.UnselectContainsTextInElement(element, selection, highlightTagName); 4611 return ContainsFilteringUtils.SelectContainsTextInElement(element, selection, highlightTagName); 4612}; 4613ContainsFilteringUtils.SelectContainsTextInElement = function(element, selection, highlightTagName) { 4614 if(selection.startIndex == -1) 4615 return; 4616 var currentText = ASPx.Attr.GetAttribute (element, "DXText"); 4617 if(!ASPx.IsExists(currentText)) ASPx.Attr.SetAttribute (element, "DXText", ASPx.GetInnerText(element)); 4618 if(!highlightTagName) 4619 highlightTagName = "em"; 4620 highlightTagName = highlightTagName.toLowerCase(); 4621 var oldInnerText = ASPx.GetInnerText(element); 4622 var newInnerText = ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(0, selection.startIndex)) + "<" + highlightTagName + ">" + 4623 ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(selection.startIndex, selection.length)) + "</" + highlightTagName + ">" + 4624 ContainsFilteringUtils.PrepareElementText(oldInnerText.substr(selection.startIndex + selection.length)); 4625 ASPx.Security.setInnerHtml(element, newInnerText, ASPx.Security.DataType.Trusted); 4626}; 4627ASPx.ContainsFilteringUtils = ContainsFilteringUtils; 4628ASPx.MakeEqualControlsWidth = function(name1, name2){ 4629 var control1 = ASPx.GetControlCollection().Get(name1); 4630 var control2 = ASPx.GetControlCollection().Get(name2); 4631 if(control1 && control2){ 4632 var width = Math.max(control1.GetWidth(), control2.GetWidth()); 4633 control1.SetWidth(width); 4634 control2.SetWidth(width); 4635 } 4636}; 4637ASPx.HighContrastForeColorHighlightColorMap = { 4638 "#ffff00" : "#008000", 4639 "#00ff00" : "#0000ff", 4640 "#ffffff" : "#00838f", 4641 "#000000" : "#a347ff" 4642}; 4643var BadgeManagerBase = ASPx.CreateClass(null, { 4644 createBadge: function(text, iconCssClass) { 4645 var badge = document.createElement("SPAN"); 4646 ASPx.SetClassName(badge, this.getBadgeClassName()); 4647 if(iconCssClass && iconCssClass.length) 4648 this.setBadgeIconCssClass(badge, iconCssClass); 4649 if(text && text.length) 4650 this.setBadgeText(badge, text); 4651 return badge; 4652 }, 4653 findBadge: function(element) { 4654 if(!element) 4655 return null; 4656 return element.querySelector("." + this.getBadgeClassName()); 4657 }, 4658 setBadgeIconCssClass: function(badge, iconCssClass) { 4659 if(!badge || iconCssClass === undefined) 4660 return; 4661 var iconElement = this.getBadgeIconElement(badge); 4662 if(!iconCssClass) { 4663 if(iconElement) 4664 badge.removeChild(iconElement); 4665 } 4666 else { 4667 if(!iconElement) { 4668 iconElement = document.createElement("SPAN"); 4669 badge.insertBefore(iconElement, badge.childNodes[0]); 4670 } 4671 ASPx.SetClassName(iconElement, iconCssClass + " " + this.getBadgeIconDefaultClassName()); 4672 } 4673 }, 4674 getBadgeIconCssClass: function(element) { 4675 var badge = this.findBadge(element); 4676 if(badge) { 4677 var iconElement = this.getBadgeIconElement(badge); 4678 var regEx = new RegExp("(?:^|\\s)" + this.getBadgeIconDefaultClassName() + "(?!\\S)"); 4679 return iconElement ? ASPx.Str.Trim(ASPx.GetClassName(iconElement).replace(regEx, "")) : ""; 4680 } 4681 return ""; 4682 }, 4683 setBadgeText: function(badge, text) { 4684 if(!badge || text === undefined) 4685 return; 4686 var textElement = this.getBadgeTextElement(badge); 4687 if(!text) { 4688 if(textElement) 4689 badge.removeChild(textElement); 4690 } 4691 else { 4692 if(!textElement) { 4693 textElement = document.createElement("SPAN"); 4694 badge.appendChild(textElement); 4695 } 4696 ASPx.Security.setInnerHtml(textElement, text, ASPx.Security.DataType.Trusted); 4697 } 4698 }, 4699 getBadgeText: function(element) { 4700 var badge = this.findBadge(element); 4701 if(badge) { 4702 var textElement = this.getBadgeTextElement(badge); 4703 return textElement ? ASPx.GetInnerText(textElement) : ""; 4704 } 4705 return ""; 4706 }, 4707 getBadgeClassName: function() { 4708 return ""; 4709 }, 4710 getBadgeIconDefaultClassName: function() { 4711 return ""; 4712 }, 4713 getBadgeIconElement: function(badge) { 4714 return badge.childNodes.length ? badge.querySelector("." + this.getBadgeIconDefaultClassName()) : null; 4715 }, 4716 getBadgeTextElement: function(badge) { 4717 return badge.childNodes.length ? badge.querySelector("span:not(." + this.getBadgeIconDefaultClassName() + ")") : null; 4718 } 4719}); 4720ASPx.BadgeManagerBase = BadgeManagerBase; 4721var BadgeManager = ASPx.CreateClass(BadgeManagerBase, { 4722 getBadgeClassName: function() { 4723 return "dxBadge"; 4724 }, 4725 getBadgeIconDefaultClassName: function() { 4726 return "dxBadgeImage"; 4727 }, 4728 createBadgeForButton: function(button) { 4729 var badge = ASPx.BadgeManager.createBadge(); 4730 var buttonImage = button.GetButtonImage(); 4731 var textContainer = button.GetTextContainer(); 4732 var badgeRightSibling = !!buttonImage ? buttonImage : textContainer; 4733 badgeRightSibling.parentNode.insertBefore(badge, badgeRightSibling); 4734 if(button.IsLink() && buttonImage) 4735 ASPx.SetStyles(badge, { verticalAlign: "middle" }); 4736 return badge; 4737 }, 4738 createBadgeForToolbar: function(toolbarItem) { 4739 var badge = ASPx.BadgeManager.createBadge(); 4740 var itemImage = toolbarItem.GetImage(); 4741 var badgeRightSibling = itemImage; 4742 if(!itemImage) { 4743 var itemContentElement = toolbarItem.menu.GetItemContentElement(toolbarItem.indexPath); 4744 badgeRightSibling = toolbarItem.menu.GetContentTextElement(itemContentElement); 4745 } 4746 badgeRightSibling.parentNode.insertBefore(badge, badgeRightSibling); 4747 return badge; 4748 } 4749}); 4750ASPx.BadgeManager = new BadgeManager(); 4751var AccessibilityUtils = { 4752 isInitialized: false, 4753 highContrastCssClassMarker: "dxHighContrast",
4754 highContrastBackgroundCssClassMarker: "dxHCB", 4755 highContrastDefaultBackgroundColor: "#a347ff", 4756 highContrastThemeActive: false, 4757 accessibleBackgroundCssMarker: ".dx-runtime-background", 4758 createAccessibleBackgrounds: function(control) { 4759 if(!this.highContrastThemeActive || control.accessibleBackgroundsCreated || !control.accessibilityCompliant) 4760 return; 4761 var className = this.accessibleBackgroundCssMarker; 4762 var styleSheetRuleNames = []; 4763 iterateStyleSheetRules(null, function(rule) { 4764 var selectorTxt = rule.selectorText; 4765 if(selectorTxt && selectorTxt.indexOf(className) > -1) 4766 styleSheetRuleNames.push(ASPx.Str.CompleteReplace(selectorTxt, className, "")); 4767 }); 4768 for(var i = 0; i < styleSheetRuleNames.length; i++) { 4769 var name = styleSheetRuleNames[i]; 4770 var rule = ASPx.GetStyleSheetRules(name.substring(1)); 4771 if(rule && rule.style && rule.style.backgroundImage) 4772 this.createAccessibleBackground(control.GetMainElement(), rule.style, name); 4773 } 4774 control.accessibleBackgroundsCreated = true; 4775 }, 4776 createAccessibleBackground: function(container, style, selector) { 4777 if(!container) 4778 return; 4779 var backgroundUrl = style.backgroundImage.substring(5, style.backgroundImage.length - 2); 4780 var elements = container.querySelectorAll(selector); 4781 var accessibleBackgroundClassName = "dx-acc-bi"; 4782 for(var i = 0; i < elements.length; i++) { 4783 var element = elements[i]; 4784 if(ASPx.ElementHasCssClass(element, accessibleBackgroundClassName)) 4785 continue; 4786 var image = null; 4787 if(element.tagName !== "IMG") { 4788 ASPx.AddClassNameToElement(element, accessibleBackgroundClassName); 4789 image = element.ownerDocument.createElement("IMG"); 4790 ASPx.SetStyles(image, { width: "100%", height: "100%" }); 4791 if(element.firstChild) 4792 element.insertBefore(image, element.firstChild); 4793 else 4794 element.appendChild(image); 4795 } else 4796 image = element; 4797 image.src = backgroundUrl; 4798 } 4799 },
4800 createHighContrastBackgroundStyle: function() { 4801 var style = document.createElement('style'); 4802 ASPx.Attr.AppendStyleType(style); 4803 var styleContent = [ 4804 "." + this.highContrastCssClassMarker + " ." + this.highContrastBackgroundCssClassMarker + ":after {", 4805 "border-image: url(" + this.getHighContrastBackgroundUrl() + ") 0 1 0 0 round;", 4806 "}", 4807 ]; 4808 setInnerHtmlInternal(style, styleContent.join('\n')); 4809 document.getElementsByTagName('head')[0].appendChild(style); 4810 }, 4811 getHighContrastBackgroundUrl: function() { 4812 var canvas = document.createElement("canvas"), 4813 ctx = canvas.getContext('2d'); 4814 canvas.width = 1; 4815 canvas.height = 1; 4816 ctx.fillStyle = this.getHighContrastBackgroundColor(); 4817 ctx.fillRect(0, 0, canvas.width, canvas.height); 4818 return canvas.toDataURL(); 4819 }, 4820 getHighContrastBackgroundColor: function() { 4821 var foreColor = ASPx.GetCurrentStyle(document.body).color; 4822 var hexColor = ASPx.Color.ColorToHexadecimal(foreColor); 4823 return ASPx.HighContrastForeColorHighlightColorMap[hexColor] || this.highContrastDefaultBackgroundColor; 4824 }, 4825 initialize: function() { 4826 if(this.isInitialized) 4827 return; 4828 this.isInitialized = true; 4829 this.detectHighContrastTheme(); 4830 if(this.highContrastThemeActive)
4831 this.createHighContrastBackgroundStyle(); 4832 }, 4833 detectHighContrastTheme: function() { 4834 var testElement = document.createElement("DIV"); 4835 ASPx.SetStyles(testElement, { 4836 backgroundColor: "rgb(255, 255, 255)", 4837 display: "none" 4838 }, true); 4839 var docElement = document.documentElement; 4840 docElement.appendChild(testElement); 4841 var actualBackgroundColor = ASPx.GetCurrentStyle(testElement).backgroundColor; 4842 docElement.removeChild(testElement); 4843 if(actualBackgroundColor === "rgb(0, 0, 0)") { 4844 this.highContrastThemeActive = true; 4845 ASPx.AddClassNameToElement(docElement, this.highContrastCssClassMarker); 4846 } 4847 } 4848}; 4849ASPx.AccessibilityUtils = AccessibilityUtils; 4850ASPx.AccessibilityUtils.SendMessageToAssistiveTechnology = function(message) { 4851 var messageParts = ASPx.Ident.IsArray(message) ? message : [message]; 4852 var args = new ASPxClientControlBeforePronounceEventArgs(messageParts, null); 4853 ASPx.AccessibilityPronouncer.EnsureInitialize(); 4854 ASPx.AccessibilityPronouncer.Pronounce(args, ASPx.AccessibilityPronouncerType.live); 4855}; 4856ASPx.AccessibilityUtils.SetFocusAccessible = function(focusableElement) { 4857 if(!focusableElement) 4858 return; 4859 var elementId = focusableElement.id; 4860 if(!elementId) { 4861 var namedParent = ASPx.GetParent(focusableElement, function(element) { 4862 return !!element.id; 4863 }); 4864 if(ASPx.IsExists(namedParent)) 4865 elementId = namedParent.id; 4866 } 4867 var focusableControl = ASPx.GetClientControlByElementID(elementId); 4868 if(focusableControl && focusableControl.OnAssociatedLabelClick) 4869 focusableControl.OnAssociatedLabelClick(focusableElement); 4870 else 4871 window.setTimeout(function() { 4872 ASPx.AccessibilityUtils.SetFocusAccessibleCore(focusableElement); 4873 }, 0); 4874}; 4875ASPx.AccessibilityUtils.SetFocusAccessibleCore = function(focusableElement) { 4876 if(!ASPx.IsExists(focusableElement)) 4877 return; 4878 var isTabIndexChanged = ASPx.ControlTabIndexManager.getInstance().isElementWithChangedIndex(focusableElement); 4879 if(isTabIndexChanged) 4880 return; 4881 if(!ASPx.IsValidElement(focusableElement) && focusableElement.id) 4882 focusableElement = ASPx.GetElementById(focusableElement.id); 4883 if(!ASPx.IsActionElement(focusableElement)) 4884 focusableElement = ASPx.RestoreFocusHelper.findNeighbourFocusElement(focusableElement, document.body); 4885 if(ASPx.IsExistsElement(focusableElement)) 4886 focusableElement.focus(); 4887}; 4888var Security = { 4889 setInnerHtml: function(el, html, dataType) { 4890 if(!html) { 4891 while(el.firstChild) 4892 ASPx.RemoveElement(el.firstChild); 4893 } else 4894 Security.setData(html, function(d) { ASPx.SetInnerHtml.call(window, el, d); }, dataType); 4895 }, 4896 setText: function(control, text, dataType) { Security.setData(text, control.SetText.aspxBind(control), dataType); }, 4897 safeEncodeHtml: function(html) { return ASPx.Str.EncodeHtml(ASPx.Str.DecodeHtml(html)); }, 4898 setData: function(data, dataSetter, dataType) { 4899 if(dataType === undefined) 4900 throw new Error("Specify the dataType"); 4901 if(dataType == Security.DataType.Untrusted) 4902 data = Security.safeEncodeHtml(data); 4903 dataSetter(data); 4904 } 4905}; 4906Security.DataType = { 4907 Trusted: 0, 4908 Untrusted: 1 4909}; 4910ASPx.EnableCssAnimation = true; 4911var AnimationTransitionBase = ASPx.CreateClass(null, { 4912 constructor: function(element, options) { 4913 if(element) { 4914 AnimationTransitionBase.Cancel(element); 4915 this.element = element; 4916 this.element.aspxTransition = this; 4917 } 4918 this.duration = options.duration || AnimationConstants.Durations.DEFAULT; 4919 this.transition = options.transition || AnimationConstants.Transitions.SINE; 4920 this.property = options.property; 4921 this.unit = options.unit || ""; 4922 this.onComplete = options.onComplete; 4923 this.to = null; 4924 this.from = null; 4925 }, 4926 Start: function(from, to) { 4927 if(to != undefined) { 4928 this.to = to; 4929 this.from = from; 4930 this.SetValue(this.from); 4931 } 4932 else 4933 this.to = from; 4934 }, 4935 Cancel: function() { 4936 if(!this.element) 4937 return; 4938 try { 4939 delete this.element.aspxTransition; 4940 } catch(e) { 4941 this.element.aspxTransition = undefined; 4942 } 4943 }, 4944 GetValue: function() { 4945 return this.getValueInternal(this.element, this.property); 4946 }, 4947 SetValue: function(value) { 4948 this.setValueInternal(this.element, this.property, this.unit, value); 4949 }, 4950 setValueInternal: function(element, property, unit, value) { 4951 if(property == "opacity") 4952 AnimationUtils.setOpacity(element, value); 4953 else 4954 element.style[property] = value + unit; 4955 }, 4956 getValueInternal: function(element, property) { 4957 if(property == "opacity") 4958 return ASPx.GetElementOpacity(element); 4959 var value = parseFloat(element.style[property]); 4960 return isNaN(value) ? 0 : value; 4961 }, 4962 performOnComplete: function() { 4963 if(this.onComplete) 4964 this.onComplete(this.element); 4965 }, 4966 getTransition: function() { 4967 return this.transition; 4968 } 4969}); 4970AnimationTransitionBase.Cancel = function(element) { 4971 if(element.aspxTransition) 4972 element.aspxTransition.Cancel(); 4973}; 4974var AnimationConstants = {}; 4975AnimationConstants.Durations = { 4976 SHORT: 200, 4977 DEFAULT: 400, 4978 LONG: 600 4979}; 4980AnimationConstants.Transitions = { 4981 LINER: { 4982 Css: "cubic-bezier(0.250, 0.250, 0.750, 0.750)", 4983 Js: function(progress) { return progress; } 4984 }, 4985 SINE: { 4986 Css: "cubic-bezier(0.470, 0.000, 0.745, 0.715)", 4987 Js: function(progress) { return Math.sin(progress * 1.57); } 4988 }, 4989 POW: { 4990 Css: "cubic-bezier(0.755, 0.050, 0.855, 0.060)", 4991 Js: function(progress) { return Math.pow(progress, 4); } 4992 }, 4993 POW_EASE_OUT: { 4994 Css: "cubic-bezier(0.165, 0.840, 0.440, 1.000)", 4995 Js: function(progress) { return 1 - AnimationConstants.Transitions.POW.Js(1 - progress); } 4996 }, 4997 RIPPLE: { 4998 Css: "cubic-bezier(0.47, 0.06, 0.23, 0.99)", 4999 Js: function(progress) { 5000 return Math.pow((progress), 3) * 0.47 + 3 * progress * Math.pow((1 - progress), 2) * 0.06 + 3 * Math.pow(progress, 2) * 5001 (1 - progress) * 0.23 + 0.99 * Math.pow(progress, 3); 5002 } 5003 } 5004}; 5005var JsAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, { 5006 constructor: function(element, options) { 5007 this.constructor.prototype.constructor.call(this, element, options); 5008 this.onStep = options.onStep; 5009 this.fps = 60; 5010 this.startTime = null; 5011 }, 5012 Start: function(from, to) { 5013 if(from == to) { 5014 this.from = this.to = from; 5015 setTimeout(this.complete.aspxBind(this), 0); 5016 } 5017 else { 5018 AnimationTransitionBase.prototype.Start.call(this, from, to); 5019 if(to == undefined) 5020 this.from = this.GetValue(); 5021 this.initTimer(); 5022 } 5023 }, 5024 Cancel: function() { 5025 AnimationTransitionBase.prototype.Cancel.call(this); 5026 if(this.timerId) 5027 clearInterval(this.timerId); 5028 }, 5029 initTimer: function() { 5030 this.startTime = new Date(); 5031 this.timerId = window.setInterval(function() { this.onTick(); }.aspxBind(this), 1000 / this.fps);
5032 }, 5033 onTick: function() { 5034 var progress = (new Date() - this.startTime) / this.duration; 5035 if(progress >= 1) 5036 this.complete(); 5037 else { 5038 this.update(progress); 5039 if(this.onStep) 5040 this.onStep(); 5041 } 5042 }, 5043 update: function(progress) { 5044 this.SetValue(this.gatCalculatedValue(this.from, this.to, progress)); 5045 }, 5046 complete: function() { 5047 this.Cancel(); 5048 this.update(1); 5049 this.performOnComplete(); 5050 }, 5051 gatCalculatedValue: function(from, to, progress) { 5052 if(progress == 1) 5053 return to; 5054 return from + (to - from) * this.getTransition()(progress); 5055 }, 5056 getTransition: function() { 5057 return this.transition.Js; 5058 } 5059}); 5060var SimpleAnimationTransition = ASPx.CreateClass(JsAnimationTransition, { 5061 constructor: function(options) { 5062 this.constructor.prototype.constructor.call(this, null, options); 5063 this.transition = options.transition || AnimationConstants.Transitions.POW_EASE_OUT; 5064 this.onUpdate = options.onUpdate; 5065 this.lastValue = 0; 5066 }, 5067 SetValue: function(value) { 5068 this.onUpdate(value - this.lastValue); 5069 this.lastValue = value; 5070 }, 5071 GetValue: function() { 5072 return this.lastValue; 5073 }, 5074 performOnComplete: function() { 5075 if(this.onComplete) 5076 this.onComplete(); 5077 } 5078}); 5079var MultipleJsAnimationTransition = ASPx.CreateClass(JsAnimationTransition, { 5080 constructor: function(element, options) { 5081 this.constructor.prototype.constructor.call(this, element, options); 5082 this.properties = {}; 5083 }, 5084 Start: function(properties) { 5085 this.initProperties(properties); 5086 this.initTimer(); 5087 }, 5088 initProperties: function(properties) { 5089 this.properties = properties; 5090 for(var propName in this.properties) 5091 if(properties[propName].from == undefined) 5092 properties[propName].from = this.getValueInternal(this.element, propName); 5093 }, 5094 update: function(progress) { 5095 for(var propName in this.properties) { 5096 if(this.properties.hasOwnProperty(propName)) { 5097 var property = this.properties[propName]; 5098 if(property.from != property.to) 5099 this.setValueInternal(this.element, propName, property.unit, this.gatCalculatedValue(property.from, property.to, progress)); 5100 } 5101 } 5102 } 5103}); 5104var CssAnimationTransition = ASPx.CreateClass(AnimationTransitionBase, { 5105 constructor: function(element, options) { 5106 this.constructor.prototype.constructor.call(this, element, options); 5107 this.transitionPropertyName = AnimationUtils.CurrentTransition.property; 5108 this.eventName = AnimationUtils.CurrentTransition.event; 5109 this.forceTransitionEndByTimer = true; 5110 this.needForceTransitionEndByTimerFlag = options.needForceTransitionEndByTimerFlag; 5111 }, 5112 Start: function(from, to) { 5113 this.forceTransitionEndByTimer = true; 5114 AnimationTransitionBase.prototype.Start.call(this, from, to); 5115 this.startTimerId = window.setTimeout(function() { 5116 if(this.from == this.to) 5117 this.onTransitionEnd(); 5118 else { 5119 var isHidden = ASPx.GetElementOffsetHeight(this.element) == 0 && ASPx.GetElementOffsetWidth(this.element) == 0; 5120 if(!isHidden) 5121 this.prepareElementBeforeAnimation(); 5122 this.SetValue(this.to); 5123 if(isHidden) 5124 this.onTransitionEnd(); 5125 } 5126 }.aspxBind(this), 0); 5127 }, 5128 Cancel: function() { 5129 this.forceTransitionEndByTimer = false; 5130 window.clearTimeout(this.startTimerId); 5131 AnimationTransitionBase.prototype.Cancel.call(this); 5132 ASPx.Evt.DetachEventFromElement(this.element, this.eventName, CssAnimationTransition.transitionEnd); 5133 this.setValueInternal(this.element, this.transitionPropertyName, "", ""); 5134 this.stopAnimation(); 5135 }, 5136 prepareElementBeforeAnimation: function() { 5137 ASPx.Evt.AttachEventToElement(this.element, this.eventName, CssAnimationTransition.transitionEnd); 5138 var dummy = this.element.offsetHeight; 5139 this.element.style[this.transitionPropertyName] = this.getTransitionCssString(); 5140 if(this.needForceTransitionEndByTimer()) { 5141 setTimeout(function() { 5142 if(this.forceTransitionEndByTimer && this.element && this.element.aspxTransition) { 5143 this.element.style[this.transitionPropertyName] = ""; 5144 this.element.aspxTransition.onTransitionEnd(); 5145 } 5146 }.aspxBind(this), this.duration + 100); 5147 } 5148 }, 5149 needForceTransitionEndByTimer: function() { 5150 if(this.needForceTransitionEndByTimerFlag) 5151 return true; 5152 if(ASPx.Browser.Safari && ASPx.Browser.MacOSMobilePlatform && ASPx.Browser.MajorVersion >= 8) 5153 return true; 5154 return ASPx.Browser.AndroidMobilePlatform; 5155 }, 5156 stopAnimation: function() { 5157 this.SetValue(ASPx.GetCurrentStyle(this.element)[this.property]); 5158 }, 5159 onTransitionEnd: function() { 5160 this.Cancel(); 5161 this.performOnComplete(); 5162 }, 5163 getTransition: function() { 5164 return this.transition.Css; 5165 }, 5166 getTransitionCssString: function() { 5167 return this.getTransitionCssStringInternal(this.getCssName(this.property)); 5168 }, 5169 getTransitionCssStringInternal: function(cssProperty) { 5170 return cssProperty + " " + this.duration + "ms " + this.getTransition(); 5171 }, 5172 getCssName: function(property) { 5173 switch(property) { 5174 case "marginLeft": 5175 return "margin-left"; 5176 case "marginTop": 5177 return "margin-top"; 5178 } 5179 return property; 5180 } 5181}); 5182var MultipleCssAnimationTransition = ASPx.CreateClass(CssAnimationTransition, { 5183 constructor: function(element, options) { 5184 this.constructor.prototype.constructor.call(this, element, options); 5185 this.properties = null; 5186 }, 5187 Start: function(properties) { 5188 this.properties = properties; 5189 this.forEachProperties(function(property, propName) { 5190 if(property.from !== undefined) 5191 this.setValueInternal(this.element, propName, property.unit, property.from); 5192 }.aspxBind(this)); 5193 this.prepareElementBeforeAnimation(); 5194 window.setTimeout(function() { 5195 this.forEachProperties(function(property, propName) { 5196 this.setValueInternal(this.element, propName, property.unit, property.to);
5197 }.aspxBind(this)); 5198 }.aspxBind(this), 0); 5199 }, 5200 stopAnimation: function() { 5201 var style = ASPx.GetCurrentStyle(this.element); 5202 this.forEachProperties(function(property, propName) { 5203 this.setValueInternal(this.element, propName, "", style[propName]); 5204 }.aspxBind(this)); 5205 }, 5206 getTransitionCssString: function() { 5207 var str = ""; 5208 this.forEachProperties(function(property, propName) { 5209 str += this.getTransitionCssStringInternal(this.getCssName(propName)) + ","; 5210 }.aspxBind(this)); 5211 str = str.substring(0, str.length - 1); 5212 return str; 5213 }, 5214 forEachProperties: function(func) { 5215 for(var propName in this.properties) { 5216 if(this.properties.hasOwnProperty(propName)) { 5217 var property = this.properties[propName]; 5218 if(property.from == undefined) 5219 property.from = this.getValueInternal(this.element, propName); 5220 if(property.from != property.to) 5221 func(property, propName); 5222 } 5223 } 5224 } 5225}); 5226CssAnimationTransition.transitionEnd = function(evt) { 5227 var element = evt.target; 5228 if(element && element.aspxTransition) 5229 element.aspxTransition.onTransitionEnd(); 5230}; 5231var AnimationUtils = { 5232 CanUseCssTransition: function() { return ASPx.EnableCssAnimation && this.CurrentTransition; }, 5233 CanUseCssTransform: function() { return this.CanUseCssTransition() && this.CurrentTransform; }, 5234 CurrentTransition: (function() { 5235 var transitions = [ 5236 { property: "webkitTransition", event: "webkitTransitionEnd" }, 5237 { property: "MozTransition", event: "transitionend" }, 5238 { property: "OTransition", event: "oTransitionEnd" }, 5239 { property: "transition", event: "transitionend" } 5240 ]; 5241 var fakeElement = document.createElement("DIV"); 5242 for(var i = 0; i < transitions.length; i++) 5243 if(transitions[i].property in fakeElement.style) 5244 return transitions[i]; 5245 })(), 5246 CurrentTransform: (function() { 5247 var transforms = ["transform", "MozTransform", "-webkit-transform", "msTransform", "OTransform"]; 5248 var fakeElement = document.createElement("DIV"); 5249 for(var i = 0; i < transforms.length; i++) 5250 if(transforms[i] in fakeElement.style) 5251 return transforms[i]; 5252 })(), 5253 SetTransformValue: function(element, position, isTop) { 5254 if(this.CanUseCssTransform()) 5255 element.style[this.CurrentTransform] = this.GetTransformCssText(position, isTop); 5256 else 5257 element.style[!isTop ? "left" : "top"] = position + "px"; 5258 }, 5259 GetTransformValue: function(element, isTop) { 5260 if(this.CanUseCssTransform()) { 5261 var cssValue = element.style[this.CurrentTransform]; 5262 return cssValue && cssValue != "none" ? Number(cssValue.replace('matrix(1, 0, 0, 1,', '').replace(')', '').split(',')[!isTop ? 0 : 1]) : 0; 5263 } 5264 else 5265 return !isTop ? element.offsetLeft : element.offsetTop; 5266 }, 5267 GetTransformCssText: function(position, isTop) { 5268 if(!position) 5269 return "none"; 5270 return "matrix(1, 0, 0, 1," + (!isTop ? position : 0) + ", " + (!isTop ? 0 : position) + ")"; 5271 }, 5272 createMultipleAnimationTransition: function (element, options) { 5273 return this.CanUseCssTransition() && !options.onStep ? new MultipleCssAnimationTransition(element, options) : new MultipleJsAnimationTransition(element, options); 5274 }, 5275 createSimpleAnimationTransition: function(options) { 5276 return new SimpleAnimationTransition(options); 5277 }, 5278 createJsAnimationTransition: function(element, options) { 5279 return new JsAnimationTransition(element, options); 5280 }, 5281 createCssAnimationTransition: function(element, options) { 5282 return new CssAnimationTransition(element, options); 5283 }, 5284 setOpacity: function(element, value) { 5285 ASPx.SetElementOpacity(element, value); 5286 } 5287}; 5288var AsyncTracker = function() { 5289 var currentToken, 5290 lockedTokens, 5291 onDoneDelegates, 5292 lockedDelegates; 5293 function clearState() { 5294 currentToken = 1; 5295 lockedTokens = []; 5296 onDoneDelegates = []; 5297 lockedDelegates = {}; 5298 } 5299 clearState(); 5300 var log = function(msg) { }; 5301 function setLog(delegate){ 5302 log = delegate; 5303 } 5304 function getLockToken() { 5305 if(onDoneDelegates.length === 0) 5306 return -1; 5307 var token = currentToken++; 5308 lockedTokens.push(token); 5309 lockedDelegates[token] = []; 5310 for (var i = 0; i < onDoneDelegates.length; i++) { 5311 lockedDelegates[token].push(onDoneDelegates[i]); 5312 } 5313 log("module locks token " + token); 5314 return token; 5315 } 5316 function releaseToken(token) { 5317 if(token < 0) return; 5318 log("module releasing token " + token); 5319 ASPx.Data.ArrayRemove(lockedTokens, token); 5320 delete lockedDelegates[token]; 5321 invokeUnlockedDelegates(); 5322 if(lockedTokens.length === 0) 5323 clearState(); 5324 log("module released token " + token); 5325 } 5326 function invokeUnlockedDelegates() { 5327 var onDoneDelegate; 5328 for (var i = onDoneDelegates.length - 1; i >= 0; i--) { 5329 if(onDoneDelegates[i] && !isDelegateLocked(onDoneDelegates[i])) { 5330 onDoneDelegate = onDoneDelegates[i]; 5331 delete onDoneDelegates[i]; 5332 onDoneDelegate(); 5333 } 5334 } 5335 } 5336 function isDelegateLocked(delegate) { 5337 for (var i = lockedTokens.length - 1; i >= 0; i--) { 5338 var token = lockedTokens[i]; 5339 var delegates = lockedDelegates[token]; 5340 if(delegates) { 5341 for (var j = delegates.length - 1; j >= 0; j--) { 5342 if(delegates[j] && delegates[j] === delegate) 5343 return true; 5344 } 5345 } 5346 } 5347 return false; 5348 } 5349 function track(doDelegate, onDoneDelegate) { 5350 if(onDoneDelegate) 5351 onDoneDelegates.push(onDoneDelegate); 5352 doDelegate(); 5353 if(onDoneDelegate) 5354 invokeUnlockedDelegates(); 5355 } 5356 return { 5357 getLockToken: getLockToken, 5358 releaseToken: releaseToken, 5359 track: track, 5360 setLog:setLog, 5361 }; 5362}; 5363var GetEditorValuesInContainer = function(containerOrId, processInvisibleEditors, needSerialize) { 5364 var container = typeof(containerOrId) === "string" ? ASPx.GetElementById(containerOrId) : containerOrId;
5365 var result = {}; 5366 if(!ASPx.ProcessEditorsInContainer) 5367 return result; 5368 ASPx.ProcessEditorsInContainer(container, function(editor){ 5369 result[editor.name] = GetCorrectedByTypeValue(ASPx.GetEditorValueByControl(editor), needSerialize); 5370 return true; 5371 }, null, null, processInvisibleEditors, false); 5372 return result; 5373}; 5374var SetEditorValues = function(values) { 5375 for(var controlName in values) { 5376 if(values.hasOwnProperty(controlName)) { 5377 var trackedControl = ASPxClientControl.GetControlCollection().Get(controlName); 5378 if(!trackedControl) 5379 continue; 5380 var setValueMethod = trackedControl.SetTokenCollection || trackedControl.SelectValues || trackedControl.SetValue; 5381 if(setValueMethod === trackedControl.SelectValues) 5382 trackedControl.UnselectAll(); 5383 setValueMethod.call(trackedControl, values[controlName]); 5384 } 5385 } 5386}; 5387var GetCorrectedByTypeValue = function(value, needSerialize){ 5388 if(ASPx.Ident.IsArray(value)) 5389 for(var i = 0; i < value.length; i++) 5390 value[i] = GetCorrectedByTypeValue(value[i]); 5391 if(needSerialize && ASPx.Ident.IsDate(value)) 5392 return ASPx.DateUtils.GetInvariantDateTimeString(value); 5393 return value; 5394}; 5395var ListBoxTemporaryCache = ASPx.CreateClass(null, { 5396 constructor: function() { 5397 this.cache = { }; 5398 this.invalidateTimerID = -1; 5399 }, 5400 Get: function(key, getObjectFunc, context, args) { 5401 if(this.invalidateTimerID < 0) { 5402 this.invalidateTimerID = window.setTimeout(function() { 5403 this.Invalidate(); 5404 }.aspxBind(this), 0); 5405 } 5406 if(!ASPx.IsExists(this.cache[key])) { 5407 if(!ASPx.IsExists(args)) 5408 args = [ ]; 5409 this.cache[key] = getObjectFunc.apply(context, args); 5410 } 5411 return this.cache[key]; 5412 }, 5413 Invalidate: function() { 5414 this.cache = { }; 5415 this.invalidateTimerID = ASPx.Timer.ClearTimer(this.invalidateTimerID); 5416 } 5417}); 5418ASPx.GetEditorValueByControl = function(control, needSerialize) { 5419 var result; 5420 if(ASPx.IsMultipleValueOwner(control)) 5421 result = control.GetSelectedValues(); 5422 if(ASPx.IsTokenBox(control)) { 5423 if(needSerialize) 5424 result = control.GetTokenValuesCollection(); 5425 else 5426 result = control.GetTokenCollection(); 5427 } 5428 if(ASPx.IsDropDownEdit(control)) 5429 result = control.GetKeyValue(); 5430 if(ASPx.IsHtmlEditor(control)) 5431 result = control.GetHtml(); 5432 return result || control.GetValue(); 5433}; 5434ASPx.IsMultipleValueOwner = function(control) { 5435 return ASPx.IsListBox(control) || ASPx.IsCheckBoxList(control); 5436}; 5437ASPx.IsCheckBoxList = function(control) { 5438 return control && typeof(ASPxClientCheckBoxList) != "undefined" && control instanceof ASPxClientCheckBoxList; 5439 }; 5440ASPx.IsCheckBox = function(control) { 5441 return control && typeof (ASPxClientCheckBox) != "undefined" && control instanceof ASPxClientCheckBox; 5442}; 5443ASPx.IsListBox = function(control) { 5444 return control && typeof(ASPxClientListBox) != "undefined" && control instanceof ASPxClientListBox; 5445}; 5446ASPx.IsComboBox = function(control) { 5447 return control && typeof(ASPxClientComboBox) != "undefined" && control instanceof ASPxClientComboBox; 5448}; 5449ASPx.IsTokenBox = function(control) { 5450 return control && typeof(ASPxClientTokenBox) != "undefined" && control instanceof ASPxClientTokenBox; 5451}; 5452ASPx.IsDropDownEdit = function(control) { 5453 return control && typeof (ASPxClientDropDownEdit) != "undefined" && control instanceof ASPxClientDropDownEdit; 5454}; 5455ASPx.IsGridLookup = function(control) { 5456 return control && typeof(MVCxClientGridLookup) != "undefined" && control instanceof MVCxClientGridLookup; 5457}; 5458ASPx.IsSpinEdit = function(control) { 5459 return control && typeof(ASPxClientSpinEdit) != "undefined" && control instanceof ASPxClientSpinEdit; 5460}; 5461ASPx.IsHtmlEditor = function(control) { 5462 return control && typeof (ASPxClientHtmlEditor) != "undefined" && control instanceof ASPxClientHtmlEditor; 5463}; 5464ASPx.DatePickerType = { 5465 Days: 0, 5466 Months: 1, 5467 Years: 2, 5468 Decades: 3 5469}; 5470ASPx.FullScreenUtils = { 5471 subscribeChange: function(handler) { 5472 Evt.AttachEventToElement(document, "fullscreenchange", handler); 5473 Evt.AttachEventToElement(document, "msfullscreenchange", handler); 5474 Evt.AttachEventToElement(document, "MSFullscreenChange", handler); 5475 Evt.AttachEventToElement(document, "webkitfullscreenchange", handler); 5476 Evt.AttachEventToElement(document, "mozfullscreenchange", handler); 5477 }, 5478 unsubscribeChange: function(handler) { 5479 Evt.DetachEventFromElement(document, "fullscreenchange", handler); 5480 Evt.DetachEventFromElement(document, "msfullscreenchange", handler); 5481 Evt.DetachEventFromElement(document, "MSFullscreenChange", handler); 5482 Evt.DetachEventFromElement(document, "webkitfullscreenchange", handler); 5483 Evt.DetachEventFromElement(document, "mozfullscreenchange", handler); 5484 }, 5485 setFullscreen: function(on) { 5486 var element = window.self.document.body; 5487 if(on) { 5488 if(element.requestFullscreen) { 5489 element.requestFullscreen(); 5490 } else if(element.mozRequestFullScreen) { 5491 element.mozRequestFullScreen(); 5492 } else if(element.webkitRequestFullscreen) { 5493 element.webkitRequestFullscreen(); 5494 } else if(element.msRequestFullscreen) { 5495 element.msRequestFullscreen(); 5496 } 5497 } else { 5498 if(document.exitFullscreen) { 5499 document.exitFullscreen(); 5500 } else if(document.mozCancelFullScreen) { 5501 document.mozCancelFullScreen(); 5502 } else if(document.webkitCancelFullScreen) { 5503 document.webkitCancelFullScreen(); 5504 } else if(document.msExitFullscreen) { 5505 document.msExitFullscreen(); 5506 } 5507 } 5508 }, 5509 inFullscreen: function() { 5510 var fullscreenElement = document.fullscreenElement || document.msFullscreenElement || document.webkitFullscreenElement; 5511 var isInFullscreen = fullscreenElement === document.body || document.webkitIsFullScreen;
5512 return !!isInFullscreen; 5513 } 5514 }; 5515ASPx.InitializeSVGSprite = function () { 5516 if (ASPx.SVGSprites && ASPx.SVGSprites.length > 0) { 5517 var svgContainer = document.getElementById('svgContainer'); 5518 var hasSvgContainer = !!svgContainer; 5519 if (!hasSvgContainer) { 5520 svgContainer = document.createElement('div'); 5521 svgContainer.id = 'svgContainer'; 5522 svgContainer.style.display = "none"; 5523 document.body.appendChild(svgContainer); 5524 } 5525 for (var i = 0; i < ASPx.SVGSprites.length; i++) { 5526 svgContainer.innerHTML += ASPx.SVGSprites[i]; 5527 } 5528 ASPx.SVGSprites = null; 5529 } 5530}; 5531var GridDynamicStyleSheetHelper = ASPx.CreateClass(null, { 5532 constructor: function() { 5533 this.styleSheet = {}; 5534 this.rules = {}; 5535 this.updateLock = 0; 5536 }, 5537 Update: function(control, styleName, rules) { 5538 var key = control.name + "_" + styleName; 5539 this.BeginUpdate(key); 5540 this.ChangeRules(key, rules); 5541 this.EndUpdate(key); 5542 }, 5543 ChangeRules: function(key, rules) { 5544 if(key && rules) 5545 this.rules[key] = rules; 5546 }, 5547 BeginUpdate: function(key) { 5548 this.updateLock++; 5549 this.RemoveStyleSheetElement(key); 5550 }, 5551 EndUpdate: function(key) { 5552 this.updateLock--; 5553 if(this.updateLock !== 0) 5554 return; 5555 var styleArgs = []; 5556 var controlRules = this.rules[key]; 5557 for(var i = 0; i < controlRules.length; i++) { 5558 var rule = controlRules[i]; 5559 styleArgs.push(rule.selector + " { " + rule.cssText + " } "); 5560 } 5561 this.styleSheet[key] = this.CreateStyleSheet(key, styleArgs.join("")); 5562 }, 5563 CreateStyleSheet: function(key, cssText) { 5564 var container = document.createElement("DIV"); 5565 ASPx.Security.setInnerHtml(container, "<style type='text/css' id='" + key + "'>" + cssText + "</style>", ASPx.Security.DataType.Trusted); 5566 styleSheet = ASPx.GetNodeByTagName(container, "style", 0); 5567 if(styleSheet) 5568 ASPx.GetNodeByTagName(document, "HEAD", 0).appendChild(styleSheet); 5569 return styleSheet; 5570 }, 5571 ClearStyleSheet: function(control, styleName) { 5572 var key = control.name + "_" + styleName; 5573 this.RemoveStyleSheetElement(key); 5574 }, 5575 RemoveStyleSheetElement: function(key) { 5576 if(this.styleSheet[key]) { 5577 ASPx.RemoveElement(this.styleSheet[key]); 5578 delete this.styleSheet[key]; 5579 } 5580 } 5581}); 5582GridDynamicStyleSheetHelper.Instance = new GridDynamicStyleSheetHelper(); 5583ASPx.GridDynamicStyleSheetHelper = GridDynamicStyleSheetHelper; 5584ASPxClientUtils = {}; 5585ASPxClientUtils.agent = Browser.UserAgent; 5586ASPxClientUtils.opera = Browser.Opera; 5587ASPxClientUtils.opera9 = Browser.Opera && Browser.MajorVersion == 9; 5588ASPxClientUtils.safari = Browser.Safari; 5589ASPxClientUtils.safari3 = Browser.Safari && Browser.MajorVersion == 3; 5590ASPxClientUtils.safariMacOS = Browser.Safari && Browser.MacOSPlatform; 5591ASPxClientUtils.chrome = Browser.Chrome; 5592ASPxClientUtils.ie = Browser.IE; 5593ASPxClientUtils.ie7 = Browser.IE && Browser.MajorVersion == 7; 5594ASPxClientUtils.firefox = Browser.Firefox; 5595ASPxClientUtils.firefox3 = Browser.Firefox && Browser.MajorVersion == 3; 5596ASPxClientUtils.mozilla = Browser.Mozilla; 5597ASPxClientUtils.netscape = Browser.Netscape; 5598ASPxClientUtils.browserVersion = Browser.Version; 5599ASPxClientUtils.browserMajorVersion = Browser.MajorVersion; 5600ASPxClientUtils.macOSPlatform = Browser.MacOSPlatform; 5601ASPxClientUtils.windowsPlatform = Browser.WindowsPlatform; 5602ASPxClientUtils.webKitFamily = Browser.WebKitFamily; 5603ASPxClientUtils.netscapeFamily = Browser.NetscapeFamily; 5604ASPxClientUtils.touchUI = Browser.TouchUI; 5605ASPxClientUtils.webKitTouchUI = Browser.WebKitTouchUI; 5606ASPxClientUtils.msTouchUI = Browser.MSTouchUI; 5607ASPxClientUtils.iOSPlatform = Browser.MacOSMobilePlatform; 5608ASPxClientUtils.androidPlatform = Browser.AndroidMobilePlatform; 5609ASPxClientUtils.ArrayInsert = Data.ArrayInsert; 5610ASPxClientUtils.ArrayRemove = Data.ArrayRemove; 5611ASPxClientUtils.ArrayRemoveAt = Data.ArrayRemoveAt; 5612ASPxClientUtils.ArrayClear = Data.ArrayClear; 5613ASPxClientUtils.ArrayIndexOf = Data.ArrayIndexOf; 5614ASPxClientUtils.AttachEventToElement = Evt.AttachEventToElement; 5615ASPxClientUtils.DetachEventFromElement = Evt.DetachEventFromElement; 5616ASPxClientUtils.GetEventSource = Evt.GetEventSource; 5617ASPxClientUtils.GetEventX = Evt.GetEventX; 5618ASPxClientUtils.GetEventY = Evt.GetEventY; 5619ASPxClientUtils.GetKeyCode = Evt.GetKeyCode; 5620ASPxClientUtils.PreventEvent = Evt.PreventEvent; 5621ASPxClientUtils.PreventEventAndBubble = Evt.PreventEventAndBubble; 5622ASPxClientUtils.PreventDragStart = Evt.PreventDragStart; 5623ASPxClientUtils.ClearSelection = Selection.Clear; 5624ASPxClientUtils.IsExists = ASPx.IsExists; 5625ASPxClientUtils.IsFunction = ASPx.IsFunction; 5626ASPxClientUtils.GetAbsoluteX = ASPx.GetAbsoluteX; 5627ASPxClientUtils.GetAbsoluteY = ASPx.GetAbsoluteY; 5628ASPxClientUtils.SetAbsoluteX = ASPx.SetAbsoluteX; 5629ASPxClientUtils.SetAbsoluteY = ASPx.SetAbsoluteY; 5630ASPxClientUtils.GetDocumentScrollTop = ASPx.GetDocumentScrollTop; 5631ASPxClientUtils.GetDocumentScrollLeft = ASPx.GetDocumentScrollLeft; 5632ASPxClientUtils.GetDocumentClientWidth = ASPx.GetDocumentClientWidth; 5633ASPxClientUtils.GetDocumentClientHeight = ASPx.GetDocumentClientHeight; 5634ASPxClientUtils.AddClassNameToElement = ASPx.AddClassNameToElement; 5635ASPxClientUtils.RemoveClassNameFromElement = ASPx.RemoveClassNameFromElement; 5636ASPxClientUtils.ToggleClassName = ASPx.ToggleClassNameToElement; 5637ASPxClientUtils.GetIsParent = ASPx.GetIsParent; 5638ASPxClientUtils.GetParentById = ASPx.GetParentById; 5639ASPxClientUtils.GetParentByTagName = ASPx.GetParentByTagName; 5640ASPxClientUtils.GetParentByClassName = ASPx.GetParentByPartialClassName; 5641ASPxClientUtils.GetChildById = ASPx.GetChildById; 5642ASPxClientUtils.GetChildByTagName = ASPx.GetChildByTagName; 5643ASPxClientUtils.SetCookie = Cookie.SetCookie;
5644ASPxClientUtils.GetCookie = Cookie.GetCookie; 5645ASPxClientUtils.DeleteCookie = Cookie.DelCookie; 5646ASPxClientUtils.GetShortcutCode = ASPx.GetShortcutCode; 5647ASPxClientUtils.GetShortcutCodeByEvent = ASPx.GetShortcutCodeByEvent; 5648ASPxClientUtils.StringToShortcutCode = ASPx.ParseShortcutString; 5649ASPxClientUtils.Trim = Str.Trim; 5650ASPxClientUtils.TrimStart = Str.TrimStart; 5651ASPxClientUtils.TrimEnd = Str.TrimEnd; 5652ASPxClientUtils.GetEditorValuesInContainer = GetEditorValuesInContainer; 5653ASPxClientUtils.SetEditorValues = SetEditorValues; 5654ASPxClientUtils.SendMessageToAssistiveTechnology = ASPx.AccessibilityUtils.SendMessageToAssistiveTechnology; 5655window.ASPxClientUtils = ASPxClientUtils; 5656window.ListBoxTemporaryCache = ListBoxTemporaryCache; 5657ASPx.AnimationUtils = AnimationUtils; 5658ASPx.AnimationTransitionBase = AnimationTransitionBase; 5659ASPx.AnimationConstants = AnimationConstants; 5660ASPx.AsyncTracker = AsyncTracker; 5661ASPx.Security = Security; 5662})(ASPx, dx); 5663 5664(function module(ASPx, options) { 5665ASPx.modules.Classes = module; 5666ASPx.classesScriptParsed = false; 5667ASPx.documentLoaded = false; 5668ASPx.CallbackType = { 5669 Data: "d", 5670 Common: "c" 5671}; 5672ASPx.callbackState = { 5673 aborted: "aborted", 5674 inTurn: "inTurn", 5675 sent: "sent" 5676}; 5677var ASPxClientEvent = ASPx.CreateClass(null, { 5678 constructor: function() { 5679 this.handlerInfoList = []; 5680 this.firingIndex = -1; 5681 }, 5682 AddHandler: function(handler, executionContext) { 5683 if(typeof(executionContext) == "undefined") 5684 executionContext = null; 5685 this.RemoveHandler(handler, executionContext); 5686 var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext); 5687 this.handlerInfoList.push(handlerInfo); 5688 }, 5689 RemoveHandler: function(handler, executionContext) { 5690 this.removeHandlerByCondition(function(handlerInfo) { 5691 return handlerInfo.handler == handler && 5692 (!executionContext || handlerInfo.executionContext == executionContext); 5693 }); 5694 }, 5695 removeHandlerByCondition: function(predicate) { 5696 for(var i = this.handlerInfoList.length - 1; i >= 0; i--) { 5697 var handlerInfo = this.handlerInfoList[i]; 5698 if(predicate(handlerInfo)) { 5699 ASPx.Data.ArrayRemoveAt(this.handlerInfoList, i); 5700 if(i <= this.firingIndex) 5701 this.firingIndex--; 5702 } 5703 } 5704 }, 5705 removeHandlerByControlName: function(controlName) { 5706 this.removeHandlerByCondition(function(handlerInfo) { 5707 return handlerInfo.executionContext && 5708 handlerInfo.executionContext.name === controlName; 5709 }); 5710 }, 5711 ClearHandlers: function() { 5712 this.handlerInfoList.length = 0; 5713 }, 5714 FireEvent: function(obj, args) { 5715 for(this.firingIndex = 0; this.firingIndex < this.handlerInfoList.length; this.firingIndex++) { 5716 var handlerInfo = this.handlerInfoList[this.firingIndex]; 5717 handlerInfo.handler.call(handlerInfo.executionContext, obj, args); 5718 } 5719 }, 5720 InsertFirstHandler: function(handler, executionContext){ 5721 if(typeof(executionContext) == "undefined") 5722 executionContext = null; 5723 var handlerInfo = ASPxClientEvent.CreateHandlerInfo(handler, executionContext); 5724 ASPx.Data.ArrayInsert(this.handlerInfoList, handlerInfo, 0); 5725 }, 5726 IsEmpty: function() { 5727 return this.handlerInfoList.length == 0; 5728 } 5729}); 5730ASPxClientEvent.CreateHandlerInfo = function(handler, executionContext) { 5731 return { 5732 handler: handler, 5733 executionContext: executionContext 5734 }; 5735}; 5736var ASPxClientEventArgs = ASPx.CreateClass(null, { 5737 constructor: function() { 5738 } 5739}); 5740ASPxClientEventArgs.Empty = new ASPxClientEventArgs(); 5741var ASPxClientCancelEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 5742 constructor: function(){ 5743 this.constructor.prototype.constructor.call(this); 5744 this.cancel = false; 5745 } 5746}); 5747var ASPxClientProcessingModeEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 5748 constructor: function(processOnServer){ 5749 this.constructor.prototype.constructor.call(this); 5750 this.processOnServer = !!processOnServer; 5751 } 5752}); 5753var ASPxClientProcessingModeCancelEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, { 5754 constructor: function(processOnServer){ 5755 this.constructor.prototype.constructor.call(this, processOnServer); 5756 this.cancel = false; 5757 } 5758}); 5759var OrderedMap = ASPx.CreateClass(null, { 5760 constructor: function(){ 5761 this.entries = {}; 5762 this.firstEntry = null; 5763 this.lastEntry = null; 5764 }, 5765 add: function(key, element) { 5766 var entry = this.addEntry(key, element); 5767 this.entries[key] = entry; 5768 }, 5769 remove: function(key) { 5770 var entry = this.entries[key]; 5771 if(entry === undefined) 5772 return; 5773 this.removeEntry(entry); 5774 delete this.entries[key]; 5775 }, 5776 clear: function() { 5777 this.markAllEntriesAsRemoved(); 5778 this.entries = {}; 5779 this.firstEntry = null; 5780 this.lastEntry = null; 5781 }, 5782 get: function(key) { 5783 var entry = this.entries[key]; 5784 return entry ? entry.value : undefined; 5785 }, 5786 forEachEntry: function(processFunc, context) { 5787 context = context || this; 5788 for(var entry = this.firstEntry; entry; entry = entry.next) { 5789 if(entry.removed) 5790 continue; 5791 if(processFunc.call(context, entry.key, entry.value)) 5792 return; 5793 } 5794 }, 5795 addEntry: function(key, element) { 5796 var entry = { key: key, value: element, next: null, prev: null }; 5797 if(!this.firstEntry) 5798 this.firstEntry = entry; 5799 else { 5800 entry.prev = this.lastEntry; 5801 this.lastEntry.next = entry; 5802 } 5803 this.lastEntry = entry; 5804 return entry; 5805 }, 5806 removeEntry: function(entry) { 5807 if(this.firstEntry == entry) 5808 this.firstEntry = entry.next; 5809 if(this.lastEntry == entry) 5810 this.lastEntry = entry.prev; 5811 if(entry.prev) 5812 entry.prev.next = entry.next; 5813 if(entry.next) 5814 entry.next.prev = entry.prev; 5815 entry.removed = true; 5816 }, 5817 markAllEntriesAsRemoved: function() { 5818 for(var entry = this.firstEntry; entry; entry = entry.next) 5819 entry.removed = true; 5820 } 5821}); 5822var CollectionBase = ASPx.CreateClass(null, { 5823 constructor: function(){ 5824 this.elementsMap = new OrderedMap(); 5825 this.isASPxClientCollection = true; 5826 }, 5827 Add: function(key, element) { 5828 this.elementsMap.add(key, element); 5829 }, 5830 Remove: function(key) { 5831 this.elementsMap.remove(key); 5832 }, 5833 Clear: function(){ 5834 this.elementsMap.clear(); 5835 }, 5836 Get: function(key){ 5837 return this.elementsMap.get(key); 5838 } 5839}); 5840(function garbageCollector(ASPx, options) { 5841 ASPx.modules.garbageCollector = garbageCollector; 5842 var interval = options.GCCheckInterval; 5843 window.setInterval(collectObjects, interval); 5844 function canCollectObjects() { 5845 if (!ASPx.GetControlCollection) return false; 5846 var collection = ASPx.GetControlCollection(); 5847 return collection && !collection.InCallback(); 5848 } 5849 function collectObjects() { 5850 if (!canCollectObjects()) return; 5851 ASPx.GetControlCollectionCollection().RemoveDisposedControls(); 5852 if(typeof(ASPx.GetStateController) != "undefined") 5853 ASPx.GetStateController().RemoveDisposedItems();
5854 if(ASPx.TableScrollHelperCollection) 5855 ASPx.TableScrollHelperCollection.RemoveDisposedObjects(); 5856 if(ASPx.Ident.scripts.ASPxClientRatingControl) 5857 ASPxClientRatingControl.RemoveDisposedElementUnderCursor(); 5858 var postHandler = ASPx.GetPostHandler(); 5859 if(postHandler) 5860 postHandler.RemoveDisposedFormsFromCache(); 5861 } 5862})(ASPx, options); 5863var ControlTree = ASPx.CreateClass(null, { 5864 constructor: function(controlCollection, container, controlFilter) { 5865 this.container = container; 5866 this.domMap = { }; 5867 this.rootNode = this.createNode(null, null); 5868 this.createControlTree(controlCollection, container, controlFilter); 5869 }, 5870 createControlTree: function(controlCollection, container, controlFilter) { 5871 controlCollection.ProcessControlsInContainer(container, function(control) { 5872 control.RegisterInControlTree(this); 5873 }.aspxBind(this), controlFilter); 5874 var fixedNodes = []; 5875 var fixedNodesChildren = []; 5876 for(var domElementID in this.domMap) { 5877 if(!this.domMap.hasOwnProperty(domElementID)) continue; 5878 var node = this.domMap[domElementID]; 5879 var controlOwner = node.control ? node.control.controlOwner : null; 5880 if(controlOwner && this.domMap[controlOwner.name]) 5881 continue; 5882 if(this.isFixedNode(node)) 5883 fixedNodes.push(node); 5884 else { 5885 var parentNode = this.findParentNode(domElementID); 5886 parentNode = parentNode || this.rootNode; 5887 if(this.isFixedNode(parentNode)) 5888 fixedNodesChildren.push(node); 5889 else { 5890 var childNode = node.mainNode || node; 5891 this.addChildNode(parentNode, childNode); 5892 } 5893 } 5894 } 5895 for(var i = fixedNodes.length - 1; i >= 0; i--) 5896 this.insertChildNode(this.rootNode, fixedNodes[i], 0); 5897 for(var i = fixedNodesChildren.length - 1; i >= 0; i--) 5898 this.insertChildNode(this.rootNode, fixedNodesChildren[i], 0); 5899 }, 5900 findParentNode: function(id) { 5901 var element = document.getElementById(id).parentNode; 5902 while(element && element.tagName !== "BODY") { 5903 if(element.id) { 5904 var parentNode = this.domMap[element.id]; 5905 if(parentNode) 5906 return parentNode; 5907 } 5908 element = element.parentNode; 5909 } 5910 return null; 5911 }, 5912 addChildNode: function(node, childNode) { 5913 if(!childNode.parentNode) { 5914 node.children.push(childNode); 5915 childNode.parentNode = node; 5916 } 5917 }, 5918 insertChildNode: function(node, childNode, index) { 5919 if(!childNode.parentNode) { 5920 ASPx.Data.ArrayInsert(node.children, childNode, index); 5921 childNode.parentNode = node; 5922 } 5923 }, 5924 addRelatedNode: function(node, relatedNode) { 5925 this.addChildNode(node, relatedNode); 5926 relatedNode.mainNode = node; 5927 }, 5928 isFixedNode: function(node) { 5929 var control = node.mainNode ? node.mainNode.control : node.control; 5930 return control && control.HasFixedPosition(); 5931 }, 5932 createNode: function(domElementID, control) { 5933 var node = { 5934 control: control, 5935 children: [], 5936 parentNode: null, 5937 mainNode: null 5938 }; 5939 if(domElementID) 5940 this.domMap[domElementID] = node; 5941 return node; 5942 } 5943}); 5944var ControlAdjuster = ASPx.CreateClass(null, { 5945 constructor: function() { 5946 }, 5947 adjustControlsInHierarchy: function(controlCollection, adjustFunc, container, collapseControls, controlFilter) { 5948 var controlTree = new ASPx.ControlTree(controlCollection, container, controlFilter); 5949 this.adjustControlsInTree(controlTree.rootNode, adjustFunc, container, collapseControls); 5950 }, 5951 adjustControlsInTree: function(treeNode, adjustFunc, container, collapseControls) { 5952 var observer = _aspxGetDomObserver(); 5953 observer.pause(container, true); 5954 var documentScrollInfo; 5955 if(collapseControls) { 5956 documentScrollInfo = ASPx.GetOuterScrollPosition(document.body); 5957 this.collapseControls(treeNode); 5958 } 5959 var adjustNodes = [], 5960 autoHeightNodes = []; 5961 var requireReAdjust = this.forEachControlCore(treeNode, collapseControls, adjustFunc, adjustNodes, autoHeightNodes); 5962 if(requireReAdjust) 5963 this.forEachControlsBackward(adjustNodes, collapseControls, adjustFunc); 5964 else { 5965 for(var i = 0, node; node = autoHeightNodes[i]; i++) 5966 node.control.AdjustAutoHeight(); 5967 } 5968 if(collapseControls) 5969 ASPx.RestoreOuterScrollPosition(documentScrollInfo); 5970 observer.resume(container, true); 5971 }, 5972 forEachControlCore: function(node, collapseControls, processFunc, adju
5972stNodes, autoHeightNodes) { 5973 var requireReAdjust = false, 5974 size, newSize; 5975 if(node.control) { 5976 var checkReadjustment = collapseControls && node.control.IsControlCollapsed() && node.control.CanCauseReadjustment(); 5977 if(checkReadjustment) 5978 size = node.control.GetControlPercentMarkerSize(false, true); 5979 if(node.control.IsControlCollapsed() && !node.control.IsExpandableByAdjustment()) 5980 node.control.ExpandControl(); 5981 node.control.isInsideHierarchyAdjustment = true; 5982 processFunc(node.control); 5983 node.control.isInsideHierarchyAdjustment = false; 5984 if(checkReadjustment) { 5985 newSize = node.control.GetControlPercentMarkerSize(false, true); 5986 requireReAdjust = size.width !== newSize.width; 5987 } 5988 if(node.control.sizingConfig.supportAutoHeight) 5989 autoHeightNodes.push(node); 5990 node.control.ResetControlPercentMarkerSize(); 5991 } 5992 for(var childNode, i = 0; childNode = node.children[i]; i++) 5993 requireReAdjust = this.forEachControlCore(childNode, collapseControls, processFunc, adjustNodes, autoHeightNodes) || requireReAdjust; 5994 adjustNodes.push(node); 5995 return requireReAdjust; 5996 }, 5997 forEachControlsBackward: function(adjustNodes, collapseControls, processFunc) { 5998 for(var i = 0, node; node = adjustNodes[i]; i++) 5999 this.forEachControlsBackwardCore(node, collapseControls, processFunc); 6000 }, 6001 forEachControlsBackwardCore: function(node, collapseControls, processFunc) { 6002 if(node.control) 6003 processFunc(node.control); 6004 if(node.children.length > 1) { 6005 for(var i = 0, childNode; childNode = node.children[i]; i++) { 6006 if(childNode.control) 6007 processFunc(childNode.control); 6008 } 6009 } 6010 }, 6011 collapseControls: function(node) { 6012 for(var childNode, i = 0; childNode = node.children[i]; i++) 6013 this.collapseControls(childNode); 6014 if(node.control && node.control.NeedCollapseControl()) 6015 node.control.CollapseControl(); 6016 } 6017}); 6018var controlAdjuster = null; 6019function GetControlAdjuster() { 6020 if(!controlAdjuster) 6021 controlAdjuster = new ControlAdjuster(); 6022 return controlAdjuster; 6023} 6024function _aspxFunctionIsInCallstack(currentCallee, targetFunction, depthLimit) { 6025 var candidate = currentCallee; 6026 var depth = 0; 6027 while(candidate && depth <= depthLimit) { 6028 candidate = candidate.caller; 6029 if(candidate == targetFunction) 6030 return true; 6031 depth++; 6032 } 6033 return false; 6034} 6035ASPx.attachToReady(aspxClassesWindowOnLoad); 6036function aspxClassesWindowOnLoad(){ 6037 ASPx.documentLoaded = true; 6038 _aspxMoveLinkElements(); 6039 _aspxSweepDuplicatedLinks(); 6040 ResourceManager.SynchronizeResources(); 6041 var externalScriptProcessor = GetExternalScriptProcessor(); 6042 if(externalScriptProcessor) 6043 externalScriptProcessor.ShowErrorMessages(); 6044 ASPx.AccessibilityUtils.initialize(); 6045 ASPx.GetControlCollection().Initialize(); 6046 _aspxInitializeScripts(); 6047 _aspxInitializeLinks(); 6048 _aspxInitializeFocus(); 6049 ASPx.GetControlCollection().FinalizeInitialization(); 6050} 6051Ident = { }; 6052Ident.IsDate = function(obj) { 6053 return obj && obj.constructor == Date; 6054}; 6055Ident.IsRegExp = function(obj) { 6056 return obj && obj.constructor === RegExp; 6057}; 6058Ident.IsArray = function(obj) { 6059 return obj && obj.constructor == Array; 6060}; 6061Ident.IsASPxClientCollection = function(obj) { 6062 return obj && obj.isASPxClientCollection; 6063}; 6064Ident.IsASPxClientControl = function(obj) { 6065 return obj && obj instanceof ASPxClientControlBase; 6066}; 6067Ident.IsASPxClientEdit = function(obj) { 6068 return obj && obj.isASPxClientEdit; 6069}; 6070Ident.IsFocusableElementRegardlessTabIndex = function (element) { 6071 var tagName = element.tagName; 6072 return tagName == "TEXTAREA" || tagName == "INPUT" || tagName == "A" || 6073 tagName == "SELECT" || tagName == "IFRAME" || tagName == "OBJECT" || tagName == "BUTTON"; 6074}; 6075Ident.isDialogInvisibleControl = function(control) { 6076 return !!ASPx.Dialog && ASPx.Dialog.isDialogInvisibleControl(control); 6077}; 6078Ident.isBatchEditUnusedEditor = function(control) { 6079 return !!ASPx.BatchEditHelper && ASPx.BatchEditHelper.isBatchEditUnusedEditor(control); 6080}; 6081Ident.scripts = {}; 6082if(ASPx.IsFunction(window.WebForm_InitCallbackAddField)) { 6083 (function() { 6084 var original = window.WebForm_InitCallbackAddField; 6085 window.WebForm_InitCallbackAddField = function(name, value) { 6086 if(typeof(name) == "string" && name) 6087 original.apply(null, arguments); 6088 }; 6089 })(); 6090} 6091ASPx.FireDefaultButton = function(evt, buttonID) { 6092 if(_aspxIsDefaultButtonEvent(evt, buttonID)) { 6093 var defaultButton = ASPx.GetElementById(buttonID);
6094 if(defaultButton && defaultButton.click) { 6095 if(ASPx.IsFocusable(defaultButton)) 6096 defaultButton.focus(); 6097 ASPx.Evt.DoElementClick(defaultButton); 6098 ASPx.Evt.PreventEventAndBubble(evt); 6099 return false; 6100 } 6101 } 6102 return true; 6103}; 6104function _aspxIsDefaultButtonEvent(evt, defaultButtonID) { 6105 if(evt.keyCode != ASPx.Key.Enter) 6106 return false; 6107 var srcElement = ASPx.Evt.GetEventSource(evt); 6108 if(!srcElement || srcElement.id === defaultButtonID) 6109 return true; 6110 var tagName = srcElement.tagName; 6111 var type = srcElement.type; 6112 return tagName != "TEXTAREA" && tagName != "BUTTON" && tagName != "A" && 6113 (tagName != "INPUT" || type != "checkbox" && type != "radio" && type != "button" && type != "submit" && type != "reset"); 6114} 6115var PostHandler = ASPx.CreateClass(null, { 6116 constructor: function() { 6117 this.Post = new ASPxClientEvent(); 6118 this.PostFinalization = new ASPxClientEvent(); 6119 this.observableForms = []; 6120 this.dxCallbackTriggers = {}; 6121 this.lastSubmitElementName = null; 6122 this.beforeOnSubmit = function() { }; 6123 this.ReplaceGlobalPostFunctions(); 6124 this.HandleDxCallbackBeginning(); 6125 this.HandleMSAjaxRequestBeginning(); 6126 }, 6127 Update: function() { 6128 this.ReplaceFormsSubmit(true); 6129 }, 6130 ProcessPostRequest: function(ownerID, isCallback, isMSAjaxRequest, isDXCallback) { 6131 this.cancelPostProcessing = false; 6132 this.isMSAjaxRequest = isMSAjaxRequest; 6133 if(this.SkipRaiseOnPost(ownerID, isCallback, isDXCallback)) 6134 return; 6135 var args = new PostHandlerOnPostEventArgs(ownerID, isCallback, isMSAjaxRequest, isDXCallback); 6136 this.Post.FireEvent(this, args); 6137 this.cancelPostProcessing = args.cancel; 6138 if(!args.cancel) 6139 this.PostFinalization.FireEvent(this, args); 6140 }, 6141 SkipRaiseOnPost: function(ownerID, isCallback, isDXCallback) { 6142 if(!isCallback) 6143 return false; 6144 var dxOwner = isDXCallback && ASPx.GetControlCollection().GetByName(ownerID); 6145 if(dxOwner) { 6146 this.dxCallbackTriggers[dxOwner.uniqueID] = true; 6147 return false; 6148 } 6149 if(this.dxCallbackTriggers[ownerID]) { 6150 this.dxCallbackTriggers[ownerID] = false; 6151 return true; 6152 } 6153 return false; 6154 }, 6155 ReplaceGlobalPostFunctions: function() { 6156 if(ASPx.IsFunction(window.__doPostBack)) 6157 this.ReplaceDoPostBack(); 6158 if(ASPx.IsFunction(window.WebForm_DoCallback)) 6159 this.ReplaceDoCallback(); 6160 if(ASPx.IsFunction(window.WebForm_ExecuteCallback)) 6161 this.ReplaceExecuteCallback(); 6162 this.ReplaceFormsSubmit(); 6163 }, 6164 HandleDxCallbackBeginning: function() { 6165 ASPx.GetControlCollection().BeforeInitCallback.AddHandler(function(s, e) { 6166 aspxRaisePostHandlerOnPost(e.callbackOwnerID, true, false, true); 6167 }); 6168 }, 6169 HandleMSAjaxRequestBeginning: function() { 6170 var pageRequestManager = ASPx.GetMSAjaxRequestManager(); 6171 if(pageRequestManager != null && Ident.IsArray(pageRequestManager._onSubmitStatements)) { 6172 pageRequestManager._onSubmitStatements.unshift(function() { 6173 var postbackSettings = Sys.WebForms.PageRequestManager.getInstance()._postBackSettings; 6174 var postHandler = aspxGetPostHandler(); 6175 aspxRaisePostHandlerOnPost(postbackSettings.asyncTarget, true, true); 6176 return !postHandler.cancelPostProcessing; 6177 }); 6178 } 6179 }, 6180 ReplaceDoPostBack: function() { 6181 var original = __doPostBack; 6182 __doPostBack = function(eventTarget, eventArgument) { 6183 var postHandler = aspxGetPostHandler(); 6184 aspxRaisePostHandlerOnPost(eventTarget); 6185 if(postHandler.cancelPostProcessing) 6186 return; 6187 ASPxClientControl.postHandlingLocked = true; 6188 original(eventTarget, eventArgument); 6189 delete ASPxClientControl.postHandlingLocked; 6190 }; 6191 }, 6192 ReplaceDoCallback: function() { 6193 var original = WebForm_DoCallback; 6194 WebForm_DoCallback = function(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) { 6195 var postHandler = aspxGetPostHandler(); 6196 aspxRaisePostHandlerOnPost(eventTarget, true); 6197 if(postHandler.cancelPostProcessing) 6198 return; 6199 return original(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync); 6200 }; 6201 }, 6202 ReplaceExecuteCallback: function() { 6203 var original = WebForm_ExecuteCallback; 6204 var handler = this; 6205 WebForm_ExecuteCallback = function(callbackObject) { 6206 var isDxCallback = callbackObject && callbackObject.context && ASPx.GetControlCollection().Get(callbackObject.context) !== null; 6207 ASPx.callbackProcessed = false; 6208 original(callbackObject); 6209 if(ASPx.Browser.Firefox && document.getElementById("__EVENTVALIDATION")) { 6210 var viewStateField = document.getElementById("__VIEWSTATE"); 6211 if(viewStateField) { 6212 var response = callbackObject.xmlRequest.responseText; 6213 var separatorIndex = response.indexOf("|");
6214 var validationFieldLength = separatorIndex > 0 ? response.substring(0, separatorIndex) : null; 6215 if(ASPx.IsNumber(validationFieldLength)) 6216 viewStateField.value = viewStateField.value; 6217 } 6218 } 6219 if(isDxCallback && !ASPx.callbackProcessed) { 6220 var request = callbackObject.xmlRequest; 6221 if(handler.HasAppErrorOnCallback(request) && ASPxClientUtils.IsExists(callbackObject.eventCallback)) 6222 callbackObject.eventCallback(handler.GetServerErrorText(), callbackObject.context); 6223 } 6224 }; 6225 }, 6226 HasAppErrorOnCallback: function(request) { 6227 if(!request) return false; 6228 var isServerError = request.status && request.status == 500; 6229 var pattern = /<html[^>]*>([\w|\W]*)<\/html>/im; 6230 var text = request.responseText; 6231 return isServerError && !!text && pattern.test(text); 6232 }, 6233 GetServerErrorText: function() { 6234 return "Internal Server Error"; 6235 }, 6236 ReplaceFormsSubmit: function(checkObservableCollection) { 6237 for(var i = 0; i < document.forms.length; i++) { 6238 var form = document.forms[i]; 6239 if(checkObservableCollection && ASPx.Data.ArrayIndexOf(this.observableForms, form) >= 0) 6240 continue; 6241 if(form.submit) 6242 this.ReplaceFormSubmit(form); 6243 this.ReplaceFormOnSumbit(form); 6244 this.observableForms.push(form); 6245 } 6246 }, 6247 ReplaceFormSubmit: function(form) { 6248 var originalSubmit = form.submit; 6249 form.submit = function() { 6250 var postHandler = aspxGetPostHandler(); 6251 aspxRaisePostHandlerOnPost(); 6252 if(postHandler.cancelPostProcessing) 6253 return false; 6254 var callee = arguments.callee; 6255 this.submit = originalSubmit; 6256 var submitResult = this.submit(); 6257 this.submit = callee; 6258 return submitResult; 6259 }; 6260 form = null; 6261 }, 6262 ReplaceFormOnSumbit: function(form) { 6263 var originalSubmit = form.onsubmit; 6264 form.onsubmit = function() { 6265 var postHandler = aspxGetPostHandler(); 6266 postHandler.beforeOnSubmit(); 6267 if(postHandler.isMSAjaxRequest) 6268 postHandler.isMsAjaxRequest = false; 6269 else 6270 aspxRaisePostHandlerOnPost(postHandler.GetLastSubmitElementName()); 6271 if(postHandler.cancelPostProcessing) 6272 return false; 6273 return ASPx.IsFunction(originalSubmit) 6274 ? originalSubmit.apply(this, arguments) 6275 : true; 6276 }; 6277 form = null; 6278 }, 6279 SetBeforeOnSubmit: function(action) { 6280 this.beforeOnSubmit = action; 6281 }, 6282 SetLastSubmitElementName: function(elementName) { 6283 this.lastSubmitElementName = elementName; 6284 }, 6285 GetLastSubmitElementName: function() { 6286 return this.lastSubmitElementName; 6287 }, 6288 RemoveDisposedFormsFromCache: function(){ 6289 for(var i = 0; this.observableForms && i < this.observableForms.length; i++){ 6290 var form = this.observableForms[i]; 6291 if(!ASPx.IsExistsElement(form)){ 6292 ASPx.Data.ArrayRemove(this.observableForms, form); 6293 i--; 6294 } 6295 } 6296 } 6297}); 6298function aspxRaisePostHandlerOnPost(ownerID, isCallback, isMSAjaxRequest, isDXCallback) { 6299 if(ASPxClientControl.postHandlingLocked) return; 6300 var postHandler = aspxGetPostHandler(); 6301 if(postHandler) 6302 postHandler.ProcessPostRequest(ownerID, isCallback, isMSAjaxRequest, isDXCallback); 6303} 6304var aspxPostHandler; 6305function aspxGetPostHandler() { 6306 if(!aspxPostHandler) 6307 aspxPostHandler = new PostHandler(); 6308 return aspxPostHandler; 6309} 6310var PostHandlerOnPostEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, { 6311 constructor: function(ownerID, isCallback, isMSAjaxCallback, isDXCallback){ 6312 this.constructor.prototype.constructor.call(this); 6313 this.ownerID = ownerID; 6314 this.isCallback = !!isCallback; 6315 this.isDXCallback = !!isDXCallback; 6316 this.isMSAjaxCallback = !!isMSAjaxCallback; 6317 } 6318}); 6319var ResourceManager = { 6320 HandlerStr: "DXR.axd?r=", 6321 ResourceHashes: {}, 6322 SynchronizeResources: function(method){ 6323 if(!method){ 6324 method = function(name, resource) { 6325 this.UpdateInputElements(name, resource); 6326 }.aspxBind(this); 6327 } 6328 var resources = this.GetResourcesData(); 6329 for(var name in resources) 6330 if(resources.hasOwnProperty(name)) 6331 method(name, resources[name]); 6332 }, 6333 GetResourcesData: function(){ 6334 return { 6335 DXScript: this.GetResourcesElementsString(_aspxGetIncludeScripts(), "src", "DXScript"), 6336 DXCss: this.GetResourcesElementsString(_aspxGetLinks(), "href", "DXCss") 6337 }; 6338 }, 6339 ParseBundleSrc: function(elements, urlAttr){ 6340 var timeStamp = ""; 6341 var resourceUrlArray = []; 6342 for(var i = 0; i < elements.length; i++) { 6343 var resourceUrl = ASPx.Attr.GetAttribute(elements[i], urlAttr); 6344 if(resourceUrl) { 6345 var pos = resourceUrl.indexOf(this.HandlerStr); 6346 if(pos > -1){ 6347 var list = resourceUrl.substr(pos + this.HandlerStr.length); 6348 var ampPos = list.lastIndexOf("-"); 6349 if(ampPos > -1) { 6350 timeStamp = list.substr(ampPos);
6351 list = list.substr(0, ampPos); 6352 } 6353 var indexes = list.split(","); 6354 for(var j = 0; j < indexes.length; j++) { 6355 resourceUrlArray.push(indexes[j]); 6356 } 6357 } 6358 else 6359 resourceUrlArray.push(resourceUrl); 6360 } 6361 } 6362 return { 6363 'resourceUrlArray': resourceUrlArray, 6364 'timeStamp': timeStamp 6365 }; 6366 }, 6367 GetResourceHashes: function (id) { 6368 if (!this.ResourceHashes[id]) 6369 this.ResourceHashes[id] = {}; 6370 return this.ResourceHashes[id]; 6371 }, 6372 GetResourcesElementsString: function (elements, urlAttr, id) { 6373 var hash = this.GetResourceHashes(id); 6374 var resourceUrlArray = this.ParseBundleSrc(elements, urlAttr).resourceUrlArray; 6375 for(var i = 0; i < resourceUrlArray.length; i++) { 6376 hash[resourceUrlArray[i]] = resourceUrlArray[i]; 6377 } 6378 var array = []; 6379 for(var key in hash) 6380 if(hash.hasOwnProperty(key)) 6381 array.push(key); 6382 return array.join(","); 6383 }, 6384 GetNewResourcesElementString: function (element, urlAttr, id) { 6385 var originalUrl = ASPx.Attr.GetAttribute(element, urlAttr); 6386 var handlerStrIndex = originalUrl.indexOf(this.HandlerStr); 6387 var dxResources = handlerStrIndex > -1; 6388 if(!dxResources) return element[urlAttr]; 6389 var hash = this.GetResourceHashes(id); 6390 var srcInfo = this.ParseBundleSrc([element], urlAttr); 6391 var resourceUrlArray = srcInfo.resourceUrlArray; 6392 var timeStamp = srcInfo.timeStamp; 6393 var newResourceArray = []; 6394 for(var i = 0; i < resourceUrlArray.length; i++) { 6395 if(!hash[resourceUrlArray[i]]) 6396 newResourceArray.push(resourceUrlArray[i]); 6397 } 6398 var newResources = ""; 6399 if(newResourceArray.length > 0) { 6400 var baseUrl = originalUrl.substr(0, handlerStrIndex); 6401 newResources = baseUrl + this.HandlerStr + newResourceArray.join(",") + timeStamp; 6402 } 6403 return newResources; 6404 }, 6405 UpdateInputElements: function(typeName, list){ 6406 for(var i = 0; i < document.forms.length; i++){ 6407 var inputElement = document.forms[i][typeName]; 6408 if(!inputElement) 6409 inputElement = this.CreateInputElement(document.forms[i], typeName); 6410 inputElement.value = list; 6411 } 6412 }, 6413 CreateInputElement: function(form, typeName){ 6414 var inputElement = ASPx.CreateHiddenField(typeName); 6415 form.appendChild(inputElement); 6416 return inputElement; 6417 } 6418}; 6419ASPx.includeScriptPrefix = "dxis_"; 6420ASPx.startupScriptPrefix = "dxss_"; 6421var includeScriptsCache = {}; 6422var createdIncludeScripts = []; 6423var appendedScriptsCount = 0; 6424var callbackOwnerNames = []; 6425var scriptsRestartHandlers = { }; 6426function _aspxIsKnownIncludeScript(script) { 6427 return !!includeScriptsCache[script.src]; 6428} 6429function _aspxCacheIncludeScript(script) { 6430 includeScriptsCache[script.src] = 1; 6431} 6432function _aspxProcessScriptsAndLinks(ownerName, isCallback) { 6433 if(!ASPx.documentLoaded) return; 6434 _aspxProcessScripts(ownerName, isCallback); 6435 getLinkProcessor().process(); 6436 ASPx.ClearCachedCssRules(); 6437} 6438function _aspxGetStartupScripts(container) { 6439 return _aspxGetScriptsCore(ASPx.startupScriptPrefix, container); 6440} 6441function _aspxGetIncludeScripts() { 6442 return _aspxGetScriptsCore(ASPx.includeScriptPrefix); 6443} 6444function _aspxGetScriptsCore(prefix, container) { 6445 var result = []; 6446 var scripts; 6447 if(ASPx.IsExists(container)) 6448 scripts = ASPx.GetNodesByTagName(container, "SCRIPT"); 6449 else 6450 scripts = document.getElementsByTagName("SCRIPT"); 6451 for(var i = 0; i < scripts.length; i++) { 6452 if(scripts[i].id.indexOf(prefix) == 0) 6453 result.push(scripts[i]); 6454 } 6455 return result; 6456} 6457function _aspxIsResourceLink(link) { 6458 if(typeof link !== "string") 6459 link = link.href; 6460 return link.toLowerCase().indexOf(ResourceManager.HandlerStr.toLowerCase()) >= 0; 6461} 6462function _aspxGetLinks(allLinks) { 6463 var result = []; 6464 var links = document.getElementsByTagName("LINK"); 6465 for(var i = 0; i < links.length; i++) { 6466 if(allLinks || _aspxIsResourceLink(links[i])) 6467 result.push(links[i]); 6468 } 6469 return result; 6470} 6471function _aspxIsLinksLoaded() { 6472 var links = _aspxGetLinks(true); 6473 for(var i = 0, link; link = links[i]; i++) 6474 if(link.readyState && link.readyState.toLowerCase() == "loading") 6475 return false; 6476 return true; 6477} 6478function _aspxInitializeLinks() { 6479 var links = _aspxGetLinks(true); 6480 for(var i = 0; i < links.length; i++) 6481 links[i].loaded = true; 6482} 6483var scriptExecutedAttrName = "data-executed"; 6484var scriptDelayedExecutionAttrName = "data-dx-delayedeval"; 6485ASPx.MarkInnerScriptBlocksAsDelayedExecution = function(scriptsContainer) { 6486 var scripts = scriptsContainer.querySelectorAll("script[id^=" + ASPx.startupScriptPrefix + "]"); 6487 for(var i = 0; i < scripts.length; i++) 6488 ASPx.Attr.SetAttribute(scripts[i], scriptDelayedExecutionAttrName, true); 6489}; 6490function isScriptExecuted(script) { 6491 return ASPx.Attr.GetAttribute(script, scriptExecutedAttrName); 6492} 6493function markScriptAsExecuted(script) { 6494 if(ASPx.Attr.GetAttribute(script, scriptDelayedExecutionAttrName)) 6495 ASPx.Attr.RemoveAttribute(script, scriptDelayedExecutionAttrName); 6496 else
6497 ASPx.Attr.SetAttribute(script, scriptExecutedAttrName, true); 6498} 6499function _aspxInitializeScripts() { 6500 var scripts = _aspxGetIncludeScripts(); 6501 for(var i = 0; i < scripts.length; i++) 6502 _aspxCacheIncludeScript(scripts[i]); 6503 var startupScripts = _aspxGetStartupScripts(); 6504 for(var i = 0; i < startupScripts.length; i++) 6505 markScriptAsExecuted(startupScripts[i]); 6506} 6507function _aspxSweepDuplicatedLinks() { 6508 var hash = { }; 6509 var links = _aspxGetLinks(); 6510 for(var i = 0; i < links.length; i++) { 6511 var href = links[i].href; 6512 if(!href) 6513 continue; 6514 if(hash[href]){ 6515 if(!hash[href].loaded && links[i].loaded) { 6516 ASPx.RemoveElement(hash[href]); 6517 hash[href] = links[i]; 6518 } 6519 else 6520 ASPx.RemoveElement(links[i]); 6521 } 6522 else 6523 hash[href] = links[i]; 6524 } 6525} 6526function _aspxSweepDuplicatedScripts() { 6527 var hash = { }; 6528 var scripts = _aspxGetIncludeScripts(); 6529 for(var i = 0; i < scripts.length; i++) { 6530 var src = scripts[i].src; 6531 if(!src) continue; 6532 if(hash[src]) 6533 ASPx.RemoveElement(scripts[i]); 6534 else 6535 hash[src] = scripts[i]; 6536 } 6537} 6538function _aspxAreScriptsEqual(script1, script2) { 6539 return script1.src == script2.src; 6540} 6541function _aspxProcessScripts(ownerName, isCallback) { 6542 var scripts = _aspxGetIncludeScripts(); 6543 var previousCreatedScript = null; 6544 var firstCreatedScript = null; 6545 for(var i = 0; i < scripts.length; i++) { 6546 var script = scripts[i]; 6547 if(script.src == "") continue; 6548 if(_aspxIsKnownIncludeScript(script)) 6549 continue; 6550 var getOnlyNewResources = true; 6551 var onlyNewScripts = ResourceManager.GetNewResourcesElementString(script, "src", "DXScript", getOnlyNewResources); 6552 if (onlyNewScripts == "") 6553 continue; 6554 var createdScript = document.createElement("script"); 6555 ASPx.Attr.AppendScriptType(createdScript); 6556 createdScript.src = onlyNewScripts; 6557 createdScript.id = script.id; 6558 if(ASPx.Data.ArrayIndexOf(createdIncludeScripts, createdScript, _aspxAreScriptsEqual) >= 0) 6559 continue; 6560 createdIncludeScripts.push(createdScript); 6561 ASPx.RemoveElement(script); 6562 if(ASPx.Browser.Edge || ASPx.Browser.WebKitFamily || (ASPx.Browser.Firefox && ASPx.Browser.Version >= 4) || ASPx.Browser.IE) { 6563 createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this, " + isCallback + ");"); 6564 if(firstCreatedScript == null) 6565 firstCreatedScript = createdScript; 6566 createdScript.nextCreatedScript = null; 6567 if(previousCreatedScript != null) 6568 previousCreatedScript.nextCreatedScript = createdScript; 6569 previousCreatedScript = createdScript; 6570 } else { 6571 createdScript.onload = new Function("ASPx.OnScriptLoadCallback(this);"); 6572 ASPx.AppendScript(createdScript); 6573 _aspxCacheIncludeScript(createdScript); 6574 } 6575 } 6576 if(firstCreatedScript != null) { 6577 ASPx.AppendScript(firstCreatedScript); 6578 _aspxCacheIncludeScript(firstCreatedScript); 6579 } 6580 if(isCallback) 6581 callbackOwnerNames.push(ownerName); 6582 if(createdIncludeScripts.length == 0) { 6583 var newLinks = ASPx.GetNodesByTagName(document.body, "link"); 6584 var needProcessLinks = isCallback && newLinks.length > 0; 6585 if(needProcessLinks) 6586 needProcessLinks = getLinkProcessor().addLinks(newLinks); 6587 if(!needProcessLinks) 6588 ASPx.FinalizeScriptProcessing(isCallback); 6589 } 6590} 6591ASPx.FinalizeScriptProcessing = function(isCallback) { 6592 createdIncludeScripts = []; 6593 appendedScriptsCount = 0; 6594 var linkProcessor = getLinkProcessor(); 6595 if(linkProcessor.hasLinks()) 6596 _aspxSweepDuplicatedLinks(); 6597 linkProcessor.reset(); 6598 _aspxSweepDuplicatedScripts(); 6599 ResourceManager.SynchronizeResources(); 6600 _aspxRunStartupScripts(isCallback); 6601}; 6602var startupScriptsRunning = false; 6603function _aspxRunStartupScripts(isCallback, container) { 6604 startupScriptsRunning = true; 6605 try { 6606 _aspxRunStartupScriptsCore(container); 6607 } 6608 finally { 6609 startupScriptsRunning = false; 6610 } 6611 if(ASPx.documentLoaded) { 6612 ASPx.GetControlCollection().ProcessActionByPredicate( 6613 function(collection) { collection.InitializeElements(isCallback); }, 6614 function(control) { return !ASPx.IsExists(container) || ASPx.GetIsParent(container, control.GetMainElement()); } 6615 ); 6616 for(var key in scriptsRestartHandlers) 6617 if(scriptsRestartHandlers.hasOwnProperty(key)) 6618 scriptsRestartHandlers[key](); 6619 if(isCallback) 6620 _aspxRunEndCallbackScript(); 6621 } 6622} 6623function _aspxIsStartupScriptsRunning(isCallback) { 6624 return startupScriptsRunning; 6625} 6626function _aspxRunStartupScriptsCore(container) { 6627 var scripts = _aspxGetStartupScripts(container); 6628 var code; 6629 for(var i = 0; i < scripts.length; i++){ 6630 var script = scripts[i]; 6631 if(!isScriptExecuted(script)) { 6632 _aspxEnsureStartupScriptIsUnique(script.id); 6633 code = ASPx.GetScriptCode(script); 6634 eval(code); 6635 markScriptAsExecuted(script); 6636 } 6637 } 6638} 6639function _aspxEnsureStartupScriptIsUnique(scriptId) { 6640 if(!scriptId) 6641 return; 6642 var scriptExecutedSelector = "script[" + scriptExecutedAttrName + "='true']#" + scriptId; 6643 ASPx.RemoveElement(document.querySelector(scriptExecutedSelector)); 6644} 6645function _aspxRunEndCallbackScript() { 6646 while(callbackOwnerNames.length > 0) { 6647 var callbackOwnerName = callbackOwnerNames.pop(); 6648 var callbackOwner = ASPx.GetControlCollection().Get(callbackOwnerName); 6649 if(callbackOwner) 6650 callbackOwner.DoEndCallback(); 6651 } 6652} 6653ASPx.RunStartupScriptsCreatedOnClient = function(container) { 6654 _aspxRunStartupScriptsCore(container); 6655};
6656ASPx.OnScriptReadyStateChangedCallback = function(scriptElement, isCallback) { 6657 if(scriptElement.readyState == "loaded") { 6658 _aspxCacheIncludeScript(scriptElement); 6659 for(var i = 0; i < createdIncludeScripts.length; i++) { 6660 var script = createdIncludeScripts[i]; 6661 if(_aspxIsKnownIncludeScript(script)) { 6662 if(!isScriptExecuted(script)) { 6663 markScriptAsExecuted(script); 6664 ASPx.AppendScript(script); 6665 appendedScriptsCount++; 6666 } 6667 } else 6668 break; 6669 } 6670 if(createdIncludeScripts.length == appendedScriptsCount) 6671 ASPx.FinalizeScriptProcessing(isCallback); 6672 } 6673}; 6674ASPx.OnScriptLoadCallback = function(scriptElement, isCallback) { 6675 appendedScriptsCount++; 6676 if(scriptElement.nextCreatedScript) { 6677 ASPx.AppendScript(scriptElement.nextCreatedScript); 6678 _aspxCacheIncludeScript(scriptElement.nextCreatedScript); 6679 } 6680 if(createdIncludeScripts.length == appendedScriptsCount) 6681 ASPx.FinalizeScriptProcessing(isCallback); 6682}; 6683function _aspxAddScriptsRestartHandler(objectName, handler) { 6684 scriptsRestartHandlers[objectName] = handler; 6685} 6686function _aspxMoveLinkElements() { 6687 var head = ASPx.GetNodesByTagName(document, "head")[0]; 6688 var bodyLinks = ASPx.GetNodesByTagName(document.body, "link"); 6689 if(head && bodyLinks.length > 0){ 6690 var headLinks = ASPx.GetNodesByTagName(head, "link"); 6691 var dxLinkAnchor = head.firstChild; 6692 for(var i = 0; i < headLinks.length; i++){ 6693 if(_aspxIsResourceLink(headLinks[i])) 6694 dxLinkAnchor = headLinks[i].nextSibling; 6695 } 6696 while(bodyLinks.length > 0) 6697 head.insertBefore(bodyLinks[0], dxLinkAnchor); 6698 } 6699} 6700var LinkProcessor = ASPx.CreateClass(null, { 6701 constructor: function() { 6702 this.linkInfos = []; 6703 this.loadingObservationTimerID = -1; 6704 }, 6705 process: function() { 6706 if(this.hasLinks()) { 6707 if(this.isLinkLoadEventSupported()) 6708 this.processViaLoadEvent(); 6709 else 6710 this.processViaTimer(); 6711 } 6712 else 6713 _aspxSweepDuplicatedLinks(); 6714 _aspxMoveLinkElements(); 6715 }, 6716 addLinks: function(links) { 6717 var prevLinkCount = this.linkInfos.length; 6718 for(var i = 0; i < links.length; i++) { 6719 var link = links[i]; 6720 if(link.loaded || link.rel != "stylesheet" || !_aspxIsResourceLink(link)) 6721 continue; 6722 var linkInfo = { 6723 link: link, 6724 href: link.href 6725 }; 6726 this.linkInfos.push(linkInfo); 6727 } 6728 return prevLinkCount != this.linkInfos.length; 6729 }, 6730 hasLinks: function() { 6731 return this.linkInfos.length > 0; 6732 }, 6733 reset: function() { 6734 this.linkInfos = []; 6735 }, 6736 processViaLoadEvent: function() { 6737 for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) 6738 linkInfo.link.onload = this.onLinkLoad.bind(this); 6739 }, 6740 isLinkLoadEventSupported: function() { 6741 return !(ASPx.Browser.Chrome && ASPx.Browser.MajorVersion < 19 || ASPx.Browser.Firefox && ASPx.Browser.MajorVersion < 9 || 6742 ASPx.Browser.Safari && ASPx.Browser.MajorVersion < 6 || ASPx.Browser.AndroidDefaultBrowser && ASPx.Browser.MajorVersion < 4.4); 6743 }, 6744 processViaTimer: function() { 6745 if(this.loadingObservationTimerID == -1) 6746 this.onLinksLoadingObserve(); 6747 }, 6748 onLinksLoadingObserve: function() { 6749 if(this.getIsAllLinksLoaded()) { 6750 this.loadingObservationTimerID = -1; 6751 this.onAllLinksLoad(); 6752 } 6753 else 6754 this.loadingObservationTimerID = window.setTimeout(this.onLinksLoadingObserve.aspxBind(this), 100); 6755 }, 6756 getIsAllLinksLoaded: function() { 6757 var styleSheets = document.styleSheets; 6758 var loadedLinkHrefs = { }; 6759 for(var i = 0; i < styleSheets.length; i++) { 6760 var styleSheet = styleSheets[i]; 6761 try { 6762 if(styleSheet.cssRules) 6763 loadedLinkHrefs[styleSheet.href] = 1; 6764 } 6765 catch(ex) { } 6766 } 6767 var loadedLinksCount = 0; 6768 for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) { 6769 if(loadedLinkHrefs[linkInfo.href]) 6770 loadedLinksCount++; 6771 } 6772 return loadedLinksCount == this.linkInfos.length; 6773 }, 6774 onAllLinksLoad: function() { 6775 this.reset(); 6776 _aspxSweepDuplicatedLinks(); 6777 if(createdIncludeScripts.length == 0) 6778 ASPx.FinalizeScriptProcessing(true); 6779 }, 6780 onLinkReadyStateChanged: function(linkElement) { 6781 if(linkElement.readyState == "complete") 6782 this.onLinkLoadCore(linkElement); 6783 }, 6784 onLinkLoad: function(evt) { 6785 var linkElement = ASPx.Evt.GetEventSource(evt); 6786 this.onLinkLoadCore(linkElement); 6787 }, 6788 onLinkLoadCore: function(linkElement) { 6789 var linkInfo = this.getLinkInfo(linkElement); 6790 if(!linkInfo) return; 6791 linkInfo.loaded = true; 6792 var notLoadedLinks = this.linkInfos.filter(function(info) { return !info.loaded; }); 6793 if(notLoadedLinks.length == 0) 6794 this.onAllLinksLoad(); 6795 }, 6796 getLinkInfo: function(linkElement) { 6797 for(var i = 0, linkInfo; linkInfo = this.linkInfos[i]; i++) { 6798 if(linkInfo.link == linkElement) 6799 return linkInfo; 6800 } 6801 } 6802}); 6803var linkProcessor = null; 6804function getLinkProcessor() { 6805 if(linkProcessor == null) 6806 linkProcessor = new LinkProcessor(); 6807 return linkProcessor; 6808} 6809ASPx.LinkProcessor = LinkProcessor; 6810var IFrameHelper = ASPx.CreateClass(null, { 6811 constructor: function(params) { 6812 this.params = params || {}; 6813 this.params.src = this.params.src || ""; 6814 this.CreateElements(); 6815 }, 6816 CreateElements: function() { 6817 var elements = IFrameHelper.Create(this.params); 6818 this.containerElement = elements.container; 6819 this.iframeElement = elements.iframe; 6820 this.AttachOnLoadHandler(this, this.iframeElement);
6821 this.SetLoading(true); 6822 if(this.params.onCreate) 6823 this.params.onCreate(this.containerElement, this.iframeElement); 6824 }, 6825 AttachOnLoadHandler: function(instance, element) { 6826 ASPx.Evt.AttachEventToElement(element, "load", function() { 6827 instance.OnLoad(element); 6828 }); 6829 }, 6830 OnLoad: function(element) { 6831 this.SetLoading(false, element); 6832 if(!element.preventCustomOnLoad && this.params.onLoad) 6833 this.params.onLoad(); 6834 }, 6835 IsLoading: function(element) { 6836 element = element || this.iframeElement; 6837 if(element) 6838 return element.loading; 6839 return false; 6840 }, 6841 SetLoading: function(value, element) { 6842 element = element || this.iframeElement; 6843 if(element) 6844 element.loading = value; 6845 }, 6846 GetContentUrl: function() { 6847 return this.params.src; 6848 }, 6849 SetContentUrl: function(url, preventBrowserCaching) { 6850 if(url) { 6851 this.params.src = url; 6852 if(preventBrowserCaching) 6853 url = IFrameHelper.AddRandomParamToUrl(url); 6854 this.SetLoading(true); 6855 this.iframeElement.src = url; 6856 } 6857 }, 6858 RefreshContentUrl: function() { 6859 if(this.IsLoading()) 6860 return; 6861 this.SetLoading(true); 6862 var oldContainerElement = this.containerElement; 6863 var oldIframeElement = this.iframeElement; 6864 var postfix = "_del" + Math.floor(Math.random()*100000).toString(); 6865 if(this.params.id) 6866 oldIframeElement.id = this.params.id + postfix; 6867 if(this.params.name) 6868 oldIframeElement.name = this.params.name + postfix; 6869 ASPx.SetStyles(oldContainerElement, { height: 0 }); 6870 this.CreateElements(); 6871 oldIframeElement.preventCustomOnLoad = true; 6872 oldIframeElement.src = ASPx.BlankUrl; 6873 window.setTimeout(function() { 6874 oldContainerElement.parentNode.removeChild(oldContainerElement); 6875 }, 10000); 6876 } 6877}); 6878IFrameHelper.Create = function(params) { 6879 var iframeHtmlStringParts = [ "<iframe frameborder='0'" ]; 6880 if(params) { 6881 if(params.id) 6882 iframeHtmlStringParts.push(" id='", params.id, "'"); 6883 if(params.name) 6884 iframeHtmlStringParts.push(" name='", params.name, "'"); 6885 if(params.title) 6886 iframeHtmlStringParts.push(" title='", params.title, "'"); 6887 if(params.scrolling) 6888 iframeHtmlStringParts.push(" scrolling='", params.scrolling, "'"); 6889 if(params.src) 6890 iframeHtmlStringParts.push(" src='", params.src, "'"); 6891 } 6892 iframeHtmlStringParts.push("></iframe>"); 6893 var containerElement = ASPx.CreateHtmlElementFromString("<div style='border-width: 0px; padding: 0px; margin: 0px'></div>"); 6894 var iframeElement = ASPx.CreateHtmlElementFromString(iframeHtmlStringParts.join("")); 6895 containerElement.appendChild(iframeElement); 6896 return { 6897 container: containerElement, 6898 iframe: iframeElement 6899 }; 6900}; 6901IFrameHelper.AddRandomParamToUrl = function(url) { 6902 var prefix = url.indexOf("?") > -1 6903 ? "&" 6904 : "?"; 6905 var param = prefix + Math.floor(Math.random()*100000).toString(); 6906 var anchorIndex = url.indexOf("#"); 6907 return anchorIndex == -1 6908 ? url + param 6909 : url.substr(0, anchorIndex) + param + url.substr(anchorIndex); 6910}; 6911IFrameHelper.GetWindow = function(name) { 6912 var frameElement = document.getElementById(name); 6913 return (frameElement != null) ? frameElement.contentWindow : null; 6914}; 6915IFrameHelper.GetDocument = function(name) { 6916 var frameElement = document.getElementById(name); 6917 return (frameElement != null) ? frameElement.contentDocument : null; 6918}; 6919IFrameHelper.GetDocumentBody = function(name) { 6920 var doc = IFrameHelper.GetDocument(name); 6921 return (doc != null) ? doc.body : null; 6922}; 6923IFrameHelper.GetDocumentHead = function (name) { 6924 var doc = IFrameHelper.GetDocument(name); 6925 return (doc != null) ? doc.head || doc.getElementsByTagName('head')[0] : null; 6926}; 6927IFrameHelper.GetElement = function(name) { 6928 return document.getElementById(name); 6929}; 6930var KbdHelper = ASPx.CreateClass(null, { 6931 constructor: function(control) { 6932 this.control = control; 6933 this.ready = false; 6934 this.clickHandler = this.HandleClick.bind(this); 6935 this.focusHandler = this.onElementFocus.bind(this); 6936 this.blurHandler = this.onBlur.bind(this); 6937 }, 6938 Init: function() { 6939 if(!this.ready){ 6940 KbdHelper.GlobalInit(); 6941 var elements = this.getFocusableElements(); 6942 for(var i = 0; i < elements.length; i++) { 6943 var element = elements[i]; 6944 element.tabIndex = Math.max(element.tabIndex, 0); 6945 ASPx.Evt.AttachEventToElement(element, "click", this.clickHandler); 6946 ASPx.Evt.AttachEventToElement(element, "focus", this.focusHandler); 6947 ASPx.Evt.AttachEventToElement(element, "blur", this.blurHandler); 6948 } 6949 this.ready = true; 6950 } 6951 }, 6952 Dispose: function() { 6953 if(this.ready) { 6954 var elements = this.getFocusableElements(); 6955 for(var i = 0; i < elements.length; i++) { 6956 var element = elements[i]; 6957 element.tabIndex = -1; 6958 ASPx.Evt.DetachEventFromElement(element, "click", this.clickHandler); 6959 ASPx.Evt.DetachEventFromElement(element, "focus", this.focusHandler); 6960 ASPx.Evt.DetachEventFromElement(element, "blur", this.blurHandler); 6961 } 6962 this.ready = false; 6963 } 6964 }, 6965 onElementFocus: function(e) { 6966 if(!this.CanFocus(e)) 6967 return true; 6968 KbdHelper.active = this; 6969 }, 6970 getFocusableElements: function() { 6971 return [this.GetFocusableElement()]; 6972 }, 6973 GetFocusableElement: function() { return this.control.GetMainElement(); }, 6974 canHandleNoFocusAction: function() { 6975 var focusableElements = this.getFocusableElements(); 6976 for(var i = 0; i < focusableElements.length; i++) { 6977 if(focusableElements[i] === _aspxGetFocusedElement()) 6978 return false; 6979 } 6980 return true; 6981 }, 6982 RequirePreventScrollOnFocus: function() { return false; }, 6983 CanFocus: function(e) { 6984 var tag = ASPx.Evt.GetEventSource(e).tagName; 6985 return !(tag === "A" || tag === "TEXTAREA" || tag === "INPUT" || tag === "SELECT" || tag === "IFRAME" || tag === "OBJECT"); 6986 }, 6987 HandleClick: function(e) { 6988 if(!this.CanFocus(e)) 6989 return; 6990 this.Focus(); 6991 }, 6992 Focus: function() { 6993 var preventScroll = this.RequirePreventScrollOnFocus(); 6994 var savedDocumentScrollTop = preventScroll ? ASPx.GetDocumentScrollTop() : -1; 6995 try { 6996 this.GetFocusableElement().focus({ preventScroll: preventScroll }); 6997 } catch(e) { } 6998 if(preventScroll && !this.IsNativePreventScrollOnFocusSupported() && savedDocumentScrollTop !== ASPx.GetDocumentScrollTop()) 6999 ASPx.SetDocumentScrollTop(savedDocumentScrollTop); 7000 }, 7001 IsNativePreventScrollOnFocusSupported: function() { 7002 if(this.isNativePreventScrollOnFocusSupported === undefined) 7003 this.isNativePreventScrollOnFocusSupported = this.CalcIsNativePreventScrollOnFocusSupported(); 7004 return this.isNativePreventScrollOnFocusSupported; 7005 }, 7006 CalcIsNativePreventScrollOnFocusSupported: function() { 7007 var result = false; 7008 try { 7009 ASPx.GetActiveElement().focus(Object.defineProperty({}, "preventScroll", { get: function() { result = true; } })); 7010 } catch(e) { result = false; } 7011 return result; 7012 }, 7013 onBlur: function(){ 7014 delete KbdHelper.active; 7015 }, 7016 HandleKeyDown: function(e) { }, 7017 HandleKeyPress: function(e) { }, 7018 HandleKeyUp: function (e) { }, 7019 HandleNoFocusAction: function(e) { }, 7020 FocusByAccessKey: function () { } 7021}); 7022KbdHelper.GlobalInit = function() { 7023 if(KbdHelper.ready) 7024 return; 7025 ASPx.Evt.AttachEventToDocument("keydown", KbdHelper.OnKeyDown); 7026 ASPx.Evt.AttachEventToDocument("keypress", KbdHelper.OnKeyPress); 7027 ASPx.Evt.AttachEventToDocument("keyup", KbdHelper.OnKeyUp); 7028 KbdHelper.ready = true; 7029}; 7030KbdHelper.swallowKey = false; 7031KbdHelper.accessKeys = { }; 7032KbdHelper.ProcessKey = function(e, actionName) { 7033 if(!KbdHelper.active) 7034 return; 7035 if (KbdHelper.active.canHandleNoFocusAction()) { 7036 KbdHelper.active["HandleNoFocusAction"](e, actionName); 7037 return; 7038 } 7039 var ctl = KbdHelper.active.control; 7040 if(ctl !== ASPx.GetControlCollection().Get(ctl.name)) { 7041 delete KbdHelper.active; 7042 return; 7043 } 7044 if(!KbdHelper.swallowKey) 7045 KbdHelper.swallowKey = KbdHelper.active[actionName](e); 7046 if(KbdHelper.swallowKey) 7047 ASPx.Evt.PreventEvent(e); 7048};
7049KbdHelper.OnKeyDown = function(e) { 7050 KbdHelper.swallowKey = false; 7051 if(KbdHelper.TryAccessKey(KbdHelper.getKeyName(e))) 7052 ASPx.Evt.PreventEvent(e); 7053 else 7054 KbdHelper.ProcessKey(e, "HandleKeyDown"); 7055}; 7056KbdHelper.OnKeyPress = function(e) { KbdHelper.ProcessKey(e, "HandleKeyPress"); }; 7057KbdHelper.OnKeyUp = function(e) { KbdHelper.ProcessKey(e, "HandleKeyUp"); }; 7058KbdHelper.RegisterAccessKey = function(obj) { 7059 var key; 7060 if(obj.accessKey) 7061 key = "CtrlShift" + obj.accessKey; 7062 else if(obj.keyTipModeShortcut) 7063 key = obj.keyTipModeShortcut; 7064 if(!key) return; 7065 KbdHelper.accessKeys[key.toLowerCase()] = obj.name; 7066}; 7067KbdHelper.TryAccessKey = function(code) { 7068 var key = code.toLowerCase ? code.toLowerCase() : String.fromCharCode(code).toLowerCase(); 7069 var name = KbdHelper.accessKeys[key]; 7070 if(!name) return false; 7071 var obj = ASPx.GetControlCollection().Get(name); 7072 return KbdHelper.ClickAccessKey(obj); 7073}; 7074KbdHelper.ClickAccessKey = function (control) { 7075 if (!control) return false; 7076 var el = control.GetMainElement(); 7077 if (!el) return false; 7078 el.focus(); 7079 setTimeout(function () { 7080 if (KbdHelper.active && KbdHelper.active.FocusByAccessKey) 7081 KbdHelper.active.FocusByAccessKey(); 7082 }.aspxBind(this), ASPx.FOCUS_TIMEOUT); 7083 return true; 7084}; 7085KbdHelper.getKeyName = function(e) { 7086 var name = ""; 7087 if(e.altKey) 7088 name += "Alt"; 7089 if(e.ctrlKey) 7090 name += "Ctrl"; 7091 if(e.shiftKey) 7092 name += "Shift"; 7093 var keyCode = e.key || e.code || String.fromCharCode(ASPx.Evt.GetKeyCode(e)); 7094 if(keyCode.match(/key/i)) 7095 name += keyCode.replace(/key/i, ""); 7096 else if(keyCode.match(/digit/i)) 7097 name += keyCode.replace(/digit/i, ""); 7098 else if(keyCode.match(/arrow/i)) 7099 name += keyCode.replace(/arrow/i, ""); 7100 else if(keyCode.match(/ins/i)) 7101 name += "Ins"; 7102 else if(keyCode.match(/del/i)) 7103 name += "Del"; 7104 else if(keyCode.match(/back/i)) 7105 name += "Back"; 7106 else if(!keyCode.match(/alt/i) && !keyCode.match(/control/i) && !keyCode.match(/shift/i)) 7107 name += keyCode; 7108 return name.replace(/^a-zA-Z0-9/, ""); 7109}; 7110AccessKeysHelper = ASPx.CreateClass(KbdHelper, { 7111 constructor: function (control) { 7112 this.constructor.prototype.constructor.call(this, control); 7113 this.accessKeysVisible = false; 7114 this.activeKey = null; 7115 this.accessKey = control.createAccessKey ? control.createAccessKey(control.accessKey) : new AccessKey(control.accessKey); 7116 this.accessKeys = this.accessKey.accessKeys; 7117 this.charIndex = 0; 7118 this.onFocusByAccessKey = null; 7119 this.onClose = null; 7120 this.manualStopProcessing = false; 7121 this.isActive = false; 7122 this.areAccessKeysShown = false; 7123 }, 7124 Init: function (control) { 7125 KbdHelper.prototype.Init.call(this); 7126 KbdHelper.RegisterAccessKey(control); 7127 }, 7128 Add: function (accessKey) { 7129 this.accessKey.Add(accessKey); 7130 }, 7131 HandleKeyDown: function (e) { 7132 var keyCode = ASPx.Evt.GetKeyCode(e); 7133 var stopProcessing = this.processKeyDown(keyCode); 7134 if (stopProcessing.value) { 7135 this.stopProcessing(); 7136 if(this.onClosedOnEscape && (keyCode == ASPx.Key.Esc || stopProcessing.fireEvent)) 7137 this.onClosedOnEscape(); 7138 } 7139 return stopProcessing; 7140 }, 7141 HandleNoFocusAction: function (e, actionName) { 7142 var keyCode = ASPx.Evt.GetKeyCode(e); 7143 if (this.onClosedOnEscape && keyCode == ASPx.Key.Esc && actionName == "HandleKeyDown") 7144 this.onClosedOnEscape(); 7145 }, 7146 Activate: function () { 7147 KbdHelper.ClickAccessKey(this.control); 7148 this.areAccessKeysShown = true; 7149 }, 7150 Stop: function() { 7151 this.stopProcessing(); 7152 }, 7153 stopProcessing: function () { 7154 this.HideAccessKeys(); 7155 if (KbdHelper.active && this.isActive) { 7156 this.isActive = false; 7157 KbdHelper.active.control.GetMainElement().blur(); 7158 delete KbdHelper.active; 7159 } 7160 }, 7161 onBlur: function() { 7162 if (this.manualStopProcessing) { 7163 this.manualStopProcessing = false; 7164 return; 7165 } 7166 this.HideAccessKeys(); 7167 KbdHelper.prototype.onBlur.call(this); 7168 }, 7169 processKeyDown: function (keyCode) { 7170 switch (keyCode) { 7171 case ASPx.Key.Left: 7172 this.TryMoveFocusLeft(); 7173 return { value: false }; 7174 case ASPx.Key.Right: 7175 this.TryMoveFocusRight(); 7176 return { value: false }; 7177 case ASPx.Key.Esc: 7178 if(this.control.hideAllPopups) 7179 this.control.hideAllPopups(true, true); 7180 if(this.activeKey) 7181 this.activeKey = this.activeKey.Return(); 7182 this.charIndex = 0; 7183 if (!this.activeKey) 7184 return { value: true }; 7185 break; 7186 case ASPx.Key.Enter: 7187 return { value: true }; 7188 default: 7189 if (!ASPx.IsPrintableKey(keyCode)) 7190 return { value: false }; 7191 var char = String.fromCharCode(keyCode).toUpperCase(); 7192 var needToContinue = { value: false }; 7193 var keyResult; 7194 if(this.activeKey)
7195 keyResult = this.activeKey.TryAccessKey(char, this.charIndex, needToContinue); 7196 if (needToContinue.value) { 7197 this.charIndex++; 7198 return { value: false }; 7199 } 7200 this.charIndex = 0; 7201 if(keyResult !== undefined) 7202 this.activeKey = keyResult; 7203 else 7204 return { value: true, fireEvent: true }; 7205 if (!this.activeKey || !this.activeKey.accessKeys || this.activeKey.accessKeys.length == 0) { 7206 if (this.activeKey && this.activeKey.manualStopProcessing) { 7207 this.manualStopProcessing = true; 7208 break; 7209 } 7210 return { value: true, fireEvent: true }; 7211 } 7212 } 7213 return { value: false }; 7214 }, 7215 TryMoveFocusLeft: function (modifier) {}, 7216 TryMoveFocusRight: function (modifier) {}, 7217 TryMoveFocusUp: function (modifier) {}, 7218 TryMoveFocusDown: function (modifier) {}, 7219 FocusByAccessKey: function() { 7220 if (this.onFocusByAccessKey) 7221 this.onFocusByAccessKey(); 7222 this.HideAccessKeys(); 7223 KbdHelper.prototype.FocusByAccessKey.call(this); 7224 this.activeKey = this.accessKey; 7225 this.activeKey.execute(); 7226 this.isActive = true; 7227 this.areAccessKeysShown = true; 7228 }, 7229 HideAccessKeys: function() { 7230 this.areAccessKeysShown = false; 7231 this.hideAccessKeys(this.accessKey); 7232 }, 7233 Update: function() { 7234 this.throttleMethod(this.refresh, 100); 7235 }, 7236 refresh: function() { 7237 if(this.activeKey && this.areAccessKeysShown) { 7238 this.activeKey.execute(); 7239 } 7240 }, 7241 throttleMethod: function(method, delay) { 7242 clearTimeout(method.timerId); 7243 method.timerId = setTimeout(function() { 7244 method.call(this); 7245 }.aspxBind(this), delay); 7246 }, 7247 AreAccessKeysShown: function() { 7248 return this.areAccessKeysShown; 7249 }, 7250 hideAccessKeys: function (accessKey) { 7251 for (var i = 0, ak; ak = accessKey.accessKeys[i]; i++) { 7252 this.hideAccessKeys(ak); 7253 } 7254 if (accessKey) 7255 accessKey.hide(); 7256 }, 7257 HandleClick: function(e) { 7258 KbdHelper.prototype.HandleClick.call(this, e); 7259 this.stopProcessing(); 7260 } 7261}); 7262AccessKey = ASPx.CreateClass(null, { 7263 constructor: function (popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing) { 7264 this.key = key ? key : keyTipElement ? ASPxClientUtils.Trim(ASPx.GetInnerText(keyTipElement)) : null; 7265 this.popupItem = popupItem; 7266 this.getPopupElement = getPopupElement; 7267 this.keyTipElement = keyTipElement; 7268 this.accessKeys = []; 7269 this.needShowChilds = true; 7270 this.parent = null; 7271 this.onlyClick = onlyClick; 7272 this.manualStopProcessing = manualStopProcessing; 7273 }, 7274 Add: function (accessKey) { 7275 this.accessKeys.push(accessKey); 7276 accessKey.parent = this; 7277 }, 7278 TryAccessKey: function (char, index, needToContinue) { 7279 if (!this.accessKeys || this.accessKeys.length == 0) 7280 return; 7281 for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) { 7282 if (accessKey.key[index] == char && accessKey.isVisible()) { 7283 if (accessKey.key[index + 1]) { 7284 needToContinue.value = true; 7285 } 7286 else { 7287 accessKey.execute(); 7288 return accessKey; 7289 } 7290 } else { 7291 accessKey.hide(); 7292 } 7293 } 7294 for (var i = 0, accessKey; accessKey = this.accessKeys[i]; i++) { 7295 var key = accessKey.TryAccessKey(char, index, needToContinue); 7296 if (key) 7297 return key; 7298 } 7299 return; 7300 }, 7301 isVisible: function(){ 7302 return ASPx.GetElementVisibility(this.keyTipElement); 7303 }, 7304 Return: function () { 7305 this.hideChildAccessKeys(); 7306 if (this.parent) { 7307 this.parent.showAccessKeys(true); 7308 } 7309 return this.parent; 7310 }, 7311 execute: function () { 7312 this.hideAll(); 7313 if (this.popupItem && this.popupItem.accessKeyClick && !this.onlyClick) 7314 this.popupItem.accessKeyClick(); 7315 if (this.getPopupElement && this.onlyClick) 7316 ASPx.Evt.EmulateMouseClick(this.getPopupElement(this.popupItem)); 7317 if (this.accessKeys) 7318 setTimeout(function () { 7319 this.showAccessKeys(true); 7320 }.aspxBind(this), 100); 7321 }, 7322 showAccessKeys: function(directShow) { 7323 if (!directShow && !this.needShowChilds) 7324 return; 7325 for (var i = 0; i < this.accessKeys.length; i++) { 7326 var accessKey = this.accessKeys[i]; 7327 if (accessKey) { 7328 var popupElement = accessKey.getPopupElement ? accessKey.getPopupElement(accessKey.popupItem) : null; 7329 if (popupElement && this.isElementVisible(popupElement)) { 7330 this.show(accessKey); 7331 } 7332 accessKey.showAccessKeys(); 7333 } 7334 } 7335 }, 7336 isElementVisible: function (el) { return ASPx.IsElementVisible(el, true); }, 7337 show: function(accessKey) { 7338 var keyTipElement = accessKey.keyTipElement; 7339 var popupElement = accessKey.getPopupElement(accessKey.popupItem); 7340 this.showKeyTipElement(keyTipElement, this.calculateCoordinates(accessKey, keyTipElement, popupElement)); 7341 }, 7342 showKeyTipElement: function (keyTipElement, coordinates) { 7343 ASPx.SetAbsoluteY(keyTipElement, coordinates.top); 7344 ASPx.SetAbsoluteX(keyTipElement, coordinates.left); 7345 ASPx.SetElementVisibility(keyTipElement, true); 7346 }, 7347 calculateCoordinates: function (accessKey, keyTipElement, popupElement) { 7348 var top = ASPx.GetAbsolutePositionY(popupElement); 7349 var left = ASPx.GetAbsolutePositionX(popupElement); 7350 if (accessKey.popupItem.getAccessKeyPosition) 7351 switch (accessKey.popupItem.getAccessKeyPosition()) { 7352 case "AboveRight": 7353 left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3; 7354 top = top - keyTipElement.offsetHeight / 2; 7355 break; 7356 case "Right": 7357 left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3;
7358 top = top + popupElement.offsetHeight / 2 - keyTipElement.offsetHeight / 2; 7359 break; 7360 case "BelowRight": 7361 left = left + popupElement.offsetWidth - keyTipElement.offsetWidth / 3; 7362 top = top + keyTipElement.offsetHeight / 2; 7363 break; 7364 default: 7365 top = top + popupElement.offsetHeight; 7366 left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2; 7367 break; 7368 } 7369 else { 7370 top = top + popupElement.offsetHeight; 7371 left = left + popupElement.offsetWidth / 2 - keyTipElement.offsetWidth / 2; 7372 } 7373 return { top: top, left: left }; 7374 }, 7375 hide: function() { 7376 if (this.keyTipElement) 7377 ASPx.SetElementVisibility(this.keyTipElement, false); 7378 }, 7379 hideChildAccessKeys: function () { 7380 this.hideAccessKeys(this.accessKeys); 7381 }, 7382 hideAccessKeys: function (accessKeys) { 7383 if (accessKeys) { 7384 for (var i = 0, accessKey; accessKey = accessKeys[i]; i++) { 7385 if (accessKey.keyTipElement) 7386 accessKey.hide(); 7387 accessKey.hideChildAccessKeys(); 7388 } 7389 } 7390 }, 7391 hideAll: function () { 7392 this.getRoot(this).hideChildAccessKeys(); 7393 }, 7394 getRoot: function (accessKey) { 7395 if (!accessKey.parent) 7396 return accessKey; 7397 return this.getRoot(accessKey.parent); 7398 } 7399}); 7400var focusedElement = null; 7401function aspxOnElementFocused(evt) { 7402 evt = ASPx.Evt.GetEvent(evt); 7403 if(evt && evt.target) 7404 focusedElement = evt.target; 7405} 7406function _aspxInitializeFocus() { 7407 if(!ASPx.GetActiveElement()) 7408 ASPx.Evt.AttachEventToDocument("focus", aspxOnElementFocused); 7409} 7410function _aspxGetFocusedElement() { 7411 var activeElement = ASPx.GetActiveElement(); 7412 return activeElement ? activeElement : focusedElement; 7413} 7414CheckBoxCheckState = { 7415 Checked : "Checked", 7416 Unchecked : "Unchecked", 7417 Indeterminate : "Indeterminate" 7418}; 7419CheckBoxInputKey = { 7420 Checked : "C", 7421 Unchecked : "U", 7422 Indeterminate : "I" 7423}; 7424var CheckableElementStateController = ASPx.CreateClass(null, { 7425 constructor: function(imageProperties) { 7426 this.checkBoxStates = []; 7427 this.imageProperties = imageProperties; 7428 this.customImageMarkerClassName = "dxcbCI"; 7429 }, 7430 GetValueByInputKey: function(inputKey) { 7431 return this.GetFirstValueBySecondValue("Value", "StateInputKey", inputKey); 7432 }, 7433 GetInputKeyByValue: function(value) { 7434 return this.GetFirstValueBySecondValue("StateInputKey", "Value", value); 7435 }, 7436 GetImagePropertiesNumByInputKey: function(value) { 7437 return this.GetFirstValueBySecondValue("ImagePropertiesNumber", "StateInputKey", value); 7438 }, 7439 GetNextCheckBoxValue: function(currentValue, allowGrayed) { 7440 var currentInputKey = this.GetInputKeyByValue(currentValue); 7441 var nextInputKey = ''; 7442 switch(currentInputKey) { 7443 case CheckBoxInputKey.Checked: 7444 nextInputKey = CheckBoxInputKey.Unchecked; break; 7445 case CheckBoxInputKey.Unchecked: 7446 nextInputKey = allowGrayed ? CheckBoxInputKey.Indeterminate : CheckBoxInputKey.Checked; break; 7447 case CheckBoxInputKey.Indeterminate: 7448 nextInputKey = CheckBoxInputKey.Checked; break; 7449 } 7450 return this.GetValueByInputKey(nextInputKey); 7451 }, 7452 GetCheckStateByInputKey: function(inputKey) { 7453 switch(inputKey) { 7454 case CheckBoxInputKey.Checked: 7455 return CheckBoxCheckState.Checked; 7456 case CheckBoxInputKey.Unchecked: 7457 return CheckBoxCheckState.Unchecked; 7458 case CheckBoxInputKey.Indeterminate: 7459 return CheckBoxCheckState.Indeterminate; 7460 } 7461 }, 7462 GetValueByCheckState: function(checkState) { 7463 switch(checkState) { 7464 case CheckBoxCheckState.Checked: 7465 return this.GetValueByInputKey(CheckBoxInputKey.Checked); 7466 case CheckBoxCheckState.Unchecked: 7467 return this.GetValueByInputKey(CheckBoxInputKey.Unchecked); 7468 case CheckBoxCheckState.Indeterminate: 7469 return this.GetValueByInputKey(CheckBoxInputKey.Indeterminate); 7470 } 7471 }, 7472 GetFirstValueBySecondValue: function(firstValueName, secondValueName, secondValue) { 7473 return this.GetValueByFunc(firstValueName, 7474 function(checkBoxState) { return checkBoxState[secondValueName] === secondValue; }); 7475 }, 7476 GetValueByFunc: function(valueName, func) { 7477 for(var i = 0; i < this.checkBoxStates.length; i++) { 7478 if(func(this.checkBoxStates[i])) 7479 return this.checkBoxStates[i][valueName]; 7480 } 7481 }, 7482 AssignElementClassName: function(element, cssClassPropertyKey, disabledCssClassPropertyKey, assignedClassName) { 7483 var classNames = [ ]; 7484 for(var i = 0; i < this.imageProperties[cssClassPropertyKey].length; i++) { 7485 classNames.push(this.imageProperties[disabledCssClassPropertyKey][i]); 7486 classNames.push(this.imageProperties[cssClassPropertyKey][i]); 7487 } 7488 var elementClassName = element.className; 7489 for(var i = 0; i < classNames.length; i++) { 7490 var className = classNames[i]; 7491 var index = elementClassName.indexOf(className); 7492 if(index > -1) 7493 elementClassName = elementClassName.replace((index == 0 ? '' : ' ') + className, ""); 7494 } 7495 elementClassName += " " + assignedClassName; 7496 element.className = elementClassName; 7497 }, 7498 UpdateInternalCheckBoxDecoration: function(mainElement, inputKey, enabled) { 7499 var imagePropertiesNumber = this.GetImagePropertiesNumByInputKey(inputKey); 7500 for(var imagePropertyKey in this.imageProperties) { 7501 if(this.imageProperties.hasOwnProperty(imagePropertyKey)) { 7502 var propertyValue = this.imageProperties[imagePropertyKey][imagePropertiesNumber]; 7503 propertyValue = propertyValue || !isNaN(propertyValue) ? propertyValue : ""; 7504 switch(imagePropertyKey) {
7505 case "0" : mainElement.title = propertyValue; break; 7506 case "1" : mainElement.style.width = propertyValue + (propertyValue != "" ? "px" : ""); break; 7507 case "2" : mainElement.style.height = propertyValue + (propertyValue != "" ? "px" : ""); break; 7508 } 7509 if(enabled) { 7510 switch(imagePropertyKey) { 7511 case "3" : this.SetImageSrc(mainElement, propertyValue); break; 7512 case "4" : 7513 this.AssignElementClassName(mainElement, "4", "8", propertyValue); 7514 break; 7515 case "5" : this.SetBackgroundPosition(mainElement, propertyValue, true); break; 7516 case "6" : this.SetBackgroundPosition(mainElement, propertyValue, false); break; 7517 } 7518 } else { 7519 switch(imagePropertyKey) { 7520 case "7" : this.SetImageSrc(mainElement, propertyValue); break; 7521 case "8" : 7522 this.AssignElementClassName(mainElement, "4", "8", propertyValue); 7523 break; 7524 case "9" : this.SetBackgroundPosition(mainElement, propertyValue, true); break; 7525 case "10" : this.SetBackgroundPosition(mainElement, propertyValue, false); break; 7526 } 7527 } 7528 } 7529 } 7530 }, 7531 SetImageSrc: function(mainElement, src) { 7532 if(src === ""){ 7533 mainElement.style.backgroundImage = ""; 7534 mainElement.style.backgroundPosition = ""; 7535 ASPx.RemoveClassNameFromElement(mainElement, this.customImageMarkerClassName); 7536 } 7537 else{ 7538 mainElement.style.backgroundImage = "url('" + src + "')"; 7539 this.SetBackgroundPosition(mainElement, 0, true); 7540 this.SetBackgroundPosition(mainElement, 0, false); 7541 ASPx.AddClassNameToElement(mainElement, this.customImageMarkerClassName); 7542 } 7543 }, 7544 SetBackgroundPosition: function(element, value, isX) { 7545 if(value === "") { 7546 element.style.backgroundPosition = value; 7547 return; 7548 } 7549 if(element.style.backgroundPosition === "") 7550 element.style.backgroundPosition = isX ? "-" + value.toString() + "px 0px" : "0px -" + value.toString() + "px"; 7551 else { 7552 var position = element.style.backgroundPosition.split(' '); 7553 element.style.backgroundPosition = isX ? '-' + value.toString() + "px " + position[1] : position[0] + " -" + value.toString() + "px"; 7554 } 7555 }, 7556 AddState: function(value, stateInputKey, imagePropertiesNumber) { 7557 this.checkBoxStates.push({ 7558 "Value" : value, 7559 "StateInputKey" : stateInputKey, 7560 "ImagePropertiesNumber" : imagePropertiesNumber 7561 }); 7562 }, 7563 GetAriaCheckedValue: function(state) { 7564 switch(state) { 7565 case ASPx.CheckBoxCheckState.Checked: return "true"; 7566 case ASPx.CheckBoxCheckState.Unchecked: return "false"; 7567 case ASPx.CheckBoxCheckState.Indeterminate: return "mixed"; 7568 default: return ""; 7569 } 7570 }, 7571 GetAriaSelectedValue: function(state) { 7572 switch(state) { 7573 case ASPx.CheckBoxCheckState.Checked: return "true"; 7574 case ASPx.CheckBoxCheckState.Unchecked: return "false"; 7575 case ASPx.CheckBoxCheckState.Indeterminate: return "undefined"; 7576 default: return ""; 7577 } 7578 }, 7579 SetAriaCheckedSelectedAttributes: function(mainElement, state) { 7580 if(mainElement.attributes["aria-checked"] !== undefined) { 7581 var ariaCheckedValue = this.GetAriaCheckedValue(state); 7582 mainElement.setAttribute("aria-checked", ariaCheckedValue); 7583 } 7584 if(mainElement.attributes["aria-selected"] !== undefined) { 7585 var ariaSelectedValue = this.GetAriaSelectedValue(state); 7586 mainElement.setAttribute("aria-selected", ariaSelectedValue); 7587 } 7588 } 7589}); 7590CheckableElementStateController.Create = function(imageProperties, valueChecked, valueUnchecked, valueGrayed, allowGrayed) { 7591 var stateController = new CheckableElementStateController(imageProperties); 7592 stateController.AddState(valueChecked, CheckBoxInputKey.Checked, 0); 7593 stateController.AddState(valueUnchecked, CheckBoxInputKey.Unchecked, 1); 7594 if(typeof(valueGrayed) != "undefined") 7595 stateController.AddState(valueGrayed, CheckBoxInputKey.Indeterminate, allowGrayed ? 2 : 1); 7596 stateController.allowGrayed = allowGrayed; 7597 return stateController; 7598}; 7599var CheckableElementHelper = ASPx.CreateClass(null, { 7600 InternalCheckBoxInitialize: function(internalCheckBox) { 7601 this.AttachToMainElement(internalCheckBox); 7602 this.AttachToInputElement(internalCheckBox); 7603 }, 7604 AttachToMainElement: function(internalCheckBox) { 7605 var instance = this; 7606 if(internalCheckBox.mainElement) { 7607 var toggleEvent = internalCheckBox.displaySwitch ? ASPx.TouchUIHelper.touchMouseDownEventName : "click"; 7608 ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, toggleEvent, 7609 function (evt) { 7610 if(ASPx.Evt.IsRightButtonPressed(evt)) 7611 return; 7612 instance.InvokeClick(internalCheckBox, evt); 7613 if(!internalCheckBox.disableCancelBubble) 7614 return ASPx.Evt.PreventEventAndBubble(evt); 7615 } 7616 ); 7617 ASPx.Evt.AttachEventToElement(internalCheckBox.mainElement, "mousedown", 7618 function (evt) { 7619 internalCheckBox.Refocus(); 7620 } 7621 ); 7622 ASPx.Evt.PreventElementDragAndSelect(internalCheckBox.mainElement, true); 7623 } 7624 }, 7625 AttachToInputElement: function(internalCheckBox) { 7626 var instance = this; 7627 if(internalCheckBox.inputElement && internalCheckBox.mainElement) { 7628 var checkableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement; 7629 ASPx.Evt.AttachEventToElement(checkableElement, "focus", 7630 function (evt) { 7631 if(!internalCheckBox.enabled) 7632 checkableElement.blur(); 7633 else 7634 internalCheckBox.OnFocus(); 7635 } 7636 ); 7637 ASPx.Evt.AttachEventToElement(checkableElement, "blur", 7638 function (evt) { 7639 internalCheckBox.OnLostFocus(); 7640 } 7641 ); 7642 ASPx.Evt.AttachEventToElement(checkableElement, "keyup", 7643 function (evt) { 7644 if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space) 7645 instance.InvokeClick(internalCheckBox, evt); 7646 } 7647 ); 7648 ASPx.Evt.AttachEventToElement(checkableElement, "keydown", 7649 function (evt) { 7650 if(ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Space) 7651 return ASPx.Evt.PreventEvent(evt); 7652 } 7653 ); 7654 } 7655 }, 7656 IsKBSInputWrapperExist: function() { 7657 return ASPx.Browser.Opera || ASPx.Browser.WebKitFamily; 7658 }, 7659 GetICBMainElementByInput: function(icbInputElement) { 7660 return this.IsKBSInputWrapperExist() ? icbInputElement.parentNode.parentNode : icbInputElement.parentNode; 7661 }, 7662 RequirePreventFocus: function() { return false; }, 7663 InvokeClick: function(internalCheckBox, evt) { 7664 if(internalCheckBox.enabled && !internalCheckBox.GetReadOnly()) { 7665 var inputElementValue = internalCheckBox.inputElement.value; 7666 var focusableElement = internalCheckBox.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement; 7667 if(!this.RequirePreventFocus()) 7668 focusableElement.focus(); 7669 internalCheckBox.inputElement.value = inputElementValue; 7670 this.InvokeClickCore(internalCheckBox, evt); 7671 } 7672 }, 7673 InvokeClickCore: function(internalCheckBox, evt) { 7674 internalCheckBox.OnClick(evt); 7675 } 7676}); 7677CheckableElementHelper.Instance = new CheckableElementHelper(); 7678var CheckBoxInternal = ASPx.CreateClass(null, { 7679 constructor: function(inputElement, stateController, allowGrayed, allowGrayedByClick, helper, container, storeValueInInput, key, disableCancelBubble, 7680 accessibilityCompliant, displaySwitch) { 7681 this.inputElement = inputElement; 7682 this.mainElement = helper.GetICBMainElementByInput(this.inputElement); 7683 this.name = (key ? key : this.inputElement.id) + CheckBoxInternal.GetICBMainElementPostfix(); 7684 this.mainElement.id = this.name; 7685 this.stateController = stateController; 7686 this.container = container; 7687 this.allowGrayed = allowGrayed; 7688 this.allowGrayedByClick = allowGrayedByClick; 7689 this.autoSwitchEnabled = true; 7690 this.displaySwitch = displaySwitch; 7691 this.storeValueInInput = !!storeValueInInput; 7692 this.storedInputKey = !this.storeValueInInput ? this.inputElement.value : null; 7693 this.disableCancelBubble = !!disableCancelBubble; 7694 this.accessibilityCompliant = accessibilityCompliant; 7695 this.focusDecoration = null; 7696 this.focused = false; 7697 this.focusLocked = false; 7698 this.enabled = !this.mainElement.className.match(/dxWeb_\w+Disabled(\b|_)/); 7699 this.readOnly = false; 7700 this.preventFocus = helper.RequirePreventFocus(); 7701 this.CheckedChanged = new ASPxClientEvent(); 7702 this.Focus = new ASPxClientEvent(); 7703 this.LostFocus = new ASPxClientEvent(); 7704 helper.InternalCheckBoxInitialize(this); 7705 }, 7706 GetReadOnly: function() { 7707 return this.readOnly; 7708 }, 7709 ChangeInputElementTabIndex: function() { 7710 var changeMethod = this.enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset; 7711 changeMethod(this.inputElement); 7712 }, 7713 CreateFocusDecoration: function(focusedStyle) { 7714 this.focusDecoration = new FocusedStyleDecoration(this); 7715 this.focusDecoration.AddStyle('F', focusedStyle[0], focusedStyle[1]); 7716 this.focusDecoration.AddPostfix(""); 7717 }, 7718 UpdateFocusDecoration: function() { 7719 this.focusDecoration.Update(); 7720 }, 7721 StoreInputKey: function(inputKey) { 7722 if(this.storeValueInInput) 7723 this.inputElement.value = inputKey; 7724 else 7725 this.storedInputKey = inputKey; 7726 }, 7727 GetStoredInputKey: function() { 7728 if(this.storeValueInInput) 7729 return this.inputElement.value; 7730 else 7731 return this.storedInputKey; 7732 }, 7733 OnClick: function(e) { 7734 if(this.autoSwitchEnabled) { 7735 var currentValue = this.GetValue(); 7736 var value = this.stateController.GetNextCheckBoxValue(currentValue, this.allowGrayedByClick && this.allowGrayed); 7737 this.SetValue(value); 7738 } 7739 this.CheckedChanged.FireEvent(this, e); 7740 }, 7741 OnFocus: function() { 7742 if(!this.IsFocusLocked()) { 7743 this.focused = true; 7744 this.UpdateFocusDecoration(); 7745 this.Focus.FireEvent(this, null); 7746 } else 7747 this.UnlockFocus(); 7748 }, 7749 OnLostFocus: function() { 7750 if(!this.IsFocusLocked()) { 7751 this.focused = false; 7752 this.UpdateFocusDecoration(); 7753 this.LostFocus.FireEvent(this, null); 7754 } 7755 }, 7756 Refocus: function() { 7757 if(this.preventFocus) return; 7758 if(this.focused) {
7759 this.LockFocus(); 7760 this.inputElement.blur(); 7761 if(ASPx.Browser.MacOSMobilePlatform) { 7762 window.setTimeout(function() { 7763 ASPx.SetFocus(this.inputElement); 7764 }, ASPx.FOCUS_TIMEOUT); 7765 } else { 7766 ASPx.SetFocus(this.inputElement); 7767 } 7768 } 7769 }, 7770 LockFocus: function() { 7771 this.focusLocked = true; 7772 }, 7773 UnlockFocus: function() { 7774 this.focusLocked = false; 7775 }, 7776 IsFocusLocked: function() { 7777 if(!!ASPx.Attr.GetAttribute(this.mainElement, ASPx.Attr.GetTabIndexAttributeName())) 7778 return false; 7779 return this.focusLocked; 7780 }, 7781 SetValue: function(value, force) { 7782 var currentValue = this.GetValue(); 7783 if(currentValue !== value || force) { 7784 var newInputKey = this.stateController.GetInputKeyByValue(value); 7785 if(newInputKey) { 7786 this.StoreInputKey(newInputKey); 7787 this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, newInputKey, this.enabled); 7788 } 7789 } 7790 if(this.accessibilityCompliant) { 7791 var state = this.GetCurrentCheckState(); 7792 this.stateController.SetAriaCheckedSelectedAttributes(this.mainElement, state); 7793 } 7794 }, 7795 GetValue: function() { 7796 return this.stateController.GetValueByInputKey(this.GetCurrentInputKey()); 7797 }, 7798 GetCurrentCheckState: function() { 7799 return this.stateController.GetCheckStateByInputKey(this.GetCurrentInputKey()); 7800 }, 7801 GetCurrentInputKey: function() { 7802 return this.GetStoredInputKey(); 7803 }, 7804 GetChecked: function() { 7805 return this.GetCurrentInputKey() === CheckBoxInputKey.Checked; 7806 }, 7807 SetChecked: function(checked) { 7808 var newValue = this.stateController.GetValueByCheckState(checked ? CheckBoxCheckState.Checked : CheckBoxCheckState.Unchecked); 7809 this.SetValue(newValue); 7810 }, 7811 SetEnabled: function(enabled) { 7812 if(this.enabled != enabled) { 7813 this.enabled = enabled; 7814 this.stateController.UpdateInternalCheckBoxDecoration(this.mainElement, this.GetCurrentInputKey(), this.enabled); 7815 this.ChangeInputElementTabIndex(); 7816 } 7817 }, 7818 GetEnabled: function() { 7819 return this.enabled; 7820 } 7821}); 7822CheckBoxInternal.GetICBMainElementPostfix = function() { 7823 return "_D"; 7824}; 7825var CheckBoxInternalCollection = ASPx.CreateClass(CollectionBase, { 7826 constructor: function(imageProperties, allowGrayed, storeValueInInput, helper, disableCancelBubble, accessibilityCompliant) { 7827 this.constructor.prototype.constructor.call(this); 7828 this.stateController = allowGrayed 7829 ? CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked, CheckBoxInputKey.Indeterminate, true) 7830 : CheckableElementStateController.Create(imageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked); 7831 this.helper = helper || CheckableElementHelper.Instance; 7832 this.storeValueInInput = !!storeValueInInput; 7833 this.disableCancelBubble = !!disableCancelBubble; 7834 this.accessibilityCompliant = accessibilityCompliant; 7835 }, 7836 Add: function(key, inputElement, container) { 7837 this.Remove(key); 7838 var checkBox = this.CreateInternalCheckBox(key, inputElement, container); 7839 CollectionBase.prototype.Add.call(this, key, checkBox); 7840 return checkBox; 7841 }, 7842 SetImageProperties: function(imageProperties) { 7843 this.stateController.imageProperties = imageProperties; 7844 }, 7845 CreateInternalCheckBox: function(key, inputElement, container) { 7846 return new CheckBoxInternal(inputElement, this.stateController, this.stateController.allowGrayed, false, this.helper, container, 7847 this.storeValueInInput, key, this.disableCancelBubble, this.accessibilityCompliant); 7848 } 7849}); 7850var FocusedStyleDecoration = ASPx.CreateClass(null, { 7851 constructor: function(editor) { 7852 this.editor = editor; 7853 this.postfixList = []; 7854 this.styles = {}; 7855 this.innerStyles = {}; 7856 }, 7857 AddPostfix: function(value) { 7858 this.postfixList.push(value); 7859 }, 7860 AddStyle: function(key, className, cssText) { 7861 this.styles[key] = this.CreateRule(className, cssText); 7862 this.innerStyles[key] = this.CreateRule("", this.FilterInnerCss(cssText)); 7863 }, 7864 CreateRule: function(className, cssText) { 7865 return ASPx.Str.Trim(className + " " + ASPx.CreateImportantStyleRule(this.GetStyleSheet(), cssText)); 7866 }, 7867 GetStyleSheet: function() { 7868 return ASPx.GetCurrentStyleSheet(); 7869 }, 7870 FilterInnerCss: function(css) { 7871 return css.replace(/(border|background-image)[^:]*:[^;]+/gi, ""); 7872 }, 7873 Update: function() { 7874 for(var i = 0; i < this.postfixList.length; i++) { 7875 var postfix = this.postfixList[i]; 7876 var inner = postfix.length > 0;
7877 var element = this.GetElementByPostfix(postfix); 7878 if(element) 7879 this.ApplyStyles(element, inner); 7880 } 7881 }, 7882 GetElementByPostfix: function(postfix) { 7883 return ASPx.GetElementById(this.editor.name + postfix); 7884 }, 7885 ApplyStyles: function(element, inner) { 7886 this.ApplyFocusedStyle(element, inner); 7887 }, 7888 ApplyFocusedStyle: function(element, inner) { 7889 if(this.HasDecoration("F")) 7890 this.ApplyDecoration("F", element, inner, this.editor.focused); 7891 }, 7892 HasDecoration: function(key) { 7893 return !!this.styles[key]; 7894 }, 7895 ApplyDecoration: function(key, element, inner, active) { 7896 var value = inner ? this.innerStyles[key] : this.styles[key]; 7897 this.RemoveDecoration(element, value); 7898 if(active) 7899 ASPx.AddClassNameToElement(element, value); 7900 }, 7901 RemoveDecoration: function(element, value) { 7902 ASPx.RemoveClassNameFromElement(element, value); 7903 }, 7904 ApplyDecorationCore: function() { 7905 }, 7906 EnsureElementBorder: function(element) { 7907 var border = parseInt(element.border) || 0; 7908 element.border = 1; 7909 element.border = border; 7910 } 7911}); 7912var EditorStyleDecoration = ASPx.CreateClass(FocusedStyleDecoration, { 7913 constructor: function(editor) { 7914 this.constructor.prototype.constructor.call(this, editor); 7915 this.lockUpdate = false; 7916 }, 7917 LockUpdate: function() { 7918 this.lockUpdate = true; 7919 }, 7920 UnlockUpdate: function() { 7921 this.lockUpdate = false; 7922 }, 7923 IsUpdateLocked: function() { 7924 return this.lockUpdate; 7925 }, 7926 Update: function () { 7927 if(this.IsUpdateLocked()) 7928 return; 7929 ASPx.FocusedStyleDecoration.prototype.Update.call(this); 7930 }, 7931 ApplyStyles: function (element, inner) { 7932 this.ApplyInvalidStyle(element, inner); 7933 ASPx.FocusedStyleDecoration.prototype.ApplyStyles.call(this, element, inner); 7934 }, 7935 ApplyInvalidStyle: function (element, inner) { 7936 if(this.HasDecoration("I")) { 7937 var isValid = this.editor.GetIsValid(); 7938 this.ApplyDecoration("I", element, inner, !isValid); 7939 } 7940 } 7941}); 7942var TextEditorStyleDecoration = ASPx.CreateClass(EditorStyleDecoration, { 7943 constructor: function(editor) { 7944 this.constructor.prototype.constructor.call(this, editor); 7945 this.nullTextClassName = ""; 7946 }, 7947 ApplyStyles: function(element, inner) { 7948 ASPx.EditorStyleDecoration.prototype.ApplyStyles.call(this, element, inner); 7949 this.ApplyNullTextStyle(element, inner); 7950 }, 7951 ApplyNullTextStyle: function(element, inner) { 7952 if(!this.HasDecoration("N")) 7953 return; 7954 var apply = !this.editor.focused && this.editor.CanApplyNullTextDecoration(); 7955 this.EnsureSpellcheckAttribute(element, apply); 7956 this.ApplyDecoration("N", element, inner, apply); 7957 }, 7958 EnsureSpellcheckAttribute: function(element, apply) { 7959 if(apply) 7960 ASPx.Attr.ChangeAttribute(element, "spellcheck", "false"); 7961 else 7962 ASPx.Attr.RestoreAttribute(element, "spellcheck"); 7963 }, 7964 ApplyNullTextClassName: function(active) { 7965 var nullTextClassName = this.GetNullTextClassName(); 7966 var editorMainElement = this.editor.GetMainElement(); 7967 if(active) 7968 ASPx.AddClassNameToElement(editorMainElement, nullTextClassName); 7969 else 7970 ASPx.RemoveClassNameFromElement(editorMainElement, nullTextClassName); 7971 }, 7972 GetNullTextClassName: function() { 7973 if (!this.nullTextClassName) 7974 this.InitializeNullTextClassName(); 7975 return this.nullTextClassName; 7976 }, 7977 InitializeNullTextClassName: function() { 7978 var nullTextStyle = this.styles["N"]; 7979 if (nullTextStyle) { 7980 var nullTextStyleClassNames = nullTextStyle.split(" "); 7981 for (var i = 0; i < nullTextStyleClassNames.length; i++) 7982 if (nullTextStyleClassNames[i].match("dxeNullText")) 7983 this.nullTextClassName = nullTextStyleClassNames[i]; 7984 } 7985 } 7986}); 7987var touchUIHelperUsePointerEvents = (ASPx.Browser.Edge || ASPx.Browser.EdgeWebKit) && ASPx.Browser.MSTouchUI && !!window.PointerEvent; 7988var TouchUIHelper = { 7989 isGesture: false, 7990 isMouseEventFromScrolling: false, 7991 isNativeScrollingAllowed: true, 7992 clickSensetivity: 10, 7993 documentTouchHandlers: {}, 7994 documentEventAttachingAllowed: true, 7995 msTouchDraggableClassName: "dxMSTouchDraggable", 7996 touchMouseDownEventName: ASPx.Browser.WebKitTouchUI ? "touchstart" : (touchUIHelperUsePointerEvents ? "pointerdown" : "mousedown"), 7997 touchMouseUpEventName: ASPx.Browser.WebKitTouchUI ? "touchend" : (touchUIHelperUsePointerEvents ? "pointerup" : "mouseup"), 7998 touchMouseMoveEventName: ASPx.Browser.WebKitTouchUI ? "touchmove" : (touchUIHelperUsePointerEvents ? "pointermove" : "mousemove"), 7999 startPreventingTouchMove: function() { 8000 if(touchUIHelperUsePointerEvents) 8001 ASPx.Evt.AttachEventToDocument("touchmove", ASPx.Evt.PreventEvent); 8002 }, 8003 stopPreventingTouchMove: function() { 8004 if(touchUIHelperUsePointerEvents) 8005 ASPx.Evt.DetachEventFromDocument("touchmove", ASPx.Evt.PreventEvent); 8006 }, 8007 isTouchEvent: function(evt) { 8008 if(!evt) return false; 8009 return ASPx.Browser.WebKitTouchUI && ASPx.IsExists(evt.changedTouches); 8010 }, 8011 isTouchEventName: function(eventName) { 8012 return ASPx.Browser.WebKitTouchUI && (eventName.indexOf("touch") > -1 || eventName.indexOf("gesture") > -1); 8013 }, 8014 getEventX: function(evt) { 8015 var touchPoint = null; 8016 if(evt.changedTouches.length > 0) 8017 touchPoint = evt.changedTouches; 8018 else if(evt.targetTouches.length > 0) 8019 touchPoint = evt.targetTouches; 8020 return touchPoint ? touchPoint[0].pageX : 0; 8021 }, 8022 getEventY: function(evt) { 8023 var touchPoint = null; 8024 if(evt.changedTouches.length > 0) 8025 touchPoint = evt.changedTouches; 8026 else if(evt.targetTouches.length > 0) 8027 touchPoint = evt.targetTouches; 8028 return touchPoint ? touchPoint[0].pageY : 0; 8029 }, 8030 getWebkitMajorVersion: function(){ 8031 if(!this.webkitMajorVersion){ 8032 var regExp = new RegExp("applewebkit/(\\d+)", "i"); 8033 var matches = regExp.exec(ASPx.Browser.UserAgent); 8034 if(matches && matches.index >= 1) 8035 this.webkitMajorVersion = matches[1]; 8036 } 8037 return this.webkitMajorVersion; 8038 }, 8039 getIsLandscapeOrientation: function(){ 8040 if(ASPx.Browser.MacOSMobilePlatform || ASPx.Browser.AndroidMobilePlatform) 8041 return Math.abs(window.orientation) == 90; 8042 return ASPx.GetDocumentClientWidth() > ASPx.GetDocumentClientHeight(); 8043 }, 8044 nativeScrollingSupported: function() { 8045 var allowedSafariVersion = ASPx.Browser.Version >= 5.1 && ASPx.Browser.Version < 8; 8046 var webkitMajorVersion = this.getWebkitMajorVersion(); 8047 var allowedWebKitVersion = webkitMajorVersion > 533 && webkitMajorVersion < 600; 8048 return (ASPx.Browser.MacOSMobilePlatform && (allowedSafariVersion || allowedWebKitVersion)) 8049 || (ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 3) || (ASPx.Browser.MSTouchUI); 8050 }, 8051 makeScrollableIfRequired: function(element, options) { 8052 if(ASPx.Browser.WebKitTouchUI && element) { 8053 var overflow = ASPx.GetCurrentStyle(element).overflow; 8054 if(element.tagName == "DIV" && overflow != "hidden" && overflow != "visible" ){ 8055 return this.MakeScrollable(element); 8056 } 8057 } 8058 }, 8059 preventScrollOnEvent: function(evt){ 8060 }, 8061 handleFastTapIfRequired: function(evt, action, preventCommonClickEvents) { 8062 if(ASPx.Browser.WebKitTouchUI && evt.type == 'touchstart' && action) { 8063 this.FastTapHelper.HandleFastTap(evt, action, preventCommonClickEvents); 8064 return true; 8065 } 8066 return false; 8067 }, 8068 ensureDocumentSizesCorrect: function (){ 8069 return (document.documentElement.clientWidth - document.documentElement.clientHeight) / (screen.width - screen.height) > 0;
8070 }, 8071 ensureOrientationChanged: function(onOrientationChangedFunction){ 8072 if(ASPxClientUtils.iOSPlatform || this.ensureDocumentSizesCorrect()) 8073 onOrientationChangedFunction(); 8074 else { 8075 window.setTimeout(function(){ 8076 this.ensureOrientationChanged(onOrientationChangedFunction); 8077 }.aspxBind(this), 100); 8078 } 8079 }, 8080 onEventAttachingToDocument: function(eventName, func){ 8081 if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) { 8082 if(!this.documentTouchHandlers[eventName]) 8083 this.documentTouchHandlers[eventName] = []; 8084 this.documentTouchHandlers[eventName].push(func); 8085 return this.documentEventAttachingAllowed; 8086 } 8087 return true; 8088 }, 8089 onEventDettachedFromDocument: function(eventName, func){ 8090 if(ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) { 8091 var handlers = this.documentTouchHandlers[eventName]; 8092 if(handlers) 8093 ASPx.Data.ArrayRemove(handlers, func); 8094 } 8095 }, 8096 processDocumentTouchEventHandlers: function(proc) { 8097 var touchEventNames = ["touchstart", "touchend", "touchmove", "gesturestart", "gestureend"]; 8098 for(var i = 0; i < touchEventNames.length; i++) { 8099 var eventName = touchEventNames[i]; 8100 var handlers = this.documentTouchHandlers[eventName]; 8101 if(handlers) { 8102 for(var j = 0; j < handlers.length; j++) { 8103 proc(eventName,handlers[j]); 8104 } 8105 } 8106 } 8107 }, 8108 removeDocumentTouchEventHandlers: function() { 8109 if(ASPx.Browser.MacOSMobilePlatform) { 8110 this.documentEventAttachingAllowed = false; 8111 this.processDocumentTouchEventHandlers(ASPx.Evt.DetachEventFromDocumentCore); 8112 } 8113 }, 8114 restoreDocumentTouchEventHandlers: function () { 8115 if(ASPx.Browser.MacOSMobilePlatform) { 8116 this.documentEventAttachingAllowed = true; 8117 this.processDocumentTouchEventHandlers(ASPx.Evt.AttachEventToDocumentCore); 8118 } 8119 }, 8120 IsNativeScrolling: function() { 8121 return TouchUIHelper.nativeScrollingSupported() && TouchUIHelper.isNativeScrollingAllowed; 8122 }, 8123 pointerEnabled: !!(window.PointerEvent || window.MSPointerEvent), 8124 pointerDownEventName: window.PointerEvent ? "pointerdown" : "MSPointerDown", 8125 pointerUpEventName: window.PointerEvent ? "pointerup" : "MSPointerUp", 8126 pointerCancelEventName: window.PointerEvent ? "pointercancel" : "MSPointerCancel", 8127 pointerMoveEventName: window.PointerEvent ? "pointermove" : "MSPointerMove", 8128 pointerOverEventName: window.PointerEvent ? "pointerover" : "MSPointerOver", 8129 pointerOutEventName: window.PointerEvent ? "pointerout" : "MSPointerOut", 8130 pointerType: { 8131 Touch: "touch", 8132 Pen: "pen", 8133 Mouse: "mouse" 8134 }, 8135 msGestureEnabled: !!(window.PointerEvent || window.MSPointerEvent) && typeof(MSGesture) != "undefined", 8136 msTouchCreateGesturesWrapper: function(element, onTap){ 8137 if(!TouchUIHelper.msGestureEnabled) 8138 return; 8139 var gesture = new MSGesture(); 8140 gesture.target = element; 8141 ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerDownEventName, function(evt){ 8142 gesture.addPointer(evt.pointerId); 8143 }); 8144 ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerUpEventName, function(evt){ 8145 gesture.stop(); 8146 }); 8147 if(onTap) 8148 ASPx.Evt.AttachEventToElement(element, "MSGestureTap", onTap); 8149 return gesture; 8150 }, 8151 useLongTapHelper: function () { 8152 return ASPx.Browser.Safari && ASPx.Browser.TouchUI; 8153 }, 8154 attachLongTapHandler: function(element, handler, onlyBubbling) { 8155 var timerID = -1; 8156 var timeout = 1000; 8157 var event = null; 8158 var preventClickEvent = false; 8159 var startX = -1; 8160 var startY = -1; 8161 var pixelLimit = 5; 8162 function onTouchMouseDown(evt) { 8163 abortWating(); 8164 event = evt; 8165 startX = evt.pageX; 8166 startY = evt.pageY; 8167 preventClickEvent = false; 8168 timerID = window.setTimeout(onTimeout, timeout); 8169 } 8170 function onTouchMouseMove(evt) { 8171 if (!isUnderTouch()) 8172 return; 8173 var shiftX = Math.abs(startX - evt.pageX), 8174 shiftY = Math.abs(startY - evt.pageY), 8175 maxShift = Math.max(shiftX, shiftY); 8176 if (maxShift > pixelLimit) 8177 abortWating(); 8178 } 8179 function onTouchMouseUp(evt) { 8180 abortWating(); 8181 if (preventClickEvent) { 8182 ASPx.Evt.PreventEventAndBubble(evt); 8183 preventClickEvent = false; 8184 } 8185 } 8186 function onTimeout() { 8187 handler(event); 8188 preventClickEvent = true; 8189 abortWatingInternal(); 8190 } 8191 function isUnderTouch() { 8192 return timerID !== -1; 8193 } 8194 function abortWating() { 8195 if (isUnderTouch()) { 8196 window.clearTimeout(timerID); 8197 abortWatingInternal(); 8198 } 8199 } 8200 function abortWatingInternal() { 8201 timerID = -1; 8202 event = null; 8203 } 8204 ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseDownEventName, onTouchMouseDown, onlyBubbling); 8205 ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseMoveEventName, onTouchMouseMove, onlyBubbling); 8206 ASPx.Evt.AttachEventToElement(element, TouchUIHelper.touchMouseUpEventName, onTouchMouseUp, onlyBubbling); 8207 element.style["-webkit-user-select"] = "none"; 8208 return function () { 8209 ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseDownEventName, onTouchMouseDown);
8210 ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseMoveEventName, onTouchMouseMove); 8211 ASPx.Evt.DetachEventFromElement(element, TouchUIHelper.touchMouseUpEventName, onTouchMouseUp); 8212 element.style["-webkit-user-select"] = ""; 8213 }; 8214 } 8215}; 8216var CacheHelper = {}; 8217CacheHelper.GetCachedValueCore = function(obj, key, func, cacheObj, fillValueMethod) { 8218 if(!cacheObj) 8219 cacheObj = obj; 8220 if(!cacheObj.cache) 8221 cacheObj.cache = {}; 8222 if(!key) 8223 key = "default"; 8224 fillValueMethod(obj, key, func, cacheObj); 8225 return cacheObj.cache[key]; 8226}; 8227CacheHelper.GetCachedValue = function(obj, key, func, cacheObj) { 8228 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 8229 function(obj, key, func, cacheObj) { 8230 if(!ASPx.IsExists(cacheObj.cache[key])) 8231 cacheObj.cache[key] = func.apply(obj, []); 8232 }); 8233}; 8234CacheHelper.GetCachedElement = function(obj, key, func, cacheObj) { 8235 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 8236 function(obj, key, func, cacheObj) { 8237 if(!ASPx.IsValidElement(cacheObj.cache[key])) 8238 cacheObj.cache[key] = func.apply(obj, []); 8239 }); 8240}; 8241CacheHelper.GetCachedElements = function(obj, key, func, cacheObj) { 8242 return CacheHelper.GetCachedValueCore(obj, key, func, cacheObj, 8243 function(obj, key, func, cacheObj) { 8244 if(!ASPx.IsValidElements(cacheObj.cache[key])){ 8245 var elements = func.apply(obj, []); 8246 if(!Ident.IsArray(elements)) 8247 elements = [elements]; 8248 cacheObj.cache[key] = elements; 8249 } 8250 }); 8251}; 8252CacheHelper.GetCachedElementById = function(obj, id, cacheObj) { 8253 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetElementById(id); }, cacheObj); 8254}; 8255CacheHelper.GetCachedChildById = function(obj, parent, id, cacheObj) { 8256 return CacheHelper.GetCachedElement(obj, id, function() { return ASPx.GetChildById(parent, id); }, cacheObj); 8257}; 8258CacheHelper.DropCachedValue = function(cacheObj, key) { 8259 cacheObj.cache[key] = null; 8260}; 8261CacheHelper.DropCache = function(cacheObj) { 8262 cacheObj.cache = null; 8263}; 8264var DomObserver = ASPx.CreateClass(null, { 8265 constructor: function() { 8266 this.items = { }; 8267 }, 8268 subscribe: function(elementID, callbackFunc) { 8269 var item = this.items[elementID]; 8270 if(item) 8271 this.unsubscribe(elementID); 8272 item = { 8273 elementID: elementID, 8274 callbackFunc: callbackFunc, 8275 pauseCount: 0 8276 }; 8277 this.prepareItem(item); 8278 this.items[elementID] = item; 8279 }, 8280 prepareItem: function(item) { 8281 }, 8282 unsubscribe: function(elementID) { 8283 this.items[elementID] = null; 8284 }, 8285 getItemElement: function(item) { 8286 var element = this.getElementById(item.elementID); 8287 if(element) 8288 return element; 8289 this.unsubscribe(item.elementID); 8290 return null; 8291 }, 8292 getElementById: function(elementID) { 8293 var element = document.getElementById(elementID); 8294 return element && ASPx.IsValidElement(element) ? element : null; 8295 }, 8296 pause: function(element, includeSubtree) { 8297 this.changeItemsState(element, includeSubtree, true); 8298 }, 8299 resume: function(element, includeSubtree) { 8300 this.changeItemsState(element, includeSubtree, false); 8301 }, 8302 forEachItem: function(processFunc, context) { 8303 context = context || this; 8304 for(var itemName in this.items) { 8305 if(!this.items.hasOwnProperty(itemName)) 8306 continue; 8307 var item = this.items[itemName]; 8308 if(item) { 8309 var needBreak = processFunc.call(context, item); 8310 if(needBreak) 8311 return; 8312 } 8313 } 8314 }, 8315 changeItemsState: function(element, includeSubtree, pause) { 8316 this.forEachItem(function(item) { 8317 if(!element) 8318 this.changeItemState(item, pause); 8319 else { 8320 var itemElement = this.getItemElement(item); 8321 if(itemElement && (element == itemElement || (includeSubtree && ASPx.GetIsParent(element, itemElement)))) { 8322 this.changeItemState(item, pause); 8323 if(!includeSubtree) 8324 return true; 8325 } 8326 } 8327 }.aspxBind(this)); 8328 }, 8329 changeItemState: function(item, pause) { 8330 if(pause) 8331 this.pauseItem(item); 8332 else 8333 this.resumeItem(item); 8334 }, 8335 pauseItem: function(item) { 8336 item.paused = true; 8337 item.pauseCount++; 8338 }, 8339 resumeItem: function(item) { 8340 if(item.pauseCount > 0) { 8341 if(item.pauseCount == 1) 8342 item.paused = false; 8343 item.pauseCount--; 8344 } 8345 } 8346}); 8347DomObserver.IsMutationObserverAvailable = function() { 8348 return !!window.MutationObserver; 8349}; 8350var TimerObserver = ASPx.CreateClass(DomObserver, { 8351 constructor: function() { 8352 this.constructor.prototype.constructor.call(this); 8353 this.timerID = -1; 8354 this.observationTimeout = 300; 8355 }, 8356 subscribe: function(elementID, callbackFunc) { 8357 DomObserver.prototype.subscribe.call(this, elementID, callbackFunc); 8358 if(!this.isActivated()) 8359 this.startObserving(); 8360 }, 8361 isActivated: function() { 8362 return this.timerID !== -1; 8363 }, 8364 startObserving: function() { 8365 if(this.isActivated()) 8366 window.clearTimeout(this.timerID); 8367 this.timerID = window.setTimeout(this.onTimeout, this.observationTimeout); 8368 }, 8369 onTimeout: function() { 8370 var observer = _aspxGetDomObserver(); 8371 observer.doObserve(); 8372 observer.startObserving(); 8373 }, 8374 doObserve: function() { 8375 if(!ASPx.documentLoaded) return; 8376 this.forEachItem(function(item) { 8377 if(!item.paused) 8378 this.doObserveForItem(item); 8379 }.aspxBind(this)); 8380 }, 8381 doObserveForItem: function(item) { 8382 var element = this.getItemElement(item); 8383 if(element) 8384 item.callbackFunc.call(this, element); 8385 } 8386}); 8387var MutationObserver = ASPx.CreateClass(DomObserver, { 8388 constructor: function() { 8389 this.constructor.prototype.constructor.call(this); 8390 this.callbackTimeout = 10; 8391 }, 8392 prepareItem: function(item) { 8393 item.callbackTimerID = -1; 8394 var target = this.getElementById(item.elementID); 8395 if(!target) 8396 return; 8397 var observerCallbackFunc = function() { 8398 if(item.callbackTimerID === -1) { 8399 var timeoutHander = function() { 8400 item.callbackTimerID = -1; 8401 item.callbackFunc.call(this, target); 8402 }.aspxBind(this); 8403 item.callbackTimerID = window.setTimeout(timeoutHander, this.callbackTimeout); 8404 } 8405 }.aspxBind(this); 8406 var observer = new window.MutationObserver(observerCallbackFunc); 8407 var config = { attributes: true, childList: true, characterData: true, subtree: true }; 8408 observer.observe(target, config); 8409 item.observer = observer; 8410 item.config = config; 8411 }, 8412 unsubscribe: function(elementID) { 8413 var item = this.items[elementID]; 8414 if(item) { 8415 item.observer.disconnect(); 8416 item.observer = null; 8417 } 8418 DomObserver.prototype.unsubscribe.call(this, elementID); 8419 }, 8420 pauseItem: function(item) { 8421 DomObserver.prototype.pauseItem.call(this, item); 8422 item.observer.disconnect(); 8423 }, 8424 resumeItem: function(item) { 8425 DomObserver.prototype.resumeItem.call(this, item); 8426 if(!item.paused) { 8427 var target = this.getItemElement(item); 8428 if(target) 8429 item.observer.observe(target, item.config); 8430 } 8431 } 8432}); 8433var domObserver = null; 8434function _aspxGetDomObserver() { 8435 if(domObserver == null) 8436 domObserver = DomObserver.IsMutationObserverAvailable() ? new MutationObserver() : new TimerObserver(); 8437 return domObserver; 8438} 8439var ControlUpdateWatcher = ASPx.CreateClass(null, { 8440 constructor: function() { 8441 this.helpers = { }; 8442 this.clearLockerTimerID = -1; 8443 this.clearLockerTimerDelay = 15; 8444 this.postProcessing = false; 8445 this.init(); 8446 }, 8447 init: function() { 8448 var postHandler = aspxGetPostHandler(); 8449 postHandler.Post.AddHandler(this.OnPost, this); 8450 }, 8451 Add: function(helper) { 8452 this.helpers[helper.GetName()] = helper; 8453 },
8454 CanSendCallback: function(dxCallbackOwner, arg) { 8455 this.LockConfirmOnBeforeWindowUnload(); 8456 var modifiedHelpers = this.FilterModifiedHelpersByDXCallbackOwner(this.GetModifiedHelpers(), dxCallbackOwner, arg); 8457 if(modifiedHelpers.length === 0) return true; 8458 var modifiedHelpersInfo = this.GetToConfirmAndToResetLists(modifiedHelpers, dxCallbackOwner.name); 8459 if(!modifiedHelpersInfo) return true; 8460 if(modifiedHelpersInfo.toConfirm.length === 0) { 8461 this.ResetClientChanges(modifiedHelpersInfo.toReset); 8462 return true; 8463 } 8464 var helper = modifiedHelpersInfo.toConfirm[0]; 8465 if(!confirm(helper.GetConfirmUpdateText())) 8466 return false; 8467 this.ResetClientChanges(modifiedHelpersInfo.toReset); 8468 return true; 8469 }, 8470 OnPost: function(s, e) { 8471 if(this.isDxCallback(e)) 8472 return; 8473 this.postProcessing = true; 8474 this.LockConfirmOnBeforeWindowUnload(); 8475 var modifiedHelpersInfo = this.GetModifedHelpersInfo(e); 8476 if(!modifiedHelpersInfo) 8477 return; 8478 if(modifiedHelpersInfo.toConfirm.length === 0) { 8479 this.ResetClientChanges(modifiedHelpersInfo.toReset); 8480 return; 8481 } 8482 var helper = modifiedHelpersInfo.toConfirm[0]; 8483 if(!confirm(helper.GetConfirmUpdateText())) { 8484 e.cancel = true; 8485 this.finishPostProcessing(); 8486 } 8487 if(!e.cancel) 8488 this.ResetClientChanges(modifiedHelpersInfo.toReset); 8489 }, 8490 isDxCallback: function(e) { 8491 return e.isDXCallback || this.isInternalUploadControlCallback(); 8492 }, 8493 isInternalUploadControlCallback: function() { 8494 var isInCallback = false; 8495 for(var key in this.helpers) { 8496 if(this.helpers.hasOwnProperty(key)) { 8497 var helper = this.helpers[key]; 8498 isInCallback = isInCallback || helper.isInUploadCallback(); 8499 } 8500 } 8501 return isInCallback; 8502 }, 8503 finishPostProcessing: function() { 8504 this.postProcessing = false; 8505 }, 8506 GetModifedHelpersInfo: function(e) { 8507 var modifiedHelpers = this.FilterModifiedHelpers(this.GetModifiedHelpers(), e); 8508 if(modifiedHelpers.length === 0) return; 8509 return this.GetToConfirmAndToResetLists(modifiedHelpers, e && e.ownerID); 8510 }, 8511 GetToConfirmAndToResetLists: function(modifiedHelpers, ownerID) { 8512 var resetList = [ ]; 8513 var confirmList = [ ]; 8514 for(var i = 0; i < modifiedHelpers.length; i++) { 8515 var helper = modifiedHelpers[i]; 8516 if(!helper.GetConfirmUpdateText()) { 8517 resetList.push(helper); 8518 continue; 8519 } 8520 if(helper.CanShowConfirm(ownerID)) { 8521 resetList.push(helper); 8522 confirmList.push(helper); 8523 } 8524 } 8525 return { toConfirm: confirmList, toReset: resetList }; 8526 }, 8527 FilterModifiedHelpers: function(modifiedHelpers, e) { 8528 if(modifiedHelpers.length === 0) 8529 return [ ]; 8530 if(this.RequireProcessUpdatePanelCallback(e)) 8531 return this.FilterModifiedHelpersByUpdatePanels(modifiedHelpers); 8532 if(this.postProcessing) 8533 return this.FilterModifiedHelpersByPostback(modifiedHelpers); 8534 return modifiedHelpers; 8535 }, 8536 FilterModifiedHelpersByDXCallbackOwner: function(modifiedHelpers, dxCallbackOwner, arg) { 8537 var result = [ ]; 8538 for(var i = 0; i < modifiedHelpers.length; i++) { 8539 var helper = modifiedHelpers[i]; 8540 if(helper.NeedConfirmOnCallback(dxCallbackOwner, arg)) 8541 result.push(helper); 8542 } 8543 return result; 8544 }, 8545 FilterModifiedHelpersByUpdatePanels: function(modifiedHelpers) { 8546 var result = [ ]; 8547 var updatePanels = this.GetUpdatePanelsWaitedForUpdate(); 8548 for(var i = 0; i < updatePanels.length; i++) { 8549 var panelID = updatePanels[i].replace(/\$/g, "_"); 8550 var panel = ASPx.GetElementById(panelID); 8551 if(!panel) continue; 8552 for(var j = 0; j < modifiedHelpers.length; j++) { 8553 var helper = modifiedHelpers[j]; 8554 if(ASPx.GetIsParent(panel, helper.GetControlMainElement())) 8555 result.push(helper); 8556 } 8557 } 8558 return result; 8559 }, 8560 FilterModifiedHelpersByPostback: function(modifiedHelpers) { 8561 var result = [ ]; 8562 for(var i = 0; i < modifiedHelpers.length; i++) { 8563 var helper = modifiedHelpers[i]; 8564 if(helper.NeedConfirmOnPostback()) 8565 result.push(helper); 8566 } 8567 return result; 8568 }, 8569 RequireProcessUpdatePanelCallback: function(e) { 8570 var rManager = this.GetMSRequestManager(); 8571 if(rManager && e && e.isMSAjaxCallback) 8572 return rManager._postBackSettings.async; 8573 return false; 8574 }, 8575 GetUpdatePanelsWaitedForUpdate: function() { 8576 var rManager = this.GetMSRequestManager(); 8577 if(!rManager) return [ ];
8578 var panelUniqueIDs = rManager._postBackSettings.panelsToUpdate || [ ]; 8579 var panelClientIDs = [ ]; 8580 for(var i = 0; i < panelUniqueIDs.length; i++) { 8581 var index = ASPx.Data.ArrayIndexOf(rManager._updatePanelIDs, panelUniqueIDs[i]); 8582 if(index >= 0) 8583 panelClientIDs.push(rManager._updatePanelClientIDs[index]); 8584 } 8585 return panelClientIDs; 8586 }, 8587 GetMSRequestManager: function() { 8588 return ASPx.GetMSAjaxRequestManager(); 8589 }, 8590 GetModifiedHelpers: function() { 8591 var result = [ ]; 8592 for(var key in this.helpers) { 8593 if(this.helpers.hasOwnProperty(key)) { 8594 var helper = this.helpers[key]; 8595 if(helper.HasChanges()) 8596 result.push(helper); 8597 } 8598 } 8599 return result; 8600 }, 8601 ResetClientChanges: function(modifiedHelpers) { 8602 for(var i = 0; i < modifiedHelpers.length; i++) 8603 modifiedHelpers[i].ResetClientChanges(); 8604 }, 8605 GetConfirmUpdateMessage: function() { 8606 if(this.confirmOnWindowUnloadLocked) return; 8607 var modifiedHelpersInfo = this.GetModifedHelpersInfo(); 8608 if(!modifiedHelpersInfo || modifiedHelpersInfo.toConfirm.length === 0) 8609 return; 8610 var helper = modifiedHelpersInfo.toConfirm[0]; 8611 return helper.GetConfirmUpdateText(); 8612 }, 8613 LockConfirmOnBeforeWindowUnload: function() { 8614 this.confirmOnWindowUnloadLocked = true; 8615 this.clearLockerTimerID = ASPx.Timer.ClearTimer(this.clearLockerTimerID); 8616 this.clearLockerTimerID = window.setTimeout(function() { 8617 this.confirmOnWindowUnloadLocked = false; 8618 }.aspxBind(this), this.clearLockerTimerDelay); 8619 }, 8620 OnWindowBeforeUnload: function(e) { 8621 var confirmMessage = this.GetConfirmUpdateMessage(); 8622 if(confirmMessage) 8623 e.returnValue = confirmMessage; 8624 this.finishPostProcessing(); 8625 return confirmMessage; 8626 }, 8627 OnWindowUnload: function(e) { 8628 if(this.confirmOnWindowUnloadLocked) return; 8629 var modifiedHelpersInfo = this.GetModifedHelpersInfo(); 8630 if(!modifiedHelpersInfo) return; 8631 this.ResetClientChanges(modifiedHelpersInfo.toReset); 8632 }, 8633 OnMouseDown: function(e) { 8634 }, 8635 OnFocusIn: function(e) { 8636 }, 8637 PreventBeforeUnloadOnLinkClick: function(e) { 8638 if(ASPx.GetObjectKeys(this.helpers).length == 0) 8639 return; 8640 var link = ASPx.GetParentByTagName(ASPx.Evt.GetEventSource(e), "A"); 8641 if(!link || link.dxgvLinkClickHanlderAssigned) 8642 return; 8643 var url = ASPx.Attr.GetAttribute(link, "href"); 8644 if(!url || url.indexOf("javascript:") < 0) 8645 return; 8646 ASPx.Evt.AttachEventToElement(link, "click", function(ev) { return ASPx.Evt.PreventEvent(ev); }); 8647 link.dxgvLinkClickHanlderAssigned = true; 8648 } 8649}); 8650ControlUpdateWatcher.Instance = null; 8651ControlUpdateWatcher.getInstance = function () { 8652 if (!ControlUpdateWatcher.Instance) { 8653 ControlUpdateWatcher.Instance = new ControlUpdateWatcher(); 8654 ASPx.Evt.AttachEventToElement(window, "beforeunload", function(e) { 8655 return ControlUpdateWatcher.Instance.OnWindowBeforeUnload(e); 8656 }); 8657 ASPx.Evt.AttachEventToElement(window, "unload", function(e) { 8658 ControlUpdateWatcher.Instance.OnWindowUnload(e); 8659 }); 8660 ASPx.Evt.AttachEventToDocument("mousedown", function(e) { 8661 ControlUpdateWatcher.Instance.OnMouseDown(e); 8662 }); 8663 ASPx.Evt.AttachEventToDocument("focusin", function(e) { 8664 ControlUpdateWatcher.Instance.OnFocusIn(e); 8665 }); 8666 } 8667 return ControlUpdateWatcher.Instance; 8668}; 8669var UpdateWatcherHelper = ASPx.CreateClass(null, { 8670 constructor: function(owner) { 8671 this.owner = owner; 8672 this.ownerWatcher = ControlUpdateWatcher.getInstance(); 8673 this.ownerWatcher.Add(this); 8674 }, 8675 GetName: function() { 8676 return this.owner.name; 8677 }, 8678 GetControlMainElement: function() { 8679 return this.owner.GetMainElement(); 8680 }, 8681 GetControlParentForm: function(){ 8682 return ASPx.GetParentByTagName(this.GetControlMainElement(), "FORM"); 8683 }, 8684 CanShowConfirm: function(requestOwnerID) { 8685 return true; 8686 }, 8687 HasChanges: function() { 8688 return false; 8689 }, 8690 GetConfirmUpdateText: function() { 8691 return ""; 8692 }, 8693 NeedConfirmOnCallback: function(dxCallbackOwner) { 8694 return true; 8695 }, 8696 NeedConfirmOnPostback: function() { 8697 if(ASPx.IsUploadSubmitRequest) 8698 return !ASPx.IsUploadSubmitRequest(this.GetControlParentForm(
8698)); 8699 return true; 8700 }, 8701 ResetClientChanges: function() { 8702 }, 8703 ConfirmOnCustomControlEvent: function() { 8704 var confirmMessage = this.GetConfirmUpdateText(); 8705 if(confirmMessage) 8706 return confirm(confirmMessage); 8707 return false; 8708 }, 8709 isInUploadCallback: function() { 8710 return false; 8711 } 8712}); 8713var ControlTabIndexManager = ASPx.CreateClass(null, { 8714 constructor: function() { 8715 this.elementsWithChangedTabIndex = {}; 8716 }, 8717 getChangedElementsForControlId: function(id) { 8718 if(!this.elementsWithChangedTabIndex[id]) 8719 this.elementsWithChangedTabIndex[id] = []; 8720 return this.elementsWithChangedTabIndex[id]; 8721 }, 8722 isElementWithChangedIndex: function(element) { 8723 for(var key in this.elementsWithChangedTabIndex) 8724 if(this.elementsWithChangedTabIndex.hasOwnProperty(key)) 8725 if(this.elementsWithChangedTabIndex[key].indexOf(element) !== -1) 8726 return true; 8727 return false; 8728 }, 8729 changeTabIndexAttribute: function(element, id) { 8730 var elements = this.getChangedElementsForControlId(id); 8731 ASPx.Attr.ChangeTabIndexAttribute(element); 8732 if(elements.indexOf(element) === -1) 8733 elements.push(element); 8734 }, 8735 restoreTabIndexAttribute: function(element, id) { 8736 var elements = this.getChangedElementsForControlId(id), 8737 index = elements.indexOf(element); 8738 if(index !== -1) { 8739 elements.splice(index, 1); 8740 if(!this.isElementWithChangedIndex(element)) 8741 ASPx.Attr.RestoreTabIndexAttribute(element); 8742 } 8743 } 8744}); 8745ControlTabIndexManager.Instance = null; 8746ControlTabIndexManager.getInstance = function() { 8747 if(!ControlTabIndexManager.Instance) 8748 ControlTabIndexManager.Instance = new ControlTabIndexManager(); 8749 return ControlTabIndexManager.Instance; 8750}; 8751var ControlCallbackHandlersQueue = ASPx.CreateClass(null, { 8752 constructor: function (owner) { 8753 this.owner = owner; 8754 this.handlerInfos = []; 8755 }, 8756 addCallbackHandler: function(handlerInfo) { 8757 this.handlerInfos.push(handlerInfo); 8758 }, 8759 executeCallbacksHandlers: function() { 8760 for(var i = 0, handlerInfo; handlerInfo = this.handlerInfos[i]; i++) 8761 handlerInfo.handler.call(this.owner, handlerInfo.result); 8762 this.handlerInfos = []; 8763 } 8764}); 8765var ControlCallbackQueueHelper = ASPx.CreateClass(null, { 8766 constructor: function (owner) { 8767 this.owner = owner; 8768 this.pendingCallbacks = []; 8769 this.receivedCallbacks = []; 8770 this.attachEvents(); 8771 }, 8772 showLoadingElements: function () { 8773 this.owner.ShowLoadingDiv(); 8774 if (this.owner.IsCallbackAnimationEnabled())
8775 this.owner.StartBeginCallbackAnimation(); 8776 else 8777 this.owner.ShowLoadingElementsInternal(); 8778 }, 8779 attachEvents: function () { 8780 this.owner.EndCallback.AddHandler(this.onEndCallback.aspxBind(this)); 8781 this.owner.CallbackError.AddHandler(this.onCallbackError.aspxBind(this)); 8782 }, 8783 detachEvents: function () { 8784 this.owner.EndCallback.RemoveHandler(this.onEndCallback); 8785 this.owner.CallbackError.RemoveHandler(this.onCallbackError); 8786 }, 8787 onCallbackError: function (owner, result) { 8788 this.sendErrorToChildControl(result); 8789 }, 8790 ignoreDuplicates: function () { 8791 return true; 8792 }, 8793 hasDuplicate: function (arg) { 8794 for (var i in this.pendingCallbacks) { 8795 if (this.pendingCallbacks[i].arg == arg && this.pendingCallbacks[i].state != ASPx.callbackState.aborted) 8796 return true; 8797 } 8798 return false; 8799 }, 8800 getToken: function (halperContext, callbackInfo) { 8801 return { 8802 cancel: function () { 8803 if (callbackInfo.state == ASPx.callbackState.sent) { 8804 callbackInfo.state = ASPx.callbackState.aborted; 8805 halperContext.sendNext(); 8806 } 8807 if (callbackInfo.state == ASPx.callbackState.inTurn) 8808 ASPx.Data.ArrayRemove(halperContext.pendingCallbacks, callbackInfo); 8809 }, 8810 callbackId: -1 8811 }; 8812 }, 8813 sendCallback: function (arg, handlerContext, handler, commandName, onBeforeSend) { 8814 if (this.ignoreDuplicates() && this.hasDuplicate(arg)) 8815 return false; 8816 var handlerContext = handlerContext || this.owner; 8817 var callbackInfo = { 8818 arg: arg, 8819 handlerContext: handlerContext, 8820 handler: handler || handlerContext.OnCallback, 8821 state: ASPx.callbackState.inTurn, 8822 callbackId: -1, 8823 onBeforeSend: onBeforeSend 8824 }; 8825 this.pendingCallbacks.push(callbackInfo); 8826 if (!this.hasActiveCallback()) { 8827 this.createCallbackByCallbackInfo(callbackInfo, commandName); 8828 } 8829 return this.getToken(this, callbackInfo); 8830 }, 8831 hasActiveCallback: function () { 8832 return this.getCallbacksInfoByState(ASPx.callbackState.sent).length > 0; 8833 }, 8834 sendNext: function () { 8835 var nextCallbackInfo = this.getCallbacksInfoByState(ASPx.callbackState.inTurn)[0]; 8836 if (nextCallbackInfo) { 8837 this.createCallbackByCallbackInfo(nextCallbackInfo); 8838 return nextCallbackInfo.callbackId; 8839 } 8840 }, 8841 createCallbackByCallbackInfo: function(callbackInfo, commandName) { 8842 if(callbackInfo.onBeforeSend) 8843 callbackInfo.onBeforeSend(); 8844 callbackInfo.callbackId = this.owner.CreateCallback(callbackInfo.arg, commandName); 8845 callbackInfo.state = ASPx.callbackState.sent; 8846 }, 8847 onEndCallback: function () { 8848 if (!this.owner.isErrorOnCallback && this.hasPendingCallbacks()) { 8849 var curCallbackId; 8850 var curCallbackInfo; 8851 var handlerContext; 8852 for (var i in this.receivedCallbacks) { 8853 if(this.receivedCallbacks.hasOwnProperty(i)) { 8854 curCallbackId = this.receivedCallbacks[i]; 8855 curCallbackInfo = this.getCallbackInfoById(curCallbackId); 8856 if (curCallbackInfo.state != ASPx.callbackState.aborted) { 8857 handlerContext = curCallbackInfo.handlerContext; 8858 if (handlerContext.OnEndCallback) 8859 handlerContext.OnEndCallback(); 8860 this.sendNext(); 8861 } 8862 ASPx.Data.ArrayRemove(this.pendingCallbacks, curCallbackInfo); 8863 } 8864 } 8865 ASPx.Data.ArrayClear(this.receivedCallbacks); 8866 } 8867 }, 8868 hasPendingCallbacks: function () { 8869 return this.pendingCallbacks && this.pendingCallbacks.length && this.pendingCallbacks.length > 0; 8870 }, 8871 processCallback: function (result, callbackId) { 8872 this.receivedCallbacks.push(callbackId); 8873 if (this.hasPendingCallbacks()) { 8874 var callbackInfo = this.getCallbackInfoById(callbackId); 8875 if (callbackInfo.state != ASPx.callbackState.aborted) 8876 callbackInfo.handler.call(callbackInfo.handlerContext, result); 8877 } 8878 }, 8879 getCallbackInfoById: function (id) { 8880 for (var i in this.pendingCallbacks) { 8881 if (this.pendingCallbacks[i].callbackId == id) 8882 return this.pendingCallbacks[i]; 8883 } 8884 }, 8885 getCallbacksInfoByState: function (state) { 8886 var result = []; 8887 for (var i in this.pendingCallbacks) { 8888 if (this.pendingCallbacks[i].state == state) 8889 result.push(this.pendingCallbacks[i]); 8890 } 8891 return result; 8892 }, 8893 sendErrorToChildControl: function (callbackObj) { 8894 if (!this.hasPendingCallbacks()) 8895 return; 8896 var callbackInfo = this.getCallbackInfoById(callbackObj.callbackId || 0); 8897 if (!callbackInfo) 8898 return; 8899 var hasChildControlHandler = (callbackInfo.handlerContext != this.owner) && callbackInfo.handlerContext.OnCallbackError; 8900 if (hasChildControlHandler) 8901 callbackInfo.handlerContext.OnCallbackError.call(callbackInfo.handlerContext, callbackObj.message, callbackObj.data); 8902 } 8903}); 8904var AccessibilityHelperBase = ASPx.CreateClass(null, { 8905 constructor: function(control) { 8906 this.control = control; 8907 this.pronounceMessageTimeout = 500; 8908 this.pronounceIsStarted = false; 8909 this.timerID = -1; 8910 }, 8911 PronounceMessage: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) { 8912 this.timerID = ASPx.Timer.ClearTimer(this.timerID); 8913 this.pronounceIsStarted = true; 8914 this.timerID = window.setTimeout(function() { 8915 this.PronounceMessageCore(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement); 8916 }.aspxBind(this), this.getPronounceTimeout()); 8917 }, 8918 PronounceMessageCore: function(text) { 8919 this.processValidationState(); 8920 if(this.control.IsFocused()) 8921 this.control.SendMessageToAssistiveTechnology(text); 8922 }, 8923 GetActiveElement: function(inputIsMainElement) { 8924 if(this.pronounceIsStarted) return null;
8925 var mainElement = inputIsMainElement ? this.control.GetInputElement() : this.getMainElement(); 8926 var activeElementId = ASPx.Attr.GetAttribute(mainElement, 'aria-activedescendant'); 8927 return activeElementId ? ASPx.GetElementById(activeElementId) : mainElement; 8928 }, 8929 GetPronounceElement: function() { return null; }, 8930 processValidationState: function() { 8931 var errorTextElement = null; 8932 if(this.control.GetErrorCell()) 8933 errorTextElement = this.getAriaExplanatoryTextManager().GetErrorTextElement(); 8934 var input = this.getInputElement(); 8935 var invalidArg = { "aria-invalid": !this.control.isValid ? "true" : "" }; 8936 this.changeActivityAttributes(input, invalidArg); 8937 if(errorTextElement) 8938 this.getAriaExplanatoryTextManager().SetOrRemoveText([input], errorTextElement, !this.control.isValid, false, true); 8939 }, 8940 getMainElement: function() { 8941 if(!ASPx.IsExistsElement(this.mainElement)) 8942 this.mainElement = this.control.GetAccessibilityAssistantElement(); 8943 return this.mainElement; 8944 }, 8945 changeActivityAttributes: function(element, args) { 8946 if(!element) 8947 return; 8948 for(var key in args) { 8949 if(args.hasOwnProperty(key)) { 8950 var value = args[key]; 8951 if(key == "innerHtml") 8952 ASPx.SetInnerHtml(element, value); 8953 else { 8954 var action = value !== "" ? ASPx.Attr.SetAttribute : ASPx.Attr.RemoveAttribute; 8955 action(element, key, value); 8956 } 8957 } 8958 } 8959 }, 8960 getPronounceTimeout: function() { return this.pronounceMessageTimeout; }, 8961 getInputElement: function() { return this.control.GetInputElement(); }, 8962 getAriaExplanatoryTextManager: function() { return this.control.ariaExplanatoryTextManager; } 8963}); 8964var AccessibilityHelper = ASPx.CreateClass(AccessibilityHelperBase, { 8965 constructor: function(control) { 8966 this.constructor.prototype.constructor.call(this, control); 8967 this.activeItem = this.getItems()[0]; 8968 }, 8969 PronounceMessageCore: function(text, activeItemArgs, inactiveItemArgs, mainElementArgs, ownerMainElement) { 8970 if(!this.getItems()) 8971 return; 8972 this.toogleItem(); 8973 var mainElement = this.getMainElement(); 8974 var activeItem = this.getItem(true); 8975 var inactiveItem = this.getItem(); 8976 if(ASPx.Attr.GetAttribute(mainElement, "role") != "application") 8977 mainElementArgs = this.addArguments(mainElementArgs, { "aria-activedescendant" : activeItem.id }); 8978 var messageAttrObj = {}; 8979 var activeItemRole = ASPx.Attr.GetAttribute(activeItem, "role"); 8980 var attrName = activeItemRole == "combobox" ? "aria-label" : "innerHtml"; 8981 messageAttrObj[attrName] = ASPx.Str.EncodeHtml(text); 8982 activeItemArgs = this.addArguments(activeItemArgs, messageAttrObj); 8983 messageAttrObj[attrName] = ""; 8984 inactiveItemArgs = this.addArguments(inactiveItemArgs, messageAttrObj); 8985 var errorTextElement = null; 8986 if(this.control.GetErrorCell()) { 8987 errorTextElement = this.getAriaExplanatoryTextManager().GetErrorTextElement(); 8988 activeItemArgs = this.addArguments(activeItemArgs, {"aria-invalid" : !this.control.isValid ? "true" : "" }); 8989 mainElementArgs = this.addArguments(mainElementArgs, { "aria-invalid" : "" }); 8990 inactiveItemArgs = this.addArguments(inactiveItemArgs, { "aria-invalid" : "" }); 8991 } 8992 this.changeActivityAttributes(activeItem, activeItemArgs); 8993 if(errorTextElement) { 8994 this.getAriaExplanatoryTextManager().SetOrRemoveText([activeItem], errorTextElement, !this.control.isValid, false, true); 8995 this.getAriaExplanatoryTextManager().SetOrRemoveText([mainElement, inactiveItem], errorTextElement, false, false, false); 8996 } 8997 this.changeActivityAttributes(mainElement, mainElementArgs); 8998 if(!!ownerMainElement && ASPx.Attr.GetAttribute(ownerMainElement, "role") != "application") 8999 this.changeActivityAttributes(ownerMainElement, { "aria-activedescendant": activeItem.id }); 9000 this.changeActivityAttributes(inactiveItem, inactiveItemArgs); 9001 this.pronounceIsStarted = false; 9002 }, 9003 GetPronounceElement: function() { 9004 return this.getItem(true); 9005 }, 9006 getItems: function() { 9007 if(!ASPx.IsExistsElement(this.items)) 9008 this.items = ASPx.GetChildElementNodes(this.getMainElement()); 9009 return this.items; 9010 }, 9011 getItem: function(isActive) { 9012 if(isActive) 9013 return this.activeItem; 9014 var items = this.getItems();
9015 return items[0] === this.activeItem ? items[1] : items[0]; 9016 }, 9017 toogleItem: function() { 9018 this.activeItem = this.getItem(); 9019 }, 9020 addArguments: function(targetArgs, newArgs) { 9021 if(!targetArgs) targetArgs = { }; 9022 for(var key in newArgs) { 9023 if(newArgs.hasOwnProperty(key) && !targetArgs.hasOwnProperty(key)) 9024 targetArgs[key] = newArgs[key]; 9025 } 9026 return targetArgs; 9027 } 9028}); 9029var AccessibilityPronouncer = ASPx.CreateClass(null, { 9030 constructor: function() { 9031 this.pronouncerId = "dxPronouncer"; 9032 this.initialized = false; 9033 this.focusableMessageElement = null; 9034 this.messageElement = null; 9035 this.pronouncers = { 9036 live: new AccessibilityLivePronouncer(this), 9037 descendant: new AccessibilityDescendantPronouncer(this) 9038 }; 9039 }, 9040 Pronounce: function(args, type) { 9041 this.pronouncers[type].Pronounce(args); 9042 }, 9043 EnsureInitialize: function() { 9044 if(!this.initialized) 9045 this.initialize(); 9046 }, 9047 RemoveState: function() { 9048 for(var pronouncer in this.pronouncers) 9049 if(this.pronouncers.hasOwnProperty(pronouncer)) 9050 pronouncer.RemoveState(); 9051 }, 9052 RestoreControlState: function(type, mainElement) { 9053 this.pronouncers[type].RestoreControlState(mainElement); 9054 }, 9055 RestoreElementsState: function(type, elements) { 9056 this.pronouncers[type].RestoreElementsState(elements); 9057 }, 9058 RestoreElementState: function(type, element) { 9059 this.pronouncers[type].RestoreElementState(element); 9060 }, 9061 initialize: function() { 9062 this.createFocusableMessageElement(); 9063 this.createMessageElement(); 9064 this.prepareFocusableMessageElement(); 9065 this.setAttributesForKeyboardNavigation(); 9066 this.initialized = true; 9067 }, 9068 createFocusableMessageElement: function() { 9069 var focusableMessageElement = document.createElement("DIV"); 9070 document.body.appendChild(focusableMessageElement); 9071 this.focusableMessageElement = focusableMessageElement; 9072 }, 9073 prepareFocusableMessageElement: function() { 9074 this.focusableMessageElement.className = "dxAIFME"; 9075 }, 9076 setAttributesForKeyboardNavigation: function() { 9077 ASPx.Attr.Aria.SetApplicationRole(this.focusableMessageElement); 9078 ASPx.Attr.Aria.SetSilence(this.focusableMessageElement); 9079 }, 9080 createMessageElement: function() { 9081 var messageElement = document.createElement("DIV"); 9082 messageElement.id = this.pronouncerId; 9083 ASPx.Attr.SetAttribute(messageElement, "role", "note"); 9084 this.focusableMessageElement.appendChild(messageElement); 9085 this.messageElement = messageElement; 9086 }, 9087 getMessage: function(messagePartsArg) { 9088 var messageParts = messagePartsArg.filter(function(x) { return ASPx.IsExists(x); }); 9089 return messageParts.join(", "); 9090 } 9091}); 9092var AccessibilityPronouncerBase = ASPx.CreateClass(null, { 9093 constructor: function() { 9094 this.state = { }; 9095 }, 9096 Pronounce: function(args) { 9097 var messageElement = this.getMessageElement(); 9098 ASPx.Attr.Aria.SetOrRemoveLabel(messageElement); 9099 ASPx.SetInnerHtml(messageElement, ""); 9100 this.PronounceCore(args); 9101 }, 9102 PronounceCore: function(args) { }, 9103 SaveElementState: function(element) { 9104 if(this.state[element.id]) 9105 return; 9106 this.state[element.id] = { 9107 element: element, 9108 descendant: ASPx.Attr.GetAttribute(element, ASPx.Attr.Aria.descendant) 9109 }; 9110 }, 9111 RemoveState: function() { 9112 this.state = { }; 9113 }, 9114 RestoreControlState: function(mainElement) { 9115 for(var elementInfo in this.state) { 9116 if(this.state.hasOwnProperty(elementInfo)) { 9117 var element = this.state[elementInfo].element; 9118 if(!mainElement || ASPx.GetIsParent(mainElement, element)) 9119 this.RestoreElementState(element); 9120 } 9121 } 9122 }, 9123 RestoreElementsState: function(elements) { 9124 for(var i = 0; i < elements.length; i++) 9125 this.RestoreElementState(elements[i]); 9126 }, 9127 RestoreElementState: function(element) { 9128 var elementState = this.state[element.id]; 9129 if(!elementState) 9130 return; 9131 ASPx.Attr.Aria.SetOrRemoveDescendant(element, elementState.descendant); 9132 delete this.state[element.id]; 9133 }, 9134 getMessage: function(args) { 9135 return ASPx.AccessibilityPronouncer.getMessage(args.messageParts); 9136 }, 9137 getMessageElement: function() { 9138 return ASPx.AccessibilityPronouncer.messageElement; 9139 }, 9140 getFocusableMessageElement: function() { 9141 return ASPx.AccessibilityPronouncer.focusableMessageElement; 9142 } 9143}); 9144var AccessibilityLivePronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, { 9145 constructor: function() { 9146 this.constructor.prototype.constructor.call(this); 9147 }, 9148 PronounceCore: function(args) {
9149 var message = this.getMessage(args); 9150 var messageElement = this.getMessageElement(); 9151 ASPx.Attr.SetAttribute(this.getFocusableMessageElement(), "aria-live", "assertive"); 9152 ASPx.Attr.Aria.SetAtomic(this.getFocusableMessageElement(), "true"); 9153 ASPx.SetInnerHtml(messageElement, ASPx.Str.EncodeHtml(message)); 9154 } 9155}); 9156var AccessibilityDescendantPronouncer = ASPx.CreateClass(AccessibilityPronouncerBase, { 9157 constructor: function() { 9158 this.constructor.prototype.constructor.call(this); 9159 }, 9160 PronounceCore: function(args) { 9161 var message = this.getMessage(args); 9162 var activeElement = ASPx.GetActiveElement(); 9163 var messageElement = this.getMessageElement(); 9164 this.SaveElementState(activeElement); 9165 ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-live"); 9166 ASPx.Attr.RemoveAttribute(this.getFocusableMessageElement(), "aria-atomic"); 9167 ASPx.Attr.Aria.SetOrRemoveLabel(messageElement, message); 9168 ASPx.Attr.Aria.SetOrRemoveDescendant(activeElement, messageElement.id); 9169 } 9170}); 9171ASPx.AccessibilityPronouncerType = { 9172 live: "live", 9173 descendant: "descendant" 9174}; 9175ASPx.AccessibilityPronouncer = new AccessibilityPronouncer(); 9176var RestoreFocusHelper = ASPx.CreateClass(null, { 9177 constructor: function() { 9178 this.excludedIDs = [ "DXCBtn" ]; 9179 this.pronouncerType = ASPx.AccessibilityPronouncerType.live; 9180 this.callbackQueue = []; 9181 this.Initialize(); 9182 }, 9183 Initialize: function() { 9184 var that = this; 9185 ASPx.attachToLoad(function() { 9186 ASPxClientControl.GetControlCollection().BeginCallback.AddHandler(that.OnBeginCallback, that); 9187 ASPxClientControl.GetControlCollection().EndCallback.AddHandler(that.OnEndCallback, that); 9188 }); 9189 }, 9190 OnBeginCallback: function(s, e) { 9191 var control = e.control; 9192 if(!control.allowRestoreFocusOnCallbacks()) 9193 return; 9194 control.accessibilityFocusTreeLine = this.getFocusTreeLine(control); 9195 var controlHasCallbackTreeLine = this.callbackQueueContainsTreeLine(control); 9196 this.pushTreeLineInfoIntoCallbackQueue(control); 9197 if(control.accessibilityFocusTreeLine && !controlHasCallbackTreeLine) 9198 control.SendMessageToAssistiveTechnology(this.getDefaultCallbackMessage()); 9199 }, 9200 OnEndCallback: function(s, e) { 9201 var control = e.control; 9202 if(!control.allowRestoreFocusOnCallbacks()) 9203 return; 9204 var treeLineInfo = this.shiftTreeLineInfoFromCallbackQueue(control); 9205 if(treeLineInfo.queueLength == 0) { 9206 if(!control.accessibilityFocusTreeLine && treeLineInfo.treeLine) 9207 control.accessibilityFocusTreeLine = treeLineInfo.treeLine; 9208 var focusElement = this.findFocusElement(control); 9209 var focusIsManagerByPopupwindow = this.isFocusManagedByActivePopupWindow(focusElement); 9210 var focusIsManagedByControl = control.shouldPreventFocusRestoringOnCallback && control.shouldPreventFocusRestoringOnCallback(); 9211 if(!focusIsManagerByPopupwindow && !focusIsManagedByControl) 9212 ASPx.AccessibilityUtils.SetFocusAccessible(focusElement); 9213 delete control.accessibilityFocusTreeLine; 9214 } 9215 }, 9216 pushTreeLineInfoIntoCallbackQueue: function(control) { 9217 var controlTreeLine = control.accessibilityFocusTreeLine ? control.accessibilityFocusTreeLine.slice(0) : null; 9218 if(!this.callbackQueue[control.name]) 9219 this.callbackQueue[control.name] = []; 9220 this.callbackQueue[control.name].push(controlTreeLine); 9221 }, 9222 shiftTreeLineInfoFromCallbackQueue: function(control) { 9223 var treeLineInfo = { queueLength: 0, treeLine: null }; 9224 var treeLines = this.callbackQueue[control.name]; 9225 if(treeLines && treeLines.length > 0) { 9226 treeLineInfo.treeLine = treeLines.shift(); 9227 var linesCount = treeLines.length; 9228 treeLineInfo.queueLength = linesCount; 9229 if(linesCount > 0 && !treeLines[0] && treeLineInfo.treeLine) 9230 treeLines[0] = treeLineInfo.treeLine.slice(0); 9231 } 9232 return treeLineInfo; 9233 }, 9234 callbackQueueContainsTreeLine: function(control) { 9235 var treeLines = this.callbackQueue[control.name]; 9236 if(!treeLines || treeLines.length == 0) 9237 return false; 9238 if(treeLines[treeLines.length - 1]) 9239 return true; 9240 return false; 9241 }, 9242 getDefaultCallbackMessage: function() { 9243 return ASPx.AccessibilitySR.DefaultCallbackMessage; 9244 }, 9245 isFocusManagedByActivePopupWindow: function(focusElement) { 9246 var popupControl = this.getActivePopupControl(); 9247 if(!popupControl || popupControl.accessibleFocusElement) 9248 return false; 9249 this.initializePopupAccessibleFocusElement(popupControl, focusElement); 9250 return popupControl.setFocusOnCallback; 9251 }, 9252 getActivePopupControl: function() { 9253 var activePopupWindow = ASPx.GetPopupControlCollection && ASPx.GetPopupControlCollection().GetCurrentActiveWindowElement(); 9254 if(!activePopupWindow) 9255 return null; 9256 var popupInfo = ASPx.GetPopupControlCollection().GetPopupWindowFromID(activePopupWindow.id); 9257 return popupInfo.popupControl; 9258 }, 9259 initializePopupAccessibleFocusElement: function(popupControl, focusElement) { 9260 if(popupControl.setFocusOnCallback) 9261 popupControl.accessibleFocusElement = focusElement; 9262 else { 9263 var parentControl = popupControl.GetParentControl(); 9264 if(parentControl && parentControl.GetMainElement()) 9265 popupControl.accessibleFocusElement = ASPx.FindFirstChildActionElement(parentControl.GetMainElement()); 9266 } 9267 }, 9268 getFocusTreeLine: function(control) { 9269 var element = ASPx.GetActiveElement(); 9270 if(!ASPx.IsExistsElement(element)) 9271 return null; 9272 var mainElement = control.GetMainElement(); 9273 if(!ASPx.GetIsParent(mainElement, element)) { 9274 var treeInfo = this.findFocusedControlElement(mainElement, element); 9275 element = treeInfo.focusElement; 9276 mainElement = treeInfo.rootElement; 9277 } 9278 return this.getTreeLineCore(mainElement, element); 9279 }, 9280 getTreeLineCore: function(mainElement, element) { 9281 if(!element) return null; 9282 treeLine = [ ]; 9283 while(element) { 9284 treeLine.push({
9285 id: element.id, 9286 tagName: element.tagName, 9287 index: ASPx.Data.ArrayIndexOf(element.parentNode.childNodes, element) 9288 }); 9289 if(element === mainElement || element === document.body) 9290 break; 9291 element = element.parentNode; 9292 } 9293 return treeLine; 9294 }, 9295 findFocusedControlElement: function(mainElement, activeElement) { 9296 var element = null; 9297 var parentElement = mainElement; 9298 var focusedEditor = ASPx.IsExists(ASPx.GetFocusedEditor) ? ASPx.GetFocusedEditor() : null; 9299 if(focusedEditor && ASPx.GetIsParent(mainElement, focusedEditor.GetMainElement())) 9300 element = focusedEditor.GetFocusableInputElement(); 9301 else { 9302 if(mainElement && activeElement) { 9303 var mainControl = ASPx.GetClientControlByElementID(mainElement.id); 9304 var parentControls = ASPx.GetParentClientControls(activeElement.id); 9305 for(var i = parentControls.length - 1; i > -1; i--) { 9306 if(mainControl.name == parentControls[i].name) { 9307 element = activeElement; 9308 var rootIndex = i > 0 ? i - 1 : i; 9309 parentElement = parentControls[rootIndex].GetMainElement(); 9310 if(!parentElement && parentControls[rootIndex].GetCurrentWindowElement) 9311 parentElement = parentControls[rootIndex].GetCurrentWindowElement(); 9312 break; 9313 } 9314 } 9315 } 9316 } 9317 return { focusElement: element, rootElement: parentElement }; 9318 }, 9319 findFocusElement: function(control) { 9320 if(!control.accessibilityFocusTreeLine) 9321 return; 9322 var treeLine = control.accessibilityFocusTreeLine.slice(0); 9323 var focusElementParent = this.findFocusElementParentById(treeLine); 9324 if(!focusElementParent) 9325 return; 9326 return this.findFocusElementFromDOMTree(treeLine, focusElementParent); 9327 }, 9328 findFocusElementParentById: function(treeLine) { 9329 for(var i = 0; i < treeLine.length; i++) { 9330 var id = treeLine[i].id; 9331 if(!this.isValidId(id)) 9332 continue; 9333 var element = document.getElementById(id); 9334 if(element) { 9335 treeLine.splice(i, treeLine.length - i); 9336 treeLine.reverse(); 9337 return element; 9338 } 9339 } 9340 return null; 9341 }, 9342 findFocusElementFromDOMTree: function(treeLine, focusElementParent) { 9343 var element = focusElementParent; 9344 for(var i = 0; i < treeLine.length; i++) { 9345 var info = treeLine[i]; 9346 if(info.index >= element.childNodes.length) { 9347 element = element.childNodes.length > 0 ? element.childNodes[element.childNodes.length - 1] : null; 9348 return this.findNeighbourFocusElement(element, focusElementParent); 9349 } 9350 var child = element.childNodes[info.index]; 9351 if(child.tagName !== info.tagName) 9352 return this.findNeighbourFocusElement(child, focusElementParent); 9353 element = child; 9354 } 9355 return element; 9356 }, 9357 findNeighbourFocusElement: function(element, focusElementParent) { 9358 ASPx.ActionElementsCache.BeginUsage(); 9359 var result = this.findNeighbourFocusElementCore(element, focusElementParent); 9360 ASPx.ActionElementsCache.EndUsage(); 9361 return result; 9362 }, 9363 findNeighbourFocusElementCore: function(element, focusElementParent) { 9364 if(!element || !element.parentNode) return null; 9365 var neighbours = element.parentNode.childNodes; 9366 var indices = this.calcLeftRightIndices(ASPx.Data.ArrayIndexOf(neighbours, element), neighbours.length); 9367 for(var i = 0; i < indices.length; i++) { 9368 var index = indices[i]; 9369 var actionElement = ASPx.FindFirstChildActionElement(neighbours[index]); 9370 if(actionElement) 9371 return actionElement; 9372 } 9373 if(element === focusElementParent) 9374 return null; 9375 return this.findNeighbourFocusElement(element.parentNode, focusElementParent); 9376 }, 9377 calcLeftRightIndices: function(startIndex, count) { 9378 var indices = [ ]; 9379 var incSides = [ 0, 0 ]; 9380 var index = startIndex; 9381 for(var i = 0; i < count; i++) { 9382 indices.push(index); 9383 var even = i % 2 === 0; 9384 var nextIndex = this.calcNextIndex(startIndex, count, incSides, even); 9385 if(nextIndex < 0) 9386 nextIndex = this.calcNextIndex(startIndex, count, incSides, !even); 9387 index = nextIndex; 9388 } 9389 return indices; 9390 }, 9391 calcNextIndex: function(startIndex, count, incSides, even) { 9392 var sideIndex = even ? 0 : 1; 9393 var inc = incSides[sideIndex]; 9394 inc += even ? -1 : 1; 9395 var nextIndex = startIndex + inc; 9396 if(nextIndex >= 0 && nextIndex < count) { 9397 incSides[sideIndex] = inc; 9398 return nextIndex; 9399 } 9400 return -1; 9401 }, 9402 isValidId: function(id) { 9403 return id && !this.isExcludedId(id); 9404 }, 9405 isExcludedId: function(id) { 9406 var result = false; 9407 for(var i = 0; i < this.excludedIDs.length; i++) { 9408 if(id.indexOf(this.excludedIDs[i]) > -1) { 9409 result = true; 9410 break; 9411 } 9412 } 9413 return result; 9414 } 9415}); 9416var EventStorage = ASPx.CreateClass(null, { 9417 constructor: function() { 9418 this.bag = { }; 9419 }, 9420 Save: function(e, data, overwrite) { 9421 var key = this.getEventKey(e); 9422 if(this.bag.hasOwnProperty(key) && !overwrite) 9423 return; 9424 this.bag[key] = data; 9425 window.setTimeout(function() { delete this.bag[key]; }.aspxBind(this), 100); 9426 }, 9427 Load: function(e) { 9428 var key = this.getEventKey(e); 9429 return this.bag[key]; 9430 }, 9431 getEventKey: function(e) { 9432 if(ASPx.IsExists(e.timeStamp)) 9433 return e.timeStamp.toString(); 9434 var eventSource = ASPx.Evt.GetEventSource(e); 9435 var type = e.type.toString(); 9436 return eventSource ? type + "_" + eventSource.uniqueID.toString() : type; 9437 } 9438}); 9439ASPx.RestoreFocusHelper = new RestoreFocusHelper(); 9440EventStorage.Instance = null; 9441EventStorage.getInstance = function() { 9442 if(!EventStorage.Instance) 9443 EventStorage.Instance = new EventStorage(); 9444 return EventStorage.Instance; 9445}; 9446var GetGlobalObject = function(objectName) { 9447 var fields = objectName.split('.'); 9448 var obj = window[fields[0]]; 9449 for(var i = 1;
9449 obj && i < fields.length; i++) { 9450 obj = obj[fields[i]]; 9451 } 9452 return obj; 9453}; 9454var GetExternalScriptProcessor = function() { 9455 return ASPx.ExternalScriptProcessor ? ASPx.ExternalScriptProcessor.getInstance() : null; 9456}; 9457var SAVED_WIDTH_ATTR = "data-dx-ripple-saved-width"; 9458var RIPPLE_FIXED_ROW_ATTR = "data-dx-ripple-locked"; 9459var READ_ONLY_COMBOBOX_MARKER_CSS_CLASS = "dxICBReadonlyMarker"; 9460var ThemesWithRipple = ['Material']; 9461var RippleHelper = { 9462 rippleTargetClassName: "dxRippleTarget", 9463 rippleTargetExternalClassName: "dxRippleTargetExternal", 9464 rippleContainerClassName: "dxRippleContainer", 9465 rippleClassName: "dxRipple", 9466 touchRadius: -1, 9467 isMobileExternalRipple: null, 9468 zoom: 1, 9469 Init: function() { 9470 if(this.getIsRippleFunctionalityEnabled()) { 9471 setTimeout(function() { 9472 this.calcTouchRadius(); 9473 }.aspxBind(this), 0); 9474 } 9475 }, 9476 calcTouchRadius: function() { 9477 var testBlock = document.createElement("DIV"); 9478 ASPx.SetStyles(testBlock, { 9479 height: "1in", 9480 width: "1in", 9481 left: "-100%", 9482 top: "-100%", 9483 position: "absolute" 9484 }); 9485 document.body.appendChild(testBlock); 9486 this.touchRadius = (1.8 / 2.54) * Math.max(testBlock.offsetWidth, testBlock.offsetHeight); 9487 document.body.removeChild(testBlock); 9488 }, 9489 isRippleFunctionalityEnabled: null, 9490 checkRippleFunctionality: function() { 9491 if(ASPx.Browser.Safari && ASPx.Browser.Version <= 5.1) 9492 return false; 9493 for(var i = 0; i < ThemesWithRipple.length; i++) { 9494 var firstRippleThemeElement = document.querySelector("[class*='_" + ThemesWithRipple[i] + "']"); 9495 if(firstRippleThemeElement) 9496 return true; 9497 } 9498 return false; 9499 }, 9500 ReInit: function() { 9501 this.isRippleFunctionalityEnabled = null; 9502 this.Init(); 9503 }, 9504 onDocumentMouseDown: function(evt) { 9505 if(RippleHelper.getIsRippleFunctionalityEnabled()) 9506 RippleHelper.processMouseDown(evt); 9507 }, 9508 getIsRippleFunctionalityEnabled: function() { 9509 if(!ASPx.IsExists(this.isRippleFunctionalityEnabled)) 9510 this.isRippleFunctionalityEnabled = this.checkRippleFunctionality(); 9511 return this.isRippleFunctionalityEnabled; 9512 }, 9513 createTargetInfo: function(target) { 9514 return { 9515 x: ASPx.GetAbsoluteX(target), 9516 y: ASPx.GetAbsoluteY(target), 9517 width: target.offsetWidth, 9518 height: target.offsetHeight, 9519 classNames: ASPx.GetClassNameList(target), 9520 getTarget: function() { return target; }, 9521 getRect: function() { return {x: this.x, y: this.y, width: this.width, height: this.height }; } 9522 }; 9523 }, 9524 createEventInfo: function(evt) { 9525 return { x: this.getEventX(evt), y: this.getEventY(evt) }; 9526 }, 9527 processMouseDown: function(evt) { 9528 var evtSource = ASPx.Evt.GetEventSource(evt); 9529 var rippleTarget = this.getRippleTargetElement(evtSource); 9530 if(this.needToProcessRipple(rippleTarget, evtSource)) 9531 this.processRipple(this.createTargetInfo(rippleTarget), this.createEventInfo(evt)); 9532 }, 9533 getRippleTargetElement: function(evtSource) { 9534 if(this.hasRippleMarker(evtSource)) 9535 return evtSource; 9536 if(evtSource.tagName && evtSource.tagName.toLowerCase() == "input" && ASPx.ElementContainsCssClass(evtSource, "dxTI")) { 9537 var elements = ASPx.GetChildElementNodesByPredicate(evtSource.parentNode.parentNode, function(element) { 9538 return this.hasRippleMarker(element); 9539 }.aspxBind(this)); 9540 return elements && elements[0]; 9541 } 9542 return ASPx.GetParent(evtSource, function(element) { 9543 return this.hasRippleMarker(element); 9544 }.aspxBind(this)); 9545 }, 9546 hasRippleMarker: function(element) { 9547 if(!ASPx.IsExistsElement(element)) 9548 return false; 9549 var computedStyles = window.getComputedStyle(element, ":before"); 9550 if(ASPx.IsExists(computedStyles)) { 9551 var content = computedStyles.getPropertyValue("content"); 9552 if(content.indexOf(this.rippleTargetExternalClassName) > -1) { 9553 ASPx.AddClassNameToElement(element, this.rippleTargetExternalClassName); 9554 return true; 9555 } 9556 return content.indexOf(this.rippleTargetClassName) > -1; 9557 } 9558 return false; 9559 }, 9560 needToProcessRipple: function(rippleTarget, evtSource) { 9561 if(!rippleTarget || !ASPx.AnimationUtils) 9562 return false; 9563 var isClearButton = ASPx.ElementContainsCssClass(rippleTarget, "dxeButton") && rippleTarget.id && rippleTarget.id.indexOf("B-100") !== -1; 9564 var isEmptyCalendarDay = ASPx.ElementContainsCssClass(rippleTarget, "dxeCalendarDay") && ASPx.Str.Trim(rippleTarget.textContent) == ""; 9565 var isReadonly = ASPx.ElementContainsCssClass(rippleTarget, READ_ONLY_COMBOBOX_MARKER_CSS_CLASS); 9566 var tempFixDisable = ASPx.ElementContainsCssClass(rippleTarget, "dxSwitcher") && ASPx.Browser.MacOSMobilePlatform; 9567 var rippleIsForbidden = isReadonly || isClearButton || isEmptyCalendarDay || ASPx.GetParentByPartialClassName(rippleTarget, "Disabled") || 9568 ASPx.ElementContainsCssClass(rippleTarget, "dxgvBatchEditCell") || ASPx.ElementContainsCssClass(rippleTarget, "dxcvEditForm") || 9569 ASPx.GetParentByPartialClassName(evtSource, "dxcvFocusedCell") || tempFixDisable; 9570 return !rippleIsForbidden; 9571 }, 9572 hasBothOverflow: function(style) { 9573 return style.overflow == "scroll" || style.overflow == "auto" || style.overflow == "hidden"; 9574 }, 9575 hasOverflowX: function(style) { 9576 return style.overflowX == "scroll" || style.overflowX == "auto" || style.overflowX == "hidden"; 9577 }, 9578 hasOverflowY: function(style) { 9579 return style.overflowY == "scroll" || style.overflowY == "auto" || style.overflowY == "hidden"; 9580 }, 9581 getExternalRippleContainerSize: function(targetRect) { 9582 if(ASPx.Browser.MobileUI) { 9583 var origTouchRadius = this.getOriginTouchRadius(); 9584 if(origTouchRadius < targetRect.width || origTouchRadius < targetRect.height) 9585 origTouchRadius = Math.max(targetRect.width, targetRect.height); 9586 return {x: targetRect.x + (targetRect.width - origTouchRadius) / 2, y: targetRect.y + (targetRect.height - origTouchRadius) / 2, width: origTouchRadius, height: origTouchRadius }; 9587 } 9588 var result = { x: 0, y: 0, width: 0, height: 0 }; 9589 var diff = targetRect.width - targetRect.height; 9590 if(diff > 0) { 9591 result.x = targetRect.x; 9592 result.y = targetRect.y - diff / 2; 9593 result.width = targetRect.width; 9594 result.height = targetRect.width; 9595 } else { 9596 result.x = targetRect.x + diff / 2; 9597 result.y = targetRect.y; 9598 result.width = targetRect.height; 9599 result.height = targetRect.height; 9600 } 9601 return result; 9602 }, 9603 getInternalContainerSize: function(targetInfo) { 9604 var parentWithOverflow = RippleHelper.getParentWithOverflow(targetInfo.getTarget()); 9605 if(!ASPx.IsExists(parentWithOverflow)) 9606 return targetInfo; 9607 var parentWithOverflowStyle = ASPx.GetCurrentStyle(parentWithOverflow); 9608 var bothOverflow = this.hasBothOverflow(parentWithOverflowStyle); 9609 var overflowX = this.hasOverflowX(parentWithOverflowStyle); 9610 var overflowY = this.hasOverflowY(parentWithOverflowStyle); 9611 var parentRect = { 9612 x: ASPx.GetAbsoluteX(parentWithOverflow), 9613 y: ASPx.GetAbsoluteY(parentWithOverflow), 9614 width: parentWithOverflow.offsetWidth, 9615 height: parentWithOverflow.offsetHeight 9616 }; 9617 return this.getInternalContainerSizeCore(targetInfo, parentRect, bothOverflow, overflowX, overflowY); 9618 }, 9619 getInternalContainerSizeCore: function(targetRect, parentRect, bothOverflow, overflowX, overflowY) { 9620 var result = {}; 9621 ASPx.Data.MergeHashTables(result, targetRect); 9622 if(bothOverflow || overflowX) { 9623 result.x = targetRect.x < parentRect.x ? parentRect.x : targetRect.x; 9624 if(targetRect.x + targetRect.width > parentRect.x + parentRect.width) 9625 result.width = parentRect.x + parentRect.width - targetRect.x; 9626 if(parentRect.x > targetRect.x) 9627 result.width -= (parentRect.x - targetRect.x); 9628 } 9629 if(bothOverflow || overflowY) { 9630 result.y = targetRect.y < parentRect.y ? parentRect.y : targetRect.y; 9631 if(targetRect.y + targetRect.height > parentRect.y + parentRect.height) 9632 result.height = parentRect.y + parentRect.height - targetRect.y; 9633 if(parentRect.y > targetRect.y) 9634 result.height -= (parentRect.y - targetRect.y); 9635 } 9636 return result; 9637 }, 9638 calculateRippleContainerSize: function(targetInfo, isExternalRipple) { 9639 return isExternalRipple ? this.getExternalRippleContainerSize(targetInfo) : this.getInternalContainerSize(targetInfo); 9640 }, 9641 getParentWithOverflow: function(rippleTarget) { 9642 var result = ASPx.GetParent(rippleTarget, function(element) { 9643 var elementStyle = ASPx.GetCurrentStyle(element); 9644 return this.hasBothOverflow(elementStyle) || this.hasOverflowX(elementStyle) || this.hasOverflowY(elementStyle); 9645 }.aspxBind(this)); 9646 return result; 9647 }, 9648 getDuration: function(targetInfo) { 9649 return this.IsExternalRipple(targetInfo) || ASPx.Browser.MobileUI ? 650 : 450; 9650 }, 9651 createRippleTransition: function(container, rippleElement, radius, targetInfo) { 9652 var rippleSize = 2 * radius; 9653 var transitionProperties = { 9654 width: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "width", unit: "px" }, 9655 height: { from: 0, to: rippleSize, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "height", unit: "px" }, 9656 marginLeft: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginLeft", unit: "px" }, 9657 marginTop: { from: 0, to: -rippleSize / 2, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "marginTop", unit: "px" }, 9658 opacity: { from: 1, to: 0.05, transition: ASPx.AnimationConstants.Transitions.RIPPLE, propName: "o
9658pacity", unit: "%" } 9659 }; 9660 var rippleTransition = ASPx.AnimationUtils.createMultipleAnimationTransition(rippleElement, { 9661 transition: ASPx.AnimationConstants.Transitions.RIPPLE, 9662 duration: this.getDuration(targetInfo), 9663 needForceTransitionEndByTimerFlag: true, 9664 onComplete: function() { 9665 this.RemoveRippleContainer(container.parentElement); 9666 }.bind(this) 9667 }); 9668 rippleTransition.Start(transitionProperties); 9669 }, 9670 needForceTransitionEndByTimer: function() { return true; }, 9671 calculateRadius: function(isExternalRipple, posX, posY, containerRect) { 9672 var radius = -1; 9673 if(isExternalRipple) { 9674 if(ASPx.Browser.MobileUI) 9675 radius = this.getOriginTouchRadius() / 2; 9676 else 9677 radius = Math.max(containerRect.height, containerRect.width); 9678 } else { 9679 var width1 = posX - containerRect.x; 9680 var width2 = containerRect.width - width1; 9681 var height1 = posY - containerRect.y; 9682 var height2 = containerRect.height - height1; 9683 var rippleWidth = Math.max(width1, width2); 9684 var rippleHeight = Math.max(height1, height2); 9685 radius = Math.sqrt(Math.pow(rippleHeight, 2) + Math.pow(rippleWidth, 2)); 9686 } 9687 return radius; 9688 }, 9689 createRippleElement: function(container, rippleCenter) { 9690 var rippleElement = document.createElement("DIV"); 9691 rippleElement.className = this.rippleClassName; 9692 container.appendChild(rippleElement); 9693 ASPxClientUtils.SetAbsoluteX(rippleElement, rippleCenter.x); 9694 ASPxClientUtils.SetAbsoluteY(rippleElement, rippleCenter.y); 9695 return rippleElement; 9696 }, 9697 processRipple: function(targetInfo, eventInfo) { 9698 this.initRippleProcess(); 9699 var isExternalRipple = this.IsExternalRipple(targetInfo); 9700 var rippleCenter = this.getRippleCenter(targetInfo.getRect(), eventInfo, isExternalRipple); 9701 var container = this.createRippleContainer(targetInfo, isExternalRipple); 9702 var rippleElement = this.createRippleElement(container, rippleCenter); 9703 var radius = this.calculateRadius(isExternalRipple, rippleCenter.x, rippleCenter.y, this.getElementRect(container)); 9704 this.createRippleTransition(container, rippleElement, radius, targetInfo); 9705 }, 9706 initRippleProcess: function() { 9707 this.isMobileExternalRipple = null; 9708 this.zoom = screen.width / window.innerWidth; 9709 }, 9710 getRippleCenter: function(targetInfo, eventInfo, isExternalRipple) { 9711 var posX = 0; 9712 var posY = 0; 9713 if(isExternalRipple) { 9714 posX = targetInfo.x + targetInfo.width / 2; 9715 posY = targetInfo.y + targetInfo.height / 2; 9716 } else { 9717 posX = eventInfo.x; 9718 posY = eventInfo.y; 9719 } 9720 return {x: posX, y: posY}; 9721 }, 9722 createRippleContainer: function(targetInfo, isExternalRipple) { 9723 var containerParent = targetInfo.getTarget(); 9724 if(!containerParent) 9725 return; 9726 var containerTagName = containerParent.tagName == "TR" ? "TD" : "DIV"; 9727 var container = document.createElement(containerTagName); 9728 container.className = this.rippleContainerClassName; 9729 if(containerParent.parentNode && containerParent.tagName == "IMG") 9730 containerParent = containerParent.parentNode; 9731 if(this.isARowInFixedLayoutTable(containerParent)) 9732 this.lockFixedLayoutTableSizes(containerParent); 9733 containerParent.appendChild(container); 9734 if(isExternalRipple) 9735 container.style.borderRadius = "50%"; 9736 var containerRect = this.calculateRippleContainerSize(targetInfo, isExternalRipple); 9737 this.assignContainerSettings(container, containerRect); 9738 return container; 9739 }, 9740 isARowInFixedLayoutTable: function(containerParent) { 9741 if(containerParent.tagName !== "TR") 9742 return false; 9743 var parentTable = this.getParentTable(containerParent); 9744 return parentTable && ASPx.GetCurrentStyle(parentTable)["table-layout"] === "fixed"; 9745 }, 9746 processFirstRowOfFixedTable: function(containerRow, rowAction, cellAction) { 9747 var firstRow = this.getFirstRow(containerRow); 9748 rowAction(firstRow); 9749 var cells = ASPx.Data.CollectionToArray(firstRow.cells); 9750 cells.forEach(cellAction); 9751 }, 9752 getParentTable: function(element) { 9753 var parentTable = element; 9754 while(parentTable && parentTable.tagName !== "TABLE") 9755 parentTable = parentTable.parentElement; 9756 return parentTable; 9757 }, 9758 lockFixedLayoutTableSizes: function(containerRow) { 9759 var firstRow = this.getFirstRow(containerRow); 9760 if(this.incLockCount(firstRow) === 1) { 9761 var cells = ASPx.Data.CollectionToArray(firstRow.cells); 9762 var widths = cells.map(function(cell) { return cell.style.width; }); 9763 var computedWidths = cells.map(function(cell) { 9764 return window.getComputedStyle(cell).width; 9765 }); 9766 var fixWidth = function(cell, i) { 9767 if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR)) 9768 return; 9769 if(widths[i]) 9770 ASPx.Attr.SetAttribute(cell, SAVED_WIDTH_ATTR, widths[i]); 9771 cell.style.width = computedWidths[i]; 9772 };
9773 cells.forEach(fixWidth); 9774 } 9775 }, 9776 unlockFixedLayoutTableSizes: function(containerRow) { 9777 var firstRow = this.getFirstRow(containerRow); 9778 if(this.decLockCount(firstRow) === 0) { 9779 var cells = ASPx.Data.CollectionToArray(firstRow.cells); 9780 var restoreState = function(cell) { 9781 if(ASPx.Attr.IsExistsAttribute(cell, SAVED_WIDTH_ATTR)) { 9782 cell.style.width = ASPx.Attr.GetAttribute(cell, SAVED_WIDTH_ATTR); 9783 ASPx.Attr.RemoveAttribute(cell, SAVED_WIDTH_ATTR); 9784 } else { 9785 cell.style.width = null; 9786 } 9787 }; 9788 cells.forEach(restoreState); 9789 } 9790 }, 9791 getFirstRow: function(containerRow) { return ASPx.GetChildByTagName(containerRow.parentElement, "TR", 0); }, 9792 incLockCount: function(elem) { return this.changeLockCount(elem, 1); }, 9793 decLockCount: function(elem) { return this.changeLockCount(elem, -1); }, 9794 changeLockCount: function(elem, diff) { 9795 var lockCounter = this.getLockCount(elem); 9796 lockCounter += diff; 9797 lockCounter = Math.max(0, lockCounter); 9798 if(lockCounter === 0) 9799 ASPx.Attr.RemoveAttribute(elem, RIPPLE_FIXED_ROW_ATTR); 9800 else 9801 ASPx.Attr.SetAttribute(elem, RIPPLE_FIXED_ROW_ATTR, lockCounter); 9802 return lockCounter; 9803 }, 9804 getLockCount: function(lockElement) { 9805 var attrValue = ASPx.Attr.GetAttribute(lockElement, RIPPLE_FIXED_ROW_ATTR); 9806 return parseInt(attrValue) || 0; 9807 }, 9808 assignContainerSettings: function(container, containerRect) { 9809 var properties = { 9810 height: containerRect.height, 9811 width: containerRect.width, 9812 left: ASPx.PrepareClientPosForElement(containerRect.x, container, true), 9813 top: ASPx.PrepareClientPosForElement(containerRect.y, container, false) 9814 }; 9815 if(ASPx.Browser.MobileUI) 9816 ASPx.Data.MergeHashTables(properties, {marginTop: 0, marginLeft: 0 }); 9817 ASPx.SetStyles(container, properties, ASPx.Browser.MobileUI); 9818 }, 9819 IsExternalRipple: function(targetInfo) { 9820 var hasExternalRippleClassName = ASPx.ElementContainsCssClass(targetInfo.getTarget(), this.rippleTargetExternalClassName); 9821 if(!ASPx.Browser.MobileUI) 9822 return hasExternalRippleClassName; 9823 return hasExternalRippleClassName || this.IsMobileExternalRipple(targetInfo); 9824 }, 9825 IsMobileExternalRipple: function(targetInfo) { 9826 if(this.isMobileExternalRipple == null) { 9827 var originTouchRadius = this.getOriginTouchRadius(); 9828 this.isMobileExternalRipple = ASPx.Browser.MobileUI && targetInfo.width < originTouchRadius && targetInfo.height < originTouchRadius; 9829 } 9830 return this.isMobileExternalRipple; 9831 }, 9832 RemoveRippleContainer: function(element) { 9833 if(!element) 9834 return; 9835 var childs = ASPx.GetChildNodesByClassName(element, this.rippleContainerClassName); 9836 var rippleContainer = childs.length > 0 ? childs[0] : null; 9837 if(rippleContainer != null) { 9838 var containerParent = rippleContainer.parentNode; 9839 containerParent.removeChild(rippleContainer); 9840 if(this.isARowInFixedLayoutTable(containerParent)) 9841 this.unlockFixedLayoutTableSizes(containerParent); 9842 } 9843 }, 9844 getEventX: function(evt) { 9845 return ASPxClientUtils.GetEventX(evt); 9846 }, 9847 getEventY: function(evt) { 9848 return ASPxClientUtils.GetEventY(evt); 9849 }, 9850 getOriginTouchRadius: function() { 9851 return this.touchRadius / this.zoom; 9852 }, 9853 getElementRect: function(element) { 9854 return { x: ASPx.GetAbsoluteX(element), y: ASPx.GetAbsoluteY(element), width: element.offsetWidth, height: element.offsetHeight }; 9855 } 9856}; 9857var AccessibilitySR = { 9858 AddStringResources: function(stringResourcesObj) { 9859 if(stringResourcesObj) { 9860 for(var key in stringResourcesObj) 9861 if(stringResourcesObj.hasOwnProperty(key)) 9862 this[key] = stringResourcesObj[key]; 9863 } 9864 } 9865}; 9866ASPx.OrderedMap = OrderedMap; 9867ASPx.CollectionBase = CollectionBase; 9868ASPx.FunctionIsInCallstack = _aspxFunctionIsInCallstack; 9869ASPx.RaisePostHandlerOnPost = aspxRaisePostHandlerOnPost; 9870ASPx.GetPostHandler = aspxGetPostHandler; 9871ASPx.ProcessScriptsAndLinks = _aspxProcessScriptsAndLinks; 9872ASPx.InitializeLinks = _aspxInitializeLinks; 9873ASPx.InitializeScripts = _aspxInitializeScripts; 9874ASPx.RunStartupScripts = _aspxRunStartupScripts; 9875ASPx.IsStartupScriptsRunning = _aspxIsStartupScriptsRunning; 9876ASPx.AddScriptsRestartHandler = _aspxAddScriptsRestartHandler; 9877ASPx.GetFocusedElement = _aspxGetFocusedElement; 9878ASPx.GetDomObserver = _aspxGetDomObserver;
9879ASPx.CacheHelper = CacheHelper; 9880ASPx.ControlTree = ControlTree; 9881ASPx.ControlAdjuster = ControlAdjuster; 9882ASPx.GetControlAdjuster = GetControlAdjuster; 9883ASPx.ControlCallbackHandlersQueue = ControlCallbackHandlersQueue; 9884ASPx.ResourceManager = ResourceManager; 9885ASPx.UpdateWatcherHelper = UpdateWatcherHelper; 9886ASPx.EventStorage = EventStorage; 9887ASPx.GetGlobalObject = GetGlobalObject; 9888ASPx.GetExternalScriptProcessor = GetExternalScriptProcessor; 9889ASPx.CheckBoxCheckState = CheckBoxCheckState; 9890ASPx.CheckBoxInputKey = CheckBoxInputKey; 9891ASPx.CheckableElementStateController = CheckableElementStateController; 9892ASPx.CheckableElementHelper = CheckableElementHelper; 9893ASPx.CheckBoxInternal = CheckBoxInternal; 9894ASPx.CheckBoxInternalCollection = CheckBoxInternalCollection; 9895ASPx.ControlCallbackQueueHelper = ControlCallbackQueueHelper; 9896ASPx.FocusedStyleDecoration = FocusedStyleDecoration; 9897ASPx.EditorStyleDecoration = EditorStyleDecoration; 9898ASPx.TextEditorStyleDecoration = TextEditorStyleDecoration; 9899ASPx.AccessibilitySR = AccessibilitySR; 9900ASPx.KbdHelper = KbdHelper; 9901ASPx.AccessKeysHelper = AccessKeysHelper; 9902ASPx.AccessKey = AccessKey; 9903ASPx.IFrameHelper = IFrameHelper; 9904ASPx.Ident = Ident; 9905ASPx.TouchUIHelper = TouchUIHelper; 9906ASPx.ControlUpdateWatcher = ControlUpdateWatcher; 9907ASPx.ControlTabIndexManager = ControlTabIndexManager; 9908ASPx.AccessibilityHelperBase = AccessibilityHelperBase; 9909ASPx.AccessibilityHelper = AccessibilityHelper; 9910ASPx.RippleHelper = RippleHelper; 9911ASPx.ThemesWithRipple = ThemesWithRipple; 9912window.ASPxClientEvent = ASPxClientEvent; 9913window.ASPxClientEventArgs = ASPxClientEventArgs; 9914window.ASPxClientCancelEventArgs = ASPxClientCancelEventArgs; 9915window.ASPxClientProcessingModeEventArgs = ASPxClientProcessingModeEventArgs; 9916window.ASPxClientProcessingModeCancelEventArgs = ASPxClientProcessingModeCancelEventArgs; 9917ASPx.Evt.AttachEventToDocument(TouchUIHelper.touchMouseDownEventName, RippleHelper.onDocumentMouseDown); 9918ASPx.classesScriptParsed = true; 9919})(ASPx, { GCCheckInterval: 5000 }); 9920 9921(function () { 9922 IntersectionObserversManager = ASPx.CreateClass(null, { 9923 constructor: function() { 9924 this.rootElementToObserverMap = this.createMap(); 9925 this.elementToHandlerMap = this.createMap(); 9926 this.clearInvalidElementsInterval = null; 9927 this.clearInvalidElementsPeriod = 5000; 9928 }, 9929 AddTargetElement: function(element, rootElement, visibilityChangedHandler) { 9930 this.addTargetElementCore(element, rootElement, visibilityChangedHandler); 9931 }, 9932 SubscribeElemensVisibilityChangeInBrowserWindow: function (element, visibilityChangedHandler) { 9933 this.addTargetElementCore(element, null, visibilityChangedHandler); 9934 }, 9935 createMap: function() { 9936 return new Map(); 9937 }, 9938 getObserver: function() { 9939 return IntersectionObserver; 9940 }, 9941 initializeObserver: function(rootElement) { 9942 if(!this.rootElementToObserverMap.get(rootElement)) { 9943 var options = { 9944 root: rootElement, 9945 rootMargin: '-1px', 9946 threshold: 0.0 9947 }; 9948 var observerClass = this.getObserver(); 9949 var observer = new observerClass(this.visibilityChanged.bind(this), options); 9950 this.rootElementToObserverMap.set(rootElement, observer); 9951 } 9952 }, 9953 addTargetElementCore: function(element, rootElement, visibilityChangedHandler) { 9954 this.initializeObserver(rootElement); 9955 if(!this.isAlreadyObserved(element)) { 9956 var observer = this.rootElementToObserverMap.get(rootElement); 9957 if(observer) { 9958 observer.observe(element); 9959 this.setObservedMarker(element); 9960 this.setElementVisibilityChangedHandler(element, visibilityChangedHandler, observer); 9961 if(this.clearInvalidElementsInterval === null) { 9962 this.clearInvalidElementsInterval = setInterval(this.removeDeletedElements.bind(this), this.clearInvalidElementsPeriod); 9963 } 9964 } 9965 } 9966 }, 9967 visibilityChanged: function(entries, observer) { 9968 entries.forEach(function (entry) { 9969 if(ASPx.IsExistsElement(entry.target)){ 9970 var element = this.elementToHandlerMap.get(observer); 9971 if(element) { 9972 var handler = element.get(entry.target); 9973 if(handler) 9974 handler(entry.isIntersecting); 9975 } 9976 } 9977 }.bind(this)); 9978 }, 9979 removeDeletedElements: function() {
9980 this.elementToHandlerMap.forEach(function(elements, observer) { 9981 elements.forEach(function(handler, element) { 9982 if(!ASPx.IsExistsElement(element)) { 9983 elements.delete(element); 9984 } 9985 }.bind(this)); 9986 if(elements.size === 0) { 9987 this.elementToHandlerMap.delete(observer); 9988 } 9989 }.bind(this)); 9990 if(this.elementToHandlerMap.size === 0) { 9991 clearInterval(this.clearInvalidElementsInterval); 9992 this.clearInvalidElementsInterval = null; 9993 } 9994 }, 9995 setElementVisibilityChangedHandler: function(element, visibilityChangedHandler, observer) { 9996 if(!this.elementToHandlerMap.get(observer)) 9997 this.elementToHandlerMap.set(observer, this.createMap()); 9998 var el = this.elementToHandlerMap.get(observer); 9999 if(el) 10000 el.set(element, visibilityChangedHandler); 10001 }, 10002 isAlreadyObserved: function(element) { 10003 return !!element.dxObserved; 10004 }, 10005 setObservedMarker: function(element) { 10006 element.dxObserved = true; 10007 }, 10008 reset: function() { 10009 this.rootElementToObserverMap.forEach(function(observer, rootElement) { 10010 observer.disconnect(); 10011 }.bind(this)); 10012 this.rootElementToObserverMap = this.createMap(); 10013 this.elementToHandlerMap = this.createMap(); 10014 this.clearInvalidElementsInterval = null; 10015 this.clearInvalidElementsPeriod = 5000; 10016 } 10017 }); 10018 IntersectionObserversManagerForOldBrowsers = ASPx.CreateClass(null, { 10019 SubscribeElemensVisibilityChangeInBrowserWindow: function() { } 10020 }); 10021 ASPx.IntersectionObserversManager = ASPx.IntersectionObserversManager || ((typeof(IntersectionObserver) !== "undefined") ? new IntersectionObserversManager() : new IntersectionObserversManagerForOldBrowsers()); 10022} 10023)(ASPx); 10024 10025(function () { 10026ASPx.StateItemsExist = false; 10027ASPx.FocusedItemKind = "FocusedStateItem"; 10028ASPx.HoverItemKind = "HoverStateItem"; 10029ASPx.PressedItemKind = "PressedStateItem"; 10030ASPx.SelectedItemKind = "SelectedStateItem"; 10031ASPx.DisabledItemKind = "DisabledStateItem"; 10032ASPx.ReadOnlyItemKind = "ReadOnlyStateItem"; 10033ASPx.CachedStatePrefix = "cached"; 10034ASPxStateItem = ASPx.CreateClass(null, { 10035 constructor: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink){ 10036 this.name = name; 10037 this.classNames = classNames; 10038 this.customClassNames = []; 10039 this.resultClassNames = []; 10040 this.cssTexts = cssTexts; 10041 this.postfixes = postfixes; 10042 this.imageObjs = imageObjs; 10043 this.imagePostfixes = imagePostfixes; 10044 this.kind = kind; 10045 this.classNamePostfix = kind.substr(0, 1).toLowerCase(); 10046 this.enabled = true; 10047 this.needRefreshBetweenElements = false; 10048 this.elements = null; 10049 this.images = null; 10050 this.links = []; 10051 this.colorChanged = []; 10052 this.textDecorationChanged = []; 10053 this.disableApplyingStyleToLink = !!disableApplyingStyleToLink; 10054 }, 10055 GetCssText: function(index){ 10056 if(ASPx.IsExists(this.cssTexts[index])) 10057 return this.cssTexts[index]; 10058 return this.cssTexts[0]; 10059 }, 10060 CreateStyleRule: function(index){ 10061 if(this.GetCssText(index) == "") return ""; 10062 var styleSheet = ASPx.GetCurrentStyleSheet(); 10063 if(styleSheet) 10064 return ASPx.CreateImportantStyleRule(styleSheet, this.GetCssText(index), this.classNamePostfix); 10065 return ""; 10066 }, 10067 GetClassName: function(index){ 10068 if(ASPx.IsExists(this.classNames[index])) 10069 return this.classNames[index]; 10070 return this.classNames[0]; 10071 }, 10072 GetResultClassName: function(index){ 10073 if(!ASPx.IsExists(this.resultClassNames[index])) { 10074 if(!ASPx.IsExists(this.customClassNames[index])) 10075 this.customClassNames[index] = this.CreateStyleRule(index); 10076 if(this.GetClassName(index) != "" && this.customClassNames[index] != "") 10077 this.resultClassNames[index] = this.GetClassName(index) + " " + this.customClassNames[index]; 10078 else if(this.GetClassName(index) != "") 10079 this.resultClassNames[index] = this.GetClassName(index); 10080 else if(this.customClassNames[index] != "") 10081 this.resultClassNames[index] = this.customClassNames[index]; 10082 else 10083 this.resultClassNames[index] = ""; 10084 } 10085 return this.resultClassNames[index]; 10086 }, 10087 GetElements: function(element){ 10088 if(!this.elements || !ASPx.IsValidElements(this.elements)){ 10089 if(this.postfixes && this.postfixes.length > 0){ 10090 this.elements = [ ]; 10091 var parentNode = element.parentNode; 10092 if(parentNode){
10093 for(var i = 0; i < this.postfixes.length; i++){ 10094 var id = this.name + this.postfixes[i]; 10095 this.elements[i] = ASPx.GetChildById(parentNode, id); 10096 if(!this.elements[i]) 10097 this.elements[i] = ASPx.GetElementById(id); 10098 } 10099 } 10100 } 10101 else 10102 this.elements = [element]; 10103 } 10104 return this.elements; 10105 }, 10106 GetImages: function(element){ 10107 if(!this.images || !ASPx.IsValidElements(this.images)){ 10108 this.images = [ ]; 10109 if(this.imagePostfixes && this.imagePostfixes.length > 0){ 10110 var elements = this.GetElements(element); 10111 for(var i = 0; i < this.imagePostfixes.length; i++){ 10112 var id = this.name + this.imagePostfixes[i]; 10113 for(var j = 0; j < elements.length; j++){ 10114 if(!elements[j]) continue; 10115 if(elements[j].id == id) 10116 this.images[i] = elements[j]; 10117 else 10118 this.images[i] = ASPx.GetChildById(elements[j], id); 10119 if(this.images[i]) 10120 break; 10121 } 10122 } 10123 } 10124 } 10125 return this.images; 10126 }, 10127 Apply: function(element){ 10128 if(!this.enabled) return; 10129 try{ 10130 this.ApplyStyle(element); 10131 if(this.imageObjs && this.imageObjs.length > 0) 10132 this.ApplyImage(element); 10133 } 10134 catch(e){ 10135 } 10136 }, 10137 ApplyStyle: function(element){ 10138 var elements = this.GetElements(element); 10139 for(var i = 0; i < elements.length; i++){ 10140 if(!elements[i]) continue; 10141 var elementColor, elementTextDecoration; 10142 if(this.colorChanged[i] === undefined) { 10143 elementColor = window.getComputedStyle(elements[i]).color; 10144 } 10145 if(this.textDecorationChanged[i] === undefined) { 10146 elementTextDecoration = window.getComputedStyle(elements[i]).textDecoration; 10147 } 10148 if(this.GetResultClassName(i) != "") { 10149 var className = elements[i].className.replace(this.GetResultClassName(i), ""); 10150 elements[i].className = ASPx.Str.Trim(className) + " " + this.GetResultClassName(i); 10151 } 10152 if(this.colorChanged[i] === undefined) { 10153 this.colorChanged[i] = window.getComputedStyle(elements[i]).color !== elementColor; 10154 } 10155 if(this.textDecorationChanged[i] === undefined) { 10156 this.textDecorationChanged[i] = window.getComputedStyle(elements[i]).textDecoration !== elementTextDecoration; 10157 } 10158 if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9) 10159 this.ApplyStyleToLinks(elements, i); 10160 } 10161 }, 10162 ApplyStyleToLinks: function(elements, index){ 10163 if(this.disableApplyingStyleToLink) 10164 return; 10165 if(!ASPx.IsValidElements(this.links[index])) 10166 this.links[index] = ASPx.GetNodesByTagName(elements[index], "A"); 10167 for(var i = 0; i < this.links[index].length; i++) 10168 this.ApplyStyleToLinkElement(this.links[index][i], index); 10169 }, 10170 ApplyStyleToLinkElement: function(link, index) { 10171 if(this.colorChanged[index]) 10172 ASPx.Attr.ChangeAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color", "inherit"); 10173 if(this.textDecorationChanged[index]) 10174 ASPx.Attr.ChangeAttributeExtended(link.style, "text-decoration", link, "saved" + this.kind + "TextDecoration", "inherit"); 10175 }, 10176 ApplyImage: function(element){ 10177 var images = this.GetImages(element); 10178 for(var i = 0; i < images.length; i++){ 10179 if(!images[i] || !this.imageObjs[i]) continue; 10180 var useSpriteImage = typeof(this.imageObjs[i]) != "string"; 10181 var newUrl = "", newCssClass = "", newBackground = ""; 10182 if(useSpriteImage){ 10183 newUrl = ASPx.EmptyImageUrl; 10184 if(this.imageObjs[i].spriteCssClass) 10185 newCssClass = this.imageObjs[i].spriteCssClass;
10186 if(this.imageObjs[i].spriteBackground) 10187 newBackground = this.imageObjs[i].spriteBackground; 10188 } 10189 else{ 10190 newUrl = this.imageObjs[i]; 10191 if(ASPx.Attr.IsExistsAttribute(images[i].style, "background")) 10192 newBackground = " "; 10193 } 10194 if(newUrl != "") 10195 ASPx.Attr.ChangeAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src", newUrl); 10196 if(newCssClass != "") 10197 this.ApplyImageClassName(images[i], newCssClass); 10198 if(newBackground != ""){ 10199 if(ASPx.Browser.WebKitFamily) { 10200 var savedBackground = ASPx.Attr.GetAttribute(images[i].style, "background"); 10201 if(!useSpriteImage) 10202 savedBackground += " " + images[i].style["backgroundPosition"]; 10203 ASPx.Attr.SetAttribute(images[i], "saved" + this.kind + "Background", savedBackground); 10204 ASPx.Attr.SetAttribute(images[i].style, "background", newBackground); 10205 } 10206 else 10207 ASPx.Attr.ChangeAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background", newBackground); 10208 } 10209 } 10210 }, 10211 ApplyImageClassName: function(element, newClassName){ 10212 if(ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName")) 10213 this.CancelImageClassName(element); 10214 var className = element.className; 10215 ASPx.Attr.SetAttribute(element, "saved" + this.kind + "ClassName", className); 10216 element.className = className + " " + newClassName; 10217 }, 10218 Cancel: function(element){ 10219 if(!this.enabled) return; 10220 try{ 10221 if(this.imageObjs && this.imageObjs.length > 0) 10222 this.CancelImage(element); 10223 this.CancelStyle(element); 10224 } 10225 catch(e){ 10226 } 10227 }, 10228 CancelStyle: function(element){ 10229 var elements = this.GetElements(element); 10230 for(var i = 0; i < elements.length; i++){ 10231 if(!elements[i]) continue; 10232 if(this.GetResultClassName(i) != "") { 10233 var className = ASPx.Str.Trim(elements[i].className.replace(this.GetResultClassName(i), "")); 10234 elements[i].className = className; 10235 } 10236 if(!ASPx.Browser.Opera || ASPx.Browser.Version >= 9) 10237 this.CancelStyleFromLinks(elements, i); 10238 } 10239 }, 10240 CancelStyleFromLinks: function(elements, index){ 10241 if(this.disableApplyingStyleToLink) 10242 return; 10243 if(!ASPx.IsValidElements(this.links[index])) 10244 this.links[index] = ASPx.GetNodesByTagName(elements[index], "A"); 10245 for(var i = 0; i < this.links[index].length; i++) 10246 this.CancelStyleFromLinkElement(this.links[index][i], index); 10247 }, 10248 CancelStyleFromLinkElement: function(link, index){ 10249 ASPx.Attr.RestoreAttributeExtended(link.style, "color", link, "saved" + this.kind + "Color"); 10250 ASPx.Attr.RestoreAttributeExtended(link.style, "text-decoration", link, "saved" + this.kind + "TextDecoration"); 10251 }, 10252 CancelImage: function(element){ 10253 var images = this.GetImages(element); 10254 for(var i = 0; i < images.length; i++){ 10255 if(!images[i] || !this.imageObjs[i]) continue; 10256 ASPx.Attr.RestoreAttributeExtended(images[i], "src", images[i], "saved" + this.kind + "Src"); 10257 this.CancelImageClassName(images[i]); 10258 ASPx.Attr.RestoreAttributeExtended(images[i].style, "background", images[i], "saved" + this.kind + "Background"); 10259 } 10260 }, 10261 CancelImageClassName: function(element){ 10262 var savedClassName = ASPx.Attr.GetAttribute(element, "saved" + this.kind + "ClassName"); 10263 if(ASPx.IsExists(savedClassName)) { 10264 element.className = savedClassName; 10265 ASPx.Attr.RemoveAttribute(element, "saved" + this.kind + "ClassName"); 10266 } 10267 }, 10268 Clone: function(){ 10269 return new ASPxStateItem(this.name, this.classNames, this.cssTexts, this.postfixes, 10270 this.imageObjs, this.imagePostfixes, this.kind, this.disableApplyingStyleToLink); 10271 }, 10272 IsChildElement: function(element){ 10273 if(element != null){ 10274 var elements = this.GetElements(element); 10275 for(var i = 0; i < elements.length; i++){ 10276 if(!elements[i]) continue; 10277 if(ASPx.GetIsParent(elements[i], element)) 10278 return true; 10279 } 10280 } 10281 return false; 10282 }, 10283 ForceRedrawAppearance: function(element) { 10284 if(!aspxGetStateController().IsForceRedrawAppearanceLocked()) { 10285 var value = element.style.opacity; 10286 element.style.opacity = "0.7777"; 10287 var dummy = element.offsetWidth; 10288 element.style.opacity = value; 10289 } 10290 } 10291}); 10292ASPxClientStateEventArgs = ASPx.CreateClass(null, { 10293 constructor: function(item, element){ 10294 this.item = item; 10295 this.element = element; 10296 this.toElement = null; 10297 this.fromElement = null; 10298 this.htmlEvent = null; 10299 } 10300}); 10301ASPxStateController = ASPx.CreateClass(null, { 10302 constructor: function(){ 10303 this.focusedItems = { }; 10304 this.hoverItems = { }; 10305 this.pressedItems = { }; 10306 this.selectedItems = { }; 10307 this.disabledItems = {}; 10308 this.readOnlyItems = {}; 10309 this.disabledScheme = {}; 10310 this.currentFocusedElement = null; 10311 this.currentFocusedItemName = null; 10312 this.currentHoverElement = null; 10313 this.currentHoverItemName = null; 10314 this.currentPressedElement = null; 10315 this.currentPressedItemName = null; 10316 this.savedCurrentPressedElement = null; 10317 this.savedCurrentMouseMoveSrcElement = null; 10318 this.forceRedrawAppearanceLockCount = 0; 10319 this.stateItemType = ASPxStateItem; 10320 this.AfterSetFocusedState = new ASPxClientEvent(); 10321 this.AfterClearFocusedState = new ASPxClientEvent(); 10322 this.AfterSetHoverState = new ASPxClientEvent(); 10323 this.AfterClearHoverState = new ASPxClientEvent(); 10324 this.AfterSetPressedState = new ASPxClientEvent(); 10325 this.AfterClearPressedState = new ASPxClientEvent(); 10326 this.AfterDisabled = new ASPxClientEvent(); 10327 this.AfterEnabled = new ASPxClientEvent(); 10328 this.BeforeSetFocusedState = new ASPxClientEvent(); 10329 this.BeforeClearFocusedState = new ASPxClientEvent(); 10330 this.BeforeSetHoverState = new ASPxClientEvent(); 10331 this.BeforeClearHoverState = new ASPxClientEvent(); 10332 this.BeforeSetPressedState = new ASPxClientEvent(); 10333 this.BeforeClearPressedState = new ASPxClientEvent(); 10334 this.BeforeDisabled = new ASPxClientEvent(); 10335 this.BeforeEnabled = new ASPxClientEvent(); 10336 this.FocusedItemKeyDown = new ASPxClientEvent(); 10337 }, 10338 AddHoverItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){ 10339 this.AddItem(this.hoverItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.HoverItemKind, disableApplyingStyleToLink); 10340 this.AddItem(this.focusedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.FocusedItemKind, disableApplyingStyleToLink); 10341 }, 10342 AddPressedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){ 10343 this.AddItem(this.pressedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.PressedItemKind, disableApplyingStyleToLink); 10344 }, 10345 AddSelectedItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink){ 10346 this.AddItem(this.selectedItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.SelectedItemKind, disableApplyingStyleToLink); 10347 }, 10348 AddDisabledItem: function (name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, rootId) { 10349 this.AddItem(this.disabledItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, 10350 ASPx.DisabledItemKind, disableApplyingStyleToLink, this.addIdToDisabledItemScheme, rootId); 10351 }, 10352 AddReadOnlyItem: function(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink) { 10353 this.AddItem(this.readOnlyItems, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, ASPx.ReadOnlyItemKind, disableApplyingStyleToLink); 10354 }, 10355 addIdToDisabledItemScheme: function(rootId, childId) { 10356 if (!rootId) 10357 return; 10358 if (!this.disabledScheme[rootId]) 10359 this.disabledScheme[rootId] = [rootId];
10360 if (childId && (rootId != childId) && ASPx.Data.ArrayIndexOf(this.disabledScheme[rootId], childId) == -1) 10361 this.disabledScheme[rootId].push(childId); 10362 }, 10363 removeIdFromDisabledItemScheme: function(rootId, childId) { 10364 if (!rootId || !this.disabledScheme[rootId]) 10365 return; 10366 ASPx.Data.ArrayRemove(this.disabledScheme[rootId], childId); 10367 if (this.disabledScheme[rootId].length == 0) 10368 delete this.disabledScheme[rootId]; 10369 }, 10370 AddItem: function (items, name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink, onAdd, rootId) { 10371 var type = this.getStateItemType(); 10372 var stateItem = new type(name, classNames, cssTexts, postfixes, imageObjs, imagePostfixes, kind, disableApplyingStyleToLink); 10373 if (postfixes && postfixes.length > 0) { 10374 for (var i = 0; i < postfixes.length; i++) { 10375 items[name + postfixes[i]] = stateItem; 10376 if (onAdd) 10377 onAdd.call(this, rootId, name + postfixes[i]); 10378 } 10379 } 10380 else { 10381 if (onAdd) 10382 onAdd.call(this, rootId, name); 10383 items[name] = stateItem; 10384 } 10385 ASPx.StateItemsExist = true; 10386 }, 10387 getStateItemType: function () { return this.stateItemType; }, 10388 withCustomStateItemType: function (newType, callback) { 10389 this.stateItemType = newType; 10390 callback(this); 10391 this.stateItemType = ASPxStateItem; 10392 }, 10393 RemoveHoverItem: function(name, postfixes){ 10394 this.RemoveItem(this.hoverItems, name, postfixes); 10395 this.RemoveItem(this.focusedItems, name, postfixes); 10396 }, 10397 RemovePressedItem: function(name, postfixes){ 10398 this.RemoveItem(this.pressedItems, name, postfixes); 10399 }, 10400 RemoveSelectedItem: function(name, postfixes){ 10401 this.RemoveItem(this.selectedItems, name, postfixes); 10402 }, 10403 RemoveDisabledItem: function (name, postfixes, rootId) { 10404 this.RemoveItem(this.disabledItems, name, postfixes, this.removeIdFromDisabledItemScheme, rootId); 10405 }, 10406 RemoveReadOnlyItem: function(name, postfixes) { 10407 this.RemoveItem(this.readOnlyItems, name, postfixes); 10408 }, 10409 RemoveItem: function (items, name, postfixes, onRemove, rootId) { 10410 if (postfixes && postfixes.length > 0) { 10411 for (var i = 0; i < postfixes.length; i++) { 10412 delete items[name + postfixes[i]]; 10413 if (onRemove) 10414 onRemove.call(this, rootId, name + postfixes[i]); 10415 } 10416 } 10417 else { 10418 delete items[name]; 10419 if (onRemove) 10420 onRemove.call(this, rootId, name); 10421 } 10422 }, 10423 RemoveDisposedItems: function(){ 10424 this.RemoveDisposedItemsByType(this.hoverItems); 10425 this.RemoveDisposedItemsByType(this.pressedItems); 10426 this.RemoveDisposedItemsByType(this.focusedItems); 10427 this.RemoveDisposedItemsByType(this.selectedItems); 10428 this.RemoveDisposedItemsByType(this.disabledItems); 10429 this.RemoveDisposedItemsByType(this.disabledScheme); 10430 this.RemoveDisposedItemsByType(this.readOnlyItems); 10431 }, 10432 RemoveDisposedItemsByType: function(items){ 10433 for(var key in items) { 10434 if(items.hasOwnProperty(key)) { 10435 var item = items[key]; 10436 var element = document.getElementById(key); 10437 if(!element || !ASPx.IsValidElement(element)) 10438 delete items[key]; 10439 try { 10440 if(item && item.elements) { 10441 for(var i = 0; i < item.elements.length; i++) { 10442 if(!ASPx.IsValidElements(item.links[i])) 10443 item.links[i] = null; 10444 } 10445 } 10446 } 10447 catch(e) { 10448 } 10449 } 10450 } 10451 }, 10452 GetFocusedElement: function(srcElement){ 10453 return this.GetItemElement(srcElement, this.focusedItems, ASPx.FocusedItemKind); 10454 }, 10455 GetHoverElement: function(srcElement){ 10456 return this.GetItemElement(srcElement, this.hoverItems, ASPx.HoverItemKind); 10457 }, 10458 GetPressedElement: function(srcElement){ 10459 return this.GetItemElement(srcElement, this.pressedItems, ASPx.PressedItemKind); 10460 }, 10461 GetSelectedElement: function(srcElement){ 10462 return this.GetItemElement(srcElement, this.selectedItems, ASPx.SelectedItemKind); 10463 }, 10464 GetDisabledElement: function(srcElement){ 10465 return this.GetItemElement(srcElement, this.disabledItems, ASPx.DisabledItemKind); 10466 }, 10467 GetReadOnlyElement: function(srcElement) { 10468 return this.GetItemElement(srcElement, this.readOnlyItems, ASPx.ReadOnlyItemKind); 10469 }, 10470 GetItemElement: function(srcElement, items, kind){ 10471 if(srcElement && srcElement[ASPx.CachedStatePrefix + kind]){ 10472 var cachedElement = srcElement[ASPx.CachedStatePrefix + kind]; 10473 if(cachedElement != ASPx.EmptyObject) 10474 return cachedElement; 10475 return null; 10476 } 10477 var element = srcElement; 10478 while(element != null) {
10479 var item = items[element.id]; 10480 if(item){ 10481 this.CacheItemElement(srcElement, kind, element); 10482 element[kind] = item; 10483 return element; 10484 } 10485 element = element.parentNode; 10486 } 10487 this.CacheItemElement(srcElement, kind, ASPx.EmptyObject); 10488 return null; 10489 }, 10490 CacheItemElement: function(srcElement, kind, value){ 10491 if(srcElement && !srcElement[ASPx.CachedStatePrefix + kind]) 10492 srcElement[ASPx.CachedStatePrefix + kind] = value; 10493 }, 10494 DoSetFocusedState: function(element, fromElement){ 10495 var item = element[ASPx.FocusedItemKind]; 10496 if(item){ 10497 var args = new ASPxClientStateEventArgs(item, element); 10498 args.fromElement = fromElement; 10499 this.BeforeSetFocusedState.FireEvent(this, args); 10500 item.Apply(element); 10501 this.AfterSetFocusedState.FireEvent(this, args); 10502 } 10503 }, 10504 DoClearFocusedState: function(element, toElement){ 10505 var item = element[ASPx.FocusedItemKind]; 10506 if(item){ 10507 var args = new ASPxClientStateEventArgs(item, element); 10508 args.toElement = toElement; 10509 this.BeforeClearFocusedState.FireEvent(this, args); 10510 item.Cancel(element); 10511 this.AfterClearFocusedState.FireEvent(this, args); 10512 } 10513 }, 10514 DoSetHoverState: function(element, fromElement){ 10515 var item = element[ASPx.HoverItemKind]; 10516 if(item){ 10517 var args = new ASPxClientStateEventArgs(item, element); 10518 args.fromElement = fromElement; 10519 this.BeforeSetHoverState.FireEvent(this, args); 10520 item.Apply(element); 10521 this.AfterSetHoverState.FireEvent(this, args); 10522 } 10523 }, 10524 DoClearHoverState: function(element, toElement){ 10525 var item = element[ASPx.HoverItemKind]; 10526 if(item){ 10527 var args = new ASPxClientStateEventArgs(item, element); 10528 args.toElement = toElement; 10529 this.BeforeClearHoverState.FireEvent(this, args); 10530 item.Cancel(element); 10531 this.AfterClearHoverState.FireEvent(this, args); 10532 } 10533 }, 10534 DoSetPressedState: function(element){ 10535 var item = element[ASPx.PressedItemKind]; 10536 if(item){ 10537 var args = new ASPxClientStateEventArgs(item, element); 10538 this.BeforeSetPressedState.FireEvent(this, args); 10539 item.Apply(element); 10540 this.AfterSetPressedState.FireEvent(this, args); 10541 } 10542 }, 10543 DoClearPressedState: function(element){ 10544 var item = element[ASPx.PressedItemKind]; 10545 if(item){ 10546 var args = new ASPxClientStateEventArgs(item, element); 10547 this.BeforeClearPressedState.FireEvent(this, args); 10548 item.Cancel(element); 10549 this.AfterClearPressedState.FireEvent(this, args); 10550 } 10551 }, 10552 SetCurrentFocusedElement: function(element){ 10553 if(this.currentFocusedElement && !ASPx.IsValidElement(this.currentFocusedElement)){ 10554 this.currentFocusedElement = null; 10555 this.currentFocusedItemName = ""; 10556 } 10557 if(this.currentFocusedElement != element){ 10558 var oldCurrentFocusedElement = this.currentFocusedElement; 10559 var item = (element != null) ? element[ASPx.FocusedItemKind] : null; 10560 var itemName = (item != null) ? item.name : ""; 10561 if(this.currentFocusedItemName != itemName){ 10562 if(this.currentHoverItemName != "") 10563 this.SetCurrentHoverElement(null); 10564 if(this.currentFocusedElement != null) 10565 this.DoClearFocusedState(this.currentFocusedElement, element); 10566 this.currentFocusedElement = element; 10567 item = (element != null) ? element[ASPx.FocusedItemKind] : null; 10568 this.currentFocusedItemName = (item != null) ? item.name : ""; 10569 if(this.currentFocusedElement != null) 10570 this.DoSetFocusedState(this.currentFocusedElement, oldCurrentFocusedElement); 10571 } 10572 } 10573 }, 10574 GetCurrentHoverElement: function() { 10575 return this.currentHoverElement; 10576 }, 10577 SetCurrentHoverElement: function(element){ 10578 if(this.currentHoverElement && !ASPx.IsValidElement(this.currentHoverElement)){ 10579 this.currentHoverElement = null; 10580 this.currentHoverItemName = ""; 10581 } 10582 var item = (element != null) ? element[ASPx.HoverItemKind] : null; 10583 if(item && !item.enabled) { 10584 element = this.GetItemElement(element.parentNode, this.hoverItems, ASPx.HoverItemKind); 10585 item = (element != null) ? element[ASPx.HoverItemKind] : null; 10586 } 10587 if(this.currentHoverElement != element){ 10588 var oldCurrentHoverElement = this.currentHoverElement, 10589 itemName = (item != null) ? item.name : ""; 10590 if(this.currentHoverItemName != itemName || (item != null && item.needRefreshBetweenElements)){ 10591 if(this.currentHoverElement != null) 10592 this.DoClearHoverState(this.currentHoverElement, element); 10593 item = (element != null) ? element[ASPx.HoverItemKind] : null; 10594 if(item == null || item.enabled){ 10595 this.currentHoverElement = element; 10596 this.currentHoverItemName = (item != null) ? item.name : ""; 10597 if(this.currentHoverElement != null) 10598 this.DoSetHoverState(this.currentHoverElement, oldCurrentHoverElement); 10599 } 10600 } 10601 } 10602 }, 10603 SetCurrentPressedElement: function(element){ 10604 if(this.currentPressedElement && !ASPx.IsValidElement(this.currentPressedElement)){ 10605 this.currentPressedElement = null; 10606 this.currentPressedItemName = ""; 10607 } 10608 if(this.currentPressedElement != element){ 10609 if(this.currentPressedElement != null) 10610 this.DoClearPressedState(this.currentPressedElement); 10611 var item = (element != null) ? element[ASPx.PressedItemKind] : null; 10612 if(item == null || item.enabled){ 10613 this.currentPressedElement = element; 10614 this.currentPressedItemName = (item != null) ? item.name : ""; 10615 if(this.currentPressedElement != null) 10616 this.DoSetPressedState(this.currentPressedElement); 10617 } 10618 } 10619 }, 10620 SetCurrentFocusedElementBySrcElement: function(srcElement){ 10621 var element = this.GetFocusedElement(srcElement); 10622 this.SetCurrentFocusedElement(element); 10623 }, 10624 SetCurrentHoverElementBySrcElement: function(srcElement){ 10625 var element = this.GetHoverElement(srcElement); 10626 this.SetCurrentHoverElement(element); 10627 }, 10628 SetCurrentPressedElementBySrcElement: function(srcElement){ 10629 var element = this.GetPressedElement(srcElement); 10630 this.SetCurrentPressedElement(element); 10631 }, 10632 SetPressedElement: function (element) { 10633 this.SetCurrentHoverElement(null); 10634 this.SetCurrentPressedElementBySrcElement(element); 10635 this.savedCurrentPressedElement = this.currentPressedElement; 10636 }, 10637 SelectElement: function (element) { 10638 var item = element[ASPx.SelectedItemKind]; 10639 if(item) 10640 item.Apply(element); 10641 }, 10642 SelectElementBySrcElement: function(srcElement){ 10643 var element = this.GetSelectedElement(srcElement); 10644 if(element != null) this.SelectElement(element); 10645 }, 10646 DeselectElement: function(element){ 10647 var item = element[ASPx.SelectedItemKind]; 10648 if(item) 10649 item.Cancel(element); 10650 }, 10651 DeselectElementBySrcElement: function(srcElement){ 10652 var element = this.GetSelectedElement(srcElement); 10653 if(element != null) this.DeselectElement(element); 10654 }, 10655 SetElementEnabled: function(element, enable){ 10656 if(enable) 10657 this.EnableElement(element); 10658 else 10659 this.DisableElement(element); 10660 }, 10661 SetElementReadOnly: function(element, readOnly) { 10662 var element = this.GetReadOnlyElement(element); 10663 if (element != null) { 10664 var item = element[ASPx.ReadOnlyItemKind]; 10665 if(item) { 10666 if(readOnly) { 10667 if(item.name == this.currentPressedItemName) 10668 this.SetCurrentPressedElement(null); 10669 if(item.name == this.currentHoverItemName) 10670 this.SetCurrentHoverElement(null); 10671 } 10672 if(readOnly) 10673 item.Apply(element); 10674 else 10675 item.Cancel(element); 10676 } 10677 } 10678 }, 10679 SetElementWithChildNodesEnabled: function (parentName, enabled) { 10680 var procFunct = (enabled ? this.EnableElement : this.DisableElement); 10681 var childItems = this.disabledScheme[parentName]; 10682 if (childItems && childItems.length > 0) 10683 for (var i = 0; i < childItems.length; i++) { 10684 procFunct.call(this, document.getElementById(childItems[i])); 10685 } 10686 }, 10687 DisableElement: function (element) { 10688 var element = this.GetDisabledElement(element); 10689 if(element != null) { 10690 var item = element[ASPx.DisabledItemKind]; 10691 if(item){ 10692 var args = new ASPxClientStateEventArgs(item, element); 10693 this.BeforeDisabled.FireEvent(this, args); 10694 if(item.name == this.currentPressedItemName) 10695 this.SetCurrentPressedElement(null); 10696 if(item.name == this.currentHoverItemName) 10697 this.SetCurrentHoverElement(null); 10698 item.Apply(element); 10699 this.SetMouseStateItemsEnabled(item.name, item.postfixes, false); 10700 this.AfterDisabled.FireEvent(this, args); 10701 } 10702 } 10703 }, 10704 EnableElement: function(element){ 10705 var element = this.GetDisabledElement(element); 10706 if(element != null) { 10707 var item = element[ASPx.DisabledItemKind]; 10708 if(item){ 10709 var args = new ASPxClientStateEventArgs(item, element); 10710 this.BeforeEnabled.FireEvent(this, args); 10711 item.Cancel(element); 10712 this.SetMouseStateItemsEnabled(item.name, item.postfixes, true); 10713 this.AfterEnabled.FireEvent(this, args); 10714 } 10715 } 10716 }, 10717 SetMouseStateItemsEnabled: function(name, postfixes, enabled){ 10718 if(postfixes && postfixes.length > 0){ 10719 for(var i = 0; i < postfixes.length; i ++){ 10720 this.SetItemsEnabled(this.hoverItems, name + postfixes[i], enabled); 10721 this.SetItemsEnabled(this.pressedItems, name + postfixes[i], enabled); 10722 this.SetItemsEnabled(this.focusedItems, name + postfixes[i], enabled); 10723 } 10724 } 10725 else{ 10726 this.SetItemsEnabled(this.hoverItems, name, enabled); 10727 this.SetItemsEnabled(this.pressedItems, name, enabled); 10728 this.SetItemsEnabled(this.focusedItems, name, enabled); 10729 } 10730 }, 10731 SetItemsEnabled: function(items, name, enabled){ 10732 if(items[name]) 10733 items[name].enabled = enabled; 10734 }, 10735 OnFocusMove: function(evt){ 10736 var element = ASPx.Evt.GetEventSource(evt); 10737 aspxGetStateController().SetCurrentFocusedElementBySrcElement(element); 10738 }, 10739 OnMouseMove: function(evt, checkElementChanged){ 10740 var srcElement = ASPx.Evt.GetEventSource(evt); 10741 if(checkElementChanged && srcElement == this.savedCurrentMouseMoveSrcElement) return; 10742 this.savedCurrentMouseMoveSrcElement = srcElement; 10743 if(this.savedCurrentPressedElement == null) 10744 this.SetCurrentHoverElementBySrcElement(srcElement); 10745 else{ 10746 var element = this.GetPressedElement(srcElement); 10747 if(element != this.currentPressedElement){ 10748 if(element == this.savedCurrentPressedElement) 10749 this.SetCurrentPressedElement(this.savedCurrentPressedElement); 10750 else 10751 this.SetCurrentPressedElement(null); 10752 } 10753 } 10754 }, 10755 OnMouseDown: function(evt){ 10756 if(!ASPx.Evt.IsLeftButtonPressed(evt)) return; 10757 var srcElement = ASPx.Evt.GetEventSource(evt); 10758 this.OnMouseDownOnElement(srcElement); 10759 }, 10760 OnMouseDownOnElement: function (element) { 10761 if(this.GetPressedElement(element) == null) return; 10762 this.SetPressedElement(element); 10763 }, 10764 OnMouseUp: function(evt){ 10765 var srcElement = ASPx.Evt.GetEventSource(evt); 10766 this.OnMouseUpOnElement(srcElement); 10767 }, 10768 OnMouseUpOnElement: function(element){ 10769 if(this.savedCurrentPressedElement == null) return; 10770 this.ClearSavedCurrentPressedElement(); 10771 this.SetCurrentHoverElementBySrcElement(element); 10772 }, 10773 OnMouseOver: function(evt){ 10774 var element = ASPx.Evt.GetEventSource(evt); 10775 if(element && element.tagName == "IFRAME") 10776 this.OnMouseMove(evt, true); 10777 }, 10778 OnKeyDown: function(evt){ 10779 var element = this.GetFocusedElement(ASPx.Evt.GetEventSource(evt)); 10780 if(element != null && element == this.currentFocusedElement) { 10781 var item = element[ASPx.FocusedItemKind]; 10782 if(item){ 10783 var args = new ASPxClientStateEventArgs(item, element); 10784 args.htmlEvent = evt; 10785 this.FocusedItemKeyDown.FireEvent(this, args); 10786 } 10787 } 10788 }, 10789 OnKeyUpOnElement: function(evt) { 10790 if(this.savedCurrentPressedElement != null && ASPx.Evt.IsActionKeyPressed(evt)) 10791 this.ClearSavedCurrentPressedElement(); 10792 }, 10793 OnSelectStart: function(evt){ 10794 if(this.savedCurrentPressedElement) { 10795 ASPx.Selection.Clear(); 10796 return false; 10797 } 10798 }, 10799 ClearSavedCurrentPressedElement: function() { 10800 this.savedCurrentPressedElement = null; 10801 this.SetCurrentPressedElement(null); 10802 }, 10803 ClearCache: function(srcElement, kind) { 10804 if(srcElement[ASPx.CachedStatePrefix + kind]) 10805 srcElement[ASPx.CachedStatePrefix + kind] = null; 10806 }, 10807 ClearElementCache: function(srcElement) { 10808 this.ClearCache(srcElement, ASPx.FocusedItemKind); 10809 this.ClearCache(srcElement, ASPx.HoverItemKind); 10810 this.ClearCache(srcElement, ASPx.PressedItemKind); 10811 this.ClearCache(srcElement, ASPx.SelectedItemKind); 10812 this.ClearCache(srcElement, ASPx.DisabledItemKind); 10813 }, 10814 ClearElementCacheInContainer: function(container) { 10815 var elements = ASPx.GetNodes(container); 10816 elements.push(container); 10817 ASPx.Data.ForEach(elements, this.ClearElementCache.bind(this)); 10818 }, 10819 LockForceRedrawAppearance: function() { 10820 this.forceRedrawAppearanceLockCount++; 10821 }, 10822 UnlockForceRedrawAppearance: function() { 10823 this.forceRedrawAppearanceLockCount--; 10824 }, 10825 IsForceRedrawAppearanceLocked: function() { 10826 return this.forceRedrawAppearanceLockCount > 0; 10827 }, 10828 GetHoverItem: function(srcElement) { 10829 var element = this.GetHoverElement(srcElement); 10830 return (element != null) ? element[ASPx.HoverItemKind] : null; 10831 } 10832}); 10833var stateController = null; 10834function aspxGetStateController(){ 10835 if(stateController == null) 10836 stateController = new ASPxStateController(); 10837 return stateController; 10838} 10839function aspxAddStateItems(method, namePrefix, classes, disableApplyingStyleToLink){ 10840 for(var i = 0; i < classes.length; i ++){ 10841 for(var j = 0; j < classes[i][2].length; j ++) { 10842 var name = namePrefix; 10843 if(classes[i][2][j]) 10844 name += "_" + classes[i][2][j]; 10845 var postfixes = classes[i][3] || null; 10846 var imageObjs = (classes[i][4] && classes[i][4][j]) || null; 10847 var imagePostfixes = classes[i][5] || null; 10848 method.call(aspxGetStateController(), name, classes[i][0], classes[i][1], postfixes, imageObjs, imagePostfixes, disableApplyingStyleToLink, namePrefix); 10849 } 10850 } 10851} 10852ASPx.AddHoverItems = function(namePrefix, classes, disableApplyingStyleToLink){ 10853 aspxAddStateItems(aspxGetStateController().AddHoverItem, namePrefix, classes, disableApplyingStyleToLink); 10854}; 10855ASPx.AddPressedItems = function(namePrefix, classes, disableApplyingStyleToLink){ 10856 aspxAddStateItems(aspxGetStateController().AddPressedItem, namePrefix, classes, disableApplyingStyleToLink); 10857}; 10858ASPx.AddSelectedItems = function(namePrefix, classes, disableApplyingStyleToLink){ 10859 aspxAddStateItems(aspxGetStateController().AddSelectedItem, namePrefix, classes, disableApplyingStyleToLink); 10860}; 10861ASPx.AddDisabledItems = function(namePrefix, classes, disableApplyingStyleToLink){ 10862 aspxAddStateItems(aspxGetStateController().AddDisabledItem, namePrefix, classes, disableApplyingStyleToLink); 10863}; 10864ASPx.AddReadOnlyItems = function(namePrefix, classes, disableApplyingStyleToLink) { 10865 aspxAddStateItems(aspxGetStateController().AddReadOnlyItem, namePrefix, classes, disableApplyingStyleToLink); 10866}; 10867function aspxRemoveStateItems(method, namePrefix, classes){ 10868 for(var i = 0; i < classes.length; i ++){ 10869 for(var j = 0; j < classes[i][0].length; j ++) { 10870 var name = namePrefix; 10871 if(classes[i][0][j]) 10872 name += "_" + classes[i][0][j]; 10873 method.call(aspxGetStateController(), name, classes[i][1], namePrefix); 10874 } 10875 } 10876} 10877ASPx.RemoveHoverItems = function(namePrefix, classes){ 10878 aspxRemoveStateItems(aspxGetStateController().RemoveHoverItem, namePrefix, classes); 10879}; 10880ASPx.RemovePressedItems = function(namePrefix, classes){ 10881 aspxRemoveStateItems(aspxGetStateController().RemovePressedItem, namePrefix, classes); 10882}; 10883ASPx.RemoveSelectedItems = function(namePrefix, classes){ 10884 aspxRemoveStateItems(aspxGetStateController().RemoveSelectedItem, namePrefix, classes); 10885}; 10886ASPx.RemoveDisabledItems = function(namePrefix, classes){ 10887 aspxRemoveStateItems(aspxGetStateController().RemoveDisabledItem, namePrefix, classes); 10888}; 10889ASPx.RemoveReadOnlyItems = function(namePrefix, classes) { 10890 aspxRemoveStateItems(aspxGetStateController().RemoveReadOnlyItem, namePrefix, classes); 10891}; 10892ASPx.AddAfterClearFocusedState = function(handler){ 10893 aspxGetStateController().AfterClearFocusedState.AddHandler(handler); 10894};
10895ASPx.AddAfterSetFocusedState = function(handler){ 10896 aspxGetStateController().AfterSetFocusedState.AddHandler(handler); 10897}; 10898ASPx.AddAfterClearHoverState = function(handler){ 10899 aspxGetStateController().AfterClearHoverState.AddHandler(handler); 10900}; 10901ASPx.AddAfterSetHoverState = function(handler){ 10902 aspxGetStateController().AfterSetHoverState.AddHandler(handler); 10903}; 10904ASPx.AddAfterClearPressedState = function(handler){ 10905 aspxGetStateController().AfterClearPressedState.AddHandler(handler); 10906}; 10907ASPx.AddAfterSetPressedState = function(handler){ 10908 aspxGetStateController().AfterSetPressedState.AddHandler(handler); 10909}; 10910ASPx.AddAfterDisabled = function(handler){ 10911 aspxGetStateController().AfterDisabled.AddHandler(handler); 10912}; 10913ASPx.AddAfterEnabled = function(handler){ 10914 aspxGetStateController().AfterEnabled.AddHandler(handler); 10915}; 10916ASPx.AddBeforeClearFocusedState = function(handler){ 10917 aspxGetStateController().BeforeClearFocusedState.AddHandler(handler); 10918}; 10919ASPx.AddBeforeSetFocusedState = function(handler){ 10920 aspxGetStateController().BeforeSetFocusedState.AddHandler(handler); 10921}; 10922ASPx.AddBeforeClearHoverState = function(handler){ 10923 aspxGetStateController().BeforeClearHoverState.AddHandler(handler); 10924}; 10925ASPx.AddBeforeSetHoverState = function(handler){ 10926 aspxGetStateController().BeforeSetHoverState.AddHandler(handler); 10927}; 10928ASPx.AddBeforeClearPressedState = function(handler){ 10929 aspxGetStateController().BeforeClearPressedState.AddHandler(handler); 10930}; 10931ASPx.AddBeforeSetPressedState = function(handler){ 10932 aspxGetStateController().BeforeSetPressedState.AddHandler(handler); 10933}; 10934ASPx.AddBeforeDisabled = function(handler){ 10935 aspxGetStateController().BeforeDisabled.AddHandler(handler); 10936}; 10937ASPx.AddBeforeEnabled = function(handler){ 10938 aspxGetStateController().BeforeEnabled.AddHandler(handler); 10939}; 10940ASPx.AddFocusedItemKeyDown = function(handler){ 10941 aspxGetStateController().FocusedItemKeyDown.AddHandler(handler); 10942}; 10943ASPx.SetHoverState = function(element){ 10944 aspxGetStateController().SetCurrentHoverElementBySrcElement(element); 10945}; 10946ASPx.ClearHoverState = function(evt){ 10947 aspxGetStateController().SetCurrentHoverElementBySrcElement(null); 10948}; 10949ASPx.UpdateHoverState = function(evt){ 10950 aspxGetStateController().OnMouseMove(evt, false); 10951}; 10952ASPx.SetFocusedState = function(element){ 10953 aspxGetStateController().SetCurrentFocusedElementBySrcElement(element); 10954}; 10955ASPx.ClearFocusedState = function(evt){ 10956 aspxGetStateController().SetCurrentFocusedElementBySrcElement(null); 10957}; 10958ASPx.UpdateFocusedState = function(evt){ 10959 aspxGetStateController().OnFocusMove(evt); 10960}; 10961ASPx.AccessibilityMarkerClass = "dxalink"; 10962ASPx.AssignAccessibilityEventsToChildrenLinks = function(container, clearFocusedStateOnMouseOut){ 10963 var links = ASPx.GetNodesByPartialClassName(container, ASPx.AccessibilityMarkerClass); 10964 for(var i = 0; i < links.length; i++) 10965 ASPx.AssignAccessibilityEventsToLink(links[i], clearFocusedStateOnMouseOut); 10966}; 10967ASPx.AssignAccessibilityEventsToLink = function(link, clearFocusedStateOnMouseOut) { 10968 if(!ASPx.ElementContainsCssClass(link, ASPx.AccessibilityMarkerClass)) 10969 return; 10970 ASPx.AssignAccessibilityEventsToLinkCore(link, clearFocusedStateOnMouseOut); 10971}; 10972ASPx.AssignAccessibilityEventsToLinkCore = function (link, clearFocusedStateOnMouseOut) { 10973 ASPx.Evt.AttachEventToElement(link, "focus", function (e) { ASPx.UpdateFocusedState(e); }); 10974 var clearFocusedStateHandler = function (e) { ASPx.ClearFocusedState(e); }; 10975 ASPx.Evt.AttachEventToElement(link, "blur", clearFocusedStateHandler); 10976 if(clearFocusedStateOnMouseOut) 10977 ASPx.Evt.AttachEventToElement(link, "mouseout", clearFocusedStateHandler); 10978}; 10979ASPx.Evt.AttachEventToDocument("mousemove", function(evt) { 10980 if(ASPx.classesScriptParsed && ASPx.StateItemsExist) 10981 aspxGetStateController().OnMouseMove(evt, true); 10982}); 10983ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) { 10984 if(ASPx.classesScriptParsed && ASPx.StateItemsExist) 10985 aspxGetStateController().OnMouseDown(evt); 10986}); 10987ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) { 10988 if(ASPx.classesScriptParsed && ASPx.StateItemsExist) 10989 aspxGetStateController().OnMouseUp(evt); 10990}); 10991ASPx.Evt.AttachEventToDocument("mouseover", function(evt) { 10992 if(ASPx.classesScriptParsed && ASPx.StateItemsExist) 10993 aspxGetStateController().OnMouseOver(evt); 10994}); 10995ASPx.Evt.AttachEventToDocument("keydown", function(evt) { 10996 if(ASPx.classesScriptParsed && ASPx.StateItemsExist) 10997 aspxGetStateController().OnKeyDown(evt); 10998}); 10999ASPx.Evt.AttachEventToDocument("selectstart", function(evt) { 11000 if(ASPx.classesScriptParsed && ASPx.StateItemsExist) 11001 return aspxGetStateController().OnSelectStart(evt); 11002}); 11003ASPx.GetStateController = aspxGetStateController;
11004ASPx.StateItem = ASPxStateItem; 11005})(); 11006 11007(function () { 11008 var ASPx = window.ASPx || {}; 11009 ASPx.ASPxImageLoad = {}; 11010 ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClass = "dxe-loadingImage"; 11011 ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClassRegexp = new RegExp("dx\\w+-loadingImage"); 11012 ASPx.ASPxImageLoad.OnLoad = function (image, customLoadingImage, isOldIE, customBackgroundImageUrl) { 11013 image.dxCustomBackgroundImageUrl = ""; 11014 image.dxShowLoadingImage = true; 11015 image.dxCustomLoadingImage = customLoadingImage; 11016 if (customBackgroundImageUrl != "") 11017 image.dxCustomBackgroundImageUrl = "url('" + customBackgroundImageUrl + "')"; 11018 ASPx.ASPxImageLoad.prepareImageBackground(image, isOldIE); 11019 ASPx.ASPxImageLoad.removeHandlers(image); 11020 image.className = image.className.replace(ASPx.ASPxImageLoad.dxDefaultLoadingImageCssClassRegexp, ""); 11021 }; 11022 ASPx.ASPxImageLoad.removeASPxImageBackground = function (image, isOldIE) { 11023 if (isOldIE) 11024 image.style.removeAttribute("background-image"); 11025 else 11026 image.style.backgroundImage = ""; 11027 }; 11028 ASPx.ASPxImageLoad.prepareImageBackground = function (image, isOldIE) { 11029 ASPx.ASPxImageLoad.removeASPxImageBackground(image, isOldIE); 11030 if (image.dxCustomBackgroundImageUrl != "") 11031 image.style.backgroundImage = image.dxCustomBackgroundImageUrl; 11032 }; 11033 ASPx.ASPxImageLoad.removeHandlers = function (image) { 11034 image.removeAttribute("onload"); 11035 image.removeAttribute("onabort"); 11036 image.removeAttribute("onerror"); 11037 }; 11038 window.ASPx = ASPx; 11039})(); 11040(function() { 11041var CheckingScriptObjectCommand = ASPx.CreateClass(null, { 11042 constructor: function(scriptName, markerObjectName) { 11043 this.scriptName = scriptName; 11044 this.markerObjectName = markerObjectName; 11045 this.isExisted = false; 11046 }, 11047 Run: function() { 11048 var markerObj = this.GetMarkerObject(); 11049 this.isExisted = !!markerObj; 11050 if(this.isExisted) 11051 markerObj.DXPatched = true; 11052 }, 11053 GetErrorMessage: function() { 11054 return this.GetErrorMessageCore(true); 11055 }, 11056 GetErrorMessageCore: function(isScriptRequired){ 11057 var markerObj = this.GetMarkerObject(); 11058 if(this.isExisted && markerObj && markerObj.DXPatched || !isScriptRequired && !markerObj) 11059 return null; 11060 if(isScriptRequired && !this.GetMarkerObject()){ 11061 if(this.isExisted) 11062 return this.scriptName + " script was attached but has been overridden."; 11063 else 11064 return this.scriptName + " script was not attached."; 11065 } 11066 if(!this.isExisted) 11067 return this.scriptName + " script was attached after DevExpress scripts."; 11068 return this.scriptName + " script was attached multiple times and mixed up with DevExpress scripts."; 11069 }, 11070 GetMarkerObject: function() { 11071 return ASPx.GetGlobalObject(this.markerObjectName); 11072 } 11073}); 11074var PatchScriptCommand = ASPx.CreateClass(CheckingScriptObjectCommand, { 11075 constructor: function(scriptName, markerObjectName, patchMethod, required) { 11076 this.constructor.prototype.constructor.call(this, scriptName, markerObjectName); 11077 this.required = required; 11078 this.patchMethod = patchMethod; 11079 }, 11080 Run: function() { 11081 CheckingScriptObjectCommand.prototype.Run.call(this); 11082 if(this.isExisted) 11083 this.patchMethod(); 11084 }, 11085 GetErrorMessage: function() { 11086 return this.GetErrorMessageCore(this.required); 11087 } 11088});
11089var ExternalScriptProcessor = ASPx.CreateClass(null, { 11090 constructor: function() { 11091 this.commands = {}; 11092 }, 11093 Process: function(scriptName, markerObjectName, patchMethod, required) { 11094 var newCommand = this.CreateCommand(scriptName, markerObjectName, patchMethod, !!required); 11095 var oldCommand = this.commands[markerObjectName]; 11096 if(oldCommand) { 11097 if(!oldCommand.patchMethod && !newCommand.patchMethod) 11098 newCommand = null; 11099 else if(newCommand.patchMethod && (!oldCommand.patchMethod || oldCommand.required)) 11100 newCommand.required = true; 11101 else if(oldCommand.patchMethod && !newCommand.patchMethod) { 11102 oldCommand.required = true; 11103 newCommand = null; 11104 } 11105 } 11106 if(newCommand) { 11107 this.commands[markerObjectName] = newCommand; 11108 newCommand.Run(); 11109 } 11110 }, 11111 CreateCommand: function(scriptName, markerObjectName, patchMethod, required) { 11112 if(patchMethod) 11113 return new PatchScriptCommand(scriptName, markerObjectName, patchMethod, required); 11114 return new CheckingScriptObjectCommand(scriptName, markerObjectName); 11115 }, 11116 ShowErrorMessages: function() { 11117 var messages = this.GetErrorMessages(); 11118 var console = window.console; 11119 if(!messages.length || !console || !ASPx.IsFunction(console.error)) 11120 return; 11121 for(var i = 0; i < messages.length; i++) { 11122 console.error(messages[i]); 11123 } 11124 ASPx.ShowKBErrorMessage("Please check the correctness of script registration on the page. For details, see ", "T272309"); 11125 }, 11126 GetErrorMessages: function() { 11127 var messages = []; 11128 for (var key in this.commands) { 11129 if (this.commands.hasOwnProperty(key)) { 11130 var message = this.commands[key].GetErrorMessage(); 11131 if (message) 11132 messages.push(message); 11133 } 11134 } 11135 return messages; 11136 } 11137}); 11138ExternalScriptProcessor.Instance = null; 11139ExternalScriptProcessor.getInstance = function() { 11140 if(!ExternalScriptProcessor.Instance) 11141 ExternalScriptProcessor.Instance = new ExternalScriptProcessor(); 11142 return ExternalScriptProcessor.Instance; 11143}; 11144ASPx.ExternalScriptProcessor = ExternalScriptProcessor; 11145})(); 11146(function module(ASPx) { 11147ASPx.modules.Controls = module; 11148var ASPxClientBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11149 constructor: function(command){ 11150 this.constructor.prototype.constructor.call(this); 11151 this.command = command; 11152 } 11153}); 11154var ASPxClientGlobalBeginCallbackEventArgs = ASPx.CreateClass(ASPxClientBeginCallbackEventArgs, { 11155 constructor: function(control, command){ 11156 this.constructor.prototype.constructor.call(this, command); 11157 this.control = control; 11158 } 11159}); 11160var ASPxClientEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11161 constructor: function(command){ 11162 this.constructor.prototype.constructor.call(this); 11163 this.command = command; 11164 } 11165}); 11166var ASPxClientGlobalEndCallbackEventArgs = ASPx.CreateClass(ASPxClientEndCallbackEventArgs, { 11167 constructor: function(control){ 11168 this.constructor.prototype.constructor.call(this); 11169 this.control = control; 11170 } 11171}); 11172var ASPxClientCustomDataCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11173 constructor: function(result) { 11174 this.constructor.prototype.constructor.call(this); 11175 this.result = result; 11176 } 11177}); 11178var ASPxClientCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11179 constructor: function (message, callbackId) { 11180 this.constructor.prototype.constructor.call(this); 11181 this.message = message; 11182 this.handled = false; 11183 this.callbackId = callbackId; 11184 } 11185}); 11186var ASPxClientGlobalCallbackErrorEventArgs = ASPx.CreateClass(ASPxClientCallbackErrorEventArgs, { 11187 constructor: function (control, message, callbackId) { 11188 this.constructor.prototype.constructor.call(this, message, callbackId); 11189 this.control = control; 11190 } 11191}); 11192var ASPxClientValidationCompletedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11193 constructor: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) { 11194 this.constructor.prototype.constructor.call(this); 11195 this.container = container; 11196 this.validationGroup = validationGroup; 11197 this.invisibleControlsValidated = invisibleControlsValidated; 11198 this.isValid = isValid; 11199 this.firstInvalidControl = firstInvalidControl;
11200 this.firstVisibleInvalidControl = firstVisibleInvalidControl; 11201 } 11202}); 11203var ASPxClientControlsInitializedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11204 constructor: function(isCallback) { 11205 this.isCallback = isCallback; 11206 } 11207}); 11208var ASPxClientControlBeforePronounceEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11209 constructor: function(messageParts, control){ 11210 this.constructor.prototype.constructor.call(this); 11211 this.messageParts = messageParts; 11212 this.control = control; 11213 } 11214}); 11215var ASPxClientControlUnloadEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11216 constructor: function(control){ 11217 this.constructor.prototype.constructor.call(this); 11218 this.control = control; 11219 } 11220}); 11221var ASPxClientEndFocusEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11222 constructor: function(item) { 11223 this.constructor.prototype.constructor.call(this); 11224 this.item = item; 11225 } 11226}); 11227var ASPxClientItemFocusedEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11228 constructor: function(item) { 11229 this.constructor.prototype.constructor.call(this); 11230 this.item = item; 11231 } 11232}); 11233var BeforeInitCallbackEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11234 constructor: function(callbackOwnerID){ 11235 this.constructor.prototype.constructor.call(this); 11236 this.callbackOwnerID = callbackOwnerID; 11237 } 11238}); 11239var ASPxClientBrowserWindowResizedInternalEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 11240 constructor: function(eventInfo) { 11241 this.constructor.prototype.constructor.call(this); 11242 this.htmlEvent = eventInfo.htmlEvent; 11243 this.windowClientWidth = eventInfo.wndWidth; 11244 this.windowClientHeigth = eventInfo.wndHeight; 11245 this.previousWindowClientWidth = eventInfo.prevWndWidth; 11246 this.previousWindowClientHeight = eventInfo.prevWndHeight; 11247 this.virtualKeyboardShownOnAndroid = eventInfo.virtualKeyboardShownOnAndroid; 11248 } 11249}); 11250ASPx.createControl = function(type, name, windowName, properties, events, setupMethod, data){ 11251 var globalName = windowName && windowName.length > 0 ? windowName : name; 11252 var dxo = new type(name); 11253 var haveWrapper = ASPx.Platform === "NETCORE" && dxo.createWrapper && !DevExpress.AspNetCore.Internal.BackwardCompatibility.useLegacyClientAPI; 11254 if(haveWrapper) { 11255 window[globalName] = dxo.createWrapper(); 11256 dxo.aspNetCoreWrapperInstance = window[globalName]; 11257 } 11258 else 11259 dxo.InitGlobalVariable(globalName); 11260 if(properties) 11261 dxo.SetProperties(properties); 11262 if(events) 11263 dxo.SetEvents(events); 11264 if(setupMethod) 11265 setupMethod.call(dxo); 11266 if(data) 11267 dxo.SetData(data); 11268 dxo.AfterCreate(); 11269}; 11270var ASPxClientControlBase = ASPx.CreateClass(null, { 11271 constructor: function(name){ 11272 this.name = name; 11273 this.uniqueID = name; 11274 this.globalName = name; 11275 this.stateObject = null; 11276 this.needEncodeState = true; 11277 this.encodeHtml = true; 11278 this.enabled = true; 11279 this.clientEnabled = true; 11280 this.savedClientEnabled = true; 11281 this.clientVisible = true; 11282 this.accessibilityCompliant = false; 11283 this.parseJSPropertiesOnCallbackError = false; 11284 this.autoPostBack = false; 11285 this.allowMultipleCallbacks = true; 11286 this.callBack = null; 11287 this.enableCallbackAnimation = false; 11288 this.enableSlideCallbackAnimation = false; 11289 this.slideAnimationDirection = null;
11290 this.beginCallbackAnimationProcessing = false; 11291 this.endCallbackAnimationProcessing = false; 11292 this.savedCallbackResult = null; 11293 this.savedCallbacks = null; 11294 this.isCallbackAnimationPrevented = false; 11295 this.lpDelay = 300; 11296 this.lpTimer = -1; 11297 this.requestCount = 0; 11298 this.enableSwipeGestures = false; 11299 this.disableSwipeGestures = false; 11300 this.supportGestures = false; 11301 this.repeatedGestureValue = 0; 11302 this.repeatedGestureCount = 0; 11303 this.isInitialized = false; 11304 this.initialFocused = false; 11305 this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.None; 11306 this.serverEvents = []; 11307 this.loadingPanelElement = null; 11308 this.loadingDivElement = null; 11309 this.hasPhantomLoadingElements = false; 11310 this.mainElement = null; 11311 this.touchUIMouseScroller = null; 11312 this.hiddenFields = {}; 11313 this.scPrefix = "dx"; 11314 this.callbackHandlersQueue = new ASPx.ControlCallbackHandlersQueue(this); 11315 this.callbackCommand = {}; 11316 this.currentCallbackID = -1; 11317 this.InitializeIntersectionObserversManager(); 11318 this.Init = new ASPxClientEvent(); 11319 this.BeginCallback = new ASPxClientEvent(); 11320 this.EndCallback = new ASPxClientEvent(); 11321 this.EndCallbackAnimationStart = new ASPxClientEvent(); 11322 this.CallbackError = new ASPxClientEvent(); 11323 this.CustomDataCallback = new ASPxClientEvent(); 11324 this.BeforePronounce = new ASPxClientEvent(); 11325 this.Unload = new ASPxClientEvent(); 11326 this.Disposed = new ASPxClientEvent(); 11327 aspxGetControlCollection().Add(this); 11328 }, 11329 Initialize: function() { 11330 if(this.callBack != null) 11331 this.InitializeCallBackData(); 11332 if (this.useCallbackQueue()) 11333 this.callbackQueueHelper = new ASPx.ControlCallbackQueueHelper(this); 11334 ASPx.AccessibilityUtils.createAccessibleBackgrounds(this); 11335 if(this.accessibilityCompliant) 11336 ASPx.AccessibilityPronouncer.EnsureInitialize(); 11337 }, 11338 FinalizeInitialization: function() { }, 11339 InlineInitialize: function() { 11340 this.savedClientEnabled = this.clientEnabled; 11341 }, 11342 InitializeGestures: function() { 11343 if(this.isSwipeGesturesEnabled() && this.supportGestures) { 11344 ASPx.GesturesHelper.AddSwipeGestureHandler(this.name, 11345 function() { return this.GetCallbackAnimationElement(); }.aspxBind(this), 11346 function(evt) { return this.CanHandleGestureCore(evt); }.aspxBind(this), 11347 function(value) { return this.AllowStartGesture(value); }.aspxBind(this), 11348 function(value) { return this.StartGesture(); }.aspxBind(this), 11349 function(value) { return this.AllowExecuteGesture(value); }.aspxBind(this), 11350 function(value) { this.ExecuteGesture(value); }.aspxBind(this), 11351 function(value) { this.CancelGesture(value); }.aspxBind(this), 11352 this.GetDefaultanimationEngineType(), 11353 this.rtl 11354 ); 11355 if(ASPx.Browser.MSTouchUI) 11356 this.touchUIMouseScroller = ASPx.MouseScroller.Create( 11357 function() { return this.GetCallbackAnimationElement(); }.aspxBind(this), 11358 function() { return null; }, 11359 function() { return this.GetCallbackAnimationElement(); }.aspxBind(this), 11360 function(element) { return this.NeedPreventTouchUIMouseScrolling(element); }.aspxBind(this), 11361 true 11362 ); 11363 } 11364 }, 11365 isSwipeGesturesEnabled: function() { 11366 return !this.disableSwipeGestures && (this.enableSwipeGestures || ASPx.Browser.TouchUI); 11367 }, 11368 isSlideCallbackAnimationEnabled: function() { 11369 return this.enableSlideCallbackAnimation || this.isSwipeGesturesEnabled(); 11370 }, 11371 InitGlobalVariable: function(varName){ 11372 if(!window) return; 11373 this.globalName = varName; 11374 window[varName] = this; 11375 }, 11376 SetElementDisplay: function(element, value, checkCurrentStyle, makeInline) { 11377 ASPx.SetElementDisplay(element, value, checkCurrentStyle, makeInline); 11378 }, 11379 SetProperties: function(properties, obj){ 11380 if(!obj) obj = this; 11381 var isAspNetCoreWrapperInstanceExist = !!obj.aspNetCoreWrapperInstance; 11382 for(var name in properties){ 11383 if(!properties.hasOwnProperty(name)) continue; 11384 obj[name] = properties[name]; 11385 if(isAspNetCoreWrapperInstanceExist && name.indexOf("cp") === 0) 11386 obj.aspNetCoreWrapperInstance[name] = properties[name]; 11387 } 11388 }, 11389 SetEvents: function(events, obj){ 11390 if(!obj) obj = this; 11391 for(var name in events){ 11392 if(events.hasOwnProperty(name) && obj[name] && obj[name].AddHandler) 11393 obj[name].AddHandler(events[name]); 11394 } 11395 }, 11396 SetData: function(data){ 11397 }, 11398 useCallbackQueue: function(){ 11399 return false; 11400 }, 11401 NeedPreventTouchUIMouseScrolling: function(element) { 11402 return false; 11403 }, 11404 InitializeFocus: function() { 11405 if(this.initialFocused && this.IsVisible()) { 11406 if(ASPxClientUtils.iOSPlatform || ASPxClientUtils.androidPlatform) 11407 setTimeout(function() { this.Focus(); }.bind(this), ASPx.FOCUS_TIMEOUT); 11408 else 11409 this.Focus(); 11410 } 11411 }, 11412 AfterCreate: function() { 11413 this.AddDefaultStateControllerItems();
11414 this.InlineInitialize(); 11415 this.InitializeGestures(); 11416 }, 11417 AfterInitialize: function() { 11418 this.initializeAriaDescriptor(); 11419 this.InitializeFocus(); 11420 this.isInitialized = true; 11421 this.RaiseInit(); 11422 if(this.savedCallbacks) { 11423 for(var i = 0; i < this.savedCallbacks.length; i++) 11424 this.CreateCallbackInternal(this.savedCallbacks[i].arg, this.savedCallbacks[i].command, 11425 false, this.savedCallbacks[i].callbackInfo); 11426 this.savedCallbacks = null; 11427 } 11428 }, 11429 InitializeCallBackData: function() { 11430 }, 11431 AtlasPreInitialize: function() { 11432 }, 11433 AtlasInitialize: function() { 11434 }, 11435 IsDOMDisposed: function() { 11436 return !ASPx.IsExistsElement(this.GetMainElement()); 11437 }, 11438 initializeAriaDescriptor: function() { 11439 if(this.ariaDescription) { 11440 var descriptionObject = ASPx.Json.Eval(this.ariaDescription); 11441 if(descriptionObject) { 11442 this.ariaDescriptor = new AriaDescriptor(this, descriptionObject); 11443 this.applyAccessibilityAttributes(this.ariaDescriptor); 11444 } 11445 } 11446 }, 11447 applyAccessibilityAttributes: function() { }, 11448 setAriaDescription: function(selector, argsList) { 11449 if(this.ariaDescriptor) 11450 this.ariaDescriptor.setDescription(selector, argsList || [[]]); 11451 }, 11452 allowRestoreFocusOnCallbacks: function(){ 11453 return this.accessibilityCompliant; 11454 }, 11455 HtmlEncode: function(text) { 11456 return this.encodeHtml ? ASPx.Str.EncodeHtml(text) : text; 11457 }, 11458 IsServerEventAssigned: function(eventName){ 11459 return ASPx.Data.ArrayIndexOf(this.serverEvents, eventName) >= 0; 11460 }, 11461 OnPost: function(args){ 11462 this.SerializeStateHiddenField(); 11463 }, 11464 SerializeStateHiddenField: function() { 11465 this.UpdateStateObject(); 11466 if(this.stateObject != null) 11467 this.UpdateStateHiddenField(); 11468 }, 11469 OnPostFinalization: function(args){ 11470 }, 11471 UpdateStateObject: function(){ 11472 }, 11473 UpdateStateObjectWithObject: function(obj){ 11474 if(!obj) return; 11475 if(!this.stateObject) 11476 this.stateObject = { }; 11477 for(var key in obj) 11478 if(obj.hasOwnProperty(key)) 11479 this.stateObject[key] = obj[key]; 11480 }, 11481 UpdateStateHiddenField: function() { 11482 var stateHiddenField = this.GetStateHiddenField(); 11483 if(stateHiddenField) { 11484 var stateObjectStr = ASPx.Json.ToJson(this.stateObject, !this.needEncodeState); 11485 stateHiddenField.value = this.needEncodeState ? ASPx.Str.EncodeHtml(stateObjectStr) : stateObjectStr; 11486 } 11487 }, 11488 GetStateHiddenField: function() { 11489 return this.GetHiddenField(this.GetStateHiddenFieldName(), this.GetStateHiddenFieldID(), 11490 this.GetStateHiddenFieldParent(), this.GetStateHiddenFieldOrigin()); 11491 }, 11492 GetStateHiddenFieldName: function() { 11493 return this.uniqueID; 11494 }, 11495 GetStateHiddenFieldID: function() { 11496 return this.name + "_State"; 11497 }, 11498 GetStateHiddenFieldOrigin: function() { 11499 return this.GetMainElement(); 11500 }, 11501 GetStateHiddenFieldParent: function() { 11502 var element = this.GetStateHiddenFieldOrigin(); 11503 return element ? element.parentNode : null; 11504 }, 11505 GetHiddenField: function(name, id, parent, beforeElement) { 11506 var hiddenField = this.hiddenFields[id]; 11507 if(!hiddenField || !ASPx.IsValidElement(hiddenField)) { 11508 if(parent) { 11509 var existingHiddenField = ASPx.GetElementById(this.GetStateHiddenFieldID()); 11510 this.hiddenFields[id] = hiddenField = existingHiddenField || ASPx.CreateHiddenField(name, id); 11511 if(existingHiddenField) 11512 return existingHiddenField; 11513 if(beforeElement) 11514 parent.insertBefore(hiddenField, beforeElement); 11515 else 11516 parent.appendChild(hiddenField); 11517 } 11518 } 11519 return hiddenField; 11520 }, 11521 GetChildElement: function(idPostfix){ 11522 var mainElement = this.GetMainElement(); 11523 if(idPostfix.charAt && idPostfix.charAt(0) !== "_") 11524 idPostfix = "_" + idPostfix; 11525 return mainElement ? ASPx.CacheHelper.GetCachedChildById(this, mainElement, this.name + idPostfix) : null; 11526 }, 11527 getChildControl: function(idPostfix) { 11528 var result = null; 11529 var childControlId = this.getChildControlUniqueID(idPostfix); 11530 ASPx.GetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) { 11531 if(control.uniqueID == childControlId) 11532 result = control; 11533 }); 11534 return result; 11535 }, 11536 getChildControlUniqueID: function(idPostfix) { 11537 idPostfix = idPostfix.split("_").join("$"); 11538 if(idPostfix.charAt && idPostfix.charAt(0) !== "$") 11539 idPostfix = "$" + idPostfix; 11540 return this.uniqueID + idPostfix; 11541 }, 11542 getInnerControl: function(idPostfix) { 11543 var name = this.name + idPostfix; 11544 var result = window[name]; 11545 return result && Ident.IsASPxClientControl(result) 11546 ? result 11547 : null; 11548 }, 11549 GetParentForm: function(){ 11550 return ASPx.GetParentByTagName(this.GetMainElement(), "FORM"); 11551 }, 11552 GetMainElement: function(){ 11553 if(!ASPx.IsExistsElement(this.mainElement)) 11554 this.mainElement = ASPx.GetElementById(this.GetMainElementId()); 11555 return this.mainElement; 11556 }, 11557 GetMainElementId: function() { 11558 return this.name; 11559 }, 11560 IsLoadingContainerVisible: function(){ 11561 return this.IsVisible(); 11562 }, 11563 GetLoadingPanelElement: function(){ 11564 return ASPx.GetElementById(this.name + "_LP"); 11565 }, 11566 GetClonedLoadingPanel: function(){ 11567 return document.getElementById(this.GetLoadingPanelElement().id + "V"); 11568 }, 11569 CloneLoadingPanel: function(element, parent) { 11570 var clone = element.cloneNode(true);
11571 clone.id = element.id + "V"; 11572 parent.appendChild(clone); 11573 return clone; 11574 }, 11575 CreateLoadingPanelWithoutBordersInsideContainer: function(container) { 11576 var loadingPanel = this.CreateLoadingPanelInsideContainer(container, false, true, true); 11577 var contentStyle = ASPx.GetCurrentStyle(container); 11578 if(!loadingPanel || !contentStyle) 11579 return; 11580 var elements = [ ]; 11581 var table = (loadingPanel.tagName == "TABLE") ? loadingPanel : ASPx.GetNodeByTagName(loadingPanel, "TABLE", 0); 11582 if(table != null) 11583 elements.push(table); 11584 else 11585 elements.push(loadingPanel); 11586 var cells = ASPx.GetNodesByTagName(loadingPanel, "TD"); 11587 if(!cells) cells = [ ]; 11588 for(var i = 0; i < cells.length; i++) 11589 elements.push(cells[i]); 11590 for(var i = 0; i < elements.length; i++) { 11591 var el = elements[i]; 11592 el.style.backgroundColor = contentStyle.backgroundColor; 11593 ASPx.RemoveBordersAndShadows(el); 11594 } 11595 }, 11596 CreateLoadingPanelInsideContainer: function(parentElement, hideContent, collapseHeight, collapseWidth) { 11597 if(this.ShouldHideExistingLoadingElements()) 11598 this.HideLoadingPanel(); 11599 if(parentElement == null) 11600 return null; 11601 if(!this.IsLoadingContainerVisible()) { 11602 this.hasPhantomLoadingElements = true; 11603 return null; 11604 } 11605 var element = this.GetLoadingPanelElement(); 11606 if(element != null){ 11607 var width = collapseWidth ? 0 : ASPx.GetClearClientWidth(parentElement); 11608 var height = collapseHeight ? 0 : ASPx.GetClearClientHeight(parentElement); 11609 if(hideContent){ 11610 for(var i = parentElement.childNodes.length - 1; i > -1; i--){ 11611 if(parentElement.childNodes[i].style) 11612 parentElement.childNodes[i].style.display = "none"; 11613 else if(parentElement.childNodes[i].nodeType == 3) 11614 parentElement.removeChild(parentElement.childNodes[i]); 11615 } 11616 } 11617 else 11618 parentElement.innerHTML = ""; 11619 var table = document.createElement("TABLE"); 11620 parentElement.appendChild(table); 11621 table.border = 0; 11622 table.cellPadding = 0; 11623 table.cellSpacing = 0; 11624 ASPx.SetStyles(table, { 11625 width: (width > 0) ? width : "100%", 11626 height: (height > 0) ? height : "100%" 11627 }); 11628 var tbody = document.createElement("TBODY"); 11629 table.appendChild(tbody); 11630 var tr = document.createElement("TR"); 11631 tbody.appendChild(tr); 11632 var td = document.createElement("TD"); 11633 tr.appendChild(td); 11634 td.align = "center"; 11635 td.vAlign = "middle"; 11636 element = this.CloneLoadingPanel(element, td); 11637 ASPx.SetElementDisplay(element, true); 11638 this.loadingPanelElement = element; 11639 return element; 11640 } else 11641 parentElement.innerHTML = " "; 11642 return null; 11643 }, 11644 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement) { 11645 if(this.ShouldHideExistingLoadingElements()) 11646 this.HideLoadingPanel(); 11647 if(parentElement == null) 11648 return null; 11649 if(!this.IsLoadingContainerVisible()) { 11650 this.hasPhantomLoadingElements = true; 11651 return null; 11652 } 11653 if(!offsetElement) 11654 offsetElement = parentElement; 11655 var element = this.GetLoadingPanelElement(); 11656 if(element != null) { 11657 element = this.CloneLoadingPanel(element, parentElement); 11658 ASPx.SetStyles(element, { 11659 position: "absolute" 11660 }); 11661 ASPx.SetElementDisplay(element, true); 11662 ASPx.Evt.AttachEventToElement(element, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent); 11663 this.SetLoadingPanelLocation(offsetElement, element); 11664 this.loadingPanelElement = element; 11665 return element; 11666 } 11667 return null; 11668 }, 11669 CreateLoadingPanelInline: function(parentElement, centerInParent){ 11670 if(this.ShouldHideExistingLoadingElements()) 11671 this.HideLoadingPanel(); 11672 if(parentElement == null) 11673 return null; 11674 if(!this.IsLoadingContainerVisible()) { 11675 this.hasPhantomLoadingElements = true; 11676 return null; 11677 } 11678 var element = this.GetLoadingPanelElement(); 11679 if(element != null) { 11680 element = this.CloneLoadingPanel(element, parentElement); 11681 if(centerInParent){ 11682 ASPx.SetElementDisplay(element, true); 11683 parentElement.style.textAlign = "center"; 11684 } 11685 else 11686 ASPx.SetElementDisplay(element, true); 11687 this.loadingPanelElement = element; 11688 return element; 11689 } 11690 return null; 11691 }, 11692 ShowLoadingPanel: function() { 11693 }, 11694 ShowLoadingElements: function() { 11695 if(this.InCallback() || this.lpTimer > -1) return; 11696 this.ShowLoadingDiv();
11697 if(this.IsCallbackAnimationEnabled()) 11698 this.StartBeginCallbackAnimation(); 11699 else 11700 this.ShowLoadingElementsInternal(); 11701 }, 11702 ShowLoadingElementsInternal: function() { 11703 if(this.lpDelay > 0 && !this.IsCallbackAnimationEnabled()) 11704 this.lpTimer = window.setTimeout(function() { 11705 this.ShowLoadingPanelOnTimer(); 11706 }.aspxBind(this), this.lpDelay); 11707 else { 11708 this.RestoreLoadingDivOpacity(); 11709 this.ShowLoadingPanel(); 11710 } 11711 }, 11712 GetLoadingPanelOffsetElement: function (baseElement) { 11713 if(this.IsCallbackAnimationEnabled()) { 11714 var element = this.GetLoadingPanelCallbackAnimationOffsetElement(); 11715 if(element) { 11716 var container = typeof(ASPx.AnimationHelper) != "undefined" ? ASPx.AnimationHelper.findSlideAnimationContainer(element) : null; 11717 if(container) 11718 return container.parentNode.parentNode; 11719 else 11720 return element; 11721 } 11722 } 11723 return baseElement; 11724 }, 11725 GetLoadingPanelCallbackAnimationOffsetElement: function () { 11726 return this.GetCallbackAnimationElement(); 11727 }, 11728 IsCallbackAnimationEnabled: function () { 11729 return (this.enableCallbackAnimation || this.isSlideCallbackAnimationEnabled()) && !this.isCallbackAnimationPrevented; 11730 }, 11731 GetDefaultanimationEngineType: function() { 11732 return ASPx.AnimationEngineType.DEFAULT; 11733 },
11734 StartBeginCallbackAnimation: function () { 11735 this.beginCallbackAnimationProcessing = true; 11736 this.isCallbackFinished = false; 11737 var element = this.GetCallbackAnimationElement(); 11738 if (element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 11739 ASPx.AnimationHelper.slideOut(element, this.slideAnimationDirection, this.FinishBeginCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl); 11740 else if(element && this.enableCallbackAnimation) 11741 ASPx.AnimationHelper.fadeOut(element, this.FinishBeginCallbackAnimation.aspxBind(this), null, ASPx.AnimationEngineType.JS); 11742 else 11743 this.FinishBeginCallbackAnimation(); 11744 }, 11745 CancelBeginCallbackAnimation: function() { 11746 if(this.beginCallbackAnimationProcessing) { 11747 this.beginCallbackAnimationProcessing = false; 11748 var element = this.GetCallbackAnimationElement(); 11749 ASPx.AnimationHelper.cancelAnimation(element); 11750 } 11751 }, 11752 FinishBeginCallbackAnimation: function () { 11753 this.beginCallbackAnimationProcessing = false; 11754 if(!this.isCallbackFinished) 11755 this.ShowLoadingElementsInternal(); 11756 else { 11757 this.DoCallback(this.savedCallbackResult); 11758 this.savedCallbackResult = null; 11759 } 11760 },
11761 CheckBeginCallbackAnimationInProgress: function(callbackResult) { 11762 if(this.beginCallbackAnimationProcessing) { 11763 this.savedCallbackResult = callbackResult; 11764 this.isCallbackFinished = true; 11765 return true; 11766 } 11767 return false; 11768 }, 11769 StartEndCallbackAnimation: function () { 11770 this.HideLoadingPanel(); 11771 this.SetInitialLoadingDivOpacity(); 11772 this.RaiseEndCallbackAnimationStart(); 11773 this.endCallbackAnimationProcessing = true; 11774 var element = this.GetCallbackAnimationElement(); 11775 if(element && this.isSlideCallbackAnimationEnabled() && this.slideAnimationDirection) 11776 ASPx.AnimationHelper.slideIn(element, this.slideAnimationDirection, this.FinishEndCallbackAnimation.aspxBind(this), this.GetDefaultanimationEngineType(), this.rtl); 11777 else if(element && this.enableCallbackAnimation) 11778 ASPx.AnimationHelper.fadeIn(element, this.FinishEndCallbackAnimation.aspxBind(this), null, ASPx.AnimationEngineType.JS); 11779 else 11780 this.FinishEndCallbackAnimation(); 11781 this.slideAnimationDirection = null; 11782 }, 11783 FinishEndCallbackAnimation: function () { 11784 this.DoEndCallback(); 11785 this.endCallbackAnimationProcessing = false; 11786 this.CheckRepeatGesture(); 11787 }, 11788 CheckEndCallbackAnimationNeeded: function() { 11789 if(!this.endCallbackAnimationProcessing && this.requestCount == 1) { 11790 this.StartEndCallbackAnimation(); 11791 return true; 11792 } 11793 return false; 11794 }, 11795 PreventCallbackAnimation: function() { 11796 this.isCallbackAnimationPrevented = true; 11797 }, 11798 GetCallbackAnimationElement: function() { 11799 return null; 11800 }, 11801 AssignSlideAnimationDirectionByPagerArgument: function(arg, currentPageIndex) { 11802 this.slideAnimationDirection = null; 11803 if(this.isSlideCallbackAnimationEnabled() && typeof(ASPx.AnimationHelper) != "undefined") { 11804 if(arg == PagerCommands.Next || arg == PagerCommands.Last) 11805 this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION; 11806 else if(arg == PagerCommands.First || arg == PagerCommands.Prev) 11807 this.slideAnimationDirection = ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION; 11808 else if(!isNaN(currentPageIndex) && arg.indexOf(PagerCommands.PageNumber) == 0) { 11809 var newPageIndex = parseInt(arg.substring(2)); 11810 if (!isNaN(newPageIndex)) { 11811 var leftDir = this.rtl ? ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION : ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION; 11812 var rightDir = this.rtl ? ASPx.AnimationHelper.SLIDE_RIGHT_DIRECTION : ASPx.AnimationHelper.SLIDE_LEFT_DIRECTION; 11813 this.slideAnimationDirection = newPageIndex < currentPageIndex ? leftDir : rightDir; 11814 } 11815 } 11816 } 11817 }, 11818 TryShowPhantomLoadingElements: function () { 11819 if(this.hasPhantomLoadingElements && this.InCallback()) { 11820 this.hasPhantomLoadingElements = false; 11821 this.ShowLoadingDivAndPanel(); 11822 } 11823 }, 11824 ShowLoadingDivAndPanel: function () { 11825 this.ShowLoadingDiv(); 11826 this.RestoreLoadingDivOpacity(); 11827 this.ShowLoadingPanel(); 11828 }, 11829 HideLoadingElements: function() {
11830 this.CancelBeginCallbackAnimation(); 11831 this.HideLoadingPanel(); 11832 this.HideLoadingDiv(); 11833 }, 11834 ShowLoadingPanelOnTimer: function() { 11835 this.ClearLoadingPanelTimer(); 11836 if(!this.IsDOMDisposed()) { 11837 this.RestoreLoadingDivOpacity(); 11838 this.ShowLoadingPanel(); 11839 } 11840 }, 11841 ClearLoadingPanelTimer: function() { 11842 this.lpTimer = ASPx.Timer.ClearTimer(this.lpTimer); 11843 }, 11844 HideLoadingPanel: function() { 11845 this.ClearLoadingPanelTimer(); 11846 this.hasPhantomLoadingElements = false; 11847 if(ASPx.IsExistsElement(this.loadingPanelElement)) { 11848 ASPx.RemoveElement(this.loadingPanelElement); 11849 this.loadingPanelElement = null; 11850 } 11851 }, 11852 SetLoadingPanelLocation: function(offsetElement, loadingPanel, x, y, offsetX, offsetY) { 11853 if(!ASPx.IsExists(x) || !ASPx.IsExists(y)){ 11854 var x1 = ASPx.GetAbsoluteX(offsetElement); 11855 var y1 = ASPx.GetAbsoluteY(offsetElement); 11856 var x2 = x1; 11857 var y2 = y1; 11858 if(offsetElement == document.body) { 11859 x1 = 0; 11860 y1 = 0; 11861 x2 = ASPx.GetDocumentMaxClientWidth(); 11862 y2 = ASPx.GetDocumentMaxClientHeight(); 11863 } 11864 else{ 11865 x2 += offsetElement.offsetWidth; 11866 y2 += offsetElement.offsetHeight; 11867 } 11868 if(x1 < ASPx.GetDocumentScrollLeft()) 11869 x1 = ASPx.GetDocumentScrollLeft(); 11870 if(y1 < ASPx.GetDocumentScrollTop()) 11871 y1 = ASPx.GetDocumentScrollTop(); 11872 if(x2 > ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth()) 11873 x2 = ASPx.GetDocumentScrollLeft() + ASPx.GetDocumentClientWidth(); 11874 if(y2 > ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight()) 11875 y2 = ASPx.GetDocumentScrollTop() + ASPx.GetDocumentClientHeight(); 11876 x = x1 + ((x2 - x1 - loadingPanel.offsetWidth) / 2); 11877 y = y1 + ((y2 - y1 - loadingPanel.offsetHeight) / 2); 11878 } 11879 if(ASPx.IsExists(offsetX) && ASPx.IsExists(offsetY)){ 11880 x += offsetX; 11881 y += offsetY; 11882 } 11883 x = ASPx.PrepareClientPosForElement(x, loadingPanel, true); 11884 y = ASPx.PrepareClientPosForElement(y, loadingPanel, false); 11885 ASPx.SetStyles(loadingPanel, { left: x, top: y }); 11886 }, 11887 GetLoadingDiv: function(){ 11888 return ASPx.GetElementById(this.name + "_LD"); 11889 }, 11890 CreateLoadingDiv: function(parentElement, offsetElement){ 11891 if(this.ShouldHideExistingLoadingElements()) 11892 this.HideLoadingDiv(); 11893 if(parentElement == null) 11894 return null; 11895 if(!this.IsLoadingContainerVisible()) { 11896 this.hasPhantomLoadingElements = true; 11897 return null; 11898 } 11899 if(!offsetElement) 11900 offsetElement = parentElement; 11901 var div = this.GetLoadingDiv(); 11902 if(div != null){ 11903 div = div.cloneNode(true); 11904 parentElement.appendChild(div); 11905 ASPx.SetElementDisplay(div, true); 11906 ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseDownEventName, ASPx.Evt.PreventEvent); 11907 ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseMoveEventName, ASPx.Evt.PreventEvent); 11908 ASPx.Evt.AttachEventToElement(div, ASPx.TouchUIHelper.touchMouseUpEventName, ASPx.Evt.PreventEvent); 11909 ASPx.Evt.AttachEventToElement(div, ASPx.Evt.GetMouseWheelEventName(), ASPx.Evt.PreventEvent); 11910 this.SetLoadingDivBounds(offsetElement, div); 11911 this.loadingDivElement = div; 11912 this.SetInitialLoadingDivOpacity(); 11913 return div; 11914 } 11915 return null; 11916 }, 11917 SetInitialLoadingDivOpacity: function() { 11918 if(!this.loadingDivElement) return; 11919 ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "opacity"); 11920 ASPx.Attr.SaveStyleAttribute(this.loadingDivElement, "filter"); 11921 ASPx.SetElementOpacity(this.loadingDivElement, 0.01); 11922 }, 11923 RestoreLoadingDivOpacity: function() { 11924 if(!this.loadingDivElement) return; 11925 ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "opacity"); 11926 ASPx.Attr.RestoreStyleAttribute(this.loadingDivElement, "filter"); 11927 }, 11928 SetLoadingDivBounds: function(offsetElement, loadingDiv) { 11929 var absX = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteX(offsetElement); 11930 var absY = (offsetElement == document.body) ? 0 : ASPx.GetAbsoluteY(offsetElement); 11931 ASPx.SetStyles(loadingDiv, { 11932 left: ASPx.PrepareClientPosForElement(absX, loadingDiv, true), 11933 top: ASPx.PrepareClientPosForElement(absY, loadingDiv, false) 11934 }); 11935 var width = (offsetElement == document.body) ? ASPx.GetDocumentWidth() : offsetElement.offsetWidth; 11936 var height = (offsetElement == document.body) ? ASPx.GetDocumentHeight() : offsetElement.offsetHeight; 11937 if(height < 0) 11938 height = 0; 11939 ASPx.SetStyles(loadingDiv, { width: width, height: height });
11940 var correctedWidth = 2 * width - loadingDiv.offsetWidth; 11941 if(correctedWidth <= 0) correctedWidth = width; 11942 var correctedHeight = 2 * height - loadingDiv.offsetHeight; 11943 if(correctedHeight <= 0) correctedHeight = height; 11944 ASPx.SetStyles(loadingDiv, { width: correctedWidth, height: correctedHeight }); 11945 }, 11946 ShowLoadingDiv: function() { 11947 }, 11948 HideLoadingDiv: function() { 11949 this.hasPhantomLoadingElements = false; 11950 if(ASPx.IsExistsElement(this.loadingDivElement)){ 11951 ASPx.RemoveElement(this.loadingDivElement); 11952 this.loadingDivElement = null; 11953 } 11954 }, 11955 CanHandleGesture: function(evt) { 11956 return false; 11957 }, 11958 CanHandleGestureCore: function(evt) { 11959 var source = ASPx.Evt.GetEventSource(evt); 11960 if(ASPx.GetIsParent(this.loadingPanelElement, source) || ASPx.GetIsParent(this.loadingDivElement, source)) 11961 return true; 11962 var callbackAnimationElement = this.GetCallbackAnimationElement(); 11963 if(!callbackAnimationElement) 11964 return false; 11965 var animationContainer = ASPx.AnimationHelper.getSlideAnimationContainer(callbackAnimationElement, false, false); 11966 if(animationContainer && ASPx.GetIsParent(animationContainer, source) && !ASPx.GetIsParent(animationContainer.childNodes[0], source)) 11967 return true; 11968 return this.CanHandleGesture(evt); 11969 }, 11970 AllowStartGesture: function() {
11971 return !this.beginCallbackAnimationProcessing && !this.endCallbackAnimationProcessing; 11972 }, 11973 StartGesture: function() { 11974 }, 11975 AllowExecuteGesture: function(value) { 11976 return false; 11977 }, 11978 ExecuteGesture: function(value) { 11979 }, 11980 CancelGesture: function(value) { 11981 if(this.repeatedGestureCount === 0) { 11982 this.repeatedGestureValue = value; 11983 this.repeatedGestureCount = 1; 11984 } 11985 else { 11986 if(this.repeatedGestureValue * value > 0) 11987 this.repeatedGestureCount++; 11988 else 11989 this.repeatedGestureCount--; 11990 if(this.repeatedGestureCount === 0) 11991 this.repeatedGestureCount = 0; 11992 } 11993 }, 11994 CheckRepeatGesture: function() { 11995 if(this.repeatedGestureCount !== 0) { 11996 if(this.AllowExecuteGesture(this.repeatedGestureValue)) 11997 this.ExecuteGesture(this.repeatedGestureValue, this.repeatedGestureCount); 11998 this.repeatedGestureValue = 0; 11999 this.repeatedGestureCount = 0; 12000 } 12001 }, 12002 AllowExecutePagerGesture: function (pageIndex, pageCount, value) { 12003 if(pageIndex < 0) return false; 12004 if(pageCount <= 1) return false; 12005 if(value > 0 && pageIndex === 0) return false; 12006 if(value < 0 && pageIndex === pageCount - 1) return false; 12007 return true; 12008 }, 12009 ExecutePagerGesture: function(pageIndex, pageCount, value, count, method) { 12010 if(!count) count = 1; 12011 var pageIndex = pageIndex + (value < 0 ? count : -count); 12012 if(pageIndex < 0) pageIndex = 0; 12013 if(pageIndex > pageCount - 1) pageIndex = pageCount - 1; 12014 method(PagerCommands.PageNumber + pageIndex); 12015 }, 12016 RaiseInit: function(){ 12017 if(!this.Init.IsEmpty()){ 12018 var args = new ASPxClientEventArgs(); 12019 this.Init.FireEvent(this, args); 12020 } 12021 }, 12022 RaiseBeginCallbackInternal: function(command){ 12023 if(!this.BeginCallback.IsEmpty()){ 12024 var args = new ASPxClientBeginCallbackEventArgs(command); 12025 this.BeginCallback.FireEvent(this, args); 12026 } 12027 }, 12028 RaiseEndCallbackInternal: function(command) { 12029 if(!this.EndCallback.IsEmpty()){ 12030 var args = new ASPxClientEndCallbackEventArgs(command); 12031 this.EndCallback.FireEvent(this, args); 12032 } 12033 }, 12034 RaiseCallbackErrorInternal: function(message, callbackId) { 12035 if(!this.CallbackError.IsEmpty()) { 12036 var args = new ASPxClientCallbackErrorEventArgs(message, callbackId); 12037 this.CallbackError.FireEvent(this, args); 12038 if(args.handled) 12039 return { isHandled: true, errorMessage: args.message }; 12040 } 12041 }, 12042 RaiseBeginCallback: function(command){ 12043 this.RaiseBeginCallbackInternal(command); 12044 aspxGetControlCollection().RaiseBeginCallback(this, command); 12045 }, 12046 RaiseEndCallback: function(command){ 12047 this.RaiseEndCallbackInternal(command); 12048 aspxGetControlCollection().RaiseEndCallback(this, command); 12049 }, 12050 RaiseCallbackError: function (message, callbackId) { 12051 var result = this.RaiseCallbackErrorInternal(message, callbackId); 12052 if(!result) 12053 result = aspxGetControlCollection().RaiseCallbackError(this, message, callbackId); 12054 return result; 12055 }, 12056 RaiseEndCallbackAnimationStart: function(){ 12057 if(!this.EndCallbackAnimationStart.IsEmpty()){ 12058 var args = new ASPxClientEventArgs(); 12059 this.EndCallbackAnimationStart.FireEvent(this, args); 12060 } 12061 }, 12062 RaiseBeforePronounce: function(message) { 12063 var args = new ASPxClientControlBeforePronounceEventArgs(message, this); 12064 if(!this.BeforePronounce.IsEmpty()) 12065 this.BeforePronounce.FireEvent(this, args); 12066 return args; 12067 }, 12068 RaiseUnload: function() { 12069 var args = new ASPxClientControlUnloadEventArgs(this); 12070 if(!this.Unload.IsEmpty()) 12071 this.Unload.FireEvent(this, args); 12072 }, 12073 RaiseDisposed: function() { 12074 this.Disposed.FireEvent(this, new ASPxClientEventArgs(this)); 12075 }, 12076 SendMessageToAssistiveTechnology: function(message) { 12077 if(!this.accessibilityCompliant) 12078 return; 12079 this.PronounceMessageInternal(message, ASPx.AccessibilityPronouncerType.live); 12080 }, 12081 PronounceMessageInternal: function(messageArg, type) { 12082 var message = messageArg; 12083 if(!ASPx.Ident.IsArray(messageArg)) 12084 message = [messageArg]; 12085 var args = this.RaiseBeforePronounce(message); 12086 ASPx.AccessibilityPronouncer.Pronounce(args, type); 12087 }, 12088 IsVisible: function() { 12089 var element = this.GetMainElement(); 12090 return ASPx.IsElementVisible(element); 12091 }, 12092 IsDisplayedElement: function(element) { 12093 while(element && element.tagName != "BODY") { 12094 if(!ASPx.GetElementDisplay(element)) 12095 return false; 12096 element = element.parentNode; 12097 } 12098 return true; 12099 }, 12100 IsDisplayed: function() { 12101 return this.IsDisplayedElement(this.GetMainElement()); 12102 }, 12103 IsHiddenElement: function(element) { 12104 return element && element.offsetWidth == 0 && element.offsetHeight == 0; 12105 }, 12106 IsHidden: function() { 12107 return this.IsHiddenElement(this.GetMainElement()); 12108 }, 12109 IsDisposed: function() { 12110 return this.disposed; 12111 }, 12112 GetParentControl: function() { 12113 var mainElement = this.getActualMainElement(); 12114 var popupPostfix = ASPx.PCWIdSuffix + "-1"; 12115 var result = null; 12116 ASPx.GetParent(mainElement, function(element) {
12117 if(element === mainElement || !element.id) 12118 return false; 12119 var controlName = element.id.replace(popupPostfix, ""); 12120 result = ASPx.GetControlCollection().Get(controlName); 12121 return !!result; 12122 }); 12123 return result; 12124 }, 12125 getActualMainElement: function() { return this.GetMainElement(); }, 12126 findParentByType: function (type) { 12127 var ctrl = this; 12128 while (ctrl) { 12129 var parent = ctrl.GetParentControl(); 12130 if (parent && parent instanceof type) 12131 return parent; 12132 ctrl = parent; 12133 } 12134 return null; 12135 }, 12136 Focus: function() { 12137 }, 12138 GetClientVisible: function(){ 12139 return this.GetVisible(); 12140 }, 12141 SetClientVisible: function(visible){ 12142 this.SetVisible(visible); 12143 }, 12144 GetVisible: function(){ 12145 return this.clientVisible; 12146 }, 12147 SetVisible: function(visible){ 12148 if(this.clientVisible != visible){ 12149 this.clientVisible = visible; 12150 ASPx.SetElementDisplay(this.GetMainElement(), visible); 12151 if(visible) { 12152 this.AdjustControl(); 12153 var mainElement = this.GetMainElement(); 12154 if(mainElement) 12155 aspxGetControlCollection().AdjustControls(mainElement); 12156 } 12157 } 12158 }, 12159 GetEnabled: function() { 12160 return this.clientEnabled; 12161 }, 12162 SetEnabled: function(enabled) { 12163 this.clientEnabled = enabled; 12164 if(ASPxClientControl.setEnabledLocked) 12165 return; 12166 else
12167 ASPxClientControl.setEnabledLocked = true; 12168 this.savedClientEnabled = enabled; 12169 aspxGetControlCollection().ProcessControlsInContainer(this.GetMainElement(), function(control) { 12170 if(ASPx.IsFunction(control.SetEnabled)) 12171 control.SetEnabled(enabled && control.savedClientEnabled); 12172 }); 12173 delete ASPxClientControl.setEnabledLocked; 12174 }, 12175 InCallback: function() { 12176 return this.requestCount > 0; 12177 }, 12178 DoBeginCallback: function(command) { 12179 this.RaiseBeginCallback(command || ""); 12180 aspxGetControlCollection().Before_WebForm_InitCallback(this.name); 12181 if(typeof(WebForm_InitCallback) != "undefined" && WebForm_InitCallback) { 12182 __theFormPostData = ""; 12183 __theFormPostCollection = [ ]; 12184 this.ClearPostBackEventInput("__EVENTTARGET"); 12185 this.ClearPostBackEventInput("__EVENTARGUMENT"); 12186 WebForm_InitCallback(); 12187 this.savedFormPostData = __theFormPostData; 12188 this.savedFormPostCollection = __theFormPostCollection; 12189 } 12190 }, 12191 ClearPostBackEventInput: function(id){ 12192 var element = ASPx.GetElementById(id); 12193 if(element != null) element.value = ""; 12194 }, 12195 PerformDataCallback: function(arg, handler) { 12196 this.CreateCustomDataCallback(arg, "", handler); 12197 }, 12198 sendCallbackViaQueue: function (prefix, arg, showLoadingPanel, context, handler, onBeforeSend) { 12199 if (!this.useCallbackQueue()) 12200 return false; 12201 var context = context || this; 12202 var token = this.callbackQueueHelper.sendCallback(ASPx.FormatCallbackArg(prefix, arg), context, handler || context.OnCallback, prefix, onBeforeSend); 12203 if (showLoadingPanel) 12204 this.callbackQueueHelper.showLoadingElements(); 12205 return token; 12206 }, 12207 CreateCallback: function (arg, command, handler) { 12208 var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Common, handler || null); 12209 var callbackID = this.CreateCallbackByInfo(arg, command, callbackInfo); 12210 return callbackID; 12211 }, 12212 CreateCustomDataCallback: function(arg, command, handler) { 12213 var callbackInfo = this.CreateCallbackInfo(ASPx.CallbackType.Data, handler); 12214 this.CreateCallbackByInfo(arg, command, callbackInfo); 12215 }, 12216 CreateCallbackByInfo: function(arg, command, callbackInfo) { 12217 if(!this.CanCreateCallback()) return; 12218 var callbackID; 12219 if(typeof(WebForm_DoCallback) != "undefined" && WebForm_DoCallback && ASPx.documentLoaded || ASPx.Platform === "NETCORE") 12220 callbackID = this.CreateCallbackInternal(arg, command, true, callbackInfo); 12221 else { 12222 if(!this.savedCallbacks) 12223 this.savedCallbacks = []; 12224 var callbackInfo = { arg: arg, command: command, callbackInfo: callbackInfo }; 12225 if(this.allowMultipleCallbacks) 12226 this.savedCallbacks.push(callbackInfo); 12227 else 12228 this.savedCallbacks[0] = callbackInfo; 12229 } 12230 return callbackID; 12231 }, 12232 CreateCallbackInternal: function(arg, command, viaTimer, callbackInfo) { 12233 var watcher = ASPx.ControlUpdateWatcher.getInstance(); 12234 if(watcher && !watcher.CanSendCallback(this, arg)) { 12235 this.CancelCallbackInternal(); 12236 return; 12237 } 12238 this.requestCount++; 12239 this.DoBeginCallback(command); 12240 if(typeof(arg) == "undefined") 12241 arg = ""; 12242 if(typeof(command) == "undefined") 12243 command = ""; 12244 var callbackID = this.SaveCallbackInfo(callbackInfo, command), 12245 customArgs = this.GetCustomCallbackArgs(); 12246 if(viaTimer) 12247 window.setTimeout(function() { this.CreateCallbackCoreWithCustomArgs(arg, command, callbackID, customArgs); }.aspxBind(this), 0); 12248 else 12249 this.CreateCallbackCoreWithCustomArgs(arg, command, callbackID, customArgs); 12250 return callbackID; 12251 }, 12252 CreateCallbackCoreWithCustomArgs: function(arg, command, callbackID, customArgs) { 12253 this.CreateCallbackCore(arg, command, callbackID); 12254 }, 12255 GetCustomCallbackArgs: function() { 12256 return {}; 12257 }, 12258 CancelCallbackInternal: function() { 12259 this.CancelCallbackCore(); 12260 this.HideLoadingElements(); 12261 }, 12262 CancelCallbackCore: function() { 12263 }, 12264 CreateCallbackCore: function(arg, command, callbackID) { 12265 var callBackMethod = this.GetCallbackMethod(command); 12266 __theFormPostData = this.savedFormPostData; 12267 __theFormPostCollection = this.savedFormPostCollection; 12268 callBackMethod.call(this, this.GetSerializedCallbackInfoByID(callbackID) + arg); 12269 }, 12270 GetCallbackMethod: function(command){ 12271 return this.callBack; 12272 }, 12273 CanCreateCallback: function() { 12274 return !this.InCallback() || (this.allowMultipleCallbacks && !this.beginCallbackA
12274nimationProcessing && !this.endCallbackAnimationProcessing); 12275 }, 12276 DoLoadCallbackScripts: function() { 12277 ASPx.ProcessScriptsAndLinks(this.name, true); 12278 }, 12279 DoEndCallback: function() { 12280 if(this.IsCallbackAnimationEnabled() && this.CheckEndCallbackAnimationNeeded()) 12281 return; 12282 this.requestCount--; 12283 if (this.requestCount < 1) 12284 this.callbackHandlersQueue.executeCallbacksHandlers(); 12285 if(this.HideLoadingPanelOnCallback() && this.requestCount < 1) 12286 this.HideLoadingElements(); 12287 if(this.isSwipeGesturesEnabled() && this.supportGestures) { 12288 ASPx.GesturesHelper.UpdateSwipeAnimationContainer(this.name); 12289 if(this.touchUIMouseScroller) 12290 this.touchUIMouseScroller.update(); 12291 } 12292 this.isCallbackAnimationPrevented = false; 12293 this.OnCallbackFinalized(); 12294 this.AssignEllipsisTooltips(); 12295 var command = this.GetCallbackCommand(); 12296 this.RaiseEndCallback(command); 12297 this.InitializeIntersectionObserversManager(); 12298 this.currentCallbackID = -1; 12299 }, 12300 DoFinalizeCallback: function() { 12301 }, 12302 OnCallbackFinalized: function() { 12303 }, 12304 AssignEllipsisTooltips: function() { }, 12305 GetCallbackCommand: function() { 12306 var result = ""; 12307 if(this.currentCallbackID != -1) { 12308 var command = this.callbackCommand[this.currentCallbackID]; 12309 if(command) 12310 result = command; 12311 } 12312 return result; 12313 }, 12314 HideLoadingPanelOnCallback: function() { 12315 return true; 12316 }, 12317 ShouldHideExistingLoadingElements: function() { 12318 return true; 12319 }, 12320 EvalCallbackResult: function(resultString) { 12321 return eval(resultString); 12322 }, 12323 ParseJSProperties: function(resultObj) { 12324 if(resultObj.cp) { 12325 for(var name in resultObj.cp) 12326 if(resultObj.cp.hasOwnProperty(name)) { 12327 this[name] = resultObj.cp[name]; 12328 if(this.aspNetCoreWrapperInstance) 12329 this.aspNetCoreWrapperInstance[name] = resultObj.cp[name]; 12330 } 12331 } 12332 }, 12333 DoCallback: function(result) { 12334 if(this.IsCallbackAnimationEnabled() && this.CheckBeginCallbackA
12334nimationInProgress(result)) 12335 return; 12336 result = ASPx.Str.Trim(result); 12337 if(result.indexOf(ASPx.CallbackResultPrefix) != 0) 12338 this.ProcessCallbackGeneralError(result, false); 12339 else { 12340 var resultObj = null; 12341 try { 12342 resultObj = this.EvalCallbackResult(result); 12343 } 12344 catch(e) { 12345 } 12346 if(resultObj) { 12347 this.currentCallbackID = resultObj.id; 12348 ASPx.CacheHelper.DropCache(this); 12349 if(resultObj.redirect) { 12350 this.ParseJSProperties(resultObj); 12351 ASPx.Url.Redirect(resultObj.redirect); 12352 } 12353 else if(ASPx.IsExists(resultObj.generalError)) { 12354 this.ProcessCallbackGeneralError(resultObj.generalError, true); 12355 } 12356 else { 12357 var errorObj = resultObj.error; 12358 if(errorObj) { 12359 if(this.parseJSPropertiesOnCallbackError) 12360 this.ParseJSProperties(resultObj); 12361 this.ProcessCallbackError(errorObj,resultObj.id); 12362 } else { 12363 this.ParseJSProperties(resultObj); 12364 var callbackInfo = this.DequeueCallbackInfo(resultObj.id); 12365 if(callbackInfo && callbackInfo.type == ASPx.CallbackType.Data) 12366 this.ProcessCustomDataCallback(resultObj.result, callbackInfo); 12367 else { 12368 if (this.useCallbackQueue() && this.callbackQueueHelper.getCallbackInfoById(resultObj.id)) 12369 this.callbackQueueHelper.processCallback(resultObj.result, resultObj.id); 12370 else { 12371 this.ProcessCallback(resultObj.result, resultObj.id); 12372 if(callbackInfo && callbackInfo.handler) { 12373 var handlerInfo = { handler: callbackInfo.handler, result: resultObj.result.data }; 12374 this.callbackHandlersQueue.addCallbackHandler(handlerInfo); 12375 } 12376 } 12377 } 12378 } 12379 } 12380 } 12381 } 12382 this.DoLoadCallbackScripts(); 12383 }, 12384 DoCallbackError: function(result) { 12385 this.HideLoadingElements(); 12386 this.ProcessCallbackGeneralError(result, false); 12387 }, 12388 DoControlClick: function(evt) { 12389 this.OnControlClick(ASPx.Evt.GetEventSource(evt), evt); 12390 }, 12391 ProcessCallback: function (result, callbackId) { 12392 this.OnCallback(result, callbackId); 12393 }, 12394 ProcessCustomDataCallback: function(result, callbackInfo) { 12395 if(callbackInfo.handler != null) 12396 callbackInfo.handler(this, result); 12397 this.RaiseCustomDataCallback(result); 12398 }, 12399 RaiseCustomDataCallback: function(result) { 12400 if(!this.CustomDataCallback.IsEmpty()) { 12401 var arg = new ASPxClientCustomDataCallbackEventArgs(result); 12402 this.CustomDataCallback.FireEvent(this, arg); 12403 } 12404 }, 12405 OnCallback: function(result) { 12406 }, 12407 CreateCallbackInfo: function(type, handler) { 12408 return { type: type, handler: handler }; 12409 }, 12410 GetSerializedCallbackInfoByID: function(callbackID) { 12411 return this.GetCallbackInfoByID(callbackID).type + callbackID + ASPx.CallbackSeparator; 12412 }, 12413 SaveCallbackInfo: function(info, command) { 12414 var callbacks = this.GetActiveCallbacksInfo(); 12415 var index = callbacks.indexOf(null); 12416 if(index === -1) 12417 index = callbacks.length; 12418 callbacks[index] = info; 12419 this.callbackCommand[index] = command; 12420 return index; 12421 }, 12422 GetActiveCallbacksInfo: function() { 12423 var persistentProperties = this.GetPersistentProperties(); 12424 if(!persistentProperties.activeCallbacks) 12425 persistentProperties.activeCallbacks = [ ]; 12426 return persistentProperties.activeCallbacks; 12427 }, 12428 GetPersistentProperties: function() { 12429 var storage = _aspxGetPersistentControlPropertiesStorage(); 12430 var persistentProperties = storage[this.name]; 12431 if(!persistentProperties) { 12432 persistentProperties = { }; 12433 storage[this.name] = persistentProperties; 12434 } 12435 return persistentProperties; 12436 }, 12437 GetCallbackInfoByID: function(callbackID) { 12438 return this.GetActiveCallbacksInfo()[callbackID]; 12439 }, 12440 DequeueCallbackInfo: function(index) { 12441 var activeCallbacksInfo = this.GetActiveCallbacksInfo(); 12442 if(index < 0 || index >= activeCallbacksInfo.length) 12443 return null; 12444 var result = activeCallbacksInfo[index]; 12445 activeCallbacksInfo[index] = null; 12446 return result; 12447 }, 12448 ProcessCallbackError: function (errorObj, callbackId) { 12449 var data = ASPx.IsExists(errorObj.data) ? errorObj.data : null; 12450 var result = this.RaiseCallbackError(errorObj.message, callbackId); 12451 if(result.isHandled) 12452 this.OnCallbackErrorAfterUserHandle(result.errorMessage, data); 12453 else 12454 this.OnCallbackError(result.errorMessage, data); 12455 }, 12456 OnCallbackError: function(errorMessage, data) { 12457 if(errorMessage) 12458 ASPx.ShowErrorAlert(errorMessage); 12459 }, 12460 OnCallbackErrorAfterUserHandle: function(errorMessage, data) { 12461 }, 12462 ProcessCallbackGeneralError: function(errorMessage, serverExceptionOnLastCallback) { 12463 this.serverExceptionOnLastCallback = serverExceptionOnLastCallback; 12464 var result = this.RaiseCallbackError(errorMessage); 12465 if(result.isHandled) 12466 this.OnCallbackGeneralErrorAfterUserHandle(result.errorMessage); 12467 else 12468 this.OnCallbackGeneralError(result.errorMessage); 12469 }, 12470 OnCallbackGeneralError: function(errorMessage) { 12471 this.OnCallbackError(errorMessage, null); 12472 }, 12473 OnCallbackGeneralErrorAfterUserHandle: function (errorMessage) { 12474 },
12475 SendPostBack: function(params, preventConvertToUpdatePanelCallback) { 12476 if(preventConvertToUpdatePanelCallback) 12477 this.sendMSAjaxCompatPostBack(params); 12478 else 12479 this.sendPostBackInternal(params); 12480 }, 12481 sendPostBackInternal: function(params) { 12482 if(typeof(__doPostBack) != "undefined") 12483 __doPostBack(this.uniqueID, params); 12484 else{ 12485 var form = this.GetParentForm(); 12486 if(form) form.submit(); 12487 } 12488 }, 12489 sendMSAjaxCompatPostBack: function(params) { 12490 var rm = ASPx.GetMSAjaxRequestManager(); 12491 var triggers = rm ? rm._postBackControlClientIDs : null; 12492 var needRegister = triggers && ASPx.Ident.IsArray(triggers) && ASPx.Data.ArrayIndexOf(triggers, this.name) == -1; 12493 if(needRegister) 12494 triggers.unshift(this.name); 12495 this.sendPostBackInternal(params); 12496 if(needRegister) 12497 triggers.shift(); 12498 }, 12499 IsValidInstance: function () { 12500 return aspxGetControlCollection().GetByName(this.name) === this; 12501 }, 12502 OnDispose: function() { 12503 this.RaiseDisposed(); 12504 var varName = this.globalName; 12505 if(varName && varName !== "" && window && window[varName] && window[varName] == this){ 12506 try{ 12507 delete window[varName]; 12508 } 12509 catch(e){ } 12510 } 12511 if(this.callbackQueueHelper) 12512 this.callbackQueueHelper.detachEvents(); 12513 if (!this.IsDisposed()) 12514 this.disposed = true; 12515 }, 12516 OnGlobalControlsInitialized: function(args) { 12517 }, 12518 OnGlobalBrowserWindowResized: function(args) { 12519 }, 12520 OnGlobalBeginCallback: function(args) { 12521 }, 12522 OnGlobalEndCallback: function(args) { 12523 }, 12524 OnGlobalCallbackError: function(args) { 12525 }, 12526 OnGlobalValidationCompleted: function(args) { 12527 }, 12528 AddDefaultStateControllerItems: function() { 12529 var states = this.scStates; 12530 if(!states) return; 12531 var postfix = this.scPostfix ? ("_" + this.scPostfix) : ""; 12532 var mainElementId = this.GetMainElementId(); 12533 if(states & 2) 12534 this.AddDefaultReadOnlyStateControllerItem(this.scPrefix + "ReadOnly" + postfix, mainElementId); 12535 if(states & 4) 12536 this.AddDefaultDisabledStateControllerItem(this.scPrefix + "Disabled" + postfix, mainElementId); 12537 }, 12538 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) { throw "Not implemented"; }, 12539 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) { throw "Not implemented"; }, 12540 DOMContentLoaded: function() { }, 12541 IsStateControllerEnabled: function() { return false; }, 12542 InitializeDOM: function() { 12543 var mainElement = this.GetMainElement(); 12544 if(mainElement) 12545 ASPx.SetElementInitializedFlag(mainElement); 12546 }, 12547 IsDOMInitialized: function() { 12548 var mainElement = this.GetMainElement(); 12549 return mainElement && ASPx.GetElementInitializedFlag(mainElement); 12550 }, 12551 AdjustControl: function(nestedCall) { }, 12552 OnBrowserWindowResizeInternal: function(e) { }, 12553 RegisterInControlTree: function(tree) { }, 12554 InitializeIntersectionObserversManager: function () { 12555 var elementToObserve = this.getElementToObserveVisibilityChange(); 12556 if(elementToObserve) { 12557 ASPx.IntersectionObserversManager.SubscribeElemensVisibilityChangeInBrowserWindow(elementToObserve, this.processVisibilityChanged.bind(this)); 12558 } 12559 }, 12560 getElementToObserveVisibilityChange: function () { }, 12561 processVisibilityChanged: function (visible) { } 12562}); 12563ASPxClientControlBase.Cast = function(obj) { 12564 if(typeof obj == "string") 12565 return window[obj]; 12566 return obj; 12567}; 12568var persistentControlPropertiesStorage = null; 12569function _aspxGetPersistentControlPropertiesStorage() { 12570 if(persistentControlPropertiesStorage == null) 12571 persistentControlPropertiesStorage = { }; 12572 return persistentControlPropertiesStorage; 12573} 12574var ELLIPSIS_MARKER_CLASS = "dx-ellipsis"; 12575var ELLIPSIS_TOOLTIP_MARKER_ATTR = "dxEllipsisTitle"; 12576var ASPxClientControl = ASPx.CreateClass(ASPxClientControlBase, { 12577 constructor: function(name){ 12578 this.constructor.prototype.constructor.call(this, name); 12579 this.rtl = false; 12580 this.enableEllipsis = false; 12581 this.isNative = false; 12582 this.isControlCollapsed = false; 12583 this.isInsideHierarchyAdjustment = false; 12584 this.controlOwner = null; 12585 this.adjustedSizes = { }; 12586 this.dialogContentHashTable = { }; 12587 this.renderIFrameForPopupElements = false; 12588 this.widthValueSetInPercentage = false; 12589 this.heightValueSetInPercentage = false; 12590 this.verticalAlignedElements = { }; 12591 this.wrappedTextContainers = { }; 12592 this.scrollPositionState = { }; 12593 this.sizingConfig = { 12594 allowSetWidth: true, 12595 allowSetHeight: true, 12596 correction : false, 12597 adjustControl : false, 12598 supportPercentHeight: false, 12599 supportAutoHeight: false 12600 }; 12601 this.percentSizeConfig = { 12602 width: -1, 12603 height: -1, 12604 markerWidth: -1, 12605 markerHeight: -1 12606 }; 12607 }, 12608 querySelector: function(selector) { return this.querySelectorAll(selector)[0] || null; }, 12609 querySelectorAll: function(selector) { 12610 return ASPx.CacheHelper.GetCachedElement(this, "querySelectorAll_" + selector, 12611 function() { return Array.prototype.slice.call(this.GetMainElement().querySelectorAll(selector)); }); 12612 }, 12613 createAccessKey: function (popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing) { 12614 return new ASPx.AccessKey(popupItem, getPopupElement, keyTipElement, key, onlyClick, manualStopProcessing); 12615 }, 12616 InlineInitialize: function() { 12617 this.InitializeDOM(); 12618 ASPxClientControlBase.prototype.InlineInitialize.call(this); 12619 }, 12620 AfterCreate: function() { 12621 ASPxClientControlBase.prototype.AfterCreate.call(this); 12622 if(!this.CanInitializeAdjustmentOnDOMContentLoaded() || ASPx.IsStartupScriptsRunning()) 12623 this.InitializeAdjustment(); 12624 }, 12625 DOMContentLoaded: function() { 12626 if(this.CanInitializeAdjustmentOnDOMContentLoaded()) 12627 this.InitializeAdjustment(); 12628 }, 12629 CanInitializeAdjustmentOnDOMContentLoaded: function() { 12630 return true; 12631 }, 12632 InitializeAdjustment: function() { 12633 this.UpdateAdjustmentFlags(); 12634 this.AdjustControl(); 12635 }, 12636 AfterInitialize: function() { 12637 this.AdjustControl(); 12638 ASPxClientControlBase.prototype.AfterInitialize.call(this); 12639 }, 12640 IsStateControllerEnabled: function(){ 12641 return typeof(ASPx.GetStateController) != "undefined" && ASPx.GetStateController(); 12642 }, 12643 GetWidth: function() { 12644 return this.GetMainElement().offsetWidth; 12645 }, 12646 GetHeight: function() { 12647 return this.GetMainElement().offsetHeight; 12648 }, 12649 SetWidth: function(width) { 12650 if(this.sizingConfig.allowSetWidth)
12651 this.SetSizeCore("width", width, "GetWidth", false); 12652 }, 12653 SetHeight: function(height) { 12654 if(this.sizingConfig.allowSetHeight) 12655 this.SetSizeCore("height", height, "GetHeight", false); 12656 }, 12657 SetSizeCore: function(sizePropertyName, size, getFunctionName, corrected) { 12658 if(size < 0 || !this.GetMainElement()) 12659 return; 12660 this.GetMainElement().style[sizePropertyName] = size + "px"; 12661 this.UpdateAdjustmentFlags(sizePropertyName); 12662 if(this.sizingConfig.adjustControl) 12663 this.AdjustControl(true); 12664 if(this.sizingConfig.correction && !corrected) { 12665 var realSize = this[getFunctionName](); 12666 if(realSize != size) { 12667 var correctedSize = size - (realSize - size); 12668 this.SetSizeCore(sizePropertyName, correctedSize, getFunctionName, true); 12669 } 12670 } 12671 }, 12672 AdjustControl: function(nestedCall) { 12673 if(this.IsAdjustmentRequired() && (!ASPxClientControl.adjustControlLocked || nestedCall)) { 12674 ASPxClientControl.adjustControlLocked = true; 12675 try { 12676 if(!this.IsAdjustmentAllowed()) 12677 return; 12678 this.AdjustControlCore(); 12679 this.UpdateAdjustedSizes(); 12680 } 12681 finally { 12682 delete ASPxClientControl.adjustControlLocked; 12683 } 12684 } 12685 this.AssignEllipsisTooltips(); 12686 this.TryShowPhantomLoadingElements(); 12687 }, 12688 ResetControlAdjustment: function () { 12689 this.adjustedSizes = { }; 12690 }, 12691 UpdateAdjustmentFlags: function(sizeProperty) { 12692 var mainElement = this.GetMainElement(); 12693 if(mainElement) { 12694 var mainElementStyle = ASPx.GetCurrentStyle(mainElement); 12695 this.UpdatePercentSizeConfig([mainElementStyle.width, mainElement.style.width], [mainElementStyle.height, mainElement.style.height], sizeProperty); 12696 } 12697 }, 12698 UpdatePercentSizeConfig: function(widths, heights, modifyStyleProperty) { 12699 switch(modifyStyleProperty) { 12700 case "width": 12701 this.UpdatePercentWidthConfig(widths); 12702 break; 12703 case "height": 12704 this.UpdatePercentHeightConfig(heights); 12705 break; 12706 default: 12707 this.UpdatePercentWidthConfig(widths); 12708 this.UpdatePercentHeightConfig(heights); 12709 break; 12710 } 12711 this.ResetControlPercentMarkerSize(); 12712 }, 12713 UpdatePercentWidthConfig: function(widths) { 12714 this.widthValueSetInPercentage = false; 12715 for(var i = 0; i < widths.length; i++) { 12716 if(this.IsPercentageWidth(widths[i])) { 12717 this.percentSizeConfig.width = widths[i]; 12718 this.widthValueSetInPercentage = true; 12719 break; 12720 } 12721 } 12722 }, 12723 IsPercentageWidth: function(width) { return ASPx.IsPercentageSize(width); }, 12724 UpdatePercentHeightConfig: function(heights) { 12725 this.heightValueSetInPercentage = false; 12726 for(var i = 0; i < heights.length; i++) { 12727 if(ASPx.IsPercentageSize(heights[i])) { 12728 this.percentSizeConfig.height = heights[i]; 12729 this.heightValueSetInPercentage = true; 12730 break; 12731 } 12732 } 12733 }, 12734 GetAdjustedSizes: function() { 12735 var mainElement = this.GetMainElement(); 12736 if(mainElement) 12737 return { width: mainElement.offsetWidth, height: mainElement.offsetHeight }; 12738 return { width: 0, height: 0 }; 12739 }, 12740 IsAdjusted: function() { 12741 return (this.adjustedSizes.width && this.adjustedSizes.width > 0) && (this.adjustedSizes.height && this.adjustedSizes.height > 0); 12742 }, 12743 IsAdjustmentRequired: function() { 12744 if(!this.IsAdjusted()) 12745 return true; 12746 if(this.widthValueSetInPercentage) 12747 return true; 12748 if(this.heightValueSetInPercentage) 12749 return true; 12750 var sizes = this.GetAdjustedSizes(); 12751 for(var name in sizes){ 12752 if(this.adjustedSizes[name] !== sizes[name]) 12753 return true; 12754 } 12755 return false; 12756 }, 12757 IsAdjustmentAllowed: function() { 12758 var mainElement = this.GetMainElement(); 12759 return mainElement && this.IsDisplayed() && !this.IsHidden() && this.IsDOMInitialized(); 12760 }, 12761 UpdateAdjustedSizes: function() { 12762 var sizes = this.GetAdjustedSizes(); 12763 for(var name in sizes) 12764 if(sizes.hasOwnProperty(name)) 12765 this.adjustedSizes[name] = sizes[name]; 12766 }, 12767 AdjustControlCore: function() { 12768 }, 12769 AdjustAutoHeight: function() { 12770 }, 12771 IsControlCollapsed: function() { 12772 return this.isControlCollapsed; 12773 }, 12774 NeedCollapseControl: function() { 12775 return this.NeedCollapseControlCore() && this.IsAdjustmentRequired() && this.IsAdjustmentAllowed(); 12776 }, 12777 NeedCollapseControlCore: function() { 12778 return false; 12779 }, 12780 CollapseEditor: function() { 12781 }, 12782 CollapseControl: function() { 12783 this.SaveScrollPositions(); 12784 var mainElement = this.GetMainElement(), 12785 marker = this.GetControlPercentSizeMarker(); 12786 marker.style.height = this.heightValueSetInPercentage && this.sizingConfig.supp
12786ortPercentHeight 12787 ? this.percentSizeConfig.height 12788 : (mainElement.offsetHeight + "px"); 12789 mainElement.style.display = "none"; 12790 this.isControlCollapsed = true; 12791 }, 12792 ExpandControl: function() { 12793 var mainElement = this.GetMainElement(); 12794 mainElement.style.display = ""; 12795 this.GetControlPercentSizeMarker().style.height = "0px"; 12796 this.isControlCollapsed = false; 12797 this.RestoreScrollPositions(); 12798 }, 12799 CanCauseReadjustment: function() { 12800 return this.NeedCollapseControlCore(); 12801 }, 12802 IsExpandableByAdjustment: function() { 12803 return false; 12804 }, 12805 HasFixedPosition: function() { 12806 return false; 12807 }, 12808 SaveScrollPositions: function() { 12809 var mainElement = this.GetMainElement(); 12810 this.scrollPositionState.outer = ASPx.GetOuterScrollPosition(mainElement.parentNode); 12811 this.scrollPositionState.inner = ASPx.GetInnerScrollPositions(mainElement); 12812 }, 12813 RestoreScrollPositions: function() { 12814 ASPx.RestoreOuterScrollPosition(this.scrollPositionState.outer); 12815 ASPx.RestoreInnerScrollPositions(this.scrollPositionState.inner); 12816 }, 12817 GetControlPercentSizeMarker: function() { 12818 if(this.percentSizeMarker === undefined) { 12819 this.percentSizeMarker = ASPx.CreateHtmlElementFromString("<div style='height:0px;font-size:0px;line-height:0;width:100%;'></div>"); 12820 ASPx.InsertElementAfter(this.percentSizeMarker, this.GetMainElement()); 12821 } 12822 return this.percentSizeMarker; 12823 }, 12824 KeepControlPercentSizeMarker: function(needCollapse, needCalculateHeight) { 12825 var marker = this.GetControlPercentSizeMarker(), 12826 markerHeight; 12827 if(needCollapse) 12828 this.CollapseControl(); 12829 if(this.widthValueSetInPercentage && marker.style.width !== this.percentSizeConfig.width) 12830 marker.style.width = this.percentSizeConfig.width; 12831 if(needCalculateHeight) { 12832 if(this.IsControlCollapsed()) 12833 markerHeight = marker.style.height; 12834 marker.style.height = this.percentSizeConfig.height; 12835 } 12836 this.percentSizeConfig.markerWidth = marker.offsetWidth; 12837 if(needCalculateHeight) { 12838 this.percentSizeConfig.markerHeight = marker.offsetHeight; 12839 if(this.IsControlCollapsed()) 12840 marker.style.height = markerHeight; 12841 else 12842 marker.style.height = "0px"; 12843 } 12844 if(needCollapse) 12845 this.ExpandControl(); 12846 }, 12847 ResetControlPercentMarkerSize: function() { 12848 this.percentSizeConfig.markerWidth = -1; 12849 this.percentSizeConfig.markerHeight = -1; 12850 }, 12851 GetControlPercentMarkerSize: function(hideControl, force) { 12852 var needCalculateHeight = this.heightValueSetInPercentage && this.sizingConfig.supportPercentHeight; 12853 if(force || this.percentSizeConfig.markerWidth < 1 || (needCalculateHeight && this.percentSizeConfig.markerHeight < 1)) 12854 this.KeepControlPercentSizeMarker(hideControl && !this.IsControlCollapsed(), needCalculateHeight); 12855 return { 12856 width: this.percentSizeConfig.markerWidth, 12857 height: this.percentSizeConfig.markerHeight 12858 }; 12859 }, 12860 AssignEllipsisTooltips: function() { 12861 if(this.RequireAssignTooltips()) 12862 this.AssignEllipsisTooltipsCore(); 12863 }, 12864 AssignEllipsisTooltipsCore: function(rootElement, reassingExistingTooltips) { 12865 var requirePaddingManipulation = ASPx.Browser.Edge || ASPx.Browser.Firefox; 12866 rootElement = rootElement || this.GetMainElement(); 12867 var nodes = this.GetEllipsisNodes(rootElement); 12868 var nodeInfos = []; 12869 var nodesCount = nodes.length; 12870 for(var i = 0; i < nodesCount; i++) { 12871 var node = nodes[i]; 12872 var info = { node: node }; 12873 if(requirePaddingManipulation) { 12874 var style = ASPx.GetCurrentStyle(node); 12875 info.paddingLeft = node.style.paddingLeft; 12876 info.totalPadding = ASPx.GetLeftRightPaddings(node, style); 12877 } 12878 nodeInfos.push(info); 12879 } 12880 if(requirePaddingManipulation) { 12881 for(var i = 0; i < nodesCount; i++) { 12882 var info = nodeInfos[i]; 12883 ASPx.SetStyles(info.node, { paddingLeft: info.totalPadding }, true); 12884 } 12885 } 12886 for(var i = 0; i < nodesCount; i++) { 12887 var info = nodeInfos[i]; 12888 var node = info.node; 12889 info.isTextShortened = node.scrollWidth > node.clientWidth; 12890 info.hasTitle = ASPx.Attr.GetAttribute(node, "title") !== null; 12891 if(!info.hasTitle || reassingExistingTooltips) 12892 info.title = ASPx.GetEllipsisTooltipText(node); 12893 } 12894 for(var i = 0; i < nodesCount; i++) { 12895 var info = nodeInfos[i]; 12896 var node = info.node; 12897 if(info.isTextShortened && info.title) { 12898 ASPx.Attr.SetAttribute(node, "title", info.title); 12899 ASPx.Attr.SetAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR, true); 12900 } 12901 if(!info.isTextShortened && info.hasTitle) 12902 ASPx.Attr.RemoveAttribute(node, "title"); 12903 } 12904 if(requirePaddingManipulation) { 12905 for(var i = 0; i < nodesCount; i++) { 12906 var info = nodeInfos[i]; 12907 var node = info.node; 12908 node.style.paddingLeft = info.paddingLeft; 12909 } 12910 } 12911 }, 12912 GetEllipsisNodes: function(element) { 12913 var ellipsibleNodes = ASPx.Data.CollectionToArray(ASPx.GetNodesByClassName(element, ELLIPSIS_MARKER_CLASS)); 12914 if(ASPx.ElementHasCssClass(element, ELLIPSIS_MARKER_CLASS)) 12915 ellipsibleNodes.push(element); 12916 return ellipsibleNodes.filter(function(node) { 12917 return !ASPx.Attr.IsExistsAttribute(node, "title") || ASPx.Attr.IsExistsAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR); 12918 }); 12919 }, 12920 RequireAssignTooltips: function() { 12921 return this.enableEllipsis && !ASPx.Browser.MobileUI; 12922 }, 12923 RemoveEllipsisFromNode: function(node) { 12924 ASPx.RemoveClassNameFromElement(node, ELLIPSIS_MARKER_CLASS); 12925 this.RemoveEllipsisTooltip(node); 12926 }, 12927 RemoveEllipsisTooltip: function(node) { 12928 if(ASPx.Attr.IsExistsAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR)) { 12929 ASPx.Attr.RemoveAttribute(node, "title"); 12930 ASPx.Attr.RemoveAttribute(node, ELLIPSIS_TOOLTIP_MARKER_ATTR); 12931 } 12932 }, 12933 OnBrowserWindowResize: function(e) { 12934 }, 12935 OnBrowserWindowResizeInternal: function(e){
12936 if(this.BrowserWindowResizeSubscriber()) 12937 this.OnBrowserWindowResize(e); 12938 }, 12939 BrowserWindowResizeSubscriber: function() { 12940 return this.widthValueSetInPercentage || !this.IsAdjusted(); 12941 }, 12942 ShrinkWrappedText: function(getElements, key, reCorrect) { 12943 if(!ASPx.Browser.Safari) return; 12944 var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers); 12945 for(var i = 0; i < elements.length; i++) 12946 this.ShrinkWrappedTextInContainer(elements[i], reCorrect); 12947 }, 12948 ShrinkWrappedTextInContainer: function(container, reCorrect) { 12949 if(!ASPx.Browser.Safari || !container || (container.dxWrappedTextShrinked && !reCorrect) || container.offsetWidth === 0) return; 12950 ASPx.ShrinkWrappedTextInContainer(container); 12951 container.dxWrappedTextShrinked = true; 12952 }, 12953 CorrectWrappedText: function(getElements, key, reCorrect) { 12954 var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.wrappedTextContainers); 12955 for(var i = 0; i < elements.length; i++) 12956 this.CorrectWrappedTextInContainer(elements[i], reCorrect); 12957 }, 12958 CorrectWrappedTextInContainer: function(container, reCorrect) { 12959 if(!container || (container.dxWrappedTextCorrected && !reCorrect) || container.offsetWidth === 0) return; 12960 ASPx.AdjustWrappedTextInContainer(container); 12961 container.dxWrappedTextCorrected = true; 12962 }, 12963 CorrectVerticalAlignment: function(alignMethod, getElements, key, reAlign) { 12964 var elements = ASPx.CacheHelper.GetCachedElements(this, key, getElements, this.verticalAlignedElements); 12965 for(var i = 0; i < elements.length; i++) 12966 this.CorrectElementVerticalAlignment(alignMethod, elements[i], reAlign); 12967 }, 12968 CorrectElementVerticalAlignment: function(alignMethod, element, reAlign) { 12969 if(!element || (element.dxVerticalAligned && !reAlign) || element.offsetHeight === 0) return; 12970 alignMethod(element); 12971 element.dxVerticalAligned = true; 12972 }, 12973 ClearVerticalAlignedElementsCache: function() { 12974 ASPx.CacheHelper.DropCache(this.verticalAlignedElements); 12975 }, 12976 ClearWrappedTextContainersCache: function() { 12977 ASPx.CacheHelper.DropCache(this.wrappedTextContainers); 12978 }, 12979 AdjustPagerControls: function() { 12980 if(typeof(ASPx.GetPagersCollection) != "undefined") 12981 ASPx.GetPagersCollection().AdjustControls(this.GetMainElement()); 12982 }, 12983 RegisterInControlTree: function(tree) { 12984 var mainElement = this.GetMainElement(); 12985 if(mainElement && mainElement.id) 12986 tree.createNode(mainElement.id, this); 12987 }, 12988 GetItemElementName: function(element) { 12989 var name = ""; 12990 if(element.id) 12991 name = element.id.substring(this.name.length + 1); 12992 return name; 12993 }, 12994 GetLinkElement: function(element) { 12995 if(element == null) return null; 12996 return (element.tagName == "A") ? element : ASPx.GetNodeByTagName(element, "A", 0); 12997 }, 12998 GetInternalHyperlinkElement: function(parentElement, index) { 12999 var element = ASPx.GetNodeByTagName(parentElement, "A", index); 13000 if(element == null) 13001 element = ASPx.GetNodeByTagName(parentElement, "SPAN", index); 13002 return element; 13003 }, 13004 OnControlClick: function(clickedElement, htmlEvent) { 13005 } 13006}); 13007ASPxClientControl.Cast = function(obj) { 13008 if(typeof obj == "string") 13009 return window[obj]; 13010 return obj; 13011}; 13012ASPxClientControl.AdjustControls = function(container, collapseControls){ 13013 aspxGetControlCollection().AdjustControls(container, collapseControls); 13014}; 13015ASPxClientControl.GetControlCollection = function(){ 13016 return aspxGetControlCollection(); 13017}; 13018ASPxClientControl.LeadingAfterInitCallConsts = { 13019 None: 0, 13020 Direct: 1, 13021 Reverse: 2 13022}; 13023var ASPxClientComponent = ASPx.CreateClass(ASPxClientControl, { 13024 constructor: function (name) { 13025 this.constructor.prototype.constructor.call(this, name); 13026 }, 13027 IsDOMDisposed: function() { 13028 return false; 13029 } 13030}); 13031var ASPxClientControlCollection = ASPx.CreateClass(ASPx.CollectionBase, { 13032 constructor: function(){ 13033 this.constructor.prototype.constructor.call(this); 13034 this.prevWndWidth = ""; 13035 this.prevWndHeight = ""; 13036 this.requestCountInternal = 0; 13037 this.BeforeInitCallback = new ASPxClientEvent(); 13038 this.ControlsInitialized = new ASPxClientEvent(); 13039 this.BrowserWindowResized = new ASPxClientEvent(); 13040 this.BrowserWindowResizedInternal = new ASPxClientEvent(); 13041 this.BeginCallback = new ASPxClientEvent(); 13042 this.EndCallback = new ASPxClientEvent(); 13043 this.CallbackError = new ASPxClientEvent(); 13044 this.ValidationCompleted = new ASPxClientEvent(); 13045 aspxGetControlCollectionCollection().Add(this); 13046 }, 13047 Add: function(element) { 13048 var existsElement = this.Get(element.name); 13049 if(existsElement && existsElement !== element) 13050 this.Remove(existsElement);
13051 ASPx.CollectionBase.prototype.Add.call(this, element.name, element); 13052 }, 13053 Remove: function(element) { 13054 if(element && element instanceof ASPxClientControl && !element.IsDisposed()) 13055 element.OnDispose(); 13056 ASPx.CollectionBase.prototype.Remove.call(this, element.name); 13057 }, 13058 GetGlobal: function(name) { 13059 var result = window[name]; 13060 return result && Ident.IsASPxClientControl(result) 13061 ? result 13062 : null; 13063 }, 13064 GetByName: function(name){ 13065 return this.Get(name) || this.GetGlobal(name); 13066 }, 13067 GetCollectionType: function(){ 13068 return ASPxClientControlCollection.BaseCollectionType; 13069 }, 13070 GetControlsByPredicate: function(predicate) { 13071 var result = []; 13072 this.ForEachControl(function(control) { 13073 if(!predicate || predicate(control)) 13074 result.push(control); 13075 }); 13076 return result; 13077 }, 13078 GetControlsByType: function(type) { 13079 return this.GetControlsByPredicate(function(control) { 13080 return type && (control instanceof type); 13081 }); 13082 }, 13083 ForEachControl: function(action, context) { 13084 context = context || this; 13085 this.elementsMap.forEachEntry(function(name, control) { 13086 if(Ident.IsASPxClientControl(control) && (!this.filterPredicate || this.filterPredicate(control))) 13087 return action.call(context, control); 13088 }, context); 13089 }, 13090 ProcessActionByPredicate: function(action, predicate) { 13091 try { 13092 this.filterPredicate = predicate; 13093 action(this); 13094 } 13095 finally { 13096 this.filterPredicate = null; 13097 } 13098 }, 13099 adjustControlsInternal: function(container, context, collapseControls, adjustFunc) { 13100 context = context || this; 13101 var func = function(control) { 13102 adjustFunc.call(context, control); 13103 }; 13104 ASPx.GetControlAdjuster().adjustControlsInHierarchy(this, func, container, collapseControls); 13105 }, 13106 AdjustControls: function(container, collapseControls) { 13107 container = container || null; 13108 window.setTimeout(function() { 13109 this.AdjustControlsCore(container, collapseControls); 13110 }.aspxBind(this), 0); 13111 }, 13112 AdjustControlsCore: function(container, collapseControls) { 13113 var adjustFunction = function(control) { control.AdjustControl(); }; 13114 this.adjustControlsInternal(container, this, collapseControls, adjustFunction); 13115 }, 13116 CollapseControls: function(container) { 13117 this.ProcessControlsInContainer(container, function(control) { 13118 if(control.isASPxClientEdit) 13119 control.CollapseEditor(); 13120 else if(!!window.ASPxClientRibbon && control instanceof ASPxClientRibbon) 13121 control.CollapseControl(); 13122 }); 13123 }, 13124 AtlasInitialize: function(isCallback) { 13125 this.ForEachControl(function(control) { 13126 control.AtlasPreInitialize(); 13127 }); 13128 ASPx.ProcessScriptsAndLinks("", isCallback); 13129 this.ForEachControl(function(control) { 13130 control.AtlasInitialize(); 13131 }); 13132 }, 13133 DOMContentLoaded: function() { 13134 this.ForEachControl(function(control){ 13135 control.DOMContentLoaded(); 13136 }); 13137 }, 13138 OnDocumentUnload: function() { 13139 this.ForEachControl(function(control) { 13140 control.RaiseUnload(); 13141 }); 13142 }, 13143 Initialize: function() { 13144 ASPx.GetPostHandler().Post.AddHandler( 13145 function(s, e) { this.OnPost(e); }.aspxBind(this) 13146 ); 13147 ASPx.GetPostHandler().PostFinalization.AddHandler( 13148 function(s, e) { this.OnPostFinalization(e); }.aspxBind(this) 13149 ); 13150 this.InitializeElements(false ); 13151 if(typeof(Sys) != "undefined" && typeof(Sys.Application) != "undefined") { 13152 var checkIsInitialized = function() { 13153 if(Sys.Application.get_isInitialized()) 13154 Sys.Application.add_load(aspxCAInit); 13155 else 13156 setTimeout(checkIsInitialized, 0); 13157 }; 13158 checkIsInitialized(); 13159 } 13160 this.InitWindowSizeCache(); 13161 }, 13162 FinalizeInitialization: function() { 13163 this.ForEachControl(function(control) { 13164 control.FinalizeInitialization(); 13165 }); 13166 }, 13167 InitializeElements: function(isCallback) { 13168 this.ForEachControl(function(control){ 13169 if(!control.isInitialized) 13170 control.Initialize(); 13171 }); 13172 this.AfterInitializeElementsLeadingCall(); 13173 this.AfterInitializeElements(); 13174 this.RaiseControlsInitialized(isCallback); 13175 }, 13176 AfterInitializeElementsLeadingCall: function() { 13177 var controls = {}; 13178 controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct] = [];
13179 controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse] = []; 13180 this.ForEachControl(function(control) { 13181 if(control.leadingAfterInitCall != ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized) 13182 controls[control.leadingAfterInitCall].push(control); 13183 }); 13184 var directInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Direct], 13185 reverseInitControls = controls[ASPxClientControl.LeadingAfterInitCallConsts.Reverse]; 13186 for(var i = 0, control; control = directInitControls[i]; i++) 13187 control.AfterInitialize(); 13188 for(var i = reverseInitControls.length - 1, control; control = reverseInitControls[i]; i--) 13189 control.AfterInitialize(); 13190 }, 13191 AfterInitializeElements: function() { 13192 this.ForEachControl(function(control) { 13193 if(control.leadingAfterInitCall == ASPxClientControl.LeadingAfterInitCallConsts.None && !control.isInitialized) 13194 control.AfterInitialize(); 13195 }); 13196 ASPx.RippleHelper.Init(); 13197 }, 13198 DoFinalizeCallback: function() { 13199 this.ForEachControl(function(control){ 13200 control.DoFinalizeCallback(); 13201 }); 13202 }, 13203 ProcessControlsInContainer: function(container, processFunc, filterFunc) { 13204 this.ForEachControl(function(control){ 13205 if((!filterFunc || filterFunc(control)) && (!container || this.IsControlInContainer(container, control))) 13206 processFunc(control); 13207 }); 13208 }, 13209 IsControlInContainer: function(container, control) { 13210 if(control.GetMainElement) { 13211 var mainElement = control.GetMainElement(); 13212 if(mainElement && (mainElement != container)) { 13213 if(ASPx.GetIsParent(container, mainElement)) 13214 return true; 13215 } 13216 } 13217 return false; 13218 }, 13219 RaiseControlsInitialized: function(isCallback) { 13220 if(typeof(isCallback) == "undefined") 13221 isCallback = true; 13222 var args = new ASPxClientControlsInitializedEventArgs(isCallback); 13223 if(!this.ControlsInitialized.IsEmpty()) 13224 this.ControlsInitialized.FireEvent(this, args); 13225 this.ForEachControl(function(control){ 13226 control.OnGlobalControlsInitialized(args); 13227 }); 13228 }, 13229 RaiseBrowserWindowResized: function() { 13230 var args = new ASPxClientEventArgs(); 13231 if(!this.BrowserWindowResized.IsEmpty()) 13232 this.BrowserWindowResized.FireEvent(this, args); 13233 this.ForEachControl(function(control){ 13234 control.OnGlobalBrowserWindowResized(args); 13235 }); 13236 }, 13237 RaiseBrowserWindowResizedInternal: function(eventInfo) { 13238 var args = new ASPxClientBrowserWindowResizedInternalEventArgs(eventInfo); 13239 if(!this.BrowserWindowResizedInternal.IsEmpty()) 13240 this.BrowserWindowResizedInternal.FireEvent(this, args); 13241 }, 13242 RaiseBeginCallback: function (control, command) { 13243 var args = new ASPxClientGlobalBeginCallbackEventArgs(control, command); 13244 if(!this.BeginCallback.IsEmpty()) 13245 this.BeginCallback.FireEvent(this, args); 13246 this.ForEachControl(function(control){ 13247 control.OnGlobalBeginCallback(args); 13248 }); 13249 this.IncrementRequestCount(); 13250 }, 13251 RaiseEndCallback: function (control) { 13252 var args = new ASPxClientGlobalEndCallbackEventArgs(control); 13253 if (!this.EndCallback.IsEmpty()) 13254 this.EndCallback.FireEvent(this, args); 13255 this.ForEachControl(function(control){ 13256 control.OnGlobalEndCallback(args); 13257 }); 13258 this.DecrementRequestCount(); 13259 }, 13260 InCallback: function() { 13261 return this.requestCountInternal > 0; 13262 }, 13263 RaiseCallbackError: function (control, message, callbackId) { 13264 var args = new ASPxClientGlobalCallbackErrorEventArgs(control, message, callbackId); 13265 if (!this.CallbackError.IsEmpty()) 13266 this.CallbackError.FireEvent(this, args); 13267 this.ForEachControl(function(control){ 13268 control.OnGlobalCallbackError(args); 13269 }); 13270 if(args.handled) 13271 return { isHandled: true, errorMessage: args.message }; 13272 return { isHandled: false, errorMessage: message }; 13273 }, 13274 RaiseValidationCompleted: function (container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl) { 13275 var args = new ASPxClientValidationCompletedEventArgs(container, validationGroup, invisibleControlsValidated, isValid, firstInvalidControl, firstVisibleInvalidControl); 13276 if (!this.ValidationCompleted.IsEmpty()) 13277 this.ValidationCompleted.FireEvent(this, args); 13278 this.ForEachControl(function(control){ 13279 control.OnGlobalValidationCompleted(args); 13280 }); 13281 return args.isValid; 13282 }, 13283 Before_WebForm_InitCallback: function(callbackOwnerID){ 13284 var args = new BeforeInitCallbackEventArgs(callbackOwnerID); 13285 this.BeforeInitCallback.FireEvent(this, args); 13286 }, 13287 InitWindowSizeCache: function(){ 13288 this.prevWndWidth = ASPx.GetDocumentClientWidth(); 13289 this.prevWndHeight = ASPx.GetDocumentClientHeight(); 13290 }, 13291 OnBrowserWindowResize: function(evt){ 13292 this.OnBrowserWindowResizeCore(evt); 13293 }, 13294 OnBrowserWindowResizeCore: function(htmlEvent){ 13295 var args = this.CreateOnBrowserWindowResizeEventArgs(htmlEvent); 13296 if(this.CalculateIsBrowserWindowSizeChanged()) { 13297 this.RaiseBrowserWindowResizedInternal(args); 13298 this.adjustControlsInternal(null, this, true, function(control) { 13299 if(control.IsDOMInitialized()) 13300 control.OnBrowserWindowResizeInternal(args); 13301 }); 13302 this.RaiseBrowserWindowResized(); 13303 } 13304 }, 13305 CreateOnBrowserWindowResizeEventArgs: function(htmlEvent) { 13306 return { 13307 htmlEvent: htmlEvent, 13308 wndWidth: ASPx.GetDocumentClientWidth(), 13309 wndHeight: ASPx.GetDocumentClientHeight(), 13310 prevWndWidth: this.prevWndWidth, 13311 prevWndHeight: this.prevWndHeight, 13312 virtualKeyboardShownOnAndroid: this.IsVirtualKeyboardShownOnAndroid() 13313 }; 13314 }, 13315 IsVirtualKeyboardShownOnAndroid: function() { 13316 if(!ASPx.Browser.AndroidMobilePlatform) 13317 return false; 13318 var documentClientWidth = ASPx.GetDocumentClientWidth(); 13319 var documentClientHeight = ASPx.GetDocumentClientHeight(); 13320 var isDocumentClientHeightChangedOnly = documentClientWidth === this.prevWndWidth && documentClientHeight !== this.prevWndHeight; 13321 return isDocumentClientHeightChangedOnly && this.IsElementSupportKeyboardInput(document.activeElement); 13322 },
13323 IsElementSupportKeyboardInput: function(element) { 13324 if(!element || !element.tagName) 13325 return false; 13326 var supportedKeyboardInputTagNames = ["INPUT", "TEXTAREA"]; 13327 return supportedKeyboardInputTagNames.indexOf(element.tagName) !== -1; 13328 }, 13329 CalculateIsBrowserWindowSizeChanged: function(){ 13330 var wndWidth = ASPx.GetDocumentClientWidth(); 13331 var wndHeight = ASPx.GetDocumentClientHeight(); 13332 var isBrowserWindowSizeChanged = (this.prevWndWidth != wndWidth) || (this.prevWndHeight != wndHeight); 13333 if(isBrowserWindowSizeChanged){ 13334 this.prevWndWidth = wndWidth; 13335 this.prevWndHeight = wndHeight; 13336 return true; 13337 } 13338 return false; 13339 }, 13340 OnPost: function(args){ 13341 this.ForEachControl(function(control) { 13342 control.OnPost(args); 13343 }, null); 13344 }, 13345 OnPostFinalization: function(args){ 13346 this.ForEachControl(function(control) { 13347 control.OnPostFinalization(args); 13348 }, null); 13349 }, 13350 IncrementRequestCount: function() { 13351 this.requestCountInternal++; 13352 }, 13353 DecrementRequestCount: function() { 13354 this.requestCountInternal--; 13355 }, 13356 ResetRequestCount: function() { 13357 this.requestCountInternal = 0; 13358 } 13359}); 13360ASPxClientControlCollection.BaseCollectionType = "Control"; 13361var controlCollection = null; 13362function aspxGetControlCollection(){ 13363 if(controlCollection == null) { 13364 controlCollection = new ASPxClientControlCollection(); 13365 if(ASPx.loadControlCollectionPreloadHandlers) 13366 ASPx.loadControlCollectionPreloadHandlers(controlCollection); 13367 } 13368 return controlCollection; 13369} 13370var ControlCollectionCollection = ASPx.CreateClass(ASPx.CollectionBase, { 13371 constructor: function(){ 13372 this.constructor.prototype.constructor.call(this); 13373 }, 13374 Add: function(element) { 13375 var key = element.GetCollectionType(); 13376 if(!key) throw "The collection type isn't specified."; 13377 if(this.Get(key)) throw "The collection with type='" + key + "' already exists."; 13378 ASPx.CollectionBase.prototype.Add.call(this, key, element); 13379 }, 13380 RemoveDisposedControls: function(){ 13381 var baseCollection = this.Get(ASPxClientControlCollection.BaseCollectionType); 13382 var disposedControls = []; 13383 baseCollection.elementsMap.forEachEntry(function(name, control) { 13384 if(!ASPx.Ident.IsASPxClientControl(control)) return; 13385 if(control.IsDOMDisposed()) 13386 disposedControls.push(control); 13387 }); 13388 this.RemoveControls(disposedControls); 13389 }, 13390 RemoveControls: function(controls){ 13391 for(var i = 0; i < controls.length; i++) { 13392 this.elementsMap.forEachEntry(function(key, collection) { 13393 if(ASPx.Ident.IsASPxClientCollection(collection)) 13394 collection.Remove(controls[i]); 13395 }); 13396 } 13397 } 13398}); 13399var controlCollectionCollection = null; 13400function aspxGetControlCollectionCollection(){ 13401 if(controlCollectionCollection == null) 13402 controlCollectionCollection = new ControlCollectionCollection(); 13403 return controlCollectionCollection; 13404} 13405var AriaDescriptionAttributes = { 13406 Role: "0", 13407 AriaLabel: "1", 13408 TabIndex: "2", 13409 AriaOwns: "3", 13410 AriaDescribedBy: "4", 13411 AriaDisabled: "5", 13412 AriaHasPopup: "6", 13413 AriaLevel: "7" 13414}; 13415var AriaDescriptor = ASPx.CreateClass(null, { 13416 constructor: function(ownerControl, description) { 13417 this.ownerControl = ownerControl; 13418 this.rootElement = ownerControl.GetMainElement(); 13419 this.description = description; 13420 }, 13421 setDescription: function(name, argList) { 13422 var description = this.findChildDescription(name); 13423 if(description) { 13424 var elements = name ? this.rootElement.querySelectorAll(this.getDescriptionSelector(description)) : [this.rootElement]; 13425 for(var i = 0; i < elements.length; i++) 13426 this.applyDescriptionToElement(elements[i], description, argList[i] || argList[0]); 13427 } 13428 }, 13429 getDescriptionName: function(description) { 13430 return description.n; 13431 }, 13432 getDescriptionSelector: function(description) { 13433 return description.s; 13434 }, 13435 findChildDescription: function(name) { 13436 if(name === this.getDescriptionName(this.description)) 13437 return this.description; 13438 var childCollection = this.description.c || []; 13439 for(var i = 0; i < childCollection.length; i++) { 13440 var childDescription = childCollection[i]; 13441 if(this.getDescriptionName(childDescription) === name) 13442 return childDescription; 13443 } 13444 return null; 13445 }, 13446 applyDescriptionToElement: function(element, description, args) { 13447 if(!description || !element) 13448 return; 13449 this.trySetAriaOwnsAttribute(element, description); 13450 this.trySetAriaDescribedByAttribute(element, description); 13451 this.trySetAttribute(element, description, AriaDescriptionAttributes.Role, "role"); 13452 this.trySetAttribute(element, description, AriaDescriptionAttributes.TabIndex, "tabindex"); 13453 this.trySetAttribute(element, description, AriaDescriptionAttributes.AriaLevel, "aria-level"); 13454 this.executeOnDescription(description, AriaDescriptionAttributes.AriaLabel, function(value) { 13455 ASPx.Attr.SetAttribute(element, "aria-label", ASPx.Str.ApplyReplacement(value, args
13455)); 13456 }); 13457 this.executeOnDescription(description, AriaDescriptionAttributes.AriaDisabled, function(value) { 13458 ASPx.Attr.SetAttribute(element, "aria-disabled", !!value); 13459 }); 13460 this.executeOnDescription(description, AriaDescriptionAttributes.AriaHasPopup, function(value) { 13461 ASPx.Attr.SetAttribute(element, "aria-haspopup", !!value); 13462 }); 13463 }, 13464 trySetAriaDescribedByAttribute: function(element, description) { 13465 this.executeOnDescription(description, AriaDescriptionAttributes.AriaDescribedBy, function(selectorInfo) { 13466 var descriptor = this.getNodesBySelector(element, selectorInfo.descriptorSelector)[0]; 13467 var target = this.getNodesBySelector(element, selectorInfo.targetSelector)[0]; 13468 if(!target || !descriptor) 13469 return; 13470 ASPx.Attr.SetAttribute(target, "aria-describedby", this.getNodeId(descriptor)); 13471 }); 13472 }, 13473 trySetAriaOwnsAttribute: function(element, description) { 13474 this.executeOnDescription(description, AriaDescriptionAttributes.AriaOwns, function(selector) { 13475 var ownedNodes = this.getNodesBySelector(element, selector); 13476 var ariaOwnsAttributeValue = ""; 13477 for(var i = 0; i < ownedNodes.length; i++) 13478 ariaOwnsAttributeValue += (this.getNodeId(ownedNodes[i]) + (i != ownedNodes.length - 1 ? " " : "")); 13479 ASPx.Attr.SetAttribute(element, "aria-owns", ariaOwnsAttributeValue); 13480 }); 13481 }, 13482 trySetAttribute: function(element, description, ariaAttribute, attributeName) { 13483 this.executeOnDescription(description, ariaAttribute, function(value) { 13484 ASPx.Attr.SetAttribute(element, attributeName, description[ariaAttribute]); 13485 }); 13486 }, 13487 executeOnDescription: function(description, ariaDescAttr, callback) { 13488 var descInfo = description[ariaDescAttr]; 13489 if(ASPx.IsExists(descInfo)) 13490 callback.aspxBind(this)(descInfo); 13491 }, 13492 getNodesBySelector: function(element, selector) { 13493 var id = element.id || ""; 13494 var childNodes = element.querySelectorAll("#" + this.getNodeId(element) + " > " + selector); 13495 ASPx.Attr.SetOrRemoveAttribute(element, "id", id); 13496 return childNodes; 13497 }, 13498 getNodeId: function(node) { 13499 if(!node.id) 13500 node.id = this.createRandomId(); 13501 return node.id; 13502 }, 13503 createRandomId: function() { 13504 return "r" + ASPx.CreateGuid(); 13505 } 13506}); 13507PagerCommands = { 13508 Next : "PBN", 13509 Prev : "PBP", 13510 Last : "PBL", 13511 First : "PBF", 13512 PageNumber : "PN", 13513 PageSize : "PSP" 13514}; 13515ASPx.callbackProcessed = false; 13516ASPx.Callback = function(result, context){ 13517 var collection = aspxGetControlCollection(); 13518 collection.DoFinalizeCallback(); 13519 var control = collection.Get(context); 13520 if(control != null) 13521 control.DoCallback(result); 13522 ASPx.RippleHelper.ReInit(); 13523 ASPx.callbackProcessed = true; 13524}; 13525ASPx.CallbackError = function(result, context){ 13526 var control = aspxGetControlCollection().Get(context); 13527 if(control != null) 13528 control.DoCallbackError(result, false); 13529 ASPx.callbackProcessed = true; 13530}; 13531ASPx.CClick = function(name, evt) { 13532 var control = aspxGetControlCollection().Get(name); 13533 if(control != null) control.DoControlClick(evt); 13534}; 13535function aspxCAInit() { 13536 var isAppInit = typeof(Sys$_Application$initialize) != "undefined" && 13537 ASPx.FunctionIsInCallstack(arguments.callee, Sys$_Application$initialize, 10 ); 13538 aspxGetControlCollection().AtlasInitialize(!isAppInit); 13539} 13540ASPx.Evt.AttachEventToElement(window, "resize", aspxGlobalWindowResize); 13541function aspxGlobalWindowResize(evt){ 13542 aspxGetControlCollection().OnBrowserWindowResize(evt); 13543} 13544ASPx.Evt.AttachEventToElement(window, "unload", aspxClassesUnload); 13545function aspxClassesUnload(evt) { 13546 aspxGetControlCollection().OnDocumentUnload(); 13547} 13548ASPx.attachToLoad(aspxClassesDOMContentLoaded); 13549function aspxClassesDOMContentLoaded(evt){ 13550 aspxGetControlCollection().DOMContentLoaded(); 13551} 13552ASPx.GetControlCollection = aspxGetControlCollection; 13553ASPx.GetControlCollectionCollection = aspxGetControlCollectionCollection; 13554ASPx.GetPersistentControlPropertiesStorage = _aspxGetPersistentControlPropertiesStorage; 13555ASPx.PagerCommands = PagerCommands; 13556ASPx.ELLIPSIS_MARKER_CLASS = ELLIPSIS_MARKER_CLASS; 13557window.ASPxClientBeginCallbackEventArgs = ASPxClientBeginCallbackEventArgs; 13558window.ASPxClientGlobalBeginCallbackEventArgs = ASPxClientGlobalBeginCallbackEventArgs; 13559window.ASPxClientEndCallbackEventArgs = ASPxClientEndCallbackEventArgs; 13560window.ASPxClientGlobalEndCallbackEventArgs = ASPxClientGlobalEndCallbackEventArgs; 13561window.ASPxClientCallbackErrorEventArgs = ASPxClientCallbackErrorEventArgs; 13562window.ASPxClientGlobalCallbackErrorEventArgs = ASPxClientGlobalCallbackErrorEventArgs; 13563window.ASPxClientCustomDataCallbackEventArgs = ASPxClientCustomDataCallbackEventArgs; 13564window.ASPxClientValidationCompletedEventArgs = ASPxClientValidationCompletedEventArgs; 13565window.ASPxClientControlsInitializedEventArgs = ASPxClientControlsInitializedEventArgs; 13566window.ASPxClientControlBeforePronounceEventArgs = ASPxClientControlBeforePronounceEventArgs; 13567window.ASPxClientControlUnloadEventArgs = ASPxClientControlUnloadEventArgs; 13568window.ASPxClientEndFocusEventArgs = ASPxClientEndFocusEventArgs; 13569window.ASPxClientItemFocusedEventArgs = ASPxClientItemFocusedEventArgs; 13570window.ASPxClientControlCollection = ASPxClientControlCollection; 13571window.ASPxClientControlBase = ASPxClientControlBase; 13572window.ASPxClientControl = ASPxClientControl; 13573window.ASPxClientComponent = ASPxClientComponent; 13574})(ASPx); 13575 13576(function () { 13577 var PositionAnimationTransition = ASPx.CreateClass(ASPx.AnimationTransitionBase, { 13578 constructor: function (element, options) { 13579 this.constructor.prototype.constructor.call(this, element, options); 13580 this.direction = options.direction; 13581 this.animationTransition = this.createAnimationTransition(); 13582 AnimationHelper.appendWKAnimationClassNameIfRequired(this.element); 13583 }, 13584 Start: function (to) { 13585 var from = this.GetValue(); 13586 if(ASPx.AnimationUtils.CanUseCssTransform()) { 13587 from = this.convertPosToCssTransformPos(from); 13588 to = this.convertPosToCssTransformPos(to); 13589 } 13590 this.animationTransition.Start(from, to); 13591 }, 13592 SetValue: function (value) { 13593 ASPx.AnimationUtils.SetTransformValue(this.element, value, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION); 13594 }, 13595 GetValue: function () { 13596 return ASPx.AnimationUtils.GetTransformValue(this.element, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION); 13597 }, 13598 createAnimationTransition: function () { 13599 var transition = ASPx.AnimationUtils.CanUseCssTransform() ? this.createTransformAnimationTransition() : this.createPositionAnimationTransition(); 13600 transition.transition = ASPx.AnimationConstants.Transitions.POW_EASE_OUT; 13601 return transition; 13602 }, 13603 createTransformAnimationTransition: function () { 13604 return ASPx.AnimationUtils.createCssAnimationTransition(this.element, { 13605 property: ASPx.AnimationUtils.CanUseCssTransform(), 13606 duration: this.duration, 13607 onComplete: this.onComplete 13608 }); 13609 }, 13610 createPositionAnimationTransition: function () { 13611 return AnimationHelper.createAnimationTransition(this.element, { 13612 property: this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION ? "top" : "left", 13613 unit: "px", 13614 duration: this.duration, 13615 onComplete: this.onComplete 13616 }); 13617 }, 13618 convertPosToCssTransformPos: function (position) { 13619 return ASPx.AnimationUtils.GetTransformCssText(position, this.direction == AnimationHelper.SLIDE_VERTICAL_DIRECTION); 13620 } 13621 }); 13622 var AnimationHelper = { 13623 SLIDE_HORIZONTAL_DIRECTION: 0, 13624 SLIDE_VERTICAL_DIRECTION: 1, 13625 SLIDE_TOP_DIRECTION: 0, 13626 SLIDE_RIGHT_DIRECTION: 1, 13627 SLIDE_BOTTOM_DIRECTION: 2, 13628 SLIDE_LEFT_DIRECTION: 3, 13629 SLIDE_CONTAINER_CLASS: "dxAC", 13630 MAXIMUM_DEPTH: 3, 13631 createAnimationTransition: function (element, options) { 13632 if(options.onStep) 13633 options.animationEngineType = AnimationEngineType.JS; 13634 switch(options.animationEngineType) { 13635 case AnimationEngineType.JS: 13636 return ASPx.AnimationUtils.createJsAnimationTransition(element, options); 13637 case AnimationEngineType.CSS: 13638 return ASPx.AnimationUtils.createCssAnimationTransition(element, options); 13639 default: 13640 return ASPx.AnimationUtils.CanUseCssTransition() ? ASPx.AnimationUtils.createCssAnimationTransition(element, options) : 13641 ASPx.AnimationUtils.createJsAnimationTransition(element, options); 13642 } 13643 }, 13644 createMultipleAnimationTransition: function (element, options) { 13645 return ASPx.AnimationUtils.createMultipleAnimationTransition(element, options); 13646 }, 13647 createSimpleAnimationTransition: function (options) { 13648 return ASPx.AnimationUtils.createSimpleAnimationTransition(options); 13649 }, 13650 cancelAnimation: function (element) { 13651 ASPx.AnimationTransitionBase.Cancel(element); 13652 }, 13653 fadeIn: function(element, onComplete, duration, animationEngineType) { 13654 AnimationHelper.fadeTo(element, { 13655 from: 0, to: 1, 13656 onComplete: onComplete, 13657 animationEngineType: animationEngineType || AnimationEngineType.DEFAULT, 13658 duration: duration || ASPx.AnimationConstants.Durations.DEFAULT 13659 }); 13660 }, 13661 fadeOut: function(element, onComplete, duration, animationEngineType) { 13662 AnimationHelper.fadeTo(element, { 13663 from: ASPx.GetElementOpacity(element), to: 0, 13664 onComplete: onComplete, 13665 animationEngineType: animationEngineType || AnimationEngineType.DEFAULT, 13666 duration: duration || ASPx.AnimationConstants.Durations.DEFAULT 13667 }); 13668 }, 13669 fadeTo: function (element, options) { 13670 options.property = "opacity"; 13671 if(!options.duration) 13672 options.duration = ASPx.AnimationConstants.Durations.SHORT; 13673 var transition = AnimationHelper.createAnimationTransition(element, options); 13674 if(!ASPx.IsExists(options.from)) 13675 options.from = transition.GetValue(); 13676 transition.Start(options.from, options.to); 13677 }, 13678 slideIn: function (element, direction, onComplete, animationEngineType, rtl) { 13679 AnimationHelper.setOpacity(element, 1); 13680 var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true); 13681 var pos = AnimationHelper.getSlideInStartPos(animationContainer, direction, rtl); 13682 var transition = AnimationHelper.createSlideTransition(animationContainer, direction, 13683 function (el) { 13684 AnimationHelper.resetSlideAnimationContainerSize(animationContainer); 13685 if(onComplete) 13686 onComplete(el); 13687 }, animationEngineType, rtl); 13688 transition.Start(pos, 0); 13689 }, 13690 slideOut: function (element, direction, onComplete, animationEngineType, rtl) { 13691 var animationContainer = AnimationHelper.getSlideAnimationContainer(element, true, true);
13692 var pos = AnimationHelper.getSlideOutFinishPos(animationContainer, direction, rtl); 13693 var transition = AnimationHelper.createSlideTransition(animationContainer, direction, 13694 function (el) { 13695 AnimationHelper.setOpacity(el.firstChild, 0); 13696 if(onComplete) 13697 onComplete(el); 13698 }, animationEngineType, rtl); 13699 transition.Start(pos); 13700 }, 13701 slideTo: function (element, options) { 13702 if(!ASPx.IsExists(options.direction)) 13703 options.direction = AnimationHelper.SLIDE_HORIZONTAL_DIRECTION; 13704 var transition = new PositionAnimationTransition(element, options); 13705 transition.Start(options.to); 13706 }, 13707 setOpacity: function (element, value) { 13708 ASPx.AnimationUtils.setOpacity(element, value); 13709 }, 13710 appendWKAnimationClassNameIfRequired: function (element) { 13711 if(ASPx.AnimationUtils.CanUseCssTransform() && ASPx.Browser.WebKitFamily && !ASPx.ElementHasCssClass(element, "dx-wbv")) 13712 element.className += " dx-wbv"; 13713 }, 13714 findSlideAnimationContainer: function (element) { 13715 var container = element; 13716 for(var i = 0; i < AnimationHelper.MAXIMUM_DEPTH; i++) { 13717 if(container.tagName == "BODY") 13718 return null; 13719 if(ASPx.ElementHasCssClass(container, AnimationHelper.SLIDE_CONTAINER_CLASS)) 13720 return container; 13721 container = container.parentNode; 13722 } 13723 return null; 13724 }, 13725 createSlideAnimationContainer: function (element) { 13726 var rootContainer = document.createElement("DIV"); 13727 ASPx.SetStyles(rootContainer, { 13728 className: AnimationHelper.SLIDE_CONTAINER_CLASS, 13729 overflow: "hidden" 13730 }); 13731 var elementContainer = document.createElement("DIV"); 13732 rootContainer.appendChild(elementContainer); 13733 var parentNode = element.parentNode; 13734 parentNode.insertBefore(rootContainer, element); 13735 elementContainer.appendChild(element); 13736 return rootContainer; 13737 }, 13738 getSlideAnimationContainer: function (element, create, fixSize) { 13739 if(!element) return; 13740 var width = element.offsetWidth; 13741 var height = element.offsetHeight; 13742 var container; 13743 if(element.className == AnimationHelper.SLIDE_CONTAINER_CLASS) 13744 container = element; 13745 if(!container) 13746 container = AnimationHelper.findSlideAnimationContainer(element); 13747 if(!container && create) 13748 container = AnimationHelper.createSlideAnimationContainer(element); 13749 if(container && fixSize) { 13750 ASPx.SetStyles(container, { 13751 width: width, height: height 13752 }); 13753 ASPx.SetStyles(container.firstChild, { 13754 width: width, height: height 13755 }); 13756 } 13757 return container; 13758 }, 13759 resetSlideAnimationContainerSize: function (container) { 13760 ASPx.SetStyles(container, { 13761 width: "", height: "" 13762 }); 13763 ASPx.SetStyles(container.firstChild, { 13764 width: "", height: "" 13765 }); 13766 }, 13767 getModifyProperty: function (direction, rtl) { 13768 if(direction == AnimationHelper.SLIDE_TOP_DIRECTION || direction == AnimationHelper.SLIDE_BOTTOM_DIRECTION) 13769 return "marginTop"; 13770 return rtl ? "margin-right" : "margin-left"; 13771 }, 13772 createSlideTransition: function (animationContainer, direction, complete, animationEngineType, rtl) { 13773 if(rtl == undefined) 13774 rtl = false; 13775 return AnimationHelper.createAnimationTransition(animationContainer.firstChild, { 13776 unit: "px", 13777 property: AnimationHelper.getModifyProperty(direction, rtl), 13778 onComplete: complete, 13779 animationEngineType: animationEngineType 13780 }); 13781 }, 13782 getSlideInStartPos: function (animationContainer, direction, rtl) { 13783 var dir = rtl ? -1 : 1; 13784 switch (direction) { 13785 case AnimationHelper.SLIDE_TOP_DIRECTION: 13786 return animationContainer.offsetHeight; 13787 case AnimationHelper.SLIDE_LEFT_DIRECTION: 13788 return animationContainer.offsetWidth * dir; 13789 case AnimationHelper.SLIDE_RIGHT_DIRECTION: 13790 return -animationContainer.offsetWidth * dir; 13791 case AnimationHelper.SLIDE_BOTTOM_DIRECTION: 13792 return -animationContainer.offsetHeight; 13793 } 13794 }, 13795 getSlideOutFinishPos: function (animationContainer, direction, rtl) { 13796 var dir = rtl ? -1 : 1; 13797 switch (direction) { 13798 case AnimationHelper.SLIDE_TOP_DIRECTION: 13799 return -animationContainer.offsetHeight; 13800 case AnimationHelper.SLIDE_LEFT_DIRECTION: 13801 return -animationContainer.offsetWidth * dir; 13802 case AnimationHelper.SLIDE_RIGHT_DIRECTION: 13803 return animationContainer.offsetWidth * dir; 13804 case AnimationHelper.SLIDE_BOTTOM_DIRECTION: 13805 return animationContainer.offsetHeight; 13806 } 13807 } 13808 }; 13809 var GestureHandler = ASPx.CreateClass(null, { 13810 constructor: function (getAnimationElement, canHandle, allowStart) { 13811 this.getAnimationElement = getAnimationElement; 13812 this.canHandle = canHandle; 13813 this.allowStart = allowStart; 13814 this.startMousePosX = 0; 13815 this.startMousePosY = 0; 13816 this.startTime = null; 13817 this.isEventsPrevented = false; 13818 this.savedElements = []; 13819 }, 13820 OnSelectStart: function(evt) { 13821 ASPx.Evt.PreventEvent(evt); 13822 }, 13823 OnDragStart: function(evt) { 13824 ASPx.Evt.PreventEvent(evt); 13825 }, 13826 OnMouseDown: function (evt) { 13827 this.startMousePosX = ASPx.Evt.GetEventX(evt); 13828 this.startMousePosY = ASPx.Evt.GetEventY(evt); 13829 this.startTime = new Date(); 13830 }, 13831 OnMouseMove: function(evt) { 13832 if(!ASPx.Browser.MobileUI) 13833 ASPx.Selection.Clear(); 13834 if(Math.abs(this.GetCurrentDistanceX(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE && Math.abs(this.GetCurrentDistanceY(evt)) < GestureHandler.SLIDER_MIN_START_DISTANCE) 13835 GesturesHelper.isExecutedGesture = false; 13836 }, 13837 OnMouseUp: function (evt) { 13838 }, 13839 CanHandleEvent: function (evt) { 13840 return !this.canHandle || this.canHandle(evt); 13841 }, 13842 IsStartAllowed: function(value) { 13843 return !this.allowStart || this.allowStart(value); 13844 }, 13845 RollbackGesture: function () { 13846 }, 13847 GetRubberPosition: function (position) { 13848 return position / GestureHandler.FACTOR_RUBBER; 13849 }, 13850 GetCurrentDistanceX: function (evt) { 13851 return ASPx.Evt.GetEventX(evt) - this.startMousePosX; 13852 }, 13853 GetCurrentDistanceY: function (evt) { 13854 return ASPx.Evt.GetEventY(evt) - this.startMousePosY; 13855 }, 13856 GetDistanceLimit: function () { 13857 return (new Date() - this.startTime) < GestureHandler.MAX_TIME_SPAN ? GestureHandler.MIN_DISTANCE_LIMIT : GestureHandler.MAX_DISTANCE_LIMIT; 13858 }, 13859 GetContainerElement: function () { 13860 }, 13861 AttachPreventEvents: function (evt) { 13862 if(!this.isEventsPrevented) { 13863 var element = ASPx.Evt.GetEventSource(evt); 13864 var container = this.GetContainerElement(); 13865 while(element && element != container) { 13866 ASPx.Evt.AttachEventToElement(element, "mouseup", ASPx.Evt.PreventEvent); 13867 ASPx.Evt.AttachEventToElement(element, "click", ASPx.Evt.PreventEvent); 13868 this.savedElements.push(element); 13869 element = element.parentNode; 13870 } 13871 this.isEventsPrevented = true; 13872 } 13873 }, 13874 DetachPreventEvents: function () { 13875 if(this.isEventsPrevented) { 13876 window.setTimeout(function () { 13877 while(this.savedElements.length > 0) { 13878 var element = this.savedElements.pop(); 13879 ASPx.Evt.DetachEventFromElement(element, "mouseup", ASPx.Evt.PreventEvent); 13880 ASPx.Evt.DetachEventFromElement(element, "click", ASPx.Evt.PreventEvent); 13881 } 13882 }.aspxBind(this), 0); 13883 this.isEventsPrevented = false; 13884 } 13885 } 13886 }); 13887 GestureHandler.MAX_DISTANCE_LIMIT = 70; 13888 GestureHandler.MIN_DISTANCE_LIMIT = 10; 13889 GestureHandler.MIN_START_DISTANCE = 0; 13890 GestureHandler.SLIDER_MIN_START_DISTANCE = 5; 13891 GestureHandler.MAX_TIME_SPAN = 300; 13892 GestureHandler.FACTOR_RUBBER = 4; 13893 GestureHandler.RETURN_ANIMATION_DURATION = 150; 13894 var SwipeSlideGestureHandler = ASPx.CreateClass(GestureHandler, { 13895 constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, move) { 13896 this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle); 13897 this.slideElement = this.getAnimationElement(); 13898 this.container = this.slideElement.parentNode; 13899 this.direction = direction; 13900 this.backward = backward; 13901 this.forward = forward; 13902 this.rollback = rollback; 13903 this.slideElementSize = 0; 13904 this.containerElementSize = 0; 13905 this.startSliderElementPosition = 0; 13906 this.centeredSlideElementPosition = 0; 13907 }, 13908 OnMouseDown: function (evt) { 13909 GestureHandler.prototype.OnMouseDown.call(this, evt); 13910 this.slideElementSize = this.GetElementSize(); 13911 this.startSliderElementPosition = this.GetElementPosition(); 13912 this.containerElementSize = this.GetContainerElementSize(); 13913 if(this.slideElementSize <= this.containerElementSize) 13914 this.centeredSlideElementPosition = (this.containerElementSize - this.slideElementSize) / 2; 13915 }, 13916 OnMouseMove: function (evt) { 13917 GestureHandler.prototype.OnMouseMove.call(this, evt); 13918 if(!ASPx.Browser.TouchUI && !ASPx.GetIsParent(this.container, ASPx.Evt.GetEventSource(evt))) { 13919 GesturesHelper.OnDocumentMouseUp(evt); 13920 return; 13921 } 13922 var distance = this.GetCurrentDistance(evt); 13923 if(Math.abs(distance) < GestureHandler.SLIDER_MIN_START_DISTANCE || ASPx.TouchUIHelper.isGesture) 13924 return; 13925 this.SetElementPosition(this.GetCalculatedPosition(distance)); 13926 this.AttachPreventEvents(evt); 13927 ASPx.Evt.PreventEvent(evt); 13928 }, 13929 GetCalculatedPosition: function (distance) { 13930 ASPx.AnimationTransitionBase.Cancel(this.slideElement); 13931 var position = this.startSliderElementPosition + distance, 13932 maxPosition = -(this.slideElementSize - this.containerElementSize), 13933 minPosition = 0; 13934 if(this.centeredSlideElementPosition > 0) 13935 position = this.GetRubberPosition(distance) + this.centeredSlideElementPosition; 13936 else if(position > minPosition) 13937 position = this.GetRubberPosition(distance); 13938 else if(position < maxPosition) 13939 position = this.GetRubberPosition(distance) + maxPosition; 13940 return position; 13941 }, 13942 OnMouseUp: function (evt) { 13943 this.DetachPreventEvents(); 13944 if(this.GetCurrentDistance(evt) != 0) 13945 this.OnMouseUpCore(evt); 13946 }, 13947 OnMouseUpCore: function (evt) { 13948 var distance = this.GetCurrentDistance(evt); 13949 if(this.centeredSlideElementPosition > 0 || this.CheckSlidePanelIsOutOfBounds()) 13950 this.PerformRollback(); 13951 else 13952 this.PerformAction(distance); 13953 }, 13954 PerformAction: function (distance) { 13955 if(Math.abs(distance) < this.GetDistanceLimit()) 13956 this.PerformRollback(); 13957 else if(distance < 0) 13958 this.PerformForward(); 13959 else 13960 this.PerformBackward(); 13961 }, 13962 PerformBackward: function () { 13963 this.backward(); 13964 }, 13965 PerformForward: function () { 13966 this.forward(); 13967 }, 13968 PerformRollback: function () { 13969 this.rollback(); 13970 }, 13971 CheckSlidePanelIsOutOfBounds: function () { 13972 var minOffset = -(this.slideElementSize - this.containerElementSize), maxOffset = 0; 13973 var slideElementPos = this.GetElementPosition(); 13974 if(slideElementPos > maxOffset || slideElementPos < minOffset) 13975 return true; 13976 return false; 13977 }, 13978 GetContainerElement: function () { 13979 return this.container; 13980 }, 13981 GetElementSize: function () { 13982 return this.IsHorizontalDirection() ? this.slideElement.offsetWidth : this.slideElement.offsetHeight; 13983 }, 13984 GetContainerElementSize: function () { 13985 return this.IsHorizontalDirection() ? ASPx.GetClearClientWidth(this.container) : ASPx.GetClearClientHeight(this.container); 13986 }, 13987 GetCurrentDistance: function (evt) { 13988 return this.IsHorizontalDirection() ? this.GetCurrentDistanceX(evt) : this.GetCurrentDistanceY(evt); 13989 }, 13990 GetElementPosition: function () { 13991 return ASPx.AnimationUtils.GetTransformValue(this.slideElement, !this.IsHorizontalDirection()); 13992 }, 13993 SetElementPosition: function (position) { 13994 ASPx.AnimationUtils.SetTransformValue(this.slideElement, position, !this.IsHorizontalDirection()); 13995 }, 13996 IsHorizontalDirection: function () { 13997 return this.direction == AnimationHelper.SLIDE_HORIZONTAL_DIRECTION; 13998 } 13999 }); 14000 var SwipeSimpleSlideGestureHandler = ASPx.CreateClass(SwipeSlideGestureHandler, { 14001 constructor: function (getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) { 14002 this.constructor.prototype.constructor.call(this, getAnimationElement, direction, canHandle, backward, forward, rollback); 14003 this.container = this.slideElement; 14004 this.updatePosition = updatePosition; 14005 this.prevDistance = 0; 14006 }, 14007 OnMouseDown: function (evt) { 14008 GestureHandler.prototype.OnMouseDown.call(this, evt); 14009 this.prevDistance = 0; 14010 }, 14011 OnMouseUpCore: function (evt) { 14012 this.PerformAction(this.GetCurrentDistance(evt)); 14013 }, 14014 PerformAction: function (distance) { 14015 if(Math.abs(distance) < this.GetDistanceLimit()) 14016 this.PerformRollback(); 14017 else if(distance < 0) 14018 this.PerformForward(); 14019 else 14020 this.PerformBackward(); 14021 }, 14022 GetCalculatedPosition: function (distance) { 14023 var position = distance - this.prevDistance; 14024 this.prevDistance = distance; 14025 return position; 14026 }, 14027 SetElementPosition: function (position) { 14028 this.updatePosition(position); 14029 } 14030 }); 14031 var SwipeGestureHandler = ASPx.CreateClass(GestureHandler, { 14032 constructor: function (getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) { 14033 this.constructor.prototype.constructor.call(this, getAnimationElement, canHandle, allowStart); 14034 this.start = start; 14035 this.allowComplete = allowComplete; 14036 this.complete = complete; 14037 this.cancel = cancel; 14038 this.animationTween = null; 14039 this.currentDistanceX = 0; 14040 this.currentDistanceY = 0; 14041 this.tryStartGesture = false; 14042 this.tryStartScrolling = false; 14043 this.animationEngineType = animationEngineType; 14044 this.rtl = rtl; 14045 this.UpdateAnimationContainer(); 14046 }, 14047 UpdateAnimationContainer: function () { 14048 this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, false); 14049 }, 14050 CanHandleEvent: function (evt) { 14051 if(GestureHandler.prototype.CanHandleEvent.call(this, evt)) 14052 return true; 14053 return this.animationTween && this.animationContainer && ASPx.GetIsParent(this.animationContainer, ASPx.Evt.GetEventSource(evt)); 14054 }, 14055 OnMouseDown: function (evt) { 14056 GestureHandler.prototype.OnMouseDown.call(this, evt); 14057 if(this.animationTween) 14058 this.animationTween.Cancel(); 14059 this.currentDistanceX = 0; 14060 this.currentDistanceY = 0; 14061 this.tryStartGesture = false; 14062 this.tryStartScrolling = false; 14063 }, 14064 OnMouseMove: function (evt) { 14065 GestureHandler.prototype.OnMouseMove.call(this, evt);
14066 var isZoomGestureConflict = evt.touches && evt.touches.length > 1; 14067 if (isZoomGestureConflict) 14068 return false; 14069 this.currentDistanceX = this.GetCurrentDistanceX(evt); 14070 this.currentDistanceY = this.GetCurrentDistanceY(evt); 14071 if(this.rtl) 14072 this.currentDistanceX = -this.currentDistanceX; 14073 if(!this.animationTween && !this.tryStartScrolling && (Math.abs(this.currentDistanceX) > 14074 GestureHandler.MIN_START_DISTANCE || Math.abs(this.currentDistanceY) > GestureHandler.MIN_START_DISTANCE)) { 14075 if(Math.abs(this.currentDistanceY) < Math.abs(this.currentDistanceX)) { 14076 this.tryStartGesture = true; 14077 if(this.IsStartAllowed(this.currentDistanceX)) { 14078 this.animationContainer = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement(), true, true); 14079 this.animationTween = AnimationHelper.createSlideTransition(this.animationContainer, AnimationHelper.SLIDE_LEFT_DIRECTION, 14080 function () { 14081 AnimationHelper.resetSlideAnimationContainerSize(this.animationContainer); 14082 this.animationContainer = null; 14083 this.animationTween = null; 14084 }.aspxBind(this), this.animationEngineType, this.rtl); 14085 this.PerformStart(this.currentDistanceX); 14086 this.AttachPreventEvents(evt); 14087 } 14088 } 14089 else 14090 this.tryStartScrolling = true; 14091 } 14092 if(this.animationTween) { 14093 if(this.allowComplete && !this.allowComplete(this.currentDistanceX)) 14094 this.currentDistanceX = this.GetRubberPosition(this.currentDistanceX); 14095 this.animationTween.SetValue(this.currentDistanceX); 14096 } 14097 if(!this.tryStartScrolling && !ASPx.TouchUIHelper.isGesture && evt.touches && evt.touches.length < 2) 14098 ASPx.Evt.PreventEvent(evt); 14099 }, 14100 OnMouseUp: function (evt) { 14101 if(!this.animationTween) { 14102 if(this.tryStartGesture) 14103 this.PerformCancel(this.currentDistanceX); 14104 } 14105 else { 14106 if(Math.abs(this.currentDistanceX) < this.GetDistanceLimit()) 14107 this.RollbackGesture(); 14108 else { 14109 if(this.IsCompleteAllowed(this.currentDistanceX)) { 14110 this.PerformComplete(this.currentDistanceX); 14111 this.animationContainer = null; 14112 this.animationTween = null; 14113 } 14114 else 14115 this.RollbackGesture(); 14116 } 14117 } 14118 this.DetachPreventEvents(); 14119 this.tryStartGesture = false; 14120 this.tryStartScrolling = false; 14121 }, 14122 PerformStart: function (value) { 14123 if(this.start) 14124 this.start(value); 14125 }, 14126 IsCompleteAllowed: function (value) { 14127 return !this.allowComplete || this.allowComplete(value); 14128 }, 14129 PerformComplete: function (value) { 14130 if(this.complete) 14131 this.complete(value); 14132 }, 14133 PerformCancel: function (value) { 14134 if(this.cancel) 14135 this.cancel(value); 14136 }, 14137 RollbackGesture: function () { 14138 this.animationTween.Start(this.currentDistanceX, 0); 14139 }, 14140 ResetGestureElementPosition: function () { 14141 if (this.currentDistanceX === 0) return; 14142 var container = AnimationHelper.getSlideAnimationContainer(this.getAnimationElement()); 14143 var onComplete = function () { AnimationHelper.resetSlideAnimationContainerSize(container); }; 14144 var animation = AnimationHelper.createSlideTransition(container, AnimationHelper.SLIDE_LEFT_DIRECTION, onComplete, this.animationEngineType, this.rtl); 14145 animation.Start(this.currentDistanceX, 0); 14146 }, 14147 GetContainerElement: function () { 14148 return this.animationContainer; 14149 } 14150 }); 14151 var GesturesHelper = { 14152 handlers: {}, 14153 activeHandler: null, 14154 isAttachedEvents: false, 14155 isExecutedGesture: false, 14156 AddSwipeGestureHandler: function (id, getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl) { 14157 this.handlers[id] = new SwipeGestureHandler(getAnimationElement, canHandle, allowStart, start, allowComplete, complete, cancel, animationEngineType, rtl); 14158 }, 14159 UpdateSwipeAnimationContainer: function (id) { 14160 if(this.handlers[id]) 14161 this.handlers[id].UpdateAnimationContainer(); 14162 }, 14163 AddSwipeSlideGestureHandler: function (id, getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition) { 14164 if(updatePosition) 14165 this.handlers[id] = new SwipeSimpleSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback, updatePosition); 14166 else 14167 this.handlers[id] = new SwipeSlideGestureHandler(getAnimationElement, direction, canHandle, backward, forward, rollback); 14168 }, 14169 getParentDXEditorWithSwipeGestures: function(element) { 14170 return ASPx.GetParent(element, function(parent) {
14171 var parentObj = ASPx.GetControlCollection().Get(parent.id); 14172 return parentObj && parentObj.supportGestures && parentObj.isSwipeGesturesEnabled(); 14173 }); 14174 }, 14175 canHandleMouseDown: function(evt) { 14176 if(!ASPx.Evt.IsLeftButtonPressed(evt)) 14177 return false; 14178 var element = ASPx.Evt.GetEventSource(evt); 14179 var dxFocusedEditor = ASPx.Ident.scripts.ASPxClientEdit && ASPx.GetFocusedEditor(); 14180 if(dxFocusedEditor && dxFocusedEditor.IsEditorElement(element)) { 14181 var elementParentDXEditorWithSwipeGestures = GesturesHelper.getParentDXEditorWithSwipeGestures(element); 14182 if(!elementParentDXEditorWithSwipeGestures || !dxFocusedEditor.IsEditorElement(elementParentDXEditorWithSwipeGestures)) 14183 return false; 14184 } 14185 var isTextEditor = element.tagName == "TEXTAREA" || element.tagName == "INPUT" && ASPx.Attr.GetAttribute(element, "type") == "text"; 14186 if(isTextEditor && document.activeElement == element) 14187 return false; 14188 return true; 14189 }, 14190 OnDocumentDragStart: function(evt) { 14191 if(GesturesHelper.activeHandler) 14192 GesturesHelper.activeHandler.OnDragStart(evt); 14193 }, 14194 OnDocumentMouseDown: function (evt) { 14195 if(!GesturesHelper.canHandleMouseDown(evt)) 14196 return; 14197 GesturesHelper.activeHandler = GesturesHelper.FindHandler(evt); 14198 if(GesturesHelper.activeHandler) 14199 GesturesHelper.activeHandler.OnMouseDown(evt); 14200 }, 14201 OnDocumentMouseMove: function (evt) { 14202 if(GesturesHelper.activeHandler) { 14203 GesturesHelper.isExecutedGesture = true; 14204 GesturesHelper.activeHandler.OnMouseMove(evt); 14205 } 14206 }, 14207 OnDocumentMouseUp: function (evt) { 14208 if(GesturesHelper.activeHandler) { 14209 GesturesHelper.activeHandler.OnMouseUp(evt); 14210 GesturesHelper.activeHandler = null; 14211 window.setTimeout(function () { GesturesHelper.isExecutedGesture = false; }, 0); 14212 } 14213 }, 14214 AttachEvents: function () { 14215 if(!GesturesHelper.isAttachedEvents) { 14216 GesturesHelper.Attach(ASPx.Evt.AttachEventToElement); 14217 GesturesHelper.isAttachedEvents = true; 14218 } 14219 }, 14220 DetachEvents: function () { 14221 if(GesturesHelper.isAttachedEvents) { 14222 GesturesHelper.Attach(ASPx.Evt.DetachEventFromElement); 14223 GesturesHelper.isAttachedEvents = false; 14224 } 14225 }, 14226 Attach: function (changeEventsMethod) { 14227 var doc = window.document; 14228 changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseDownEventName, GesturesHelper.OnDocumentMouseDown); 14229 changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseMoveEventName, GesturesHelper.OnDocumentMouseMove); 14230 changeEventsMethod(doc, ASPx.TouchUIHelper.touchMouseUpEventName, GesturesHelper.OnDocumentMouseUp); 14231 if(!ASPx.Browser.MobileUI) { 14232 changeEventsMethod(doc, "dragstart", GesturesHelper.OnDocumentDragStart); 14233 } 14234 }, 14235 FindHandler: function (evt) { 14236 var handlers = []; 14237 for(var id in GesturesHelper.handlers) { 14238 if(GesturesHelper.handlers.hasOwnProperty(id)) { 14239 var handler = GesturesHelper.handlers[id]; 14240 if(handler.CanHandleEvent && handler.CanHandleEvent(evt)) 14241 handlers.push(handler); 14242 } 14243 } 14244 if(!handlers.length) 14245 return null; 14246 handlers.sort(function (a, b) { 14247 return ASPx.GetIsParent(a.getAnimationElement(), b.getAnimationElement()) ? 1 : -1; 14248 }); 14249 return handlers[0]; 14250 }, 14251 IsExecutedGesture: function () { 14252 return GesturesHelper.isExecutedGesture; 14253 } 14254 }; 14255 GesturesHelper.AttachEvents(); 14256 var AnimationEngineType = { 14257 "DEFAULT": 0, 14258 "CSS": 1, 14259 "JS": 2 14260 }; 14261 ASPx.AnimationEngineType = AnimationEngineType; 14262 ASPx.AnimationHelper = AnimationHelper; 14263 ASPx.GesturesHelper = GesturesHelper; 14264})(); 14265 14266(function () { 14267var ASPxClientLoadingPanel = ASPx.CreateClass(ASPxClientControl, { 14268 constructor: function (name) { 14269 this.constructor.prototype.constructor.call(this, name); 14270 this.containerElementID = ""; 14271 this.containerElement = null; 14272 this.horizontalOffset = 0; 14273 this.verticalOffset = 0; 14274 this.isTextEmpty = false; 14275 this.showImage = true; 14276 this.shown = false; 14277 this.currentoffsetElement = null; 14278 this.currentX = null; 14279 this.currentY = null; 14280 }, 14281 Initialize: function () { 14282 if(this.containerElementID != "") 14283 this.containerElement = ASPx.GetElementById(this.containerElementID); 14284 ASPxClientControl.prototype.Initialize.call(this); 14285 }, 14286 SetCurrentShowArguments: function (offsetElement, x, y) { 14287 if(offsetElement == null) 14288 offsetElement = this.containerElement; 14289 if(offsetElement && !ASPx.IsValidElement(offsetElement)) 14290 offsetElement = ASPx.GetElementById(offsetElement.id); 14291 if(offsetElement == null) 14292 offsetElement = document.body; 14293 this.SetCurrentoffsetElement(offsetElement); 14294 this.currentX = x; 14295 this.currentY = y; 14296 }, 14297 SetCurrentoffsetElement: function(offsetElement) { 14298 this.ChangeTabIndexesBehindLoadingDiv(true); 14299 this.currentoffsetElement = offsetElement; 14300 delete ASPxClientControl.documentDropDownMouseDownLocked; 14301 }, 14302 GetCurrentoffsetElement: function() { 14303 return this.currentoffsetElement; 14304 }, 14305 ResetCurrentShowArguments: function () { 14306 this.SetCurrentoffsetElement(null); 14307 this.currentX = null; 14308 this.currentY = null; 14309 }, 14310 SetLoadingPanelPosAndSize: function () { 14311 var element = this.GetMainElement();
14312 this.SetLoadingPanelLocation(this.GetCurrentoffsetElement(), element, this.currentX, this.currentY, this.horizontalOffset, this.verticalOffset); 14313 }, 14314 SetLoadingDivPosAndSize: function () { 14315 var element = this.GetLoadingDiv(); 14316 if(element != null) { 14317 ASPx.SetElementDisplay(element, true); 14318 var offsetElement = this.GetCurrentoffsetElement(); 14319 this.SetLoadingDivBounds(offsetElement, element); 14320 var activeElement = document.activeElement; 14321 if(offsetElement.contains(activeElement) && !!activeElement.blur) { 14322 activeElement.blur(); 14323 if(element.tabIndex === -1) 14324 element.tabIndex = 0; 14325 } 14326 this.ChangeTabIndexesBehindLoadingDiv(false); 14327 if(offsetElement === document.body) 14328 ASPxClientControl.documentDropDownMouseDownLocked = true; 14329 } 14330 }, 14331 ShowInternal: function (offsetElement, x, y) { 14332 this.SetCurrentShowArguments(offsetElement, x, y); 14333 var element = this.GetMainElement(); 14334 ASPx.SetElementDisplay(element, true); 14335 this.SetLoadingPanelPosAndSize(); 14336 this.SetLoadingDivPosAndSize(); 14337 ASPx.GetControlCollection().AdjustControls(element); 14338 this.shown = true; 14339 }, 14340 Show: function () { 14341 this.ShowInternal(null); 14342 }, 14343 ShowInElement: function (htmlElement) { 14344 if(htmlElement) 14345 this.ShowInternal(htmlElement); 14346 }, 14347 ShowInElementByID: function (id) { 14348 var htmlElement = ASPx.GetElementById(id); 14349 this.ShowInElement(htmlElement); 14350 }, 14351 ShowAtPos: function (x, y) { 14352 this.ShowInternal(null, x, y); 14353 }, 14354 SetText: function (text) { 14355 this.isTextEmpty = (text == null || text == ""); 14356 var textLabel = this.GetTextLabel(); 14357 if(textLabel) 14358 textLabel.innerHTML = this.isTextEmpty ? " " : text; 14359 }, 14360 GetText: function () { 14361 return this.isTextEmpty ? "" : this.GetTextLabel().innerHTML; 14362 }, 14363 Hide: function () { 14364 var element = this.GetMainElement(); 14365 ASPx.SetElementDisplay(element, false); 14366 element = this.GetLoadingDiv(); 14367 if(element != null) { 14368 ASPx.SetStyles(element, { width: 1, height: 1 }); 14369 ASPx.SetElementDisplay(element, false); 14370 element.tabIndex = -1; 14371 } 14372 this.ResetCurrentShowArguments(); 14373 this.shown = false; 14374 }, 14375 GetTextLabel: function () { 14376 return this.GetChildElement("TL"); 14377 }, 14378 GetVisible: function () { 14379 return ASPx.GetElementDisplay(this.GetMainElement()); 14380 }, 14381 SetVisible: function (visible) { 14382 if(visible && !this.IsVisible()) 14383 this.Show(); 14384 else if(!visible && this.IsVisible()) 14385 this.Hide(); 14386 }, 14387 BrowserWindowResizeSubscriber: function () { 14388 return true; 14389 }, 14390 OnBrowserWindowResize: function () { 14391 if(this.shown) { 14392 this.SetLoadingPanelPosAndSize(); 14393 this.SetLoadingDivPosAndSize(); 14394 } 14395 }, 14396 ChangeTabIndexesBehindLoadingDiv: function(restore) { 14397 var offsetElement = this.GetCurrentoffsetElement(); 14398 if(!this.GetLoadingDiv() || !offsetElement) return; 14399 var elements = restore ? this.elementsToRestoreTabIndex : ASPx.GetCanBeActiveElementsInContainer(offsetElement); 14400 this.elementsToRestoreTabIndex = []; 14401 ASPx.Data.ForEach(elements, function(element) { 14402 var manager = ASPx.ControlTabIndexManager.getInstance(); 14403 if(restore) 14404 manager.restoreTabIndexAttribute(element, this.GetMainElement().id); 14405 else { 14406 this.elementsToRestoreTabIndex.push(element); 14407 manager.changeTabIndexAttribute(element, this.GetMainElement().id); 14408 } 14409 }.aspxBind(this)); 14410 } 14411}); 14412ASPxClientLoadingPanel.Cast = ASPxClientControl.Cast; 14413window.ASPxClientLoadingPanel = ASPxClientLoadingPanel; 14414})(); 14415 14416(function () { 14417var ASPxClientCallback = ASPx.CreateClass(ASPxClientComponent, { 14418 constructor: function (name) { 14419 this.constructor.prototype.constructor.call(this, name); 14420 this.CallbackComplete = new ASPxClientEvent(); 14421 }, 14422 SendCallback: function (parameter) { 14423 this.PerformCallback(parameter); 14424 }, 14425 PerformCallback: function (parameter, onSuccess) { 14426 if (!ASPx.IsExists(parameter)) parameter = ""; 14427 this.CreateCallback(parameter, null, onSuccess); 14428 }, 14429 OnCallback: function (result) { 14430 result.parameter = ASPx.Str.DecodeHtmlViaTextArea(result.parameter); 14431 var args = new ASPxClientCallbackCompleteEventArgs(result.parameter, result.data); 14432 this.CallbackComplete.FireEvent(this, args); 14433 } 14434}); 14435ASPxClientCallback.Cast = ASPxClientControl.Cast; 14436var ASPxClientCallbackCompleteEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 14437 constructor: function (parameter, result) { 14438 this.constructor.prototype.constructor.call(this); 14439 this.parameter = parameter; 14440 this.result = result; 14441 } 14442}); 14443window.ASPxClientCallback = ASPxClientCallback; 14444window.ASPxClientCallbackCompleteEventArgs = ASPxClientCallbackCompleteEventArgs; 14445})(); 14446 14447(function () { 14448var PopupUtils = { 14449 NotSetAlignIndicator: "NotSet", 14450 InnerAlignIndicator: "Sides", 14451 OutsideLeftAlignIndicator: "OutsideLeft", 14452 LeftSidesAlignIndicator: "LeftSides", 14453 RightSidesAlignIndicator: "RightSides", 14454 OutsideRightAlignIndicator: "OutsideRight", 14455 CenterAlignIndicator: "Center", 14456 AboveAlignIndicator: "Above", 14457 TopSidesAlignIndicator: "TopSides", 14458 MiddleAlignIndicator: "Middle", 14459 BottomSidesAlignIndicator: "BottomSides", 14460 BelowAlignIndicator: "Below", 14461 WindowCenterAlignIndicator: "WindowCenter", 14462 LeftAlignIndicator: "Left", 14463 RightAlignIndicator: "Right", 14464 TopAlignIndicator: "Top", 14465 BottomAlignIndicator: "Bottom", 14466 WindowLeftAlignIndicator: "WindowLeft", 14467 WindowRightAlignIndicator: "WindowRight", 14468 WindowTopAlignIndicator: "WindowTop", 14469 WindowBottomAlignIndicator: "WindowBottom", 14470 IsAlignNotSet: function (align) { 14471 return align == PopupUtils.NotSetAlignIndicator; 14472 }, 14473 IsInnerAlign: function (align) { 14474 return align.indexOf(PopupUtils.InnerAlignIndicator) != -1; 14475 }, 14476 IsRightSidesAlign: function(align) { 14477 return align == PopupUtils.RightSidesAlignIndicator; 14478 }, 14479 IsOutsideRightAlign: function(align) { 14480 return align == PopupUtils.OutsideRightAlignIndicator; 14481 }, 14482 IsCenterAlign: function(align) { 14483 return align == PopupUtils.CenterAlignIndicator; 14484 }, 14485 FindPopupElementById: function (id) { 14486 if(id == "") 14487 return null; 14488 var popupElement = ASPx.GetElementById(id); 14489 if(!ASPx.IsExistsElement(popupElement)) { 14490 var idParts = id.split("_"); 14491 var uniqueId = idParts.join("$"); 14492 popupElement = ASPx.GetElementById(uniqueId); 14493 } 14494 return popupElement; 14495 }, 14496 FindEventSourceParentByTestFunc: function (evt, testFunc) { 14497 return ASPx.GetParent(ASPx.Evt.GetEventSource(evt), testFunc); 14498 }, 14499 PreventContextMenu: function (evt) { 14500 ASPx.Evt.PreventEventAndBubble(evt); 14501 if(ASPx.Browser.WebKitFamily) 14502 evt.returnValue = false; 14503 }, 14504 GetDocumentClientWidthForPopup: function() { 14505 return ASPx.Browser.WebKitTouchUI ? document.body.offsetWidth : ASPx.GetDocumentClientWidth(); 14506 }, 14507 GetDocumentClientHeightForPopup: function() { 14508 return ASPx.Browser.WebKitTouchUI ? document.body.offsetHeight : ASPx.GetDocumentClientHeight(); 14509 }, 14510 AdjustPositionToClientScreen: function (element, pos, rtl, isX) { 14511 var min = isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(), 14512 max = min + (isX ? ASPx.GetDocumentClientWidth() : ASPx.GetDocumentClientHeight()); 14513 max -= (isX ? element.offsetWidth : element.offsetHeight); 14514 if(rtl && isX) { 14515 if(pos < min) pos = min; 14516 if(pos > max) pos = max; 14517 } else { 14518 if(pos > max) pos = max; 14519 if(pos < min) pos = min; 14520 } 14521 return pos; 14522 }, 14523 GetPopupAbsoluteX: function(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn, showPopupInsideScreenBounds) { 14524 return PopupUtils.getPopupAbsolutePos(element, popupElement, hAlign, hOffset, x, left, rtl, isPopupFullCorrectionOn, false, false, true, showPopupInsideScreenBounds); 14525 }, 14526 GetPopupAbsoluteY: function(element, popupElement, vAlign, vOffset, y, top, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, showPopupInsideScreenBounds) { 14527 return PopupUtils.getPopupAbsolutePos(element, popupElement, vAlign, vOffset, y, top, false, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, false, showPopupInsideScreenBounds); 14528 }, 14529 getPopupAbsolutePos: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal, showPopupInsideScreenBounds) { 14530 var calculator = getPositionCalculator(); 14531 calculator.applyParams(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal, showPopupInsideScreenBounds); 14532 var position = calculator.getPopupAbsolutePos(); 14533 calculator.disposeState(); 14534 return position; 14535 }, 14536 InitAnimationProperties: function(element, onAnimStopCallString) { 14537 element.popuping = true; 14538 element.onAnimStopCallString = onAnimStopCallString; 14539 }, 14540 InitAnimationDiv: function (element, x, y, onAnimStopCallString, skipSizeInit) { 14541 PopupUtils.InitAnimationProperties(element, onAnimStopCallString); 14542 PopupUtils.InitAnimationDivCore(element); 14543 if(!skipSizeInit) { 14544 ASPx.SetStyles(element, { width: "", height: "" }); 14545 ASPx.SetStyles(element, { width: element.offsetWidth, height: element.offsetHeight });
14546 } 14547 ASPx.SetStyles(element, { left: x, top: y }); 14548 }, 14549 InitAnimationDivCore: function (element) { 14550 ASPx.SetStyles(element, { 14551 overflow: "hidden", 14552 position: "absolute" 14553 }); 14554 }, 14555 StartSlideAnimation: function (animationDivElement, element, iframeElement, duration, preventChangingWidth, preventChangingHeight) { 14556 if(iframeElement) { 14557 var endLeft = ASPx.PxToInt(iframeElement.style.left); 14558 var endTop = ASPx.PxToInt(iframeElement.style.top); 14559 var startLeft = ASPx.PxToInt(element.style.left) < 0 ? endLeft : animationDivElement.offsetLeft + animationDivElement.offsetWidth; 14560 var startTop = ASPx.PxToInt(element.style.top) < 0 ? endTop : animationDivElement.offsetTop + animationDivElement.offsetHeight; 14561 var properties = { 14562 left: { from: startLeft, to: endLeft, unit: "px" }, 14563 top: { from: startTop, to: endTop, unit: "px" } 14564 }; 14565 if(!preventChangingWidth) 14566 properties.width = { to: element.offsetWidth, unit: "px" }; 14567 if(!preventChangingHeight) 14568 properties.height = { to: element.offsetHeight, unit: "px" }; 14569 ASPx.AnimationHelper.createMultipleAnimationTransition(iframeElement, { 14570 duration: duration 14571 }).Start(properties); 14572 } 14573 ASPx.AnimationHelper.createMultipleAnimationTransition(element, { 14574 duration: duration, 14575 onComplete: function () { PopupUtils.AnimationFinished(animationDivElement, element); } 14576 }).Start({ 14577 left: { to: 0, unit: "px" }, 14578 top: { to: 0, unit: "px" } 14579 }); 14580 }, 14581 AnimationFinished: function (animationDivElement, element) { 14582 if(PopupUtils.StopAnimation(animationDivElement, element) && ASPx.IsExists(animationDivElement.onAnimStopCallString) && 14583 animationDivElement.onAnimStopCallString !== "") { 14584 window.setTimeout(animationDivElement.onAnimStopCallString, 0); 14585 } 14586 }, 14587 StopAnimation: function (animationDivElement, element) { 14588 if(animationDivElement.popuping) { 14589 ASPx.AnimationHelper.cancelAnimation(element); 14590 animationDivElement.popuping = false; 14591 animationDivElement.style.overflow = "visible"; 14592 return true; 14593 } 14594 return false; 14595 }, 14596 GetAnimationHorizontalDirection: function (popupPosition, horizontalAlign, verticalAlign, rtl) { 14597 if(PopupUtils.IsInnerAlign(horizontalAlign) 14598 && !PopupUtils.IsInnerAlign(verticalAlign) 14599 && !PopupUtils.IsAlignNotSet(verticalAlign)) 14600 return 0; 14601 var toTheLeft = (horizontalAlign == PopupUtils.OutsideLeftAlignIndicator || horizontalAlign == PopupUtils.RightSidesAlignIndicator || (horizontalAlign == PopupUtils.NotSetAlignIndicator && rtl)) ^ popupPosition.isInverted; 14602 return toTheLeft ? 1 : -1; 14603 }, 14604 GetAnimationVerticalDirection: function (popupPosition, horizontalAlign, verticalAlign) { 14605 if(PopupUtils.IsInnerAlign(verticalAlign) 14606 && !PopupUtils.IsInnerAlign(horizontalAlign) 14607 && !PopupUtils.IsAlignNotSet(horizontalAlign)) 14608 return 0; 14609 var toTheTop = (verticalAlign == PopupUtils.AboveAlignIndicator || verticalAlign == PopupUtils.BottomSidesAlignIndicator) ^ popupPosition.isInverted; 14610 return toTheTop ? 1 : -1; 14611 }, 14612 IsVerticalScrollExists: function () { 14613 var scrollIsNotHidden = ASPx.GetCurrentStyle(document.body).overflowY !== "hidden" && ASPx.GetCurrentStyle(document.documentElement).overflowY !== "hidden"; 14614 return (scrollIsNotHidden && ASPx.GetDocumentHeight() > ASPx.GetDocumentClientHeight()); 14615 }, 14616 CoordinatesInDocumentRect: function (x, y) { 14617 var docScrollLeft = ASPx.GetDocumentScrollLeft(); 14618 var docScrollTop = ASPx.GetDocumentScrollTop(); 14619 return (x > docScrollLeft && y > docScrollTop && 14620 x < ASPx.GetDocumentClientWidth() + docScrollLeft && 14621 y < ASPx.GetDocumentClientHeight() + docScrollTop); 14622 }, 14623 GetElementZIndexArray: function (element) { 14624 var currentElement = element; 14625 var zIndexesArray = [0]; 14626 while(currentElement && currentElement.tagName != "BODY") { 14627 if(currentElement.style) { 14628 if(typeof (currentElement.style.zIndex) != "undefined" && currentElement.style.zIndex != "") 14629 zIndexesArray.unshift(currentElement.style.zIndex); 14630 } 14631 currentElement = currentElement.parentNode; 14632 } 14633 return zIndexesArray; 14634 }, 14635 IsHigher: function (higherZIndexArrat, zIndexArray) { 14636 if(zIndexArray == null) return true; 14637 var count = (higherZIndexArrat.length >= zIndexArray.length) ? higherZIndexArrat.length : zIndexArray.length; 14638 for(var i = 0; i < count; i++) 14639 if(typeof (higherZIndexArrat[i]) != "undefined" && typeof (zIndexArray[i]) != "undefined") { 14640 var higherZIndexArrayCurrentElement = parseInt(higherZIndexArrat[i].toString()); 14641 var zIndexArrayCurrentElement = parseInt(zIndexArray[i].toString()); 14642 if(higherZIndexArrayCurrentElement != zIndexArrayCurrentElement) 14643 return higherZIndexArrayCurrentElement > zIndexArrayCurrentElement; 14644 } else return typeof (zIndexArray[i]) == "undefined"; 14645 return true; 14646 }, 14647 TestIsPopupElement: function (element) { 14648 return !!element.DXPopupElementControl; 14649 }, 14650 adjustViewportScrollWrapper: function(wrapper, wrapperScroll, windowElement) { 14651 var document = wrapper.ownerDocument; 14652 var window = document.defaultView || document.parentWindow; 14653 var isWindowElementDisplayed = ASPx.IsElementDisplayed(windowElement); 14654 if(!isWindowElementDisplayed) { 14655 wrapper.style.cssText = ""; 14656 wrapperScroll.style.cssText = ""; 14657 return; 14658 } 14659 var windowRect = windowElement.getBoundingClientRect(); 14660 var yAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.top, windowRect.top, windowElement.offsetHeight, window.innerHeight, wrapper.scrollTop); 14661 var xAxis = this.calculateViewPortScrollDataByAxis(wrapper.style.left, windowRect.left, windowElement.offsetWidth, window.innerWidth, wrapper.scrollLeft); 14662 this.prepareViewPortScrollData(xAxis, yAxis); 14663 ASPx.SetStyles(windowElement, { 14664 top: yAxis.windowOffset,
14665 left: xAxis.windowOffset 14666 }); 14667 ASPx.SetStyles(wrapper, { 14668 width: xAxis.wrapperSize, 14669 height: yAxis.wrapperSize, 14670 position: "absolute", 14671 overflow: ASPx.Browser.MobileUI ? "scroll" : "auto", 14672 zIndex: windowElement.style.zIndex 14673 }); 14674 ASPx.SetAbsoluteX(wrapper, ASPx.GetDocumentScrollLeft()); 14675 ASPx.SetAbsoluteY(wrapper, ASPx.GetDocumentScrollTop()); 14676 ASPx.SetStyles(wrapperScroll, { 14677 width: xAxis.wrapperScrollSize, 14678 height: yAxis.wrapperScrollSize, 14679 position: "absolute", 14680 overflow: "hidden" 14681 }); 14682 wrapper.scrollLeft = xAxis.scrollSize; 14683 wrapper.scrollTop = yAxis.scrollSize; 14684 }, 14685 calculateViewPortScrollDataByAxis: function(wrapperOffsetStyle, windowOffset, windowSize, viewPortSize, scrollSize) { 14686 var isWindowOffsetNegative = windowOffset < 0; 14687 windowOffset = isWindowOffsetNegative ? 0 : windowOffset; 14688 var wrapperScrollSize = Math.max(viewPortSize + Math.abs(Math.min(0, windowOffset)), windowSize + Math.abs(windowOffset)); 14689 return { 14690 windowOffset: isWindowOffsetNegative ? 0 : windowOffset, 14691 wrapperSize: viewPortSize, 14692 wrapperScrollSize: wrapperScrollSize, 14693 scrollSize: isWindowOffsetNegative ? scrollSize + Math.abs(windowOffset) : 0, 14694 hasScroll: wrapperScrollSize > viewPortSize 14695 }; 14696 }, 14697 prepareViewPortScrollData: function(xAxis, yAxis) { 14698 var scrollBarSize = ASPx.GetVerticalScrollBarWidth(); 14699 if(yAxis.hasScroll && !xAxis.hasScroll) { 14700 xAxis.wrapperScrollSize = Math.min(xAxis.wrapperSize - scrollBarSize, xAxis.wrapperScrollSize); 14701 } else if(xAxis.hasScroll && !yAxis.hasScroll) { 14702 yAxis.wrapperScrollSize = Math.min(yAxis.wrapperSize - scrollBarSize, yAxis.wrapperScrollSize); 14703 } else if(yAxis.hasScroll && xAxis.hasScroll) { 14704 yAxis.wrapperScrollSize -= scrollBarSize; 14705 xAxis.wrapperScrollSize -= scrollBarSize; 14706 } 14707 } 14708}; 14709PopupUtils.OverControl = { 14710 GetPopupElementByEvt: function (evt) { 14711 return PopupUtils.FindEventSourceParentByTestFunc(evt, PopupUtils.TestIsPopupElement); 14712 }, 14713 OnMouseEvent: function (evt, mouseOver) { 14714 var popupElement = PopupUtils.OverControl.GetPopupElementByEvt(evt); 14715 if(mouseOver) 14716 popupElement.DXPopupElementControl.OnPopupElementMouseOver(evt, popupElement); 14717 else 14718 popupElement.DXPopupElementControl.OnPopupElementMouseOut(evt, popupElement); 14719 }, 14720 OnMouseOut: function (evt) { 14721 PopupUtils.OverControl.OnMouseEvent(evt, false); 14722 }, 14723 OnMouseOver: function (evt) { 14724 PopupUtils.OverControl.OnMouseEvent(evt, true); 14725 } 14726}; 14727PopupUtils.BodyScrollHelper = (function () { 14728 var windowScrollLock = {}, 14729 windowScroll = {}, 14730 hideScrollbarsClassName = "dxpc-hideScrollbars"; 14731 function lockWindowScroll(windowId) { 14732 windowScrollLock[windowId] = true; 14733 } 14734 function unlockWindowScroll(windowId) { 14735 delete windowScrollLock[windowId]; 14736 } 14737 function isLocked(windowId) { 14738 return !!windowScrollLock[windowId]; 14739 } 14740 function isAnyWindowScrollLocked() { 14741 for(var key in windowScrollLock) 14742 if (windowScrollLock.hasOwnProperty(key) && windowScrollLock[key] === true) 14743 return true; 14744 return false; 14745 } 14746 function replaceVerticalScrollByPadding() { 14747 var currentBodyStyle = ASPx.GetCurrentStyle(document.body), 14748 paddingWidth = ASPx.GetVerticalScrollBarWidth() + ASPx.PxToInt(currentBodyStyle.paddingRight); 14749 ASPx.Attr.ChangeStyleAttribute(document.body, "padding-right", paddingWidth + "px"); 14750 } 14751 function changeOverflow() { 14752 ASPx.Attr.ChangeStyleAttribute(document.documentElement, "overflow", "hidden"); 14753 if(ASPx.GetCurrentStyle(document.body).overflowY === "scroll") 14754 ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden"); 14755 resetOverflowCache(); 14756 } 14757 function restoreOverflow() { 14758 ASPx.Attr.RestoreStyleAttribute(document.documentElement, "overflow"); 14759 ASPx.Attr.RestoreStyleAttribute(document.body, "overflow"); 14760 resetOverflowCache(); 14761 } 14762 function resetOverflowCache() { 14763 ASPx.verticalScrollIsNotHidden = null; 14764 ASPx.horizontalScrollIsNotHidden = null; 14765 } 14766 function saveScrollPosition(windowId) { 14767 windowScroll[windowId] = { 14768 x: window.pageXOffset, 14769 y: window.pageYOffset 14770 }; 14771 } 14772 function restoreScrollPosition(windowId) { 14773 var currentWindowScroll = windowScroll[windowId]; 14774 if(!!currentWindowScroll) 14775 window.scrollTo(currentWindowScroll.x, currentWindowScroll.y); 14776 } 14777 function restoreBodyScroll(windowId) { 14778 unlockWindowScroll(windowId); 14779 if(isAnyWindowScrollLocked()) 14780 return; 14781 if(ASPx.Browser.WebKitTouchUI) { 14782 ASPx.Attr.RestoreStyleAttribute(document.body, "position"); 14783 ASPx.Attr.RestoreStyleAttribute(document.body, "height"); 14784 ASPx.Attr.RestoreStyleAttribute(document.body, "margin"); 14785 ASPx.RemoveClassNameFromElement(document.documentElement, hideScrollbarsClassName); 14786 ASPx.Attr.RestoreStyleAttribute(document.body, "overflow"); 14787 restoreScrollPosition(windowId); 14788 } else { 14789 restoreOverflow(); 14790 restoreScrollPosition(windowId); 14791 } 14792 if(ASPx.Browser.Chrome) 14793 var dummy = document.documentElement.scrollTop; 14794 ASPx.Attr.RestoreStyleAttribute(document.body, "padding-right"); 14795 ASPx.Attr.RestoreStyleAttribute(document.body, "height"); 14796 ASPx.Attr.RestoreStyleAttribute(document.body, "width"); 14797 } 14798 return { 14799 RestoreIfLocked: function(windowId) { 14800 if(isLocked(windowId)) 14801 restoreBodyScroll(windowId); 14802 }, 14803 HideBodyScroll: function(windowId) { 14804 if(isAnyWindowScrollLocked()) { 14805 lockWindowScroll(windowId); 14806 return; 14807 } 14808 lockWindowScroll(windowId); 14809 if(PopupUtils.IsVerticalScrollExists()) 14810 replaceVerticalScrollByPadding(); 14811 if(ASPx.Browser.WebKitTouchUI) { 14812 saveScrollPosition(windowId); 14813 ASPx.Attr.ChangeStyleAttribute(document.body, "overflow", "hidden"); 14814 ASPx.Attr.ChangeStyleAttribute(document.body, "position", "relative"); 14815 ASPx.Attr.ChangeStyleAttribute(document.body, "height", "100%"); 14816 ASPx.Attr.ChangeStyleAttribute(document.body, "margin", "0"); 14817 ASPx.AddClassNameToElement(document.documentElement, hideScrollbarsClassName); 14818 } else { 14819 saveScrollPosition(windowId); 14820 changeOverflow(); 14821 var documentHeight = ASPx.GetDocumentHeight(); 14822 var documentWidth = ASPx.GetDocumentWidth(); 14823 if(window.pageYOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentHeight) 14824 ASPx.Attr.ChangeStyleAttribute(document.body, "height", documentHeight + "px"); 14825 if(window.pageXOffset > 0 && ASPx.PxToInt(window.getComputedStyle(document.body, null)) != documentWidth) 14826 ASPx.Attr.ChangeStyleAttribute(document.body, "width", documentWidth + "px"); 14827 } 14828 }, 14829 RestoreBodyScroll: restoreBodyScroll 14830 }; 14831})(); 14832var PositionAlignConsts = { 14833 NOT_SET: 0, 14834 OUTSIDE_START: 1, 14835 NEAR_BOUND_START: 2, 14836 INNER_START: 3,
14837 CENTER: 4, 14838 INNER_END: 5, 14839 NEAR_BOUND_END: 6, 14840 OUTSIDE_END: 7, 14841 WINDOW_CENTER: 8, 14842 WINDOW_START: 9, 14843 WINDOW_END: 10 14844}; 14845var AlignIndicatorTable = {}; 14846var PositionCalculator = ASPx.CreateClass(null, { 14847 constructor: function() { 14848 this.element = null; 14849 this.popupElement = null; 14850 this.align = 0; 14851 this.offset = 0; 14852 this.startPos = 0; 14853 this.startPosInit = 0; 14854 this.rtl = false; 14855 this.isPopupFullCorrectionOn = false; 14856 this.isHorizontal = true; 14857 this.size = 0; 14858 this.bodySize = 0; 14859 this.actualBodySize = 0; 14860 this.elementStartPos = 0; 14861 this.scrollStartPos = 0; 14862 this.isInverted = false; 14863 this.popupElementSize = 0; 14864 this.boundStartPos = 0; 14865 this.boundEndPos = 0; 14866 this.innerBoundStartPos = 0; 14867 this.innerBoundEndPos = 0; 14868 this.isMoreFreeSpaceLeft = false; 14869 this.nearBoundOverlapRate = 0.25; 14870 this.functionsTable = {}; 14871 this.initializeFunctionsTable(); 14872 }, 14873 applyParams: function(element, popupElement, align, offset, startPos, startPosInit, rtl, isPopupFullCorrectionOn, ignoreAlignWithoutScrollReserve, ignorePopupElementBorders, isHorizontal, showPopupInsideScreenBounds) { 14874 this.isHorizontal = isHorizontal; 14875 this.element = element; 14876 this.popupElement = popupElement; 14877 this.align = this.getAlignValueFromIndicator(align); 14878 this.offset = offset; 14879 this.startPos = startPos; 14880 this.startPosInit = startPosInit; 14881 this.rtl = rtl; 14882 this.isPopupFullCorrectionOn = isPopupFullCorrectionOn; 14883 this.ignoreAlignWithoutScrollReserve = ignoreAlignWithoutScrollReserve; 14884 this.ignorePopupElementBorders = ignorePopupElementBorders; 14885 this.showPopupInsideScreenBounds = showPopupInsideScreenBounds; 14886 this.calculateParams(); 14887 }, 14888 disposeState: function() { 14889 this.element = null; 14890 this.popupElement = null; 14891 }, 14892 getPopupAbsolutePos: function() { 14893 if(this.isWindowAlign()) { 14894 var showAtPos = this.startPos != ASPx.InvalidPosition && !this.popupElement; 14895 if(showAtPos) 14896 this.align = PositionAlignConsts.NOT_SET; 14897 else 14898 return this.getWindowAlignPos(); 14899 } 14900 if(this.popupElement) 14901 this.calculatePopupElement(); 14902 else 14903 this.align = PositionAlignConsts.NOT_SET; 14904 return this.getPopupAbsolutePosCore(); 14905 }, 14906 initializeFunctionsTable: function() { 14907 var table = this.functionsTable; 14908 table[PositionAlignConsts.NOT_SET] = this.calculateNotSet; 14909 table[PositionAlignConsts.OUTSIDE_START] = this.calculateOutsideStart; 14910 table[PositionAlignConsts.INNER_START] = this.calculateInnerStart; 14911 table[PositionAlignConsts.CENTER] = this.calculateCenter; 14912 table[PositionAlignConsts.INNER_END] = this.calculateInnerEnd; 14913 table[PositionAlignConsts.OUTSIDE_END] = this.calculateOutsideEnd; 14914 table[PositionAlignConsts.NEAR_BOUND_START] = this.calculateNearBoundStart; 14915 table[PositionAlignConsts.NEAR_BOUND_END] = this.calculateNearBoundEnd; 14916 table[PositionAlignConsts.WINDOW_CENTER] = this.calculateWindowCenter; 14917 table[PositionAlignConsts.WINDOW_START] = this.calculateWindowStart; 14918 table[PositionAlignConsts.WINDOW_END] = this.calculateWindowEnd; 14919 }, 14920 calculateParams: function() { 14921 this.size = this.getElementSize(); 14922 if(this.isHorizontal) { 14923 this.bodySize = ASPx.GetDocumentClientWidth(); 14924 this.elementStartPos = ASPx.GetAbsoluteX(this.popupElement) + this.getBorderCorrection(); 14925 this.scrollStartPos = ASPx.GetDocumentScrollLeft(); 14926 } 14927 else { 14928 this.bodySize = ASPx.GetDocumentClientHeight(); 14929 this.elementStartPos = ASPx.GetAbsoluteY(this.popupElement) + this.getBorderCorrection(); 14930 this.scrollStartPos = ASPx.GetDocumentScrollTop(); 14931 } 14932 }, 14933 getBorderCorrection: function() { 14934 if(!this.ignorePopupElementBorders) 14935 return 0; 14936 var style = getComputedStyle(this.popupElement); 14937 return ASPx.PxToInt(this.isHorizontal ? style.borderLeftWidth : style.borderTopWidth); 14938 }, 14939 isWindowAlign: function() { 14940 return this.align == PositionAlignConsts.WINDOW_CENTER || this.align == PositionAlignConsts.WINDOW_START || 14941 this.align == PositionAlignConsts.WINDOW_END; 14942 }, 14943 getWindowAlignPos: function() { 14944 this.actualBodySize = ASPx.Browser.WebKitTouchUI ? this.getWindowInnerSize() : this.bodySize; 14945 return this.getPopupAbsolutePosCore(); 14946 }, 14947 getPopupAbsolutePosCore: function() { 14948 var calculationFunc = this.functionsTable[this.align]; 14949 calculationFunc.call(this); 14950 return new ASPx.PopupPosition(this.startPos, this.isInverted); 14951 }, 14952 calculateWindowCenter: function() { 14953 this.startPos = Math.max(Math.ceil(this.actualBodySize / 2 - this.size / 2), 0) + this.scrollStartPos + this.offset; 14954 }, 14955 calculateWindowStart: function() { 14956 this.startPos = this.scrollStartPos + this.offset; 14957 }, 14958 calculateWindowEnd: function() { 14959 this.startPos = this.scrollStartPos + this.actualBodySize - this.size + this.offset; 14960 }, 14961 calculatePopupElement: function() { 14962 this.popupElementSize = this.getPopupElementSize(); 14963 this.boundStartPos = this.elementStartPos - this.size; 14964 this.boundEndPos = this.elementStartPos + this.popupElementSize; 14965 this.innerBoundStartPos = this.elementStartPos; 14966 this.innerBoundEndPos = this.elementStartPos + this.popupElementSize - this.size; 14967 var hasLeftScrollReserve = this.boundStartPos >= 0;
14968 this.isMoreFreeSpaceLeft = (this.bodySize - (this.boundEndPos + this.size) < this.boundStartPos - 2 * this.scrollStartPos) && (!this.ignoreAlignWithoutScrollReserve || hasLeftScrollReserve); 14969 }, 14970 calculateOutsideStart: function() { 14971 this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundStartPos - this.scrollStartPos > 0 || this.isMoreFreeSpaceLeft)); 14972 if(this.isInverted) 14973 this.startPos = this.boundEndPos - this.offset; 14974 else 14975 this.startPos = this.boundStartPos + this.offset; 14976 }, 14977 calculateInnerStart: function() { 14978 this.startPos = this.innerBoundStartPos + this.offset; 14979 if(this.isPopupFullCorrectionOn) 14980 this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal); 14981 }, 14982 calculateCenter: function() { 14983 this.startPos = this.elementStartPos + Math.round((this.popupElementSize - this.size) / 2) + this.offset; 14984 if(this.showPopupInsideScreenBounds) { 14985 if(this.startPos < 0) 14986 this.startPos = 0; 14987 if(this.startPos + this.size > this.bodySize) 14988 this.startPos = this.bodySize - this.size; 14989 } 14990 }, 14991 calculateInnerEnd: function() { 14992 this.startPos = this.innerBoundEndPos + this.offset; 14993 if(this.isPopupFullCorrectionOn) 14994 this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal); 14995 }, 14996 calculateOutsideEnd: function() { 14997 this.isInverted = this.isPopupFullCorrectionOn && (!(this.boundEndPos + this.size < this.bodySize + this.scrollStartPos || !this.isMoreFreeSpaceLeft)); 14998 if(this.isInverted) 14999 this.startPos = this.boundStartPos - this.offset; 15000 else 15001 this.startPos = this.boundEndPos + this.offset; 15002 }, 15003 calculateNotSet: function() { 15004 if(this.rtl) 15005 this.calculateNotSetRightToLeft(); 15006 else 15007 this.calculateNotSetLeftToRight(); 15008 }, 15009 calculateNotSetLeftToRight: function() { 15010 if(!ASPx.IsValidPosition(this.startPos)) { 15011 if(this.popupElement) 15012 this.startPos = this.elementStartPos; 15013 else if(this.offset) 15014 this.startPos = 0; 15015 else 15016 this.startPos = this.startPosInit; 15017 } 15018 this.isInverted = this.isPopupFullCorrectionOn && (this.startPos - this.scrollStartPos + this.size > this.bodySize && this.startPos - this.scrollStartPos > this.bodySize / 2); 15019 if(this.isInverted) 15020 this.startPos = this.startPos - this.size - this.offset; 15021 else 15022 this.startPos = this.startPos + this.offset; 15023 }, 15024 calculateNotSetRightToLeft: function() { 15025 if(!ASPx.IsValidPosition(this.startPos)) { 15026 if(this.popupElement) 15027 this.startPos = this.innerBoundEndPos; 15028 else if(this.offset) 15029 this.startPos = 0; 15030 else 15031 this.startPos = this.startPosInit; 15032 } 15033 else 15034 this.startPos -= this.size; 15035 this.isInverted = this.isPopupFullCorrectionOn && (this.startPos < this.scrollStartPos && this.startPos - this.scrollStartPos < this.bodySize / 2); 15036 if(this.isInverted) 15037 this.startPos = this.startPos + this.size + this.offset; 15038 else 15039 this.startPos = this.startPos - this.offset; 15040 }, 15041 calculateNearBoundStart: function() { 15042 this.startPos = this.boundStartPos + this.offset + this.size * this.nearBoundOverlapRate; 15043 if(this.isPopupFullCorrectionOn) 15044 this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal); 15045 }, 15046 calculateNearBoundEnd: function() { 15047 this.startPos = this.boundEndPos + this.offset - this.size * this.nearBoundOverlapRate; 15048 if(this.isPopupFullCorrectionOn) 15049 this.startPos = PopupUtils.AdjustPositionToClientScreen(this.element, this.startPos, this.rtl, this.isHorizontal); 15050 }, 15051 getAlignValueFromIndicator: function(alignIndicator) { 15052 var alignValue = AlignIndicatorTable[alignIndicator]; 15053 if(alignValue === undefined) 15054 throw "Incorrect align indicator."; 15055 return alignValue; 15056 }, 15057 getElementSize: function() { 15058 return this.getCustomElementSize(this.element, false); 15059 }, 15060 getPopupElementSize: function() { 15061 return this.getCustomElementSize(this.popupElement, this.ignorePopupElementBorders); 15062 }, 15063 getCustomElementSize: function(customElement, ignoreBorders) { 15064 if(ignoreBorders) { 15065 return this.isHorizontal ? ASPx.GetClearClientWidth(customElement) : ASPx.GetClearClientHeight(customElement); 15066 } 15067 return this.isHorizontal ? ASPx.GetElementOffsetWidth(customElement) : ASPx.GetElementOffsetHeight(customElement); 15068 }, 15069 getWindowInnerSize: function() { 15070 return this.isHorizontal ? window.innerWidth : window.innerHeight; 15071 } 15072}); 15073var positionCalculator = null; 15074function getPositionCalculator() { 15075 if(positionCalculator == null) 15076 positionCalculator = new PositionCalculator(); 15077 return positionCalculator; 15078} 15079function initializeAlignIndicatorTable() { 15080 AlignIndicatorTable[PopupUtils.NotSetAlignIndicator] = PositionAlignConsts.NOT_SET; 15081 AlignIndicatorTable[PopupUtils.OutsideLeftAlignIndicator] = PositionAlignConsts.OUT
15081SIDE_START; 15082 AlignIndicatorTable[PopupUtils.AboveAlignIndicator] = PositionAlignConsts.OUTSIDE_START; 15083 AlignIndicatorTable[PopupUtils.LeftAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START; 15084 AlignIndicatorTable[PopupUtils.TopAlignIndicator] = PositionAlignConsts.NEAR_BOUND_START; 15085 AlignIndicatorTable[PopupUtils.LeftSidesAlignIndicator] = PositionAlignConsts.INNER_START; 15086 AlignIndicatorTable[PopupUtils.TopSidesAlignIndicator] = PositionAlignConsts.INNER_START; 15087 AlignIndicatorTable[PopupUtils.CenterAlignIndicator] = PositionAlignConsts.CENTER; 15088 AlignIndicatorTable[PopupUtils.MiddleAlignIndicator] = PositionAlignConsts.CENTER; 15089 AlignIndicatorTable[PopupUtils.RightSidesAlignIndicator] = PositionAlignConsts.INNER_END; 15090 AlignIndicatorTable[PopupUtils.BottomSidesAlignIndicator] = PositionAlignConsts.INNER_END; 15091 AlignIndicatorTable[PopupUtils.RightAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END; 15092 AlignIndicatorTable[PopupUtils.BottomAlignIndicator] = PositionAlignConsts.NEAR_BOUND_END; 15093 AlignIndicatorTable[PopupUtils.OutsideRightAlignIndicator] = PositionAlignConsts.OUTSIDE_END; 15094 AlignIndicatorTable[PopupUtils.BelowAlignIndicator] = PositionAlignConsts.OUTSIDE_END; 15095 AlignIndicatorTable[PopupUtils.WindowCenterAlignIndicator] = PositionAlignConsts.WINDOW_CENTER; 15096 AlignIndicatorTable[PopupUtils.WindowLeftAlignIndicator] = PositionAlignConsts.WINDOW_START; 15097 AlignIndicatorTable[PopupUtils.WindowTopAlignIndicator] = PositionAlignConsts.WINDOW_START; 15098 AlignIndicatorTable[PopupUtils.WindowRightAlignIndicator] = PositionAlignConsts.WINDOW_END; 15099 AlignIndicatorTable[PopupUtils.WindowBottomAlignIndicator] = PositionAlignConsts.WINDOW_END; 15100} 15101initializeAlignIndicatorTable(); 15102ASPx.PopupPosition = function(position, isInverted) { 15103 this.position = position; 15104 this.isInverted = isInverted; 15105}; 15106ASPx.PopupSize = function(width, height) { 15107 this.width = width; 15108 this.height = height; 15109}; 15110ASPx.PopupUtils = PopupUtils; 15111ASPx.PositionCalculator = PositionCalculator; 15112})(); 15113 15114(function() { 15115ASPx.PCWIdSuffix = "_PW"; 15116var popupControlZIndex = 11998; 15117var defaultZIndexFromServer = "10000"; 15118var ModalAlign = { 15119 WindowLeft: "WindowLeft", 15120 WindowCenter: "WindowCenter", 15121 WindowRight: "WindowRight", 15122 WindowTop: "WindowTop", 15123 WindowBottom: "WindowBottom" 15124}; 15125function PCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset) { 15126 this.horizontalDirection = horizontalDirection; 15127 this.verticalDirection = verticalDirection; 15128 this.horizontalOffset = horizontalOffset; 15129 this.verticalOffset = verticalOffset; 15130 this.course = verticalDirection + horizontalDirection; 15131} 15132var PopupControlCssClasses = {}; 15133PopupControlCssClasses.Prefix = "dxpc-"; 15134PopupControlCssClasses.SizeGripLiteCssClassName = PopupControlCssClasses.Prefix + "sizeGrip"; 15135PopupControlCssClasses.LinkCssClassName = PopupControlCssClasses.Prefix + "link"; 15136PopupControlCssClasses.ShadowLiteCssClassName = PopupControlCssClasses.Prefix + "shadow"; 15137PopupControlCssClasses.MainDivLiteCssClass = PopupControlCssClasses.Prefix + "mainDiv"; 15138PopupControlCssClasses.ContentWrapperCssClassName = PopupControlCssClasses.Prefix + "contentWrapper"; 15139PopupControlCssClasses.ContentCssClassName = PopupControlCssClasses.Prefix + "content"; 15140PopupControlCssClasses.HeaderContentCssClassName = PopupControlCssClasses.Prefix + "headerContent"; 15141PopupControlCssClasses.FooterContentCssClassName = PopupControlCssClasses.Prefix + "footerContent"; 15142PopupControlCssClasses.WindowWrapperCssClassName = PopupControlCssClasses.Prefix + "win-wrapper"; 15143PopupControlCssClasses.WindowWrapperScrollCssClassName = PopupControlCssClasses.WindowWrapperCssClassName + "-scroll"; 15144PopupControlCssClasses.HeaderCssClassName = "dxpc-header"; 15145var LoadContentViaCallback = { 15146 Default: "Default", 15147 OnFirstShow: "OnFirstShow", 15148 OnPageLoad: "OnPageLoad" 15149}; 15150var constants = { 15151 DEFAULT_WINDOW_WIDTH: 200, 15152 DEFAULT_WINDOW_HEIGHT: 0 15153}; 15154var ASPxClientPopupControlBase = ASPx.CreateClass(ASPxClientControl, { 15155 constructor: function(name) { 15156 this.constructor.prototype.constructor.call(this, name); 15157 this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.Direct; 15158 this.adjustInnerControlsSizeOnShow = true; 15159 this.shadowVisible = true; 15160 this.cookieName = ""; 15161 this.popupAnimationType = "none"; 15162 this.closeAnimationType = "none"; 15163 this.closeAction = "OuterMouseClick"; 15164 this.isPopupFullCorrectionOn = true; 15165 this.forceAdjustPositionToClientScreen = false; 15166 this.usedInDropDown = false; 15167 this.popupHorizontalOffset = 0; 15168 this.popupVerticalOffset = 0; 15169 this.popupHorizontalAlign = ASPx.PopupUtils.NotSetAlignIndicator; 15170 this.popupVerticalAlign = ASPx.PopupUtils.NotSetAlignIndicator; 15171 this.contentLoadingMode = LoadContentViaCallback.Default; 15172 this.slideAnimationDuration = 80; 15173 this.fadeAnimationDuration = 400; 15174 this.enableAnimation = true; 15175 this.showOnPageLoad = false; 15176 this.isDragged = false; 15177 this.closeOnEscape = false; 15178 this.savedCallbackWindowIndex = null; 15179 this.animationLockCount = 0; 15180 this.windowRequestCount = []; 15181 this.lpTimers = [];
15182 this.callbackAnimationProcessings = []; 15183 this.isCallbackFinishedStates = []; 15184 this.savedCallbackResults = []; 15185 this.loadingPanels = []; 15186 this.loadingDivs = []; 15187 this.left = 0; 15188 this.top = 0; 15189 this.height = constants.DEFAULT_WINDOW_HEIGHT; 15190 this.width = constants.DEFAULT_WINDOW_WIDTH; 15191 this.minHeight = null; 15192 this.minWidth = null; 15193 this.maxHeight = null; 15194 this.maxWidth = null; 15195 this.isResized = false; 15196 this.cachedSize = null; 15197 this.enableContentScrolling = false; 15198 this.contentOverflowX = "None"; 15199 this.contentOverflowY = "None"; 15200 this.contentUrl = ""; 15201 this.contentUrlIFrameTitle = ""; 15202 this.iframeLoading = false; 15203 this.iframeAdjustingPostponed = false; 15204 this.isPopupPositionCorrectionOn = true; 15205 this.resizeSessionCache = {}; 15206 this.ResizeBorderSize = ASPx.Browser.TouchUI ? 10 : 6; 15207 this.ResizeCornerBorderSize = 20; 15208 this.isLiveResizingMode = true; 15209 this.allowResize = false; 15210 this.allowDragging = false; 15211 this.allowDraggingInAdaptiveMode = false; 15212 this.isWindowDragging = false; 15213 this.prohibitClearSelectionOnMouseDown = false; 15214 this.windowElements = {}; 15215 this.windowContentElements = {}; 15216 this.zIndex = -1; 15217 this.appearAfter = 300; 15218 this.disappearAfter = 500; 15219 this.popupAction = "LeftMouseClick"; 15220 this.autoUpdatePosition = false; 15221 this.defaultIsPopuped = false; 15222 this.defaultLastUsedPopupElementInfo = {}; 15223 this.defaultWindowPopupElementList = []; 15224 this.defaultWindowPopupElementIDList = []; 15225 this.firstFocusableElement = null; 15226 this.lastFocusableElement = null; 15227 this.focusLastElementHandler = function(e) { this.loopFocusHandler(e, false); }.aspxBind(this); 15228 this.focusFirstElementHandler = function(e) { this.loopFocusHandler(e, true); }.aspxBind(this); 15229 this.setFocusOnCallback = true; 15230 this.accessibleFocusElement = null; 15231 this.preventAccessibilityFocus = false; 15232 this.CloseButtonClick = new ASPxClientEvent(); 15233 this.CloseUp = new ASPxClientEvent(); 15234 this.Closing = new ASPxClientEvent(); 15235 this.PopUp = new ASPxClientEvent(); 15236 this.Shown = new ASPxClientEvent(); 15237 this.Resize = new ASPxClientEvent(); 15238 this.Dragged = new ASPxClientEvent(); 15239 this.BeforeDrag = new ASPxClientEvent(); 15240 this.BeforeResizing = new ASPxClientEvent(); 15241 this.AfterResizing = new ASPxClientEvent(); 15242 aspxGetPopupControlCollection().Add(this); 15243 }, 15244 WindowElementIDAssignmentMap: [ 15245 { cssClass: PopupControlCssClasses.HeaderCssClassName, prefix: "_PWH" }, 15246 { cssClass: "dxpc-headerText", prefix: "_PWH", postfix: "T" }, 15247 { cssClass: "dxpc-headerImg", prefix: "_PWH", postfix: "I" }, 15248 { cssClass: "dxpc-closeBtn", prefix: "_HCB" }, 15249 { cssClass: "dxpc-pinBtn", prefix: "_HPB" }, 15250 { cssClass: "dxpc-refreshBtn", prefix: "_HRB" }, 15251 { cssClass: "dxpc-collapseBtn", prefix: "_HMNB" }, 15252 { cssClass: "dxpc-maximizeBtn", prefix: "_HMXB" }, 15253 { cssClass: "dxpc-content", prefix: "_PWC" }, 15254 { cssClass: "dxpc-iFrame", prefix: "_CIF" }, 15255 { cssClass: "dxpc-footer", prefix: "_PWF" }, 15256 { cssClass: "dxpc-footerText", prefix: "_PWF", postfix: "T" }, 15257 { cssClass: "dxpc-footerImg", prefix: "_PWF", postfix: "I" } 15258 ], 15259 Initialize: function() { 15260 this.InitializeBeforeAnyShow(); 15261 ASPxClientControl.prototype.Initialize.call(this); 15262 if(this.accessibilityCompliant) 15263 this.InitializeAccessibleNavigation(); 15264 }, 15265 InitializeWindow: function(index) { 15266 ASPx.PopupUtils.BodyScrollHelper.RestoreIfLocked(this.GetWindowElementId(index)); 15267 this.RemoveWindowAllPopupElements(index); 15268 this.PopulatePopupElements(index); 15269 var element = this.GetWindowElement(index); 15270 if(element != null) { 15271 this.AssignWindowElementsID(index, element); 15272 this.AssignWindowElementsEvents(index, element); 15273 element.DXPopupWindowElement = true; 15274 this.AttachOnDragStartEventToWindowImages(index); 15275 this.EnsureWindowContentUrl(index); 15276 element.isHiding = false; 15277 element.isPopupPositionCorrectionOn = this.isPopupPositionCorrectionOn || !this.GetShowOnPageLoad(index); 15278 if(this.GetShowOnPageLoad(index) && this.GetZIndex(index) > 0) { 15279 this.FirstShowWindow(index, false); 15280 this.SetWindowElementZIndex(element, this.GetZIndex(index)); 15281 element.isPopupPositionCorrectionOn = true; 15282 } 15283 this.InitializeWindowEscKeyHandler(element, index); 15284 if(this.GetCanScrollViewPort(index)) 15285 ensureViewPortSizeInterval(); 15286 var headerImageElement = this.GetWindowHeaderImageCell(index); 15287 if(headerImageElement != null) { 15288 var headerImageHandler = function() { 15289 this.CorrectHeaderContentElementHeight(index); 15290 }.aspxBind(this); 15291 headerImageElement.addEventListener("load", headerImageHandler); 15292 headerImageElement.addEventListener("error", headerImageHandler); 15293 } 15294 var footerImageElement = this.GetWindowFooterImageCell(index); 15295 if(footerImageElement != null) { 15296 var footerImageHandler = function() { 15297 this.CorrectWindowSizeGripPositionLite(index); 15298 this.CorrectFooterTextElementWidth(index); 15299 }.aspxBind(this); 15300 footerImageElement.addEventListener("load", footerImageHandler); 15301 footerImageElement.addEventListener("error", footerImageHandler); 15302 } 15303 } 15304 }, 15305 InitializeBeforeAnyShow: function() { 15306 this.InitializeEnableContentScrolling(); 15307 }, 15308 InitializeEnableContentScrolling: function() {
15309 this.enableContentScrolling = this.contentOverflowX != "None" || this.contentOverflowY != "None"; 15310 }, 15311 InitializeWindowEscKeyHandler: function(element, index) { 15312 if(!this.GetEnableCloseByEsc(index)) return; 15313 this.AddKeyDownHandler("ESC", this.OnEscKeyDown.aspxBind(this)); 15314 }, 15315 AfterInitialize: function() { 15316 if(this.HasDefaultWindow()) 15317 this.AfterInitializeWindow(-1); 15318 for(var i = 0; i < this.GetWindowCount(); i++) 15319 this.AfterInitializeWindow(i); 15320 ASPxClientControl.prototype.AfterInitialize.call(this); 15321 }, 15322 AfterInitializeWindow: function(index) { 15323 if(this.GetShowOnPageLoad(index) && this.GetZIndex(index) < 0) { 15324 this.FirstShowWindow(index, true); 15325 var element = this.GetWindowElement(index); 15326 if(element != null) 15327 element.isPopupPositionCorrectionOn = true; 15328 } 15329 this.EnsureContent(index, true); 15330 }, 15331 AssignWindowElementsID: function(index, windowElement) { 15332 for(var i = 0; i < this.WindowElementIDAssignmentMap.length; i++) { 15333 var elementClass = this.WindowElementIDAssignmentMap[i].cssClass; 15334 var elements = ASPx.GetNodesByClassName(windowElement, elementClass); 15335 for(var j = 0; j < elements.length; j++) { 15336 var element = elements[j]; 15337 if(this.GetFirstParentWindow(element) === windowElement) 15338 this.AssignElementID(element, index, this.WindowElementIDAssignmentMap[i].prefix, this.WindowElementIDAssignmentMap[i].postfix); 15339 } 15340 } 15341 }, 15342 AssignElementID: function(element, index, prefix, postfix) { 15343 element.id = this.name + prefix + index + (postfix ? postfix : ""); 15344 }, 15345 AssignWindowElementsEvents: function(index, element) { 15346 var header = this.GetWindowHeaderElement(index); 15347 if(header && this.allowDragging && !this.isWindowDragging) 15348 ASPx.Evt.AttachEventToElement(header, ASPx.TouchUIHelper.touchMouseDownEventName, this.GetWindowHeaderElementMouseDownEventHandler(index), true); 15349 this.AssignHeaderButtonsEvents(index); 15350 var mdEventName = ASPx.TouchUIHelper.touchMouseDownEventName; 15351 ASPx.Evt.AttachEventToElement(element, mdEventName, this.GetWindowElementMouseDownEventHandler(index)); 15352 if(this.IsResizeAllowed(index)) { 15353 var mmEventName = ASPx.TouchUIHelper.touchMouseMoveEventName; 15354 ASPx.Evt.AttachEventToElement(element, mmEventName, this.GetWindowElementMouseMoveEventHandler(index)); 15355 } 15356 var sizeGrip = this.GetWindowSizeGripElement(index); 15357 if(sizeGrip) { 15358 var instance = this; 15359 ASPx.Evt.AttachEventToElement(sizeGrip, mdEventName, function(evt) { 15360 ASPx.PWGripMDown(evt, instance.name, index); 15361 ASPx.Evt.PreventEvent(evt); 15362 }); 15363 } 15364 }, 15365 AssignHeaderButtonsEvents: function(index) { 15366 this.AttachClickToHeaderButton(index, this.GetWindowCloseButton(index), "ASPx.PWCBClick"); 15367 this.AttachClickToHeaderButton(index, this.GetWindowRefreshButton(index), "ASPx.PWRBClick"); 15368 }, 15369 AttachClickToHeaderButton: function(index, headerButton, eventFuncName) { 15370 var instance = this; 15371 if(headerButton) { 15372 ASPx.Evt.AttachEventToElement(headerButton, "click", function(evt) { 15373 eval(eventFuncName)(evt, instance.name, index); 15374 }); 15375 } 15376 }, 15377 AttachOnDragStartEventToWindowImages: function(index) { 15378 this.AttachChildImagesPreventDragStartEvent(this.GetWindowHeaderElement(index)); 15379 this.AttachChildImagesPreventDragStartEvent(this.GetWindowFooterElement(index)); 15380 }, 15381 AttachChildImagesPreventDragStartEvent: function(parentElem) { 15382 var images = parentElem == null ? null : ASPx.GetNodesByTagName(parentElem, "img"); 15383 if(images != null) { 15384 for(var i = 0; i < images.length; i++) 15385 ASPx.Evt.AttachEventToElement(images[i], "dragstart", ASPx.Evt.PreventEventAndBubble); 15386 } 15387 }, 15388 GetPropertyValue: function(index, propName) { 15389 return this[propName]; 15390 }, 15391 SetPropertyValue: function(index, propName, value) { 15392 this[propName] = value; 15393 }, 15394 GetStretchVerticallyByIndex: function(index) { 15395 return this.GetPropertyValue(index, "stretchVertically"); 15396 }, 15397 GetModalMaxWidth: function(index) { 15398 return this.GetPropertyValue(index, "modalMaxWidth"); 15399 }, 15400 SetAdaptiveMaxWidthByIndex: function(index, value) { 15401 value = this.ConvertDimensionValueToString(value); 15402 this.SetPropertyValue(index, "modalMaxWidth", value); 15403 this.GetWindowElement(index).style["maxWidth"] = value; 15404 if(value.indexOf("px") > 0) 15405 this.EnsureMaxWidthClassName(index, ASPx.PxToInt(value)); 15406 }, 15407 EnsureMaxWidthClassName: function(index, maxWidth) { 15408 var defaultPaddingsWidth = 20; 15409 ASPx.ToggleClassNameToElement(this.GetModalWrapperElement(index), "dxmodalMaxWidth", maxWidth < ASPx.MaxMobileWindowWidth - defaultPaddingsWidth); 15410 }, 15411 GetModalMinWidth: function(index) { 15412 return this.GetPropertyValue(index, "modalMinWidth"); 15413 }, 15414 SetAdaptiveMinWidthByIndex: function(index, value) { 15415 value = this.ConvertDimensionValueToString(value); 15416 this.SetPropertyValue(index, "modalMinWidth", value); 15417 this.GetWindowElement(index).style["minWidth"] = value; 15418 }, 15419 GetModalMinHeight: function(index) { 15420 return this.GetPropertyValue(index, "modalMinHeight"); 15421 }, 15422 SetContentElementsAdaptiveDisplayStyle: function(index) { 15423 var contentWrapper = this.GetWindowContentWrapperElement(index); 15424 ASPx.ToggleClassNameToElement(contentWrapper, "dxmodalTableSys", !this.GetWindowContentIFrameElement(index) && !this.HasAnyScrollBars(index)); 15425 }, 15426 SetContentWrapperAdaptiveHeight: function(index, adaptiveHeight) { 15427 var contentWrapper = this.GetWindowContentWrapperElement(index); 15428 contentWrapper.style.height = adaptiveHeight; 15429 }, 15430 SetAdaptiveMinHeightByIndex: function(index, value) { 15431 this.StretchVerticallyByIndex(index, false); 15432 this.SetPropertyValue(index, "modalMinHeight", value); 15433 this.SetAdaptiveHeightDimension(index, "minHeight", value); 15434 }, 15435 GetModalMaxHeight: function(index) { 15436 return this.GetPropertyValue(index, "modalMaxHeight"); 15437 }, 15438 SetAdaptiveMaxHeightByIndex: function(index, value) { 15439 this.SetPropertyValue(index, "modalMaxHeight", value); 15440 this.SetAdaptiveHeightDimension(index, "maxHeight", value); 15441 }, 15442 GetFixedHeader: function(index) { 15443 return this.GetPropertyValue(index, "fixedHeader"); 15444 }, 15445 GetFixedFooter: function(index) { 15446 return this.GetPropertyValue(index, "fixedFooter"); 15447 }, 15448 GetWindowWidthInternal: function(index) { 15449 return this.GetPropertyValue(index, "width"); 15450 }, 15451 GetWindowHeightInternal: function(index) { 15452 return this.GetPropertyValue(index, "height"); 15453 }, 15454 SetWindowHeight: function(index, height) { 15455 this.SetPropertyValue(index, "height", height); 15456 }, 15457 SetWindowWidth: function(index, width) { 15458 this.SetPropertyValue(index, "width", width); 15459 }, 15460 GetWindowMinWidth: function(index) { 15461 return this.GetPropertyValue(index, "minWidth"); 15462 }, 15463 GetWindowMaxWidth: function(index) { 15464 return this.GetPropertyValue(index, "maxWidth"); 15465 }, 15466 GetWindowMinHeight: function(index) { 15467 return this.GetPropertyValue(index, "minHeight"); 15468 }, 15469 GetWindowMaxHeight: function(index) { 15470 return this.GetPropertyValue(index, "maxHeight"); 15471 }, 15472 SetWindowMaxHeight: function(index, maxHeight) { 15473 this.SetPropertyValue(index, "maxHeight", maxHeight); 15474 }, 15475 SetWindowCachedSize: function(index, width, height) { 15476 this.SetPropertyValue(index, "cachedSize", new ASPx.PopupSize(width, height)); 15477 }, 15478 GetWindowCachedSize: function(index) { 15479 return this.GetPropertyValue(index, "cachedSize"); 15480 }, 15481 ResetWindowCachedSize: function(index) { 15482 this.SetPropertyValue(index, "cachedSize", null); 15483 }, 15484 GetPosition: function(index, isLeft) { 15485 return this.GetPropertyValue(index, isLeft ? "left" : "top"); 15486 }, 15487 GetWindowTop: function(index) { 15488 return this.GetPropertyValue(index, "top"); 15489 }, 15490 SetWindowTop: function(index, top) { 15491 this.SetPropertyValue(index, "top", top); 15492 }, 15493 GetWindowLeft: function(index) { 15494 return this.GetPropertyValue(index, "left"); 15495 }, 15496 SetWindowLeft: function(index, left) { 15497 this.SetPropertyValue(index, "left", left); 15498 }, 15499 GetEnableCloseByEsc: function(index) { 15500 return this.GetPropertyValue(index, "closeOnEscape"); 15501 }, 15502 GetIsDragged: function(index) { 15503 return this.GetPropertyValue(index, "isDragged"); 15504 }, 15505 GetWindowContentIFrameUrl: function(index) { 15506 return this.GetPropertyValue(index, "contentUrl"); 15507 }, 15508 GetWindowContentIFrameTitle: function(index) { 15509 return this.GetPropertyValue(index, "contentUrlIFrameTitle"); 15510 },
15511 GetWindowCloseAction: function(index) { 15512 return this.GetPropertyValue(index, "closeAction"); 15513 }, 15514 GetShowOnPageLoad: function(index) { 15515 return this.GetPropertyValue(index, "showOnPageLoad"); 15516 }, 15517 GetZIndex: function(index) { 15518 return this.GetPropertyValue(index, "zIndex"); 15519 }, 15520 GetIframeLoading: function(index) { 15521 return this.GetPropertyValue(index, "iframeLoading"); 15522 }, 15523 SetIframeLoading: function(index, value) { 15524 this.SetPropertyValue(index, "iframeLoading", value); 15525 }, 15526 SetIsDragged: function(index, value) { 15527 this.SetPropertyValue(index, "isDragged", value); 15528 }, 15529 GetIsResized: function(index) { 15530 return this.GetPropertyValue(index, "isResized"); 15531 }, 15532 SetIsResized: function(index, value) { 15533 this.SetPropertyValue(index, "isResized", value); 15534 }, 15535 SetIframeAdjustingPostponed: function(index, value) { 15536 this.SetPropertyValue(index, "iframeAdjustingPostponed", value); 15537 }, 15538 GetIframeAdjustingPostponed: function(index) { 15539 return this.GetPropertyValue(index, "iframeAdjustingPostponed"); 15540 }, 15541 GetWindowPopupAction: function(index) { 15542 return this.GetPropertyValue(index, "popupAction"); 15543 }, 15544 GetWindowElementMouseMoveEventHandler: function(index) { 15545 var instance = this; 15546 return function(evt) { ASPx.PWMMove(evt, instance.name, index); }; 15547 }, 15548 GetWindowElementMouseDownEventHandler: function(index) { 15549 var instance = this; 15550 return function(evt) { 15551 if(instance.AllowMouseDown(evt, index)) 15552 ASPx.PWMDown(evt, instance.name, index, instance.isWindowDragging); 15553 }; 15554 }, 15555 GetWindowHeaderElementMouseDownEventHandler: function(index) { 15556 var instance = this; 15557 return function(evt) { 15558 if(instance.AllowMouseDown(evt, index)) 15559 ASPx.PWDGMDown(evt, instance.name, index); 15560 }; 15561 }, 15562 AllowMouseDown: function(evt, index) { 15563 return !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowCloseButton(index)) && 15564 !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowRefreshButton(index)); 15565 }, 15566 PreventHeaderButtonMouseDownBubbling: function(evt, hdrButton) { 15567 if(hdrButton) { 15568 var source = ASPx.Evt.GetEventSource(evt); 15569 if(ASPx.GetIsParent(hdrButton, source)) { 15570 ASPx.PWHMDown(evt); 15571 return true; 15572 } 15573 } 15574 return false; 15575 }, 15576 PrepareToAdjustContentOnShow: function(index) { 15577 if(this.adjustInnerControlsSizeOnShow) { 15578 var windowContent = this.GetContentContainer(index), 15579 collection = ASPx.GetControlCollection(); 15580 collection.CollapseControls(windowContent); 15581 } 15582 }, 15583 AdjustContentOnShow: function(index) { 15584 if(this.adjustInnerControlsSizeOnShow) { 15585 var windowElement = this.GetWindowElement(index); 15586 ASPx.GetControlCollection().AdjustControls(windowElement, false); 15587 } 15588 }, 15589 AdjustSize: function() { 15590 if(this.enableContentScrolling) 15591 return; 15592 this.SetSize(0, 0); 15593 }, 15594 GetFirstParentWindow: function(el) { 15595 while(el && el.tagName != "BODY") { 15596 if(el.nodeType == 1 && el.className.indexOf("dxpclW") > -1 && !isNaN(this.GetWindowIndex(el))) 15597 return el; 15598 el = el.parentNode; 15599 } 15600 }, 15601 getParentPopupControl: function(index) { 15602 var parentPopupWindowElement = this.GetFirstParentWindow(this.GetWindowElement(index).parentNode); 15603 if(parentPopupWindowElement) 15604 return aspxGetPopupControlCollection().GetPopupWindowFromID(parentPopupWindowElement.id); 15605 }, 15606 registerAndActivateWindow: function(windowElement, index, allowChangeZIndex) { 15607 aspxGetPopupControlCollection().RegisterVisibleWindow(windowElement, this, index); 15608 if(allowChangeZIndex) 15609 aspxGetPopupControlCollection().ActivateWindowElement(windowElement, undefined, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex()); 15610 }, 15611 HasCloseAnimation: function() { 15612 return this.closeAnimationType !== ASPxClientPopupControlBase.AnimationType.None; 15613 }, 15614 HasOpenAnimation: function() { 15615 return this.popupAnimationType !== ASPxClientPopupControlBase.AnimationType.None; 15616 }, 15617 AddKeyDownHandler: function(shortcutString, handler) { 15618 if(typeof(this.keyDownHandlers) === "undefined") 15619 this.keyDownHandlers = []; 15620 this.keyDownHandlers[ASPx.ParseShortcutString(shortcutString)] = handler; 15621 }, 15622 InternalIsWindowDisplayed: function(index) { 15623 var element = this.GetWindowElement(index); 15624 return (element != null) ? ASPx.GetElementDisplay(element) : false; 15625 }, 15626 InternalIsWindowVisible: function(index) { 15627 var element = this.GetWindowElement(index); 15628 if(!element) 15629 return false; 15630 if(this.HasCloseAnimation() && !element.closeAnimationCompleted) 15631 return false; 15632 return ASPx.GetElementVisibility(element, true) && ASPx.GetElementDisplay(element); 15633 }, 15634 IsWindowVisible: function(window) { 15635 var index = (window != null) ? window.index : -1; 15636 return this.InternalIsWindowVisible(index); 15637 }, 15638 IsVisible: function() { 15639 return this.InternalIsWindowVisible(-1); 15640 },
15641 UpdateWindowsStateCookie: function() { 15642 if(this.cookieName == "") return; 15643 ASPx.Cookie.DelCookie(this.cookieName); 15644 ASPx.Cookie.SetCookie(this.cookieName, this.GetWindowsState()); 15645 }, 15646 SetWindowElementZIndex: function(element, zIndex) { 15647 element.style.zIndex = zIndex; 15648 var iFrame = element.overflowElement; 15649 if(iFrame) 15650 iFrame.style.zIndex = zIndex - 1; 15651 var modalElement = element.modalElement; 15652 if(modalElement) 15653 modalElement.style.zIndex = zIndex - 1; 15654 this.UpdateWindowsStateCookie(); 15655 }, 15656 SetWindowContentHtmlCore: function(index, html, useAnimation) { 15657 var element = this.GetContentContainer(index); 15658 if(element != null) { 15659 ASPx.SetInnerHtml(element, html); 15660 this.AfterSetWindowContentHtml(index, element, useAnimation); 15661 } 15662 }, 15663 SetContentHtml: function(html, useAnimation) { 15664 this.SetWindowContentHtml(null, html, useAnimation); 15665 if(html && this.accessibilityCompliant) 15666 ASPx.GetControlCollection().ControlsInitialized.AddHandler(this.OnControlsInitialized, this); 15667 }, 15668 SetWindowContentHtml: function(window, html, useAnimation) { 15669 var index = (window != null) ? window.index : -1; 15670 this.SetWindowContentHtmlCore(index, html, useAnimation); 15671 }, 15672 GetContentHtml: function() { 15673 return this.GetWindowContentHtml(null); 15674 }, 15675 AfterSetWindowContentHtml: function(index, contentContainer, useAnimation) { 15676 if(useAnimation && typeof (ASPx.AnimationHelper) != "undefined") 15677 ASPx.AnimationHelper.fadeIn(contentContainer, function() { this.ResizeWindowIFrame(index); }.aspxBind(this)); 15678 else 15679 this.ResizeWindowIFrame(index); 15680 }, 15681 ResizeWindowIFrame: function(index) { 15682 if(!this.renderIFrameForPopupElements || !this.InternalIsWindowVisible(index)) return; 15683 var iFrame = this.GetWindowIFrame(index); 15684 if(iFrame) { 15685 var cell = this.GetWindowMainCell(this.GetWindowElement(index)); 15686 ASPx.SetStyles(iFrame, { width: cell.offsetWidth, height: cell.offsetHeight }); 15687 } 15688 }, 15689 DoHideWindow: function(index, dontRaiseClosing, closeReason) { 15690 if(!this.InternalIsWindowVisible(index)) return; 15691 var cancel = !dontRaiseClosing && this.RaiseClosing(index, closeReason); 15692 if(!cancel) { 15693 if(this.HasCloseAnimation() && this.IsAnimationAllowed()) 15694 this.DoHideWindowCoreWithAnimation(index, closeReason); 15695 else { 15696 this.DoHideWindowCore(index, closeReason); 15697 this.RaiseCloseUp(index, closeReason); 15698 } 15699 } 15700 return cancel; 15701 }, 15702 HasAnyScrollBars: function(index) { 15703 var contentElement = this.GetWindowContentElement(index); 15704 var hasBothScrollBars = contentElement.style.overflow == "scroll" || contentElement.style.overflow == "auto"; 15705 return hasBothScrollBars || contentElement.style.overflowX == "scroll" || 15706 contentElement.style.overflowY == "scroll" || contentElement.style.overflowX == "auto" || 15707 contentElement.style.overflowY == "auto"; 15708 }, 15709 DoHideWindowModalElement: function(element, closeReason) { 15710 var modalElement = element.modalElement; 15711 if(modalElement && ASPx.GetElementVisibility(modalElement, true)) { 15712 var closeModalElement = function () { 15713 ASPx.SetStyles(modalElement, { width: 1, height: 1, zIndex: defaultZIndexFromServer - 1 }); 15714 ASPx.SetElementVisibility(modalElement, false); 15715 ASPx.SetElementDisplay(modalElement, false); 15716 }; 15717 aspxGetPopupControlCollection().UnregisterVisibleModalElement(modalElement); 15718 if(this.GetHideBodyScrollWhenModal(this.GetWindowIndex(element))) { 15719 if(ASPx.Browser.WebKitFamily) 15720 aspxGetPopupControlCollection().LockScrollEvent(); 15721 if(!ASPx.Browser.WebKitTouchUI) 15722 ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id); 15723 if(ASPx.Browser.WebKitFamily) 15724 aspxGetPopupControlCollection().UnlockScrollEvent(); 15725 } 15726 if(closeReason == ASPxClientPopupControlCloseReason.OuterMouseClick) { 15727 ASPx.SetStyles(modalElement, { opacity: 0 }); 15728 if(!modalElement.mouseHandler) { 15729 modalElement.mouseHandler = function() { 15730 ASPx.SetStyles(modalElement, { opacity: "" }); 15731 closeModalElement(); 15732 ASPx.Evt.DetachEventFromElement(modalElement, "mouseup", modalElement.mouseHandler); 15733 ASPx.Evt.DetachEventFromElement(modalElement, "mouseout", modalElement.mouseHandler); 15734 }; 15735 } 15736 ASPx.Evt.AttachEventToElement(modalElement, "mouseup", modalElement.mouseHandler); 15737 ASPx.Evt.AttachEventToElement(modalElement, "mouseout", modalElement.mouseHandler); 15738 } else 15739 closeModalElement(); 15740 } 15741 }, 15742 IncreaseWindowRequestCount: function (index) { 15743 if(!this.windowRequestCount[index]) 15744 this.windowRequestCount[index] = 1; 15745 else 15746 this.windowRequestCount[index]++; 15747 }, 15748 DecreaseWindowRequestCount: function(index) { 15749 this.windowRequestCount[index]--; 15750 }, 15751 IsLoadingContainerVisible: function() { 15752 return true; 15753 }, 15754 ShouldHideExistingLoadingElements: function() { 15755 return false; 15756 }, 15757 GetModalElementEndAnimationOpacity: function(index) { 15758 if(typeof (this.modalElementOpacity) == "undefined") 15759 this.modalElementOpacity = []; 15760 if(typeof (this.modalElementOpacity[index]) == "undefined") 15761 this.modalElementOpacity[index] = ASPx.GetElementOpacity(this.GetWindowModalElement(index)); 15762 return this.modalElementOpacity[index]; 15763 }, 15764 SetModalElementVisibilityWithAnimation: function(modalElement, index) { 15765 if(this.AllowModalElementAnimation(index)) { 15766 var endOpacity = this.GetModalElementEndAnimationOpacity(index); 15767 ASPx.AnimationHelper.setOpacity(modalElement, 0); 15768 ASPx.SetElementVisibility(modalElement, true); 15769 ASPx.AnimationHelper.fadeTo(modalElement, { to: endOpacity }); 15770 } else 15771 ASPx.SetElementVisibility(modalElement, true); 15772 }, 15773 AllowModalElementAnimation: function(index) { 15774 return this.popupAnimationType === ASPxClientPopupControlBase.AnimationType.Fade; 15775 }, 15776 SetVisibleWithAnimation: function(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition) { 15777 var isAnimationNeed = this.IsAnimationAllowed() && !isMoving; 15778 if(isAnimationNeed && this.popupAnimationType !== "none") { 15779 switch(this.popupAnimationType) { 15780 case ASPxClientPopupControlBase.AnimationType.Slide: 15781 this.StartSlideAnimation(element, index, horizontalPopupPosition, verticalPopupPosition); 15782 break; 15783 case ASPxClientPopupControlBase.AnimationType.Fade: 15784 this.StartFadeAnimation(element, index); 15785 break; 15786 case ASPxClientPopupControlBase.AnimationType.Auto: 15787 this.StartAutoAnimation(element, index, horizontalPopupPosition, verticalPopupPosition); 15788 break; 15789 } 15790 } 15791 else 15792 ASPx.SetElementVisibility(element, true); 15793 }, 15794 StartAutoAnimation: function(element, index, horizontalPopupPosition, verticalPopupPosition) { 15795 ASPx.SetElementVisibility(element, true); 15796 }, 15797 StartFadeAnimation: function(element, index) { 15798 ASPx.AnimationHelper.setOpacity(element, 0); 15799 ASPx.SetElementVisibility(element, true); 15800 var callback = function() { 15801 this.OnAnimationStop(index); 15802 }.aspxBind(this); 15803 ASPx.AnimationHelper.fadeIn(element, callback, this.fadeAnimationDuration); 15804 }, 15805 StartSlideAnimation: function (animationDivElement, index, horizontalPopupPosition, verticalPopupPosition) { 15806 var element = this.GetWindowMainCell(animationDivElement); 15807 var clientX = horizontalPopupPosition.position; 15808 var clientY = verticalPopupPosition.position; 15809 var args = "(\"" + this.name + "\", " + index + ")"; 15810 var onAnimStopCallString = "ASPx.PCAStop" + args; 15811 this.InitDivPosForShowSlideAnimation(index, animationDivElement, clientX, clientY, onAnimStopCallString); 15812 var horizontalDirection = this.GetAnimationHorizontalDirection(index, horizontalPopupPosition); 15813 var verticalDirection = this.GetAnimationVerticalDirection(index, verticalPopupPosition); 15814 var offsetCoefficient = this.GetSlideOffsetCoefficient(index); 15815 var xPos = horizontalDirection * animationDivElement.offsetWidth * offsetCoefficient; 15816 var yPos = verticalDirection * animationDivElement.offsetHeight * offsetCoefficient; 15817 neddToForceAnimation = xPos === 0 && yPos === 0; 15818 if(neddToForceAnimation) 15819 yPos = 1; 15820 ASPx.SetStyles(element, { left: xPos, top: yPos }); 15821 ASPx.SetElementVisibility(animationDivElement, true); 15822 this.DoShowWindowIFrame(index, clientX, clientY, 0, 0); 15823 ASPx.PopupUtils.StartSlideAnimation(animationDivElement, element, this.GetWindowIFrame(index), this.GetSlideAnimationDuration(index)); 15824 }, 15825 GetSlideAnimationDuration: function(index) { 15826 return this.slideAnimationDuration; 15827 }, 15828 GetSlideOffsetCoefficient: function(index) { 15829 return 1; 15830 }, 15831 InitDivPosForShowSlideAnimation: function(index, animationDivElement, clientX, clientY, onAnimStopCallString) { 15832 ASPx.PopupUtils.InitAnimationDiv(animationDivElement, clientX, clientY, onAnimStopCallString, true); 15833 }, 15834 InitDivPosForHideSlideAnimation: function(animationDivElement) { 15835 }, 15836 StopShowAnimation: function(index) { 15837 if(this.HasOpenAnimation()) { 15838 var windowElement = this.GetWindowElement(index); 15839 if(this.popupAnimationType === 'slide') 15840 ASPx.PopupUtils.StopAnimation(windowElement, this.GetWindowMainCell(windowElement)); 15841 else 15842 ASPx.AnimationHelper.cancelAnimation(windowElement); 15843 } 15844 }, 15845 StopCloseAnimation: function(index) { 15846 var element = this.GetWindowElement(index); 15847 if(this.HasCloseAnimation() && !element.closeAnimationCompleted) { 15848 ASPx.AnimationHelper.cancelAnimation(element); 15849 this.DoHideWindowCore(index); 15850 } 15851 }, 15852 IsFadeCloseAnimation: function(index) { 15853 return this.closeAnimationType === ASPxClientPopupControlBase.AnimationType.Fade; 15854 }, 15855 PrepareElementAfterCloseAnimation: function(index, element) { 15856 element.closeAnimationCompleted = true;
15857 if(this.IsFadeCloseAnimation(index)) 15858 ASPx.SetStyles(element, { opacity: 1 }); 15859 else 15860 ASPx.SetStyles(this.GetWindowMainCell(element), { 15861 left: 0, 15862 top: 0 15863 }); 15864 }, 15865 DoHideWindowCoreWithAnimation: function(index, closeReason) { 15866 this.StopShowAnimation(index); 15867 var element = this.GetWindowElement(index); 15868 element.closeAnimationCompleted = false; 15869 if(this.AllowModalElementAnimation(index) && this.CanManipulateWithModalElement(index)) 15870 ASPx.AnimationHelper.fadeOut(element.modalElement, null, this.fadeAnimationDuration); 15871 switch(this.closeAnimationType) { 15872 case ASPxClientPopupControlBase.AnimationType.Slide: 15873 this.DoHideWindowWithSlideAnimation(index, closeReason); 15874 break; 15875 case ASPxClientPopupControlBase.AnimationType.Fade: 15876 this.DoHideWindowWithFadeAnimation(index, element, closeReason); 15877 break; 15878 case ASPxClientPopupControlBase.AnimationType.Auto: 15879 this.DoHideWindowWithAutoAnimation(index, element, closeReason); 15880 break; 15881 } 15882 }, 15883 DoHideWindowWithAutoAnimation: function(index, element, closeReason) { 15884 }, 15885 DoHideWindowWithFadeAnimation: function(index, element, closeReason) { 15886 ASPx.AnimationHelper.fadeOut(element, function() { 15887 this.DoHideWindowCore(index); 15888 this.RaiseCloseUp(index, closeReason); 15889 }.aspxBind(this), this.fadeAnimationDuration); 15890 }, 15891 DoHideWindowWithSlideAnimation: function(index, closeReason) { 15892 var element = this.GetWindowElement(index); 15893 var horizontalPopupPosition = this.GetSlideAnimationPosition(element, true); 15894 var verticalPopupPosition = this.GetSlideAnimationPosition(element, false); 15895 var horizontalDirection = this.GetAnimationHorizontalDirection(index, horizontalPopupPosition); 15896 var verticalDirection = this.GetAnimationVerticalDirection(index, verticalPopupPosition); 15897 this.InitDivPosForHideSlideAnimation(element); 15898 var offsetCoefficient = this.GetSlideOffsetCoefficient(index); 15899 ASPx.AnimationHelper.createMultipleAnimationTransition(this.GetWindowMainCell(element), { 15900 duration: this.GetSlideAnimationDuration(index), 15901 onComplete: function(element) { 15902 this.DoHideWindowCore(index); 15903 this.RaiseCloseUp(index, closeReason); 15904 }.aspxBind(this) 15905 }).Start({ 15906 left: { to: horizontalDirection * element.offsetWidth * offsetCoefficient, unit: "px" }, 15907 top: { to: verticalDirection * element.offsetHeight * offsetCoefficient, unit: "px" } 15908 }); 15909 }, 15910 GetSlideAnimationPosition: function(element, isX) { 15911 return this.GetClientPopupPos(element, null, ASPx.InvalidPosition, isX, true); 15912 }, 15913 GetAnimationHorizontalDirection: function(index, horizontalPopupPosition) { 15914 return ASPx.PopupUtils.GetAnimationHorizontalDirection(horizontalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign, this.rtl); 15915 }, 15916 GetAnimationVerticalDirection: function(index, verticalPopupPosition) { 15917 return ASPx.PopupUtils.GetAnimationVerticalDirection(verticalPopupPosition, this.popupHorizontalAlign, this.popupVerticalAlign); 15918 }, 15919 OnAnimationStop: function(index) { 15920 this.OnWindowShown(index); 15921 }, 15922 PerformCallback: function(parameter, onSuccess) { 15923 this.PerformWindowCallback(null, parameter, onSuccess); 15924 }, 15925 PerformWindowCallback: function(window, parameter, onSuccess) { 15926 parameter = ASPx.IsExists(parameter) ? parameter.toString() : ""; 15927 var index = (window != null) ? window.index : -1; 15928 if(!this.InWindowCallback(index)) { 15929 var windowCallbackArguments = index + ";" + parameter; 15930 this.CreateWindowCallback(index, windowCallbackArguments, onSuccess); 15931 } 15932 }, 15933 InWindowCallback: function(windowIndex) { 15934 return this.windowRequestCount[windowIndex] > 0; 15935 }, 15936 CreateWindowCallback: function(windowIndex, argument, handler) { 15937 this.IncreaseWindowRequestCount(windowIndex); 15938 var element = this.GetWindowElement(windowIndex); 15939 if(this.contentLoadingMode != LoadContentViaCallback.OnPageLoad || !element.loading || this.GetShowOnPageLoad(windowIndex)) 15940 this.ShowWindowLoadingElements(windowIndex); 15941 this.CreateCallback(argument, null, handler); 15942 }, 15943 OnCallback: function(result) { 15944 this.OnCallbackInternal(result.html, result.index, false); 15945 }, 15946 OnCallbackError: function(result, data) { 15947 this.OnCallbackInternal(result, ASPx.IsExists(data) ? data : -1, true); 15948 }, 15949 OnCallbackErrorAfterUserHandle: function(result, data) { 15950 this.DecreaseWindowRequestCount(data); 15951 }, 15952 OnCallbackGeneralError: function(errorMessage) { 15953 this.OnCallbackInternal(errorMessage, -1, true); 15954 }, 15955 OnCallbackGeneralErrorAfterUserHandle: function(errorMessage) { 15956 this.DecreaseWindowRequestCount(-1); 15957 }, 15958 OnCallbackInternal: function(html, windowIndex, isError) { 15959 var element = this.GetWindowElement(windowIndex); 15960 element.loaded = !isError; 15961 element.loading = false; 15962 this.DecreaseWindowRequestCount(windowIndex); 15963 this.HideWindowLoadingPanel(windowIndex); 15964 this.SetWindowContentHtmlCore(windowIndex, html); 15965 this.UpdatePositionAfterCallback(windowIndex); 15966 this.savedCallbackWindowIndex = windowIndex; 15967 this.UpdateWindowsStateCookie(); 15968 if(this.accessibilityCompliant) 15969 this.InitializeAccessibleNavigationCore(); 15970 }, 15971 RaiseCallbackError: function(message) { 15972 var result = ASPxClientControl.prototype.RaiseCallbackError.call(this, message); 15973 if(result.isHandled) 15974 this.HideAllLoadingPanels(); 15975 return result; 15976 },
15977 StartWindowBeginCallbackAnimation: function(windowIndex) { 15978 this.callbackAnimationProcessings[windowIndex] = true; 15979 this.isCallbackFinishedStates[windowIndex] = false; 15980 ASPx.AnimationHelper.fadeOut(this.GetWindowContentElement(windowIndex), function() { this.FinishWindowBeginCallbackAnimation(windowIndex); }.aspxBind(this)); 15981 }, 15982 FinishWindowBeginCallbackAnimation: function(windowIndex) { 15983 this.callbackAnimationProcessings[windowIndex] = false; 15984 if(!this.isCallbackFinishedStates[windowIndex]) 15985 this.ShowWindowLoadingElementsInternal(windowIndex); 15986 else 15987 this.DoCallback(this.savedCallbackResults[windowIndex]); 15988 }, 15989 CheckBeginCallbackAnimationInProgress: function(callbackResult) { 15990 var result; 15991 try { 15992 result = this.EvalCallbackResult(callbackResult).result; 15993 } catch(e) { 15994 return false; 15995 } 15996 var windowIndex = result.index; 15997 if(this.enableCallbackAnimation && this.callbackAnimationProcessings[windowIndex]) { 15998 this.savedCallbackResults[windowIndex] = callbackResult; 15999 this.isCallbackFinishedStates[windowIndex] = true; 16000 return true; 16001 } 16002 return false; 16003 }, 16004 StartWindowEndCallbackAnimation: function(windowIndex) { 16005 this.callbackAnimationProcessings[windowIndex] = true; 16006 ASPx.AnimationHelper.fadeIn(this.GetWindowContentElement(windowIndex), function() { this.FinishWindowEndCallbackAnimation(windowIndex); }.aspxBind(this)); 16007 }, 16008 FinishWindowEndCallbackAnimation: function(windowIndex) { 16009 this.DoEndCallback(); 16010 this.callbackAnimationProcessings[windowIndex] = false; 16011 }, 16012 CheckEndCallbackAnimationNeeded: function() { 16013 var windowIndex = this.savedCallbackWindowIndex; 16014 this.savedCallbackWindowIndex = null; 16015 if(windowIndex !== null && !this.callbackAnimationProcessings[windowIndex]) { 16016 this.StartWindowEndCallbackAnimation(windowIndex); 16017 return true; 16018 } 16019 return false; 16020 }, 16021 EnsureContent: function(windowIndex, isInit) { 16022 var element = this.GetWindowElement(windowIndex); 16023 if(element && !element.loaded && !element.loading) { 16024 var shouldLoad = this.contentLoadingMode == LoadContentViaCallback.OnPageLoad || this.contentLoadingMode == LoadContentViaCallback.OnFirstShow && !isInit; 16025 if(shouldLoad) { 16026 element.loading = true; 16027 this.CreateWindowCallback(windowIndex, windowIndex); 16028 } else if(this.contentLoadingMode == LoadContentViaCallback.Default) 16029 element.loaded = true; 16030 } 16031 }, 16032 HideAllLoadingPanels: function() { 16033 if(this.HasDefaultWindow()) 16034 this.HideWindowLoadingPanel(-1); 16035 for(var i = 0; i < this.GetWindowCount() ; i++) 16036 this.HideWindowLoadingPanel(i); 16037 }, 16038 HideWindowLoadingPanel: function(windowIndex) { 16039 this.ClearWindowLoadingPanelTimer(windowIndex); 16040 if(this.loadingDivs[windowIndex]) { 16041 ASPx.RemoveElement(this.loadingDivs[windowIndex]); 16042 this.loadingDivs[windowIndex] = null; 16043 } 16044 if(this.loadingPanels[windowIndex]) { 16045 ASPx.RemoveElement(this.loadingPanels[windowIndex]); 16046 this.loadingPanels[windowIndex] = null; 16047 } 16048 }, 16049 ShowWindowLoadingElements: function(windowIndex) { 16050 if(this.lpTimers[windowIndex] && this.lpTimers[windowIndex] > -1) return; 16051 if(this.enableCallbackAnimation)
16052 this.StartWindowBeginCallbackAnimation(windowIndex); 16053 else 16054 this.ShowWindowLoadingElementsInternal(windowIndex); 16055 }, 16056 ShowWindowLoadingPanelOnTimer: function(windowIndex) { 16057 this.ClearWindowLoadingPanelTimer(windowIndex); 16058 this.ShowWindowLoadingPanel(windowIndex); 16059 }, 16060 ClearWindowLoadingPanelTimer: function(windowIndex) { 16061 this.lpTimers[windowIndex] = ASPx.Timer.ClearTimer(this.lpTimers[windowIndex]); 16062 }, 16063 ShowWindowLoadingElementsInternal: function(windowIndex) { 16064 if(this.lpDelay > 1 && !this.enableCallbackAnimation) { 16065 var _this = this; 16066 this.lpTimers[windowIndex] = window.setTimeout(function() { _this.ShowWindowLoadingPanelOnTimer(windowIndex); }, this.lpDelay); 16067 } 16068 else 16069 this.ShowWindowLoadingPanel(windowIndex); 16070 }, 16071 ShowWindowLoadingPanel: function(windowIndex) { 16072 if(!this.IsExistLoadingPanel()) 16073 return; 16074 if(!this.loadingPanels[windowIndex] && this.InternalIsWindowVisible(windowIndex)) { 16075 var parentElement = this.GetWindowElement(windowIndex).parentNode; 16076 var offsetElement = this.GetLoadingPanelOffsetElement(windowIndex); 16077 this.loadingDivs[windowIndex] = this.CreateLoadingDiv(parentElement, offsetElement, windowIndex); 16078 this.loadingPanels[windowIndex] = this.CreateLoadingPanelWithAbsolutePosition(parentElement, offsetElement, windowIndex); 16079 } 16080 }, 16081 GetLoadingPanelOffsetElement: function(windowIndex) { 16082 return this.GetWindowContentWrapperElement(windowIndex); 16083 }, 16084 IsExistLoadingPanel: function() { 16085 return !!this.GetLoadingDiv(); 16086 }, 16087 LockAnimation: function() { 16088 this.animationLockCount++; 16089 }, 16090 UnlockAnimation: function() { 16091 this.animationLockCount--; 16092 }, 16093 IsAnimationLocked: function() { 16094 return this.animationLockCount > 0; 16095 }, 16096 IsAnimationAllowed: function() { 16097 return this.enableAnimation && !this.IsAnimationLocked(); 16098 }, 16099 SetWindowSizeByIndexCore: function(index, width, height, isWindowCollapsed) { 16100 this.SetClientWindowSizeLite(index, width, height, isWindowCollapsed); 16101 var iFrame = this.GetWindowIFrame(index); 16102 if(iFrame && !isWindowCollapsed) { 16103 var winElememnt = this.GetWindowElement(index); 16104 var realWidth = winElememnt.offsetWidth; 16105 var realHeight = winElememnt.offsetHeight; 16106 ASPx.SetStyles(iFrame, { width: realWidth, height: realHeight }); 16107 } 16108 this.UpdateWindowsStateCookie(); 16109 }, 16110 SetWindowSizeByIndex: function(index, width, height) { 16111 var minWidth = this.GetWindowMinWidth(index); 16112 var minHeight = this.GetWindowMinHeight(index); 16113 var maxWidth = this.GetWindowMaxWidth(index); 16114 var maxHeight = this.GetWindowMaxHeight(index); 16115 if(minWidth) 16116 width = Math.max(width, minWidth); 16117 if(minHeight) 16118 height = Math.max(height, minHeight); 16119 if(maxWidth) 16120 width = Math.min(width, maxWidth); 16121 if(maxHeight) 16122 height = Math.min(height, maxHeight); 16123 var isWindowMaximized = this.GetIsMaximized(index); 16124 var isWindowCollapsed = this.GetIsCollapsed(index); 16125 var isWindowMaximizedAndCollapsed = (isWindowMaximized && isWindowCollapsed); 16126 if(this.SizeCanBeSet(index, isWindowMaximizedAndCollapsed)) { 16127 if(!this.CollapseExecuting() && !this.MaximizationExecuting() && !this.ResizingForMaxWindowLocked()) { 16128 this.SetWindowCachedSize(index, width, height); 16129 this.SetIsResized(index, true); 16130 } 16131 if(isWindowCollapsed && !this.MaximizationExecuting() && !this.ResizingForMaxWindowLocked()) { 16132 this.SetWindowCachedSize(index, width, height); 16133 this.UpdateRestoredWindowSize(index, width, height); 16134 height = 0; 16135 } 16136 if(isWindowMaximized && !this.CollapseExecuting() && !this.ResizingForMaxWindowLocked()) { 16137 this.SetWindowCachedSize(index, width, height); 16138 this.UpdateRestoredWindowSize(index, width, height); 16139 } else { 16140 this.SetWindowSizeByIndexCore(index, width, height, isWindowCollapsed); 16141 } 16142 } else 16143 this.SetWindowCachedSize(index, width, height); 16144 }, 16145 SizeCanBeSet: function(index, isWindowMaximizedAndCollapsed) { 16146 return this.InternalIsWindowDisplayed(index) && this.IsWindowElementsIDAssigned(index) && (!isWindowMaximizedAndCollapsed || this.ResizingForMaxWindowLocked()); 16147 }, 16148 RestoreWindowSizeFromCache: function(index) { 16149 var cachedSize = this.GetWindowCachedSize(index); 16150 if(cachedSize != null) {
16151 if(cachedSize.width !== this.GetClientWindowWidth(index, true, true) || 16152 cachedSize.height !== this.GetClientWindowHeight(index, true, true)) 16153 this.SetWindowSizeByIndex(index, cachedSize.width, cachedSize.height); 16154 this.ResetWindowCachedSize(index); 16155 } 16156 }, 16157 CollapseExecuting: function() { 16158 return false; 16159 }, 16160 MaximizationExecuting: function() { 16161 return false; 16162 }, 16163 ResizingForMaxWindowLocked: function() { 16164 return false; 16165 }, 16166 IsResizeAllowed: function(index) { 16167 return this.allowResize; 16168 }, 16169 GetWindowDimensionByIndex: function(index, isWidth, forceFromCache) { 16170 var cachedSize = this.GetWindowCachedSize(index); 16171 var dimensionValue = null; 16172 if(forceFromCache == undefined && !this.GetWindowElement(index)) 16173 forceFromCache = true; 16174 if(cachedSize && forceFromCache) 16175 dimensionValue = isWidth ? cachedSize.width : cachedSize.height; 16176 if(dimensionValue) 16177 return dimensionValue; 16178 else { 16179 var element = this.GetWindowElement(index); 16180 var sizeFromDOM = 0; 16181 if(this.GetIsCollapsed(index)) { 16182 var headerCell = this.GetWindowHeaderElement(index); 16183 sizeFromDOM = isWidth ? headerCell.offsetWidth : headerCell.offsetHeight; 16184 } 16185 else { 16186 var mainCell = this.GetWindowMainCell(element); 16187 sizeFromDOM = isWidth ? mainCell.offsetWidth : mainCell.offsetHeight; 16188 } 16189 if(sizeFromDOM === 0 && cachedSize) 16190 sizeFromDOM = isWidth ? cachedSize.width : cachedSize.height; 16191 return sizeFromDOM; 16192 } 16193 }, 16194 SetWindowSize: function(window, width, height) { 16195 var index = (window != null) ? window.index : -1; 16196 this.SetWindowSizeByIndex(index, width, height); 16197 }, 16198 SetSize: function(width, height) { 16199 this.SetWindowSize(null, width, height); 16200 }, 16201 SetWidth: function(width) { 16202 var height = this.GetHeight(); 16203 this.SetSize(width, height); 16204 }, 16205 SetHeight: function(height) { 16206 var width = this.GetWidth(); 16207 this.SetSize(width, height); 16208 }, 16209 GetHeight: function() { 16210 return this.GetWindowDimensionByIndex(-1, false, false); 16211 }, 16212 GetWidth: function() { 16213 return this.GetWindowDimensionByIndex(-1, true, false); 16214 }, 16215 CanBeClosedByClickOnElement: function(index, srcElement, posX, id) { 16216 return srcElement === null || ASPx.GetParentById(srcElement, id) === null; 16217 }, 16218 OnMouseDown: function(evt, index, isDraggingAllowed, pointOnScrollBar) { 16219 if(ASPx.Evt.IsLeftButtonPressed(evt)) { 16220 if((this.IsResizeAllowed(index) || isDraggingAllowed) && !this.prohibitClearSelectionOnMouseDown) 16221 ASPx.Selection.Clear(); 16222 var isResizing = this.ProcessResizeOnMouseDown(evt, index); 16223 var clickedOnScroll = pointOnScrollBar && this.GetEnableContentScrolling(index); 16224 if(isDraggingAllowed && !isResizing && !clickedOnScroll && !this.GetIsPinned(index) && !this.GetIsMaximized(index) && !ASPx.Ident.IsFocusableElementRegardlessTabIndex(evt.target)) 16225 this.OnDragStart(evt, index); 16226 } 16227 }, 16228 OnMouseMove: function(evt, index) { 16229 if(this.allowResize && !this.GetIsCollapsed(index) && !this.GetIsMaximized(index)) 16230 this.CreateResizeCursorInfo(evt, index); 16231 }, 16232 CreateResizeCursorInfo: function(evt, index) { 16233 var element = this.GetWindowElement(index); 16234 var mainCell = this.GetWindowMainCell(element); 16235 var clientWindow = this.GetWindowClientTable(index); 16236 var headerElement = this.GetWindowHeaderElement(index); 16237 var left = ASPx.GetAbsoluteX(mainCell); 16238 var top = ASPx.GetAbsoluteY(mainCell); 16239 var x = ASPx.Evt.GetEventX(evt); 16240 var y = ASPx.Evt.GetEventY(evt); 16241 var mainCellWidth = mainCell.offsetWidth; 16242 var mainCellHeight = mainCell.offsetHeight; 16243 var leftOffset = Math.abs(x - left); 16244 var rightOffset = Math.abs(x - left - mainCellWidth); 16245 var topOffset = Math.abs(y - top); 16246 var bottomOffset = Math.abs(y - top - mainCellHeight); 16247 var cursorInfo = this.CreateResizeBorderCursorInfo(index, leftOffset, rightOffset, topOffset, bottomOffset); 16248 var grip = this.GetWindowSizeGripElement(index); 16249 if(grip) { 16250 var gripCursorInfo = this.CreateGripCursorInfo(index, mainCell, grip, leftOffset, rightOffset, bottomOffset); 16251 if(gripCursorInfo) 16252 cursorInfo = gripCursorInfo; 16253 } 16254 this.UpdateResizeCursor(index, clientWindow, cursorInfo.verticalDirection, cursorInfo.horizontalDirection); 16255 this.UpdateResizeCursor(index, mainCell, cursorInfo.verticalDirection, cursorInfo.horizontalDirection); 16256 if(headerElement) 16257 this.UpdateResizeCursor(index, headerElement, cursorInfo.verticalDirection, cursorInfo.horizontalDirection); 16258 return cursorInfo; 16259 }, 16260 UpdateResizeCursor: function(index, element, verticalDirection, horizontalDirection) { 16261 var cursor = verticalDirection + horizontalDirection; 16262 if(cursor == "") 16263 this.HideTemporaryCursor(element); 16264 else { 16265 cursor += "-resize"; 16266 this.ShowTemporaryCursor(element, cursor); 16267 } 16268 }, 16269 CreateGripCursorInfo: function(index, mainCell, grip, leftOffset, rightOffset, bottomOffset) { 16270 var gripWidth = this.rtl 16271 ? ASPx.GetAbsoluteX(grip) - ASPx.GetAbsoluteX(mainCell) + grip.offsetWidth 16272 : mainCell.offsetWidth - (ASPx.GetAbsoluteX(grip) - ASPx.GetAbsoluteX(mainCell)); 16273 var gripHeight = mainCell.offsetHeight - (ASPx.GetAbsoluteY(grip) - ASPx.GetAbsoluteY(mainCell)); 16274 if(gripHeight > bottomOffset) { 16275 if(this.rtl && gripWidth > leftOffset) 16276 return new PCResizeCursorInfo("w", "s", leftOffset, bottomOffset); 16277 if(gripWidth > rightOffset) 16278 return new PCResizeCursorInfo("e", "s", rightOffset, bottomOffset); 16279 } 16280 return null; 16281 }, 16282 CreateResizeBorderCursorInfo: function(index, leftOffset, rightOffset, topOffset, bottomOffset) { 16283 var ResizeBorderSize = this.ResizeBorderSize; 16284 var verticalDirection = this.GetResizeVerticalCourse(ResizeBorderSize, topOffset, bottomOffset); 16285 ResizeBorderSize = verticalDirection != "" ? this.ResizeCornerBorderSize : this.ResizeBorderSize; 16286 var horizontalDirection = this.GetResizeHorizontalCourse(ResizeBorderSize, leftOffset, rightOffset); 16287 if(verticalDirection == "" && horizontalDirection != "") 16288 verticalDirection = this.GetResizeVerticalCourse(this.ResizeCornerBorderSize, topOffset, bottomOffset); 16289 var horizontalOffset = leftOffset < rightOffset ? leftOffset : rightOffset; 16290 var verticalOffset = topOffset < bottomOffset ? topOffset : bottomOffset; 16291 return new PCResizeCursorInfo(horizontalDirection, verticalDirection, horizontalOffset, verticalOffset); 16292 }, 16293 GetResizeVerticalCourse: function(ResizeBorderSize, topOffset, bottomOffset) { 16294 if(ResizeBorderSize > topOffset) return "n"; 16295 if(ResizeBorderSize > bottomOffset) return "s"; 16296 return ""; 16297 }, 16298 GetResizeHorizontalCourse: function(ResizeBorderSize, leftOffset, rightOffset) { 16299 if(ResizeBorderSize > leftOffset) return "w"; 16300 if(ResizeBorderSize > rightOffset) return "e"; 16301 return ""; 16302 }, 16303 ProcessResizeOnMouseDown: function(evt, index) { 16304 var isResizing = false; 16305 if(this.IsResizeAllowed(index) && !this.GetIsCollapsed(index) && !this.GetIsMaximized(index)) { 16306 var eventSourceControl = ASPx.Evt.GetEventSource(evt); 16307 var eventFromPopupContainer = ASPx.ElementHasCssClass(eventSourceControl, PopupControlCssClasse
16307s.ContentCssClassName) || 16308 !ASPx.GetParentByClassName(eventSourceControl, PopupControlCssClasses.ContentCssClassName) || 16309 this.eventFromOwnPopupContent(eventSourceControl); 16310 if(eventFromPopupContainer && getComputedStyle(evt.target).cursor !== "pointer") 16311 isResizing = this.OnResizeStart(evt, index); 16312 } 16313 if(isResizing && ASPx.Browser.WebKitTouchUI) 16314 aspxGetPopupControlCollection().OverStop(); 16315 return isResizing; 16316 }, 16317 eventFromOwnPopupContent: function(element) { 16318 while(element != null) { 16319 if(element.tagName == "BODY") 16320 return false; 16321 if(element.style.position == "absolute") { 16322 var windowIndex = this.GetWindowIndex(element); 16323 var isPopupWindow = !isNaN(windowIndex); 16324 if(isPopupWindow) { 16325 if(this.GetWindowElementId(windowIndex) == element.id) 16326 return true; 16327 return false; 16328 } else { 16329 var elementIsOtherPopup = element.style.zIndex >= this.GetPopupControlZIndex(); 16330 if(elementIsOtherPopup) 16331 return false; 16332 } 16333 } 16334 element = element.parentNode; 16335 } 16336 return false; 16337 }, 16338 OnResizeStart: function(evt, index) { 16339 if(!aspxGetPopupControlCollection().IsResizeInint()) { 16340 var cursor = this.CreateResizeCursorInfo(evt, index); 16341 if(cursor.course != "") { 16342 aspxGetPopupControlCollection().setIframesMouseMoveEnabled(false); 16343 this.EnsureWindowCoverDiv(index); 16344 this.SetIsResized(index, true); 16345 var resizePanel = this.CreateResizePanel(index); 16346 this.UpdateResizeCursor(index, resizePanel, cursor.verticalDirection, cursor.horizontalDirection); 16347 aspxGetPopupControlCollection().InitResizeObject(this, index, cursor, resizePanel); 16348 this.OnResize(evt, index, cursor, resizePanel); 16349 } 16350 ASPx.TouchUIHelper.startPreventingTouchMove(); 16351 } 16352 return aspxGetPopupControlCollection().IsResizeInint(); 16353 }, 16354 OnResizeStop: function(evt, index, cursor, resizePanel) { 16355 if(this.IsResizeAllowed(index)) { 16356 ASPx.TouchUIHelper.stopPreventingTouchMove(); 16357 aspxGetPopupControlCollection().setIframesMouseMoveEnabled(true); 16358 this.RemoveWindowCoverDiv(); 16359 var windowElement; 16360 if(!this.isLiveResizingMode) { 16361 windowElement = this.GetWindowElement(index); 16362 ASPx.GetControlCollection().CollapseControls(windowElement); 16363 this.OnResizeWindow(index, cursor, resizePanel); 16364 } 16365 this.CreateResizeCursorInfo(evt, index); 16366 this.UpdateWindowsStateCookie(); 16367 this.RaiseResize(index); 16368 if(!this.isLiveResizingMode) 16369 ASPx.GetControlCollection().AdjustControls(windowElement, true); 16370 } 16371 this.ResetResizeSessionCache(); 16372 }, 16373 OnResizeWindow: function(index, cursor, resizePanel) { 16374 var windowElement = this.GetWindowElement(index); 16375 var resizePanelDimensions = this.GetResizePanelDimensions(); 16376 var left = resizePanelDimensions.left; 16377 var top = resizePanelDimensions.top; 16378 this.SetClientWindowSizeLite(index, resizePanelDimensions.offsetWidth, resizePanelDimensions.offsetHeight); 16379 if(this.fixedBottom) 16380 top = this.fixedBottom - windowElement.offsetHeight; 16381 if(this.fixedRight) 16382 left = this.fixedRight - windowElement.offsetWidth; 16383 this.fixedBottom = null; 16384 this.fixedRight = null; 16385 if(cursor.verticalDirection === "n") 16386 this.ChangePosOnResizeWindow(top, windowElement, false); 16387 if(cursor.horizontalDirection === "w") 16388 this.ChangePosOnResizeWindow(left, windowElement, true); 16389 if(this.InternalIsWindowVisible(index)) 16390 this.DoShowWindowIFrame(index, left, top, ASPx.InvalidDimension, ASPx.InvalidDimension); 16391 }, 16392 ChangePosOnResizeWindow: function(pos, windowElement, isX) { 16393 windowElement.style[isX ? "left" : "top"] = pos + "px"; 16394 }, 16395 SetClientWindowSizeLite: function(index, width, height, isWindowCollapsed) { 16396 this.RaiseBeforeResizing(index); 16397 this.SetClientWindowSizeCoreLite(index, width, height, isWindowCollapsed); 16398 if(!this.IsRaiseAfterResizingLocked()) 16399 this.RaiseAfterResizing(index); 16400 }, 16401 SetClientWindowSizeCoreLite: function(index, width, height, isWindowCollapsed) { 16402 var contentUrl = this.GetWindowContentIFrameUrl(index); 16403 var needToHideContent = !contentUrl; 16404 var element = this.GetWindowElement(index); 16405 var contentWrapper = this.GetWindowContentWrapperElement(index); 16406 var contentElement = this.GetWindowContentElement(index); 16407 var contentIframeElement = this.GetWindowContentIFrameElement(index); 16408 var iframeHeightCorrectionOnFirstShow = height > 0; 16409 if(contentIframeElement && (this.GetWindowIsShown(index) || iframeHeightCorrectionOnFirstShow)) 16410 contentIframeElement.style.height = "0px"; 16411 contentWrapper.style.height = ""; 16412 contentWrapper.style.width = ""; 16413 contentElement.style.height = ""; 16414 contentElement.style.width = "";
16415 var hasAnyScrollBars = this.HasAnyScrollBars(index); 16416 var expectedHeight = (!ASPx.IsExists(height) && hasAnyScrollBars) ? this.GetExpectedHeight(index) : null; 16417 if(needToHideContent) 16418 contentElement.style.display = "none"; 16419 var elementsDisplayValue = this.GetWindowElementDisplayValue(hasAnyScrollBars, height); 16420 element.style.display = elementsDisplayValue; 16421 if(!this.GetIsCollapsed(index)) 16422 contentWrapper.style.display = elementsDisplayValue; 16423 if(ASPx.IsExists(width)) { 16424 var actualWidth = width - this.GetElementBordersAndPaddings(index, element, true); 16425 if(actualWidth <= 0) 16426 actualWidth = ASPx.Browser.WebKitFamily ? 1 : 0; 16427 element.style.width = actualWidth + "px"; 16428 } 16429 var actualHeight; 16430 if(ASPx.IsExists(height)) { 16431 actualHeight = height - this.GetElementBordersAndPaddings(index, element, false); 16432 if(actualHeight < 0) 16433 actualHeight = 0; 16434 element.style.height = actualHeight + "px"; 16435 } else { 16436 if(ASPx.IsExists(expectedHeight)) { 16437 actualHeight = expectedHeight; 16438 element.style.height = actualHeight + "px"; 16439 } 16440 } 16441 this.CorrectWindowSizeGripPositionLite(index); 16442 this.CorrectWindowHeaderText(index); 16443 this.SetContentWrapperHeightLite(index, actualHeight, element, contentWrapper); 16444 var correctContentElementSize = hasAnyScrollBars || contentElement.style.overflow == "hidden" || contentElement.style.overflowX == "hidden" || contentElement.style.overflowY == "hidden"; 16445 if((correctContentElementSize || contentUrl) && (height || expectedHeight)) { 16446 if(contentElement !== contentWrapper) { 16447 var contentHeight = ASPx.GetClearClientHeight(contentWrapper); 16448 if(contentHeight < 0) 16449 contentHeight = 0; 16450 contentElement.style.height = contentHeight + "px"; 16451 } 16452 } 16453 if(correctContentElementSize && width && contentElement !== contentWrapper) 16454 contentElement.style.width = ASPx.GetClearClientWidth(contentWrapper) + "px"; 16455 contentElement.style.display = this.getContentElementDisplay(correctContentElementSize, contentUrl); 16456 if(contentIframeElement) 16457 contentIframeElement.style.height = "100%"; 16458 this.SetWindowWidth(index, width); 16459 this.SetWindowHeight(index, height); 16460 if(isWindowCollapsed) 16461 this.ResetWindowHeight(index); 16462 }, 16463 GetExpectedHeight: function(index) { 16464 var height = this.GetWindowHeightInternal(index) || 0; 16465 height = Math.max(height, this.GetWindowMinHeight(index)); 16466 if(this.HasAnyScrollBars(index)) { 16467 var windowHeight = this.GetWindowContentElement(index).offsetHeight + this.GetWindowHeightWithoutContent(index); 16468 height = Math.max(height, windowHeight); 16469 } 16470 var maxHeight = this.GetWindowMaxHeight(index); 16471 if(maxHeight) 16472 height = Math.min(height, maxHeight); 16473 return height; 16474 }, 16475 IsRaiseAfterResizingLocked: function() { 16476 return false; 16477 }, 16478 CreateResizePanel: function(index) { 16479 var element = this.GetWindowElement(index); 16480 var resizePanel = document.createElement("DIV"); 16481 element.parentNode.appendChild(resizePanel); 16482 resizePanel.style.overflow = "hidden"; 16483 resizePanel.style.position = "absolute"; 16484 resizePanel.style.zIndex = this.GetPopupControlZIndex() + aspxGetPopupControlCollection().visiblePopupWindowIds.length * 2 + 2; 16485 if(!this.isLiveResizingMode) 16486 resizePanel.style.border = "black 1px dotted"; 16487 return resizePanel; 16488 }, 16489 OnResize: function(evt, index, cursor, resizePanel) { 16490 this.OnResizePanelLite(evt, index, cursor, resizePanel); 16491 if(this.isLiveResizingMode) 16492 this.OnResizeWindow(index, cursor, resizePanel); 16493 ASPx.Selection.Clear(); 16494 if(ASPx.Browser.WebKitTouchUI) 16495 ASPx.Evt.PreventEvent(evt); 16496 if(this.GetIsPinned(index)) 16497 this.HoldPosition(index, true, resizePanel); 16498 }, 16499 OnResizePanelLite: function(evt, index, cursor, resizePanel) { 16500 var x = ASPx.Evt.GetEventX(evt); 16501 var y = ASPx.Evt.GetEventY(evt); 16502 var element = this.GetWindowElement(index); 16503 var elementTop = ASPx.GetAbsoluteY(element); 16504 var elementLeft = ASPx.GetAbsoluteX(element); 16505 var newLeft = ASPx.PxToInt(element.style.left); 16506 var newTop = ASPx.PxToInt(element.style.top); 16507 var newWidth = element.offsetWidth; 16508 var newHeight = element.offsetHeight; 16509 if(cursor.verticalDirection == "n") { 16510 if(!this.fixedBottom) 16511 this.fixedBottom = newTop + newHeight;
16512 newHeight += elementTop - y + cursor.verticalOffset; 16513 newTop = ASPx.PrepareClientPosForElement(y - cursor.verticalOffset, element, false); 16514 } 16515 if(cursor.verticalDirection == "s") { 16516 newHeight = y - elementTop + cursor.verticalOffset; 16517 this.fixedBottom = null; 16518 } 16519 if(cursor.horizontalDirection == "w") { 16520 if(!this.fixedRight) 16521 this.fixedRight = newLeft + newWidth; 16522 newWidth += elementLeft - x + cursor.horizontalOffset; 16523 newLeft = ASPx.PrepareClientPosForElement(x - cursor.horizontalOffset, element, true); 16524 } 16525 if(cursor.horizontalDirection == "e") { 16526 newWidth = x - elementLeft + cursor.horizontalOffset; 16527 this.fixedRight = null; 16528 } 16529 if(newWidth > 0 && newHeight > 0) { 16530 var minWidth = this.GetWindowMinWidth(index); 16531 var maxWidth = this.GetWindowMaxWidth(index); 16532 if(minWidth && newWidth < minWidth) 16533 newWidth = minWidth; 16534 if(maxWidth && newWidth > maxWidth) 16535 newWidth = maxWidth; 16536 var minHeight = this.GetWindowMinHeight(index); 16537 var maxHeight = this.GetWindowMaxHeight(index); 16538 if(minHeight && newHeight < minHeight) 16539 newHeight = minHeight; 16540 if(maxHeight && newHeight > maxHeight) 16541 newHeight = maxHeight; 16542 this.SetResizePanelDimensions(newLeft, newTop, newWidth, newHeight); 16543 var widthWithoutBorders = newWidth - this.getLeftRightBordersAndPaddingsSummaryValue(resizePanel); 16544 var heightWithoutBorders = newHeight - this.getTopBottomBordersAndPaddingsSummaryValue(resizePanel); 16545 ASPx.SetStyles(resizePanel, { 16546 left: newLeft, top: newTop, 16547 width: widthWithoutBorders, height: heightWithoutBorders 16548 }); 16549 this.SetWindowLeft(index, elementLeft); 16550 this.SetWindowTop(index, elementTop); 16551 } 16552 }, 16553 SetResizePanelDimensions: function(left, top, offsetWidth, offsetHeight) { 16554 var cache = this.GetResizeSessionCache(); 16555 cache.resizePanelDimensions = { 16556 left: left, 16557 top: top, 16558 offsetWidth: offsetWidth, 16559 offsetHeight: offsetHeight 16560 }; 16561 }, 16562 GetResizePanelDimensions: function() { 16563 var cache = this.GetResizeSessionCache(); 16564 return cache.resizePanelDimensions; 16565 }, 16566 ResetResizeSessionCache: function() { 16567 this.resizeSessionCache = {}; 16568 }, 16569 GetResizeSessionCache: function() { 16570 return aspxGetPopupControlCollection().IsResizeInint() ? this.resizeSessionCache : {}; 16571 }, 16572 EnsureWindowCoverDiv: function(index) { 16573 this.windowCoverDiv = this.CreateCoverDiv(index); 16574 var windowElement = this.GetWindowElement(index); 16575 windowElement.parentNode.appendChild(this.windowCoverDiv); 16576 }, 16577 CreateCoverDiv: function(index) { 16578 var coverDiv = document.createElement("DIV"); 16579 ASPx.SetStyles(coverDiv, { 16580 position: "fixed", 16581 left: 0, 16582 top: 0, 16583 width: "100%", 16584 height: "100%" 16585 }); 16586 return coverDiv; 16587 }, 16588 RemoveWindowCoverDiv: function() { 16589 if(!!this.windowCoverDiv) { 16590 this.windowCoverDiv.parentNode.removeChild(this.windowCoverDiv); 16591 this.windowCoverDiv = null; 16592 } 16593 }, 16594 OnDrag: function(index, x, y, xClientCorrection, yClientCorrection) { 16595 var element = this.GetWindowElement(index); 16596 if(element != null) { 16597 ASPx.SetStyles(element, { left: x, top: y }); 16598 xClientCorrection = typeof (xClientCorrection) != "undefined" ? xClientCorrection : 0; 16599 yClientCorrection = typeof (yClientCorrection) != "undefined" ? yClientCorrection : 0; 16600 this.SetWindowLeft(index, x + xClientCorrection); 16601 this.SetWindowTop(index, y + yClientCorrection); 16602 var iFrame = element.overflowElement; 16603 if(iFrame) 16604 ASPx.SetStyles(iFrame, { left: x, top: y }); 16605 if(ASPx.Browser.Opera) 16606 ASPx.Selection.Clear(); 16607 } 16608 }, 16609 OnDragStop: function(index) { 16610 this.HideDragCursor(index); 16611 this.UpdateWindowsStateCookie(); 16612 if(this.GetWindowContentIFrameElement(index)) 16613 this.SetIframeVisibleForDragging(index, true); 16614 ASPx.TouchUIHelper.stopPreventingTouchMove(); 16615 this.RaiseDragged(index); 16616 }, 16617 OnDragStart: function(evt, index) { 16618 this.RaiseBeforeDrag(index); 16619 this.SetIsDragged(index, true); 16620 this.ShowDragCursor(index); 16621 ASPx.TouchUIHelper.startPreventingTouchMove(); 16622 if(this.GetWindowContentIFrameElement(index)) 16623 this.SetIframeVisibleForDragging(index, false); 16624 this.InitDragInfo(index, evt); 16625 }, 16626 HideIframeElementBeforeDragging: function() { 16627 }, 16628 InitDragInfo: function(index, evt) { 16629 var element = this.GetWindowElement(index); 16630 var gragXOffset = ASPx.GetAbsoluteX(element) - ASPx.Evt.GetEventX(evt); 16631 var gragYOffset = ASPx.GetAbsoluteY(element) - ASPx.Evt.GetEventY(evt); 16632 var xClientCorrection = this.GetDragCorrection(index, element, true); 16633 var yClientCorrection = this.GetDragCorrection(index, element, false); 16634 gragXOffset -= xClientCorrection; 16635 gragYOffset -= yClientCorrection; 16636 aspxGetPopupControlCollection().InitDragObject(this, index, gragXOffset, gragYOffset, xClientCorrection, yClientCorrection); 16637 }, 16638 GetDragCorrection: function(index, element, isX) { 16639 return ASPx.GetPositionElementOffset(element, isX); 16640 }, 16641 ShowDragCursor: function(index) { 16642 var dragElement = this.GetDragElement(index);
16643 if(dragElement) 16644 this.ShowTemporaryCursor(dragElement, "move"); 16645 }, 16646 ShowTemporaryCursor: function(element, cursor) { 16647 ASPx.Attr.ChangeStyleAttribute(element, "cursor", cursor); 16648 }, 16649 HideDragCursor: function(index) { 16650 var dragElement = this.GetDragElement(index); 16651 if(dragElement != null) 16652 this.HideTemporaryCursor(dragElement); 16653 }, 16654 GetDragElement: function(index) { 16655 var headerElement = this.GetWindowHeaderElement(index); 16656 var element = this.GetWindowElement(index); 16657 if(element != null) 16658 return (headerElement != null ? headerElement : this.GetWindowMainCell(element)); 16659 return null; 16660 }, 16661 HideTemporaryCursor: function(element) { 16662 ASPx.Attr.RestoreStyleAttribute(element, "cursor"); 16663 }, 16664 OnDocumentKeyDown: function(evt, popupWindow) { 16665 var handler = this.keyDownHandlers && this.keyDownHandlers[ASPx.GetShortcutCode(evt.keyCode, evt.ctrlKey, evt.shiftKey, evt.altKey)]; 16666 if(handler) 16667 handler(this.GetWindowIndex(popupWindow)); 16668 }, 16669 OnEscKeyDown: function(index) { 16670 if(this.GetEnableCloseByEsc(index)) 16671 this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.Escape); 16672 }, 16673 OnRefreshButtonClick: function(index) { 16674 var contentIFrame = this.GetWindowContentIFrameElement(index); 16675 if(contentIFrame) 16676 this.RefreshWindowContentUrl(this.GetWindow(index)); 16677 else 16678 this.PerformWindowCallback(this.GetWindow(index)); 16679 }, 16680 OnCloseButtonClick: function(index) { 16681 this.RaiseCloseButtonClick(index); 16682 if(this.GetWindowCloseAction(index) != "None") 16683 this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.CloseButton); 16684 }, 16685 Show: function(popupElementIndex) { 16686 this.ShowWindowByIndex(-1, popupElementIndex); 16687 }, 16688 Hide: function() { 16689 this.HideWindow(null); 16690 }, 16691 HideWindow: function(window) { 16692 var index = (window != null) ? window.index : -1; 16693 this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.API); 16694 }, 16695 RaiseEventByIndex: function(index, event, argsName) { 16696 if(!event.IsEmpty()) { 16697 var window = index < 0 ? null : this.GetWindow(index), 16698 args = new argsName(window); 16699 event.FireEvent(this, args); 16700 } 16701 }, 16702 RaiseCloseButtonClick: function(index) { 16703 this.RaiseEventByIndex(index, this.CloseButtonClick, ASPxClientPopupWindowEventArgs); 16704 }, 16705 RaiseShown: function(index) { 16706 this.RaiseEventByIndex(index, this.Shown, ASPxClientPopupWindowEventArgs); 16707 }, 16708 RaisePopUp: function(index) { 16709 this.RaiseEventByIndex(index, this.PopUp, ASPxClientPopupWindowEventArgs); 16710 }, 16711 RaiseBeforeResizing: function(index) { 16712 this.RaiseEventByIndex(index, this.BeforeResizing, ASPxClientPopupWindowEventArgs); 16713 }, 16714 RaiseAfterResizing: function(index) { 16715 this.RaiseEventByIndex(index, this.AfterResizing, ASPxClientPopupWindowEventArgs); 16716 }, 16717 RaiseDragged: function(index) { 16718 this.RaiseEventByIndex(index, this.Dragged, ASPxClientPopupWindowEventArgs); 16719 }, 16720 RaiseBeforeDrag: function(index) { 16721 this.RaiseEventByIndex(index, this.BeforeDrag, ASPxClientPopupWindowEventArgs); 16722 }, 16723 RaiseClosing: function(index, closeReason) { 16724 var window = index < 0 ? null : this.GetWindow(index); 16725 var cancel = false; 16726 if(!this.Closing.IsEmpty()) { 16727 var args = new ASPxClientPopupWindowCancelEventArgs(window, closeReason); 16728 this.Closing.FireEvent(this, args); 16729 cancel = args.cancel; 16730 } 16731 return cancel; 16732 }, 16733 RaiseCloseUp: function(index, closeReason) { 16734 var window = index < 0 ? null : this.GetWindow(index); 16735 if(!this.CloseUp.IsEmpty()) { 16736 var args = new ASPxClientPopupWindowCloseUpEventArgs(window, closeReason); 16737 this.CloseUp.FireEvent(this, args); 16738 } 16739 }, 16740 RaiseResize: function(index, resizeState) { 16741 var window = index < 0 ? null : this.GetWindow(index); 16742 if(!this.Resize.IsEmpty()) { 16743 if(!resizeState) 16744 resizeState = ASPxClientPopupControlResizeState.Resized; 16745 var args = new ASPxClientPopupWindowResizeEventArgs(window, resizeState); 16746 this.Resize.FireEvent(this, args); 16747 } 16748 }, 16749 RaisePopupOnShow: function(isMoving, index) { 16750 if(!isMoving) { 16751 this.RaisePopUp(index); 16752 if(!this.IsAnimationAllowed() || !this.HasOpenAnimation()) 16753 this.OnWindowShown(index); 16754 } 16755 }, 16756 OnActivate: function(index, evt) { 16757 var element = this.GetWindowElement(index); 16758 if(element != null) 16759 aspxGetPopupControlCollection().ActivateWindowElement(element, evt, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex()); 16760 }, 16761 OnPWHBClickCore: function(evt, index, method) { 16762 this.OnActivate(index, evt); 16763 if(ASPx.TouchUIHelper.handleFastTapIfRequired(evt, 16764 function() { this[method](index); }.aspxBind(this), true)) { 16765 return; 16766 } 16767 if(ASPx.Browser.Opera) 16768 ASPx.Evt.EmulateDocumentOnMouseDown(evt); 16769 this[method](index); 16770 }, 16771 OnScroll: function(evt, index) { 16772 if(this.HasIframeOnIos(index)) 16773 this.ResetWebkitScrolling(this.getTouchScrollerElement(index), 0); 16774 if(!this.GetIsPinned(index) || (this.lockScroll > 0)) return; 16775 this.AdjustPinPositionWhileScroll(index); 16776 }, 16777 ResetWebkitScrolling: function(scrollElement, timeout) { 16778 if(scrollElement.scrollTop === 0) { 16779 var styleName = "-webkit-overflow-scrolling"; 16780 scrollElement.style[styleName] = "auto"; 16781 window.setTimeout(function() { 16782 scrollElement.style[styleName] = "touch"; 16783 }.aspxBind(this), timeout); 16784 } 16785 }, 16786 HaveSpecialDivForAnimation: function() { 16787 return this.enableAnimation; 16788 }, 16789 HasIframeOnIos: function(index) { 16790 return ASPx.Browser.MacOSMobilePlatform && !!this.GetWindowContentIFrameElement(index); 16791 }, 16792 WindowIsModal: function(index) { 16793 return this.GetPropertyValue(index, "modal"); 16794 }, 16795 GetIsPopuped: function(index) { 16796 if(0 <= index && index < this.GetWindowCountCore()) 16797 return this.windowsIsPopupedList[index]; 16798 return this.defaultIsPopuped; 16799 }, 16800 SetIsPopuped: function(index, isPopuped) { 16801 if(0 <= index && index < this.GetWindowCountCore()) 16802 this.windowsIsPopupedList[index] = isPopuped; 16803 this.defaultIsPopuped = isPopuped; 16804 }, 16805 GetIsMaximized: function(index) { 16806 return false; 16807 }, 16808 GetIsMaximizedInit: function(index) { 16809 return false; 16810 }, 16811 GetCurrentLeft: function(index) { 16812 return this.GetPosition(index, true); 16813 }, 16814 GetCurrentTop: function(index) { 16815 return this.GetPosition(index, false); 16816 }, 16817 GetIsPinned: function(index) { 16818 return false; 16819 }, 16820 GetIsCollapsed: function(index) { 16821 return false; 16822 }, 16823 needToHidePinnedOutFromViewPort: function(index) { 16824 return false; 16825 }, 16826 GetHideBodyScrollWhenModal: function(index) { 16827 return false; 16828 }, 16829 GetCanScrollViewPort: function(index) { 16830 return false; 16831 }, 16832 GetEnableContentScrolling: function(index) { 16833 return false; 16834 }, 16835 AutoUpdateElementsPosition: function() { 16836 }, 16837 GetWindowChild: function(index, idPostfix) { 16838 var elem = this.GetWindowElement(index); 16839 if(elem) 16840 return ASPx.GetChildById(elem, this.name + idPostfix); 16841 return null; 16842 }, 16843 GetWindowIndex: function(element) {
16844 var id = element.id; 16845 var pos = id.lastIndexOf(ASPx.PCWIdSuffix); 16846 return parseInt(id.substr(pos + ASPx.PCWIdSuffix.length)); 16847 }, 16848 GetWindow: function(index) { 16849 return (0 <= index && index < this.windows.length) ? this.windows[index] : null; 16850 }, 16851 DoShowWindowIFrame: function(index, x, y, width, height) { 16852 if(!this.renderIFrameForPopupElements) return; 16853 var element = this.GetWindowElement(index); 16854 var iFrame = this.GetWindowIFrame(index); 16855 if(element && iFrame) { 16856 var cell = this.GetWindowMainCell(element); 16857 if(width < 0) 16858 width = cell.offsetWidth; 16859 if(height < 0) 16860 height = cell.offsetHeight; 16861 ASPx.SetStyles(iFrame, { width: width, height: height }); 16862 if(this.IsValidPosition(x) && this.IsValidPosition(y)) 16863 ASPx.SetStyles(iFrame, { left: x, top: y }); 16864 if(ASPx.Browser.Firefox) 16865 this.ClearWindowIframeBodyInnerHtml(iFrame); 16866 ASPx.SetElementDisplay(iFrame, true); 16867 } 16868 }, 16869 IsValidPosition: function(pos) { 16870 return pos !== ASPx.InvalidPosition; 16871 }, 16872 DoHideWindowIFrame: function(element) { 16873 if(!this.renderIFrameForPopupElements) return; 16874 var iFrame = element.overflowElement; 16875 if(iFrame) 16876 ASPx.SetElementDisplay(iFrame, false); 16877 }, 16878 GetIframeBody: function(iFrame) { 16879 var document = iFrame.contentDocument || iFrame.contentWindow.document; 16880 if(document) 16881 return document.getElementsByTagName('body')[0]; 16882 }, 16883 ClearWindowIframeBodyInnerHtml: function(iFrame) { 16884 var iFrameBody = this.GetIframeBody(iFrame); 16885 if(iFrameBody) 16886 iFrameBody.innerHTML = ""; 16887 }, 16888 FindWindowIFrame: function(index) { 16889 return ASPx.GetElementById(this.name + "_DXPWIF" + index); 16890 }, 16891 GetWindowIFrame: function(index) { 16892 var element = this.GetWindowElement(index); 16893 var iFrame = element.overflowElement; 16894 if(!iFrame) { 16895 iFrame = this.FindWindowIFrame(index); 16896 element.overflowElement = iFrame; 16897 } 16898 return iFrame; 16899 }, 16900 CreateFakeDivForIframe: function(iframe) { 16901 var fakeDiv = document.createElement("div"); 16902 ASPx.SetStyles(fakeDiv, { width: iframe.offsetWidth, height: iframe.offsetHeight }); 16903 return fakeDiv; 16904 }, 16905 CreateIframeCoverDiv: function(iframe, index) { 16906 if(!this.iframeCoverDiv)
16907 this.iframeCoverDiv = []; 16908 if(!this.iframeCoverDiv[index]) 16909 this.iframeCoverDiv[index] = this.CreateFakeDivForIframe(iframe); 16910 this.iframeCoverDiv[index].style.position = "absolute"; 16911 iframe.parentElement.appendChild(this.iframeCoverDiv[index]); 16912 ASPx.SetAbsoluteX(this.iframeCoverDiv[index], ASPx.GetAbsoluteX(iframe)); 16913 ASPx.SetAbsoluteY(this.iframeCoverDiv[index], ASPx.GetAbsoluteY(iframe)); 16914 }, 16915 RemoveIframeCoverDiv: function(iframe, index) { 16916 iframe.parentElement.removeChild(this.iframeCoverDiv[index]); 16917 this.iframeCoverDiv[index] = null; 16918 }, 16919 GetWindowBorderOwnerElement: function(windowElement) { 16920 if(ASPx.ElementHasCssClass(windowElement, PopupControlCssClasses.MainDivLiteCssClass)) 16921 return windowElement; 16922 else 16923 return ASPx.GetNodeByClassName(windowElement, PopupControlCssClasses.MainDivLiteCssClass); 16924 }, 16925 GetWindowContentIFrameElement: function(index) { 16926 return this.GetWindowChild(index, "_CIF" + index); 16927 }, 16928 GetWindowContentElement: function(index) { 16929 return this.GetWindowChild(index, "_PWC" + index); 16930 }, 16931 GetWindowContentIFrameElementId: function(index) { 16932 return this.name + "_CIF" + index; 16933 }, 16934 GetContentContainer: function(index) { 16935 return this.GetWindowContentElement(index); 16936 }, 16937 getTouchScrollerElement: function(index) { 16938 return this.GetContentContainer(index); 16939 }, 16940 GetWindowHeaderElement: function(index) { 16941 return this.GetWindowChild(index, "_PWH" + index); 16942 }, 16943 GetWindowFooterElement: function(index) { 16944 return this.GetWindowChild(index, "_PWF" + index); 16945 }, 16946 GetWindowSizeGripElement: function(index) { 16947 var footer = this.GetWindowFooterElement(index); 16948 if(!footer) 16949 return null; 16950 var descendants = ASPx.GetNodesByClassName(footer, PopupControlCssClasses.SizeGripLiteCssClassName); 16951 return descendants.length > 0 ? descendants[0] : null; 16952 }, 16953 GetWindowContentWrapperElement: function(index) { 16954 if(!ASPx.IsExistsElement(this.windowContentElements[index])) { 16955 var windowElem = this.GetWindowElement(index); 16956 var contentWrapperParent = this.GetWindowMainCell(windowElem); 16957 this.windowContentElements[index] = ASPx.GetChildByClassName(contentWrapperParent, PopupControlCssClasses.ContentWrapperCssClassName); 16958 } 16959 return this.windowContentElements[index]; 16960 }, 16961 GetWindowMainCell: function(element) { 16962 return this.HaveSpecialDivForAnimation() ? ASPx.GetNodeByTagName(element, "DIV", 0) : element; 16963 }, 16964 GetWindowModalElement: function(index) { 16965 var element = this.GetWindowElement(index); 16966 if(!element) return; 16967 var modalElement = element.modalElement; 16968 if(!modalElement) { 16969 modalElement = this.FindWindowModalElement(index); 16970 element.modalElement = modalElement; 16971 if(modalElement) { 16972 modalElement.DXModalPopupControl = this; 16973 modalElement.DXModalPopupWindowIndex = index; 16974 } 16975 } 16976 return modalElement; 16977 }, 16978 CanManipulateWithModalElement: function(index) { 16979 return this.WindowIsModal(index); 16980 }, 16981 GetCurrentZIndex: function(index) { 16982 var element = this.GetWindowElement(index); 16983 if(element != null) { 16984 if(element.style.zIndex != "" && element.style.zIndex != this.GetDefaultZIndexFromServer()) 16985 return element.style.zIndex; 16986 return this.GetZIndex(index); 16987 } 16988 }, 16989 GetWindowsState: function() { 16990 var state = ""; 16991 if(this.HasDefaultWindow()) { 16992 state += this.GetWindowState(-1); 16993 } 16994 return state; 16995 }, 16996 GetWindowState: function(index) { 16997 var element = this.GetWindowElement(index); 16998 if(element != null) { 16999 var visibleFlag = (!this.InternalIsWindowVisible(index) || element.isHiding) ? "0" : "1"; 17000 var isDraggedFlag = this.GetIsDragged(index) ? "1" : "0"; 17001 var zIndex = this.GetCurrentZIndex(index); 17002 var isResized = this.GetIsResized(index); 17003 var isResizedFlag = isResized ? "1" : "0"; 17004 var width = null, height=null; 17005 if(isResized) { 17006 width = this.GetWindowWidthInternal(index); 17007 height = this.GetIsCollapsed(index) ? this.GetWindowDimensionByIndex(index, false, true) : this.GetWindowHeightInternal(index); 17008 } else { 17009 width = ASPx.InvalidDimension; 17010 height = ASPx.InvalidDimension; 17011 } 17012 var contentWasLoaded = element.loaded ? "1" : "0"; 17013 var left, top; 17014 var isMaximized = this.GetIsMaximized(index); 17015 if(isMaximized && !this.MaximizationExecuting()) { 17016 var restoredWindowData = this.GetRestoredWindowData(index); 17017 left = restoredWindowData.left; 17018 top = restoredWindowData.top; 17019 } else { 17020 left = this.GetCurrentLeft(index); 17021 top = this.GetCurrentTop(index); 17022 } 17023 var isPinned = this.GetIsPinned(index); 17024 if(isPinned) { 17025 left -= ASPx.GetDocumentScrollLeft(); 17026 top -= ASPx.GetDocumentScrollTop(); 17027 }
17028 left = Math.ceil(left); 17029 top = Math.ceil(top); 17030 var pinFlag = isPinned ? "1" : "0"; 17031 var minFlag = this.GetIsCollapsed(index) ? "1" : "0"; 17032 var maxFlag = isMaximized || this.GetIsMaximizedInit(index) ? "1" : "0"; 17033 return [visibleFlag, isDraggedFlag, zIndex, left, top, isResizedFlag, width, height, contentWasLoaded, pinFlag, minFlag, maxFlag].join(":"); 17034 } 17035 return ""; 17036 }, 17037 UpdateStateObject: function(){ 17038 this.UpdateStateObjectWithObject({ windowsState: this.GetWindowsState() }); 17039 }, 17040 GetStateHiddenFieldOrigin: function() { 17041 return this.GetWindowElement(this.GetWindowCountCore() - 1); 17042 }, 17043 GetPopupType: function() { 17044 return "aspxpopup"; 17045 }, 17046 GetDefaultZIndexFromServer: function() { 17047 return defaultZIndexFromServer; 17048 }, 17049 GetPopupControlZIndex: function() { 17050 return popupControlZIndex; 17051 }, 17052 FindWindowModalElement: function(index) { 17053 return ASPx.GetElementById(this.name + "_DXPWMB" + index); 17054 }, 17055 GetWindowCloseButton: function(index) { 17056 return ASPx.GetElementById(this.name + "_HCB" + index); 17057 }, 17058 GetWindowRefreshButton: function(index) { 17059 return ASPx.GetElementById(this.name + "_HRB" + index); 17060 }, 17061 FirstShowWindow: function(index, allowChangeZIndex) { 17062 var popupHorizontalOffsetBackup = -1; 17063 var popupVerticalOffsetBackup = -1; 17064 var isFreeWindow = this.GetIsDragged(index); 17065 var x = ASPx.InvalidPosition; 17066 var y = ASPx.InvalidPosition; 17067 if(isFreeWindow) { 17068 x = this.GetWindowLeft(index); 17069 y = this.GetWindowTop(index); 17070 popupHorizontalOffsetBackup = this.popupHorizontalOffset; 17071 popupVerticalOffsetBackup = this.popupVerticalOffset; 17072 this.popupHorizontalOffset = 0; 17073 this.popupVerticalOffset = 0; 17074 } 17075 this.LockAnimation(); 17076 this.DoShowWindowCore(index, x, y, isFreeWindow ? -1 : 0, false, allowChangeZIndex); 17077 this.UnlockAnimation(); 17078 if(isFreeWindow) { 17079 this.popupHorizontalOffset = popupHorizontalOffsetBackup; 17080 this.popupVerticalOffset = popupVerticalOffsetBackup; 17081 } 17082 this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index)); 17083 this.CorrectFooterTextElementWidth(index); 17084 }, 17085 HasDefaultWindow: function() { 17086 return true; 17087 }, 17088 GetWindowCount: function() { 17089 return 0; 17090 }, 17091 GetWindowContentHtml: function(window) { 17092 var index = (window != null) ? window.index : -1; 17093 var element = this.GetContentContainer(index); 17094 return (element != null) ? element.innerHTML : ""; 17095 }, 17096 GetWindowElementId: function(index) { 17097 return this.name + ASPx.PCWIdSuffix + index; 17098 }, 17099 GetWindowElement: function(index) { 17100 if(!ASPx.IsExistsElement(this.windowElements[index])) 17101 this.windowElements[index] = ASPx.GetElementById(this.GetWindowElementId(index)); 17102 return this.windowElements[index]; 17103 }, 17104 GetWindowClientTable: function(index) { 17105 return this.GetWindowElement(index); 17106 }, 17107 GetCurrentWindowElement: function() { 17108 return this.GetWindowElement(-1); 17109 }, 17110 getActualMainElement: function() { return this.GetCurrentWindowElement(); }, 17111 ShowWindowContentUrl: function(index) { 17112 var contentIFrame = this.GetWindowContentIFrameElement(index); 17113 this.LoadWindowContentUrl(index); 17114 if(contentIFrame && contentIFrame.DXReloadAfterShowRequired) { 17115 this.RefreshWindowContentUrl(this.GetWindow(index)); 17116 contentIFrame.DXReloadAfterShowRequired = false; 17117 } 17118 }, 17119 RefreshWindowContentUrl: function(window) { 17120 this.RefreshWindowContentUrlCommon(window); 17121 }, 17122 RefreshContentUrl: function() { 17123 this.RefreshWindowContentUrl(null); 17124 }, 17125 RefreshWindowContentUrlCommon: function(window) { 17126 this.SetWindowContentUrl(window, this.GetWindowContentUrl(window)); 17127 }, 17128 GetContentUrl: function() { 17129 return this.GetWindowContentUrl(null); 17130 }, 17131 GetWindowContentUrl: function(window) { 17132 var index = (window != null) ? window.index : -1; 17133 if(!this.IsWindowVisible(window)) 17134 return this.GetWindowContentIFrameUrl(index); 17135 var element = this.GetWindowContentIFrameElement(index); 17136 return (element != null) ? element.src : ""; 17137 }, 17138 GetContentIFrame: function(window) { 17139 return this.GetWindowContentIFrame(null); 17140 }, 17141 GetWindowContentIFrame: function(window) { 17142 var index = (window != null) ? window.index : -1; 17143 return this.GetWindowContentIFrameElement(index); 17144 }, 17145 GetContentIFrameWindow: function() { 17146 var iframeElement = this.GetContentIFrame(); 17147 return iframeElement.contentWindow; 17148 }, 17149 SetContentUrl: function(url) { 17150 this.SetWindowContentUrl(null, url); 17151 }, 17152 SetWindowContentUrl: function(window, url) { 17153 var index = (window != null) ? window.index : -1; 17154 this.SetWindowContentUrlInternal(index, url); 17155 }, 17156 LoadWindowContentUrl: function(index) { 17157 var url = this.GetWindowContentIFrameUrl(index); 17158 this.LoadWindowContentFromUrl(index, url); 17159 }, 17160 LoadWindowContentFromUrl: function(index, url) { 17161 var element = this.GetWindowContentIFrameElement(index);
17162 if(element && element.src != url && element.DXSrcRaw != url) { 17163 this.SetSrcToIframeElement(index, element, url); 17164 this.SetWindowContentIFrameUrl(index, element.src); 17165 } 17166 }, 17167 SetWindowContentIFrameUrl: function(index, url) { 17168 this.SetPropertyValue(index, "contentUrl", url); 17169 }, 17170 SetWindowContentUrlInternal: function(index, url) { 17171 var element = this.GetWindowContentIFrameElement(index); 17172 var windowVisible = this.InternalIsWindowVisible(index); 17173 if(windowVisible && element != null) 17174 this.SetIframeVisibleForDragging(index, true); 17175 this.SetWindowContentIFrameUrl(index, url); 17176 var src = windowVisible ? url : ASPx.Browser.WebKitFamily && ASPx.Browser.Version >= 75 ? "about:blank" : ASPx.SSLSecureBlankUrl; 17177 if(element == null) { 17178 this.CreateWindowContentIFrameElement(index, src); 17179 this.RefreshDimensionsAfterCreateIframe(index); 17180 } 17181 else 17182 this.SetSrcToIframeElement(index, element, src); 17183 this.ReinitScrollForIframe(index); 17184 }, 17185 ReinitScrollForIframe: function(index) { 17186 if(this.HasIframeOnIos(index)) { 17187 var scrollElement = this.getTouchScrollerElement(index); 17188 if(scrollElement) { 17189 var options = this.GetWindowTouchScrollOptions(index); 17190 ASPx.TouchUIHelper.InitNativeScrolling(scrollElement, options); 17191 if(!!this.touchUIScrollers[index]) { 17192 this.touchUIScrollers[index].Destroy(); 17193 this.touchUIScrollers[index] = null; 17194 } 17195 } 17196 } 17197 }, 17198 EnsureWindowContentUrl: function(index) { 17199 var contentUrl = this.GetWindowContentIFrameUrl(index); 17200 if(contentUrl != "") 17201 this.SetWindowContentUrlInternal(index, contentUrl); 17202 }, 17203 CreateWindowContentIFrameElement: function(index, src) { 17204 var content = this.GetContentContainer(index); 17205 var iframeParent = content; 17206 content.innerHTML = ""; 17207 content.style.display = "block"; 17208 var iframe = this.CreateContentIFrameElement(index, src); 17209 this.RequireIFrameHeightAdjusting(index, iframe); 17210 iframeParent.appendChild(iframe); 17211 this.InitIFrame(index); 17212 return iframe; 17213 }, 17214 InitIFrame: function(index) { 17215 var contentIFrameElement = this.GetWindowContentIFrameElement(index); 17216 if(contentIFrameElement) { 17217 contentIFrameElement.popupControlName = this.name; 17218 contentIFrameElement.pcWndIndex = index; 17219 ASPx.Evt.AttachEventToElement(contentIFrameElement, "load", ASPx.PCIframeLoad); 17220 } 17221 }, 17222 OnIFrameLoad: function(index) { 17223 this.SetIframeLoading(index, false); 17224 }, 17225 RequireIFrameHeightAdjusting: function(index, iframe) { 17226 if(this.InternalIsWindowVisible(index)) 17227 this.AdjustIFrameHeight(index, iframe); 17228 else 17229 this.PostponeIframeAdjusting(index); 17230 }, 17231 PostponeIframeAdjusting: function(index) { 17232 this.SetIframeAdjustingPostponed(index, true); 17233 }, 17234 EnsureIFrameHeightAdjusted: function(index) { 17235 if(this.GetIframeAdjustingPostponed(index)) { 17236 var iframe = this.GetWindowContentIFrameElement(index); 17237 this.AdjustIFrameHeight(index, iframe); 17238 } 17239 }, 17240 AdjustIFrameHeight: function(index, iframe) { 17241 }, 17242 CreateContentIFrameElement: function(index, src) { 17243 var iframe = document.createElement("IFRAME"); 17244 iframe.id = this.GetWindowContentIFrameElementId(index); 17245 iframe.scrolling = "auto"; 17246 iframe.frameBorder = 0; 17247 iframe.style.width = "100%"; 17248 iframe.style.height = "100%"; 17249 iframe.style.overflow = "auto"; 17250 if(ASPx.Browser.Chrome) iframe.style.webkitBackfaceVisibility = "hidden"; 17251 if(ASPx.Browser.Edge) 17252 iframe.style["-ms-user-select"] = "text"; 17253 var titleText = this.GetWindowContentIFrameTitle(index); 17254 if(!!titleText) 17255 iframe.title = titleText; 17256 this.SetSrcToIframeElement(index, iframe, src); 17257 return iframe; 17258 }, 17259 SetSrcToIframeElement: function(index, iframeElement, src) { 17260 this.SetIframeLoading(index, true); 17261 iframeElement.src = src; 17262 if(ASPx.Browser.Chrome && src.indexOf("#")) 17263 this.PreventScrollingAfterIframeLoaded(iframeElement); 17264 iframeElement.DXSrcRaw = src; 17265 }, 17266 PreventScrollingAfterIframeLoaded: function(iframeElement) { 17267 var docScrollTop = ASPx.GetDocumentScrollTop(); 17268 var onIframeLoadedHandler = function() { 17269 window.setTimeout(function() { 17270 ASPx.SetDocumentScrollTop(docScrollTop); 17271 ASPx.Evt.DetachEventFromElement(iframeElement, "load", onIframeLoadedHandler); 17272 }, 0); 17273 }; 17274 ASPx.Evt.AttachEventToElement(iframeElement, "load", onIframeLoadedHandler); 17275 }, 17276 GetWindowHeaderTextCell: function(index) { 17277 return this.GetWindowChild(index, "_PWH" + index + "T"); 17278 }, 17279 GetWindowHeaderTextElement: function(index) { 17280 var element = this.GetWindowHeaderTextCell(index); 17281 if(element != null) { 17282 var link = ASPx.GetNodeByTagName(element, "A", 0); 17283 return link || element; 17284 } 17285 return null; 17286 }, 17287 GetWindowHeaderLinkElement: function(index) { 17288 var element = this.GetWindowHeaderElement(index); 17289 return element ? ASPx.GetNodeByClassName(element, PopupControlCssClasse
17289s.LinkCssClassName) : null; 17290 }, 17291 GetWindowHeaderImageCell: function(index) { 17292 return this.GetWindowChild(index, "_PWH" + index + "I"); 17293 }, 17294 GetWindowFooterTextCell: function(index) { 17295 return this.GetWindowChild(index, "_PWF" + index + "T"); 17296 }, 17297 GetWindowFooterTextElement: function(index) { 17298 var element = this.GetWindowFooterTextCell(index); 17299 if(element != null) { 17300 var link = ASPx.GetNodeByTagName(element, "A", 0); 17301 return link || element; 17302 } 17303 return null; 17304 }, 17305 GetWindowFooterLinkElement: function(index) { 17306 var element = this.GetWindowFooterElement(index); 17307 return element ? ASPx.GetNodeByClassName(element, PopupControlCssClasses.LinkCssClassName) : null; 17308 }, 17309 GetWindowFooterImageCell: function(index) { 17310 return this.GetWindowChild(index, "_PWF" + index + "I"); 17311 }, 17312 GetWindowHeaderImageUrl: function(index) { 17313 var element = this.GetWindowHeaderImageCell(index); 17314 return element ? element.src : ""; 17315 }, 17316 SetWindowHeaderImageUrl: function(index, url) { 17317 var element = this.GetWindowHeaderImageCell(index); 17318 if(element != null) { 17319 element.src = url; 17320 } 17321 }, 17322 GetWindowFooterImageUrl: function(index) { 17323 var element = this.GetWindowFooterImageCell(index); 17324 return element ? element.src : ""; 17325 }, 17326 SetWindowFooterImageUrl: function(index, url) { 17327 var element = this.GetWindowFooterImageCell(index); 17328 if(element != null) { 17329 element.src = url; 17330 } 17331 }, 17332 GetWindowHeaderNavigateUrl: function(index) { 17333 var link = this.GetWindowHeaderLinkElement(index); 17334 if(link) 17335 return link.href || ASPx.Attr.GetAttribute(linkEl, "savedhref"); 17336 return ""; 17337 }, 17338 SetWindowHeaderNavigateUrl: function(index, url) { 17339 var link = this.GetWindowHeaderLinkElement(index); 17340 if(link) { 17341 if(ASPx.Attr.IsExistsAttribute(link, "savedhref")) 17342 ASPx.Attr.SetAttribute(link, "savedhref", url); 17343 else if(ASPx.Attr.IsExistsAttribute(link, "href")) 17344 link.href = url; 17345 } 17346 }, 17347 GetWindowFooterNavigateUrl: function(index) { 17348 var link = this.GetWindowFooterLinkElement(index); 17349 if(link) 17350 return link.href || ASPx.Attr.GetAttribute(linkEl, "savedhref"); 17351 return ""; 17352 }, 17353 SetWindowFooterNavigateUrl: function(index, url) { 17354 var link = this.GetWindowFooterLinkElement(index); 17355 if(link) { 17356 if(ASPx.Attr.IsExistsAttribute(link, "savedhref")) 17357 ASPx.Attr.SetAttribute(link, "savedhref", url); 17358 else if (ASPx.Attr.IsExistsAttribute(link, "href")) 17359 link.href = url; 17360 } 17361 }, 17362 GetWindowHeaderText: function(index) { 17363 var element = this.GetWindowHeaderTextElement(index); 17364 if(element != null) 17365 return element.innerHTML; 17366 return ""; 17367 }, 17368 SetWindowHeaderText: function(index, text) { 17369 var element = this.GetWindowHeaderTextElement(index); 17370 if(element != null) { 17371 element.innerHTML = text; 17372 this.CorrectHeaderContentElementHeight(index); 17373 this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index), true); 17374 } 17375 }, 17376 GetWindowFooterText: function(index) { 17377 var element = this.GetWindowFooterTextElement(index); 17378 if(element != null) 17379 return element.innerHTML; 17380 return ""; 17381 }, 17382 SetWindowFooterText: function(index, text) { 17383 var element = this.GetWindowFooterTextElement(index); 17384 if(element != null) { 17385 element.innerHTML = text; 17386 this.CorrectWindowSizeGripPositionLite(index); 17387 } 17388 }, 17389 CorrectWindowSizeGripPositionLite: function(index) { 17390 var sizeGrip = this.GetWindowSizeGripElement(index); 17391 if(!sizeGrip || sizeGrip.corrected) return; 17392 sizeGrip.style[this.rtl ? "marginRight" : "marginLeft"] = "-" + sizeGrip.offsetWidth + "px"; 17393 sizeGrip.style.marginTop = "-" + sizeGrip.offsetHeight + "px"; 17394 sizeGrip.corrected = true; 17395 }, 17396 GetHeaderFooterHeightCore: function(index) { 17397 var extenders = [ 17398 this.GetWindowHeaderElement(index), 17399 this.GetWindowFooterElement(index) 17400 ], height = 0; 17401 for(var i = 0; i < extenders.length; i++) { 17402 if(extenders[i]) 17403 height += extenders[i].offsetHeight; 17404 } 17405 return height; 17406 }, 17407 GetHeaderImageUrl: function() { 17408 return this.GetWindowHeaderImageUrl(-1); 17409 }, 17410 SetHeaderImageUrl: function(value) { 17411 this.SetWindowHeaderImageUrl(-1, value); 17412 }, 17413 GetFooterImageUrl: function() { 17414 return this.GetWindowFooterImageUrl(-1); 17415 }, 17416 SetFooterImageUrl: function(value) { 17417 this.SetWindowFooterImageUrl(-1, value); 17418 }, 17419 GetHeaderNavigateUrl: function() { 17420 return this.GetWindowHeaderNavigateUrl(-1); 17421 }, 17422 SetHeaderNavigateUrl: function(value) { 17423 this.SetWindowHeaderNavigateUrl(-1, value); 17424 }, 17425 GetFooterNavigateUrl: function() { 17426 return this.GetWindowFooterNavigateUrl(-1); 17427 }, 17428 SetFooterNavigateUrl: function(value) { 17429 this.SetWindowFooterNavigateUrl(-1, value); 17430 }, 17431 GetHeaderText: function() { 17432 return this.GetWindowHeaderText(-1); 17433 }, 17434 SetHeaderText: function(value) { 17435 this.SetWindowHeaderText(-1, value); 17436 }, 17437 GetFooterText: function() { 17438 return this.GetWindowFooterText(-1); 17439 }, 17440 SetFooterText: function(value) { 17441 this.SetWindowFooterText(-1, value); 17442 }, 17443 GetVisible: function() { 17444 return this.IsVisible(); 17445 }, 17446 SetVisible: function(visible) { 17447 if(visible && !this.IsVisible()) 17448 this.Show(); 17449 else if(!visible && this.IsVisible()) 17450 this.Hide(); 17451 }, 17452 GetStateHiddenFieldName: function() { 17453 return this.uniqueID + "State"; 17454 }, 17455 GetWindowCountCore: function() { 17456 return 0; 17457 }, 17458 IsWindowElementsIDAssigned: function(index) { 17459 var contentElement = this.GetWindowContentElement(index); 17460 return ASPx.IsExistsElement(contentElement); 17461 }, 17462 InitializeDOM: function () { 17463 var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1); 17464 if(windowElement) 17465 windowElement.dxinit = true; 17466 }, 17467 IsDOMInitialized: function() { 17468 var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1); 17469 return windowElement && windowElement.dxinit; 17470 }, 17471 IsDOMDisposed: function() { 17472 var windowElement = this.GetWindowElement(this.GetWindowCountCore() - 1); 17473 return !ASPx.IsExistsElement(windowElement); 17474 }, 17475 OnDispose: function() { 17476 ASPxClientControl.prototype.OnDispose.call(this); 17477 this.ClearPopupElementConnection(); 17478 }, 17479 RegisterInControlTree: function(tree) { 17480 var mainNode = tree.createNode(null, this); 17481 if(this.HasDefaultWindow()) 17482 this.RegisterRelatedNodeForWindowElement(tree, -1, mainNode); 17483 for(var i = 0; i < this.GetWindowCount() ; i++) 17484 this.RegisterRelatedNodeForWindowElement(tree, i, mainNode); 17485 }, 17486 RegisterRelatedNodeForWindowElement: function(tree, windowElementIndex, mainNode) { 17487 var windowElement = this.GetWindowElement(windowElementIndex); 17488 if(windowElement) { 17489 var childNode = tree.createNode(windowElement.id, null); 17490 tree.addRelatedNode(mainNode, childNode); 17491 } 17492 }, 17493 CorrectWindowHeaderText: function(index) { 17494 var headerElement = this.GetWindowHeaderElement(index); 17495 if(!headerElement || headerElement.corrected) return; 17496 var leftChildrenWidth = 0, rightChildrenWidth = 0, headerContentElement; 17497 for(var i = 0; i < headerElement.childNodes.length; i++) { 17498 var child = headerElement.childNodes[i];
17499 if(!child.offsetWidth) continue; 17500 if(ASPx.GetElementFloat(child) === "right") 17501 rightChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child); 17502 else if(ASPx.GetElementFloat(child) === "left") 17503 leftChildrenWidth += child.offsetWidth + ASPx.GetLeftRightMargins(child); 17504 else if(!headerContentElement) 17505 headerContentElement = child; 17506 } 17507 if(headerContentElement && (leftChildrenWidth > 0 || rightChildrenWidth > 0)) { 17508 var headerContentElementStyle = ASPx.GetCurrentStyle(headerContentElement); 17509 var originalMarginLeft = parseInt(headerContentElementStyle.marginLeft); 17510 var originalMarginRight = parseInt(headerContentElementStyle.marginRight); 17511 ASPx.SetStyles(headerContentElement, { 17512 marginLeft: leftChildrenWidth + originalMarginLeft, 17513 marginRight: rightChildrenWidth + originalMarginRight 17514 }); 17515 this.CorrectHeaderContentElementHeight(index); 17516 } 17517 headerElement.corrected = true; 17518 }, 17519 CorrectHeaderContentElementHeight: function(index) { 17520 var headerElement = this.GetWindowHeaderElement(index), 17521 headerContentElement = ASPx.GetChildByClassName(headerElement, PopupControlCssClasses.HeaderContentCssClassName); 17522 if(!headerElement || !headerContentElement) return; 17523 if(headerContentElement.style.height) 17524 headerContentElement.style.height = ""; 17525 var contentElementHeight = ASPx.GetClearClientHeight(headerElement) - this.getTopBottomBordersAndPaddingsSummaryValue(headerContentElement), 17526 lineHeightForTextVerticalAlign = contentElementHeight, 17527 windowHeaderTextCell = this.GetWindowHeaderTextCell(index); 17528 if(windowHeaderTextCell) 17529 lineHeightForTextVerticalAlign -= this.getTopBottomBordersAndPaddingsSummaryValue(windowHeaderTextCell); 17530 ASPx.SetStyles(headerContentElement, { lineHeight: lineHeightForTextVerticalAlign, height: contentElementHeight }, false); 17531 }, 17532 CorrectFooterTextElementWidth: function(index) { 17533 var footerElement = this.GetWindowFooterElement(index); 17534 var footerContentElement = ASPx.GetChildByClassName(footerElement, PopupControlCssClasses.FooterContentCssClassName); 17535 var footerTextElement = this.GetWindowFooterTextElement(index); 17536 var footerImageElement = this.GetWindowFooterImageCell(index); 17537 if(!footerElement || !footerContentElement || !footerTextElement) 17538 return; 17539 var footerTextMaxWidth = ""; 17540 if(footerImageElement) { 17541 var footerTextMaxWidthCorrection = footerImageElement.offsetWidth + ASPx.GetLeftRightMargins(footerImageElement); 17542 footerTextMaxWidth = "calc(100% - " + footerTextMaxWidthCorrection + "px)"; 17543 } 17544 ASPx.SetStyles(footerTextElement, { maxWidth: footerTextMaxWidth }, false); 17545 }, 17546 OnBeforeDropdownShow: function() { 17547 var element = this.GetWindowElement(-1); 17548 if(!ASPx.GetElementDisplay(element)) { 17549 element.style.visibility = "hidden"; 17550 } 17551 this.SetWindowDisplay(-1, true); 17552 if(this.adaptivityEnabled) { 17553 ASPx.SetElementDisplay(this.GetModalWrapperElement(-1), true); 17554 this.SetAdaptiveModalMode(-1, this.NeedAdaptiveModalMode()); 17555 } 17556 }, 17557 SetWindowDisplay: function(index, value) { 17558 var pcwElement = this.GetWindowElement(index); 17559 ASPx.SetElementDisplay(pcwElement, value); 17560 }, 17561 getWindowHorizontalAlign: function(element) { 17562 return this.popupHorizontalAlign; 17563 }, 17564 getWindowVerticalAlign: function(element) { 17565 return this.popupVerticalAlign; 17566 }, 17567 getWindowHorizontalOffset: function(element) { 17568 return this.popupHorizontalOffset; 17569 }, 17570 getWindowVerticalOffset: function(element) { 17571 return this.popupVerticalOffset; 17572 }, 17573 GetHorizontalAlign: function() { 17574 return this.popupHorizontalAlign; 17575 }, 17576 GetVerticalAlign: function() { 17577 return this.popupVerticalAlign; 17578 }, 17579 GetPopupHorizontalOffset: function() { 17580 return this.popupHorizontalOffset; 17581 }, 17582 SetPopupHorizontalOffset: function(offset) { 17583 this.popupHorizontalOffset = offset; 17584 }, 17585 SetPopupVerticalOffset: function(offset) { 17586 this.popupVerticalOffset = offset; 17587 }, 17588 GetPopupVerticalOffset: function() { 17589 return this.popupVerticalOffset; 17590 }, 17591 ShowAtElement: function(htmlElement, savePopupElement) { 17592 this.ShowWindowAtElementByIndex(-1, htmlElement, savePopupElement); 17593 }, 17594 ShowAtElementByID: function(id) { 17595 var htmlElement = document.getElementById(id); 17596 this.ShowAtElement(htmlElement); 17597 }, 17598 ShowWindowAtElementByIndex: function(index, htmlElement, savePopupElement) { 17599 var lastIndexBackup = this.GetLastShownPopupElementIndex(index); 17600 this.ShowWindowByIndex(index, this.AddPopupElementInternal(index, htmlElement)); 17601 if(!savePopupElement) 17602 this.RemovePopupElementInternal(index, htmlElement); 17603 this.SetLastShownPopupElementIndex(index, lastIndexBackup); 17604 }, 17605 ShowWindowByIndex: function(index, popupElementIndex) { 17606 if(!this.isInitialized) 17607 return; 17608 if(popupElementIndex === undefined) 17609 popupElementIndex = this.GetLastShownPopupElementIndex(index); 17610 this.DoShowWindowCore(index, ASPx.InvalidPosition, ASPx.InvalidPosition, popupElementIndex, false, true); 17611 }, 17612 DoShowWindowCore: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) { 17613 }, 17614 DoShowWindow: function(index, popupElementIndex, evt) { 17615 if(!this.InternalIsWindowVisible(index)) { 17616 var x = ASPx.Evt.GetEventX(evt); 17617 var y = ASPx.Evt.GetEventY(evt); 17618 this.DoShowWindowCore(index, x, y, popupElementIndex, true, true, evt, ASPxClientPopupControlCloseReason.OuterMouseClick); 17619 } 17620 }, 17621 SetWindowPos: function(index, element, x, y) { 17622 ASPx.SetStyles(element, { left: x, top: y }); 17623 this.DoShowWindowIFrame(index, x, y, ASPx.InvalidDimension, ASPx.InvalidDimension); 17624 this.SetIsDragged(index, true); 17625 this.SetWindowLeft(index, ASPx.GetAbsoluteX(element)); 17626 this.SetWindowTop(index, ASPx.GetAbsoluteY(element)); 17627 this.UpdateWindowsStateCookie(); 17628 }, 17629 CorrectPopupPositionForClientWindow: function(element, popupPosition, isX) { 17630 if(element.isPopupPositionCorrectionOn && this.isPopupFullCorrectionOn || this.forceAdjustPositionToClientScreen) { 17631 popupPosition.position = ASPx.PopupUtils.AdjustPositionToClientScreen(element, popupPosition.position, this.rtl, isX); 17632 } 17633 return popupPosition; 17634 }, 17635 GetClientPopupPos: function(element, popupElement, pos, isX, isDragged) { 17636 var index = this.GetWindowIndex(element); 17637 var popupPosition = null; 17638 if(this.GetIsMaximizedOnWebKitTouch(index)) 17639 return new ASPx.PopupPosition(ASPx.PrepareClientPosForElement(0, element, isX), false); 17640 if(isDragged) 17641 popupPosition = new ASPx.PopupPosition(!this.IsValidPosition(pos) ? this.GetPosition(index, isX) : pos, false); 17642 else 17643 popupPosition = isX ? this.GetClientPopupPosX(element, popupElement, pos) : this.GetClientPopupPosY(element, popupElement, pos); 17644 popupPosition.position = ASPx.PrepareClientPosForElement(popupPosition.position, element, isX); 17645 if(ASPx.Browser.Firefox && ASPx.Browser.Version < 3 && this.GetWindowModalElement(index)) 17646 popupPosition.position -= isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(); 17647 return popupPosition; 17648 }, 17649 GetClientPopupPosX: function(element, popupElement, x) { 17650 var mainElement = this.GetWindowMainCell(element); 17651 var popupPosition = ASPx.PopupUtils.GetPopupAbsoluteX(mainElement, popupElement, this.getWindowHorizontalAlign(element), this.getWindowHorizontalOffset(element), 17652 x, this.GetWindowLeft(this.GetWindowIndex(element)), this.rtl, this.isPopupFullCorrectionOn); 17653 return this.CorrectPopupPositionForClientWindow(element, popupPosition, true); 17654 }, 17655 GetClientPopupPosY: function(element, popupElement, y) { 17656 var mainElement = this.GetWindowMainCell(element); 17657 var popupPosition = ASPx.PopupUtils.GetPopupAbsoluteY(mainElement, popupElement, this.getWindowVerticalAlign(element), this.getWindowVerticalOffset(element), 17658 y, this.GetWindowTop(this.GetWindowIndex(element)), this.isPopupFullCorrectionOn, this.usedInDropDown, this.usedInDropDown); 17659 return this.usedInDropDown ? popupPosition : this.CorrectPopupPositionForClientWindow(element, popupPosition, false); 17660 }, 17661 UpdateWindowPositionInternal: function(index, popupElement) { 17662 var positionUpdated = false, 17663 element = this.GetWindowElement(index); 17664 if(this.InternalIsWindowVisible(index) && element != null) { 17665 var horizontalPopupPosition; 17666 if(this.popupHorizontalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator && window.innerWidth <= element.offsetWidth) { 17667 var scrollDiff = aspxGetPopupControlCollection().GetDocScrollDifference(),
17668 scrollInProgress = scrollDiff.horizontal !== 0 || scrollDiff.vertical !== 0; 17669 horizontalPopupPosition = scrollInProgress ? ASPx.PxToInt(element.style.left) : this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, true, false); 17670 } else 17671 horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, true, false); 17672 var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, ASPx.InvalidPosition, false, false); 17673 this.SetWindowPos(index, element, horizontalPopupPosition.position, verticalPopupPosition.position); 17674 positionUpdated = true; 17675 } 17676 return positionUpdated; 17677 }, 17678 UpdatePositionAtElement: function(popupElement) { 17679 this.UpdateWindowPositionAtElement(null, popupElement); 17680 }, 17681 UpdateWindowPositionAtElement: function(window, popupElement) { 17682 var index = (window != null) ? window.index : -1; 17683 this.UpdateWindowPositionInternal(index, popupElement); 17684 }, 17685 TryAutoUpdatePosition: function(index) { 17686 if(this.GetAutoUpdatePosition(index)) 17687 this.UpdateWindowPositionInternal(index, this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index))); 17688 }, 17689 GetLastShownPopupElementIndex: function(windowIndex) { 17690 var info = this.GetLastUsedPopupElementInfo(windowIndex); 17691 return ASPx.GetDefinedValue(info.shownPEIndex, 0); 17692 }, 17693 SetLastShownPopupElementIndex: function(windowIndex, popupElementIndex) { 17694 var info = this.GetLastUsedPopupElementInfo(windowIndex); 17695 info.shownPEIndex = popupElementIndex; 17696 }, 17697 GetLastUsedPopupElementInfo: function(index) { 17698 if(0 <= index && index < this.GetWindowCountCore()) 17699 return this.windowsLastUsedPopupElementInfoList[index]; 17700 return this.defaultLastUsedPopupElementInfo; 17701 }, 17702 GetPopupElement: function(index, popupElementIndex) { 17703 var popupElement = this.GetPopupElementList(index)[popupElementIndex]; 17704 return popupElement ? popupElement : null; 17705 }, 17706 GetPopupElementList: function(index) { 17707 if(0 <= index && index < this.GetWindowCountCore()) 17708 return this.windowsPopupElementList[index]; 17709 return this.defaultWindowPopupElementList; 17710 }, 17711 PopulatePopupElementsByIds: function(index) { 17712 var ids = this.GetPopupElementIDList(index); 17713 for(var i = 0; i < ids.length; i++) { 17714 var popupElement = ASPx.PopupUtils.FindPopupElementById(ids[i]); 17715 if(popupElement) 17716 this.AddWindowPopupElement(index, popupElement); 17717 } 17718 }, 17719 PopulatePopupElements: function(index) { 17720 this.PopulatePopupElementsByIds(index); 17721 }, 17722 SetPopupElementIDByIndex: function(index, popupElementId) { 17723 this.RemoveWindowAllPopupElements(index); 17724 this.SetPopupElementIDs(index, popupElementId.split(';')); 17725 if(aspxGetPopupControlCollection().IsDisappearTimerActive()) { 17726 aspxGetPopupControlCollection().ClearDisappearTimer(); 17727 this.Hide(index); 17728 } 17729 this.PopulatePopupElements(index); 17730 }, 17731 RefreshPopupElementConnection: function() { 17732 this.ClearPopupElementConnection(); 17733 var index = this.HasDefaultWindow() ? -1 : 0; 17734 for(; index < this.GetWindowCount(); index++) 17735 this.PopulatePopupElements(index); 17736 }, 17737 ClearPopupElementConnection: function() { 17738 var index = this.HasDefaultWindow() ? -1 : 0; 17739 for(; index < this.GetWindowCount(); index++) 17740 this.RemoveWindowAllPopupElements(index); 17741 }, 17742 GetPopupElementIDList: function(index) { 17743 if(0 <= index && index < this.GetWindowCountCore()) 17744 return this.windowsPopupElementIDList[index]; 17745 return this.defaultWindowPopupElementIDList; 17746 }, 17747 SetPopupElementIDs: function(index, ids) { 17748 if(0 <= index && index < this.GetWindowCountCore()) 17749 this.windowsPopupElementIDList[index] = ids; 17750 this.defaultWindowPopupElementIDList = ids; 17751 }, 17752 AddPopupElementInternal: function(index, element) { 17753 var popupElements = this.GetPopupElementList(index); 17754 for(var i = 0; i < popupElements.length; i++) { 17755 if(!popupElements[i]) { 17756 popupElements[i] = element; 17757 return i; 17758 } 17759 } 17760 popupElements.push(element); 17761 return popupElements.length - 1; 17762 }, 17763 RemovePopupElementInternal: function(index, element) { 17764 var popupElements = this.GetPopupElementList(index); 17765 for(var i = 0; i < popupElements.length; i++) { 17766 if(popupElements[i] == element) { 17767 popupElements[i] = null; 17768 return; 17769 } 17770 } 17771 }, 17772 AddPopupElement: function(popupElement) { 17773 this.AddWindowPopupElement(-1, popupElement); 17774 }, 17775 AddWindowPopupElement: function(index, popupElement) { 17776 var popupElementIndex = this.AddPopupElementInternal(index, popupElement); 17777 this.SetPopupElementReference(index, popupElement, popupElementIndex, true); 17778 }, 17779 RemovePopupElement: function(popupElement) { 17780 this.RemoveWindowPopupElement(-1, popupElement); 17781 }, 17782 RemoveWindowPopupElement: function(index, popupElement) { 17783 this.RemovePopupElementInternal(index, popupElement); 17784 this.SetPopupElementReference(index, popupElement, null, false); 17785 }, 17786 SetPopupElementReference: function(index, popupElement, popupElementIndex, attach) { 17787 if(!ASPx.IsExistsElement(popupElement)) return; 17788 var setReferenceFunction = this.getAttachReferenceFunction(attach); 17789 var setContextMenuReferenceFunction = attach ? ASPx.Evt.AttachContextMenuToElement : ASPx.Evt.DetachContextMenuFromElement; 17790 var windowPopupAction = this.GetWindowPopupAction(index); 17791 if(windowPopupAction == "LeftMouseClick") 17792 setReferenceFunction(popupElement, "mouseup", aspxPEMEvent); 17793 else if(windowPopupAction == "RightMouseClick") 17794 setContextMenuReferenceFunction(popupElement, aspxPEMEvent); 17795 else if(windowPopupAction == "MouseOver") { 17796 var windowElement = this.GetWindowElement(index); 17797 setReferenceFunction(popupElement, "mouseover", ASPx.PopupUtils.OverControl.OnMouseOver); 17798 setReferenceFunction(windowElement, "mouseover", aspxPWEMOver); 17799 if(attach) 17800 this.SetMSTouchMouseOverReference(popupElement, windowElement, this.name, index, this.appearAfter); 17801 } 17802 if(windowPopupAction == "LeftMouseClick" || windowPopupAction == "RightMouseClick") { 17803 setReferenceFunction(popupElement, "mousedown", aspxPEMEvent); 17804 } 17805 if(attach) { 17806 popupElement.DXPopupElementControl = this; 17807 popupElement.DXPopupWindowIndex = index; 17808 popupElement.DXPopupElementIndex = popupElementIndex; 17809 } else 17810 popupElement.DXPopupElementControl = popupElement.DXPopupWindowIndex = popupElement.DXPopupElementIndex = undefined; 17811 }, 17812 getAttachReferenceFunction: function(attach) { 17813 return attach ? ASPx.Evt.AttachEventToElement : ASPx.Evt.DetachEventFromElement; 17814 }, 17815 SetMSTouchMouseOverReference: function(popupElement, windowElement, popupName, index, appearAfter) { 17816 if(!ASPx.TouchUIHelper.pointerEnabled) return; 17817 popupElement.dxMsTouchGesture = popupElement.dxMsTouchGesture || 17818 ASPx.TouchUIHelper.msTouchCreateGesturesWrapper(popupElement, function(evt) { 17819 window.setTimeout(function() { 17820 aspxGetPopupControlCollection().SetAppearTimer(popupName, index, popupElement.DXPopupElementIndex, appearAfter, evt); 17821 }, 0); 17822 }); 17823 windowElement.dxMsTouchGesture = windowElement.dxMsTouchGesture || ASPx.TouchUIHelper.msTouchCreateGesturesWrapper(windowElement, function(evt) { 17824 window.setTimeout(function() { 17825 aspxGetPopupControlCollection().ClearDisappearTimer(); 17826 }, 0); 17827 }); 17828 },
17829 GetLastOverPopupElementIndex: function(windowIndex) { 17830 var info = this.GetLastUsedPopupElementInfo(windowIndex); 17831 return ASPx.GetDefinedValue(info.overPEIndex, -1); 17832 }, 17833 SetLastOverPopupElementIndex: function(windowIndex, popupElementIndex) { 17834 var info = this.GetLastUsedPopupElementInfo(windowIndex); 17835 info.overPEIndex = popupElementIndex; 17836 }, 17837 OnPopupElementMouseOver: function(evt, popupElement) { 17838 if(popupElement != null) { 17839 var index = popupElement.DXPopupWindowIndex; 17840 var isVisible = this.InternalIsWindowVisible(index); 17841 var popupElementIndex = popupElement.DXPopupElementIndex; 17842 if(this.GetLastOverPopupElementIndex(index) != popupElementIndex) { 17843 if(aspxGetPopupControlCollection().IsAppearTimerActive()) 17844 aspxGetPopupControlCollection().ClearAppearTimer(); 17845 if(aspxGetPopupControlCollection().IsDisappearTimerActive()) 17846 aspxGetPopupControlCollection().ClearDisappearTimer(); 17847 if(isVisible) { 17848 this.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.MouseOut); 17849 isVisible = false; 17850 } 17851 } 17852 if(!isVisible) { 17853 aspxGetPopupControlCollection().SetAppearTimer(this.name, index, popupElement.DXPopupElementIndex, this.appearAfter, evt); 17854 aspxGetPopupControlCollection().InitOverObject(this, index, evt); 17855 } 17856 this.SetLastOverPopupElementIndex(index, popupElementIndex); 17857 } 17858 }, 17859 OnPopupElementMouseOut: function(evt, popupElement) { 17860 }, 17861 RemoveAllPopupElements: function() { 17862 this.RemoveWindowAllPopupElements(-1); 17863 }, 17864 RemoveWindowAllPopupElements: function(index) { 17865 var popupElements = this.GetPopupElementList(index); 17866 for(var i = 0; i < popupElements.length; i++) 17867 this.RemoveWindowPopupElement(index, popupElements[i]); 17868 }, 17869 GetWindowCurrentPopupElementByIndex: function(index) { 17870 var popupElement = this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index)); 17871 if(popupElement && popupElement.DXPopupElementControl) 17872 return popupElement; 17873 return null; 17874 }, 17875 GetWindowCurrentPopupElementIndexByWindowIndex: function(windowIndex) { 17876 var popupElement = this.GetWindowCurrentPopupElementByIndex(windowIndex); 17877 return popupElement ? popupElement.DXPopupElementIndex : -1; 17878 }, 17879 GetIsMaximizedOnWebKitTouch: function(index) { 17880 return false; 17881 }, 17882 ProcessAccessibleElementOnHide: function() { 17883 if(this.accessibilityCompliant) { 17884 var focusElement = this.accessibleFocusElement ? this.accessibleFocusElement : this.GetCurrentPopupElement(); 17885 ASPx.AccessibilityUtils.SetFocusAccessibleCore(focusElement); 17886 this.accessibleFocusElement = null; 17887 } 17888 }, 17889 OnControlsInitialized: function() { 17890 this.InitializeAccessibleNavigationCore(); 17891 setTimeout(function() { 17892 ASPx.GetControlCollection().ControlsInitialized.RemoveHandler(this.OnControlsInitialized, this); 17893 }.aspxBind(this), 0); 17894 }, 17895 InitializeAccessibleNavigation: function() { 17896 this.Shown.AddHandler(this.InitializeAccessibleNavigationCore.aspxBind(this)); 17897 }, 17898 InitializeAccessibleNavigationCore: function() { 17899 this.resetFocusableElements(); 17900 var focusableElement = this.getFirstFocusableElement(); 17901 if(focusableElement) { 17902 var currentWindowContentCell = this.GetWindowContentElement(-1); 17903 var contentFirstActionElement = ASPx.FindFirstChildActionElement(currentWindowContentCell); 17904 if(contentFirstActionElement && contentFirstActionElement !== focusableElement) 17905 focusableElement = contentFirstActionElement; 17906 if(!this.preventAccessibilityFocus) 17907 ASPx.AccessibilityUtils.SetFocusAccessible(focusableElement); 17908 this.SetLoopingFocusHandlers(); 17909 } 17910 }, 17911 resetFocusableElements: function() { 17912 if(this.firstFocusableElement) 17913 ASPx.Evt.DetachEventFromElement(this.firstFocusableElement, "keydown", this.focusLastElementHandler); 17914 if(this.lastFocusableElement) 17915 ASPx.Evt.DetachEventFromElement(this.lastFocusableElement, "keydown", this.focusFirstElementHandler); 17916 this.firstFocusableElement = null; 17917 this.lastFocusableElement = null; 17918 }, 17919 getFirstFocusableElement: function() { 17920 if(!this.firstFocusableElement) 17921 this.firstFocusableElement = ASPx.FindFirstChildActionElement(this.GetCurrentWindowElement()); 17922 return this.firstFocusableElement; 17923 }, 17924 getLastFocusableElement: function() { 17925 if(!this.lastFocusableElement) 17926 this.lastFocusableElement = ASPx.FindLastChildActionElement(this.GetCurrentWindowElement()); 17927 return this.lastFocusableElement; 17928 }, 17929 SetLoopingFocusHandlers: function() { 17930 ASPx.Evt.AttachEventToElement(this.getFirstFocusableElement(), "ke
17930ydown", this.focusLastElementHandler); 17931 ASPx.Evt.AttachEventToElement(this.getLastFocusableElement(), "keydown", this.focusFirstElementHandler); 17932 }, 17933 loopFocusHandler: function(evt, isLastFocusableElement) { 17934 var keyCode = ASPx.Evt.GetKeyCode(evt); 17935 if(keyCode !== ASPx.Key.Tab) 17936 return; 17937 var targetElement = isLastFocusableElement ? this.getLastFocusableElement() : this.getFirstFocusableElement(); 17938 if(ASPx.Evt.GetEventSource(evt) !== targetElement) 17939 return; 17940 var elementToFocus = null; 17941 if(!isLastFocusableElement && evt.shiftKey) 17942 elementToFocus = this.getLastFocusableElement(); 17943 else if(isLastFocusableElement && !evt.shiftKey) 17944 elementToFocus = this.getFirstFocusableElement(); 17945 if(elementToFocus) { 17946 ASPx.AccessibilityUtils.SetFocusAccessible(elementToFocus); 17947 ASPx.Evt.PreventEventAndBubble(evt); 17948 } 17949 }, 17950 getLeftRightBordersAndPaddingsSummaryValue: function(element, currentStyle) { 17951 return ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element, currentStyle); 17952 }, 17953 getTopBottomBordersAndPaddingsSummaryValue: function(element, currentStyle) { 17954 return ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle); 17955 }, 17956 AdjustModalElementBounds: function(element) { 17957 }, 17958 RefreshDimensionsAfterCreateIframe: function(index) { 17959 }, 17960 UpdatePositionAfterCallback: function(windowIndex) { 17961 } 17962}); 17963ASPxClientPopupControlBase.AnimationType = { 17964 Fade: "fade", 17965 Slide: "slide", 17966 Auto: "auto", 17967 None: "none" 17968}; 17969var ASPxClientPopupControl = ASPx.CreateClass(ASPxClientPopupControlBase, { 17970 constructor: function(name) { 17971 this.constructor.prototype.constructor.call(this, name); 17972 this.popupActionArray = []; 17973 this.windowsPopupElementIDList = []; 17974 this.windowsPopupElementList = []; 17975 this.windowsLastUsedPopupElementInfoList = []; 17976 this.windowsIsPopupedList = []; 17977 this.windowsPopupReasonMouseEventList = []; 17978 this.defaultPopupReasonMouseEvent = null; 17979 this.modal = false; 17980 this.modalArray = []; 17981 this.isDraggedArray = []; 17982 this.closeActionArray = []; 17983 this.showOnPageLoadArray = []; 17984 this.windows = []; 17985 this.windowCount = 0; 17986 this.closeOnEscapeArray = []; 17987 this.leftArray = []; 17988 this.contentUrlArray = []; 17989 this.contentUrlIFrameTitleArray = []; 17990 this.iframeLoadingArray = []; 17991 this.iframeAdjustingPostponedArray = []; 17992 this.isResizedArray = []; 17993 this.zIndexArray = []; 17994 this.topArray = []; 17995 this.shownArray = []; 17996 this.heightArray = []; 17997 this.widthArray = []; 17998 this.widthFromServer = false; 17999 this.widthFromServerArray = []; 18000 this.minHeightArray = []; 18001 this.minWidthArray = []; 18002 this.maxHeightArray = []; 18003 this.maxWidthArray = []; 18004 this.hideBodyScrollWhenModal = true; 18005 this.hideBodyScrollWhenModalArray = []; 18006 this.hideBodyScrollWhenMaximized = true; 18007 this.canScrollViewPort = false; 18008 this.canScrollViewPortArray = []; 18009 this.autoUpdatePositionArray = []; 18010 this.cachedSizeArray = []; 18011 this.enableContentScrollingArray = []; 18012 this.contentOverflowXArray = []; 18013 this.contentOverflowYArray = []; 18014 this.isPinned = false; 18015 this.isPinnedArray = []; 18016 this.pinX = 0; 18017 this.pinXArray = []; 18018 this.pinY = 0; 18019 this.pinYArray = []; 18020 this.lockScroll = 0; 18021 this.isCollapsed = false; 18022 this.isCollapsedArray = []; 18023 this.isCollapsedInit = false; 18024 this.isCollapsedInitArray = []; 18025 this.collapseExecutingLockCount = 0; 18026 this.isMaximized = false; 18027 this.isMaximizedArray = []; 18028 this.isMaximizedInit = false; 18029 this.isMaximizedInitArray = []; 18030 this.maximizationExecutingLockCount = 0; 18031 this.restoredWindowValues = {}; 18032 this.restoredWindowValuesArray = []; 18033 this.browserResizingForMaxWindowLockCount = 0; 18034 this.updateRestoredWindowSizeLockCount = 0; 18035 this.touchUIScrollers = {}; 18036 this.adaptivityEnabled = false; 18037 this.DefaultModalMaxWidth = 500; 18038 this.DefaultModalMinWidth = 0; 18039 this.stretchVertically = false; 18040 this.stretchVerticallyArray = []; 18041 this.fixedHeader = true; 18042 this.fixedHeaderArray = []; 18043 this.fixedFooter = true; 18044 this.fixedFooterArray = []; 18045 this.modalMinHeight = null; 18046 this.modalMinHeightArray = []; 18047 this.modalMinWidth = null; 18048 this.modalMinWidthArray = []; 18049 this.modalMaxHeight = null; 18050 this.modalMaxHeightArray = []; 18051 this.modalMaxWidth = null; 18052 this.modalMaxWidthArray = []; 18053 this.modalVerticalAlign = ModalAlign.WindowTop; 18054 this.modalHorizontalAlign = ModalAlign.WindowCenter; 18055 this.adaptiveModalMode = false; 18056 this.adaptiveModalModeArray = []; 18057 this.switchAtWindowInnerWidth = ASPx.MaxMobileWindowWidth; 18058 this.PinnedChanged = new ASPxClientEvent(); 18059 this.AdaptiveModeChanged = new ASPxClientEvent(); 18060 }, 18061 SetData: function(data){
18062 if(data.windows) 18063 this.CreateWindows(data.windows); 18064 }, 18065 InlineInitialize: function() { 18066 ASPxClientControl.prototype.InlineInitialize.call(this); 18067 this.InitializeArrayCores(); 18068 }, 18069 Initialize: function() { 18070 ASPxClientPopupControlBase.prototype.Initialize.call(this); 18071 aspxGetPopupControlCollection().EnsureSaveScrollState(); 18072 if(this.HasDefaultWindow()) 18073 this.InitializeWindow(-1); 18074 for(var i = 0; i < this.GetWindowCount() ; i++) 18075 this.InitializeWindow(i); 18076 this.InitializeScrollbars(); 18077 }, 18078 InitializeEnableContentScrolling: function() { 18079 for(var windowIndex = 0; windowIndex < this.GetWindowCount() ; windowIndex++) { 18080 var contentOverflowX = this.GetWindowOverflowX(windowIndex); 18081 var contentOverflowY = this.GetWindowOverflowY(windowIndex); 18082 this.enableContentScrollingArray.push(contentOverflowX != "None" || contentOverflowY != "None"); 18083 } 18084 ASPxClientPopupControlBase.prototype.InitializeEnableContentScrolling.call(this); 18085 }, 18086 InitializeScrollbars: function() { 18087 if(!ASPx.Browser.WebKitTouchUI && !ASPx.Browser.MSTouchUI && (!ASPx.Browser.WindowsPhonePlatform || !ASPx.Browser.IE)) 18088 return; 18089 this.ForEachWindow(function(windowIndex) { 18090 if(this.GetEnableContentScrolling(windowIndex)) { 18091 var scrollElement = this.getTouchScrollerElement(windowIndex); 18092 if(scrollElement) { 18093 if(ASPx.Browser.MSTouchUI) 18094 scrollElement.style.touchAction = "auto"; 18095 else { 18096 var options = this.GetWindowTouchScrollOptions(windowIndex); 18097 if(!this.HasIframeOnIos(windowIndex)) 18098 this.touchUIScrollers[windowIndex] = ASPx.TouchUIHelper.MakeScrollable(scrollElement, options); 18099 } 18100 } 18101 } 18102 }.aspxBind(this)); 18103 }, 18104 GetWindowTouchScrollOptions: function (index) { 18105 var contentOverflowX = this.GetWindowOverflowX(index), 18106 contentOverflowY = this.GetWindowOverflowY(index); 18107 return { 18108 showHorizontalScrollbar: contentOverflowX === "Auto" || contentOverflowX === "Scroll", 18109 showVerticalScrollbar: contentOverflowY === "Auto" || contentOverflowY === "Scroll" 18110 }; 18111 }, 18112 ForEachWindow: function(callback) { 18113 var indices = []; 18114 if(this.HasDefaultWindow()) 18115 indices.push(-1); 18116 else { 18117 for(var i = 0; i < this.GetWindowCount(); i++) 18118 indices.push(i); 18119 } 18120 ASPx.Data.ForEach(indices, callback); 18121 }, 18122 GetMainElementId: function() { 18123 return null; 18124 }, 18125 preventParentOverlowOnIos: function(index) { 18126 if(!ASPx.Browser.MacOSMobilePlatform) return; 18127 var parent = this.getParentPopupControl(index); 18128 if(parent) 18129 parent.popupControl.changeContentOverflow(parent.windowIndex); 18130 }, 18131 restoreParentOverflowOnIos: function(index) { 18132 if(!ASPx.Browser.MacOSMobilePlatform) return; 18133 var parent = this.getParentPopupControl(index); 18134 if(parent) 18135 parent.popupControl.restoreContentOverflow(parent.windowIndex); 18136 }, 18137 changeContentOverflow: function(index) { 18138 var scrollerElement = this.getTouchScrollerElement(index); 18139 if(!scrollerElement) return; 18140 ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflow", "visible"); 18141 ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflowX", "visible"); 18142 ASPx.Attr.ChangeStyleAttribute(scrollerElement, "overflowY", "visible"); 18143 }, 18144 restoreContentOverflow: function(index) { 18145 var scrollerElement = this.getTouchScrollerElement(index); 18146 if(!scrollerElement) return; 18147 ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflow"); 18148 ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflowX"); 18149 ASPx.Attr.RestoreStyleAttribute(scrollerElement, "overflowY"); 18150 }, 18151 UpdateScrollbar: function(index) { 18152 var touchUIScroller = this.touchUIScrollers[index]; 18153 if(!touchUIScroller) 18154 return; 18155 var scrollElement = this.GetContentContainer(index); 18156 if(scrollElement) 18157 touchUIScroller.ChangeElement(scrollElement); 18158 }, 18159 InitializeArrayCores: function() { 18160 if(this.GetWindowCountCore() > 0) { 18161 this.InitializeWindowPopupElementList(); 18162 this.InitializeWindowPopupElementIDList(); 18163 this.InitializeWindowLastUsedPopupElementInfoList(); 18164 this.InitializeArray(this.shownArray); 18165 this.InitializeArray(this.windowsPopupReasonMouseEventList, null); 18166 this.InitializeArray(this.windowsIsPopupedList, false); 18167 this.InitializeArray(this.contentUrlArray, ""); 18168 this.InitializeArray(this.contentUrlIFrameTitleArray, ""); 18169 this.InitializeArray(this.popupActionArray, this.popupAction); 18170 this.InitializeArray(this.closeActionArray, this.closeAction); 18171 this.InitializeArray(this.showOnPageLoadArray, false); 18172 this.InitializeArray(this.isDraggedArray, false); 18173 this.InitializeArray(this.isPinnedArray, false); 18174 this.InitializeArray(this.isCollapsedArray, false); 18175 this.InitializeArray(this.isCollapsedInitArray, false); 18176 this.InitializeArray(this.isMaximizedArray, false); 18177 this.InitializeArray(this.isMaximizedInitArray, false); 18178 this.InitializeArray(this.restoredWindowValuesArray, {}); 18179 this.InitializeArray(this.iframeAdjustingPostponedArray, {}); 18180 this.InitializeArray(this.isResizedArray, false); 18181 this.InitializeArray(this.zIndexArray, -1); 18182 this.InitializeArray(this.leftArray, 0); 18183 this.InitializeArray(this.topArray, 0); 18184 this.InitializeArray(this.widthArray, constants.DEFAULT_WINDOW_WIDTH); 18185 this.InitializeArray(this.heightArray, constants.DEFAULT_WINDOW_HEIGHT); 18186 this.InitializeArray(this.widthFromServerArray, false); 18187 this.InitializeArray(this.pinXArray, 0); 18188 this.InitializeArray(this.pinYArray, 0); 18189 this.InitializeArray(this.minWidthArray, null); 18190 this.InitializeArray(this.minHeightArray, null); 18191 this.InitializeArray(this.maxWidthArray, null); 18192 this.InitializeArray(this.maxHeightArray, null); 18193 this.InitializeArray(this.cachedSizeArray, null); 18194 this.InitializeArray(this.iframeLoadingArray, false); 18195 this.InitializeArray(this.autoUpdatePositionArray, false); 18196 this.InitializeArray(this.hideBodyScrollWhenModalArray, true); 18197 this.InitializeArray(this.canScrollViewPortArray, false); 18198 this.InitializeArray(this.closeOnEscapeArray, this.closeOnEscape); 18199 this.InitializeArray(this.modalArray, false); 18200 this.InitializeArray(this.adaptiveModalModeArray, false); 18201 this.InitializeArray(this.fixedHeaderArray, true); 18202 this.InitializeArray(this.fixedFooterArray, true); 18203 this.InitializeArray(this.modalMinWidthArray, null); 18204 this.InitializeArray(this.modalMinHeightArray, null); 18205 this.InitializeArray(this.modalMaxWidthArray, null); 18206 this.InitializeArray(this.modalMaxHeightArray, null); 18207 this.InitializeArray(this.stretchVerticallyArray, false); 18208 } 18209 }, 18210 InitializeArray: function(array, defaultValue) { 18211 if(array.length == 0) { 18212 for(var i = 0; i < this.GetWindowCountCore() ; i++) 18213 array[i] = defaultValue; 18214 } 18215 }, 18216 InitializeWindowPopupElementIDList: function() { 18217 for(var i = 0; i < this.GetWindowCountCore() ; i++) { 18218 if(!this.windowsPopupElementIDList[i]) 18219 this.windowsPopupElementIDList[i] = []; 18220 } 18221 }, 18222 InitializeWindowPopupElementList: function() { 18223 for(var i = 0; i < this.GetWindowCountCore() ; i++) { 18224 if(!this.windowsPopupElementList[i]) 18225 this.windowsPopupElementList[i] = []; 18226 } 18227 }, 18228 InitializeWindowLastUsedPopupElementInfoList: function() { 18229 for(var i = 0; i < this.GetWindowCountCore() ; i++) { 18230 if(!this.windowsLastUsedPopupElementInfoList[i]) 18231 this.windowsLastUsedPopupElementInfoList[i] = {}; 18232 } 18233 }, 18234 AllowMouseDown: function(evt, index) { 18235 return ASPxClientPopupControlBase.prototype.AllowMouseDown.call(this, evt, index) && 18236 !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowPinButton(index)) && 18237 !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowCollapseButton(index)) && 18238 !this.PreventHeaderButtonMouseDownBubbling(evt, this.GetWindowMaximizeButton(index)); 18239 }, 18240 AssignHeaderButtonsEvents: function(index) { 18241 ASPxClientPopupControlBase.prototype.AssignHeaderButtonsEvents.call(this, index); 18242 this.AttachClickToHeaderButton(index, this.GetWindowPinButton(index), "ASPx.PWPBClick"); 18243 this.AttachClickToHeaderButton(index, this.GetWindowCollapseButton(index), "ASPx.PWMNBClick"); 18244 this.AttachClickToHeaderButton(index, this.GetWindowMaximizeButton(index), "ASPx.PWMXBClick"); 18245 }, 18246 InitializeWindow: function(index) { 18247 ASPxClientPopupControlBase.prototype.InitializeWindow.call(this, index); 18248 if(this.adaptivityEnabled) { 18249 ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "scroll", function(e) { this.OnModalWrapperScroll(e, index); }.aspxBind(this)); 18250 if(ASPx.Browser.WebKitTouchUI) { 18251 ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "touchstart", function(e) { this.OnModalWrapperTouchStart(e); }.aspxBind(this)); 18252 ASPx.Evt.AttachEventToElement(this.GetModalWrapperElement(index), "touchmove", function(e) { this.OnModalWrapperTouchMove(e, index); }.aspxBind(this)); 18253 } 18254 } else { 18255 var modalElement = this.GetWindowModalElement(index); 18256 if(modalElement) 18257 ASPx.Evt.AttachEventToElement(modalElement, "mousedown", aspxPWMEMDown); 18258 } 18259 }, 18260 BrowserWindowResizeSubscriber: function() { 18261 return true; 18262 }, 18263 OnBrowserWindowResize: function(e) { 18264 window.setTimeout(this.SetPopupMaximizedPositionOnBrowserResize.aspxBind(this), 0); 18265 this.ForEachWindow(this.updateContentScrollIfNeeded.aspxBind(this)); 18266 }, 18267 SetPopupMaximizedPositionOnBrowserResize: function() {
18268 this.ForEachWindow(this.SetMaximizedPositionOnBrowserResize.aspxBind(this)); 18269 }, 18270 UpdateResizeCursor: function(index, element, verticalDirection, horizontalDirection) { 18271 if(this.GetAdaptiveModalMode(index)) 18272 this.HideTemporaryCursor(element); 18273 else 18274 ASPxClientPopupControlBase.prototype.UpdateResizeCursor.call(this, index, element, verticalDirection, horizontalDirection); 18275 }, 18276 SetMaximizedPositionOnBrowserResize: function(index) { 18277 var element = this.GetWindowElement(index); 18278 if(element && this.GetIsMaximized(index) && this.InternalIsWindowVisible(index)) { 18279 var left = this.GetMaximizedPosition(element, true); 18280 var top = this.GetMaximizedPosition(element, false); 18281 this.SetWindowPos(index, element, left, top); 18282 } 18283 }, 18284 InitCollapsedWindows: function(index) { 18285 if((this.isCollapsedInit && index == -1) || (index >= 0 && index < this.isCollapsedInitArray.length && this.isCollapsedInitArray[index])) { 18286 if(this.InternalIsWindowVisible(index)) { 18287 this.DoCollapse(index, true); 18288 if(index == -1) 18289 this.isCollapsedInit = false; 18290 else 18291 this.isCollapsedInitArray[index] = false; 18292 } 18293 } 18294 }, 18295 InitMaximizedWindows: function(index) { 18296 if(this.GetIsMaximizedInit(index) && this.InternalIsWindowVisible(index)) { 18297 this.DoMaximize(index, true); 18298 this.SetIsMaximizedInit(index, false); 18299 } 18300 }, 18301 InitPinnedWindows: function(index) { 18302 if((this.isPinned && index == -1) || (index >= 0 && index < this.isPinnedArray.length && this.isPinnedArray[index])) 18303 this.HoldPosition(index, true); 18304 }, 18305 AfterInitializeWindow: function(index) { 18306 if(this.contentOverflowX !== "None" && !this.GetWindowWidthFromServer(index)) 18307 this.SetWindowWidth(index, 0); 18308 ASPxClientPopupControlBase.prototype.AfterInitializeWindow.call(this, index); 18309 this.InitPinnedWindows(index); 18310 this.InitMaximizedWindows(index); 18311 this.InitCollapsedWindows(index); 18312 }, 18313 OnDragStop: function(index) { 18314 ASPxClientPopupControlBase.prototype.OnDragStop.call(this, index); 18315 if(this.adaptivityEnabled) 18316 ASPxClientPopupControl.WindowResizeHelper.Initialize(this.GetWindowElement(index)); 18317 else 18318 this.updateContentScrollIfNeeded(index); 18319 }, 18320 GetPropertyValue: function(index, propName) { 18321 if(0 <= index && index < this.GetWindowCountCore()) 18322 return this[propName + "Array"][index]; 18323 return ASPxClientPopupControlBase.prototype.GetPropertyValue.call(this, index, propName); 18324 }, 18325 SetPropertyValue: function(index, propName, value) { 18326 if(0 <= index && index < this.GetWindowCountCore()) 18327 this[propName + "Array"][index] = value; 18328 else 18329 ASPxClientPopupControlBase.prototype.SetPropertyValue.call(this, index, propName, value); 18330 }, 18331 GetAdaptiveModalMode: function(index) { 18332 return this.GetPropertyValue(index, "adaptiveModalMode"); 18333 }, 18334 GetAutoUpdatePosition: function(index) { 18335 return this.GetPropertyValue(index, "autoUpdatePosition") && !this.GetAdaptiveModalMode(index); 18336 }, 18337 SetAdaptiveModalMode: function(index, enabled) { 18338 ASPx.ToggleClassNameToElement(this.GetModalWrapperElement(index), this.GetModalSystemCssClass(), enabled); 18339 this.SetPropertyValue(index, "adaptiveModalMode", enabled); 18340 }, 18341 GetIsPinned: function(index) { 18342 return this.GetPropertyValue(index, "isPinned"); 18343 }, 18344 SetIsPinned: function(index, value) { 18345 this.SetPropertyValue(index, "isPinned", value); 18346 }, 18347 GetPinPosX: function(index) { 18348 return this.GetPropertyValue(index, "pinX"); 18349 }, 18350 SetPinPosX: function(index, pinX) { 18351 this.SetPropertyValue(index, "pinX", pinX); 18352 }, 18353 GetPinPosY: function(index) { 18354 return this.GetPropertyValue(index, "pinY"); 18355 }, 18356 SetPinPosY: function(index, pinY) { 18357 this.SetPropertyValue(index, "pinY", pinY); 18358 }, 18359 GetIsCollapsed: function(index) { 18360 return this.GetPropertyValue(index, "isCollapsed"); 18361 }, 18362 SetIsCollapsed: function(index, value) { 18363 this.SetPropertyValue(index, "isCollapsed", value); 18364 }, 18365 GetIsMaximized: function(index) { 18366 return this.GetPropertyValue(index, "isMaximized"); 18367 }, 18368 GetIsMaximizedOnWebKitTouch: function(index) { 18369 return this.GetIsMaximized(index) && ASPx.Browser.WebKitTouchUI; 18370 }, 18371 SetIsMaximized: function(index, value) { 18372 this.SetPropertyValue(index, "isMaximized", value); 18373 }, 18374 GetIsMaximizedInit: function(index) { 18375 return this.GetPropertyValue(index, "isMaximizedInit"); 18376 }, 18377 SetIsMaximizedInit: function(index, value) { 18378 this.SetPropertyValue(index, "isMaximizedInit", value); 18379 }, 18380 GetRestoredWindowData: function(index) { 18381 return ASPx.CloneObject(this.GetPropertyValue(index, "restoredWindowValues")); 18382 }, 18383 GetEnableContentScrolling: function(index) { 18384 return this.GetPropertyValue(index, "enableContentScrolling"); 18385 }, 18386 GetWindowOverflowX: function(index) { 18387 return this.GetPropertyValue(index, "contentOverflowX"); 18388 }, 18389 GetWindowOverflowY: function(index) { 18390 return this.GetPropertyValue(index, "contentOverflowY"); 18391 }, 18392 SetRestoredWindowData: function(index, value) { 18393 this.SetPropertyValue(index, "restoredWindowValues", value); 18394 }, 18395 GetWindowIsShown: function(index) { 18396 return this.GetPropertyValue(index, "shown"); 18397 }, 18398 SetWindowIsShown: function(index, shown) { 18399 this.SetPropertyValue(index, "shown", shown); 18400 }, 18401 GetWindowWidthFromServer: function(index) { 18402 return this.GetPropertyValue(index, "widthFromServer"); 18403 }, 18404 GetHideBodyScrollWhenModal: function(index) { 18405 return this.GetPropertyValue(index, "hideBodyScrollWhenModal"); 18406 }, 18407 SetHideBodyScrollWhenModal: function(index, value) { 18408 this.SetPropertyValue(index, "hideBodyScrollWhenModal", value); 18409 }, 18410 GetCanScrollViewPort: function(index) { 18411 return this.GetPropertyValue(index, "canScrollViewPort"); 18412 }, 18413 HasDefaultWindow: function() { 18414 return this.GetWindowCountCore() === 0; 18415 }, 18416 GetWindowFooterHeightLite: function(index) { 18417 var footer = this.GetWindowFooterElement(index); 18418 if(footer) 18419 return footer.offsetHeight; 18420 return null; 18421 }, 18422 SetWindowPopUpReasonMouseEvent: function(index, evt) { 18423 evt = ASPx.CloneObject(evt); 18424 if(evt === undefined) 18425 evt = null; 18426 if(0 <= index && index < this.GetWindowCountCore()) 18427 this.windowsPopupReasonMouseEventList[index] = evt; 18428 this.defaultPopupReasonMouseEvent = evt; 18429 }, 18430 GetPopUpReasonMouseEvent: function() { 18431 return this.GetWindowPopUpReasonMouseEvent(null); 18432 }, 18433 GetWindowPopUpReasonMouseEvent: function(window) { 18434 var index = (window != null) ? window.index : -1; 18435 if(0 <= index && index < this.GetWindowCountCore()) 18436 return this.windowsPopupReasonMouseEventList[index]; 18437 return this.defaultPopupReasonMouseEvent; 18438 }, 18439 GetWindowCountCore: function() { 18440 return (this.windows.length > 0) ? this.windows.length : this.windowCount; 18441 }, 18442 SetClientModality: function(isModal) { 18443 this.SetWindowClientModality(-1, isModal); 18444 }, 18445 SetWindowClientModality: function(index, isModal) { 18446 var modalElement = this.GetWindowModalElement(index); 18447 if(isModal && !ASPx.IsElementVisible(modalElement)) 18448 this.DoShowWindowModalElement(index); 18449 if(!isModal && ASPx.IsElementVisible(modalElement)) { 18450 var element = this.GetWindowElement(index); 18451 this.DoHideWindowModalElement(element); 18452 } 18453 }, 18454 GetWindowPinButton: function(index) { 18455 return ASPx.GetElementById(this.name + "_HPB" + index); 18456 }, 18457 GetWindowCollapseButton: function(index) { 18458 return ASPx.GetElementById(this.name + "_HMNB" + index); 18459 }, 18460 GetWindowMaximizeButton: function(index) { 18461 return ASPx.GetElementById(this.name + "_HMXB" + index); 18462 }, 18463 GetWindowScrollDiv: function(index) { 18464 return this.GetWindowChild(index, "_CSD" + index); 18465 }, 18466 GetWindowElementDisplayValue: function(windowHasAnyScrollbars, windowHeight) { 18467 return windowHasAnyScrollbars && windowHeight ? "block" : "table"; 18468 }, 18469 GetMainWindowWidth: function(index, noCache) { 18470 return this.GetClientWindowWidth(index, true, noCache); 18471 }, 18472 GetClientWindowWidth: function(index, outerSize, noCache) { 18473 if(!noCache && (this.GetIsCollapsed(index) || this.GetIsMaximized(index))) { 18474 var cachedSize = this.GetWindowCachedSize(index); 18475 if(cachedSize != null)
18476 return cachedSize.width; 18477 } 18478 var element = this.GetWindowElement(index); 18479 if(element != null) 18480 return element.offsetWidth; 18481 }, 18482 GetMainWindowHeight: function(index, noCache) { 18483 return this.GetClientWindowHeight(index, true, noCache); 18484 }, 18485 GetClientWindowHeight: function(index, outerSize, noCache) { 18486 if(!noCache && (this.GetIsCollapsed(index) || this.GetIsMaximized(index))) { 18487 var cachedSize = this.GetWindowCachedSize(index); 18488 if(cachedSize != null) 18489 return cachedSize.height; 18490 } 18491 var element = this.GetWindowElement(index); 18492 if(element != null) 18493 return element.offsetHeight; 18494 }, 18495 ShowModal: function() { 18496 this.ShowModalByIndex(-1); 18497 }, 18498 ShowModalByIndex: function(index) { 18499 if(this.adaptivityEnabled) { 18500 this.SetAdaptiveModalMode(index, true); 18501 this.ResetModalStyles(index); 18502 this.ResetPopupStyles(index); 18503 this.DoShowModal(index, ASPx.InvalidPosition, ASPx.InvalidPosition, this.GetLastShownPopupElementIndex(index)); 18504 } 18505 }, 18506 DoShowWindowCore: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) { 18507 if(this.IsDOMDisposed()) return; 18508 this.SetWindowPopUpReasonMouseEvent(index, evt); 18509 if(this.adaptivityEnabled) { 18510 this.SetAdaptiveModalMode(index, this.NeedAdaptiveModalMode(index)); 18511 this.ResetModalStyles(index); 18512 if(this.GetAdaptiveModalMode(index)) { 18513 this.ResetPopupStyles(index); 18514 this.DoShowModal(index, x, y, popupElementIndex); 18515 return; 18516 } 18517 } 18518 this.DoShowWindowAtPos(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason); 18519 }, 18520 NeedAdaptiveModalMode: function(index) { 18521 return window.innerWidth < this.GetSwitchAtWindowInnerWidth(); 18522 }, 18523 GetSwitchAtWindowInnerWidth: function() { 18524 return this.switchAtWindowInnerWidth; 18525 }, 18526 GetModalSystemCssClass: function() { 18527 return "dxmodalSys"; 18528 }, 18529 DoShowWindowAtPos: function(index, x, y, popupElementIndex, closeOtherWindows, allowChangeZIndex, evt, closeOtherReason) { 18530 if(!this.isInitialized) 18531 this.PopulatePopupElements(index); 18532 var element = this.GetWindowElement(index); 18533 if(element != null && this.IsWindowElementsIDAssigned(index)) { 18534 this.StopCloseAnimation(index); 18535 this.PrepareToAdjustContentOnShow(index); 18536 if(closeOtherWindows) 18537 aspxGetPopupControlCollection().DoHideAllWindows(element, this.GetWindowElementId(index), false, closeOtherReason, 0); 18538 var isMoving = this.InternalIsWindowVisible(index); 18539 ASPx.SetElementDisplay(element, true); 18540 element.style.display = this.GetWindowElementDisplayValue(this.HasAnyScrollBars(index), this.GetPopupWindowDimensionFromCache(index, false)); 18541 element.style.position = "absolute"; 18542 var scrollDiv = this.GetWindowScrollDiv(index), 18543 shouldResetScrollSize = scrollDiv && this.GetEnableContentScrolling(index) && ASPx.GetDocumentMaxClientHeight() <= element.offsetHeight, 18544 savedScrollDivHeight = shouldResetScrollSize && scrollDiv.style.height; 18545 if(shouldResetScrollSize) 18546 scrollDiv.style.height = 0; 18547 this.RestoreWindowSizeFromCache(index); 18548 if(!this.GetWindowIsShown(index)) { 18549 var width = this.GetPopupWindowDimensionFromCache(index, true), 18550 height = this.GetPopupWindowDimensionFromCache(index, false); 18551 this.SetClientWindowSizeCoreLite(index, width, height); 18552 this.SetWindowIsShown(index, true); 18553 } 18554 var popupElement = this.GetPopupElement(index, popupElementIndex); 18555 if(popupElement) 18556 this.SetLastShownPopupElementIndex(index, popupElementIndex); 18557 if(this.GetIsMaximized(index)) { 18558 if(this.hideBodyScrollWhenMaximized) 18559 ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id); 18560 this.NormalizeMaximizedWindowSize(index); 18561 } 18562 var isDragged = this.GetIsDragged(index); 18563 var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, x, true, isDragged); 18564 var verticalPopupPosition = this.GetClientPopupPos(element, popupElement, y, false, isDragged); 18565 var clientX = horizontalPopupPosition.position; 18566 var clientY = verticalPopupPosition.position; 18567 this.SetWindowPos(index, element, clientX, clientY); 18568 if(shouldResetScrollSize) 18569 scrollDiv.style.height = savedScrollDivHeight; 18570 this.DoShowWindowModalElement(index); 18571 this.SetVisibleWithAnimation(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition); 18572 this.ShowWindowContentUrl(index); 18573 this.AdjustContentOnShow(index); 18574 scrollDiv = this.GetWindowScrollDiv(index); 18575 if(scrollDiv && this.GetEnableContentScrolling(index)) { 18576 var dimension = null; 18577 var windowMainCell = this.GetWindowMainCell(element); 18578 if(windowMainCell.style.width && windowMainCell.style.height) 18579 dimension = 'both'; 18580 else if(windowMainCell.style.width) 18581 dimension = 'width'; 18582 else if(windowMainCell.style.height) 18583 dimension = 'height'; 18584 if(!dimension) 18585 return; 18586 ASPx.SetElementDisplay(scrollDiv, false); 18587 this.SetWindowScrollDivSize(scrollDiv, index, dimension); 18588 ASPx.SetElementDisplay(scrollDiv, true); 18589 } 18590 this.registerAndActivateWindow(element, index, allowChangeZIndex); 18591 this.RaisePopupOnShow(isMoving, index); 18592 this.CorrectWindowSizeGripPositionLite(index); 18593 this.CorrectWindowHeaderText(index); 18594 this.InitMaximizedWindows(index); 18595 this.InitCollapsedWindows(index); 18596 if(this.GetIsPinned(index)) window.setTimeout(function() { this.HoldPosition(index, true); }.aspxBind(this), 0); 18597 if(!this.GetShowOnPageLoad(index)) 18598 this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index)); 18599 if(element.style.width.indexOf("px") > -1) { 18600 element.style.width = ASPx.GetCurrentStyle(element).width; 18601 } 18602 this.updateContentScrollIfNeeded(index); 18603 } 18604 }, 18605 DoShowModal: function(index, x, y, popupElementIndex) { 18606 var element = this.GetWindowElement(index); 18607 if(element != null) { 18608 this.StopCloseAnimation(index); 18609 this.EnsureIframeOnIosContentOverflow(index); 18610 this.PrepareToAdjustContentOnShow(index); 18611 if(!ASPx.Browser.WebKitTouchUI)
18612 ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id); 18613 this.DoShowWindowModalElement(index); 18614 var isMoving = this.InternalIsWindowVisible(index); 18615 ASPx.SetElementDisplay(this.GetModalWrapperElement(index), true); 18616 this.ResetScroll(index); 18617 ASPx.SetElementDisplay(element, true); 18618 this.SetSizeBeforeShow(index); 18619 this.UpdateAlignment(index); 18620 var popupElement = this.GetPopupElement(index, popupElementIndex); 18621 if(popupElement) 18622 this.SetLastShownPopupElementIndex(index, popupElementIndex); 18623 this.SetContentElementsAdaptiveDisplayStyle(index); 18624 var horizontalPopupPosition = this.GetClientPopupPos(element, popupElement, x, true, false), 18625 verticalPopupPosition = this.GetClientPopupPos(element, popupElement, y, false, false); 18626 this.SetVisibleWithAnimation(element, isMoving, index, horizontalPopupPosition, verticalPopupPosition); 18627 this.ShowWindowContentUrl(index); 18628 this.AdjustContentOnShow(index); 18629 this.registerAndActivateWindow(element, index, true); 18630 this.RaisePopupOnShow(isMoving, index); 18631 this.CorrectWindowHeaderText(index); 18632 if(!this.GetShowOnPageLoad(index)) 18633 this.CorrectElementVerticalAlignment(ASPx.AdjustVerticalMarginsInContainer, this.GetWindowHeaderElement(index)); 18634 } 18635 }, 18636 EnsureIframeOnIosContentOverflow: function(index) { 18637 if(this.HasIframeOnIos(index)) { 18638 var contentElement = this.GetWindowContentElement(index); 18639 if(contentElement.style.overflow === "") 18640 contentElement.style.overflow = "auto"; 18641 } 18642 }, 18643 SetWindowElementZIndex: function(element, zIndex) { 18644 ASPxClientPopupControlBase.prototype.SetWindowElementZIndex.call(this, element, zIndex); 18645 if(this.adaptivityEnabled) 18646 this.SetModalWrapperZIndex(this.GetWindowIndex(element), zIndex); 18647 else 18648 this.updateContentScrollIfNeeded(this.GetWindowIndex(element)); 18649 }, 18650 SetModalWrapperZIndex: function(index, zIndex) { 18651 if(!this.GetAdaptiveModalMode(index)) return; 18652 ASPx.SetStyles(this.GetModalWrapperElement(index), { 18653 zIndex: zIndex 18654 }); 18655 }, 18656 updateContentScrollIfNeeded: function(index) { 18657 var windowElement = this.GetWindowElement(index); 18658 var wrapper = this.getWindowWrapper(windowElement); 18659 var wrapperScroll = this.getWindowWrapperScroll(windowElement); 18660 if(!wrapper || !this.WindowIsModal(index) || !this.GetHideBodyScrollWhenModal(index)) 18661 return; 18662 ASPx.PopupUtils.adjustViewportScrollWrapper(wrapper, wrapperScroll, windowElement); 18663 }, 18664 getWindowWrapper: function(windowElement) { 18665 return ASPx.GetParentByClassName(windowElement, PopupControlCssClasses.WindowWrapperCssClassName); 18666 }, 18667 getWindowWrapperScroll: function(windowElement) { 18668 return ASPx.GetParentByClassName(windowElement, PopupControlCssClasses.WindowWrapperScrollCssClassName); 18669 }, 18670 SizeCanBeSet: function(index, isWindowMaximizedAndCollapsed) { 18671 return ASPxClientPopupControlBase.prototype.SizeCanBeSet.call(this, index, isWindowMaximizedAndCollapsed) && !this.GetAdaptiveModalMode(index); 18672 }, 18673 GetPopupWindowDimensionFromCache: function(index, isWidth) { 18674 var dimension; 18675 if(isWidth) { 18676 dimension = this.GetWindowWidthInternal(index); 18677 if(ASPx.IsExists(dimension)) { 18678 dimension = Math.max(dimension, this.GetWindowMinWidth(index)); 18679 var maxWidth = this.GetWindowMaxWidth(index); 18680 if(maxWidth) 18681 dimension = Math.min(dimension, maxWidth); 18682 } 18683 } 18684 else { 18685 dimension = this.GetWindowHeightInternal(index); 18686 if(ASPx.IsExists(dimension)) { 18687 if(this.HasAnyScrollBars(index) && dimension === constants.DEFAULT_WINDOW_HEIGHT) 18688 return undefined; 18689 dimension = Math.max(dimension, this.GetWindowMinHeight(index)); 18690 var maxHeight = this.GetWindowMaxHeight(index); 18691 if(maxHeight) 18692 dimension = Math.min(dimension, maxHeight); 18693 } 18694 } 18695 return dimension; 18696 }, 18697 NormalizeMaximizedWindowSize: function(index) { 18698 var width = this.GetPopupWindowDimensionFromCache(index, true), 18699 height = this.GetPopupWindowDimensionFromCache(index, false), 18700 dimensions = this.getDocumentDimensions(index), 18701 sizeNormalizationIsNeeded = width < dimensions.width || height < dimensions.height; 18702 if(sizeNormalizationIsNeeded) 18703 this.NormalizeWindowSize(index, true); 18704 }, 18705 NormalizeWindowSize: function(index, isMaximized) { 18706 var width = this.GetClientWindowWidth(index), 18707 height = this.GetClientWindowHeight(index), 18708 normWidth = width, 18709 normHeight = height, 18710 maxWidth = this.GetWindowMaxWidth(index), 18711 minWidth = this.GetWindowMinWidth(index), 18712 maxHeight = this.GetWindowMaxHeight(index), 18713 minHeight = this.GetWindowMinHeight(index); 18714 if(maxWidth) 18715 normWidth = Math.min(normWidth, maxWidth); 18716 if(minWidth) 18717 normWidth = Math.max(normWidth, minWidth); 18718 if(maxHeight) 18719 normHeight = Math.min(normHeight, maxHeight); 18720 if(minHeight) 18721 normHeight = Math.max(normHeight, minHeight); 18722 if(normWidth !== width || normHeight !== height) 18723 this.SetWindowSize(this.GetWindow(index), normWidth, normHeight); 18724 if(isMaximized) { 18725 var dimensions = this.getDocumentDimensions(index); 18726 if(this.GetIsCollapsed(index)) { 18727 if(normWidth != dimensions.width) { 18728 this.SetWindowSizeByIndexCore(index, dimensions.width, normHeight, true); 18729 } 18730 } else { 18731 if(normWidth != dimensions.width || normHeight != dimensions.height) { 18732 this.SetWindowSizeByIndexCore(index, dimensions.width, dimensions.height, false); 18733 } 18734 } 18735 } 18736 }, 18737 DoShowWindowModalElement: function(index) { 18738 if(this.CanManipulateWithModalElement(index)) { 18739 if(this.adaptivityEnabled) { 18740 this.DoShowWindowModalElementWithAdaptivity(index); 18741 return; 18742 } 18743 var modalElement = this.GetWindowModalElement(index); 18744 var bodyScrollHasJustBeingHidden = false; 18745 if(this.GetHideBodyScrollWhenModal(index) && (!this.IsWindowVisible(this.GetWindow(index)) || !ASPx.IsElementVisible(modalElement))) { 18746 bodyScrollHasJustBeingHidden = true; 18747 aspxGetPopupControlCollection().LockWindowResizeByBodyScrollVisibilityChanging(); 18748 if(!ASPx.Browser.WebKitTouchUI) 18749 ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(this.GetWindowElementId(index)); 18750 } 18751 ASPx.SetElementDisplay(modalElement, true); 18752 this.AdjustModalElementBounds(modalElement); 18753 this.SetModalElementVisibilityWithAnimation(modalElement, index); 18754 aspxGetPopupControlCollection().RegisterVisibleModalElement(modalElement); 18755 if(bodyScrollHasJustBeingHidden) 18756 aspxGetPopupControlCollection().UnlockWindowResizeByBodyScrollVisibilityChanging(); 18757 } 18758 }, 18759 DoShowWindowModalElementWithAdaptivity: function(index) { 18760 var overlayElement = this.GetOverlayElement(index); 18761 if(!overlayElement) return; 18762 ASPx.SetStyles(overlayElement, { 18763 right: 0, 18764 bottom: 0, 18765 width: "", 18766 height: "" 18767 }); 18768 ASPx.SetElementDisplay(overlayElement, true); 18769 this.SetModalElementVisibilityWithAnimation(overlayElement, index); 18770 ASPx.GetPopupControlCollection().RegisterVisibleModalElement(overlayElement); 18771 }, 18772 SetSizeBeforeShow: function(index) { 18773 if(this.GetModalMaxWidth(index) && this.GetModalMaxWidth(index) !== this.DefaultModalMaxWidth) 18774 this.SetAdaptiveMaxWidthByIndex(index, this.GetModalMaxWidth(index)); 18775 if(this.GetModalMinWidth(index) !== this.DefaultModalMinWidth) 18776 this.SetAdaptiveMinWidthByIndex(index, this.GetModalMinWidth(index)); 18777 this.UpdateHeightDimensions(index); 18778 }, 18779 UpdateHeightDimensions: function(index) { 18780 this.UpdateAdaptiveMinHeight(index); 18781 this.UpdateAdaptiveMaxHeight(index); 18782 }, 18783 UpdateAdaptiveMinHeight: function(index) { 18784 if(this.GetModalMinHeight(index) !== null) 18785 this.SetAdaptiveHeightDimension(index, "minHeight", this.GetModalMinHeight(index)); 18786 }, 18787 UpdateAdaptiveMaxHeight: function(index) { 18788 if(this.GetModalMaxHeight(index) !== null) 18789 this.SetAdaptiveHeightDimension(index, "maxHeight", this.GetModalMaxHeight(index)); 18790 }, 18791 GetClientPopupPos: function(element, popupElement, pos, isX, isDragged) { 18792 if(!this.GetAdaptiveModalMode(this.GetWindowIndex(element))) 18793 return ASPxClientPopupControlBase.prototype.GetClientPopupPos.call(this, element, popupElement, pos, isX, isDragged); 18794 var getPosFunc = isX ? ASPx.GetAbsolutePositionX : ASPx.GetAbsolutePositionY; 18795 return { position: getPosFunc(element) }; 18796 }, 18797 GetAnimationVerticalDirection: function(index, verticalPopupPosition) { 18798 if(!this.GetAdaptiveModalMode(index)) 18799 return ASPxClientPopupControlBase.prototype.GetAnimationVerticalDirection.call(this, index, verticalPopupPosition); 18800 return ASPxClientPopupControl.Animation.GetVerticalDirection(this.modalVerticalAlign, this.modalHorizontalAlign); 18801 }, 18802 GetAnimationHorizontalDirection: function(index, horizontalPopupPosition) { 18803 if(!this.GetAdaptiveModalMode(index)) 18804 return ASPxClientPopupControlBase.prototype.GetAnimationHorizontalDirection.call(this, index, horizontalPopupPosition); 18805 return ASPxClientPopupControl.Animation.GetHorizontalDirection(this.modalHorizontalAlign); 18806 }, 18807 GetDefaultVerticalOffset: function() { 18808 return this.IsSmallDisplay() ? 10 : 30; 18809 }, 18810 IsSmallDisplay: function() { 18811 return window.innerWidth < this.GetScreenLimitForCss(); 18812 }, 18813 GetScreenLimitForCss: function() { 18814 return ASPx.MaxMobileWindowWidth; 18815 }, 18816 StartAutoAnimation: function(element, index, horizontalPopupPosition, verticalPopupPosition) { 18817 if(this.adaptivityEnabled) { 18818 if(this.NeedFadeAnimation(index, this.popupAnimationType)) 18819 this.StartFadeAnimation(element, index); 18820 else 18821 this.StartSlideAnimation(element, index, horizontalPopupPosition, verticalPopupPosition); 18822 } else 18823 ASPxClientPopupControlBase.prototype.StartAutoAnimation.call(this, element, index, horizontalPopupPosition, verticalPopupPosition); 18824 }, 18825 DoHideWindowWithAutoAnimation: function(index, element, closeReason) { 18826 if(this.NeedFadeAnimation(index, this.closeAnimationType)) 18827 this.DoHideWindowWithFadeAnimation(index, element, closeReason); 18828 else 18829 this.DoHideWindowWithSlideAnimation(index, closeReason); 18830 }, 18831 IsDraggingAllowed: function(index) { 18832 return this.allowDragging && (!this.GetAdaptiveModalMode(index) || this.allowDraggingInAdaptiveMode); 18833 }, 18834 IsResizeAllowed: function(index) { 18835 return ASPxClientPopupControlBase.prototype.IsResizeAllowed.call(this, index) && !this.GetAdaptiveModalMode(index); 18836 }, 18837 IsFadeCloseAnimation: function(index) { 18838 return ASPxClientPopupControlBase.prototype.IsFadeCloseAnimation.call(this, index) || this.NeedFadeAnimation(index, this.closeAnimationType); 18839 }, 18840 NeedFadeAnimation: function(index, animationType) { 18841 return ASPxClientPopupControl.Animation.NeedFadeAnimation(this.modalHorizontalAlign, this.modalVerticalAlign, 18842 animationType, this.popupHorizontalAlign, this.popupVerticalAlign, this.GetAdaptiveModalMode(index)); 18843 }, 18844 AllowModalElementAnimation: function(index) { 18845 if(this.GetAdaptiveModalMode(index)) 18846 return this.HasOpenAnimation(); 18847 return ASPxClientPopupControlBase.prototype.AllowModalElementAnimation.call(this, index); 18848 }, 18849 DoHideWindowCore: function(index, closeReason) { 18850 var element = this.GetWindowElement(index); 18851 if(element != null) { 18852 if(this.HasCloseAnimation()) 18853 this.PrepareElementAfterCloseAnimation(index, element); 18854 element.isHiding = true; 18855 element.style.zIndex = this.GetDefaultZIndexFromServer(); 18856 this.SetIsDragged(index, false); 18857 this.UpdateWindowsStateCookie(); 18858 element.isHiding = false; 18859 this.StopShowAnimation(index); 18860 if(ASPx.Browser.WebKitTouchUI || ASPx.Browser.Safari) { 18861 var dummy = element.offsetWidth; 18862 } 18863 ASPx.SetElementDisplay(element, false); 18864 ASPx.SetElementVisibility(element, false); 18865 if(this.adaptivityEnabled) { 18866 ASPx.SetElementDisplay(this.GetModalWrapperElement(index), ""); 18867 if(!ASPx.Browser.WebKitTouchUI) 18868 ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.i
18868d); 18869 this.SetWrapperScrollVisible(index, true); 18870 this.SetIsDragged(index, false); 18871 } 18872 if(this.hideBodyScrollWhenMaximized && this.GetIsMaximized(index)) 18873 ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id); 18874 this.DoHideWindowModalElement(element, closeReason); 18875 this.DoHideWindowIFrame(element); 18876 aspxGetPopupControlCollection().UnregisterVisibleWindow(element); 18877 this.ProcessAccessibleElementOnHide(); 18878 this.HideWindowLoadingPanel(index); 18879 } 18880 }, 18881 OnAnimationStop: function(index) { 18882 if(this.adaptivityEnabled) { 18883 this.SetWrapperScrollVisible(index, true); 18884 this.UnlockWrapperScrollEventEvent(); 18885 } 18886 ASPxClientPopupControlBase.prototype.OnAnimationStop.call(this, index); 18887 if(!this.adaptivityEnabled && ASPx.Browser.Firefox) 18888 this.GetWindowElement(index).style.display = "table"; 18889 }, 18890 ResetModalStyles: function(index) { 18891 var element = this.GetWindowElement(index); 18892 if(element != null) { 18893 ASPx.SetStyles(element, { 18894 minWidth: "", 18895 maxWidth: "", 18896 marginTop: "", 18897 marginLeft: "", 18898 marginRight: "", 18899 position: "" 18900 }); 18901 ASPx.SetStyles(this.GetWindowContentElement(index), { 18902 minHeight: "", 18903 maxHeight: "", 18904 }); 18905 this.FixateFooter(index, false, 0); 18906 this.FixateHeader(index, false, 0); 18907 this.SetIsDragged(false); 18908 this.DoHideWindowModalElement(element); 18909 } 18910 }, 18911 ResetPopupStyles: function(index) { 18912 var element = this.GetWindowElement(index); 18913 if(element != null) { 18914 ASPx.SetStyles(element, { 18915 left: "", 18916 top: "", 18917 width: "", 18918 height: "", 18919 }); 18920 ASPx.SetStyles(this.GetWindowContentWrapperElement(index), { 18921 height: "", 18922 width: "", 18923 display: "" 18924 }); 18925 ASPx.SetStyles(this.GetWindowContentElement(index), { 18926 display: "", 18927 width: "", 18928 height: "" 18929 }); 18930 this.SetWindowIsShown(index, false); 18931 } 18932 }, 18933 InitDivPosForHideSlideAnimation: function(animationDivElement) { 18934 ASPx.PopupUtils.InitAnimationDivCore(animationDivElement); 18935 }, 18936 DoHideWindow: function(index, dontRaiseClosing, closeReason) { 18937 var cancel = ASPxClientPopupControlBase.prototype.DoHideWindow.call(this, index, dontRaiseClosing, closeReason); 18938 this.updateContentScrollIfNeeded(index); 18939 return cancel; 18940 }, 18941 OnWindowShown: function(windowIndex) { 18942 this.EnsureContent(windowIndex, false); 18943 this.EnsureIFrameHeightAdjusted(windowIndex); 18944 if(this.GetAdaptiveModalMode(windowIndex)) 18945 this.ChangeFooterFixed(windowIndex); 18946 else { 18947 var isMaximized = this.GetIsMaximized(windowIndex); 18948 if(isMaximized || this.HasAnyScrollBars(windowIndex)) 18949 this.NormalizeWindowSize(windowIndex, isMaximized); 18950 } 18951 this.RaiseShown(windowIndex); 18952 var loadingElementsWillNotBeShown = !this.lpTimers[windowIndex] || this.lpTimers[windowIndex] < 0; 18953 if(this.InWindowCallback(windowIndex) && loadingElementsWillNotBeShown) { 18954 this.ShowWindowLoadingElementsInternal(windowIndex); 18955 } 18956 if(this.GetAdaptiveModalMode(windowIndex)) 18957 this.UpdateAdaptiveMinHeight(windowIndex); 18958 }, 18959 SetWrapperScrollVisible: function(index, visible) { 18960 if(!this.GetAdaptiveModalMode(index)) return; 18961 var modalWrapper = this.GetModalWrapperElement(index); 18962 if(visible) { 18963 ASPx.Attr.RestoreStyleAttribute(modalWrapper, "overflow-x"); 18964 ASPx.Attr.RestoreStyleAttribute(modalWrapper, "overflow-y"); 18965 } else { 18966 if(this.modalVerticalAlign === ModalAlign.WindowBottom && this.GetWindowElement(index).offsetHeight <= window.innerHeight) 18967 ASPx.Attr.ChangeStyleAttribute(modalWrapper, "overflow-y", "hidden"); 18968 if(this.modalHorizontalAlign === ModalAlign.WindowRight) 18969 ASPx.Attr.ChangeStyleAttribute(modalWrapper, "overflow-x", "hidden"); 18970 } 18971 }, 18972 GetDragCorrection: function(index, element, isX) { 18973 if(this.adaptivityEnabled) { 18974 var offset = isX ? element.offsetLeft : element.offsetTop; 18975 offset -= ASPx.PxToInt(element.style[isX ? "left" : "top"]); 18976 return ASPx.GetPositionElementOffset(this.GetModalWrapperElement(index), isX) + offset; 18977 } else 18978 return ASPxClientPopupControlBase.prototype.GetDragCorrection.call(this, index, element, isX); 18979 }, 18980 GetSlideAnimationDuration: function(index) { 18981 return !this.GetAdaptiveModalMode(index) ? ASPxClientPopupControlBase.prototype.GetSlideAnimationDuration.call(this, index) : 300; 18982 }, 18983 GetSlideOffsetCoefficient: function(index) { 18984 return !this.GetAdaptiveModalMode(index) ? ASPxClientPopupControlBase.prototype.GetSlideOffsetCoefficient.call(this, index) : 0.25; 18985 }, 18986 InitDivPosForShowSlideAnimation: function(index, animationDivElement, clientX, clientY, onAnimStopCallString) { 18987 if(!this.GetAdaptiveModalMode(index)) 18988 ASPxClientPopupControlBase.prototype.InitDivPosForShowSlideAnimation.call(this, index, animationDivElement, clientX, clientY, onAnimStopCallString); 18989 else 18990 ASPx.PopupUtils.InitAnimationProperties(animationDivElement, onAnimStopCallString); 18991 }, 18992 BeforeAnySlideAnimation: function(index) { 18993 this.FixateFooter(index, false, 0); 18994 this.FixateHeader(index, false, 0); 18995 this.SetWrapperScrollVisible(index, false); 18996 }, 18997 StartSlideAnimation: function(animationDivElement, index, horizontalPopupPosition, verticalPopupPosition) { 18998 if(this.adaptivityEnabled) { 18999 this.LockWrapperScrollEvent(); 19000 this.BeforeAnySlideAnimation(index); 19001 } 19002 ASPxClientPopupControlBase.prototype.StartSlideAnimation.call(this, animationDivElement, index, horizontalPopupPosition, verticalPopupPosition); 19003 }, 19004 DoHideWindowWithSlideAnimation: function(index, closeReason) { 19005 if(this.adaptivityEnabled) 19006 this.BeforeAnySlideAnimation(index); 19007 ASPxClientPopupControlBase.prototype.DoHideWindowWithSlideAnimation.call(this, index, closeReason); 19008 }, 19009 UpdatePositionAfterCallback: function(windowIndex) { 19010 if(!this.InternalIsWindowVisible(windowIndex)) return; 19011 if(this.adaptivityEnabled) 19012 this.TryAutoUpdatePosition(windowIndex); 19013 else if(this.contentLoadingMode === LoadContentViaCallback.OnFirstShow) 19014 this.UpdateWindowPositionInternal(windowIndex, this.GetPopupElement(windowIndex, this.GetLastShownPopupElementIndex(windowIndex))); 19015 }, 19016 CreateLoadingDiv: function(parentElement, offsetElement, windowIndex) { 19017 if(typeof (windowIndex) != "undefined") { 19018 var loadingDiv = ASPxClientControl.prototype.CreateLoadingDiv.call(this, parentElement, offsetElement); 19019 loadingDiv.id += windowIndex; 19020 return loadingDiv; 19021 } 19022 }, 19023 CreateLoadingPanelWithAbsolutePosition: function(parentElement, offsetElement, windowIndex) { 19024 if(typeof (windowIndex) != "undefined") { 19025 var loadingPanel = ASPxClientControl.prototype.CreateLoadingPanelWithAbsolutePosition.call(this, parentElement, offsetElement); 19026 loadingPanel.id += windowIndex; 19027 return loadingPanel; 19028 } 19029 }, 19030 PerformWindowCallback: function(window, parameter, onSuccess) { 19031 ASPxClientPopupControlBase.prototype.PerformWindowCallback.call(this, window, parameter, onSuccess); 19032 }, 19033 SetIframeVisibleForDragging: function(index, visible) { 19034 var iframeElement = this.GetWindowContentIFrameElement(index); 19035 if(ASPx.Browser.Edge) 19036 iframeElement.style.pointerEvents = visible ? "" : "none"; 19037 ASPx.SetElementVisibility(iframeElement, visible); 19038 }, 19039 OnResizeStop: function(evt, index, cursor, resizePanel) { 19040 ASPxClientPopupControlBase.prototype.OnResizeStop.call(this, evt, index, cursor, resizePanel); 19041 if(this.IsResizeAllowed(index)) 19042 this.SetWindowCachedSize(index, this.GetClientWindowWidth(index), this.GetClientWindowHeight(index)); 19043 this.updateContentScrollIfNeeded(index); 19044 }, 19045 OnMouseDownModalElement: function(evt, index) { 19046 aspxGetPopupControlCollection().DoHideAllWindows(ASPx.Evt.GetEventSource(evt), "", false, ASPxClientPopupControlCloseReason.OuterMouseClick, evt.offsetX); 19047 this.SetIsPopuped(index, true); 19048 }, 19049 IsRaiseAfterResizingLocked: function() { 19050 return this.CollapseExecuting() || this.MaximizationExecuting(); 19051 }, 19052 GetContentElementChildren: function(index, contentElement) { 19053 var cache = this.GetResizeSessionCache(); 19054 if(!cache.contentElementChildren || !cache.contentElementChildren[index]) { 19055 cache.contentElementChildren = []; 19056 cache.contentElementChildren[index] = contentElement.getElementsByTagName("*"); 19057 } 19058 return cache.contentElementChildren[index]; 19059 }, 19060 GetContentElementChildrenScroll: function(index, contentElementChildren) { 19061 var cache = this.GetResizeSessionCache(); 19062 if(!cache.contentElementChildrenScroll || !cache.contentElementChildrenScroll[index]) { 19063 cache.contentElementChildrenScroll = []; 19064 cache.contentElementChildrenScroll[index] = []; 19065 for(var i = 0, len = contentElementChildren.length; i < len; i++) { 19066 var child = contentElementChildren[i]; 19067 if(!!child.scrollLeft || !!child.scrollTop) 19068 cache.contentElementChildrenScroll[index].push([i, child.scrollLeft, child.scrollTop]); 19069 } 19070 } 19071 return cache.contentElementChildrenScroll[index]; 19072 }, 19073 GetElementBordersAndPaddings: function(index, element, leftRight) { 19074 var cache = this.GetResizeSessionCache(); 19075 if(!cache.elementBordersAndPaddings || !cache.elementBordersAndPaddings[index]) { 19076 cache.elementBordersAndPaddings = []; 19077 var style = ASPx.GetCurrentStyle(element); 19078 cache.elementBordersAndPaddings[index] = { 19079 leftRight: this.getLeftRightBordersAndPaddingsSummaryValue(element, style), 19080 topBottom: this.getTopBottomBordersAndPaddingsSummaryValue(element, style) 19081 }; 19082 } 19083 return leftRight ? cache.elementBordersAndPaddings[index].leftRight : cache.elementBordersAndPaddings[index].topBottom; 19084 }, 19085 GetHeaderFooterHeight: function(index) { 19086 var cache = this.GetResizeSessionCache(); 19087 if(!cache.headerFooterHeight || !cache.headerFooterHeight[index]) { 19088 cache.headerFooterHeight = []; 19089 cache.headerFooterHeight[index] = this.GetHeaderFooterHeightCore(index); 19090 } 19091 return cache.headerFooterHeight[index]; 19092 }, 19093 getContentElementDisplay: function(correctContentElementSize, contentUrl) { 19094 return correctContentElementSize || contentUrl ? "block" : "table-cell"; 19095 }, 19096 SetContentWrapperHeightLite: function(index, actualHeight, windowElem, contentWrapper) { 19097 if(!windowElem.style.height || ASPx.IsPercentageSize(windowElem.style.height)) 19098 return; 19099 var borderOwner = this.GetWindowBorderOwnerElement(windowElem); 19100 var height = borderOwner == windowElem ? actualHeight : actualHeight - (borderOwner ? ASPx.GetTopBottomBordersAndPaddingsSummaryValue(borderOwner) : 0); 19101 height -= this.GetHeaderFooterHeight(index); 19102 if(height > 0) 19103 contentWrapper.style.height = height + "px"; 19104 }, 19105 SetWindowScrollDivSize: function(scrollDiv, index, dimension) { 19106 var windowClientTable = this.GetWindowClientTable(index); 19107 var headerElement = this.GetWindowHeaderElement(index); 19108 var height = windowClientTable.offsetHeight; 19109 if(headerElement) 19110 height -= headerElement.offsetHeight; 19111 height -= this.GetWindowFooterHeightLite(index);
19112 if(dimension == 'height' || dimension == 'both') 19113 ASPx.SetOffsetHeight(scrollDiv, height); 19114 if(dimension == 'width' || dimension == 'both') { 19115 var width = windowClientTable.offsetWidth; 19116 var contentElement = this.GetWindowContentElement(index); 19117 width -= this.getLeftRightBordersAndPaddingsSummaryValue(scrollDiv) + ASPx.GetHorizontalBordersWidth(contentElement); 19118 if(width > -1) 19119 scrollDiv.style.width = width + "px"; 19120 } 19121 scrollDiv.style.marginRight = "0px"; 19122 }, 19123 AdjustIFrameHeight: function(index, iframe) { 19124 ASPxClientPopupControlBase.prototype.AdjustIFrameHeight.call(this, index, iframe); 19125 if(!this.InternalIsWindowVisible(index) || !iframe || this.GetAdaptiveModalMode(index)) return; 19126 this.SetIframeAdjustingPostponed(index, false); 19127 var content = this.GetContentContainer(index); 19128 var contentWrapper = this.GetWindowContentWrapperElement(index); 19129 iframe.style.verticalAlign = "text-bottom"; 19130 var iframeHeight = contentWrapper.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(content); 19131 if(iframeHeight >= 0) 19132 iframe.style.height = iframeHeight + "px"; 19133 }, 19134 OnPinButtonClick: function(index) { 19135 var value = this.GetIsPinned(index); 19136 this.SetPinCore(index, !value); 19137 }, 19138 SetPinCore: function(index, value) { 19139 if(this.GetIsPinned(index) != value) { 19140 this.SetIsPinned(index, value); 19141 this.HoldPosition(index, value); 19142 this.UpdateWindowsStateCookie(); 19143 this.OnPinned(index, value); 19144 } 19145 }, 19146 OnPinned: function(index, pinned) { 19147 this.RaisePinnedChanged(index, pinned); 19148 }, 19149 HoldPosition: function(index, hold, element) { 19150 if(hold) { 19151 element = element || this.GetWindowElement(index); 19152 if(!element) return; 19153 var x = ASPx.GetAbsoluteX(element); 19154 var y = ASPx.GetAbsoluteY(element); 19155 scrollX = ASPx.GetDocumentScrollLeft(); 19156 scrollY = ASPx.GetDocumentScrollTop(); 19157 this.SetPinPosX(index, x - scrollX); 19158 this.SetPinPosY(index, y - scrollY); 19159 } 19160 this.UpdateHeaderButtonSelected(index, "GetWindowPinButton", hold);
19161 this.CheckHeaderCursor(index); 19162 }, 19163 GetBodyWidth: function() { 19164 return aspxGetPopupControlCollection().GetSavedBodyWidth(); 19165 }, 19166 GetBodyHeight: function() { 19167 return aspxGetPopupControlCollection().GetSavedBodyHeight(); 19168 }, 19169 GetIsOutFromViewPort: function(index) { 19170 var element = this.GetWindowElement(index); 19171 if(!element) return false; 19172 var pinXTarget = this.GetPinPosX(index); 19173 var pinYTarget = this.GetPinPosY(index); 19174 var popupWindowWidth = this.GetClientWindowWidth(index); 19175 var docClientWidth = ASPx.GetDocumentClientWidth(); 19176 var rightOutOffset = (pinXTarget + popupWindowWidth) - docClientWidth; 19177 var popupWindowHeight = this.GetClientWindowHeight(index); 19178 var docClientHeight = ASPx.GetDocumentClientHeight(); 19179 var bottomOutOffset = (pinYTarget + popupWindowHeight) - docClientHeight; 19180 return (rightOutOffset > 0 || bottomOutOffset > 0); 19181 }, 19182 needToHidePinnedOutFromViewPort: function(index) { 19183 return this.GetIsPinned(index) && this.GetIsOutFromViewPort(index); 19184 }, 19185 AdjustPinPositionWhileScroll: function(index) { 19186 var element = this.GetWindowElement(index); 19187 if(!element) return; 19188 var x = ASPx.GetAbsoluteX(element); 19189 var y = ASPx.GetAbsoluteY(element); 19190 var scrollX = ASPx.GetDocumentScrollLeft(); 19191 var scrollY = ASPx.GetDocumentScrollTop(); 19192 var pinX = x - scrollX; 19193 var pinY = y - scrollY; 19194 var pinXTarget = this.GetPinPosX(index); 19195 var pinYTarget = this.GetPinPosY(index); 19196 if((pinX != pinXTarget) || (pinY != pinYTarget)) { 19197 this.lockScroll++; 19198 var xNew = pinXTarget + scrollX; 19199 var yNew = pinYTarget + scrollY; 19200 var bodyWidth = this.GetBodyWidth(); 19201 var bodyHeight = this.GetBodyHeight(); 19202 var popupWindowWidth = this.GetClientWindowWidth(index); 19203 var docClientWidth = ASPx.GetDocumentClientWidth(); 19204 var rightOutOffset = (pinXTarget + popupWindowWidth) - docClientWidth; 19205 var popupWindowHeight = this.GetClientWindowHeight(index); 19206 var docClientHeight = ASPx.GetDocumentClientHeight(); 19207 var bottomOutOffset = (pinYTarget + popupWindowHeight) - docClientHeight; 19208 var cancelScrollX = false; 19209 if(xNew + (popupWindowWidth - rightOutOffset) > bodyWidth) { 19210 xNew -= (xNew + (popupWindowWidth - rightOutOffset) - bodyWidth); 19211 cancelScrollX = true; 19212 } 19213 var cancelScrollY = false; 19214 if(yNew + (popupWindowHeight - bottomOutOffset) > bodyHeight) { 19215 yNew -= (yNew + (popupWindowHeight - bottomOutOffset) - bodyHeight); 19216 cancelScrollY = true; 19217 } 19218 xNew = ASPx.PrepareClientPosForElement(xNew, element, true); 19219 yNew = ASPx.PrepareClientPosForElement(yNew, element, false); 19220 this.SetWindowPos(index, element, xNew, yNew); 19221 if(cancelScrollX) { 19222 var scrollLeftMax = bodyWidth - ASPx.GetDocumentClientWidth(); 19223 if((rightOutOffset > 0) && (scrollX > scrollLeftMax)) { 19224 this.lockScroll++; 19225 ASPx.SetDocumentScrollLeft(scrollLeftMax); 19226 this.lockScroll--; 19227 } 19228 } 19229 if(cancelScrollY) { 19230 var scrollTopMax = bodyHeight - ASPx.GetDocumentClientHeight(); 19231 if((bottomOutOffset > 0) && (scrollY > scrollTopMax)) { 19232 this.lockScroll++; 19233 ASPx.SetDocumentScrollTop(scrollTopMax); 19234 this.lockScroll--; 19235 } 19236 } 19237 this.lockScroll--; 19238 } 19239 }, 19240 OnCollapseButtonClick: function(index) { 19241 this.SetCollapsedCore(index, !this.GetIsCollapsed(index)); 19242 }, 19243 SetCollapsedCore: function(index, minimization) { 19244 if(this.GetIsCollapsed(index) == minimization) return; 19245 this.DoCollapse(index, minimization); 19246 this.OnCollapsed(index, minimization); 19247 }, 19248 DoCollapse: function(index, minimization) { 19249 if(this.GetIsCollapsed(index) == minimization) return; 19250 this.StartCollapse(); 19251 if(minimization) { 19252 var cachedWidth = this.GetClientWindowWidth(index); 19253 var cachedHeight = this.GetClientWindowHeight(index); 19254 var shouldUpdateRestoredSize = this.ShoulUpdatedRestoredWindowSizeOnCollapse(index); 19255 var width = this.GetMainWindowWidth(index, !shouldUpdateRestoredSize); 19256 var height = this.GetMainWindowHeight(index, !shouldUpdateRestoredSize); 19257 this.SetWindowSizeByIndex(index, width, 0); 19258 this.SetWindowContentVisible(index, false); 19259 this.SetWindowFooterVisible(index, false); 19260 this.ResetWindowHeight(index); 19261 this.SetIsCollapsed(index, minimization); 19262 this.SetWindowCachedSize(index, cachedWidth, cachedHeight); 19263 if(shouldUpdateRestoredSize) 19264 this.UpdateRestoredWindowSize(index, width, height); 19265 } 19266 else { 19267 if(this.MaximizationExecuting()) { 19268 var element = this.GetWindowElement(index); 19269 if(element) { 19270 element.style.left = ASPx.GetDocumentScrollLeft(); 19271 element.style.top = ASPx.GetDocumentScrollTop(); 19272 } 19273 } 19274 this.SetWindowContentVisible(index, true); 19275 this.SetWindowFooterVisible(index, true); 19276 this.SetIsCollapsed(index, minimization); 19277 if(this.GetIsMaximized(index)) { 19278 var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup(); 19279 var documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup(); 19280 this.SetWindowSizeByIndex(index, documentClientWidth, documentClientHeight); 19281 } else { 19282 var restoredWindowData = this.GetRestoredWindowData(index); 19283 this.SetWindowSizeByIndex(index, restoredWindowData.width, restoredWindowData.height); 19284 } 19285 ASPx.GetControlCollection().AdjustControls(this.GetWindowElement(index)); 19286 }
19287 this.UpdateHeaderButtonSelected(index, "GetWindowCollapseButton", minimization); 19288 this.EndCollapse(); 19289 this.UpdateWindowsStateCookie(); 19290 }, 19291 ResetWindowHeight: function(index) { 19292 var element = this.GetWindowElement(index); 19293 if(element) 19294 element.style.height = ""; 19295 }, 19296 ShoulUpdatedRestoredWindowSizeOnCollapse: function(index) { 19297 return !this.GetIsMaximized(index); 19298 }, 19299 OnCollapsed: function(index, value) { 19300 if(value) 19301 this.RaiseCollapsed(index); 19302 else 19303 this.RaiseExpanded(index); 19304 this.RaiseAfterResizing(index); 19305 }, 19306 OnMaximizeButtonClick: function(index) { 19307 this.SetMaximizedCore(index, !this.GetIsMaximized(index)); 19308 }, 19309 SetMaximizedCore: function(index, maximization) { 19310 if(this.GetIsMaximized(index) == maximization) return; 19311 this.DoMaximize(index, maximization); 19312 this.OnMaximizedChanged(index, maximization); 19313 }, 19314 GetMaximizedPosition: function(element, isX) { 19315 if(ASPx.Browser.WebKitTouchUI) 19316 return ASPx.PrepareClientPosForElement(0, element, isX); 19317 return ASPx.PrepareClientPosForElement(isX ? ASPx.GetDocumentScrollLeft() : ASPx.GetDocumentScrollTop(), element, isX); 19318 }, 19319 PerformMaximaze: function (index, maximization, element) { 19320 if (this.hideBodyScrollWhenMaximized) 19321 ASPx.PopupUtils.BodyScrollHelper.HideBodyScroll(element.id); 19322 if (this.GetIsCollapsed(index)) 19323 this.DoCollapse(index, false); 19324 var cachedWidth = this.GetClientWindowWidth(index); 19325 var cachedHeight = this.GetClientWindowHeight(index); 19326 var restoredWindowData = this.GetInitRestoredWindowData(index); 19327 var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup(); 19328 var documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup(); 19329 var windowClientTable = this.GetWindowClientTable(index); 19330 var windowClientTableParent = windowClientTable.parentNode; 19331 childStyle = ASPx.GetCurrentStyle(windowClientTableParent); 19332 var left = this.GetMaximizedPosition(element, true); 19333 var top = this.GetMaximizedPosition(element, false); 19334 this.SetWindowPos(index, element, left, top); 19335 this.SetWindowSizeByIndex(index, documentClientWidth, documentClientHeight); 19336 this.SetWindowCachedSize(index, cachedWidth, cachedHeight); 19337 this.SetRestoredWindowData(index, restoredWindowData); 19338 this.SetIsMaximized(index, maximization); 19339 }, 19340 PerformMinimize: function (index, maximization, element) { 19341 var restoredWindowData = this.GetRestoredWindowData(index); 19342 var width = restoredWindowData.width || this.GetMainWindowWidth(index); 19343 var height = restoredWindowData.height || this.GetMainWindowHeight(index); 19344 this.SetIsMaximized(index, maximization); 19345 var left = ASPx.PrepareClientPosForElement(restoredWindowData.left, element, true); 19346 var top = ASPx.PrepareClientPosForElement(restoredWindowData.top, element, false); 19347 this.SetWindowPos(index, element, left, top); 19348 this.SetWindowSizeByIndex(index, width, height); 19349 if (this.GetIsCollapsed(index)) { 19350 this.SetIsCollapsed(index, false); 19351 this.UpdateRestoredWindowSizeLock(); 19352 this.DoCollapse(index, true); 19353 this.UpdateRestoredWindowSizeUnlock(); 19354 } 19355 if (this.hideBodyScrollWhenMaximized) 19356 ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id); 19357 }, 19358 DoMaximize: function(index, maximization) { 19359 if(this.GetIsMaximized(index) == maximization) return; 19360 var element = this.GetWindowElement(index); 19361 if(!element) return; 19362 this.StartMaximization(); 19363 if(maximization) 19364 this.PerformMaximaze(index, maximization, element); 19365 else 19366 this.PerformMinimize(index, maximization, element); 19367 if(this.GetIsPinned(index)) 19368 this.HoldPosition(index, true, element); 19369 this.UpdateHeaderButtonSelected(index, "GetWindowMaximizeButton", maximization); 19370 this.EndMaximization(); 19371 this.UpdateWindowsStateCookie(); 19372 this.CheckHeaderCursor(index); 19373 }, 19374 OnMaximizedChanged: function(index, value) { 19375 if(value) 19376 this.RaiseMaximized(index); 19377 else 19378 this.RaiseRestoredAfterMaximized(index); 19379 this.RaiseAfterResizing(index); 19380 }, 19381 GetInitRestoredWindowData: function(index) { 19382 var restoredWindowData = this.GetRestoredWindowData(index); 19383 restoredWindowData.left = this.GetCurrentLeft(index); 19384 restoredWindowData.top = this.GetCurrentTop(index); 19385 restoredWindowData.width = this.GetMainWindowWidth(index); 19386 restoredWindowData.height = this.GetMainWindowHeight(index); 19387 return restoredWindowData; 19388 }, 19389 getDocumentDimensions: function(index) { 19390 var documentClientWidth = ASPx.PopupUtils.GetDocumentClientWidthForPopup(), 19391 documentClientHeight = ASPx.PopupUtils.GetDocumentClientHeightForPopup(); 19392 return { width: documentClientWidth, height: documentClientHeight }; 19393 }, 19394 UpdateMaximizedWindowSizeOnResize: function(index) {
19395 this.StartUpdateMaximizedWindowSizeOnResize(); 19396 var dimensions = this.getDocumentDimensions(index); 19397 if(this.GetIsCollapsed(index)) dimensions.height = 0; 19398 this.SetWindowSizeByIndex(index, dimensions.width, dimensions.height); 19399 if(this.GetIsCollapsed(index)) { 19400 this.CorrectCollapsedSize(index); 19401 } 19402 window.setTimeout(function() { this.SetMaximizedWindowSizeAfterOnResize(index); }.aspxBind(this), 0); 19403 this.EndUpdateMaximizedWindowSizeOnResize(); 19404 }, 19405 SetMaximizedWindowSizeAfterOnResize: function(index) { 19406 this.StartUpdateMaximizedWindowSizeOnResize(); 19407 var dimensions = this.getDocumentDimensions(index); 19408 windowWidthCurrent = this.GetMainWindowWidth(index, true); 19409 windowHeightCurrent = this.GetMainWindowHeight(index, true); 19410 if(this.GetIsCollapsed(index)) 19411 dimensions.height = 0; 19412 if(dimensions.width != windowWidthCurrent || dimensions.height != windowHeightCurrent) { 19413 this.SetWindowSizeByIndex(index, dimensions.width, dimensions.height); 19414 if(this.GetIsCollapsed(index)) { 19415 this.CorrectCollapsedSize(index); 19416 } 19417 } 19418 this.EndUpdateMaximizedWindowSizeOnResize(); 19419 }, 19420 CorrectCollapsedSize: function(index) { 19421 var contentWrapper = this.GetWindowContentWrapperElement(index); 19422 if(contentWrapper && ASPx.IsElementVisible(contentWrapper)) 19423 contentWrapper.style.display = 'none'; 19424 }, 19425 UpdateHeaderButtonSelected: function(index, methodGetWindowButton, flagSelected) { 19426 if(typeof (ASPx.GetStateController) != "undefined") { 19427 button = this[methodGetWindowButton](index); 19428 var method = flagSelected ? "SelectElementBySrcElement" : "DeselectElementBySrcElement"; 19429 ASPx.GetStateController()[method](button); 19430 } 19431 }, 19432 CheckHeaderCursor: function(index) { 19433 if(!this.allowDragging) return; 19434 var dragElement = this.GetDragElement(index); 19435 if(!dragElement) return; 19436 var styleCursor = dragElement.style.cursor; 19437 var isPinned = this.GetIsPinned(index); 19438 var isMaximized = this.GetIsMaximized(index); 19439 if((isPinned || isMaximized) && styleCursor != "default") 19440 dragElement.style.cursor = "default"; 19441 else if(!isPinned && !isMaximized && styleCursor != "move") 19442 dragElement.style.cursor = "move"; 19443 }, 19444 StartCollapse: function() { 19445 this.collapseExecutingLockCount++; 19446 }, 19447 EndCollapse: function() { 19448 this.collapseExecutingLockCount--; 19449 }, 19450 CollapseExecuting: function() { 19451 return this.collapseExecutingLockCount > 0; 19452 }, 19453 StartMaximization: function() { 19454 this.maximizationExecutingLockCount++; 19455 }, 19456 EndMaximization: function() { 19457 this.maximizationExecutingLockCount--; 19458 }, 19459 MaximizationExecuting: function() { 19460 return this.maximizationExecutingLockCount > 0; 19461 }, 19462 StartUpdateMaximizedWindowSizeOnResize: function() { 19463 this.browserResizingForMaxWindowLockCount++; 19464 }, 19465 EndUpdateMaximizedWindowSizeOnResize: function() { 19466 this.browserResizingForMaxWindowLockCount--; 19467 }, 19468 ResizingForMaxWindowLocked: function() { 19469 return this.browserResizingForMaxWindowLockCount > 0; 19470 }, 19471 UpdateRestoredWindowSizeLock: function() { 19472 this.updateRestoredWindowSizeLockCount++; 19473 }, 19474 UpdateRestoredWindowSizeUnlock: function() { 19475 this.updateRestoredWindowSizeLockCount--; 19476 }, 19477 UpdateRestoredWindowSizeLocked: function() { 19478 return this.updateRestoredWindowSizeLockCount > 0; 19479 }, 19480 UpdateRestoredWindowSize: function(index, width, height) { 19481 if(!this.UpdateRestoredWindowSizeLocked()) { 19482 restoredMinWindowData = this.GetRestoredWindowData(index); 19483 restoredMinWindowData.width = width; 19484 restoredMinWindowData.height = height; 19485 this.SetRestoredWindowData(index, restoredMinWindowData); 19486 } 19487 }, 19488 GetWindowsState: function() { 19489 var state = ASPxClientPopupControlBase.prototype.GetWindowsState.call(this); 19490 for(var i = 0; i < this.GetWindowCountCore() ; i++) { 19491 state += this.GetWindowState(i); 19492 if(i < this.GetWindowCountCore() - 1) state += ";"; 19493 } 19494 return state; 19495 }, 19496 CreateWindows: function(windowsNames) { 19497 for(var i = 0; i < windowsNames.length; i++) { 19498 var window = new ASPxClientPopupWindow(this, i, windowsNames[i]); 19499 this.windows.push(window); 19500 } 19501 }, 19502 RaiseCloseButtonClick: function(index) { 19503 ASPxClientPopupControlBase.prototype.RaiseCloseButtonClick.call(this, index); 19504 }, 19505 RaisePinnedChanged: function(index, pinned) { 19506 var window = index < 0 ? null : this.GetWindow(index); 19507 if(!this.PinnedChanged.IsEmpty()) { 19508 var args = new ASPxClientPopupWindowPinnedChangedEventArgs(window, pinned); 19509 this.PinnedChanged.FireEvent(this, args); 19510 } 19511 }, 19512 RaiseCollapsed: function(index) { 19513 this.RaiseResize(index, ASPxClientPopupControlResizeState.Collapsed); 19514 }, 19515 RaiseExpanded: function(index) { 19516 this.RaiseResize(index, ASPxClientPopupControlResizeState.Expanded); 19517 }, 19518 RaiseMaximized: function(index) { 19519 this.RaiseResize(index, ASPxClientPopupControlResizeState.Maximized); 19520 }, 19521 RaiseRestoredAfterMaximized: function(index) { 19522 this.RaiseResize(index, ASPxClientPopupControlResizeState.RestoredAfterMaximized); 19523 }, 19524 GetContentWidth: function() { 19525 return this.GetWindowContentWidth(null); 19526 }, 19527 GetContentHeight: function() { 19528 return this.GetWindowContentHeight(null); 19529 }, 19530 SetSize: function(width, height) { 19531 ASPxClientPopupControlBase.prototype.SetSize.call(this, width, height); 19532 }, 19533 GetWindowDimension: function(window, isWidth, forceFromCache) { 19534 var index = (window != null) ? window.index : -1; 19535 return this.GetWindowDimensionByIndex(index, isWidth, forceFromCache); 19536 }, 19537 GetWindowContentDimension: function(window, isWidth) { 19538 var index = (window != null) ? window.index : -1, 19539 contentElem = this.GetWindowContentElement(index), 19540 dimensionHolder = contentElem.parentNode, 19541 paddingsHolder = contentElem; 19542 return isWidth ? 19543 (dimensionHolder.offsetWidth - this.getLeftRightBordersAndPaddingsSummaryValue(paddingsHolder)) : 19544 (dimensionHolder.offsetHeight - this.getTopBottomBordersAndPaddingsSummaryValue(paddingsHolder));
19545 }, 19546 GetWindowContentWidth: function(window) { 19547 return this.GetWindowContentDimension(window, true); 19548 }, 19549 GetWindowContentHeight: function(window) { 19550 return this.GetWindowContentDimension(window, false); 19551 }, 19552 GetWindowHeight: function(window) { 19553 return this.GetWindowDimension(window, false); 19554 }, 19555 GetWindowWidth: function(window) { 19556 return this.GetWindowDimension(window, true); 19557 }, 19558 SetWindowSize: function(window, width, height) { 19559 return ASPxClientPopupControlBase.prototype.SetWindowSize.call(this, window, width, height); 19560 }, 19561 GetContentHTML: function() { 19562 return this.GetContentHtml(); 19563 }, 19564 SetContentHTML: function(html) { 19565 this.SetContentHtml(html); 19566 }, 19567 SetWindowPopupElementID: function(window, popupElementId) { 19568 var index = (window != null) ? window.index : -1; 19569 this.SetPopupElementIDByIndex(index, popupElementId); 19570 }, 19571 SetPopupElementID: function(popupElementId) { 19572 this.SetPopupElementIDByIndex(-1, popupElementId); 19573 }, 19574 GetCurrentPopupElementIndex: function() { 19575 return this.GetWindowCurrentPopupElementIndexByWindowIndex(-1); 19576 }, 19577 GetWindowCurrentPopupElementIndex: function(window) { 19578 var index = (window != null) ? window.index : -1; 19579 return this.GetWindowCurrentPopupElementIndexByWindowIndex(index); 19580 }, 19581 GetCurrentPopupElement: function() { 19582 return this.GetWindowCurrentPopupElementByIndex(-1); 19583 }, 19584 GetWindowCurrentPopupElement: function(window) { 19585 var index = (window != null) ? window.index : -1; 19586 return this.GetWindowCurrentPopupElementByIndex(index); 19587 }, 19588 ShowAtPos: function(x, y) { 19589 this.ShowWindowAtPos(null, Math.round(x), Math.round(y)); 19590 }, 19591 BringToFront: function() { 19592 this.BringWindowToFront(null); 19593 }, 19594 IsWindowVisible: function(window) { 19595 return ASPxClientPopupControlBase.prototype.IsWindowVisible.call(this, window); 19596 }, 19597 GetWindow: function(index) { 19598 return ASPxClientPopupControlBase.prototype.GetWindow.call(this, index); 19599 }, 19600 GetWindowByName: function(name) { 19601 for(var i = 0; i < this.windows.length; i++) 19602 if(this.windows[i].name == name) return this.windows[i]; 19603 return null; 19604 }, 19605 GetWindowCount: function() { 19606 return this.GetWindowCountCore(); 19607 }, 19608 ShowWindow: function(window, popupElementIndex) { 19609 var index = (window != null) ? window.index : -1; 19610 this.ShowWindowByIndex(index, popupElementIndex); 19611 }, 19612 ShowWindowAtElement: function(window, htmlElement) { 19613 var index = (window != null) ? window.index : -1; 19614 this.ShowWindowAtElementByIndex(index, htmlElement); 19615 }, 19616 ShowWindowAtElementByID: function(window, id) { 19617 var htmlElement = document.getElementById(id); 19618 this.ShowWindowAtElement(window, htmlElement); 19619 }, 19620 ShowWindowAtPos: function(window, x, y) { 19621 if(!this.isInitialized) 19622 return; 19623 var index = (window != null) ? window.index : -1; 19624 this.DoShowWindowCore(index, x, y, -1, false, true); 19625 }, 19626 BringWindowToFront: function(window) { 19627 var index = (window != null) ? window.index : -1; 19628 var element = this.GetWindowElement(index); 19629 aspxGetPopupControlCollection().ActivateWindowElement(element, undefined, this.GetPopupType(), this.GetDefaultZIndexFromServer(), this.GetPopupControlZIndex()); 19630 }, 19631 HideWindow: function(window) { 19632 ASPxClientPopupControlBase.prototype.HideWindow.call(this, window); 19633 }, 19634 GetWindowContentHTML: function(window) { 19635 return this.GetWindowContentHtml(window); 19636 }, 19637 SetWindowContentHTML: function(window, html) { 19638 this.SetWindowContentHtml(window, html); 19639 }, 19640 GetWindowContentHtml: function(window) { 19641 return ASPxClientPopupControlBase.prototype.GetWindowContentHtml.call(this, window); 19642 }, 19643 SetWindowContentHtml: function(window, html, useAnimation) { 19644 ASPxClientPopupControlBase.prototype.SetWindowContentHtml.call(this, window, html, useAnimation); 19645 }, 19646 AfterSetWindowContentHtml: function(index, contentContainer, useAnimation) { 19647 if(this.GetAdaptiveModalMode(index)) 19648 this.TryAutoUpdatePosition(index); 19649 else if(this.InternalIsWindowVisible(index)) 19650 this.RecalculateWindowSize(index); 19651 ASPxClientPopupControlBase.prototype.AfterSetWindowContentHtml.call(this, index, contentContainer, useAnimation); 19652 this.UpdateScrollbar(index); 19653 }, 19654 UpdateAlignment: function(index) { 19655 if(this.GetIsDragged(index)) return; 19656 var element = this.GetWindowElement(index), 19657 wrapperStyle = getComputedStyle(this.GetModalWrapperElement(index)), 19658 top = ASPxClientPopupControl.AligmentCalculator.CalculateTopMargin(this.modalVerticalAlign, element.offsetHeight, this.GetDefaultVerticalOffset()), 19659 left = ASPxClientPopupControl.AligmentCalculator.CalculateLeftRightMargin(this.modalHorizontalAlign, ModalAlign.WindowLeft, wrapperStyle.paddingLeft), 19660 right = ASPxClientPopupControl.AligmentCalculator.CalculateLeftRightMargin(this.modalHorizontalAlign, ModalAlign.WindowRight, wrapperStyle.paddingRight); 19661 ASPx.SetStyles(element, { 19662 marginTop: top, 19663 marginLeft: left, 19664 marginRight: right 19665 }); 19666 }, 19667 GetOverlayElement: function(index) { 19668 return this.GetWindowModalElement(index); 19669 }, 19670 GetModalWrapperElement: function(index) { 19671 if(!this.adaptivityEnabled) return null; 19672 var windowElement = this.GetWindowElement(index); 19673 return !!windowElement ? windowElement.parentNode : null; 19674 }, 19675 GetWindowHeightWithoutContent: function(index) { 19676 var element = this.GetWindowElement(index), 19677 borderOwner = this.GetWindowBorderOwnerElement(element); 19678 return this.GetHeaderFooterHeightCore(index) + ASPx.GetVerticalBordersWidth(borderOwner); 19679 }, 19680 StretchVertically: function() { 19681 this.StretchVerticallyByIndex(-1, true); 19682 }, 19683 WindowStretchVertically: function(window) { 19684 var index = (window != null) ? window.index : -1; 19685 this.StretchVerticallyByIndex(index, true); 19686 }, 19687 StretchVerticallyByIndex: function(index, value) { 19688 if(this.GetStretchVerticallyByIndex(index) !== value) { 19689 this.SetPropertyValue(index, "stretchVertically", value); 19690 var oldMinHeight = !!this.GetModalMinHeight(index) ? this.GetModalMinHeight(index) : 0; 19691 this.SetPropertyValue(index, "modalMinHeight", value ? "100vh" : this.minHeightBackup); 19692 this.minHeightBackup = oldMinHeight; 19693 this.UpdateHeightDimensions(index); 19694 } 19695 }, 19696 SetAdaptiveMinWidth: function(minWidth) { 19697 this.SetAdaptiveMinWidthByIndex(-1, minWidth); 19698 }, 19699 SetWindowAdaptiveMinWidth: function(window, minWidth) { 19700 var index = (window != null) ? window.index : -1; 19701 this.SetAdaptiveMinWidthByIndex(index, minWidth); 19702 }, 19703 SetAdaptiveMaxWidth: function(maxWidth) { 19704 this.SetAdaptiveMaxWidthByIndex(-1, maxWidth); 19705 }, 19706 SetWindowAdaptiveMaxWidth: function(window, maxWidth) { 19707 var index = (window != null) ? window.index : -1; 19708 this.SetAdaptiveMaxWidthByIndex(index, maxWidth); 19709 }, 19710 SetAdaptiveMinHeight: function(minHeight) { 19711 this.SetAdaptiveMinHeightByIndex(-1, minHeight); 19712 }, 19713 SetWindowAdaptiveMinHeight: function(window, minHeight) { 19714 var index = (window != null) ? window.index : -1; 19715 this.SetAdaptiveMinHeightByIndex(index, minHeight); 19716 }, 19717 SetAdaptiveMaxHeight: function(maxHeight) { 19718 this.SetAdaptiveMaxHeightByIndex(-1, maxHeight); 19719 }, 19720 SetWindowAdaptiveMaxHeight: function(window, maxHeight) { 19721 var index = (window != null) ? window.index : -1; 19722 this.SetAdaptiveMaxHeightByIndex(index, maxHeight); 19723 }, 19724 SetAdaptiveHeightDimension: function(index, propertyName, value) { 19725 value = this.ConvertDimensionValueToString(value); 19726 value = value.indexOf("%") > -1 ? value.replace("%", "vh") : value; 19727 var margins = 0; 19728 if(this.stretchVertically && propertyName === "minHeight") 19729 margins = ASPx.GetTopBottomMargins(this.GetWindowElement(index)); 19730 var contentElement = this.GetWindowContentElement(index); 19731 var iframe = this.GetWindowContentIFrameElement(index); 19732 var additionalHeight = this.GetWindowHeightWithoutContent(index) + margins; 19733 var adaptiveHeight = "calc(" + value + " - " + additionalHeight + "px)"; 19734 contentElement.style[propertyName] = adaptiveHeight; 19735 if (contentElement.style.minHeight) { 19736 if (iframe || this.HasAnyScrollBars(index)) 19737 contentElement.style.height = "1px"; 19738 else if (propertyName === "minHeight") 19739 this.SetContentWrapperAdaptiveHeight(index, adaptiveHeight); 19740 } 19741 if(iframe) { 19742 iframe.style.verticalAlign = "text-bottom"; 19743 iframe.style.height = "100%"; 19744 } 19745 }, 19746 ConvertDimensionValueToString: function(value) { 19747 if(typeof value === "number") 19748 return value + "px"; 19749 if(typeof value === "string") 19750 return value; 19751 }, 19752 CanBeClosedByClickOnElement: function(index, srcElement, posX, id) { 19753 return ASPxClientPopupControlBase.prototype.CanBeClosedByClickOnElement.call(this, index, srcElement, posX, id) && 19754 (!this.GetAdaptiveModalMode(index) || srcElement != this.GetModalWrapperElement(index) || posX < srcElement.offsetWidth - ASPx.GetVerticalScrollBarWidth()); 19755 }, 19756 SetWindowDisplay: function(index, value) { 19757 ASPxClientPopupControlBase.prototype.SetWindowDisplay.call(this, index, value); 19758 if(this.adaptivityEnabled) { 19759 var wrapper = this.GetModalWrapperElement(index); 19760 ASPx.SetElementDisplay(wrapper, value); 19761 } 19762 }, 19763 HaveSpecialDivForAnimation: function() { 19764 return ASPxClientPopupControlBase.prototype.HaveSpecialDivForAnimation.call(this) || this.adaptivityEnabled; 19765 }, 19766 WindowIsModal: function(index) { 19767 return ASPxClientPopupControlBase.prototype.WindowIsModal.call(this, index) || this.GetAdaptiveModalMode(index); 19768 }, 19769 RecalculateWindowSize: function(index) { 19770 var window = this.GetWindowElement(index); 19771 var displayAfterSetSize = window.style.display; 19772 this.SetClientWindowSizeCoreLite(index, this.GetWindowWidthInternal(index), this.GetWindowHeightInternal(index), this.GetIsCollapsed(index)); 19773 window.style.display = displayAfterSetSize; 19774 if(this.HasAnyScrollBars(index)) 19775 this.NormalizeWindowSize(index, this.GetIsMaximized(index)); 19776 }, 19777 GetWindowContentIFrame: function(window) { 19778 return ASPxClientPopupControlBase.prototype.GetWindowContentIFrame.call(this, window); 19779 }, 19780 GetWindowContentUrl: function(window) { 19781 return ASPxClientPopupControlBase.prototype.GetWindowContentUrl.call(this, window); 19782 }, 19783 SetWindowContentUrl: function(window, url) { 19784 ASPxClientPopupControlBase.prototype.SetWindowContentUrl.call(this, window, url); 19785 }, 19786 RefreshDimensionsAfterCreateIframe: function(index) { 19787 if(ASPx.IsElementVisible(this.GetWindowElement(index), true)) { 19788 var windowWidth = this.GetWindowDimensionByIndex(index, true, false); 19789 var windowHeight = this.GetWindowDimensionByIndex(index, false, false); 19790 this.SetClientWindowSizeCoreLite(index, windowWidth, windowHeight); 19791 } 19792 }, 19793 GetPinned: function() { 19794 return this.GetIsPinned(-1); 19795 },
19796 SetPinned: function(value) { 19797 this.SetPinCore(-1, value); 19798 }, 19799 GetWindowPinned: function(window) { 19800 var index = (window != null) ? window.index : -1; 19801 return this.GetIsPinned(index); 19802 }, 19803 SetWindowPinned: function(window, value) { 19804 var index = (window != null) ? window.index : -1; 19805 this.SetPinCore(index, value); 19806 }, 19807 GetMaximized: function() { 19808 return this.GetIsMaximized(-1); 19809 }, 19810 SetMaximized: function(value) { 19811 this.SetMaximizedCore(-1, value); 19812 }, 19813 GetWindowMaximized: function(window) { 19814 var index = (window != null) ? window.index : -1; 19815 return this.GetIsMaximized(index); 19816 }, 19817 SetWindowMaximized: function(window, value) { 19818 var index = (window != null) ? window.index : -1; 19819 this.SetMaximizedCore(index, value); 19820 }, 19821 GetCollapsed: function() { 19822 return this.GetIsCollapsed(-1); 19823 }, 19824 SetCollapsed: function(value) { 19825 this.SetCollapsedCore(-1, value); 19826 }, 19827 GetWindowCollapsed: function(window) { 19828 var index = (window != null) ? window.index : -1; 19829 return this.GetIsCollapsed(index); 19830 }, 19831 SetWindowCollapsed: function(window, value) { 19832 var index = (window != null) ? window.index : -1; 19833 this.SetCollapsedCore(index, value); 19834 }, 19835 RefreshWindowContentUrl: function(window) { 19836 ASPxClientPopupControlBase.prototype.RefreshWindowContentUrl.call(this, window); 19837 }, 19838 SetWindowContentVisible: function(index, visible) { 19839 var contentElement = this.GetWindowContentWrapperElement(index); 19840 if(contentElement) 19841 this.SetWindowPartVisibleCore(contentElement, "DXPopupWindowContentDisplay", visible); 19842 }, 19843 SetWindowFooterVisible: function(index, visible) { 19844 var footerElement = this.GetWindowFooterElement(index); 19845 if(footerElement) 19846 this.SetWindowPartVisibleCore(footerElement, "DXPopupWindowFooterDisplay", visible); 19847 }, 19848 SetWindowPartVisibleCore: function(partElement, displayCacheName, visible) { 19849 var nothingChanged = ASPx.IsElementVisible(partElement) && visible; 19850 if(nothingChanged) return; 19851 if(!(ASPx.IsExists(partElement[displayCacheName]))) 19852 partElement[displayCacheName] = partElement.style.display; 19853 partElement.style.display = visible ? partElement[displayCacheName] : 'none'; 19854 }, 19855 UpdatePosition: function() { 19856 this.UpdatePositionAtElement(this.GetPopupElement(-1, this.GetLastShownPopupElementIndex(-1))); 19857 }, 19858 UpdatePositionAtElement: function(popupElement) { 19859 ASPxClientPopupControlBase.prototype.UpdatePositionAtElement.call(this, popupElement); 19860 }, 19861 UpdateWindowPosition: function(window) { 19862 var index = (window != null) ? window.index : -1; 19863 this.UpdateWindowPositionAtElement(window, this.GetPopupElement(index, this.GetLastShownPopupElementIndex(index))); 19864 }, 19865 UpdateWindowPositionAtElement: function(window, popupElement) { 19866 ASPxClientPopupControlBase.prototype.UpdateWindowPositionAtElement.call(this, window, popupElement); 19867 }, 19868 UpdateWindowPositionInternal: function(index, popupElement) { 19869 if(this.GetAdaptiveModalMode(index)) { 19870 this.TryAutoUpdatePosition(index); 19871 return; 19872 } 19873 if(!ASPxClientPopupControlBase.prototype.UpdateWindowPositionInternal.call(this, index, popupElement)) 19874 this.DoShowWindowAtPos(index, ASPx.InvalidDimension, ASPx.InvalidDimension, this.GetLastShownPopupElementIndex(index), false, false); 19875 }, 19876 UpdateMode: function(index) { 19877 if(!this.adaptivityEnabled) return; 19878 var currentMode = this.GetAdaptiveModalMode(index), 19879 newMode = this.NeedAdaptiveModalMode(index); 19880 if(currentMode != newMode) { 19881 this.SetAdaptiveModalMode(index, newMode); 19882 if(!newMode && !ASPx.Browser.WebKitTouchUI) { 19883 var element = this.GetWindowElement(index); 19884 ASPx.PopupUtils.BodyScrollHelper.RestoreBodyScroll(element.id); 19885 } 19886 this.ShowWindowByIndex(-1); 19887 this.RaiseAdaptiveModeChanged(); 19888 } 19889 }, 19890 RaiseAdaptiveModeChanged: function() { 19891 if(!this.AdaptiveModeChanged.IsEmpty()) { 19892 var args = new ASPxClientEventArgs(); 19893 this.AdaptiveModeChanged.FireEvent(this, args); 19894 } 19895 }, 19896 TryAutoUpdatePosition: function(index) { 19897 this.UpdateMode(index); 19898 ASPxClientPopupControlBase.prototype.TryAutoUpdatePosition.call(this, index); 19899 if(this.GetAdaptiveModalMode(index)) { 19900 this.CorrectScrollPositionOnAndroid(index, false); 19901 this.ResetWebkitScrolling(this.GetModalWrapperElement(index), 100); 19902 this.UpdateHeightDimensions(index); 19903 this.ChangeHeaderFixed(index); 19904 this.UpdateAlignment(index); 19905 this.ChangeFooterFixed(index); 19906 if(this.GetIsDragged(index) && 19907 ASPxClientPopupControl.WindowResizeHelper.AdjustModalOnWindowResize(this.GetWindowElement(index))) 19908 this.SetIsDragged(index, false); 19909 } 19910 if(this.GetIsMaximized(index)) { 19911 this.CorrectScrollPositionOnAndroid(index, true); 19912 this.UpdateMaximizedWindowSizeOnResize(index); 19913 } 19914 }, 19915 CorrectScrollPositionOnAndroid: function(index, checkElementIsInPopup) { 19916 if(ASPx.Browser.AndroidMobilePlatform) { 19917 var activeElement = this.GetActiveElementIncludingIframes(); 19918 if(activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA") && 19919 (!checkElementIsInPopup || this.GetWindowElement(index).contains(activeElement))) 19920 window.setTimeout(function() { 19921 if(activeElement.scrollIntoViewIfNeeded) 19922 activeElement.scrollIntoViewIfNeeded(); 19923 }, 100); 19924 } 19925 }, 19926 GetActiveElementIncludingIframes: function(document) { 19927 document = document || window.document; 19928 if(document.body === document.activeElement || document.activeElement.tagName === "IFRAME") { 19929 var iframes = document.getElementsByTagName("iframe"); 19930 for(var i = 0; i < iframes.length; i++) { 19931 var iFrameDocument = null; 19932 try { 19933 iFrameDocument = iframes[i].contentWindow.document; 19934 } 19935 catch(e) { } 19936 if(iFrameDocument !== null) { 19937 var focused = this.GetActiveElementIncludingIframes(iframes[i].contentWindow.document); 19938 if(focused !== false) { 19939 return focused; 19940 } 19941 } 19942 } 19943 } else 19944 return document.activeElement; 19945 return false; 19946 }, 19947 OnModalWrapperScroll: function(e, index) { 19948 if(!this.GetAdaptiveModalMode(index) || this.IsWrapperScrollEventLocked()) return; 19949 this.ChangeHeaderFixed(index); 19950 this.ChangeFooterFixed(index); 19951 }, 19952 OnModalWrapperTouchStart: function(e) { 19953 this.touchStartY = e.touches[0].clientY; 19954 }, 19955 OnModalWrapperTouchMove: function (e, index) { 19956 if(e.touches.length > 1) 19957 return; 19958 var preventScroll = this.RequirePreventScrollForAdaptiveMode(e, index); 19959 if(preventScroll) 19960 ASPx.Evt.PreventEvent(e); 19961 this.touchStartY = e.touches[0].clientY; 19962 }, 19963 RequirePreventScrollForAdaptiveMode: function(e, index) { 19964 var modalWrapper = this.GetModalWrapperElement(index), 19965 zoom = modalWrapper.offsetWidth / window.innerWidth, 19966 activeElement = document.activeElement, 19967 activeTyping = !!activeElement && (activeElement["type"] === "text" || activeElement["type"] === "textarea"); 19968 if(zoom !== 1 || activeTyping) 19969 return false; 19970 var currentY = e.touches[0].clientY, 19971 preventScroll = currentY > this.touchStartY && modalWrapper.scrollTop === 0 || 19972 currentY < this.touchStartY && modalWrapper.scrollTop + modalWrapper.clientHeight >= modalWrapper.scrollHeight; 19973 if(!preventScroll) 19974 return false; 19975 var targetElement = ASPx.Evt.GetEventSource(e), 19976 contentWrapper = this.GetWindowContentWrapperElement(index); 19977 while(targetElement && targetElement !== contentWrapper && targetElement.tagName !== 'BODY') { 19978 if(this.ElementHasScroll(targetElement)) 19979 return false; 19980 targetElement = targetElement.parentNode; 19981 } 19982 return true; 19983 }, 19984 ElementHasScroll: function(elem) { 19985 var style = window.getComputedStyle(elem); 19986 return ["overflow", "overflow-x", "overflow-y"].some(function(prop) { 19987 return ASPx.Data.ArrayContains(["scroll","auto"], style[prop]); 19988 }); 19989 }, 19990 GetFixedHeaderMaxBottom: function(index) { 19991 var contentWrapper = this.GetWindowContentWrapperElement(index); 19992 return ASPx.GetAbsolutePositionY(contentWrapper) + contentWrapper.offsetHeight; 19993 }, 19994 GetFixedFooterMaxTop: function(index) { 19995 var header = this.GetWindowHeaderElement(index), 19996 contentWrapper = this.GetWindowContentWrapperElement(index), 19997 headerBottom = !!header ? ASPx.GetAbsolutePositionY(header) + header.offsetHeight : ASPx.GetAbsolutePositionY(contentWrapper); 19998 return window.innerHeight - headerBottom; 19999 }, 20000 ChangeHeaderFixed: function(index) { 20001 if(!this.GetFixedHeader(index)) return; 20002 var element = this.GetWindowElement(index), 20003 modalWrapper = this.GetModalWrapperElement(index), 20004 isHeaderPartiallyHidden = modalWrapper.scrollTop > element.offsetTop, 20005 maxBottom = isHeaderPartiallyHidden ? this.GetFixedHeaderMaxBottom(index) : 0; 20006 this.FixateHeader(index, isHeaderPartiallyHidden, maxBottom); 20007 }, 20008 ChangeFooterFixed: function(index) { 20009 if(!this.GetFixedFooter(index) || !this.GetWindowFooterElement(index)) return; 20010 var element = this.GetWindowElement(index), 20011 modalWrapper = this.GetModalWrapperElement(index), 20012 isFooterPartiallyHidden = element.offsetTop + element.offsetHeight - modalWrapper.scrollTop > window.innerHeight, 20013 maxTop = isFooterPartiallyHidden ? this.GetFixedFooterMaxTop(index) : 0; 20014 this.FixateFooter(index, isFooterPartiallyHidden, maxTop); 20015 }, 20016 ChangeHeaderFooterFixed: function(index, elementToFix, isFixed, fixedClassName, offsetName, maxPos) { 20017 if(!elementToFix) return; 20018 var element = this.GetWindowElement(index), 20019 contentWrapper = this.GetWindowContentWrapperElement(index), 20020 changeClassNameFunc = isFixed ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement, 20021 elementToFixHeight = elementToFix.offsetHeight; 20022 if(isFixed) { 20023 var borderOwner = this.GetWindowBorderOwnerElement(element), 20024 width = ASPx.GetClearClientWidth(borderOwner); 20025 ASPx.SetOffsetWidth(elementToFix, width); 20026 elementToFix.style[offsetName] = maxPos < elementToFixHeight ? maxPos - elementToFixHeight + "px" : ""; 20027 } else 20028 elementToFix.style.width = ""; 20029 contentWrapper.style["margin-" + offsetName] = isFixed ? elementToFixHeight + "px" : 0; 20030 changeClassNameFunc(elementToFix, fixedClassName); 20031 }, 20032 FixateFooter: function(index, isFixed, maxTop) { 20033 this.ChangeHeaderFooterFixed(index, this.GetWindowFooterElement(index), isFixed, "dxFixedFooter", "bottom", maxTop); 20034 }, 20035 FixateHeader: function(index, isFixed, maxBottom) { 20036 this.ChangeHeaderFooterFixed(index, this.GetWindowHeaderElement(index), isFixed, "dxFixedHeader", "top", maxBottom); 20037 }, 20038 LockWrapperScrollEvent: function() { 20039 this.wrapperScrollEventLocked = true; 20040 }, 20041 UnlockWrapperScrollEventEvent: function() { 20042 this.wrapperScrollEventLocked = false; 20043 }, 20044 IsWrapperScrollEventLocked: function() { 20045 return this.wrapperScrollEventLocked; 20046 }, 20047 ResetScroll: function(index) { 20048 if(!this.GetAdaptiveModalMode(index)) return; 20049 this.LockWrapperScrollEvent(); 20050 this.GetModalWrapperElement(index).scrollTop = 0; 20051 this.UnlockWrapperScrollEventEvent(); 20052 }, 20053 AdjustModalElementBounds: function(element) { 20054 if(!ASPx.IsExistsElement(element)) return; 20055 ASPx.SetStyles(element, {
20056 left: 0, 20057 top: 0, 20058 right: 0, 20059 bottom: 0, 20060 width: "", 20061 height: "" 20062 }); 20063 }, 20064 RefreshPopupElementConnection: function() { 20065 ASPxClientPopupControlBase.prototype.RefreshPopupElementConnection.call(this); 20066 } 20067}); 20068ASPxClientPopupControl.AligmentCalculator = (function() { 20069 function CalculateTopMargin(verticalAlign, elementHeight, defaultOffset) { 20070 if(verticalAlign === ModalAlign.WindowTop) 20071 return ""; 20072 if(elementHeight < window.innerHeight) { 20073 var freeSpace = window.innerHeight - elementHeight; 20074 switch(verticalAlign) { 20075 case ModalAlign.WindowCenter: 20076 return freeSpace / 2; 20077 case ModalAlign.WindowBottom: 20078 return freeSpace - defaultOffset; 20079 } 20080 } 20081 return ""; 20082 } 20083 function CalculateLeftRightMargin(horizontalAlign, forAligmenment, wrapperPadding) { 20084 if(horizontalAlign === forAligmenment) { 20085 if(ASPx.PxToInt(wrapperPadding) !== 0) 20086 return 0; 20087 return 10; 20088 } 20089 return ""; 20090 } 20091 return { 20092 CalculateTopMargin: CalculateTopMargin, 20093 CalculateLeftRightMargin: CalculateLeftRightMargin 20094 }; 20095})(); 20096ASPxClientPopupControl.Animation = (function() { 20097 function GetVerticalDirection(verticalAlign, horizontalAlign) { 20098 switch(verticalAlign) { 20099 case ModalAlign.WindowTop: 20100 return -1; 20101 case ModalAlign.WindowCenter: 20102 if(horizontalAlign === ModalAlign.WindowCenter) 20103 return -1; 20104 return 0; 20105 case ModalAlign.WindowBottom: 20106 return 1; 20107 } 20108 } 20109 function GetHorizontalDirection(horizontalAlign) { 20110 switch(horizontalAlign) { 20111 case ModalAlign.WindowLeft: 20112 return -1; 20113 case ModalAlign.WindowCenter: 20114 return 0; 20115 case ModalAlign.WindowRight: 20116 return 1; 20117 } 20118 } 20119 function NeedFadeAnimation(horizontalAlign, verticalAlign, animationType, popupHorizontalAlign, popupVerticalAlign, adaptiveModalMode) { 20120 if(animationType === ASPxClientPopupControlBase.AnimationType.Auto) { 20121 if(adaptiveModalMode) 20122 return horizontalAlign === ModalAlign.WindowCenter && verticalAlign === ModalAlign.WindowCenter; 20123 else 20124 return popupHorizontalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator && popupVerticalAlign === ASPx.PopupUtils.WindowCenterAlignIndicator; 20125 } 20126 return false; 20127 } 20128 return { 20129 GetVerticalDirection: GetVerticalDirection, 20130 GetHorizontalDirection: GetHorizontalDirection, 20131 NeedFadeAnimation: NeedFadeAnimation 20132 }; 20133})(); 20134ASPxClientPopupControl.WindowResizeHelper = (function() { 20135 var previousInnerWidth = 0, 20136 previousMargin = 0; 20137 function AdjustModalOnWindowResize(element) { 20138 var offsetLeft = element.offsetLeft, 20139 offsetWidth = element.offsetWidth, 20140 windowWidth = window.innerWidth, 20141 expectedLeft = windowWidth / 2 - offsetWidth / 2, 20142 toTheRightOfCenter = offsetLeft > expectedLeft, 20143 dw = windowWidth - previousInnerWidth, 20144 computedStyle = getComputedStyle(element), 20145 left = ASPx.PxToFloat(computedStyle.left), 20146 currentMargin = ASPx.PxToFloat(computedStyle.marginLeft), 20147 dm = currentMargin - previousMargin, 20148 newLeft = left - dm; 20149 if(toTheRightOfCenter) 20150 newLeft += dw; 20151 ASPx.SetStyles(element, { left: newLeft + "px" }); 20152 if(Math.abs(offsetLeft - expectedLeft) <= 10 || dw < 0 && toTheRightOfCenter !== (element.offsetLeft > expectedLeft)) { 20153 ASPx.SetStyles(element, { left: "" }); 20154 ASPx.Attr.RestoreStyleAttribute(element, "top"); 20155 ASPx.Attr.RestoreStyleAttribute(element, "margin-top"); 20156 return true; 20157 } 20158 previousMargin = currentMargin; 20159 previousInnerWidth = windowWidth; 20160 return false; 20161 } 20162 function Initialize(element) { 20163 previousInnerWidth = window.innerWidth; 20164 ASPx.Attr.ChangeStyleAttribute(element, "top", element.offsetTop + "px"); 20165 ASPx.Attr.ChangeStyleAttribute(element, "margin-top", "0"); 20166 previousMargin = ASPx.PxToFloat(getComputedStyle(element).marginLeft); 20167 } 20168 return { 20169 Initialize: Initialize, 20170 AdjustModalOnWindowResize: AdjustModalOnWindowResize 20171 }; 20172})(); 20173ASPxClientPopupControl.Cast = ASPxClientControl.Cast; 20174ASPxClientPopupControl.GetPopupControlCollection = function() { 20175 return aspxGetPopupControlCollection(); 20176}; 20177var ASPxClientPopupWindow = ASPx.CreateClass(null, { 20178 constructor: function(popupControl, index, name) { 20179 this.popupControl = popupControl; 20180 this.index = index; 20181 this.name = name; 20182 }, 20183 GetHeaderImageUrl: function() { 20184 return this.popupControl.GetWindowHeaderImageUrl(this.index); 20185 }, 20186 SetHeaderImageUrl: function(value) { 20187 this.popupControl.SetWindowHeaderImageUrl(this.index, value); 20188 }, 20189 GetFooterImageUrl: function() { 20190 return this.popupControl.GetWindowFooterImageUrl(this.index); 20191 }, 20192 SetFooterImageUrl: function(value) { 20193 this.popupControl.SetWindowFooterImageUrl(this.index, value); 20194 }, 20195 GetHeaderNavigateUrl: function() { 20196 return this.popupControl.GetWindowHeaderNavigateUrl(this.index); 20197 }, 20198 SetHeaderNavigateUrl: function(value) { 20199 this.popupControl.SetWindowHeaderNavigateUrl(this.index, value); 20200 }, 20201 GetFooterNavigateUrl: function() { 20202 return this.popupControl.GetWindowFooterNavigateUrl(this.index); 20203 }, 20204 SetFooterNavigateUrl: function(value) { 20205 this.popupControl.SetWindowFooterNavigateUrl(this.index, value); 20206 }, 20207 GetHeaderText: function() { 20208 return this.popupControl.GetWindowHeaderText(this.index); 20209 }, 20210 SetHeaderText: function(value) { 20211 this.popupControl.SetWindowHeaderText(this.index, value); 20212 }, 20213 GetFooterText: function() { 20214 return this.popupControl.GetWindowFooterText(this.index); 20215 }, 20216 SetFooterText: function(value) { 20217 this.popupControl.SetWindowFooterText(this.index, value); 20218 } 20219}); 20220var ASPxClientPopupWindowEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 20221 constructor: function(window) { 20222 this.constructor.prototype.constructor.call(this); 20223 this.window = window; 20224 } 20225}); 20226var ASPxClientPopupWindowCancelEventArgs = ASPx.CreateClass(ASPxClientCancelEventArgs, { 20227 constructor: function(window, closeReason) { 20228 this.constructor.prototype.constructor.call(this); 20229 this.window = window; 20230 this.closeReason = closeReason; 20231 } 20232}); 20233var ASPxClientPopupWindowCloseUpEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, { 20234 constructor: function(window, closeReason) { 20235 this.constructor.prototype.constructor.call(this, window); 20236 this.closeReason = closeReason; 20237 } 20238}); 20239var ASPxClientPopupWindowResizeEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, { 20240 constructor: function(window, resizeState) { 20241 this.constructor.prototype.constructor.call(this, window); 20242 this.resizeState = resizeState; 20243 } 20244}); 20245var ASPxClientPopupWindowPinnedChangedEventArgs = ASPx.CreateClass(ASPxClientPopupWindowEventArgs, { 20246 constructor: function(window, pinned) { 20247 this.constructor.prototype.constructor.call(this, window); 20248 this.pinned = pinned; 20249 } 20250}); 20251var ASPxClientPopupControlCollection = ASPx.CreateClass(ASPxClientControlCollection, { 20252 constructor: function() { 20253 this.constructor.prototype.constructor.call(this); 20254 this.draggingControl = null; 20255 this.draggingWindowIndex = -1; 20256 this.gragXOffset = 0; 20257 this.gragYOffset = 0; 20258 this.visibleModalElements = []; 20259 this.visiblePopupWindowIds = []; 20260 this.windowResizeByBodyScrollVisibilityChangingLockCount = 0; 20261 this.savedBodyWidth = 0; 20262 this.savedBodyHeight = 0; 20263 this.overControl = null; 20264 this.overWindowIndex = -1; 20265 this.overXPos = ASPx.InvalidPosition; 20266 this.overYPos = ASPx.InvalidPosition; 20267 this.appearTimerID = -1; 20268 this.disappearTimerID = -1; 20269 this.scrollEventLockCount = 0; 20270 this.currentActiveWindowElement = null; 20271 this.resizeControl = null; 20272 this.resizeIndex = -2; 20273 this.resizeCursor = ""; 20274 this.resizePanel = null; 20275 this.selectBanned = false; 20276 this.pcWindowsAreRestrictedByDocumentWindow = true; 20277 this.docScrollLeft = -1; 20278 this.docScrollTop = -1; 20279 this.EnsureSaveScrollState(); 20280 }, 20281 GetCollectionType: function(){ 20282 return "Popup"; 20283 }, 20284 Remove: function(popupControl) { 20285 for(var i = this.visibleModalElements.length - 1; i >= 0; i--) { 20286 var modalElement = this.visibleModalElements[i]; 20287 if(modalElement && modalElement.DXModalPopupControl === popupControl) 20288 this.UnregisterVisibleModalElement(modalElement); 20289 } 20290 for(var j = this.visiblePopupWindowIds.length - 1; j >= 0; j--) { 20291 var id = this.visiblePopupWindowIds[j];
20292 if(!ASPx.IsExists(id)) continue; 20293 var popupWindow = this.GetPopupWindowFromID(id); 20294 if(popupWindow.popupControl === popupControl) { 20295 var windowElement = popupControl.GetWindowElement(popupWindow.windowIndex); 20296 if(windowElement) 20297 this.UnregisterVisibleWindow(windowElement); 20298 else 20299 ASPx.Data.ArrayRemove(this.visiblePopupWindowIds, id); 20300 } 20301 } 20302 ASPxClientControlCollection.prototype.Remove.call(this, popupControl); 20303 }, 20304 EnsureSaveScrollState: function() { 20305 if(ASPx.documentLoaded && this.docScrollLeft < 0 && this.docScrollTop < 0) 20306 this.SaveScrollState(); 20307 }, 20308 GetPopupWindowFromID: function(id) { 20309 var pos = id.lastIndexOf(ASPx.PCWIdSuffix); 20310 var name = id.substring(0, pos); 20311 var index = id.substr(pos + ASPx.PCWIdSuffix.length); 20312 var popupControl = aspxGetPopupControlCollection().Get(name); 20313 return { popupControl: popupControl, windowIndex: index }; 20314 }, 20315 DoHideAllWindows: function(srcElement, excptId, applyToAll, closeReason, posX) { 20316 for(var i = this.visiblePopupWindowIds.length - 1; i >= 0; i--) { 20317 var id = this.visiblePopupWindowIds[i]; 20318 if(id == excptId) continue; 20319 var popupWindow = this.GetPopupWindowFromID(id), 20320 windowIndex = popupWindow.windowIndex, 20321 popupControl = popupWindow.popupControl; 20322 if(!popupControl.CanBeClosedByClickOnElement(windowIndex, srcElement, posX, id)) continue; 20323 if(popupControl != null) { 20324 var popupWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(popupControl.GetWindowElement(windowIndex)); 20325 var isPopupHigherSrcElement = ASPx.PopupUtils.IsHigher(popupWindowZIndexArray, ASPx.PopupUtils.GetElementZIndexArray(srcElement)) || !popupControl.HasDefaultWindow(); 20326 var windowCloseAction = popupControl.GetWindowCloseAction(windowIndex); 20327 if ((windowCloseAction != "CloseButton" && windowCloseAction != "None") && isPopupHigherSrcElement || applyToAll) 20328 popupControl.DoHideWindow(parseInt(windowIndex), false, closeReason); 20329 } 20330 } 20331 }, 20332 DoShowAtCurrentPos: function(name, index, popupElementIndex, evtClone) { 20333 var pc = this.Get(name); 20334 if(pc != null && !pc.InternalIsWindowVisible(index)) 20335 pc.DoShowWindowCore(index, this.overXPos, this.overYPos, popupElementIndex, true, true, evtClone, ASPxClientPopupControlCloseReason.MouseOut); 20336 }, 20337 WindowZIndexWasInitialized: function(zIndex, pcZIndex) { 20338 return pcZIndex <= zIndex; 20339 }, 20340 ActivateWindowElement: function(element, evt, popupType, defZIndex, zIndex) { 20341 var maxZIndex = this.GetMaxZIndex(popupType, defZIndex), 20342 topZIndex = this.WindowZIndexWasInitialized(maxZIndex, zIndex) ? parseInt(maxZIndex) : zIndex; 20343 if(this.WindowZIndexWasInitialized(element.style.zIndex, zIndex) && element.style.zIndex != topZIndex) { 20344 this.DeleteWindowFromZIndexOrder(element); 20345 } 20346 if(!this.WindowZIndexWasInitialized(element.style.zIndex, zIndex)) 20347 topZIndex += 2; 20348 var popupWindow = this.GetPopupWindowFromID(element.id); 20349 popupWindow.popupControl.SetWindowElementZIndex(element, topZIndex); 20350 var pcWElementEventSource = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupWindowElement); 20351 if(!evt || (evt && pcWElementEventSource == element)) { 20352 if(this.GetCurrentActiveWindowElement() != element) { 20353 this.RefreshTabIndexes(false); 20354 this.SaveCurrentActiveWindowElement(element); 20355 } 20356 } 20357 }, 20358 RefreshTabIndexes: function(forceRecalculate) { 20359 var topModalWindow = this.GetTopModalWindow(); 20360 if(topModalWindow != null || forceRecalculate) { 20361 var topModalWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(topModalWindow); 20362 this.CalculateTabIndexes(topModalWindowZIndexArray); 20363 } 20364 }, 20365 ElementHasTabIndex: function(element) { 20366 return ASPx.IsExists(ASPx.Attr.GetAttribute(element, "tabindex")); 20367 }, 20368 IsElementCanBeActive: function(element) { 20369 return element.tagName === "INPUT" || element.tagName === "A" || 20370 element.tagName === "BUTTON" || element.tagName === "TEXTAREA" || 20371 element.tagName === "SELECT" || this.ElementHasTabIndex(element); 20372 }, 20373 GetCanBeActiveElements: function() { 20374 var elements = document.getElementsByTagName("*"), 20375 canBeActiveElements = []; 20376 for(var i = 0; i < elements.length; i++) { 20377 if(this.IsElementCanBeActive(elements[i])) 20378 canBeActiveElements.push(elements[i]); 20379 } 20380 return canBeActiveElements; 20381 }, 20382 GetEditableDivs: function(){
20383 if(document.querySelectorAll) 20384 return document.querySelectorAll("div[contenteditable=true]"); 20385 var editableDivs = [ ]; 20386 var allDivs = document.getElementsByTagName("DIV"); 20387 for(var i = 0; i < allDivs.length; i++){ 20388 var div = allDivs[i]; 20389 if(div.getAttribute("contenteditable") == 'true') 20390 editableDivs.push(div); 20391 } 20392 return editableDivs; 20393 }, 20394 CalculateTabIndexes: function(topModalWindowZIndexArray) { 20395 var elements = this.GetCanBeActiveElements(); 20396 for(var i = 0; i < elements.length; i++) { 20397 var currentElementZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(elements[i]), 20398 manager = ASPx.ControlTabIndexManager.getInstance(), 20399 tabIndexManagerGroupId = "pcCollection"; 20400 if(ASPx.PopupUtils.IsHigher(currentElementZIndexArray, topModalWindowZIndexArray)) 20401 manager.restoreTabIndexAttribute(elements[i], tabIndexManagerGroupId); 20402 else 20403 manager.changeTabIndexAttribute(elements[i], tabIndexManagerGroupId); 20404 } 20405 }, 20406 PopupWindowIsModalByVisibleIndex: function(visiblePopupWindowIndex) { 20407 return this.PopupWindowIsModalByID(this.visiblePopupWindowIds[visiblePopupWindowIndex]); 20408 }, 20409 PopupWindowIsModalByID: function(windowElementID) { 20410 var popupWindow = this.GetPopupWindowFromID(windowElementID); 20411 return popupWindow.popupControl.WindowIsModal(popupWindow.windowIndex); 20412 }, 20413 SaveCurrentActiveWindowElement: function(windowElement) { 20414 this.currentActiveWindowElement = windowElement; 20415 }, 20416 SkipCurrentActiveWindowElement: function(element) { 20417 if(element == this.GetCurrentActiveWindowElement()) 20418 this.SaveCurrentActiveWindowElement(null); 20419 }, 20420 GetCurrentActiveWindowElement: function() { 20421 return this.currentActiveWindowElement; 20422 }, 20423 GetMaxZIndex: function (type, defaultZIndex) { 20424 var maxZIndex = defaultZIndex; 20425 for(var i = 0; i < this.visiblePopupWindowIds.length; i++) { 20426 var id = this.visiblePopupWindowIds[i]; 20427 if(type !== undefined && this.GetPopupWindowFromID(id).popupControl.GetPopupType() !== type) 20428 continue; 20429 var currentWindow = ASPx.GetElementById(id); 20430 if(!!currentWindow && ASPx.IsElementVisible(currentWindow) && currentWindow.style && currentWindow.style.zIndex > maxZIndex) 20431 maxZIndex = currentWindow.style.zIndex; 20432 } 20433 return maxZIndex; 20434 }, 20435 GetTopModalWindow: function() { 20436 return this.GetTopWindow(true); 20437 }, 20438 GetTopWindow: function(onlyModal) { 20439 var topWindow = null; 20440 var topWindowZIndexArray = null; 20441 for(var i = 0; i < this.visiblePopupWindowIds.length; i++) { 20442 var currentWindow = ASPx.GetElementById(this.visiblePopupWindowIds[i]); 20443 if(onlyModal && !this.PopupWindowIsModalByVisibleIndex(i)) 20444 continue; 20445 if(ASPx.IsElementVisible(currentWindow)) { 20446 var currentWindowZIndexArray = ASPx.PopupUtils.GetElementZIndexArray(currentWindow); 20447 if(topWindow == null || ASPx.PopupUtils.IsHigher(currentWindowZIndexArray, topWindowZIndexArray)) { 20448 topWindow = currentWindow; 20449 topWindowZIndexArray = currentWindowZIndexArray; 20450 } 20451 } 20452 } 20453 return topWindow; 20454 }, 20455 DeleteWindowFromZIndexOrder: function(element) { 20456 for(var i = this.visiblePopupWindowIds.length - 1; i >= 0; i--) { 20457 var windowElement = ASPx.GetElementById(this.visiblePopupWindowIds[i]); 20458 if(!windowElement) 20459 ASPx.Data.ArrayRemoveAt(this.visiblePopupWindowIds, i); 20460 else if(windowElement.style.zIndex > element.style.zIndex) { 20461 var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]); 20462 popupWindow.popupControl.SetWindowElementZIndex(windowElement, windowElement.style.zIndex - 2); 20463 } 20464 } 20465 }, 20466 AdjustModalElementsBounds: function() { 20467 for(var i = 0; i < this.visibleModalElements.length; i++) 20468 this.visibleModalElements[i].DXModalPopupControl.AdjustModalElementBounds(this.visibleModalElements[i]); 20469 }, 20470 ClearAppearTimer: function() { 20471 this.appearTimerID = ASPx.Timer.ClearTimer(this.appearTimerID); 20472 }, 20473 ClearDisappearTimer: function() { 20474 this.disappearTimerID = ASPx.Timer.ClearTimer(this.disappearTimerID); 20475 }, 20476 IsAppearTimerActive: function() { 20477 return this.appearTimerID > -1; 20478 }, 20479 IsDisappearTimerActive: function() { 20480 return this.disappearTimerID > -1; 20481 }, 20482 SetAppearTimer: function(name, index, popupElementIndex, timeout, evt) { 20483 var evtClone = ASPx.CloneObject(evt); 20484 this.appearTimerID = window.setTimeout(function() { 20485 aspxGetPopupControlCollection().DoShowAtCurrentPos(name, index, popupElementIndex, evtClone); 20486 }, timeout); 20487 }, 20488 SetDisappearTimer: function(name, index, timeout) { 20489 this.disappearTimerID = window.setTimeout(function() { 20490 aspxGetPopupControlCollection().OnPWDisappearTimer(name, index); 20491 }, timeout); 20492 }, 20493 GetDocScrollDifference: function() { 20494 return new _aspxScrollDifference(ASPx.GetDocumentScrollLeft() - this.docScrollLeft, ASPx.GetDocumentScrollTop() - this.docScrollTop); 20495 }, 20496 IsDocScrolled: function(scroll) {
20497 return scroll.horizontal != 0 || scroll.vertical != 0; 20498 }, 20499 SaveScrollState: function() { 20500 this.docScrollLeft = ASPx.GetDocumentScrollLeft(); 20501 this.docScrollTop = ASPx.GetDocumentScrollTop(); 20502 }, 20503 InitDragObject: function(control, index, x, y, xClientCorrection, yClientCorrection) { 20504 this.draggingControl = control; 20505 this.draggingWindowIndex = index; 20506 this.gragXOffset = x; 20507 this.gragYOffset = y; 20508 this.xClientCorrection = xClientCorrection; 20509 this.yClientCorrection = yClientCorrection; 20510 this.SetDocumentSelectionBan(true); 20511 }, 20512 InitOverObject: function(control, index, evt) { 20513 this.overControl = control; 20514 this.overWindowIndex = index; 20515 if(evt) 20516 this.SaveCurrentMouseOverPos(evt); 20517 }, 20518 InitResizeObject: function(control, index, cursor, resizePanel) { 20519 this.resizeControl = control; 20520 this.resizeIndex = index; 20521 this.resizeCursor = cursor; 20522 this.resizePanel = resizePanel; 20523 this.SetDocumentSelectionBan(true); 20524 }, 20525 SetDocumentSelectionBan: function(value) { 20526 if(this.selectBanned === value) 20527 return; 20528 this.selectBanned = value; 20529 if(ASPx.Browser.WebKitFamily) { 20530 if(value) { 20531 if(!this.webkitUserSelectBackup && document.body.style.webkitUserSelect) 20532 this.webkitUserSelectBackup = document.body.style.webkitUserSelect; 20533 document.body.style.webkitUserSelect = "none"; 20534 } else { 20535 if(this.webkitUserSelectBackup) { 20536 document.body.style.webkitUserSelect = this.webkitUserSelectBackup; 20537 delete this.webkitUserSelectBackup; 20538 } else 20539 document.body.style.webkitUserSelect = "auto"; 20540 } 20541 } 20542 }, 20543 IsResizeInint: function() { 20544 return this.resizeControl != null; 20545 }, 20546 ClearDragObject: function() { 20547 this.draggingControl = null; 20548 this.draggingWindowIndex = -1; 20549 this.gragXOffset = 0; 20550 this.gragYOffset = 0; 20551 this.SetDocumentSelectionBan(this.resizeControl != null); 20552 }, 20553 ClearResizeObject: function() { 20554 this.resizeControl = null; 20555 this.resizeIndex = -2; 20556 this.resizeCursor = ""; 20557 this.SetDocumentSelectionBan(this.draggingControl != null); 20558 this.resizePanel.parentNode.removeChild(this.resizePanel); 20559 }, 20560 Drag: function(evt) { 20561 if(ASPx.tableColumnResizing || ASPx.currentDragHelper || !ASPx.Evt.IsLeftButtonPressed(evt)) return; 20562 var x = ASPx.Evt.GetEventX(evt); 20563 var y = ASPx.Evt.GetEventY(evt); 20564 if(this.pcWindowsAreRestrictedByDocumentWindow && ASPx.PopupUtils.CoordinatesInDocumentRect(x, y)) { 20565 x += this.gragXOffset; 20566 y += this.gragYOffset; 20567 this.draggingControl.OnDrag(this.draggingWindowIndex, x, y, this.xClientCorrection, this.yClientCorrection, evt); 20568 if(ASPx.Browser.WebKitTouchUI) 20569 ASPx.Evt.PreventEvent(evt); 20570 } 20571 }, 20572 DragStop: function() { 20573 this.draggingControl.OnDragStop(this.draggingWindowIndex); 20574 this.ClearDragObject(); 20575 }, 20576 ResizeStop: function(evt) { 20577 this.resizeControl.OnResizeStop(evt, this.resizeIndex, this.resizeCursor, this.resizePanel); 20578 aspxGetPopupControlCollection().ClearResizeObject(); 20579 }, 20580 setIframesMouseMoveEnabled: function(enabled) { 20581 for(var i = 0; i < this.visiblePopupWindowIds.length; i++) { 20582 var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]); 20583 var popupControl = popupWindow.popupControl; 20584 if(popupControl) { 20585 var iframe = popupControl.GetWindowContentIFrameElement(popupWindow.windowIndex); 20586 if(iframe) 20587 iframe.style.pointerEvents = enabled ? "" : "none"; 20588 } 20589 } 20590 }, 20591 OnPWMouseMove: function(evt, name, index) { 20592 if(this.draggingControl == null && 20593 this.overControl == null && 20594 this.resizeControl == null) { 20595 var pc = aspxGetPopupControlCollection().Get(name); 20596 if(pc != null) pc.OnMouseMove(evt, index); 20597 } 20598 }, 20599 OnPWMouseOver: function(evt) { 20600 if(!this.overControl || this.draggingControl) return; 20601 if(this.IsOverPopupWindow(evt)) 20602 this.ClearDisappearTimer(); 20603 }, 20604 IsOverPopupWindow: function(evt) { 20605 return ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlOverElement) != null; 20606 }, 20607 OnDocumentKeyDown: function(evt) { 20608 var windowElement = this.GetTopWindow(false); 20609 if(windowElement) { 20610 var window = this.GetPopupWindowFromID(windowElement.id); 20611 if(window.popupControl); 20612 window.popupControl.OnDocumentKeyDown(evt, windowElement); 20613 } 20614 }, 20615 OnDocumentMouseDown: function(evt) { 20616 var popupElement = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement); 20617 var excptId = popupElement == null ? "" : 20618 popupElement.DXPopupElementControl.GetWindowElementId(popupElement.DXPopupWindowIndex); 20619 this.OnMouseDownCore(evt, excptId); 20620 }, 20621 OnMouseDown: function(evt) { 20622 this.OnMouseDownCore(evt, ""); 20623 }, 20624 OnMouseDownCore: function(evt, excptId) { 20625 var srcElement = ASPx.Evt.GetEventSource(evt); 20626 this.DoHideAllWindows(srcElement, excptId, false, ASPxClientPopupControlCloseReason.OuterMouseClick, ASPx.Evt.GetEventX(evt));
20627 aspxGetPopupControlCollection().ClearAppearTimer(); 20628 }, 20629 OnMouseMove: function (evt) { 20630 if(ASPx.Browser.WebKitTouchUI && ASPx.TouchUIHelper.isGesture) 20631 return; 20632 if(this.draggingControl != null) { 20633 this.Drag(evt); 20634 } 20635 else if(this.overControl != null) { 20636 this.OnMouseOver(evt); 20637 } 20638 else if(this.resizeControl != null) { 20639 this.resizeControl.OnResize(evt, this.resizeIndex, this.resizeCursor, this.resizePanel); 20640 } 20641 }, 20642 OnMouseOver: function(evt) { 20643 var element = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlOverElement); 20644 var curPopupElement = this.overControl.GetWindowCurrentPopupElementByIndex(this.overWindowIndex); 20645 var popup = element != null ? element.DXPopupElementControl : null; 20646 var isPopupActionMouseOver = popup && popup.GetWindowPopupAction(this.overWindowIndex) == 'MouseOver'; 20647 var isCurPopupElement = element !== null && element === curPopupElement; 20648 var isCurPopupWindow = element != null && element.id === this.overControl.GetWindowElementId(this.overWindowIndex); 20649 var isCurPopupElementOrCurPopupWindow = isCurPopupElement || isCurPopupWindow || isPopupActionMouseOver; 20650 if(isCurPopupElementOrCurPopupWindow) { 20651 var clearTimer = true; 20652 popup = element.DXPopupElementControl; 20653 if(popup && popup.GetLastShownPopupElementIndex(element.DXPopupWindowIndex) != element.DXPopupElementIndex) 20654 clearTimer = false; 20655 if(clearTimer) 20656 this.ClearDisappearTimer(); 20657 this.SaveCurrentMouseOverPos(evt); 20658 return; 20659 } 20660 this.OnMouseOut(); 20661 }, 20662 OnMouseOut: function(evt) { 20663 if(!this.overControl || this.draggingControl) return; 20664 this.ClearAppearTimer(); 20665 var windowCloseAction = this.overControl.GetWindowCloseAction(this.overWindowIndex); 20666 if(windowCloseAction == "MouseOut" && this.overControl.InternalIsWindowVisible(this.overWindowIndex)) { 20667 if(!this.IsDisappearTimerActive() && this.IsDisappearAllowedByMouseOut(evt)) 20668 this.SetDisappearTimer(this.overControl.name, this.overWindowIndex, this.overControl.disappearAfter); 20669 } 20670 else 20671 this.OverStop(); 20672 }, 20673 IsDisappearAllowedByMouseOut: function(evt) { 20674 return ASPx.Browser.Firefox || ASPx.Browser.Chrome ? !this.IsOverPopupWindow(evt) : true; 20675 }, 20676 OnMouseUp: function(evt) { 20677 if(this.draggingControl != null) 20678 this.DragStop(); 20679 if(this.resizeControl != null) 20680 this.ResizeStop(evt); 20681 }, 20682 OnResize: function(evt) { 20683 this.AutoUpdateElementsPosition(); 20684 this.AdjustModalElementsBounds(); 20685 }, 20686 OnScroll: function(evt) { 20687 if(this.scrollEventLockCount > 0) 20688 return; 20689 var scroll = this.GetDocScrollDifference(); 20690 if(this.IsDocScrolled(scroll)) { 20691 this.CorrectPositionAtScroll(scroll); 20692 this.AdjustModalElementsBounds(); 20693 this.SaveScrollState(); 20694 } 20695 this.CalculateDocumentDimensionsWithoutPinnedWindows(evt); 20696 this.FireScrollEventToWindows(evt); 20697 }, 20698 GetSavedBodyWidth: function() { 20699 if(this.savedBodyWidth == 0) 20700 this.CalculateDocumentDimensionsWithoutPinnedWindows(); 20701 return this.savedBodyWidth; 20702 }, 20703 GetSavedBodyHeight: function() { 20704 if(this.savedBodyHeight == 0) 20705 this.CalculateDocumentDimensionsWithoutPinnedWindows(); 20706 return this.savedBodyHeight; 20707 }, 20708 HidePinnedPopupsThatOutFromViewPort: function() { 20709 var popupsToRestoreVisible = []; 20710 for(var i = 0; i < this.visiblePopupWindowIds.length; i++) { 20711 var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]); 20712 var popupControl = popupWindow.popupControl; 20713 if(!popupControl.needToHidePinnedOutFromViewPort(popupWindow.windowIndex)) 20714 continue; 20715 var element = popupControl.GetWindowElement(popupWindow.windowIndex); 20716 if(!element) continue; 20717 var restoreData = {}; 20718 restoreData.element = element; 20719 restoreData.display = element.style.display; 20720 element.style.display = "none"; 20721 popupsToRestoreVisible.push(restoreData); 20722 } 20723 return popupsToRestoreVisible; 20724 }, 20725 RestorePinnedPopupsThatOutFromViewPort: function(popupsToRestoreVisible) { 20726 if(popupsToRestoreVisible.length > 0) { 20727 for(var i = 0; i < popupsToRestoreVisible.length; i++) { 20728 var restoreData = popupsToRestoreVisible[i]; 20729 restoreData.element.style.display = restoreData.display; 20730 } 20731 } 20732 },
20733 CalculateDocumentDimensionsWithoutPinnedWindows: function(evt) { 20734 var popupsToRestoreVisible = []; 20735 var needToHideRestorePopupsThatOutFromViewPort = !!evt && ASPx.Evt.GetEventSource(evt) == document; 20736 if(needToHideRestorePopupsThatOutFromViewPort) 20737 popupsToRestoreVisible = this.HidePinnedPopupsThatOutFromViewPort(); 20738 this.savedBodyWidth = ASPx.GetDocumentWidth(); 20739 this.savedBodyHeight = ASPx.GetDocumentHeight(); 20740 if(needToHideRestorePopupsThatOutFromViewPort) 20741 this.RestorePinnedPopupsThatOutFromViewPort(popupsToRestoreVisible); 20742 }, 20743 FireScrollEventToWindows: function(evt) { 20744 for(var i = 0; i < this.visiblePopupWindowIds.length; i++) { 20745 var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]); 20746 var popupControl = popupWindow.popupControl; 20747 popupControl.OnScroll(evt, popupWindow.windowIndex); 20748 } 20749 }, 20750 LockScrollEvent: function() { 20751 this.scrollEventLockCount++; 20752 }, 20753 UnlockScrollEvent: function() { 20754 this.scrollEventLockCount--; 20755 }, 20756 CorrectPositionAtScroll: function(scroll) { 20757 for(var i = 0; i < this.visiblePopupWindowIds.length; i++) { 20758 var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]); 20759 var popupControl = popupWindow.popupControl; 20760 if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex)) { 20761 if(popupControl.GetAutoUpdatePosition(popupWindow.windowIndex)) 20762 popupWindow.popupControl.TryAutoUpdatePosition(popupWindow.windowIndex); 20763 } 20764 } 20765 }, 20766 OnSelectStart: function() { 20767 return !this.selectBanned; 20768 }, 20769 OverStop: function() { 20770 this.overControl = null; 20771 this.overWindowIndex = -1; 20772 }, 20773 OnPWDisappearTimer: function(name, index) { 20774 var pc = this.Get(name); 20775 if(pc != null) { 20776 if(!pc.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.MouseOut)) 20777 this.OverStop(); 20778 this.ClearDisappearTimer(); 20779 } 20780 }, 20781 SaveCurrentMouseOverPos: function(evt) { 20782 this.overXPos = ASPx.Evt.GetEventX(evt); 20783 this.overYPos = ASPx.Evt.GetEventY(evt); 20784 }, 20785 RegisterVisibleModalElement: function(element) { 20786 if(ASPx.Data.ArrayIndexOf(this.visibleModalElements, element) == -1) 20787 this.visibleModalElements.push(element); 20788 }, 20789 UnregisterVisibleModalElement: function(element) { 20790 ASPx.Data.ArrayRemove(this.visibleModalElements, element); 20791 }, 20792 RegisterVisibleWindow: function(element, popupControl, index) { 20793 if(ASPx.Data.ArrayIndexOf(this.visiblePopupWindowIds, element.id) == -1) { 20794 this.visiblePopupWindowIds.push(element.id); 20795 if(popupControl && popupControl.GetWindowCloseAction(index) == "MouseOut") 20796 aspxGetPopupControlCollection().InitOverObject(popupControl, index, null); 20797 this.OnRegisteredVisibleWindow(element); 20798 } 20799 }, 20800 OnRegisteredVisibleWindow: function(element) { 20801 var elementIndex = ASPx.Data.ArrayIndexOf(this.visiblePopupWindowIds, element.id); 20802 if(this.PopupWindowIsModalByVisibleIndex(elementIndex)) 20803 ASPx.RemoveFocus(element); 20804 }, 20805 UnregisterVisibleWindow: function(element) { 20806 this.DeleteWindowFromZIndexOrder(element); 20807 ASPx.Data.ArrayRemove(this.visiblePopupWindowIds, element.id); 20808 var forceRecalculate = this.PopupWindowIsModalByID(element.id); 20809 this.RefreshTabIndexes(forceRecalculate); 20810 this.SkipCurrentActiveWindowElement(element); 20811 }, 20812 AutoUpdateElementsPosition: function() { 20813 for(var i = 0; i < this.visiblePopupWindowIds.length; i++) { 20814 var popupWindow = this.GetPopupWindowFromID(this.visiblePopupWindowIds[i]); 20815 var popupControl = popupWindow.popupControl; 20816 if(popupControl != null && popupControl.InternalIsWindowVisible(popupWindow.windowIndex)) 20817 popupControl.TryAutoUpdatePosition(popupWindow.windowIndex); 20818 } 20819 }, 20820 LockWindowResizeByBodyScrollVisibilityChanging: function() { 20821 this.windowResizeByBodyScrollVisibilityChangingLockCount++; 20822 }, 20823 UnlockWindowResizeByBodyScrollVisibilityChanging: function() { 20824 this.windowResizeByBodyScrollVisibilityChangingLockCount--; 20825 }, 20826 WindowResizeByBodyScrollVisibilityChangingLocked: function() { 20827 return this.windowResizeByBodyScrollVisibilityChangingLockCount > 0; 20828 }, 20829 HideAllWindows: function() { 20830 this.DoHideAllWindows(null, "", true, ASPxClientPopupControlCloseReason.API, 0); 20831 } 20832}); 20833var ASPxClientPopupControlResizeState = { 20834 Resized: 0, 20835 Collapsed: 1, 20836 Expanded: 2, 20837 Maximized: 3, 20838 RestoredAfterMaximized: 4 20839}; 20840var ASPxClientPopupControlCloseReason = { 20841 API: "API", 20842 CloseButton: "CloseButton", 20843 OuterMouseClick: "OuterMouseClick", 20844 MouseOut: "MouseOut", 20845 Escape: "Escape" 20846}; 20847var popupControlCollection = null; 20848function aspxGetPopupControlCollection() { 20849 if(popupControlCollection == null) 20850 popupControlCollection = new ASPxClientPopupControlCollection(); 20851 return popupControlCollection; 20852} 20853function _aspxScrollDifference(horizontal, vertical) { 20854 this.horizontal = horizontal; 20855 this.vertical = vertical; 20856} 20857function aspxPWEMOver(evt) { 20858 aspxGetPopupControlCollection().OnPWMouseOver(evt); 20859} 20860ASPx.PWHMDown = function(evt) { 20861 return ASPx.Evt.CancelBubble(evt); 20862};
20863ASPx.PWCBClick = function(evt, name, index) { 20864 var pc = aspxGetPopupControlCollection().Get(name); 20865 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnCloseButtonClick"); 20866}; 20867ASPx.PWPBClick = function(evt, name, index) { 20868 var pc = aspxGetPopupControlCollection().Get(name); 20869 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnPinButtonClick"); 20870}; 20871ASPx.PWRBClick = function(evt, name, index) { 20872 var pc = aspxGetPopupControlCollection().Get(name); 20873 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnRefreshButtonClick"); 20874}; 20875ASPx.PWMNBClick = function(evt, name, index) { 20876 var pc = aspxGetPopupControlCollection().Get(name); 20877 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnCollapseButtonClick"); 20878}; 20879ASPx.PWMXBClick = function(evt, name, index) { 20880 var pc = aspxGetPopupControlCollection().Get(name); 20881 if(pc != null) pc.OnPWHBClickCore(evt, index, "OnMaximizeButtonClick"); 20882}; 20883ASPx.PWDGMDown = function (evt, name, index) { 20884 var pc = aspxGetPopupControlCollection().Get(name); 20885 return ASPx.PWMDown(evt, name, index, pc.IsDraggingAllowed(index)); 20886}; 20887ASPx.PWGripMDown = function(evt, name, index) { 20888 aspxPWMDownCore(evt, name, index, false); 20889 return ASPx.PWHMDown(evt); 20890}; 20891ASPx.PWMMove = function(evt, name, index) { 20892 aspxGetPopupControlCollection().OnPWMouseMove(evt, name, index); 20893}; 20894ASPx.PWMDown = function(evt, name, index, isWindowContentDraggingAllowed) { 20895 var pointOnScrollBar = false; 20896 var pc = aspxGetPopupControlCollection().Get(name); 20897 if(pc && pc.GetEnableContentScrolling(index)) { 20898 var rtl = pc.rtl && (ASPx.Browser.Firefox || ASPx.Browser.Opera); 20899 pointOnScrollBar = aspxPointOnElementScrollBar(pc.GetContentContainer(index), evt.clientX, evt.clientY, rtl); 20900 } 20901 aspxPWMDownCore(evt, name, index, isWindowContentDraggingAllowed, pointOnScrollBar); 20902 if(isWindowContentDraggingAllowed) { 20903 aspxGetPopupControlCollection().OnDocumentMouseDown(evt); 20904 if(typeof (ASPx.GetDropDownCollection) == "function") 20905 ASPx.GetDropDownCollection().OnDocumentMouseDown(evt); 20906 if(!pointOnScrollBar) { 20907 if(!ASPx.Browser.WebKitTouchUI && ASPx.Evt.GetEventSource(evt).tagName == "IMG") 20908 ASPx.Evt.PreventEvent(evt); 20909 } 20910 } 20911}; 20912function aspxPWMDownCore(evt, name, index, isDraggingAllowed, pointOnScrollBar) { 20913 var pc = aspxGetPopupControlCollection().Get(name); 20914 if(pc != null) { 20915 pc.OnActivate(index, evt); 20916 pc.OnMouseDown(evt, index, isDraggingAllowed, pointOnScrollBar); 20917 } 20918} 20919function aspxPWMEMDown(evt) { 20920 var internalScrollableModalDiv = ASPx.Browser.AndroidDefaultBrowser ? ASPx.Evt.GetEventSource(evt) : null; 20921 var modalDiv = internalScrollableModalDiv ? internalScrollableModalDiv.parentNode : ASPx.Evt.GetEventSource(evt); 20922 if(modalDiv != null) 20923 modalDiv.DXModalPopupControl.OnMouseDownModalElement(evt, modalDiv.DXModalPopupWindowIndex); 20924} 20925function aspxPEMEvent(evt) { 20926 var element = ASPx.PopupUtils.FindEventSourceParentByTestFunc(evt, aspxTestPopupControlElement); 20927 if(element != null) { 20928 var popupControl = element.DXPopupElementControl; 20929 var index = element.DXPopupWindowIndex; 20930 if(evt.type == "mousedown") { 20931 popupControl.SetIsPopuped(index, popupControl.InternalIsWindowVisible(index)); 20932 aspxGetPopupControlCollection().OnMouseDown(evt); 20933 } 20934 else { 20935 var windowPopupAction = popupControl.GetWindowPopupAction(element.DXPopupWindowIndex); 20936 var leftMouseButtonAction = windowPopupAction == "LeftMouseClick" && ASPx.Evt.IsLeftButtonPressed(evt); 20937 var isAccessibleKeyboardAction = popupControl.accessibilityCompliant && ASPx.Evt.IsActionKeyPressed(evt); 20938 var rightMouseButtonAction = windowPopupAction == "RightMouseClick" && !ASPx.Evt.IsLeftButtonPressed(evt); 20939 if(leftMouseButtonAction || rightMouseButtonAction || isAccessibleKeyboardAction) { 20940 if(rightMouseButtonAction) 20941 ASPx.PopupUtils.PreventContextMenu(evt); 20942 var windowCloseAction = popupControl.GetWindowCloseAction(index); 20943 var isPopuped = popupControl.GetIsPopuped(index); 20944 var isNewPopupElement = popupControl.GetLastShownPopupElementIndex(index) != element.DXPopupElementIndex; 20945 if(isPopuped && isNewPopupElement) { 20946 popupControl.DoHideWindow(index, false, ASPxClientPopupControlCloseReason.OuterMouseClick); 20947 aspxGetPopupControlCollection().ClearDisappearTimer(); 20948 isPopuped = false; 20949 }
20950 if(!(isPopuped && windowCloseAction == "OuterMouseClick")) { 20951 popupControl.DoShowWindow(index, element.DXPopupElementIndex, evt); 20952 } 20953 if(windowCloseAction == "MouseOut") 20954 aspxGetPopupControlCollection().InitOverObject(popupControl, element.DXPopupWindowIndex, evt); 20955 return false; 20956 } 20957 } 20958 } 20959} 20960ASPx.PopupElementMouseEvent = aspxPEMEvent; 20961function aspxPointOnElementScrollBar(element, x, y, rtl) { 20962 var scrollWidth = ASPx.GetVerticalScrollBarWidth(); 20963 var hasHorizontalScroll = element.scrollWidth > element.clientWidth; 20964 var hasVerticalScroll = element.scrollHeight > element.clientHeight; 20965 var ceilX = rtl ? ASPx.GetAbsoluteX(element) + scrollWidth : 20966 ASPx.GetAbsoluteX(element) + (element.offsetWidth - ASPx.GetHorizontalBordersWidth(element)); 20967 var ceilY = ASPx.GetAbsoluteY(element) + (element.offsetHeight - ASPx.GetVerticalBordersWidth(element)); 20968 return (hasVerticalScroll && x >= ceilX - scrollWidth && x <= ceilX) || 20969 (hasHorizontalScroll && y >= ceilY - scrollWidth && y <= ceilY); 20970} 20971ASPx.PCAStop = function(name, index) { 20972 var pc = aspxGetPopupControlCollection().Get(name); 20973 if(pc != null) pc.OnAnimationStop(index); 20974}; 20975ASPx.PCIframeLoad = function(evt) { 20976 var srcElement = ASPx.Evt.GetEventSource(evt); 20977 if(srcElement) { 20978 var pcName = srcElement.popupControlName; 20979 var pcWndIndex = srcElement.pcWndIndex; 20980 if(pcName) { 20981 var pc = aspxGetPopupControlCollection().Get(pcName); 20982 if(pc) pc.OnIFrameLoad(pcWndIndex); 20983 } 20984 } 20985}; 20986function aspxTestPopupWindowElement(element) { 20987 return !!element.DXPopupWindowElement; 20988} 20989function aspxTestPopupControlElement(element) { 20990 return element.DXPopupElementControl && ASPx.IsExists(element.DXPopupWindowIndex); 20991} 20992function aspxTestPopupControlOverElement(element) { 20993 var collection = aspxGetPopupControlCollection(); 20994 var popupControl = collection.overControl; 20995 var index = collection.overWindowIndex; 20996 var windowId = popupControl.GetWindowElementId(index); 20997 if(element.id == windowId) 20998 return true; 20999 var popupElements = popupControl.GetPopupElementList(index); 21000 for(var i = 0; i < popupElements.length; i++) 21001 if(popupElements[i] == element) 21002 return true; 21003 return false; 21004} 21005ASPx.Evt.AttachEventToDocument("keydown", function(evt) { 21006 aspxGetPopupControlCollection().OnDocumentKeyDown(evt); 21007}); 21008ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, function(evt) { 21009 aspxGetPopupControlCollection().OnDocumentMouseDown(evt); 21010}); 21011ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, function(evt) { 21012 return aspxGetPopupControlCollection().OnMouseUp(evt); 21013}); 21014ASPx.Evt.AttachEventToElement(window, ASPx.TouchUIHelper.touchMouseMoveEventName, function(evt) { 21015 if(typeof(aspxGetPopupControlCollection) != "undefined") 21016 aspxGetPopupControlCollection().OnMouseMove(evt); 21017}, false, !ASPx.Browser.WebKitTouchUI); 21018ASPx.Evt.AttachEventToDocument("mouseout", function(evt) { 21019 if(typeof (aspxGetPopupControlCollection) != "undefined") 21020 aspxGetPopupControlCollection().OnMouseOut(evt); 21021}); 21022 ASPx.Evt.AttachEventToElement(window, "resize", function(evt) { 21023 aspxGetPopupControlCollection().OnResize(evt); 21024}); 21025ASPx.Evt.AttachEventToElement(window, "scroll", function(evt) { 21026 aspxGetPopupControlCollection().OnScroll(evt); 21027}); 21028ASPx.Evt.AttachEventToDocument("selectstart", function(evt) { 21029 var ret = aspxGetPopupControlCollection().OnSelectStart(evt); 21030 if(!ret) return false; 21031}); 21032var currViewPortSize = null, 21033 viewPortSizeInterval = null; 21034function getViewPortSize() { 21035 return { 21036 w: window.innerWidth, 21037 h: window.innerHeight, 21038 x: window.pageXOffset, 21039 y: window.pageYOffset 21040 }; 21041} 21042function ensureViewPortSizeInterval() { 21043 if(!!viewPortSizeInterval) return; 21044 viewPortSizeInterval = setInterval(function() { 21045 var size = getViewPortSize(); 21046 if(currViewPortSize && (size.w != currViewPortSize.w || size.h != currViewPortSize.h || size.x != currViewPortSize.x || size.y != currViewPortSize.y)) { 21047 var controlCollection = aspxGetPopupControlCollection(); 21048 controlCollection.ForEachControl(function(popupControl) { 21049 if(popupControl.GetCanScrollViewPort(-1) && popupControl.IsVisible()) { 21050 popupControl.updateContentScrollIfNeeded(-1); 21051 popupControl.UpdatePosition(); 21052 } 21053 }); 21054 } 21055 currViewPortSize = size; 21056 }, 50); 21057} 21058window.ASPxClientPopupControlBase = ASPxClientPopupControlBase; 21059window.ASPxClientPopupControl = ASPxClientPopupControl; 21060window.ASPxClientPopupWindow = ASPxClientPopupWindow; 21061window.ASPxClientPopupWindowEventArgs = ASPxClientPopupWindowEventArgs; 21062window.ASPxClientPopupWindowCancelEventArgs = ASPxClientPopupWindowCancelEventArgs; 21063window.ASPxClientPopupWindowResizeEventArgs = ASPxClientPopupWindowResizeEventArgs; 21064window.ASPxClientPopupWindowPinnedChangedEventArgs = ASPxClientPopupWindowPinnedChangedEventArgs; 21065window.ASPxClientPopupControlCollection = ASPxClientPopupControlCollection; 21066window.ASPxClientPopupControlResizeState = ASPxClientPopupControlResizeState; 21067window.ASPxClientPopupControlCloseReason = ASPxClientPopupControlCloseReason; 21068ASPx.GetPopupControlCollection = aspxGetPopupControlCollection;
21069ASPx.PopupControlCssClasses = PopupControlCssClasses; 21070})(); 21071 21072(function () { 21073 FormLayoutConsts = { 21074 FORM_LAYOUT_PARTIAL_CLASS_NAME: "dxflFormLayout", 21075 ITEM_SYSTEM_CLASS_NAME: "dxflItemSys", 21076 CAPTION_CELL_SYSTEM_CLASS_NAME: "dxflCaptionCellSys", 21077 ALIGNED_GROUP_SYSTEM_CLASS_NAME: "dxflAGSys", 21078 FULL_HEIGHT_CELL_SYSTEM_CLASS_NAME: "dxflFullHeightItemCellSys", 21079 FULL_HEIGHT_NESTED_CONTROL_SYSTEM_CLASS_NAME: "dxflFullHeightNestedControlSys", 21080 HEADING_LINE_GROUP_BOX_WITH_CAPTION_SYSTEM_CLASS_NAME: "dxflWithCaptionSys", 21081 NESTED_CONTROL_CELL_PARTIAL_CLASS_NAME: "dxflNestedControlCell", 21082 HEADING_LINE_GROUP_BOX_SYSTEM_CLASS_NAME: "dxflHeadingLineGroupBoxSys", 21083 TABBED_GROUP_PAGE_CONTROL_SYSTEM_CLASS_NAME: "dxflPCSys", 21084 PAGE_CONTROL_ID_PREFIX: "PC_", 21085 ITEM_PATH_SEPARATOR: "_", 21086 NOT_FLOATED_ELEMENT_SYSTEM_CLASS_NAME: "dxflNotFloatedElSys", 21087 ELEMENT_CONTAINER_SYSTEM_CLASS_NAME: "dxflElConSys", 21088 ELEMENT_IN_ADAPTIVE_VIEW: "dxflElInAdaptiveView", 21089 ITEM_IN_ADAPTIVE_VIEW: "dxflItemInAdaptiveView", 21090 GROUP_CHILD_ITEM_IN_FIRST_ROW_SYSTEM_CLASS_NAME: "dxflChildInFirstRowSys", 21091 GROUP_FIRST_CHILD_ITEM_SYSTEM_CLASS_NAME: "dxflFirstChildSys", 21092 GROUP_CHILD_ITEM_IN_LAST_ROW_SYSTEM_CLASS_NAME: "dxflChildInLastRowSys", 21093 GROUP_LAST_CHILD_ITEM_SYSTEM_CLASS_NAME: "dxflLastChildSys", 21094 GROUP_SYSTEM_CLASS_NAME: "dxflGroupSys", 21095 GROUP_BOX_SYSTEM_CLASS_NAME: "dxflGroupBoxSys", 21096 TABBED_GROUP_SYSTEM_CLASS_NAME: "dxflPCContainerSys", 21097 EMPTY_ITEM_CLASS_NAME: "dxflEmptyItem", 21098 GROUP_FIRST_CHILD_IN_ROW_SYSTEM_CLASS_NAME: "dxflFirstChildInRowSys", 21099 GROUP_LAST_CHILD_IN_ROW_SYSTEM_CLASS_NAME: "dxflLastChildInRowSys", 21100 GROUP_WITHOUT_PADDINGS_SYSTEM_CLASS_NAME: "dxflNoDefaultPaddings", 21101 GROUP_CELL_PARTIAL_CLASS_NAME: "dxflGroupCell", 21102 LAYOUT_ITEM_CAPTION_PARTIAL_CLASS_NAME: "dxflCaption", 21103 GROUP_BOX_CAPTION_PARTIAL_CLASS_NAME: "dxflGroupBoxCaption", 21104 VIEW_FORM_LAYOUT_SYSTEM_CLASS_NAME: "dxflViewFormLayoutSys", 21105 EDIT_FORM_ITEM_SYSTEM_CLASS_NAME: "dxflEditFormItemSys", 21106 TEXT_ITEM_SYSTEM_CLASS_NAME: "dxflTextItemSys", 21107 GROUP_CONTAINER_SYSTEM_CLASS_NAME: "dxflGroupContainerSys", 21108 SINGLE_COLUMN_BREAKPOINT_NAME: "dxSC", 21109 OFFSET_ERROR: 5 21110 }; 21111 FormLayoutHorizontalCaptionsCssClasses = [ "dxflCLLSys", "dxflCLRSys" ]; 21112 FormLayoutVerticalCaptionsCssClasses = [ "dxflCLTSys", "dxflCLBSys" ]; 21113 FormLayoutHorizontalHelpTextsCssClasses = [ "dxflLHelpTextSys", "dxflRHelpTextSys" ]; 21114 FormLayoutVerticalHelpTextsCssClasses = [ "dxflTHelpTextSys", "dxflBHelpTextSys" ]; 21115 var NestedControlToItemClassNamesMap = [ 21116 { controlClassName: "dxeTextBoxSys", itemClassName: "dxflTextEditItemSys" }, 21117 { controlClassName: "dxeButtonEditSys", itemClassName: "dxflTextEditItemSys" }, 21118 { controlClassName: "dxeMemoSys", itemClassName: "dxflMemoItemSys" }, 21119 { controlClassName: "dxeBase", itemClassName: "dxflCheckBoxItemSys" } 21120 ]; 21121 var LayoutChangeType = { 21122 None: "N", 21123 SingleColumn: "S", 21124 Breakpoint: "B" 21125 }; 21126 var FormLayoutAdaptivityMode = { 21127 Off: 0, 21128 SingleColumnWindowLimit: 1, 21129 Breakpoints: 2 21130 }; 21131 var EdgeKeys = { 21132 top: "top", 21133 bottom: "bottom", 21134 left: "left", 21135 right: "right" 21136 }; 21137 var errorCellVisibilityChangedProcessingDelay = 50; 21138 ASPxClientLayoutItem = ASPx.CreateClass(null, { 21139 constructor: function (formLayout, name, path, parent) { 21140 this.formLayout = formLayout; 21141 this.name = name; 21142 this.path = path; 21143 this.parent = parent; 21144 this.visible = true; 21145 this.clientVisible = true; 21146 this.isTabbedGroup = false; 21147 this.needAdjustContentOnShowing = true; 21148 this.items = []; 21149 }, 21150 CreateItems: function (itemsProperties) { 21151 for(var i = 0; i < itemsProperties.length; i++){ 21152 var item = this.CreateItemInstance(itemsProperties[i].name, itemsProperties[i].path); 21153 item.ConfigureByProperties(itemsProperties[i]); 21154 this.items.push(item); 21155 } 21156 }, 21157 CreateItemInstance: function (name, path) { 21158 return new ASPxClientLayoutItem(this.formLayout, name, path, this); 21159 }, 21160 ConfigureByProperties: function(itemProperties){ 21161 if(ASPx.IsExists(itemProperties.visible)) 21162 this.visible = itemProperties.visible; 21163 if(ASPx.IsExists(itemProperties.clientVisible)) 21164 this.clientVisible = itemProperties.clientVisible; 21165 if(ASPx.IsExists(itemProperties.isTabbedGroup)) 21166 this.isTabbedGroup = itemProperties.isTabbedGroup; 21167 if(ASPx.IsExists(itemProperties.items)) 21168 this.CreateItems(itemProperties.items); 21169 if(ASPx.IsExists(itemProperties.columnProperties)) { 21170 this.columnProperties = {}; 21171 this.columnProperties.name = itemProperties.columnProperties.name; 21172 this.columnProperties.fieldName = itemProperties.columnProperties.fieldName; 21173 } 21174 }, 21175 GetItemByName: function(name) { 21176 return this.getItemByPredicate(function(item) { return item.name == name; });
21177 }, 21178 getItemByPredicate: function(predicate) { 21179 for(var i = 0; i < this.items.length; i++) 21180 if(predicate(this.items[i])) return this.items[i]; 21181 for(var i = 0; i < this.items.length; i++) { 21182 var item = this.items[i].getItemByPredicate(predicate); 21183 if(item != null) return item; 21184 } 21185 return null; 21186 }, 21187 GetItemByPath: function (path) { 21188 var pathIndexes = path.split(FormLayoutConsts.ITEM_PATH_SEPARATOR); 21189 var currentIndex = pathIndexes[0]; 21190 pathIndexes.shift(); 21191 if(currentIndex > this.items.length - 1) 21192 return null; 21193 if(pathIndexes.length > 0 && this.items[currentIndex].items.length > 0) { 21194 var newPath = pathIndexes.join(FormLayoutConsts.ITEM_PATH_SEPARATOR); 21195 var result = this.items[currentIndex].GetItemByPath(newPath); 21196 if(result != null) 21197 return result; 21198 } 21199 else 21200 return pathIndexes.length > 0 ? null : this.items[currentIndex]; 21201 return null; 21202 }, 21203 GetVisible: function () { 21204 return this.visible && this.clientVisible; 21205 }, 21206 SetVisible: function (value) { 21207 if(this.clientVisible != value) { 21208 this.clientVisible = value; 21209 this.formLayout.SetItemVisible(this, value, false); 21210 } 21211 }, 21212 SetCaption: function(caption) { 21213 if(!this.visible) 21214 return; 21215 this.formLayout.SetItemCaption(this, caption); 21216 }, 21217 GetCaption: function() { 21218 if(this.visible) 21219 return this.formLayout.GetItemCaption(this); 21220 return ""; 21221 }, 21222 InitializeNeedAdjustContentOnShowing: function () { 21223 if(this.visible) { 21224 this.needAdjustContentOnShowing = !this.IsVisibleOnClient(); 21225 for(var i = 0; i < this.items.length; i++) 21226 this.items[i].InitializeNeedAdjustContentOnShowing(); 21227 } 21228 }, 21229 IsVisibleOnClient: function () { 21230 var currentItem = this; 21231 while(currentItem != null) { 21232 if(!currentItem.clientVisible) 21233 return false; 21234 currentItem = currentItem.parent; 21235 } 21236 return true; 21237 }, 21238 ResetNeedAdjustContentOnShowing: function () { 21239 this.needAdjustContentOnShowing = false; 21240 } 21241 }); 21242 var ApplyEdgeClassHelper = ASPx.CreateClass(null, { 21243 constructor: function() { 21244 this.edgeClasses = { 21245 top: FormLayoutConsts.GROUP_CHILD_ITEM_IN_FIRST_ROW_SYSTEM_CLASS_NAME, 21246 right: FormLayoutConsts.GROUP_LAST_CHILD_IN_ROW_SYSTEM_CLASS_NAME, 21247 bottom: FormLayoutConsts.GROUP_CHILD_ITEM_IN_LAST_ROW_SYSTEM_CLASS_NAME, 21248 left: FormLayoutConsts.GROUP_FIRST_CHILD_IN_ROW_SYSTEM_CLASS_NAME 21249 }; 21250 this.cells = null; 21251 }, 21252 RemoveElementClassNames: function(cellContainer) { 21253 ASPx.RemoveClassNamesFromElement(cellContainer, [ 21254 FormLayoutConsts.NOT_FLOATED_ELEMENT_SYSTEM_CLASS_NAME, 21255 FormLayoutConsts.GROUP_CHILD_ITEM_IN_FIRST_ROW_SYSTEM_CLASS_NAME, 21256 FormLayoutConsts.GROUP_CHILD_ITEM_IN_LAST_ROW_SYSTEM_CLASS_NAME, 21257 FormLayoutConsts.GROUP_FIRST_CHILD_IN_ROW_SYSTEM_CLASS_NAME, 21258 FormLayoutConsts.GROUP_LAST_CHILD_IN_ROW_SYSTEM_CLASS_NAME, 21259 FormLayoutConsts.GROUP_LAST_CHILD_ITEM_SYSTEM_CLASS_NAME 21260 ]); 21261 }, 21262 ApplyEdgeClasses: function(cells, cellsRects, edgeKey) { 21263 this.cells = null; 21264 if(!cells) 21265 return; 21266 this.cells = cells; 21267 var edgeCells = cells; 21268 if(edgeCells.length > 1) 21269 edgeCells = this.GetEdgeElements(cellsRects, edgeKey); 21270 for(var i = 0; i < edgeCells.length; i++) 21271 ASPx.AddClassNameToElement(edgeCells[i], this.edgeClasses[edgeKey]); 21272 }, 21273 ApplyEdgeTopClass: function(cells, cellsRects) { 21274 this.ApplyEdgeClasses(cells, cellsRects, EdgeKeys.top); 21275 }, 21276 ApplyEdgeBottomClass: function(cells, cellsRects) { 21277 this.ApplyEdgeClasses(cells, cellsRects, EdgeKeys.bottom); 21278 }, 21279 ApplyEdgeLeftClass: function(cells, cellsRects) { 21280 this.ApplyEdgeClasses(cells, cellsRects, EdgeKeys.left); 21281 }, 21282 ApplyEdgeRightClass: function(cells, cellsRects) { 21283 this.ApplyEdgeClasses(cells, cellsRects, EdgeKeys.right); 21284 }, 21285 ApplyLastGroupItemClass: function(cells) { 21286 var lastCell = cells[cells.length - 1]; 21287 ASPx.AddClassNameToElement(lastCell, FormLayoutConsts.GROUP_LAST_CHILD_ITEM_SYSTEM_CLASS_NAME); 21288 }, 21289 GetEdgeElements: function(cellsRects, edgeKey) { 21290 var result = []; 21291 var edgeOffset = this.GetEdgeOffset(cellsRects, edgeKey); 21292 for(var i = 0; i < this.cells.length; i++) { 21293 var cell = this.cells[i]; 21294 var offset = cellsRects[i][edgeKey]; 21295 if(Math.abs(offset - edgeOffset) < FormLayoutConsts.OFFSET_ERROR) 21296 result.push(cell); 21297 } 21298 return result; 21299 }, 21300 GetEdgeOffset: function(cellsRects, edgeKey) { 21301 var offsets = this.GetOffsets(cellsRects, edgeKey); 21302 return this.GetEdgeOffsetCore(edgeKey, offsets); 21303 }, 21304 GetOffsets: function(cellsRects, edgeKey) { 21305 var offsets = []; 21306 for(var i = 0; i < cellsRects.length; i++) 21307 offsets.push(cellsRects[i][edgeKey]); 21308 return offsets; 21309 }, 21310 GetEdgeOffsetCore: function(edgeKey, offsets) { 21311 var result = -1; 21312 if(edgeKey === EdgeKeys.bottom || edgeKey === EdgeKeys.right) 21313 result = Math.max.apply(null, offsets); 21314 else 21315 result = Math.min.apply(null, offsets); 21316 return result; 21317 } 21318 }); 21319 var FullHeightTableItemHelper = ASPx.CreateClass(null, { 21320 constructor: function(mainElement) { 21321 this.mainElement = mainElement; 21322 this.cells = null; 21323 this.rows = []; 21324 }, 21325 SetCellsFullHeight: function(cellsInfo) { 21326 this.prepareHelperState(cellsInfo); 21327 for(var i = 0; i < this.cells.length; i++) 21328 this.SetCellsFullHeightCore(i, this.cells[i]); 21329 }, 21330 SetCellsFullHeightCore: function(index, container) { 21331 this.ensureNestedControlCellHeight(container); 21332 this.ensureGroupBoxCellHeight(container); 21333 }, 21334 prepareHelperState: function(cellsInfo) { 21335 this.resetHelperState(); 21336 if(!this.needInitializeHelperState(cellsInfo)) 21337 return; 21338 this.initializeHelperState(cellsInfo); 21339 }, 21340 initializeHelperState: function(cellsInfo) { 21341 this.cells = cellsInfo.cells; 21342 this.rows = cellsInfo.rows; 21343 }, 21344 resetHelperState: function() { 21345 this.cells = null; 21346 this.rows = []; 21347 }, 21348 needInitializeHelperState: function(cellsInfo) { 21349 return cellsInfo.cells && cellsInfo.rows; 21350 }, 21351 ensureGroupBoxCellHeight: function(container) { 21352 var groupBoxCell = ASPxClientFormLayoutUtils.getContainerElementNodesByClassName(container, FormLayoutConsts.GROUP_BOX_SYSTEM_CLASS_NAME, c
21352ontainer)[0]; 21353 if(!groupBoxCell || groupBoxCell.style.height !== "100%") 21354 return; 21355 groupBoxCell.style.height = this.getGroupBoxCellHeight(groupBoxCell); 21356 }, 21357 getGroupBoxCellHeight: function(groupBoxCell) { 21358 var itemCell = groupBoxCell.parentNode; 21359 var indents = ASPx.GetTopBottomMargins(groupBoxCell); 21360 return itemCell.offsetHeight - indents + "px"; 21361 }, 21362 ensureNestedControlCellHeight: function(container, isReset) { 21363 var itemCell = ASPxClientFormLayoutUtils.getContainerElementNodesByClassName(container, FormLayoutConsts.ITEM_SYSTEM_CLASS_NAME, container)[0]; 21364 var nestedControlCell = ASPxClientFormLayoutUtils.getContainerElementNodesByPartialClassName(container, FormLayoutConsts.NESTED_CONTROL_CELL_PARTIAL_CLASS_NAME, container)[0]; 21365 if(!itemCell || !nestedControlCell) 21366 return; 21367 var captionCell = ASPxClientFormLayoutUtils.getContainerElementNodesByClassName(container, FormLayoutConsts.CAPTION_CELL_SYSTEM_CLASS_NAME, container)[0]; 21368 var helpTextCell = ASPxClientFormLayoutUtils.getContainerElementNodesByPartialClassName(container, "HelpTextSys", container)[0]; 21369 var isComplexItemRenderer = captionCell || helpTextCell; 21370 var hasFullHeightNestedControl = ASPx.ElementHasCssClass(nestedControlCell, FormLayoutConsts.FULL_HEIGHT_NESTED_CONTROL_SYSTEM_CLASS_NAME); 21371 if(!isComplexItemRenderer && !hasFullHeightNestedControl) 21372 return; 21373 var correctingHeightCell = this.getCorrectingHeightCell(container, nestedControlCell); 21374 correctingHeightCell.style.height = this.getNestedControlCellHeight(container, itemCell, hasFullHeightNestedControl, isReset); 21375 }, 21376 getNestedControlCellHeight: function(container, itemCell, hasFullHeightNestedControl, isReset) { 21377 var height = ""; 21378 if(isReset) 21379 return height; 21380 if(hasFullHeightNestedControl) { 21381 if(this.haveAllRowNestedControlsFloatHeight(container)) 21382 height = "100%"; 21383 else { 21384 var cellHeight = this.getNestedControlCellHeightCore(container, itemCell); 21385 if(cellHeight) 21386 height = cellHeight + "px"; 21387 } 21388 } 21389 return height; 21390 }, 21391 getNestedControlCellHeightCore: function(container, itemCell) { 21392 var verticalCaptionCellHeight = this.getVerticalCaptionCellHeight(container); 21393 var containerPaddings = this.getContainerPaddings(container, itemCell); 21394 var containerOffsetHeight = this.getContainerOffsetHeight(container); 21395 var result = containerOffsetHeight - verticalCaptionCellHeight - containerPaddings; 21396 return result; 21397 }, 21398 haveAllRowNestedControlsFloatHeight: function(container) { 21399 var currentRow = this.getRowByCellContainer(container); 21400 var currentRowCellContainers = currentRow.cells; 21401 var result = true; 21402 for(var i = 0; i < currentRowCellContainers.length; i++) { 21403 var cellContainer = currentRowCellContainers[i]; 21404 var nestedControlCell = ASPxClientFormLayoutUtils.getContainerElementNodesByPartialClassName(cellContainer, FormLayoutConsts.NESTED_CONTROL_CELL_PARTIAL_CLASS_NAME, cellContainer)[0]; 21405 var hasFullHeightNestedControl = ASPx.ElementHasCssClass(nestedControlCell, FormLayoutConsts.FULL_HEIGHT_NESTED_CONTROL_SYSTEM_CLASS_NAME); 21406 if(!hasFullHeightNestedControl) { 21407 result = false; 21408 break; 21409 } 21410 } 21411 return result; 21412 }, 21413 getRowByCellContainer: function(container) { 21414 var result = null; 21415 for(var i = 0; i < this.rows.length; i++) { 21416 var row = this.rows[i]; 21417 if(ASPx.GetIsParent(row, container)) { 21418 result = row; 21419 break; 21420 } 21421 } 21422 return result; 21423 }, 21424 getVerticalCaptionCellHeight: function(container) { 21425 var captionCell = this.getVerticalCaptionCell(container); 21426 var result = 0; 21427 if(captionCell) { 21428 if(ASPx.Browser.Firefox) 21429 result = captionCell.firstElementChild.offsetHeight + ASPx.GetTopBottomPaddings(captionCell); 21430 else 21431 result = captionCell.offsetHeight; 21432 } 21433 return result; 21434 }, 21435 getVerticalCaptionCell: function(container) { 21436 var result = null; 21437 var verticalCaptionContainer = ASPxClientFormLayoutUtils.getVerticalCaptionContainer(container); 21438 if(verticalCaptionContainer) 21439 result = ASPxClientFormLayoutUtils.getContainerElementNodesByClassName(verticalCaptionContainer, FormLayoutConsts.CAPTION_CELL_SYSTEM_CLASS_NAME, c
21439ontainer)[0]; 21440 return result; 21441 }, 21442 getVerticalHelpTextCellHeight: function(container) { 21443 var verticalHelpTextCell = this.getVerticalHelpTextCell(container); 21444 return verticalHelpTextCell ? verticalHelpTextCell.offsetHeight : 0; 21445 }, 21446 getVerticalHelpTextCell: function(container) { 21447 var result = ASPxClientFormLayoutUtils.getContainerElementNodesByPredicate(container, function(element) { 21448 return ASPx.ElementContainsCssClass(element, FormLayoutVerticalHelpTextsCssClasses[0]) 21449 || ASPx.ElementContainsCssClass(element, FormLayoutVerticalHelpTextsCssClasses[1]); 21450 }, container)[0]; 21451 return result; 21452 }, 21453 getContainerPaddings: function(container, itemCell) { 21454 var containerChildElement = ASPx.GetChildByTagName(container, "DIV", 0) || ASPx.GetChildByTagName(container, "TABLE", 0); 21455 var containerPaddings = ASPx.GetTopBottomPaddings(containerChildElement); 21456 if(containerChildElement !== itemCell) 21457 containerPaddings += ASPx.GetTopBottomPaddings(itemCell); 21458 return containerPaddings; 21459 }, 21460 getContainerOffsetHeight: function(container) { 21461 var parentNode = ASPx.GetParentByPartialClassName(container, FormLayoutConsts.GROUP_CELL_PARTIAL_CLASS_NAME); 21462 return ASPx.GetClearClientHeight(parentNode); 21463 }, 21464 getCorrectingHeightCell: function(container, controlCell) { 21465 return controlCell; 21466 } 21467 }); 21468 var FullHeightAdaptiveItemHelper = ASPx.CreateClass(FullHeightTableItemHelper, { 21469 constructor: function(mainElement) { 21470 this.constructor.prototype.constructor.call(this, mainElement); 21471 this.rowHeights = []; 21472 this.breakpointKey = ""; 21473 this.rowLastCellIndices = []; 21474 this.isSingleColumnLayout = false; 21475 }, 21476 initializeHelperState: function(cellsInfo) { 21477 FullHeightTableItemHelper.prototype.initializeHelperState.call(this, cellsInfo); 21478 this.rowLastCellIndices = cellsInfo.rowLastCellIndices; 21479 this.breakpointKey = cellsInfo.breakpointKey; 21480 this.isSingleColumnLayout = cellsInfo.cells.length === cellsInfo.rows.length; 21481 }, 21482 resetHelperState: function() { 21483 FullHeightTableItemHelper.prototype.resetHelperState.call(this); 21484 this.breakpointKey = ""; 21485 this.rowLastCellIndices = []; 21486 this.rowHeights = []; 21487 this.isSingleColumnLayout = false; 21488 }, 21489 SetCellsFullHeightCore: function(index, container) { 21490 if(container.style.width !== "100%") 21491 this.setCellFullHeight(index); 21492 FullHeightTableItemHelper.prototype.SetCellsFullHeightCore.call(this, index, container); 21493 }, 21494 setCellFullHeight: function(index) { 21495 var container = this.cells[index]; 21496 var rowSpan = this.getCellRowSpan(container); 21497 var rowHeight = this.getRowHeightByCellIndex(index); 21498 var height = rowHeight; 21499 if(rowSpan > 1) { 21500 var nextRowsHeight = this.getNextRowsHeight(index, rowSpan - 1); 21501 height += nextRowsHeight; 21502 var marginBottom = Math.max(container.offsetHeight *(1 - 1/rowSpan), nextRowsHeight); 21503 container.style.marginBottom = -marginBottom + "px"; 21504 } 21505 var heightAttribute = height + "px"; 21506 if(height === 0) 21507 heightAttribute = ""; 21508 container.style.height = heightAttribute; 21509 }, 21510 getRowHeightByCellIndex: function(index) { 21511 var rowIndex = this.getRowIndexByCellIndex(index); 21512 return this.getRowHeight(rowIndex); 21513 }, 21514 getNextRowsHeight: function(index, count) { 21515 var rowIndex = this.getRowIndexByCellIndex(index); 21516 var result = 0; 21517 for(var i = 0; i < count; i++) 21518 result += this.getRowHeight(rowIndex + 1 + i); 21519 return result; 21520 }, 21521 getPreviousRowHeights: function(rowIndex, count) { 21522 var result = 0; 21523 for(var i = 0; i < count; i++) 21524 result += this.getCachedRowHeight(rowIndex - 1 - i); 21525 return result; 21526 }, 21527 getRowHeight: function(rowIndex) { 21528 if(!this.rows[rowIndex]) 21529 return 0; 21530 var result = this.getCachedRowHeight(rowIndex); 21531 if(result !== 0) 21532 return result; 21533 var heights = []; 21534 for(var i = 0; i <= rowIndex; i++) { 21535 var row = this.rows[i]; 21536 for(var j = 0; j < row.length; j++) { 21537 var height = this.getRowHeightCore(i, row[j], rowIndex); 21538 if(height !== 0) 21539 heights.push(height); 21540 } 21541 } 21542 result = Math.max.apply(null, heights); 21543 this.rowHeights[rowIndex] = result; 21544 return result; 21545 }, 21546 getRowHeightCore: function(rowIndex, cellElement, currentRowIndex) { 21547 var rowSpan = this.getCellRowSpan(cellElement); 21548 var unoccupiedRowSpan = rowIndex + rowSpan - currentRowIndex; 21549 if(unoccupiedRowSpan <= 0) 21550 return 0; 21551 var previousRowHeights = this.getPreviousRowHeights(currentRowIndex, rowSpan - unoccupiedRowSpan); 21552 var extraCellHeightOverPreviousRow = cellElement.offsetHeight - previousRowHeights; 21553 var unoccupiedElementHeight = extraCellHeightOverPreviousRow > 0 ? extraCellHeightOverPreviousRow : 0; 21554 return unoccupiedElementHeight / unoccupiedRowSpan; 21555 }, 21556 getCachedRowHeight: function(rowIndex) { 21557 var rowHeight = this.rowHeights[rowIndex]; 21558 if(isNaN(rowHeight)) 21559 rowHeight = 0; 21560 return rowHeight; 21561 }, 21562 getCorrectingHeightCell: function(container, controlCell) { 21563 var verticalHelpTextCell = this.getVerticalHelpTextCell(container); 21564 if(!verticalHelpTextCell) 21565 return controlCell; 21566 var internalTable = ASPxClientFormLayoutUtils.getContainerElementNodesByPartialClassName(container, "dxflInternalEditorTable", container)[0]; 21567 return ASPx.RetrieveByPredicate(ASPx.GetChildNodesByTagName(internalTable, "DIV"), 21568 function (element) { return element != verticalHelpTextCell; } 21569 )[0]; 21570 }, 21571 resetInlineMargins: function(cellContainer) { 21572 if(cellContainer.style.marginLeft) 21573 cellContainer.style.marginLeft = ""; 21574 if(cellContainer.style.marginBottom) 21575 cellContainer.style.marginBottom = ""; 21576 }, 21577 resetInlineHeight: function(cellContainer) { 21578 this.ensureNestedControlCellHeight(cellContainer, true); 21579 if(cellContainer.style.height) 21580 cellContainer.style.height = ""; 21581 }, 21582 resetInlineWidth: function(cellContainer) { 21583 if(cellContainer.style.width) 21584 cellContainer.style.width = ""; 21585 }, 21586 getRowIndexByCellIndex: function(index) { 21587 return ASPxClientFormLayoutUtils.getRowIndexByCellIndex(index, this.rowLastCellIndices); 21588 }, 21589 needInitializeHelperState: function(cellsInfo) { 21590 return FullHeightTableItemHelper.prototype.needInitializeHelperState.call(this, cellsInfo) && cellsInfo.rowLastCellIndices; 21591 }, 21592 getNestedControlCellHeightCore: function(container, itemCell) { 21593 var result = FullHeightTableItemHelper.prototype.getNestedControlCellHeightCore.call(this, container, itemCell); 21594 var verticalHelpTextCellHeight = this.getVerticalHelpTextCellHeight(container); 21595 result = result - verticalHelpTextCellHeight; 21596 return result; 21597 }, 21598 haveAllRowNestedControlsFloatHeight: function() { 21599 return false; 21600 }, 21601 getContainerOffsetHeight: function(container) { 21602 var rowIndex = this.getContainerRowIndex(container); 21603 var otherRowsHeight = this.getRowsHeight(rowIndex); 21604 return Math.max(container.offsetHeight, ASPx.GetClearClientHeight(container.parentNode) - otherRowsHeight); 21605 }, 21606 getContainerRowIndex: function(container) { 21607 var result = 0; 21608 for(var i = 0, row; row = this.rows[i]; i++) { 21609 if(row == container || ASPx.Data.ArrayContains(row, container)) { 21610 result = i; 21611 break; 21612 } 21613 } 21614 return result; 21615 }, 21616 getRowsHeight: function(excludedRowIndex) { 21617 var result = 0; 21618 for(var i = 0, row; row = this.rows[i]; i++) { 21619 if(i == excludedRowIndex) 21620 continue; 21621 var rowHeight = 0; 21622 for(var j = 0, cell; cell = row[j]; j++) { 21623 var cellOffsetHeight = cell.offsetHeight; 21624 if(cellOffsetHeight > rowHeight) 21625 rowHeight = cellOffsetHeight; 21626 } 21627 result += rowHeight; 21628 } 21629 return result; 21630 }, 21631 getCellRowSpan: function(cell) { 21632 var rowSpan = 1; 21633 if(!this.isSingleColumnLayout) 21634 rowSpan = ASPxClientFormLayoutUtils.getCellRowSpan(cell, this.breakpointKey); 21635 return rowSpan; 21636 }, 21637 ensureGroupBoxCellHeight: function() { } 21638 }); 21639 var TableGroupLayoutHelper = ASPx.CreateClass(null, { 21640 constructor: function(formLayout) { 21641 this.formLayout = formLayout; 21642 this.areGroupsAligned = false; 21643 this.groupElementClassName = FormLayoutConsts.GROUP_SYSTEM_CLASS_NAME; 21644 }, 21645 RecalculateLayout: function() { 21646 this.ensureGroupsLayout(); 21647 this.ensureCaptionsAlignment(); 21648 }, 21649 ensureCaptionsAlignment: function() { 21650 if(this.AreCaptionsAligned()) 21651 return; 21652 var mainElement = this.formLayout.GetMainElement(); 21653 this.formLayout.alignGroupsInContainer(mainElement); 21654 }, 21655 ensureGroupsLayout: function() {
21656 var groups = this.getSortedVisibleGroups(); 21657 for(var i = 0; i < groups.length; i++) { 21658 var groupInfo = this.getGroupInfo(groups[i]); 21659 var resizingHandler = this.getResizingHandler(groupInfo); 21660 this.areGroupsAligned = resizingHandler.EnsureCellsLayout(groupInfo) && this.areGroupsAligned; 21661 } 21662 }, 21663 getSortedVisibleGroups: function() { 21664 var result = this.getVisibleGroups(); 21665 return result.sort(function(a, b) { 21666 var predicate = function(node) { return node.id; }; 21667 var aContainer = ASPx.GetParent(a, predicate); 21668 var bContainer = ASPx.GetParent(b, predicate); 21669 var aDepth = aContainer.id.split(FormLayoutConsts.ITEM_PATH_SEPARATOR).length; 21670 var bDepth = bContainer.id.split(FormLayoutConsts.ITEM_PATH_SEPARATOR).length; 21671 return bDepth - aDepth; 21672 }); 21673 }, 21674 getVisibleGroups: function() { 21675 var mainElement = this.formLayout.GetMainElement(); 21676 var groups = ASPxClientFormLayoutUtils.getElementNodesByClassName(mainElement, this.groupElementClassName, mainElement); 21677 return groups.filter(function(groupElement) { return ASPx.IsElementVisible(groupElement); }); 21678 }, 21679 getGroupInfo: function(group) { 21680 return { group: group }; 21681 }, 21682 getResizingHandler: function(groupInfo) { 21683 return new TableResizingHandler(this, this.formLayout.GetMainElement()); 21684 }, 21685 AreCaptionsAligned: function() { return this.areGroupsAligned; } 21686 }); 21687 var AdaptiveGroupLayoutHelper = ASPx.CreateClass(TableGroupLayoutHelper, { 21688 constructor: function(formLayout) { 21689 this.constructor.prototype.constructor.call(this, formLayout); 21690 this.formLayoutOffsetWidth = 0; 21691 this.areGroupsAligned = true; 21692 this.isSingleColumnLayout = null; 21693 this.groupElementClassName = FormLayoutConsts.GROUP_CONTAINER_SYSTEM_CLASS_NAME; 21694 }, 21695 RecalculateLayout: function(force) { 21696 this.prepareHelperState(force); 21697 TableGroupLayoutHelper.prototype.RecalculateLayout.call(this); 21698 }, 21699 prepareHelperState: function(force) { 21700 this.formLayoutOffsetWidth = this.formLayout.GetMainElement().offsetWidth; 21701 this.force = force; 21702 this.isSingleColumnLayout = null; 21703 this.areGroupsAligned = true; 21704 }, 21705 getResizingHandler: function(groupInfo) { 21706 var layoutChangeType = this.getLayoutChangeType(groupInfo); 21707 var mainElement = this.formLayout.GetMainElement(); 21708 switch(layoutChangeType) { 21709 case LayoutChangeType.SingleColumn: 21710 return new SingleColumnResizingHandler(this, mainElement); 21711 case LayoutChangeType.Breakpoint: 21712 return new BreakpointResizingHandler(this, mainElement); 21713 default: 21714 return new RegularResizingHandler(this, mainElement); 21715 } 21716 }, 21717 getLayoutChangeType: function(groupInfo) { 21718 var result = LayoutChangeType.None; 21719 if(this.force || this.isBreakpointChanged(groupInfo)) { 21720 if(this.IsSingleColumnLayout()) 21721 result = LayoutChangeType.SingleColumn; 21722 else 21723 result = LayoutChangeType.Breakpoint; 21724 } 21725 return result; 21726 }, 21727 getSortedVisibleGroups: function() { 21728 var result = this.getVisibleGroups(); 21729 return result.sort(function(a, b) { 21730 var aDepth = a.id.split(FormLayoutConsts.ITEM_PATH_SEPARATOR).length; 21731 var bDepth = b.id.split(FormLayoutConsts.ITEM_PATH_SEPARATOR).length; 21732 return bDepth - aDepth; 21733 }); 21734 }, 21735 getGroupInfo: function(group) { 21736 var breakpointInfo = ASPxClientFormLayoutUtils.getBreakpointInfo(group, this.formLayoutOffsetWidth); 21737 var requiredColumnCount = this.getRequiredColumnCount(group, breakpointInfo); 21738 return { 21739 group: group, 21740 breakpointInfo: breakpointInfo, 21741 requiredColumnCount: requiredColumnCount 21742 }; 21743 }, 21744 isBreakpointChanged: function(groupInfo) { 21745 var currentBreakpoint = ASPxClientFormLayoutUtils.getCurrentBreakpoint(groupInfo.group); 21746 if(this.IsSingleColumnLayout() && currentBreakpoint == FormLayoutConsts.SINGLE_COLUMN_BREAKPOINT_NAME) 21747 return false; 21748 return currentBreakpoint !== this.getRequiredBreakpoint(groupInfo); 21749 }, 21750 getRequiredBreakpoint: function(groupInfo) { 21751 if(this.IsSingleColumnLayout()) 21752 return FormLayoutConsts.SINGLE_COLUMN_BREAKPOINT_NAME; 21753 return groupInfo.breakpointInfo.breakpointKey; 21754 }, 21755 IsSingleColumnLayout: function() { 21756 if(this.isSingleColumnLayout === null) 21757 this.isSingleColumnLayout = ASPx.GetCurrentDocumentWidth() <= this.formLayout.switchToSingleColumnAtWindowInnerWidth; 21758 return this.isSingleColumnLayout; 21759 }, 21760 getRequiredColumnCount: function(group, breakpointInfo) { 21761 var result = 1;
21762 if(this.IsSingleColumnLayout()) 21763 return result; 21764 if(breakpointInfo.breakpoint) { 21765 var colCountIndex = 2; 21766 result = breakpointInfo.breakpoint[colCountIndex]; 21767 } else 21768 result = ASPxClientFormLayoutUtils.getGroupCurrentColCount(group); 21769 return result; 21770 } 21771 }); 21772 var TableResizingHandler = ASPx.CreateClass(null, { 21773 constructor: function(groupHelper, mainElement) { 21774 this.heightHelper = null; 21775 this.groupHelper = groupHelper; 21776 this.classHelper = new ApplyEdgeClassHelper(); 21777 this.mainElement = mainElement; 21778 this.group = null; 21779 this.groupCells = null; 21780 this.areGroupsAligned = false; 21781 }, 21782 EnsureCellsLayout: function(groupInfo) { 21783 this.prepareHelperState(groupInfo); 21784 this.ensureCaptionLocation(); 21785 this.adjustCellContainers(); 21786 return this.areGroupsAligned; 21787 }, 21788 prepareHelperState: function(groupInfo) { 21789 this.group = groupInfo.group; 21790 this.groupCells = this.getGroupCells(); 21791 this.requiredColumnCount = groupInfo.requiredColumnCount; 21792 }, 21793 getGroupCells: function() { 21794 var result = []; 21795 for(var i = 0, row; row = this.group.rows[i]; i++) 21796 result = result.concat(Array.prototype.slice.call(row.cells)); 21797 return result; 21798 }, 21799 adjustCellContainers: function() { 21800 if(!this.groupCells) 21801 return; 21802 this.groupCells = this.groupCells.filter(function(cell) { 21803 return ASPx.GetElementDisplay(cell); 21804 }); 21805 this.adjustCellContainersCore(this.groupCells.length); 21806 this.applyEdgeClassesAndFullHeight(); 21807 }, 21808 applyEdgeClassesAndFullHeight: function() { 21809 var cellsRects = []; 21810 if(this.groupCells.length > 1) 21811 cellsRects = this.getCellsClientRects(); 21812 this.classHelper.ApplyEdgeTopClass(this.groupCells, cellsRects); 21813 this.classHelper.ApplyEdgeLeftClass(this.groupCells, cellsRects); 21814 this.classHelper.ApplyEdgeRightClass(this.groupCells, cellsRects); 21815 this.classHelper.ApplyLastGroupItemClass(this.groupCells); 21816 this.applyEdgeBottomClassAndFullHeight(cellsRects); 21817 }, 21818 applyEdgeBottomClassAndFullHeight: function(cellsRects) { 21819 this.classHelper.ApplyEdgeBottomClass(this.groupCells, cellsRects); 21820 this.SetCellsFullHeight(); 21821 }, 21822 SetCellsFullHeight: function() { 21823 this.getHeightHelper().SetCellsFullHeight(this.getCellsInfo()); 21824 }, 21825 getCellsClientRects: function() { 21826 var result = []; 21827 for(var i = 0; i < this.groupCells.length; i++) { 21828 var groupCell = this.groupCells[i]; 21829 var clientRect = groupCell.getBoundingClientRect(); 21830 result.push(clientRect); 21831 ASPx.Attr.SetAttribute(groupCell, "data-left", clientRect.left); 21832 } 21833 return result; 21834 }, 21835 getCellsInfo: function() { 21836 return { 21837 cells: this.groupCells, 21838 rows: this.group.rows 21839 }; 21840 }, 21841 getHeightHelper: function() { 21842 if(!this.heightHelper) 21843 this.heightHelper = this.getHeightHelperCore(); 21844 return this.heightHelper; 21845 }, 21846 getHeightHelperCore: function() { 21847 return new FullHeightTableItemHelper(this.mainElement); 21848 }, 21849 adjustCellContainersCore: function() { 21850 var groupCellsLength = this.groupCells.length; 21851 for(var i = 0; i < groupCellsLength; i++) 21852 this.removeElementClassNames(this.groupCells[i]); 21853 }, 21854 removeElementClassNames: function(cellContainer) { 21855 this.classHelper.RemoveElementClassNames(cellContainer); 21856 }, 21857 ensureCaptionLocation: function() { } 21858 }); 21859 var RegularResizingHandler = ASPx.CreateClass(TableResizingHandler, { 21860 constructor: function(groupHelper, mainElement) { 21861 this.constructor.prototype.constructor.call(this, groupHelper, mainElement); 21862 this.breakpointInfo = ASPxClientFormLayoutUtils.getDefaultBreakpointInfo(); 21863 this.rows = []; 21864 this.cellsWidth = []; 21865 this.rowLastCellIndices = []; 21866 this.busyWidthIntervals = []; 21867 this.isStretchLastItem = null; 21868 this.requiredColumnCount = 0; 21869 this.areGroupsAligned = true; 21870 }, 21871 EnsureCellsLayout: function(groupInfo) { 21872 this.areGroupsAligned = TableResizingHandler.prototype.EnsureCellsLayout.call(this, groupInfo) && this.areGroupsAligned; 21873 this.setCurrentBreakpoint(); 21874 return this.areGroupsAligned; 21875 }, 21876 prepareHelperState: function(groupInfo) { 21877 this.isStretchLastItem = null; 21878 this.breakpointInfo = groupInfo.breakpointInfo; 21879 TableResizingHandler.prototype.prepareHelperState.call(this, groupInfo); 21880 }, 21881 ensureCaptionLocation: function() { 21882 var verticalCaptionPositionWidth = this.GetVerticalCaptionPositionWidth(); 21883 var isSingleColumnLayout = this.groupHelper.IsSingleColumnLayout(); 21884 var isVerticalCaptionsCurrentState = this.IsVerticalCaptionsCurrentState(); 21885 var formLayoutWidth = this.groupHelper.formLayoutOffsetWidth; 21886 var isVerticalPositionRequired = formLayoutWidth < verticalCaptionPositionWidth; 21887 if((isVerticalPositionRequired || isSingleColumnLayout) && !isVerticalCaptionsCurrentState) 21888 this.SetVerticalItemCaptionsState(true); 21889 else if((!isVerticalPositionRequired && !isSingleColumnLayout) && isVerticalCaptionsCurrentState) 21890 this.SetVerticalItemCaptionsState(false); 21891 }, 21892 GetVerticalCaptionPositionWidth: function() { 21893 var result = parseInt(ASPx.Attr.GetAttribute(this.group, "data-wrapCaption")); 21894 if(isNaN(result)) 21895 result = -1; 21896 return result; 21897 }, 21898 IsVerticalCaptionsCurrentState: function() { 21899 var groupContainer = this.GetGroupContainer(); 21900 if(groupContainer) 21901 return !!ASPx.Attr.GetAttribute(groupContainer, "data-itemVertCaptions"); 21902 }, 21903 IsStretchLastItem: function() { 21904 if(this.isStretchLastItem === null) 21905 this.isStretchLastItem = !!ASPx.Attr.GetAttribute(this.group, "data-stretchLastItem"); 21906 return this.isStretchLastItem; 21907 }, 21908 setCurrentBreakpoint: function() { 21909 var attribute = this.breakpointInfo.breakpointKey;
21910 if(this.groupHelper.IsSingleColumnLayout()) 21911 attribute = FormLayoutConsts.SINGLE_COLUMN_BREAKPOINT_NAME; 21912 if(attribute != ASPxClientFormLayoutUtils.getCurrentBreakpoint(this.group)) 21913 ASPx.Attr.SetAttribute(this.group, "data-currentBreakpoint", attribute); 21914 }, 21915 adjustCellContainersCore: function(count) { 21916 for(var i = 0; i < count; i++) 21917 this.adjustCellContainer(i); 21918 }, 21919 applyEdgeClassesAndFullHeight: function() { 21920 this.SetCellsFullHeight(); 21921 }, 21922 getCellsInfo: function() { 21923 return { 21924 breakpointKey: this.breakpointInfo.breakpointKey, 21925 cells: this.groupCells, 21926 rowLastCellIndices: this.rowLastCellIndices, 21927 rows: this.rows 21928 }; 21929 }, 21930 adjustCellContainer: function(index) { 21931 var cellContainer = this.groupCells[index]; 21932 this.removeElementClassNames(cellContainer); 21933 this.getHeightHelper().resetInlineHeight(cellContainer); 21934 if(!this.groupHelper.IsSingleColumnLayout()) 21935 this.adjustCellContainerCore(index); 21936 else 21937 this.prepareSingleColumnCellsInfo(); 21938 }, 21939 removeElementClassNames: function(cellContainer) { }, 21940 prepareSingleColumnCellsInfo: function() { 21941 this.rows = this.groupCells.map(function(cell) { return [cell]; }); 21942 for(var i = 0; i < this.groupCells.length; i++) 21943 this.rowLastCellIndices.push(i); 21944 }, 21945 adjustCellContainerCore: function(index) { 21946 var cellContainer = this.groupCells[index]; 21947 if(this.IsFirstCellInRow(index)) 21948 this.onPrepareFirstCellInRow(cellContainer); 21949 this.onSetGroupCellWidth(index); 21950 if(this.IsLastCellInRow(index)) 21951 this.onPrepareLastCellInRow(index); 21952 }, 21953 onPrepareLastCellInRow: function(index) { 21954 this.rowLastCellIndices.push(index); 21955 }, 21956 onSetGroupCellWidth: function(index) { 21957 var cellContainer = this.groupCells[index]; 21958 var cellWidth = this.getGroupCellWidth(index); 21959 var marginLeft = this.getMarginLeft(index, cellWidth);
21960 this.setCellStyleProperties(cellContainer, cellWidth, marginLeft); 21961 this.CacheCellInfo(cellContainer, cellWidth + marginLeft); 21962 this.prepareBusyWidthIntervals(index, cellWidth, marginLeft); 21963 }, 21964 setCellStyleProperties: function(cellContainer, cellWidth, marginLeft) { }, 21965 prepareBusyWidthIntervals: function(index, cellWidth, marginLeft) { 21966 var cellContainer = this.groupCells[index]; 21967 var rowSpan = ASPxClientFormLayoutUtils.getCellRowSpan(cellContainer, this.breakpointInfo.breakpointKey); 21968 if(rowSpan > 1) { 21969 var rowWidth = this.GetRowWidth(index - 1) + marginLeft; 21970 this.addBusyWidthInterval(index, rowSpan, rowWidth, cellWidth); 21971 } 21972 }, 21973 getMarginLeft: function(index, cellWidth) { 21974 var result = 0; 21975 var busyWidthIntervals = this.getbusyWidthIntervals(index); 21976 if(!busyWidthIntervals) 21977 return result; 21978 var rowWidth = this.GetRowWidth(index); 21979 for(var i = 0; i < busyWidthIntervals.length; i++) { 21980 var busyWidthInterval = busyWidthIntervals[i]; 21981 result = this.getMarginLeftCore(busyWidthInterval, rowWidth, cellWidth, result); 21982 } 21983 return result; 21984 }, 21985 getMarginLeftCore: function(busyWidthInterval, rowWidth, cellWidth, result) { 21986 var beginCellWidth = rowWidth; 21987 var endCellWidth = beginCellWidth + cellWidth; 21988 var beginBusyWidth = busyWidthInterval[0]; 21989 var endBusyWidth = beginBusyWidth + busyWidthInterval[1]; 21990 while(beginCellWidth + result <= beginBusyWidth && endCellWidth + result > beginBusyWidth || 21991 beginCellWidth + result >= beginBusyWidth && endCellWidth + result <= endBusyWidth || 21992 beginCellWidth + result < endBusyWidth && endCellWidth + result > endBusyWidth) 21993 result = endBusyWidth - rowWidth; 21994 return result; 21995 }, 21996 getGroupCellWidth: function(index) { 21997 if(this.cellsWidth[index] !== undefined) 21998 return this.cellsWidth[index]; 21999 var cellContainer = this.groupCells[index]; 22000 var colSpan = ASPxClientFormLayoutUtils.getCellColSpan(cellContainer, this.breakpointInfo.breakpointKey); 22001 if(colSpan > this.requiredColumnCount) 22002 colSpan = this.requiredColumnCount; 22003 var result = colSpan * 100 / this.requiredColumnCount; 22004 if(this.IsLastCellInGroup(index) && colSpan == 1 && this.IsStretchLastItem()) 22005 result = this.GetStretchedLastItemWidth(); 22006 return result; 22007 }, 22008 addBusyWidthInterval: function(index, rowSpan, rowWidth, width) { 22009 var rowIndex = this.getRowIndexByCellIndex(index); 22010 for(var i = rowIndex + 1; i < rowIndex + rowSpan; i++) { 22011 var busyWidthInterval = [rowWidth, width]; 22012 var currentRowIndex = i.toString(); 22013 if(!this.busyWidthIntervals[currentRowIndex]) 22014 this.busyWidthIntervals[currentRowIndex] = []; 22015 this.busyWidthIntervals[currentRowIndex].push(busyWidthInterval); 22016 } 22017 }, 22018 IsFirstCellInRow: function(index) { 22019 return index === this.GetRowLastCellIndex(index) + 1; 22020 }, 22021 IsLastCellInRow: function(index) { 22022 if(this.IsLastCellInGroup(index)) 22023 return true; 22024 var currentRowWidth = this.GetRowWidth(index); 22025 var nextItemWidth = this.getGroupCellWidth(index + 1); 22026 var fullNextItemWidth = nextItemWidth + this.getMarginLeft(index + 1, nextItemWidth, true); 22027 return Math.floor(currentRowWidth + fullNextItemWidth) > 100; 22028 }, 22029 IsLastCellInGroup: function(index) { 22030 return index == this.groupCells.length - 1; 22031 }, 22032 GetRowWidth: function(index) { 22033 var result = 0; 22034 var lastEndRowCellIndex = this.GetRowLastCellIndex(index); 22035 for(var i = index; i > lastEndRowCellIndex; i--) 22036 if(this.cellsWidth[i]) 22037 result += this.cellsWidth[i]; 22038 return result; 22039 }, 22040 GetRowLastCellIndex: function(index) { 22041 var lastEndRowCellIndex = -1; 22042 for(var i = this.rowLastCellIndices.length - 1; i >= 0; i--) { 22043 var lastCellIndex = this.rowLastCellIndices[i]; 22044 if(index >= lastCellIndex) { 22045 lastEndRowCellIndex = lastCellIndex; 22046 break; 22047 } 22048 } 22049 return lastEndRowCellIndex; 22050 }, 22051 GetStretchedLastItemWidth: function() { 22052 var cellIndex = this.groupCells.length - 1; 22053 var previousItemWidth = this.GetRowWidth(cellIndex); 22054 var endWidth = 100; 22055 var busyWidthIntervals = this.getbusyWidthIntervals(cellIndex); 22056 if(busyWidthIntervals) { 22057 for(var i = 0; i < busyWidthIntervals.length; i++) { 22058 var busyWidthInterval = busyWidthIntervals[i]; 22059 var beginBusyWidth = busyWidthInterval[0]; 22060 var endBusyWidth = busyWidthInterval[0] + busyWidthInterval[1]; 22061 if(endWidth > beginBusyWidth && previousItemWidth < beginBusyWidth) 22062 endWidth = beginBusyWidth; 22063 if(previousItemWidth >= beginBusyWidth && previousItemWidth < endBusyWidth) 22064 previousItemWidth = endBusyWidth; 22065 } 22066 } 22067 return endWidth - previousItemWidth % 100; 22068 }, 22069 getbusyWidthIntervals: function(cellIndex) { 22070 var rowIndex = this.getRowIndexByCellIndex(cellIndex); 22071 var busyWidthIntervals = this.busyWidthIntervals[rowIndex]; 22072 return busyWidthIntervals && busyWidthIntervals.sort(function(a, b) { 22073 return a[0] - b[0]; 22074 }); 22075 }, 22076 onPrepareFirstCellInRow: function(cellContainer) { 22077 this.rows.push([]); 22078 ASPx.AddClassNameToElement(cellContainer, FormLayoutConsts.NOT_FLOATED_ELEMENT_SYSTEM_CLASS_NAME); 22079 }, 22080 CacheCellInfo: function(cellContainer, width) { 22081 this.cellsWidth.push(width); 22082 this.rows[this.rows.length - 1].push(cellContainer); 22083 }, 22084 SetVerticalItemCaptionsState: function(enabled) { 22085 var groupContainer = this.GetGroupContainer();
22086 this.groupHelper.formLayout.UpdateItemsCssClasses(enabled); 22087 if(!groupContainer) 22088 return; 22089 if(enabled) 22090 ASPx.Attr.SetAttribute(groupContainer, "data-itemVertCaptions", true); 22091 else 22092 ASPx.Attr.RemoveAttribute(groupContainer, "data-itemVertCaptions"); 22093 var changeClassNameMethod = enabled ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement; 22094 var groupChildLayoutItemElements = this.GetGroupChildLayoutItemElements(); 22095 for(var i = 0; i < groupChildLayoutItemElements.length; i++) 22096 changeClassNameMethod(groupChildLayoutItemElements[i], FormLayoutConsts.ITEM_IN_ADAPTIVE_VIEW); 22097 this.updateItemCaptionsClassNames(enabled, groupChildLayoutItemElements); 22098 this.updateHelpTextClassNames(enabled); 22099 this.areGroupsAligned = false; 22100 }, 22101 getGroupCells: function() { 22102 var result = null; 22103 var groupContainer = this.GetGroupContainer(); 22104 if(groupContainer) 22105 result = ASPx.GetChildNodesByTagName(groupContainer, "DIV"); 22106 return result; 22107 }, 22108 GetGroupContainer: function() {
22109 var isRootGroup = ASPx.Attr.GetAttribute(this.group, "data-groupID"); 22110 return isRootGroup ? this.group : this.GetGroupContainerCore(); 22111 }, 22112 GetGroupContainerCore: function() { 22113 var nestedGroups = Array.prototype.slice.call(this.group.querySelectorAll("[data-groupID]")); 22114 var mainElement = this.group; 22115 return nestedGroups.filter(function(el) { 22116 return !ASPxClientFormLayoutUtils.isElementContainedInNestedItem(el, mainElement); 22117 })[0]; 22118 }, 22119 GetGroupChildLayoutItemElements: function() { 22120 if(!this.groupToChildLayoutItemElementsMap) 22121 this.groupToChildLayoutItemElementsMap = {}; 22122 if(!ASPx.IsExists(this.groupToChildLayoutItemElementsMap[ASPx.Attr.GetAttribute(this.group, "data-groupID")])) { 22123 var layoutItemElementsWithHorizontalCaptions = this.groupHelper.formLayout.GetLayoutItemElementsWithHorizontalCaptions(); 22124 var groupChildLayoutItemElementsWithHorizontalCaptions = []; 22125 for(var i = 0; i < layoutItemElementsWithHorizontalCaptions.length; i++) { 22126 var layoutItemWithHorCaption = layoutItemElementsWithHorizontalCaptions[i]; 22127 if(ASPx.GetParentByClassName(layoutItemWithHorCaption, FormLayoutConsts.GROUP_CONTAINER_SYSTEM_CLASS_NAME) == this.group 22128 && !ASPx.Attr.GetAttribute(layoutItemWithHorCaption, "data-fixedCaptionLocation")) 22129 groupChildLayoutItemElementsWithHorizontalCaptions.push(layoutItemWithHorCaption); 22130 } 22131 this.groupToChildLayoutItemElementsMap[ASPx.Attr.GetAttribute(this.group, "data-groupID")] = groupChildLayoutItemElementsWithHorizontalCaptions; 22132 } 22133 return this.groupToChildLayoutItemElementsMap[ASPx.Attr.GetAttribute(this.group, "data-groupID")]; 22134 }, 22135 getRowIndexByCellIndex: function(index) { 22136 return ASPxClientFormLayoutUtils.getRowIndexByCellIndex(index, this.rowLastCellIndices); 22137 }, 22138 getHeightHelperCore: function() { 22139 return new FullHeightAdaptiveItemHelper(this.mainElement); 22140 }, 22141 updateItemCaptionsClassNames: function(fromHorizontalToVertical, itemElements) { 22142 var targetItemElements = itemElements || this.groupHelper.formLayout.GetLayoutItemElementsWithHorizontalCaptions(); 22143 var oldClasses = fromHorizontalToVertical ? FormLayoutHorizontalCaptionsCssClasses : FormLayoutVerticalCaptionsCssClasses; 22144 var newClasses = fromHorizontalToVertical ? FormLayoutVerticalCaptionsCssClasses : FormLayoutHorizontalCaptionsCssClasses; 22145 this.updateElementsCssClasses(targetItemElements, oldClasses, newClasses); 22146 }, 22147 updateHelpTextClassNames: function(fromHorizontalToVertical) { 22148 var targetItemElements = this.groupHelper.formLayout.GetHorizontalHelpTextElements(); 22149 var oldClasses = fromHorizontalToVertical ? FormLayoutHorizontalHelpTextsCssClasses : FormLayoutVerticalHelpTextsCssClasses; 22150 var newClasses = fromHorizontalToVertical ? FormLayoutVerticalHelpTextsCssClasses : FormLayoutHorizontalHelpTextsCssClasses; 22151 this.updateElementsCssClasses(targetItemElements, oldClasses, newClasses); 22152 }, 22153 updateElementsCssClasses: function (elements, oldCssClasses, newCssClasses) { 22154 for(var i = 0; i < elements.length; i++) { 22155 for(var j = 0; j < oldCssClasses.length; j++) 22156 elements[i].className = elements[i].className.replace(oldCssClasses[j], newCssClasses[j]); 22157 } 22158 } 22159 }); 22160 var SingleColumnResizingHandler = ASPx.CreateClass(RegularResizingHandler, { 22161 constructor: function(groupHelper, mainElement) { 22162 this.constructor.prototype.constructor.call(this, groupHelper, mainElement); 22163 this.areGroupsAligned = false; 22164 }, 22165 applyEdgeClassesAndFullHeight: function() { 22166 TableResizingHandler.prototype.applyEdgeClassesAndFullHeight.call(this); 22167 }, 22168 adjustCellContainer: function(index) { 22169 var cellContainer = this.groupCells[index]; 22170 this.getHeightHelper().resetInlineMargins(cellContainer); 22171 this.resetCellInlineWidth(cellContainer); 22172 RegularResizingHandler.prototype.adjustCellContainer.call(this, index); 22173 }, 22174 removeElementClassNames: function(cellContainer) { 22175 TableResizingHandler.prototype.removeElementClassNames.call(this, cellContainer); 22176 }, 22177 resetCellInlineWidth: function(cellContainer) { 22178 this.getHeightHelper().resetInlineWidth(cellContainer); 22179 } 22180 }); 22181 var BreakpointResizingHandler = ASPx.CreateClass(SingleColumnResizingHandler, { 22182 constructor: function(groupHelper, mainElement) { 22183 this.constructor.prototype.constructor.call(this, groupHelper, mainElement); 22184 }, 22185 setCellStyleProperties: function(cellContainer, cellWidth, marginLeft) { 22186 cellContainer.style.width = cellWidth + "%"; 22187 cellContainer.style.marginLeft = marginLeft + "%"; 22188 }, 22189 resetCellInlineWidth: function(cellContainer) { }, 22190 applyEdgeBottomClassAndFullHeight: function() { 22191 RegularResizingHandler.prototype.applyEdgeClassesAndFullHeight.call(this); 22192 this.classHelper.ApplyEdgeBottomClass(this.groupCells, this.getCellsClientRects()); 22193 }, 22194 getMarginLeft: function(index, cellWidth, isNextCell) { 22195 var result = SingleColumnResizingHandler.prototype.getMarginLeft.call(this, index, cellWidth);
22196 var isWrongLayout = !isNextCell && Math.floor(result + cellWidth) > 100; 22197 if(isWrongLayout) { 22198 try { 22199 this.tryCorrectWrongLayout(index); 22200 result = this.getMarginLeft(index, cellWidth, isNextCell); 22201 } 22202 catch(e) { 22203 var errorMessage = "A FormLayout's item has an incorrect RowSpan property value that cannot be corrected automatically. For detailed information, refer to http://www.devexpress.com/bcid=BC4454."; 22204 throw new Error(errorMessage); 22205 } 22206 } 22207 return result; 22208 }, 22209 recalculateCellsLayout: function(count) { 22210 this.rows = []; 22211 this.cellsWidth = []; 22212 this.rowLastCellIndices = []; 22213 this.busyWidthIntervals = []; 22214 this.adjustCellContainersCore(count); 22215 this.rows.push([]); 22216 }, 22217 tryCorrectWrongLayout: function(index) { 22218 this.decreaseRowSpan(index); 22219 this.recalculateCellsLayout(index); 22220 }, 22221 decreaseRowSpan: function(index) { 22222 var currentRowIndex = ASPxClientFormLayoutUtils.getRowIndexByCellIndex(index, this.rowLastCellIndices); 22223 for(var i = 0; i < index; i++) { 22224 var container = this.groupCells[i]; 22225 var rowSpan = ASPxClientFormLayoutUtils.getCellRowSpan(container, this.breakpointInfo.breakpointKey); 22226 var rowIndex = ASPxClientFormLayoutUtils.getRowIndexByCellIndex(i, this.rowLastCellIndices); 22227 var occupiedRowSpan = rowIndex + rowSpan - currentRowIndex; 22228 if(rowIndex !== currentRowIndex && occupiedRowSpan > 0) 22229 this.decreaseRowSpanCore(container); 22230 } 22231 }, 22232 decreaseRowSpanCore: function(cellContainer) { 22233 var spanRules = ASPxClientFormLayoutUtils.getCellSpanRules(cellContainer); 22234 var key = this.breakpointInfo.breakpointKey; 22235 var areSpanRulesExist = spanRules && spanRules[key]; 22236 if(areSpanRulesExist) { 22237 spanRules[key][1]--; 22238 ASPx.Attr.SetAttribute(cellContainer, "data-spanRules", JSON.stringify(spanRules)); 22239 } else { 22240 var currentRowSpan = ASPxClientFormLayoutUtils.getCellRowSpan(cellContainer); 22241 ASPx.Attr.SetAttribute(cellContainer, "data-rowSpan", currentRowSpan - 1); 22242 } 22243 } 22244 }); 22245 var AlignCaptionBaseStrategy = ASPx.CreateClass(null, { 22246 constructor: function(formLayout) { 22247 this.formLayout = formLayout; 22248 this.leftAndRightCaptionsWidth = formLayout.leftAndRightCaptionsWidth; 22249 this.alignItemCaptionsInAllGroups = formLayout.alignItemCaptionsInAllGroups; 22250 this.rtl = formLayout.rtl; 22251 this.firstCaptionElement = null; 22252 this.firstCaptionElementOffsetWidth = 0; 22253 }, 22254 AlignGroups: function(groupContainer) { 22255 if(this.leftAndRightCaptionsWidth === 0) { 22256 var groupElements = this.getGroupElements(groupContainer); 22257 if(this.alignItemCaptionsInAllGroups) 22258 this.alignGroupsTogether(groupElements); 22259 else 22260 this.alignGroupsSeparately(groupElements); 22261 } 22262 else 22263 this.alignLeftAndRightCaptionsIdentically(groupContainer); 22264 }, 22265 getGroupElements: function(parent) { 22266 return ASPxClientFormLayoutUtils.getElementNodesByClassName(parent, 22267 FormLayoutConsts.ALIGNED_GROUP_SYSTEM_CLASS_NAME, 22268 this.formLayout.GetMainElement()); 22269 }, 22270 alignLeftAndRightCaptionsIdentically: function(groupContainer) { 22271 var captionCells = ASPxClientFormLayoutUtils.getElementNodesByClassName(groupContainer, 22272 FormLayoutConsts.CAPTION_CELL_SYSTEM_CLASS_NAME, 22273 this.formLayout.GetMainElement()); 22274 for(var i = 0; i < captionCells.length; i++) 22275 if(this.isLeftOrRigthCaption(captionCells[i])) 22276 this.setCaptionCellWidth(captionCells[i], this.leftAndRightCaptionsWidth); 22277 }, 22278 isLeftOrRigthCaption: function(captionCell) { 22279 var itemElement = ASPx.GetParentByClassName(captionCell, FormLayoutConsts.ITEM_SYSTEM_CLASS_NAME); 22280 return this.formLayout.itemHasHorizontalCaption(itemElement); 22281 }, 22282 setCaptionCellWidth: function(captionCellElement, width) { 22283 var captionCellPaddings = ASPx.GetLeftRightBordersAndPaddingsSummaryValue(captionCellElement); 22284 ASPx.SetOffsetWidth(captionCellElement, width + captionCellPaddings); 22285 captionCellElement.style.minWidth = this.getCaptionMinWidth(captionCellElement, width) + "px";
22286 if(!this.formLayout.isFinallyInitialized && !ASPx.IsExists(this.firstCaptionElementOffsetWidth)) { 22287 var firstCaptionElement = ASPx.GetChildByPartialClassName(captionCellElement, FormLayoutConsts.LAYOUT_ITEM_CAPTION_PARTIAL_CLASS_NAME); 22288 if(firstCaptionElement) { 22289 this.firstCaptionElementOffsetWidth = firstCaptionElement.offsetWidth; 22290 this.firstCaptionElement = firstCaptionElement; 22291 } 22292 } 22293 }, 22294 getCaptionMinWidth: function(captionCell, width) { 22295 var result = width; 22296 var groupElement = this.getParentGroupElement(captionCell); 22297 var isVerticalCaptions = ASPx.Attr.GetAttribute(groupElement, "data-itemVertCaptions"); 22298 if(isVerticalCaptions) { 22299 var itemElement = ASPx.GetParentByClassName(captionCell, FormLayoutConsts.ITEM_SYSTEM_CLASS_NAME); 22300 var isFixedCaptionLocation = ASPx.Attr.GetAttribute(itemElement, "data-fixedCaptionLocation"); 22301 if(!isFixedCaptionLocation) 22302 result = 0; 22303 } 22304 return result; 22305 }, 22306 getParentGroupElement: function(element) { 22307 return ASPx.GetParentByClassName(element, FormLayoutConsts.GROUP_SYSTEM_CLASS_NAME); 22308 }, 22309 alignGroupsSeparately: function(groupElements) { 22310 for(var i = 0; i < groupElements.length; i++) 22311 this.alignGroup(groupElements[i]); 22312 }, 22313 alignGroupColumnCaptionCellWidths: function(cellElements) { 22314 var maxCaptionCellWidth = this.getGroupCellsMaxWidth(cellElements); 22315 this.setGroupCellsWidth(cellElements, maxCaptionCellWidth); 22316 }, 22317 getGroupCellsMaxWidth: function(cellElements) { 22318 var maxCaptionWidth = 0; 22319 var captionCellWithMaxCaption = null; 22320 for(var i = 0; i < cellElements.length; i++) { 22321 var captionInfo = this.getGroupCellCaptionInfo(cellElements[i]); 22322 if(captionInfo && maxCaptionWidth < captionInfo.captionWidth) { 22323 maxCaptionWidth = captionInfo.captionWidth; 22324 captionCellWithMaxCaption = captionInfo.captionCell; 22325 } 22326 } 22327 if(captionCellWithMaxCaption) { 22328 this.setCaptionCellWidth(captionCellWithMaxCaption, maxCaptionWidth); 22329 var captionCellWidth = ASPx.GetClearClientWidth(captionCellWithMaxCaption); 22330 return Math.max(captionCellWidth, maxCaptionWidth); 22331 } 22332 return maxCaptionWidth; 22333 }, 22334 getGroupCellCaptionInfo: function(groupCellElement) { 22335 if(groupCellElement) { 22336 var captionCellElement = this.getGroupCellCaptionElement(groupCellElement); 22337 if(captionCellElement) 22338 return { 22339 captionCell: captionCellElement, 22340 captionWidth: this.getCaptionCellChildrenWidth(captionCellElement) 22341 }; 22342 } 22343 return null; 22344 }, 22345 getGroupCellCaptionElement: function(groupCellElement) { 22346 var itemElement = this.getChildItemElement(groupCellElement); 22347 if(itemElement == null) 22348 return null; 22349 return this.getFormLayoutElementNodeByClassName(itemElement, FormLayoutConsts.CAPTION_CELL_SYSTEM_CLASS_NAME); 22350 }, 22351 getChildItemElement: function(groupCellElement) { 22352 var childTabbedGroupElement = null; 22353 if(this.alignItemCaptionsInAllGroups) 22354 childTabbedGroupElement = ASPx.GetChildByClassName(groupCellElement, FormLayoutConsts.TABBED_GROUP_SYSTEM_CLASS_NAME); 22355 return childTabbedGroupElement ? this.formLayout.findTabbedGroupChildItemElement(childTabbedGroupElement) : 22356 ASPx.GetChildByClassName(groupCellElement, FormLayoutConsts.ITEM_SYSTEM_CLASS_NAME); 22357 }, 22358 setGroupCellsWidth: function(cellElements, captionCellWidth) { 22359 for(var i = 0; i < cellElements.length; i++) 22360 this.setGroupCellCaptionElementWidth(cellElements[i], captionCellWidth); 22361 }, 22362 setGroupCellCaptionElementWidth: function(groupCellElement, width) { 22363 if(groupCellElement) { 22364 var captionCellElement = this.getGroupCellCaptionElement(groupCellElement); 22365 if(captionCellElement) 22366 this.setCaptionCellWidth(captionCellElement, width); 22367 } 22368 }, 22369 getFormLayoutElementNodeByClassName: function(parent, className, index) { 22370 var mainElement = this.formLayout.GetMainElement(); 22371 var nodes = ASPxClientFormLayoutUtils.getElementNodesByClassName(parent, className, mainElement); 22372 if(!index) index = 0; 22373 return nodes.length > index ? nodes[index] : null; 22374 }, 22375 getCaptionCellChildrenWidth: function(captionCellElement) { 22376 var result = 0; 22377 for(var i = 0; i < captionCellElement.childNodes.length; i++) 22378 if(captionCellElement.childNodes[i].offsetWidth) 22379 result += captionCellElement.childNodes[i].offsetWidth; 22380 if(result) 22381 return result; 22382 }, 22383 needAlignCaptionCells: function() { 22384 return this.firstCaptionElement && this.firstCaptionElement.offsetWidth !== this.firstCaptionElementOffsetWidth; 22385 } 22386 }); 22387 var AlignCaptionByOffsetStrategy = ASPx.CreateClass(AlignCaptionBaseStrategy, { 22388 constructor: function(formLayout) { 22389 this.constructor.prototype.constructor.call(this, formLayout); 22390 }, 22391 alignGroupsTogether: function(groupElements) { 22392 var containerElements = []; 22393 for(var i = 0; i < groupElements.length; i++) { 22394 var elementsToAlign = this.getElementsToAlign(groupElements[i]); 22395 containerElements = containerElements.concat(elementsToAlign); 22396 } 22397 this.alignElements(containerElements, null); 22398 }, 22399 alignGroup: function(groupElement) { 22400 var containerElements = this.getElementsToAlign(groupElement); 22401 this.alignElements(containerElements); 22402 }, 22403 alignElements: function(elements) { 22404 var columnStartOffsets = this.getUniqueStartOffsets(elements); 22405 var sameColumnElements = []; 22406 for(var i = 0; i < columnStartOffsets.length; i++) 22407 sameColumnElements.push(this.getSameColumnElements(elements, columnStartOffsets[i])); 22408 for(var i = 0; i < sameColumnElements.length; i++) 22409 this.alignGroupColumnCaptionCellWidths(sameColumnElements[i]); 22410 }, 22411 getElementsToAlign: function(groupElement) { 22412 var isVerticalCaptionLocation = ASPx.Attr.GetAttribute(groupElement, "data-itemVertCaptions"); 22413 var groupChildElements = this.getGroupChildElements(groupElement); 22414 var result = []; 22415 if(isVerticalCaptionLocation) { 22416 for(var i = 0; i < groupChildElements.length; i++) { 22417 var groupChildElement = groupChildElements[i]; 22418 var container = ASPxClientFormLayoutUtils.getChildDivAtNestedLevel(groupChildElement, 2); 22419 if(container && ASPx.Attr.GetAttribute(container, "data-fixedCaptionLocation")) 22420 result.push(groupChildElement); 22421 } 22422 } else 22423 result = groupChildElements.filter(function(c) {
22424 return !ASPxClientFormLayoutUtils.getVerticalCaptionContainer(c); 22425 }); 22426 return result; 22427 }, 22428 getGroupChildElements: function(groupElement) { 22429 return ASPx.GetChildNodesByTagName(groupElement, "DIV"); 22430 }, 22431 getSameColumnElements: function(elements, columnOffsetLeft) { 22432 var result = []; 22433 for(var i = 0; i < elements.length; i++) { 22434 var container = elements[i]; 22435 var containerOffset = this.getItemElementStartOffset(container); 22436 var isSameColumn = Math.abs(columnOffsetLeft - containerOffset) < FormLayoutConsts.OFFSET_ERROR; 22437 if(isSameColumn) { 22438 var groupCellElement = this.getGroupCellElement(container); 22439 result.push(groupCellElement); 22440 } 22441 } 22442 return result; 22443 }, 22444 getItemElementStartOffset: function(element) { 22445 var offset = ASPxClientFormLayoutUtils.getClientLeft(element); 22446 var parentGroupElement = this.getParentGroupElement(element); 22447 if(this.rtl) 22448 offset += ASPx.GetElementOffsetWidth(element) + this.getGroupItemRightIndents(parentGroupElement); 22449 else 22450 offset -= this.getGroupItemLeftIndents(parentGroupElement); 22451 return offset; 22452 }, 22453 getGroupCellElement: function(container) { 22454 return ASPx.GetNodeByTagName(container, "DIV"); 22455 }, 22456 getGroupElementsTreeLine: function(groupElement) { 22457 var groupItems = []; 22458 var parent = groupElement; 22459 var mainElement = this.formLayout.GetMainElement(); 22460 while(parent !== mainElement) { 22461 groupItems.push(parent); 22462 parent = parent.parentNode; 22463 } 22464 return groupItems; 22465 }, 22466 getGroupItemLeftIndents: function(groupElement) { 22467 var result = 0; 22468 var parentGroups = this.getGroupElementsTreeLine(groupElement); 22469 for(var i = 0; i < parentGroups.length; i++) { 22470 var currentStyle = ASPx.GetCurrentStyle(parentGroups[i]); 22471 result += ASPx.PxToInt(currentStyle.paddingLeft) + 22472 ASPx.PxToInt(currentStyle.marginLeft) + 22473 ASPx.PxToInt(currentStyle.borderLeftWidth); 22474 } 22475 return result; 22476 }, 22477 getGroupItemRightIndents: function(groupElement) { 22478 var result = 0; 22479 var parentGroups = this.getGroupElementsTreeLine(groupElement); 22480 for(var i = 0; i < parentGroups.length; i++) { 22481 var currentStyle = ASPx.GetCurrentStyle(parentGroups[i]); 22482 result += ASPx.PxToInt(currentStyle.paddingRight) + 22483 ASPx.PxToInt(currentStyle.marginRight) + 22484 ASPx.PxToInt(currentStyle.borderRightWidth); 22485 } 22486 return result; 22487 }, 22488 getUniqueStartOffsets: function(elements) { 22489 var offsets = []; 22490 for(var i = 0; i < elements.length; i++) 22491 offsets.push(this.getItemElementStartOffset(elements[i])); 22492 function uniqueOffsets(value, index, self) { 22493 var unique = true; 22494 for(var i = 0; i < index; i++) { 22495 var isSameColumn = Math.abs(self[i] - value) < FormLayoutConsts.OFFSET_ERROR; 22496 if(isSameColumn) { 22497 unique = false; 22498 break; 22499 } 22500 } 22501 return unique; 22502 } 22503 return offsets.filter(uniqueOffsets); 22504 } 22505 }); 22506 var AlignTableLayoutCaptionByOffsetStrategy = ASPx.CreateClass(AlignCaptionByOffsetStrategy, { 22507 constructor: function(formLayout) { 22508 this.constructor.prototype.constructor.call(this, formLayout); 22509 }, 22510 getGroupCellElement: function (container) { 22511 return container; 22512 }, 22513 getGroupChildElements: function(groupElement) { 22514 var result = []; 22515 for(var i = 0; i < groupElement.rows.length; i++) { 22516 var cells = ASPx.GetChildNodesByTagName(groupElement.rows[i], "TD"); 22517 result = result.concat(cells); 22518 } 22519 return result; 22520 } 22521 }); 22522 var ASPxClientFormLayout = ASPx.CreateClass(ASPxClientControl, { 22523 constructor: function(name) { 22524 this.constructor.prototype.constructor.call(this, name); 22525 this.rootItem = null; 22526 this.needAdjust = true; 22527 this.forceAdjustOnShow = true; 22528 this.isFinallyInitialized = false; 22529 this.mainElementWidth = 0; 22530 this.updateLock = false; 22531 this.alignItemCaptionsInAllGroups = false; 22532 this.leftAndRightCaptionsWidth = 0; 22533 this.adaptivityMode = FormLayoutAdaptivityMode.Off; 22534 this.switchToSingleColumnAtWindowInnerWidth = 0; 22535 this.showItemCaptionColon = true; 22536 this.captionAssociatingItems = []; 22537 this.alignCaptionHelper = null; 22538 this.layoutHelper = null; 22539 },
22540 UpdateItemsCssClasses: function() { }, 22541 SetData: function(data){ 22542 if(data.items) 22543 this.CreateItems(data.items); 22544 if(this.accessibilityCompliant && data.captionAssociatingItems) 22545 this.captionAssociatingItems = data.captionAssociatingItems; 22546 }, 22547 InlineInitialize: function() { 22548 ASPxClientControl.prototype.InlineInitialize.call(this); 22549 this.InitializeEvents(); 22550 this.EnsureCustomFontSizeClassName(); 22551 this.InitializeNeedAdjustItemsContentOnShowing(); 22552 this.UpdateHeadingLineGroupBoxElements(); 22553 if(this.enabled) 22554 this.addHandlersToActiveTabChangedEvents(); 22555 if(this.switchToSingleColumnAtWindowInnerWidth > 0) 22556 this.CreateAdaptivityCssRules(); 22557 this.adjustTabbedGroupPageControls(); 22558 }, 22559 Initialize: function () { 22560 ASPxClientControl.prototype.Initialize.call(this); 22561 this.isFinallyInitialized = true; 22562 this.prepareNestedControls(); 22563 }, 22564 InitializeEvents: function() { 22565 if(this.adaptivityMode === FormLayoutAdaptivityMode.Breakpoints) 22566 this.InitializeResizeEvent(); 22567 }, 22568 AfterInitialize: function() { 22569 if(this.accessibilityCompliant && this.captionAssociatingItems) 22570 this.SetAccessibilityCaptionAssociating(this.captionAssociatingItems); 22571 ASPxClientControl.prototype.AfterInitialize.call(this); 22572 }, 22573 prepareNestedControls: function(container) { 22574 this.getLayoutItemElements(container).forEach(function(itemElement) { 22575 var predicate = function(control) { return !!control.applyFormLayoutItemSettings || !!control.errorCellVisibilityChanged; }; 22576 var nestedControls = this.getNestedControls(itemElement, predicate); 22577 nestedControls.forEach(function(control) { this.prepareNestedControl(control, itemElement); }.bind(this)); 22578 }.bind(this)); 22579 }, 22580 prepareNestedControl: function(nestedControl, itemElement) { 22581 if(nestedControl.applyFormLayoutItemSettings) { 22582 var captionElement = this.getLayoutItemCaptionElement(itemElement); 22583 var helpTextElement = this.getLayoutItemHelpTextElement(itemElement); 22584 var caption = captionElement ? this.getItemCaptionInternal(captionElement) : ""; 22585 nestedControl.applyFormLayoutItemSettings({ 22586 caption: caption, 22587 helpText: helpTextElement ? ASPx.GetInnerText(helpTextElement) : null 22588 }); 22589 } 22590 if(this.IsFlowRender() && nestedControl.errorCellVisibilityChanged) { 22591 var eventHandler = this.getErrorCellVisibilityChangedEventHandler(); 22592 nestedControl.errorCellVisibilityChanged.AddHandler(eventHandler); 22593 } 22594 }, 22595 getErrorCellVisibilityChangedEventHandler: function() { 22596 if(!this.errorCellVisibilityChangedEventHandler) 22597 this.errorCellVisibilityChangedEventHandler = function() { 22598 if(this.isErrorCellVisibilityChangedProcessingLocked) 22599 return; 22600 this.isErrorCellVisibilityChangedProcessingLocked = true; 22601 setTimeout(function() { 22602 this.AdjustControl(); 22603 this.isErrorCellVisibilityChangedProcessingLocked = false; 22604 }.bind(this), errorCellVisibilityChangedProcessingDelay); 22605 }.bind(this); 22606 return this.errorCellVisibilityChangedEventHandler; 22607 }, 22608 getNestedControls: function(layoutItemElement, predicate) { 22609 var controlTree = new ASPx.ControlTree(ASPx.GetControlCollection(), layoutItemElement, 22610 function(control) { return predicate(control); }); 22611 return controlTree.rootNode.children.map(function(child) { return child.control; }); 22612 }, 22613 getNestedControlCell: function(layoutItem) { 22614 var itemElementContainer = this.getItemElementContainer(layoutItem); 22615 if(this.IsFlowRender() && !itemElementContainer.id) 22616 itemElementContainer = itemElementContainer.parentNode; 22617 return ASPxClientFormLayoutUtils.getItemNestedControlCell(itemElementContainer); 22618 }, 22619 getLayoutItemElements: function(container) { 22620 var mainElement = this.GetMainElement(); 22621 var itemsContainer = container || mainElement; 22622 return Array.prototype.slice.call(itemsContainer.querySelectorAll("." + FormLayoutConsts.ITEM_SYSTEM_CLASS_NAME)) 22623 .map(function(element) { return ASPx.GetParent(element, function(el) { return !!el.id; }); }) 22624 .filter(function(element) {
22625 return !ASPxClientFormLayoutUtils.isElementContainedInNestedFormLayout(element, mainElement); 22626 }); 22627 }, 22628 GetAlignCaptionHelper: function() { 22629 if(!this.alignCaptionHelper) 22630 this.alignCaptionHelper = this.IsFlowRender() ? new AlignCaptionByOffsetStrategy(this) : new AlignTableLayoutCaptionByOffsetStrategy(this); 22631 return this.alignCaptionHelper; 22632 }, 22633 InitializeResizeEvent: function() { 22634 var resizeInterval = 50; 22635 this.mainElementWidth = this.GetMainElement().getBoundingClientRect().width; 22636 ASPx.Timer.SetControlBoundInterval(function() { 22637 var currentWidth = this.GetMainElement().getBoundingClientRect().width; 22638 if(currentWidth !== this.mainElementWidth) { 22639 this.mainElementWidth = currentWidth; 22640 this.AdjustControlInternal(); 22641 } 22642 }.aspxBind(this), this, resizeInterval); 22643 }, 22644 EnsureCustomFontSizeClassName: function() { 22645 var mainElement = this.GetMainElement(); 22646 if(mainElement.style.fontSize !== "") 22647 ASPx.AddClassNameToElement(mainElement, "dxflCustomFontSizeSys"); 22648 }, 22649 GetGroupLayoutHelper: function() { 22650 if(!this.layoutHelper) 22651 this.layoutHelper = this.GetGroupLayoutHelperCore(); 22652 return this.layoutHelper; 22653 }, 22654 GetGroupLayoutHelperCore: function() { 22655 if(this.adaptivityMode == FormLayoutAdaptivityMode.Off) 22656 return new TableGroupLayoutHelper(this); 22657 else 22658 return new AdaptiveGroupLayoutHelper(this); 22659 }, 22660 IsFlowRender: function() { 22661 return this.adaptivityMode !== FormLayoutAdaptivityMode.Off; 22662 }, 22663 CreateAdaptivityCssRules: function() { 22664 var styleSheet = ASPx.GetCurrentStyleSheet(); 22665 if(!styleSheet || !styleSheet.insertRule) return; 22666 var rule = "@media all and (max-width: " + this.switchToSingleColumnAtWindowInnerWidth + "px) { " + 22667 this.getAdaptiveSelectorForContainer() + this.getAdaptiveContainerStyles() + 22668 this.getAdaptiveSelectorForCaptionCell() + this.getAdaptiveCaptionCellStyles() + 22669 "}"; 22670 styleSheet.insertRule(rule, styleSheet.cssRules.length); 22671 }, 22672 getAdaptiveSelectorForContainer: function () { 22673 return "#" + this.name + " ." + FormLayoutConsts.ELEMENT_CONTAINER_SYSTEM_CLASS_NAME + ":not[data-fixedCaptionLocation=\"True\"]" + " > div"; 22674 }, 22675 getAdaptiveSelectorForCaptionCell: function () { 22676 return "#" + this.name + " ." + FormLayoutConsts.CAPTION_CELL_SYSTEM_CLASS_NAME; 22677 }, 22678 getAdaptiveContainerStyles: function () { 22679 return "{ width: 100%!important; min-width: 0!important; float: left; }"; 22680 }, 22681 getAdaptiveCaptionCellStyles: function () { 22682 return "{ height: auto !important; }"; 22683 }, 22684 OnBrowserWindowResize: function(e) { 22685 this.AdjustControl(); 22686 }, 22687 BrowserWindowResizeSubscriber: function() { 22688 return this.adaptivityMode == FormLayoutAdaptivityMode.SingleColumnWindowLimit; 22689 }, 22690 GetLayoutItemElementsWithHorizontalCaptions: function() { 22691 if(!this.itemsWithHorizontalCaptions) { 22692 var mainElement = this.GetMainElement(); 22693 this.itemsWithHorizontalCaptions = ASPxClientFormLayoutUtils.getElementNodesByPredicate(mainElement, 22694 function(element) { return this.itemHasHorizontalCaption(element); }.aspxBind(this), 22695 mainElement); 22696 } 22697 return this.itemsWithHorizontalCaptions; 22698 }, 22699 GetHorizontalHelpTextElements: function() { 22700 if(!this.horizontalHelpTextElements) { 22701 var mainElement = this.GetMainElement(); 22702 this.horizontalHelpTextElements = ASPxClientFormLayoutUtils.getElementNodesByPredicate(mainElement, 22703 function(element) { return this.isHorizontalHelpTextElement(element); }.aspxBind(this), 22704 mainElement); 22705 } 22706 return this.horizontalHelpTextElements; 22707 }, 22708 AddCssClassToElements: function(elements, className) { 22709 for(var i = 0; i < elements.length; i++) 22710 ASPx.AddClassNameToElement(elements[i], className); 22711 }, 22712 InitializeNeedAdjustItemsContentOnShowing: function () { 22713 if(this.rootItem == null) return; 22714 for(var i = 0; i < this.rootItem.items.length; i++) 22715 this.rootItem.items[i].InitializeNeedAdjustContentOnShowing(); 22716 }, 22717 CreateItems: function (itemsProperties) { 22718 this.rootItem = this.CreateRootItem();
22719 this.rootItem.CreateItems(itemsProperties); 22720 }, 22721 CreateRootItem: function(){ 22722 return new ASPxClientLayoutItem(this, "", "", null); 22723 }, 22724 SetAccessibilityCaptionAssociating: function(captionAssociatingItems) { 22725 var itemsCount = captionAssociatingItems.length; 22726 for(var i = 0; i < itemsCount; i++) { 22727 var captionElement = ASPx.GetElementById(captionAssociatingItems[i][0]); 22728 var control = ASPx.GetControlCollection().Get(captionAssociatingItems[i][1]); 22729 if(ASPx.IsExists(captionElement) && ASPx.IsExists(control) && control.isASPxClientEdit) 22730 ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating(control, control.GetAccessibilityFirstActiveElement(), captionElement); 22731 if(ASPx.IsExists(captionAssociatingItems[i][2])) 22732 this.SetAccessibilityCaptionAssociating(captionAssociatingItems[i][2]); 22733 } 22734 }, 22735 GetItemByName: function (name) { 22736 return this.rootItem != null ? this.rootItem.GetItemByName(name) : null; 22737 }, 22738 getItemByPredicate: function(predicate) { 22739 return this.rootItem != null ? this.rootItem.getItemByPredicate(predicate) : null; 22740 }, 22741 GetItemByPath: function (path) { 22742 return this.rootItem != null ? this.rootItem.GetItemByPath(path) : null; 22743 }, 22744 getElementToAlignGroups: function(elementToChangeState, item) { 22745 if(this.alignItemCaptionsInAllGroups) 22746 return this.GetMainElement(); 22747 else { 22748 if(item.items.length > 0) 22749 return elementToChangeState; 22750 else 22751 return this.GetHTMLElementByItem(item.parent); 22752 } 22753 }, 22754 SetItemVisible: function (item, visible, initialization) { 22755 if(visible && initialization) return; 22756 if(!item.visible) return; 22757 var tab = this.findItemParentTab(item); 22758 if(tab) 22759 tab.SetVisible(visible); 22760 else 22761 this.SetItemVisibleCore(item, visible); 22762 this.adjustTabbedGroupPageControls(); 22763 }, 22764 SetItemVisibleCore: function(item, visible) { 22765 var element = this.GetHTMLElementByItem(item); 22766 if(!element) 22767 return; 22768 this.setElementDisplay(element, visible); 22769 if(this.IsVisible() && this.isLayoutPrepared()) 22770 this.alignGroupsAfterItemStateChanged(element, item); 22771 if(visible && item.needAdjustContentOnShowing) { 22772 ASPx.GetControlCollection().AdjustControls(element); 22773 item.ResetNeedAdjustContentOnShowing(); 22774 } 22775 this.AdjustControlInternal(true); 22776 }, 22777 setElementDisplay: function(element, visible) { 22778 ASPx.SetElementDisplay(element, visible); 22779 }, 22780 getItemCaptionElement: function(item, itemParentTab) { 22781 var itemElementContainer = this.getItemElementContainer(item, itemParentTab); 22782 return this.getCaptionElementByItemContainer(itemElementContainer); 22783 }, 22784 getItemCaptionInternal: function(captionElement) { 22785 var captionText = this.getItemCaptionElementText(captionElement); 22786 captionText = ASPx.Str.Trim(captionText); 22787 if(captionText !== "" && captionText[captionText.length - 1] == ":") 22788 captionText = captionText.substring(0, captionText.length - 1); 22789 return captionText; 22790 }, 22791 GetItemCaption: function(item) { 22792 var itemParentTab = this.findItemParentTab(item); 22793 if(itemParentTab) 22794 return itemParentTab.GetText(); 22795 var captionElement = this.getItemCaptionElement(item); 22796 if(captionElement) 22797 return this.getItemCaptionInternal(captionElement); 22798 return ""; 22799 }, 22800 SetItemCaption: function(item, caption) { 22801 var itemParentTab = this.findItemParentTab(item); 22802 var captionElement = this.getItemCaptionElement(item, itemParentTab); 22803 if(itemParentTab) 22804 itemParentTab.SetText(caption); 22805 if(captionElement) 22806 this.setItemCaptionInternal(captionElement, caption); 22807 if(this.isLayoutItemCaptionElement(captionElement)) { 22808 this.alignGroupsAfterItemStateChanged(captionElement, item); 22809 } 22810 this.adjustTabbedGroupPageControls(); 22811 }, 22812 isLayoutItemCaptionElement: function(captionElement) { 22813 return ASPx.ElementContainsCssClass(captionElement, FormLayoutConsts.LAYOUT_ITEM_CAPTION_PARTIAL_CLASS_NAME); 22814 }, 22815 alignGroupsAfterItemStateChanged: function(element, item) { 22816 var elementToAlignGroups = this.getElementToAlignGroups(element, item); 22817 if(elementToAlignGroups) 22818 this.alignGroupsInContainer(elementToAlignGroups); 22819 }, 22820 needToAddItemCaptionColon: function(captionElement, caption) { 22821 if(caption === "") 22822 return false; 22823 var captionEndsWithColon = caption[caption.length - 1] == ":"; 22824 return this.showItemCaptionColon && this.isLayoutItemCaptionElement(captionElement) && !captionEndsWithColon; 22825 }, 22826 setItemCaptionInternal: function(captionElement, rawCaption) { 22827 var captionTextNode = ASPx.GetNormalizedTextNode(captionElement); 22828 if(!captionTextNode) { 22829 captionTextNode = document.createTextNode(""); 22830 captionElement.appendChild(captionTextNode); 22831 } 22832 captionTextNode.nodeValue = this.getPreparedCaption(rawCaption, captionElement); 22833 }, 22834 getPreparedCaption: function(rawCaption, captionElement) { 22835 var result = ASPx.Str.Trim(rawCaption); 22836 if(this.needToAddItemCaptionColon(captionElement, result)) 22837 result += ":"; 22838 return result; 22839 }, 22840 findItemParentTab: function(item) { 22841 if(!item.parent.isTabbedGroup) 22842 return null; 22843 var pageControlObject = this.getPageControlObjectByItem(item.parent); 22844 if(pageControlObject) { 22845 var tabName = item.name || item.path; 22846 return pageControlObject.GetTabByName(tabName); 22847 } 22848 return null; 22849 }, 22850 getItemElementContainer: function(item, itemParentTab) { 22851 if(itemParentTab) 22852 return itemParentTab.tabControl.GetContentHolder(itemParentTab.index); 22853 var container = this.GetHTMLElementByItem(item); 22854 if(!this.IsFlowRender()) 22855 return container; 22856 return ASPxClientFormLayoutUtils.getGroupCell(container); 22857 }, 22858 getPageControlObjectByItem: function(tabbedGroup) { 22859 var pageControlName = this.GetPageControlName(tabbedGroup); 22860 return ASPx.GetControlCollection().Get(pageControlName); 22861 }, 22862 getPageControlObjectByContainer: function(pageControlContainer) { 22863 var pageControlElement = ASPx.GetChildByClassName(pageControlContainer, FormLayoutConsts.TABBED_GROUP_PAGE_CONTROL_SYSTEM_CLASS_NAME, 0); 22864 if(pageControlElement == null) 22865 return null; 22866 return ASPx.GetControlCollection().Get(pageControlElement.id); 22867 }, 22868 getCaptionElementByItemContainer: function(container) { 22869 var captionElement = null; 22870 var layoutItemElement = ASPx.GetChildByClassName(container, this.getItemCaptionContainerClassName()); 22871 if(layoutItemElement) 22872 captionElement = this.getLayoutItemCaptionElement(layoutItemElement); 22873 else { 22874 var groupBoxElement = ASPx.GetChildByClassName(container, this.getGroupBoxCaptionContainerClassName()); 22875 if(groupBoxElement) 22876 captionElement = this.getGroupBoxCaptionElement(groupBoxElement); 22877 } 22878 return captionElement; 22879 }, 22880 getLayoutItemCaptionElement: function(itemElement) { 22881 var captionCell = ASPxClientFormLayoutUtils.getElementNodesByClassName(itemElement, FormLayoutConsts.CAPTION_CELL_SYSTEM_CLASS_NAME, this.GetMainElement())[
228810]; 22882 return ASPx.GetChildByPartialClassName(captionCell, FormLayoutConsts.LAYOUT_ITEM_CAPTION_PARTIAL_CLASS_NAME); 22883 }, 22884 getLayoutItemHelpTextElement: function(itemElement) { 22885 var classes = FormLayoutHorizontalHelpTextsCssClasses.concat(FormLayoutVerticalHelpTextsCssClasses) 22886 .map(function(c) { return "." + c; }) 22887 .join(","); 22888 return Array.prototype.slice.call(itemElement.querySelectorAll(classes)) 22889 .filter(function(element) { 22890 return !ASPxClientFormLayoutUtils.isElementContainedInNestedItem(element, itemElement); 22891 })[0]; 22892 }, 22893 getGroupBoxCaptionElement: function(groupBoxElement) { 22894 return ASPx.GetChildByPartialClassName(groupBoxElement, FormLayoutConsts.GROUP_BOX_CAPTION_PARTIAL_CLASS_NAME); 22895 }, 22896 GetPageControlName: function (tabbedGroup) { 22897 return this.GetItemElementIDPrefix(tabbedGroup) + FormLayoutConsts.PAGE_CONTROL_ID_PREFIX + tabbedGroup.path; 22898 }, 22899 GetHTMLElementByItem: function(item) { 22900 if(item === this.rootItem) 22901 return this.GetMainElement(); 22902 var itemParentTab = this.findItemParentTab(item); 22903 if(itemParentTab) 22904 return itemParentTab.tabControl.GetContentHolder(itemParentTab.index); 22905 return ASPx.GetElementById(this.GetItemElementID(item)); 22906 }, 22907 GetItemElementID: function (item) { 22908 return this.GetItemElementIDPrefix(item) + item.path; 22909 }, 22910 GetItemElementIDPrefix: function (item) { 22911 var result = ""; 22912 var currentParent = item.parent; 22913 while(currentParent != null) { 22914 if(currentParent.isTabbedGroup) 22915 result = FormLayoutConsts.PAGE_CONTROL_ID_PREFIX + currentParent.path + "_" + result; 22916 currentParent = currentParent.parent; 22917 } 22918 return this.name + "_" + result; 22919 }, 22920 UpdateHeadingLineGroupBoxElements: function () { 22921 var mainElement = this.GetMainElement(); 22922 if(ASPx.IsExistsElement(mainElement)) { 22923 var groupBoxElements = this.getGroupBoxElements(mainElement); 22924 for(var i = 0; i < groupBoxElements.length; i++) { 22925 var groupBoxElement = groupBoxElements[i]; 22926 var isHeadingLineGroupBox = groupBoxElement.className.indexOf(FormLayoutConsts.HEADING_LINE_GROUP_BOX_SYSTEM_CLASS_NAME) !== -1; 22927 if(isHeadingLineGroupBox) { 22928 var hasGroupBoxCaption = ASPx.GetChildNodesByTagName(groupBoxElement, "SPAN").length === 1; 22929 if(hasGroupBoxCaption) 22930 groupBoxElement.className += " " + FormLayoutConsts.HEADING_LINE_GROUP_BOX_WITH_CAPTION_SYSTEM_CLASS_NAME; 22931 } 22932 } 22933 } 22934 }, 22935 AdjustControlCore: function() { 22936 this.AdjustControlInternal(); 22937 }, 22938 AdjustControlInternal: function(force) { 22939 if(!this.isLayoutPrepared()) 22940 return; 22941 var isForce = force || this.forceAdjustOnShow; 22942 if(!this.IsFlowRender() && !isForce) 22943 return; 22944 var mainElement = this.GetMainElement(); 22945 if(ASPx.IsExists(mainElement)) { 22946 if(ASPx.IsElementVisible(mainElement)) { 22947 this.GetGroupLayoutHelper().RecalculateLayout(isForce); 22948 this.forceAdjustOnShow = false; 22949 } else 22950 this.forceAdjustOnShow = isForce; 22951 } 22952 }, 22953 BeginUpdate: function() { 22954 this.updateLock = true; 22955 }, 22956 EndUpdate: function() { 22957 this.updateLock = false; 22958 this.AdjustControlInternal(true); 22959 }, 22960 getTabbedGroupPageControlObjects: function() { 22961 var mainElement = this.GetMainElement(); 22962 var pageControlElements = ASPxClientFormLayoutUtils.getElementNodesByClassName(mainElement, FormLayoutConsts.TABBED_GROUP_PAGE_CONTROL_SYSTEM_CLASS_NAME, mainElement); 22963 var result = []; 22964 ASPx.Data.ForEach(pageControlElements, function(element) { 22965 if(!element.id) 22966 return; 22967 var pageControlObject = ASPx.GetControlCollection().Get(element.id); 22968 if(pageControlObject) 22969 result.push(pageControlObject); 22970 }); 22971 return result; 22972 }, 22973 adjustTabbedGroupPageControls: function() { 22974 var pageControls = this.getTabbedGroupPageControlObjects(); 22975 ASPx.Data.ForEach(pageControls, function(control) { 22976 control.AdjustControl(); 22977 }); 22978 }, 22979 addHandlersToActiveTabChangedEvents: function () { 22980 var mainElement = this.GetMainElement(); 22981 var pageControls = ASPxClientFormLayoutUtils.getElementNodesByClassName(mainElement, 22982 FormLayoutConsts.TABBED_GROUP_PAGE_CONTROL_SYSTEM_CLASS_NAME, 22983 mainElement); 22984 for(var i = 0; i < pageControls.length; i++) { 22985 var pageControlObject = ASPx.GetControlCollection().Get(pageControls[i].id); 22986 if(!pageControlObject) 22987 continue; 22988 pageControlObject.ActiveTabChanged.AddHandler(function (s, e) { 22989 this.onPageControlTabChanged(); 22990 this.AdjustControlInternal(true); 22991 }.aspxBind(this)); 22992 pageControlObject.EndCallback.AddHandler(function (s, e) { 22993 var tabContentElement = s.GetContentElement(s.GetActiveTabIndex());
22994 this.prepareNestedControls(tabContentElement); 22995 }.aspxBind(this)); 22996 } 22997 }, 22998 onPageControlTabChanged: function () { }, 22999 alignGroupsInContainer: function (groupContainer) { 23000 if(ASPx.IsExistsElement(groupContainer)) 23001 this.GetAlignCaptionHelper().AlignGroups(groupContainer); 23002 }, 23003 itemHasHorizontalCaption: function(itemElement) { 23004 for(var i = 0; i < FormLayoutHorizontalCaptionsCssClasses.length; i++) 23005 if(ASPx.ElementContainsCssClass(itemElement, FormLayoutHorizontalCaptionsCssClasses[i])) 23006 return true; 23007 return false; 23008 }, 23009 isHorizontalHelpTextElement: function(element) { 23010 for(var i = 0; i < FormLayoutHorizontalHelpTextsCssClasses.length; i++) 23011 if(ASPx.ElementContainsCssClass(element, FormLayoutHorizontalHelpTextsCssClasses[i])) 23012 return true; 23013 return false; 23014 }, 23015 findTabbedGroupChildItemElement: function(tabbedGroupElement) { 23016 var pageControlObject = this.getPageControlObjectByContainer(tabbedGroupElement); 23017 if(pageControlObject == null) 23018 return null; 23019 var tabContentHolder = pageControlObject.GetContentHolder(pageControlObject.GetActiveTabIndex()); 23020 var itemElement = ASPx.GetChildByClassName(tabContentHolder, FormLayoutConsts.ITEM_SYSTEM_CLASS_NAME); 23021 if(itemElement) 23022 return itemElement; 23023 var childTabbedGroupElement = ASPx.GetChildByClassName(tabContentHolder, FormLayoutConsts.TABBED_GROUP_SYSTEM_CLASS_NAME); 23024 return childTabbedGroupElement ? this.findTabbedGroupChildItemElement(childTabbedGroupElement) : null; 23025 }, 23026 getGroupBoxElements: function(parent) { 23027 return ASPxClientFormLayoutUtils.getElementNodesByClassName(parent, 23028 FormLayoutConsts.HEADING_LINE_GROUP_BOX_SYSTEM_CLASS_NAME, 23029 this.GetMainElement()); 23030 }, 23031 isLayoutPrepared: function() { 23032 return !this.updateLock; 23033 }, 23034 getItemCaptionContainerClassName: function() { 23035 return FormLayoutConsts.ITEM_SYSTEM_CLASS_NAME; 23036 }, 23037 getGroupBoxCaptionContainerClassName: function() { 23038 return FormLayoutConsts.GROUP_BOX_SYSTEM_CLASS_NAME; 23039 }, 23040 getItemCaptionElementText: function(captionElement) { 23041 return ASPx.GetInnerText(captionElement); 23042 } 23043 }); 23044 ASPxClientFormLayout.Cast = ASPxClientControl.Cast; 23045 var ASPxClientFormLayoutUtils = { }; 23046 ASPxClientFormLayoutUtils.getCellColSpan = function (cellContainer, breakpointKey) { 23047 return this.getCellSpanCore(cellContainer, breakpointKey, true); 23048 }; 23049 ASPxClientFormLayoutUtils.getCellRowSpan = function (cellContainer, breakpointKey) { 23050 return this.getCellSpanCore(cellContainer, breakpointKey, false); 23051 }; 23052 ASPxClientFormLayoutUtils.getCellSpanCore = function(cellContainer, breakpointKey, isColumnSpan) { 23053 var spanRules = this.getCellSpanRules(cellContainer); 23054 var defaultSpan = this.getDefaultCellSpanCore(cellContainer, isColumnSpan); 23055 if(!spanRules) 23056 return defaultSpan; 23057 var rulesValue = spanRules[breakpointKey]; 23058 var ruleSpanIndex = isColumnSpan ? 0 : 1; 23059 return rulesValue === undefined ? defaultSpan : rulesValue[ruleSpanIndex]; 23060 }; 23061 ASPxClientFormLayoutUtils.getCellSpanRules = function(cellElement) { 23062 return JSON.parse(ASPx.Attr.GetAttribute(cellElement, "data-spanRules")); 23063 }; 23064 ASPxClientFormLayoutUtils.getDefaultCellSpanCore = function(cellContainer, isColumnSpan) { 23065 var result = 1; 23066 var attributeName = isColumnSpan ? "data-colSpan" : "data-rowSpan"; 23067 var spanAttribute = ASPx.Attr.GetAttribute(cellContainer, attributeName); 23068 if(spanAttribute) { 23069 var invariantCultureSpanAttribute = spanAttribute.replace(/,/g, '.'); 23070 var parsedValue = parseFloat(invariantCultureSpanAttribute); 23071 if(!isNaN(parsedValue)) 23072 result = parsedValue; 23073 } 23074 return result; 23075 }; 23076 ASPxClientFormLayoutUtils.getGroupCell = function(container) { 23077 return ASPx.GetChildByPartialClassName(container, FormLayoutConsts.GROUP_CELL_PARTIAL_CLASS_NAME); 23078 }; 23079 ASPxClientFormLayoutUtils.getCellContent = function(groupCell) { 23080 return ASPx.GetChildNodes(groupCell, this.isFormLayoutElement)[0]; 23081 }; 23082 ASPxClientFormLayoutUtils.isFormLayoutElement = function(element) { 23083 return ASPx.ElementHasCssClass(element, FormLayoutConsts.TABBED_GROUP_SYSTEM_CLASS_NAME) || 23084 ASPx.ElementHasCssClass(element, FormLayoutConsts.GROUP_BOX_SYSTEM_CLASS_NAME) || 23085 ASPx.ElementHasCssClass(element, FormLayoutConsts.ITEM_SYSTEM_CLASS_NAME) || 23086 ASPx.ElementHasCssClass(element, FormLayoutConsts.GROUP_SYSTEM_CLASS_NAME) || 23087 ASPx.ElementContainsCssClass(element, FormLayoutConsts.EMPTY_ITEM_CLASS_NAME); 23088 }; 23089 ASPxClientFormLayoutUtils.isRootFlowLayoutGroup = function(groupBox) { 23090 return this.getFlowLayoutGroupLevel(groupBox) == 1; 23091 }; 23092 ASPxClientFormLayoutUtils.getFlowLayoutGroupLevel = function(groupBox) { 23093 var result = -1; 23094 var groupIDAttribute = ASPx.Attr.GetAttribute(groupBox, "data-groupid"); 23095 if(groupIDAttribute) 23096 result = groupIDAttribute.split(FormLayoutConsts.ITEM_PATH_SEPARATOR) 23097 .filter(function(pathPart) { return pathPart !== ""; }) 23098 .length; 23099 return result; 23100 }; 23101 ASPxClientFormLayoutUtils.getChildDivAtNestedLevel = function(element, level) { 23102 var result = element; 23103 for(var i = 0; i < level; i++) { 23104 result = ASPx.GetChildNodesByTagName(result, "DIV")[0]; 23105 if(!result) 23106 break; 23107 } 23108 return result; 23109 }; 23110 ASPxClientFormLayoutUtils.getRowIndexByCellIndex = function(index, rowLastCellIndices) { 23111 var rowIndex = 0; 23112 if(rowLastCellIndices.length == 0) 23113 return rowIndex; 23114 if(index > rowLastCellIndices[rowLastCellIndices.length - 1]) 23115 return rowLastCellIndices.length; 23116 for(var i = rowLastCellIndices.length - 1; i >= 0; i--) { 23117 var lastCellIndex = rowLastCellIndices[i]; 23118 var previousLastCellIndex = rowLastCellIndices[i - 1]; 23119 if(index <= lastCellIndex && (i == 0 || index > previousLastCellIndex)) { 23120 rowIndex = i; 23121 break; 23122 } 23123 } 23124 return rowIndex; 23125 };
23126 ASPxClientFormLayoutUtils.getDefaultBreakpointInfo = function() { 23127 return { 23128 breakpoint: "", 23129 breakpointKey: "" 23130 }; 23131 }; 23132 ASPxClientFormLayoutUtils.getBreakpointInfo = function(group, flOffsetWidth) { 23133 var result = this.getDefaultBreakpointInfo(); 23134 var breakpoints = this.getBreakpoints(group); 23135 if(!breakpoints) 23136 return result; 23137 for(var key in breakpoints) { 23138 if(breakpoints.hasOwnProperty(key)) { 23139 var breakpoint = breakpoints[key]; 23140 var minWidth = breakpoint[0]; 23141 var maxWidth = breakpoint[1]; 23142 if(flOffsetWidth >= minWidth && flOffsetWidth <= maxWidth) { 23143 result.breakpoint = breakpoints[key]; 23144 result.breakpointKey = key; 23145 break; 23146 } 23147 } 23148 } 23149 return result; 23150 }; 23151 ASPxClientFormLayoutUtils.getBreakpoints = function(group) { 23152 var breakpointsAttribute = ASPx.Attr.GetAttribute(group, "data-breakpoints"); 23153 return JSON.parse(breakpointsAttribute); 23154 }; 23155 ASPxClientFormLayoutUtils.getCurrentBreakpoint = function(group) { 23156 return ASPx.Attr.GetAttribute(group, "data-currentBreakpoint") || ""; 23157 }; 23158 ASPxClientFormLayoutUtils.getGroupCurrentColCount = function(group) { 23159 var colCountAttribute = ASPx.Attr.GetAttribute(group, "data-colCount"); 23160 return (colCountAttribute && parseInt(colCountAttribute)) || 1; 23161 }; 23162 ASPxClientFormLayoutUtils.getClientLeft = function(container) { 23163 var clientLeftAttr = ASPx.Attr.GetAttribute(container, "data-left"); 23164 return (clientLeftAttr && parseInt(clientLeftAttr)) || ASPx.GetAbsoluteX(container); 23165 }; 23166 ASPxClientFormLayoutUtils.getVerticalCaptionContainer = function(container) { 23167 return this.getContainerElementNodesByPredicate(container, function(element) { 23168 return ASPx.ElementContainsCssClass(element, FormLayoutVerticalCaptionsCssClasses[0]) 23169 || ASPx.ElementContainsCssClass(element, FormLayoutVerticalCaptionsCssClasses[1]); 23170 }, container)[0]; 23171 }; 23172 ASPxClientFormLayoutUtils.isElementContainedInNestedFormLayout = function(element, mainElement) { 23173 var parentFormLayout = ASPx.GetParentByPartialClassName(element, FormLayoutConsts.FORM_LAYOUT_PARTIAL_CLASS_NAME); 23174 return parentFormLayout !== mainElement; 23175 }; 23176 ASPxClientFormLayoutUtils.isElementContainedInNestedItem = function(element, mainElement) { 23177 var parentContainer = ASPx.GetParent(element, function(el) { return !!el.id; }); 23178 return mainElement.id !== parentContainer.id; 23179 }; 23180 ASPxClientFormLayoutUtils.getElementNodesByPredicate = function(parent, predicate, mainElement) { 23181 return ASPx.GetNodes(parent, function(element) { 23182 return !this.isElementContainedInNestedFormLayout(element, mainElement) && (!predicate || predicate(element)); 23183 }.aspxBind(this)); 23184 }; 23185 ASPxClientFormLayoutUtils.getContainerElementNodesByPredicate = function(parent, predicate, mainElement) { 23186 return ASPx.GetNodes(parent, function(element) { 23187 return !this.isElementContainedInNestedItem(element, mainElement) && (!predicate || predicate(element)); 23188 }.aspxBind(this)); 23189 }; 23190 ASPxClientFormLayoutUtils.getElementNodesByClassName = function(parent, className, mainElement) { 23191 var result = []; 23192 ASPx.Data.ForEach(ASPx.GetNodesByClassName(parent, className), function(element) { 23193 if(!this.isElementContainedInNestedFormLayout(element, mainElement)) 23194 result.push(element); 23195 }.aspxBind(this)); 23196 return result; 23197 }; 23198 ASPxClientFormLayoutUtils.getContainerElementNodesByClassName = function(parent, className, mainElement) { 23199 var result = []; 23200 ASPx.Data.ForEach(ASPx.GetNodesByClassName(parent, className), function(element) { 23201 if(!this.isElementContainedInNestedItem(element, mainElement)) 23202 result.push(element); 23203 }.aspxBind(this)); 23204 return result; 23205 }; 23206 ASPxClientFormLayoutUtils.getElementNodesByPartialClassName = function(parent, className, mainElement) { 23207 var result = []; 23208 ASPx.Data.ForEach(ASPx.GetNodesByPartialClassName(parent, className), function(element) { 23209 if(!this.isElementContainedInNestedFormLayout(element, mainElement)) 23210 result.push(element); 23211 }.aspxBind(this)); 23212 return result; 23213 }; 23214 ASPxClientFormLayoutUtils.getContainerElementNodesByPartialClassName = function(parent, className, mainElement) { 23215 var result = []; 23216 ASPx.Data.ForEach(ASPx.GetNodesByPartialClassName(parent, className), function(element) { 23217 if(!this.isElementContainedInNestedItem(element, mainElement)) 23218 result.push(element); 23219 }.aspxBind(this)); 23220 return result; 23221 }; 23222 ASPxClientFormLayoutUtils.getItemNestedControlCell = function(itemElementContainer) { 23223 return this.getContainerElementNodesByPartialClassName(itemElementContainer, FormLayoutConsts.NESTED_CONTROL_CELL_PARTIAL_CLASS_NAME, itemElementContainer)[0]; 23224 };
23225 ASPxClientFormLayout.UpdateNestedControlTypeClassName = function(itemElement, isEditingItem) { 23226 var getActualEditorTypeClassName = function(itemElement) { 23227 for(var i = 0; i < NestedControlToItemClassNamesMap.length; i++) 23228 if(ASPx.ElementHasCssClass(itemElement, NestedControlToItemClassNamesMap[i].itemClassName)) 23229 return NestedControlToItemClassNamesMap[i].itemClassName; 23230 return ""; 23231 }; 23232 var getRequiredEditorTypeClassName = function(itemElement) { 23233 var nestedControlElement = getNestedControlElement(itemElement); 23234 if(ASPx.IsExists(nestedControlElement)) { 23235 for(var i = 0; i < NestedControlToItemClassNamesMap.length; i++) 23236 if(ASPx.ElementContainsCssClass(nestedControlElement, NestedControlToItemClassNamesMap[i].controlClassName)) 23237 return NestedControlToItemClassNamesMap[i].itemClassName; 23238 } 23239 return ""; 23240 }; 23241 var getNestedControlElement = function(itemElement) { 23242 var nestedControlCell = ASPx.GetNodesByPartialClassName(itemElement, FormLayoutConsts.NESTED_CONTROL_CELL_PARTIAL_CLASS_NAME)[0]; 23243 if(!nestedControlCell) return null; 23244 var nestedControlElements = ASPx.GetNodes(nestedControlCell, function(element) { 23245 var nestedControlObject = element.id && ASPx.GetControlCollection().Get(element.id); 23246 return !!nestedControlObject; 23247 }); 23248 return nestedControlElements.length > 0 ? nestedControlElements[0] : null; 23249 }; 23250 if(isEditingItem) { 23251 var editorClassName = getRequiredEditorTypeClassName(itemElement); 23252 if(editorClassName) { 23253 ASPx.AddClassNameToElement(itemElement, ASPx.FormLayoutConsts.EDIT_FORM_ITEM_SYSTEM_CLASS_NAME); 23254 ASPx.RemoveClassNameFromElement(itemElement, FormLayoutConsts.TEXT_ITEM_SYSTEM_CLASS_NAME); 23255 ASPx.AddClassNameToElement(itemElement, editorClassName); 23256 } 23257 } 23258 else { 23259 ASPx.RemoveClassNameFromElement(itemElement, ASPx.FormLayoutConsts.EDIT_FORM_ITEM_SYSTEM_CLASS_NAME); 23260 ASPx.RemoveClassNameFromElement(itemElement, getActualEditorTypeClassName(itemElement)); 23261 ASPx.AddClassNameToElement(itemElement, FormLayoutConsts.TEXT_ITEM_SYSTEM_CLASS_NAME); 23262 } 23263 }; 23264 ASPx.CreateDialogLayoutBaseClass = function (parentClass, properties) { 23265 var extendentClass = ASPx.CreateClass(parentClass, { 23266 constructor: function (name) { 23267 this.constructor.prototype.constructor.call(this, name); 23268 this.oneColumnItemPriorityTable = {}; 23269 this.itemVisibilityDependencies = {}; 23270 this.triggerInfoCollection = []; 23271 this.controlNameIdMapping = {}; 23272 this.externalUpdateInvokesCounter = 0; 23273 this.allowAdjust = true; 23274 }, 23275 processFieldValueChangedOnServer: function (parentCallbackPanelName) { 23276 var callbackPanel = ASPxClientControl.GetControlCollection().GetByName(parentCallbackPanelName); 23277 if (this.externalUpdateInvokesCounter == 0) { 23278 this.externalUpdateInvokesCounter++; 23279 callbackPanel.PerformCallback(); 23280 } 23281 }, 23282 CreateItems: function (itemsProperties) { 23283 parentClass.prototype.CreateItems.call(this, itemsProperties); 23284 if (this.rootItem) { 23285 this.beginUpdate(); 23286 this.initializeOneColumnItemPriorities(); 23287 this.initializeDependencies(); 23288 this.initializeTriggers(); 23289 this.endUpdate(); 23290 } 23291 }, 23292 initializeTriggers: function () { 23293 this.triggerInfoCollection.forEach(this.createTrigger.aspxBind(this)); 23294 }, 23295 createTrigger: function (triggerInfo) { 23296 if (!triggerInfo.trigger || !triggerInfo.method) 23297 return; 23298 var targetGetter = null; 23299 var target = triggerInfo.target; 23300 if (target) { 23301 if (target.control) 23302 targetGetter = function () { return ASPxClientControl.GetControlCollection().GetByName(target.control); }; 23303 else if (target.object) { 23304 targetGetter = function () { 23305 return target.object.split('.') 23306 .reduce(function (obj, n) { 23307 return (obj[n] || (obj[n] = {})); 23308 }, window); 23309 }; 23310 } 23311 } else 23312 targetGetter = function () { return window; }; 23313 triggerInfo.trigger.forEach(function (trigger) { 23314 this.attachMethodInvokationOnEvent(trigger, targetGetter, triggerInfo.method); 23315 }.aspxBind(this)); 23316 }, 23317 attachMethodInvokationOnEvent: function (trigger, targetGetter, methodInfo) { 23318 var event = this.getControlEvent(trigger); 23319 if (event) { 23320 event.AddHandler(function (s, e) { 23321 var target = targetGetter(); 23322 if (target) { 23323 var method = target[methodInfo.name]; 23324 if (method) 23325 method.apply(target, methodInfo.args || []); 23326 } 23327 }); 23328 } 23329 }, 23330 getControlEvent: function (trigger) { 23331 var field = this.getField(trigger.name); 23332 if (!field) 23333 return null; 23334 var control = field.getControl(); 23335 return control ? (control[trigger.event] || control.UserInput || control.ValueChanged) : null; 23336 }, 23337 initializeOneColumnItemPriorities: function () { 23338 for (var orderIndex in this.oneColumnItemPriorityTable) { 23339 if (this.oneColumnItemPriorityTable.hasOwnProperty(orderIndex)) { 23340 var itemName = this.oneColumnItemPriorityTable[orderIndex]; 23341 var items = this.getItemsByName(itemName); 23342 for (var j = 0; j < items.length; j++) { 23343 var itemElement = this.getItemElementContainer(items[j]).parentNode; 23344 if (itemElement) 23345 itemElement.style.order = orderIndex; 23346 } 23347 } 23348 } 23349 }, 23350 initializeDependencies: function (suppressEventAssign) { 23351 this.iterateDependencies(this.itemVisibilityDependencies, function (key, dependency) {
23352 this.getItemsByName(key).forEach(function (item) { 23353 this.createDependency(dependency, this.getItemVisibleChangeDelegate(item), suppressEventAssign); 23354 }.aspxBind(this)); 23355 }.aspxBind(this)); 23356 this.iterateDependencies(this.editorVisibilityDependencies, function (key, dependency) { 23357 var editor = this.getField(key).getControl(); 23358 if (editor) 23359 this.createDependency(dependency, this.getEditorVisibleChangeDelegate(editor), suppressEventAssign); 23360 }.aspxBind(this)); 23361 this.iterateDependencies(this.editorEnabledDependencies, function (key, dependency) { 23362 var editor = this.getField(key).getControl(); 23363 if (editor) 23364 this.createDependency(dependency, editor.SetEnabled.aspxBind(editor), suppressEventAssign); 23365 }.aspxBind(this)); 23366 }, 23367 getItemVisibleChangeDelegate: function (item) { 23368 return function (newValue) { 23369 var container = this.GetMainElement(); 23370 var stateClasses = this.getFieldStateCssClasses(item); 23371 if (stateClasses) { 23372 ASPx.RemoveClassNameFromElement(container, stateClasses.hidden); 23373 ASPx.RemoveClassNameFromElement(container, stateClasses.visible); 23374 ASPx.AddClassNameToElement(container, newValue ? stateClasses.visible : stateClasses.hidden); 23375 } 23376 item.SetVisible(newValue); 23377 }.aspxBind(this); 23378 }, 23379 getFieldStateCssClasses: function (item) { 23380 return { 23381 visible: "dialog-item-" + item.name + "-visible", 23382 hidden: "dialog-item-" + item.name + "-hidden" 23383 }; 23384 }, 23385 getEditorVisibleChangeDelegate: function (editor) { 23386 return function (newValue) { 23387 if (newValue != editor.GetVisible()) { 23388 var container = ASPx.GetParentByClassName(editor.GetMainElement(), "dialog-linc"); 23389 var count = container.className.match(/(?:dialog-linc-c)(\d)/)[1]; 23390 ASPx.RemoveClassNameFromElement(container, "dialog-linc-c" + count); 23391 ASPx.AddClassNameToElement(container, "dialog-linc-c" + (newValue ? ++count : --count)); 23392 ASPx.SetElementDisplay(ASPx.GetParentByClassName(editor.GetMainElement(), "dialog-control-wrapper"), newValue); 23393 } 23394 editor.SetVisible(newValue); 23395 }; 23396 }, 23397 createDependency: function (dependency, propertySetter, suppressEventAssign) { 23398 var control = this.getField(dependency.fieldName).getControl(); 23399 if (control) { 23400 propertySetter(this.hasSameValue(control, dependency)); 23401 if (!suppressEventAssign) { 23402 control.ValueChanged.removeHandlerByControlName(this.name); 23403 control.ValueChanged.AddHandler(function (s, e) { 23404 this.beginUpdate(); 23405 propertySetter(this.hasSameValue(control, dependency)); 23406 this.initializeDependencies(true); 23407 this.endUpdate(); 23408 this.AdjustControlInternal(true); 23409 }.aspxBind(this), this); 23410 } 23411 } else if (!dependency.fieldName) 23412 propertySetter(dependency.value.toString().toLowerCase() == "true"); 23413 }, 23414 hasSameValue: function (control, dependency) { 23415 return this.getValueToCompare(control.GetValue()) == this.getValueToCompare(dependency.value); 23416 }, 23417 getValueToCompare: function (value) { 23418 return ASPx.IsExists(value) ? value.toString().toLowerCase() : ""; 23419 }, 23420 iterateDependencies: function (dependencies, callback) { 23421 for (var key in dependencies) { 23422 if (dependencies.hasOwnProperty(key)) { 23423 var dependencyTable = dependencies[key]; 23424 for (var i = 0; i < dependencyTable.length; i++) { 23425 var dependency = dependencyTable[i]; 23426 callback(key, dependency); 23427 } 23428 } 23429 } 23430 }, 23431 getItemsByName: function (name, result, currentItem) { 23432 result = result || []; 23433 currentItem = currentItem || this.rootItem; 23434 if (currentItem) { 23435 if (currentItem.name == name) 23436 result.push(currentItem); 23437 for (var i = 0; i < currentItem.items.length; i++) 23438 this.getItemsByName(name, result, currentItem.items[i]); 23439 } 23440 return result; 23441 }, 23442 getField: function (name) { 23443 return new DialogLayoutField(name, this); 23444 }, 23445 beginUpdate: function() { 23446 this.allowAdjust = false; 23447 }, 23448 endUpdate: function() { 23449 this.allowAdjust = true; 23450 }, 23451 layoutUpdating: function() { 23452 return !this.allowAdjust; 23453 } 23454 }); 23455 return ASPx.CreateClass(extendentClass, properties); 23456 }; 23457 ASPx.CreateDialogLayoutClass = function (parentClass, properties) { 23458 var extendentClass = ASPx.CreateDialogLayoutBaseClass(parentClass, { 23459 constructor: function (name) { 23460 this.constructor.prototype.constructor.call(this, name); 23461 this.layoutPrepared = false; 23462 this.canModifyEnviroment = false; 23463 }, 23464 getPreparingCssClass: function () { 23465 return "dialog-preparing"; 23466 }, 23467 getSingleColumnCssClass: function () { 23468 return "dialog-singlecolumn"; 23469 }, 23470 InlineInitialize: function () { 23471 this.switchToSingleColumnAtWindowInnerWidth = this.calculateSwitchToSingleColumnAtWindowInnerWidth(); 23472 this.columnMinWidth = this.calculateColumnMinWidth(); 23473 ASPxClientFormLayout.prototype.InlineInitialize.call(this); 23474 }, 23475 Initialize: function () { 23476 this.beginUpdate(); 23477 ASPxClientFormLayout.prototype.Initialize.call(this); 23478 this.canModifyEnviroment = true; 23479 this.endUpdate(); 23480 }, 23481 onPageControlTabChanged: function () { 23482 this.adjustLogicalRows(); 23483 }, 23484 SetItemVisible: function () { 23485 ASPxClientFormLayout.prototype.SetItemVisible.apply(this, arguments); 23486 }, 23487 AdjustControlCore: function () { 23488 if(this.layoutUpdating()) 23489 return; 23490 if (this.canModifyEnviroment && !this.layoutPrepared) { 23491 this.removePopupInvisibleProperties(); 23492 this.prepareMinLayoutSize(); 23493 this.prepareDialogPopupIfNeeded(); 23494 this.adjustLogicalRows(); 23495 this.restorePopupInvisibleProperties(); 23496 ASPx.RemoveClassNameFromElement(this.GetMainElement(), this.getPreparingCssClass()); 23497 this.layoutPrepared = true; 23498 } 23499 this.AdjustControlInternal(true); 23500 }, 23501 AdjustControlInternal: function(force) { 23502 if(this.layoutUpdating()) 23503 return; 23504 ASPxClientFormLayout.prototype.AdjustControlInternal.call(this, force); 23505 }, 23506 removePopupInvisibleProperties: function () { 23507 var mainElement = this.GetMainElement(); 23508 var w = ASPx.GetParentByClassName(mainElement, "dialog-window");
23509 if(w && !ASPx.IsElementVisible(w)) { 23510 var winOuter = w.parentNode; 23511 this.savedWindowStyles = { display: winOuter.style.display, visibility: winOuter.style.visibility, overflow: "", height: "", width: "" }; 23512 ASPx.SetStyles(winOuter, { display: "block", visibility: "visible", overflow: "hidden", height: 0, width: 0 }); 23513 if (winOuter.parentNode.className.indexOf("dxmodalSys") > -1) { 23514 this.savedModalStyles = { display: "", overflow: "", height: "", width: "" }; 23515 ASPx.SetStyles(winOuter.parentNode, { display: "block", overflow: "hidden", height: 0, width: 0 }); 23516 } 23517 } 23518 }, 23519 restorePopupInvisibleProperties: function () { 23520 if (this.savedWindowStyles) { 23521 var mainElement = this.GetMainElement(); 23522 var w = ASPx.GetParentByClassName(mainElement, "dialog-window").parentNode; 23523 ASPx.SetStyles(w, this.savedWindowStyles); 23524 delete this.savedWindowStyles; 23525 if (this.savedModalStyles) { 23526 ASPx.SetStyles(w.parentNode, this.savedModalStyles); 23527 delete this.savedModalStyles; 23528 } 23529 } 23530 }, 23531 prepareDialogPopupIfNeeded: function () { 23532 var mainElement = this.GetMainElement(); 23533 if (!!ASPx.GetParentByClassName(mainElement, "dialog-window")) { 23534 var popup = this.findParentByType(ASPxClientPopupControl); 23535 var win = popup.GetWindowElement(-1); 23536 var newMaxWidth = mainElement.offsetWidth + ASPx.GetLeftRightBordersAndPaddingsSummaryValue(win); 23537 var oldMaxWidth = ASPx.PxToInt(ASPx.GetCurrentStyle(win).maxWidth); 23538 if (oldMaxWidth > 0 && oldMaxWidth < newMaxWidth) 23539 popup.SetAdaptiveMaxWidth(newMaxWidth); 23540 } 23541 }, 23542 prepareMinLayoutSize: function () { 23543 var mainElement = this.GetMainElement(); 23544 var buttonGroups = mainElement.querySelectorAll(".dialog-linc.buttons"); 23545 var layoutMinWidth = 0; 23546 for (var i = 0; i < buttonGroups.length; i++) { 23547 var buttonGroup = buttonGroups[i]; 23548 var minWidth = 0; 23549 var separators = buttonGroup.querySelectorAll(".dialog-separator"); 23550 for (var j = 0; j < separators.length; j++) 23551 minWidth += separators[j].offsetWidth; 23552 var maxButtonWidth = 0; 23553 var buttons = buttonGroup.querySelectorAll(".dialog-btn"); 23554 for (var j = 0; j < buttons.length; j++) { 23555 maxButtonWidth = Math.max(buttons[j].offsetWidth, maxButtonWidth); 23556 minWidth += ASPx.GetLeftRightMargins(buttons[j]); 23557 } 23558 minWidth += maxButtonWidth * buttons.length; 23559 var buttonWrappers = buttonGroup.querySelectorAll(".dialog-control-wrapper"); 23560 for (var j = 0; j < buttonWrappers.length; j++) { 23561 ASPx.SetStyles(buttonWrappers[j], { width: maxButtonWidth }); 23562 minWidth += ASPx.GetLeftRightMargins(buttonWrappers[j]); 23563 } 23564 ASPx.SetStyles(buttonGroup, { minWidth: minWidth }); 23565 while ((buttonGroup = buttonGroup.parentNode) != mainElement) 23566 minWidth += ASPx.GetLeftRightBordersAndPaddingsSummaryValue(buttonGroup); 23567 layoutMinWidth = Math.max(layoutMinWidth, minWidth); 23568 } 23569 ASPx.SetStyles(mainElement, { minWidth: layoutMinWidth }); 23570 }, 23571 adjustLogicalRows: function () { 23572 var rowNumber = 1; 23573 var mainElement = this.GetMainElement(); 23574 var rowCells = []; 23575 while ((rowCells = mainElement.querySelectorAll(".d-row-" + rowNumber)).length) { 23576 var parent = rowCells[0].parentNode; 23577 var tmpRowCells = []; 23578 for (var i = 0; i < rowCells.length; i++) { 23579 if (rowCells[i].parentNode == parent) { 23580 tmpRowCells.push(rowCells[i]); 23581 } else { 23582 if (tmpRowCells.length > 1) 23583 this.adjustHeightWithinSameRow(tmpRowCells); 23584 tmpRowCells = [rowCells[i]]; 23585 parent = rowCells[i].parentNode; 23586 } 23587 } 23588 if (tmpRowCells.length > 1) 23589 this.adjustHeightWithinSameRow(tmpRowCells); 23590 rowNumber++; 23591 } 23592 this.AdjustControlInternal(true); 23593 }, 23594 adjustHeightWithinSameRow: function (cells) { 23595 var maxHeight = 0; 23596 for(var i = 0; i < cells.length; i++) { 23597 cells[i].style.height = ""; 23598 } 23599 for (var i = 0; i < cells.length; i++) { 23600 if (this.getRowSpan(cells[i]) == 1) 23601 maxHeight = Math.max(cells[i].offsetHeight, maxHeight); 23602 } 23603 for (var i = 0; i < cells.length; i++) { 23604 var cell = cells[i]; 23605 var rowSpan = this.getRowSpan(cell); 23606 ASPx.SetStyles(cell, { height: maxHeight * rowSpan, marginBottom: -1 * (rowSpan - 1) * maxHeight });
23607 ASPxClientControl.AdjustControls(cell, true); 23608 } 23609 }, 23610 getRowSpan: function (cell) { 23611 if(!ASPx.IsExists(cell.dataset.rowSpan)) 23612 cell.dataset.rowSpan = cell.className.match(/(?:d-rowspan-)(\d)/)[1]; 23613 return cell.dataset.rowSpan; 23614 }, 23615 UpdateItemsCssClasses: function (fromHorizontalToVertical) { 23616 ASPxClientFormLayout.prototype.UpdateItemsCssClasses.call(this, fromHorizontalToVertical); 23617 if (fromHorizontalToVertical) 23618 ASPx.AddClassNameToElement(this.GetMainElement(), this.getSingleColumnCssClass()); 23619 else 23620 ASPx.RemoveClassNameFromElement(this.GetMainElement(), this.getSingleColumnCssClass()); 23621 }, 23622 GetLayoutItemElementsWithHorizontalCaptions: function () { 23623 return ASPxClientFormLayout.prototype.GetLayoutItemElementsWithHorizontalCaptions.call(this) 23624 .filter(function (element) { 23625 return !ASPx.GetParentByClassName(element, "dx-noAdaptive"); 23626 }); 23627 }, 23628 getAdaptiveSelector: function () { 23629 return "#" + this.name + " .dialog-lg:not(.dx-noAdaptive) > div"; 23630 }, 23631 getAdaptiveSelectorForContainer: function () { 23632 return this.getAdaptiveSelector() + ", " + 23633 this.getAdaptiveSelector() + " > .dialog-lgc > .dialog-li > .dialog-linc"; 23634 }, 23635 getAdaptiveSelectorForCaptionCell: function () { 23636 return this.getAdaptiveSelector() + " > .dialog-lgc > .dialog-li > .dxflCaptionCellSys"; 23637 }, 23638 getAdaptiveContainerStyles: function () { 23639 return "{ width: 100%!important; float: left; }"; 23640 }, 23641 getAdaptiveCaptionCellStyles: function () { 23642 return "{ width: 100%!important; float: left;height: auto !important; }"; 23643 }, 23644 calculateSwitchToSingleColumnAtWindowInnerWidth: function () { 23645 var singleColumnCssClass = this.getSingleColumnCssClass(); 23646 var mainElement = this.GetMainElement(); 23647 var isSingleColumn = ASPx.ElementHasCssClass(mainElement, singleColumnCssClass); 23648 if (!isSingleColumn) 23649 ASPx.AddClassNameToElement(mainElement, singleColumnCssClass); 23650 ASPx.Attr.RemoveStyleAttribute(mainElement, "max-width"); 23651 var singleColumnMaxWidthPx = ASPx.GetCurrentStyle(mainElement).maxWidth; 23652 ASPx.SetStyles(mainElement, { maxWidth: "none" }); 23653 if (!isSingleColumn) 23654 ASPx.RemoveClassNameFromElement(mainElement, singleColumnCssClass); 23655 return ASPx.PxToInt(singleColumnMaxWidthPx) || this.getDefaultSwitchToSingleColumnAtWindowInnerWidth(); 23656 }, 23657 getDefaultSwitchToSingleColumnAtWindowInnerWidth: function () { 23658 return 700; 23659 }, 23660 calculateColumnMinWidth: function () { 23661 return 0; 23662 }, 23663 isLayoutPrepared: function () { 23664 return this.layoutPrepared; 23665 } 23666 }); 23667 return ASPx.CreateClass(extendentClass, properties); 23668 }; 23669 ASPx.ClientDialogFormLayout = ASPx.CreateDialogLayoutClass(ASPxClientFormLayout, {}); 23670 var DialogLayoutField = ASPx.CreateClass(null, { 23671 constructor: function (name, dialogLayout) { 23672 this.name = name; 23673 this.dialogLayout = dialogLayout; 23674 }, 23675 getItem: function () { 23676 return this.dialogLayout.GetItemByName(this.name); 23677 }, 23678 getControl: function () { 23679 return this.getControlWithFallbackStrategy([this.getControlByMapping, this.getDialogLayoutInnerControl, this.getControlByItemId]); 23680 }, 23681 getControlByMapping: function () { 23682 return ASPxClientControl.GetControlCollection().Get(this.dialogLayout.controlNameIdMapping[this.name]); 23683 }, 23684 getDialogLayoutInnerControl: function () { 23685 return this.dialogLayout.getInnerControl("_" + this.name); 23686 }, 23687 getControlByItemId: function () { 23688 var item, control; 23689 if (item = this.getItem()) { 23690 var containerId = this.dialogLayout.GetItemElementID(item); 23691 containerId = containerId.substring(0, containerId.length - item.path.length) + this.name; 23692 control = window[containerId]; 23693 if (control && !ASPx.Ident.IsASPxClientControl(control) && control.nodeType == 1) 23694 control = ASPxClientControl.GetControlCollection().Get(containerId); 23695 } 23696 return control; 23697 }, 23698 getControlWithFallbackStrategy: function (gettersArray) { 23699 var control = null; 23700 while (gettersArray.length && !(control = gettersArray.shift().call(this))) { } 23701 return control; 23702 }, 23703 isEnabled: function () { 23704 var control = this.getControl(); 23705 return !!control && control.GetEnabled(); 23706 }, 23707 getValue: function () { 23708 var control = this.getControl(); 23709 return control && control.GetValue(); 23710 } 23711 }); 23712 ASPx.DialogLayoutField = DialogLayoutField; 23713ASPx.FormLayoutConsts = FormLayoutConsts; 23714window.ASPxClientLayoutItem = ASPxClientLayoutItem; 23715window.ASPxClientFormLayout = ASPxClientFormLayout; 23716window.ASPxClientFormLayoutUtils = ASPxClientFormLayoutUtils; 23717})(); 23718 23719(function() { 23720var ASPxClientEditBase = ASPx.CreateClass(ASPxClientControl, { 23721 constructor: function(name) { 23722 this.constructor.prototype.constructor.call(this, name); 23723 this.EnabledChanged = new ASPxClientEvent(); 23724 this.captionPosition = ASPx.Position.Left; 23725 this.showCaptionColon = true; 23726 this.scPrefix = "dxe"; 23727 }, 23728 InlineInitialize: function(){ 23729 ASPxClientControl.prototype.InlineInitialize.call(this); 23730 this.InitializeEnabled(); 23731 this.InitializeEvents(); 23732 }, 23733 InitializeEnabled: function() { 23734 this.SetEnabledInternal(this.clientEnabled, true); 23735 }, 23736 InitializeEvents: function() { }, 23737 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) { 23738 ASPx.AddReadOnlyItems(mainElementId, [[[cssClass], [''], ['']]]); 23739 }, 23740 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) { 23741 ASPx.AddDisabledItems(mainElementId, [[[cssClass], [''], ['']]]); 23742 }, 23743 GetValue: function() { 23744 var element = this.GetMainElement(); 23745 if(ASPx.IsExistsElement(element)) 23746 return element.innerHTML; 23747 return ""; 23748 }, 23749 GetValueString: function(){ 23750 var value = this.GetValue(); 23751 return (value == null) ? null : value.toString(); 23752 }, 23753 EnsureValueStringIsActual: function() { 23754 if(this.maskInfo != null) 23755 this.ParseValue(); 23756 }, 23757 SetValue: function(value) { 23758 if(value == null) 23759 value = ""; 23760 var element = this.GetMainElement(); 23761 if(ASPx.IsExistsElement(element)) 23762 element.innerHTML = value; 23763 }, 23764 GetEnabled: function(){ 23765 return this.enabled && this.clientEnabled; 23766 }, 23767 SetEnabled: function(enabled){ 23768 if(this.clientEnabled != enabled) { 23769 var errorFrameRequiresUpdate = this.GetIsValid && !this.GetIsValid();
23770 if(errorFrameRequiresUpdate && !enabled) 23771 this.UpdateErrorFrameAndFocus(false , null , true ); 23772 this.clientEnabled = enabled; 23773 this.SetEnabledInternal(enabled, false); 23774 if(errorFrameRequiresUpdate && enabled) 23775 this.UpdateErrorFrameAndFocus(false ); 23776 this.RaiseEnabledChangedEvent(); 23777 } 23778 }, 23779 SetEnabledInternal: function(enabled, initialization){ 23780 if(!this.enabled) return; 23781 if(!initialization || !enabled) 23782 this.ChangeEnabledStateItems(enabled); 23783 this.ChangeEnabledAttributes(enabled); 23784 if(ASPx.Browser.Chrome) { 23785 var mainElement = this.GetMainElement(); 23786 if(mainElement) 23787 mainElement.className = mainElement.className; 23788 } 23789 }, 23790 ChangeEnabledAttributes: function(enabled){ 23791 }, 23792 ChangeEnabledStateItems: function(enabled){ 23793 }, 23794 RaiseEnabledChangedEvent: function(){ 23795 if(!this.EnabledChanged.IsEmpty()){ 23796 var args = new ASPxClientEventArgs(); 23797 this.EnabledChanged.FireEvent(this, args); 23798 } 23799 }, 23800 GetDecodeValue: function (value) { 23801 if(typeof (value) == "string" && value.length > 1) 23802 value = this.SimpleDecodeHtml(value); 23803 return value; 23804 }, 23805 SimpleDecodeHtml: function (html) { 23806 return ASPx.Str.ApplyReplacement(html, [ 23807 [/</g, '<'], 23808 [/&/g, '&'], 23809 [/"/g, '"'], 23810 [/'/g, '\''], 23811 [/ /g, ' '] 23812 ]); 23813 }, 23814 GetCachedElementById: function(idSuffix) { 23815 return ASPx.CacheHelper.GetCachedElementById(this, this.name + idSuffix); 23816 }, 23817 GetCaptionCell: function() { 23818 return this.GetCachedElementById(EditElementSuffix.CaptionCell); 23819 }, 23820 GetExternalTable: function() { 23821 return this.GetCachedElementById(EditElementSuffix.ExternalTable); 23822 }, 23823 getCaptionRelatedCellCount: function() { 23824 if(!this.captionRelatedCellCount) 23825 this.captionRelatedCellCount = ASPx.GetNodesByClassName(this.GetExternalTable(), CaptionRelatedCellClassName).length; 23826 return this.captionRelatedCellCount; 23827 }, 23828 addCssClassToCaptionRelatedCells: function() { 23829 if(this.captionPosition == ASPx.Position.Left || this.captionPosition == ASPx.Position.Right) { 23830 var captionRelatedCellsIndex = this.captionPosition == ASPx.Position.Left ? 0 : this.GetCaptionCell().cellIndex; 23831 for(var i = 0; i < this.GetExternalTable().rows.length; i++) 23832 ASPx.AddClassNameToElement(this.GetExternalTable().rows[i].cells[captionRelatedCellsIndex], CaptionRelatedCellClassName); 23833 } 23834 if(this.captionPosition == ASPx.Position.Top || this.captionPosition == ASPx.Position.Bottom) 23835 for(var i = 0; i < this.GetCaptionCell().parentNode.cells.length; i++) 23836 ASPx.AddClassNameToElement(this.GetCaptionCell().parentNode.cells[i], CaptionRelatedCellClassName); 23837 }, 23838 GetCaption: function() { 23839 if(ASPx.IsExists(this.GetCaptionCell())) 23840 return this.getCaptionInternal(); 23841 return ""; 23842 }, 23843 SetCaption: function(caption) { 23844 if(!ASPx.IsExists(this.GetCaptionCell())) 23845 return; 23846 if(this.getCaptionRelatedCellCount() == 0) 23847 this.addCssClassToCaptionRelatedCells(); 23848 if(caption !== "") 23849 ASPx.RemoveClassNameFromElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName); 23850 else 23851 ASPx.AddClassNameToElement(this.GetExternalTable(), ASPxEditExternalTableClassNames.TableWithEmptyCaptionClassName); 23852 this.setCaptionInternal(caption); 23853 }, 23854 getCaptionTextNode: function() { 23855 var captionElement = ASPx.GetNodesByPartialClassName(this.GetCaptionCell(), CaptionElementPartialClassName)[0]; 23856 return ASPx.GetNormalizedTextNode(captionElement); 23857 }, 23858 getCaptionInternal: function() { 23859 var captionText = this.getCaptionTextNode().nodeValue; 23860 if(captionText !== "" && captionText[captionText.length - 1] == ":") 23861 captionText = captionText.substring(0, captionText.length - 1); 23862 return captionText; 23863 }, 23864 setCaptionInternal: function(caption) { 23865 caption = ASPx.Str.Trim(caption); 23866 var captionTextNode = this.getCaptionTextNode(); 23867 if(this.showCaptionColon && caption[caption.length - 1] != ":" && caption !== "") 23868 caption += ":"; 23869 captionTextNode.nodeValue = caption; 23870 }, 23871 onVirtualKeyboardUITouchStart: function(evt) { } 23872}); 23873var ValidationPattern = ASPx.CreateClass(null, { 23874 constructor: function(errorText) { 23875 this.errorText = errorText; 23876 } 23877}); 23878var RequiredFieldValidationPattern = ASPx.CreateClass(ValidationPattern, { 23879 constructor: function(errorText) { 23880 this.constructor.prototype.constructor.call(this, errorText); 23881 }, 23882 EvaluateIsValid: function(value) { 23883 return value != null && (value.constructor == Array || ASPx.Str.Trim(value.toString()) != ""); 23884 } 23885}); 23886var RegularExpressionValidationPattern = ASPx.CreateClass(ValidationPattern, { 23887 constructor: function(errorText, pattern) { 23888 this.constructor.prototype.constructor.call(this, errorText); 23889 this.pattern = pattern; 23890 }, 23891 EvaluateIsValid: function(value) { 23892 if(value == null) 23893 return true; 23894 var strValue = value.toString(); 23895 if(ASPx.Str.Trim(strValue).length == 0) 23896 return true; 23897 var regEx = new RegExp(this.pattern); 23898 var matches = regEx.exec(strValue); 23899 return matches != null && strValue == matches[0]; 23900 } 23901}); 23902function _aspxIsEditorFocusable(inputElement) { 23903 return ASPx.IsFocusableCore(inputElement, function(container) { 23904 return container.getAttribute("errorFrame") == "errorFrame"; 23905 }); 23906} 23907var invalidEditorToBeFocused = null; 23908var ValidationType = { 23909 PersonalOnValueChanged: "ValueChanged", 23910 PersonalViaScript: "CalledViaScript", 23911 MassValidation: "MassValidation" 23912}; 23913var ErrorFrameDisplay = { 23914 None: "None", 23915 Static: "Static", 23916 Dynamic: "Dynamic" 23917}; 23918var EditElementSuffix = { 23919 ExternalTable: "_ET", 23920 ControlCell: "_CC", 23921 ErrorCell: "_EC", 23922 ErrorTextCell: "_ETC", 23923 ErrorImage: "_EI", 23924 CaptionCell: "_CapC", 23925 AccessibilityAdditionalTextRow: "_AHTR" 23926}; 23927var ASPxEditExternalTableClassNames = { 23928 ValidStaticTableClassName: "dxeValidStEditorTable", 23929 ValidDynamicTableClassName: "dxeValidDynEditorTable", 23930 TableWithEmptyCaptionClassName: "tableWithEmptyCaption" 23931}; 23932var CaptionRelatedCellClassName = "dxeCaptionRelatedCell"; 23933var CaptionElementPartialClassName = "dxeCaption"; 23934var AccessibilityAssistantID = "AcAs"; 23935var ASPxClientEdit = ASPx.CreateClass(ASPxClientEditBase, { 23936 constructor: function(name) { 23937 this.constructor.prototype.constructor.call(this, name); 23938 this.isASPxClientEdit = true; 23939 this.inputElement = null; 23940 this.convertEmptyStringToNull = true; 23941 this.readOnly = false; 23942 this.clientReadOnly = false; 23943 this.focused = false; 23944 this.focusEventsLocked = false; 23945 this.focusEventsLockCount = 0; 23946 this.receiveGlobalMouseWheel = true; 23947 this.styleDecoration = null; 23948 this.heightCorrectionRequired = false; 23949 this.customValidationEnabled = false; 23950 this.display = ErrorFrameDisplay.Static; 23951 this.initialErrorText = ""; 23952 this.causesValidation = false; 23953 this.validateOnLeave = true; 23954 this.validationGroup = ""; 23955 this.sendPostBackWithValidation = null; 23956 this.validationPatterns = []; 23957 this.setFocusOnError = false; 23958 this.errorDisplayMode = "it"; 23959 this.errorText = ""; 23960 this.isValid = true; 23961 this.errorImageIsAssigned = false; 23962 this.notifyValidationSummariesToAcceptNewError = false; 23963 this.isErrorFrameRequired = false; 23964 this.enterProcessed = false; 23965 this.keyDownHandlers = {}; 23966 this.keyPressHandlers = {}; 23967 this.keyUpHandlers = {};
23968 this.onKeyDownHandler = null; 23969 this.onKeyPressHandler = null; 23970 this.onKeyUpHandler = null; 23971 this.onGotFocusHandler = null; 23972 this.onLostFocusHandler = null; 23973 this.GotFocus = new ASPxClientEvent(); 23974 this.LostFocus = new ASPxClientEvent(); 23975 this.Validation = new ASPxClientEvent(); 23976 this.ValueChanged = new ASPxClientEvent(); 23977 this.KeyDown = new ASPxClientEvent(); 23978 this.KeyPress = new ASPxClientEvent(); 23979 this.KeyUp = new ASPxClientEvent(); 23980 this.eventHandlersInitialized = false; 23981 this.errorCellVisibilityChanged = new ASPxClientEvent(); 23982 this.ariaExplanatoryTextManager = null; 23983 this.InitializeEventHandlers(); 23984 }, 23985 SetData: function(data){ 23986 if(data.decorationStyles){ 23987 for(var i = 0; i < data.decorationStyles.length; i++) 23988 this.AddDecorationStyle(data.decorationStyles[i].key, 23989 data.decorationStyles[i].className, 23990 data.decorationStyles[i].cssText); 23991 } 23992 }, 23993 Initialize: function() { 23994 this.initialErrorText = this.errorText; 23995 ASPxClientEditBase.prototype.Initialize.call(this); 23996 this.InitializeKeyHandlers(); 23997 this.UpdateClientValidationState(); 23998 this.UpdateValidationSummaries(null , true ); 23999 }, 24000 InlineInitialize: function() { 24001 if(this.UseDelayedSpecialFocus()) 24002 this.InitializeDelayedSpecialFocus(); 24003 ASPxClientEditBase.prototype.InlineInitialize.call(this); 24004 this.UpdateStyleDecorations(); 24005 var externalTable = this.GetExternalTable(); 24006 if(externalTable && ASPx.IsPercentageSize(externalTable.style.width)) { 24007 this.width = "100%"; 24008 this.GetMainElement().style.width = "100%"; 24009 if(this.isErrorFrameRequired) 24010 externalTable.setAttribute("errorFrame", "errorFrame"); 24011 } 24012 this.ariaExplanatoryTextManager = this.CreateAriaExplanatoryTextManager(); 24013 if(this.clientReadOnly) 24014 this.SetReadOnlyInternal(true); 24015 this.UpdateErrorCellParentRowVisibility(); 24016 }, 24017 AfterInitialize: function() { 24018 this.ariaExplanatoryTextManager.SetCaptionAssociating(); 24019 this.ariaExplanatoryTextManager.UpdateText(); 24020 this.ariaExplanatoryTextManager.UpdateValidationState(); 24021 ASPxClientEditBase.prototype.AfterInitialize.call(this); 24022 }, 24023 UpdateStyleDecorations: function() { 24024 if(this.styleDecoration) 24025 this.styleDecoration.Update(); 24026 }, 24027 UseSpecialKeyboardHandling: function() { 24028 return false; 24029 }, 24030 InitializeKeyHandlers: function() { 24031 }, 24032 AddKeyDownHandler: function(key, handler) { 24033 this.keyDownHandlers[key] = handler; 24034 }, 24035 AddKeyPressHandler: function(key, handler) { 24036 this.keyPressHandlers[key] = handler; 24037 }, 24038 InitializeEventHandlers: function() { 24039 this.onGotFocusHandler = function(evt) { ASPx.EGotFocus(this.name); }.bind(this); 24040 this.onLostFocusHandler = function(evt) { ASPx.ELostFocus(this.name); }.bind(this); 24041 if(this.UseSpecialKeyboardHandling()) { 24042 this.onKeyDownHandler = function(evt) { ASPx.KBSIKeyDown(this.name, evt); }.bind(this); 24043 this.onKeyPressHandler = function(evt) { ASPx.KBSIKeyPress(this.name, evt); }.bind(this); 24044 this.onKeyUpHandler = function(evt) { ASPx.KBSIKeyUp(this.name, evt); }.bind(this); 24045 } 24046 }, 24047 ChangeSpecialInputEnabledAttributes: function(element, method, doNotChangeAutoComplete) { 24048 if(!doNotChangeAutoComplete) 24049 element.autocomplete = "off"; 24050 if(this.onKeyDownHandler != null) 24051 method(element, "keydown", this.onKeyDownHandler); 24052 if(this.onKeyPressHandler != null) 24053 method(element, "keypress", this.onKeyPressHandler); 24054 if(this.onKeyUpHandler != null) 24055 method(element, "keyup", this.onKeyUpHandler); 24056 if(this.onGotFocusHandler != null) 24057 method(element, "focus", this.onGotFocusHandler); 24058 if(this.onLostFocusHandler != null) 24059 method(element, "blur", this.onLostFocusHandler); 24060 }, 24061 CreateAriaExplanatoryTextManager: function() { 24062 if(this.accessibilityCompliant) 24063 return new EditAccessibilityExplanatoryTextManager(this); 24064 else 24065 return new DisableAccessibilityExplanatoryTextManager(this); 24066 }, 24067 UpdateClientValidationState: function() { 24068 if(!this.customValidationEnabled) 24069 return; 24070 var mainElement = this.GetMainElement(); 24071 if(mainElement) { 24072 var validationState = !this.GetIsValid() ? ("-" + this.GetErrorText()) : ""; 24073 this.UpdateStateObjectWithObject({ validationState: validationState }); 24074 } 24075 },
24076 UpdateValidationSummaries: function(validationType, initializing) { 24077 if(ASPx.Ident.scripts.ASPxClientValidationSummary) { 24078 var summaryCollection = ASPx.GetClientValidationSummaryCollection(); 24079 summaryCollection.OnEditorIsValidStateChanged(this, validationType, initializing && this.notifyValidationSummariesToAcceptNewError); 24080 } 24081 }, 24082 FindInputElement: function(){ 24083 return null; 24084 }, 24085 GetInputElement: function(){ 24086 if(!ASPx.IsExistsElement(this.inputElement)) 24087 this.inputElement = this.FindInputElement(); 24088 return this.inputElement; 24089 }, 24090 GetFocusableInputElement: function() { 24091 return this.GetInputElement(); 24092 }, 24093 GetAccessibilityActiveElements: function() { 24094 return [this.GetInputElement()]; 24095 }, 24096 GetAccessibilityFirstActiveElement: function() { 24097 return this.accessibilityHelper ? 24098 this.accessibilityHelper.getMainElement() : 24099 this.GetAccessibilityActiveElements()[0]; 24100 }, 24101 GetAccessibilityAssistantElement: function() { 24102 return this.GetChildElement(AccessibilityAssistantID); 24103 }, 24104 GetErrorImage: function() { 24105 return this.GetCachedElementById(EditElementSuffix.ErrorImage); 24106 }, 24107 GetControlCell: function() { 24108 return this.GetCachedElementById(EditElementSuffix.ControlCell); 24109 }, 24110 GetErrorCell: function() { 24111 return this.GetCachedElementById(EditElementSuffix.ErrorCell); 24112 }, 24113 GetErrorTextCell: function() { 24114 return this.GetCachedElementById(this.errorImageIsAssigned ? EditElementSuffix.ErrorTextCell : EditElementSuffix.ErrorCell); 24115 }, 24116 GetReadOnly: function() { 24117 return this.readOnly || this.clientReadOnly; 24118 }, 24119 SetReadOnly: function(readOnly) { 24120 readOnly = !!readOnly; 24121 if(this.clientReadOnly === readOnly || this.readOnly) 24122 return; 24123 this.SetReadOnlyInternal(readOnly); 24124 }, 24125 SetReadOnlyInternal: function(readOnly) { 24126 this.clientReadOnly = readOnly; 24127 this.ChangeReadOnlyStateItems(readOnly); 24128 }, 24129 ChangeReadOnlyStateItems: function(readOnly) { 24130 ASPx.GetStateController().SetElementReadOnly(this.GetMainElement(), readOnly); 24131 }, 24132 SetVisible: function (isVisible) { 24133 if(this.clientVisible == isVisible) 24134 return; 24135 var externalTable = this.GetExternalTable(); 24136 if(externalTable) { 24137 ASPx.SetElementDisplay(externalTable, isVisible); 24138 if(this.customValidationEnabled) { 24139 var isValid = !isVisible ? true : void (0); 24140 this.UpdateErrorFrameAndFocus(false , true , isValid ); 24141 } 24142 } 24143 ASPxClientControl.prototype.SetVisible.call(this, isVisible); 24144 }, 24145 GetStateHiddenFieldName: function() { 24146 return this.uniqueID + "$State"; 24147 }, 24148 GetValueInputToValidate: function() { 24149 return this.GetInputElement(); 24150 }, 24151 IsVisible: function() { 24152 if(!this.clientVisible) 24153 return false; 24154 var element = this.GetMainElement(); 24155 if(!element) 24156 return false; 24157 while(element && element.tagName != "BODY") { 24158 if(element.getAttribute("errorFrame") != "errorFrame" && (!ASPx.GetElementVisibility(element) || !ASPx.GetElementDisplay(element))) 24159 return false; 24160 element = element.parentNode; 24161 } 24162 return true; 24163 }, 24164 AdjustControlCore: function() { 24165 this.CollapseEditor(); 24166 this.UnstretchInputElement(); 24167 if(this.heightCorrectionRequired) 24168 this.CorrectEditorHeight(); 24169 }, 24170 CorrectEditorHeight: function() { 24171 }, 24172 UnstretchInputElement: function() { 24173 }, 24174 UseDelayedSpecialFocus: function() { 24175 return false; 24176 }, 24177 GetInnerEditors: function() { 24178 return []; 24179 }, 24180 GetDelayedSpecialFocusTriggers: function() { 24181 return [ this.GetMainElement() ]; 24182 }, 24183 InitializeDelayedSpecialFocus: function() { 24184 this.specialFocusTimer = -1; 24185 var handler = function(evt) { this.OnDelayedSpecialFocusMouseDown(evt); }.aspxBind(this); 24186 var triggers = this.GetDelayedSpecialFocusTriggers(); 24187 for(var i = 0; i < triggers.length; i++) 24188 ASPx.Evt.AttachEventToElement(triggers[i], "mousedown", handler); 24189 }, 24190 OnDelayedSpecialFocusMouseDown: function(evt) { 24191 window.setTimeout(function() { this.SetFocus(); }.aspxBind(this), 0); 24192 }, 24193 IsFocusEventsLocked: function() { 24194 return this.focusEventsLocked || this.focusEventsLockCount !== 0; 24195 }, 24196 BeginFocusUpdate: function() { 24197 this.focusEventsLockCount++; 24198 }, 24199 EndFocusUpdate: function() { 24200 this.focusEventsLockCount--; 24201 if(this.focusEventsLockCount === 0) 24202 if(this.focused && !this.IsEditorElement(document.activeElement)) 24203 this.OnLostFocus(); 24204 }, 24205 LockFocusEvents: function() { 24206 if(!this.focused) return; 24207 this.focusEventsLocked = true; 24208 }, 24209 UnlockFocusEvents: function() { 24210 this.focusEventsLocked = false; 24211 }, 24212 ForceRefocusEditor: function(evt, isNativeFocus) { 24213 if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) { 24214 var focusedEditor = ASPx.VirtualKeyboardUI.getFocusedEditor(); 24215 if(ASPx.VirtualKeyboardUI.getInputNativeFocusLocked() && (!focusedEditor || focusedEditor === this)) 24216 return; 24217 ASPx.VirtualKeyboardUI.setInputNativeFocusLocked(!isNativeFocus); 24218 }
24219 this.LockFocusEvents(); 24220 this.BlurInputElement(); 24221 window.setTimeout(function() { 24222 if(ASPx.Browser.VirtualKeyboardSupported && !this.ownerListBox) { 24223 ASPx.VirtualKeyboardUI.setFocusToEditor(this); 24224 } else { 24225 this.SetFocus(); 24226 } 24227 }.aspxBind(this), 0); 24228 }, 24229 BlurInputElement: function() { 24230 var inputElement = this.GetFocusableInputElement(); 24231 if(inputElement && inputElement.blur) 24232 inputElement.blur(); 24233 }, 24234 IsEditorElement: function(element) { 24235 return this.GetMainElement() == element || ASPx.GetIsParent(this.GetMainElement(), element); 24236 }, 24237 IsClearButtonElement: function(element) { 24238 return false; 24239 }, 24240 IsElementBelongToInputElement: function(element) { 24241 return this.GetInputElement() == element; 24242 }, 24243 OnFocusCore: function() { 24244 if(this.UseDelayedSpecialFocus()) 24245 this.specialFocusTimer = ASPx.Timer.ClearTimer(this.specialFocusTimer); 24246 if(!this.IsFocusEventsLocked()){ 24247 this.focused = true; 24248 ASPx.SetFocusedEditor(this); 24249 if(this.styleDecoration) 24250 this.styleDecoration.Update(); 24251 if(this.isInitialized) 24252 this.RaiseFocus(); 24253 } 24254 else 24255 this.UnlockFocusEvents(); 24256 }, 24257 OnLostFocusCore: function() { 24258 if(!this.IsFocusEventsLocked()){ 24259 this.focused = false; 24260 if(ASPx.GetFocusedEditor() === this) 24261 ASPx.SetFocusedEditor(null); 24262 if(this.styleDecoration) 24263 this.styleDecoration.Update(); 24264 this.RaiseLostFocus(); 24265 } 24266 }, 24267 OnFocus: function() { 24268 var focusedEditor = ASPx.GetFocusedEditor(); 24269 if(focusedEditor && focusedEditor.UseDelayedSpecialFocus() && focusedEditor !== this && focusedEditor.GetInnerEditors().indexOf(this) === -1 && ASPx.IsElementVisible(focusedEditor.GetMainElement())) { 24270 var lostFocusHandler = function() { 24271 focusedEditor.LostFocus.RemoveHandler(lostFocusHandler); 24272 this.OnFocusCore(); 24273 }.bind(this); 24274 focusedEditor.LostFocus.AddHandler(lostFocusHandler); 24275 } 24276 else { 24277 this.OnFocusCore(); 24278 } 24279 }, 24280 OnLostFocus: function() { 24281 if(this.isInitialized) 24282 this.OnLostFocusCore(); 24283 }, 24284 OnMouseWheel: function(evt){ 24285 }, 24286 OnValidation: function(validationType) { 24287 if(this.customValidationEnabled && this.isInitialized && ASPx.IsExistsElement(this.GetMainElement()) && 24288 (!this.IsErrorFrameDisplayed() || this.GetElementRequiredForErrorFrame())) { 24289 this.BeginErrorFrameUpdate(); 24290 try { 24291 if(this.validateOnLeave || validationType != ValidationType.PersonalOnValueChanged) { 24292 this.SetIsValid(true, true ); 24293 this.SetErrorText(this.initialErrorText, true ); 24294 this.ValidateWithPatterns(); 24295 this.RaiseValidation(); 24296 } 24297 this.UpdateErrorFrameAndFocus(this.editorFocusingRequired(validationType)); 24298 } finally { 24299 this.EndErrorFrameUpdate(); 24300 } 24301 this.UpdateValidationSummaries(validationType); 24302 this.ariaExplanatoryTextManager.UpdateValidationState(validationType); 24303 } 24304 }, 24305 GetElementRequiredForErrorFrame: function() { 24306 return this.GetExternalTable(); 24307 }, 24308 editorFocusingRequired: function(validationType) { 24309 return !this.GetIsValid() && 24310 validationType == ValidationType.PersonalViaScript && this.setFocusOnError; 24311 }, 24312 OnValueChanged: function() { 24313 if(this.getProcessOnServerOnValueChanged()) 24314 this.SendPostBackInternal(""); 24315 }, 24316 getProcessOnServerOnValueChanged: function() { 24317 var processOnServer = this.RaiseValidationInternal(); 24318 return this.RaiseValueChangedEvent() && processOnServer; 24319 }, 24320 ParseValue: function() { 24321 }, 24322 RaisePersonalStandardValidation: function() { 24323 if(ASPx.IsFunction(window.ValidatorOnChange)) { 24324 var inputElement = this.GetValueInputToValidate(); 24325 if(inputElement && inputElement.Validators) 24326 window.ValidatorOnChange({ srcElement: inputElement }); 24327 } 24328 }, 24329 RaiseValidationInternal: function() { 24330 if(this.isPostBackAllowed() && this.causesValidation && this.validateOnLeave) 24331 return ASPxClientEdit.ValidateGroup(this.validationGroup); 24332 else { 24333 this.OnValidation(ValidationType.PersonalOnValueChanged); 24334 return this.GetIsValid(); 24335 } 24336 }, 24337 RaiseValueChangedEvent: function(){ 24338 return this.RaiseValueChanged(); 24339 }, 24340 SendPostBackInternal: function(postBackArg) { 24341 if(ASPx.IsFunction(this.sendPostBackWithValidation)) 24342 this.sendPostBackWithValidation(postBackArg); 24343 else 24344 this.SendPostBack(postBackArg); 24345 }, 24346 SetElementToBeFocused: function() { 24347 if(this.IsVisible()) 24348 invalidEditorToBeFocused = this; 24349 }, 24350 GetFocusSelectAction: function() { 24351 return null; 24352 }, 24353 SetFocus: function() { 24354 var inputElement = this.GetFocusableInputElement(); 24355 if(!inputElement) return; 24356 if((ASPx.GetActiveElement() != inputElement) && _aspxIsEditorFocusable(inputElement)) 24357 ASPx.SetFocus(inputElement, this.GetFocusSelectAction()); 24358 }, 24359 SetFocusOnError: function() { 24360 if(invalidEditorToBeFocused == this) { 24361 this.SetFocus(); 24362 invalidEditorToBeFocused = null; 24363 } 24364 }, 24365 BeginErrorFrameUpdate: function() { 24366 if(!this.errorFrameUpdateLocked) 24367 this.errorFrameUpdateLocked = true; 24368 }, 24369 EndErrorFrameUpdate: function() { 24370 this.errorFrameUpdateLocked = false; 24371 var args = this.updateErrorFrameAndFocusLastCallArgs; 24372 if(args) { 24373 this.UpdateErrorFrameAndFocus(args[0], args[1]); 24374 delete this.updateErrorFrameAndFocusLastCallArgs; 24375 } 24376 }, 24377 UpdateErrorFrameAndFocus: function(setFocusOnError, ignoreVisibilityCheck, isValid) { 24378 if(!ignoreVisibilityCheck && !this.GetVisible()) 24379 return; 24380 if(this.errorFrameUpdateLocked) { 24381 this.updateErrorFrameAndFocusLastCallArgs = [ setFocusOnError, ignoreVisibilityCheck ]; 24382 return; 24383 } 24384 if(this.styleDecoration) 24385 this.styleDecoration.Update(); 24386 if(typeof(isValid) == "undefined") 24387 isValid = this.GetIsValid(); 24388 if(isValid && this.IsErrorFrameDisplayed()) 24389 this.ChangeErrorFrameVisibility(false); 24390 else { 24391 var editorLocatedWithinVisibleContainer = this.IsVisible(); 24392 if(this.IsErrorFrameDisplayed()) { 24393 this.UpdateErrorCellContent(); 24394 this.ChangeErrorFrameVisibility(true); 24395 } 24396 if(editorLocatedWithinVisibleContainer) { 24397 if(setFocusOnError && this.setFocusOnError && invalidEditorToBeFocused == null) { 24398 this.SetElementToBeFocused(); 24399 this.SetFocusOnError(); 24400 } 24401 } 24402 } 24403 }, 24404 ChangeErrorFrameVisibility: function(visible) { 24405 var externalTable = this.GetExternalTable(); 24406 var isStaticDisplay = this.display == ErrorFrameDisplay.Static; 24407 if(!isStaticDisplay && visible) { 24408 this.EnsureControlCellStylesLoaded(); 24409 this.RestoreControlCellStyles(); 24410 } 24411 this.ChangeErrorCellVisibility(visible, isStaticDisplay); 24412 if(!isStaticDisplay && !visible) { 24413 this.EnsureControlCellStylesLoaded(); 24414 this.ClearControlCellStyles(); 24415 }
24416 var validExternalTableClassName = isStaticDisplay ? ASPxEditExternalTableClassNames.ValidStaticTableClassName 24417 : ASPxEditExternalTableClassNames.ValidDynamicTableClassName; 24418 ASPx.ToggleClassNameToElement(externalTable, validExternalTableClassName, !visible); 24419 this.UpdateErrorCellParentRowVisibility(); 24420 }, 24421 ChangeErrorCellVisibility: function(visible, useVisibilityAttribute) { 24422 var errorCell = this.GetErrorCell(); 24423 if(errorCell) { 24424 if(useVisibilityAttribute) 24425 ASPx.SetElementVisibility(errorCell, visible); 24426 else { 24427 ASPx.SetElementDisplay(errorCell, visible); 24428 this.raiseErrorCellVisibilityChanged(); 24429 } 24430 } 24431 }, 24432 raiseErrorCellVisibilityChanged: function() { 24433 if(!this.errorCellVisibilityChanged.IsEmpty()) 24434 this.errorCellVisibilityChanged.FireEvent(this); 24435 }, 24436 UpdateErrorCellParentRowVisibility: function() { 24437 var errorCell = this.GetErrorCell(); 24438 if(!errorCell || this.display == ErrorFrameDisplay.Static) 24439 return; 24440 var displayedCellCount = 0; 24441 var errorCellParentRow = errorCell.parentNode; 24442 for(var i = 0; i < errorCellParentRow.cells.length; i++) { 24443 var cell = errorCellParentRow.cells[i]; 24444 if(ASPx.GetElementDisplay(cell)) 24445 displayedCellCount++; 24446 } 24447 ASPx.SetElementDisplay(errorCellParentRow, displayedCellCount > 0); 24448 }, 24449 EnsureControlCellStylesLoaded: function() { 24450 if(typeof(this.controlCellStyles) == "undefined") { 24451 var controlCell = this.GetControlCell(); 24452 this.controlCellStyles = { 24453 cssClass: controlCell.className,
24454 style: this.ExtractElementStyleStringIgnoringVisibilityProps(controlCell) 24455 }; 24456 } 24457 }, 24458 ClearControlCellStyles: function() { 24459 this.ClearElementStyle(this.GetControlCell()); 24460 }, 24461 RestoreControlCellStyles: function() { 24462 var controlCell = this.GetControlCell(); 24463 controlCell.className = this.controlCellStyles.cssClass; 24464 controlCell.style.cssText = this.controlCellStyles.style; 24465 }, 24466 ExtractElementStyleStringIgnoringVisibilityProps: function(element) { 24467 var savedVisibility = element.style.visibility; 24468 var savedDisplay = element.style.display; 24469 element.style.visibility = ""; 24470 element.style.display = ""; 24471 var styleStr = element.style.cssText; 24472 element.style.visibility = savedVisibility; 24473 element.style.display = savedDisplay; 24474 return styleStr; 24475 }, 24476 ClearElementStyle: function(element) { 24477 if(!element) 24478 return; 24479 element.className = ""; 24480 var excludedAttrNames = [ 24481 "width", "display", "visibility", 24482 "position", "left", "top", "z-index", 24483 "margin", "margin-top", "margin-right", "margin-bottom", "margin-left", 24484 "float", "clear" 24485 ]; 24486 var savedAttrValues = { }; 24487 for(var i = 0; i < excludedAttrNames.length; i++) { 24488 var attrName = excludedAttrNames[i]; 24489 var attrValue = element.style[attrName]; 24490 if(attrValue) 24491 savedAttrValues[attrName] = attrValue; 24492 } 24493 element.style.cssText = ""; 24494 for(var styleAttrName in savedAttrValues) 24495 if(savedAttrValues.hasOwnProperty(styleAttrName)) 24496 element.style[styleAttrName] = savedAttrValues[styleAttrName]; 24497 }, 24498 Clear: function() { 24499 this.SetValue(null); 24500 this.SetIsValid(true); 24501 return true; 24502 }, 24503 ResetEditorState: function() { }, 24504 UpdateErrorCellContent: function() { 24505 if(this.errorDisplayMode.indexOf("t") > -1) 24506 this.UpdateErrorText(); 24507 if(this.errorDisplayMode == "i") 24508 this.UpdateErrorImage(); 24509 }, 24510 UpdateErrorImage: function() { 24511 var image = this.GetErrorImage(); 24512 if(ASPx.IsExistsElement(image)) { 24513 if(this.accessibilityCompliant) { 24514 ASPx.Attr.SetAttribute(image, "aria-label", this.errorText); 24515 var innerImg = ASPx.GetNodeByTagName(image, "IMG", 0); 24516 if(ASPx.IsExists(innerImg)) 24517 innerImg.alt = this.errorText; 24518 } 24519 image.alt = this.errorText; 24520 image.title = this.errorText; 24521 } else { 24522 this.UpdateErrorText(); 24523 } 24524 }, 24525 UpdateErrorText: function() { 24526 var errorTextCell = this.GetErrorTextCell(); 24527 if(ASPx.IsExistsElement(errorTextCell)) 24528 errorTextCell.innerHTML = this.HtmlEncode(this.errorText); 24529 }, 24530 ValidateWithPatterns: function() { 24531 if(this.validationPatterns.length > 0) { 24532 var value = this.GetValue(); 24533 for(var i = 0; i < this.validationPatterns.length; i++) { 24534 var validator = this.validationPatterns[i]; 24535 if(!validator.EvaluateIsValid(value)) { 24536 this.SetIsValid(false, true ); 24537 this.SetErrorText(validator.errorText, true ); 24538 return; 24539 } 24540 } 24541 } 24542 }, 24543 OnSpecialKeyDown: function(evt){ 24544 this.RaiseKeyDown(evt); 24545 var handler = this.keyDownHandlers[evt.keyCode]; 24546 if(handler) 24547 return this[handler](evt); 24548 return false; 24549 }, 24550 OnSpecialKeyPress: function(evt){ 24551 this.RaiseKeyPress(evt); 24552 var handler = this.keyPressHandlers[evt.keyCode]; 24553 if(handler) 24554 return this[handler](evt); 24555 if(ASPx.Browser.NetscapeFamily || ASPx.Browser.Opera){ 24556 if(evt.keyCode == ASPx.Key.Enter) 24557 return this.enterProcessed; 24558 } 24559 return false; 24560 }, 24561 OnSpecialKeyUp: function(evt){ 24562 this.RaiseKeyUp(evt); 24563 var handler = this.keyUpHandlers[evt.keyCode]; 24564 if(handler) 24565 return this[handler](evt); 24566 return false; 24567 }, 24568 OnKeyDown: function(evt) { 24569 if(!this.UseSpecialKeyboardHandling()) 24570 this.RaiseKeyDown(evt); 24571 }, 24572 OnKeyPress: function(evt) { 24573 if(!this.UseSpecialKeyboardHandling()) 24574 this.RaiseKeyPress(evt); 24575 }, 24576 OnKeyUp: function(evt) { 24577 if(!this.UseSpecialKeyboardHandling()) 24578 this.RaiseKeyUp(evt); 24579 }, 24580 RaiseKeyDown: function(evt){ 24581 if(!this.KeyDown.IsEmpty()){ 24582 var args = new ASPxClientEditKeyEventArgs(evt); 24583 this.KeyDown.FireEvent(this, args); 24584 } 24585 }, 24586 RaiseKeyPress: function(evt){ 24587 if(!this.KeyPress.IsEmpty()){ 24588 var args = new ASPxClientEditKeyEventArgs(evt); 24589 this.KeyPress.FireEvent(this, args); 24590 } 24591 }, 24592 RaiseKeyUp: function(evt){ 24593 if(!this.KeyUp.IsEmpty()){ 24594 var args = new ASPxClientEditKeyEventArgs(evt); 24595 this.KeyUp.FireEvent(this, args); 24596 } 24597 }, 24598 RaiseFocus: function(){ 24599 if(!this.GotFocus.IsEmpty()){ 24600 var args = new ASPxClientEventArgs(); 24601 this.GotFocus.FireEvent(this, args); 24602 } 24603 }, 24604 RaiseLostFocus: function(){ 24605 if(!this.LostFocus.IsEmpty()){ 24606 var args = new ASPxClientEventArgs(); 24607 this.LostFocus.FireEvent(this, args); 24608 } 24609 }, 24610 RaiseValidation: function() { 24611 if(this.customValidationEnabled && !this.Validation.IsEmpty()) { 24612 var currentValue = this.GetValue(); 24613 var args = new ASPxClientEditValidationEventArgs(currentValue, this.errorText, this.GetIsValid()); 24614 this.Validation.FireEvent(this, args); 24615 this.SetErrorText(args.errorText, true ); 24616 this.SetIsValid(args.isValid, true ); 24617 if(args.value != currentValue) 24618 this.SetValue(args.value); 24619 } 24620 }, 24621 RaiseValueChanged: function(){ 24622 var processOnServer = this.isPostBackAllowed(); 24623 if(!this.ValueChanged.IsEmpty()){ 24624 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 24625 this.ValueChanged.FireEvent(this, args); 24626 processOnServer = args.processOnServer; 24627 } 24628 return processOnServer; 24629 }, 24630 isPostBackAllowed: function() { 24631 return this.autoPostBack; 24632 }, 24633 AddDecorationStyle: function(key, className, cssText) { 24634 if(!this.styleDecoration) 24635 this.RequireStyleDecoration(); 24636 this.styleDecoration.AddStyle(key, className, cssText); 24637 }, 24638 RequireStyleDecoration: function() { 24639 this.styleDecoration = this.CreateStyleDecoration(); 24640 this.PopulateStyleDecorationPostfixes(); 24641 }, 24642 CreateStyleDecoration: function() { 24643 return new ASPx.EditorStyleDecoration(this); 24644 }, 24645 PopulateStyleDecorationPostfixes: function() { 24646 this.styleDecoration.AddPostfix(""); 24647 }, 24648 LockStyleDecorationUpdate: function() { 24649 if(this.styleDecoration) 24650 this.styleDecoration.LockUpdate(); 24651 }, 24652 UnlockStyleDecorationUpdate: function() { 24653 if(this.styleDecoration) 24654 this.styleDecoration.UnlockUpdate(); 24655 }, 24656 Focus: function(){ 24657 this.SetFocus(); 24658 }, 24659 GetIsValid: function() { 24660 var hasRequiredInputElement = !this.RequireInputElementToValidate() || ASPx.IsExistsElement(this.GetInputElement()); 24661 if(!hasRequiredInputElement || this.IsErrorFrameDisplayed() && !ASPx.IsExistsElement(this.GetElementRequiredForErrorFrame())) 24662 return true; 24663 return this.isValid; 24664 }, 24665 RequireInputElementToValidate: function() { 24666 return true; 24667 }, 24668 IsErrorFrameDisplayed: function() { 24669 return this.display !== ErrorFrameDisplay.None; 24670 }, 24671 GetErrorText: function(){ 24672 return this.errorText; 24673 }, 24674 SetIsValid: function(isValid, validating){ 24675 if(this.customValidationEnabled && this.isValid != isValid) { 24676 this.isValid = isValid; 24677 this.UpdateErrorFrameAndFocus(false );
24678 this.UpdateClientValidationState(); 24679 if(!validating) 24680 this.UpdateValidationSummaries(ValidationType.PersonalViaScript); 24681 } 24682 }, 24683 SetErrorText: function(errorText, validating){ 24684 if(this.customValidationEnabled && this.errorText != errorText) { 24685 this.errorText = errorText; 24686 this.UpdateErrorFrameAndFocus(false ); 24687 this.UpdateClientValidationState(); 24688 if(!validating) 24689 this.UpdateValidationSummaries(ValidationType.PersonalViaScript); 24690 } 24691 }, 24692 Validate: function(){ 24693 this.ParseValue(); 24694 this.OnValidation(ValidationType.PersonalViaScript); 24695 }, 24696 GetModifyEvent: function() { 24697 return this.ValueChanged; 24698 }, 24699 EnsureRequiredNativeAttributesExists: function() { } 24700}); 24701ASPx.Ident.scripts.ASPxClientEdit = true; 24702ASPx.focusedEditorName = ""; 24703ASPx.GetFocusedEditor = function() { 24704 var focusedEditor = ASPx.GetControlCollection().Get(ASPx.focusedEditorName); 24705 if(focusedEditor && !focusedEditor.focused){ 24706 ASPx.SetFocusedEditor(null); 24707 focusedEditor = null; 24708 } 24709 return focusedEditor; 24710}; 24711ASPx.SetFocusedEditor = function(editor) { 24712 ASPx.focusedEditorName = editor ? editor.name : ""; 24713}; 24714ASPx.FindAssociatedLabelElements = function(editor) { 24715 var assocciatedLabels = []; 24716 var inputElement = editor.GetInputElement(); 24717 if(!ASPx.IsExists(inputElement) || !inputElement.id) 24718 return assocciatedLabels; 24719 var labels = ASPx.GetNodesByTagName(document, "LABEL"); 24720 for(var i = 0; i < labels.length; i++) { 24721 if(!!labels[i].htmlFor && labels[i].htmlFor === inputElement.id) 24722 assocciatedLabels.push(labels[i]); 24723 } 24724 return assocciatedLabels; 24725}; 24726var DisableAccessibilityExplanatoryTextManager = ASPx.CreateClass(null, { 24727 constructor: function(editor) { 24728 this.editor = editor; 24729 }, 24730 GetAdditionalTextRowId: function() { 24731 return this.editor.name + EditElementSuffix.AccessibilityAdditionalTextRow; 24732 }, 24733 GetErrorTextElement: function () { 24734 return !!this.editor.GetErrorTextCell() ? this.editor.GetErrorTextCell() : this.editor.GetErrorImage(); 24735 }, 24736 GetTextElement: function() { return null; }, 24737 SetCaptionAssociating: function() { }, 24738 UpdateText: function() { }, 24739 UpdateValidationState: function(validationType) { }, 24740 ToggleErrorAlert: function() { }, 24741 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) { } 24742}); 24743var EditAccessibilityExplanatoryTextManager = ASPx.CreateClass(DisableAccessibilityExplanatoryTextManager, { 24744 constructor: function(editor) { 24745 this.constructor.prototype.constructor.call(this, editor); 24746 this.invisibleRowCssClassName = "dxAIR"; 24747 }, 24748 GetTextElement: function() { 24749 var mainElement = this.editor.GetMainElement(); 24750 if(!mainElement) return null; 24751 var explanatoryText = ""; 24752 var explanatoryTextElement = null; 24753 if(!!this.editor.nullText) 24754 explanatoryText = this.editor.nullText; 24755 else if(!!this.editor.helpTextObj) 24756 explanatoryTextElement = this.editor.helpTextObj.helpTextElement; 24757 else if(!!mainElement.title) 24758 explanatoryText = mainElement.title; 24759 if(explanatoryText && mainElement.tagName == "TABLE") { 24760 var assistantElement = this.editor.GetAccessibilityFirstActiveElement(); 24761 if(assistantElement) 24762 ASPx.Attr.Aria.AppendLabel(assistantElement, explanatoryText, true); 24763 } 24764 return explanatoryTextElement; 24765 }, 24766 SetCaptionAssociating: function() { 24767 var captionCell = this.editor.GetCaptionCell(); 24768 if(!captionCell || captionCell.childNodes[0].tagName == "LABEL") return; 24769 var labelElement = captionCell.childNodes[0]; 24770 ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating(this.editor, this.editor.GetAccessibilityFirstActiveElement(), labelElement); 24771 }, 24772 UpdateText: function() { 24773 var additionalTextElement = this.GetTextElement(); 24774 if(ASPx.IsExists(additionalTextElement)) { 24775 var pronounceElement = this.editor.GetAccessibilityFirstActiveElement(); 24776 var hasAnyLabel = !!ASPx.Attr.GetAttribute(pronounceElement, "aria-label") || 24777 !!ASPx.Attr.GetAttribute(pronounceElement, "aria-labelledby") || 24778 ASPx.FindAssociatedLabelElements(this.editor).length > 0; 24779 this.SetOrRemoveText([pronounceElement], additionalTextElement, true, !hasAnyLabel, false); 24780 } 24781 },
24782 UpdateValidationState: function(validationType) { 24783 if(validationType == ValidationType.PersonalOnValueChanged && this.editor.accessibilityHelper) return; 24784 var accessibilityElements = this.editor.GetAccessibilityActiveElements(); 24785 var errorTextElement = this.GetErrorTextElement(); 24786 this.SetOrRemoveText(accessibilityElements, errorTextElement, !this.editor.isValid, false, true); 24787 if(accessibilityElements.length > 0 && !!errorTextElement) { 24788 for(var i = 0; i < accessibilityElements.length; i++) { 24789 if(!ASPx.IsExists(accessibilityElements[i])) continue; 24790 ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], "aria-invalid", !this.editor.isValid); 24791 } 24792 } 24793 }, 24794 ToggleErrorAlert: function() { 24795 var errorTextElement = this.GetErrorTextElement(); 24796 ASPx.SetElementDisplay(errorTextElement, false); 24797 ASPx.Attr.SetAttribute(errorTextElement, 'role', 'alert'); 24798 ASPx.SetElementDisplay(errorTextElement, true); 24799 setTimeout(function() { ASPx.Attr.RemoveAttribute(errorTextElement, 'role'); }, 500); 24800 }, 24801 SetOrRemoveText: function(accessibilityElements, textElement, setText, isLabel, isFirst) { 24802 var idsRefAttribute = isLabel ? ASPx.Attr.Aria.labelled : ASPx.Attr.Aria.described; 24803 if(!textElement) return; 24804 var textId = !!textElement.id ? textElement.id : textElement.parentNode.id; 24805 for(var i = 0; i < accessibilityElements.length; i++) { 24806 if(!accessibilityElements[i]) continue; 24807 var descRefString = ASPx.Attr.GetAttribute(accessibilityElements[i], idsRefAttribute); 24808 var descRefIds = !!descRefString ? descRefString.split(" ") : [ ]; 24809 var descIndex = descRefIds.indexOf(textId); 24810 if(setText && descIndex == -1) { 24811 if(isFirst) 24812 descRefIds.unshift(textId); 24813 else 24814 descRefIds.push(textId); 24815 } 24816 else if(!setText && descIndex > -1) 24817 descRefIds.splice(descIndex, 1); 24818 ASPx.Attr.SetOrRemoveAttribute(accessibilityElements[i], idsRefAttribute, descRefIds.join(" ")); 24819 } 24820 } 24821}); 24822ASPx.DisableAccessibilityExplanatoryTextManager = DisableAccessibilityExplanatoryTextManager; 24823ASPx.EditAccessibilityExplanatoryTextManager = EditAccessibilityExplanatoryTextManager; 24824ASPx.EditAccessibilityExplanatoryTextManager.SetLabelAssociating = function(editor, activeElement, labelElement) { 24825 var clickHandler = function(evt) { 24826 if(editor && editor.OnAssociatedLabelClick) 24827 editor.OnAssociatedLabelClick(evt); 24828 else 24829 activeElement.click(); 24830 }; 24831 ASPx.Evt.AttachEventToElement(labelElement, "click", clickHandler); 24832 if(!!editor) { 24833 var hasAriaLabel = !!ASPx.Attr.GetAttribute(activeElement, "aria-label"); 24834 editor.ariaExplanatoryTextManager.SetOrRemoveText([activeElement], labelElement, true, !hasAriaLabel, true); 24835 } 24836}; 24837ASPxClientEdit.ClearEditorsInContainer = function(container, validationGroup, clearInvisibleEditors) { 24838 invalidEditorToBeFocused = null; 24839 ASPx.ProcessEditorsInContainer(container, ASPx.ClearProcessingProc, ASPx.ClearChoiceCondition, validationGroup, clearInvisibleEditors, true ); 24840 ASPxClientEdit.ClearExternalControlsInContainer(container, validationGroup, clearInvisibleEditors, true ); 24841}; 24842ASPxClientEdit.ClearEditorsInContainerById = function(containerId, validationGroup, clearInvisibleEditors) { 24843 var container = document.getElementById(containerId); 24844 this.ClearEditorsInContainer(container, validationGroup, clearInvisibleEditors); 24845}; 24846ASPxClientEdit.ClearGroup = function(validationGroup, clearInvisibleEditors) { 24847 return this.ClearEditorsInContainer(null, validationGroup, clearInvisibleEditors); 24848}; 24849ASPxClientEdit.ValidateEditorsInContainer = function(container, validationGroup, validateInvisibleEditors) { 24850 var summaryCollection; 24851 if(ASPx.Ident.scripts.ASPxClientValidationSummary) { 24852 summaryCollection = ASPx.GetClientValidationSummaryCollection(); 24853 summaryCollection.AllowNewErrorsAccepting(validationGroup); 24854 } 24855 var validationResult = ASPx.ProcessEditorsInContainer(container, ASPx.ValidateProcessingProc, _aspxValidateChoiceCondition, validationGroup, validateInvisibleEditors, 24856 false ); 24857 validationResult.isValid = ASPxClientEdit.ValidateExternalControlsInContainer(container, validationGroup, validateInvisibleEditors, 24858 false ) && validationResult.isValid; 24859 if(typeof(validateInvisibleEditors) == "undefined") 24860 validateInvisibleEditors = false; 24861 if(typeof(validationGroup) == "undefined") 24862 validationGroup = null; 24863 validationResult.isValid = ASPx.GetControlCollection().RaiseValidationCompleted(container, validationGroup, 24864 validateInvisibleEditors, validationResult.isValid, validationResult.firstInvalid, validationResult.firstVisibleInvalid); 24865 if(summaryCollection) 24866 summaryCollection.ForbidNewErrorsAccepting(validationGroup); 24867 if(!validationResult.isValid && !!validationResult.firstVisibleInvalid && validationResult.firstVisibleInvalid.accessibilityCompliant && !validationResult.firstVisibleInvalid.setFocusOnError) { 24868 var accessInvalidControl = validationResult.firstVisibleInvalid; 24869 if(!summaryCollection && !accessInvalidControl.focused) { 24870 var beforeDelayActiveElement = ASPx.GetActiveElement(); 24871 setTimeout(function() { 24872 var currentActiveElement = ASPx.GetActiveElement(); 24873 if(accessInvalidControl.focused || (currentActiveElement != beforeDelayActiveElement && ASPx.Attr.IsExistsAttribute(currentActiveElement, 'role'))) 24874 return; 24875 accessInvalidControl.ariaExplanatoryTextManager.ToggleErrorAlert(); 24876 }, 500); 24877 } 24878 } 24879 return validationResult.isValid; 24880}; 24881ASPxClientEdit.ValidateEditorsInContainerById = function(containerId, validationGroup, validateInvisibleEditors) { 24882 var container = document.getElementById(containerId); 24883 return this.ValidateEditorsInContainer(container, validationGroup, validateInvisibleEditors); 24884};
24885ASPxClientEdit.ValidateGroup = function(validationGroup, validateInvisibleEditors) { 24886 return this.ValidateEditorsInContainer(null, validationGroup, validateInvisibleEditors); 24887}; 24888ASPxClientEdit.AreEditorsValid = function(containerOrContainerId, validationGroup, checkInvisibleEditors) { 24889 var container = typeof(containerOrContainerId) == "string" ? document.getElementById(containerOrContainerId) : containerOrContainerId; 24890 var checkResult = ASPx.ProcessEditorsInContainer(container, ASPx.EditorsValidProcessingProc, _aspxEditorsValidChoiceCondition, validationGroup, 24891 checkInvisibleEditors, false ); 24892 checkResult.isValid = ASPxClientEdit.AreExternalControlsValidInContainer(containerOrContainerId, validationGroup, 24893 checkInvisibleEditors, false ) && checkResult.isValid; 24894 return checkResult.isValid; 24895}; 24896ASPxClientEdit.AreExternalControlsValidInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) { 24897 if(ASPx.Ident.scripts.ASPxClientHtmlEditor) 24898 return ASPxClientHtmlEditor.AreEditorsValidInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors); 24899 return true; 24900}; 24901ASPxClientEdit.ClearExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) { 24902 if(ASPx.Ident.scripts.ASPxClientHtmlEditor) 24903 return ASPxClientHtmlEditor.ClearEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors); 24904 return true; 24905}; 24906ASPxClientEdit.ValidateExternalControlsInContainer = function(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors) { 24907 if(ASPx.Ident.scripts.ASPxClientHtmlEditor) 24908 return ASPxClientHtmlEditor.ValidateEditorsInContainer(containerId, validationGroup, validateInvisibleEditors, processDisabledEditors); 24909 return true; 24910}; 24911ASPxClientEdit.AttachEditorModificationListener = function(handler, predicate) { 24912 var processAction = function(event) { event.AddHandler(handler); }; 24913 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate); 24914}; 24915ASPxClientEdit.DetachEditorModificationListener = function(handler, predicate) { 24916 var processAction = function(event) { event.RemoveHandler(handler); }; 24917 ASPxClientEdit.ProcessEditorModificationListener(handler, processAction, predicate); 24918}; 24919ASPxClientEdit.ProcessEditorModificationListener = function(handler, action, predicate) { 24920 ASPx.GetControlCollection().ForEachControl(function(control) { 24921 if(control.GetModifyEvent && predicate(control)) { 24922 if(control.isNative) 24923 control.EnsureRequiredNativeAttributesExists(); 24924 action(control.GetModifyEvent()); 24925 } 24926 }); 24927}; 24928var ASPxClientEditKeyEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 24929 constructor: function(htmlEvent) { 24930 this.constructor.prototype.constructor.call(this); 24931 this.htmlEvent = htmlEvent; 24932 } 24933}); 24934var ASPxClientEditValidationEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 24935 constructor: function(value, errorText, isValid) { 24936 this.constructor.prototype.constructor.call(this); 24937 this.errorText = errorText; 24938 this.isValid = isValid; 24939 this.value = value; 24940 } 24941}); 24942ASPx.ProcessEditorsInContainer = function(container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) { 24943 var allProcessedSuccessfull = true; 24944 var firstInvalid = null; 24945 var firstVisibleInvalid = null; 24946 var invalidEditorToBeFocused = null; 24947 ASPx.GetControlCollection().ForEachControl(function(control) { 24948 var canValidate = ASPx.CanValidateControl(control, container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors); 24949 if(!canValidate) return; 24950 var isSuccess = processingProc(control); 24951 if(!isSuccess) { 24952 allProcessedSuccessfull = false; 24953 if(firstInvalid == null) 24954 firstInvalid = control; 24955 var isVisible = control.IsVisible(); 24956 if(isVisible && firstVisibleInvalid == null) 24957 firstVisibleInvalid = control; 24958 if(control.setFocusOnError && invalidEditorToBeFocused == null && isVisible) 24959 invalidEditorToBeFocused = control; 24960 } 24961 }, this); 24962 if(invalidEditorToBeFocused != null) 24963 invalidEditorToBeFocused.SetFocus(); 24964 return new ASPxValidationResult(allProcessedSuccessfull, firstInvalid, firstVisibleInvalid); 24965}; 24966ASPx.CanValidateControl = function(control, container, processingProc, choiceCondition, validationGroup, processInvisibleEditors, processDisabledEditors) { 24967 var needToProcessRatingControl = window.ASPxClientRatingControl && (control instanceof ASPxClientRatingControl) && processingProc === ASPx.ClearProcessingProc; 24968 var mainElement = control.GetMainElement(); 24969 if(!ASPx.Ident.IsASPxClientEdit(control) && !needToProcessRatingControl) 24970 return false; 24971 if(ASPx.Ident.isDialogInvisibleControl(control) || ASPx.Ident.isBatchEditUnusedEditor(control)) 24972 return false; 24973 if(!processDisabledEditors && !control.GetEnabled()) 24974 return false; 24975 if(!mainElement || (container && !ASPx.GetIsParent(container, mainElement))) 24976 return false; 24977 if(!processInvisibleEditors && !control.IsVisible()) 24978 return false; 24979 if(choiceCondition && !choiceCondition(control, validationGroup)) 24980 return false; 24981 return true; 24982}; 24983var ASPxValidationResult = ASPx.CreateClass(null, { 24984 constructor: function(isValid, firstInvalid, firstVisibleInvalid) { 24985 this.isValid = isValid; 24986 this.firstInvalid = firstInvalid;
24987 this.firstVisibleInvalid = firstVisibleInvalid; 24988 } 24989}); 24990ASPx.ClearChoiceCondition = function(edit, validationGroup) { 24991 return !ASPx.IsExists(validationGroup) || (edit.validationGroup == validationGroup); 24992}; 24993function _aspxValidateChoiceCondition(edit, validationGroup) { 24994 return ASPx.ClearChoiceCondition(edit, validationGroup) && edit.customValidationEnabled; 24995} 24996function _aspxEditorsValidChoiceCondition(edit, validationGroup) { 24997 return _aspxValidateChoiceCondition(edit, validationGroup); 24998} 24999function wrapLostFocusHandler(handler) { 25000 if(ASPx.Browser.Edge) { 25001 return function(name) { 25002 var edit = ASPx.GetControlCollection().Get(name); 25003 if(edit && !ASPx.IsElementVisible(edit.GetMainElement())) 25004 setTimeout(handler, 0, name); 25005 else 25006 handler(name); 25007 }; 25008 } 25009 return handler; 25010} 25011ASPx.EGotFocus = function(name) { 25012 var edit = ASPx.GetControlCollection().Get(name); 25013 if(edit) { 25014 if(edit.isInitialized) { 25015 if(ASPx.Browser.VirtualKeyboardSupported && !edit.ownerListBox) 25016 ASPx.VirtualKeyboardUI.processEditorGotFocus(edit); 25017 else 25018 edit.OnFocus(); 25019 } 25020 else { 25021 var inputElement = edit.GetFocusableInputElement(); 25022 if(inputElement && inputElement === document.activeElement) { 25023 if(ASPx.Browser.Firefox) 25024 window.setTimeout(function() { document.activeElement.blur(); }, 0); 25025 else 25026 document.activeElement.blur(); 25027 } 25028 } 25029 } 25030}; 25031ASPx.ELostFocusCore = function(name) { 25032 var edit = ASPx.GetControlCollection().Get(name); 25033 if(ASPx.Browser.VirtualKeyboardSupported && (!edit || !edit.ownerListBox)) { 25034 var supressLostFocus = ASPx.VirtualKeyboardUI.isInputNativeBluring(); 25035 if(!supressLostFocus) 25036 ASPx.VirtualKeyboardUI.resetFocusedEditorCore(); 25037 else 25038 return; 25039 } 25040 if(edit && edit.focused) { 25041 if(edit.UseDelayedSpecialFocus()) { 25042 if(edit.specialFocusTimer === -1) 25043 edit.specialFocusTimer = ASPx.Timer.SetControlBoundTimeout(function() { edit.OnLostFocus(); }, edit, 30); 25044 } 25045 else { 25046 edit.OnLostFocus(); 25047 } 25048 } 25049}; 25050ASPx.ELostFocus = wrapLostFocusHandler(ASPx.ELostFocusCore); 25051ASPx.EValueChanged = function(name) { 25052 var edit = ASPx.GetControlCollection().Get(name); 25053 if(edit != null) 25054 edit.OnValueChanged(); 25055}; 25056ASPx.VirtualKeyboardUI = (function() { 25057 var result = { 25058 focusedEditor: null, 25059 inputNativeFocusLocked: false, 25060 elementBelongsToEditor: function(element) { 25061 if(!element) return false; 25062 var isBelongsToEditor = false; 25063 ASPx.GetControlCollection().ForEachControl(function(control) { 25064 if(ASPx.Ident.IsASPxClientEdit(control) && control.IsEditorElement(element)) { 25065 isBelongsToEditor = true; 25066 return true; 25067 } 25068 }, this); 25069 return isBelongsToEditor; 25070 }, 25071 elementBelongsToFocusedEditor: function (element) { 25072 return this.focusedEditor && this.focusedEditor.IsEditorElement(element); 25073 }, 25074 onTouchStart: function (evt) { 25075 if (!ASPx.Browser.VirtualKeyboardSupported || this.isGooglePlaceAutocompleteElementTap(evt)) return; 25076 this.setInputNativeFocusLocked(false); 25077 if(this.focusedEditor) 25078 this.focusedEditor.onVirtualKeyboardUITouchStart(evt); 25079 }, 25080 onTouchEnd: function(evt) { 25081 if(ASPx.TouchUIHelper.pointerEnabled) { 25082 if(!window.testingTouchMode) { 25083 if(evt.pointerType !== ASPx.TouchUIHelper.pointerType.Touch) 25084 return; 25085 } 25086 this.processFocusEditorControl(evt); 25087 } else 25088 ASPx.TouchUIHelper.handleFastTapIfRequired(evt, 25089 function() { 25090 this.processFocusEditorControl(evt); 25091 }.aspxBind(this), false); 25092 }, 25093 processFocusEditorControl: function(evt) { 25094 var evtSource = ASPx.Evt.GetEventSource(evt); 25095 var focusedEditorIsTimeEdit = this.focusedEditor && (ASPx.Ident.IsASPxClientTimeEdit && ASPx.Ident.IsASPxClientTimeEdit(this.focusedEditor)); 25096 var focusedTimeEditBelongsToDateEdit = focusedEditorIsTimeEdit && this.focusedEditor.OwnerDateEdit && this.focusedEditor.OwnerDateEdit.GetShowTimeSection(); 25097 if(focusedTimeEditBelongsToDateEdit) { 25098 this.focusedEditor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource); 25099 return; 25100 } 25101 var elementWithNativeFocus = ASPx.GetActiveElement(); 25102 var someEditorInputIsFocused = this.elementBelongsToEditor(elementWithNativeFocus); 25103 var touchKeyboardIsVisible = someEditorInputIsFocused;
25104 var tapOutsideEditorAndInputs = !this.elementBelongsToEditor(evtSource) && !ASPx.Ident.IsFocusableElementRegardlessTabIndex(evtSource) 25105 && !this.isGooglePlaceAutocompleteElementTap(evt); 25106 var blurToHideTouchKeyboard = touchKeyboardIsVisible && tapOutsideEditorAndInputs; 25107 if(blurToHideTouchKeyboard) { 25108 elementWithNativeFocus.blur(); 25109 return; 25110 } 25111 var tapOutsideFocusedEditor = this.focusedEditor && !this.elementBelongsToFocusedEditor(evtSource); 25112 if(tapOutsideFocusedEditor) { 25113 if(!this.elementBelongsToFocusedEditor(elementWithNativeFocus)) 25114 this.resetFocusedEditor(); 25115 } 25116 }, 25117 focusEditor: function(edit) { 25118 if(!edit.focused) { 25119 this.setInputNativeFocusLocked(true); 25120 this.setFocusToEditor(edit); 25121 } else { 25122 edit.ForceRefocusEditor(); 25123 } 25124 }, 25125 setFocusToEditor: function(edit) { 25126 if(ASPx.Browser.MacOSMobilePlatform) { 25127 var timeoutDuration = ASPx.Browser.Chrome ? 250 : 30; 25128 window.setTimeout(function() { 25129 edit.SetFocus(); 25130 }, timeoutDuration); 25131 } else { 25132 edit.SetFocus(); 25133 } 25134 }, 25135 processEditorGotFocus: function(edit) { 25136 if(this.focusedEditor === edit) { 25137 this.focusedEditor.UnlockFocusEvents(); 25138 if(this.focusedEditor.EnsureClearButtonVisibility) 25139 this.focusedEditor.EnsureClearButtonVisibility(); 25140 } 25141 else { 25142 this.setFocusedEditor(edit); 25143 if(this.getInputNativeFocusLocked()) 25144 edit.BlurInputElement(); 25145 } 25146 }, 25147 setFocusedEditor: function(edit) { 25148 this.resetFocusedEditor(); 25149 this.focusedEditor = edit; 25150 this.focusedEditor.Disposed.AddHandler(this.onFocusedEditorDisposed); 25151 this.focusedEditor.OnFocus(); 25152 ASPx.SetFocusedEditor(this.focusedEditor); 25153 }, 25154 isInputNativeBluring: function() { 25155 return this.focusedEditor && this.getInputNativeFocusLocked(); 25156 }, 25157 setInputNativeFocusLocked: function(locked) { 25158 this.inputNativeFocusLocked = locked; 25159 }, 25160 getInputNativeFocusLocked: function() { 25161 return this.inputNativeFocusLocked; 25162 }, 25163 resetFocusedEditor: function() { 25164 if(this.focusedEditor) { 25165 var curEditorName = this.focusedEditor.name; 25166 var focusedEditorInputElementExists = this.focusedEditor.GetInputElement(); 25167 this.resetFocusedEditorCore(); 25168 if(focusedEditorInputElementExists) 25169 ASPx.ELostFocusCore(curEditorName); 25170 } 25171 }, 25172 resetFocusedEditorCore: function() { 25173 if(this.focusedEditor) 25174 this.focusedEditor.Disposed.RemoveHandler(this.onFocusedEditorDisposed); 25175 this.focusedEditor = null; 25176 }, 25177 getFocusedEditor: function() { 25178 return this.focusedEditor; 25179 }, 25180 focusableInputElementIsActive: function(edit) { 25181 var inputElement = edit.GetFocusableInputElement(); 25182 return !!inputElement ? ASPx.GetActiveElement() === inputElement : false; 25183 }, 25184 isGooglePlaceAutocompleteElementTap: function(evt) { 25185 var googlePlaceAutocompleteContainer = ASPx.GetNodeByClassName(document.body, "pac-container", 0); 25186 if(!googlePlaceAutocompleteContainer) 25187 return false; 25188 return ASPx.GetParentByClassName(ASPx.Evt.GetEventSource(evt), "pac-container") != null; 25189 } 25190 }; 25191 result.onFocusedEditorDisposed = function() { 25192 this.resetFocusedEditor(); 25193 }.bind(result); 25194 return result; 25195})(); 25196if(ASPx.Browser.VirtualKeyboardSupported) { 25197 var touchStartEventName = ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerDownEventName : 'touchstart'; 25198 var touchEndEventName = ASPx.TouchUIHelper.pointerEnabled ? ASPx.TouchUIHelper.pointerUpEventName : 'touchend'; 25199 ASPx.Evt.AttachEventToDocument(touchStartEventName, function(evt) { ASPx.VirtualKeyboardUI.onTouchStart(evt); }); 25200 ASPx.Evt.AttachEventToDocument(touchEndEventName, function(evt) { ASPx.VirtualKeyboardUI.onTouchEnd(evt); }); 25201} 25202ASPx.Evt.AttachEventToDocument("mousedown", function(evt) { 25203 var editor = ASPx.GetFocusedEditor(); 25204 if(!editor) 25205 return; 25206 var evtSource = ASPx.Evt.GetEventSource(evt); 25207 if(editor.IsClearButtonElement(evtSource)) 25208 return; 25209 if(editor.OwnerDateEdit && editor.OwnerDateEdit.GetShowTimeSection()) { 25210 editor.OwnerDateEdit.ForceRefocusTimeSectionTimeEdit(evtSource); 25211 return; 25212 } 25213 if(editor.ownerListBox && editor.ownerListBox.IsEditorElement(evtSource) && !editor.IsEditorElement(evtSource)) { 25214 editor.ownerListBox.ForceRefocusEditor(evt); 25215 ASPx.SetFocusedEditor(editor.ownerListBox); 25216 return; 25217 } 25218 if(editor.IsEditorElement(evtSource) && !editor.IsElementBelongToInputElement(evtSource)) 25219 editor.ForceRefocusEditor(evt); 25220}); 25221ASPx.Evt.AttachEventToDocument(ASPx.Evt.GetMouseWheelEventName(), function(evt) { 25222 var editor = ASPx.GetFocusedEditor(); 25223 if(editor != null && ASPx.IsExistsElement(editor.GetMainElement()) && editor.focused && editor.receiveGlobalMouseWheel) 25224 editor.OnMouseWheel(evt); 25225}); 25226ASPx.KBSIKeyDown = function(name, evt){ 25227 var control = ASPx.GetControlCollection().Get(name); 25228 if(control != null){ 25229 var isProcessed = control.OnSpecialKeyDown(evt); 25230 if(isProcessed) 25231 return ASPx.Evt.PreventEventAndBubble(evt); 25232 } 25233}; 25234ASPx.KBSIKeyPress = function(name, evt){ 25235 var control = ASPx.GetControlCollection().Get(name); 25236 if(control != null){ 25237 var isProcessed = control.OnSpecialKeyPress(evt); 25238 if(isProcessed) 25239 return ASPx.Evt.PreventEventAndBubble(evt); 25240 } 25241}; 25242ASPx.KBSIKeyUp = function(name, evt){ 25243 var control = ASPx.GetControlCollection().Get(name); 25244 if(control != null){ 25245 var isProcessed = control.OnSpecialKeyUp(evt); 25246 if(isProcessed) 25247 return ASPx.Evt.PreventEventAndBubble(evt); 25248 } 25249}; 25250ASPx.ClearProcessingProc = function(edit) { 25251 return edit.Clear(); 25252}; 25253ASPx.ValidateProcessingProc = function(edit) { 25254 edit.OnValidation(ValidationType.MassValidation); 25255 return edit.GetIsValid(); 25256}; 25257ASPx.EditorsValidProcessingProc = function(edit) { 25258 return edit.GetIsValid(); 25259}; 25260var CheckEditElementHelper = ASPx.CreateClass(ASPx.CheckableElementHelper, { 25261 AttachToMainElement: function(internalCheckBox) { 25262 ASPx.CheckableElementHelper.prototype.AttachToMainElement.call(this, internalCheckBox); 25263 this.AttachToLabelElement(this.GetLabelElement(internalCheckBox.container), internalCheckBox); 25264 }, 25265 AttachToLabelElement: function(labelElement, internalCheckBox) { 25266 var _this = this; 25267 if(labelElement) { 25268 ASPx.Evt.AttachEventToElement(labelElement, "click", 25269 function (evt) { 25270 _this.InvokeClick(internalCheckBox, evt); 25271 } 25272 ); 25273 ASPx.Evt.AttachEventToElement(labelElement, "mousedown", 25274 function (evt) { 25275 internalCheckBox.Refocus(); 25276 } 25277 ); 25278 } 25279 }, 25280 GetLabelElement: function(container) { 25281 var labelElement = ASPx.GetNodeByTagName(container, "LABEL", 0); 25282 if(!labelElement) { 25283 var labelCell = ASPx.GetNodeByClassName(container, "dxichTextCellSys", 0); 25284 labelElement = ASPx.GetNodeByTagName(labelCell, "SPAN", 0); 25285 } 25286 return labelElement; 25287 } 25288}); 25289CheckEditElementHelper.Instance = new CheckEditElementHelper(); 25290var CalendarSharedParameters = ASPx.CreateClass(null, { 25291 updateCalendarCallbackCommand: "UPDATE", 25292 constructor: function() { 25293 this.minDate = null; 25294 this.maxDate = null; 25295 this.disabledDates = []; 25296 this.calendarCustomDraw = false; 25297 this.hasCustomDisabledDatesViaCallback = false; 25298 this.dateRangeMode = false; 25299 this.currentDateEdit = null; 25300 this.DaysSelectingOnMouseOver = new ASPxClientEvent(); 25301 this.VisibleDaysMouseOut = new ASPxClientEvent(); 25302 this.CalendarSelectionChangedInternal = new ASPxClientEvent(); 25303 }, 25304 Assign: function(source) { 25305 this.minDate = source.minDate ? source.minDate : null; 25306 this.maxDate = source.maxDate ? source.maxDate : null; 25307 this.calendarCustomDraw = source.calendarCustomDraw ? source.calendarCustomDraw : false;
25308 this.hasCustomDisabledDatesViaCallback = source.hasCustomDisabledDatesViaCallback ? source.hasCustomDisabledDatesViaCallback : false; 25309 this.disabledDates = source.disabledDates ? source.disabledDates : []; 25310 this.currentDateEdit = source.currentDateEdit ? source.currentDateEdit : null; 25311 }, 25312 GetUpdateCallbackParameters: function() { 25313 var callbackArgs = this.GetCallbackArgs(); 25314 callbackArgs = this.FormatCallbackArg(this.updateCalendarCallbackCommand, callbackArgs); 25315 return callbackArgs; 25316 }, 25317 GetCallbackArgs: function() { 25318 var args = {}; 25319 if(this.minDate) 25320 args.clientMinDate = ASPx.DateUtils.GetInvariantDateString(this.minDate); 25321 if(this.maxDate) 25322 args.clientMaxDate = ASPx.DateUtils.GetInvariantDateString(this.maxDate); 25323 if(args.clientMinDate || args.clientMaxDate) { 25324 var jsonArgs = JSON.stringify(args); 25325 return ASPx.Str.EncodeHtml(jsonArgs); 25326 } 25327 return null; 25328 }, 25329 FormatCallbackArg: function(prefix, arg) { 25330 if(!arg) return prefix; 25331 return [prefix, '|', arg.length, ';', arg, ';'].join(''); 25332 } 25333}); 25334ASPx.CalendarSharedParameters = CalendarSharedParameters; 25335ASPx.ValidationType = ValidationType; 25336ASPx.ErrorFrameDisplay = ErrorFrameDisplay; 25337ASPx.EditElementSuffix = EditElementSuffix; 25338ASPx.ValidationPattern = ValidationPattern; 25339ASPx.RequiredFieldValidationPattern = RequiredFieldValidationPattern; 25340ASPx.RegularExpressionValidationPattern = RegularExpressionValidationPattern; 25341ASPx.CheckEditElementHelper = CheckEditElementHelper; 25342ASPx.IsEditorFocusable = _aspxIsEditorFocusable; 25343window.ASPxClientEditBase = ASPxClientEditBase; 25344window.ASPxClientEdit = ASPxClientEdit; 25345window.ASPxClientEditKeyEventArgs = ASPxClientEditKeyEventArgs; 25346window.ASPxClientEditValidationEventArgs = ASPxClientEditValidationEventArgs; 25347})(); 25348 25349(function() { 25350ASPx.TEInputSuffix = "_I"; 25351ASPx.PasteCheckInterval = 50; 25352ASPx.CheckUserInputInterval = 10; 25353ASPx.TEHelpTextElementSuffix = "_HTE"; 25354ASPx.TempHiddenInputSuffix = "_THI"; 25355var passwordInputClonedSuffix = "_CLND"; 25356var CHROME_AUTOFILL_SELECTOR = ":-webkit-autofill"; 25357var BrowserHelper = { 25358 SAFARI_SYSTEM_CLASS_NAME: "dxeSafariSys", 25359 MOBILE_SAFARI_SYSTEM_CLASS_NAME: "dxeIPadSys", 25360 GetBrowserSpecificSystemClassName: function() { 25361 if(ASPx.Browser.Safari) 25362 return ASPx.Browser.MacOSMobilePlatform ? this.MOBILE_SAFARI_SYSTEM_CLASS_NAME : this.SAFARI_SYSTEM_CLASS_NAME; 25363 return ""; 25364 } 25365}; 25366var focusedNullTextClassName = "dxeFNTextSys"; 25367var NullTextDisplayMode = { 25368 Unfocused: "Unfocused", 25369 UnfocusedAndFocused: "UnfocusedAndFocused" 25370}; 25371ASPx.NullTextDisplayMode = NullTextDisplayMode; 25372var ASPxClientTextEdit = ASPx.CreateClass(ASPxClientEdit, { 25373 constructor: function(name) { 25374 this.constructor.prototype.constructor.call(this, name); 25375 this.isASPxClientTextEdit = true; 25376 this.nullText = ""; 25377 this.nullTextDisplayMode = NullTextDisplayMode.Unfocused; 25378 this.nullTextOnFocusCssText = ""; 25379 this.focusedNullTextTimerID = -1; 25380 this.escCount = 0; 25381 this.raiseValueChangedOnEnter = true; 25382 this.autoResizeWithContainer = false; 25383 this.lastChangedValue = null; 25384 this.autoCompleteAttribute = null; 25385 this.isTextSelectionOnClickEnabled = false; 25386 this.trySelectInputTextOnClick = true; 25387 this.passwordNullTextIntervalID = -1; 25388 this.nullTextInputElement = null; 25389 this.helpText = ""; 25390 this.helpTextObj = null; 25391 this.helpTextStyle = []; 25392 this.externalTableStyle = []; 25393 this.helpTextPosition = ASPx.Position.Right; 25394 this.helpTextMargins = null; 25395 this.helpTextHAlign = ASPxClientTextEditHelpTextHAlign.Left; 25396 this.helpTextVAlign = ASPxClientTextEditHelpTextVAlign.Top; 25397 this.enableHelpTextPopupAnimation = true; 25398 this.helpTextDisplayMode = ASPxClientTextEditHelpTextDisplayMode.Inline; 25399 this.maskInfo = null; 25400 this.maskValueBeforeUserInput = ""; 25401 this.maskValueChangedByPassKeyPressOnAndroid = false; 25402 this.maskPasteTimerID = -1; 25403 this.maskPasteLock = false; 25404 this.maskPasteCounter = 0; 25405 this.maskTextBeforePaste = ""; 25406 this.maskHintHtml = ""; 25407 this.maskHintTimerID = -1; 25408 this.errorCellPosition = ASPx.Position.Right; 25409 this.inlineInitializeInputValue = null; 25410 this.initializeInputValue = null; 25411 this.displayFormat = null; 25412 this.TextChanged = new ASPxClientEvent(); 25413 this.UserInput = new ASPxClientEvent(); 25414 this.userInputEventTimerID = -1; 25415 }, 25416 AddDefaultReadOnlyStateControllerItem: function(cssClass, mainElementId) { 25417 ASPx.AddReadOnlyItems(mainElementId, [[[cssClass], [''], ['', 'I']]]); 25418 }, 25419 AddDefaultDisabledStateControllerItem: function(cssClass, mainElementId) { 25420 ASPx.AddDisabledItems(mainElementId, [[[cssClass], [''], ['', 'I']]]); 25421 }, 25422 SetData: function(data){ 25423 ASPxClientEdit.prototype.SetData.call(this, data);
25424 if(data.maskInfo) { 25425 var maskProperties = data.maskInfo.properties; 25426 var useInvariantCultureDecimalSymbol = maskProperties && maskProperties.useInvariantCultureDecimalSymbol || false; 25427 this.maskInfo = ASPx.MaskInfo.Create(data.maskInfo.maskText, data.maskInfo.dateTimeOnly, data.maskInfo.allowEscapingInEnums, useInvariantCultureDecimalSymbol); 25428 this.SetProperties(data.maskInfo.properties, this.maskInfo); 25429 } 25430 }, 25431 InlineInitialize: function() { 25432 this.SaveInputValue(true); 25433 ASPxClientEdit.prototype.InlineInitialize.call(this); 25434 if(this.maskInfo != null) 25435 this.InitMask(); 25436 this.ApplyBrowserSpecificClassName(); 25437 this.helpTextInitialize(); 25438 }, 25439 Initialize: function(){ 25440 this.SaveInputValue(false); 25441 this.SaveChangedValue(); 25442 ASPxClientEdit.prototype.Initialize.call(this); 25443 if(ASPx.Browser.WebKitFamily) 25444 this.CorrectMainElementWhiteSpaceStyle(); 25445 this.InitializeTextDecoration(); 25446 this.InitializeAutocompleteAttribute(); 25447 if(this.IsValueRestoredByBrowser()) 25448 this.SynchronizeRestoredValue(); 25449 }, 25450 InitializeEvents: function() { 25451 ASPxClientEdit.prototype.InitializeEvents.call(this); 25452 ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keydown", this.OnKeyDown.aspxBind(this)); 25453 ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keyup", this.OnKeyUp.aspxBind(this)); 25454 ASPx.Evt.AttachEventToElement(this.GetInputElement(), "keypress", this.OnKeyPress.aspxBind(this)); 25455 if(this.isTextSelectionOnClickEnabled) { 25456 ASPx.Evt.AttachEventToElement(this.GetInputElement(), ASPx.TouchUIHelper.touchMouseDownEventName, this.OnMouseDown.aspxBind(this)); 25457 ASPx.Evt.AttachEventToElement(this.GetInputElement(), "click", this.OnClick.aspxBind(this)); 25458 } 25459 this.Unload.AddHandler(this.OnUnload.aspxBind(this)); 25460 }, 25461 InitializeTextDecoration: function() { 25462 var input = this.GetInputElement(); 25463 if(input.type === "password" && !this.IsInputPasswordFilledAutomaticallyByChrome()) 25464 this.ToggleTextDecoration(); 25465 }, 25466 IsInputPasswordFilledAutomaticallyByChrome: function() { 25467 if(!ASPx.Browser.Chrome) 25468 return false; 25469 var input = this.GetInputElement(); 25470 return ASPx.ElementMatchesSelector(input, CHROME_AUTOFILL_SELECTOR); 25471 }, 25472 OnMouseDown: function() { 25473 this.trySelectInputTextOnClick = ASPx.GetActiveElement() !== this.GetInputElement() && !this.IsFocusEventsLocked(); 25474 }, 25475 OnClick: function() { 25476 if(this.trySelectInputTextOnClick) { 25477 var input = this.GetInputElement(); 25478 setTimeout(function() { 25479 var inputSelection = ASPx.Selection.GetInfo(input); 25480 if (inputSelection.startPos === inputSelection.endPos) 25481 ASPx.Selection.Set(input); 25482 }, 0); 25483 } 25484 }, 25485 InitializeAutocompleteAttribute: function() { 25486 var input = this.GetInputElement(); 25487 if(this.IsVCardAttributeRequired()) 25488 ASPx.Attr.SetAttribute(input, this.autoCompleteAttribute.name, this.autoCompleteAttribute.value); 25489 else if(this.IsAutocompleteOffRequiredOnInitialize()) 25490 ASPx.Attr.SetAttribute(input, "autocomplete", "off"); 25491 }, 25492 SaveInputValue: function(isInlineInitialize) { 25493 var input = this.GetInputElement(); 25494 if(!input) 25495 return; 25496 var inputValue = input.value; 25497 if(inputValue === null) 25498 inputValue = ""; 25499 if(isInlineInitialize) 25500 this.inlineInitializeInputValue = inputValue; 25501 else 25502 this.initializeInputValue = inputValue; 25503 }, 25504 IsValueRestoredByBrowser: function() { 25505 if(this.displayFormat || this.isNative || this.inlineInitializeInputValue === null || this.initializeInputValue === null) 25506 return false; 25507 if(ASPx.Browser.Chrome) 25508 return this.IsValueRestoredByChrome(); 25509 else if(ASPx.Browser.Firefox) 25510 return this.IsValueRestoredByFirefox(); 25511 else 25512 return this.IsValueRestoredByBrowserCore(); 25513 }, 25514 IsValueRestoredByBrowserCore: function() { 25515 return this.IsValueChangedBeforeInitialize() || this.IsClientValueNotExists() || this.IsValueChangedOnMaskInitialize(); 25516 }, 25517 IsValueRestoredByChrome: function() { 25518 return this.IsValueRestoredByBrowserCore(); 25519 }, 25520 IsValueRestoredByFirefox: function() { 25521 return this.IsValueRestoredByBrowserCore(); 25522 }, 25523 IsValueChangedBeforeInitialize: function() { 25524 return this.inlineInitializeInputValue !== this.initializeInputValue; 25525 }, 25526 IsClientValueNotExists: function() { 25527 return this.inlineInitializeInputValue !== "" && 25528 this.inlineInitializeInputValue !== this.nullText && 25529 this.inlineInitializeInputValue !== this.GetValue() && 25530 this.inlineInitializeInputValue !== this.GetText(); 25531 }, 25532 IsValueChangedOnMaskInitialize: function() { 25533 return this.maskInfo && this.inlineInitializeInputValue !== this.GetInputElement().value; 25534 }, 25535 SynchronizeRestoredValue: function() { 25536 this.SetText(this.initializeInputValue); 25537 }, 25538 AdjustControl: function() { 25539 ASPxClientEdit.prototype.AdjustControl.call(this); 25540 this.ensureAdjustFocusedNullTextElement(); 25541 }, 25542 correctInputElementHeight: function() { 25543 var mainElement = this.GetMainElement(); 25544 if(mainElement) { 25545 var mainElementHeight = mainElement.style.height; 25546 var mainElementHeightSpecified = mainElementHeight && mainElementHeight.indexOf('px') !== -1; 25547 if(mainElementHeightSpecified) { 25548 var inputElement = this.GetInputElement(); 25549 var inputElementHeight = this.getInputElementHeight(); 25550 inputElement.style.height = inputElementHeight + "px"; 25551 if(!ASPx.Ident.IsASPxClientMemo(this)) 25552 inputElement.style.lineHeight = inputElementHeight + "px"; 25553 } 25554 } 25555 }, 25556 getInputElementHeight: function() { 25557 var mainElement = this.GetMainElement(), 25558 inputElement = this.GetInputElement(); 25559 var inputElementHeight = ASPx.PxToInt(mainElement.style.height) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement); 25560 var inputElementContainer = inputElement.parentNode, 25561 inputContainerStyle = ASPx.GetCurrentStyle(inputElementContainer); 25562 inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElementContainer, inputContainerStyle) 25563 + ASPx.GetTopBottomMargins(inputElementContainer, inputContainerStyle); 25564 var mainElementCellspacing = ASPx.GetCellSpacing(mainElement); 25565 if(mainElementCellspacing) 25566 inputElementHeight -= mainElementCellspacing * 2; 25567 var inputStyle = ASPx.GetCurrentStyle(inputElement); 25568 inputElementHeight -= ASPx.GetTopBottomBordersAndPaddingsSummaryValue(inputElement, inputStyle) 25569 + ASPx.GetTopBottomMargins(inputElement, inputStyle); 25570 return inputElementHeight; 25571 }, 25572 getInputCell: function() { 25573 var inputElement = this.GetInputElement(); 25574 if(inputElement) 25575 return inputElement.parentNode; 25576 }, 25577 ensureOutOfRangeWarningManager: function (minValue, maxValue, defaultMinValue, defaultMaxValue, valueFormatter) { 25578 if (!this.outOfRangeWarningManager) 25579 this.outOfRangeWarningManager = new ASPxOutOfRangeWarningManager(this, minValue, maxValue, defaultMinValue, defaultMaxValue, 25580 this.showOutOfRangeWarningElementAtBottom() ? ASPx.Position.Bottom : ASPx.Position.Right, valueFormatter); 25581 }, 25582 showOutOfRangeWarningElementAtBottom: function() { 25583 return this.hasRightPopupHelpText(); 25584 }, 25585 GetOutOfRangeWarningElementPrevSibling: function() { 25586 return this.GetMainElement(); 25587 }, 25588 helpTextInitialize: function () { 25589 if(this.helpText) { 25590 this.helpTextObj = new ASPxClientTextEditHelpText(this, this.helpTextStyle, this.helpText, this.helpTextPosition, 25591 this.helpTextHAlign, this.helpTextVAlign, this.helpTextMargins, this.enableHelpTextPopupAnimation, this.helpTextDisplayMode); 25592 } 25593 }, 25594 hasPopupHelpText: function() { 25595 return this.helpText && this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup; 25596 }, 25597 hasRightPopupHelpText: function() { 25598 return this.hasPopupHelpText() && this.helpTextPosition === ASPx.Position.Right; 25599 }, 25600 showHelpText: function () { 25601 if(this.helpTextObj) 25602 this.helpTextObj.show(); 25603 }, 25604 hideHelpText: function () { 25605 if(this.helpTextObj) 25606 this.helpTextObj.hide(); 25607 }, 25608 ApplyBrowserSpecificClassName: function() { 25609 var mainElement = this.GetMainElement(); 25610 if(ASPx.IsExistsElement(mainElement)) { 25611 var className = BrowserHelper.GetBrowserSpecificSystemClassName(); 25612 if(className) 25613 mainElement.className += " " + className; 25614 } 25615 }, 25616 CorrectMainElementWhiteSpaceStyle: function() { 25617 var inputElement = this.GetInputElement(); 25618 if(inputElement && inputElement.parentNode) { 25619 if(this.IsElementHasWhiteSpaceStyle(inputElement.parentNode)) 25620 inputElement.parentNode.style.whiteSpace = "normal"; 25621 } 25622 }, 25623 IsElementHasWhiteSpaceStyle: function(element) { 25624 var currentStyle = ASPx.GetCurrentStyle(element); 25625 return currentStyle.whiteSpace == "nowrap" || currentStyle.whiteSpace == "pre"; 25626 }, 25627 FindInputElement: function(){ 25628 return this.isNative ? this.GetMainElement() : ASPx.GetElementById(this.name + ASPx.TEInputSuffix); 25629 }, 25630 DecodeRawInputValue: function(value) { 25631 return value; 25632 }, 25633 GetRawValue: function(value){ 25634 return ASPx.IsExists(this.stateObject) ? this.stateObject.rawValue : null; 25635 }, 25636 SetRawValue: function(value){ 25637 if(ASPx.IsExists(value)) 25638 value = value.toString(); 25639 this.UpdateStateObjectWithObject({ rawValue: value });
25640 }, 25641 SyncRawValue: function() { 25642 if(this.maskInfo != null) 25643 this.SetRawValue(this.maskInfo.GetValue(true)); 25644 else 25645 this.SetRawValue(this.GetInputElement().value); 25646 }, 25647 HasTextDecorators: function() { 25648 return this.nullText != "" || this.displayFormat != null; 25649 }, 25650 CanApplyTextDecorators: function(){ 25651 return !this.focused; 25652 }, 25653 CreateStyleDecoration: function () { 25654 return new ASPx.TextEditorStyleDecoration(this); 25655 }, 25656 CanApplyNullTextDecoration: function() { 25657 var value = this.GetValue(); 25658 return this.IsNull(value); 25659 }, 25660 GetDecoratedText: function(value) { 25661 var result = value; 25662 if(this.IsNull(value) && this.nullText != "" && this.CanApplyNullTextDecoration()) 25663 result = this.nullText; 25664 else if(this.displayFormat != null) 25665 result = this.GetDisplayFormatText(value); 25666 else if(this.maskInfo != null) 25667 result = this.maskInfo.GetText(); 25668 else if(value == null) 25669 result = ""; 25670 return result; 25671 }, 25672 GetDisplayFormatText: function(value) { 25673 return ASPx.Formatter.Format(this.displayFormat, value); 25674 }, 25675 ToggleTextDecoration: function() { 25676 if(this.HasTextDecorators()) { 25677 if(this.focused) { 25678 var input = this.GetInputElement(); 25679 var oldValue = input.value; 25680 var sel = ASPx.Selection.GetExtInfo(input); 25681 this.ToggleTextDecorationCore(); 25682 this.ensureActivateFocusedNullTextMechanism(); 25683 if(oldValue != input.value || !ASPx.Selection.AreEqual(sel, ASPx.Selection.GetExtInfo(input))) { 25684 if(sel.startPos == 0 && sel.endPos == oldValue.length) 25685 sel.endPos = input.value.length; 25686 else 25687 sel.endPos = sel.startPos; 25688 if(!this.accessibilityCompliant || ASPx.GetActiveElement() == input) 25689 this.SetSelectionOnToggleTextDecoration(input, sel); 25690 } 25691 } else { 25692 this.ToggleTextDecorationCore(); 25693 this.ensureDeactivateFocusedNullTextMechanism(); 25694 } 25695 } 25696 }, 25697 SetSelectionOnToggleTextDecoration: function(input, sel) { 25698 ASPx.Selection.Set(input, sel.startPos, sel.endPos); 25699 }, 25700 ToggleTextDecorationCore: function() { 25701 if(this.maskInfo != null) { 25702 this.ApplyMaskInfo(false); 25703 } else { 25704 var input = this.GetInputElement(); 25705 var rawValue = this.GetRawValue(); 25706 var value = this.CanApplyTextDecorators() ? this.GetDecoratedText(rawValue) : rawValue; 25707 if(input.value != value) { 25708 if(input.type == "password") 25709 this.TogglePasswordInputTextDecoration(value); 25710 else 25711 input.value = value; 25712 } 25713 } 25714 }, 25715 GetPasswordNullTextInputElement: function() { 25716 if(!this.isPasswordNullTextInputElementExists()) 25717 this.nullTextInputElement = this.createPasswordNullTextInputElement(); 25718 return this.nullTextInputElement; 25719 }, 25720 createPasswordNullTextInputElement: function() { 25721 var inputElement = this.GetInputElement(), 25722 nullTextInputElement = document.createElement("INPUT"); 25723 nullTextInputElement.className = inputElement.className; 25724 nullTextInputElement.style.cssText = inputElement.style.cssText; 25725 nullTextInputElement.id = inputElement.id + passwordInputClonedSuffix; 25726 nullTextInputElement.type = "text"; 25727 if(ASPx.IsExists(inputElement.tabIndex)) 25728 nullTextInputElement.tabIndex = inputElement.tabIndex; 25729 nullTextInputElement.disabled = inputElement.disabled; 25730 var onFocusEventHandler = function() { 25731 var inputElement = this.GetInputElement(), 25732 nullTextInputElement = this.GetPasswordNullTextInputElement(); 25733 if(inputElement) { 25734 this.LockFocusEvents(); 25735 ASPx.SetElementDisplay(inputElement, true); 25736 if((ASPx.Browser.MacOSMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 14) || (ASPx.Browser.MacOSPlatform && ASPx.Browser.Safari && ASPx.Browser.Version >= 14)) { 25737 ASPx.GetCurrentStyle(inputElement).display; 25738 } 25739 inputElement.focus(); 25740 ASPx.SetElementDisplay(nullTextInputElement, false); 25741 this.ensureAdjustFocusedNullTextElement(); 25742 this.ReplaceAssociatedIdInLabels(nullTextInputElement.id, inputElement.id); 25743 } 25744 }.aspxBind(this); 25745 ASPx.Evt.AttachEventToElement(nullTextInputElement, "focus", onFocusEventHandler); 25746 return nullTextInputElement; 25747 }, 25748 isPasswordNullTextInputElementExists: function() { 25749 return ASPx.IsExistsElement(this.nullTextInputElement); 25750 }, 25751 TogglePasswordNullTextTimeoutChecker: function() { 25752 if(this.passwordNullTextIntervalID < 0) { 25753 var timeoutChecker = function() { 25754 var inputElement = this.GetInputElement(); 25755 if(ASPx.GetControlCollection().GetByName(this.name) !== this || inputElement == null) { 25756 window.clearTimeout(this.passwordNullTextIntervalID); 25757 this.passwordNullTextIntervalID = -1; 25758 return; 25759 } else { 25760 if(!this.focused) { 25761 var passwordNullTextInputElement = this.GetPasswordNullTextInputElement(); 25762 if(passwordNullTextInputElement.value != this.nullText && inputElement.value == "") { 25763 passwordNullTextInputElement.value = this.nullText; 25764 this.SetValue(null); 25765 } 25766 if(inputElement.value != "") { 25767 if(inputElement.style.display == "none") { 25768 this.SetValue(inputElement.value); 25769 this.UnhidePasswordInput(); 25770 } 25771 } else { 25772 if(inputElement.style.display != "none") { 25773 this.SetValue(null); 25774 this.HidePasswordInput(); 25775 } 25776 } 25777 } 25778 else { 25779 var passwordNullTextInputElement = this.GetPasswordNullTextInputElement(); 25780 if(passwordNullTextInputElement.value !== this.nullText && passwordNullTextInputElement.value !== "") { 25781 if(inputElement.value === "") 25782 inputElement.value = passwordNullTextInputElement.value; 25783 passwordNullTextInputElement.value = this.nullText; 25784 } 25785 } 25786 } 25787 }.aspxBind(this); 25788 timeoutChecker(); 25789 this.passwordNullTextIntervalID = window.setInterval(timeoutChecker, 100); 25790 } 25791 }, 25792 TogglePasswordInputTextDecoration: function(value) { 25793 var inputElement = this.GetInputElement(); 25794 var nullTextInputElement = this.GetPasswordNullTextInputElement(); 25795 nullTextInputElement.value = value; 25796 var parentNode = inputElement.parentNode; 25797 if(ASPx.Data.ArrayIndexOf(parentNode.childNodes, nullTextInputElement) < 0) { 25798 ASPx.Attr.ChangeStyleAttribute(nullTextInputElement, "display", "none"); 25799 ASPx.InsertElementAfter(nullTextInputElement, inputElement); 25800 } 25801 this.HidePasswordInput(); 25802 this.TogglePasswordNullTextTimeoutChecker(); 25803 },
25804 HidePasswordInput: function() { 25805 ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", "none"); 25806 ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", ""); 25807 this.ReplaceAssociatedIdInLabels(this.GetInputElement().id, this.GetPasswordNullTextInputElement().id); 25808 }, 25809 UnhidePasswordInput: function() { 25810 ASPx.Attr.ChangeStyleAttribute(this.GetInputElement(), "display", ""); 25811 ASPx.Attr.ChangeStyleAttribute(this.GetPasswordNullTextInputElement(), "display", "none"); 25812 this.ReplaceAssociatedIdInLabels(this.GetPasswordNullTextInputElement().id, this.GetInputElement().id); 25813 }, 25814 ReplaceAssociatedIdInLabels: function(oldId, newId) { 25815 var labels = document.getElementsByTagName("LABEL"); 25816 for(var i = 0; i < labels.length; i++) { 25817 if(labels[i].attributes["for"] && labels[i].attributes["for"].value == oldId) 25818 labels[i].attributes["for"].value = newId; 25819 } 25820 }, 25821 GetFormattedText: function() { 25822 var value = this.GetValue(); 25823 if(this.IsNull(value) && this.nullText != "") 25824 return this.GetText(); 25825 return this.GetDecoratedText(value); 25826 }, 25827 IsNull: function(value) { 25828 return value == null || value === ""; 25829 }, 25830 PopulateStyleDecorationPostfixes: function() { 25831 ASPxClientEdit.prototype.PopulateStyleDecorationPostfixes.call(this); 25832 this.styleDecoration.AddPostfix(ASPx.TEInputSuffix); 25833 if(this.GetInputElement().type === "password" && this.nullText !== "") 25834 this.styleDecoration.AddPostfix(ASPx.TEInputSuffix + passwordInputClonedSuffix); 25835 }, 25836 GetValue: function() { 25837 var value = null; 25838 if(this.maskInfo != null) 25839 value = this.maskInfo.GetValue(); 25840 else if(this.HasTextDecorators()) 25841 value = this.GetRawValue(); 25842 else { 25843 var input = this.GetInputElement(); 25844 value = input ? input.value : null; 25845 } 25846 return (value == "" && this.convertEmptyStringToNull) ? null : value; 25847 }, 25848 SetValue: function(value) { 25849 if(value == null || value === undefined) 25850 value = ""; 25851 if(this.maskInfo != null) { 25852 this.maskInfo.SetValue(value.toString()); 25853 this.ApplyMaskInfo(false); 25854 this.SavePrevMaskValue(); 25855 } 25856 else if(this.HasTextDecorators()) { 25857 this.SetRawValue(value); 25858 this.GetInputElement().value = this.CanApplyTextDecorators() && this.GetInputElement().type != "password" ? this.GetDecoratedText(value) : value; 25859 } 25860 else 25861 this.GetInputElement().value = value; 25862 this.UpdateStyleDecorations(); 25863 this.SaveChangedValue(); 25864 }, 25865 SetVisible: function(visible) { 25866 ASPxClientEdit.prototype.SetVisible.call(this, visible); 25867 if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) { 25868 if(visible) 25869 this.showHelpText(); 25870 else 25871 this.hideHelpText(); 25872 } 25873 }, 25874 UnstretchInputElement: function(){ 25875 var inputElement = this.GetInputElement(); 25876 var mainElement = this.GetMainElement(); 25877 var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement); 25878 if(ASPx.IsExistsElement(mainElement) && ASPx.IsExistsElement(inputElement) && ASPx.IsExists(mainElementCurStyle) && 25879 inputElement.style.width == "100%" && 25880 (mainElementCurStyle.width == "" || mainElementCurStyle.width == "auto")) 25881 inputElement.style.width = ""; 25882 }, 25883 RestoreActiveElement: function(activeElement) { 25884 if(activeElement && activeElement.setActive && activeElement.tagName != "IFRAME") 25885 activeElement.setActive(); 25886 }, 25887 RaiseValueChangedEvent: function() { 25888 var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this); 25889 processOnServer = this.RaiseTextChanged(processOnServer); 25890 return processOnServer; 25891 }, 25892 InitMask: function() { 25893 var rawValue = this.GetRawValue(); 25894 this.SetValue(rawValue.length ? this.DecodeRawInputValue(rawValue) : this.maskInfo.GetValue()); 25895 this.validationPatterns.unshift(new MaskValidationPattern(this.maskInfo.errorText, this.maskInfo)); 25896 }, 25897 SetMaskPasteTimer: function() { 25898 this.ClearMaskPasteTimer(); 25899 this.maskPasteTimerID = ASPx.Timer.SetControlBoundInterval(this.MaskPasteTimerProc, this, ASPx.PasteCheckInterval); 25900 }, 25901 ClearMaskPasteTimer: function() { 25902 this.maskPasteTimerID = ASPx.Timer.ClearInterval(this.maskPasteTimerID); 25903 }, 25904 SavePrevMaskValue: function() { 25905 this.maskValueBeforeUserInput = this.maskInfo.GetValue(); 25906 }, 25907 FillMaskInfo: function() { 25908 var input = this.GetInputElement(); 25909 if(!input) return; 25910 var sel = ASPx.Selection.GetInfo(input); 25911 this.maskInfo.SetCaret(sel.startPos, sel.endPos - sel.startPos); 25912 }, 25913 ApplyMaskInfo: function(applyCaret) { 25914 this.SyncRawValue(); 25915 var input = this.GetInputElement(); 25916 var text = this.GetMaskDisplayText(); 25917 this.maskTextBeforePaste = text; 25918 if(input.value != text) 25919 input.value = text; 25920 if(applyCaret) 25921 ASPx.Selection.Set(input, this.maskInfo.caretPos, this.maskInfo.caretPos + this.maskInfo.selectionLength); 25922 }, 25923 GetMaskDisplayText: function() { 25924 if(!this.focused && this.HasTextDecorators()) 25925 return this.GetDecoratedText(this.maskInfo.GetValue()); 25926 return this.maskInfo.GetText(); 25927 }, 25928 ShouldCancelMaskKeyProcessing: function(htmlEvent, keyDownInfo) { 25929 return ASPx.Evt.IsEventPrevented(htmlEvent); 25930 }, 25931 HandleMaskKeyDown: function(evt) { 25932 var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt); 25933 ASPx.MaskManager.keyCancelled = this.ShouldCancelMaskKeyProcessing(evt, keyInfo); 25934 if(ASPx.MaskManager.keyCancelled) { 25935 ASPx.Evt.PreventEvent(evt); 25936 return; 25937 } 25938 this.maskPasteLock = true; 25939 this.FillMaskInfo(); 25940 var canHandle = ASPx.MaskManager.CanHandleControlKey(keyInfo); 25941 ASPx.MaskManager.savedKeyDownKeyInfo = keyInfo; 25942 if(canHandle) { 25943 ASPx.MaskManager.OnKeyDown(this.maskInfo, keyInfo);
25944 this.ApplyMaskInfo(true); 25945 ASPx.Evt.PreventEvent(evt); 25946 } 25947 ASPx.MaskManager.keyDownHandled = canHandle; 25948 this.maskPasteLock = false; 25949 this.UpdateMaskHintHtml(); 25950 }, 25951 HandleMaskKeyPress: function(evt) { 25952 var keyInfo = ASPx.MaskManager.CreateKeyInfoByEvent(evt); 25953 ASPx.MaskManager.keyCancelled = ASPx.MaskManager.keyCancelled || this.ShouldCancelMaskKeyProcessing(evt, ASPx.MaskManager.savedKeyDownKeyInfo); 25954 if(ASPx.MaskManager.keyCancelled) { 25955 ASPx.Evt.PreventEvent(evt); 25956 return; 25957 } 25958 this.maskPasteLock = true; 25959 var printable = ASPx.MaskManager.savedKeyDownKeyInfo != null && ASPx.MaskManager.IsPrintableKeyCode(ASPx.MaskManager.savedKeyDownKeyInfo); 25960 if(printable) { 25961 ASPx.MaskManager.OnKeyPress(this.maskInfo, keyInfo); 25962 this.ApplyMaskInfo(true); 25963 } 25964 if(printable || ASPx.MaskManager.keyDownHandled) 25965 ASPx.Evt.PreventEvent(evt); 25966 this.maskPasteLock = false; 25967 this.UpdateMaskHintHtml(); 25968 }, 25969 MaskPasteTimerProc: function() { 25970 if(this.maskPasteLock || !this.maskInfo) return; 25971 this.maskPasteCounter++; 25972 var inputElement = this.inputElement; 25973 if(!inputElement || this.maskPasteCounter > 40) { 25974 this.maskPasteCounter = 0; 25975 inputElement = this.GetInputElement(); 25976 if(!ASPx.IsExistsElement(inputElement)) { 25977 this.ClearMaskPasteTimer(); 25978 return; 25979 } 25980 } 25981 if(this.maskTextBeforePaste !== inputElement.value) 25982 this.ProcessInputValueChangedOnTimer(); 25983 if(!this.focused) 25984 this.ClearMaskPasteTimer(); 25985 }, 25986 ProcessInputValueChangedOnTimer: function() { 25987 var inputElement = this.inputElement; 25988 var selectionInfo = ASPx.Selection.GetInfo(inputElement); 25989 var startCaretPosition = selectionInfo.startPos; 25990 var endCaretPosition = selectionInfo.endPos; 25991 var oldText = this.maskTextBeforePaste; 25992 var newText = inputElement.value; 25993 var isAndroidBackSpacePressed = this.isAndroidBackSpacePressed(oldText, newText, startCaretPosition, endCaretPosition); 25994 var isLastTypedCharacter = newText.indexOf(oldText) == 0 && newText.length > oldText.length; 25995 if(isAndroidBackSpacePressed || isLastTypedCharacter) { 25996 this.SetText(newText); 25997 this.SetCaretPosition(endCaretPosition); 25998 this.maskValueChangedByPassKeyPressOnAndroid = true; 25999 } else { 26000 this.maskInfo.ProcessPaste(newText, endCaretPosition); 26001 this.ApplyMaskInfo(true); 26002 } 26003 }, 26004 isAndroidBackSpacePressed: function(oldText, newText, startCaretPosition, endCaretPosition) { 26005 if(!ASPx.Browser.AndroidMobilePlatform || startCaretPosition !== endCaretPosition || newText.length >= oldText.length) 26006 return false; 26007 var startSubstring = newText.substring(0, startCaretPosition); 26008 var endSubstring = newText.substring(startCaretPosition); 26009 var isStartSubstringMatches = oldText.indexOf(startSubstring) == 0; 26010 var isEndSubstringMatches = endSubstring == "" || oldText.lastIndexOf(endSubstring) == oldText.length - endSubstring.length; 26011 return isStartSubstringMatches && isEndSubstringMatches; 26012 }, 26013 BeginShowMaskHint: function() { 26014 if(!this.GetReadOnly() && this.maskHintTimerID == -1) 26015 this.maskHintTimerID = window.setInterval(ASPx.MaskHintTimerProc, 500); 26016 }, 26017 EndShowMaskHint: function() { 26018 window.clearInterval(this.maskHintTimerID); 26019 this.maskHintTimerID = -1; 26020 }, 26021 MaskHintTimerProc: function() { 26022 if(this.maskInfo) { 26023 this.FillMaskInfo(); 26024 this.UpdateMaskHintHtml(); 26025 } else { 26026 this.EndShowMaskHint(); 26027 } 26028 }, 26029 UpdateMaskHintHtml: function() { 26030 var hint = this.GetMaskHintElement(); 26031 if(!ASPx.IsExistsElement(hint)) 26032 return; 26033 var html = ASPx.MaskManager.GetHintHtml(this.maskInfo); 26034 if(html == this.maskHintHtml) 26035 return; 26036 if(html != "") { 26037 var mainElement = this.GetMainElement(); 26038 if(ASPx.IsExistsElement(mainElement)) { 26039 hint.innerHTML = html; 26040 hint.style.position = "absolute"; 26041 hint.style.left = ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteX(mainElement), mainElement, true) + "px"; 26042 hint.style.top = (ASPx.PrepareClientPosForElement(ASPx.GetAbsoluteY(mainElement), mainElement, false) + mainElement.offsetHeight + 2) + "px"; 26043 hint.style.display = "block"; 26044 } 26045 } else { 26046 hint.style.display = "none"; 26047 } 26048 this.maskHintHtml = html; 26049 }, 26050 HideMaskHint: function() { 26051 var hint = this.GetMaskHintElement(); 26052 if(ASPx.IsExistsElement(hint)) 26053 hint.style.display = "none"; 26054 this.maskHintHtml = ""; 26055 }, 26056 GetMaskHintElement: function() { 26057 return ASPx.GetElementById(this.name + "_MaskHint"); 26058 }, 26059 OnLostFocus: function() { 26060 if(this.IsAutocompleteOffRequiredOnLostFocus()) 26061 ASPx.Attr.SetAttribute(this.GetInputElement(), "autocomplete", "off"); 26062 ASPxClientEdit.prototype.OnLostFocus.call(this); 26063 }, 26064 OnMouseWheel: function(evt){ 26065 if(this.GetReadOnly() || this.maskInfo == null || !this.maskInfo.allowMouseWheel) 26066 return; 26067 this.FillMaskInfo(); 26068 ASPx.MaskManager.OnMouseWheel(this.maskInfo, ASPx.Evt.GetWheelDelta(evt) < 0 ? -1 : 1);
26069 this.ApplyMaskInfo(true); 26070 ASPx.Evt.PreventEvent(evt); 26071 this.UpdateMaskHintHtml(); 26072 }, 26073 OnBrowserWindowResize: function(e) { 26074 if(!this.autoResizeWithContainer) 26075 this.AdjustControl(); 26076 }, 26077 IsValueChanged: function() { 26078 return this.GetValue() != this.lastChangedValue; 26079 }, 26080 OnKeyDown: function(evt) { 26081 if(this.NeedPreventBrowserUndoBehaviour(evt)) 26082 return ASPx.Evt.PreventEvent(evt); 26083 if(this.RequireHandleMaxlenManually()) { 26084 this.onKeyDownInputValue = this.GetInputElement().value; 26085 var selectionInfo = ASPx.Selection.GetExtInfo(this.GetInputElement()); 26086 this.onKeyDownCursorPos = selectionInfo.startPos; 26087 } 26088 this.escCount = 0; 26089 ASPxClientEdit.prototype.OnKeyDown.call(this, evt); 26090 if(!this.IsRaiseStandardOnChange(evt)) { 26091 if(!this.GetReadOnly() && this.maskInfo != null) 26092 this.HandleMaskKeyDown(evt); 26093 } 26094 }, 26095 IsCtrlZ: function(evt) { 26096 return evt.ctrlKey && !evt.altKey && !evt.shiftKey && (ASPx.Evt.GetKeyCode(evt) == 122 || ASPx.Evt.GetKeyCode(evt) == 90); 26097 }, 26098 NeedPreventBrowserUndoBehaviour: function(evt) { 26099 var inputElement = this.GetInputElement(); 26100 return this.IsCtrlZ(evt) && !!inputElement && !inputElement.value; 26101 }, 26102 OnKeyPress: function(evt) { 26103 ASPxClientEdit.prototype.OnKeyPress.call(this, evt); 26104 if(!this.GetReadOnly() && this.maskInfo != null && !this.IsRaiseStandardOnChange(evt)) 26105 this.HandleMaskKeyPress(evt); 26106 if(this.NeedOnKeyEventEnd(evt, true)) 26107 this.OnKeyEventEnd(evt); 26108 }, 26109 OnKeyUp: function(evt) { 26110 if(ASPx.Browser.Firefox && !this.focused && ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab) 26111 return; 26112 if(this.NeedOnKeyEventEnd(evt, false)) { 26113 var proccessNextCommingPress = ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Alt; 26114 this.OnKeyEventEnd(evt, proccessNextCommingPress); 26115 } 26116 if(this.RequireHandleMaxlenManually()) { 26117 var inputValueLength = this.GetInputElement().value.length; 26118 var maxLength = this.GetInputMaxLength(); 26119 if(inputValueLength > maxLength && inputValueLength > this.onKeyDownInputValue.length) { 26120 this.GetInputElement().value = this.onKeyDownInputValue; 26121 this.SetCaretPosition(this.onKeyDownCursorPos); 26122 } 26123 } 26124 ASPxClientEdit.prototype.OnKeyUp.call(this, evt); 26125 }, 26126 RequireHandleMaxlenManually: function() { 26127 return ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.SamsungAndroidDevice && ASPx.Browser.PlaformMajorVersion < 6 && this.GetInputMaxLength() !== -1; 26128 }, 26129 GetInputMaxLength: function() { 26130 var input = this.GetInputElement(); 26131 if(ASPx.Attr.IsExistsAttribute(input, "maxlength")) 26132 return input.maxLength; 26133 return -1; 26134 }, 26135 NeedOnKeyEventEnd: function(evt, isKeyPress) { 26136 var handleKeyPress = this.maskInfo != null && evt.keyCode == ASPx.Key.Enter; 26137 return handleKeyPress == isKeyPress; 26138 }, 26139 OnKeyEventEnd: function(evt, withDelay){ 26140 if(!this.GetReadOnly()) { 26141 if(this.IsRaiseStandardOnChange(evt)) 26142 this.RaiseStandardOnChange(); 26143 this.SyncRawValueIfHasTextDecorators(withDelay); 26144 } 26145 }, 26146 SyncRawValueIfHasTextDecorators: function(withDelay) { 26147 if(this.HasTextDecorators()) { 26148 if(withDelay) { 26149 window.setTimeout(function() { 26150 this.SyncRawValue(); 26151 }.aspxBind(this), 0); 26152 } else 26153 this.SyncRawValue(); 26154 } 26155 }, 26156 IsRaiseStandardOnChange: function(evt){ 26157 return !this.UseSpecialKeyboardHandling() && this.raiseValueChangedOnEnter && evt.keyCode == ASPx.Key.Enter; 26158 }, 26159 GetFocusSelectAction: function() { 26160 if (this.maskInfo) 26161 return this.maskInfo.IsEmpty() ? null : "start"; 26162 return "all"; 26163 }, 26164 CorrectFocusWhenDisabled: function() { 26165 if(!this.GetEnabled()) { 26166 var inputElement = this.GetInputElement(); 26167 if(inputElement) 26168 inputElement.blur(); 26169 return true; 26170 } 26171 return false; 26172 }, 26173 EnsureShowPopupHelpText: function() { 26174 if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup) 26175 this.showHelpText(); 26176 }, 26177 EnsureHidePopupHelpText: function() { 26178 if(this.helpTextDisplayMode === ASPxClientTextEditHelpTextDisplayMode.Popup) 26179 this.hideHelpText(); 26180 }, 26181 OnFocusCore: function() { 26182 if(this.maskInfo != null && !ASPx.GetControlCollection().InCallback()) { 26183 this.TrySetCursorToStartPosition(); 26184 this.SetMaskPasteTimer(); 26185 } 26186 if(this.IsAutocompleteDropDownListRequiredOnFocus()) 26187 ASPx.Attr.RemoveAttribute(this.GetInputElement(), "autocomplete"); 26188 if(this.CorrectFocusWhenDisabled()) 26189 return;
26190 var wasLocked = this.IsFocusEventsLocked(); 26191 ASPxClientEdit.prototype.OnFocusCore.call(this); 26192 if(this.maskInfo != null) { 26193 this.SavePrevMaskValue(); 26194 this.BeginShowMaskHint(); 26195 } 26196 if(!wasLocked) { 26197 this.ToggleTextDecoration(); 26198 this.startUserInputEventTimerIfRequired(); 26199 } 26200 if(this.isPasswordNullTextInputElementExists()) 26201 setTimeout(function() { this.EnsureShowPopupHelpText(); }.aspxBind(this), 0); 26202 else 26203 this.EnsureShowPopupHelpText(); 26204 }, 26205 startUserInputEventTimerIfRequired: function () { 26206 if(this.shouldStartUserInputTimer() && this.userInputEventTimerID === -1) { 26207 this.prevInputValue = this.GetInputElement().value; 26208 this.userInputEventTimerID = ASPx.Timer.SetControlBoundInterval(this.processUserInputEventTimer, this, ASPx.CheckUserInputInterval); 26209 } 26210 }, 26211 shouldStartUserInputTimer: function() { 26212 return !this.UserInput.IsEmpty(); 26213 }, 26214 restartCurrentUserInputTimer: function() { 26215 if(this.userInputEventTimerID !== -1) { 26216 this.processUserInputEventTimer(true); 26217 this.clearUserInputEventTimerIfRequired(); 26218 this.startUserInputEventTimerIfRequired(); 26219 } 26220 }, 26221 clearUserInputEventTimerIfRequired: function () { 26222 if (this.userInputEventTimerID !== -1) 26223 this.userInputEventTimerID = ASPx.Timer.ClearInterval(this.userInputEventTimerID); 26224 }, 26225 processUserInputEventTimer: function(onRestart) { 26226 var currentInputValue = this.GetInputElement().value; 26227 if(currentInputValue !== this.prevInputValue) { 26228 this.onInputChangedOnUserInputTimer(onRestart); 26229 this.prevInputValue = currentInputValue; 26230 } 26231 }, 26232 onInputChangedOnUserInputTimer: function(onRestart) { 26233 if(this.raiseUserInputTimeout > -1) 26234 clearTimeout(this.raiseUserInputTimeout); 26235 this.raiseUserInputTimeout = setTimeout(function() { 26236 this.RaiseUserInput(); 26237 this.raiseUserInputTimeout = -1; 26238 }.bind(this), 0); 26239 }, 26240 ensureFocusedNullTextElement: function () { 26241 if(!this.focusedNullTextElement) 26242 this.createFocusedNullTextElement(); 26243 }, 26244 getFocusedNullTextElementClassName: function() { 26245 return focusedNullTextClassName; 26246 }, 26247 getFocusedNullTextElementTagName: function() { 26248 return "INPUT"; 26249 }, 26250 getCopyFromInputElementStyles: function() { 26251 return [ "paddingLeft", "paddingTop", "paddingRight", "paddingBottom", "borderCollapse", "borderLeftWidth", "borderTopWidth", "borderRightWidth", "borderBottomWidth" ]; 26252 }, 26253 copyStylesFromInputElementToFocusedNullTextElement: function() { 26254 var input = this.GetInputElement(); 26255 var inputStyle = ASPx.GetCurrentStyle(input); 26256 var stylesToCopy = this.getCopyFromInputElementStyles(); 26257 for(var i = 0; i < stylesToCopy.length; i++) 26258 this.focusedNullTextElement.style[stylesToCopy[i]] = inputStyle[stylesToCopy[i]]; 26259 }, 26260 createFocusedNullTextElement: function() { 26261 this.focusedNullTextElement = document.createElement(this.getFocusedNullTextElementTagName()); 26262 this.focusedNullTextElement.value = this.nullText; 26263 this.focusedNullTextElement.className = this.getFocusedNullTextElementClassName(); 26264 this.focusedNullTextElement.tabIndex = -1; 26265 ASPx.SetElementDisplay(this.focusedNullTextElement, false); 26266 if(this.accessibilityCompliant) { 26267 ASPx.Attr.SetAttribute(this.focusedNullTextElement, "aria-label", this.nullText); 26268 ASPx.Attr.SetAttribute(this.focusedNullTextElement, "aria-hidden", true); 26269 } 26270 this.copyStylesFromInputElementToFocusedNullTextElement(); 26271 if (this.nullTextOnFocusCssText) { 26272 var styleSheet = ASPx.GetCurrentStyleSheet(); 26273 this.focusedNullTextElement.className += " " + ASPx.CreateImportantStyleRule(styleSheet, this.nullTextOnFocusCssText); 26274 } 26275 var inputElement = this.GetInputElement(); 26276 inputElement.parentNode.insertBefore(this.focusedNullTextElement, inputElement.nextSibling); 26277 }, 26278 ensureActivateFocusedNullTextMechanism: function() { 26279 if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) { 26280 if(this.IsNull(this.GetValue())) 26281 this.changeFocusedNullTextElementVisibility(true); 26282 this.setFocusedNullTextTimer(); 26283 } 26284 }, 26285 ensureDeactivateFocusedNullTextMechanism: function () { 26286 if (this.nullTextDisplayMode === NullTextDisplayMode.UnfocusedAndFocused) { 26287 this.clearFocusedNullTextTimer(); 26288 this.changeFocusedNullTextElementVisibility(false); 26289 } 26290 }, 26291 setFocusedNullTextTimer: function () { 26292 if(this.focusedNullTextTimerID === -1) 26293 this.focusedNullTextTimerID = ASPx.Timer.SetControlBoundInterval(this.onFocusedNullTextVisibilityCheck, this, ASPx.PasteCheckInterval); 26294 }, 26295 clearFocusedNullTextTimer: function () { 26296 this.focusedNullTextTimerID = ASPx.Timer.ClearInterval(this.focusedNullTextTimerID); 26297 }, 26298 onFocusedNullTextVisibilityCheck: function (evt) { 26299 if(!this.needShowFocusedNullText() && this.isFocusedNullTextElementDisplayed()) 26300 this.changeFocusedNullTextElementVisibility(false); 26301 else if(this.needShowFocusedNullText() && !this.isFocusedNullTextElementDisplayed()) 26302 this.changeFocusedNullTextElementVisibility(true); 26303 }, 26304 isFocusedNullTextElementDisplayed: function() { 26305 return this.focusedNullTextElement && ASPx.GetElementDisplay(this.focusedNullTextElement); 26306 }, 26307 needShowFocusedNullText: function() { 26308 if(this.focusedNullTextTimerID === -1) 26309 return this.IsNull(this.GetValue()); 26310 var result = this.GetInputElement().value === ""; 26311 if(this.CanApplyNullTextDecoration) 26312 result = result && this.CanApplyNullTextDecoration(); 26313 return result; 26314 }, 26315 changeFocusedNullTextElementVisibility: function (visible) { 26316 this.ensureFocusedNullTextElement(); 26317 ASPx.SetElementDisplay(this.focusedNullTextElement, visible); 26318 if(visible) 26319 this.adjustFocusedNullTextElement(); 26320 }, 26321 getInputElementAbsoluteX: function(input) { 26322 var result = ASPx.GetAbsoluteX(input); 26323 if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 26324 result++; 26325 return result; 26326 }, 26327 getInputElementAbsoluteY: function (input) { 26328 var result = ASPx.GetAbsoluteY(input); 26329 if(ASPx.Browser.Opera || ASPx.Browser.AndroidMobilePlatform) 26330 result++; 26331 return result; 26332 }, 26333 adjustFocusedNullTextElement: function() { 26334 var input = this.GetInputElement(); 26335 this.focusedNullTextElement.style.width = input.offsetWidth + "px"; 26336 this.focusedNullTextElement.style.height = input.offsetHeight + "px"; 26337 var inputXPos = this.getInputElementAbsoluteX(input);
26338 var inputYPos = this.getInputElementAbsoluteY(input); 26339 ASPx.SetAbsoluteX(this.focusedNullTextElement, inputXPos); 26340 ASPx.SetAbsoluteY(this.focusedNullTextElement, inputYPos); 26341 var shiftByX = inputXPos - ASPx.GetAbsoluteX(this.focusedNullTextElement); 26342 var shiftByY = inputYPos - ASPx.GetAbsoluteY(this.focusedNullTextElement); 26343 if (shiftByX !== 0) 26344 this.focusedNullTextElement.style.left = ASPx.PxToFloat(this.focusedNullTextElement.style.left) + shiftByX + "px"; 26345 if (shiftByY !== 0) 26346 this.focusedNullTextElement.style.top = ASPx.PxToFloat(this.focusedNullTextElement.style.top) + shiftByY + "px"; 26347 }, 26348 ensureAdjustFocusedNullTextElement: function () { 26349 if(this.isFocusedNullTextElementDisplayed()) 26350 this.adjustFocusedNullTextElement(this.focusedNullTextElement); 26351 }, 26352 TrySetCursorToStartPosition: function() { 26353 var input = this.GetInputElement(); 26354 var sel = ASPx.Selection.GetInfo(input); 26355 if (sel.startPos === sel.endPos && this.IsMaskInfoEmpty()) { 26356 var pos = this.maskInfo.GetFirstNonLiteralPosition(); 26357 var setCaret = ASPx.Selection.SetCaretPosition.bind(this, input, pos); 26358 setTimeout(function() { 26359 if (document.activeElement === input) { 26360 setCaret(); 26361 setTimeout(setCaret, 50); 26362 } 26363 }, 0); 26364 } 26365 }, 26366 IsMaskInfoEmpty: function() { 26367 return this.maskInfo.IsEmpty(); 26368 }, 26369 OnLostFocusCore: function() { 26370 var wasLocked = this.IsFocusEventsLocked(); 26371 ASPxClientEdit.prototype.OnLostFocusCore.call(this); 26372 if(this.maskInfo != null) { 26373 this.EndShowMaskHint(); 26374 this.HideMaskHint(); 26375 if(this.maskInfo.ApplyFixes(null)) 26376 this.ApplyMaskInfo(false); 26377 this.RaiseStandardOnChange(); 26378 } 26379 if(!wasLocked) { 26380 this.clearUserInputEventTimerIfRequired(); 26381 this.ToggleTextDecoration(); 26382 } 26383 this.escCount = 0; 26384 this.EnsureHidePopupHelpText(); 26385 }, 26386 SetFocus: function() { 26387 if(this.isPasswordNullTextInputElementExists()) { 26388 this.GetPasswordNullTextInputElement().focus(); 26389 } else { 26390 ASPxClientEdit.prototype.SetFocus.call(this); 26391 } 26392 }, 26393 OnValueChanged: function() { 26394 if(this.maskInfo != null) { 26395 if(!this.maskValueChangedByPassKeyPressOnAndroid && this.maskInfo.GetValue() == this.maskValueBeforeUserInput && !this.IsValueChangeForced()) 26396 return; 26397 if(this.maskValueChangedByPassKeyPressOnAndroid) 26398 this.maskValueChangedByPassKeyPressOnAndroid = false; 26399 this.SavePrevMaskValue(); 26400 } 26401 if(this.HasTextDecorators()) 26402 this.SyncRawValue(); 26403 if(!this.IsValueChanged() && !this.IsValueChangeForced()) 26404 return; 26405 this.SaveChangedValue(); 26406 ASPxClientEdit.prototype.OnValueChanged.call(this); 26407 }, 26408 IsValueChangeForced: function() { 26409 return false; 26410 }, 26411 OnTextChanged: function() { 26412 }, 26413 ForceTextChanged: function() { 26414 this.OnTextChanged(); 26415 }, 26416 SaveChangedValue: function() { 26417 this.lastChangedValue = this.GetValue(); 26418 }, 26419 RaiseStandardOnChange: function(){ 26420 var element = this.GetInputElement(); 26421 if(element && element.onchange) { 26422 element.onchange({ target: this.GetInputElement() }); 26423 } 26424 else if(this.ValueChanged) { 26425 this.ValueChanged.FireEvent(this); 26426 } 26427 }, 26428 RaiseTextChanged: function(processOnServer){ 26429 if(!this.TextChanged.IsEmpty()){ 26430 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 26431 this.TextChanged.FireEvent(this, args); 26432 processOnServer = args.processOnServer; 26433 } 26434 return processOnServer; 26435 }, 26436 RaiseUserInput: function () { 26437 if(!this.UserInput.IsEmpty()) { 26438 var args = new ASPxClientEventArgs(); 26439 this.UserInput.FireEvent(this, args); 26440 } 26441 }, 26442 GetText: function(){ 26443 if(this.maskInfo != null) { 26444 return this.maskInfo.GetText(); 26445 } else { 26446 var value = this.GetValue(); 26447 return value != null ? value : ""; 26448 } 26449 }, 26450 SetText: function (value){ 26451 if(this.maskInfo != null) { 26452 this.maskInfo.SetText(value); 26453 this.ApplyMaskInfo(false); 26454 this.SavePrevMaskValue(); 26455 } else { 26456 this.SetValue(value); 26457 } 26458 }, 26459 SelectAll: function() { 26460 this.SetSelection(0, -1, false); 26461 }, 26462 SetCaretPosition: function(pos) { 26463 var inputElement = this.GetInputElement(); 26464 ASPx.Selection.SetCaretPosition(inputElement, pos); 26465 }, 26466 GetCaretPosition: function() { 26467 var inputElement = this.GetInputElement(); 26468 return ASPx.Selection.GetCaretPosition(inputElement); 26469 }, 26470 SetSelection: function(startPos, endPos, scrollToSelection) { 26471 var inputElement = this.GetInputElement(); 26472 ASPx.Selection.Set(inputElement, startPos, endPos, scrollToSelection, true); 26473 }, 26474 ChangeEnabledAttributes: function(enabled){ 26475 var inputElement = this.GetInputElement(); 26476 if(inputElement){ 26477 this.ChangeInputEnabledAttributes(inputElement, ASPx.Attr.ChangeAttributesMethod(enabled), enabled); 26478 this.ChangeSpecialInputEnabledAttributes(inputElement, ASPx.Attr.ChangeEventsMethod(enabled), true); 26479 this.ChangeInputEnabled(inputElement, enabled, this.GetReadOnly()); 26480 if(this.isPasswordNullTextInputElementExists()) 26481 this.GetPasswordNullTextInputElement().disabled = inputElement.disabled; 26482 } 26483 }, 26484 SetReadOnlyInternal: function(readOnly) { 26485 ASPxClientEdit.prototype.SetReadOnlyInternal.call(this, readOnly); 26486 this.ChangeInputReadOnly(readOnly); 26487 }, 26488 ChangeReadOnlyStateItems: function(readOnly) { 26489 ASPxClientEdit.prototype.ChangeReadOnlyStateItems.call(this, readOnly); 26490 ASPx.GetStateController().SetElementReadOnly(this.GetInputElement(), readOnly); 26491 if(this.isPasswordNullTextInputElementExists()) 26492 ASPx.GetStateController().SetElementReadOnly(this.GetPasswordNullTextInputElement(), readOnly); 26493 }, 26494 ChangeInputReadOnly: function(readOnly) { 26495 var inputElement = this.GetInputElement(); 26496 if(inputElement) 26497 inputElement.readOnly = readOnly || !this.GetEnabled() && this.UseReadOnlyForDisabled(); 26498 }, 26499 ChangeEnabledStateItems: function(enabled){ 26500 if(!this.isNative) { 26501 var sc = ASPx.GetStateController(); 26502 sc.SetElementEnabled(this.GetMainElement(), enabled); 26503 sc.SetElementEnabled(this.GetInputElement(), enabled); 26504 if(this.isPasswordNullTextInputElementExists()) 26505 sc.SetElementEnabled(this.GetPasswordNullTextInputElement(), enabled); 26506 } 26507 }, 26508 ChangeInputEnabled: function(element, enabled, readOnly) { 26509 if(this.UseReadOnlyForDisabled()) 26510 element.readOnly = !enabled || readOnly; 26511 else 26512 element.disabled = !enabled; 26513 }, 26514 ChangeInputEnabledAttributes: function(element, method, enabled) { 26515 method(element, "tabIndex"); 26516 if(!enabled) element.tabIndex = -1; 26517 method(element, "onclick"); 26518 method(element, "onkeydown"); 26519 method(element, "onkeypress"); 26520 method(element, "onkeyup"); 26521 }, 26522 UseReadOnlyForDisabled: function() { 26523 return false; 26524 }, 26525 OnPostFinalization: function(args) {
26526 this.TryRestoreDisabledOnPost(args); 26527 this.TryClearInputTextDecorationOnPost(args); 26528 }, 26529 TryRestoreDisabledOnPost: function(args) { 26530 if(this.GetEnabled() || !this.UseReadOnlyForDisabled() || args.isDXCallback) 26531 return; 26532 var inputElement = this.GetInputElement(); 26533 if(inputElement) { 26534 var inputDisabled = inputElement.disabled; 26535 inputElement.disabled = true; 26536 window.setTimeout(function() { 26537 inputElement.disabled = inputDisabled; 26538 }, 0); 26539 } 26540 }, 26541 GetTempHiddenInputID: function() { 26542 return this.name + ASPx.TempHiddenInputSuffix; 26543 }, 26544 TryClearInputTextDecorationOnPost: function(args) { 26545 if(ASPx.Platform === "NETCORE") 26546 return; 26547 if(this.HasTextDecorators() && !ASPx.IsExists(this.GetValue())) { 26548 var inputElement = this.GetInputElement(); 26549 if(inputElement) { 26550 var name = ASPx.Attr.GetAttribute(inputElement, "name"); 26551 if(name) 26552 this.TryClearInputTextDecorationOnPostCore(inputElement, name); 26553 } 26554 } 26555 }, 26556 TryClearInputTextDecorationOnPostCore: function(inputElement, name) { 26557 var hiddenInput = ASPx.CreateHiddenField(name, this.GetTempHiddenInputID(), inputElement.parentNode); 26558 ASPx.Attr.SetAttribute(inputElement, "data-name", name); 26559 ASPx.Attr.RemoveAttribute(inputElement, "name"); 26560 setTimeout(function() { 26561 ASPx.Attr.SetAttribute(inputElement, "name", name); 26562 ASPx.Attr.RemoveAttribute(inputElement, "data-name"); 26563 ASPx.RemoveElement(hiddenInput); 26564 }, 0); 26565 }, 26566 OnUnload: function() { 26567 var input = this.GetInputElement(); 26568 if(!input) 26569 return; 26570 if(this.IsAutocompleteOffNotRequiredOnUnload()) 26571 ASPx.Attr.RemoveAttribute(input, "autocomplete"); 26572 if(this.focusedNullTextElement) 26573 ASPx.RemoveElement(this.focusedNullTextElement); 26574 }, 26575 IsVCardAttributeRequired: function() { 26576 return this.autoCompleteAttribute && this.autoCompleteAttribute.name !== "autocomplete"; 26577 }, 26578 IsAutocompleteDropDownListRequiredOnFocus: function() { 26579 return !this.autoCompleteAttribute || this.IsVCardAttributeRequired(); 26580 }, 26581 IsAutocompleteOffRequiredOnInitialize: function() { 26582 return !this.isNative && (this.autoCompleteAttribute && this.autoCompleteAttribute.name === "autocomplete" || ASPx.Browser.WebKitFamily); 26583 }, 26584 IsAutocompleteOffRequiredOnLostFocus: function() { 26585 return !this.autoCompleteAttribute && this.IsNullTextVisible() && !this.IsVCardAttributeRequired(); 26586 }, 26587 IsAutocompleteOffNotRequiredOnUnload: function() { 26588 return !this.IsNullTextVisible() || this.IsVCardAttributeRequired() || (this.maskInfo != null && this.GetValue() == null); 26589 }, 26590 IsNullTextVisible: function() { 26591 return this.nullText && !this.GetValue() && !this.GetText(); 26592 }, 26593 GetModifyEvent: function() { 26594 return this.UserInput; 26595 } 26596}); 26597MaskValidationPattern = ASPx.CreateClass(ASPx.ValidationPattern, { 26598 constructor: function(errorText, maskInfo) { 26599 this.constructor.prototype.constructor.call(this, errorText); 26600 this.maskInfo = maskInfo; 26601 }, 26602 EvaluateIsValid: function(value) { 26603 return this.maskInfo.IsValid(); 26604 } 26605}); 26606ASPx.Ident.IsASPxClientTextEdit = function(obj) { 26607 return !!obj.isASPxClientTextEdit; 26608}; 26609var ASPxClientTextBoxBase = ASPx.CreateClass(ASPxClientTextEdit, { 26610 constructor: function(name) { 26611 this.constructor.prototype.constructor.call(this, name); 26612 this.sizingConfig.allowSetHeight = false; 26613 this.sizingConfig.adjustControl = true; 26614 } 26615}); 26616var ASPxClientTextBox = ASPx.CreateClass(ASPxClientTextBoxBase, { 26617 constructor: function(name) { 26618 this.constructor.prototype.constructor.call(this, name); 26619 this.isASPxClientTextBox = true; 26620 this.isCaptchaTextBox = false; 26621 }, 26622 NeedProcessUnload: function() { 26623 return ASPxClientTextBoxBase.prototype.NeedProcessUnload.call(this) && !this.isCaptchaTextBox; 26624 }, 26625 IsValueRestoredByBrowser: function() { 26626 if(this.isCaptchaTextBox) 26627 return this.initializeInputValue !== "" && this.initializeInputValue !== this.nullText; 26628 return ASPxClientTextBoxBase.prototype.IsValueRestoredByBrowser.call(this); 26629 }, 26630 SynchronizeRestoredValue: function() { 26631 if(this.isCaptchaTextBox) 26632 this.SetText(null); 26633 else 26634 ASPxClientTextBoxBase.prototype.SynchronizeRestoredValue.call(this); 26635 }, 26636}); 26637ASPxClientTextBox.Cast = ASPxClientControl.Cast; 26638ASPx.Ident.IsASPxClientTextBox = function(obj) { 26639 return !!obj.isASPxClientTextBox; 26640}; 26641var ASPxClientMemo = ASPx.CreateClass(ASPxClientTextEdit, { 26642 constructor: function(name) { 26643 this.constructor.prototype.constructor.call(this, name); 26644 this.isASPxClientMemo = true; 26645 this.raiseValueChangedOnEnter = false; 26646 this.maxLength = 0; 26647 this.pasteTimerID = -1; 26648 this.pasteTimerActivatorCount = 0; 26649 }, 26650 Initialize: function() { 26651 ASPxClientTextEdit.prototype.Initialize.call(this); 26652 this.SaveChangedValue(); 26653 this.maxLengthRestricted = this.maxLength > 0;
26654 }, 26655 CutString: function() { 26656 var text = this.GetText(); 26657 if(text.length > this.maxLength) { 26658 text = text.substring(0, this.maxLength); 26659 this.SetText(text); 26660 } 26661 }, 26662 EventKeyCodeChangesTheInput: function(evt) { 26663 if(ASPx.IsPasteShortcut(evt)) 26664 return true; 26665 else if(evt.ctrlKey) 26666 return false; 26667 var keyCode = ASPx.Evt.GetKeyCode(evt); 26668 var isSystemKey = ASPx.Key.Windows <= keyCode && keyCode <= ASPx.Key.ContextMenu; 26669 var isFKey = ASPx.Key.F1 <= keyCode && keyCode <= 127; 26670 return ASPx.Key.Delete < keyCode && !isSystemKey && !isFKey || keyCode == ASPx.Key.Enter || keyCode == ASPx.Key.Space; 26671 }, 26672 OnTextChangingCheck: function() { 26673 if(this.maxLengthRestricted) 26674 this.CutString(); 26675 }, 26676 StartTextChangingTimer: function() { 26677 if(this.maxLengthRestricted) { 26678 if(this.pasteTimerActivatorCount == 0) 26679 this.SetTextChangingTimer(); 26680 this.pasteTimerActivatorCount ++; 26681 } 26682 }, 26683 EndTextChangingTimer: function() { 26684 if(this.maxLengthRestricted) { 26685 this.pasteTimerActivatorCount --; 26686 if(this.pasteTimerActivatorCount == 0) 26687 this.ClearTextChangingTimer(); 26688 } 26689 }, 26690 CollapseEditor: function() { 26691 if(!this.IsAdjustmentRequired()) return; 26692 var mainElement = this.GetMainElement(); 26693 var inputElement = this.GetInputElement(); 26694 if(!ASPx.IsExistsElement(mainElement) || !ASPx.IsExistsElement(inputElement)) 26695 return; 26696 ASPxClientTextEdit.prototype.CollapseEditor.call(this); 26697 var mainElementCurStyle = ASPx.GetCurrentStyle(mainElement); 26698 if(this.heightCorrectionRequired && mainElement && inputElement) { 26699 if(mainElement.style.height == "100%" || mainElementCurStyle.height == "100%") { 26700 mainElement.style.height = "0"; 26701 mainElement.wasCollapsed = true; 26702 } 26703 inputElement.style.height = "0"; 26704 } 26705 }, 26706 SetWidth: function(width) { 26707 ASPxClientTextEdit.prototype.SetWidth.call(this, width); 26708 }, 26709 ClearErrorFrameElementsStyles: function() { 26710 var textarea = this.GetInputElement(); 26711 if(!textarea) 26712 return; 26713 var scrollBarPosition = textarea.scrollTop; 26714 ASPxClientTextEdit.prototype.ClearErrorFrameElementsStyles.call(this); 26715 if(ASPx.Browser.Firefox) 26716 textarea.scrollTop = scrollBarPosition; 26717 }, 26718 OnMouseOver: function() { 26719 this.StartTextChangingTimer(); 26720 }, 26721 OnMouseOut: function() { 26722 this.EndTextChangingTimer(); 26723 }, 26724 OnFocusCore: function() { 26725 this.StartTextChangingTimer(); 26726 ASPxClientTextEdit.prototype.OnFocusCore.call(this); 26727 }, 26728 OnLostFocus: function() { 26729 this.EndTextChangingTimer(); 26730 ASPxClientTextEdit.prototype.OnLostFocus.call(this); 26731 }, 26732 OnKeyDown: function(evt) { 26733 if(this.NeedPreventBrowserUndoBehaviour(evt)) 26734 return ASPx.Evt.PreventEvent(evt); 26735 if(this.maxLengthRestricted){ 26736 var selection = ASPx.Selection.GetInfo(this.GetInputElement()); 26737 var noCharToReplace = selection.startPos == selection.endPos; 26738 if(this.GetText().length >= this.maxLength && noCharToReplace && this.EventKeyCodeChangesTheInput(evt)) { 26739 return ASPx.Evt.PreventEvent(evt); 26740 } 26741 } 26742 ASPxClientEdit.prototype.OnKeyDown.call(this, evt); 26743 }, 26744 SetTextChangingTimer: function() { 26745 this.pasteTimerID = ASPx.Timer.SetControlBoundInterval(this.OnTextChangingCheck, this, ASPx.PasteCheckInterval); 26746 }, 26747 ClearTextChangingTimer: function() { 26748 this.pasteTimerID = ASPx.Timer.ClearInterval(this.pasteTimerID); 26749 }, 26750 getFocusedNullTextElementTagName: function() { 26751 return "TEXTAREA"; 26752 }, 26753 getCopyFromInputElementStyles: function() { 26754 var result = ASPxClientTextEdit.prototype.getCopyFromInputElementStyles.call(this); 26755 result.push("resize"); 26756 return result; 26757 } 26758}); 26759ASPxClientMemo.Cast = ASPxClientControl.Cast; 26760ASPx.Ident.IsASPxClientMemo = function(obj) { return obj && !!obj.isASPxClientMemo; }; 26761var CLEAR_BUTTON_INDEX = -100; 26762var HIDE_CONTENT_CSS_CLASS_NAME = "dxHideContent"; 26763var setContentVisibility = function(clearButtonElement, value) { 26764 var action = value ? ASPx.RemoveClassNameFromElement : ASPx.AddClassNameToElement; 26765 action(clearButtonElement, HIDE_CONTENT_CSS_CLASS_NAME); 26766}; 26767var CLEAR_BUTTON_DISPLAY_MODE = { 26768 AUTO: 'Auto', 26769 ALWAYS: 'Always', 26770 NEVER: 'Never', 26771 ON_HOVER: 'OnHover' 26772}; 26773var AccessibilityFocusedButtonClassName = "dxAFB"; 26774var ButtonEditButtonLeftSystemClassName = "dxeButtonLeft"; 26775var ASPxClientButtonEditBase = ASPx.CreateClass(ASPxClientTextBoxBase, { 26776 constructor: function(name) { 26777 this.constructor.prototype.constructor.call(this, name); 26778 this.allowUserInput = true; 26779 this.isValueChanging = false; 26780 this.allowMouseWheel = true; 26781 this.isMouseOver = false; 26782 this.buttonCount = 0; 26783 this.emptyValueMaskDisplayText = ""; 26784 this.clearButtonDisplayMode = CLEAR_BUTTON_DISPLAY_MODE.AUTO; 26785 this.forceShowClearButtonAlways = false; 26786 this.recoverClearButtonVisibility = false; 26787 this.ButtonClick = new ASPxClientEvent(); 26788 }, 26789 Initialize: function() { 26790 ASPxClientTextBoxBase.prototype.Initialize.call(this); 26791 this.EnsureEmptyValueMaskDisplayText(); 26792 if(this.HasClearButton()) 26793 this.InitializeClearButton(); 26794 this.InitAccessibilityCompliant(); 26795 }, 26796 InlineInitialize: function() { 26797 ASPxClientTextBoxBase.prototype.InlineInitialize.call(this); 26798 if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.AUTO) { 26799 this.clearButtonDisplayMode = this.IsClearButtonVisibleAuto() || this.forceShowClearButtonAlways ? 26800 CLEAR_BUTTON_DISPLAY_MODE.ALWAYS : CLEAR_BUTTON_DISPLAY_MODE.NEVER; 26801 } 26802 this.EnsureClearButtonVisibility(); 26803 }, 26804 InitializeClearButton: function() { 26805 if(this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER) { 26806 ASPx.Evt.AttachMouseEnterToElement(this.GetHoverElementToShowClearButton(), this.OnMouseOver.aspxBind(this), this.OnMouseOut.aspxBind(this)); 26807 } 26808 }, 26809 GetHoverElementToShowClearButton: function() { 26810 return this.GetMainElement(); 26811 }, 26812 IsClearButtonVisibleAuto: function() { 26813 return ASPx.Browser.MobileUI; 26814 }, 26815 SetEnabled: function(enabled) { 26816 ASPxClientTextBoxBase.prototype.SetEnabled.call(this, enabled); 26817 this.EnsureClearButtonVisibility(); 26818 }, 26819 EnsureEmptyValueMaskDisplayText: function() { 26820 if(this.maskInfo && this.HasClearButton()) { 26821 var savedText = this.maskInfo.GetText(); 26822 this.maskInfo.SetText(""); 26823 this.emptyValueMaskDisplayText = this.maskInfo.GetText(); 26824 this.maskInfo.SetText(savedText); 26825 } 26826 }, 26827 GetButton: function(number) { 26828 return this.GetChildElement("B" + number); 26829 }, 26830 GetCustomButtonCollection: function() { 26831 var buttonElements = []; 26832 for(var i = 0; i < this.buttonCount; i++) { 26833 var button = this.GetButton(i); 26834 if(!!button) 26835 buttonElements.push(button); 26836 } 26837 return buttonElements; 26838 }, 26839 GetButtonCollection: function() { 26840 var buttonElements = []; 26841 var clearButton = this.GetClearButton(); 26842 if(!!clearButton) 26843 buttonElements.push(clearButton); 26844 return buttonElements.concat(this.GetCustomButtonCollection()); 26845 }, 26846 GetAccessibilityAnchor: function(buttonElement) { 26847 var firstChild = buttonElement.firstElementChild; 26848 var isExistsAnchorElement = ASPx.Attr.GetAttribute(firstChild, "role") === "button"; 26849 return isExistsAnchorElement ? firstChild : null; 26850 }, 26851 GetButtonByAccessibilityAnchor: function(anchorElement) { 26852 return anchorElement.parentNode; 26853 }, 26854 SetAccessibilityAnchorEnabled: function(buttonElement, enabled) { 26855 var anchorElement = this.GetAccessibilityAnchor(buttonElement); 26856 if(ASPx.IsExists(anchorElement)) 26857 ASPx.Attr.SetOrRemoveAttribute(anchorElement, "tabindex", enabled ? "0" : ""); 26858 }, 26859 InitAccessibilityCompliant: function() { 26860 if(!this.accessibilityCompliant) return; 26861 var buttonElements = this.GetButtonCollection(); 26862 var labelElements = ASPx.FindAssociatedLabelElements(this); 26863 for(var i = 0; i < buttonElements.length; i++) { 26864 this.InitAccessibilityAnchor(this.GetAccessibilityAnchor(buttonElements[i]), labelElements); 26865 ASPx.Evt.AttachEventToElement(buttonElements[i], "mousedown", this.Button_MouseDown.bind(this)); 26866 } 26867 }, 26868 InitAccessibilityAnchor: function(anchorElement, labelElements) { 26869 if(!ASPx.IsExists(anchorElement)) 26870 return; 26871 for(var i = 0; i < labelElements.length; i++) 26872 this.ariaExplanatoryTextManager.SetOrRemoveText([anchorElement], labelElements[i], true, false, false); 26873 this.InitAccessibilityAnchorEvents(anchorElement); 26874 }, 26875 InitAccessibilityAnchorEvents: function(anchorElement) { 26876 ASPx.Evt.AttachEventToElement(anchorElement, "keydown", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this)); 26877 ASPx.Evt.AttachEventToElement(anchorElement, "keyup", function(evt) { this.OnButtonKeysHandling(evt); }.aspxBind(this)); 26878 ASPx.Evt.AttachEventToElement(anchorElement, "focus", function(evt) { this.OnButtonGotFocus(evt); }.aspxBind(this)); 26879 ASPx.Evt.AttachEventToElement(anchorElement, "blur", function(evt) { this.OnButtonLostFocus(evt); }.aspxBind(this)); 26880 }, 26881 EmulateButtonMouseEvent: function(sourceElement) { 26882 var buttonElement = this.GetButtonByAccessibilityAnchor(sourceElement); 26883 var mouseEvent = buttonElement.onclick || buttonElement.onmousedown || buttonElement.ontouchstart || buttonElement.onpointerdown; 26884 var emulateMouseEvtArgs = { button: 0, which: 1, srcElement: buttonElement, target: buttonElement }; 26885 if(!!mouseEvent) { 26886 ASPx.Attr.SetAttribute(sourceElement, "aria-pressed", true); 26887 setTimeout(function() { 26888 mouseEvent(emulateMouseEvtArgs); 26889 ASPx.Attr.RemoveAttribute(sourceElement, "aria-pressed"); 26890 }, 300); 26891 } 26892 }, 26893 OnButtonKeysHandling: function(evt) { 26894 var isKeyUp = evt.type == "keyup"; 26895 var keyCode = ASPx.Evt.GetKeyCode(evt); 26896 var sourceElement = ASPx.Evt.GetEventSource(evt); 26897 if((keyCode == ASPx.Key.Space && isKeyUp) || (keyCode == ASPx.Key.Enter && !isKeyUp)) 26898 this.EmulateButtonMouseEvent(sourceElement); 26899 if(keyCode != ASPx.Key.Tab) 26900 ASPx.Evt.PreventEventAndBubble(evt); 26901 return false; 26902 }, 26903 OnButtonGotFocus: function(evt) { 26904 this.UnlockFocusEvents(); 26905 var editor = ASPx.GetControlCollection().Get(this.name); 26906 var sourceElement = ASPx.Evt.GetEventSource(evt);
26907 if(!!editor && !editor.CorrectAccessibilityButtonFocus(sourceElement)) { 26908 var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement); 26909 ASPx.AddClassNameToElement(buttonElement, this.GetAccessibilityFocusedButtonClassName()); 26910 ASPx.EGotFocus(editor.name); 26911 } 26912 }, 26913 OnButtonLostFocus: function(evt) { 26914 var editor = ASPx.GetControlCollection().Get(this.name); 26915 var sourceElement = ASPx.Evt.GetEventSource(evt); 26916 if(!!editor) { 26917 var buttonElement = editor.GetButtonByAccessibilityAnchor(sourceElement); 26918 ASPx.RemoveClassNameFromElement(buttonElement, this.GetAccessibilityFocusedButtonClassName()); 26919 } 26920 setTimeout(function() { 26921 if(!!editor && !editor.IsEditorElement(ASPx.GetActiveElement())) { 26922 ASPx.ELostFocus(editor.name); 26923 } 26924 }.aspxBind(this), 0); 26925 }, 26926 Button_MouseDown: function(evt) { 26927 var editor = ASPx.GetControlCollection().Get(this.name); 26928 if(!!editor) { 26929 var sourceElement = ASPx.Evt.GetEventSource(evt); 26930 if(document.activeElement !== sourceElement) 26931 this.LockFocusEvents(); 26932 } 26933 }, 26934 ForceRefocusEditor: function(evt, isNativeFocus) { 26935 if(this.accessibilityCompliant) { 26936 var srcElement = ASPx.Evt.GetEventSource(evt); 26937 var customButtons = this.GetCustomButtonCollection(); 26938 for(var i = 0; i < customButtons.length; i++) 26939 if(customButtons[i] == srcElement || ASPx.GetIsParent(customButtons[i], srcElement)) 26940 return; 26941 } 26942 ASPxClientEdit.prototype.ForceRefocusEditor.call(this, evt, isNativeFocus); 26943 if(this.GetInputElement().type == "password") { 26944 window.setTimeout(function() { this.GetInputElement().focus(); }.bind(this), 0); 26945 } 26946 },
26947 CorrectAccessibilityButtonFocus: function(sourceElement) { 26948 if(ASPx.Attr.IsExistsAttribute(sourceElement, "tabindex")) 26949 return false; 26950 setTimeout(function() { 26951 var buttonElements = this.GetButtonCollection(); 26952 for(var i = 0; i < buttonElements.length; i++) 26953 if(ASPx.GetIsParent(buttonElements[i], sourceElement)) 26954 this.GetAccessibilityAnchor(buttonElements[i]).focus(); 26955 }.aspxBind(this), 0); 26956 return true; 26957 }, 26958 OnKeyDown: function(evt) { 26959 if(this.NeedEnsureClearButtonVisibilityOnKeyDown()) { 26960 var hasClearButtonOnHover = this.HasClearButton() && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ON_HOVER; 26961 this.recoverClearButtonVisibility = hasClearButtonOnHover && ASPx.Evt.GetKeyCode(evt) == ASPx.Key.Tab && !evt.shiftKey; 26962 } 26963 if(this.accessibilityCompliant) { 26964 var hasVisibleFocusableButtonToTheRIGHT = this.GetButtonCollection().some(function(buttonElement) { 26965 return this.IsButtonVisible(buttonElement) 26966 && !ASPx.ElementHasCssClass(buttonElement, ButtonEditButtonLeftSystemClassName) 26967 && this.GetAccessibilityAnchor(buttonElement) !== null; 26968 }, this); 26969 var hasVisibleFocusableButtonToTheLEFT = this.GetButtonCollection().some(function(buttonElement) { 26970 return this.IsButtonVisible(buttonElement) 26971 && ASPx.ElementHasCssClass(buttonElement, ButtonEditButtonLeftSystemClassName) 26972 && this.GetAccessibilityAnchor(buttonElement) !== null; 26973 }, this); 26974 if((ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab && !evt.shiftKey && hasVisibleFocusableButtonToTheRIGHT) || 26975 (ASPx.Evt.GetKeyCode(evt) === ASPx.Key.Tab && evt.shiftKey && hasVisibleFocusableButtonToTheLEFT )) 26976 this.LockFocusEvents(); 26977 } 26978 ASPxClientTextBoxBase.prototype.OnKeyDown.call(this, evt); 26979 }, 26980 NeedEnsureClearButtonVisibilityOnKeyDown: function() { 26981 return this.accessibilityCompliant; 26982 }, 26983 GetAccessibilityFocusedButtonClassName: function() { 26984 return AccessibilityFocusedButtonClassName; 26985 }, 26986 SetButtonVisible: function(number, value) { 26987 var button = this.GetButton(number); 26988 if(!button) 26989 return; 26990 var isClearButton = number === CLEAR_BUTTON_INDEX; 26991 var visibilityModifier = isClearButton ? setContentVisibility : ASPx.SetElementDisplay; 26992 if(isClearButton && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS && this.accessibilityCompliant && this.enabled)
26993 this.SetAccessibilityAnchorEnabled(button, value); 26994 visibilityModifier(button, value); 26995 }, 26996 GetButtonVisible: function(number) { 26997 var button = this.GetButton(number); 26998 return this.IsButtonVisible(button); 26999 }, 27000 IsButtonVisible: function(button) { 27001 var result = false; 27002 if(button) { 27003 if(this.IsClearButtonElement(button) && this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.ALWAYS) 27004 result = !ASPx.ElementHasCssClass(button, this.GetHideContentCssClassName()); 27005 else 27006 result = ASPx.IsElementVisible(button); 27007 } 27008 return result; 27009 }, 27010 GetHideContentCssClassName: function() { 27011 return HIDE_CONTENT_CSS_CLASS_NAME; 27012 }, 27013 ProcessInternalButtonClick: function(buttonIndex) { 27014 return false; 27015 }, 27016 OnButtonClick: function(number) { 27017 var processOnServer = this.RaiseButtonClick(number); 27018 if(!this.ProcessInternalButtonClick(number) && processOnServer) 27019 this.SendPostBack('BC:' + number); 27020 }, 27021 GetLastSuccesfullValue: function() { 27022 return this.lastChangedValue; 27023 }, 27024 OnClear: function() { 27025 this.startUserInputEventTimerIfRequired(); 27026 this.ClearEditorValueAndForceOnChange(); 27027 this.ForceRefocusEditor(null, true); 27028 window.setTimeout(this.EnsureClearButtonVisibility.aspxBind(this), 0); 27029 }, 27030 ClearEditorValueAndForceOnChange: function() { 27031 if(this.GetReadOnly() || !this.GetButtonVisible(CLEAR_BUTTON_INDEX)) 27032 return; 27033 var raiseOnChange = this.ClearEditorValueByClearButton(); 27034 if(raiseOnChange) 27035 this.ForceStandardOnChange(); 27036 }, 27037 ClearEditorValueByClearButton: function() { 27038 var prevValue = this.GetLastSuccesfullValue(); 27039 this.ClearEditorValueByClearButtonCore(); 27040 return prevValue !== this.GetValue(); 27041 }, 27042 ClearEditorValueByClearButtonCore: function() { 27043 this.Clear(); 27044 this.GetInputElement().value = ''; 27045 }, 27046 ForceStandardOnChange: function() { 27047 this.forceValueChanged = true; 27048 this.RaiseStandardOnChange(); 27049 this.forceValueChanged = false; 27050 }, 27051 IsValueChangeForced: function() { 27052 return this.forceValueChanged || ASPxClientTextBoxBase.prototype.IsValueChangeForced.call(this); 27053 }, 27054 IsValueChanging: function() { return this.isValueChanging; }, 27055 StartValueChanging: function() { this.isValueChanging = true; }, 27056 EndValueChanging: function() { this.isValueChanging = false; }, 27057 IsClearButtonElement: function(element) { 27058 return ASPx.GetIsParent(this.GetClearButton(), element); 27059 }, 27060 OnFocusCore: function() { 27061 if(this.accessibilityCompliant) { 27062 if(this.focused) 27063 this.UnlockFocusEvents(); 27064 else 27065 ASPxClientTextBoxBase.prototype.OnFocusCore.call(this); 27066 } 27067 else 27068 ASPxClientTextBoxBase.prototype.OnFocusCore.call(this); 27069 this.EnsureClearButtonVisibility(); 27070 }, 27071 OnLostFocusCore: function() { 27072 ASPxClientTextBoxBase.prototype.OnLostFocusCore.call(this); 27073 this.EnsureClearButtonVisibility(); 27074 this.recoverClearButtonVisibility = false; 27075 }, 27076 GetClearButton: function() { 27077 return this.GetButton(CLEAR_BUTTON_INDEX); 27078 }, 27079 HasClearButton: function() { 27080 return !!this.GetClearButton(); 27081 }, 27082 RequireShowClearButton: function() { 27083 return !this.IsClearButtonDisabled() && !this.IsClearButtonNotRequired() && this.RequireShowClearButtonInternal(); 27084 }, 27085 IsClearButtonDisabled: function() { 27086 return !this.clientEnabled || !this.HasClearButton() || this.clearButtonDisplayMode === CLEAR_BUTTON_DISPLAY_MODE.NEVER; 27087 }, 27088 IsClearButtonNotRequired: function() { 27089 return !this.IsFocused() && !this.isMouseOver && this.clearButtonDisplayMode !== CLEAR_BUTTON_DISPLAY_MODE.ALWAYS && !this.recoverClearButtonVisibility; 27090 }, 27091 RequireShowClearButtonInternal: function () { 27092 return this.IsFocused() && this.RequireShowClearButtonCore() || !this.IsNullState(); 27093 }, 27094 RequireShowClearButtonCore: function() { 27095 var inputText = this.GetInputElement().value; 27096 return inputText !== this.GetEmptyValueDisplayText(); 27097 }, 27098 IsFocused: function() { 27099 return this === ASPx.GetFocusedEditor(); 27100 }, 27101 IsNullState: function() { 27102 var value = this.GetValue(); 27103 return this.IsNull(value) || value === this.GetEmptyValueDisplayText(); 27104 }, 27105 GetEmptyValueDisplayText: function() { 27106 return this.maskInfo ? this.emptyValueMaskDisplayText : ""; 27107 }, 27108 EnsureClearButtonVisibility: function() { 27109 this.SetButtonVisible(CLEAR_BUTTON_INDEX, this.RequireShowClearButton()); 27110 }, 27111 OnMouseOver: function() { 27112 this.isMouseOver = true; 27113 this.EnsureClearButtonVisibility(); 27114 }, 27115 OnMouseOut: function() { 27116 this.isMouseOver = false; 27117 this.EnsureClearButtonVisibility(); 27118 }, 27119 OnKeyPress: function(evt) { 27120 if(this.allowUserInput) 27121 ASPxClientTextBoxBase.prototype.OnKeyPress.call(this, evt); 27122 }, 27123 OnKeyEventEnd: function(evt, withDelay) { 27124 ASPxClientTextBoxBase.prototype.OnKeyEventEnd.call(this, evt, withDelay); 27125 this.EnsureClearButtonVisibility(); 27126 }, 27127 RaiseButtonClick: function(number){
27128 var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ButtonClick"); 27129 if(!this.ButtonClick.IsEmpty()){ 27130 var args = new ASPxClientButtonEditClickEventArgs(processOnServer, number); 27131 this.ButtonClick.FireEvent(this, args); 27132 processOnServer = args.processOnServer; 27133 } 27134 return processOnServer; 27135 }, 27136 ChangeEnabledAttributes: function(enabled){ 27137 ASPxClientTextEdit.prototype.ChangeEnabledAttributes.call(this, enabled); 27138 for(var i = 0; i < this.buttonCount; i++){ 27139 var element = this.GetButton(i); 27140 if(element) 27141 this.ChangeButtonEnabledAttributes(element, this.GetChangeButtonEnabledAttributesMethod(enabled)); 27142 } 27143 if(this.accessibilityCompliant) 27144 this.ChangeAccessibilityButtonEnabledAttributes(enabled); 27145 }, 27146 ChangeEnabledStateItems: function(enabled){ 27147 ASPxClientTextEdit.prototype.ChangeEnabledStateItems.call(this, enabled); 27148 for(var i = 0; i < this.buttonCount; i++){ 27149 var element = this.GetButton(i); 27150 if(element) 27151 ASPx.GetStateController().SetElementEnabled(element, enabled); 27152 } 27153 }, 27154 GetChangeButtonEnabledAttributesMethod: function(enabled) { 27155 return ASPx.Attr.ChangeAttributesMethod(enabled); 27156 }, 27157 ChangeButtonEnabledAttributes: function(element, method){ 27158 method(element, "onclick"); 27159 method(element, "ondblclick"); 27160 if(ASPx.Browser.Edge) 27161 method(element, "onmousedown"); 27162 method(element, "on" + ASPx.TouchUIHelper.touchMouseDownEventName); 27163 method(element, "on" + ASPx.TouchUIHelper.touchMouseUpEventName); 27164 }, 27165 ChangeInputEnabled: function(element, enabled, readOnly) { 27166 ASPxClientTextEdit.prototype.ChangeInputEnabled.call(this, element, enabled, readOnly || !this.allowUserInput); 27167 }, 27168 ChangeAccessibilityButtonEnabledAttributes: function(enabled) { 27169 var buttonElements = this.GetButtonCollection(); 27170 for(var i = 0; i < buttonElements.length; i++)
27171 this.SetAccessibilityAnchorEnabled(buttonElements[i], enabled); 27172 }, 27173 SetValue: function(value) { 27174 ASPxClientTextEdit.prototype.SetValue.call(this, value); 27175 if(!this.IsFocused()) 27176 this.EnsureClearButtonVisibility(); 27177 }, 27178 OnAssociatedLabelClick: function(focusableElement) { 27179 var isValidElement = focusableElement && ASPx.IsActionElement(focusableElement) && ASPx.GetIsParent(this.GetMainElement(), focusableElement) && ASPx.IsElementVisible(focusableElement); 27180 if(isValidElement) 27181 focusableElement.focus(); 27182 else 27183 this.SetFocus(); 27184 }, 27185 onClearButtonClick: function() { 27186 var requireFocus = !ASPx.Browser.VirtualKeyboardSupported || ASPx.Browser.MSTouchUI; 27187 if(this.ownerListBox) 27188 this.ownerListBox.ForceLockFocusEvents(); 27189 if((requireFocus && !this.IsFocused()) || this.accessibilityCompliant) 27190 this.GetInputElement().focus(); 27191 if(this.IsFocused() || !requireFocus) { 27192 if(this.ownerListBox) 27193 this.ownerListBox.UnlockFocusEvents(); 27194 else if(this.accessibilityCompliant) 27195 this.UnlockFocusEvents(); 27196 this.OnClear(); 27197 } 27198 else 27199 window.setTimeout(this.onClearButtonClick.bind(this), 100); 27200 } 27201}); 27202var ASPxClientButtonEdit = ASPx.CreateClass(ASPxClientButtonEditBase, { 27203}); 27204ASPxClientButtonEdit.Cast = ASPxClientControl.Cast; 27205var ASPxClientButtonEditClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, { 27206 constructor: function(processOnServer, buttonIndex){ 27207 this.constructor.prototype.constructor.call(this, processOnServer); 27208 this.buttonIndex = buttonIndex; 27209 } 27210}); 27211var ASPxClientTextEditHelpTextHAlign = { 27212 Left: "Left", 27213 Right: "Right", 27214 Center: "Center" 27215}; 27216var ASPxClientTextEditHelpTextVAlign = { 27217 Top: "Top", 27218 Bottom: "Bottom", 27219 Middle: "Middle" 27220}; 27221var ASPxClientTextEditHelpTextDisplayMode = { 27222 Inline: "Inline", 27223 Popup: "Popup" 27224}; 27225var ASPxClientTextEditHelpTextConsts = { 27226 VERTICAL_ORIENTATION_CLASS_NAME: "dxeVHelpTextSys", 27227 HORIZONTAL_ORIENTATION_CLASS_NAME: "dxeHHelpTextSys" 27228}; 27229var ASPxClientTextEditHelpText = ASPx.CreateClass(null, { 27230 constructor: function (editor, helpTextStyle, helpText, position, hAlign, vAlign, margins, animationEnabled, helpTextDisplayMode) { 27231 this.hAlign = hAlign; 27232 this.vAlign = vAlign; 27233 this.animationEnabled = animationEnabled; 27234 this.displayMode = helpTextDisplayMode; 27235 this.editor = editor; 27236 this.editorMainElement = editor.GetMainElement(); 27237 this.margins = margins ? { Top: margins[0], Right: margins[1], Bottom: margins[2], Left: margins[3] } : null; 27238 this.defaultMargins = { Top: 10, Right: 10, Bottom: 10, Left: 10 }; 27239 this.position = position; 27240 this.helpTextElement = this.createHelpTextElement(); 27241 this.setHelpTextZIndex(true); 27242 this.prepareHelpTextElement(helpTextStyle, helpText); 27243 }, 27244 getRows: function (table) { 27245 return ASPx.GetChildNodesByTagName(table, "TR"); 27246 }, 27247 getCells: function (row) { 27248 return ASPx.GetChildNodesByTagName(row, "TD"); 27249 }, 27250 getCellByIndex: function(row, cellIndex) { 27251 return this.getCells(row)[cellIndex]; 27252 }, 27253 getCellIndex: function(row, cell) { 27254 var cells = this.getCells(row); 27255 for(var i = 0; i < cells.length; i++) { 27256 if(cells[i] === cell) 27257 return i; 27258 } 27259 }, 27260 isHorizontal: function(position) { 27261 return position === ASPx.Position.Left || position === ASPx.Position.Right; 27262 }, 27263 isVertical: function (position) { 27264 return position === ASPx.Position.Top || position === ASPx.Position.Bottom; 27265 }, 27266 createEmptyCell: function(assignClassName) { 27267 var cell = document.createElement("TD"); 27268 if(assignClassName) 27269 cell.className = "dxeFakeEmptyCell"; 27270 return cell; 27271 }, 27272 addHelpTextCellToExternalTableWithTwoCells: function (captionCell, errorCell, helpTextCell, errorTableBody, tableRows) { 27273 var captionPosition = this.editor.captionPosition; 27274 var errorCellPosition = this.editor.errorCellPosition; 27275 var helpTextRow = this.isVertical(this.position) ? document.createElement("TR") : null; 27276 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition)) 27277 captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling); 27278 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition)) 27279 captionCell.parentNode.insertBefore(helpTextCell, captionCell); 27280 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition)) 27281 tableRows[0].appendChild(helpTextCell); 27282 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition)) 27283 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 27284 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) { 27285 helpTextRow.appendChild(helpTextCell); 27286 errorTableBody.appendChild(helpTextRow); 27287 } 27288 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) { 27289 helpTextRow.appendChild(helpTextCell); 27290 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27291 } 27292 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) { 27293 helpTextRow.appendChild(helpTextCell); 27294 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling); 27295 } 27296 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) { 27297 helpTextRow.appendChild(helpTextCell); 27298 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode); 27299 } 27300 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) { 27301 helpTextRow.appendChild(helpTextCell); 27302 helpTextRow.appendChild(this.createEmptyCell()); 27303 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27304 } 27305 if(this.position === ASPx.Position.Bottom) { 27306 if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) { 27307 helpTextRow.appendChild(helpTextCell); 27308 helpTextRow.appendChild(this.createEmptyCell()); 27309 errorTableBody.appendChild(helpTextRow); 27310 } 27311 } 27312 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) { 27313 helpTextRow.appendChild(this.createEmptyCell()); 27314 helpTextRow.appendChild(helpTextCell); 27315 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27316 } 27317 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) { 27318 helpTextRow.appendChild(this.createEmptyCell()); 27319 helpTextRow.appendChild(helpTextCell); 27320 errorTableBody.appendChild(helpTextRow); 27321 } 27322 if(this.position === ASPx.Position.Right) { 27323 if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Top 27324 || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right) { 27325 tableRows[1].appendChild(helpTextCell); 27326 tableRows[0].appendChild(this.createEmptyCell()); 27327 } 27328 if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Bottom || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) { 27329 tableRows[0].appendChild(helpTextCell); 27330 tableRows[1].appendChild(this.createEmptyCell()); 27331 } 27332 } 27333 if(this.position === ASPx.Position.Left) { 27334 if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Right 27335 || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Left) { 27336 tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]); 27337 tableRows[0].insertBefore(this.createEmptyCell(), tableRows[0].childNodes[0]); 27338 } 27339 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) { 27340 tableRows[1].insertBefore(helpTextCell, tableRows[1].childNodes[0]); 27341 tableRows[0].insertBefore(this.createEmptyCell(errorCellPosition === ASPx.Position.Top), tableRows[0].childNodes[0]); 27342 tableRows[2].insertBefore(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top), tableRows[2].childNodes[0]); 27343 } 27344 if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) { 27345 tableRows[2].insertBefore(helpTextCell, tableRows[2].childNodes[0]); 27346 tableRows[0].insertBefore(this.createEmptyCell(false), tableRows[0].childNodes[0]); 27347 tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]); 27348 } 27349 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) { 27350 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 27351 tableRows[1].insertBefore(this.createEmptyCell(true), tableRows[1].childNodes[0]); 27352 tableRows[2].insertBefore(this.createEmptyCell(false), tableRows[2].childNodes[0]); 27353 } 27354 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Bottom 27355 || captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) { 27356 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 27357 tableRows[1].insertBefore(this.createEmptyCell(), tableRows[1].childNodes[0]); 27358 } 27359 if(captionPosition === ASPx.Position.Left && this.isVertical(errorCellPosition)) { 27360 captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling); 27361 var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1]; 27362 var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell); 27363 emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex)); 27364 } 27365 } 27366 if(this.position === ASPx.Position.Right) { 27367 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Top || captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Bottom) { 27368 tableRows[1].appendChild(helpTextCell); 27369 tableRows[0].appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Top)); 27370 tableRows[2].appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Top)); 27371 } 27372 if(captionPosition === ASPx.Position.Top && errorCellPosition === ASPx.Position.Top) { 27373 tableRows[2].appendChild(helpTextCell); 27374 tableRows[0].appendChild(this.createEmptyCell(false)); 27375 tableRows[1].appendChild(this.createEmptyCell(true)); 27376 } 27377 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) { 27378 tableRows[0].appendChild(helpTextCell); 27379 tableRows[1].appendChild(this.createEmptyCell(true)); 27380 tableRows[2].appendChild(this.createEmptyCell(false)); 27381 } 27382 if(captionPosition === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Right) { 27383 tableRows[0].appendChild(helpTextCell); 27384 tableRows[1].appendChild(this.createEmptyCell()); 27385 } 27386 if(captionPosition === ASPx.Position.Right && this.isVertical(errorCellPosition)) { 27387 captionCell.parentNode.insertBefore(helpTextCell, captionCell); 27388 var emptyCellParentRow = errorCellPosition === ASPx.Position.Top ? tableRows[0] : tableRows[1]; 27389 var helpTextCellIndex = this.getCellIndex(helpTextCell.parentNode, helpTextCell); 27390 emptyCellParentRow.insertBefore(this.createEmptyCell(), this.getCellByIndex(emptyCellParentRow, helpTextCellIndex)); 27391 } 27392 } 27393 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) { 27394 if(errorCellPosition === ASPx.Position.Left) { 27395 helpTextRow.appendChild(this.createEmptyCell(true)); 27396 helpTextRow.appendChild(helpTextCell); 27397 } 27398 else { 27399 helpTextRow.appendChild(helpTextCell); 27400 helpTextRow.appendChild(this.createEmptyCell()); 27401 } 27402 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling); 27403 } 27404 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top && this.isHorizontal(errorCellPosition)) { 27405 if(errorCellPosition === ASPx.Position.Left) { 27406 helpTextRow.appendChild(this.createEmptyCell(true)); 27407 helpTextRow.appendChild(helpTextCell); 27408 } 27409 else { 27410 helpTextRow.appendChild(helpTextCell); 27411 helpTextRow.appendChild(this.createEmptyCell()); 27412 } 27413 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27414 } 27415 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom && this.isHorizontal(errorCellPosition)) { 27416 if(errorCellPosition === ASPx.Position.Left) { 27417 helpTextRow.appendChild(this.createEmptyCell(true)); 27418 helpTextRow.appendChild(helpTextCell); 27419 } 27420 else { 27421 helpTextRow.appendChild(helpTextCell); 27422 helpTextRow.appendChild(this.createEmptyCell()); 27423 } 27424 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode); 27425 } 27426 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Left) { 27427 helpTextRow.appendChild(this.createEmptyCell(true)); 27428 helpTextRow.appendChild(helpTextCell); 27429 errorTableBody.appendChild(helpTextRow); 27430 } 27431 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Bottom && errorCellPosition === ASPx.Position.Bottom) { 27432 helpTextRow.appendChild(helpTextCell); 27433 helpTextRow.appendChild(this.createEmptyCell()); 27434 errorTableBody.appendChild(helpTextRow); 27435 } 27436 if(this.position === ASPx.Position.Bottom) { 27437 if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) { 27438 helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right)); 27439 helpTextRow.appendChild(helpTextCell); 27440 helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right)); 27441 errorTableBody.appendChild(helpTextRow); 27442 } 27443 if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) { 27444 helpTextRow.appendChild(this.createEmptyCell(false)); 27445 helpTextRow.appendChild(this.createEmptyCell(true)); 27446 helpTextRow.appendChild(helpTextCell); 27447 errorTableBody.appendChild(helpTextRow); 27448 } 27449 if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) { 27450 helpTextRow.appendChild(helpTextCell); 27451 helpTextRow.appendChild(this.createEmptyCell(true)); 27452 helpTextRow.appendChild(this.createEmptyCell(false)); 27453 errorTableBody.appendChild(helpTextRow); 27454 } 27455 } 27456 if(this.position === ASPx.Position.Top) { 27457 if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Right || captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Left) { 27458 helpTextRow.appendChild(this.createEmptyCell(errorCellPosition !== ASPx.Position.Right)); 27459 helpTextRow.appendChild(helpTextCell); 27460 helpTextRow.appendChild(this.createEmptyCell(errorCellPosition === ASPx.Position.Right)); 27461 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27462 } 27463 if(captionPosition === ASPx.Position.Left && errorCellPosition === ASPx.Position.Left) { 27464 helpTextRow.appendChild(this.createEmptyCell(false)); 27465 helpTextRow.appendChild(this.createEmptyCell(true)); 27466 helpTextRow.appendChild(helpTextCell); 27467 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27468 } 27469 if(captionPosition === ASPx.Position.Right && errorCellPosition === ASPx.Position.Right) { 27470 helpTextRow.appendChild(helpTextCell); 27471 helpTextRow.appendChild(this.createEmptyCell(true)); 27472 helpTextRow.appendChild(this.createEmptyCell(false)); 27473 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27474 } 27475 } 27476 }, 27477 addHelpTextCellToExternalTableWithErrorCell
27477: function (errorCell, helpTextCell, errorTableBody, tableRows) { 27478 var errorCellPosition = this.editor.errorCellPosition; 27479 var helpTextRow = document.createElement("TR"); 27480 if(this.position === ASPx.Position.Left && this.isHorizontal(errorCellPosition)) 27481 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 27482 if(this.position === ASPx.Position.Right && this.isHorizontal(errorCellPosition)) 27483 tableRows[0].appendChild(helpTextCell); 27484 if(this.position === ASPx.Position.Top && this.isVertical(errorCellPosition)) { 27485 helpTextRow.appendChild(helpTextCell); 27486 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27487 } 27488 if(this.position === ASPx.Position.Bottom && this.isVertical(errorCellPosition)) { 27489 helpTextRow.appendChild(helpTextCell); 27490 errorTableBody.appendChild(helpTextRow); 27491 } 27492 if(errorCellPosition === ASPx.Position.Left && this.isVertical(this.position)) { 27493 helpTextRow.appendChild(this.createEmptyCell(true)); 27494 helpTextRow.appendChild(helpTextCell); 27495 if(this.position === ASPx.Position.Top) 27496 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27497 else 27498 errorTableBody.appendChild(helpTextRow); 27499 } 27500 if(errorCellPosition === ASPx.Position.Right && this.isVertical(this.position)) { 27501 helpTextRow.appendChild(helpTextCell); 27502 helpTextRow.appendChild(this.createEmptyCell(true)); 27503 if(this.position === ASPx.Position.Top) 27504 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27505 else 27506 errorTableBody.appendChild(helpTextRow); 27507 } 27508 if(this.position === ASPx.Position.Left && this.isVertical(errorCellPosition)) { 27509 var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0; 27510 var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0; 27511 tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]); 27512 tableRows[emptyCellRowIndex].insertBefore(this.createEmptyCell(true), tableRows[emptyCellRowIndex].childNodes[0]); 27513 } 27514 if(this.position === ASPx.Position.Right && this.isVertical(errorCellPosition)) { 27515 var helpTextParentRowIndex = errorCellPosition === ASPx.Position.Top ? 1 : 0; 27516 var emptyCellRowIndex = helpTextParentRowIndex === 0 ? 1 : 0; 27517 tableRows[helpTextParentRowIndex].appendChild(helpTextCell); 27518 tableRows[emptyCellRowIndex].appendChild(this.createEmptyCell(true)); 27519 } 27520 }, 27521 addHelpTextCellToExternalTableWithCaption: function (captionCell, helpTextCell, errorTableBody, tableRows) { 27522 var captionPosition = this.editor.captionPosition; 27523 var helpTextRow = document.createElement("TR"); 27524 if(captionPosition === ASPx.Position.Left && this.isVertical(this.position)) { 27525 helpTextRow.appendChild(this.createEmptyCell()); 27526 helpTextRow.appendChild(helpTextCell); 27527 if(this.position === ASPx.Position.Top) 27528 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27529 else 27530 errorTableBody.appendChild(helpTextRow); 27531 } 27532 if(this.position === ASPx.Position.Left && this.isVertical(captionPosition)) { 27533 var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0; 27534 var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0; 27535 tableRows[helpTextParentRowIndex].insertBefore(helpTextCell, tableRows[helpTextParentRowIndex].childNodes[0]); 27536 tableRows[emptyCellParentRowIndex].insertBefore(this.createEmptyCell(), tableRows[emptyCellParentRowIndex].childNodes[0]); 27537 } 27538 if(this.position === ASPx.Position.Right && this.isVertical(captionPosition)) { 27539 var helpTextParentRowIndex = captionPosition === ASPx.Position.Top ? 1 : 0; 27540 var emptyCellParentRowIndex = helpTextParentRowIndex === 0 ? 1 : 0; 27541 tableRows[helpTextParentRowIndex].appendChild(helpTextCell); 27542 tableRows[emptyCellParentRowIndex].appendChild(this.createEmptyCell()); 27543 } 27544 if(captionPosition === ASPx.Position.Right && this.isVertical(this.position)) { 27545 helpTextRow.appendChild(helpTextCell); 27546 helpTextRow.appendChild(this.createEmptyCell()); 27547 if(this.position === ASPx.Position.Top) 27548 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27549 else 27550 errorTableBody.appendChild(helpTextRow); 27551 } 27552 if(this.isVertical(captionPosition) && this.isVertical(this.position)) { 27553 helpTextRow.appendChild(helpTextCell); 27554 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Top) 27555 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode.nextSibling); 27556 if(captionPosition === ASPx.Position.Top && this.position === ASPx.Position.Bottom) 27557 errorTableBody.appendChild(helpTextRow); 27558 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Top) 27559 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27560 if(captionPosition === ASPx.Position.Bottom && this.position === ASPx.Position.Bottom) 27561 errorTableBody.insertBefore(helpTextRow, captionCell.parentNode); 27562 } 27563 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Left) 27564 captionCell.parentNode.insertBefore(helpTextCell, captionCell.nextSibling); 27565 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Right) 27566 captionCell.parentNode.insertBefore(helpTextCell, captionCell); 27567 if(captionPosition === ASPx.Position.Left && this.position === ASPx.Position.Right) 27568 tableRows[0].appendChild(helpTextCell); 27569 if(captionPosition === ASPx.Position.Right && this.position === ASPx.Position.Left) 27570 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 27571 }, 27572 addHelpTextCellToExternalTableWithEditorOnly: function (helpTextCell, errorTableBody, tableRows) { 27573 if(this.isHorizontal(this.position)) { 27574 if(this.position === ASPx.Position.Left) 27575 tableRows[0].insertBefore(helpTextCell, tableRows[0].childNodes[0]); 27576 else 27577 tableRows[0].appendChild(helpTextCell); 27578 } 27579 else { 27580 var helpTextRow = document.createElement("TR"); 27581 helpTextRow.appendChild(helpTextCell); 27582 if(this.position === ASPx.Position.Top) 27583 errorTableBody.insertBefore(helpTextRow, errorTableBody.childNodes[0]); 27584 else 27585 errorTableBody.appendChild(helpTextRow); 27586 } 27587 }, 27588 addHelpTextCellToExternalTable: function (errorTable, helpTextCell) { 27589 var errorTableBody = ASPx.GetNodeByTagName(errorTable, "TBODY", 0); 27590 var tableRows = this.getRows(errorTableBody); 27591 var captionCell = this.editor.GetCaptionCell();
27592 var errorCell = this.editor.GetErrorCell(); 27593 if(captionCell) { 27594 if(errorCell) 27595 this.addHelpTextCellToExternalTableWithTwoCells(captionCell, errorCell, helpTextCell, errorTableBody, tableRows); 27596 else 27597 this.addHelpTextCellToExternalTableWithCaption(captionCell, helpTextCell, errorTableBody, tableRows); 27598 } 27599 else if(errorCell) 27600 this.addHelpTextCellToExternalTableWithErrorCell(errorCell, helpTextCell, errorTableBody, tableRows); 27601 else 27602 this.addHelpTextCellToExternalTableWithEditorOnly(helpTextCell, errorTableBody, tableRows); 27603 }, 27604 createExternalTable: function () { 27605 var externalTable = document.createElement("TABLE"); 27606 externalTable.id = this.editor.name + ASPx.EditElementSuffix.ExternalTable; 27607 externalTable.cellPadding = 0; 27608 externalTable.cellSpacing = 0; 27609 this.applyExternalTableStyle(externalTable); 27610 var editorWidth = this.editorMainElement.style.width; 27611 if(ASPx.IsPercentageSize(editorWidth)) { 27612 externalTable.style.width = editorWidth; 27613 this.editorMainElement.style.width = "100%"; 27614 this.editor.width = "100%"; 27615 } 27616 var externalTableBody = document.createElement("TBODY"); 27617 var externalTableRow = document.createElement("TR"); 27618 var externalTableCell = document.createElement("TD"); 27619 externalTable.appendChild(externalTableBody); 27620 externalTableBody.appendChild(externalTableRow); 27621 externalTableRow.appendChild(externalTableCell); 27622 this.editorMainElement.parentNode.appendChild(externalTable); 27623 ASPx.ChangeElementContainer(this.editorMainElement, externalTableCell, true); 27624 if(this.editor.accessibilityCompliant) 27625 ASPx.Attr.SetAttribute(externalTable, "role", "presentation"); 27626 return externalTable; 27627 }, 27628 applyExternalTableStyle: function (externalTable) { 27629 var externalTableStyle = this.editor.externalTableStyle; 27630 if(externalTableStyle.length > 0) { 27631 this.applyStyleToElement(externalTable, externalTableStyle); 27632 } 27633 }, 27634 applyStyleToElement: function(element, style) { 27635 element.className = style[0]; 27636 if(style[1]) { 27637 var styleSheet = ASPx.GetCurrentStyleSheet(); 27638 element.className += " " + ASPx.CreateImportantStyleRule(styleSheet, style[1]); 27639 } 27640 }, 27641 createInlineHelpTextElement: function () { 27642 var helpTextElement = document.createElement("TD"); 27643 var externalTable = this.editor.GetExternalTable(); 27644 if(!externalTable) 27645 externalTable = this.createExternalTable(); 27646 this.addHelpTextCellToExternalTable(externalTable, helpTextElement); 27647 return helpTextElement; 27648 }, 27649 createPopupHelpTextElement: function () { 27650 var helpTextElement = document.createElement("DIV"); 27651 ASPx.InsertElementAfter(helpTextElement, this.editor.GetMainElement()); 27652 ASPx.AnimationHelper.setOpacity(helpTextElement, 0); 27653 ASPx.SetElementDisplay(helpTextElement, false); 27654 return helpTextElement; 27655 }, 27656 createHelpTextElement: function () { 27657 return this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup ? 27658 this.createPopupHelpTextElement() : this.createInlineHelpTextElement(); 27659 }, 27660 prepareHelpTextElement: function (helpTextStyle, helpText) { 27661 this.helpTextElement.id = this.getHelpTextElementId(); 27662 this.applyStyleToElement(this.helpTextElement, helpTextStyle); 27663 ASPx.SetInnerHtml(this.helpTextElement, "<SPAN>" + helpText + "</SPAN>"); 27664 if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Popup) 27665 this.updatePopupHelpTextPosition(); 27666 else { 27667 var isVerticalOrientation = this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom; 27668 var orientationClassName = isVerticalOrientation ? ASPxClientTextEditHelpTextConsts.VERTICAL_ORIENTATION_CLASS_NAME : 27669 ASPxClientTextEditHelpTextConsts.HORIZONTAL_ORIENTATION_CLASS_NAME; 27670 this.helpTextElement.className += " " + orientationClassName; 27671 this.setInlineHelpTextElementAlign(); 27672 ASPx.SetElementDisplay(this.helpTextElement, this.editor.clientVisible); 27673 } 27674 }, 27675 getHelpTextElementId: function() { 27676 return this.editor.name + ASPx.TEHelpTextElementSuffix; 27677 }, 27678 setInlineHelpTextElementAlign: function() { 27679 var hAlignValue = "", vAlignValue = ""; 27680 switch(this.hAlign) { 27681 case ASPxClientTextEditHelpTextHAlign.Left: hAlignValue = "left"; break; 27682 case ASPxClientTextEditHelpTextHAlign.Right: hAlignValue = "right"; break; 27683 case ASPxClientTextEditHelpTextHAlign.Center: hAlignValue = "center"; break; 27684 } 27685 switch(this.vAlign) { 27686 case ASPxClientTextEditHelpTextVAlign.Top: vAlignValue = "top"; break; 27687 case ASPxClientTextEditHelpTextVAlign.Bottom: vAlignValue = "bottom"; break; 27688 case ASPxClientTextEditHelpTextVAlign.Middle: vAlignValue = "middle"; break; 27689 } 27690 this.helpTextElement.style.textAlign = hAlignValue; 27691 this.helpTextElement.style.verticalAlign = vAlignValue; 27692 }, 27693 getHelpTextMargins: function() { 27694 if(this.margins) 27695 return this.margins; 27696 var result = this.defaultMargins; 27697 if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom) 27698 result.Left = result.Right = 0; 27699 else 27700 result.Top = result.Bottom = 0; 27701 return result; 27702 }, 27703 updatePopupHelpTextPosition: function (editorMainElement) { 27704 var editorWidth = this.editorMainElement.offsetWidth; 27705 var editorHeight = this.editorMainElement.offsetHeight; 27706 var helpTextWidth = this.helpTextElement.offsetWidth; 27707 var helpTextHeight = this.helpTextElement.offsetHeight; 27708 var editorX = ASPx.GetAbsoluteX(this.editorMainElement); 27709 var editorY = ASPx.GetAbsoluteY(this.editorMainElement); 27710 var helpTextX = 0, helpTextY = 0; 27711 var margins = this.getHelpTextMargins(); 27712 if(this.position === ASPx.Position.Top || this.position === ASPx.Position.Bottom) { 27713 if(this.position === ASPx.Position.Top) 27714 helpTextY = editorY - margins.Bottom - helpTextHeight; 27715 else if(this.position === ASPx.Position.Bottom) 27716 helpTextY = editorY + editorHeight + margins.Top; 27717 if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Left) 27718 helpTextX = editorX + margins.Left; 27719 else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Right) 27720 helpTextX = editorX + editorWidth - helpTextWidth - margins.Right; 27721 else if(this.hAlign === ASPxClientTextEditHelpTextHAlign.Center) { 27722 var editorCenterX = editorX + editorWidth / 2; 27723 var helpTextWidthWithMargins = helpTextWidth + margins.Left + margins.Right; 27724 helpTextX = editorCenterX - helpTextWidthWithMargins / 2 + margins.Left; 27725 } 27726 } else { 27727 if(this.position === ASPx.Position.Left) 27728 helpTextX = editorX - margins.Right - helpTextWidth; 27729 else if(this.position === ASPx.Position.Right) 27730 helpTextX = editorX + editorWidth + margins.Left; 27731 if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Top) 27732 helpTextY = editorY + margins.Top; 27733 else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Bottom) 27734 helpTextY = editorY + editorHeight - helpTextHeight - margins.Bottom; 27735 else if(this.vAlign === ASPxClientTextEditHelpTextVAlign.Middle) { 27736 var editorCenterY = editorY + editorHeight / 2; 27737 var helpTextHeightWithMargins = helpTextHeight + margins.Top + margins.Bottom; 27738 helpTextY = editorCenterY - helpTextHeightWithMargins / 2 + margins.Top; 27739 } 27740 } 27741 helpTextX = helpTextX < 0 ? 0 : helpTextX; 27742 helpTextY = helpTextY < 0 ? 0 : helpTextY; 27743 ASPx.SetAbsoluteX(this.helpTextElement, helpTextX); 27744 ASPx.SetAbsoluteY(this.helpTextElement, helpTextY); 27745 }, 27746 setHelpTextZIndex: function (hide) { 27747 var newZIndex = 41998 * (hide ? -1 : 1); 27748 if(this.helpTextElement.style.zIndex != newZIndex) 27749 this.helpTextElement.style.zIndex = newZIndex; 27750 }, 27751 hide: function () { 27752 if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) { 27753 ASPx.SetElementDisplay(this.helpTextElement, false); 27754 } 27755 else 27756 this.hidePopupHelpText(); 27757 }, 27758 hidePopupHelpText: function() { 27759 var onHidePopupHelpTextComplete = function () { 27760 this.setHelpTextZIndex(true); 27761 ASPx.SetElementDisplay(this.helpTextElement, false); 27762 }.aspxBind(this); 27763 if(this.animationEnabled) 27764 ASPx.AnimationHelper.fadeOut(this.helpTextElement, onHidePopupHelpTextComplete); 27765 else { 27766 ASPx.AnimationHelper.setOpacity(this.helpTextElement, 0); 27767 onHidePopupHelpTextComplete(); 27768 } 27769 }, 27770 show: function () { 27771 if(this.displayMode === ASPxClientTextEditHelpTextDisplayMode.Inline) { 27772 ASPx.SetElementDisplay(this.helpTextElement, true); 27773 } 27774 else 27775 this.showPopupHelpText(); 27776 }, 27777 showPopupHelpText: function () { 27778 ASPx.SetElementDisplay(this.helpTextElement, true); 27779 this.updatePopupHelpTextPosition(); 27780 if(this.animationEnabled) 27781 ASPx.AnimationHelper.fadeIn(this.helpTextElement); 27782 else 27783 ASPx.AnimationHelper.setOpacity(this.helpTextElement, 1); 27784 this.setHelpTextZIndex(false); 27785 } 27786}); 27787var ASPxOutOfRangeWarningManager = ASPx.CreateClass(null, { 27788 constructor: function (editor, minValue, maxValue, defaultMinValue, defaultMaxValue, outOfRangeWarningElementPosition, valueFormatter) { 27789 this.editor = editor; 27790 this.outOfRangeWarningElementPosition = outOfRangeWarningElementPosition; 27791 this.minValue = minValue; 27792 this.maxValue = maxValue; 27793 this.defaultMinValue = defaultMinValue; 27794 this.defaultMaxValue = defaultMaxValue; 27795 this.minMaxValueFormatter = valueFormatter; 27796 this.animationDuration = 150; 27797 this.CreateOutOfRangeWarningElement(); 27798 }, 27799 SetMinValue: function (minValue) { 27800 this.minValue = minValue; 27801 this.UpdateOutOfRangeWarningElementText(); 27802 }, 27803 SetMaxValue: function (maxValue) { 27804 this.maxValue = maxValue; 27805 this.UpdateOutOfRangeWarningElementText(); 27806 }, 27807 CreateOutOfRangeWarningElement: function () { 27808 this.outOfRangeWarningElement = document.createElement("DIV"); 27809 this.outOfRangeWarningElement.id = this.editor.name + "OutOfRWarn"; 27810 ASPx.InsertElementAfter(this.outOfRangeWarningElement, this.editor.GetOutOfRangeWarningElementPrevSibling()); 27811 ASPx.AnimationHelper.setOpacity(this.outOfRangeWarningElement, 0); 27812 this.outOfRangeWarningElement.className = this.editor.outOfRangeWarningClassName; 27813 this.UpdateOutOfRangeWarningElementText(); 27814 }, 27815 IsValueInRange: function (value) { 27816 return (!this.IsMinValueExists() || value >= this.minValue)
27817 && (!this.IsMaxValueExists() || value <= this.maxValue); 27818 }, 27819 IsMinValueExists: function() { 27820 return ASPx.IsExists(this.minValue) && !isNaN(this.minValue) && this.minValue !== this.defaultMinValue; 27821 }, 27822 IsMaxValueExists: function () { 27823 return ASPx.IsExists(this.maxValue) && !isNaN(this.maxValue) && this.maxValue !== this.defaultMaxValue; 27824 }, 27825 GetFormattedTextByValue: function(value) { 27826 if (this.minMaxValueFormatter) 27827 return this.minMaxValueFormatter.Format(value); 27828 return value; 27829 }, 27830 GetWarningText: function() { 27831 var textTemplate = arguments[0]; 27832 var valueTexts = []; 27833 for (var i = 1; i < arguments.length; i++) { 27834 var valueText = this.GetFormattedTextByValue(arguments[i]); 27835 valueTexts.push(valueText); 27836 } 27837 return ASPx.Formatter.Format(textTemplate, valueTexts); 27838 }, 27839 UpdateOutOfRangeWarningElementText: function () { 27840 var text = ""; 27841 if (this.IsMinValueExists() && this.IsMaxValueExists()) 27842 text = this.GetWarningText(this.editor.outOfRangeWarningMessages[0], this.minValue, this.maxValue); 27843 if (this.IsMinValueExists() && !this.IsMaxValueExists()) 27844 text = this.GetWarningText(this.editor.outOfRangeWarningMessages[1], this.minValue); 27845 if (!this.IsMinValueExists() && this.IsMaxValueExists()) 27846 text = this.GetWarningText(this.editor.outOfRangeWarningMessages[2], this.maxValue); 27847 ASPx.SetInnerHtml(this.outOfRangeWarningElement, "<LABEL>" + text + "</LABEL>"); 27848 }, 27849 UpdateOutOfRangeWarningElementVisibility: function (currentValue) { 27850 var isValidValue = currentValue == null || this.IsValueInRange(currentValue); 27851 if (!isValidValue && !this.outOfRangeWarningElementShown) 27852 this.ShowOutOfRangeWarningElement(); 27853 if (isValidValue && this.outOfRangeWarningElementShown) 27854 this.HideOutOfRangeWarningElement(); 27855 }, 27856 GetOutOfRangeWarningElementCoordinates: function() { 27857 var editorMainElement = this.editor.GetMainElement(); 27858 var editorWidth = editorMainElement.offsetWidth; 27859 var editorHeight = editorMainElement.offsetHeight; 27860 var editorX = ASPx.GetAbsoluteX(editorMainElement); 27861 var editorY = ASPx.GetAbsoluteY(editorMainElement); 27862 var outOfRangeWarningElementX = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorX + editorWidth : editorX; 27863 var outOfRangeWarningElementY = this.outOfRangeWarningElementPosition === ASPx.Position.Right ? editorY : editorY + editorHeight; 27864 outOfRangeWarningElementX = outOfRangeWarningElementX < 0 ? 0 : outOfRangeWarningElementX; 27865 outOfRangeWarningElementY = outOfRangeWarningElementY < 0 ? 0 : outOfRangeWarningElementY; 27866 return { 27867 x: outOfRangeWarningElementX, 27868 y: outOfRangeWarningElementY 27869 }; 27870 }, 27871 ShowOutOfRangeWarningElement: function () { 27872 this.outOfRangeWarningElement.style.display = "inline"; 27873 var outOfRangeWarningElementCoordinates = this.GetOutOfRangeWarningElementCoordinates(); 27874 ASPx.SetAbsoluteX(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.x); 27875 ASPx.SetAbsoluteY(this.outOfRangeWarningElement, outOfRangeWarningElementCoordinates.y); 27876 ASPx.AnimationHelper.fadeIn(this.outOfRangeWarningElement, null, this.animationDuration); 27877 this.ScrollToWarningElementIfRequired(outOfRangeWarningElementCoordinates); 27878 this.outOfRangeWarningElementShown = true; 27879 }, 27880 HideOutOfRangeWarningElement: function () { 27881 ASPx.AnimationHelper.fadeOut(this.outOfRangeWarningElement, function () { 27882 ASPx.SetElementDisplay(this.outOfRangeWarningElement, false); 27883 }.aspxBind(this), this.animationDuration); 27884 this.outOfRangeWarningElementShown = false; 27885 }, 27886 ScrollToWarningElementIfRequired: function (outOfRangeWarningElementCoordinates) { 27887 if(this.outOfRangeWarningElementPosition === ASPx.Position.Right) { 27888 var warnElementRightPos = outOfRangeWarningElementCoordinates.x 27889 + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginLeft) 27890 + this.outOfRangeWarningElement.offsetWidth; 27891 if(warnElementRightPos > ASPx.GetDocumentClientWidth() + ASPx.GetDocumentScrollLeft()) 27892 ASPx.SetDocumentScrollLeft(warnElementRightPos - ASPx.GetDocumentClientWidth()); 27893 } 27894 if(this.outOfRangeWarningElementPosition === ASPx.Position.Bottom) { 27895 var warnElementBottomPos = outOfRangeWarningElementCoordinates.y 27896 + ASPx.PxToInt(ASPx.GetCurrentStyle(this.outOfRangeWarningElement).marginTop) 27897 + this.outOfRangeWarningElement.offsetHeight; 27898 if(warnElementBottomPos > ASPx.GetDocumentClientHeight() + ASPx.GetDocumentScrollTop()) 27899 ASPx.SetDocumentScrollTop(warnElementBottomPos - ASPx.GetDocumentClientHeight()); 27900 } 27901 } 27902}); 27903ASPx.MMMouseOut = function(name, evt) { 27904 var edit = ASPx.GetControlCollection().Get(name);
27905 if(edit != null) edit.OnMouseOut(evt); 27906}; 27907ASPx.MMMouseOver = function(name, evt) { 27908 var edit = ASPx.GetControlCollection().Get(name); 27909 if(edit != null) edit.OnMouseOver(evt); 27910}; 27911ASPx.MaskHintTimerProc = function() { 27912 var focusedEditor = ASPx.GetFocusedEditor(); 27913 if(focusedEditor != null && ASPx.IsFunction(focusedEditor.MaskHintTimerProc)) 27914 focusedEditor.MaskHintTimerProc(); 27915}; 27916ASPx.ETextChanged = function(name) { 27917 var edit = ASPx.GetControlCollection().Get(name); 27918 if(edit != null) edit.OnTextChanged(); 27919}; 27920ASPx.BEClick = function(name,number){ 27921 var edit = ASPx.GetControlCollection().Get(name); 27922 if(edit != null) edit.OnButtonClick(number); 27923}; 27924ASPx.BEClear = function(name, evt) { 27925 var edit = ASPx.GetControlCollection().Get(name); 27926 if(edit && (evt.button === 0 || ASPx.Browser.TouchUI)) 27927 edit.onClearButtonClick(); 27928}; 27929ASPx.SetFocusToTextEditWithDelay = function(name) { 27930 window.setTimeout(function() { 27931 var edit = ASPx.GetControlCollection().Get(name); 27932 if(edit) 27933 edit.SetFocus(); 27934 }, 500); 27935}; 27936window.ASPxClientTextEdit = ASPxClientTextEdit; 27937window.ASPxClientTextBoxBase = ASPxClientTextBoxBase; 27938window.ASPxClientTextBox = ASPxClientTextBox; 27939window.ASPxClientMemo = ASPxClientMemo; 27940window.ASPxClientButtonEditBase = ASPxClientButtonEditBase; 27941window.ASPxClientButtonEdit = ASPxClientButtonEdit; 27942window.ASPxClientButtonEditClickEventArgs = ASPxClientButtonEditClickEventArgs; 27943})(); 27944 27945(function() { 27946var MaskPartBase = ASPx.CreateClass(null, { 27947 typeCode: 1, 27948 constructor: function() { 27949 this.valueInitialized = false; 27950 this.dateTimeRole = null; 27951 }, 27952 Grow: function(text) { 27953 throw "Not supported"; 27954 }, 27955 GetSize: function() { 27956 throw "Not supported"; 27957 }, 27958 GetValue: function() { 27959 this.EnsureValueInitialized(); 27960 return this.GetValueCore(); 27961 }, 27962 EnsureValueInitialized: function() { 27963 if(this.valueInitialized) return; 27964 this.InitValue(); 27965 this.valueInitialized = true; 27966 }, 27967 InitValue: function() { 27968 throw "Not supported"; 27969 }, 27970 GetValueCore: function() { 27971 throw "Not supported"; 27972 }, 27973 Clear: function(startPos, endPos) { 27974 }, 27975 HandleKey: function(maskInfo, keyInfo, pos) { 27976 throw "Not supported"; 27977 }, 27978 HandleControlKey: function(maskInfo, keyInfo, pos) { 27979 switch(keyInfo.keyCode) { 27980 case ASPx.Key.Left: 27981 if(keyInfo.ctrlState) 27982 maskInfo.MoveToPrevNonLiteral(); 27983 else 27984 maskInfo.IncCaretPos(-1); 27985 break; 27986 case ASPx.Key.Right: 27987 if(keyInfo.ctrlState) 27988 maskInfo.MoveToNextNonLiteral(); 27989 else 27990 maskInfo.IncCaretPos(1); 27991 break; 27992 } 27993 }, 27994 HandleMouseWheel: function(maskInfo, delta, pos) { 27995 }, 27996 AllowIncreaseSize: function() { 27997 return false; 27998 }, 27999 SupportsUpDown: function() { 28000 return false; 28001 }, 28002 IsValid: function() { 28003 return true; 28004 }, 28005 GetHintHtml: function() { 28006 return ""; 28007 }, 28008 IsEmpty: function() { return true; } 28009}); 28010var LiteralMaskPart = ASPx.CreateClass(MaskPartBase, { 28011 typeCode: 2, 28012 constructor: function(useInvariantCultureDecimalSymbol) { 28013 this.constructor.prototype.constructor.call(this); 28014 this.literal = ""; 28015 this.useInvariantCultureDecimalSymbol = useInvariantCultureDecimalSymbol; 28016 }, 28017 Grow: function(text) { 28018 this.literal += text; 28019 }, 28020 GetSize: function() { 28021 return this.literal.length; 28022 }, 28023 InitValue: function() { 28024 }, 28025 GetValueCore: function() { 28026 return this.literal; 28027 }, 28028 HandleKey: function(maskInfo, keyInfo, pos) { 28029 if(keyInfo.keyCode == 32){ 28030 maskInfo.IncCaretPos(); 28031 return true; 28032 } 28033 var ch = String.fromCharCode(keyInfo.keyCode).toLowerCase(); 28034 var index = this.GetValue().toLowerCase().indexOf(ch, pos); 28035 if(index > -1){ 28036 maskInfo.IncCaretPos(index - pos + 1); 28037 return true; 28038 } 28039 maskInfo.IncCaretPos(); 28040 return false; 28041 }, 28042 HandleControlKey: function(maskInfo, keyInfo, pos) { 28043 switch(keyInfo.keyCode) { 28044 case ASPx.Key.Right: 28045 case ASPx.Key.Delete: 28046 maskInfo.IncCaretPos(this.GetSize() - pos); 28047 break; 28048 case ASPx.Key.Left: 28049 case ASPx.Key.Backspace: 28050 maskInfo.IncCaretPos(-pos); 28051 break; 28052 default: 28053 MaskPartBase.prototype.HandleControlKey.call(this, maskInfo, keyInfo, pos); 28054 } 28055 } 28056}); 28057var EnumMaskPart = ASPx.CreateClass(MaskPartBase, { 28058 typeCode: 3, 28059 constructor: function(items, defaultItemIndex) { 28060 this.constructor.prototype.constructor.call(this); 28061 this.items = []; 28062 this.itemIndex = 0; 28063 this.defaultItemIndex = defaultItemIndex || 0; 28064 this.PrepareItems(items); 28065 }, 28066 PrepareItems: function(items){ 28067 var hash = {}; 28068 for(var i = 0; i < items.length; i++){ 28069 var item = String(items[i]); 28070 if(item.length > 0 && (!ASPx.IsExists(hash[item]) || i == this.defaultItemIndex)){ 28071 this.items.push(item); 28072 hash[item] = 1; 28073 } 28074 } 28075 }, 28076 GetSize: function() { 28077 return this.GetValue().length; 28078 }, 28079 InitValue: function() { 28080 this.itemIndex = this.defaultItemIndex; 28081 }, 28082 GetValueCore: function() { 28083 return this.items[this.itemIndex]; 28084 }, 28085 Clear: function(startPos, endPos) { 28086 this.ClearInternal(startPos); 28087 }, 28088 ClearInternal: function(pos) { 28089 var prefix = this.GetValue().substr(0, pos); 28090 if(prefix.length < 1) { 28091 this.itemIndex = this.defaultItemIndex; 28092 } else { 28093 this.itemIndex = this.FindItemIndexByPrefix(prefix); 28094 } 28095 }, 28096 HandleKey: function(maskInfo, keyInfo, pos) { 28097 var ch = String.fromCharCode(keyInfo.keyCode); 28098 var prefix = this.GetValue().substr(0, pos) + ch; 28099 var index = this.FindItemIndexByPrefix(prefix); 28100 var offset = (index < 0 || this.GetSize() > prefix.length ? this.GetSize() : prefix.length) - pos; 28101 if(index < 0 && (ch != " " || offset == 0)) { 28102 maskInfo.SetCaret(maskInfo.caretPos, offset); 28103 return false; 28104 } 28105 if(index > -1) 28106 this.itemIndex = index; 28107 maskInfo.SetCaret(1 + maskInfo.caretPos, offset - 1); 28108 return true; 28109 }, 28110 HandleControlKey: function(maskInfo, keyInfo, pos) { 28111 switch(keyInfo.keyCode) { 28112 case ASPx.Key.Up: 28113 this.ChangeItemIndex(maskInfo, this.dateTimeRole != null ? 1 : -1, pos); 28114 break; 28115 case ASPx.Key.Down: 28116 this.ChangeItemIndex(maskInfo, this.dateTimeRole != null ? -1 : 1, pos); 28117 break; 28118 case ASPx.Key.Backspace: 28119 if(keyInfo.ctrlState){ 28120 this.itemIndex = this.defaultItemIndex; 28121 maskInfo.IncCaretPos(-pos); 28122 } 28123 else { 28124 this.ClearInternal(pos - 1); 28125 maskInfo.SetCaret(maskInfo.caretPos - 1, 0); 28126 } 28127 break; 28128 case ASPx.Key.Delete: 28129 if(keyInfo.ctrlState){ 28130 this.itemIndex = this.defaultItemIndex; 28131 maskInfo.IncCaretPos(this.GetSize() - pos); 28132 } 28133 else { 28134 this.ClearInternal(pos); 28135 maskInfo.SetCaret(maskInfo.caretPos + 1, 0); 28136 } 28137 break; 28138 default: 28139 MaskPartBase.prototype.HandleControlKey.call(this, maskInfo, keyInfo, pos); 28140 } 28141 }, 28142 HandleMouseWheel: function(maskInfo, delta, pos) { 28143 if(this.dateTimeRole == null) 28144 delta = -delta; 28145 this.ChangeItemIndex(maskInfo, delta, pos); 28146 }, 28147 ChangeItemIndex: function(maskInfo, delta, pos) { 28148 this.itemIndex += delta; 28149 while(this.itemIndex < 0) 28150 this.itemIndex += this.items.length; 28151 while(this.itemIndex > this.items.length - 1) 28152 this.itemIndex -= this.items.length; 28153 maskInfo.SetCaret(maskInfo.caretPos - pos, this.GetSize()); 28154 }, 28155 FindItemIndexByPrefix: function(prefix) { 28156 prefix = prefix.toLowerCase(); 28157 for(var i = 0; i < this.items.length; i++) { 28158 var item = this.items[i]; 28159 if(item.toLowerCase().indexOf(prefix) == 0) 28160 return i; 28161 } 28162 return -1; 28163 }, 28164 SupportsUpDown: function() { 28165 return true; 28166 }, 28167 GetHintHtml: function() { 28168 if(this.dateTimeRole != null) 28169 return ""; 28170 var list = []; 28171 for(var i = 0; i < this.items.length; i++) { 28172 var text = this.items[i]; 28173 if(i == this.itemIndex) 28174 text = "<strong>
28174" + text + "</strong>"; 28175 list.push(text); 28176 } 28177 return list.join(", "); 28178 }, 28179 AllowIncreaseSize: function() { 28180 var value = this.GetValue(); 28181 if(value) { 28182 for (var i = 0; i < this.items.length; i++) 28183 if(this.items[i].length > value.length) 28184 return true; 28185 } 28186 return false; 28187 }, 28188 IsEmpty: function() { return false; } 28189}); 28190var RangeMaskPart = ASPx.CreateClass(MaskPartBase, { 28191 typeCode: 4, 28192 constructor: function(minNumber, maxNumber) { 28193 this.constructor.prototype.constructor.call(this); 28194 if(maxNumber < minNumber) 28195 maxNumber = minNumber; 28196 this.minNumber = minNumber; 28197 this.maxNumber = maxNumber; 28198 this.defaultNumber = null; 28199 this.zeroFill = false; 28200 this.absNumber = 0; 28201 this.negative = false; 28202 this.enableGroups = false; 28203 }, 28204 GetSize: function() { 28205 return this.GetValue().length; 28206 }, 28207 InitValue: function() { 28208 var number = 0; 28209 if(this.defaultNumber != null) 28210 number = this.defaultNumber; 28211 else { 28212 if(this.maxNumber < 0) 28213 number = this.maxNumber; 28214 else if(this.minNumber < 0) 28215 number = 0; 28216 else 28217 number = this.minNumber; 28218 } 28219 this.SetNumber(number); 28220 }, 28221 GetValueCore: function() { 28222 var value = String(this.absNumber); 28223 if(this.zeroFill) { 28224 var size = Math.max(this.minNumber.toString().length, this.maxNumber.toString().length); 28225 var incSize = size - value.length; 28226 for(var i = 0; i < incSize; i++) 28227 value = "0" + value; 28228 } 28229 if(this.enableGroups) 28230 value = this.AddGroupSeparators(value); 28231 if(this.negative) 28232 value = "-" + value; 28233 return value; 28234 }, 28235 AddGroupSeparators: function(text) { 28236 if(text.length < 4) 28237 return text; 28238 var temp = [ ]; 28239 var count = Math.ceil(text.length / 3); 28240 for(var i = 1; i < count; i++) 28241 temp.unshift(text.substr(text.length - i * 3, 3)); 28242 temp.unshift(text.substr(0, text.length % 3 || 3)); 28243 return temp.join(ASPx.CultureInfo.numGroupSeparator); 28244 }, 28245 IsGroupSeparatorPos: function(pos) { 28246 if(!this.enableGroups) 28247 return false; 28248 var reversePos = this.GetSize() - pos; 28249 return reversePos > 0 && reversePos % 4 == 0; 28250 }, 28251 GetNumber: function() { 28252 var result = this.absNumber; 28253 if(this.negative) 28254 result = -result; 28255 return result; 28256 }, 28257 SetNumber: function(number) { 28258 this.negative = (number < 0); 28259 this.absNumber = Math.abs(number); 28260 }, 28261 TextToNumber: function(text) { 28262 if(text == "" || text == "-") 28263 return 0; 28264 if(this.enableGroups) 28265 text = text.split(ASPx.CultureInfo.numGroupSeparator).join(""); 28266 return Number(text); 28267 }, 28268 SetText: function(text, checkMinNumber) { 28269 checkMinNumber = checkMinNumber || Math.abs(this.minNumber) < 2; 28270 var number = this.TextToNumber(text); 28271 if(number > this.maxNumber) { 28272 this.SetNumber(this.maxNumber); 28273 } else if(checkMinNumber && number < this.minNumber) { 28274 this.SetNumber(this.minNumber); 28275 } else { 28276 this.absNumber = Math.abs(number); 28277 this.negative = (text.indexOf("-") > -1); 28278 } 28279 }, 28280 Clear: function(startPos, endPos, ignoreZeroFill) { 28281 var value = this.GetValue(); 28282 var clearLength = endPos - startPos; 28283 var newText = ASPx.Str.InsertEx(value, this.zeroFill && !ignoreZeroFill ? new Array(clearLength + 1).join('0') : "", startPos, endPos); 28284 if(clearLength == value.length && this.defaultNumber !== null) 28285 this.SetNumber(this.defaultNumber); 28286 else 28287 this.SetText(newText, true); 28288 }, 28289 HandleKey: function(maskInfo, keyInfo, pos, isApi) { 28290 var keyCode = keyInfo.keyCode; 28291 var ch = String.fromCharCode(keyCode); 28292 var handled = false; 28293 if((ch == ASPx.CultureInfo.numGroupSeparator && this.IsGroupSeparatorPos(pos) 28294 || keyCode == 32) && pos < this.GetSize()) { 28295 maskInfo.IncCaretPos(); 28296 handled = true; 28297 } 28298 if(MaskManager.IsSignumCode(keyCode)) 28299 handled = this.HandleSignKey(maskInfo, ch, pos, isApi); 28300 if(MaskManager.IsDigitCode(keyCode)) { 28301 if(!this.zeroFill && ch == "0" && this.GetNumber() == 0 && pos > this.GetSize() - 1) 28302 handled = false; 28303 else { 28304 this.TryTypeAtPos(maskInfo, ch, pos, 1); 28305 handled = true; 28306 } 28307 } 28308 return handled; 28309 }, 28310 HandleSignKey: function(maskInfo, character, pos, isApi) { 28311 var handled = false; 28312 var isNegativeSignAllowed = character == "-" && this.minNumber < 0; 28313 var isSwitchingToPositiveNumber = character == "+" && this.GetNumber() < 0; 28314 if(isNegativeSignAllowed) 28315 handled = this.HandleSignKeyCore(maskInfo, pos, isApi, true); 28316 else if(isSwitchingToPositiveNumber) 28317 handled = this.HandleSignKeyCore(maskInfo, pos, isApi, false); 28318 return handled; 28319 }, 28320 HandleSignKeyCore: function(maskInfo, pos, isApi, isNegative) { 28321 var sign = isNegative ? -1 : 1; 28322 var newNumber = isApi ? sign * this.absNumber : -this.GetNumber(); 28323 if(!this.CheckRange(newNumber)) 28324 return false; 28325 if(isApi) 28326 this.negative = isNegative; 28327 else 28328 this.negative = !this.negative; 28329 var shiftCaretPosition = this.negative ? 1 : 0; 28330 maskInfo.SetCaret(maskInfo.caretPos - pos + shiftCaretPosition, 0); 28331 return true; 28332 }, 28333 HandleControlKey: function(maskInfo, keyInfo, pos) { 28334 switch(keyInfo.keyCode) { 28335 case ASPx.Key.Up: 28336 this.ChangeNumber(maskInfo, 1, pos); 28337 break; 28338 case ASPx.Key.Down: 28339 this.ChangeNumber(maskInfo, -1, pos); 28340 break; 28341 case ASPx.Key.Delete: 28342 if(keyInfo.ctrlState) { 28343 var newText = this.GetValue().substr(0, pos); 28344 this.SetText(newText, false); 28345 maskInfo.IncCaretPos(this.GetSize() - pos); 28346 } else { 28347 if(this.IsGroupSeparatorPos(pos)) { 28348 maskInfo.IncCaretPos(); 28349 } else { 28350 if(this.zeroFill) 28351 this.TryTypeAtPos(maskInfo, "0", pos, 1); 28352 else 28353 this.TryTypeAtPos(maskInfo, "", pos, 1); 28354 } 28355 } 28356 break; 28357 case ASPx.Key.Backspace: 28358 if(keyInfo.ctrlState) { 28359 var newText = this.GetValue().substr(pos); 28360 this.SetText(newText, false); 28361 maskInfo.IncCaretPos(-pos); 28362 } else { 28363 if(this.IsGroupSeparatorPos(pos - 1)) { 28364 maskInfo.IncCaretPos(-1); 28365 } else { 28366 if(this.zeroFill) 28367 this.TryTypeAtPos(maskInfo, "0", pos, -1); 28368 else 28369 this.TryTypeAtPos(maskInfo, "", pos, -1); 28370 } 28371 } 28372 break; 28373 default: 28374 MaskPartBase.prototype.HandleControlKey.call(this, maskInfo, keyInfo, pos); 28375 } 28376 }, 28377 HandleMouseWheel: function(maskInfo, delta, pos) { 28378 this.ChangeNumber(maskInfo, delta, pos); 28379 }, 28380 ChangeNumber: function(maskInfo, delta, pos) { 28381 var number = this.GetNumber(); 28382 if(number < this.minNumber) 28383 number = this.minNumber; 28384 var newNumber = number + delta; 28385 while(newNumber < this.minNumber) 28386 newNumber += 1 + this.maxNumber - this.minNumber; 28387 while(newNumber > this.maxNumber) 28388 newNumber -= 1 + this.maxNumber - this.minNumber; 28389 this.SetNumber(newNumber); 28390 maskInfo.SetCaret(maskInfo.caretPos - pos, this.GetSize()); 28391 }, 28392 CheckRange: function(number){
28393 return (this.minNumber <= number && number <= this.maxNumber); 28394 }, 28395 TryTypeAtPos: function(maskInfo, str, pos, dir) { 28396 if(dir > 0 && this.IsGroupSeparatorPos(pos)) { 28397 pos++; 28398 maskInfo.IncCaretPos(); 28399 } 28400 var oldSize = this.GetSize(); 28401 var strPos = pos; 28402 if(dir < 0) strPos -= 1; 28403 var newText = ASPx.Str.InsertEx(this.GetValue(), str, strPos, strPos + 1); 28404 if(this.dateTimeRole && dir > 0 && pos == 0 && /\d/.test(str) && !this.CheckRange(this.TextToNumber(newText))) { 28405 var number = Number(str); 28406 if(this.negative) 28407 number = -number; 28408 if(this.CheckRange(number) && this.IsMaxMagnitude(number)) { 28409 this.SetNumber(number); 28410 maskInfo.IncCaretPos(this.GetSize() - pos); 28411 return; 28412 } 28413 } 28414 var newPos; 28415 this.SetText(newText, false); 28416 if(dir > 0 && oldSize == pos) { 28417 newPos = this.GetSize(); 28418 } else { 28419 var diff = 0; 28420 if(!this.zeroFill) { 28421 diff = this.GetSize() - oldSize; 28422 if(dir < 0) diff += 1; 28423 if(diff > 0) diff = 0; 28424 } 28425 newPos = pos + dir + diff; 28426 } 28427 if(newPos < 0) newPos = 0; 28428 if(newPos > this.GetSize()) newPos = this.GetSize(); 28429 if(this.IsGroupSeparatorPos(newPos)) 28430 newPos++; 28431 maskInfo.IncCaretPos(newPos - pos); 28432 }, 28433 IsMaxMagnitude: function(number) { 28434 if(number < 0) 28435 return number * 10 < this.minNumber; 28436 return number * 10 > this.maxNumber; 28437 }, 28438 AllowIncreaseSize: function() { 28439 return !this.zeroFill && !this.IsMaxMagnitude(this.GetNumber()); 28440 }, 28441 SupportsUpDown: function() { 28442 return true; 28443 }, 28444 GetHintHtml: function() { 28445 if(this.dateTimeRole != null) 28446 return ""; 28447 return this.minNumber + ".." + this.maxNumber; 28448 }, 28449 IsEmpty: function() { return false; } 28450}); 28451var PromptMaskPart = ASPx.CreateClass(MaskPartBase, { 28452 typeCode: 5, 28453 constructor: function() { 28454 this.constructor.prototype.constructor.call(this); 28455 this.required = false; 28456 this.size = 0; 28457 this.text = ""; 28458 }, 28459 Grow: function(text) { 28460 this.size += text.length; 28461 }, 28462 GetSize: function() { 28463 return this.size; 28464 }, 28465 InitValue: function() { 28466 var size = this.GetSize(); 28467 for(var i = 0; i < size; i++) 28468 this.text += " "; 28469 }, 28470 GetValueCore: function() { 28471 return this.text; 28472 }, 28473 Clear: function(startPos, endPos){ 28474 this.ClearInternal(startPos, endPos - startPos); 28475 }, 28476 ClearInternal: function(pos, count){ 28477 for(var i = 0; i < count; i++) 28478 this.SetCharInPos(" ", i + pos); 28479 }, 28480 HandleKey: function(maskInfo, keyInfo, pos) { 28481 var keyCode = keyInfo.keyCode; 28482 if(maskInfo.IsPromptCode(keyCode)) 28483 keyCode = 32; 28484 if(keyCode != 32 && !this.IsValidCharCode(keyCode, pos)) 28485 return false; 28486 this.SetCharInPos(String.fromCharCode(keyCode), pos); 28487 maskInfo.IncCaretPos(); 28488 return true; 28489 }, 28490 HandleControlKey: function(maskInfo, keyInfo, pos) { 28491 switch(keyInfo.keyCode) { 28492 case ASPx.Key.Delete: 28493 var count = keyInfo.ctrlState ? this.GetSize() - pos : 1; 28494 this.ClearInternal(pos, count); 28495 maskInfo.IncCaretPos(count); 28496 break; 28497 case ASPx.Key.Backspace: 28498 var count = keyInfo.ctrlState ? pos : 1; 28499 this.ClearInternal(pos - count, count); 28500 maskInfo.IncCaretPos(-count); 28501 break; 28502 default: 28503 MaskPartBase.prototype.HandleControlKey.call(this, maskInfo, keyInfo, pos); 28504 } 28505 }, 28506 SetCharInPos: function(ch, pos) { 28507 this.text = ASPx.Str.InsertEx(this.GetValue(), ch, pos, pos + 1); 28508 }, 28509 IsValidCharCode: function(code, pos) { 28510 throw "Not supported"; 28511 }, 28512 IsValid: function() { 28513 if(!this.required) 28514 return true; 28515 return this.GetValue().indexOf(" ") < 0; 28516 }, 28517 IsEmpty: function() { 28518 return /^\s*$/.test(this.GetValue()); 28519 } 28520}); 28521var NumericMaskPart = ASPx.CreateClass(PromptMaskPart, { 28522 typeCode: 6, 28523 constructor: function() { 28524 this.constructor.prototype.constructor.call(this); 28525 this.acceptsSignum = false; 28526 }, 28527 IsValidCharCode: function(code, pos) { 28528 if(MaskManager.IsSignumCode(code)) { 28529 if(!this.acceptsSignum) return false; 28530 var value = this.GetValue(); 28531 for(var i = 0; i < pos; i++){ 28532 var currentCode = value.charCodeAt(i); 28533 if(MaskManager.IsDigitCode(currentCode) || MaskManager.IsSignumCode(currentCode)) 28534 return false; 28535 } 28536 return true; 28537 } 28538 return MaskManager.IsDigitCode(code); 28539 } 28540}); 28541var CharMaskPart = ASPx.CreateClass(PromptMaskPart, { 28542 typeCode: 7, 28543 constructor: function() { 28544 this.constructor.prototype.constructor.call(this); 28545 this.caseConvention = 0; 28546 }, 28547 SetCharInPos: function(ch, pos) { 28548 if(this.caseConvention < 0) 28549 ch = ch.toLowerCase(); 28550 if(this.caseConvention > 0) 28551 ch = ch.toUpperCase(); 28552 PromptMaskPart.prototype.SetCharInPos.call(this, ch, pos); 28553 }, 28554 IsValidCharCode: function(code, pos) { 28555 return code > 31; 28556 } 28557}); 28558var AlphaMaskPart = ASPx.CreateClass(CharMaskPart, { 28559 typeCode: 8, 28560 IsValidCharCode: function(code, pos) { 28561 return MaskManager.IsAlphaCode(code); 28562 } 28563}); 28564var AlphaNumericMaskPart = ASPx.CreateClass(CharMaskPart, { 28565 typeCode: 9, 28566 IsValidCharCode: function(code, pos) { 28567 return MaskManager.IsAlphaCode(code) || MaskManager.IsDigitCode(code); 28568 } 28569}); 28570var REGEX = {}; 28571REGEX.ENUM = { 28572 SYMBOL: { 28573 REGULAR: "[^|*<>]", 28574 REGULAR_ESCAPE_MODE: "[^|*<>\\\\'\"]", 28575 SLASH_ESCAPED: "\\\\." 28576 }, 28577 SEQUENCE: { 28578 APOSTROPHE_ESCAPED: "'[^']+'", 28579 QUOTES_ESCAPED: '"[^"]+"', 28580 } 28581}; 28582REGEX.ENUM.TOKEN = "\\*?(" + REGEX.ENUM.SYMBOL.REGULAR + ")*"; 28583REGEX.ENUM.TOKEN_ESCAPE_MODE = "\\*?(" + REGEX.ENUM.SYMBOL.SLASH_ESCAPED + "|" 28584 + REGEX.ENUM.SEQUENCE.QUOTES_ESCAPED + "|" 28585 + REGEX.ENUM.SEQUENCE.APOSTROPHE_ESCAPED + "|" 28586 + REGEX.ENUM.SYMBOL.REGULAR_ESCAPE_MODE + ")*"; 28587REGEX.ENUM.VALUE = "<" + REGEX.ENUM.TOKEN + "(\\|" + REGEX.ENUM.TOKEN + ")+>"; 28588REGEX.ENUM.VALUE_ESCAPE_MODE = "<" + REGEX.ENUM.TOKEN_ESCAPE_MODE + "(\\|" + REGEX.ENUM.TOKEN_ESCAPE_MODE + ")+>"; 28589REGEX.RANGE = "\\<-?\\d+(\\.\\.-?\\d+){1,2}g?\\>"; 28590REGEX.PROMPT = "[LlAaCc09#,.:/$<>~]"; 28591REGEX.DATE_TIME = "(y{1,4}|M{1,4}|d{1,4}|hh?|HH?|mm?|ss?|F{1,6}|f{1,6}|tt?)"; 28592MASK_PART_TYPE = { 28593 RANGE: 1, 28594 ENUM: 2, 28595 ENUM_ESCAPE_MODE: 4, 28596 DATE_TIME: 8, 28597}; 28598REGEX.BY_TYPE = {}; 28599REGEX.BY_TYPE[MASK_PART_TYPE.RANGE] = REGEX.RANGE; 28600REGEX.BY_TYPE[MASK_PART_TYPE.ENUM] = REGEX.ENUM.VALUE; 28601REGEX.BY_TYPE[MASK_PART_TYPE.ENUM_ESCAPE_MODE] = REGEX.ENUM.VALUE_ESCAPE_MODE; 28602REGEX.BY_TYPE[MASK_PART_TYPE.DATE_TIME] = REGEX.DATE_TIME; 28603var MaskParser = { 28604 Parse: function(mask, dateTimeOnly, allowEscapingInEnums, useInvariantCultureDecimalSymbol) { 28605 this.result = [ ]; 28606 this.currentCaseConvention = 0; 28607 this.quoteMode = null;
28608 this.dateTimeOnly = (dateTimeOnly === true); 28609 this.allowEscapingInEnums = allowEscapingInEnums; 28610 this.useInvariantCultureDecimalSymbol = useInvariantCultureDecimalSymbol; 28611 mask.replace(this.GetMasterRegex(), this.ParseCallback); 28612 return this.result; 28613 }, 28614 GetMasterRegex: function() { 28615 var masterRegexType = 1 * this.dateTimeOnly + 2 * this.allowEscapingInEnums; 28616 if(!this.__masterRegex) 28617 this.__masterRegex = []; 28618 if(!ASPx.IsExists(this.__masterRegex[masterRegexType])) { 28619 var pushIfNotOnlyDateTime = function(item) { if(!this.dateTimeOnly) list.push(item); }; 28620 var list = ["\\\\\\\\", "\\\\[\"']", "[\"']"]; 28621 pushIfNotOnlyDateTime(REGEX.RANGE); 28622 var enumRegex = this.allowEscapingInEnums ? REGEX.ENUM.VALUE_ESCAPE_MODE : REGEX.ENUM.VALUE; 28623 pushIfNotOnlyDateTime(enumRegex); 28624 list.push("\\\\" + REGEX.DATE_TIME); 28625 pushIfNotOnlyDateTime("\\\\" + REGEX.PROMPT); 28626 list.push(REGEX.DATE_TIME); 28627 pushIfNotOnlyDateTime(REGEX.PROMPT); 28628 list.push("."); 28629 this.__masterRegex[masterRegexType] = new RegExp("(" + list.join("|") + ")", "g"); 28630 } 28631 return this.__masterRegex[masterRegexType]; 28632 }, 28633 ParseCallback: function(text) { 28634 MaskParser.ParseCore(text, null); 28635 }, 28636 ParseCore: function(text, dateTimeRole) { 28637 var acceptRangesEnums = (dateTimeRole != null || !this.dateTimeOnly); 28638 if(text == "'" || text == '"') 28639 this.ParseQuote(text); 28640 else if(this.quoteMode != null) 28641 this.ParseLiteral(text); 28642 else if(acceptRangesEnums && MaskParser.MatchType(text, MASK_PART_TYPE.RANGE)) 28643 this.ParseRange(text, dateTimeRole); 28644 else if(acceptRangesEnums && MaskParser.MatchType(text, this.allowEscapingInEnums ? MASK_PART_TYPE.ENUM_ESCAPE_MODE : MASK_PART_TYPE.ENUM)) 28645 this.ParseEnum(text, dateTimeRole); 28646 else if(MaskParser.MatchType(text, MASK_PART_TYPE.DATE_TIME)) 28647 this.ParseDate(text); 28648 else 28649 this.ParseSimple(text); 28650 }, 28651 MatchType: function(text, type) { return MaskParser.GetAnchoredRegex(type).test(text); }, 28652 GetAnchoredRegex: function(type) { 28653 if(!this.__regex) 28654 this.__regex = []; 28655 if(!this.__regex[type]) 28656 this.__regex[type] = new RegExp("^" + REGEX.BY_TYPE[type] + "$"); 28657 return this.__regex[type]; 28658 }, 28659 ParseRange: function(text, dateTimeRole) { 28660 var enableGroups = false; 28661 text = this.StripBrockets(text); 28662 if(text.charAt(text.length - 1) == "g") { 28663 enableGroups = true; 28664 text = text.substr(0, text.length - 1); 28665 } 28666 var data = text.split(".."); 28667 var minNumber, maxNumber = 0; 28668 var defaultNumber = null; 28669 if(data.length == 2){ 28670 minNumber = Number(data[0]); 28671 maxNumber = Number(data[1]); 28672 } 28673 else if(data.length == 3){ 28674 minNumber = Number(data[0]); 28675 maxNumber = Number(data[2]); 28676 defaultNumber = Number(data[1]); 28677 } 28678 var part = new RangeMaskPart(minNumber, maxNumber); 28679 part.defaultNumber = defaultNumber; 28680 part.zeroFill = (data[0] == "00") || (data[0].length > 1 && data[0].charAt(0) == "0"); 28681 part.dateTimeRole = dateTimeRole; 28682 part.enableGroups = enableGroups; 28683 this.result.push(part); 28684 }, 28685 ParseEnum: function(text, dateTimeRole) { 28686 var delimReplaceGuid = "2c15b016-6e77-4f62-830a-28569118a972"; 28687 var delimRegex = new RegExp(delimReplaceGuid, "g"); 28688 var defaultItemIndex; 28689 text = MaskParser.StripBrockets(text); 28690 if(this.allowEscapingInEnums) { 28691 var escapeWithSlash = function(str) { return str.replace(/./g, "\\$&"); }; 28692 var quoteOrApostropheEscapedRegex = new RegExp("(" + REGEX.ENUM.SEQUENCE.APOSTROPHE_ESCAPED + "|" + REGEX.ENUM.SEQUENCE.QUOTES_ESCAPED + ")", "g"); 28693 text = text.replace(quoteOrApostropheEscapedRegex, function(str) { return escapeWithSlash(MaskParser.StripBrockets(str)); }) 28694 .replace(/\\\|/g, delimReplaceGuid); 28695 } 28696 var enumTokens = text.split("|"); 28697 enumTokens = enumTokens.map(function(enumToken, index) { 28698 if(/^\*/.test(enumToken)) 28699 defaultItemIndex = index; 28700 return enumToken.replace(/^\*/, ""); 28701 }); 28702 if(this.allowEscapingInEnums) { 28703 enumTokens = enumTokens.map(function(enumToken) { 28704 return enumToken 28705 .replace(delimRegex, "|") 28706 .replace(/\\(.)/g, "$1"); 28707 }); 28708 } 28709 var part = new EnumMaskPart(enumTokens, defaultItemIndex); 28710 part.dateTimeRole = dateTimeRole; 28711 this.result.push(part); 28712 }, 28713 StripBrockets: function(text) { 28714 return text.substr(1, text.length - 2); 28715 }, 28716 ParseSimple: function(text) { 28717 switch(text) { 28718 case ":": 28719 this.ParseLiteral(ASPx.CultureInfo.ts); 28720 break; 28721 case "/": 28722 this.ParseLiteral(ASPx.CultureInfo.ds); 28723 break; 28724 default: 28725 if(this.dateTimeOnly) { 28726 this.ParseLiteral(text); 28727 } else { 28728 switch(text) { 28729 case "L": 28730 case "l": 28731 this.ParseChar(text, AlphaMaskPart, text == "L"); 28732 break; 28733 case "A": 28734 case "a": 28735 this.ParseChar(text, AlphaNumericMaskPart, text == "A"); 28736 break; 28737 case "C": 28738 case "c": 28739 this.ParseChar(text, CharMaskPart, text == "C"); 28740 break; 28741 case ">": 28742 this.currentCaseConvention = 1; 28743 break; 28744 case "<": 28745 this.currentCaseConvention = -1; 28746 break; 28747 case "~": 28748 this.currentCaseConvention = 0; 28749 break; 28750 case "0": 28751 case "9": 28752 case "#": 28753 this.ParseNumeric(text); 28754 break; 28755 case ".": 28756 this.ParseLiteral(ASPx.CultureInfo.numDecimalPoint, this.useInvariantCultureDecimalSymbol); 28757 break; 28758 case ",": 28759 this.ParseLiteral(ASPx.CultureInfo.numGroupSeparator); 28760 break; 28761 case "$": 28762 this.ParseLiteral(ASPx.CultureInfo.currency); 28763 break; 28764 default: 28765 this.ParseLiteral(text); 28766 break; 28767 } 28768 } 28769 break; 28770 } 28771 }, 28772 ParseChar: function(text, ctor, required) { 28773 var part = this.GetCurrentPart(); 28774 if(part == null || part.typeCode != ctor.prototype.typeCode || part.required != required || part.caseConvention != this.currentCaseConvention) { 28775 part = new ctor(); 28776 part.required = required; 28777 part.caseConvention = this.currentCaseConvention; 28778 this.result.push(part); 28779 } 28780 part.Grow(text); 28781 }, 28782 ParseNumeric: function(text) { 28783 var required = text == "0"; 28784 var acceptsSignum = text == "#"; 28785 var part = this.GetCurrentPart(); 28786 if(part == null || part.typeCode != NumericMaskPart.prototype.typeCode || part.required != required || part.acceptsSignum != acceptsSignum) { 28787 part = new NumericMaskPart(); 28788 part.required = required; 28789 part.acceptsSignum = acceptsSignum; 28790 this.result.push(part); 28791 } 28792 part.Grow(text); 28793 }, 28794 ParseLiteral: function(text, useInvariantCultureDecimalSymbol) { 28795 var part = this.GetCurrentPart(); 28796 if(part == null || part.typeCode != LiteralMaskPart.prototype.typeCode) { 28797 part = new LiteralMaskPart(useInvariantCultureDecimalSymbol); 28798 this.result.push(part); 28799 } 28800 if(text.length > 0 && text.charAt(0) == "\\") 28801 text = text.substr(1); 28802 part.Grow(text); 28803 }, 28804 GetCurrentPart: function() { 28805 var len = this.result.length; 28806 if(len < 1) 28807 return null; 28808 return this.result[len - 1]; 28809 }, 28810 ParseDate: function(text) { 28811 this.ParseCore(this.GetDateSpecifierReplacement(text), this.GetDateTimeRole(text)); 28812 }, 28813 GetDateSpecifierReplacement: function(text) { 28814 switch(text) { 28815 case "yyyy": 28816 return "<0100..9999>"; 28817 case "yyy": 28818 return "<100..9999>"; 28819 case "yy": 28820 return "<00..99>"; 28821 case "y": 28822 return "<0..99>"; 28823 case "MMMM": 28824 return "<" + ASPx.CultureInfo.genMonthNames.join("|") + ">"; 28825 case "MMM": 28826 return "<" + ASPx.CultureInfo.abbrMonthNames.join("|") + ">"; 28827 case "MM": 28828 return "<01..12>"; 28829 case "M": 28830 return "<1..12>"; 28831 case "dddd": 28832 return "<" + ASPx.CultureInfo.dayNames.join("|") + ">"; 28833 case "ddd": 28834 return "<" + ASPx.CultureInfo.abbrDayNames.join("|") + ">"; 28835 case "dd": 28836 return "<01..31>"; 28837 case "d": 28838 return "<1..31>"; 28839 case "hh": 28840 return "<01..12..12>"; 28841 case "h": 28842 return "<1..12..12>"; 28843 case "HH": 28844 return "<00..23>"; 28845 case "H": 28846 return "<0..23>"; 28847 case "mm": 28848 return "<00..59>"; 28849 case "m": 28850 return "<0..59>"; 28851 case "ss": 28852 return "<00..59>"; 28853 case "s": 28854 return "<0..59>"; 28855 case "tt": 28856 case "t": 28857 if(ASPx.CultureInfo.am.length < 1) 28858 return ""; 28859 return "<" + this.GetAmPmArray(text.length < 2).join("|") + ">"; 28860 } 28861 if(/^f{1,6}$/i.test(text)) { 28862 if(text.length == 1) 28863 return "<0..9>"; 28864 if(text.length == 2) 28865 return "<0..99>"; 28866 return "<0..999>"; 28867 } 28868 throw "Not supported"; 28869 }, 28870 GetDateTimeRole: function(text) { 28871 var ch = text.charAt(0);
28872 if(ch == "y" || ch == "M" || ch =="d" 28873 || ch.toLowerCase() == "h" || ch == "m" || ch == "s" 28874 || ch.toLowerCase() == "f" || ch == "t") 28875 return ch; 28876 return null; 28877 }, 28878 GetAmPmArray: function(useFirstChar){ 28879 var result = [ ASPx.CultureInfo.am, ASPx.CultureInfo.pm ]; 28880 if(useFirstChar) { 28881 for(var i = 0; i < result.length; i++) 28882 result[i] = result[i].charAt(0); 28883 } 28884 return result; 28885 }, 28886 ParseQuote: function(text) { 28887 if(this.quoteMode == null) { 28888 this.quoteMode = text; 28889 } else { 28890 if(text == this.quoteMode) 28891 this.quoteMode = null; 28892 else 28893 this.ParseLiteral(text); 28894 } 28895 } 28896}; 28897var MaskIncludeLiterals = { 28898 All: 1, 28899 None: 2, 28900 DecimalSymbol: 3 28901}; 28902var MaskInfo = ASPx.CreateClass(null, { 28903 constructor: function() { 28904 this.parts = null; 28905 this.allowMouseWheel = true; 28906 this.promptChar = "_"; 28907 this.includeLiterals = MaskIncludeLiterals.All; 28908 this.useInvariantCultureDecimalSymbol = false; 28909 this.errorText = ""; 28910 this.caretPos = 0; 28911 this.selectionLength = 0; 28912 this.lastEditedPart = null; 28913 }, 28914 GetSize: function() { 28915 var size = 0; 28916 for(var i = 0; i < this.parts.length; i++) 28917 size += this.parts[i].GetSize(); 28918 return size; 28919 }, 28920 GetText: function() { 28921 var result = ""; 28922 for(var i = 0; i < this.parts.length; i++) { 28923 var part = this.parts[i]; 28924 if(MaskManager.IsLiteralPart(part) || MaskManager.IsEnumPart(part)) 28925 result += part.GetValue(); 28926 else 28927 result += part.GetValue().split(" ").join(this.promptChar); 28928 } 28929 return result; 28930 }, 28931 GetValue: function(ignoreInvariantCultureDecimalPoint) { 28932 var list = []; 28933 var hasNonEmptyValue = false; 28934 var canPartReturnNull = false; 28935 var canPartReturnNullConstValue = true; 28936 for(var i = this.parts.length - 1; i >= 0; i--) { 28937 var part = this.parts[i]; 28938 if(part.typeCode < PromptMaskPart.prototype.typeCode && 28939 (this.includeLiterals == MaskIncludeLiterals.All || part.typeCode != LiteralMaskPart.prototype.typeCode)) 28940 canPartReturnNullConstValue = false; 28941 canPartReturnNull = part.typeCode >= PromptMaskPart.prototype.typeCode ? canPartReturnNullConstValue : false; 28942 var partValue = part.GetValue(); 28943 if(MaskManager.IsLiteralPart(part) && MaskManager.IsIgnorableLiteral(partValue, this.includeLiterals)) 28944 continue; 28945 if(MaskManager.IsRangePart(part) && this.includeLiterals != MaskIncludeLiterals.All) 28946 partValue = partValue.split(ASPx.CultureInfo.numGroupSeparator).join(""); 28947 var valueToAdd; 28948 if(canPartReturnNull && !hasNonEmptyValue) 28949 valueToAdd = ASPx.Str.TrimEnd(partValue); 28950 else 28951 valueToAdd = part.useInvariantCultureDecimalSymbol && !ignoreInvariantCultureDecimalPoint ? ASPx.CultureInfo.invariantCultureDecimalPoint : partValue; 28952 list.unshift(valueToAdd); 28953 hasNonEmptyValue = hasNonEmptyValue || !!ASPx.Str.TrimEnd(valueToAdd); 28954 } 28955 return list.join(""); 28956 }, 28957 SetText: function(text) { 28958 this.Clear(); 28959 this.SetCaret(0, 0); 28960 this.SetValueCore(text, MaskIncludeLiterals.All); 28961 this.SetCaret(0, 0); 28962 }, 28963 SetValue: function(value) { 28964 this.Clear(); 28965 this.SetCaret(0, 0); 28966 this.SetValueCore(value, this.includeLiterals); 28967 this.SetCaret(0, 0); 28968 }, 28969 SetValueCore: function(value, includeLiterals) { 28970 if(value == null) return; 28971 for(var i = 0; i < value.length; i++) { 28972 var keyInfo = MaskManager.CreateKeyInfo(value.charCodeAt(i), false, false); 28973 MaskManager.HandleKey(this, keyInfo, false, includeLiterals, true); 28974 } 28975 }, 28976 Clear: function() { 28977 for(var i = 0; i < this.parts.length; i++) { 28978 var part = this.parts[i]; 28979 part.Clear(0, part.GetSize()); 28980 } 28981 }, 28982 ProcessPaste: function(rawText, caretPosAfterPaste) { 28983 var currentText = this.GetText(); 28984 if (caretPosAfterPaste === rawText.length) { 28985 this.Clear(); 28986 this.SetCaret(0, 0); 28987 this.SetValueCore(rawText, this.includeLiterals); 28988 } else { 28989 var leadLength = 0; 28990 for (var i = 0; i < Math.min(rawText.length, currentText.length); i++) { 28991 if (rawText.charAt(i) != currentText.charAt(i)) 28992 break; 28993 leadLength++; 28994 } 28995 var pastedText = rawText.substr(leadLength, caretPosAfterPaste - leadLength); 28996 this.SetCaret(caretPosAfterPaste - pastedText.length, 0); 28997 var padLength = 0; 28998 for (var i = pastedText.length + rawText.length; i < currentText.length; i++) { 28999 pastedText += " "; 29000 padLength++; 29001 } 29002 this.SetValueCore(pastedText, MaskIncludeLiterals.All); 29003 this.caretPos -= padLength; 29004 } 29005 }, 29006 IsValid: function() { 29007 for(var i = 0; i < this.parts.length; i++) { 29008 if(!this.parts[i].IsValid()) 29009 return false; 29010 } 29011 return true; 29012 }, 29013 SetCaret: function(caretPos, selectionLength) { 29014 if(selectionLength < 0) throw "Internal Error"; 29015 this.caretPos = caretPos; 29016 this.selectionLength = selectionLength; 29017 }, 29018 IncCaretPos: function(delta) { 29019 if(!ASPx.IsExists(delta)) 29020 delta = 1; 29021 this.caretPos += delta; 29022 this.selectionLength = 0; 29023 }, 29024 MoveToPrevNonLiteral: function() { 29025 var partPos = 0; 29026 var resultPos = 0; 29027 for(var i = 0; i < this.parts.length; i++) { 29028 if(partPos >= this.caretPos) 29029 break; 29030 var part = this.parts[i];
29031 var nextPartPos = partPos + part.GetSize(); 29032 if(!MaskManager.IsLiteralPart(part)) 29033 resultPos = nextPartPos < this.caretPos ? nextPartPos : partPos; 29034 partPos = nextPartPos; 29035 } 29036 this.SetCaret(resultPos, 0); 29037 }, 29038 MoveToNextNonLiteral: function() { 29039 var partPos = 0; 29040 for(var i = 0; i < this.parts.length; i++) { 29041 var part = this.parts[i]; 29042 var nextPartPos = partPos + part.GetSize(); 29043 if(nextPartPos > this.caretPos && !MaskManager.IsLiteralPart(part)) { 29044 if(partPos <= this.caretPos) 29045 partPos = nextPartPos; 29046 break; 29047 } 29048 partPos = nextPartPos; 29049 } 29050 this.SetCaret(partPos, 0); 29051 }, 29052 IsPromptCode: function(code) { 29053 return (code == 32 || code == this.promptChar.charCodeAt(0)); 29054 }, 29055 BeforeChange: function(part) { 29056 this.ApplyFixes(part); 29057 this.lastEditedPart = part; 29058 part.EnsureValueInitialized(); 29059 }, 29060 AfterChange: function(part) { 29061 }, 29062 ApplyFixes: function(currentPart) { 29063 var result1 = this.FixLastRangePart(currentPart); 29064 var result2 = this.FixLastDatePart(currentPart); 29065 return result1 || result2; 29066 }, 29067 FixLastRangePart: function(currentPart) { 29068 var part = this.lastEditedPart; 29069 if(!part || part == currentPart || !MaskManager.IsRangePart(part)) 29070 return false; 29071 var number = part.GetNumber(); 29072 if(number >= part.minNumber) 29073 return false; 29074 var prevSize = part.GetSize(); 29075 part.SetNumber(part.minNumber); 29076 this.SetCaret(this.caretPos + part.GetSize() - prevSize, 0); 29077 return true; 29078 }, 29079 FixLastDatePart: function(currentPart) { 29080 var part = this.lastEditedPart; 29081 if(!part || part == currentPart || part.dateTimeRole == null) 29082 return false; 29083 var bag = MaskDateTimeHelper.GetDateBag(this); 29084 if(!bag.hasDate) 29085 return false; 29086 var maxDay = MaskDateTimeHelper.GetMaxDayInMonth(bag.month, bag.year); 29087 if(bag.day > maxDay) { 29088 if(bag.day == 29 && bag.month == 1) { 29089 bag.year = MaskDateTimeHelper.GetNextLeapYear(bag.year); 29090 } else { 29091 if(part.dateTimeRole == "d") 29092 bag.month--; 29093 else 29094 bag.day = maxDay; 29095 } 29096 } 29097 var prefixSize = this.GetSizeBeforeEditedPart(currentPart); 29098 MaskDateTimeHelper.SetDate(this, MaskDateTimeHelper.CreateDateFromBag(bag, true)); 29099 this.caretPos += this.GetSizeBeforeEditedPart(currentPart) - prefixSize; 29100 return true; 29101 }, 29102 GetSizeBeforeEditedPart: function(currentPart) { 29103 var pos = 0; 29104 for(var i = 0; i < this.parts.length; i++) { 29105 if(this.parts[i] == currentPart) 29106 break; 29107 pos += this.parts[i].GetSize(); 29108 } 29109 return pos; 29110 }, 29111 GetFirstNonLiteralPosition: function() { 29112 var position = 0; 29113 for (var i = 0, part; part = this.parts[i]; i++) { 29114 if (MaskManager.IsLiteralPart(part)) 29115 position += part.GetSize(); 29116 else 29117 break; 29118 } 29119 return position; 29120 }, 29121 IsEmpty: function() { 29122 for (var i = 0, part; part = this.parts[i]; i++) { 29123 if (!part.IsEmpty()) 29124 return false; 29125 } 29126 return true; 29127 } 29128}); 29129MaskInfo.Create = function(maskText, dateTimeOnly, allowEscapingInEnums, useInvariantCultureDecimalSymbol) { 29130 var info = new MaskInfo(); 29131 info.parts = MaskParser.Parse(maskText, dateTimeOnly, allowEscapingInEnums, useInvariantCultureDecimalSymbol); 29132 return info; 29133}; 29134var MaskManager = { 29135 OnKeyPress: function(maskInfo, keyInfo) { 29136 if(maskInfo.selectionLength > 0) 29137 this.ClearSelection(maskInfo); 29138 this.HandleKey(maskInfo, keyInfo, true, MaskIncludeLiterals.All); 29139 this.savedKeyDownKeyInfo = null; 29140 }, 29141 OnKeyDown: function(maskInfo, keyInfo) { 29142 if(maskInfo.selectionLength > 0 && (keyInfo.keyCode == ASPx.Key.Backspace || keyInfo.keyCode == ASPx.Key.Delete)) 29143 this.ClearSelection(maskInfo, true); 29144 else 29145 this.HandleControlKey(maskInfo, keyInfo); 29146 }, 29147 OnMouseWheel: function(maskInfo, delta) { 29148 if(maskInfo.allowMouseWheel) 29149 this.HandleMouseWheel(maskInfo, delta); 29150 }, 29151 HandleKey: function(maskInfo, keyInfo, autoSkipLiterals, includeLiterals, isApi) { 29152 var partStart = 0; 29153 var caretInfoBeforeSkip = null; 29154 for(var i = 0; i < maskInfo.parts.length; i++) { 29155 var part = maskInfo.parts[i]; 29156 if(this.IsCaretInPart(maskInfo.caretPos, partStart, part)) { 29157 if(!this.IsLiteralPart(part) || !this.IsIgnorableLiteral(part.GetValue(), includeLiterals)) { 29158 var savedCaretPos = maskInfo.caretPos; 29159 maskInfo.BeforeChange(part); 29160 partStart += maskInfo.caretPos - savedCaretPos; 29161 if(this.savedKeyDownKeyInfo && this.savedKeyDownKeyInfo.keyCode == ASPx.Key.Decimal) 29162 keyInfo.keyCode = ASPx.CultureInfo.numDecimalPoint.charCodeAt(0); 29163 if(part.HandleKey(maskInfo, keyInfo, maskInfo.caretPos - partStart, isApi)) { 29164 if(autoSkipLiterals) 29165 this.TrySkipLiteralOnPartEdge(maskInfo, partStart, i); 29166 maskInfo.AfterChange(part); 29167 return; 29168 } 29169 if(caretInfoBeforeSkip == null) 29170 caretInfoBeforeSkip = [ maskInfo.caretPos, maskInfo.selectionLength ]; 29171 } 29172 maskInfo.SetCaret(partStart + part.GetSize(), 0); 29173 } 29174 partStart += part.GetSize(); 29175 } 29176 if(caretInfoBeforeSkip != null) 29177 maskInfo.SetCaret(caretInfoBeforeSkip[0], caretInfoBeforeSkip[1]); 29178 }, 29179 HandleControlKey: function(maskInfo, keyInfo) { 29180 maskInfo.selectionLength = 0; 29181 var partStart = 0; 29182 for(var i = 0; i < maskInfo.parts.length; i++) { 29183 var part = maskInfo.parts[i];
29184 if(this.IsCaretInPartOnControlKey(maskInfo.caretPos, partStart, part, keyInfo.keyCode)) { 29185 var savedCaretPos = maskInfo.caretPos; 29186 maskInfo.BeforeChange(part); 29187 partStart += maskInfo.caretPos - savedCaretPos; 29188 part.HandleControlKey(maskInfo, keyInfo, maskInfo.caretPos - partStart); 29189 if(keyInfo.keyCode == ASPx.Key.Delete) 29190 this.TrySkipLiteralOnPartEdge(maskInfo, partStart, i); 29191 maskInfo.AfterChange(part); 29192 break; 29193 } 29194 partStart += part.GetSize(); 29195 } 29196 }, 29197 HandleMouseWheel: function(maskInfo, delta) { 29198 var partStart = 0; 29199 for(var i = 0; i < maskInfo.parts.length; i++) { 29200 var part = maskInfo.parts[i]; 29201 if(this.IsCaretInPartOnMouseWheel(maskInfo.caretPos, partStart, part)) { 29202 var savedCaretPos = maskInfo.caretPos; 29203 maskInfo.BeforeChange(part); 29204 partStart += maskInfo.caretPos - savedCaretPos; 29205 part.HandleMouseWheel(maskInfo, delta, maskInfo.caretPos - partStart); 29206 maskInfo.AfterChange(part); 29207 break; 29208 } 29209 partStart += part.GetSize(); 29210 } 29211 }, 29212 TrySkipLiteralOnPartEdge: function(maskInfo, partStartPos, partIndex) { 29213 var part = maskInfo.parts[partIndex]; 29214 var posInPart = maskInfo.caretPos - partStartPos; 29215 var amount = 0; 29216 if(part.AllowIncreaseSize()) return; 29217 if(partIndex > maskInfo.parts.length - 3 || posInPart < part.GetSize()) return; 29218 var sibling = maskInfo.parts[partIndex + 1]; 29219 if(this.IsLiteralPart(sibling)) 29220 amount = sibling.GetSize(); 29221 maskInfo.IncCaretPos(amount); 29222 maskInfo.ApplyFixes(sibling); 29223 }, 29224 ClearSelection: function(maskInfo, ignoreZeroFill){ 29225 var partStart = 0; 29226 for(var i = 0; i < maskInfo.parts.length; i++) { 29227 var part = maskInfo.parts[i]; 29228 var outerLeft = Math.min(partStart, maskInfo.caretPos); 29229 var outerRight = Math.max(partStart + part.GetSize(), maskInfo.caretPos + maskInfo.selectionLength); 29230 var size = part.GetSize(); 29231 if(size + maskInfo.selectionLength > outerRight - outerLeft){ 29232 var innerLeft = Math.max(partStart, maskInfo.caretPos); 29233 var innerRight = Math.min(partStart + size, maskInfo.caretPos + maskInfo.selectionLength); 29234 part.Clear(innerLeft - partStart, innerRight - partStart, ignoreZeroFill); 29235 maskInfo.selectionLength += part.GetSize() - size; 29236 } 29237 partStart += part.GetSize(); 29238 } 29239 maskInfo.selectionLength = 0; 29240 }, 29241 IsCaretInPart: function(caretPos, partStartPos, part) { 29242 if(caretPos < partStartPos) 29243 return false; 29244 var nextPartPos = partStartPos + part.GetSize(); 29245 if(caretPos > nextPartPos) 29246 return false; 29247 if(caretPos == nextPartPos) 29248 return part.AllowIncreaseSize(); 29249 return true; 29250 }, 29251 IsCaretInPartOnControlKey: function(caretPos, partStartPos, part, keyCode) { 29252 if(caretPos == partStartPos) { 29253 if(keyCode == ASPx.Key.Backspace || keyCode == ASPx.Key.Left) 29254 return false; 29255 return true; 29256 } 29257 var nextPartPos = partStartPos + part.GetSize(); 29258 if(partStartPos < caretPos && caretPos < nextPartPos) 29259 return true; 29260 if(caretPos == nextPartPos) { 29261 if(keyCode == ASPx.Key.Up || keyCode == ASPx.Key.Down) 29262 return part.SupportsUpDown(); 29263 if(keyCode == ASPx.Key.Backspace || keyCode == ASPx.Key.Left) 29264 return true; 29265 return false; 29266 } 29267 return false; 29268 }, 29269 IsCaretInPartOnMouseWheel: function(caretPos, partStartPos, part) { 29270 if(!part.SupportsUpDown()) 29271 return false; 29272 return caretPos >= partStartPos && caretPos <= partStartPos + part.GetSize(); 29273 }, 29274 GetHintHtml: function(maskInfo) { 29275 var pos = 0; 29276 for(var i = 0; i < maskInfo.parts.length; i++) { 29277 var part = maskInfo.parts[i]; 29278 if(this.IsCaretInPartOnMouseWheel(maskInfo.caretPos, pos, part)) 29279 return part.GetHintHtml(); 29280 pos += part.GetSize(); 29281 } 29282 return ""; 29283 }, 29284 CreateKeyInfo: function(keyCode, shiftState, ctrlState) { 29285 return { 29286 keyCode: keyCode, 29287 shiftState: shiftState, 29288 ctrlState: ctrlState 29289 }; 29290 }, 29291 CreateKeyInfoByEvent: function(evt) { 29292 return this.CreateKeyInfo(ASPx.Evt.GetKeyCode(evt), evt.shiftKey, evt.ctrlKey || ASPx.Browser.MacOSPlatform && evt.metaKey); 29293 }, 29294 IsLiteralPart: function(part) { 29295 return (part.typeCode == LiteralMaskPart.prototype.typeCode); 29296 }, 29297 IsEnumPart: function(part) { 29298 return (part.typeCode == EnumMaskPart.prototype.typeCode); 29299 }, 29300 IsRangePart: function(part) { 29301 return (part.typeCode == RangeMaskPart.prototype.typeCode); 29302 }, 29303 IsAlphaCode: function(code) { 29304 return (64 < code && code < 91 || 96 < code && code < 123 || code > 127); 29305 }, 29306 IsDigitCode: function(code) { 29307 return (47 < code && code < 58); 29308 }, 29309 IsSignumCode: function(code) { 29310 return (code == 43 || code == 45); 29311 }, 29312 CanHandleControlKey: function(keyInfo) { 29313 if(keyInfo.shiftState) 29314 return false; 29315 return keyInfo.keyCode == ASPx.Key.Up || keyInfo.keyCode == ASPx.Key.Down 29316 || keyInfo.keyCode == ASPx.Key.Left || keyInfo.keyCode == ASPx.Key.Right 29317 || keyInfo.keyCode == ASPx.Key.Backspace || keyInfo.keyCode == ASPx.Key.Delete; 29318 }, 29319 IsPrintableKeyCode: function(keyInfo) { 29320 if(keyInfo.ctrlState) 29321 return false; 29322 var code = keyInfo.keyCode; 29323 var isFFSignCode = ASPx.Browser.Firefox && (code == 173 || code == 61); 29324 return isFFSignCode || code == 32 29325 || (code >= 48 && code <= 57) 29326 || (code >= 65 && code <= 90) 29327 || (code >= 96 && code <= 107) 29328 || (code >= 109 && code <= 111) 29329 || (code >= 186 && code <= 192) 29330 || (code >= 219 && code <= 222); 29331 },
29332 IsIgnorableLiteral: function(text, mode) { 29333 if(mode == MaskIncludeLiterals.None) 29334 return true; 29335 if(mode == MaskIncludeLiterals.All) 29336 return false; 29337 return text != ASPx.CultureInfo.numDecimalPoint; 29338 } 29339}; 29340MaskManager.keyCancelled = false; 29341MaskManager.keyDownHandled = false; 29342MaskManager.savedKeyDownKeyInfo = null; 29343var MaskDateTimeHelper = { 29344 GetDate: function(maskInfo, etalonDate, ignoreHasDateParts) { 29345 return this.CreateDateFromBag(this.GetDateBag(maskInfo, etalonDate), !ignoreHasDateParts && this.HasDateParts(maskInfo)); 29346 }, 29347 GetDateBag: function(maskInfo, etalonDate) { 29348 var bag = { 29349 year: 100, 29350 month: 0, 29351 day: 1, 29352 hours: 0, 29353 min: 0, 29354 sec: 0, 29355 msec: 0, 29356 pm: false, 29357 hasAmPm: false, 29358 hasDate: false 29359 }; 29360 if(etalonDate) { 29361 bag.year = etalonDate.getFullYear(); 29362 bag.month = etalonDate.getMonth(); 29363 bag.day = etalonDate.getDate(); 29364 bag.hours = etalonDate.getHours(); 29365 bag.min = etalonDate.getMinutes(); 29366 bag.sec = etalonDate.getSeconds(); 29367 bag.msec = etalonDate.getMilliseconds(); 29368 } 29369 for(var i = 0; i < maskInfo.parts.length; i++) { 29370 var part = maskInfo.parts[i]; 29371 switch(part.dateTimeRole) { 29372 case "y": 29373 bag.year = Number(part.GetValue()); 29374 if(bag.year < 100) 29375 bag.year = ASPx.DateUtils.ExpandTwoDigitYear(bag.year); 29376 bag.hasDate = true; 29377 break; 29378 case "M": 29379 bag.month = MaskManager.IsEnumPart(part) ? part.itemIndex : Number(part.GetValue()) - 1; 29380 bag.hasDate = true; 29381 break; 29382 case "d": 29383 if(!MaskManager.IsEnumPart(part)) { 29384 bag.day = Number(part.GetValue()); 29385 bag.hasDate = true; 29386 } 29387 break; 29388 case "H": 29389 case "h": 29390 bag.hours = Number(part.GetValue()); 29391 break; 29392 case "m": 29393 bag.min = Number(part.GetValue()); 29394 break; 29395 case "s": 29396 bag.sec = Number(part.GetValue()); 29397 break; 29398 case "f": 29399 case "F": 29400 bag.msec = Number(part.GetValue()); 29401 break; 29402 case "t": 29403 bag.hasAmPm = true; 29404 bag.pm = MaskManager.IsEnumPart(part) && part.itemIndex > 0; 29405 break; 29406 } 29407 } 29408 if(bag.hasAmPm) { 29409 if(!bag.pm && bag.hours == 12) 29410 bag.hours = 0; 29411 if(bag.pm && bag.hours < 12) 29412 bag.hours += 12; 29413 } 29414 return bag; 29415 }, 29416 CreateDateFromBag: function(bag, allowNull) { 29417 if(allowNull) { 29418 if(bag.year == 100 && bag.month == 0 && bag.day == 1 29419 && bag.hours + bag.min + bag.sec + bag.msec == 0) 29420 return null; 29421 } 29422 var originDate = new Date(bag.year, bag.month, bag.day, bag.hours, bag.min, bag.sec, bag.msec); 29423 var neighborDate = new Date( 29424 bag.year, 29425 bag.month, 29426 originDate.getDate() > 1 ? bag.day - 1 : bag.day + 1, 29427 bag.hours, 29428 bag.min, 29429 bag.sec, 29430 bag.msec 29431 ); 29432 var isNeighborDateCorrectedByBrowser = neighborDate.getHours() != bag.hours; 29433 if(!isNeighborDateCorrectedByBrowser) 29434 ASPx.DateUtils.FixTimezoneGap(neighborDate, originDate); 29435 return originDate; 29436 }, 29437 GetMaxDayInMonth: function(month, year) { 29438 if(month == 1) 29439 return this.IsLeapYear(year) ? 29 : 28; 29440 if(month == 3 || month == 5 || month == 8 || month == 10) 29441 return 30; 29442 return 31; 29443 }, 29444 IsLeapYear: function(year) { 29445 if(year % 4 != 0) 29446 return false; 29447 if(year % 100 == 0) 29448 return year % 400 == 0; 29449 return true; 29450 }, 29451 GetNextLeapYear: function(year) { 29452 var result = 4 * (1 + Math.floor(year / 4)); 29453 if(!this.IsLeapYear(result)) 29454 result += 4; 29455 return result; 29456 }, 29457 SetDate: function(maskInfo, date) { 29458 if(date == null) 29459 date = new Date(100, 0, 1); 29460 for(var i = 0; i < maskInfo.parts.length; i++) { 29461 var part = maskInfo.parts[i]; 29462 part.EnsureValueInitialized(); 29463 switch(part.dateTimeRole) { 29464 case "y": 29465 this.SetYear(part, date); 29466 break; 29467 case "M": 29468 this.SetMonth(part, date); 29469 break; 29470 case "d": 29471 this.SetDay(part, date); 29472 break; 29473 case "h": 29474 this.SetHours(part, date, false); 29475 break; 29476 case "H": 29477 this.SetHours(part, date, true); 29478 break; 29479 case "m": 29480 this.SetMinutes(part, date); 29481 break; 29482 case "s": 29483 this.SetSeconds(part, date); 29484 break; 29485 case "f": 29486 case "F": 29487 this.SetMilliseconds(part, date); 29488 break; 29489 case "t": 29490 this.SetAmPm(part, date); 29491 break; 29492 } 29493 } 29494 }, 29495 SetYear: function(part, date) { 29496 if(!MaskManager.IsRangePart(part)) 29497 return; 29498 var value = date.getFullYear(); 29499 if(part.maxNumber < 100) 29500 value = value % 100; 29501 part.SetNumber(value); 29502 }, 29503 SetMonth: function(part, date) { 29504 if(MaskManager.IsRangePart(part)) 29505 part.SetNumber(1 + date.getMonth()); 29506 else if(MaskManager.IsEnumPart(part)) 29507 part.itemIndex = date.getMonth(); 29508 }, 29509 SetDay: function(part, date) { 29510 if(MaskManager.IsRangePart(part)) 29511 part.SetNumber(date.getDate()); 29512 else if(MaskManager.IsEnumPart(part)) 29513 part.itemIndex = date.getDay(); 29514 }, 29515 SetHours: function(part, date, full) { 29516 if(!MaskManager.IsRangePart(part)) 29517 return; 29518 var value = date.getHours(); 29519 if(!full) { 29520 value = value % 12; 29521 if(value == 0) 29522 value = 12; 29523 } 29524 part.SetNumber(value); 29525 }, 29526 SetMinutes: function(part, date) { 29527 if(!MaskManager.IsRangePart(part)) 29528 return; 29529 part.SetNumber(date.getMinutes()); 29530 }, 29531 SetSeconds: function(part, date) { 29532 if(!MaskManager.IsRangePart(part)) 29533 return; 29534 part.SetNumber(date.getSeconds()); 29535 }, 29536 SetMilliseconds: function(part, date) { 29537 if(!MaskManager.IsRangePart(part)) 29538 return; 29539 var value = date.getMilliseconds(); 29540 while(value > part.maxNumber) 29541 value = value / 10; 29542 part.SetNumber(Math.round(value)); 29543 }, 29544 SetAmPm: function(part, date) { 29545 if(!MaskManager.IsEnumPart(part)) 29546 return; 29547 part.itemIndex = date.getHours() < 12 ? 0 : 1; 29548 }, 29549 HasDateParts: function(maskInfo) { 29550 var list = maskInfo.parts; 29551 for(var i = 0; i < list.length; i++) { 29552 var role = list[i].dateTimeRole; 29553 if(role == "d" || role == "M" || role == "y") 29554 return true; 29555 } 29556 return false; 29557 } 29558}; 29559ASPx.MaskPartBase = MaskPartBase; 29560ASPx.LiteralMaskPart = LiteralMaskPart; 29561ASPx.EnumMaskPart = EnumMaskPart; 29562ASPx.RangeMaskPart = RangeMaskPart; 29563ASPx.PromptMaskPart = PromptMaskPart; 29564ASPx.NumericMaskPart = NumericMaskPart; 29565ASPx.CharMaskPart = CharMaskPart; 29566ASPx.AlphaMaskPart = AlphaMaskPart; 29567ASPx.AlphaNumericMaskPart = AlphaNumericMaskPart; 29568ASPx.MaskParser = MaskParser; 29569ASPx.MaskInfo = MaskInfo; 29570ASPx.MaskManager = MaskManager;
29571ASPx.MaskDateTimeHelper = MaskDateTimeHelper; 29572ASPx.MaskIncludeLiterals = MaskIncludeLiterals; 29573})(); 29574(function() { 29575var ASPxClientButton = ASPx.CreateClass(ASPxClientControl, { 29576 constructor: function(name) { 29577 this.constructor.prototype.constructor.call(this, name); 29578 this.isASPxClientButton = true; 29579 this.allowFocus = true; 29580 this.autoPostBackFunction = null; 29581 this.causesValidation = true; 29582 this.checked = false; 29583 this.clickLocked = false; 29584 this.groupName = ""; 29585 this.focusElementSelected = false; 29586 this.pressed = false; 29587 this.useSubmitBehavior = true; 29588 this.validationGroup = ""; 29589 this.validationContainerID = null; 29590 this.validateInvisibleEditors = false; 29591 this.originalWidth = null; 29592 this.originalHeight = null; 29593 this.needUpdateBounds = true; 29594 this.isTextEmpty = false; 29595 this.isImage = false; 29596 this.CheckedChanged = new ASPxClientEvent(); 29597 this.GotFocus = new ASPxClientEvent(); 29598 this.LostFocus = new ASPxClientEvent(); 29599 this.Click = new ASPxClientEvent(); 29600 }, 29601 InlineInitialize: function() { 29602 var mainElement = this.GetMainElement(); 29603 this.originalWidth = mainElement.style.width; 29604 this.originalHeight = mainElement.style.height; 29605 ASPxClientControl.prototype.InlineInitialize.call(this); 29606 this.InitializeElementIDs(); 29607 this.InitializeEvents(); 29608 this.InitializeEnabled(); 29609 this.InitializeChecked(); 29610 if(this.IsLink()) 29611 this.InitializeLink(); 29612 this.PreventButtonImageDragging(); 29613 this.EnsureBoundsAdjusted(); 29614 }, 29615 InitializeElementIDs: function(){ 29616 var mainElement = this.GetMainElement(); 29617 var contentElement = ASPx.GetNodeByTagName(mainElement, "DIV", 0); 29618 if(contentElement) contentElement.id = this.name + "_CD"; 29619 var imageElement = ASPx.GetNodeByTagName(mainElement, "IMG", 0); 29620 if(imageElement) imageElement.id = this.name + "Img"; 29621 }, 29622 InitializeEnabled: function(){ 29623 this.SetEnabledInternal(this.clientEnabled, true); 29624 }, 29625 InitializeChecked: function(){ 29626 this.SetCheckedInternal(this.checked, true); 29627 }, 29628 InitializeLink: function(){ 29629 var mainElement = this.GetMainElement(); 29630 if(this.enabled) 29631 mainElement.href = "javascript:;"; 29632 if(!this.allowFocus) 29633 mainElement.style.outline = 0; 29634 if(!this.isImage && !this.GetTextContainer()) 29635 mainElement.style.fontSize = "0pt"; 29636 }, 29637 InitializeEvents: function(){ 29638 if(!this.isNative && !this.IsLink()) { 29639 var element = this.GetInternalButton(); 29640 if(element) 29641 element.onfocus = null; 29642 var textControl = this.GetTextControl(); 29643 if(textControl) 29644 ASPx.Evt.PreventElementDragAndSelect(textControl, false); 29645 } 29646 this.onClick = function(evt) { 29647 var processOnServer = ASPx.BClick(this.name, evt); 29648 if(!processOnServer) 29649 ASPx.Evt.PreventEvent(evt); 29650 return processOnServer; 29651 }.aspxBind(this); 29652 this.onImageMoseDown = function() { var el = ASPx.GetFocusedElement(); if(el) el.blur(); }; 29653 this.onGotFocus = function() { this.OnFocus(); }.aspxBind(this); 29654 this.onLostFocus = function() { this.OnLostFocus(); }.aspxBind(this); 29655 this.onKeyUp = function(evt) { this.OnKeyUp(evt); }.aspxBind(this); 29656 this.onKeyDown = function(evt) { this.OnKeyDown(evt); }.aspxBind(this); 29657 if(!this.isNative && !this.IsLink()) 29658 this.InitializeNativeHandlers(); 29659 }, 29660 InitializeNativeHandlers: function() { 29661 this.AttachNativeHandlerToMainElement("focus", "SetFocus"); 29662 this.AttachNativeHandlerToMainElement("click", "DoClick"); 29663 }, 29664 EnsureBoundsAdjusted: function() { 29665 var mainElement = this.GetMainElement(); 29666 this.needUpdateBounds = ASPx.GetCurrentStyle(mainElement).display === "block"; 29667 if(this.needUpdateBounds) 29668 mainElement.className = mainElement.className.replace("dxbTSys", ""); 29669 }, 29670 AdjustControlCore: function () { 29671 if(this.isNative || this.IsLink()) return; 29672 var buttonImage = this.GetButtonImage(); 29673 if(buttonImage && buttonImage.offsetHeight === 0 && buttonImage.offsetWidth === 0) 29674 buttonImage.onload = function() { this.UpdateSize(); }.aspxBind(this); 29675 else 29676 this.UpdateSize(); 29677 this.UpdateVerticalAlign(); 29678 }, 29679 UpdateSize: function() { 29680 if(this.needUpdateBounds) { 29681 this.UpdateWidth(); 29682 this.UpdateHeight(); 29683 } else 29684 this.CorrectWrappedText(this.GetContentDiv, "Text", true); 29685 }, 29686 UpdateVerticalAlign: function() { 29687 var contentElement = this.GetContentDiv(); 29688 var verticalAlign = this.GetMainElement().style.verticalAlign; 29689 if(ASPx.IsExistsElement(contentElement) && verticalAlign) 29690 contentElement.style.verticalAlign = verticalAlign; 29691 }, 29692 UpdateHeight: function(){ 29693 if(this.isNative || this.IsLink() || this.originalHeight === null || ASPx.IsPercentageSize(this.originalHeight)) return; 29694 var height; 29695 var mainElement = this.GetMainElement(); 29696 var contentDiv = this.GetContentDiv(); 29697 var borderAndPadding = ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement); 29698 var contentHasExcessiveHeight = contentDiv.offsetHeight > mainElement.offsetHeight - borderAndPadding;
29699 var needSetAutoHeight = !this.originalHeight || (ASPx.Browser.Safari && contentHasExcessiveHeight); 29700 if(needSetAutoHeight) { 29701 mainElement.style.height = ""; 29702 height = mainElement.offsetHeight - borderAndPadding; 29703 } 29704 else 29705 height = (ASPx.PxToInt(this.originalHeight) - borderAndPadding); 29706 if(height){ 29707 mainElement.style.height = height + "px"; 29708 if(contentDiv && contentDiv.offsetHeight > 0){ 29709 var contentDivCurrentStyle = ASPx.GetCurrentStyle(contentDiv); 29710 var paddingTop = parseInt(contentDivCurrentStyle.paddingTop) || 0; 29711 var paddingBottom = parseInt(contentDivCurrentStyle.paddingBottom) || 0; 29712 var clientHeightDiff = height - contentDiv.offsetHeight; 29713 var verticalAlign = ASPx.GetCurrentStyle(mainElement).verticalAlign; 29714 if(verticalAlign == "top") 29715 paddingBottom = paddingBottom + clientHeightDiff; 29716 else if(verticalAlign == "bottom") 29717 paddingTop = paddingTop + clientHeightDiff; 29718 else { 29719 var halfClientHeightDiff = Math.floor(clientHeightDiff / 2); 29720 paddingTop = paddingTop + halfClientHeightDiff; 29721 paddingBottom = paddingBottom + (clientHeightDiff - halfClientHeightDiff); 29722 } 29723 contentDiv.style.paddingTop = (paddingTop > 0 ? paddingTop : 0) + "px"; 29724 contentDiv.style.paddingBottom = (paddingBottom > 0 ? paddingBottom : 0) + "px"; 29725 } 29726 } 29727 }, 29728 UpdateWidth: function(){ 29729 if(this.isNative || this.IsLink() || this.originalWidth === null) return; 29730 if(!ASPx.IsPercentageSize(this.originalWidth)) { 29731 var mainElement = this.GetMainElement(); 29732 var borderAndPadding = ASPx.GetLeftRightBordersAndPaddingsSummaryValue(mainElement); 29733 if(this.originalWidth && ASPx.IsTextWrapped(this.GetTextContainer())) 29734 mainElement.style.width = (ASPx.PxToInt(this.originalWidth) - borderAndPadding) + "px"; 29735 else 29736 mainElement.style.width = "auto"; 29737 var width = mainElement.offsetWidth - borderAndPadding; 29738 if(this.originalWidth && width < ASPx.PxToInt(this.originalWidth) - borderAndPadding) 29739 width = ASPx.PxToInt(this.originalWidth) - borderAndPadding; 29740 if(width) 29741 mainElement.style.width = (width > 0 ? width : 0) + "px"; 29742 } 29743 this.CorrectWrappedText(this.GetContentDiv, "Text", true); 29744 }, 29745 GetAdjustedSizes: function() { 29746 var sizes = ASPxClientControl.prototype.GetAdjustedSizes.call(this); 29747 var image = this.GetButtonImage(); 29748 if(image) { 29749 sizes.imageWidth = image.offsetWidth; 29750 sizes.imageHeight = image.offsetHeight; 29751 } 29752 return sizes; 29753 }, 29754 PreventButtonImageDragging: function() { 29755 ASPx.Evt.PreventImageDragging(this.GetButtonImage()); 29756 }, 29757 AttachNativeHandlerToMainElement: function(handlerName, correspondingMethodName) { 29758 var mainElement = this.GetMainElement(); 29759 if(!ASPx.IsExistsElement(mainElement)) 29760 return; 29761 mainElement[handlerName] = function() { _aspxBCallButtonMethod(this.name, correspondingMethodName); }.aspxBind(this); 29762 }, 29763 GetContentDiv: function(){ 29764 return this.GetChildElement("CD"); 29765 }, 29766 GetButtonImage: function(){ 29767 return ASPx.CacheHelper.GetCachedElement(this, "buttonImage", 29768 function() { 29769 return ASPx.GetNodeByTagName(this.GetMainElement(), "IMG", 0); 29770 }); 29771 }, 29772 GetInternalButton: function() { 29773 return ASPx.CacheHelper.GetCachedElement(this, "internalButton", 29774 function() { 29775 return this.isNative || this.IsLink() ? this.GetMainElement() : ASPx.GetNodeByTagName(this.GetMainElement(), "INPUT", 0); 29776 }); 29777 }, 29778 GetTextContainer: function() { 29779 return ASPx.CacheHelper.GetCachedElement(this, "textContainer", 29780 function() { 29781 if(this.isNative) 29782 return this.GetMainElement(); 29783 else{ 29784 var textElement = this.IsLink() ? this.GetMainElement() : this.GetContentDiv(); 29785 return this.accessibilityCompliant ? ASPx.GetElementById(this.name + "_BTC") : ASPx.GetNodeByTagName(textElement, "SPAN", 0); 29786 } 29787 }); 29788 }, 29789 GetTextControl: function(){ 29790 return ASPx.CacheHelper.GetCachedElement(this, "textControl", 29791 function() { 29792 var element = ASPx.GetParentByTagName(this.GetContentDiv(), "DIV");
29793 if(!ASPx.IsExistsElement(element) || (element.id == this.name)) 29794 element = this.GetContentDiv(); 29795 return element; 29796 }); 29797 }, 29798 IsLink: function(){ 29799 if (this.GetMainElement()) 29800 return this.GetMainElement().tagName === "A"; 29801 return false; 29802 }, 29803 IsHovered: function(){ 29804 var hoverElement = this.GetMainElement(); 29805 return ASPx.GetStateController().currentHoverItemName == hoverElement.id; 29806 }, 29807 SetEnabledInternal: function(enabled, initialization) { 29808 if(!this.enabled) 29809 return; 29810 if(!initialization || !enabled) 29811 this.ChangeEnabledStateItems(enabled); 29812 this.ChangeEnabledAttributes(enabled); 29813 }, 29814 ChangeEnabledAttributes: function(enabled) { 29815 var element = this.GetInternalButton(); 29816 if(element) { 29817 if(this.IsLink()){ 29818 var method = ASPx.Attr.ChangeAttributesMethod(enabled); 29819 var link = this.GetMainElement(); 29820 method(link, "href"); 29821 if(this.accessibilityCompliant) 29822 ASPx.Attr.SetOrRemoveAttribute(link, ASPx.Attr.GetTabIndexAttributeName(), enabled ? null : "0"); 29823 } else { 29824 if(this.accessibilityCompliant) 29825 ASPx.Attr.Aria.SetOrRemoveDisabled(element, !enabled); 29826 else 29827 element.disabled = !enabled; 29828 } 29829 } 29830 this.ChangeEnabledEventsAttributes(ASPx.Attr.ChangeEventsMethod(enabled)); 29831 var isFocusable = enabled || this.accessibilityCompliant; 29832 this.ChangeEnabledFocusEvents(ASPx.Attr.ChangeEventsMethod(isFocusable)); 29833 }, 29834 ChangeEnabledEventsAttributes: function(method) { 29835 var element = this.GetMainElement(); 29836 method(element, "click", this.onClick); 29837 if(this.allowFocus){ 29838 if(!this.isNative && !this.IsLink()) { 29839 element = this.GetInternalButton(); 29840 if(element) { 29841 method(element, "keyup", this.onKeyUp); 29842 method(element, "blur", this.onKeyUp); 29843 method(element, "keydown", this.onKeyDown); 29844 } 29845 } 29846 if(ASPx.Browser.Firefox){ 29847 var image = this.GetButtonImage(); 29848 if(image) 29849 method(image, "mousedown", this.onImageMoseDown); 29850 } 29851 } 29852 }, 29853 ChangeEnabledFocusEvents: function(method) { 29854 if(!this.allowFocus) 29855 return; 29856 var element = !this.isNative && !this.IsLink() ? this.GetInternalButton() : this.GetMainElement(); 29857 if(element) { 29858 method(element, "focus", this.onGotFocus); 29859 method(element, "blur", this.onLostFocus); 29860 } 29861 }, 29862 ChangeEnabledStateItems: function(enabled){ 29863 if(this.isNative) return; 29864 ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled); 29865 this.UpdateFocusedStyle(); 29866 }, 29867 RequiredPreventDoublePostback: function(){ 29868 return ASPx.Browser.Firefox && !this.isNative; 29869 }, 29870 OnFocus: function() { 29871 if(!this.allowFocus) 29872 return false; 29873 this.focused = true; 29874 if(this.isInitialized) 29875 this.RaiseFocus(); 29876 this.UpdateFocusedStyle(); 29877 }, 29878 OnLostFocus: function() { 29879 if(!this.allowFocus) 29880 return false; 29881 this.focused = false; 29882 if(this.isInitialized) 29883 this.RaiseLostFocus(); 29884 this.UpdateFocusedStyle(); 29885 }, 29886 CauseValidation: function() { 29887 if(this.causesValidation && ASPx.Ident.scripts.ASPxClientEdit) 29888 return this.validationContainerID != null ? 29889 ASPxClientEdit.ValidateEditorsInContainerById(this.validationContainerID, this.validationGroup, this.validateInvisibleEditors) : 29890 ASPxClientEdit.ValidateGroup(this.validationGroup, this.validateInvisibleEditors); 29891 else 29892 return true; 29893 }, 29894 OnClick: function(evt) { 29895 if(this.clickLocked) return true; 29896 if(this.checked && this.groupName != "" && this.GetCheckedGroupList().length > 1) return; 29897 this.SetFocus(); 29898 var isValid = this.CauseValidation(); 29899 var processOnServer = this.autoPostBack; 29900 if(this.groupName != "") { 29901 if(this.GetCheckedGroupList().length == 1) 29902 this.SetCheckedInternal(!this.checked, false); 29903 else { 29904 this.SetCheckedInternal(true, false); 29905 this.ClearButtonGroupChecked(true); 29906 } 29907 processOnServer = this.RaiseCheckedChanged(); 29908 if(processOnServer && isValid) 29909 this.SendPostBack("CheckedChanged"); 29910 } 29911 var params = this.RaiseClick(); 29912 if(evt && params.cancelEventAndBubble) 29913 ASPx.Evt.PreventEventAndBubble(evt); 29914 if(params.processOnServer && isValid) 29915 return this.ProcessClick(); 29916 return false; 29917 }, 29918 ProcessClick: function() { 29919 var requiredPreventDoublePostback = this.RequiredPreventDoublePostback(); 29920 var postponePostback = ASPx.Browser.AndroidMobilePlatform; 29921 if(requiredPreventDoublePostback || postponePostback) 29922 window.setTimeout(function() { _aspxBCallButtonMethod(this.name, "SendPostBack", "Click"); }.aspxBind(this), 0); 29923 else 29924 this.SendPostBack("Click"); 29925 return !requiredPreventDoublePostback; 29926 }, 29927 OnKeyUp: function(evt) { 29928 if(!this.pressed) 29929 return; 29930 this.pressed = false; 29931 ASPx.GetStateController().OnKeyUpOnElement(evt); 29932 }, 29933 OnKeyDown: function(evt) { 29934 if(evt.keyCode == ASPx.Key.Enter || evt.keyCode == ASPx.Key.Space) 29935 this.SetPressed(); 29936 }, 29937 GetCheckedGroupList: function(){ 29938 var result = [ ]; 29939 ASPx.GetControlCollection().ForEachControl(function(control) { 29940 if(ASPx.Ident.IsASPxClientButton(control) && (control.groupName == this.groupName) && !control.IsDOMDisposed()) 29941 result.push(control); 29942 }, this); 29943 return result; 29944 }, 29945 ClearButtonGroupChecked: function(raiseCheckedChanged){ 29946 var list = this.GetCheckedGroupList(); 29947 for(var i = 0; i < list.length; i ++){ 29948 if(list[i] != this && list[i].checked) { 29949 list[i].SetCheckedInternal(false, false); 29950 if(raiseCheckedChanged) 29951 list[i].RaiseCheckedChanged(); 29952 } 29953 } 29954 }, 29955 ApplyCheckedStyle: function(){ 29956 var stateController = ASPx.GetStateController(); 29957 if(this.IsHovered()) 29958 stateController.SetCurrentHoverElement(null); 29959 stateController.SelectElementBySrcElement(this.GetMainElement()); 29960 }, 29961 ApplyUncheckedStyle: function(){ 29962 var stateController = ASPx.GetStateController(); 29963 if(this.IsHovered()) 29964 stateController.SetCurrentHoverElement(null); 29965 stateController.DeselectElementBySrcElement(this.GetMainElement()); 29966 }, 29967 SetCheckedInternal: function(checked, initialization){ 29968 if(initialization && checked || (this.checked != checked)){ 29969 this.checked = checked; 29970 if(checked)
29971 this.ApplyCheckedStyle(); 29972 else 29973 this.ApplyUncheckedStyle(); 29974 } 29975 }, 29976 UpdateStateObject: function(){ 29977 if(this.groupName != "") 29978 this.UpdateStateObjectWithObject({ checked: this.checked }); 29979 }, 29980 GetStateHiddenFieldName: function() { 29981 return this.uniqueID + "$State"; 29982 }, 29983 ApplyPressedStyle: function(){ 29984 ASPx.GetStateController().OnMouseDownOnElement(this.GetMainElement()); 29985 }, 29986 ApplyUnpressedStyle: function(){ 29987 ASPx.GetStateController().OnMouseUpOnElement(this.GetMainElement()); 29988 }, 29989 SetPressed: function(){ 29990 this.pressed = true; 29991 this.ApplyPressedStyle(); 29992 }, 29993 SetUnpressed: function(){ 29994 this.pressed = false; 29995 this.ApplyUnpressedStyle(); 29996 }, 29997 SetFocus: function(){ 29998 if(!this.allowFocus || this.focused) 29999 return; 30000 var element = this.GetInternalButton(); 30001 if(element) { 30002 var hiddenInternalButtonRequiresVisibilityToGetFocused = ASPx.Browser.WebKitFamily && !this.isNative && !this.IsLink(); 30003 if(hiddenInternalButtonRequiresVisibilityToGetFocused) 30004 ASPxClientButton.MakeHiddenElementFocusable(element); 30005 if(ASPx.IsFocusable(element) && ASPx.GetActiveElement() != element) 30006 element.focus(); 30007 if(hiddenInternalButtonRequiresVisibilityToGetFocused) 30008 ASPxClientButton.RestoreHiddenElementAppearance(element); 30009 } 30010 }, 30011 ApplyFocusedStyle: function(){ 30012 if(this.focusElementSelected) return; 30013 if(typeof(ASPx.GetStateController) != "undefined") 30014 ASPx.GetStateController().SelectElementBySrcElement(this.GetContentDiv()); 30015 this.focusElementSelected = true; 30016 }, 30017 ApplyUnfocusedStyle: function(){ 30018 if(!this.focusElementSelected) return; 30019 if(typeof(ASPx.GetStateController) != "undefined") 30020 ASPx.GetStateController().DeselectElementBySrcElement(this.GetContentDiv()); 30021 this.focusElementSelected = false; 30022 }, 30023 UpdateFocusedStyle: function(){ 30024 if(this.isNative || this.IsLink()) return; 30025 var isFocusable = this.enabled && this.allowFocus && this.focused && (this.clientEnabled || this.accessibilityCompliant); 30026 if(isFocusable) 30027 this.ApplyFocusedStyle(); 30028 else 30029 this.ApplyUnfocusedStyle(); 30030 }, 30031 SendPostBack: function(postBackArg){ 30032 if(!this.enabled || !this.clientEnabled) 30033 return; 30034 var arg = postBackArg || ""; 30035 if(this.autoPostBackFunction) 30036 this.autoPostBackFunction(arg); 30037 else if(!this.useSubmitBehavior || this.IsLink()) 30038 ASPxClientControl.prototype.SendPostBack.call(this, arg); 30039 if(this.useSubmitBehavior && !this.isNative) 30040 this.ClickInternalButton(); 30041 }, 30042 ClickInternalButton: function(){ 30043 var element = this.GetInternalButton(); 30044 if(element) { 30045 this.clickLocked = true; 30046 if(ASPx.Browser.NetscapeFamily) 30047 this.CreateUniqueIDCarrier(); 30048 var postHandler = ASPx.GetPostHandler(); 30049 postHandler.SetLastSubmitElementName(element.name); 30050 ASPx.Evt.DoElementClick(element); 30051 postHandler.SetLastSubmitElementName(null); 30052 if(ASPx.Browser.NetscapeFamily) 30053 this.RemoveUniqueIDCarrier(); 30054 this.clickLocked = false; 30055 } 30056 }, 30057 CreateUniqueIDCarrier: function() { 30058 var name = this.uniqueID; 30059 var id = this.GetUniqueIDCarrierID(); 30060 var field = ASPx.CreateHiddenField(name, id);
30061 var form = this.GetParentForm(); 30062 if(form) form.appendChild(field); 30063 }, 30064 RemoveUniqueIDCarrier: function() { 30065 var field = document.getElementById(this.GetUniqueIDCarrierID()); 30066 if(field) 30067 field.parentNode.removeChild(field); 30068 }, 30069 GetUniqueIDCarrierID: function() { 30070 return this.uniqueID + "_UIDC"; 30071 }, 30072 DoClick: function(){ 30073 if(!this.enabled || !this.clientEnabled) 30074 return; 30075 var button = (this.isNative || this.IsLink()) ? this.GetMainElement() : this.GetInternalButton(); 30076 if(button) 30077 ASPx.Evt.DoElementClick(button); 30078 else 30079 this.OnClick(); 30080 }, 30081 GetChecked: function(){ 30082 return this.checked; 30083 }, 30084 SetChecked: function(checked){ 30085 this.SetCheckedInternal(checked, false); 30086 this.ClearButtonGroupChecked(false); 30087 }, 30088 GetText: function(){ 30089 if(!this.isTextEmpty) 30090 return this.isNative ? this.GetTextContainer().value : this.GetTextContainer().innerHTML; 30091 return ""; 30092 }, 30093 SetText: function(text){ 30094 this.isTextEmpty = (text == null || text == ""); 30095 var textContainer = this.GetTextContainer(); 30096 if(textContainer){ 30097 if(this.isNative) 30098 textContainer.value = (text != null) ? text : ""; 30099 else { 30100 var value = this.isTextEmpty ? " " : text; 30101 textContainer.innerHTML = value; 30102 var element = this.GetInternalButton(); 30103 if(element) 30104 element.value = value; 30105 } 30106 this.UpdateSize(); 30107 } 30108 }, 30109 GetImageUrl: function(){ 30110 var img = this.GetButtonImage(); 30111 return img ? img.src : ""; 30112 }, 30113 SetImageUrl: function(url){ 30114 var img = this.GetButtonImage(); 30115 if(img) { 30116 img.src = url; 30117 this.UpdateSize(); 30118 } 30119 }, 30120 SetEnabled: function(enabled){ 30121 if(this.clientEnabled != enabled) { 30122 if(!enabled && this.focused) 30123 this.OnLostFocus(); 30124 this.clientEnabled = enabled; 30125 this.SetEnabledInternal(enabled, false); 30126 } 30127 }, 30128 GetEnabled: function(){ 30129 return this.enabled && this.clientEnabled; 30130 }, 30131 Focus: function(){ 30132 this.SetFocus(); 30133 }, 30134 RaiseCheckedChanged: function(){ 30135 var processOnServer = this.autoPostBack || this.IsServerEventAssigned("CheckedChanged"); 30136 if(!this.CheckedChanged.IsEmpty()){ 30137 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 30138 this.CheckedChanged.FireEvent(this, args); 30139 processOnServer = args.processOnServer; 30140 } 30141 return processOnServer; 30142 }, 30143 RaiseFocus: function(){ 30144 if(!this.GotFocus.IsEmpty()){ 30145 var args = new ASPxClientEventArgs(); 30146 this.GotFocus.FireEvent(this, args); 30147 } 30148 }, 30149 RaiseLostFocus: function(){ 30150 if(!this.LostFocus.IsEmpty()){ 30151 var args = new ASPxClientEventArgs(); 30152 this.LostFocus.FireEvent(this, args); 30153 } 30154 }, 30155 RaiseClick: function() { 30156 var processOnServer = this.autoPostBack || this.IsServerEventAssigned("Click"); 30157 var cancelEventAndBubble = false; 30158 if(!this.Click.IsEmpty()) { 30159 var args = new ASPxClientButtonClickEventArgs(processOnServer, cancelEventAndBubble); 30160 this.Click.FireEvent(this, args); 30161 cancelEventAndBubble = args.cancelEventAndBubble; 30162 processOnServer = args.processOnServer; 30163 } 30164 return { 30165 processOnServer: processOnServer, 30166 cancelEventAndBubble: cancelEventAndBubble 30167 }; 30168 } 30169}); 30170ASPxClientButton.Cast = ASPxClientControl.Cast; 30171var ASPxClientButtonClickEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, { 30172 constructor: function(processOnServer, cancelEventAndBubble) { 30173 this.constructor.prototype.constructor.call(this, processOnServer); 30174 this.cancelEventAndBubble = cancelEventAndBubble; 30175 } 30176}); 30177ASPxClientButton.MakeHiddenElementFocusable = function(element) { 30178 element.__dxHiddenElementState = { 30179 parentDisplay: element.parentNode.style.display, 30180 height: element.style.height, 30181 width: element.style.width 30182 }; 30183 element.parentNode.style.display = "block"; 30184 element.style.height = "1px"; 30185 element.style.width = "1px"; 30186}; 30187ASPxClientButton.RestoreHiddenElementAppearance = function(element) { 30188 var state = element.__dxHiddenElementState; 30189 element.parentNode.style.display = state.parentDisplay; 30190 element.style.height = state.height; 30191 element.style.width = state.width; 30192 delete element.__dxHiddenElementState; 30193}; 30194ASPx.Ident.IsASPxClientButton = function(obj) { 30195 return !!obj.isASPxClientButton; 30196};
30197function _aspxBCallButtonMethod(name, methodName, arg) { 30198 var button = ASPx.GetControlCollection().Get(name); 30199 if(button != null) 30200 button[methodName](arg); 30201} 30202ASPx.BClick = function(name, evt) { 30203 var button = ASPx.GetControlCollection().Get(name); 30204 if(button != null) 30205 return button.OnClick(evt); 30206}; 30207window.ASPxClientButton = ASPxClientButton; 30208})(); 30209 30210(function() { 30211var serializingSeparator = "|"; 30212var serializingSeparatorLength = serializingSeparator.length; 30213var lbIPostfixes = ['C', 'I', 'T']; 30214var lbIIdSuffix = "LBI"; 30215var lbSIIdSuffix = lbIIdSuffix + "-1"; 30216var lbAIRIdSuffix = "AIR"; 30217var lbAIRTIdSuffix = lbAIRIdSuffix + "-1"; 30218var lbTSIdSuffix = "_TS"; 30219var lbBSIdSuffix = "_BS"; 30220var lbHeaderDivIdSuffix = "_H"; 30221var lTableIdSuffix = "_LBT"; 30222var leVISuffix = "_VI"; 30223var lbDSuffix = "_D"; 30224var emptyItemsRange = "0:-1"; 30225var nbsp = " "; 30226var nameSeparator = "_"; 30227var nbspChar = String.fromCharCode(160); 30228var NullSizeCellClassName = "dxlbNullSizeCell"; 30229var itemCellTextAttributeName = "data-item-cell-text"; 30230var itemSerializedTextsAttributeName = "data-item-serialized-texts"; 30231var FIRST_CELL_MARKER_CSS_CLASS_NAME = "dxeFTM"; 30232var LAST_CELL_MARKER_CSS_CLASS_NAME = "dxeLTM"; 30233var selectAllMainElementID = "LBSAME"; 30234var selectAllCheckBoxID = "LBSACB"; 30235var filterMainElementID = "LBF"; 30236var filteringTextBoxID = "LBFE"; 30237var showFilterButtonID = "LBSFEB"; 30238var inactiveFilterElementClassName = "dxeLBInactiveFilterPanelSys"; 30239var listTableCollapsedClassName = "dxeLBTCollapsed"; 30240var ListBoxSelectionMode = { Single : 0, Multiple : 1, CheckColumn : 2 }; 30241var ListBoxVirtualScrollTableContainerIDPostfix = "LBVSTC"; 30242var CONSTANTS = { 30243 CALLBACK_PREFIXES: { 30244 CUSTOM: "LECC", 30245 CUSTOMPERFORM: "LECCP", 30246 LOAD_RANGE_ITEMS: "LBCRI", 30247 FILTERING: "CBLF", 30248 FILTERING_CORRECT: "CBCF" 30249 }, 30250 CALLBACK_RESULTS: { 30251 ITEMS: "i", 30252 FILTER_CUSTOMHIGHLIGHTING: "fCH", 30253 FILTER_LENGTH: "fL" 30254 } 30255}; 30256var ListBoxStateControllerManagerBase = ASPx.CreateClass(null, { 30257 constructor: function(listBox) { 30258 this.listBox = listBox; 30259 }, 30260 Initialize: function() { 30261 this.AddStateItems(false, false); 30262 }, 30263 AddStateItems: function(clearCache, hoverItemOnly) { 30264 if(typeof (ASPx.GetStateController) !== "undefined") { 30265 var itemCellsIdSuffixes = this.listBox.GetItemCellsIdPostfixes(); 30266 this.AddStateItemsCore(ASPx.GetStateController(), clearCache, itemCellsIdSuffixes, hoverItemOnly); 30267 } 30268 }, 30269 AddStateItemsCore: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) { 30270 if(this.HasSampleItemStateItems()) 30271 this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly,-1); 30272 }, 30273 AddItemStateItems: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, index) { 30274 var name = this.listBox.name + "_" + lbIIdSuffix + index; 30275 if(clearCache) 30276 this.listBox.ClearStateItemCache(controller, name, itemCellsIdSuffixes); 30277 if(this.NeedAddHoverStateToItem()) 30278 controller.AddHoverItem(name, this.listBox.hoverClasses, this.listBox.hoverCssArray, itemCellsIdSuffixes, null, null, true); 30279 if(!hoverItemOnly) { 30280 this.AddFunctionalStates(controller, name, itemCellsIdSuffixes); 30281 } 30282 }, 30283 NeedAddHoverStateToItem: function() { 30284 return !ASPx.Browser.WebKitTouchUI; 30285 }, 30286 AddFunctionalStates: function(controller, name, itemCellsIdSuffixes) { 30287 controller.AddSelectedItem(name, this.listBox.selectedClasses, this.listBox.selectedCssArray, itemCellsIdSuffixes, null, null, true); 30288 controller.AddDisabledItem(name, this.listBox.disabledClasses, this.listBox.disabledCssArray, itemCellsIdSuffixes, null, null, true); 30289 }, 30290 RemoveHoverStateItem: function() { 30291 if(typeof (ASPx.GetStateController) !== "undefined") { 30292 var itemCellsIdSuffixes = this.listBox.GetItemCellsIdPostfixes(); 30293 this.RemoveHoverStateItemCore(ASPx.GetStateController(), itemCellsIdSuffixes); 30294 } 30295 }, 30296 RemoveHoverStateItemCore: function(controller, itemCellsIdSuffixes) { 30297 if(this.HasSampleItemStateItems()) 30298 this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, -1); 30299 },
30300 RemoveItemStateHoverItem: function(controller, itemCellsIdSuffixes, index) { 30301 var name = this.listBox.name + "_" + lbIIdSuffix + index; 30302 this.listBox.ClearStateItemCache(controller, name, itemCellsIdSuffixes); 30303 if(!ASPx.Browser.WebKitTouchUI) 30304 controller.RemoveHoverItem(name, itemCellsIdSuffixes); 30305 }, 30306 HasSampleItemStateItems: function() { 30307 return this.listBox.hasSampleItem; 30308 }, 30309}); 30310var VirtualRenderListBoxStateControllerManager = ASPx.CreateClass(ListBoxStateControllerManagerBase, { 30311 constructor: function(listBox, virtualRenderItemsManager) { 30312 this.constructor.prototype.constructor.call(this, listBox); 30313 this.virtualRenderItemsManager = virtualRenderItemsManager; 30314 }, 30315 AddStateItemsCore: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) { 30316 ListBoxStateControllerManagerBase.prototype.AddStateItemsCore.call(this, controller, clearCache, itemCellsIdSuffixes, hoverItemOnly); 30317 var range = this.virtualRenderItemsManager.GetRenderedItemRange(); 30318 for(var i = range.startIndex;i <= range.endIndex;i++) { 30319 if(i >= 0) 30320 this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, i); 30321 } 30322 }, 30323 RemoveHoverStateItemCore: function(controller, itemCellsIdSuffixes) { 30324 ListBoxStateControllerManagerBase.prototype.RemoveHoverStateItemCore.call(this, controller, itemCellsIdSuffixes); 30325 var range = this.virtualRenderItemsManager.GetRenderedItemRange(); 30326 for(var i = range.startIndex; i <= range.endIndex; i++) { 30327 if(i >= 0) 30328 this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, i); 30329 } 30330 }, 30331}); 30332var DefaultListBoxStateControllerManager = ASPx.CreateClass(ListBoxStateControllerManagerBase, { 30333 constructor: function(listBox) { 30334 this.constructor.prototype.constructor.call(this, listBox); 30335 }, 30336 AddStateItemsCore: function(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly) { 30337 ListBoxStateControllerManagerBase.prototype.AddStateItemsCore.call(this, controller, clearCache, itemCellsIdSuffixes, hoverItemOnly); 30338 var count = this.listBox.GetItemCount(); 30339 for(var i = 0;i < count;i++) 30340 this.AddItemStateItems(controller, clearCache, itemCellsIdSuffixes, hoverItemOnly, i); 30341 }, 30342 RemoveHoverStateItemCore: function(controller, itemCellsIdSuffixes) { 30343 ListBoxStateControllerManagerBase.prototype.RemoveHoverStateItemCore.call(this, controller, itemCellsIdSuffixes); 30344 var count = this.GetItemCount(); 30345 for(var i = 0; i < count; i++) 30346 this.RemoveItemStateHoverItem(controller, itemCellsIdSuffixes, i); 30347 }, 30348}); 30349var ListBoxItemsManagerBase = ASPx.CreateClass(null, { 30350 constructor: function(listBox) { 30351 this.listBox = listBox; 30352 this.listTable = listBox.GetListTable(); 30353 }, 30354 Initialize: function() { 30355 }, 30356 GetListTableRows: function() { 30357 return this.listTable ? this.listTable.rows : []; 30358 }, 30359 GetItemHtmlContent: function(index) { return null; }, 30360 GetItem: function () { return null; }, 30361 GetItemIndexByRow: function (itemRow) { return null; }, 30362 GetItemCount: function () { return 0; }, 30363 GetItemRow: function (index) { 30364 if (this.listTable && index >= 0) { 30365 var rowIndex = this.ConvertItemIndexToRowIndex(index); 30366 var itemRow = this.listTable.rows[rowIndex]; 30367 if (itemRow && ASPx.ElementContainsCssClass(itemRow, "dxeListBoxItemRow")) 30368 return itemRow; 30369 } 30370 return null; 30371 }, 30372 GetItemElement: function (index) { 30373 var result = null; 30374 var itemRow = this.GetItemRow(index); 30375 if (itemRow) 30376 result = this.GetFirstVisibleCell(itemRow) || itemRow.cells[0]; 30377 return result; 30378 }, 30379 GetFirstVisibleCell: function (itemRow) { 30380 for (var i = 0; i < itemRow.cells.length; i++) 30381 if (ASPx.GetElementDisplay(itemRow.cells[i])) 30382 return itemRow.cells[i]; 30383 return null; 30384 }, 30385 GetItemHeight: function(index) { 30386 throw new Error("this method is abstract"); 30387 }, 30388 GetTotalItemsHeight: function(firstItemIndex, lastItemIndex) { 30389 throw new Error("this method is abstract"); 30390 }, 30391 GetItemsHeight: function() { return 0; }, 30392 GetItemsWidth: function() { return 0; }, 30393 GetVisibleItemCount: function () { return 0; }, 30394 GetTopSpacersHeight: function() { 30395 return this.listBox.GetTopScrollSpacerHeight(); 30396 }, 30397 GetItemTopOffset: function(index) { 30398 return this.GetItemTopOffsetCore(index); 30399 }, 30400 GetItemTopOffsetCore: function(index) { 30401 var itemElement = this.GetItemElement(index); 30402 return itemElement ? itemElement.offsetTop + this.GetTopSpacersHeight() : 0; 30403 }, 30404 IsItemVisible: function(index) { 30405 return this.IsItemEdgeVisible(index, true, true); 30406 }, 30407 IsItemEdgeVisible: function(index, checkTop, checkBottom) { 30408 var result = false; 30409 var itemElement = this.GetItemElement(index); 30410 if(itemElement != null) { 30411 var scrollDiv = this.listBox.GetScrollDivElement(); 30412 var topScrollDivEdge = scrollDiv.scrollTop; 30413 var bottomScrollDivEdge = scrollDiv.scrollTop + scrollDiv.clientHeight; 30414 var topItemElementEdge = this.GetItemTopOffset(index); 30415 var bottomItemElementEdge = topItemElementEdge + itemElement.getBoundingClientRect().height; 30416 var checkTopVisibleResult = !checkTop || this.IsVisibleOffset(topItemElementEdge, topScrollDivEdge, bottomScrollDivEdge); 30417 var checkBottomVisibleResult = !checkBottom || this.IsVisibleOffset(bottomItemElementEdge, topScrollDivEdge, bottomScrollDivEdge); 30418 result = checkTopVisibleResult && checkBottomVisibleResult; 30419 } 30420 return result; 30421 }, 30422 IsVisibleOffset: function(offset, topScrollDivEdge, bottomScrollDivEdge) { 30423 return offset >= topScrollDivEdge && offset <= bottomScrollDivEdge; 30424 }, 30425 GetFirstVisibleItem: function () { return null; }, 30426 GetFirstVisibleItemRow: function() { 30427 var firstVisibleItemIndex = this.GetFirstVisibleItem(); 30428 return this.listTable.rows[this.ConvertItemIndexToRowIndex(firstVisibleItemIndex)]; 30429 }, 30430 GetFirstRenderedItem: function () { }, 30431 GetLastRenderedItem: function () { }, 30432 InitializeInternalCheckBoxCollection: function () { }, 30433 GetScrollDivChildElementHeight: function () { return null; }, 30434 RemoveItem: function(index) { this.RemoveItemCore(index); }, 30435 RemoveItemCore: function(index) { 30436 this.listBox.RemoveItemRow(index); 30437 }, 30438 InsertItem: function () { }, 30439 CreateNewItemRow: function (index) { 30440 var newItemRow = this.listBox.GetSampleItemRow(); 30441 if (ASPx.IsExistsElement(newItemRow)) 30442 newItemRow = newItemRow.cloneNode(true); 30443 return newItemRow; 30444 }, 30445 ClearItems: function () { 30446 this.ClearItemsCore(); 30447 }, 30448 ClearItemsCore: function() { 30449 var tBody = this.listBox.GetListTableRowParent(); 30450 tBody.innerHTML = ""; 30451 }, 30452 IsItemFiltered: function (index) { return false; }, 30453 ConvertItemIndexToRowIndex: function () { return null; }, 30454 Adjust: function () { }, 30455 BeforeClientFiltering: function () { }, 30456 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) { }, 30457 RestorePrevFilteredState: function (index) { }, 30458 OnEndItemsFiltering: function () { }, 30459 ChangeItemsFilteredState: function(action) { 30460 var count = this.GetItemCount(); 30461 for (var i = 0; i < count; i++) { 30462 action(i);
30463 this.AfterChangeItemFilteredStateAction(i); 30464 } 30465 }, 30466 AfterChangeItemFilteredStateAction: function() { }, 30467 MakeAllItemsVisible: function () { 30468 this.ChangeItemsFilteredState(function (index) { 30469 this.ApplyFilterToItem(index, true, false, true); 30470 }.aspxBind(this)); 30471 }, 30472 MakeItemVisibleAtTop: function(index) { 30473 var scrollDiv = this.listBox.GetScrollDivElement(); 30474 scrollDiv.scrollTop = this.GetItemTopOffset(index); 30475 }, 30476 MakeItemVisible: function(index) { 30477 if(!this.IsItemVisible(index)) { 30478 var scrollDiv = this.listBox.GetScrollDivElement(); 30479 var scrollTop = scrollDiv.scrollTop; 30480 var scrollDivHeight = scrollDiv.clientHeight; 30481 var itemOffsetTop = this.GetItemTopOffset(index); 30482 var itemHeight = this.GetItemHeight(index); 30483 var itemAbove = scrollTop > itemOffsetTop; 30484 var itemBelow = scrollTop + scrollDivHeight < itemOffsetTop + itemHeight; 30485 if(itemAbove) { 30486 this.MakeItemVisibleAtTop(index); 30487 } 30488 else if(itemBelow) { 30489 var scrollDivChildElementHeight = this.listBox.GetScrollDivChildElementHeight(); 30490 var scrollPaddings = scrollDiv.scrollHeight - scrollDivChildElementHeight; 30491 scrollDiv.scrollTop = itemOffsetTop + itemHeight - scrollDivHeight + scrollPaddings; 30492 } 30493 } 30494 }, 30495 RewriteFilteredItemIndices: function(newFilteredItemIndices) { }, 30496 OnScrollSpacerVisibilityChanged: function () { }, 30497 SetItemHtml: function (index, html) { }, 30498 SetItemTooltip: function(index, tooltip) { }, 30499 SetItemAttribute: function(index, attrName, attrValue) { }, 30500 AddItemCssClass: function (index, className) { }, 30501 RemoveItemCssClass: function (index, className) { }, 30502 SetItemTextCellHtml: function (itemIndex, textCellIndex, html) { }, 30503 SetItemTextCellTooltip: function(itemIndex, textCellIndex, tooltip) { }, 30504 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attrName, attrValue) { }, 30505 AddItemTextCellCssClass: function (itemIndex, textCellIndex, className) { }, 30506 RemoveItemTextCellCssClass: function (itemIndex, textCellIndex, className) { }, 30507 OnDecoratedItemsRendering: function () { }, 30508 DeactivateScrollHandler: function() { }, 30509 ActivateScrollHandler: function() { }, 30510 IsScrollActivated: function() { return true; }, 30511 CorrectItemsHeight: function() {}, 30512 BeginUpdate: function() { }, 30513 EndUpdate: function() { } 30514}); 30515var ListBoxItemsDefaultManager = ASPx.CreateClass(ListBoxItemsManagerBase, { 30516 constructor: function (listBox) { 30517 this.constructor.prototype.constructor.call(this, listBox); 30518 }, 30519 GetItemIndexByRow: function (itemRow) { 30520 var result = itemRow.rowIndex; 30521 if (this.listBox.ContainsFixWidthRow()) 30522 result--; 30523 return result; 30524 }, 30525 GetItemCount: function () { 30526 if (this.listTable) { 30527 var rowLength = this.listTable.rows.length; 30528 if (!!this.listBox.GetAccessibilityHeaderRow()) 30529 rowLength--; 30530 if (this.listBox.ContainsFixWidthRow()) 30531 rowLength--; 30532 return rowLength; 30533 } 30534 return 0; 30535 }, 30536 GetItem: function (index) { 30537 var rowLength = this.GetItemCount(); 30538 if (!this.listTable || index < 0 || index >= rowLength) 30539 return null; 30540 var row = this.listBox.GetItemRow(index); 30541 var image = this.listBox.imageCellExists ? ASPx.GetNodeByTagName(row.cells[this.listBox.GetImageCellIndex()], "IMG", 0) : null; 30542 var src = image == null ? "" : ASPx.ImageUtils.GetImageSrc(image); 30543 var itemValue = this.listBox.itemsValue[index] !== undefined ? this.listBox.itemsValue[index] : null; 30544 return new ASPxClientListBoxItem(this.listBox, index, this.listBox.GetItemRowTexts(row), itemValue, src, this.listBox.GetIsItemSelected(index)); 30545 }, 30546 GetVisibleItemCount: function () { 30547 var count = this.GetItemCount(); 30548 var visibleItemCount = 0; 30549 for (var i = 0; i < count; i++) { 30550 if (ASPx.GetElementDisplay(this.GetItemRow(i))) 30551 visibleItemCount++; 30552 } 30553 return visibleItemCount; 30554 }, 30555 GetFirstVisibleItem: function () { 30556 var itemCount = this.GetItemCount(); 30557 for (var i = 0; i < itemCount; i++) 30558 if (this.GetItemRow(i) && this.IsItemFiltered(i)) 30559 return i; 30560 return -1; 30561 }, 30562 GetFirstFilteredItemIndex: function () { 30563 return this.GetFirstVisibleItem(); 30564 }, 30565 GetLastFilteredItemIndex: function() { 30566 var itemCount = this.GetItemCount(); 30567 for(var i = itemCount - 1; i >= 0; i--) 30568 if(this.GetItemRow(i) && this.IsItemFiltered(i)) 30569 return i; 30570 return -1; 30571 }, 30572 GetNextFilteredItemIndex: function(currentIndex) { 30573 var itemCount = this.GetItemCount(); 30574 for(var i = currentIndex + 1; i < itemCount; i++) 30575 if(this.GetItemRow(i) && this.IsItemFiltered(i)) 30576 return i; 30577 return -1; 30578 }, 30579 GetPrevFilteredItemIndex: function(currentIndex) { 30580 for(var i = currentIndex - 1; i >= 0; i--) 30581 if(this.GetItemRow(i) && this.IsItemFiltered(i)) 30582 return i; 30583 return -1; 30584 }, 30585 GetFirstRenderedItem: function () { 30586 return this.GetItemCount() > 0 ? this.GetItem(0) : null; 30587 }, 30588 GetLastRenderedItem: function () { 30589 return this.GetItemCount() > 0 ? this.GetItem(this.GetItemCount() - 1) : null; 30590 }, 30591 ConvertItemIndexToRowIndex: function (itemIndex) { 30592 return this.listBox.ContainsFixWidthRow() ? itemIndex + 1 : itemIndex; 30593 }, 30594 GetScrollDivChildElementHeight: function () { 30595 return this.listBox.GetListTableHeight() + this.listBox.GetTopScrollSpacerHeight() + this.listBox.GetBottomScrollSpacerHeight(); 30596 }, 30597 IsItemFiltered: function (index) { 30598 return ASPx.GetElementDisplay(this.GetItemRow(index)); 30599 }, 30600 InsertItem: function (index, itemProperties) { 30601 this.listBox.InsertItemRow(index, itemProperties); 30602 }, 30603 InitializeInternalCheckBoxCollection: function () { 30604 var count = this.GetItemCount(); 30605 var enabled = this.listBox.GetEnabled(); 30606 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled); 30607 for (var i = 0; i < count; i++) 30608 this.listBox.AddInternalCheckBoxToCollectionCore(i, enabled, changeEventMethod); 30609 }, 30610 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) { 30611 var itemRow = this.GetItemRow(index); 30612 if (savePrevState) { 30613 var newDisplayValue = isSatisfy ? "" : "none"; 30614 ASPx.Attr.ChangeStyleAttribute(itemRow, "display", newDisplayValue); 30615 } 30616 else 30617 ASPx.SetElementDisplay(itemRow, isSatisfy); 30618 }, 30619 RestorePrevFilteredState: function (index) { 30620 ASPx.Attr.RestoreStyleAttribute(this.GetItemRow(index), "display"); 30621 }, 30622 GetItemsHeight: function () { 30623 return this.listBox.GetListTableHeight(); 30624 }, 30625 GetTotalItemsHeight: function(firstItemIndex, lastItemIndex) { 30626 var result = 0; 30627 var rows = Array.prototype.slice.call(this.listBox.GetItemElements()); 30628 var visibleRowsIndexes = []; 30629 rows.forEach(function(row, index) { 30630 if(ASPx.GetElementDisplay(row)) 30631 visibleRowsIndexes.push(index); 30632 }); 30633 if(firstItemIndex > visibleRowsIndexes.length) 30634 lastItemIndex = visibleRowsIndexes.length - 1; 30635 if(lastItemIndex > visibleRowsIndexes.length) 30636 lastItemIndex = visibleRowsIndexes.length - 1; 30637 for(var i = firstItemIndex;i <= lastItemIndex;i++) 30638 result += this.GetItemHeight(visibleRowsIndexes[i]); 30639 return result; 30640 }, 30641 GetItemHeight: function(index) { 30642 if((isNaN(index))) throw new Error("index must be a number"); 30643 var itemElement = this.GetItemElement(index); 30644 return itemElement != null ? itemElement.getBoundingClientRect().height : 0; 30645 }, 30646 GetItemsWidth: function() { 30647 return this.listTable.offsetWidth; 30648 }, 30649 GetNewItemIndexInFilteredRange: function(selectedIndex, step) { 30650 var rows = Array.prototype.slice.call(this.listTable.rows); 30651 var filteredRows = rows.filter(function(row) { 30652 return ASPx.GetElementDisplay(row);
30653 }); 30654 var selectedRow = this.GetItemRow(selectedIndex); 30655 var itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(filteredRows, selectedRow); 30656 var newItemIndexInFilteredRange = itemIndexInFilteredRange + step; 30657 if(newItemIndexInFilteredRange >= filteredRows.length) 30658 newItemIndexInFilteredRange = filteredRows.length - 1; 30659 else if(newItemIndexInFilteredRange < 0) 30660 newItemIndexInFilteredRange = 0; 30661 var newSelectedRow = filteredRows[newItemIndexInFilteredRange]; 30662 return this.GetItemIndexByRow(newSelectedRow); 30663 } 30664}); 30665var ListBoxItemsVirtualManager = ASPx.CreateClass(ListBoxItemsManagerBase, { 30666 constructor: function(listBox) { 30667 this.constructor.prototype.constructor.call(this, listBox); 30668 this.smallestItemHeight = 0; 30669 this.smallestItemWidth = 0; 30670 this.previousScrollPosition = 0; 30671 }, 30672 Initialize: function () { 30673 ListBoxItemsManagerBase.prototype.Initialize.call(this); 30674 this.virtualScrollTopInvisibleItemsCount = 1; 30675 this.virtualScrollBottomInvisibleItemsCount = 1; 30676 this.showFilterButtonWidthCounted = false; 30677 this.isScrollProcessingActivated = true; 30678 this.InitializeItemRows(); 30679 this.virtualScrollVisibleItemIndices = []; 30680 this.updateSmallestItemSize(); 30681 this.UpdateScrollTableContainerHeight(); 30682 }, 30683 GetItemIndexByRow: function (itemRow) { 30684 return itemRow.itemIndex; 30685 }, 30686 GetItemCount: function () { 30687 return this.deserializedItems.length; 30688 }, 30689 GetItem: function(index, preventEncodeText) { 30690 if (index < 0 || index >= this.GetItemCount()) 30691 return null; 30692 var deserializedItem = this.deserializedItems[index]; 30693 var itemTexts = this.AdjustItemTexts(deserializedItem, preventEncodeText); 30694 var result = new ASPxClientListBoxItem(this.listBox, index, itemTexts, deserializedItem.value, 30695 deserializedItem.imageUrl, this.listBox.GetIsItemSelected(index)); 30696 result.insertOrderIndex = deserializedItem.insertOrderIndex; 30697 return result; 30698 }, 30699 GetItemHtmlContent: function(index) { 30700 return this.deserializedItems[index] && this.deserializedItems[index].htmlContent; 30701 }, 30702 AdjustItemTexts: function (item, preventEncodeText) { 30703 var itemInnerTexts = this.GetItemInnerTexts(item, preventEncodeText); 30704 if (this.listBox.IsMultiColumn()) { 30705 for (var i = itemInnerTexts.length; i < this.listBox.columnFieldNames.length; i++) 30706 itemInnerTexts.push(""); 30707 } 30708 return itemInnerTexts; 30709 }, 30710 GetItemInnerTexts: function(item, preventEncodeText) { 30711 if(!item.texts) 30712 return item.texts; 30713 var adjustedItemTexts = []; 30714 for(var i = 0; i < item.texts.length; i++) { 30715 var itemText = item.texts[i] || ""; 30716 if(!this.listBox.encodeHtml && !preventEncodeText) 30717 itemText = this.GetEncodedItemInnerText(itemText); 30718 adjustedItemTexts[i] = itemText; 30719 } 30720 return adjustedItemTexts; 30721 }, 30722 GetEncodedItemInnerText: function(itemText) { 30723 var result = itemText; 30724 var encodedItemText = ASPx.Str.EncodeHtml(itemText); 30725 if(itemText !== encodedItemText) { 30726 var div = document.createElement("DIV"); 30727 ASPx.SetInnerHtml(div, itemText); 30728 result = ASPx.GetInnerText(div); 30729 } 30730 return result; 30731 }, 30732 GetVisibleItemCount: function () { 30733 return this.filteredItemIndices.length; 30734 }, 30735 GetItemsHeight: function () { 30736 var result = 0; 30737 ASPx.Data.ForEach(this.filteredItemIndices, function(itemIndex) { 30738 result += this.GetItemHeight(itemIndex); 30739 }.bind(this)); 30740 return result; 30741 }, 30742 GetTotalItemsHeight: function(firstItemIndex, lastItemIndex) { 30743 var result = 0; 30744 if(lastItemIndex >= this.filteredItemIndices.length) 30745 lastItemIndex = this.filteredItemIndices.length - 1; 30746 for(var i = firstItemIndex;i <= lastItemIndex;i++) { 30747 result += this.GetItemHeight(this.filteredItemIndices[i]); 30748 } 30749 return result; 30750 }, 30751 GetItemHeight: function(index) { 30752 return this.deserializedItems[index].calculatedHeight ? this.deserializedItems[index].calculatedHeight : this.smallestItemHeight; 30753 }, 30754 GetItemsWidth: function() { 30755 var listTableOffsetWidth = this.listTable.offsetWidth; 30756 var showFilterButton = this.listBox.GetShowFilterButton();
30757 if(showFilterButton && !this.showFilterButtonWidthCounted) { 30758 listTableOffsetWidth += showFilterButton.GetMainElement().offsetWidth; 30759 this.showFilterButtonWidthCounted = true; 30760 } 30761 var itemsWidth = this.UseVirtualItemWidth() ? 30762 Math.max(this.visibleItemTextMaxWidth + this.smallestItemWidth, listTableOffsetWidth) 30763 : listTableOffsetWidth; 30764 return itemsWidth; 30765 }, 30766 UseVirtualItemWidth: function() { 30767 return !this.IsFixedWidth() && !this.listBox.hasDecoratedItems && !this.IsItemTextWrapEnabled(); 30768 }, 30769 IsFixedWidth: function() { 30770 return this.listBox.IsMultiColumn() || this.IsStandaloneListBoxWithFixedWidth(); 30771 }, 30772 IsStandaloneListBoxWithFixedWidth: function() { 30773 return !this.listBox.isComboBoxList && this.listBox.width !== ""; 30774 }, 30775 GetFirstRenderedItem: function () { 30776 for (var i = 0; i < this.listTable.rows.length; i++) 30777 if (this.listTable.rows[i].itemIndex !== undefined) 30778 return this.GetItem(this.listTable.rows[i].itemIndex); 30779 return null; 30780 }, 30781 GetLastRenderedItem: function () { 30782 for (var i = this.listTable.rows.length - 1; i >= 0; i--) 30783 if (this.listTable.rows[i].itemIndex !== undefined) 30784 return this.GetItem(this.listTable.rows[i].itemIndex); 30785 return null; 30786 }, 30787 GetTopSpacersHeight: function () { 30788 return ListBoxItemsManagerBase.prototype.GetTopSpacersHeight.call(this) + this.GetVirtualScrollTopSpacer().clientHeight; 30789 }, 30790 GetItemTopOffset: function (index) { 30791 var result = this.GetItemTopOffsetCore(index); 30792 if(result === 0) { 30793 var renderedItemRange = this.GetRenderedItemRange(); 30794 if((renderedItemRange.startIndex >= 0 && renderedItemRange.endIndex >= 0) && (index < renderedItemRange.startIndex || index > renderedItemRange.endIndex)) { 30795 itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(this.filteredItemIndices, index); 30796 if(itemIndexInFilteredRange !== -1) { 30797 result = this.GetTotalItemsHeight(0, itemIndexInFilteredRange) - this.GetItemHeight(itemIndexInFilteredRange); 30798 } 30799 } 30800 } 30801 return result; 30802 }, 30803 IsItemVisible: function (index) { 30804 return this.IsItemRendered(index) ? ListBoxItemsManagerBase.prototype.IsItemVisible.call(this, index) : false; 30805 }, 30806 AreAllItemsVisible: function() { 30807 return this.filteredItemIndices.length === this.GetItemCount(); 30808 }, 30809 IsLastItemBottomEdgeVisible: function() { 30810 return this.IsItemEdgeVisible(this.GetLastFilteredItemIndex(), false, true); 30811 }, 30812 ConvertItemIndexToRowIndex: function (itemIndex) { 30813 if(this.listTable.rows.length < 1) 30814 return -1; 30815 if(this.AreAllItemsVisible() && this.listBox.syncLockCount < 1 && !this.listBox.hasItemTemplate) { 30816 var rawIndex = itemIndex - this.listTable.rows[0].itemIndex; 30817 return rawIndex >= 0 && rawIndex < this.listTable.rows.length 30818 ? rawIndex 30819 : ASPx.Data.ArrayIndexOf(this.listTable.rows, itemIndex, function(element) {return element.itemIndex === itemIndex;}); 30820 } 30821 return ASPx.Data.ArrayIndexOf(this.listTable.rows, itemIndex, function (element) { return element.itemIndex === itemIndex; }); 30822 }, 30823 GetScrollDivChildElementHeight: function () { 30824 return this.GetVirtualScrollTableContainer().getBoundingClientRect().height; 30825 }, 30826 IsItemFiltered: function (index) { 30827 return this.deserializedItems[index] && this.deserializedItems[index].filtered; 30828 }, 30829 GetFirstVisibleItem: function () { 30830 for(var i = 0; i < this.listTable.rows.length; i++) 30831 if (this.listTable.rows[i] && ASPx.ElementContainsCssClass(this.listTable.rows[i], "dxeListBoxItemRow")) 30832 return this.listTable.rows[i].itemIndex; 30833 return -1; 30834 }, 30835 GetFirstFilteredItemIndex: function() { 30836 return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[0] : -1; 30837 }, 30838 GetLastFilteredItemIndex: function() { 30839 return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[this.filteredItemIndices.length - 1] :
30839-1; 30840 }, 30841 GetNextFilteredItemIndex: function(currentFilteredItemIndex) { 30842 return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[ASPx.Data.ArrayIndexOf(this.filteredItemIndices, currentFilteredItemIndex) + 1] : -1; 30843 }, 30844 GetPrevFilteredItemIndex: function(currentFilteredItemIndex) { 30845 return this.filteredItemIndices.length > 0 ? this.filteredItemIndices[ASPx.Data.ArrayIndexOf(this.filteredItemIndices, currentFilteredItemIndex) - 1] : -1; 30846 }, 30847 GetNewItemIndexInFilteredRange: function(selectedIndex, step) { 30848 var itemIndexInFilteredRange = ASPx.Data.ArrayIndexOf(this.filteredItemIndices, selectedIndex); 30849 var newItemIndexInFilteredRange = itemIndexInFilteredRange + step; 30850 if(newItemIndexInFilteredRange >= this.filteredItemIndices.length) 30851 newItemIndexInFilteredRange = this.filteredItemIndices.length - 1; 30852 else if(newItemIndexInFilteredRange < 0) 30853 newItemIndexInFilteredRange = 0; 30854 return this.filteredItemIndices[newItemIndexInFilteredRange]; 30855 }, 30856 ShouldRenderItemOnInsert: function(index) { 30857 if (!this.listBox.IsDisplayed()) 30858 return false; 30859 if (this.GetFirstVisibleItemRow() == null) 30860 return true; 30861 if (this.IsIndexInRenderedItemRange(index)) 30862 return true; 30863 if (this.filteredItemIndices.length > 0) { 30864 var startFilteredItemIndex = this.filteredItemIndices[0]; 30865 var endFilteredItemIndex = this.filteredItemIndices[this.filteredItemIndices.length - 1]; 30866 return index < startFilteredItemIndex && this.IsItemVisible(startFilteredItemIndex) 30867 || index > endFilteredItemIndex && this.IsItemVisible(endFilteredItemIndex); 30868 } 30869 return false; 30870 }, 30871 InsertItem: function(index, itemProperties) { 30872 var isInsertToEnd = index === this.GetItemCount(); 30873 var isInsertToEndWithLock = isInsertToEnd && this.updateLock; 30874 var shouldRenderItemOnInsert = !isInsertToEndWithLock && this.ShouldRenderItemOnInsert(index); 30875 var isItemInsertedToTop = this.virtualScrollVisibleItemIndices.length > 0 && index < this.virtualScrollVisibleItemIndices[0]; 30876 ASPx.Data.ArrayInsert(this.deserializedItems, this.listBox.CreateItem(index, itemProperties), index); 30877 this.deserializedItems[index].filtered = true; 30878 this.deserializedItems[index].insertOrderIndex = this.listBox.FindFreeIndex(); 30879 if(!isInsertToEnd) { 30880 for(var i = 0; i < this.deserializedItems.length; i++) 30881 this.deserializedItems[i].index = i; 30882 var requiredItemIndexInFilteredRange = -1; 30883 for(var i = 0; i < this.filteredItemIndices.length; i++) 30884 if(this.filteredItemIndices[i] >= index) { 30885 this.filteredItemIndices[i]++; 30886 if(requiredItemIndexInFilteredRange == -1) 30887 requiredItemIndexInFilteredRange = i; 30888 } 30889 ASPx.Data.ArrayInsert(this.filteredItemIndices, index, requiredItemIndexInFilteredRange); 30890 } 30891 else 30892 this.filteredItemIndices.push(index); 30893 if(shouldRenderItemOnInsert) { 30894 this.updateSmallestItemSize(); 30895 } 30896 if(!isInsertToEndWithLock) { 30897 this.virtualScrollVisibleItemIndices = []; 30898 var rows = this.GetListTableRows(); 30899 for(var i = 0; i < rows.length; i++) { 30900 var row = rows[i]; 30901 if(row.itemIndex !== undefined) { 30902 if(row.itemIndex >= index) 30903 row.itemIndex++; 30904 this.virtualScrollVisibleItemIndices.push(row.itemIndex); 30905 } 30906 } 30907 if(shouldRenderItemOnInsert) { 30908 ASPx.Data.ArrayInsert(this.virtualScrollVisibleItemIndices, index, 30909 ASPx.Data.ArrayIndexOf(this.virtualScrollVisibleItemIndices, index, 30910 function(element) { return element > index; })); 30911 this.listBox.InsertItemRow(index, itemProperties); 30912 this.RecreateItemRowsCompletelly(this.getScrollPosition()); 30913 } 30914 this.UpdateScrollTableContainerHeight(); 30915 if(isItemInsertedToTop) 30916 this.UpdateVirtualScrollSpacerHeight(this.virtualScrollVisibleItemIndices, 0); 30917 if(!this.listBox.IsDisplayed()) 30918 this.listBox.ResetControlAdjustment(); 30919 } 30920 this.UpdateItemTextMaxWidth(this.GetItem(index).text); 30921 }, 30922 BeginUpdate: function() { 30923 this.updateLock = true; 30924 }, 30925 EndUpdate: function() { 30926 this.updateLock = false; 30927 this.updateSmallestItemSize(); 30928 this.RecreateItemRowsCompletelly(this.getScrollPosition()); 30929 this.UpdateScrollTableContainerHeight(); 30930 if(!this.listBox.IsDisplayed()) 30931 this.listBox.ResetControlAdjustment(); 30932 }, 30933 RemoveItem: function(index) { 30934 var shouldRecreateItemRows = this.listBox.IsDisplayed() && this.IsIndexInRenderedItemRange(index); 30935 var shouldRemoveFromRender = this.GetItemRow(index); 30936 var isItemRemovedFromTop = this.virtualScrollVisibleItemIndices.length > 0 && index < this.virtualScrollVisibleItemIndices[0]; 30937 var needUpdateItemTextMaxWidth = this.NeedUpdateItemTextMaxWidthOnRemoveItem(index); 30938 ASPx.Data.ArrayRemoveAt(this.deserializedItems, index); 30939 ASPx.Data.ArrayRemove(this.filteredItemIndices, index); 30940 for (var i = 0; i < this.deserializedItems.length; i++) 30941 this.deserializedItems[i].index = i; 30942 for (var i = 0; i < this.filteredItemIndices.length; i++) 30943 if (this.filteredItemIndices[i] > index) 30944 this.filteredItemIndices[i]--; 30945 this.virtualScrollVisibleItemIndices = []; 30946 if (shouldRemoveFromRender) 30947 this.RemoveItemCore(index); 30948 var rows = this.GetListTableRows(); 30949 for (var i = 0; i < rows.length; i++) { 30950 var row = rows[i]; 30951 if (row.itemIndex !== undefined) { 30952 if(row.itemIndex > index) 30953 row.itemIndex--; 30954 this.virtualScrollVisibleItemIndices.push(row.itemIndex); 30955 } 30956 } 30957 if (shouldRecreateItemRows) 30958 this.RecreateItemRowsCompletelly(this.getScrollPosition()); 30959 this.UpdateScrollTableContainerHeight(); 30960 if (isItemRemovedFromTop) 30961 this.UpdateVirtualScrollSpacerHeight(this.virtualScrollVisibleItemIndices, 0
30961); 30962 if (needUpdateItemTextMaxWidth) { 30963 this.itemTextMaxWidth = 0; 30964 this.visibleItemTextMaxWidth = 0; 30965 for (var i = 0; i < this.GetItemCount() ; i++) 30966 this.UpdateItemTextMaxWidth(this.GetItem(i).text); 30967 } 30968 if (!this.listBox.IsDisplayed()) 30969 this.listBox.ResetControlAdjustment(); 30970 }, 30971 ClearItems: function () { 30972 this.ClearItemsCore(); 30973 this.deserializedItems = []; 30974 this.filteredItemIndices = []; 30975 this.virtualScrollVisibleItemIndices = []; 30976 if (this.listBox.isComboBoxList) { 30977 this.itemTextMaxWidth = 0; 30978 this.visibleItemTextMaxWidth = 0; 30979 } 30980 this.UpdateScrollTableContainerHeight(); 30981 if (!this.listBox.IsDisplayed()) 30982 this.listBox.ResetControlAdjustment(); 30983 }, 30984 CreateNewItemRow: function (index) { 30985 var newItemRow = ListBoxItemsManagerBase.prototype.CreateNewItemRow.call(this, index); 30986 newItemRow.itemIndex = index; 30987 return newItemRow; 30988 }, 30989 Adjust: function() { 30990 if (this.GetItemCount() == 0 || !this.listBox.IsDisplayed()) 30991 return; 30992 if(this.smallestItemHeight === 0) { 30993 this.updateSmallestItemSize(); 30994 this.UpdateScrollTableContainerHeight(); 30995 } 30996 if(this.smallestItemHeight !== 0) { 30997 if(this.IsItemTextWrapEnabled()) 30998 this.CorrectItemsHeight(); 30999 this.RecreateItemRowsCompletelly(this.getScrollPosition()); 31000 this.listBox.InitializePageSize(); 31001 if(!this.listBox.isComboBoxList) 31002 this.listBox.CorrectWidth(); 31003 } 31004 }, 31005 UpdateItemTextMaxWidth: function (itemText, isFiltering) { 31006 if (!this.UseVirtualItemWidth()) 31007 return; 31008 if (!ASPx.IsExists(this.visibleItemTextMaxWidth)) 31009 this.visibleItemTextMaxWidth = 0; 31010 this.visibleItemTextMaxWidth = Math.max(this.GetItemTextWidth(itemText), this.visibleItemTextMaxWidth); 31011 if (!isFiltering) 31012 this.itemTextMaxWidth = this.visibleItemTextMaxWidth; 31013 }, 31014 GetItemTextWidth: function (itemText) { 31015 return Math.round(this.GetItemTextMeasureContext().measureText(itemText).width); 31016 }, 31017 GetItemTextMeasureContext: function() { 31018 if (!this.itemTextMeasureContext) { 31019 var itemTextMeasureCanvas = document.createElement("canvas"); 31020 this.itemTextMeasureContext = itemTextMeasureCanvas.getContext("2d"); 31021 var mainElementStyle = ASPx.GetCurrentStyle(this.listBox.GetMainElement()); 31022 var mainElementFont = mainElementStyle.font ? mainElementStyle.font : 31023 mainElementStyle.fontStyle + " " + mainElementStyle.fontVariant + " " + mainElementStyle.fontWeight + " " 31024 + mainElementStyle.fontSize + " / " + mainElementStyle.lineHeight + " " + mainElementStyle.fontFamily; 31025 this.itemTextMeasureContext.font = mainElementFont; 31026 } 31027 return this.itemTextMeasureContext; 31028 }, 31029 NeedUpdateItemTextMaxWidthOnRemoveItem: function(index) { 31030 return this.UseVirtualItemWidth() && this.listBox.isComboBoxList && this.IsItemWithMaxText(this.GetItem(index).text); 31031 }, 31032 BeforeClientFiltering: function () { 31033 if (this.listBox.isComboBoxList) 31034 this.visibleItemTextMaxWidth = 0; 31035 }, 31036 IsItemWithMaxText: function(itemText) { 31037 return this.GetItemTextWidth(itemText) === this.itemTextMaxWidth; 31038 }, 31039 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) { 31040 if (savePrevState && !ASPx.IsExists(this.deserializedItems[index].savedFiltered)) 31041 this.deserializedItems[index].savedFiltered = this.deserializedItems[index].filtered; 31042 this.ChangeItemFilteredFlag(index, isSatisfy, isFilterReset); 31043 }, 31044 RestorePrevFilteredState: function (index) { 31045 var savedFilteredState = this.deserializedItems[index].savedFiltered; 31046 if (ASPx.IsExists(savedFilteredState)) { 31047 this.ChangeItemFilteredFlag(index, savedFilteredState); 31048 delete this.deserializedItems[index].savedFiltered; 31049 } 31050 }, 31051 ChangeItemFilteredFlag: function (index, newValue, isFilterReset) { 31052 var item = this.deserializedItems[index]; 31053 item.filtered = newValue; 31054 if (!isFilterReset && this.listBox.isComboBoxList && newValue) 31055 this.UpdateItemTextMaxWidth(item.text); 31056 }, 31057 OnEndItemsFiltering: function() { 31058 if(this.listBox.IsDisplayed()) { 31059 this.RecreateItemRowsCompletelly(0); 31060 } 31061 }, 31062 ChangeItemsFilteredState: function (action) { 31063 this.filteredItemIndices = []; 31064 ListBoxItemsManagerBase.prototype.ChangeItemsFilteredState.call(this, action); 31065 }, 31066 AfterChangeItemFilteredStateAction: function (index) { 31067 if (this.IsItemFiltered(index)) 31068 this.filteredItemIndices.push(index); 31069 }, 31070 RewriteFilteredItemIndices: function (newFilteredItemIndices) { 31071 this.filteredItemIndices = newFilteredItemIndices; 31072 }, 31073 MakeAllItemsVisible: function () { 31074 ListBoxItemsManagerBase.prototype.MakeAllItemsVisible.call(this); 31075 this.visibleItemTextMaxWidth = this.itemTextMaxWidth; 31076 }, 31077 MakeItemVisible: function(index) { 31078 if(index < 0) { 31079 index = 0; 31080 } 31081 ListBoxItemsManagerBase.prototype.MakeItemVisible.call(this, index); 31082 }, 31083 InsertTempFirstItemRow: function() { 31084 try { 31085 this.listBox.LockRunStartupSciptsInItemRow(); 31086 if(this.deserializedItems.length > 0) 31087 this.listBox.InsertItemRow(0, this.deserializedItems[0]); 31088 } 31089 finally { 31090 this.listBox.UnlockRunStartupSciptsInItemRow(); 31091 } 31092 }, 31093 RemoveFirstTempRow: function () { 31094 if (this.deserializedItems.length > 0) 31095 this.listBox.RemoveItemRow(0); 31096 }, 31097 GetVirtualScrollItemHeight: function(virtualScrollItemRow) { 31098 return virtualScrollItemRow.getBoundingClientRect().height; 31099 }, 31100 updateSmallestItemSize: function() { 31101 if(this.smallestItemHeight == 0 && this.GetItemCount() !== 0) { 31102 this.InsertTempFirstItemRow(); 31103 var firstItemRow = this.GetFirstVisibleItemRow(); 31104 var itemTextCell = this.listBox.GetItemFirstTextCell(0); 31105 var cellDisplay = itemTextCell.style.display; 31106 itemTextCell.style.display = ""; 31107 ASPx.SetInnerHtml(itemTextCell,"."); 31108 this.smallestItemHeight = firstItemRow.offsetHeight; 31109 ASPx.AddClassNameToElement(this.listTable, listTableCollapsedClassName); 31110 ASPx.SetInnerHtml(itemTextCell,""); 31111 if(this.UseVirtualItemWidth() && this.smallestItemWidth === 0) { 31112 this.smallestItemWidth = firstItemRow.offsetWidth; 31113 } 31114 itemTextCell.style.display = cellDisplay; 31115 ASPx.RemoveClassNameFromElement(this.listTable, listTableCollapsedClassName); 31116 this.RemoveFirstTempRow(); 31117 } 31118 }, 31119 UpdateScrollTableContainerHeight: function () { 31120 var virtualScrollTableContainer = this.GetVirtualScrollTableContainer(); 31121 if (virtualScrollTableContainer) 31122 ASPx.SetStyles(virtualScrollTableContainer, { 31123 height: this.GetItemsHeight() 31124 + this.listBox.GetTopScrollSpacerHeight() 31125 + this.listBox.GetBottomScrollSpacerHeight() 31126 }); 31127 }, 31128 UpdateVirtualScrollSpacerHeight: function(visibleIndices, scrollableContainerHeightDelta) { 31129 var firstVisibleIndex = visibleIndices.length > 0 && this.filteredItemIndices.length > 0 ? ASPx.Data.ArrayIndexOf(this.filteredItemIndices, visibleIndices[0]) : 0; 31130 var topSpacerHeight = 0; 31131 if(firstVisibleIndex > 0) { 31132 topSpacerHeight = this.GetTotalItemsHeight(0, firstVisibleIndex - 1); 31133 } 31134 if(!scrollableContainerHeightDelta) 31135 scrollableContainerHeightDelta = 0; 31136 ASPx.SetStyles(this.GetVirtualScrollTopSpacer(), { height: topSpacerHeight - scrollableContainerHeightDelta }); 31137 }, 31138 OnScrollSpacerVisibilityChanged: function() { 31139 this.UpdateScrollTableContainerHeight(); 31140 }, 31141 SetItemHtml: function(index, html) { 31142 this.deserializedItems[index].htmlContent = html; 31143 }, 31144 SetItemTooltip: function (index, tooltip) { 31145 this.deserializedItems[index].tooltip = tooltip; 31146 }, 31147 SetItemAttribute: function(index, attrName, attrValue) { 31148 if(!this.deserializedItems[index].attributes) 31149 this.deserializedItems[index].attributes = {}; 31150 this.deserializedItems[index].attributes[attrName] = attrValue; 31151 }, 31152 AddClassNameToCssClass: function(cssClass, className) { 31153 return (cssClass == "" || cssClass == undefined) ? className : cssClass + " " + className; 31154 }, 31155 RemoveClassNameFromCssClass: function (cssClass, className) { 31156 var updClassName = " " + cssClass + " "; 31157 var newClassName = updClassName.replace(" " + className + " ", " "); 31158 return updClassName.length != newClassName.length ? ASPx.Str.Trim(newClassName) : cssClass; 31159 }, 31160 AddItemCssClass: function (index, className) { 31161 this.deserializedItems[index].cssClass = this.AddClassNameToCssClass(this.deserializedItems[index].cssClass, className); 31162 }, 31163 RemoveItemCssClass: function (index, className) { 31164 this.deserializedItems[index].cssClass = this.RemoveClassNameFromCssClass(this.deserializedItems[index].cssClass, className); 31165 }, 31166 SetItemTextCellHtml: function (itemIndex, textCellIndex, html) { 31167 if (!this.deserializedItems[itemIndex].htmlContents) 31168 this.deserializedItems[itemIndex].htmlContents = []; 31169 this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].htmlContents, textCellIndex, html); 31170 }, 31171 SetItemTextCellTooltip: function (itemIndex, textCellIndex, tooltip) { 31172 if (!this.deserializedItems[itemIndex].cellTooltips) 31173 this.deserializedItems[itemIndex].cellTooltips = []; 31174 this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellTooltips, textCellIndex, tooltip); 31175 }, 31176 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attrName, attrValue) { 31177 if(!this.deserializedItems[itemIndex].cellAttributes) 31178 this.deserializedItems[itemIndex].cellAttributes = []; 31179 var setValueAction = function(itemInfo, value) { 31180 if(!itemInfo.value) 31181 itemInfo.value = {}; 31182 itemInfo.value[value.attrName] = value.attrValue; 31183 }; 31184 this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellAttributes, textCellIndex, 31185 { attrName: attrName, attrValue: attrValue }, setValueAction); 31186 }, 31187 AddItemTextCellCssClass: function (itemIndex, textCellIndex, className) {
31188 if (!this.deserializedItems[itemIndex].cellCssClasses) 31189 this.deserializedItems[itemIndex].cellCssClasses = []; 31190 var newCssClass = this.AddClassNameToCssClass(this.deserializedItems[itemIndex].cellCssClasses[textCellIndex], className); 31191 this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellCssClasses, textCellIndex, newCssClass); 31192 }, 31193 RemoveItemTextCellCssClass: function (itemIndex, textCellIndex, className) { 31194 if (!this.deserializedItems[itemIndex].cellCssClasses) 31195 this.deserializedItems[itemIndex].cellCssClasses = []; 31196 var newCssClass = this.RemoveClassNameFromCssClass(this.deserializedItems[itemIndex].cellCssClasses[textCellIndex], className); 31197 this.SetItemTextCellInfoValue(this.deserializedItems[itemIndex].cellCssClasses, textCellIndex, newCssClass); 31198 }, 31199 SetItemTextCellInfoValue: function (infoArray, textCellIndex, value, setValueAction) { 31200 var itemInfo = null; 31201 var filteredArray = infoArray.filter(function (info) { return info.index === textCellIndex; }); 31202 if (filteredArray.length == 0) { 31203 itemInfo = { index: textCellIndex }; 31204 infoArray.push(itemInfo); 31205 } 31206 else 31207 itemInfo = filteredArray[0]; 31208 if(setValueAction) 31209 setValueAction(itemInfo, value); 31210 else 31211 itemInfo.value = value; 31212 }, 31213 InitializeItems: function(items, itemsValue) { 31214 this.deserializedItems = this.listBox.DeserializeItems(items); 31215 this.filteredItemIndices = []; 31216 this.visibleItemTextMaxWidth = 0; 31217 this.itemTextMaxWidth = 0; 31218 for (var i = 0; i < this.deserializedItems.length; i++) { 31219 this.listBox.AdjustItemProperties(this.deserializedItems[i]); 31220 itemsValue[i] = this.deserializedItems[i].value; 31221 this.filteredItemIndices[i] = this.deserializedItems[i].index; 31222 this.deserializedItems[i].filtered = true; 31223 this.deserializedItems[i].insertOrderIndex = this.listBox.FindFreeIndex(); 31224 this.UpdateItemTextMaxWidth(this.deserializedItems[i].text); 31225 } 31226 }, 31227 InitializeItemRows: function () { 31228 var topSpacer = ASPx.CreateHtmlElement("DIV"); 31229 topSpacer.id = this.listBox.name + "VirtualScrollTopSpacer"; 31230 var tableContainer = ASPx.CreateHtmlElement("DIV"); 31231 tableContainer.id = this.listBox.name + ListBoxVirtualScrollTableContainerIDPostfix; 31232 tableContainer.appendChild(topSpacer); 31233 var scrollDiv = this.listBox.GetScrollDivElement(); 31234 ASPx.MoveChildrenToElement(scrollDiv, tableContainer); 31235 scrollDiv.appendChild(tableContainer); 31236 ASPx.SetStyles(tableContainer, { overflow: "hidden", width: "100%" }); 31237 ASPx.Evt.AttachEventToElement(scrollDiv, "scroll", this.onScroll.bind(this)); 31238 }, 31239 getScrollPosition: function() { 31240 var scrollDiv = this.listBox.GetScrollDivElement(); 31241 var scrollTop = scrollDiv.scrollTop - this.listBox.GetTopScrollSpacerHeight(); 31242 if(scrollTop < 0) 31243 scrollTop = 0; 31244 return scrollTop; 31245 }, 31246 onScroll: function() { 31247 var scrollTop = this.getScrollPosition(); 31248 if(this.IsScrollActivated()) { 31249 var scrollDiv = this.listBox.GetScrollDivElement(); 31250 if(!scrollDiv) return; 31251 var scrollDivHeight = scrollDiv.clientHeight; 31252 var scrollContainerHeight = this.GetScrollDivChildElementHeight(); 31253 var scrollToBottom = scrollContainerHeight <= scrollDivHeight ? false : scrollTop >= scrollContainerHeight - scrollDivHeight; 31254 var virtualScrollTopSpacerHeight = this.GetVirtualScrollTopSpacer().getBoundingClientRect().height; 31255 var isSmallScroll = Math.abs(scrollTop - this.previousScrollPosition) < scrollDivHeight; 31256 if(isSmallScroll && virtualScrollTopSpacerHeight > scrollTop) 31257 isSmallScroll = false; 31258 if(isSmallScroll) 31259 this.RecreateItemRowsPartially(scrollTop); 31260 else 31261 this.RecreateItemRowsCompletelly(scrollTop); 31262 if(scrollToBottom) { 31263 this.DeactivateScrollHandler(); 31264 scrollDiv.scrollTop = this.GetScrollDivChildElementHeight() - scrollDivHeight; 31265 } 31266 } 31267 else { 31268 this.ActivateScrollHandler(); 31269 } 31270 this.previousScrollPosition = scrollTop; 31271 }, 31272 RecreateItemRowsCompletelly: function(scrollTop) { 31273 this.RecreateItemRows(scrollTop, false); 31274 }, 31275 RecreateItemRowsPartially: function(scrollTop) { 31276 this.RecreateItemRows(scrollTop, true); 31277 }, 31278 RecreateItemRows: function(scrollTop, recreateItemsPartially) { 31279 if(recreateItemsPartially == "undefined") throw new Error("recreateItemsPartially"); 31280 if(this.listBox.IsDisplayed()) { 31281 var firstVisibleItemIndex = this.getFirstVisibleItemIndex(scrollTop); 31282 var lastVisibleItemIndex = this.getLastVisibleItemIndex(scrollTop); 31283 this.RecreateItemRowsCore(firstVisibleItemIndex, lastVisibleItemIndex, recreateItemsPartially); 31284 if(typeof (ASPxClientHint) != "undefined") 31285 this.UpdateHintControl(); 31286 this.listBox.AssignEllipsisTooltips(); 31287 } 31288 }, 31289 RecreateItemRowsCore: function(topRenderedItemIndex, bottomRenderedItemIndex, recreateItemsPartially) { 31290 if(topRenderedItemIndex > bottomRenderedItemIndex && this.filteredItemIndices.length > 0) 31291 return; 31292 var newVisibleIndices = this.filteredItemIndices.slice(topRenderedItemIndex, bottomRenderedItemIndex + 1); 31293 this.RecreateItemRowsByVisibleIndices(newVisibleIndices, false, recreateItemsPartially); 31294 this.OnDecoratedItemsRendering(); 31295 if(this.listBox.NeedToHandleCellWidth()) 31296 this.listBox.CorrectCellNullWidthStyle(this.GetFirstVisibleItemRow()); 31297 }, 31298 getFirstVisibleItemIndex: function(scrollTop) { 31299 var result = -1; 31300 var scrollDiv = this.listBox.GetScrollDivElement(); 31301 var scrollDivHeight = scrollDiv.clientHeight; 31302 var scrollContainerHeight = this.GetScrollDivChildElementHeight();
31303 var scrollToBottom = scrollContainerHeight <= scrollDivHeight ? false : scrollTop >= scrollContainerHeight - scrollDivHeight; 31304 var height = 0; 31305 if(scrollToBottom) { 31306 for(var i = this.filteredItemIndices.length - 1;i >= 0;i--) { 31307 height += this.GetItemHeight(this.filteredItemIndices[i]); 31308 if(height > scrollDivHeight) { 31309 result = i; 31310 break; 31311 } 31312 } 31313 } 31314 else { 31315 for(var i = 0;i < this.filteredItemIndices.length;i++) { 31316 height += this.GetItemHeight(this.filteredItemIndices[i]); 31317 if(height > scrollTop) { 31318 result = i > 1 ? i - 1 : 0; 31319 break; 31320 } 31321 } 31322 } 31323 return result; 31324 }, 31325 getLastVisibleItemIndex: function(scrollTop) { 31326 var result = -1; 31327 var scrollDiv = this.listBox.GetScrollDivElement(); 31328 var scrollDivHeight = scrollDiv.clientHeight; 31329 var scrollContainerHeight = this.GetScrollDivChildElementHeight(); 31330 var scrollToBottom = scrollContainerHeight <= scrollDivHeight ? false : scrollTop >= scrollContainerHeight - scrollDivHeight; 31331 if(scrollToBottom) { 31332 result = this.filteredItemIndices[this.filteredItemIndices.length - 1]; 31333 } 31334 else { 31335 var height = 0; 31336 result = this.filteredItemIndices.length - 1; 31337 if(this.filteredItemIndices) { 31338 for(var i = 0;i < this.filteredItemIndices.length;i++) { 31339 height += this.GetItemHeight(this.filteredItemIndices[i]); 31340 if(height >= (scrollTop + scrollDivHeight)) { 31341 result = i; 31342 break; 31343 } 31344 } 31345 } 31346 } 31347 return result == this.filteredItemIndices.length - 1 ? result : result + 1; 31348 }, 31349 UpdateHintControl: function() { 31350 ASPxClientHint.hideByTargetsContainerElement(this.listTable, true); 31351 ASPxClientHint.Update(); 31352 }, 31353 GetScrollContentHeight: function() { 31354 return this.GetVirtualScrollTopSpacer().getBoundingClientRect().height 31355 + this.listBox.GetTopScrollSpacerHeight() + this.listBox.GetBottomScrollSpacerHeight() 31356 + this.listTable.getBoundingClientRect().height; 31357 }, 31358 removeItems: function(indicesToRemove) { 31359 var renderedItemIndexesBeforeModification = this.virtualScrollVisibleItemIndices; 31360 var removedFromTopItemsHeight = 0; 31361 for(var i = 0;i < indicesToRemove.length;i++) { 31362 var itemIndex = indicesToRemove[i]; 31363 if(renderedItemIndexesBeforeModification.indexOf(itemIndex) === 0) { 31364 removedFromTopItemsHeight += this.GetItemHeight(itemIndex); 31365 renderedItemIndexesBeforeModification = renderedItemIndexesBeforeModification.slice(1); 31366 } 31367 this.listBox.RemoveItemRow(itemIndex); 31368 } 31369 return removedFromTopItemsHeight; 31370 }, 31371 insertItems: function(indicesToInsert) { 31372 var firstVisibleItemIndexBeforeInsert = this.GetFirstVisibleItem(); 31373 var scrollableContainerHeightDelta = 0; 31374 var insertedToTopItemsHeight = 0; 31375 for(var i = 0;i < indicesToInsert.length;i++) { 31376 var itemIndex = indicesToInsert[i]; 31377 if(itemIndex < firstVisibleItemIndexBeforeInsert) { 31378 insertedToTopItemsHeight += this.GetItemHeight(itemIndex); 31379 } 31380 this.listBox.InsertItemRow(itemIndex, this.deserializedItems[itemIndex]); 31381 if(!this.deserializedItems[itemIndex].calculatedHeight) { 31382 var itemRowElement = this.GetItemRow(itemIndex); 31383 var imageElements = itemRowElement.querySelectorAll("img"); 31384 var updateCalculatedHeightFunction = function(itemIndex, itemRowElement) { 31385 this.deserializedItems[itemIndex].calculatedHeight = this.GetVirtualScrollItemHeight(itemRowElement); 31386 this.RecreateItemRows(this.getScrollPosition(),true); 31387 }; 31388 for(var j = 0;j < imageElements.length;j++) { 31389 var img = imageElements[j]; 31390 if(!img.complete) { 31391 ASPx.Evt.AttachEventToElement(img, "load", updateCalculatedHeightFunction.bind(this, itemIndex, itemRowElement)); 31392 ASPx.Evt.AttachEventToElement(img, "error", updateCalculatedHeightFunction.bind(this, itemIndex, itemRowElement)); 31393 } 31394 } 31395 this.deserializedItems[itemIndex].calculatedHeight = this.GetVirtualScrollItemHeight(itemRowElement); 31396 if(itemIndex < firstVisibleItemIndexBeforeInsert) { 31397 scrollableContainerHeightDelta += this.deserializedItems[itemIndex].calculatedHeight - this.smallestItemHeight; 31398 } 31399 } 31400 var isItemSelected = this.listBox.GetIsItemSelected(itemIndex); 31401 var stateController = typeof (ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null; 31402 this.listBox.SetItemSelectionAppearance(itemIndex, isItemSelected, stateController, false); 31403 if (this.listBox.GetIsCheckColumnExists()) 31404 this.listBox.SetCheckBoxChecked(itemIndex, isItemSelected); 31405 this.listBox.ChangeEnabledStateItem(itemIndex, this.listBox.GetEnabled(), stateController); 31406 } 31407 return { 31408 scrollableContainerHeightDelta: scrollableContainerHeightDelta, 31409 insertedToTopItemsHeight: insertedToTopItemsHeight 31410 }; 31411 }, 31412 RecreateItemRowsByVisibleIndices: function(newVisibleIndices, keepTopSpacerHeight, recreateItemsPartially) { 31413 if(recreateItemsPartially == "undefined") throw new Error("recreateItemsPartially"); 31414 if(keepTopSpacerHeight == "undefined") throw new Error("keepTopSpacerHeight"); 31415 newVisibleIndices = newVisibleIndices || []; 31416 var indicesToRemove = this.virtualScrollVisibleItemIndices.filter(function(index) { 31417 return newVisibleIndices.indexOf(index) === -1; 31418 }); 31419 var indicesToInsert = newVisibleIndices.filter(function(index) { 31420 return this.virtualScrollVisibleItemIndices.indexOf(index) === -1; 31421 }.bind(this)); 31422 this.listBox.LockSynchronization(); 31423 var removedFromTopItemsHeight = this.removeItems(indicesToRemove); 31424 var insertionInfo = this.insertItems(indicesToInsert); 31425 var scrollableContainerHeightDelta = insertionInfo.scrollableContainerHeightDelta; 31426 var insertedToTopItemsHeight = insertionInfo.insertedToTopItemsHeight; 31427 this.virtualScrollVisibleItemIndices = newVisibleIndices; 31428 this.UpdateScrollTableContainerHeight();
31429 this.listBox.TryApplyHighlighting(); 31430 this.listBox.UnlockSynchronization(); 31431 if(recreateItemsPartially) { 31432 var virtualScrollTopSpacer = this.GetVirtualScrollTopSpacer(); 31433 var newHeight = virtualScrollTopSpacer.getBoundingClientRect().height - insertedToTopItemsHeight + removedFromTopItemsHeight; 31434 newHeight = newHeight >= 0 ? newHeight : 0; 31435 ASPx.SetStyles(virtualScrollTopSpacer, { height: newHeight }); 31436 if(scrollableContainerHeightDelta !== 0) { 31437 this.DeactivateScrollHandler(); 31438 this.listBox.GetScrollDivElement().scrollTop += scrollableContainerHeightDelta; 31439 } 31440 } 31441 else if(!keepTopSpacerHeight) 31442 this.UpdateVirtualScrollSpacerHeight(newVisibleIndices); 31443 this.listBox.InitDXTextAttributes(); 31444 }, 31445 GetVirtualScrollTableContainer: function () { 31446 return this.listBox.tempCache.Get("virtualScrollTableContainer", this.GetVirtualScrollTableContainerCore.aspxBind(this), this.listBox); 31447 }, 31448 GetVirtualScrollTableContainerCore: function () { 31449 if (!ASPx.IsExistsElement(this.listBox.virtualScrollTableContainer)) 31450 this.listBox.virtualScrollTableContainer = ASPx.GetElementById(this.listBox.name + ListBoxVirtualScrollTableContainerIDPostfix); 31451 return this.listBox.virtualScrollTableContainer; 31452 }, 31453 GetVirtualScrollTopSpacer: function () { 31454 return this.listBox.tempCache.Get("virtualScrollTopSpacer", this.GetVirtualScrollTopSpacerCore.aspxBind(this), this.listBox); 31455 }, 31456 GetVirtualScrollTopSpacerCore: function () { 31457 if (!ASPx.IsExistsElement(this.listBox.virtualScrollTopSpacer)) 31458 this.listBox.virtualScrollTopSpacer = ASPx.GetElementById(this.listBox.name + "VirtualScrollTopSpacer"); 31459 return this.listBox.virtualScrollTopSpacer; 31460 }, 31461 GetRenderedItemRange: function () { 31462 var firstRenderedItem = this.GetFirstRenderedItem(); 31463 var lastRenderedItem = this.GetLastRenderedItem(); 31464 return { 31465 startIndex: firstRenderedItem ? firstRenderedItem.index : -1, 31466 endIndex: lastRenderedItem ? lastRenderedItem.index : -1 31467 }; 31468 }, 31469 IsIndexInRenderedItemRange: function(index) { 31470 var renderedItemRange = this.GetRenderedItemRange(); 31471 return index >= renderedItemRange.startIndex && index <= renderedItemRange.endIndex; 31472 }, 31473 IsItemRendered: function (itemIndex) { 31474 return this.GetItemRow(itemIndex) !== null; 31475 }, 31476 IsItemTextWrapEnabled: function() { 31477 if(!ASPx.IsExists(this.enableItemTextWrap)) { 31478 var sampleItemFirstTextCell = this.listBox.GetSampleItemFirstTextCell(); 31479 this.enableItemTextWrap = sampleItemFirstTextCell && ASPx.GetCurrentStyle(sampleItemFirstTextCell).whiteSpace !== "nowrap"; 31480 } 31481 return this.enableItemTextWrap; 31482 }, 31483 OnDecoratedItemsRendering: function () { 31484 if(this.listBox.hasDecoratedItems && !this.IsFixedWidth() && this.listBox.IsDisplayed() && !this.IsItemTextWrapEnabled()) 31485 this.listBox.CorrectWidth(); 31486 }, 31487 DeactivateScrollHandler: function() { 31488 this.isScrollProcessingActivated = false; 31489 }, 31490 ActivateScrollHandler: function() { 31491 this.isScrollProcessingActivated = true; 31492 }, 31493 CorrectItemsHeight: function() { 31494 var needUpdateSmallestItemSize = false; 31495 var rows = this.GetListTableRows(); 31496 for(var i = 0; i < rows.length; i++) { 31497 var row = rows[i]; 31498 var index = row.itemIndex; 31499 if(index != undefined) { 31500 var deserializedItem = this.GetDeserializedItemByIndex(index); 31501 var rowHeight = this.GetVirtualScrollItemHeight(row); 31502 if(deserializedItem.calculatedHeight != rowHeight) { 31503 this.deserializedItems[index].calculatedHeight = rowHeight; 31504 needUpdateSmallestItemSize = true; 31505 } 31506 } 31507 } 31508 if(needUpdateSmallestItemSize) { 31509 this.smallestItemHeight = 0; 31510 this.updateSmallestItemSize(); 31511 } 31512 }, 31513 GetDeserializedItemByIndex: function(itemIndex) { 31514 return this.deserializedItems.filter(function(item) { return item.index == itemIndex; })[0]; 31515 }, 31516 IsScrollActivated: function() { 31517 return this.isScrollProcessingActivated; 31518 } 31519}); 31520var ASPxClientListEdit = ASPx.CreateClass(ASPxClientEdit, { 31521 constructor: function(name) { 31522 this.constructor.prototype.constructor.call(this, name); 31523 this.SelectedIndexChanged = new ASPxClientEvent(); 31524 this.savedSelectedIndex = -1; 31525 }, 31526 FindInputElement: function() { 31527 return this.FindStateInputElement(); 31528 }, 31529 FindStateInputElement: function(){ 31530 return document.getElementById(this.name + leVISuffix); 31531 }, 31532 GetItem: function(index) { 31533 throw "Not implemented"; 31534 },
31535 GetItemValue: function(index) { 31536 throw "Not implemented"; 31537 }, 31538 GetValue: function(){ 31539 return this.GetItemValue(this.GetSelectedIndex()); 31540 }, 31541 GetSelectedIndexInternal: function(){ 31542 return this.savedSelectedIndex; 31543 }, 31544 SetSelectedIndexInternal: function(index){ 31545 this.savedSelectedIndex = index; 31546 }, 31547 FindItemIndexByValue: function(value){ 31548 for(var i = 0; i < this.GetItemCount(); i++){ 31549 if(this.GetItemValue(i) == value) 31550 return i; 31551 } 31552 return -1; 31553 }, 31554 RaiseItemClick: function() { 31555 var processOnServer = this.autoPostBack; 31556 if(!this.ItemClick.IsEmpty()){ 31557 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 31558 this.ItemClick.FireEvent(this, args); 31559 processOnServer = args.processOnServer; 31560 } 31561 return processOnServer; 31562 }, 31563 RaiseItemDoubleClick: function() { 31564 var processOnServer = this.autoPostBack; 31565 if(!this.ItemDoubleClick.IsEmpty()){ 31566 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 31567 this.ItemDoubleClick.FireEvent(this, args); 31568 processOnServer = args.processOnServer; 31569 } 31570 return processOnServer; 31571 }, 31572 RaiseValueChangedEvent: function() { 31573 if(!this.isInitialized) return false; 31574 var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this); 31575 processOnServer = this.RaiseValueChangedAdditionalEvents(processOnServer); 31576 return processOnServer; 31577 }, 31578 RaiseValueChangedAdditionalEvents: function(processOnServer){ 31579 return this.RaiseSelectedIndexChanged(processOnServer); 31580 }, 31581 RaiseSelectedIndexChanged: function (processOnServer) { 31582 this.RaiseValidationInternal(); 31583 if(!this.SelectedIndexChanged.IsEmpty()){ 31584 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 31585 this.SelectedIndexChanged.FireEvent(this, args); 31586 processOnServer = args.processOnServer; 31587 } 31588 return processOnServer; 31589 }, 31590 UpdateHiddenInputs: function(){ 31591 var element = this.FindStateInputElement(); 31592 if(ASPx.IsExistsElement(element)) { 31593 var value = this.GetValue(); 31594 if(value == null) 31595 value = ""; 31596 element.value = value; 31597 } 31598 }, 31599 GetModifyEvent: function () { 31600 return this.SelectedIndexChanged; 31601 }, 31602 GetSelectedItem: function(){ 31603 var index = this.GetSelectedIndexInternal(); 31604 return this.GetItem(index); 31605 }, 31606 GetSelectedIndex: function(){ 31607 return this.GetSelectedIndexInternal(); 31608 }, 31609 SetSelectedItem: function(item){ 31610 var index = (item != null) ? item.index : -1; 31611 this.SetSelectedIndex(index); 31612 }, 31613 SetSelectedIndex: function(index){ 31614 this.SelectIndexSilent(index); 31615 }, 31616 SelectIndexSilent: function(index){ 31617 throw "Not implemented"; 31618 }, 31619 OnValueChanged: function () { 31620 var processOnServer = this.RaiseValueChangedEvent() && this.GetIsValid(); 31621 if(processOnServer) 31622 this.SendPostBackInternal(""); 31623 }, 31624 getElementToObserveVisibilityChange: function () { 31625 return this.GetMainElement(); 31626 }, 31627 processVisibilityChanged: function (visible) { 31628 var focusHandlingInputForKeyboardSupport = this.GetMainElement().querySelector(".dxKBSI"); 31629 ASPx.ToggleClassNameToElement(focusHandlingInputForKeyboardSupport, "dx-position-fixed", visible); 31630 } 31631}); 31632var ASPxClientListEditItem = ASPx.CreateClass(null, { 31633 constructor: function(listEditBase, index, text, value, imageUrl){ 31634 this.listEditBase = listEditBase; 31635 this.index = index; 31636 this.imageUrl = imageUrl; 31637 this.text = text; 31638 this.value = value; 31639 } 31640}); 31641var ASPxClientListBoxItem = ASPx.CreateClass(ASPxClientListEditItem, { 31642 constructor: function(listEditBase, index, texts, value, imageUrl, selected, cellStyles, cellCssClasses, cellTooltips, cellAttributes, htmlContents, style, cssClass, tooltip, attributes, htmlContent) { 31643 this.constructor.prototype.constructor.call(this, listEditBase, index, null, value, imageUrl); 31644 this.selected = !!selected; 31645 this.texts = texts; 31646 this.text = listEditBase.FormatText(texts, value); 31647 this.cellStyles = cellStyles; 31648 this.cellCssClasses = cellCssClasses; 31649 this.cellTooltips = cellTooltips; 31650 this.cellAttributes = cellAttributes; 31651 this.htmlContents = htmlContents; 31652 this.style = style; 31653 this.cssClass = cssClass; 31654 this.tooltip = tooltip; 31655 this.attributes = attributes; 31656 this.htmlContent = htmlContent; 31657 }, 31658 GetColumnText: function(columnIndexOrFieldName){ 31659 var columnIndex = -1; 31660 if(typeof(columnIndexOrFieldName) == "string") 31661 columnIndex = ASPx.Data.ArrayIndexOf(this.listEditBase.columnFieldNames, columnIndexOrFieldName); 31662 else if(typeof(columnIndexOrFieldName) == "number") 31663 columnIndex = columnIndexOrFieldName; 31664 return this.GetColumnTextByIndex(columnIndex); 31665 }, 31666 GetColumnTextByIndex: function(columnIndex){ 31667 if(0 <= columnIndex && columnIndex < this.texts.length) 31668 return this.texts[columnIndex]; 31669 else 31670 return null; 31671 } 31672}); 31673var ListBoxScrollCallbackHelperBase = ASPx.CreateClass(null, { 31674 constructor: function(listBoxControl) { 31675 this.listBoxControl = listBoxControl; 31676 this.itemsRange = ""; 31677 this.defaultItemsRange = "0:" + (this.listBoxControl.callbackPageSize - 1); 31678 }, 31679 OnScroll: function(){ }, 31680 Reset: function(){ }, 31681 IsScrolledToTopSpacer: function(){ return false; }, 31682 IsScrolledToBottomSpacer: function(){ return false; }, 31683 GetIsNeedToHideTopSpacer: function(){ return false; }, 31684 GetIsNeedCallback: function(){ return false; }, 31685 GetIsAnySpacerVisible: function() { return false; }, 31686 GetItemsRangeForLoad: function(){ return this.defaultItemsRange; }, 31687 SetItemsRangeForLoad: function(){} 31688}); 31689var ListBoxScrollCallbackHelper = ASPx.CreateClass(ListBoxScrollCallbackHelperBase, { 31690 constructor: function(listBoxControl) { 31691 this.constructor.prototype.constructor.call(this, listBoxControl); 31692 this.isScrolledToTopSpacer = false; 31693 this.isScrolledToBottomSpacer = false; 31694 }, 31695 OnScroll: function(){ 31696 this.DetectScrollDirection(); 31697 this.ResetItemsRange(); 31698 if(this.GetIsAnySpacerVisible()) 31699 this.RecalcItemsRangeForLoad(); 31700 }, 31701 DetectScrollDirection: function(){ 31702 var listBoxControl = this.listBoxControl; 31703 var divElement = listBoxControl.GetScrollDivElement(); 31704 var scrollTop = divElement.scrollTop; 31705 var scrollBottom = divElement.scrollTop + divElement.clientHeight; 31706 var isTopSpacerVisible = listBoxControl.GetScrollSpacerVisibility(true); 31707 var isBottomSpacerVisible = listBoxControl.GetScrollSpacerVisibility(false); 31708 this.isScrolledToTopSpacer = (scrollTop < parseInt(listBoxControl.GetTopSpacersHeight())) && isTopSpacerVisible; 31709 var listHeight = this.GetListHeight(); 31710 this.isScrolledToBottomSpacer = (scrollBottom >= listBoxControl.GetTopSpacersHeight() + listHeight) && isBottomSpacerVisible; 31711 }, 31712 GetListHeight: function () { 31713 var listTable = this.listBoxControl.GetListTable(); 31714 return listTable.clientHeight; 31715 }, 31716 Reset: function(){ 31717 this.ResetItemsRange(); 31718 this.isScrolledToTopSpacer = false; 31719 this.isScrolledToBottomSpacer = false; 31720 }, 31721 ResetItemsRange: function(){ 31722 this.itemsRange = ""; 31723 }, 31724 RecalcItemsRangeForLoad: function(){ 31725 if(this.listBoxControl.isCallbackMode) { 31726 if(this.isScrolledToTopSpacer || this.isScrolledToBottomSpacer) 31727 this.SetItemsRangeForLoad(this.isScrolledToTopSpacer); 31728 } 31729 }, 31730 IsScrolledToTopSpacer: function(){ 31731 return this.isScrolledToTopSpacer; 31732 }, 31733 IsScrolledToBottomSpacer: function(){ 31734 return this.isScrolledToBottomSpacer; 31735 }, 31736 GetIsAnySpacerVisible: function(){ 31737 return this.isScrolledToTopSpacer || this.isScrolledToBottomSpacer; 31738 }, 31739 GetIsNeedCallback: function(){ 31740 return !this.GetIsItemsRangeEmpty(); 31741 }, 31742 GetIsNeedToHideTopSpacer: function(){ 31743 return this.isScrolledToTopSpacer && this.GetIsItemsRangeEmpty(); 31744 }, 31745 GetItemsRangeForLoad: function(){ 31746 return (!this.GetIsItemsRangeEmpty() ? this.itemsRange : this.defaultItemsRange); 31747 }, 31748 SetItemsRangeForLoad: function(isForTop){ 31749 var listbox = this.listBoxControl; 31750 var beginIndex = isForTop ? 31751 listbox.serverIndexOfFirstItem - listbox.callbackPageSize : 31752 listbox.serverIndexOfFirstItem + listbox.GetItemCount(); 31753 beginIndex = beginIndex < 0 ? 0 : beginIndex; 31754 var endIndex = isForTop ? 31755 listbox.serverIndexOfFirstItem - 1 : 31756 beginIndex + listbox.callbackPageSize - 1; 31757 this.itemsRange = beginIndex + ":" + endIndex; 31758 this.isScrolledToTopSpacer = isForTop; 31759 this.isScrolledToBottomSpacer = !isForTop; 31760 }, 31761 GetIsItemsRangeEmpty: function(){ 31762 return (this.itemsRange == "" || this.itemsRange == emptyItemsRange); 31763 } 31764}); 31765var ASPxClientListBoxBase = ASPx.CreateClass(ASPxClientListEdit, { 31766 constructor: function(name) { 31767 this.constructor.prototype.constructor.call(this, name); 31768 this.APILockCount = 0; 31769 this.updateSelectAllElementsLockCount = 0; 31770 this.enableSyncOnPerfCallback = false; 31771 this.scrollOnKBNavigationLockCount = 0; 31772 this.isComboBoxList = false; 31773 this.isSyncEnabled = true; 31774 this.ownerName = ""; 31775 this.selectionEventsLockCount = 0; 31776 this.syncLockCount = 0; 31777 this.encodeHtml = true; 31778 this.useCaseInsensitiveSearch = true; 31779 this.serializingHelper = null; 31780 this.deletedItems = []; 31781 this.insertedItems = []; 31782 this.itemsValue = []; 31783 this.ItemDoubleClick = new ASPxClientEvent();
31784 this.ItemClick = new ASPxClientEvent(); 31785 }, 31786 InlineInitialize: function () { 31787 ASPxClientListEdit.prototype.InlineInitialize.call(this); 31788 for(var i = 0; i < this.itemsValue.length; i++) 31789 this.itemsValue[i] = this.GetDecodeValue(this.itemsValue[i]); 31790 }, 31791 LockScrollOnKBNavigation: function(){ 31792 this.scrollOnKBNavigationLockCount++; 31793 }, 31794 UnlockScrollOnKBNavigation: function(){ 31795 this.scrollOnKBNavigationLockCount--; 31796 }, 31797 IsScrollOnKBNavigationLocked: function() { 31798 return this.scrollOnKBNavigationLockCount > 0; 31799 }, 31800 LockSelectionEvents: function(){ 31801 this.selectionEventsLockCount++; 31802 }, 31803 UnlockSelectionEvents: function(){ 31804 this.selectionEventsLockCount--; 31805 }, 31806 IsSelectionEventsLocked: function(){ 31807 return this.selectionEventsLockCount > 0; 31808 }, 31809 LockSynchronizationOnInternalCallback: function(){ 31810 if(!this.enableSyncOnPerfCallback) 31811 this.LockSynchronization(); 31812 }, 31813 UnlockSynchronizationOnInternalCallback: function (){ 31814 if(!this.enableSyncOnPerfCallback) 31815 this.UnlockSynchronization(); 31816 }, 31817 GetItemCount: function(){ 31818 return 0; 31819 }, 31820 GetItemValue: function(index){ 31821 if(0 <= index && index < this.GetItemCount()) 31822 return this.PrepareItemValue(this.itemsValue[index]); 31823 return null; 31824 }, 31825 GetItemTexts: function(item) { 31826 return item.text; 31827 }, 31828 PrepareItemValue: function(value) { 31829 return (typeof(value) == "string" && value == "" && this.convertEmptyStringToNull) ? null : value; 31830 }, 31831 LoadItemsFromCallback: function(isToTop, itemStrings){ 31832 }, 31833 SetValue: function(value){ 31834 var index = this.FindItemIndexByValue(value); 31835 this.SelectIndexSilentAndMakeVisible(index); 31836 }, 31837 FindItemIndexByText: function(text){ 31838 var transformText = function(text) { return text; }; 31839 var textIsString = typeof(text) === "string"; 31840 if(this.useCaseInsensitiveSearch && textIsString) 31841 transformText = function(text) { return text.toUpperCase(); }; 31842 text = transformText(text); 31843 for(var i = 0; i < this.GetItemCount(); i ++){ 31844 if(transformText(this.GetItem(i).text) == text) 31845 return i; 31846 } 31847 return -1; 31848 }, 31849 SelectIndex: function (index){ 31850 if(this.SelectIndexSilentAndMakeVisible(index, false)){ 31851 this.RaisePersonalStandardValidation(); 31852 this.OnValueChanged(); 31853 } 31854 }, 31855 SelectIndexSilentAndMakeVisible: function(index, lockScrollingToItem){ 31856 var selectionChanged = this.SelectIndexSilent(index); 31857 if(!this.IsScrollOnKBNavigationLocked() && !lockScrollingToItem && selectionChanged) 31858 this.MakeItemVisible(index); 31859 return selectionChanged; 31860 }, 31861 FormatText: function (texts) { 31862 return texts; 31863 }, 31864 MakeItemVisible: function(index){ 31865 }, 31866 InitOnContainerMadeVisible: function(){ 31867 }, 31868 AddItem: function(texts, value, imageUrl) { 31869 return this.AddItemInternal(this.CreateItemProperties(texts, value, imageUrl)); 31870 }, 31871 AddItemInternal: function(itemProperties) { 31872 var index = this.GetItemCount(); 31873 this.InsertItemInternal(index, itemProperties); 31874 if(!ASPx.IsExists(this.GetItem(index))) 31875 index = -1; 31876 return index; 31877 }, 31878 InsertItem: function(index, texts, value, imageUrl) { 31879 this.InsertItemInternal(index, this.CreateItemProperties(texts, value, imageUrl)); 31880 }, 31881 CreateItemProperties: function(texts, value, imageUrl, htmlContent, cssClass, tooltip) { 31882 return { 31883 texts: texts, 31884 value: value, 31885 imageUrl: imageUrl, 31886 htmlContent: htmlContent, 31887 cssClass: cssClass, 31888 tooltip: tooltip 31889 }; 31890 }, 31891 InsertItemInternal: function(index, itemProperties) { 31892 }, 31893 BeginUpdate: function(){ 31894 this.APILockCount ++; 31895 }, 31896 EndUpdate: function(){ 31897 this.APILockCount --; 31898 this.Synchronize(); 31899 }, 31900 LockUpdateSelectAllElements: function() { 31901 this.updateSelectAllElementsLockCount++; 31902 }, 31903 UnlockUpdateSelectAllElements: function () { 31904 this.updateSelectAllElementsLockCount--; 31905 }, 31906 IsUpdateSelectAllElementsLocked: function() { 31907 return this.updateSelectAllElementsLockCount > 0; 31908 }, 31909 ClearItems: function(){ 31910 this.BeginUpdate(); 31911 this.UpdateArraysItemsCleared(); 31912 this.ClearItemsCore(); 31913 this.EndUpdate(); 31914 }, 31915 ClearItemsCore: function(){ 31916 }, 31917 ClearItemsForPerformCallback: function(){ 31918 this.itemsValue = []; 31919 this.ClearItemsCore(); 31920 }, 31921 RemoveItem: function(index){ 31922 }, 31923 FindItemByText: function(text){ 31924 var index = this.FindItemIndexByText(text); 31925 return this.GetItem(index); 31926 }, 31927 FindItemByValue: function(value){ 31928 var index = this.FindItemIndexByValue(value); 31929 return this.GetItem(index); 31930 }, 31931 PerformCallback: function(arg) { 31932 }, 31933 GetCallbackArguments: function(){ 31934 var args = this.GetCustomCallbackArg(); 31935 args += this.GetLoadItemsRangeCallbackArg(); 31936 if(this.filterStrategy) 31937 args += this.filterStrategy.GetCallbackArguments(); 31938 return args; 31939 }, 31940 GetLoadItemsRangeCallbackArg: function(){ 31941 return this.GetLoadItemsRangeCallbackArgCore(this.GetItemsRangeForLoad()); 31942 }, 31943 GetLoadCustomItemsRangeCallbackArguments: function(beginIndex, endIndex, value) { 31944 var itemsRange = beginIndex + ":" + endIndex; 31945 if(ASPx.IsExists(value)) 31946 itemsRange = itemsRange + ":" + ASPx.Json.ToJson(value); 31947 var args = this.GetCustomCallbackArg(); 31948 args += this.GetLoadItemsRangeCallbackArgCore(itemsRange); 31949 return args; 31950 }, 31951 GetLoadItemsRangeCallbackArgCore: function(itemsRange) { 31952 return this.FormatCallbackArg(CONSTANTS.CALLBACK_PREFIXES.LOAD_RANGE_ITEMS, itemsRange); 31953 }, 31954 FormatCallbackArg: function(prefix, arg) { 31955 arg = arg.toString(); 31956 return (ASPx.IsExists(arg) ? prefix + "|" + arg.length + ';' + arg + ';' : ""); 31957 }, 31958 GetItemsRangeForLoad: function(){ 31959 return emptyItemsRange; 31960 }, 31961 GetCallbackOwnerControl: function(){ 31962 if(this.ownerName && !this.ownerControl) 31963 this.ownerControl = ASPx.GetControlCollection().Get(this.ownerName); 31964 return this.ownerControl; 31965 }, 31966 GetCustomCallbackArg: function(){ 31967 return this.stateObject["CustomCallback"]; 31968 }, 31969 SetCustomCallbackArg: function(arg){ 31970 this.UpdateStateObjectWithObject({ CustomCallback: arg }); 31971 }, 31972 FormatAndSetCustomCallbackArg: function(arg, onPerformCallback){ 31973 arg = ASPx.IsExists(arg) ? arg.toString() : ""; 31974 var formatArg = this.FormatCallbackArg(onPerformCallback ? CONSTANTS.CALLBACK_PREFIXES.CUSTOMPERFORM : CONSTANTS.CALLBACK_PREFIXES.CUSTOM, arg); 31975 this.SetCustomCallbackArg(formatArg); 31976 }, 31977 SendCallback: function(){ 31978 }, 31979 LockSynchronization: function(){ 31980 this.syncLockCount++; 31981 }, 31982 UnlockSynchronization: function(){ 31983 this.syncLockCount--; 31984 }, 31985 IsSyncLocked: function(){ 31986 return this.syncLockCount > 0; 31987 }, 31988 IsSyncEnabled: function(){ 31989 return this.isSyncEnabled && !this.IsSyncLocked(); 31990 }, 31991 RegisterInsertedItem: function(index, itemProperties){ 31992 if(this.IsSyncEnabled()){ 31993 this.RefreshSynchroArraysIndex(index, true); 31994 var item = this.CreateItem(index, itemProperties); 31995 this.insertedItems.push(item); 31996 this.Synchronize(); 31997 } 31998 }, 31999 CreateItem: function(index, itemProperties) { 32000 return new ASPxClientListBoxItem(this, index, itemProperties.texts || [itemProperties.text], itemProperties.value, itemProperties.imageUrl, 32001 itemProperties.selected, itemProperties.cellStyles, itemProperties.cellCssClasse
32001s, itemProperties.cellTooltips, itemProperties.cellAttributes, itemProperties.htmlContents, 32002 itemProperties.style, itemProperties.cssClass, itemProperties.tooltip, itemProperties.attributes, itemProperties.htmlContent); 32003 }, 32004 UpdateSyncArraysItemDeleted: function(item, isValueRemovingRequired){ 32005 if(isValueRemovingRequired) 32006 ASPx.Data.ArrayRemoveAt(this.itemsValue, item.index); 32007 if(this.IsSyncEnabled()){ 32008 var index = this.FindItemInArray(this.insertedItems, item); 32009 if(index == -1){ 32010 this.RefreshSynchroArraysIndex(item.index, false); 32011 this.deletedItems.push(item); 32012 } else { 32013 this.RefreshSynchroArraysIndex(item.index, false); 32014 ASPx.Data.ArrayRemoveAt(this.insertedItems, index); 32015 } 32016 this.Synchronize(); 32017 } 32018 }, 32019 UpdateArraysItemsCleared: function(){ 32020 if(this.IsSyncEnabled()){ 32021 for(var i = this.GetItemCount() - 1; i >= 0; i --) 32022 this.UpdateSyncArraysItemDeleted(this.GetItem(i), false); 32023 } 32024 this.itemsValue = []; 32025 }, 32026 RefreshSynchroArraysIndex: function(startIndex, isIncrease){ 32027 this.RefreshSynchroArrayIndexIndex(this.deletedItems, startIndex, isIncrease); 32028 this.RefreshSynchroArrayIndexIndex(this.insertedItems, startIndex, isIncrease); 32029 }, 32030 RefreshSynchroArrayIndexIndex: function(array, startIndex, isIncrease){ 32031 var delta = isIncrease ? 1 : -1; 32032 for(var i = 0; i < array.length; i ++){ 32033 if(array[i].index >= startIndex) 32034 array[i].index += delta; 32035 } 32036 }, 32037 FindItemInArray: function(array, item){ 32038 for(var i = array.length - 1; i >= 0; i--){ 32039 var currentItem = array[i]; 32040 if((!this.encodeHtml || currentItem.text == item.text) && currentItem.value == item.value && 32041 currentItem.imageUrl == item.imageUrl) 32042 break; 32043 } 32044 return i; 32045 }, 32046 Synchronize: function(){ 32047 if(this.APILockCount == 0){ 32048 if(this.IsSyncEnabled()){ 32049 this.SynchronizeItems(this.deletedItems, "DeletedItems"); 32050 this.SynchronizeItems(this.insertedItems, "InsertedItems"); 32051 } 32052 this.CorrectSizeByTimer(); 32053 } 32054 }, 32055 CorrectSizeByTimer: function(){ 32056 }, 32057 SynchronizeItems: function(items, syncType){ 32058 var itemsObj = { }; 32059 itemsObj[syncType] = this.SerializeItems(items); 32060 this.UpdateStateObjectWithObject(itemsObj); 32061 }, 32062 GetSerializingHelper: function(){ 32063 if(this.serializingHelper == null) 32064 this.serializingHelper = this.CreateSerializingHelper(); 32065 return this.serializingHelper; 32066 }, 32067 CreateSerializingHelper: function(){ 32068 return new ListBoxBaseItemsSerializingHelper(this); 32069 }, 32070 SerializeItems: function(items){ 32071 var serialiser = this.GetSerializingHelper(); 32072 return serialiser.SerializeItems(items); 32073 }, 32074 DeserializeItems: function(items) { 32075 return items.map(function(itemProperties, index) { 32076 return this.CreateItem(index, itemProperties); 32077 }.bind(this)); 32078 } 32079}); 32080var ListBoxBaseItemsSerializingHelper = ASPx.CreateClass(null, { 32081 constructor: function(listBoxControl) { 32082 this.listBoxControl = listBoxControl; 32083 this.startPos = 0; 32084 }, 32085 SerializeItems: function(items){ 32086 var sb = [ ]; 32087 for(var i = 0; i < items.length; i++) 32088 this.SerializeItem(sb, items[i]); 32089 return sb.join(""); 32090 }, 32091 SerializeItem: function(sb, item) { 32092 if(!item) 32093 return; 32094 this.SerializeAtomValue(sb, item.index); 32095 this.SerializeAtomValue(sb, item.value); 32096 this.SerializeAtomValue(sb, item.imageUrl); 32097 var texts = this.listBoxControl.GetItemTexts(item); 32098 if(typeof(texts) == "string") 32099 this.SerializeAtomValue(sb, texts); 32100 else { 32101 for(var i = 0; i < texts.length; i++) 32102 this.SerializeAtomValue(sb, texts[i]); 32103 } 32104 }, 32105 SerializeAtomValue: function(sb, value) { 32106 var valueStr = ASPx.IsExists(value) ? value.toString() : ""; 32107 sb.push(valueStr.length); 32108 sb.push('|'); 32109 sb.push(valueStr); 32110 }, 32111 ParseItemIndex: function(serializedItem){ 32112 return parseInt(this.ParseString(serializedItem)); 32113 }, 32114 ParseItemValue: function(serializedItem){ 32115 return this.ParseString(serializedItem); 32116 }, 32117 ParseString: function(str){ 32118 var indexOfSeparator = str.indexOf(serializingSeparator, this.startPos); 32119 var strLength = parseInt(str.substring(this.startPos, indexOfSeparator)); 32120 var strStartPos = indexOfSeparator + serializingSeparatorLength; 32121 this.startPos = strStartPos + strLength; 32122 return str.substring(strStartPos, strStartPos + strLength); 32123 }, 32124 ParseTexts: function(serializedItems){ 32125 return this.ParseString(serializedItems); 32126 }, 32127 DeserializeValues: function(serializedValues){ 32128 var deserializedValues = []; 32129 this.startPos = 0; 32130 while(this.startPos < serializedValues.length){
32131 deserializedValues.push(this.ParseItemValue(serializedValues)); 32132 } 32133 return deserializedValues; 32134 } 32135}); 32136var ListBoxItemsSerializingHelper = ASPx.CreateClass(ListBoxBaseItemsSerializingHelper, { 32137 constructor: function(listBoxControl) { 32138 this.constructor.prototype.constructor.call(this, listBoxControl); 32139 }, 32140 ParseTexts: function(serializedItems){ 32141 var textColumnCount = this.listBoxControl.GetItemTextCellCount(); 32142 return (textColumnCount > 1) ? this.DeserializeItemTexts(serializedItems, textColumnCount) 32143 : ListBoxBaseItemsSerializingHelper.prototype.ParseTexts.call(this, serializedItems); 32144 }, 32145 DeserializeItemTexts: function(serializedItem, textColumnCount){ 32146 var texts = []; 32147 for(var i = 0; i < textColumnCount; i++) 32148 texts.push(this.ParseString(serializedItem)); 32149 return texts; 32150 } 32151}); 32152var ListBoxSingleSelectionHelper = ASPx.CreateClass(null, { 32153 constructor: function(listBoxControl) { 32154 this.listBoxControl = listBoxControl; 32155 this.savedSelectedIndex = listBoxControl.savedSelectedIndex; 32156 this.updateHiddenInputsLockCount = 0; 32157 this.cachedSelectionChangedArgs = []; 32158 }, 32159 ClearSelection: function(){ 32160 this.SetSelectedIndexCore(-1); 32161 this.OnSelectionCleared(); 32162 }, 32163 OnSelectionCleared: function(){ 32164 this.cachedSelectionChangedArgs = []; 32165 }, 32166 GetSelectedIndexInternal: function(){ 32167 return this.savedSelectedIndex; 32168 }, 32169 SetSelectedIndexInternal: function(index){ 32170 this.savedSelectedIndex = index; 32171 }, 32172 SetSelectedIndexCore: function(index){ 32173 if(index != this.savedSelectedIndex && -1 <= index && index < this.GetItemCount()){ 32174 this.BeginSelectionUpdate(); 32175 this.SetSelectedIndexInternal(index); 32176 this.EndSelectionUpdate(); 32177 return true; 32178 } 32179 return false; 32180 }, 32181 GetSelectedIndex: function(){ 32182 return this.GetSelectedIndexInternal(); 32183 }, 32184 SetSelectedIndex: function(index){ 32185 this.ChangeSelectedItem(index); 32186 this.SetSelectedIndexCore(index); 32187 this.OnItemSelectionChanged(index, true); 32188 }, 32189 GetSelectedIndices: function(){ 32190 var selectedIndex = this.GetSelectedIndexInternal(); 32191 return selectedIndex != -1 ? [selectedIndex] : []; 32192 }, 32193 GetSelectedValues: function(){ 32194 var selectedValue = this.listBoxControl.GetValue(); 32195 return selectedValue != null ? [selectedValue] : []; 32196 }, 32197 GetSelectedItems: function(){ 32198 var selectedItem = this.listBoxControl.GetSelectedItem(); 32199 return selectedItem != null? [selectedItem] : []; 32200 }, 32201 SelectIndices: function(indices){}, 32202 SelectItems: function(items){}, 32203 SelectValues: function(values){}, 32204 UnselectIndices: function (selected) { this.SetSelectedIndex(-1); }, 32205 UnselectItems: function(items){}, 32206 UnselectValues: function(values){}, 32207 GetIsItemSelected: function(index){ return index == this.GetSelectedIndexInternal(); }, 32208 ResetSelectionCollectionsCache: function(){ }, 32209 OnItemClick: function(index, evt){ 32210 var selected = true; 32211 this.BeginSelectionUpdate(); 32212 this.ChangeSelectedItem(index); 32213 var selectedIndexChanged = this.SetSelectedIndexCore(index); 32214 this.EndSelectionUpdate(); 32215 if(selectedIndexChanged) 32216 this.OnItemSelectionChanged(index, selected); 32217 }, 32218 ChangeSelectedItem: function(newSelectedIndex){ 32219 var selected = true; 32220 var oldSelectedIndex = this.GetSelectedIndexInternal(); 32221 this.BeginSelectionUpdate(); 32222 this.SetItemSelectionState(oldSelectedIndex, !selected); 32223 this.SetItemSelectionState(newSelectedIndex, selected); 32224 this.EndSelectionUpdate(); 32225 }, 32226 SetItemSelectionState: function (itemIndex, selected, controller) { 32227 this.BeginSelectionUpdate(); 32228 this.listBoxControl.SetItemSelectionAppearance(itemIndex, selected, controller, true); 32229 this.EndSelectionUpdate(); 32230 }, 32231 GetFocusedIndex: function(){ 32232 return this.GetSelectedIndexInternal(); 32233 }, 32234 BeginSelectionUpdate: function(){ 32235 this.updateHiddenInputsLockCount++; 32236 }, 32237 EndSelectionUpdate: function(){ 32238 this.updateHiddenInputsLockCount--; 32239 if(!this.IsUpdateInternalSelectionStateLocked()){ 32240 this.listBoxControl.UpdateInternalState(); 32241 this.FlushSelectionChanged(); 32242 } 32243 }, 32244 IsUpdateInternalSelectionStateLocked: function(){
32245 return this.updateHiddenInputsLockCount > 0; 32246 }, 32247 GetItemCount: function(){ 32248 return this.listBoxControl.GetItemCount(); 32249 }, 32250 OnItemSelectionChanged: function(index, selected){ 32251 if(this.IsUpdateInternalSelectionStateLocked()){ 32252 var a = {Index: index, Selected: selected}; 32253 this.cachedSelectionChangedArgs.push(a); 32254 } 32255 else 32256 this.listBoxControl.OnItemSelectionChanged(index, selected); 32257 }, 32258 FlushSelectionChanged: function(){ 32259 if(this.IsUpdateInternalSelectionStateLocked()) 32260 return; 32261 for(var i = 0; i < this.cachedSelectionChangedArgs.length; i++) 32262 this.listBoxControl.OnItemSelectionChanged(this.cachedSelectionChangedArgs[i].Index, this.cachedSelectionChangedArgs[i].Selected); 32263 this.cachedSelectionChangedArgs = []; 32264 }, 32265 OnItemInserted: function(index){ 32266 if(index <= this.savedSelectedIndex && this.savedSelectedIndex != -1) 32267 this.SetSelectedIndexInternal(this.savedSelectedIndex + 1); 32268 }, 32269 OnItemRemoved: function(index){ 32270 if(index < this.savedSelectedIndex) 32271 this.SetSelectedIndexInternal( this.savedSelectedIndex - 1); 32272 else if(index == this.savedSelectedIndex) 32273 this.SetSelectedIndexInternal(-1); 32274 }, 32275 OnItemsCleared: function(){ 32276 this.ClearSelection(); 32277 } 32278}); 32279var ListBoxMultiSelectionHelper = ASPx.CreateClass(ListBoxSingleSelectionHelper, { 32280 constructor: function(listBoxControl) { 32281 this.constructor.prototype.constructor.call(this, listBoxControl); 32282 this.selectedValuesCache = []; 32283 this.selectedItemsCache = []; 32284 this.savedSelectedIndices = []; 32285 this.selectedIndicesSortingRequired = false; 32286 this.focusedIndex = -1; 32287 this.lastIndexFocusedWithoutShift = -1; 32288 }, 32289 SetSelectedIndex: function(index){ 32290 this.SingleIndexSelection(index); 32291 }, 32292 SetSelectedIndexCore: function(index){ 32293 ListBoxSingleSelectionHelper.prototype.SetSelectedIndexCore.call(this, index); 32294 this.updateSelectAllElementsState(); 32295 }, 32296 updateSelectAllElementsState: function() { 32297 this.listBoxControl.updateSelectAllElementsState(); 32298 }, 32299 ResetSelectionCollectionsCache: function(){ 32300 this.selectedIndicesSortingRequired = true; 32301 this.selectedItemsCache = []; 32302 this.selectedValuesCache = []; 32303 }, 32304 GetSelectedIndices: function(){ 32305 return this.GetSortedSelectedIndices().slice(); 32306 }, 32307 GetSortedSelectedIndices: function() { 32308 if(this.savedSelectedIndices.length > 1 && this.selectedIndicesSortingRequired) 32309 this.SortSelectedIndices(); 32310 return this.savedSelectedIndices; 32311 }, 32312 GetSelectedValues: function(){ 32313 if(this.savedSelectedIndices.length == 0) 32314 return []; 32315 if(this.selectedValuesCache.length == 0) 32316 this.selectedValuesCache = this.GetSelectedValuesCore(); 32317 return this.selectedValuesCache; 32318 }, 32319 GetSelectedValuesCore: function(){ 32320 var selectedValues = []; 32321 var selectedIndices = this.GetSortedSelectedIndices(); 32322 if(selectedIndices.length == 0) 32323 return selectedValues; 32324 for(var i = 0; i < selectedIndices.length; i++) 32325 selectedValues.push(this.listBoxControl.GetItemValue([selectedIndices[i]])); 32326 return selectedValues; 32327 }, 32328 GetSelectedItems: function(){ 32329 if(this.savedSelectedIndices.length == 0) 32330 return []; 32331 if(this.selectedItemsCache.length == 0) 32332 this.selectedItemsCache = this.GetSelectedItemsCore(); 32333 return this.selectedItemsCache; 32334 }, 32335 GetSelectedItemsCore: function(){ 32336 var selectedItems = []; 32337 for(var i = 0; i < this.savedSelectedIndices.length; i++) 32338 selectedItems.push(this.listBoxControl.GetItem(this.savedSelectedIndices[i])); 32339 return selectedItems; 32340 }, 32341 SetIndicesSelectionState: function(indices, selected){ 32342 this.BeginSelectionUpdate(); 32343 var controller = typeof(ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null; 32344 if(indices){ 32345 var itemCount = this.listBoxControl.GetItemCount(); 32346 for(var i = 0; i < indices.length; i++) { 32347 var index = indices[i]; 32348 if(index >= 0 && index < itemCount) 32349 this.SetItemSelectionState(indices[i], selected, controller); 32350 } 32351 } else if(this.IsClientFilterApplied()) 32352 this.SetAllFilteredItemsSelectionState(selected, controller); 32353 else 32354 this.SetAllItemsSelectionState(selected, controller); 32355 this.SetSelectedIndexCore(this.GetFirstSelectedIndex()); 32356 this.EndSelectionUpdate(); 32357 }, 32358 IsClientFilterApplied: function() { 32359 return this.listBoxControl.IsClientFilterApplied(); 32360 }, 32361 SetAllFilteredItemsSelectionState: function (selected, controller) { 32362 for (var i = 0; i < this.listBoxControl.GetItemCount() ; i++) { 32363 if (this.listBoxControl.IsItemFiltered && !this.listBoxControl.IsItemFiltered(i)) 32364 continue; 32365 this.SetItemSelectionState(i, selected, controller); 32366 } 32367 }, 32368 SetItemsSelectionState: function(items, selected){ 32369 var indices = items ? this.ConvertItemsToIndices(items) : null; 32370 this.SetIndicesSelectionState(indices, selected); 32371 }, 32372 SetValuesSelectionState: function(values, selected){ 32373 var indices = values ? this.ConvertValuesToIndices(values) : null; 32374 this.SetIndicesSelectionState(indices, selected); 32375 }, 32376 ConvertValuesToIndices: function(values){ 32377 var indices = []; 32378 for(var i = 0; i < values.length; i++) 32379 indices.push(this.listBoxControl.FindItemIndexByValue(values[i])); 32380 return indices; 32381 }, 32382 ConvertItemsToIndices: function(items){ 32383 var indices = []; 32384 for(var i = 0; i < items.length; i++) 32385 indices.push(items[i].index); 32386 return indices; 32387 }, 32388 SelectIndices: function(indices){ 32389 this.SetIndicesSelectionState(indices, true); 32390 }, 32391 SelectItems: function(items){ 32392 this.SetItemsSelectionState(items, true); 32393 }, 32394 SelectValues: function(values){ 32395 this.SetValuesSelectionState(values, true); 32396 }, 32397 UnselectIndices: function(indices){ 32398 this.SetIndicesSelectionState(indices, false); 32399 }, 32400 UnselectItems: function(items){ 32401 this.SetItemsSelectionState(items, false); 32402 }, 32403 UnselectValues: function(values){ 32404 this.SetValuesSelectionState(values, false); 32405 }, 32406 GetIsItemSelected: function(index){ 32407 return ASPx.Data.ArrayBinarySearch(this.GetSortedSelectedIndices(), index) > -1; 32408 }, 32409 OnItemClick: function(index, evt){ 32410 this.BeginSelectionUpdate(); 32411 var ctrlKey = evt.ctrlKey || evt.metaKey; 32412 var shift = evt.shiftKey; 32413 if(ctrlKey) 32414 this.AddSelectedIndex(index); 32415 else if(shift){ 32416 var startIndex = index > this.lastIndexFocusedWithoutShift ? this.lastIndexFocusedWithoutShift + 1 : index; 32417 var endIndex = index > this.lastIndexFocusedWithoutShift ? index : this.lastIndexFocusedWithoutShift - 1; 32418 this.SelectRangeIndicesOnly(startIndex, endIndex); 32419 this.SetFocusedIndexInternal(index, true); 32420 }else 32421 this.SingleIndexSelection(index); 32422 this.EndSelectionUpdate(); 32423 }, 32424 OnItemCheckBoxClick: function(index, evt){ 32425 this.BeginSelectionUpdate(); 32426 this.AddSelectedIndex(index); 32427 this.EndSelectionUpdate(); 32428 }, 32429 AddSelectedIndex: function(index){ 32430 this.SetFocusedIndexInternal(index, false); 32431 var indexInSelectedIndices = ASPx.Data.ArrayIndexOf(this.savedSelectedIndices, index); 32432 var selectionOperation = indexInSelectedIndices == -1; 32433 this.SetItemSelectionState(index, selectionOperation); 32434 this.SetSelectedIndexCore(this.GetFirstSelectedIndex()); 32435 }, 32436 SelectRangeIndicesOnly: function(startIndex, endIndex){ 32437 this.BeginSelectionUpdate(); 32438 var controller = typeof(ASPx.GetStateController) != "undefined" ? ASPx.GetStateController() : null; 32439 var itemCount = this.GetItemCount(); 32440 for(var i = 0; i < itemCount; i ++) { 32441 if(i == this.lastIndexFocusedWithoutShift) 32442 continue; 32443 if(startIndex !== endIndex && this.listBoxControl.IsItemFiltered && !this.listBoxControl.IsItemFiltered(i)) 32444 continue; 32445 this.SetItemSelectionState(i, i >= startIndex && i <= endIndex, controller); 32446 } 32447 this.SetSelectedIndexCore(this.GetFirstSelectedIndex()); 32448 this.EndSelectionUpdate(); 32449 }, 32450 SingleIndexSelection: function(index){ 32451 this.SetFocusedIndexInternal(-1, false); 32452 this.SelectRangeIndicesOnly(index, index); 32453 this.SetFocusedIndexInternal(index, false); 32454 }, 32455 SetAllItemsSelectionState: function(selected, controller){ 32456 this.BeginSelectionUpdate(); 32457 this.savedSelectedIndices = [ ]; 32458 var itemCount = this.GetItemCount(); 32459 for (var i = 0; i < itemCount; i++) { 32460 this.SetItemSelectionStateCore(i, selected, controller); 32461 if(selected) 32462 this.PushSelectedIndex(i); 32463 this.OnItemSelectionChanged(i, selected); 32464 } 32465 this.ResetSelectionCollectionsCache(); 32466 this.EndSelectionUpdate(); 32467 }, 32468 SetItemSelectionState: function(itemIndex, selected, controller){ 32469 this.SetItemSelectionStateCore(itemIndex, selected, controller); 32470 this.ResetSelectionCollectionsCache(); 32471 var indexInSelectionArray = this.savedSelectedIndices.indexOf(itemIndex); 32472 if(selected && indexInSelectionArray == -1){ 32473 this.PushSelectedIndex(itemIndex); 32474 this.OnItemSelectionChanged(itemIndex, true); 32475 } 32476 if(!selected && indexInSelectionArray != -1){ 32477 this.RemoveSelectedIndexAt(indexInSelectionArray);
32478 this.OnItemSelectionChanged(itemIndex, false); 32479 } 32480 }, 32481 GetFirstSelectedIndex: function(){ 32482 var selectedIndices = this.GetSelectedIndices(); 32483 var selectedIndicesCount = selectedIndices.length; 32484 var firstSelectedIndex = -1; 32485 if(selectedIndicesCount > 0){ 32486 firstSelectedIndex = selectedIndices[0]; 32487 for(var i = 1; i < selectedIndices.length; i++){ 32488 if(firstSelectedIndex > selectedIndices[i]) 32489 firstSelectedIndex = selectedIndices[i]; 32490 } 32491 } 32492 return firstSelectedIndex; 32493 }, 32494 PushSelectedIndex: function(index){ 32495 this.savedSelectedIndices.push(index); 32496 }, 32497 RemoveSelectedIndex: function(index){ 32498 ASPx.Data.ArrayRemove(this.savedSelectedIndices, index); 32499 }, 32500 RemoveSelectedIndexAt: function(indexInArray){ 32501 ASPx.Data.ArrayRemoveAt(this.savedSelectedIndices, indexInArray); 32502 }, 32503 SortSelectedIndices: function(){ 32504 ASPx.Data.ArrayIntegerAscendingSort(this.savedSelectedIndices); 32505 this.selectedIndicesSortingRequired = false; 32506 }, 32507 SetItemSelectionStateCore: function(itemIndex, selected, controller){ 32508 ListBoxSingleSelectionHelper.prototype.SetItemSelectionState.call(this, itemIndex, selected, controller); 32509 }, 32510 GetFocusedIndex: function(){ 32511 return this.focusedIndex; 32512 }, 32513 SetFocusedIndexInternal: function(index, isShiftPressed){ 32514 if(!isShiftPressed) 32515 this.lastIndexFocusedWithoutShift = index; 32516 this.focusedIndex = index; 32517 }, 32518 OnItemInserted: function(index){ 32519 this.ResetSelectionCollectionsCache(); 32520 ListBoxSingleSelectionHelper.prototype.OnItemInserted.call(this, index); 32521 if(this.focusedIndex >= index) 32522 this.focusedIndex ++; 32523 for(var i = 0; i < this.savedSelectedIndices.length; i++){ 32524 if(this.savedSelectedIndices[i] >= index) 32525 this.savedSelectedIndices[i]++; 32526 } 32527 this.updateSelectAllElementsState(); 32528 }, 32529 OnItemRemoved: function(index){ 32530 this.ResetSelectionCollectionsCache(); 32531 ListBoxSingleSelectionHelper.prototype.OnItemRemoved.call(this, index); 32532 if(this.focusedIndex == index) 32533 this.focusedIndex = -1; 32534 else if(this.focusedIndex > index) 32535 this.focusedIndex --; 32536 if(this.GetIsItemSelected(index)) 32537 this.RemoveSelectedIndex(index); 32538 for(var i = 0; i < this.savedSelectedIndices.length; i++){ 32539 if(this.savedSelectedIndices[i] > index) 32540 this.savedSelectedIndices[i]--; 32541 } 32542 if(this.GetSelectedIndex() == -1) 32543 this.SetSelectedIndexCore(this.GetFirstSelectedIndex()); 32544 this.updateSelectAllElementsState(); 32545 }, 32546 ClearSelection: function(){ 32547 this.ResetSelectionCollectionsCache(); 32548 ASPx.Data.ArrayClear(this.savedSelectedIndices); 32549 this.OnSelectionCleared(); 32550 this.SetSelectedIndexCore(-1); 32551 } 32552}); 32553var CheckBoxListMultiSelectionHelper = ASPx.CreateClass(ListBoxMultiSelectionHelper, { 32554 OnItemClick: function(index){ 32555 this.BeginSelectionUpdate(); 32556 this.AddSelectedIndex(index); 32557 this.EndSelectionUpdate(); 32558 }, 32559 GetFocusedItemIndex: function(){ 32560 return this.lastIndexFocusedWithoutShift; 32561 }, 32562 updateSelectAllElementsState: function () { }, 32563 IsClientFilterApplied: function() { return false; } 32564}); 32565var ListBoxCheckSelectionHelper = ASPx.CreateClass(ListBoxMultiSelectionHelper, { 32566 OnItemClick: function(index, evt){ 32567 this.BeginSelectionUpdate(); 32568 if(evt.shiftKey) 32569 ListBoxMultiSelectionHelper.prototype.OnItemClick.call(this, index, evt); 32570 else 32571 this.AddSelectedIndex(index); 32572 this.EndSelectionUpdate(); 32573 } 32574}); 32575var ASPxClientListBox = ASPx.CreateClass(ASPxClientListBoxBase, { 32576 constructor: function(name) { 32577 this.constructor.prototype.constructor.call(this, name); 32578 this.freeUniqIndex = -1; 32579 this.isHasFakeRow = false; 32580 this.headerDiv = null; 32581 this.headerTable = null; 32582 this.listTable = null; 32583 this.sampleItemFirstTextCell = null; 32584 this.width = ""; 32585 this.defaultHeight = ""; 32586 this.hasSampleItem = false; 32587 this.hoverClasses = [""]; 32588 this.hoverCssArray = [""]; 32589 this.selectAllHoverClasses = [""]; 32590 this.selectAllHoverCssArray = [""]; 32591 this.selectAllDisabledClasses = [""]; 32592 this.selectAllDisabledCssArray = [""]; 32593 this.selectedClasses = [""]; 32594 this.selectedCssArray = [""]; 32595 this.disabledClasses = [""]; 32596 this.disabledCssArray = [""]; 32597 this.imageCellExists = false; 32598 this.scrollHandlerLockCount = 0; 32599 this.columnFieldNames = []; 32600 this.textFormatString = "";
32601 this.nullValueItemDisplayText = null; 32602 this.defaultImageUrl = ""; 32603 this.selectionMode = 0; 32604 this.initSelectedIndices = []; 32605 this.itemHorizontalAlign = ""; 32606 this.emptyTextRowCellIndices = null; 32607 this.accessibilityHelper = null; 32608 this.accessibilityHelperID = ""; 32609 this.allowMultipleCallbacks = false; 32610 this.isCallbackMode = false; 32611 this.callbackPageSize = -1; 32612 this.isTopSpacerVisible = false; 32613 this.isBottomSpacerVisible = false; 32614 this.serverIndexOfFirstItem = 0; 32615 this.scrollHelper = null; 32616 this.changeSelectAfterCallback = 0; 32617 this.ownerControl = null; 32618 this.SampleItem = null; 32619 this.sampleHeaderRow = null; 32620 this.scrollDivElement = null; 32621 this.scrollPageSize = 4; 32622 this.itemsValue = []; 32623 this.cachedValue = null; 32624 this.tempCache = new ListBoxTemporaryCache(); 32625 this.sizingConfig.adjustControl = true; 32626 this.disableScrolling = false; 32627 this.icbFocusedStyle = null; 32628 this.icbImageProperties = null; 32629 this.internalCheckBoxCollection = null; 32630 this.focusableCheckInput = null; 32631 this.nativeCheckOnFocusHandler = null; 32632 this.enableSelectAll = false; 32633 this.enableFiltering = false; 32634 this.filteringDelay = 100; 32635 this.filterMinLength = 1; 32636 this.filterTimerID = -1; 32637 this.customFilteringEditorID = ""; 32638 this.filteringTextBox = null; 32639 this.filteringTextBoxInput = null; 32640 this.showFilterButtonInput = null; 32641 this.highlighting = this.CreateHighlightingHelper(); 32642 this.hasDecoratedItems = false; 32643 this.scrollDivMinWidth = 0; 32644 this.ItemFiltering = new ASPxClientEvent(); 32645 this.CustomHighlighting = new ASPxClientEvent(); 32646 }, 32647 Initialize: function() { 32648 this.LockScrollHandler(); 32649 this.InitScrollPos(); 32650 if(ASPx.Browser.WebKitTouchUI && !this.disableScrolling) 32651 ASPx.TouchUIHelper.MakeScrollable(this.GetScrollDivElement(), {showHorizontalScrollbar: false}); 32652 this.CreateInternalCheckBoxCollection(); 32653 this.InitSelection(); 32654 if(!this.isComboBoxList) 32655 this.AdjustControlCore(); 32656 this.InitializeLoadOnDemand(); 32657 this.UnlockScrollHandler(); 32658 if(!this.HasVirtualScrolling()) 32659 this.freeUniqIndex = this.GetItemCount(); 32660 ASPxClientEdit.prototype.Initialize.call(this); 32661 if(this.NeedUnfocusableScrollDivElement()) 32662 ASPx.Attr.SetAttribute(this.GetScrollDivElement(), "tabIndex", "-1"); 32663 this.EnsureFilteringElements(); 32664 }, 32665 InitDXTextAttributes: function(){ 32666 if(this.emptyTextRowCellIndices != null){ 32667 var itemWithDXTextCount = this.emptyTextRowCellIndices.length; 32668 for(var i = 0; i < itemWithDXTextCount; i++){ 32669 var itemIndex = this.emptyTextRowCellIndices[i][0]; 32670 var cellIndices = this.emptyTextRowCellIndices[i][1]; 32671 var itemRow = this.GetItemRow(itemIndex); 32672 if(!itemRow) continue; 32673 for(var j = 0; j < cellIndices.length; j++){ 32674 ASPx.Attr.SetAttribute(itemRow.cells[cellIndices[j]], "DXText", ""); 32675 } 32676 } 32677 } 32678 }, 32679 InitSelection: function(){ 32680 var valueFromLastTime = this.GetValueFromValueInput(); 32681 if(this.MultiSelectionMode()){ 32682 if(valueFromLastTime != ""){ 32683 var serialiser = this.GetSerializingHelper(); 32684 var selectedValuesFromLastTime = serialiser.DeserializeValues(valueFromLastTime); 32685 var selectedIdicesFromLastTime = []; 32686 for(var i = 0; i < selectedValuesFromLastTime.length; i++) 32687 selectedIdicesFromLastTime.push(this.FindItemIndexByValue(selectedValuesFromLastTime[i])); 32688 this.SelectIndices(selectedIdicesFromLastTime); 32689 } else 32690 this.SelectIndices(this.initSelectedIndices); 32691 } else { 32692 var selectedIndex = (valueFromLastTime != "") ? 32693 this.FindItemIndexByValue(valueFromLastTime) : this.GetSelectedIndexInternal(); 32694 this.SetSelectedIndexInternal(selectedIndex); 32695 this.SelectIndexSilent(selectedIndex); 32696 this.GetItemSelectionHelper().SetSelectedIndexInternal(selectedIndex); 32697 } 32698 this.CacheValue(); 32699 }, 32700 BeginUpdate: function() { 32701 ASPxClientListBoxBase.prototype.BeginUpdate.call(this); 32702 if(this.isInitialized) 32703 this.itemsManager.BeginUpdate(); 32704 }, 32705 EndUpdate: function() { 32706 ASPxClientListBoxBase.prototype.EndUpdate.call(this); 32707 if(this.isInitialized) 32708 this.itemsManager.EndUpdate(); 32709 }, 32710 GetShowFilterButton: function() { 32711 return ASPx.GetControlCollection().Get(this.name + "_" + showFilterButtonID); 32712 }, 32713 GetAccessibilityHelper: function() { 32714 var result = null; 32715 if(this.accessibilityCompliant) { 32716 if(!this.accessibilityHelper) { 32717 this.accessibilityHelper = new AccessibilityHelperListBox(this); 32718 } 32719 result = this.accessibilityHelper; 32720 } 32721 return result; 32722 }, 32723 CreateHighlightingHelper: function() { 32724 return new ASPx.ListBoxHighlightingHelper(this, "em"); 32725 }, 32726 CreateInternalCheckBoxCollection: function() { 32727 if(this.IsNativeCheckBoxes() || this.internalCheckBoxCollection) 32728 return; 32729 this.internalCheckBoxCollection = new ASPx.CheckBoxInternalCollection(this.icbImageProperties, false, false, null, true, this.accessibilityCompliant); 32730 this.itemsManager.InitializeInternalCheckBoxCollection(); 32731 }, 32732 AddInternalCheckBoxToCollection: function(index) { 32733 if(!this.internalCheckBoxCollection) 32734 return; 32735 var enabled = this.GetEnabled(); 32736 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled); 32737 this.AddInternalCheckBoxToCollectionCore(index, enabled, changeEventMethod); 32738 }, 32739 AddInternalCheckBoxToCollectionCore: function(index, enabled, changeEventMethod) { 32740 var inputElement = this.GetItemCheckBoxInput(index); 32741 if(inputElement) { 32742 var internalCheckBox = this.internalCheckBoxCollection.Add(this.GetInternalCheckBoxKey(index), inputElement); 32743 internalCheckBox.CreateFocusDecoration(this.icbFocusedStyle); 32744 internalCheckBox.SetEnabled(enabled); 32745 internalCheckBox.autoSwitchEnabled = false; 32746 var checkBoxFocusableElement = this.GetCheckBoxFocusableElement(index); 32747 this.ChangeSpecialInputEnabledAttributes(checkBoxFocusableElement, changeEventMethod, true); 32748 if(this.accessibilityCompliant) { 32749 this.SetupCheckBoxAccessibilityAttributes(checkBoxFocusableElement, index); 32750 } 32751 internalCheckBox.CheckedChanged.AddHandler( 32752 function(s, e) { 32753 if(ASPx.Evt.GetKeyCode(e) == ASPx.Key.Space) { 32754 var element = ASPx.Evt.GetEventSource(e);
32755 this.GetItemSelectionHelper().OnItemCheckBoxClick(this.FindInternalCheckBoxIndex(element), e); 32756 } 32757 }.aspxBind(this) 32758 ); 32759 internalCheckBox.Focus.AddHandler( 32760 function(s, e) { 32761 var index = this.FindInternalCheckBoxIndex(s.mainElement); 32762 window.setTimeout(function() { this.MakeItemVisible(index); }.aspxBind(this),50); 32763 }.aspxBind(this) 32764 ); 32765 } 32766 }, 32767 SetupCheckBoxAccessibilityAttributes: function(checkBox, index) { 32768 if(index !== -1) { 32769 ASPx.Attr.SetAttribute(checkBox, "aria-label", this.GetAccessibilityHelper().getTextForScreenReader(this.GetItem(index))); 32770 } 32771 }, 32772 ClearInternalCheckBoxCollection: function() { 32773 if(this.internalCheckBoxCollection) 32774 this.internalCheckBoxCollection.Clear(); 32775 }, 32776 RemoveInternalCheckBoxFromCollecntion: function(index) { 32777 if(this.internalCheckBoxCollection) 32778 this.internalCheckBoxCollection.Remove(this.GetInternalCheckBoxKey(index)); 32779 }, 32780 GetInternalCheckBoxKey: function(index) { 32781 return this.name + nameSeparator + this.GetItemValue(index); 32782 }, 32783 GetInternalCheckBox: function (index) { 32784 if(this.internalCheckBoxCollection == null) 32785 this.CreateInternalCheckBoxCollection(); 32786 if(this.internalCheckBoxCollection) 32787 return this.internalCheckBoxCollection.Get(this.GetInternalCheckBoxKey(index)); 32788 return null; 32789 }, 32790 IsNativeCheckBoxes: function() { 32791 return !this.icbImageProperties; 32792 }, 32793 SetCheckBoxChecked: function(index, checked) { 32794 var checkBox = this.IsNativeCheckBoxes() ? this.GetItemCheckBoxInput(index) : this.GetInternalCheckBox(index); 32795 if(checkBox) 32796 this.SetCheckBoxCheckedCore(checkBox, checked); 32797 if(this.accessibilityCompliant) { 32798 setTimeout(function() { this.GetAccessibilityHelper().SetCheckBoxesValidationAttributes(); }.bind(this), 0); 32799 } 32800 }, 32801 SetCheckBoxCheckedCore: function (checkBox, checked) { 32802 if(this.IsNativeCheckBoxes()) 32803 checkBox.checked = checked; 32804 else 32805 checkBox.SetValue(checked ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked); 32806 }, 32807 SetCheckBoxEnabled: function (index, enabled) { 32808 var checkBox = this.IsNativeCheckBoxes() ? this.GetItemCheckBoxInput(index) : this.GetInternalCheckBox(index); 32809 if (checkBox) 32810 this.SetCheckBoxEnabledCore(checkBox, enabled); 32811 }, 32812 SetCheckBoxEnabledCore: function (checkbox, enabled) { 32813 if (this.IsNativeCheckBoxes()) { 32814 checkbox.disabled = !enabled; 32815 this.ChangeNativeCheckEnabledAttributes(checkbox, ASPx.Attr.ChangeEventsMethod(this.GetEnabled())); 32816 } 32817 else 32818 checkbox.SetEnabled(enabled); 32819 this.ChangeSpecialInputEnabledAttributes(this.IsNativeCheckBoxes() ? 32820 checkbox : checkbox.inputElement, ASPx.Attr.ChangeEventsMethod(enabled)); 32821 }, 32822 ClearItems: function() { 32823 ASPxClientListBoxBase.prototype.ClearItems.call(this); 32824 this.ClearInternalCheckBoxCollection(); 32825 this.freeUniqIndex = this.GetItemCount(); 32826 }, 32827 OnDelayedSpecialFocusMouseDown: function (evt) { 32828 if(this.filteringTextBox) { 32829 var isEventFromFilteringTextBox = ASPx.Evt.GetEventSource(evt) == this.filteringTextBox.GetInputElement(); 32830 this.filteringTextBoxInput = isEventFromFilteringTextBox ? this.filteringTextBox.GetInputElement() : null; 32831 } 32832 if(this.showFilterButton) { 32833 var isEventFromShowFilterButton = ASPx.GetIsParent(this.showFilterButton.GetMainElement(), ASPx.Evt.GetEventSource(evt)); 32834 this.showFilterButtonInput = isEventFromShowFilterButton ? this.showFilterButton.GetInternalButton() : null; 32835 this.isFilterEditorShowing = isEventFromShowFilterButton; 32836 } 32837 if(this.GetIsCheckColumnExists()) 32838 this.SetFocusableCheckInput(this.GetCheckBoxInputFromEvent(evt)); 32839 ASPxClientListBoxBase.prototype.OnDelayedSpecialFocusMouseDown.call(this, evt); 32840 var shiftPressed = evt.shiftKey; 32841 var ctrlKey = evt.ctrlKey || evt.metaKey; 32842 if(shiftPressed || ctrlKey) 32843 ASPx.Selection.Clear(); 32844 }, 32845 GetCheckBoxInputFromEvent: function(evt) { 32846 var element = ASPx.Evt.GetEventSource(evt); 32847 if(this.IsNativeCheckBoxes()) 32848 return element.type == "checkbox" ? element : null; 32849 var index = this.FindInternalCheckBoxIndex(element); 32850 if(index > -1) 32851 return this.GetCheckBoxFocusableElement(index); 32852 else if(this.IsSelectAllCheckBoxClicked(element)) 32853 return this.GetSelectAllCheckBoxFocusableElement(); 32854 return null; 32855 }, 32856 IsSelectAllCheckBoxClicked: function(eventSource) { 32857 return this.selectAllCheckBox && ASPx.GetIsParent(this.selectAllCheckBox.container, eventSource) 32858 && (eventSource == this.selectAllCheckBox.mainElement || eventSource.tagName == "LABEL"); 32859 }, 32860 IsNativeSelectAllCheckBoxClicked: function (eventSource) { 32861 return this.nativeSelectAllCheckBox && ASPx.GetIsParent(this.nativeSelectAllCheckBox, eventSource); 32862 }, 32863 GetSelectAllClickableElement: function() { 32864 return this.IsMultiColumn() ? this.selectAllMainElement.parentNode : this.selectAllMainElement; 32865 }, 32866 GetSelectAllCheckBoxFocusableElement: function() { 32867 return this.accessibilityCompliant ? this.selectAllCheckBox.mainElement : this.selectAllCheckBox.inputElement; 32868 }, 32869 GetCheckBoxFocusableElement: function(index) { 32870 var internalCheckBox = this.GetInternalCheckBox(index); 32871 if(!internalCheckBox) 32872 return null; 32873 return this.accessibilityCompliant ? internalCheckBox.mainElement : internalCheckBox.inputElement; 32874 }, 32875 FindInternalCheckBoxIndex: function(element) { 32876 var level = 5; 32877 while(level > 0) {
32878 var id = element.id; 32879 if(id && element.tagName == "TD" && id.slice(-1) == lbIPostfixes[0]) 32880 return this.GetItemIndexByRow(element.parentNode); 32881 element = element.parentNode; 32882 level--; 32883 } 32884 return -1; 32885 }, 32886 IsCheckBoxClicked: function(evt) { 32887 return !!this.GetCheckBoxInputFromEvent(evt); 32888 }, 32889 GetFocusableInputElement: function() { 32890 return this.showFilterButtonInput || this.filteringTextBoxInput || this.focusableCheckInput || this.GetInputElement(); 32891 }, 32892 IsElementBelongToInputElement: function (element) { 32893 return ASPxClientEdit.prototype.IsElementBelongToInputElement.call(this, element) 32894 || this.filteringTextBox && this.filteringTextBox.ownerListBox == this && this.filteringTextBox.IsElementBelongToInputElement(element); 32895 }, 32896 SetFocusableCheckInput: function(element) { 32897 this.focusableCheckInput = element; 32898 }, 32899 OnFocusCore: function() { 32900 if(this.UseDelayedSpecialFocus()) 32901 this.specialFocusTimer = ASPx.Timer.ClearTimer(this.specialFocusTimer); 32902 if(this.focused) 32903 this.UnlockFocusEvents(); 32904 else 32905 ASPxClientListBoxBase.prototype.OnFocusCore.call(this); 32906 }, 32907 OnLostFocusCore: function() { 32908 if(!this.IsFocusEventsLocked()) { 32909 this.SetFocusableCheckInput(null); 32910 this.filteringTextBoxInput = null; 32911 this.showFilterButtonInput = null; 32912 } 32913 ASPxClientListBoxBase.prototype.OnLostFocusCore.call(this); 32914 }, 32915 IsFocusEventsLocked: function() { 32916 var result = ASPxClientEdit.prototype.IsFocusEventsLocked.call(this) || 32917 this.IsInternalFilteringTextBoxFocusEventsLocked() || 32918 this.isFilterEditorShowing; 32919 if(this.accessibilityCompliant) 32920 result = this.focused && (result || this.HasInternalFilteringTextBoxFocus()); 32921 return result; 32922 }, 32923 HasInternalFilteringTextBoxFocus: function() { 32924 return !this.customFilteringEditorID && this.filteringTextBox && ASPx.GetIsParent(this.filteringTextBox.GetMainElement(), ASPx.GetActiveElement()); 32925 }, 32926 IsInternalFilteringTextBoxFocusEventsLocked: function() { 32927 return !this.customFilteringEditorID && this.filteringTextBox && this.filteringTextBox.IsFocusEventsLocked(); 32928 }, 32929 ForceLockFocusEvents: function() { 32930 this.focusEventsLocked = true; 32931 }, 32932 GetValueFromValueInput: function(){ 32933 var valueInput = this.FindStateInputElement(); 32934 if(ASPx.IsExistsElement(valueInput)) 32935 return valueInput.value; 32936 return ""; 32937 }, 32938 NeedUnfocusableScrollDivElement: function() { 32939 return ASPx.Browser.Firefox; 32940 }, 32941 GetInitSelectedIndex: function(){ 32942 return this.savedSelectedIndex; 32943 }, 32944 CacheValue: function(){ 32945 this.cachedValue = this.GetValue(); 32946 }, 32947 InitScrollPos: function(){ 32948 if(!this.isComboBoxList && this.isCallbackMode && this.GetInitSelectedIndex() == -1) 32949 this.GetScrollDivElement().scrollTop = 0; 32950 }, 32951 InitializeLoadOnDemand: function(){ 32952 var loadOnDemandRequired = this.isCallbackMode && this.GetEnabledByServer(); 32953 this.scrollHelper = this.CreateScrollHelper(loadOnDemandRequired); 32954 }, 32955 CreateScrollHelper: function (loadOnDemandRequired) { 32956 if (loadOnDemandRequired) 32957 return new ListBoxScrollCallbackHelper(this); 32958 return new ListBoxScrollCallbackHelperBase(this); 32959 }, 32960 HasVirtualScrolling: function() { return !!this.itemsInfo || this.itemsManager instanceof ListBoxItemsVirtualManager; }, 32961 CreateItemsManager: function() { 32962 if (this.HasVirtualScrolling()) { 32963 var manager = new ListBoxItemsVirtualManager(this); 32964 manager.InitializeItems(this.itemsInfo, this.itemsValue); 32965 delete this.itemsInfo; 32966 return manager; 32967 } 32968 return new ListBoxItemsDefaultManager(this); 32969 }, 32970 CreateStateControllerManager: function() { 32971 var result = null; 32972 if(this.HasVirtualScrolling()) { 32973 result = this.CreateVirtualRenderStateControllerManager(); 32974 } 32975 else { 32976 result = this.CreateDefaultRenderStateControllerManager(); 32977 } 32978 return result; 32979 }, 32980 CreateVirtualRenderStateControllerManager: function() { 32981 return new VirtualRenderListBoxStateControllerManager(this, this.itemsManager); 32982 }, 32983 CreateDefaultRenderStateControllerManager: function() { 32984 return new DefaultListBoxStateControllerManager(this); 32985 }, 32986 InlineInitialize: function(){ 32987 if(this.HasVirtualScrolling()) 32988 this.freeUniqIndex = 0; 32989 this.itemsManager = this.CreateItemsManager(); 32990 this.stateControllerManager = this.CreateStateControllerManager(); 32991 this.filterStrategy = this.isComboBoxList ? null : this.CreateFilterStrategy(); 32992 this.EnsureFixWidthRow(); 32993 this.InitializeNativeCheckHandlers(); 32994 this.LockScrollHandler(); 32995 this.InitializeItemsAttributes(); 32996 this.InitDXTextAttributes(); 32997 this.stateControllerManager.Initialize(); 32998 this.itemsManager.Initialize(); 32999 this.AddSelectAllStateItems(true); 33000 this.UnlockScrollHandler(); 33001 if(this.NeedToHandleCellWidth()) { 33002 var headerTable = this.GetHeaderTableElement(); 33003 var firstHeaderRow = !!headerTable && headerTable.rows[0]; 33004 this.CorrectCellNullWidthStyle(firstHeaderRow); 33005 this.CorrectCellNullWidthStyle(this.itemsManager.GetFirstVisibleItemRow()); 33006 } 33007 ASPxClientListBoxBase.prototype.InlineInitialize.call(this); 33008 this.EnsureSelectAllElements(); 33009 }, 33010 IsItemVisible: function(index) { 33011 return this.itemsManager.IsItemVisible(index); 33012 }, 33013 UseSpecialKeyboardHandling: function() { 33014 return true; 33015 }, 33016 GetItemIndexByInsertionOrder: function (itemIndex) { 33017 return this.HasVirtualScrolling() ? this.GetItem(itemIndex).insertOrderIndex : this.FindFreeIndex(); 33018 }, 33019 InsertItemRow: function (index, itemProperties) { 33020 var newItemRow = this.itemsManager.CreateNewItemRow(index); 33021 ASPx.Attr.RemoveAttribute(newItemRow, "id"); 33022 var listTable = this.GetListTable(); 33023 var tbody = this.GetTableRowParent(listTable); 33024 var rowBeforeNewItemRow = this.GetListTableRowBeforeNewItemRow(index, listTable); 33025 var scrollDiv = this.GetScrollDivElement(); 33026 var oldScrollTop = scrollDiv.scrollTop; 33027 if(rowBeforeNewItemRow) 33028 tbody.insertBefore(newItemRow, rowBeforeNewItemRow); 33029 else 33030 tbody.appendChild(newItemRow); 33031 if(ASPx.Browser.Firefox && scrollDiv.scrollTop != oldScrollTop) 33032 scrollDiv.scrollTop = oldScrollTop; 33033 var newIndex = this.GetItemIndexByInsertionOrder(index); 33034 var newId = this.CreateItemId(newIndex); 33035 var newClientId = this.CreateItemClientId(newIndex); 33036 this.InitializeItemAttributes(newItemRow, newClientId, true); 33037 this.AddStateControllerClasses(newId); 33038 this.PrepareItem(newItemRow, itemProperties); 33039 if (this.needUnselectableItemRows) 33040 this.SetItemRowUnselectable(newItemRow); 33041 if (this.GetIsCheckColumnExists() && !this.IsNativeCheckBoxes()) { 33042 if (!this.internalCheckBoxCollection) 33043 this.CreateInternalCheckBoxCollection(); 33044 this.AddInternalCheckBoxToCollection(index); 33045 } 33046 }, 33047 RemoveItemRow: function (index) { 33048 if (this.GetIsCheckColumnExists() && !this.IsNativeCheckBoxes()) 33049 this.RemoveInternalCheckBoxFromCollecntion(index); 33050 var row = this.GetItemRow(index); 33051 if (ASPx.IsExistsElement(row)) { 33052 var firstCellId = this.GetItemElement(index).id; 33053 var itemId = firstCellId.match(/LBI\d+/)[0]; 33054 this.RemoveStateControllerClasses(itemId); 33055 row.parentNode.removeChild(row);
33056 } 33057 }, 33058 SetItemRowsUnselectable: function() { 33059 var count = this.GetItemCount(); 33060 for (var i = 0; i < count; i++) { 33061 var itemRow = this.GetItemRow(i); 33062 if (itemRow) 33063 this.SetItemRowUnselectable(itemRow); 33064 } 33065 this.needUnselectableItemRows = true; 33066 }, 33067 SetItemRowUnselectable: function (itemRow) { 33068 for (var j = 0; j < itemRow.cells.length; j++) 33069 ASPx.Selection.SetElementAsUnselectable(itemRow.cells[j], true); 33070 }, 33071 GetInactiveFilterElementClassName: function() { 33072 return inactiveFilterElementClassName; 33073 }, 33074 GetAnimatedFilterElementClassName: function() { 33075 return "dxeLBAnimatedFilterPanelSys"; 33076 }, 33077 GetCompactViewFilterAdjacentScrollDivSelector: function() { 33078 return "*[class*=\"dxeListBoxFilter\"]:not(.dxeLBInactiveFilterPanelSys) + *[class*=\"dxeListBoxSelectAll\"] + .dxlbd"; 33079 }, 33080 GetCompactViewInactiveFilterAdjacentScrollDivSelector: function() { 33081 return ".dxeLBInactiveFilterPanelSys + *[class*=\"dxeListBoxSelectAll\"] + .dxlbd"; 33082 }, 33083 EnsureFilteringElements: function () { 33084 if(this.enableFiltering) { 33085 this.EnsureFilteringTextBox(); 33086 if(!this.customFilteringEditorID) { 33087 this.filterMainElement = this.GetChildElement(filterMainElementID); 33088 this.showFilterButton = this.GetShowFilterButton(); 33089 if(this.showFilterButton) { 33090 this.showFilterButton.ownerListBox = this; 33091 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled()); 33092 var showFilterButtonInternalButton = this.showFilterButton.GetInternalButton(); 33093 if(showFilterButtonInternalButton) 33094 this.ChangeSpecialInputEnabledAttributes(showFilterButtonInternalButton, changeEventMethod, true); 33095 this.showFilterButton.SetEnabled(this.GetEnabled()); 33096 this.UpdateFilterButtonHeight(); 33097 this.UpdateShowHideFilterElementCssRules(); 33098 } 33099 } 33100 } 33101 }, 33102 CreateFilterStrategy: function() { 33103 if(this.enableFiltering) 33104 return new ListBoxFilterStrategy(this); 33105 return new ListEditFilterStrategyBase(); 33106 }, 33107 UpdateShowHideFilterElementCssRules: function() { 33108 var scrollDiv = this.GetScrollDivElement(); 33109 var scrollDivClientHeight = scrollDiv.offsetHeight - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(scrollDiv); 33110 var filterMainElementOffsetHeight = this.GetFilterMainElementHeight(); 33111 if (ASPx.GetElementVisibility(this.filteringTextBox.GetMainElement(), true)) 33112 scrollDivClientHeight += filterMainElementOffsetHeight; 33113 var showHideFilterStyle = this.EnsureShowHideFilterStyle(); 33114 var mainElementSelector = "#" + this.name; 33115 var styleContent = [ 33116 mainElementSelector + " " + this.GetCompactViewFilterAdjacentScrollDivSelector() 33117 + " { max-height: " + (scrollDivClientHeight - filterMainElementOffsetHeight) + "px; }", 33118 mainElementSelector + " " + this.GetCompactViewInactiveFilterAdjacentScrollDivSelector() 33119 + " { max-height: " + scrollDivClientHeight + "px; }" 33120 ]; 33121 showHideFilterStyle.innerHTML = styleContent.join('\n'); 33122 }, 33123 EnsureShowHideFilterStyle: function() { 33124 if(!this.showHideFilterStyle) { 33125 this.showHideFilterStyle = this.FindShowHideFilterStyle(); 33126 if(!this.showHideFilterStyle) { 33127 this.showHideFilterStyle = document.createElement('style'); 33128 this.showHideFilterStyle.id = this.GetShowHideFilterStyleID(); 33129 ASPx.Attr.AppendStyleType(this.showHideFilterStyle); 33130 document.getElementsByTagName('head')[0].appendChild(this.showHideFilterStyle); 33131 } 33132 } 33133 return this.showHideFilterStyle; 33134 }, 33135 FindShowHideFilterStyle: function() { 33136 return ASPx.GetChildById(document.getElementsByTagName('head')[0], this.GetShowHideFilterStyleID()); 33137 }, 33138 GetShowHideFilterStyleID: function() { 33139 return this.name + "ShowHideFilterStyle"; 33140 }, 33141 GetFilterMainElementHeight: function() { 33142 if(!this.filterMainElementHeight) { 33143 var filteringTextBoxClone = this.filteringTextBox.GetMainElement().cloneNode(true); 33144 filteringTextBoxClone.style.position = "absolute"; 33145 filteringTextBoxClone.style.visibility = "hidden"; 33146 document.body.appendChild(filteringTextBoxClone); 33147 this.filterMainElementHeight = filteringTextBoxClone.offsetHeight;
33148 document.body.removeChild(filteringTextBoxClone); 33149 var filterMainElementClone = this.filterMainElement.cloneNode(false); 33150 filterMainElementClone.style.position = "absolute"; 33151 filterMainElementClone.style.visibility = "hidden"; 33152 ASPx.RemoveClassNameFromElement(filterMainElementClone, this.GetInactiveFilterElementClassName()); 33153 ASPx.RemoveClassNameFromElement(filterMainElementClone, this.GetAnimatedFilterElementClassName()); 33154 document.body.appendChild(filterMainElementClone); 33155 this.filterMainElementHeight += ASPx.GetTopBottomBordersAndPaddingsSummaryValue(filterMainElementClone); 33156 document.body.removeChild(filterMainElementClone); 33157 } 33158 return this.filterMainElementHeight; 33159 }, 33160 RemoveShowHideFilterCssRules: function () { 33161 var showHideFilterStyle = this.FindShowHideFilterStyle(); 33162 if(showHideFilterStyle) 33163 showHideFilterStyle.innerHTML = ""; 33164 }, 33165 UpdateFilterButtonHeight: function() { 33166 setTimeout(function () { 33167 this.showFilterButton.SetHeight(this.selectAllMainElement.offsetHeight - ASPx.GetVerticalBordersWidth(this.selectAllMainElement)); 33168 }.aspxBind(this), 0); 33169 }, 33170 EnsureFilteringTextBox: function() { 33171 this.filteringTextBox = this.FindFilteringTextBox(); 33172 if(this.filteringTextBox) { 33173 this.filteringTextBox.UserInput.AddHandler(this.filterStrategy.OnInput.bind(this.filterStrategy)); 33174 if(!this.customFilteringEditorID) { 33175 this.filteringTextBox.ownerListBox = this; 33176 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled()); 33177 this.ChangeSpecialInputEnabledAttributes(this.filteringTextBox.GetInputElement(), changeEventMethod, true); 33178 this.filteringTextBox.SetEnabled(this.GetEnabled()); 33179 this.filteringTextBox.KeyDown.AddHandler(function(sender, args) { 33180 if(ASPx.Evt.GetKeyCode(args.htmlEvent) === ASPx.Key.Esc) 33181 sender.GetInputElement().value = ""; 33182 }); 33183 } 33184 } 33185 }, 33186 FindFilteringTextBox: function() { 33187 var actualFilteringTextBoxID = this.customFilteringEditorID ? this.customFilteringEditorID : this.name + "_" + filteringTextBoxID; 33188 return ASPx.GetControlCollection().Get(actualFilteringTextBoxID); 33189 }, 33190 CollectionChanged: function(isFiltering) { 33191 if(isFiltering) 33192 this.itemsManager.OnEndItemsFiltering(); 33193 }, 33194 ChangeItemsFilteredState: function(action) { 33195 this.itemsManager.ChangeItemsFilteredState(action); 33196 }, 33197 RewriteFilteredItemIndices: function (newFilteredItemIndices) { 33198 this.itemsManager.RewriteFilteredItemIndices(newFilteredItemIndices); 33199 }, 33200 BeforeClientFiltering: function () { 33201 this.itemsManager.BeforeClientFiltering(); 33202 }, 33203 ApplyFilterToItem: function (index, isSatisfy, savePrevState, isFilterReset) { 33204 this.itemsManager.ApplyFilterToItem(index, isSatisfy, savePrevState, isFilterReset); 33205 }, 33206 RestorePrevFilteredState: function (index) { 33207 this.itemsManager.RestorePrevFilteredState(index); 33208 }, 33209 IsItemFiltered: function (index) { 33210 return this.itemsManager.IsItemFiltered(index); 33211 }, 33212 IsClientFilterApplied: function() { 33213 return !this.isComboBoxList && this.filterStrategy.filter != "" && !this.isCallbackMode; 33214 }, 33215 MakeAllItemsVisible: function () { 33216 this.itemsManager.MakeAllItemsVisible(); 33217 }, 33218 ShowFilterElement: function() { 33219 ASPx.RemoveClassNameFromElement(this.filterMainElement, this.GetInactiveFilterElementClassName()); 33220 this.showFilterButton.SetVisible(false); 33221 if(ASPx.Browser.VirtualKeyboardSupported) { 33222 this.ReplaceFilteringTextBoxShowNullTextOnFocusFunction(); 33223 this.isFilterEditorShowing = false; 33224 this.filteringTextBox.GetInputElement().focus(); 33225 } 33226 else 33227 setTimeout(function () { 33228 this.isFilterEditorShowing = false; 33229 this.filteringTextBox.GetInputElement().focus(); 33230 }.aspxBind(this), 200); 33231 }, 33232 HideFilterElement: function () { 33233 ASPx.AddClassNameToElement(this.filterMainElement, this.GetInactiveFilterElementClassName()); 33234 this.showFilterButton.SetVisible(true); 33235 this.UpdateFilterButtonHeight(); 33236 this.CorrectHeight(true); 33237 setTimeout(function () { 33238 this.filteringTextBox.UnlockFocusEvents(); 33239 this.showFilterButton.GetInternalButton().focus(); 33240 }.aspxBind(this), 0); 33241 }, 33242 ReplaceFilteringTextBoxShowNullTextOnFocusFunction: function () { 33243 if(this.filteringTextBox.nullTextDisplayMode === ASPx.NullTextDisplayMode.UnfocusedAndFocused) { 33244 var origin = this.filteringTextBox.ensureActivateFocusedNullTextMechanism; 33245 var filteringTextBox = this.filteringTextBox; 33246 this.filteringTextBox.ensureActivateFocusedNullTextMechanism = function() { 33247 setTimeout(function() { 33248 origin.call(filteringTextBox); 33249 filteringTextBox.ensureActivateFocusedNullTextMechanism = origin; 33250 setTimeout(function () { 33251 if(filteringTextBox.isFocusedNullTextElementDisplayed()) 33252 filteringTextBox.adjustFocusedNullTextElement(); 33253 }, 300); 33254 }, 400); 33255 }; 33256 } 33257 }, 33258 EnsureSelectAllElements: function () { 33259 if(this.enableSelectAll && !this.selectAllMainElement) { 33260 this.EnsureSelectAllCheckElement(); 33261 this.selectAllMainElement = this.GetChildElement(selectAllMainElementID); 33262 var selectAllClickableElement = this.GetSelectAllClickableElement(); 33263 ASPx.Evt.AttachEventToElement(selectAllClickableElement, "click", this.onSelectAllClickableElementClick.bind(this)); 33264 } 33265 }, 33266 EnsureSelectAllCheckElement: function () { 33267 var selectAllCheckBoxInput = null; 33268 if(!this.IsNativeCheckBoxes()) { 33269 this.CreateSelectAllCheckBox(); 33270 selectAllCheckBoxInput = this.GetSelectAllCheckBoxFocusableElement(); 33271 } 33272 else { 33273 this.nativeSelectAllCheckBox = this.GetChildElement(selectAllCheckBoxID + "_I"); 33274 this.nativeSelectAllCheckBox.disabled = !this.GetEnabled(); 33275 selectAllCheckBoxInput = this.nativeSelectAllCheckBox; 33276 } 33277 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(this.GetEnabled()); 33278 this.ChangeSpecialInputEnabledAttributes(selectAllCheckBoxInput, changeEventMethod, true); 33279 }, 33280 CreateSelectAllCheckBox: function () { 33281 var selectAllCheckBoxElement = this.GetChildElement(selectAllCheckBoxID); 33282 var selectAllCheckBoxInputElement = this.GetChildElement(selectAllCheckBoxID + "_S"); 33283 var selectAllStateController = ASPx.CheckableElementStateController.Create(this.icbImageProperties, CheckBoxInputKey.Checked, CheckBoxInputKey.Unchecked, CheckBoxInputKey.Indeterminate, true); 33284 this.selectAllCheckBox = new ASPx.CheckBoxInternal(selectAllCheckBoxInputElement, selectAllStateController, true, false, 33285 ASPx.CheckEditElementHelper.Instance, selectAllCheckBoxElement, true, undefined, undefined, this.accessibilityCompliant); 33286 this.selectAllCheckBox.CreateFocusDecoration(this.icbFocusedStyle); 33287 this.selectAllCheckBox.SetEnabled(this.GetEnabled()); 33288 this.selectAllCheckBox.GetReadOnly = this.GetReadOnly.bind(this); 33289 this.selectAllCheckBox.CheckedChanged.AddHandler(this.onSelectAll.as
33289pxBind(this)); 33290 if(ASPx.Browser.WebKitFamily) 33291 ASPx.Evt.AttachEventToElement(this.selectAllCheckBox.mainElement.parentNode, "selectstart", ASPx.Evt.PreventEventAndBubble); 33292 }, 33293 onSelectAllClickableElementClick: function (evt) { 33294 if (!this.GetEnabled() || this.GetReadOnly()) { 33295 if (this.IsNativeCheckBoxes() || this.isNative) 33296 ASPx.Evt.PreventEvent(evt); 33297 return false; 33298 } 33299 if(this.IsSelectAllCheckBoxClicked(ASPx.Evt.GetEventSource(evt))) 33300 return; 33301 if(!this.IsNativeSelectAllCheckBoxClicked(ASPx.Evt.GetEventSource(evt))) { 33302 var currentCheckState = this.getSelectAllCheckElementState(); 33303 var newCheckState = currentCheckState != ASPx.CheckBoxCheckState.Checked ? 33304 ASPx.CheckBoxCheckState.Checked : ASPx.CheckBoxCheckState.Unchecked; 33305 this.updateSelectAllCheckElementState(newCheckState); 33306 } 33307 this.onSelectAll(); 33308 }, 33309 onSelectAll: function () { 33310 this.LockUpdateSelectAllElements(); 33311 var selectAllCheckState = this.getSelectAllCheckElementState(); 33312 this.onSelectAllCore(selectAllCheckState); 33313 this.UnlockUpdateSelectAllElements(); 33314 }, 33315 onSelectAllCore: function (currentCheckState) { 33316 var toSelect = currentCheckState == ASPx.CheckBoxCheckState.Checked; 33317 var valueBeforeSelectAll = this.GetValue(); 33318 var selectionBeforeSelectAll = this.GetValueFromValueInput(); 33319 if (toSelect) 33320 this.SelectAll(); 33321 else 33322 this.UnselectAll(); 33323 if(selectionBeforeSelectAll !== this.GetValueFromValueInput()) 33324 this.OnItemSelectionChanged(-1, toSelect, true, valueBeforeSelectAll !== this.GetValue()); 33325 }, 33326 getSelectAllCheckElementState: function () { 33327 if(this.selectAllCheckBox) 33328 return this.selectAllCheckBox.GetCurrentCheckState(); 33329 if(this.nativeSelectAllCheckBox) 33330 return this.nativeSelectAllCheckBox.checked ? ASPx.CheckBoxCheckState.Checked : ASPx.CheckBoxCheckState.Unchecked; 33331 return null; 33332 }, 33333 updateSelectAllCheckElementState: function (checkState) { 33334 if(this.selectAllCheckBox) { 33335 var checkValue = this.selectAllCheckBox.stateController.GetValueByCheckState(checkState); 33336 this.selectAllCheckBox.SetValue(checkValue, !this.isInitialized); 33337 } else if(this.nativeSelectAllCheckBox) 33338 this.nativeSelectAllCheckBox.checked = checkState === ASPx.CheckBoxCheckState.Checked; 33339 }, 33340 updateSelectAllElementsState: function() { 33341 if(!this.IsUpdateSelectAllElementsLocked() && this.enableSelectAll) { 33342 this.EnsureSelectAllElements(); 33343 this.updateSelectAllElementsStateCore(); 33344 } 33345 }, 33346 updateSelectAllElementsStateCore: function() { 33347 var selectAllCheckState = ASPx.CheckBoxCheckState.Unchecked; 33348 var isFilteredSelectedItemFound = false; 33349 var isFilteredUnselectedItemFound = false; 33350 var itemCount = this.GetItemCount(); 33351 for(var i = 0; i < itemCount; i++) { 33352 if(this.IsItemFiltered(i)) { 33353 if(this.GetIsItemSelected(i)) 33354 isFilteredSelectedItemFound = true; 33355 else 33356 isFilteredUnselectedItemFound = true; 33357 } 33358 if (isFilteredSelectedItemFound && isFilteredUnselectedItemFound) { 33359 selectAllCheckState = ASPx.CheckBoxCheckState.Indeterminate; 33360 break; 33361 } 33362 if(i == itemCount - 1 && isFilteredSelectedItemFound && !isFilteredUnselectedItemFound) 33363 selectAllCheckState = ASPx.CheckBoxCheckState.Checked; 33364 } 33365 this.updateSelectAllCheckElementState(selectAllCheckState); 33366 }, 33367 changeSelectAllElementsEnabledState: function(enabled) { 33368 var selectAllCheckBoxInput = null; 33369 if(this.selectAllCheckBox) { 33370 this.selectAllCheckBox.SetEnabled(enabled); 33371 selectAllCheckBoxInput = this.GetSelectAllCheckBoxFocusableElement(); 33372 } 33373 else if(this.nativeSelectAllCheckBox) { 33374 this.nativeSelectAllCheckBox.disabled = !enabled; 33375 selectAllCheckBoxInput = this.nativeSelectAllCheckBox; 33376 } 33377 if(selectAllCheckBoxInput) { 33378 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled); 33379 this.ChangeSpecialInputEnabledAttributes(selectAllCheckBoxInput, changeEventMethod, true); 33380 } 33381 ASPx.GetStateController().SetElementEnabled(this.selectAllMainElement, enabled); 33382 }, 33383 NeedToHandleCellWidth: function() { 33384 return this.IsMultiColumn() && (ASPx.Browser.Firefox || ASPx.Browser.Edge); 33385 }, 33386 CorrectCellNullWidthStyle: function(row) { 33387 if(!row) return; 33388 var cellCount = row.cells.length; 33389 for(var i = 0; i < cellCount; i++) { 33390 var cellStyle = !!window.getComputedStyle ? window.getComputedStyle(row.cells[i]) : ASPx.GetCurrentStyle(row.cells[i]); 33391 var originalWidth = parseInt(cellStyle.width); 33392 var needToApply = originalWidth === 0 || originalWidth <= ASPx.PxToInt(cellStyle.paddingLeft) || originalWidth <= ASPx.PxToInt(cellStyle.paddingRight); 33393 var action = needToApply ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement; 33394 action(row.cells[i], NullSizeCellClassName); 33395 } 33396 }, 33397 InitializeNativeCheckHandlers: function() { 33398 this.nativeCheckOnFocusHandler = function(evt) { 33399 this.SetFocusableCheckInput(ASPx.Evt.GetEventSource(evt)); 33400 }.aspxBind(this); 33401 }, 33402 ChangeNativeCheckEnabledAttributes: function(element, method) { 33403 if(this.nativeCheckOnFocusHandler) 33404 method(element, "focus", this.nativeCheckOnFocusHandler); 33405 }, 33406 InitializeItemsAttributes: function() { 33407 var listTable = this.GetListTable(); 33408 if(this.isHasFakeRow){ 33409 this.LockSynchronization(); 33410 this.ClearItems();
33411 this.UnlockSynchronization(); 33412 } 33413 listTable.ListBoxId = this.name; 33414 var rowIdConst = this.name + "_"; 33415 if(this.hasSampleItem) 33416 this.InitializeItemAttributes(this.GetSampleItemRow(), rowIdConst + lbSIIdSuffix); 33417 if(!this.HasVirtualScrolling()) { 33418 rowIdConst += lbIIdSuffix; 33419 var count = this.GetItemCount(); 33420 if(this.HasAccessibilityHeaderRow()) 33421 count--; 33422 for (var i = 0; i < count; i++) 33423 this.InitializeItemAttributes(this.GetItemRow(i), rowIdConst + i); 33424 } 33425 var rows = listTable.rows; 33426 if(this.HasAccessibilityHeaderRow() && rows[rows.length - 1]) 33427 rows[rows.length - 1].id = this.GetAccessibilityHeaderRowID(); 33428 }, 33429 InitializeItemAttributes: function(row, rowId) { 33430 var cells = row.cells; 33431 var itemCellsIdSuffixes = this.GetItemCellsIdPostfixes(); 33432 for(var i = 0; i < row.cells.length; i++) { 33433 cells[i].style.textAlign = this.itemHorizontalAlign; 33434 cells[i].id = rowId + itemCellsIdSuffixes[i]; 33435 } 33436 if(this.GetIsCheckColumnExists() && this.IsNativeCheckBoxes() && rowId != this.GetSampleItemRowID()) { 33437 var input = this.GetItemCheckBoxInput(this.GetItemIndexByRow(row)); 33438 this.ChangeNativeCheckEnabledAttributes(input, ASPx.Attr.ChangeEventsMethod(this.GetEnabled())); 33439 this.ChangeSpecialInputEnabledAttributes(input, ASPx.Attr.ChangeEventsMethod(this.GetEnabled())); 33440 } 33441 }, 33442 InitializePageSize: function(){ 33443 var divElement = this.GetScrollDivElement(); 33444 var count = this.GetItemCount(); 33445 if (divElement && count > 0) { 33446 var firstVisibleRow = this.itemsManager.GetFirstVisibleItemRow(); 33447 if(firstVisibleRow) 33448 this.scrollPageSize = Math.round(divElement.clientHeight / firstVisibleRow.offsetHeight) - 1; 33449 } 33450 }, 33451 AddSelectAllStateItems: function(isInitialization) { 33452 if (this.enableSelectAll && typeof (ASPx.GetStateController) !== "undefined") { 33453 var stateController = ASPx.GetStateController(); 33454 var name = this.name + "_" + selectAllMainElementID; 33455 if (!isInitialization) 33456 this.ClearStateItemCache(stateController, name, [""]); 33457 stateController.AddHoverItem(name, this.selectAllHoverClasses, this.selectAllHoverCssArray, "", null, null, true); 33458 stateController.AddDisabledItem(name, this.selectAllDisabledClasses, this.selectAllDisabledCssArray, "", null, null, true); 33459 } 33460 }, 33461 RemoveSelectAllStateItems: function() { 33462 if (this.enableSelectAll && typeof (ASPx.GetStateController) !== "undefined") { 33463 var stateController = ASPx.GetStateController(); 33464 var name = this.name + "_" + selectAllMainElementID; 33465 this.ClearStateItemCache(stateController, name, [""]); 33466 stateController.RemoveHoverItem(name, ""); 33467 stateController.RemoveDisabledItem(name, ""); 33468 } 33469 }, 33470 ClearStateItemCache: function(stateController, name, suffixes) { 33471 for (var i = 0; i < suffixes.length; i++) { 33472 var element = document.getElementById(name + suffixes[i]); 33473 var elements = ASPx.GetNodes(element); 33474 elements.push(element); 33475 ASPx.Data.ForEach(elements, stateController.ClearElementCache.bind(stateController)); 33476 } 33477 }, 33478 AfterInitialize: function() { 33479 if(this.disableScrolling) { 33480 var scrollDiv = this.GetScrollDivElement(); 33481 var mainElement = this.GetMainElement(); 33482 var listTable = this.GetListTable(); 33483 scrollDiv.style.height = mainElement.style.height = (listTable 33484 ? ASPx.GetClearClientHeight(listTable) 33485 : this.GetListTableHeight() - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(mainElement)) + "px"; 33486 } 33487 this.CallbackSpaceInit(true); 33488 ASPxClientListBoxBase.prototype.AfterInitialize.call(this); 33489 }, 33490 GetEnabledByServer: function(){ 33491 return this.enabled; 33492 }, 33493 SetEnabled: function(enabled){ 33494 ASPxClientListBoxBase.prototype.SetEnabled.call(this, enabled); 33495 this.CallbackSpaceInit(false); 33496 }, 33497 SetReadOnlyInternal: function(readOnly) { 33498 ASPxClientListBoxBase.prototype.SetReadOnlyInternal.call(this, readOnly); 33499 if (readOnly) { 33500 this.RemoveSelectAllStateItems(); 33501 this.stateControllerManager.RemoveHoverStateItem(); 33502 } 33503 else { 33504 this.AddSelectAllStateItems(false); 33505 this.stateControllerManager.AddStateItems(true, true); 33506 } 33507 }, 33508 CallbackSpaceInit: function(isInitialization){ 33509 if(this.isCallbackMode){ 33510 this.SetBottomScrollSpacerVisibility(this.GetScrollSpacerVisibility(false)); 33511 this.SetTopScrollSpacerVisibility(this.GetScrollSpacerVisibility(true)); 33512 if(isInitialization || this.isComboBoxList){ 33513 this.EnsureSelectedItemVisible(); 33514 ASPx.Evt.AttachEventToElement(this.GetScrollDivElement(), "scroll", aspxLBScroll); 33515 } 33516 } 33517 }, 33518 GetListTable: function() { 33519 return this.tempCache.Get("ListTable", this.GetListTableCore, this); 33520 }, 33521 GetListTableCore: function(){ 33522 if(!ASPx.IsExistsElement(this.listTable)) 33523 this.listTable = ASPx.GetElementById(this.name + lTableIdSuffix); 33524 return this.listTable; 33525 }, 33526 GetItemElements: function() { 33527 return this.GetListTable().rows; 33528 }, 33529 GetListTableHeight: function(){ 33530 return this.GetListTable().offsetHeight; 33531 }, 33532 GetHeaderDivElement: function(){ 33533 if(!ASPx.IsExistsElement(this.headerDiv)) 33534 this.headerDiv = ASPx.GetElementById(this.name + lbHeaderDivIdSuffix); 33535 return this.headerDiv; 33536 }, 33537 GetHeaderTableElement: function(){ 33538 if(!ASPx.IsExistsElement(this.headerTable)){ 33539 var headerDiv = this.GetHeaderDivElement(); 33540 this.headerTable = ASPx.GetNodeByTagName(headerDiv, "table", 0); 33541 } 33542 return this.headerTable; 33543 }, 33544 GetScrollDivElement: function(){ 33545 if(!ASPx.IsExistsElement(this.scrollDivElement)) 33546 this.scrollDivElement = document.getElementById(this.name + lbDSuffix); 33547 return this.scrollDivElement; 33548 }, 33549 GetItemElement: function(index) { 33550 return this.itemsManager.GetItemElement(index); 33551 }, 33552 GetItemRow: function(index){ 33553 return this.itemsManager.GetItemRow(index); 33554 }, 33555 GetItemIndexByRow: function (itemRow) { 33556 return this.itemsManager.GetItemIndexByRow(itemRow); 33557 }, 33558 GetItemSelectableElementsByRow: function(row) { 33559 return row.cells; 33560 }, 33561 GetItemTexts: function(item) { 33562 return item.texts ? item.texts : [ item.text ]; 33563 }, 33564 GetItemHtmlContent: function(index) { 33565 return this.itemsManager.GetItemHtmlContent(index); 33566 }, 33567 GetItemCount: function(){ 33568 return this.itemsManager.GetItemCount(); 33569 }, 33570 GetListTableRowParent: function() { 33571 var listTable = this.GetListTable(); 33572 return this.GetTableRowParent(listTable); 33573 }, 33574 EnsureFixWidthRow: function (isSetItemHtmlProcessing) { 33575 var needfixWidthRow = !this.ContainsFixWidthRow() && this.IsMultiColumn() && (isSetItemHtmlProcessing || this.hasItemTemplate); 33576 if (needfixWidthRow) 33577 this.CreateFixWidthRow(); 33578 }, 33579 CreateFixWidthRow: function() { 33580 this.fixWidthRow = document.createElement("TR"); 33581 var etalonRow = this.GetSampleItemRow(); 33582 for(var i = 0; i < etalonRow.cells.length; i++) { 33583 var fixWidthCell = document.createElement("TD"); 33584 var etalonCell = etalonRow.cells[i]; 33585 var etalonCellStyle = ASPx.GetCurrentStyle(etalonCell); 33586 fixWidthCell.style.width = etalonCell.style.width || etalonCellStyle.width; 33587 fixWidthCell.style.borderLeftWidth = etalonCellStyle.borderLeftWidth; 33588 fixWidthCell.style.borderRightWidth = etalonCellStyle.borderRightWidth; 33589 fixWidthCell.style.borderLeftStyle = etalonCellStyle.borderLeftStyle; 33590 fixWidthCell.style.borderRightStyle = etalonCellStyle.borderRightStyle; 33591 fixWidthCell.style.paddingLeft = etalonCellStyle.paddingLeft; 33592 fixWidthCell.style.paddingRight = etalonCellStyle.paddingRight; 33593 fixWidthCell.style.boxSizing = etalonCellStyle.boxSizing; 33594 fixWidthCell.style.display = etalonCellStyle.display; 33595 this.fixWidthRow.appendChild(fixWidthCell); 33596 } 33597 ASPx.SetElementVisibility(this.fixWidthRow, "hidden"); 33598 this.fixWidthRow.style.height = "0px"; 33599 var listTableBody = this.GetListTableRowParent(); 33600 listTableBody.insertBefore(this.fixWidthRow, listTableBody.childNodes[0]); 33601 }, 33602 ContainsFixWidthRow: function() { 33603 return this.fixWidthRow && this.fixWidthRow.parentNode === this.GetListTableRowParent(); 33604 }, 33605 GetVisibleItemCount: function () { 33606 return this.itemsManager.GetVisibleItemCount(); 33607 }, 33608 GetIndexVisibleItem: function(item) { 33609 var count = this.GetItemCount(); 33610 var visibleItemCount = 0; 33611 for(var i = 0; i < count; i ++){ 33612 if(this.IsItemFiltered(i)) 33613 visibleItemCount++; 33614 var curItem = this.GetItem(i); 33615 if(item.value === curItem.value && item.text === curItem.text) 33616 break; 33617 } 33618 return visibleItemCount; 33619 }, 33620 GetItemCellCount: function(){ 33621 if(this.hasSampleItem) 33622 return this.GetSampleItemRow().cells.length; 33623 if(this.GetItemCount() > 0) 33624 return this.itemsManager.GetFirstVisibleItemRow().cells.length; 33625 return 0; 33626 }, 33627 GetItemTextCellCount: function(){ 33628 return this.GetItemCellCount() - this.GetItemFirstTextCellIndex(); 33629 }, 33630 GetItemFirstTextCellIndex: function(){ 33631 var itemFirstTextCellIndex = 0; 33632 if(this.GetIsCheckColumnExists()) 33633 itemFirstTextCellIndex++; 33634 if(this.imageCellExists) 33635 itemFirstTextCellIndex++; 33636 return itemFirstTextCellIndex; 33637 }, 33638 GetItemFirstTextCell: function(index){ 33639 return this.GetItemTextCell(index, 0); 33640 }, 33641 GetItemTextCell: function(itemIndex, textCellIndex) { 33642 var rowElement = this.GetItemRow(itemIndex); 33643 if(rowElement == null) 33644 return null; 33645 return rowElement.cells[this.GetItemFirstTextCellIndex() + textCellIndex]; 33646 }, 33647 GetItemTextCells: function(item) { 33648 var firstTextCellIndex = this.GetItemFirstTextCellIndex(); 33649 return Array.prototype.slice.call(this.GetItemSelectableElementsByRow(item), firstTextCellIndex); 33650 }, 33651 GetItemTopOffset: function(index){ 33652 return this.itemsManager.GetItemTopOffset(index); 33653 }, 33654 GetItemHeight: function(index){ 33655 return this.itemsManager.GetItemHeight(index); 33656 }, 33657 GetItemsHeight: function(){ 33658 return this.itemsManager.GetItemsHeight(); 33659 }, 33660 GetItemsWidth: function () { 33661 return this.itemsManager.GetItemsWidth(); 33662 }, 33663 GetItemCheckBoxInput: function(index){ 33664 var itemRow = this.GetItemRow(index); 33665 var checkBoxCell = itemRow ? itemRow.cells[this.GetCheckBoxCellIndex()] : null; 33666 return checkBoxCell ? ASPx.GetNodesByTagName(checkBoxCell, "input")[0] : null; 33667 }, 33668 GetIsCheckColumnExists: function(){ 33669 if(!this.checkCellExists) 33670 this.checkCellExists = this.CheckColumnSelectionMode(); 33671 return this.checkCellExists; 33672 }, 33673 GetCheckBoxCellIndex: function(){ 33674 return 0; 33675 }, 33676 GetImageCellIndex: function(){ 33677 return this.GetIsCheckColumnExists() ? 1 : 0; 33678 },
33679 GetItemCellsIdPostfixes: function(){ 33680 if(this.itemCellsIdPostfixes == null){ 33681 this.itemCellsIdPostfixes = []; 33682 var i = 0; 33683 if(this.GetIsCheckColumnExists()) { 33684 this.itemCellsIdPostfixes.push(lbIPostfixes[0]); 33685 i++; 33686 } 33687 if(this.imageCellExists){ 33688 this.itemCellsIdPostfixes.push(lbIPostfixes[1]); 33689 i++; 33690 } 33691 var cellCount = this.GetItemCellCount(); 33692 for(; i < cellCount; i++) 33693 this.itemCellsIdPostfixes.push(lbIPostfixes[2] + i); 33694 } 33695 return this.itemCellsIdPostfixes; 33696 }, 33697 AdjustControl: function (nestedCall) { 33698 if(this.IsAdjustmentRequired()) 33699 this.heightCorrected = false; 33700 ASPxClientEdit.prototype.AdjustControl.call(this, nestedCall); 33701 }, 33702 AdjustControlCore: function(){ 33703 this.RemoveShowHideFilterCssRules(); 33704 if(this.disableScrolling) 33705 return; 33706 ASPxClientEdit.prototype.AdjustControlCore.call(this); 33707 this.CorrectSize(); 33708 this.itemsManager.Adjust(); 33709 this.EnsureSelectedItemVisible(); 33710 if(this.showFilterButton) { 33711 this.UpdateFilterButtonHeight(); 33712 this.UpdateShowHideFilterElementCssRules(); 33713 } 33714 }, 33715 CorrectSize: function() { 33716 if(this.isComboBoxList || this.disableScrolling || this.filterStrategy.currentCallbackIsFiltration) 33717 return; 33718 this.LockScrollHandler(); 33719 this.CorrectHeight(); 33720 this.CorrectWidth(); 33721 this.InitializePageSize(); 33722 this.UnlockScrollHandler(); 33723 }, 33724 OnCorrectSizeByTimer: function() { 33725 if(this.IsVisible()) 33726 this.CorrectSize(); 33727 }, 33728 SetProtectionFromFlick_inFF: function(changeVisibility, changeDisplay){ 33729 if(!ASPx.Browser.Firefox) return; 33730 var listTable = this.GetListTable(); 33731 if(changeVisibility) 33732 listTable.style.visibility = "hidden"; 33733 if(changeDisplay) 33734 listTable.style.display = "none"; 33735 }, 33736 ResetProtectionFromFlick_inFF: function(){ 33737 if(!ASPx.Browser.Firefox) return; 33738 var listTable = this.GetListTable(); 33739 listTable.style.visibility = ""; 33740 listTable.style.display = ""; 33741 }, 33742 CorrectHeight: function(force){ 33743 if(ASPx.Browser.Firefox && this.heightCorrected && !force) return; 33744 this.heightCorrected = true; 33745 var mainElement = this.GetMainElement(); 33746 var divElement = this.GetScrollDivElement(); 33747 divElement.style.height = "0px"; 33748 var height = mainElement.offsetHeight; 33749 divElement.style.height = height + "px"; 33750 var extrudedHeight = mainElement.offsetHeight; 33751 var heightCorrection = extrudedHeight - height; 33752 if(heightCorrection > 0){ 33753 var divHeight = divElement.offsetHeight; 33754 this.SetProtectionFromFlick_inFF(true, false); 33755 divElement.style.height = (divHeight - heightCorrection) + "px"; 33756 this.ResetProtectionFromFlick_inFF(); 33757 extrudedHeight = mainElement.offsetHeight; 33758 var paddingsHeightCorrection = extrudedHeight - height; 33759 if(paddingsHeightCorrection > 0) 33760 divElement.style.height = (divHeight - heightCorrection - paddingsHeightCorrection) + "px"; 33761 } 33762 }, 33763 IsMultiColumn: function(){ 33764 return this.columnFieldNames.length > 0; 33765 }, 33766 IsCorrectWidthRequired: function(){ 33767 return true; 33768 }, 33769 GetVisibleColumnCount: function() { 33770 if (!this.visibleColumnCount) { 33771 this.visibleColumnCount = this.IsMultiColumn() ? 33772 ASPx.Data.CollectionToArray(this.GetSampleItemRow().cells) 33773 .slice(this.GetItemFirstTextCellIndex()) 33774 .filter(function (cell) { return ASPx.GetElementDisplay(cell); }).length 33775 : -1; 33776 } 33777 return this.visibleColumnCount; 33778 }, 33779 CorrectWidth: function () { 33780 if(!this.IsCorrectWidthRequired()) return; 33781 if(this.IsMultiColumn()) 33782 this.CorrectMultiColumnWidth(); 33783 else 33784 this.CorrectNonMultiColumnWidth(); 33785 }, 33786 CorrectMultiColumnWidth: function(){ 33787 var scrollBarWidth = this.GetVerticalScrollBarWidth(); 33788 this.CorrectMultiColumnHeaderWidth(scrollBarWidth); 33789 }, 33790 CollapseMultiColumnHeaderWidth:function(){ 33791 var headerDivElement = this.GetHeaderDivElement(); 33792 headerDivElement.style.width = "0px"; 33793 }, 33794 CorrectMultiColumnHeaderWidth: function(scrollBarWidth){ 33795 var headerDivElement = this.GetHeaderDivElement(); 33796 if(ASPx.IsExistsElement(headerDivElement)){ 33797 var headerTable; 33798 if(ASPx.Browser.WebKitFamily){ 33799 headerTable = this.GetHeaderTableElement(); 33800 if(!ASPx.IsExistsElement(headerTable)) 33801 headerTable = null; 33802 } 33803 if(this.rtl) 33804 headerDivElement.style.paddingLeft = scrollBarWidth + "px"; 33805 else 33806 headerDivElement.style.paddingRight = scrollBarWidth + "px"; 33807 if(headerTable) 33808 window.setTimeout(function() { headerTable.style.width = "100%"; }, 0); 33809 } 33810 }, 33811 CorrectNonMultiColumnWidth: function(){ 33812 var mainElement = this.GetMainElement(), 33813 divElement = this.GetScrollDivElement(); 33814 if(this.width == ""){ 33815 var itemsWidth = this.GetItemsWidth(); 33816 if (itemsWidth != 0 || !ASPx.Browser.NetscapeFamily) { 33817 divElement.style.width = Math.max((itemsWidth + this.GetVerticalScrollBarWidth()), this.scrollDivMinWidth) + "px"; 33818 if(ASPx.Browser.Firefox) 33819 mainElement.style.width = divElement.offsetWidth + "px"; 33820 } 33821 } else { 33822 mainElement.style.width = this.width; 33823 if(this.width !== "100%") { 33824 var scrollDivWidth = ASPx.Browser.WebKitFamily ? 1 : 0; 33825 var oldScrollTop = divElement.scrollTop; 33826 divElement.style.width = scrollDivWidth + "px"; 33827 scrollDivWidth = ASPx.Browser.Edge ? mainElement.clientWidth - ASPx.GetHorizontalBordersWidth(mainElement) : mainElement.clientWidth; 33828 divElement.style.width = scrollDivWidth + "px"; 33829 var isScrollEventWillRaised = divElement.scrollTop != oldScrollTop; 33830 if(isScrollEventWillRaised) 33831 this.itemsManager.DeactivateScrollHandler(); 33832 divElement.scrollTop = oldScrollTop; 33833 } 33834 } 33835 }, 33836 UpdateAdjustmentFlags: function() { 33837 var mainElement = this.GetMainElement(); 33838 if(mainElement) { 33839 var mainElementStyle = ASPx.GetCurrentStyle(mainElement); 33840 this.UpdatePercentSizeConfig([this.width], [mainElementStyle.height, mainElement.style.height]); 33841 } 33842 }, 33843 EnsureSelectedItemVisible: function() { 33844 var index = this.GetSelectedIndex(); 33845 if(index != -1) 33846 this.itemsManager.MakeItemVisibleAtTop(index); 33847 }, 33848 MakeItemVisible: function(index) { 33849 if(!this.itemsManager.IsItemVisible(index)) 33850 this.itemsManager.MakeItemVisibleAtTop(index); 33851 }, 33852 ScrollItemToTop: function(index) { 33853 this.LockScrollHandler(); 33854 this.SetScrollTop(this.GetItemTopOffset(index)); 33855 this.UnlockScrollHandler(); 33856 }, 33857 GetScrollDivChildElementHeight: function() { 33858 return this.itemsManager.GetScrollDivChildElementHeight(); 33859 }, 33860 SetScrollTop: function(scrollTop){ 33861 var scrollDiv = this.GetScrollDivElement(); 33862 if(scrollDiv){ 33863 scrollDiv.scrollTop = scrollTop; 33864 if(ASPx.Browser.Opera) 33865 this.CachedScrollTop(); 33866 } 33867 }, 33868 CachedScrollTop: function(){ 33869 var scrollDiv = this.GetScrollDivElement(); 33870 scrollDiv.cachedScrollTop = scrollDiv.scrollTop; 33871 }, 33872 RestoreScrollTopFromCache: function(){ 33873 var scrollDiv = this.GetScrollDivElement(); 33874 if(scrollDiv && ASPx.IsExists(scrollDiv.cachedScrollTop)) 33875 scrollDiv.scrollTop = scrollDiv.cachedScrollTop; 33876 }, 33877 IsListBoxWidthLessThenList: function(){ 33878 var divElement = this.GetScrollDivElement(); 33879 var listTable = this.GetListTable(); 33880 var listTabelWidth = listTable.style.width; 33881 var isLess = false; 33882 listTable.style.width = ""; 33883 isLess = listTable.offsetWidth < divElement.offsetWidth; 33884 listTable.style.width = listTabelWidth; 33885 return isLess; 33886 }, 33887 GetVerticalScrollBarWidth: function(){ 33888 var divElement = this.GetScrollDivElement(); 33889 if(!this.verticalScrollBarWidth || this.verticalScrollBarWidth <= 0){ 33890 this.verticalScrollBarWidth = this.GetVerticalScrollBarWidthCore(divElement); 33891 return this.verticalScrollBarWidth; 33892 } else 33893 return this.GetIsVerticalScrollBarVisible(divElement) ? this.verticalScrollBarWidth : 0; 33894 }, 33895 GetIsVerticalScrollBarVisible: function(divElement){ 33896 var verticalOverflow = this.GetVerticalOverflow(divElement); 33897 if(verticalOverflow != "auto"){ 33898 return divElement.clientHeight < this.GetListTableHeight(); 33899 } else { 33900 var borderWidthWithScroll = divElement.offsetWidth - divElement.clientWidth; 33901 return borderWidthWithScroll == this.scrollDivBordersWidthWithScroll; 33902 } 33903 }, 33904 GetVerticalScrollBarWidthCore: function(divElement){ 33905 var overflowYReserv = this.GetVerticalOverflow(divElement); 33906 this.SetVerticalOverflow(divElement, "auto"); 33907 this.scrollDivBordersWidthWithScroll = divElement.offsetWidth - divElement.clientWidth; 33908 this.SetProtectionFromFlick_inFF(false, true); 33909 this.SetVerticalOverflow(divElement, "hidden"); 33910 var bordersWidthWithoutScroll = divElement.offsetWidth - divElement.clientWidth; 33911 this.SetVerticalOverflow(divElement, overflowYReserv); 33912 this.ResetProtectionFromFlick_inFF(); 33913 return this.scrollDivBordersWidthWithScroll - bordersWidthWithoutScroll; 33914 }, 33915 GetVerticalOverflowPropertyName: function() { 33916 if(ASPx.Browser.WebKitFamily || ASPx.Browser.AndroidDefaultBrowser || ASPx.Browser.Firefox && ASPx.Browser.Version >= 3) 33917 return "overflowY"; 33918 return "overflow"; 33919 }, 33920 GetVerticalOverflow: function(element){ 33921 return element.style[this.GetVerticalOverflowPropertyName()]; 33922 }, 33923 SetVerticalOverflow: function(element, value) { 33924 element.style[this.GetVerticalOverflowPropertyName()] = value; 33925 }, 33926 MultiSelectionMode: function(){ 33927 return this.selectionMode != ListBoxSelectionMode.Single; 33928 }, 33929 CheckColumnSelectionMode: function(){ 33930 return this.selectionMode == ListBoxSelectionMode.CheckColumn; 33931 }, 33932 OnItemClick: function(index, evt){ 33933 if(!this.isInitialized) 33934 return; 33935 if (this.GetReadOnly()) { 33936 ASPx.Evt.PreventEvent(evt); 33937 return this.OnItemClickOrDblClickReadOnly(); 33938 } 33939 if(this.CheckColumnSelectionMode() && this.IsCheckBoxClicked(evt))
33940 this.GetItemSelectionHelper().OnItemCheckBoxClick(index, evt); 33941 else 33942 this.GetItemSelectionHelper().OnItemClick(index, evt); 33943 this.SetFocus(); 33944 this.RaiseItemClick(); 33945 }, 33946 OnItemClickOrDblClickReadOnly: function(){ 33947 return false; 33948 }, 33949 OnItemDblClick: function(){ 33950 if (this.GetReadOnly()) 33951 return this.OnItemClickOrDblClickReadOnly(); 33952 return this.RaiseItemDoubleClick(); 33953 }, 33954 CanChangeSelection: function(){ 33955 return !this.GetReadOnly() || !this.isInitialized; 33956 }, 33957 SelectIndexSilent: function(index){ 33958 return this.SetItemSelectionStateSilent(index); 33959 }, 33960 SetItemSelectionStateSilent: function(index) { 33961 if(!this.CanChangeSelection()) 33962 return; 33963 var oldSelectionIndex = this.GetSelectedIndex(); 33964 this.LockSelectionEvents(); 33965 this.SetSelectedIndexCore(index); 33966 this.UnlockSelectionEvents(); 33967 return index !== oldSelectionIndex; 33968 }, 33969 SetItemSelectionAppearance: function (index, selected, controller, checkCanChangeSelection) { 33970 if (checkCanChangeSelection && !this.CanChangeSelection()) 33971 return; 33972 if(!controller) 33973 controller = ASPx.GetStateController(); 33974 var itemFirstTextCell = this.GetItemFirstTextCell(index); 33975 if(selected) 33976 controller.SelectElementBySrcElement(itemFirstTextCell); 33977 else 33978 controller.DeselectElementBySrcElement(itemFirstTextCell); 33979 }, 33980 GetItemSelectionHelper: function(){ 33981 if(!this.itemSelectionHelper) 33982 this.itemSelectionHelper = this.CreateItemSelectionHelper(); 33983 return this.itemSelectionHelper; 33984 }, 33985 CreateItemSelectionHelper: function(){ 33986 if(this.selectionMode == ListBoxSelectionMode.Single) 33987 return new ListBoxSingleSelectionHelper(this); 33988 else if(this.selectionMode == ListBoxSelectionMode.Multiple) 33989 return new ListBoxMultiSelectionHelper(this); 33990 else if(this.selectionMode == ListBoxSelectionMode.CheckColumn) 33991 return new ListBoxCheckSelectionHelper(this); 33992 }, 33993 GetValue: function(){ 33994 var index = this.GetSelectedIndex(); 33995 if(0 <= index && index < this.itemsValue.length) 33996 return this.itemsValue[index]; 33997 return null; 33998 }, 33999 SetValue: function(value){ 34000 var index = this.FindItemIndexByValue(value); 34001 this.SetSelectedIndex(index); 34002 }, 34003 GetSelectedItem: function(){ 34004 var index = this.GetSelectedIndex(); 34005 return this.GetItem(index); 34006 }, 34007 GetSelectedIndex: function(){ 34008 if(!this.itemSelectionHelper) 34009 return this.GetSelectedIndexInternal(); 34010 return this.GetItemSelectionHelper().GetSelectedIndex(); 34011 }, 34012 SetSelectedIndex: function(index){ 34013 this.LockSelectionEvents(); 34014 this.SetSelectedIndexCore(index); 34015 this.EnsureSelectedItemVisible(index); 34016 this.UnlockSelectionEvents(); 34017 }, 34018 SetSelectedIndexCore: function(index){ 34019 this.GetItemSelectionHelper().SetSelectedIndex(index); 34020 }, 34021 GetSelectedIndices: function(){ 34022 return this.GetItemSelectionHelper().GetSelectedIndices(); 34023 }, 34024 GetSelectedValues: function(){ 34025 return this.GetItemSelectionHelper().GetSelectedValues(); 34026 }, 34027 GetSelectedItems: function(){ 34028 return this.GetItemSelectionHelper().GetSelectedItems(); 34029 }, 34030 SelectAll: function(){ 34031 this.SelectIndices(); 34032 }, 34033 UnselectAll: function(){ 34034 this.UnselectIndices(); 34035 }, 34036 SelectIndices: function(indices){ 34037 this.LockSelectionEvents(); 34038 this.GetItemSelectionHelper().SelectIndices(indices); 34039 this.UnlockSelectionEvents(); 34040 }, 34041 SelectItems: function(items){ 34042 this.LockSelectionEvents(); 34043 this.GetItemSelectionHelper().SelectItems(items); 34044 this.UnlockSelectionEvents(); 34045 }, 34046 SelectValues: function(values){ 34047 this.LockSelectionEvents(); 34048 this.GetItemSelectionHelper().SelectValues(values); 34049 this.UnlockSelectionEvents(); 34050 }, 34051 UnselectIndices: function(indices){ 34052 this.LockSelectionEvents(); 34053 this.GetItemSelectionHelper().UnselectIndices(indices); 34054 this.UnlockSelectionEvents(); 34055 }, 34056 UnselectItems: function(items){ 34057 this.LockSelectionEvents(); 34058 this.GetItemSelectionHelper().UnselectItems(items); 34059 this.UnlockSelectionEvents(); 34060 }, 34061 UnselectValues: function(values){ 34062 this.LockSelectionEvents(); 34063 this.GetItemSelectionHelper().UnselectValues(values); 34064 this.UnlockSelectionEvents(); 34065 }, 34066 GetIsItemSelected: function(index){ 34067 return this.GetItemSelectionHelper().GetIsItemSelected(index); 34068 }, 34069 GetFocusedIndex: function(){ 34070 return this.GetItemSelectionHelper().GetFocusedIndex(); 34071 }, 34072 UpdateInternalState: function(){
34073 this.UpdateHiddenInputs(); 34074 }, 34075 IsUpdateHiddenInputsLocked: function(){ 34076 return this.GetItemSelectionHelper().IsUpdateInternalSelectionStateLocked(); 34077 }, 34078 UpdateHiddenInputs: function(){ 34079 if(this.IsUpdateHiddenInputsLocked()) 34080 return; 34081 if(this.MultiSelectionMode()){ 34082 var element = this.FindStateInputElement(); 34083 if(ASPx.IsExistsElement(element)) { 34084 var sb = [ ]; 34085 var serialiser = this.GetSerializingHelper(); 34086 var selectedIndices = this.GetSelectedIndices(); 34087 for(var i = 0; i < selectedIndices.length; i++) 34088 serialiser.SerializeAtomValue(sb, this.GetItemValue(selectedIndices[i])); 34089 element.value = sb.join(""); 34090 } 34091 } else 34092 ASPxClientListBoxBase.prototype.UpdateHiddenInputs.call(this); 34093 }, 34094 UseDelayedSpecialFocus: function() { 34095 return true; 34096 }, 34097 GetInnerEditors: function() { 34098 var result = ASPxClientListBoxBase.prototype.GetInnerEditors(); 34099 if(this.filteringTextBox) { 34100 result.push(this.filteringTextBox); 34101 } 34102 return result; 34103 }, 34104 AdjustWidthInDropDown: function(parentComboBoxMainElement, isCallbackMode, customWidth) { 34105 var lbScrollDiv = this.GetScrollDivElement(); 34106 var lbMainElement = this.GetMainElement(); 34107 var scrollWidth = 0; 34108 if (this.IsMultiColumn() && isCallbackMode && this.GetScrollSpacerVisibility(false) && this.GetBottomScrollSpacerHeight() == 0) 34109 this.SetBottomScrollSpacerVisibility(true); 34110 var keepCurrentWidth = this.HasVirtualScrolling() && this.hasDecoratedItems && this.isComboBoxScrollingCallbackProcessing; 34111 if(!keepCurrentWidth) { 34112 lbMainElement.style.width = ""; 34113 lbScrollDiv.style.paddingRight = "0px"; 34114 lbScrollDiv.style.width = "100%"; 34115 } 34116 else 34117 this.isComboBoxScrollingCallbackProcessing = false; 34118 if (customWidth != "") { 34119 lbMainElement.style.width = customWidth; 34120 var width = lbMainElement.clientWidth; 34121 var scrollInfo = this.SetScrollDivAndCorrectionForScroll(width, false); 34122 width = scrollInfo.scrollDivWidth; 34123 scrollWidth = scrollInfo.scrollWidth; 34124 if(!this.enableEllipsis) { 34125 var difference = this.GetItemsWidth() - lbScrollDiv.clientWidth; 34126 if (difference > 0) { 34127 lbMainElement.style.width = (lbMainElement.offsetWidth + difference) + "px"; 34128 lbScrollDiv.style.width = (lbMainElement.clientWidth) + "px"; 34129 } 34130 } 34131 } else { 34132 var width = this.GetItemsWidth(); 34133 var scrollInfo = this.SetScrollDivAndCorrectionForScroll(width, true); 34134 width = scrollInfo.scrollDivWidth; 34135 scrollWidth = scrollInfo.scrollWidth; 34136 if (ASPx.Browser.Firefox && lbMainElement.offsetWidth < lbScrollDiv.offsetWidth) 34137 lbMainElement.style.width = "0%"; 34138 if (parentComboBoxMainElement) { 34139 var widthDifference = parentComboBoxMainElement.offsetWidth - lbMainElement.offsetWidth; 34140 if (widthDifference > 0) { 34141 this.scrollDivMinWidth = width + widthDifference; 34142 lbScrollDiv.style.width = this.scrollDivMinWidth + "px"; 34143 var twoBorderSize = (lbMainElement.offsetWidth - lbMainElement.clientWidth); 34144 lbMainElement.style.width = (width + widthDifference + twoBorderSize) + "px"; 34145 } 34146 } 34147 } 34148 if (this.IsMultiColumn()) 34149 this.CorrectMultiColumnHeaderWidth(scrollWidth); 34150 if (this.NeedToHandleCellWidth()) 34151 this.CorrectCellNullWidthStyle(this.itemsManager.GetFirstVisibleItemRow()); 34152 if (this.ContainsFixWidthRow()) { 34153 var lbHeaderDiv = this.GetHeaderDivElement(); 34154 if (lbHeaderDiv) 34155 lbScrollDiv.style.width = lbHeaderDiv.offsetWidth - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(lbScrollDiv) + "px"; 34156 } 34157 return lbScrollDiv.offsetWidth; 34158 }, 34159 SetScrollDivAndCorrectionForScroll: function(width, widthByContent) { 34160 var lbScrollDiv = this.GetScrollDivElement(); 34161 var scrollWidth = this.GetVerticalScrollBarWidth(); 34162 var browserCanHaveScroll = this.GetVerticalOverflow(lbScrollDiv) == "auto"; 34163 if (widthByContent && browserCanHaveScroll) 34164 width += scrollWidth; 34165 lbScrollDiv.style.width = width + "px"; 34166 return { scrollDivWidth: width, scrollWidth: scrollWidth }; 34167 }, 34168 BeforeAdjustHeightInDropDown: function() { 34169 this.GetMainElement().style.height = "0px"; 34170 }, 34171 AdjustHeightInDropDown: function(customHeight, visibleRowCount) { 34172 this.BeforeAdjustHeightInDropDown(); 34173 if(this.itemsManager.smallestItemHeight === 0) 34174 this.itemsManager.updateSmallestItemSize(); 34175 var lbHeight = 0; 34176 if (customHeight == "") 34177 lbHeight = this.GetHeightByContent(visibleRowCount); 34178 else 34179 lbHeight = this.GetHeightByServerValue(customHeight); 34180 this.itemsManager.Adjust(); 34181 this.InitializePageSize(); 34182 return lbHeight; 34183 }, 34184 GetHeightByContent: function(visibleRowCount) { 34185 var lbScrollDiv = this.GetScrollDivElement(), 34186 itemCount = this.GetVisibleItemCount(), 34187 hasVerticalScrollbar = itemCount > visibleRowCount; 34188 lbScrollDiv.style.height = ""; 34189 var height = 0; 34190 if (hasVerticalScrollbar) 34191 height = this.itemsManager.GetTotalItemsHeight(0, visibleRowCount - 1); 34192 else { 34193 if(itemCount !== 0) { 34194 height = this.GetItemsHeight(); 34195 } 34196 } 34197 height += "px"; 34198 lbScrollDiv.style.height = height; 34199 height = lbScrollDiv.offsetHeight; 34200 height += ASPx.GetTopBottomBordersAndPaddingsSummaryValue(this.GetMainElement()); 34201 var lbHeaderDiv = this.GetHeaderDivElement(); 34202 if (ASPx.IsExists(lbHeaderDiv)) 34203 height += lbHeaderDiv.offsetHeight; 34204 return height; 34205 }, 34206 GetHeightByServerValue: function(customHeight) { 34207 var lbMainElement = this.GetMainElement(); 34208 var lbScrollDiv = this.GetScrollDivElement(); 34209 var height = customHeight; 34210 lbMainElement.style.height = "0px"; 34211 lbScrollDiv.style.height = "0px"; 34212 lbMainElement.style.height = height; 34213 var trueLbOffsetHeight = lbMainElement.offsetHeight; 34214 var trueLbClientHeight = lbMainElement.clientHeight; 34215 lbScrollDiv.style.height = lbMainElement.clientHeight + "px";
34216 var lbHeightCorrection = lbMainElement.offsetHeight - trueLbOffsetHeight; 34217 lbScrollDiv.style.height = (trueLbClientHeight - lbHeightCorrection) + "px"; 34218 height = lbMainElement.offsetHeight; 34219 return height; 34220 }, 34221 GetLoadingParentElement: function() { 34222 return this.GetScrollDivElement().parentNode; 34223 }, 34224 ShowLoadingPanel: function() { 34225 if(!this.isComboBoxList){ 34226 var loadingParentElement = this.GetLoadingParentElement(); 34227 var lp = this.CreateLoadingPanelWithAbsolutePosition(loadingParentElement); 34228 this.PreventMouseWheelOnElement(lp); 34229 } 34230 }, 34231 ShowLoadingDiv: function () { 34232 if(!this.isComboBoxList){ 34233 var loadingParentElement = this.GetLoadingParentElement(); 34234 var ld = this.CreateLoadingDiv(loadingParentElement); 34235 this.PreventMouseWheelOnElement(ld); 34236 } 34237 }, 34238 PreventMouseWheelOnElement: function(element) { 34239 if(!element) return; 34240 var wheelEventName = ASPx.Evt.GetMouseWheelEventName(); 34241 ASPx.Evt.AttachEventToElement(element, wheelEventName, function(evt) { 34242 if(this.scrollHelper.GetIsAnySpacerVisible()) 34243 ASPx.Evt.PreventEvent(evt); 34244 }.aspxBind(this)); 34245 }, 34246 ParseCallbackResult: function(result, shouldSelectSilentDelegate){ 34247 var gottenEgdeOfCollection = false; 34248 var isLoadindToTopByScroll = this.scrollHelper.IsScrolledToTopSpacer(); 34249 if(result[CONSTANTS.CALLBACK_RESULTS.ITEMS].length) { 34250 var deserializedItems = this.DeserializeItems(result[CONSTANTS.CALLBACK_RESULTS.ITEMS]); 34251 this.LoadItemsFromCallback(isLoadindToTopByScroll, deserializedItems, shouldSelectSilentDelegate); 34252 gottenEgdeOfCollection = deserializedItems.length < this.callbackPageSize; 34253 } 34254 var noMoreItemsForLoadThisDirection = !result[CONSTANTS.CALLBACK_RESULTS.ITEMS].length || gottenEgdeOfCollection; 34255 this.SetScrollSpacerVisibility(isLoadindToTopByScroll, !noMoreItemsForLoadThisDirection); 34256 this.scrollHelper.Reset(); 34257 }, 34258 LoadItemsFromCallback: function(isToTop, deserializedItems, shouldSelectSilentDelegate){ 34259 this.LockSynchronizationOnInternalCallback(); 34260 this.BeginUpdate(); 34261 var isMultiSelect = this.MultiSelectionMode(); 34262 this.RemoveAccessibilityHeaderRow(); 34263 if(isToTop){ 34264 var scrollHeightCorrection = 0; 34265 for(var i = deserializedItems.length - 1; i >= 0; i--) { 34266 this.InsertItemInternal(0, deserializedItems[i]); 34267 scrollHeightCorrection += this.GetItemHeight(0); 34268 } 34269 this.GetScrollDivElement().scrollTop += scrollHeightCorrection; 34270 this.serverIndexOfFirstItem -= deserializedItems.length; 34271 if(this.serverIndexOfFirstItem < 0) this.serverIndexOfFirstItem = 0; 34272 } else { 34273 for(var i = 0; i < deserializedItems.length; i++) { 34274 var itemIndex = this.AddItemInternal(deserializedItems[i]); 34275 var shouldSelectSilent = shouldSelectSilentDelegate && shouldSelectSilentDelegate(deserializedItems[i].value, deserializedItems[i].text); 34276 this.SelectValueOnLoad(itemIndex, deserializedItems[i].selected, shouldSelectSilent, isMultiSelect); 34277 } 34278 } 34279 if(this.changeSelectAfterCallback != 0) { 34280 var newIndex = this.GetSelectedIndex() + this.changeSelectAfterCallback; 34281 newIndex = this.GetAdjustedIndex(newIndex); 34282 this.SelectIndexSilent(newIndex); 34283 if(this.scrollHelper.isScrolledToTopSpacer) 34284 this.ScrollItemToTop(newIndex); 34285 else 34286 this.MakeItemVisible(newIndex); 34287 } 34288 this.AddAccessibilityHeaderRow(); 34289 this.EndUpdate(); 34290 this.UnlockSynchronizationOnInternalCallback(); 34291 }, 34292 SelectValueOnLoad: function (index, selected, shouldSelectSilent, isMultiSelect) { 34293 if(selected && this.changeSelectAfterCallback == 0) { 34294 if(isMultiSelect) { 34295 this.SelectIndices([index]); 34296 } else { 34297 if(shouldSelectSilent) 34298 this.SelectIndexSilent(index); 34299 else 34300 this.SelectIndex(index); 34301 } 34302 } 34303 }, 34304 CreateSerializingHelper: function(){ 34305 return new ListBoxItemsSerializingHelper(this); 34306 }, 34307 InCallback: function(){ 34308 var callbackOwner = this.GetCallbackOwnerControl(); 34309 if(callbackOwner != null) 34310 return callbackOwner.InCallback(); 34311 return ASPxClientListEdit.prototype.InCallback.call(this); 34312 }, 34313 GetItemsRangeForLoad: function(){ 34314 return this.scrollHelper.GetItemsRangeForLoad(); 34315 }, 34316 GetScrollSpacerElement: function(isTop){ 34317 return document.getElementById(this.name + (isTop ? lbTSIdSuffix : lbBSIdSuffix)); 34318 }, 34319 GetScrollSpacerVisibility: function(isTop){ 34320 if(!this.clientEnabled) 34321 return false; 34322 return isTop ? this.isTopSpacerVisible : this.isBottomSpacerVisible; 34323 }, 34324 SetScrollSpacerVisibility: function(isTop, visibility){ 34325 this.LockScrollHandler(); 34326 var spacer = this.GetScrollSpacerElement(isTop); 34327 if(spacer){ 34328 if(visibility) 34329 spacer.style.height = this.GetRequiredScrollSpacerHeight() + "px"; 34330 if(this.clientEnabled){ 34331 if(isTop) 34332 this.isTopSpacerVisible = visibility; 34333 else 34334 this.isBottomSpacerVisible = visibility; 34335 } 34336 if(ASPx.GetElementDisplay(spacer) != visibility){ 34337 ASPx.SetElementDisplay(spacer, visibility); 34338 ASPx.GetElementVisibility(spacer, visibility); 34339 } 34340 } 34341 this.itemsManager.OnScrollSpacerVisibilityChanged(); 34342 this.UnlockScrollHandler(); 34343 }, 34344 GetRequiredScrollSpacerHeight: function() { 34345 return this.GetScrollDivElement().clientHeight; 34346 }, 34347 SetTopScrollSpacerVisibility: function(visibility){ 34348 this.SetScrollSpacerVisibility(true, visibility); 34349 }, 34350 SetBottomScrollSpacerVisibility: function(visibility){ 34351 this.SetScrollSpacerVisibility(false, visibility); 34352 }, 34353 GetTopScrollSpacerHeight: function(){ 34354 return this.GetScrollSpacerVisibility(true) ? this.GetScrollSpacerElement(true).clientHeight : 0; 34355 }, 34356 GetBottomScrollSpacerHeight: function(){ 34357 return this.GetScrollSpacerVisibility(false) ? this.GetScrollSpacerElement(false).clientHeight : 0; 34358 }, 34359 GetTopSpacersHeight: function() { 34360 return this.itemsManager.GetTopSpacersHeight(); 34361 }, 34362 SendCallback: function(onSuccess) { 34363 if(!this.InCallback()){ 34364 this.ShowLoadingElements(); 34365 var callbackOwner = this.GetCallbackOwnerControl(); 34366 if(callbackOwner != null) 34367 callbackOwner.SendCallback(onSuccess); 34368 else { 34369 var argument = this.GetCallbackArguments(); 34370 this.CreateCallback(argument, null, onSuccess); 34371 } 34372 } 34373 }, 34374 OnCallback: function(result, shouldSelectSilentDelegate) { 34375 if(result.serverMode) 34376 this.UpdateStateObjectWithObject({serverMode: true}); 34377 if(!this.filterStrategy || !this.filterStrategy.ShouldDiscardCallbackResult()) { 34378 this.ParseCallbackResult(result, shouldSelectSilentDelegate); 34379 if(!this.isComboBoxList) 34380 this.filterStrategy.OnCallback(result); 34381 this.OnCallbackFinally(); 34382 } 34383 }, 34384 OnCallbackError: function(result){ 34385 ASPxClientListBoxBase.prototype.OnCallbackError.call(this, result); 34386 this.OnCallbackFinally(); 34387 }, 34388 OnCallbackFinally: function () { 34389 this.HideLoadingPanel(); 34390 this.changeSelectAfterCallback = 0; 34391 }, 34392 DoEndCallback: function() { 34393 this.filterStrategy.OnBeforeDoEndCallback(); 34394 ASPxClientListBoxBase.prototype.DoEndCallback.call(this); 34395 this.filterStrategy.OnAfterDoEndCallback(); 34396 }, 34397 RaiseEndCallback: function() { 34398 if(this.preventEndCallbackRising) 34399 this.preventEndCallbackRising = false; 34400 else 34401 ASPxClientListBoxBase.prototype.RaiseEndCallback.call(this); 34402 }, 34403 LockScrollHandler: function(){ 34404 this.scrollHandlerLockCount ++; 34405 }, 34406 UnlockScrollHandler: function(){ 34407 this.scrollHandlerLockCount --; 34408 }, 34409 IsScrollHandlerLocked: function(){ 34410 return this.scrollHandlerLockCount > 0; 34411 }, 34412 OnScroll: function(){ 34413 if(this.IsScrollHandlerLocked()) return; 34414 if(this.IsVisible() && !this.InCallback() && ( this.GetScrollSpacerVisibility(true) || this.GetScrollSpacerVisibility(false))) { 34415 this.scrollHelper.OnScroll(); 34416 if(this.scrollHelper.GetIsNeedToHideTopSpacer()) 34417 this.SetTopScrollSpacerVisibility(false); 34418 if(this.scrollHelper.GetIsNeedCallback()) { 34419 this.isComboBoxScrollingCallbackProcessing = this.isComboBoxList; 34420 this.SendCallback(); 34421 } 34422 } 34423 }, 34424 OnBrowserWindowResize: function(e) { 34425 if(this.IsVisible()) 34426 this.CorrectSize(); 34427 }, 34428 KeyboardSupportAllowed: function(){ 34429 return !this.CheckColumnSelectionMode(); 34430 }, 34431 InitializeKeyHandlers: function() { 34432 if(this.KeyboardSupportAllowed()){ 34433 this.AddKeyDownHandler(ASPx.Key.PageUp, "OnPageUp"); 34434 this.AddKeyDownHandler(ASPx.Key.PageDown, "OnPageDown"); 34435 this.AddKeyDownHandler(ASPx.Key.End, "OnEndKeyDown"); 34436 this.AddKeyDownHandler(ASPx.Key.Home, "OnHomeKeyDown"); 34437 this.AddKeyDownHandler(ASPx.Key.Up, "OnArrowUp"); 34438 this.AddKeyDownHandler(ASPx.Key.Down, "OnArrowDown"); 34439 } else if(this.accessibilityCompliant && !this.IsNativeCheckBoxes()) { 34440 this.AddKeyDownHandler(ASPx.Key.Up, "OnAccessArrowUp"); 34441 this.AddKeyDownHandler(ASPx.Key.Down, "OnAccessArrowDown"); 34442 } 34443 }, 34444 OnArrowUp: function(evt){ 34445 if(this.isInitialized) 34446 this.SelectNeighbour(-1); 34447 return true; 34448 }, 34449 OnArrowDown: function(evt){ 34450 if(this.isInitialized) 34451 this.SelectNeighbour(1); 34452 return true; 34453 }, 34454 OnAccessArrowUp: function(evt){ 34455 if(!this.isInitialized) return true; 34456 var index = this.GetFocusedIndex(); 34457 var isItemCheckBoxFocused = this.GetInternalCheckBox(index) && this.GetInternalCheckBox(index).focused; 34458 var isSelectAllCheckBoxFocused = this.selectAllCheckBox && this.selectAllCheckBox.focused; 34459 if(index > this.GetFirstFilteredItemIndex() && isItemCheckBoxFocused) 34460 this.SetFocusedIndex(this.GetPrevFilteredItemIndex(index)); 34461 else if(index == this.GetFirstFilteredItemIndex() && this.selectAllCheckBox && !isSelectAllCheckBoxFocused) { 34462 this.selectAllCheckBox.mainElement.focus(); 34463 this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false); 34464 } 34465 else 34466 this.SetFocusedIndex(this.GetLastFilteredItemIndex()); 34467 return true; 34468 }, 34469 OnAccessArrowDown: function(evt){ 34470 if(!this.isInitialized) return true; 34471 var index = this.GetFocusedIndex(); 34472 var isItemCheckBoxFocused = this.GetInternalCheckBox(index) && this.GetInternalCheckBox(index).focused; 34473 var isSelectAllCheckBoxFocused = this.selectAllCheckBox && this.selectAllCheckBox.focused; 34474 if(index < this.GetLastFilteredItemIndex() && isItemCheckBoxFocused) 34475 this.SetFocusedIndex(this.GetNextFilteredItemIndex(index)); 34476 else if(index == this.GetLastFilteredItemIndex() && this.selectAllCheckBox && !isSelectAllCheckBoxFocused) { 34477 this.selectAllCheckBox.mainElement.focus(); 34478 this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false); 34479 } 34480 else 34481 this.SetFocusedIndex(this.GetFirstFilteredItemIndex()); 34482 return true; 34483 }, 34484 SetFocusedIndex: function(index) { 34485 if(this.GetIsCheckColumnExists()) { 34486 this.MakeItemVisible(index); 34487 setTimeout(function () { this.GetInternalCheckBox(index).mainElement.focus(); }.aspxBind(this), 0); 34488 } 34489 this.GetItemSelectionHelper().SetFocusedIndexInternal(index, false); 34490 }, 34491 OnPageUp: function(evt){ 34492 if(this.isInitialized) 34493 this.SelectNeighbour(-this.scrollPageSize); 34494 return true; 34495 }, 34496 OnPageDown: function(evt){ 34497 if(this.isInitialized) 34498 this.SelectNeighbour(this.scrollPageSize); 34499 return true; 34500 }, 34501 OnHomeKeyDown: function(evt){ 34502 if(this.isInitialized) 34503 this.SelectNeighbour(-this.GetItemCount()); 34504 return true; 34505 }, 34506 OnEndKeyDown: function(evt){ 34507 if(this.isInitialized) 34508 this.SelectNeighbour(this.GetItemCount()); 34509 return true; 34510 }, 34511 GetAdjustedIndex: function(index){ 34512 if(index < 0) index = 0; 34513 else{ 34514 var itemCount = this.GetItemCount(); 34515 if(index >= itemCount) index = itemCount - 1; 34516 } 34517 return index; 34518 }, 34519 SelectNeighbour: function (step) { 34520 var itemCount = this.GetItemCount(); 34521 if(itemCount > 0) { 34522 this.changeSelectAfterCallback = 0; 34523 var selectedIndex = this.GetFocusedIndex(); 34524 var newSelectedIndex = this.GetNewSelectedIndex(selectedIndex, step); 34525 newSelectedIndex = this.GetAdjustedIndex(newSelectedIndex); 34526 if(selectedIndex != newSelectedIndex && this.IsItemFiltered(newSelectedIndex)) { 34527 this.LockScrollOnKBNavigation(); 34528 this.SetSelectedIndexCore(newSelectedIndex); 34529 this.UnlockScrollOnKBNavigation(); 34530 } 34531 if(this.GetIsNeedToCallbackLoadItemsToTop(newSelectedIndex, step, itemCount)) { 34532 this.LoadItemsOnCallback(true, newSelectedIndex); 34533 } else if(this.GetIsNeedToCallbackLoadItemsToBottom(newSelectedIndex, step, itemCount)) { 34534 this.LoadItemsOnCallback(false, newSelectedIndex); 34535 } 34536 this.itemsManager.MakeItemVisible(newSelectedIndex); 34537 } 34538 }, 34539 GetNewSelectedIndex: function(selectedIndex, step) { 34540 var pageDownSize = step == 1 ? this.scrollPageSize + 1 : this.scrollPageSize; 34541 var isFirstPageDown = selectedIndex == -1 && step == pageDownSize && step > 1; 34542 if(isFirstPageDown) 34543 step++; 34544 var newSelectedIndex = 0; 34545 var areThereUnfilteredItems = this.GetVisibleItemCount() < this.GetItemCount(); 34546 if(areThereUnfilteredItems) 34547 newSelectedIndex = this.itemsManager.GetNewItemIndexInFilteredRange(selectedIndex, step); 34548 else 34549 newSelectedIndex = selectedIndex + step; 34550 return newSelectedIndex; 34551 }, 34552 GetIsNeedToCallbackLoadItemsToTop: function(selectedIndex, step, itemCount){ 34553 return this.isCallbackMode && this.GetScrollSpacerVisibility(true) && 34554 this.serverIndexOfFirstItem > 0 && ((step < 0 && selectedIndex <= 0) || step <= -itemCount); 34555 }, 34556 GetIsNeedToCallbackLoadItemsToBottom: function(selectedIndex, step, itemCount){ 34557 return this.isCallbackMode && this.GetScrollSpacerVisibility(false) && 34558 ((step > 0 && selectedIndex >= itemCount - 1) || step >= itemCount); 34559 }, 34560 LoadItemsOnCallback: function(isToTop, index){ 34561 this.changeSelectAfterCallback = index - this.GetSelectedIndex(); 34562 this.scrollHelper.SetItemsRangeForLoad(isToTop); 34563 this.isComboBoxScrollingCallbackProcessing = this.isComboBoxList; 34564 this.SendCallback(); 34565 }, 34566 FindInputElement: function(){ 34567 if(this.accessibilityCompliant) 34568 return this.isComboBoxList ? null : this.GetAccessibilityAssistantElement(); 34569 return this.GetKBSInput(); 34570 },
34571 GetKBSInput: function() { 34572 return this.GetChildElement("KBS"); 34573 }, 34574 GetAccessibilityActiveElements: function() { 34575 var accessibilityElements = []; 34576 if(this.CheckColumnSelectionMode()) { 34577 for(var i = 0; i < this.GetItemCount() ; i++) { 34578 var checkBoxFocusableElement = this.GetCheckBoxFocusableElement(i); 34579 if(checkBoxFocusableElement) 34580 accessibilityElements.push(checkBoxFocusableElement); 34581 } 34582 } 34583 accessibilityElements.push(this.accessibilityCompliant ? this.GetAccessibilityHelper().GetActiveElement() : this.GetInputElement()); 34584 return accessibilityElements; 34585 }, 34586 SetHoverElement: function(element){ 34587 ASPx.GetStateController().SetCurrentHoverElementBySrcElement(element); 34588 }, 34589 InitOnContainerMadeVisible: function(){ 34590 this.AdjustControl(); 34591 }, 34592 ClearItemsCore: function(){ 34593 this.itemsManager.ClearItems(); 34594 this.EnsureFixWidthRow(); 34595 this.AddAccessibilityHeaderRow(); 34596 this.OnItemsCleared(); 34597 this.SetValue(null); 34598 }, 34599 OnItemsCleared: function(){ 34600 this.GetItemSelectionHelper().OnItemsCleared(); 34601 }, 34602 CorrectCellWidthsOnFirstRowItemReplacement: function(oldFirstRowItemIndex, newFirstRowItemIndex) { 34603 if (!this.ContainsFixWidthRow() && !this.HasVirtualScrolling()) { 34604 var oldFirstRowItemHasTemplate = this.ItemRowHasTemplate(oldFirstRowItemIndex); 34605 var newFirstRowItemHasTemplate = this.ItemRowHasTemplate(newFirstRowItemIndex); 34606 if(!oldFirstRowItemHasTemplate && !newFirstRowItemHasTemplate) 34607 this.CopyCellWidths(oldFirstRowItemIndex, newFirstRowItemIndex); 34608 } 34609 }, 34610 CopyCellWidths: function(sourceRowIndex, destinationRowIndex){ 34611 var cellCount = this.GetItemCellCount(); 34612 var sourceRow = this.GetItemRow(sourceRowIndex); 34613 var destRow = this.GetItemRow(destinationRowIndex); 34614 if (!sourceRow || !destRow) return; 34615 var lastDestCellIndex = destRow.cells.length - 1; 34616 for(var i = 0; i < lastDestCellIndex; i++) { 34617 destRow.cells[i].style.width = sourceRow.cells[i].style.width; 34618 } 34619 if(destRow.cells.length === cellCount) { 34620 destRow.cells[lastDestCellIndex].style.width = sourceRow.cells[lastDestCellIndex].style.width; 34621 } else { 34622 var cellWidths = ASPx.Data.CollectionToArray(sourceRow.cells) 34623 .slice(lastDestCellIndex) 34624 .map(function(cell) { return ASPx.PxToInt(cell.style.width); }) 34625 .reduce(function(accumulator, current) { return accumulator + current; }, 0); 34626 destRow.cells[lastDestCellIndex].style.width = cellWidths + "px"; 34627 } 34628 if(this.NeedToHandleCellWidth()) 34629 this.CorrectCellNullWidthStyle(destRow); 34630 }, 34631 RemoveItem: function (index) { 34632 var firstRenderedItem = this.itemsManager.GetFirstRenderedItem(); 34633 if (firstRenderedItem && index == firstRenderedItem.index && this.GetItemRow(firstRenderedItem.index + 1) !== null) 34634 this.CorrectCellWidthsOnFirstRowItemReplacement(firstRenderedItem.index, firstRenderedItem.index + 1); 34635 if (0 <= index && index < this.GetItemCount()) { 34636 this.UpdateSyncArraysItemDeleted(this.GetItem(index), true); 34637 this.itemsManager.RemoveItem(index); 34638 this.OnItemRemoved(index); 34639 } 34640 }, 34641 GetItem: function(index, preventEncodeText) { 34642 return this.itemsManager.GetItem(index, preventEncodeText); 34643 }, 34644 GetItemRowTexts: function(row) { 34645 var serializedTexts = this.GetTextsDataAttribute(row); 34646 if(ASPx.IsExists(serializedTexts)) 34647 return JSON.parse(serializedTexts); 34648 var texts = []; 34649 var i = this.GetItemFirstTextCellIndex(); 34650 var cellsLength = this.IsMultiColumn() ? row.cells.length : i + 1; 34651 for(; i < cellsLength; i++) { 34652 var textCell = row.cells[i]; 34653 texts.push(ASPxClientListBox.GetItemCellInnerText(textCell)); 34654 } 34655 return texts; 34656 }, 34657 ItemRowHasTemplate: function(itemIndex) { 34658 var itemRow = this.GetItemRow(itemIndex); 34659 return itemRow ? this.ItemRowHasTemplateCore(itemRow) : false; 34660 }, 34661 ItemRowHasTemplateCore: function(itemRow) { 34662 return this.ItemRowHasSerializedTextsAttr(itemRow); 34663 }, 34664 ItemRowHasSerializedTextsAttr: function(itemRow) { 34665 return ASPx.Attr.IsExistsAttribute(itemRow, itemSerializedTextsAttributeName); 34666 }, 34667 ItemCellHasTextAttr: function(itemTextCell) { 34668 return ASPx.Attr.IsExistsAttribute(itemTextCell, itemCellTextAttributeName); 34669 }, 34670 GetFirstVisibleItem: function() { 34671 return this.itemsManager.GetFirstVisibleItem(); 34672 }, 34673 GetFirstFilteredItemIndex: function () { 34674 return this.itemsManager.GetFirstFilteredItemIndex(); 34675 }, 34676 GetLastFilteredItemIndex: function() { 34677 return this.itemsManager.GetLastFilteredItemIndex(); 34678 }, 34679 GetNextFilteredItemIndex: function(currentFilteredItemIndex) { 34680 return this.itemsManager.GetNextFilteredItemIndex(currentFilteredItemIndex); 34681 }, 34682 GetPrevFilteredItemIndex: function(currentFilteredItemIndex) { 34683 return this.itemsManager.GetPrevFilteredItemIndex(currentFilteredItemIndex); 34684 }, 34685 PerformCallback: function(arg, onSuccess) { 34686 this.SetScrollSpacerVisibility(true, false); 34687 this.SetScrollSpacerVisibility(false, false); 34688 this.ClearItemsForPerformCallback(); 34689 this.serverIndexOfFirstItem = 0; 34690 this.SetScrollSpacerVisibility(true, false); 34691 this.SetScrollSpacerVisibility(false, false); 34692 this.FormatAndSetCustomCallbackArg(arg, true); 34693 this.SendCallback(onSuccess); 34694 this.FormatAndSetCustomCallbackArg(arg, false); 34695 }, 34696 GetTableRowParent: function(table){ 34697 if(table.tBodies.length > 0) 34698 return table.tBodies[0]; 34699 return table; 34700 }, 34701 ProtectWhitespaceSerieses: function(text){ 34702 if(text == "") 34703 text = nbsp; 34704 else { 34705 if(text.charAt(0) == ' ') 34706 text = nbsp + text.slice(1); 34707 if(text.charAt(text.length - 1) == ' ') 34708 text = text.slice(0, -1) + nbsp; 34709 text = text.replace(new RegExp(" ", "g"), " "); 34710 } 34711 return text; 34712 }, 34713 InsertItemInternal: function(index, itemProperties) { 34714 if(!this.hasSampleItem) 34715 return; 34716 this.AdjustItemProperties(itemProperties); 34717 ASPx.Data.ArrayInsert(this.itemsValue, itemProperties.value, index); 34718 this.itemsManager.InsertItem(index, itemProperties); 34719 this.RegisterInsertedItem(index, itemProperties); 34720 this.OnItemInserted(index); 34721 }, 34722 GetListTableRowBeforeNewItemRow: function (newItemIndex, listTable) { 34723 var lastRenderedItem = this.itemsManager.GetLastRenderedItem(); 34724 if (!lastRenderedItem || lastRenderedItem.index < newItemIndex) { 34725 var lastItemRow = lastRenderedItem ? this.GetItemRow(lastRenderedItem.index) : null; 34726 var lastListTableRow = listTable.rows[listTable.rows.length - 1]; 34727 if (lastItemRow) 34728 return lastItemRow === lastListTableRow ? null : lastItemRow.nextSibling; 34729 if (!!this.GetAccessibilityHeaderRow()) 34730 return this.ContainsFixWidthRow() ? listTable.rows[1] : listTable.rows[0]; 34731 return null; 34732 } 34733 for (var i = 0; i < listTable.rows.length; i++) 34734 if (this.GetItemIndexByRow(listTable.rows[i]) >= newItemIndex) 34735 return listTable.rows[i]; 34736 return null; 34737 }, 34738 AdjustItemProperties: function(itemProperties) { 34739 if(!itemProperties.texts || itemProperties.texts.length == 0) 34740 itemProperties.texts = [""]; 34741 else if(typeof (itemProperties.texts) === "string") 34742 itemProperties.texts = [itemProperties.texts]; 34743 if(typeof (itemProperties.value) === "undefined") 34744 itemProperties.value = itemProperties.texts[0]; 34745 if(!ASPx.IsExists(itemProperties.imageUrl) || itemProperties.imageUrl === "") 34746 itemProperties.imageUrl = this.defaultImageUrl; 34747 }, 34748 AddStateControllerClasses: function(itemId){
34749 var itemCellsIdPostfixes = this.GetItemCellsIdPostfixes(); 34750 var sampleItemFirstTextCell = this.GetSampleItemFirstTextCell(); 34751 var styleController = ASPx.GetStateController(); 34752 var hoverStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 34753 styleController.GetHoverElement(sampleItemFirstTextCell), ASPx.HoverItemKind); 34754 var selectedStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 34755 styleController.GetSelectedElement(sampleItemFirstTextCell), ASPx.SelectedItemKind); 34756 var disabledStyleClasses = this.CreateStyleClasses(itemId, itemCellsIdPostfixes, 34757 styleController.GetDisabledElement(sampleItemFirstTextCell), ASPx.DisabledItemKind); 34758 ASPx.AddHoverItems(this.name, hoverStyleClasses, true); 34759 ASPx.AddSelectedItems(this.name, selectedStyleClasses, true); 34760 ASPx.AddDisabledItems(this.name, disabledStyleClasses, true); 34761 ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.HoverItemKind); 34762 ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.SelectedItemKind); 34763 ASPx.Attr.RemoveAttribute(sampleItemFirstTextCell, ASPx.CachedStatePrefix + ASPx.DisabledItemKind); 34764 }, 34765 RemoveStateControllerClasses: function(itemId){ 34766 var itemCellsIdPostfixes = this.GetItemCellsIdPostfixes(); 34767 var classes = []; 34768 classes[0] = []; 34769 classes[0][0] = [itemId]; 34770 classes[0][1] = itemCellsIdPostfixes; 34771 ASPx.RemoveHoverItems(this.name, classes); 34772 ASPx.RemoveSelectedItems(this.name, classes); 34773 ASPx.RemoveDisabledItems(this.name, classes); 34774 }, 34775 GetCellInfo: function(index, infoArray) { 34776 if(!infoArray) return null; 34777 var filteredArray = infoArray.filter(function(info) { return info.index === index; }); 34778 return filteredArray.length ? filteredArray[0].value : null; 34779 }, 34780 PrepareItem: function(newItemRow, itemProperties) { 34781 var i = 0; 34782 if(this.GetIsCheckColumnExists()) 34783 i++; 34784 if(this.imageCellExists) { 34785 this.PrepareItemImage(newItemRow, i, itemProperties.imageUrl); 34786 i++; 34787 } 34788 if(itemProperties.htmlContent) { 34789 this.SetItemHtmlContent(newItemRow, itemProperties.htmlContent); 34790 this.SetTextsDataAttribute(newItemRow, itemProperties.texts); 34791 } else { 34792 this.SetItemTextContent(i, newItemRow, itemProperties); 34793 } 34794 this.AssignDecorationSettingsToElement(newItemRow, itemProperties.style, itemProperties.cssClass, itemProperties.tooltip, itemProperties.attributes); 34795 }, 34796 LockRunStartupSciptsInItemRow: function() { 34797 this.lockRunStartupScipts = true; 34798 }, 34799 UnlockRunStartupSciptsInItemRow: function() { 34800 this.lockRunStartupScipts = false; 34801 }, 34802 IsRunStartupSciptsInItemRowLocked: function() { 34803 return this.lockRunStartupScipts; 34804 }, 34805 EnsureStartupScriptsInContainer: function(container) { 34806 if(!this.InCallback() && !this.IsRunStartupSciptsInItemRowLocked()) 34807 ASPx.RunStartupScripts(false, container); 34808 }, 34809 SetItemHtml: function(index, html) { 34810 this.hasDecoratedItems = true; 34811 this.hasItemTemplate = true; 34812 this.EnsureFixWidthRow(true); 34813 this.itemsManager.SetItemHtml(index, html); 34814 this.ProcessItemRow(index, function(itemRow) { 34815 if(!this.ItemRowHasSerializedTextsAttr(itemRow)) 34816 this.SetTextsDataAttribute(itemRow, this.GetItem(index).texts); 34817 this.SetItemHtmlContent(itemRow, html); 34818 this.itemsManager.OnDecoratedItemsRendering(); 34819 }.bind(this)); 34820 }, 34821 SetTextsDataAttribute: function(itemRow, texts) { ASPx.Attr.SetAttribute(itemRow, itemSerializedTextsAttributeName, JSON.stringify(texts)); }, 34822 GetTextsDataAttribute: function(itemRow) { return ASPx.Attr.GetAttribute(itemRow, itemSerializedTextsAttributeName); }, 34823 SetItemTooltip: function(index, tooltip) { 34824 this.itemsManager.SetItemTooltip(index, tooltip); 34825 this.ProcessItemRow(index, function(itemRow) { this.SetElementTooltip(itemRow, tooltip); }.aspxBind(this)); 34826 }, 34827 SetItemAttribute: function(index, attributeName, attributeValue) { 34828 this.itemsManager.SetItemAttribute(index, attributeName, attributeValue); 34829 this.ProcessItemRow(index, function(itemRow) { ASPx.Attr.SetAttribute(itemRow, attributeName, attributeValue); }.aspxBind(this)); 34830 }, 34831 AddItemCssClass: function(index, className) { 34832 this.hasDecoratedItems = true; 34833 this.itemsManager.AddItemCssClass(index, className); 34834 this.ProcessItemRow(index, function(itemRow) { 34835 ASPx.AddClassNameToElement(itemRow, className); 34836 this.itemsManager.OnDecoratedItemsRendering(); 34837 }.bind(this)); 34838 }, 34839 RemoveItemCssClass: function(index, className) { 34840 this.hasDecoratedItems = true; 34841 this.itemsManager.RemoveItemCssClass(index, className); 34842 this.ProcessItemRow(index, function(itemRow) { 34843 ASPx.RemoveClassNameFromElement(itemRow, className); 34844 this.itemsManager.OnDecoratedItemsRendering(); 34845 }.bind(this)); 34846 }, 34847 SetItemTextCellHtml: function(itemIndex, textCellIndex, html) { 34848 this.hasDecoratedItems = true; 34849 this.itemsManager.SetItemTextCellHtml(itemIndex, textCellIndex, html); 34850 this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) {
34851 if(!this.ItemCellHasTextAttr(textCell)) 34852 this.SetItemCellTextDataAttribute(textCell, this.GetItem(itemIndex).texts[textCellIndex]); 34853 this.SetItemTextCellHtmlContent(textCell, html); 34854 this.itemsManager.OnDecoratedItemsRendering(); 34855 }.aspxBind(this)); 34856 }, 34857 SetItemCellTextDataAttribute: function(textCell, text) { 34858 ASPx.Attr.SetAttribute(textCell, itemCellTextAttributeName, text); 34859 }, 34860 SetItemTextCellTooltip: function(itemIndex, textCellIndex, tooltip) { 34861 this.itemsManager.SetItemTextCellTooltip(itemIndex, textCellIndex, tooltip); 34862 this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { this.SetElementTooltip(textCell, tooltip); }.aspxBind(this)); 34863 }, 34864 SetItemTextCellAttribute: function(itemIndex, textCellIndex, attributeName, attributeValue) { 34865 this.itemsManager.SetItemTextCellAttribute(itemIndex, textCellIndex, attributeName, attributeValue); 34866 this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { ASPx.Attr.SetAttribute(textCell, attributeName, attributeValue); }.aspxBind(this)); 34867 }, 34868 AddItemTextCellCssClass: function(itemIndex, textCellIndex, className) { 34869 this.hasDecoratedItems = true; 34870 this.itemsManager.AddItemTextCellCssClass(itemIndex, textCellIndex, className); 34871 this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { 34872 ASPx.AddClassNameToElement(textCell, className); 34873 this.itemsManager.OnDecoratedItemsRendering(); 34874 }.bind(this)); 34875 }, 34876 RemoveItemTextCellCssClass: function(itemIndex, textCellIndex, className) { 34877 this.hasDecoratedItems = true; 34878 this.itemsManager.RemoveItemTextCellCssClass(itemIndex, textCellIndex, className); 34879 this.ProcessItemTextCell(itemIndex, textCellIndex, function(textCell) { 34880 ASPx.RemoveClassNameFromElement(textCell, className); 34881 this.itemsManager.OnDecoratedItemsRendering(); 34882 }.bind(this)); 34883 }, 34884 ProcessItemRow: function(index, action) { 34885 var itemRow = this.GetItemRow(index); 34886 if(itemRow) 34887 action(itemRow); 34888 }, 34889 ProcessItemTextCell: function(itemIndex, textCellIndex, action) { 34890 var itemTextCell = this.GetItemTextCell(itemIndex, textCellIndex); 34891 if(itemTextCell && !this.ItemRowHasTemplateCore(itemTextCell.parentNode)) 34892 action(itemTextCell); 34893 }, 34894 SetItemHtmlContent: function(itemRow, html) { 34895 var redundantCells = ASPx.Data.CollectionToArray(itemRow.cells) 34896 .slice(this.GetItemFirstTextCellIndex(), itemRow.cells.length - 1); 34897 redundantCells.forEach(function(cell) { itemRow.removeChild(cell); }); 34898 var itemHtmlContainerCell = itemRow.cells[itemRow.cells.length - 1]; 34899 ASPx.SetElementDisplay(itemHtmlContainerCell, this.GetVisibleColumnCount() !== 0); 34900 itemHtmlContainerCell.colSpan = Math.max(itemHtmlContainerCell.colSpan, this.GetVisibleColumnCount()); 34901 if(this.IsMultiColumn()) { 34902 if(this.GetItemFirstTextCellIndex() === 0) 34903 ASPx.AddClassNameToElement(itemHtmlContainerCell, FIRST_CELL_MARKER_CSS_CLASS_NAME); 34904 ASPx.AddClassNameToElement(itemHtmlContainerCell, LAST_CELL_MARKER_CSS_CLASS_NAME); 34905 } 34906 itemHtmlContainerCell.style.width = ""; 34907 itemHtmlContainerCell.innerHTML = html; 34908 this.RemoveEllipsisFromNode(itemHtmlContainerCell); 34909 this.EnsureStartupScriptsInContainer(itemHtmlContainerCell); 34910 }, 34911 SetItemTextContent: function(textCellIndex, newItemRow, itemProperties) { 34912 var cellCount = this.GetItemCellCount(); 34913 for(var j = 0; textCellIndex < cellCount; textCellIndex++, j++) { 34914 var cellStyle = this.GetCellInfo(j, itemProperties.cellStyles); 34915 var cellCssClass = this.GetCellInfo(j, itemProperties.cellCssClasses); 34916 var cellTooltip = this.GetCellInfo(j, itemProperties.cellTooltips); 34917 var cellAttributes = this.GetCellInfo(j, itemProperties.cellAttributes); 34918 var htmlContent = this.GetCellInfo(j, itemProperties.htmlContents); 34919 this.PrepareItemTextCell(newItemRow.cells[textCellIndex], itemProperties.texts[j], cellStyle, cellCssClass, cellTooltip, cellAttributes, htmlContent); 34920 } 34921 }, 34922 SetItemTextCellHtmlContent: function(cell, html) { 34923 cell.innerHTML = html; 34924 this.RemoveEllipsisFromNode(cell); 34925 this.EnsureStartupScriptsInContainer(cell); 34926 }, 34927 PrepareItemImage: function(newItemRow, imageCellIndex, imageUrl){ 34928 var imageCell = newItemRow.cells[imageCellIndex]; 34929 var image = ASPx.GetNodeByTagName(imageCell, "IMG", 0); 34930 if(!imageUrl) { 34931 if(image) 34932 ASPx.RemoveElement(image); 34933 imageCell.innerHTML = " "; 34934 } else { 34935 if(!image) { 34936 image = document.createElement("IMG"); 34937 imageCell.innerHTML = "";
34938 imageCell.appendChild(image); 34939 } 34940 ASPx.ImageUtils.SetImageSrc(image, imageUrl); 34941 } 34942 }, 34943 PrepareItemTextCell: function(cell, text, style, cssClass, tooltip, attributes, htmlContent) { 34944 if(!ASPx.IsExists(text)) 34945 text = ""; 34946 if(this.encodeHtml) 34947 text = ASPx.Str.EncodeHtml(text); 34948 if(htmlContent) { 34949 this.SetItemTextCellHtmlContent(cell, htmlContent); 34950 this.SetItemCellTextDataAttribute(cell, this.ProtectWhitespaceSerieses(text)); 34951 } 34952 else { 34953 cell.innerHTML = this.ProtectWhitespaceSerieses(text); 34954 if(this.enableEllipsis) 34955 ASPx.AddClassNameToElement(cell, ASPx.ELLIPSIS_MARKER_CLASS); 34956 } 34957 this.AssignDecorationSettingsToElement(cell, style, cssClass, tooltip, attributes); 34958 if(text == "") 34959 ASPx.Attr.SetAttribute(cell, "DXText", text); 34960 }, 34961 AssignDecorationSettingsToElement: function(element, style, cssClass, tooltip, attributes) { 34962 if(cssClass) 34963 ASPx.AddClassNameToElement(element, cssClass); 34964 if(style) { 34965 var styleSheet = ASPx.GetCurrentStyleSheet(); 34966 ASPx.AddClassNameToElement(element, ASPx.CreateImportantStyleRule(styleSheet, style)); 34967 } 34968 if(tooltip) 34969 this.SetElementTooltip(element, tooltip); 34970 if(attributes) 34971 for(var key in attributes) 34972 if(attributes.hasOwnProperty(key)) 34973 ASPx.Attr.SetAttribute(element, key, attributes[key]); 34974 }, 34975 SetElementTooltip: function(element, tooltip) { 34976 this.RemoveEllipsisTooltip(element); 34977 ASPx.Attr.SetAttribute(element, "title", tooltip); 34978 }, 34979 FormatText: function(texts, value) { 34980 if(typeof(texts) === "string") 34981 return texts; 34982 else if(!this.IsMultiColumn()) 34983 return texts[0]; 34984 else 34985 return this.FormatTextCore(texts, value); 34986 }, 34987 FormatTextCore: function(texts, value) { 34988 var result = ""; 34989 if(this.isComboBoxList) { 34990 if(this.nullValueItemDisplayText !== null && value === null) 34991 result = this.nullValueItemDisplayText; 34992 else 34993 result = ASPx.Formatter.Format(this.textFormatString, texts); 34994 } else 34995 result = texts.join("; "); 34996 return result; 34997 }, 34998 OnItemInserted: function(index){ 34999 this.GetItemSelectionHelper().OnItemInserted(index); 35000 }, 35001 OnItemRemoved: function(index){ 35002 this.GetItemSelectionHelper().OnItemRemoved(index); 35003 }, 35004 CreateItemId: function(index){ 35005 return lbIIdSuffix + index; 35006 }, 35007 CreateItemClientId: function(index){ 35008 return this.name + "_" + lbIIdSuffix + index; 35009 }, 35010 CreateStyleClasses: function(id, postfixes, item, kind){ 35011 var classes = []; 35012 if(item && item[kind]){ 35013 classes[0] = []; 35014 classes[0][0] = item[kind].classNames; 35015 classes[0][1] = item[kind].cssTexts; 35016 classes[0][2] = []; 35017 classes[0][2][0] = id; 35018 classes[0][3] = postfixes; 35019 } 35020 return classes; 35021 }, 35022 CorrectSizeByTimer: function(){ 35023 if(this.APILockCount == 0 && this.IsDisplayed()) 35024 window.setTimeout(function() { this.OnCorrectSizeByTimer(); }.aspxBind(this), 0); 35025 }, 35026 FindFreeIndex: function(){ 35027 return this.freeUniqIndex ++; 35028 }, 35029 GetSampleItemRowID: function(){ 35030 return this.name + "_" + lbSIIdSuffix; 35031 }, 35032 GetAccessibilitySampleHeaderRowID: function() { 35033 return this.name + "_" + lbAIRTIdSuffix; 35034 }, 35035 GetSampleItemRow: function(){ 35036 if(this.SampleItem == null) 35037 this.SampleItem = ASPx.GetElementById(this.GetSampleItemRowID()); 35038 return this.SampleItem; 35039 }, 35040 GetAccessibilitySampleHeaderRow: function() { 35041 if(this.sampleHeaderRow == null) 35042 this.sampleHeaderRow = ASPx.GetElementById(this.GetAccessibilitySampleHeaderRowID()); 35043 return this.sampleHeaderRow; 35044 }, 35045 AddAccessibilityHeaderRow: function() { 35046 if(!this.HasAccessibilityHeaderRow()) return; 35047 var listTableBody = ASPx.GetChildByTagName(this.GetListTable(), "TBODY", 0); 35048 var headerRow = this.GetAccessibilitySampleHeaderRow().cloneNode(true); 35049 headerRow.id = this.GetAccessibilityHeaderRowID(); 35050 listTableBody.appendChild(headerRow); 35051 }, 35052 HasAccessibilityHeaderRow: function() { 35053 return this.accessibilityCompliant && this.IsMultiColumn(); 35054 }, 35055 GetAccessibilityHeaderRow: function() { 35056 return this.GetChildElement(lbAIRIdSuffix); 35057 }, 35058 RemoveAccessibilityHeaderRow: function() { 35059 var headerRow = this.GetAccessibilityHeaderRow(); 35060 if(headerRow) 35061 ASPx.RemoveElement(headerRow); 35062 }, 35063 GetAccessibilityHeaderRowID: function() { 35064 return this.name + "_" + lbAIRIdSuffix; 35065 }, 35066 GetSampleItemFirstTextCell: function(){ 35067 if(!ASPx.IsExistsElement(this.sampleItemFirstTextCell)){ 35068 var sampleItemRow = this.GetSampleItemRow(); 35069 if(ASPx.IsExistsElement(sampleItemRow)) 35070 this.sampleItemFirstTextCell = sampleItemRow.cells[this.imageCellExists ? 1 : 0]; 35071 } 35072 return this.sampleItemFirstTextCell; 35073 }, 35074 ChangeEnabledAttributes: function(enabled){ 35075 this.ChangeListTableEvents(this.GetListTable(), ASPx.Attr.ChangeEventsMethod(enabled)); 35076 var focusableElement = this.GetInputElement(); 35077 if(focusableElement) { 35078 this.ChangeSpecialInputEnabledAttributes(focusableElement, ASPx.Attr.ChangeEventsMethod(enabled)); 35079 if(this.accessibilityCompliant) 35080 this.ChangeFocusableElementTabIndex(focusableElement, enabled); 35081 else if(!this.isComboBoxList) { 35082 var changeMethod = enabled ? ASPx.Attr.RestoreTabIndexAttribute : ASPx.Attr.SaveTabIndexAttributeAndReset; 35083 changeMethod(focusableElement); 35084 } 35085 } 35086 }, 35087 ChangeFocusableElementTabIndex: function(focusableElement, enabled) { 35088 if(!this.isComboBoxList) { 35089 if(enabled) 35090 ASPx.Attr.SetAttribute(focusableElement, "tabindex", "0"); 35091 else 35092 focusableElement.removeAttribute("tabindex"); 35093 } 35094 }, 35095 ChangeEnabledStateItems: function(enabled){ 35096 var controller = ASPx.GetStateController(); 35097 controller.SetElementEnabled(this.GetMainElement(), enabled); 35098 var count = this.GetItemCount(); 35099 var i = this.hasSampleItem ? -1 : 0 ; 35100 for(; i < count; i ++){ 35101 this.ChangeEnabledStateItem(i, enabled, controller); 35102 }
35103 this.changeSelectAllElementsEnabledState(enabled); 35104 var changeEventMethod = ASPx.Attr.ChangeEventsMethod(enabled); 35105 if(this.filteringTextBox && !this.customFilteringEditorID) { 35106 this.filteringTextBox.SetEnabled(enabled); 35107 this.ChangeSpecialInputEnabledAttributes(this.filteringTextBox.GetInputElement(), changeEventMethod, true); 35108 } 35109 if(this.showFilterButton) { 35110 this.showFilterButton.SetEnabled(enabled); 35111 this.ChangeSpecialInputEnabledAttributes(this.showFilterButton.GetInternalButton(), changeEventMethod, true); 35112 } 35113 }, 35114 ChangeEnabledStateItem: function (index, enabled, controller) { 35115 var element = this.GetItemFirstTextCell(index); 35116 if (element) 35117 controller.SetElementEnabled(element, enabled); 35118 if (this.GetIsCheckColumnExists() && index >= 0) 35119 this.SetCheckBoxEnabled(index, enabled); 35120 }, 35121 ChangeListTableEvents: function(listTable, method){ 35122 if(this.isComboBoxList){ 35123 method(listTable, "mouseup", aspxLBIClick); 35124 if(ASPx.Browser.Firefox) 35125 method(listTable, "mousedown", ASPx.Evt.PreventEvent); 35126 } 35127 else{ 35128 method(listTable, "click", aspxLBIClick); 35129 method(listTable, "dblclick", aspxLBIClick); 35130 if(this.MultiSelectionMode()) 35131 this.AttachSelectStartHandlerToElement(listTable); 35132 } 35133 }, 35134 AttachSelectStartHandlerToElement: function(element) { 35135 ASPx.Evt.AttachEventToElement(element, "selectstart", aspxLBTSelectStart); 35136 }, 35137 IsValueChanged: function(){ 35138 return this.cachedValue != this.GetValue(); 35139 }, 35140 OnItemSelectionChanged: function(index, selected, fromSelectAllClick, forceValueChanged){ 35141 if(this.CheckColumnSelectionMode() && !fromSelectAllClick) 35142 this.SetCheckBoxChecked(index, selected); 35143 if(!this.IsSelectionEventsLocked()) { 35144 this.SetRaiseSelectedIndexChangedArguments(this.autoPostBack, index, selected); 35145 var valueChanged = this.IsValueChanged() || forceValueChanged; 35146 if(valueChanged) { 35147 this.RaisePersonalStandardValidation(); 35148 this.OnValueChanged(); 35149 } else { 35150 if(this.RaiseSelectedIndexChanged()) 35151 this.SendPostBackInternal(""); 35152 } 35153 } 35154 this.CacheValue(); 35155 if(this.accessibilityCompliant && !fromSelectAllClick) 35156 this.GetAccessibilityHelper().OnSelectedIndexChanged(index); 35157 }, 35158 SetRaiseSelectedIndexChangedArguments: function(processOnServer, index, selected){ 35159 this.selectedIndexChangedArguments = { 35160 processOnServer: processOnServer, 35161 index: index, 35162 selected: selected 35163 }; 35164 }, 35165 GetRaiseSelectedIndexChangedArguments: function(){ 35166 if(!this.selectedIndexChangedArguments) 35167 this.SetRaiseSelectedIndexChangedArguments(false, this.GetSelectedIndex(), true); 35168 return this.selectedIndexChangedArguments; 35169 }, 35170 RaiseSelectedIndexChanged: function (processOnServer) { 35171 this.RaiseValidationInternal(); 35172 var savedArgs = this.GetRaiseSelectedIndexChangedArguments(); 35173 processOnServer = savedArgs.processOnServer || processOnServer; 35174 if(!this.SelectedIndexChanged.IsEmpty()){ 35175 var args = new ASPxClientListEditItemSelectedChangedEventArgs(savedArgs.index, savedArgs.selected, processOnServer); 35176 this.SelectedIndexChanged.FireEvent(this, args); 35177 processOnServer = args.processOnServer; 35178 } 35179 return processOnServer; 35180 }, 35181 RaiseItemFiltering: function(item, filter, isFit) { 35182 if(!this.ItemFiltering.IsEmpty()) { 35183 var args = new ASPxClientListEditItemFilteringEventArgs(item, filter, isFit); 35184 this.ItemFiltering.FireEvent(this, args); 35185 isFit = args.isFit; 35186 } 35187 return isFit; 35188 }, 35189 RaiseCustomHighlighting: function(filter, callbackHighlighting) { 35190 if(!this.CustomHighlighting.IsEmpty()) { 35191 var args = new ASPxClientListEditCustomHighlightingEventArgs(filter); 35192 args.highlighting = callbackHighlighting; 35193 this.CustomHighlighting.FireEvent(this, args); 35194 return args.highlighting; 35195 } 35196 return callbackHighlighting; 35197 }, 35198 SetWidth: function(width) { 35199 this.width = width + "px"; 35200 this.GetScrollDivElement().style.width = "100%"; 35201 ASPxClientListBoxBase.prototype.SetWidth.call(this, width); 35202 }, 35203 SetHeight: function(height) { 35204 this.heightCorrected = false; 35205 ASPxClientListBoxBase.prototype.SetHeight.call(this, height); 35206 this.CorrectHeight(); 35207 }, 35208 OnAssociatedLabelClick: function(focusableElement) { 35209 var isValidElement = focusableElement && ASPx.IsActionElement(focusableElement) && ASPx.GetIsParent(this.GetMainElement(), focusableElement); 35210 if(isValidElement) 35211 focusableElement.focus(); 35212 else 35213 ASPxClientListBoxBase.prototype.OnDelayedSpecialFocusMouseDown.call(this, null); 35214 }, 35215 TryApplyHighlighting: function() { 35216 var ownerControl = this.GetCallbackOwnerControl(); 35217 var filterStrategy = ownerControl && ownerControl.filterStrategy ? ownerControl.filterStrategy : this.filterStrategy; 35218 if(filterStrategy && filterStrategy.ApplyHighlighting)
35219 filterStrategy.ApplyHighlighting(); 35220 }, 35221 onDropDownModalChanged: function(enabled) { 35222 if(!this.IsMultiColumn()) 35223 return; 35224 if(enabled && !this.itemsManager.GetFirstVisibleItemRow()) 35225 return; 35226 this.updateCellWidthsOnDropDownChanged(enabled); 35227 }, 35228 updateCellWidthsOnDropDownChanged: function(enabled) { 35229 var applyFunction = this.getUpdateCellWidthsFunctionOnDropDownChanged(enabled); 35230 var sampleRow = this.GetSampleItemRow(); 35231 var headerRow = this.GetHeaderTableElement().rows[0]; 35232 var dataRows = this.itemsManager.GetListTableRows(); 35233 for(var i = this.columnFieldNames.length - 1; i >= 0; i--) { 35234 applyFunction(sampleRow, i); 35235 applyFunction(headerRow, i); 35236 for(var row, j = 0; row = dataRows[j]; j++) 35237 applyFunction(row, i); 35238 } 35239 }, 35240 getUpdateCellWidthsFunctionOnDropDownChanged: function(enabled) { 35241 if(enabled) { 35242 var row = this.itemsManager.GetFirstVisibleItemRow(); 35243 var widths = Array.prototype.slice.call(row.cells, 0).map(function(cell) { return cell.offsetWidth; }); 35244 var commonWidth = widths.reduce(function(a, b) { return a + b; }, 0); 35245 widths = widths.map(function(w) { return (w * 100) / commonWidth; }); 35246 return function(row, cellIndex) { 35247 ASPx.Attr.ChangeStyleAttribute(row.cells[cellIndex], "width", widths[cellIndex] + "%"); 35248 }; 35249 } 35250 return function(row, cellIndex) { 35251 ASPx.Attr.RestoreStyleAttribute(row.cells[cellIndex], "width"); 35252 }; 35253 } 35254}); 35255ASPxClientListBox.GetItemCellInnerText = function(itemTextCell) { 35256 var text; 35257 if(typeof(itemTextCell.attributes["DXText"]) != "undefined") 35258 text = ASPx.Attr.GetAttribute(itemTextCell, "DXText"); 35259 else { 35260 var itemCellTextAttribute = ASPx.Attr.GetAttribute(itemTextCell, itemCellTextAttributeName); 35261 text = ASPx.IsExists(itemCellTextAttribute) ? itemCellTextAttribute : ASPx.GetInnerText(itemTextCell); 35262 } 35263 text = text.replace(new RegExp(nbspChar, "g"), " "); 35264 return text; 35265}; 35266var ASPxClientNativeListBox = ASPx.CreateClass(ASPxClientListBoxBase, { 35267 constructor: function(name) { 35268 this.constructor.prototype.constructor.call(this, name); 35269 }, 35270 InitializeEvents: function() { 35271 ASPxClientListBoxBase.prototype.InitializeEvents.call(this); 35272 if(!!this.GetMainElement()) { 35273 ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keydown", this.OnKeyDown.aspxBind(this)); 35274 ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keyup", this.OnKeyUp.aspxBind(this)); 35275 ASPx.Evt.AttachEventToElement(this.GetMainElement(), "keypress", this.OnKeyPress.aspxBind(this)); 35276 } 35277 }, 35278 SetReadOnlyInternal: function(readOnly) { 35279 ASPxClientListBoxBase.prototype.SetReadOnlyInternal.call(this, readOnly); 35280 var options = this.GetMainElement().querySelectorAll("option"); 35281 for (var i = 0, option; option = options[i]; i++) { 35282 if (readOnly) 35283 ASPx.Attr.SetAttribute(option, "disabled", "disabled"); 35284 else 35285 ASPx.Attr.RemoveAttribute(option, "disabled"); 35286 } 35287 }, 35288 SetMainElement: function(mainElement){ 35289 this.mainElement = mainElement; 35290 }, 35291 FindInputElement: function(){ 35292 return this.GetMainElement(); 35293 }, 35294 GetOptionCount: function(){ 35295 return this.GetMainElement().options.length; 35296 }, 35297 GetOption: function(index){ 35298 return this.GetMainElement().options[index]; 35299 }, 35300 GetItemCount: function(){ 35301 return this.GetOptionCount(); 35302 }, 35303 SelectIndexSilent: function(index){ 35304 var selectedIndex = this.GetSelectedIndexInternal(); 35305 var isValidIndex = (-1 <= index && index < this.GetItemCount()); 35306 if((selectedIndex != index && isValidIndex) || !this.isInitialized){ 35307 this.SetSelectedIndexInternal(index); 35308 return true; 35309 } 35310 return false; 35311 }, 35312 GetSelectedIndexInternal: function(){ 35313 return this.GetMainElement().selectedIndex; 35314 }, 35315 SetSelectedIndexInternal: function(index){ 35316 this.GetMainElement().selectedIndex = index; 35317 }, 35318 ClearItemsCore: function(){ 35319 this.GetMainElement().innerHTML = ""; 35320 }, 35321 RemoveItem: function(index){ 35322 if(0 <= index && index < this.GetItemCount()){ 35323 var oldSelectedIndex = this.GetSelectedIndexInternal(); 35324 this.UpdateSyncArraysItemDeleted(this.GetItem(index), true); 35325 var option = this.GetOption(index); 35326 this.GetMainElement().removeChild(option); 35327 this.UpdateOptionValues();
35328 this.OnItemRemoved(oldSelectedIndex, index); 35329 } 35330 }, 35331 OnItemRemoved: function(oldSelectedIndex, newSelectedIndex){ 35332 if(newSelectedIndex == oldSelectedIndex && !this.MultiSelectionMode()) 35333 this.SetSelectedIndexInternal(-1); 35334 }, 35335 MultiSelectionMode: function(){ 35336 return this.GetMainElement().multiple; 35337 }, 35338 GetItem: function(index){ 35339 if(0 <= index && index < this.GetOptionCount()) { 35340 var text = this.GetOption(index).text; 35341 var selected = this.GetMainElement().options[index].selected; 35342 var itemValue = this.itemsValue[index] !== undefined ? this.itemsValue[index] : null; 35343 if(ASPx.IsExists(text)) 35344 return new ASPxClientListBoxItem(this, index, text, itemValue, "", selected); 35345 } 35346 return null; 35347 }, 35348 PerformCallback: function(arg) { 35349 this.ClearItemsForPerformCallback(); 35350 this.FormatAndSetCustomCallbackArg(arg, true); 35351 this.SendCallback(); 35352 this.FormatAndSetCustomCallbackArg(arg, false); 35353 }, 35354 SendCallback: function(){ 35355 if(!this.InCallback()){ 35356 var callbackOwner = this.GetCallbackOwnerControl(); 35357 if(callbackOwner != null) 35358 callbackOwner.SendCallback(); 35359 else { 35360 var argument = this.GetCallbackArguments(); 35361 this.CreateCallback(argument); 35362 } 35363 } 35364 }, 35365 ParseCallbackResult: function(result){ 35366 var deserializedItems = this.DeserializeItems(result[CONSTANTS.CALLBACK_RESULTS.ITEMS]); 35367 this.LoadItemsFromCallback(true, deserializedItems); 35368 }, 35369 InsertItemInternal: function(index, itemProperties) { 35370 if(typeof (itemProperties.value) == "undefined") 35371 itemProperties.value = itemProperties.texts; 35372 var oldSelectedIndex = this.GetSelectedIndexInternal(); 35373 var isAdd = this.GetOptionCount() <= index; 35374 var newOption = document.createElement("OPTION"); 35375 if(isAdd) 35376 this.GetMainElement().appendChild(newOption); 35377 else 35378 this.GetMainElement().insertBefore(newOption, this.GetOption(index)); 35379 newOption.innerHTML = itemProperties.texts; 35380 this.UpdateOptionValues(); 35381 ASPx.Data.ArrayInsert(this.itemsValue, itemProperties.value, index); 35382 this.RegisterInsertedItem(index, itemProperties); 35383 if(index == oldSelectedIndex && index != -1) 35384 this.SetSelectedIndex(index + 1); 35385 }, 35386 UpdateOptionValues: function() { 35387 if(this.APILockCount == 0){ 35388 for(var i = 0; i < this.GetOptionCount(); i++) 35389 this.GetOption(i).value = i; 35390 } 35391 }, 35392 ChangeEnabledAttributes: function(enabled){ 35393 if(!this.isComboBoxList) { 35394 this.GetMainElement().disabled = !enabled; 35395 this.ChangeSpecialInputEnabledAttributes(this.GetMainElement(), ASPx.Attr.ChangeEventsMethod(enabled), true); 35396 } 35397 }, 35398 OnCallback: function(result) { 35399 this.ParseCallbackResult(result); 35400 }, 35401 OnItemDblClick: function(){ 35402 this.RaiseItemDoubleClick(); 35403 }, 35404 LoadItemsFromCallback: function(isToTop, deserializedItems){ 35405 this.BeginUpdate(); 35406 this.LockSynchronizationOnInternalCallback(); 35407 var mainElement = this.GetMainElement(); 35408 for(var i = deserializedItems.length - 1; i >= 0; i--) { 35409 this.InsertItemInternal(0, deserializedItems[i]); 35410 if(deserializedItems[i].selected) 35411 mainElement.options[0].selected = true; 35412 } 35413 this.UnlockSynchronizationOnInternalCallback(); 35414 this.EndUpdate(); 35415 }, 35416 EndUpdate: function(){ 35417 ASPxClientListBoxBase.prototype.EndUpdate.call(this); 35418 this.UpdateOptionValues(); 35419 }, 35420 GetSelectedIndices: function(){ 35421 var selectedIndices = []; 35422 var mainElement = this.GetMainElement(); 35423 for(var i = 0; i < mainElement.options.length; i++){ 35424 if(mainElement.options[i].selected) 35425 selectedIndices.push(i); 35426 } 35427 return selectedIndices; 35428 }, 35429 GetSelectedValues: function(){ 35430 var selectedValues = []; 35431 var selectedIndices = this.GetSelectedIndices(); 35432 for(var i = 0; i < selectedIndices.length; i++) 35433 selectedValues.push(this.GetItemValue(selectedIndices[i])); 35434 return selectedValues; 35435 }, 35436 GetSelectedItems: function(){ 35437 var selectedItems = []; 35438 var selectedIndices = this.GetSelectedIndices(); 35439 for(var i = 0; i < selectedIndices.length; i++) 35440 selectedItems.push(this.GetItem(selectedIndices[i])); 35441 return selectedItems; 35442 }, 35443 SelectAll: function(){ 35444 this.SetAllItemsSelectedValue(true); 35445 }, 35446 UnselectAll: function(){ 35447 this.SetAllItemsSelectedValue(false); 35448 }, 35449 SetAllItemsSelectedValue: function(selected){ 35450 var mainElement = this.GetMainElement(); 35451 for(var i = 0; i < mainElement.options.length; i++) 35452 mainElement.options[i].selected = selected; 35453 }, 35454 SelectIndices: function(indices){ 35455 this.SetIndicesSelectionState(indices, true); 35456 }, 35457 UnselectIndices: function(indices){ 35458 this.SetIndicesSelectionState(indices, false); 35459 }, 35460 SetIndicesSelectionState: function(indices, selected){ 35461 var mainElement = this.GetMainElement(); 35462 for(var i = 0; i < indices.length; i++){ 35463 mainElement.options[indices[i]].selected = selected; 35464 } 35465 }, 35466 SelectItems: function(items){ 35467 if(ASPx.IsExists(items)) 35468 this.SetItemsSelectionState(items, true); 35469 else 35470 this.SelectAll(); 35471 }, 35472 UnselectItems: function(items){ 35473 if(ASPx.IsExists(items)) 35474 this.SetItemsSelectionState(items, false); 35475 else 35476 this.UnselectAll(); 35477 }, 35478 SetItemsSelectionState: function(items, selected){ 35479 var mainElement = this.GetMainElement(); 35480 for(var i = 0; i < items.length; i++){ 35481 mainElement.options[items[i].index].selected = selected; 35482 } 35483 }, 35484 SelectValues: function(values){ 35485 this.SetValuesSelectedState(values, true); 35486 }, 35487 UnselectValues: function(values){ 35488 this.SetValuesSelectedState(values, false); 35489 }, 35490 SetValuesSelectedState: function(values, selected){ 35491 var mainElement = this.GetMainElement(); 35492 var index; 35493 for(var i = 0; i < values.length; i++){ 35494 index = this.FindItemIndexByValue(values[i]); 35495 mainElement.options[index].selected = selected; 35496 } 35497 }, 35498 EnsureRequiredNativeAttributesExists: function() { 35499 var input = this.GetInputElement(); 35500 if(!input.onchange) 35501 ASPx.Evt.AttachEventToElement(input, "change", function() { ASPx.EValueChanged(this.name); }.aspxBind(this)); 35502 } 35503}); 35504var AccessibilityHelperListBox = ASPx.CreateClass(ASPx.AccessibilityHelper, { 35505 constructor: function(listBox) { 35506 this.constructor.prototype.constructor.call(this, listBox); 35507 this.checkBoxRefocusTimeout = 1000; 35508 this.firstReadingColumnIndex = this.control.CheckColumnSelectionMode() ? 1 : 0; 35509 this.Initialize(); 35510 }, 35511 Initialize: function() { 35512 if(this.control.CheckColumnSelectionMode() && !this.control.IsNativeCheckBoxes())
35513 this.control.GotFocus.AddHandler(function() { this.SetActionElementFocus(); }.aspxBind(this)); 35514 this.control.GotFocus.AddHandler(function() { this.OnSelectedIndexChanged(this.control.GetSelectedIndex()); }.aspxBind(this)); 35515 this.control.LostFocus.AddHandler(function() { 35516 setTimeout(function() { 35517 this.changeActivityAttributes(this.getMainElement(), { "aria-activedescendant": "" }); 35518 }.aspxBind(this), 200); 35519 }.aspxBind(this)); 35520 }, 35521 OnSelectedIndexChanged: function(index) { 35522 var stateSelected = index != -1 && this.control.GetItem(index) && this.control.GetItem(index).selected; 35523 var selectedIndex = this.control.GetSelectedIndex(); 35524 if(this.control.CheckColumnSelectionMode() || stateSelected || selectedIndex == -1) 35525 this.setSelectionAttributes(index, stateSelected); 35526 }, 35527 getPronounceTimeout: function() { 35528 if(ASPx.Browser.WebKitFamily && this.control.CheckColumnSelectionMode()) 35529 return 1000; 35530 return ASPx.AccessibilityHelper.prototype.getPronounceTimeout.call(this); 35531 }, 35532 getHeaderCellCaptionText: function(index) { 35533 var headerDiv = this.control.GetHeaderDivElement(); 35534 if(!headerDiv) return ""; 35535 var headerTable = headerDiv.firstElementChild; 35536 return headerTable.rows[0].cells[this.firstReadingColumnIndex + index].textContent; 35537 }, 35538 isItemCheckBoxFocused: function() { 35539 for(var i = 0; i < this.control.GetItemCount() ; i++) { 35540 var internalCheckBox = this.control.GetInternalCheckBox(i); 35541 if(internalCheckBox && internalCheckBox.focused) 35542 return true; 35543 } 35544 return false; 35545 }, 35546 isSelectAllCheckBoxFocused: function() { 35547 return this.control.selectAllCheckBox && this.control.selectAllCheckBox.focused; 35548 }, 35549 SetActionElementFocus: function() { 35550 if(this.control.enableFiltering) { 35551 if(!this.control.HasInternalFilteringTextBoxFocus()) 35552 this.SetFilterPanelFocus(); 35553 } 35554 else 35555 this.SetCheckBoxFocus(); 35556 }, 35557 SetCheckBoxFocus: function () { 35558 var isCheckBoxFocused = this.isItemCheckBoxFocused() || this.isSelectAllCheckBoxFocused(); 35559 if(!isCheckBoxFocused) 35560 this.ProcessRefocusHandler(function() { 35561 this.control.SetFocusedIndex(0); 35562 }.aspxBind(this)); 35563 }, 35564 SetFilterPanelFocus: function() { 35565 if(this.control.customFilteringEditorID || ASPx.ElementHasCssClass(this.control.filterMainElement, this.control.GetInactiveFilterElementClassName())) { 35566 if(this.control.showFilterButton) 35567 this.ProcessRefocusHandler(function() { 35568 this.control.showFilterButton.Focus(); 35569 }.aspxBind(this)); 35570 } else 35571 this.ProcessRefocusHandler(function() { 35572 ASPx.FindFirstChildActionElement(this.control.filterMainElement).focus(); 35573 }.aspxBind(this)); 35574 }, 35575 ProcessRefocusHandler: function(handler) { 35576 setTimeout(function() { 35577 if(!this.control.focused) return; 35578 handler(); 35579 }.aspxBind(this), this.checkBoxRefocusTimeout); 35580 }, 35581 getTextForScreenReader: function(item) { 35582 var result = ""; 35583 if(!this.control.IsMultiColumn()) { 35584 result= item.text; 35585 } else { 35586 var columnsCount = this.control.columnFieldNames.length; 35587 var formatString = ASPx.AccessibilitySR.TableItemFormatString; 35588 for(var i = 0; i < columnsCount; i++) 35589 result += ASPx.Str.ApplyReplacement(formatString, [["{0}", this.getHeaderCellCaptionText(i)], ["{1}", item.texts[i]]]); 35590 } 35591 return result; 35592 }, 35593 setSelectionAttributes: function(index, stateSelected) { 35594 if(index == -1) index = 0; 35595 var item = this.control.GetItem(index); 35596 if(!item) return; 35597 var assistText = this.getTextForScreenReader(item); 35598 var activeItemArgs = { 35599 "role" : "option", 35600 "aria-posinset" : index + 1, 35601 "aria-setsize" : this.control.itemTotalCount, 35602 "aria-selected" : stateSelected 35603 }; 35604 var inactiveItemArgs = { 35605 "role" : "", 35606 "aria-posinset" : "", 35607 "aria-setsize" : "", 35608 "aria-selected" : "" 35609 }; 35610 this.PronounceMessage(assistText, activeItemArgs, inactiveItemArgs); 35611 }, 35612 SetCheckBoxesValidationAttributes: function() { 35613 if(!this.control.CheckColumnSelectionMode() || !this.control.GetErrorCell()) return; 35614 var errorTextElement = this.control.ariaExplanatoryTextManager.GetErrorTextElement(); 35615 for (var i = 0; i < this.control.GetItemCount() ; i++) { 35616 var checkBoxFocusableElement = this.control.GetCheckBoxFocusableElement(i); 35617 if(checkBoxFocusableElement) { 35618 ASPx.Attr.SetOrRemoveAttribute(checkBoxFocusableElement, "aria-describedby", !this.control.isValid ? errorTextElement.id : null); 35619 ASPx.Attr.SetOrRemoveAttribute(checkBoxFocusableElement, "aria-invalid", !this.control.isValid); 35620 } 35621 } 35622 } 35623}); 35624ASPxClientListBox.Cast = ASPxClientControl.Cast; 35625var ASPxClientCheckListBase = ASPx.CreateClass(ASPxClientListEdit, { 35626 constructor: function(name) { 35627 this.constructor.prototype.constructor.call(this, name); 35628 this.imageProperties = null; 35629 this.internalButtonCollection = null; 35630 this.icbFocusedStyle = []; 35631 this.items = []; 35632 }, 35633 SetData: function(data){ 35634 ASPxClientEdit.prototype.SetData.call(this, data);
35635 if(data.items) 35636 this.CreateItems(data.items); 35637 }, 35638 Initialize: function() { 35639 ASPxClientListEdit.prototype.Initialize.call(this); 35640 this.UpdateInternalSelectedIndex(); 35641 }, 35642 UpdateInternalSelectedIndex: function() { 35643 var selectedIndexFromServer = this.GetSelectedIndex(); 35644 var stateInput = this.FindStateInputElement(); 35645 if(stateInput) { 35646 var restoredSelectedIndex = stateInput.value; 35647 if(restoredSelectedIndex != '' && restoredSelectedIndex != selectedIndexFromServer) { 35648 this.SetSelectedIndex(selectedIndexFromServer); 35649 this.SetSelectedIndex(restoredSelectedIndex); 35650 } 35651 } 35652 }, 35653 CreateButtonInternalCollection: function() { 35654 this.internalButtonCollection = this.CreateCheckBoxInternalCollection(); 35655 for(var i = 0; i < this.GetItemCount(); i++) { 35656 var icbInputElement = this.GetItemInput(i); 35657 var internalButton = this.internalButtonCollection.Add(icbInputElement.id, icbInputElement, this.GetItemElement(i)); 35658 internalButton.CreateFocusDecoration(this.icbFocusedStyle); 35659 internalButton.SetEnabled(this.GetEnabled()); 35660 internalButton.GetReadOnly = this.GetReadOnly.bind(this); 35661 internalButton.CheckedChanged.AddHandler(function(s, e) { 35662 this.OnItemClick(this.GetItemIndexByElement(ASPx.Evt.GetEventSource(e))); 35663 }.aspxBind(this)); 35664 internalButton.Focus.AddHandler(function(s, e) { 35665 if(!this.focused) 35666 this.OnFocus(); 35667 }.bind(this)); 35668 internalButton.LostFocus.AddHandler(function(s, e) { this.OnLostFocus(); }.aspxBind(this)); 35669 this.attachToCellsClick(i); 35670 this.PrepareInternalButton(internalButton, i); 35671 } 35672 this.attachToMainElementMouseDown(); 35673 }, 35674 CreateCheckBoxInternalCollection: function () { 35675 return new ASPx.CheckBoxInternalCollection(this.imageProperties, false, true, ASPx.CheckEditElementHelper.Instance, undefined, 35676 this.accessibilityCompliant); 35677 }, 35678 CheckableElementsExist: function() { 35679 return !!this.imageProperties; 35680 }, 35681 SetEnabled: function(enabled){ 35682 ASPxClientListEdit.prototype.SetEnabled.call(this, enabled); 35683 var stateInput = this.FindStateInputElement(); 35684 if(enabled) 35685 ASPx.Attr.RemoveAttribute(stateInput, "disabled"); 35686 else 35687 ASPx.Attr.SetAttribute(stateInput, "disabled", "disabled"); 35688 }, 35689 SetFocus: function() { 35690 this.UpdateFocus(); 35691 }, 35692 UpdateFocus: function() { 35693 }, 35694 IsElementBelongToInputElement: function(element) { 35695 return this.GetItemIndexByElement(element) != -1; 35696 }, 35697 attachToCellsClick: function(index) { 35698 var element = this.GetItemElement(index); 35699 ASPx.Evt.AttachEventToElement(element, "click", function(evt) { 35700 var src = ASPx.Evt.GetEventSource(evt); 35701 var label = ASPx.CheckEditElementHelper.Instance.GetLabelElement(element); 35702 var button = this.internalButtonCollection.Get(this.GetItemInput(index).id); 35703 if(!ASPx.GetIsParent(button.mainElement, src) && src !== label && src.parentElement !== label) { 35704 ASPx.CheckEditElementHelper.Instance.InvokeClick(button, evt); 35705 } 35706 }.aspxBind(this)); 35707 }, 35708 attachToMainElementMouseDown: function() { 35709 var mainElement = this.GetMainElement(); 35710 ASPx.Evt.AttachEventToElement(mainElement, "mousedown", function() { 35711 if(!this.enabled || this.readOnly) 35712 return;
35713 this.LockFocusEvents(); 35714 setTimeout(function() { this.UnlockFocusEvents(); }.aspxBind(this), 0); 35715 }.aspxBind(this)); 35716 }, 35717 GetItemIndexByElement: function(element) { 35718 for(var i = 0; i < this.GetItemCount(); i++) { 35719 var itemElement = this.GetItemElement(i); 35720 if(ASPx.GetIsParent(itemElement, element)) 35721 return i; 35722 } 35723 return -1; 35724 }, 35725 GetItemInput: function(index) { 35726 return this.GetChildElement("RB" + index + "_I"); 35727 }, 35728 GetItemElement: function(index) { 35729 return this.GetChildElement("RB" + index); 35730 }, 35731 GetItemFocusableElement: function(index) { 35732 return this.accessibilityCompliant ? this.GetChildElement("RB" + index + "_I_D") : this.GetItemInput(index); 35733 }, 35734 GetAccessibilityActiveElements: function() { 35735 var accessibilityElements = []; 35736 for(var i = 0; i < this.GetItemCount(); i++) 35737 accessibilityElements.push(this.GetItemFocusableElement(i)); 35738 return accessibilityElements; 35739 }, 35740 GetItemCount: function() { 35741 return this.items.length; 35742 }, 35743 OnItemClick: function(index) { 35744 }, 35745 OnItemClickReadonly: function() { 35746 var index = this.GetSelectedIndexInternal(); 35747 this.SelectIndexSilent(index); 35748 }, 35749 UpdateHiddenInputs: function(index) { 35750 var stateInput = this.FindStateInputElement(); 35751 if(ASPx.IsExistsElement(stateInput)) 35752 stateInput.value = index; 35753 var valueInput = this.GetValueInputElement(); 35754 if(ASPx.IsExistsElement(valueInput)) { 35755 var value = this.GetValue(); 35756 valueInput.value = ASPx.IsExists(value) ? value : " "; 35757 } 35758 }, 35759 GetItemValue: function(index){ 35760 if(index > -1 && index < this.items.length) { 35761 if(typeof(this.items[index].value) == "string" && this.items[index].value == "" && this.convertEmptyStringToNull) 35762 return null; 35763 else 35764 return this.items[index].value; 35765 } 35766 return null; 35767 }, 35768 SetValue: function(value) { 35769 for(var i = 0; i < this.items.length; i++) { 35770 if(this.GetItemValue(i) == value) { 35771 this.SelectIndexSilent(i); 35772 return; 35773 } 35774 } 35775 this.SelectIndexSilent(-1); 35776 }, 35777 CreateItems: function(itemsProperties){ 35778 for(var i = 0; i < itemsProperties.length; i++) 35779 this.CreateItem(i, { 35780 texts: itemsProperties[i][0], 35781 value: this.GetDecodeValue(itemsProperties[i][1]), 35782 imageUrl: itemsProperties[i][2] 35783 }); 35784 }, 35785 CreateItem: function(index, itemProperties){ 35786 var item = new ASPxClientListEditItem(this, index, itemProperties.texts, itemProperties.value, itemProperties.imageUrl); 35787 this.items.push(item); 35788 }, 35789 GetItem: function(index){ 35790 return (0 <= index && index < this.items.length) ? this.items[index] : null; 35791 }, 35792 ChangeEnabledAttributes: function(enabled){ 35793 if(!this.CheckableElementsExist()) { 35794 for(var i = 0; i < this.GetItemCount(); i++){ 35795 var element = this.GetItemInput(i); 35796 if(element){ 35797 this.ChangeItemEnabledAttributes(element, ASPx.Attr.ChangeAttributesMethod(enabled)); 35798 this.ChangeSpecialInputEnabledAttributes(element, ASPx.Attr.ChangeEventsMethod(enabled), true); 35799 element.disabled = !enabled; 35800 } 35801 } 35802 } else { 35803 var selectedIndex = this.GetSelectedIndexInternal(); 35804 this.UpdateCheckableElementDecorations(selectedIndex, enabled); 35805 } 35806 }, 35807 ChangeEnabledStateItems: function(enabled){ 35808 ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled); 35809 if(this.isNative){ 35810 for(var i = 0; i < this.GetItemCount(); i++){ 35811 var element = this.GetItemInput(i); 35812 if(element) 35813 ASPx.GetStateController().SetElementEnabled(element, enabled); 35814 } 35815 } 35816 }, 35817 ChangeItemEnabledAttributes: function(element, method){ 35818 method(element, "onclick"); 35819 } 35820}); 35821var ASPxClientRadioButtonList = ASPx.CreateClass(ASPxClientCheckListBase, { 35822 constructor: function(name) { 35823 this.constructor.prototype.constructor.call(this, name); 35824 }, 35825 InlineInitialize: function() { 35826 if(this.CheckableElementsExist()) 35827 this.CreateButtonInternalCollection(); 35828 ASPxClientCheckListBase.prototype.InlineInitialize.call(this); 35829 }, 35830 Initialize: function() { 35831 ASPxClientCheckListBase.prototype.Initialize.call(this);
35832 this.UpdateHiddenInputs(this.GetSelectedIndex()); 35833 this.SetSelectedIndex(this.GetSelectedIndex()); 35834 }, 35835 PrepareInternalButton: function(internalRadioButton){ 35836 internalRadioButton.autoSwitchEnabled = false; 35837 }, 35838 GetInputElement: function() { 35839 if(this.isNative) { 35840 var index = this.GetSelectedIndexInternal(); 35841 return this.GetItemInput(index); 35842 } else 35843 return this.GetValueInputElement(); 35844 }, 35845 GetValueInputElement: function() { 35846 if(this.valueInput == null) { 35847 var stateInput = this.FindStateInputElement(); 35848 this.valueInput = this.GetHiddenField(null, this.name + "_ValueInput", stateInput.parentNode, stateInput); 35849 } 35850 return this.valueInput; 35851 }, 35852 GetValueInputToValidate: function() { 35853 return this.GetValueInputElement(); 35854 }, 35855 SelectIndexSilent: function(index) { 35856 var itemCount = this.GetItemCount(); 35857 var isValidIndex = (-1 <= index && index < itemCount); 35858 if(isValidIndex) { 35859 if(this.CheckableElementsExist()) 35860 this.UpdateCheckableElementDecorations(index, this.GetEnabled()); 35861 else { 35862 for(var i = 0; i < itemCount; i++) { 35863 var element = this.GetItemInput(i); 35864 if(element) 35865 element.checked = (i == index); 35866 } 35867 } 35868 this.SetSelectedIndexInternal(index); 35869 this.UpdateHiddenInputs(index); 35870 } 35871 }, 35872 UpdateCheckableElementDecorations: function(selectedIndex, enabled) { 35873 if(this.CheckableElementsExist()) { 35874 for(var i = 0; i < this.items.length; i++) { 35875 var inputElement = this.GetItemInput(i); 35876 var internalButton = this.internalButtonCollection.Get(inputElement.id); 35877 internalButton.SetEnabled(enabled); 35878 internalButton.SetValue(i == selectedIndex ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked); 35879 } 35880 } 35881 }, 35882 UpdateFocus: function() { 35883 var index = this.GetSelectedIndexInternal(); 35884 if(index == -1) 35885 index = 0; 35886 var itemElement = this.GetItemFocusableElement(index); 35887 if(itemElement != null && ASPx.GetActiveElement() != itemElement && ASPx.IsEditorFocusable(itemElement)) 35888 ASPx.SetFocus(itemElement); 35889 }, 35890 OnItemClick: function(index) { 35891 if(this.GetSelectedIndexInternal() != index) { 35892 this.SelectIndexSilent(index); 35893 this.RaisePersonalStandardValidation(); 35894 this.OnValueChanged(); 35895 } 35896 this.UpdateFocus(); 35897 }, 35898 RequireInputElementToValidate: function() { 35899 return false; 35900 }, 35901 GetItem: function(index){ 35902 var item = ASPxClientCheckListBase.prototype.GetItem.call(this, index); 35903 if(item) 35904 item.selected = index == this.GetSelectedIndexInternal(); 35905 return item; 35906 } 35907}); 35908ASPxClientRadioButtonList.Cast = ASPxClientControl.Cast; 35909var ASPxClientCheckBoxList = ASPx.CreateClass(ASPxClientCheckListBase, { 35910 constructor: function(name) { 35911 this.constructor.prototype.constructor.call(this, name); 35912 this.selectionEventsLockCount = 0; 35913 this.initializeInputValue = null; 35914 this.restoredSelectedIndices = null; 35915 }, 35916 InlineInitialize: function() { 35917 if(this.CheckableElementsExist()) 35918 this.CreateButtonInternalCollection(); 35919 ASPxClientCheckListBase.prototype.InlineInitialize.call(this); 35920 }, 35921 Initialize: function() { 35922 this.initializeInputValue = this.GetInputElement().value; 35923 ASPxClientCheckListBase.prototype.Initialize.call(this); 35924 this.SaveRestoredIndices(); 35925 this.InitSelection(); 35926 }, 35927 SaveRestoredIndices: function() { 35928 var value = this.initializeInputValue; 35929 if(!ASPx.IsExists(value) || value === "") 35930 return; 35931 var serializer = this.GetSerializingHelper(); 35932 var itemStringIndices = serializer.DeserializeValues(value); 35933 var itemIndices = []; 35934 for(var i = 0; i < itemStringIndices.length; i++) { 35935 var itemIndex = parseInt(itemStringIndices[i]); 35936 itemIndices.push(itemIndex); 35937 } 35938 this.restoredSelectedIndices = itemIndices; 35939 }, 35940 InitSelection: function() { 35941 if(this.restoredSelectedIndices) 35942 this.UnselectAll(); 35943 var selectedIndices = this.restoredSelectedIndices || this.initSelectedIndices; 35944 this.SelectIndices(selectedIndices); 35945 this.CacheValue(); 35946 }, 35947 PrepareInternalButton: function(internalCheckBox, index){ 35948 internalCheckBox.autoSwitchEnabled = true; 35949 internalCheckBox.SetChecked(this.GetItemSelectionHelper().GetIsItemSelected(index)); 35950 }, 35951 SelectIndexSilent: function(index) { 35952 var itemCount = this.GetItemCount(); 35953 var isValidIndex = (-1 <= index && index < itemCount); 35954 if(isValidIndex) 35955 this.SelectIndices([index]); 35956 }, 35957 UpdateCheckableElementDecorations: function(selectedIndex, enabled) {
35958 if(this.CheckableElementsExist()) { 35959 for(var i = 0; i < this.items.length; i++) { 35960 var inputElement = this.GetItemInput(i); 35961 var internalButton = this.internalButtonCollection.Get(inputElement.id); 35962 internalButton.SetEnabled(enabled); 35963 } 35964 } 35965 }, 35966 SetSelectionDecoration: function(index, selected){ 35967 if(this.CheckableElementsExist()){ 35968 var inputElement = this.GetItemInput(index); 35969 var internalButton = this.internalButtonCollection.Get(inputElement.id); 35970 internalButton.SetValue(selected ? ASPx.CheckBoxInputKey.Checked : ASPx.CheckBoxInputKey.Unchecked); 35971 } else { 35972 var element = this.GetItemInput(index); 35973 if(element) 35974 element.checked = (selected); 35975 } 35976 }, 35977 OnItemClick: function(index) { 35978 this.GetItemSelectionHelper().OnItemClick(index); 35979 }, 35980 UpdateFocus: function() { 35981 var index = this.GetItemSelectionHelper().GetFocusedItemIndex(); 35982 if(index == -1) 35983 index = this.GetSelectedIndexInternal(); 35984 if(index == -1) 35985 index = 0; 35986 var itemElement = this.GetItemFocusableElement(index); 35987 if(itemElement != null && ASPx.GetActiveElement() != itemElement && ASPx.IsEditorFocusable(itemElement)) 35988 ASPx.SetFocus(itemElement); 35989 }, 35990 UpdateInternalState: function(){ 35991 this.UpdateHiddenInputs(); 35992 }, 35993 IsUpdateHiddenInputsLocked: function(){ 35994 return this.GetItemSelectionHelper().IsUpdateInternalSelectionStateLocked(); 35995 }, 35996 UpdateHiddenInputs: function(){ 35997 if(this.IsUpdateHiddenInputsLocked()) 35998 return; 35999 var element = this.FindStateInputElement(); 36000 if(ASPx.IsExistsElement(element)) { 36001 var sb = [ ]; 36002 var serialiser = this.GetSerializingHelper(); 36003 var selectedIndices = this.GetSelectedIndices(); 36004 for(var i = 0; i < selectedIndices.length; i++) 36005 serialiser.SerializeAtomValue(sb, selectedIndices[i]); 36006 element.value = sb.join(""); 36007 } 36008 }, 36009 GetSerializingHelper: function(){ 36010 if(this.serializingHelper == null) 36011 this.serializingHelper = new ListBoxBaseItemsSerializingHelper(this); 36012 return this.serializingHelper; 36013 }, 36014 SetItemSelectionAppearance: function(index, selected, controller, checkCanChangeSelection){ 36015 }, 36016 LockSelectionEvents: function(){ 36017 this.selectionEventsLockCount++; 36018 }, 36019 UnlockSelectionEvents: function(){ 36020 this.selectionEventsLockCount--; 36021 }, 36022 IsSelectionEventsLocked: function(){ 36023 return this.selectionEventsLockCount > 0; 36024 }, 36025 CacheValue: function(){ 36026 this.cachedValue = this.GetValue(); 36027 }, 36028 IsValueChanged: function(){ 36029 return this.cachedValue != this.GetValue(); 36030 }, 36031 OnItemSelectionChanged: function(index, selected){ 36032 this.SetSelectionDecoration(index, selected); 36033 if(!this.IsSelectionEventsLocked()) { 36034 this.SetRaiseSelectedIndexChangedArguments(this.autoPostBack, index, selected); 36035 var valueChanged = this.IsValueChanged(); 36036 if(valueChanged) { 36037 this.RaisePersonalStandardValidation(); 36038 this.OnValueChanged(); 36039 } else { 36040 if(this.RaiseSelectedIndexChanged()) 36041 this.SendPostBackInternal(""); 36042 } 36043 } 36044 this.CacheValue(); 36045 }, 36046 SetRaiseSelectedIndexChangedArguments: function(processOnServer, index, selected){ 36047 this.selectedIndexChangedArguments = { 36048 processOnServer: processOnServer, 36049 index: index, 36050 selected: selected 36051 }; 36052 }, 36053 GetRaiseSelectedIndexChangedArguments: function(){ 36054 if(!this.selectedIndexChangedArguments) 36055 this.SetRaiseSelectedIndexChangedArguments(false, this.GetSelectedIndex(), true); 36056 return this.selectedIndexChangedArguments; 36057 }, 36058 RaiseSelectedIndexChanged: function (processOnServer) { 36059 this.RaiseValidationInternal(); 36060 var savedArgs = this.GetRaiseSelectedIndexChangedArguments(); 36061 processOnServer = savedArgs.processOnServer || processOnServer; 36062 if(!this.SelectedIndexChanged.IsEmpty()){ 36063 var args = new ASPxClientListEditItemSelectedChangedEventArgs(savedArgs.index, savedArgs.selected, processOnServer); 36064 this.SelectedIndexChanged.FireEvent(this, args); 36065 processOnServer = args.processOnServer; 36066 } 36067 return processOnServer; 36068 }, 36069 GetItemSelectionHelper: function(){ 36070 if(!this.itemSelectionHelper) 36071 this.itemSelectionHelper = this.CreateItemSelectionHelper(); 36072 return this.itemSelectionHelper; 36073 }, 36074 CreateItemSelectionHelper: function(){ 36075 return new CheckBoxListMultiSelectionHelper(this); 36076 }, 36077 GetItem: function(index){ 36078 var item = ASPxClientCheckListBase.prototype.GetItem.call(this, index); 36079 item.selected = this.GetItemSelectionHelper().GetIsItemSelected(index); 36080 return item; 36081 }, 36082 SetValue: function(value){ 36083 var index = this.FindItemIndexByValue(value); 36084 this.SetSelectedIndex(index); 36085 }, 36086 GetSelectedIndexInternal: function(){ 36087 if(!this.isInitialized) 36088 return ASPxClientCheckListBase.prototype.GetSelectedIndexInternal.call(this); 36089 return this.GetItemSelectionHelper().GetSelectedIndex(); 36090 }, 36091 SetSelectedIndex: function(index){ 36092 this.LockSelectionEvents(); 36093 this.GetItemSelectionHelper().SetSelectedIndex(index); 36094 this.UnlockSelectionEvents(); 36095 }, 36096 GetSelectedIndices: function(){ 36097 return this.GetItemSelectionHelper().GetSelectedIndices(); 36098 }, 36099 GetSelectedValues: function(){ 36100 return this.GetItemSelectionHelper().GetSelectedValues();
36101 }, 36102 GetSelectedItems: function(){ 36103 return this.GetItemSelectionHelper().GetSelectedItems(); 36104 }, 36105 SelectAll: function(){ 36106 this.SelectIndices(); 36107 }, 36108 UnselectAll: function(){ 36109 this.UnselectIndices(); 36110 }, 36111 SelectIndices: function(indices){ 36112 this.LockSelectionEvents(); 36113 this.GetItemSelectionHelper().SelectIndices(indices); 36114 this.UnlockSelectionEvents(); 36115 }, 36116 SelectItems: function(items){ 36117 this.LockSelectionEvents(); 36118 this.GetItemSelectionHelper().SelectItems(items); 36119 this.UnlockSelectionEvents(); 36120 }, 36121 SelectValues: function(values){ 36122 this.LockSelectionEvents(); 36123 this.GetItemSelectionHelper().SelectValues(values); 36124 this.UnlockSelectionEvents(); 36125 }, 36126 UnselectIndices: function(indices){ 36127 this.LockSelectionEvents(); 36128 this.GetItemSelectionHelper().UnselectIndices(indices); 36129 this.UnlockSelectionEvents(); 36130 }, 36131 UnselectItems: function(items){ 36132 this.LockSelectionEvents(); 36133 this.GetItemSelectionHelper().UnselectItems(items); 36134 this.UnlockSelectionEvents(); 36135 }, 36136 UnselectValues: function(values){ 36137 this.LockSelectionEvents(); 36138 this.GetItemSelectionHelper().UnselectValues(values); 36139 this.UnlockSelectionEvents(); 36140 } 36141}); 36142ASPxClientCheckBoxList.Cast = ASPxClientControl.Cast; 36143var ASPxClientListEditItemSelectedChangedEventArgs = ASPx.CreateClass(ASPxClientProcessingModeEventArgs, { 36144 constructor: function(index, isSelected, processOnServer){ 36145 this.constructor.prototype.constructor.call(this, processOnServer); 36146 this.index = index; 36147 this.isSelected = isSelected; 36148 } 36149}); 36150function aspxLBTSelectStart(evt){ 36151 var shiftPressed = evt.shiftKey; 36152 var ctrlKey = evt.ctrlKey || evt.metaKey; 36153 if(shiftPressed || ctrlKey){ 36154 ASPx.Selection.Clear(); 36155 ASPx.Evt.PreventEventAndBubble(evt); 36156 } 36157} 36158function aspxLBIClick(evt){ 36159 if(ASPx.TouchUIHelper.isMouseEventFromScrolling) return; 36160 var element = ASPx.Evt.GetEventSource(evt); 36161 while(element != null && element.tagName != "BODY"){ 36162 if(element.tagName == "TR"){ 36163 var table = element.offsetParent; 36164 if(table && table.ListBoxId){ 36165 var lb = ASPx.GetControlCollection().Get(table.ListBoxId); 36166 if(lb != null) { 36167 var retValue; 36168 if(evt.type == "dblclick") 36169 retValue =lb.OnItemDblClick(); 36170 else if(!lb.isComboBoxList || ASPx.Evt.IsLeftButtonPressed(evt)) { 36171 var itemIndex = lb.GetItemIndexByRow(element); 36172 retValue = lb.OnItemClick(itemIndex, evt); 36173 } 36174 if(typeof(retValue) != "undefined") 36175 return retValue; 36176 } 36177 break; 36178 } 36179 } 36180 element = element.parentNode; 36181 } 36182} 36183function aspxLBScroll(evt){ 36184 var sourceId = ASPx.Evt.GetEventSource(evt).id; 36185 if(sourceId.slice(-lbDSuffix.length) == lbDSuffix){ 36186 var name = sourceId.slice(0, -2); 36187 var lb = ASPx.GetControlCollection().Get(name); 36188 if(lb != null && lb.isInitialized) 36189 lb.OnScroll(); 36190 } 36191} 36192ASPx.NLBIDClick = function(evt) { 36193 var element = ASPx.Evt.GetEventSource(evt); 36194 if(element != null && element.tagName == "SELECT"){ 36195 var lb = ASPx.GetControlCollection().Get(element.id); 36196 if(lb != null) 36197 lb.OnItemDblClick(); 36198 } 36199}; 36200ASPx.ERBLIClick = function(name, index) { 36201 var list = ASPx.GetControlCollection().Get(name); 36202 if(list != null) { 36203 if(list.GetReadOnly()) 36204 return false; 36205 list.OnItemClick(index); 36206 } 36207}; 36208ASPx.ERBLICancel = function(name) { 36209 var list = ASPx.GetControlCollection().Get(name); 36210 if(list != null) 36211 list.OnItemClickReadonly(); 36212}; 36213ASPx.ShowListBoxFilter = function(name) { 36214 var list = ASPx.GetControlCollection().Get(name); 36215 if(list != null) 36216 list.ShowFilterElement(); 36217}; 36218ASPx.HideListBoxFilter = function(name) { 36219 var list = ASPx.GetControlCollection().Get(name); 36220 if (list != null) 36221 list.HideFilterElement(); 36222}; 36223var highlightingOpeningGuid = "680fb6b5-de5f-4af1-b444-2617b6dc5aab"; 36224var highlightingClosingGuid = "ee51e3d2-fb72-45fc-b737-6d3432008053"; 36225ASPx.ListBoxHighlightingHelper = ASPx.CreateClass(null, { 36226 constructor: function(listBox, tagName) { 36227 this.listBox = listBox; 36228 this.tagName = tagName; 36229 this.highlightingOpeningTag = "<" + tagName + ">"; 36230 this.highlightingClosingTag = "</" + tagName + ">"; 36231 this.highlightingOpeningTagPlaceholder = new RegExp(highlightingOpeningGuid, "g"); 36232 this.highlightingClosingTagPlaceholder = new RegExp(highlightingClosingGuid, "g"); 36233 this.customReplacer = highlightingOpeningGuid + "$&" + highlightingClosingGuid; 36234 }, 36235 Apply: function(text, isCustom) { 36236 if(text == "" || !this.listBox.encodeHtml) return; 36237 if(isCustom) 36238 this.applyCustom(text); 36239 else
36240 this.apply(text, ASPx.ContainsFilteringUtils.SelectContainsTextInElement, false); 36241 }, 36242 Remove: function(text, isCustom) { 36243 if(isCustom) 36244 this.removeCustom(text); 36245 else 36246 this.apply(text, ASPx.ContainsFilteringUtils.UnselectContainsTextInElement, true); 36247 }, 36248 Refresh: function(text, isCustom) { 36249 if(text == "") return; 36250 if(isCustom) 36251 this.applyCustom(text, true); 36252 else 36253 this.apply(text, ASPx.ContainsFilteringUtils.ReselectContainsTextInElement, false); 36254 }, 36255 applyCustom: function(highlighting, refreshing) { 36256 var count = this.listBox.GetItemCount(); 36257 var highlightingRegExpxByColumns = this.getCustomHighlightingRegExpsByColumns(highlighting); 36258 for(var i = 0; i < count; i++) { 36259 var item = this.listBox.GetItemRow(i); 36260 if(!item || this.listBox.ItemRowHasTemplate(i)) continue; 36261 this.applyCustomCore(item, highlightingRegExpxByColumns, refreshing); 36262 } 36263 }, 36264 applyCustomCore: function(item, highlightingRegExpxByColumns, refreshing) { 36265 var elements = this.getTextCellElements(item); 36266 for(var i = 0, el; el = elements[i]; i++) { 36267 if(refreshing) 36268 this.removeCustomFromItem(el); 36269 this.applyCustomToItem(el, highlightingRegExpxByColumns[i]); 36270 } 36271 }, 36272 applyCustomToItem: function(element, regexp) { 36273 if(!regexp) 36274 return; 36275 var currentText = ASPx.Attr.GetAttribute(element, "DXText"); 36276 if(!ASPx.IsExists(currentText)) ASPx.Attr.SetAttribute(element, "DXText", ASPx.GetInnerText(element)); 36277 var oldInnerText = ASPx.GetInnerText(element); 36278 var newInnerText = oldInnerText.replace(regexp, this.customReplacer); 36279 newInnerText = ASPx.ContainsFilteringUtils.PrepareElementText(newInnerText) 36280 .replace(this.highlightingOpeningTagPlaceholder, this.highlightingOpeningTag) 36281 .replace(this.highlightingClosingTagPlaceholder, this.highlightingClosingTag); 36282 if(newInnerText !== oldInnerText) 36283 ASPx.SetInnerHtml(element, newInnerText); 36284 }, 36285 removeCustomFromItem: function(element) { 36286 var currentText = ASPx.Attr.GetAttribute(element, "DXText"); 36287 if(ASPx.IsExists(currentText)) { 36288 currentText = ASPx.ContainsFilteringUtils.PrepareElementText(currentText); 36289 ASPx.SetInnerHtml(element, currentText === "" ? " " : currentText); 36290 } 36291 }, 36292 removeCustom: function() { 36293 var count = this.listBox.GetItemCount(); 36294 for(var i = 0; i < count; i++) { 36295 var item = this.listBox.GetItemRow(i); 36296 if(!item || this.listBox.ItemRowHasTemplate(i)) continue; 36297 this.removeCustomCore(item); 36298 } 36299 }, 36300 removeCustomCore: function(item) { 36301 var elements = this.getTextCellElements(item); 36302 for(var i = 0, el; el = elements[i]; i++) 36303 this.removeCustomFromItem(el); 36304 }, 36305 getCustomHighlightingRegExpsByColumns: function(highlighting) { 36306 var columns = this.listBox.IsMultiColumn() ? this.listBox.columnFieldNames : [""]; 36307 return columns.map(function(fieldName) { 36308 if(typeof (highlighting) === "string" || Array.isArray(highlighting) || highlighting instanceof RegExp) 36309 return this.arrayToRegEx(highlighting); 36310 if(typeof (highlighting) === "object") 36311 return this.arrayToRegEx(highlighting[fieldName]); 36312 return null; 36313 }.bind(this)); 36314 }, 36315 arrayToRegEx: function(texts) { 36316 if(texts instanceof RegExp) 36317 return texts; 36318 if(typeof (texts) === "string") 36319 return this.arrayToRegEx([texts]); 36320 if(Array.isArray(texts)) { 36321 texts = texts 36322 .filter(function(t) { return typeof (t) === "string" && t.length; }) 36323 .sort(function(a, b) { return b.length - a.length; }) 36324 .map(ASPx.Str.EscapeForRegEx); 36325 if(texts.length) 36326 return new RegExp("(" + texts.join("|") + ")", "gi"); 36327 } 36328 return null; 36329 }, 36330 apply: function(text, func, allColumns) { 36331 var count = this.listBox.GetItemCount(); 36332 for (var i = 0; i < count; i++) { 36333 var item = this.listBox.GetItemRow(i); 36334 if (item && (allColumns || ASPx.GetElementDisplay(item)) && this.canApply(item)) { 36335 var elements = this.listBox.GetItemSelectableElementsByRow(item); 36336 this.applyToItem(text, elements, func, allColumns); 36337 } 36338 } 36339 }, 36340 applyToItem: function(text, elements, func, allColumns) {
36341 var itemValues = this.getItemValues(elements); 36342 var itemSelection = this.getItemSelection(itemValues, this.listBox.textFormatString, text); 36343 var firstTextCellIndex = this.getFirstTextCellIndex(); 36344 if (allColumns) { 36345 for (var i = 0; i < elements.length; i++) 36346 this.applyToItemCore(func, elements[i], itemSelection[i]); 36347 } else 36348 this.applyToTextCells(func, firstTextCellIndex, elements, itemSelection); 36349 }, 36350 getItemSelection: function (itemValues, textFormatString, text) { 36351 return ASPx.ContainsFilteringUtils.GetColumnSelectionsForItem(itemValues, textFormatString, text); 36352 }, 36353 applyToTextCells: function(func, firstTextCellIndex, elements, itemSelection) { 36354 for(var i = 0; i < itemSelection.length; i++) 36355 this.applyToItemCore(func, elements[itemSelection[i].index + firstTextCellIndex], itemSelection[i]); 36356 }, 36357 applyToItemCore: function (func, itemElement, itemSelection) { 36358 if (!this.listBox.ItemCellHasTextAttr(itemElement)) 36359 func(itemElement, itemSelection, this.tagName); 36360 }, 36361 getItemValues: function (elements) { 36362 var result = []; 36363 for (var i = this.getFirstTextCellIndex() ; i < elements.length; i++) 36364 result.push(ASPxClientListBox.GetItemCellInnerText(elements[i])); 36365 return result; 36366 }, 36367 canApply: function (item) { 36368 return !this.listBox.ItemRowHasTemplateCore(item); 36369 }, 36370 getFirstTextCellIndex: function () { 36371 return this.listBox.GetItemFirstTextCellIndex(); 36372 }, 36373 getTextCellElements: function(item) { 36374 return this.listBox.GetItemTextCells(item); 36375 } 36376}); 36377var ListEditFilterStrategyBase = ASPx.CreateClass(null, { 36378 OnPaste: function(evt) { }, 36379 OnInput: function() { }, 36380 OnClearButtonClick: function() { }, 36381 OnTextChanged: function() { }, 36382 OnEscape: function() { }, 36383 OnKeyDown: function(evt) { }, 36384 OnAfterEnter: function() { }, 36385 OnSelectedIndexChanged: function() { }, 36386 OnLostFocus: function() { }, 36387 OnCallback: function(result) { }, 36388 OnBeforeDoEndCallback: function() { }, 36389 OnAfterDoEndCallback: function() { }, 36390 OnBeforeCallbackFinally: function() { }, 36391 OnAfterCallbackFinally: function() { }, 36392 OnPerformCallback: function() { }, 36393 Filtering: function() { }, 36394 CancelFiltering: function() { }, 36395 ShouldDiscardCallbackResult: function() { }, 36396 GetCallbackArguments: function() { return ""; }, 36397 CanNavigateByKbd: function() { return true; }, 36398 IsFilterMeetRequirementForMinLength: function (filter) { return true; }, 36399 ResetCallbackState: function() { }, 36400 ClearFilterApplied: function() { }, 36401 OnDropDownHideArea: function() { }, 36402 OnDropDownButtonClick: function() { }, 36403 OnDropDownCloseByDocumentOrWindowEvent: function() { }, 36404 OnApplyChanges: function() { }, 36405 OnCancelChanges: function() { }, 36406 OnUndo: function() { } 36407}); 36408var ListEditIncrementalFilterStrategyBase = ASPx.CreateClass(ListEditFilterStrategyBase, { 36409 constructor: function(filterDelay, filterMinLength, isCallbackMode) { 36410 this.filterTimeoutId = -1; 36411 this.filterDelay = filterDelay; 36412 this.filterMinLength = filterMinLength; 36413 this.isCallbackMode = isCallbackMode; 36414 this.filter = ""; 36415 this.highlighting = ""; 36416 this.filterInitialized = false; 36417 this.needEmptyFilterBeforeFiltering = false; 36418 this.currentCallbackIsFiltration = false; 36419 this.refiltrationRequired = false; 36420 }, 36421 GetInputFilterValue: function() { throw "Not Implemented"; }, 36422 GetListBoxControl: function() { throw "Not Implemented"; }, 36423 IsSatisfy: function(text, filter) { throw "Not Implemented"; }, 36424 InCallback: function() { throw "Not Implemented"; }, 36425 IsEnabled: function() { throw "Not Implemented"; }, 36426 SendCallbackCore: function() { throw "Not Implemented"; }, 36427 PreventEndCallbackRising: function() { throw "Not Implemented"; }, 36428 GetSelectedIndex: function() { throw "Not Implemented"; }, 36429 NotifyCollectionChanged: function() { throw "Not Implemented"; }, 36430 OnCallbackCore: function(highlighting, newFilterLength) { throw "Not Implemented"; }, 36431 RaiseItemFilteringEvent: function(item, filter, isFit) { throw "Not Implemented"; }, 36432 RaiseCustomHighlightingEvent: function(filter, highlighting) { throw "Not Implemented"; }, 36433 OnBeforeFilteringOnClient: function(filter) { }, 36434 OnAfterFilteringOnClientCore: function (filter, firstSatisfyItemIndex) { throw "Not Implemented"; }, 36435 SupportsFilterCorrection: function() { throw "Not Implemented"; }, 36436 OnFirstSatisfiedItemFound: function(index, text, isTextClearing) { }, 36437 TryProcessFilterLessMinLength: function() { return true; }, 36438 AllowEmptyFilterResults: function() { return true; }, 36439 OnBeforeFiltering: function() { }, 36440 OnAfterFiltering: function() { }, 36441 OnFilteringCancelled: function() { }, 36442 OnTextChanged: function() { }, 36443 OnFilterRollback: function() { }, 36444 CanStartFilterOnInput: function() { 36445 return this.IsEnabled() && !this.InCallback(); 36446 }, 36447 OnAfterFilteringOnClient: function (filter, satisfyItemIndices) { 36448 this.GetListBoxControl().RewriteFilteredItemIndices(satisfyItemIndices); 36449 var firstSatisfyItemIndex = satisfyItemIndices.length > 0 ? satisfyItemIndices[0] : -1; 36450 this.OnAfterFilteringOnClientCore(filter, firstSatisfyItemIndex); 36451 }, 36452 ShouldClearFilterBeforeFiltering: function(filter) { return false; }, 36453 OnInput: function() { 36454 if(this.CanStartFilterOnInput()) { 36455 this.FilterStopTimer(); 36456 this.FilterStartTimer(); 36457 } 36458 }, 36459 OnCallback: function(result) { 36460 this.OnCallbackCore(result[CONSTANTS.CALLBACK_RESULTS.FILTER_CUSTOMHIGHLIGHTING], result[CONSTANTS.CALLBACK_RESULTS.FILTER_LENGTH]); 36461 this.currentCallbackIsFiltration = false; 36462 }, 36463 CancelFiltering: function() { 36464 this.FilterStopTimer(); 36465 }, 36466 Filtering: function(fromApi) { 36467 this.FilterStopTimer(); 36468 var inputValue = this.GetInputFilterValue(); 36469 this.needEmptyFilterBeforeFiltering = this.ShouldClearFilterBeforeFiltering(inputValue); 36470 var newFilter = this.needEmptyFilterBeforeFiltering ? "" : inputValue; 36471 var oldFilter = this.filter; 36472 if(!this.FilterCompare(newFilter)) { 36473 this.SetFilter(newFilter); 36474 if(!this.IsFilterMeetRequirementForMinLength() && this.TryProcessFilterLessMinLength(oldFilter)) 36475 return; 36476 else { 36477 this.OnBeforeFiltering(); 36478 if(this.isCallbackMode) 36479 this.FilteringOnServer(); 36480 else 36481 this.FilteringOnClient(); 36482 this.OnAfterFiltering(); 36483 } 36484 } 36485 else 36486 this.OnFilteringCancelled(fromApi); 36487 }, 36488 FilteringOnClient: function() { 36489 var listBox = this.GetListBoxControl(), 36490 count = listBox.GetItemCount(), 36491 filter = this.filter, 36492 visibleItems = [], 36493 visibleItemFound = false;
36494 this.DiscardHighlighting(); 36495 while(true) { 36496 var preparedFilter = ASPx.Str.PrepareStringForFilter(filter); 36497 listBox.BeforeClientFiltering(); 36498 for(var i = 0; i < count; i++) { 36499 var item = listBox.GetItem(i); 36500 var isFit = this.IsSatisfy(item.text, preparedFilter); 36501 isFit = this.RaiseItemFilteringEvent(item, filter, isFit); 36502 if(isFit) { 36503 if(!visibleItemFound) { 36504 this.OnBeforeFilteringOnClient(filter); 36505 for(var j = 0; j < i; j++) 36506 listBox.ApplyFilterToItem(j, false); 36507 var isTextClearing = filter == "" && this.filter != item.text; 36508 this.OnFirstSatisfiedItemFound(i, item.text, isTextClearing); 36509 visibleItemFound = true; 36510 } 36511 visibleItems.push(i); 36512 } 36513 if(visibleItemFound) 36514 listBox.ApplyFilterToItem(i, isFit); 36515 } 36516 if(visibleItemFound || this.AllowEmptyFilterResults() || !filter) 36517 break; 36518 filter = filter.substr(0, filter.length - 1); 36519 } 36520 if(!visibleItemFound) { 36521 this.OnBeforeFilteringOnClient(filter); 36522 if(this.AllowEmptyFilterResults()) { 36523 for(var i = 0; i < count; i++) 36524 listBox.ApplyFilterToItem(i, false); 36525 } 36526 } 36527 this.OnAfterFilteringOnClient(filter, visibleItems); 36528 this.SetHighlighting(filter); 36529 this.OnEndFiltering(visibleItemFound || this.AllowEmptyFilterResults()); 36530 }, 36531 FilteringOnServer: function() { 36532 if(!this.InCallback()) { 36533 var listBox = this.GetListBoxControl(); 36534 listBox.ClearItems(); 36535 listBox.serverIndexOfFirstItem = 0; 36536 listBox.SetScrollSpacerVisibility(true, false); 36537 listBox.SetScrollSpacerVisibility(false, false); 36538 } 36539 this.SendFilteringCallback(); 36540 }, 36541 SendFilteringCallback: function(owner) { 36542 this.currentCallbackIsFiltration = true; 36543 this.SendCallbackCore(); 36544 }, 36545 OnEndFiltering: function(visibleCollectionChanged) { 36546 if(visibleCollectionChanged) 36547 this.NotifyCollectionChanged(); 36548 this.ApplyHighlighting(); 36549 }, 36550 IsFilterTimerActive: function() { 36551 return this.filterTimeoutId !== -1; 36552 }, 36553 FilterStopTimer: function() { 36554 this.filterTimeoutId = ASPx.Timer.ClearTimer(this.filterTimeoutId); 36555 }, 36556 FilterStartTimer: function() { 36557 this.filterTimeoutId = ASPx.Timer.SetControlBoundTimeout(function() { 36558 this.filterTimeoutId = -1; 36559 this.Filtering(); 36560 }.bind(this), this.GetListBoxControl(), this.filterDelay); 36561 }, 36562 IsFilterMeetRequirementForMinLength: function(filter) { 36563 if(typeof (filter) !== "string") 36564 filter = this.GetInputFilterValue(); 36565 return typeof (filter) === "string" ? filter.length >= this.filterMinLength : true; 36566 }, 36567 GetCallbackArguments: function() { 36568 if(this.filter) { 36569 var callbackPrefix = this.SupportsFilterCorrection() ? CONSTANTS.CALLBACK_PREFIXES.FILTERING_CORRECT : CONSTANTS.CALLBACK_PREFIXES.FILTERING; 36570 return ASPx.FilteringUtils.FormatCallbackArg(callbackPrefix, this.filter); 36571 } 36572 return ""; 36573 }, 36574 OnAfterDoEndCallback: function() { 36575 if(this.refiltrationRequired) { 36576 this.refiltrationRequired = false; 36577 window.setTimeout(this.Filtering.bind(this), 0); 36578 } 36579 }, 36580 OnBeforeDoEndCallback: function() { 36581 if(this.refiltrationRequired) 36582 this.PreventEndCallbackRising(); 36583 }, 36584 OnSelectedIndexChanged: function() { 36585 this.ClearFilterApplied(); 36586 }, 36587 SetHighlighting: function(filter, callbackHighlighting) { 36588 callbackHighlighting = this.ProcessCallbackHighlighting(callbackHighlighting); 36589 var customHighlighting = this.RaiseCustomHighlightingEvent(filter, callbackHighlighting); 36590 this.isCustomHighlighting = customHighlighting !== null && customHighlighting !== undefined; 36591 this.highlighting = this.isCustomHighlighting ? customHighlighting : filter; 36592 }, 36593 ProcessCallbackHighlighting: function(obj) { 36594 if(obj === undefined || obj === null) 36595 return undefined; 36596 var val = obj.val; 36597 var regEx = !!obj.regEx; 36598 if(regEx) { 36599 if(typeof (val) === "string") 36600 val = new RegExp(val, "gi"); 36601 if(!Array.isArray(val) && typeof (val) === "object") { 36602 for(var col in val) { 36603 if(!val.hasOwnProperty(col)) continue; 36604 if(typeof (val[col]) === "string") 36605 val[col] = new RegExp(val[col], "gi"); 36606 } 36607 } 36608 } 36609 return val; 36610 }, 36611 IsEmptyFilter: function() { 36612 return !this.filterInitialized || this.filter === ""; 36613 }, 36614 ShouldDiscardCallbackResult: function() { 36615 var discardCallbackResult = !this.needEmptyFilterBeforeFiltering && !this.IsFilterEqualInputValue() && this.currentCallbackIsFiltration;
36616 if(discardCallbackResult) 36617 this.refiltrationRequired = true; 36618 return discardCallbackResult; 36619 }, 36620 IsFilterEqualInputValue: function() { 36621 var currentFilter = this.GetInputFilterValue(); 36622 return this.FilterCompareLower(ASPx.Str.PrepareStringForFilter(currentFilter)); 36623 }, 36624 FilterCompare: function(value) { 36625 return this.filterInitialized && this.filter === value; 36626 }, 36627 FilterCompareLower: function(value) { 36628 if(!this.filterInitialized) 36629 return false; 36630 return ASPx.Str.PrepareStringForFilter(this.filter) == value; 36631 }, 36632 DiscardHighlighting: function() { 36633 this.GetListBoxControl().highlighting.Remove(this.highlighting, this.isCustomHighlighting); 36634 }, 36635 ApplyHighlighting: function() { 36636 this.GetListBoxControl().highlighting.Apply(this.highlighting, this.isCustomHighlighting); 36637 }, 36638 RefreshHighlighting: function() { 36639 this.GetListBoxControl().highlighting.Refresh(this.highlighting, this.isCustomHighlighting); 36640 }, 36641 MakeAllItemsVisible: function() { 36642 this.GetListBoxControl().MakeAllItemsVisible(); 36643 }, 36644 SetFilter: function(newFilter) { 36645 this.filter = newFilter; 36646 this.highlighting = ""; 36647 this.isCustomHighlighting = undefined; 36648 this.filterInitialized = true; 36649 }, 36650 ClearFilter: function() { 36651 this.filter = ""; 36652 this.highlighting = ""; 36653 this.isCustomHighlighting = undefined; 36654 this.filterInitialized = false; 36655 }, 36656 ClearFilterApplied: function() { 36657 this.filterInitialized = false; 36658 }, 36659 FilteringBackspace: function() { 36660 throw "Not Implemented"; 36661 }, 36662}); 36663var ListBoxFilterStrategy = ASPx.CreateClass(ListEditIncrementalFilterStrategyBase, { 36664 constructor: function(listBox) { 36665 this.constructor.prototype.constructor.call(this, listBox.filteringDelay, listBox.filterMinLength, listBox.isCallbackMode); 36666 this.listBox = listBox; 36667 }, 36668 SupportsFilterCorrection: function() { 36669 return false; 36670 }, 36671 IsEnabled: function() { 36672 return this.listBox.GetEnabled(); 36673 }, 36674 GetInputFilterValue: function() { 36675 return this.listBox.filteringTextBox.GetInputElement().value; 36676 }, 36677 NotifyCollectionChanged: function() { 36678 this.listBox.CollectionChanged(true); 36679 }, 36680 TryProcessFilterLessMinLength: function(oldFilter) { 36681 this.SetFilter(""); 36682 return !oldFilter; 36683 }, 36684 IsSatisfy: function(text, filter) { 36685 return ASPx.Str.PrepareStringForFilter(text).indexOf(filter) !== -1; 36686 }, 36687 GetListBoxControl: function() { 36688 return this.listBox; 36689 }, 36690 OnAfterFilteringOnClientCore: function (filter, firstSatisfyItemIndex) { 36691 if(firstSatisfyItemIndex !== -1) 36692 this.listBox.CorrectCellWidthsOnFirstRowItemReplacement(0, firstSatisfyItemIndex); 36693 }, 36694 OnEndFiltering: function(visibleCollectionChanged) { 36695 ListEditIncrementalFilterStrategyBase.prototype.OnEndFiltering.call(this, visibleCollectionChanged); 36696 if(this.listBox.IsMultiColumn()) 36697 this.listBox.CorrectWidth(); 36698 this.listBox.updateSelectAllElementsState(); 36699 }, 36700 SendCallbackCore: function() { 36701 this.listBox.SendCallback(); 36702 }, 36703 InCallback: function() { 36704 return this.listBox.InCallback(); 36705 }, 36706 PreventEndCallbackRising: function() { 36707 this.listBox.preventEndCallbackRising = true; 36708 }, 36709 GetSelectedIndex: function() { 36710 return this.listBox.GetSelectedIndex(); 36711 }, 36712 OnCallbackCore: function(highlighting, newFilterLength) { 36713 if(this.currentCallbackIsFiltration) 36714 this.SetHighlighting(this.filter, highlighting); 36715 if(this.filter) 36716 this.OnEndFiltering(); 36717 }, 36718 FilteringBackspace: function() { 36719 var textBox = this.listBox.filteringTextBox; 36720 if(textBox) 36721 ASPx.StartWithFilteringUtils.RollbackOneSuggestedChar(textBox.GetInputElement()); 36722 this.FilterStartTimer(); 36723 }, 36724 RaiseItemFilteringEvent: function(item, filter, isFit) { 36725 return this.listBox.RaiseItemFiltering(item, filter, isFit); 36726 }, 36727 RaiseCustomHighlightingEvent: function(filter, callbackHighlighting) { 36728 return this.listBox.RaiseCustomHighlighting(filter, callbackHighlighting); 36729 } 36730}); 36731ASPx.ListBoxItemsDefaultManager = ListBoxItemsDefaultManager; 36732ASPx.ListBoxItemsVirtualManager = ListBoxItemsVirtualManager; 36733ASPx.VirtualRenderListBoxStateControllerManager = VirtualRenderListBoxStateControllerManager;
36734ASPx.DefaultListBoxStateControllerManager = DefaultListBoxStateControllerManager; 36735ASPx.ListEditIncrementalFilterStrategyBase = ListEditIncrementalFilterStrategyBase; 36736ASPx.ListBoxFilterStrategy = ListBoxFilterStrategy; 36737ASPx.ListEditFilterStrategyBase = ListEditFilterStrategyBase; 36738var ASPxClientListEditItemFilteringEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 36739 constructor: function(item, filter, isFit) { 36740 this.constructor.prototype.constructor.call(this); 36741 this.item = item; 36742 this.isFit = isFit; 36743 this.filter = filter; 36744 } 36745}); 36746var ASPxClientListEditCustomHighlightingEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 36747 constructor: function(filter) { 36748 this.constructor.prototype.constructor.call(this); 36749 this.highlighting = null; 36750 this.filter = filter; 36751 } 36752}); 36753ASPx.ListBoxScrollCallbackHelper = ListBoxScrollCallbackHelper; 36754window.ASPxClientListEdit = ASPxClientListEdit; 36755window.ASPxClientListEdit.CONSTANTS = CONSTANTS; 36756window.ASPxClientListEditItem = ASPxClientListEditItem; 36757window.ASPxClientListBoxItem = ASPxClientListBoxItem; 36758window.ASPxClientListBoxBase = ASPxClientListBoxBase; 36759window.ASPxClientListBox = ASPxClientListBox; 36760window.ASPxClientNativeListBox = ASPxClientNativeListBox; 36761window.ASPxClientCheckListBase = ASPxClientCheckListBase; 36762window.ASPxClientRadioButtonList = ASPxClientRadioButtonList; 36763window.ASPxClientCheckBoxList = ASPxClientCheckBoxList; 36764window.ASPxClientListEditItemSelectedChangedEventArgs = ASPxClientListEditItemSelectedChangedEventArgs; 36765window.ASPxClientListEditItemFilteringEventArgs = ASPxClientListEditItemFilteringEventArgs; 36766window.ASPxClientListEditCustomHighlightingEventArgs = ASPxClientListEditCustomHighlightingEventArgs; 36767})(); 36768 36769(function() { 36770var CheckBoxValidStateMode = { 36771 Checked: "Checked", 36772 CheckedAndUnchecked: "CheckedAndUnchecked" 36773}; 36774var CheckBoxRequiredValidationPattern = ASPx.CreateClass(ASPx.ValidationPattern, { 36775 constructor: function(checkBox, errorText) { 36776 this.constructor.prototype.constructor.call(this, errorText); 36777 this.checkBox = checkBox; 36778 }, 36779 EvaluateIsValid: function(value) { 36780 var checkState = this.checkBox.GetCheckState(); 36781 if(this.checkBox.validStateMode === CheckBoxValidStateMode.Checked) 36782 return checkState === ASPx.CheckBoxCheckState.Checked; 36783 else 36784 return checkState !== ASPx.CheckBoxCheckState.Indeterminate; 36785 }, 36786}); 36787var ASPxClientCheckBox = ASPx.CreateClass(ASPxClientEdit, { 36788 constructor: function(name) { 36789 this.constructor.prototype.constructor.call(this, name); 36790 this.isASPxClientCheckEdit = true; 36791 this.valueChecked = true; 36792 this.valueUnchecked = false; 36793 this.valueGrayed = null; 36794 this.allowGrayed = false; 36795 this.isNative = false; 36796 this.stateController = null; 36797 this.imageProperties = null; 36798 this.allowGrayedByClick = true; 36799 this.displaySwitch = false; 36800 this.internalCheckBox = null; 36801 this.icbFocusedStyle = [];
36802 this.checkedIsValidOnly = false; 36803 this.sizingConfig.allowSetWidth = false; 36804 this.sizingConfig.allowSetHeight = false; 36805 this.isRequiredCheckBox = false; 36806 this.requiredCheckBoxErrorText = "*"; 36807 this.validStateMode = CheckBoxValidStateMode.Checked; 36808 this.CheckedChanged = new ASPxClientEvent(); 36809 }, 36810 InlineInitialize: function() { 36811 this.isNative = !this.imageProperties; 36812 this.allowGrayed = this.IsGrayedAllowed(); 36813 this.stateController = ASPx.CheckableElementStateController.Create(this.imageProperties, this.valueChecked, this.valueUnchecked, this.valueGrayed, this.allowGrayed); 36814 if(!this.isNative) 36815 this.CreateInternalCheckBox(); 36816 if(this.isRequiredCheckBox) 36817 this.validationPatterns.push(new CheckBoxRequiredValidationPattern(this, this.requiredCheckBoxErrorText)); 36818 ASPxClientEdit.prototype.InlineInitialize.call(this); 36819 }, 36820 Initialize: function() { 36821 ASPxClientEdit.prototype.Initialize.call(this); 36822 if(!ASPx.IsExistsElement(this.GetMainElement())) 36823 return; 36824 if(!this.isNative) { 36825 this.previousValue = this.GetStateInput().value; 36826 if(this.GetValue() !== null) 36827 this.UpdateInternalCheckState(); 36828 this.SetValue(this.GetValue()); 36829 } 36830 else 36831 this.previousValue = this.GetInputElement().checked; 36832 }, 36833 UpdateInternalCheckState: function() { 36834 var stateInput = this.GetStateInput(); 36835 stateInput.value = this.stateController.GetInputKeyByValue(true); 36836 stateInput.value = this.stateController.GetInputKeyByValue(false); 36837 var checkState = this.stateController.GetCheckStateByInputKey(this.previousValue); 36838 this.SetCheckState(checkState); 36839 }, 36840 GetInputElement: function() { 36841 if(this.isNative) 36842 return ASPxClientEdit.prototype.GetInputElement.call(this); 36843 else 36844 return this.GetStateInput(); 36845 }, 36846 CreateInternalCheckBox: function() { 36847 var instance = this; 36848 this.internalCheckBox = new ASPx.CheckBoxInternal(this.GetStateInput(), this.stateController, this.allowGrayed, this.allowGrayedByClick, 36849 ASPx.CheckEditElementHelper.Instance, this.GetMainElement(), true, undefined, undefined, this.accessibilityCompliant, this.displaySwitch); 36850 this.internalCheckBox.CreateFocusDecoration(this.icbFocusedStyle); 36851 this.internalCheckBox.SetValue(this.GetValue(), true); 36852 this.internalCheckBox.SetEnabled(this.GetEnabled()); 36853 this.internalCheckBox.GetReadOnly = this.GetReadOnly.bind(this); 36854 this.internalCheckBox.CheckedChanged.AddHandler(function(s, e) { instance.OnClick(e); }); 36855 this.internalCheckBox.Focus.AddHandler(function() { instance.OnFocus(); }); 36856 this.internalCheckBox.LostFocus.AddHandler(function() { instance.OnLostFocus(); }); 36857 if(ASPx.Browser.WebKitFamily) 36858 ASPx.Evt.AttachEventToElement(this.internalCheckBox.mainElement.parentNode, "selectstart", ASPx.Evt.PreventEventAndBubble); 36859 }, 36860 FindInputElement: function() { 36861 var element = this.GetMainElement(); 36862 if(ASPx.IsExistsElement(element) && element.tagName != "INPUT") 36863 element = this.GetChildElement("I"); 36864 return element; 36865 }, 36866 GetFocusableInputElement: function() { 36867 if(this.isNative) 36868 return this.GetInputElement(); 36869 return this.accessibilityCompliant ? this.GetICBMainElement() : this.GetInputElement(); 36870 }, 36871 IsGrayedAllowed: function() { 36872 for(var propertyKey in this.imageProperties) 36873 if(this.imageProperties[propertyKey].length === 3) 36874 return true; 36875 return false; 36876 }, 36877 RaiseValueChangedEvent: function() { 36878 var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this); 36879 processOnServer = this.RaiseCheckedChanged(processOnServer); 36880 return processOnServer; 36881 }, 36882 OnClick: function() { 36883 if(this.ToogleCheckState() && !this.focused) 36884 this.SetFocus(); 36885 }, 36886 ToogleCheckState: function() { 36887 if(!this.GetEnabled() || this.GetReadOnly()) 36888 return false; 36889 var value = this.GetCorrectValue(this.previousValue); 36890 value = this.stateController.GetNextCheckBoxValue(value, this.allowGrayedByClick && this.allowGrayed); 36891 this.SetValue(value); 36892 this.OnValueChanged(); 36893 return true; 36894 }, 36895 IsElementBelongToInputElement: function(element) { 36896 return false; 36897 }, 36898 ForceRefocusEditor: function() { 36899 if(this.isNative) 36900 ASPxClientEdit.prototype.ForceRefocusEditor.call(this); 36901 }, 36902 GetValue: function() { 36903 var value = this.stateController.GetValueByInputKey(this.GetStateInput().value); 36904 if(value === "" && this.convertEmptyStringToNull) 36905 value = null; 36906 return value; 36907 }, 36908 SetValue: function(value) { 36909 this.previousValue = value; 36910 value = this.GetCorrectValue(value); 36911 if(this.isNative) 36912 this.GetInputElement().checked = (this.previousValue == this.valueChecked); 36913 else 36914 this.internalCheckBox.SetValue(value);
36915 this.GetStateInput().value = this.stateController.GetInputKeyByValue(value); 36916 if(this.accessibilityCompliant) { 36917 var state = this.GetCheckState(); 36918 var mainElement = this.GetICBMainElement(); 36919 this.stateController.SetAriaCheckedSelectedAttributes(mainElement, state); 36920 } 36921 this.OnValueSet(); 36922 }, 36923 GetICBMainElement: function() { 36924 return ASPx.CheckableElementHelper.Instance.GetICBMainElementByInput(this.GetStateInput()); 36925 }, 36926 GetLabelElement: function() { 36927 return ASPx.CheckEditElementHelper.Instance.GetLabelElement(this.GetMainElement()); 36928 }, 36929 GetStateInput: function() { 36930 return this.GetChildElement("S"); 36931 }, 36932 GetAccessibilityActiveElements: function() { 36933 return [this.GetFocusableInputElement()]; 36934 }, 36935 GetCorrectValue: function(value) { 36936 var stateIsExist = typeof(this.stateController.GetInputKeyByValue(value)) != "undefined"; 36937 if(!stateIsExist) 36938 return this.allowGrayed ? this.valueGrayed : this.valueUnchecked; 36939 return value; 36940 }, 36941 OnValueSet: function() {}, 36942 RaiseCheckedChanged: function(processOnServer) { 36943 if(!this.CheckedChanged.IsEmpty()) { 36944 var args = new ASPxClientProcessingModeEventArgs(processOnServer); 36945 this.CheckedChanged.FireEvent(this, args); 36946 processOnServer = args.processOnServer; 36947 } 36948 return processOnServer; 36949 }, 36950 SetEnabled: function(enabled) { 36951 ASPxClientEdit.prototype.SetEnabled.call(this, enabled); 36952 if(!this.isNative) 36953 this.internalCheckBox.SetEnabled(enabled); 36954 }, 36955 GetChecked: function() { 36956 return this.stateController.GetCheckStateByInputKey(this.GetStateInput().value) == ASPx.CheckBoxCheckState.Checked; 36957 }, 36958 SetChecked: function(isChecked) { 36959 this.SetCheckState(isChecked ? ASPx.CheckBoxCheckState.Checked : ASPx.CheckBoxCheckState.Unchecked); 36960 }, 36961 GetText: function() { 36962 var labelElement = this.GetLabelElement(); 36963 return (labelElement != null) ? labelElement.innerHTML : ""; 36964 }, 36965 GetCheckState: function() { 36966 var internalCheckeState = this.stateController.GetCheckStateByInputKey(this.GetStateInput().value); 36967 if(internalCheckeState != ASPx.CheckBoxCheckState.Indeterminate || this.allowGrayed) 36968 return internalCheckeState; 36969 else 36970 return ASPx.CheckBoxCheckState.Unchecked; 36971 }, 36972 SetCheckState: function(checkState) { 36973 if(checkState != ASPx.CheckBoxCheckState.Indeterminate || this.allowGrayed) { 36974 var value = this.stateController.GetValueByCheckState(checkState); 36975 this.SetValue(value); 36976 } 36977 }, 36978 SetText: function(text) { 36979 var labelElement = this.GetLabelElement(); 36980 if(labelElement != null) 36981 ASPx.SetInnerHtml(labelElement, text); 36982 }, 36983 ChangeEnabledAttributes: function(enabled){ 36984 if(this.isNative) { 36985 this.ChangeInputEnabledAttributes(this.GetInputElement(), ASPx.Attr.ChangeAttributesMethod(enabled)); 36986 this.ChangeSpecialInputEnabledAttributes(this.GetInputElement(), ASPx.Attr.ChangeEventsMethod(enabled), true); 36987 this.GetInputElement().disabled = !enabled; 36988 } else 36989 this.internalCheckBox.SetEnabled(enabled); 36990 }, 36991 ChangeEnabledStateItems: function(enabled){ 36992 ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled); 36993 this.GetStateInput().disabled = !enabled; 36994 }, 36995 ChangeInputEnabledAttributes: function(element, method){ 36996 method(element, "onclick"); 36997 } 36998}); 36999ASPxClientCheckBox.Cast = ASPxClientControl.Cast; 37000var ASPxClientRadioButton = ASPx.CreateClass(ASPxClientCheckBox, { 37001 constructor: function(name) { 37002 this.constructor.prototype.constructor.call(this, name); 37003 this.isASPxClientRadioButton = true; 37004 this.groupName = ""; 37005 }, 37006 Initialize: function() { 37007 ASPxClientCheckBox.prototype.Initialize.call(this); 37008 if(this.accessibilityCompliant && this.groupName) 37009 this.setAccessibilityGroupAttributes(); 37010 }, 37011 setAccessibilityGroupAttributes: function() { 37012 var members = this.GetGroupMembers(); 37013 var currentIndex = members.indexOf(this); 37014 var focusableElement = this.GetFocusableInputElement(); 37015 ASPx.Attr.SetAttribute(focusableElement, "aria-setsize", members.length); 37016 ASPx.Attr.SetAttribute(focusableElement, "aria-posinset", currentIndex + 1); 37017 }, 37018 OnValueSet: function() { 37019 if(this.previousValue === true) 37020 this.UncheckOtherGroupMembers(true ); 37021 }, 37022 OnClick: function() { 37023 if(!this.previousValue) { 37024 this.UncheckOtherGroupMembers(); 37025 ASPxClientCheckBox.prototype.OnClick.call(this); 37026 } else { 37027 if(!this.focused) 37028 this.SetFocus(); 37029 } 37030 }, 37031 CreateInternalCheckBox: function() { 37032 ASPxClientCheckBox.prototype.CreateInternalCheckBox.call(this); 37033 this.internalCheckBox.autoSwitchEnabled = false; 37034 }, 37035 UncheckOtherGroupMembers: function(suppressEvents) { 37036 var members = this.GetGroupMembers(); 37037 for(var i = 0; i < members.length; i++) { 37038 var radioButton = members[i]; 37039 if(!ASPx.IsExistsElement(radioButton.GetMainElement())) 37040 members[i] = null; 37041 else { 37042 if(radioButton != this && radioButton.GetValue()){ 37043 radioButton.SetValue(false); 37044 if(!suppressEvents) 37045 radioButton.RaiseValueChangedEvent(); 37046 } 37047 } 37048 } 37049 }, 37050 OnReadonlyClick: function() { 37051 if(!this.previousValue) { 37052 var members = this.GetGroupMembers(); 37053 for(var i = 0; i < members.length; i++) { 37054 var radioButton = members[i]; 37055 radioButton.SetValue(radioButton.GetValue()); 37056 } 37057 } 37058 }, 37059 GetGroupName: function() { 37060 if(!this.isNative) 37061 return this.groupName; 37062 var inputElement = this.GetInputElement(); 37063 if (!ASPx.IsExistsElement(inputElement)) 37064 return null; 37065 var name = inputElement.name; 37066 if(!name.length) 37067 name = ""; 37068 return name; 37069 }, 37070 GetGroupMembers: function() { 37071 var result = [ ]; 37072 var groupName = this.GetGroupName(); 37073 if(groupName.length > 0) { 37074 ASPx.GetControlCollection().ForEachControl(function(control) { 37075 if(ASPx.Ident.IsASPxClientRadioButton(control)) { 37076 var controlGroupName = control.GetGroupName(); 37077 if (controlGroupName != null && controlGroupName == groupName) 37078 result.push(control); 37079 } 37080 }); 37081 } else { 37082 result.push(this); 37083 } 37084 return result; 37085 }, 37086 GetChecked: function() { 37087 return this.GetValue() == true; 37088 }, 37089 SetChecked: function(isChecked) { 37090 this.SetValue(isChecked); 37091 } 37092}); 37093ASPxClientRadioButton.Cast = ASPxClientControl.Cast; 37094ASPx.Ident.IsASPxClientCheckEdit = function(obj) { 37095 return !!obj.isASPxClientCheckEdit; 37096}; 37097ASPx.Ident.IsASPxClientRadioButton = function(obj) { 37098 return !!obj.isASPxClientRadioButton; 37099};
37100ASPx.Ident.IsASPxClientCheckBox = function(obj) { 37101 return ASPx.Ident.IsASPxClientCheckEdit(obj) && !ASPx.Ident.IsASPxClientRadioButton(obj); 37102}; 37103ASPx.ChkOnClick = function(name) { 37104 var edit = ASPx.GetControlCollection().Get(name); 37105 if(edit) { 37106 if(edit.isNative && edit.GetReadOnly()) 37107 return false; 37108 edit.OnClick(); 37109 } 37110}; 37111ASPx.ERBOnReadonlyClick = function(name) { 37112 var rb = ASPx.GetControlCollection().Get(name); 37113 if(rb) 37114 rb.OnReadonlyClick(); 37115}; 37116window.ASPxClientCheckBox = ASPxClientCheckBox; 37117window.ASPxClientRadioButton = ASPxClientRadioButton; 37118})(); 37119 37120(function () { 37121var SplitterHelper = ASPx.CreateClass(null, { 37122 constructor: function (splitter) { 37123 this.splitter = splitter; 37124 }, 37125 GetMoveMaxDeltaSize: function (deltaSize) { 37126 if(deltaSize == 0) 37127 return 0; 37128 var splitter = this.splitter, 37129 leftPane = splitter.moveLeftPane, 37130 rightPane = splitter.moveRightPane; 37131 if(splitter.isHeavyUpdate) { 37132 var parent = leftPane.parent; 37133 var totalSize = 0, minSize = 0; 37134 for(var i = 0; i < parent.panes.length; i++) { 37135 var pane = parent.panes[i]; 37136 if(pane.isSizePx) 37137 continue; 37138 if(pane.collapsed) { 37139 var collapsedSize = pane.GetSizeDiff(pane.isVertical); 37140 totalSize += collapsedSize; 37141 minSize += collapsedSize; 37142 } 37143 else { 37144 totalSize += pane.GetOffsetSize(); 37145 minSize += pane.GetMinSize(); 37146 } 37147 } 37148 var rightPanePx = rightPane.isSizePx; 37149 if(rightPanePx) 37150 deltaSize = this.GetPaneMaxDeltaSize(rightPane, -deltaSize); 37151 deltaSize = this.GetMaxDeltaSize(totalSize, minSize, Number.MAX_VALUE, -deltaSize); 37152 if(!rightPanePx) 37153 deltaSize = this.GetPaneMaxDeltaSize(leftPane, -deltaSize); 37154 } 37155 else { 37156 var parent = leftPane.parent, 37157 rightPaneAutoSize = rightPane.IsAutoSize(parent.isVertical), 37158 leftPaneAutoSize = leftPane.IsAutoSize(parent.isVertical); 37159 if(!rightPaneAutoSize) 37160 deltaSize = -this.GetPaneMaxDeltaSize(rightPane, -1 * deltaSize); 37161 if(!leftPaneAutoSize) 37162 deltaSize = this.GetPaneMaxDeltaSize(leftPane, deltaSize); 37163 } 37164 return deltaSize; 37165 }, 37166 GetPaneMaxDeltaSize: function (pane, deltaSize) { 37167 return this.GetMaxDeltaSize(pane.GetOffsetSize(), pane.GetMinSize(), pane.maxSize, deltaSize); 37168 }, 37169 GetMaxDeltaSize: function (size, min, max, deltaSize) { 37170 var minDeltaSize = Math.floor(min - size); 37171 var maxDeltaSize = Math.floor(max - size); 37172 if(deltaSize < minDeltaSize) 37173 return (size < min) ? 0 : minDeltaSize; 37174 else if(deltaSize > maxDeltaSize) 37175 return (size > max) ? 0 : maxDeltaSize; 37176 return deltaSize; 37177 }, 37178 GetCurrentPos: function () { 37179 return this.splitter.moveIsVertical 37180 ? ASPxClientSplitter.CurrentYPos 37181 : ASPxClientSplitter.CurrentXPos; 37182 }, 37183 SetResizingPanelVisibility: function (visible, cursor) { 37184 var resizingPanel = ASPx.CacheHelper.GetCachedValue(this, "resizingPanel", function () { 37185 var resizingPanel = document.createElement("DIV"); 37186 resizingPanel.style.overflow = "hidden"; 37187 resizingPanel.style.position = "absolute"; 37188 resizingPanel.isVisible = false; 37189 return resizingPanel; 37190 }); 37191 if(resizingPanel.isVisible != visible) { 37192 if(visible) { 37193 var mainElement = this.splitter.GetMainElement(); 37194 ASPx.SetStyles(resizingPanel, { 37195 width: mainElement.offsetWidth, 37196 height: mainElement.offsetHeight 37197 }); 37198 if(cursor) 37199 resizingPanel.style.cursor = cursor; 37200 mainElement.parentNode.appendChild(resizingPanel); 37201 ASPx.SetAbsoluteX(resizingPanel, ASPx.GetAbsoluteX(mainElement)); 37202 ASPx.SetAbsoluteY(resizingPanel, ASPx.GetAbsoluteY(mainElement)); 37203 } 37204 else 37205 resizingPanel.parentNode.removeChild(resizingPanel); 37206 resizingPanel.isVisible = visible; 37207 } 37208 }, 37209 OnDispose: function() { 37210 this.splitter = null; 37211 } 37212}); 37213SplitterHelper.Resize = function (pane1, pane2, deltaSize) { 37214 if(pane1.isSizePx || pane2.isSizePx) { 37215 var parent = pane1.parent; 37216 if(pane1.isSizePx && !pane1.IsAutoSize(parent.isVertical)) 37217 pane1.size += deltaSize; 37218 if(pane2.isSizePx && !pane2.IsAutoSize(parent.isVertical)) 37219 pane2.size -= deltaSize; 37220 } 37221 else { 37222 var c = (pane1.size + pane2.size) / (pane1.GetOffsetSize() + pane2.GetOffsetSize()); 37223 pane1.size = c * (pane1.GetOffsetSize() + deltaSize); 37224 pane2.size = c * (pane2.GetOffsetSize() - deltaSize); 37225 } 37226}; 37227SplitterHelper.IsAllowResize = function (pane1, pane2) { 37228 if(!pane1 || !pane2) 37229 return false; 37230 if(!pane1.splitter.enabled) 37231 return false; 37232 var bothAutoSizeOrPercent = pane1.isVertical 37233 ? pane1.autoHeight && pane2.autoHeight || pane1.autoHeight && !pane2.isSizePx || !pane1.isSizePx && pane2.autoHeight 37234 : pane1.autoWidth && pane2.autoWidth || pane1.autoWidth && !pane2.isSizePx || !pane1.isSizePx && pane2.autoWidth; 37235 if(bothAutoSizeOrPercent) 37236 return false; 37237 return pane1.splitter.allowResize && pane1.allowResize && pane2.allowResize; 37238}; 37239var ASPxSplitterPaneHelper = ASPx.CreateClass(null, { 37240 constructor: function(pane) { 37241 this.pane = pane; 37242 this.indexPath = this.GetIndexPath(); 37243 var paneIdPostfix = this.pane.isRootPane ? "" : "_" + this.indexPath; 37244 var separatorIdPostfix = paneIdPostfix + "_S"; 37245 this.postfixes = { 37246 pane: paneIdPostfix, 37247 separator: separatorIdPostfix, 37248 table: paneIdPostfix + "_T", 37249 contentContainer: paneIdPostfix + "_CC", 37250 collapseForwardButton: separatorIdPostfix + "_CF", 37251 collapseBackwardButton: separatorIdPostfix + "_CB", 37252 collapseButtonsSeparator: separatorIdPostfix + "_CS" 37253 }; 37254 this.buttonsTableExists = !!this.GetCollapseBackwardButton(); 37255 this.separatorImageExists = !!this.GetCollapseButtonsSeparatorImage(); 37256 this.buttonsExists = this.buttonsTableExists || this.separatorImageExists; 37257 }, 37258 GetCachedValue: function (name, func) { 37259 return ASPx.CacheHelper.GetCachedValue(this, name, func); 37260 }, 37261 DropCachedValue: function (name) { 37262 ASPx.CacheHelper.DropCachedValue(this, name); 37263 }, 37264 DropCache: function() { 37265 ASPx.CacheHelper.DropCache(this); 37266 }, 37267 GetIndexPath: function () { 37268 if(this.pane.isRootPane) 37269 return ""; 37270 var parentPane = this.pane.parent; 37271 if(parentPane.isRootPane) 37272 return "" + this.pane.index; 37273 return parentPane.helper.indexPath + ASPx.ItemIndexSeparator + this.pane.index; 37274 }, 37275 GetChildElement: function (idPostfix) { 37276 return this.pane.splitter.GetChildElement(idPostfix); 37277 }, 37278 GetPaneElement: function () { 37279 return this.GetChildElement(this.postfixes.pane); 37280 }, 37281 GetTableElement: function () { 37282 return this.GetChildElement(this.postfixes.table); 37283 }, 37284 GetContentContainerElement: function () { 37285 return this.GetCachedValue(this.postfixes.contentContainer, 37286 function () { return ASPx.GetElementById(this.pane.splitter.name + this.postfixes.contentContainer); }); 37287 }, 37288 DropContentContainerElementFromCache: function () { 37289 this.DropCachedValue(this.postfixes.contentContainer); 37290 }, 37291 GetSeparatorElementId: function () { 37292 return this.pane.splitter.name + this.postfixes.separator; 37293 }, 37294 GetSeparatorElement: function () { 37295 return this.GetChildElement(this.postfixes.separator); 37296 }, 37297 GetSeparatorDivElement: function () { 37298 return this.GetCachedValue("separatorDivElement", function () { 37299 var separatorElement = this.GetSeparatorElement(); 37300 return separatorElement ? separatorElement.childNodes[0] : null; 37301 }); 37302 }, 37303 GetCollapseBackwardButton: function () { 37304 return this.GetChildElement(this.postfixes.collapseBackwardButton); 37305 }, 37306 GetCollapseForwardButton: function () { 37307 return this.GetChildElement(this.postfixes.collapseForwardButton); 37308 }, 37309 GetCollapseButtonsSeparator: function () { 37310 return this.GetChildElement(this.postfixes.collapseButtonsSeparator); 37311 }, 37312 GetCollapseButtonsTable: function () { 37313 return this.GetCachedValue("collapseButtonsTable", function () { 37314 return this.buttonsTableExists ? ASPx.GetParentByTagName(this.GetCollapseForwardButton(), "TABLE") : null; 37315 }); 37316 }, 37317 GetCollapseButtonsSeparatorImage: function () { 37318 return this.GetCachedValue("collapseButtonsSeparatorImage", function () { 37319 var separator = this.GetCollapseButtonsSeparator(); 37320 if(!separator) { 37321 if(!this.buttonsTableExists) 37322 separator = this.GetSeparatorElement(); 37323 else 37324 return null; 37325 } 37326 return ASPx.GetNodeByTagName(separator, "IMG", 0); 37327 }); 37328 }, 37329 GetButtonUpdateElement: function (buttonElement) { 37330 return !this.pane.isVertical ? buttonElement.parentNode : buttonElement; 37331 }, 37332 ClearElementSizeProperty: function (property) { 37333 var element = this.GetPaneElement(), 37334 isVertical = property === "width"; 37335 this.pane.savedSizeProperty = element.style[property]; 37336 element.style[property] = ""; 37337 if(!this.pane.IsAutoSize(isVertical)) { 37338 var contentContainerElement = this.GetContentContainerElement(); 37339 this.pane.savedContentSizeProperty = contentContainerElement.style[property]; 37340 contentContainerElement.style[property] = (this.pane.GetMinSize() - (isVertical ? this.pane.contentContainerWidthDiff : this.pane.contentContainerHeightDiff)) + "px"; 37341 } 37342 }, 37343 RestoreElementSizeProperty: function (property) { 37344 if(this.pane.savedSizeProperty) { 37345 this.GetPaneElement().style[property] = this.pane.savedSizeProperty; 37346 this.pane.savedSizeProperty = null; 37347 } 37348 if(!this.pane.IsAutoSize(property === "width")) { 37349 this.GetContentContainerElement().style[property] = this.pane.savedContentSizeProperty; 37350 this.pane.savedContentSizeProperty = null; 37351 } 37352 }, 37353 SetEmptyDivVisible: function (visible) { 37354 var emptyDiv = this.GetCachedValue("emptyDiv", function () { 37355 var emptyDiv = document.createElement("DIV"); 37356 emptyDiv.style.cssText = "overflow: hidden; width: 0px; height: 0px"; 37357 emptyDiv.isVisible = false; 37358 return emptyDiv; 37359 }); 37360 if(visible != emptyDiv.isVisible) { 37361 if(visible) 37362 this.GetPaneElement().appendChild(emptyDiv); 37363 else 37364 this.GetPaneElement().removeChild(emptyDiv); 37365 emptyDiv.isVisible = visible; 37366 } 37367 }, 37368 HasCollapsedParent: function () { 37369 var parent = this.pane.parent; 37370 if(parent) 37371 return parent.collapsed || parent.helper.HasCollapsedParent(); 37372 return false; 37373 }, 37374 HasVisibleAutoSizeChildren: function (isVertical) { 37375 var result = false; 37376 if(!ASPx.IsExists(isVertical)) 37377 isVertical = this.pane.isVertical; 37378 for(var i = 0; i < this.pane.panes.length; i++) { 37379 var pane = this.pane.panes[i]; 37380 result = result || !pane.collapsed && pane.IsAutoSize(isVertical) && (!pane.panes.length || pane.helper.HasVisibleAutoSizeChildren(isVertical)); 37381 } 37382 return result; 37383 }, 37384 OnDispose: function() { 37385 this.pane = null; 37386 this.DropCache(); 37387 } 37388}); 37389var ASPxSplitterResizingPointer = ASPx.CreateClass(null, { 37390 constructor: function (elementId) { 37391 this.elementId = elementId; 37392 this.element = ASPx.GetElementById(this.elementId); 37393 this.x = 0; 37394 this.y = 0; 37395 }, 37396 SetCursor: function (cursor) {
37397 this.element.style.cursor = cursor; 37398 }, 37399 SetPosition: function (x, y) { 37400 this.x = x; 37401 this.y = y; 37402 ASPx.SetAbsoluteY(this.element, this.y); 37403 ASPx.SetAbsoluteX(this.element, this.x); 37404 }, 37405 SetVisibility: function (isVisible) { 37406 ASPx.SetElementDisplay(this.element, isVisible); 37407 }, 37408 Move: function (delta, isX) { 37409 if(isX) 37410 this.x += delta; 37411 else 37412 this.y += delta; 37413 this.SetPosition(this.x, this.y); 37414 }, 37415 AttachToElement: function (element, isShow) { 37416 ASPx.SetStyles(this.element, { 37417 width: element.offsetWidth, height: element.offsetHeight 37418 }); 37419 this.SetVisibility(true); 37420 this.SetPosition(ASPx.GetAbsoluteX(element), ASPx.GetAbsoluteY(element)); 37421 } 37422}); 37423var ASPxClientSplitter = ASPx.CreateClass(ASPxClientControl, { 37424 constructor: function (name) { 37425 this.constructor.prototype.constructor.call(this, name); 37426 this.leadingAfterInitCall = ASPxClientControl.LeadingAfterInitCallConsts.Reverse; 37427 this.emptyUrls = [ 37428 "javascript:false", 37429 "about:blank", 37430 "#" 37431 ]; 37432 this.width = "100%"; 37433 this.height = "200px"; 37434 this.helper = new SplitterHelper(this); 37435 this.resizingPointer = new ASPxSplitterResizingPointer(this.name + "_RP"); 37436 this.rootPane = new ASPxClientSplitterPane(this, null, 0, 0, {}); 37437 this.liveResizing = false; 37438 this.allowResize = true; 37439 this.defaultMinSize = 5; 37440 this.showSeparatorImage = true; 37441 this.showCollapseBackwardButton = false; 37442 this.showCollapseForwardButton = false; 37443 this.fullScreen = false; 37444 this.prepared = false; 37445 this.PaneResizing = new ASPxClientEvent(); 37446 this.PaneResized = new ASPxClientEvent(); 37447 this.PaneCollapsing = new ASPxClientEvent(); 37448 this.PaneCollapsed = new ASPxClientEvent(); 37449 this.PaneExpanding = new ASPxClientEvent(); 37450 this.PaneExpanded = new ASPxClientEvent(); 37451 this.PaneResizeCompleted = new ASPxClientEvent(); 37452 this.PaneContentUrlLoaded = new ASPxClientEvent(); 37453 this.autoHeightPanes = []; 37454 this.autoWidthPanes = []; 37455 this.documentScrollTop = 0; 37456 this.documentScrollLeft = 0; 37457 this.inFullscreen = false; 37458 }, 37459 SetData: function(data){
37460 if(data.isVertical) 37461 this.rootPane.isVertical = data.isVertical; 37462 if(data.panes) 37463 this.CreatePanes(data.panes); 37464 }, 37465 CreatePanes: function (panesInfo) { 37466 this.CreatePanesInternal(this.rootPane, panesInfo); 37467 this.rootPane.ForEach("UpdateSize"); 37468 this.rootPane.ForEach("UpdateAutoSize"); 37469 this.state = this.GetStateObj(panesInfo); 37470 }, 37471 CreatePanesInternal: function (parent, panesInfo) { 37472 var prevPane = null, 37473 visibleIndex = 0; 37474 for(var i = 0; i < panesInfo.length; i++) { 37475 var paneInfo = panesInfo[i]; 37476 if(!paneInfo.v) continue; 37477 var pane = new ASPxClientSplitterPane(this, parent, visibleIndex++, i, paneInfo); 37478 updatePrevNext(pane); 37479 updateAutoSize(parent, pane.autoWidth, pane.autoHeight); 37480 parent.panes.push(pane); 37481 if(ASPx.IsExists(paneInfo["i"])) 37482 this.CreatePanesInternal(pane, paneInfo["i"]); 37483 } 37484 function updatePrevNext(pane) { 37485 pane.prevPane = prevPane; 37486 if(prevPane != null) 37487 prevPane.nextPane = pane; 37488 prevPane = pane; 37489 } 37490 function updateAutoSize(pane, autoWidth, autoHeight) { 37491 if(pane && (autoWidth || autoHeight)) { 37492 if(autoWidth) 37493 pane.autoWidth = true; 37494 if(autoHeight) 37495 pane.autoHeight = true; 37496 if(!pane.splitter.hasAutoSizePane) 37497 pane.splitter.hasAutoSizePane = true; 37498 updateAutoSize(pane.parent, autoWidth, autoHeight); 37499 } 37500 } 37501 }, 37502 GetStateObj: function (panesInfo) { 37503 var result = []; 37504 for(var i = 0; i < panesInfo.length; i++) { 37505 var paneState = {}; 37506 if(panesInfo[i].st) { 37507 paneState.st = panesInfo[i].st; 37508 paneState.s = panesInfo[i].s; 37509 } 37510 if(panesInfo[i].c) 37511 paneState.c = panesInfo[i].c; 37512 if(panesInfo[i]["i"]) 37513 paneState["i"] = this.GetStateObj(panesInfo[i]["i"]); 37514 result.push(paneState); 37515 } 37516 return result; 37517 }, 37518 GetClientStateString: function () { 37519 return ASPx.Json.ToJson(this.GetClientStateObject()); 37520 }, 37521 GetClientStateObject: function () { 37522 return this.RefreshState(this.state, this.rootPane.panes); 37523 }, 37524 RefreshState: function (state, panes) { 37525 for(var i = 0; i < panes.length; i++) { 37526 var pane = panes[i]; 37527 var paneState = state[pane._index]; 37528 paneState.s = Math.round(pane.size * 1000) / 1000; 37529 paneState.st = pane.sizeType; 37530 paneState.c = pane.collapsed ? 1 : 0; 37531 paneState.mp = !!pane.maximizedPane ? pane.maximizedPane.index : -1; 37532 if(pane.panes.length == 0) { 37533 paneState.spt = Math.round(pane.scrollTop); 37534 paneState.spl = Math.round(pane.scrollLeft); 37535 } 37536 if(pane.panes.length > 0) 37537 this.RefreshState(paneState["i"], pane.panes); 37538 } 37539 return state; 37540 }, 37541 InlineInitialize: function () { 37542 this.EnsureFullscreenMode(); 37543 this.rootPane.ForEach("Initialize"); 37544 ASPxClientControl.prototype.InlineInitialize.call(this); 37545 }, 37546 EnsureFullscreenMode: function () { 37547 if(this.fullScreen) { 37548 var overflowProperty = "overflow", 37549 autoWidth = this.rootPane.autoWidth, 37550 autoHeight = this.rootPane.autoHeight; 37551 if(autoWidth && autoHeight) 37552 overflowProperty = null; 37553 else if(autoWidth) 37554 overflowProperty = "overflowY"; 37555 else if(autoHeight) 37556 overflowProperty = "overflowX"; 37557 var element = this.GetMainElement().parentNode; 37558 while(element && element.tagName) { 37559 var tagName = element.tagName.toLowerCase(); 37560 if(tagName != "tbody") { 37561 element.style.height = "100%"; 37562 if(tagName == "form" || tagName == "body" || tagName == "html") { 37563 element.style.margin = "0px"; 37564 element.style.padding = "0px"; 37565 if(overflowProperty) 37566 element.style[overflowProperty] = "hidden"; 37567 if(autoHeight != autoWidth && (tagName == "body" || tagName == "html")) 37568 element.style.overflow = "hidden"; 37569 } 37570 if(tagName == "html") 37571 break; 37572 } 37573 element = element.parentNode; 37574 } 37575 } 37576 }, 37577 Initialize: function () { 37578 ASPxClientControl.prototype.Initialize.call(this); 37579 this.rootPane.ForEach("CreateContentUrlIFrame", true); 37580 if(ASPx.Browser.TouchUI) 37581 this.UpdateAutoSizePanes(); 37582 }, 37583 AfterInitialize: function () { 37584 ASPxClientControl.prototype.AfterInitialize.call(this); 37585 this.SubscribeBrowserFullScreenChangeEvent(); 37586 this.rootPane.ForEach("RaiseResizedEvent", true); 37587 }, 37588 OnWebkitFullScreenChange: function(e) { 37589 this.inFullscreen = true; 37590 this.rootPane.ForEach('SetVisibleOverflow'); 37591 }, 37592 SubscribeBrowserFullScreenChangeEvent: function() { 37593 if(ASPx.Browser.Chrome) { 37594 this.webKitFullScreenChangeHandler = this.OnWebkitFullScreenChange.bind(this); 37595 ASPx.Evt.AttachEventToDocument('webkitfullscreenchange', this.webKitFullScreenChangeHandler); 37596 } 37597 }, 37598 UnsubscribeFromBrowserFullScreenChangeEvent: function() { 37599 if(this.webKitFullScreenChangeHandler) 37600 ASPx.Evt.DetachEventFromDocument('webkitfullscreenchange', this.webKitFullScreenChangeHandler); 37601 }, 37602 IsPrepared: function () { 37603 return this.prepared; 37604 }, 37605 Prepare: function () { 37606 if(this.IsPrepared() || !this.IsDisplayed()) 37607 return; 37608 this.rootPane.ForEach("Prepare", true); 37609 ASPxClientSplitter.Instances.Add(this); 37610 this.prepared = true; 37611 }, 37612 UpdateAdjustmentFlags: function () { 37613 var mainElement = this.GetMainElement(); 37614 if(mainElement) { 37615 var mainElementStyle = ASPx.GetCurrentStyle(mainElement); 37616 this.UpdatePercentSizeConfig([mainElementStyle.width, this.width], [mainElementStyle.height, this.height]); 37617 } 37618 }, 37619 AdjustControlCore: function () { 37620 this.Prepare();
37621 this.UpdateControlSizes(false, this.isInsideHierarchyAdjustment); 37622 }, 37623 NeedCollapseControlCore: function () { 37624 return true; 37625 }, 37626 NeedUpdateControlSizes: function () { 37627 return ASPx.IsPercentageSize(this.width) || ASPx.IsPercentageSize(this.height) || !this.sizeUpdatedOnce; 37628 }, 37629 UpdateControlSizes: function (forceUpdate, disableControlsAdjustment) { 37630 if(!(forceUpdate || this.NeedUpdateControlSizes()) || !this.IsDisplayed()) 37631 return; 37632 var element = this.GetMainElement(); 37633 element.style.width = this.width; 37634 element.style.height = this.height; 37635 var focusedElement = ASPx.GetFocusedElement(); 37636 var isFocusedElementVisible = ASPx.IsElementVisible(focusedElement, true); 37637 var savedSelectionStart = null, 37638 savedSelectionEnd = null, 37639 editor = null; 37640 var innerEditorIsFocused = false; 37641 if(window.ASPxClientEdit && !!focusedElement && isFocusedElementVisible) { 37642 editor = ASPx.GetFocusedEditor(); 37643 if(!!editor) { 37644 innerEditorIsFocused = true; 37645 editor.BeginFocusUpdate(); 37646 savedSelectionStart = focusedElement.selectionStart;
37647 savedSelectionEnd = focusedElement.selectionEnd; 37648 } 37649 } 37650 this.saveDocumentScrollPositon(); 37651 this.UpdatePanesVisible(ASPx.Attr.ChangeStyleAttribute); 37652 if(ASPx.Browser.WebKitFamily) 37653 this.CreateWebkitSpecialElement(); 37654 var newWidth = ASPx.GetClearClientWidth(element); 37655 var newHeight = ASPx.GetClearClientHeight(element); 37656 this.UpdatePanesVisible(ASPx.Attr.RestoreStyleAttribute); 37657 this.restoreDocumentScrollPoisiton(); 37658 this.rootPane.offsetWidth = Math.max(newWidth, this.defaultMinSize); 37659 this.rootPane.offsetHeight = Math.max(newHeight, this.defaultMinSize); 37660 this.rootPane.UpdatePanes(true); 37661 try { 37662 if(focusedElement && 37663 isFocusedElementVisible && 37664 !ASPx.Browser.AndroidMobilePlatform && 37665 !(ASPx.Browser.MacOSMobilePlatform && ASPx.Browser.Version >= 6) && 37666 ASPx.GetIsParent(element, focusedElement) && 37667 !(focusedElement.tagName && focusedElement.tagName == "IFRAME")) { 37668 focusedElement.blur(); 37669 focusedElement.focus(); 37670 if(innerEditorIsFocused) { 37671 focusedElement.selectionStart = savedSelectionStart; 37672 focusedElement.selectionEnd = savedSelectionEnd; 37673 } 37674 } 37675 } 37676 catch (e) { } 37677 this.rootPane.ForEach("ApplyScrollPosition", true); 37678 if(this.isInitialized && !disableControlsAdjustment) 37679 this.rootPane.ForEach("AdjustControls", true); 37680 if(innerEditorIsFocused) 37681 window.setTimeout(editor.EndFocusUpdate.bind(editor), 0); 37682 if(this.IsPrepared()) 37683 this.sizeUpdatedOnce = true; 37684 this.UpdateCookie(); 37685 }, 37686 saveDocumentScrollPositon: function() { 37687 if(this.isInitialized) { 37688 this.documentScrollTop = ASPx.GetDocumentScrollTop(); 37689 this.documentScrollLeft = ASPx.GetDocumentScrollLeft(); 37690 } 37691 }, 37692 restoreDocumentScrollPoisiton: function() { 37693 if(this.documentScrollTop > 0 && ASPx.GetDocumentScrollTop() !== this.documentScrollTop) 37694 ASPx.SetDocumentScrollTop(this.documentScrollTop); 37695 if(this.documentScrollLeft > 0 && ASPx.GetDocumentScrollLeft() !== this.documentScrollLeft) 37696 ASPx.SetDocumentScrollLeft(this.documentScrollLeft); 37697 this.documentScrollTop = 0; 37698 this.documentScrollLeft = 0; 37699 }, 37700 UpdateAutoSizePanes: function (forced) { 37701 if(this.hasAutoSizePane) { 37702 var heightChanged = this.UpdateAutoHeightPanes(forced), 37703 widthChanged = this.UpdateAutoWidthPanes(forced); 37704 if(forced || heightChanged || widthChanged) 37705 this.rootPane.ForEach("UpdateChildrenSize"); 37706 } 37707 }, 37708 UpdateAutoHeightPanes: function (forced) { 37709 var changed = false; 37710 for(var i = 0; i < this.autoHeightPanes.length; i++) 37711 changed = this.autoHeightPanes[i].IsContentHeightChanged() || changed; 37712 if(forced || changed) 37713 this.UpdateAutoSizePanesSizes(false); 37714 return changed; 37715 }, 37716 UpdateAutoWidthPanes: function (forced) { 37717 var changed = false; 37718 for(var i = 0; i < this.autoWidthPanes.length; i++) 37719 changed = this.autoWidthPanes[i].IsContentWidthChanged() || changed; 37720 if(forced || changed) 37721 this.UpdateAutoSizePanesSizes(true); 37722 return changed; 37723 }, 37724 UpdateAutoSizePanesSizes: function (isVertical) { 37725 var autoSizePanes = isVertical 37726 ? this.autoWidthPanes 37727 : this.autoHeightPanes, 37728 property = isVertical ? "width" : "height", 37729 percentPanes = []; 37730 for(var i = 0; i < autoSizePanes.length; i++) { 37731 var pane = autoSizePanes[i]; 37732 if(!pane.helper.HasCollapsedParent()) { 37733 pane.helper.ClearElementSizeProperty(property); 37734 for(var child = pane.panes[0]; child; child = child.nextPane) 37735 if(!child.isSizePx) { 37736 percentPanes.push(child); 37737 child.helper.ClearElementSizeProperty(property); 37738 } 37739 } 37740 } 37741 for(var i = 0; i < autoSizePanes.length; i++) 37742 autoSizePanes[i].UpdateOffsetSize(isVertical); 37743 for(var i = 0; i < autoSizePanes.length; i++) { 37744 var pane = autoSizePanes[i]; 37745 if(!pane.helper.HasCollapsedParent()) 37746 pane.helper.RestoreElementSizeProperty(property); 37747 } 37748 for(var i = 0; i < percentPanes.length; i++) 37749 percentPanes[i].helper.RestoreElementSizeProperty(property); 37750 }, 37751 UpdatePanesVisible: function (func) { 37752 var firstTD = this.rootPane.panes[0].helper.GetPaneElement(); 37753 func(firstTD, "width", "1px"); 37754 func(firstTD, "height", "1px"); 37755 func(this.rootPane.panes[0].helper.GetContentContainerElement(), "display", "none"); 37756 for(var i = 1; i < this.rootPane.panes.length; i++) { 37757 var pane = this.rootPane.panes[i]; 37758 func(pane.helper.GetPaneElement(), "display", "none"); 37759 var separator = pane.helper.GetSeparatorElement(); 37760 if(separator) 37761 func(separator, "display", "none"); 37762 } 37763 },
37764 UpdateCookie: function () { 37765 if(this.cookieName && this.cookieName != "") { 37766 ASPx.Cookie.DelCookie(this.cookieName); 37767 ASPx.Cookie.SetCookie(this.cookieName, this.GetClientStateString()); 37768 } 37769 }, 37770 UpdateStateObject: function(){ 37771 this.UpdateStateObjectWithObject({ state: this.GetClientStateObject() }); 37772 }, 37773 GetPaneByPath: function (panePath, parentPane) { 37774 var pane = parentPane || this.rootPane; 37775 for(var i = 0; i < panePath.length; i++) 37776 pane = pane.panes[panePath[i]]; 37777 return pane; 37778 }, 37779 GetPaneByStringPath: function (paneStringPath, paneIndexSeparator) { 37780 if(!paneIndexSeparator) 37781 paneIndexSeparator = ASPx.ItemIndexSeparator; 37782 return this.GetPaneByPath(paneStringPath.split(paneIndexSeparator)); 37783 }, 37784 IsDocumentWidthChanged: function () { 37785 var documentWidth = this.GetDocumentWidth(); 37786 if(!ASPx.IsExists(this.lastDocumentWidth) || documentWidth != this.lastDocumentWidth) { 37787 this.lastDocumentWidth = documentWidth; 37788 return true; 37789 } 37790 return false; 37791 }, 37792 GetDocumentWidth: function () { 37793 if(this.fullScreen && (this.rootPane.autoHeight || this.rootPane.autoWidth)) 37794 return this.GetDocumentWidthFullscreen(); 37795 return ASPx.GetDocumentWidth(); 37796 }, 37797 GetDocumentWidthFullscreen: function () { 37798 var sizeElement = ASPx.CacheHelper.GetCachedValue(this, "fullscreenWidthElement", function () { 37799 var element = ASPx.CreateHtmlElementFromString("<div style='width: 100%; height: 0px'></div>"); 37800 this.GetMainElement().parentNode.insertBefore(element, this.GetMainElement()); 37801 return element; 37802 }); 37803 return sizeElement.offsetWidth; 37804 }, 37805 CreateWebkitSpecialElement: function () { 37806 var webkitSpecialElement = document.createElement("DIV"), 37807 element = this.GetMainElement(); 37808 element.parentNode.appendChild(webkitSpecialElement); 37809 var dummy = element.offsetHeight; 37810 element.parentNode.removeChild(webkitSpecialElement); 37811 }, 37812 OnBrowserWindowResize: function() { 37813 if(this.inFullscreen) 37814 window.setTimeout(function() { 37815 this.inFullscreen = false; 37816 this.rootPane.ForEach('ResetOverflow'); 37817 }.aspxBind(this), 0); 37818 this.UpdateControlSizes(false, true); 37819 this.lastDocumentWidth = this.GetDocumentWidth(); 37820 }, 37821 BrowserWindowResizeSubscriber: function() { 37822 return this.widthValueSetInPercentage; 37823 }, 37824 OnSeparatorMouseDown: function (moveRightPanePath) { 37825 var pane = this.GetPaneByStringPath(moveRightPanePath); 37826 var invert = this.rtl && !pane.isVertical; 37827 this.moveRightPane = invert ? pane.prevPane : pane; 37828 this.moveLeftPane = invert ? pane : pane.prevPane; 37829 this.moveIsVertical = pane.isVertical; 37830 this.moveStartPos = this.helper.GetCurrentPos(); 37831 this.moveLastPos = this.moveStartPos; 37832 this.isHeavyUpdate = this.moveLeftPane.isSizePx != this.moveRightPane.isSizePx 37833 && !this.moveLeftPane.parent.IsAutoSize(); 37834 if(!SplitterHelper.IsAllowResize(this.moveLeftPane, this.moveRightPane)) 37835 return false; 37836 if(this.moveLeftPane.collapsed || this.moveRightPane.collapsed) 37837 return false; 37838 if(this.RaiseCancelEvent("PaneResizing", this.moveRightPane) || this.RaiseCancelEvent("PaneResizing", this.moveLeftPane)) 37839 return false; 37840 var cursor = this.moveIsVertical ? "n-resize" : "w-resize"; 37841 if(!this.liveResizing) { 37842 this.resizingPointer.SetCursor(cursor); 37843 this.resizingPointer.AttachToElement(pane.helper.GetSeparatorElement(), true); 37844 } 37845 else 37846 this.isInLiveResizing = true; 37847 this.setIframesMouseMoveEnabled(this.moveRightPane, false); 37848 this.setIframesMouseMoveEnabled(this.moveLeftPane, false); 37849 this.helper.SetResizingPanelVisibility(true, cursor); 37850 return true; 37851 }, 37852 OnSeparatorMouseUp: function () { 37853 this.helper.SetResizingPanelVisibility(false); 37854 if(!this.liveResizing || !this.isHeavyUpdate) { 37855 var deltaSize = this.moveLastPos - this.moveStartPos; 37856 if(!this.moveLeftPane.IsAutoSize(!this.moveLeftPane.isVertical)) { 37857 this.moveLeftPane.SetOffsetSize(this.moveLeftPane.GetOffsetSize() - deltaSize); 37858 this.moveLeftPane.inResizing = true; 37859 } 37860 if(!this.moveRightPane.IsAutoSize(!this.moveRightPane.isVertical)) { 37861 this.moveRightPane.SetOffsetSize(this.moveRightPane.GetOffsetSize() + deltaSize); 37862 this.moveRightPane.inResizing = true; 37863 } 37864 if(!this.liveResizing || !this.hasAutoSizePane) 37865 SplitterHelper.Resize(this.moveLeftPane, this.moveRightPane, deltaSize); 37866 this.moveLeftPane.parent.ForEach("UpdateChildrenSize"); 37867 } 37868 if(!this.liveResizing) 37869 this.resizingPointer.SetVisibility(false); 37870 else 37871 this.isInLiveResizing = null; 37872 this.UpdateAutoSizePanes(true); 37873 this.moveLeftPane.parent.ForEach("AdjustControls"); 37874 if(!this.liveResizing && (this.rootPane.autoHeight || this.rootPane.autoWidth) && this.IsDocumentWidthChanged())
37875 this.UpdateControlSizes(); 37876 this.moveLeftPane.inResizing = null; 37877 this.moveRightPane.inResizing = null; 37878 this.UpdateCookie(); 37879 this.setIframesMouseMoveEnabled(this.moveRightPane, true); 37880 this.setIframesMouseMoveEnabled(this.moveLeftPane, true); 37881 this.RaiseEvent("PaneResizeCompleted", this.moveLeftPane); 37882 this.RaiseEvent("PaneResizeCompleted", this.moveRightPane); 37883 }, 37884 OnMouseMove: function () { 37885 var deltaSize = this.helper.GetMoveMaxDeltaSize(this.helper.GetCurrentPos() - this.moveLastPos); 37886 if(deltaSize == 0) return; 37887 if(!this.moveLeftPane.IsAutoSize(!this.moveLeftPane.isVertical) || this.liveResizing) 37888 this.moveLeftPane.SetOffsetSize(this.moveLeftPane.GetOffsetSize() + deltaSize); 37889 if(!this.moveRightPane.IsAutoSize(!this.moveRightPane.isVertical) || this.liveResizing) 37890 this.moveRightPane.SetOffsetSize(this.moveRightPane.GetOffsetSize() - deltaSize); 37891 if(this.liveResizing) { 37892 var changePaneSize = function (pane, deltaSize) { 37893 pane.SetContentVisible(false); 37894 if(pane.ApplyElementSize()) { 37895 pane.ForEach("UpdateChildrenSize"); 37896 pane.SetContentVisible(true); 37897 pane.RaiseResizedEvent(); 37898 } 37899 }; 37900 if(this.isHeavyUpdate || this.moveLeftPane.parent.autoHeight || this.moveLeftPane.parent.autoWidth) { 37901 SplitterHelper.Resize(this.moveLeftPane, this.moveRightPane, this.moveLeftPane.isSizePx || this.moveRightPane.isSizePx ? deltaSize : 0); 37902 this.moveLeftPane.parent.ForEach("UpdateChildrenSize"); 37903 } 37904 else { 37905 changePaneSize(this.moveLeftPane, deltaSize, this.helper); 37906 changePaneSize(this.moveRightPane, -deltaSize, this.helper); 37907 } 37908 this.UpdateAutoSizePanes(this.liveResizing); 37909 } 37910 else 37911 this.resizingPointer.Move(deltaSize, !this.moveIsVertical); 37912 this.moveLastPos += deltaSize; 37913 }, 37914 setIframesMouseMoveEnabled: function(pane, enabled) { 37915 if(pane) { 37916 var iframe = pane.GetContentIFrame(); 37917 if(iframe) 37918 iframe.style.pointerEvents = enabled ? "" : "none"; 37919 } 37920 }, 37921 CreateFakeDivForIframe: function(iframe) { 37922 var fakeDiv = document.createElement("div"); 37923 ASPx.SetStyles(fakeDiv, { width: iframe.offsetWidth, height: iframe.offsetHeight }); 37924 return fakeDiv; 37925 }, 37926 CreateIframeCoverDiv: function(iframe, index) { 37927 if(!this.iframeCoverDiv)
37928 this.iframeCoverDiv = []; 37929 if(!this.iframeCoverDiv[index]) 37930 this.iframeCoverDiv[index] = this.CreateFakeDivForIframe(iframe); 37931 this.iframeCoverDiv[index].style.position = "absolute"; 37932 this.iframeCoverDiv[index].className = "dxspl-cover"; 37933 iframe.parentElement.appendChild(this.iframeCoverDiv[index]); 37934 ASPx.SetAbsoluteX(this.iframeCoverDiv[index], ASPx.GetAbsoluteX(iframe)); 37935 ASPx.SetAbsoluteY(this.iframeCoverDiv[index], ASPx.GetAbsoluteY(iframe)); 37936 }, 37937 RemoveIframeCoverDiv: function(iframe, index) { 37938 iframe.parentElement.removeChild(this.iframeCoverDiv[index]); 37939 this.iframeCoverDiv[index] = null; 37940 }, 37941 OnCollapseButtonClick: function (panePath, forwardDirection) { 37942 var rightPane = this.GetPaneByStringPath(panePath); 37943 var pane1 = forwardDirection ? rightPane.prevPane : rightPane; 37944 var pane2 = forwardDirection ? rightPane : rightPane.prevPane; 37945 if(pane1.collapsed && pane1.maximizedPane == pane2) { 37946 if(!this.RaiseCancelEvent("PaneExpanding", pane1)) { 37947 pane1.Expand(); 37948 if(this.savedSize) { 37949 var rootPaneChildren = this.rootPane.panes; 37950 for(var i = 0; i < rootPaneChildren.length; i++) { 37951 if(rootPaneChildren[i].IsCollapsed()) 37952 return; 37953 } 37954 for(var sizeProperty in this.savedSize) 37955 if(this.savedSize.hasOwnProperty(sizeProperty)) 37956 this.GetMainElement().style[sizeProperty] = this.savedSize[sizeProperty]; 37957 this.savedSize = null; 37958 } 37959 } 37960 } 37961 else { 37962 if(!this.RaiseCancelEvent("PaneCollapsing", pane2)) { 37963 if(pane2.NeedResetSplitterSizeOnCollapsing(pane1)) { 37964 if(!this.savedSize) 37965 this.savedSize = {}; 37966 var sizeProperty = pane1.isVertical ? "height" : "width"; 37967 if(!this.savedSize[sizeProperty]) { 37968 this.savedSize[sizeProperty] = this.GetMainElement().style[sizeProperty]; 37969 this.GetMainElement().style[sizeProperty] = ""; 37970 } 37971 } 37972 pane2.Collapse(pane1); 37973 } 37974 } 37975 }, 37976 IsEmptyUrl: function (url) { 37977 for(var i = 0; i < this.emptyUrls.length; i++) 37978 if(url == this.emptyUrls[i]) 37979 return true; 37980 return false; 37981 }, 37982 RaiseEvent: function (eventName, pane) { 37983 if(this.isInitialized) 37984 this[eventName].FireEvent(this, new ASPxClientSplitterPaneEventArgs(pane)); 37985 }, 37986 RaiseCancelEvent: function (eventName, pane) { 37987 var args = new ASPxClientSplitterPaneCancelEventArgs(pane); 37988 this[eventName].FireEvent(this, args); 37989 return args.cancel; 37990 }, 37991 GetPaneCount: function () { 37992 return this.rootPane.GetPaneCount(); 37993 }, 37994 GetPane: function (index) { 37995 return this.rootPane.GetPane(index); 37996 }, 37997 GetPaneByName: function (name) { 37998 return this.rootPane.GetPaneByName(name); 37999 }, 38000 SetAllowResize: function (allowResize) { 38001 if(this.allowResize == allowResize) 38002 return; 38003 this.allowResize = allowResize; 38004 this.rootPane.ForEach("UpdateSeparatorStyle", true); 38005 }, 38006 GetLayoutData: function() { 38007 return this.GetClientStateString(); 38008 }, 38009 SetWidth: function (width) { 38010 this.width = width + "px"; 38011 if(this.IsPrepared()) 38012 this.UpdateControlSizes(true); 38013 }, 38014 SetHeight: function (height) { 38015 this.height = height + "px"; 38016 if(this.IsPrepared()) 38017 this.UpdateControlSizes(true); 38018 }, 38019 OnDispose: function() { 38020 this.RemoveGlobalLinksToObject(); 38021 this.rootPane.ForEach("OnDispose"); 38022 if(this.helper) 38023 this.helper.OnDispose(); 38024 ASPxClientControl.prototype.OnDispose.call(this); 38025 }, 38026 RemoveGlobalLinksToObject: function() { 38027 this.UnsubscribeFromBrowserFullScreenChangeEvent(); 38028 ASPxClientSplitter.Instances.Remove(this.name); 38029 if(ASPxClientSplitter.current === this) 38030 ASPxClientSplitter.current = null; 38031 } 38032}); 38033ASPxClientSplitter.Cast = ASPxClientControl.Cast; 38034var ASPxClientSplitterPane = ASPx.CreateClass(null, { 38035 constructor: function (splitter, parent, visibleIndex, index, paneInfo) { 38036 this.splitter = splitter; 38037 this.parent = parent; 38038 this.index = visibleIndex; 38039 this._index = index; 38040 this.name = paneInfo.n || ""; 38041 this.isRootPane = (this.parent == null); 38042 this.helper = new ASPxSplitterPaneHelper(this); 38043 this.prevPane = null; 38044 this.nextPane = null; 38045 this.panes = []; 38046 this.isVertical = this.isRootPane ? false : !parent.isVertical; 38047 this.hasSeparator = (this.index > 0); 38048 this.collapsed = ASPx.IsExists(paneInfo.c); 38049 this.size = ASPx.IsExists(paneInfo.s) ? paneInfo.s : 0; 38050 this.sizeType = ASPx.IsExists(paneInfo.st) ? paneInfo.st : null; 38051 this.autoWidth = ASPx.IsExists(paneInfo.aw); 38052 this.autoHeight = ASPx.IsExists(paneInfo.ah); 38053 this.maxSize = ASPx.IsExists(paneInfo.smax) ? paneInfo.smax : Number.MAX_VALUE; 38054 this.minSize = ASPx.IsExists(paneInfo.smin) ? paneInfo.smin : this.splitter.defaultMinSize; 38055 this.allowResize = !ASPx.IsExists(paneInfo.nar); 38056 this.showCollapseBackwardButton = ASPx.IsExists(paneInfo.scbb); 38057 this.showCollapseForwardButton = ASPx.IsExists(paneInfo.scfb); 38058 this.maximizedPaneIndex = ASPx.IsExists(paneInfo.mp) ? paneInfo.mp : -1; 38059 this.iframe = {}; 38060 if(paneInfo.iframe) { 38061 this.iframe = { 38062 src: paneInfo.iframe[0], 38063 scrolling: paneInfo.iframe[1] 38064 }; 38065 if(paneInfo.iframe[2] != "") 38066 this.iframe.name = paneInfo.iframe[2]; 38067 if(paneInfo.iframe[3] != "") 38068 this.iframe.title = paneInfo.iframe[3]; 38069 this.isContentUrl = true; 38070 } 38071 this.scrollTop = paneInfo.spt || 0; 38072 this.scrollLeft = paneInfo.spl || 0;
38073 this.isSizePx = (this.sizeType == "px"); 38074 this.maximizedPane = null; 38075 this.dragPrevented = false; 38076 this.offsetWidth = 0; 38077 this.offsetHeight = 0; 38078 this.widthDiff = 0; 38079 this.heightDiff = 0; 38080 this.contentContainerWidthDiff = 0; 38081 this.contentContainerHeightDiff = 0; 38082 this.collapsedWidthDiff = 0; 38083 this.collapsedHeightDiff = 0; 38084 this.isASPxClientSplitterPane = true; 38085 }, 38086 SetVisibleOverflow: function() { 38087 var element = this.helper.GetContentContainerElement(); 38088 if(element) 38089 element.style.overflow = 'visible'; 38090 }, 38091 ResetOverflow: function() { 38092 var element = this.helper.GetContentContainerElement(); 38093 if(element) 38094 element.style.overflow = ''; 38095 }, 38096 UpdateSize: function () { 38097 if(!this.panes.length) return; 38098 var prcSum = 0, 38099 emptyPanesCount = 0; 38100 for(var pane = this.panes[0]; pane; pane = pane.nextPane) { 38101 if(!pane.sizeType) 38102 emptyPanesCount++; 38103 else if(pane.sizeType == "%") 38104 prcSum += pane.size; 38105 } 38106 if(emptyPanesCount) { 38107 var emptyPaneSize = Math.max(100 - prcSum, 0) / emptyPanesCount; 38108 for(var pane = this.panes[0]; pane; pane = pane.nextPane) { 38109 if(!pane.sizeType) { 38110 pane.sizeType = "%"; 38111 pane.size = emptyPaneSize; 38112 } 38113 } 38114 } 38115 if(prcSum && (!emptyPanesCount && prcSum != 100 || prcSum > 100)) { 38116 for(var pane = this.panes[0]; pane; pane = pane.nextPane) { 38117 if(pane.sizeType == "%") 38118 pane.size = 100 * pane.size / prcSum; 38119 } 38120 } 38121 }, 38122 UpdateAutoSize: function () { 38123 if(this.panes.length) { 38124 var propertyAll = this.isVertical ? "autoHeight" : "autoWidth", 38125 propertyOne = this.isVertical ? "autoWidth" : "autoHeight"; 38126 if(this[propertyAll]) { 38127 for(var pane = this.panes[0]; pane; pane = pane.nextPane) { 38128 pane[propertyAll] = true; 38129 } 38130 } 38131 if(this[propertyOne]) { 38132 var selected; 38133 for(var pane = this.panes[0]; pane; pane = pane.nextPane) { 38134 if(pane[propertyOne] || !pane.isSizePx || pane.isSizePx && !selected && !pane.nextPane) 38135 selected = pane; 38136 if(pane[propertyOne]) 38137 break; 38138 } 38139 selected[propertyOne] = true; 38140 } 38141 for(var pane = this.panes[0]; pane; pane = pane.nextPane) { 38142 if(pane.isSizePx) 38143 continue; 38144 if(pane[propertyOne]) { 38145 pane.size = pane.GetMinSize(); 38146 pane.sizeType = "px"; 38147 pane.isSizePx = true; 38148 } 38149 } 38150 } 38151 if(!this.isRootPane) { 38152 if(this.autoHeight) 38153 this.splitter.autoHeightPanes.push(this); 38154 if(this.autoWidth) 38155 this.splitter.autoWidthPanes.push(this); 38156 } 38157 }, 38158 IsAutoSize: function (isVertical) { 38159 if(isVertical == null) 38160 isVertical = this.isVertical; 38161 return isVertical ? this.autoWidth : this.autoHeight; 38162 }, 38163 IsContentHeightChanged: function () { 38164 var contentHeight = this.helper.GetContentContainerElement().getBoundingClientRect().height; 38165 if(!ASPx.IsExists(this.lastContentHeight) || Math.abs(contentHeight - this.lastContentHeight) > 1) { 38166 this.lastContentHeight = contentHeight; 38167 return true; 38168 } 38169 return false; 38170 }, 38171 IsContentWidthChanged: function () { 38172 var contentWidth = this.helper.GetContentContainerElement().getBoundingClientRect().width; 38173 if(!ASPx.IsExists(this.lastContentWidth) || Math.abs(contentWidth - this.lastContentWidth) > 1) { 38174 this.lastContentWidth = contentWidth; 38175 return true; 38176 } 38177 return false; 38178 }, 38179 UpdateOffsetSize: function (isVertical) { 38180 var hasPanes = !!this.panes.length, 38181 contentContainerSizeDiff = hasPanes 38182 ? 0 38183 : isVertical 38184 ? this.widthDiff 38185 : this.heightDiff, 38186 contentSize = 0; 38187 if(this.isContentUrl && !hasPanes) { 38188 var element = this.helper.GetContentContainerElement(); 38189 element.style.display = "none"; 38190 } 38191 var contentSize = this.GetContentMinSize(isVertical); 38192 this.SetOffsetSize(Math.max(this.GetMinSize(!isVertical), contentSize), !isVertical); 38193 if(this.isContentUrl && !hasPanes) { 38194 var element = this.helper.GetContentContainerElement(); 38195 element.style[isVertical ? "width" : "height"] = this.isVertical || isVertical 38196 ? "100%" 38197 : this.helper.GetPaneElement().offsetHeight - contentContainerSizeDiff + "px"; 38198 element.style.display = ""; 38199 } 38200 }, 38201 GetContentMinSize: function (isVertical) { 38202 if(!this.panes.length) { 38203 var contentContainerElement = this.helper.GetContentContainerElement(), 38204 contentContainerSizeDiff = isVertical 38205 ? this.widthDiff 38206 : this.heightDiff; 38207 return (isVertical ? contentContainerElement.offsetWidth : contentContainerElement.offsetHeight) + contentContainerSizeDiff; 38208 } 38209 var contentSize = 0; 38210 if(this.isVertical != isVertical) 38211 for(var pane = this.panes[0]; pane; pane = pane.nextPane) 38212 contentSize = Math.max(contentSize, pane.GetContentMinSize(isVertical)); 38213 else { 38214 for(var pane = this.panes[0]; pane; pane = pane.nextPane) 38215 contentSize += pane.GetContentMinSize(isVertical); 38216 contentSize += this.GetTotalSeparatorsSize(!this.isVertical); 38217 } 38218 return contentSize; 38219 }, 38220 Initialize: function() { 38221 this.InitializePreventDragging(); 38222 if(this.isRootPane) 38223 return; 38224 if(this.collapsed) { 38225 if(this.maximizedPaneIndex !== -1) 38226 this.maximizedPane = this.GetParentPane().GetPane(this.maximizedPaneIndex); 38227 else if(this.IsFirstPane()) 38228 this.maximizedPane = this.GetNextPane(); 38229 else if(this.IsLastPane()) 38230 this.maximizedPane = this.GetPrevPane(); 38231 else if(this.prevPane.maximizedPane !== this) 38232 this.maximizedPane = this.prevPane; 38233 else 38234 this.maximizedPane = this.nextPane; 38235 if(this.maximizedPane == null) 38236 this.collapsed = false; 38237 } 38238 }, 38239 PrepareInternal: function(needToResetContentSize) { 38240 var EvaluateWidthDiff = function(element) { 38241 return element.getBoundingClientRect().width - element.clientWidth; 38242 }; 38243 var EvaluateHeightDiff = function(element) { 38244 var elementClientHeight = ((ASPx.Browser.Safari && (ASPx.Browser.Version < 4)) || (ASPx.Browser.Chrome && (A
38244SPx.Browser.Version < 2))) ? (element.offsetHeight - element.clientTop * 2) : element.clientHeight; 38245 return element.getBoundingClientRect().height - elementClientHeight; 38246 }; 38247 this.GetSeparatorSize(); 38248 var element = this.helper.GetPaneElement(); 38249 this.widthDiff = EvaluateWidthDiff(element); 38250 this.heightDiff = EvaluateHeightDiff(element); 38251 if(needToResetContentSize && this.panes.length == 0) { 38252 var contentContainerElement = this.helper.GetContentContainerElement(); 38253 ASPx.SetScrollBarVisibility(contentContainerElement, false); 38254 ASPx.SetStyles(contentContainerElement, { width: 1, height: 1 }); 38255 var overflow = contentContainerElement.style.overflowY; 38256 if(ASPx.Browser.Edge) 38257 contentContainerElement.style.overflowY = ''; 38258 this.contentContainerWidthDiff = contentContainerElement.offsetWidth - 1; 38259 this.contentContainerHeightDiff = contentContainerElement.offsetHeight - 1; 38260 if(ASPx.Browser.Edge) 38261 contentContainerElement.style.overflowY = overflow; 38262 if(this.autoWidth) { 38263 contentContainerElement.style.width = ""; 38264 var minWidthValue = this.splitter.defaultMinSize - this.contentContainerWidthDiff; 38265 if(minWidthValue > -1) 38266 contentContainerElement.style.minWidth = minWidthValue + "px"; 38267 } 38268 if(this.autoHeight) { 38269 contentContainerElement.style.height = ""; 38270 var minHeightValue = this.splitter.defaultMinSize - this.contentContainerWidthDiff; 38271 if(minHeightValue > -1) 38272 contentContainerElement.style.minHeight = minHeightValue + "px"; 38273 } 38274 ASPx.SetScrollBarVisibility(contentContainerElement, true); 38275 if(!this.scrollEventAttached) { 38276 var _this = this; 38277 ASPx.Evt.AttachEventToElement(contentContainerElement, "scroll", function () { 38278 if(!_this.splitter) return; 38279 if(contentContainerElement.scrollTop >= 0) 38280 _this.scrollTop = contentContainerElement.scrollTop; 38281 if(contentContainerElement.scrollLeft >= 0) 38282 _this.scrollLeft = contentContainerElement.scrollLeft; 38283 _this.splitter.UpdateCookie(); 38284 }); 38285 this.scrollEventAttached = true; 38286 } 38287 } 38288 this.UpdateStyle(element, true); 38289 this.collapsedWidthDiff = EvaluateWidthDiff(element); 38290 this.collapsedHeightDiff = EvaluateHeightDiff(element); 38291 this.UpdateStyle(element, false); 38292 var separator = this.helper.GetSeparatorElement(); 38293 if(separator) { 38294 ASPx.SetElementDisplay(this.helper.GetSeparatorDivElement(), false); 38295 if(!this.isVertical) 38296 this.separatorSizeDiff = separator.offsetWidth - separator.clientWidth; 38297 else 38298 this.separatorSizeDiff = separator.offsetHeight - separator.clientHeight; 38299 ASPx.SetElementDisplay(this.helper.GetSeparatorDivElement(), true); 38300 } 38301 else 38302 this.separatorSizeDiff = 0; 38303 this.PrepareSeparatorButtons(); 38304 if(ASPx.Browser.WebKitTouchUI) { 38305 var contentContainer = this.helper.GetContentContainerElement(); 38306 var scrollbarVisible = contentContainer.style.overflow == "auto" || contentContainer.style.overflow == "scroll"; 38307 var hScrollbarVisible = scrollbarVisible || contentContainer.style.overflowX == "scroll"; 38308 var vScrollbarVisible = scrollbarVisible || contentContainer.style.overflowY == "scroll"; 38309 if(hScrollbarVisible || vScrollbarVisible) { 38310 ASPx.TouchUIHelper.MakeScrollable(contentContainer, { showHorizontalScrollbar: hScrollbarVisible, showVerticalScrollbar: vScrollbarVisible }); 38311 } 38312 } 38313 if(needToResetContentSize && !this.isRootPane) { 38314 if(this.autoHeight) 38315 this.offsetHeight = this.GetMinSize(true); 38316 if(this.autoWidth) 38317 this.offsetWidth = this.GetMinSize(false); 38318 } 38319 }, 38320 Prepare: function() { 38321 this.PrepareInternal(true); 38322 }, 38323 PrepareSeparatorButtons: function () { 38324 if(!(this.hasSeparator && this.helper.buttonsExists)) 38325 return; 38326 var sizeProperty = this.isVertical ? "offsetWidth" : "offsetHeight"; 38327 if(this.helper.buttonsTableExists) { 38328 this.collapseBackwardButtonSize = this.helper.GetButtonUpdateElement(this.helper.GetCollapseBackwardButton())[sizeProperty]; 38329 this.collapseForwardButtonSize = this.helper.GetButtonUpdateElement(this.helper.GetCollapseForwardButton())[sizeProperty]; 38330 this.buttonsTableDiffSize = this.helper.GetCollapseButtonsTable()[sizeProperty] - this.collapseBackwardButtonSize - this.collapseForwardButtonSize; 38331 if(this.helper.separatorImageExists) { 38332 this.collapseButtonsSeparatorSize = this.helper.GetButtonUpdateElement(this.helper.GetCollapseButtonsSeparator())[sizeProperty]; 38333 this.buttonsTableDiffSize -= this.collapseButtonsSeparatorSize; 38334 } 38335 } 38336 else 38337 this.collapseButtonsSeparatorSize = this.helper.GetCollapseButtonsSeparatorImage()[sizeProperty]; 38338 }, 38339 InitializePreventDragging: function () { 38340 if(!this.dragPrevented && this.helper.separatorImageExists) { 38341 ASPx.Evt.PreventElementDrag(this.helper.GetCollapseButtonsSeparatorImage()); 38342 this.dragPrevented = true; 38343 } 38344 }, 38345 ApplyScrollPosition: function () { 38346 if(this.panes.length == 0) { 38347 this.SetScrollTop(this.scrollTop); 38348 this.SetScrollLeft(this.scrollLeft); 38349 } 38350 }, 38351 ForEach: function (funcName, skippSelf) { 38352 if(!skippSelf) 38353 this[funcName](); 38354 for(var i = 0; i < this.panes.length; i++) 38355 this.panes[i].ForEach(funcName); 38356 }, 38357 SetContentVisible: function (visible) { 38358 ASPx.SetElementDisplay(this.helper.GetContentContainerElement(), visible); 38359 }, 38360 AdjustControls: function () { 38361 if(this.panes.length == 0 && !this.collapsed && !this.isContentUrl) 38362 ASPx.GetControlCollection().AdjustControls(this.helper.GetContentContainerElement(), true); 38363 }, 38364 UpdatePanes: function (forceAutoSizeUpdate) { 38365 this.ForEach("UpdateVisualElements", true); 38366 this.ForEach("UpdateChildrenSize"); 38367 this.splitter.UpdateAutoSizePanes(forceAutoSizeUpdate); 38368 }, 38369 UpdateVisualElements: function () { 38370 this.UpdateButtonsVisibility(); 38371 this.UpdateSeparatorStyle(); 38372 this.UpdatePaneStyle(); 38373 }, 38374 IsBackwardButtonVisible: function () { 38375 return ASPx.CacheHelper.GetCachedValue(this, "isBackwardButtonVisible", function () { 38376 if(!this.helper.buttonsTableExists) 38377 return false; 38378 if(this.collapsed && (this.maximizedPane == this.prevPane)) 38379 return true; 38380 if(this.nextPane && this.collapsed && this.nextPane.collapsed) 38381 return true; 38382 if(this.prevPane.collapsed) 38383 return false; 38384 return this.showCollapseBackwardButton; 38385 }, this.helper); 38386 }, 38387 IsForwardButtonVisible: function () { 38388 return ASPx.CacheHelper.GetCachedValue(this, "isForwardButtonVisible", function () { 38389 if(!this.helper.buttonsTableExists) 38390 return false; 38391 if(this.prevPane.collapsed && (this.prevPane.maximizedPane == this)) 38392 return true; 38393 if(this.prevPane.collapsed && !this.collapsed) 38394 return true; 38395 if(this.collapsed) 38396 return false; 38397 return this.showCollapseForwardButton; 38398 }, this.helper); 38399 }, 38400 DropCachedButtonsVisible: function () { 38401 ASPx.CacheHelper.DropCachedValue(this.helper, "isBackwardButtonVisible"); 38402 ASPx.CacheHelper.DropCachedValue(this.helper, "isForwardButtonVisible"); 38403 }, 38404 UpdateSeparatorStyle: function () { 38405 var separator = this.helper.GetSeparatorElement(); 38406 if(!separator) return; 38407 var prevPane = this.prevPane, 38408 isCollapsed = this.collapsed || prevPane && prevPane.collapsed, 38409 resizingEnabled = SplitterHelper.IsAllowResize(this, prevPane); 38410 if(this.splitter.IsStateControllerEnabled()) 38411 ASPx.GetStateController().SetMouseStateItemsEnabled(this.helper.GetSeparatorElementId(), null, !isCollapsed && resizingEnabled); 38412 this.UpdateStyle(separator, isCollapsed); 38413 }, 38414 UpdatePaneStyle: function () { 38415 this.UpdateStyle(this.helper.GetPaneElement(), 38416 this.collapsed && !this.NeedResetSplitterSizeOnCollapsing(this.maximizedPane) && !this.NeedKeepOffsetSizeOnCollapsing() 38417 ); 38418 }, 38419 UpdateStyle: function (element, isSelect) { 38420 if(!this.splitter.IsStateControllerEnabled()) return; 38421 if(isSelect) 38422 ASPx.GetStateController().SelectElementBySrcElement(element); 38423 else 38424 ASPx.GetStateController().DeselectElementBySrcElement(element); 38425 }, 38426 UpdateButtonsVisibility: function () { 38427 if(!(this.hasSeparator && this.helper.buttonsExists)) 38428 return; 38429 var separatorSize = this.GetOffsetSize(!this.isVertical) - this.separatorSizeDiff; 38430 if(this.helper.buttonsTableExists) { 38431 var buttonsSize = this.buttonsTableDiffSize; 38432 if(this.IsBackwardButtonVisible()) 38433 buttonsSize += this.collapseBackwardButtonSize; 38434 if(this.IsForwardButtonVisible()) 38435 buttonsSize += this.collapseForwardButtonSize; 38436 var buttonsVisible = (buttonsSize <= separatorSize); 38437 var backwardButtonVisible = buttonsVisible && this.IsBackwardButtonVisible(); 38438 var forwardButtonVisible = buttonsVisible && this.IsForwardButtonVisible(); 38439 ASPx.SetElementDisplay(this.helper.GetButtonUpdateElement(this.helper.GetCollapseBackwardButton()), backwardButtonVisible); 38440 ASPx.SetElementDisplay(this.helper.GetButtonUpdateElement(this.helper.GetCollapseForwardButton()), forwardButtonVisible); 38441 if(this.helper.separatorImageExists) { 38442 if(!buttonsVisible) 38443 buttonsSize = this.buttonsTableDiffSize; 38444 buttonsSize += this.collapseButtonsSeparatorSize; 38445 var separatorImageVisible = this.splitter.showSeparatorImage && (backwardButtonVisible === forwardButtonVisible) && (buttonsSize <= separatorSize); 38446 ASPx.SetElementDisplay(this.helper.GetButtonUpdateElement(this.helper.GetCollapseButtonsSeparator()), separatorImageVisible); 38447 } 38448 } 38449 else { 38450 var separatorImageVisible = this.splitter.showSeparatorImage && (this.collapseButtonsSeparatorSize <= separatorSize); 38451 ASPx.SetElementDisplay(this.helper.GetCollapseButtonsSeparatorImage(), separatorImageVisible); 38452 } 38453 }, 38454 GetSeparatorSize: function () { 38455 return ASPx.CacheHelper.GetCachedValue(this, "SeparatorSize", function () { 38456 var separator = this.helper.GetSeparatorElement(); 38457 return separator ? (this.isVertical ? separator.offsetHeight : separator.offsetWidth) : 0; 38458 }, this.helper); 38459 }, 38460 GetTotalSeparatorsSize: function (isVertical) { 38461 if(!ASPx.IsExists(isVertical) || (isVertical == this.isVertical)) 38462 return 0; 38463 var cacheKey = (isVertical ? "v" : "h") + "TotalSeparatorsSize"; 38464 return ASPx.CacheHelper.GetCachedValue(this, cacheKey, function () { 38465 var result = 0; 38466 for(var i = 0; i < this.panes.length; i++)
38467 result += this.panes[i].GetSeparatorSize(); 38468 return result; 38469 }, this.helper); 38470 }, 38471 GetMinSize: function (isVertical) { 38472 if(!ASPx.IsExists(isVertical)) 38473 isVertical = this.isVertical; 38474 var cacheKey = (isVertical ? "v" : "h") + "ItemMinSize"; 38475 return ASPx.CacheHelper.GetCachedValue(this, cacheKey, function () { 38476 var result = 0; 38477 for(var i = 0; i < this.panes.length; i++) 38478 if(isVertical != this.isVertical) 38479 result += this.panes[i].GetMinSize(isVertical); 38480 else 38481 result = Math.max(result, this.panes[i].GetMinSize(isVertical)); 38482 result += this.GetTotalSeparatorsSize(isVertical); 38483 var minSize = (isVertical == this.isVertical) ? this.minSize : this.splitter.defaultMinSize; 38484 result = Math.max(result, Math.max(minSize, this.GetSizeDiff(isVertical))); 38485 return result; 38486 }, this.helper); 38487 }, 38488 DropCachedSizes: function () { 38489 ASPx.CacheHelper.DropCachedValue(this.helper, "SeparatorSize"); 38490 ASPx.CacheHelper.DropCachedValue(this.helper, "vTotalSeparatorsSize"); 38491 ASPx.CacheHelper.DropCachedValue(this.helper, "hTotalSeparatorsSize"); 38492 ASPx.CacheHelper.DropCachedValue(this.helper, "ItemMinSize"); 38493 }, 38494 IsMaxSizeSpecified: function () { 38495 return this.maxSize != Number.MAX_VALUE; 38496 }, 38497 GetMaxSize: function () { 38498 return Math.max(this.maxSize, this.GetSizeDiff(this.isVertical)); 38499 }, 38500 PrepareUpdateInfo: function () { 38501 var updateInfo = {}; 38502 var prepareUpdateInfoPart = function () { 38503 return { 38504 panes: [], 38505 sum: 0, 38506 sumMin: 0, 38507 sumMax: 0, 38508 addPane: function () { 38509 this.panes.push(pane); 38510 if(pane.collapsed) { 38511 var sizeDiff = pane.GetSizeDiff(pane.isVertical); 38512 this.sum += sizeDiff; 38513 this.sumMin += sizeDiff; 38514 } 38515 else { 38516 this.sum += pane.size; 38517 this.sumMin += pane.GetMinSize(); 38518 } 38519 this.sumMax += pane.GetMaxSize(); 38520 }, 38521 IsIgnoreMaxSize: function () { 38522 return this.sumMax < this.sum; 38523 } 38524 }; 38525 }; 38526 updateInfo.px = prepareUpdateInfoPart(); 38527 updateInfo.prc = prepareUpdateInfoPart(); 38528 updateInfo.collapsed = prepareUpdateInfoPart(); 38529 updateInfo.autoSize = prepareUpdateInfoPart(); 38530 updateInfo.onlyPxPanes = true; 38531 updateInfo.hasPxPanesShown = false; 38532 updateInfo.hasPrcPanesShown = false; 38533 for(var i = 0; i < this.panes.length; i++) { 38534 var pane = this.panes[i]; 38535 if(pane.collapsed) 38536 updateInfo.collapsed.addPane(pane); 38537 else if(pane.IsAutoSize(this.isVertical) && pane.GetOffsetSize()) { 38538 updateInfo.autoSize.addPane(pane); 38539 } 38540 else if(pane.isSizePx) { 38541 updateInfo.px.addPane(pane); 38542 updateInfo.hasPxPanesShown = true; 38543 } 38544 else { 38545 updateInfo.prc.addPane(pane); 38546 updateInfo.hasPrcPanesShown = true; 38547 } 38548 if(!pane.isSizePx) 38549 updateInfo.onlyPxPanes = false; 38550 } 38551 updateInfo.px.isIgnoreMaxSize = (!updateInfo.hasPrcPanesShown && (updateInfo.px.sumMax < updateInfo.px.sum)); 38552 updateInfo.prc.isIgnoreMaxSize = (updateInfo.prc.sumMax < updateInfo.prc.sum); 38553 return updateInfo; 38554 }, 38555 SetChildrenSecondSize: function () { 38556 var orientation = this.isVertical; 38557 var size = this.GetClientSize(orientation); 38558 if(this.isRootPane) 38559 for(var pane = this.panes[0]; pane; pane = pane.nextPane) { 38560 if(pane.IsAutoSize(!this.isVertical)) 38561 size = Math.max(size, pane.GetOffsetSize(this.isVertical)); 38562 } 38563 for(var i = 0; i < this.panes.length; i++) 38564 this.panes[i].SetOffsetSize(size, orientation); 38565 }, 38566 GetChildrenTotalSize: function () { 38567 return this.GetClientSize(!this.isVertical) - this.GetTotalSeparatorsSize(!this.isVertical); 38568 }, 38569 UpdateChildrenSize: function () { 38570 if(this.collapsed || (this.panes.length == 0)) 38571 return; 38572 var updateInfo = this.PrepareUpdateInfo(); 38573 var childrenTotalSize = this.GetChildrenTotalSize(); 38574 var asTotalSize = 0; 38575 for(var i = 0; i < updateInfo.autoSize.panes.length; i++) { 38576 var pane = updateInfo.autoSize.panes[i]; 38577 pane.size = pane.GetOffsetSize(); 38578 asTotalSize += pane.size; 38579 } 38580 if(!updateInfo.hasPxPanesShown && !updateInfo.hasPrcPanesShown) { 38581 var asMaxSize = childrenTotalSize - (updateInfo.px.sumMin + updateInfo.prc.sumMin + updateInfo.collapsed.sumMin); 38582 asTotalSize = this.NormalizePanesSizes(updateInfo.autoSize.panes, asTotalSize, asMaxSize); 38583 } 38584 else { 38585 var pxMaxSize = childrenTotalSize - (updateInfo.prc.sumMin + updateInfo.collapsed.sumMin) - asTotalSize, 38586 isOutOfParentSize = !!(pxMaxSize < 0 && updateInfo.autoSize.panes.length); 38587 if(isOutOfParentSize) 38588 pxMaxSize = updateInfo.px.sum; 38589 var pxTotalSize = 0; 38590 if(updateInfo.hasPxPanesShown) { 38591 var c = !updateInfo.hasPrcPanesShown && !isOutOfParentSize && !updateInfo.autoSize.panes.length 38592 ? (pxMaxSize / (updateInfo.px.sum + updateInfo.autoSize.sum)) 38593 : 1; 38594 for(var i = 0; i < updateInfo.px.panes.length; i++) { 38595 var pane = updateInfo.px.panes[i]; 38596 var newSize = pxMaxSize > 0 38597 ? Math.max(Math.round(pane.size * c), pane.GetMinSize()) 38598 : pane.GetMinSize(); 38599 if(!updateInfo.px.isIgnoreMaxSize) 38600 newSize = Math.min(newSize, pane.GetMaxSize()); 38601 pane.SetOffsetSize(newSize); 38602 pxTotalSize += newSize; 38603 } 38604 if(pxMaxSize > 0 && (!updateInfo.hasPrcPanesShown || (pxTotalSize > pxMaxSize))) { 38605 pxTotalSize = this.NormalizePanesSizes(updateInfo.autoSize.panes, pxTotalSize, pxMaxSize); 38606 pxTotalSize = this.NormalizePanesSizes(updateInfo.px.panes, pxTotalSize, pxMaxSize); 38607 } 38608 if(updateInfo.onlyPxPanes && !(this.IsAutoSize(this.isVertical) && !updateInfo.autoSize.panes.length)) {
38609 for(var i = 0; i < updateInfo.px.panes.length; i++) { 38610 var pane = updateInfo.px.panes[i]; 38611 pane.size = pane.GetOffsetSize(); 38612 } 38613 } 38614 } 38615 var prcMaxSize = pxMaxSize - pxTotalSize + updateInfo.prc.sumMin; 38616 var prcTotalSize = 0; 38617 if((prcMaxSize > 0) && updateInfo.hasPrcPanesShown) { 38618 var c = 1 / updateInfo.prc.sum; 38619 for(var i = 0; i < updateInfo.prc.panes.length; i++) { 38620 var pane = updateInfo.prc.panes[i]; 38621 var newSize = Math.max(Math.round(pane.size * c * (childrenTotalSize - pxTotalSize - asTotalSize)), pane.GetMinSize()); 38622 if(!updateInfo.prc.isIgnoreMaxSize) 38623 newSize = Math.min(newSize, pane.GetMaxSize()); 38624 pane.SetOffsetSize(newSize); 38625 prcTotalSize += newSize; 38626 } 38627 if(prcTotalSize != prcMaxSize) 38628 prcTotalSize = this.NormalizePanesSizes(updateInfo.prc.panes, prcTotalSize, prcMaxSize); 38629 } 38630 } 38631 for(var i = 0; i < updateInfo.collapsed.panes.length; i++) { 38632 var pane = updateInfo.collapsed.panes[i], 38633 collapsedSize = pane.GetSizeDiff(pane.isVertical); 38634 pane.SetOffsetSize(collapsedSize); 38635 } 38636 if(ASPx.Browser.WebKitFamily && updateInfo.collapsed.panes.length && this.IsAutoSize(this.IsVertical)) 38637 this.splitter.CreateWebkitSpecialElement(); 38638 this.SetChildrenSecondSize(); 38639 for(var i = 0; i < this.panes.length; i++) { 38640 var pane = this.panes[i]; 38641 if(pane.collapsed) 38642 pane.SetContentVisible(false); 38643 else 38644 pane.SetContentVisible(true); 38645 if(pane.ApplyElementSize()) 38646 pane.RaiseResizedEvent(); 38647 } 38648 this.ForEach("UpdateButtonsVisibility", true); 38649 }, 38650 GetPossibleUp: function () { 38651 if(this.inResizing) 38652 return -1; 38653 return this.GetMaxSize() - this.GetOffsetSize(); 38654 }, 38655 GetPossibleDown: function () { 38656 if(this.IsAutoSize(!this.isVertical) && !(this.panes.length && !this.helper.HasVisibleAutoSizeChildren(!this.isVertical))) 38657 return -1; 38658 if(this.inResizing) 38659 return -1; 38660 return this.GetOffsetSize() - this.GetMinSize(); 38661 }, 38662 NormalizePanesSizes: function (panes, size, maxSize) { 38663 var insufficientSize = Math.ceil(maxSize - size); 38664 var changeStep = (insufficientSize > 0) ? 1 : -1; 38665 var possibleChangeFunction = (insufficientSize > 0) ? "GetPossibleUp" : "GetPossibleDown"; 38666 var changed = true; 38667 while(insufficientSize != 0 && changed) { 38668 changed = false; 38669 for(var i = 0; i < panes.length; i++) { 38670 var pane = panes[i]; 38671 if(pane[possibleChangeFunction]() > 0) { 38672 pane.SetOffsetSize(pane.GetOffsetSize() + changeStep); 38673 insufficientSize -= changeStep; 38674 changed = true; 38675 if(insufficientSize == 0) 38676 break; 38677 } 38678 } 38679 } 38680 return maxSize - insufficientSize; 38681 }, 38682 GetOffsetSize: function (isVertical) { 38683 if(!ASPx.IsExists(isVertical)) 38684 isVertical = this.isVertical; 38685 return isVertical ? this.offsetHeight : this.offsetWidth; 38686 }, 38687 GetClientSize: function (isVertical) { 38688 return isVertical ? this.GetClientHeightInternal(true) : this.GetClientWidthInternal(true); 38689 }, 38690 SetOffsetSize: function (value, isVertical) { 38691 if(!ASPx.IsExists(isVertical)) 38692 isVertical = this.isVertical; 38693 if(isVertical) 38694 this.offsetHeight = value; 38695 else 38696 this.offsetWidth = value; 38697 }, 38698 GetSizeDiff: function (isVertical) { 38699 return isVertical ? this.GetHeightDiff(true) : this.GetWidthDiff(true); 38700 }, 38701 GetWidthDiff: function (isContainer) { 38702 if(this.collapsed) 38703 return this.collapsedWidthDiff; 38704 return this.widthDiff + (isContainer ? this.contentContainerWidthDiff : 0); 38705 }, 38706 GetHeightDiff: function (isContainer) { 38707 if(this.collapsed) 38708 return this.collapsedHeightDiff; 38709 return this.heightDiff + (isContainer ? this.contentContainerHeightDiff : 0); 38710 }, 38711 GetClientWidthInternal: function (isContainer) { 38712 if(ASPx.Browser.Firefox && this.autoWidth) 38713 return this.offsetWidth; 38714 return this.offsetWidth - this.GetWidthDiff(isContainer); 38715 }, 38716 GetClientHeightInternal: function (isContainer) { 38717 if(ASPx.Browser.Firefox && this.autoHeight) 38718 return this.offsetHeight - (isContainer ? 0 : ASPx.GetVerticalBordersWidth(this.GetElement())); 38719 return this.offsetHeight - this.GetHeightDiff(isContainer); 38720 }, 38721 ApplyElementSize: function () { 38722 if(this.IsSizeChanged()) {
38723 this.ApplyElementSizeCore(); 38724 var contentContainerElement = this.helper.GetContentContainerElement(); 38725 if(ASPx.Browser.Chrome && ASPx.Browser.MajorVersion >= 3 38726 || ASPx.Browser.Safari && ASPx.Browser.MajorVersion >= 5) { 38727 var marginRight = ASPx.PxToInt(contentContainerElement.style.marginRight); 38728 marginRight -= ASPx.PxToInt(ASPx.GetCurrentStyle(contentContainerElement).marginRight); 38729 contentContainerElement.style.marginRight = marginRight + "px"; 38730 } 38731 if(ASPx.Browser.WebKitFamily) 38732 this.splitter.CreateWebkitSpecialElement(); 38733 return true; 38734 } 38735 return false; 38736 }, 38737 ApplyElementSizeCore: function () { 38738 var paneWidth = this.GetClientWidthInternal(false); 38739 var paneHeight = this.GetClientHeightInternal(false); 38740 var contentContainerWidth = this.GetClientWidthInternal(true); 38741 var contentContainerHeight = this.GetClientHeightInternal(true); 38742 if(contentContainerWidth < 0) { 38743 paneWidth -= contentContainerWidth; 38744 contentContainerWidth = 0; 38745 } 38746 if(contentContainerHeight < 0) { 38747 paneHeight -= contentContainerHeight; 38748 contentContainerHeight = 0; 38749 } 38750 var paneElement = this.helper.GetPaneElement(), 38751 contentContainerElement = this.helper.GetContentContainerElement(); 38752 if(!isNaN(paneWidth) && !(paneWidth === 0 && !this.collapsed)) 38753 paneElement.style.width = paneWidth + "px"; 38754 if(!isNaN(paneHeight) && !(paneHeight === 0 && !this.collapsed)) 38755 paneElement.style.height = paneHeight + "px"; 38756 if(!this.autoWidth && !isNaN(contentContainerWidth)) 38757 contentContainerElement.style.width = contentContainerWidth + "px"; 38758 if(!this.autoHeight && !isNaN(contentContainerHeight)) 38759 contentContainerElement.style.height = contentContainerHeight + "px"; 38760 }, 38761 IsSizeChanged: function () { 38762 if(!ASPx.IsExists(this.lastWidth) || !ASPx.IsExists(this.lastHeight) || 38763 (this.offsetWidth != this.lastWidth) || (this.offsetHeight != this.lastHeight)) { 38764 this.lastWidth = this.offsetWidth; 38765 this.lastHeight = this.offsetHeight; 38766 return true; 38767 } 38768 return false; 38769 }, 38770 GetSplitter: function () { 38771 return this.splitter; 38772 }, 38773 GetParentPane: function () { 38774 return this.parent; 38775 }, 38776 GetPrevPane: function () { 38777 return this.prevPane; 38778 }, 38779 GetNextPane: function () { 38780 return this.nextPane; 38781 }, 38782 IsFirstPane: function () { 38783 return (this.prevPane == null); 38784 }, 38785 IsLastPane: function () { 38786 return (this.nextPane == null); 38787 }, 38788 IsVertical: function () { 38789 return this.isVertical; 38790 }, 38791 GetPaneCount: function () { 38792 return this.panes.length; 38793 }, 38794 GetPane: function (index) { 38795 return (0 <= index && index < this.panes.length) ? this.panes[index] : null; 38796 }, 38797 GetPaneByName: function (name) { 38798 for(var i = 0; i < this.panes.length; i++) 38799 if(this.panes[i].name == name) return this.panes[i]; 38800 for(var i = 0; i < this.panes.length; i++) { 38801 var pane = this.panes[i].GetPaneByName(name); 38802 if(pane != null) return pane; 38803 } 38804 return null; 38805 }, 38806 GetClientWidth: function () { 38807 var clientWidth = this.GetClientWidthInternal(true); 38808 if(!this.IsContentUrlPane()) { 38809 var contentContainer = this.helper.GetContentContainerElement(); 38810 if((contentContainer.style.overflow == "auto" && contentContainer.scrollHeight > contentContainer.clientHeight) 38811 || contentContainer.style.overflow == "scroll" 38812 || contentContainer.style.overflowY == "scroll") { 38813 clientWidth = clientWidth - ASPx.GetVerticalScrollBarWidth(); 38814 } 38815 } 38816 return clientWidth; 38817 }, 38818 GetClientHeight: function () { 38819 return this.GetClientHeightInternal(true); 38820 }, 38821 Collapse: function (maximizedPane) { 38822 if(!this.splitter.IsPrepared()) 38823 return false; 38824 if(this.collapsed) 38825 return false; 38826 if(!ASPx.IsExists(maximizedPane) || !maximizedPane.isASPxClientSplitterPane) 38827 return false; 38828 return this.CollapseExpandCore(true, maximizedPane, "PaneCollapsed"); 38829 }, 38830 CollapseForward: function () { 38831 return this.Collapse(this.prevPane); 38832 }, 38833 CollapseBackward: function () { 38834 return this.Collapse(this.nextPane); 38835 }, 38836 Expand: function () { 38837 if(!this.splitter.IsPrepared()) 38838 return false; 38839 if(!this.collapsed) 38840 return false; 38841 return this.CollapseExpandCore(false, null, "PaneExpanded"); 38842 }, 38843 CollapseExpandCore: function (collapsed, maximizedPane, eventName) { 38844 this.collapsed = collapsed; 38845 this.maximizedPane = maximizedPane; 38846 this.DropCachedButtonsVisible(); 38847 if(this.nextPane != null) 38848 this.nextPane.DropCachedButtonsVisible(); 38849 this.GetParentPane().UpdatePanes(!collapsed); 38850 this.GetParentPane().ForEach("AdjustControls"); 38851 this.splitter.RaiseEvent(eventName, this); 38852 this.splitter.UpdateCookie(); 38853 return true; 38854 }, 38855 IsCollapsed: function () { 38856 return this.collapsed; 38857 }, 38858 NeedResetSplitterSizeOnCollapsing: function (maximizedPane) { 38859 return maximizedPane.IsMaxSizeSpecified() && maximizedPane.GetParentPane().isRootPane; 38860 }, 38861 NeedKeepOffsetSizeOnCollapsing: function () { 38862 return this.maximizedPane.IsMaxSizeSpecified() && !this.GetParentPane().isRootPane && this.GetParentPane().GetPaneCount() == 2; 38863 }, 38864 IsContentUrlPane: function () { 38865 return this.isContentUrl; 38866 }, 38867 GetContentUrl: function () { 38868 return this.isContentUrl 38869 ? this.iframeObj.GetContentUrl() 38870 : ""; 38871 }, 38872 SetContentUrl: function (url, preventBrowserCaching) { 38873 if(!this.isContentUrl) 38874 return; 38875 this.iframeObj.SetContentUrl(url, preventBrowserCaching); 38876 }, 38877 RefreshContentUrl: function () { 38878 if(!this.isContentUrl) 38879 return; 38880 this.iframeObj.RefreshContentUrl(); 38881 }, 38882 GetContentIFrame: function () { 38883 return this.isContentUrl 38884 ? this.helper.GetContentContainerElement() 38885 : null; 38886 }, 38887 CreateContentUrlIFrame: function () { 38888 if(!this.isContentUrl) 38889 return; 38890 var contentContainer = this.helper.GetContentContainerElement(); 38891 contentContainer.parentNode.removeChild(contentContainer); 38892 this.iframeObj = new ASPx.IFrameHelper({ 38893 id: contentContainer.id, 38894 name: this.iframe.name, 38895 title: this.iframe.title, 38896 scrolling: this.iframe.scrolling, 38897 src: this.iframe.src, 38898 onCreate: function (containerElement, element) { 38899 element.className = "dxsplIF"; 38900 this.helper.GetPaneElement().appendChild(containerElement); 38901 this.helper.DropContentContainerElementFromCache();
38902 this.ApplyElementSizeCore(); 38903 if(this.autoHeight && this.isVertical) 38904 containerElement.style.height = "100%"; 38905 }.aspxBind(this), 38906 onLoad: function () { 38907 this.splitter.RaiseEvent("PaneContentUrlLoaded", this); 38908 }.aspxBind(this) 38909 }); 38910 }, 38911 SetAllowResize: function (allowResize) { 38912 this.allowResize = allowResize; 38913 this.UpdateSeparatorStyle(); 38914 if(!this.IsLastPane()) 38915 this.nextPane.UpdateSeparatorStyle(); 38916 }, 38917 RaiseResizedEvent: function () { 38918 this.splitter.RaiseEvent("PaneResized", this); 38919 }, 38920 GetElement: function () { 38921 return this.helper.GetPaneElement(); 38922 }, 38923 SetSize: function (size) { 38924 if(!this.splitter.IsPrepared()) 38925 return; 38926 if(this.SetSizeCore(size)) { 38927 this.parent.ForEach("UpdateChildrenSize"); 38928 this.splitter.UpdateAutoSizePanes(); 38929 this.parent.ForEach("AdjustControls"); 38930 this.splitter.UpdateCookie(); 38931 } 38932 }, 38933 GetSize: function () { 38934 return this.size + this.sizeType; 38935 }, 38936 SetSizeCore: function (size) { 38937 if(!ASPx.IsExists(size)) 38938 return false; 38939 if(this.IsAutoSize(!this.isVertical)) 38940 return false; 38941 if(typeof (size) == "string") { 38942 var parsedSize = parseInt(size); 38943 if(isNaN(parsedSize)) 38944 return false; 38945 this.size = parsedSize; 38946 this.sizeType = ASPx.IsPercentageSize(size) ? "%" : "px"; 38947 } 38948 else if(typeof (size) == "number") { 38949 this.size = size; 38950 this.sizeType = "px"; 38951 } 38952 else 38953 return false; 38954 this.isSizePx = this.sizeType == "px"; 38955 return true; 38956 }, 38957 GetScrollTop: function () { 38958 return this.scrollTop; 38959 }, 38960 SetScrollTop: function (value) { 38961 this.helper.GetContentContainerElement().scrollTop = value; 38962 }, 38963 GetScrollLeft: function () { 38964 return this.scrollLeft; 38965 }, 38966 SetScrollLeft: function (value) { 38967 this.helper.GetContentContainerElement().scrollLeft = value; 38968 }, 38969 OnDispose: function() { 38970 if(this.helper != null) 38971 this.helper.OnDispose(); 38972 this.splitter = null; 38973 this.helper = null; 38974 } 38975}); 38976ASPxClientSplitter.Instances = { 38977 items: {}, 38978 Add: function(instance) { 38979 var name = instance.name; 38980 if(ASPx.IsExists(this.items[name])) { 38981 this.items[name].OnDispose(); 38982 this.Remove(name); 38983 } 38984 this.items[name] = instance; 38985 if(instance.hasAutoSizePane) 38986 ASPxClientSplitter.AutoSizePanesUpdater.Start(); 38987 }, 38988 Get: function (name) { 38989 var instance = this.items[name]; 38990 if(instance) { 38991 if(instance.GetMainElement()) 38992 return instance; 38993 this.Remove(name); 38994 } 38995 return null; 38996 }, 38997 Each: function (cb) { 38998 var hasInstances = false; 38999 for(var name in this.items) { 39000 if(this.items.hasOwnProperty(name)) { 39001 var instance = this.Get(name); 39002 if(instance) { 39003 hasInstances = true; 39004 cb.call(instance); 39005 } 39006 } 39007 } 39008 return hasInstances; 39009 }, 39010 Remove: function(name) { 39011 if(ASPx.IsExists(this.items[name])) { 39012 try { 39013 delete this.items[name]; 39014 } catch(e) { } 39015 } 39016 } 39017}; 39018ASPxClientSplitter.AutoSizePanesUpdater = { 39019 timeoutId: -1, 39020 Start: function () { 39021 var updater = ASPxClientSplitter.AutoSizePanesUpdater; 39022 if(updater.timeoutId > -1) 39023 return; 39024 updater.timeoutId = window.setTimeout(updater.OnTimeout, 300); 39025 updater.devicePixelRatio = window.devicePixelRatio; 39026 }, 39027 Stop: function () { 39028 var updater = ASPxClientSplitter.AutoSizePanesUpdater; 39029 updater.timeoutId = ASPx.Timer.ClearTimer(updater.timeoutId); 39030 }, 39031 OnTimeout: function () { 39032 var updater = ASPxClientSplitter.AutoSizePanesUpdater; 39033 updater.Stop(); 39034 if(ASPxClientSplitter.Instances.Each(function() { 39035 if(!this.isInitialized) 39036 return; 39037 this.UpdateAutoSizePanes(); 39038 if(window.devicePixelRatio !== updater.devicePixelRatio) 39039 this.rootPane.ForEach("PrepareInternal", true); 39040 if(!this.isInLiveResizing && this.hasAutoSizePane && this.IsDocumentWidthChanged() || window.devicePixelRatio !== updater.devicePixelRatio) 39041 this.UpdateControlSizes(); 39042 })); 39043 updater.Start(); 39044 } 39045}; 39046ASPxClientSplitter.timerInterval = 0; 39047ASPxClientSplitter.GetRegEx = function (idPostfix) { 39048 if(!this.regExs) 39049 this.regExs = {}; 39050 if(!this.regExs[idPostfix]) 39051 this.regExs[idPostfix] = "_\\d+(" + ASPx.ItemIndexSeparator + "\\d+)*_" + idPostfix + "$"; 39052 return this.regExs[idPostfix]; 39053}; 39054ASPxClientSplitter.SaveCurrentPos = function (evt) { 39055 evt = ASPx.Evt.GetEvent(evt); 39056 ASPxClientSplitter.CurrentXPos = ASPx.Evt.GetEventX(evt); 39057 ASPxClientSplitter.CurrentYPos = ASPx.Evt.GetEventY(evt); 39058};
39059ASPxClientSplitter.FindParentCell = function (element) { 39060 if(element.tagName != "TD") 39061 element = ASPx.GetParentByTagName(element, "TD"); 39062 return element; 39063}; 39064ASPxClientSplitter.FindSplitterInfo = function (evt, regex, suffixLength) { 39065 var element = ASPxClientSplitter.FindParentCell(ASPx.Evt.GetEventSource(evt)); 39066 if(element) { 39067 var matchResult = element.id.match(regex); 39068 if(matchResult) { 39069 var name = element.id.substring(0, matchResult.index); 39070 var splitter = ASPxClientSplitter.Instances.Get(name); 39071 if(splitter != null) { 39072 var panePath = element.id.substring(matchResult.index + 1, element.id.length - suffixLength); 39073 return { "splitter": splitter, "panePath": panePath }; 39074 } 39075 } 39076 } 39077 return null; 39078}; 39079ASPxClientSplitter.OnMouseClick = function (evt) { 39080 var info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S_CF"), 5); 39081 if(info) { 39082 if(info.splitter.enabled) 39083 info.splitter.OnCollapseButtonClick(info.panePath, true); 39084 } 39085 else { 39086 info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S_CB"), 5); 39087 if(info && info.splitter.enabled) 39088 info.splitter.OnCollapseButtonClick(info.panePath, false); 39089 } 39090}; 39091ASPxClientSplitter.OnMouseDown = function (evt) { 39092 var info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S"), 2); 39093 if(!info) 39094 info = ASPxClientSplitter.FindSplitterInfo(evt, ASPxClientSplitter.GetRegEx("S_CS"), 5); 39095 if(info && info.splitter) { 39096 ASPxClientSplitter.current = info.splitter; 39097 ASPxClientSplitter.SaveCurrentPos(evt); 39098 ASPx.Selection.SetElementSelectionEnabled(ASPxClientSplitter.current.GetMainElement(), false); 39099 ASPxClientSplitter.isInMove = info.splitter.OnSeparatorMouseDown(info.panePath); 39100 ASPx.Evt.PreventEvent(evt); 39101 } 39102}; 39103ASPxClientSplitter.OnMouseUp = function () { 39104 if(ASPxClientSplitter.isInMove) { 39105 ASPxClientSplitter.isInMove = false; 39106 ASPx.Selection.SetElementSelectionEnabled(ASPxClientSplitter.current.GetMainElement(), true); 39107 ASPxClientSplitter.current.OnSeparatorMouseUp(); 39108 } 39109}; 39110ASPxClientSplitter.mouseMoveTimeoutId = -1; 39111ASPxClientSplitter.SuspendedMouseMove = function () { 39112 if(ASPxClientSplitter.isInMove) 39113 ASPxClientSplitter.current.OnMouseMove(); 39114 ASPxClientSplitter.mouseMoveTimeoutId = ASPx.Timer.ClearTimer(ASPxClientSplitter.mouseMoveTimeoutId); 39115}; 39116ASPxClientSplitter.OnMouseMove = function (evt) { 39117 if(ASPx.Browser.WebKitTouchUI && ASPx.TouchUIHelper.isGesture) 39118 return; 39119 if(!ASPxClientSplitter.isInMove) 39120 return; 39121 ASPxClientSplitter.SaveCurrentPos(evt); 39122 if(ASPxClientSplitter.mouseMoveTimeoutId == -1) 39123 ASPxClientSplitter.mouseMoveTimeoutId = window.setTimeout(ASPxClientSplitter.SuspendedMouseMove, ASPxClientSplitter.timerInterval); 39124 if(ASPx.Browser.WebKitTouchUI) 39125 ASPx.Evt.PreventEvent(evt); 39126}; 39127ASPx.Evt.AttachEventToDocument("click", ASPxClientSplitter.OnMouseClick); 39128ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseDownEventName, ASPxClientSplitter.OnMouseDown); 39129ASPx.Evt.AttachEventToDocument(ASPx.TouchUIHelper.touchMouseUpEventName, ASPxClientSplitter.OnMouseUp); 39130ASPx.Evt.AttachEventToElement(window, ASPx.TouchUIHelper.touchMouseMoveEventName, ASPxClientSplitter.OnMouseMove, false, !ASPx.Browser.WebKitTouchUI); 39131var ASPxClientSplitterPaneEventArgs = ASPx.CreateClass(ASPxClientEventArgs, { 39132 constructor: function (pane) { 39133 this.constructor.prototype.constructor.call(this, pane); 39134 this.pane = pane; 39135 } 39136}); 39137var ASPxClientSplitterPaneCancelEventArgs = ASPx.CreateClass(ASPxClientSplitterPaneEventArgs, { 39138 constructor: function (pane) { 39139 this.constructor.prototype.constructor.call(this, pane); 39140 this.cancel = false; 39141 } 39142}); 39143window.ASPxClientSplitter = ASPxClientSplitter; 39144window.ASPxClientSplitterPane = ASPxClientSplitterPane; 39145window.ASPxClientSplitterPaneEventArgs = ASPxClientSplitterPaneEventArgs; 39146window.ASPxClientSplitterPaneCancelEventArgs = ASPxClientSplitterPaneCancelEventArgs; 39147})(); 39148
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.