@progress/kendo-react-dateinputs 14.4.0-develop.1 → 14.4.0-develop.11
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/NOTICE.txt +366 -82
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +36 -36
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +1 -1
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +10 -10
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +1 -1
- package/datetimepicker/DateTimeSelector.js +1 -1
- package/datetimepicker/DateTimeSelector.mjs +75 -73
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- 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 +1 -1
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as i from "react";
|
|
9
9
|
import { provideLocalizationService as R, registerForLocalization as M } from "@progress/kendo-react-intl";
|
|
10
|
-
import { dateTimePickerCancel as
|
|
11
|
-
import { Button as
|
|
10
|
+
import { dateTimePickerCancel as C, messages as p, dateTimePickerSet as D, date as _, time as T } from "../messages/index.mjs";
|
|
11
|
+
import { Button as f, ButtonGroup as x } from "@progress/kendo-react-buttons";
|
|
12
12
|
import { Calendar as z } from "../calendar/components/Calendar.mjs";
|
|
13
13
|
import { TimePart as A } from "../timepicker/TimePart.mjs";
|
|
14
|
-
import { MIDNIGHT_DATE as
|
|
14
|
+
import { MIDNIGHT_DATE as g, MAX_TIME as F, MIN_TIME as L, getToday as E, setTime as P } from "../utils.mjs";
|
|
15
15
|
import { isEqualDate as k } from "@progress/kendo-date-math";
|
|
16
|
-
import { classNames as l, uDateTimePicker as u, uTime as
|
|
17
|
-
import { getNow as
|
|
18
|
-
const
|
|
19
|
-
constructor(
|
|
20
|
-
super(
|
|
16
|
+
import { classNames as l, uDateTimePicker as u, uTime as V, Keys as h, getActiveElement as I } from "@progress/kendo-react-common";
|
|
17
|
+
import { getNow as B } from "../timepicker/utils.mjs";
|
|
18
|
+
const b = class b extends i.Component {
|
|
19
|
+
constructor(s) {
|
|
20
|
+
super(s), this._calendar = null, this._timePart = null, this._cancelButton = null, this._acceptButton = null, this._dateButtonRef = null, this._calendarWrap = null, this.shouldFocusPart = !1, this.focus = (t) => {
|
|
21
21
|
Promise.resolve().then(() => {
|
|
22
22
|
this.state.tab === "time" && this._timePart && this._timePart.focus(t);
|
|
23
23
|
const e = this.calendarElement();
|
|
@@ -29,30 +29,16 @@ const y = class y extends i.Component {
|
|
|
29
29
|
const e = t === "left" ? "date" : "time";
|
|
30
30
|
this.shouldFocusPart = !0, this.setState({ tab: e });
|
|
31
31
|
}, this.dateTimeFooter = () => {
|
|
32
|
-
const { cancelButton: t, unstyled: e } = this.props,
|
|
33
|
-
return /* @__PURE__ */ i.createElement("div", { className: l(u.timeFooter({ c:
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
type: "button",
|
|
37
|
-
ref: (n) => {
|
|
38
|
-
this._cancelButton = n;
|
|
39
|
-
},
|
|
40
|
-
className: l(B.cancel({ c: s })),
|
|
41
|
-
onClick: this.handleReject,
|
|
42
|
-
onKeyDown: this.handleCancelKeyDown,
|
|
43
|
-
title: o,
|
|
44
|
-
"aria-label": o
|
|
45
|
-
},
|
|
46
|
-
o
|
|
47
|
-
), /* @__PURE__ */ i.createElement(
|
|
48
|
-
g,
|
|
32
|
+
const { cancelButton: t, unstyled: e } = this.props, a = e && e.uDateTimePicker, o = this.localizationService.toLanguageString(C, p[C]), r = this.localizationService.toLanguageString(D, p[D]);
|
|
33
|
+
return /* @__PURE__ */ i.createElement("div", { className: l(u.timeFooter({ c: a })) }, /* @__PURE__ */ i.createElement(
|
|
34
|
+
f,
|
|
49
35
|
{
|
|
50
36
|
type: "button",
|
|
51
37
|
themeColor: "primary",
|
|
52
38
|
ref: (n) => {
|
|
53
39
|
this._acceptButton = n;
|
|
54
40
|
},
|
|
55
|
-
className: l(
|
|
41
|
+
className: l(V.accept({ c: a })),
|
|
56
42
|
disabled: !this.hasDateValue,
|
|
57
43
|
onClick: this.handleAccept,
|
|
58
44
|
onKeyDown: this.handleSetKeyDown,
|
|
@@ -60,31 +46,45 @@ const y = class y extends i.Component {
|
|
|
60
46
|
"aria-label": r
|
|
61
47
|
},
|
|
62
48
|
r
|
|
49
|
+
), t && /* @__PURE__ */ i.createElement(
|
|
50
|
+
f,
|
|
51
|
+
{
|
|
52
|
+
type: "button",
|
|
53
|
+
ref: (n) => {
|
|
54
|
+
this._cancelButton = n;
|
|
55
|
+
},
|
|
56
|
+
className: l(V.cancel({ c: a })),
|
|
57
|
+
onClick: this.handleReject,
|
|
58
|
+
onKeyDown: this.handleCancelKeyDown,
|
|
59
|
+
title: o,
|
|
60
|
+
"aria-label": o
|
|
61
|
+
},
|
|
62
|
+
o
|
|
63
63
|
));
|
|
64
64
|
}, this.handleReject = (t) => {
|
|
65
|
-
this.setState({ dateValue: this.props.value, timeValue: this.props.value ||
|
|
66
|
-
const e = this.mergeDate(this.props.value, this.props.value ||
|
|
65
|
+
this.setState({ dateValue: this.props.value, timeValue: this.props.value || g });
|
|
66
|
+
const e = this.mergeDate(this.props.value, this.props.value || g);
|
|
67
67
|
if (this.props.onReject) {
|
|
68
|
-
const
|
|
68
|
+
const a = {
|
|
69
69
|
nativeEvent: t.nativeEvent,
|
|
70
70
|
syntheticEvent: t,
|
|
71
71
|
target: this,
|
|
72
72
|
value: e
|
|
73
73
|
};
|
|
74
|
-
this.props.onReject.call(void 0,
|
|
74
|
+
this.props.onReject.call(void 0, a);
|
|
75
75
|
}
|
|
76
76
|
}, this.handleAccept = (t, e) => {
|
|
77
77
|
if (!this.state.dateValue || !this.state.timeValue || !this.hasDateValue)
|
|
78
78
|
return;
|
|
79
|
-
const
|
|
79
|
+
const a = this.mergeDate(this.state.dateValue, e || this.state.timeValue);
|
|
80
80
|
this.props.onChange.call(void 0, {
|
|
81
81
|
syntheticEvent: t,
|
|
82
82
|
nativeEvent: t.nativeEvent,
|
|
83
|
-
value:
|
|
83
|
+
value: a,
|
|
84
84
|
target: this
|
|
85
85
|
});
|
|
86
86
|
}, this.handleNowClick = (t) => {
|
|
87
|
-
this.setState({ timeValue:
|
|
87
|
+
this.setState({ timeValue: B() }), this.handleAccept(t, B());
|
|
88
88
|
}, this.handleCalendarValueChange = (t) => {
|
|
89
89
|
t.syntheticEvent.stopPropagation(), this.setState({ dateValue: t.value, tab: "time" }), this.shouldFocusPart = !0;
|
|
90
90
|
}, this.handleTimeListContainerChange = (t) => {
|
|
@@ -94,19 +94,19 @@ const y = class y extends i.Component {
|
|
|
94
94
|
}, this.handleTimeClick = (t) => {
|
|
95
95
|
t.stopPropagation(), this.move("right");
|
|
96
96
|
}, this.handleKeyDown = (t) => {
|
|
97
|
-
const { keyCode: e, altKey:
|
|
97
|
+
const { keyCode: e, altKey: a } = t;
|
|
98
98
|
if (!this.props.disabled)
|
|
99
99
|
switch (e) {
|
|
100
100
|
case h.enter:
|
|
101
101
|
!this.hasActiveButton() && this.hasDateValue && this.handleAccept(t);
|
|
102
102
|
return;
|
|
103
103
|
case h.left:
|
|
104
|
-
if (!
|
|
104
|
+
if (!a)
|
|
105
105
|
return;
|
|
106
106
|
this.move("left");
|
|
107
107
|
return;
|
|
108
108
|
case h.right:
|
|
109
|
-
if (!
|
|
109
|
+
if (!a)
|
|
110
110
|
return;
|
|
111
111
|
this.move("right");
|
|
112
112
|
return;
|
|
@@ -114,15 +114,17 @@ const y = class y extends i.Component {
|
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
}, this.handleCancelKeyDown = (t) => {
|
|
117
|
+
var a;
|
|
117
118
|
const { keyCode: e } = t;
|
|
118
|
-
e === h.tab &&
|
|
119
|
+
e === h.tab && ((a = this._dateButtonRef) != null && a.element) && (t.preventDefault(), this._dateButtonRef.element.focus());
|
|
119
120
|
}, this.handleSetKeyDown = (t) => {
|
|
121
|
+
var a;
|
|
120
122
|
const { keyCode: e } = t;
|
|
121
|
-
e === h.tab && this.
|
|
123
|
+
e === h.tab && !this.props.cancelButton && ((a = this._dateButtonRef) != null && a.element) && (t.preventDefault(), this._dateButtonRef.element.focus());
|
|
122
124
|
}, this.handleDateKeyDown = (t) => {
|
|
123
|
-
var o, r, n
|
|
124
|
-
const { keyCode: e, shiftKey:
|
|
125
|
-
|
|
125
|
+
var o, r, n;
|
|
126
|
+
const { keyCode: e, shiftKey: a } = t;
|
|
127
|
+
a && e === h.tab && (t.stopPropagation(), (o = this._cancelButton) != null && o.element ? this._cancelButton.element.focus() : (n = (r = this._acceptButton) == null ? void 0 : r.element) == null || n.focus()), e === h.enter && (t.stopPropagation(), this.move("left"));
|
|
126
128
|
}, this.handleTimeKeyDown = (t) => {
|
|
127
129
|
const { keyCode: e } = t;
|
|
128
130
|
e === h.enter && (t.stopPropagation(), this.move("right"));
|
|
@@ -131,7 +133,7 @@ const y = class y extends i.Component {
|
|
|
131
133
|
}, this.state = {
|
|
132
134
|
tab: "date",
|
|
133
135
|
dateValue: this.props.value,
|
|
134
|
-
timeValue: this.props.value ||
|
|
136
|
+
timeValue: this.props.value || g
|
|
135
137
|
};
|
|
136
138
|
}
|
|
137
139
|
get calendar() {
|
|
@@ -146,35 +148,35 @@ const y = class y extends i.Component {
|
|
|
146
148
|
get localizationService() {
|
|
147
149
|
return R(this);
|
|
148
150
|
}
|
|
149
|
-
componentDidUpdate(
|
|
150
|
-
var e,
|
|
151
|
-
this.shouldFocusPart && this.focus({ preventScroll: !0 }), (((e =
|
|
152
|
-
dateValue:
|
|
153
|
-
timeValue: this.props.value ||
|
|
151
|
+
componentDidUpdate(s, t) {
|
|
152
|
+
var e, a;
|
|
153
|
+
this.shouldFocusPart && this.focus({ preventScroll: !0 }), (((e = s.value) == null ? void 0 : e.getTime()) !== ((a = this.props.value) == null ? void 0 : a.getTime()) || this.state.tab !== t.tab && this.props.value) && this.setState((o) => ({
|
|
154
|
+
dateValue: s.value && this.props.value && k(s.value, this.props.value) ? o.dateValue : this.props.value,
|
|
155
|
+
timeValue: this.props.value || g
|
|
154
156
|
})), this.shouldFocusPart = !1;
|
|
155
157
|
}
|
|
156
158
|
render() {
|
|
157
|
-
const { disabled:
|
|
159
|
+
const { disabled: s, min: t, max: e, weekNumber: a, focusedDate: o, format: r, mobileMode: n, footerActions: w, unstyled: d } = this.props, m = d && d.uDateTimePicker, S = l(
|
|
158
160
|
u.wrap({
|
|
159
161
|
c: m,
|
|
160
162
|
date: this.state.tab === "date",
|
|
161
163
|
time: this.state.tab === "time",
|
|
162
|
-
disabled:
|
|
164
|
+
disabled: s
|
|
163
165
|
})
|
|
164
|
-
), K = this.localizationService.toLanguageString(
|
|
166
|
+
), K = this.localizationService.toLanguageString(_, p[_]), N = this.localizationService.toLanguageString(T, p[T]), y = {
|
|
165
167
|
min: t,
|
|
166
168
|
max: e,
|
|
167
|
-
weekNumber:
|
|
169
|
+
weekNumber: a,
|
|
168
170
|
focusedDate: o,
|
|
169
|
-
disabled:
|
|
171
|
+
disabled: s || this.state.tab !== "date",
|
|
170
172
|
value: this.state.dateValue,
|
|
171
173
|
onChange: this.handleCalendarValueChange,
|
|
172
174
|
navigation: !1,
|
|
173
|
-
tabIndex:
|
|
175
|
+
tabIndex: s || this.state.tab !== "date" ? -1 : void 0,
|
|
174
176
|
mobileMode: n
|
|
175
177
|
};
|
|
176
|
-
return /* @__PURE__ */ i.createElement("div", { onKeyDown: this.handleKeyDown, className: S, tabIndex: -1 }, /* @__PURE__ */ i.createElement("div", { className: l(u.buttonGroup({ c: m })) }, /* @__PURE__ */ i.createElement(x, { width: "100%", unstyled:
|
|
177
|
-
|
|
178
|
+
return /* @__PURE__ */ i.createElement("div", { onKeyDown: this.handleKeyDown, className: S, tabIndex: -1 }, /* @__PURE__ */ i.createElement("div", { className: l(u.buttonGroup({ c: m })) }, /* @__PURE__ */ i.createElement(x, { width: "100%", unstyled: d }, /* @__PURE__ */ i.createElement(
|
|
179
|
+
f,
|
|
178
180
|
{
|
|
179
181
|
ref: (c) => {
|
|
180
182
|
this._dateButtonRef = c;
|
|
@@ -188,7 +190,7 @@ const y = class y extends i.Component {
|
|
|
188
190
|
},
|
|
189
191
|
K
|
|
190
192
|
), /* @__PURE__ */ i.createElement(
|
|
191
|
-
|
|
193
|
+
f,
|
|
192
194
|
{
|
|
193
195
|
type: "button",
|
|
194
196
|
selected: this.state.tab === "time",
|
|
@@ -206,14 +208,14 @@ const y = class y extends i.Component {
|
|
|
206
208
|
this._calendarWrap = c;
|
|
207
209
|
}
|
|
208
210
|
},
|
|
209
|
-
this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { key: this.state.tab, ...
|
|
211
|
+
this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { key: this.state.tab, ...y }) : /* @__PURE__ */ i.createElement(
|
|
210
212
|
z,
|
|
211
213
|
{
|
|
212
214
|
key: this.state.tab,
|
|
213
215
|
ref: (c) => {
|
|
214
216
|
this._calendar = c;
|
|
215
217
|
},
|
|
216
|
-
...
|
|
218
|
+
...y
|
|
217
219
|
}
|
|
218
220
|
)
|
|
219
221
|
), /* @__PURE__ */ i.createElement("div", { className: l(u.timeWrap({ c: m })) }, /* @__PURE__ */ i.createElement("div", { className: l(u.timeSelector({ c: m, mobileMode: n })) }, /* @__PURE__ */ i.createElement(
|
|
@@ -221,7 +223,7 @@ const y = class y extends i.Component {
|
|
|
221
223
|
{
|
|
222
224
|
key: 1,
|
|
223
225
|
onNowClick: this.handleNowClick,
|
|
224
|
-
disabled:
|
|
226
|
+
disabled: s || this.state.tab !== "time",
|
|
225
227
|
ref: (c) => {
|
|
226
228
|
this._timePart = c;
|
|
227
229
|
},
|
|
@@ -233,9 +235,9 @@ const y = class y extends i.Component {
|
|
|
233
235
|
onChange: this.handleTimeListContainerChange,
|
|
234
236
|
onMount: this.handleTimePartMount,
|
|
235
237
|
mobileMode: n,
|
|
236
|
-
unstyled:
|
|
238
|
+
unstyled: d
|
|
237
239
|
}
|
|
238
|
-
)))),
|
|
240
|
+
)))), w && this.dateTimeFooter());
|
|
239
241
|
}
|
|
240
242
|
get minTime() {
|
|
241
243
|
return this.props.minTime !== void 0 ? this.props.minTime : this.normalizeRange(this.props.min, this.state.dateValue);
|
|
@@ -243,27 +245,27 @@ const y = class y extends i.Component {
|
|
|
243
245
|
get maxTime() {
|
|
244
246
|
return this.props.maxTime !== void 0 ? this.props.maxTime : this.normalizeRange(this.props.max, this.state.dateValue);
|
|
245
247
|
}
|
|
246
|
-
normalizeRange(
|
|
247
|
-
return k(
|
|
248
|
+
normalizeRange(s, t) {
|
|
249
|
+
return k(s, t || E()) ? s : null;
|
|
248
250
|
}
|
|
249
251
|
hasActiveButton() {
|
|
250
252
|
if (!this._acceptButton)
|
|
251
253
|
return !1;
|
|
252
|
-
const
|
|
253
|
-
return this._acceptButton &&
|
|
254
|
+
const s = I(document);
|
|
255
|
+
return this._acceptButton && s === this._acceptButton.element || this._cancelButton && s === this._cancelButton.element;
|
|
254
256
|
}
|
|
255
|
-
mergeTime(
|
|
256
|
-
return
|
|
257
|
+
mergeTime(s, t) {
|
|
258
|
+
return s && t ? P(t, s) : t;
|
|
257
259
|
}
|
|
258
|
-
mergeDate(
|
|
259
|
-
return
|
|
260
|
+
mergeDate(s, t) {
|
|
261
|
+
return s ? P(s || E(), t) : t;
|
|
260
262
|
}
|
|
261
263
|
};
|
|
262
|
-
|
|
264
|
+
b.defaultProps = {
|
|
263
265
|
footerActions: !0
|
|
264
266
|
};
|
|
265
|
-
let
|
|
266
|
-
M(
|
|
267
|
+
let v = b;
|
|
268
|
+
M(v);
|
|
267
269
|
export {
|
|
268
|
-
|
|
270
|
+
v as DateTimeSelector
|
|
269
271
|
};
|