@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) • 1.48 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 n=l=>t=>Math.floor(t/l),o=l=>t=>t*l;class s{constructor(t){this.dom=t,this.divideByMagnitude=null,this.powerByMagnitude=null,this.navigator=null,this.view=null,this.monthScrolled=!1,this.navScrolled=!1}configure(t){const i=Math.max(this.dom.viewHeight(t)/this.dom.navigationItemHeight,1);this.divideByMagnitude=n(i),this.powerByMagnitude=o(i)}sync(t,i,e){if(!(!t||!i)){if(this.navigator=t,this.view=i,e.target===this.navigator.element){if(this.monthScrolled){this.monthScrolled=!1;return}this.navScrolled=!0,this.scrollSiblingOf(this.navigator.element)}if(e.target===this.view.element){if(this.navScrolled){this.navScrolled=!1;return}this.monthScrolled=!0,this.scrollSiblingOf(this.view.element)}}}scrollSiblingOf(t){const i=this.siblingComponent(t),e=this.calculateScroll(i,t.scrollTop);i.scrollTo(e)}siblingComponent(t){return this.navigator.element===t?this.view:this.navigator}calculateScroll(t,i){const e=t===this.navigator?this.divideByMagnitude:this.powerByMagnitude;return e?e(i):0}}exports.ScrollSyncService=s;