@progress/kendo-react-dateinputs 8.2.0-develop.8 → 8.2.0
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 +77 -73
- 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 n from "react";
|
|
10
10
|
import e from "prop-types";
|
|
11
|
-
import { Popup as
|
|
12
|
-
import { getDate as
|
|
13
|
-
import { classNames as M, Keys as r, validatePackage as
|
|
14
|
-
import { calendarIcon as
|
|
15
|
-
import { packageMetadata as
|
|
16
|
-
import { DateInput as
|
|
17
|
-
import { Calendar as
|
|
18
|
-
import { MAX_DATE as
|
|
19
|
-
import { toggleCalendar as E, messages as
|
|
20
|
-
import { provideLocalizationService as
|
|
21
|
-
import { ToggleButton as
|
|
22
|
-
import { PickerWrap as
|
|
23
|
-
import { PickerFloatingLabel as
|
|
24
|
-
import { ActionSheetContent as
|
|
25
|
-
import { AdaptiveMode as
|
|
26
|
-
import { MOBILE_MEDIUM_DEVISE as
|
|
11
|
+
import { Popup as W } from "@progress/kendo-react-popup";
|
|
12
|
+
import { getDate as _, cloneDate as O } from "@progress/kendo-date-math";
|
|
13
|
+
import { classNames as M, Keys as r, validatePackage as K, canUseDOM as P, AsyncFocusBlur as U, kendoThemeMaps as T, createPropsContext as $, withIdHOC as H, withPropsContext as X } from "@progress/kendo-react-common";
|
|
14
|
+
import { calendarIcon as Z } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { packageMetadata as j } from "../package-metadata.mjs";
|
|
16
|
+
import { DateInput as G } from "../dateinput/DateInput.mjs";
|
|
17
|
+
import { Calendar as J } from "../calendar/components/Calendar.mjs";
|
|
18
|
+
import { MAX_DATE as Q, MIN_DATE as Y, isInDateRange as ee, setTime as te } from "../utils.mjs";
|
|
19
|
+
import { toggleCalendar as E, messages as ie } from "../messages/index.mjs";
|
|
20
|
+
import { provideLocalizationService as se, registerForLocalization as oe } from "@progress/kendo-react-intl";
|
|
21
|
+
import { ToggleButton as ae } from "./ToggleButton.mjs";
|
|
22
|
+
import { PickerWrap as ne } from "../common/PickerWrap.mjs";
|
|
23
|
+
import { PickerFloatingLabel as re } from "../hooks/usePickerFloatingLabel.mjs";
|
|
24
|
+
import { ActionSheetContent as le } from "@progress/kendo-react-layout";
|
|
25
|
+
import { AdaptiveMode as de } from "../common/AdaptiveMode.mjs";
|
|
26
|
+
import { MOBILE_MEDIUM_DEVISE as ue } from "../common/constants.mjs";
|
|
27
27
|
const o = class o extends n.Component {
|
|
28
28
|
constructor(i) {
|
|
29
29
|
super(i), this._element = null, this._dateInput = n.createRef(), this._calendar = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.focus = () => {
|
|
@@ -31,7 +31,7 @@ const o = class o extends n.Component {
|
|
|
31
31
|
}, this.setCalendarRef = (t) => {
|
|
32
32
|
this._calendar = t;
|
|
33
33
|
}, this.nextValue = (t, s) => t.value !== void 0 ? t.value : s.value, this.nextShow = (t, s) => t.show !== void 0 ? t.show : s.show, this.renderPopup = () => {
|
|
34
|
-
const { disabled: t, min: s, max: a, weekNumber: c, focusedDate: m, popupSettings: l } = this.props, { popupClass: f, ...g } = l, v = this.show, d = this.value, w = d &&
|
|
34
|
+
const { disabled: t, min: s, max: a, weekNumber: c, focusedDate: m, popupSettings: l } = this.props, { popupClass: f, ...g } = l, v = this.show, d = this.value, w = d && _(d), u = M(
|
|
35
35
|
f
|
|
36
36
|
), b = {
|
|
37
37
|
popupClass: "k-datepicker-popup",
|
|
@@ -67,7 +67,7 @@ const o = class o extends n.Component {
|
|
|
67
67
|
adaptiveTitle: this.props.adaptiveTitle,
|
|
68
68
|
windowWidth: t
|
|
69
69
|
};
|
|
70
|
-
return /* @__PURE__ */ n.createElement(
|
|
70
|
+
return /* @__PURE__ */ n.createElement(de, { ...s }, /* @__PURE__ */ n.createElement(le, { className: "!k-overflow-hidden" }, this.renderPopup()));
|
|
71
71
|
}, this.handleInputValueChange = (t) => {
|
|
72
72
|
this.handleValueChange(t.value, t);
|
|
73
73
|
}, this.handleCalendarValueChange = (t) => {
|
|
@@ -95,12 +95,12 @@ const o = class o extends n.Component {
|
|
|
95
95
|
t.preventDefault();
|
|
96
96
|
}, this.handleKeyDown = (t) => {
|
|
97
97
|
const { altKey: s, keyCode: a } = t;
|
|
98
|
-
if (a === r.esc) {
|
|
98
|
+
if (a === r.esc && this.show) {
|
|
99
99
|
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
s && (a === r.up || a === r.down) && (t.preventDefault(), t.stopPropagation(), this.shouldFocusDateInput = a === r.up, this.setShow(a === r.down));
|
|
103
|
-
},
|
|
103
|
+
}, K(j), this.state = {
|
|
104
104
|
value: this.props.defaultValue || o.defaultProps.defaultValue,
|
|
105
105
|
show: this.props.defaultShow || o.defaultProps.defaultShow,
|
|
106
106
|
focused: !1
|
|
@@ -123,7 +123,7 @@ const o = class o extends n.Component {
|
|
|
123
123
|
* The mobile mode of the DatePicker.
|
|
124
124
|
*/
|
|
125
125
|
get mobileMode() {
|
|
126
|
-
return !!(this.state.windowWidth && this.state.windowWidth <=
|
|
126
|
+
return !!(this.state.windowWidth && this.state.windowWidth <= ue && this.props.adaptive);
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
129
129
|
* Gets the DateInput component inside the DatePicker component.
|
|
@@ -181,7 +181,7 @@ const o = class o extends n.Component {
|
|
|
181
181
|
* Represents the validity state into which the DatePicker is set.
|
|
182
182
|
*/
|
|
183
183
|
get validity() {
|
|
184
|
-
const i =
|
|
184
|
+
const i = ee(this.value, this.min, this.max), t = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && i, a = this.props.valid !== void 0 ? this.props.valid : s;
|
|
185
185
|
return {
|
|
186
186
|
customError: t,
|
|
187
187
|
rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
|
|
@@ -244,42 +244,43 @@ const o = class o extends n.Component {
|
|
|
244
244
|
validationMessage: h,
|
|
245
245
|
required: x,
|
|
246
246
|
validityStyles: B,
|
|
247
|
-
ariaLabelledBy:
|
|
248
|
-
ariaDescribedBy:
|
|
249
|
-
ariaLabel:
|
|
247
|
+
ariaLabelledBy: F,
|
|
248
|
+
ariaDescribedBy: V,
|
|
249
|
+
ariaLabel: z,
|
|
250
250
|
placeholder: N,
|
|
251
251
|
label: y,
|
|
252
|
-
popupSettings:
|
|
253
|
-
defaultValue:
|
|
254
|
-
defaultShow:
|
|
255
|
-
value:
|
|
256
|
-
popup:
|
|
257
|
-
weekNumber:
|
|
258
|
-
dateInput:
|
|
259
|
-
calendar:
|
|
260
|
-
toggleButton:
|
|
261
|
-
onChange:
|
|
262
|
-
onBlur:
|
|
263
|
-
onFocus:
|
|
264
|
-
show:
|
|
265
|
-
onOpen:
|
|
266
|
-
pickerWrap:
|
|
267
|
-
adaptive:
|
|
268
|
-
adaptiveTitle:
|
|
269
|
-
valid:
|
|
252
|
+
popupSettings: ce,
|
|
253
|
+
defaultValue: me,
|
|
254
|
+
defaultShow: fe,
|
|
255
|
+
value: ge,
|
|
256
|
+
popup: ve,
|
|
257
|
+
weekNumber: we,
|
|
258
|
+
dateInput: be,
|
|
259
|
+
calendar: ye,
|
|
260
|
+
toggleButton: Ie,
|
|
261
|
+
onChange: Ce,
|
|
262
|
+
onBlur: De,
|
|
263
|
+
onFocus: ke,
|
|
264
|
+
show: Se,
|
|
265
|
+
onOpen: Oe,
|
|
266
|
+
pickerWrap: Me,
|
|
267
|
+
adaptive: Pe,
|
|
268
|
+
adaptiveTitle: Te,
|
|
269
|
+
valid: Ee,
|
|
270
|
+
autoFocus: R,
|
|
270
271
|
// Removed to support direct use in Form Field component
|
|
271
|
-
visited:
|
|
272
|
-
touched:
|
|
273
|
-
modified:
|
|
272
|
+
visited: xe,
|
|
273
|
+
touched: Be,
|
|
274
|
+
modified: Fe,
|
|
274
275
|
...I
|
|
275
|
-
} = this.props,
|
|
276
|
+
} = this.props, A = this.value, C = !this.validityStyles || this.validity.valid, q = {
|
|
276
277
|
disabled: a,
|
|
277
278
|
format: f,
|
|
278
279
|
formatPlaceholder: g,
|
|
279
280
|
id: l,
|
|
280
|
-
ariaLabelledBy:
|
|
281
|
-
ariaDescribedBy:
|
|
282
|
-
ariaLabel:
|
|
281
|
+
ariaLabelledBy: F,
|
|
282
|
+
ariaDescribedBy: V,
|
|
283
|
+
ariaLabel: z,
|
|
283
284
|
max: d,
|
|
284
285
|
min: v,
|
|
285
286
|
name: b,
|
|
@@ -290,15 +291,15 @@ const o = class o extends n.Component {
|
|
|
290
291
|
valid: this.validity.valid,
|
|
291
292
|
validationMessage: h,
|
|
292
293
|
validityStyles: B,
|
|
293
|
-
value:
|
|
294
|
+
value: A,
|
|
294
295
|
label: void 0,
|
|
295
296
|
placeholder: this.state.focused ? null : N,
|
|
296
297
|
ariaExpanded: this.show,
|
|
297
298
|
size: null,
|
|
298
299
|
fillMode: null,
|
|
299
300
|
rounded: null
|
|
300
|
-
}, D =
|
|
301
|
-
|
|
301
|
+
}, D = se(this).toLanguageString(E, ie[E]), k = /* @__PURE__ */ n.createElement(
|
|
302
|
+
U,
|
|
302
303
|
{
|
|
303
304
|
onFocus: this.handleFocus,
|
|
304
305
|
onBlur: this.mobileMode ? void 0 : this.handleBlur,
|
|
@@ -309,8 +310,8 @@ const o = class o extends n.Component {
|
|
|
309
310
|
"span",
|
|
310
311
|
{
|
|
311
312
|
...y ? {} : I,
|
|
312
|
-
ref: (
|
|
313
|
-
this._element =
|
|
313
|
+
ref: (L) => {
|
|
314
|
+
this._element = L;
|
|
314
315
|
},
|
|
315
316
|
className: M(
|
|
316
317
|
"k-input",
|
|
@@ -339,7 +340,8 @@ const o = class o extends n.Component {
|
|
|
339
340
|
readonly: this.mobileMode,
|
|
340
341
|
ariaExpanded: this.show,
|
|
341
342
|
ariaControls: this._popupId,
|
|
342
|
-
|
|
343
|
+
autoFocus: R,
|
|
344
|
+
...q
|
|
343
345
|
}
|
|
344
346
|
),
|
|
345
347
|
/* @__PURE__ */ n.createElement(
|
|
@@ -347,7 +349,7 @@ const o = class o extends n.Component {
|
|
|
347
349
|
{
|
|
348
350
|
type: "button",
|
|
349
351
|
icon: "calendar",
|
|
350
|
-
svgIcon:
|
|
352
|
+
svgIcon: Z,
|
|
351
353
|
title: D,
|
|
352
354
|
className: "k-input-button",
|
|
353
355
|
rounded: null,
|
|
@@ -361,7 +363,7 @@ const o = class o extends n.Component {
|
|
|
361
363
|
), this.mobileMode && this.renderAdaptivePopup())
|
|
362
364
|
);
|
|
363
365
|
return y ? /* @__PURE__ */ n.createElement(
|
|
364
|
-
|
|
366
|
+
re,
|
|
365
367
|
{
|
|
366
368
|
dateInput: this._dateInput,
|
|
367
369
|
label: y,
|
|
@@ -383,7 +385,7 @@ const o = class o extends n.Component {
|
|
|
383
385
|
}));
|
|
384
386
|
}
|
|
385
387
|
mergeTime(i) {
|
|
386
|
-
return this.value && i ?
|
|
388
|
+
return this.value && i ? te(i, this.value) : i;
|
|
387
389
|
}
|
|
388
390
|
nextTick(i) {
|
|
389
391
|
clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => i());
|
|
@@ -456,19 +458,20 @@ o.displayName = "DatePicker", o.propTypes = {
|
|
|
456
458
|
rounded: e.oneOf([null, "small", "medium", "large", "full"]),
|
|
457
459
|
fillMode: e.oneOf([null, "solid", "flat", "outline"]),
|
|
458
460
|
adaptive: e.bool,
|
|
459
|
-
adaptiveTitle: e.string
|
|
461
|
+
adaptiveTitle: e.string,
|
|
462
|
+
autoFocus: e.bool
|
|
460
463
|
}, o.defaultProps = {
|
|
461
464
|
defaultShow: !1,
|
|
462
465
|
defaultValue: null,
|
|
463
|
-
dateInput:
|
|
464
|
-
calendar:
|
|
465
|
-
toggleButton:
|
|
466
|
-
popup:
|
|
467
|
-
pickerWrap:
|
|
466
|
+
dateInput: G,
|
|
467
|
+
calendar: J,
|
|
468
|
+
toggleButton: ae,
|
|
469
|
+
popup: W,
|
|
470
|
+
pickerWrap: ne,
|
|
468
471
|
disabled: !1,
|
|
469
472
|
format: "d",
|
|
470
|
-
max:
|
|
471
|
-
min:
|
|
473
|
+
max: Q,
|
|
474
|
+
min: Y,
|
|
472
475
|
popupSettings: {},
|
|
473
476
|
tabIndex: 0,
|
|
474
477
|
weekNumber: !1,
|
|
@@ -476,14 +479,15 @@ o.displayName = "DatePicker", o.propTypes = {
|
|
|
476
479
|
validityStyles: !0,
|
|
477
480
|
size: "medium",
|
|
478
481
|
rounded: "medium",
|
|
479
|
-
fillMode: "solid"
|
|
482
|
+
fillMode: "solid",
|
|
483
|
+
autoFocus: !1
|
|
480
484
|
};
|
|
481
485
|
let p = o;
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
|
|
486
|
+
const he = $(), pe = H(X(he, p));
|
|
487
|
+
pe.displayName = "KendoReactDatePicker";
|
|
488
|
+
oe(p);
|
|
485
489
|
export {
|
|
486
|
-
|
|
487
|
-
|
|
490
|
+
pe as DatePicker,
|
|
491
|
+
he as DatePickerPropsContext,
|
|
488
492
|
p as DatePickerWithoutContext
|
|
489
493
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),t=require("prop-types"),M=require("@progress/kendo-react-popup"),D=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),c=require("@progress/kendo-react-intl"),O=require("@progress/kendo-svg-icons"),k=require("../package-metadata.js"),g=require("../dateinput/DateInput.js"),T=require("../calendar/components/MultiViewCalendar.js"),h=require("../calendar/models/SelectionRange.js"),u=require("../utils.js"),x=require("../common/constants.js"),n=require("../messages/index.js"),P=require("@progress/kendo-react-buttons"),_=require("../common/AdaptiveMode.js"),N=require("@progress/kendo-react-layout");function A(d){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>d[e]})}}return a.default=d,Object.freeze(a)}const i=A(R),l=class l extends i.Component{constructor(a){super(a),this._element=null,this._calendar=null,this._startDateInput=i.createRef(),this._endDateInput=i.createRef(),this.shouldFocusDateInput=!1,this.shouldFocusCalendar=!1,this.focus=()=>{this.startDateInput&&this.startDateInput.focus()},this.setCalendarRef=e=>{this._calendar=e},this.focusCalendarElement=()=>{this._calendar&&this._calendar.element&&this._calendar.element.focus({preventScroll:!0})},this.calculateValue=(e,s)=>(e.value!==void 0?e.value:s.value)||h.EMPTY_SELECTIONRANGE,this.calculateShow=(e,s)=>e.show!==void 0?e.show:s.show,this.renderCalendar=()=>{const e=this.value||h.EMPTY_SELECTIONRANGE,s={min:this.min,max:this.max,allowReverse:this.props.allowReverse,mode:"range",focusedDate:this.props.focusedDate,disabled:this.props.disabled,className:this.mobileMode?"k-calendar-lg":"",mobileMode:this.mobileMode,...this.props.calendarSettings,value:e,dir:this.props.dir,onChange:this.handleCalendarChange};return this.props.calendar?i.createElement(this.props.calendar,{...s}):i.createElement(T.MultiViewCalendar,{...s,ref:this.setCalendarRef})},this.renderPopup=()=>{const e={popupClass:o.classNames("k-calendar-container","k-daterangepicker-popup"),animate:this._element!==null,anchor:this._element,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...this.props.popupSettings,show:this.show};return this.props.popup?i.createElement(this.props.popup,{...e},this.renderCalendar()):i.createElement(M.Popup,{...e},this.renderCalendar())},this.renderAdaptivePopup=()=>{const{windowWidth:e=0}=this.state,s={expand:this.show,onClose:r=>this.handleCancel(r),adaptiveTitle:this.props.adaptiveTitle,windowWidth:e,footer:{cancelText:this.localizationService.toLanguageString(n.dateRangePickerCancel,n.messages[n.dateRangePickerCancel]),onCancel:this.handleCancel,applyText:this.localizationService.toLanguageString(n.dateRangePickerSet,n.messages[n.dateRangePickerSet]),onApply:this.handleBlur}};return i.createElement(_.AdaptiveMode,{...s},i.createElement(N.ActionSheetContent,{className:"!k-overflow-hidden"},i.createElement("div",{className:"k-scrollable-wrap"},this.renderCalendar())))},this.handleReverseClick=e=>{const s={start:this.value.end,end:this.value.start},r={syntheticEvent:e,nativeEvent:e.nativeEvent};this.handleChange(s,r)},this.handleReverseMouseDown=e=>{e.preventDefault()},this.handleFocus=e=>{clearTimeout(this.nextTickId),this.shouldFocusDateInput||this.mobileMode&&this.setState({currentValue:this.value});const{onFocus:s}=this.props;s&&s.call(void 0,e)},this.handleClick=()=>{this.shouldFocusDateInput||this.setShow(!0)},this.handleBlur=e=>{this.nextTick(()=>{this.setShow(!1)});const{onBlur:s}=this.props;s&&s.call(void 0,e)},this.handleCancel=e=>{this.nextTick(()=>{this.setShow(!1),this.setState({currentValue:h.EMPTY_SELECTIONRANGE})});const{onCancel:s}=this.props;s&&s.call(void 0,e)},this.handleEndChange=e=>{const s={start:this.value.start,end:D.cloneDate(e.value||void 0)};this.handleChange(s,e)},this.handleStartChange=e=>{const s={start:D.cloneDate(e.value||void 0),end:this.value.end};this.handleChange(s,e)},this.extractRangeFromValue=e=>{if(!Array.isArray(e.value)&&!(e.value instanceof Date))return e.value||h.EMPTY_SELECTIONRANGE;const s=Array.isArray(e.value)?e.value[0]:e.value;return{start:this.value.end!==null?s:this.value.start,end:this.value.start!==null?s:this.value.end}},this.handleCalendarChange=e=>{const s=this.extractRangeFromValue(e);this.handleChange(s,e)},this.handleKeyDown=e=>{const{keyCode:s,altKey:r}=e;s===o.Keys.esc?(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1)):r&&s===o.Keys.down?(e.preventDefault(),this.shouldFocusCalendar=!0,this.setShow(!0),this.focusCalendarElement()):r&&s===o.Keys.up&&(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1))},this.handleChange=(e,s)=>{this.setState({value:e}),this.valueDuringOnChange=e;const{onChange:r}=this.props;if(r){const m={syntheticEvent:s.syntheticEvent,nativeEvent:s.nativeEvent,value:this.value,show:this.show,target:this};r.call(void 0,m)}this.valueDuringOnChange=void 0},o.validatePackage(k.packageMetadata),this.state={show:this.props.show||this.props.defaultShow||l.defaultProps.defaultShow,value:this.props.value||this.props.defaultValue||l.defaultProps.defaultValue,currentValue:h.EMPTY_SELECTIONRANGE},this.nextTick=this.nextTick.bind(this),this.setShow=this.setShow.bind(this),this.focusCalendarElement=this.focusCalendarElement.bind(this),this.focusDateInputElement=this.focusDateInputElement.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get _startInputId(){return this.props.id+"-start-input-id"}get _endInputId(){return this.props.id+"-end-input-id"}get element(){return this._element}get startDateInput(){return this._startDateInput.current}get endDateInput(){return this._endDateInput.current}get calendar(){return this._calendar}get value(){return(this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value)||h.EMPTY_SELECTIONRANGE}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get min(){return this.props.min!==void 0?this.props.min:l.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:l.defaultProps.max}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}get localizationService(){return c.provideLocalizationService(this)}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=x.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}componentDidMount(){var a;this.observerResize=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this.shouldFocusCalendar&&this.focusCalendarElement(),this.shouldFocusDateInput&&this.focusDateInputElement(),this.shouldFocusCalendar=!1,this.shouldFocusDateInput=!1}componentWillUnmount(){var a;clearTimeout(this.nextTickId),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.disconnect()}render(){const a=this.value||h.EMPTY_SELECTIONRANGE,e=this.mobileMode&&this.show?this.state.currentValue:a,s=(this.props.startDateInputSettings||{}).id||this._startInputId,r=(this.props.endDateInputSettings||{}).id||this._endInputId,m=o.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),b=this.localizationService.toLanguageString(n.start,n.messages[n.start]),E=this.localizationService.toLanguageString(n.end,n.messages[n.end]),S=this.localizationService.toLanguageString(n.separator,n.messages[n.separator]),f={disableSelection:this.mobileMode&&!0,label:b,format:this.props.format,min:this.min,max:this.max,id:this._startInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,clearButton:this.props.clearButton,...this.props.startDateInputSettings,value:e.start,onChange:this.handleStartChange},v={disableSelection:this.mobileMode&&!0,label:E,format:this.props.format,min:this.min,max:this.max,id:this._endInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,clearButton:this.props.clearButton,...this.props.endDateInputSettings,value:e.end,onChange:this.handleEndChange},C=i.createElement(P.Button,{type:"button",className:"k-select",fillMode:"flat",title:c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd]),onMouseDown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":s+" "+r,"aria-label":c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd])},i.createElement(o.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:O.arrowsSwapIcon}));return i.createElement(i.Fragment,null,i.createElement("span",{ref:y=>{this._element=y},className:m,style:this.props.style,id:this.props.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.tabIndex,onFocus:this.handleFocus,onClick:this.handleClick,onKeyDown:this.handleKeyDown,onBlur:this.mobileMode?void 0:this.handleBlur,dir:this.props.dir},this.props.startDateInput?i.createElement(this.props.startDateInput,{...f}):i.createElement(g.DateInput,{...f,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?C:S,this.props.endDateInput?i.createElement(this.props.endDateInput,{...v}):i.createElement(g.DateInput,{...v,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup())}focusDateInputElement(){if(!document||!this.startDateInput||!this.startDateInput.element||!this.endDateInput||!this.endDateInput.element)return;const a=o.getActiveElement(document);(this.value.start===null||this.value.end!==null)&&a!==this.endDateInput.element?this.startDateInput.element.focus({preventScroll:!0}):a!==this.startDateInput.element&&this.endDateInput.element.focus({preventScroll:!0})}nextTick(a){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>a())}setShow(a){const{onOpen:e,onClose:s}=this.props;this.show!==a&&(this.setState({show:a}),a&&e&&e.call(void 0,{target:this}),!a&&s&&s.call(void 0,{target:this}))}calculateMedia(a){for(const e of a)this.setState({windowWidth:e.target.clientWidth})}};l.displayName="DateRangePicker",l.propTypes={allowReverse:t.bool,calendarSettings:t.any,className:t.string,defaultShow:t.bool,defaultValue:t.shape({start:u.nullable(t.instanceOf(Date).isRequired),end:u.nullable(t.instanceOf(Date).isRequired)}),disabled:t.bool,endDateInputSettings:t.shape(g.DateInputWithoutContext.propTypes),focusedDate:t.instanceOf(Date),format:t.oneOfType([t.string,t.shape({skeleton:t.string,pattern:t.string,date:t.oneOf(["short","medium","long","full"]),time:t.oneOf(["short","medium","long","full"]),datetime:t.oneOf(["short","medium","long","full"]),era:t.oneOf(["narrow","short","long"]),year:t.oneOf(["numeric","2-digit"]),month:t.oneOf(["numeric","2-digit","narrow","short","long"]),day:t.oneOf(["numeric","2-digit"]),weekday:t.oneOf(["narrow","short","long"]),hour:t.oneOf(["numeric","2-digit"]),hour12:t.bool,minute:t.oneOf(["numeric","2-digit"]),second:t.oneOf(["numeric","2-digit"]),timeZoneName:t.oneOf(["short","long"])})]),id:t.string,ariaLabelledBy:t.string,ariaDescribedBy:t.string,max:t.instanceOf(Date),min:t.instanceOf(Date),onBlur:t.func,onChange:t.func,onFocus:t.func,popupSettings:t.any,show:t.bool,startDateInputSettings:t.any,style:t.any,swapButton:t.any,tabIndex:t.number,dir:t.string,value:t.shape({start:u.nullable(t.instanceOf(Date).isRequired),end:u.nullable(t.instanceOf(Date).isRequired)})},l.defaultProps={allowReverse:!1,defaultShow:!1,defaultValue:h.EMPTY_SELECTIONRANGE,disabled:!1,format:"d",max:u.MAX_DATE,min:u.MIN_DATE,swapButton:!1};let p=l;const I=o.createPropsContext(),w=o.withIdHOC(o.withPropsContext(I,p));w.displayName="KendoReactDateRangePicker";c.registerForLocalization(p);exports.DateRangePicker=w;exports.DateRangePickerPropsContext=I;exports.DateRangePickerWithoutContext=p;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),t=require("prop-types"),M=require("@progress/kendo-react-popup"),D=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),c=require("@progress/kendo-react-intl"),O=require("@progress/kendo-svg-icons"),k=require("../package-metadata.js"),g=require("../dateinput/DateInput.js"),T=require("../calendar/components/MultiViewCalendar.js"),h=require("../calendar/models/SelectionRange.js"),u=require("../utils.js"),x=require("../common/constants.js"),n=require("../messages/index.js"),P=require("@progress/kendo-react-buttons"),_=require("../common/AdaptiveMode.js"),N=require("@progress/kendo-react-layout");function A(d){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>d[e]})}}return a.default=d,Object.freeze(a)}const i=A(R),l=class l extends i.Component{constructor(a){super(a),this._element=null,this._calendar=null,this._startDateInput=i.createRef(),this._endDateInput=i.createRef(),this.shouldFocusDateInput=!1,this.shouldFocusCalendar=!1,this.focus=()=>{this.startDateInput&&this.startDateInput.focus()},this.setCalendarRef=e=>{this._calendar=e},this.focusCalendarElement=()=>{this._calendar&&this._calendar.element&&this._calendar.element.focus({preventScroll:!0})},this.calculateValue=(e,s)=>(e.value!==void 0?e.value:s.value)||h.EMPTY_SELECTIONRANGE,this.calculateShow=(e,s)=>e.show!==void 0?e.show:s.show,this.renderCalendar=()=>{const e=this.value||h.EMPTY_SELECTIONRANGE,s={min:this.min,max:this.max,allowReverse:this.props.allowReverse,mode:"range",focusedDate:this.props.focusedDate,disabled:this.props.disabled,className:this.mobileMode?"k-calendar-lg":"",mobileMode:this.mobileMode,...this.props.calendarSettings,value:e,dir:this.props.dir,onChange:this.handleCalendarChange};return this.props.calendar?i.createElement(this.props.calendar,{...s}):i.createElement(T.MultiViewCalendar,{...s,ref:this.setCalendarRef})},this.renderPopup=()=>{const e={popupClass:o.classNames("k-calendar-container","k-daterangepicker-popup"),animate:this._element!==null,anchor:this._element,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...this.props.popupSettings,show:this.show};return this.props.popup?i.createElement(this.props.popup,{...e},this.renderCalendar()):i.createElement(M.Popup,{...e},this.renderCalendar())},this.renderAdaptivePopup=()=>{const{windowWidth:e=0}=this.state,s={expand:this.show,onClose:r=>this.handleCancel(r),adaptiveTitle:this.props.adaptiveTitle,windowWidth:e,footer:{cancelText:this.localizationService.toLanguageString(n.dateRangePickerCancel,n.messages[n.dateRangePickerCancel]),onCancel:this.handleCancel,applyText:this.localizationService.toLanguageString(n.dateRangePickerSet,n.messages[n.dateRangePickerSet]),onApply:this.handleBlur}};return i.createElement(_.AdaptiveMode,{...s},i.createElement(N.ActionSheetContent,{className:"!k-overflow-hidden"},i.createElement("div",{className:"k-scrollable-wrap"},this.renderCalendar())))},this.handleReverseClick=e=>{const s={start:this.value.end,end:this.value.start},r={syntheticEvent:e,nativeEvent:e.nativeEvent};this.handleChange(s,r)},this.handleReverseMouseDown=e=>{e.preventDefault()},this.handleFocus=e=>{clearTimeout(this.nextTickId),this.shouldFocusDateInput||this.mobileMode&&this.setState({currentValue:this.value});const{onFocus:s}=this.props;s&&s.call(void 0,e)},this.handleClick=()=>{this.shouldFocusDateInput||this.setShow(!0)},this.handleBlur=e=>{this.nextTick(()=>{this.setShow(!1)});const{onBlur:s}=this.props;s&&s.call(void 0,e)},this.handleCancel=e=>{this.nextTick(()=>{this.setShow(!1),this.setState({currentValue:h.EMPTY_SELECTIONRANGE})});const{onCancel:s}=this.props;s&&s.call(void 0,e)},this.handleEndChange=e=>{const s={start:this.value.start,end:D.cloneDate(e.value||void 0)};this.handleChange(s,e)},this.handleStartChange=e=>{const s={start:D.cloneDate(e.value||void 0),end:this.value.end};this.handleChange(s,e)},this.extractRangeFromValue=e=>{if(!Array.isArray(e.value)&&!(e.value instanceof Date))return e.value||h.EMPTY_SELECTIONRANGE;const s=Array.isArray(e.value)?e.value[0]:e.value;return{start:this.value.end!==null?s:this.value.start,end:this.value.start!==null?s:this.value.end}},this.handleCalendarChange=e=>{const s=this.extractRangeFromValue(e);this.handleChange(s,e)},this.handleKeyDown=e=>{const{keyCode:s,altKey:r}=e;s===o.Keys.esc?(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1)):r&&s===o.Keys.down?(e.preventDefault(),this.shouldFocusCalendar=!0,this.setShow(!0),this.focusCalendarElement()):r&&s===o.Keys.up&&(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1))},this.handleChange=(e,s)=>{this.setState({value:e}),this.valueDuringOnChange=e;const{onChange:r}=this.props;if(r){const m={syntheticEvent:s.syntheticEvent,nativeEvent:s.nativeEvent,value:this.value,show:this.show,target:this};r.call(void 0,m)}this.valueDuringOnChange=void 0},o.validatePackage(k.packageMetadata),this.state={show:this.props.show||this.props.defaultShow||l.defaultProps.defaultShow,value:this.props.value||this.props.defaultValue||l.defaultProps.defaultValue,currentValue:h.EMPTY_SELECTIONRANGE},this.nextTick=this.nextTick.bind(this),this.setShow=this.setShow.bind(this),this.focusCalendarElement=this.focusCalendarElement.bind(this),this.focusDateInputElement=this.focusDateInputElement.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get _startInputId(){return this.props.id+"-start-input-id"}get _endInputId(){return this.props.id+"-end-input-id"}get element(){return this._element}get startDateInput(){return this._startDateInput.current}get endDateInput(){return this._endDateInput.current}get calendar(){return this._calendar}get value(){return(this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value)||h.EMPTY_SELECTIONRANGE}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get min(){return this.props.min!==void 0?this.props.min:l.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:l.defaultProps.max}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}get localizationService(){return c.provideLocalizationService(this)}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=x.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}componentDidMount(){var a;this.observerResize=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this.shouldFocusCalendar&&this.focusCalendarElement(),this.shouldFocusDateInput&&this.focusDateInputElement(),this.shouldFocusCalendar=!1,this.shouldFocusDateInput=!1}componentWillUnmount(){var a;clearTimeout(this.nextTickId),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.disconnect()}render(){const a=this.value||h.EMPTY_SELECTIONRANGE,e=this.mobileMode&&this.show?this.state.currentValue:a,s=(this.props.startDateInputSettings||{}).id||this._startInputId,r=(this.props.endDateInputSettings||{}).id||this._endInputId,m=o.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),w=this.localizationService.toLanguageString(n.start,n.messages[n.start]),E=this.localizationService.toLanguageString(n.end,n.messages[n.end]),S=this.localizationService.toLanguageString(n.separator,n.messages[n.separator]),f={disableSelection:this.mobileMode&&!0,label:w,format:this.props.format,min:this.min,max:this.max,id:this._startInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,clearButton:this.props.clearButton,...this.props.startDateInputSettings,value:e.start,onChange:this.handleStartChange},v={disableSelection:this.mobileMode&&!0,label:E,format:this.props.format,min:this.min,max:this.max,id:this._endInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,clearButton:this.props.clearButton,...this.props.endDateInputSettings,value:e.end,onChange:this.handleEndChange},C=i.createElement(P.Button,{type:"button",className:"k-select",fillMode:"flat",title:c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd]),onMouseDown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":s+" "+r,"aria-label":c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd])},i.createElement(o.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:O.arrowsSwapIcon}));return i.createElement(i.Fragment,null,i.createElement("span",{ref:y=>{this._element=y},className:m,style:this.props.style,id:this.props.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.tabIndex,onFocus:this.handleFocus,onClick:this.handleClick,onKeyDown:this.handleKeyDown,onBlur:this.mobileMode?void 0:this.handleBlur,dir:this.props.dir},this.props.startDateInput?i.createElement(this.props.startDateInput,{...f}):i.createElement(g.DateInput,{...f,autoFocus:this.props.autoFocus,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?C:S,this.props.endDateInput?i.createElement(this.props.endDateInput,{...v}):i.createElement(g.DateInput,{...v,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup())}focusDateInputElement(){if(!document||!this.startDateInput||!this.startDateInput.element||!this.endDateInput||!this.endDateInput.element)return;const a=o.getActiveElement(document);(this.value.start===null||this.value.end!==null)&&a!==this.endDateInput.element?this.startDateInput.element.focus({preventScroll:!0}):a!==this.startDateInput.element&&this.endDateInput.element.focus({preventScroll:!0})}nextTick(a){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>a())}setShow(a){const{onOpen:e,onClose:s}=this.props;this.show!==a&&(this.setState({show:a}),a&&e&&e.call(void 0,{target:this}),!a&&s&&s.call(void 0,{target:this}))}calculateMedia(a){for(const e of a)this.setState({windowWidth:e.target.clientWidth})}};l.displayName="DateRangePicker",l.propTypes={allowReverse:t.bool,calendarSettings:t.any,className:t.string,defaultShow:t.bool,defaultValue:t.shape({start:u.nullable(t.instanceOf(Date).isRequired),end:u.nullable(t.instanceOf(Date).isRequired)}),disabled:t.bool,endDateInputSettings:t.shape(g.DateInputWithoutContext.propTypes),focusedDate:t.instanceOf(Date),format:t.oneOfType([t.string,t.shape({skeleton:t.string,pattern:t.string,date:t.oneOf(["short","medium","long","full"]),time:t.oneOf(["short","medium","long","full"]),datetime:t.oneOf(["short","medium","long","full"]),era:t.oneOf(["narrow","short","long"]),year:t.oneOf(["numeric","2-digit"]),month:t.oneOf(["numeric","2-digit","narrow","short","long"]),day:t.oneOf(["numeric","2-digit"]),weekday:t.oneOf(["narrow","short","long"]),hour:t.oneOf(["numeric","2-digit"]),hour12:t.bool,minute:t.oneOf(["numeric","2-digit"]),second:t.oneOf(["numeric","2-digit"]),timeZoneName:t.oneOf(["short","long"])})]),id:t.string,ariaLabelledBy:t.string,ariaDescribedBy:t.string,max:t.instanceOf(Date),min:t.instanceOf(Date),onBlur:t.func,onChange:t.func,onFocus:t.func,popupSettings:t.any,show:t.bool,startDateInputSettings:t.any,style:t.any,swapButton:t.any,tabIndex:t.number,dir:t.string,value:t.shape({start:u.nullable(t.instanceOf(Date).isRequired),end:u.nullable(t.instanceOf(Date).isRequired)}),autoFocus:t.bool},l.defaultProps={allowReverse:!1,defaultShow:!1,defaultValue:h.EMPTY_SELECTIONRANGE,disabled:!1,format:"d",max:u.MAX_DATE,min:u.MIN_DATE,swapButton:!1,autoFocus:!1};let p=l;const I=o.createPropsContext(),b=o.withIdHOC(o.withPropsContext(I,p));b.displayName="KendoReactDateRangePicker";c.registerForLocalization(p);exports.DateRangePicker=b;exports.DateRangePickerPropsContext=I;exports.DateRangePickerWithoutContext=p;
|
|
@@ -10,7 +10,7 @@ import * as i from "react";
|
|
|
10
10
|
import e from "prop-types";
|
|
11
11
|
import { Popup as T } from "@progress/kendo-react-popup";
|
|
12
12
|
import { cloneDate as v } from "@progress/kendo-date-math";
|
|
13
|
-
import { classNames as D, Keys as c, validatePackage as _, canUseDOM as I, IconWrap as
|
|
13
|
+
import { classNames as D, Keys as c, validatePackage as _, canUseDOM as I, IconWrap as F, getActiveElement as P, createPropsContext as B, withIdHOC as z, withPropsContext as A } from "@progress/kendo-react-common";
|
|
14
14
|
import { provideLocalizationService as m, registerForLocalization as N } from "@progress/kendo-react-intl";
|
|
15
15
|
import { arrowsSwapIcon as L } from "@progress/kendo-svg-icons";
|
|
16
16
|
import { packageMetadata as V } from "../package-metadata.mjs";
|
|
@@ -138,14 +138,14 @@ const o = class o extends i.Component {
|
|
|
138
138
|
this.setState({ value: t }), this.valueDuringOnChange = t;
|
|
139
139
|
const { onChange: n } = this.props;
|
|
140
140
|
if (n) {
|
|
141
|
-
const
|
|
141
|
+
const p = {
|
|
142
142
|
syntheticEvent: s.syntheticEvent,
|
|
143
143
|
nativeEvent: s.nativeEvent,
|
|
144
144
|
value: this.value,
|
|
145
145
|
show: this.show,
|
|
146
146
|
target: this
|
|
147
147
|
};
|
|
148
|
-
n.call(void 0,
|
|
148
|
+
n.call(void 0, p);
|
|
149
149
|
}
|
|
150
150
|
this.valueDuringOnChange = void 0;
|
|
151
151
|
}, _(V), this.state = {
|
|
@@ -242,7 +242,7 @@ const o = class o extends i.Component {
|
|
|
242
242
|
* @hidden
|
|
243
243
|
*/
|
|
244
244
|
render() {
|
|
245
|
-
const a = this.value || r, t = this.mobileMode && this.show ? this.state.currentValue : a, s = (this.props.startDateInputSettings || {}).id || this._startInputId, n = (this.props.endDateInputSettings || {}).id || this._endInputId,
|
|
245
|
+
const a = this.value || r, t = this.mobileMode && this.show ? this.state.currentValue : a, s = (this.props.startDateInputSettings || {}).id || this._startInputId, n = (this.props.endDateInputSettings || {}).id || this._endInputId, p = D(
|
|
246
246
|
"k-daterangepicker",
|
|
247
247
|
{
|
|
248
248
|
"k-disabled": this.props.disabled
|
|
@@ -290,7 +290,7 @@ const o = class o extends i.Component {
|
|
|
290
290
|
"aria-controls": s + " " + n,
|
|
291
291
|
"aria-label": m(this).toLanguageString(d, l[d])
|
|
292
292
|
},
|
|
293
|
-
/* @__PURE__ */ i.createElement(
|
|
293
|
+
/* @__PURE__ */ i.createElement(F, { style: { transform: "rotate(90deg)" }, name: "arrows-swap", icon: L })
|
|
294
294
|
);
|
|
295
295
|
return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
|
|
296
296
|
"span",
|
|
@@ -298,7 +298,7 @@ const o = class o extends i.Component {
|
|
|
298
298
|
ref: (k) => {
|
|
299
299
|
this._element = k;
|
|
300
300
|
},
|
|
301
|
-
className:
|
|
301
|
+
className: p,
|
|
302
302
|
style: this.props.style,
|
|
303
303
|
id: this.props.id,
|
|
304
304
|
"aria-labelledby": this.props.ariaLabelledBy,
|
|
@@ -314,6 +314,7 @@ const o = class o extends i.Component {
|
|
|
314
314
|
w,
|
|
315
315
|
{
|
|
316
316
|
...f,
|
|
317
|
+
autoFocus: this.props.autoFocus,
|
|
317
318
|
ref: this._startDateInput,
|
|
318
319
|
ariaRole: "combobox",
|
|
319
320
|
ariaControls: this._popupId,
|
|
@@ -337,7 +338,7 @@ const o = class o extends i.Component {
|
|
|
337
338
|
focusDateInputElement() {
|
|
338
339
|
if (!document || !this.startDateInput || !this.startDateInput.element || !this.endDateInput || !this.endDateInput.element)
|
|
339
340
|
return;
|
|
340
|
-
const a =
|
|
341
|
+
const a = P(document);
|
|
341
342
|
(this.value.start === null || this.value.end !== null) && a !== this.endDateInput.element ? this.startDateInput.element.focus({ preventScroll: !0 }) : a !== this.startDateInput.element && this.endDateInput.element.focus({ preventScroll: !0 });
|
|
342
343
|
}
|
|
343
344
|
nextTick(a) {
|
|
@@ -406,7 +407,8 @@ o.displayName = "DateRangePicker", o.propTypes = {
|
|
|
406
407
|
value: e.shape({
|
|
407
408
|
start: h(e.instanceOf(Date).isRequired),
|
|
408
409
|
end: h(e.instanceOf(Date).isRequired)
|
|
409
|
-
})
|
|
410
|
+
}),
|
|
411
|
+
autoFocus: e.bool
|
|
410
412
|
}, o.defaultProps = {
|
|
411
413
|
allowReverse: !1,
|
|
412
414
|
defaultShow: !1,
|
|
@@ -415,14 +417,15 @@ o.displayName = "DateRangePicker", o.propTypes = {
|
|
|
415
417
|
format: "d",
|
|
416
418
|
max: q,
|
|
417
419
|
min: W,
|
|
418
|
-
swapButton: !1
|
|
420
|
+
swapButton: !1,
|
|
421
|
+
autoFocus: !1
|
|
419
422
|
};
|
|
420
|
-
let
|
|
421
|
-
const Z =
|
|
423
|
+
let u = o;
|
|
424
|
+
const Z = B(), j = z(A(Z, u));
|
|
422
425
|
j.displayName = "KendoReactDateRangePicker";
|
|
423
|
-
N(
|
|
426
|
+
N(u);
|
|
424
427
|
export {
|
|
425
428
|
j as DateRangePicker,
|
|
426
429
|
Z as DateRangePickerPropsContext,
|
|
427
|
-
|
|
430
|
+
u as DateRangePickerWithoutContext
|
|
428
431
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),e=require("prop-types"),V=require("@progress/kendo-react-popup"),D=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),K=require("@progress/kendo-svg-icons"),j=require("../dateinput/DateInput.js"),U=require("@progress/kendo-react-buttons"),$=require("../package-metadata.js"),p=require("../utils.js"),W=require("../common/constants.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),X=require("./DateTimeSelector.js"),H=require("../timepicker/utils.js"),Z=require("../hooks/usePickerFloatingLabel.js"),G=require("../common/AdaptiveMode.js"),J=require("@progress/kendo-react-layout");function Q(h){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const i in h)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(h,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>h[i]})}}return t.default=h,Object.freeze(t)}const r=Q(_),o=class o extends r.Component{constructor(t){super(t),this._element=null,this._dateInput=r.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{const i=this.dateInputElement();i&&i.focus()},this.renderPicker=()=>{const{disabled:i,minTime:s,maxTime:a,format:c,calendar:u,cancelButton:d,weekNumber:f,focusedDate:v}=this.props;return r.createElement(X.DateTimeSelector,{ref:w=>{this._dateTimeSelector=w},cancelButton:d,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:i,weekNumber:f,min:this.min,max:this.max,minTime:s,maxTime:a,focusedDate:v,format:c,calendar:u,mobileMode:this.mobileMode,footerActions:!this.mobileMode})},this.renderAdaptivePopup=()=>{const{windowWidth:i=0}=this.state,s=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerCancel,l.messages[l.dateTimePickerCancel]),a=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerSet,l.messages[l.dateTimePickerSet]),c={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:i,footer:{cancelText:s,onCancel:u=>{var d;return(d=this._dateTimeSelector)==null?void 0:d.handleReject(u)},applyText:a,onApply:u=>{var d;return(d=this._dateTimeSelector)==null?void 0:d.handleAccept(u)}}};return r.createElement(G.AdaptiveMode,{...c},r.createElement(J.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=i=>{this.setState({value:D.cloneDate(i.value||void 0)}),this.valueDuringOnChange=i.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleDateIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=i=>{i.preventDefault()},this.handleKeyDown=i=>{const{altKey:s,keyCode:a}=i;if(a===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(a===n.Keys.up||a===n.Keys.down)&&(i.preventDefault(),i.stopPropagation(),this.shouldFocusDateInput=a===n.Keys.up,this.setShow(a===n.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),n.validatePackage($.packageMetadata),this.state={value:this.props.defaultValue||o.defaultProps.defaultValue,show:this.props.defaultShow||o.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get value(){const t=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return t!==null?D.cloneDate(t):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=W.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:o.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:o.defaultProps.max}get validity(){const t=p.isInDateRange(this.value,this.min,this.max)&&H.isInTimeRange(this.value,this.props.minTime||p.MIN_TIME,this.props.maxTime||p.MAX_TIME),i=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&t,a=this.props.valid!==void 0?this.props.valid:s;return{customError:i,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:a,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:o.defaultProps.required}get dateInputComp(){return this.props.dateInput||o.defaultProps.dateInput}componentDidMount(){var t;this.observerResize=n.canUseDOM&&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)}componentDidUpdate(){const t=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),t&&!this.show&&this.shouldFocusDateInput&&t.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var t;clearTimeout(this.nextTickId),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:t=o.defaultProps.size,rounded:i=o.defaultProps.rounded,fillMode:s=o.defaultProps.fillMode,disabled:a,tabIndex:c,title:u,id:d,format:f,formatPlaceholder:v,min:w,max:k,className:T,width:M,name:O,validationMessage:P,required:C,validityStyles:x,minTime:q,maxTime:E,ariaLabelledBy:R,ariaDescribedBy:z,popup:F=V.Popup}=this.props,b=!this.validityStyles||this.validity.valid,A={id:d,ariaLabelledBy:R,ariaDescribedBy:z,format:f,formatPlaceholder:v,disabled:a,title:u,validityStyles:x,validationMessage:P,required:C,min:w,max:k,minTime:q,maxTime:E,name:O,tabIndex:this.show?-1:c,valid:this.validity.valid,value:this.value,onChange:this.handleValueChange,steps:this.props.steps,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},y=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:B,onBlur:L})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:N=>{this._element=N},className:n.classNames("k-input","k-datetimepicker",{[`k-input-${n.kendoThemeMaps.sizeMap[t]||t}`]:t,[`k-rounded-${n.kendoThemeMaps.roundedMap[i]||i}`]:i,[`k-input-${s}`]:s,"k-invalid":!b,"k-required":this.required,"k-disabled":this.props.disabled},T),onKeyDown:this.handleKeyDown,style:{width:M},onFocus:this.mobileMode?void 0:B,onBlur:L,onClick:this.mobileMode?this.handleDateIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode,...A}),r.createElement(U.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:K.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleDateIconClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:"k-input-button",rounded:null,fillMode:s,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(F,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:"k-datetime-container k-reset",id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"}},!this.mobileMode&&this.renderPicker())),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(Z.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:d,editorValid:b,editorDisabled:this.props.disabled,children:y,style:{width:this.props.width}}):y}setShow(t){const{onOpen:i,onClose:s}=this.props;this.show!==t&&(this.setState({show:t}),t&&i&&i.call(void 0,{target:this}),!t&&s&&s.call(void 0,{target:this}))}nextTick(t){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>t())}calculateMedia(t){for(const i of t)this.setState({windowWidth:i.target.clientWidth})}};o.displayName="DateTimePicker",o.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,cancelButton:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"])},o.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:p.MAX_DATE,min:p.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,cancelButton:!0,dateInput:j.DateInput,size:"medium",rounded:"medium",fillMode:"solid"};let g=o;const S=n.createPropsContext(),I=n.withIdHOC(n.withPropsContext(S,g));I.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=I;exports.DateTimePickerPropsContext=S;exports.DateTimePickerWithoutContext=g;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),e=require("prop-types"),K=require("@progress/kendo-react-popup"),D=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),j=require("@progress/kendo-svg-icons"),U=require("../dateinput/DateInput.js"),$=require("@progress/kendo-react-buttons"),W=require("../package-metadata.js"),p=require("../utils.js"),X=require("../common/constants.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),H=require("./DateTimeSelector.js"),Z=require("../timepicker/utils.js"),G=require("../hooks/usePickerFloatingLabel.js"),J=require("../common/AdaptiveMode.js"),Q=require("@progress/kendo-react-layout");function Y(h){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const i in h)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(h,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>h[i]})}}return t.default=h,Object.freeze(t)}const r=Y(V),o=class o extends r.Component{constructor(t){super(t),this._element=null,this._dateInput=r.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{const i=this.dateInputElement();i&&i.focus()},this.renderPicker=()=>{const{disabled:i,minTime:s,maxTime:a,format:c,calendar:u,cancelButton:d,weekNumber:f,focusedDate:v}=this.props;return r.createElement(H.DateTimeSelector,{ref:b=>{this._dateTimeSelector=b},cancelButton:d,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:i,weekNumber:f,min:this.min,max:this.max,minTime:s,maxTime:a,focusedDate:v,format:c,calendar:u,mobileMode:this.mobileMode,footerActions:!this.mobileMode})},this.renderAdaptivePopup=()=>{const{windowWidth:i=0}=this.state,s=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerCancel,l.messages[l.dateTimePickerCancel]),a=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerSet,l.messages[l.dateTimePickerSet]),c={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:i,footer:{cancelText:s,onCancel:u=>{var d;return(d=this._dateTimeSelector)==null?void 0:d.handleReject(u)},applyText:a,onApply:u=>{var d;return(d=this._dateTimeSelector)==null?void 0:d.handleAccept(u)}}};return r.createElement(J.AdaptiveMode,{...c},r.createElement(Q.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=i=>{this.setState({value:D.cloneDate(i.value||void 0)}),this.valueDuringOnChange=i.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleDateIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=i=>{i.preventDefault()},this.handleKeyDown=i=>{const{altKey:s,keyCode:a}=i;if(a===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(a===n.Keys.up||a===n.Keys.down)&&(i.preventDefault(),i.stopPropagation(),this.shouldFocusDateInput=a===n.Keys.up,this.setShow(a===n.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),n.validatePackage(W.packageMetadata),this.state={value:this.props.defaultValue||o.defaultProps.defaultValue,show:this.props.defaultShow||o.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get value(){const t=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return t!==null?D.cloneDate(t):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=X.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:o.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:o.defaultProps.max}get validity(){const t=p.isInDateRange(this.value,this.min,this.max)&&Z.isInTimeRange(this.value,this.props.minTime||p.MIN_TIME,this.props.maxTime||p.MAX_TIME),i=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&t,a=this.props.valid!==void 0?this.props.valid:s;return{customError:i,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:a,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:o.defaultProps.required}get dateInputComp(){return this.props.dateInput||o.defaultProps.dateInput}componentDidMount(){var t;this.observerResize=n.canUseDOM&&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)}componentDidUpdate(){const t=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),t&&!this.show&&this.shouldFocusDateInput&&t.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var t;clearTimeout(this.nextTickId),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:t=o.defaultProps.size,rounded:i=o.defaultProps.rounded,fillMode:s=o.defaultProps.fillMode,autoFocus:a=o.defaultProps.autoFocus,disabled:c,tabIndex:u,title:d,id:f,format:v,formatPlaceholder:b,min:k,max:T,className:M,width:O,name:P,validationMessage:C,required:x,validityStyles:q,minTime:E,maxTime:R,ariaLabelledBy:F,ariaDescribedBy:z,popup:A=K.Popup}=this.props,w=!this.validityStyles||this.validity.valid,B={id:f,ariaLabelledBy:F,ariaDescribedBy:z,format:v,formatPlaceholder:b,disabled:c,title:d,validityStyles:q,validationMessage:C,required:x,min:k,max:T,minTime:E,maxTime:R,name:P,tabIndex:this.show?-1:u,valid:this.validity.valid,value:this.value,onChange:this.handleValueChange,steps:this.props.steps,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},y=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:L,onBlur:N})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:_=>{this._element=_},className:n.classNames("k-input","k-datetimepicker",{[`k-input-${n.kendoThemeMaps.sizeMap[t]||t}`]:t,[`k-rounded-${n.kendoThemeMaps.roundedMap[i]||i}`]:i,[`k-input-${s}`]:s,"k-invalid":!w,"k-required":this.required,"k-disabled":this.props.disabled},M),onKeyDown:this.handleKeyDown,style:{width:O},onFocus:this.mobileMode?void 0:L,onBlur:N,onClick:this.mobileMode?this.handleDateIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode,autoFocus:a,...B}),r.createElement($.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:j.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleDateIconClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:"k-input-button",rounded:null,fillMode:s,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(A,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:"k-datetime-container k-reset",id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"}},!this.mobileMode&&this.renderPicker())),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(G.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:f,editorValid:w,editorDisabled:this.props.disabled,children:y,style:{width:this.props.width}}):y}setShow(t){const{onOpen:i,onClose:s}=this.props;this.show!==t&&(this.setState({show:t}),t&&i&&i.call(void 0,{target:this}),!t&&s&&s.call(void 0,{target:this}))}nextTick(t){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>t())}calculateMedia(t){for(const i of t)this.setState({windowWidth:i.target.clientWidth})}};o.displayName="DateTimePicker",o.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,cancelButton:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),autoFocus:e.bool},o.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:p.MAX_DATE,min:p.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,cancelButton:!0,dateInput:U.DateInput,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let g=o;const S=n.createPropsContext(),I=n.withIdHOC(n.withPropsContext(S,g));I.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=I;exports.DateTimePickerPropsContext=S;exports.DateTimePickerWithoutContext=g;
|