@progress/kendo-react-dateinputs 9.5.0-develop.6 → 10.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 +47 -48
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +103 -101
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +30 -32
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +47 -49
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +28 -28
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +53 -54
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +3 -0
- package/index.d.ts +3 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +77 -77
|
@@ -5,33 +5,34 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
8
|
+
import * as d from "react";
|
|
9
9
|
import s from "prop-types";
|
|
10
10
|
import { provideIntlService as j, provideLocalizationService as G, registerForIntl as X, registerForLocalization as q } from "@progress/kendo-react-intl";
|
|
11
|
-
import { Keys as O,
|
|
12
|
-
import { isEqualDate as
|
|
13
|
-
import { Button as
|
|
14
|
-
import { chevronRightIcon as
|
|
15
|
-
import { Action as
|
|
16
|
-
import { CalendarViewEnum as
|
|
17
|
-
import { EMPTY_SELECTIONRANGE as
|
|
18
|
-
import { Header as
|
|
19
|
-
import { dateInRange as
|
|
20
|
-
import { prevView as K, messages as Y, nextView as
|
|
21
|
-
import { BusViewService as
|
|
22
|
-
import { NavigationService as
|
|
11
|
+
import { Keys as O, validatePackage as J, classNames as Q, WatermarkOverlay as Z, createPropsContext as ee, withIdHOC as te, withPropsContext as se } from "@progress/kendo-react-common";
|
|
12
|
+
import { isEqualDate as P, addDays as M, cloneDate as m, getDate as g, firstDayOfMonth as ie, lastDayOfMonth as ae } from "@progress/kendo-date-math";
|
|
13
|
+
import { Button as N } from "@progress/kendo-react-buttons";
|
|
14
|
+
import { chevronRightIcon as L, chevronLeftIcon as B } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { Action as k } from "../models/NavigationAction.mjs";
|
|
16
|
+
import { CalendarViewEnum as A } from "../models/CalendarViewEnum.mjs";
|
|
17
|
+
import { EMPTY_SELECTIONRANGE as H } from "../models/SelectionRange.mjs";
|
|
18
|
+
import { Header as ne } from "./Header.mjs";
|
|
19
|
+
import { dateInRange as x, getToday as F, viewInRange as _, nullable as D, MIN_DATE as oe, MAX_DATE as re, isInRange as T } from "../../utils.mjs";
|
|
20
|
+
import { prevView as K, messages as Y, nextView as W } from "../../messages/index.mjs";
|
|
21
|
+
import { BusViewService as le } from "../services/BusViewService.mjs";
|
|
22
|
+
import { NavigationService as he } from "../services/NavigationService.mjs";
|
|
23
23
|
import { HorizontalViewList as E } from "./HorizontalViewList.mjs";
|
|
24
|
-
import { TodayCommand as
|
|
25
|
-
|
|
24
|
+
import { TodayCommand as ce } from "./TodayCommand.mjs";
|
|
25
|
+
import { packageMetadata as de } from "../../package-metadata.mjs";
|
|
26
|
+
const S = (l = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Date && !Array.isArray(a) && T(g(a), l, i) ? g(a) : null, z = (l = v.defaultProps.min, i = v.defaultProps.max, a) => Array.isArray(a) ? a.filter((c) => T(c, l, i)).map((c) => g(c)) : null, U = (l) => typeof l == "object" && !(l instanceof Date) && l !== null && !Array.isArray(l) ? l : H, $ = (l, i, a) => l || i && i[0] || a && a.start, ue = (l, i) => l.start === null && i === null ? "start" : l.end === null ? "end" : "start", u = class u extends d.Component {
|
|
26
27
|
constructor(i) {
|
|
27
|
-
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 = H, 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.showLicenseWatermark = !1, this.focus = () => {
|
|
28
29
|
this._element && this._element.focus();
|
|
29
30
|
}, this.clampRange = (e) => ({ start: e, end: null }), this.rangeWithFocused = (e, t) => ({
|
|
30
31
|
start: e.start,
|
|
31
32
|
end: e.end === null && e.start !== null && this.isActive ? t : e.end
|
|
32
33
|
}), this.generateRange = (e, t) => {
|
|
33
|
-
const { end:
|
|
34
|
-
return !this.props.allowReverse && h ? { start: e, end: this.selectedRange.start } : this.activeRange !== "end" ? { start: e, end:
|
|
34
|
+
const { end: r, 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: r } : { start: o || this.selectedDate, end: e };
|
|
35
36
|
}, this.canNavigate = (e) => {
|
|
36
37
|
if (!this.service)
|
|
37
38
|
return !1;
|
|
@@ -39,11 +40,11 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
39
40
|
return this.min <= t && t <= this.max || this.service.isInSameView(t, this.min) || this.service.isInSameView(t, this.max);
|
|
40
41
|
}, this.navigate = (e, t) => {
|
|
41
42
|
this.calculateFocusFromValue = !1;
|
|
42
|
-
const
|
|
43
|
-
this.setState({ navigateDate:
|
|
44
|
-
}, this.move = (e, t) => this.clampDate(this.service.move(t, e)), this.clampDate = (e) =>
|
|
45
|
-
const { end:
|
|
46
|
-
return this.activeRange !== "end" ?
|
|
43
|
+
const r = this.move(e, t);
|
|
44
|
+
this.setState({ navigateDate: r, focusedDate: r });
|
|
45
|
+
}, this.move = (e, t) => this.clampDate(this.service.move(t, e)), this.clampDate = (e) => x(e, this.min, this.max), this.shouldAutoCorrect = (e, t) => {
|
|
46
|
+
const { end: r, start: o } = t;
|
|
47
|
+
return this.activeRange !== "end" ? r !== null && e > r : o !== null && e < o;
|
|
47
48
|
}, this.handleCellEnter = (e) => {
|
|
48
49
|
this.props.mode === "range" && (this.calculateFocusFromValue = !1, this.setState({
|
|
49
50
|
focusedDate: e
|
|
@@ -67,7 +68,7 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
67
68
|
}, this.handleTodayClick = (e) => {
|
|
68
69
|
this.todayIsInRange && this.handleDateChange(e);
|
|
69
70
|
}, this.handlePrevButtonClick = () => {
|
|
70
|
-
const e =
|
|
71
|
+
const e = k.PrevView;
|
|
71
72
|
if (this.state.activeView > 0 && this.focusedDate.getFullYear() > this.dates[0].getFullYear())
|
|
72
73
|
this.navigate(e, this.move(e, this.focusedDate));
|
|
73
74
|
else {
|
|
@@ -75,14 +76,14 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
75
76
|
this.navigate(e, t);
|
|
76
77
|
}
|
|
77
78
|
}, this.handleNextButtonClick = () => {
|
|
78
|
-
this.navigate(
|
|
79
|
+
this.navigate(k.NextView, this.focusedDate);
|
|
79
80
|
}, this.handleKeyDown = (e) => {
|
|
80
|
-
const { keyCode:
|
|
81
|
-
if (
|
|
82
|
-
const n =
|
|
81
|
+
const { keyCode: r, ctrlKey: o, metaKey: h } = e;
|
|
82
|
+
if (r === 84) {
|
|
83
|
+
const n = F();
|
|
83
84
|
this.calculateFocusFromValue = !1, this.setState({ focusedDate: n, navigateDate: n });
|
|
84
85
|
}
|
|
85
|
-
if ((o || h) && (
|
|
86
|
+
if ((o || h) && (r === O.left && this.handlePrevButtonClick(), r === O.right && this.handleNextButtonClick()), r === O.enter) {
|
|
86
87
|
const n = {
|
|
87
88
|
syntheticEvent: e,
|
|
88
89
|
nativeEvent: e.nativeEvent,
|
|
@@ -91,7 +92,7 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
91
92
|
};
|
|
92
93
|
this.handleDateChange(n);
|
|
93
94
|
} else {
|
|
94
|
-
const n =
|
|
95
|
+
const n = x(
|
|
95
96
|
this.navigation.move(
|
|
96
97
|
this.focusedDate,
|
|
97
98
|
this.navigation.action(e),
|
|
@@ -102,40 +103,40 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
102
103
|
this.min,
|
|
103
104
|
this.max
|
|
104
105
|
);
|
|
105
|
-
if (
|
|
106
|
+
if (P(this.focusedDate, n))
|
|
106
107
|
return;
|
|
107
108
|
this.dates && this.service && !this.service.isInArray(n, this.dates) && this.setState({ navigateDate: n }), this.calculateFocusFromValue = !1, this.setState({ focusedDate: n });
|
|
108
109
|
}
|
|
109
110
|
e.preventDefault();
|
|
110
111
|
}, this.handleViewChange = ({ view: e }) => {
|
|
111
112
|
this.calculateFocusFromValue = !1, this.setState((t) => ({ activeView: e, navigateDate: t.focusedDate }));
|
|
112
|
-
}, this.handleWeekSelection = (e, t,
|
|
113
|
+
}, this.handleWeekSelection = (e, t, r) => {
|
|
113
114
|
if (this.props.mode === "single")
|
|
114
115
|
return;
|
|
115
|
-
const o = 0, h = 6, n = t === o ? e :
|
|
116
|
+
const o = 0, h = 6, n = t === o ? e : M(e, -t), p = t === h ? e : M(e, h - t);
|
|
116
117
|
let f = null;
|
|
117
118
|
if (this.props.mode === "multiple") {
|
|
118
119
|
f = [];
|
|
119
120
|
for (let y = o; y <= h; y++)
|
|
120
|
-
f.push(
|
|
121
|
+
f.push(M(n, y));
|
|
121
122
|
this.setState({ value: f, focusedDate: e });
|
|
122
123
|
}
|
|
123
|
-
this.props.mode === "range" && (f = { start: n, end:
|
|
124
|
-
const { onChange:
|
|
125
|
-
if (
|
|
124
|
+
this.props.mode === "range" && (f = { start: n, end: p }, this.setState({ value: f, focusedDate: e }));
|
|
125
|
+
const { onChange: C } = this.props;
|
|
126
|
+
if (C) {
|
|
126
127
|
const y = {
|
|
127
|
-
syntheticEvent:
|
|
128
|
-
nativeEvent:
|
|
128
|
+
syntheticEvent: r,
|
|
129
|
+
nativeEvent: r.nativeEvent,
|
|
129
130
|
value: f,
|
|
130
131
|
target: this
|
|
131
132
|
};
|
|
132
|
-
|
|
133
|
+
C.call(void 0, y);
|
|
133
134
|
}
|
|
134
135
|
}, this.handleDateChange = (e) => {
|
|
135
|
-
const t = m(e.value),
|
|
136
|
+
const t = m(e.value), r = this.bus.canMoveDown(this.state.activeView);
|
|
136
137
|
if (this.props.disabled)
|
|
137
138
|
return;
|
|
138
|
-
if (
|
|
139
|
+
if (r)
|
|
139
140
|
if (e.isTodayClick)
|
|
140
141
|
this.bus.moveToBottom(this.state.activeView);
|
|
141
142
|
else {
|
|
@@ -151,10 +152,10 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
151
152
|
case "multiple":
|
|
152
153
|
if (Array.isArray(this.selectedMultiple)) {
|
|
153
154
|
const n = this.selectedMultiple.slice();
|
|
154
|
-
let
|
|
155
|
-
n.forEach((f,
|
|
156
|
-
|
|
157
|
-
}),
|
|
155
|
+
let p = -1;
|
|
156
|
+
n.forEach((f, C) => {
|
|
157
|
+
P(f, e.value) && (p = C);
|
|
158
|
+
}), p !== -1 ? n.splice(p, 1) : n.push(m(e.value)), o = n.slice();
|
|
158
159
|
} else
|
|
159
160
|
this.selectedDate ? o = [m(this.selectedDate), m(e.value)] : o = [m(e.value)];
|
|
160
161
|
break;
|
|
@@ -178,18 +179,18 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
178
179
|
h.call(void 0, n);
|
|
179
180
|
}
|
|
180
181
|
this.valueDuringOnChange = void 0;
|
|
181
|
-
};
|
|
182
|
-
const a = i.value !== void 0 ? i.value : i.defaultValue ||
|
|
183
|
-
|
|
182
|
+
}, this.showLicenseWatermark = !J(de, { component: "MultiViewCalendar" });
|
|
183
|
+
const a = i.value !== void 0 ? i.value : i.defaultValue || u.defaultProps.defaultValue, c = S(this.min, this.max, a), w = z(this.min, this.max, a), R = U(a), I = $(c, w, R), V = _(
|
|
184
|
+
A[i.defaultActiveView],
|
|
184
185
|
this.bottomView,
|
|
185
186
|
this.topView
|
|
186
|
-
), b =
|
|
187
|
+
), b = x(i.focusedDate || I || F(), this.min, this.max);
|
|
187
188
|
this.state = {
|
|
188
189
|
value: a,
|
|
189
190
|
activeView: V,
|
|
190
191
|
focusedDate: b,
|
|
191
192
|
navigateDate: b
|
|
192
|
-
}, this.activeRangeEnd =
|
|
193
|
+
}, this.activeRangeEnd = ue(R, c), this.bus = new le(this.handleViewChange), this.navigation = new he(this.bus), this.calculateFocusFromValue = !1, this.lastView = V, this.lastViewsCount = this.props.views || E.defaultProps.views;
|
|
193
194
|
}
|
|
194
195
|
get wrapperID() {
|
|
195
196
|
return this.props.id + "-wrapper-id";
|
|
@@ -217,25 +218,25 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
217
218
|
}
|
|
218
219
|
get min() {
|
|
219
220
|
return g(
|
|
220
|
-
this.props.min !== void 0 ? this.props.min :
|
|
221
|
+
this.props.min !== void 0 ? this.props.min : u.defaultProps.min
|
|
221
222
|
);
|
|
222
223
|
}
|
|
223
224
|
get max() {
|
|
224
225
|
return g(
|
|
225
|
-
this.props.max !== void 0 ? this.props.max :
|
|
226
|
+
this.props.max !== void 0 ? this.props.max : u.defaultProps.max
|
|
226
227
|
);
|
|
227
228
|
}
|
|
228
229
|
get bottomView() {
|
|
229
|
-
return
|
|
230
|
+
return A[this.props.bottomView !== void 0 ? this.props.bottomView : u.defaultProps.bottomView];
|
|
230
231
|
}
|
|
231
232
|
get topView() {
|
|
232
|
-
return
|
|
233
|
+
return A[this.props.topView !== void 0 ? this.props.topView : u.defaultProps.topView];
|
|
233
234
|
}
|
|
234
235
|
get activeRange() {
|
|
235
236
|
return this.props.activeRangeEnd !== void 0 ? this.props.activeRangeEnd : this.activeRangeEnd;
|
|
236
237
|
}
|
|
237
238
|
get todayIsInRange() {
|
|
238
|
-
return T(
|
|
239
|
+
return T(F(), g(this.min), g(this.max));
|
|
239
240
|
}
|
|
240
241
|
/**
|
|
241
242
|
* @hidden
|
|
@@ -257,30 +258,30 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
257
258
|
render() {
|
|
258
259
|
this.props._ref && this.props._ref(this), this.intl = j(this), this.localization = G(this), this.bus.configure(this.bottomView, this.topView);
|
|
259
260
|
const i = _(this.state.activeView, this.bottomView, this.topView);
|
|
260
|
-
this.service = this.bus.service(i, this.intl), this.selectedDate = S(this.min, this.max, this.value), this.selectedMultiple =
|
|
261
|
-
const a =
|
|
262
|
-
this._focusedDate =
|
|
261
|
+
this.service = this.bus.service(i, this.intl), this.selectedDate = S(this.min, this.max, this.value), this.selectedMultiple = z(this.min, this.max, this.value), this.selectedRange = U(this.value);
|
|
262
|
+
const a = $(this.selectedDate, this.selectedMultiple, this.selectedRange);
|
|
263
|
+
this._focusedDate = x(
|
|
263
264
|
this.calculateFocusFromValue && a !== null ? a : this.state.focusedDate,
|
|
264
265
|
this.min,
|
|
265
266
|
this.max
|
|
266
267
|
);
|
|
267
|
-
const c =
|
|
268
|
+
const c = Q(
|
|
268
269
|
"k-calendar k-calendar-range k-calendar-md",
|
|
269
270
|
{
|
|
270
271
|
"k-disabled": this.props.disabled
|
|
271
272
|
},
|
|
272
273
|
this.props.className
|
|
273
|
-
),
|
|
274
|
-
(!o ||
|
|
274
|
+
), w = this.rangeWithFocused(this.selectedRange, this.focusedDate), R = this.localization.toLanguageString(K, Y[K]), I = this.localization.toLanguageString(W, Y[W]), V = !this.canNavigate(k.PrevView), b = !this.canNavigate(k.NextView), e = { "aria-disabled": V }, t = { "aria-disabled": b }, r = this.lastView !== i, o = this.dates && this.isInMonth(this.state.navigateDate, this.dates[0]), h = this.lastViewsCount !== this.props.views;
|
|
275
|
+
(!o || r || h) && (this.dates = this.service.datesList(
|
|
275
276
|
this.state.navigateDate,
|
|
276
277
|
this.props.views || E.defaultProps.views
|
|
277
278
|
));
|
|
278
|
-
const n = m(this.dates && this.dates[0] ? this.dates[0] :
|
|
279
|
-
return /* @__PURE__ */
|
|
279
|
+
const n = m(this.dates && this.dates[0] ? this.dates[0] : F());
|
|
280
|
+
return /* @__PURE__ */ d.createElement(
|
|
280
281
|
"div",
|
|
281
282
|
{
|
|
282
|
-
ref: (
|
|
283
|
-
this._element =
|
|
283
|
+
ref: (p) => {
|
|
284
|
+
this._element = p;
|
|
284
285
|
},
|
|
285
286
|
className: c,
|
|
286
287
|
id: this.props.id || this.wrapperID,
|
|
@@ -295,8 +296,8 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
295
296
|
"aria-disabled": this.props.disabled,
|
|
296
297
|
dir: this.props.dir
|
|
297
298
|
},
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
-
|
|
299
|
+
/* @__PURE__ */ d.createElement(
|
|
300
|
+
ne,
|
|
300
301
|
{
|
|
301
302
|
key: `.kendo.calendar.header.${n.getTime()}`,
|
|
302
303
|
activeView: i,
|
|
@@ -308,34 +309,34 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
308
309
|
service: this.service,
|
|
309
310
|
headerTitle: this.props.headerTitle,
|
|
310
311
|
verticalView: this.props.mobileMode,
|
|
311
|
-
commands: /* @__PURE__ */
|
|
312
|
-
|
|
312
|
+
commands: /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement(
|
|
313
|
+
N,
|
|
313
314
|
{
|
|
314
315
|
type: "button",
|
|
315
316
|
className: "k-calendar-nav-prev",
|
|
316
317
|
icon: this.isRtl ? "chevron-right" : "chevron-left",
|
|
317
|
-
svgIcon: this.isRtl ?
|
|
318
|
+
svgIcon: this.isRtl ? L : B,
|
|
318
319
|
fillMode: "flat",
|
|
319
320
|
title: R,
|
|
320
321
|
disabled: V,
|
|
321
322
|
onClick: this.handlePrevButtonClick,
|
|
322
323
|
...e
|
|
323
324
|
}
|
|
324
|
-
), /* @__PURE__ */
|
|
325
|
-
|
|
325
|
+
), /* @__PURE__ */ d.createElement(
|
|
326
|
+
ce,
|
|
326
327
|
{
|
|
327
328
|
min: this.min,
|
|
328
329
|
max: this.max,
|
|
329
330
|
onClick: this.handleTodayClick,
|
|
330
331
|
disabled: !this.todayIsInRange
|
|
331
332
|
}
|
|
332
|
-
), /* @__PURE__ */
|
|
333
|
-
|
|
333
|
+
), /* @__PURE__ */ d.createElement(
|
|
334
|
+
N,
|
|
334
335
|
{
|
|
335
336
|
type: "button",
|
|
336
337
|
className: "k-calendar-nav-next",
|
|
337
338
|
icon: this.isRtl ? "chevron-left" : "chevron-right",
|
|
338
|
-
svgIcon: this.isRtl ?
|
|
339
|
+
svgIcon: this.isRtl ? B : L,
|
|
339
340
|
fillMode: "flat",
|
|
340
341
|
title: I,
|
|
341
342
|
disabled: b,
|
|
@@ -345,11 +346,11 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
345
346
|
))
|
|
346
347
|
}
|
|
347
348
|
),
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ d.createElement(
|
|
349
350
|
E,
|
|
350
351
|
{
|
|
351
|
-
ref: (
|
|
352
|
-
this.calendarViewList =
|
|
352
|
+
ref: (p) => {
|
|
353
|
+
this.calendarViewList = p;
|
|
353
354
|
},
|
|
354
355
|
dates: this.dates,
|
|
355
356
|
activeView: i,
|
|
@@ -359,7 +360,7 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
359
360
|
max: this.max,
|
|
360
361
|
bus: this.bus,
|
|
361
362
|
service: this.service,
|
|
362
|
-
selectionRange:
|
|
363
|
+
selectionRange: w,
|
|
363
364
|
value: this.selectedMultiple || this.selectedDate,
|
|
364
365
|
cellUID: this.cellUID,
|
|
365
366
|
views: this.props.views,
|
|
@@ -374,7 +375,8 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
374
375
|
showOtherMonthDays: this.props.showOtherMonthDays,
|
|
375
376
|
allowReverse: this.props.allowReverse
|
|
376
377
|
}
|
|
377
|
-
)
|
|
378
|
+
),
|
|
379
|
+
this.showLicenseWatermark && /* @__PURE__ */ d.createElement(Z, null)
|
|
378
380
|
);
|
|
379
381
|
}
|
|
380
382
|
// protected isListInRange = (list: Date[]): boolean => {
|
|
@@ -382,21 +384,21 @@ const S = (r = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
382
384
|
// && this.max > list[Math.max(0, (this.props.views || MultiViewCalendarWithoutContext.defaultProps.views) - 1)];
|
|
383
385
|
// };
|
|
384
386
|
isInMonth(i, a) {
|
|
385
|
-
return !!a &&
|
|
387
|
+
return !!a && ie(a) <= i && i <= ae(a);
|
|
386
388
|
}
|
|
387
389
|
};
|
|
388
|
-
|
|
390
|
+
u.displayName = "MultiViewCalendar", u.propTypes = {
|
|
389
391
|
activeRangeEnd: s.oneOf(["start", "end"]),
|
|
390
392
|
allowReverse: s.bool,
|
|
391
393
|
bottomView: s.oneOf(["month", "year", "decade", "century"]),
|
|
392
394
|
className: s.string,
|
|
393
395
|
defaultActiveView: s.oneOf(["month", "year", "decade", "century"]),
|
|
394
396
|
defaultValue: s.oneOfType([
|
|
395
|
-
|
|
397
|
+
D(s.instanceOf(Date)),
|
|
396
398
|
s.arrayOf(s.instanceOf(Date)),
|
|
397
399
|
s.shape({
|
|
398
|
-
start:
|
|
399
|
-
end:
|
|
400
|
+
start: D(s.instanceOf(Date)),
|
|
401
|
+
end: D(s.instanceOf(Date))
|
|
400
402
|
})
|
|
401
403
|
]),
|
|
402
404
|
disabled: s.bool,
|
|
@@ -414,26 +416,26 @@ d.displayName = "MultiViewCalendar", d.propTypes = {
|
|
|
414
416
|
tabIndex: s.number,
|
|
415
417
|
topView: s.oneOf(["month", "year", "decade", "century"]),
|
|
416
418
|
value: s.oneOfType([
|
|
417
|
-
|
|
419
|
+
D(s.instanceOf(Date)),
|
|
418
420
|
s.arrayOf(s.instanceOf(Date)),
|
|
419
421
|
s.shape({
|
|
420
|
-
start:
|
|
421
|
-
end:
|
|
422
|
+
start: D(s.instanceOf(Date).isRequired),
|
|
423
|
+
end: D(s.instanceOf(Date).isRequired)
|
|
422
424
|
})
|
|
423
425
|
]),
|
|
424
426
|
views: (i, a, c) => {
|
|
425
|
-
const
|
|
426
|
-
return
|
|
427
|
+
const w = i[a];
|
|
428
|
+
return w !== void 0 && w < 1 ? new Error(
|
|
427
429
|
`Invalid prop '${a}' supplied to'${c}'. The '${a}' property cannot be less than 1'`
|
|
428
430
|
) : null;
|
|
429
431
|
},
|
|
430
432
|
weekNumber: s.bool,
|
|
431
433
|
showOtherMonthDays: s.bool,
|
|
432
434
|
dir: s.string
|
|
433
|
-
},
|
|
435
|
+
}, u.defaultProps = {
|
|
434
436
|
disabled: !1,
|
|
435
|
-
min:
|
|
436
|
-
max:
|
|
437
|
+
min: oe,
|
|
438
|
+
max: re,
|
|
437
439
|
navigation: !0,
|
|
438
440
|
defaultActiveView: "month",
|
|
439
441
|
defaultValue: null,
|
|
@@ -445,18 +447,18 @@ d.displayName = "MultiViewCalendar", d.propTypes = {
|
|
|
445
447
|
allowReverse: !1,
|
|
446
448
|
showOtherMonthDays: !1
|
|
447
449
|
};
|
|
448
|
-
let v =
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
|
|
450
|
+
let v = u;
|
|
451
|
+
const pe = ee(), me = te(
|
|
452
|
+
se(
|
|
453
|
+
pe,
|
|
452
454
|
v
|
|
453
455
|
)
|
|
454
456
|
);
|
|
455
|
-
|
|
457
|
+
me.displayName = "KendoReactMultiViewCalendar";
|
|
456
458
|
X(v);
|
|
457
459
|
q(v);
|
|
458
460
|
export {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
+
me as MultiViewCalendar,
|
|
462
|
+
pe as MultiViewCalendarPropsContext,
|
|
461
463
|
v as MultiViewCalendarWithoutContext
|
|
462
464
|
};
|
package/dateinput/DateInput.js
CHANGED
|
@@ -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 Ve=require("react"),e=require("prop-types"),I=require("@progress/kendo-date-math"),$=require("@progress/kendo-react-buttons"),G=require("@progress/kendo-svg-icons"),Z=require("@progress/kendo-react-intl"),i=require("@progress/kendo-react-common"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ve=require("react"),e=require("prop-types"),I=require("@progress/kendo-date-math"),$=require("@progress/kendo-react-buttons"),G=require("@progress/kendo-svg-icons"),Z=require("@progress/kendo-react-intl"),i=require("@progress/kendo-react-common"),Le=require("@progress/kendo-react-labels"),Ne=require("@progress/kendo-dateinputs-common"),q=require("./utils.js"),u=require("../utils.js"),c=require("../messages/index.js"),pe=require("../timepicker/utils.js"),Ae=require("../common/ClearButton.js"),_e=require("./dateInputIntl.js");function Be(t){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const m in t)if(m!=="default"){const O=Object.getOwnPropertyDescriptor(t,m);Object.defineProperty(b,m,O.get?O:{enumerable:!0,get:()=>t[m]})}}return b.default=t,Object.freeze(b)}const a=Be(Ve),je="Please enter a valid value!",L=a.forwardRef((t,b)=>{var Y;const m=i.useId(t.id),O=Z.useInternationalization(),E=Z.useLocalization(),Q=i.useUnstyled(),N=i.usePropsContext(V,t).unstyled||Q,{format:R=r.format,size:ee=r.size,rounded:te=r.rounded,fillMode:ne=r.fillMode,formatPlaceholder:ae=r.formatPlaceholder,spinners:re=r.spinners,disabled:C=r.disabled,min:le=r.min,max:ue=r.max,minTime:ie=r.minTime,maxTime:oe=r.maxTime,validityStyles:se=r.validityStyles,validationMessage:p=r.validationMessage,placeholder:y=r.placeholder,enableMouseWheel:ce=r.enableMouseWheel,autoCorrectParts:de=r.autoCorrectParts,autoSwitchParts:fe=r.autoSwitchParts,allowCaretMode:me=r.allowCaretMode,twoDigitYearMax:ge=r.twoDigitYearMax,ariaHasPopup:ve=r.ariaHasPopup,autoFocus:be=r.autoFocus}=i.usePropsContext(V,t),g=()=>M.current!==void 0?M.current:o.current&&o.current.value,A=()=>{const n=o.current&&o.current.currentText||"",l=g();return y!=null&&!Re.focused&&!l?y:n},_=()=>t.required!==void 0?t.required:!1,P=()=>{const n=g()||t.value,l=le,X=ue,Te=q.isInRange(n,l,X)&&pe.isInTimeRange(n,ie,oe),Se=p!==void 0,ke=(!_()||n!=null)&&Te,qe=t.valid!==void 0?t.valid:ke;return{customError:Se,rangeOverflow:n&&X.getTime()<n.getTime()||!1,rangeUnderflow:n&&n.getTime()<l.getTime()||!1,valid:qe,valueMissing:n===null}},ye=()=>{s.current&&s.current.focus()},B=()=>new _e.DateInputIntl(O),x=()=>{const n=g();return{format:R,steps:t.steps,formatPlaceholder:ae,placeholder:y,selectPreviousSegmentOnBackspace:!0,value:t.value||n,intlService:B(),autoFill:t.autoFill!==void 0?t.autoFill:!1,enableMouseWheel:ce,autoCorrectParts:de,autoSwitchParts:fe,autoSwitchKeys:t.autoSwitchKeys||[],twoDigitYearMax:ge,allowCaretMode:me}},he=n=>{d.current&&d.current.classList.add("k-focus"),U({focused:!0})},De=n=>{d.current&&d.current.classList.remove("k-focus"),U({focused:!1})},Ie=(n,l)=>typeof n!=typeof l?!0:typeof n=="string"&&typeof l=="string"?n!==l:typeof n=="object"&&typeof l=="object"?JSON.stringify(n)!==JSON.stringify(l):!1,Oe=n=>typeof n=="string"?n:{inputFormat:n,displayFormat:n},j=n=>{M.current=g(),Pe(),v.current=n,M.current=void 0},F=n=>{t.onChange&&t.onChange(n)},H=n=>{i.getActiveElement(document)===s.current&&n.preventDefault()},Ee=()=>new Ne.DateInput(s.current,{...x(),format:Oe(x().format),events:{focus:he,blur:De,valueChange:j,click:F}}),z=()=>{s.current&&s.current.setCustomValidity&&s.current.setCustomValidity(P().valid?"":p||r.validationMessage)},Ce=n=>{!s.current||!o.current||j(n)},xe=n=>{n.preventDefault();const l=i.getActiveElement(document);s.current&&l!==s.current&&s.current.focus({preventScroll:!0})},f=n=>{const l=g();v.current&&t.onChange&&!I.isEqual(v.current.oldValue,l)&&t.onChange.call(void 0,{syntheticEvent:n,nativeEvent:v.current.event,value:v.current.value,target:w.current}),v.current=null},we=n=>{var l;(l=o.current)==null||l.modifyDateSegmentValue(1),f(n)},Me=n=>{var l;(l=o.current)==null||l.modifyDateSegmentValue(-1),f(n)},w=a.useRef(null),s=a.useRef(null),d=a.useRef(null);a.useImperativeHandle(w,()=>({props:t,get options(){return x()},get text(){return A()},get element(){return s.current},get name(){return t.name},get value(){return g()},get validity(){return P()},focus:ye,updateOnPaste:Ce})),a.useImperativeHandle(b,()=>w.current);const o=a.useRef(null),T=a.useRef(null),S=a.useRef(!1),M=a.useRef(null),v=a.useRef(null),h=a.useRef(t),[Re,U]=a.useState({focused:!1}),[,Pe]=a.useReducer(n=>n+1,0);a.useLayoutEffect(()=>{S.current||(o.current=Ee(),T.current=o.current.dateObject,S.current=!0)},[]),a.useEffect(()=>(z(),S.current||d.current&&d.current.addEventListener("wheel",H,{passive:!1}),()=>{d.current&&d.current.removeEventListener("wheel",H)}),[]),a.useEffect(()=>{z(),o.current&&((Ie(h.current.format,R)||h.current.readonly!==t.readonly||JSON.stringify(h.current.steps)!==JSON.stringify(t.steps)||B().locale!==o.current.options.intlService.locale)&&o.current.setOptions(x(),!0),h.current.value!==t.value&&(T.current.getValue()!==null||t.value!==null)&&T.current.setValue(t.value),t.ariaExpanded!==void 0&&t.ariaExpanded&&(o.current.options.placeholder=null),t.ariaExpanded!==void 0&&!t.ariaExpanded&&(o.current.options.placeholder=y),o.current.refreshElementValue(),h.current={format:R,readonly:t.readonly,ariaExpanded:t.ariaExpanded,steps:t.steps,value:t.value})});const W=t.id||m+"-accessibility-id",D=N&&N.uDateInput,K=A(),k=!se||P().valid;a.useImperativeHandle(t._ref,()=>w.current);const J=a.createElement("span",{ref:n=>d.current=n,style:t.label?void 0:{width:t.width},dir:t.dir,className:i.classNames(i.uDateInput.wrapper({c:D,size:ee,fillMode:ne,rounded:te,disabled:C,required:_(),invalid:!k}),t.className)},a.createElement("input",{ref:n=>s.current=n,role:t.ariaRole||"textbox",readOnly:t.readonly,tabIndex:t.tabIndex||0,disabled:C,title:t.title!==void 0?t.title:K,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:be,className:i.classNames(i.uDateInput.inputInner({c:D})),id:W,value:K,"aria-label":t.ariaLabel,"aria-labelledby":t.ariaLabelledBy,"aria-describedby":t.ariaDescribedBy,"aria-haspopup":ve,"aria-disabled":C,"aria-expanded":t.ariaExpanded,"aria-controls":t.ariaControls,"aria-required":t.required,"aria-invalid":!k,onKeyDown:f,onChange:f,onWheel:f,onInput:f,onClick:f,name:t.name,...t.inputAttributes}),t.children,t.clearButton&&t.value&&a.createElement(Ae,{onClick:F,key:"clearbutton"}),re&&a.createElement("span",{className:i.classNames(i.uDateInput.inputSpinner({c:D})),onMouseDown:xe},a.createElement($.Button,{tabIndex:-1,type:"button",rounded:null,className:i.classNames(i.uDateInput.spinnerIncrease({c:D})),icon:"caret-alt-up",svgIcon:G.caretAltUpIcon,"aria-label":E.toLanguageString(c.increaseValue,c.messages[c.increaseValue]),title:E.toLanguageString(c.increaseValue,c.messages[c.increaseValue]),onClick:we}),a.createElement($.Button,{tabIndex:-1,type:"button",rounded:null,className:i.classNames(i.uDateInput.spinnerDecrease({c:D})),icon:"caret-alt-down",svgIcon:G.caretAltDownIcon,"aria-label":E.toLanguageString(c.decreaseValue,c.messages[c.decreaseValue]),title:E.toLanguageString(c.decreaseValue,c.messages[c.decreaseValue]),onClick:Me})));return t.label?a.createElement(Le.FloatingLabel,{label:t.label,editorId:W,editorValue:(Y=s.current)==null?void 0:Y.value,editorValid:k,editorDisabled:C,children:J,style:{width:t.width}}):J});L.propTypes={value:e.instanceOf(Date),format:e.oneOfType([u.nullable(e.string),e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([u.nullable(e.oneOf(["wide","narrow","short","formatPattern"])),e.shape({year:u.nullable(e.string),month:u.nullable(e.string),day:u.nullable(e.string),hour:u.nullable(e.string),minute:u.nullable(e.string),second:u.nullable(e.string)})]),width:e.oneOfType([e.string,e.number]),tabIndex:e.number,title:e.string,steps:e.shape({year:u.nullable(e.number),month:u.nullable(e.number),day:u.nullable(e.number),hour:u.nullable(e.number),minute:u.nullable(e.number),second:u.nullable(e.number)}),min:e.instanceOf(Date),max:e.instanceOf(Date),disabled:e.bool,spinners:e.bool,name:e.string,dir:e.string,label:e.string,id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,ariaLabel:e.string,ariaRole:e.string,ariaHasPopup:e.oneOfType([e.bool,e.oneOf(["grid","dialog"])]),ariaExpanded:e.oneOfType([e.bool]),onChange:e.func,validationMessage:e.string,required:e.bool,valid:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object};const r={format:q.DEFAULT_FORMAT,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:q.DEFAULT_FORMAT_PLACEHOLDER,spinners:!1,disabled:!1,max:I.cloneDate(u.MAX_DATE),min:I.cloneDate(u.MIN_DATE),minTime:I.cloneDate(u.MIN_TIME),maxTime:I.cloneDate(u.MAX_TIME),validityStyles:!0,validationMessage:je,placeholder:null,enableMouseWheel:!0,autoCorrectParts:!0,autoSwitchParts:!0,allowCaretMode:!1,twoDigitYearMax:68,ariaHasPopup:"grid",autoFocus:!1},V=i.createPropsContext();L.displayName="KendoReactDateInput";exports.DateInput=L;exports.DateInputPropsContext=V;exports.dateInputDefaultProps=r;
|