@progress/kendo-react-dateinputs
Version:
React DateInput is a perfect input component for handling quick and efficient date values. KendoReact Date Inputs package
9 lines (8 loc) • 2.2 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=e=>Math.max(e,0);class a{constructor(t){this.offset=t}}class n{constructor(t){this.skip=t}}class w{constructor(t,s){this.onScrollAction=t,this.onPageAction=s,this.direction="vertical",this.firstLoaded=0,this.lastLoaded=0,this.lastScrollTop=0,this.take=0,this.total=0,this.rowHeightService=null,this.bottomOffset=0,this.topOffset=0}create(t,s,r,f,i=0,d=0,h="vertical"){this.rowHeightService=t,this.firstLoaded=s,this.lastLoaded=s+r,this.take=r,this.total=f,this.lastScrollTop=0,this.topOffset=i,this.bottomOffset=d,this.direction=h;const o=this.rowsForHeight(i),c=l(s-o);this.onScrollAction(new a(this.rowOffset(c))),this.onPageAction(new n(c))}onScroll({scrollLeft:t,scrollTop:s,offsetHeight:r,offsetWidth:f}){const i=this.direction==="vertical"?s:t,d=this.direction==="vertical"?r:f;if(this.lastScrollTop===i||!this.rowHeightService)return;const h=this.lastScrollTop>=i;this.lastScrollTop=i;const o=this.rowHeightService.index(l(i-this.topOffset)),c=this.rowHeightService.index(l(i+d-this.bottomOffset));if(!h&&c>=this.lastLoaded&&this.lastLoaded<this.total&&(this.firstLoaded=o,this.onScrollAction(new a(this.rowOffset(o))),this.lastLoaded=Math.min(this.firstLoaded+this.take,this.total),this.onPageAction(new n(this.firstLoaded))),h&&o<=this.firstLoaded){const S=Math.floor(this.take*.3);this.firstLoaded=l(o-S),this.onScrollAction(new a(this.rowOffset(this.firstLoaded))),this.lastLoaded=Math.min(this.firstLoaded+this.take,this.total),this.onPageAction(new n(this.firstLoaded))}}rowOffset(t){return this.rowHeightService?this.rowHeightService.offset(t)+this.topOffset:0}rowsForHeight(t){return this.rowHeightService?Math.ceil(t/this.rowHeightService.height(0)):0}}exports.PageAction=n;exports.ScrollAction=a;exports.ScrollerService=w;