@progress/kendo-react-dateinputs 5.14.0-dev.202305100821 → 5.14.0-dev.202305111601
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/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/dist/es/common/AdaptiveMode.d.ts +7 -0
- package/dist/es/common/AdaptiveMode.js +19 -12
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/timepicker/TimeList.d.ts +1 -0
- package/dist/es/timepicker/TimeList.js +5 -0
- package/dist/es/timepicker/TimePart.d.ts +1 -0
- package/dist/es/timepicker/TimePart.js +2 -2
- package/dist/es/timepicker/TimePicker.d.ts +27 -0
- package/dist/es/timepicker/TimePicker.js +121 -36
- package/dist/es/timepicker/TimeSelector.d.ts +10 -0
- package/dist/es/timepicker/TimeSelector.js +11 -4
- package/dist/npm/common/AdaptiveMode.d.ts +7 -0
- package/dist/npm/common/AdaptiveMode.js +18 -11
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/timepicker/TimeList.d.ts +1 -0
- package/dist/npm/timepicker/TimeList.js +5 -0
- package/dist/npm/timepicker/TimePart.d.ts +1 -0
- package/dist/npm/timepicker/TimePart.js +2 -2
- package/dist/npm/timepicker/TimePicker.d.ts +27 -0
- package/dist/npm/timepicker/TimePicker.js +119 -34
- package/dist/npm/timepicker/TimeSelector.d.ts +10 -0
- package/dist/npm/timepicker/TimeSelector.js +11 -4
- package/dist/systemjs/kendo-react-dateinputs.js +1 -1
- package/package.json +13 -13
|
@@ -8,7 +8,7 @@ exports.packageMetadata = {
|
|
|
8
8
|
name: '@progress/kendo-react-dateinputs',
|
|
9
9
|
productName: 'KendoReact',
|
|
10
10
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
11
|
-
publishDate:
|
|
11
|
+
publishDate: 1683818443,
|
|
12
12
|
version: '',
|
|
13
13
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
14
14
|
};
|
|
@@ -30,6 +30,7 @@ var SCROLL_THRESHOLD = 2; // < 2px threshold
|
|
|
30
30
|
var SNAP_THRESHOLD = 0.05; // % of the item height
|
|
31
31
|
var SCROLL_THROTTLE = 100; // ms
|
|
32
32
|
var SKIP = 0;
|
|
33
|
+
var MOBILE_MODE_OFFSET = 9;
|
|
33
34
|
var getters = (_a = {},
|
|
34
35
|
_a[kendo_react_common_1.Keys.end] = function (data, _) { return data[data.length - 1]; },
|
|
35
36
|
_a[kendo_react_common_1.Keys.home] = function (data, _) { return data[0]; },
|
|
@@ -91,6 +92,10 @@ var TimeList = /** @class */ (function (_super) {
|
|
|
91
92
|
_this.listHeight = _this.dom.timeListHeight;
|
|
92
93
|
_this.topOffset = (_this.listHeight - _this.itemHeight) / 2;
|
|
93
94
|
_this.bottomOffset = _this.listHeight - _this.itemHeight;
|
|
95
|
+
if (_this.props.mobileMode) {
|
|
96
|
+
_this.topOffset += MOBILE_MODE_OFFSET;
|
|
97
|
+
_this.bottomOffset += MOBILE_MODE_OFFSET * 2;
|
|
98
|
+
}
|
|
94
99
|
_this.topThreshold = _this.itemHeight * SNAP_THRESHOLD;
|
|
95
100
|
_this.bottomThreshold = _this.itemHeight * (1 - SNAP_THRESHOLD);
|
|
96
101
|
};
|
|
@@ -210,7 +210,7 @@ var TimePart = /** @class */ (function (_super) {
|
|
|
210
210
|
*/
|
|
211
211
|
TimePart.prototype.render = function () {
|
|
212
212
|
var _this = this;
|
|
213
|
-
var _a = this.props, format = _a.format, smoothScroll = _a.smoothScroll, onNowClick = _a.onNowClick, className = _a.className, disabled = _a.disabled;
|
|
213
|
+
var _a = this.props, format = _a.format, smoothScroll = _a.smoothScroll, onNowClick = _a.onNowClick, className = _a.className, disabled = _a.disabled, mobileMode = _a.mobileMode, show = _a.show;
|
|
214
214
|
this.snapTime = (0, utils_2.snapTime)((0, utils_2.generateSnappers)(this.steps, this.min));
|
|
215
215
|
this.dateFormatParts = this.intl
|
|
216
216
|
.splitDateFormat(format || TimePart.defaultProps.format)
|
|
@@ -236,7 +236,7 @@ var TimePart = /** @class */ (function (_super) {
|
|
|
236
236
|
React.createElement("span", { className: "k-title", onMouseDown: function (e) { e.preventDefault(); } }, _this.intl.dateFieldName(part)),
|
|
237
237
|
React.createElement(TimeList_1.TimeList, { min: _this.min, max: _this.max, boundRange: _this.boundRange, part: part, step: part.type ? _this.steps[part.type] : 1, smoothScroll: smoothScroll, ref: function (el) { if (!el) {
|
|
238
238
|
return;
|
|
239
|
-
} _this.timeLists.push(el); }, id: idx, onFocus: function () { _this.handleListFocus(idx); }, onBlur: _this.handleListBlur, onChange: _this.handleChange, value: _this.value, disabled: disabled, show:
|
|
239
|
+
} _this.timeLists.push(el); }, id: idx, onFocus: function () { _this.handleListFocus(idx); }, onBlur: _this.handleListBlur, onChange: _this.handleChange, value: _this.value, disabled: disabled, show: show, mobileMode: mobileMode }))
|
|
240
240
|
: React.createElement("div", { key: idx, className: "k-time-separator" }, part.pattern));
|
|
241
241
|
}))));
|
|
242
242
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as PropTypes from 'prop-types';
|
|
3
3
|
import { FormComponent, FormComponentProps, FormComponentValidity } from '@progress/kendo-react-common';
|
|
4
|
+
import { LocalizationService } from '@progress/kendo-react-intl';
|
|
4
5
|
import { DateInput, DateInputProps } from '../dateinput/DateInput';
|
|
5
6
|
import { TimeSelector } from './TimeSelector';
|
|
6
7
|
import { TimePickerSettings } from './models';
|
|
@@ -69,6 +70,14 @@ export interface TimePickerProps extends TimePickerSettings, FormComponentProps
|
|
|
69
70
|
* @default `solid`
|
|
70
71
|
*/
|
|
71
72
|
fillMode?: null | 'solid' | 'flat' | 'outline';
|
|
73
|
+
/**
|
|
74
|
+
* Providing different rendering of the popup element based on the screen dimensions.
|
|
75
|
+
*/
|
|
76
|
+
adaptive?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Specifies the text that is rendered as title in the adaptive popup.
|
|
79
|
+
*/
|
|
80
|
+
adaptiveTitle?: string;
|
|
72
81
|
}
|
|
73
82
|
/**
|
|
74
83
|
* @hidden
|
|
@@ -77,6 +86,8 @@ export interface TimePickerState {
|
|
|
77
86
|
value: Date | null;
|
|
78
87
|
show: boolean;
|
|
79
88
|
focused: boolean;
|
|
89
|
+
windowWidth?: number;
|
|
90
|
+
candidate: Date | null;
|
|
80
91
|
}
|
|
81
92
|
/** @hidden */
|
|
82
93
|
export declare class TimePickerWithoutContext extends React.Component<TimePickerProps, TimePickerState> implements FormComponent {
|
|
@@ -181,6 +192,8 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
|
|
|
181
192
|
private showDuringOnChange?;
|
|
182
193
|
private shouldFocusDateInput;
|
|
183
194
|
private prevShow;
|
|
195
|
+
private observerResize?;
|
|
196
|
+
private get document();
|
|
184
197
|
constructor(props: TimePickerProps);
|
|
185
198
|
/**
|
|
186
199
|
* Gets the wrapping element of the TimePicker.
|
|
@@ -210,6 +223,10 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
|
|
|
210
223
|
* Represents the validity state into which the TimePicker is set.
|
|
211
224
|
*/
|
|
212
225
|
get validity(): FormComponentValidity;
|
|
226
|
+
/**
|
|
227
|
+
* The mobile mode of the ComboBox.
|
|
228
|
+
*/
|
|
229
|
+
get mobileMode(): boolean;
|
|
213
230
|
/**
|
|
214
231
|
* @hidden
|
|
215
232
|
*/
|
|
@@ -222,6 +239,7 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
|
|
|
222
239
|
private get min();
|
|
223
240
|
private get max();
|
|
224
241
|
protected get dateInputComp(): React.ComponentType<DateInputProps<any>>;
|
|
242
|
+
protected get localizationService(): LocalizationService;
|
|
225
243
|
/**
|
|
226
244
|
* @hidden
|
|
227
245
|
*/
|
|
@@ -230,6 +248,10 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
|
|
|
230
248
|
* @hidden
|
|
231
249
|
*/
|
|
232
250
|
componentDidUpdate(): void;
|
|
251
|
+
/**
|
|
252
|
+
* @hidden
|
|
253
|
+
*/
|
|
254
|
+
componentWillUnmount(): void;
|
|
233
255
|
/**
|
|
234
256
|
* @hidden
|
|
235
257
|
*/
|
|
@@ -238,6 +260,9 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
|
|
|
238
260
|
* @hidden
|
|
239
261
|
*/
|
|
240
262
|
render(): JSX.Element;
|
|
263
|
+
private renderTimeSelector;
|
|
264
|
+
private renderPopup;
|
|
265
|
+
private renderAdaptivePopup;
|
|
241
266
|
protected setTimeSelectorRef: (timeSelector: TimeSelector | null) => void;
|
|
242
267
|
protected nextValue: (nextProps: TimePickerProps, nextState: TimePickerState) => Date | null;
|
|
243
268
|
protected nextShow: (nextProps: TimePickerProps, nextState: TimePickerState) => boolean;
|
|
@@ -245,6 +270,7 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
|
|
|
245
270
|
protected setShow(show: boolean): void;
|
|
246
271
|
protected mergeTime(value: Date | null): Date | null;
|
|
247
272
|
private handleInputValueChange;
|
|
273
|
+
private handleTimeChange;
|
|
248
274
|
private handleValueChange;
|
|
249
275
|
private handleFocus;
|
|
250
276
|
private handleBlur;
|
|
@@ -252,6 +278,7 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
|
|
|
252
278
|
private handleIconClick;
|
|
253
279
|
private handleIconMouseDown;
|
|
254
280
|
private handleKeyDown;
|
|
281
|
+
private calculateMedia;
|
|
255
282
|
}
|
|
256
283
|
/**
|
|
257
284
|
* Represents the PropsContext of the `TimePicker` component.
|
|
@@ -54,6 +54,9 @@ var utils_1 = require("../utils");
|
|
|
54
54
|
var utils_2 = require("./utils");
|
|
55
55
|
var usePickerFloatingLabel_1 = require("../hooks/usePickerFloatingLabel");
|
|
56
56
|
var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
|
|
57
|
+
var constants_1 = require("../common/constants");
|
|
58
|
+
var AdaptiveMode_1 = require("../common/AdaptiveMode");
|
|
59
|
+
var kendo_react_layout_1 = require("@progress/kendo-react-layout");
|
|
57
60
|
/** @hidden */
|
|
58
61
|
var TimePickerWithoutContext = /** @class */ (function (_super) {
|
|
59
62
|
__extends(TimePickerWithoutContext, _super);
|
|
@@ -73,6 +76,41 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
73
76
|
_this.dateInput.focus();
|
|
74
77
|
}
|
|
75
78
|
};
|
|
79
|
+
_this.renderTimeSelector = function () {
|
|
80
|
+
var _a = _this.props, smoothScroll = _a.smoothScroll, cancelButton = _a.cancelButton, nowButton = _a.nowButton, disabled = _a.disabled, format = _a.format, steps = _a.steps;
|
|
81
|
+
return (React.createElement(TimeSelector_1.TimeSelector, { ref: _this.setTimeSelectorRef, className: _this.mobileMode ? 'k-reset k-timeselector-lg' : '', mobileMode: _this.mobileMode, show: _this.show, cancelButton: cancelButton, disabled: disabled, nowButton: nowButton, format: format, min: _this.min, max: _this.max, steps: steps, smoothScroll: smoothScroll, value: _this.value, footer: _this.mobileMode ? false : true, handleTimeChange: _this.mobileMode && _this.handleTimeChange, onChange: _this.handleValueChange, onReject: _this.handleValueReject }));
|
|
82
|
+
};
|
|
83
|
+
_this.renderPopup = function () {
|
|
84
|
+
var _a = _this.popupSettings, popupClass = _a.popupClass, otherPopupSettings = __rest(_a, ["popupClass"]);
|
|
85
|
+
var popupClassNames = (0, kendo_react_common_1.classNames)('k-group k-reset', popupClass);
|
|
86
|
+
var popupProps = __assign({ popupClass: 'k-timepicker-popup', show: _this.show, animate: _this.element !== null, anchor: _this.element, className: popupClassNames, id: _this._popupId, anchorAlign: {
|
|
87
|
+
horizontal: 'left',
|
|
88
|
+
vertical: 'bottom'
|
|
89
|
+
}, popupAlign: {
|
|
90
|
+
horizontal: 'left',
|
|
91
|
+
vertical: 'top'
|
|
92
|
+
} }, otherPopupSettings);
|
|
93
|
+
return (_this.props.popup
|
|
94
|
+
? React.createElement(_this.props.popup, __assign({}, popupProps), _this.renderTimeSelector())
|
|
95
|
+
: React.createElement(kendo_react_popup_1.Popup, __assign({}, popupProps), _this.renderTimeSelector()));
|
|
96
|
+
};
|
|
97
|
+
_this.renderAdaptivePopup = function () {
|
|
98
|
+
var _a = _this.state.windowWidth, windowWidth = _a === void 0 ? 0 : _a;
|
|
99
|
+
var actionSheetProps = {
|
|
100
|
+
expand: _this.show,
|
|
101
|
+
onClose: _this.handleBlur,
|
|
102
|
+
adaptiveTitle: _this.props.adaptiveTitle,
|
|
103
|
+
windowWidth: windowWidth,
|
|
104
|
+
footer: {
|
|
105
|
+
cancelText: _this.localizationService.toLanguageString(messages_1.toggleClock, messages_1.messages[messages_1.timePickerCancel]),
|
|
106
|
+
onCancel: function (event) { return _this.handleValueReject(event); },
|
|
107
|
+
applyText: _this.localizationService.toLanguageString(messages_1.timePickerSet, messages_1.messages[messages_1.timePickerSet]),
|
|
108
|
+
onApply: function (event) { return _this.handleValueChange(event); }
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return (React.createElement(AdaptiveMode_1.AdaptiveMode, __assign({}, actionSheetProps),
|
|
112
|
+
React.createElement(kendo_react_layout_1.ActionSheetContent, { className: '!k-overflow-hidden' }, _this.renderTimeSelector())));
|
|
113
|
+
};
|
|
76
114
|
_this.setTimeSelectorRef = function (timeSelector) {
|
|
77
115
|
_this._timeSelector = timeSelector;
|
|
78
116
|
};
|
|
@@ -90,20 +128,24 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
90
128
|
var value = _this.mergeTime(event.value);
|
|
91
129
|
_this.handleValueChange(__assign(__assign({}, event), { value: value }));
|
|
92
130
|
};
|
|
131
|
+
_this.handleTimeChange = function (date) {
|
|
132
|
+
_this.setState({ candidate: date.time });
|
|
133
|
+
};
|
|
93
134
|
_this.handleValueChange = function (event) {
|
|
94
135
|
_this.setState({
|
|
95
|
-
value: (0, kendo_date_math_1.cloneDate)(event.value),
|
|
136
|
+
value: (0, kendo_date_math_1.cloneDate)(event.value || _this.state.candidate),
|
|
96
137
|
show: false
|
|
97
138
|
});
|
|
98
139
|
_this.valueDuringOnChange = event.value;
|
|
99
140
|
_this.showDuringOnChange = false;
|
|
100
141
|
_this.shouldFocusDateInput = true;
|
|
101
142
|
var onChange = _this.props.onChange;
|
|
143
|
+
var value = _this.value || _this.state.candidate;
|
|
102
144
|
if (onChange) {
|
|
103
145
|
onChange.call(undefined, {
|
|
104
146
|
syntheticEvent: event.syntheticEvent,
|
|
105
147
|
nativeEvent: event.nativeEvent,
|
|
106
|
-
value:
|
|
148
|
+
value: value,
|
|
107
149
|
show: _this.show,
|
|
108
150
|
target: _this
|
|
109
151
|
});
|
|
@@ -149,13 +191,25 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
149
191
|
_this.state = {
|
|
150
192
|
value: _this.props.defaultValue || TimePickerWithoutContext.defaultProps.defaultValue,
|
|
151
193
|
show: _this.props.defaultShow || TimePickerWithoutContext.defaultProps.defaultShow,
|
|
152
|
-
focused: false
|
|
194
|
+
focused: false,
|
|
195
|
+
candidate: null
|
|
153
196
|
};
|
|
154
197
|
_this.normalizeTime = _this.normalizeTime.bind(_this);
|
|
155
198
|
_this.setShow = _this.setShow.bind(_this);
|
|
156
199
|
_this.mergeTime = _this.mergeTime.bind(_this);
|
|
157
200
|
return _this;
|
|
158
201
|
}
|
|
202
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "document", {
|
|
203
|
+
get: function () {
|
|
204
|
+
if (!kendo_react_common_1.canUseDOM) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
// useful only for user actions
|
|
208
|
+
return (this.element && this.element.ownerDocument) || document;
|
|
209
|
+
},
|
|
210
|
+
enumerable: false,
|
|
211
|
+
configurable: true
|
|
212
|
+
});
|
|
159
213
|
Object.defineProperty(TimePickerWithoutContext.prototype, "element", {
|
|
160
214
|
/**
|
|
161
215
|
* Gets the wrapping element of the TimePicker.
|
|
@@ -248,6 +302,17 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
248
302
|
enumerable: false,
|
|
249
303
|
configurable: true
|
|
250
304
|
});
|
|
305
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "mobileMode", {
|
|
306
|
+
/**
|
|
307
|
+
* The mobile mode of the ComboBox.
|
|
308
|
+
*/
|
|
309
|
+
get: function () {
|
|
310
|
+
var isAdaptive = this.state.windowWidth && this.state.windowWidth <= constants_1.MOBILE_MEDIUM_DEVISE && this.props.adaptive;
|
|
311
|
+
return !!isAdaptive;
|
|
312
|
+
},
|
|
313
|
+
enumerable: false,
|
|
314
|
+
configurable: true
|
|
315
|
+
});
|
|
251
316
|
Object.defineProperty(TimePickerWithoutContext.prototype, "validityStyles", {
|
|
252
317
|
/**
|
|
253
318
|
* @hidden
|
|
@@ -300,14 +365,26 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
300
365
|
enumerable: false,
|
|
301
366
|
configurable: true
|
|
302
367
|
});
|
|
368
|
+
Object.defineProperty(TimePickerWithoutContext.prototype, "localizationService", {
|
|
369
|
+
get: function () {
|
|
370
|
+
return (0, kendo_react_intl_1.provideLocalizationService)(this);
|
|
371
|
+
},
|
|
372
|
+
enumerable: false,
|
|
373
|
+
configurable: true
|
|
374
|
+
});
|
|
303
375
|
/**
|
|
304
376
|
* @hidden
|
|
305
377
|
*/
|
|
306
378
|
TimePickerWithoutContext.prototype.componentDidMount = function () {
|
|
379
|
+
var _a;
|
|
380
|
+
this.observerResize = kendo_react_common_1.canUseDOM && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this));
|
|
307
381
|
if (this.show) {
|
|
308
382
|
// If defaultShow is true during the initial render, the popup is not aligned.
|
|
309
383
|
this.forceUpdate();
|
|
310
384
|
}
|
|
385
|
+
if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
|
|
386
|
+
this.observerResize.observe(this.document.body);
|
|
387
|
+
}
|
|
311
388
|
};
|
|
312
389
|
/**
|
|
313
390
|
* @hidden
|
|
@@ -325,15 +402,23 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
325
402
|
this.prevShow = this.show;
|
|
326
403
|
this.shouldFocusDateInput = false;
|
|
327
404
|
};
|
|
405
|
+
/**
|
|
406
|
+
* @hidden
|
|
407
|
+
*/
|
|
408
|
+
TimePickerWithoutContext.prototype.componentWillUnmount = function () {
|
|
409
|
+
var _a;
|
|
410
|
+
if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
|
|
411
|
+
this.observerResize.disconnect();
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
;
|
|
328
415
|
/**
|
|
329
416
|
* @hidden
|
|
330
417
|
*/
|
|
331
418
|
TimePickerWithoutContext.prototype.render = function () {
|
|
332
419
|
var _this = this;
|
|
333
|
-
var _a = this.props, _b = _a.size, size = _b === void 0 ? TimePickerWithoutContext.defaultProps.size : _b, _c = _a.rounded, rounded = _c === void 0 ? TimePickerWithoutContext.defaultProps.rounded : _c, _d = _a.fillMode, fillMode = _d === void 0 ? TimePickerWithoutContext.defaultProps.fillMode : _d, disabled = _a.disabled, tabIndex = _a.tabIndex, title = _a.title, id = _a.id, className = _a.className, format = _a.format, formatPlaceholder = _a.formatPlaceholder,
|
|
334
|
-
var _e = this.popupSettings, popupClass = _e.popupClass, otherPopupSettings = __rest(_e, ["popupClass"]);
|
|
420
|
+
var _a = this.props, _b = _a.size, size = _b === void 0 ? TimePickerWithoutContext.defaultProps.size : _b, _c = _a.rounded, rounded = _c === void 0 ? TimePickerWithoutContext.defaultProps.rounded : _c, _d = _a.fillMode, fillMode = _d === void 0 ? TimePickerWithoutContext.defaultProps.fillMode : _d, disabled = _a.disabled, tabIndex = _a.tabIndex, title = _a.title, id = _a.id, className = _a.className, format = _a.format, formatPlaceholder = _a.formatPlaceholder, width = _a.width, name = _a.name, steps = _a.steps, validationMessage = _a.validationMessage, required = _a.required, validityStyles = _a.validityStyles, ariaLabelledBy = _a.ariaLabelledBy, ariaDescribedBy = _a.ariaDescribedBy;
|
|
335
421
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
336
|
-
var popupClassNames = (0, kendo_react_common_1.classNames)('k-group k-reset', popupClass);
|
|
337
422
|
var dateInputProps = {
|
|
338
423
|
disabled: disabled,
|
|
339
424
|
format: format,
|
|
@@ -359,38 +444,30 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
359
444
|
ariaExpanded: this.show,
|
|
360
445
|
size: null,
|
|
361
446
|
fillMode: null,
|
|
362
|
-
rounded: null
|
|
447
|
+
rounded: null,
|
|
448
|
+
readonly: this.mobileMode
|
|
363
449
|
};
|
|
364
|
-
var
|
|
365
|
-
|
|
366
|
-
vertical: 'bottom'
|
|
367
|
-
}, popupAlign: {
|
|
368
|
-
horizontal: 'left',
|
|
369
|
-
vertical: 'top'
|
|
370
|
-
} }, otherPopupSettings);
|
|
371
|
-
var timeSelector = (React.createElement(TimeSelector_1.TimeSelector, { ref: this.setTimeSelectorRef, show: this.show, cancelButton: cancelButton, disabled: disabled, nowButton: nowButton, format: format, min: this.min, max: this.max, steps: steps, smoothScroll: smoothScroll, value: this.value, onChange: this.handleValueChange, onReject: this.handleValueReject }));
|
|
372
|
-
var localizationService = (0, kendo_react_intl_1.provideLocalizationService)(this);
|
|
373
|
-
var toggleClockMessage = localizationService.toLanguageString(messages_1.toggleClock, messages_1.messages[messages_1.toggleClock]);
|
|
374
|
-
var toggleTimeMessage = localizationService
|
|
450
|
+
var toggleClockMessage = this.localizationService.toLanguageString(messages_1.toggleClock, messages_1.messages[messages_1.toggleClock]);
|
|
451
|
+
var toggleTimeMessage = this.localizationService
|
|
375
452
|
.toLanguageString(messages_1.toggleTimeSelector, messages_1.messages[messages_1.toggleTimeSelector]);
|
|
376
|
-
var timepicker = (React.createElement(kendo_react_common_1.AsyncFocusBlur, { onFocus: this.handleFocus, onBlur: this.handleBlur, onSyncBlur: this.props.onBlur, onSyncFocus: this.props.onFocus }, function (_a) {
|
|
453
|
+
var timepicker = (React.createElement(kendo_react_common_1.AsyncFocusBlur, { onFocus: this.handleFocus, onBlur: !this.mobileMode ? this.handleBlur : undefined, onSyncBlur: this.props.onBlur, onSyncFocus: this.props.onFocus }, function (_a) {
|
|
377
454
|
var _b;
|
|
378
455
|
var onFocus = _a.onFocus, onBlur = _a.onBlur;
|
|
379
|
-
return (React.createElement(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
456
|
+
return (React.createElement(React.Fragment, null,
|
|
457
|
+
React.createElement("div", { ref: function (span) { _this._element = span; }, className: (0, kendo_react_common_1.classNames)('k-input', 'k-timepicker', (_b = {},
|
|
458
|
+
_b["k-input-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
459
|
+
_b["k-rounded-".concat(kendo_react_common_1.kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
|
|
460
|
+
_b["k-input-".concat(fillMode)] = fillMode,
|
|
461
|
+
_b['k-invalid'] = !isValid,
|
|
462
|
+
_b['k-required'] = _this.required,
|
|
463
|
+
_b['k-disabled'] = _this.props.disabled,
|
|
464
|
+
_b), className), onKeyDown: _this.handleKeyDown, style: { width: width }, onFocus: onFocus, onBlur: onBlur, onClick: _this.mobileMode ? _this.handleIconClick : undefined },
|
|
465
|
+
React.createElement(_this.dateInputComp, __assign({ _ref: _this._dateInput, ariaRole: "combobox", ariaControls: _this._popupId }, dateInputProps)),
|
|
466
|
+
React.createElement(kendo_react_buttons_1.Button, __assign({ tabIndex: -1, type: "button", icon: 'clock', svgIcon: kendo_svg_icons_1.clockIcon, onMouseDown: _this.handleIconMouseDown, onClick: _this.handleIconClick, title: toggleTimeMessage, className: "k-input-button", rounded: null }, {
|
|
467
|
+
'aria-label': toggleClockMessage
|
|
468
|
+
})),
|
|
469
|
+
!_this.mobileMode && _this.renderPopup()),
|
|
470
|
+
_this.mobileMode && _this.renderAdaptivePopup()));
|
|
394
471
|
}));
|
|
395
472
|
return this.props.label
|
|
396
473
|
? (React.createElement(usePickerFloatingLabel_1.PickerFloatingLabel, { dateInput: this._dateInput, label: this.props.label, editorId: id, editorValid: isValid, editorDisabled: this.props.disabled, children: timepicker, style: { width: this.props.width } }))
|
|
@@ -408,6 +485,14 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
408
485
|
TimePickerWithoutContext.prototype.mergeTime = function (value) {
|
|
409
486
|
return this.value && value ? (0, utils_1.setTime)(this.value, value) : value;
|
|
410
487
|
};
|
|
488
|
+
TimePickerWithoutContext.prototype.calculateMedia = function (entries) {
|
|
489
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
490
|
+
var entry = entries_1[_i];
|
|
491
|
+
this.setState({ windowWidth: entry.target.clientWidth });
|
|
492
|
+
}
|
|
493
|
+
;
|
|
494
|
+
};
|
|
495
|
+
;
|
|
411
496
|
/**
|
|
412
497
|
* @hidden
|
|
413
498
|
*/
|
|
@@ -18,6 +18,12 @@ export interface TimeSelectorChangeEvent {
|
|
|
18
18
|
value: Date;
|
|
19
19
|
target: TimeSelector;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export interface TimeSelectorTimeChangeEvent {
|
|
25
|
+
time: Date;
|
|
26
|
+
}
|
|
21
27
|
/**
|
|
22
28
|
* @hidden
|
|
23
29
|
*/
|
|
@@ -30,6 +36,7 @@ export interface TimeSelectorProps {
|
|
|
30
36
|
min?: Date;
|
|
31
37
|
nowButton?: boolean;
|
|
32
38
|
onChange?: any;
|
|
39
|
+
handleTimeChange?: any;
|
|
33
40
|
onReject?: any;
|
|
34
41
|
steps?: TimePickerIncrementalSteps;
|
|
35
42
|
smoothScroll?: boolean;
|
|
@@ -37,6 +44,8 @@ export interface TimeSelectorProps {
|
|
|
37
44
|
value?: Date | null;
|
|
38
45
|
boundRange?: boolean;
|
|
39
46
|
show?: boolean;
|
|
47
|
+
footer?: boolean;
|
|
48
|
+
mobileMode?: boolean;
|
|
40
49
|
}
|
|
41
50
|
/**
|
|
42
51
|
* @hidden
|
|
@@ -91,6 +100,7 @@ export declare class TimeSelector extends React.Component<TimeSelectorProps, Tim
|
|
|
91
100
|
min: Date;
|
|
92
101
|
max: Date;
|
|
93
102
|
boundRange: boolean;
|
|
103
|
+
footer: boolean;
|
|
94
104
|
};
|
|
95
105
|
readonly state: TimeSelectorState;
|
|
96
106
|
private _element;
|
|
@@ -116,6 +116,12 @@ var TimeSelector = /** @class */ (function (_super) {
|
|
|
116
116
|
};
|
|
117
117
|
_this.handleChange = function (candidate) {
|
|
118
118
|
_this.setState({ current: candidate });
|
|
119
|
+
var handleTimeChange = _this.props.handleTimeChange;
|
|
120
|
+
if (handleTimeChange) {
|
|
121
|
+
handleTimeChange.call(undefined, {
|
|
122
|
+
time: candidate
|
|
123
|
+
});
|
|
124
|
+
}
|
|
119
125
|
};
|
|
120
126
|
_this.dateFormatParts = _this.intl.splitDateFormat(_this.props.format || TimeSelector.defaultProps.format);
|
|
121
127
|
_this.mergeValue = (0, utils_2.valueMerger)((0, utils_2.generateGetters)(_this.dateFormatParts));
|
|
@@ -177,15 +183,15 @@ var TimeSelector = /** @class */ (function (_super) {
|
|
|
177
183
|
*/
|
|
178
184
|
TimeSelector.prototype.render = function () {
|
|
179
185
|
var _this = this;
|
|
180
|
-
var _a = this.props, format = _a.format, cancelButton = _a.cancelButton, disabled = _a.disabled, tabIndex = _a.tabIndex, className = _a.className, smoothScroll = _a.smoothScroll, min = _a.min, max = _a.max, boundRange = _a.boundRange, nowButton = _a.nowButton, steps = _a.steps;
|
|
186
|
+
var _a = this.props, format = _a.format, cancelButton = _a.cancelButton, disabled = _a.disabled, tabIndex = _a.tabIndex, className = _a.className, smoothScroll = _a.smoothScroll, min = _a.min, max = _a.max, boundRange = _a.boundRange, nowButton = _a.nowButton, steps = _a.steps, show = _a.show, mobileMode = _a.mobileMode;
|
|
181
187
|
var localizationService = (0, kendo_react_intl_1.provideLocalizationService)(this);
|
|
182
188
|
var cancelMessage = localizationService.toLanguageString(messages_1.timePickerCancel, messages_1.messages[messages_1.timePickerCancel]);
|
|
183
189
|
var setMessage = localizationService.toLanguageString(messages_1.timePickerSet, messages_1.messages[messages_1.timePickerSet]);
|
|
184
190
|
return (React.createElement("div", { ref: function (el) { _this._element = el; }, tabIndex: !disabled ? tabIndex || 0 : undefined, className: (0, kendo_react_common_1.classNames)('k-timeselector', className, {
|
|
185
191
|
'k-disabled': disabled
|
|
186
192
|
}), onKeyDown: this.handleKeyDown },
|
|
187
|
-
React.createElement(TimePart_1.TimePart, { ref: function (el) { _this.timePart = el; }, value: this.current, onChange: this.handleChange, onNowClick: this.handleNowClick, format: format, smoothScroll: smoothScroll, min: min, max: max, boundRange: boundRange, disabled: disabled, nowButton: nowButton, steps: steps, show:
|
|
188
|
-
React.createElement("div", { className: "k-time-footer k-actions k-actions-stretched" },
|
|
193
|
+
React.createElement(TimePart_1.TimePart, { ref: function (el) { _this.timePart = el; }, value: this.current, onChange: this.handleChange, onNowClick: this.handleNowClick, format: format, smoothScroll: smoothScroll, min: min, max: max, boundRange: boundRange, disabled: disabled, nowButton: nowButton, steps: steps, show: show, mobileMode: mobileMode }),
|
|
194
|
+
this.props.footer && React.createElement("div", { className: "k-time-footer k-actions k-actions-stretched" },
|
|
189
195
|
cancelButton &&
|
|
190
196
|
React.createElement(kendo_react_buttons_1.Button, __assign({ type: "button", ref: function (btn) { _this._cancelButton = btn; }, className: "k-time-cancel", onClick: this.handleReject, title: cancelMessage }, { 'aria-label': cancelMessage }), cancelMessage),
|
|
191
197
|
React.createElement(kendo_react_buttons_1.Button, __assign({ type: "button", ref: function (btn) { _this._acceptButton = btn; }, className: "k-time-accept", themeColor: 'primary', onClick: this.handleAccept, title: setMessage }, { 'aria-label': setMessage }), setMessage))));
|
|
@@ -247,7 +253,8 @@ var TimeSelector = /** @class */ (function (_super) {
|
|
|
247
253
|
format: 't',
|
|
248
254
|
min: utils_1.MIN_TIME,
|
|
249
255
|
max: utils_1.MAX_TIME,
|
|
250
|
-
boundRange: false
|
|
256
|
+
boundRange: false,
|
|
257
|
+
footer: true
|
|
251
258
|
};
|
|
252
259
|
return TimeSelector;
|
|
253
260
|
}(React.Component));
|