@progress/kendo-react-dateinputs 13.3.0 → 13.4.0-develop.2
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/PopupSettings.d.ts +22 -0
- package/calendar/components/Calendar.d.ts +202 -0
- package/calendar/components/Calendar.mjs +7 -7
- package/calendar/components/CalendarCell.d.ts +71 -0
- package/calendar/components/CalendarHeaderTitle.d.ts +38 -0
- package/calendar/components/CalendarNavigationItem.d.ts +39 -0
- package/calendar/components/CalendarWeekCell.d.ts +42 -0
- package/calendar/components/Header.d.ts +65 -0
- package/calendar/components/Header.mjs +3 -3
- package/calendar/components/HorizontalViewList.d.ts +80 -0
- package/calendar/components/HorizontalViewList.mjs +3 -3
- package/calendar/components/MultiViewCalendar.d.ts +226 -0
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +17 -17
- package/calendar/components/Navigation.d.ts +85 -0
- package/calendar/components/TodayCommand.d.ts +46 -0
- package/calendar/components/TodayCommand.mjs +3 -3
- package/calendar/components/View.d.ts +101 -0
- package/calendar/components/ViewList.d.ts +128 -0
- package/calendar/models/ActiveView.d.ts +11 -0
- package/calendar/models/CalendarSettings.d.ts +256 -0
- package/calendar/models/CalendarViewEnum.d.ts +16 -0
- package/calendar/models/CellContext.d.ts +72 -0
- package/calendar/models/MultiViewCalendarMode.d.ts +16 -0
- package/calendar/models/MultiViewCalendarSettings.d.ts +129 -0
- package/calendar/models/NavigationAction.d.ts +22 -0
- package/calendar/models/SelectionRange.d.ts +24 -0
- package/calendar/models/SelectionRangeEnd.d.ts +11 -0
- package/calendar/models/ViewService.d.ts +32 -0
- package/calendar/models/WeekDaysFormat.d.ts +11 -0
- package/calendar/models/index.d.ts +18 -0
- package/calendar/services/BusViewService.d.ts +28 -0
- package/calendar/services/CenturyViewService.d.ts +32 -0
- package/calendar/services/CenturyViewService.mjs +4 -4
- package/calendar/services/DOMService.d.ts +36 -0
- package/calendar/services/DecadeViewService.d.ts +34 -0
- package/calendar/services/DecadeViewService.mjs +4 -4
- package/calendar/services/MonthViewService.d.ts +40 -0
- package/calendar/services/MonthViewService.mjs +2 -2
- package/calendar/services/NavigationService.d.ts +21 -0
- package/calendar/services/ScrollSyncService.d.ts +28 -0
- package/calendar/services/WeekNamesService.d.ts +17 -0
- package/calendar/services/YearViewService.d.ts +38 -0
- package/calendar/services/YearViewService.mjs +2 -2
- package/calendar/services/index.d.ts +17 -0
- package/calendar/utils/ScrollSync.d.ts +20 -0
- package/codemods/utils.js +1 -8
- package/codemods/v11/dateinput-handle.js +1 -8
- package/codemods/v11/datepicker-handle.js +1 -8
- package/common/AdaptiveMode.d.ts +22 -0
- package/common/ClearButton.d.ts +20 -0
- package/dateinput/DateInput.d.ts +248 -0
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +63 -65
- package/dateinput/dateInputIntl.d.ts +30 -0
- package/dateinput/models/DateInputSettings.d.ts +107 -0
- package/dateinput/models/common-package-props.d.ts +34 -0
- package/dateinput/models/dateinput-options.d.ts +105 -0
- package/dateinput/models/format-placeholder.d.ts +46 -0
- package/dateinput/models/incremental-steps.d.ts +24 -0
- package/dateinput/models/index.d.ts +15 -0
- package/dateinput/models/kendo-date.d.ts +60 -0
- package/dateinput/models/mask.d.ts +14 -0
- package/dateinput/models/selection.d.ts +14 -0
- package/dateinput/utils.d.ts +31 -0
- package/datepicker/DatePicker.d.ts +279 -0
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +68 -72
- package/datepicker/ToggleButton.d.ts +17 -0
- package/datepicker/models/DatePickerSettings.d.ts +248 -0
- package/datepicker/models/index.d.ts +9 -0
- package/daterangepicker/DateRangePicker.d.ts +357 -0
- package/daterangepicker/DateRangePicker.mjs +13 -13
- package/daterangepicker/models/DateRangePickerCalendarSettings.d.ts +13 -0
- package/daterangepicker/models/DateRangePickerDateInputSettings.d.ts +13 -0
- package/daterangepicker/models/DateRangePickerPopupSettings.d.ts +13 -0
- package/daterangepicker/models/DateRangePickerSettings.d.ts +129 -0
- package/daterangepicker/models/index.d.ts +12 -0
- package/datetimepicker/DateTimePicker.d.ts +420 -0
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +16 -20
- package/datetimepicker/DateTimeSelector.d.ts +111 -0
- package/datetimepicker/DateTimeSelector.mjs +3 -3
- package/datetimepicker/models/DateTimePickerSettings.d.ts +154 -0
- package/datetimepicker/models/index.d.ts +9 -0
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/hooks/usePickerFloatingLabel.d.ts +27 -0
- package/index.d.mts +35 -4952
- package/index.d.ts +35 -4952
- package/messages/index.d.ts +132 -0
- package/package-metadata.d.ts +12 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +10 -16
- package/package.json +8 -8
- package/timepicker/TimeList.d.ts +97 -0
- package/timepicker/TimeList.js +5 -5
- package/timepicker/TimeList.mjs +122 -112
- package/timepicker/TimePart.d.ts +146 -0
- package/timepicker/TimePart.mjs +3 -3
- package/timepicker/TimePicker.d.ts +417 -0
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +64 -68
- package/timepicker/TimeSelector.d.ts +149 -0
- package/timepicker/TimeSelector.mjs +3 -3
- package/timepicker/models/IncrementalSteps.d.ts +18 -0
- package/timepicker/models/ListItem.d.ts +14 -0
- package/timepicker/models/ListService.d.ts +22 -0
- package/timepicker/models/ListServiceSettings.d.ts +19 -0
- package/timepicker/models/TimePart.d.ts +17 -0
- package/timepicker/models/TimePickerSettings.d.ts +137 -0
- package/timepicker/models/index.d.ts +14 -0
- package/timepicker/services/DOMService.d.ts +18 -0
- package/timepicker/services/DayPeriodService.d.ts +54 -0
- package/timepicker/services/HoursService.d.ts +40 -0
- package/timepicker/services/MinutesService.d.ts +39 -0
- package/timepicker/services/SecondsService.d.ts +39 -0
- package/timepicker/services/index.d.ts +13 -0
- package/timepicker/utils.d.ts +63 -0
- package/timepicker/utils.mjs +1 -1
- package/utils.d.ts +103 -0
- package/utils.js +1 -1
- package/utils.mjs +46 -46
- package/virtualization/Virtualization.d.ts +125 -0
- package/virtualization/services/ScrollerService.d.ts +56 -0
- package/virtualization/services/index.d.ts +10 -0
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { default as PropTypes } from 'prop-types';
|
|
9
|
+
import { FormComponent, FormComponentProps, FormComponentValidity, DateInputsClassStructure, AdaptiveModeContextType } from '@progress/kendo-react-common';
|
|
10
|
+
import { DateInputHandle, DateInputProps } from '../dateinput/DateInput.js';
|
|
11
|
+
import { DateTimePickerSettings } from './models/index.js';
|
|
12
|
+
import { DateInputCommonPackageProps } from '../dateinput/models/common-package-props.js';
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
/**
|
|
15
|
+
* The arguments for the `onChange` event of the DateTimePicker.
|
|
16
|
+
*/
|
|
17
|
+
export interface DateTimePickerChangeEvent {
|
|
18
|
+
/** The native DOM event. */
|
|
19
|
+
nativeEvent: any;
|
|
20
|
+
/** The React synthetic event. */
|
|
21
|
+
syntheticEvent: React.SyntheticEvent<any>;
|
|
22
|
+
/** The new `value`. */
|
|
23
|
+
value: Date | null;
|
|
24
|
+
/** The current popup state. */
|
|
25
|
+
show: boolean;
|
|
26
|
+
/** The component instance that fired the event. */
|
|
27
|
+
target: DateTimePicker;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The arguments for the `onOpen` event of the DateTimePicker.
|
|
31
|
+
*/
|
|
32
|
+
export interface DateTimePickerOpenEvent {
|
|
33
|
+
/** The component instance that fired the event. */
|
|
34
|
+
target: DateTimePicker;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The arguments for the `onClose` event of the DateTimePicker.
|
|
38
|
+
*/
|
|
39
|
+
export interface DateTimePickerCloseEvent {
|
|
40
|
+
/** The component instance that fired the event. */
|
|
41
|
+
target: DateTimePicker;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Represents the props of the [KendoReact DateTimePicker component](https://www.telerik.com/kendo-react-ui/components/dateinputs/datetimepicker).
|
|
45
|
+
*/
|
|
46
|
+
export interface DateTimePickerProps extends DateTimePickerSettings, FormComponentProps, DateInputCommonPackageProps {
|
|
47
|
+
/**
|
|
48
|
+
* Set the initial `value` when uncontrolled ([see example](https://www.telerik.com/kendo-react-ui/components/dateinputs/datetimepicker/default-value)).
|
|
49
|
+
* See also [uncontrolled components](https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components).
|
|
50
|
+
*/
|
|
51
|
+
defaultValue?: Date | null;
|
|
52
|
+
/**
|
|
53
|
+
/**
|
|
54
|
+
* Fires when the user selects a new `value` ([see example](https://www.telerik.com/kendo-react-ui/components/dateinputs/datetimepicker/controlled-state#toc-controlling-the-date-value)).
|
|
55
|
+
*/
|
|
56
|
+
onChange?: (event: DateTimePickerChangeEvent) => void;
|
|
57
|
+
/**
|
|
58
|
+
/**
|
|
59
|
+
* Fires when the popup opens.
|
|
60
|
+
*/
|
|
61
|
+
onOpen?: (event: DateTimePickerOpenEvent) => void;
|
|
62
|
+
/**
|
|
63
|
+
/**
|
|
64
|
+
* Fires when the popup closes.
|
|
65
|
+
*/
|
|
66
|
+
onClose?: (event: DateTimePickerCloseEvent) => void;
|
|
67
|
+
/**
|
|
68
|
+
/**
|
|
69
|
+
* Set the current `value` ([see example](https://www.telerik.com/kendo-react-ui/components/dateinputs/datetimepicker/controlled-state#toc-controlling-the-date-value)).
|
|
70
|
+
* Provide a valid `Date` or `null`.
|
|
71
|
+
*/
|
|
72
|
+
value?: Date | null;
|
|
73
|
+
/**
|
|
74
|
+
/**
|
|
75
|
+
* Control the `size` of the DateTimePicker.
|
|
76
|
+
*
|
|
77
|
+
* The available options are:
|
|
78
|
+
* - small
|
|
79
|
+
* - medium
|
|
80
|
+
* - large
|
|
81
|
+
*
|
|
82
|
+
* @default undefined (theme-controlled)
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* <DateTimePicker size="large" />
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
size?: 'small' | 'medium' | 'large';
|
|
90
|
+
/**
|
|
91
|
+
* Control the corner `rounded` style of the DateTimePicker.
|
|
92
|
+
*
|
|
93
|
+
* The available options are:
|
|
94
|
+
* - small
|
|
95
|
+
* - medium
|
|
96
|
+
* - large
|
|
97
|
+
* - full
|
|
98
|
+
*
|
|
99
|
+
* @default undefined (theme-controlled)
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* <DateTimePicker rounded="full" />
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
rounded?: 'small' | 'medium' | 'large' | 'full';
|
|
107
|
+
/**
|
|
108
|
+
* Control the `fillMode` (background) of the DateTimePicker.
|
|
109
|
+
*
|
|
110
|
+
* The available options are:
|
|
111
|
+
* - solid
|
|
112
|
+
* - outline
|
|
113
|
+
* - flat
|
|
114
|
+
*
|
|
115
|
+
* @default undefined (theme-controlled)
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```tsx
|
|
119
|
+
* <DateTimePicker fillMode="outline" />
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
fillMode?: 'solid' | 'flat' | 'outline';
|
|
123
|
+
/**
|
|
124
|
+
* Enable adaptive popup rendering based on viewport width.
|
|
125
|
+
*
|
|
126
|
+
* @default `false`
|
|
127
|
+
*/
|
|
128
|
+
adaptive?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Set the title text in the adaptive popup (action sheet). Use only when `adaptive` is `true`.
|
|
131
|
+
* If not set, it matches the `label`.
|
|
132
|
+
*/
|
|
133
|
+
adaptiveTitle?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Set the subtitle text in the adaptive popup (action sheet). Use only when `adaptive` is `true`.
|
|
136
|
+
*/
|
|
137
|
+
adaptiveSubtitle?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Apply the `autoFocus` attribute to the internal input.
|
|
140
|
+
*
|
|
141
|
+
* @default `false`
|
|
142
|
+
*/
|
|
143
|
+
autoFocus?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* @hidden
|
|
146
|
+
*/
|
|
147
|
+
unstyled?: DateInputsClassStructure;
|
|
148
|
+
/**
|
|
149
|
+
* Autofill missing date or time parts with the current date/time on blur.
|
|
150
|
+
*
|
|
151
|
+
* @default `false`
|
|
152
|
+
*/
|
|
153
|
+
autoFill?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Set the upper threshold for interpreting a two-digit year as part of the current century ([see example](https://www.telerik.com/kendo-react-ui/components/dateinputs/dateinput/formats#toc-two---digit-year-max)).
|
|
156
|
+
* Values smaller than (`twoDigitYearMax` + 1) map to 20xx. Larger map to 19xx.
|
|
157
|
+
*
|
|
158
|
+
* @default `68`
|
|
159
|
+
*/
|
|
160
|
+
twoDigitYearMax?: number;
|
|
161
|
+
/**
|
|
162
|
+
* Enable mouse wheel to increment or decrement segments.
|
|
163
|
+
*
|
|
164
|
+
* @default `true`
|
|
165
|
+
*/
|
|
166
|
+
enableMouseWheel?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Pass HTML attributes to the internal focusable input.
|
|
169
|
+
* Attributes required for core logic are ignored.
|
|
170
|
+
*/
|
|
171
|
+
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
172
|
+
/**
|
|
173
|
+
* @hidden
|
|
174
|
+
* This prop is provided by the withAdaptiveModeContext HOC to subscribe to AdaptiveModeContext.
|
|
175
|
+
*/
|
|
176
|
+
_adaptiveMode?: AdaptiveModeContextType;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @hidden
|
|
180
|
+
*/
|
|
181
|
+
export interface DateTimePickerState {
|
|
182
|
+
value: Date | null;
|
|
183
|
+
show: boolean;
|
|
184
|
+
focused: boolean;
|
|
185
|
+
windowWidth?: number;
|
|
186
|
+
}
|
|
187
|
+
/** @hidden */
|
|
188
|
+
export declare class DateTimePickerWithoutContext extends React.Component<DateTimePickerProps, DateTimePickerState> implements FormComponent {
|
|
189
|
+
/**
|
|
190
|
+
* @hidden
|
|
191
|
+
*/
|
|
192
|
+
static displayName: string;
|
|
193
|
+
/**
|
|
194
|
+
* @hidden
|
|
195
|
+
*/
|
|
196
|
+
static propTypes: {
|
|
197
|
+
className: PropTypes.Requireable<string>;
|
|
198
|
+
defaultShow: PropTypes.Requireable<boolean>;
|
|
199
|
+
defaultValue: PropTypes.Requireable<Date>;
|
|
200
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
201
|
+
focusedDate: PropTypes.Requireable<Date>;
|
|
202
|
+
format: PropTypes.Requireable<NonNullable<string | PropTypes.InferProps<{
|
|
203
|
+
skeleton: PropTypes.Requireable<string>;
|
|
204
|
+
pattern: PropTypes.Requireable<string>;
|
|
205
|
+
date: PropTypes.Requireable<string>;
|
|
206
|
+
time: PropTypes.Requireable<string>;
|
|
207
|
+
datetime: PropTypes.Requireable<string>;
|
|
208
|
+
era: PropTypes.Requireable<string>;
|
|
209
|
+
year: PropTypes.Requireable<string>;
|
|
210
|
+
month: PropTypes.Requireable<string>;
|
|
211
|
+
day: PropTypes.Requireable<string>;
|
|
212
|
+
weekday: PropTypes.Requireable<string>;
|
|
213
|
+
hour: PropTypes.Requireable<string>;
|
|
214
|
+
hour12: PropTypes.Requireable<boolean>;
|
|
215
|
+
minute: PropTypes.Requireable<string>;
|
|
216
|
+
second: PropTypes.Requireable<string>;
|
|
217
|
+
timeZoneName: PropTypes.Requireable<string>;
|
|
218
|
+
}> | null | undefined>>;
|
|
219
|
+
formatPlaceholder: PropTypes.Requireable<NonNullable<"short" | "narrow" | "wide" | "formatPattern" | PropTypes.InferProps<{
|
|
220
|
+
year: PropTypes.Requireable<string>;
|
|
221
|
+
month: PropTypes.Requireable<string>;
|
|
222
|
+
day: PropTypes.Requireable<string>;
|
|
223
|
+
hour: PropTypes.Requireable<string>;
|
|
224
|
+
minute: PropTypes.Requireable<string>;
|
|
225
|
+
second: PropTypes.Requireable<string>;
|
|
226
|
+
}> | null | undefined>>;
|
|
227
|
+
id: PropTypes.Requireable<string>;
|
|
228
|
+
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
229
|
+
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
230
|
+
min: PropTypes.Requireable<Date>;
|
|
231
|
+
max: PropTypes.Requireable<Date>;
|
|
232
|
+
name: PropTypes.Requireable<string>;
|
|
233
|
+
popupSettings: PropTypes.Requireable<PropTypes.InferProps<{
|
|
234
|
+
animate: PropTypes.Requireable<boolean>;
|
|
235
|
+
appendTo: PropTypes.Requireable<any>;
|
|
236
|
+
popupClass: PropTypes.Requireable<string>;
|
|
237
|
+
}>>;
|
|
238
|
+
show: PropTypes.Requireable<boolean>;
|
|
239
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
240
|
+
title: PropTypes.Requireable<string>;
|
|
241
|
+
value: PropTypes.Requireable<Date>;
|
|
242
|
+
weekNumber: PropTypes.Requireable<boolean>;
|
|
243
|
+
width: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
244
|
+
validationMessage: PropTypes.Requireable<string>;
|
|
245
|
+
required: PropTypes.Requireable<boolean>;
|
|
246
|
+
validate: PropTypes.Requireable<boolean>;
|
|
247
|
+
valid: PropTypes.Requireable<boolean>;
|
|
248
|
+
cancelButton: PropTypes.Requireable<boolean>;
|
|
249
|
+
size: PropTypes.Requireable<"small" | "medium" | "large" | undefined>;
|
|
250
|
+
rounded: PropTypes.Requireable<"small" | "medium" | "large" | "full" | undefined>;
|
|
251
|
+
fillMode: PropTypes.Requireable<"flat" | "solid" | "outline" | undefined>;
|
|
252
|
+
autoFocus: PropTypes.Requireable<boolean>;
|
|
253
|
+
inputAttributes: PropTypes.Requireable<object>;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* @hidden
|
|
257
|
+
*/
|
|
258
|
+
static defaultProps: {
|
|
259
|
+
defaultShow: boolean;
|
|
260
|
+
defaultValue: null;
|
|
261
|
+
disabled: boolean;
|
|
262
|
+
format: string;
|
|
263
|
+
max: Date;
|
|
264
|
+
min: Date;
|
|
265
|
+
popupSettings: {};
|
|
266
|
+
tabIndex: number;
|
|
267
|
+
weekNumber: boolean;
|
|
268
|
+
validityStyles: boolean;
|
|
269
|
+
cancelButton: boolean;
|
|
270
|
+
dateInput: React.ComponentType<DateInputProps<any>>;
|
|
271
|
+
size: "small" | "medium" | "large" | undefined;
|
|
272
|
+
rounded: "small" | "medium" | "large" | "full" | undefined;
|
|
273
|
+
fillMode: "flat" | "solid" | "outline" | undefined;
|
|
274
|
+
autoFocus: boolean;
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* @hidden
|
|
278
|
+
*/
|
|
279
|
+
readonly state: DateTimePickerState;
|
|
280
|
+
private get _popupId();
|
|
281
|
+
private _element;
|
|
282
|
+
private _dateInput;
|
|
283
|
+
private _dateTimeSelector;
|
|
284
|
+
private valueDuringOnChange?;
|
|
285
|
+
private showDuringOnChange?;
|
|
286
|
+
private nextTickId;
|
|
287
|
+
private shouldFocusDateInput;
|
|
288
|
+
private prevShow;
|
|
289
|
+
private observerResize?;
|
|
290
|
+
private get document();
|
|
291
|
+
constructor(props: DateTimePickerProps);
|
|
292
|
+
/**
|
|
293
|
+
* Gets the wrapping element of the DateTimePicker.
|
|
294
|
+
*/
|
|
295
|
+
get element(): HTMLSpanElement | null;
|
|
296
|
+
/**
|
|
297
|
+
* Gets the DateInput component inside the DateTimePicker component.
|
|
298
|
+
*/
|
|
299
|
+
get dateInput(): DateInputHandle | null;
|
|
300
|
+
/**
|
|
301
|
+
* Gets the value of the DateTimePicker.
|
|
302
|
+
*/
|
|
303
|
+
get value(): Date | null;
|
|
304
|
+
/**
|
|
305
|
+
* Gets the popup state of the DateTimePicker.
|
|
306
|
+
*/
|
|
307
|
+
get show(): boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Gets the `name` property of the DateTimePicker.
|
|
310
|
+
*/
|
|
311
|
+
get name(): string | undefined;
|
|
312
|
+
/**
|
|
313
|
+
* Returns a boolean value indicating whether the DateTimePicker is in mobile mode.
|
|
314
|
+
*/
|
|
315
|
+
get mobileMode(): boolean;
|
|
316
|
+
protected get min(): Date;
|
|
317
|
+
protected get max(): Date;
|
|
318
|
+
/**
|
|
319
|
+
* Represents the validity state into which the DateTimePicker is set.
|
|
320
|
+
*/
|
|
321
|
+
get validity(): FormComponentValidity;
|
|
322
|
+
/**
|
|
323
|
+
* @hidden
|
|
324
|
+
*/
|
|
325
|
+
protected get validityStyles(): boolean;
|
|
326
|
+
/**
|
|
327
|
+
* @hidden
|
|
328
|
+
*/
|
|
329
|
+
protected get required(): boolean;
|
|
330
|
+
/**
|
|
331
|
+
* @hidden
|
|
332
|
+
*/
|
|
333
|
+
protected get dateInputComp(): React.ComponentType<DateInputProps<any>>;
|
|
334
|
+
/**
|
|
335
|
+
* @hidden
|
|
336
|
+
*/
|
|
337
|
+
componentDidMount(): void;
|
|
338
|
+
/**
|
|
339
|
+
* @hidden
|
|
340
|
+
*/
|
|
341
|
+
componentDidUpdate(): void;
|
|
342
|
+
/**
|
|
343
|
+
* @hidden
|
|
344
|
+
*/
|
|
345
|
+
componentWillUnmount(): void;
|
|
346
|
+
/**
|
|
347
|
+
* @hidden
|
|
348
|
+
*/
|
|
349
|
+
focus: () => void;
|
|
350
|
+
/**
|
|
351
|
+
* @hidden
|
|
352
|
+
*/
|
|
353
|
+
render(): React.JSX.Element;
|
|
354
|
+
private renderPicker;
|
|
355
|
+
private renderAdaptivePopup;
|
|
356
|
+
protected setShow(show: boolean): void;
|
|
357
|
+
protected nextTick(f: () => any): void;
|
|
358
|
+
private handleReject;
|
|
359
|
+
private handleValueChange;
|
|
360
|
+
private handleFocus;
|
|
361
|
+
private handleBlur;
|
|
362
|
+
private handleClick;
|
|
363
|
+
private handleIconMouseDown;
|
|
364
|
+
private handleKeyDown;
|
|
365
|
+
private dateInputElement;
|
|
366
|
+
private calculateMedia;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Represents the PropsContext of the `DateTimePicker` component.
|
|
370
|
+
* Used for global configuration of all `DateTimePicker` instances.
|
|
371
|
+
*
|
|
372
|
+
* For more information, refer to the [DateInputs Props Context](https://www.telerik.com/kendo-react-ui/components/dateinputs/props-context) article.
|
|
373
|
+
*/
|
|
374
|
+
export declare const DateTimePickerPropsContext: React.Context<(p: DateTimePickerProps) => DateTimePickerProps>;
|
|
375
|
+
/**
|
|
376
|
+
* Represent the `ref` of the DateTimePicker component.
|
|
377
|
+
*/
|
|
378
|
+
export interface DateTimePickerHandle extends Pick<DateTimePickerWithoutContext, keyof DateTimePickerWithoutContext> {
|
|
379
|
+
/**
|
|
380
|
+
* Gets the DateInput component inside the DateTimePicker component.
|
|
381
|
+
*/
|
|
382
|
+
dateInput: DateInputHandle | null;
|
|
383
|
+
/**
|
|
384
|
+
* Returns the HTML element of the DateTimePicker component.
|
|
385
|
+
*/
|
|
386
|
+
element: HTMLSpanElement | null;
|
|
387
|
+
/**
|
|
388
|
+
* Returns a boolean value indicating whether the DateTimePicker is in mobile mode.
|
|
389
|
+
*/
|
|
390
|
+
mobileMode: boolean;
|
|
391
|
+
/**
|
|
392
|
+
* Gets the `name` property of the DateTimePicker.
|
|
393
|
+
*/
|
|
394
|
+
name: string | undefined;
|
|
395
|
+
/**
|
|
396
|
+
* The props of the DateTimePickerHandle component.
|
|
397
|
+
*/
|
|
398
|
+
props: Readonly<DateTimePickerProps>;
|
|
399
|
+
/**
|
|
400
|
+
* Gets the popup state of the DateTimePicker.
|
|
401
|
+
*/
|
|
402
|
+
show: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Represents the validity state into which the DateTimePicker is set.
|
|
405
|
+
*/
|
|
406
|
+
validity: FormComponentValidity;
|
|
407
|
+
/**
|
|
408
|
+
* Gets the value of the DateTimePicker.
|
|
409
|
+
*/
|
|
410
|
+
value: Date | null;
|
|
411
|
+
}
|
|
412
|
+
/** @hidden */
|
|
413
|
+
export type DateTimePicker = DateTimePickerHandle;
|
|
414
|
+
/**
|
|
415
|
+
* Represents the KendoReact DateTimePicker Component.
|
|
416
|
+
*
|
|
417
|
+
* Accepts properties of type [DateTimePickerProps](https://www.telerik.com/kendo-react-ui/components/dateinputs/api/datetimepickerprops).
|
|
418
|
+
* Obtaining the `ref` returns an object of type [DateTimePickerHandle](https://www.telerik.com/kendo-react-ui/components/dateinputs/api/datetimepickerhandle).
|
|
419
|
+
*/
|
|
420
|
+
export declare const DateTimePicker: React.ForwardRefExoticComponent<DateTimePickerProps & React.RefAttributes<any>>;
|
|
@@ -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"),J=require("@progress/kendo-react-popup"),I=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),Q=require("@progress/kendo-svg-icons"),ee=require("../dateinput/DateInput.js"),te=require("@progress/kendo-react-buttons"),p=require("../utils.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),ie=require("./DateTimeSelector.js"),se=require("../timepicker/utils.js"),oe=require("../hooks/usePickerFloatingLabel.js"),ne=require("../common/AdaptiveMode.js"),ae=require("@progress/kendo-react-layout");function re(h){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>h[t]})}}return i.default=h,Object.freeze(i)}const r=re(G),n=class n extends r.Component{constructor(i){super(i),this._element=null,this._dateInput=r.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{const t=this.dateInputElement();t&&t.focus()},this.renderPicker=()=>{const{disabled:t,minTime:s,maxTime:a,format:c,calendar:d,cancelButton:u,weekNumber:v,focusedDate:f,unstyled:w}=this.props;return r.createElement(ie.DateTimeSelector,{ref:b=>{this._dateTimeSelector=b},cancelButton:u,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:t,weekNumber:v,min:this.min,max:this.max,minTime:s,maxTime:a,focusedDate:f,format:c,calendar:d,mobileMode:this.mobileMode,footerActions:!this.mobileMode,unstyled:w})},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerCancel,l.messages[l.dateTimePickerCancel]),a=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerSet,l.messages[l.dateTimePickerSet]),c={expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,windowWidth:t,footer:{cancelText:s,onCancel:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleReject(d)},applyText:a,onApply:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleAccept(d)}}};return r.createElement(ne.AdaptiveMode,{...c},r.createElement(ae.ActionSheetContent,null,this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=t=>{this.setState({value:I.cloneDate(t.value||void 0)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:s,keyCode:a}=t;if(a===o.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(a===o.Keys.up||a===o.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=a===o.Keys.up,this.setShow(a===o.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),this.state={value:this.props.defaultValue||n.defaultProps.defaultValue,show:this.props.defaultShow||n.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?I.cloneDate(i):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get mobileMode(){var t;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((t=this.props._adaptiveMode)==null?void 0:t.medium)&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:n.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:n.defaultProps.max}get validity(){const i=p.isInDateRange(this.value,this.min,this.max)&&se.isInTimeRange(this.value,this.props.minTime||p.MIN_TIME,this.props.maxTime||p.MAX_TIME),t=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&i,a=this.props.valid!==void 0?this.props.valid:s;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:a,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:n.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get dateInputComp(){return this.props.dateInput||n.defaultProps.dateInput}componentDidMount(){var 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(){const i=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),this.mobileMode&&this.show&&!this.prevShow&&setTimeout(()=>{this._dateTimeSelector&&this._dateTimeSelector.focus({preventScroll:!0})},300),i&&!this.show&&this.shouldFocusDateInput&&i.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=n.defaultProps.size,rounded:t=n.defaultProps.rounded,fillMode:s=n.defaultProps.fillMode,autoFocus:a=n.defaultProps.autoFocus,inputAttributes:c,disabled:d,tabIndex:u,title:v,id:f,format:w,formatPlaceholder:b,min:M,max:k,className:C,width:x,name:q,validationMessage:E,required:F,validityStyles:R,minTime:z,maxTime:A,ariaLabelledBy:B,ariaDescribedBy:N,popup:_=J.Popup,unstyled:y,autoFill:L,twoDigitYearMax:K,enableMouseWheel:j,autoCorrectParts:V,autoSwitchParts:U,autoSwitchKeys:W,allowCaretMode:H}=this.props,S=y&&y.uDateTimePicker,D=!this.validityStyles||this.validity.valid,X={id:f,ariaLabelledBy:B,ariaDescribedBy:N,format:w,formatPlaceholder:b,disabled:d,title:v,validityStyles:R,validationMessage:E,required:F,min:M,max:k,minTime:z,maxTime:A,name:q,tabIndex:this.show?-1:u,valid:this.validity.valid,value:this.value,onChange:this.handleValueChange,steps:this.props.steps,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null,unstyled:y,autoFill:L,twoDigitYearMax:K,enableMouseWheel:j,autoCorrectParts:V,autoSwitchParts:U,autoSwitchKeys:W,allowCaretMode:H},T=r.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:Y,onBlur:Z})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:$=>{this._element=$},className:o.classNames(o.uDateTimePicker.wrapper({c:S,size:i,fillMode:s,rounded:t,disabled:d,required:this.required,invalid:!D}),C),onKeyDown:this.handleKeyDown,style:{width:x},onFocus:this.mobileMode?this.handleClick:Y,onBlur:Z,onClick:this.mobileMode?this.handleClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,ariaHasPopup:"dialog",autoFocus:a,inputAttributes:c,...X}),r.createElement(te.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:Q.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:o.classNames(o.uDateTimePicker.inputButton({c:S})),rounded:null,fillMode:s,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(_,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:o.classNames(o.uDateTimePicker.popup({c:S})),id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"}},!this.mobileMode&&this.renderPicker())),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(oe.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:f,editorValid:D,editorDisabled:this.props.disabled,children:T,style:{width:this.props.width}}):T}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}))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}calculateMedia(i){for(const t of i)this.setState({windowWidth:t.target.clientWidth})}};n.displayName="DateTimePicker",n.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,cancelButton:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object},n.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:p.MAX_DATE,min:p.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,cancelButton:!0,dateInput:ee.DateInput,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let g=n;const P=o.createPropsContext(),O=o.withIdHOC(o.withPropsContext(P,o.withUnstyledHOC(o.withAdaptiveModeContext(g))));O.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=O;exports.DateTimePickerPropsContext=P;exports.DateTimePickerWithoutContext=g;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("react"),e=require("prop-types"),J=require("@progress/kendo-react-popup"),I=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),Q=require("@progress/kendo-svg-icons"),ee=require("../dateinput/DateInput.js"),te=require("@progress/kendo-react-buttons"),p=require("../utils.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),ie=require("./DateTimeSelector.js"),se=require("../timepicker/utils.js"),oe=require("../hooks/usePickerFloatingLabel.js"),ae=require("../common/AdaptiveMode.js"),ne=require("@progress/kendo-react-layout");function re(h){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>h[t]})}}return i.default=h,Object.freeze(i)}const r=re(G),a=class a extends r.Component{constructor(i){super(i),this._element=null,this._dateInput=r.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{const t=this.dateInputElement();t&&t.focus()},this.renderPicker=()=>{const{disabled:t,minTime:s,maxTime:n,format:c,calendar:d,cancelButton:u,weekNumber:v,focusedDate:f,unstyled:w}=this.props;return r.createElement(ie.DateTimeSelector,{ref:b=>{this._dateTimeSelector=b},cancelButton:u,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:t,weekNumber:v,min:this.min,max:this.max,minTime:s,maxTime:n,focusedDate:f,format:c,calendar:d,mobileMode:this.mobileMode,footerActions:!this.mobileMode,unstyled:w})},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerCancel,l.messages[l.dateTimePickerCancel]),n=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerSet,l.messages[l.dateTimePickerSet]),c={expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,windowWidth:t,footer:{cancelText:s,onCancel:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleReject(d)},applyText:n,onApply:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleAccept(d)}}};return r.createElement(ae.AdaptiveMode,{...c},r.createElement(ne.ActionSheetContent,null,this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=t=>{this.setState({value:I.cloneDate(t.value||void 0)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleClick=()=>{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.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),this.state={value:this.props.defaultValue||a.defaultProps.defaultValue,show:this.props.defaultShow||a.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?I.cloneDate(i):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get mobileMode(){var t;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((t=this.props._adaptiveMode)==null?void 0:t.medium)&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:a.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:a.defaultProps.max}get validity(){const i=p.isInDateRange(this.value,this.min,this.max)&&se.isInTimeRange(this.value,this.props.minTime||p.MIN_TIME,this.props.maxTime||p.MAX_TIME),t=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&i,n=this.props.valid!==void 0?this.props.valid:s;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:n,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:a.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get dateInputComp(){return this.props.dateInput||a.defaultProps.dateInput}componentDidMount(){var i;this.observerResize=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(){const i=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),this.mobileMode&&this.show&&!this.prevShow&&setTimeout(()=>{this._dateTimeSelector&&this._dateTimeSelector.focus({preventScroll:!0})},300),i&&!this.show&&this.shouldFocusDateInput&&i.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=a.defaultProps.size,rounded:t=a.defaultProps.rounded,fillMode:s=a.defaultProps.fillMode,autoFocus:n=a.defaultProps.autoFocus,inputAttributes:c,disabled:d,tabIndex:u,title:v,id:f,format:w,formatPlaceholder:b,min:M,max:k,className:C,width:x,name:q,validationMessage:E,required:F,validityStyles:R,minTime:A,maxTime:z,ariaLabelledBy:B,ariaDescribedBy:N,popup:_=J.Popup,unstyled:y,autoFill:L,twoDigitYearMax:K,enableMouseWheel:j,autoCorrectParts:V,autoSwitchParts:U,autoSwitchKeys:W,allowCaretMode:H}=this.props,S=y&&y.uDateTimePicker,D=!this.validityStyles||this.validity.valid,X={id:f,ariaLabelledBy:B,ariaDescribedBy:N,format:w,formatPlaceholder:b,disabled:d,title:v,validityStyles:R,validationMessage:E,required:F,min:M,max:k,minTime:A,maxTime:z,name:q,tabIndex:this.show?-1:u,valid:this.validity.valid,value:this.value,onChange:this.handleValueChange,steps:this.props.steps,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,unstyled:y,autoFill:L,twoDigitYearMax:K,enableMouseWheel:j,autoCorrectParts:V,autoSwitchParts:U,autoSwitchKeys:W,allowCaretMode:H},T=r.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:Y,onBlur:Z})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:$=>{this._element=$},className:o.classNames(o.uDateTimePicker.wrapper({c:S,size:i,fillMode:s,rounded:t,disabled:d,required:this.required,invalid:!D}),C),onKeyDown:this.handleKeyDown,style:{width:x},onFocus:this.mobileMode?this.handleClick:Y,onBlur:Z,onClick:this.mobileMode?this.handleClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,ariaHasPopup:"dialog",autoFocus:n,inputAttributes:c,...X}),r.createElement(te.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:Q.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:o.classNames(o.uDateTimePicker.inputButton({c:S})),fillMode:s,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(_,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:o.classNames(o.uDateTimePicker.popup({c:S})),id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"}},!this.mobileMode&&this.renderPicker())),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(oe.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:f,editorValid:D,editorDisabled:this.props.disabled,children:T,style:{width:this.props.width}}):T}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}))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}calculateMedia(i){for(const t of i)this.setState({windowWidth:t.target.clientWidth})}};a.displayName="DateTimePicker",a.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,cancelButton:e.bool,size:e.oneOf(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full"]),fillMode:e.oneOf(["solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object},a.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:p.MAX_DATE,min:p.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,cancelButton:!0,dateInput:ee.DateInput,size:void 0,rounded:void 0,fillMode:void 0,autoFocus:!1};let g=a;const P=o.createPropsContext(),O=o.withIdHOC(o.withPropsContext(P,o.withUnstyledHOC(o.withAdaptiveModeContext(g))));O.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=O;exports.DateTimePickerPropsContext=P;exports.DateTimePickerWithoutContext=g;
|
|
@@ -9,11 +9,11 @@ import * as n from "react";
|
|
|
9
9
|
import e from "prop-types";
|
|
10
10
|
import { Popup as $ } from "@progress/kendo-react-popup";
|
|
11
11
|
import { cloneDate as M } from "@progress/kendo-date-math";
|
|
12
|
-
import {
|
|
12
|
+
import { withIdHOC as ee, createPropsContext as te, Keys as d, canUseDOM as O, AsyncFocusBlur as ie, classNames as S, uDateTimePicker as I, withPropsContext as se, withUnstyledHOC as oe, withAdaptiveModeContext as ae } from "@progress/kendo-react-common";
|
|
13
13
|
import { calendarIcon as ne } from "@progress/kendo-svg-icons";
|
|
14
14
|
import { DateInput as re } from "../dateinput/DateInput.mjs";
|
|
15
15
|
import { Button as le } from "@progress/kendo-react-buttons";
|
|
16
|
-
import {
|
|
16
|
+
import { MIN_DATE as he, MAX_DATE as de, isInDateRange as ue, MAX_TIME as pe, MIN_TIME as ce } from "../utils.mjs";
|
|
17
17
|
import { dateTimePickerCancel as C, messages as p, dateTimePickerSet as P, toggleDateTimeSelector as c } from "../messages/index.mjs";
|
|
18
18
|
import { provideLocalizationService as m, registerForLocalization as me } from "@progress/kendo-react-intl";
|
|
19
19
|
import { DateTimeSelector as fe } from "./DateTimeSelector.mjs";
|
|
@@ -242,8 +242,8 @@ const o = class o extends n.Component {
|
|
|
242
242
|
width: F,
|
|
243
243
|
name: A,
|
|
244
244
|
validationMessage: R,
|
|
245
|
-
required:
|
|
246
|
-
validityStyles:
|
|
245
|
+
required: B,
|
|
246
|
+
validityStyles: z,
|
|
247
247
|
minTime: N,
|
|
248
248
|
maxTime: _,
|
|
249
249
|
ariaLabelledBy: V,
|
|
@@ -265,9 +265,9 @@ const o = class o extends n.Component {
|
|
|
265
265
|
formatPlaceholder: w,
|
|
266
266
|
disabled: l,
|
|
267
267
|
title: g,
|
|
268
|
-
validityStyles:
|
|
268
|
+
validityStyles: z,
|
|
269
269
|
validationMessage: R,
|
|
270
|
-
required:
|
|
270
|
+
required: B,
|
|
271
271
|
min: x,
|
|
272
272
|
max: k,
|
|
273
273
|
minTime: N,
|
|
@@ -281,9 +281,6 @@ const o = class o extends n.Component {
|
|
|
281
281
|
label: void 0,
|
|
282
282
|
placeholder: this.state.focused ? null : this.props.placeholder,
|
|
283
283
|
ariaExpanded: this.show,
|
|
284
|
-
size: null,
|
|
285
|
-
fillMode: null,
|
|
286
|
-
rounded: null,
|
|
287
284
|
unstyled: b,
|
|
288
285
|
autoFill: K,
|
|
289
286
|
twoDigitYearMax: U,
|
|
@@ -293,7 +290,7 @@ const o = class o extends n.Component {
|
|
|
293
290
|
autoSwitchKeys: X,
|
|
294
291
|
allowCaretMode: Y
|
|
295
292
|
}, T = /* @__PURE__ */ n.createElement(
|
|
296
|
-
|
|
293
|
+
ie,
|
|
297
294
|
{
|
|
298
295
|
onFocus: this.handleFocus,
|
|
299
296
|
onBlur: this.handleBlur,
|
|
@@ -350,7 +347,6 @@ const o = class o extends n.Component {
|
|
|
350
347
|
p[c]
|
|
351
348
|
),
|
|
352
349
|
className: S(I.inputButton({ c: y })),
|
|
353
|
-
rounded: null,
|
|
354
350
|
fillMode: s,
|
|
355
351
|
"aria-label": m(this).toLanguageString(
|
|
356
352
|
c,
|
|
@@ -472,9 +468,9 @@ o.displayName = "DateTimePicker", o.propTypes = {
|
|
|
472
468
|
validate: e.bool,
|
|
473
469
|
valid: e.bool,
|
|
474
470
|
cancelButton: e.bool,
|
|
475
|
-
size: e.oneOf([
|
|
476
|
-
rounded: e.oneOf([
|
|
477
|
-
fillMode: e.oneOf([
|
|
471
|
+
size: e.oneOf(["small", "medium", "large"]),
|
|
472
|
+
rounded: e.oneOf(["small", "medium", "large", "full"]),
|
|
473
|
+
fillMode: e.oneOf(["solid", "flat", "outline"]),
|
|
478
474
|
autoFocus: e.bool,
|
|
479
475
|
inputAttributes: e.object
|
|
480
476
|
}, o.defaultProps = {
|
|
@@ -483,21 +479,21 @@ o.displayName = "DateTimePicker", o.propTypes = {
|
|
|
483
479
|
disabled: !1,
|
|
484
480
|
format: "g",
|
|
485
481
|
// general date and time pattern (short time): "M/d/y h:mm a" for en.
|
|
486
|
-
max:
|
|
487
|
-
min:
|
|
482
|
+
max: de,
|
|
483
|
+
min: he,
|
|
488
484
|
popupSettings: {},
|
|
489
485
|
tabIndex: 0,
|
|
490
486
|
weekNumber: !1,
|
|
491
487
|
validityStyles: !0,
|
|
492
488
|
cancelButton: !0,
|
|
493
489
|
dateInput: re,
|
|
494
|
-
size:
|
|
495
|
-
rounded:
|
|
496
|
-
fillMode:
|
|
490
|
+
size: void 0,
|
|
491
|
+
rounded: void 0,
|
|
492
|
+
fillMode: void 0,
|
|
497
493
|
autoFocus: !1
|
|
498
494
|
};
|
|
499
495
|
let f = o;
|
|
500
|
-
const ye = te(), Se =
|
|
496
|
+
const ye = te(), Se = ee(
|
|
501
497
|
se(
|
|
502
498
|
ye,
|
|
503
499
|
oe(
|