@progress/kendo-react-dateinputs 15.1.1-develop.2 → 15.2.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +164 -164
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +61 -63
- package/datetimepicker/DateTimePicker.d.ts +1 -0
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +103 -105
- package/datetimepicker/models/DateTimePickerSettings.d.ts +7 -0
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/timepicker/TimePicker.d.ts +1 -0
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +113 -112
- package/timepicker/models/TimePickerSettings.d.ts +7 -0
package/package-metadata.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-dateinputs",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-dateinputs",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1784273478,version:"15.2.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"});exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export const packageMetadata = Object.freeze({
|
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCode: 'KENDOUIREACT',
|
|
8
8
|
productCodes: ['KENDOUIREACT'],
|
|
9
|
-
publishDate:
|
|
10
|
-
version: '15.
|
|
9
|
+
publishDate: 1784273478,
|
|
10
|
+
version: '15.2.0-develop.1',
|
|
11
11
|
licensingDocsUrl:
|
|
12
12
|
'https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
13
13
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-dateinputs",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.2.0-develop.1",
|
|
4
4
|
"description": "React DateInput is a perfect input component for handling quick and efficient date values. KendoReact Date Inputs package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"@progress/kendo-date-math": "^1.4.0",
|
|
29
29
|
"@progress/kendo-licensing": "^1.7.2",
|
|
30
30
|
"@progress/kendo-dateinputs-common": "^0.4.7",
|
|
31
|
-
"@progress/kendo-react-buttons": "15.
|
|
32
|
-
"@progress/kendo-react-common": "15.
|
|
33
|
-
"@progress/kendo-react-intl": "15.
|
|
34
|
-
"@progress/kendo-react-labels": "15.
|
|
35
|
-
"@progress/kendo-react-layout": "15.
|
|
36
|
-
"@progress/kendo-react-popup": "15.
|
|
31
|
+
"@progress/kendo-react-buttons": "15.2.0-develop.1",
|
|
32
|
+
"@progress/kendo-react-common": "15.2.0-develop.1",
|
|
33
|
+
"@progress/kendo-react-intl": "15.2.0-develop.1",
|
|
34
|
+
"@progress/kendo-react-labels": "15.2.0-develop.1",
|
|
35
|
+
"@progress/kendo-react-layout": "15.2.0-develop.1",
|
|
36
|
+
"@progress/kendo-react-popup": "15.2.0-develop.1",
|
|
37
37
|
"@progress/kendo-svg-icons": "^4.9.0 || ^5.0.0",
|
|
38
38
|
"react": "^18.0.0 || ^19.0.0",
|
|
39
39
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"package": {
|
|
90
90
|
"productName": "KendoReact",
|
|
91
91
|
"productCode": "KENDOUIREACT",
|
|
92
|
-
"publishDate":
|
|
92
|
+
"publishDate": 1784273478,
|
|
93
93
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
|
|
94
94
|
}
|
|
95
95
|
},
|
|
@@ -217,6 +217,7 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
|
|
|
217
217
|
}> | null | undefined>>;
|
|
218
218
|
id: PropTypes.Requireable<string>;
|
|
219
219
|
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
220
|
+
ariaLabel: PropTypes.Requireable<string>;
|
|
220
221
|
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
221
222
|
min: PropTypes.Requireable<Date>;
|
|
222
223
|
max: PropTypes.Requireable<Date>;
|
package/timepicker/TimePicker.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("react"),e=require("prop-types"),$=require("@progress/kendo-react-popup"),y=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),J=require("@progress/kendo-svg-icons"),P=require("@progress/kendo-react-intl"),T=require("../package-metadata.js"),a=require("../messages/index.js"),Q=require("../dateinput/DateInput.js"),Y=require("./TimeSelector.js"),p=require("../utils.js"),g=require("./utils.js"),ee=require("../hooks/usePickerFloatingLabel.js"),te=require("@progress/kendo-react-buttons"),ie=require("../common/AdaptiveMode.js"),se=require("@progress/kendo-react-layout");function oe(c){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>c[t]})}}return s.default=c,Object.freeze(s)}const r=oe(Z),l=class l extends r.Component{constructor(s){super(s),this._element=null,this._dateInput=r.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.showLicenseWatermark=!1,this.handleKendoPasteValue=t=>{if(t instanceof Date&&!isNaN(t.getTime())){this.applyKendoPasteTime(t);return}const i=t!=null?String(t):"";if(!i)return;const o=new Date(i);isNaN(o.getTime())||this.applyKendoPasteTime(o)},this.applyKendoPasteTime=t=>{const i=this.normalizeTime(t);if(!g.isInRange(i,this.min,this.max))return;const o=new Event("change",{bubbles:!0}),h={target:this._element,currentTarget:this._element,nativeEvent:o};this.handleValueChange({syntheticEvent:h,nativeEvent:o,value:i})},this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:i,nowButton:o,disabled:h,format:d,steps:u,unstyled:f}=this.props;return r.createElement(Y.TimeSelector,{ref:this.setTimeSelectorRef,mobileMode:this.mobileMode,show:this.show,cancelButton:i,disabled:h,nowButton:o,format:d,min:this.min,max:this.max,steps:u,smoothScroll:t,value:this.value,footer:!this.mobileMode,handleTimeChange:this.mobileMode&&this.handleTimeChange,onChange:this.handleValueChange,onReject:this.handleValueReject,unstyled:f})},this.renderPopup=()=>{const{popupClass:t,...i}=this.popupSettings,{unstyled:o}=this.props,h=o&&o.uTimePicker,d=n.classNames(t),u={popupClass:n.uTimePicker.popup({c:h}),show:this.show,animate:this.element!==null,anchor:this.element,className:d,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...i};return this.props.popup?r.createElement(this.props.popup,{...u},this.renderTimeSelector()):r.createElement($.Popup,{...u},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,i={expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,windowWidth:t,footer:{cancelText:this.localizationService.toLanguageString(a.toggleClock,a.messages[a.timePickerCancel]),onCancel:this.handleValueReject,applyText:this.localizationService.toLanguageString(a.timePickerSet,a.messages[a.timePickerSet]),onApply:o=>this.handleValueChange(o)}};return r.createElement(ie.AdaptiveMode,{...i},r.createElement(se.ActionSheetContent,null,this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},this.nextValue=(t,i)=>t.value!==void 0?t.value:i.value,this.nextShow=(t,i)=>t.show!==void 0?t.show:i.show,this.handleInputValueChange=t=>{const i=this.mergeTime(t.value);this.handleValueChange({...t,value:i})},this.handleTimeChange=t=>{this.setState({candidate:t.time})},this.handleValueChange=t=>{this.setState({value:y.cloneDate(t.value||this.state.candidate)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:i}=this.props,o=this.valueDuringOnChange!==void 0?this.value:this.state.candidate||this.value;i&&i.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:o,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setState({candidate:null}),this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleValueReject=t=>{this.mobileMode||(this.shouldFocusDateInput=!0),this.setShow(!1)},this.handleClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:i,keyCode:o}=t;if(o===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(o===n.Keys.up||o===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=o===n.Keys.up,this.setShow(o===n.Keys.down))},this.showLicenseWatermark=!n.validatePackage(T.packageMetadata,{component:"TimePicker"}),this.licenseMessage=n.getLicenseMessage(T.packageMetadata),this.state={value:this.props.defaultValue||l.defaultProps.defaultValue,show:this.props.defaultShow||l.defaultProps.defaultShow,focused:!1,candidate:null},this.normalizeTime=this.normalizeTime.bind(this),this.setShow=this.setShow.bind(this),this.mergeTime=this.mergeTime.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get timeSelector(){return this._timeSelector}get value(){const s=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return s!==null?y.cloneDate(s):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 validity(){const s=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),i=this.normalizeTime(this.max),o=g.isInRange(s,t,i),h=this.props.validationMessage!==void 0,d=(!this.required||this.value!==null)&&o,u=this.props.valid!==void 0?this.props.valid:d;return{customError:h,rangeOverflow:g.isBiggerThanMax(s,i),rangeUnderflow:g.isSmallerThanMin(s,t),valid:u,valueMissing:this.value===null}}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 validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:l.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get popupSettings(){return this.props.popupSettings||l.defaultProps.popupSettings}get min(){return this.props.min!==void 0?this.props.min:l.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:l.defaultProps.max}get dateInputComp(){return this.props.dateInput||l.defaultProps.dateInput}get localizationService(){return P.provideLocalizationService(this)}componentDidMount(){var t;this.observerResize=n.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);const s=this.props.name||this.props.id;this.KendoPasteSubscription=n.subscribeToKendoPaste(this._element,{fieldName:s,onValueChange:i=>{this.handleKendoPasteValue(i)}})}componentDidUpdate(){this._timeSelector&&this.show&&!this.prevShow&&this._timeSelector.focusActiveList(),this.mobileMode&&this.show&&!this.prevShow&&setTimeout(()=>{this._timeSelector&&this._timeSelector.focusActiveList()},300),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var s,t;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect(),(t=this.KendoPasteSubscription)==null||t.unsubscribe()}render(){const{size:s=l.defaultProps.size,rounded:t=l.defaultProps.rounded,fillMode:i=l.defaultProps.fillMode,disabled:o,tabIndex:h,title:d,id:u,className:f,format:I,formatPlaceholder:D,width:k,name:O,steps:z,validationMessage:x,required:R,validityStyles:q,ariaLabelledBy:E,ariaDescribedBy:L,unstyled:v,enableMouseWheel:N,autoCorrectParts:B,autoSwitchParts:F,autoSwitchKeys:K,allowCaretMode:V,inputAttributes:A}=this.props,b=v&&v.uTimePicker,w=!this.validityStyles||this.validity.valid,_=this.localizationService.toLanguageString(a.selectTime,a.messages[a.selectTime]),j={disabled:o,format:I,formatPlaceholder:D,id:u,ariaLabelledBy:E,ariaDescribedBy:L,ariaLabel:_,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:O,onChange:this.handleInputValueChange,required:R,steps:z,tabIndex:this.show?-1:h,title:d,valid:this.validity.valid,validationMessage:x,validityStyles:q,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.show,enableMouseWheel:N,autoCorrectParts:B,autoSwitchParts:F,autoSwitchKeys:K,allowCaretMode:V,inputAttributes:A},W=this.localizationService.toLanguageString(a.toggleClock,a.messages[a.toggleClock]),U=this.localizationService.toLanguageString(a.toggleTimeSelector,a.messages[a.toggleTimeSelector]),S=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:H,onBlur:G})=>r.createElement(r.Fragment,null,r.createElement("span",{ref:X=>{this._element=X},className:n.classNames(n.uTimePicker.wrapper({c:b,size:s,rounded:t,fillMode:i,invalid:!w,required:this.required,disabled:o}),{"k-focus":this.state.focused},f),onKeyDown:this.handleKeyDown,style:{width:k},onFocus:this.mobileMode?this.handleClick:H,onBlur:G,onClick:this.mobileMode?this.handleClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this.show?this._popupId:void 0,...j}),r.createElement(te.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:J.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleClick,title:U,className:n.classNames(n.uTimePicker.inputButton({c:b})),fillMode:i,"aria-label":W}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&r.createElement(n.WatermarkOverlay,{message:this.licenseMessage})));return this.props.label?r.createElement(ee.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:u,editorValid:w,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}normalizeTime(s){return p.setTime(p.MIDNIGHT_DATE,s)}setShow(s){const{onOpen:t,onClose:i}=this.props;this.show!==s&&(this.setState({show:s}),s&&t&&t.call(void 0,{target:this}),!s&&i&&i.call(void 0,{target:this}))}mergeTime(s){return this.value&&s?p.setTime(this.value,s):s}calculateMedia(s){for(const t of s)this.setState({windowWidth:t.target.clientWidth})}};l.displayName="TimePicker",l.propTypes={className:e.string,cancelButton:e.bool,nowButton:e.bool,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,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}),dateInput:e.elementType,show:e.bool,steps:e.shape({hour:e.number,minute:e.number,second:e.number}),smoothScroll:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full","none"]),fillMode:e.oneOf(["solid","flat","outline"]),inputAttributes:e.object},l.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:p.MAX_TIME,min:p.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},validityStyles:!0,dateInput:Q.DateInputInner,size:void 0,rounded:void 0,fillMode:void 0};let m=l;const C=n.createPropsContext(),M=n.withIdHOC(n.withPropsContext(C,n.withUnstyledHOC(n.withAdaptiveModeContext(m))));M.displayName="KendoReactTimePicker";P.registerForLocalization(m);exports.TimePicker=M;exports.TimePickerPropsContext=C;exports.TimePickerWithoutContext=m;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react"),e=require("prop-types"),Z=require("@progress/kendo-react-popup"),y=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),$=require("@progress/kendo-svg-icons"),P=require("@progress/kendo-react-intl"),T=require("../package-metadata.js"),l=require("../messages/index.js"),J=require("../dateinput/DateInput.js"),Q=require("./TimeSelector.js"),p=require("../utils.js"),g=require("./utils.js"),Y=require("../hooks/usePickerFloatingLabel.js"),ee=require("@progress/kendo-react-buttons"),te=require("../common/AdaptiveMode.js"),ie=require("@progress/kendo-react-layout");function se(c){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>c[t]})}}return s.default=c,Object.freeze(s)}const a=se(X),r=class r extends a.Component{constructor(s){super(s),this._element=null,this._dateInput=a.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.showLicenseWatermark=!1,this.handleKendoPasteValue=t=>{if(t instanceof Date&&!isNaN(t.getTime())){this.applyKendoPasteTime(t);return}const i=t!=null?String(t):"";if(!i)return;const o=new Date(i);isNaN(o.getTime())||this.applyKendoPasteTime(o)},this.applyKendoPasteTime=t=>{const i=this.normalizeTime(t);if(!g.isInRange(i,this.min,this.max))return;const o=new Event("change",{bubbles:!0}),h={target:this._element,currentTarget:this._element,nativeEvent:o};this.handleValueChange({syntheticEvent:h,nativeEvent:o,value:i})},this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:i,nowButton:o,disabled:h,format:d,steps:u,unstyled:f}=this.props;return a.createElement(Q.TimeSelector,{ref:this.setTimeSelectorRef,mobileMode:this.mobileMode,show:this.show,cancelButton:i,disabled:h,nowButton:o,format:d,min:this.min,max:this.max,steps:u,smoothScroll:t,value:this.value,footer:!this.mobileMode,handleTimeChange:this.mobileMode&&this.handleTimeChange,onChange:this.handleValueChange,onReject:this.handleValueReject,unstyled:f})},this.renderPopup=()=>{const{popupClass:t,...i}=this.popupSettings,{unstyled:o}=this.props,h=o&&o.uTimePicker,d=n.classNames(t),u={popupClass:n.uTimePicker.popup({c:h}),show:this.show,animate:this.element!==null,anchor:this.element,className:d,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...i};return this.props.popup?a.createElement(this.props.popup,{...u},this.renderTimeSelector()):a.createElement(Z.Popup,{...u},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,i={expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,windowWidth:t,footer:{cancelText:this.localizationService.toLanguageString(l.toggleClock,l.messages[l.timePickerCancel]),onCancel:this.handleValueReject,applyText:this.localizationService.toLanguageString(l.timePickerSet,l.messages[l.timePickerSet]),onApply:o=>this.handleValueChange(o)}};return a.createElement(te.AdaptiveMode,{...i},a.createElement(ie.ActionSheetContent,null,this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},this.nextValue=(t,i)=>t.value!==void 0?t.value:i.value,this.nextShow=(t,i)=>t.show!==void 0?t.show:i.show,this.handleInputValueChange=t=>{const i=this.mergeTime(t.value);this.handleValueChange({...t,value:i})},this.handleTimeChange=t=>{this.setState({candidate:t.time})},this.handleValueChange=t=>{this.setState({value:y.cloneDate(t.value||this.state.candidate)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:i}=this.props,o=this.valueDuringOnChange!==void 0?this.value:this.state.candidate||this.value;i&&i.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:o,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setState({candidate:null}),this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleValueReject=t=>{this.mobileMode||(this.shouldFocusDateInput=!0),this.setShow(!1)},this.handleClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:i,keyCode:o}=t;if(o===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(o===n.Keys.up||o===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=o===n.Keys.up,this.setShow(o===n.Keys.down))},this.showLicenseWatermark=!n.validatePackage(T.packageMetadata,{component:"TimePicker"}),this.licenseMessage=n.getLicenseMessage(T.packageMetadata),this.state={value:this.props.defaultValue||r.defaultProps.defaultValue,show:this.props.defaultShow||r.defaultProps.defaultShow,focused:!1,candidate:null},this.normalizeTime=this.normalizeTime.bind(this),this.setShow=this.setShow.bind(this),this.mergeTime=this.mergeTime.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get timeSelector(){return this._timeSelector}get value(){const s=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return s!==null?y.cloneDate(s):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 validity(){const s=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),i=this.normalizeTime(this.max),o=g.isInRange(s,t,i),h=this.props.validationMessage!==void 0,d=(!this.required||this.value!==null)&&o,u=this.props.valid!==void 0?this.props.valid:d;return{customError:h,rangeOverflow:g.isBiggerThanMax(s,i),rangeUnderflow:g.isSmallerThanMin(s,t),valid:u,valueMissing:this.value===null}}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 validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:r.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get popupSettings(){return this.props.popupSettings||r.defaultProps.popupSettings}get min(){return this.props.min!==void 0?this.props.min:r.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:r.defaultProps.max}get dateInputComp(){return this.props.dateInput||r.defaultProps.dateInput}get localizationService(){return P.provideLocalizationService(this)}componentDidMount(){var t;this.observerResize=n.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);const s=this.props.name||this.props.id;this.KendoPasteSubscription=n.subscribeToKendoPaste(this._element,{fieldName:s,onValueChange:i=>{this.handleKendoPasteValue(i)}})}componentDidUpdate(){this._timeSelector&&this.show&&!this.prevShow&&this._timeSelector.focusActiveList(),this.mobileMode&&this.show&&!this.prevShow&&setTimeout(()=>{this._timeSelector&&this._timeSelector.focusActiveList()},300),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var s,t;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect(),(t=this.KendoPasteSubscription)==null||t.unsubscribe()}render(){const{size:s=r.defaultProps.size,rounded:t=r.defaultProps.rounded,fillMode:i=r.defaultProps.fillMode,disabled:o,tabIndex:h,title:d,id:u,className:f,format:I,formatPlaceholder:D,width:k,name:O,steps:z,validationMessage:x,required:R,validityStyles:q,ariaLabelledBy:E,ariaDescribedBy:L,unstyled:v,enableMouseWheel:N,autoCorrectParts:B,autoSwitchParts:F,autoSwitchKeys:K,allowCaretMode:V,inputAttributes:A}=this.props,b=v&&v.uTimePicker,w=!this.validityStyles||this.validity.valid,_={disabled:o,format:I,formatPlaceholder:D,id:u,ariaLabelledBy:E,ariaDescribedBy:L,ariaLabel:this.props.ariaLabel,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:O,onChange:this.handleInputValueChange,required:R,steps:z,tabIndex:this.show?-1:h,title:d,valid:this.validity.valid,validationMessage:x,validityStyles:q,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.show,enableMouseWheel:N,autoCorrectParts:B,autoSwitchParts:F,autoSwitchKeys:K,allowCaretMode:V,inputAttributes:A},j=this.localizationService.toLanguageString(l.toggleClock,l.messages[l.toggleClock]),W=this.localizationService.toLanguageString(l.toggleTimeSelector,l.messages[l.toggleTimeSelector]),S=a.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:U,onBlur:H})=>a.createElement(a.Fragment,null,a.createElement("span",{ref:G=>{this._element=G},className:n.classNames(n.uTimePicker.wrapper({c:b,size:s,rounded:t,fillMode:i,invalid:!w,required:this.required,disabled:o}),{"k-focus":this.state.focused},f),onKeyDown:this.handleKeyDown,style:{width:k},onFocus:this.mobileMode?this.handleClick:U,onBlur:H,onClick:this.mobileMode?this.handleClick:void 0},a.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this.show?this._popupId:void 0,..._}),a.createElement(ee.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:$.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleClick,title:W,className:n.classNames(n.uTimePicker.inputButton({c:b})),fillMode:i,"aria-label":j}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&a.createElement(n.WatermarkOverlay,{message:this.licenseMessage})));return this.props.label?a.createElement(Y.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:u,editorValid:w,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}normalizeTime(s){return p.setTime(p.MIDNIGHT_DATE,s)}setShow(s){const{onOpen:t,onClose:i}=this.props;this.show!==s&&(this.setState({show:s}),s&&t&&t.call(void 0,{target:this}),!s&&i&&i.call(void 0,{target:this}))}mergeTime(s){return this.value&&s?p.setTime(this.value,s):s}calculateMedia(s){for(const t of s)this.setState({windowWidth:t.target.clientWidth})}};r.displayName="TimePicker",r.propTypes={className:e.string,cancelButton:e.bool,nowButton:e.bool,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,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,ariaLabel: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}),dateInput:e.elementType,show:e.bool,steps:e.shape({hour:e.number,minute:e.number,second:e.number}),smoothScroll:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full","none"]),fillMode:e.oneOf(["solid","flat","outline"]),inputAttributes:e.object},r.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:p.MAX_TIME,min:p.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},validityStyles:!0,dateInput:J.DateInputInner,size:void 0,rounded:void 0,fillMode:void 0};let m=r;const C=n.createPropsContext(),M=n.withIdHOC(n.withPropsContext(C,n.withUnstyledHOC(n.withAdaptiveModeContext(m))));M.displayName="KendoReactTimePicker";P.registerForLocalization(m);exports.TimePicker=M;exports.TimePickerPropsContext=C;exports.TimePickerWithoutContext=m;
|
|
@@ -5,26 +5,26 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
8
|
+
import * as a from "react";
|
|
9
9
|
import e from "prop-types";
|
|
10
|
-
import { Popup as
|
|
10
|
+
import { Popup as J } from "@progress/kendo-react-popup";
|
|
11
11
|
import { cloneDate as y } from "@progress/kendo-date-math";
|
|
12
|
-
import { createPropsContext as
|
|
13
|
-
import { clockIcon as
|
|
14
|
-
import { provideLocalizationService as
|
|
12
|
+
import { createPropsContext as Q, classNames as m, uTimePicker as g, Keys as d, validatePackage as Y, getLicenseMessage as $, canUseDOM as T, subscribeToKendoPaste as ee, AsyncFocusBlur as te, WatermarkOverlay as ie, withIdHOC as se, withPropsContext as oe, withUnstyledHOC as ae, withAdaptiveModeContext as ne } from "@progress/kendo-react-common";
|
|
13
|
+
import { clockIcon as re } from "@progress/kendo-svg-icons";
|
|
14
|
+
import { provideLocalizationService as le, registerForLocalization as he } from "@progress/kendo-react-intl";
|
|
15
15
|
import { packageMetadata as C } from "../package-metadata.mjs";
|
|
16
|
-
import { timePickerSet as I, messages as u, toggleClock as f, timePickerCancel as
|
|
17
|
-
import { DateInputInner as
|
|
18
|
-
import { TimeSelector as
|
|
19
|
-
import { MIN_TIME as
|
|
20
|
-
import { isInRange as
|
|
21
|
-
import { PickerFloatingLabel as
|
|
22
|
-
import { Button as
|
|
23
|
-
import { AdaptiveMode as
|
|
24
|
-
import { ActionSheetContent as
|
|
25
|
-
const
|
|
16
|
+
import { timePickerSet as I, messages as u, toggleClock as f, timePickerCancel as de, toggleTimeSelector as M } from "../messages/index.mjs";
|
|
17
|
+
import { DateInputInner as ue } from "../dateinput/DateInput.mjs";
|
|
18
|
+
import { TimeSelector as pe } from "./TimeSelector.mjs";
|
|
19
|
+
import { MIN_TIME as ce, MAX_TIME as me, setTime as P, MIDNIGHT_DATE as ge } from "../utils.mjs";
|
|
20
|
+
import { isInRange as D, isSmallerThanMin as fe, isBiggerThanMax as ve } from "./utils.mjs";
|
|
21
|
+
import { PickerFloatingLabel as be } from "../hooks/usePickerFloatingLabel.mjs";
|
|
22
|
+
import { Button as we } from "@progress/kendo-react-buttons";
|
|
23
|
+
import { AdaptiveMode as Se } from "../common/AdaptiveMode.mjs";
|
|
24
|
+
import { ActionSheetContent as ye } from "@progress/kendo-react-layout";
|
|
25
|
+
const n = class n extends a.Component {
|
|
26
26
|
constructor(s) {
|
|
27
|
-
super(s), this._element = null, this._dateInput =
|
|
27
|
+
super(s), this._element = null, this._dateInput = a.createRef(), this._timeSelector = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.showLicenseWatermark = !1, this.handleKendoPasteValue = (t) => {
|
|
28
28
|
if (t instanceof Date && !isNaN(t.getTime())) {
|
|
29
29
|
this.applyKendoPasteTime(t);
|
|
30
30
|
return;
|
|
@@ -36,7 +36,7 @@ const a = class a extends n.Component {
|
|
|
36
36
|
isNaN(o.getTime()) || this.applyKendoPasteTime(o);
|
|
37
37
|
}, this.applyKendoPasteTime = (t) => {
|
|
38
38
|
const i = this.normalizeTime(t);
|
|
39
|
-
if (!
|
|
39
|
+
if (!D(i, this.min, this.max))
|
|
40
40
|
return;
|
|
41
41
|
const o = new Event("change", { bubbles: !0 }), r = {
|
|
42
42
|
target: this._element,
|
|
@@ -52,8 +52,8 @@ const a = class a extends n.Component {
|
|
|
52
52
|
this.dateInput && this.dateInput.focus();
|
|
53
53
|
}, this.renderTimeSelector = () => {
|
|
54
54
|
const { smoothScroll: t, cancelButton: i, nowButton: o, disabled: r, format: h, steps: l, unstyled: c } = this.props;
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
|
|
55
|
+
return /* @__PURE__ */ a.createElement(
|
|
56
|
+
pe,
|
|
57
57
|
{
|
|
58
58
|
ref: this.setTimeSelectorRef,
|
|
59
59
|
mobileMode: this.mobileMode,
|
|
@@ -92,7 +92,7 @@ const a = class a extends n.Component {
|
|
|
92
92
|
},
|
|
93
93
|
...i
|
|
94
94
|
};
|
|
95
|
-
return this.props.popup ? /* @__PURE__ */
|
|
95
|
+
return this.props.popup ? /* @__PURE__ */ a.createElement(this.props.popup, { ...l }, this.renderTimeSelector()) : /* @__PURE__ */ a.createElement(J, { ...l }, this.renderTimeSelector());
|
|
96
96
|
}, this.renderAdaptivePopup = () => {
|
|
97
97
|
const { windowWidth: t = 0 } = this.state, i = {
|
|
98
98
|
expand: this.show,
|
|
@@ -101,13 +101,13 @@ const a = class a extends n.Component {
|
|
|
101
101
|
subTitle: this.props.adaptiveSubtitle,
|
|
102
102
|
windowWidth: t,
|
|
103
103
|
footer: {
|
|
104
|
-
cancelText: this.localizationService.toLanguageString(f, u[
|
|
104
|
+
cancelText: this.localizationService.toLanguageString(f, u[de]),
|
|
105
105
|
onCancel: this.handleValueReject,
|
|
106
106
|
applyText: this.localizationService.toLanguageString(I, u[I]),
|
|
107
107
|
onApply: (o) => this.handleValueChange(o)
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
return /* @__PURE__ */
|
|
110
|
+
return /* @__PURE__ */ a.createElement(Se, { ...i }, /* @__PURE__ */ a.createElement(ye, null, this.renderTimeSelector()));
|
|
111
111
|
}, this.setTimeSelectorRef = (t) => {
|
|
112
112
|
this._timeSelector = t;
|
|
113
113
|
}, this.nextValue = (t, i) => t.value !== void 0 ? t.value : i.value, this.nextShow = (t, i) => t.show !== void 0 ? t.show : i.show, this.handleInputValueChange = (t) => {
|
|
@@ -144,9 +144,9 @@ const a = class a extends n.Component {
|
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
146
|
i && (o === d.up || o === d.down) && (t.preventDefault(), t.stopPropagation(), this.shouldFocusDateInput = o === d.up, this.setShow(o === d.down));
|
|
147
|
-
}, this.showLicenseWatermark = !
|
|
148
|
-
value: this.props.defaultValue ||
|
|
149
|
-
show: this.props.defaultShow ||
|
|
147
|
+
}, this.showLicenseWatermark = !Y(C, { component: "TimePicker" }), this.licenseMessage = $(C), this.state = {
|
|
148
|
+
value: this.props.defaultValue || n.defaultProps.defaultValue,
|
|
149
|
+
show: this.props.defaultShow || n.defaultProps.defaultShow,
|
|
150
150
|
focused: !1,
|
|
151
151
|
candidate: null
|
|
152
152
|
}, this.normalizeTime = this.normalizeTime.bind(this), this.setShow = this.setShow.bind(this), this.mergeTime = this.mergeTime.bind(this);
|
|
@@ -199,11 +199,11 @@ const a = class a extends n.Component {
|
|
|
199
199
|
* Represents the validity state into which the TimePicker is set.
|
|
200
200
|
*/
|
|
201
201
|
get validity() {
|
|
202
|
-
const s = this.value && this.normalizeTime(this.value), t = this.normalizeTime(this.min), i = this.normalizeTime(this.max), o =
|
|
202
|
+
const s = this.value && this.normalizeTime(this.value), t = this.normalizeTime(this.min), i = this.normalizeTime(this.max), o = D(s, t, i), r = this.props.validationMessage !== void 0, h = (!this.required || this.value !== null) && o, l = this.props.valid !== void 0 ? this.props.valid : h;
|
|
203
203
|
return {
|
|
204
204
|
customError: r,
|
|
205
|
-
rangeOverflow:
|
|
206
|
-
rangeUnderflow:
|
|
205
|
+
rangeOverflow: ve(s, i),
|
|
206
|
+
rangeUnderflow: fe(s, t),
|
|
207
207
|
valid: l,
|
|
208
208
|
valueMissing: this.value === null
|
|
209
209
|
};
|
|
@@ -219,7 +219,7 @@ const a = class a extends n.Component {
|
|
|
219
219
|
* @hidden
|
|
220
220
|
*/
|
|
221
221
|
get validityStyles() {
|
|
222
|
-
return this.props.validityStyles !== void 0 ? this.props.validityStyles :
|
|
222
|
+
return this.props.validityStyles !== void 0 ? this.props.validityStyles : n.defaultProps.validityStyles;
|
|
223
223
|
}
|
|
224
224
|
/**
|
|
225
225
|
* @hidden
|
|
@@ -228,19 +228,19 @@ const a = class a extends n.Component {
|
|
|
228
228
|
return this.props.required !== void 0 ? this.props.required : !1;
|
|
229
229
|
}
|
|
230
230
|
get popupSettings() {
|
|
231
|
-
return this.props.popupSettings ||
|
|
231
|
+
return this.props.popupSettings || n.defaultProps.popupSettings;
|
|
232
232
|
}
|
|
233
233
|
get min() {
|
|
234
|
-
return this.props.min !== void 0 ? this.props.min :
|
|
234
|
+
return this.props.min !== void 0 ? this.props.min : n.defaultProps.min;
|
|
235
235
|
}
|
|
236
236
|
get max() {
|
|
237
|
-
return this.props.max !== void 0 ? this.props.max :
|
|
237
|
+
return this.props.max !== void 0 ? this.props.max : n.defaultProps.max;
|
|
238
238
|
}
|
|
239
239
|
get dateInputComp() {
|
|
240
|
-
return this.props.dateInput ||
|
|
240
|
+
return this.props.dateInput || n.defaultProps.dateInput;
|
|
241
241
|
}
|
|
242
242
|
get localizationService() {
|
|
243
|
-
return
|
|
243
|
+
return le(this);
|
|
244
244
|
}
|
|
245
245
|
/**
|
|
246
246
|
* @hidden
|
|
@@ -249,7 +249,7 @@ const a = class a extends n.Component {
|
|
|
249
249
|
var t;
|
|
250
250
|
this.observerResize = T && 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);
|
|
251
251
|
const s = this.props.name || this.props.id;
|
|
252
|
-
this.KendoPasteSubscription =
|
|
252
|
+
this.KendoPasteSubscription = ee(this._element, {
|
|
253
253
|
fieldName: s,
|
|
254
254
|
onValueChange: (i) => {
|
|
255
255
|
this.handleKendoPasteValue(i);
|
|
@@ -276,85 +276,85 @@ const a = class a extends n.Component {
|
|
|
276
276
|
*/
|
|
277
277
|
render() {
|
|
278
278
|
const {
|
|
279
|
-
size: s =
|
|
280
|
-
rounded: t =
|
|
281
|
-
fillMode: i =
|
|
279
|
+
size: s = n.defaultProps.size,
|
|
280
|
+
rounded: t = n.defaultProps.rounded,
|
|
281
|
+
fillMode: i = n.defaultProps.fillMode,
|
|
282
282
|
disabled: o,
|
|
283
283
|
tabIndex: r,
|
|
284
284
|
title: h,
|
|
285
285
|
id: l,
|
|
286
286
|
className: c,
|
|
287
|
-
format:
|
|
288
|
-
formatPlaceholder:
|
|
289
|
-
width:
|
|
290
|
-
name:
|
|
291
|
-
steps:
|
|
292
|
-
validationMessage:
|
|
293
|
-
required:
|
|
294
|
-
validityStyles:
|
|
295
|
-
ariaLabelledBy:
|
|
296
|
-
ariaDescribedBy:
|
|
287
|
+
format: O,
|
|
288
|
+
formatPlaceholder: z,
|
|
289
|
+
width: k,
|
|
290
|
+
name: x,
|
|
291
|
+
steps: E,
|
|
292
|
+
validationMessage: R,
|
|
293
|
+
required: V,
|
|
294
|
+
validityStyles: B,
|
|
295
|
+
ariaLabelledBy: F,
|
|
296
|
+
ariaDescribedBy: L,
|
|
297
297
|
unstyled: v,
|
|
298
|
-
enableMouseWheel:
|
|
299
|
-
autoCorrectParts:
|
|
300
|
-
autoSwitchParts:
|
|
301
|
-
autoSwitchKeys:
|
|
302
|
-
allowCaretMode:
|
|
303
|
-
inputAttributes:
|
|
304
|
-
} = this.props,
|
|
298
|
+
enableMouseWheel: A,
|
|
299
|
+
autoCorrectParts: N,
|
|
300
|
+
autoSwitchParts: K,
|
|
301
|
+
autoSwitchKeys: _,
|
|
302
|
+
allowCaretMode: q,
|
|
303
|
+
inputAttributes: W
|
|
304
|
+
} = this.props, b = v && v.uTimePicker, w = !this.validityStyles || this.validity.valid, U = {
|
|
305
305
|
disabled: o,
|
|
306
|
-
format:
|
|
307
|
-
formatPlaceholder:
|
|
306
|
+
format: O,
|
|
307
|
+
formatPlaceholder: z,
|
|
308
308
|
id: l,
|
|
309
|
-
ariaLabelledBy:
|
|
310
|
-
ariaDescribedBy:
|
|
311
|
-
ariaLabel:
|
|
309
|
+
ariaLabelledBy: F,
|
|
310
|
+
ariaDescribedBy: L,
|
|
311
|
+
ariaLabel: this.props.ariaLabel,
|
|
312
312
|
max: this.normalizeTime(this.max),
|
|
313
313
|
min: this.normalizeTime(this.min),
|
|
314
|
-
name:
|
|
314
|
+
name: x,
|
|
315
315
|
onChange: this.handleInputValueChange,
|
|
316
|
-
required:
|
|
317
|
-
steps:
|
|
316
|
+
required: V,
|
|
317
|
+
steps: E,
|
|
318
318
|
tabIndex: this.show ? -1 : r,
|
|
319
319
|
title: h,
|
|
320
320
|
valid: this.validity.valid,
|
|
321
|
-
validationMessage:
|
|
322
|
-
validityStyles:
|
|
321
|
+
validationMessage: R,
|
|
322
|
+
validityStyles: B,
|
|
323
323
|
value: this.value && this.normalizeTime(this.value),
|
|
324
324
|
label: void 0,
|
|
325
325
|
placeholder: this.state.focused ? null : this.props.placeholder,
|
|
326
326
|
ariaHasPopup: "dialog",
|
|
327
327
|
ariaExpanded: this.show,
|
|
328
|
-
enableMouseWheel:
|
|
329
|
-
autoCorrectParts:
|
|
330
|
-
autoSwitchParts:
|
|
331
|
-
autoSwitchKeys:
|
|
332
|
-
allowCaretMode:
|
|
333
|
-
inputAttributes:
|
|
334
|
-
},
|
|
335
|
-
|
|
336
|
-
u[
|
|
337
|
-
), S = /* @__PURE__ */
|
|
338
|
-
|
|
328
|
+
enableMouseWheel: A,
|
|
329
|
+
autoCorrectParts: N,
|
|
330
|
+
autoSwitchParts: K,
|
|
331
|
+
autoSwitchKeys: _,
|
|
332
|
+
allowCaretMode: q,
|
|
333
|
+
inputAttributes: W
|
|
334
|
+
}, j = this.localizationService.toLanguageString(f, u[f]), H = this.localizationService.toLanguageString(
|
|
335
|
+
M,
|
|
336
|
+
u[M]
|
|
337
|
+
), S = /* @__PURE__ */ a.createElement(
|
|
338
|
+
te,
|
|
339
339
|
{
|
|
340
340
|
onFocus: this.handleFocus,
|
|
341
341
|
onBlur: this.mobileMode ? void 0 : this.handleBlur,
|
|
342
342
|
onSyncBlur: this.props.onBlur,
|
|
343
343
|
onSyncFocus: this.props.onFocus
|
|
344
344
|
},
|
|
345
|
-
({ onFocus:
|
|
345
|
+
({ onFocus: G, onBlur: X }) => /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
|
|
346
346
|
"span",
|
|
347
347
|
{
|
|
348
|
-
ref: (
|
|
349
|
-
this._element =
|
|
348
|
+
ref: (Z) => {
|
|
349
|
+
this._element = Z;
|
|
350
350
|
},
|
|
351
351
|
className: m(
|
|
352
352
|
g.wrapper({
|
|
353
|
-
c:
|
|
353
|
+
c: b,
|
|
354
354
|
size: s,
|
|
355
355
|
rounded: t,
|
|
356
356
|
fillMode: i,
|
|
357
|
-
invalid: !
|
|
357
|
+
invalid: !w,
|
|
358
358
|
required: this.required,
|
|
359
359
|
disabled: o
|
|
360
360
|
}),
|
|
@@ -362,45 +362,45 @@ const a = class a extends n.Component {
|
|
|
362
362
|
c
|
|
363
363
|
),
|
|
364
364
|
onKeyDown: this.handleKeyDown,
|
|
365
|
-
style: { width:
|
|
366
|
-
onFocus: this.mobileMode ? this.handleClick :
|
|
367
|
-
onBlur:
|
|
365
|
+
style: { width: k },
|
|
366
|
+
onFocus: this.mobileMode ? this.handleClick : G,
|
|
367
|
+
onBlur: X,
|
|
368
368
|
onClick: this.mobileMode ? this.handleClick : void 0
|
|
369
369
|
},
|
|
370
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ a.createElement(
|
|
371
371
|
this.dateInputComp,
|
|
372
372
|
{
|
|
373
373
|
_ref: this._dateInput,
|
|
374
374
|
ariaRole: "combobox",
|
|
375
375
|
ariaControls: this.show ? this._popupId : void 0,
|
|
376
|
-
...
|
|
376
|
+
...U
|
|
377
377
|
}
|
|
378
378
|
),
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
|
|
379
|
+
/* @__PURE__ */ a.createElement(
|
|
380
|
+
we,
|
|
381
381
|
{
|
|
382
382
|
tabIndex: -1,
|
|
383
383
|
type: "button",
|
|
384
384
|
icon: "clock",
|
|
385
|
-
svgIcon:
|
|
385
|
+
svgIcon: re,
|
|
386
386
|
onMouseDown: this.handleIconMouseDown,
|
|
387
387
|
onClick: this.mobileMode ? void 0 : this.handleClick,
|
|
388
|
-
title:
|
|
389
|
-
className: m(g.inputButton({ c:
|
|
388
|
+
title: H,
|
|
389
|
+
className: m(g.inputButton({ c: b })),
|
|
390
390
|
fillMode: i,
|
|
391
|
-
"aria-label":
|
|
391
|
+
"aria-label": j
|
|
392
392
|
}
|
|
393
393
|
),
|
|
394
394
|
!this.mobileMode && this.renderPopup()
|
|
395
|
-
), this.mobileMode && this.renderAdaptivePopup(), this.showLicenseWatermark && /* @__PURE__ */
|
|
395
|
+
), this.mobileMode && this.renderAdaptivePopup(), this.showLicenseWatermark && /* @__PURE__ */ a.createElement(ie, { message: this.licenseMessage }))
|
|
396
396
|
);
|
|
397
|
-
return this.props.label ? /* @__PURE__ */
|
|
398
|
-
|
|
397
|
+
return this.props.label ? /* @__PURE__ */ a.createElement(
|
|
398
|
+
be,
|
|
399
399
|
{
|
|
400
400
|
dateInput: this._dateInput,
|
|
401
401
|
label: this.props.label,
|
|
402
402
|
editorId: l,
|
|
403
|
-
editorValid:
|
|
403
|
+
editorValid: w,
|
|
404
404
|
editorDisabled: this.props.disabled,
|
|
405
405
|
children: S,
|
|
406
406
|
style: { width: this.props.width }
|
|
@@ -408,7 +408,7 @@ const a = class a extends n.Component {
|
|
|
408
408
|
) : S;
|
|
409
409
|
}
|
|
410
410
|
normalizeTime(s) {
|
|
411
|
-
return
|
|
411
|
+
return P(ge, s);
|
|
412
412
|
}
|
|
413
413
|
setShow(s) {
|
|
414
414
|
const { onOpen: t, onClose: i } = this.props;
|
|
@@ -419,14 +419,14 @@ const a = class a extends n.Component {
|
|
|
419
419
|
}));
|
|
420
420
|
}
|
|
421
421
|
mergeTime(s) {
|
|
422
|
-
return this.value && s ?
|
|
422
|
+
return this.value && s ? P(this.value, s) : s;
|
|
423
423
|
}
|
|
424
424
|
calculateMedia(s) {
|
|
425
425
|
for (const t of s)
|
|
426
426
|
this.setState({ windowWidth: t.target.clientWidth });
|
|
427
427
|
}
|
|
428
428
|
};
|
|
429
|
-
|
|
429
|
+
n.displayName = "TimePicker", n.propTypes = {
|
|
430
430
|
className: e.string,
|
|
431
431
|
cancelButton: e.bool,
|
|
432
432
|
nowButton: e.bool,
|
|
@@ -471,6 +471,7 @@ a.displayName = "TimePicker", a.propTypes = {
|
|
|
471
471
|
]),
|
|
472
472
|
id: e.string,
|
|
473
473
|
ariaLabelledBy: e.string,
|
|
474
|
+
ariaLabel: e.string,
|
|
474
475
|
ariaDescribedBy: e.string,
|
|
475
476
|
min: e.instanceOf(Date),
|
|
476
477
|
max: e.instanceOf(Date),
|
|
@@ -500,33 +501,33 @@ a.displayName = "TimePicker", a.propTypes = {
|
|
|
500
501
|
rounded: e.oneOf(["small", "medium", "large", "full", "none"]),
|
|
501
502
|
fillMode: e.oneOf(["solid", "flat", "outline"]),
|
|
502
503
|
inputAttributes: e.object
|
|
503
|
-
},
|
|
504
|
+
}, n.defaultProps = {
|
|
504
505
|
defaultShow: !1,
|
|
505
506
|
defaultValue: null,
|
|
506
507
|
disabled: !1,
|
|
507
508
|
format: "t",
|
|
508
|
-
max:
|
|
509
|
-
min:
|
|
509
|
+
max: me,
|
|
510
|
+
min: ce,
|
|
510
511
|
popupSettings: {},
|
|
511
512
|
tabIndex: 0,
|
|
512
513
|
steps: {},
|
|
513
514
|
validityStyles: !0,
|
|
514
|
-
dateInput:
|
|
515
|
+
dateInput: ue,
|
|
515
516
|
size: void 0,
|
|
516
517
|
rounded: void 0,
|
|
517
518
|
fillMode: void 0
|
|
518
519
|
};
|
|
519
|
-
let p =
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
520
|
+
let p = n;
|
|
521
|
+
const Te = Q(), Ce = se(
|
|
522
|
+
oe(
|
|
523
|
+
Te,
|
|
524
|
+
ae(ne(p))
|
|
524
525
|
)
|
|
525
526
|
);
|
|
526
|
-
|
|
527
|
-
|
|
527
|
+
Ce.displayName = "KendoReactTimePicker";
|
|
528
|
+
he(p);
|
|
528
529
|
export {
|
|
529
|
-
|
|
530
|
-
|
|
530
|
+
Ce as TimePicker,
|
|
531
|
+
Te as TimePickerPropsContext,
|
|
531
532
|
p as TimePickerWithoutContext
|
|
532
533
|
};
|
|
@@ -65,6 +65,13 @@ export interface TimePickerSettings {
|
|
|
65
65
|
* This property is related to accessibility.
|
|
66
66
|
*/
|
|
67
67
|
ariaLabelledBy?: string;
|
|
68
|
+
/**
|
|
69
|
+
* The accessible label of the component.
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* This property is related to accessibility.
|
|
73
|
+
*/
|
|
74
|
+
ariaLabel?: string;
|
|
68
75
|
/**
|
|
69
76
|
* Specifies the greatest valid time ([see example](https://www.telerik.com/kendo-react-ui/components/dateinputs/timepicker/time-ranges)).
|
|
70
77
|
*/
|