@progress/kendo-react-dateinputs 13.3.0-develop.9 → 13.4.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PopupSettings.d.ts +22 -0
- package/calendar/components/Calendar.d.ts +202 -0
- package/calendar/components/Calendar.mjs +7 -7
- package/calendar/components/CalendarCell.d.ts +71 -0
- package/calendar/components/CalendarHeaderTitle.d.ts +38 -0
- package/calendar/components/CalendarNavigationItem.d.ts +39 -0
- package/calendar/components/CalendarWeekCell.d.ts +42 -0
- package/calendar/components/Header.d.ts +65 -0
- package/calendar/components/Header.mjs +3 -3
- package/calendar/components/HorizontalViewList.d.ts +80 -0
- package/calendar/components/HorizontalViewList.mjs +3 -3
- package/calendar/components/MultiViewCalendar.d.ts +226 -0
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +17 -17
- package/calendar/components/Navigation.d.ts +85 -0
- package/calendar/components/TodayCommand.d.ts +46 -0
- package/calendar/components/TodayCommand.mjs +3 -3
- package/calendar/components/View.d.ts +101 -0
- package/calendar/components/ViewList.d.ts +128 -0
- package/calendar/models/ActiveView.d.ts +11 -0
- package/calendar/models/CalendarSettings.d.ts +256 -0
- package/calendar/models/CalendarViewEnum.d.ts +16 -0
- package/calendar/models/CellContext.d.ts +72 -0
- package/calendar/models/MultiViewCalendarMode.d.ts +16 -0
- package/calendar/models/MultiViewCalendarSettings.d.ts +129 -0
- package/calendar/models/NavigationAction.d.ts +22 -0
- package/calendar/models/SelectionRange.d.ts +24 -0
- package/calendar/models/SelectionRangeEnd.d.ts +11 -0
- package/calendar/models/ViewService.d.ts +32 -0
- package/calendar/models/WeekDaysFormat.d.ts +11 -0
- package/calendar/models/index.d.ts +18 -0
- package/calendar/services/BusViewService.d.ts +28 -0
- package/calendar/services/CenturyViewService.d.ts +32 -0
- package/calendar/services/CenturyViewService.mjs +4 -4
- package/calendar/services/DOMService.d.ts +36 -0
- package/calendar/services/DecadeViewService.d.ts +34 -0
- package/calendar/services/DecadeViewService.mjs +4 -4
- package/calendar/services/MonthViewService.d.ts +40 -0
- package/calendar/services/MonthViewService.mjs +2 -2
- package/calendar/services/NavigationService.d.ts +21 -0
- package/calendar/services/ScrollSyncService.d.ts +28 -0
- package/calendar/services/WeekNamesService.d.ts +17 -0
- package/calendar/services/YearViewService.d.ts +38 -0
- package/calendar/services/YearViewService.mjs +2 -2
- package/calendar/services/index.d.ts +17 -0
- package/calendar/utils/ScrollSync.d.ts +20 -0
- package/codemods/utils.js +1 -8
- package/codemods/v11/dateinput-handle.js +1 -8
- package/codemods/v11/datepicker-handle.js +1 -8
- package/common/AdaptiveMode.d.ts +22 -0
- package/common/ClearButton.d.ts +20 -0
- package/dateinput/DateInput.d.ts +248 -0
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +63 -65
- package/dateinput/dateInputIntl.d.ts +30 -0
- package/dateinput/models/DateInputSettings.d.ts +107 -0
- package/dateinput/models/common-package-props.d.ts +34 -0
- package/dateinput/models/dateinput-options.d.ts +105 -0
- package/dateinput/models/format-placeholder.d.ts +46 -0
- package/dateinput/models/incremental-steps.d.ts +24 -0
- package/dateinput/models/index.d.ts +15 -0
- package/dateinput/models/kendo-date.d.ts +60 -0
- package/dateinput/models/mask.d.ts +14 -0
- package/dateinput/models/selection.d.ts +14 -0
- package/dateinput/utils.d.ts +31 -0
- package/datepicker/DatePicker.d.ts +279 -0
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +68 -72
- package/datepicker/ToggleButton.d.ts +17 -0
- package/datepicker/models/DatePickerSettings.d.ts +248 -0
- package/datepicker/models/index.d.ts +9 -0
- package/daterangepicker/DateRangePicker.d.ts +357 -0
- package/daterangepicker/DateRangePicker.mjs +13 -13
- package/daterangepicker/models/DateRangePickerCalendarSettings.d.ts +13 -0
- package/daterangepicker/models/DateRangePickerDateInputSettings.d.ts +13 -0
- package/daterangepicker/models/DateRangePickerPopupSettings.d.ts +13 -0
- package/daterangepicker/models/DateRangePickerSettings.d.ts +129 -0
- package/daterangepicker/models/index.d.ts +12 -0
- package/datetimepicker/DateTimePicker.d.ts +420 -0
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +16 -20
- package/datetimepicker/DateTimeSelector.d.ts +111 -0
- package/datetimepicker/DateTimeSelector.mjs +3 -3
- package/datetimepicker/models/DateTimePickerSettings.d.ts +154 -0
- package/datetimepicker/models/index.d.ts +9 -0
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/hooks/usePickerFloatingLabel.d.ts +27 -0
- package/index.d.mts +35 -4952
- package/index.d.ts +35 -4952
- package/messages/index.d.ts +132 -0
- package/package-metadata.d.ts +12 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +10 -16
- package/package.json +8 -8
- package/timepicker/TimeList.d.ts +97 -0
- package/timepicker/TimeList.js +5 -5
- package/timepicker/TimeList.mjs +122 -112
- package/timepicker/TimePart.d.ts +146 -0
- package/timepicker/TimePart.mjs +3 -3
- package/timepicker/TimePicker.d.ts +417 -0
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +64 -68
- package/timepicker/TimeSelector.d.ts +149 -0
- package/timepicker/TimeSelector.mjs +3 -3
- package/timepicker/models/IncrementalSteps.d.ts +18 -0
- package/timepicker/models/ListItem.d.ts +14 -0
- package/timepicker/models/ListService.d.ts +22 -0
- package/timepicker/models/ListServiceSettings.d.ts +19 -0
- package/timepicker/models/TimePart.d.ts +17 -0
- package/timepicker/models/TimePickerSettings.d.ts +137 -0
- package/timepicker/models/index.d.ts +14 -0
- package/timepicker/services/DOMService.d.ts +18 -0
- package/timepicker/services/DayPeriodService.d.ts +54 -0
- package/timepicker/services/HoursService.d.ts +40 -0
- package/timepicker/services/MinutesService.d.ts +39 -0
- package/timepicker/services/SecondsService.d.ts +39 -0
- package/timepicker/services/index.d.ts +13 -0
- package/timepicker/utils.d.ts +63 -0
- package/timepicker/utils.mjs +1 -1
- package/utils.d.ts +103 -0
- package/utils.js +1 -1
- package/utils.mjs +46 -46
- package/virtualization/Virtualization.d.ts +125 -0
- package/virtualization/services/ScrollerService.d.ts +56 -0
- package/virtualization/services/index.d.ts +10 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { default as PropTypes } from 'prop-types';
|
|
9
|
+
import { Action, ActiveView, SelectionRange, CalendarViewEnum, SelectionRangeEnd, MultiViewCalendarSettings } from '../models/index.js';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* The arguments for the `onChange` event of the MultiViewCalendar. * The generic argument sets the target type of the event. Defaults to `MultiViewCalendar`.
|
|
13
|
+
*/
|
|
14
|
+
export interface MultiViewCalendarChangeEvent<T = MultiViewCalendar> {
|
|
15
|
+
/** The React synthetic event */
|
|
16
|
+
syntheticEvent: React.SyntheticEvent<any>;
|
|
17
|
+
/** The native DOM event */
|
|
18
|
+
nativeEvent?: any;
|
|
19
|
+
/** The new value of the MultiViewCalendar (can be a single Date, array of Dates, or SelectionRange) */
|
|
20
|
+
value: Date | Date[] | SelectionRange | null;
|
|
21
|
+
/** The component instance that fired the event */
|
|
22
|
+
target: T;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Represents the props of the [KendoReact MultiViewCalendar component](https://www.telerik.com/kendo-react-ui/components/dateinputs/multiviewcalendar). The generic argument is passed to the `onChange` property and is used as a target in the [`MultiViewCalendarChangeEvent`](https://www.telerik.com/kendo-react-ui/components/dateinputs/api/multiviewcalendarchangeevent) interface.
|
|
26
|
+
*/
|
|
27
|
+
export interface MultiViewCalendarProps<T = any> extends MultiViewCalendarSettings {
|
|
28
|
+
/** @hidden */
|
|
29
|
+
_ref?: (instance: {
|
|
30
|
+
element: HTMLDivElement | null;
|
|
31
|
+
}) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the default value of the MultiViewCalendar.
|
|
34
|
+
*/
|
|
35
|
+
defaultValue?: Date | Date[] | SelectionRange | null;
|
|
36
|
+
/**
|
|
37
|
+
* An event that is called after the value of the MultiViewCalendar has changed. The new value is generated based on the current `mode` of the MultiViewCalendar.
|
|
38
|
+
*/
|
|
39
|
+
onChange?: (event: MultiViewCalendarChangeEvent<T>) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Sets the value of the MultiViewCalendar. Based on the value type, the MultiViewcalendar renders a single, multiple, or range selection.
|
|
42
|
+
*/
|
|
43
|
+
value?: Date | Date[] | SelectionRange | null;
|
|
44
|
+
/** @hidden */
|
|
45
|
+
mobileMode?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* @hidden
|
|
48
|
+
*/
|
|
49
|
+
dir?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @hidden
|
|
53
|
+
*/
|
|
54
|
+
export interface MultiViewCalendarState {
|
|
55
|
+
value: Date | Date[] | SelectionRange | null;
|
|
56
|
+
activeView: CalendarViewEnum;
|
|
57
|
+
focusedDate: Date;
|
|
58
|
+
navigateDate: Date;
|
|
59
|
+
}
|
|
60
|
+
/** @hidden */
|
|
61
|
+
export declare class MultiViewCalendarWithoutContext extends React.Component<MultiViewCalendarProps, MultiViewCalendarState> {
|
|
62
|
+
/**
|
|
63
|
+
* @hidden
|
|
64
|
+
*/
|
|
65
|
+
static displayName: string;
|
|
66
|
+
/**
|
|
67
|
+
* @hidden
|
|
68
|
+
*/
|
|
69
|
+
static propTypes: {
|
|
70
|
+
activeRangeEnd: PropTypes.Requireable<"end" | "start">;
|
|
71
|
+
allowReverse: PropTypes.Requireable<boolean>;
|
|
72
|
+
bottomView: PropTypes.Requireable<ActiveView>;
|
|
73
|
+
className: PropTypes.Requireable<string>;
|
|
74
|
+
defaultActiveView: PropTypes.Requireable<ActiveView>;
|
|
75
|
+
defaultValue: PropTypes.Requireable<any>;
|
|
76
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
77
|
+
focusedDate: PropTypes.Requireable<Date>;
|
|
78
|
+
id: PropTypes.Requireable<string>;
|
|
79
|
+
weekDaysFormat: PropTypes.Requireable<string>;
|
|
80
|
+
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
81
|
+
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
82
|
+
max: PropTypes.Requireable<Date>;
|
|
83
|
+
min: PropTypes.Requireable<Date>;
|
|
84
|
+
mode: PropTypes.Requireable<"range" | "multiple" | "single">;
|
|
85
|
+
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
86
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
87
|
+
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
88
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
89
|
+
topView: PropTypes.Requireable<ActiveView>;
|
|
90
|
+
value: PropTypes.Requireable<any>;
|
|
91
|
+
views: (props: MultiViewCalendarProps, propName: keyof MultiViewCalendarProps<any>, componentName: string) => Error | null;
|
|
92
|
+
weekNumber: PropTypes.Requireable<boolean>;
|
|
93
|
+
showOtherMonthDays: PropTypes.Requireable<boolean>;
|
|
94
|
+
dir: PropTypes.Requireable<string>;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* @hidden
|
|
98
|
+
*/
|
|
99
|
+
static defaultProps: {
|
|
100
|
+
disabled: boolean;
|
|
101
|
+
min: Date;
|
|
102
|
+
max: Date;
|
|
103
|
+
navigation: boolean;
|
|
104
|
+
defaultActiveView: ActiveView;
|
|
105
|
+
defaultValue: null;
|
|
106
|
+
topView: ActiveView;
|
|
107
|
+
weekDaysFormat: string;
|
|
108
|
+
tabIndex: number;
|
|
109
|
+
bottomView: ActiveView;
|
|
110
|
+
views: number;
|
|
111
|
+
allowReverse: boolean;
|
|
112
|
+
showOtherMonthDays: boolean;
|
|
113
|
+
};
|
|
114
|
+
protected dates: any[];
|
|
115
|
+
private lastView;
|
|
116
|
+
private lastViewsCount;
|
|
117
|
+
protected selectedDate: Date | null;
|
|
118
|
+
protected selectedMultiple: Date[] | null;
|
|
119
|
+
protected selectedRange: SelectionRange;
|
|
120
|
+
protected _focusedDate: Date;
|
|
121
|
+
protected cellUID: string | undefined;
|
|
122
|
+
private valueDuringOnChange?;
|
|
123
|
+
private activeRangeEnd;
|
|
124
|
+
private _element;
|
|
125
|
+
private bus;
|
|
126
|
+
private navigation;
|
|
127
|
+
private intl;
|
|
128
|
+
private localization;
|
|
129
|
+
private service;
|
|
130
|
+
private get wrapperID();
|
|
131
|
+
private calendarViewList;
|
|
132
|
+
private isActive;
|
|
133
|
+
private calculateFocusFromValue;
|
|
134
|
+
private get isRtl();
|
|
135
|
+
/**
|
|
136
|
+
* Gets the wrapping element of the MultiViewCalendar component.
|
|
137
|
+
*/
|
|
138
|
+
get element(): HTMLDivElement | null;
|
|
139
|
+
/**
|
|
140
|
+
* Gets the value of the MultiViewCalendar.
|
|
141
|
+
*/
|
|
142
|
+
get value(): Date | Date[] | SelectionRange | null;
|
|
143
|
+
/**
|
|
144
|
+
* Gets the current focused date of the MultiViewCalendar.
|
|
145
|
+
*/
|
|
146
|
+
get focusedDate(): Date;
|
|
147
|
+
protected get min(): Date;
|
|
148
|
+
protected get max(): Date;
|
|
149
|
+
protected get bottomView(): CalendarViewEnum;
|
|
150
|
+
protected get topView(): CalendarViewEnum;
|
|
151
|
+
protected get activeRange(): SelectionRangeEnd;
|
|
152
|
+
protected get todayIsInRange(): boolean;
|
|
153
|
+
private readonly showLicenseWatermark;
|
|
154
|
+
private readonly licenseMessage?;
|
|
155
|
+
constructor(props: MultiViewCalendarProps);
|
|
156
|
+
/**
|
|
157
|
+
* @hidden
|
|
158
|
+
*/
|
|
159
|
+
componentDidMount(): void;
|
|
160
|
+
/**
|
|
161
|
+
* @hidden
|
|
162
|
+
*/
|
|
163
|
+
componentDidUpdate(): void;
|
|
164
|
+
/**
|
|
165
|
+
* @hidden
|
|
166
|
+
*/
|
|
167
|
+
focus: () => void;
|
|
168
|
+
/**
|
|
169
|
+
* @hidden
|
|
170
|
+
*/
|
|
171
|
+
render(): React.JSX.Element;
|
|
172
|
+
protected clampRange: (value: Date) => SelectionRange;
|
|
173
|
+
protected rangeWithFocused: (range: SelectionRange, focusedDate: Date) => SelectionRange;
|
|
174
|
+
protected generateRange: (candidate: Date, value: SelectionRange) => SelectionRange;
|
|
175
|
+
protected canNavigate: (action: Action) => boolean;
|
|
176
|
+
protected isInMonth(date: Date, month: Date): boolean;
|
|
177
|
+
protected navigate: (action: Action, date: Date) => void;
|
|
178
|
+
protected move: (action: Action, date: Date) => Date;
|
|
179
|
+
protected clampDate: (value: Date) => Date;
|
|
180
|
+
protected shouldAutoCorrect: (candidate: Date, value: SelectionRange) => boolean;
|
|
181
|
+
private handleCellEnter;
|
|
182
|
+
private handleMouseDown;
|
|
183
|
+
private handleClick;
|
|
184
|
+
private handleFocus;
|
|
185
|
+
private handleBlur;
|
|
186
|
+
private handleTodayClick;
|
|
187
|
+
private handlePrevButtonClick;
|
|
188
|
+
private handleNextButtonClick;
|
|
189
|
+
private handleKeyDown;
|
|
190
|
+
private handleViewChange;
|
|
191
|
+
private handleWeekSelection;
|
|
192
|
+
private handleDateChange;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Represents the PropsContext of the `MultiViewCalendar` component.
|
|
196
|
+
* Used for global configuration of all `MultiViewCalendar` instances.
|
|
197
|
+
*
|
|
198
|
+
* For more information, refer to the [DateInputs Props Context](https://www.telerik.com/kendo-react-ui/components/dateinputs/props-context) article.
|
|
199
|
+
*/
|
|
200
|
+
export declare const MultiViewCalendarPropsContext: React.Context<(p: MultiViewCalendarProps<any>) => MultiViewCalendarProps<any>>;
|
|
201
|
+
/**
|
|
202
|
+
* Represent the `ref` of the MultiViewCalendar component.
|
|
203
|
+
*/
|
|
204
|
+
export interface MultiViewCalendarHandle extends Pick<MultiViewCalendarWithoutContext, keyof MultiViewCalendarWithoutContext> {
|
|
205
|
+
/**
|
|
206
|
+
* Returns the HTML element of the MultiViewCalendar component.
|
|
207
|
+
*/
|
|
208
|
+
element: HTMLDivElement | null;
|
|
209
|
+
/**
|
|
210
|
+
* Gets the current focused date of the MultiViewCalendar.
|
|
211
|
+
*/
|
|
212
|
+
focusedDate: Date;
|
|
213
|
+
/**
|
|
214
|
+
* Gets the value of the MultiViewCalendar.
|
|
215
|
+
*/
|
|
216
|
+
value: Date | Date[] | SelectionRange | null;
|
|
217
|
+
}
|
|
218
|
+
/** @hidden */
|
|
219
|
+
export type MultiViewCalendar = MultiViewCalendarHandle;
|
|
220
|
+
/**
|
|
221
|
+
* Represents the KendoReact MultiViewCalendar Component.
|
|
222
|
+
*
|
|
223
|
+
* Accepts properties of type [MultiViewCalendarProps](https://www.telerik.com/kendo-react-ui/components/dateinputs/api/multiviewcalendarprops).
|
|
224
|
+
* Obtaining the `ref` returns an object of type [MultiViewCalendarHandle](https://www.telerik.com/kendo-react-ui/components/dateinputs/api/multiviewcalendarhandle).
|
|
225
|
+
*/
|
|
226
|
+
export declare const MultiViewCalendar: React.ForwardRefExoticComponent<MultiViewCalendarProps<any> & React.RefAttributes<any>>;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("react"),s=require("prop-types"),F=require("@progress/kendo-react-intl"),g=require("@progress/kendo-react-common"),o=require("@progress/kendo-date-math"),S=require("@progress/kendo-react-buttons"),x=require("@progress/kendo-svg-icons"),I=require("../models/NavigationAction.js"),O=require("../models/CalendarViewEnum.js"),B=require("../models/SelectionRange.js"),z=require("./Header.js"),r=require("../../utils.js"),V=require("../../messages/index.js"),H=require("../services/BusViewService.js"),Y=require("../services/NavigationService.js"),E=require("./HorizontalViewList.js"),W=require("./TodayCommand.js"),T=require("../../package-metadata.js");function j(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const a in c)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(c,a);Object.defineProperty(i,a,d.get?d:{enumerable:!0,get:()=>c[a]})}}return i.default=c,Object.freeze(i)}const p=j(K),A=(c=m.defaultProps.min,i=m.defaultProps.max,a)=>a instanceof Date&&!Array.isArray(a)&&r.isInRange(o.getDate(a),c,i)?o.getDate(a):null,L=(c=m.defaultProps.min,i=m.defaultProps.max,a)=>Array.isArray(a)?a.filter(d=>r.isInRange(d,c,i)).map(d=>o.getDate(d)):null,P=c=>typeof c=="object"&&!(c instanceof Date)&&c!==null&&!Array.isArray(c)?c:B.EMPTY_SELECTIONRANGE,N=(c,i,a)=>c||i&&i[0]||a&&a.start,U=(c,i)=>c.start===null&&i===null?"start":c.end===null?"end":"start",v=class v extends p.Component{constructor(i){super(i),this.dates=[],this.selectedDate=null,this.selectedMultiple=null,this.selectedRange=B.EMPTY_SELECTIONRANGE,this._focusedDate=new Date,this.cellUID=this.props.id+"-cell-uid",this.activeRangeEnd="start",this._element=null,this.intl=null,this.localization=null,this.service=null,this.calendarViewList=null,this.isActive=!1,this.calculateFocusFromValue=!0,this.showLicenseWatermark=!1,this.focus=()=>{this._element&&this._element.focus()},this.clampRange=e=>({start:e,end:null}),this.rangeWithFocused=(e,t)=>({start:e.start,end:e.end===null&&e.start!==null&&this.isActive?t:e.end}),this.generateRange=(e,t)=>{const{end:h,start:l}=t,u=t.start!==null&&e.getTime()<=t.start.getTime();return!this.props.allowReverse&&u?{start:e,end:this.selectedRange.start}:this.activeRange!=="end"?{start:e,end:h}:{start:l||this.selectedDate,end:e}},this.canNavigate=e=>{if(!this.service)return!1;const t=this.service.move(this.focusedDate,e);return this.min<=t&&t<=this.max||this.service.isInSameView(t,this.min)||this.service.isInSameView(t,this.max)},this.navigate=(e,t)=>{this.calculateFocusFromValue=!1;const h=this.move(e,t);this.setState({navigateDate:h,focusedDate:h})},this.move=(e,t)=>this.clampDate(this.service.move(t,e)),this.clampDate=e=>r.dateInRange(e,this.min,this.max),this.shouldAutoCorrect=(e,t)=>{const{end:h,start:l}=t;return this.activeRange!=="end"?h!==null&&e>h:l!==null&&e<l},this.handleCellEnter=e=>{this.props.mode==="range"&&(this.calculateFocusFromValue=!1,this.setState({focusedDate:e}))},this.handleMouseDown=e=>{e.preventDefault()},this.handleClick=e=>{this._element&&this._element.focus({preventScroll:!0})},this.handleFocus=e=>{if(this.isActive=!0,!this.calendarViewList)return;this.calendarViewList.focusActiveDate();const{onFocus:t}=this.props;t&&t.call(void 0,e)},this.handleBlur=e=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:t}=this.props;t&&t.call(void 0,e)},this.handleTodayClick=e=>{this.todayIsInRange&&this.handleDateChange(e)},this.handlePrevButtonClick=()=>{const e=I.Action.PrevView;if(this.state.activeView>0&&this.focusedDate.getFullYear()>this.dates[0].getFullYear())this.navigate(e,this.move(e,this.focusedDate));else{const t=this.isInMonth(this.focusedDate,this.dates[1])?this.move(e,this.focusedDate):this.focusedDate;this.navigate(e,t)}},this.handleNextButtonClick=()=>{this.navigate(I.Action.NextView,this.focusedDate)},this.handleKeyDown=e=>{const{keyCode:h,ctrlKey:l,metaKey:u}=e;if(h===84){const n=r.getToday();this.calculateFocusFromValue=!1,this.setState({focusedDate:n,navigateDate:n})}if((l||u)&&(h===g.Keys.left&&this.handlePrevButtonClick(),h===g.Keys.right&&this.handleNextButtonClick()),h===g.Keys.enter){const n={syntheticEvent:e,nativeEvent:e.nativeEvent,value:this.focusedDate,target:this};this.handleDateChange(n)}else{const n=r.dateInRange(this.navigation.move(this.focusedDate,this.navigation.action(e),this.state.activeView,this.service,e),this.min,this.max);if(o.isEqualDate(this.focusedDate,n))return;this.dates&&this.service&&!this.service.isInArray(n,this.dates)&&this.setState({navigateDate:n}),this.calculateFocusFromValue=!1,this.setState({focusedDate:n})}e.preventDefault()},this.handleViewChange=({view:e})=>{this.calculateFocusFromValue=!1,this.setState(t=>({activeView:e,navigateDate:t.focusedDate}))},this.handleWeekSelection=(e,t,h)=>{if(this.props.mode==="single")return;const l=0,u=6,n=t===l?e:o.addDays(e,-t),f=t===u?e:o.addDays(e,u-t);let D=null;if(this.props.mode==="multiple"){D=[];for(let R=l;R<=u;R++)D.push(o.addDays(n,R));this.setState({value:D,focusedDate:e})}this.props.mode==="range"&&(D={start:n,end:f},this.setState({value:D,focusedDate:e}));const{onChange:k}=this.props;if(k){const R={syntheticEvent:h,nativeEvent:h.nativeEvent,value:D,target:this};k.call(void 0,R)}},this.handleDateChange=e=>{const t=o.cloneDate(e.value),h=this.bus.canMoveDown(this.state.activeView);if(this.props.disabled)return;if(h)if(e.isTodayClick)this.bus.moveToBottom(this.state.activeView);else{this.bus.moveDown(this.state.activeView,e.syntheticEvent),this.setState({focusedDate:t,navigateDate:t});return}this.calculateFocusFromValue=!0;let l;switch(this.props.mode){case"single":l=o.cloneDate(e.value);break;case"multiple":if(Array.isArray(this.selectedMultiple)){const n=this.selectedMultiple.slice();let f=-1;n.forEach((D,k)=>{o.isEqualDate(D,e.value)&&(f=k)}),f!==-1?n.splice(f,1):n.push(o.cloneDate(e.value)),l=n.slice()}else this.selectedDate?l=[o.cloneDate(this.selectedDate),o.cloneDate(e.value)]:l=[o.cloneDate(e.value)];break;case"range":{l=this.selectedRange.start!==null&&this.selectedRange.end!==null&&this.activeRange==="start"?this.clampRange(e.value):this.generateRange(e.value,this.selectedRange),this.activeRangeEnd=this.activeRange!=="end"?"end":"start";break}default:l=o.cloneDate(e.value);break}this.valueDuringOnChange=l,e.isTodayClick&&this.setState({navigateDate:t}),this.setState({value:l,focusedDate:t}),this.valueDuringOnChange=l;const{onChange:u}=this.props;if(u){const n={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:l,target:this};u.call(void 0,n)}this.valueDuringOnChange=void 0},this.showLicenseWatermark=!g.validatePackage(T.packageMetadata,{component:"MultiViewCalendar"}),this.licenseMessage=g.getLicenseMessage(T.packageMetadata);const a=i.value!==void 0?i.value:i.defaultValue||v.defaultProps.defaultValue,d=A(this.min,this.max,a),w=L(this.min,this.max,a),C=P(a),M=N(d,w,C),b=r.viewInRange(O.CalendarViewEnum[i.defaultActiveView],this.bottomView,this.topView),y=r.dateInRange(i.focusedDate||M||r.getToday(),this.min,this.max);this.state={value:a,activeView:b,focusedDate:y,navigateDate:y},this.activeRangeEnd=U(C,d),this.bus=new H.BusViewService(this.handleViewChange),this.navigation=new Y.NavigationService(this.bus),this.calculateFocusFromValue=!1,this.lastView=b,this.lastViewsCount=this.props.views||E.HorizontalViewList.defaultProps.views}get wrapperID(){return this.props.id+"-wrapper-id"}get isRtl(){return this.props.dir==="rtl"}get element(){return this._element}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value}get focusedDate(){return o.cloneDate(this._focusedDate)}get min(){return o.getDate(this.props.min!==void 0?this.props.min:v.defaultProps.min)}get max(){return o.getDate(this.props.max!==void 0?this.props.max:v.defaultProps.max)}get bottomView(){return O.CalendarViewEnum[this.props.bottomView!==void 0?this.props.bottomView:v.defaultProps.bottomView]}get topView(){return O.CalendarViewEnum[this.props.topView!==void 0?this.props.topView:v.defaultProps.topView]}get activeRange(){return this.props.activeRangeEnd!==void 0?this.props.activeRangeEnd:this.activeRangeEnd}get todayIsInRange(){return r.isInRange(r.getToday(),o.getDate(this.min),o.getDate(this.max))}componentDidMount(){this.calculateFocusFromValue=!0}componentDidUpdate(){this.calendarViewList&&(this.isActive?this.calendarViewList.focusActiveDate:this.calendarViewList.blurActiveDate)();const i=A(this.min,this.max,this.value);this.calculateFocusFromValue=!!(this.selectedDate&&i&&this.selectedDate.getTime()&&i.getTime()),this.lastView=this.state.activeView,this.lastViewsCount=this.props.views||E.HorizontalViewList.defaultProps.views}render(){this.props._ref&&this.props._ref(this),this.intl=F.provideIntlService(this),this.localization=F.provideLocalizationService(this),this.bus.configure(this.bottomView,this.topView);const i=r.viewInRange(this.state.activeView,this.bottomView,this.topView);this.service=this.bus.service(i,this.intl),this.selectedDate=A(this.min,this.max,this.value),this.selectedMultiple=L(this.min,this.max,this.value),this.selectedRange=P(this.value);const a=N(this.selectedDate,this.selectedMultiple,this.selectedRange);this._focusedDate=r.dateInRange(this.calculateFocusFromValue&&a!==null?a:this.state.focusedDate,this.min,this.max);const d=g.classNames("k-calendar k-calendar-range k-calendar-md",{"k-disabled":this.props.disabled},this.props.className),w=this.rangeWithFocused(this.selectedRange,this.focusedDate),C=this.localization.toLanguageString(V.prevView,V.messages[V.prevView]),M=this.localization.toLanguageString(V.nextView,V.messages[V.nextView]),b=!this.canNavigate(I.Action.PrevView),y=!this.canNavigate(I.Action.NextView),e={"aria-disabled":b},t={"aria-disabled":y},h=this.lastView!==i,l=this.dates&&this.isInMonth(this.state.navigateDate,this.dates[0]),u=this.lastViewsCount!==this.props.views;(!l||h||u)&&(this.dates=this.service.datesList(this.state.navigateDate,this.props.views||E.HorizontalViewList.defaultProps.views));const n=o.cloneDate(this.dates&&this.dates[0]?this.dates[0]:r.getToday());return p.createElement("div",{ref:f=>{this._element=f},className:d,id:this.props.id||this.wrapperID,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.disabled?void 0:this.props.tabIndex,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseDown:this.handleMouseDown,onClick:this.handleClick,onKeyDown:this.handleKeyDown,"aria-disabled":this.props.disabled,dir:this.props.dir},p.createElement(z.Header,{key:`.kendo.calendar.header.${n.getTime()}`,activeView:i,currentDate:n,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:p.createElement(p.Fragment,null,p.createElement(S.Button,{type:"button",className:"k-calendar-nav-prev",icon:this.isRtl?"chevron-right":"chevron-left",svgIcon:this.isRtl?x.chevronRightIcon:x.chevronLeftIcon,fillMode:"flat",title:C,disabled:b,onClick:this.handlePrevButtonClick,...e}),p.createElement(W.TodayCommand,{min:this.min,max:this.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange}),p.createElement(S.Button,{type:"button",className:"k-calendar-nav-next",icon:this.isRtl?"chevron-left":"chevron-right",svgIcon:this.isRtl?x.chevronLeftIcon:x.chevronRightIcon,fillMode:"flat",title:M,disabled:y,onClick:this.handleNextButtonClick,...t}))}),p.createElement(E.HorizontalViewList,{ref:f=>{this.calendarViewList=f},dates:this.dates,activeView:i,focusedDate:this.focusedDate,weekDaysFormat:this.props.weekDaysFormat,min:this.min,max:this.max,bus:this.bus,service:this.service,selectionRange:w,value:this.selectedMultiple||this.selectedDate,cellUID:this.cellUID,views:this.props.views,onChange:this.handleDateChange,onWeekSelect:this.handleWeekSelection,showWeekNumbers:this.props.weekNumber,onCellEnter:this.handleCellEnter,cell:this.props.cell,weekCell:this.props.weekCell,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode,showOtherMonthDays:this.props.showOtherMonthDays,allowReverse:this.props.allowReverse}),this.showLicenseWatermark&&p.createElement(g.WatermarkOverlay,{message:this.licenseMessage}))}isInMonth(i,a){return!!a&&o.firstDayOfMonth(a)<=i&&i<=o.lastDayOfMonth(a)}};v.displayName="MultiViewCalendar",v.propTypes={activeRangeEnd:s.oneOf(["start","end"]),allowReverse:s.bool,bottomView:s.oneOf(["month","year","decade","century"]),className:s.string,defaultActiveView:s.oneOf(["month","year","decade","century"]),defaultValue:s.oneOfType([r.nullable(s.instanceOf(Date)),s.arrayOf(s.instanceOf(Date)),s.shape({start:r.nullable(s.instanceOf(Date)),end:r.nullable(s.instanceOf(Date))})]),disabled:s.bool,focusedDate:s.instanceOf(Date),id:s.string,weekDaysFormat:s.oneOf(["narrow","short","abbreviated"]),ariaLabelledBy:s.string,ariaDescribedBy:s.string,max:s.instanceOf(Date),min:s.instanceOf(Date),mode:s.oneOf(["single","multiple","range"]),onBlur:s.func,onChange:s.func,onFocus:s.func,tabIndex:s.number,topView:s.oneOf(["month","year","decade","century"]),value:s.oneOfType([r.nullable(s.instanceOf(Date)),s.arrayOf(s.instanceOf(Date)),s.shape({start:r.nullable(s.instanceOf(Date).isRequired),end:r.nullable(s.instanceOf(Date).isRequired)})]),views:(i,a,d)=>{const w=i[a];return w!==void 0&&w<1?new Error(`Invalid prop '${a}' supplied to'${d}'. The '${a}' property cannot be less than 1'`):null},weekNumber:s.bool,showOtherMonthDays:s.bool,dir:s.string},v.defaultProps={disabled:!1,min:r.MIN_DATE,max:r.MAX_DATE,navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",weekDaysFormat:"short",tabIndex:0,bottomView:"month",views:2,allowReverse:!1,showOtherMonthDays:!1};let m=v;const q=g.createPropsContext(),_=g.withIdHOC(g.withPropsContext(q,m));_.displayName="KendoReactMultiViewCalendar";F.registerForIntl(m);F.registerForLocalization(m);exports.MultiViewCalendar=_;exports.MultiViewCalendarPropsContext=q;exports.MultiViewCalendarWithoutContext=m;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("react"),s=require("prop-types"),F=require("@progress/kendo-react-intl"),g=require("@progress/kendo-react-common"),o=require("@progress/kendo-date-math"),S=require("@progress/kendo-react-buttons"),x=require("@progress/kendo-svg-icons"),I=require("../models/NavigationAction.js"),O=require("../models/CalendarViewEnum.js"),B=require("../models/SelectionRange.js"),z=require("./Header.js"),r=require("../../utils.js"),V=require("../../messages/index.js"),H=require("../services/BusViewService.js"),Y=require("../services/NavigationService.js"),E=require("./HorizontalViewList.js"),W=require("./TodayCommand.js"),T=require("../../package-metadata.js");function j(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const a in c)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(c,a);Object.defineProperty(i,a,d.get?d:{enumerable:!0,get:()=>c[a]})}}return i.default=c,Object.freeze(i)}const p=j(K),A=(c=m.defaultProps.min,i=m.defaultProps.max,a)=>a instanceof Date&&!Array.isArray(a)&&r.isInRange(o.getDate(a),c,i)?o.getDate(a):null,L=(c=m.defaultProps.min,i=m.defaultProps.max,a)=>Array.isArray(a)?a.filter(d=>r.isInRange(d,c,i)).map(d=>o.getDate(d)):null,P=c=>typeof c=="object"&&!(c instanceof Date)&&c!==null&&!Array.isArray(c)?c:B.EMPTY_SELECTIONRANGE,N=(c,i,a)=>c||i&&i[0]||a&&a.start,U=(c,i)=>c.start===null&&i===null?"start":c.end===null?"end":"start",v=class v extends p.Component{constructor(i){super(i),this.dates=[],this.selectedDate=null,this.selectedMultiple=null,this.selectedRange=B.EMPTY_SELECTIONRANGE,this._focusedDate=new Date,this.cellUID=this.props.id+"-cell-uid",this.activeRangeEnd="start",this._element=null,this.intl=null,this.localization=null,this.service=null,this.calendarViewList=null,this.isActive=!1,this.calculateFocusFromValue=!0,this.showLicenseWatermark=!1,this.focus=()=>{this._element&&this._element.focus()},this.clampRange=e=>({start:e,end:null}),this.rangeWithFocused=(e,t)=>({start:e.start,end:e.end===null&&e.start!==null&&this.isActive?t:e.end}),this.generateRange=(e,t)=>{const{end:h,start:l}=t,u=t.start!==null&&e.getTime()<=t.start.getTime();return!this.props.allowReverse&&u?{start:e,end:this.selectedRange.start}:this.activeRange!=="end"?{start:e,end:h}:{start:l||this.selectedDate,end:e}},this.canNavigate=e=>{if(!this.service)return!1;const t=this.service.move(this.focusedDate,e);return this.min<=t&&t<=this.max||this.service.isInSameView(t,this.min)||this.service.isInSameView(t,this.max)},this.navigate=(e,t)=>{this.calculateFocusFromValue=!1;const h=this.move(e,t);this.setState({navigateDate:h,focusedDate:h})},this.move=(e,t)=>this.clampDate(this.service.move(t,e)),this.clampDate=e=>r.dateInRange(e,this.min,this.max),this.shouldAutoCorrect=(e,t)=>{const{end:h,start:l}=t;return this.activeRange!=="end"?h!==null&&e>h:l!==null&&e<l},this.handleCellEnter=e=>{this.props.mode==="range"&&(this.calculateFocusFromValue=!1,this.setState({focusedDate:e}))},this.handleMouseDown=e=>{e.preventDefault()},this.handleClick=e=>{this._element&&this._element.focus({preventScroll:!0})},this.handleFocus=e=>{if(this.isActive=!0,!this.calendarViewList)return;this.calendarViewList.focusActiveDate();const{onFocus:t}=this.props;t&&t.call(void 0,e)},this.handleBlur=e=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:t}=this.props;t&&t.call(void 0,e)},this.handleTodayClick=e=>{this.todayIsInRange&&this.handleDateChange(e)},this.handlePrevButtonClick=()=>{const e=I.Action.PrevView;if(this.state.activeView>0&&this.focusedDate.getFullYear()>this.dates[0].getFullYear())this.navigate(e,this.move(e,this.focusedDate));else{const t=this.isInMonth(this.focusedDate,this.dates[1])?this.move(e,this.focusedDate):this.focusedDate;this.navigate(e,t)}},this.handleNextButtonClick=()=>{this.navigate(I.Action.NextView,this.focusedDate)},this.handleKeyDown=e=>{const{keyCode:h,ctrlKey:l,metaKey:u}=e;if(h===84){const n=r.getToday();this.calculateFocusFromValue=!1,this.setState({focusedDate:n,navigateDate:n})}if((l||u)&&(h===g.Keys.left&&this.handlePrevButtonClick(),h===g.Keys.right&&this.handleNextButtonClick()),h===g.Keys.enter){const n={syntheticEvent:e,nativeEvent:e.nativeEvent,value:this.focusedDate,target:this};this.handleDateChange(n)}else{const n=r.dateInRange(this.navigation.move(this.focusedDate,this.navigation.action(e),this.state.activeView,this.service,e),this.min,this.max);if(o.isEqualDate(this.focusedDate,n))return;this.dates&&this.service&&!this.service.isInArray(n,this.dates)&&this.setState({navigateDate:n}),this.calculateFocusFromValue=!1,this.setState({focusedDate:n})}e.preventDefault()},this.handleViewChange=({view:e})=>{this.calculateFocusFromValue=!1,this.setState(t=>({activeView:e,navigateDate:t.focusedDate}))},this.handleWeekSelection=(e,t,h)=>{if(this.props.mode==="single")return;const l=0,u=6,n=t===l?e:o.addDays(e,-t),f=t===u?e:o.addDays(e,u-t);let D=null;if(this.props.mode==="multiple"){D=[];for(let R=l;R<=u;R++)D.push(o.addDays(n,R));this.setState({value:D,focusedDate:e})}this.props.mode==="range"&&(D={start:n,end:f},this.setState({value:D,focusedDate:e}));const{onChange:k}=this.props;if(k){const R={syntheticEvent:h,nativeEvent:h.nativeEvent,value:D,target:this};k.call(void 0,R)}},this.handleDateChange=e=>{const t=o.cloneDate(e.value),h=this.bus.canMoveDown(this.state.activeView);if(this.props.disabled)return;if(h)if(e.isTodayClick)this.bus.moveToBottom(this.state.activeView);else{this.bus.moveDown(this.state.activeView,e.syntheticEvent),this.setState({focusedDate:t,navigateDate:t});return}this.calculateFocusFromValue=!0;let l;switch(this.props.mode){case"single":l=o.cloneDate(e.value);break;case"multiple":if(Array.isArray(this.selectedMultiple)){const n=this.selectedMultiple.slice();let f=-1;n.forEach((D,k)=>{o.isEqualDate(D,e.value)&&(f=k)}),f!==-1?n.splice(f,1):n.push(o.cloneDate(e.value)),l=n.slice()}else this.selectedDate?l=[o.cloneDate(this.selectedDate),o.cloneDate(e.value)]:l=[o.cloneDate(e.value)];break;case"range":{l=this.selectedRange.start!==null&&this.selectedRange.end!==null&&this.activeRange==="start"?this.clampRange(e.value):this.generateRange(e.value,this.selectedRange),this.activeRangeEnd=this.activeRange!=="end"?"end":"start";break}default:l=o.cloneDate(e.value);break}this.valueDuringOnChange=l,e.isTodayClick&&this.setState({navigateDate:t}),this.setState({value:l,focusedDate:t}),this.valueDuringOnChange=l;const{onChange:u}=this.props;if(u){const n={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:l,target:this};u.call(void 0,n)}this.valueDuringOnChange=void 0},this.showLicenseWatermark=!g.validatePackage(T.packageMetadata,{component:"MultiViewCalendar"}),this.licenseMessage=g.getLicenseMessage(T.packageMetadata);const a=i.value!==void 0?i.value:i.defaultValue||v.defaultProps.defaultValue,d=A(this.min,this.max,a),w=L(this.min,this.max,a),C=P(a),M=N(d,w,C),b=r.viewInRange(O.CalendarViewEnum[i.defaultActiveView],this.bottomView,this.topView),y=r.dateInRange(i.focusedDate||M||r.getToday(),this.min,this.max);this.state={value:a,activeView:b,focusedDate:y,navigateDate:y},this.activeRangeEnd=U(C,d),this.bus=new H.BusViewService(this.handleViewChange),this.navigation=new Y.NavigationService(this.bus),this.calculateFocusFromValue=!1,this.lastView=b,this.lastViewsCount=this.props.views||E.HorizontalViewList.defaultProps.views}get wrapperID(){return this.props.id+"-wrapper-id"}get isRtl(){return this.props.dir==="rtl"}get element(){return this._element}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value}get focusedDate(){return o.cloneDate(this._focusedDate)}get min(){return o.getDate(this.props.min!==void 0?this.props.min:v.defaultProps.min)}get max(){return o.getDate(this.props.max!==void 0?this.props.max:v.defaultProps.max)}get bottomView(){return O.CalendarViewEnum[this.props.bottomView!==void 0?this.props.bottomView:v.defaultProps.bottomView]}get topView(){return O.CalendarViewEnum[this.props.topView!==void 0?this.props.topView:v.defaultProps.topView]}get activeRange(){return this.props.activeRangeEnd!==void 0?this.props.activeRangeEnd:this.activeRangeEnd}get todayIsInRange(){return r.isInRange(r.getToday(),o.getDate(this.min),o.getDate(this.max))}componentDidMount(){this.calculateFocusFromValue=!0}componentDidUpdate(){this.calendarViewList&&(this.isActive?this.calendarViewList.focusActiveDate:this.calendarViewList.blurActiveDate)();const i=A(this.min,this.max,this.value);this.calculateFocusFromValue=!!(this.selectedDate&&i&&this.selectedDate.getTime()&&i.getTime()),this.lastView=this.state.activeView,this.lastViewsCount=this.props.views||E.HorizontalViewList.defaultProps.views}render(){this.props._ref&&this.props._ref(this),this.intl=F.provideIntlService(this),this.localization=F.provideLocalizationService(this),this.bus.configure(this.bottomView,this.topView);const i=r.viewInRange(this.state.activeView,this.bottomView,this.topView);this.service=this.bus.service(i,this.intl),this.selectedDate=A(this.min,this.max,this.value),this.selectedMultiple=L(this.min,this.max,this.value),this.selectedRange=P(this.value);const a=N(this.selectedDate,this.selectedMultiple,this.selectedRange);this._focusedDate=r.dateInRange(this.calculateFocusFromValue&&a!==null?a:this.state.focusedDate,this.min,this.max);const d=g.classNames("k-calendar k-calendar-range",{"k-disabled":this.props.disabled},this.props.className),w=this.rangeWithFocused(this.selectedRange,this.focusedDate),C=this.localization.toLanguageString(V.prevView,V.messages[V.prevView]),M=this.localization.toLanguageString(V.nextView,V.messages[V.nextView]),b=!this.canNavigate(I.Action.PrevView),y=!this.canNavigate(I.Action.NextView),e={"aria-disabled":b},t={"aria-disabled":y},h=this.lastView!==i,l=this.dates&&this.isInMonth(this.state.navigateDate,this.dates[0]),u=this.lastViewsCount!==this.props.views;(!l||h||u)&&(this.dates=this.service.datesList(this.state.navigateDate,this.props.views||E.HorizontalViewList.defaultProps.views));const n=o.cloneDate(this.dates&&this.dates[0]?this.dates[0]:r.getToday());return p.createElement("div",{ref:f=>{this._element=f},className:d,id:this.props.id||this.wrapperID,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.disabled?void 0:this.props.tabIndex,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseDown:this.handleMouseDown,onClick:this.handleClick,onKeyDown:this.handleKeyDown,"aria-disabled":this.props.disabled,dir:this.props.dir},p.createElement(z.Header,{key:`.kendo.calendar.header.${n.getTime()}`,activeView:i,currentDate:n,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:p.createElement(p.Fragment,null,p.createElement(S.Button,{type:"button",className:"k-calendar-nav-prev",icon:this.isRtl?"chevron-right":"chevron-left",svgIcon:this.isRtl?x.chevronRightIcon:x.chevronLeftIcon,fillMode:"flat",title:C,disabled:b,onClick:this.handlePrevButtonClick,...e}),p.createElement(W.TodayCommand,{min:this.min,max:this.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange}),p.createElement(S.Button,{type:"button",className:"k-calendar-nav-next",icon:this.isRtl?"chevron-left":"chevron-right",svgIcon:this.isRtl?x.chevronLeftIcon:x.chevronRightIcon,fillMode:"flat",title:M,disabled:y,onClick:this.handleNextButtonClick,...t}))}),p.createElement(E.HorizontalViewList,{ref:f=>{this.calendarViewList=f},dates:this.dates,activeView:i,focusedDate:this.focusedDate,weekDaysFormat:this.props.weekDaysFormat,min:this.min,max:this.max,bus:this.bus,service:this.service,selectionRange:w,value:this.selectedMultiple||this.selectedDate,cellUID:this.cellUID,views:this.props.views,onChange:this.handleDateChange,onWeekSelect:this.handleWeekSelection,showWeekNumbers:this.props.weekNumber,onCellEnter:this.handleCellEnter,cell:this.props.cell,weekCell:this.props.weekCell,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode,showOtherMonthDays:this.props.showOtherMonthDays,allowReverse:this.props.allowReverse}),this.showLicenseWatermark&&p.createElement(g.WatermarkOverlay,{message:this.licenseMessage}))}isInMonth(i,a){return!!a&&o.firstDayOfMonth(a)<=i&&i<=o.lastDayOfMonth(a)}};v.displayName="MultiViewCalendar",v.propTypes={activeRangeEnd:s.oneOf(["start","end"]),allowReverse:s.bool,bottomView:s.oneOf(["month","year","decade","century"]),className:s.string,defaultActiveView:s.oneOf(["month","year","decade","century"]),defaultValue:s.oneOfType([r.nullable(s.instanceOf(Date)),s.arrayOf(s.instanceOf(Date)),s.shape({start:r.nullable(s.instanceOf(Date)),end:r.nullable(s.instanceOf(Date))})]),disabled:s.bool,focusedDate:s.instanceOf(Date),id:s.string,weekDaysFormat:s.oneOf(["narrow","short","abbreviated"]),ariaLabelledBy:s.string,ariaDescribedBy:s.string,max:s.instanceOf(Date),min:s.instanceOf(Date),mode:s.oneOf(["single","multiple","range"]),onBlur:s.func,onChange:s.func,onFocus:s.func,tabIndex:s.number,topView:s.oneOf(["month","year","decade","century"]),value:s.oneOfType([r.nullable(s.instanceOf(Date)),s.arrayOf(s.instanceOf(Date)),s.shape({start:r.nullable(s.instanceOf(Date).isRequired),end:r.nullable(s.instanceOf(Date).isRequired)})]),views:(i,a,d)=>{const w=i[a];return w!==void 0&&w<1?new Error(`Invalid prop '${a}' supplied to'${d}'. The '${a}' property cannot be less than 1'`):null},weekNumber:s.bool,showOtherMonthDays:s.bool,dir:s.string},v.defaultProps={disabled:!1,min:r.MIN_DATE,max:r.MAX_DATE,navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",weekDaysFormat:"short",tabIndex:0,bottomView:"month",views:2,allowReverse:!1,showOtherMonthDays:!1};let m=v;const q=g.createPropsContext(),_=g.withIdHOC(g.withPropsContext(q,m));_.displayName="KendoReactMultiViewCalendar";F.registerForIntl(m);F.registerForLocalization(m);exports.MultiViewCalendar=_;exports.MultiViewCalendarPropsContext=q;exports.MultiViewCalendarWithoutContext=m;
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
import * as d from "react";
|
|
9
9
|
import s from "prop-types";
|
|
10
10
|
import { provideIntlService as G, provideLocalizationService as X, registerForIntl as q, registerForLocalization as J } from "@progress/kendo-react-intl";
|
|
11
|
-
import {
|
|
11
|
+
import { withIdHOC as Q, createPropsContext as Z, Keys as O, validatePackage as ee, getLicenseMessage as te, classNames as se, WatermarkOverlay as ie, withPropsContext as ae } from "@progress/kendo-react-common";
|
|
12
12
|
import { isEqualDate as P, addDays as M, cloneDate as m, getDate as g, firstDayOfMonth as ne, lastDayOfMonth as oe } from "@progress/kendo-date-math";
|
|
13
13
|
import { Button as L } from "@progress/kendo-react-buttons";
|
|
14
14
|
import { chevronRightIcon as N, chevronLeftIcon as B } from "@progress/kendo-svg-icons";
|
|
15
|
-
import { Action as
|
|
15
|
+
import { Action as x } from "../models/NavigationAction.mjs";
|
|
16
16
|
import { CalendarViewEnum as A } from "../models/CalendarViewEnum.mjs";
|
|
17
17
|
import { EMPTY_SELECTIONRANGE as j } from "../models/SelectionRange.mjs";
|
|
18
18
|
import { Header as re } from "./Header.mjs";
|
|
19
|
-
import { dateInRange as
|
|
19
|
+
import { dateInRange as k, getToday as F, viewInRange as _, nullable as D, MAX_DATE as le, MIN_DATE as he, isInRange as T } from "../../utils.mjs";
|
|
20
20
|
import { prevView as K, messages as Y, nextView as W } from "../../messages/index.mjs";
|
|
21
21
|
import { BusViewService as ce } from "../services/BusViewService.mjs";
|
|
22
22
|
import { NavigationService as de } from "../services/NavigationService.mjs";
|
|
@@ -42,7 +42,7 @@ const S = (l = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
42
42
|
this.calculateFocusFromValue = !1;
|
|
43
43
|
const r = this.move(e, t);
|
|
44
44
|
this.setState({ navigateDate: r, focusedDate: r });
|
|
45
|
-
}, this.move = (e, t) => this.clampDate(this.service.move(t, e)), this.clampDate = (e) =>
|
|
45
|
+
}, this.move = (e, t) => this.clampDate(this.service.move(t, e)), this.clampDate = (e) => k(e, this.min, this.max), this.shouldAutoCorrect = (e, t) => {
|
|
46
46
|
const { end: r, start: o } = t;
|
|
47
47
|
return this.activeRange !== "end" ? r !== null && e > r : o !== null && e < o;
|
|
48
48
|
}, this.handleCellEnter = (e) => {
|
|
@@ -68,7 +68,7 @@ const S = (l = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
68
68
|
}, this.handleTodayClick = (e) => {
|
|
69
69
|
this.todayIsInRange && this.handleDateChange(e);
|
|
70
70
|
}, this.handlePrevButtonClick = () => {
|
|
71
|
-
const e =
|
|
71
|
+
const e = x.PrevView;
|
|
72
72
|
if (this.state.activeView > 0 && this.focusedDate.getFullYear() > this.dates[0].getFullYear())
|
|
73
73
|
this.navigate(e, this.move(e, this.focusedDate));
|
|
74
74
|
else {
|
|
@@ -76,7 +76,7 @@ const S = (l = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
76
76
|
this.navigate(e, t);
|
|
77
77
|
}
|
|
78
78
|
}, this.handleNextButtonClick = () => {
|
|
79
|
-
this.navigate(
|
|
79
|
+
this.navigate(x.NextView, this.focusedDate);
|
|
80
80
|
}, this.handleKeyDown = (e) => {
|
|
81
81
|
const { keyCode: r, ctrlKey: o, metaKey: h } = e;
|
|
82
82
|
if (r === 84) {
|
|
@@ -92,7 +92,7 @@ const S = (l = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
92
92
|
};
|
|
93
93
|
this.handleDateChange(n);
|
|
94
94
|
} else {
|
|
95
|
-
const n =
|
|
95
|
+
const n = k(
|
|
96
96
|
this.navigation.move(
|
|
97
97
|
this.focusedDate,
|
|
98
98
|
this.navigation.action(e),
|
|
@@ -179,12 +179,12 @@ const S = (l = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
179
179
|
h.call(void 0, n);
|
|
180
180
|
}
|
|
181
181
|
this.valueDuringOnChange = void 0;
|
|
182
|
-
}, this.showLicenseWatermark = !
|
|
182
|
+
}, this.showLicenseWatermark = !ee(z, { component: "MultiViewCalendar" }), this.licenseMessage = te(z);
|
|
183
183
|
const a = i.value !== void 0 ? i.value : i.defaultValue || u.defaultProps.defaultValue, c = S(this.min, this.max, a), w = U(this.min, this.max, a), R = $(a), I = H(c, w, R), V = _(
|
|
184
184
|
A[i.defaultActiveView],
|
|
185
185
|
this.bottomView,
|
|
186
186
|
this.topView
|
|
187
|
-
), b =
|
|
187
|
+
), b = k(i.focusedDate || I || F(), this.min, this.max);
|
|
188
188
|
this.state = {
|
|
189
189
|
value: a,
|
|
190
190
|
activeView: V,
|
|
@@ -260,18 +260,18 @@ const S = (l = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
260
260
|
const i = _(this.state.activeView, this.bottomView, this.topView);
|
|
261
261
|
this.service = this.bus.service(i, this.intl), this.selectedDate = S(this.min, this.max, this.value), this.selectedMultiple = U(this.min, this.max, this.value), this.selectedRange = $(this.value);
|
|
262
262
|
const a = H(this.selectedDate, this.selectedMultiple, this.selectedRange);
|
|
263
|
-
this._focusedDate =
|
|
263
|
+
this._focusedDate = k(
|
|
264
264
|
this.calculateFocusFromValue && a !== null ? a : this.state.focusedDate,
|
|
265
265
|
this.min,
|
|
266
266
|
this.max
|
|
267
267
|
);
|
|
268
|
-
const c =
|
|
269
|
-
"k-calendar k-calendar-range
|
|
268
|
+
const c = se(
|
|
269
|
+
"k-calendar k-calendar-range",
|
|
270
270
|
{
|
|
271
271
|
"k-disabled": this.props.disabled
|
|
272
272
|
},
|
|
273
273
|
this.props.className
|
|
274
|
-
), w = this.rangeWithFocused(this.selectedRange, this.focusedDate), R = this.localization.toLanguageString(K, Y[K]), I = this.localization.toLanguageString(W, Y[W]), V = !this.canNavigate(
|
|
274
|
+
), w = this.rangeWithFocused(this.selectedRange, this.focusedDate), R = this.localization.toLanguageString(K, Y[K]), I = this.localization.toLanguageString(W, Y[W]), V = !this.canNavigate(x.PrevView), b = !this.canNavigate(x.NextView), e = { "aria-disabled": V }, t = { "aria-disabled": b }, r = this.lastView !== i, o = this.dates && this.isInMonth(this.state.navigateDate, this.dates[0]), h = this.lastViewsCount !== this.props.views;
|
|
275
275
|
(!o || r || h) && (this.dates = this.service.datesList(
|
|
276
276
|
this.state.navigateDate,
|
|
277
277
|
this.props.views || E.defaultProps.views
|
|
@@ -376,7 +376,7 @@ const S = (l = v.defaultProps.min, i = v.defaultProps.max, a) => a instanceof Da
|
|
|
376
376
|
allowReverse: this.props.allowReverse
|
|
377
377
|
}
|
|
378
378
|
),
|
|
379
|
-
this.showLicenseWatermark && /* @__PURE__ */ d.createElement(
|
|
379
|
+
this.showLicenseWatermark && /* @__PURE__ */ d.createElement(ie, { message: this.licenseMessage })
|
|
380
380
|
);
|
|
381
381
|
}
|
|
382
382
|
// protected isListInRange = (list: Date[]): boolean => {
|
|
@@ -434,8 +434,8 @@ u.displayName = "MultiViewCalendar", u.propTypes = {
|
|
|
434
434
|
dir: s.string
|
|
435
435
|
}, u.defaultProps = {
|
|
436
436
|
disabled: !1,
|
|
437
|
-
min:
|
|
438
|
-
max:
|
|
437
|
+
min: he,
|
|
438
|
+
max: le,
|
|
439
439
|
navigation: !0,
|
|
440
440
|
defaultActiveView: "month",
|
|
441
441
|
defaultValue: null,
|
|
@@ -448,7 +448,7 @@ u.displayName = "MultiViewCalendar", u.propTypes = {
|
|
|
448
448
|
showOtherMonthDays: !1
|
|
449
449
|
};
|
|
450
450
|
let v = u;
|
|
451
|
-
const me =
|
|
451
|
+
const me = Z(), ve = Q(
|
|
452
452
|
ae(
|
|
453
453
|
me,
|
|
454
454
|
v
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { default as PropTypes } from 'prop-types';
|
|
9
|
+
import { CalendarNavigationItemProps } from './CalendarNavigationItem.js';
|
|
10
|
+
import { DOMService } from '../services/index.js';
|
|
11
|
+
import { Virtualization } from '../../virtualization/Virtualization.js';
|
|
12
|
+
import { CalendarViewEnum, ViewService } from '../models/index.js';
|
|
13
|
+
import { DateInputsClassStructure } from '@progress/kendo-react-common';
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
export interface NavigationEventArguments {
|
|
19
|
+
syntheticEvent: React.SyntheticEvent<any>;
|
|
20
|
+
nativeEvent?: any;
|
|
21
|
+
value: Date;
|
|
22
|
+
target: Navigation;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
export interface NavigationProps {
|
|
28
|
+
activeView: CalendarViewEnum;
|
|
29
|
+
dom: DOMService;
|
|
30
|
+
focusedDate: Date;
|
|
31
|
+
max: Date;
|
|
32
|
+
min: Date;
|
|
33
|
+
onScroll?: (event: React.SyntheticEvent) => void;
|
|
34
|
+
onChange?: (event: NavigationEventArguments) => void;
|
|
35
|
+
service: ViewService;
|
|
36
|
+
take?: number;
|
|
37
|
+
navigationItem?: React.ComponentType<CalendarNavigationItemProps>;
|
|
38
|
+
tabIndex?: number;
|
|
39
|
+
unstyled?: DateInputsClassStructure;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @hidden
|
|
43
|
+
*/
|
|
44
|
+
export interface NavigationState {
|
|
45
|
+
skip: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @hidden
|
|
49
|
+
*/
|
|
50
|
+
export declare class Navigation extends React.Component<NavigationProps, NavigationState> {
|
|
51
|
+
static propTypes: {
|
|
52
|
+
activeView: PropTypes.Validator<number>;
|
|
53
|
+
focusedDate: PropTypes.Validator<Date>;
|
|
54
|
+
max: PropTypes.Validator<Date>;
|
|
55
|
+
min: PropTypes.Validator<Date>;
|
|
56
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
57
|
+
take: PropTypes.Requireable<number>;
|
|
58
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
59
|
+
};
|
|
60
|
+
static defaultProps: {
|
|
61
|
+
take: number;
|
|
62
|
+
};
|
|
63
|
+
virtualization: Virtualization | null;
|
|
64
|
+
private list;
|
|
65
|
+
private itemHeight;
|
|
66
|
+
private topOffset;
|
|
67
|
+
private maxViewHeight;
|
|
68
|
+
private bottomOffset;
|
|
69
|
+
private lastView;
|
|
70
|
+
private indexToScroll?;
|
|
71
|
+
private lastFocus;
|
|
72
|
+
protected get take(): number;
|
|
73
|
+
constructor(props: NavigationProps);
|
|
74
|
+
/**
|
|
75
|
+
* @hidden
|
|
76
|
+
*/
|
|
77
|
+
componentDidUpdate(_prevProps: NavigationProps, _prevState: NavigationState): void;
|
|
78
|
+
render(): React.JSX.Element;
|
|
79
|
+
protected handleVirtualizationMount: (virtualization: Virtualization) => void;
|
|
80
|
+
protected buildNavigationItem: (date: Date) => React.ReactNode;
|
|
81
|
+
protected calculateHeights: () => void;
|
|
82
|
+
protected getTake(skip: number, total: number): number;
|
|
83
|
+
private handleDateChange;
|
|
84
|
+
private handleScrollAction;
|
|
85
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { default as PropTypes } from 'prop-types';
|
|
9
|
+
import { DateInputsClassStructure } from '@progress/kendo-react-common';
|
|
10
|
+
import { HeaderEventArguments } from './Header.js';
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
export interface TodayCommandProps {
|
|
16
|
+
min: Date;
|
|
17
|
+
max: Date;
|
|
18
|
+
onClick?: (event: HeaderEventArguments) => void;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
tabIndex?: number;
|
|
21
|
+
unstyled?: DateInputsClassStructure;
|
|
22
|
+
}
|
|
23
|
+
export declare class TodayCommand extends React.Component<TodayCommandProps> {
|
|
24
|
+
/**
|
|
25
|
+
* The prop types for the TodayCommand component.
|
|
26
|
+
*/
|
|
27
|
+
static propTypes: {
|
|
28
|
+
max: PropTypes.Validator<Date>;
|
|
29
|
+
min: PropTypes.Validator<Date>;
|
|
30
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
31
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The default props for the TodayCommand component.
|
|
35
|
+
*/
|
|
36
|
+
static defaultProps: {
|
|
37
|
+
min: Date;
|
|
38
|
+
max: Date;
|
|
39
|
+
};
|
|
40
|
+
protected get min(): Date;
|
|
41
|
+
protected get max(): Date;
|
|
42
|
+
private localization;
|
|
43
|
+
protected get todayIsInRange(): boolean;
|
|
44
|
+
private handleClick;
|
|
45
|
+
render(): React.JSX.Element;
|
|
46
|
+
}
|
|
@@ -12,7 +12,7 @@ import { classNames as f, uCalendar as g } from "@progress/kendo-react-common";
|
|
|
12
12
|
import { Button as x } from "@progress/kendo-react-buttons";
|
|
13
13
|
import { getDate as n } from "@progress/kendo-date-math";
|
|
14
14
|
import { today as l, messages as v } from "../../messages/index.mjs";
|
|
15
|
-
import { dateInRange as C, getToday as m,
|
|
15
|
+
import { dateInRange as C, getToday as m, MAX_DATE as k, MIN_DATE as I, isInRange as y } from "../../utils.mjs";
|
|
16
16
|
const t = class t extends r.Component {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments), this.localization = null, this.handleClick = (i) => {
|
|
@@ -61,8 +61,8 @@ t.propTypes = {
|
|
|
61
61
|
onClick: e.func,
|
|
62
62
|
disabled: e.bool
|
|
63
63
|
}, t.defaultProps = {
|
|
64
|
-
min:
|
|
65
|
-
max:
|
|
64
|
+
min: I,
|
|
65
|
+
max: k
|
|
66
66
|
};
|
|
67
67
|
let a = t;
|
|
68
68
|
u(a);
|