1ASPx.IS(function(ASPx, dx, DevExpress){ 2(function(dx) { 3 (function (env) { 4 var baseClass = env.CreateClass({ 5 constructor: function (args) { 6 Object.defineProperty(this, '__dx__', { value: args, enumerable: false, configurable: false, writable: false }); 7 if(!args[1].getInstance) 8 Object.defineProperty(args[1], 'getInstance', { value: args[2], enumerable: true, configurable: false, writable: false }); 9 }, 10 getType: function () { return this.__dx__[1]; }, 11 clone: function (env) { return create(this.__dx__[0], env, env ? null : this.getType()); } 12 }); 13 function create(setupEnv, envObj, type, ret) { 14 type = type || (type = env.CreateClass(baseClass, setupEnv(envObj || env))); 15 return ret = new type([setupEnv, type, function () { return ret; }]); 16 } 17 env.CreateSingleton = create; 18 })(ASPx); 19 var BootstrapEventManager = {}; 20 var globalContainersStorage = {}; 21 function getEventAttachFunc(owner, key) { 22 var cs = globalContainersStorage[owner.name]; 23 if(!cs || cs.checkSum !== owner.checkSum) 24 cs = globalContainersStorage[owner.name] = { checkSum: (owner.checkSum = ASPx.CreateGuid()), c: {} }; 25 return cs.c[key] || (cs.c[key] = createEventHandlerContainer( 26 owner.getEventContainers || function() { return [document.getElementById(owner.name)]; }, key)); 27 } 28 function createEventHandlerContainer(getEventContainers, eventName) { 29 var elements = getEventContainers(); 30 var queue = [], i = 0, order = [queue]; 31 function addToHierarchy(el, handler) { 32 var foundQueue = queue; 33 var detachIndex = foundQueue.length; 34 foundQueue.push({ target: el, handler: handler }); 35 return function() { foundQueue.splice(detachIndex, 1); }; 36 } 37 function handleEvent(e) { 38 if(e.cancelBubble) return; 39 var srcEl = ASPx.Evt.GetEventSource(e); 40 for(var i = 0; !e.cancelBubble && i < order.length; i++) { 41 var q = order[i]; 42 if(q && q.length) { 43 for(var j = 0; !e.cancelBubble && j < q.length; j++) { 44 if(ASPx.GetIsParent(q[j].target, srcEl)) { 45 q[j].handler(e); 46 break; 47 } 48 } 49 } 50 } 51 } 52 for(var i = 0; i < elements.length; i++) { 53 ASPx.Evt.AttachEventToElement(elements[i], eventName, handleEvent); 54 } 55 return addToHierarchy; 56 } 57 BootstrapEventManager.attachEventToElement = function(owner, element, eventName, handler) { 58 var detacherBagRef = element._detacherBagRef || (element._detacherBagRef = {}); 59 detacherBagRef[eventName] = getEventAttachFunc(owner, eventName)(element, handler); 60 }; 61 BootstrapEventManager.detachEventFromElement = function(element, eventName, handler) { 62 var detacherBagRef = element._detacherBagRef || (element._detacherBagRef = {}); 63 if(detacherBagRef[eventName]) 64 detacherBagRef[eventName](); 65 }; 66 BootstrapEventManager.EventsHub = ASPx.CreateSingleton(function (ASPx) { 67 var eventListenersAttachedToDOM = false, eventListenersBuffer = [], handleOnEventBubbling = true, emptyEventListener = { attach: function () { }, detach: function () { } }; 68 function ensureEventListenersActive() { 69 if (eventListenersAttachedToDOM === true) 70 return; 71 eventListenersBuffer.forEach(function (f) { f(); }); 72 eventListenersBuffer = null; 73 eventListenersAttachedToDOM = true; 74 } 75 function getEventListener(eventName, targetGetter) { 76 targetGetter = targetGetter || function () { return document; }; 77 if (eventName === "mouseover" && ASPx.Browser.MobileUI) 78 return emptyEventListener; 79 var listeners = []; 80 function getDepth(root, el) { return el !== root ? getDepth(root, el.parentNode) + 1 : 0; } 81 function attachListenersToDOM() { 82 ASPx.Evt.AttachEventToElement(targetGetter(), eventName, function (evt) { 83 var evtSrc = ASPx.Evt.GetEventSource(evt); 84 function invokeHandlerForListener(listener) { listener.handler(listener.el, evt, evtSrc, eventName); } 85 function createListenerInfo(listener) { 86 var p = ASPx.GetParentBySelector(evtSrc, listener.targetSelector); 87 if (!p && !(listener.fallbackSelector && ASPx.ElementMatchesSelector(evtSrc, listener.fallbackSelector))) 88 return null; 89 return { isFallback: !p, handler: p ? listener.handler : listener.fallbackHandler, el: p || evtSrc, depth: p ? getDepth(p, evtSrc) : 0 }; 90 } 91 function processRelatedListeners(relatedListeners, isFallback) { 92 relatedListeners.filter(function (rl) { return rl.isFallback === isFallback; }).sort(function (a, b) { return a.depth < b.depth; }
92).forEach(invokeHandlerForListener); 93 } 94 var relatedListeners = listeners.map(createListenerInfo).filter(function (rl) { return !!rl; }); 95 processRelatedListeners(relatedListeners, false); 96 processRelatedListeners(relatedListeners, true); 97 }, handleOnEventBubbling); 98 } 99 function attach(eventListenerInfo) { 100 var targetSelector, handler, fallbackSelector, fallbackHandler; 101 for (var k in eventListenerInfo) { 102 if (eventListenerInfo.hasOwnProperty(k)) { 103 if (k === "*") { 104 fallbackSelector = k; 105 fallbackHandler = eventListenerInfo[k]; 106 } else { 107 targetSelector = k; 108 handler = eventListenerInfo[k]; 109 } 110 } 111 } 112 listeners.push({ targetSelector: targetSelector, handler: handler, fallbackSelector: fallbackSelector, fallbackHandler: fallbackHandler, owner: eventListenerInfo }); 113 } 114 function detach(eventListenerInfo) { 115 listeners = listeners.filter(function (l) { return l.owner !== eventListenerInfo; }); 116 } 117 eventListenersBuffer.push(attachListenersToDOM); 118 return { 119 attach: attach, 120 detach: detach 121 }; 122 } 123 return { 124 getEventListener: getEventListener, 125 ensureEventListenersActive: ensureEventListenersActive 126 }; 127 }); 128 ASPx.BootstrapEventManager = BootstrapEventManager; 129 var BootstrapPopupManager = {}; 130 var visiblePopups; 131 var popupInfo = function(elements, onHide){ 132 this.elements = elements; 133 this.onHide = onHide; 134 }; 135 BootstrapPopupManager.registerVisiblePopup = function(elements, onHide){ 136 if(!visiblePopups) 137 visiblePopups = []; 138 if(!ASPx.Ident.IsArray(elements)) 139 elements = [elements]; 140 visiblePopups.push(new popupInfo(elements, onHide)); 141 showPopup(elements); 142 }; 143 BootstrapPopupManager.correctPopupPositionForClientWindow = function(elements, hAlign, hOffset, vAlign, vOffset) { 144 correctPopupForClientWindow(ASPx.Ident.IsArray(elements) ? elements : [elements], hAlign, hOffset, vAlign, vOffset); 145 }; 146 BootstrapPopupManager.unregisterVisiblePopup = function(elements){ 147 if(visiblePopups && visiblePopups.length && elements && elements.length) { 148 var popupInfo = this.findPopupInfo(elements); 149 if(popupInfo) { 150 hidePopup(popupInfo.elements); 151 ASPx.Data.ArrayRemove(visiblePopups, popupInfo); 152 if(popupInfo.onHide) 153 popupInfo.onHide(); 154 } 155 } 156 }; 157 BootstrapPopupManager.findPopupInfo = function(elements){ 158 for(var i = 0; i < visiblePopups.length; i++){ 159 if(ASPx.Data.ArrayEqual(visiblePopups[i].elements, elements)) 160 return visiblePopups[i]; 161 } 162 return null; 163 }; 164 BootstrapPopupManager.isPopupVisible = function(elements){ 165 return visiblePopups && visiblePopups.length && elements && elements.length && this.findPopupInfo(elements); 166 }; 167 function showPopup(elements) { 168 var originElement = getOriginElement(elements); 169 var popupElement = getPopupElement(elements); 170 var x = ASPx.GetAbsoluteX(originElement); 171 var y = ASPx.GetAbsoluteY(originElement) + originElement.offsetHeight; 172 ASPx.SetAbsoluteX(popupElement, x); 173 ASPx.SetAbsoluteY(popupElement, y); 174 ASPx.SetElementDisplay(popupElement, true); 175 } 176 function correctPopupForClientWindow(elements, hAlign, hOffset, vAlign, vOffset) { 177 var originElement = getOriginElement(elements); 178 var popupElement = getPopupElement(elements); 179 ASPx.SetAbsoluteX(popupElement, correctPopupPositionToClientScreen(popupElement, originElement, true, hAlign, hOffset)); 180 ASPx.SetAbsoluteY(popupElement, correctPopupPositionToClientScreen(popupElement, originElement, false, vAlign, vOffset)); 181 } 182 function hidePopup(elements){ 183 var popupElement = getPopupElement(elements); 184 if(popupElement) 185 ASPx.SetElementDisplay(popupElement, false); 186 } 187 function getPopupElement(elements){ 188 return elements && elements.length > 0 ? elements[0] : null; 189 } 190 function getOriginElement(elements){ 191 return elements && elements.length > 1 ? elements[1] : null; 192 } 193 function correctPopupPositionToClientScreen(popupElement, originElement, isX, align, offset) { 194 var startPos = ASPx.InvalidPosition; 195 var startPosInit = isX ? ASPx.GetAbsoluteX(popupElement) : ASPx.GetAbsoluteY(popupElement); 196 var popupPosition = isX ? ASPx.PopupUtils.GetPopupAbsoluteX(popupElement, originElement, align, offset, startPos, startPosInit, false, true) 197 : ASPx.PopupUtils.GetPopupAbsoluteY(popupElement, originElement, align, offset, startPos, startPosInit, true, false); 198 return popupPosition.position; 199 } 200 ASPx.Evt.AttachEventToDocument("mousedown", function(evt) { 201 if(!visiblePopups || !visiblePopups.length) return; 202 var eventSource = ASPx.Evt.GetEventSource(evt); 203 if(typeof(ASPx.GetDropDownCollection) != "undefined") { 204 var dropDownCollection = ASPx.GetDropDownCollection(); 205 var dropDownControl = dropDownCollection.GetDroppedDropDown(); 206 if(dropDownControl != null) { 207 var modalWrapperElement = dropDownControl.GetMainElement().querySelector(".dxbs-ddmodal"); 208 var isEventFromModalWrapper = ASPx.GetIsParent(modalWrapperElement, eventSource); 209 var isEventFromDropDownWindow = ASPx.GetIsParent(dropDownControl.GetDropDownWindow(), eventSource); 210 if(!(isEventFromModalWrapper || isEventFromDropDownWindow)) { 211 var isEventFromDropDownControl = !dropDownCollection.IsEventNotFromControlSelf(evt, dropDownControl); 212 if(isEventFromDropDownControl) 213 return; 214 } 215 var isEventOutFromModalDialog = isEventFromModalWrapper && !isEventFromDropDownWindow; 216 if(isEventOutFromModalDialog) { 217 dropDownControl.CloseDropDownByDocumentOrWindowEvent(false); 218 return; 219 } 220 if(!dropDownControl.QueryCloseUp.IsEmpty()) 221 return; 222 } 223 } 224 for(var i = visiblePopups.length - 1; i >= 0; i--) { 225 var needHidePopup = true; 226 var popupElements = visiblePopups[i].elements; 227 for(var j = 0; j < popupElements.length; j++) { 228 if(ASPx.GetIsParent(popupElements[j], eventSource)) 229 needHidePopup = false; 230 } 231 if(needHidePopup) 232 BootstrapPopupManager.unregisterVisiblePopup(popupElements); 233 } 234 }); 235 BootstrapPopupManager.PopupZIndex = 500; 236 BootstrapPopupManager.PopupModalZIndex = 1100; 237 BootstrapPopupManager.PopupType = "bspopup"; 238 BootstrapPopupManager.PopupModalType = "modalbspopup"; 239 ASPx.BootstrapPopupManager = BootstrapPopupManager; 240 var defaultDecorationStyles = { }; 241 var BootstrapEditorStyleDecoration = ASPx.CreateClass(ASPx.TextEditorStyleDecoration, { 242 constructor: function(editor) { 243 this.constructor.prototype.constructor.call(this, editor);
244 if(editor.cssClasses && editor.cssClasses.nt) 245 this.innerStyles["N"] = editor.cssClasses.nt; 246 }, 247 InitializeNullTextClassName: function() { 248 if(this.HasDecoration("N")) 249 this.nullTextClassName = this.innerStyles["N"]; 250 }, 251 IsTimeEditDecorated: function() { 252 return ASPx.Ident.IsASPxClientTimeEdit && ASPx.Ident.IsASPxClientTimeEdit(this.editor); 253 }, 254 HasDecoration: function(key) { 255 var editor = this.editor; 256 var validationEnabled = editor.customValidationEnabled; 257 var hasNullTextDecoration = key == "N" && (!!editor.nullText || this.IsTimeEditDecorated()); 258 var hasInvalidDecoration = key == "I" && validationEnabled; 259 var hasFocusedDecoration = editor.needFocusedStyleDecoration && (key == "F" || key == "FI" && validationEnabled); 260 var hasDecoration = hasNullTextDecoration || hasInvalidDecoration || hasFocusedDecoration; 261 if(hasDecoration) { 262 var needUpdateDefaultDecoration = !defaultDecorationStyles[key] || !defaultDecorationStyles[key].isValid; 263 if(needUpdateDefaultDecoration) 264 BootstrapEditorStyleDecoration.UpdateDefaultDecorationStyles([key]); 265 if(!this.innerStyles[key] && defaultDecorationStyles[key]) 266 this.innerStyles[key] = defaultDecorationStyles[key].className; 267 } 268 return hasDecoration; 269 }, 270 CanApplyNullTextStyleToElement: function(element) { 271 var needApplyNullTextClassName = this.editor.focused && this.IsTimeEditDecorated(); 272 return !needApplyNullTextClassName 273 ? this.IsInputElement(element) && this.editor.GetInputElement() == element 274 : false; 275 }, 276 CanApplyFocusedStyleToElement: function(element) { 277 var tabIndex = parseInt(ASPx.Attr.GetAttribute(element, "tabindex")); 278 return !this.IsInputElement(element) 279 ? !isNaN(tabIndex) && tabIndex >= 0 || ASPx.ElementContainsCssClass(element, ASPx.BootstrapCssSelectors.FormControl) 280 : false; 281 }, 282 CanApplyInvalidStyleToElement: function(element) { 283 var editor = this.editor; 284 var isEditorInputElement = editor.GetInputElement() == element 285 || editor.GetPasswordNullTextInputElement && editor.GetPasswordNullTextInputElement() == element; 286 var isFormControlElement = isEditorInputElement || ASPx.ElementContainsCssClass(element, ASPx.BootstrapCssSelectors.FormControl); 287 var isCheckInputElement = ASPx.ElementContainsCssClass(element, "form-check-input") 288 || ASPx.ElementContainsCssClass(element, "custom-control-input"); 289 return (isFormControlElement || isCheckInputElement) != ASPx.BootstrapCore.IsBootstrap3; 290 }, 291 ApplyFocusedStyle: function(element, inner) { 292 var focusedInvalidStyleApplied = !this.editor.GetIsValid() && this.editor.focused && this.editor.customValidationEnabled; 293 if(!focusedInvalidStyleApplied && this.CanApplyFocusedStyleToElement(element)) 294 ASPx.TextEditorStyleDecoration.prototype.ApplyFocusedStyle.call(this, element, true); 295 }, 296 ApplyFocusedInvalidStyle: function(element) { 297 if(this.CanApplyFocusedStyleToElement(element) && this.HasDecoration("FI")) 298 this.ApplyDecoration("FI", element, true, this.editor.focused && !this.editor.GetIsValid()); 299 }, 300 ApplyInvalidStyle: function(element, inner) { 301 if(this.CanApplyInvalidStyleToElement(element)) 302 ASPx.TextEditorStyleDecoration.prototype.ApplyInvalidStyle.call(this, element, true); 303 this.ApplyFocusedInvalidStyle(element); 304 }, 305 ApplyNullTextStyle: function(element, inner) { 306 if(this.CanApplyNullTextStyleToElement(element)) 307 ASPx.TextEditorStyleDecoration.prototype.ApplyNullTextStyle.call(this, element, true); 308 }, 309 ApplyNullTextClassName: function(active) { 310 var nullTextClassName = this.GetNullTextClassName(); 311 var inputElement = this.editor.GetInputElement(); 312 if(active) 313 ASPx.AddClassNameToElement(inputElement, nullTextClassName); 314 else 315 ASPx.RemoveClassNameFromElement(inputElement, nullTextClassName); 316 }, 317 Update: function() { 318 if(this.IsUpdateLocked()) 319 return; 320 var mainElement = this.editor.GetMainElement(); 321 for(var i = 0; i < this.postfixList.length; i++) { 322 var postfix = this.postfixList[i]; 323 var elements = postfix.length ? mainElement.querySelectorAll(postfix) : [ mainElement ]; 324 for(var j = 0; j < elements.length; j++) 325 if(elements[j])
326 this.ApplyStyles(elements[j], true); 327 } 328 }, 329 IsInputElement: function(element) { 330 var tagName = element.tagName.toUpperCase(); 331 return tagName == "TEXTAREA" || tagName == "INPUT" || tagName == "SELECT"; 332 } 333 }); 334 BootstrapEditorStyleDecoration.UpdateDefaultDecorationStyles = function(keys) { 335 var container = document.createElement("DIV"); 336 ASPx.Attr.SetAttribute(container, 337 "style", "overflow:hidden;position:fixed;z-index:10000;top:0;left:0;opacity:0;"); 338 document.body.appendChild(container); 339 var inputElement = document.createElement("INPUT"); 340 inputElement.type = "text"; 341 ASPx.Attr.SetAttribute(inputElement, 342 "style", "transition:none!important;-webkit-transition:none!important;-o-transition:none!important;"); 343 container.appendChild(inputElement); 344 resetDefaultDecorationStyles(keys); 345 if(!keys || !keys.length) 346 keys = ["N", "I", "F", "FI"]; 347 for(var key, i = 0; key = keys[i]; i++) 348 updateDefaultStyleDecoration(key, inputElement, container); 349 document.body.removeChild(container); 350 }; 351 function resetDefaultDecorationStyles(keys) { 352 if(!keys || !keys.length) 353 keys = ASPx.GetObjectKeys(defaultDecorationStyles); 354 for(var key, i = 0; key = keys[i]; i++) { 355 if(defaultDecorationStyles[key]) 356 defaultDecorationStyles[key].isValid = false; 357 } 358 } 359 function updateDefaultStyleDecoration(key, input, inputContainer) { 360 var defaultNullTextClassName = "text-muted"; 361 var defaultInvalidClassName = ASPx.BootstrapCore.IsBootstrap3 ? ASPx.BootstrapCssSelectors.HasError : ASPx.BootstrapCssSelectors.InvalidFormControl; 362 switch(key) { 363 case "N": 364 if(ASPx.BootstrapCore.IsBootstrap3) { 365 ASPx.SetClassName(input, defaultNullTextClassName); 366 setDefaultStyleDecoration(key, "", getDecorationStyleRuleCssText(ASPx.GetCurrentStyle(input), ["color", "opacity", "text-shadow"])); 367 } 368 else 369 setDefaultStyleDecoration(key, defaultNullTextClassName); 370 break; 371 case "I": 372 setDefaultStyleDecoration(key, defaultInvalidClassName); 373 break; 374 case "F": 375 case "FI": 376 if(document.hasFocus()) { 377 ASPx.SetClassName(input, ASPx.BootstrapCssSelectors.FormControl); 378 if(key == "FI") 379 ASPx.AddClassNameToElement(ASPx.BootstrapCore.IsBootstrap3 ? inputContainer : input, defaultInvalidClassName); 380 setDefaultStyleDecoration(key, "", getEditorFocusedStyleRuleCssText(input)); 381 } 382 break; 383 default: 384 break; 385 } 386 } 387 function setDefaultStyleDecoration(key, cssClass, cssText) { 388 if(defaultDecorationStyles[key]) { 389 if(cssClass) 390 defaultDecorationStyles[key].className = cssClass; 391 else { 392 var rule = ASPx.GetStyleSheetRules(defaultDecorationStyles[key].className); 393 if(rule) 394 rule.style.cssText = ASPx.CreateImportantCssText(cssText); 395 } 396 defaultDecorationStyles[key].isValid = true; 397 } 398 else { 399 if(!cssClass && cssText) 400 cssClass = ASPx.Str.Trim(ASPx.CreateImportantStyleRule(ASPx.GetCurrentStyleSheet(), cssText)); 401 defaultDecorationStyles[key] = createDefaultStyleDecoration(cssClass); 402 } 403 } 404 function createDefaultStyleDecoration(cssClass) { 405 return { className: cssClass, isValid: true }; 406 } 407 function getEditorFocusedStyleRuleCssText(inputElement) { 408 var focusedElement = ASPx.GetFocusedElement(); 409 inputElement.focus(); 410 var focusedStyle = ASPx.GetCurrentStyle(inputElement); 411 var cssText = getDecorationStyleRuleCssText(focusedStyle, [ 412 "border-top-width", "border-top-style", "border-top-color", 413 "border-left-width", "border-left-style", "border-left-color", 414 "border-bottom-width", "border-bottom-style", "border-bottom-color", 415 "border-right-width", "border-right-style", "border-right-color", 416 "outline-width", "outline-style", "outline-color", "outline-offset", 417 "box-shadow", "-webkit-box-shadow" 418 ]); 419 inputElement.blur(); 420 if(focusedElement) 421 ASPx.SetFocus(focusedElement); 422 return cssText; 423 } 424 function getDecorationStyleRuleCssText(currentStyle, styleProperties) { 425 var rules = [ ]; 426 for(var i = 0; i < styleProperties.length; i++) { 427 var stylePropertyValue = ASPx.Str.Trim(currentStyle.getPropertyValue(styleProperties[i])
427) + ""; 428 if(stylePropertyValue) 429 rules.push(styleProperties[i] + ": " + stylePropertyValue); 430 } 431 return rules.join(";"); 432 } 433 ASPx.BootstrapEditorStyleDecoration = BootstrapEditorStyleDecoration; 434 var styleUpdateListeners = []; 435 BootstrapClientUtils = {}; 436 BootstrapClientUtils.UpdateDefaultStyles = function() { 437 ASPx.BootstrapEditorStyleDecoration.UpdateDefaultDecorationStyles(); 438 ASPx.BootstrapCore.updateTableCellStyleSheetRules(); 439 ASPx.BootstrapCore.initializeAccentColorRelatedSelectors(); 440 for(var i = 0; i < styleUpdateListeners.length; i++) 441 styleUpdateListeners[i].beginStyleUpdate(); 442 for(var i = 0; i < styleUpdateListeners.length; i++) 443 styleUpdateListeners[i].updateStyle(); 444 for(var i = 0; i < styleUpdateListeners.length; i++) 445 styleUpdateListeners[i].endStyleUpdate(); 446 }; 447 BootstrapClientUtils.attachToUpdateDefaultStylesRequest = function(styleUpdateListener) { 448 styleUpdateListeners.push(styleUpdateListener); 449 }; 450 BootstrapClientUtils.detachUpdateDefaultStylesRequestListener = function(styleUpdateListener) { 451 ASPx.Data.ArrayRemove(styleUpdateListeners, styleUpdateListener); 452 }; 453 BootstrapClientUtils.GetChangeButtonEnabledAttributesMethod = function(enabled) { 454 return enabled 455 ? function(element, className) { 456 if(element.tagName == "BUTTON") 457 ASPx.Attr.RemoveAttribute(element, "disabled"); 458 else 459 ASPx.RemoveClassNameFromElement(element, className); 460 } 461 : function(element, className) { 462 if(element.tagName == "BUTTON") 463 ASPx.Attr.SetAttribute(element, "disabled", "disabled"); 464 else 465 ASPx.AddClassNameToElement(element, className); 466 }; 467 }; 468 var BootstrapEditFeedbackRenderHelper = ASPx.CreateClass(null, { 469 constructor: function(editor) { 470 this.editor = editor; 471 }, 472 getErrorImage: function() { 473 var editorElement = this.editor.GetMainElement(); 474 return editorElement && editorElement.querySelector("[data-error-image]"); 475 }, 476 getClearButton: function() { 477 var editorElement = this.editor.GetMainElement(); 478 return editorElement && editorElement.querySelector(BootstrapEditFeedbackRenderHelper.FeedbackSelector + " > .dxbs-clear-btn"); 479 }, 480 getErrorTextElement: function() { 481 var editorElement = this.editor.GetMainElement(); 482 return editorElement && editorElement.querySelector(".dxbs-edit-error-text"); 483 }, 484 setElementVisible: function(element, value) { 485 if(element && ASPx.ElementHasCssClass(element, ASPx.BootstrapCssSelectors.Hidden) == value) { 486 var action = value ? ASPx.RemoveClassNameFromElement : ASPx.AddClassNameToElement; 487 action(element, ASPx.BootstrapCssSelectors.Hidden); 488 this.updateInputRightPadding(); 489 } 490 }, 491 setClearButtonVisible: function(value) { 492 var clearButton = this.getClearButton(); 493 if(!clearButton) 494 return; 495 if(this.editor.clearButtonDisplayMode === 'Always' && ASPx.Attr.GetAttribute(clearButton, "role") == "button") 496 this.editor.SetAccessibilityAnchorEnabled(clearButton, value); 497 this.setElementVisible(clearButton, value); 498 }, 499 setErrorControlVisible: function(value) { 500 var errorTextElement = this.getErrorTextElement(); 501 if(errorTextElement) 502 this.setElementVisible(errorTextElement, value); 503 if(this.editor.errorDisplayMode == "i") 504 this.setErrorImageVisible(value); 505 }, 506 setErrorImageVisible: function(value) { 507 var errorImage = this.getErrorImage(); 508 if(errorImage) { 509 if(!this.getErrorTextElement() && !ASPx.BootstrapCore.IsBootstrap3) { 510 var feedbackControl = this.editor.GetMainElement().querySelector(BootstrapEditFeedbackRenderHelper.FeedbackSelector); 511 var action = value ? ASPx.AddClassNameToElement : ASPx.RemoveClassNameFromElement; 512 action(feedbackControl || errorImage, ASPx.BootstrapCssSelectors.InvalidFeedback); 513 } 514 this.setElementVisible(errorImage, value); 515 if(!value) { 516 ASPx.Attr.RemoveAttribute(errorImage, "title"); 517 ASPx.Attr.RemoveAttribute(errorImage, "data-error-tooltip"); 518 } 519 else 520 this.updateErrorText(); 521 } 522 }, 523 updateErrorText: function() { 524 var errorText = this.editor.HtmlEncode(this.editor.errorText); 525 var errorTextElement = this.getErrorTextElement(); 526 if(errorTextElement) { 527 var textNode = ASPx.GetNormalizedTextNode(errorTextElement); 528 if(textNode) { 529 textNode.nodeValue = errorText; 530 return; 531 } 532 } 533 var errorImage = this.getErrorImage(); 534 if(errorImage) { 535 ASPx.Attr.SetAttribute(errorImage, "title", errorText); 536 if(ASPx.Browser.TouchUI) { 537 var x = ASPx.GetAbsolutePositionX(errorImage); 538 var docWidth = ASPx.Browser.WebKitTouchUI ? window.innerWidth : ASPx.GetDocumentClientWidth(); 539 var availableWidth = this.editor.isASPxClientCheckEdit ? docWidth - x - errorImage.offsetWidth : x; 540 if(availableWidth > 0) { 541 var fontSize = ASPx.GetCurrentStyle(errorImage).fontSize; 542 ASPx.Attr.SetAttribute(errorImage, "data-error-tooltip", this.formatErrorText(errorText, availableWidth, fontSize)); 543 } 544 } 545 } 546 }, 547 formatErrorText: function(errorText, availableWidth, fontSize) { 548 var errorTextSize = ASPx.GetSizeOfText(errorText, { 549 fontFamily: '"Helvetica Neue", Helvetica, Arial, sans-serif', 550 fontSize: 'calc(0.75 * ' + fontSize + ')', 551 fontWeight: "normal", 552 letterSpacing: "normal", 553 lineHeight: "2" 554 }).width + 1.2 * ASPx.PxToInt(fontSize); 555 if(errorTextSize > availableWidth) { 556 var availableCharCount = Math.floor(errorText.length * availableWidth / errorTextSize); 557 if(availableCharCount) { 558 var errorTextRows = []; 559 while(errorText && errorText.length) { 560 var textRow = errorText.substr(0, availableCharCount); 561 var spacesAtStart = /(^\s+)\S/.exec(textRow); 562 if(spacesAtStart) 563 textRow = errorText.substr(0, availableCharCount + spacesAtStart[1].length); 564 var spacesAtEnd = /(\s+)\S{1,4}$/.exec(textRow);
565 if(spacesAtEnd && spacesAtEnd.index) 566 textRow = errorText.slice(0, spacesAtEnd.index + spacesAtEnd[1].length); 567 errorTextRows.push(ASPx.Str.TrimStart(textRow)); 568 errorText = errorText.replace(textRow, ""); 569 } 570 errorText = errorTextRows.join("\n"); 571 } 572 } 573 return errorText; 574 }, 575 updateInputRightPadding: function() { 576 if(this.editor.isASPxClientTextEdit) { 577 var feedbackControl = this.editor.GetMainElement().querySelector(BootstrapEditFeedbackRenderHelper.FeedbackSelector); 578 if(feedbackControl) { 579 var feedbackWidth = feedbackControl.offsetWidth; 580 var formControl = this.editor.GetFormControlElement ? this.editor.GetFormControlElement() : this.editor.GetInputElement(); 581 formControl.style["padding-right"] = feedbackWidth ? feedbackWidth + "px" : ""; 582 if(this.editor.UpdateDropDownOnFeedbackChanged) 583 this.editor.UpdateDropDownOnFeedbackChanged(); 584 } 585 } 586 } 587 }); 588 BootstrapEditFeedbackRenderHelper.FeedbackSelector = "." + ASPx.BootstrapCssSelectors.FormControlFeedback; 589 ASPx.BootstrapEditFeedbackRenderHelper = BootstrapEditFeedbackRenderHelper; 590 var BootstrapTextEditHelpText = ASPx.CreateClass(null, { 591 constructor: function(editor, helpText, animationEnabled, isPopupDisplayMode) { 592 this.editor = editor; 593 this.isPopupDisplayMode = isPopupDisplayMode; 594 this.animationEnabled = animationEnabled; 595 this.createHelpTextElement(helpText); 596 }, 597 createHelpTextElement: function(helpText) { 598 var helpTextElement = document.createElement("SPAN"); 599 ASPx.SetClassName(helpTextElement, ASPx.BootstrapCssSelectors.HelpBlock); 600 ASPx.Security.setInnerHtml(helpTextElement, helpText, ASPx.Security.DataType.Trusted); 601 ASPx.InsertElementAfter(helpTextElement, this.editor.GetHelpTextElementPrevSibling()); 602 if(this.isPopupDisplayMode) { 603 var parentNode = helpTextElement.parentNode; 604 if(parentNode) { 605 var parentStyle = ASPx.GetCurrentStyle(parentNode); 606 if(parentStyle.position != "relative") 607 parentNode.style.position = "relative"; 608 } 609 ASPx.AddClassNameToElement(helpTextElement, "dxbs-popup-help-text mark"); 610 ASPx.SetElementDisplay(helpTextElement, false); 611 } 612 else { 613 ASPx.SetElementDisplay(helpTextElement, this.editor.clientVisible); 614 if(!ASPx.BootstrapCore.IsBootstrap3) 615 ASPx.AddClassNameToElement(helpTextElement, "text-muted"); 616 } 617 this.helpTextElement = helpTextElement; 618 }, 619 show: function() { 620 if(this.isPopupDisplayMode) 621 this.showPopup(); 622 else 623 ASPx.SetElementDisplay(this.helpTextElement, true); 624 }, 625 hide: function() { 626 if(this.isPopupDisplayMode) 627 this.hidePopup(); 628 else 629 ASPx.SetElementDisplay(this.helpTextElement, false); 630 }, 631 showPopup: function() { 632 ASPx.SetElementDisplay(this.helpTextElement, true); 633 if(this.animationEnabled) 634 ASPx.AnimationHelper.fadeIn(this.helpTextElement); 635 else 636 ASPx.AnimationHelper.setOpacity(this.helpTextElement, 1); 637 }, 638 hidePopup: function() { 639 var onHidePopupComplete = function() { 640 ASPx.SetElementDisplay(this.helpTextElement, false); 641 }.aspxBind(this); 642 if(this.animationEnabled) 643 ASPx.AnimationHelper.fadeOut(this.helpTextElement, onHidePopupComplete); 644 else { 645 ASPx.AnimationHelper.setOpacity(this.helpTextElement, 0); 646 onHidePopupComplete(); 647 } 648 } 649 }); 650 ASPx.BootstrapTextEditHelpText = BootstrapTextEditHelpText; 651 var BootstrapCheckBoxInternal = ASPx.CreateClass(null, { 652 constructor: function(mainElement, allowGrayed, allowGrayedByClick, storeValueInInput, inputName) { 653 this.mainElement = mainElement; 654 this.allowGrayed = allowGrayed; 655 this.allowGrayedByClick = allowGrayedByClick; 656 this.storeValueInInput = storeValueInInput; 657 if(this.storeValueInInput) 658 this.stateInput = this.createStateInput(inputName); 659 this.mainInput = this.findMainInput(); 660 this.initializeSiblingLabelElement(); 661 this.initializeIndeterminateState(); 662 this.CheckedChanged = new ASPxClientEvent(); 663 this.Focus = new ASPxClientEvent(); 664 this.LostFocus = new ASPxClientEvent(); 665 this.attachHtmlEvents(); 666 this.updateState(); 667 }, 668 SetValue: function(value) { 669 this.setValueCore(value); 670 }, 671 GetValue: function() { 672 return this.getValueCore(); 673 }, 674 GetChecked: function() { 675 return this.getValueCore() === true; 676 }, 677 SetChecked: function(checked) { 678 this.setValueCore(!!checked); 679 }, 680 SetEnabled: function(enabled) {
681 this.setEnabledCore(enabled); 682 }, 683 GetEnabled: function() { 684 return this.getEnabledCore(); 685 }, 686 GetReadOnly: function() { 687 return false; 688 }, 689 attachHtmlEvents: function() { 690 var isMSBrowser = ASPx.Browser.Edge; 691 ASPx.Evt.AttachEventToElement(this.mainInput, "change", function(evt) { 692 if(this.allowGrayed && this.allowGrayedByClick && isMSBrowser) { 693 ASPx.Evt.PreventEvent(evt); 694 return false; 695 } 696 if(!this.correctNextValue()) 697 this.updateState(); 698 this.CheckedChanged.FireEvent(this, evt); 699 }.bind(this)); 700 ASPx.Evt.AttachEventToElement(this.mainInput, "focus", function(evt) { 701 this.Focus.FireEvent(this, null); 702 }.bind(this)); 703 ASPx.Evt.AttachEventToElement(this.mainInput, "blur", function(evt) { 704 this.LostFocus.FireEvent(this, null); 705 }.bind(this)); 706 ASPx.Evt.AttachEventToElement(this.mainInput, "click", function(evt) { 707 if (this.GetReadOnly()) { 708 ASPx.Evt.PreventEvent(evt); 709 return false; 710 } 711 if(this.allowGrayed && isMSBrowser) { 712 var raiseCheckedChanged = false; 713 if(this.allowGrayedByClick && this.lastValue) { 714 this.setValueCore(false); 715 raiseCheckedChanged = true; 716 } 717 else if(this.correctNextValue()) { 718 this.updateState(); 719 raiseCheckedChanged = true; 720 } 721 if(raiseCheckedChanged) 722 this.CheckedChanged.FireEvent(this, evt); 723 } 724 }.bind(this)); 725 }, 726 invokeClick: function() { 727 if(this.mainInput){ 728 this.mainInput.focus(); 729 this.mainInput.click(); 730 } 731 }, 732 correctNextValue: function() { 733 if(!this.allowGrayed) 734 return; 735 if(this.allowGrayedByClick && this.lastValue === false){ 736 this.setValueCore(null); 737 return true; 738 } 739 if(this.lastValue === null) { 740 this.setValueCore(true); 741 return true; 742 } 743 }, 744 findMainInput: function() { 745 return this.mainElement.querySelectorAll("[type=checkbox]")[0] || this.mainElement.querySelectorAll("[type=radio]")[0]; 746 }, 747 createStateInput: function (inputName) { 748 var input = ASPx.CreateHiddenField(inputName, this.mainElement.id + "_S"); 749 this.mainElement.appendChild(input); 750 return input; 751 }, 752 initializeIndeterminateState: function() { 753 if(ASPx.Attr.GetAttribute(this.mainInput, "data-value") === "indeterminate") { 754 ASPx.Attr.RemoveAttribute(this.mainInput, "data-value"); 755 this.mainInput.indeterminate = true; 756 } 757 }, 758 initializeSiblingLabelElement: function() { 759 if(this.mainInput && this.mainInput.id) { 760 var siblingLabel = this.mainElement.querySelectorAll("[type=checkbox]+label, label+[type=checkbox], [type=radio]+label, label+[type=radio]")[0]; 761 if(siblingLabel) 762 ASPx.Attr.SetAttribute(siblingLabel, "for", this.mainInput.id); 763 } 764 }, 765 setValueCore: function(value) { 766 if(value === true || value === ASPx.CheckBoxInputKey.Checked) { 767 this.mainInput.checked = true; 768 this.mainInput.indeterminate = false; 769 this.updateState(true); 770 } 771 else if(value === false || value === ASPx.CheckBoxInputKey.Unchecked) { 772 this.mainInput.checked = false; 773 this.mainInput.indeterminate = false; 774 this.updateState(false); 775 } 776 else if(value === null || value === ASPx.CheckBoxInputKey.Indeterminate) { 777 this.mainInput.indeterminate = true; 778 this.updateState(null); 779 } 780 }, 781 getValueCore: function() { 782 var mainInput = this.mainInput; 783 if(mainInput.indeterminate) 784 return null; 785 return mainInput.checked; 786 }, 787 setEnabledCore: function(enabled) { 788 if(enabled) { 789 ASPx.RemoveClassNameFromElement(this.mainElement, ASPx.BootstrapCssSelectors.Disabled); 790 ASPx.Attr.RemoveAttribute(this.mainInput, "disabled"); 791 if(this.stateInput) 792 ASPx.Attr.RemoveAttribute(this.stateInput, "disabled"); 793 } 794 else { 795 ASPx.AddClassNameToElement(this.mainElement, ASPx.BootstrapCssSelectors.Disabled); 796 ASPx.Attr.SetAttribute(this.mainInput, "disabled", "disabled"); 797 if(this.stateInput) 798 ASPx.Attr.SetAttribute(this.stateInput, "disabled", "disabled"); 799 } 800 }, 801 getEnabledCore: function() { 802 return !ASPx.Attr.GetAttribute(this.mainInput, "disabled"); 803 }, 804 updateState: function(value) { 805 value = value === undefined ? this.getValueCore() : value; 806 this.lastValue = value; 807 var stateInput = this.stateInput; 808 if(stateInput) { 809 if(value === true) 810 stateInput.value = ASPx.CheckBoxInputKey.Checked; 811 else if(value === false) 812 stateInput.value = ASPx.CheckBoxInputKey.Unchecked; 813 else 814 stateInput.value = ASPx.CheckBoxInputKey.Indeterminate; 815 } 816 } 817 }); 818 var BootstrapCheckBoxInternalCollection = ASPx.CreateClass(ASPx.CollectionBase, {
819 constructor: function(allowGrayed, allowGrayedByClick, storeValueInInput) { 820 this.constructor.prototype.constructor.call(this); 821 this.allowGrayed = !!allowGrayed; 822 this.allowGrayedByClick = !!allowGrayedByClick; 823 this.storeValueInInput = !!storeValueInInput; 824 }, 825 Add: function(key, mainElement) { 826 this.Remove(key); 827 var checkBox = this.createInternalCheckBox(key, mainElement); 828 ASPx.CollectionBase.prototype.Add.call(this, key, checkBox); 829 return checkBox; 830 }, 831 createInternalCheckBox: function(key, mainElement) { 832 return new BootstrapCheckBoxInternal(mainElement, this.allowGrayed, this.allowGrayedByClick, this.storeValueInInput); 833 } 834 }); 835 ASPx.BootstrapCheckBoxInternal = BootstrapCheckBoxInternal; 836 ASPx.BootstrapCheckBoxInternalCollection = BootstrapCheckBoxInternalCollection; 837 var BootstrapLoadingPanelManager = {}; 838 var loadingPanels = {}; 839 var loadingDivs = {}; 840 BootstrapLoadingPanelManager.getLoadingPanel = function(name, settings, inline) { 841 if(!settings) return null; 842 var lpID = name + "_LP"; 843 if(!loadingPanels[lpID]){ 844 var lp = document.createElement("DIV"); 845 lp.id = lpID; 846 ASPx.SetClassName(lp, ASPx.Str.Trim([ 847 "dxbs-lp" + (inline ? " dxbs-lp-inline" : ""), 848 ASPx.HiddenChangable, ASPx.BootstrapCssSelectors.Panel, ASPx.BootstrapCssSelectors.PanelDefault 849 ].join(" "))); 850 var lpBody = document.createElement("DIV"); 851 ASPx.SetClassName(lpBody, ASPx.BootstrapCssSelectors.PanelBody); 852 if(settings.showImage !== false) { 853 var lpImg = document.createElement("SPAN"); 854 var imgCssClass = settings.imageCssClass ? settings.imageCssClass : "dxbs-icon dxbs-icon-refresh"; 855 ASPx.SetClassName(lpImg, "image " + imgCssClass); 856 lpBody.appendChild(lpImg); 857 } 858 if(settings.text !== "") { 859 var breakHtml = ""; 860 var textHtml = "<span>" + (settings.text || "Loading…") + "</span>"; 861 if(settings.imagePosition && (settings.imagePosition === "Top" || settings.imagePosition === "Bottom")) 862 breakHtml = "<br />"; 863 if(settings.imagePosition && (settings.imagePosition === "Right" || settings.imagePosition === "Bottom")) 864 ASPx.Security.setInnerHtml(lpBody, textHtml + breakHtml + lpBody.innerHTML, ASPx.Security.DataType.Trusted); 865 else 866 ASPx.Security.setInnerHtml(lpBody, lpBody.innerHTML + breakHtml + textHtml, ASPx.Security.DataType.Trusted); 867 } 868 lp.appendChild(lpBody); 869 loadingPanels[lpID] = lp; 870 } 871 return loadingPanels[lpID]; 872 }; 873 BootstrapLoadingPanelManager.getLoadingDiv = function(name, settings){ 874 if(!settings || settings.fade === false) return null; 875 var ldID = name + "_LD"; 876 if(!loadingDivs[ldID]){ 877 var ld = document.createElement("DIV"); 878 ld.id = ldID; 879 ASPx.SetClassName(ld, "dxbs-ld " + ASPx.HiddenChangable); 880 loadingDivs[ldID] = ld; 881 } 882 return loadingDivs[ldID]; 883 }; 884 ASPx.BootstrapLoadingPanelManager = BootstrapLoadingPanelManager; 885 var BootstrapOverlayManager = {}; 886 BootstrapOverlayManager.createOverlay = function(name, settings) { 887 var overlay = document.createElement("DIV"); 888 overlay.id = name + "_OV"; 889 ASPx.SetClassName(overlay, ASPx.BootstrapCssSelectors.ModalBackdrop + " dxbs-modal-back" + (settings.cssClass ? " " + settings.cssClass : "")); 890 return overlay; 891 }; 892 ASPx.BootstrapOverlayManager = BootstrapOverlayManager; 893 var BootstrapBadgeManager = ASPx.CreateClass(ASPx.BadgeManagerBase, { 894 getBadgeClassName: function() { 895 return ASPx.BootstrapCssSelectors.Badge; 896 }, 897 getBadgeIconDefaultClassName: function() { 898 return "image"; 899 }, 900 createBadgeForButton: function(button, toLeftSide) { 901 var badge = this.createBadge(); 902 if(!ASPx.BootstrapCore.IsBootstrap3) { 903 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgePill); 904 if (ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonDanger)) { 905 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgeLight); 906 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.TextDanger); 907 } 908 else if(ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonSecondary) || ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonOutlineSecondary)) 909 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgeDark); 910 else if(ASPx.ElementHasCssClass(button, ASPx.BootstrapCssSelectors.ButtonLink)) 911 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.BadgePrimary); 912 else 913 ASPx.AddClassNameToElement(badge, ASPx.BootstrapCssSelectors.TextPrimary); 914 } 915 if(toLeftSide) 916 button.insertBefore(badge, button.childNodes[0]); 917 else 918 button.appendChild(badge); 919 return badge; 920 }, 921 updateToolbarItemBadge: function(item, count) { 922 var button = item.menu.IsEnabledAdaptivity() ? item.itemViewModel.getElement() : item.menu.GetItemContentElement(item.indexPath); 923 var badge = this.findBadge(button); 924 if(!badge) 925 badge = this.createBadgeForButton(button); 926 if(badge) 927 this.setBadgeText(badge, count > 0 ? count : ""); 928 } 929 }); 930 ASPx.BootstrapBadgeManager = new BootstrapBadgeManager(); 931 var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
931+/="; 932 var getBase64Char = function(index) { 933 return BASE64_CHARS.charAt(index); 934 }; 935 var getIndexOfBase64Char = function(char) { 936 return BASE64_CHARS.indexOf(char); 937 }; 938 var codeArrayToString = function(codes) { 939 return codes.map(function(code) { return String.fromCharCode(code); }).join(""); 940 }; 941 var base64_encode = function(input) { 942 var result = ""; 943 if (!$.isArray(input)) 944 input = stringToByteArray(String(input)); 945 for (var i = 0; i < input.length; i += 3) { 946 var octet1 = input[i], 947 octet2 = input[i + 1], 948 octet3 = input[i + 2]; 949 result += $.map([octet1 >> 2, (3 & octet1) << 4 | octet2 >> 4, isNaN(octet2) ? 64 : (15 & octet2) << 2 | octet3 >> 6, isNaN(octet3) ? 64 : 63 & octet3], getBase64Char).join(""); 950 } 951 return result; 952 }; 953 var base64_decode = function(input) { 954 var result = ""; 955 input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); 956 for (var i = 0; i < input.length; i += 4) { 957 var bytes = []; 958 var octet1 = getIndexOfBase64Char(input.charAt(i)), 959 octet2 = getIndexOfBase64Char(input.charAt(i + 1)), 960 octet3 = getIndexOfBase64Char(input.charAt(i + 2)), 961 octet4 = getIndexOfBase64Char(input.charAt(i + 3)); 962 bytes.push((octet1 << 2) | (octet2 >> 4)); 963 if(octet3 != 64) 964 bytes.push(((octet2 & 15) << 4) | (octet3 >> 2)); 965 if(octet4 != 64) 966 bytes.push(((octet3 & 3) << 6) | octet4); 967 result += codeArrayToString(bytes); 968 } 969 return decodeText(result); 970 }; 971 var stringToByteArray = function(str) { 972 var bytes = []; 973 var code = 0; 974 for (var i = 0; i < str.length; i++) { 975 code = str.charCodeAt(i); 976 if (code < 128) { 977 bytes.push(code); 978 } else { 979 if (code < 2048) { 980 bytes.push(192 + (code >> 6), 128 + (63 & code)); 981 } else { 982 if (code < 65536) { 983 bytes.push(224 + (code >> 12), 128 + (code >> 6 & 63), 128 + (63 & code)); 984 } else { 985 if (code < 2097152) { 986 bytes.push(240 + (code >> 18), 128 + (code >> 12 & 63), 128 + (code >> 6 & 63), 128 + (63 & code)); 987 } 988 } 989 } 990 } 991 } 992 return bytes; 993 }; 994 var decodeText = function(codeText) { 995 var bytes = []; 996 var code = 0, 997 code2 = 0, 998 code3 = 0; 999 for (var i = 0; i < codeText.length; i++) { 1000 code = codeText.charCodeAt(i); 1001 if (code < 128) { 1002 bytes.push(code); 1003 } else { 1004 i += 1; 1005 code2 = codeText.charCodeAt(i); 1006 if((code > 191) && (code < 224)) { 1007 bytes.push(((code & 31) << 6) | (code2 & 63)); 1008 } else { 1009 i += 1; 1010 code3 = codeText.charCodeAt(i); 1011 bytes.push(((code & 15) << 12) | ((code2 & 63) << 6) | (code3 & 63));
1012 } 1013 } 1014 } 1015 return codeArrayToString(bytes); 1016 }; 1017 ASPx.Base64 = {}; 1018 ASPx.Base64.Encode = base64_encode; 1019 ASPx.Base64.Decode = base64_decode; 1020 dx.BootstrapClientUtils = BootstrapClientUtils; 1021 ASPx.BootstrapDockManager = ASPx.CreateSingleton(function(ASPx) { 1022 var showCssClass = "show", 1023 matrixRegex = "\\s*matrix\\(\\s*" + ([0, 0, 0, 0, 0, 0].map(function() { return "(\\-?\\d+\\.?\\d*)"; }).join(",\\s*")) + "\\)\\s*"; 1024 function parseTranslateInfo(styles) { 1025 var m = new RegExp(matrixRegex).exec(styles.transform); 1026 return m ? { left: parseInt(m[5]), top: parseInt(m[6]) } : { left: 0, top: 0 }; 1027 } 1028 function getBoundingBox(x, y, w, h) { return { left: x, top: y, right: x + w, bottom: y + h, width: w, height: h }; } 1029 function getSafeBoundingBox(element, roundLT, roundRB) { 1030 var box = element.getBoundingClientRect(); 1031 var safeBox = { left: roundLT(box.left), top: roundLT(box.top), right: roundRB(box.right), bottom: roundRB(box.bottom) }; 1032 safeBox.width = safeBox.right - safeBox.left; 1033 safeBox.height = safeBox.bottom - safeBox.top; 1034 return safeBox; 1035 } 1036 function getOuterBoundingBox(element) { 1037 return getSafeBoundingBox(element, Math.floor, Math.ceil); 1038 } 1039 function getInnerBoundingBox(element) { 1040 return getSafeBoundingBox(element, Math.ceil, Math.floor); 1041 } 1042 var DockPoint = ASPx.CreateClass(null, { 1043 constructor: function (key, info) { 1044 this.key = key; 1045 this.info = info; 1046 }, 1047 checkMargin: function () { return true; }, 1048 allowScroll: function () { return this.info.size === "height"; }, 1049 canApplyToElement: function(element) { return ASPx.GetClassName(element).indexOf("dxbs-align-" + this.key) > -1; }, 1050 getRange: function (dockInfo) { 1051 var c1 = this.getTargetBox(dockInfo)[this.info.to]; 1052 var c2 = c1 + this.info.sizeM * (dockInfo.elementBox[this.info.size] + (this.checkMargin() ? dockInfo.margin : 0)); 1053 return { 1054 from: Math.min(c1, c2), 1055 to: Math.max(c1, c2), 1056 windowOverflow: 0 1057 }; 1058 }, 1059 getTargetBox: function (dockInfo) { return null; }, 1060 validate: function (range, windowInfo) { 1061 var windowSize = windowInfo[this.info.size]; 1062 range.windowOverflow = Math.abs(Math.min(0, range.from - windowSize.from) + Math.min(0, windowSize.to - range.to)); 1063 range.validTo = Math.min(range.to, windowSize.to); 1064 range.validFrom = Math.max(range.from, windowSize.from); 1065 return range.windowOverflow === 0; 1066 }, 1067 applyRange: function (range, dockInfo) { 1068 dockInfo.appliedModifierKeys[this.info.size] = this.key; 1069 var side = this.info.size === "width" ? "left" : "top"; 1070 var style = dockInfo.styles; 1071 var from = range.from; 1072 if (this.allowScroll() && range.windowOverflow > 0) { 1073 if (!dockInfo.limitBox.scroll.width) { 1074 dockInfo.limitBox.scroll.width = true; 1075 dockInfo.limitBox.width.to -= ASPx.GetVerticalScrollBarWidth(); 1076 } 1077 if (dockInfo.isScrollable) { 1078 style["max-height"] = dockInfo.height - range.windowOverflow + "px"; 1079 dockInfo.width += ASPx.GetVerticalScrollBarWidth(); 1080 dockInfo.elementBox.width += ASPx.GetVerticalScrollBarWidth(); 1081 from = range.validFrom; 1082 } 1083 } 1084 style.width = dockInfo.width + "px"; 1085 if(this.checkMargin()) 1086 from += Math.max(0, this.info.sizeM) * dockInfo.margin; 1087 dockInfo.elementBox[side] += from; 1088 style["transform"] = 1089 "matrix(1, 0, 0, 1, " + dockInfo.elementBox.left + ", " + dockInfo.elementBox.top + ")"; 1090 }, 1091 dockElementToTarget: function (dockInfo) { 1092 var range1 = this.getRange(dockInfo); 1093 if (!this.dockElementToTargetInternal(range1, dockInfo)) 1094 this.applyRange(range1, dockInfo); 1095 }, 1096 dockElementToTargetInternal: function (range1, dockInfo) { } 1097 }); 1098 var OuterDockPoint = ASPx.CreateClass(DockPoint, { 1099 constructor: function (name, info, oppositePointName) { 1100 this.constructor.prototype.constructor.apply(this, arguments); 1101 this.oppositePointName = oppositePointName || null; 1102 }, 1103 getTargetBox: function (dockInfo) { return dockInfo.targetBox.outer; }, 1104 getOppositePoint: function () { 1105 return this._oppositePoint || (this._oppositePoint = dockPoints.filter(function (d) { 1106 return d.key === this.oppositePointName; 1107 }.bind(this))[0]); 1108 }, 1109 dockElementToTargetInternal: function (range1, dockInfo) { 1110 if (this.validate(range1, dockInfo.limitBox)) 1111 this.applyRange(range1, dockInfo); 1112 else { 1113 var oppositePoint = this.getOppositePoint(); 1114 var range2 = oppositePoint.getRange(dockInfo); 1115 if (oppositePoint.validate(range2, dockInfo.limitBox) || range2.windowOverflow < range1.windowOverflow) 1116 oppositePoint.applyRange(range2, dockInfo); 1117 else 1118 return false; 1119 } 1120 return true; 1121 } 1122 }); 1123 var InnerDockPoint = ASPx.CreateClass(DockPoint, { 1124 checkMargin: function () { return false; }, 1125 getTargetBox: function (dockInfo) { return dockInfo.targetBox.inner; }, 1126 dockElementToTargetInternal: function (range1, dockInfo) { 1127 this.validate(range1, dockInfo.limitBox); 1128 return false; 1129 },
1130 validate: function (range, windowInfo) { 1131 var toOverflow = Math.min(range.from, Math.max(0, range.to - windowInfo[this.info.size].to)); 1132 if (toOverflow > 0) { 1133 range.from -= toOverflow; 1134 range.to -= toOverflow; 1135 } 1136 return DockPoint.prototype.validate.call(this, range, windowInfo); 1137 } 1138 }); 1139 var dockPoints = [ 1140 new OuterDockPoint("above", { to: "top", from: "bottom", size: "height", sizeM: -1 }, "below"), 1141 new OuterDockPoint("below", { to: "bottom", from: "top", size: "height", sizeM: 1 }, "above"), 1142 new InnerDockPoint("top-sides", { to: "top", from: "top", size: "height", sizeM: 1 }), 1143 new InnerDockPoint("bottom-sides", { to: "bottom", from: "bottom", size: "height", sizeM: -1 }), 1144 new OuterDockPoint("outside-left", { to: "left", from: "right", size: "width", sizeM: -1 }, "outside-right"), 1145 new OuterDockPoint("outside-right", { to: "right", from: "left", size: "width", sizeM: 1 }, "outside-left"), 1146 new InnerDockPoint("left-sides", { to: "left", from: "left", size: "width", sizeM: 1 }), 1147 new InnerDockPoint("right-sides", { to: "right", from: "right", size: "width", sizeM: -1 }) 1148 ]; 1149 var defaultHorizontalItemDockPoints = [dockPoints[1], dockPoints[6]], 1150 defaultVerticalItemDockPoints = [dockPoints[2], dockPoints[5]]; 1151 function getElementPopupInfo(element, targetElement, isVertical, settings) { 1152 var elementStyle = ASPx.GetCurrentStyle(element); 1153 var box = getOuterBoundingBox(element); 1154 var docEl = element.ownerDocument.documentElement; 1155 var result = { 1156 isScrollable: ASPx.ElementHasCssClass(element, "dxbs-scrollable"), 1157 specifiedOffsetModifiers: dockPoints.filter(function (m) { return m.canApplyToElement(element); }), 1158 margin: ASPx.PxToInt(elementStyle.marginTop), 1159 width: settings ? Math.max(settings.width, Math.ceil(element.offsetWidth)) : Math.ceil(element.offsetWidth), 1160 height: Math.ceil(element.offsetHeight), 1161 appliedModifierKeys: { height: null, width: null } 1162 }; 1163 var styles = parseTranslateInfo(elementStyle); 1164 result.elementBox = getBoundingBox(styles.left - box.left, styles.top - box.top, box.width, box.height); 1165 result.targetBox = { outer: getOuterBoundingBox(targetElement), inner: getInnerBoundingBox(targetElement) }; 1166 result.limitBox = { 1167 scroll: { width: docEl.clientWidth < window.innerWidth, height: docEl.clientHeight < window.innerHeight }, 1168 width: { from: 0, to: docEl.clientWidth }, 1169 height: { from: 0, to: docEl.clientHeight } 1170 }; 1171 result.styles = {}; 1172 var highPriorityModifiersData = ASPx.Attr.GetAttribute(element, "data-popup-align") || settings && settings.align; 1173 if (highPriorityModifiersData) { 1174 var highPriorityModifiers = highPriorityModifiersData.split(/\s+/); 1175 result.offsetModifiers = dockPoints.filter(function (m) { 1176 return highPriorityModifiers.some(function (k) { return m.key === k; }); 1177 }); 1178 } else 1179 result.offsetModifiers = result.specifiedOffsetModifiers.filter(function (m) { return !isVertical; }); 1180 if (result.offsetModifiers.length === 0) 1181 result.offsetModifiers = isVertical ? defaultVerticalItemDockPoints : defaultHorizontalItemDockPoints; 1182 return result; 1183 } 1184 function hide(element) { 1185 if (ASPx.ElementHasCssClass(element, showCssClass)) { 1186 if (element.isDockedElementHidden) 1187 delete element.isDockedElementHidden; 1188 ASPx.DOM.ClearStyles(element); 1189 ASPx.DOM.ToggleCssClass(element, showCssClass, false); 1190 } else if (element.isDockedElementHidden) 1191 delete element.isDockedElementHidden; 1192 } 1193 function show(element, targetElement, isVertical) { 1194 ASPx.DOM.ClearStyles(element); 1195 ASPx.DOM.ToggleCssClass(element, showCssClass, true); 1196 preparePosition(element, targetElement, isVertical, null, function () { });
1197 } 1198 function preparePosition(element, targetElement, isVertical, settings, onShow) { 1199 ASPx.DOM.CalculateStyles(function () { 1200 var dockInfo = getElementPopupInfo(element, targetElement, isVertical, settings); 1201 for (var i = 0; i < dockInfo.offsetModifiers.length; i++) 1202 dockInfo.offsetModifiers[i].dockElementToTarget(dockInfo); 1203 ASPx.DOM.ChangeDOM(function () { onShow(dockInfo); }); 1204 ASPx.DOM.SetStyles(element, dockInfo.styles); 1205 }.bind(this)); 1206 } 1207 return { 1208 getElementPopupInfo: getElementPopupInfo, 1209 hide: hide, 1210 show: show, 1211 preparePosition: preparePosition 1212 }; 1213 }); 1214 ASPx.DOM = ASPx.CreateSingleton(function (ASPx) { 1215 var FrameContext = ASPx.CreateClass(null, { 1216 constructor: function (requestFrame) { 1217 this.requestFrame = requestFrame; 1218 this.cache = [[]]; 1219 this.isInFrame = false; 1220 this.isWaiting = false; 1221 }, 1222 getBuffer: function (order) { 1223 if (!order) order = 0; 1224 if (this.cache.length <= order) this.cache[order] = []; 1225 return this.cache[order]; 1226 }, 1227 execute: function (callback, order) { 1228 if (!this.isInFrame) 1229 return false; 1230 var buffer = this.cache[order || 0]; 1231 if (buffer === null) 1232 callback(requestFrameId); 1233 else 1234 (buffer = this.getBuffer(order)).push(callback); 1235 return true; 1236 }, 1237 runAll: function () { 1238 this.isWaiting = false; 1239 this.isInFrame = true; 1240 for (var i = 0; i < this.cache.length; i++) { 1241 var buffer = this.cache[i]; 1242 if (buffer) { 1243 this.cache[i] = null; 1244 while (buffer.length) 1245 buffer.shift()(requestFrameId); 1246 } 1247 } 1248 this.waitNextFrame(); 1249 }, 1250 waitNextFrame: function () { 1251 this.cache = [[]]; 1252 this.isInFrame = false; 1253 this.isWaiting = false; 1254 }, 1255 requestExecution: function (callback, order) { 1256 if (!this.execute(callback, order)) { 1257 this.getBuffer(order).push(callback); 1258 if (this.isWaiting === false) { 1259 this.isWaiting = true; 1260 this.requestFrame(this.runAll.bind(this)); 1261 } 1262 } 1263 } 1264 }); 1265 var requestFrameId = null; 1266 function requestAnimationFrame(callback) { return requestFrameId = ASPx.RequestAnimationFrame(callback); } 1267 function createAccumulator(requestFrame) { 1268 var context = new FrameContext(requestFrame); 1269 return context.requestExecution.bind(context); 1270 } 1271 var changeDom = createAccumulator(requestAnimationFrame); 1272 var calculateStyles = createAccumulator(function (callback) { changeDom(function () { setTimeout(callback); }); }); 1273 var observers = [], minimumIntervalBetweenChecks = 50; 1274 function itemObserver(element, callback, width) { 1275 return function () { 1276 if (element.compareDocumentPosition(document.body) & Node.DOCUMENT_POSITION_DISCONNECTED) 1277 return false; 1278 var currentStyle = ASPx.GetCurrentStyle(element); 1279 if (currentStyle.width === "auto") 1280 return true; 1281 var w = ASPx.PxToInt(currentStyle.width) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element); 1282 if (width !== w) 1283 callback(width = w); 1284 return true; 1285 }; 1286 } 1287 function subscribeElementContentWidth(el, callback) { 1288 if (observers.length === 0) { 1289 observers.push(itemObserver(el, callback, -1)); 1290 calculateStyles(updateTrackedElements); 1291 } else 1292 observers.push(itemObserver(el, callback, -1)); 1293 } 1294 function elementSizeObserver(element, callback, size) { 1295 return function() { 1296 if(element.compareDocumentPosition(document.body) & Node.DOCUMENT_POSITION_DISCONNECTED) 1297 return false; 1298 var currentStyle = ASPx.GetCurrentStyle(element); 1299 if(currentStyle.width === "auto") 1300 return true; 1301 var elementWidth = ASPx.PxToInt(currentStyle.width) - ASPx.GetLeftRightBordersAndPaddingsSummaryValue(element); 1302 var elementHeight = ASPx.PxToInt(currentStyle.height) - ASPx.GetTopBottomBordersAndPaddingsSummaryValue(element); 1303 if(size.width !== elementWidth || size.height !== elementHeight) { 1304 size.width = elementWidth; 1305 size.height = elementHeight; 1306 callback(size); 1307 } 1308 return true; 1309 }; 1310 } 1311 function subscribeElementContentSize(element, callback) { 1312 if(observers.length === 0) { 1313 observers.push(elementSizeObserver(element, callback, { width: -1, height: -1 })); 1314 calculateStyles(updateTrackedElements); 1315 } else 1316 observers.push(elementSizeObserver(element, callback, { width: -1, height: -1 })); 1317 } 1318 function updateTrackedElements() { 1319 observers = observers.filter(function (observer) { return observer(); }); 1320 if (observers.length > 0) { 1321 setTimeout(function () {
1322 calculateStyles(updateTrackedElements); 1323 }, minimumIntervalBetweenChecks); 1324 } 1325 } 1326 function applyStyles(element, styles) { 1327 var stylesArr = []; 1328 for (var property in styles) { 1329 if (styles.hasOwnProperty(property)) 1330 stylesArr.push({ attr: property, value: styles[property] }); 1331 } 1332 if (stylesArr.length === 1) { 1333 element.style[stylesArr[0].attr] = stylesArr[0].value; 1334 } else { 1335 var cssText = ""; 1336 if (element.style.cssText) { 1337 var oldStylesArr = element.style.cssText.split(';').map(function (nvp) { return nvp.trim().split(':'); }); 1338 for (var i = 0; i < oldStylesArr.length; i++) { 1339 var oldStyleArr = oldStylesArr[i]; 1340 if (oldStyleArr.length === 2 && styles[oldStyleArr[0]] === undefined) 1341 cssText += oldStyleArr[0] + ":" + oldStyleArr[1].trim() + ";"; 1342 } 1343 } 1344 for (var i = 0; i < stylesArr.length; i++) { 1345 var style = stylesArr[i]; 1346 if (style.value !== "") 1347 cssText += style.attr + ":" + style.value + ";"; 1348 } 1349 ASPx.Attr.SetOrRemoveAttribute(element, "style", cssText); 1350 } 1351 } 1352 function applyStateToElement(element, state) { 1353 if (state.inlineStyles === null) 1354 ASPx.Attr.RemoveAttribute(element, "style"); 1355 else 1356 applyStyles(element, state.inlineStyles); 1357 for (var attrName in state.attributes) { 1358 if (state.attributes.hasOwnProperty(attrName)) 1359 ASPx.Attr.SetOrRemoveAttribute(element, attrName, state.attributes[attrName]); 1360 }
1361 var allCssClasses = ASPx.GetClassNameList(state); 1362 if (allCssClasses) { 1363 var toggleInfo = state.cssClassToggleInfo; 1364 var cssClasses = allCssClasses.filter(function (c) { return toggleInfo[c] !== false; }); 1365 for (var c in toggleInfo) { 1366 if (toggleInfo.hasOwnProperty(c) && toggleInfo[c] && cssClasses.indexOf(c) === -1) 1367 cssClasses.push(c); 1368 } 1369 var cssClass = cssClasses.join(" "); 1370 if (cssClass) 1371 ASPx.SetClassName(element, cssClass); 1372 else 1373 ASPx.Attr.RemoveAttribute(element, "class"); 1374 } 1375 } 1376 function createElementState(element) { 1377 return { inlineStyles: {}, cssClassToggleInfo: {}, className: ASPx.GetClassName(element), attributes: {} }; 1378 } 1379 function updateElementState(elementOrCollection, callback) { 1380 if (elementOrCollection.length !== undefined) { 1381 for (var i = 0; i < elementOrCollection.length; i++) 1382 updateElementState(elementOrCollection[i], callback); 1383 return; 1384 } 1385 var element = elementOrCollection; 1386 if (!element._dxCurrentFrameElementStateInfo) { 1387 callback(element._dxCurrentFrameElementStateInfo = createElementState(element)); 1388 changeDom(function () { 1389 applyStateToElement(element, element._dxCurrentFrameElementStateInfo); 1390 element._dxCurrentFrameElementStateInfo = null; 1391 }, 1); 1392 } else 1393 callback(element._dxCurrentFrameElementStateInfo); 1394 } 1395 function setStyles(el, styles) { 1396 updateElementState(el, function (state) { 1397 if (state.inlineStyles === null) 1398 state.inlineStyles = styles; 1399 else { 1400 for (var i in styles) { 1401 if (styles.hasOwnProperty(i)) 1402 state.inlineStyles[i] = styles[i]; 1403 } 1404 } 1405 }); 1406 } 1407 function clearStyles(el) { 1408 updateElementState(el, function (state) { 1409 state.inlineStyles = null; 1410 }); 1411 } 1412 function toggleCssClass(el, cssClass, condition) { 1413 updateElementState(el, function (state) { 1414 state.cssClassToggleInfo[cssClass] = condition; 1415 }); 1416 } 1417 function setCssClassName(el, className) { 1418 updateElementState(el, function (state) { 1419 state.cssClassToggleInfo = {}; 1420 state.className = className; 1421 }); 1422 } 1423 function updateAttribute(el, attrName, attrValue) { 1424 updateElementState(el, function (state) { 1425 state.attributes[attrName] = attrValue; 1426 }); 1427 } 1428 function nextChangeDOM(callback) { 1429 changeDom(callback, 2); 1430 } 1431 return { 1432 ChangeDOM: changeDom, 1433 NextChangeDOM: nextChangeDOM, 1434 CalculateStyles: calculateStyles, 1435 SubscribeElementContentWidth: subscribeElementContentWidth, 1436 SubscribeElementContentSize: subscribeElementContentSize, 1437 SetStyles: setStyles, 1438 ClearStyles: clearStyles, 1439 ToggleCssClass: toggleCssClass, 1440 SetCssClassName: setCssClassName, 1441 UpdateAttribute: updateAttribute 1442 }; 1443 }); 1444 ASPx.DefaultDisplayNoneSelectors = ASPx.DefaultDisplayNoneSelectors.concat([ 1445 ASPx.BootstrapCssSelectors.Modal, 1446 ASPx.BootstrapCssSelectors.DropDownMenu, 1447 "dxbs-dropdown-area", 1448 ASPx.BootstrapCssSelectors.HiddenLayout 1449 ]); 1450 ASPx.DefaultDisplaySelectors = ASPx.DefaultDisplaySelectors.concat([ 1451 "dxbs-modal" 1452 ]); 1453 ASPx.ProcessStyleSheetRules(".dropdown-item", function(name, style, rule) { 1454 if(name.indexOf(":hover") > -1 && style.backgroundColor) { 1455 var cssText = "background-color: " + style.backgroundColor + ";"; 1456 if(style.color) 1457 cssText += "color: " + style.color + "; "; 1458 ASPx.AddStyleSheetRule(rule.parentStyleSheet, ".dxbs-item-hover", cssText); 1459 return true; 1460 } 1461 }); 1462})(dx || (dx = {})); 1463 1464},15);
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.