@progress/kendo-react-dateinputs 8.3.0-develop.8 → 8.3.0
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 +29 -24
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +24 -24
- package/datetimepicker/DateTimeSelector.js +1 -1
- package/datetimepicker/DateTimeSelector.mjs +66 -79
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +3 -5
- package/index.d.ts +3 -5
- 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
package/index.d.mts
CHANGED
|
@@ -873,7 +873,7 @@ export declare const dateInputsMessages: {
|
|
|
873
873
|
"datetimepicker.toggleDateTimeSelector": string;
|
|
874
874
|
};
|
|
875
875
|
|
|
876
|
-
declare interface DateInputsPopupSettings {
|
|
876
|
+
declare interface DateInputsPopupSettings extends PopupProps {
|
|
877
877
|
/**
|
|
878
878
|
* Controls the popup animation. By default, the open and close animations are enabled.
|
|
879
879
|
*/
|
|
@@ -976,7 +976,6 @@ export declare class DateInputWithoutContext extends React_2.Component<DateInput
|
|
|
976
976
|
min: Date;
|
|
977
977
|
minTime: Date;
|
|
978
978
|
maxTime: Date;
|
|
979
|
-
required: boolean;
|
|
980
979
|
validityStyles: boolean;
|
|
981
980
|
validationMessage: string;
|
|
982
981
|
placeholder: null;
|
|
@@ -1498,7 +1497,6 @@ export declare class DatePickerWithoutContext extends React_2.Component<DatePick
|
|
|
1498
1497
|
popupSettings: {};
|
|
1499
1498
|
tabIndex: number;
|
|
1500
1499
|
weekNumber: boolean;
|
|
1501
|
-
required: boolean;
|
|
1502
1500
|
validityStyles: boolean;
|
|
1503
1501
|
size: "small" | "large" | "medium" | null | undefined;
|
|
1504
1502
|
rounded: "small" | "large" | "medium" | "full" | null | undefined;
|
|
@@ -1601,6 +1599,8 @@ export declare class DatePickerWithoutContext extends React_2.Component<DatePick
|
|
|
1601
1599
|
private handleValueChange;
|
|
1602
1600
|
private handleFocus;
|
|
1603
1601
|
private handleBlur;
|
|
1602
|
+
togglePopup: () => void;
|
|
1603
|
+
private handleMouseDownOutside;
|
|
1604
1604
|
private handleIconClick;
|
|
1605
1605
|
private handleIconMouseDown;
|
|
1606
1606
|
private handleKeyDown;
|
|
@@ -2486,7 +2486,6 @@ export declare class DateTimePickerWithoutContext extends React_2.Component<Date
|
|
|
2486
2486
|
popupSettings: {};
|
|
2487
2487
|
tabIndex: number;
|
|
2488
2488
|
weekNumber: boolean;
|
|
2489
|
-
required: boolean;
|
|
2490
2489
|
validityStyles: boolean;
|
|
2491
2490
|
cancelButton: boolean;
|
|
2492
2491
|
dateInput: React_2.ComponentType<DateInputProps<any>>;
|
|
@@ -4087,7 +4086,6 @@ export declare class TimePickerWithoutContext extends React_2.Component<TimePick
|
|
|
4087
4086
|
popupSettings: {};
|
|
4088
4087
|
tabIndex: number;
|
|
4089
4088
|
steps: {};
|
|
4090
|
-
required: boolean;
|
|
4091
4089
|
validityStyles: boolean;
|
|
4092
4090
|
dateInput: React_2.ComponentType<DateInputProps<any>>;
|
|
4093
4091
|
size: "small" | "large" | "medium" | null | undefined;
|
package/index.d.ts
CHANGED
|
@@ -873,7 +873,7 @@ export declare const dateInputsMessages: {
|
|
|
873
873
|
"datetimepicker.toggleDateTimeSelector": string;
|
|
874
874
|
};
|
|
875
875
|
|
|
876
|
-
declare interface DateInputsPopupSettings {
|
|
876
|
+
declare interface DateInputsPopupSettings extends PopupProps {
|
|
877
877
|
/**
|
|
878
878
|
* Controls the popup animation. By default, the open and close animations are enabled.
|
|
879
879
|
*/
|
|
@@ -976,7 +976,6 @@ export declare class DateInputWithoutContext extends React_2.Component<DateInput
|
|
|
976
976
|
min: Date;
|
|
977
977
|
minTime: Date;
|
|
978
978
|
maxTime: Date;
|
|
979
|
-
required: boolean;
|
|
980
979
|
validityStyles: boolean;
|
|
981
980
|
validationMessage: string;
|
|
982
981
|
placeholder: null;
|
|
@@ -1498,7 +1497,6 @@ export declare class DatePickerWithoutContext extends React_2.Component<DatePick
|
|
|
1498
1497
|
popupSettings: {};
|
|
1499
1498
|
tabIndex: number;
|
|
1500
1499
|
weekNumber: boolean;
|
|
1501
|
-
required: boolean;
|
|
1502
1500
|
validityStyles: boolean;
|
|
1503
1501
|
size: "small" | "large" | "medium" | null | undefined;
|
|
1504
1502
|
rounded: "small" | "large" | "medium" | "full" | null | undefined;
|
|
@@ -1601,6 +1599,8 @@ export declare class DatePickerWithoutContext extends React_2.Component<DatePick
|
|
|
1601
1599
|
private handleValueChange;
|
|
1602
1600
|
private handleFocus;
|
|
1603
1601
|
private handleBlur;
|
|
1602
|
+
togglePopup: () => void;
|
|
1603
|
+
private handleMouseDownOutside;
|
|
1604
1604
|
private handleIconClick;
|
|
1605
1605
|
private handleIconMouseDown;
|
|
1606
1606
|
private handleKeyDown;
|
|
@@ -2486,7 +2486,6 @@ export declare class DateTimePickerWithoutContext extends React_2.Component<Date
|
|
|
2486
2486
|
popupSettings: {};
|
|
2487
2487
|
tabIndex: number;
|
|
2488
2488
|
weekNumber: boolean;
|
|
2489
|
-
required: boolean;
|
|
2490
2489
|
validityStyles: boolean;
|
|
2491
2490
|
cancelButton: boolean;
|
|
2492
2491
|
dateInput: React_2.ComponentType<DateInputProps<any>>;
|
|
@@ -4087,7 +4086,6 @@ export declare class TimePickerWithoutContext extends React_2.Component<TimePick
|
|
|
4087
4086
|
popupSettings: {};
|
|
4088
4087
|
tabIndex: number;
|
|
4089
4088
|
steps: {};
|
|
4090
|
-
required: boolean;
|
|
4091
4089
|
validityStyles: boolean;
|
|
4092
4090
|
dateInput: React_2.ComponentType<DateInputProps<any>>;
|
|
4093
4091
|
size: "small" | "large" | "medium" | null | undefined;
|
package/package-metadata.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const e = {
|
|
|
10
10
|
name: "@progress/kendo-react-dateinputs",
|
|
11
11
|
productName: "KendoReact",
|
|
12
12
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
-
publishDate:
|
|
13
|
+
publishDate: 1726561363,
|
|
14
14
|
version: "",
|
|
15
15
|
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"
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-dateinputs",
|
|
3
|
-
"version": "8.3.0
|
|
3
|
+
"version": "8.3.0",
|
|
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",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@progress/kendo-date-math": "^1.4.0",
|
|
26
26
|
"@progress/kendo-licensing": "^1.3.4",
|
|
27
|
-
"@progress/kendo-react-buttons": "8.3.0
|
|
28
|
-
"@progress/kendo-react-common": "8.3.0
|
|
29
|
-
"@progress/kendo-react-intl": "8.3.0
|
|
30
|
-
"@progress/kendo-react-labels": "8.3.0
|
|
31
|
-
"@progress/kendo-react-layout": "8.3.0
|
|
32
|
-
"@progress/kendo-react-popup": "8.3.0
|
|
27
|
+
"@progress/kendo-react-buttons": "8.3.0",
|
|
28
|
+
"@progress/kendo-react-common": "8.3.0",
|
|
29
|
+
"@progress/kendo-react-intl": "8.3.0",
|
|
30
|
+
"@progress/kendo-react-labels": "8.3.0",
|
|
31
|
+
"@progress/kendo-react-layout": "8.3.0",
|
|
32
|
+
"@progress/kendo-react-popup": "8.3.0",
|
|
33
33
|
"@progress/kendo-svg-icons": "^3.0.0",
|
|
34
34
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
35
35
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|
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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),e=require("prop-types"),K=require("@progress/kendo-react-popup"),y=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),j=require("@progress/kendo-svg-icons"),I=require("@progress/kendo-react-intl"),U=require("../package-metadata.js"),l=require("../messages/index.js"),H=require("../dateinput/DateInput.js"),W=require("./TimeSelector.js"),c=require("../utils.js"),f=require("./utils.js"),G=require("../hooks/usePickerFloatingLabel.js"),X=require("@progress/kendo-react-buttons"),Z=require("../common/constants.js"),$=require("../common/AdaptiveMode.js"),J=require("@progress/kendo-react-layout");function Q(p){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const t in p)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(p,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>p[t]})}}return i.default=p,Object.freeze(i)}const r=Q(_),a=class a extends r.Component{constructor(i){super(i),this._element=null,this._dateInput=r.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:s,nowButton:o,disabled:u,format:d,steps:h,unstyled:g}=this.props;return r.createElement(W.TimeSelector,{ref:this.setTimeSelectorRef,mobileMode:this.mobileMode,show:this.show,cancelButton:s,disabled:u,nowButton:o,format:d,min:this.min,max:this.max,steps:h,smoothScroll:t,value:this.value,footer:!this.mobileMode,handleTimeChange:this.mobileMode&&this.handleTimeChange,onChange:this.handleValueChange,onReject:this.handleValueReject,unstyled:g})},this.renderPopup=()=>{const{popupClass:t,...s}=this.popupSettings,{unstyled:o}=this.props,u=o&&o.uTimePicker,d=n.classNames(t),h={popupClass:n.uTimePicker.popup({c:u}),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"},...s};return this.props.popup?r.createElement(this.props.popup,{...h},this.renderTimeSelector()):r.createElement(K.Popup,{...h},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,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 r.createElement($.AdaptiveMode,{...s},r.createElement(J.ActionSheetContent,{overflowHidden:!0},this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},this.nextValue=(t,s)=>t.value!==void 0?t.value:s.value,this.nextShow=(t,s)=>t.show!==void 0?t.show:s.show,this.handleInputValueChange=t=>{const s=this.mergeTime(t.value);this.handleValueChange({...t,value:s})},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.shouldFocusDateInput=!0;const{onChange:s}=this.props,o=this.state.candidate||this.value;s&&s.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.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleValueReject=t=>{this.setShow(!1)},this.handleIconClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:s,keyCode:o}=t;if(o===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(o===n.Keys.up||o===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=o===n.Keys.up,this.setShow(o===n.Keys.down))},n.validatePackage(U.packageMetadata),this.state={value:this.props.defaultValue||a.defaultProps.defaultValue,show:this.props.defaultShow||a.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 i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?y.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 validity(){const i=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),s=this.normalizeTime(this.max),o=f.isInRange(i,t,s),u=this.props.validationMessage!==void 0,d=(!this.required||this.value!==null)&&o,h=this.props.valid!==void 0?this.props.valid:d;return{customError:u,rangeOverflow:f.isBiggerThanMax(i,s),rangeUnderflow:f.isSmallerThanMin(i,t),valid:h,valueMissing:this.value===null}}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=Z.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}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:a.defaultProps.required}get popupSettings(){return this.props.popupSettings||a.defaultProps.popupSettings}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 dateInputComp(){return this.props.dateInput||a.defaultProps.dateInput}get localizationService(){return I.provideLocalizationService(this)}componentDidMount(){var i;this.observerResize=n.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(){this._timeSelector&&this.show&&!this.prevShow?this._timeSelector.focusActiveList():this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=a.defaultProps.size,rounded:t=a.defaultProps.rounded,fillMode:s=a.defaultProps.fillMode,disabled:o,tabIndex:u,title:d,id:h,className:g,format:M,formatPlaceholder:P,width:D,name:O,steps:k,validationMessage:z,required:q,validityStyles:x,ariaLabelledBy:R,ariaDescribedBy:E,unstyled:v}=this.props,w=v&&v.uTimePicker,S=!this.validityStyles||this.validity.valid,B={disabled:o,format:M,formatPlaceholder:P,id:h,ariaLabelledBy:R,ariaDescribedBy:E,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:O,onChange:this.handleInputValueChange,required:q,steps:k,tabIndex:this.show?-1:u,title:d,valid:this.validity.valid,validationMessage:z,validityStyles:x,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.show,size:null,fillMode:null,rounded:null,readonly:this.mobileMode},V=this.localizationService.toLanguageString(l.toggleClock,l.messages[l.toggleClock]),F=this.localizationService.toLanguageString(l.toggleTimeSelector,l.messages[l.toggleTimeSelector]),b=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:N,onBlur:A})=>r.createElement(r.Fragment,null,r.createElement("span",{id:this.props.id,ref:L=>{this._element=L},className:n.classNames(n.uTimePicker.wrapper({c:w,size:i,rounded:t,fillMode:s,invalid:!S,required:this.required,disabled:o}),g),onKeyDown:this.handleKeyDown,style:{width:D},onFocus:N,onBlur:A,onClick:this.mobileMode?this.handleIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,...B}),r.createElement(X.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:j.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleIconClick,title:F,className:n.classNames(n.uTimePicker.inputButton({c:w})),rounded:null,fillMode:s,"aria-label":V}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(G.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:S,editorDisabled:this.props.disabled,children:b,style:{width:this.props.width}}):b}normalizeTime(i){return c.setTime(c.MIDNIGHT_DATE,i)}setShow(i){const{onOpen:t,onClose:s}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&s&&s.call(void 0,{target:this}))}mergeTime(i){return this.value&&i?c.setTime(this.value,i):i}calculateMedia(i){for(let t of i)this.setState({windowWidth:t.target.clientWidth})}};a.displayName="TimePicker",a.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}),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([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"])},a.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:c.MAX_TIME,min:c.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},required:!1,validityStyles:!0,dateInput:H.DateInput,size:"medium",rounded:"medium",fillMode:"solid"};let m=a;const T=n.createPropsContext(),C=n.withIdHOC(n.withPropsContext(T,n.withUnstyledHOC(m)));C.displayName="KendoReactTimePicker";I.registerForLocalization(m);exports.TimePicker=C;exports.TimePickerPropsContext=T;exports.TimePickerWithoutContext=m;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),e=require("prop-types"),K=require("@progress/kendo-react-popup"),y=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),j=require("@progress/kendo-svg-icons"),I=require("@progress/kendo-react-intl"),U=require("../package-metadata.js"),l=require("../messages/index.js"),H=require("../dateinput/DateInput.js"),W=require("./TimeSelector.js"),p=require("../utils.js"),f=require("./utils.js"),G=require("../hooks/usePickerFloatingLabel.js"),X=require("@progress/kendo-react-buttons"),Z=require("../common/constants.js"),$=require("../common/AdaptiveMode.js"),J=require("@progress/kendo-react-layout");function Q(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return i.default=c,Object.freeze(i)}const r=Q(_),a=class a extends r.Component{constructor(i){super(i),this._element=null,this._dateInput=r.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:s,nowButton:o,disabled:u,format:d,steps:h,unstyled:g}=this.props;return r.createElement(W.TimeSelector,{ref:this.setTimeSelectorRef,mobileMode:this.mobileMode,show:this.show,cancelButton:s,disabled:u,nowButton:o,format:d,min:this.min,max:this.max,steps:h,smoothScroll:t,value:this.value,footer:!this.mobileMode,handleTimeChange:this.mobileMode&&this.handleTimeChange,onChange:this.handleValueChange,onReject:this.handleValueReject,unstyled:g})},this.renderPopup=()=>{const{popupClass:t,...s}=this.popupSettings,{unstyled:o}=this.props,u=o&&o.uTimePicker,d=n.classNames(t),h={popupClass:n.uTimePicker.popup({c:u}),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"},...s};return this.props.popup?r.createElement(this.props.popup,{...h},this.renderTimeSelector()):r.createElement(K.Popup,{...h},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,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 r.createElement($.AdaptiveMode,{...s},r.createElement(J.ActionSheetContent,{overflowHidden:!0},this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},this.nextValue=(t,s)=>t.value!==void 0?t.value:s.value,this.nextShow=(t,s)=>t.show!==void 0?t.show:s.show,this.handleInputValueChange=t=>{const s=this.mergeTime(t.value);this.handleValueChange({...t,value:s})},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.shouldFocusDateInput=!0;const{onChange:s}=this.props,o=this.state.candidate||this.value;s&&s.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.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleValueReject=t=>{this.setShow(!1)},this.handleIconClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:s,keyCode:o}=t;if(o===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(o===n.Keys.up||o===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=o===n.Keys.up,this.setShow(o===n.Keys.down))},n.validatePackage(U.packageMetadata),this.state={value:this.props.defaultValue||a.defaultProps.defaultValue,show:this.props.defaultShow||a.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 i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?y.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 validity(){const i=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),s=this.normalizeTime(this.max),o=f.isInRange(i,t,s),u=this.props.validationMessage!==void 0,d=(!this.required||this.value!==null)&&o,h=this.props.valid!==void 0?this.props.valid:d;return{customError:u,rangeOverflow:f.isBiggerThanMax(i,s),rangeUnderflow:f.isSmallerThanMin(i,t),valid:h,valueMissing:this.value===null}}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=Z.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}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 popupSettings(){return this.props.popupSettings||a.defaultProps.popupSettings}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 dateInputComp(){return this.props.dateInput||a.defaultProps.dateInput}get localizationService(){return I.provideLocalizationService(this)}componentDidMount(){var i;this.observerResize=n.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(){this._timeSelector&&this.show&&!this.prevShow?this._timeSelector.focusActiveList():this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=a.defaultProps.size,rounded:t=a.defaultProps.rounded,fillMode:s=a.defaultProps.fillMode,disabled:o,tabIndex:u,title:d,id:h,className:g,format:M,formatPlaceholder:D,width:O,name:P,steps:k,validationMessage:z,required:q,validityStyles:x,ariaLabelledBy:R,ariaDescribedBy:E,unstyled:v}=this.props,w=v&&v.uTimePicker,S=!this.validityStyles||this.validity.valid,B={disabled:o,format:M,formatPlaceholder:D,id:h,ariaLabelledBy:R,ariaDescribedBy:E,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:P,onChange:this.handleInputValueChange,required:q,steps:k,tabIndex:this.show?-1:u,title:d,valid:this.validity.valid,validationMessage:z,validityStyles:x,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.show,size:null,fillMode:null,rounded:null,readonly:this.mobileMode},V=this.localizationService.toLanguageString(l.toggleClock,l.messages[l.toggleClock]),F=this.localizationService.toLanguageString(l.toggleTimeSelector,l.messages[l.toggleTimeSelector]),b=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:N,onBlur:A})=>r.createElement(r.Fragment,null,r.createElement("span",{id:this.props.id,ref:L=>{this._element=L},className:n.classNames(n.uTimePicker.wrapper({c:w,size:i,rounded:t,fillMode:s,invalid:!S,required:this.required,disabled:o}),g),onKeyDown:this.handleKeyDown,style:{width:O},onFocus:N,onBlur:A,onClick:this.mobileMode?this.handleIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,...B}),r.createElement(X.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:j.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleIconClick,title:F,className:n.classNames(n.uTimePicker.inputButton({c:w})),rounded:null,fillMode:s,"aria-label":V}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(G.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:S,editorDisabled:this.props.disabled,children:b,style:{width:this.props.width}}):b}normalizeTime(i){return p.setTime(p.MIDNIGHT_DATE,i)}setShow(i){const{onOpen:t,onClose:s}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&s&&s.call(void 0,{target:this}))}mergeTime(i){return this.value&&i?p.setTime(this.value,i):i}calculateMedia(i){for(const t of i)this.setState({windowWidth:t.target.clientWidth})}};a.displayName="TimePicker",a.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}),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([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"])},a.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:p.MAX_TIME,min:p.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},validityStyles:!0,dateInput:H.DateInput,size:"medium",rounded:"medium",fillMode:"solid"};let m=a;const T=n.createPropsContext(),C=n.withIdHOC(n.withPropsContext(T,n.withUnstyledHOC(m)));C.displayName="KendoReactTimePicker";I.registerForLocalization(m);exports.TimePicker=C;exports.TimePickerPropsContext=T;exports.TimePickerWithoutContext=m;
|
|
@@ -18,8 +18,8 @@ import { toggleClock as f, messages as u, timePickerCancel as $, timePickerSet a
|
|
|
18
18
|
import { DateInput as ee } from "../dateinput/DateInput.mjs";
|
|
19
19
|
import { TimeSelector as te } from "./TimeSelector.mjs";
|
|
20
20
|
import { MAX_TIME as ie, MIN_TIME as se, setTime as M, MIDNIGHT_DATE as oe } from "../utils.mjs";
|
|
21
|
-
import { isInRange as ne, isBiggerThanMax as ae, isSmallerThanMin as
|
|
22
|
-
import { PickerFloatingLabel as
|
|
21
|
+
import { isInRange as ne, isBiggerThanMax as ae, isSmallerThanMin as le } from "./utils.mjs";
|
|
22
|
+
import { PickerFloatingLabel as re } from "../hooks/usePickerFloatingLabel.mjs";
|
|
23
23
|
import { Button as he } from "@progress/kendo-react-buttons";
|
|
24
24
|
import { MOBILE_MEDIUM_DEVISE as de } from "../common/constants.mjs";
|
|
25
25
|
import { AdaptiveMode as ue } from "../common/AdaptiveMode.mjs";
|
|
@@ -29,7 +29,7 @@ const n = class n extends a.Component {
|
|
|
29
29
|
super(i), this._element = null, this._dateInput = a.createRef(), this._timeSelector = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.focus = () => {
|
|
30
30
|
this.dateInput && this.dateInput.focus();
|
|
31
31
|
}, this.renderTimeSelector = () => {
|
|
32
|
-
const { smoothScroll: t, cancelButton: s, nowButton: o, disabled:
|
|
32
|
+
const { smoothScroll: t, cancelButton: s, nowButton: o, disabled: r, format: h, steps: l, unstyled: m } = this.props;
|
|
33
33
|
return /* @__PURE__ */ a.createElement(
|
|
34
34
|
te,
|
|
35
35
|
{
|
|
@@ -37,12 +37,12 @@ const n = class n extends a.Component {
|
|
|
37
37
|
mobileMode: this.mobileMode,
|
|
38
38
|
show: this.show,
|
|
39
39
|
cancelButton: s,
|
|
40
|
-
disabled:
|
|
40
|
+
disabled: r,
|
|
41
41
|
nowButton: o,
|
|
42
42
|
format: h,
|
|
43
43
|
min: this.min,
|
|
44
44
|
max: this.max,
|
|
45
|
-
steps:
|
|
45
|
+
steps: l,
|
|
46
46
|
smoothScroll: t,
|
|
47
47
|
value: this.value,
|
|
48
48
|
footer: !this.mobileMode,
|
|
@@ -53,10 +53,10 @@ const n = class n extends a.Component {
|
|
|
53
53
|
}
|
|
54
54
|
);
|
|
55
55
|
}, this.renderPopup = () => {
|
|
56
|
-
const { popupClass: t, ...s } = this.popupSettings, { unstyled: o } = this.props,
|
|
56
|
+
const { popupClass: t, ...s } = this.popupSettings, { unstyled: o } = this.props, r = o && o.uTimePicker, h = c(
|
|
57
57
|
t
|
|
58
|
-
),
|
|
59
|
-
popupClass: g.popup({ c:
|
|
58
|
+
), l = {
|
|
59
|
+
popupClass: g.popup({ c: r }),
|
|
60
60
|
show: this.show,
|
|
61
61
|
animate: this.element !== null,
|
|
62
62
|
anchor: this.element,
|
|
@@ -72,7 +72,7 @@ const n = class n extends a.Component {
|
|
|
72
72
|
},
|
|
73
73
|
...s
|
|
74
74
|
};
|
|
75
|
-
return this.props.popup ? /* @__PURE__ */ a.createElement(this.props.popup, { ...
|
|
75
|
+
return this.props.popup ? /* @__PURE__ */ a.createElement(this.props.popup, { ...l }, this.renderTimeSelector()) : /* @__PURE__ */ a.createElement(U, { ...l }, this.renderTimeSelector());
|
|
76
76
|
}, this.renderAdaptivePopup = () => {
|
|
77
77
|
const { windowWidth: t = 0 } = this.state, s = {
|
|
78
78
|
expand: this.show,
|
|
@@ -178,12 +178,12 @@ const n = class n extends a.Component {
|
|
|
178
178
|
* Represents the validity state into which the TimePicker is set.
|
|
179
179
|
*/
|
|
180
180
|
get validity() {
|
|
181
|
-
const i = this.value && this.normalizeTime(this.value), t = this.normalizeTime(this.min), s = this.normalizeTime(this.max), o = ne(i, t, s),
|
|
181
|
+
const i = this.value && this.normalizeTime(this.value), t = this.normalizeTime(this.min), s = this.normalizeTime(this.max), o = ne(i, t, s), r = this.props.validationMessage !== void 0, h = (!this.required || this.value !== null) && o, l = this.props.valid !== void 0 ? this.props.valid : h;
|
|
182
182
|
return {
|
|
183
|
-
customError:
|
|
183
|
+
customError: r,
|
|
184
184
|
rangeOverflow: ae(i, s),
|
|
185
|
-
rangeUnderflow:
|
|
186
|
-
valid:
|
|
185
|
+
rangeUnderflow: le(i, t),
|
|
186
|
+
valid: l,
|
|
187
187
|
valueMissing: this.value === null
|
|
188
188
|
};
|
|
189
189
|
}
|
|
@@ -203,7 +203,7 @@ const n = class n extends a.Component {
|
|
|
203
203
|
* @hidden
|
|
204
204
|
*/
|
|
205
205
|
get required() {
|
|
206
|
-
return this.props.required !== void 0 ? this.props.required :
|
|
206
|
+
return this.props.required !== void 0 ? this.props.required : !1;
|
|
207
207
|
}
|
|
208
208
|
get popupSettings() {
|
|
209
209
|
return this.props.popupSettings || n.defaultProps.popupSettings;
|
|
@@ -249,9 +249,9 @@ const n = class n extends a.Component {
|
|
|
249
249
|
rounded: t = n.defaultProps.rounded,
|
|
250
250
|
fillMode: s = n.defaultProps.fillMode,
|
|
251
251
|
disabled: o,
|
|
252
|
-
tabIndex:
|
|
252
|
+
tabIndex: r,
|
|
253
253
|
title: h,
|
|
254
|
-
id:
|
|
254
|
+
id: l,
|
|
255
255
|
className: m,
|
|
256
256
|
format: D,
|
|
257
257
|
formatPlaceholder: O,
|
|
@@ -268,7 +268,7 @@ const n = class n extends a.Component {
|
|
|
268
268
|
disabled: o,
|
|
269
269
|
format: D,
|
|
270
270
|
formatPlaceholder: O,
|
|
271
|
-
id:
|
|
271
|
+
id: l,
|
|
272
272
|
ariaLabelledBy: R,
|
|
273
273
|
ariaDescribedBy: V,
|
|
274
274
|
max: this.normalizeTime(this.max),
|
|
@@ -277,7 +277,7 @@ const n = class n extends a.Component {
|
|
|
277
277
|
onChange: this.handleInputValueChange,
|
|
278
278
|
required: k,
|
|
279
279
|
steps: x,
|
|
280
|
-
tabIndex: this.show ? -1 :
|
|
280
|
+
tabIndex: this.show ? -1 : r,
|
|
281
281
|
title: h,
|
|
282
282
|
valid: this.validity.valid,
|
|
283
283
|
validationMessage: E,
|
|
@@ -299,12 +299,12 @@ const n = class n extends a.Component {
|
|
|
299
299
|
onSyncBlur: this.props.onBlur,
|
|
300
300
|
onSyncFocus: this.props.onFocus
|
|
301
301
|
},
|
|
302
|
-
({ onFocus: L, onBlur:
|
|
302
|
+
({ onFocus: L, onBlur: _ }) => /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
|
|
303
303
|
"span",
|
|
304
304
|
{
|
|
305
305
|
id: this.props.id,
|
|
306
|
-
ref: (
|
|
307
|
-
this._element =
|
|
306
|
+
ref: (q) => {
|
|
307
|
+
this._element = q;
|
|
308
308
|
},
|
|
309
309
|
className: c(
|
|
310
310
|
g.wrapper({
|
|
@@ -321,7 +321,7 @@ const n = class n extends a.Component {
|
|
|
321
321
|
onKeyDown: this.handleKeyDown,
|
|
322
322
|
style: { width: P },
|
|
323
323
|
onFocus: L,
|
|
324
|
-
onBlur:
|
|
324
|
+
onBlur: _,
|
|
325
325
|
onClick: this.mobileMode ? this.handleIconClick : void 0
|
|
326
326
|
},
|
|
327
327
|
/* @__PURE__ */ a.createElement(
|
|
@@ -353,11 +353,11 @@ const n = class n extends a.Component {
|
|
|
353
353
|
), this.mobileMode && this.renderAdaptivePopup())
|
|
354
354
|
);
|
|
355
355
|
return this.props.label ? /* @__PURE__ */ a.createElement(
|
|
356
|
-
|
|
356
|
+
re,
|
|
357
357
|
{
|
|
358
358
|
dateInput: this._dateInput,
|
|
359
359
|
label: this.props.label,
|
|
360
|
-
editorId:
|
|
360
|
+
editorId: l,
|
|
361
361
|
editorValid: S,
|
|
362
362
|
editorDisabled: this.props.disabled,
|
|
363
363
|
children: b,
|
|
@@ -380,7 +380,7 @@ const n = class n extends a.Component {
|
|
|
380
380
|
return this.value && i ? M(this.value, i) : i;
|
|
381
381
|
}
|
|
382
382
|
calculateMedia(i) {
|
|
383
|
-
for (
|
|
383
|
+
for (const t of i)
|
|
384
384
|
this.setState({ windowWidth: t.target.clientWidth });
|
|
385
385
|
}
|
|
386
386
|
};
|
|
@@ -461,7 +461,6 @@ n.displayName = "TimePicker", n.propTypes = {
|
|
|
461
461
|
popupSettings: {},
|
|
462
462
|
tabIndex: 0,
|
|
463
463
|
steps: {},
|
|
464
|
-
required: !1,
|
|
465
464
|
validityStyles: !0,
|
|
466
465
|
dateInput: ee,
|
|
467
466
|
size: "medium",
|
package/utils.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@progress/kendo-date-math"),y=require("./calendar/models/SelectionRange.js");function S(t){const e=(r,o,s,...
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@progress/kendo-date-math"),y=require("./calendar/models/SelectionRange.js");function S(t){const e=(r,o,s,...c)=>o[s]===null?null:(r?t.isRequired:t)(o,s,...c),n=e.bind(null,!1);return n.isRequired=e.bind(null,!0),n}const w=(t,e,n)=>e===void 0||n===void 0||e<=t&&t<=n?t:t<e?e:n,C=new Date(1980,0,1),F=new Date(1900,0,1),k=new Date(2099,11,31),W=new Date(1980,0,1),q=new Date(1980,0,1,23,59,59),H=(t,e)=>{const n=l.cloneDate(t);return n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n},L=()=>l.getDate(new Date),X=(t,e,n)=>!t||!(e&&e>t||n&&n<t),G=(t,e,n)=>t===null||!(e&&l.getDate(e)>l.getDate(t)||n&&l.getDate(n)<l.getDate(t)),O=(t,e)=>{const{start:n,end:r}=e||y.EMPTY_SELECTIONRANGE;return!n||!r?!1:n<t&&t<r},j=(t,e,n=1)=>{const r=[];for(let o=t;o<e;o=o+n)r.push(o);return r},P=(t,e,n)=>e.getTime()<=t.getTime()&&t.getTime()<=n.getTime(),Y=(t,e)=>t.slice(e).concat(t.slice(0,e)),z=(t,e,n)=>t&&(e&&t<e?l.cloneDate(e):n&&t>n?l.cloneDate(n):t),B=t=>(e,n="",r={})=>{const o=document.createElement(t);return o.className=n,Object.keys(r).map(s=>o.style[s]=r[s]),typeof e=="string"?o.innerHTML=e||"":(e||[]).forEach(s=>s&&o.appendChild(s)),o};function J(t,e,n={}){let r,o;n.maxWait;let s,c,a;const f=window,v=!1,R=!1,I=!e&&e!==0&&typeof f.requestAnimationFrame=="function";if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;function E(i){const u=r,T=o;return r=o=void 0,s=t.apply(T,u),s}function m(i,u){return I?(f.cancelAnimationFrame(c),f.requestAnimationFrame(i)):setTimeout(i,u)}function p(i){if(I)return f.cancelAnimationFrame(i);clearTimeout(i)}function b(i){return c=m(D,e),v?E():s}function d(i){const u=i-a;return e-u}function M(i){const u=i-a;return a===void 0||u>=e||u<0||R}function D(){const i=Date.now();if(M(i))return A();c=m(D,d(i))}function A(i){return c=void 0,r?E():(r=o=void 0,s)}function h(){c!==void 0&&p(c),r=a=o=c=void 0}function N(){return c===void 0?s:A()}function _(){return c!==void 0}function g(...i){const u=Date.now(),T=M(u);return r=i,o=this,a=u,T&&c===void 0?b():(c===void 0&&(c=m(D,e)),s)}return g.cancel=h,g.flush=N,g.pending=_,g}exports.MAX_DATE=k;exports.MAX_TIME=q;exports.MIDNIGHT_DATE=C;exports.MIN_DATE=F;exports.MIN_TIME=W;exports.dateInRange=z;exports.debounce=J;exports.domContainerFactory=B;exports.getToday=L;exports.intersects=P;exports.isInDateRange=G;exports.isInRange=X;exports.isInSelectionRange=O;exports.nullable=S;exports.range=j;exports.setTime=H;exports.shiftWeekNames=Y;exports.viewInRange=w;
|
package/utils.mjs
CHANGED
|
@@ -8,43 +8,36 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import { getDate as f, cloneDate as v } from "@progress/kendo-date-math";
|
|
10
10
|
import { EMPTY_SELECTIONRANGE as F } from "./calendar/models/SelectionRange.mjs";
|
|
11
|
-
function W(
|
|
12
|
-
const
|
|
13
|
-
return
|
|
11
|
+
function W(e) {
|
|
12
|
+
const n = (r, o, s, ...u) => o[s] === null ? null : (r ? e.isRequired : e)(o, s, ...u), t = n.bind(null, !1);
|
|
13
|
+
return t.isRequired = n.bind(null, !0), t;
|
|
14
14
|
}
|
|
15
|
-
const d = (
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
), n;
|
|
23
|
-
}, X = () => f(/* @__PURE__ */ new Date()), j = (t, e, n) => !t || !(e && e > t || n && n < t), P = (t, e, n) => t === null || !(e && f(e) > f(t) || n && f(n) < f(t)), Y = (t, e) => {
|
|
24
|
-
const { start: n, end: r } = e || F;
|
|
25
|
-
return !n || !r ? !1 : n < t && t < r;
|
|
26
|
-
}, z = (t, e, n = 1) => {
|
|
15
|
+
const d = (e, n, t) => n === void 0 || t === void 0 || n <= e && e <= t ? e : e < n ? n : t, k = new Date(1980, 0, 1), H = new Date(1900, 0, 1), L = new Date(2099, 11, 31), q = new Date(1980, 0, 1), G = new Date(1980, 0, 1, 23, 59, 59), O = (e, n) => {
|
|
16
|
+
const t = v(e);
|
|
17
|
+
return t.setHours(n.getHours(), n.getMinutes(), n.getSeconds(), n.getMilliseconds()), t;
|
|
18
|
+
}, X = () => f(/* @__PURE__ */ new Date()), j = (e, n, t) => !e || !(n && n > e || t && t < e), P = (e, n, t) => e === null || !(n && f(n) > f(e) || t && f(t) < f(e)), Y = (e, n) => {
|
|
19
|
+
const { start: t, end: r } = n || F;
|
|
20
|
+
return !t || !r ? !1 : t < e && e < r;
|
|
21
|
+
}, z = (e, n, t = 1) => {
|
|
27
22
|
const r = [];
|
|
28
|
-
for (let o =
|
|
23
|
+
for (let o = e; o < n; o = o + t)
|
|
29
24
|
r.push(o);
|
|
30
25
|
return r;
|
|
31
|
-
}, B = (
|
|
32
|
-
const o = document.createElement(
|
|
33
|
-
return o.className =
|
|
26
|
+
}, B = (e, n, t) => n.getTime() <= e.getTime() && e.getTime() <= t.getTime(), J = (e, n) => e.slice(n).concat(e.slice(0, n)), K = (e, n, t) => e && (n && e < n ? v(n) : t && e > t ? v(t) : e), Q = (e) => (n, t = "", r = {}) => {
|
|
27
|
+
const o = document.createElement(e);
|
|
28
|
+
return o.className = t, Object.keys(r).map((s) => o.style[s] = r[s]), typeof n == "string" ? o.innerHTML = n || "" : (n || []).forEach((s) => s && o.appendChild(s)), o;
|
|
34
29
|
};
|
|
35
|
-
function U(
|
|
30
|
+
function U(e, n, t = {}) {
|
|
36
31
|
let r, o;
|
|
37
|
-
|
|
32
|
+
t.maxWait;
|
|
38
33
|
let s, u, l;
|
|
39
|
-
const g = window;
|
|
40
|
-
|
|
41
|
-
const D = !e && e !== 0 && typeof g.requestAnimationFrame == "function";
|
|
42
|
-
if (typeof t != "function")
|
|
34
|
+
const g = window, M = !1, h = !1, D = !n && n !== 0 && typeof g.requestAnimationFrame == "function";
|
|
35
|
+
if (typeof e != "function")
|
|
43
36
|
throw new TypeError("Expected a function");
|
|
44
|
-
|
|
37
|
+
n = +n || 0;
|
|
45
38
|
function I(i) {
|
|
46
39
|
const c = r, m = o;
|
|
47
|
-
return r = o = void 0, s =
|
|
40
|
+
return r = o = void 0, s = e.apply(m, c), s;
|
|
48
41
|
}
|
|
49
42
|
function T(i, c) {
|
|
50
43
|
return D ? (g.cancelAnimationFrame(u), g.requestAnimationFrame(i)) : setTimeout(i, c);
|
|
@@ -55,15 +48,15 @@ function U(t, e, n = {}) {
|
|
|
55
48
|
clearTimeout(i);
|
|
56
49
|
}
|
|
57
50
|
function b(i) {
|
|
58
|
-
return u = T(E,
|
|
51
|
+
return u = T(E, n), M ? I() : s;
|
|
59
52
|
}
|
|
60
53
|
function N(i) {
|
|
61
54
|
const c = i - l;
|
|
62
|
-
return
|
|
55
|
+
return n - c;
|
|
63
56
|
}
|
|
64
57
|
function p(i) {
|
|
65
58
|
const c = i - l;
|
|
66
|
-
return l === void 0 || c >=
|
|
59
|
+
return l === void 0 || c >= n || c < 0 || h;
|
|
67
60
|
}
|
|
68
61
|
function E() {
|
|
69
62
|
const i = Date.now();
|
|
@@ -85,7 +78,7 @@ function U(t, e, n = {}) {
|
|
|
85
78
|
}
|
|
86
79
|
function a(...i) {
|
|
87
80
|
const c = Date.now(), m = p(c);
|
|
88
|
-
return r = i, o = this, l = c, m && u === void 0 ? b() : (u === void 0 && (u = T(E,
|
|
81
|
+
return r = i, o = this, l = c, m && u === void 0 ? b() : (u === void 0 && (u = T(E, n)), s);
|
|
89
82
|
}
|
|
90
83
|
return a.cancel = w, a.flush = y, a.pending = C, a;
|
|
91
84
|
}
|