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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/calendar/components/Calendar.d.ts +35 -110
  2. package/calendar/components/Calendar.js +5 -5
  3. package/calendar/components/Calendar.mjs +288 -313
  4. package/calendar/components/CalendarCell.d.ts +1 -10
  5. package/calendar/components/CalendarCell.js +1 -1
  6. package/calendar/components/CalendarCell.mjs +68 -78
  7. package/calendar/components/Header.d.ts +10 -23
  8. package/calendar/components/Header.js +1 -1
  9. package/calendar/components/Header.mjs +41 -55
  10. package/calendar/components/HorizontalViewList.d.ts +28 -26
  11. package/calendar/components/HorizontalViewList.js +1 -1
  12. package/calendar/components/HorizontalViewList.mjs +112 -102
  13. package/calendar/components/MultiViewCalendar.d.ts +39 -141
  14. package/calendar/components/MultiViewCalendar.js +1 -1
  15. package/calendar/components/MultiViewCalendar.mjs +331 -373
  16. package/calendar/components/Navigation.d.ts +19 -39
  17. package/calendar/components/Navigation.js +1 -1
  18. package/calendar/components/Navigation.mjs +95 -107
  19. package/calendar/components/TodayCommand.d.ts +8 -25
  20. package/calendar/components/TodayCommand.js +1 -1
  21. package/calendar/components/TodayCommand.mjs +44 -61
  22. package/calendar/components/View.d.ts +11 -42
  23. package/calendar/components/View.js +1 -1
  24. package/calendar/components/View.mjs +111 -137
  25. package/calendar/components/ViewList.d.ts +25 -65
  26. package/calendar/components/ViewList.js +1 -1
  27. package/calendar/components/ViewList.mjs +207 -225
  28. package/calendar/services/ScrollSyncService.d.ts +4 -4
  29. package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
  30. package/package-metadata.js +1 -1
  31. package/package-metadata.mjs +2 -2
  32. package/package.json +8 -8
  33. package/virtualization/Virtualization.d.ts +25 -63
  34. package/virtualization/Virtualization.js +1 -1
  35. package/virtualization/Virtualization.mjs +163 -168
@@ -5,460 +5,418 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as d from "react";
9
- import s from "prop-types";
10
- import { provideIntlService as G, provideLocalizationService as X, registerForIntl as q, registerForLocalization as J } from "@progress/kendo-react-intl";
11
- import { withIdHOC as Q, withPropsContext as Z, createPropsContext as ee, Keys as O, validatePackage as te, getLicenseMessage as se, classNames as ie, WatermarkOverlay as ae } from "@progress/kendo-react-common";
12
- import { isEqualDate as P, addDays as M, cloneDate as m, getDate as g, firstDayOfMonth as ne, lastDayOfMonth as oe } from "@progress/kendo-date-math";
13
- import { Button as L } from "@progress/kendo-react-buttons";
14
- import { chevronRightIcon as N, chevronLeftIcon as B } from "@progress/kendo-svg-icons";
15
- import { Action as x } from "../models/NavigationAction.mjs";
16
- import { CalendarViewEnum as A } from "../models/CalendarViewEnum.mjs";
17
- import { EMPTY_SELECTIONRANGE as j } from "../models/SelectionRange.mjs";
18
- import { Header as re } from "./Header.mjs";
19
- import { dateInRange as k, getToday as F, viewInRange as _, nullable as D, MAX_DATE as le, MIN_DATE as he, isInRange as T } from "../../utils.mjs";
20
- import { prevView as K, messages as Y, nextView as W } from "../../messages/index.mjs";
21
- import { BusViewService as ce } from "../services/BusViewService.mjs";
22
- import { NavigationService as de } from "../services/NavigationService.mjs";
23
- import { HorizontalViewList as E } from "./HorizontalViewList.mjs";
24
- import { TodayCommand as ue } from "./TodayCommand.mjs";
25
- import { packageMetadata as z } from "../../package-metadata.mjs";
26
- const S = (l = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Date && !Array.isArray(a) && T(g(a), l, i) ? g(a) : null, U = (l = v.defaultProps.min, i = v.defaultProps.max, a) => Array.isArray(a) ? a.filter((c) => T(c, l, i)).map((c) => g(c)) : null, $ = (l) => typeof l == "object" && !(l instanceof Date) && l !== null && !Array.isArray(l) ? l : j, H = (l, i, a) => l || i && i[0] || a && a.start, pe = (l, i) => l.start === null && i === null ? "start" : l.end === null ? "end" : "start", u = class u extends d.Component {
27
- constructor(i) {
28
- super(i), this.dates = [], this.selectedDate = null, this.selectedMultiple = null, this.selectedRange = j, this._focusedDate = /* @__PURE__ */ new Date(), this.cellUID = this.props.id + "-cell-uid", this.activeRangeEnd = "start", this._element = null, this.intl = null, this.localization = null, this.service = null, this.calendarViewList = null, this.isActive = !1, this.calculateFocusFromValue = !0, this.showLicenseWatermark = !1, this.focus = () => {
29
- this._element && this._element.focus();
30
- }, this.clampRange = (e) => ({ start: e, end: null }), this.rangeWithFocused = (e, t) => ({
8
+ import * as a from "react";
9
+ import n from "prop-types";
10
+ import { validatePackage as Ft, getLicenseMessage as Tt, usePropsContext as Nt, useId as Pt, classNames as Bt, WatermarkOverlay as Lt, createPropsContext as Kt, Keys as oe } from "@progress/kendo-react-common";
11
+ import { getDate as O, cloneDate as m, firstDayOfMonth as Wt, lastDayOfMonth as Yt, isEqualDate as Pe, addDays as se } from "@progress/kendo-date-math";
12
+ import { useInternationalization as _t, useLocalization as Ht } from "@progress/kendo-react-intl";
13
+ import { Button as Be } from "@progress/kendo-react-buttons";
14
+ import { chevronRightIcon as Le, chevronLeftIcon as Ke } from "@progress/kendo-svg-icons";
15
+ import { Action as U } from "../models/NavigationAction.mjs";
16
+ import { CalendarViewEnum as X } from "../models/CalendarViewEnum.mjs";
17
+ import { EMPTY_SELECTIONRANGE as $t } from "../models/SelectionRange.mjs";
18
+ import { Header as zt } from "./Header.mjs";
19
+ import { MIN_DATE as jt, MAX_DATE as Gt, viewInRange as ie, dateInRange as q, getToday as J, isInRange as ue, nullable as I } from "../../utils.mjs";
20
+ import { prevView as We, messages as Ye, nextView as _e } from "../../messages/index.mjs";
21
+ import { BusViewService as Ut } from "../services/BusViewService.mjs";
22
+ import { NavigationService as Xt } from "../services/NavigationService.mjs";
23
+ import { HorizontalViewList as qt } from "./HorizontalViewList.mjs";
24
+ import { TodayCommand as Jt } from "./TodayCommand.mjs";
25
+ import { packageMetadata as He } from "../../package-metadata.mjs";
26
+ const S = (c, d = u.min, p = u.max) => c instanceof Date && !Array.isArray(c) && ue(O(c), d, p) ? O(c) : null, le = (c, d = u.min, p = u.max) => Array.isArray(c) ? c.filter((k) => ue(k, d, p)).map((k) => O(k)) : null, Q = (c) => typeof c == "object" && !(c instanceof Date) && c !== null && !Array.isArray(c) ? c : $t, $e = (c, d, p) => c || d && d[0] || p && p.start, Qt = (c, d) => c.start === null && d === null ? "start" : c.end === null ? "end" : "start", u = {
27
+ disabled: !1,
28
+ min: jt,
29
+ max: Gt,
30
+ defaultActiveView: "month",
31
+ defaultValue: null,
32
+ topView: "century",
33
+ weekDaysFormat: "short",
34
+ tabIndex: 0,
35
+ bottomView: "month",
36
+ views: 2,
37
+ allowReverse: !1,
38
+ showOtherMonthDays: !1
39
+ }, Zt = Kt(), Z = a.forwardRef(
40
+ (c, d) => {
41
+ var Ne;
42
+ const p = a.useMemo(
43
+ () => !Ft(He, { component: "MultiViewCalendar" }),
44
+ []
45
+ ), k = a.useMemo(() => Tt(He), []), P = Nt(Zt, c), de = Pt(P.id), {
46
+ disabled: B = u.disabled,
47
+ min: ze = u.min,
48
+ max: je = u.max,
49
+ defaultActiveView: fe = u.defaultActiveView,
50
+ defaultValue: Ge = u.defaultValue,
51
+ topView: Ue = u.topView,
52
+ bottomView: Xe = u.bottomView,
53
+ weekDaysFormat: qe = u.weekDaysFormat,
54
+ tabIndex: Je = u.tabIndex,
55
+ views: M = u.views,
56
+ allowReverse: me = u.allowReverse,
57
+ showOtherMonthDays: Qe = u.showOtherMonthDays,
58
+ _ref: ve,
59
+ className: Ze,
60
+ weekNumber: et,
61
+ mobileMode: ge,
62
+ focusedDate: tt,
63
+ value: L,
64
+ onChange: K,
65
+ onFocus: we,
66
+ onBlur: De,
67
+ cell: nt,
68
+ weekCell: at,
69
+ headerTitle: pe,
70
+ mode: F,
71
+ activeRangeEnd: W,
72
+ ariaLabelledBy: rt,
73
+ ariaDescribedBy: ct,
74
+ dir: he
75
+ } = P, i = O(ze), l = O(je), Y = X[Xe], _ = X[Ue], H = he === "rtl", ot = de + "-cell-uid", st = de + "-wrapper-id", it = (e) => ({ start: e, end: null }), lt = (e, t) => ({
31
76
  start: e.start,
32
- end: e.end === null && e.start !== null && this.isActive ? t : e.end
33
- }), this.generateRange = (e, t) => {
34
- const { end: r, start: o } = t, h = t.start !== null && e.getTime() <= t.start.getTime();
35
- return !this.props.allowReverse && h ? { start: e, end: this.selectedRange.start } : this.activeRange !== "end" ? { start: e, end: r } : { start: o || this.selectedDate, end: e };
36
- }, this.canNavigate = (e) => {
37
- if (!this.service)
77
+ end: e.end === null && e.start !== null && $.current ? t : e.end
78
+ }), ut = (e, t) => {
79
+ const { end: r, start: o } = t, g = W !== void 0 ? W : z.current, s = t.start !== null && e.getTime() <= t.start.getTime(), y = Q(f), D = S(f, i, l);
80
+ return !me && s ? { start: e, end: y.start } : g !== "end" ? { start: e, end: r } : { start: o || D, end: e };
81
+ }, Ve = (e) => {
82
+ if (!b.current)
38
83
  return !1;
39
- const t = this.service.move(this.focusedDate, e);
40
- return this.min <= t && t <= this.max || this.service.isInSameView(t, this.min) || this.service.isInSameView(t, this.max);
41
- }, this.navigate = (e, t) => {
42
- this.calculateFocusFromValue = !1;
43
- const r = this.move(e, t);
44
- this.setState({ navigateDate: r, focusedDate: r });
45
- }, this.move = (e, t) => this.clampDate(this.service.move(t, e)), this.clampDate = (e) => k(e, this.min, this.max), this.shouldAutoCorrect = (e, t) => {
46
- const { end: r, start: o } = t;
47
- return this.activeRange !== "end" ? r !== null && e > r : o !== null && e < o;
48
- }, this.handleCellEnter = (e) => {
49
- this.props.mode === "range" && (this.calculateFocusFromValue = !1, this.setState({
84
+ const t = m(C), r = b.current.move(t, e);
85
+ return i <= r && r <= l || b.current.isInSameView(r, i) || b.current.isInSameView(r, l);
86
+ }, ye = (e, t) => !!t && Wt(t) <= e && e <= Yt(t), ee = (e, t) => {
87
+ R.current = !1;
88
+ const r = te(e, t);
89
+ V({ navigateDate: r, focusedDate: r });
90
+ }, te = (e, t) => dt(b.current.move(t, e)), dt = (e) => q(e, i, l), ft = (e) => {
91
+ F === "range" && (R.current = !1, V({
50
92
  focusedDate: e
51
93
  }));
52
- }, this.handleMouseDown = (e) => {
94
+ }, mt = (e) => {
53
95
  e.preventDefault();
54
- }, this.handleClick = (e) => {
55
- this._element && this._element.focus({ preventScroll: !0 });
56
- }, this.handleFocus = (e) => {
57
- if (this.isActive = !0, !this.calendarViewList)
58
- return;
59
- this.calendarViewList.focusActiveDate();
60
- const { onFocus: t } = this.props;
61
- t && t.call(void 0, e);
62
- }, this.handleBlur = (e) => {
63
- if (this.isActive = !1, !this.calendarViewList)
64
- return;
65
- this.calendarViewList.blurActiveDate();
66
- const { onBlur: t } = this.props;
67
- t && t.call(void 0, e);
68
- }, this.handleTodayClick = (e) => {
69
- this.todayIsInRange && this.handleDateChange(e);
70
- }, this.handlePrevButtonClick = () => {
71
- const e = x.PrevView;
72
- if (this.state.activeView > 0 && this.focusedDate.getFullYear() > this.dates[0].getFullYear())
73
- this.navigate(e, this.move(e, this.focusedDate));
96
+ }, vt = (e) => {
97
+ A.current && A.current.focus({ preventScroll: !0 });
98
+ }, gt = (e) => {
99
+ $.current = !0, E.current && (E.current.focusActiveDate(), we && we(e));
100
+ }, wt = (e) => {
101
+ $.current = !1, E.current && (E.current.blurActiveDate(), De && De(e));
102
+ }, Dt = (e) => {
103
+ Ie && ne(e);
104
+ }, Re = () => {
105
+ const e = U.PrevView, t = m(C);
106
+ if (w.activeView > 0 && t.getFullYear() > h.current[0].getFullYear())
107
+ ee(e, te(e, t));
74
108
  else {
75
- const t = this.isInMonth(this.focusedDate, this.dates[1]) ? this.move(e, this.focusedDate) : this.focusedDate;
76
- this.navigate(e, t);
109
+ const r = ye(t, h.current[1]) ? te(e, t) : t;
110
+ ee(e, r);
77
111
  }
78
- }, this.handleNextButtonClick = () => {
79
- this.navigate(x.NextView, this.focusedDate);
80
- }, this.handleKeyDown = (e) => {
81
- const { keyCode: r, ctrlKey: o, metaKey: h } = e;
112
+ }, be = () => {
113
+ ee(U.NextView, m(C));
114
+ }, pt = (e) => {
115
+ const { keyCode: r, ctrlKey: o, metaKey: g } = e;
82
116
  if (r === 84) {
83
- const n = F();
84
- this.calculateFocusFromValue = !1, this.setState({ focusedDate: n, navigateDate: n });
117
+ const s = J();
118
+ R.current = !1, V({ focusedDate: s, navigateDate: s });
85
119
  }
86
- if ((o || h) && (r === O.left && this.handlePrevButtonClick(), r === O.right && this.handleNextButtonClick()), r === O.enter) {
87
- const n = {
120
+ if ((o || g) && (r === oe.left && Re(), r === oe.right && be()), r === oe.enter) {
121
+ const s = {
88
122
  syntheticEvent: e,
89
123
  nativeEvent: e.nativeEvent,
90
- value: this.focusedDate,
91
- target: this
124
+ value: m(C),
125
+ target: T.current
92
126
  };
93
- this.handleDateChange(n);
127
+ ne(s);
94
128
  } else {
95
- const n = k(
96
- this.navigation.move(
97
- this.focusedDate,
98
- this.navigation.action(e),
99
- this.state.activeView,
100
- this.service,
129
+ const s = q(
130
+ Ce.current.move(
131
+ C,
132
+ Ce.current.action(e),
133
+ w.activeView,
134
+ b.current,
101
135
  e
102
136
  ),
103
- this.min,
104
- this.max
137
+ i,
138
+ l
105
139
  );
106
- if (P(this.focusedDate, n))
140
+ if (Pe(C, s))
107
141
  return;
108
- this.dates && this.service && !this.service.isInArray(n, this.dates) && this.setState({ navigateDate: n }), this.calculateFocusFromValue = !1, this.setState({ focusedDate: n });
142
+ h.current && b.current && !b.current.isInArray(s, h.current) && V({ navigateDate: s }), R.current = !1, V({ focusedDate: s });
109
143
  }
110
144
  e.preventDefault();
111
- }, this.handleViewChange = ({ view: e }) => {
112
- this.calculateFocusFromValue = !1, this.setState((t) => ({ activeView: e, navigateDate: t.focusedDate }));
113
- }, this.handleWeekSelection = (e, t, r) => {
114
- if (this.props.mode === "single")
145
+ }, ht = ({ view: e }) => {
146
+ R.current = !1, ke((t) => ({ ...t, activeView: e, navigateDate: t.focusedDate }));
147
+ }, Vt = (e, t, r) => {
148
+ if (F === "single")
115
149
  return;
116
- const o = 0, h = 6, n = t === o ? e : M(e, -t), p = t === h ? e : M(e, h - t);
117
- let f = null;
118
- if (this.props.mode === "multiple") {
119
- f = [];
120
- for (let y = o; y <= h; y++)
121
- f.push(M(n, y));
122
- this.setState({ value: f, focusedDate: e });
150
+ const o = 0, g = 6, s = t === o ? e : se(e, -t), y = t === g ? e : se(e, g - t);
151
+ let D = null;
152
+ if (F === "multiple") {
153
+ D = [];
154
+ for (let v = o; v <= g; v++)
155
+ D.push(se(s, v));
156
+ V({ value: D, focusedDate: e });
123
157
  }
124
- this.props.mode === "range" && (f = { start: n, end: p }, this.setState({ value: f, focusedDate: e }));
125
- const { onChange: C } = this.props;
126
- if (C) {
127
- const y = {
158
+ if (F === "range" && (D = { start: s, end: y }, V({ value: D, focusedDate: e })), K) {
159
+ const v = {
128
160
  syntheticEvent: r,
129
161
  nativeEvent: r.nativeEvent,
130
- value: f,
131
- target: this
162
+ value: D,
163
+ target: T.current
132
164
  };
133
- C.call(void 0, y);
165
+ K(v);
134
166
  }
135
- }, this.handleDateChange = (e) => {
136
- const t = m(e.value), r = this.bus.canMoveDown(this.state.activeView);
137
- if (this.props.disabled)
167
+ }, ne = (e) => {
168
+ const t = m(e.value), r = x.current.canMoveDown(w.activeView);
169
+ if (B)
138
170
  return;
139
171
  if (r)
140
172
  if (e.isTodayClick)
141
- this.bus.moveToBottom(this.state.activeView);
173
+ x.current.moveToBottom(w.activeView);
142
174
  else {
143
- this.bus.moveDown(this.state.activeView, e.syntheticEvent), this.setState({ focusedDate: t, navigateDate: t });
175
+ x.current.moveDown(w.activeView, e.syntheticEvent), V({ focusedDate: t, navigateDate: t });
144
176
  return;
145
177
  }
146
- this.calculateFocusFromValue = !0;
178
+ R.current = !0;
147
179
  let o;
148
- switch (this.props.mode) {
180
+ const g = le(f, i, l), s = S(f, i, l), y = Q(f), D = W !== void 0 ? W : z.current;
181
+ switch (F) {
149
182
  case "single":
150
183
  o = m(e.value);
151
184
  break;
152
185
  case "multiple":
153
- if (Array.isArray(this.selectedMultiple)) {
154
- const n = this.selectedMultiple.slice();
155
- let p = -1;
156
- n.forEach((f, C) => {
157
- P(f, e.value) && (p = C);
158
- }), p !== -1 ? n.splice(p, 1) : n.push(m(e.value)), o = n.slice();
159
- } else
160
- this.selectedDate ? o = [m(this.selectedDate), m(e.value)] : o = [m(e.value)];
186
+ if (Array.isArray(g)) {
187
+ const v = g.slice();
188
+ let ce = -1;
189
+ v.forEach((It, St) => {
190
+ Pe(It, e.value) && (ce = St);
191
+ }), ce !== -1 ? v.splice(ce, 1) : v.push(m(e.value)), o = v.slice();
192
+ } else s ? o = [m(s), m(e.value)] : o = [m(e.value)];
161
193
  break;
162
194
  case "range": {
163
- o = this.selectedRange.start !== null && this.selectedRange.end !== null && this.activeRange === "start" ? this.clampRange(e.value) : this.generateRange(e.value, this.selectedRange), this.activeRangeEnd = this.activeRange !== "end" ? "end" : "start";
195
+ o = y.start !== null && y.end !== null && D === "start" ? it(e.value) : ut(e.value, y), z.current = D !== "end" ? "end" : "start";
164
196
  break;
165
197
  }
166
198
  default:
167
199
  o = m(e.value);
168
200
  break;
169
201
  }
170
- this.valueDuringOnChange = o, e.isTodayClick && this.setState({ navigateDate: t }), this.setState({ value: o, focusedDate: t }), this.valueDuringOnChange = o;
171
- const { onChange: h } = this.props;
172
- if (h) {
173
- const n = {
202
+ if (N.current = o, e.isTodayClick && V({ navigateDate: t }), V({ value: o, focusedDate: t }), N.current = o, K) {
203
+ const v = {
174
204
  syntheticEvent: e.syntheticEvent,
175
205
  nativeEvent: e.nativeEvent,
176
206
  value: o,
177
- target: this
207
+ target: T.current
178
208
  };
179
- h.call(void 0, n);
209
+ K(v);
180
210
  }
181
- this.valueDuringOnChange = void 0;
182
- }, this.showLicenseWatermark = !te(z, { component: "MultiViewCalendar" }), this.licenseMessage = se(z);
183
- const a = i.value !== void 0 ? i.value : i.defaultValue || u.defaultProps.defaultValue, c = S(this.min, this.max, a), w = U(this.min, this.max, a), R = $(a), I = H(c, w, R), V = _(
184
- A[i.defaultActiveView],
185
- this.bottomView,
186
- this.topView
187
- ), b = k(i.focusedDate || I || F(), this.min, this.max);
188
- this.state = {
189
- value: a,
190
- activeView: V,
191
- focusedDate: b,
192
- navigateDate: b
193
- }, this.activeRangeEnd = pe(R, c), this.bus = new ce(this.handleViewChange), this.navigation = new de(this.bus), this.calculateFocusFromValue = !1, this.lastView = V, this.lastViewsCount = this.props.views || E.defaultProps.views;
194
- }
195
- get wrapperID() {
196
- return this.props.id + "-wrapper-id";
197
- }
198
- get isRtl() {
199
- return this.props.dir === "rtl";
200
- }
201
- /**
202
- * Gets the wrapping element of the MultiViewCalendar component.
203
- */
204
- get element() {
205
- return this._element;
206
- }
207
- /**
208
- * Gets the value of the MultiViewCalendar.
209
- */
210
- get value() {
211
- return this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value;
212
- }
213
- /**
214
- * Gets the current focused date of the MultiViewCalendar.
215
- */
216
- get focusedDate() {
217
- return m(this._focusedDate);
218
- }
219
- get min() {
220
- return g(
221
- this.props.min !== void 0 ? this.props.min : u.defaultProps.min
222
- );
223
- }
224
- get max() {
225
- return g(
226
- this.props.max !== void 0 ? this.props.max : u.defaultProps.max
227
- );
228
- }
229
- get bottomView() {
230
- return A[this.props.bottomView !== void 0 ? this.props.bottomView : u.defaultProps.bottomView];
231
- }
232
- get topView() {
233
- return A[this.props.topView !== void 0 ? this.props.topView : u.defaultProps.topView];
234
- }
235
- get activeRange() {
236
- return this.props.activeRangeEnd !== void 0 ? this.props.activeRangeEnd : this.activeRangeEnd;
237
- }
238
- get todayIsInRange() {
239
- return T(F(), g(this.min), g(this.max));
240
- }
241
- /**
242
- * @hidden
243
- */
244
- componentDidMount() {
245
- this.calculateFocusFromValue = !0;
246
- }
247
- /**
248
- * @hidden
249
- */
250
- componentDidUpdate() {
251
- this.calendarViewList && (this.isActive ? this.calendarViewList.focusActiveDate : this.calendarViewList.blurActiveDate)();
252
- const i = S(this.min, this.max, this.value);
253
- this.calculateFocusFromValue = !!(this.selectedDate && i && this.selectedDate.getTime() && i.getTime()), this.lastView = this.state.activeView, this.lastViewsCount = this.props.views || E.defaultProps.views;
254
- }
255
- /**
256
- * @hidden
257
- */
258
- render() {
259
- this.props._ref && this.props._ref(this), this.intl = G(this), this.localization = X(this), this.bus.configure(this.bottomView, this.topView);
260
- const i = _(this.state.activeView, this.bottomView, this.topView);
261
- this.service = this.bus.service(i, this.intl), this.selectedDate = S(this.min, this.max, this.value), this.selectedMultiple = U(this.min, this.max, this.value), this.selectedRange = $(this.value);
262
- const a = H(this.selectedDate, this.selectedMultiple, this.selectedRange);
263
- this._focusedDate = k(
264
- this.calculateFocusFromValue && a !== null ? a : this.state.focusedDate,
265
- this.min,
266
- this.max
211
+ N.current = void 0;
212
+ }, T = a.useRef(null);
213
+ a.useImperativeHandle(
214
+ T,
215
+ () => ({
216
+ get element() {
217
+ return A.current;
218
+ },
219
+ get focusedDate() {
220
+ return m(C);
221
+ },
222
+ get value() {
223
+ return f;
224
+ },
225
+ get props() {
226
+ return P;
227
+ },
228
+ focus: () => {
229
+ var e;
230
+ return (e = A.current) == null ? void 0 : e.focus();
231
+ }
232
+ })
233
+ ), a.useImperativeHandle(
234
+ d,
235
+ () => T.current
267
236
  );
268
- const c = ie(
237
+ const A = a.useRef(null), E = a.useRef(null), x = a.useRef(new Ut(ht)), Ce = a.useRef(new Xt(x.current)), N = a.useRef(void 0), $ = a.useRef(!1), R = a.useRef(!1), z = a.useRef("start"), ae = a.useRef(
238
+ ie(X[fe], Y, _)
239
+ ), re = a.useRef(M), h = a.useRef([]), b = a.useRef(null), [w, ke] = a.useState(() => {
240
+ const e = L !== void 0 ? L : Ge, t = S(e, i, l), r = le(e, i, l), o = Q(e), g = $e(t, r, o), s = ie(X[fe], Y, _), y = q(tt || g || J(), i, l);
241
+ return z.current = Qt(o, t), ae.current = s, re.current = M, {
242
+ value: e,
243
+ activeView: s,
244
+ focusedDate: y,
245
+ navigateDate: y
246
+ };
247
+ }), V = (e) => {
248
+ ke((t) => ({ ...t, ...e }));
249
+ };
250
+ a.useEffect(() => {
251
+ R.current = !0;
252
+ }, []), a.useEffect(() => {
253
+ E.current && ($.current ? E.current.focusActiveDate : E.current.blurActiveDate)();
254
+ const e = S(f, i, l), t = S(f, i, l);
255
+ R.current = !!(t && e && t.getTime() && e.getTime()), ae.current = w.activeView, re.current = M;
256
+ }), a.useEffect(() => {
257
+ ve && ve({ element: A.current });
258
+ });
259
+ const yt = _t(), Ee = Ht();
260
+ x.current.configure(Y, _);
261
+ const j = ie(w.activeView, Y, _), G = x.current.service(j, yt);
262
+ b.current = G;
263
+ let f;
264
+ N.current !== void 0 ? f = N.current : L !== void 0 ? f = L : f = w.value;
265
+ const xe = S(f, i, l), Me = le(f, i, l), Oe = Q(f), Ae = $e(xe, Me, Oe), C = q(
266
+ R.current && Ae !== null ? Ae : w.focusedDate,
267
+ i,
268
+ l
269
+ ), Ie = ue(J(), O(i), O(l)), Rt = Bt(
269
270
  "k-calendar k-calendar-range",
270
271
  {
271
- "k-disabled": this.props.disabled
272
+ "k-disabled": B
272
273
  },
273
- this.props.className
274
- ), w = this.rangeWithFocused(this.selectedRange, this.focusedDate), R = this.localization.toLanguageString(K, Y[K]), I = this.localization.toLanguageString(W, Y[W]), V = !this.canNavigate(x.PrevView), b = !this.canNavigate(x.NextView), e = { "aria-disabled": V }, t = { "aria-disabled": b }, r = this.lastView !== i, o = this.dates && this.isInMonth(this.state.navigateDate, this.dates[0]), h = this.lastViewsCount !== this.props.views;
275
- (!o || r || h) && (this.dates = this.service.datesList(
276
- this.state.navigateDate,
277
- this.props.views || E.defaultProps.views
278
- ));
279
- const n = m(this.dates && this.dates[0] ? this.dates[0] : F());
280
- return /* @__PURE__ */ d.createElement(
274
+ Ze
275
+ ), bt = lt(Oe, C), Ct = Ee.toLanguageString(We, Ye[We]), kt = Ee.toLanguageString(_e, Ye[_e]), Se = !Ve(U.PrevView), Fe = !Ve(U.NextView), Et = { "aria-disabled": Se }, xt = { "aria-disabled": Fe }, Mt = ae.current !== j, Ot = h.current.length > 0 && ye(w.navigateDate, h.current[0]), At = re.current !== M;
276
+ (!Ot || Mt || At) && (h.current = G.datesList(w.navigateDate, M));
277
+ const Te = m((Ne = h.current) != null && Ne[0] ? h.current[0] : J());
278
+ return /* @__PURE__ */ a.createElement(
281
279
  "div",
282
280
  {
283
- ref: (p) => {
284
- this._element = p;
285
- },
286
- className: c,
287
- id: this.props.id || this.wrapperID,
288
- "aria-labelledby": this.props.ariaLabelledBy,
289
- "aria-describedby": this.props.ariaDescribedBy,
290
- tabIndex: this.props.disabled ? void 0 : this.props.tabIndex,
291
- onFocus: this.handleFocus,
292
- onBlur: this.handleBlur,
293
- onMouseDown: this.handleMouseDown,
294
- onClick: this.handleClick,
295
- onKeyDown: this.handleKeyDown,
296
- "aria-disabled": this.props.disabled,
297
- dir: this.props.dir
281
+ ref: A,
282
+ className: Rt,
283
+ id: P.id || st,
284
+ "aria-labelledby": rt,
285
+ "aria-describedby": ct,
286
+ tabIndex: B ? void 0 : Je,
287
+ onFocus: gt,
288
+ onBlur: wt,
289
+ onMouseDown: mt,
290
+ onClick: vt,
291
+ onKeyDown: pt,
292
+ "aria-disabled": B,
293
+ dir: he
298
294
  },
299
- /* @__PURE__ */ d.createElement(
300
- re,
295
+ /* @__PURE__ */ a.createElement(
296
+ zt,
301
297
  {
302
- key: `.kendo.calendar.header.${n.getTime()}`,
303
- activeView: i,
304
- currentDate: n,
305
- min: this.min,
306
- max: this.max,
307
- rangeLength: this.props.views,
308
- bus: this.bus,
309
- service: this.service,
310
- headerTitle: this.props.headerTitle,
311
- verticalView: this.props.mobileMode,
312
- commands: /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement(
313
- L,
298
+ key: `.kendo.calendar.header.${Te.getTime()}`,
299
+ activeView: j,
300
+ currentDate: Te,
301
+ min: i,
302
+ max: l,
303
+ rangeLength: M,
304
+ bus: x.current,
305
+ service: G,
306
+ headerTitle: pe,
307
+ verticalView: ge,
308
+ commands: /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
309
+ Be,
314
310
  {
315
311
  type: "button",
316
312
  className: "k-calendar-nav-prev",
317
- icon: this.isRtl ? "chevron-right" : "chevron-left",
318
- svgIcon: this.isRtl ? N : B,
313
+ icon: H ? "chevron-right" : "chevron-left",
314
+ svgIcon: H ? Le : Ke,
319
315
  fillMode: "flat",
320
- title: R,
321
- disabled: V,
322
- onClick: this.handlePrevButtonClick,
323
- ...e
324
- }
325
- ), /* @__PURE__ */ d.createElement(
326
- ue,
327
- {
328
- min: this.min,
329
- max: this.max,
330
- onClick: this.handleTodayClick,
331
- disabled: !this.todayIsInRange
316
+ title: Ct,
317
+ disabled: Se,
318
+ onClick: Re,
319
+ ...Et
332
320
  }
333
- ), /* @__PURE__ */ d.createElement(
334
- L,
321
+ ), /* @__PURE__ */ a.createElement(Jt, { min: i, max: l, onClick: Dt, disabled: !Ie }), /* @__PURE__ */ a.createElement(
322
+ Be,
335
323
  {
336
324
  type: "button",
337
325
  className: "k-calendar-nav-next",
338
- icon: this.isRtl ? "chevron-left" : "chevron-right",
339
- svgIcon: this.isRtl ? B : N,
326
+ icon: H ? "chevron-left" : "chevron-right",
327
+ svgIcon: H ? Ke : Le,
340
328
  fillMode: "flat",
341
- title: I,
342
- disabled: b,
343
- onClick: this.handleNextButtonClick,
344
- ...t
329
+ title: kt,
330
+ disabled: Fe,
331
+ onClick: be,
332
+ ...xt
345
333
  }
346
334
  ))
347
335
  }
348
336
  ),
349
- /* @__PURE__ */ d.createElement(
350
- E,
337
+ /* @__PURE__ */ a.createElement(
338
+ qt,
351
339
  {
352
- ref: (p) => {
353
- this.calendarViewList = p;
354
- },
355
- dates: this.dates,
356
- activeView: i,
357
- focusedDate: this.focusedDate,
358
- weekDaysFormat: this.props.weekDaysFormat,
359
- min: this.min,
360
- max: this.max,
361
- bus: this.bus,
362
- service: this.service,
363
- selectionRange: w,
364
- value: this.selectedMultiple || this.selectedDate,
365
- cellUID: this.cellUID,
366
- views: this.props.views,
367
- onChange: this.handleDateChange,
368
- onWeekSelect: this.handleWeekSelection,
369
- showWeekNumbers: this.props.weekNumber,
370
- onCellEnter: this.handleCellEnter,
371
- cell: this.props.cell,
372
- weekCell: this.props.weekCell,
373
- headerTitle: this.props.headerTitle,
374
- verticalView: this.props.mobileMode,
375
- showOtherMonthDays: this.props.showOtherMonthDays,
376
- allowReverse: this.props.allowReverse
340
+ ref: E,
341
+ dates: h.current,
342
+ activeView: j,
343
+ focusedDate: m(C),
344
+ weekDaysFormat: qe,
345
+ min: i,
346
+ max: l,
347
+ bus: x.current,
348
+ service: G,
349
+ selectionRange: bt,
350
+ value: Me || xe,
351
+ cellUID: ot,
352
+ views: M,
353
+ onChange: ne,
354
+ onWeekSelect: Vt,
355
+ showWeekNumbers: et,
356
+ onCellEnter: ft,
357
+ cell: nt,
358
+ weekCell: at,
359
+ headerTitle: pe,
360
+ verticalView: ge,
361
+ showOtherMonthDays: Qe,
362
+ allowReverse: me
377
363
  }
378
364
  ),
379
- this.showLicenseWatermark && /* @__PURE__ */ d.createElement(ae, { message: this.licenseMessage })
365
+ p && /* @__PURE__ */ a.createElement(Lt, { message: k })
380
366
  );
381
367
  }
382
- // protected isListInRange = (list: Date[]): boolean => {
383
- // return this.min < list[0]
384
- // && this.max > list[Math.max(0, (this.props.views || MultiViewCalendarWithoutContext.defaultProps.views) - 1)];
385
- // };
386
- isInMonth(i, a) {
387
- return !!a && ne(a) <= i && i <= oe(a);
388
- }
389
- };
390
- u.displayName = "MultiViewCalendar", u.propTypes = {
391
- activeRangeEnd: s.oneOf(["start", "end"]),
392
- allowReverse: s.bool,
393
- bottomView: s.oneOf(["month", "year", "decade", "century"]),
394
- className: s.string,
395
- defaultActiveView: s.oneOf(["month", "year", "decade", "century"]),
396
- defaultValue: s.oneOfType([
397
- D(s.instanceOf(Date)),
398
- s.arrayOf(s.instanceOf(Date)),
399
- s.shape({
400
- start: D(s.instanceOf(Date)),
401
- end: D(s.instanceOf(Date))
368
+ );
369
+ Z.propTypes = {
370
+ activeRangeEnd: n.oneOf(["start", "end"]),
371
+ allowReverse: n.bool,
372
+ bottomView: n.oneOf(["month", "year", "decade", "century"]),
373
+ className: n.string,
374
+ defaultActiveView: n.oneOf(["month", "year", "decade", "century"]),
375
+ defaultValue: n.oneOfType([
376
+ I(n.instanceOf(Date)),
377
+ n.arrayOf(n.instanceOf(Date)),
378
+ n.shape({
379
+ start: I(n.instanceOf(Date)),
380
+ end: I(n.instanceOf(Date))
402
381
  })
403
382
  ]),
404
- disabled: s.bool,
405
- focusedDate: s.instanceOf(Date),
406
- id: s.string,
407
- weekDaysFormat: s.oneOf(["narrow", "short", "abbreviated"]),
408
- ariaLabelledBy: s.string,
409
- ariaDescribedBy: s.string,
410
- max: s.instanceOf(Date),
411
- min: s.instanceOf(Date),
412
- mode: s.oneOf(["single", "multiple", "range"]),
413
- onBlur: s.func,
414
- onChange: s.func,
415
- onFocus: s.func,
416
- tabIndex: s.number,
417
- topView: s.oneOf(["month", "year", "decade", "century"]),
418
- value: s.oneOfType([
419
- D(s.instanceOf(Date)),
420
- s.arrayOf(s.instanceOf(Date)),
421
- s.shape({
422
- start: D(s.instanceOf(Date).isRequired),
423
- end: D(s.instanceOf(Date).isRequired)
383
+ disabled: n.bool,
384
+ focusedDate: n.instanceOf(Date),
385
+ id: n.string,
386
+ weekDaysFormat: n.oneOf(["narrow", "short", "abbreviated"]),
387
+ ariaLabelledBy: n.string,
388
+ ariaDescribedBy: n.string,
389
+ max: n.instanceOf(Date),
390
+ min: n.instanceOf(Date),
391
+ mode: n.oneOf(["single", "multiple", "range"]),
392
+ onBlur: n.func,
393
+ onChange: n.func,
394
+ onFocus: n.func,
395
+ tabIndex: n.number,
396
+ topView: n.oneOf(["month", "year", "decade", "century"]),
397
+ value: n.oneOfType([
398
+ I(n.instanceOf(Date)),
399
+ n.arrayOf(n.instanceOf(Date)),
400
+ n.shape({
401
+ start: I(n.instanceOf(Date).isRequired),
402
+ end: I(n.instanceOf(Date).isRequired)
424
403
  })
425
404
  ]),
426
- views: (i, a, c) => {
427
- const w = i[a];
428
- return w !== void 0 && w < 1 ? new Error(
429
- `Invalid prop '${a}' supplied to'${c}'. The '${a}' property cannot be less than 1'`
405
+ views: (c, d, p) => {
406
+ const k = c[d];
407
+ return k !== void 0 && k < 1 ? new Error(
408
+ `Invalid prop '${d}' supplied to'${p}'. The '${d}' property cannot be less than 1'`
430
409
  ) : null;
431
410
  },
432
- weekNumber: s.bool,
433
- showOtherMonthDays: s.bool,
434
- dir: s.string
435
- }, u.defaultProps = {
436
- disabled: !1,
437
- min: he,
438
- max: le,
439
- navigation: !0,
440
- defaultActiveView: "month",
441
- defaultValue: null,
442
- topView: "century",
443
- weekDaysFormat: "short",
444
- tabIndex: 0,
445
- bottomView: "month",
446
- views: 2,
447
- allowReverse: !1,
448
- showOtherMonthDays: !1
411
+ weekNumber: n.bool,
412
+ showOtherMonthDays: n.bool,
413
+ dir: n.string
449
414
  };
450
- let v = u;
451
- const me = ee(), ve = Q(
452
- Z(
453
- me,
454
- v
455
- )
456
- );
457
- ve.displayName = "KendoReactMultiViewCalendar";
458
- q(v);
459
- J(v);
415
+ Z.displayName = "KendoReactMultiViewCalendar";
416
+ const pn = Z, hn = Z;
460
417
  export {
461
- ve as MultiViewCalendar,
462
- me as MultiViewCalendarPropsContext,
463
- v as MultiViewCalendarWithoutContext
418
+ hn as MultiViewCalendar,
419
+ Zt as MultiViewCalendarPropsContext,
420
+ pn as MultiViewCalendarWithoutContext,
421
+ u as multiViewCalendarDefaultProps
464
422
  };