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