@progress/kendo-react-dateinputs 7.2.4-develop.3 → 7.3.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calendar/components/Calendar.js +12 -0
- package/calendar/components/Calendar.mjs +328 -0
- package/calendar/components/CalendarCell.js +8 -0
- package/calendar/components/CalendarCell.mjs +101 -0
- package/calendar/components/CalendarHeaderTitle.js +8 -0
- package/calendar/components/CalendarHeaderTitle.mjs +23 -0
- package/calendar/components/CalendarNavigationItem.js +8 -0
- package/calendar/components/CalendarNavigationItem.mjs +29 -0
- package/calendar/components/CalendarWeekCell.js +8 -0
- package/calendar/components/CalendarWeekCell.mjs +23 -0
- package/calendar/components/Header.js +8 -0
- package/calendar/components/Header.mjs +78 -0
- package/calendar/components/HorizontalViewList.js +8 -0
- package/calendar/components/HorizontalViewList.mjs +120 -0
- package/calendar/components/MultiViewCalendar.js +8 -0
- package/calendar/components/MultiViewCalendar.mjs +428 -0
- package/calendar/components/Navigation.js +8 -0
- package/calendar/components/Navigation.mjs +117 -0
- package/calendar/components/TodayCommand.js +8 -0
- package/calendar/components/TodayCommand.mjs +74 -0
- package/calendar/components/View.js +8 -0
- package/calendar/components/View.mjs +153 -0
- package/calendar/components/ViewList.js +8 -0
- package/calendar/components/ViewList.mjs +228 -0
- package/calendar/models/CalendarViewEnum.js +8 -0
- package/calendar/models/CalendarViewEnum.mjs +12 -0
- package/calendar/models/NavigationAction.js +8 -0
- package/calendar/models/NavigationAction.mjs +12 -0
- package/calendar/models/SelectionRange.js +8 -0
- package/calendar/models/SelectionRange.mjs +12 -0
- package/calendar/services/BusViewService.js +8 -0
- package/calendar/services/BusViewService.mjs +58 -0
- package/calendar/services/CenturyViewService.js +8 -0
- package/calendar/services/CenturyViewService.mjs +126 -0
- package/calendar/services/DOMService.js +14 -0
- package/calendar/services/DOMService.mjs +124 -0
- package/calendar/services/DecadeViewService.js +8 -0
- package/calendar/services/DecadeViewService.mjs +126 -0
- package/calendar/services/MonthViewService.js +8 -0
- package/calendar/services/MonthViewService.mjs +139 -0
- package/calendar/services/NavigationService.js +8 -0
- package/calendar/services/NavigationService.mjs +36 -0
- package/calendar/services/ScrollSyncService.js +8 -0
- package/calendar/services/ScrollSyncService.mjs +50 -0
- package/calendar/services/WeekNamesService.js +8 -0
- package/calendar/services/WeekNamesService.mjs +24 -0
- package/calendar/services/YearViewService.js +8 -0
- package/calendar/services/YearViewService.mjs +135 -0
- package/common/AdaptiveMode.js +8 -0
- package/common/AdaptiveMode.mjs +73 -0
- package/common/PickerWrap.js +8 -0
- package/common/PickerWrap.mjs +32 -0
- package/common/constants.js +8 -0
- package/common/constants.mjs +12 -0
- package/dateinput/DateInput.js +8 -0
- package/dateinput/DateInput.mjs +503 -0
- package/dateinput/models/kendo-date.js +8 -0
- package/dateinput/models/kendo-date.mjs +233 -0
- package/dateinput/models/mask.js +8 -0
- package/dateinput/models/mask.mjs +16 -0
- package/dateinput/utils.js +8 -0
- package/dateinput/utils.mjs +38 -0
- package/datepicker/DatePicker.js +8 -0
- package/datepicker/DatePicker.mjs +462 -0
- package/datepicker/ToggleButton.js +8 -0
- package/datepicker/ToggleButton.mjs +13 -0
- package/daterangepicker/DateRangePicker.js +8 -0
- package/daterangepicker/DateRangePicker.mjs +426 -0
- package/datetimepicker/DateTimePicker.js +8 -0
- package/datetimepicker/DateTimePicker.mjs +475 -0
- package/datetimepicker/DateTimeSelector.js +8 -0
- package/datetimepicker/DateTimeSelector.mjs +275 -0
- package/dist/cdn/js/kendo-react-dateinputs.js +8 -21
- package/hooks/usePickerFloatingLabel.js +8 -0
- package/hooks/usePickerFloatingLabel.mjs +31 -0
- package/index.d.mts +4528 -5
- package/index.d.ts +4528 -39
- package/index.js +8 -21
- package/index.mjs +114 -6540
- package/messages/index.js +8 -0
- package/messages/index.mjs +59 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +7 -7
- package/timepicker/TimeList.js +14 -0
- package/timepicker/TimeList.mjs +230 -0
- package/timepicker/TimePart.js +8 -0
- package/timepicker/TimePart.mjs +267 -0
- package/timepicker/TimePicker.js +8 -0
- package/timepicker/TimePicker.mjs +479 -0
- package/timepicker/TimeSelector.js +8 -0
- package/timepicker/TimeSelector.mjs +250 -0
- package/timepicker/models/TimePart.js +8 -0
- package/timepicker/models/TimePart.mjs +18 -0
- package/timepicker/services/DOMService.js +8 -0
- package/timepicker/services/DOMService.mjs +34 -0
- package/timepicker/services/DayPeriodService.js +8 -0
- package/timepicker/services/DayPeriodService.mjs +89 -0
- package/timepicker/services/HoursService.js +8 -0
- package/timepicker/services/HoursService.mjs +92 -0
- package/timepicker/services/MinutesService.js +8 -0
- package/timepicker/services/MinutesService.mjs +91 -0
- package/timepicker/services/SecondsService.js +8 -0
- package/timepicker/services/SecondsService.mjs +91 -0
- package/timepicker/utils.js +8 -0
- package/timepicker/utils.mjs +91 -0
- package/utils.js +8 -0
- package/utils.mjs +111 -0
- package/virtualization/Virtualization.js +8 -0
- package/virtualization/Virtualization.mjs +204 -0
- package/virtualization/services/RowHeightService.js +8 -0
- package/virtualization/services/RowHeightService.mjs +50 -0
- package/virtualization/services/ScrollerService.js +8 -0
- package/virtualization/services/ScrollerService.mjs +52 -0
- package/PopupSettings.d.ts +0 -18
- package/calendar/components/Calendar.d.ts +0 -191
- package/calendar/components/CalendarCell.d.ts +0 -39
- package/calendar/components/CalendarHeaderTitle.d.ts +0 -32
- package/calendar/components/CalendarNavigationItem.d.ts +0 -31
- package/calendar/components/CalendarWeekCell.d.ts +0 -29
- package/calendar/components/Header.d.ts +0 -58
- package/calendar/components/HorizontalViewList.d.ts +0 -71
- package/calendar/components/MultiViewCalendar.d.ts +0 -212
- package/calendar/components/Navigation.d.ts +0 -80
- package/calendar/components/TodayCommand.d.ts +0 -35
- package/calendar/components/View.d.ts +0 -89
- package/calendar/components/ViewList.d.ts +0 -115
- package/calendar/models/ActiveView.d.ts +0 -8
- package/calendar/models/CalendarSettings.d.ts +0 -106
- package/calendar/models/CalendarViewEnum.d.ts +0 -13
- package/calendar/models/CellContext.d.ts +0 -23
- package/calendar/models/MultiViewCalendarMode.d.ts +0 -13
- package/calendar/models/MultiViewCalendarSettings.d.ts +0 -115
- package/calendar/models/NavigationAction.d.ts +0 -19
- package/calendar/models/SelectionRange.d.ts +0 -21
- package/calendar/models/SelectionRangeEnd.d.ts +0 -8
- package/calendar/models/ViewService.d.ts +0 -29
- package/calendar/models/index.d.ts +0 -15
- package/calendar/services/BusViewService.d.ts +0 -25
- package/calendar/services/CenturyViewService.d.ts +0 -29
- package/calendar/services/DOMService.d.ts +0 -33
- package/calendar/services/DecadeViewService.d.ts +0 -31
- package/calendar/services/MonthViewService.d.ts +0 -37
- package/calendar/services/NavigationService.d.ts +0 -18
- package/calendar/services/ScrollSyncService.d.ts +0 -25
- package/calendar/services/WeekNamesService.d.ts +0 -13
- package/calendar/services/YearViewService.d.ts +0 -35
- package/calendar/services/index.d.ts +0 -14
- package/common/AdaptiveMode.d.ts +0 -25
- package/common/PickerWrap.d.ts +0 -22
- package/common/constants.d.ts +0 -8
- package/dateinput/DateInput.d.ts +0 -355
- package/dateinput/models/DateInputSettings.d.ts +0 -103
- package/dateinput/models/format-placeholder.d.ts +0 -43
- package/dateinput/models/incremental-steps.d.ts +0 -15
- package/dateinput/models/index.d.ts +0 -11
- package/dateinput/models/kendo-date.d.ts +0 -57
- package/dateinput/models/mask.d.ts +0 -11
- package/dateinput/models/selection.d.ts +0 -11
- package/dateinput/utils.d.ts +0 -34
- package/datepicker/DatePicker.d.ts +0 -358
- package/datepicker/ToggleButton.d.ts +0 -14
- package/datepicker/models/DatePickerSettings.d.ts +0 -141
- package/datepicker/models/index.d.ts +0 -6
- package/daterangepicker/DateRangePicker.d.ts +0 -354
- package/daterangepicker/models/DateRangePickerCalendarSettings.d.ts +0 -10
- package/daterangepicker/models/DateRangePickerDateInputSettings.d.ts +0 -10
- package/daterangepicker/models/DateRangePickerPopupSettings.d.ts +0 -10
- package/daterangepicker/models/DateRangePickerSettings.d.ts +0 -126
- package/daterangepicker/models/index.d.ts +0 -9
- package/datetimepicker/DateTimePicker.d.ts +0 -342
- package/datetimepicker/DateTimeSelector.d.ts +0 -106
- package/datetimepicker/models/DateTimePickerSettings.d.ts +0 -144
- package/datetimepicker/models/index.d.ts +0 -6
- package/hooks/usePickerFloatingLabel.d.ts +0 -24
- package/messages/index.d.ts +0 -124
- package/package-metadata.d.ts +0 -9
- package/timepicker/TimeList.d.ts +0 -91
- package/timepicker/TimePart.d.ts +0 -141
- package/timepicker/TimePicker.d.ts +0 -355
- package/timepicker/TimeSelector.d.ts +0 -144
- package/timepicker/models/IncrementalSteps.d.ts +0 -12
- package/timepicker/models/ListItem.d.ts +0 -11
- package/timepicker/models/ListService.d.ts +0 -19
- package/timepicker/models/ListServiceSettings.d.ts +0 -16
- package/timepicker/models/TimePart.d.ts +0 -14
- package/timepicker/models/TimePickerSettings.d.ts +0 -133
- package/timepicker/models/index.d.ts +0 -11
- package/timepicker/services/DOMService.d.ts +0 -14
- package/timepicker/services/DayPeriodService.d.ts +0 -51
- package/timepicker/services/HoursService.d.ts +0 -37
- package/timepicker/services/MinutesService.d.ts +0 -36
- package/timepicker/services/SecondsService.d.ts +0 -36
- package/timepicker/services/index.d.ts +0 -10
- package/timepicker/utils.d.ts +0 -60
- package/utils.d.ts +0 -100
- package/virtualization/Virtualization.d.ts +0 -120
- package/virtualization/services/RowHeightService.d.ts +0 -22
- package/virtualization/services/ScrollerService.d.ts +0 -53
- package/virtualization/services/index.d.ts +0 -7
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as a from "react";
|
|
10
|
+
import e from "prop-types";
|
|
11
|
+
import { Popup as _ } from "@progress/kendo-react-popup";
|
|
12
|
+
import { cloneDate as I } from "@progress/kendo-date-math";
|
|
13
|
+
import { Keys as h, validatePackage as K, canUseDOM as y, AsyncFocusBlur as U, classNames as j, kendoThemeMaps as D, createPropsContext as $, withIdHOC as W, withPropsContext as X } from "@progress/kendo-react-common";
|
|
14
|
+
import { calendarIcon as H } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { DateInput as Z } from "../dateinput/DateInput.mjs";
|
|
16
|
+
import { Button as G } from "@progress/kendo-react-buttons";
|
|
17
|
+
import { packageMetadata as J } from "../package-metadata.mjs";
|
|
18
|
+
import { MAX_DATE as Q, MIN_DATE as Y, isInDateRange as ee, MAX_TIME as te, MIN_TIME as ie } from "../utils.mjs";
|
|
19
|
+
import { MOBILE_MEDIUM_DEVISE as se } from "../common/constants.mjs";
|
|
20
|
+
import { dateTimePickerCancel as S, messages as u, dateTimePickerSet as T, toggleDateTimeSelector as p } from "../messages/index.mjs";
|
|
21
|
+
import { provideLocalizationService as m, registerForLocalization as oe } from "@progress/kendo-react-intl";
|
|
22
|
+
import { DateTimeSelector as ne } from "./DateTimeSelector.mjs";
|
|
23
|
+
import { isInTimeRange as ae } from "../timepicker/utils.mjs";
|
|
24
|
+
import { PickerFloatingLabel as re } from "../hooks/usePickerFloatingLabel.mjs";
|
|
25
|
+
import { AdaptiveMode as le } from "../common/AdaptiveMode.mjs";
|
|
26
|
+
import { ActionSheetContent as de } from "@progress/kendo-react-layout";
|
|
27
|
+
const o = class o extends a.Component {
|
|
28
|
+
constructor(t) {
|
|
29
|
+
super(t), this._element = null, this._dateInput = a.createRef(), this._dateTimeSelector = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.focus = () => {
|
|
30
|
+
const i = this.dateInputElement();
|
|
31
|
+
i && i.focus();
|
|
32
|
+
}, this.renderPicker = () => {
|
|
33
|
+
const {
|
|
34
|
+
disabled: i,
|
|
35
|
+
minTime: s,
|
|
36
|
+
maxTime: n,
|
|
37
|
+
format: d,
|
|
38
|
+
calendar: l,
|
|
39
|
+
cancelButton: r,
|
|
40
|
+
weekNumber: f,
|
|
41
|
+
focusedDate: g
|
|
42
|
+
} = this.props;
|
|
43
|
+
return /* @__PURE__ */ a.createElement(
|
|
44
|
+
ne,
|
|
45
|
+
{
|
|
46
|
+
ref: (v) => {
|
|
47
|
+
this._dateTimeSelector = v;
|
|
48
|
+
},
|
|
49
|
+
cancelButton: r,
|
|
50
|
+
steps: this.props.steps,
|
|
51
|
+
value: this.value,
|
|
52
|
+
onChange: this.handleValueChange,
|
|
53
|
+
onReject: this.handleReject,
|
|
54
|
+
disabled: i,
|
|
55
|
+
weekNumber: f,
|
|
56
|
+
min: this.min,
|
|
57
|
+
max: this.max,
|
|
58
|
+
minTime: s,
|
|
59
|
+
maxTime: n,
|
|
60
|
+
focusedDate: g,
|
|
61
|
+
format: d,
|
|
62
|
+
calendar: l,
|
|
63
|
+
mobileMode: this.mobileMode,
|
|
64
|
+
footerActions: !this.mobileMode
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}, this.renderAdaptivePopup = () => {
|
|
68
|
+
const { windowWidth: i = 0 } = this.state, s = m(this).toLanguageString(S, u[S]), n = m(this).toLanguageString(T, u[T]), d = {
|
|
69
|
+
expand: this.show,
|
|
70
|
+
onClose: this.handleBlur,
|
|
71
|
+
adaptiveTitle: this.props.adaptiveTitle,
|
|
72
|
+
windowWidth: i,
|
|
73
|
+
footer: {
|
|
74
|
+
cancelText: s,
|
|
75
|
+
onCancel: (l) => {
|
|
76
|
+
var r;
|
|
77
|
+
return (r = this._dateTimeSelector) == null ? void 0 : r.handleReject(l);
|
|
78
|
+
},
|
|
79
|
+
applyText: n,
|
|
80
|
+
onApply: (l) => {
|
|
81
|
+
var r;
|
|
82
|
+
return (r = this._dateTimeSelector) == null ? void 0 : r.handleAccept(l);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
return /* @__PURE__ */ a.createElement(le, { ...d }, /* @__PURE__ */ a.createElement(de, { className: "!k-overflow-hidden" }, this.renderPicker()));
|
|
87
|
+
}, this.handleReject = () => {
|
|
88
|
+
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
89
|
+
}, this.handleValueChange = (i) => {
|
|
90
|
+
this.setState({
|
|
91
|
+
value: I(i.value || void 0)
|
|
92
|
+
}), this.valueDuringOnChange = i.value, this.showDuringOnChange = !1, this.mobileMode || (this.shouldFocusDateInput = !0);
|
|
93
|
+
const { onChange: s } = this.props;
|
|
94
|
+
s && s.call(void 0, {
|
|
95
|
+
syntheticEvent: i.syntheticEvent,
|
|
96
|
+
nativeEvent: i.nativeEvent,
|
|
97
|
+
value: this.value,
|
|
98
|
+
show: this.show,
|
|
99
|
+
target: this
|
|
100
|
+
}), this.valueDuringOnChange = void 0, this.showDuringOnChange = void 0, this.setShow(!1);
|
|
101
|
+
}, this.handleFocus = () => {
|
|
102
|
+
this.setState({ focused: !0 });
|
|
103
|
+
}, this.handleBlur = () => {
|
|
104
|
+
this.setState({ focused: !1 }), this.setShow(!1);
|
|
105
|
+
}, this.handleDateIconClick = () => {
|
|
106
|
+
this.props.disabled || (this.shouldFocusDateInput = !0, this.setShow(!this.show));
|
|
107
|
+
}, this.handleIconMouseDown = (i) => {
|
|
108
|
+
i.preventDefault();
|
|
109
|
+
}, this.handleKeyDown = (i) => {
|
|
110
|
+
const { altKey: s, keyCode: n } = i;
|
|
111
|
+
if (n === h.esc) {
|
|
112
|
+
this.shouldFocusDateInput = !0, this.setShow(!1);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
s && (n === h.up || n === h.down) && (i.preventDefault(), i.stopPropagation(), this.shouldFocusDateInput = n === h.up, this.setShow(n === h.down));
|
|
116
|
+
}, this.dateInputElement = () => this.dateInput && this.dateInput.element || this.element && this.element.querySelector(".k-dateinput > input.k-input-inner"), K(J), this.state = {
|
|
117
|
+
value: this.props.defaultValue || o.defaultProps.defaultValue,
|
|
118
|
+
show: this.props.defaultShow || o.defaultProps.defaultShow,
|
|
119
|
+
focused: !1
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
get _popupId() {
|
|
123
|
+
return this.props.id + "-popup-id";
|
|
124
|
+
}
|
|
125
|
+
get document() {
|
|
126
|
+
if (y)
|
|
127
|
+
return this.element && this.element.ownerDocument || document;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Gets the wrapping element of the DateTimePicker.
|
|
131
|
+
*/
|
|
132
|
+
get element() {
|
|
133
|
+
return this._element;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Gets the DateInput component inside the DateTimePicker component.
|
|
137
|
+
*/
|
|
138
|
+
get dateInput() {
|
|
139
|
+
return this._dateInput.current;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Gets the value of the DateTimePicker.
|
|
143
|
+
*/
|
|
144
|
+
get value() {
|
|
145
|
+
const t = this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value;
|
|
146
|
+
return t !== null ? I(t) : null;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Gets the popup state of the DateTimePicker.
|
|
150
|
+
*/
|
|
151
|
+
get show() {
|
|
152
|
+
return this.showDuringOnChange !== void 0 ? this.showDuringOnChange : this.props.show !== void 0 ? this.props.show : this.state.show;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Gets the `name` property of the DateTimePicker.
|
|
156
|
+
*/
|
|
157
|
+
get name() {
|
|
158
|
+
return this.props.name;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The mobile mode of the ComboBox.
|
|
162
|
+
*/
|
|
163
|
+
get mobileMode() {
|
|
164
|
+
return !!(this.state.windowWidth && this.state.windowWidth <= se && this.props.adaptive);
|
|
165
|
+
}
|
|
166
|
+
get min() {
|
|
167
|
+
return this.props.min !== void 0 ? this.props.min : o.defaultProps.min;
|
|
168
|
+
}
|
|
169
|
+
get max() {
|
|
170
|
+
return this.props.max !== void 0 ? this.props.max : o.defaultProps.max;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Represents the validity state into which the DateTimePicker is set.
|
|
174
|
+
*/
|
|
175
|
+
get validity() {
|
|
176
|
+
const t = ee(this.value, this.min, this.max) && ae(this.value, this.props.minTime || ie, this.props.maxTime || te), i = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && t, n = this.props.valid !== void 0 ? this.props.valid : s;
|
|
177
|
+
return {
|
|
178
|
+
customError: i,
|
|
179
|
+
rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
|
|
180
|
+
rangeUnderflow: this.value && this.value.getTime() < this.min.getTime() || !1,
|
|
181
|
+
valid: n,
|
|
182
|
+
valueMissing: this.value === null
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* @hidden
|
|
187
|
+
*/
|
|
188
|
+
get validityStyles() {
|
|
189
|
+
return this.props.validityStyles !== void 0 ? this.props.validityStyles : o.defaultProps.validityStyles;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* @hidden
|
|
193
|
+
*/
|
|
194
|
+
get required() {
|
|
195
|
+
return this.props.required !== void 0 ? this.props.required : o.defaultProps.required;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* @hidden
|
|
199
|
+
*/
|
|
200
|
+
get dateInputComp() {
|
|
201
|
+
return this.props.dateInput || o.defaultProps.dateInput;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* @hidden
|
|
205
|
+
*/
|
|
206
|
+
componentDidMount() {
|
|
207
|
+
var t;
|
|
208
|
+
this.observerResize = y && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.show && this.forceUpdate(), (t = this.document) != null && t.body && this.observerResize && this.observerResize.observe(this.document.body);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* @hidden
|
|
212
|
+
*/
|
|
213
|
+
componentDidUpdate() {
|
|
214
|
+
const t = this.dateInputElement();
|
|
215
|
+
this._dateTimeSelector && this.show && !this.prevShow && this._dateTimeSelector.focus({ preventScroll: !0 }), t && !this.show && this.shouldFocusDateInput && t.focus({ preventScroll: !0 }), this.prevShow = this.show, this.shouldFocusDateInput = !1;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* @hidden
|
|
219
|
+
*/
|
|
220
|
+
componentWillUnmount() {
|
|
221
|
+
var t;
|
|
222
|
+
clearTimeout(this.nextTickId), (t = this.document) != null && t.body && this.observerResize && this.observerResize.disconnect();
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* @hidden
|
|
226
|
+
*/
|
|
227
|
+
render() {
|
|
228
|
+
const {
|
|
229
|
+
size: t = o.defaultProps.size,
|
|
230
|
+
rounded: i = o.defaultProps.rounded,
|
|
231
|
+
fillMode: s = o.defaultProps.fillMode,
|
|
232
|
+
disabled: n,
|
|
233
|
+
tabIndex: d,
|
|
234
|
+
title: l,
|
|
235
|
+
id: r,
|
|
236
|
+
format: f,
|
|
237
|
+
formatPlaceholder: g,
|
|
238
|
+
min: v,
|
|
239
|
+
max: M,
|
|
240
|
+
className: k,
|
|
241
|
+
width: O,
|
|
242
|
+
name: P,
|
|
243
|
+
validationMessage: C,
|
|
244
|
+
required: x,
|
|
245
|
+
validityStyles: E,
|
|
246
|
+
minTime: F,
|
|
247
|
+
maxTime: R,
|
|
248
|
+
ariaLabelledBy: z,
|
|
249
|
+
ariaDescribedBy: A,
|
|
250
|
+
popup: B = _
|
|
251
|
+
} = this.props, w = !this.validityStyles || this.validity.valid, N = {
|
|
252
|
+
id: r,
|
|
253
|
+
ariaLabelledBy: z,
|
|
254
|
+
ariaDescribedBy: A,
|
|
255
|
+
format: f,
|
|
256
|
+
formatPlaceholder: g,
|
|
257
|
+
disabled: n,
|
|
258
|
+
title: l,
|
|
259
|
+
validityStyles: E,
|
|
260
|
+
validationMessage: C,
|
|
261
|
+
required: x,
|
|
262
|
+
min: v,
|
|
263
|
+
max: M,
|
|
264
|
+
minTime: F,
|
|
265
|
+
maxTime: R,
|
|
266
|
+
name: P,
|
|
267
|
+
tabIndex: this.show ? -1 : d,
|
|
268
|
+
valid: this.validity.valid,
|
|
269
|
+
value: this.value,
|
|
270
|
+
onChange: this.handleValueChange,
|
|
271
|
+
steps: this.props.steps,
|
|
272
|
+
label: void 0,
|
|
273
|
+
placeholder: this.state.focused ? null : this.props.placeholder,
|
|
274
|
+
ariaExpanded: this.show,
|
|
275
|
+
size: null,
|
|
276
|
+
fillMode: null,
|
|
277
|
+
rounded: null
|
|
278
|
+
}, b = /* @__PURE__ */ a.createElement(
|
|
279
|
+
U,
|
|
280
|
+
{
|
|
281
|
+
onFocus: this.handleFocus,
|
|
282
|
+
onBlur: this.handleBlur,
|
|
283
|
+
onSyncFocus: this.props.onFocus,
|
|
284
|
+
onSyncBlur: this.props.onBlur
|
|
285
|
+
},
|
|
286
|
+
({ onFocus: q, onBlur: V }) => /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
|
|
287
|
+
"div",
|
|
288
|
+
{
|
|
289
|
+
ref: (L) => {
|
|
290
|
+
this._element = L;
|
|
291
|
+
},
|
|
292
|
+
className: j(
|
|
293
|
+
"k-input",
|
|
294
|
+
"k-datetimepicker",
|
|
295
|
+
{
|
|
296
|
+
[`k-input-${D.sizeMap[t] || t}`]: t,
|
|
297
|
+
[`k-rounded-${D.roundedMap[i] || i}`]: i,
|
|
298
|
+
[`k-input-${s}`]: s,
|
|
299
|
+
"k-invalid": !w,
|
|
300
|
+
"k-required": this.required,
|
|
301
|
+
"k-disabled": this.props.disabled
|
|
302
|
+
},
|
|
303
|
+
k
|
|
304
|
+
),
|
|
305
|
+
onKeyDown: this.handleKeyDown,
|
|
306
|
+
style: { width: O },
|
|
307
|
+
onFocus: this.mobileMode ? void 0 : q,
|
|
308
|
+
onBlur: V,
|
|
309
|
+
onClick: this.mobileMode ? this.handleDateIconClick : void 0
|
|
310
|
+
},
|
|
311
|
+
/* @__PURE__ */ a.createElement(
|
|
312
|
+
this.dateInputComp,
|
|
313
|
+
{
|
|
314
|
+
_ref: this._dateInput,
|
|
315
|
+
ariaRole: "combobox",
|
|
316
|
+
ariaControls: this._popupId,
|
|
317
|
+
readonly: this.mobileMode,
|
|
318
|
+
...N
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
/* @__PURE__ */ a.createElement(
|
|
322
|
+
G,
|
|
323
|
+
{
|
|
324
|
+
tabIndex: -1,
|
|
325
|
+
type: "button",
|
|
326
|
+
icon: "calendar",
|
|
327
|
+
svgIcon: H,
|
|
328
|
+
onMouseDown: this.handleIconMouseDown,
|
|
329
|
+
onClick: this.mobileMode ? void 0 : this.handleDateIconClick,
|
|
330
|
+
title: m(this).toLanguageString(p, u[p]),
|
|
331
|
+
className: "k-input-button",
|
|
332
|
+
rounded: null,
|
|
333
|
+
"aria-label": m(this).toLanguageString(p, u[p])
|
|
334
|
+
}
|
|
335
|
+
),
|
|
336
|
+
/* @__PURE__ */ a.createElement(
|
|
337
|
+
B,
|
|
338
|
+
{
|
|
339
|
+
show: this.show,
|
|
340
|
+
animate: this.element !== null,
|
|
341
|
+
anchor: this.element,
|
|
342
|
+
popupClass: "k-datetime-container k-reset",
|
|
343
|
+
id: this._popupId,
|
|
344
|
+
anchorAlign: {
|
|
345
|
+
horizontal: "left",
|
|
346
|
+
vertical: "bottom"
|
|
347
|
+
},
|
|
348
|
+
popupAlign: {
|
|
349
|
+
horizontal: "left",
|
|
350
|
+
vertical: "top"
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
!this.mobileMode && this.renderPicker()
|
|
354
|
+
)
|
|
355
|
+
), this.mobileMode && this.renderAdaptivePopup())
|
|
356
|
+
);
|
|
357
|
+
return this.props.label ? /* @__PURE__ */ a.createElement(
|
|
358
|
+
re,
|
|
359
|
+
{
|
|
360
|
+
dateInput: this._dateInput,
|
|
361
|
+
label: this.props.label,
|
|
362
|
+
editorId: r,
|
|
363
|
+
editorValid: w,
|
|
364
|
+
editorDisabled: this.props.disabled,
|
|
365
|
+
children: b,
|
|
366
|
+
style: { width: this.props.width }
|
|
367
|
+
}
|
|
368
|
+
) : b;
|
|
369
|
+
}
|
|
370
|
+
setShow(t) {
|
|
371
|
+
const { onOpen: i, onClose: s } = this.props;
|
|
372
|
+
this.show !== t && (this.setState({ show: t }), t && i && i.call(void 0, {
|
|
373
|
+
target: this
|
|
374
|
+
}), !t && s && s.call(void 0, {
|
|
375
|
+
target: this
|
|
376
|
+
}));
|
|
377
|
+
}
|
|
378
|
+
nextTick(t) {
|
|
379
|
+
clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => t());
|
|
380
|
+
}
|
|
381
|
+
calculateMedia(t) {
|
|
382
|
+
for (const i of t)
|
|
383
|
+
this.setState({ windowWidth: i.target.clientWidth });
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
o.displayName = "DateTimePicker", o.propTypes = {
|
|
387
|
+
className: e.string,
|
|
388
|
+
defaultShow: e.bool,
|
|
389
|
+
defaultValue: e.instanceOf(Date),
|
|
390
|
+
disabled: e.bool,
|
|
391
|
+
focusedDate: e.instanceOf(Date),
|
|
392
|
+
format: e.oneOfType([
|
|
393
|
+
e.string,
|
|
394
|
+
e.shape({
|
|
395
|
+
skeleton: e.string,
|
|
396
|
+
pattern: e.string,
|
|
397
|
+
date: e.oneOf(["short", "medium", "long", "full"]),
|
|
398
|
+
time: e.oneOf(["short", "medium", "long", "full"]),
|
|
399
|
+
datetime: e.oneOf(["short", "medium", "long", "full"]),
|
|
400
|
+
era: e.oneOf(["narrow", "short", "long"]),
|
|
401
|
+
year: e.oneOf(["numeric", "2-digit"]),
|
|
402
|
+
month: e.oneOf(["numeric", "2-digit", "narrow", "short", "long"]),
|
|
403
|
+
day: e.oneOf(["numeric", "2-digit"]),
|
|
404
|
+
weekday: e.oneOf(["narrow", "short", "long"]),
|
|
405
|
+
hour: e.oneOf(["numeric", "2-digit"]),
|
|
406
|
+
hour12: e.bool,
|
|
407
|
+
minute: e.oneOf(["numeric", "2-digit"]),
|
|
408
|
+
second: e.oneOf(["numeric", "2-digit"]),
|
|
409
|
+
timeZoneName: e.oneOf(["short", "long"])
|
|
410
|
+
})
|
|
411
|
+
]),
|
|
412
|
+
formatPlaceholder: e.oneOfType([
|
|
413
|
+
e.oneOf(["wide", "narrow", "short", "formatPattern"]),
|
|
414
|
+
e.shape({
|
|
415
|
+
year: e.string,
|
|
416
|
+
month: e.string,
|
|
417
|
+
day: e.string,
|
|
418
|
+
hour: e.string,
|
|
419
|
+
minute: e.string,
|
|
420
|
+
second: e.string
|
|
421
|
+
})
|
|
422
|
+
]),
|
|
423
|
+
id: e.string,
|
|
424
|
+
ariaLabelledBy: e.string,
|
|
425
|
+
ariaDescribedBy: e.string,
|
|
426
|
+
min: e.instanceOf(Date),
|
|
427
|
+
max: e.instanceOf(Date),
|
|
428
|
+
name: e.string,
|
|
429
|
+
popupSettings: e.shape({
|
|
430
|
+
animate: e.bool,
|
|
431
|
+
appendTo: e.any,
|
|
432
|
+
popupClass: e.string
|
|
433
|
+
}),
|
|
434
|
+
show: e.bool,
|
|
435
|
+
tabIndex: e.number,
|
|
436
|
+
title: e.string,
|
|
437
|
+
value: e.instanceOf(Date),
|
|
438
|
+
weekNumber: e.bool,
|
|
439
|
+
width: e.oneOfType([e.number, e.string]),
|
|
440
|
+
validationMessage: e.string,
|
|
441
|
+
required: e.bool,
|
|
442
|
+
validate: e.bool,
|
|
443
|
+
valid: e.bool,
|
|
444
|
+
cancelButton: e.bool,
|
|
445
|
+
size: e.oneOf([null, "small", "medium", "large"]),
|
|
446
|
+
rounded: e.oneOf([null, "small", "medium", "large", "full"]),
|
|
447
|
+
fillMode: e.oneOf([null, "solid", "flat", "outline"])
|
|
448
|
+
}, o.defaultProps = {
|
|
449
|
+
defaultShow: !1,
|
|
450
|
+
defaultValue: null,
|
|
451
|
+
disabled: !1,
|
|
452
|
+
format: "g",
|
|
453
|
+
// general date and time pattern (short time): "M/d/y h:mm a" for en.
|
|
454
|
+
max: Q,
|
|
455
|
+
min: Y,
|
|
456
|
+
popupSettings: {},
|
|
457
|
+
tabIndex: 0,
|
|
458
|
+
weekNumber: !1,
|
|
459
|
+
required: !1,
|
|
460
|
+
validityStyles: !0,
|
|
461
|
+
cancelButton: !0,
|
|
462
|
+
dateInput: Z,
|
|
463
|
+
size: "medium",
|
|
464
|
+
rounded: "medium",
|
|
465
|
+
fillMode: "solid"
|
|
466
|
+
};
|
|
467
|
+
let c = o;
|
|
468
|
+
const he = $(), ue = W(X(he, c));
|
|
469
|
+
ue.displayName = "KendoReactDateTimePicker";
|
|
470
|
+
oe(c);
|
|
471
|
+
export {
|
|
472
|
+
ue as DateTimePicker,
|
|
473
|
+
he as DateTimePickerPropsContext,
|
|
474
|
+
c as DateTimePickerWithoutContext
|
|
475
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),k=require("@progress/kendo-react-intl"),n=require("../messages/index.js"),m=require("@progress/kendo-react-buttons"),E=require("../calendar/components/Calendar.js"),P=require("../timepicker/TimePart.js"),o=require("../utils.js"),b=require("@progress/kendo-date-math"),l=require("@progress/kendo-react-common"),y=require("../timepicker/utils.js");function w(u){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const e in u)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(u,e);Object.defineProperty(a,e,t.get?t:{enumerable:!0,get:()=>u[e]})}}return a.default=u,Object.freeze(a)}const i=w(C),f=class f extends i.Component{constructor(a){super(a),this._calendar=null,this._timePart=null,this._cancelButton=null,this._acceptButton=null,this._dateButtonRef=null,this._calendarWrap=null,this.shouldFocusPart=!1,this.focus=e=>{Promise.resolve().then(()=>{this.state.tab==="time"&&this._timePart&&this._timePart.focus(e);const t=this.calendarElement();this.state.tab==="date"&&t&&t.focus(e)})},this.calendarElement=()=>this._calendar&&this._calendar.element||this._calendarWrap&&this._calendarWrap.querySelector(".k-widget.k-calendar"),this.move=e=>{if(e==="right"&&this.state.tab==="time"||e==="left"&&this.state.tab==="date")return;const t=e==="left"?"date":"time";this.shouldFocusPart=!0,this.setState({tab:t})},this.dateTimeFooter=()=>{const{cancelButton:e}=this.props,t=this.localizationService.toLanguageString(n.dateTimePickerCancel,n.messages[n.dateTimePickerCancel]),s=this.localizationService.toLanguageString(n.dateTimePickerSet,n.messages[n.dateTimePickerSet]);return i.createElement("div",{className:"k-datetime-footer k-actions k-actions-stretched"},e&&i.createElement(m.Button,{type:"button",ref:r=>{this._cancelButton=r},className:"k-time-cancel",onClick:this.handleReject,onKeyDown:this.handleCancelKeyDown,title:t,"aria-label":t},t),i.createElement(m.Button,{type:"button",themeColor:"primary",ref:r=>{this._acceptButton=r},className:"k-time-accept",disabled:!this.hasDateValue,onClick:this.handleAccept,onKeyDown:this.handleSetKeyDown,title:s,"aria-label":s},s))},this.handleReject=e=>{this.setState({dateValue:this.props.value,timeValue:this.props.value||o.MIDNIGHT_DATE});const t=this.mergeDate(this.props.value,this.props.value||o.MIDNIGHT_DATE);if(this.props.onReject){const s={nativeEvent:e.nativeEvent,syntheticEvent:e,target:this,value:t};this.props.onReject.call(void 0,s)}},this.handleAccept=(e,t)=>{if(!this.state.dateValue||!this.state.timeValue||!this.hasDateValue)return;const s=this.mergeDate(this.state.dateValue,t||this.state.timeValue);this.props.onChange.call(void 0,{syntheticEvent:e,nativeEvent:e.nativeEvent,value:s,target:this})},this.handleNowClick=e=>{this.setState({timeValue:y.getNow()}),this.handleAccept(e,y.getNow())},this.handleCalendarValueChange=e=>{e.syntheticEvent.stopPropagation(),this.setState({dateValue:e.value,tab:"time"}),this.shouldFocusPart=!0},this.handleTimeListContainerChange=e=>{this.setState({timeValue:e})},this.handleDateClick=e=>{e.stopPropagation(),this.move("left")},this.handleTimeClick=e=>{e.stopPropagation(),this.move("right")},this.handleKeyDown=e=>{const{keyCode:t,altKey:s}=e;if(!this.props.disabled)switch(t){case l.Keys.enter:!this.hasActiveButton()&&this.hasDateValue&&this.handleAccept(e);return;case l.Keys.left:if(!s)return;this.move("left");return;case l.Keys.right:if(!s)return;this.move("right");return;default:return}},this.handleCancelKeyDown=e=>{const{keyCode:t}=e;t===l.Keys.tab&&this._dateButtonRef&&this._dateButtonRef.element&&!this.hasDateValue&&(e.preventDefault(),this._dateButtonRef.element.focus())},this.handleSetKeyDown=e=>{const{keyCode:t}=e;t===l.Keys.tab&&this._dateButtonRef&&this._dateButtonRef.element&&(e.preventDefault(),this._dateButtonRef.element.focus())},this.handleDateKeyDown=e=>{var r,d,c,p;const{keyCode:t,shiftKey:s}=e;s&&t===l.Keys.tab&&(e.stopPropagation(),this.hasDateValue?(p=(c=this._acceptButton)==null?void 0:c.element)==null||p.focus():(d=(r=this._cancelButton)==null?void 0:r.element)==null||d.focus()),t===l.Keys.enter&&(e.stopPropagation(),this.move("left"))},this.handleTimeKeyDown=e=>{const{keyCode:t}=e;t===l.Keys.enter&&(e.stopPropagation(),this.move("right"))},this.handleTimePartMount=e=>{this.setState({timeValue:e})},this.state={tab:"date",dateValue:this.props.value,timeValue:this.props.value||o.MIDNIGHT_DATE}}get calendar(){return this._calendar}get timePart(){return this._timePart}get hasDateValue(){return this.state.dateValue!==null}get localizationService(){return k.provideLocalizationService(this)}componentDidUpdate(a,e){var t,s;this.shouldFocusPart&&this.focus({preventScroll:!0}),(((t=a.value)==null?void 0:t.getTime())!==((s=this.props.value)==null?void 0:s.getTime())||this.state.tab!==e.tab&&this.props.value)&&this.setState({dateValue:a.value&&this.props.value&&b.isEqualDate(a.value,this.props.value)?this.state.dateValue:this.props.value,timeValue:this.props.value||o.MIDNIGHT_DATE}),this.shouldFocusPart=!1}render(){const{disabled:a,min:e,max:t,weekNumber:s,focusedDate:r,format:d,mobileMode:c,footerActions:p}=this.props,D=l.classNames({"k-date-tab":this.state.tab==="date","k-time-tab":this.state.tab==="time","k-disabled":a},"k-datetime-wrap"),T=this.localizationService.toLanguageString(n.date,n.messages[n.date]),_=this.localizationService.toLanguageString(n.time,n.messages[n.time]),v={min:e,max:t,weekNumber:s,focusedDate:r,disabled:a||this.state.tab!=="date",value:this.state.dateValue,onChange:this.handleCalendarValueChange,navigation:!1,tabIndex:a||this.state.tab!=="date"?-1:void 0,mobileMode:c};return i.createElement("div",{onKeyDown:this.handleKeyDown,className:D,tabIndex:-1},i.createElement("div",{className:"k-datetime-buttongroup"},i.createElement(m.ButtonGroup,{width:"100%"},i.createElement(m.Button,{ref:h=>this._dateButtonRef=h,type:"button",selected:this.state.tab==="date",togglable:!0,onClick:this.handleDateClick,onKeyDown:this.handleDateKeyDown},T),i.createElement(m.Button,{type:"button",selected:this.state.tab==="time",togglable:!0,onClick:this.handleTimeClick,onKeyDown:this.handleTimeKeyDown},_))),i.createElement("div",{className:"k-datetime-selector"},i.createElement("div",{className:"k-datetime-calendar-wrap",ref:h=>this._calendarWrap=h},this.props.calendar?i.createElement(this.props.calendar,{key:this.state.tab,...v}):i.createElement(E.Calendar,{key:this.state.tab,ref:h=>{this._calendar=h},...v})),i.createElement("div",{className:"k-datetime-time-wrap"},i.createElement("div",{className:c?"k-reset k-timeselector-lg k-timeselector":""},i.createElement(P.TimePart,{key:1,onNowClick:this.handleNowClick,disabled:a||this.state.tab!=="time",ref:h=>{this._timePart=h},min:this.minTime||o.MIN_TIME,max:this.maxTime||o.MAX_TIME,steps:this.props.steps,value:this.state.timeValue,format:d,onChange:this.handleTimeListContainerChange,onMount:this.handleTimePartMount,mobileMode:c})))),p&&this.dateTimeFooter())}get minTime(){return this.props.minTime!==void 0?this.props.minTime:this.normalizeRange(this.props.min,this.state.dateValue)}get maxTime(){return this.props.maxTime!==void 0?this.props.maxTime:this.normalizeRange(this.props.max,this.state.dateValue)}normalizeRange(a,e){return b.isEqualDate(a,e||o.getToday())?a:null}hasActiveButton(){if(!this._acceptButton)return!1;const a=l.getActiveElement(document);return this._acceptButton&&a===this._acceptButton.element||this._cancelButton&&a===this._cancelButton.element}mergeTime(a,e){return a&&e?o.setTime(e,a):e}mergeDate(a,e){return a?o.setTime(a||o.getToday(),e):e}};f.defaultProps={footerActions:!0};let g=f;k.registerForLocalization(g);exports.DateTimeSelector=g;
|