@progress/kendo-react-dateinputs 9.0.0-develop.2 → 9.0.0-develop.20
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/README.md +47 -46
- package/calendar/components/Calendar.mjs +57 -60
- package/calendar/components/CalendarNavigationItem.mjs +10 -12
- package/calendar/components/CalendarWeekCell.mjs +9 -1
- package/calendar/components/HorizontalViewList.mjs +8 -11
- package/calendar/components/MultiViewCalendar.mjs +13 -8
- package/calendar/components/Navigation.mjs +11 -11
- package/calendar/components/View.mjs +8 -25
- package/common/PickerWrap.mjs +2 -15
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +264 -321
- package/dateinput/dateInputIntl.js +8 -0
- package/dateinput/dateInputIntl.mjs +20 -0
- package/dateinput/utils.js +1 -1
- package/dateinput/utils.mjs +4 -27
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +104 -82
- package/daterangepicker/DateRangePicker.mjs +14 -3
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +102 -81
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/hooks/usePickerFloatingLabel.js +1 -1
- package/hooks/usePickerFloatingLabel.mjs +6 -11
- package/index.d.mts +177 -36
- package/index.d.ts +177 -36
- package/package-metadata.mjs +1 -1
- package/package.json +8 -7
- package/timepicker/TimeList.mjs +27 -12
- package/timepicker/TimePart.mjs +55 -75
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +85 -69
- package/timepicker/services/DOMService.mjs +7 -4
- package/timepicker/services/DayPeriodService.mjs +1 -4
- package/timepicker/utils.mjs +3 -15
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +3 -13
- package/dateinput/models/kendo-date.js +0 -8
- package/dateinput/models/kendo-date.mjs +0 -233
- package/dateinput/models/mask.js +0 -8
- package/dateinput/models/mask.mjs +0 -16
|
@@ -6,43 +6,33 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as n from "react";
|
|
10
10
|
import e from "prop-types";
|
|
11
|
-
import { Popup as
|
|
12
|
-
import { cloneDate as
|
|
13
|
-
import { Keys as d, validatePackage as
|
|
14
|
-
import { calendarIcon as
|
|
15
|
-
import { DateInput as
|
|
16
|
-
import { Button as
|
|
17
|
-
import { packageMetadata as
|
|
18
|
-
import { MAX_DATE as
|
|
19
|
-
import { MOBILE_MEDIUM_DEVISE as
|
|
11
|
+
import { Popup as Q } from "@progress/kendo-react-popup";
|
|
12
|
+
import { cloneDate as M } from "@progress/kendo-date-math";
|
|
13
|
+
import { Keys as d, validatePackage as $, canUseDOM as O, AsyncFocusBlur as ee, classNames as I, uDateTimePicker as D, createPropsContext as te, withIdHOC as ie, withPropsContext as se, withUnstyledHOC as oe } from "@progress/kendo-react-common";
|
|
14
|
+
import { calendarIcon as ae } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { DateInput as ne } from "../dateinput/DateInput.mjs";
|
|
16
|
+
import { Button as re } from "@progress/kendo-react-buttons";
|
|
17
|
+
import { packageMetadata as le } from "../package-metadata.mjs";
|
|
18
|
+
import { MAX_DATE as he, MIN_DATE as de, isInDateRange as ue, MAX_TIME as pe, MIN_TIME as ce } from "../utils.mjs";
|
|
19
|
+
import { MOBILE_MEDIUM_DEVISE as me } from "../common/constants.mjs";
|
|
20
20
|
import { dateTimePickerCancel as P, messages as p, dateTimePickerSet as C, toggleDateTimeSelector as c } from "../messages/index.mjs";
|
|
21
|
-
import { provideLocalizationService as m, registerForLocalization as
|
|
22
|
-
import { DateTimeSelector as
|
|
23
|
-
import { isInTimeRange as
|
|
24
|
-
import { PickerFloatingLabel as
|
|
25
|
-
import { AdaptiveMode as
|
|
26
|
-
import { ActionSheetContent as
|
|
27
|
-
const o = class o extends
|
|
21
|
+
import { provideLocalizationService as m, registerForLocalization as fe } from "@progress/kendo-react-intl";
|
|
22
|
+
import { DateTimeSelector as ge } from "./DateTimeSelector.mjs";
|
|
23
|
+
import { isInTimeRange as ve } from "../timepicker/utils.mjs";
|
|
24
|
+
import { PickerFloatingLabel as we } from "../hooks/usePickerFloatingLabel.mjs";
|
|
25
|
+
import { AdaptiveMode as be } from "../common/AdaptiveMode.mjs";
|
|
26
|
+
import { ActionSheetContent as ye } from "@progress/kendo-react-layout";
|
|
27
|
+
const o = class o extends n.Component {
|
|
28
28
|
constructor(t) {
|
|
29
|
-
super(t), this._element = null, this._dateInput =
|
|
29
|
+
super(t), this._element = null, this._dateInput = n.createRef(), this._dateTimeSelector = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.focus = () => {
|
|
30
30
|
const i = this.dateInputElement();
|
|
31
31
|
i && i.focus();
|
|
32
32
|
}, this.renderPicker = () => {
|
|
33
|
-
const {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
maxTime: n,
|
|
37
|
-
format: h,
|
|
38
|
-
calendar: l,
|
|
39
|
-
cancelButton: r,
|
|
40
|
-
weekNumber: u,
|
|
41
|
-
focusedDate: g,
|
|
42
|
-
unstyled: v
|
|
43
|
-
} = this.props;
|
|
44
|
-
return /* @__PURE__ */ a.createElement(
|
|
45
|
-
he,
|
|
33
|
+
const { disabled: i, minTime: s, maxTime: a, format: h, calendar: l, cancelButton: r, weekNumber: u, focusedDate: g, unstyled: v } = this.props;
|
|
34
|
+
return /* @__PURE__ */ n.createElement(
|
|
35
|
+
ge,
|
|
46
36
|
{
|
|
47
37
|
ref: (w) => {
|
|
48
38
|
this._dateTimeSelector = w;
|
|
@@ -57,7 +47,7 @@ const o = class o extends a.Component {
|
|
|
57
47
|
min: this.min,
|
|
58
48
|
max: this.max,
|
|
59
49
|
minTime: s,
|
|
60
|
-
maxTime:
|
|
50
|
+
maxTime: a,
|
|
61
51
|
focusedDate: g,
|
|
62
52
|
format: h,
|
|
63
53
|
calendar: l,
|
|
@@ -67,7 +57,13 @@ const o = class o extends a.Component {
|
|
|
67
57
|
}
|
|
68
58
|
);
|
|
69
59
|
}, this.renderAdaptivePopup = () => {
|
|
70
|
-
const { windowWidth: i = 0 } = this.state, s = m(this).toLanguageString(
|
|
60
|
+
const { windowWidth: i = 0 } = this.state, s = m(this).toLanguageString(
|
|
61
|
+
P,
|
|
62
|
+
p[P]
|
|
63
|
+
), a = m(this).toLanguageString(
|
|
64
|
+
C,
|
|
65
|
+
p[C]
|
|
66
|
+
), h = {
|
|
71
67
|
expand: this.show,
|
|
72
68
|
onClose: this.handleBlur,
|
|
73
69
|
adaptiveTitle: this.props.adaptiveTitle,
|
|
@@ -78,19 +74,19 @@ const o = class o extends a.Component {
|
|
|
78
74
|
var r;
|
|
79
75
|
return (r = this._dateTimeSelector) == null ? void 0 : r.handleReject(l);
|
|
80
76
|
},
|
|
81
|
-
applyText:
|
|
77
|
+
applyText: a,
|
|
82
78
|
onApply: (l) => {
|
|
83
79
|
var r;
|
|
84
80
|
return (r = this._dateTimeSelector) == null ? void 0 : r.handleAccept(l);
|
|
85
81
|
}
|
|
86
82
|
}
|
|
87
83
|
};
|
|
88
|
-
return /* @__PURE__ */
|
|
84
|
+
return /* @__PURE__ */ n.createElement(be, { ...h }, /* @__PURE__ */ n.createElement(ye, { overflowHidden: !0 }, this.renderPicker()));
|
|
89
85
|
}, this.handleReject = () => {
|
|
90
86
|
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
91
87
|
}, this.handleValueChange = (i) => {
|
|
92
88
|
this.setState({
|
|
93
|
-
value:
|
|
89
|
+
value: M(i.value || void 0)
|
|
94
90
|
}), this.valueDuringOnChange = i.value, this.showDuringOnChange = !1, this.mobileMode || (this.shouldFocusDateInput = !0);
|
|
95
91
|
const { onChange: s } = this.props;
|
|
96
92
|
s && s.call(void 0, {
|
|
@@ -109,13 +105,13 @@ const o = class o extends a.Component {
|
|
|
109
105
|
}, this.handleIconMouseDown = (i) => {
|
|
110
106
|
i.preventDefault();
|
|
111
107
|
}, this.handleKeyDown = (i) => {
|
|
112
|
-
const { altKey: s, keyCode:
|
|
113
|
-
if (
|
|
108
|
+
const { altKey: s, keyCode: a } = i;
|
|
109
|
+
if (a === d.esc) {
|
|
114
110
|
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
115
111
|
return;
|
|
116
112
|
}
|
|
117
|
-
s && (
|
|
118
|
-
}, this.dateInputElement = () => this.dateInput && this.dateInput.element || this.element && this.element.querySelector(".k-dateinput > input.k-input-inner"),
|
|
113
|
+
s && (a === d.up || a === d.down) && (i.preventDefault(), i.stopPropagation(), this.shouldFocusDateInput = a === d.up, this.setShow(a === d.down));
|
|
114
|
+
}, this.dateInputElement = () => this.dateInput && this.dateInput.element || this.element && this.element.querySelector(".k-dateinput > input.k-input-inner"), $(le), this.state = {
|
|
119
115
|
value: this.props.defaultValue || o.defaultProps.defaultValue,
|
|
120
116
|
show: this.props.defaultShow || o.defaultProps.defaultShow,
|
|
121
117
|
focused: !1
|
|
@@ -125,7 +121,7 @@ const o = class o extends a.Component {
|
|
|
125
121
|
return this.props.id + "-popup-id";
|
|
126
122
|
}
|
|
127
123
|
get document() {
|
|
128
|
-
if (
|
|
124
|
+
if (O)
|
|
129
125
|
return this.element && this.element.ownerDocument || document;
|
|
130
126
|
}
|
|
131
127
|
/**
|
|
@@ -145,7 +141,7 @@ const o = class o extends a.Component {
|
|
|
145
141
|
*/
|
|
146
142
|
get value() {
|
|
147
143
|
const t = this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value;
|
|
148
|
-
return t !== null ?
|
|
144
|
+
return t !== null ? M(t) : null;
|
|
149
145
|
}
|
|
150
146
|
/**
|
|
151
147
|
* Gets the popup state of the DateTimePicker.
|
|
@@ -163,7 +159,7 @@ const o = class o extends a.Component {
|
|
|
163
159
|
* The mobile mode of the ComboBox.
|
|
164
160
|
*/
|
|
165
161
|
get mobileMode() {
|
|
166
|
-
return !!(this.state.windowWidth && this.state.windowWidth <=
|
|
162
|
+
return !!(this.state.windowWidth && this.state.windowWidth <= me && this.props.adaptive);
|
|
167
163
|
}
|
|
168
164
|
get min() {
|
|
169
165
|
return this.props.min !== void 0 ? this.props.min : o.defaultProps.min;
|
|
@@ -175,12 +171,12 @@ const o = class o extends a.Component {
|
|
|
175
171
|
* Represents the validity state into which the DateTimePicker is set.
|
|
176
172
|
*/
|
|
177
173
|
get validity() {
|
|
178
|
-
const t =
|
|
174
|
+
const t = ue(this.value, this.min, this.max) && ve(this.value, this.props.minTime || ce, this.props.maxTime || pe), i = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && t, a = this.props.valid !== void 0 ? this.props.valid : s;
|
|
179
175
|
return {
|
|
180
176
|
customError: i,
|
|
181
177
|
rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
|
|
182
178
|
rangeUnderflow: this.value && this.value.getTime() < this.min.getTime() || !1,
|
|
183
|
-
valid:
|
|
179
|
+
valid: a,
|
|
184
180
|
valueMissing: this.value === null
|
|
185
181
|
};
|
|
186
182
|
}
|
|
@@ -207,7 +203,7 @@ const o = class o extends a.Component {
|
|
|
207
203
|
*/
|
|
208
204
|
componentDidMount() {
|
|
209
205
|
var t;
|
|
210
|
-
this.observerResize =
|
|
206
|
+
this.observerResize = O && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.show && this.forceUpdate(), (t = this.document) != null && t.body && this.observerResize && this.observerResize.observe(this.document.body);
|
|
211
207
|
}
|
|
212
208
|
/**
|
|
213
209
|
* @hidden
|
|
@@ -231,7 +227,7 @@ const o = class o extends a.Component {
|
|
|
231
227
|
size: t = o.defaultProps.size,
|
|
232
228
|
rounded: i = o.defaultProps.rounded,
|
|
233
229
|
fillMode: s = o.defaultProps.fillMode,
|
|
234
|
-
autoFocus:
|
|
230
|
+
autoFocus: a = o.defaultProps.autoFocus,
|
|
235
231
|
disabled: h,
|
|
236
232
|
tabIndex: l,
|
|
237
233
|
title: r,
|
|
@@ -250,9 +246,16 @@ const o = class o extends a.Component {
|
|
|
250
246
|
maxTime: N,
|
|
251
247
|
ariaLabelledBy: V,
|
|
252
248
|
ariaDescribedBy: L,
|
|
253
|
-
popup: _ =
|
|
254
|
-
unstyled: b
|
|
255
|
-
|
|
249
|
+
popup: _ = Q,
|
|
250
|
+
unstyled: b,
|
|
251
|
+
autoFill: q,
|
|
252
|
+
twoDigitYearMax: K,
|
|
253
|
+
enableMouseWheel: U,
|
|
254
|
+
autoCorrectParts: j,
|
|
255
|
+
autoSwitchParts: H,
|
|
256
|
+
autoSwitchKeys: W,
|
|
257
|
+
allowCaretMode: X
|
|
258
|
+
} = this.props, y = b && b.uDateTimePicker, S = !this.validityStyles || this.validity.valid, Y = {
|
|
256
259
|
id: u,
|
|
257
260
|
ariaLabelledBy: V,
|
|
258
261
|
ariaDescribedBy: L,
|
|
@@ -279,20 +282,27 @@ const o = class o extends a.Component {
|
|
|
279
282
|
size: null,
|
|
280
283
|
fillMode: null,
|
|
281
284
|
rounded: null,
|
|
282
|
-
unstyled: b
|
|
283
|
-
|
|
284
|
-
|
|
285
|
+
unstyled: b,
|
|
286
|
+
autoFill: q,
|
|
287
|
+
twoDigitYearMax: K,
|
|
288
|
+
enableMouseWheel: U,
|
|
289
|
+
autoCorrectParts: j,
|
|
290
|
+
autoSwitchParts: H,
|
|
291
|
+
autoSwitchKeys: W,
|
|
292
|
+
allowCaretMode: X
|
|
293
|
+
}, T = /* @__PURE__ */ n.createElement(
|
|
294
|
+
ee,
|
|
285
295
|
{
|
|
286
296
|
onFocus: this.handleFocus,
|
|
287
297
|
onBlur: this.handleBlur,
|
|
288
298
|
onSyncFocus: this.props.onFocus,
|
|
289
299
|
onSyncBlur: this.props.onBlur
|
|
290
300
|
},
|
|
291
|
-
({ onFocus:
|
|
301
|
+
({ onFocus: Z, onBlur: G }) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
292
302
|
"div",
|
|
293
303
|
{
|
|
294
|
-
ref: (
|
|
295
|
-
this._element =
|
|
304
|
+
ref: (J) => {
|
|
305
|
+
this._element = J;
|
|
296
306
|
},
|
|
297
307
|
className: I(
|
|
298
308
|
D.wrapper({
|
|
@@ -308,11 +318,11 @@ const o = class o extends a.Component {
|
|
|
308
318
|
),
|
|
309
319
|
onKeyDown: this.handleKeyDown,
|
|
310
320
|
style: { width: k },
|
|
311
|
-
onFocus: this.mobileMode ? void 0 :
|
|
312
|
-
onBlur:
|
|
321
|
+
onFocus: this.mobileMode ? void 0 : Z,
|
|
322
|
+
onBlur: G,
|
|
313
323
|
onClick: this.mobileMode ? this.handleDateIconClick : void 0
|
|
314
324
|
},
|
|
315
|
-
/* @__PURE__ */
|
|
325
|
+
/* @__PURE__ */ n.createElement(
|
|
316
326
|
this.dateInputComp,
|
|
317
327
|
{
|
|
318
328
|
_ref: this._dateInput,
|
|
@@ -320,27 +330,33 @@ const o = class o extends a.Component {
|
|
|
320
330
|
ariaControls: this._popupId,
|
|
321
331
|
ariaHasPopup: "dialog",
|
|
322
332
|
readonly: this.mobileMode,
|
|
323
|
-
autoFocus:
|
|
324
|
-
...
|
|
333
|
+
autoFocus: a,
|
|
334
|
+
...Y
|
|
325
335
|
}
|
|
326
336
|
),
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
|
|
337
|
+
/* @__PURE__ */ n.createElement(
|
|
338
|
+
re,
|
|
329
339
|
{
|
|
330
340
|
tabIndex: -1,
|
|
331
341
|
type: "button",
|
|
332
342
|
icon: "calendar",
|
|
333
|
-
svgIcon:
|
|
343
|
+
svgIcon: ae,
|
|
334
344
|
onMouseDown: this.handleIconMouseDown,
|
|
335
345
|
onClick: this.mobileMode ? void 0 : this.handleDateIconClick,
|
|
336
|
-
title: m(this).toLanguageString(
|
|
346
|
+
title: m(this).toLanguageString(
|
|
347
|
+
c,
|
|
348
|
+
p[c]
|
|
349
|
+
),
|
|
337
350
|
className: I(D.inputButton({ c: y })),
|
|
338
351
|
rounded: null,
|
|
339
352
|
fillMode: s,
|
|
340
|
-
"aria-label": m(this).toLanguageString(
|
|
353
|
+
"aria-label": m(this).toLanguageString(
|
|
354
|
+
c,
|
|
355
|
+
p[c]
|
|
356
|
+
)
|
|
341
357
|
}
|
|
342
358
|
),
|
|
343
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ n.createElement(
|
|
344
360
|
_,
|
|
345
361
|
{
|
|
346
362
|
show: this.show,
|
|
@@ -361,8 +377,8 @@ const o = class o extends a.Component {
|
|
|
361
377
|
)
|
|
362
378
|
), this.mobileMode && this.renderAdaptivePopup())
|
|
363
379
|
);
|
|
364
|
-
return this.props.label ? /* @__PURE__ */
|
|
365
|
-
|
|
380
|
+
return this.props.label ? /* @__PURE__ */ n.createElement(
|
|
381
|
+
we,
|
|
366
382
|
{
|
|
367
383
|
dateInput: this._dateInput,
|
|
368
384
|
label: this.props.label,
|
|
@@ -417,7 +433,12 @@ o.displayName = "DateTimePicker", o.propTypes = {
|
|
|
417
433
|
})
|
|
418
434
|
]),
|
|
419
435
|
formatPlaceholder: e.oneOfType([
|
|
420
|
-
e.oneOf([
|
|
436
|
+
e.oneOf([
|
|
437
|
+
"wide",
|
|
438
|
+
"narrow",
|
|
439
|
+
"short",
|
|
440
|
+
"formatPattern"
|
|
441
|
+
]),
|
|
421
442
|
e.shape({
|
|
422
443
|
year: e.string,
|
|
423
444
|
month: e.string,
|
|
@@ -459,30 +480,30 @@ o.displayName = "DateTimePicker", o.propTypes = {
|
|
|
459
480
|
disabled: !1,
|
|
460
481
|
format: "g",
|
|
461
482
|
// general date and time pattern (short time): "M/d/y h:mm a" for en.
|
|
462
|
-
max:
|
|
463
|
-
min:
|
|
483
|
+
max: he,
|
|
484
|
+
min: de,
|
|
464
485
|
popupSettings: {},
|
|
465
486
|
tabIndex: 0,
|
|
466
487
|
weekNumber: !1,
|
|
467
488
|
validityStyles: !0,
|
|
468
489
|
cancelButton: !0,
|
|
469
|
-
dateInput:
|
|
490
|
+
dateInput: ne,
|
|
470
491
|
size: "medium",
|
|
471
492
|
rounded: "medium",
|
|
472
493
|
fillMode: "solid",
|
|
473
494
|
autoFocus: !1
|
|
474
495
|
};
|
|
475
496
|
let f = o;
|
|
476
|
-
const
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
497
|
+
const Ie = te(), De = ie(
|
|
498
|
+
se(
|
|
499
|
+
Ie,
|
|
500
|
+
oe(f)
|
|
480
501
|
)
|
|
481
502
|
);
|
|
482
|
-
|
|
483
|
-
|
|
503
|
+
De.displayName = "KendoReactDateTimePicker";
|
|
504
|
+
fe(f);
|
|
484
505
|
export {
|
|
485
|
-
|
|
486
|
-
|
|
506
|
+
De as DateTimePicker,
|
|
507
|
+
Ie as DateTimePickerPropsContext,
|
|
487
508
|
f as DateTimePickerWithoutContext
|
|
488
509
|
};
|