@progress/kendo-react-dateinputs 8.3.0-develop.6 → 8.3.0-develop.8
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.js +2 -2
- package/calendar/components/Calendar.mjs +123 -115
- package/calendar/components/CalendarCell.js +1 -1
- package/calendar/components/CalendarCell.mjs +37 -39
- package/calendar/components/CalendarHeaderTitle.js +1 -1
- package/calendar/components/CalendarHeaderTitle.mjs +6 -12
- package/calendar/components/CalendarNavigationItem.js +1 -1
- package/calendar/components/CalendarNavigationItem.mjs +15 -19
- package/calendar/components/CalendarWeekCell.js +1 -1
- package/calendar/components/CalendarWeekCell.mjs +10 -15
- package/calendar/components/Header.js +1 -1
- package/calendar/components/Header.mjs +30 -40
- package/calendar/components/Navigation.js +1 -1
- package/calendar/components/Navigation.mjs +52 -49
- package/calendar/components/TodayCommand.js +1 -1
- package/calendar/components/TodayCommand.mjs +21 -25
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +48 -42
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +99 -94
- package/common/ClearButton.js +1 -1
- package/common/ClearButton.mjs +25 -31
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +113 -110
- package/dateinput/utils.js +1 -1
- package/dateinput/utils.mjs +22 -23
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +9 -9
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +5 -5
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +95 -90
- package/datetimepicker/DateTimeSelector.js +1 -1
- package/datetimepicker/DateTimeSelector.mjs +83 -81
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +38 -28
- package/index.d.ts +38 -28
- package/package-metadata.mjs +1 -1
- package/package.json +7 -7
- package/timepicker/TimeList.js +3 -3
- package/timepicker/TimeList.mjs +83 -81
- package/timepicker/TimePart.js +1 -1
- package/timepicker/TimePart.mjs +74 -68
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +112 -107
- package/timepicker/TimeSelector.js +1 -1
- package/timepicker/TimeSelector.mjs +66 -59
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +49 -48
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as a from "react";
|
|
10
10
|
import t from "prop-types";
|
|
11
|
-
import { cloneDate as
|
|
12
|
-
import { Keys as h, classNames as
|
|
13
|
-
import { provideIntlService as
|
|
14
|
-
import { timePickerCancel as
|
|
15
|
-
import { MIDNIGHT_DATE as
|
|
16
|
-
import { getNow as
|
|
17
|
-
import { TimePart as
|
|
18
|
-
import { Button as
|
|
11
|
+
import { cloneDate as u } from "@progress/kendo-date-math";
|
|
12
|
+
import { Keys as h, classNames as m, uTimePicker as x, uTime as g, getActiveElement as A } from "@progress/kendo-react-common";
|
|
13
|
+
import { provideIntlService as K, provideLocalizationService as M, registerForIntl as R, registerForLocalization as F } from "@progress/kendo-react-intl";
|
|
14
|
+
import { timePickerCancel as y, messages as B, timePickerSet as D } from "../messages/index.mjs";
|
|
15
|
+
import { MIDNIGHT_DATE as L, MIN_TIME as j, MAX_TIME as z } from "../utils.mjs";
|
|
16
|
+
import { getNow as w, valueMerger as V, generateGetters as G } from "./utils.mjs";
|
|
17
|
+
import { TimePart as H } from "./TimePart.mjs";
|
|
18
|
+
import { Button as O } from "@progress/kendo-react-buttons";
|
|
19
19
|
const r = class r extends a.Component {
|
|
20
20
|
constructor(i) {
|
|
21
21
|
super(i), this._element = null, this._cancelButton = null, this._acceptButton = null, this.timePart = null, this.focusActiveList = () => {
|
|
@@ -33,12 +33,12 @@ const r = class r extends a.Component {
|
|
|
33
33
|
const { keyCode: n, shiftKey: o } = e;
|
|
34
34
|
!o && n === h.tab && (e.preventDefault(), this.props.nowButton !== !1 ? this.timePart && this.timePart.focus({ preventScroll: !0 }, !0) : this.timePart && this.timePart.focus({ preventScroll: !0 }));
|
|
35
35
|
}, this.handleNowKeyDown = (e) => {
|
|
36
|
-
var
|
|
36
|
+
var c;
|
|
37
37
|
const { keyCode: n, shiftKey: o } = e;
|
|
38
|
-
o && n === h.tab ? (e.preventDefault(), this._acceptButton && ((
|
|
38
|
+
o && n === h.tab ? (e.preventDefault(), this._acceptButton && ((c = this._acceptButton.element) == null || c.focus({ preventScroll: !0 }))) : n === h.enter && (e.stopPropagation(), this.handleNowClick(e));
|
|
39
39
|
}, this.handleAccept = (e) => {
|
|
40
40
|
const n = this.mergeValue(
|
|
41
|
-
|
|
41
|
+
u(this.value || w()),
|
|
42
42
|
this.timePart ? this.timePart.value : this.current
|
|
43
43
|
);
|
|
44
44
|
this.setState({ value: n }), this.valueDuringOnChange = n;
|
|
@@ -55,8 +55,8 @@ const r = class r extends a.Component {
|
|
|
55
55
|
n && n.call(void 0, e);
|
|
56
56
|
}, this.handleNowClick = (e) => {
|
|
57
57
|
const n = this.mergeValue(
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
u(this.value || w()),
|
|
59
|
+
w()
|
|
60
60
|
);
|
|
61
61
|
this.setState({
|
|
62
62
|
current: n,
|
|
@@ -75,8 +75,8 @@ const r = class r extends a.Component {
|
|
|
75
75
|
n && n.call(void 0, {
|
|
76
76
|
time: e
|
|
77
77
|
});
|
|
78
|
-
}, this.dateFormatParts = this.intl.splitDateFormat(this.props.format || r.defaultProps.format), this.mergeValue =
|
|
79
|
-
current: this.props.value ||
|
|
78
|
+
}, this.dateFormatParts = this.intl.splitDateFormat(this.props.format || r.defaultProps.format), this.mergeValue = V(G(this.dateFormatParts)), this.hasActiveButton = this.hasActiveButton.bind(this), this.state = {
|
|
79
|
+
current: this.props.value || L,
|
|
80
80
|
value: this.props.value || r.defaultProps.value
|
|
81
81
|
};
|
|
82
82
|
}
|
|
@@ -88,13 +88,13 @@ const r = class r extends a.Component {
|
|
|
88
88
|
}
|
|
89
89
|
get value() {
|
|
90
90
|
const i = this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value;
|
|
91
|
-
return i !== null ?
|
|
91
|
+
return i !== null ? u(i) : null;
|
|
92
92
|
}
|
|
93
93
|
get intl() {
|
|
94
|
-
return
|
|
94
|
+
return K(this);
|
|
95
95
|
}
|
|
96
96
|
get current() {
|
|
97
|
-
return this.state.current !== null ?
|
|
97
|
+
return this.state.current !== null ? u(this.state.current) : null;
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* @hidden
|
|
@@ -111,16 +111,17 @@ const r = class r extends a.Component {
|
|
|
111
111
|
cancelButton: e,
|
|
112
112
|
disabled: n,
|
|
113
113
|
tabIndex: o,
|
|
114
|
-
className:
|
|
115
|
-
smoothScroll:
|
|
116
|
-
min:
|
|
117
|
-
max:
|
|
118
|
-
boundRange:
|
|
119
|
-
nowButton:
|
|
120
|
-
steps:
|
|
121
|
-
show:
|
|
122
|
-
mobileMode:
|
|
123
|
-
|
|
114
|
+
className: c,
|
|
115
|
+
smoothScroll: P,
|
|
116
|
+
min: N,
|
|
117
|
+
max: k,
|
|
118
|
+
boundRange: T,
|
|
119
|
+
nowButton: E,
|
|
120
|
+
steps: S,
|
|
121
|
+
show: _,
|
|
122
|
+
mobileMode: b,
|
|
123
|
+
unstyled: l
|
|
124
|
+
} = this.props, I = l && l.uTimePicker, d = l && l.uTime, C = M(this), f = C.toLanguageString(y, B[y]), v = C.toLanguageString(D, B[D]);
|
|
124
125
|
return /* @__PURE__ */ a.createElement(
|
|
125
126
|
"div",
|
|
126
127
|
{
|
|
@@ -128,13 +129,18 @@ const r = class r extends a.Component {
|
|
|
128
129
|
this._element = s;
|
|
129
130
|
},
|
|
130
131
|
tabIndex: n ? void 0 : o || 0,
|
|
131
|
-
className:
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
className: m(
|
|
133
|
+
x.timeSelector({
|
|
134
|
+
c: I,
|
|
135
|
+
mobileMode: b,
|
|
136
|
+
disabled: n
|
|
137
|
+
}),
|
|
138
|
+
c
|
|
139
|
+
),
|
|
134
140
|
onKeyDown: this.handleKeyDown
|
|
135
141
|
},
|
|
136
142
|
/* @__PURE__ */ a.createElement(
|
|
137
|
-
|
|
143
|
+
H,
|
|
138
144
|
{
|
|
139
145
|
ref: (s) => {
|
|
140
146
|
this.timePart = s;
|
|
@@ -143,46 +149,47 @@ const r = class r extends a.Component {
|
|
|
143
149
|
onChange: this.handleChange,
|
|
144
150
|
onNowClick: this.handleNowClick,
|
|
145
151
|
format: i,
|
|
146
|
-
smoothScroll:
|
|
147
|
-
min:
|
|
148
|
-
max:
|
|
149
|
-
boundRange:
|
|
152
|
+
smoothScroll: P,
|
|
153
|
+
min: N,
|
|
154
|
+
max: k,
|
|
155
|
+
boundRange: T,
|
|
150
156
|
disabled: n,
|
|
151
|
-
nowButton:
|
|
152
|
-
steps:
|
|
153
|
-
show:
|
|
154
|
-
mobileMode:
|
|
155
|
-
onNowKeyDown: this.handleNowKeyDown
|
|
157
|
+
nowButton: E,
|
|
158
|
+
steps: S,
|
|
159
|
+
show: _,
|
|
160
|
+
mobileMode: b,
|
|
161
|
+
onNowKeyDown: this.handleNowKeyDown,
|
|
162
|
+
unstyled: l
|
|
156
163
|
}
|
|
157
164
|
),
|
|
158
|
-
this.props.footer && /* @__PURE__ */ a.createElement("div", { className:
|
|
159
|
-
|
|
165
|
+
this.props.footer && /* @__PURE__ */ a.createElement("div", { className: m(g.footer({ c: d })) }, e && /* @__PURE__ */ a.createElement(
|
|
166
|
+
O,
|
|
160
167
|
{
|
|
161
168
|
type: "button",
|
|
162
169
|
ref: (s) => {
|
|
163
170
|
this._cancelButton = s;
|
|
164
171
|
},
|
|
165
|
-
className:
|
|
172
|
+
className: m(g.cancel({ c: d })),
|
|
166
173
|
onClick: this.handleReject,
|
|
167
|
-
title:
|
|
168
|
-
"aria-label":
|
|
174
|
+
title: f,
|
|
175
|
+
"aria-label": f
|
|
169
176
|
},
|
|
170
|
-
|
|
177
|
+
f
|
|
171
178
|
), /* @__PURE__ */ a.createElement(
|
|
172
|
-
|
|
179
|
+
O,
|
|
173
180
|
{
|
|
174
181
|
type: "button",
|
|
175
182
|
ref: (s) => {
|
|
176
183
|
this._acceptButton = s;
|
|
177
184
|
},
|
|
178
|
-
className:
|
|
185
|
+
className: m(g.accept({ c: d })),
|
|
179
186
|
themeColor: "primary",
|
|
180
187
|
onClick: this.handleAccept,
|
|
181
188
|
onKeyDown: this.revertToNowButton,
|
|
182
|
-
title:
|
|
183
|
-
"aria-label":
|
|
189
|
+
title: v,
|
|
190
|
+
"aria-label": v
|
|
184
191
|
},
|
|
185
|
-
|
|
192
|
+
v
|
|
186
193
|
))
|
|
187
194
|
);
|
|
188
195
|
}
|
|
@@ -192,7 +199,7 @@ const r = class r extends a.Component {
|
|
|
192
199
|
hasActiveButton() {
|
|
193
200
|
if (!this._acceptButton || !this._acceptButton.element)
|
|
194
201
|
return !1;
|
|
195
|
-
const i =
|
|
202
|
+
const i = A(document);
|
|
196
203
|
return this._acceptButton && i === this._acceptButton.element || this._cancelButton && i === this._cancelButton.element;
|
|
197
204
|
}
|
|
198
205
|
};
|
|
@@ -237,14 +244,14 @@ r.propTypes = {
|
|
|
237
244
|
disabled: !1,
|
|
238
245
|
cancelButton: !0,
|
|
239
246
|
format: "t",
|
|
240
|
-
min:
|
|
241
|
-
max:
|
|
247
|
+
min: j,
|
|
248
|
+
max: z,
|
|
242
249
|
boundRange: !1,
|
|
243
250
|
footer: !0
|
|
244
251
|
};
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
|
|
252
|
+
let p = r;
|
|
253
|
+
R(p);
|
|
254
|
+
F(p);
|
|
248
255
|
export {
|
|
249
|
-
|
|
256
|
+
p as TimeSelector
|
|
250
257
|
};
|
|
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),s=require("prop-types"),d=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);let{start:n,end:l}=this.scrollRange(i,o);if(n===l)return;const h=this.scrollStep(n,l),c=A[o](h),f=x[o](l),u=I[o](c(l)),m=p=>{this.animationInProgress=!0;const S=c(p);this.scrollTo(f(S)),u(S)?this.cancelAnimation=window.requestAnimationFrame(()=>{m(S)}):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,h=T(o,t,this.props.maxScrollDifference||0),c=Math.min(t,n);return{start:Math.min(Math.max(c+l*h,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 d.RowHeightService(t.total,i,0),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:h,unstyled:c}=this.props,f=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=d.classNames(d.uCalendar.scrollable({c:f,horizontal:this.direction==="horizontal"}),o),S=d.classNames(d.uCalendar.scrollablePlaceholder({c:f,horizontal:this.direction==="horizontal"}));return g.createElement("div",{ref:b=>{this.scrollContainer=b},onScroll:this.handleScroll,className:p,tabIndex:n,role:l},h,g.createElement("div",{style:m,className:S}))}};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;
|
|
@@ -6,27 +6,27 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as u from "react";
|
|
10
10
|
import o from "prop-types";
|
|
11
|
-
import { RowHeightService as
|
|
12
|
-
import { ScrollerService as
|
|
13
|
-
const
|
|
11
|
+
import { RowHeightService as b, classNames as p, uCalendar as v } from "@progress/kendo-react-common";
|
|
12
|
+
import { ScrollerService as P } from "./services/ScrollerService.mjs";
|
|
13
|
+
const T = (s, i, t) => Math.min(Math.abs(i - s), t), A = 17, C = 10, x = {
|
|
14
14
|
1: (s) => (i) => i + s,
|
|
15
15
|
0: (s) => (i) => i - s
|
|
16
|
-
},
|
|
16
|
+
}, I = {
|
|
17
17
|
1: (s) => (i) => Math.min(i, s),
|
|
18
18
|
0: (s) => (i) => Math.max(i, s)
|
|
19
|
-
},
|
|
19
|
+
}, M = {
|
|
20
20
|
1: (s) => (i) => i < s,
|
|
21
21
|
0: (s) => (i) => i > s
|
|
22
|
-
},
|
|
22
|
+
}, a = class a extends u.Component {
|
|
23
23
|
constructor(i) {
|
|
24
24
|
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) => {
|
|
25
25
|
const e = this.direction === "vertical" ? "scrollTop" : "scrollLeft";
|
|
26
26
|
if (!this.scrollContainer)
|
|
27
27
|
return;
|
|
28
28
|
const r = this.scrollContainer[e];
|
|
29
|
-
this.restrictScroll && e === "scrollTop" && (!Number.isInteger(r) || !Number.isInteger(t)) && Math.abs(r - t) <
|
|
29
|
+
this.restrictScroll && e === "scrollTop" && (!Number.isInteger(r) || !Number.isInteger(t)) && Math.abs(r - t) < C || (this.scrollContainer[e] = t);
|
|
30
30
|
}, this.scrollToIndex = (t) => {
|
|
31
31
|
this.animationInProgress = !1, this.rowHeightService && this.scrollTo(this.rowHeightService.offset(t));
|
|
32
32
|
}, this.animateToIndex = (t) => {
|
|
@@ -37,30 +37,30 @@ const H = (s, i, t) => Math.min(Math.abs(i - s), t), P = 17, T = 10, x = {
|
|
|
37
37
|
let { start: n, end: l } = this.scrollRange(e, r);
|
|
38
38
|
if (n === l)
|
|
39
39
|
return;
|
|
40
|
-
const
|
|
40
|
+
const h = this.scrollStep(n, l), c = x[r](h), f = I[r](l), d = M[r](c(l)), m = (g) => {
|
|
41
41
|
this.animationInProgress = !0;
|
|
42
|
-
const S =
|
|
43
|
-
this.scrollTo(
|
|
44
|
-
|
|
42
|
+
const S = c(g);
|
|
43
|
+
this.scrollTo(f(S)), d(S) ? this.cancelAnimation = window.requestAnimationFrame(() => {
|
|
44
|
+
m(S);
|
|
45
45
|
}) : this.animationInProgress = !1;
|
|
46
46
|
};
|
|
47
47
|
this.cancelAnimation = window.requestAnimationFrame(() => {
|
|
48
|
-
|
|
48
|
+
m(n);
|
|
49
49
|
});
|
|
50
50
|
}, this.scrollToBottom = () => {
|
|
51
51
|
this.rowHeightService && this.scrollTo(this.rowHeightService.totalHeight() + this.props.bottomOffset);
|
|
52
52
|
}, this.scrollStep = (t, e) => {
|
|
53
|
-
const r = this.props.scrollDuration ||
|
|
54
|
-
return Math.abs(e - t) / (r /
|
|
53
|
+
const r = this.props.scrollDuration || a.defaultProps.scrollDuration;
|
|
54
|
+
return Math.abs(e - t) / (r / A);
|
|
55
55
|
}, this.scrollRange = (t, e) => {
|
|
56
56
|
const r = this.containerScrollPosition;
|
|
57
57
|
if (parseInt(`${t}`, 10) === parseInt(`${r}`, 10))
|
|
58
58
|
return { start: t, end: t };
|
|
59
|
-
const n = this.containerMaxScroll(), l = e === 0 ? 1 : -1,
|
|
60
|
-
return { start: Math.min(Math.max(
|
|
59
|
+
const n = this.containerMaxScroll(), l = e === 0 ? 1 : -1, h = T(r, t, this.props.maxScrollDifference || 0), c = Math.min(t, n);
|
|
60
|
+
return { start: Math.min(Math.max(c + l * h, 0), n), end: c };
|
|
61
61
|
}, this.containerMaxScroll = () => this.containerScrollSize - this.containerOffsetSize, this.getContainerScrollDirection = (t) => t < this.containerScrollPosition ? 0 : 1, this.initServices = (t = this.props) => {
|
|
62
62
|
const e = this.direction === "vertical" ? t.itemHeight : t.itemWidth;
|
|
63
|
-
e !== void 0 && (this.rowHeightService = new
|
|
63
|
+
e !== void 0 && (this.rowHeightService = new b(t.total, e, 0), this.scrollerService.create(
|
|
64
64
|
this.rowHeightService,
|
|
65
65
|
t.skip,
|
|
66
66
|
t.take,
|
|
@@ -91,10 +91,10 @@ const H = (s, i, t) => Math.min(Math.abs(i - s), t), P = 17, T = 10, x = {
|
|
|
91
91
|
this.scrollAction = t;
|
|
92
92
|
}, this.handlePageAction = (t) => {
|
|
93
93
|
this.pageAction = t;
|
|
94
|
-
}, this.scrollerService = new
|
|
94
|
+
}, this.scrollerService = new P(
|
|
95
95
|
this.handleScrollAction,
|
|
96
96
|
this.handlePageAction
|
|
97
|
-
), this.restrictScroll = Number.parseFloat(
|
|
97
|
+
), this.restrictScroll = Number.parseFloat(u.version) > 17;
|
|
98
98
|
}
|
|
99
99
|
get element() {
|
|
100
100
|
return this.scrollContainer;
|
|
@@ -109,10 +109,10 @@ const H = (s, i, t) => Math.min(Math.abs(i - s), t), P = 17, T = 10, x = {
|
|
|
109
109
|
return this.getContainerProperty(this.direction === "vertical" ? "scrollTop" : "scrollLeft");
|
|
110
110
|
}
|
|
111
111
|
get direction() {
|
|
112
|
-
return this.props.direction !== void 0 ? this.props.direction :
|
|
112
|
+
return this.props.direction !== void 0 ? this.props.direction : a.defaultProps.direction;
|
|
113
113
|
}
|
|
114
114
|
get scrollOffsetSize() {
|
|
115
|
-
return this.props.scrollOffsetSize !== void 0 ? this.props.scrollOffsetSize :
|
|
115
|
+
return this.props.scrollOffsetSize !== void 0 ? this.props.scrollOffsetSize : a.defaultProps.scrollOffsetSize;
|
|
116
116
|
}
|
|
117
117
|
activeIndex() {
|
|
118
118
|
return this.itemIndex(Math.ceil(this.containerScrollPosition));
|
|
@@ -137,42 +137,43 @@ const H = (s, i, t) => Math.min(Math.abs(i - s), t), P = 17, T = 10, x = {
|
|
|
137
137
|
i && i.call(void 0, this);
|
|
138
138
|
}
|
|
139
139
|
render() {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
{
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
{
|
|
150
|
-
|
|
151
|
-
|
|
140
|
+
const { total: i, take: t, bottomOffset: e, className: r, tabIndex: n, role: l, children: h, unstyled: c } = this.props, f = c && c.uCalendar;
|
|
141
|
+
(this.lastTotal !== i || this.lastDirection !== this.direction || this.lastTake !== t) && (this.initServices(), this.lastTotal = i, this.lastDirection = this.direction, this.lastTake = t);
|
|
142
|
+
const d = `${(this.rowHeightService ? this.rowHeightService.totalHeight() : 0) + e}`, m = this.direction === "vertical" ? { height: `${d}px` } : { width: `${d}px` }, g = p(
|
|
143
|
+
v.scrollable({
|
|
144
|
+
c: f,
|
|
145
|
+
horizontal: this.direction === "horizontal"
|
|
146
|
+
}),
|
|
147
|
+
r
|
|
148
|
+
), S = p(
|
|
149
|
+
v.scrollablePlaceholder({
|
|
150
|
+
c: f,
|
|
151
|
+
horizontal: this.direction === "horizontal"
|
|
152
|
+
})
|
|
152
153
|
);
|
|
153
|
-
return /* @__PURE__ */
|
|
154
|
+
return /* @__PURE__ */ u.createElement(
|
|
154
155
|
"div",
|
|
155
156
|
{
|
|
156
|
-
ref: (
|
|
157
|
-
this.scrollContainer =
|
|
157
|
+
ref: (H) => {
|
|
158
|
+
this.scrollContainer = H;
|
|
158
159
|
},
|
|
159
160
|
onScroll: this.handleScroll,
|
|
160
|
-
className:
|
|
161
|
-
tabIndex:
|
|
162
|
-
role:
|
|
161
|
+
className: g,
|
|
162
|
+
tabIndex: n,
|
|
163
|
+
role: l
|
|
163
164
|
},
|
|
164
|
-
|
|
165
|
-
/* @__PURE__ */
|
|
165
|
+
h,
|
|
166
|
+
/* @__PURE__ */ u.createElement(
|
|
166
167
|
"div",
|
|
167
168
|
{
|
|
168
|
-
style:
|
|
169
|
-
className:
|
|
169
|
+
style: m,
|
|
170
|
+
className: S
|
|
170
171
|
}
|
|
171
172
|
)
|
|
172
173
|
);
|
|
173
174
|
}
|
|
174
175
|
};
|
|
175
|
-
|
|
176
|
+
a.propTypes = {
|
|
176
177
|
bottomOffset: o.number.isRequired,
|
|
177
178
|
className: o.string,
|
|
178
179
|
direction: o.oneOf(["horizontal", "vertical"]),
|
|
@@ -190,14 +191,14 @@ c.propTypes = {
|
|
|
190
191
|
topOffset: o.number.isRequired,
|
|
191
192
|
total: o.number.isRequired,
|
|
192
193
|
role: o.string
|
|
193
|
-
},
|
|
194
|
+
}, a.defaultProps = {
|
|
194
195
|
direction: "vertical",
|
|
195
196
|
forceScroll: !1,
|
|
196
197
|
scrollOffsetSize: 0,
|
|
197
198
|
maxScrollDifference: 100,
|
|
198
199
|
scrollDuration: 100
|
|
199
200
|
};
|
|
200
|
-
let
|
|
201
|
+
let w = a;
|
|
201
202
|
export {
|
|
202
|
-
|
|
203
|
+
w as Virtualization
|
|
203
204
|
};
|