@progress/kendo-react-grid 16.2.0-develop.8 → 16.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/VirtualScroll.js CHANGED
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),f=require("./utils/index.js"),d=require("./utils/proxiedScrollOverlay.js");function p(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const S=p(g),u=.3;class T{constructor(){this.table=null,this.tableBody=null,this.container=null,this.scrollHeightContainer=null,this.total=0,this.scrollableVirtual=!1,this.pageSize=0,this.PageChange=null,this.fixedScroll=!1,this.tableTransform="",this.scrollbarOverlaySpacerElement=null,this.overlaySyncingRef=null,this.reactVersion=Number.parseFloat(S.version),this.scrollSyncing=!1,this.pendingTranslate=!1,this.deferredScrollTop=0,this.firstToLoad=0,this.lastScrollTop=0,this.firstLoaded=0,this.lastLoaded=0,this.scrollHandler=this.scrollHandler.bind(this)}reset(){if(this.firstToLoad=0,this.firstLoaded=0,this.lastLoaded=0,this.rowHeightService=void 0,this.fixedScroll){this.lastScrollTop=this.container?this.container.scrollTop:0;return}this.container&&this.container.scrollTop!==0&&(this.scrollSyncing=!0,this.container.scrollTop=0,this.lastScrollTop=0,this.translate(0,!0))}scrollToPosition(t,e,i=!1){var c;if(!this.scrollableVirtual||!this.rowHeightService)return;i&&(this.pendingTranslate=!0,this.deferredScrollTop=t);const s=this.lastScrollTop>=t,r=!s;this.lastScrollTop=t;const a=((c=this.container)==null?void 0:c.offsetHeight)||0;let l=this.rowHeightService.index(t);const h=this.rowHeightService.index(t+a),n=Math.max(l+this.pageSize-this.total,0);l=Math.max(l-n,0),r&&h>=this.lastLoaded&&this.lastLoaded<this.total-1?(this.firstToLoad=l,this.loadPage(e)):s&&l<this.firstToLoad||l>this.lastLoaded||h<this.firstLoaded?this.loadPageWithBuffer(l,n,s,e):i&&this.pendingTranslate&&this.container&&(this.scrollSyncing=!0,this.container.scrollTop=this.deferredScrollTop,this.pendingTranslate=!1)}scrollHandler(t){if(this.scrollSyncing){this.scrollSyncing=!1;return}!this.scrollableVirtual||!this.container||!this.table||!this.rowHeightService||this.scrollToPosition(this.container.scrollTop,t)}update(){var e;const t=this.getItemHeights();if(this.firstLoaded>this.firstToLoad){const i=Math.min(this.firstLoaded-this.firstToLoad,this.pageSize),s=this.getTotalHeight(i,t),r=this.getExpectedTotalHeight(i),a=s-r;a!==0&&this.adjustScroll(a)}(e=this.rowHeightService)==null||e.update(this.firstToLoad,t),this.setScrollHeightContainerHeight(),this.firstLoaded=this.firstToLoad,this.lastLoaded=this.firstLoaded+t.length-1,this.pendingTranslate&&this.rowHeightService&&(this.translate(this.rowHeightService.offset(this.firstLoaded),!0),this.container&&(this.scrollSyncing=!0,this.container.scrollTop=this.deferredScrollTop),this.pendingTranslate=!1)}loadPage(t){this.rowHeightService&&(this.pendingTranslate||this.translate(this.rowHeightService.offset(this.firstToLoad)),this.changePage(this.firstToLoad,t))}loadPageWithBuffer(t,e,i,s){const r=i?Math.max(Math.floor(this.pageSize*u)-e,0):0;this.firstToLoad=Math.max(t-r,0),this.loadPage(s)}translate(t,e){this.scrollableVirtual&&this.table&&((this.reactVersion<=17||e)&&(this.table.style.transform="translateY("+t+"px)"),this.reactVersion>17&&(this.tableTransform="translateY("+t+"px)"))}changePage(t,e){this.PageChange&&this.PageChange({skip:Math.max(0,t),take:this.pageSize},e)}adjustScroll(t){this.scrollSyncing=!0,this.container&&(this.container.scrollTop+=t)}setScrollHeightContainerHeight(){var t;if(this.scrollableVirtual&&this.scrollHeightContainer){let e=((t=this.rowHeightService)==null?void 0:t.totalHeight())||0;const i=this.firstToLoad+this.pageSize>=this.total,s=d.isOverlayAtBottom(this.scrollbarOverlaySpacerElement,i);e=f.firefox?Math.min(f.firefoxMaxHeight,e):e,this.scrollHeightContainer.style.height=e+"px",this.scrollbarOverlaySpacerElement&&(this.scrollbarOverlaySpacerElement.style.height=e+"px");const r=s?d.getOverlayBottomPin(this.scrollbarOverlaySpacerElement,this.container):null;r&&this.applyOverlayBottomPin(r)}}applyOverlayBottomPin(t){t.scrollbarOverlay.scrollTop!==t.overlayScrollTop&&(this.overlaySyncingRef&&(this.overlaySyncingRef.current=!0),t.scrollbarOverlay.scrollTop=t.overlayScrollTop),this.container&&this.container.scrollTop!==t.contentScrollTop&&(this.scrollSyncing=!0,this.container.scrollTop=t.contentScrollTop),this.deferredScrollTop=t.contentScrollTop,this.lastScrollTop=t.contentScrollTop}getItemHeights(){const t=[];return this.tableBody&&Array.from(this.tableBody.children).forEach(e=>{const i=e.offsetHeight;e.classList.contains("k-detail-row")?t[t.length-1]+=i:t.push(i)}),t}getTotalHeight(t,e){return e.slice(0,t).reduce((i,s)=>i+s,0)}getExpectedTotalHeight(t){const e=this.rowHeightService;if(!e)return 0;const i=this.firstToLoad+(t-1);return e.offset(i)+e.height(i)-e.offset(this.firstToLoad)}}exports.VirtualScroll=T;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),f=require("./utils/index.js"),d=require("./utils/proxiedScrollOverlay.js");function p(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const S=p(g),u=.3;class T{constructor(){this.table=null,this.tableBody=null,this.container=null,this.scrollHeightContainer=null,this.total=0,this.scrollableVirtual=!1,this.pageSize=0,this.PageChange=null,this.fixedScroll=!1,this.tableTransform="",this.scrollbarOverlaySpacerElement=null,this.overlaySyncingRef=null,this.reactVersion=Number.parseFloat(S.version),this.scrollSyncing=!1,this.pendingTranslate=!1,this.deferredScrollTop=0,this.firstToLoad=0,this.lastScrollTop=0,this.firstLoaded=0,this.lastLoaded=0,this.scrollHandler=this.scrollHandler.bind(this)}reset(){if(this.firstToLoad=0,this.firstLoaded=0,this.lastLoaded=0,this.rowHeightService=void 0,this.fixedScroll){this.lastScrollTop=this.container?this.container.scrollTop:0;return}this.container&&this.container.scrollTop!==0&&(this.scrollSyncing=!0,this.container.scrollTop=0,this.lastScrollTop=0,this.translate(0,!0))}scrollToPosition(t,e,i=!1){var c;if(!this.scrollableVirtual||!this.rowHeightService)return;i&&(this.pendingTranslate=!0,this.deferredScrollTop=t);const s=this.lastScrollTop>=t,r=!s;this.lastScrollTop=t;const a=((c=this.container)==null?void 0:c.offsetHeight)||0;let l=this.rowHeightService.index(t);const h=this.rowHeightService.index(t+a),n=Math.max(l+this.pageSize-this.total,0);l=Math.max(l-n,0),r&&h>=this.lastLoaded&&this.lastLoaded<this.total-1?(this.firstToLoad=l,this.loadPage(e)):s&&l<this.firstToLoad||l>this.lastLoaded||h<this.firstLoaded?this.loadPageWithBuffer(l,n,s,e):i&&this.pendingTranslate&&this.container&&(this.scrollSyncing=!0,this.container.scrollTop=this.deferredScrollTop,this.pendingTranslate=!1)}scrollHandler(t){if(this.scrollSyncing){this.scrollSyncing=!1;return}!this.scrollableVirtual||!this.container||!this.table||!this.rowHeightService||this.scrollToPosition(this.container.scrollTop,t)}update(){var e;const t=this.getItemHeights();if(this.firstLoaded>this.firstToLoad){const i=Math.min(this.firstLoaded-this.firstToLoad,this.pageSize),s=this.getTotalHeight(i,t),r=this.getExpectedTotalHeight(i),a=s-r;a!==0&&this.adjustScroll(a)}(e=this.rowHeightService)==null||e.update(this.firstToLoad,t),this.setScrollHeightContainerHeight(),this.firstLoaded=this.firstToLoad,this.lastLoaded=this.firstLoaded+t.length-1,this.pendingTranslate&&this.rowHeightService&&(this.translate(this.rowHeightService.offset(this.firstLoaded),!0),this.container&&(this.scrollSyncing=!0,this.container.scrollTop=this.deferredScrollTop),this.pendingTranslate=!1)}loadPage(t){this.rowHeightService&&(this.pendingTranslate||this.translate(this.rowHeightService.offset(this.firstToLoad),this.scrollbarOverlaySpacerElement!==null),this.changePage(this.firstToLoad,t))}loadPageWithBuffer(t,e,i,s){const r=i?Math.max(Math.floor(this.pageSize*u)-e,0):0;this.firstToLoad=Math.max(t-r,0),this.loadPage(s)}translate(t,e){this.scrollableVirtual&&this.table&&((this.reactVersion<=17||e)&&(this.table.style.transform="translateY("+t+"px)"),this.reactVersion>17&&(this.tableTransform="translateY("+t+"px)"))}changePage(t,e){this.PageChange&&this.PageChange({skip:Math.max(0,t),take:this.pageSize},e)}adjustScroll(t){this.scrollSyncing=!0,this.container&&(this.container.scrollTop+=t)}setScrollHeightContainerHeight(){var t;if(this.scrollableVirtual&&this.scrollHeightContainer){let e=((t=this.rowHeightService)==null?void 0:t.totalHeight())||0;const i=this.firstToLoad+this.pageSize>=this.total,s=d.isOverlayAtBottom(this.scrollbarOverlaySpacerElement,i);e=f.firefox?Math.min(f.firefoxMaxHeight,e):e,this.scrollHeightContainer.style.height=e+"px",this.scrollbarOverlaySpacerElement&&(this.scrollbarOverlaySpacerElement.style.height=e+"px");const r=s?d.getOverlayBottomPin(this.scrollbarOverlaySpacerElement,this.container):null;r&&this.applyOverlayBottomPin(r)}}applyOverlayBottomPin(t){t.scrollbarOverlay.scrollTop!==t.overlayScrollTop&&(this.overlaySyncingRef&&(this.overlaySyncingRef.current=!0),t.scrollbarOverlay.scrollTop=t.overlayScrollTop),this.container&&this.container.scrollTop!==t.contentScrollTop&&(this.scrollSyncing=!0,this.container.scrollTop=t.contentScrollTop),this.deferredScrollTop=t.contentScrollTop,this.lastScrollTop=t.contentScrollTop}getItemHeights(){const t=[];return this.tableBody&&Array.from(this.tableBody.children).forEach(e=>{const i=e.offsetHeight;e.classList.contains("k-detail-row")?t[t.length-1]+=i:t.push(i)}),t}getTotalHeight(t,e){return e.slice(0,t).reduce((i,s)=>i+s,0)}getExpectedTotalHeight(t){const e=this.rowHeightService;if(!e)return 0;const i=this.firstToLoad+(t-1);return e.offset(i)+e.height(i)-e.offset(this.firstToLoad)}}exports.VirtualScroll=T;
package/VirtualScroll.mjs CHANGED
@@ -9,7 +9,7 @@ import * as c from "react";
9
9
  import { firefox as f, firefoxMaxHeight as d } from "./utils/index.mjs";
10
10
  import { isOverlayAtBottom as g, getOverlayBottomPin as p } from "./utils/proxiedScrollOverlay.mjs";
11
11
  const S = 0.3;
12
- class L {
12
+ class y {
13
13
  constructor() {
14
14
  this.table = null, this.tableBody = null, this.container = null, this.scrollHeightContainer = null, this.total = 0, this.scrollableVirtual = !1, this.pageSize = 0, this.PageChange = null, this.fixedScroll = !1, this.tableTransform = "", this.scrollbarOverlaySpacerElement = null, this.overlaySyncingRef = null, this.reactVersion = Number.parseFloat(c.version), this.scrollSyncing = !1, this.pendingTranslate = !1, this.deferredScrollTop = 0, this.firstToLoad = 0, this.lastScrollTop = 0, this.firstLoaded = 0, this.lastLoaded = 0, this.scrollHandler = this.scrollHandler.bind(this);
15
15
  }
@@ -27,10 +27,10 @@ class L {
27
27
  e && (this.pendingTranslate = !0, this.deferredScrollTop = t);
28
28
  const s = this.lastScrollTop >= t, r = !s;
29
29
  this.lastScrollTop = t;
30
- const l = ((n = this.container) == null ? void 0 : n.offsetHeight) || 0;
31
- let o = this.rowHeightService.index(t);
32
- const a = this.rowHeightService.index(t + l), h = Math.max(o + this.pageSize - this.total, 0);
33
- o = Math.max(o - h, 0), r && a >= this.lastLoaded && this.lastLoaded < this.total - 1 ? (this.firstToLoad = o, this.loadPage(i)) : s && o < this.firstToLoad || o > this.lastLoaded || a < this.firstLoaded ? this.loadPageWithBuffer(o, h, s, i) : e && this.pendingTranslate && this.container && (this.scrollSyncing = !0, this.container.scrollTop = this.deferredScrollTop, this.pendingTranslate = !1);
30
+ const o = ((n = this.container) == null ? void 0 : n.offsetHeight) || 0;
31
+ let l = this.rowHeightService.index(t);
32
+ const a = this.rowHeightService.index(t + o), h = Math.max(l + this.pageSize - this.total, 0);
33
+ l = Math.max(l - h, 0), r && a >= this.lastLoaded && this.lastLoaded < this.total - 1 ? (this.firstToLoad = l, this.loadPage(i)) : s && l < this.firstToLoad || l > this.lastLoaded || a < this.firstLoaded ? this.loadPageWithBuffer(l, h, s, i) : e && this.pendingTranslate && this.container && (this.scrollSyncing = !0, this.container.scrollTop = this.deferredScrollTop, this.pendingTranslate = !1);
34
34
  }
35
35
  scrollHandler(t) {
36
36
  if (this.scrollSyncing) {
@@ -43,13 +43,13 @@ class L {
43
43
  var i;
44
44
  const t = this.getItemHeights();
45
45
  if (this.firstLoaded > this.firstToLoad) {
46
- const e = Math.min(this.firstLoaded - this.firstToLoad, this.pageSize), s = this.getTotalHeight(e, t), r = this.getExpectedTotalHeight(e), l = s - r;
47
- l !== 0 && this.adjustScroll(l);
46
+ const e = Math.min(this.firstLoaded - this.firstToLoad, this.pageSize), s = this.getTotalHeight(e, t), r = this.getExpectedTotalHeight(e), o = s - r;
47
+ o !== 0 && this.adjustScroll(o);
48
48
  }
49
49
  (i = this.rowHeightService) == null || i.update(this.firstToLoad, t), this.setScrollHeightContainerHeight(), this.firstLoaded = this.firstToLoad, this.lastLoaded = this.firstLoaded + t.length - 1, this.pendingTranslate && this.rowHeightService && (this.translate(this.rowHeightService.offset(this.firstLoaded), !0), this.container && (this.scrollSyncing = !0, this.container.scrollTop = this.deferredScrollTop), this.pendingTranslate = !1);
50
50
  }
51
51
  loadPage(t) {
52
- this.rowHeightService && (this.pendingTranslate || this.translate(this.rowHeightService.offset(this.firstToLoad)), this.changePage(this.firstToLoad, t));
52
+ this.rowHeightService && (this.pendingTranslate || this.translate(this.rowHeightService.offset(this.firstToLoad), this.scrollbarOverlaySpacerElement !== null), this.changePage(this.firstToLoad, t));
53
53
  }
54
54
  loadPageWithBuffer(t, i, e, s) {
55
55
  const r = e ? Math.max(Math.floor(this.pageSize * S) - i, 0) : 0;
@@ -102,5 +102,5 @@ class L {
102
102
  }
103
103
  }
104
104
  export {
105
- L as VirtualScroll
105
+ y as VirtualScroll
106
106
  };