@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.
- package/calendar/components/CalendarCell.js +1 -1
- package/calendar/components/CalendarCell.mjs +29 -28
- package/calendar/components/CalendarWeekCell.js +1 -1
- package/calendar/components/CalendarWeekCell.mjs +12 -10
- package/calendar/components/HorizontalViewList.js +1 -1
- package/calendar/components/HorizontalViewList.mjs +31 -26
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +187 -163
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +40 -34
- package/common/ClearButton.js +8 -0
- package/common/ClearButton.mjs +41 -0
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +32 -29
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +6 -4
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +17 -0
- package/index.d.ts +17 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +38 -36
- package/package-metadata.mjs +1 -1
- package/package.json +7 -7
|
@@ -6,45 +6,45 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import { provideIntlService as
|
|
12
|
-
import { Keys as
|
|
13
|
-
import { isEqualDate as A, cloneDate as
|
|
14
|
-
import { Button as
|
|
15
|
-
import { chevronRightIcon as
|
|
16
|
-
import { Action as
|
|
17
|
-
import { CalendarViewEnum as
|
|
18
|
-
import { EMPTY_SELECTIONRANGE as
|
|
19
|
-
import { Header as
|
|
20
|
-
import { dateInRange as
|
|
21
|
-
import { prevView as
|
|
22
|
-
import { BusViewService as
|
|
23
|
-
import { NavigationService as
|
|
24
|
-
import { HorizontalViewList as
|
|
25
|
-
import { TodayCommand as
|
|
26
|
-
const
|
|
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 =
|
|
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,
|
|
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 ?
|
|
33
|
-
}), this.generateRange = (e,
|
|
34
|
-
const { end:
|
|
35
|
-
return !this.props.allowReverse &&
|
|
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
|
|
40
|
-
return this.min <=
|
|
41
|
-
}, this.navigate = (e,
|
|
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
|
|
44
|
-
this.setState({ navigateDate:
|
|
45
|
-
}, this.move = (e,
|
|
46
|
-
const { end:
|
|
47
|
-
return this.activeRange !== "end" ?
|
|
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:
|
|
61
|
-
|
|
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:
|
|
67
|
-
|
|
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 =
|
|
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
|
|
76
|
-
this.navigate(e,
|
|
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(
|
|
79
|
+
this.navigate(C.NextView, this.focusedDate);
|
|
80
80
|
}, this.handleKeyDown = (e) => {
|
|
81
|
-
const { keyCode:
|
|
82
|
-
if (
|
|
83
|
-
const n =
|
|
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 ||
|
|
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 =
|
|
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 (
|
|
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((
|
|
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
|
|
136
|
+
const t = m(e.value), l = this.bus.canMoveDown(this.state.activeView);
|
|
115
137
|
if (this.props.disabled)
|
|
116
138
|
return;
|
|
117
|
-
if (
|
|
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:
|
|
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 =
|
|
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
|
|
134
|
-
n.forEach((
|
|
135
|
-
|
|
136
|
-
}),
|
|
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 = [
|
|
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 =
|
|
167
|
+
o = m(e.value);
|
|
146
168
|
break;
|
|
147
169
|
}
|
|
148
|
-
this.valueDuringOnChange = o, e.isTodayClick && this.setState({ navigateDate:
|
|
149
|
-
const { onChange:
|
|
150
|
-
if (
|
|
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
|
-
|
|
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 ||
|
|
162
|
-
|
|
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
|
-
),
|
|
166
|
-
i.focusedDate ||
|
|
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:
|
|
173
|
-
focusedDate:
|
|
174
|
-
navigateDate:
|
|
175
|
-
}, this.activeRangeEnd =
|
|
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
|
|
221
|
+
return m(this._focusedDate);
|
|
200
222
|
}
|
|
201
223
|
get min() {
|
|
202
|
-
return
|
|
224
|
+
return g(this.props.min !== void 0 ? this.props.min : d.defaultProps.min);
|
|
203
225
|
}
|
|
204
226
|
get max() {
|
|
205
|
-
return
|
|
227
|
+
return g(this.props.max !== void 0 ? this.props.max : d.defaultProps.max);
|
|
206
228
|
}
|
|
207
229
|
get bottomView() {
|
|
208
|
-
return
|
|
230
|
+
return M[this.props.bottomView !== void 0 ? this.props.bottomView : d.defaultProps.bottomView];
|
|
209
231
|
}
|
|
210
232
|
get topView() {
|
|
211
|
-
return
|
|
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
|
|
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 =
|
|
231
|
-
this.calculateFocusFromValue = !!(this.selectedDate && i && this.selectedDate.getTime() && i.getTime()), this.lastView = this.state.activeView, this.lastViewsCount = this.props.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 =
|
|
238
|
-
const i =
|
|
239
|
-
this.service = this.bus.service(i, this.intl), this.selectedDate =
|
|
240
|
-
const a =
|
|
241
|
-
this._focusedDate =
|
|
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
|
|
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
|
-
),
|
|
253
|
-
(!o ||
|
|
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 ||
|
|
277
|
+
this.props.views || E.defaultProps.views
|
|
256
278
|
));
|
|
257
|
-
const n =
|
|
258
|
-
return /* @__PURE__ */
|
|
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: (
|
|
262
|
-
this._element =
|
|
283
|
+
ref: (u) => {
|
|
284
|
+
this._element = u;
|
|
263
285
|
},
|
|
264
|
-
className:
|
|
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__ */
|
|
278
|
-
|
|
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__ */
|
|
291
|
-
|
|
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 ?
|
|
318
|
+
svgIcon: this.isRtl ? B : L,
|
|
297
319
|
fillMode: "flat",
|
|
298
|
-
title:
|
|
299
|
-
disabled:
|
|
320
|
+
title: R,
|
|
321
|
+
disabled: V,
|
|
300
322
|
onClick: this.handlePrevButtonClick,
|
|
301
323
|
...e
|
|
302
324
|
}
|
|
303
|
-
), /* @__PURE__ */
|
|
304
|
-
|
|
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__ */
|
|
312
|
-
|
|
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 ?
|
|
339
|
+
svgIcon: this.isRtl ? L : B,
|
|
318
340
|
fillMode: "flat",
|
|
319
|
-
title:
|
|
320
|
-
disabled:
|
|
341
|
+
title: I,
|
|
342
|
+
disabled: b,
|
|
321
343
|
onClick: this.handleNextButtonClick,
|
|
322
|
-
...
|
|
344
|
+
...t
|
|
323
345
|
}
|
|
324
346
|
))
|
|
325
347
|
}
|
|
326
348
|
),
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
|
|
349
|
+
/* @__PURE__ */ p.createElement(
|
|
350
|
+
E,
|
|
329
351
|
{
|
|
330
|
-
ref: (
|
|
331
|
-
this.calendarViewList =
|
|
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:
|
|
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 &&
|
|
386
|
+
return !!a && te(a) <= i && i <= se(a);
|
|
363
387
|
}
|
|
364
388
|
};
|
|
365
|
-
|
|
366
|
-
activeRangeEnd:
|
|
367
|
-
allowReverse:
|
|
368
|
-
bottomView:
|
|
369
|
-
className:
|
|
370
|
-
defaultActiveView:
|
|
371
|
-
defaultValue:
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
start:
|
|
376
|
-
end:
|
|
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:
|
|
380
|
-
focusedDate:
|
|
381
|
-
id:
|
|
382
|
-
weekDaysFormat:
|
|
383
|
-
ariaLabelledBy:
|
|
384
|
-
ariaDescribedBy:
|
|
385
|
-
max:
|
|
386
|
-
min:
|
|
387
|
-
mode:
|
|
388
|
-
onBlur:
|
|
389
|
-
onChange:
|
|
390
|
-
onFocus:
|
|
391
|
-
tabIndex:
|
|
392
|
-
topView:
|
|
393
|
-
value:
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
start:
|
|
398
|
-
end:
|
|
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,
|
|
402
|
-
const
|
|
403
|
-
return
|
|
404
|
-
`Invalid prop '${a}' supplied to'${
|
|
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:
|
|
408
|
-
showOtherMonthDays:
|
|
409
|
-
dir:
|
|
410
|
-
},
|
|
431
|
+
weekNumber: s.bool,
|
|
432
|
+
showOtherMonthDays: s.bool,
|
|
433
|
+
dir: s.string
|
|
434
|
+
}, d.defaultProps = {
|
|
411
435
|
disabled: !1,
|
|
412
|
-
min:
|
|
413
|
-
max:
|
|
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
|
|
426
|
-
const
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
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
|
-
|
|
432
|
-
|
|
433
|
-
|
|
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"),
|
|
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;
|