@progress/kendo-react-dateinputs 14.4.1 → 14.5.0-develop.1

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.
Files changed (35) hide show
  1. package/calendar/components/Calendar.d.ts +35 -110
  2. package/calendar/components/Calendar.js +5 -5
  3. package/calendar/components/Calendar.mjs +288 -313
  4. package/calendar/components/CalendarCell.d.ts +1 -10
  5. package/calendar/components/CalendarCell.js +1 -1
  6. package/calendar/components/CalendarCell.mjs +68 -78
  7. package/calendar/components/Header.d.ts +10 -23
  8. package/calendar/components/Header.js +1 -1
  9. package/calendar/components/Header.mjs +41 -55
  10. package/calendar/components/HorizontalViewList.d.ts +28 -26
  11. package/calendar/components/HorizontalViewList.js +1 -1
  12. package/calendar/components/HorizontalViewList.mjs +112 -102
  13. package/calendar/components/MultiViewCalendar.d.ts +39 -141
  14. package/calendar/components/MultiViewCalendar.js +1 -1
  15. package/calendar/components/MultiViewCalendar.mjs +331 -373
  16. package/calendar/components/Navigation.d.ts +19 -39
  17. package/calendar/components/Navigation.js +1 -1
  18. package/calendar/components/Navigation.mjs +95 -107
  19. package/calendar/components/TodayCommand.d.ts +8 -25
  20. package/calendar/components/TodayCommand.js +1 -1
  21. package/calendar/components/TodayCommand.mjs +44 -61
  22. package/calendar/components/View.d.ts +11 -42
  23. package/calendar/components/View.js +1 -1
  24. package/calendar/components/View.mjs +111 -137
  25. package/calendar/components/ViewList.d.ts +25 -65
  26. package/calendar/components/ViewList.js +1 -1
  27. package/calendar/components/ViewList.mjs +207 -225
  28. package/calendar/services/ScrollSyncService.d.ts +4 -4
  29. package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
  30. package/package-metadata.js +1 -1
  31. package/package-metadata.mjs +2 -2
  32. package/package.json +8 -8
  33. package/virtualization/Virtualization.d.ts +25 -63
  34. package/virtualization/Virtualization.js +1 -1
  35. package/virtualization/Virtualization.mjs +163 -168
@@ -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 e=Object.freeze({name:"@progress/kendo-react-dateinputs",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1777886224,version:"14.4.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"});exports.packageMetadata=e;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-dateinputs",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1777909919,version:"14.5.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"});exports.packageMetadata=e;
@@ -6,8 +6,8 @@ export const packageMetadata = Object.freeze({
6
6
  productName: 'KendoReact',
7
7
  productCode: 'KENDOUIREACT',
8
8
  productCodes: ['KENDOUIREACT'],
9
- publishDate: 1777886224,
10
- version: '14.4.1',
9
+ publishDate: 1777909919,
10
+ version: '14.5.0-develop.1',
11
11
  licensingDocsUrl:
12
12
  'https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
13
13
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-dateinputs",
3
- "version": "14.4.1",
3
+ "version": "14.5.0-develop.1",
4
4
  "description": "React DateInput is a perfect input component for handling quick and efficient date values. KendoReact Date Inputs package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -28,12 +28,12 @@
28
28
  "@progress/kendo-date-math": "^1.4.0",
29
29
  "@progress/kendo-licensing": "^1.7.2",
30
30
  "@progress/kendo-dateinputs-common": "^0.4.7",
31
- "@progress/kendo-react-buttons": "14.4.1",
32
- "@progress/kendo-react-common": "14.4.1",
33
- "@progress/kendo-react-intl": "14.4.1",
34
- "@progress/kendo-react-labels": "14.4.1",
35
- "@progress/kendo-react-layout": "14.4.1",
36
- "@progress/kendo-react-popup": "14.4.1",
31
+ "@progress/kendo-react-buttons": "14.5.0-develop.1",
32
+ "@progress/kendo-react-common": "14.5.0-develop.1",
33
+ "@progress/kendo-react-intl": "14.5.0-develop.1",
34
+ "@progress/kendo-react-labels": "14.5.0-develop.1",
35
+ "@progress/kendo-react-layout": "14.5.0-develop.1",
36
+ "@progress/kendo-react-popup": "14.5.0-develop.1",
37
37
  "@progress/kendo-svg-icons": "^4.0.0",
38
38
  "react": "^18.0.0 || ^19.0.0",
39
39
  "react-dom": "^18.0.0 || ^19.0.0"
@@ -89,7 +89,7 @@
89
89
  "package": {
90
90
  "productName": "KendoReact",
91
91
  "productCode": "KENDOUIREACT",
92
- "publishDate": 1777886224,
92
+ "publishDate": 1777909919,
93
93
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
94
94
  }
95
95
  },
@@ -5,7 +5,6 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { default as PropTypes } from 'prop-types';
9
8
  import { DateInputsClassStructure } from '@progress/kendo-react-common';
10
9
  import { ScrollAction, PageAction } from './services/index.js';
11
10
  import * as React from 'react';
@@ -57,69 +56,32 @@ export interface VirtualizationProps {
57
56
  /**
58
57
  * @hidden
59
58
  */
60
- export declare class Virtualization extends React.Component<VirtualizationProps, {}> {
61
- static propTypes: {
62
- bottomOffset: PropTypes.Validator<number>;
63
- className: PropTypes.Requireable<string>;
64
- direction: PropTypes.Requireable<string>;
65
- forceScroll: PropTypes.Requireable<boolean>;
66
- itemHeight: PropTypes.Requireable<number>;
67
- itemWidth: PropTypes.Requireable<number>;
68
- maxScrollDifference: PropTypes.Requireable<number>;
69
- onScroll: PropTypes.Requireable<(...args: any[]) => any>;
70
- onScrollAction: PropTypes.Requireable<(...args: any[]) => any>;
71
- scrollDuration: PropTypes.Requireable<number>;
72
- scrollOffsetSize: PropTypes.Requireable<number>;
73
- skip: PropTypes.Validator<number>;
74
- tabIndex: PropTypes.Requireable<number>;
75
- take: PropTypes.Validator<number>;
76
- topOffset: PropTypes.Validator<number>;
77
- total: PropTypes.Validator<number>;
78
- role: PropTypes.Requireable<string>;
79
- };
80
- static defaultProps: {
81
- direction: Direction;
82
- forceScroll: boolean;
83
- scrollOffsetSize: number;
84
- maxScrollDifference: number;
85
- scrollDuration: number;
86
- };
87
- private cancelAnimation;
88
- private rowHeightService;
89
- private scrollerService;
90
- private scrollContainer;
91
- private scrollAction?;
92
- private pageAction?;
93
- private lastDirection;
94
- private lastTotal;
95
- private lastTake;
96
- private animationInProgress;
97
- private restrictScroll;
98
- get element(): HTMLDivElement | null;
99
- protected get containerOffsetSize(): number;
100
- get containerScrollSize(): number;
101
- get containerScrollPosition(): number;
102
- protected get direction(): Direction;
103
- protected get scrollOffsetSize(): number;
104
- constructor(props: VirtualizationProps);
59
+ export interface VirtualizationHandle {
60
+ element: HTMLDivElement | null;
61
+ containerScrollSize: number;
62
+ containerScrollPosition: number;
105
63
  activeIndex(): number;
106
- itemIndex(offset: number): number;
107
- itemOffset(index: number): number;
64
+ scrollTo(value: number): void;
65
+ scrollToIndex(index: number): void;
66
+ animateToIndex(index: number): void;
67
+ scrollToBottom(): void;
108
68
  isIndexVisible(index: number): boolean;
109
69
  isListScrolled(index: number): boolean;
110
- scrollTo: (value: number) => void;
111
- scrollToIndex: (index: number) => void;
112
- animateToIndex: (index: number) => void;
113
- scrollToBottom: () => void;
114
- componentDidMount(): void;
115
- render(): React.JSX.Element;
116
- protected scrollStep: (start: number, end: number) => number;
117
- protected scrollRange: (indexOffset: number, direction: ScrollDirection) => any;
118
- protected containerMaxScroll: () => number;
119
- protected getContainerScrollDirection: (indexOffset: number) => ScrollDirection;
120
- protected initServices: (props?: VirtualizationProps) => void;
121
- protected getContainerProperty: (propertyName: 'offsetHeight' | 'offsetWidth' | 'scrollHeight' | 'scrollWidth' | 'scrollTop' | 'scrollLeft') => number;
122
- private handleScroll;
123
- private handleScrollAction;
124
- private handlePageAction;
70
+ itemIndex(offset: number): number;
71
+ itemOffset(index: number): number;
125
72
  }
73
+ /**
74
+ * The default props of the Virtualization component.
75
+ *
76
+ * @hidden
77
+ */
78
+ export declare const virtualizationDefaultProps: {
79
+ direction: Direction;
80
+ scrollOffsetSize: number;
81
+ maxScrollDifference: number;
82
+ scrollDuration: number;
83
+ };
84
+ /**
85
+ * @hidden
86
+ */
87
+ export declare const Virtualization: React.ForwardRefExoticComponent<VirtualizationProps & React.RefAttributes<VirtualizationHandle | null>>;
@@ -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 w=require("react"),s=require("prop-types"),f=require("@progress/kendo-react-common"),H=require("./services/ScrollerService.js");function P(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const g=P(w),T=(r,e,t)=>Math.min(Math.abs(e-r),t),C=17,O=10,A={1:r=>e=>e+r,0:r=>e=>e-r},x={1:r=>e=>Math.min(e,r),0:r=>e=>Math.max(e,r)},I={1:r=>e=>e<r,0:r=>e=>e>r},a=class a extends g.Component{constructor(e){super(e),this.rowHeightService=null,this.scrollContainer=null,this.lastDirection=null,this.lastTotal=0,this.lastTake=0,this.animationInProgress=!1,this.restrictScroll=!1,this.scrollTo=t=>{const i=this.direction==="vertical"?"scrollTop":"scrollLeft";if(!this.scrollContainer)return;const o=this.scrollContainer[i];this.restrictScroll&&i==="scrollTop"&&(!Number.isInteger(o)||!Number.isInteger(t))&&Math.abs(o-t)<O||(this.scrollContainer[i]=t)},this.scrollToIndex=t=>{this.animationInProgress=!1,this.rowHeightService&&this.scrollTo(this.rowHeightService.offset(t))},this.animateToIndex=t=>{if(!this.rowHeightService||!window)return;window.cancelAnimationFrame(this.cancelAnimation);const i=this.rowHeightService.offset(t),o=this.getContainerScrollDirection(i),{start:n,end:l}=this.scrollRange(i,o);if(n===l)return;const S=this.scrollStep(n,l),c=A[o](S),h=x[o](l),u=I[o](c(l)),m=p=>{this.animationInProgress=!0;const d=c(p);this.scrollTo(h(d)),u(d)?this.cancelAnimation=window.requestAnimationFrame(()=>{m(d)}):this.animationInProgress=!1};this.cancelAnimation=window.requestAnimationFrame(()=>{m(n)})},this.scrollToBottom=()=>{this.rowHeightService&&this.scrollTo(this.rowHeightService.totalHeight()+this.props.bottomOffset)},this.scrollStep=(t,i)=>{const o=this.props.scrollDuration||a.defaultProps.scrollDuration;return Math.abs(i-t)/(o/C)},this.scrollRange=(t,i)=>{const o=this.containerScrollPosition;if(parseInt(`${t}`,10)===parseInt(`${o}`,10))return{start:t,end:t};const n=this.containerMaxScroll(),l=i===0?1:-1,S=T(o,t,this.props.maxScrollDifference||0),c=Math.min(t,n);return{start:Math.min(Math.max(c+l*S,0),n),end:c}},this.containerMaxScroll=()=>this.containerScrollSize-this.containerOffsetSize,this.getContainerScrollDirection=t=>t<this.containerScrollPosition?0:1,this.initServices=(t=this.props)=>{const i=this.direction==="vertical"?t.itemHeight:t.itemWidth;i!==void 0&&(this.rowHeightService=new f.RowHeightService(t.total,i),this.scrollerService.create(this.rowHeightService,t.skip,t.take,t.total,t.topOffset,this.scrollOffsetSize,this.direction))},this.getContainerProperty=t=>this.scrollContainer?this.scrollContainer[t]:0,this.handleScroll=t=>{if(!this.scrollContainer||!this.rowHeightService)return;const i=t.target;this.scrollerService.onScroll({scrollLeft:i.scrollLeft,scrollTop:i.scrollTop,offsetHeight:i.offsetHeight,offsetWidth:i.offsetWidth});const o=this.rowHeightService.index(this.containerScrollPosition-this.props.topOffset),{onScrollAction:n}=this.props,l={index:o,target:i,scrollAction:this.scrollAction,pageAction:this.pageAction,animationInProgress:this.animationInProgress};this.props.onScroll&&this.props.onScroll.call(void 0,t),n&&n.call(void 0,l),this.scrollAction=void 0,this.pageAction=void 0},this.handleScrollAction=t=>{this.scrollAction=t},this.handlePageAction=t=>{this.pageAction=t},this.scrollerService=new H.ScrollerService(this.handleScrollAction,this.handlePageAction),this.restrictScroll=Number.parseFloat(g.version)>17}get element(){return this.scrollContainer}get containerOffsetSize(){return this.getContainerProperty(this.direction==="vertical"?"offsetHeight":"offsetWidth")}get containerScrollSize(){return this.getContainerProperty(this.direction==="vertical"?"scrollHeight":"scrollWidth")}get containerScrollPosition(){return this.getContainerProperty(this.direction==="vertical"?"scrollTop":"scrollLeft")}get direction(){return this.props.direction!==void 0?this.props.direction:a.defaultProps.direction}get scrollOffsetSize(){return this.props.scrollOffsetSize!==void 0?this.props.scrollOffsetSize:a.defaultProps.scrollOffsetSize}activeIndex(){return this.itemIndex(Math.ceil(this.containerScrollPosition))}itemIndex(e){return this.rowHeightService?this.rowHeightService.index(e):0}itemOffset(e){return this.rowHeightService?this.rowHeightService.offset(e):0}isIndexVisible(e){if(!this.rowHeightService)return!1;const t=this.containerScrollPosition,i=t+this.containerOffsetSize,o=this.rowHeightService.offset(e),n=o+this.rowHeightService.height(e);return o>=t&&n<=i}isListScrolled(e){return this.rowHeightService?this.containerScrollPosition!==this.rowHeightService.offset(e):!1}componentDidMount(){const{onMount:e}=this.props;e&&e.call(void 0,this)}render(){const{total:e,take:t,bottomOffset:i,className:o,tabIndex:n,role:l,children:S,unstyled:c}=this.props,h=c&&c.uCalendar;(this.lastTotal!==e||this.lastDirection!==this.direction||this.lastTake!==t)&&(this.initServices(),this.lastTotal=e,this.lastDirection=this.direction,this.lastTake=t);const u=`${(this.rowHeightService?this.rowHeightService.totalHeight():0)+i}`,m=this.direction==="vertical"?{height:`${u}px`}:{width:`${u}px`},p=f.classNames(f.uCalendar.scrollableSelector({c:h}),f.uCalendar.scrollable({c:h,horizontal:this.direction==="horizontal"}),o),d=f.classNames(f.uCalendar.scrollablePlaceholder({c:h,horizontal:this.direction==="horizontal"}));return g.createElement("div",{ref:b=>{this.scrollContainer=b},onScroll:this.handleScroll,className:p,tabIndex:n,role:l},S,g.createElement("div",{style:m,className:d}))}};a.propTypes={bottomOffset:s.number.isRequired,className:s.string,direction:s.oneOf(["horizontal","vertical"]),forceScroll:s.bool,itemHeight:s.number,itemWidth:s.number,maxScrollDifference:s.number,onScroll:s.func,onScrollAction:s.func,scrollDuration:s.number,scrollOffsetSize:s.number,skip:s.number.isRequired,tabIndex:s.number,take:s.number.isRequired,topOffset:s.number.isRequired,total:s.number.isRequired,role:s.string},a.defaultProps={direction:"vertical",forceScroll:!1,scrollOffsetSize:0,maxScrollDifference:100,scrollDuration:100};let v=a;exports.Virtualization=v;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ze=require("react"),l=require("prop-types"),d=require("@progress/kendo-react-common"),xe=require("./services/ScrollerService.js");function Ne(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const g=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,g.get?g:{enumerable:!0,get:()=>t[s]})}}return n.default=t,Object.freeze(n)}const c=Ne(ze),De=(t,n,s)=>Math.min(Math.abs(n-t),s),Ie=17,Me=10,Ce={1:t=>n=>n+t,0:t=>n=>n-t},Oe={1:t=>n=>Math.min(n,t),0:t=>n=>Math.max(n,t)},Pe={1:t=>n=>n<t,0:t=>n=>n>t},S={direction:"vertical",scrollOffsetSize:0,maxScrollDifference:100,scrollDuration:100},P=c.forwardRef((t,n)=>{const{direction:s=S.direction,scrollOffsetSize:g=S.scrollOffsetSize,maxScrollDifference:K=S.maxScrollDifference,scrollDuration:U=S.scrollDuration,bottomOffset:A,className:G,tabIndex:J,role:Q,children:X,unstyled:T,total:b,take:z,skip:Y,topOffset:y,itemHeight:Z,itemWidth:ee,onMount:H,onScroll:q,onScrollAction:L}=t,x=e=>u.current?u.current[e]:0,k=()=>x(s==="vertical"?"offsetHeight":"offsetWidth"),w=()=>x(s==="vertical"?"scrollHeight":"scrollWidth"),m=()=>x(s==="vertical"?"scrollTop":"scrollLeft"),te=()=>w()-k(),re=e=>e<m()?0:1,ne=(e,o)=>{const i=U||S.scrollDuration;return Math.abs(o-e)/(i/Ie)},oe=(e,o)=>{const i=m();if(Number.parseInt(`${e}`,10)===Number.parseInt(`${i}`,10))return{start:e,end:e};const a=te(),f=o===0?1:-1,C=De(i,e,K||0),h=Math.min(e,a);return{start:Math.min(Math.max(h+f*C,0),a),end:h}},V=e=>r.current?r.current.index(e):0,ce=e=>r.current?r.current.offset(e):0,se=()=>V(Math.ceil(m())),le=e=>{if(!r.current)return!1;const o=m(),i=o+k(),a=r.current.offset(e),f=a+r.current.height(e);return a>=o&&f<=i},ie=e=>r.current?m()!==r.current.offset(e):!1,p=e=>{const o=s==="vertical"?"scrollTop":"scrollLeft";if(!u.current)return;const i=u.current[o];ge.current&&o==="scrollTop"&&(!Number.isInteger(i)||!Number.isInteger(e))&&Math.abs(i-e)<Me||(u.current[o]=e)},ae=e=>{v.current=!1,r.current&&p(r.current.offset(e))},ue=e=>{if(!r.current||!globalThis)return;globalThis.cancelAnimationFrame(N.current);const o=r.current.offset(e),i=re(o),{start:a,end:f}=oe(o,i);if(a===f)return;const C=ne(a,f),h=Ce[i](C),$=Oe[i](f),ve=Pe[i](h(f)),B=Te=>{v.current=!0;const O=h(Te);p($(O)),ve(O)?N.current=globalThis.requestAnimationFrame(()=>{B(O)}):v.current=!1};N.current=globalThis.requestAnimationFrame(()=>{B(a)})},fe=()=>{r.current&&p(r.current.totalHeight()+A)},me=e=>{D.current=e},de=e=>{I.current=e},Se=e=>{if(!u.current||!r.current)return;const o=e.target;W.current.onScroll({scrollLeft:o.scrollLeft,scrollTop:o.scrollTop,offsetHeight:o.offsetHeight,offsetWidth:o.offsetWidth});const a={index:r.current.index(m()-y),target:o,scrollAction:D.current,pageAction:I.current,animationInProgress:v.current};q&&q(e),L&&L(a),D.current=void 0,I.current=void 0},he=()=>{const e=s==="vertical"?Z:ee;e!==void 0&&(r.current=new d.RowHeightService(b,e),W.current.create(r.current,Y,z,b,y,g,s))},R=c.useRef(null),u=c.useRef(null),W=c.useRef(new xe.ScrollerService(me,de)),r=c.useRef(null),N=c.useRef(0),v=c.useRef(!1),ge=c.useRef(Number.parseFloat(c.version)>17),D=c.useRef(void 0),I=c.useRef(void 0),_=c.useRef(0),j=c.useRef(0),E=c.useRef(null);c.useImperativeHandle(R,()=>({element:u.current,containerScrollSize:w(),containerScrollPosition:m(),activeIndex:se,scrollTo:p,scrollToIndex:ae,animateToIndex:ue,scrollToBottom:fe,isIndexVisible:le,isListScrolled:ie,itemIndex:V,itemOffset:ce})),c.useImperativeHandle(n,()=>R.current),c.useEffect(()=>{H&&R.current&&H(R.current)},[]);const M=T==null?void 0:T.uCalendar;(_.current!==b||E.current!==s||j.current!==z)&&(he(),_.current=b,E.current=s,j.current=z);const F=`${(r.current?r.current.totalHeight():0)+A}`,be=s==="vertical"?{height:`${F}px`}:{width:`${F}px`},pe=d.classNames(d.uCalendar.scrollableSelector({c:M}),d.uCalendar.scrollable({c:M,horizontal:s==="horizontal"}),G),Re=d.classNames(d.uCalendar.scrollablePlaceholder({c:M,horizontal:s==="horizontal"}));return c.createElement("div",{ref:u,onScroll:Se,className:pe,tabIndex:J,role:Q},X,c.createElement("div",{style:be,className:Re}))});P.propTypes={bottomOffset:l.number.isRequired,className:l.string,direction:l.oneOf(["horizontal","vertical"]),itemHeight:l.number,itemWidth:l.number,maxScrollDifference:l.number,onScroll:l.func,onScrollAction:l.func,scrollDuration:l.number,scrollOffsetSize:l.number,skip:l.number.isRequired,tabIndex:l.number,take:l.number.isRequired,topOffset:l.number.isRequired,total:l.number.isRequired,role:l.string};P.displayName="KendoReactVirtualization";const Ae=P;exports.Virtualization=Ae;exports.virtualizationDefaultProps=S;
@@ -5,171 +5,170 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as u from "react";
8
+ import * as n from "react";
9
9
  import o from "prop-types";
10
- import { RowHeightService as b, classNames as v, uCalendar as p } from "@progress/kendo-react-common";
11
- import { ScrollerService as P } from "./services/ScrollerService.mjs";
12
- const T = (s, i, t) => Math.min(Math.abs(i - s), t), A = 17, C = 10, x = {
13
- 1: (s) => (i) => i + s,
14
- 0: (s) => (i) => i - s
15
- }, I = {
16
- 1: (s) => (i) => Math.min(i, s),
17
- 0: (s) => (i) => Math.max(i, s)
18
- }, M = {
19
- 1: (s) => (i) => i < s,
20
- 0: (s) => (i) => i > s
21
- }, a = class a extends u.Component {
22
- constructor(i) {
23
- super(i), this.rowHeightService = null, this.scrollContainer = null, this.lastDirection = null, this.lastTotal = 0, this.lastTake = 0, this.animationInProgress = !1, this.restrictScroll = !1, this.scrollTo = (t) => {
24
- const e = this.direction === "vertical" ? "scrollTop" : "scrollLeft";
25
- if (!this.scrollContainer)
26
- return;
27
- const r = this.scrollContainer[e];
28
- this.restrictScroll && e === "scrollTop" && (!Number.isInteger(r) || !Number.isInteger(t)) && Math.abs(r - t) < C || (this.scrollContainer[e] = t);
29
- }, this.scrollToIndex = (t) => {
30
- this.animationInProgress = !1, this.rowHeightService && this.scrollTo(this.rowHeightService.offset(t));
31
- }, this.animateToIndex = (t) => {
32
- if (!this.rowHeightService || !window)
33
- return;
34
- window.cancelAnimationFrame(this.cancelAnimation);
35
- const e = this.rowHeightService.offset(t), r = this.getContainerScrollDirection(e), { start: n, end: l } = this.scrollRange(e, r);
36
- if (n === l)
37
- return;
38
- const f = this.scrollStep(n, l), c = x[r](f), h = I[r](l), d = M[r](c(l)), m = (g) => {
39
- this.animationInProgress = !0;
40
- const S = c(g);
41
- this.scrollTo(h(S)), d(S) ? this.cancelAnimation = window.requestAnimationFrame(() => {
42
- m(S);
43
- }) : this.animationInProgress = !1;
44
- };
45
- this.cancelAnimation = window.requestAnimationFrame(() => {
46
- m(n);
47
- });
48
- }, this.scrollToBottom = () => {
49
- this.rowHeightService && this.scrollTo(this.rowHeightService.totalHeight() + this.props.bottomOffset);
50
- }, this.scrollStep = (t, e) => {
51
- const r = this.props.scrollDuration || a.defaultProps.scrollDuration;
52
- return Math.abs(e - t) / (r / A);
53
- }, this.scrollRange = (t, e) => {
54
- const r = this.containerScrollPosition;
55
- if (parseInt(`${t}`, 10) === parseInt(`${r}`, 10))
56
- return { start: t, end: t };
57
- const n = this.containerMaxScroll(), l = e === 0 ? 1 : -1, f = T(r, t, this.props.maxScrollDifference || 0), c = Math.min(t, n);
58
- return { start: Math.min(Math.max(c + l * f, 0), n), end: c };
59
- }, this.containerMaxScroll = () => this.containerScrollSize - this.containerOffsetSize, this.getContainerScrollDirection = (t) => t < this.containerScrollPosition ? 0 : 1, this.initServices = (t = this.props) => {
60
- const e = this.direction === "vertical" ? t.itemHeight : t.itemWidth;
61
- e !== void 0 && (this.rowHeightService = new b(t.total, e), this.scrollerService.create(
62
- this.rowHeightService,
63
- t.skip,
64
- t.take,
65
- t.total,
66
- t.topOffset,
67
- this.scrollOffsetSize,
68
- this.direction
69
- ));
70
- }, this.getContainerProperty = (t) => this.scrollContainer ? this.scrollContainer[t] : 0, this.handleScroll = (t) => {
71
- if (!this.scrollContainer || !this.rowHeightService)
72
- return;
73
- const e = t.target;
74
- this.scrollerService.onScroll({
75
- scrollLeft: e.scrollLeft,
76
- scrollTop: e.scrollTop,
77
- offsetHeight: e.offsetHeight,
78
- offsetWidth: e.offsetWidth
79
- });
80
- const r = this.rowHeightService.index(this.containerScrollPosition - this.props.topOffset), { onScrollAction: n } = this.props, l = {
81
- index: r,
82
- target: e,
83
- scrollAction: this.scrollAction,
84
- pageAction: this.pageAction,
85
- animationInProgress: this.animationInProgress
86
- };
87
- this.props.onScroll && this.props.onScroll.call(void 0, t), n && n.call(void 0, l), this.scrollAction = void 0, this.pageAction = void 0;
88
- }, this.handleScrollAction = (t) => {
89
- this.scrollAction = t;
90
- }, this.handlePageAction = (t) => {
91
- this.pageAction = t;
92
- }, this.scrollerService = new P(this.handleScrollAction, this.handlePageAction), this.restrictScroll = Number.parseFloat(u.version) > 17;
93
- }
94
- get element() {
95
- return this.scrollContainer;
96
- }
97
- get containerOffsetSize() {
98
- return this.getContainerProperty(this.direction === "vertical" ? "offsetHeight" : "offsetWidth");
99
- }
100
- get containerScrollSize() {
101
- return this.getContainerProperty(this.direction === "vertical" ? "scrollHeight" : "scrollWidth");
102
- }
103
- get containerScrollPosition() {
104
- return this.getContainerProperty(this.direction === "vertical" ? "scrollTop" : "scrollLeft");
105
- }
106
- get direction() {
107
- return this.props.direction !== void 0 ? this.props.direction : a.defaultProps.direction;
108
- }
109
- get scrollOffsetSize() {
110
- return this.props.scrollOffsetSize !== void 0 ? this.props.scrollOffsetSize : a.defaultProps.scrollOffsetSize;
111
- }
112
- activeIndex() {
113
- return this.itemIndex(Math.ceil(this.containerScrollPosition));
114
- }
115
- itemIndex(i) {
116
- return this.rowHeightService ? this.rowHeightService.index(i) : 0;
117
- }
118
- itemOffset(i) {
119
- return this.rowHeightService ? this.rowHeightService.offset(i) : 0;
120
- }
121
- isIndexVisible(i) {
122
- if (!this.rowHeightService)
10
+ import { classNames as K, uCalendar as D, RowHeightService as ze } from "@progress/kendo-react-common";
11
+ import { ScrollerService as Ie } from "./services/ScrollerService.mjs";
12
+ const Ne = (c, s, i) => Math.min(Math.abs(s - c), i), Me = 17, Ae = 10, De = {
13
+ 1: (c) => (s) => s + c,
14
+ 0: (c) => (s) => s - c
15
+ }, Ce = {
16
+ 1: (c) => (s) => Math.min(s, c),
17
+ 0: (c) => (s) => Math.max(s, c)
18
+ }, He = {
19
+ 1: (c) => (s) => s < c,
20
+ 0: (c) => (s) => s > c
21
+ }, h = {
22
+ direction: "vertical",
23
+ scrollOffsetSize: 0,
24
+ maxScrollDifference: 100,
25
+ scrollDuration: 100
26
+ }, C = n.forwardRef((c, s) => {
27
+ const {
28
+ direction: i = h.direction,
29
+ scrollOffsetSize: U = h.scrollOffsetSize,
30
+ maxScrollDifference: j = h.maxScrollDifference,
31
+ scrollDuration: G = h.scrollDuration,
32
+ bottomOffset: H,
33
+ className: J,
34
+ tabIndex: Q,
35
+ role: X,
36
+ children: Y,
37
+ unstyled: b,
38
+ total: S,
39
+ take: v,
40
+ skip: Z,
41
+ topOffset: P,
42
+ itemHeight: ee,
43
+ itemWidth: re,
44
+ onMount: O,
45
+ onScroll: L,
46
+ onScrollAction: q
47
+ } = c, T = (e) => u.current ? u.current[e] : 0, y = () => T(i === "vertical" ? "offsetHeight" : "offsetWidth"), w = () => T(i === "vertical" ? "scrollHeight" : "scrollWidth"), m = () => T(i === "vertical" ? "scrollTop" : "scrollLeft"), te = () => w() - y(), ne = (e) => e < m() ? 0 : 1, oe = (e, t) => {
48
+ const l = G || h.scrollDuration;
49
+ return Math.abs(t - e) / (l / Me);
50
+ }, ce = (e, t) => {
51
+ const l = m();
52
+ if (Number.parseInt(`${e}`, 10) === Number.parseInt(`${l}`, 10))
53
+ return { start: e, end: e };
54
+ const a = te(), f = t === 0 ? 1 : -1, M = Ne(l, e, j || 0), d = Math.min(e, a);
55
+ return { start: Math.min(Math.max(d + f * M, 0), a), end: d };
56
+ }, V = (e) => r.current ? r.current.index(e) : 0, se = (e) => r.current ? r.current.offset(e) : 0, le = () => V(Math.ceil(m())), ie = (e) => {
57
+ if (!r.current)
123
58
  return !1;
124
- const t = this.containerScrollPosition, e = t + this.containerOffsetSize, r = this.rowHeightService.offset(i), n = r + this.rowHeightService.height(i);
125
- return r >= t && n <= e;
126
- }
127
- isListScrolled(i) {
128
- return this.rowHeightService ? this.containerScrollPosition !== this.rowHeightService.offset(i) : !1;
129
- }
130
- componentDidMount() {
131
- const { onMount: i } = this.props;
132
- i && i.call(void 0, this);
133
- }
134
- render() {
135
- const { total: i, take: t, bottomOffset: e, className: r, tabIndex: n, role: l, children: f, unstyled: c } = this.props, h = c && c.uCalendar;
136
- (this.lastTotal !== i || this.lastDirection !== this.direction || this.lastTake !== t) && (this.initServices(), this.lastTotal = i, this.lastDirection = this.direction, this.lastTake = t);
137
- const d = `${(this.rowHeightService ? this.rowHeightService.totalHeight() : 0) + e}`, m = this.direction === "vertical" ? { height: `${d}px` } : { width: `${d}px` }, g = v(
138
- p.scrollableSelector({
139
- c: h
140
- }),
141
- p.scrollable({
142
- c: h,
143
- horizontal: this.direction === "horizontal"
144
- }),
145
- r
146
- ), S = v(
147
- p.scrollablePlaceholder({
148
- c: h,
149
- horizontal: this.direction === "horizontal"
150
- })
151
- );
152
- return /* @__PURE__ */ u.createElement(
153
- "div",
154
- {
155
- ref: (H) => {
156
- this.scrollContainer = H;
157
- },
158
- onScroll: this.handleScroll,
159
- className: g,
160
- tabIndex: n,
161
- role: l
162
- },
163
- f,
164
- /* @__PURE__ */ u.createElement("div", { style: m, className: S })
165
- );
166
- }
167
- };
168
- a.propTypes = {
59
+ const t = m(), l = t + y(), a = r.current.offset(e), f = a + r.current.height(e);
60
+ return a >= t && f <= l;
61
+ }, ae = (e) => r.current ? m() !== r.current.offset(e) : !1, p = (e) => {
62
+ const t = i === "vertical" ? "scrollTop" : "scrollLeft";
63
+ if (!u.current)
64
+ return;
65
+ const l = u.current[t];
66
+ Re.current && t === "scrollTop" && (!Number.isInteger(l) || !Number.isInteger(e)) && Math.abs(l - e) < Ae || (u.current[t] = e);
67
+ }, ue = (e) => {
68
+ g.current = !1, r.current && p(r.current.offset(e));
69
+ }, fe = (e) => {
70
+ if (!r.current || !globalThis)
71
+ return;
72
+ globalThis.cancelAnimationFrame(x.current);
73
+ const t = r.current.offset(e), l = ne(t), { start: a, end: f } = ce(t, l);
74
+ if (a === f)
75
+ return;
76
+ const M = oe(a, f), d = De[l](M), _ = Ce[l](f), Te = He[l](d(f)), B = (xe) => {
77
+ g.current = !0;
78
+ const A = d(xe);
79
+ p(_(A)), Te(A) ? x.current = globalThis.requestAnimationFrame(() => {
80
+ B(A);
81
+ }) : g.current = !1;
82
+ };
83
+ x.current = globalThis.requestAnimationFrame(() => {
84
+ B(a);
85
+ });
86
+ }, me = () => {
87
+ r.current && p(r.current.totalHeight() + H);
88
+ }, de = (e) => {
89
+ z.current = e;
90
+ }, he = (e) => {
91
+ I.current = e;
92
+ }, Se = (e) => {
93
+ if (!u.current || !r.current)
94
+ return;
95
+ const t = e.target;
96
+ W.current.onScroll({
97
+ scrollLeft: t.scrollLeft,
98
+ scrollTop: t.scrollTop,
99
+ offsetHeight: t.offsetHeight,
100
+ offsetWidth: t.offsetWidth
101
+ });
102
+ const a = {
103
+ index: r.current.index(m() - P),
104
+ target: t,
105
+ scrollAction: z.current,
106
+ pageAction: I.current,
107
+ animationInProgress: g.current
108
+ };
109
+ L && L(e), q && q(a), z.current = void 0, I.current = void 0;
110
+ }, pe = () => {
111
+ const e = i === "vertical" ? ee : re;
112
+ e !== void 0 && (r.current = new ze(S, e), W.current.create(
113
+ r.current,
114
+ Z,
115
+ v,
116
+ S,
117
+ P,
118
+ U,
119
+ i
120
+ ));
121
+ }, R = n.useRef(null), u = n.useRef(null), W = n.useRef(new Ie(de, he)), r = n.useRef(null), x = n.useRef(0), g = n.useRef(!1), Re = n.useRef(Number.parseFloat(n.version) > 17), z = n.useRef(void 0), I = n.useRef(void 0), k = n.useRef(0), E = n.useRef(0), F = n.useRef(null);
122
+ n.useImperativeHandle(R, () => ({
123
+ element: u.current,
124
+ containerScrollSize: w(),
125
+ containerScrollPosition: m(),
126
+ activeIndex: le,
127
+ scrollTo: p,
128
+ scrollToIndex: ue,
129
+ animateToIndex: fe,
130
+ scrollToBottom: me,
131
+ isIndexVisible: ie,
132
+ isListScrolled: ae,
133
+ itemIndex: V,
134
+ itemOffset: se
135
+ })), n.useImperativeHandle(s, () => R.current), n.useEffect(() => {
136
+ O && R.current && O(R.current);
137
+ }, []);
138
+ const N = b == null ? void 0 : b.uCalendar;
139
+ (k.current !== S || F.current !== i || E.current !== v) && (pe(), k.current = S, F.current = i, E.current = v);
140
+ const $ = `${(r.current ? r.current.totalHeight() : 0) + H}`, ge = i === "vertical" ? { height: `${$}px` } : { width: `${$}px` }, be = K(
141
+ D.scrollableSelector({
142
+ c: N
143
+ }),
144
+ D.scrollable({
145
+ c: N,
146
+ horizontal: i === "horizontal"
147
+ }),
148
+ J
149
+ ), ve = K(
150
+ D.scrollablePlaceholder({
151
+ c: N,
152
+ horizontal: i === "horizontal"
153
+ })
154
+ );
155
+ return /* @__PURE__ */ n.createElement(
156
+ "div",
157
+ {
158
+ ref: u,
159
+ onScroll: Se,
160
+ className: be,
161
+ tabIndex: Q,
162
+ role: X
163
+ },
164
+ Y,
165
+ /* @__PURE__ */ n.createElement("div", { style: ge, className: ve })
166
+ );
167
+ });
168
+ C.propTypes = {
169
169
  bottomOffset: o.number.isRequired,
170
170
  className: o.string,
171
171
  direction: o.oneOf(["horizontal", "vertical"]),
172
- forceScroll: o.bool,
173
172
  itemHeight: o.number,
174
173
  itemWidth: o.number,
175
174
  maxScrollDifference: o.number,
@@ -183,14 +182,10 @@ a.propTypes = {
183
182
  topOffset: o.number.isRequired,
184
183
  total: o.number.isRequired,
185
184
  role: o.string
186
- }, a.defaultProps = {
187
- direction: "vertical",
188
- forceScroll: !1,
189
- scrollOffsetSize: 0,
190
- maxScrollDifference: 100,
191
- scrollDuration: 100
192
185
  };
193
- let w = a;
186
+ C.displayName = "KendoReactVirtualization";
187
+ const qe = C;
194
188
  export {
195
- w as Virtualization
189
+ qe as Virtualization,
190
+ h as virtualizationDefaultProps
196
191
  };