UNPKG

10.3 kBJavaScriptView Raw
1!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("primeng/dom",["exports"],t):t(((e=e||self).primeng=e.primeng||{},e.primeng.dom={}))}(this,(function(e){"use strict";var t=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=function(){function e(){}return e.addClass=function(e,t){e.classList?e.classList.add(t):e.className+=" "+t},e.addMultipleClasses=function(e,t){if(e.classList)for(var n=t.split(" "),i=0;i<n.length;i++)e.classList.add(n[i]);else for(n=t.split(" "),i=0;i<n.length;i++)e.className+=" "+n[i]},e.removeClass=function(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")},e.hasClass=function(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)},e.siblings=function(e){return Array.prototype.filter.call(e.parentNode.children,(function(t){return t!==e}))},e.find=function(e,t){return Array.from(e.querySelectorAll(t))},e.findSingle=function(e,t){return e?e.querySelector(t):null},e.index=function(e){for(var t=e.parentNode.childNodes,n=0,i=0;i<t.length;i++){if(t[i]==e)return n;1==t[i].nodeType&&n++}return-1},e.indexWithinGroup=function(e,t){for(var n=e.parentNode?e.parentNode.childNodes:[],i=0,o=0;o<n.length;o++){if(n[o]==e)return i;n[o].attributes&&n[o].attributes[t]&&1==n[o].nodeType&&i++}return-1},e.relativePosition=function(e,t){var n,i,o=e.offsetParent?{width:e.offsetWidth,height:e.offsetHeight}:this.getHiddenElementDimensions(e),r=t.offsetHeight,l=t.getBoundingClientRect(),a=this.getViewport();l.top+r+o.height>a.height?(n=-1*o.height,l.top+n<0&&(n=-1*l.top)):n=r,i=o.width>a.width?-1*l.left:l.left+o.width>a.width?-1*(l.left+o.width-a.width):0,e.style.top=n+"px",e.style.left=i+"px"},e.absolutePosition=function(e,t){var n,i,o=e.offsetParent?{width:e.offsetWidth,height:e.offsetHeight}:this.getHiddenElementDimensions(e),r=o.height,l=o.width,a=t.offsetHeight,d=t.offsetWidth,s=t.getBoundingClientRect(),c=this.getWindowScrollTop(),u=this.getWindowScrollLeft(),f=this.getViewport();s.top+a+r>f.height?(n=s.top+c-r)<0&&(n=c):n=a+s.top+c,i=s.left+l>f.width?Math.max(0,s.left+u+d-l):s.left+u,e.style.top=n+"px",e.style.left=i+"px"},e.getHiddenElementOuterHeight=function(e){e.style.visibility="hidden",e.style.display="block";var t=e.offsetHeight;return e.style.display="none",e.style.visibility="visible",t},e.getHiddenElementOuterWidth=function(e){e.style.visibility="hidden",e.style.display="block";var t=e.offsetWidth;return e.style.display="none",e.style.visibility="visible",t},e.getHiddenElementDimensions=function(e){var t={};return e.style.visibility="hidden",e.style.display="block",t.width=e.offsetWidth,t.height=e.offsetHeight,e.style.display="none",e.style.visibility="visible",t},e.scrollInView=function(e,t){var n=getComputedStyle(e).getPropertyValue("borderTopWidth"),i=n?parseFloat(n):0,o=getComputedStyle(e).getPropertyValue("paddingTop"),r=o?parseFloat(o):0,l=e.getBoundingClientRect(),a=t.getBoundingClientRect().top+document.body.scrollTop-(l.top+document.body.scrollTop)-i-r,d=e.scrollTop,s=e.clientHeight,c=this.getOuterHeight(t);a<0?e.scrollTop=d+a:a+c>s&&(e.scrollTop=d+a-s+c)},e.fadeIn=function(e,t){e.style.opacity=0;var n=+new Date,i=0,o=function(){i=+e.style.opacity.replace(",",".")+((new Date).getTime()-n)/t,e.style.opacity=i,n=+new Date,+i<1&&(window.requestAnimationFrame&&requestAnimationFrame(o)||setTimeout(o,16))};o()},e.fadeOut=function(e,t){var n=1,i=50/t,o=setInterval((function(){(n-=i)<=0&&(n=0,clearInterval(o)),e.style.opacity=n}),50)},e.getWindowScrollTop=function(){var e=document.documentElement;return(window.pageYOffset||e.scrollTop)-(e.clientTop||0)},e.getWindowScrollLeft=function(){var e=document.documentElement;return(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0)},e.matches=function(e,t){var n=Element.prototype;return(n.matches||n.webkitMatchesSelector||n.mozMatchesSelector||n.msMatchesSelector||function(e){return-1!==[].indexOf.call(document.querySelectorAll(e),this)}).call(e,t)},e.getOuterWidth=function(e,t){var n=e.offsetWidth;if(t){var i=getComputedStyle(e);n+=parseFloat(i.marginLeft)+parseFloat(i.marginRight)}return n},e.getHorizontalPadding=function(e){var t=getComputedStyle(e);return parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)},e.getHorizontalMargin=function(e){var t=getComputedStyle(e);return parseFloat(t.marginLeft)+parseFloat(t.marginRight)},e.innerWidth=function(e){var t=e.offsetWidth,n=getComputedStyle(e);return t+=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)},e.width=function(e){var t=e.offsetWidth,n=getComputedStyle(e);return t-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)},e.getInnerHeight=function(e){var t=e.offsetHeight,n=getComputedStyle(e);return t+=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)},e.getOuterHeight=function(e,t){var n=e.offsetHeight;if(t){var i=getComputedStyle(e);n+=parseFloat(i.marginTop)+parseFloat(i.marginBottom)}return n},e.getHeight=function(e){var t=e.offsetHeight,n=getComputedStyle(e);return t-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)+parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth)},e.getWidth=function(e){var t=e.offsetWidth,n=getComputedStyle(e);return t-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)+parseFloat(n.borderLeftWidth)+parseFloat(n.borderRightWidth)},e.getViewport=function(){var e=window,t=document,n=t.documentElement,i=t.getElementsByTagName("body")[0];return{width:e.innerWidth||n.clientWidth||i.clientWidth,height:e.innerHeight||n.clientHeight||i.clientHeight}},e.getOffset=function(e){var t=e.getBoundingClientRect();return{top:t.top+document.body.scrollTop,left:t.left+document.body.scrollLeft}},e.replaceElementWith=function(e,t){var n=e.parentNode;if(!n)throw"Can't replace element";return n.replaceChild(t,e)},e.getUserAgent=function(){return navigator.userAgent},e.isIE=function(){var e=window.navigator.userAgent;if(e.indexOf("MSIE ")>0)return!0;if(e.indexOf("Trident/")>0){e.indexOf("rv:");return!0}return e.indexOf("Edge/")>0},e.isIOS=function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream},e.isAndroid=function(){return/(android)/i.test(navigator.userAgent)},e.appendChild=function(e,t){if(this.isElement(t))t.appendChild(e);else{if(!t.el||!t.el.nativeElement)throw"Cannot append "+t+" to "+e;t.el.nativeElement.appendChild(e)}},e.removeChild=function(e,t){if(this.isElement(t))t.removeChild(e);else{if(!t.el||!t.el.nativeElement)throw"Cannot remove "+e+" from "+t;t.el.nativeElement.removeChild(e)}},e.isElement=function(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName},e.calculateScrollbarWidth=function(e){if(e){var t=getComputedStyle(e);return e.offsetWidth-e.clientWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth)}if(null!==this.calculatedScrollbarWidth)return this.calculatedScrollbarWidth;var n=document.createElement("div");n.className="ui-scrollbar-measure",document.body.appendChild(n);var i=n.offsetWidth-n.clientWidth;return document.body.removeChild(n),this.calculatedScrollbarWidth=i,i},e.calculateScrollbarHeight=function(){if(null!==this.calculatedScrollbarHeight)return this.calculatedScrollbarHeight;var e=document.createElement("div");e.className="ui-scrollbar-measure",document.body.appendChild(e);var t=e.offsetHeight-e.clientHeight;return document.body.removeChild(e),this.calculatedScrollbarWidth=t,t},e.invokeElementMethod=function(e,t,n){e[t].apply(e,n)},e.clearSelection=function(){if(window.getSelection)window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().rangeCount>0&&window.getSelection().getRangeAt(0).getClientRects().length>0&&window.getSelection().removeAllRanges();else if(document.selection&&document.selection.empty)try{document.selection.empty()}catch(e){}},e.getBrowser=function(){if(!this.browser){var e=this.resolveUserAgent();this.browser={},e.browser&&(this.browser[e.browser]=!0,this.browser.version=e.version),this.browser.chrome?this.browser.webkit=!0:this.browser.webkit&&(this.browser.safari=!0)}return this.browser},e.resolveUserAgent=function(){var e=navigator.userAgent.toLowerCase(),t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e.isInteger=function(e){return Number.isInteger?Number.isInteger(e):"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},e.isHidden=function(e){return null===e.offsetParent},e.getFocusableElements=function(n){var i,o,r=e.find(n,'button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), \n [href][clientHeight][clientWidth]:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), \n input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), \n textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), [tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden]), \n [contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])'),l=[];try{for(var a=t(r),d=a.next();!d.done;d=a.next()){var s=d.value;"none"!=getComputedStyle(s).display&&"hidden"!=getComputedStyle(s).visibility&&l.push(s)}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}return l},e.zindex=1e3,e.calculatedScrollbarWidth=null,e.calculatedScrollbarHeight=null,e}();e.DomHandler=n,Object.defineProperty(e,"__esModule",{value:!0})}));
2//# sourceMappingURL=primeng-dom.umd.min.js.map
\No newline at end of file