@progress/kendo-react-dateinputs 7.5.0-develop.9 → 8.0.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.js +2 -2
- package/calendar/components/Calendar.mjs +46 -40
- package/calendar/components/CalendarCell.js +1 -1
- package/calendar/components/CalendarCell.mjs +53 -49
- package/calendar/components/CalendarWeekCell.js +1 -1
- package/calendar/components/CalendarWeekCell.mjs +12 -10
- package/calendar/components/Header.js +1 -1
- package/calendar/components/Header.mjs +20 -19
- package/calendar/components/HorizontalViewList.js +1 -1
- package/calendar/components/HorizontalViewList.mjs +37 -29
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +153 -123
- package/calendar/components/TodayCommand.js +1 -1
- package/calendar/components/TodayCommand.mjs +1 -1
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +56 -48
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +47 -45
- package/calendar/services/MonthViewService.js +1 -1
- package/calendar/services/MonthViewService.mjs +14 -16
- package/calendar/services/WeekNamesService.js +1 -1
- package/calendar/services/WeekNamesService.mjs +5 -5
- 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/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +3 -0
- 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 +80 -7
- package/index.d.ts +80 -7
- package/messages/index.js +1 -1
- package/messages/index.mjs +38 -36
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +5 -6
- package/virtualization/services/RowHeightService.js +0 -8
- package/virtualization/services/RowHeightService.mjs +0 -50
|
@@ -6,33 +6,33 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as p from "react";
|
|
10
10
|
import s from "prop-types";
|
|
11
|
-
import { provideIntlService as
|
|
12
|
-
import { Keys as
|
|
13
|
-
import { isEqualDate 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
|
|
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
30
|
}, this.clampRange = (e) => ({ start: e, end: null }), this.rangeWithFocused = (e, t) => ({
|
|
31
31
|
start: e.start,
|
|
32
32
|
end: e.end === null && e.start !== null && this.isActive ? t : e.end
|
|
33
33
|
}), this.generateRange = (e, t) => {
|
|
34
|
-
const { end:
|
|
35
|
-
return !this.props.allowReverse &&
|
|
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;
|
|
@@ -40,11 +40,11 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
40
40
|
return this.min <= t && t <= this.max || this.service.isInSameView(t, this.min) || this.service.isInSameView(t, this.max);
|
|
41
41
|
}, this.navigate = (e, t) => {
|
|
42
42
|
this.calculateFocusFromValue = !1;
|
|
43
|
-
const
|
|
44
|
-
this.setState({ navigateDate:
|
|
45
|
-
}, this.move = (e, t) => this.clampDate(this.service.move(t, e)), this.clampDate = (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
|
|
@@ -68,7 +68,7 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
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 {
|
|
@@ -76,14 +76,14 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
76
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 ((
|
|
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 k = (o = 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,18 +103,40 @@ const k = (o = 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
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 t =
|
|
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 {
|
|
@@ -122,57 +144,57 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
122
144
|
return;
|
|
123
145
|
}
|
|
124
146
|
this.calculateFocusFromValue = !0;
|
|
125
|
-
let
|
|
147
|
+
let o;
|
|
126
148
|
switch (this.props.mode) {
|
|
127
149
|
case "single":
|
|
128
|
-
|
|
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 ?
|
|
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
|
-
|
|
167
|
+
o = m(e.value);
|
|
146
168
|
break;
|
|
147
169
|
}
|
|
148
|
-
this.valueDuringOnChange =
|
|
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
|
-
value:
|
|
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 k = (o = 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 k = (o = 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
|
-
(!
|
|
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 k = (o = 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,67 +309,71 @@ const k = (o = 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,
|
|
335
357
|
focusedDate: this.focusedDate,
|
|
358
|
+
weekDaysFormat: this.props.weekDaysFormat,
|
|
336
359
|
min: this.min,
|
|
337
360
|
max: this.max,
|
|
338
361
|
bus: this.bus,
|
|
339
362
|
service: this.service,
|
|
340
|
-
selectionRange:
|
|
363
|
+
selectionRange: D,
|
|
341
364
|
value: this.selectedMultiple || this.selectedDate,
|
|
342
365
|
cellUID: this.cellUID,
|
|
343
366
|
views: this.props.views,
|
|
344
367
|
onChange: this.handleDateChange,
|
|
368
|
+
onWeekSelect: this.handleWeekSelection,
|
|
345
369
|
showWeekNumbers: this.props.weekNumber,
|
|
346
370
|
onCellEnter: this.handleCellEnter,
|
|
347
371
|
cell: this.props.cell,
|
|
348
372
|
weekCell: this.props.weekCell,
|
|
349
373
|
headerTitle: this.props.headerTitle,
|
|
350
|
-
verticalView: this.props.mobileMode
|
|
374
|
+
verticalView: this.props.mobileMode,
|
|
375
|
+
showOtherMonthDays: this.props.showOtherMonthDays,
|
|
376
|
+
allowReverse: this.props.allowReverse
|
|
351
377
|
}
|
|
352
378
|
)
|
|
353
379
|
);
|
|
@@ -357,26 +383,27 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
357
383
|
// && this.max > list[Math.max(0, (this.props.views || MultiViewCalendarWithoutContext.defaultProps.views) - 1)];
|
|
358
384
|
// };
|
|
359
385
|
isInMonth(i, a) {
|
|
360
|
-
return !!a &&
|
|
386
|
+
return !!a && te(a) <= i && i <= se(a);
|
|
361
387
|
}
|
|
362
388
|
};
|
|
363
|
-
|
|
389
|
+
d.displayName = "MultiViewCalendar", d.propTypes = {
|
|
364
390
|
activeRangeEnd: s.oneOf(["start", "end"]),
|
|
365
391
|
allowReverse: s.bool,
|
|
366
392
|
bottomView: s.oneOf(["month", "year", "decade", "century"]),
|
|
367
393
|
className: s.string,
|
|
368
394
|
defaultActiveView: s.oneOf(["month", "year", "decade", "century"]),
|
|
369
395
|
defaultValue: s.oneOfType([
|
|
370
|
-
|
|
396
|
+
w(s.instanceOf(Date)),
|
|
371
397
|
s.arrayOf(s.instanceOf(Date)),
|
|
372
398
|
s.shape({
|
|
373
|
-
start:
|
|
374
|
-
end:
|
|
399
|
+
start: w(s.instanceOf(Date)),
|
|
400
|
+
end: w(s.instanceOf(Date))
|
|
375
401
|
})
|
|
376
402
|
]),
|
|
377
403
|
disabled: s.bool,
|
|
378
404
|
focusedDate: s.instanceOf(Date),
|
|
379
405
|
id: s.string,
|
|
406
|
+
weekDaysFormat: s.oneOf(["narrow", "short", "abbreviated"]),
|
|
380
407
|
ariaLabelledBy: s.string,
|
|
381
408
|
ariaDescribedBy: s.string,
|
|
382
409
|
max: s.instanceOf(Date),
|
|
@@ -388,41 +415,44 @@ c.displayName = "MultiViewCalendar", c.propTypes = {
|
|
|
388
415
|
tabIndex: s.number,
|
|
389
416
|
topView: s.oneOf(["month", "year", "decade", "century"]),
|
|
390
417
|
value: s.oneOfType([
|
|
391
|
-
|
|
418
|
+
w(s.instanceOf(Date)),
|
|
392
419
|
s.arrayOf(s.instanceOf(Date)),
|
|
393
420
|
s.shape({
|
|
394
|
-
start:
|
|
395
|
-
end:
|
|
421
|
+
start: w(s.instanceOf(Date).isRequired),
|
|
422
|
+
end: w(s.instanceOf(Date).isRequired)
|
|
396
423
|
})
|
|
397
424
|
]),
|
|
398
|
-
views: (i, a,
|
|
399
|
-
const
|
|
400
|
-
return
|
|
401
|
-
`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'`
|
|
402
429
|
) : null;
|
|
403
430
|
},
|
|
404
431
|
weekNumber: s.bool,
|
|
432
|
+
showOtherMonthDays: s.bool,
|
|
405
433
|
dir: s.string
|
|
406
|
-
},
|
|
434
|
+
}, d.defaultProps = {
|
|
407
435
|
disabled: !1,
|
|
408
|
-
min:
|
|
409
|
-
max:
|
|
436
|
+
min: ae,
|
|
437
|
+
max: ne,
|
|
410
438
|
navigation: !0,
|
|
411
439
|
defaultActiveView: "month",
|
|
412
440
|
defaultValue: null,
|
|
413
441
|
topView: "century",
|
|
442
|
+
weekDaysFormat: "short",
|
|
414
443
|
tabIndex: 0,
|
|
415
444
|
bottomView: "month",
|
|
416
445
|
views: 2,
|
|
417
|
-
allowReverse: !1
|
|
446
|
+
allowReverse: !1,
|
|
447
|
+
showOtherMonthDays: !1
|
|
418
448
|
};
|
|
419
|
-
let
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
449
|
+
let v = d;
|
|
450
|
+
const ce = Q(), de = Z(ee(ce, v));
|
|
451
|
+
de.displayName = "KendoReactMultiViewCalendar";
|
|
452
|
+
X(v);
|
|
453
|
+
q(v);
|
|
424
454
|
export {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
455
|
+
de as MultiViewCalendar,
|
|
456
|
+
ce as MultiViewCalendarPropsContext,
|
|
457
|
+
v as MultiViewCalendarWithoutContext
|
|
428
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 p=require("react"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),a=require("prop-types"),d=require("@progress/kendo-react-intl"),m=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-buttons"),l=require("@progress/kendo-date-math"),r=require("../../messages/index.js"),i=require("../../utils.js");function h(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,c.get?c:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=h(p),n=class n extends u.Component{constructor(){super(...arguments),this.localization=null,this.handleClick=e=>{if(this.todayIsInRange&&this.props.onClick){const t={syntheticEvent:e,nativeEvent:e.nativeEvent,value:i.dateInRange(i.getToday(),this.min,this.max),target:this,isTodayClick:!0};this.props.onClick.call(void 0,t)}}}get min(){return this.props.min!==void 0?this.props.min:n.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:n.defaultProps.max}get todayIsInRange(){return i.isInRange(i.getToday(),l.getDate(this.min),l.getDate(this.max))}render(){this.localization=d.provideLocalizationService(this);const e=this.localization.toLanguageString(r.today,r.messages[r.today]),t=m.classNames("k-calendar-nav-today",{"k-disabled":this.props.disabled});return u.createElement(g.Button,{className:t,onClick:this.handleClick,tabIndex:this.props.tabIndex,fillMode:"flat",themeColor:"base",role:"link"},e)}};n.propTypes={max:a.instanceOf(Date).isRequired,min:a.instanceOf(Date).isRequired,onClick:a.func,disabled:a.bool},n.defaultProps={min:i.MIN_DATE,max:i.MAX_DATE};let o=n;d.registerForLocalization(o);exports.TodayCommand=o;
|
|
@@ -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
|
|
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;
|