@progress/kendo-react-dateinputs 14.4.1-develop.9 → 14.5.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calendar/components/Calendar.d.ts +35 -110
- package/calendar/components/Calendar.js +5 -5
- package/calendar/components/Calendar.mjs +288 -313
- package/calendar/components/CalendarCell.d.ts +1 -10
- package/calendar/components/CalendarCell.js +1 -1
- package/calendar/components/CalendarCell.mjs +68 -78
- package/calendar/components/Header.d.ts +11 -24
- package/calendar/components/Header.js +1 -1
- package/calendar/components/Header.mjs +41 -55
- package/calendar/components/HorizontalViewList.d.ts +29 -27
- package/calendar/components/HorizontalViewList.js +1 -1
- package/calendar/components/HorizontalViewList.mjs +112 -102
- package/calendar/components/MultiViewCalendar.d.ts +39 -141
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +331 -373
- package/calendar/components/Navigation.d.ts +19 -39
- package/calendar/components/Navigation.js +1 -1
- package/calendar/components/Navigation.mjs +95 -107
- package/calendar/components/TodayCommand.d.ts +8 -25
- package/calendar/components/TodayCommand.js +1 -1
- package/calendar/components/TodayCommand.mjs +44 -61
- package/calendar/components/View.d.ts +12 -43
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +111 -137
- package/calendar/components/ViewList.d.ts +27 -67
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +207 -225
- package/calendar/models/CalendarSettings.d.ts +2 -2
- package/calendar/models/MultiViewCalendarSettings.d.ts +4 -4
- package/calendar/models/ViewService.d.ts +1 -1
- package/calendar/models/index.d.ts +7 -7
- package/calendar/services/BusViewService.d.ts +1 -1
- package/calendar/services/DecadeViewService.d.ts +2 -2
- package/calendar/services/MonthViewService.d.ts +2 -2
- package/calendar/services/NavigationService.d.ts +1 -1
- package/calendar/services/ScrollSyncService.d.ts +4 -4
- package/calendar/services/WeekNamesService.d.ts +1 -1
- package/calendar/services/YearViewService.d.ts +2 -2
- package/dateinput/DateInput.d.ts +1 -1
- package/dateinput/models/DateInputSettings.d.ts +2 -2
- package/dateinput/models/dateinput-options.d.ts +2 -2
- package/dateinput/models/index.d.ts +7 -7
- package/dateinput/models/kendo-date.d.ts +1 -1
- package/datepicker/models/DatePickerSettings.d.ts +2 -2
- package/datepicker/models/index.d.ts +1 -1
- package/daterangepicker/models/DateRangePickerCalendarSettings.d.ts +1 -1
- package/daterangepicker/models/DateRangePickerDateInputSettings.d.ts +1 -1
- package/daterangepicker/models/DateRangePickerSettings.d.ts +3 -3
- package/daterangepicker/models/index.d.ts +4 -4
- package/datetimepicker/DateTimePicker.d.ts +1 -1
- package/datetimepicker/models/DateTimePickerSettings.d.ts +1 -1
- package/datetimepicker/models/index.d.ts +1 -1
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/timepicker/TimePart.d.ts +1 -1
- package/timepicker/TimePicker.d.ts +1 -1
- package/timepicker/TimeSelector.d.ts +1 -1
- package/timepicker/models/ListService.d.ts +2 -2
- package/timepicker/models/TimePickerSettings.d.ts +3 -3
- package/timepicker/models/index.d.ts +5 -5
- package/timepicker/services/DayPeriodService.d.ts +3 -3
- package/timepicker/services/HoursService.d.ts +3 -3
- package/timepicker/services/MinutesService.d.ts +3 -3
- package/timepicker/services/SecondsService.d.ts +3 -3
- package/virtualization/Virtualization.d.ts +25 -63
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +163 -168
|
@@ -5,120 +5,130 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { View as
|
|
10
|
-
import { CalendarViewEnum as
|
|
11
|
-
import { classNames as
|
|
12
|
-
import { cloneDate as
|
|
13
|
-
import {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
import * as t from "react";
|
|
9
|
+
import { View as O } from "./View.mjs";
|
|
10
|
+
import { CalendarViewEnum as o } from "../models/CalendarViewEnum.mjs";
|
|
11
|
+
import { classNames as U } from "@progress/kendo-react-common";
|
|
12
|
+
import { cloneDate as P } from "@progress/kendo-date-math";
|
|
13
|
+
import { MIN_DATE as j, MAX_DATE as B } from "../../utils.mjs";
|
|
14
|
+
const w = 2, a = {
|
|
15
|
+
showWeekNumbers: !1,
|
|
16
|
+
views: w,
|
|
17
|
+
take: w,
|
|
18
|
+
allowReverse: !0,
|
|
19
|
+
weekDaysFormat: "short",
|
|
20
|
+
min: j,
|
|
21
|
+
max: B
|
|
22
|
+
}, h = t.forwardRef(
|
|
23
|
+
(y, R) => {
|
|
24
|
+
const {
|
|
25
|
+
showWeekNumbers: p = a.showWeekNumbers,
|
|
26
|
+
allowReverse: u = a.allowReverse,
|
|
27
|
+
weekDaysFormat: D = a.weekDaysFormat,
|
|
28
|
+
min: C = a.min,
|
|
29
|
+
max: E = a.max,
|
|
30
|
+
activeView: r,
|
|
31
|
+
bus: N,
|
|
32
|
+
cellUID: b,
|
|
33
|
+
focusedDate: A,
|
|
34
|
+
onChange: m,
|
|
35
|
+
onWeekSelect: f,
|
|
36
|
+
selectionRange: d,
|
|
37
|
+
service: L,
|
|
38
|
+
value: S,
|
|
39
|
+
onCellEnter: T,
|
|
40
|
+
cell: V,
|
|
41
|
+
weekCell: H,
|
|
42
|
+
showOtherMonthDays: W,
|
|
43
|
+
dates: g,
|
|
44
|
+
verticalView: k
|
|
45
|
+
} = y, x = !!(p && r === o.month), v = () => {
|
|
46
|
+
if (!n.current)
|
|
18
47
|
return;
|
|
19
|
-
const e =
|
|
20
|
-
e && e[0] && e[0].classList.remove("k-focus"),
|
|
21
|
-
},
|
|
22
|
-
if (!
|
|
48
|
+
const e = n.current.querySelector("td.k-focus"), s = n.current.querySelector(".k-state-pending-focus");
|
|
49
|
+
e && e[0] && e[0].classList.remove("k-focus"), s && s.classList.add("k-focus"), i.current = !0;
|
|
50
|
+
}, z = () => {
|
|
51
|
+
if (!n.current)
|
|
23
52
|
return;
|
|
24
|
-
const e =
|
|
25
|
-
e && e.classList.remove("k-focus"),
|
|
26
|
-
},
|
|
53
|
+
const e = n.current.querySelector("td.k-focus");
|
|
54
|
+
e && e.classList.remove("k-focus"), i.current = !1;
|
|
55
|
+
}, F = (e) => {
|
|
27
56
|
if (e.start === null || e.end === null)
|
|
28
57
|
return e;
|
|
29
|
-
const
|
|
58
|
+
const s = e.end < e.start;
|
|
30
59
|
return {
|
|
31
|
-
start:
|
|
32
|
-
end:
|
|
60
|
+
start: s ? e.end : e.start,
|
|
61
|
+
end: s ? e.start : e.end
|
|
33
62
|
};
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (s) {
|
|
40
|
-
const a = {
|
|
63
|
+
}, _ = (e, s, c) => {
|
|
64
|
+
f && c && f(e, s, c);
|
|
65
|
+
}, I = (e, s = !1) => {
|
|
66
|
+
if (m) {
|
|
67
|
+
const c = {
|
|
41
68
|
syntheticEvent: e.syntheticEvent,
|
|
42
69
|
nativeEvent: e.nativeEvent,
|
|
43
|
-
value:
|
|
44
|
-
target:
|
|
45
|
-
isTodayClick:
|
|
70
|
+
value: P(e.value),
|
|
71
|
+
target: l.current,
|
|
72
|
+
isTodayClick: s
|
|
46
73
|
};
|
|
47
|
-
|
|
74
|
+
m(c);
|
|
48
75
|
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"k-
|
|
69
|
-
"k-
|
|
70
|
-
"k-calendar-
|
|
71
|
-
"k-calendar-
|
|
72
|
-
"k-calendar-decadeview": this.props.activeView === i.decade,
|
|
73
|
-
"k-calendar-centuryview": this.props.activeView === i.century
|
|
76
|
+
}, l = t.useRef(null);
|
|
77
|
+
t.useImperativeHandle(
|
|
78
|
+
l,
|
|
79
|
+
() => ({
|
|
80
|
+
element: n.current,
|
|
81
|
+
focusActiveDate: v,
|
|
82
|
+
blurActiveDate: z
|
|
83
|
+
})
|
|
84
|
+
), t.useImperativeHandle(
|
|
85
|
+
R,
|
|
86
|
+
() => l.current
|
|
87
|
+
);
|
|
88
|
+
const n = t.useRef(null), i = t.useRef(!1);
|
|
89
|
+
t.useEffect(() => {
|
|
90
|
+
i.current && v();
|
|
91
|
+
});
|
|
92
|
+
const M = u ? F(d) : d, q = U("k-calendar-view k-align-items-start k-justify-content-center", {
|
|
93
|
+
"k-vstack": k,
|
|
94
|
+
"k-hstack": !k,
|
|
95
|
+
"k-calendar-monthview": r === o.month,
|
|
96
|
+
"k-calendar-yearview": r === o.year,
|
|
97
|
+
"k-calendar-decadeview": r === o.decade,
|
|
98
|
+
"k-calendar-centuryview": r === o.century
|
|
74
99
|
});
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
|
|
100
|
+
return /* @__PURE__ */ t.createElement("div", { ref: n, className: q }, g.map((e) => /* @__PURE__ */ t.createElement("table", { className: "k-calendar-table", key: e.getTime(), role: "grid" }, /* @__PURE__ */ t.createElement(
|
|
101
|
+
O,
|
|
77
102
|
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
onWeekSelect: this.handleWeekCellClick,
|
|
102
|
-
onCellEnter: this.props.onCellEnter,
|
|
103
|
-
cell: this.props.cell,
|
|
104
|
-
weekCell: this.props.weekCell,
|
|
105
|
-
showOtherMonthDays: this.props.showOtherMonthDays,
|
|
106
|
-
allowReverse: this.props.allowReverse
|
|
107
|
-
}
|
|
108
|
-
)))
|
|
109
|
-
);
|
|
103
|
+
bus: N,
|
|
104
|
+
weekDaysFormat: D,
|
|
105
|
+
service: L,
|
|
106
|
+
key: e.getTime(),
|
|
107
|
+
direction: "horizontal",
|
|
108
|
+
activeView: r,
|
|
109
|
+
cellUID: b,
|
|
110
|
+
viewDate: e,
|
|
111
|
+
min: C,
|
|
112
|
+
max: E,
|
|
113
|
+
focusedDate: A,
|
|
114
|
+
selectionRange: M,
|
|
115
|
+
selectedDate: S,
|
|
116
|
+
showWeekNumbers: x,
|
|
117
|
+
onChange: I,
|
|
118
|
+
onWeekSelect: _,
|
|
119
|
+
onCellEnter: T,
|
|
120
|
+
cell: V,
|
|
121
|
+
weekCell: H,
|
|
122
|
+
showOtherMonthDays: W,
|
|
123
|
+
allowReverse: u
|
|
124
|
+
}
|
|
125
|
+
))));
|
|
110
126
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
take: n,
|
|
116
|
-
allowReverse: !0,
|
|
117
|
-
weekDaysFormat: "short",
|
|
118
|
-
min: d,
|
|
119
|
-
max: u
|
|
120
|
-
};
|
|
121
|
-
let c = r;
|
|
127
|
+
);
|
|
128
|
+
h.displayName = "KendoReactHorizontalViewList";
|
|
129
|
+
const K = h;
|
|
130
|
+
K.defaultProps = a;
|
|
122
131
|
export {
|
|
123
|
-
|
|
132
|
+
K as HorizontalViewList,
|
|
133
|
+
a as horizontalViewListDefaultProps
|
|
124
134
|
};
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
import { Action, ActiveView, SelectionRange, CalendarViewEnum, SelectionRangeEnd, MultiViewCalendarSettings } from '../models/index.js';
|
|
8
|
+
import { ActiveView, SelectionRange, CalendarViewEnum, MultiViewCalendarSettings } from '../models/index.js';
|
|
10
9
|
import * as React from 'react';
|
|
11
10
|
/**
|
|
12
11
|
* The arguments for the `onChange` event of the MultiViewCalendar. * The generic argument sets the target type of the event. Defaults to `MultiViewCalendar`.
|
|
@@ -57,140 +56,51 @@ export interface MultiViewCalendarState {
|
|
|
57
56
|
focusedDate: Date;
|
|
58
57
|
navigateDate: Date;
|
|
59
58
|
}
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*/
|
|
65
|
-
static displayName: string;
|
|
66
|
-
/**
|
|
67
|
-
* @hidden
|
|
68
|
-
*/
|
|
69
|
-
static propTypes: {
|
|
70
|
-
activeRangeEnd: PropTypes.Requireable<"end" | "start">;
|
|
71
|
-
allowReverse: PropTypes.Requireable<boolean>;
|
|
72
|
-
bottomView: PropTypes.Requireable<ActiveView>;
|
|
73
|
-
className: PropTypes.Requireable<string>;
|
|
74
|
-
defaultActiveView: PropTypes.Requireable<ActiveView>;
|
|
75
|
-
defaultValue: PropTypes.Requireable<any>;
|
|
76
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
77
|
-
focusedDate: PropTypes.Requireable<Date>;
|
|
78
|
-
id: PropTypes.Requireable<string>;
|
|
79
|
-
weekDaysFormat: PropTypes.Requireable<string>;
|
|
80
|
-
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
81
|
-
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
82
|
-
max: PropTypes.Requireable<Date>;
|
|
83
|
-
min: PropTypes.Requireable<Date>;
|
|
84
|
-
mode: PropTypes.Requireable<"range" | "multiple" | "single">;
|
|
85
|
-
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
86
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
87
|
-
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
88
|
-
tabIndex: PropTypes.Requireable<number>;
|
|
89
|
-
topView: PropTypes.Requireable<ActiveView>;
|
|
90
|
-
value: PropTypes.Requireable<any>;
|
|
91
|
-
views: (props: MultiViewCalendarProps, propName: keyof MultiViewCalendarProps<any>, componentName: string) => Error | null;
|
|
92
|
-
weekNumber: PropTypes.Requireable<boolean>;
|
|
93
|
-
showOtherMonthDays: PropTypes.Requireable<boolean>;
|
|
94
|
-
dir: PropTypes.Requireable<string>;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* @hidden
|
|
98
|
-
*/
|
|
99
|
-
static defaultProps: {
|
|
100
|
-
disabled: boolean;
|
|
101
|
-
min: Date;
|
|
102
|
-
max: Date;
|
|
103
|
-
navigation: boolean;
|
|
104
|
-
defaultActiveView: ActiveView;
|
|
105
|
-
defaultValue: null;
|
|
106
|
-
topView: ActiveView;
|
|
107
|
-
weekDaysFormat: string;
|
|
108
|
-
tabIndex: number;
|
|
109
|
-
bottomView: ActiveView;
|
|
110
|
-
views: number;
|
|
111
|
-
allowReverse: boolean;
|
|
112
|
-
showOtherMonthDays: boolean;
|
|
113
|
-
};
|
|
114
|
-
protected dates: any[];
|
|
115
|
-
private lastView;
|
|
116
|
-
private lastViewsCount;
|
|
117
|
-
protected selectedDate: Date | null;
|
|
118
|
-
protected selectedMultiple: Date[] | null;
|
|
119
|
-
protected selectedRange: SelectionRange;
|
|
120
|
-
protected _focusedDate: Date;
|
|
121
|
-
protected cellUID: string | undefined;
|
|
122
|
-
private valueDuringOnChange?;
|
|
123
|
-
private activeRangeEnd;
|
|
124
|
-
private _element;
|
|
125
|
-
private bus;
|
|
126
|
-
private navigation;
|
|
127
|
-
private intl;
|
|
128
|
-
private localization;
|
|
129
|
-
private service;
|
|
130
|
-
private get wrapperID();
|
|
131
|
-
private calendarViewList;
|
|
132
|
-
private isActive;
|
|
133
|
-
private calculateFocusFromValue;
|
|
134
|
-
private get isRtl();
|
|
135
|
-
/**
|
|
136
|
-
* Gets the wrapping element of the MultiViewCalendar component.
|
|
137
|
-
*/
|
|
138
|
-
get element(): HTMLDivElement | null;
|
|
59
|
+
/**
|
|
60
|
+
* Represent the `ref` of the MultiViewCalendar component.
|
|
61
|
+
*/
|
|
62
|
+
export interface MultiViewCalendarHandle {
|
|
139
63
|
/**
|
|
140
|
-
*
|
|
64
|
+
* Returns the HTML element of the MultiViewCalendar component.
|
|
141
65
|
*/
|
|
142
|
-
|
|
66
|
+
element: HTMLDivElement | null;
|
|
143
67
|
/**
|
|
144
68
|
* Gets the current focused date of the MultiViewCalendar.
|
|
145
69
|
*/
|
|
146
|
-
|
|
147
|
-
protected get min(): Date;
|
|
148
|
-
protected get max(): Date;
|
|
149
|
-
protected get bottomView(): CalendarViewEnum;
|
|
150
|
-
protected get topView(): CalendarViewEnum;
|
|
151
|
-
protected get activeRange(): SelectionRangeEnd;
|
|
152
|
-
protected get todayIsInRange(): boolean;
|
|
153
|
-
private readonly showLicenseWatermark;
|
|
154
|
-
private readonly licenseMessage?;
|
|
155
|
-
constructor(props: MultiViewCalendarProps);
|
|
156
|
-
/**
|
|
157
|
-
* @hidden
|
|
158
|
-
*/
|
|
159
|
-
componentDidMount(): void;
|
|
70
|
+
focusedDate: Date;
|
|
160
71
|
/**
|
|
161
|
-
*
|
|
72
|
+
* Gets the value of the MultiViewCalendar.
|
|
162
73
|
*/
|
|
163
|
-
|
|
74
|
+
value: Date | Date[] | SelectionRange | null;
|
|
164
75
|
/**
|
|
165
|
-
*
|
|
76
|
+
* Returns the props of the MultiViewCalendar component.
|
|
166
77
|
*/
|
|
167
|
-
|
|
78
|
+
readonly props: MultiViewCalendarProps;
|
|
168
79
|
/**
|
|
169
80
|
* @hidden
|
|
81
|
+
* Focuses the MultiViewCalendar component.
|
|
170
82
|
*/
|
|
171
|
-
|
|
172
|
-
protected clampRange: (value: Date) => SelectionRange;
|
|
173
|
-
protected rangeWithFocused: (range: SelectionRange, focusedDate: Date) => SelectionRange;
|
|
174
|
-
protected generateRange: (candidate: Date, value: SelectionRange) => SelectionRange;
|
|
175
|
-
protected canNavigate: (action: Action) => boolean;
|
|
176
|
-
protected isInMonth(date: Date, month: Date): boolean;
|
|
177
|
-
protected navigate: (action: Action, date: Date) => void;
|
|
178
|
-
protected move: (action: Action, date: Date) => Date;
|
|
179
|
-
protected clampDate: (value: Date) => Date;
|
|
180
|
-
protected shouldAutoCorrect: (candidate: Date, value: SelectionRange) => boolean;
|
|
181
|
-
private handleCellEnter;
|
|
182
|
-
private handleMouseDown;
|
|
183
|
-
private handleClick;
|
|
184
|
-
private handleFocus;
|
|
185
|
-
private handleBlur;
|
|
186
|
-
private handleTodayClick;
|
|
187
|
-
private handlePrevButtonClick;
|
|
188
|
-
private handleNextButtonClick;
|
|
189
|
-
private handleKeyDown;
|
|
190
|
-
private handleViewChange;
|
|
191
|
-
private handleWeekSelection;
|
|
192
|
-
private handleDateChange;
|
|
83
|
+
focus(): void;
|
|
193
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* @hidden
|
|
87
|
+
* The default props of the MultiViewCalendar component.
|
|
88
|
+
*/
|
|
89
|
+
export declare const multiViewCalendarDefaultProps: {
|
|
90
|
+
disabled: boolean;
|
|
91
|
+
min: Date;
|
|
92
|
+
max: Date;
|
|
93
|
+
navigation: boolean;
|
|
94
|
+
defaultActiveView: ActiveView;
|
|
95
|
+
defaultValue: Date | Date[] | SelectionRange | null;
|
|
96
|
+
topView: ActiveView;
|
|
97
|
+
weekDaysFormat: "short";
|
|
98
|
+
tabIndex: number;
|
|
99
|
+
bottomView: ActiveView;
|
|
100
|
+
views: number;
|
|
101
|
+
allowReverse: boolean;
|
|
102
|
+
showOtherMonthDays: boolean;
|
|
103
|
+
};
|
|
194
104
|
/**
|
|
195
105
|
* Represents the PropsContext of the `MultiViewCalendar` component.
|
|
196
106
|
* Used for global configuration of all `MultiViewCalendar` instances.
|
|
@@ -199,28 +109,16 @@ export declare class MultiViewCalendarWithoutContext extends React.Component<Mul
|
|
|
199
109
|
*/
|
|
200
110
|
export declare const MultiViewCalendarPropsContext: React.Context<(p: MultiViewCalendarProps<any>) => MultiViewCalendarProps<any>>;
|
|
201
111
|
/**
|
|
202
|
-
*
|
|
112
|
+
* @hidden
|
|
113
|
+
* @deprecated Use MultiViewCalendarHandle directly.
|
|
203
114
|
*/
|
|
204
|
-
export
|
|
205
|
-
/**
|
|
206
|
-
* Returns the HTML element of the MultiViewCalendar component.
|
|
207
|
-
*/
|
|
208
|
-
element: HTMLDivElement | null;
|
|
209
|
-
/**
|
|
210
|
-
* Gets the current focused date of the MultiViewCalendar.
|
|
211
|
-
*/
|
|
212
|
-
focusedDate: Date;
|
|
213
|
-
/**
|
|
214
|
-
* Gets the value of the MultiViewCalendar.
|
|
215
|
-
*/
|
|
216
|
-
value: Date | Date[] | SelectionRange | null;
|
|
217
|
-
}
|
|
218
|
-
/** @hidden */
|
|
219
|
-
export type MultiViewCalendar = MultiViewCalendarHandle;
|
|
115
|
+
export declare const MultiViewCalendarWithoutContext: React.ForwardRefExoticComponent<MultiViewCalendarProps<any> & React.RefAttributes<MultiViewCalendarHandle | null>>;
|
|
220
116
|
/**
|
|
221
117
|
* Represents the KendoReact MultiViewCalendar Component.
|
|
222
118
|
*
|
|
223
119
|
* Accepts properties of type [MultiViewCalendarProps](https://www.telerik.com/kendo-react-ui/components/dateinputs/api/multiviewcalendarprops).
|
|
224
120
|
* Obtaining the `ref` returns an object of type [MultiViewCalendarHandle](https://www.telerik.com/kendo-react-ui/components/dateinputs/api/multiviewcalendarhandle).
|
|
225
121
|
*/
|
|
226
|
-
export declare const MultiViewCalendar: React.ForwardRefExoticComponent<MultiViewCalendarProps<any> & React.RefAttributes<
|
|
122
|
+
export declare const MultiViewCalendar: React.ForwardRefExoticComponent<MultiViewCalendarProps<any> & React.RefAttributes<MultiViewCalendarHandle | null>>;
|
|
123
|
+
/** @deprecated Use MultiViewCalendarHandle directly. */
|
|
124
|
+
export type MultiViewCalendar = MultiViewCalendarHandle;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("react"),s=require("prop-types"),F=require("@progress/kendo-react-intl"),g=require("@progress/kendo-react-common"),o=require("@progress/kendo-date-math"),S=require("@progress/kendo-react-buttons"),x=require("@progress/kendo-svg-icons"),I=require("../models/NavigationAction.js"),O=require("../models/CalendarViewEnum.js"),B=require("../models/SelectionRange.js"),z=require("./Header.js"),r=require("../../utils.js"),V=require("../../messages/index.js"),H=require("../services/BusViewService.js"),Y=require("../services/NavigationService.js"),E=require("./HorizontalViewList.js"),W=require("./TodayCommand.js"),T=require("../../package-metadata.js");function j(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const a in c)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(c,a);Object.defineProperty(i,a,d.get?d:{enumerable:!0,get:()=>c[a]})}}return i.default=c,Object.freeze(i)}const p=j(K),A=(c=m.defaultProps.min,i=m.defaultProps.max,a)=>a instanceof Date&&!Array.isArray(a)&&r.isInRange(o.getDate(a),c,i)?o.getDate(a):null,L=(c=m.defaultProps.min,i=m.defaultProps.max,a)=>Array.isArray(a)?a.filter(d=>r.isInRange(d,c,i)).map(d=>o.getDate(d)):null,P=c=>typeof c=="object"&&!(c instanceof Date)&&c!==null&&!Array.isArray(c)?c:B.EMPTY_SELECTIONRANGE,N=(c,i,a)=>c||i&&i[0]||a&&a.start,U=(c,i)=>c.start===null&&i===null?"start":c.end===null?"end":"start",v=class v extends p.Component{constructor(i){super(i),this.dates=[],this.selectedDate=null,this.selectedMultiple=null,this.selectedRange=B.EMPTY_SELECTIONRANGE,this._focusedDate=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=()=>{this._element&&this._element.focus()},this.clampRange=e=>({start:e,end:null}),this.rangeWithFocused=(e,t)=>({start:e.start,end:e.end===null&&e.start!==null&&this.isActive?t:e.end}),this.generateRange=(e,t)=>{const{end:h,start:l}=t,u=t.start!==null&&e.getTime()<=t.start.getTime();return!this.props.allowReverse&&u?{start:e,end:this.selectedRange.start}:this.activeRange!=="end"?{start:e,end:h}:{start:l||this.selectedDate,end:e}},this.canNavigate=e=>{if(!this.service)return!1;const t=this.service.move(this.focusedDate,e);return this.min<=t&&t<=this.max||this.service.isInSameView(t,this.min)||this.service.isInSameView(t,this.max)},this.navigate=(e,t)=>{this.calculateFocusFromValue=!1;const h=this.move(e,t);this.setState({navigateDate:h,focusedDate:h})},this.move=(e,t)=>this.clampDate(this.service.move(t,e)),this.clampDate=e=>r.dateInRange(e,this.min,this.max),this.shouldAutoCorrect=(e,t)=>{const{end:h,start:l}=t;return this.activeRange!=="end"?h!==null&&e>h:l!==null&&e<l},this.handleCellEnter=e=>{this.props.mode==="range"&&(this.calculateFocusFromValue=!1,this.setState({focusedDate:e}))},this.handleMouseDown=e=>{e.preventDefault()},this.handleClick=e=>{this._element&&this._element.focus({preventScroll:!0})},this.handleFocus=e=>{if(this.isActive=!0,!this.calendarViewList)return;this.calendarViewList.focusActiveDate();const{onFocus:t}=this.props;t&&t.call(void 0,e)},this.handleBlur=e=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:t}=this.props;t&&t.call(void 0,e)},this.handleTodayClick=e=>{this.todayIsInRange&&this.handleDateChange(e)},this.handlePrevButtonClick=()=>{const e=I.Action.PrevView;if(this.state.activeView>0&&this.focusedDate.getFullYear()>this.dates[0].getFullYear())this.navigate(e,this.move(e,this.focusedDate));else{const t=this.isInMonth(this.focusedDate,this.dates[1])?this.move(e,this.focusedDate):this.focusedDate;this.navigate(e,t)}},this.handleNextButtonClick=()=>{this.navigate(I.Action.NextView,this.focusedDate)},this.handleKeyDown=e=>{const{keyCode:h,ctrlKey:l,metaKey:u}=e;if(h===84){const n=r.getToday();this.calculateFocusFromValue=!1,this.setState({focusedDate:n,navigateDate:n})}if((l||u)&&(h===g.Keys.left&&this.handlePrevButtonClick(),h===g.Keys.right&&this.handleNextButtonClick()),h===g.Keys.enter){const n={syntheticEvent:e,nativeEvent:e.nativeEvent,value:this.focusedDate,target:this};this.handleDateChange(n)}else{const n=r.dateInRange(this.navigation.move(this.focusedDate,this.navigation.action(e),this.state.activeView,this.service,e),this.min,this.max);if(o.isEqualDate(this.focusedDate,n))return;this.dates&&this.service&&!this.service.isInArray(n,this.dates)&&this.setState({navigateDate:n}),this.calculateFocusFromValue=!1,this.setState({focusedDate:n})}e.preventDefault()},this.handleViewChange=({view:e})=>{this.calculateFocusFromValue=!1,this.setState(t=>({activeView:e,navigateDate:t.focusedDate}))},this.handleWeekSelection=(e,t,h)=>{if(this.props.mode==="single")return;const l=0,u=6,n=t===l?e:o.addDays(e,-t),f=t===u?e:o.addDays(e,u-t);let D=null;if(this.props.mode==="multiple"){D=[];for(let R=l;R<=u;R++)D.push(o.addDays(n,R));this.setState({value:D,focusedDate:e})}this.props.mode==="range"&&(D={start:n,end:f},this.setState({value:D,focusedDate:e}));const{onChange:k}=this.props;if(k){const R={syntheticEvent:h,nativeEvent:h.nativeEvent,value:D,target:this};k.call(void 0,R)}},this.handleDateChange=e=>{const t=o.cloneDate(e.value),h=this.bus.canMoveDown(this.state.activeView);if(this.props.disabled)return;if(h)if(e.isTodayClick)this.bus.moveToBottom(this.state.activeView);else{this.bus.moveDown(this.state.activeView,e.syntheticEvent),this.setState({focusedDate:t,navigateDate:t});return}this.calculateFocusFromValue=!0;let l;switch(this.props.mode){case"single":l=o.cloneDate(e.value);break;case"multiple":if(Array.isArray(this.selectedMultiple)){const n=this.selectedMultiple.slice();let f=-1;n.forEach((D,k)=>{o.isEqualDate(D,e.value)&&(f=k)}),f!==-1?n.splice(f,1):n.push(o.cloneDate(e.value)),l=n.slice()}else this.selectedDate?l=[o.cloneDate(this.selectedDate),o.cloneDate(e.value)]:l=[o.cloneDate(e.value)];break;case"range":{l=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";break}default:l=o.cloneDate(e.value);break}this.valueDuringOnChange=l,e.isTodayClick&&this.setState({navigateDate:t}),this.setState({value:l,focusedDate:t}),this.valueDuringOnChange=l;const{onChange:u}=this.props;if(u){const n={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:l,target:this};u.call(void 0,n)}this.valueDuringOnChange=void 0},this.showLicenseWatermark=!g.validatePackage(T.packageMetadata,{component:"MultiViewCalendar"}),this.licenseMessage=g.getLicenseMessage(T.packageMetadata);const a=i.value!==void 0?i.value:i.defaultValue||v.defaultProps.defaultValue,d=A(this.min,this.max,a),w=L(this.min,this.max,a),C=P(a),M=N(d,w,C),b=r.viewInRange(O.CalendarViewEnum[i.defaultActiveView],this.bottomView,this.topView),y=r.dateInRange(i.focusedDate||M||r.getToday(),this.min,this.max);this.state={value:a,activeView:b,focusedDate:y,navigateDate:y},this.activeRangeEnd=U(C,d),this.bus=new H.BusViewService(this.handleViewChange),this.navigation=new Y.NavigationService(this.bus),this.calculateFocusFromValue=!1,this.lastView=b,this.lastViewsCount=this.props.views||E.HorizontalViewList.defaultProps.views}get wrapperID(){return this.props.id+"-wrapper-id"}get isRtl(){return this.props.dir==="rtl"}get element(){return this._element}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value}get focusedDate(){return o.cloneDate(this._focusedDate)}get min(){return o.getDate(this.props.min!==void 0?this.props.min:v.defaultProps.min)}get max(){return o.getDate(this.props.max!==void 0?this.props.max:v.defaultProps.max)}get bottomView(){return O.CalendarViewEnum[this.props.bottomView!==void 0?this.props.bottomView:v.defaultProps.bottomView]}get topView(){return O.CalendarViewEnum[this.props.topView!==void 0?this.props.topView:v.defaultProps.topView]}get activeRange(){return this.props.activeRangeEnd!==void 0?this.props.activeRangeEnd:this.activeRangeEnd}get todayIsInRange(){return r.isInRange(r.getToday(),o.getDate(this.min),o.getDate(this.max))}componentDidMount(){this.calculateFocusFromValue=!0}componentDidUpdate(){this.calendarViewList&&(this.isActive?this.calendarViewList.focusActiveDate:this.calendarViewList.blurActiveDate)();const i=A(this.min,this.max,this.value);this.calculateFocusFromValue=!!(this.selectedDate&&i&&this.selectedDate.getTime()&&i.getTime()),this.lastView=this.state.activeView,this.lastViewsCount=this.props.views||E.HorizontalViewList.defaultProps.views}render(){this.props._ref&&this.props._ref(this),this.intl=F.provideIntlService(this),this.localization=F.provideLocalizationService(this),this.bus.configure(this.bottomView,this.topView);const i=r.viewInRange(this.state.activeView,this.bottomView,this.topView);this.service=this.bus.service(i,this.intl),this.selectedDate=A(this.min,this.max,this.value),this.selectedMultiple=L(this.min,this.max,this.value),this.selectedRange=P(this.value);const a=N(this.selectedDate,this.selectedMultiple,this.selectedRange);this._focusedDate=r.dateInRange(this.calculateFocusFromValue&&a!==null?a:this.state.focusedDate,this.min,this.max);const d=g.classNames("k-calendar k-calendar-range",{"k-disabled":this.props.disabled},this.props.className),w=this.rangeWithFocused(this.selectedRange,this.focusedDate),C=this.localization.toLanguageString(V.prevView,V.messages[V.prevView]),M=this.localization.toLanguageString(V.nextView,V.messages[V.nextView]),b=!this.canNavigate(I.Action.PrevView),y=!this.canNavigate(I.Action.NextView),e={"aria-disabled":b},t={"aria-disabled":y},h=this.lastView!==i,l=this.dates&&this.isInMonth(this.state.navigateDate,this.dates[0]),u=this.lastViewsCount!==this.props.views;(!l||h||u)&&(this.dates=this.service.datesList(this.state.navigateDate,this.props.views||E.HorizontalViewList.defaultProps.views));const n=o.cloneDate(this.dates&&this.dates[0]?this.dates[0]:r.getToday());return p.createElement("div",{ref:f=>{this._element=f},className:d,id:this.props.id||this.wrapperID,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.disabled?void 0:this.props.tabIndex,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseDown:this.handleMouseDown,onClick:this.handleClick,onKeyDown:this.handleKeyDown,"aria-disabled":this.props.disabled,dir:this.props.dir},p.createElement(z.Header,{key:`.kendo.calendar.header.${n.getTime()}`,activeView:i,currentDate:n,min:this.min,max:this.max,rangeLength:this.props.views,bus:this.bus,service:this.service,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode,commands:p.createElement(p.Fragment,null,p.createElement(S.Button,{type:"button",className:"k-calendar-nav-prev",icon:this.isRtl?"chevron-right":"chevron-left",svgIcon:this.isRtl?x.chevronRightIcon:x.chevronLeftIcon,fillMode:"flat",title:C,disabled:b,onClick:this.handlePrevButtonClick,...e}),p.createElement(W.TodayCommand,{min:this.min,max:this.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange}),p.createElement(S.Button,{type:"button",className:"k-calendar-nav-next",icon:this.isRtl?"chevron-left":"chevron-right",svgIcon:this.isRtl?x.chevronLeftIcon:x.chevronRightIcon,fillMode:"flat",title:M,disabled:y,onClick:this.handleNextButtonClick,...t}))}),p.createElement(E.HorizontalViewList,{ref:f=>{this.calendarViewList=f},dates:this.dates,activeView:i,focusedDate:this.focusedDate,weekDaysFormat:this.props.weekDaysFormat,min:this.min,max:this.max,bus:this.bus,service:this.service,selectionRange:w,value:this.selectedMultiple||this.selectedDate,cellUID:this.cellUID,views:this.props.views,onChange:this.handleDateChange,onWeekSelect:this.handleWeekSelection,showWeekNumbers:this.props.weekNumber,onCellEnter:this.handleCellEnter,cell:this.props.cell,weekCell:this.props.weekCell,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode,showOtherMonthDays:this.props.showOtherMonthDays,allowReverse:this.props.allowReverse}),this.showLicenseWatermark&&p.createElement(g.WatermarkOverlay,{message:this.licenseMessage}))}isInMonth(i,a){return!!a&&o.firstDayOfMonth(a)<=i&&i<=o.lastDayOfMonth(a)}};v.displayName="MultiViewCalendar",v.propTypes={activeRangeEnd:s.oneOf(["start","end"]),allowReverse:s.bool,bottomView:s.oneOf(["month","year","decade","century"]),className:s.string,defaultActiveView:s.oneOf(["month","year","decade","century"]),defaultValue:s.oneOfType([r.nullable(s.instanceOf(Date)),s.arrayOf(s.instanceOf(Date)),s.shape({start:r.nullable(s.instanceOf(Date)),end:r.nullable(s.instanceOf(Date))})]),disabled:s.bool,focusedDate:s.instanceOf(Date),id:s.string,weekDaysFormat:s.oneOf(["narrow","short","abbreviated"]),ariaLabelledBy:s.string,ariaDescribedBy:s.string,max:s.instanceOf(Date),min:s.instanceOf(Date),mode:s.oneOf(["single","multiple","range"]),onBlur:s.func,onChange:s.func,onFocus:s.func,tabIndex:s.number,topView:s.oneOf(["month","year","decade","century"]),value:s.oneOfType([r.nullable(s.instanceOf(Date)),s.arrayOf(s.instanceOf(Date)),s.shape({start:r.nullable(s.instanceOf(Date).isRequired),end:r.nullable(s.instanceOf(Date).isRequired)})]),views:(i,a,d)=>{const w=i[a];return w!==void 0&&w<1?new Error(`Invalid prop '${a}' supplied to'${d}'. The '${a}' property cannot be less than 1'`):null},weekNumber:s.bool,showOtherMonthDays:s.bool,dir:s.string},v.defaultProps={disabled:!1,min:r.MIN_DATE,max:r.MAX_DATE,navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",weekDaysFormat:"short",tabIndex:0,bottomView:"month",views:2,allowReverse:!1,showOtherMonthDays:!1};let m=v;const q=g.createPropsContext(),_=g.withIdHOC(g.withPropsContext(q,m));_.displayName="KendoReactMultiViewCalendar";F.registerForIntl(m);F.registerForLocalization(m);exports.MultiViewCalendar=_;exports.MultiViewCalendarPropsContext=q;exports.MultiViewCalendarWithoutContext=m;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const kt=require("react"),n=require("prop-types"),C=require("@progress/kendo-react-common"),c=require("@progress/kendo-date-math"),Se=require("@progress/kendo-react-intl"),Te=require("@progress/kendo-react-buttons"),U=require("@progress/kendo-svg-icons"),X=require("../models/NavigationAction.js"),J=require("../models/CalendarViewEnum.js"),Et=require("../models/SelectionRange.js"),It=require("./Header.js"),s=require("../../utils.js"),S=require("../../messages/index.js"),Mt=require("../services/BusViewService.js"),Ot=require("../services/NavigationService.js"),xt=require("./HorizontalViewList.js"),At=require("./TodayCommand.js"),Fe=require("../../package-metadata.js");function St(r){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const v in r)if(v!=="default"){const h=Object.getOwnPropertyDescriptor(r,v);Object.defineProperty(f,v,h.get?h:{enumerable:!0,get:()=>r[v]})}}return f.default=r,Object.freeze(f)}const a=St(kt),T=(r,f=g.min,v=g.max)=>r instanceof Date&&!Array.isArray(r)&&s.isInRange(c.getDate(r),f,v)?c.getDate(r):null,oe=(r,f=g.min,v=g.max)=>Array.isArray(r)?r.filter(h=>s.isInRange(h,f,v)).map(h=>c.getDate(h)):null,Q=r=>typeof r=="object"&&!(r instanceof Date)&&r!==null&&!Array.isArray(r)?r:Et.EMPTY_SELECTIONRANGE,Pe=(r,f,v)=>r||f&&f[0]||v&&v.start,Tt=(r,f)=>r.start===null&&f===null?"start":r.end===null?"end":"start",g={disabled:!1,min:s.MIN_DATE,max:s.MAX_DATE,defaultActiveView:"month",defaultValue:null,topView:"century",weekDaysFormat:"short",tabIndex:0,bottomView:"month",views:2,allowReverse:!1,showOtherMonthDays:!1},Ne=C.createPropsContext(),Z=a.forwardRef((r,f)=>{var Ae;const v=a.useMemo(()=>!C.validatePackage(Fe.packageMetadata,{component:"MultiViewCalendar"}),[]),h=a.useMemo(()=>C.getLicenseMessage(Fe.packageMetadata),[]),q=C.usePropsContext(Ne,r),se=C.useId(q.id),{disabled:B=g.disabled,min:qe=g.min,max:Be=g.max,defaultActiveView:ie=g.defaultActiveView,defaultValue:Le=g.defaultValue,topView:Ke=g.topView,bottomView:_e=g.bottomView,weekDaysFormat:We=g.weekDaysFormat,tabIndex:Ye=g.tabIndex,views:x=g.views,allowReverse:le=g.allowReverse,showOtherMonthDays:je=g.showOtherMonthDays,_ref:ue,className:He,weekNumber:ze,mobileMode:de,focusedDate:$e,value:L,onChange:K,onFocus:fe,onBlur:ge,cell:Ge,weekCell:Ue,headerTitle:ve,mode:F,activeRangeEnd:_,ariaLabelledBy:Xe,ariaDescribedBy:Je,dir:De}=q,u=c.getDate(qe),d=c.getDate(Be),W=J.CalendarViewEnum[_e],Y=J.CalendarViewEnum[Ke],j=De==="rtl",Qe=se+"-cell-uid",Ze=se+"-wrapper-id",et=e=>({start:e,end:null}),tt=(e,t)=>({start:e.start,end:e.end===null&&e.start!==null&&H.current?t:e.end}),nt=(e,t)=>{const{end:o,start:i}=t,m=_!==void 0?_:z.current,l=t.start!==null&&e.getTime()<=t.start.getTime(),b=Q(D),V=T(D,u,d);return!le&&l?{start:e,end:b.start}:m!=="end"?{start:e,end:o}:{start:i||V,end:e}},we=e=>{if(!E.current)return!1;const t=c.cloneDate(I),o=E.current.move(t,e);return u<=o&&o<=d||E.current.isInSameView(o,u)||E.current.isInSameView(o,d)},me=(e,t)=>!!t&&c.firstDayOfMonth(t)<=e&&e<=c.lastDayOfMonth(t),ee=(e,t)=>{k.current=!1;const o=te(e,t);R({navigateDate:o,focusedDate:o})},te=(e,t)=>at(E.current.move(t,e)),at=e=>s.dateInRange(e,u,d),rt=e=>{F==="range"&&(k.current=!1,R({focusedDate:e}))},ct=e=>{e.preventDefault()},ot=e=>{A.current&&A.current.focus({preventScroll:!0})},st=e=>{H.current=!0,M.current&&(M.current.focusActiveDate(),fe&&fe(e))},it=e=>{H.current=!1,M.current&&(M.current.blurActiveDate(),ge&&ge(e))},lt=e=>{Ie&&ne(e)},he=()=>{const e=X.Action.PrevView,t=c.cloneDate(I);if(p.activeView>0&&t.getFullYear()>y.current[0].getFullYear())ee(e,te(e,t));else{const o=me(t,y.current[1])?te(e,t):t;ee(e,o)}},pe=()=>{ee(X.Action.NextView,c.cloneDate(I))},ut=e=>{const{keyCode:o,ctrlKey:i,metaKey:m}=e;if(o===84){const l=s.getToday();k.current=!1,R({focusedDate:l,navigateDate:l})}if((i||m)&&(o===C.Keys.left&&he(),o===C.Keys.right&&pe()),o===C.Keys.enter){const l={syntheticEvent:e,nativeEvent:e.nativeEvent,value:c.cloneDate(I),target:P.current};ne(l)}else{const l=s.dateInRange(Ve.current.move(I,Ve.current.action(e),p.activeView,E.current,e),u,d);if(c.isEqualDate(I,l))return;y.current&&E.current&&!E.current.isInArray(l,y.current)&&R({navigateDate:l}),k.current=!1,R({focusedDate:l})}e.preventDefault()},dt=({view:e})=>{k.current=!1,ye(t=>({...t,activeView:e,navigateDate:t.focusedDate}))},ft=(e,t,o)=>{if(F==="single")return;const i=0,m=6,l=t===i?e:c.addDays(e,-t),b=t===m?e:c.addDays(e,m-t);let V=null;if(F==="multiple"){V=[];for(let w=i;w<=m;w++)V.push(c.addDays(l,w));R({value:V,focusedDate:e})}if(F==="range"&&(V={start:l,end:b},R({value:V,focusedDate:e})),K){const w={syntheticEvent:o,nativeEvent:o.nativeEvent,value:V,target:P.current};K(w)}},ne=e=>{const t=c.cloneDate(e.value),o=O.current.canMoveDown(p.activeView);if(B)return;if(o)if(e.isTodayClick)O.current.moveToBottom(p.activeView);else{O.current.moveDown(p.activeView,e.syntheticEvent),R({focusedDate:t,navigateDate:t});return}k.current=!0;let i;const m=oe(D,u,d),l=T(D,u,d),b=Q(D),V=_!==void 0?_:z.current;switch(F){case"single":i=c.cloneDate(e.value);break;case"multiple":if(Array.isArray(m)){const w=m.slice();let ce=-1;w.forEach((bt,Ct)=>{c.isEqualDate(bt,e.value)&&(ce=Ct)}),ce!==-1?w.splice(ce,1):w.push(c.cloneDate(e.value)),i=w.slice()}else l?i=[c.cloneDate(l),c.cloneDate(e.value)]:i=[c.cloneDate(e.value)];break;case"range":{i=b.start!==null&&b.end!==null&&V==="start"?et(e.value):nt(e.value,b),z.current=V!=="end"?"end":"start";break}default:i=c.cloneDate(e.value);break}if(N.current=i,e.isTodayClick&&R({navigateDate:t}),R({value:i,focusedDate:t}),N.current=i,K){const w={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:i,target:P.current};K(w)}N.current=void 0},P=a.useRef(null);a.useImperativeHandle(P,()=>({get element(){return A.current},get focusedDate(){return c.cloneDate(I)},get value(){return D},get props(){return q},focus:()=>{var e;return(e=A.current)==null?void 0:e.focus()}})),a.useImperativeHandle(f,()=>P.current);const A=a.useRef(null),M=a.useRef(null),O=a.useRef(new Mt.BusViewService(dt)),Ve=a.useRef(new Ot.NavigationService(O.current)),N=a.useRef(void 0),H=a.useRef(!1),k=a.useRef(!1),z=a.useRef("start"),ae=a.useRef(s.viewInRange(J.CalendarViewEnum[ie],W,Y)),re=a.useRef(x),y=a.useRef([]),E=a.useRef(null),[p,ye]=a.useState(()=>{const e=L!==void 0?L:Le,t=T(e,u,d),o=oe(e,u,d),i=Q(e),m=Pe(t,o,i),l=s.viewInRange(J.CalendarViewEnum[ie],W,Y),b=s.dateInRange($e||m||s.getToday(),u,d);return z.current=Tt(i,t),ae.current=l,re.current=x,{value:e,activeView:l,focusedDate:b,navigateDate:b}}),R=e=>{ye(t=>({...t,...e}))};a.useEffect(()=>{k.current=!0},[]),a.useEffect(()=>{M.current&&(H.current?M.current.focusActiveDate:M.current.blurActiveDate)();const e=T(D,u,d),t=T(D,u,d);k.current=!!(t&&e&&t.getTime()&&e.getTime()),ae.current=p.activeView,re.current=x}),a.useEffect(()=>{ue&&ue({element:A.current})});const gt=Se.useInternationalization(),Re=Se.useLocalization();O.current.configure(W,Y);const $=s.viewInRange(p.activeView,W,Y),G=O.current.service($,gt);E.current=G;let D;N.current!==void 0?D=N.current:L!==void 0?D=L:D=p.value;const be=T(D,u,d),Ce=oe(D,u,d),ke=Q(D),Ee=Pe(be,Ce,ke),I=s.dateInRange(k.current&&Ee!==null?Ee:p.focusedDate,u,d),Ie=s.isInRange(s.getToday(),c.getDate(u),c.getDate(d)),vt=C.classNames("k-calendar k-calendar-range",{"k-disabled":B},He),Dt=tt(ke,I),wt=Re.toLanguageString(S.prevView,S.messages[S.prevView]),mt=Re.toLanguageString(S.nextView,S.messages[S.nextView]),Me=!we(X.Action.PrevView),Oe=!we(X.Action.NextView),ht={"aria-disabled":Me},pt={"aria-disabled":Oe},Vt=ae.current!==$,yt=y.current.length>0&&me(p.navigateDate,y.current[0]),Rt=re.current!==x;(!yt||Vt||Rt)&&(y.current=G.datesList(p.navigateDate,x));const xe=c.cloneDate((Ae=y.current)!=null&&Ae[0]?y.current[0]:s.getToday());return a.createElement("div",{ref:A,className:vt,id:q.id||Ze,"aria-labelledby":Xe,"aria-describedby":Je,tabIndex:B?void 0:Ye,onFocus:st,onBlur:it,onMouseDown:ct,onClick:ot,onKeyDown:ut,"aria-disabled":B,dir:De},a.createElement(It.Header,{key:`.kendo.calendar.header.${xe.getTime()}`,activeView:$,currentDate:xe,min:u,max:d,rangeLength:x,bus:O.current,service:G,headerTitle:ve,verticalView:de,commands:a.createElement(a.Fragment,null,a.createElement(Te.Button,{type:"button",className:"k-calendar-nav-prev",icon:j?"chevron-right":"chevron-left",svgIcon:j?U.chevronRightIcon:U.chevronLeftIcon,fillMode:"flat",title:wt,disabled:Me,onClick:he,...ht}),a.createElement(At.TodayCommand,{min:u,max:d,onClick:lt,disabled:!Ie}),a.createElement(Te.Button,{type:"button",className:"k-calendar-nav-next",icon:j?"chevron-left":"chevron-right",svgIcon:j?U.chevronLeftIcon:U.chevronRightIcon,fillMode:"flat",title:mt,disabled:Oe,onClick:pe,...pt}))}),a.createElement(xt.HorizontalViewList,{ref:M,dates:y.current,activeView:$,focusedDate:c.cloneDate(I),weekDaysFormat:We,min:u,max:d,bus:O.current,service:G,selectionRange:Dt,value:Ce||be,cellUID:Qe,views:x,onChange:ne,onWeekSelect:ft,showWeekNumbers:ze,onCellEnter:rt,cell:Ge,weekCell:Ue,headerTitle:ve,verticalView:de,showOtherMonthDays:je,allowReverse:le}),v&&a.createElement(C.WatermarkOverlay,{message:h}))});Z.propTypes={activeRangeEnd:n.oneOf(["start","end"]),allowReverse:n.bool,bottomView:n.oneOf(["month","year","decade","century"]),className:n.string,defaultActiveView:n.oneOf(["month","year","decade","century"]),defaultValue:n.oneOfType([s.nullable(n.instanceOf(Date)),n.arrayOf(n.instanceOf(Date)),n.shape({start:s.nullable(n.instanceOf(Date)),end:s.nullable(n.instanceOf(Date))})]),disabled:n.bool,focusedDate:n.instanceOf(Date),id:n.string,weekDaysFormat:n.oneOf(["narrow","short","abbreviated"]),ariaLabelledBy:n.string,ariaDescribedBy:n.string,max:n.instanceOf(Date),min:n.instanceOf(Date),mode:n.oneOf(["single","multiple","range"]),onBlur:n.func,onChange:n.func,onFocus:n.func,tabIndex:n.number,topView:n.oneOf(["month","year","decade","century"]),value:n.oneOfType([s.nullable(n.instanceOf(Date)),n.arrayOf(n.instanceOf(Date)),n.shape({start:s.nullable(n.instanceOf(Date).isRequired),end:s.nullable(n.instanceOf(Date).isRequired)})]),views:(r,f,v)=>{const h=r[f];return h!==void 0&&h<1?new Error(`Invalid prop '${f}' supplied to'${v}'. The '${f}' property cannot be less than 1'`):null},weekNumber:n.bool,showOtherMonthDays:n.bool,dir:n.string};Z.displayName="KendoReactMultiViewCalendar";const Ft=Z,Pt=Z;exports.MultiViewCalendar=Pt;exports.MultiViewCalendarPropsContext=Ne;exports.MultiViewCalendarWithoutContext=Ft;exports.multiViewCalendarDefaultProps=g;
|