@progress/kendo-react-dateinputs 7.2.4-develop.3 → 7.3.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calendar/components/Calendar.js +12 -0
- package/calendar/components/Calendar.mjs +328 -0
- package/calendar/components/CalendarCell.js +8 -0
- package/calendar/components/CalendarCell.mjs +101 -0
- package/calendar/components/CalendarHeaderTitle.js +8 -0
- package/calendar/components/CalendarHeaderTitle.mjs +23 -0
- package/calendar/components/CalendarNavigationItem.js +8 -0
- package/calendar/components/CalendarNavigationItem.mjs +29 -0
- package/calendar/components/CalendarWeekCell.js +8 -0
- package/calendar/components/CalendarWeekCell.mjs +23 -0
- package/calendar/components/Header.js +8 -0
- package/calendar/components/Header.mjs +78 -0
- package/calendar/components/HorizontalViewList.js +8 -0
- package/calendar/components/HorizontalViewList.mjs +120 -0
- package/calendar/components/MultiViewCalendar.js +8 -0
- package/calendar/components/MultiViewCalendar.mjs +428 -0
- package/calendar/components/Navigation.js +8 -0
- package/calendar/components/Navigation.mjs +117 -0
- package/calendar/components/TodayCommand.js +8 -0
- package/calendar/components/TodayCommand.mjs +74 -0
- package/calendar/components/View.js +8 -0
- package/calendar/components/View.mjs +153 -0
- package/calendar/components/ViewList.js +8 -0
- package/calendar/components/ViewList.mjs +228 -0
- package/calendar/models/CalendarViewEnum.js +8 -0
- package/calendar/models/CalendarViewEnum.mjs +12 -0
- package/calendar/models/NavigationAction.js +8 -0
- package/calendar/models/NavigationAction.mjs +12 -0
- package/calendar/models/SelectionRange.js +8 -0
- package/calendar/models/SelectionRange.mjs +12 -0
- package/calendar/services/BusViewService.js +8 -0
- package/calendar/services/BusViewService.mjs +58 -0
- package/calendar/services/CenturyViewService.js +8 -0
- package/calendar/services/CenturyViewService.mjs +126 -0
- package/calendar/services/DOMService.js +14 -0
- package/calendar/services/DOMService.mjs +124 -0
- package/calendar/services/DecadeViewService.js +8 -0
- package/calendar/services/DecadeViewService.mjs +126 -0
- package/calendar/services/MonthViewService.js +8 -0
- package/calendar/services/MonthViewService.mjs +139 -0
- package/calendar/services/NavigationService.js +8 -0
- package/calendar/services/NavigationService.mjs +36 -0
- package/calendar/services/ScrollSyncService.js +8 -0
- package/calendar/services/ScrollSyncService.mjs +50 -0
- package/calendar/services/WeekNamesService.js +8 -0
- package/calendar/services/WeekNamesService.mjs +24 -0
- package/calendar/services/YearViewService.js +8 -0
- package/calendar/services/YearViewService.mjs +135 -0
- package/common/AdaptiveMode.js +8 -0
- package/common/AdaptiveMode.mjs +73 -0
- package/common/PickerWrap.js +8 -0
- package/common/PickerWrap.mjs +32 -0
- package/common/constants.js +8 -0
- package/common/constants.mjs +12 -0
- package/dateinput/DateInput.js +8 -0
- package/dateinput/DateInput.mjs +503 -0
- package/dateinput/models/kendo-date.js +8 -0
- package/dateinput/models/kendo-date.mjs +233 -0
- package/dateinput/models/mask.js +8 -0
- package/dateinput/models/mask.mjs +16 -0
- package/dateinput/utils.js +8 -0
- package/dateinput/utils.mjs +38 -0
- package/datepicker/DatePicker.js +8 -0
- package/datepicker/DatePicker.mjs +462 -0
- package/datepicker/ToggleButton.js +8 -0
- package/datepicker/ToggleButton.mjs +13 -0
- package/daterangepicker/DateRangePicker.js +8 -0
- package/daterangepicker/DateRangePicker.mjs +426 -0
- package/datetimepicker/DateTimePicker.js +8 -0
- package/datetimepicker/DateTimePicker.mjs +475 -0
- package/datetimepicker/DateTimeSelector.js +8 -0
- package/datetimepicker/DateTimeSelector.mjs +275 -0
- package/dist/cdn/js/kendo-react-dateinputs.js +8 -21
- package/hooks/usePickerFloatingLabel.js +8 -0
- package/hooks/usePickerFloatingLabel.mjs +31 -0
- package/index.d.mts +4528 -5
- package/index.d.ts +4528 -39
- package/index.js +8 -21
- package/index.mjs +114 -6540
- package/messages/index.js +8 -0
- package/messages/index.mjs +59 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +7 -7
- package/timepicker/TimeList.js +14 -0
- package/timepicker/TimeList.mjs +230 -0
- package/timepicker/TimePart.js +8 -0
- package/timepicker/TimePart.mjs +267 -0
- package/timepicker/TimePicker.js +8 -0
- package/timepicker/TimePicker.mjs +479 -0
- package/timepicker/TimeSelector.js +8 -0
- package/timepicker/TimeSelector.mjs +250 -0
- package/timepicker/models/TimePart.js +8 -0
- package/timepicker/models/TimePart.mjs +18 -0
- package/timepicker/services/DOMService.js +8 -0
- package/timepicker/services/DOMService.mjs +34 -0
- package/timepicker/services/DayPeriodService.js +8 -0
- package/timepicker/services/DayPeriodService.mjs +89 -0
- package/timepicker/services/HoursService.js +8 -0
- package/timepicker/services/HoursService.mjs +92 -0
- package/timepicker/services/MinutesService.js +8 -0
- package/timepicker/services/MinutesService.mjs +91 -0
- package/timepicker/services/SecondsService.js +8 -0
- package/timepicker/services/SecondsService.mjs +91 -0
- package/timepicker/utils.js +8 -0
- package/timepicker/utils.mjs +91 -0
- package/utils.js +8 -0
- package/utils.mjs +111 -0
- package/virtualization/Virtualization.js +8 -0
- package/virtualization/Virtualization.mjs +204 -0
- package/virtualization/services/RowHeightService.js +8 -0
- package/virtualization/services/RowHeightService.mjs +50 -0
- package/virtualization/services/ScrollerService.js +8 -0
- package/virtualization/services/ScrollerService.mjs +52 -0
- package/PopupSettings.d.ts +0 -18
- package/calendar/components/Calendar.d.ts +0 -191
- package/calendar/components/CalendarCell.d.ts +0 -39
- package/calendar/components/CalendarHeaderTitle.d.ts +0 -32
- package/calendar/components/CalendarNavigationItem.d.ts +0 -31
- package/calendar/components/CalendarWeekCell.d.ts +0 -29
- package/calendar/components/Header.d.ts +0 -58
- package/calendar/components/HorizontalViewList.d.ts +0 -71
- package/calendar/components/MultiViewCalendar.d.ts +0 -212
- package/calendar/components/Navigation.d.ts +0 -80
- package/calendar/components/TodayCommand.d.ts +0 -35
- package/calendar/components/View.d.ts +0 -89
- package/calendar/components/ViewList.d.ts +0 -115
- package/calendar/models/ActiveView.d.ts +0 -8
- package/calendar/models/CalendarSettings.d.ts +0 -106
- package/calendar/models/CalendarViewEnum.d.ts +0 -13
- package/calendar/models/CellContext.d.ts +0 -23
- package/calendar/models/MultiViewCalendarMode.d.ts +0 -13
- package/calendar/models/MultiViewCalendarSettings.d.ts +0 -115
- package/calendar/models/NavigationAction.d.ts +0 -19
- package/calendar/models/SelectionRange.d.ts +0 -21
- package/calendar/models/SelectionRangeEnd.d.ts +0 -8
- package/calendar/models/ViewService.d.ts +0 -29
- package/calendar/models/index.d.ts +0 -15
- package/calendar/services/BusViewService.d.ts +0 -25
- package/calendar/services/CenturyViewService.d.ts +0 -29
- package/calendar/services/DOMService.d.ts +0 -33
- package/calendar/services/DecadeViewService.d.ts +0 -31
- package/calendar/services/MonthViewService.d.ts +0 -37
- package/calendar/services/NavigationService.d.ts +0 -18
- package/calendar/services/ScrollSyncService.d.ts +0 -25
- package/calendar/services/WeekNamesService.d.ts +0 -13
- package/calendar/services/YearViewService.d.ts +0 -35
- package/calendar/services/index.d.ts +0 -14
- package/common/AdaptiveMode.d.ts +0 -25
- package/common/PickerWrap.d.ts +0 -22
- package/common/constants.d.ts +0 -8
- package/dateinput/DateInput.d.ts +0 -355
- package/dateinput/models/DateInputSettings.d.ts +0 -103
- package/dateinput/models/format-placeholder.d.ts +0 -43
- package/dateinput/models/incremental-steps.d.ts +0 -15
- package/dateinput/models/index.d.ts +0 -11
- package/dateinput/models/kendo-date.d.ts +0 -57
- package/dateinput/models/mask.d.ts +0 -11
- package/dateinput/models/selection.d.ts +0 -11
- package/dateinput/utils.d.ts +0 -34
- package/datepicker/DatePicker.d.ts +0 -358
- package/datepicker/ToggleButton.d.ts +0 -14
- package/datepicker/models/DatePickerSettings.d.ts +0 -141
- package/datepicker/models/index.d.ts +0 -6
- package/daterangepicker/DateRangePicker.d.ts +0 -354
- package/daterangepicker/models/DateRangePickerCalendarSettings.d.ts +0 -10
- package/daterangepicker/models/DateRangePickerDateInputSettings.d.ts +0 -10
- package/daterangepicker/models/DateRangePickerPopupSettings.d.ts +0 -10
- package/daterangepicker/models/DateRangePickerSettings.d.ts +0 -126
- package/daterangepicker/models/index.d.ts +0 -9
- package/datetimepicker/DateTimePicker.d.ts +0 -342
- package/datetimepicker/DateTimeSelector.d.ts +0 -106
- package/datetimepicker/models/DateTimePickerSettings.d.ts +0 -144
- package/datetimepicker/models/index.d.ts +0 -6
- package/hooks/usePickerFloatingLabel.d.ts +0 -24
- package/messages/index.d.ts +0 -124
- package/package-metadata.d.ts +0 -9
- package/timepicker/TimeList.d.ts +0 -91
- package/timepicker/TimePart.d.ts +0 -141
- package/timepicker/TimePicker.d.ts +0 -355
- package/timepicker/TimeSelector.d.ts +0 -144
- package/timepicker/models/IncrementalSteps.d.ts +0 -12
- package/timepicker/models/ListItem.d.ts +0 -11
- package/timepicker/models/ListService.d.ts +0 -19
- package/timepicker/models/ListServiceSettings.d.ts +0 -16
- package/timepicker/models/TimePart.d.ts +0 -14
- package/timepicker/models/TimePickerSettings.d.ts +0 -133
- package/timepicker/models/index.d.ts +0 -11
- package/timepicker/services/DOMService.d.ts +0 -14
- package/timepicker/services/DayPeriodService.d.ts +0 -51
- package/timepicker/services/HoursService.d.ts +0 -37
- package/timepicker/services/MinutesService.d.ts +0 -36
- package/timepicker/services/SecondsService.d.ts +0 -36
- package/timepicker/services/index.d.ts +0 -10
- package/timepicker/utils.d.ts +0 -60
- package/utils.d.ts +0 -100
- package/virtualization/Virtualization.d.ts +0 -120
- package/virtualization/services/RowHeightService.d.ts +0 -22
- package/virtualization/services/ScrollerService.d.ts +0 -53
- package/virtualization/services/index.d.ts +0 -7
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react"),r=require("prop-types"),m=require("@progress/kendo-date-math"),v=require("./CalendarNavigationItem.js"),f=require("../../utils.js"),k=require("../../virtualization/Virtualization.js");function x(p){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const i in p)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(p,i);Object.defineProperty(a,i,o.get?o:{enumerable:!0,get:()=>p[i]})}}return a.default=p,Object.freeze(a)}const h=x(g),D=30,c=class c extends h.Component{constructor(a){super(a),this.virtualization=null,this.list=null,this.itemHeight=0,this.topOffset=0,this.maxViewHeight=0,this.bottomOffset=0,this.handleVirtualizationMount=t=>{if(this.virtualization=t,this.virtualization&&this.list){this.list.style.transform=`translateY(${this.topOffset}px)`;const e=f.dateInRange(this.props.focusedDate,this.props.min,this.props.max),s=this.props.service.skip(e,this.props.min);this.virtualization.scrollToIndex(s)}},this.buildNavigationItem=t=>{const e=this.props.service.navigationTitle(t),s=this.props.service.isRangeStart(t),n=`kendo-react-calendar-nav-item-${t.getTime()}`,l={text:e,value:t,isRangeStart:s,view:this.props.activeView,onClick:this.handleDateChange};return this.props.navigationItem?h.createElement(this.props.navigationItem,{...l,key:n},e):h.createElement(v.CalendarNavigationItem,{...l,key:n},e)},this.calculateHeights=()=>{const t=this.props.dom.calendarHeight;this.itemHeight=this.props.dom.navigationItemHeight||1,this.maxViewHeight=this.props.dom.monthViewHeight,this.topOffset=(t-this.itemHeight)/2,this.bottomOffset=t-this.itemHeight},this.handleDateChange=(t,e)=>{const{onChange:s}=this.props;if(s&&e){const n={value:m.cloneDate(t),target:this,nativeEvent:e&&e.nativeEvent,syntheticEvent:e};s.call(void 0,n)}},this.handleScrollAction=({scrollAction:t,pageAction:e})=>{const s=e?e.skip:this.state.skip;if(this.state.skip!==s&&this.setState({skip:s}),this.list&&t){const n=`translateY(${t.offset}px)`;this.list.style.transform=n}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate;const i=this.props.service.skip(this.props.focusedDate,this.props.min),o=this.props.service.total(this.props.min,this.props.max);this.state={skip:i-this.getTake(i,o)>0?i:0}}get take(){return this.props.take!==void 0?this.props.take:c.defaultProps.take}componentDidUpdate(a,i){this.indexToScroll!==void 0&&this.virtualization&&this.virtualization.scrollToIndex(this.indexToScroll),this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.indexToScroll=void 0}render(){this.calculateHeights();const a=this.lastView!==this.props.activeView,i=f.dateInRange(this.props.focusedDate,this.props.min,this.props.max),o=a?this.props.service.skip(i,this.props.min):this.state.skip,t=this.props.service.total(this.props.min,this.props.max),e=this.getTake(o,t),s=this.props.service.addToDate(this.props.min,o),n=this.props.service.datesList(s,e);(this.props.activeView!==this.lastView||!m.isEqual(i,this.lastFocus))&&(this.indexToScroll=this.props.service.skip(i,this.props.min));const l=h.createElement(k.Virtualization,{skip:o,take:this.take,total:t,itemHeight:this.itemHeight,topOffset:this.topOffset,bottomOffset:this.bottomOffset,onScroll:this.props.onScroll,maxScrollDifference:this.maxViewHeight,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,tabIndex:this.props.tabIndex},h.createElement("ul",{ref:u=>{this.list=u},className:"k-reset"},n.map(u=>this.buildNavigationItem(u))));return h.createElement("div",{className:"k-calendar-navigation"},h.createElement("span",{className:"k-calendar-navigation-highlight"}),this.props.dom.didCalculate?l:null)}getTake(a,i){return Math.min(i-a,this.take)}};c.propTypes={activeView:r.number.isRequired,focusedDate:r.instanceOf(Date).isRequired,max:r.instanceOf(Date).isRequired,min:r.instanceOf(Date).isRequired,onChange:r.func,take:r.number,tabIndex:r.number},c.defaultProps={take:D};let d=c;exports.Navigation=d;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as a from "react";
|
|
10
|
+
import n from "prop-types";
|
|
11
|
+
import { cloneDate as u, isEqual as f } from "@progress/kendo-date-math";
|
|
12
|
+
import { CalendarNavigationItem as v } from "./CalendarNavigationItem.mjs";
|
|
13
|
+
import { dateInRange as m } from "../../utils.mjs";
|
|
14
|
+
import { Virtualization as g } from "../../virtualization/Virtualization.mjs";
|
|
15
|
+
const k = 30, p = class p extends a.Component {
|
|
16
|
+
constructor(r) {
|
|
17
|
+
super(r), this.virtualization = null, this.list = null, this.itemHeight = 0, this.topOffset = 0, this.maxViewHeight = 0, this.bottomOffset = 0, this.handleVirtualizationMount = (t) => {
|
|
18
|
+
if (this.virtualization = t, this.virtualization && this.list) {
|
|
19
|
+
this.list.style.transform = `translateY(${this.topOffset}px)`;
|
|
20
|
+
const i = m(this.props.focusedDate, this.props.min, this.props.max), s = this.props.service.skip(i, this.props.min);
|
|
21
|
+
this.virtualization.scrollToIndex(s);
|
|
22
|
+
}
|
|
23
|
+
}, this.buildNavigationItem = (t) => {
|
|
24
|
+
const i = this.props.service.navigationTitle(t), s = this.props.service.isRangeStart(t), o = `kendo-react-calendar-nav-item-${t.getTime()}`, l = {
|
|
25
|
+
text: i,
|
|
26
|
+
value: t,
|
|
27
|
+
isRangeStart: s,
|
|
28
|
+
view: this.props.activeView,
|
|
29
|
+
onClick: this.handleDateChange
|
|
30
|
+
};
|
|
31
|
+
return this.props.navigationItem ? /* @__PURE__ */ a.createElement(this.props.navigationItem, { ...l, key: o }, i) : /* @__PURE__ */ a.createElement(v, { ...l, key: o }, i);
|
|
32
|
+
}, this.calculateHeights = () => {
|
|
33
|
+
const t = this.props.dom.calendarHeight;
|
|
34
|
+
this.itemHeight = this.props.dom.navigationItemHeight || 1, this.maxViewHeight = this.props.dom.monthViewHeight, this.topOffset = (t - this.itemHeight) / 2, this.bottomOffset = t - this.itemHeight;
|
|
35
|
+
}, this.handleDateChange = (t, i) => {
|
|
36
|
+
const { onChange: s } = this.props;
|
|
37
|
+
if (s && i) {
|
|
38
|
+
const o = {
|
|
39
|
+
value: u(t),
|
|
40
|
+
target: this,
|
|
41
|
+
nativeEvent: i && i.nativeEvent,
|
|
42
|
+
syntheticEvent: i
|
|
43
|
+
};
|
|
44
|
+
s.call(void 0, o);
|
|
45
|
+
}
|
|
46
|
+
}, this.handleScrollAction = ({ scrollAction: t, pageAction: i }) => {
|
|
47
|
+
const s = i ? i.skip : this.state.skip;
|
|
48
|
+
if (this.state.skip !== s && this.setState({ skip: s }), this.list && t) {
|
|
49
|
+
const o = `translateY(${t.offset}px)`;
|
|
50
|
+
this.list.style.transform = o;
|
|
51
|
+
}
|
|
52
|
+
}, this.lastView = this.props.activeView, this.lastFocus = this.props.focusedDate;
|
|
53
|
+
const e = this.props.service.skip(this.props.focusedDate, this.props.min), h = this.props.service.total(this.props.min, this.props.max);
|
|
54
|
+
this.state = {
|
|
55
|
+
skip: e - this.getTake(e, h) > 0 ? e : 0
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
get take() {
|
|
59
|
+
return this.props.take !== void 0 ? this.props.take : p.defaultProps.take;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @hidden
|
|
63
|
+
*/
|
|
64
|
+
componentDidUpdate(r, e) {
|
|
65
|
+
this.indexToScroll !== void 0 && this.virtualization && this.virtualization.scrollToIndex(this.indexToScroll), this.lastView = this.props.activeView, this.lastFocus = this.props.focusedDate, this.indexToScroll = void 0;
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
this.calculateHeights();
|
|
69
|
+
const r = this.lastView !== this.props.activeView, e = m(this.props.focusedDate, this.props.min, this.props.max), h = r ? this.props.service.skip(e, this.props.min) : this.state.skip, t = this.props.service.total(this.props.min, this.props.max), i = this.getTake(h, t), s = this.props.service.addToDate(this.props.min, h), o = this.props.service.datesList(s, i);
|
|
70
|
+
(this.props.activeView !== this.lastView || !f(e, this.lastFocus)) && (this.indexToScroll = this.props.service.skip(e, this.props.min));
|
|
71
|
+
const l = /* @__PURE__ */ a.createElement(
|
|
72
|
+
g,
|
|
73
|
+
{
|
|
74
|
+
skip: h,
|
|
75
|
+
take: this.take,
|
|
76
|
+
total: t,
|
|
77
|
+
itemHeight: this.itemHeight,
|
|
78
|
+
topOffset: this.topOffset,
|
|
79
|
+
bottomOffset: this.bottomOffset,
|
|
80
|
+
onScroll: this.props.onScroll,
|
|
81
|
+
maxScrollDifference: this.maxViewHeight,
|
|
82
|
+
onScrollAction: this.handleScrollAction,
|
|
83
|
+
onMount: this.handleVirtualizationMount,
|
|
84
|
+
tabIndex: this.props.tabIndex
|
|
85
|
+
},
|
|
86
|
+
/* @__PURE__ */ a.createElement("ul", { ref: (c) => {
|
|
87
|
+
this.list = c;
|
|
88
|
+
}, className: "k-reset" }, o.map((c) => this.buildNavigationItem(c)))
|
|
89
|
+
);
|
|
90
|
+
return /* @__PURE__ */ a.createElement(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: "k-calendar-navigation"
|
|
94
|
+
},
|
|
95
|
+
/* @__PURE__ */ a.createElement("span", { className: "k-calendar-navigation-highlight" }),
|
|
96
|
+
this.props.dom.didCalculate ? l : null
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
getTake(r, e) {
|
|
100
|
+
return Math.min(e - r, this.take);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
p.propTypes = {
|
|
104
|
+
activeView: n.number.isRequired,
|
|
105
|
+
focusedDate: n.instanceOf(Date).isRequired,
|
|
106
|
+
max: n.instanceOf(Date).isRequired,
|
|
107
|
+
min: n.instanceOf(Date).isRequired,
|
|
108
|
+
onChange: n.func,
|
|
109
|
+
take: n.number,
|
|
110
|
+
tabIndex: n.number
|
|
111
|
+
}, p.defaultProps = {
|
|
112
|
+
take: k
|
|
113
|
+
};
|
|
114
|
+
let d = p;
|
|
115
|
+
export {
|
|
116
|
+
d as Navigation
|
|
117
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),a=require("prop-types"),d=require("@progress/kendo-react-intl"),g=require("@progress/kendo-react-common"),m=require("@progress/kendo-react-buttons"),l=require("@progress/kendo-date-math"),r=require("../../messages/index.js"),i=require("../../utils.js");function h(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,c.get?c:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=h(p),n=class n extends u.Component{constructor(){super(...arguments),this.localization=null,this.handleClick=e=>{if(this.todayIsInRange&&this.props.onClick){const t={syntheticEvent:e,nativeEvent:e.nativeEvent,value:i.dateInRange(i.getToday(),this.min,this.max),target:this,isTodayClick:!0};this.props.onClick.call(void 0,t)}}}get min(){return this.props.min!==void 0?this.props.min:n.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:n.defaultProps.max}get todayIsInRange(){return i.isInRange(i.getToday(),l.getDate(this.min),l.getDate(this.max))}render(){this.localization=d.provideLocalizationService(this);const e=this.localization.toLanguageString(r.today,r.messages[r.today]),t=g.classNames("k-calendar-nav-today",{"k-disabled":this.props.disabled});return u.createElement(m.Button,{className:t,onClick:this.handleClick,tabIndex:this.props.tabIndex,fillMode:"flat"},e)}};n.propTypes={max:a.instanceOf(Date).isRequired,min:a.instanceOf(Date).isRequired,onClick:a.func,disabled:a.bool},n.defaultProps={min:i.MIN_DATE,max:i.MAX_DATE};let o=n;d.registerForLocalization(o);exports.TodayCommand=o;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as o from "react";
|
|
10
|
+
import e from "prop-types";
|
|
11
|
+
import { provideLocalizationService as p, registerForLocalization as m } from "@progress/kendo-react-intl";
|
|
12
|
+
import { classNames as c } from "@progress/kendo-react-common";
|
|
13
|
+
import { Button as d } from "@progress/kendo-react-buttons";
|
|
14
|
+
import { getDate as r } from "@progress/kendo-date-math";
|
|
15
|
+
import { today as n, messages as h } from "../../messages/index.mjs";
|
|
16
|
+
import { dateInRange as u, getToday as l, MIN_DATE as f, MAX_DATE as g, isInRange as x } from "../../utils.mjs";
|
|
17
|
+
const t = class t extends o.Component {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments), this.localization = null, this.handleClick = (i) => {
|
|
20
|
+
if (this.todayIsInRange && this.props.onClick) {
|
|
21
|
+
const s = {
|
|
22
|
+
syntheticEvent: i,
|
|
23
|
+
nativeEvent: i.nativeEvent,
|
|
24
|
+
value: u(l(), this.min, this.max),
|
|
25
|
+
target: this,
|
|
26
|
+
isTodayClick: !0
|
|
27
|
+
};
|
|
28
|
+
this.props.onClick.call(void 0, s);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
get min() {
|
|
33
|
+
return this.props.min !== void 0 ? this.props.min : t.defaultProps.min;
|
|
34
|
+
}
|
|
35
|
+
get max() {
|
|
36
|
+
return this.props.max !== void 0 ? this.props.max : t.defaultProps.max;
|
|
37
|
+
}
|
|
38
|
+
get todayIsInRange() {
|
|
39
|
+
return x(l(), r(this.min), r(this.max));
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
this.localization = p(this);
|
|
43
|
+
const i = this.localization.toLanguageString(n, h[n]), s = c(
|
|
44
|
+
"k-calendar-nav-today",
|
|
45
|
+
{
|
|
46
|
+
"k-disabled": this.props.disabled
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
return /* @__PURE__ */ o.createElement(
|
|
50
|
+
d,
|
|
51
|
+
{
|
|
52
|
+
className: s,
|
|
53
|
+
onClick: this.handleClick,
|
|
54
|
+
tabIndex: this.props.tabIndex,
|
|
55
|
+
fillMode: "flat"
|
|
56
|
+
},
|
|
57
|
+
i
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
t.propTypes = {
|
|
62
|
+
max: e.instanceOf(Date).isRequired,
|
|
63
|
+
min: e.instanceOf(Date).isRequired,
|
|
64
|
+
onClick: e.func,
|
|
65
|
+
disabled: e.bool
|
|
66
|
+
}, t.defaultProps = {
|
|
67
|
+
min: f,
|
|
68
|
+
max: g
|
|
69
|
+
};
|
|
70
|
+
let a = t;
|
|
71
|
+
m(a);
|
|
72
|
+
export {
|
|
73
|
+
a as TodayCommand
|
|
74
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react"),i=require("prop-types"),d=require("@progress/kendo-date-math"),D=require("@progress/kendo-react-intl"),w=require("./CalendarCell.js"),g=require("./CalendarWeekCell.js"),k=require("../models/CalendarViewEnum.js"),m=require("../../utils.js"),b=require("../services/WeekNamesService.js");function N(l){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const e in l)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(l,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>l[e]})}}return t.default=l,Object.freeze(t)}const s=N(v),f=l=>s.createElement("td",{key:l,className:"k-calendar-td"}," "),u=class u extends s.Component{constructor(){super(...arguments),this.intl=null,this.weekService=null,this.buildWeekNumber=(t,e)=>{if(!this.firstDate(t))return f(`week-cell-${e}`);const n=this.firstDate(t),a=this.getWeekNumber(n),o=`kendo-react-calendar-week-cell-${a}`,c={className:"k-alt",value:a,firstDate:n};return this.props.weekCell?s.createElement(this.props.weekCell,{...c,key:o},a):s.createElement(g.CalendarWeekCell,{...c,key:o},a)},this.buildRow=t=>t.map((e,r)=>{if(!e)return f(r);const n={"aria-selected":e.isSelected},a=`kendo-react-calendar-cell-${e.value.getTime()}`,o={...n,...e,isDisabled:!e.isInRange,view:this.props.activeView,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave};return this.props.cell?s.createElement(this.props.cell,{...o,key:a},e.formattedValue):s.createElement(w.CalendarCell,{...o,key:a},e.formattedValue)}),this.firstDate=t=>{const e=this.firstWeekDateContext(t);return e?e.value:null},this.firstWeekDateContext=t=>{if(!this.weekNumber)return null;let e=0,r=t[e];for(;!r&&e<t.length;)r=t[++e];return r},this.handleClick=(t,e)=>{const{onChange:r}=this.props;if(r&&e){const n={value:d.cloneDate(t),target:this,nativeEvent:e&&e.nativeEvent,syntheticEvent:e};r.call(void 0,n)}},this.handleMouseEnter=t=>{const{onCellEnter:e}=this.props;e&&e.call(void 0,d.cloneDate(t))},this.handleMouseLeave=t=>{const{onCellLeave:e}=this.props;e&&e.call(void 0,d.cloneDate(t))}}get min(){return this.props.min}get max(){return this.props.max}get isHorizontal(){return this.props.direction==="horizontal"}get isMonthView(){return this.props.activeView===k.CalendarViewEnum.month}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===k.CalendarViewEnum.month)}get selectedDate(){return this.props.selectedDate!==void 0?this.props.selectedDate:u.defaultProps.selectedDate}render(){this.intl=D.provideIntlService(this),this.weekService=new b.WeekNamesService(this.intl);const t=this.weekService.getWeekNames(this.weekNumber),e=this.props.service.rowLength(this.weekNumber),r=this.props.service.title(this.props.viewDate),n=m.getToday(),a=m.setTime(this.props.viewDate,n),o=this.props.service.data({cellUID:this.props.cellUID,min:this.min,max:this.max,focusedDate:this.props.focusedDate,isActiveView:!this.props.bus.canMoveDown(this.props.activeView),selectedDate:this.selectedDate,selectionRange:this.props.selectionRange,viewDate:a});return s.createElement(s.Fragment,null,this.isMonthView&&this.isHorizontal&&s.createElement("thead",{role:"rowgroup",className:"k-calendar-thead"},s.createElement("tr",{role:"row",className:"k-calendar-tr"},t.map((c,h)=>s.createElement("th",{key:h,className:"k-calendar-th"},c)))),s.createElement("tbody",{role:"rowgroup",className:"k-calendar-tbody"},!this.isHorizontal&&s.createElement("tr",{role:"presentation",className:"k-calendar-tr"},s.createElement("th",{scope:"col",colSpan:e,className:"k-calendar-caption"},r)),o.map((c,h)=>s.createElement("tr",{role:"row",className:"k-calendar-tr",key:h},this.weekNumber&&this.buildWeekNumber(c,h),this.buildRow(c)))))}getWeekNumber(t){return!this.weekNumber||!this.intl?null:d.weekInYear(t,this.intl.firstDay())}};u.propTypes={activeRangeEnd:i.oneOf(["start","end",null]),activeView:i.number.isRequired,cellUID:i.string.isRequired,direction:i.oneOf(["horizontal","vertical"]),focusedDate:i.instanceOf(Date).isRequired,max:i.instanceOf(Date).isRequired,min:i.instanceOf(Date).isRequired,onChange:i.func,selectedDate:i.oneOfType([i.instanceOf(Date),i.arrayOf(i.instanceOf(Date))]),showWeekNumbers:i.bool,viewDate:i.instanceOf(Date).isRequired},u.defaultProps={direction:"vertical",selectedDate:m.getToday(),showWeekNumbers:!1};let p=u;D.registerForIntl(p);exports.View=p;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as s from "react";
|
|
10
|
+
import r from "prop-types";
|
|
11
|
+
import { cloneDate as p, weekInYear as v } from "@progress/kendo-date-math";
|
|
12
|
+
import { provideIntlService as D, registerForIntl as w } from "@progress/kendo-react-intl";
|
|
13
|
+
import { CalendarCell as g } from "./CalendarCell.mjs";
|
|
14
|
+
import { CalendarWeekCell as N } from "./CalendarWeekCell.mjs";
|
|
15
|
+
import { CalendarViewEnum as u } from "../models/CalendarViewEnum.mjs";
|
|
16
|
+
import { getToday as d, setTime as b } from "../../utils.mjs";
|
|
17
|
+
import { WeekNamesService as E } from "../services/WeekNamesService.mjs";
|
|
18
|
+
const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-calendar-td" }, " "), c = class c extends s.Component {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments), this.intl = null, this.weekService = null, this.buildWeekNumber = (t, e) => {
|
|
21
|
+
if (!this.firstDate(t))
|
|
22
|
+
return k(`week-cell-${e}`);
|
|
23
|
+
const n = this.firstDate(t), a = this.getWeekNumber(n), o = `kendo-react-calendar-week-cell-${a}`, l = {
|
|
24
|
+
className: "k-alt",
|
|
25
|
+
value: a,
|
|
26
|
+
firstDate: n
|
|
27
|
+
};
|
|
28
|
+
return this.props.weekCell ? /* @__PURE__ */ s.createElement(this.props.weekCell, { ...l, key: o }, a) : /* @__PURE__ */ s.createElement(N, { ...l, key: o }, a);
|
|
29
|
+
}, this.buildRow = (t) => t.map((e, i) => {
|
|
30
|
+
if (!e)
|
|
31
|
+
return k(i);
|
|
32
|
+
const n = { "aria-selected": e.isSelected }, a = `kendo-react-calendar-cell-${e.value.getTime()}`, o = {
|
|
33
|
+
...n,
|
|
34
|
+
...e,
|
|
35
|
+
isDisabled: !e.isInRange,
|
|
36
|
+
view: this.props.activeView,
|
|
37
|
+
onClick: this.handleClick,
|
|
38
|
+
onMouseEnter: this.handleMouseEnter,
|
|
39
|
+
onMouseLeave: this.handleMouseLeave
|
|
40
|
+
};
|
|
41
|
+
return this.props.cell ? /* @__PURE__ */ s.createElement(this.props.cell, { ...o, key: a }, e.formattedValue) : /* @__PURE__ */ s.createElement(g, { ...o, key: a }, e.formattedValue);
|
|
42
|
+
}), this.firstDate = (t) => {
|
|
43
|
+
const e = this.firstWeekDateContext(t);
|
|
44
|
+
return e ? e.value : null;
|
|
45
|
+
}, this.firstWeekDateContext = (t) => {
|
|
46
|
+
if (!this.weekNumber)
|
|
47
|
+
return null;
|
|
48
|
+
let e = 0, i = t[e];
|
|
49
|
+
for (; !i && e < t.length; )
|
|
50
|
+
i = t[++e];
|
|
51
|
+
return i;
|
|
52
|
+
}, this.handleClick = (t, e) => {
|
|
53
|
+
const { onChange: i } = this.props;
|
|
54
|
+
if (i && e) {
|
|
55
|
+
const n = {
|
|
56
|
+
value: p(t),
|
|
57
|
+
target: this,
|
|
58
|
+
nativeEvent: e && e.nativeEvent,
|
|
59
|
+
syntheticEvent: e
|
|
60
|
+
};
|
|
61
|
+
i.call(void 0, n);
|
|
62
|
+
}
|
|
63
|
+
}, this.handleMouseEnter = (t) => {
|
|
64
|
+
const { onCellEnter: e } = this.props;
|
|
65
|
+
e && e.call(void 0, p(t));
|
|
66
|
+
}, this.handleMouseLeave = (t) => {
|
|
67
|
+
const { onCellLeave: e } = this.props;
|
|
68
|
+
e && e.call(void 0, p(t));
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
get min() {
|
|
72
|
+
return this.props.min;
|
|
73
|
+
}
|
|
74
|
+
get max() {
|
|
75
|
+
return this.props.max;
|
|
76
|
+
}
|
|
77
|
+
get isHorizontal() {
|
|
78
|
+
return this.props.direction === "horizontal";
|
|
79
|
+
}
|
|
80
|
+
get isMonthView() {
|
|
81
|
+
return this.props.activeView === u.month;
|
|
82
|
+
}
|
|
83
|
+
get weekNumber() {
|
|
84
|
+
return !!(this.props.showWeekNumbers && this.props.activeView === u.month);
|
|
85
|
+
}
|
|
86
|
+
get selectedDate() {
|
|
87
|
+
return this.props.selectedDate !== void 0 ? this.props.selectedDate : c.defaultProps.selectedDate;
|
|
88
|
+
}
|
|
89
|
+
render() {
|
|
90
|
+
this.intl = D(this), this.weekService = new E(this.intl);
|
|
91
|
+
const t = this.weekService.getWeekNames(this.weekNumber), e = this.props.service.rowLength(this.weekNumber), i = this.props.service.title(this.props.viewDate), n = d(), a = b(this.props.viewDate, n), o = this.props.service.data({
|
|
92
|
+
cellUID: this.props.cellUID,
|
|
93
|
+
min: this.min,
|
|
94
|
+
max: this.max,
|
|
95
|
+
focusedDate: this.props.focusedDate,
|
|
96
|
+
isActiveView: !this.props.bus.canMoveDown(this.props.activeView),
|
|
97
|
+
selectedDate: this.selectedDate,
|
|
98
|
+
selectionRange: this.props.selectionRange,
|
|
99
|
+
viewDate: a
|
|
100
|
+
});
|
|
101
|
+
return /* @__PURE__ */ s.createElement(s.Fragment, null, this.isMonthView && this.isHorizontal && /* @__PURE__ */ s.createElement(
|
|
102
|
+
"thead",
|
|
103
|
+
{
|
|
104
|
+
role: "rowgroup",
|
|
105
|
+
className: "k-calendar-thead"
|
|
106
|
+
},
|
|
107
|
+
/* @__PURE__ */ s.createElement("tr", { role: "row", className: "k-calendar-tr" }, t.map((l, h) => /* @__PURE__ */ s.createElement("th", { key: h, className: "k-calendar-th" }, l)))
|
|
108
|
+
), /* @__PURE__ */ s.createElement(
|
|
109
|
+
"tbody",
|
|
110
|
+
{
|
|
111
|
+
role: "rowgroup",
|
|
112
|
+
className: "k-calendar-tbody"
|
|
113
|
+
},
|
|
114
|
+
!this.isHorizontal && /* @__PURE__ */ s.createElement("tr", { role: "presentation", className: "k-calendar-tr" }, /* @__PURE__ */ s.createElement(
|
|
115
|
+
"th",
|
|
116
|
+
{
|
|
117
|
+
scope: "col",
|
|
118
|
+
colSpan: e,
|
|
119
|
+
className: "k-calendar-caption"
|
|
120
|
+
},
|
|
121
|
+
i
|
|
122
|
+
)),
|
|
123
|
+
o.map((l, h) => /* @__PURE__ */ s.createElement("tr", { role: "row", className: "k-calendar-tr", key: h }, this.weekNumber && this.buildWeekNumber(l, h), this.buildRow(l)))
|
|
124
|
+
));
|
|
125
|
+
}
|
|
126
|
+
getWeekNumber(t) {
|
|
127
|
+
return !this.weekNumber || !this.intl ? null : v(t, this.intl.firstDay());
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
c.propTypes = {
|
|
131
|
+
activeRangeEnd: r.oneOf(["start", "end", null]),
|
|
132
|
+
activeView: r.number.isRequired,
|
|
133
|
+
cellUID: r.string.isRequired,
|
|
134
|
+
direction: r.oneOf(["horizontal", "vertical"]),
|
|
135
|
+
focusedDate: r.instanceOf(Date).isRequired,
|
|
136
|
+
max: r.instanceOf(Date).isRequired,
|
|
137
|
+
min: r.instanceOf(Date).isRequired,
|
|
138
|
+
onChange: r.func,
|
|
139
|
+
selectedDate: r.oneOfType(
|
|
140
|
+
[r.instanceOf(Date), r.arrayOf(r.instanceOf(Date))]
|
|
141
|
+
),
|
|
142
|
+
showWeekNumbers: r.bool,
|
|
143
|
+
viewDate: r.instanceOf(Date).isRequired
|
|
144
|
+
}, c.defaultProps = {
|
|
145
|
+
direction: "vertical",
|
|
146
|
+
selectedDate: d(),
|
|
147
|
+
showWeekNumbers: !1
|
|
148
|
+
};
|
|
149
|
+
let m = c;
|
|
150
|
+
w(m);
|
|
151
|
+
export {
|
|
152
|
+
m as View
|
|
153
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),r=require("prop-types"),y=require("@progress/kendo-react-common"),d=require("@progress/kendo-date-math"),f=require("@progress/kendo-react-intl"),x=require("../../virtualization/Virtualization.js"),C=require("./View.js"),S=require("./Header.js"),c=require("../../utils.js"),l=require("../models/CalendarViewEnum.js"),E=require("./TodayCommand.js");function T(h){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const e in h)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(h,e);Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:()=>h[e]})}}return o.default=h,Object.freeze(o)}const s=T(V),I=5,p=class p extends s.Component{constructor(o){super(o),this.virtualization=null,this.calendarView=null,this.table=null,this.intl=null,this.bottomOffset=0,this.viewOffset=0,this.viewHeight=0,this._element=null,this.isActive=!1,this.animateToIndex=!0,this.shouldScroll=!1,this.focusActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus"),t=this._element.querySelector(".k-state-pending-focus");e&&e[0]&&e[0].classList.remove("k-focus"),t&&t.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus");e&&e.classList.remove("k-focus"),this.isActive=!1},this.handleVirtualizationMount=e=>{if(this.virtualization=e,this.virtualization&&this.table){this.table.style.transform=`translateY(${this.viewOffset}px)`;const t=c.dateInRange(this.props.focusedDate,this.props.min,this.props.max),i=this.props.service.skip(t,this.props.min);this.virtualization.scrollToIndex(i)}},this.buildMonthView=(e,t)=>s.createElement("table",{key:"calendar-view-list-weekdays",className:"k-calendar-table k-calendar-weekdays",role:"grid",tabIndex:this.props.tabIndex},s.createElement("colgroup",null,e.map((i,a)=>s.createElement("col",{key:a}))),s.createElement("thead",{className:"k-calendar-thead"},s.createElement("tr",{className:"k-calendar-tr"},t.map((i,a)=>s.createElement("th",{key:a,className:"k-calendar-th"},i))))),this.buildDates=(e,t)=>{const i=this.props.cellUID;return s.createElement("table",{className:"k-calendar-table",ref:a=>this.table=a,role:"grid",tabIndex:this.props.tabIndex,"aria-activedescendant":i+this.props.focusedDate.getTime()},s.createElement("colgroup",null,e.map((a,n)=>s.createElement("col",{key:n}))),t.map(a=>s.createElement(C.View,{ref:n=>{this.calendarView||(this.calendarView=n)},key:a.getTime(),activeView:this.props.activeView,viewDate:a,min:this.props.min,max:this.props.max,cellUID:i,focusedDate:this.props.focusedDate,cell:this.props.cell,selectedDate:this.props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,bus:this.props.bus,service:this.props.service,weekCell:this.props.weekCell})))},this.calculateHeights=()=>{if(!this.props.dom)return;const e=this.props.activeView===l.CalendarViewEnum.month?this.props.dom.scrollableContentHeight:this.props.dom.scrollableYearContentHeight;this.bottomOffset=e-this.props.dom.viewHeight(this.props.activeView),this.viewOffset=-1*this.props.dom.headerHeight,this.viewHeight=this.props.dom.viewHeight(this.props.activeView)||1},this.getTake=(e,t)=>Math.min(t-e,this.take),this.handleScrollAction=({index:e,scrollAction:t,pageAction:i})=>{const a=i?i.skip:this.state.skip;if((this.state.index!==e||this.state.skip!==a)&&this.setState({index:e,skip:a}),this.table&&t){const n=`translateY(${t.offset}px)`;this.table.style.transform=n}},this.handleTodayClick=e=>{this.shouldScroll=!0,this.handleDateChange.call(void 0,e,!0)},this.handleDateChange=(e,t=!1)=>{const{onChange:i}=this.props;if(i){const a={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:d.cloneDate(e.value),target:this,isTodayClick:t};i.call(void 0,a)}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.state={skip:this.props.service.skip(this.props.focusedDate,this.props.min),index:this.props.service.skip(this.props.focusedDate,this.props.min)}}get element(){return this._element}get weekNames(){this.intl=f.provideIntlService(this);const o=c.shiftWeekNames(this.intl.dateFormatNames({nameType:"short",type:"days"}),this.intl.firstDay());return this.weekNumber?[""].concat(o):o}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===l.CalendarViewEnum.month)}get take(){return this.props.take!==void 0?this.props.take:p.defaultProps.take}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get todayIsInRange(){return c.isInRange(c.getToday(),d.getDate(this.props.min),d.getDate(this.props.max))}componentDidUpdate(o,e){this.shouldScroll=!1,this.indexToScroll!==void 0&&this.virtualization&&this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](this.indexToScroll),this.isActive&&this.focusActiveDate(),this.lastView=this.props.activeView,this.indexToScroll=void 0}render(){this.calculateHeights();const o=this.lastView!==this.props.activeView,e=c.dateInRange(this.props.focusedDate,this.props.min,this.props.max),t=o?this.props.service.skip(e,this.props.min):this.state.skip,i=this.props.service.total(this.props.min,this.props.max),a=this.getTake(t,i),n=this.props.service.addToDate(this.props.min,t),w=this.props.service.addToDate(this.props.min,this.state.index),m=new Array(this.props.service.rowLength(this.weekNumber)).fill(""),v=this.props.activeView!==this.lastView;this.animateToIndex=!v,(v||!d.isEqualDate(this.lastFocus,e)||this.shouldScroll||!this.props.shouldScroll||this.props.shouldScroll())&&(this.indexToScroll=this.props.service.skip(e,this.props.min)),this.lastFocus=e;const k=y.classNames("k-calendar-view k-vstack",{"k-calendar-monthview":this.props.activeView===l.CalendarViewEnum.month,"k-calendar-yearview":this.props.activeView===l.CalendarViewEnum.year,"k-calendar-decadeview":this.props.activeView===l.CalendarViewEnum.decade,"k-calendar-centuryview":this.props.activeView===l.CalendarViewEnum.century}),b=this.buildDates(m,this.props.service.datesList(n,a)),g=s.createElement(s.Fragment,null,s.createElement(S.Header,{key:"calendar-view-list-header",currentDate:w,min:this.props.min,max:this.props.max,activeView:this.props.activeView,bus:this.props.bus,service:this.props.service,headerTitle:this.props.headerTitle,commands:s.createElement(s.Fragment,null,s.createElement(E.TodayCommand,{min:this.props.min,max:this.props.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange,tabIndex:this.props.tabIndex}))}),this.props.activeView===l.CalendarViewEnum.month&&this.buildMonthView(m,this.weekNames),s.createElement(x.Virtualization,{key:"calendar-view-list-content",skip:t,take:this.take,total:i,itemHeight:this.viewHeight,topOffset:this.viewOffset,bottomOffset:this.bottomOffset,scrollOffsetSize:this.viewOffset,maxScrollDifference:this.viewHeight,onScroll:this.props.onScroll,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,children:b,tabIndex:this.props.tabIndex}));return s.createElement("div",{ref:D=>{this._element=D},className:k},this.props.dom.didCalculate?g:null)}};p.propTypes={activeView:r.number.isRequired,bottomOffset:r.number,cellUID:r.string.isRequired,focusedDate:r.instanceOf(Date).isRequired,max:r.instanceOf(Date).isRequired,min:r.instanceOf(Date).isRequired,onChange:r.func,showWeekNumbers:r.bool,smoothScroll:r.bool,take:r.number,value:r.instanceOf(Date),viewHeight:r.number,viewOffset:r.number,tabIndex:r.number},p.defaultProps={take:I,showWeekNumbers:!1,smoothScroll:!0};let u=p;f.registerForIntl(u);exports.ViewList=u;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as s from "react";
|
|
10
|
+
import o from "prop-types";
|
|
11
|
+
import { classNames as g } from "@progress/kendo-react-common";
|
|
12
|
+
import { cloneDate as x, getDate as d, isEqualDate as D } from "@progress/kendo-date-math";
|
|
13
|
+
import { provideIntlService as y, registerForIntl as V } from "@progress/kendo-react-intl";
|
|
14
|
+
import { Virtualization as S } from "../../virtualization/Virtualization.mjs";
|
|
15
|
+
import { View as I } from "./View.mjs";
|
|
16
|
+
import { Header as T } from "./Header.mjs";
|
|
17
|
+
import { dateInRange as u, shiftWeekNames as C, isInRange as E, getToday as N } from "../../utils.mjs";
|
|
18
|
+
import { CalendarViewEnum as l } from "../models/CalendarViewEnum.mjs";
|
|
19
|
+
import { TodayCommand as O } from "./TodayCommand.mjs";
|
|
20
|
+
const H = 5, h = class h extends s.Component {
|
|
21
|
+
constructor(r) {
|
|
22
|
+
super(r), this.virtualization = null, this.calendarView = null, this.table = null, this.intl = null, this.bottomOffset = 0, this.viewOffset = 0, this.viewHeight = 0, this._element = null, this.isActive = !1, this.animateToIndex = !0, this.shouldScroll = !1, this.focusActiveDate = () => {
|
|
23
|
+
if (!this._element)
|
|
24
|
+
return;
|
|
25
|
+
const e = this._element.querySelector("td.k-focus"), t = this._element.querySelector(".k-state-pending-focus");
|
|
26
|
+
e && e[0] && e[0].classList.remove("k-focus"), t && t.classList.add("k-focus"), this.isActive = !0;
|
|
27
|
+
}, this.blurActiveDate = () => {
|
|
28
|
+
if (!this._element)
|
|
29
|
+
return;
|
|
30
|
+
const e = this._element.querySelector("td.k-focus");
|
|
31
|
+
e && e.classList.remove("k-focus"), this.isActive = !1;
|
|
32
|
+
}, this.handleVirtualizationMount = (e) => {
|
|
33
|
+
if (this.virtualization = e, this.virtualization && this.table) {
|
|
34
|
+
this.table.style.transform = `translateY(${this.viewOffset}px)`;
|
|
35
|
+
const t = u(this.props.focusedDate, this.props.min, this.props.max), i = this.props.service.skip(t, this.props.min);
|
|
36
|
+
this.virtualization.scrollToIndex(i);
|
|
37
|
+
}
|
|
38
|
+
}, this.buildMonthView = (e, t) => /* @__PURE__ */ s.createElement(
|
|
39
|
+
"table",
|
|
40
|
+
{
|
|
41
|
+
key: "calendar-view-list-weekdays",
|
|
42
|
+
className: "k-calendar-table k-calendar-weekdays",
|
|
43
|
+
role: "grid",
|
|
44
|
+
tabIndex: this.props.tabIndex
|
|
45
|
+
},
|
|
46
|
+
/* @__PURE__ */ s.createElement("colgroup", null, e.map((i, a) => /* @__PURE__ */ s.createElement("col", { key: a }))),
|
|
47
|
+
/* @__PURE__ */ s.createElement("thead", { className: "k-calendar-thead" }, /* @__PURE__ */ s.createElement("tr", { className: "k-calendar-tr" }, t.map((i, a) => /* @__PURE__ */ s.createElement("th", { key: a, className: "k-calendar-th" }, i))))
|
|
48
|
+
), this.buildDates = (e, t) => {
|
|
49
|
+
const i = this.props.cellUID;
|
|
50
|
+
return /* @__PURE__ */ s.createElement(
|
|
51
|
+
"table",
|
|
52
|
+
{
|
|
53
|
+
className: "k-calendar-table",
|
|
54
|
+
ref: (a) => this.table = a,
|
|
55
|
+
role: "grid",
|
|
56
|
+
tabIndex: this.props.tabIndex,
|
|
57
|
+
"aria-activedescendant": i + this.props.focusedDate.getTime()
|
|
58
|
+
},
|
|
59
|
+
/* @__PURE__ */ s.createElement("colgroup", null, e.map((a, n) => /* @__PURE__ */ s.createElement("col", { key: n }))),
|
|
60
|
+
t.map((a) => /* @__PURE__ */ s.createElement(
|
|
61
|
+
I,
|
|
62
|
+
{
|
|
63
|
+
ref: (n) => {
|
|
64
|
+
this.calendarView || (this.calendarView = n);
|
|
65
|
+
},
|
|
66
|
+
key: a.getTime(),
|
|
67
|
+
activeView: this.props.activeView,
|
|
68
|
+
viewDate: a,
|
|
69
|
+
min: this.props.min,
|
|
70
|
+
max: this.props.max,
|
|
71
|
+
cellUID: i,
|
|
72
|
+
focusedDate: this.props.focusedDate,
|
|
73
|
+
cell: this.props.cell,
|
|
74
|
+
selectedDate: this.props.value,
|
|
75
|
+
showWeekNumbers: this.weekNumber,
|
|
76
|
+
onChange: this.handleDateChange,
|
|
77
|
+
bus: this.props.bus,
|
|
78
|
+
service: this.props.service,
|
|
79
|
+
weekCell: this.props.weekCell
|
|
80
|
+
}
|
|
81
|
+
))
|
|
82
|
+
);
|
|
83
|
+
}, this.calculateHeights = () => {
|
|
84
|
+
if (!this.props.dom)
|
|
85
|
+
return;
|
|
86
|
+
const e = this.props.activeView === l.month ? this.props.dom.scrollableContentHeight : this.props.dom.scrollableYearContentHeight;
|
|
87
|
+
this.bottomOffset = e - this.props.dom.viewHeight(this.props.activeView), this.viewOffset = -1 * this.props.dom.headerHeight, this.viewHeight = this.props.dom.viewHeight(this.props.activeView) || 1;
|
|
88
|
+
}, this.getTake = (e, t) => Math.min(t - e, this.take), this.handleScrollAction = ({ index: e, scrollAction: t, pageAction: i }) => {
|
|
89
|
+
const a = i ? i.skip : this.state.skip;
|
|
90
|
+
if ((this.state.index !== e || this.state.skip !== a) && this.setState({ index: e, skip: a }), this.table && t) {
|
|
91
|
+
const n = `translateY(${t.offset}px)`;
|
|
92
|
+
this.table.style.transform = n;
|
|
93
|
+
}
|
|
94
|
+
}, this.handleTodayClick = (e) => {
|
|
95
|
+
this.shouldScroll = !0, this.handleDateChange.call(void 0, e, !0);
|
|
96
|
+
}, this.handleDateChange = (e, t = !1) => {
|
|
97
|
+
const { onChange: i } = this.props;
|
|
98
|
+
if (i) {
|
|
99
|
+
const a = {
|
|
100
|
+
syntheticEvent: e.syntheticEvent,
|
|
101
|
+
nativeEvent: e.nativeEvent,
|
|
102
|
+
value: x(e.value),
|
|
103
|
+
target: this,
|
|
104
|
+
isTodayClick: t
|
|
105
|
+
};
|
|
106
|
+
i.call(void 0, a);
|
|
107
|
+
}
|
|
108
|
+
}, this.lastView = this.props.activeView, this.lastFocus = this.props.focusedDate, this.state = {
|
|
109
|
+
skip: this.props.service.skip(this.props.focusedDate, this.props.min),
|
|
110
|
+
index: this.props.service.skip(this.props.focusedDate, this.props.min)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
get element() {
|
|
114
|
+
return this._element;
|
|
115
|
+
}
|
|
116
|
+
get weekNames() {
|
|
117
|
+
this.intl = y(this);
|
|
118
|
+
const r = C(
|
|
119
|
+
this.intl.dateFormatNames({ nameType: "short", type: "days" }),
|
|
120
|
+
this.intl.firstDay()
|
|
121
|
+
);
|
|
122
|
+
return this.weekNumber ? [""].concat(r) : r;
|
|
123
|
+
}
|
|
124
|
+
get weekNumber() {
|
|
125
|
+
return !!(this.props.showWeekNumbers && this.props.activeView === l.month);
|
|
126
|
+
}
|
|
127
|
+
get take() {
|
|
128
|
+
return this.props.take !== void 0 ? this.props.take : h.defaultProps.take;
|
|
129
|
+
}
|
|
130
|
+
get animate() {
|
|
131
|
+
return !!(this.props.smoothScroll && this.animateToIndex);
|
|
132
|
+
}
|
|
133
|
+
get todayIsInRange() {
|
|
134
|
+
return E(N(), d(this.props.min), d(this.props.max));
|
|
135
|
+
}
|
|
136
|
+
componentDidUpdate(r, e) {
|
|
137
|
+
this.shouldScroll = !1, this.indexToScroll !== void 0 && this.virtualization && this.virtualization[this.animate ? "animateToIndex" : "scrollToIndex"](this.indexToScroll), this.isActive && this.focusActiveDate(), this.lastView = this.props.activeView, this.indexToScroll = void 0;
|
|
138
|
+
}
|
|
139
|
+
render() {
|
|
140
|
+
this.calculateHeights();
|
|
141
|
+
const r = this.lastView !== this.props.activeView, e = u(this.props.focusedDate, this.props.min, this.props.max), t = r ? this.props.service.skip(e, this.props.min) : this.state.skip, i = this.props.service.total(this.props.min, this.props.max), a = this.getTake(t, i), n = this.props.service.addToDate(this.props.min, t), f = this.props.service.addToDate(this.props.min, this.state.index), p = new Array(this.props.service.rowLength(this.weekNumber)).fill(""), m = this.props.activeView !== this.lastView;
|
|
142
|
+
this.animateToIndex = !m, (m || !D(this.lastFocus, e) || this.shouldScroll || !this.props.shouldScroll || this.props.shouldScroll()) && (this.indexToScroll = this.props.service.skip(e, this.props.min)), this.lastFocus = e;
|
|
143
|
+
const v = g(
|
|
144
|
+
"k-calendar-view k-vstack",
|
|
145
|
+
{
|
|
146
|
+
"k-calendar-monthview": this.props.activeView === l.month,
|
|
147
|
+
"k-calendar-yearview": this.props.activeView === l.year,
|
|
148
|
+
"k-calendar-decadeview": this.props.activeView === l.decade,
|
|
149
|
+
"k-calendar-centuryview": this.props.activeView === l.century
|
|
150
|
+
}
|
|
151
|
+
), w = this.buildDates(p, this.props.service.datesList(n, a)), k = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
|
|
152
|
+
T,
|
|
153
|
+
{
|
|
154
|
+
key: "calendar-view-list-header",
|
|
155
|
+
currentDate: f,
|
|
156
|
+
min: this.props.min,
|
|
157
|
+
max: this.props.max,
|
|
158
|
+
activeView: this.props.activeView,
|
|
159
|
+
bus: this.props.bus,
|
|
160
|
+
service: this.props.service,
|
|
161
|
+
headerTitle: this.props.headerTitle,
|
|
162
|
+
commands: /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
|
|
163
|
+
O,
|
|
164
|
+
{
|
|
165
|
+
min: this.props.min,
|
|
166
|
+
max: this.props.max,
|
|
167
|
+
onClick: this.handleTodayClick,
|
|
168
|
+
disabled: !this.todayIsInRange,
|
|
169
|
+
tabIndex: this.props.tabIndex
|
|
170
|
+
}
|
|
171
|
+
))
|
|
172
|
+
}
|
|
173
|
+
), this.props.activeView === l.month && this.buildMonthView(p, this.weekNames), /* @__PURE__ */ s.createElement(
|
|
174
|
+
S,
|
|
175
|
+
{
|
|
176
|
+
key: "calendar-view-list-content",
|
|
177
|
+
skip: t,
|
|
178
|
+
take: this.take,
|
|
179
|
+
total: i,
|
|
180
|
+
itemHeight: this.viewHeight,
|
|
181
|
+
topOffset: this.viewOffset,
|
|
182
|
+
bottomOffset: this.bottomOffset,
|
|
183
|
+
scrollOffsetSize: this.viewOffset,
|
|
184
|
+
maxScrollDifference: this.viewHeight,
|
|
185
|
+
onScroll: this.props.onScroll,
|
|
186
|
+
onScrollAction: this.handleScrollAction,
|
|
187
|
+
onMount: this.handleVirtualizationMount,
|
|
188
|
+
children: w,
|
|
189
|
+
tabIndex: this.props.tabIndex
|
|
190
|
+
}
|
|
191
|
+
));
|
|
192
|
+
return /* @__PURE__ */ s.createElement(
|
|
193
|
+
"div",
|
|
194
|
+
{
|
|
195
|
+
ref: (b) => {
|
|
196
|
+
this._element = b;
|
|
197
|
+
},
|
|
198
|
+
className: v
|
|
199
|
+
},
|
|
200
|
+
this.props.dom.didCalculate ? k : null
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
h.propTypes = {
|
|
205
|
+
activeView: o.number.isRequired,
|
|
206
|
+
bottomOffset: o.number,
|
|
207
|
+
cellUID: o.string.isRequired,
|
|
208
|
+
focusedDate: o.instanceOf(Date).isRequired,
|
|
209
|
+
max: o.instanceOf(Date).isRequired,
|
|
210
|
+
min: o.instanceOf(Date).isRequired,
|
|
211
|
+
onChange: o.func,
|
|
212
|
+
showWeekNumbers: o.bool,
|
|
213
|
+
smoothScroll: o.bool,
|
|
214
|
+
take: o.number,
|
|
215
|
+
value: o.instanceOf(Date),
|
|
216
|
+
viewHeight: o.number,
|
|
217
|
+
viewOffset: o.number,
|
|
218
|
+
tabIndex: o.number
|
|
219
|
+
}, h.defaultProps = {
|
|
220
|
+
take: H,
|
|
221
|
+
showWeekNumbers: !1,
|
|
222
|
+
smoothScroll: !0
|
|
223
|
+
};
|
|
224
|
+
let c = h;
|
|
225
|
+
V(c);
|
|
226
|
+
export {
|
|
227
|
+
c as ViewList
|
|
228
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var c=(t=>(t[t.month=0]="month",t[t.year=1]="year",t[t.decade=2]="decade",t[t.century=3]="century",t))(c||{});exports.CalendarViewEnum=c;
|