@progress/kendo-react-dateinputs 8.2.0-develop.2 → 8.2.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/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +75 -71
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +76 -72
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +16 -13
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +92 -88
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +25 -0
- package/index.d.ts +25 -0
- package/package-metadata.mjs +1 -1
- package/package.json +7 -7
|
@@ -8,22 +8,22 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as a from "react";
|
|
10
10
|
import e from "prop-types";
|
|
11
|
-
import { Popup as
|
|
11
|
+
import { Popup as K } from "@progress/kendo-react-popup";
|
|
12
12
|
import { cloneDate as I } from "@progress/kendo-date-math";
|
|
13
|
-
import { Keys as h, 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
|
|
20
|
-
import { dateTimePickerCancel as S, messages as
|
|
21
|
-
import { provideLocalizationService as
|
|
22
|
-
import { DateTimeSelector as
|
|
23
|
-
import { isInTimeRange as
|
|
24
|
-
import { PickerFloatingLabel as
|
|
25
|
-
import { AdaptiveMode as
|
|
26
|
-
import { ActionSheetContent as
|
|
13
|
+
import { Keys as h, validatePackage as U, canUseDOM as y, AsyncFocusBlur as j, classNames as $, kendoThemeMaps as D, createPropsContext as W, withIdHOC as X, withPropsContext as H } from "@progress/kendo-react-common";
|
|
14
|
+
import { calendarIcon as Z } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { DateInput as G } from "../dateinput/DateInput.mjs";
|
|
16
|
+
import { Button as J } from "@progress/kendo-react-buttons";
|
|
17
|
+
import { packageMetadata as Q } from "../package-metadata.mjs";
|
|
18
|
+
import { MAX_DATE as Y, MIN_DATE as ee, isInDateRange as te, MAX_TIME as ie, MIN_TIME as se } from "../utils.mjs";
|
|
19
|
+
import { MOBILE_MEDIUM_DEVISE as oe } from "../common/constants.mjs";
|
|
20
|
+
import { dateTimePickerCancel as S, messages as p, dateTimePickerSet as T, toggleDateTimeSelector as m } from "../messages/index.mjs";
|
|
21
|
+
import { provideLocalizationService as c, registerForLocalization as ne } from "@progress/kendo-react-intl";
|
|
22
|
+
import { DateTimeSelector as ae } from "./DateTimeSelector.mjs";
|
|
23
|
+
import { isInTimeRange as re } from "../timepicker/utils.mjs";
|
|
24
|
+
import { PickerFloatingLabel as le } from "../hooks/usePickerFloatingLabel.mjs";
|
|
25
|
+
import { AdaptiveMode as de } from "../common/AdaptiveMode.mjs";
|
|
26
|
+
import { ActionSheetContent as he } from "@progress/kendo-react-layout";
|
|
27
27
|
const o = class o extends a.Component {
|
|
28
28
|
constructor(t) {
|
|
29
29
|
super(t), this._element = null, this._dateInput = a.createRef(), this._dateTimeSelector = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.focus = () => {
|
|
@@ -37,11 +37,11 @@ const o = class o extends a.Component {
|
|
|
37
37
|
format: d,
|
|
38
38
|
calendar: l,
|
|
39
39
|
cancelButton: r,
|
|
40
|
-
weekNumber:
|
|
40
|
+
weekNumber: u,
|
|
41
41
|
focusedDate: g
|
|
42
42
|
} = this.props;
|
|
43
43
|
return /* @__PURE__ */ a.createElement(
|
|
44
|
-
|
|
44
|
+
ae,
|
|
45
45
|
{
|
|
46
46
|
ref: (v) => {
|
|
47
47
|
this._dateTimeSelector = v;
|
|
@@ -52,7 +52,7 @@ const o = class o extends a.Component {
|
|
|
52
52
|
onChange: this.handleValueChange,
|
|
53
53
|
onReject: this.handleReject,
|
|
54
54
|
disabled: i,
|
|
55
|
-
weekNumber:
|
|
55
|
+
weekNumber: u,
|
|
56
56
|
min: this.min,
|
|
57
57
|
max: this.max,
|
|
58
58
|
minTime: s,
|
|
@@ -65,7 +65,7 @@ const o = class o extends a.Component {
|
|
|
65
65
|
}
|
|
66
66
|
);
|
|
67
67
|
}, this.renderAdaptivePopup = () => {
|
|
68
|
-
const { windowWidth: i = 0 } = this.state, s =
|
|
68
|
+
const { windowWidth: i = 0 } = this.state, s = c(this).toLanguageString(S, p[S]), n = c(this).toLanguageString(T, p[T]), d = {
|
|
69
69
|
expand: this.show,
|
|
70
70
|
onClose: this.handleBlur,
|
|
71
71
|
adaptiveTitle: this.props.adaptiveTitle,
|
|
@@ -83,7 +83,7 @@ const o = class o extends a.Component {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
return /* @__PURE__ */ a.createElement(
|
|
86
|
+
return /* @__PURE__ */ a.createElement(de, { ...d }, /* @__PURE__ */ a.createElement(he, { className: "!k-overflow-hidden" }, this.renderPicker()));
|
|
87
87
|
}, this.handleReject = () => {
|
|
88
88
|
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
89
89
|
}, this.handleValueChange = (i) => {
|
|
@@ -113,7 +113,7 @@ const o = class o extends a.Component {
|
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
s && (n === h.up || n === h.down) && (i.preventDefault(), i.stopPropagation(), this.shouldFocusDateInput = n === h.up, this.setShow(n === h.down));
|
|
116
|
-
}, this.dateInputElement = () => this.dateInput && this.dateInput.element || this.element && this.element.querySelector(".k-dateinput > input.k-input-inner"),
|
|
116
|
+
}, this.dateInputElement = () => this.dateInput && this.dateInput.element || this.element && this.element.querySelector(".k-dateinput > input.k-input-inner"), U(Q), this.state = {
|
|
117
117
|
value: this.props.defaultValue || o.defaultProps.defaultValue,
|
|
118
118
|
show: this.props.defaultShow || o.defaultProps.defaultShow,
|
|
119
119
|
focused: !1
|
|
@@ -161,7 +161,7 @@ const o = class o extends a.Component {
|
|
|
161
161
|
* The mobile mode of the ComboBox.
|
|
162
162
|
*/
|
|
163
163
|
get mobileMode() {
|
|
164
|
-
return !!(this.state.windowWidth && this.state.windowWidth <=
|
|
164
|
+
return !!(this.state.windowWidth && this.state.windowWidth <= oe && this.props.adaptive);
|
|
165
165
|
}
|
|
166
166
|
get min() {
|
|
167
167
|
return this.props.min !== void 0 ? this.props.min : o.defaultProps.min;
|
|
@@ -173,7 +173,7 @@ const o = class o extends a.Component {
|
|
|
173
173
|
* Represents the validity state into which the DateTimePicker is set.
|
|
174
174
|
*/
|
|
175
175
|
get validity() {
|
|
176
|
-
const t =
|
|
176
|
+
const t = te(this.value, this.min, this.max) && re(this.value, this.props.minTime || se, this.props.maxTime || ie), i = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && t, n = this.props.valid !== void 0 ? this.props.valid : s;
|
|
177
177
|
return {
|
|
178
178
|
customError: i,
|
|
179
179
|
rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
|
|
@@ -229,42 +229,43 @@ const o = class o extends a.Component {
|
|
|
229
229
|
size: t = o.defaultProps.size,
|
|
230
230
|
rounded: i = o.defaultProps.rounded,
|
|
231
231
|
fillMode: s = o.defaultProps.fillMode,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
232
|
+
autoFocus: n = o.defaultProps.autoFocus,
|
|
233
|
+
disabled: d,
|
|
234
|
+
tabIndex: l,
|
|
235
|
+
title: r,
|
|
236
|
+
id: u,
|
|
237
|
+
format: g,
|
|
238
|
+
formatPlaceholder: v,
|
|
239
|
+
min: M,
|
|
240
|
+
max: k,
|
|
241
|
+
className: O,
|
|
242
|
+
width: P,
|
|
243
|
+
name: C,
|
|
244
|
+
validationMessage: x,
|
|
245
|
+
required: E,
|
|
246
|
+
validityStyles: F,
|
|
247
|
+
minTime: R,
|
|
248
|
+
maxTime: z,
|
|
249
|
+
ariaLabelledBy: A,
|
|
250
|
+
ariaDescribedBy: B,
|
|
251
|
+
popup: N = K
|
|
252
|
+
} = this.props, w = !this.validityStyles || this.validity.valid, q = {
|
|
253
|
+
id: u,
|
|
254
|
+
ariaLabelledBy: A,
|
|
255
|
+
ariaDescribedBy: B,
|
|
256
|
+
format: g,
|
|
257
|
+
formatPlaceholder: v,
|
|
258
|
+
disabled: d,
|
|
259
|
+
title: r,
|
|
260
|
+
validityStyles: F,
|
|
261
|
+
validationMessage: x,
|
|
262
|
+
required: E,
|
|
263
|
+
min: M,
|
|
264
|
+
max: k,
|
|
265
|
+
minTime: R,
|
|
266
|
+
maxTime: z,
|
|
267
|
+
name: C,
|
|
268
|
+
tabIndex: this.show ? -1 : l,
|
|
268
269
|
valid: this.validity.valid,
|
|
269
270
|
value: this.value,
|
|
270
271
|
onChange: this.handleValueChange,
|
|
@@ -276,20 +277,20 @@ const o = class o extends a.Component {
|
|
|
276
277
|
fillMode: null,
|
|
277
278
|
rounded: null
|
|
278
279
|
}, b = /* @__PURE__ */ a.createElement(
|
|
279
|
-
|
|
280
|
+
j,
|
|
280
281
|
{
|
|
281
282
|
onFocus: this.handleFocus,
|
|
282
283
|
onBlur: this.handleBlur,
|
|
283
284
|
onSyncFocus: this.props.onFocus,
|
|
284
285
|
onSyncBlur: this.props.onBlur
|
|
285
286
|
},
|
|
286
|
-
({ onFocus:
|
|
287
|
+
({ onFocus: V, onBlur: L }) => /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
|
|
287
288
|
"div",
|
|
288
289
|
{
|
|
289
|
-
ref: (
|
|
290
|
-
this._element =
|
|
290
|
+
ref: (_) => {
|
|
291
|
+
this._element = _;
|
|
291
292
|
},
|
|
292
|
-
className:
|
|
293
|
+
className: $(
|
|
293
294
|
"k-input",
|
|
294
295
|
"k-datetimepicker",
|
|
295
296
|
{
|
|
@@ -300,12 +301,12 @@ const o = class o extends a.Component {
|
|
|
300
301
|
"k-required": this.required,
|
|
301
302
|
"k-disabled": this.props.disabled
|
|
302
303
|
},
|
|
303
|
-
|
|
304
|
+
O
|
|
304
305
|
),
|
|
305
306
|
onKeyDown: this.handleKeyDown,
|
|
306
|
-
style: { width:
|
|
307
|
-
onFocus: this.mobileMode ? void 0 :
|
|
308
|
-
onBlur:
|
|
307
|
+
style: { width: P },
|
|
308
|
+
onFocus: this.mobileMode ? void 0 : V,
|
|
309
|
+
onBlur: L,
|
|
309
310
|
onClick: this.mobileMode ? this.handleDateIconClick : void 0
|
|
310
311
|
},
|
|
311
312
|
/* @__PURE__ */ a.createElement(
|
|
@@ -315,27 +316,28 @@ const o = class o extends a.Component {
|
|
|
315
316
|
ariaRole: "combobox",
|
|
316
317
|
ariaControls: this._popupId,
|
|
317
318
|
readonly: this.mobileMode,
|
|
318
|
-
|
|
319
|
+
autoFocus: n,
|
|
320
|
+
...q
|
|
319
321
|
}
|
|
320
322
|
),
|
|
321
323
|
/* @__PURE__ */ a.createElement(
|
|
322
|
-
|
|
324
|
+
J,
|
|
323
325
|
{
|
|
324
326
|
tabIndex: -1,
|
|
325
327
|
type: "button",
|
|
326
328
|
icon: "calendar",
|
|
327
|
-
svgIcon:
|
|
329
|
+
svgIcon: Z,
|
|
328
330
|
onMouseDown: this.handleIconMouseDown,
|
|
329
331
|
onClick: this.mobileMode ? void 0 : this.handleDateIconClick,
|
|
330
|
-
title:
|
|
332
|
+
title: c(this).toLanguageString(m, p[m]),
|
|
331
333
|
className: "k-input-button",
|
|
332
334
|
rounded: null,
|
|
333
335
|
fillMode: s,
|
|
334
|
-
"aria-label":
|
|
336
|
+
"aria-label": c(this).toLanguageString(m, p[m])
|
|
335
337
|
}
|
|
336
338
|
),
|
|
337
339
|
/* @__PURE__ */ a.createElement(
|
|
338
|
-
|
|
340
|
+
N,
|
|
339
341
|
{
|
|
340
342
|
show: this.show,
|
|
341
343
|
animate: this.element !== null,
|
|
@@ -356,11 +358,11 @@ const o = class o extends a.Component {
|
|
|
356
358
|
), this.mobileMode && this.renderAdaptivePopup())
|
|
357
359
|
);
|
|
358
360
|
return this.props.label ? /* @__PURE__ */ a.createElement(
|
|
359
|
-
|
|
361
|
+
le,
|
|
360
362
|
{
|
|
361
363
|
dateInput: this._dateInput,
|
|
362
364
|
label: this.props.label,
|
|
363
|
-
editorId:
|
|
365
|
+
editorId: u,
|
|
364
366
|
editorValid: w,
|
|
365
367
|
editorDisabled: this.props.disabled,
|
|
366
368
|
children: b,
|
|
@@ -445,32 +447,34 @@ o.displayName = "DateTimePicker", o.propTypes = {
|
|
|
445
447
|
cancelButton: e.bool,
|
|
446
448
|
size: e.oneOf([null, "small", "medium", "large"]),
|
|
447
449
|
rounded: e.oneOf([null, "small", "medium", "large", "full"]),
|
|
448
|
-
fillMode: e.oneOf([null, "solid", "flat", "outline"])
|
|
450
|
+
fillMode: e.oneOf([null, "solid", "flat", "outline"]),
|
|
451
|
+
autoFocus: e.bool
|
|
449
452
|
}, o.defaultProps = {
|
|
450
453
|
defaultShow: !1,
|
|
451
454
|
defaultValue: null,
|
|
452
455
|
disabled: !1,
|
|
453
456
|
format: "g",
|
|
454
457
|
// general date and time pattern (short time): "M/d/y h:mm a" for en.
|
|
455
|
-
max:
|
|
456
|
-
min:
|
|
458
|
+
max: Y,
|
|
459
|
+
min: ee,
|
|
457
460
|
popupSettings: {},
|
|
458
461
|
tabIndex: 0,
|
|
459
462
|
weekNumber: !1,
|
|
460
463
|
required: !1,
|
|
461
464
|
validityStyles: !0,
|
|
462
465
|
cancelButton: !0,
|
|
463
|
-
dateInput:
|
|
466
|
+
dateInput: G,
|
|
464
467
|
size: "medium",
|
|
465
468
|
rounded: "medium",
|
|
466
|
-
fillMode: "solid"
|
|
469
|
+
fillMode: "solid",
|
|
470
|
+
autoFocus: !1
|
|
467
471
|
};
|
|
468
|
-
let
|
|
469
|
-
const
|
|
470
|
-
|
|
471
|
-
|
|
472
|
+
let f = o;
|
|
473
|
+
const ue = W(), pe = X(H(ue, f));
|
|
474
|
+
pe.displayName = "KendoReactDateTimePicker";
|
|
475
|
+
ne(f);
|
|
472
476
|
export {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
477
|
+
pe as DateTimePicker,
|
|
478
|
+
ue as DateTimePickerPropsContext,
|
|
479
|
+
f as DateTimePickerWithoutContext
|
|
476
480
|
};
|