@progress/kendo-react-grid 15.0.1-develop.1 → 15.0.1-develop.10

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 c=require("react"),n=require("./utils/index.js");function f(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const d=f(c),g=.3;class u{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.reactVersion=Number.parseFloat(d.version),this.scrollSyncing=!1,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))}scrollHandler(t){if(this.scrollSyncing){this.scrollSyncing=!1;return}if(!this.scrollableVirtual||!this.container||!this.table||!this.rowHeightService||!this.container)return;const e=this.container.scrollTop,i=this.lastScrollTop>=e,o=!i;this.lastScrollTop=e;const a=this.container.offsetHeight;let s=this.rowHeightService.index(e);const l=this.rowHeightService.index(e+a),h=Math.max(s+this.pageSize-this.total,0);s=Math.max(s-h,0),o&&l>=this.lastLoaded&&this.lastLoaded<this.total-1?(this.firstToLoad=s,this.loadPage(t)):(i&&s<this.firstToLoad||s>this.lastLoaded||l<this.firstLoaded)&&this.loadPageWithBuffer(s,h,i,t)}update(){var e;const t=this.getItemHeights();if(this.firstLoaded>this.firstToLoad){const i=Math.min(this.firstLoaded-this.firstToLoad,this.pageSize),o=this.getTotalHeight(i,t),a=this.getExpectedTotalHeight(i),s=o-a;s!==0&&this.adjustScroll(s)}(e=this.rowHeightService)==null||e.update(this.firstToLoad,t),this.setScrollHeightContainerHeight(),this.firstLoaded=this.firstToLoad,this.lastLoaded=this.firstLoaded+t.length-1}loadPage(t){this.rowHeightService&&(this.translate(this.rowHeightService.offset(this.firstToLoad)),this.changePage(this.firstToLoad,t))}loadPageWithBuffer(t,e,i,o){const a=i?Math.max(Math.floor(this.pageSize*g)-e,0):0;this.firstToLoad=Math.max(t-a,0),this.loadPage(o)}translate(t,e){this.scrollableVirtual&&this.table&&(this.reactVersion<=17||e?this.table.style.transform="translateY("+t+"px)":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;e=n.firefox?Math.min(n.firefoxMaxHeight,e):e,this.scrollHeightContainer.style.height=e+"px"}}getItemHeights(){const t=[];return this.tableBody&&Array.from(this.tableBody.children).forEach(e=>{const i=e.getBoundingClientRect().height;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,o)=>i+o,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=u;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),n=require("./utils/index.js");function f(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const d=f(c),g=.3;class u{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.reactVersion=Number.parseFloat(d.version),this.scrollSyncing=!1,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))}scrollHandler(t){if(this.scrollSyncing){this.scrollSyncing=!1;return}if(!this.scrollableVirtual||!this.container||!this.table||!this.rowHeightService||!this.container)return;const e=this.container.scrollTop,i=this.lastScrollTop>=e,o=!i;this.lastScrollTop=e;const a=this.container.offsetHeight;let s=this.rowHeightService.index(e);const l=this.rowHeightService.index(e+a),h=Math.max(s+this.pageSize-this.total,0);s=Math.max(s-h,0),o&&l>=this.lastLoaded&&this.lastLoaded<this.total-1?(this.firstToLoad=s,this.loadPage(t)):(i&&s<this.firstToLoad||s>this.lastLoaded||l<this.firstLoaded)&&this.loadPageWithBuffer(s,h,i,t)}update(){var e;const t=this.getItemHeights();if(this.firstLoaded>this.firstToLoad){const i=Math.min(this.firstLoaded-this.firstToLoad,this.pageSize),o=this.getTotalHeight(i,t),a=this.getExpectedTotalHeight(i),s=o-a;s!==0&&this.adjustScroll(s)}(e=this.rowHeightService)==null||e.update(this.firstToLoad,t),this.setScrollHeightContainerHeight(),this.firstLoaded=this.firstToLoad,this.lastLoaded=this.firstLoaded+t.length-1}loadPage(t){this.rowHeightService&&(this.translate(this.rowHeightService.offset(this.firstToLoad)),this.changePage(this.firstToLoad,t))}loadPageWithBuffer(t,e,i,o){const a=i?Math.max(Math.floor(this.pageSize*g)-e,0):0;this.firstToLoad=Math.max(t-a,0),this.loadPage(o)}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;e=n.firefox?Math.min(n.firefoxMaxHeight,e):e,this.scrollHeightContainer.style.height=e+"px"}}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,o)=>i+o,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=u;
package/VirtualScroll.mjs CHANGED
@@ -28,16 +28,16 @@ class u {
28
28
  return;
29
29
  const i = this.container.scrollTop, s = this.lastScrollTop >= i, o = !s;
30
30
  this.lastScrollTop = i;
31
- const a = this.container.offsetHeight;
31
+ const r = this.container.offsetHeight;
32
32
  let e = this.rowHeightService.index(i);
33
- const h = this.rowHeightService.index(i + a), r = Math.max(e + this.pageSize - this.total, 0);
34
- e = Math.max(e - r, 0), o && h >= this.lastLoaded && this.lastLoaded < this.total - 1 ? (this.firstToLoad = e, this.loadPage(t)) : (s && e < this.firstToLoad || e > this.lastLoaded || h < this.firstLoaded) && this.loadPageWithBuffer(e, r, s, t);
33
+ const a = this.rowHeightService.index(i + r), h = Math.max(e + this.pageSize - this.total, 0);
34
+ e = Math.max(e - h, 0), o && a >= this.lastLoaded && this.lastLoaded < this.total - 1 ? (this.firstToLoad = e, this.loadPage(t)) : (s && e < this.firstToLoad || e > this.lastLoaded || a < this.firstLoaded) && this.loadPageWithBuffer(e, h, s, t);
35
35
  }
36
36
  update() {
37
37
  var i;
38
38
  const t = this.getItemHeights();
39
39
  if (this.firstLoaded > this.firstToLoad) {
40
- const s = Math.min(this.firstLoaded - this.firstToLoad, this.pageSize), o = this.getTotalHeight(s, t), a = this.getExpectedTotalHeight(s), e = o - a;
40
+ const s = Math.min(this.firstLoaded - this.firstToLoad, this.pageSize), o = this.getTotalHeight(s, t), r = this.getExpectedTotalHeight(s), e = o - r;
41
41
  e !== 0 && this.adjustScroll(e);
42
42
  }
43
43
  (i = this.rowHeightService) == null || i.update(this.firstToLoad, t), this.setScrollHeightContainerHeight(), this.firstLoaded = this.firstToLoad, this.lastLoaded = this.firstLoaded + t.length - 1;
@@ -46,11 +46,11 @@ class u {
46
46
  this.rowHeightService && (this.translate(this.rowHeightService.offset(this.firstToLoad)), this.changePage(this.firstToLoad, t));
47
47
  }
48
48
  loadPageWithBuffer(t, i, s, o) {
49
- const a = s ? Math.max(Math.floor(this.pageSize * f) - i, 0) : 0;
50
- this.firstToLoad = Math.max(t - a, 0), this.loadPage(o);
49
+ const r = s ? Math.max(Math.floor(this.pageSize * f) - i, 0) : 0;
50
+ this.firstToLoad = Math.max(t - r, 0), this.loadPage(o);
51
51
  }
52
52
  translate(t, i) {
53
- this.scrollableVirtual && this.table && (this.reactVersion <= 17 || i ? this.table.style.transform = "translateY(" + t + "px)" : this.tableTransform = "translateY(" + t + "px)");
53
+ this.scrollableVirtual && this.table && ((this.reactVersion <= 17 || i) && (this.table.style.transform = "translateY(" + t + "px)"), this.reactVersion > 17 && (this.tableTransform = "translateY(" + t + "px)"));
54
54
  }
55
55
  changePage(t, i) {
56
56
  this.PageChange && this.PageChange(
@@ -74,7 +74,7 @@ class u {
74
74
  getItemHeights() {
75
75
  const t = [];
76
76
  return this.tableBody && Array.from(this.tableBody.children).forEach((i) => {
77
- const s = i.getBoundingClientRect().height;
77
+ const s = i.offsetHeight;
78
78
  i.classList.contains("k-detail-row") ? t[t.length - 1] += s : t.push(s);
79
79
  }), t;
80
80
  }