@progress/kendo-react-dateinputs 9.0.0-develop.9 → 9.0.1-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/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +107 -93
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +97 -83
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +82 -68
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +111 -10
- package/index.d.ts +111 -10
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +78 -68
|
@@ -6,33 +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 { disabled: i, minTime: s, maxTime:
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
|
|
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,
|
|
36
36
|
{
|
|
37
37
|
ref: (w) => {
|
|
38
38
|
this._dateTimeSelector = w;
|
|
@@ -47,7 +47,7 @@ const o = class o extends a.Component {
|
|
|
47
47
|
min: this.min,
|
|
48
48
|
max: this.max,
|
|
49
49
|
minTime: s,
|
|
50
|
-
maxTime:
|
|
50
|
+
maxTime: a,
|
|
51
51
|
focusedDate: g,
|
|
52
52
|
format: h,
|
|
53
53
|
calendar: l,
|
|
@@ -60,7 +60,7 @@ const o = class o extends a.Component {
|
|
|
60
60
|
const { windowWidth: i = 0 } = this.state, s = m(this).toLanguageString(
|
|
61
61
|
P,
|
|
62
62
|
p[P]
|
|
63
|
-
),
|
|
63
|
+
), a = m(this).toLanguageString(
|
|
64
64
|
C,
|
|
65
65
|
p[C]
|
|
66
66
|
), h = {
|
|
@@ -74,19 +74,19 @@ const o = class o extends a.Component {
|
|
|
74
74
|
var r;
|
|
75
75
|
return (r = this._dateTimeSelector) == null ? void 0 : r.handleReject(l);
|
|
76
76
|
},
|
|
77
|
-
applyText:
|
|
77
|
+
applyText: a,
|
|
78
78
|
onApply: (l) => {
|
|
79
79
|
var r;
|
|
80
80
|
return (r = this._dateTimeSelector) == null ? void 0 : r.handleAccept(l);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
return /* @__PURE__ */
|
|
84
|
+
return /* @__PURE__ */ n.createElement(be, { ...h }, /* @__PURE__ */ n.createElement(ye, { overflowHidden: !0 }, this.renderPicker()));
|
|
85
85
|
}, this.handleReject = () => {
|
|
86
86
|
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
87
87
|
}, this.handleValueChange = (i) => {
|
|
88
88
|
this.setState({
|
|
89
|
-
value:
|
|
89
|
+
value: M(i.value || void 0)
|
|
90
90
|
}), this.valueDuringOnChange = i.value, this.showDuringOnChange = !1, this.mobileMode || (this.shouldFocusDateInput = !0);
|
|
91
91
|
const { onChange: s } = this.props;
|
|
92
92
|
s && s.call(void 0, {
|
|
@@ -105,13 +105,13 @@ const o = class o extends a.Component {
|
|
|
105
105
|
}, this.handleIconMouseDown = (i) => {
|
|
106
106
|
i.preventDefault();
|
|
107
107
|
}, this.handleKeyDown = (i) => {
|
|
108
|
-
const { altKey: s, keyCode:
|
|
109
|
-
if (
|
|
108
|
+
const { altKey: s, keyCode: a } = i;
|
|
109
|
+
if (a === d.esc) {
|
|
110
110
|
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
-
s && (
|
|
114
|
-
}, 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 = {
|
|
115
115
|
value: this.props.defaultValue || o.defaultProps.defaultValue,
|
|
116
116
|
show: this.props.defaultShow || o.defaultProps.defaultShow,
|
|
117
117
|
focused: !1
|
|
@@ -121,7 +121,7 @@ const o = class o extends a.Component {
|
|
|
121
121
|
return this.props.id + "-popup-id";
|
|
122
122
|
}
|
|
123
123
|
get document() {
|
|
124
|
-
if (
|
|
124
|
+
if (O)
|
|
125
125
|
return this.element && this.element.ownerDocument || document;
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
@@ -141,7 +141,7 @@ const o = class o extends a.Component {
|
|
|
141
141
|
*/
|
|
142
142
|
get value() {
|
|
143
143
|
const t = this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value;
|
|
144
|
-
return t !== null ?
|
|
144
|
+
return t !== null ? M(t) : null;
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
147
|
* Gets the popup state of the DateTimePicker.
|
|
@@ -159,7 +159,7 @@ const o = class o extends a.Component {
|
|
|
159
159
|
* The mobile mode of the ComboBox.
|
|
160
160
|
*/
|
|
161
161
|
get mobileMode() {
|
|
162
|
-
return !!(this.state.windowWidth && this.state.windowWidth <=
|
|
162
|
+
return !!(this.state.windowWidth && this.state.windowWidth <= me && this.props.adaptive);
|
|
163
163
|
}
|
|
164
164
|
get min() {
|
|
165
165
|
return this.props.min !== void 0 ? this.props.min : o.defaultProps.min;
|
|
@@ -171,12 +171,12 @@ const o = class o extends a.Component {
|
|
|
171
171
|
* Represents the validity state into which the DateTimePicker is set.
|
|
172
172
|
*/
|
|
173
173
|
get validity() {
|
|
174
|
-
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;
|
|
175
175
|
return {
|
|
176
176
|
customError: i,
|
|
177
177
|
rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
|
|
178
178
|
rangeUnderflow: this.value && this.value.getTime() < this.min.getTime() || !1,
|
|
179
|
-
valid:
|
|
179
|
+
valid: a,
|
|
180
180
|
valueMissing: this.value === null
|
|
181
181
|
};
|
|
182
182
|
}
|
|
@@ -203,7 +203,7 @@ const o = class o extends a.Component {
|
|
|
203
203
|
*/
|
|
204
204
|
componentDidMount() {
|
|
205
205
|
var t;
|
|
206
|
-
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);
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
209
|
* @hidden
|
|
@@ -227,7 +227,7 @@ const o = class o extends a.Component {
|
|
|
227
227
|
size: t = o.defaultProps.size,
|
|
228
228
|
rounded: i = o.defaultProps.rounded,
|
|
229
229
|
fillMode: s = o.defaultProps.fillMode,
|
|
230
|
-
autoFocus:
|
|
230
|
+
autoFocus: a = o.defaultProps.autoFocus,
|
|
231
231
|
disabled: h,
|
|
232
232
|
tabIndex: l,
|
|
233
233
|
title: r,
|
|
@@ -246,9 +246,16 @@ const o = class o extends a.Component {
|
|
|
246
246
|
maxTime: N,
|
|
247
247
|
ariaLabelledBy: V,
|
|
248
248
|
ariaDescribedBy: L,
|
|
249
|
-
popup: _ =
|
|
250
|
-
unstyled: b
|
|
251
|
-
|
|
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 = {
|
|
252
259
|
id: u,
|
|
253
260
|
ariaLabelledBy: V,
|
|
254
261
|
ariaDescribedBy: L,
|
|
@@ -275,20 +282,27 @@ const o = class o extends a.Component {
|
|
|
275
282
|
size: null,
|
|
276
283
|
fillMode: null,
|
|
277
284
|
rounded: null,
|
|
278
|
-
unstyled: b
|
|
279
|
-
|
|
280
|
-
|
|
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,
|
|
281
295
|
{
|
|
282
296
|
onFocus: this.handleFocus,
|
|
283
297
|
onBlur: this.handleBlur,
|
|
284
298
|
onSyncFocus: this.props.onFocus,
|
|
285
299
|
onSyncBlur: this.props.onBlur
|
|
286
300
|
},
|
|
287
|
-
({ onFocus:
|
|
301
|
+
({ onFocus: Z, onBlur: G }) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
288
302
|
"div",
|
|
289
303
|
{
|
|
290
|
-
ref: (
|
|
291
|
-
this._element =
|
|
304
|
+
ref: (J) => {
|
|
305
|
+
this._element = J;
|
|
292
306
|
},
|
|
293
307
|
className: I(
|
|
294
308
|
D.wrapper({
|
|
@@ -304,11 +318,11 @@ const o = class o extends a.Component {
|
|
|
304
318
|
),
|
|
305
319
|
onKeyDown: this.handleKeyDown,
|
|
306
320
|
style: { width: k },
|
|
307
|
-
onFocus: this.mobileMode ? void 0 :
|
|
308
|
-
onBlur:
|
|
321
|
+
onFocus: this.mobileMode ? void 0 : Z,
|
|
322
|
+
onBlur: G,
|
|
309
323
|
onClick: this.mobileMode ? this.handleDateIconClick : void 0
|
|
310
324
|
},
|
|
311
|
-
/* @__PURE__ */
|
|
325
|
+
/* @__PURE__ */ n.createElement(
|
|
312
326
|
this.dateInputComp,
|
|
313
327
|
{
|
|
314
328
|
_ref: this._dateInput,
|
|
@@ -316,17 +330,17 @@ const o = class o extends a.Component {
|
|
|
316
330
|
ariaControls: this._popupId,
|
|
317
331
|
ariaHasPopup: "dialog",
|
|
318
332
|
readonly: this.mobileMode,
|
|
319
|
-
autoFocus:
|
|
320
|
-
...
|
|
333
|
+
autoFocus: a,
|
|
334
|
+
...Y
|
|
321
335
|
}
|
|
322
336
|
),
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
|
|
337
|
+
/* @__PURE__ */ n.createElement(
|
|
338
|
+
re,
|
|
325
339
|
{
|
|
326
340
|
tabIndex: -1,
|
|
327
341
|
type: "button",
|
|
328
342
|
icon: "calendar",
|
|
329
|
-
svgIcon:
|
|
343
|
+
svgIcon: ae,
|
|
330
344
|
onMouseDown: this.handleIconMouseDown,
|
|
331
345
|
onClick: this.mobileMode ? void 0 : this.handleDateIconClick,
|
|
332
346
|
title: m(this).toLanguageString(
|
|
@@ -342,7 +356,7 @@ const o = class o extends a.Component {
|
|
|
342
356
|
)
|
|
343
357
|
}
|
|
344
358
|
),
|
|
345
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ n.createElement(
|
|
346
360
|
_,
|
|
347
361
|
{
|
|
348
362
|
show: this.show,
|
|
@@ -363,8 +377,8 @@ const o = class o extends a.Component {
|
|
|
363
377
|
)
|
|
364
378
|
), this.mobileMode && this.renderAdaptivePopup())
|
|
365
379
|
);
|
|
366
|
-
return this.props.label ? /* @__PURE__ */
|
|
367
|
-
|
|
380
|
+
return this.props.label ? /* @__PURE__ */ n.createElement(
|
|
381
|
+
we,
|
|
368
382
|
{
|
|
369
383
|
dateInput: this._dateInput,
|
|
370
384
|
label: this.props.label,
|
|
@@ -466,30 +480,30 @@ o.displayName = "DateTimePicker", o.propTypes = {
|
|
|
466
480
|
disabled: !1,
|
|
467
481
|
format: "g",
|
|
468
482
|
// general date and time pattern (short time): "M/d/y h:mm a" for en.
|
|
469
|
-
max:
|
|
470
|
-
min:
|
|
483
|
+
max: he,
|
|
484
|
+
min: de,
|
|
471
485
|
popupSettings: {},
|
|
472
486
|
tabIndex: 0,
|
|
473
487
|
weekNumber: !1,
|
|
474
488
|
validityStyles: !0,
|
|
475
489
|
cancelButton: !0,
|
|
476
|
-
dateInput:
|
|
490
|
+
dateInput: ne,
|
|
477
491
|
size: "medium",
|
|
478
492
|
rounded: "medium",
|
|
479
493
|
fillMode: "solid",
|
|
480
494
|
autoFocus: !1
|
|
481
495
|
};
|
|
482
496
|
let f = o;
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
497
|
+
const Ie = te(), De = ie(
|
|
498
|
+
se(
|
|
499
|
+
Ie,
|
|
500
|
+
oe(f)
|
|
487
501
|
)
|
|
488
502
|
);
|
|
489
|
-
|
|
490
|
-
|
|
503
|
+
De.displayName = "KendoReactDateTimePicker";
|
|
504
|
+
fe(f);
|
|
491
505
|
export {
|
|
492
|
-
|
|
493
|
-
|
|
506
|
+
De as DateTimePicker,
|
|
507
|
+
Ie as DateTimePickerPropsContext,
|
|
494
508
|
f as DateTimePickerWithoutContext
|
|
495
509
|
};
|