@progress/kendo-react-dateinputs 14.4.1-develop.9 → 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 (71) 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 +11 -24
  8. package/calendar/components/Header.js +1 -1
  9. package/calendar/components/Header.mjs +41 -55
  10. package/calendar/components/HorizontalViewList.d.ts +29 -27
  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 +12 -43
  23. package/calendar/components/View.js +1 -1
  24. package/calendar/components/View.mjs +111 -137
  25. package/calendar/components/ViewList.d.ts +27 -67
  26. package/calendar/components/ViewList.js +1 -1
  27. package/calendar/components/ViewList.mjs +207 -225
  28. package/calendar/models/CalendarSettings.d.ts +2 -2
  29. package/calendar/models/MultiViewCalendarSettings.d.ts +4 -4
  30. package/calendar/models/ViewService.d.ts +1 -1
  31. package/calendar/models/index.d.ts +7 -7
  32. package/calendar/services/BusViewService.d.ts +1 -1
  33. package/calendar/services/DecadeViewService.d.ts +2 -2
  34. package/calendar/services/MonthViewService.d.ts +2 -2
  35. package/calendar/services/NavigationService.d.ts +1 -1
  36. package/calendar/services/ScrollSyncService.d.ts +4 -4
  37. package/calendar/services/WeekNamesService.d.ts +1 -1
  38. package/calendar/services/YearViewService.d.ts +2 -2
  39. package/dateinput/DateInput.d.ts +1 -1
  40. package/dateinput/models/DateInputSettings.d.ts +2 -2
  41. package/dateinput/models/dateinput-options.d.ts +2 -2
  42. package/dateinput/models/index.d.ts +7 -7
  43. package/dateinput/models/kendo-date.d.ts +1 -1
  44. package/datepicker/models/DatePickerSettings.d.ts +2 -2
  45. package/datepicker/models/index.d.ts +1 -1
  46. package/daterangepicker/models/DateRangePickerCalendarSettings.d.ts +1 -1
  47. package/daterangepicker/models/DateRangePickerDateInputSettings.d.ts +1 -1
  48. package/daterangepicker/models/DateRangePickerSettings.d.ts +3 -3
  49. package/daterangepicker/models/index.d.ts +4 -4
  50. package/datetimepicker/DateTimePicker.d.ts +1 -1
  51. package/datetimepicker/models/DateTimePickerSettings.d.ts +1 -1
  52. package/datetimepicker/models/index.d.ts +1 -1
  53. package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
  54. package/index.d.mts +1 -1
  55. package/index.d.ts +1 -1
  56. package/package-metadata.js +1 -1
  57. package/package-metadata.mjs +2 -2
  58. package/package.json +8 -8
  59. package/timepicker/TimePart.d.ts +1 -1
  60. package/timepicker/TimePicker.d.ts +1 -1
  61. package/timepicker/TimeSelector.d.ts +1 -1
  62. package/timepicker/models/ListService.d.ts +2 -2
  63. package/timepicker/models/TimePickerSettings.d.ts +3 -3
  64. package/timepicker/models/index.d.ts +5 -5
  65. package/timepicker/services/DayPeriodService.d.ts +3 -3
  66. package/timepicker/services/HoursService.d.ts +3 -3
  67. package/timepicker/services/MinutesService.d.ts +3 -3
  68. package/timepicker/services/SecondsService.d.ts +3 -3
  69. package/virtualization/Virtualization.d.ts +25 -63
  70. package/virtualization/Virtualization.js +1 -1
  71. package/virtualization/Virtualization.mjs +163 -168
@@ -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
  };