@progress/kendo-react-dateinputs 9.2.0-develop.4 → 9.2.0-develop.5
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/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +27 -27
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +74 -69
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +20 -19
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +60 -57
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +22 -1
- package/index.d.ts +22 -1
- package/package-metadata.mjs +1 -1
- package/package.json +7 -7
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +35 -34
|
@@ -10,15 +10,15 @@ import * as i from "react";
|
|
|
10
10
|
import e from "prop-types";
|
|
11
11
|
import { Popup as _ } from "@progress/kendo-react-popup";
|
|
12
12
|
import { cloneDate as v } from "@progress/kendo-date-math";
|
|
13
|
-
import { classNames as
|
|
13
|
+
import { classNames as w, Keys as c, validatePackage as F, canUseDOM as D, IconWrap as P, getActiveElement as z, createPropsContext as B, withIdHOC as N, withPropsContext as L, withAdaptiveModeContext as V } from "@progress/kendo-react-common";
|
|
14
14
|
import { provideLocalizationService as m, registerForLocalization as K } from "@progress/kendo-react-intl";
|
|
15
|
-
import { arrowsSwapIcon as
|
|
16
|
-
import { packageMetadata as
|
|
17
|
-
import { DateInputWithoutContext as W, DateInput as
|
|
15
|
+
import { arrowsSwapIcon as q } from "@progress/kendo-svg-icons";
|
|
16
|
+
import { packageMetadata as U } from "../package-metadata.mjs";
|
|
17
|
+
import { DateInputWithoutContext as W, DateInput as b } from "../dateinput/DateInput.mjs";
|
|
18
18
|
import { MultiViewCalendar as H } from "../calendar/components/MultiViewCalendar.mjs";
|
|
19
19
|
import { EMPTY_SELECTIONRANGE as r } from "../calendar/models/SelectionRange.mjs";
|
|
20
20
|
import { nullable as h, MAX_DATE as j, MIN_DATE as G } from "../utils.mjs";
|
|
21
|
-
import { dateRangePickerCancel as
|
|
21
|
+
import { dateRangePickerCancel as I, messages as l, dateRangePickerSet as C, start as S, end as y, separator as E, swapStartEnd as u } from "../messages/index.mjs";
|
|
22
22
|
import { Button as X } from "@progress/kendo-react-buttons";
|
|
23
23
|
import { AdaptiveMode as Y } from "../common/AdaptiveMode.mjs";
|
|
24
24
|
import { ActionSheetContent as Z } from "@progress/kendo-react-layout";
|
|
@@ -48,7 +48,7 @@ const o = class o extends i.Component {
|
|
|
48
48
|
return this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { ...s }) : /* @__PURE__ */ i.createElement(H, { ...s, ref: this.setCalendarRef });
|
|
49
49
|
}, this.renderPopup = () => {
|
|
50
50
|
const t = {
|
|
51
|
-
popupClass:
|
|
51
|
+
popupClass: w("k-calendar-container", "k-daterangepicker-popup"),
|
|
52
52
|
animate: this._element !== null,
|
|
53
53
|
anchor: this._element,
|
|
54
54
|
id: this._popupId,
|
|
@@ -72,8 +72,8 @@ const o = class o extends i.Component {
|
|
|
72
72
|
windowWidth: t,
|
|
73
73
|
footer: {
|
|
74
74
|
cancelText: this.localizationService.toLanguageString(
|
|
75
|
-
|
|
76
|
-
l[
|
|
75
|
+
I,
|
|
76
|
+
l[I]
|
|
77
77
|
),
|
|
78
78
|
onCancel: this.handleCancel,
|
|
79
79
|
applyText: this.localizationService.toLanguageString(C, l[C]),
|
|
@@ -150,7 +150,7 @@ const o = class o extends i.Component {
|
|
|
150
150
|
n.call(void 0, d);
|
|
151
151
|
}
|
|
152
152
|
this.valueDuringOnChange = void 0;
|
|
153
|
-
},
|
|
153
|
+
}, F(U), this.state = {
|
|
154
154
|
show: this.props.show || this.props.defaultShow || o.defaultProps.defaultShow,
|
|
155
155
|
value: this.props.value || this.props.defaultValue || o.defaultProps.defaultValue,
|
|
156
156
|
currentValue: r
|
|
@@ -208,7 +208,7 @@ const o = class o extends i.Component {
|
|
|
208
208
|
return this.props.max !== void 0 ? this.props.max : o.defaultProps.max;
|
|
209
209
|
}
|
|
210
210
|
get document() {
|
|
211
|
-
if (
|
|
211
|
+
if (D)
|
|
212
212
|
return this.element && this.element.ownerDocument || document;
|
|
213
213
|
}
|
|
214
214
|
get localizationService() {
|
|
@@ -218,14 +218,15 @@ const o = class o extends i.Component {
|
|
|
218
218
|
* The mobile mode of the DateRangePicker.
|
|
219
219
|
*/
|
|
220
220
|
get mobileMode() {
|
|
221
|
-
|
|
221
|
+
var t;
|
|
222
|
+
return !!(this.state.windowWidth && this.props._adaptiveMode && this.state.windowWidth <= ((t = this.props._adaptiveMode) == null ? void 0 : t.medium) && this.props.adaptive);
|
|
222
223
|
}
|
|
223
224
|
/**
|
|
224
225
|
* @hidden
|
|
225
226
|
*/
|
|
226
227
|
componentDidMount() {
|
|
227
228
|
var a;
|
|
228
|
-
this.observerResize =
|
|
229
|
+
this.observerResize = D && 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);
|
|
229
230
|
}
|
|
230
231
|
/**
|
|
231
232
|
* @hidden
|
|
@@ -244,13 +245,13 @@ const o = class o extends i.Component {
|
|
|
244
245
|
* @hidden
|
|
245
246
|
*/
|
|
246
247
|
render() {
|
|
247
|
-
const { autoFocus: a, inputAttributes: t } = this.props, s = this.value || r, n = this.mobileMode && this.show ? this.state.currentValue : s, d = (this.props.startDateInputSettings || {}).id || this._startInputId, x = (this.props.endDateInputSettings || {}).id || this._endInputId, R =
|
|
248
|
+
const { autoFocus: a, inputAttributes: t } = this.props, s = this.value || r, n = this.mobileMode && this.show ? this.state.currentValue : s, d = (this.props.startDateInputSettings || {}).id || this._startInputId, x = (this.props.endDateInputSettings || {}).id || this._endInputId, R = w(
|
|
248
249
|
"k-daterangepicker",
|
|
249
250
|
{
|
|
250
251
|
"k-disabled": this.props.disabled
|
|
251
252
|
},
|
|
252
253
|
this.props.className
|
|
253
|
-
), O = this.localizationService.toLanguageString(S, l[S]), k = this.localizationService.toLanguageString(
|
|
254
|
+
), O = this.localizationService.toLanguageString(S, l[S]), k = this.localizationService.toLanguageString(y, l[y]), M = this.localizationService.toLanguageString(E, l[E]), f = {
|
|
254
255
|
disableSelection: this.mobileMode && !0,
|
|
255
256
|
label: O,
|
|
256
257
|
format: this.props.format,
|
|
@@ -297,7 +298,7 @@ const o = class o extends i.Component {
|
|
|
297
298
|
l[u]
|
|
298
299
|
)
|
|
299
300
|
},
|
|
300
|
-
/* @__PURE__ */ i.createElement(
|
|
301
|
+
/* @__PURE__ */ i.createElement(P, { style: { transform: "rotate(90deg)" }, name: "arrows-swap", icon: q })
|
|
301
302
|
);
|
|
302
303
|
return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
|
|
303
304
|
"span",
|
|
@@ -318,7 +319,7 @@ const o = class o extends i.Component {
|
|
|
318
319
|
dir: this.props.dir
|
|
319
320
|
},
|
|
320
321
|
this.props.startDateInput ? /* @__PURE__ */ i.createElement(this.props.startDateInput, { ...f }) : /* @__PURE__ */ i.createElement(
|
|
321
|
-
|
|
322
|
+
b,
|
|
322
323
|
{
|
|
323
324
|
...f,
|
|
324
325
|
autoFocus: a,
|
|
@@ -329,7 +330,7 @@ const o = class o extends i.Component {
|
|
|
329
330
|
),
|
|
330
331
|
(this.props.allowReverse || this.props.calendarSettings && this.props.calendarSettings.allowReverse) && this.props.swapButton ? A : M,
|
|
331
332
|
this.props.endDateInput ? /* @__PURE__ */ i.createElement(this.props.endDateInput, { ...g }) : /* @__PURE__ */ i.createElement(
|
|
332
|
-
|
|
333
|
+
b,
|
|
333
334
|
{
|
|
334
335
|
...g,
|
|
335
336
|
ref: this._endDateInput,
|
|
@@ -427,10 +428,10 @@ o.displayName = "DateRangePicker", o.propTypes = {
|
|
|
427
428
|
autoFocus: !1
|
|
428
429
|
};
|
|
429
430
|
let p = o;
|
|
430
|
-
const J =
|
|
431
|
+
const J = B(), Q = N(
|
|
431
432
|
L(
|
|
432
433
|
J,
|
|
433
|
-
p
|
|
434
|
+
V(p)
|
|
434
435
|
)
|
|
435
436
|
);
|
|
436
437
|
Q.displayName = "KendoReactDateRangePicker";
|
|
@@ -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 G=require("react"),e=require("prop-types"),J=require("@progress/kendo-react-popup"),T=require("@progress/kendo-date-math"),s=require("@progress/kendo-react-common"),Q=require("@progress/kendo-svg-icons"),ee=require("../dateinput/DateInput.js"),te=require("@progress/kendo-react-buttons"),ie=require("../package-metadata.js"),p=require("../utils.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),se=require("./DateTimeSelector.js"),oe=require("../timepicker/utils.js"),ae=require("../hooks/usePickerFloatingLabel.js"),ne=require("../common/AdaptiveMode.js"),re=require("@progress/kendo-react-layout");function le(h){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const i in h)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(h,i);Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>h[i]})}}return t.default=h,Object.freeze(t)}const r=le(G),a=class a extends r.Component{constructor(t){super(t),this._element=null,this._dateInput=r.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{const i=this.dateInputElement();i&&i.focus()},this.renderPicker=()=>{const{disabled:i,minTime:o,maxTime:n,format:c,calendar:d,cancelButton:u,weekNumber:v,focusedDate:f,unstyled:w}=this.props;return r.createElement(se.DateTimeSelector,{ref:b=>{this._dateTimeSelector=b},cancelButton:u,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:i,weekNumber:v,min:this.min,max:this.max,minTime:o,maxTime:n,focusedDate:f,format:c,calendar:d,mobileMode:this.mobileMode,footerActions:!this.mobileMode,unstyled:w})},this.renderAdaptivePopup=()=>{const{windowWidth:i=0}=this.state,o=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerCancel,l.messages[l.dateTimePickerCancel]),n=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerSet,l.messages[l.dateTimePickerSet]),c={expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle,windowWidth:i,footer:{cancelText:o,onCancel:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleReject(d)},applyText:n,onApply:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleAccept(d)}}};return r.createElement(ne.AdaptiveMode,{...c},r.createElement(re.ActionSheetContent,{overflowHidden:!0},this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=i=>{this.setState({value:T.cloneDate(i.value||void 0)}),this.valueDuringOnChange=i.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:o}=this.props;o&&o.call(void 0,{syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleDateIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=i=>{i.preventDefault()},this.handleKeyDown=i=>{const{altKey:o,keyCode:n}=i;if(n===s.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}o&&(n===s.Keys.up||n===s.Keys.down)&&(i.preventDefault(),i.stopPropagation(),this.shouldFocusDateInput=n===s.Keys.up,this.setShow(n===s.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),s.validatePackage(ie.packageMetadata),this.state={value:this.props.defaultValue||a.defaultProps.defaultValue,show:this.props.defaultShow||a.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(s.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get value(){const t=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return t!==null?T.cloneDate(t):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=s.ADAPTIVE_MEDIUM_BREAKPOINT&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:a.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:a.defaultProps.max}get validity(){const t=p.isInDateRange(this.value,this.min,this.max)&&oe.isInTimeRange(this.value,this.props.minTime||p.MIN_TIME,this.props.maxTime||p.MAX_TIME),i=this.props.validationMessage!==void 0,o=(!this.required||this.value!==null)&&t,n=this.props.valid!==void 0?this.props.valid:o;return{customError:i,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:n,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:a.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get dateInputComp(){return this.props.dateInput||a.defaultProps.dateInput}componentDidMount(){var t;this.observerResize=s.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){const t=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),t&&!this.show&&this.shouldFocusDateInput&&t.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var t;clearTimeout(this.nextTickId),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:t=a.defaultProps.size,rounded:i=a.defaultProps.rounded,fillMode:o=a.defaultProps.fillMode,autoFocus:n=a.defaultProps.autoFocus,inputAttributes:c,disabled:d,tabIndex:u,title:v,id:f,format:w,formatPlaceholder:b,min:k,max:M,className:C,width:x,name:E,validationMessage:q,required:R,validityStyles:F,minTime:A,maxTime:z,ariaLabelledBy:B,ariaDescribedBy:N,popup:L=J.Popup,unstyled:y,autoFill:_,twoDigitYearMax:K,enableMouseWheel:V,autoCorrectParts:j,autoSwitchParts:U,autoSwitchKeys:H,allowCaretMode:W}=this.props,D=y&&y.uDateTimePicker,S=!this.validityStyles||this.validity.valid,X={id:f,ariaLabelledBy:B,ariaDescribedBy:N,format:w,formatPlaceholder:b,disabled:d,title:v,validityStyles:F,validationMessage:q,required:R,min:k,max:M,minTime:A,maxTime:z,name:E,tabIndex:this.show?-1:u,valid:this.validity.valid,value:this.value,onChange:this.handleValueChange,steps:this.props.steps,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null,unstyled:y,autoFill:_,twoDigitYearMax:K,enableMouseWheel:V,autoCorrectParts:j,autoSwitchParts:U,autoSwitchKeys:H,allowCaretMode:W},I=r.createElement(s.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:Y,onBlur:Z})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:$=>{this._element=$},className:s.classNames(s.uDateTimePicker.wrapper({c:D,size:t,fillMode:o,rounded:i,disabled:d,required:this.required,invalid:!S}),C),onKeyDown:this.handleKeyDown,style:{width:x},onFocus:this.mobileMode?void 0:Y,onBlur:Z,onClick:this.mobileMode?this.handleDateIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,ariaHasPopup:"dialog",autoFocus:n,inputAttributes:c,...X}),r.createElement(te.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:Q.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleDateIconClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:s.classNames(s.uDateTimePicker.inputButton({c:D})),rounded:null,fillMode:o,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(L,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:s.classNames(s.uDateTimePicker.popup({c:D})),id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"}},!this.mobileMode&&this.renderPicker())),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(ae.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:f,editorValid:S,editorDisabled:this.props.disabled,children:I,style:{width:this.props.width}}):I}setShow(t){const{onOpen:i,onClose:o}=this.props;this.show!==t&&(this.setState({show:t}),t&&i&&i.call(void 0,{target:this}),!t&&o&&o.call(void 0,{target:this}))}nextTick(t){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>t())}calculateMedia(t){for(const i of t)this.setState({windowWidth:i.target.clientWidth})}};a.displayName="DateTimePicker",a.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,cancelButton:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object},a.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:p.MAX_DATE,min:p.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,cancelButton:!0,dateInput:ee.DateInput,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let g=a;const P=s.createPropsContext(),O=s.withIdHOC(s.withPropsContext(P,s.withUnstyledHOC(g)));O.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=O;exports.DateTimePickerPropsContext=P;exports.DateTimePickerWithoutContext=g;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("react"),e=require("prop-types"),J=require("@progress/kendo-react-popup"),T=require("@progress/kendo-date-math"),s=require("@progress/kendo-react-common"),Q=require("@progress/kendo-svg-icons"),ee=require("../dateinput/DateInput.js"),te=require("@progress/kendo-react-buttons"),ie=require("../package-metadata.js"),p=require("../utils.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),se=require("./DateTimeSelector.js"),oe=require("../timepicker/utils.js"),ae=require("../hooks/usePickerFloatingLabel.js"),ne=require("../common/AdaptiveMode.js"),re=require("@progress/kendo-react-layout");function le(h){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(i,t,o.get?o:{enumerable:!0,get:()=>h[t]})}}return i.default=h,Object.freeze(i)}const r=le(G),a=class a extends r.Component{constructor(i){super(i),this._element=null,this._dateInput=r.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{const t=this.dateInputElement();t&&t.focus()},this.renderPicker=()=>{const{disabled:t,minTime:o,maxTime:n,format:c,calendar:d,cancelButton:u,weekNumber:v,focusedDate:f,unstyled:w}=this.props;return r.createElement(se.DateTimeSelector,{ref:b=>{this._dateTimeSelector=b},cancelButton:u,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:t,weekNumber:v,min:this.min,max:this.max,minTime:o,maxTime:n,focusedDate:f,format:c,calendar:d,mobileMode:this.mobileMode,footerActions:!this.mobileMode,unstyled:w})},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,o=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerCancel,l.messages[l.dateTimePickerCancel]),n=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerSet,l.messages[l.dateTimePickerSet]),c={expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle,windowWidth:t,footer:{cancelText:o,onCancel:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleReject(d)},applyText:n,onApply:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleAccept(d)}}};return r.createElement(ne.AdaptiveMode,{...c},r.createElement(re.ActionSheetContent,{overflowHidden:!0},this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=t=>{this.setState({value:T.cloneDate(t.value||void 0)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:o}=this.props;o&&o.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleDateIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:o,keyCode:n}=t;if(n===s.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}o&&(n===s.Keys.up||n===s.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=n===s.Keys.up,this.setShow(n===s.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),s.validatePackage(ie.packageMetadata),this.state={value:this.props.defaultValue||a.defaultProps.defaultValue,show:this.props.defaultShow||a.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(s.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?T.cloneDate(i):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get mobileMode(){var t;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((t=this.props._adaptiveMode)==null?void 0:t.medium)&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:a.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:a.defaultProps.max}get validity(){const i=p.isInDateRange(this.value,this.min,this.max)&&oe.isInTimeRange(this.value,this.props.minTime||p.MIN_TIME,this.props.maxTime||p.MAX_TIME),t=this.props.validationMessage!==void 0,o=(!this.required||this.value!==null)&&i,n=this.props.valid!==void 0?this.props.valid:o;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:n,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:a.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get dateInputComp(){return this.props.dateInput||a.defaultProps.dateInput}componentDidMount(){var i;this.observerResize=s.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){const i=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),i&&!this.show&&this.shouldFocusDateInput&&i.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=a.defaultProps.size,rounded:t=a.defaultProps.rounded,fillMode:o=a.defaultProps.fillMode,autoFocus:n=a.defaultProps.autoFocus,inputAttributes:c,disabled:d,tabIndex:u,title:v,id:f,format:w,formatPlaceholder:b,min:O,max:k,className:C,width:x,name:q,validationMessage:E,required:F,validityStyles:R,minTime:z,maxTime:A,ariaLabelledBy:B,ariaDescribedBy:N,popup:L=J.Popup,unstyled:y,autoFill:_,twoDigitYearMax:K,enableMouseWheel:j,autoCorrectParts:V,autoSwitchParts:U,autoSwitchKeys:H,allowCaretMode:W}=this.props,D=y&&y.uDateTimePicker,S=!this.validityStyles||this.validity.valid,X={id:f,ariaLabelledBy:B,ariaDescribedBy:N,format:w,formatPlaceholder:b,disabled:d,title:v,validityStyles:R,validationMessage:E,required:F,min:O,max:k,minTime:z,maxTime:A,name:q,tabIndex:this.show?-1:u,valid:this.validity.valid,value:this.value,onChange:this.handleValueChange,steps:this.props.steps,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null,unstyled:y,autoFill:_,twoDigitYearMax:K,enableMouseWheel:j,autoCorrectParts:V,autoSwitchParts:U,autoSwitchKeys:H,allowCaretMode:W},I=r.createElement(s.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:Y,onBlur:Z})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:$=>{this._element=$},className:s.classNames(s.uDateTimePicker.wrapper({c:D,size:i,fillMode:o,rounded:t,disabled:d,required:this.required,invalid:!S}),C),onKeyDown:this.handleKeyDown,style:{width:x},onFocus:this.mobileMode?void 0:Y,onBlur:Z,onClick:this.mobileMode?this.handleDateIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,ariaHasPopup:"dialog",autoFocus:n,inputAttributes:c,...X}),r.createElement(te.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:Q.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleDateIconClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:s.classNames(s.uDateTimePicker.inputButton({c:D})),rounded:null,fillMode:o,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(L,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:s.classNames(s.uDateTimePicker.popup({c:D})),id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"}},!this.mobileMode&&this.renderPicker())),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(ae.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:f,editorValid:S,editorDisabled:this.props.disabled,children:I,style:{width:this.props.width}}):I}setShow(i){const{onOpen:t,onClose:o}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&o&&o.call(void 0,{target:this}))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}calculateMedia(i){for(const t of i)this.setState({windowWidth:t.target.clientWidth})}};a.displayName="DateTimePicker",a.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,cancelButton:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object},a.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:p.MAX_DATE,min:p.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,cancelButton:!0,dateInput:ee.DateInput,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let g=a;const P=s.createPropsContext(),M=s.withIdHOC(s.withPropsContext(P,s.withUnstyledHOC(s.withAdaptiveModeContext(g))));M.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=M;exports.DateTimePickerPropsContext=P;exports.DateTimePickerWithoutContext=g;
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
import * as n from "react";
|
|
10
10
|
import e from "prop-types";
|
|
11
11
|
import { Popup as $ } from "@progress/kendo-react-popup";
|
|
12
|
-
import { cloneDate as
|
|
13
|
-
import { Keys as d, validatePackage as ee, canUseDOM as
|
|
12
|
+
import { cloneDate as M } from "@progress/kendo-date-math";
|
|
13
|
+
import { Keys as d, validatePackage as ee, canUseDOM as O, AsyncFocusBlur as te, classNames as I, uDateTimePicker as D, createPropsContext as ie, withIdHOC as se, withPropsContext as oe, withUnstyledHOC as ae, withAdaptiveModeContext as ne } from "@progress/kendo-react-common";
|
|
14
14
|
import { calendarIcon as re } from "@progress/kendo-svg-icons";
|
|
15
15
|
import { DateInput as le } from "../dateinput/DateInput.mjs";
|
|
16
16
|
import { Button as he } from "@progress/kendo-react-buttons";
|
|
17
17
|
import { packageMetadata as de } from "../package-metadata.mjs";
|
|
18
18
|
import { MAX_DATE as ue, MIN_DATE as pe, isInDateRange as ce, MAX_TIME as me, MIN_TIME as fe } from "../utils.mjs";
|
|
19
|
-
import { dateTimePickerCancel as
|
|
19
|
+
import { dateTimePickerCancel as P, messages as p, dateTimePickerSet as C, toggleDateTimeSelector as c } from "../messages/index.mjs";
|
|
20
20
|
import { provideLocalizationService as m, registerForLocalization as ge } from "@progress/kendo-react-intl";
|
|
21
21
|
import { DateTimeSelector as ve } from "./DateTimeSelector.mjs";
|
|
22
22
|
import { isInTimeRange as we } from "../timepicker/utils.mjs";
|
|
@@ -24,12 +24,12 @@ import { PickerFloatingLabel as be } from "../hooks/usePickerFloatingLabel.mjs";
|
|
|
24
24
|
import { AdaptiveMode as ye } from "../common/AdaptiveMode.mjs";
|
|
25
25
|
import { ActionSheetContent as Ie } from "@progress/kendo-react-layout";
|
|
26
26
|
const o = class o extends n.Component {
|
|
27
|
-
constructor(
|
|
28
|
-
super(
|
|
29
|
-
const
|
|
30
|
-
|
|
27
|
+
constructor(i) {
|
|
28
|
+
super(i), this._element = null, this._dateInput = n.createRef(), this._dateTimeSelector = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.focus = () => {
|
|
29
|
+
const t = this.dateInputElement();
|
|
30
|
+
t && t.focus();
|
|
31
31
|
}, this.renderPicker = () => {
|
|
32
|
-
const { disabled:
|
|
32
|
+
const { disabled: t, minTime: s, maxTime: a, format: h, calendar: l, cancelButton: r, weekNumber: g, focusedDate: u, unstyled: v } = this.props;
|
|
33
33
|
return /* @__PURE__ */ n.createElement(
|
|
34
34
|
ve,
|
|
35
35
|
{
|
|
@@ -41,7 +41,7 @@ const o = class o extends n.Component {
|
|
|
41
41
|
value: this.value,
|
|
42
42
|
onChange: this.handleValueChange,
|
|
43
43
|
onReject: this.handleReject,
|
|
44
|
-
disabled:
|
|
44
|
+
disabled: t,
|
|
45
45
|
weekNumber: g,
|
|
46
46
|
min: this.min,
|
|
47
47
|
max: this.max,
|
|
@@ -56,9 +56,9 @@ const o = class o extends n.Component {
|
|
|
56
56
|
}
|
|
57
57
|
);
|
|
58
58
|
}, this.renderAdaptivePopup = () => {
|
|
59
|
-
const { windowWidth:
|
|
60
|
-
|
|
61
|
-
p[
|
|
59
|
+
const { windowWidth: t = 0 } = this.state, s = m(this).toLanguageString(
|
|
60
|
+
P,
|
|
61
|
+
p[P]
|
|
62
62
|
), a = m(this).toLanguageString(
|
|
63
63
|
C,
|
|
64
64
|
p[C]
|
|
@@ -66,7 +66,7 @@ const o = class o extends n.Component {
|
|
|
66
66
|
expand: this.show,
|
|
67
67
|
onClose: this.handleBlur,
|
|
68
68
|
title: this.props.adaptiveTitle,
|
|
69
|
-
windowWidth:
|
|
69
|
+
windowWidth: t,
|
|
70
70
|
footer: {
|
|
71
71
|
cancelText: s,
|
|
72
72
|
onCancel: (l) => {
|
|
@@ -83,14 +83,14 @@ const o = class o extends n.Component {
|
|
|
83
83
|
return /* @__PURE__ */ n.createElement(ye, { ...h }, /* @__PURE__ */ n.createElement(Ie, { overflowHidden: !0 }, this.renderPicker()));
|
|
84
84
|
}, this.handleReject = () => {
|
|
85
85
|
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
86
|
-
}, this.handleValueChange = (
|
|
86
|
+
}, this.handleValueChange = (t) => {
|
|
87
87
|
this.setState({
|
|
88
|
-
value:
|
|
89
|
-
}), this.valueDuringOnChange =
|
|
88
|
+
value: M(t.value || void 0)
|
|
89
|
+
}), this.valueDuringOnChange = t.value, this.showDuringOnChange = !1, this.mobileMode || (this.shouldFocusDateInput = !0);
|
|
90
90
|
const { onChange: s } = this.props;
|
|
91
91
|
s && s.call(void 0, {
|
|
92
|
-
syntheticEvent:
|
|
93
|
-
nativeEvent:
|
|
92
|
+
syntheticEvent: t.syntheticEvent,
|
|
93
|
+
nativeEvent: t.nativeEvent,
|
|
94
94
|
value: this.value,
|
|
95
95
|
show: this.show,
|
|
96
96
|
target: this
|
|
@@ -101,15 +101,15 @@ const o = class o extends n.Component {
|
|
|
101
101
|
this.setState({ focused: !1 }), this.setShow(!1);
|
|
102
102
|
}, this.handleDateIconClick = () => {
|
|
103
103
|
this.props.disabled || (this.shouldFocusDateInput = !0, this.setShow(!this.show));
|
|
104
|
-
}, this.handleIconMouseDown = (
|
|
105
|
-
|
|
106
|
-
}, this.handleKeyDown = (
|
|
107
|
-
const { altKey: s, keyCode: a } =
|
|
104
|
+
}, this.handleIconMouseDown = (t) => {
|
|
105
|
+
t.preventDefault();
|
|
106
|
+
}, this.handleKeyDown = (t) => {
|
|
107
|
+
const { altKey: s, keyCode: a } = t;
|
|
108
108
|
if (a === d.esc) {
|
|
109
109
|
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
s && (a === d.up || a === d.down) && (
|
|
112
|
+
s && (a === d.up || a === d.down) && (t.preventDefault(), t.stopPropagation(), this.shouldFocusDateInput = a === d.up, this.setShow(a === d.down));
|
|
113
113
|
}, this.dateInputElement = () => this.dateInput && this.dateInput.element || this.element && this.element.querySelector(".k-dateinput > input.k-input-inner"), ee(de), this.state = {
|
|
114
114
|
value: this.props.defaultValue || o.defaultProps.defaultValue,
|
|
115
115
|
show: this.props.defaultShow || o.defaultProps.defaultShow,
|
|
@@ -120,7 +120,7 @@ const o = class o extends n.Component {
|
|
|
120
120
|
return this.props.id + "-popup-id";
|
|
121
121
|
}
|
|
122
122
|
get document() {
|
|
123
|
-
if (
|
|
123
|
+
if (O)
|
|
124
124
|
return this.element && this.element.ownerDocument || document;
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
@@ -139,8 +139,8 @@ const o = class o extends n.Component {
|
|
|
139
139
|
* Gets the value of the DateTimePicker.
|
|
140
140
|
*/
|
|
141
141
|
get value() {
|
|
142
|
-
const
|
|
143
|
-
return
|
|
142
|
+
const i = this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value;
|
|
143
|
+
return i !== null ? M(i) : null;
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
146
|
* Gets the popup state of the DateTimePicker.
|
|
@@ -155,10 +155,11 @@ const o = class o extends n.Component {
|
|
|
155
155
|
return this.props.name;
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
|
-
* The mobile mode of the
|
|
158
|
+
* The mobile mode of the DateTimePicker.
|
|
159
159
|
*/
|
|
160
160
|
get mobileMode() {
|
|
161
|
-
|
|
161
|
+
var t;
|
|
162
|
+
return !!(this.state.windowWidth && this.props._adaptiveMode && this.state.windowWidth <= ((t = this.props._adaptiveMode) == null ? void 0 : t.medium) && this.props.adaptive);
|
|
162
163
|
}
|
|
163
164
|
get min() {
|
|
164
165
|
return this.props.min !== void 0 ? this.props.min : o.defaultProps.min;
|
|
@@ -170,9 +171,9 @@ const o = class o extends n.Component {
|
|
|
170
171
|
* Represents the validity state into which the DateTimePicker is set.
|
|
171
172
|
*/
|
|
172
173
|
get validity() {
|
|
173
|
-
const
|
|
174
|
+
const i = ce(this.value, this.min, this.max) && we(this.value, this.props.minTime || fe, this.props.maxTime || me), t = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && i, a = this.props.valid !== void 0 ? this.props.valid : s;
|
|
174
175
|
return {
|
|
175
|
-
customError:
|
|
176
|
+
customError: t,
|
|
176
177
|
rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
|
|
177
178
|
rangeUnderflow: this.value && this.value.getTime() < this.min.getTime() || !1,
|
|
178
179
|
valid: a,
|
|
@@ -201,30 +202,30 @@ const o = class o extends n.Component {
|
|
|
201
202
|
* @hidden
|
|
202
203
|
*/
|
|
203
204
|
componentDidMount() {
|
|
204
|
-
var
|
|
205
|
-
this.observerResize =
|
|
205
|
+
var i;
|
|
206
|
+
this.observerResize = O && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.show && this.forceUpdate(), (i = this.document) != null && i.body && this.observerResize && this.observerResize.observe(this.document.body);
|
|
206
207
|
}
|
|
207
208
|
/**
|
|
208
209
|
* @hidden
|
|
209
210
|
*/
|
|
210
211
|
componentDidUpdate() {
|
|
211
|
-
const
|
|
212
|
-
this._dateTimeSelector && this.show && !this.prevShow && this._dateTimeSelector.focus({ preventScroll: !0 }),
|
|
212
|
+
const i = this.dateInputElement();
|
|
213
|
+
this._dateTimeSelector && this.show && !this.prevShow && this._dateTimeSelector.focus({ preventScroll: !0 }), i && !this.show && this.shouldFocusDateInput && i.focus({ preventScroll: !0 }), this.prevShow = this.show, this.shouldFocusDateInput = !1;
|
|
213
214
|
}
|
|
214
215
|
/**
|
|
215
216
|
* @hidden
|
|
216
217
|
*/
|
|
217
218
|
componentWillUnmount() {
|
|
218
|
-
var
|
|
219
|
-
clearTimeout(this.nextTickId), (
|
|
219
|
+
var i;
|
|
220
|
+
clearTimeout(this.nextTickId), (i = this.document) != null && i.body && this.observerResize && this.observerResize.disconnect();
|
|
220
221
|
}
|
|
221
222
|
/**
|
|
222
223
|
* @hidden
|
|
223
224
|
*/
|
|
224
225
|
render() {
|
|
225
226
|
const {
|
|
226
|
-
size:
|
|
227
|
-
rounded:
|
|
227
|
+
size: i = o.defaultProps.size,
|
|
228
|
+
rounded: t = o.defaultProps.rounded,
|
|
228
229
|
fillMode: s = o.defaultProps.fillMode,
|
|
229
230
|
autoFocus: a = o.defaultProps.autoFocus,
|
|
230
231
|
inputAttributes: h,
|
|
@@ -240,8 +241,8 @@ const o = class o extends n.Component {
|
|
|
240
241
|
width: F,
|
|
241
242
|
name: A,
|
|
242
243
|
validationMessage: R,
|
|
243
|
-
required:
|
|
244
|
-
validityStyles:
|
|
244
|
+
required: z,
|
|
245
|
+
validityStyles: B,
|
|
245
246
|
minTime: N,
|
|
246
247
|
maxTime: V,
|
|
247
248
|
ariaLabelledBy: _,
|
|
@@ -263,9 +264,9 @@ const o = class o extends n.Component {
|
|
|
263
264
|
formatPlaceholder: w,
|
|
264
265
|
disabled: l,
|
|
265
266
|
title: g,
|
|
266
|
-
validityStyles:
|
|
267
|
+
validityStyles: B,
|
|
267
268
|
validationMessage: R,
|
|
268
|
-
required:
|
|
269
|
+
required: z,
|
|
269
270
|
min: x,
|
|
270
271
|
max: k,
|
|
271
272
|
minTime: N,
|
|
@@ -291,7 +292,7 @@ const o = class o extends n.Component {
|
|
|
291
292
|
autoSwitchKeys: X,
|
|
292
293
|
allowCaretMode: Y
|
|
293
294
|
}, T = /* @__PURE__ */ n.createElement(
|
|
294
|
-
|
|
295
|
+
te,
|
|
295
296
|
{
|
|
296
297
|
onFocus: this.handleFocus,
|
|
297
298
|
onBlur: this.handleBlur,
|
|
@@ -307,9 +308,9 @@ const o = class o extends n.Component {
|
|
|
307
308
|
className: I(
|
|
308
309
|
D.wrapper({
|
|
309
310
|
c: y,
|
|
310
|
-
size:
|
|
311
|
+
size: i,
|
|
311
312
|
fillMode: s,
|
|
312
|
-
rounded:
|
|
313
|
+
rounded: t,
|
|
313
314
|
disabled: l,
|
|
314
315
|
required: this.required,
|
|
315
316
|
invalid: !S
|
|
@@ -390,20 +391,20 @@ const o = class o extends n.Component {
|
|
|
390
391
|
}
|
|
391
392
|
) : T;
|
|
392
393
|
}
|
|
393
|
-
setShow(
|
|
394
|
-
const { onOpen:
|
|
395
|
-
this.show !==
|
|
394
|
+
setShow(i) {
|
|
395
|
+
const { onOpen: t, onClose: s } = this.props;
|
|
396
|
+
this.show !== i && (this.setState({ show: i }), i && t && t.call(void 0, {
|
|
396
397
|
target: this
|
|
397
|
-
}), !
|
|
398
|
+
}), !i && s && s.call(void 0, {
|
|
398
399
|
target: this
|
|
399
400
|
}));
|
|
400
401
|
}
|
|
401
|
-
nextTick(
|
|
402
|
-
clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() =>
|
|
402
|
+
nextTick(i) {
|
|
403
|
+
clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => i());
|
|
403
404
|
}
|
|
404
|
-
calculateMedia(
|
|
405
|
-
for (const
|
|
406
|
-
this.setState({ windowWidth:
|
|
405
|
+
calculateMedia(i) {
|
|
406
|
+
for (const t of i)
|
|
407
|
+
this.setState({ windowWidth: t.target.clientWidth });
|
|
407
408
|
}
|
|
408
409
|
};
|
|
409
410
|
o.displayName = "DateTimePicker", o.propTypes = {
|
|
@@ -495,10 +496,12 @@ o.displayName = "DateTimePicker", o.propTypes = {
|
|
|
495
496
|
autoFocus: !1
|
|
496
497
|
};
|
|
497
498
|
let f = o;
|
|
498
|
-
const De =
|
|
499
|
-
|
|
499
|
+
const De = ie(), Se = se(
|
|
500
|
+
oe(
|
|
500
501
|
De,
|
|
501
|
-
|
|
502
|
+
ae(
|
|
503
|
+
ne(f)
|
|
504
|
+
)
|
|
502
505
|
)
|
|
503
506
|
);
|
|
504
507
|
Se.displayName = "KendoReactDateTimePicker";
|