@mhmdaljefri/revogrid
Version:
Virtual reactive data grid component - RevoGrid.
1 lines • 8.8 kB
JavaScript
System.register([],(function(e){"use strict";return{execute:function(){var t=[];var r=function(){return t.some((function(e){return e.activeTargets.length>0}))};var n=function(){return t.some((function(e){return e.skippedTargets.length>0}))};var i="ResizeObserver loop completed with undelivered notifications.";var o=function(){var e;if(typeof ErrorEvent==="function"){e=new ErrorEvent("error",{message:i})}else{e=document.createEvent("Event");e.initEvent("error",false,false);e.message=i}window.dispatchEvent(e)};var a;(function(e){e["BORDER_BOX"]="border-box";e["CONTENT_BOX"]="content-box";e["DEVICE_PIXEL_CONTENT_BOX"]="device-pixel-content-box"})(a||(a={}));var s=function(){function e(e,t,r,n){this.x=e;this.y=t;this.width=r;this.height=n;this.top=this.y;this.left=this.x;this.bottom=this.top+this.height;this.right=this.left+this.width;return Object.freeze(this)}e.prototype.toJSON=function(){var e=this,t=e.x,r=e.y,n=e.top,i=e.right,o=e.bottom,a=e.left,s=e.width,u=e.height;return{x:t,y:r,top:n,right:i,bottom:o,left:a,width:s,height:u}};e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)};return e}();var u=function(e){return e instanceof SVGElement&&"getBBox"in e};var v=function(e){if(u(e)){var t=e.getBBox(),r=t.width,n=t.height;return!r&&!n}var i=e,o=i.offsetWidth,a=i.offsetHeight;return!(o||a||e.getClientRects().length)};var c=function(e){var t,r;var n=(r=(t=e)===null||t===void 0?void 0:t.ownerDocument)===null||r===void 0?void 0:r.defaultView;return!!(n&&e instanceof n.Element)};var f=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image"){break}case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return true}return false};var h=typeof window!=="undefined"?window:{};var d=new WeakMap;var l=/auto|scroll/;var p=/^tb|vertical/;var g=/msie|trident/i.test(h.navigator&&h.navigator.userAgent);var b=function(e){return parseFloat(e||"0")};var w=function(e,t,r){if(e===void 0){e=0}if(t===void 0){t=0}if(r===void 0){r=false}return Object.freeze({inlineSize:(r?t:e)||0,blockSize:(r?e:t)||0})};var x=Object.freeze({devicePixelContentBoxSize:w(),borderBoxSize:w(),contentBoxSize:w(),contentRect:new s(0,0,0,0)});var E=function(e,t){if(t===void 0){t=false}if(d.has(e)&&!t){return d.get(e)}if(v(e)){d.set(e,x);return x}var r=getComputedStyle(e);var n=u(e)&&e.ownerSVGElement&&e.getBBox();var i=!g&&r.boxSizing==="border-box";var o=p.test(r.writingMode||"");var a=!n&&l.test(r.overflowY||"");var c=!n&&l.test(r.overflowX||"");var f=n?0:b(r.paddingTop);var h=n?0:b(r.paddingRight);var E=n?0:b(r.paddingBottom);var T=n?0:b(r.paddingLeft);var y=n?0:b(r.borderTopWidth);var z=n?0:b(r.borderRightWidth);var m=n?0:b(r.borderBottomWidth);var S=n?0:b(r.borderLeftWidth);var B=T+h;var O=f+E;var R=S+z;var C=y+m;var k=!c?0:e.offsetHeight-C-e.clientHeight;var N=!a?0:e.offsetWidth-R-e.clientWidth;var D=i?B+R:0;var I=i?O+C:0;var M=n?n.width:b(r.width)-D-N;var P=n?n.height:b(r.height)-I-k;var _=M+B+N+R;var F=P+O+k+C;var L=Object.freeze({devicePixelContentBoxSize:w(Math.round(M*devicePixelRatio),Math.round(P*devicePixelRatio),o),borderBoxSize:w(_,F,o),contentBoxSize:w(M,P,o),contentRect:new s(T,f,M,P)});d.set(e,L);return L};var T=function(e,t,r){var n=E(e,r),i=n.borderBoxSize,o=n.contentBoxSize,s=n.devicePixelContentBoxSize;switch(t){case a.DEVICE_PIXEL_CONTENT_BOX:return s;case a.BORDER_BOX:return i;default:return o}};var y=e("ResizeObserverEntry",function(){function e(e){var t=E(e);this.target=e;this.contentRect=t.contentRect;this.borderBoxSize=[t.borderBoxSize];this.contentBoxSize=[t.contentBoxSize];this.devicePixelContentBoxSize=[t.devicePixelContentBoxSize]}return e}());var z=function(e){if(v(e)){return Infinity}var t=0;var r=e.parentNode;while(r){t+=1;r=r.parentNode}return t};var m=function(){var e=Infinity;var r=[];t.forEach((function t(n){if(n.activeTargets.length===0){return}var i=[];n.activeTargets.forEach((function t(r){var n=new y(r.target);var o=z(r.target);i.push(n);r.lastReportedSize=T(r.target,r.observedBox);if(o<e){e=o}}));r.push((function e(){n.callback.call(n.observer,i,n.observer)}));n.activeTargets.splice(0,n.activeTargets.length)}));for(var n=0,i=r;n<i.length;n++){var o=i[n];o()}return e};var S=function(e){t.forEach((function t(r){r.activeTargets.splice(0,r.activeTargets.length);r.skippedTargets.splice(0,r.skippedTargets.length);r.observationTargets.forEach((function t(n){if(n.isActive()){if(z(n.target)>e){r.activeTargets.push(n)}else{r.skippedTargets.push(n)}}}))}))};var B=function(){var e=0;S(e);while(r()){e=m();S(e)}if(n()){o()}return e>0};var O;var R=[];var C=function(){return R.splice(0).forEach((function(e){return e()}))};var k=function(e){if(!O){var t=0;var r=document.createTextNode("");var n={characterData:true};new MutationObserver((function(){return C()})).observe(r,n);O=function(){r.textContent=""+(t?t--:t++)}}R.push(e);O()};var N=function(e){k((function t(){requestAnimationFrame(e)}))};var D=0;var I=function(){return!!D};var M=250;var P={attributes:true,characterData:true,childList:true,subtree:true};var _=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"];var F=function(e){if(e===void 0){e=0}return Date.now()+e};var L=false;var W=function(){function e(){var e=this;this.stopped=true;this.listener=function(){return e.schedule()}}e.prototype.run=function(e){var t=this;if(e===void 0){e=M}if(L){return}L=true;var r=F(e);N((function(){var n=false;try{n=B()}finally{L=false;e=r-F();if(!I()){return}if(n){t.run(1e3)}else if(e>0){t.run(e)}else{t.start()}}}))};e.prototype.schedule=function(){this.stop();this.run()};e.prototype.observe=function(){var e=this;var t=function(){return e.observer&&e.observer.observe(document.body,P)};document.body?t():h.addEventListener("DOMContentLoaded",t)};e.prototype.start=function(){var e=this;if(this.stopped){this.stopped=false;this.observer=new MutationObserver(this.listener);this.observe();_.forEach((function(t){return h.addEventListener(t,e.listener,true)}))}};e.prototype.stop=function(){var e=this;if(!this.stopped){this.observer&&this.observer.disconnect();_.forEach((function(t){return h.removeEventListener(t,e.listener,true)}));this.stopped=true}};return e}();var X=new W;var A=function(e){!D&&e>0&&X.start();D+=e;!D&&X.stop()};var V=function(e){return!u(e)&&!f(e)&&getComputedStyle(e).display==="inline"};var j=function(){function e(e,t){this.target=e;this.observedBox=t||a.CONTENT_BOX;this.lastReportedSize={inlineSize:0,blockSize:0}}e.prototype.isActive=function(){var e=T(this.target,this.observedBox,true);if(V(this.target)){this.lastReportedSize=e}if(this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize){return true}return false};return e}();var q=function(){function e(e,t){this.activeTargets=[];this.skippedTargets=[];this.observationTargets=[];this.observer=e;this.callback=t}return e}();var G=new WeakMap;var H=function(e,t){for(var r=0;r<e.length;r+=1){if(e[r].target===t){return r}}return-1};var J=function(){function e(){}e.connect=function(e,t){var r=new q(e,t);G.set(e,r)};e.observe=function(e,r,n){var i=G.get(e);var o=i.observationTargets.length===0;if(H(i.observationTargets,r)<0){o&&t.push(i);i.observationTargets.push(new j(r,n&&n.box));A(1);X.schedule()}};e.unobserve=function(e,r){var n=G.get(e);var i=H(n.observationTargets,r);var o=n.observationTargets.length===1;if(i>=0){o&&t.splice(t.indexOf(n),1);n.observationTargets.splice(i,1);A(-1)}};e.disconnect=function(e){var t=this;var r=G.get(e);r.observationTargets.slice().forEach((function(r){return t.unobserve(e,r.target)}));r.activeTargets.splice(0,r.activeTargets.length)};return e}();var U=e("ResizeObserver",function(){function e(e){if(arguments.length===0){throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.")}if(typeof e!=="function"){throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.")}J.connect(this,e)}e.prototype.observe=function(e,t){if(arguments.length===0){throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.")}if(!c(e)){throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element")}J.observe(this,e,t)};e.prototype.unobserve=function(e){if(arguments.length===0){throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.")}if(!c(e)){throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element")}J.unobserve(this,e)};e.prototype.disconnect=function(){J.disconnect(this)};e.toString=function(){return"function ResizeObserver () { [polyfill code] }"};return e}())}}}));