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