@progress/kendo-react-dateinputs 5.4.0-dev.202205271059 → 5.4.0-dev.202206061009
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/Calendar.d.ts +4 -4
- package/dist/es/calendar/components/Calendar.js +17 -5
- package/dist/es/calendar/components/Header.d.ts +1 -0
- package/dist/es/calendar/components/Header.js +1 -1
- package/dist/es/calendar/components/HorizontalViewList.js +1 -0
- package/dist/es/calendar/components/MultiViewCalendar.d.ts +3 -3
- package/dist/es/calendar/components/MultiViewCalendar.js +12 -5
- package/dist/es/calendar/components/Navigation.js +9 -4
- package/dist/es/calendar/components/TodayCommand.js +4 -2
- package/dist/es/calendar/components/View.d.ts +4 -4
- package/dist/es/calendar/components/View.js +7 -5
- package/dist/es/calendar/components/ViewList.js +10 -2
- package/dist/es/calendar/services/BusViewService.js +1 -1
- package/dist/es/calendar/services/CenturyViewService.js +2 -2
- package/dist/es/calendar/services/DOMService.js +24 -6
- package/dist/es/calendar/services/DecadeViewService.js +2 -2
- package/dist/es/calendar/services/MonthViewService.js +2 -2
- package/dist/es/calendar/services/NavigationService.js +1 -1
- package/dist/es/calendar/services/ScrollSyncService.js +5 -1
- package/dist/es/calendar/services/YearViewService.js +2 -2
- package/dist/es/dateinput/DateInput.d.ts +11 -7
- package/dist/es/dateinput/DateInput.js +14 -8
- package/dist/es/dateinput/models/mask.js +1 -0
- package/dist/es/datepicker/DatePicker.d.ts +8 -8
- package/dist/es/datepicker/DatePicker.js +4 -3
- package/dist/es/daterangepicker/DateRangePicker.d.ts +3 -3
- package/dist/es/datetimepicker/DateTimePicker.d.ts +7 -7
- package/dist/es/datetimepicker/DateTimePicker.js +3 -3
- package/dist/es/datetimepicker/DateTimeSelector.d.ts +1 -1
- package/dist/es/datetimepicker/DateTimeSelector.js +5 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/timepicker/TimeList.d.ts +3 -3
- package/dist/es/timepicker/TimeList.js +25 -7
- package/dist/es/timepicker/TimePart.d.ts +3 -3
- package/dist/es/timepicker/TimePart.js +4 -1
- package/dist/es/timepicker/TimePicker.d.ts +7 -7
- package/dist/es/timepicker/TimePicker.js +4 -3
- package/dist/es/timepicker/TimeSelector.d.ts +2 -2
- package/dist/es/timepicker/TimeSelector.js +4 -0
- package/dist/es/timepicker/services/DOMService.js +2 -0
- package/dist/es/timepicker/services/DayPeriodService.js +9 -3
- package/dist/es/timepicker/services/HoursService.js +14 -5
- package/dist/es/timepicker/services/MinutesService.js +12 -6
- package/dist/es/timepicker/services/SecondsService.js +12 -6
- package/dist/es/utils.js +9 -5
- package/dist/es/virtualization/Virtualization.d.ts +1 -0
- package/dist/es/virtualization/Virtualization.js +13 -5
- package/dist/es/virtualization/services/RowHeightService.js +9 -5
- package/dist/es/virtualization/services/ScrollerService.js +9 -3
- package/dist/npm/calendar/components/Calendar.d.ts +4 -4
- package/dist/npm/calendar/components/Calendar.js +43 -31
- package/dist/npm/calendar/components/CalendarCell.js +1 -1
- package/dist/npm/calendar/components/CalendarNavigationItem.js +1 -1
- package/dist/npm/calendar/components/CalendarWeekCell.js +1 -1
- package/dist/npm/calendar/components/Header.d.ts +1 -0
- package/dist/npm/calendar/components/Header.js +3 -3
- package/dist/npm/calendar/components/HorizontalViewList.js +3 -2
- package/dist/npm/calendar/components/MultiViewCalendar.d.ts +3 -3
- package/dist/npm/calendar/components/MultiViewCalendar.js +49 -42
- package/dist/npm/calendar/components/Navigation.js +13 -8
- package/dist/npm/calendar/components/TodayCommand.js +9 -7
- package/dist/npm/calendar/components/View.d.ts +4 -4
- package/dist/npm/calendar/components/View.js +16 -14
- package/dist/npm/calendar/components/ViewList.js +19 -11
- package/dist/npm/calendar/services/BusViewService.js +1 -1
- package/dist/npm/calendar/services/CenturyViewService.js +38 -38
- package/dist/npm/calendar/services/DOMService.js +33 -15
- package/dist/npm/calendar/services/DecadeViewService.js +32 -32
- package/dist/npm/calendar/services/MonthViewService.js +36 -36
- package/dist/npm/calendar/services/NavigationService.js +1 -1
- package/dist/npm/calendar/services/ScrollSyncService.js +5 -1
- package/dist/npm/calendar/services/WeekNamesService.js +1 -1
- package/dist/npm/calendar/services/YearViewService.js +33 -33
- package/dist/npm/common/PickerWrap.js +1 -1
- package/dist/npm/dateinput/DateInput.d.ts +11 -7
- package/dist/npm/dateinput/DateInput.js +32 -26
- package/dist/npm/dateinput/models/kendo-date.js +11 -11
- package/dist/npm/dateinput/models/mask.js +1 -0
- package/dist/npm/datepicker/DatePicker.d.ts +8 -8
- package/dist/npm/datepicker/DatePicker.js +17 -16
- package/dist/npm/daterangepicker/DateRangePicker.d.ts +3 -3
- package/dist/npm/daterangepicker/DateRangePicker.js +17 -17
- package/dist/npm/datetimepicker/DateTimePicker.d.ts +7 -7
- package/dist/npm/datetimepicker/DateTimePicker.js +15 -15
- package/dist/npm/datetimepicker/DateTimeSelector.d.ts +1 -1
- package/dist/npm/datetimepicker/DateTimeSelector.js +13 -8
- package/dist/npm/hooks/usePickerFloatingLabel.js +1 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/timepicker/TimeList.d.ts +3 -3
- package/dist/npm/timepicker/TimeList.js +29 -11
- package/dist/npm/timepicker/TimePart.d.ts +3 -3
- package/dist/npm/timepicker/TimePart.js +14 -11
- package/dist/npm/timepicker/TimePicker.d.ts +7 -7
- package/dist/npm/timepicker/TimePicker.js +19 -18
- package/dist/npm/timepicker/TimeSelector.d.ts +2 -2
- package/dist/npm/timepicker/TimeSelector.js +14 -10
- package/dist/npm/timepicker/services/DOMService.js +6 -4
- package/dist/npm/timepicker/services/DayPeriodService.js +10 -4
- package/dist/npm/timepicker/services/HoursService.js +20 -11
- package/dist/npm/timepicker/services/MinutesService.js +16 -10
- package/dist/npm/timepicker/services/SecondsService.js +16 -10
- package/dist/npm/timepicker/utils.js +11 -11
- package/dist/npm/utils.js +16 -12
- package/dist/npm/virtualization/Virtualization.d.ts +1 -0
- package/dist/npm/virtualization/Virtualization.js +15 -7
- package/dist/npm/virtualization/services/RowHeightService.js +9 -5
- package/dist/npm/virtualization/services/ScrollerService.js +9 -3
- package/dist/systemjs/kendo-react-dateinputs.js +1 -1
- package/package.json +13 -13
|
@@ -19,6 +19,10 @@ var limitUp = limit(SECONDS_IN_HOUR - 1);
|
|
|
19
19
|
var SecondsService = /** @class */ (function () {
|
|
20
20
|
function SecondsService(intl) {
|
|
21
21
|
this.intl = intl;
|
|
22
|
+
this.toListItem = null;
|
|
23
|
+
this.min = null;
|
|
24
|
+
this.max = null;
|
|
25
|
+
this.step = 0;
|
|
22
26
|
this.insertUndividedMax = false;
|
|
23
27
|
}
|
|
24
28
|
SecondsService.prototype.apply = function (value, candidate) {
|
|
@@ -43,7 +47,7 @@ var SecondsService = /** @class */ (function () {
|
|
|
43
47
|
var _this = this;
|
|
44
48
|
var min = this.range(selectedValue)[0];
|
|
45
49
|
var getSecond = stepper(min, this.step);
|
|
46
|
-
var convertToItem = function (idx) { return (_this.toListItem(getSecond(idx))); };
|
|
50
|
+
var convertToItem = function (idx) { return (_this.toListItem && _this.toListItem(getSecond(idx))); };
|
|
47
51
|
var data = range(0, this.countFromMin(selectedValue)).map(convertToItem);
|
|
48
52
|
this.addLast(data);
|
|
49
53
|
if (selectedValue) {
|
|
@@ -52,7 +56,7 @@ var SecondsService = /** @class */ (function () {
|
|
|
52
56
|
return data;
|
|
53
57
|
};
|
|
54
58
|
SecondsService.prototype.isRangeChanged = function (min, max) {
|
|
55
|
-
return !isEqual(this.min, min) || !isEqual(this.max, max);
|
|
59
|
+
return this.min !== null && this.max !== null && (!isEqual(this.min, min) || !isEqual(this.max, max));
|
|
56
60
|
};
|
|
57
61
|
SecondsService.prototype.limitRange = function (min, max, value) {
|
|
58
62
|
return [limitDown(min, value), limitUp(max, value)];
|
|
@@ -76,7 +80,7 @@ var SecondsService = /** @class */ (function () {
|
|
|
76
80
|
return distanceFromMin(value.getSeconds(), this.min.getSeconds()) / this.step;
|
|
77
81
|
};
|
|
78
82
|
SecondsService.prototype.addLast = function (data, value) {
|
|
79
|
-
if (this.insertUndividedMax && this.isLastMissing(value)) {
|
|
83
|
+
if (this.insertUndividedMax && this.isLastMissing(value) && this.toListItem) {
|
|
80
84
|
data.push(this.toListItem(this.lastSecond(value)));
|
|
81
85
|
}
|
|
82
86
|
return data;
|
|
@@ -85,8 +89,10 @@ var SecondsService = /** @class */ (function () {
|
|
|
85
89
|
if (this.valueInList(value)) {
|
|
86
90
|
return data;
|
|
87
91
|
}
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
if (this.toListItem) {
|
|
93
|
+
var missingItem = this.toListItem(value.getSeconds());
|
|
94
|
+
data.splice(this.selectedIndex(value), 0, missingItem);
|
|
95
|
+
}
|
|
90
96
|
return data;
|
|
91
97
|
};
|
|
92
98
|
SecondsService.prototype.countFromMin = function (value) {
|
|
@@ -100,7 +106,7 @@ var SecondsService = /** @class */ (function () {
|
|
|
100
106
|
return this.selectedIndex(value) !== this.divideByStep(value);
|
|
101
107
|
};
|
|
102
108
|
SecondsService.prototype.isLastMissing = function (value) {
|
|
103
|
-
return this.isMissing(setSeconds(this.max, this.lastSecond(value)));
|
|
109
|
+
return this.max !== null && this.isMissing(setSeconds(this.max, this.lastSecond(value)));
|
|
104
110
|
};
|
|
105
111
|
SecondsService.prototype.lastSecond = function (value) {
|
|
106
112
|
return this.range(value)[1];
|
package/dist/es/utils.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
2
|
-
for (var i = 0,
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
5
9
|
};
|
|
6
10
|
import { cloneDate, isEqual } from '@progress/kendo-date-math';
|
|
7
11
|
import { getDate } from '@progress/kendo-date-math';
|
|
@@ -31,7 +35,7 @@ export function nullable(subRequirement) {
|
|
|
31
35
|
return null;
|
|
32
36
|
}
|
|
33
37
|
var sub = required ? subRequirement.isRequired : subRequirement;
|
|
34
|
-
return sub.apply(void 0, __spreadArray([props, key], rest));
|
|
38
|
+
return sub.apply(void 0, __spreadArray([props, key], rest, false));
|
|
35
39
|
};
|
|
36
40
|
var fn = check.bind(null, false);
|
|
37
41
|
fn.isRequired = check.bind(null, true);
|
|
@@ -49,7 +49,13 @@ var Virtualization = /** @class */ (function (_super) {
|
|
|
49
49
|
__extends(Virtualization, _super);
|
|
50
50
|
function Virtualization(props) {
|
|
51
51
|
var _this = _super.call(this, props) || this;
|
|
52
|
+
_this.rowHeightService = null;
|
|
53
|
+
_this.scrollContainer = null;
|
|
54
|
+
_this.lastDirection = null;
|
|
55
|
+
_this.lastTotal = 0;
|
|
56
|
+
_this.lastTake = 0;
|
|
52
57
|
_this.animationInProgress = false;
|
|
58
|
+
_this.scrollToIndexTimeout = 0;
|
|
53
59
|
_this.scrollTo = function (value) {
|
|
54
60
|
var scrollProperty = _this.direction === 'vertical' ? 'scrollTop' : 'scrollLeft';
|
|
55
61
|
if (!_this.scrollContainer) {
|
|
@@ -66,7 +72,9 @@ var Virtualization = /** @class */ (function (_super) {
|
|
|
66
72
|
}
|
|
67
73
|
_this.scrollToIndexTimeout = window.requestAnimationFrame(function () {
|
|
68
74
|
_this.animationInProgress = false;
|
|
69
|
-
|
|
75
|
+
if (_this.rowHeightService) {
|
|
76
|
+
_this.scrollTo(_this.rowHeightService.offset(index));
|
|
77
|
+
}
|
|
70
78
|
});
|
|
71
79
|
};
|
|
72
80
|
_this.animateToIndex = function (index) {
|
|
@@ -106,7 +114,7 @@ var Virtualization = /** @class */ (function (_super) {
|
|
|
106
114
|
};
|
|
107
115
|
_this.scrollRange = function (indexOffset, direction) {
|
|
108
116
|
var containerScroll = _this.containerScrollPosition;
|
|
109
|
-
if (parseInt(""
|
|
117
|
+
if (parseInt("".concat(indexOffset), 10) === parseInt("".concat(containerScroll), 10)) {
|
|
110
118
|
return { start: indexOffset, end: indexOffset };
|
|
111
119
|
}
|
|
112
120
|
var maxScroll = _this.containerMaxScroll();
|
|
@@ -265,10 +273,10 @@ var Virtualization = /** @class */ (function (_super) {
|
|
|
265
273
|
this.lastDirection = this.direction;
|
|
266
274
|
this.lastTake = this.props.take;
|
|
267
275
|
}
|
|
268
|
-
var vertexLength = ""
|
|
276
|
+
var vertexLength = "".concat((this.rowHeightService ? this.rowHeightService.totalHeight() : 0) + this.props.bottomOffset);
|
|
269
277
|
var placeholderStyle = this.direction === 'vertical'
|
|
270
|
-
? { height: vertexLength
|
|
271
|
-
: { width: vertexLength
|
|
278
|
+
? { height: "".concat(vertexLength, "px") }
|
|
279
|
+
: { width: "".concat(vertexLength, "px") };
|
|
272
280
|
var rootClassNames = classNames('k-content k-calendar-content k-scrollable', {
|
|
273
281
|
'k-scrollable-horizontal': this.direction === 'horizontal'
|
|
274
282
|
}, this.props.className);
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
2
|
-
for (var i = 0,
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
5
9
|
};
|
|
6
10
|
/**
|
|
7
11
|
* @hidden
|
|
8
12
|
*/
|
|
9
|
-
var update = function (arr, idx, value) { return (__spreadArray(__spreadArray([], arr.slice(0, idx + 1)), (arr.slice(idx + 1).map(function (x) { return x + value; })))); };
|
|
13
|
+
var update = function (arr, idx, value) { return (__spreadArray(__spreadArray([], arr.slice(0, idx + 1), true), (arr.slice(idx + 1).map(function (x) { return x + value; })), true)); };
|
|
10
14
|
/**
|
|
11
15
|
* @hidden
|
|
12
16
|
*/
|
|
@@ -26,7 +26,13 @@ var ScrollerService = /** @class */ (function () {
|
|
|
26
26
|
function ScrollerService(onScrollAction, onPageAction) {
|
|
27
27
|
this.onScrollAction = onScrollAction;
|
|
28
28
|
this.onPageAction = onPageAction;
|
|
29
|
+
this.direction = 'vertical';
|
|
29
30
|
this.firstLoaded = 0;
|
|
31
|
+
this.lastLoaded = 0;
|
|
32
|
+
this.lastScrollTop = 0;
|
|
33
|
+
this.take = 0;
|
|
34
|
+
this.total = 0;
|
|
35
|
+
this.rowHeightService = null;
|
|
30
36
|
this.bottomOffset = 0;
|
|
31
37
|
this.topOffset = 0;
|
|
32
38
|
}
|
|
@@ -52,7 +58,7 @@ var ScrollerService = /** @class */ (function () {
|
|
|
52
58
|
var scrollLeft = _a.scrollLeft, scrollTop = _a.scrollTop, offsetHeight = _a.offsetHeight, offsetWidth = _a.offsetWidth;
|
|
53
59
|
var scrollPosition = this.direction === 'vertical' ? scrollTop : scrollLeft;
|
|
54
60
|
var offsetSize = this.direction === 'vertical' ? offsetHeight : offsetWidth;
|
|
55
|
-
if (this.lastScrollTop === scrollPosition) {
|
|
61
|
+
if (this.lastScrollTop === scrollPosition || !this.rowHeightService) {
|
|
56
62
|
return;
|
|
57
63
|
}
|
|
58
64
|
var up = this.lastScrollTop >= scrollPosition;
|
|
@@ -74,10 +80,10 @@ var ScrollerService = /** @class */ (function () {
|
|
|
74
80
|
}
|
|
75
81
|
};
|
|
76
82
|
ScrollerService.prototype.rowOffset = function (index) {
|
|
77
|
-
return this.rowHeightService.offset(index) + this.topOffset;
|
|
83
|
+
return this.rowHeightService ? this.rowHeightService.offset(index) + this.topOffset : 0;
|
|
78
84
|
};
|
|
79
85
|
ScrollerService.prototype.rowsForHeight = function (height) {
|
|
80
|
-
return Math.ceil(height / this.rowHeightService.height(0));
|
|
86
|
+
return this.rowHeightService ? Math.ceil(height / this.rowHeightService.height(0)) : 0;
|
|
81
87
|
};
|
|
82
88
|
return ScrollerService;
|
|
83
89
|
}());
|
|
@@ -80,8 +80,8 @@ export declare class CalendarWithoutContext extends React.Component<CalendarProp
|
|
|
80
80
|
tabIndex: PropTypes.Requireable<number>;
|
|
81
81
|
value: PropTypes.Requireable<Date>;
|
|
82
82
|
weekNumber: PropTypes.Requireable<boolean>;
|
|
83
|
-
topView: (props: CalendarProps, propName: string, componentName: string) => Error;
|
|
84
|
-
bottomView: (props: CalendarProps, propName: string, componentName: string) => Error;
|
|
83
|
+
topView: (props: CalendarProps, propName: string, componentName: string) => Error | null;
|
|
84
|
+
bottomView: (props: CalendarProps, propName: string, componentName: string) => Error | null;
|
|
85
85
|
};
|
|
86
86
|
/**
|
|
87
87
|
* @hidden
|
|
@@ -92,13 +92,13 @@ export declare class CalendarWithoutContext extends React.Component<CalendarProp
|
|
|
92
92
|
max: Date;
|
|
93
93
|
navigation: boolean;
|
|
94
94
|
defaultActiveView: ActiveView;
|
|
95
|
-
defaultValue:
|
|
95
|
+
defaultValue: null;
|
|
96
96
|
smoothScroll: boolean;
|
|
97
97
|
topView: ActiveView;
|
|
98
98
|
bottomView: ActiveView;
|
|
99
99
|
};
|
|
100
100
|
protected dom: DOMService;
|
|
101
|
-
protected scrollSyncService: ScrollSyncService;
|
|
101
|
+
protected scrollSyncService: ScrollSyncService | null;
|
|
102
102
|
private valueDuringOnChange?;
|
|
103
103
|
private focusedDate;
|
|
104
104
|
private cellUID;
|
|
@@ -44,10 +44,10 @@ var calculateValue = function (min, max, stateValue, propValue) {
|
|
|
44
44
|
if (min === void 0) { min = CalendarWithoutContext.defaultProps.min; }
|
|
45
45
|
if (max === void 0) { max = CalendarWithoutContext.defaultProps.max; }
|
|
46
46
|
return propValue !== undefined
|
|
47
|
-
? propValue !== null && utils_1.isInRange(kendo_date_math_1.getDate(propValue), min, max)
|
|
47
|
+
? propValue !== null && (0, utils_1.isInRange)((0, kendo_date_math_1.getDate)(propValue), min, max)
|
|
48
48
|
? propValue
|
|
49
49
|
: null
|
|
50
|
-
: stateValue !== null && utils_1.isInRange(kendo_date_math_1.getDate(stateValue), min, max)
|
|
50
|
+
: stateValue !== null && (0, utils_1.isInRange)((0, kendo_date_math_1.getDate)(stateValue), min, max)
|
|
51
51
|
? stateValue
|
|
52
52
|
: null;
|
|
53
53
|
};
|
|
@@ -56,8 +56,15 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
56
56
|
__extends(CalendarWithoutContext, _super);
|
|
57
57
|
function CalendarWithoutContext(props) {
|
|
58
58
|
var _this = _super.call(this, props) || this;
|
|
59
|
-
_this.
|
|
60
|
-
_this.
|
|
59
|
+
_this.scrollSyncService = null;
|
|
60
|
+
_this.focusedDate = null;
|
|
61
|
+
_this.cellUID = (0, kendo_react_common_1.guid)();
|
|
62
|
+
_this.id = (0, kendo_react_common_1.guid)();
|
|
63
|
+
_this.Navigation = null;
|
|
64
|
+
_this.calendarViewList = null;
|
|
65
|
+
_this._element = null;
|
|
66
|
+
_this.intl = null;
|
|
67
|
+
_this.service = null;
|
|
61
68
|
_this.isActive = false;
|
|
62
69
|
_this.didNavigationChange = false;
|
|
63
70
|
/**
|
|
@@ -80,17 +87,19 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
80
87
|
return;
|
|
81
88
|
}
|
|
82
89
|
_this.didNavigationChange = true;
|
|
83
|
-
var focusedDate = kendo_date_math_1.cloneDate(event.value);
|
|
90
|
+
var focusedDate = (0, kendo_date_math_1.cloneDate)(event.value);
|
|
84
91
|
_this.setState({ focusedDate: focusedDate });
|
|
85
92
|
};
|
|
86
93
|
_this.handleViewChange = function (_a) {
|
|
87
94
|
var view = _a.view;
|
|
88
|
-
_this.scrollSyncService
|
|
95
|
+
if (_this.scrollSyncService) {
|
|
96
|
+
_this.scrollSyncService.configure(view);
|
|
97
|
+
}
|
|
89
98
|
_this.setState({ activeView: view });
|
|
90
99
|
};
|
|
91
100
|
_this.handleDateChange = function (event) {
|
|
92
|
-
var value = kendo_date_math_1.cloneDate(event.value);
|
|
93
|
-
var focusedDate = kendo_date_math_1.cloneDate(event.value);
|
|
101
|
+
var value = (0, kendo_date_math_1.cloneDate)(event.value);
|
|
102
|
+
var focusedDate = (0, kendo_date_math_1.cloneDate)(event.value);
|
|
94
103
|
var canNavigateDown = _this.bus.canMoveDown(_this.state.activeView);
|
|
95
104
|
if (_this.props.disabled) {
|
|
96
105
|
return;
|
|
@@ -143,10 +152,13 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
143
152
|
};
|
|
144
153
|
_this.handleKeyDown = function (event) {
|
|
145
154
|
var keyCode = event.keyCode;
|
|
155
|
+
if (!_this.focusedDate || !_this.service) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
146
158
|
if (keyCode === kendo_react_common_1.Keys.enter) {
|
|
147
159
|
if (_this.value !== null
|
|
148
|
-
&& kendo_date_math_1.isEqualDate(_this.focusedDate, _this.value)) {
|
|
149
|
-
var viewDate = utils_1.dateInRange(_this.focusedDate, _this.min, _this.max);
|
|
160
|
+
&& (0, kendo_date_math_1.isEqualDate)(_this.focusedDate, _this.value)) {
|
|
161
|
+
var viewDate = (0, utils_1.dateInRange)(_this.focusedDate, _this.min, _this.max);
|
|
150
162
|
virtualizationProp(_this.calendarViewList).scrollToIndex(_this.service.skip(viewDate, _this.min));
|
|
151
163
|
}
|
|
152
164
|
var args = {
|
|
@@ -155,11 +167,11 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
155
167
|
value: _this.focusedDate,
|
|
156
168
|
target: _this
|
|
157
169
|
};
|
|
158
|
-
_this.handleDateChange
|
|
170
|
+
_this.handleDateChange(args);
|
|
159
171
|
}
|
|
160
172
|
else {
|
|
161
|
-
var candidate = utils_1.dateInRange(_this.navigation.move(_this.focusedDate, _this.navigation.action(event), _this.state.activeView, _this.service, event), _this.min, _this.max);
|
|
162
|
-
if (kendo_date_math_1.isEqualDate(_this.focusedDate, candidate)) {
|
|
173
|
+
var candidate = (0, utils_1.dateInRange)(_this.navigation.move(_this.focusedDate, _this.navigation.action(event), _this.state.activeView, _this.service, event), _this.min, _this.max);
|
|
174
|
+
if ((0, kendo_date_math_1.isEqualDate)(_this.focusedDate, candidate)) {
|
|
163
175
|
return;
|
|
164
176
|
}
|
|
165
177
|
_this.setState({ focusedDate: candidate });
|
|
@@ -174,14 +186,14 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
174
186
|
_this._element.focus({ preventScroll: true });
|
|
175
187
|
}
|
|
176
188
|
};
|
|
177
|
-
kendo_react_common_1.validatePackage(package_metadata_1.packageMetadata);
|
|
189
|
+
(0, kendo_react_common_1.validatePackage)(package_metadata_1.packageMetadata);
|
|
178
190
|
var value = calculateValue(_this.min, _this.max, _this.props.defaultValue || CalendarWithoutContext.defaultProps.defaultValue, _this.props.value);
|
|
179
191
|
_this.state = {
|
|
180
192
|
value: value,
|
|
181
|
-
activeView: utils_1.viewInRange(models_1.CalendarViewEnum[props.defaultActiveView], _this.bottomView, _this.topView),
|
|
182
|
-
focusedDate: utils_1.dateInRange(props.focusedDate
|
|
193
|
+
activeView: (0, utils_1.viewInRange)(models_1.CalendarViewEnum[props.defaultActiveView], _this.bottomView, _this.topView),
|
|
194
|
+
focusedDate: (0, utils_1.dateInRange)(props.focusedDate
|
|
183
195
|
|| value
|
|
184
|
-
|| utils_1.getToday(), _this.min, _this.max)
|
|
196
|
+
|| (0, utils_1.getToday)(), _this.min, _this.max)
|
|
185
197
|
};
|
|
186
198
|
_this.dom = new services_1.DOMService();
|
|
187
199
|
_this.bus = new services_1.BusViewService(_this.handleViewChange);
|
|
@@ -215,7 +227,7 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
215
227
|
});
|
|
216
228
|
Object.defineProperty(CalendarWithoutContext.prototype, "min", {
|
|
217
229
|
get: function () {
|
|
218
|
-
return kendo_date_math_1.getDate(this.props.min !== undefined
|
|
230
|
+
return (0, kendo_date_math_1.getDate)(this.props.min !== undefined
|
|
219
231
|
? this.props.min
|
|
220
232
|
: CalendarWithoutContext.defaultProps.min);
|
|
221
233
|
},
|
|
@@ -224,7 +236,7 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
224
236
|
});
|
|
225
237
|
Object.defineProperty(CalendarWithoutContext.prototype, "max", {
|
|
226
238
|
get: function () {
|
|
227
|
-
return kendo_date_math_1.getDate(this.props.max !== undefined
|
|
239
|
+
return (0, kendo_date_math_1.getDate)(this.props.max !== undefined
|
|
228
240
|
? this.props.max
|
|
229
241
|
: CalendarWithoutContext.defaultProps.max);
|
|
230
242
|
},
|
|
@@ -269,7 +281,7 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
269
281
|
* @hidden
|
|
270
282
|
*/
|
|
271
283
|
CalendarWithoutContext.prototype.componentDidUpdate = function (_, prevState) {
|
|
272
|
-
if (prevState.activeView !== this.state.activeView) {
|
|
284
|
+
if (prevState.activeView !== this.state.activeView && this.scrollSyncService) {
|
|
273
285
|
this.scrollSyncService.configure(this.state.activeView);
|
|
274
286
|
}
|
|
275
287
|
if (this.calendarViewList) {
|
|
@@ -287,22 +299,22 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
287
299
|
this.props._ref(this);
|
|
288
300
|
}
|
|
289
301
|
var didValueChange = this.value !== null && this.oldValue !== null
|
|
290
|
-
? !kendo_date_math_1.isEqualDate(this.value, this.oldValue)
|
|
302
|
+
? !(0, kendo_date_math_1.isEqualDate)(this.value, this.oldValue)
|
|
291
303
|
: this.value !== this.oldValue;
|
|
292
|
-
var activeView = utils_1.viewInRange(this.state.activeView, models_1.CalendarViewEnum[this.props.bottomView !== undefined
|
|
304
|
+
var activeView = (0, utils_1.viewInRange)(this.state.activeView, models_1.CalendarViewEnum[this.props.bottomView !== undefined
|
|
293
305
|
? this.props.bottomView
|
|
294
306
|
: CalendarWithoutContext.defaultProps.bottomView], models_1.CalendarViewEnum[this.props.topView !== undefined
|
|
295
307
|
? this.props.topView
|
|
296
308
|
: CalendarWithoutContext.defaultProps.topView]);
|
|
297
309
|
var value = calculateValue(this.min, this.max, this.value, this.value);
|
|
298
|
-
var sanitizedValue = value ? kendo_date_math_1.getDate(value) : null;
|
|
299
|
-
this.focusedDate = kendo_date_math_1.getDate(utils_1.dateInRange(didValueChange && value !== null
|
|
310
|
+
var sanitizedValue = value ? (0, kendo_date_math_1.getDate)(value) : null;
|
|
311
|
+
this.focusedDate = (0, kendo_date_math_1.getDate)((0, utils_1.dateInRange)(didValueChange && value !== null
|
|
300
312
|
? value
|
|
301
313
|
: this.state.focusedDate, this.min, this.max));
|
|
302
|
-
this.intl = kendo_react_intl_1.provideIntlService(this);
|
|
314
|
+
this.intl = (0, kendo_react_intl_1.provideIntlService)(this);
|
|
303
315
|
this.bus.configure(this.bottomView, this.topView);
|
|
304
316
|
this.service = this.bus.service(activeView, this.intl);
|
|
305
|
-
var rootClassNames = kendo_react_common_1.classNames('k-widget k-calendar k-calendar-infinite', {
|
|
317
|
+
var rootClassNames = (0, kendo_react_common_1.classNames)('k-widget k-calendar k-calendar-infinite', {
|
|
306
318
|
'k-disabled': this.props.disabled,
|
|
307
319
|
'k-week-number': this.props.weekNumber
|
|
308
320
|
}, this.props.className);
|
|
@@ -343,7 +355,7 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
343
355
|
var prop = props[propName];
|
|
344
356
|
var bottomView = props.bottomView;
|
|
345
357
|
if (prop && bottomView && models_1.CalendarViewEnum[prop] < models_1.CalendarViewEnum[bottomView]) {
|
|
346
|
-
return new Error("Invalid prop + "
|
|
358
|
+
return new Error("Invalid prop + ".concat(propName, " suplied to ").concat(componentName, ".\n ").concat(propName, " can not be smaller than bottomView.\n "));
|
|
347
359
|
}
|
|
348
360
|
return null;
|
|
349
361
|
},
|
|
@@ -351,7 +363,7 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
|
|
|
351
363
|
var prop = props[propName];
|
|
352
364
|
var topView = props.topView;
|
|
353
365
|
if (prop && topView && models_1.CalendarViewEnum[prop] > models_1.CalendarViewEnum[topView]) {
|
|
354
|
-
return new Error("Invalid prop + "
|
|
366
|
+
return new Error("Invalid prop + ".concat(propName, " suplied to ").concat(componentName, ".\n ").concat(propName, " can not be bigger than topView.\n "));
|
|
355
367
|
}
|
|
356
368
|
return null;
|
|
357
369
|
}
|
|
@@ -379,7 +391,7 @@ exports.CalendarWithoutContext = CalendarWithoutContext;
|
|
|
379
391
|
*
|
|
380
392
|
* For more information, refer to the [DateInputs Props Context]({% slug props-context_dateinputs %}) article.
|
|
381
393
|
*/
|
|
382
|
-
exports.CalendarPropsContext = kendo_react_common_1.createPropsContext();
|
|
394
|
+
exports.CalendarPropsContext = (0, kendo_react_common_1.createPropsContext)();
|
|
383
395
|
/* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
|
|
384
396
|
/**
|
|
385
397
|
* Represents the KendoReact Calendar Component.
|
|
@@ -387,6 +399,6 @@ exports.CalendarPropsContext = kendo_react_common_1.createPropsContext();
|
|
|
387
399
|
* Accepts properties of type [CalendarProps]({% slug api_dateinputs_calendarprops %}).
|
|
388
400
|
* Obtaining the `ref` returns an object of type [CalendarHandle]({% slug api_dateinputs_calendarhandle %}).
|
|
389
401
|
*/
|
|
390
|
-
exports.Calendar = kendo_react_common_1.withPropsContext(exports.CalendarPropsContext, CalendarWithoutContext);
|
|
402
|
+
exports.Calendar = (0, kendo_react_common_1.withPropsContext)(exports.CalendarPropsContext, CalendarWithoutContext);
|
|
391
403
|
exports.Calendar.displayName = 'KendoReactCalendar';
|
|
392
|
-
kendo_react_intl_1.registerForIntl(CalendarWithoutContext);
|
|
404
|
+
(0, kendo_react_intl_1.registerForIntl)(CalendarWithoutContext);
|
|
@@ -110,7 +110,7 @@ var CalendarCell = /** @class */ (function (_super) {
|
|
|
110
110
|
var _a = this.props, className = _a.className, formattedValue = _a.formattedValue, isWeekend = _a.isWeekend, isFocused = _a.isFocused, isInRange = _a.isInRange, isSelected = _a.isSelected, isRangeStart = _a.isRangeStart, isRangeMid = _a.isRangeMid, isRangeEnd = _a.isRangeEnd, isRangeSplitStart = _a.isRangeSplitStart, isRangeSplitEnd = _a.isRangeSplitEnd, isToday = _a.isToday, isDisabled = _a.isDisabled, view = _a.view, value = _a.value, other = __rest(_a, ["className", "formattedValue", "isWeekend", "isFocused", "isInRange", "isSelected", "isRangeStart", "isRangeMid", "isRangeEnd", "isRangeSplitStart", "isRangeSplitEnd", "isToday", "isDisabled", "view", "value"]);
|
|
111
111
|
var isEndActive = this.props.activeRangeEnd === 'end' && isRangeEnd;
|
|
112
112
|
var isStartActive = this.props.activeRangeEnd === 'start' && isRangeStart;
|
|
113
|
-
var rootClassName = kendo_react_common_1.classNames('k-calendar-td', {
|
|
113
|
+
var rootClassName = (0, kendo_react_common_1.classNames)('k-calendar-td', {
|
|
114
114
|
'k-range-end': isRangeEnd,
|
|
115
115
|
'k-range-mid': isRangeMid,
|
|
116
116
|
'k-range-split-end': isRangeSplitEnd,
|
|
@@ -62,7 +62,7 @@ var CalendarNavigationItem = /** @class */ (function (_super) {
|
|
|
62
62
|
CalendarNavigationItem.prototype.render = function () {
|
|
63
63
|
var _a = this.props, isRangeStart = _a.isRangeStart, value = _a.value, text = _a.text, other = __rest(_a, ["isRangeStart", "value", "text"]);
|
|
64
64
|
return (React.createElement("li", __assign({}, other, { onClick: this.handleClick }),
|
|
65
|
-
React.createElement("span", { className: kendo_react_common_1.classNames({ 'k-calendar-navigation-marker': isRangeStart }) }, this.props.children)));
|
|
65
|
+
React.createElement("span", { className: (0, kendo_react_common_1.classNames)({ 'k-calendar-navigation-marker': isRangeStart }) }, this.props.children)));
|
|
66
66
|
};
|
|
67
67
|
return CalendarNavigationItem;
|
|
68
68
|
}(React.Component));
|
|
@@ -57,7 +57,7 @@ var CalendarWeekCell = /** @class */ (function (_super) {
|
|
|
57
57
|
*/
|
|
58
58
|
CalendarWeekCell.prototype.render = function () {
|
|
59
59
|
var _a = this.props, className = _a.className, firstDate = _a.firstDate, other = __rest(_a, ["className", "firstDate"]);
|
|
60
|
-
return (React.createElement("td", __assign({ className: kendo_react_common_1.classNames('k-calendar-td', className) }, other), this.props.children));
|
|
60
|
+
return (React.createElement("td", __assign({ className: (0, kendo_react_common_1.classNames)('k-calendar-td', className) }, other), this.props.children));
|
|
61
61
|
};
|
|
62
62
|
return CalendarWeekCell;
|
|
63
63
|
}(React.Component));
|
|
@@ -50,7 +50,7 @@ var Header = /** @class */ (function (_super) {
|
|
|
50
50
|
if (take < 1 || !_this.props.service.isInRange(nextDate, _this.min, _this.max)) {
|
|
51
51
|
return title;
|
|
52
52
|
}
|
|
53
|
-
return title
|
|
53
|
+
return "".concat(title, " - ").concat(_this.props.service.title(nextDate));
|
|
54
54
|
};
|
|
55
55
|
_this.handleTitleClick = function (event) {
|
|
56
56
|
if (!_this.canMoveUp) {
|
|
@@ -94,7 +94,7 @@ var Header = /** @class */ (function (_super) {
|
|
|
94
94
|
});
|
|
95
95
|
Header.prototype.render = function () {
|
|
96
96
|
var title = this.getTitle();
|
|
97
|
-
var titleClassNames = kendo_react_common_1.classNames('k-calendar-title');
|
|
97
|
+
var titleClassNames = (0, kendo_react_common_1.classNames)('k-calendar-title');
|
|
98
98
|
var headerTitleProps = {
|
|
99
99
|
children: title,
|
|
100
100
|
value: title,
|
|
@@ -126,4 +126,4 @@ var Header = /** @class */ (function (_super) {
|
|
|
126
126
|
return Header;
|
|
127
127
|
}(React.Component));
|
|
128
128
|
exports.Header = Header;
|
|
129
|
-
kendo_react_intl_1.registerForLocalization(Header);
|
|
129
|
+
(0, kendo_react_intl_1.registerForLocalization)(Header);
|
|
@@ -30,6 +30,7 @@ var HorizontalViewList = /** @class */ (function (_super) {
|
|
|
30
30
|
__extends(HorizontalViewList, _super);
|
|
31
31
|
function HorizontalViewList(props) {
|
|
32
32
|
var _this = _super.call(this, props) || this;
|
|
33
|
+
_this._element = null;
|
|
33
34
|
_this.isActive = false;
|
|
34
35
|
_this.focusActiveDate = function () {
|
|
35
36
|
if (!_this._element) {
|
|
@@ -72,7 +73,7 @@ var HorizontalViewList = /** @class */ (function (_super) {
|
|
|
72
73
|
var args = {
|
|
73
74
|
syntheticEvent: event.syntheticEvent,
|
|
74
75
|
nativeEvent: event.nativeEvent,
|
|
75
|
-
value: kendo_date_math_1.cloneDate(event.value),
|
|
76
|
+
value: (0, kendo_date_math_1.cloneDate)(event.value),
|
|
76
77
|
target: _this,
|
|
77
78
|
isTodayClick: isTodayClick
|
|
78
79
|
};
|
|
@@ -123,7 +124,7 @@ var HorizontalViewList = /** @class */ (function (_super) {
|
|
|
123
124
|
var selectionRange = this.props.allowReverse
|
|
124
125
|
? this.rotateSelectionRange(this.props.selectionRange)
|
|
125
126
|
: this.props.selectionRange;
|
|
126
|
-
var rootClassNames = kendo_react_common_1.classNames('k-calendar-view k-hstack k-align-items-start k-justify-content-center', {
|
|
127
|
+
var rootClassNames = (0, kendo_react_common_1.classNames)('k-calendar-view k-hstack k-align-items-start k-justify-content-center', {
|
|
127
128
|
'k-calendar-monthview': this.props.activeView === models_1.CalendarViewEnum.month,
|
|
128
129
|
'k-calendar-yearview': this.props.activeView === models_1.CalendarViewEnum.year,
|
|
129
130
|
'k-calendar-decadeview': this.props.activeView === models_1.CalendarViewEnum.decade,
|
|
@@ -62,14 +62,14 @@ export declare class MultiViewCalendarWithoutContext extends React.Component<Mul
|
|
|
62
62
|
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
63
63
|
max: PropTypes.Requireable<Date>;
|
|
64
64
|
min: PropTypes.Requireable<Date>;
|
|
65
|
-
mode: PropTypes.Requireable<"
|
|
65
|
+
mode: PropTypes.Requireable<"multiple" | "range" | "single">;
|
|
66
66
|
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
67
67
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
68
68
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
69
69
|
tabIndex: PropTypes.Requireable<number>;
|
|
70
70
|
topView: PropTypes.Requireable<ActiveView>;
|
|
71
71
|
value: PropTypes.Requireable<any>;
|
|
72
|
-
views: (props: any, propName: any, componentName: any) => Error;
|
|
72
|
+
views: (props: any, propName: any, componentName: any) => Error | null;
|
|
73
73
|
weekNumber: PropTypes.Requireable<boolean>;
|
|
74
74
|
};
|
|
75
75
|
/**
|
|
@@ -81,7 +81,7 @@ export declare class MultiViewCalendarWithoutContext extends React.Component<Mul
|
|
|
81
81
|
max: Date;
|
|
82
82
|
navigation: boolean;
|
|
83
83
|
defaultActiveView: ActiveView;
|
|
84
|
-
defaultValue:
|
|
84
|
+
defaultValue: null;
|
|
85
85
|
topView: ActiveView;
|
|
86
86
|
tabIndex: number;
|
|
87
87
|
bottomView: ActiveView;
|