@progress/kendo-react-dateinputs 9.3.0-develop.3 → 9.3.0-develop.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dateinput/DateInput.js
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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ve=require("react"),e=require("prop-types"),I=require("@progress/kendo-date-math"),$=require("@progress/kendo-react-buttons"),G=require("@progress/kendo-svg-icons"),Z=require("@progress/kendo-react-intl"),l=require("@progress/kendo-react-common"),Le=require("@progress/kendo-react-labels"),pe=require("@progress/kendo-dateinputs-common"),k=require("./utils.js"),Ne=require("../package-metadata.js"),c=require("../utils.js"),s=require("../messages/index.js"),Ae=require("../timepicker/utils.js"),_e=require("../common/ClearButton.js"),Be=require("./dateInputIntl.js");function je(t){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const m in t)if(m!=="default"){const O=Object.getOwnPropertyDescriptor(t,m);Object.defineProperty(b,m,O.get?O:{enumerable:!0,get:()=>t[m]})}}return b.default=t,Object.freeze(b)}const a=je(Ve),Fe="Please enter a valid value!",L=a.forwardRef((t,b)=>{var J;l.validatePackage(Ne.packageMetadata);const m=l.useId(t.id),O=Z.useInternationalization(),E=Z.useLocalization(),Q=l.useUnstyled(),p=l.usePropsContext(V,t).unstyled||Q,{format:w=r.format,size:ee=r.size,rounded:te=r.rounded,fillMode:ne=r.fillMode,formatPlaceholder:ae=r.formatPlaceholder,spinners:re=r.spinners,disabled:C=r.disabled,min:ie=r.min,max:le=r.max,minTime:ue=r.minTime,maxTime:oe=r.maxTime,validityStyles:se=r.validityStyles,validationMessage:N=r.validationMessage,placeholder:y=r.placeholder,enableMouseWheel:ce=r.enableMouseWheel,autoCorrectParts:de=r.autoCorrectParts,autoSwitchParts:fe=r.autoSwitchParts,allowCaretMode:me=r.allowCaretMode,twoDigitYearMax:ge=r.twoDigitYearMax,ariaHasPopup:ve=r.ariaHasPopup,autoFocus:be=r.autoFocus}=l.usePropsContext(V,t),g=()=>M.current!==void 0?M.current:u.current&&u.current.value,A=()=>{const n=u.current&&u.current.currentText||"",i=g();return y!=null&&!we.focused&&!i?y:n},_=()=>t.required!==void 0?t.required:!1,P=()=>{const n=g()||t.value,i=ie,X=le,Te=k.isInRange(n,i,X)&&Ae.isInTimeRange(n,ue,oe),qe=N!==void 0,Se=(!_()||n!=null)&&Te,ke=t.valid!==void 0?t.valid:Se;return{customError:qe,rangeOverflow:n&&X.getTime()<n.getTime()||!1,rangeUnderflow:n&&n.getTime()<i.getTime()||!1,valid:ke,valueMissing:n===null}},ye=()=>{o.current&&o.current.focus()},B=()=>new Be.DateInputIntl(O),R=()=>{const n=g();return{format:w,steps:t.steps,formatPlaceholder:ae,placeholder:y,selectPreviousSegmentOnBackspace:!0,value:t.value||n,intlService:B(),autoFill:t.autoFill!==void 0?t.autoFill:!1,enableMouseWheel:ce,autoCorrectParts:de,autoSwitchParts:fe,autoSwitchKeys:t.autoSwitchKeys||[],twoDigitYearMax:ge,allowCaretMode:me}},he=n=>{d.current&&d.current.classList.add("k-focus"),U({focused:!0})},De=n=>{d.current&&d.current.classList.remove("k-focus"),U({focused:!1})},Ie=(n,i)=>typeof n!=typeof i?!0:typeof n=="string"&&typeof i=="string"?n!==i:typeof n=="object"&&typeof i=="object"?JSON.stringify(n)!==JSON.stringify(i):!1,Oe=n=>typeof n=="string"?n:{inputFormat:n,displayFormat:n},j=n=>{M.current=g(),Pe(),v.current=n,M.current=void 0},F=n=>{t.onChange&&t.onChange(n)},H=n=>{l.getActiveElement(document)===o.current&&n.preventDefault()},Ee=()=>new pe.DateInput(o.current,{...R(),format:Oe(R().format),events:{focus:he,blur:De,valueChange:j,click:F}}),z=()=>{o.current&&o.current.setCustomValidity&&o.current.setCustomValidity(P().valid?"":N||r.validationMessage)},Ce=n=>{!o.current||!u.current||j(n)},Re=n=>{n.preventDefault();const i=l.getActiveElement(document);o.current&&i!==o.current&&o.current.focus({preventScroll:!0})},f=n=>{const i=g();v.current&&t.onChange&&!I.isEqual(v.current.oldValue,i)&&t.onChange.call(void 0,{syntheticEvent:n,nativeEvent:v.current.event,value:v.current.value,target:x.current}),v.current=null},xe=n=>{var i;(i=u.current)==null||i.modifyDateSegmentValue(1),f(n)},Me=n=>{var i;(i=u.current)==null||i.modifyDateSegmentValue(-1),f(n)},x=a.useRef(null),o=a.useRef(null),d=a.useRef(null);a.useImperativeHandle(x,()=>({props:t,get options(){return R()},get text(){return A()},get element(){return o.current},get name(){return t.name},get value(){return g()},get validity(){return P()},focus:ye,updateOnPaste:Ce})),a.useImperativeHandle(b,()=>x.current);const u=a.useRef(null),T=a.useRef(null),q=a.useRef(!1),M=a.useRef(null),v=a.useRef(null),h=a.useRef(t),[we,U]=a.useState({focused:!1}),[,Pe]=a.useReducer(n=>n+1,0);a.useLayoutEffect(()=>{q.current||(u.current=Ee(),T.current=u.current.dateObject,q.current=!0)},[]),a.useEffect(()=>(z(),q.current||d.current&&d.current.addEventListener("wheel",H,{passive:!1}),()=>{d.current&&d.current.removeEventListener("wheel",H)}),[]),a.useEffect(()=>{z(),u.current&&((Ie(h.current.format,w)||h.current.readonly!==t.readonly||h.current.steps!==t.steps||B().locale!==u.current.options.intlService.locale)&&u.current.setOptions(R(),!0),h.current.value!==t.value&&(T.current.getValue()!==null||t.value!==null)&&T.current.setValue(t.value),t.ariaExpanded!==void 0&&t.ariaExpanded&&(u.current.options.placeholder=null),t.ariaExpanded!==void 0&&!t.ariaExpanded&&(u.current.options.placeholder=y),u.current.refreshElementValue(),h.current={format:w,readonly:t.readonly,ariaExpanded:t.ariaExpanded,steps:t.steps,value:t.value})});const W=t.id||m+"-accessibility-id",D=p&&p.uDateInput,K=A(),S=!se||P().valid;t._ref&&(t._ref.current=x.current);const Y=a.createElement("span",{ref:n=>d.current=n,style:t.label?void 0:{width:t.width},dir:t.dir,className:l.classNames(l.uDateInput.wrapper({c:D,size:ee,fillMode:ne,rounded:te,disabled:C,required:_(),invalid:!S}),t.className)},a.createElement("input",{ref:n=>o.current=n,role:t.ariaRole||"textbox",readOnly:t.readonly,tabIndex:t.tabIndex||0,disabled:C,title:t.title!==void 0?t.title:K,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:be,className:l.classNames(l.uDateInput.inputInner({c:D})),id:W,value:K,"aria-label":t.ariaLabel,"aria-labelledby":t.ariaLabelledBy,"aria-describedby":t.ariaDescribedBy,"aria-haspopup":ve,"aria-disabled":C,"aria-expanded":t.ariaExpanded,"aria-controls":t.ariaControls,"aria-required":t.required,"aria-invalid":!S,onKeyDown:f,onChange:f,onWheel:f,onInput:f,onClick:f,name:t.name,...t.inputAttributes}),t.children,t.clearButton&&t.value&&a.createElement(_e,{onClick:F,key:"clearbutton"}),re&&a.createElement("span",{className:l.classNames(l.uDateInput.inputSpinner({c:D})),onMouseDown:Re},a.createElement($.Button,{tabIndex:-1,type:"button",rounded:null,className:l.classNames(l.uDateInput.spinnerIncrease({c:D})),icon:"caret-alt-up",svgIcon:G.caretAltUpIcon,"aria-label":E.toLanguageString(s.increaseValue,s.messages[s.increaseValue]),title:E.toLanguageString(s.increaseValue,s.messages[s.increaseValue]),onClick:xe}),a.createElement($.Button,{tabIndex:-1,type:"button",rounded:null,className:l.classNames(l.uDateInput.spinnerDecrease({c:D})),icon:"caret-alt-down",svgIcon:G.caretAltDownIcon,"aria-label":E.toLanguageString(s.decreaseValue,s.messages[s.decreaseValue]),title:E.toLanguageString(s.decreaseValue,s.messages[s.decreaseValue]),onClick:Me})));return t.label?a.createElement(Le.FloatingLabel,{label:t.label,editorId:W,editorValue:(J=o.current)==null?void 0:J.value,editorValid:S,editorDisabled:C,children:Y,style:{width:t.width}}):Y});L.propTypes={value:e.instanceOf(Date),format:e.oneOfType([c.nullable(e.string),e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]).isRequired,e.shape({year:e.string.isRequired,month:e.string.isRequired,day:e.string.isRequired,hour:e.string.isRequired,minute:e.string.isRequired,second:e.string.isRequired})]),width:e.oneOfType([e.string,e.number]),tabIndex:e.number,title:e.string,steps:e.shape({year:c.nullable(e.number),month:c.nullable(e.number),day:c.nullable(e.number),hour:c.nullable(e.number),minute:c.nullable(e.number),second:c.nullable(e.number)}),min:e.instanceOf(Date),max:e.instanceOf(Date),disabled:e.bool,spinners:e.bool,name:e.string,dir:e.string,label:e.string,id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,ariaLabel:e.string,ariaRole:e.string,ariaHasPopup:e.oneOfType([e.bool,e.oneOf(["grid","dialog"])]),ariaExpanded:e.oneOfType([e.bool]),onChange:e.func,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"]),autoFocus:e.bool,inputAttributes:e.object};const r={format:k.DEFAULT_FORMAT,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:k.DEFAULT_FORMAT_PLACEHOLDER,spinners:!1,disabled:!1,max:I.cloneDate(c.MAX_DATE),min:I.cloneDate(c.MIN_DATE),minTime:I.cloneDate(c.MIN_TIME),maxTime:I.cloneDate(c.MAX_TIME),validityStyles:!0,validationMessage:Fe,placeholder:null,enableMouseWheel:!0,autoCorrectParts:!0,autoSwitchParts:!0,allowCaretMode:!1,twoDigitYearMax:68,ariaHasPopup:"grid",autoFocus:!1},V=l.createPropsContext();L.displayName="KendoReactDateInput";exports.DateInput=L;exports.DateInputPropsContext=V;exports.dateInputDefaultProps=r;
|
package/dateinput/DateInput.mjs
CHANGED
|
@@ -6,130 +6,127 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as a from "react";
|
|
10
10
|
import e from "prop-types";
|
|
11
|
-
import { cloneDate as
|
|
12
|
-
import { Button as
|
|
13
|
-
import { caretAltUpIcon as
|
|
14
|
-
import { useInternationalization as
|
|
15
|
-
import { validatePackage as
|
|
16
|
-
import { FloatingLabel as
|
|
17
|
-
import { DateInput as
|
|
18
|
-
import { DEFAULT_FORMAT as
|
|
19
|
-
import { packageMetadata as
|
|
20
|
-
import { nullable as c, MAX_DATE as
|
|
21
|
-
import { increaseValue as
|
|
22
|
-
import { isInTimeRange as
|
|
23
|
-
import
|
|
24
|
-
import { DateInputIntl as
|
|
25
|
-
const
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
format:
|
|
30
|
-
size:
|
|
31
|
-
rounded:
|
|
32
|
-
fillMode:
|
|
33
|
-
formatPlaceholder:
|
|
34
|
-
spinners:
|
|
35
|
-
disabled:
|
|
36
|
-
min:
|
|
37
|
-
max:
|
|
38
|
-
minTime:
|
|
39
|
-
maxTime:
|
|
40
|
-
validityStyles:
|
|
41
|
-
validationMessage:
|
|
42
|
-
placeholder: f =
|
|
43
|
-
enableMouseWheel:
|
|
44
|
-
autoCorrectParts:
|
|
45
|
-
autoSwitchParts:
|
|
46
|
-
allowCaretMode:
|
|
47
|
-
twoDigitYearMax:
|
|
48
|
-
ariaHasPopup:
|
|
49
|
-
autoFocus:
|
|
50
|
-
} =
|
|
51
|
-
const
|
|
52
|
-
return
|
|
53
|
-
},
|
|
54
|
-
const n =
|
|
55
|
-
return f != null && !pe.focused && !a ? f : n;
|
|
56
|
-
}, F = () => t.required !== void 0 ? t.required : !1, p = () => {
|
|
57
|
-
const n = d() || t.value, a = ce, y = de, R = Xe(n, a, y) && tt(n, me, fe), w = N !== void 0, M = (!F() || n != null) && R, Ve = t.valid !== void 0 ? t.valid : M;
|
|
11
|
+
import { cloneDate as x, isEqual as Ve } from "@progress/kendo-date-math";
|
|
12
|
+
import { Button as Y } from "@progress/kendo-react-buttons";
|
|
13
|
+
import { caretAltUpIcon as qe, caretAltDownIcon as Ne } from "@progress/kendo-svg-icons";
|
|
14
|
+
import { useInternationalization as _e, useLocalization as Fe } from "@progress/kendo-react-intl";
|
|
15
|
+
import { validatePackage as Be, useId as He, useUnstyled as ze, usePropsContext as J, classNames as y, uDateInput as b, createPropsContext as Ue, getActiveElement as X } from "@progress/kendo-react-common";
|
|
16
|
+
import { FloatingLabel as We } from "@progress/kendo-react-labels";
|
|
17
|
+
import { DateInput as je } from "@progress/kendo-dateinputs-common";
|
|
18
|
+
import { DEFAULT_FORMAT as Ke, DEFAULT_FORMAT_PLACEHOLDER as Ye, isInRange as Je } from "./utils.mjs";
|
|
19
|
+
import { packageMetadata as Xe } from "../package-metadata.mjs";
|
|
20
|
+
import { nullable as c, MAX_DATE as Ge, MIN_DATE as Ze, MIN_TIME as $e, MAX_TIME as Qe } from "../utils.mjs";
|
|
21
|
+
import { increaseValue as C, messages as R, decreaseValue as w } from "../messages/index.mjs";
|
|
22
|
+
import { isInTimeRange as et } from "../timepicker/utils.mjs";
|
|
23
|
+
import tt from "../common/ClearButton.mjs";
|
|
24
|
+
import { DateInputIntl as nt } from "./dateInputIntl.mjs";
|
|
25
|
+
const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
|
|
26
|
+
var j;
|
|
27
|
+
Be(Xe);
|
|
28
|
+
const Q = He(t.id), ee = _e(), h = Fe(), te = ze(), L = J(G, t).unstyled || te, {
|
|
29
|
+
format: M = r.format,
|
|
30
|
+
size: ne = r.size,
|
|
31
|
+
rounded: ae = r.rounded,
|
|
32
|
+
fillMode: re = r.fillMode,
|
|
33
|
+
formatPlaceholder: ie = r.formatPlaceholder,
|
|
34
|
+
spinners: le = r.spinners,
|
|
35
|
+
disabled: E = r.disabled,
|
|
36
|
+
min: oe = r.min,
|
|
37
|
+
max: ue = r.max,
|
|
38
|
+
minTime: se = r.minTime,
|
|
39
|
+
maxTime: ce = r.maxTime,
|
|
40
|
+
validityStyles: de = r.validityStyles,
|
|
41
|
+
validationMessage: p = r.validationMessage,
|
|
42
|
+
placeholder: f = r.placeholder,
|
|
43
|
+
enableMouseWheel: me = r.enableMouseWheel,
|
|
44
|
+
autoCorrectParts: fe = r.autoCorrectParts,
|
|
45
|
+
autoSwitchParts: ge = r.autoSwitchParts,
|
|
46
|
+
allowCaretMode: ve = r.allowCaretMode,
|
|
47
|
+
twoDigitYearMax: ye = r.twoDigitYearMax,
|
|
48
|
+
ariaHasPopup: be = r.ariaHasPopup,
|
|
49
|
+
autoFocus: he = r.autoFocus
|
|
50
|
+
} = J(G, t), d = () => I.current !== void 0 ? I.current : l.current && l.current.value, A = () => {
|
|
51
|
+
const n = l.current && l.current.currentText || "", i = d();
|
|
52
|
+
return f != null && !Pe.focused && !i ? f : n;
|
|
53
|
+
}, V = () => t.required !== void 0 ? t.required : !1, T = () => {
|
|
54
|
+
const n = d() || t.value, i = oe, K = ue, ke = Je(n, i, K) && et(n, se, ce), Le = p !== void 0, pe = (!V() || n != null) && ke, Ae = t.valid !== void 0 ? t.valid : pe;
|
|
58
55
|
return {
|
|
59
|
-
customError:
|
|
60
|
-
rangeOverflow: n &&
|
|
61
|
-
rangeUnderflow: n && n.getTime() <
|
|
62
|
-
valid:
|
|
56
|
+
customError: Le,
|
|
57
|
+
rangeOverflow: n && K.getTime() < n.getTime() || !1,
|
|
58
|
+
rangeUnderflow: n && n.getTime() < i.getTime() || !1,
|
|
59
|
+
valid: Ae,
|
|
63
60
|
valueMissing: n === null
|
|
64
61
|
};
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
},
|
|
62
|
+
}, Ee = () => {
|
|
63
|
+
o.current && o.current.focus();
|
|
64
|
+
}, q = () => new nt(ee), O = () => {
|
|
68
65
|
const n = d();
|
|
69
66
|
return {
|
|
70
|
-
format:
|
|
67
|
+
format: M,
|
|
71
68
|
steps: t.steps,
|
|
72
|
-
formatPlaceholder:
|
|
69
|
+
formatPlaceholder: ie,
|
|
73
70
|
placeholder: f,
|
|
74
71
|
selectPreviousSegmentOnBackspace: !0,
|
|
75
72
|
value: t.value || n,
|
|
76
|
-
intlService:
|
|
73
|
+
intlService: q(),
|
|
77
74
|
autoFill: t.autoFill !== void 0 ? t.autoFill : !1,
|
|
78
|
-
enableMouseWheel:
|
|
79
|
-
autoCorrectParts:
|
|
80
|
-
autoSwitchParts:
|
|
75
|
+
enableMouseWheel: me,
|
|
76
|
+
autoCorrectParts: fe,
|
|
77
|
+
autoSwitchParts: ge,
|
|
81
78
|
autoSwitchKeys: t.autoSwitchKeys || [],
|
|
82
|
-
twoDigitYearMax:
|
|
83
|
-
allowCaretMode:
|
|
79
|
+
twoDigitYearMax: ye,
|
|
80
|
+
allowCaretMode: ve
|
|
84
81
|
};
|
|
85
|
-
},
|
|
86
|
-
u.current && u.current.classList.add("k-focus"),
|
|
87
|
-
},
|
|
88
|
-
u.current && u.current.classList.remove("k-focus"),
|
|
89
|
-
},
|
|
82
|
+
}, Oe = (n) => {
|
|
83
|
+
u.current && u.current.classList.add("k-focus"), H({ focused: !0 });
|
|
84
|
+
}, De = (n) => {
|
|
85
|
+
u.current && u.current.classList.remove("k-focus"), H({ focused: !1 });
|
|
86
|
+
}, Ie = (n, i) => typeof n != typeof i ? !0 : typeof n == "string" && typeof i == "string" ? n !== i : typeof n == "object" && typeof i == "object" ? JSON.stringify(n) !== JSON.stringify(i) : !1, xe = (n) => typeof n == "string" ? n : {
|
|
90
87
|
inputFormat: n,
|
|
91
88
|
displayFormat: n
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
},
|
|
89
|
+
}, N = (n) => {
|
|
90
|
+
I.current = d(), Se(), m.current = n, I.current = void 0;
|
|
91
|
+
}, _ = (n) => {
|
|
95
92
|
t.onChange && t.onChange(n);
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
},
|
|
93
|
+
}, F = (n) => {
|
|
94
|
+
X(document) === o.current && n.preventDefault();
|
|
95
|
+
}, Ce = () => new je(o.current, {
|
|
99
96
|
...O(),
|
|
100
|
-
format:
|
|
97
|
+
format: xe(O().format),
|
|
101
98
|
events: {
|
|
102
|
-
focus:
|
|
103
|
-
blur:
|
|
104
|
-
valueChange:
|
|
105
|
-
click:
|
|
99
|
+
focus: Oe,
|
|
100
|
+
blur: De,
|
|
101
|
+
valueChange: N,
|
|
102
|
+
click: _
|
|
106
103
|
}
|
|
107
|
-
}),
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
}), B = () => {
|
|
105
|
+
o.current && o.current.setCustomValidity && o.current.setCustomValidity(
|
|
106
|
+
T().valid ? "" : p || r.validationMessage
|
|
110
107
|
);
|
|
111
|
-
},
|
|
112
|
-
!
|
|
113
|
-
},
|
|
108
|
+
}, Re = (n) => {
|
|
109
|
+
!o.current || !l.current || N(n);
|
|
110
|
+
}, we = (n) => {
|
|
114
111
|
n.preventDefault();
|
|
115
|
-
const
|
|
116
|
-
|
|
112
|
+
const i = X(document);
|
|
113
|
+
o.current && i !== o.current && o.current.focus({ preventScroll: !0 });
|
|
117
114
|
}, s = (n) => {
|
|
118
|
-
const
|
|
119
|
-
m.current && t.onChange && !
|
|
115
|
+
const i = d();
|
|
116
|
+
m.current && t.onChange && !Ve(m.current.oldValue, i) && t.onChange.call(void 0, {
|
|
120
117
|
syntheticEvent: n,
|
|
121
118
|
nativeEvent: m.current.event,
|
|
122
119
|
value: m.current.value,
|
|
123
120
|
target: D.current
|
|
124
121
|
}), m.current = null;
|
|
125
|
-
},
|
|
126
|
-
var
|
|
127
|
-
(
|
|
128
|
-
},
|
|
129
|
-
var
|
|
130
|
-
(
|
|
131
|
-
}, D =
|
|
132
|
-
|
|
122
|
+
}, Me = (n) => {
|
|
123
|
+
var i;
|
|
124
|
+
(i = l.current) == null || i.modifyDateSegmentValue(1), s(n);
|
|
125
|
+
}, Te = (n) => {
|
|
126
|
+
var i;
|
|
127
|
+
(i = l.current) == null || i.modifyDateSegmentValue(-1), s(n);
|
|
128
|
+
}, D = a.useRef(null), o = a.useRef(null), u = a.useRef(null);
|
|
129
|
+
a.useImperativeHandle(
|
|
133
130
|
D,
|
|
134
131
|
() => ({
|
|
135
132
|
props: t,
|
|
@@ -137,10 +134,10 @@ const rt = "Please enter a valid value!", ee = r.forwardRef((t, te) => {
|
|
|
137
134
|
return O();
|
|
138
135
|
},
|
|
139
136
|
get text() {
|
|
140
|
-
return
|
|
137
|
+
return A();
|
|
141
138
|
},
|
|
142
139
|
get element() {
|
|
143
|
-
return
|
|
140
|
+
return o.current;
|
|
144
141
|
},
|
|
145
142
|
get name() {
|
|
146
143
|
return t.name;
|
|
@@ -149,74 +146,74 @@ const rt = "Please enter a valid value!", ee = r.forwardRef((t, te) => {
|
|
|
149
146
|
return d();
|
|
150
147
|
},
|
|
151
148
|
get validity() {
|
|
152
|
-
return
|
|
149
|
+
return T();
|
|
153
150
|
},
|
|
154
151
|
// hidden methods
|
|
155
|
-
focus:
|
|
156
|
-
updateOnPaste:
|
|
152
|
+
focus: Ee,
|
|
153
|
+
updateOnPaste: Re
|
|
157
154
|
})
|
|
158
|
-
),
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}, []),
|
|
163
|
-
u.current && u.current.removeEventListener("wheel",
|
|
164
|
-
}), []),
|
|
165
|
-
|
|
166
|
-
format:
|
|
155
|
+
), a.useImperativeHandle($, () => D.current);
|
|
156
|
+
const l = a.useRef(null), P = a.useRef(null), S = a.useRef(!1), I = a.useRef(null), m = a.useRef(null), g = a.useRef(t), [Pe, H] = a.useState({ focused: !1 }), [, Se] = a.useReducer((n) => n + 1, 0);
|
|
157
|
+
a.useLayoutEffect(() => {
|
|
158
|
+
S.current || (l.current = Ce(), P.current = l.current.dateObject, S.current = !0);
|
|
159
|
+
}, []), a.useEffect(() => (B(), S.current || u.current && u.current.addEventListener("wheel", F, { passive: !1 }), () => {
|
|
160
|
+
u.current && u.current.removeEventListener("wheel", F);
|
|
161
|
+
}), []), a.useEffect(() => {
|
|
162
|
+
B(), l.current && ((Ie(g.current.format, M) || g.current.readonly !== t.readonly || g.current.steps !== t.steps || q().locale !== l.current.options.intlService.locale) && l.current.setOptions(O(), !0), g.current.value !== t.value && (P.current.getValue() !== null || t.value !== null) && P.current.setValue(t.value), t.ariaExpanded !== void 0 && t.ariaExpanded && (l.current.options.placeholder = null), t.ariaExpanded !== void 0 && !t.ariaExpanded && (l.current.options.placeholder = f), l.current.refreshElementValue(), g.current = {
|
|
163
|
+
format: M,
|
|
167
164
|
readonly: t.readonly,
|
|
168
165
|
ariaExpanded: t.ariaExpanded,
|
|
169
166
|
steps: t.steps,
|
|
170
167
|
value: t.value
|
|
171
168
|
});
|
|
172
169
|
});
|
|
173
|
-
const
|
|
170
|
+
const z = t.id || Q + "-accessibility-id", v = L && L.uDateInput, U = A(), k = !de || T().valid;
|
|
174
171
|
t._ref && (t._ref.current = D.current);
|
|
175
|
-
const
|
|
172
|
+
const W = /* @__PURE__ */ a.createElement(
|
|
176
173
|
"span",
|
|
177
174
|
{
|
|
178
175
|
ref: (n) => u.current = n,
|
|
179
176
|
style: t.label ? void 0 : { width: t.width },
|
|
180
177
|
dir: t.dir,
|
|
181
|
-
className:
|
|
182
|
-
|
|
178
|
+
className: y(
|
|
179
|
+
b.wrapper({
|
|
183
180
|
c: v,
|
|
184
|
-
size:
|
|
185
|
-
fillMode:
|
|
186
|
-
rounded:
|
|
187
|
-
disabled:
|
|
188
|
-
required:
|
|
189
|
-
invalid: !
|
|
181
|
+
size: ne,
|
|
182
|
+
fillMode: re,
|
|
183
|
+
rounded: ae,
|
|
184
|
+
disabled: E,
|
|
185
|
+
required: V(),
|
|
186
|
+
invalid: !k
|
|
190
187
|
}),
|
|
191
188
|
t.className
|
|
192
189
|
)
|
|
193
190
|
},
|
|
194
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ a.createElement(
|
|
195
192
|
"input",
|
|
196
193
|
{
|
|
197
|
-
ref: (n) =>
|
|
194
|
+
ref: (n) => o.current = n,
|
|
198
195
|
role: t.ariaRole || "textbox",
|
|
199
196
|
readOnly: t.readonly,
|
|
200
197
|
tabIndex: t.tabIndex || 0,
|
|
201
|
-
disabled:
|
|
202
|
-
title: t.title !== void 0 ? t.title :
|
|
198
|
+
disabled: E,
|
|
199
|
+
title: t.title !== void 0 ? t.title : U,
|
|
203
200
|
type: "text",
|
|
204
201
|
spellCheck: !1,
|
|
205
202
|
autoComplete: "off",
|
|
206
203
|
autoCorrect: "off",
|
|
207
|
-
autoFocus:
|
|
208
|
-
className: b
|
|
209
|
-
id:
|
|
210
|
-
value:
|
|
204
|
+
autoFocus: he,
|
|
205
|
+
className: y(b.inputInner({ c: v })),
|
|
206
|
+
id: z,
|
|
207
|
+
value: U,
|
|
211
208
|
"aria-label": t.ariaLabel,
|
|
212
209
|
"aria-labelledby": t.ariaLabelledBy,
|
|
213
210
|
"aria-describedby": t.ariaDescribedBy,
|
|
214
|
-
"aria-haspopup":
|
|
215
|
-
"aria-disabled":
|
|
211
|
+
"aria-haspopup": be,
|
|
212
|
+
"aria-disabled": E,
|
|
216
213
|
"aria-expanded": t.ariaExpanded,
|
|
217
214
|
"aria-controls": t.ariaControls,
|
|
218
215
|
"aria-required": t.required,
|
|
219
|
-
"aria-invalid": !
|
|
216
|
+
"aria-invalid": !k,
|
|
220
217
|
onKeyDown: s,
|
|
221
218
|
onChange: s,
|
|
222
219
|
onWheel: s,
|
|
@@ -227,49 +224,49 @@ const rt = "Please enter a valid value!", ee = r.forwardRef((t, te) => {
|
|
|
227
224
|
}
|
|
228
225
|
),
|
|
229
226
|
t.children,
|
|
230
|
-
t.clearButton && t.value && /* @__PURE__ */
|
|
231
|
-
|
|
232
|
-
|
|
227
|
+
t.clearButton && t.value && /* @__PURE__ */ a.createElement(tt, { onClick: _, key: "clearbutton" }),
|
|
228
|
+
le && /* @__PURE__ */ a.createElement("span", { className: y(b.inputSpinner({ c: v })), onMouseDown: we }, /* @__PURE__ */ a.createElement(
|
|
229
|
+
Y,
|
|
233
230
|
{
|
|
234
231
|
tabIndex: -1,
|
|
235
232
|
type: "button",
|
|
236
233
|
rounded: null,
|
|
237
|
-
className: b
|
|
234
|
+
className: y(b.spinnerIncrease({ c: v })),
|
|
238
235
|
icon: "caret-alt-up",
|
|
239
|
-
svgIcon:
|
|
240
|
-
"aria-label":
|
|
241
|
-
title:
|
|
242
|
-
onClick:
|
|
236
|
+
svgIcon: qe,
|
|
237
|
+
"aria-label": h.toLanguageString(C, R[C]),
|
|
238
|
+
title: h.toLanguageString(C, R[C]),
|
|
239
|
+
onClick: Me
|
|
243
240
|
}
|
|
244
|
-
), /* @__PURE__ */
|
|
245
|
-
|
|
241
|
+
), /* @__PURE__ */ a.createElement(
|
|
242
|
+
Y,
|
|
246
243
|
{
|
|
247
244
|
tabIndex: -1,
|
|
248
245
|
type: "button",
|
|
249
246
|
rounded: null,
|
|
250
|
-
className: b
|
|
247
|
+
className: y(b.spinnerDecrease({ c: v })),
|
|
251
248
|
icon: "caret-alt-down",
|
|
252
|
-
svgIcon:
|
|
253
|
-
"aria-label":
|
|
254
|
-
title:
|
|
255
|
-
onClick:
|
|
249
|
+
svgIcon: Ne,
|
|
250
|
+
"aria-label": h.toLanguageString(w, R[w]),
|
|
251
|
+
title: h.toLanguageString(w, R[w]),
|
|
252
|
+
onClick: Te
|
|
256
253
|
}
|
|
257
254
|
))
|
|
258
255
|
);
|
|
259
|
-
return t.label ? /* @__PURE__ */
|
|
260
|
-
|
|
256
|
+
return t.label ? /* @__PURE__ */ a.createElement(
|
|
257
|
+
We,
|
|
261
258
|
{
|
|
262
259
|
label: t.label,
|
|
263
|
-
editorId:
|
|
264
|
-
editorValue: (
|
|
265
|
-
editorValid:
|
|
266
|
-
editorDisabled:
|
|
267
|
-
children:
|
|
260
|
+
editorId: z,
|
|
261
|
+
editorValue: (j = o.current) == null ? void 0 : j.value,
|
|
262
|
+
editorValid: k,
|
|
263
|
+
editorDisabled: E,
|
|
264
|
+
children: W,
|
|
268
265
|
style: { width: t.width }
|
|
269
266
|
}
|
|
270
|
-
) :
|
|
267
|
+
) : W;
|
|
271
268
|
});
|
|
272
|
-
|
|
269
|
+
Z.propTypes = {
|
|
273
270
|
value: e.instanceOf(Date),
|
|
274
271
|
format: e.oneOfType([
|
|
275
272
|
c(e.string),
|
|
@@ -340,20 +337,20 @@ ee.propTypes = {
|
|
|
340
337
|
autoFocus: e.bool,
|
|
341
338
|
inputAttributes: e.object
|
|
342
339
|
};
|
|
343
|
-
const
|
|
344
|
-
format:
|
|
340
|
+
const r = {
|
|
341
|
+
format: Ke,
|
|
345
342
|
size: "medium",
|
|
346
343
|
rounded: "medium",
|
|
347
344
|
fillMode: "solid",
|
|
348
|
-
formatPlaceholder:
|
|
345
|
+
formatPlaceholder: Ye,
|
|
349
346
|
spinners: !1,
|
|
350
347
|
disabled: !1,
|
|
351
|
-
max:
|
|
352
|
-
min:
|
|
353
|
-
minTime:
|
|
354
|
-
maxTime:
|
|
348
|
+
max: x(Ge),
|
|
349
|
+
min: x(Ze),
|
|
350
|
+
minTime: x($e),
|
|
351
|
+
maxTime: x(Qe),
|
|
355
352
|
validityStyles: !0,
|
|
356
|
-
validationMessage:
|
|
353
|
+
validationMessage: at,
|
|
357
354
|
placeholder: null,
|
|
358
355
|
enableMouseWheel: !0,
|
|
359
356
|
autoCorrectParts: !0,
|
|
@@ -362,10 +359,10 @@ const i = {
|
|
|
362
359
|
twoDigitYearMax: 68,
|
|
363
360
|
ariaHasPopup: "grid",
|
|
364
361
|
autoFocus: !1
|
|
365
|
-
},
|
|
366
|
-
|
|
362
|
+
}, G = Ue();
|
|
363
|
+
Z.displayName = "KendoReactDateInput";
|
|
367
364
|
export {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
365
|
+
Z as DateInput,
|
|
366
|
+
G as DateInputPropsContext,
|
|
367
|
+
r as dateInputDefaultProps
|
|
371
368
|
};
|