@progress/kendo-react-dateinputs 7.5.0-develop.1 → 7.5.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/calendar/components/Calendar.js +2 -2
- package/calendar/components/Calendar.mjs +35 -32
- package/calendar/components/HorizontalViewList.js +1 -1
- package/calendar/components/HorizontalViewList.mjs +2 -0
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +93 -90
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +5 -5
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +42 -42
- package/calendar/services/WeekNamesService.js +1 -1
- package/calendar/services/WeekNamesService.mjs +5 -5
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +33 -6
- package/index.d.ts +33 -6
- package/package-metadata.mjs +1 -1
- package/package.json +7 -7
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as d from "react";
|
|
10
|
-
import
|
|
10
|
+
import t from "prop-types";
|
|
11
11
|
import { provideIntlService as q, provideLocalizationService as H, registerForIntl as j, registerForLocalization as G } from "@progress/kendo-react-intl";
|
|
12
|
-
import { Keys as
|
|
12
|
+
import { Keys as k, classNames as X, createPropsContext as J, withIdHOC as Q, withPropsContext as Z } from "@progress/kendo-react-common";
|
|
13
13
|
import { isEqualDate as O, cloneDate as u, getDate as f, firstDayOfMonth as W, lastDayOfMonth as ee } from "@progress/kendo-date-math";
|
|
14
14
|
import { Button as T } from "@progress/kendo-react-buttons";
|
|
15
15
|
import { chevronRightIcon as M, chevronLeftIcon as N } from "@progress/kendo-svg-icons";
|
|
16
16
|
import { Action as y } from "../models/NavigationAction.mjs";
|
|
17
|
-
import { CalendarViewEnum as
|
|
17
|
+
import { CalendarViewEnum as E } from "../models/CalendarViewEnum.mjs";
|
|
18
18
|
import { EMPTY_SELECTIONRANGE as Y } from "../models/SelectionRange.mjs";
|
|
19
19
|
import { Header as te } from "./Header.mjs";
|
|
20
20
|
import { dateInRange as R, getToday as C, viewInRange as P, nullable as D, MIN_DATE as se, MAX_DATE as ie, isInRange as A } from "../../utils.mjs";
|
|
@@ -22,29 +22,29 @@ import { prevView as S, messages as B, nextView as L } from "../../messages/inde
|
|
|
22
22
|
import { BusViewService as ae } from "../services/BusViewService.mjs";
|
|
23
23
|
import { NavigationService as ne } from "../services/NavigationService.mjs";
|
|
24
24
|
import { HorizontalViewList as x } from "./HorizontalViewList.mjs";
|
|
25
|
-
import { TodayCommand as
|
|
26
|
-
const
|
|
25
|
+
import { TodayCommand as re } from "./TodayCommand.mjs";
|
|
26
|
+
const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Date && !Array.isArray(a) && A(f(a), o, i) ? f(a) : null, _ = (o = m.defaultProps.min, i = m.defaultProps.max, a) => Array.isArray(a) ? a.filter((h) => A(h, o, i)).map((h) => f(h)) : null, K = (o) => typeof o == "object" && !(o instanceof Date) && o !== null && !Array.isArray(o) ? o : Y, z = (o, i, a) => o || i && i[0] || a && a.start, le = (o, i) => o.start === null && i === null ? "start" : o.end === null ? "end" : "start", c = class c extends d.Component {
|
|
27
27
|
constructor(i) {
|
|
28
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 = () => {
|
|
29
29
|
this._element && this._element.focus();
|
|
30
|
-
}, this.clampRange = (e) => ({ start: e, end: null }), this.rangeWithFocused = (e,
|
|
30
|
+
}, this.clampRange = (e) => ({ start: e, end: null }), this.rangeWithFocused = (e, s) => ({
|
|
31
31
|
start: e.start,
|
|
32
|
-
end: e.end === null && e.start !== null && this.isActive ?
|
|
33
|
-
}), this.generateRange = (e,
|
|
34
|
-
const { end:
|
|
35
|
-
return !this.props.allowReverse &&
|
|
32
|
+
end: e.end === null && e.start !== null && this.isActive ? s : e.end
|
|
33
|
+
}), this.generateRange = (e, s) => {
|
|
34
|
+
const { end: l, start: r } = s, p = s.start !== null && e.getTime() <= s.start.getTime();
|
|
35
|
+
return !this.props.allowReverse && p ? { start: e, end: this.selectedRange.start } : this.activeRange !== "end" ? { start: e, end: l } : { start: r || this.selectedDate, end: e };
|
|
36
36
|
}, this.canNavigate = (e) => {
|
|
37
37
|
if (!this.service)
|
|
38
38
|
return !1;
|
|
39
|
-
const
|
|
40
|
-
return this.min <=
|
|
41
|
-
}, this.navigate = (e,
|
|
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) => {
|
|
42
42
|
this.calculateFocusFromValue = !1;
|
|
43
|
-
const
|
|
44
|
-
this.setState({ navigateDate:
|
|
45
|
-
}, this.move = (e,
|
|
46
|
-
const { end:
|
|
47
|
-
return this.activeRange !== "end" ?
|
|
43
|
+
const l = this.move(e, s);
|
|
44
|
+
this.setState({ navigateDate: l, focusedDate: l });
|
|
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: l, start: r } = s;
|
|
47
|
+
return this.activeRange !== "end" ? l !== null && e > l : r !== null && e < r;
|
|
48
48
|
}, this.handleCellEnter = (e) => {
|
|
49
49
|
this.props.mode === "range" && (this.calculateFocusFromValue = !1, this.setState({
|
|
50
50
|
focusedDate: e
|
|
@@ -57,14 +57,14 @@ const k = (o = 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:
|
|
61
|
-
|
|
60
|
+
const { onFocus: s } = this.props;
|
|
61
|
+
s && s.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:
|
|
67
|
-
|
|
66
|
+
const { onBlur: s } = this.props;
|
|
67
|
+
s && s.call(void 0, e);
|
|
68
68
|
}, this.handleTodayClick = (e) => {
|
|
69
69
|
this.todayIsInRange && this.handleDateChange(e);
|
|
70
70
|
}, this.handlePrevButtonClick = () => {
|
|
@@ -72,18 +72,18 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
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
|
|
76
|
-
this.navigate(e,
|
|
75
|
+
const s = this.isInMonth(this.focusedDate, this.dates[1]) ? this.move(e, this.focusedDate) : this.focusedDate;
|
|
76
|
+
this.navigate(e, s);
|
|
77
77
|
}
|
|
78
78
|
}, this.handleNextButtonClick = () => {
|
|
79
79
|
this.navigate(y.NextView, this.focusedDate);
|
|
80
80
|
}, this.handleKeyDown = (e) => {
|
|
81
|
-
const { keyCode:
|
|
82
|
-
if (
|
|
81
|
+
const { keyCode: l, ctrlKey: r, metaKey: p } = e;
|
|
82
|
+
if (l === 84) {
|
|
83
83
|
const n = C();
|
|
84
84
|
this.calculateFocusFromValue = !1, this.setState({ focusedDate: n, navigateDate: n });
|
|
85
85
|
}
|
|
86
|
-
if ((
|
|
86
|
+
if ((r || p) && (l === k.left && this.handlePrevButtonClick(), l === k.right && this.handleNextButtonClick()), l === k.enter) {
|
|
87
87
|
const n = {
|
|
88
88
|
syntheticEvent: e,
|
|
89
89
|
nativeEvent: e.nativeEvent,
|
|
@@ -109,23 +109,23 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
109
109
|
}
|
|
110
110
|
e.preventDefault();
|
|
111
111
|
}, this.handleViewChange = ({ view: e }) => {
|
|
112
|
-
this.calculateFocusFromValue = !1, this.setState((
|
|
112
|
+
this.calculateFocusFromValue = !1, this.setState((s) => ({ activeView: e, navigateDate: s.focusedDate }));
|
|
113
113
|
}, this.handleDateChange = (e) => {
|
|
114
|
-
const
|
|
114
|
+
const s = u(e.value), l = this.bus.canMoveDown(this.state.activeView);
|
|
115
115
|
if (this.props.disabled)
|
|
116
116
|
return;
|
|
117
|
-
if (
|
|
117
|
+
if (l)
|
|
118
118
|
if (e.isTodayClick)
|
|
119
119
|
this.bus.moveToBottom(this.state.activeView);
|
|
120
120
|
else {
|
|
121
|
-
this.bus.moveDown(this.state.activeView, e.syntheticEvent), this.setState({ focusedDate:
|
|
121
|
+
this.bus.moveDown(this.state.activeView, e.syntheticEvent), this.setState({ focusedDate: s, navigateDate: s });
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
this.calculateFocusFromValue = !0;
|
|
125
|
-
let
|
|
125
|
+
let r;
|
|
126
126
|
switch (this.props.mode) {
|
|
127
127
|
case "single":
|
|
128
|
-
|
|
128
|
+
r = u(e.value);
|
|
129
129
|
break;
|
|
130
130
|
case "multiple":
|
|
131
131
|
if (Array.isArray(this.selectedMultiple)) {
|
|
@@ -133,33 +133,33 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
133
133
|
let v = -1;
|
|
134
134
|
n.forEach((U, $) => {
|
|
135
135
|
O(U, e.value) && (v = $);
|
|
136
|
-
}), v !== -1 ? n.splice(v, 1) : n.push(u(e.value)),
|
|
136
|
+
}), v !== -1 ? n.splice(v, 1) : n.push(u(e.value)), r = n.slice();
|
|
137
137
|
} else
|
|
138
|
-
this.selectedDate ?
|
|
138
|
+
this.selectedDate ? r = [u(this.selectedDate), u(e.value)] : r = [u(e.value)];
|
|
139
139
|
break;
|
|
140
140
|
case "range": {
|
|
141
|
-
|
|
141
|
+
r = 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
142
|
break;
|
|
143
143
|
}
|
|
144
144
|
default:
|
|
145
|
-
|
|
145
|
+
r = u(e.value);
|
|
146
146
|
break;
|
|
147
147
|
}
|
|
148
|
-
this.valueDuringOnChange =
|
|
149
|
-
const { onChange:
|
|
150
|
-
if (
|
|
148
|
+
this.valueDuringOnChange = r, e.isTodayClick && this.setState({ navigateDate: s }), this.setState({ value: r, focusedDate: s }), this.valueDuringOnChange = r;
|
|
149
|
+
const { onChange: p } = this.props;
|
|
150
|
+
if (p) {
|
|
151
151
|
const n = {
|
|
152
152
|
syntheticEvent: e.syntheticEvent,
|
|
153
153
|
nativeEvent: e.nativeEvent,
|
|
154
|
-
value:
|
|
154
|
+
value: r,
|
|
155
155
|
target: this
|
|
156
156
|
};
|
|
157
|
-
|
|
157
|
+
p.call(void 0, n);
|
|
158
158
|
}
|
|
159
159
|
this.valueDuringOnChange = void 0;
|
|
160
160
|
};
|
|
161
|
-
const a = i.value !== void 0 ? i.value : i.defaultValue || c.defaultProps.defaultValue, h =
|
|
162
|
-
|
|
161
|
+
const a = i.value !== void 0 ? i.value : i.defaultValue || c.defaultProps.defaultValue, h = I(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],
|
|
163
163
|
this.bottomView,
|
|
164
164
|
this.topView
|
|
165
165
|
), V = R(
|
|
@@ -172,7 +172,7 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
172
172
|
activeView: w,
|
|
173
173
|
focusedDate: V,
|
|
174
174
|
navigateDate: V
|
|
175
|
-
}, this.activeRangeEnd =
|
|
175
|
+
}, this.activeRangeEnd = le(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;
|
|
176
176
|
}
|
|
177
177
|
get wrapperID() {
|
|
178
178
|
return this.props.id + "-wrapper-id";
|
|
@@ -205,10 +205,10 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
205
205
|
return f(this.props.max !== void 0 ? this.props.max : c.defaultProps.max);
|
|
206
206
|
}
|
|
207
207
|
get bottomView() {
|
|
208
|
-
return
|
|
208
|
+
return E[this.props.bottomView !== void 0 ? this.props.bottomView : c.defaultProps.bottomView];
|
|
209
209
|
}
|
|
210
210
|
get topView() {
|
|
211
|
-
return
|
|
211
|
+
return E[this.props.topView !== void 0 ? this.props.topView : c.defaultProps.topView];
|
|
212
212
|
}
|
|
213
213
|
get activeRange() {
|
|
214
214
|
return this.props.activeRangeEnd !== void 0 ? this.props.activeRangeEnd : this.activeRangeEnd;
|
|
@@ -227,7 +227,7 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
227
227
|
*/
|
|
228
228
|
componentDidUpdate() {
|
|
229
229
|
this.calendarViewList && (this.isActive ? this.calendarViewList.focusActiveDate : this.calendarViewList.blurActiveDate)();
|
|
230
|
-
const i =
|
|
230
|
+
const i = I(this.min, this.max, this.value);
|
|
231
231
|
this.calculateFocusFromValue = !!(this.selectedDate && i && this.selectedDate.getTime() && i.getTime()), this.lastView = this.state.activeView, this.lastViewsCount = this.props.views || x.defaultProps.views;
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
@@ -236,7 +236,7 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
236
236
|
render() {
|
|
237
237
|
this.props._ref && this.props._ref(this), this.intl = q(this), this.localization = H(this), this.bus.configure(this.bottomView, this.topView);
|
|
238
238
|
const i = P(this.state.activeView, this.bottomView, this.topView);
|
|
239
|
-
this.service = this.bus.service(i, this.intl), this.selectedDate =
|
|
239
|
+
this.service = this.bus.service(i, this.intl), this.selectedDate = I(this.min, this.max, this.value), this.selectedMultiple = _(this.min, this.max, this.value), this.selectedRange = K(this.value);
|
|
240
240
|
const a = z(this.selectedDate, this.selectedMultiple, this.selectedRange);
|
|
241
241
|
this._focusedDate = R(
|
|
242
242
|
this.calculateFocusFromValue && a !== null ? a : this.state.focusedDate,
|
|
@@ -249,8 +249,8 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
249
249
|
"k-disabled": this.props.disabled
|
|
250
250
|
},
|
|
251
251
|
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 },
|
|
253
|
-
(!
|
|
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 }, l = this.lastView !== i, r = this.dates && this.isInMonth(this.state.navigateDate, this.dates[0]), p = this.lastViewsCount !== this.props.views;
|
|
253
|
+
(!r || l || p) && (this.dates = this.service.datesList(
|
|
254
254
|
this.state.navigateDate,
|
|
255
255
|
this.props.views || x.defaultProps.views
|
|
256
256
|
));
|
|
@@ -301,7 +301,7 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
301
301
|
...e
|
|
302
302
|
}
|
|
303
303
|
), /* @__PURE__ */ d.createElement(
|
|
304
|
-
|
|
304
|
+
re,
|
|
305
305
|
{
|
|
306
306
|
min: this.min,
|
|
307
307
|
max: this.max,
|
|
@@ -319,7 +319,7 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
319
319
|
title: F,
|
|
320
320
|
disabled: V,
|
|
321
321
|
onClick: this.handleNextButtonClick,
|
|
322
|
-
...
|
|
322
|
+
...s
|
|
323
323
|
}
|
|
324
324
|
))
|
|
325
325
|
}
|
|
@@ -333,6 +333,7 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
333
333
|
dates: this.dates,
|
|
334
334
|
activeView: i,
|
|
335
335
|
focusedDate: this.focusedDate,
|
|
336
|
+
weekDaysFormat: this.props.weekDaysFormat,
|
|
336
337
|
min: this.min,
|
|
337
338
|
max: this.max,
|
|
338
339
|
bus: this.bus,
|
|
@@ -361,38 +362,39 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
361
362
|
}
|
|
362
363
|
};
|
|
363
364
|
c.displayName = "MultiViewCalendar", c.propTypes = {
|
|
364
|
-
activeRangeEnd:
|
|
365
|
-
allowReverse:
|
|
366
|
-
bottomView:
|
|
367
|
-
className:
|
|
368
|
-
defaultActiveView:
|
|
369
|
-
defaultValue:
|
|
370
|
-
D(
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
start: D(
|
|
374
|
-
end: D(
|
|
365
|
+
activeRangeEnd: t.oneOf(["start", "end"]),
|
|
366
|
+
allowReverse: t.bool,
|
|
367
|
+
bottomView: t.oneOf(["month", "year", "decade", "century"]),
|
|
368
|
+
className: t.string,
|
|
369
|
+
defaultActiveView: t.oneOf(["month", "year", "decade", "century"]),
|
|
370
|
+
defaultValue: t.oneOfType([
|
|
371
|
+
D(t.instanceOf(Date)),
|
|
372
|
+
t.arrayOf(t.instanceOf(Date)),
|
|
373
|
+
t.shape({
|
|
374
|
+
start: D(t.instanceOf(Date)),
|
|
375
|
+
end: D(t.instanceOf(Date))
|
|
375
376
|
})
|
|
376
377
|
]),
|
|
377
|
-
disabled:
|
|
378
|
-
focusedDate:
|
|
379
|
-
id:
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
378
|
+
disabled: t.bool,
|
|
379
|
+
focusedDate: t.instanceOf(Date),
|
|
380
|
+
id: t.string,
|
|
381
|
+
weekDaysFormat: t.oneOf(["narrow", "short", "abbreviated"]),
|
|
382
|
+
ariaLabelledBy: t.string,
|
|
383
|
+
ariaDescribedBy: t.string,
|
|
384
|
+
max: t.instanceOf(Date),
|
|
385
|
+
min: t.instanceOf(Date),
|
|
386
|
+
mode: t.oneOf(["single", "multiple", "range"]),
|
|
387
|
+
onBlur: t.func,
|
|
388
|
+
onChange: t.func,
|
|
389
|
+
onFocus: t.func,
|
|
390
|
+
tabIndex: t.number,
|
|
391
|
+
topView: t.oneOf(["month", "year", "decade", "century"]),
|
|
392
|
+
value: t.oneOfType([
|
|
393
|
+
D(t.instanceOf(Date)),
|
|
394
|
+
t.arrayOf(t.instanceOf(Date)),
|
|
395
|
+
t.shape({
|
|
396
|
+
start: D(t.instanceOf(Date).isRequired),
|
|
397
|
+
end: D(t.instanceOf(Date).isRequired)
|
|
396
398
|
})
|
|
397
399
|
]),
|
|
398
400
|
views: (i, a, h) => {
|
|
@@ -401,8 +403,8 @@ c.displayName = "MultiViewCalendar", c.propTypes = {
|
|
|
401
403
|
`Invalid prop '${a}' supplied to'${h}'. The '${a}' property cannot be less than 1'`
|
|
402
404
|
) : null;
|
|
403
405
|
},
|
|
404
|
-
weekNumber:
|
|
405
|
-
dir:
|
|
406
|
+
weekNumber: t.bool,
|
|
407
|
+
dir: t.string
|
|
406
408
|
}, c.defaultProps = {
|
|
407
409
|
disabled: !1,
|
|
408
410
|
min: se,
|
|
@@ -411,18 +413,19 @@ c.displayName = "MultiViewCalendar", c.propTypes = {
|
|
|
411
413
|
defaultActiveView: "month",
|
|
412
414
|
defaultValue: null,
|
|
413
415
|
topView: "century",
|
|
416
|
+
weekDaysFormat: "short",
|
|
414
417
|
tabIndex: 0,
|
|
415
418
|
bottomView: "month",
|
|
416
419
|
views: 2,
|
|
417
420
|
allowReverse: !1
|
|
418
421
|
};
|
|
419
|
-
let
|
|
420
|
-
const oe = J(), he = Q(Z(oe,
|
|
422
|
+
let m = c;
|
|
423
|
+
const oe = J(), he = Q(Z(oe, m));
|
|
421
424
|
he.displayName = "KendoReactMultiViewCalendar";
|
|
422
|
-
j(
|
|
423
|
-
G(
|
|
425
|
+
j(m);
|
|
426
|
+
G(m);
|
|
424
427
|
export {
|
|
425
428
|
he as MultiViewCalendar,
|
|
426
429
|
oe as MultiViewCalendarPropsContext,
|
|
427
|
-
|
|
430
|
+
m as MultiViewCalendarWithoutContext
|
|
428
431
|
};
|
|
@@ -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 v=require("react"),i=require("prop-types"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react"),i=require("prop-types"),p=require("@progress/kendo-date-math"),D=require("@progress/kendo-react-intl"),w=require("./CalendarCell.js"),g=require("./CalendarWeekCell.js"),k=require("../models/CalendarViewEnum.js"),m=require("../../utils.js"),b=require("../services/WeekNamesService.js");function y(l){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const e in l)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(l,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>l[e]})}}return t.default=l,Object.freeze(t)}const s=y(v),f=l=>s.createElement("td",{key:l,className:"k-calendar-td k-empty"}," "),u=class u extends s.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),o=`kendo-react-calendar-week-cell-${a}`,c={className:"k-alt",value:a,firstDate:n};return this.props.weekCell?s.createElement(this.props.weekCell,{...c,key:o},a):s.createElement(g.CalendarWeekCell,{...c,key:o},a)},this.buildRow=t=>t.map((e,r)=>{if(!e)return f(r);const n={"aria-selected":e.isSelected},a=`kendo-react-calendar-cell-${e.value.getTime()}`,o={...n,...e,isDisabled:!e.isInRange,view:this.props.activeView,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave};return this.props.cell?s.createElement(this.props.cell,{...o,key:a},e.formattedValue):s.createElement(w.CalendarCell,{...o,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,r=t[e];for(;!r&&e<t.length;)r=t[++e];return r},this.handleClick=(t,e)=>{const{onChange:r}=this.props;if(r&&e){const n={value:p.cloneDate(t),target:this,nativeEvent:e&&e.nativeEvent,syntheticEvent:e};r.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),r=this.props.service.title(this.props.viewDate),n=m.getToday(),a=m.setTime(this.props.viewDate,n),o=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 s.createElement(s.Fragment,null,this.isMonthView&&this.isHorizontal&&s.createElement("thead",{role:"rowgroup",className:"k-calendar-thead"},s.createElement("tr",{role:"row",className:"k-calendar-tr"},t.map((c,h)=>s.createElement("th",{key:h,className:"k-calendar-th"},c)))),s.createElement("tbody",{role:"rowgroup",className:"k-calendar-tbody"},!this.isHorizontal&&s.createElement("tr",{role:"presentation",className:"k-calendar-tr"},s.createElement("th",{scope:"col",colSpan:e,className:"k-calendar-caption"},r)),o.map((c,h)=>s.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:i.oneOf(["start","end",null]),activeView:i.number.isRequired,cellUID:i.string.isRequired,direction:i.oneOf(["horizontal","vertical"]),focusedDate:i.instanceOf(Date).isRequired,max:i.instanceOf(Date).isRequired,min:i.instanceOf(Date).isRequired,onChange:i.func,selectedDate:i.oneOfType([i.instanceOf(Date),i.arrayOf(i.instanceOf(Date))]),showWeekNumbers:i.bool,viewDate:i.instanceOf(Date).isRequired},u.defaultProps={direction:"vertical",selectedDate:m.getToday(),showWeekNumbers:!1};let d=u;D.registerForIntl(d);exports.View=d;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as s from "react";
|
|
10
10
|
import r from "prop-types";
|
|
11
|
-
import { cloneDate as p, weekInYear as
|
|
12
|
-
import { provideIntlService as
|
|
11
|
+
import { cloneDate as p, weekInYear as D } from "@progress/kendo-date-math";
|
|
12
|
+
import { provideIntlService as v, registerForIntl as w } from "@progress/kendo-react-intl";
|
|
13
13
|
import { CalendarCell as g } from "./CalendarCell.mjs";
|
|
14
14
|
import { CalendarWeekCell as N } from "./CalendarWeekCell.mjs";
|
|
15
15
|
import { CalendarViewEnum as u } from "../models/CalendarViewEnum.mjs";
|
|
@@ -87,8 +87,8 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
|
|
|
87
87
|
return this.props.selectedDate !== void 0 ? this.props.selectedDate : c.defaultProps.selectedDate;
|
|
88
88
|
}
|
|
89
89
|
render() {
|
|
90
|
-
this.intl =
|
|
91
|
-
const t = this.weekService.getWeekNames(this.weekNumber), e = this.props.service.rowLength(this.weekNumber), i = this.props.service.title(this.props.viewDate), n = d(), a = b(this.props.viewDate, n), o = this.props.service.data({
|
|
90
|
+
this.intl = v(this), this.weekService = new E(this.intl);
|
|
91
|
+
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 = d(), a = b(this.props.viewDate, n), o = this.props.service.data({
|
|
92
92
|
cellUID: this.props.cellUID,
|
|
93
93
|
min: this.min,
|
|
94
94
|
max: this.max,
|
|
@@ -124,7 +124,7 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
|
|
|
124
124
|
));
|
|
125
125
|
}
|
|
126
126
|
getWeekNumber(t) {
|
|
127
|
-
return !this.weekNumber || !this.intl ? null :
|
|
127
|
+
return !this.weekNumber || !this.intl ? null : D(t, this.intl.firstDay());
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
c.propTypes = {
|
|
@@ -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 V=require("react"),r=require("prop-types"),y=require("@progress/kendo-react-common"),d=require("@progress/kendo-date-math"),f=require("@progress/kendo-react-intl"),x=require("../../virtualization/Virtualization.js"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),r=require("prop-types"),y=require("@progress/kendo-react-common"),d=require("@progress/kendo-date-math"),f=require("@progress/kendo-react-intl"),x=require("../../virtualization/Virtualization.js"),S=require("./View.js"),C=require("./Header.js"),E=require("../services/WeekNamesService.js"),c=require("../../utils.js"),l=require("../models/CalendarViewEnum.js"),I=require("./TodayCommand.js");function T(h){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const e in h)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(h,e);Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:()=>h[e]})}}return o.default=h,Object.freeze(o)}const s=T(V),N=5,p=class p extends s.Component{constructor(o){super(o),this.virtualization=null,this.calendarView=null,this.table=null,this.intl=null,this.bottomOffset=0,this.viewOffset=0,this.viewHeight=0,this._element=null,this.isActive=!1,this.animateToIndex=!0,this.shouldScroll=!1,this.weekService=null,this.focusActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus"),t=this._element.querySelector(".k-state-pending-focus");e&&e[0]&&e[0].classList.remove("k-focus"),t&&t.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus");e&&e.classList.remove("k-focus"),this.isActive=!1},this.handleVirtualizationMount=e=>{if(this.virtualization=e,this.virtualization&&this.table){this.table.style.transform=`translateY(${this.viewOffset}px)`;const t=c.dateInRange(this.props.focusedDate,this.props.min,this.props.max),i=this.props.service.skip(t,this.props.min);this.virtualization.scrollToIndex(i)}},this.buildMonthView=(e,t)=>s.createElement("table",{key:"calendar-view-list-weekdays",className:"k-calendar-table k-calendar-weekdays",role:"grid",tabIndex:this.props.tabIndex},s.createElement("colgroup",null,e.map((i,a)=>s.createElement("col",{key:a}))),s.createElement("thead",{className:"k-calendar-thead"},s.createElement("tr",{className:"k-calendar-tr"},t.map((i,a)=>s.createElement("th",{key:a,className:"k-calendar-th"},i))))),this.buildDates=(e,t)=>{const i=this.props.cellUID;return s.createElement("table",{className:"k-calendar-table",ref:a=>this.table=a,role:"grid",tabIndex:this.props.tabIndex,"aria-activedescendant":i+this.props.focusedDate.getTime()},s.createElement("colgroup",null,e.map((a,n)=>s.createElement("col",{key:n}))),t.map(a=>s.createElement(S.View,{ref:n=>{this.calendarView||(this.calendarView=n)},key:a.getTime(),activeView:this.props.activeView,viewDate:a,min:this.props.min,max:this.props.max,cellUID:i,focusedDate:this.props.focusedDate,cell:this.props.cell,selectedDate:this.props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,bus:this.props.bus,service:this.props.service,weekCell:this.props.weekCell})))},this.calculateHeights=()=>{if(!this.props.dom)return;const e=this.props.activeView===l.CalendarViewEnum.month?this.props.dom.scrollableContentHeight:this.props.dom.scrollableYearContentHeight;this.bottomOffset=e-this.props.dom.viewHeight(this.props.activeView),this.viewOffset=-1*this.props.dom.headerHeight,this.viewHeight=this.props.dom.viewHeight(this.props.activeView)||1},this.getTake=(e,t)=>Math.min(t-e,this.take),this.handleScrollAction=({index:e,scrollAction:t,pageAction:i})=>{const a=i?i.skip:this.state.skip;if((this.state.index!==e||this.state.skip!==a)&&this.setState({index:e,skip:a}),this.table&&t){const n=`translateY(${t.offset}px)`;this.table.style.transform=n}},this.handleTodayClick=e=>{this.shouldScroll=!0,this.handleDateChange.call(void 0,e,!0)},this.handleDateChange=(e,t=!1)=>{const{onChange:i}=this.props;if(i){const a={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:d.cloneDate(e.value),target:this,isTodayClick:t};i.call(void 0,a)}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.state={skip:this.props.service.skip(this.props.focusedDate,this.props.min),index:this.props.service.skip(this.props.focusedDate,this.props.min)}}get element(){return this._element}get weekNames(){this.intl=f.provideIntlService(this),this.weekService=new E.WeekNamesService(this.intl);const o=this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat),e=c.shiftWeekNames(o,this.intl.firstDay());return this.weekNumber?[""].concat(e):e}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===l.CalendarViewEnum.month)}get take(){return this.props.take!==void 0?this.props.take:p.defaultProps.take}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get todayIsInRange(){return c.isInRange(c.getToday(),d.getDate(this.props.min),d.getDate(this.props.max))}componentDidUpdate(o,e){this.shouldScroll=!1,this.indexToScroll!==void 0&&this.virtualization&&this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](this.indexToScroll),this.isActive&&this.focusActiveDate(),this.lastView=this.props.activeView,this.indexToScroll=void 0}render(){this.calculateHeights();const o=this.lastView!==this.props.activeView,e=c.dateInRange(this.props.focusedDate,this.props.min,this.props.max),t=o?this.props.service.skip(e,this.props.min):this.state.skip,i=this.props.service.total(this.props.min,this.props.max),a=this.getTake(t,i),n=this.props.service.addToDate(this.props.min,t),w=this.props.service.addToDate(this.props.min,this.state.index),m=new Array(this.props.service.rowLength(this.weekNumber)).fill(""),v=this.props.activeView!==this.lastView;this.animateToIndex=!v,(v||!d.isEqualDate(this.lastFocus,e)||this.shouldScroll||!this.props.shouldScroll||this.props.shouldScroll())&&(this.indexToScroll=this.props.service.skip(e,this.props.min)),this.lastFocus=e;const k=y.classNames("k-calendar-view k-vstack",{"k-calendar-monthview":this.props.activeView===l.CalendarViewEnum.month,"k-calendar-yearview":this.props.activeView===l.CalendarViewEnum.year,"k-calendar-decadeview":this.props.activeView===l.CalendarViewEnum.decade,"k-calendar-centuryview":this.props.activeView===l.CalendarViewEnum.century}),b=this.buildDates(m,this.props.service.datesList(n,a)),g=s.createElement(s.Fragment,null,s.createElement(C.Header,{key:"calendar-view-list-header",currentDate:w,min:this.props.min,max:this.props.max,activeView:this.props.activeView,bus:this.props.bus,service:this.props.service,headerTitle:this.props.headerTitle,commands:s.createElement(s.Fragment,null,s.createElement(I.TodayCommand,{min:this.props.min,max:this.props.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange,tabIndex:this.props.tabIndex}))}),this.props.activeView===l.CalendarViewEnum.month&&this.buildMonthView(m,this.weekNames),s.createElement(x.Virtualization,{key:"calendar-view-list-content",skip:t,take:this.take,total:i,itemHeight:this.viewHeight,topOffset:this.viewOffset,bottomOffset:this.bottomOffset,scrollOffsetSize:this.viewOffset,maxScrollDifference:this.viewHeight,onScroll:this.props.onScroll,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,children:b,tabIndex:this.props.tabIndex}));return s.createElement("div",{ref:D=>{this._element=D},className:k},this.props.dom.didCalculate?g:null)}};p.propTypes={activeView:r.number.isRequired,bottomOffset:r.number,cellUID:r.string.isRequired,focusedDate:r.instanceOf(Date).isRequired,max:r.instanceOf(Date).isRequired,min:r.instanceOf(Date).isRequired,onChange:r.func,showWeekNumbers:r.bool,smoothScroll:r.bool,take:r.number,value:r.instanceOf(Date),viewHeight:r.number,viewOffset:r.number,weekDaysFormat:r.oneOf(["short","abbreviated","narrow"]),tabIndex:r.number},p.defaultProps={take:N,showWeekNumbers:!1,weekDaysFormat:"short",smoothScroll:!0};let u=p;f.registerForIntl(u);exports.ViewList=u;
|