@progress/kendo-react-dateinputs 15.1.1-develop.3 → 15.2.0-develop.2
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/calendar/components/Calendar.js +1 -1
- package/calendar/components/Calendar.mjs +1 -1
- package/calendar/components/CalendarHeaderTitle.js +1 -1
- package/calendar/components/CalendarHeaderTitle.mjs +17 -5
- package/calendar/components/HorizontalViewList.js +1 -1
- package/calendar/components/HorizontalViewList.mjs +29 -29
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +131 -128
- package/calendar/components/TodayCommand.js +1 -1
- package/calendar/components/TodayCommand.mjs +21 -32
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +66 -66
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +135 -125
- package/calendar/models/WeekDaysFormat.d.ts +1 -1
- package/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +30 -31
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +35 -36
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +184 -183
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +61 -63
- package/datetimepicker/DateTimePicker.d.ts +1 -0
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +117 -118
- package/datetimepicker/models/DateTimePickerSettings.d.ts +7 -0
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/messages/index.d.ts +5 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +46 -44
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +9 -9
- package/timepicker/TimeList.js +2 -2
- package/timepicker/TimeList.mjs +51 -47
- package/timepicker/TimePart.js +1 -1
- package/timepicker/TimePart.mjs +57 -68
- package/timepicker/TimePicker.d.ts +8 -0
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +122 -118
- package/timepicker/TimeSelector.js +1 -1
- package/timepicker/TimeSelector.mjs +56 -57
- package/timepicker/models/TimePickerSettings.d.ts +7 -0
|
@@ -7,73 +7,73 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as o from "react";
|
|
9
9
|
import t from "prop-types";
|
|
10
|
-
import { Popup as
|
|
11
|
-
import { cloneDate as
|
|
12
|
-
import { useId as
|
|
13
|
-
import { calendarIcon as
|
|
14
|
-
import { DateInputInner as
|
|
15
|
-
import { Calendar as
|
|
16
|
-
import { MIN_DATE as
|
|
17
|
-
import { toggleCalendar as
|
|
18
|
-
import { useLocalization as
|
|
19
|
-
import { ToggleButton as
|
|
20
|
-
import { PickerFloatingLabel as
|
|
21
|
-
import { ActionSheetContent as
|
|
22
|
-
import { AdaptiveMode as
|
|
23
|
-
const
|
|
24
|
-
const S =
|
|
25
|
-
defaultShow:
|
|
26
|
-
defaultValue:
|
|
27
|
-
dateInput:
|
|
28
|
-
calendar:
|
|
29
|
-
toggleButton:
|
|
30
|
-
popup:
|
|
31
|
-
disabled:
|
|
32
|
-
format:
|
|
10
|
+
import { Popup as dt } from "@progress/kendo-react-popup";
|
|
11
|
+
import { cloneDate as le, getDate as ft } from "@progress/kendo-date-math";
|
|
12
|
+
import { useId as mt, useAdaptiveModeContext as pt, usePropsContext as gt, useWebMcpRegister as ht, useKendoPaste as vt, canUseDOM as ue, AsyncFocusBlur as bt, classNames as se, kendoThemeMaps as ce, createPropsContext as wt, Keys as O } from "@progress/kendo-react-common";
|
|
13
|
+
import { calendarIcon as yt } from "@progress/kendo-svg-icons";
|
|
14
|
+
import { DateInputInner as Ct } from "../dateinput/DateInput.mjs";
|
|
15
|
+
import { Calendar as Dt } from "../calendar/components/Calendar.mjs";
|
|
16
|
+
import { MIN_DATE as Pt, MAX_DATE as kt, isInDateRange as de, setTime as Ot, nullable as a } from "../utils.mjs";
|
|
17
|
+
import { toggleCalendar as fe, messages as Mt } from "../messages/index.mjs";
|
|
18
|
+
import { useLocalization as It } from "@progress/kendo-react-intl";
|
|
19
|
+
import { ToggleButton as Rt } from "./ToggleButton.mjs";
|
|
20
|
+
import { PickerFloatingLabel as St } from "../hooks/usePickerFloatingLabel.mjs";
|
|
21
|
+
import { ActionSheetContent as _t } from "@progress/kendo-react-layout";
|
|
22
|
+
import { AdaptiveMode as Et } from "../common/AdaptiveMode.mjs";
|
|
23
|
+
const me = o.forwardRef((r, pe) => {
|
|
24
|
+
const S = mt(r.id), ge = It(), w = pt(), {
|
|
25
|
+
defaultShow: he = i.defaultShow,
|
|
26
|
+
defaultValue: ve = i.defaultValue,
|
|
27
|
+
dateInput: be = i.dateInput,
|
|
28
|
+
calendar: we = i.calendar,
|
|
29
|
+
toggleButton: ye = i.toggleButton,
|
|
30
|
+
popup: Ce = i.popup,
|
|
31
|
+
disabled: d = i.disabled,
|
|
32
|
+
format: De = i.format,
|
|
33
33
|
max: y = i.max,
|
|
34
34
|
min: C = i.min,
|
|
35
35
|
popupSettings: D = i.popupSettings,
|
|
36
|
-
tabIndex:
|
|
37
|
-
weekNumber:
|
|
38
|
-
validityStyles:
|
|
36
|
+
tabIndex: Pe = i.tabIndex,
|
|
37
|
+
weekNumber: ke = i.weekNumber,
|
|
38
|
+
validityStyles: W = i.validityStyles,
|
|
39
39
|
size: _ = i.size,
|
|
40
40
|
rounded: E = i.rounded,
|
|
41
41
|
fillMode: B = i.fillMode,
|
|
42
|
-
autoFocus:
|
|
43
|
-
show:
|
|
44
|
-
autoSwitchParts:
|
|
45
|
-
autoSwitchKeys:
|
|
46
|
-
twoDigitYearMax:
|
|
47
|
-
ariaLabel:
|
|
48
|
-
adaptive:
|
|
49
|
-
adaptiveTitle:
|
|
50
|
-
adaptiveSubtitle:
|
|
51
|
-
formatPlaceholder:
|
|
52
|
-
inputAttributes:
|
|
53
|
-
validationMessage:
|
|
54
|
-
visited:
|
|
42
|
+
autoFocus: Oe = i.autoFocus,
|
|
43
|
+
show: q,
|
|
44
|
+
autoSwitchParts: Me,
|
|
45
|
+
autoSwitchKeys: Ie,
|
|
46
|
+
twoDigitYearMax: Re,
|
|
47
|
+
ariaLabel: Se,
|
|
48
|
+
adaptive: Tt,
|
|
49
|
+
adaptiveTitle: _e = r.label || void 0,
|
|
50
|
+
adaptiveSubtitle: Ee,
|
|
51
|
+
formatPlaceholder: Be,
|
|
52
|
+
inputAttributes: Te,
|
|
53
|
+
validationMessage: H,
|
|
54
|
+
visited: xt,
|
|
55
55
|
value: T,
|
|
56
|
-
touched:
|
|
57
|
-
modified:
|
|
58
|
-
_adaptiveMode:
|
|
59
|
-
valid:
|
|
60
|
-
focusedDate:
|
|
61
|
-
id:
|
|
62
|
-
ariaLabelledBy:
|
|
63
|
-
ariaDescribedBy:
|
|
64
|
-
placeholder:
|
|
65
|
-
onChange:
|
|
66
|
-
onOpen:
|
|
67
|
-
onClose:
|
|
68
|
-
...
|
|
69
|
-
} =
|
|
70
|
-
if (
|
|
71
|
-
return
|
|
56
|
+
touched: At,
|
|
57
|
+
modified: Nt,
|
|
58
|
+
_adaptiveMode: Ft = w,
|
|
59
|
+
valid: U,
|
|
60
|
+
focusedDate: xe,
|
|
61
|
+
id: Ae,
|
|
62
|
+
ariaLabelledBy: Ne,
|
|
63
|
+
ariaDescribedBy: Fe,
|
|
64
|
+
placeholder: Le,
|
|
65
|
+
onChange: Y,
|
|
66
|
+
onOpen: $,
|
|
67
|
+
onClose: j,
|
|
68
|
+
...X
|
|
69
|
+
} = gt(Bt, r), x = () => {
|
|
70
|
+
if (ue)
|
|
71
|
+
return f.current && f.current.ownerDocument || window.document;
|
|
72
72
|
}, s = () => !!(p.windowWidth && w && p.windowWidth <= (w == null ? void 0 : w.medium) && r.adaptive), g = () => {
|
|
73
73
|
const e = M.current !== void 0 ? M.current : T !== void 0 ? T : p.value;
|
|
74
|
-
return e !== null ?
|
|
75
|
-
}, l = () =>
|
|
76
|
-
const e = g() || T || null, n = C, u = y,
|
|
74
|
+
return e !== null ? le(e) : null;
|
|
75
|
+
}, l = () => I.current !== void 0 ? I.current : q !== void 0 ? q : p.show, Ve = () => be || i.dateInput, ze = () => ye || i.toggleButton, Ke = () => we || i.calendar, We = () => Ce || i.popup, Z = () => r.required !== void 0 ? r.required : !1, A = () => {
|
|
76
|
+
const e = g() || T || null, n = C, u = y, R = de(e, n, u), V = H !== void 0, z = (!Z() || e != null) && R, K = U !== void 0 ? U : z;
|
|
77
77
|
return {
|
|
78
78
|
customError: V,
|
|
79
79
|
rangeOverflow: e && u.getTime() < e.getTime() || !1,
|
|
@@ -81,38 +81,38 @@ const he = o.forwardRef((r, ve) => {
|
|
|
81
81
|
valid: K,
|
|
82
82
|
valueMissing: e === null
|
|
83
83
|
};
|
|
84
|
-
},
|
|
84
|
+
}, qe = (e) => {
|
|
85
85
|
for (const n of e)
|
|
86
86
|
k({ windowWidth: n.target.clientWidth });
|
|
87
|
-
},
|
|
87
|
+
}, He = () => {
|
|
88
88
|
c.current && c.current.focus();
|
|
89
|
-
},
|
|
90
|
-
|
|
89
|
+
}, G = (e) => {
|
|
90
|
+
m.current = e;
|
|
91
91
|
}, h = (e) => {
|
|
92
|
-
l() !== e && (k({ show: e }), e &&
|
|
93
|
-
},
|
|
92
|
+
l() !== e && (k({ show: e }), e && $ && $({ target: v.current }), !e && j && j({ target: v.current }));
|
|
93
|
+
}, Ue = (e) => {
|
|
94
94
|
const n = g();
|
|
95
|
-
return n && e ?
|
|
96
|
-
},
|
|
95
|
+
return n && e ? Ot(e, n) : e;
|
|
96
|
+
}, Ye = (e) => {
|
|
97
97
|
D != null && D.onMouseDownOutside && D.onMouseDownOutside(e);
|
|
98
|
-
},
|
|
99
|
-
k({ value:
|
|
98
|
+
}, N = (e, n) => {
|
|
99
|
+
k({ value: le(e || void 0) }), M.current = e, I.current = !1, s() || (b.current = !0), Y && Y({
|
|
100
100
|
syntheticEvent: n.syntheticEvent,
|
|
101
101
|
nativeEvent: n.nativeEvent,
|
|
102
102
|
value: g(),
|
|
103
103
|
show: l(),
|
|
104
104
|
target: v.current
|
|
105
|
-
}), M.current = void 0,
|
|
106
|
-
},
|
|
107
|
-
const n =
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
const { popupClass: e, ...n } = D, u = l(),
|
|
105
|
+
}), M.current = void 0, I.current = void 0, h(!1);
|
|
106
|
+
}, $e = (e) => {
|
|
107
|
+
const n = Ue(e.value);
|
|
108
|
+
N(n, e);
|
|
109
|
+
}, J = () => {
|
|
110
|
+
const { popupClass: e, ...n } = D, u = l(), R = g(), V = R && ft(R), z = se(e), K = {
|
|
111
111
|
popupClass: "k-datepicker-popup",
|
|
112
112
|
show: u,
|
|
113
|
-
anchor:
|
|
113
|
+
anchor: f.current,
|
|
114
114
|
className: z,
|
|
115
|
-
id:
|
|
115
|
+
id: te,
|
|
116
116
|
anchorAlign: {
|
|
117
117
|
horizontal: "left",
|
|
118
118
|
vertical: "bottom"
|
|
@@ -122,57 +122,57 @@ const he = o.forwardRef((r, ve) => {
|
|
|
122
122
|
vertical: "top"
|
|
123
123
|
},
|
|
124
124
|
...n,
|
|
125
|
-
onMouseDownOutside:
|
|
126
|
-
},
|
|
127
|
-
disabled:
|
|
125
|
+
onMouseDownOutside: Ye
|
|
126
|
+
}, ae = {
|
|
127
|
+
disabled: d,
|
|
128
128
|
value: V,
|
|
129
129
|
min: C,
|
|
130
130
|
max: y,
|
|
131
|
-
weekNumber:
|
|
132
|
-
focusedDate:
|
|
131
|
+
weekNumber: ke,
|
|
132
|
+
focusedDate: xe,
|
|
133
133
|
className: s() ? "k-calendar-lg" : "",
|
|
134
134
|
navigation: !s(),
|
|
135
|
-
onChange:
|
|
136
|
-
},
|
|
137
|
-
return s() ? /* @__PURE__ */ o.createElement(
|
|
138
|
-
},
|
|
135
|
+
onChange: $e
|
|
136
|
+
}, ie = Ke(), ct = We();
|
|
137
|
+
return s() ? /* @__PURE__ */ o.createElement(ie, { _ref: G, ...ae }) : /* @__PURE__ */ o.createElement(ct, { ...K }, /* @__PURE__ */ o.createElement(ie, { _ref: G, ...ae }));
|
|
138
|
+
}, Q = () => {
|
|
139
139
|
k({ focused: !1 }), h(!1);
|
|
140
|
-
},
|
|
140
|
+
}, je = () => {
|
|
141
141
|
const { windowWidth: e = 0 } = p, n = {
|
|
142
142
|
expand: l(),
|
|
143
|
-
onClose:
|
|
144
|
-
title:
|
|
145
|
-
subTitle:
|
|
143
|
+
onClose: Q,
|
|
144
|
+
title: _e,
|
|
145
|
+
subTitle: Ee,
|
|
146
146
|
windowWidth: e
|
|
147
147
|
};
|
|
148
|
-
return /* @__PURE__ */ o.createElement(
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
},
|
|
148
|
+
return /* @__PURE__ */ o.createElement(Et, { ...n }, /* @__PURE__ */ o.createElement(_t, null, J()));
|
|
149
|
+
}, Xe = (e) => {
|
|
150
|
+
N(e.value, e);
|
|
151
|
+
}, Ze = () => {
|
|
152
152
|
k({ focused: !0 });
|
|
153
|
-
},
|
|
153
|
+
}, Ge = () => {
|
|
154
154
|
h(!l());
|
|
155
155
|
}, F = () => {
|
|
156
|
-
|
|
157
|
-
},
|
|
156
|
+
d || (b.current = !0, h(!l()));
|
|
157
|
+
}, Je = (e) => {
|
|
158
158
|
e.preventDefault();
|
|
159
|
-
},
|
|
159
|
+
}, Qe = (e) => {
|
|
160
160
|
const { altKey: n, keyCode: u } = e;
|
|
161
161
|
if (u === O.esc && l()) {
|
|
162
162
|
b.current = !0, h(!1);
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
165
|
n && (u === O.up || u === O.down) && (e.preventDefault(), e.stopPropagation(), b.current = u === O.up, h(u === O.down));
|
|
166
|
-
}, v = o.useRef(null),
|
|
166
|
+
}, v = o.useRef(null), f = o.useRef(null), c = o.useRef(null), m = o.useRef(null);
|
|
167
167
|
o.useImperativeHandle(
|
|
168
168
|
v,
|
|
169
169
|
() => ({
|
|
170
170
|
props: r,
|
|
171
171
|
get element() {
|
|
172
|
-
return
|
|
172
|
+
return f.current;
|
|
173
173
|
},
|
|
174
174
|
get calendar() {
|
|
175
|
-
return
|
|
175
|
+
return m.current;
|
|
176
176
|
},
|
|
177
177
|
get dateInput() {
|
|
178
178
|
return c.current;
|
|
@@ -184,7 +184,7 @@ const he = o.forwardRef((r, ve) => {
|
|
|
184
184
|
return l();
|
|
185
185
|
},
|
|
186
186
|
get validity() {
|
|
187
|
-
return
|
|
187
|
+
return A();
|
|
188
188
|
},
|
|
189
189
|
get value() {
|
|
190
190
|
return g();
|
|
@@ -192,18 +192,18 @@ const he = o.forwardRef((r, ve) => {
|
|
|
192
192
|
get mobileMode() {
|
|
193
193
|
return s();
|
|
194
194
|
},
|
|
195
|
-
togglePopup:
|
|
195
|
+
togglePopup: Ge,
|
|
196
196
|
// Hidden Methods but still accessible
|
|
197
|
-
focus:
|
|
197
|
+
focus: He
|
|
198
198
|
})
|
|
199
|
-
), o.useImperativeHandle(
|
|
200
|
-
const M = o.useRef(void 0),
|
|
201
|
-
value:
|
|
202
|
-
show:
|
|
199
|
+
), o.useImperativeHandle(pe, () => v.current), ht("datepicker", v, r, r.webMcp);
|
|
200
|
+
const M = o.useRef(void 0), I = o.useRef(void 0), et = o.useRef(null), b = o.useRef(!1), L = o.useRef(!1), P = o.useRef(null), [p, tt] = o.useState({
|
|
201
|
+
value: ve,
|
|
202
|
+
show: he,
|
|
203
203
|
focused: !1
|
|
204
|
-
}), [,
|
|
204
|
+
}), [, nt] = o.useReducer((e) => e, !0), ee = r.name || S || void 0, ot = o.useCallback(
|
|
205
205
|
(e) => {
|
|
206
|
-
if (
|
|
206
|
+
if (d)
|
|
207
207
|
return;
|
|
208
208
|
let n = null;
|
|
209
209
|
if (e != null) {
|
|
@@ -214,143 +214,144 @@ const he = o.forwardRef((r, ve) => {
|
|
|
214
214
|
isNaN(u.getTime()) || (n = u);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
if (n &&
|
|
217
|
+
if (n && de(n, C, y)) {
|
|
218
218
|
const u = {
|
|
219
|
-
target:
|
|
220
|
-
currentTarget:
|
|
219
|
+
target: f.current,
|
|
220
|
+
currentTarget: f.current
|
|
221
221
|
};
|
|
222
|
-
|
|
222
|
+
N(n, { syntheticEvent: u });
|
|
223
223
|
}
|
|
224
224
|
},
|
|
225
|
-
[
|
|
225
|
+
[d, C, y]
|
|
226
226
|
);
|
|
227
|
-
|
|
228
|
-
fieldName:
|
|
229
|
-
onValueChange:
|
|
230
|
-
enabled: !!
|
|
227
|
+
vt(f, {
|
|
228
|
+
fieldName: ee,
|
|
229
|
+
onValueChange: ot,
|
|
230
|
+
enabled: !!ee
|
|
231
231
|
});
|
|
232
232
|
const k = (e) => {
|
|
233
|
-
|
|
233
|
+
tt((n) => ({ ...n, ...e }));
|
|
234
234
|
};
|
|
235
235
|
o.useEffect(() => {
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
m.current && m.current.element && l() && !L.current && m.current.element.focus({ preventScroll: !0 }), s() && l() && !L.current && setTimeout(() => {
|
|
237
|
+
m.current && m.current.element && m.current.element.focus({ preventScroll: !0 });
|
|
238
238
|
}, 300), c.current && c.current.element && !l() && b.current && c.current.element.focus({ preventScroll: !0 }), L.current = l(), b.current = !1;
|
|
239
239
|
}), o.useEffect(() => {
|
|
240
240
|
var e;
|
|
241
|
-
return P.current =
|
|
241
|
+
return P.current = ue && window.ResizeObserver && new window.ResizeObserver((n) => qe(n)), l() && nt(), (e = x()) != null && e.body && P.current && P.current.observe(x().body), () => {
|
|
242
242
|
var n;
|
|
243
|
-
clearTimeout(
|
|
243
|
+
clearTimeout(et.current), (n = x()) != null && n.body && P.current && P.current.disconnect();
|
|
244
244
|
};
|
|
245
245
|
}, []);
|
|
246
|
-
const
|
|
247
|
-
disabled:
|
|
248
|
-
format:
|
|
249
|
-
formatPlaceholder:
|
|
250
|
-
id:
|
|
251
|
-
ariaLabelledBy:
|
|
252
|
-
ariaDescribedBy:
|
|
253
|
-
ariaLabel:
|
|
246
|
+
const te = S + "-popup-id", rt = J(), at = Ve(), it = g(), lt = ze(), ut = je(), ne = !W || A().valid, oe = ge.toLanguageString(fe, Mt[fe]), st = {
|
|
247
|
+
disabled: d,
|
|
248
|
+
format: De,
|
|
249
|
+
formatPlaceholder: Be,
|
|
250
|
+
id: Ae,
|
|
251
|
+
ariaLabelledBy: Ne,
|
|
252
|
+
ariaDescribedBy: Fe,
|
|
253
|
+
ariaLabel: Se,
|
|
254
254
|
max: y,
|
|
255
255
|
min: C,
|
|
256
256
|
name: r.name,
|
|
257
|
-
onChange:
|
|
257
|
+
onChange: Xe,
|
|
258
258
|
required: r.required,
|
|
259
259
|
_ref: c,
|
|
260
|
-
tabIndex: l() ? -1 :
|
|
260
|
+
tabIndex: l() ? -1 : Pe,
|
|
261
261
|
title: r.title,
|
|
262
|
-
valid:
|
|
263
|
-
validationMessage:
|
|
264
|
-
validityStyles:
|
|
265
|
-
value:
|
|
262
|
+
valid: A().valid,
|
|
263
|
+
validationMessage: H,
|
|
264
|
+
validityStyles: W,
|
|
265
|
+
value: it,
|
|
266
266
|
label: void 0,
|
|
267
|
-
placeholder: p.focused ? null :
|
|
267
|
+
placeholder: p.focused ? null : Le,
|
|
268
268
|
ariaExpanded: l(),
|
|
269
269
|
autoFill: r.autoFill,
|
|
270
|
-
twoDigitYearMax:
|
|
270
|
+
twoDigitYearMax: Re,
|
|
271
271
|
enableMouseWheel: r.enableMouseWheel,
|
|
272
272
|
autoCorrectParts: r.autoCorrectParts,
|
|
273
|
-
autoSwitchParts:
|
|
274
|
-
autoSwitchKeys:
|
|
273
|
+
autoSwitchParts: Me,
|
|
274
|
+
autoSwitchKeys: Ie,
|
|
275
275
|
allowCaretMode: r.allowCaretMode,
|
|
276
|
-
inputAttributes:
|
|
277
|
-
},
|
|
278
|
-
|
|
276
|
+
inputAttributes: Te
|
|
277
|
+
}, re = /* @__PURE__ */ o.createElement(
|
|
278
|
+
bt,
|
|
279
279
|
{
|
|
280
|
-
onFocus:
|
|
281
|
-
onBlur: s() ? void 0 :
|
|
280
|
+
onFocus: Ze,
|
|
281
|
+
onBlur: s() ? void 0 : Q,
|
|
282
282
|
onSyncBlur: r.onBlur,
|
|
283
283
|
onSyncFocus: r.onFocus
|
|
284
284
|
},
|
|
285
285
|
(e) => /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
|
|
286
286
|
"span",
|
|
287
287
|
{
|
|
288
|
-
...r.label ? {} :
|
|
289
|
-
ref:
|
|
290
|
-
className:
|
|
288
|
+
...r.label ? {} : X,
|
|
289
|
+
ref: f,
|
|
290
|
+
className: se(
|
|
291
291
|
"k-input",
|
|
292
292
|
"k-datepicker",
|
|
293
293
|
{
|
|
294
|
-
[`k-input-${
|
|
295
|
-
[`k-rounded-${
|
|
294
|
+
[`k-input-${ce.sizeMap[_] || _}`]: _,
|
|
295
|
+
[`k-rounded-${ce.roundedMap[E] || E}`]: E,
|
|
296
296
|
[`k-input-${B}`]: B,
|
|
297
|
-
"k-invalid": !
|
|
298
|
-
"k-required":
|
|
299
|
-
"k-disabled":
|
|
297
|
+
"k-invalid": !ne,
|
|
298
|
+
"k-required": Z(),
|
|
299
|
+
"k-disabled": d,
|
|
300
300
|
"k-focus": p.focused
|
|
301
301
|
},
|
|
302
302
|
r.className
|
|
303
303
|
),
|
|
304
|
-
onKeyDown:
|
|
304
|
+
onKeyDown: Qe,
|
|
305
305
|
style: { width: r.width },
|
|
306
306
|
onFocus: s() ? F : e.onFocus,
|
|
307
307
|
onBlur: e.onBlur,
|
|
308
308
|
onClick: s() ? F : void 0
|
|
309
309
|
},
|
|
310
310
|
/* @__PURE__ */ o.createElement(
|
|
311
|
-
|
|
311
|
+
at,
|
|
312
312
|
{
|
|
313
313
|
_ref: c,
|
|
314
314
|
ariaRole: "combobox",
|
|
315
315
|
ariaHasPopup: "grid",
|
|
316
316
|
ariaExpanded: l(),
|
|
317
|
-
ariaControls: l() ?
|
|
318
|
-
autoFocus:
|
|
319
|
-
...
|
|
317
|
+
ariaControls: l() ? te : void 0,
|
|
318
|
+
autoFocus: Oe,
|
|
319
|
+
...st
|
|
320
320
|
}
|
|
321
321
|
),
|
|
322
322
|
/* @__PURE__ */ o.createElement(
|
|
323
|
-
|
|
323
|
+
lt,
|
|
324
324
|
{
|
|
325
325
|
type: "button",
|
|
326
326
|
icon: "calendar",
|
|
327
|
-
svgIcon:
|
|
328
|
-
title:
|
|
327
|
+
svgIcon: yt,
|
|
328
|
+
title: oe,
|
|
329
|
+
disabled: d,
|
|
329
330
|
className: "k-input-button",
|
|
330
331
|
onClick: s() ? void 0 : F,
|
|
331
|
-
"aria-label":
|
|
332
|
+
"aria-label": oe,
|
|
332
333
|
fillMode: B,
|
|
333
|
-
onMouseDown:
|
|
334
|
+
onMouseDown: Je
|
|
334
335
|
}
|
|
335
336
|
),
|
|
336
|
-
!s() &&
|
|
337
|
-
), s() &&
|
|
337
|
+
!s() && rt
|
|
338
|
+
), s() && ut)
|
|
338
339
|
);
|
|
339
340
|
return r.label ? /* @__PURE__ */ o.createElement(
|
|
340
|
-
|
|
341
|
+
St,
|
|
341
342
|
{
|
|
342
343
|
dateInput: c,
|
|
343
344
|
label: r.label,
|
|
344
345
|
editorId: S,
|
|
345
|
-
editorValid:
|
|
346
|
-
editorDisabled:
|
|
347
|
-
children:
|
|
346
|
+
editorValid: ne,
|
|
347
|
+
editorDisabled: d,
|
|
348
|
+
children: re,
|
|
348
349
|
style: { width: r.width },
|
|
349
|
-
...
|
|
350
|
+
...X
|
|
350
351
|
}
|
|
351
|
-
) :
|
|
352
|
+
) : re;
|
|
352
353
|
});
|
|
353
|
-
|
|
354
|
+
me.propTypes = {
|
|
354
355
|
className: t.string,
|
|
355
356
|
defaultShow: t.bool,
|
|
356
357
|
defaultValue: t.instanceOf(Date),
|
|
@@ -422,14 +423,14 @@ he.propTypes = {
|
|
|
422
423
|
const i = {
|
|
423
424
|
defaultShow: !1,
|
|
424
425
|
defaultValue: null,
|
|
425
|
-
dateInput:
|
|
426
|
-
calendar:
|
|
427
|
-
toggleButton:
|
|
428
|
-
popup:
|
|
426
|
+
dateInput: Ct,
|
|
427
|
+
calendar: Dt,
|
|
428
|
+
toggleButton: Rt,
|
|
429
|
+
popup: dt,
|
|
429
430
|
disabled: !1,
|
|
430
431
|
format: "d",
|
|
431
|
-
max:
|
|
432
|
-
min:
|
|
432
|
+
max: kt,
|
|
433
|
+
min: Pt,
|
|
433
434
|
popupSettings: {},
|
|
434
435
|
tabIndex: 0,
|
|
435
436
|
weekNumber: !1,
|
|
@@ -438,10 +439,10 @@ const i = {
|
|
|
438
439
|
rounded: void 0,
|
|
439
440
|
fillMode: void 0,
|
|
440
441
|
autoFocus: !1
|
|
441
|
-
},
|
|
442
|
-
|
|
442
|
+
}, Bt = wt();
|
|
443
|
+
me.displayName = "KendoReactDatePicker";
|
|
443
444
|
export {
|
|
444
|
-
|
|
445
|
-
|
|
445
|
+
me as DatePicker,
|
|
446
|
+
Bt as DatePickerPropsContext,
|
|
446
447
|
i as datePickerDefaultProps
|
|
447
448
|
};
|
|
@@ -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 T=require("react"),t=require("prop-types"),P=require("@progress/kendo-react-popup"),D=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),c=require("@progress/kendo-react-intl"),x=require("@progress/kendo-svg-icons"),b=require("../package-metadata.js"),g=require("../dateinput/DateInput.js"),_=require("../calendar/components/MultiViewCalendar.js"),h=require("../calendar/models/SelectionRange.js"),u=require("../utils.js"),i=require("../messages/index.js"),A=require("@progress/kendo-react-buttons"),L=require("../common/AdaptiveMode.js"),N=require("@progress/kendo-react-layout");function z(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 n=z(T),l=class l extends n.Component{constructor(a){super(a),this._element=null,this._calendar=null,this._startDateInput=n.createRef(),this._endDateInput=n.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?n.createElement(this.props.calendar,{...s}):n.createElement(_.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?n.createElement(this.props.popup,{...e},this.renderCalendar()):n.createElement(P.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,subTitle:this.props.adaptiveSubtitle,windowWidth:e,footer:{cancelText:this.localizationService.toLanguageString(i.dateRangePickerCancel,i.messages[i.dateRangePickerCancel]),onCancel:this.handleCancel,applyText:this.localizationService.toLanguageString(i.dateRangePickerSet,i.messages[i.dateRangePickerSet]),onApply:this.handleBlur}};return n.createElement(L.AdaptiveMode,{...s},n.createElement(N.ActionSheetContent,null,n.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(b.packageMetadata,{component:"DateRangePicker"}),this.licenseMessage=o.getLicenseMessage(b.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(){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}=this.props,e=this.value||h.EMPTY_SELECTIONRANGE,s=this.mobileMode&&this.show?this.state.currentValue:e,r=(this.props.startDateInputSettings||{}).id||this._startInputId,m=(this.props.endDateInputSettings||{}).id||this._endInputId,S=o.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),E=this.localizationService.toLanguageString(i.start,i.messages[i.start]),C=this.localizationService.toLanguageString(i.end,i.messages[i.end]),y=this.localizationService.toLanguageString(i.separator,i.messages[i.separator]),k=this.localizationService.toLanguageString(i.selectStartDate,i.messages[i.selectStartDate]),R=this.localizationService.toLanguageString(i.selectEndDate,i.messages[i.selectEndDate]),f={disableSelection:this.mobileMode&&!0,label:E,ariaLabel:k,ariaHasPopup:"grid",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:s.start,onChange:this.handleStartChange,inputAttributes:this.props.inputAttributes},v={disableSelection:this.mobileMode&&!0,label:C,ariaLabel:R,ariaHasPopup:"grid",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:s.end,onChange:this.handleEndChange,inputAttributes:this.props.inputAttributes},M=n.createElement(A.Button,{type:"button",className:"k-select",fillMode:"flat",title:c.provideLocalizationService(this).toLanguageString(i.swapStartEnd,i.messages[i.swapStartEnd]),onMouseDown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":r+" "+m,"aria-label":c.provideLocalizationService(this).toLanguageString(i.swapStartEnd,i.messages[i.swapStartEnd])},n.createElement(o.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:x.arrowsSwapIcon}));return n.createElement(n.Fragment,null,n.createElement("span",{ref:O=>{this._element=O},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?n.createElement(this.props.startDateInput,{...f}):n.createElement(g.DateInput,{...f,autoFocus:a,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this.show?this._popupId:void 0}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?M:y,this.props.endDateInput?n.createElement(this.props.endDateInput,{...v}):n.createElement(g.DateInput,{...v,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this.show?this._popupId:void 0}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&n.createElement(o.WatermarkOverlay,{message:this.licenseMessage}))}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 w=o.createPropsContext(),I=o.withIdHOC(o.withPropsContext(w,o.withAdaptiveModeContext(p)));I.displayName="KendoReactDateRangePicker";c.registerForLocalization(p);exports.DateRangePicker=I;exports.DateRangePickerPropsContext=w;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"),D=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"),i=require("../messages/index.js"),x=require("@progress/kendo-react-buttons"),_=require("../common/AdaptiveMode.js"),A=require("@progress/kendo-react-layout");function N(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 n=N(M),l=class l extends n.Component{constructor(a){super(a),this._element=null,this._calendar=null,this._startDateInput=n.createRef(),this._endDateInput=n.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?n.createElement(this.props.calendar,{...s}):n.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?n.createElement(this.props.popup,{...e},this.renderCalendar()):n.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,subTitle:this.props.adaptiveSubtitle,windowWidth:e,footer:{cancelText:this.localizationService.toLanguageString(i.dateRangePickerCancel,i.messages[i.dateRangePickerCancel]),onCancel:this.handleCancel,applyText:this.localizationService.toLanguageString(i.dateRangePickerSet,i.messages[i.dateRangePickerSet]),onApply:this.handleBlur}};return n.createElement(_.AdaptiveMode,{...s},n.createElement(A.ActionSheetContent,null,n.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(D.packageMetadata,{component:"DateRangePicker"}),this.licenseMessage=o.getLicenseMessage(D.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(){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}=this.props,e=this.value||h.EMPTY_SELECTIONRANGE,s=this.mobileMode&&this.show?this.state.currentValue:e,r=(this.props.startDateInputSettings||{}).id||this._startInputId,m=(this.props.endDateInputSettings||{}).id||this._endInputId,S=o.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),C=this.localizationService.toLanguageString(i.start,i.messages[i.start]),E=this.localizationService.toLanguageString(i.end,i.messages[i.end]),y=this.localizationService.toLanguageString(i.separator,i.messages[i.separator]),f={disableSelection:this.mobileMode&&!0,label:C,ariaHasPopup:"grid",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:s.start,onChange:this.handleStartChange,inputAttributes:this.props.inputAttributes},v={disableSelection:this.mobileMode&&!0,label:E,ariaHasPopup:"grid",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:s.end,onChange:this.handleEndChange,inputAttributes:this.props.inputAttributes},k=n.createElement(x.Button,{type:"button",className:"k-select",fillMode:"flat",title:c.provideLocalizationService(this).toLanguageString(i.swapStartEnd,i.messages[i.swapStartEnd]),onMouseDown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":r+" "+m,"aria-label":c.provideLocalizationService(this).toLanguageString(i.swapStartEnd,i.messages[i.swapStartEnd])},n.createElement(o.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:T.arrowsSwapIcon}));return n.createElement(n.Fragment,null,n.createElement("span",{ref:R=>{this._element=R},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?n.createElement(this.props.startDateInput,{...f}):n.createElement(g.DateInput,{...f,autoFocus:a,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this.show?this._popupId:void 0}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?k:y,this.props.endDateInput?n.createElement(this.props.endDateInput,{...v}):n.createElement(g.DateInput,{...v,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this.show?this._popupId:void 0}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&n.createElement(o.WatermarkOverlay,{message:this.licenseMessage}))}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 w=o.createPropsContext(),I=o.withIdHOC(o.withPropsContext(w,o.withAdaptiveModeContext(p)));I.displayName="KendoReactDateRangePicker";c.registerForLocalization(p);exports.DateRangePicker=I;exports.DateRangePickerPropsContext=w;exports.DateRangePickerWithoutContext=p;
|