@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.
- package/calendar/components/Calendar.d.ts +35 -110
- package/calendar/components/Calendar.js +5 -5
- package/calendar/components/Calendar.mjs +288 -313
- package/calendar/components/CalendarCell.d.ts +1 -10
- package/calendar/components/CalendarCell.js +1 -1
- package/calendar/components/CalendarCell.mjs +68 -78
- package/calendar/components/Header.d.ts +10 -23
- package/calendar/components/Header.js +1 -1
- package/calendar/components/Header.mjs +41 -55
- package/calendar/components/HorizontalViewList.d.ts +28 -26
- package/calendar/components/HorizontalViewList.js +1 -1
- package/calendar/components/HorizontalViewList.mjs +112 -102
- package/calendar/components/MultiViewCalendar.d.ts +39 -141
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +331 -373
- package/calendar/components/Navigation.d.ts +19 -39
- package/calendar/components/Navigation.js +1 -1
- package/calendar/components/Navigation.mjs +95 -107
- package/calendar/components/TodayCommand.d.ts +8 -25
- package/calendar/components/TodayCommand.js +1 -1
- package/calendar/components/TodayCommand.mjs +44 -61
- package/calendar/components/View.d.ts +11 -42
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +111 -137
- package/calendar/components/ViewList.d.ts +25 -65
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +207 -225
- package/calendar/services/ScrollSyncService.d.ts +4 -4
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/virtualization/Virtualization.d.ts +25 -63
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +163 -168
package/package-metadata.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 e=Object.freeze({name:"@progress/kendo-react-dateinputs",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
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;
|
package/package-metadata.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export const packageMetadata = Object.freeze({
|
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCode: 'KENDOUIREACT',
|
|
8
8
|
productCodes: ['KENDOUIREACT'],
|
|
9
|
-
publishDate:
|
|
10
|
-
version: '14.
|
|
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.
|
|
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.
|
|
32
|
-
"@progress/kendo-react-common": "14.
|
|
33
|
-
"@progress/kendo-react-intl": "14.
|
|
34
|
-
"@progress/kendo-react-labels": "14.
|
|
35
|
-
"@progress/kendo-react-layout": "14.
|
|
36
|
-
"@progress/kendo-react-popup": "14.
|
|
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":
|
|
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
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
107
|
-
|
|
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
|
-
|
|
111
|
-
|
|
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
|
|
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
|
|
8
|
+
import * as n from "react";
|
|
9
9
|
import o from "prop-types";
|
|
10
|
-
import {
|
|
11
|
-
import { ScrollerService as
|
|
12
|
-
const
|
|
13
|
-
1: (
|
|
14
|
-
0: (
|
|
15
|
-
},
|
|
16
|
-
1: (
|
|
17
|
-
0: (
|
|
18
|
-
},
|
|
19
|
-
1: (
|
|
20
|
-
0: (
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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 =
|
|
125
|
-
return
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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
|
-
|
|
186
|
+
C.displayName = "KendoReactVirtualization";
|
|
187
|
+
const qe = C;
|
|
194
188
|
export {
|
|
195
|
-
|
|
189
|
+
qe as Virtualization,
|
|
190
|
+
h as virtualizationDefaultProps
|
|
196
191
|
};
|