@progress/kendo-react-dateinputs 14.5.0-develop.7 → 14.5.0-develop.9
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/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +55 -55
- package/datetimepicker/DateTimeSelector.d.ts +2 -3
- package/datetimepicker/DateTimeSelector.js +1 -1
- package/datetimepicker/DateTimeSelector.mjs +86 -83
- 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 +14 -9
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { provideLocalizationService as
|
|
10
|
-
import { dateTimePickerCancel as
|
|
11
|
-
import { Button as
|
|
8
|
+
import * as n from "react";
|
|
9
|
+
import { provideLocalizationService as x, registerForLocalization as M } from "@progress/kendo-react-intl";
|
|
10
|
+
import { dateTimePickerCancel as y, messages as d, dateTimePickerSet as C, date as _, time as D } from "../messages/index.mjs";
|
|
11
|
+
import { Button as T, SegmentedControl as R } 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 p, MAX_TIME as F, MIN_TIME as L, getToday as E, setTime as P } from "../utils.mjs";
|
|
15
15
|
import { isEqualDate as V } from "@progress/kendo-date-math";
|
|
16
|
-
import { classNames as
|
|
17
|
-
import { getNow as
|
|
18
|
-
const
|
|
16
|
+
import { classNames as r, uDateTimePicker as u, uTime as S, Keys as h, getActiveElement as I } from "@progress/kendo-react-common";
|
|
17
|
+
import { getNow as k } from "../timepicker/utils.mjs";
|
|
18
|
+
const v = class v extends n.Component {
|
|
19
19
|
constructor(s) {
|
|
20
|
-
super(s), this._calendar = null, this._timePart = null, this._cancelButton = null, this._acceptButton = null, this.
|
|
20
|
+
super(s), this._calendar = null, this._timePart = null, this._cancelButton = null, this._acceptButton = null, this._buttonGroupRef = 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,41 +29,41 @@ const b = class b 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, a = e && e.uDateTimePicker,
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
|
|
32
|
+
const { cancelButton: t, unstyled: e } = this.props, a = e && e.uDateTimePicker, i = this.localizationService.toLanguageString(y, d[y]), l = this.localizationService.toLanguageString(C, d[C]);
|
|
33
|
+
return /* @__PURE__ */ n.createElement("div", { className: r(u.timeFooter({ c: a })) }, /* @__PURE__ */ n.createElement(
|
|
34
|
+
T,
|
|
35
35
|
{
|
|
36
36
|
type: "button",
|
|
37
37
|
themeColor: "primary",
|
|
38
38
|
ref: (o) => {
|
|
39
39
|
this._acceptButton = o;
|
|
40
40
|
},
|
|
41
|
-
className:
|
|
41
|
+
className: r(S.accept({ c: a })),
|
|
42
42
|
disabled: !this.hasDateValue,
|
|
43
43
|
onClick: this.handleAccept,
|
|
44
44
|
onKeyDown: this.handleSetKeyDown,
|
|
45
|
-
title:
|
|
46
|
-
"aria-label":
|
|
45
|
+
title: l,
|
|
46
|
+
"aria-label": l
|
|
47
47
|
},
|
|
48
|
-
|
|
49
|
-
), t && /* @__PURE__ */
|
|
50
|
-
|
|
48
|
+
l
|
|
49
|
+
), t && /* @__PURE__ */ n.createElement(
|
|
50
|
+
T,
|
|
51
51
|
{
|
|
52
52
|
type: "button",
|
|
53
53
|
ref: (o) => {
|
|
54
54
|
this._cancelButton = o;
|
|
55
55
|
},
|
|
56
|
-
className:
|
|
56
|
+
className: r(S.cancel({ c: a })),
|
|
57
57
|
onClick: this.handleReject,
|
|
58
58
|
onKeyDown: this.handleCancelKeyDown,
|
|
59
|
-
title:
|
|
60
|
-
"aria-label":
|
|
59
|
+
title: i,
|
|
60
|
+
"aria-label": i
|
|
61
61
|
},
|
|
62
|
-
|
|
62
|
+
i
|
|
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 || p });
|
|
66
|
+
const e = this.mergeDate(this.props.value, this.props.value || p);
|
|
67
67
|
if (this.props.onReject) {
|
|
68
68
|
const a = {
|
|
69
69
|
nativeEvent: t.nativeEvent,
|
|
@@ -76,23 +76,22 @@ const b = class b extends i.Component {
|
|
|
76
76
|
}, this.handleAccept = (t, e) => {
|
|
77
77
|
if (!this.state.dateValue || !this.state.timeValue || !this.hasDateValue)
|
|
78
78
|
return;
|
|
79
|
-
const a = e || (this._timePart ? this._timePart.value : this.state.timeValue),
|
|
79
|
+
const a = e || (this._timePart ? this._timePart.value : this.state.timeValue), i = this.mergeDate(this.state.dateValue, a);
|
|
80
80
|
this.props.onChange.call(void 0, {
|
|
81
81
|
syntheticEvent: t,
|
|
82
82
|
nativeEvent: t.nativeEvent,
|
|
83
|
-
value:
|
|
83
|
+
value: i,
|
|
84
84
|
target: this
|
|
85
85
|
});
|
|
86
86
|
}, this.handleNowClick = (t) => {
|
|
87
|
-
this.setState({ timeValue:
|
|
87
|
+
this.setState({ timeValue: k() }), this.handleAccept(t, k());
|
|
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) => {
|
|
91
91
|
this.setState({ timeValue: t });
|
|
92
|
-
}, this.
|
|
93
|
-
t
|
|
94
|
-
|
|
95
|
-
t.stopPropagation(), this.move("right");
|
|
92
|
+
}, this.handleTabChange = (t) => {
|
|
93
|
+
const e = t === "date" ? "left" : "right";
|
|
94
|
+
this.move(e);
|
|
96
95
|
}, this.handleKeyDown = (t) => {
|
|
97
96
|
const { keyCode: e, altKey: a } = t;
|
|
98
97
|
if (!this.props.disabled)
|
|
@@ -114,26 +113,26 @@ const b = class b extends i.Component {
|
|
|
114
113
|
return;
|
|
115
114
|
}
|
|
116
115
|
}, this.handleCancelKeyDown = (t) => {
|
|
117
|
-
var
|
|
118
|
-
const { keyCode: e } = t;
|
|
119
|
-
e === h.tab &&
|
|
116
|
+
var i;
|
|
117
|
+
const { keyCode: e } = t, a = (i = this._buttonGroupRef) == null ? void 0 : i.querySelector(".k-segmented-control-button");
|
|
118
|
+
e === h.tab && a && (t.preventDefault(), a.focus());
|
|
120
119
|
}, this.handleSetKeyDown = (t) => {
|
|
121
|
-
var
|
|
122
|
-
const { keyCode: e } = t;
|
|
123
|
-
e === h.tab && !this.props.cancelButton &&
|
|
120
|
+
var i;
|
|
121
|
+
const { keyCode: e } = t, a = (i = this._buttonGroupRef) == null ? void 0 : i.querySelector(".k-segmented-control-button");
|
|
122
|
+
e === h.tab && !this.props.cancelButton && a && (t.preventDefault(), a.focus());
|
|
124
123
|
}, this.handleDateKeyDown = (t) => {
|
|
125
|
-
var
|
|
124
|
+
var i, l, o;
|
|
126
125
|
const { keyCode: e, shiftKey: a } = t;
|
|
127
|
-
a && e === h.tab && (t.stopPropagation(), (
|
|
126
|
+
a && e === h.tab && (t.stopPropagation(), (i = this._cancelButton) != null && i.element ? this._cancelButton.element.focus() : (o = (l = this._acceptButton) == null ? void 0 : l.element) == null || o.focus()), e === h.enter && t.stopPropagation();
|
|
128
127
|
}, this.handleTimeKeyDown = (t) => {
|
|
129
128
|
const { keyCode: e } = t;
|
|
130
|
-
e === h.enter &&
|
|
129
|
+
e === h.enter && t.stopPropagation();
|
|
131
130
|
}, this.handleTimePartMount = (t) => {
|
|
132
131
|
this.setState({ timeValue: t });
|
|
133
132
|
}, this.state = {
|
|
134
133
|
tab: "date",
|
|
135
134
|
dateValue: this.props.value,
|
|
136
|
-
timeValue: this.props.value ||
|
|
135
|
+
timeValue: this.props.value || p
|
|
137
136
|
};
|
|
138
137
|
}
|
|
139
138
|
get calendar() {
|
|
@@ -146,28 +145,28 @@ const b = class b extends i.Component {
|
|
|
146
145
|
return this.state.dateValue !== null;
|
|
147
146
|
}
|
|
148
147
|
get localizationService() {
|
|
149
|
-
return
|
|
148
|
+
return x(this);
|
|
150
149
|
}
|
|
151
150
|
componentDidUpdate(s, t) {
|
|
152
151
|
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((
|
|
154
|
-
dateValue: s.value && this.props.value && V(s.value, this.props.value) ?
|
|
155
|
-
timeValue: this.props.value ||
|
|
152
|
+
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((i) => ({
|
|
153
|
+
dateValue: s.value && this.props.value && V(s.value, this.props.value) ? i.dateValue : this.props.value,
|
|
154
|
+
timeValue: this.props.value || p
|
|
156
155
|
})), this.shouldFocusPart = !1;
|
|
157
156
|
}
|
|
158
157
|
render() {
|
|
159
|
-
const { disabled: s, min: t, max: e, weekNumber: a, focusedDate:
|
|
160
|
-
|
|
161
|
-
c:
|
|
158
|
+
const { disabled: s, min: t, max: e, weekNumber: a, focusedDate: i, format: l, mobileMode: o, footerActions: w, unstyled: f } = this.props, m = f && f.uDateTimePicker, B = r(
|
|
159
|
+
u.wrap({
|
|
160
|
+
c: m,
|
|
162
161
|
date: this.state.tab === "date",
|
|
163
162
|
time: this.state.tab === "time",
|
|
164
163
|
disabled: s
|
|
165
164
|
})
|
|
166
|
-
), K = this.localizationService.toLanguageString(
|
|
165
|
+
), K = this.localizationService.toLanguageString(_, d[_]), N = this.localizationService.toLanguageString(D, d[D]), b = {
|
|
167
166
|
min: t,
|
|
168
167
|
max: e,
|
|
169
168
|
weekNumber: a,
|
|
170
|
-
focusedDate:
|
|
169
|
+
focusedDate: i,
|
|
171
170
|
disabled: s || this.state.tab !== "date",
|
|
172
171
|
value: this.state.dateValue,
|
|
173
172
|
onChange: this.handleCalendarValueChange,
|
|
@@ -175,50 +174,54 @@ const b = class b extends i.Component {
|
|
|
175
174
|
tabIndex: s || this.state.tab !== "date" ? -1 : void 0,
|
|
176
175
|
mobileMode: o
|
|
177
176
|
};
|
|
178
|
-
return /* @__PURE__ */
|
|
179
|
-
|
|
177
|
+
return /* @__PURE__ */ n.createElement("div", { onKeyDown: this.handleKeyDown, className: B, tabIndex: -1 }, /* @__PURE__ */ n.createElement(
|
|
178
|
+
"div",
|
|
180
179
|
{
|
|
180
|
+
className: r(u.buttonGroup({ c: m })),
|
|
181
181
|
ref: (c) => {
|
|
182
|
-
this.
|
|
183
|
-
}
|
|
184
|
-
type: "button",
|
|
185
|
-
selected: this.state.tab === "date",
|
|
186
|
-
togglable: !0,
|
|
187
|
-
size: o ? "large" : void 0,
|
|
188
|
-
onClick: this.handleDateClick,
|
|
189
|
-
onKeyDown: this.handleDateKeyDown
|
|
190
|
-
},
|
|
191
|
-
K
|
|
192
|
-
), /* @__PURE__ */ i.createElement(
|
|
193
|
-
f,
|
|
194
|
-
{
|
|
195
|
-
type: "button",
|
|
196
|
-
selected: this.state.tab === "time",
|
|
197
|
-
togglable: !0,
|
|
198
|
-
size: o ? "large" : void 0,
|
|
199
|
-
onClick: this.handleTimeClick,
|
|
200
|
-
onKeyDown: this.handleTimeKeyDown
|
|
182
|
+
this._buttonGroupRef = c;
|
|
183
|
+
}
|
|
201
184
|
},
|
|
202
|
-
|
|
203
|
-
|
|
185
|
+
/* @__PURE__ */ n.createElement(
|
|
186
|
+
R,
|
|
187
|
+
{
|
|
188
|
+
layoutMode: "stretch",
|
|
189
|
+
size: o ? "large" : void 0,
|
|
190
|
+
value: this.state.tab,
|
|
191
|
+
onChange: this.handleTabChange,
|
|
192
|
+
items: [
|
|
193
|
+
{
|
|
194
|
+
value: "date",
|
|
195
|
+
text: K,
|
|
196
|
+
onKeyDown: this.handleDateKeyDown
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
value: "time",
|
|
200
|
+
text: N,
|
|
201
|
+
onKeyDown: this.handleTimeKeyDown
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
), /* @__PURE__ */ n.createElement("div", { className: r(u.selector({ c: m })) }, /* @__PURE__ */ n.createElement(
|
|
204
207
|
"div",
|
|
205
208
|
{
|
|
206
|
-
className:
|
|
209
|
+
className: r(u.calendarWrap({ c: m })),
|
|
207
210
|
ref: (c) => {
|
|
208
211
|
this._calendarWrap = c;
|
|
209
212
|
}
|
|
210
213
|
},
|
|
211
|
-
this.props.calendar ? /* @__PURE__ */
|
|
214
|
+
this.props.calendar ? /* @__PURE__ */ n.createElement(this.props.calendar, { key: this.state.tab, ...b }) : /* @__PURE__ */ n.createElement(
|
|
212
215
|
z,
|
|
213
216
|
{
|
|
214
217
|
key: this.state.tab,
|
|
215
218
|
ref: (c) => {
|
|
216
219
|
this._calendar = c;
|
|
217
220
|
},
|
|
218
|
-
...
|
|
221
|
+
...b
|
|
219
222
|
}
|
|
220
223
|
)
|
|
221
|
-
), /* @__PURE__ */
|
|
224
|
+
), /* @__PURE__ */ n.createElement("div", { className: r(u.timeWrap({ c: m })) }, /* @__PURE__ */ n.createElement("div", { className: r(u.timeSelector({ c: m, mobileMode: o })) }, /* @__PURE__ */ n.createElement(
|
|
222
225
|
A,
|
|
223
226
|
{
|
|
224
227
|
key: 1,
|
|
@@ -231,11 +234,11 @@ const b = class b extends i.Component {
|
|
|
231
234
|
max: this.maxTime || F,
|
|
232
235
|
steps: this.props.steps,
|
|
233
236
|
value: this.state.timeValue,
|
|
234
|
-
format:
|
|
237
|
+
format: l,
|
|
235
238
|
onChange: this.handleTimeListContainerChange,
|
|
236
239
|
onMount: this.handleTimePartMount,
|
|
237
240
|
mobileMode: o,
|
|
238
|
-
unstyled:
|
|
241
|
+
unstyled: f
|
|
239
242
|
}
|
|
240
243
|
)))), w && this.dateTimeFooter());
|
|
241
244
|
}
|
|
@@ -261,11 +264,11 @@ const b = class b extends i.Component {
|
|
|
261
264
|
return s ? P(s || E(), t) : t;
|
|
262
265
|
}
|
|
263
266
|
};
|
|
264
|
-
|
|
267
|
+
v.defaultProps = {
|
|
265
268
|
footerActions: !0
|
|
266
269
|
};
|
|
267
|
-
let
|
|
268
|
-
M(
|
|
270
|
+
let g = v;
|
|
271
|
+
M(g);
|
|
269
272
|
export {
|
|
270
|
-
|
|
273
|
+
g as DateTimeSelector
|
|
271
274
|
};
|