@progress/kendo-react-dateinputs 11.0.0-develop.2 → 11.0.0-develop.21
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/codemods/utils.js +9 -0
- package/codemods/v11/dateinput-handle.js +9 -0
- package/codemods/v11/datepicker-handle.js +9 -0
- package/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +14 -13
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +170 -161
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +166 -159
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +17 -15
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +49 -46
- package/datetimepicker/DateTimeSelector.js +1 -1
- package/datetimepicker/DateTimeSelector.mjs +23 -21
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +63 -26
- package/index.d.ts +63 -26
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +29 -9
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +39 -37
- package/timepicker/TimeSelector.js +1 -1
- package/timepicker/TimeSelector.mjs +49 -48
- package/utils.js +1 -1
- package/utils.mjs +3 -1
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +1 -1
|
@@ -7,107 +7,110 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as o from "react";
|
|
9
9
|
import e from "prop-types";
|
|
10
|
-
import { Popup as
|
|
11
|
-
import { cloneDate as oe, getDate as
|
|
12
|
-
import { useId as
|
|
13
|
-
import { calendarIcon as
|
|
14
|
-
import { DateInput as
|
|
15
|
-
import { Calendar as
|
|
16
|
-
import { nullable as a, MAX_DATE as
|
|
17
|
-
import { toggleCalendar as ie, messages as
|
|
18
|
-
import { useLocalization as
|
|
19
|
-
import { ToggleButton as
|
|
20
|
-
import { PickerWrap as
|
|
21
|
-
import { PickerFloatingLabel as
|
|
22
|
-
import { ActionSheetContent as
|
|
23
|
-
import { AdaptiveMode as
|
|
10
|
+
import { Popup as at } from "@progress/kendo-react-popup";
|
|
11
|
+
import { cloneDate as oe, getDate as lt } from "@progress/kendo-date-math";
|
|
12
|
+
import { useId as it, useAdaptiveModeContext as ut, usePropsContext as st, canUseDOM as re, AsyncFocusBlur as ct, classNames as ae, kendoThemeMaps as le, createPropsContext as dt, Keys as k } from "@progress/kendo-react-common";
|
|
13
|
+
import { calendarIcon as ft } from "@progress/kendo-svg-icons";
|
|
14
|
+
import { DateInput as mt } from "../dateinput/DateInput.mjs";
|
|
15
|
+
import { Calendar as pt } from "../calendar/components/Calendar.mjs";
|
|
16
|
+
import { nullable as a, MAX_DATE as gt, MIN_DATE as ht, isInDateRange as vt, setTime as bt } from "../utils.mjs";
|
|
17
|
+
import { toggleCalendar as ie, messages as wt } from "../messages/index.mjs";
|
|
18
|
+
import { useLocalization as yt } from "@progress/kendo-react-intl";
|
|
19
|
+
import { ToggleButton as Ct } from "./ToggleButton.mjs";
|
|
20
|
+
import { PickerWrap as Dt } from "../common/PickerWrap.mjs";
|
|
21
|
+
import { PickerFloatingLabel as kt } from "../hooks/usePickerFloatingLabel.mjs";
|
|
22
|
+
import { ActionSheetContent as Ot } from "@progress/kendo-react-layout";
|
|
23
|
+
import { AdaptiveMode as Mt } from "../common/AdaptiveMode.mjs";
|
|
24
24
|
const ue = o.forwardRef((n, se) => {
|
|
25
|
-
const
|
|
25
|
+
const L = it(n.id), ce = yt(), h = ut(), {
|
|
26
26
|
defaultShow: de = l.defaultShow,
|
|
27
27
|
defaultValue: fe = l.defaultValue,
|
|
28
28
|
dateInput: me = l.dateInput,
|
|
29
29
|
calendar: pe = l.calendar,
|
|
30
30
|
toggleButton: ge = l.toggleButton,
|
|
31
31
|
popup: he = l.popup,
|
|
32
|
-
pickerWrap:
|
|
33
|
-
disabled:
|
|
32
|
+
pickerWrap: Rt = l.pickerWrap,
|
|
33
|
+
disabled: v = l.disabled,
|
|
34
34
|
format: ve = l.format,
|
|
35
35
|
max: R = l.max,
|
|
36
36
|
min: I = l.min,
|
|
37
|
-
popupSettings:
|
|
38
|
-
tabIndex:
|
|
39
|
-
weekNumber:
|
|
40
|
-
validityStyles:
|
|
37
|
+
popupSettings: b = l.popupSettings,
|
|
38
|
+
tabIndex: be = l.tabIndex,
|
|
39
|
+
weekNumber: we = l.weekNumber,
|
|
40
|
+
validityStyles: W = l.validityStyles,
|
|
41
41
|
size: S = l.size,
|
|
42
|
-
rounded:
|
|
43
|
-
fillMode:
|
|
42
|
+
rounded: _ = l.rounded,
|
|
43
|
+
fillMode: E = l.fillMode,
|
|
44
44
|
autoFocus: ye = l.autoFocus,
|
|
45
|
-
show:
|
|
45
|
+
show: K,
|
|
46
46
|
autoSwitchParts: Ce,
|
|
47
47
|
autoSwitchKeys: De,
|
|
48
48
|
twoDigitYearMax: ke,
|
|
49
49
|
ariaLabel: Oe,
|
|
50
|
-
adaptive:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
adaptive: It,
|
|
51
|
+
adaptiveTitle: Me = n.label || void 0,
|
|
52
|
+
adaptiveSubtitle: Pe,
|
|
53
|
+
formatPlaceholder: Re,
|
|
54
|
+
inputAttributes: Ie,
|
|
55
|
+
validationMessage: q,
|
|
56
|
+
visited: St,
|
|
57
|
+
value: B,
|
|
58
|
+
touched: _t,
|
|
59
|
+
modified: Et,
|
|
60
|
+
_adaptiveMode: Bt = h,
|
|
61
|
+
valid: H,
|
|
62
|
+
focusedDate: Se,
|
|
63
|
+
id: _e,
|
|
63
64
|
ariaLabelledBy: Ee,
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
ariaDescribedBy: Be,
|
|
66
|
+
placeholder: xe,
|
|
67
|
+
...U
|
|
68
|
+
} = st(Pt, n), x = () => {
|
|
66
69
|
if (re)
|
|
67
|
-
return
|
|
68
|
-
},
|
|
69
|
-
const t = O.current !== void 0 ? O.current :
|
|
70
|
+
return y.current && y.current.ownerDocument || window.document;
|
|
71
|
+
}, u = () => !!(g.windowWidth && h && g.windowWidth <= (h == null ? void 0 : h.medium) && n.adaptive), f = () => {
|
|
72
|
+
const t = O.current !== void 0 ? O.current : B !== void 0 ? B : g.value;
|
|
70
73
|
return t !== null ? oe(t) : null;
|
|
71
|
-
}, i = () =>
|
|
72
|
-
const t =
|
|
74
|
+
}, i = () => M.current !== void 0 ? M.current : K !== void 0 ? K : g.show, Te = () => me || l.dateInput, Ae = () => ge || l.toggleButton, Ve = () => pe || l.calendar, Fe = () => he || l.popup, Y = () => n.required !== void 0 ? n.required : !1, T = () => {
|
|
75
|
+
const t = f() || B || null, r = I, s = R, P = vt(t, r, s), F = q !== void 0, N = (!Y() || t != null) && P, z = H !== void 0 ? H : N;
|
|
73
76
|
return {
|
|
74
|
-
customError:
|
|
75
|
-
rangeOverflow: t &&
|
|
77
|
+
customError: F,
|
|
78
|
+
rangeOverflow: t && s.getTime() < t.getTime() || !1,
|
|
76
79
|
rangeUnderflow: t && t.getTime() < r.getTime() || !1,
|
|
77
|
-
valid:
|
|
80
|
+
valid: z,
|
|
78
81
|
valueMissing: t === null
|
|
79
82
|
};
|
|
80
|
-
},
|
|
83
|
+
}, Ne = (t) => {
|
|
81
84
|
for (const r of t)
|
|
82
85
|
D({ windowWidth: r.target.clientWidth });
|
|
83
|
-
},
|
|
86
|
+
}, ze = () => {
|
|
84
87
|
c.current && c.current.focus();
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
+
}, $ = (t) => {
|
|
89
|
+
d.current = t;
|
|
90
|
+
}, m = (t) => {
|
|
88
91
|
i() !== t && (D({ show: t }), t && n.onOpen && n.onOpen.call(void 0, { target: w.current }), !t && n.onClose && n.onClose.call(void 0, { target: w.current }));
|
|
89
|
-
},
|
|
90
|
-
const r =
|
|
91
|
-
return r && t ?
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
D({ value: oe(t || void 0) }), O.current = t,
|
|
92
|
+
}, Le = (t) => {
|
|
93
|
+
const r = f();
|
|
94
|
+
return r && t ? bt(t, r) : t;
|
|
95
|
+
}, We = (t) => {
|
|
96
|
+
b != null && b.onMouseDownOutside && b.onMouseDownOutside.call(void 0, t);
|
|
97
|
+
}, j = (t, r) => {
|
|
98
|
+
D({ value: oe(t || void 0) }), O.current = t, M.current = !1, u() || (p.current = !0), n.onChange && n.onChange.call(void 0, {
|
|
96
99
|
syntheticEvent: r.syntheticEvent,
|
|
97
100
|
nativeEvent: r.nativeEvent,
|
|
98
|
-
value:
|
|
101
|
+
value: f(),
|
|
99
102
|
show: i(),
|
|
100
103
|
target: w.current
|
|
101
|
-
}), O.current = void 0,
|
|
102
|
-
},
|
|
103
|
-
const r =
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
const { popupClass: t, ...r } =
|
|
104
|
+
}), O.current = void 0, M.current = void 0, m(!1);
|
|
105
|
+
}, Ke = (t) => {
|
|
106
|
+
const r = Le(t.value);
|
|
107
|
+
j(r, t);
|
|
108
|
+
}, X = () => {
|
|
109
|
+
const { popupClass: t, ...r } = b, s = i(), P = f(), F = P && lt(P), N = ae(t), z = {
|
|
107
110
|
popupClass: "k-datepicker-popup",
|
|
108
|
-
show:
|
|
109
|
-
anchor:
|
|
110
|
-
className:
|
|
111
|
+
show: s,
|
|
112
|
+
anchor: y.current,
|
|
113
|
+
className: N,
|
|
111
114
|
id: G,
|
|
112
115
|
anchorAlign: {
|
|
113
116
|
horizontal: "left",
|
|
@@ -118,56 +121,57 @@ const ue = o.forwardRef((n, se) => {
|
|
|
118
121
|
vertical: "top"
|
|
119
122
|
},
|
|
120
123
|
...r,
|
|
121
|
-
onMouseDownOutside:
|
|
124
|
+
onMouseDownOutside: We
|
|
122
125
|
}, te = {
|
|
123
|
-
disabled:
|
|
124
|
-
value:
|
|
126
|
+
disabled: v,
|
|
127
|
+
value: F,
|
|
125
128
|
min: I,
|
|
126
129
|
max: R,
|
|
127
|
-
weekNumber:
|
|
128
|
-
focusedDate:
|
|
129
|
-
className:
|
|
130
|
-
navigation: !
|
|
131
|
-
onChange:
|
|
132
|
-
}, ne =
|
|
133
|
-
return
|
|
134
|
-
},
|
|
135
|
-
D({ focused: !1 }),
|
|
136
|
-
},
|
|
137
|
-
const { windowWidth: t = 0 } =
|
|
130
|
+
weekNumber: we,
|
|
131
|
+
focusedDate: Se,
|
|
132
|
+
className: u() ? "k-calendar-lg" : "",
|
|
133
|
+
navigation: !u(),
|
|
134
|
+
onChange: Ke
|
|
135
|
+
}, ne = Ve(), rt = Fe();
|
|
136
|
+
return u() ? /* @__PURE__ */ o.createElement(ne, { _ref: $, ...te }) : /* @__PURE__ */ o.createElement(rt, { ...z }, /* @__PURE__ */ o.createElement(ne, { _ref: $, ...te }));
|
|
137
|
+
}, Z = () => {
|
|
138
|
+
D({ focused: !1 }), m(!1);
|
|
139
|
+
}, qe = () => {
|
|
140
|
+
const { windowWidth: t = 0 } = g, r = {
|
|
138
141
|
expand: i(),
|
|
139
|
-
onClose:
|
|
140
|
-
|
|
142
|
+
onClose: Z,
|
|
143
|
+
title: Me,
|
|
144
|
+
subTitle: Pe,
|
|
141
145
|
windowWidth: t
|
|
142
|
-
}
|
|
143
|
-
return /* @__PURE__ */ o.createElement(
|
|
144
|
-
}, We = (t) => {
|
|
145
|
-
Y(t.value, t);
|
|
146
|
-
}, Ke = () => {
|
|
147
|
-
D({ focused: !0 });
|
|
148
|
-
}, qe = () => {
|
|
149
|
-
f(!i());
|
|
150
|
-
}, X = () => {
|
|
151
|
-
h || (m.current = !0, f(!i()));
|
|
146
|
+
};
|
|
147
|
+
return /* @__PURE__ */ o.createElement(Mt, { ...r }, /* @__PURE__ */ o.createElement(Ot, null, X()));
|
|
152
148
|
}, He = (t) => {
|
|
149
|
+
j(t.value, t);
|
|
150
|
+
}, Ue = () => {
|
|
151
|
+
D({ focused: !0 });
|
|
152
|
+
}, Ye = () => {
|
|
153
|
+
m(!i());
|
|
154
|
+
}, A = () => {
|
|
155
|
+
v || (p.current = !0, m(!i()));
|
|
156
|
+
}, $e = (t) => {
|
|
153
157
|
t.preventDefault();
|
|
154
|
-
},
|
|
155
|
-
const { altKey: r, keyCode:
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
+
}, je = (t) => {
|
|
159
|
+
const { altKey: r, keyCode: s } = t;
|
|
160
|
+
if (s === k.esc && i()) {
|
|
161
|
+
p.current = !0, m(!1);
|
|
158
162
|
return;
|
|
159
163
|
}
|
|
160
|
-
r && (
|
|
161
|
-
}, w = o.useRef(null),
|
|
164
|
+
r && (s === k.up || s === k.down) && (t.preventDefault(), t.stopPropagation(), p.current = s === k.up, m(s === k.down));
|
|
165
|
+
}, w = o.useRef(null), y = o.useRef(null), c = o.useRef(null), d = o.useRef(null);
|
|
162
166
|
o.useImperativeHandle(
|
|
163
167
|
w,
|
|
164
168
|
() => ({
|
|
165
169
|
props: n,
|
|
166
170
|
get element() {
|
|
167
|
-
return
|
|
171
|
+
return y.current;
|
|
168
172
|
},
|
|
169
173
|
get calendar() {
|
|
170
|
-
return
|
|
174
|
+
return d.current;
|
|
171
175
|
},
|
|
172
176
|
get dateInput() {
|
|
173
177
|
return c.current;
|
|
@@ -182,54 +186,56 @@ const ue = o.forwardRef((n, se) => {
|
|
|
182
186
|
return T();
|
|
183
187
|
},
|
|
184
188
|
get value() {
|
|
185
|
-
return
|
|
189
|
+
return f();
|
|
186
190
|
},
|
|
187
191
|
get mobileMode() {
|
|
188
|
-
return
|
|
192
|
+
return u();
|
|
189
193
|
},
|
|
190
|
-
togglePopup:
|
|
194
|
+
togglePopup: Ye,
|
|
191
195
|
// Hidden Methods but still accessible
|
|
192
|
-
focus:
|
|
196
|
+
focus: ze
|
|
193
197
|
})
|
|
194
198
|
), o.useImperativeHandle(se, () => w.current);
|
|
195
|
-
const O = o.useRef(void 0),
|
|
199
|
+
const O = o.useRef(void 0), M = o.useRef(void 0), Xe = o.useRef(null), p = o.useRef(!1), V = o.useRef(!1), C = o.useRef(null), [g, Ze] = o.useState({
|
|
196
200
|
value: fe,
|
|
197
201
|
show: de,
|
|
198
202
|
focused: !1
|
|
199
|
-
}), [,
|
|
200
|
-
|
|
203
|
+
}), [, Ge] = o.useReducer((t) => t, !0), D = (t) => {
|
|
204
|
+
Ze((r) => ({ ...r, ...t }));
|
|
201
205
|
};
|
|
202
206
|
o.useEffect(() => {
|
|
203
|
-
|
|
207
|
+
d.current && d.current.element && i() && !V.current && d.current.element.focus({ preventScroll: !0 }), u() && i() && !V.current && setTimeout(() => {
|
|
208
|
+
d.current && d.current.element && d.current.element.focus({ preventScroll: !0 });
|
|
209
|
+
}, 300), c.current && c.current.element && !i() && p.current && c.current.element.focus({ preventScroll: !0 }), V.current = i(), p.current = !1;
|
|
204
210
|
}), o.useEffect(() => {
|
|
205
211
|
var t;
|
|
206
|
-
return C.current = re && window.ResizeObserver && new window.ResizeObserver((r) =>
|
|
212
|
+
return C.current = re && window.ResizeObserver && new window.ResizeObserver((r) => Ne(r)), i() && Ge(), (t = x()) != null && t.body && C.current && C.current.observe(x().body), () => {
|
|
207
213
|
var r;
|
|
208
|
-
clearTimeout(
|
|
214
|
+
clearTimeout(Xe.current), (r = x()) != null && r.body && C.current && C.current.disconnect();
|
|
209
215
|
};
|
|
210
216
|
}, []);
|
|
211
|
-
const G =
|
|
212
|
-
disabled:
|
|
217
|
+
const G = L + "-popup-id", Je = X(), Qe = Te(), et = f(), tt = Ae(), nt = qe(), J = !W || T().valid, Q = ce.toLanguageString(ie, wt[ie]), ot = {
|
|
218
|
+
disabled: v,
|
|
213
219
|
format: ve,
|
|
214
|
-
formatPlaceholder:
|
|
215
|
-
id:
|
|
220
|
+
formatPlaceholder: Re,
|
|
221
|
+
id: _e,
|
|
216
222
|
ariaLabelledBy: Ee,
|
|
217
|
-
ariaDescribedBy:
|
|
223
|
+
ariaDescribedBy: Be,
|
|
218
224
|
ariaLabel: Oe,
|
|
219
225
|
max: R,
|
|
220
226
|
min: I,
|
|
221
227
|
name: n.name,
|
|
222
|
-
onChange:
|
|
228
|
+
onChange: He,
|
|
223
229
|
required: n.required,
|
|
224
230
|
_ref: c,
|
|
225
|
-
tabIndex: i() ? -1 :
|
|
231
|
+
tabIndex: i() ? -1 : be,
|
|
226
232
|
title: n.title,
|
|
227
233
|
valid: T().valid,
|
|
228
|
-
validationMessage:
|
|
229
|
-
validityStyles:
|
|
230
|
-
value:
|
|
234
|
+
validationMessage: q,
|
|
235
|
+
validityStyles: W,
|
|
236
|
+
value: et,
|
|
231
237
|
label: void 0,
|
|
232
|
-
placeholder:
|
|
238
|
+
placeholder: g.focused ? null : xe,
|
|
233
239
|
ariaExpanded: i(),
|
|
234
240
|
size: null,
|
|
235
241
|
fillMode: null,
|
|
@@ -241,79 +247,79 @@ const ue = o.forwardRef((n, se) => {
|
|
|
241
247
|
autoSwitchParts: Ce,
|
|
242
248
|
autoSwitchKeys: De,
|
|
243
249
|
allowCaretMode: n.allowCaretMode,
|
|
244
|
-
inputAttributes:
|
|
250
|
+
inputAttributes: Ie
|
|
245
251
|
}, ee = /* @__PURE__ */ o.createElement(
|
|
246
|
-
|
|
252
|
+
ct,
|
|
247
253
|
{
|
|
248
|
-
onFocus:
|
|
249
|
-
onBlur:
|
|
254
|
+
onFocus: Ue,
|
|
255
|
+
onBlur: u() ? void 0 : Z,
|
|
250
256
|
onSyncBlur: n.onBlur,
|
|
251
257
|
onSyncFocus: n.onFocus
|
|
252
258
|
},
|
|
253
259
|
(t) => /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
|
|
254
260
|
"span",
|
|
255
261
|
{
|
|
256
|
-
...n.label ? {} :
|
|
257
|
-
ref:
|
|
262
|
+
...n.label ? {} : U,
|
|
263
|
+
ref: y,
|
|
258
264
|
className: ae(
|
|
259
265
|
"k-input",
|
|
260
266
|
"k-datepicker",
|
|
261
267
|
{
|
|
262
268
|
[`k-input-${le.sizeMap[S] || S}`]: S,
|
|
263
|
-
[`k-rounded-${le.roundedMap[
|
|
264
|
-
[`k-input-${
|
|
269
|
+
[`k-rounded-${le.roundedMap[_] || _}`]: _,
|
|
270
|
+
[`k-input-${E}`]: E,
|
|
265
271
|
"k-invalid": !J,
|
|
266
|
-
"k-required":
|
|
267
|
-
"k-disabled":
|
|
272
|
+
"k-required": Y(),
|
|
273
|
+
"k-disabled": v
|
|
268
274
|
},
|
|
269
275
|
n.className
|
|
270
276
|
),
|
|
271
|
-
onKeyDown:
|
|
277
|
+
onKeyDown: je,
|
|
272
278
|
style: { width: n.width },
|
|
273
|
-
onFocus: t.onFocus,
|
|
279
|
+
onFocus: u() ? A : t.onFocus,
|
|
274
280
|
onBlur: t.onBlur,
|
|
275
|
-
onClick:
|
|
281
|
+
onClick: u() ? A : void 0
|
|
276
282
|
},
|
|
277
283
|
/* @__PURE__ */ o.createElement(
|
|
278
|
-
|
|
284
|
+
Qe,
|
|
279
285
|
{
|
|
280
286
|
_ref: c,
|
|
281
287
|
ariaRole: "combobox",
|
|
282
288
|
ariaExpanded: i(),
|
|
283
289
|
ariaControls: G,
|
|
284
290
|
autoFocus: ye,
|
|
285
|
-
...
|
|
291
|
+
...ot
|
|
286
292
|
}
|
|
287
293
|
),
|
|
288
294
|
/* @__PURE__ */ o.createElement(
|
|
289
|
-
|
|
295
|
+
tt,
|
|
290
296
|
{
|
|
291
297
|
type: "button",
|
|
292
298
|
icon: "calendar",
|
|
293
|
-
svgIcon:
|
|
299
|
+
svgIcon: ft,
|
|
294
300
|
title: Q,
|
|
295
301
|
className: "k-input-button",
|
|
296
302
|
rounded: null,
|
|
297
|
-
onClick:
|
|
303
|
+
onClick: u() ? void 0 : A,
|
|
298
304
|
"aria-label": Q,
|
|
299
|
-
fillMode:
|
|
300
|
-
onMouseDown:
|
|
305
|
+
fillMode: E,
|
|
306
|
+
onMouseDown: $e
|
|
301
307
|
}
|
|
302
308
|
),
|
|
303
|
-
!
|
|
304
|
-
),
|
|
309
|
+
!u() && Je
|
|
310
|
+
), u() && nt)
|
|
305
311
|
);
|
|
306
312
|
return n.label ? /* @__PURE__ */ o.createElement(
|
|
307
|
-
|
|
313
|
+
kt,
|
|
308
314
|
{
|
|
309
315
|
dateInput: c,
|
|
310
316
|
label: n.label,
|
|
311
|
-
editorId:
|
|
317
|
+
editorId: L,
|
|
312
318
|
editorValid: J,
|
|
313
|
-
editorDisabled:
|
|
319
|
+
editorDisabled: v,
|
|
314
320
|
children: ee,
|
|
315
321
|
style: { width: n.width },
|
|
316
|
-
...
|
|
322
|
+
...U
|
|
317
323
|
}
|
|
318
324
|
) : ee;
|
|
319
325
|
});
|
|
@@ -382,21 +388,22 @@ ue.propTypes = {
|
|
|
382
388
|
fillMode: e.oneOf([null, "solid", "flat", "outline"]),
|
|
383
389
|
adaptive: e.bool,
|
|
384
390
|
adaptiveTitle: e.string,
|
|
391
|
+
adaptiveSubtitle: e.string,
|
|
385
392
|
autoFocus: e.bool,
|
|
386
393
|
inputAttributes: e.object
|
|
387
394
|
};
|
|
388
395
|
const l = {
|
|
389
396
|
defaultShow: !1,
|
|
390
397
|
defaultValue: null,
|
|
391
|
-
dateInput:
|
|
392
|
-
calendar:
|
|
393
|
-
toggleButton:
|
|
394
|
-
popup:
|
|
395
|
-
pickerWrap:
|
|
398
|
+
dateInput: mt,
|
|
399
|
+
calendar: pt,
|
|
400
|
+
toggleButton: Ct,
|
|
401
|
+
popup: at,
|
|
402
|
+
pickerWrap: Dt,
|
|
396
403
|
disabled: !1,
|
|
397
404
|
format: "d",
|
|
398
|
-
max:
|
|
399
|
-
min:
|
|
405
|
+
max: gt,
|
|
406
|
+
min: ht,
|
|
400
407
|
popupSettings: {},
|
|
401
408
|
tabIndex: 0,
|
|
402
409
|
weekNumber: !1,
|
|
@@ -405,10 +412,10 @@ const l = {
|
|
|
405
412
|
rounded: "medium",
|
|
406
413
|
fillMode: "solid",
|
|
407
414
|
autoFocus: !1
|
|
408
|
-
},
|
|
415
|
+
}, Pt = dt();
|
|
409
416
|
ue.displayName = "KendoReactDatePicker";
|
|
410
417
|
export {
|
|
411
418
|
ue as DatePicker,
|
|
412
|
-
|
|
419
|
+
Pt as DatePickerPropsContext,
|
|
413
420
|
l as datePickerDefaultProps
|
|
414
421
|
};
|
|
@@ -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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=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"),T=require("@progress/kendo-svg-icons"),x=require("../package-metadata.js"),g=require("../dateinput/DateInput.js"),P=require("../calendar/components/MultiViewCalendar.js"),h=require("../calendar/models/SelectionRange.js"),u=require("../utils.js"),n=require("../messages/index.js"),_=require("@progress/kendo-react-buttons"),A=require("../common/AdaptiveMode.js"),N=require("@progress/kendo-react-layout");function L(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=L(O),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.showLicenseWatermark=!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(P.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),title: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(A.AdaptiveMode,{...s},i.createElement(N.ActionSheetContent,null,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},this.showLicenseWatermark=!o.validatePackage(x.packageMetadata,{component:"DateRangePicker"}),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(){var e;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((e=this.props._adaptiveMode)==null?void 0:e.medium)&&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{autoFocus:a,inputAttributes:e}=this.props,s=this.value||h.EMPTY_SELECTIONRANGE,r=this.mobileMode&&this.show?this.state.currentValue:s,m=(this.props.startDateInputSettings||{}).id||this._startInputId,w=(this.props.endDateInputSettings||{}).id||this._endInputId,S=o.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),E=this.localizationService.toLanguageString(n.start,n.messages[n.start]),C=this.localizationService.toLanguageString(n.end,n.messages[n.end]),y=this.localizationService.toLanguageString(n.separator,n.messages[n.separator]),f={disableSelection:this.mobileMode&&!0,label:E,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:r.start,onChange:this.handleStartChange,inputAttributes:this.props.inputAttributes},v={disableSelection:this.mobileMode&&!0,label:C,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:r.end,onChange:this.handleEndChange,inputAttributes:this.props.inputAttributes},R=i.createElement(_.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":m+" "+w,"aria-label":c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd])},i.createElement(o.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:T.arrowsSwapIcon}));return i.createElement(i.Fragment,null,i.createElement("span",{ref:k=>{this._element=k},className:S,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:a,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this._popupId}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?R:y,this.props.endDateInput?i.createElement(this.props.endDateInput,{...v}):i.createElement(g.DateInput,{...v,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this._popupId}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&i.createElement(o.WatermarkOverlay,null))}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.DateInput.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)),end:u.nullable(t.instanceOf(Date))}),autoFocus:t.bool,inputAttributes:t.object},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 b=o.createPropsContext(),I=o.withIdHOC(o.withPropsContext(b,o.withAdaptiveModeContext(p)));I.displayName="KendoReactDateRangePicker";c.registerForLocalization(p);exports.DateRangePicker=I;exports.DateRangePickerPropsContext=b;exports.DateRangePickerWithoutContext=p;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react"),t=require("prop-types"),O=require("@progress/kendo-react-popup"),b=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),c=require("@progress/kendo-react-intl"),T=require("@progress/kendo-svg-icons"),x=require("../package-metadata.js"),g=require("../dateinput/DateInput.js"),P=require("../calendar/components/MultiViewCalendar.js"),h=require("../calendar/models/SelectionRange.js"),u=require("../utils.js"),n=require("../messages/index.js"),_=require("@progress/kendo-react-buttons"),A=require("../common/AdaptiveMode.js"),N=require("@progress/kendo-react-layout");function L(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=L(M),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.showLicenseWatermark=!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(P.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(O.Popup,{...e},this.renderCalendar())},this.renderAdaptivePopup=()=>{const{windowWidth:e=0}=this.state,s={expand:this.show,onClose:r=>this.handleCancel(r),title: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(A.AdaptiveMode,{...s},i.createElement(N.ActionSheetContent,null,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:b.cloneDate(e.value||void 0)};this.handleChange(s,e)},this.handleStartChange=e=>{const s={start:b.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},this.showLicenseWatermark=!o.validatePackage(x.packageMetadata,{component:"DateRangePicker"}),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(){var e;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((e=this.props._adaptiveMode)==null?void 0:e.medium)&&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.mobileMode&&this.show&&setTimeout(()=>{this.focusCalendarElement()},300),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{autoFocus:a,inputAttributes:e}=this.props,s=this.value||h.EMPTY_SELECTIONRANGE,r=this.mobileMode&&this.show?this.state.currentValue:s,m=(this.props.startDateInputSettings||{}).id||this._startInputId,w=(this.props.endDateInputSettings||{}).id||this._endInputId,S=o.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),C=this.localizationService.toLanguageString(n.start,n.messages[n.start]),E=this.localizationService.toLanguageString(n.end,n.messages[n.end]),y=this.localizationService.toLanguageString(n.separator,n.messages[n.separator]),f={disableSelection:this.mobileMode&&!0,label:C,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:r.start,onChange:this.handleStartChange,inputAttributes:this.props.inputAttributes},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:r.end,onChange:this.handleEndChange,inputAttributes:this.props.inputAttributes},R=i.createElement(_.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":m+" "+w,"aria-label":c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd])},i.createElement(o.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:T.arrowsSwapIcon}));return i.createElement(i.Fragment,null,i.createElement("span",{ref:k=>{this._element=k},className:S,style:this.props.style,id:this.props.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.tabIndex,onFocus:this.mobileMode?this.handleClick: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:a,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this._popupId}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?R:y,this.props.endDateInput?i.createElement(this.props.endDateInput,{...v}):i.createElement(g.DateInput,{...v,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this._popupId}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&i.createElement(o.WatermarkOverlay,null))}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.DateInput.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)),end:u.nullable(t.instanceOf(Date))}),autoFocus:t.bool,inputAttributes:t.object},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 D=o.createPropsContext(),I=o.withIdHOC(o.withPropsContext(D,o.withAdaptiveModeContext(p)));I.displayName="KendoReactDateRangePicker";c.registerForLocalization(p);exports.DateRangePicker=I;exports.DateRangePickerPropsContext=D;exports.DateRangePickerWithoutContext=p;
|