@progress/kendo-react-dateinputs 11.0.0-develop.1 → 11.0.0-develop.10
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/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +14 -13
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +166 -159
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +17 -15
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +49 -46
- package/datetimepicker/DateTimeSelector.js +1 -1
- package/datetimepicker/DateTimeSelector.mjs +23 -21
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +42 -6
- package/index.d.ts +42 -6
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +39 -37
- package/timepicker/TimeSelector.js +1 -1
- package/timepicker/TimeSelector.mjs +49 -48
- package/utils.js +1 -1
- package/utils.mjs +3 -1
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +1 -1
|
@@ -5,24 +5,24 @@
|
|
|
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 a from "react";
|
|
9
9
|
import t from "prop-types";
|
|
10
|
-
import { cloneDate as
|
|
11
|
-
import { Keys as
|
|
12
|
-
import { provideIntlService as K, provideLocalizationService as M, registerForIntl as
|
|
10
|
+
import { cloneDate as h } from "@progress/kendo-date-math";
|
|
11
|
+
import { Keys as u, classNames as m, uTimePicker as x, uTime as g, getActiveElement as A } from "@progress/kendo-react-common";
|
|
12
|
+
import { provideIntlService as K, provideLocalizationService as M, registerForIntl as R, registerForLocalization as F } from "@progress/kendo-react-intl";
|
|
13
13
|
import { timePickerCancel as y, messages as B, timePickerSet as D } from "../messages/index.mjs";
|
|
14
14
|
import { MIDNIGHT_DATE as L, MIN_TIME as j, MAX_TIME as z } from "../utils.mjs";
|
|
15
15
|
import { getNow as w, valueMerger as V, generateGetters as G } from "./utils.mjs";
|
|
16
16
|
import { TimePart as H } from "./TimePart.mjs";
|
|
17
17
|
import { Button as O } from "@progress/kendo-react-buttons";
|
|
18
|
-
const r = class r extends
|
|
18
|
+
const r = class r extends a.Component {
|
|
19
19
|
constructor(i) {
|
|
20
20
|
super(i), this._element = null, this._cancelButton = null, this._acceptButton = null, this.timePart = null, this.focusActiveList = () => {
|
|
21
21
|
this.timePart && this.timePart.focus({ preventScroll: !0 });
|
|
22
22
|
}, this.handleKeyDown = (e) => {
|
|
23
23
|
const { keyCode: n } = e;
|
|
24
24
|
switch (n) {
|
|
25
|
-
case
|
|
25
|
+
case u.enter:
|
|
26
26
|
this.hasActiveButton() || this.handleAccept(e);
|
|
27
27
|
return;
|
|
28
28
|
default:
|
|
@@ -30,14 +30,14 @@ const r = class r extends s.Component {
|
|
|
30
30
|
}
|
|
31
31
|
}, this.revertToNowButton = (e) => {
|
|
32
32
|
const { keyCode: n, shiftKey: o } = e;
|
|
33
|
-
!o && n ===
|
|
33
|
+
!o && n === u.tab && (e.preventDefault(), this.props.nowButton !== !1 ? this.timePart && this.timePart.focus({ preventScroll: !0 }, !0) : this.timePart && this.timePart.focus({ preventScroll: !0 }));
|
|
34
34
|
}, this.handleNowKeyDown = (e) => {
|
|
35
35
|
var c;
|
|
36
36
|
const { keyCode: n, shiftKey: o } = e;
|
|
37
|
-
o && n ===
|
|
37
|
+
o && n === u.tab ? (e.preventDefault(), this._acceptButton && ((c = this._acceptButton.element) == null || c.focus({ preventScroll: !0 }))) : n === u.enter && (e.stopPropagation(), this.handleNowClick(e));
|
|
38
38
|
}, this.handleAccept = (e) => {
|
|
39
39
|
const n = this.mergeValue(
|
|
40
|
-
|
|
40
|
+
h(this.value || w()),
|
|
41
41
|
this.timePart ? this.timePart.value : this.current
|
|
42
42
|
);
|
|
43
43
|
this.setState({ value: n }), this.valueDuringOnChange = n;
|
|
@@ -53,7 +53,7 @@ const r = class r extends s.Component {
|
|
|
53
53
|
const { onReject: n } = this.props;
|
|
54
54
|
n && n.call(void 0, e);
|
|
55
55
|
}, this.handleNowClick = (e) => {
|
|
56
|
-
const n = this.mergeValue(
|
|
56
|
+
const n = this.mergeValue(h(this.value || w()), w());
|
|
57
57
|
this.setState({
|
|
58
58
|
current: n,
|
|
59
59
|
value: n
|
|
@@ -84,13 +84,13 @@ const r = class r extends s.Component {
|
|
|
84
84
|
}
|
|
85
85
|
get value() {
|
|
86
86
|
const i = this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value;
|
|
87
|
-
return i !== null ?
|
|
87
|
+
return i !== null ? h(i) : null;
|
|
88
88
|
}
|
|
89
89
|
get intl() {
|
|
90
90
|
return K(this);
|
|
91
91
|
}
|
|
92
92
|
get current() {
|
|
93
|
-
return this.state.current !== null ?
|
|
93
|
+
return this.state.current !== null ? h(this.state.current) : null;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* @hidden
|
|
@@ -117,12 +117,12 @@ const r = class r extends s.Component {
|
|
|
117
117
|
show: _,
|
|
118
118
|
mobileMode: b,
|
|
119
119
|
unstyled: l
|
|
120
|
-
} = this.props, I = l && l.uTimePicker, d = l && l.uTime, C = M(this), f = C.toLanguageString(y, B[y]),
|
|
121
|
-
return /* @__PURE__ */
|
|
120
|
+
} = 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]);
|
|
121
|
+
return /* @__PURE__ */ a.createElement(
|
|
122
122
|
"div",
|
|
123
123
|
{
|
|
124
|
-
ref: (
|
|
125
|
-
this._element =
|
|
124
|
+
ref: (s) => {
|
|
125
|
+
this._element = s;
|
|
126
126
|
},
|
|
127
127
|
tabIndex: n ? void 0 : o || 0,
|
|
128
128
|
className: m(
|
|
@@ -135,11 +135,11 @@ const r = class r extends s.Component {
|
|
|
135
135
|
),
|
|
136
136
|
onKeyDown: this.handleKeyDown
|
|
137
137
|
},
|
|
138
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ a.createElement(
|
|
139
139
|
H,
|
|
140
140
|
{
|
|
141
|
-
ref: (
|
|
142
|
-
this.timePart =
|
|
141
|
+
ref: (s) => {
|
|
142
|
+
this.timePart = s;
|
|
143
143
|
},
|
|
144
144
|
value: this.current,
|
|
145
145
|
onChange: this.handleChange,
|
|
@@ -157,36 +157,37 @@ const r = class r extends s.Component {
|
|
|
157
157
|
onNowKeyDown: this.handleNowKeyDown,
|
|
158
158
|
unstyled: l
|
|
159
159
|
}
|
|
160
|
-
)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
),
|
|
161
|
+
this.props.footer && /* @__PURE__ */ a.createElement("div", { className: m(g.footer({ c: d })) }, e && /* @__PURE__ */ a.createElement(
|
|
162
|
+
O,
|
|
163
|
+
{
|
|
164
|
+
type: "button",
|
|
165
|
+
ref: (s) => {
|
|
166
|
+
this._cancelButton = s;
|
|
167
|
+
},
|
|
168
|
+
className: m(g.cancel({ c: d })),
|
|
169
|
+
onClick: this.handleReject,
|
|
170
|
+
title: f,
|
|
171
|
+
"aria-label": f
|
|
167
172
|
},
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
this.
|
|
173
|
+
f
|
|
174
|
+
), /* @__PURE__ */ a.createElement(
|
|
175
|
+
O,
|
|
176
|
+
{
|
|
177
|
+
type: "button",
|
|
178
|
+
ref: (s) => {
|
|
179
|
+
this._acceptButton = s;
|
|
180
|
+
},
|
|
181
|
+
className: m(g.accept({ c: d })),
|
|
182
|
+
themeColor: "primary",
|
|
183
|
+
onClick: this.handleAccept,
|
|
184
|
+
onKeyDown: this.revertToNowButton,
|
|
185
|
+
title: v,
|
|
186
|
+
"aria-label": v
|
|
180
187
|
},
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
onKeyDown: this.revertToNowButton,
|
|
185
|
-
title: g,
|
|
186
|
-
"aria-label": g
|
|
187
|
-
},
|
|
188
|
-
g
|
|
189
|
-
)));
|
|
188
|
+
v
|
|
189
|
+
))
|
|
190
|
+
);
|
|
190
191
|
}
|
|
191
192
|
nextTick(i) {
|
|
192
193
|
clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => i());
|
|
@@ -245,8 +246,8 @@ r.propTypes = {
|
|
|
245
246
|
footer: !0
|
|
246
247
|
};
|
|
247
248
|
let p = r;
|
|
248
|
-
F(p);
|
|
249
249
|
R(p);
|
|
250
|
+
F(p);
|
|
250
251
|
export {
|
|
251
252
|
p as TimeSelector
|
|
252
253
|
};
|
package/utils.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 l=require("@progress/kendo-date-math"),y=require("./calendar/models/SelectionRange.js");function S(t){const e=(r,o,s,...c)=>o[s]===null?null:(r?t.isRequired:t)(o,s,...c),n=e.bind(null,!1);return n.isRequired=e.bind(null,!0),n}const w=(t,e,n)=>e===void 0||n===void 0||e<=t&&t<=n?t:t<e?e:n,C=new Date(1980,0,1),F=new Date(1900,0,1),k=new Date(2099,11,31),W=new Date(1980,0,1),q=new Date(1980,0,1,23,59,59),H=(t,e)=>{const n=l.cloneDate(t);return n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n},L=()=>l.getDate(new Date),X=(t,e,n)=>!t||!(e&&e>t||n&&n<t),G=(t,e,n)=>t===null||!(e&&l.getDate(e)>l.getDate(t)||n&&l.getDate(n)<l.getDate(t)),O=(t,e)=>{const{start:n,end:r}=e||y.EMPTY_SELECTIONRANGE;return!n||!r?!1:n<t&&t<r},j=(t,e,n=1)=>{const r=[];for(let o=t;o<e;o=o+n)r.push(o);return r},P=(t,e,n)=>e.getTime()<=t.getTime()&&t.getTime()<=n.getTime(),Y=(t,e)=>t.slice(e).concat(t.slice(0,e)),z=(t,e,n)=>t&&(e&&t<e?l.cloneDate(e):n&&t>n?l.cloneDate(n):t),B=t=>(e,n="",r={})=>{const o=document.createElement(t);return o.className=n,Object.keys(r).
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@progress/kendo-date-math"),y=require("./calendar/models/SelectionRange.js");function S(t){const e=(r,o,s,...c)=>o[s]===null?null:(r?t.isRequired:t)(o,s,...c),n=e.bind(null,!1);return n.isRequired=e.bind(null,!0),n}const w=(t,e,n)=>e===void 0||n===void 0||e<=t&&t<=n?t:t<e?e:n,C=new Date(1980,0,1),F=new Date(1900,0,1),k=new Date(2099,11,31),W=new Date(1980,0,1),q=new Date(1980,0,1,23,59,59),H=(t,e)=>{const n=l.cloneDate(t);return n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n},L=()=>l.getDate(new Date),X=(t,e,n)=>!t||!(e&&e>t||n&&n<t),G=(t,e,n)=>t===null||!(e&&l.getDate(e)>l.getDate(t)||n&&l.getDate(n)<l.getDate(t)),O=(t,e)=>{const{start:n,end:r}=e||y.EMPTY_SELECTIONRANGE;return!n||!r?!1:n<t&&t<r},j=(t,e,n=1)=>{const r=[];for(let o=t;o<e;o=o+n)r.push(o);return r},P=(t,e,n)=>e.getTime()<=t.getTime()&&t.getTime()<=n.getTime(),Y=(t,e)=>t.slice(e).concat(t.slice(0,e)),z=(t,e,n)=>t&&(e&&t<e?l.cloneDate(e):n&&t>n?l.cloneDate(n):t),B=t=>(e,n="",r={})=>{const o=document.createElement(t);return o.className=n,Object.keys(r).forEach(s=>{o.style[s]=r[s]}),typeof e=="string"?o.innerHTML=e||"":(e||[]).forEach(s=>s&&o.appendChild(s)),o};function J(t,e,n={}){let r,o;n.maxWait;let s,c,a;const f=window,v=!1,R=!1,I=!e&&e!==0&&typeof f.requestAnimationFrame=="function";if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;function E(i){const u=r,T=o;return r=o=void 0,s=t.apply(T,u),s}function D(i,u){return I?(f.cancelAnimationFrame(c),f.requestAnimationFrame(i)):setTimeout(i,u)}function h(i){if(I)return f.cancelAnimationFrame(i);clearTimeout(i)}function b(i){return c=D(m,e),v?E():s}function d(i){const u=i-a;return e-u}function M(i){const u=i-a;return a===void 0||u>=e||u<0||R}function m(){const i=Date.now();if(M(i))return A();c=D(m,d(i))}function A(i){return c=void 0,r?E():(r=o=void 0,s)}function p(){c!==void 0&&h(c),r=a=o=c=void 0}function N(){return c===void 0?s:A()}function _(){return c!==void 0}function g(...i){const u=Date.now(),T=M(u);return r=i,o=this,a=u,T&&c===void 0?b():(c===void 0&&(c=D(m,e)),s)}return g.cancel=p,g.flush=N,g.pending=_,g}exports.MAX_DATE=k;exports.MAX_TIME=q;exports.MIDNIGHT_DATE=C;exports.MIN_DATE=F;exports.MIN_TIME=W;exports.dateInRange=z;exports.debounce=J;exports.domContainerFactory=B;exports.getToday=L;exports.intersects=P;exports.isInDateRange=G;exports.isInRange=X;exports.isInSelectionRange=O;exports.nullable=S;exports.range=j;exports.setTime=H;exports.shiftWeekNames=Y;exports.viewInRange=w;
|
package/utils.mjs
CHANGED
|
@@ -24,7 +24,9 @@ const d = (t, n, e) => n === void 0 || e === void 0 || n <= t && t <= e ? t : t
|
|
|
24
24
|
return r;
|
|
25
25
|
}, B = (t, n, e) => n.getTime() <= t.getTime() && t.getTime() <= e.getTime(), J = (t, n) => t.slice(n).concat(t.slice(0, n)), K = (t, n, e) => t && (n && t < n ? v(n) : e && t > e ? v(e) : t), Q = (t) => (n, e = "", r = {}) => {
|
|
26
26
|
const o = document.createElement(t);
|
|
27
|
-
return o.className = e, Object.keys(r).
|
|
27
|
+
return o.className = e, Object.keys(r).forEach((s) => {
|
|
28
|
+
o.style[s] = r[s];
|
|
29
|
+
}), typeof n == "string" ? o.innerHTML = n || "" : (n || []).forEach((s) => s && o.appendChild(s)), o;
|
|
28
30
|
};
|
|
29
31
|
function U(t, n, e = {}) {
|
|
30
32
|
let r, o;
|
|
@@ -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
|
|
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;
|
|
@@ -58,7 +58,7 @@ const T = (s, i, t) => Math.min(Math.abs(i - s), t), A = 17, C = 10, x = {
|
|
|
58
58
|
return { start: Math.min(Math.max(c + l * f, 0), n), end: c };
|
|
59
59
|
}, this.containerMaxScroll = () => this.containerScrollSize - this.containerOffsetSize, this.getContainerScrollDirection = (t) => t < this.containerScrollPosition ? 0 : 1, this.initServices = (t = this.props) => {
|
|
60
60
|
const e = this.direction === "vertical" ? t.itemHeight : t.itemWidth;
|
|
61
|
-
e !== void 0 && (this.rowHeightService = new b(t.total, e
|
|
61
|
+
e !== void 0 && (this.rowHeightService = new b(t.total, e), this.scrollerService.create(
|
|
62
62
|
this.rowHeightService,
|
|
63
63
|
t.skip,
|
|
64
64
|
t.take,
|