@progress/kendo-react-dateinputs 8.3.0-develop.10 → 8.3.0-develop.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calendar/components/Navigation.js +1 -1
- package/calendar/components/Navigation.mjs +14 -14
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +27 -25
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +63 -51
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +6 -7
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +24 -24
- package/datetimepicker/DateTimeSelector.mjs +47 -60
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +0 -4
- package/index.d.ts +0 -4
- package/package-metadata.mjs +1 -1
- package/package.json +7 -7
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +25 -26
- package/utils.js +1 -1
- package/utils.mjs +24 -31
|
@@ -206,7 +206,7 @@ const o = class o extends n.Component {
|
|
|
206
206
|
* @hidden
|
|
207
207
|
*/
|
|
208
208
|
get required() {
|
|
209
|
-
return this.props.required !== void 0 ? this.props.required :
|
|
209
|
+
return this.props.required !== void 0 ? this.props.required : !1;
|
|
210
210
|
}
|
|
211
211
|
/**
|
|
212
212
|
* @hidden
|
|
@@ -279,7 +279,7 @@ const o = class o extends n.Component {
|
|
|
279
279
|
touched: Be,
|
|
280
280
|
modified: Fe,
|
|
281
281
|
...I
|
|
282
|
-
} = this.props, A = this.value, C = !this.validityStyles || this.validity.valid,
|
|
282
|
+
} = this.props, A = this.value, C = !this.validityStyles || this.validity.valid, L = {
|
|
283
283
|
disabled: a,
|
|
284
284
|
format: f,
|
|
285
285
|
formatPlaceholder: g,
|
|
@@ -316,8 +316,8 @@ const o = class o extends n.Component {
|
|
|
316
316
|
"span",
|
|
317
317
|
{
|
|
318
318
|
...y ? {} : I,
|
|
319
|
-
ref: (
|
|
320
|
-
this._element =
|
|
319
|
+
ref: (q) => {
|
|
320
|
+
this._element = q;
|
|
321
321
|
},
|
|
322
322
|
className: k(
|
|
323
323
|
"k-input",
|
|
@@ -347,7 +347,7 @@ const o = class o extends n.Component {
|
|
|
347
347
|
ariaExpanded: this.show,
|
|
348
348
|
ariaControls: this._popupId,
|
|
349
349
|
autoFocus: R,
|
|
350
|
-
...
|
|
350
|
+
...L
|
|
351
351
|
}
|
|
352
352
|
),
|
|
353
353
|
/* @__PURE__ */ n.createElement(
|
|
@@ -397,7 +397,7 @@ const o = class o extends n.Component {
|
|
|
397
397
|
clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => i());
|
|
398
398
|
}
|
|
399
399
|
calculateMedia(i) {
|
|
400
|
-
for (
|
|
400
|
+
for (const t of i)
|
|
401
401
|
this.setState({ windowWidth: t.target.clientWidth });
|
|
402
402
|
}
|
|
403
403
|
};
|
|
@@ -481,7 +481,6 @@ o.displayName = "DatePicker", o.propTypes = {
|
|
|
481
481
|
popupSettings: {},
|
|
482
482
|
tabIndex: 0,
|
|
483
483
|
weekNumber: !1,
|
|
484
|
-
required: !1,
|
|
485
484
|
validityStyles: !0,
|
|
486
485
|
size: "medium",
|
|
487
486
|
rounded: "medium",
|
|
@@ -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 j=require("react"),e=require("prop-types"),U=require("@progress/kendo-react-popup"),I=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),H=require("@progress/kendo-svg-icons"),W=require("../dateinput/DateInput.js"),X=require("@progress/kendo-react-buttons"),Z=require("../package-metadata.js"),p=require("../utils.js"),$=require("../common/constants.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),G=require("./DateTimeSelector.js"),J=require("../timepicker/utils.js"),Q=require("../hooks/usePickerFloatingLabel.js"),Y=require("../common/AdaptiveMode.js"),ee=require("@progress/kendo-react-layout");function te(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const i in c)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(c,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>c[i]})}}return t.default=c,Object.freeze(t)}const r=te(j),n=class n 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:s,maxTime:a,format:h,calendar:d,cancelButton:u,weekNumber:f,focusedDate:v}=this.props;return r.createElement(G.DateTimeSelector,{ref:w=>{this._dateTimeSelector=w},cancelButton:u,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:i,weekNumber:f,min:this.min,max:this.max,minTime:s,maxTime:a,focusedDate:v,format:h,calendar:d,mobileMode:this.mobileMode,footerActions:!this.mobileMode})},this.renderAdaptivePopup=()=>{const{windowWidth:i=0}=this.state,s=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerCancel,l.messages[l.dateTimePickerCancel]),a=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerSet,l.messages[l.dateTimePickerSet]),h={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:i,footer:{cancelText:s,onCancel:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleReject(d)},applyText:a,onApply:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleAccept(d)}}};return r.createElement(Y.AdaptiveMode,{...h},r.createElement(ee.ActionSheetContent,{overflowHidden:!0},this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=i=>{this.setState({value:I.cloneDate(i.value||void 0)}),this.valueDuringOnChange=i.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.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:s,keyCode:a}=i;if(a===o.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(a===o.Keys.up||a===o.Keys.down)&&(i.preventDefault(),i.stopPropagation(),this.shouldFocusDateInput=a===o.Keys.up,this.setShow(a===o.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),o.validatePackage(Z.packageMetadata),this.state={value:this.props.defaultValue||n.defaultProps.defaultValue,show:this.props.defaultShow||n.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(o.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?I.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<=$.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:n.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:n.defaultProps.max}get validity(){const t=p.isInDateRange(this.value,this.min,this.max)&&J.isInTimeRange(this.value,this.props.minTime||p.MIN_TIME,this.props.maxTime||p.MAX_TIME),i=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&t,a=this.props.valid!==void 0?this.props.valid:s;return{customError:i,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:a,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:n.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:n.defaultProps.required}get dateInputComp(){return this.props.dateInput||n.defaultProps.dateInput}componentDidMount(){var t;this.observerResize=o.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=n.defaultProps.size,rounded:i=n.defaultProps.rounded,fillMode:s=n.defaultProps.fillMode,autoFocus:a=n.defaultProps.autoFocus,disabled:h,tabIndex:d,title:u,id:f,format:v,formatPlaceholder:w,min:O,max:k,className:M,width:C,name:x,validationMessage:q,required:E,validityStyles:R,minTime:F,maxTime:z,ariaLabelledBy:B,ariaDescribedBy:A,popup:N=U.Popup,unstyled:y}=this.props,b=y&&y.uDateTimePicker,D=!this.validityStyles||this.validity.valid,L={id:f,ariaLabelledBy:B,ariaDescribedBy:A,format:v,formatPlaceholder:w,disabled:h,title:u,validityStyles:R,validationMessage:q,required:E,min:O,max:k,minTime:F,maxTime:z,name:x,tabIndex:this.show?-1:d,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},S=r.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:_,onBlur:V})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:K=>{this._element=K},className:o.classNames(o.uDateTimePicker.wrapper({c:b,size:t,fillMode:s,rounded:i,disabled:h,required:this.required,invalid:!D}),M),onKeyDown:this.handleKeyDown,style:{width:C},onFocus:this.mobileMode?void 0:_,onBlur:V,onClick:this.mobileMode?this.handleDateIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode,autoFocus:a,...L}),r.createElement(X.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:H.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleDateIconClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:o.classNames(o.uDateTimePicker.inputButton({c:b})),rounded:null,fillMode:s,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(N,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:o.classNames(o.uDateTimePicker.popup({c:b})),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(Q.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:f,editorValid:D,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}setShow(t){const{onOpen:i,onClose:s}=this.props;this.show!==t&&(this.setState({show:t}),t&&i&&i.call(void 0,{target:this}),!t&&s&&s.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})}};n.displayName="DateTimePicker",n.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},n.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:p.MAX_DATE,min:p.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,cancelButton:!0,dateInput:W.DateInput,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let g=n;const T=o.createPropsContext(),P=o.withIdHOC(o.withPropsContext(T,o.withUnstyledHOC(g)));P.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=P;exports.DateTimePickerPropsContext=T;exports.DateTimePickerWithoutContext=g;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react"),e=require("prop-types"),U=require("@progress/kendo-react-popup"),I=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),H=require("@progress/kendo-svg-icons"),W=require("../dateinput/DateInput.js"),X=require("@progress/kendo-react-buttons"),Z=require("../package-metadata.js"),p=require("../utils.js"),$=require("../common/constants.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),G=require("./DateTimeSelector.js"),J=require("../timepicker/utils.js"),Q=require("../hooks/usePickerFloatingLabel.js"),Y=require("../common/AdaptiveMode.js"),ee=require("@progress/kendo-react-layout");function te(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const i in c)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(c,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>c[i]})}}return t.default=c,Object.freeze(t)}const r=te(j),n=class n 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:s,maxTime:a,format:h,calendar:d,cancelButton:u,weekNumber:f,focusedDate:v}=this.props;return r.createElement(G.DateTimeSelector,{ref:w=>{this._dateTimeSelector=w},cancelButton:u,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:i,weekNumber:f,min:this.min,max:this.max,minTime:s,maxTime:a,focusedDate:v,format:h,calendar:d,mobileMode:this.mobileMode,footerActions:!this.mobileMode})},this.renderAdaptivePopup=()=>{const{windowWidth:i=0}=this.state,s=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerCancel,l.messages[l.dateTimePickerCancel]),a=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerSet,l.messages[l.dateTimePickerSet]),h={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:i,footer:{cancelText:s,onCancel:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleReject(d)},applyText:a,onApply:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleAccept(d)}}};return r.createElement(Y.AdaptiveMode,{...h},r.createElement(ee.ActionSheetContent,{overflowHidden:!0},this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=i=>{this.setState({value:I.cloneDate(i.value||void 0)}),this.valueDuringOnChange=i.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.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:s,keyCode:a}=i;if(a===o.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(a===o.Keys.up||a===o.Keys.down)&&(i.preventDefault(),i.stopPropagation(),this.shouldFocusDateInput=a===o.Keys.up,this.setShow(a===o.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),o.validatePackage(Z.packageMetadata),this.state={value:this.props.defaultValue||n.defaultProps.defaultValue,show:this.props.defaultShow||n.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(o.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?I.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<=$.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:n.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:n.defaultProps.max}get validity(){const t=p.isInDateRange(this.value,this.min,this.max)&&J.isInTimeRange(this.value,this.props.minTime||p.MIN_TIME,this.props.maxTime||p.MAX_TIME),i=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&t,a=this.props.valid!==void 0?this.props.valid:s;return{customError:i,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:a,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:n.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get dateInputComp(){return this.props.dateInput||n.defaultProps.dateInput}componentDidMount(){var t;this.observerResize=o.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=n.defaultProps.size,rounded:i=n.defaultProps.rounded,fillMode:s=n.defaultProps.fillMode,autoFocus:a=n.defaultProps.autoFocus,disabled:h,tabIndex:d,title:u,id:f,format:v,formatPlaceholder:w,min:O,max:k,className:M,width:C,name:x,validationMessage:E,required:q,validityStyles:R,minTime:F,maxTime:z,ariaLabelledBy:B,ariaDescribedBy:A,popup:N=U.Popup,unstyled:y}=this.props,b=y&&y.uDateTimePicker,D=!this.validityStyles||this.validity.valid,L={id:f,ariaLabelledBy:B,ariaDescribedBy:A,format:v,formatPlaceholder:w,disabled:h,title:u,validityStyles:R,validationMessage:E,required:q,min:O,max:k,minTime:F,maxTime:z,name:x,tabIndex:this.show?-1:d,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},S=r.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:_,onBlur:V})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:K=>{this._element=K},className:o.classNames(o.uDateTimePicker.wrapper({c:b,size:t,fillMode:s,rounded:i,disabled:h,required:this.required,invalid:!D}),M),onKeyDown:this.handleKeyDown,style:{width:C},onFocus:this.mobileMode?void 0:_,onBlur:V,onClick:this.mobileMode?this.handleDateIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,ariaHasPopup:"dialog",readonly:this.mobileMode,autoFocus:a,...L}),r.createElement(X.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:H.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleDateIconClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:o.classNames(o.uDateTimePicker.inputButton({c:b})),rounded:null,fillMode:s,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(N,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:o.classNames(o.uDateTimePicker.popup({c:b})),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(Q.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:f,editorValid:D,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}setShow(t){const{onOpen:i,onClose:s}=this.props;this.show!==t&&(this.setState({show:t}),t&&i&&i.call(void 0,{target:this}),!t&&s&&s.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})}};n.displayName="DateTimePicker",n.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},n.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:W.DateInput,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let g=n;const T=o.createPropsContext(),P=o.withIdHOC(o.withPropsContext(T,o.withUnstyledHOC(g)));P.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=P;exports.DateTimePickerPropsContext=T;exports.DateTimePickerWithoutContext=g;
|
|
@@ -10,7 +10,7 @@ import * as a from "react";
|
|
|
10
10
|
import e from "prop-types";
|
|
11
11
|
import { Popup as H } from "@progress/kendo-react-popup";
|
|
12
12
|
import { cloneDate as T } from "@progress/kendo-date-math";
|
|
13
|
-
import { Keys as
|
|
13
|
+
import { Keys as d, validatePackage as W, canUseDOM as O, AsyncFocusBlur as X, classNames as b, uDateTimePicker as y, createPropsContext as Z, withIdHOC as G, withPropsContext as J, withUnstyledHOC as Q } from "@progress/kendo-react-common";
|
|
14
14
|
import { calendarIcon as Y } from "@progress/kendo-svg-icons";
|
|
15
15
|
import { DateInput as $ } from "../dateinput/DateInput.mjs";
|
|
16
16
|
import { Button as ee } from "@progress/kendo-react-buttons";
|
|
@@ -19,8 +19,8 @@ import { MAX_DATE as ie, MIN_DATE as se, isInDateRange as oe, MAX_TIME as ne, MI
|
|
|
19
19
|
import { MOBILE_MEDIUM_DEVISE as re } from "../common/constants.mjs";
|
|
20
20
|
import { dateTimePickerCancel as M, messages as p, dateTimePickerSet as P, toggleDateTimeSelector as c } from "../messages/index.mjs";
|
|
21
21
|
import { provideLocalizationService as m, registerForLocalization as le } from "@progress/kendo-react-intl";
|
|
22
|
-
import { DateTimeSelector as
|
|
23
|
-
import { isInTimeRange as
|
|
22
|
+
import { DateTimeSelector as he } from "./DateTimeSelector.mjs";
|
|
23
|
+
import { isInTimeRange as de } from "../timepicker/utils.mjs";
|
|
24
24
|
import { PickerFloatingLabel as ue } from "../hooks/usePickerFloatingLabel.mjs";
|
|
25
25
|
import { AdaptiveMode as pe } from "../common/AdaptiveMode.mjs";
|
|
26
26
|
import { ActionSheetContent as ce } from "@progress/kendo-react-layout";
|
|
@@ -34,14 +34,14 @@ const o = class o extends a.Component {
|
|
|
34
34
|
disabled: i,
|
|
35
35
|
minTime: s,
|
|
36
36
|
maxTime: n,
|
|
37
|
-
format:
|
|
37
|
+
format: h,
|
|
38
38
|
calendar: l,
|
|
39
39
|
cancelButton: r,
|
|
40
40
|
weekNumber: u,
|
|
41
41
|
focusedDate: g
|
|
42
42
|
} = this.props;
|
|
43
43
|
return /* @__PURE__ */ a.createElement(
|
|
44
|
-
|
|
44
|
+
he,
|
|
45
45
|
{
|
|
46
46
|
ref: (v) => {
|
|
47
47
|
this._dateTimeSelector = v;
|
|
@@ -58,14 +58,14 @@ const o = class o extends a.Component {
|
|
|
58
58
|
minTime: s,
|
|
59
59
|
maxTime: n,
|
|
60
60
|
focusedDate: g,
|
|
61
|
-
format:
|
|
61
|
+
format: h,
|
|
62
62
|
calendar: l,
|
|
63
63
|
mobileMode: this.mobileMode,
|
|
64
64
|
footerActions: !this.mobileMode
|
|
65
65
|
}
|
|
66
66
|
);
|
|
67
67
|
}, this.renderAdaptivePopup = () => {
|
|
68
|
-
const { windowWidth: i = 0 } = this.state, s = m(this).toLanguageString(M, p[M]), n = m(this).toLanguageString(P, p[P]),
|
|
68
|
+
const { windowWidth: i = 0 } = this.state, s = m(this).toLanguageString(M, p[M]), n = m(this).toLanguageString(P, p[P]), h = {
|
|
69
69
|
expand: this.show,
|
|
70
70
|
onClose: this.handleBlur,
|
|
71
71
|
adaptiveTitle: this.props.adaptiveTitle,
|
|
@@ -83,7 +83,7 @@ const o = class o extends a.Component {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
return /* @__PURE__ */ a.createElement(pe, { ...
|
|
86
|
+
return /* @__PURE__ */ a.createElement(pe, { ...h }, /* @__PURE__ */ a.createElement(ce, { overflowHidden: !0 }, this.renderPicker()));
|
|
87
87
|
}, this.handleReject = () => {
|
|
88
88
|
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
89
89
|
}, this.handleValueChange = (i) => {
|
|
@@ -108,11 +108,11 @@ const o = class o extends a.Component {
|
|
|
108
108
|
i.preventDefault();
|
|
109
109
|
}, this.handleKeyDown = (i) => {
|
|
110
110
|
const { altKey: s, keyCode: n } = i;
|
|
111
|
-
if (n ===
|
|
111
|
+
if (n === d.esc) {
|
|
112
112
|
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
s && (n ===
|
|
115
|
+
s && (n === d.up || n === d.down) && (i.preventDefault(), i.stopPropagation(), this.shouldFocusDateInput = n === d.up, this.setShow(n === d.down));
|
|
116
116
|
}, this.dateInputElement = () => this.dateInput && this.dateInput.element || this.element && this.element.querySelector(".k-dateinput > input.k-input-inner"), W(te), this.state = {
|
|
117
117
|
value: this.props.defaultValue || o.defaultProps.defaultValue,
|
|
118
118
|
show: this.props.defaultShow || o.defaultProps.defaultShow,
|
|
@@ -173,7 +173,7 @@ const o = class o extends a.Component {
|
|
|
173
173
|
* Represents the validity state into which the DateTimePicker is set.
|
|
174
174
|
*/
|
|
175
175
|
get validity() {
|
|
176
|
-
const t = oe(this.value, this.min, this.max) &&
|
|
176
|
+
const t = oe(this.value, this.min, this.max) && de(this.value, this.props.minTime || ae, this.props.maxTime || ne), i = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && t, n = this.props.valid !== void 0 ? this.props.valid : s;
|
|
177
177
|
return {
|
|
178
178
|
customError: i,
|
|
179
179
|
rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
|
|
@@ -192,7 +192,7 @@ const o = class o extends a.Component {
|
|
|
192
192
|
* @hidden
|
|
193
193
|
*/
|
|
194
194
|
get required() {
|
|
195
|
-
return this.props.required !== void 0 ? this.props.required :
|
|
195
|
+
return this.props.required !== void 0 ? this.props.required : !1;
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
198
|
* @hidden
|
|
@@ -230,7 +230,7 @@ const o = class o extends a.Component {
|
|
|
230
230
|
rounded: i = o.defaultProps.rounded,
|
|
231
231
|
fillMode: s = o.defaultProps.fillMode,
|
|
232
232
|
autoFocus: n = o.defaultProps.autoFocus,
|
|
233
|
-
disabled:
|
|
233
|
+
disabled: h,
|
|
234
234
|
tabIndex: l,
|
|
235
235
|
title: r,
|
|
236
236
|
id: u,
|
|
@@ -246,17 +246,17 @@ const o = class o extends a.Component {
|
|
|
246
246
|
validityStyles: z,
|
|
247
247
|
minTime: A,
|
|
248
248
|
maxTime: N,
|
|
249
|
-
ariaLabelledBy:
|
|
250
|
-
ariaDescribedBy:
|
|
251
|
-
popup:
|
|
249
|
+
ariaLabelledBy: V,
|
|
250
|
+
ariaDescribedBy: L,
|
|
251
|
+
popup: _ = H,
|
|
252
252
|
unstyled: I
|
|
253
|
-
} = this.props, w = I && I.uDateTimePicker, D = !this.validityStyles || this.validity.valid,
|
|
253
|
+
} = this.props, w = I && I.uDateTimePicker, D = !this.validityStyles || this.validity.valid, q = {
|
|
254
254
|
id: u,
|
|
255
|
-
ariaLabelledBy:
|
|
256
|
-
ariaDescribedBy:
|
|
255
|
+
ariaLabelledBy: V,
|
|
256
|
+
ariaDescribedBy: L,
|
|
257
257
|
format: g,
|
|
258
258
|
formatPlaceholder: v,
|
|
259
|
-
disabled:
|
|
259
|
+
disabled: h,
|
|
260
260
|
title: r,
|
|
261
261
|
validityStyles: z,
|
|
262
262
|
validationMessage: R,
|
|
@@ -297,7 +297,7 @@ const o = class o extends a.Component {
|
|
|
297
297
|
size: t,
|
|
298
298
|
fillMode: s,
|
|
299
299
|
rounded: i,
|
|
300
|
-
disabled:
|
|
300
|
+
disabled: h,
|
|
301
301
|
required: this.required,
|
|
302
302
|
invalid: !D
|
|
303
303
|
}),
|
|
@@ -315,9 +315,10 @@ const o = class o extends a.Component {
|
|
|
315
315
|
_ref: this._dateInput,
|
|
316
316
|
ariaRole: "combobox",
|
|
317
317
|
ariaControls: this._popupId,
|
|
318
|
+
ariaHasPopup: "dialog",
|
|
318
319
|
readonly: this.mobileMode,
|
|
319
320
|
autoFocus: n,
|
|
320
|
-
...
|
|
321
|
+
...q
|
|
321
322
|
}
|
|
322
323
|
),
|
|
323
324
|
/* @__PURE__ */ a.createElement(
|
|
@@ -337,7 +338,7 @@ const o = class o extends a.Component {
|
|
|
337
338
|
}
|
|
338
339
|
),
|
|
339
340
|
/* @__PURE__ */ a.createElement(
|
|
340
|
-
|
|
341
|
+
_,
|
|
341
342
|
{
|
|
342
343
|
show: this.show,
|
|
343
344
|
animate: this.element !== null,
|
|
@@ -460,7 +461,6 @@ o.displayName = "DateTimePicker", o.propTypes = {
|
|
|
460
461
|
popupSettings: {},
|
|
461
462
|
tabIndex: 0,
|
|
462
463
|
weekNumber: !1,
|
|
463
|
-
required: !1,
|
|
464
464
|
validityStyles: !0,
|
|
465
465
|
cancelButton: !0,
|
|
466
466
|
dateInput: $,
|
|
@@ -155,17 +155,7 @@ const y = class y extends i.Component {
|
|
|
155
155
|
}), this.shouldFocusPart = !1;
|
|
156
156
|
}
|
|
157
157
|
render() {
|
|
158
|
-
const {
|
|
159
|
-
disabled: a,
|
|
160
|
-
min: t,
|
|
161
|
-
max: e,
|
|
162
|
-
weekNumber: s,
|
|
163
|
-
focusedDate: l,
|
|
164
|
-
format: r,
|
|
165
|
-
mobileMode: n,
|
|
166
|
-
footerActions: d,
|
|
167
|
-
unstyled: v
|
|
168
|
-
} = this.props, m = v && v.uDateTimePicker, S = o(
|
|
158
|
+
const { disabled: a, min: t, max: e, weekNumber: s, focusedDate: l, format: r, mobileMode: n, footerActions: d, unstyled: v } = this.props, m = v && v.uDateTimePicker, S = o(
|
|
169
159
|
u.wrap({
|
|
170
160
|
c: m,
|
|
171
161
|
date: this.state.tab === "date",
|
|
@@ -184,36 +174,34 @@ const y = class y extends i.Component {
|
|
|
184
174
|
tabIndex: a || this.state.tab !== "date" ? -1 : void 0,
|
|
185
175
|
mobileMode: n
|
|
186
176
|
};
|
|
187
|
-
return /* @__PURE__ */ i.createElement(
|
|
177
|
+
return /* @__PURE__ */ i.createElement("div", { onKeyDown: this.handleKeyDown, className: S, tabIndex: -1 }, /* @__PURE__ */ i.createElement("div", { className: o(u.buttonGroup({ c: m })) }, /* @__PURE__ */ i.createElement(x, { width: "100%" }, /* @__PURE__ */ i.createElement(
|
|
178
|
+
f,
|
|
179
|
+
{
|
|
180
|
+
ref: (c) => this._dateButtonRef = c,
|
|
181
|
+
type: "button",
|
|
182
|
+
selected: this.state.tab === "date",
|
|
183
|
+
togglable: !0,
|
|
184
|
+
onClick: this.handleDateClick,
|
|
185
|
+
onKeyDown: this.handleDateKeyDown
|
|
186
|
+
},
|
|
187
|
+
K
|
|
188
|
+
), /* @__PURE__ */ i.createElement(
|
|
189
|
+
f,
|
|
190
|
+
{
|
|
191
|
+
type: "button",
|
|
192
|
+
selected: this.state.tab === "time",
|
|
193
|
+
togglable: !0,
|
|
194
|
+
onClick: this.handleTimeClick,
|
|
195
|
+
onKeyDown: this.handleTimeKeyDown
|
|
196
|
+
},
|
|
197
|
+
N
|
|
198
|
+
))), /* @__PURE__ */ i.createElement("div", { className: o(u.selector({ c: m })) }, /* @__PURE__ */ i.createElement(
|
|
188
199
|
"div",
|
|
189
200
|
{
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
tabIndex: -1
|
|
201
|
+
className: o(u.calendarWrap({ c: m })),
|
|
202
|
+
ref: (c) => this._calendarWrap = c
|
|
193
203
|
},
|
|
194
|
-
/* @__PURE__ */ i.createElement(
|
|
195
|
-
f,
|
|
196
|
-
{
|
|
197
|
-
ref: (c) => this._dateButtonRef = c,
|
|
198
|
-
type: "button",
|
|
199
|
-
selected: this.state.tab === "date",
|
|
200
|
-
togglable: !0,
|
|
201
|
-
onClick: this.handleDateClick,
|
|
202
|
-
onKeyDown: this.handleDateKeyDown
|
|
203
|
-
},
|
|
204
|
-
K
|
|
205
|
-
), /* @__PURE__ */ i.createElement(
|
|
206
|
-
f,
|
|
207
|
-
{
|
|
208
|
-
type: "button",
|
|
209
|
-
selected: this.state.tab === "time",
|
|
210
|
-
togglable: !0,
|
|
211
|
-
onClick: this.handleTimeClick,
|
|
212
|
-
onKeyDown: this.handleTimeKeyDown
|
|
213
|
-
},
|
|
214
|
-
N
|
|
215
|
-
))),
|
|
216
|
-
/* @__PURE__ */ i.createElement("div", { className: o(u.selector({ c: m })) }, /* @__PURE__ */ i.createElement("div", { className: o(u.calendarWrap({ c: m })), ref: (c) => this._calendarWrap = c }, this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { key: this.state.tab, ...C }) : /* @__PURE__ */ i.createElement(
|
|
204
|
+
this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { key: this.state.tab, ...C }) : /* @__PURE__ */ i.createElement(
|
|
217
205
|
A,
|
|
218
206
|
{
|
|
219
207
|
key: this.state.tab,
|
|
@@ -222,28 +210,27 @@ const y = class y extends i.Component {
|
|
|
222
210
|
},
|
|
223
211
|
...C
|
|
224
212
|
}
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
);
|
|
213
|
+
)
|
|
214
|
+
), /* @__PURE__ */ i.createElement("div", { className: o(u.timeWrap({ c: m })) }, /* @__PURE__ */ i.createElement("div", { className: o(u.timeSelector({ c: m, mobileMode: n })) }, /* @__PURE__ */ i.createElement(
|
|
215
|
+
z,
|
|
216
|
+
{
|
|
217
|
+
key: 1,
|
|
218
|
+
onNowClick: this.handleNowClick,
|
|
219
|
+
disabled: a || this.state.tab !== "time",
|
|
220
|
+
ref: (c) => {
|
|
221
|
+
this._timePart = c;
|
|
222
|
+
},
|
|
223
|
+
min: this.minTime || F,
|
|
224
|
+
max: this.maxTime || L,
|
|
225
|
+
steps: this.props.steps,
|
|
226
|
+
value: this.state.timeValue,
|
|
227
|
+
format: r,
|
|
228
|
+
onChange: this.handleTimeListContainerChange,
|
|
229
|
+
onMount: this.handleTimePartMount,
|
|
230
|
+
mobileMode: n,
|
|
231
|
+
unstyled: v
|
|
232
|
+
}
|
|
233
|
+
)))), d && this.dateTimeFooter());
|
|
247
234
|
}
|
|
248
235
|
get minTime() {
|
|
249
236
|
return this.props.minTime !== void 0 ? this.props.minTime : this.normalizeRange(this.props.min, this.state.dateValue);
|