@progress/kendo-react-dateinputs 7.5.0-develop.20 → 7.5.0-develop.21

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.
@@ -6,45 +6,45 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as d from "react";
10
- import t from "prop-types";
11
- import { provideIntlService as q, provideLocalizationService as H, registerForIntl as j, registerForLocalization as G } from "@progress/kendo-react-intl";
12
- import { Keys as k, classNames as X, createPropsContext as J, withIdHOC as Q, withPropsContext as Z } from "@progress/kendo-react-common";
13
- import { isEqualDate as A, cloneDate as u, getDate as f, firstDayOfMonth as W, lastDayOfMonth as ee } from "@progress/kendo-date-math";
14
- import { Button as M } from "@progress/kendo-react-buttons";
15
- import { chevronRightIcon as T, chevronLeftIcon as N } from "@progress/kendo-svg-icons";
16
- import { Action as y } from "../models/NavigationAction.mjs";
17
- import { CalendarViewEnum as E } from "../models/CalendarViewEnum.mjs";
18
- import { EMPTY_SELECTIONRANGE as Y } from "../models/SelectionRange.mjs";
19
- import { Header as te } from "./Header.mjs";
20
- import { dateInRange as R, getToday as C, viewInRange as P, nullable as D, MIN_DATE as se, MAX_DATE as ie, isInRange as I } from "../../utils.mjs";
21
- import { prevView as S, messages as B, nextView as L } from "../../messages/index.mjs";
22
- import { BusViewService as ae } from "../services/BusViewService.mjs";
23
- import { NavigationService as ne } from "../services/NavigationService.mjs";
24
- import { HorizontalViewList as x } from "./HorizontalViewList.mjs";
25
- import { TodayCommand as oe } from "./TodayCommand.mjs";
26
- const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Date && !Array.isArray(a) && I(f(a), l, i) ? f(a) : null, _ = (l = p.defaultProps.min, i = p.defaultProps.max, a) => Array.isArray(a) ? a.filter((h) => I(h, l, i)).map((h) => f(h)) : null, K = (l) => typeof l == "object" && !(l instanceof Date) && l !== null && !Array.isArray(l) ? l : Y, z = (l, i, a) => l || i && i[0] || a && a.start, re = (l, i) => l.start === null && i === null ? "start" : l.end === null ? "end" : "start", c = class c extends d.Component {
9
+ import * as p from "react";
10
+ import s from "prop-types";
11
+ import { provideIntlService as j, provideLocalizationService as G, registerForIntl as X, registerForLocalization as q } from "@progress/kendo-react-intl";
12
+ import { Keys as O, classNames as J, createPropsContext as Q, withIdHOC as Z, withPropsContext as ee } from "@progress/kendo-react-common";
13
+ import { isEqualDate as N, addDays as A, cloneDate as m, getDate as g, firstDayOfMonth as te, lastDayOfMonth as se } from "@progress/kendo-date-math";
14
+ import { Button as P } from "@progress/kendo-react-buttons";
15
+ import { chevronRightIcon as B, chevronLeftIcon as L } from "@progress/kendo-svg-icons";
16
+ import { Action as C } from "../models/NavigationAction.mjs";
17
+ import { CalendarViewEnum as M } from "../models/CalendarViewEnum.mjs";
18
+ import { EMPTY_SELECTIONRANGE as W } from "../models/SelectionRange.mjs";
19
+ import { Header as ie } from "./Header.mjs";
20
+ import { dateInRange as F, getToday as k, viewInRange as _, nullable as w, MIN_DATE as ae, MAX_DATE as ne, isInRange as T } from "../../utils.mjs";
21
+ import { prevView as K, messages as Y, nextView as z } from "../../messages/index.mjs";
22
+ import { BusViewService as oe } from "../services/BusViewService.mjs";
23
+ import { NavigationService as le } from "../services/NavigationService.mjs";
24
+ import { HorizontalViewList as E } from "./HorizontalViewList.mjs";
25
+ import { TodayCommand as re } from "./TodayCommand.mjs";
26
+ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Date && !Array.isArray(a) && T(g(a), r, i) ? g(a) : null, U = (r = v.defaultProps.min, i = v.defaultProps.max, a) => Array.isArray(a) ? a.filter((c) => T(c, r, i)).map((c) => g(c)) : null, $ = (r) => typeof r == "object" && !(r instanceof Date) && r !== null && !Array.isArray(r) ? r : W, H = (r, i, a) => r || i && i[0] || a && a.start, he = (r, i) => r.start === null && i === null ? "start" : r.end === null ? "end" : "start", d = class d extends p.Component {
27
27
  constructor(i) {
28
- super(i), this.dates = [], this.selectedDate = null, this.selectedMultiple = null, this.selectedRange = Y, 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.focus = () => {
28
+ super(i), this.dates = [], this.selectedDate = null, this.selectedMultiple = null, this.selectedRange = W, 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.focus = () => {
29
29
  this._element && this._element.focus();
30
- }, this.clampRange = (e) => ({ start: e, end: null }), this.rangeWithFocused = (e, s) => ({
30
+ }, this.clampRange = (e) => ({ start: e, end: null }), this.rangeWithFocused = (e, t) => ({
31
31
  start: e.start,
32
- end: e.end === null && e.start !== null && this.isActive ? s : e.end
33
- }), this.generateRange = (e, s) => {
34
- const { end: r, start: o } = s, m = s.start !== null && e.getTime() <= s.start.getTime();
35
- return !this.props.allowReverse && m ? { start: e, end: this.selectedRange.start } : this.activeRange !== "end" ? { start: e, end: r } : { start: o || this.selectedDate, end: e };
32
+ end: e.end === null && e.start !== null && this.isActive ? t : e.end
33
+ }), this.generateRange = (e, t) => {
34
+ const { end: l, 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: l } : { start: o || this.selectedDate, end: e };
36
36
  }, this.canNavigate = (e) => {
37
37
  if (!this.service)
38
38
  return !1;
39
- const s = this.service.move(this.focusedDate, e);
40
- return this.min <= s && s <= this.max || this.service.isInSameView(s, this.min) || this.service.isInSameView(s, this.max);
41
- }, this.navigate = (e, s) => {
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
42
  this.calculateFocusFromValue = !1;
43
- const r = this.move(e, s);
44
- this.setState({ navigateDate: r, focusedDate: r });
45
- }, this.move = (e, s) => this.clampDate(this.service.move(s, e)), this.clampDate = (e) => R(e, this.min, this.max), this.shouldAutoCorrect = (e, s) => {
46
- const { end: r, start: o } = s;
47
- return this.activeRange !== "end" ? r !== null && e > r : o !== null && e < o;
43
+ const l = this.move(e, t);
44
+ this.setState({ navigateDate: l, focusedDate: l });
45
+ }, this.move = (e, t) => this.clampDate(this.service.move(t, e)), this.clampDate = (e) => F(e, this.min, this.max), this.shouldAutoCorrect = (e, t) => {
46
+ const { end: l, start: o } = t;
47
+ return this.activeRange !== "end" ? l !== null && e > l : o !== null && e < o;
48
48
  }, this.handleCellEnter = (e) => {
49
49
  this.props.mode === "range" && (this.calculateFocusFromValue = !1, this.setState({
50
50
  focusedDate: e
@@ -57,33 +57,33 @@ const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
57
57
  if (this.isActive = !0, !this.calendarViewList)
58
58
  return;
59
59
  this.calendarViewList.focusActiveDate();
60
- const { onFocus: s } = this.props;
61
- s && s.call(void 0, e);
60
+ const { onFocus: t } = this.props;
61
+ t && t.call(void 0, e);
62
62
  }, this.handleBlur = (e) => {
63
63
  if (this.isActive = !1, !this.calendarViewList)
64
64
  return;
65
65
  this.calendarViewList.blurActiveDate();
66
- const { onBlur: s } = this.props;
67
- s && s.call(void 0, e);
66
+ const { onBlur: t } = this.props;
67
+ t && t.call(void 0, e);
68
68
  }, this.handleTodayClick = (e) => {
69
69
  this.todayIsInRange && this.handleDateChange(e);
70
70
  }, this.handlePrevButtonClick = () => {
71
- const e = y.PrevView;
71
+ const e = C.PrevView;
72
72
  if (this.state.activeView > 0 && this.focusedDate.getFullYear() > this.dates[0].getFullYear())
73
73
  this.navigate(e, this.move(e, this.focusedDate));
74
74
  else {
75
- const s = this.isInMonth(this.focusedDate, this.dates[1]) ? this.move(e, this.focusedDate) : this.focusedDate;
76
- this.navigate(e, s);
75
+ const t = this.isInMonth(this.focusedDate, this.dates[1]) ? this.move(e, this.focusedDate) : this.focusedDate;
76
+ this.navigate(e, t);
77
77
  }
78
78
  }, this.handleNextButtonClick = () => {
79
- this.navigate(y.NextView, this.focusedDate);
79
+ this.navigate(C.NextView, this.focusedDate);
80
80
  }, this.handleKeyDown = (e) => {
81
- const { keyCode: r, ctrlKey: o, metaKey: m } = e;
82
- if (r === 84) {
83
- const n = C();
81
+ const { keyCode: l, ctrlKey: o, metaKey: h } = e;
82
+ if (l === 84) {
83
+ const n = k();
84
84
  this.calculateFocusFromValue = !1, this.setState({ focusedDate: n, navigateDate: n });
85
85
  }
86
- if ((o || m) && (r === k.left && this.handlePrevButtonClick(), r === k.right && this.handleNextButtonClick()), r === k.enter) {
86
+ if ((o || h) && (l === O.left && this.handlePrevButtonClick(), l === O.right && this.handleNextButtonClick()), l === O.enter) {
87
87
  const n = {
88
88
  syntheticEvent: e,
89
89
  nativeEvent: e.nativeEvent,
@@ -92,7 +92,7 @@ const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
92
92
  };
93
93
  this.handleDateChange(n);
94
94
  } else {
95
- const n = R(
95
+ const n = F(
96
96
  this.navigation.move(
97
97
  this.focusedDate,
98
98
  this.navigation.action(e),
@@ -103,76 +103,98 @@ const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
103
103
  this.min,
104
104
  this.max
105
105
  );
106
- if (A(this.focusedDate, n))
106
+ if (N(this.focusedDate, n))
107
107
  return;
108
108
  this.dates && this.service && !this.service.isInArray(n, this.dates) && this.setState({ navigateDate: n }), this.calculateFocusFromValue = !1, this.setState({ focusedDate: n });
109
109
  }
110
110
  e.preventDefault();
111
111
  }, this.handleViewChange = ({ view: e }) => {
112
- this.calculateFocusFromValue = !1, this.setState((s) => ({ activeView: e, navigateDate: s.focusedDate }));
112
+ this.calculateFocusFromValue = !1, this.setState((t) => ({ activeView: e, navigateDate: t.focusedDate }));
113
+ }, this.handleWeekSelection = (e, t, l) => {
114
+ if (this.props.mode === "single")
115
+ return;
116
+ const o = 0, h = 6, n = t === o ? e : A(e, -t), u = t === h ? e : A(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(A(n, y));
122
+ this.setState({ value: f, focusedDate: e });
123
+ }
124
+ this.props.mode === "range" && (f = { start: n, end: u }, this.setState({ value: f, focusedDate: e }));
125
+ const { onChange: x } = this.props;
126
+ if (x) {
127
+ const y = {
128
+ syntheticEvent: l,
129
+ nativeEvent: l.nativeEvent,
130
+ value: f,
131
+ target: this
132
+ };
133
+ x.call(void 0, y);
134
+ }
113
135
  }, this.handleDateChange = (e) => {
114
- const s = u(e.value), r = this.bus.canMoveDown(this.state.activeView);
136
+ const t = m(e.value), l = this.bus.canMoveDown(this.state.activeView);
115
137
  if (this.props.disabled)
116
138
  return;
117
- if (r)
139
+ if (l)
118
140
  if (e.isTodayClick)
119
141
  this.bus.moveToBottom(this.state.activeView);
120
142
  else {
121
- this.bus.moveDown(this.state.activeView, e.syntheticEvent), this.setState({ focusedDate: s, navigateDate: s });
143
+ this.bus.moveDown(this.state.activeView, e.syntheticEvent), this.setState({ focusedDate: t, navigateDate: t });
122
144
  return;
123
145
  }
124
146
  this.calculateFocusFromValue = !0;
125
147
  let o;
126
148
  switch (this.props.mode) {
127
149
  case "single":
128
- o = u(e.value);
150
+ o = m(e.value);
129
151
  break;
130
152
  case "multiple":
131
153
  if (Array.isArray(this.selectedMultiple)) {
132
154
  const n = this.selectedMultiple.slice();
133
- let v = -1;
134
- n.forEach((U, $) => {
135
- A(U, e.value) && (v = $);
136
- }), v !== -1 ? n.splice(v, 1) : n.push(u(e.value)), o = n.slice();
155
+ let u = -1;
156
+ n.forEach((f, x) => {
157
+ N(f, e.value) && (u = x);
158
+ }), u !== -1 ? n.splice(u, 1) : n.push(m(e.value)), o = n.slice();
137
159
  } else
138
- this.selectedDate ? o = [u(this.selectedDate), u(e.value)] : o = [u(e.value)];
160
+ this.selectedDate ? o = [m(this.selectedDate), m(e.value)] : o = [m(e.value)];
139
161
  break;
140
162
  case "range": {
141
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";
142
164
  break;
143
165
  }
144
166
  default:
145
- o = u(e.value);
167
+ o = m(e.value);
146
168
  break;
147
169
  }
148
- this.valueDuringOnChange = o, e.isTodayClick && this.setState({ navigateDate: s }), this.setState({ value: o, focusedDate: s }), this.valueDuringOnChange = o;
149
- const { onChange: m } = this.props;
150
- if (m) {
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) {
151
173
  const n = {
152
174
  syntheticEvent: e.syntheticEvent,
153
175
  nativeEvent: e.nativeEvent,
154
176
  value: o,
155
177
  target: this
156
178
  };
157
- m.call(void 0, n);
179
+ h.call(void 0, n);
158
180
  }
159
181
  this.valueDuringOnChange = void 0;
160
182
  };
161
- const a = i.value !== void 0 ? i.value : i.defaultValue || c.defaultProps.defaultValue, h = O(this.min, this.max, a), g = _(this.min, this.max, a), b = K(a), F = z(h, g, b), w = P(
162
- E[i.defaultActiveView],
183
+ const a = i.value !== void 0 ? i.value : i.defaultValue || d.defaultProps.defaultValue, c = S(this.min, this.max, a), D = U(this.min, this.max, a), R = $(a), I = H(c, D, R), V = _(
184
+ M[i.defaultActiveView],
163
185
  this.bottomView,
164
186
  this.topView
165
- ), V = R(
166
- i.focusedDate || F || C(),
187
+ ), b = F(
188
+ i.focusedDate || I || k(),
167
189
  this.min,
168
190
  this.max
169
191
  );
170
192
  this.state = {
171
193
  value: a,
172
- activeView: w,
173
- focusedDate: V,
174
- navigateDate: V
175
- }, this.activeRangeEnd = re(b, h), this.bus = new ae(this.handleViewChange), this.navigation = new ne(this.bus), this.calculateFocusFromValue = !1, this.lastView = w, this.lastViewsCount = this.props.views || x.defaultProps.views;
194
+ activeView: V,
195
+ focusedDate: b,
196
+ navigateDate: b
197
+ }, this.activeRangeEnd = he(R, c), this.bus = new oe(this.handleViewChange), this.navigation = new le(this.bus), this.calculateFocusFromValue = !1, this.lastView = V, this.lastViewsCount = this.props.views || E.defaultProps.views;
176
198
  }
177
199
  get wrapperID() {
178
200
  return this.props.id + "-wrapper-id";
@@ -196,25 +218,25 @@ const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
196
218
  * Gets the current focused date of the MultiViewCalendar.
197
219
  */
198
220
  get focusedDate() {
199
- return u(this._focusedDate);
221
+ return m(this._focusedDate);
200
222
  }
201
223
  get min() {
202
- return f(this.props.min !== void 0 ? this.props.min : c.defaultProps.min);
224
+ return g(this.props.min !== void 0 ? this.props.min : d.defaultProps.min);
203
225
  }
204
226
  get max() {
205
- return f(this.props.max !== void 0 ? this.props.max : c.defaultProps.max);
227
+ return g(this.props.max !== void 0 ? this.props.max : d.defaultProps.max);
206
228
  }
207
229
  get bottomView() {
208
- return E[this.props.bottomView !== void 0 ? this.props.bottomView : c.defaultProps.bottomView];
230
+ return M[this.props.bottomView !== void 0 ? this.props.bottomView : d.defaultProps.bottomView];
209
231
  }
210
232
  get topView() {
211
- return E[this.props.topView !== void 0 ? this.props.topView : c.defaultProps.topView];
233
+ return M[this.props.topView !== void 0 ? this.props.topView : d.defaultProps.topView];
212
234
  }
213
235
  get activeRange() {
214
236
  return this.props.activeRangeEnd !== void 0 ? this.props.activeRangeEnd : this.activeRangeEnd;
215
237
  }
216
238
  get todayIsInRange() {
217
- return I(C(), f(this.min), f(this.max));
239
+ return T(k(), g(this.min), g(this.max));
218
240
  }
219
241
  /**
220
242
  * @hidden
@@ -227,41 +249,41 @@ const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
227
249
  */
228
250
  componentDidUpdate() {
229
251
  this.calendarViewList && (this.isActive ? this.calendarViewList.focusActiveDate : this.calendarViewList.blurActiveDate)();
230
- const i = O(this.min, this.max, this.value);
231
- this.calculateFocusFromValue = !!(this.selectedDate && i && this.selectedDate.getTime() && i.getTime()), this.lastView = this.state.activeView, this.lastViewsCount = this.props.views || x.defaultProps.views;
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;
232
254
  }
233
255
  /**
234
256
  * @hidden
235
257
  */
236
258
  render() {
237
- this.props._ref && this.props._ref(this), this.intl = q(this), this.localization = H(this), this.bus.configure(this.bottomView, this.topView);
238
- const i = P(this.state.activeView, this.bottomView, this.topView);
239
- this.service = this.bus.service(i, this.intl), this.selectedDate = O(this.min, this.max, this.value), this.selectedMultiple = _(this.min, this.max, this.value), this.selectedRange = K(this.value);
240
- const a = z(this.selectedDate, this.selectedMultiple, this.selectedRange);
241
- this._focusedDate = R(
259
+ this.props._ref && this.props._ref(this), this.intl = j(this), this.localization = G(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 = F(
242
264
  this.calculateFocusFromValue && a !== null ? a : this.state.focusedDate,
243
265
  this.min,
244
266
  this.max
245
267
  );
246
- const h = X(
268
+ const c = J(
247
269
  "k-calendar k-calendar-range k-calendar-md",
248
270
  {
249
271
  "k-disabled": this.props.disabled
250
272
  },
251
273
  this.props.className
252
- ), g = this.rangeWithFocused(this.selectedRange, this.focusedDate), b = this.localization.toLanguageString(S, B[S]), F = this.localization.toLanguageString(L, B[L]), w = !this.canNavigate(y.PrevView), V = !this.canNavigate(y.NextView), e = { "aria-disabled": w }, s = { "aria-disabled": V }, r = this.lastView !== i, o = this.dates && this.isInMonth(this.state.navigateDate, this.dates[0]), m = this.lastViewsCount !== this.props.views;
253
- (!o || r || m) && (this.dates = this.service.datesList(
274
+ ), D = this.rangeWithFocused(this.selectedRange, this.focusedDate), R = this.localization.toLanguageString(K, Y[K]), I = this.localization.toLanguageString(z, Y[z]), V = !this.canNavigate(C.PrevView), b = !this.canNavigate(C.NextView), e = { "aria-disabled": V }, t = { "aria-disabled": b }, l = this.lastView !== i, o = this.dates && this.isInMonth(this.state.navigateDate, this.dates[0]), h = this.lastViewsCount !== this.props.views;
275
+ (!o || l || h) && (this.dates = this.service.datesList(
254
276
  this.state.navigateDate,
255
- this.props.views || x.defaultProps.views
277
+ this.props.views || E.defaultProps.views
256
278
  ));
257
- const n = u(this.dates && this.dates[0] ? this.dates[0] : C());
258
- return /* @__PURE__ */ d.createElement(
279
+ const n = m(this.dates && this.dates[0] ? this.dates[0] : k());
280
+ return /* @__PURE__ */ p.createElement(
259
281
  "div",
260
282
  {
261
- ref: (v) => {
262
- this._element = v;
283
+ ref: (u) => {
284
+ this._element = u;
263
285
  },
264
- className: h,
286
+ className: c,
265
287
  id: this.props.id || this.wrapperID,
266
288
  "aria-labelledby": this.props.ariaLabelledBy,
267
289
  "aria-describedby": this.props.ariaDescribedBy,
@@ -274,8 +296,8 @@ const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
274
296
  "aria-disabled": this.props.disabled,
275
297
  dir: this.props.dir
276
298
  },
277
- /* @__PURE__ */ d.createElement(
278
- te,
299
+ /* @__PURE__ */ p.createElement(
300
+ ie,
279
301
  {
280
302
  key: `.kendo.calendar.header.${n.getTime()}`,
281
303
  activeView: i,
@@ -287,48 +309,48 @@ const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
287
309
  service: this.service,
288
310
  headerTitle: this.props.headerTitle,
289
311
  verticalView: this.props.mobileMode,
290
- commands: /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement(
291
- M,
312
+ commands: /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement(
313
+ P,
292
314
  {
293
315
  type: "button",
294
316
  className: "k-calendar-nav-prev",
295
317
  icon: this.isRtl ? "chevron-right" : "chevron-left",
296
- svgIcon: this.isRtl ? T : N,
318
+ svgIcon: this.isRtl ? B : L,
297
319
  fillMode: "flat",
298
- title: b,
299
- disabled: w,
320
+ title: R,
321
+ disabled: V,
300
322
  onClick: this.handlePrevButtonClick,
301
323
  ...e
302
324
  }
303
- ), /* @__PURE__ */ d.createElement(
304
- oe,
325
+ ), /* @__PURE__ */ p.createElement(
326
+ re,
305
327
  {
306
328
  min: this.min,
307
329
  max: this.max,
308
330
  onClick: this.handleTodayClick,
309
331
  disabled: !this.todayIsInRange
310
332
  }
311
- ), /* @__PURE__ */ d.createElement(
312
- M,
333
+ ), /* @__PURE__ */ p.createElement(
334
+ P,
313
335
  {
314
336
  type: "button",
315
337
  className: "k-calendar-nav-next",
316
338
  icon: this.isRtl ? "chevron-left" : "chevron-right",
317
- svgIcon: this.isRtl ? N : T,
339
+ svgIcon: this.isRtl ? L : B,
318
340
  fillMode: "flat",
319
- title: F,
320
- disabled: V,
341
+ title: I,
342
+ disabled: b,
321
343
  onClick: this.handleNextButtonClick,
322
- ...s
344
+ ...t
323
345
  }
324
346
  ))
325
347
  }
326
348
  ),
327
- /* @__PURE__ */ d.createElement(
328
- x,
349
+ /* @__PURE__ */ p.createElement(
350
+ E,
329
351
  {
330
- ref: (v) => {
331
- this.calendarViewList = v;
352
+ ref: (u) => {
353
+ this.calendarViewList = u;
332
354
  },
333
355
  dates: this.dates,
334
356
  activeView: i,
@@ -338,18 +360,20 @@ const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
338
360
  max: this.max,
339
361
  bus: this.bus,
340
362
  service: this.service,
341
- selectionRange: g,
363
+ selectionRange: D,
342
364
  value: this.selectedMultiple || this.selectedDate,
343
365
  cellUID: this.cellUID,
344
366
  views: this.props.views,
345
367
  onChange: this.handleDateChange,
368
+ onWeekSelect: this.handleWeekSelection,
346
369
  showWeekNumbers: this.props.weekNumber,
347
370
  onCellEnter: this.handleCellEnter,
348
371
  cell: this.props.cell,
349
372
  weekCell: this.props.weekCell,
350
373
  headerTitle: this.props.headerTitle,
351
374
  verticalView: this.props.mobileMode,
352
- showOtherMonthDays: this.props.showOtherMonthDays
375
+ showOtherMonthDays: this.props.showOtherMonthDays,
376
+ allowReverse: this.props.allowReverse
353
377
  }
354
378
  )
355
379
  );
@@ -359,58 +383,58 @@ const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
359
383
  // && this.max > list[Math.max(0, (this.props.views || MultiViewCalendarWithoutContext.defaultProps.views) - 1)];
360
384
  // };
361
385
  isInMonth(i, a) {
362
- return !!a && W(a) <= i && i <= ee(a);
386
+ return !!a && te(a) <= i && i <= se(a);
363
387
  }
364
388
  };
365
- c.displayName = "MultiViewCalendar", c.propTypes = {
366
- activeRangeEnd: t.oneOf(["start", "end"]),
367
- allowReverse: t.bool,
368
- bottomView: t.oneOf(["month", "year", "decade", "century"]),
369
- className: t.string,
370
- defaultActiveView: t.oneOf(["month", "year", "decade", "century"]),
371
- defaultValue: t.oneOfType([
372
- D(t.instanceOf(Date)),
373
- t.arrayOf(t.instanceOf(Date)),
374
- t.shape({
375
- start: D(t.instanceOf(Date)),
376
- end: D(t.instanceOf(Date))
389
+ d.displayName = "MultiViewCalendar", d.propTypes = {
390
+ activeRangeEnd: s.oneOf(["start", "end"]),
391
+ allowReverse: s.bool,
392
+ bottomView: s.oneOf(["month", "year", "decade", "century"]),
393
+ className: s.string,
394
+ defaultActiveView: s.oneOf(["month", "year", "decade", "century"]),
395
+ defaultValue: s.oneOfType([
396
+ w(s.instanceOf(Date)),
397
+ s.arrayOf(s.instanceOf(Date)),
398
+ s.shape({
399
+ start: w(s.instanceOf(Date)),
400
+ end: w(s.instanceOf(Date))
377
401
  })
378
402
  ]),
379
- disabled: t.bool,
380
- focusedDate: t.instanceOf(Date),
381
- id: t.string,
382
- weekDaysFormat: t.oneOf(["narrow", "short", "abbreviated"]),
383
- ariaLabelledBy: t.string,
384
- ariaDescribedBy: t.string,
385
- max: t.instanceOf(Date),
386
- min: t.instanceOf(Date),
387
- mode: t.oneOf(["single", "multiple", "range"]),
388
- onBlur: t.func,
389
- onChange: t.func,
390
- onFocus: t.func,
391
- tabIndex: t.number,
392
- topView: t.oneOf(["month", "year", "decade", "century"]),
393
- value: t.oneOfType([
394
- D(t.instanceOf(Date)),
395
- t.arrayOf(t.instanceOf(Date)),
396
- t.shape({
397
- start: D(t.instanceOf(Date).isRequired),
398
- end: D(t.instanceOf(Date).isRequired)
403
+ disabled: s.bool,
404
+ focusedDate: s.instanceOf(Date),
405
+ id: s.string,
406
+ weekDaysFormat: s.oneOf(["narrow", "short", "abbreviated"]),
407
+ ariaLabelledBy: s.string,
408
+ ariaDescribedBy: s.string,
409
+ max: s.instanceOf(Date),
410
+ min: s.instanceOf(Date),
411
+ mode: s.oneOf(["single", "multiple", "range"]),
412
+ onBlur: s.func,
413
+ onChange: s.func,
414
+ onFocus: s.func,
415
+ tabIndex: s.number,
416
+ topView: s.oneOf(["month", "year", "decade", "century"]),
417
+ value: s.oneOfType([
418
+ w(s.instanceOf(Date)),
419
+ s.arrayOf(s.instanceOf(Date)),
420
+ s.shape({
421
+ start: w(s.instanceOf(Date).isRequired),
422
+ end: w(s.instanceOf(Date).isRequired)
399
423
  })
400
424
  ]),
401
- views: (i, a, h) => {
402
- const g = i[a];
403
- return g !== void 0 && g < 1 ? new Error(
404
- `Invalid prop '${a}' supplied to'${h}'. The '${a}' property cannot be less than 1'`
425
+ views: (i, a, c) => {
426
+ const D = i[a];
427
+ return D !== void 0 && D < 1 ? new Error(
428
+ `Invalid prop '${a}' supplied to'${c}'. The '${a}' property cannot be less than 1'`
405
429
  ) : null;
406
430
  },
407
- weekNumber: t.bool,
408
- showOtherMonthDays: t.bool,
409
- dir: t.string
410
- }, c.defaultProps = {
431
+ weekNumber: s.bool,
432
+ showOtherMonthDays: s.bool,
433
+ dir: s.string
434
+ }, d.defaultProps = {
411
435
  disabled: !1,
412
- min: se,
413
- max: ie,
436
+ min: ae,
437
+ max: ne,
414
438
  navigation: !0,
415
439
  defaultActiveView: "month",
416
440
  defaultValue: null,
@@ -422,13 +446,13 @@ c.displayName = "MultiViewCalendar", c.propTypes = {
422
446
  allowReverse: !1,
423
447
  showOtherMonthDays: !1
424
448
  };
425
- let p = c;
426
- const le = J(), he = Q(Z(le, p));
427
- he.displayName = "KendoReactMultiViewCalendar";
428
- j(p);
429
- G(p);
449
+ let v = d;
450
+ const ce = Q(), de = Z(ee(ce, v));
451
+ de.displayName = "KendoReactMultiViewCalendar";
452
+ X(v);
453
+ q(v);
430
454
  export {
431
- he as MultiViewCalendar,
432
- le as MultiViewCalendarPropsContext,
433
- p as MultiViewCalendarWithoutContext
455
+ de as MultiViewCalendar,
456
+ ce as MultiViewCalendarPropsContext,
457
+ v as MultiViewCalendarWithoutContext
434
458
  };
@@ -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 w=require("react"),s=require("prop-types"),p=require("@progress/kendo-date-math"),D=require("@progress/kendo-react-intl"),v=require("./CalendarCell.js"),g=require("./CalendarWeekCell.js"),k=require("../models/CalendarViewEnum.js"),m=require("../../utils.js"),b=require("../services/WeekNamesService.js");function y(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const r=y(w),f=o=>r.createElement("td",{key:o,className:"k-calendar-td k-empty"}," "),u=class u extends r.Component{constructor(){super(...arguments),this.intl=null,this.weekService=null,this.buildWeekNumber=(t,e)=>{if(!this.firstDate(t))return f(`week-cell-${e}`);const n=this.firstDate(t),a=this.getWeekNumber(n),l=`kendo-react-calendar-week-cell-${a}`,c={className:"k-alt",value:a,firstDate:n};return this.props.weekCell?r.createElement(this.props.weekCell,{...c,key:l},a):r.createElement(g.CalendarWeekCell,{...c,key:l},a)},this.buildRow=t=>t.map((e,i)=>{if(!e)return f(i);const n={"aria-selected":e.isSelected},a=`kendo-react-calendar-cell-${e.value.getTime()}`,l={...n,...e,isDisabled:!e.isInRange,view:this.props.activeView,showOtherMonthDays:this.props.showOtherMonthDays,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave};return this.props.cell?r.createElement(this.props.cell,{...l,key:a},e.formattedValue):r.createElement(v.CalendarCell,{...l,key:a},e.formattedValue)}),this.firstDate=t=>{const e=this.firstWeekDateContext(t);return e?e.value:null},this.firstWeekDateContext=t=>{if(!this.weekNumber)return null;let e=0,i=t[e];for(;!i&&e<t.length;)i=t[++e];return i},this.handleClick=(t,e)=>{const{onChange:i}=this.props;if(i&&e){const n={value:p.cloneDate(t),target:this,nativeEvent:e&&e.nativeEvent,syntheticEvent:e};i.call(void 0,n)}},this.handleMouseEnter=t=>{const{onCellEnter:e}=this.props;e&&e.call(void 0,p.cloneDate(t))},this.handleMouseLeave=t=>{const{onCellLeave:e}=this.props;e&&e.call(void 0,p.cloneDate(t))}}get min(){return this.props.min}get max(){return this.props.max}get isHorizontal(){return this.props.direction==="horizontal"}get isMonthView(){return this.props.activeView===k.CalendarViewEnum.month}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===k.CalendarViewEnum.month)}get selectedDate(){return this.props.selectedDate!==void 0?this.props.selectedDate:u.defaultProps.selectedDate}render(){this.intl=D.provideIntlService(this),this.weekService=new b.WeekNamesService(this.intl);const t=this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat),e=this.props.service.rowLength(this.weekNumber),i=this.props.service.title(this.props.viewDate),n=m.getToday(),a=m.setTime(this.props.viewDate,n),l=this.props.service.data({cellUID:this.props.cellUID,min:this.min,max:this.max,focusedDate:this.props.focusedDate,isActiveView:!this.props.bus.canMoveDown(this.props.activeView),selectedDate:this.selectedDate,selectionRange:this.props.selectionRange,viewDate:a});return r.createElement(r.Fragment,null,this.isMonthView&&this.isHorizontal&&r.createElement("thead",{role:"rowgroup",className:"k-calendar-thead"},r.createElement("tr",{role:"row",className:"k-calendar-tr"},t.map((c,h)=>r.createElement("th",{key:h,className:"k-calendar-th"},c)))),r.createElement("tbody",{role:"rowgroup",className:"k-calendar-tbody"},!this.isHorizontal&&r.createElement("tr",{role:"presentation",className:"k-calendar-tr"},r.createElement("th",{scope:"col",colSpan:e,className:"k-calendar-caption"},i)),l.map((c,h)=>r.createElement("tr",{role:"row",className:"k-calendar-tr",key:h},this.weekNumber&&this.buildWeekNumber(c,h),this.buildRow(c)))))}getWeekNumber(t){return!this.weekNumber||!this.intl?null:p.weekInYear(t,this.intl.firstDay())}};u.propTypes={activeRangeEnd:s.oneOf(["start","end",null]),activeView:s.number.isRequired,cellUID:s.string.isRequired,direction:s.oneOf(["horizontal","vertical"]),focusedDate:s.instanceOf(Date).isRequired,max:s.instanceOf(Date).isRequired,min:s.instanceOf(Date).isRequired,onChange:s.func,selectedDate:s.oneOfType([s.instanceOf(Date),s.arrayOf(s.instanceOf(Date))]),showWeekNumbers:s.bool,showOtherMonthDays:s.bool,viewDate:s.instanceOf(Date).isRequired},u.defaultProps={direction:"vertical",selectedDate:m.getToday(),showWeekNumbers:!1};let d=u;D.registerForIntl(d);exports.View=d;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),r=require("prop-types"),p=require("@progress/kendo-date-math"),D=require("@progress/kendo-react-intl"),v=require("./CalendarCell.js"),g=require("./CalendarWeekCell.js"),k=require("../models/CalendarViewEnum.js"),m=require("../../utils.js"),b=require("../services/WeekNamesService.js");function y(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const i=y(w),f=o=>i.createElement("td",{key:o,className:"k-calendar-td k-empty"}," "),h=class h extends i.Component{constructor(){super(...arguments),this.intl=null,this.weekService=null,this.buildWeekNumber=(t,e)=>{if(!this.firstDate(t))return f(`week-cell-${e}`);const a=this.firstDate(t),n=this.getWeekNumber(a),l=`kendo-react-calendar-week-cell-${n}`,c={className:"k-alt",value:n,firstDate:a,weekDays:t,onClick:this.handleWeekCellClick};return this.props.weekCell?i.createElement(this.props.weekCell,{...c,key:l},n):i.createElement(g.CalendarWeekCell,{...c,key:l},n)},this.buildRow=t=>t.map((e,s)=>{if(!e)return f(s);const a={"aria-selected":e.isSelected},n=`kendo-react-calendar-cell-${e.value.getTime()}`,l={...a,...e,isDisabled:!e.isInRange,view:this.props.activeView,showOtherMonthDays:this.props.showOtherMonthDays,allowReverse:this.props.allowReverse,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave};return this.props.cell?i.createElement(this.props.cell,{...l,key:n},e.formattedValue):i.createElement(v.CalendarCell,{...l,key:n},e.formattedValue)}),this.firstDate=t=>{const e=this.firstWeekDateContext(t);return e?e.value:null},this.firstWeekDateContext=t=>{if(!this.weekNumber)return null;let e=0,s=t[e];for(;!s&&e<t.length;)s=t[++e];return s},this.handleClick=(t,e)=>{const{onChange:s}=this.props;if(s&&e){const a={value:p.cloneDate(t),target:this,nativeEvent:e&&e.nativeEvent,syntheticEvent:e};s.call(void 0,a)}},this.handleWeekCellClick=(t,e,s)=>{const{onWeekSelect:a}=this.props,n=e.findIndex(l=>l&&l.value===t);a&&s&&a.call(void 0,t,n,s)},this.handleMouseEnter=t=>{const{onCellEnter:e}=this.props;e&&e.call(void 0,p.cloneDate(t))},this.handleMouseLeave=t=>{const{onCellLeave:e}=this.props;e&&e.call(void 0,p.cloneDate(t))}}get min(){return this.props.min}get max(){return this.props.max}get isHorizontal(){return this.props.direction==="horizontal"}get isMonthView(){return this.props.activeView===k.CalendarViewEnum.month}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===k.CalendarViewEnum.month)}get selectedDate(){return this.props.selectedDate!==void 0?this.props.selectedDate:h.defaultProps.selectedDate}render(){this.intl=D.provideIntlService(this),this.weekService=new b.WeekNamesService(this.intl);const t=this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat),e=this.props.service.rowLength(this.weekNumber),s=this.props.service.title(this.props.viewDate),a=m.getToday(),n=m.setTime(this.props.viewDate,a),l=this.props.service.data({cellUID:this.props.cellUID,min:this.min,max:this.max,focusedDate:this.props.focusedDate,isActiveView:!this.props.bus.canMoveDown(this.props.activeView),selectedDate:this.selectedDate,selectionRange:this.props.selectionRange,viewDate:n});return i.createElement(i.Fragment,null,this.isMonthView&&this.isHorizontal&&i.createElement("thead",{role:"rowgroup",className:"k-calendar-thead"},i.createElement("tr",{role:"row",className:"k-calendar-tr"},t.map((c,u)=>i.createElement("th",{key:u,className:"k-calendar-th"},c)))),i.createElement("tbody",{role:"rowgroup",className:"k-calendar-tbody"},!this.isHorizontal&&i.createElement("tr",{role:"presentation",className:"k-calendar-tr"},i.createElement("th",{scope:"col",colSpan:e,className:"k-calendar-caption"},s)),l.map((c,u)=>i.createElement("tr",{role:"row",className:"k-calendar-tr",key:u},this.weekNumber&&this.buildWeekNumber(c,u),this.buildRow(c)))))}getWeekNumber(t){return!this.weekNumber||!this.intl?null:p.weekInYear(t,this.intl.firstDay())}};h.propTypes={activeRangeEnd:r.oneOf(["start","end",null]),activeView:r.number.isRequired,cellUID:r.string.isRequired,direction:r.oneOf(["horizontal","vertical"]),focusedDate:r.instanceOf(Date).isRequired,max:r.instanceOf(Date).isRequired,min:r.instanceOf(Date).isRequired,onChange:r.func,selectedDate:r.oneOfType([r.instanceOf(Date),r.arrayOf(r.instanceOf(Date))]),showWeekNumbers:r.bool,showOtherMonthDays:r.bool,viewDate:r.instanceOf(Date).isRequired},h.defaultProps={direction:"vertical",selectedDate:m.getToday(),showWeekNumbers:!1};let d=h;D.registerForIntl(d);exports.View=d;