@progress/kendo-react-dateinputs 11.0.0-develop.1 → 11.0.0-develop.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +14 -13
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +166 -159
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +17 -15
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +49 -46
- package/datetimepicker/DateTimeSelector.js +1 -1
- package/datetimepicker/DateTimeSelector.mjs +23 -21
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +42 -6
- package/index.d.ts +42 -6
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +39 -37
- package/timepicker/TimeSelector.js +1 -1
- package/timepicker/TimeSelector.mjs +49 -48
- package/utils.js +1 -1
- package/utils.mjs +3 -1
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +1 -1
package/index.d.mts
CHANGED
|
@@ -1407,12 +1407,21 @@ export declare interface DatePickerProps extends DatePickerSettings, FormCompone
|
|
|
1407
1407
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
1408
1408
|
/**
|
|
1409
1409
|
* Providing different rendering of the popup element based on the screen dimensions.
|
|
1410
|
+
*
|
|
1411
|
+
* @default `false`
|
|
1410
1412
|
*/
|
|
1411
1413
|
adaptive?: boolean;
|
|
1412
1414
|
/**
|
|
1413
|
-
* Specifies the text that is rendered as title in the adaptive popup.
|
|
1415
|
+
* Specifies the text that is rendered as title in the adaptive popup(action sheet).
|
|
1416
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1417
|
+
* If not provided, the title will be the same as the label.
|
|
1414
1418
|
*/
|
|
1415
1419
|
adaptiveTitle?: string;
|
|
1420
|
+
/**
|
|
1421
|
+
* Specifies the text that is rendered as subtitle in the adaptive popup(action sheet).
|
|
1422
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1423
|
+
*/
|
|
1424
|
+
adaptiveSubtitle?: string;
|
|
1416
1425
|
/**
|
|
1417
1426
|
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the DatePicker. (Defaults to `false`)
|
|
1418
1427
|
*/
|
|
@@ -1825,12 +1834,21 @@ export declare interface DateRangePickerProps extends DateRangePickerSettings {
|
|
|
1825
1834
|
value?: SelectionRange;
|
|
1826
1835
|
/**
|
|
1827
1836
|
* Providing different rendering of the popup element based on the screen dimensions.
|
|
1837
|
+
*
|
|
1838
|
+
* @default `false`
|
|
1828
1839
|
*/
|
|
1829
1840
|
adaptive?: boolean;
|
|
1830
1841
|
/**
|
|
1831
|
-
* Specifies the text that is rendered as title in the adaptive popup.
|
|
1842
|
+
* Specifies the text that is rendered as title in the adaptive popup(action sheet).
|
|
1843
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1844
|
+
* If not provided, the title will be the same as the label.
|
|
1832
1845
|
*/
|
|
1833
1846
|
adaptiveTitle?: string;
|
|
1847
|
+
/**
|
|
1848
|
+
* Specifies the text that is rendered as subtitle in the adaptive popup(action sheet).
|
|
1849
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1850
|
+
*/
|
|
1851
|
+
adaptiveSubtitle?: string;
|
|
1834
1852
|
/**
|
|
1835
1853
|
* If `clearButton` is set to `true`, the DateRangePicker renders a button next to the start and end date values. Clicking this button resets the value of the date and triggers the `change` event.
|
|
1836
1854
|
*/
|
|
@@ -2286,12 +2304,21 @@ export declare interface DateTimePickerProps extends DateTimePickerSettings, For
|
|
|
2286
2304
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
2287
2305
|
/**
|
|
2288
2306
|
* Providing different rendering of the popup element based on the screen dimensions.
|
|
2307
|
+
*
|
|
2308
|
+
* @default `false`
|
|
2289
2309
|
*/
|
|
2290
2310
|
adaptive?: boolean;
|
|
2291
2311
|
/**
|
|
2292
|
-
* Specifies the text that is rendered as title in the adaptive popup.
|
|
2312
|
+
* Specifies the text that is rendered as title in the adaptive popup(action sheet).
|
|
2313
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
2314
|
+
* If not provided, the title will be the same as the label.
|
|
2293
2315
|
*/
|
|
2294
2316
|
adaptiveTitle?: string;
|
|
2317
|
+
/**
|
|
2318
|
+
* Specifies the text that is rendered as subtitle in the adaptive popup(action sheet).
|
|
2319
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
2320
|
+
*/
|
|
2321
|
+
adaptiveSubtitle?: string;
|
|
2295
2322
|
/**
|
|
2296
2323
|
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the DateTimePicker. (Defaults to `false`)
|
|
2297
2324
|
*/
|
|
@@ -2660,7 +2687,7 @@ export declare class DateTimePickerWithoutContext extends React_2.Component<Date
|
|
|
2660
2687
|
private handleValueChange;
|
|
2661
2688
|
private handleFocus;
|
|
2662
2689
|
private handleBlur;
|
|
2663
|
-
private
|
|
2690
|
+
private handleClick;
|
|
2664
2691
|
private handleIconMouseDown;
|
|
2665
2692
|
private handleKeyDown;
|
|
2666
2693
|
private dateInputElement;
|
|
@@ -3928,12 +3955,21 @@ export declare interface TimePickerProps extends TimePickerSettings, FormCompone
|
|
|
3928
3955
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
3929
3956
|
/**
|
|
3930
3957
|
* Providing different rendering of the popup element based on the screen dimensions.
|
|
3958
|
+
*
|
|
3959
|
+
* @default `false`
|
|
3931
3960
|
*/
|
|
3932
3961
|
adaptive?: boolean;
|
|
3933
3962
|
/**
|
|
3934
|
-
* Specifies the text that is rendered as title in the adaptive popup.
|
|
3963
|
+
* Specifies the text that is rendered as title in the adaptive popup(action sheet).
|
|
3964
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
3965
|
+
* If not provided, the title will be the same as the label.
|
|
3935
3966
|
*/
|
|
3936
3967
|
adaptiveTitle?: string;
|
|
3968
|
+
/**
|
|
3969
|
+
* Specifies the text that is rendered as subtitle in the adaptive popup(action sheet).
|
|
3970
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
3971
|
+
*/
|
|
3972
|
+
adaptiveSubtitle?: string;
|
|
3937
3973
|
/**
|
|
3938
3974
|
* @hidden
|
|
3939
3975
|
*/
|
|
@@ -4286,7 +4322,7 @@ export declare class TimePickerWithoutContext extends React_2.Component<TimePick
|
|
|
4286
4322
|
private handleFocus;
|
|
4287
4323
|
private handleBlur;
|
|
4288
4324
|
private handleValueReject;
|
|
4289
|
-
private
|
|
4325
|
+
private handleClick;
|
|
4290
4326
|
private handleIconMouseDown;
|
|
4291
4327
|
private handleKeyDown;
|
|
4292
4328
|
private calculateMedia;
|
package/index.d.ts
CHANGED
|
@@ -1407,12 +1407,21 @@ export declare interface DatePickerProps extends DatePickerSettings, FormCompone
|
|
|
1407
1407
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
1408
1408
|
/**
|
|
1409
1409
|
* Providing different rendering of the popup element based on the screen dimensions.
|
|
1410
|
+
*
|
|
1411
|
+
* @default `false`
|
|
1410
1412
|
*/
|
|
1411
1413
|
adaptive?: boolean;
|
|
1412
1414
|
/**
|
|
1413
|
-
* Specifies the text that is rendered as title in the adaptive popup.
|
|
1415
|
+
* Specifies the text that is rendered as title in the adaptive popup(action sheet).
|
|
1416
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1417
|
+
* If not provided, the title will be the same as the label.
|
|
1414
1418
|
*/
|
|
1415
1419
|
adaptiveTitle?: string;
|
|
1420
|
+
/**
|
|
1421
|
+
* Specifies the text that is rendered as subtitle in the adaptive popup(action sheet).
|
|
1422
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1423
|
+
*/
|
|
1424
|
+
adaptiveSubtitle?: string;
|
|
1416
1425
|
/**
|
|
1417
1426
|
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the DatePicker. (Defaults to `false`)
|
|
1418
1427
|
*/
|
|
@@ -1825,12 +1834,21 @@ export declare interface DateRangePickerProps extends DateRangePickerSettings {
|
|
|
1825
1834
|
value?: SelectionRange;
|
|
1826
1835
|
/**
|
|
1827
1836
|
* Providing different rendering of the popup element based on the screen dimensions.
|
|
1837
|
+
*
|
|
1838
|
+
* @default `false`
|
|
1828
1839
|
*/
|
|
1829
1840
|
adaptive?: boolean;
|
|
1830
1841
|
/**
|
|
1831
|
-
* Specifies the text that is rendered as title in the adaptive popup.
|
|
1842
|
+
* Specifies the text that is rendered as title in the adaptive popup(action sheet).
|
|
1843
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1844
|
+
* If not provided, the title will be the same as the label.
|
|
1832
1845
|
*/
|
|
1833
1846
|
adaptiveTitle?: string;
|
|
1847
|
+
/**
|
|
1848
|
+
* Specifies the text that is rendered as subtitle in the adaptive popup(action sheet).
|
|
1849
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
1850
|
+
*/
|
|
1851
|
+
adaptiveSubtitle?: string;
|
|
1834
1852
|
/**
|
|
1835
1853
|
* If `clearButton` is set to `true`, the DateRangePicker renders a button next to the start and end date values. Clicking this button resets the value of the date and triggers the `change` event.
|
|
1836
1854
|
*/
|
|
@@ -2286,12 +2304,21 @@ export declare interface DateTimePickerProps extends DateTimePickerSettings, For
|
|
|
2286
2304
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
2287
2305
|
/**
|
|
2288
2306
|
* Providing different rendering of the popup element based on the screen dimensions.
|
|
2307
|
+
*
|
|
2308
|
+
* @default `false`
|
|
2289
2309
|
*/
|
|
2290
2310
|
adaptive?: boolean;
|
|
2291
2311
|
/**
|
|
2292
|
-
* Specifies the text that is rendered as title in the adaptive popup.
|
|
2312
|
+
* Specifies the text that is rendered as title in the adaptive popup(action sheet).
|
|
2313
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
2314
|
+
* If not provided, the title will be the same as the label.
|
|
2293
2315
|
*/
|
|
2294
2316
|
adaptiveTitle?: string;
|
|
2317
|
+
/**
|
|
2318
|
+
* Specifies the text that is rendered as subtitle in the adaptive popup(action sheet).
|
|
2319
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
2320
|
+
*/
|
|
2321
|
+
adaptiveSubtitle?: string;
|
|
2295
2322
|
/**
|
|
2296
2323
|
* Represents the `autoFocus` HTML attribute that will be applied to the input element of the DateTimePicker. (Defaults to `false`)
|
|
2297
2324
|
*/
|
|
@@ -2660,7 +2687,7 @@ export declare class DateTimePickerWithoutContext extends React_2.Component<Date
|
|
|
2660
2687
|
private handleValueChange;
|
|
2661
2688
|
private handleFocus;
|
|
2662
2689
|
private handleBlur;
|
|
2663
|
-
private
|
|
2690
|
+
private handleClick;
|
|
2664
2691
|
private handleIconMouseDown;
|
|
2665
2692
|
private handleKeyDown;
|
|
2666
2693
|
private dateInputElement;
|
|
@@ -3928,12 +3955,21 @@ export declare interface TimePickerProps extends TimePickerSettings, FormCompone
|
|
|
3928
3955
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
3929
3956
|
/**
|
|
3930
3957
|
* Providing different rendering of the popup element based on the screen dimensions.
|
|
3958
|
+
*
|
|
3959
|
+
* @default `false`
|
|
3931
3960
|
*/
|
|
3932
3961
|
adaptive?: boolean;
|
|
3933
3962
|
/**
|
|
3934
|
-
* Specifies the text that is rendered as title in the adaptive popup.
|
|
3963
|
+
* Specifies the text that is rendered as title in the adaptive popup(action sheet).
|
|
3964
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
3965
|
+
* If not provided, the title will be the same as the label.
|
|
3935
3966
|
*/
|
|
3936
3967
|
adaptiveTitle?: string;
|
|
3968
|
+
/**
|
|
3969
|
+
* Specifies the text that is rendered as subtitle in the adaptive popup(action sheet).
|
|
3970
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
3971
|
+
*/
|
|
3972
|
+
adaptiveSubtitle?: string;
|
|
3937
3973
|
/**
|
|
3938
3974
|
* @hidden
|
|
3939
3975
|
*/
|
|
@@ -4286,7 +4322,7 @@ export declare class TimePickerWithoutContext extends React_2.Component<TimePick
|
|
|
4286
4322
|
private handleFocus;
|
|
4287
4323
|
private handleBlur;
|
|
4288
4324
|
private handleValueReject;
|
|
4289
|
-
private
|
|
4325
|
+
private handleClick;
|
|
4290
4326
|
private handleIconMouseDown;
|
|
4291
4327
|
private handleKeyDown;
|
|
4292
4328
|
private calculateMedia;
|
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={name:"@progress/kendo-react-dateinputs",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-dateinputs",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1747133152,version:"11.0.0-develop.10",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
|
@@ -10,8 +10,8 @@ const e = {
|
|
|
10
10
|
productName: "KendoReact",
|
|
11
11
|
productCode: "KENDOUIREACT",
|
|
12
12
|
productCodes: ["KENDOUIREACT"],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: "11.0.0-develop.
|
|
13
|
+
publishDate: 1747133152,
|
|
14
|
+
version: "11.0.0-develop.10",
|
|
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
|
};
|
|
17
17
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-dateinputs",
|
|
3
|
-
"version": "11.0.0-develop.
|
|
3
|
+
"version": "11.0.0-develop.10",
|
|
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.5.1",
|
|
30
30
|
"@progress/kendo-dateinputs-common": "^0.4.0",
|
|
31
|
-
"@progress/kendo-react-buttons": "11.0.0-develop.
|
|
32
|
-
"@progress/kendo-react-common": "11.0.0-develop.
|
|
33
|
-
"@progress/kendo-react-intl": "11.0.0-develop.
|
|
34
|
-
"@progress/kendo-react-labels": "11.0.0-develop.
|
|
35
|
-
"@progress/kendo-react-layout": "11.0.0-develop.
|
|
36
|
-
"@progress/kendo-react-popup": "11.0.0-develop.
|
|
31
|
+
"@progress/kendo-react-buttons": "11.0.0-develop.10",
|
|
32
|
+
"@progress/kendo-react-common": "11.0.0-develop.10",
|
|
33
|
+
"@progress/kendo-react-intl": "11.0.0-develop.10",
|
|
34
|
+
"@progress/kendo-react-labels": "11.0.0-develop.10",
|
|
35
|
+
"@progress/kendo-react-layout": "11.0.0-develop.10",
|
|
36
|
+
"@progress/kendo-react-popup": "11.0.0-develop.10",
|
|
37
37
|
"@progress/kendo-svg-icons": "^4.0.0",
|
|
38
38
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
39
39
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"package": {
|
|
70
70
|
"productName": "KendoReact",
|
|
71
71
|
"productCode": "KENDOUIREACT",
|
|
72
|
-
"publishDate":
|
|
72
|
+
"publishDate": 1747133152,
|
|
73
73
|
"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"
|
|
74
74
|
}
|
|
75
75
|
},
|
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 G=require("react"),e=require("prop-types"),X=require("@progress/kendo-react-popup"),y=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),Z=require("@progress/kendo-svg-icons"),T=require("@progress/kendo-react-intl"),$=require("../package-metadata.js"),l=require("../messages/index.js"),J=require("../dateinput/DateInput.js"),Q=require("./TimeSelector.js"),c=require("../utils.js"),f=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(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 a=se(G),r=class r extends a.Component{constructor(i){super(i),this._element=null,this._dateInput=a.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.showLicenseWatermark=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:s,nowButton:n,disabled:u,format:d,steps:h,unstyled:g}=this.props;return a.createElement(Q.TimeSelector,{ref:this.setTimeSelectorRef,mobileMode:this.mobileMode,show:this.show,cancelButton:s,disabled:u,nowButton:n,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:n}=this.props,u=n&&n.uTimePicker,d=o.classNames(t),h={popupClass:o.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?a.createElement(this.props.popup,{...h},this.renderTimeSelector()):a.createElement(X.Popup,{...h},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s={expand:this.show,onClose:this.handleBlur,title: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:n=>this.handleValueChange(n)}};return a.createElement(te.AdaptiveMode,{...s},a.createElement(ie.ActionSheetContent,null,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,n=this.state.candidate||this.value;s&&s.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:n,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:n}=t;if(n===o.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(n===o.Keys.up||n===o.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=n===o.Keys.up,this.setShow(n===o.Keys.down))},this.showLicenseWatermark=!o.validatePackage($.packageMetadata,{component:"TimePicker"}),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(o.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),n=f.isInRange(i,t,s),u=this.props.validationMessage!==void 0,d=(!this.required||this.value!==null)&&n,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(){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 T.provideLocalizationService(this)}componentDidMount(){var i;this.observerResize=o.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=r.defaultProps.size,rounded:t=r.defaultProps.rounded,fillMode:s=r.defaultProps.fillMode,disabled:n,tabIndex:u,title:d,id:h,className:g,format:P,formatPlaceholder:M,width:O,name:k,steps:D,validationMessage:z,required:x,validityStyles:q,ariaLabelledBy:R,ariaDescribedBy:E,unstyled:v,enableMouseWheel:B,autoCorrectParts:A,autoSwitchParts:F,autoSwitchKeys:V,allowCaretMode:L,inputAttributes:N}=this.props,w=v&&v.uTimePicker,b=!this.validityStyles||this.validity.valid,_={disabled:n,format:P,formatPlaceholder:M,id:h,ariaLabelledBy:R,ariaDescribedBy:E,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:k,onChange:this.handleInputValueChange,required:x,steps:D,tabIndex:this.show?-1:u,title:d,valid:this.validity.valid,validationMessage:z,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,size:null,fillMode:null,rounded:null,enableMouseWheel:B,autoCorrectParts:A,autoSwitchParts:F,autoSwitchKeys:V,allowCaretMode:L,inputAttributes:N},K=this.localizationService.toLanguageString(l.toggleClock,l.messages[l.toggleClock]),j=this.localizationService.toLanguageString(l.toggleTimeSelector,l.messages[l.toggleTimeSelector]),S=a.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:W,onBlur:U})=>a.createElement(a.Fragment,null,a.createElement("span",{id:this.props.id,ref:H=>{this._element=H},className:o.classNames(o.uTimePicker.wrapper({c:w,size:i,rounded:t,fillMode:s,invalid:!b,required:this.required,disabled:n}),g),onKeyDown:this.handleKeyDown,style:{width:O},onFocus:W,onBlur:U,onClick:this.mobileMode?this.handleIconClick:void 0},a.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,..._}),a.createElement(ee.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:Z.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleIconClick,title:j,className:o.classNames(o.uTimePicker.inputButton({c:w})),rounded:null,fillMode:s,"aria-label":K}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&a.createElement(o.WatermarkOverlay,null)));return this.props.label?a.createElement(Y.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:b,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}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(const t of i)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,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"]),inputAttributes:e.object},r.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:c.MAX_TIME,min:c.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},validityStyles:!0,dateInput:J.DateInput,size:"medium",rounded:"medium",fillMode:"solid"};let m=r;const I=o.createPropsContext(),C=o.withIdHOC(o.withPropsContext(I,o.withUnstyledHOC(o.withAdaptiveModeContext(m))));C.displayName="KendoReactTimePicker";T.registerForLocalization(m);exports.TimePicker=C;exports.TimePickerPropsContext=I;exports.TimePickerWithoutContext=m;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("react"),e=require("prop-types"),X=require("@progress/kendo-react-popup"),y=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),Z=require("@progress/kendo-svg-icons"),T=require("@progress/kendo-react-intl"),$=require("../package-metadata.js"),l=require("../messages/index.js"),J=require("../dateinput/DateInput.js"),Q=require("./TimeSelector.js"),c=require("../utils.js"),f=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(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 a=se(G),r=class r extends a.Component{constructor(i){super(i),this._element=null,this._dateInput=a.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.showLicenseWatermark=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:s,nowButton:n,disabled:u,format:d,steps:h,unstyled:g}=this.props;return a.createElement(Q.TimeSelector,{ref:this.setTimeSelectorRef,mobileMode:this.mobileMode,show:this.show,cancelButton:s,disabled:u,nowButton:n,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:n}=this.props,u=n&&n.uTimePicker,d=o.classNames(t),h={popupClass:o.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?a.createElement(this.props.popup,{...h},this.renderTimeSelector()):a.createElement(X.Popup,{...h},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s={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:n=>this.handleValueChange(n)}};return a.createElement(te.AdaptiveMode,{...s},a.createElement(ie.ActionSheetContent,null,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,n=this.state.candidate||this.value;s&&s.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:n,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.handleClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:s,keyCode:n}=t;if(n===o.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(n===o.Keys.up||n===o.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=n===o.Keys.up,this.setShow(n===o.Keys.down))},this.showLicenseWatermark=!o.validatePackage($.packageMetadata,{component:"TimePicker"}),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(o.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),n=f.isInRange(i,t,s),u=this.props.validationMessage!==void 0,d=(!this.required||this.value!==null)&&n,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(){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 T.provideLocalizationService(this)}componentDidMount(){var i;this.observerResize=o.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.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 i;(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=r.defaultProps.size,rounded:t=r.defaultProps.rounded,fillMode:s=r.defaultProps.fillMode,disabled:n,tabIndex:u,title:d,id:h,className:g,format:M,formatPlaceholder:P,width:O,name:k,steps:D,validationMessage:z,required:x,validityStyles:q,ariaLabelledBy:R,ariaDescribedBy:E,unstyled:v,enableMouseWheel:B,autoCorrectParts:A,autoSwitchParts:F,autoSwitchKeys:V,allowCaretMode:L,inputAttributes:N}=this.props,w=v&&v.uTimePicker,b=!this.validityStyles||this.validity.valid,_={disabled:n,format:M,formatPlaceholder:P,id:h,ariaLabelledBy:R,ariaDescribedBy:E,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:k,onChange:this.handleInputValueChange,required:x,steps:D,tabIndex:this.show?-1:u,title:d,valid:this.validity.valid,validationMessage:z,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,size:null,fillMode:null,rounded:null,enableMouseWheel:B,autoCorrectParts:A,autoSwitchParts:F,autoSwitchKeys:V,allowCaretMode:L,inputAttributes:N},K=this.localizationService.toLanguageString(l.toggleClock,l.messages[l.toggleClock]),j=this.localizationService.toLanguageString(l.toggleTimeSelector,l.messages[l.toggleTimeSelector]),S=a.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:W,onBlur:U})=>a.createElement(a.Fragment,null,a.createElement("span",{ref:H=>{this._element=H},className:o.classNames(o.uTimePicker.wrapper({c:w,size:i,rounded:t,fillMode:s,invalid:!b,required:this.required,disabled:n}),g),onKeyDown:this.handleKeyDown,style:{width:O},onFocus:this.mobileMode?this.handleClick:W,onBlur:U,onClick:this.mobileMode?this.handleClick:void 0},a.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,..._}),a.createElement(ee.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:Z.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleClick,title:j,className:o.classNames(o.uTimePicker.inputButton({c:w})),rounded:null,fillMode:s,"aria-label":K}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&a.createElement(o.WatermarkOverlay,null)));return this.props.label?a.createElement(Y.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:b,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}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(const t of i)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,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"]),inputAttributes:e.object},r.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:c.MAX_TIME,min:c.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},validityStyles:!0,dateInput:J.DateInput,size:"medium",rounded:"medium",fillMode:"solid"};let m=r;const C=o.createPropsContext(),I=o.withIdHOC(o.withPropsContext(C,o.withUnstyledHOC(o.withAdaptiveModeContext(m))));I.displayName="KendoReactTimePicker";T.registerForLocalization(m);exports.TimePicker=I;exports.TimePickerPropsContext=C;exports.TimePickerWithoutContext=m;
|
|
@@ -9,19 +9,19 @@ import * as n from "react";
|
|
|
9
9
|
import e from "prop-types";
|
|
10
10
|
import { Popup as X } from "@progress/kendo-react-popup";
|
|
11
11
|
import { cloneDate as y } from "@progress/kendo-date-math";
|
|
12
|
-
import { classNames as c, uTimePicker as g, Keys as
|
|
12
|
+
import { classNames as c, uTimePicker as g, Keys as u, validatePackage as Z, canUseDOM as C, AsyncFocusBlur as J, WatermarkOverlay as Q, createPropsContext as Y, withIdHOC as $, withPropsContext as ee, withUnstyledHOC as te, withAdaptiveModeContext as ie } from "@progress/kendo-react-common";
|
|
13
13
|
import { clockIcon as se } from "@progress/kendo-svg-icons";
|
|
14
14
|
import { provideLocalizationService as oe, registerForLocalization as ne } from "@progress/kendo-react-intl";
|
|
15
15
|
import { packageMetadata as ae } from "../package-metadata.mjs";
|
|
16
|
-
import { toggleClock as f, messages as
|
|
16
|
+
import { toggleClock as f, messages as d, timePickerCancel as re, timePickerSet as I, toggleTimeSelector as T } from "../messages/index.mjs";
|
|
17
17
|
import { DateInput as le } from "../dateinput/DateInput.mjs";
|
|
18
18
|
import { TimeSelector as he } from "./TimeSelector.mjs";
|
|
19
|
-
import { MAX_TIME as
|
|
19
|
+
import { MAX_TIME as ue, MIN_TIME as de, setTime as M, MIDNIGHT_DATE as pe } from "../utils.mjs";
|
|
20
20
|
import { isInRange as me, isBiggerThanMax as ce, isSmallerThanMin as ge } from "./utils.mjs";
|
|
21
21
|
import { PickerFloatingLabel as fe } from "../hooks/usePickerFloatingLabel.mjs";
|
|
22
22
|
import { Button as ve } from "@progress/kendo-react-buttons";
|
|
23
23
|
import { AdaptiveMode as we } from "../common/AdaptiveMode.mjs";
|
|
24
|
-
import { ActionSheetContent as
|
|
24
|
+
import { ActionSheetContent as be } from "@progress/kendo-react-layout";
|
|
25
25
|
const a = class a extends n.Component {
|
|
26
26
|
constructor(i) {
|
|
27
27
|
super(i), this._element = null, this._dateInput = n.createRef(), this._timeSelector = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.showLicenseWatermark = !1, this.focus = () => {
|
|
@@ -73,16 +73,17 @@ const a = class a extends n.Component {
|
|
|
73
73
|
const { windowWidth: t = 0 } = this.state, s = {
|
|
74
74
|
expand: this.show,
|
|
75
75
|
onClose: this.handleBlur,
|
|
76
|
-
title: this.props.adaptiveTitle,
|
|
76
|
+
title: this.props.adaptiveTitle || this.props.label,
|
|
77
|
+
subTitle: this.props.adaptiveSubtitle,
|
|
77
78
|
windowWidth: t,
|
|
78
79
|
footer: {
|
|
79
|
-
cancelText: this.localizationService.toLanguageString(f,
|
|
80
|
+
cancelText: this.localizationService.toLanguageString(f, d[re]),
|
|
80
81
|
onCancel: this.handleValueReject,
|
|
81
|
-
applyText: this.localizationService.toLanguageString(
|
|
82
|
+
applyText: this.localizationService.toLanguageString(I, d[I]),
|
|
82
83
|
onApply: (o) => this.handleValueChange(o)
|
|
83
84
|
}
|
|
84
85
|
};
|
|
85
|
-
return /* @__PURE__ */ n.createElement(we, { ...s }, /* @__PURE__ */ n.createElement(
|
|
86
|
+
return /* @__PURE__ */ n.createElement(we, { ...s }, /* @__PURE__ */ n.createElement(be, null, this.renderTimeSelector()));
|
|
86
87
|
}, this.setTimeSelectorRef = (t) => {
|
|
87
88
|
this._timeSelector = t;
|
|
88
89
|
}, 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) => {
|
|
@@ -108,17 +109,17 @@ const a = class a extends n.Component {
|
|
|
108
109
|
this.setState({ focused: !1 }), this.setShow(!1);
|
|
109
110
|
}, this.handleValueReject = (t) => {
|
|
110
111
|
this.setShow(!1);
|
|
111
|
-
}, this.
|
|
112
|
+
}, this.handleClick = (t) => {
|
|
112
113
|
this.props.disabled || (this.shouldFocusDateInput = !0, this.setShow(!this.show));
|
|
113
114
|
}, this.handleIconMouseDown = (t) => {
|
|
114
115
|
t.preventDefault();
|
|
115
116
|
}, this.handleKeyDown = (t) => {
|
|
116
117
|
const { altKey: s, keyCode: o } = t;
|
|
117
|
-
if (o ===
|
|
118
|
+
if (o === u.esc) {
|
|
118
119
|
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
119
120
|
return;
|
|
120
121
|
}
|
|
121
|
-
s && (o ===
|
|
122
|
+
s && (o === u.up || o === u.down) && (t.preventDefault(), t.stopPropagation(), this.shouldFocusDateInput = o === u.up, this.setShow(o === u.down));
|
|
122
123
|
}, this.showLicenseWatermark = !Z(ae, { component: "TimePicker" }), this.state = {
|
|
123
124
|
value: this.props.defaultValue || a.defaultProps.defaultValue,
|
|
124
125
|
show: this.props.defaultShow || a.defaultProps.defaultShow,
|
|
@@ -130,7 +131,7 @@ const a = class a extends n.Component {
|
|
|
130
131
|
return this.props.id + "-popup-id";
|
|
131
132
|
}
|
|
132
133
|
get document() {
|
|
133
|
-
if (
|
|
134
|
+
if (C)
|
|
134
135
|
return this.element && this.element.ownerDocument || document;
|
|
135
136
|
}
|
|
136
137
|
/**
|
|
@@ -222,13 +223,15 @@ const a = class a extends n.Component {
|
|
|
222
223
|
*/
|
|
223
224
|
componentDidMount() {
|
|
224
225
|
var i;
|
|
225
|
-
this.observerResize =
|
|
226
|
+
this.observerResize = C && 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);
|
|
226
227
|
}
|
|
227
228
|
/**
|
|
228
229
|
* @hidden
|
|
229
230
|
*/
|
|
230
231
|
componentDidUpdate() {
|
|
231
|
-
this._timeSelector && this.show && !this.prevShow
|
|
232
|
+
this._timeSelector && this.show && !this.prevShow && this._timeSelector.focusActiveList(), this.mobileMode && this.show && !this.prevShow && setTimeout(() => {
|
|
233
|
+
this._timeSelector && this._timeSelector.focusActiveList();
|
|
234
|
+
}, 300), this.dateInput && this.dateInput.element && !this.show && this.shouldFocusDateInput && this.dateInput.element.focus({ preventScroll: !0 }), this.prevShow = this.show, this.shouldFocusDateInput = !1;
|
|
232
235
|
}
|
|
233
236
|
/**
|
|
234
237
|
* @hidden
|
|
@@ -259,21 +262,21 @@ const a = class a extends n.Component {
|
|
|
259
262
|
required: E,
|
|
260
263
|
validityStyles: R,
|
|
261
264
|
ariaLabelledBy: B,
|
|
262
|
-
ariaDescribedBy:
|
|
265
|
+
ariaDescribedBy: A,
|
|
263
266
|
unstyled: v,
|
|
264
|
-
enableMouseWheel:
|
|
265
|
-
autoCorrectParts:
|
|
267
|
+
enableMouseWheel: F,
|
|
268
|
+
autoCorrectParts: V,
|
|
266
269
|
autoSwitchParts: L,
|
|
267
270
|
autoSwitchKeys: N,
|
|
268
271
|
allowCaretMode: _,
|
|
269
272
|
inputAttributes: q
|
|
270
|
-
} = this.props, w = v && v.uTimePicker,
|
|
273
|
+
} = this.props, w = v && v.uTimePicker, b = !this.validityStyles || this.validity.valid, K = {
|
|
271
274
|
disabled: o,
|
|
272
275
|
format: O,
|
|
273
276
|
formatPlaceholder: D,
|
|
274
277
|
id: r,
|
|
275
278
|
ariaLabelledBy: B,
|
|
276
|
-
ariaDescribedBy:
|
|
279
|
+
ariaDescribedBy: A,
|
|
277
280
|
max: this.normalizeTime(this.max),
|
|
278
281
|
min: this.normalizeTime(this.min),
|
|
279
282
|
name: z,
|
|
@@ -293,16 +296,16 @@ const a = class a extends n.Component {
|
|
|
293
296
|
size: null,
|
|
294
297
|
fillMode: null,
|
|
295
298
|
rounded: null,
|
|
296
|
-
enableMouseWheel:
|
|
297
|
-
autoCorrectParts:
|
|
299
|
+
enableMouseWheel: F,
|
|
300
|
+
autoCorrectParts: V,
|
|
298
301
|
autoSwitchParts: L,
|
|
299
302
|
autoSwitchKeys: N,
|
|
300
303
|
allowCaretMode: _,
|
|
301
304
|
inputAttributes: q
|
|
302
|
-
}, W = this.localizationService.toLanguageString(f,
|
|
305
|
+
}, W = this.localizationService.toLanguageString(f, d[f]), U = this.localizationService.toLanguageString(
|
|
303
306
|
T,
|
|
304
|
-
|
|
305
|
-
),
|
|
307
|
+
d[T]
|
|
308
|
+
), S = /* @__PURE__ */ n.createElement(
|
|
306
309
|
J,
|
|
307
310
|
{
|
|
308
311
|
onFocus: this.handleFocus,
|
|
@@ -313,7 +316,6 @@ const a = class a extends n.Component {
|
|
|
313
316
|
({ onFocus: j, onBlur: H }) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
314
317
|
"span",
|
|
315
318
|
{
|
|
316
|
-
id: this.props.id,
|
|
317
319
|
ref: (G) => {
|
|
318
320
|
this._element = G;
|
|
319
321
|
},
|
|
@@ -323,7 +325,7 @@ const a = class a extends n.Component {
|
|
|
323
325
|
size: i,
|
|
324
326
|
rounded: t,
|
|
325
327
|
fillMode: s,
|
|
326
|
-
invalid: !
|
|
328
|
+
invalid: !b,
|
|
327
329
|
required: this.required,
|
|
328
330
|
disabled: o
|
|
329
331
|
}),
|
|
@@ -331,9 +333,9 @@ const a = class a extends n.Component {
|
|
|
331
333
|
),
|
|
332
334
|
onKeyDown: this.handleKeyDown,
|
|
333
335
|
style: { width: P },
|
|
334
|
-
onFocus: j,
|
|
336
|
+
onFocus: this.mobileMode ? this.handleClick : j,
|
|
335
337
|
onBlur: H,
|
|
336
|
-
onClick: this.mobileMode ? this.
|
|
338
|
+
onClick: this.mobileMode ? this.handleClick : void 0
|
|
337
339
|
},
|
|
338
340
|
/* @__PURE__ */ n.createElement(
|
|
339
341
|
this.dateInputComp,
|
|
@@ -352,7 +354,7 @@ const a = class a extends n.Component {
|
|
|
352
354
|
icon: "clock",
|
|
353
355
|
svgIcon: se,
|
|
354
356
|
onMouseDown: this.handleIconMouseDown,
|
|
355
|
-
onClick: this.mobileMode ? void 0 : this.
|
|
357
|
+
onClick: this.mobileMode ? void 0 : this.handleClick,
|
|
356
358
|
title: U,
|
|
357
359
|
className: c(g.inputButton({ c: w })),
|
|
358
360
|
rounded: null,
|
|
@@ -369,12 +371,12 @@ const a = class a extends n.Component {
|
|
|
369
371
|
dateInput: this._dateInput,
|
|
370
372
|
label: this.props.label,
|
|
371
373
|
editorId: r,
|
|
372
|
-
editorValid:
|
|
374
|
+
editorValid: b,
|
|
373
375
|
editorDisabled: this.props.disabled,
|
|
374
|
-
children:
|
|
376
|
+
children: S,
|
|
375
377
|
style: { width: this.props.width }
|
|
376
378
|
}
|
|
377
|
-
) :
|
|
379
|
+
) : S;
|
|
378
380
|
}
|
|
379
381
|
normalizeTime(i) {
|
|
380
382
|
return M(pe, i);
|
|
@@ -473,8 +475,8 @@ a.displayName = "TimePicker", a.propTypes = {
|
|
|
473
475
|
defaultValue: null,
|
|
474
476
|
disabled: !1,
|
|
475
477
|
format: "t",
|
|
476
|
-
max:
|
|
477
|
-
min:
|
|
478
|
+
max: ue,
|
|
479
|
+
min: de,
|
|
478
480
|
popupSettings: {},
|
|
479
481
|
tabIndex: 0,
|
|
480
482
|
steps: {},
|
|
@@ -485,9 +487,9 @@ a.displayName = "TimePicker", a.propTypes = {
|
|
|
485
487
|
fillMode: "solid"
|
|
486
488
|
};
|
|
487
489
|
let p = a;
|
|
488
|
-
const
|
|
490
|
+
const Se = Y(), ye = $(
|
|
489
491
|
ee(
|
|
490
|
-
|
|
492
|
+
Se,
|
|
491
493
|
te(ie(p))
|
|
492
494
|
)
|
|
493
495
|
);
|
|
@@ -495,6 +497,6 @@ ye.displayName = "KendoReactTimePicker";
|
|
|
495
497
|
ne(p);
|
|
496
498
|
export {
|
|
497
499
|
ye as TimePicker,
|
|
498
|
-
|
|
500
|
+
Se as TimePickerPropsContext,
|
|
499
501
|
p as TimePickerWithoutContext
|
|
500
502
|
};
|
|
@@ -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 I=require("react"),e=require("prop-types"),g=require("@progress/kendo-date-math"),s=require("@progress/kendo-react-common"),f=require("@progress/kendo-react-intl"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),e=require("prop-types"),g=require("@progress/kendo-date-math"),s=require("@progress/kendo-react-common"),f=require("@progress/kendo-react-intl"),r=require("../messages/index.js"),y=require("../utils.js"),m=require("./utils.js"),K=require("./TimePart.js"),O=require("@progress/kendo-react-buttons");function x(u){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const t in u)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(u,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:()=>u[t]})}}return i.default=u,Object.freeze(i)}const l=x(I),c=class c extends l.Component{constructor(i){super(i),this._element=null,this._cancelButton=null,this._acceptButton=null,this.timePart=null,this.focusActiveList=()=>{this.timePart&&this.timePart.focus({preventScroll:!0})},this.handleKeyDown=t=>{const{keyCode:n}=t;switch(n){case s.Keys.enter:this.hasActiveButton()||this.handleAccept(t);return;default:return}},this.revertToNowButton=t=>{const{keyCode:n,shiftKey:o}=t;!o&&n===s.Keys.tab&&(t.preventDefault(),this.props.nowButton!==!1?this.timePart&&this.timePart.focus({preventScroll:!0},!0):this.timePart&&this.timePart.focus({preventScroll:!0}))},this.handleNowKeyDown=t=>{var p;const{keyCode:n,shiftKey:o}=t;o&&n===s.Keys.tab?(t.preventDefault(),this._acceptButton&&((p=this._acceptButton.element)==null||p.focus({preventScroll:!0}))):n===s.Keys.enter&&(t.stopPropagation(),this.handleNowClick(t))},this.handleAccept=t=>{const n=this.mergeValue(g.cloneDate(this.value||m.getNow()),this.timePart?this.timePart.value:this.current);this.setState({value:n}),this.valueDuringOnChange=n;const{onChange:o}=this.props;o&&o.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0},this.handleReject=t=>{this.setState({current:this.value});const{onReject:n}=this.props;n&&n.call(void 0,t)},this.handleNowClick=t=>{const n=this.mergeValue(g.cloneDate(this.value||m.getNow()),m.getNow());this.setState({current:n,value:n}),this.valueDuringOnChange=n;const{onChange:o}=this.props;o&&o.call(void 0,{syntheticEvent:t,nativeEvent:t.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0},this.handleChange=t=>{this.setState({current:t});const{handleTimeChange:n}=this.props;n&&n.call(void 0,{time:t})},this.dateFormatParts=this.intl.splitDateFormat(this.props.format||c.defaultProps.format),this.mergeValue=m.valueMerger(m.generateGetters(this.dateFormatParts)),this.hasActiveButton=this.hasActiveButton.bind(this),this.state={current:this.props.value||y.MIDNIGHT_DATE,value:this.props.value||c.defaultProps.value}}get element(){return this._element}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?g.cloneDate(i):null}get intl(){return f.provideIntlService(this)}get current(){return this.state.current!==null?g.cloneDate(this.state.current):null}componentWillUnmount(){clearTimeout(this.nextTickId)}render(){const{format:i,cancelButton:t,disabled:n,tabIndex:o,className:p,smoothScroll:P,min:B,max:k,boundRange:N,nowButton:T,steps:S,show:_,mobileMode:C,unstyled:h}=this.props,E=h&&h.uTimePicker,v=h&&h.uTime,D=f.provideLocalizationService(this),b=D.toLanguageString(r.timePickerCancel,r.messages[r.timePickerCancel]),w=D.toLanguageString(r.timePickerSet,r.messages[r.timePickerSet]);return l.createElement("div",{ref:a=>{this._element=a},tabIndex:n?void 0:o||0,className:s.classNames(s.uTimePicker.timeSelector({c:E,mobileMode:C,disabled:n}),p),onKeyDown:this.handleKeyDown},l.createElement(K.TimePart,{ref:a=>{this.timePart=a},value:this.current,onChange:this.handleChange,onNowClick:this.handleNowClick,format:i,smoothScroll:P,min:B,max:k,boundRange:N,disabled:n,nowButton:T,steps:S,show:_,mobileMode:C,onNowKeyDown:this.handleNowKeyDown,unstyled:h}),this.props.footer&&l.createElement("div",{className:s.classNames(s.uTime.footer({c:v}))},t&&l.createElement(O.Button,{type:"button",ref:a=>{this._cancelButton=a},className:s.classNames(s.uTime.cancel({c:v})),onClick:this.handleReject,title:b,"aria-label":b},b),l.createElement(O.Button,{type:"button",ref:a=>{this._acceptButton=a},className:s.classNames(s.uTime.accept({c:v})),themeColor:"primary",onClick:this.handleAccept,onKeyDown:this.revertToNowButton,title:w,"aria-label":w},w)))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}hasActiveButton(){if(!this._acceptButton||!this._acceptButton.element)return!1;const i=s.getActiveElement(document);return this._acceptButton&&i===this._acceptButton.element||this._cancelButton&&i===this._cancelButton.element}};c.propTypes={cancelButton:e.bool,className:e.string,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"])})]),max:e.instanceOf(Date),min:e.instanceOf(Date),nowButton:e.bool,steps:e.shape({hour:e.number,minute:e.number,second:e.number}),smoothScroll:e.bool,tabIndex:e.number,value:e.instanceOf(Date),show:e.bool},c.defaultProps={value:null,disabled:!1,cancelButton:!0,format:"t",min:y.MIN_TIME,max:y.MAX_TIME,boundRange:!1,footer:!0};let d=c;f.registerForIntl(d);f.registerForLocalization(d);exports.TimeSelector=d;
|