@progress/kendo-react-dateinputs 5.14.0-dev.202305231015 → 5.14.0-dev.202305250741
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/calendar/components/Header.d.ts +1 -0
- package/dist/es/calendar/components/Header.js +4 -1
- package/dist/es/calendar/components/HorizontalViewList.d.ts +1 -0
- package/dist/es/calendar/components/HorizontalViewList.js +3 -1
- package/dist/es/calendar/components/MultiViewCalendar.d.ts +2 -0
- package/dist/es/calendar/components/MultiViewCalendar.js +2 -2
- package/dist/es/dateinput/DateInput.d.ts +4 -0
- package/dist/es/dateinput/DateInput.js +1 -1
- package/dist/es/daterangepicker/DateRangePicker.d.ts +26 -0
- package/dist/es/daterangepicker/DateRangePicker.js +127 -37
- package/dist/es/messages/index.d.ts +9 -0
- package/dist/es/messages/index.js +10 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/calendar/components/Header.d.ts +1 -0
- package/dist/npm/calendar/components/Header.js +4 -1
- package/dist/npm/calendar/components/HorizontalViewList.d.ts +1 -0
- package/dist/npm/calendar/components/HorizontalViewList.js +3 -1
- package/dist/npm/calendar/components/MultiViewCalendar.d.ts +2 -0
- package/dist/npm/calendar/components/MultiViewCalendar.js +2 -2
- package/dist/npm/dateinput/DateInput.d.ts +4 -0
- package/dist/npm/dateinput/DateInput.js +1 -1
- package/dist/npm/daterangepicker/DateRangePicker.d.ts +26 -0
- package/dist/npm/daterangepicker/DateRangePicker.js +125 -35
- package/dist/npm/messages/index.d.ts +9 -0
- package/dist/npm/messages/index.js +11 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-react-dateinputs.js +1 -1
- package/package.json +13 -13
|
@@ -103,7 +103,10 @@ var Header = /** @class */ (function (_super) {
|
|
|
103
103
|
var headerTitle = this.props.headerTitle
|
|
104
104
|
? React.createElement(this.props.headerTitle, __assign({}, headerTitleProps), title)
|
|
105
105
|
: React.createElement(CalendarHeaderTitle, __assign({}, headerTitleProps), title);
|
|
106
|
-
return (React.createElement("div", { className:
|
|
106
|
+
return (React.createElement("div", { className: classNames('k-calendar-header', {
|
|
107
|
+
'k-vstack': this.props.verticalView,
|
|
108
|
+
'k-hstack': !this.props.verticalView
|
|
109
|
+
}) },
|
|
107
110
|
headerTitle,
|
|
108
111
|
React.createElement("span", { className: "k-spacer" }),
|
|
109
112
|
React.createElement("span", { className: "k-calendar-nav k-hstack" }, this.props.commands)));
|
|
@@ -121,7 +121,9 @@ var HorizontalViewList = /** @class */ (function (_super) {
|
|
|
121
121
|
var selectionRange = this.props.allowReverse
|
|
122
122
|
? this.rotateSelectionRange(this.props.selectionRange)
|
|
123
123
|
: this.props.selectionRange;
|
|
124
|
-
var rootClassNames = classNames('k-calendar-view k-
|
|
124
|
+
var rootClassNames = classNames('k-calendar-view k-align-items-start k-justify-content-center', {
|
|
125
|
+
'k-vstack': this.props.verticalView,
|
|
126
|
+
'k-hstack': !this.props.verticalView,
|
|
125
127
|
'k-calendar-monthview': this.props.activeView === CalendarViewEnum.month,
|
|
126
128
|
'k-calendar-yearview': this.props.activeView === CalendarViewEnum.year,
|
|
127
129
|
'k-calendar-decadeview': this.props.activeView === CalendarViewEnum.decade,
|
|
@@ -30,6 +30,8 @@ export interface MultiViewCalendarProps<T = any> extends MultiViewCalendarSettin
|
|
|
30
30
|
* Sets the value of the MultiViewCalendar. Based on the value type, the MultiViewcalendar renders a single, multiple, or range selection.
|
|
31
31
|
*/
|
|
32
32
|
value?: Date | Date[] | SelectionRange | null;
|
|
33
|
+
/** @hidden */
|
|
34
|
+
mobileMode?: boolean;
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
* @hidden
|
|
@@ -474,11 +474,11 @@ var MultiViewCalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
474
474
|
}
|
|
475
475
|
var activeDate = cloneDate(this.dates && this.dates[0] ? this.dates[0] : getToday());
|
|
476
476
|
return (React.createElement("div", { ref: function (el) { _this._element = el; }, className: wrapperClassName, id: this.props.id || this.wrapperID, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, tabIndex: !this.props.disabled ? this.props.tabIndex : undefined, onFocus: this.handleFocus, onBlur: this.handleBlur, onMouseDown: this.handleMouseDown, onClick: this.handleClick, onKeyDown: this.handleKeyDown, "aria-disabled": this.props.disabled },
|
|
477
|
-
React.createElement(Header, { key: ".kendo.calendar.header.".concat(activeDate.getTime()), activeView: activeView, currentDate: activeDate, min: this.min, max: this.max, rangeLength: this.props.views, bus: this.bus, service: this.service, headerTitle: this.props.headerTitle, commands: (React.createElement(React.Fragment, null,
|
|
477
|
+
React.createElement(Header, { key: ".kendo.calendar.header.".concat(activeDate.getTime()), activeView: activeView, currentDate: activeDate, min: this.min, max: this.max, rangeLength: this.props.views, bus: this.bus, service: this.service, headerTitle: this.props.headerTitle, verticalView: this.props.mobileMode, commands: (React.createElement(React.Fragment, null,
|
|
478
478
|
React.createElement(Button, __assign({ type: "button", className: "k-calendar-nav-prev", icon: this.isRtl ? 'chevron-right' : 'chevron-left', svgIcon: this.isRtl ? chevronRightIcon : chevronLeftIcon, fillMode: "flat", title: prevViewTitle, disabled: isPrevDisabled, onClick: this.handlePrevButtonClick }, prevBtnAria)),
|
|
479
479
|
React.createElement(TodayCommand, { min: this.min, max: this.max, onClick: this.handleTodayClick, disabled: !this.todayIsInRange }),
|
|
480
480
|
React.createElement(Button, __assign({ type: "button", className: "k-calendar-nav-next", icon: this.isRtl ? 'chevron-left' : 'chevron-right', svgIcon: this.isRtl ? chevronLeftIcon : chevronRightIcon, fillMode: "flat", title: nextViewTittle, disabled: isNextDisabled, onClick: this.handleNextButtonClick }, nextBtnAria)))) }),
|
|
481
|
-
React.createElement(HorizontalViewList, { ref: function (el) { _this.calendarViewList = el; }, dates: this.dates, activeView: activeView, focusedDate: this.focusedDate, min: this.min, max: this.max, bus: this.bus, service: this.service, selectionRange: visualizedRange, value: this.selectedMultiple || this.selectedDate, cellUID: this.cellUID, views: this.props.views, onChange: this.handleDateChange, showWeekNumbers: this.props.weekNumber, onCellEnter: this.handleCellEnter, cell: this.props.cell, weekCell: this.props.weekCell, headerTitle: this.props.headerTitle })));
|
|
481
|
+
React.createElement(HorizontalViewList, { ref: function (el) { _this.calendarViewList = el; }, dates: this.dates, activeView: activeView, focusedDate: this.focusedDate, min: this.min, max: this.max, bus: this.bus, service: this.service, selectionRange: visualizedRange, value: this.selectedMultiple || this.selectedDate, cellUID: this.cellUID, views: this.props.views, onChange: this.handleDateChange, showWeekNumbers: this.props.weekNumber, onCellEnter: this.handleCellEnter, cell: this.props.cell, weekCell: this.props.weekCell, headerTitle: this.props.headerTitle, verticalView: this.props.mobileMode })));
|
|
482
482
|
};
|
|
483
483
|
/**
|
|
484
484
|
* @hidden
|
|
@@ -474,7 +474,7 @@ var DateInputWithoutContext = /** @class */ (function (_super) {
|
|
|
474
474
|
var _this = this;
|
|
475
475
|
this._lastSelectedSymbol = this.currentFormat[selection.start];
|
|
476
476
|
window.requestAnimationFrame(function () {
|
|
477
|
-
if (_this.element && document.activeElement === _this.element) {
|
|
477
|
+
if (_this.element && document.activeElement === _this.element && !_this.props.disableSelection) {
|
|
478
478
|
_this.element.setSelectionRange(selection.start, selection.end);
|
|
479
479
|
}
|
|
480
480
|
});
|
|
@@ -40,12 +40,24 @@ export interface DateRangePickerProps extends DateRangePickerSettings {
|
|
|
40
40
|
* Fires each time the user selects a part of a date range ([see example]({% slug controlled_daterangepicker %}#toc-controlling-the-value)).
|
|
41
41
|
*/
|
|
42
42
|
onChange?: (event: DateRangePickerChangeEvent) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Fires each time the popup of the DateRangePicker is about to cancel in ([adaptive mode]({% slug adaptive_rendering_daterangepicker %})).
|
|
45
|
+
*/
|
|
46
|
+
onCancel?: (event: React.PointerEvent<HTMLSpanElement>) => void;
|
|
43
47
|
/**
|
|
44
48
|
* Specifies the selected date range of the DateRangePicker ([see example]({% slug controlled_daterangepicker %}#toc-controlling-the-value)).
|
|
45
49
|
*
|
|
46
50
|
* > The `value` has to be an object with `start` and `end` valid JavaScript [`Date`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date) instances or `null`.
|
|
47
51
|
*/
|
|
48
52
|
value?: SelectionRange;
|
|
53
|
+
/**
|
|
54
|
+
* Providing different rendering of the popup element based on the screen dimensions.
|
|
55
|
+
*/
|
|
56
|
+
adaptive?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Specifies the text that is rendered as title in the adaptive popup.
|
|
59
|
+
*/
|
|
60
|
+
adaptiveTitle?: string;
|
|
49
61
|
}
|
|
50
62
|
/**
|
|
51
63
|
* @hidden
|
|
@@ -53,6 +65,8 @@ export interface DateRangePickerProps extends DateRangePickerSettings {
|
|
|
53
65
|
export interface DateRangePickerState {
|
|
54
66
|
show: boolean;
|
|
55
67
|
value: SelectionRange;
|
|
68
|
+
windowWidth?: number;
|
|
69
|
+
currentValue: SelectionRange;
|
|
56
70
|
}
|
|
57
71
|
/** @hidden */
|
|
58
72
|
export declare class DateRangePickerWithoutContext extends React.Component<DateRangePickerProps, DateRangePickerState> {
|
|
@@ -190,6 +204,7 @@ export declare class DateRangePickerWithoutContext extends React.Component<DateR
|
|
|
190
204
|
private _endInputId;
|
|
191
205
|
private shouldFocusDateInput;
|
|
192
206
|
private shouldFocusCalendar;
|
|
207
|
+
private observerResize?;
|
|
193
208
|
constructor(props: DateRangePickerProps);
|
|
194
209
|
/**
|
|
195
210
|
* Gets the wrapping element of the DateRangePicker.
|
|
@@ -217,6 +232,12 @@ export declare class DateRangePickerWithoutContext extends React.Component<DateR
|
|
|
217
232
|
get show(): boolean;
|
|
218
233
|
protected get min(): Date;
|
|
219
234
|
protected get max(): Date;
|
|
235
|
+
private get document();
|
|
236
|
+
private get localizationService();
|
|
237
|
+
/**
|
|
238
|
+
* The mobile mode of the DateRangePicker.
|
|
239
|
+
*/
|
|
240
|
+
get mobileMode(): boolean;
|
|
220
241
|
/**
|
|
221
242
|
* @hidden
|
|
222
243
|
*/
|
|
@@ -244,16 +265,21 @@ export declare class DateRangePickerWithoutContext extends React.Component<DateR
|
|
|
244
265
|
protected calculateShow: (nextProps: DateRangePickerProps, nextState: DateRangePickerState) => boolean;
|
|
245
266
|
protected nextTick(f: () => any): void;
|
|
246
267
|
protected setShow(show: boolean): void;
|
|
268
|
+
private renderCalendar;
|
|
269
|
+
private renderPopup;
|
|
270
|
+
private renderAdaptivePopup;
|
|
247
271
|
private handleReverseClick;
|
|
248
272
|
private handleReverseMouseDown;
|
|
249
273
|
private handleFocus;
|
|
250
274
|
private handleBlur;
|
|
275
|
+
private handleCancel;
|
|
251
276
|
private handleEndChange;
|
|
252
277
|
private handleStartChange;
|
|
253
278
|
private extractRangeFromValue;
|
|
254
279
|
private handleCalendarChange;
|
|
255
280
|
private handleKeyDown;
|
|
256
281
|
private handleChange;
|
|
282
|
+
private calculateMedia;
|
|
257
283
|
}
|
|
258
284
|
/**
|
|
259
285
|
* Represents the PropsContext of the `DateRangePicker` component.
|
|
@@ -31,15 +31,18 @@ import { cloneDate } from '@progress/kendo-date-math';
|
|
|
31
31
|
import { guid, classNames, Keys, createPropsContext, withPropsContext, IconWrap } from '@progress/kendo-react-common';
|
|
32
32
|
import { provideLocalizationService, registerForLocalization } from '@progress/kendo-react-intl';
|
|
33
33
|
import { arrowsSwapIcon } from '@progress/kendo-svg-icons';
|
|
34
|
-
import { validatePackage } from '@progress/kendo-react-common';
|
|
34
|
+
import { validatePackage, canUseDOM } from '@progress/kendo-react-common';
|
|
35
35
|
import { packageMetadata } from '../package-metadata';
|
|
36
36
|
import { DateInput, DateInputWithoutContext } from '../dateinput/DateInput';
|
|
37
37
|
import { MultiViewCalendar } from '../calendar/components/MultiViewCalendar';
|
|
38
38
|
import { EMPTY_SELECTIONRANGE } from '../calendar/models';
|
|
39
39
|
import { MIN_DATE, MAX_DATE } from '../utils';
|
|
40
|
-
import {
|
|
40
|
+
import { MOBILE_MEDIUM_DEVISE } from '../common/constants';
|
|
41
|
+
import { swapStartEnd, start, end, separator, messages, dateRangePickerConfirm, dateRangePickerCancel } from '../messages';
|
|
41
42
|
import { Button } from '@progress/kendo-react-buttons';
|
|
42
43
|
import { nullable } from '../utils';
|
|
44
|
+
import { AdaptiveMode } from '../common/AdaptiveMode';
|
|
45
|
+
import { ActionSheetContent } from '@progress/kendo-react-layout';
|
|
43
46
|
/** @hidden */
|
|
44
47
|
var DateRangePickerWithoutContext = /** @class */ (function (_super) {
|
|
45
48
|
__extends(DateRangePickerWithoutContext, _super);
|
|
@@ -81,6 +84,43 @@ var DateRangePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
81
84
|
? nextProps.show
|
|
82
85
|
: nextState.show;
|
|
83
86
|
};
|
|
87
|
+
_this.renderCalendar = function () {
|
|
88
|
+
var value = _this.value || EMPTY_SELECTIONRANGE;
|
|
89
|
+
var calendarProps = __assign(__assign({ min: _this.min, max: _this.max, allowReverse: _this.props.allowReverse, mode: 'range', focusedDate: _this.props.focusedDate, disabled: _this.props.disabled, className: _this.mobileMode ? 'k-calendar-lg' : '', mobileMode: _this.mobileMode }, _this.props.calendarSettings), { value: value, onChange: _this.handleCalendarChange });
|
|
90
|
+
return _this.props.calendar
|
|
91
|
+
? React.createElement(_this.props.calendar, __assign({}, calendarProps, { className: '' }))
|
|
92
|
+
: React.createElement(MultiViewCalendar, __assign({}, calendarProps, { ref: _this.setCalendarRef, className: 'k-calendar-lg' }));
|
|
93
|
+
};
|
|
94
|
+
_this.renderPopup = function () {
|
|
95
|
+
var popupProps = __assign(__assign({ popupClass: 'k-daterangepicker-popup', animate: _this._element !== null, anchor: _this._element, id: _this._popupId, anchorAlign: {
|
|
96
|
+
horizontal: 'left',
|
|
97
|
+
vertical: 'bottom'
|
|
98
|
+
}, popupAlign: {
|
|
99
|
+
horizontal: 'left',
|
|
100
|
+
vertical: 'top'
|
|
101
|
+
} }, _this.props.popupSettings), { show: _this.show });
|
|
102
|
+
return (_this.props.popup
|
|
103
|
+
? React.createElement(_this.props.popup, __assign({}, popupProps), _this.renderCalendar())
|
|
104
|
+
: React.createElement(Popup, __assign({}, popupProps), _this.renderCalendar()));
|
|
105
|
+
};
|
|
106
|
+
_this.renderAdaptivePopup = function () {
|
|
107
|
+
var _a = _this.state.windowWidth, windowWidth = _a === void 0 ? 0 : _a;
|
|
108
|
+
var actionSheetProps = {
|
|
109
|
+
expand: _this.show,
|
|
110
|
+
onClose: function (event) { return _this.handleCancel(event); },
|
|
111
|
+
adaptiveTitle: _this.props.adaptiveTitle,
|
|
112
|
+
windowWidth: windowWidth,
|
|
113
|
+
footer: {
|
|
114
|
+
cancelText: _this.localizationService.toLanguageString(dateRangePickerCancel, messages[dateRangePickerCancel]),
|
|
115
|
+
onCancel: function (event) { return _this.handleCancel(event); },
|
|
116
|
+
applyText: _this.localizationService.toLanguageString(dateRangePickerConfirm, messages[dateRangePickerConfirm]),
|
|
117
|
+
onApply: function (event) { return _this.handleBlur(event); }
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
return (React.createElement(AdaptiveMode, __assign({}, actionSheetProps),
|
|
121
|
+
React.createElement(ActionSheetContent, { className: '!k-overflow-hidden' },
|
|
122
|
+
React.createElement("div", { className: 'k-scrollable-wrap' }, _this.renderCalendar()))));
|
|
123
|
+
};
|
|
84
124
|
_this.handleReverseClick = function (event) {
|
|
85
125
|
var value = {
|
|
86
126
|
start: _this.value.end,
|
|
@@ -99,6 +139,9 @@ var DateRangePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
99
139
|
clearTimeout(_this.nextTickId);
|
|
100
140
|
if (!_this.shouldFocusDateInput) {
|
|
101
141
|
_this.setShow(true);
|
|
142
|
+
if (_this.mobileMode) {
|
|
143
|
+
_this.setState({ currentValue: _this.value });
|
|
144
|
+
}
|
|
102
145
|
}
|
|
103
146
|
var onFocus = _this.props.onFocus;
|
|
104
147
|
if (onFocus) {
|
|
@@ -114,6 +157,16 @@ var DateRangePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
114
157
|
onBlur.call(undefined, event);
|
|
115
158
|
}
|
|
116
159
|
};
|
|
160
|
+
_this.handleCancel = function (event) {
|
|
161
|
+
_this.nextTick(function () {
|
|
162
|
+
_this.setShow(false);
|
|
163
|
+
_this.setState({ currentValue: EMPTY_SELECTIONRANGE });
|
|
164
|
+
});
|
|
165
|
+
var onCancel = _this.props.onCancel;
|
|
166
|
+
if (onCancel) {
|
|
167
|
+
onCancel.call(undefined, event);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
117
170
|
_this.handleEndChange = function (event) {
|
|
118
171
|
var value = {
|
|
119
172
|
start: _this.value.start,
|
|
@@ -185,7 +238,8 @@ var DateRangePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
185
238
|
validatePackage(packageMetadata);
|
|
186
239
|
_this.state = {
|
|
187
240
|
show: _this.props.show || _this.props.defaultShow || DateRangePickerWithoutContext.defaultProps.defaultShow,
|
|
188
|
-
value: _this.props.value || _this.props.defaultValue || DateRangePickerWithoutContext.defaultProps.defaultValue
|
|
241
|
+
value: _this.props.value || _this.props.defaultValue || DateRangePickerWithoutContext.defaultProps.defaultValue,
|
|
242
|
+
currentValue: EMPTY_SELECTIONRANGE
|
|
189
243
|
};
|
|
190
244
|
_this.nextTick = _this.nextTick.bind(_this);
|
|
191
245
|
_this.setShow = _this.setShow.bind(_this);
|
|
@@ -280,14 +334,49 @@ var DateRangePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
280
334
|
enumerable: false,
|
|
281
335
|
configurable: true
|
|
282
336
|
});
|
|
337
|
+
Object.defineProperty(DateRangePickerWithoutContext.prototype, "document", {
|
|
338
|
+
get: function () {
|
|
339
|
+
if (!canUseDOM) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
// useful only for user actions
|
|
343
|
+
return (this.element && this.element.ownerDocument) || document;
|
|
344
|
+
},
|
|
345
|
+
enumerable: false,
|
|
346
|
+
configurable: true
|
|
347
|
+
});
|
|
348
|
+
Object.defineProperty(DateRangePickerWithoutContext.prototype, "localizationService", {
|
|
349
|
+
get: function () {
|
|
350
|
+
var localization = provideLocalizationService(this);
|
|
351
|
+
return localization;
|
|
352
|
+
},
|
|
353
|
+
enumerable: false,
|
|
354
|
+
configurable: true
|
|
355
|
+
});
|
|
356
|
+
Object.defineProperty(DateRangePickerWithoutContext.prototype, "mobileMode", {
|
|
357
|
+
/**
|
|
358
|
+
* The mobile mode of the DateRangePicker.
|
|
359
|
+
*/
|
|
360
|
+
get: function () {
|
|
361
|
+
var isAdaptive = this.state.windowWidth && this.state.windowWidth <= MOBILE_MEDIUM_DEVISE && this.props.adaptive;
|
|
362
|
+
return !!isAdaptive;
|
|
363
|
+
},
|
|
364
|
+
enumerable: false,
|
|
365
|
+
configurable: true
|
|
366
|
+
});
|
|
283
367
|
/**
|
|
284
368
|
* @hidden
|
|
285
369
|
*/
|
|
286
370
|
DateRangePickerWithoutContext.prototype.componentDidMount = function () {
|
|
371
|
+
var _a;
|
|
372
|
+
this.observerResize = canUseDOM && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this));
|
|
287
373
|
if (this.show) {
|
|
288
374
|
// If defaultShow is true during the initial render, the popup is not aligned.
|
|
289
375
|
this.forceUpdate();
|
|
290
376
|
}
|
|
377
|
+
if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
|
|
378
|
+
this.observerResize.observe(this.document.body);
|
|
379
|
+
}
|
|
291
380
|
};
|
|
292
381
|
/**
|
|
293
382
|
* @hidden
|
|
@@ -306,7 +395,11 @@ var DateRangePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
306
395
|
* @hidden
|
|
307
396
|
*/
|
|
308
397
|
DateRangePickerWithoutContext.prototype.componentWillUnmount = function () {
|
|
398
|
+
var _a;
|
|
309
399
|
clearTimeout(this.nextTickId);
|
|
400
|
+
if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
|
|
401
|
+
this.observerResize.disconnect();
|
|
402
|
+
}
|
|
310
403
|
};
|
|
311
404
|
/**
|
|
312
405
|
* @hidden
|
|
@@ -314,28 +407,17 @@ var DateRangePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
314
407
|
DateRangePickerWithoutContext.prototype.render = function () {
|
|
315
408
|
var _this = this;
|
|
316
409
|
var value = this.value || EMPTY_SELECTIONRANGE;
|
|
410
|
+
var valueToShow = (this.mobileMode && this.show) ? this.state.currentValue : value;
|
|
317
411
|
var startDateInputId = (this.props.startDateInputSettings || {}).id || this._startInputId;
|
|
318
412
|
var endDateInputId = (this.props.endDateInputSettings || {}).id || this._endInputId;
|
|
319
413
|
var rootClassName = classNames('k-daterangepicker', {
|
|
320
414
|
'k-disabled': this.props.disabled
|
|
321
415
|
}, this.props.className);
|
|
322
|
-
var
|
|
323
|
-
var
|
|
324
|
-
var
|
|
325
|
-
var
|
|
326
|
-
var
|
|
327
|
-
var endDateInputProps = __assign(__assign({ label: endMessage, format: this.props.format, min: this.min, max: this.max, id: this._endInputId, disabled: this.props.disabled, valid: this.props.valid, tabIndex: this.props.tabIndex, ariaExpanded: this.show }, this.props.endDateInputSettings), { value: value.end, onChange: this.handleEndChange });
|
|
328
|
-
var popupProps = __assign(__assign({ popupClass: 'k-daterangepicker-popup', animate: this._element !== null, anchor: this._element, id: this._popupId, anchorAlign: {
|
|
329
|
-
horizontal: 'left',
|
|
330
|
-
vertical: 'bottom'
|
|
331
|
-
}, popupAlign: {
|
|
332
|
-
horizontal: 'left',
|
|
333
|
-
vertical: 'top'
|
|
334
|
-
} }, this.props.popupSettings), { show: this.show });
|
|
335
|
-
var calendarProps = __assign(__assign({ min: this.min, max: this.max, allowReverse: this.props.allowReverse, mode: 'range', focusedDate: this.props.focusedDate, disabled: this.props.disabled }, this.props.calendarSettings), { value: value, onChange: this.handleCalendarChange });
|
|
336
|
-
var calendar = this.props.calendar
|
|
337
|
-
? React.createElement(this.props.calendar, __assign({}, calendarProps))
|
|
338
|
-
: React.createElement(MultiViewCalendar, __assign({}, calendarProps, { ref: this.setCalendarRef }));
|
|
416
|
+
var startMessage = this.localizationService.toLanguageString(start, messages[start]);
|
|
417
|
+
var endMessage = this.localizationService.toLanguageString(end, messages[end]);
|
|
418
|
+
var separatorMessage = this.localizationService.toLanguageString(separator, messages[separator]);
|
|
419
|
+
var startDateInputProps = __assign(__assign({ disableSelection: this.mobileMode && true, label: startMessage, format: this.props.format, min: this.min, max: this.max, id: this._startInputId, disabled: this.props.disabled, valid: this.props.valid, tabIndex: this.props.tabIndex, ariaExpanded: this.show }, this.props.startDateInputSettings), { value: valueToShow.start, onChange: this.handleStartChange });
|
|
420
|
+
var endDateInputProps = __assign(__assign({ disableSelection: this.mobileMode && true, label: endMessage, format: this.props.format, min: this.min, max: this.max, id: this._endInputId, disabled: this.props.disabled, valid: this.props.valid, tabIndex: this.props.tabIndex, ariaExpanded: this.show }, this.props.endDateInputSettings), { value: valueToShow.end, onChange: this.handleEndChange });
|
|
339
421
|
var reverseButton = (React.createElement(Button, __assign({ className: "k-select", fillMode: "flat", title: provideLocalizationService(this)
|
|
340
422
|
.toLanguageString(swapStartEnd, messages[swapStartEnd]), onMouseDown: this.handleReverseMouseDown, onClick: this.handleReverseClick }, {
|
|
341
423
|
'aria-controls': startDateInputId + ' ' + endDateInputId,
|
|
@@ -343,23 +425,23 @@ var DateRangePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
343
425
|
.toLanguageString(swapStartEnd, messages[swapStartEnd])
|
|
344
426
|
}),
|
|
345
427
|
React.createElement(IconWrap, { style: { transform: 'rotate(90deg)' }, name: "arrows-swap", icon: arrowsSwapIcon })));
|
|
346
|
-
return (React.createElement(
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
428
|
+
return (React.createElement(React.Fragment, null,
|
|
429
|
+
React.createElement("span", { ref: function (span) {
|
|
430
|
+
_this._element = span;
|
|
431
|
+
}, className: rootClassName, style: this.props.style, id: this.props.id, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, tabIndex: this.props.tabIndex, onFocus: this.handleFocus, onBlur: !this.mobileMode ? this.handleBlur : undefined, onKeyDown: this.handleKeyDown },
|
|
432
|
+
this.props.startDateInput
|
|
433
|
+
? React.createElement(this.props.startDateInput, __assign({}, startDateInputProps))
|
|
434
|
+
: React.createElement(DateInput, __assign({}, startDateInputProps, { ref: this._startDateInput, ariaRole: "combobox", ariaControls: this._popupId, readonly: this.mobileMode })),
|
|
435
|
+
(this.props.allowReverse
|
|
436
|
+
|| (this.props.calendarSettings && this.props.calendarSettings.allowReverse))
|
|
437
|
+
&& this.props.swapButton
|
|
438
|
+
? (reverseButton)
|
|
439
|
+
: (separatorMessage),
|
|
440
|
+
this.props.endDateInput
|
|
441
|
+
? React.createElement(this.props.endDateInput, __assign({}, endDateInputProps))
|
|
442
|
+
: React.createElement(DateInput, __assign({}, endDateInputProps, { ref: this._endDateInput, ariaRole: "combobox", ariaControls: this._popupId, readonly: this.mobileMode })),
|
|
443
|
+
!this.mobileMode && this.renderPopup()),
|
|
444
|
+
this.mobileMode && this.renderAdaptivePopup()));
|
|
363
445
|
};
|
|
364
446
|
DateRangePickerWithoutContext.prototype.focusDateInputElement = function () {
|
|
365
447
|
if (!document || !this.startDateInput || !this.startDateInput.element
|
|
@@ -387,6 +469,14 @@ var DateRangePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
387
469
|
}
|
|
388
470
|
this.setState({ show: show });
|
|
389
471
|
};
|
|
472
|
+
DateRangePickerWithoutContext.prototype.calculateMedia = function (entries) {
|
|
473
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
474
|
+
var entry = entries_1[_i];
|
|
475
|
+
this.setState({ windowWidth: entry.target.clientWidth });
|
|
476
|
+
}
|
|
477
|
+
;
|
|
478
|
+
};
|
|
479
|
+
;
|
|
390
480
|
/**
|
|
391
481
|
* @hidden
|
|
392
482
|
*/
|
|
@@ -82,6 +82,14 @@ export declare const dateTimePickerCancel = "datetimepicker.cancel";
|
|
|
82
82
|
* @hidden
|
|
83
83
|
*/
|
|
84
84
|
export declare const dateTimePickerSet = "datetimepicker.set";
|
|
85
|
+
/**
|
|
86
|
+
* @hidden
|
|
87
|
+
*/
|
|
88
|
+
export declare const dateRangePickerCancel = "datetimepicker.cancel";
|
|
89
|
+
/**
|
|
90
|
+
* @hidden
|
|
91
|
+
*/
|
|
92
|
+
export declare const dateRangePickerConfirm = "datetimepicker.confirm";
|
|
85
93
|
/**
|
|
86
94
|
* @hidden
|
|
87
95
|
*/
|
|
@@ -94,6 +102,7 @@ export declare const messages: {
|
|
|
94
102
|
"datetimepicker.time": string;
|
|
95
103
|
"datetimepicker.cancel": string;
|
|
96
104
|
"datetimepicker.set": string;
|
|
105
|
+
"datetimepicker.confirm": string;
|
|
97
106
|
"daterangepicker.start": string;
|
|
98
107
|
"daterangepicker.end": string;
|
|
99
108
|
"daterangepicker.separator": string;
|
|
@@ -83,6 +83,14 @@ export var dateTimePickerCancel = 'datetimepicker.cancel';
|
|
|
83
83
|
* @hidden
|
|
84
84
|
*/
|
|
85
85
|
export var dateTimePickerSet = 'datetimepicker.set';
|
|
86
|
+
/**
|
|
87
|
+
* @hidden
|
|
88
|
+
*/
|
|
89
|
+
export var dateRangePickerCancel = 'datetimepicker.cancel';
|
|
90
|
+
/**
|
|
91
|
+
* @hidden
|
|
92
|
+
*/
|
|
93
|
+
export var dateRangePickerConfirm = 'datetimepicker.confirm';
|
|
86
94
|
/**
|
|
87
95
|
* @hidden
|
|
88
96
|
*/
|
|
@@ -95,6 +103,8 @@ export var messages = (_a = {},
|
|
|
95
103
|
_a[time] = 'Time',
|
|
96
104
|
_a[dateTimePickerCancel] = 'Cancel',
|
|
97
105
|
_a[dateTimePickerSet] = 'Set',
|
|
106
|
+
_a[dateRangePickerCancel] = 'Cancel',
|
|
107
|
+
_a[dateRangePickerConfirm] = 'Confirm Selection',
|
|
98
108
|
_a[start] = 'Start',
|
|
99
109
|
_a[end] = 'End',
|
|
100
110
|
_a[separator] = ' ',
|
|
@@ -5,7 +5,7 @@ export var packageMetadata = {
|
|
|
5
5
|
name: '@progress/kendo-react-dateinputs',
|
|
6
6
|
productName: 'KendoReact',
|
|
7
7
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate:
|
|
8
|
+
publishDate: 1684998456,
|
|
9
9
|
version: '',
|
|
10
10
|
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'
|
|
11
11
|
};
|
|
@@ -106,7 +106,10 @@ var Header = /** @class */ (function (_super) {
|
|
|
106
106
|
var headerTitle = this.props.headerTitle
|
|
107
107
|
? React.createElement(this.props.headerTitle, __assign({}, headerTitleProps), title)
|
|
108
108
|
: React.createElement(CalendarHeaderTitle_1.CalendarHeaderTitle, __assign({}, headerTitleProps), title);
|
|
109
|
-
return (React.createElement("div", { className:
|
|
109
|
+
return (React.createElement("div", { className: (0, kendo_react_common_1.classNames)('k-calendar-header', {
|
|
110
|
+
'k-vstack': this.props.verticalView,
|
|
111
|
+
'k-hstack': !this.props.verticalView
|
|
112
|
+
}) },
|
|
110
113
|
headerTitle,
|
|
111
114
|
React.createElement("span", { className: "k-spacer" }),
|
|
112
115
|
React.createElement("span", { className: "k-calendar-nav k-hstack" }, this.props.commands)));
|
|
@@ -124,7 +124,9 @@ var HorizontalViewList = /** @class */ (function (_super) {
|
|
|
124
124
|
var selectionRange = this.props.allowReverse
|
|
125
125
|
? this.rotateSelectionRange(this.props.selectionRange)
|
|
126
126
|
: this.props.selectionRange;
|
|
127
|
-
var rootClassNames = (0, kendo_react_common_1.classNames)('k-calendar-view k-
|
|
127
|
+
var rootClassNames = (0, kendo_react_common_1.classNames)('k-calendar-view k-align-items-start k-justify-content-center', {
|
|
128
|
+
'k-vstack': this.props.verticalView,
|
|
129
|
+
'k-hstack': !this.props.verticalView,
|
|
128
130
|
'k-calendar-monthview': this.props.activeView === models_1.CalendarViewEnum.month,
|
|
129
131
|
'k-calendar-yearview': this.props.activeView === models_1.CalendarViewEnum.year,
|
|
130
132
|
'k-calendar-decadeview': this.props.activeView === models_1.CalendarViewEnum.decade,
|
|
@@ -30,6 +30,8 @@ export interface MultiViewCalendarProps<T = any> extends MultiViewCalendarSettin
|
|
|
30
30
|
* Sets the value of the MultiViewCalendar. Based on the value type, the MultiViewcalendar renders a single, multiple, or range selection.
|
|
31
31
|
*/
|
|
32
32
|
value?: Date | Date[] | SelectionRange | null;
|
|
33
|
+
/** @hidden */
|
|
34
|
+
mobileMode?: boolean;
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
* @hidden
|
|
@@ -477,11 +477,11 @@ var MultiViewCalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
477
477
|
}
|
|
478
478
|
var activeDate = (0, kendo_date_math_1.cloneDate)(this.dates && this.dates[0] ? this.dates[0] : (0, utils_2.getToday)());
|
|
479
479
|
return (React.createElement("div", { ref: function (el) { _this._element = el; }, className: wrapperClassName, id: this.props.id || this.wrapperID, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, tabIndex: !this.props.disabled ? this.props.tabIndex : undefined, onFocus: this.handleFocus, onBlur: this.handleBlur, onMouseDown: this.handleMouseDown, onClick: this.handleClick, onKeyDown: this.handleKeyDown, "aria-disabled": this.props.disabled },
|
|
480
|
-
React.createElement(Header_1.Header, { key: ".kendo.calendar.header.".concat(activeDate.getTime()), activeView: activeView, currentDate: activeDate, min: this.min, max: this.max, rangeLength: this.props.views, bus: this.bus, service: this.service, headerTitle: this.props.headerTitle, commands: (React.createElement(React.Fragment, null,
|
|
480
|
+
React.createElement(Header_1.Header, { key: ".kendo.calendar.header.".concat(activeDate.getTime()), activeView: activeView, currentDate: activeDate, min: this.min, max: this.max, rangeLength: this.props.views, bus: this.bus, service: this.service, headerTitle: this.props.headerTitle, verticalView: this.props.mobileMode, commands: (React.createElement(React.Fragment, null,
|
|
481
481
|
React.createElement(kendo_react_buttons_1.Button, __assign({ type: "button", className: "k-calendar-nav-prev", icon: this.isRtl ? 'chevron-right' : 'chevron-left', svgIcon: this.isRtl ? kendo_svg_icons_1.chevronRightIcon : kendo_svg_icons_1.chevronLeftIcon, fillMode: "flat", title: prevViewTitle, disabled: isPrevDisabled, onClick: this.handlePrevButtonClick }, prevBtnAria)),
|
|
482
482
|
React.createElement(TodayCommand_1.TodayCommand, { min: this.min, max: this.max, onClick: this.handleTodayClick, disabled: !this.todayIsInRange }),
|
|
483
483
|
React.createElement(kendo_react_buttons_1.Button, __assign({ type: "button", className: "k-calendar-nav-next", icon: this.isRtl ? 'chevron-left' : 'chevron-right', svgIcon: this.isRtl ? kendo_svg_icons_1.chevronLeftIcon : kendo_svg_icons_1.chevronRightIcon, fillMode: "flat", title: nextViewTittle, disabled: isNextDisabled, onClick: this.handleNextButtonClick }, nextBtnAria)))) }),
|
|
484
|
-
React.createElement(HorizontalViewList_1.HorizontalViewList, { ref: function (el) { _this.calendarViewList = el; }, dates: this.dates, activeView: activeView, focusedDate: this.focusedDate, min: this.min, max: this.max, bus: this.bus, service: this.service, selectionRange: visualizedRange, value: this.selectedMultiple || this.selectedDate, cellUID: this.cellUID, views: this.props.views, onChange: this.handleDateChange, showWeekNumbers: this.props.weekNumber, onCellEnter: this.handleCellEnter, cell: this.props.cell, weekCell: this.props.weekCell, headerTitle: this.props.headerTitle })));
|
|
484
|
+
React.createElement(HorizontalViewList_1.HorizontalViewList, { ref: function (el) { _this.calendarViewList = el; }, dates: this.dates, activeView: activeView, focusedDate: this.focusedDate, min: this.min, max: this.max, bus: this.bus, service: this.service, selectionRange: visualizedRange, value: this.selectedMultiple || this.selectedDate, cellUID: this.cellUID, views: this.props.views, onChange: this.handleDateChange, showWeekNumbers: this.props.weekNumber, onCellEnter: this.handleCellEnter, cell: this.props.cell, weekCell: this.props.weekCell, headerTitle: this.props.headerTitle, verticalView: this.props.mobileMode })));
|
|
485
485
|
};
|
|
486
486
|
/**
|
|
487
487
|
* @hidden
|
|
@@ -477,7 +477,7 @@ var DateInputWithoutContext = /** @class */ (function (_super) {
|
|
|
477
477
|
var _this = this;
|
|
478
478
|
this._lastSelectedSymbol = this.currentFormat[selection.start];
|
|
479
479
|
window.requestAnimationFrame(function () {
|
|
480
|
-
if (_this.element && document.activeElement === _this.element) {
|
|
480
|
+
if (_this.element && document.activeElement === _this.element && !_this.props.disableSelection) {
|
|
481
481
|
_this.element.setSelectionRange(selection.start, selection.end);
|
|
482
482
|
}
|
|
483
483
|
});
|