@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.
Files changed (200) hide show
  1. package/calendar/components/Calendar.js +12 -0
  2. package/calendar/components/Calendar.mjs +328 -0
  3. package/calendar/components/CalendarCell.js +8 -0
  4. package/calendar/components/CalendarCell.mjs +101 -0
  5. package/calendar/components/CalendarHeaderTitle.js +8 -0
  6. package/calendar/components/CalendarHeaderTitle.mjs +23 -0
  7. package/calendar/components/CalendarNavigationItem.js +8 -0
  8. package/calendar/components/CalendarNavigationItem.mjs +29 -0
  9. package/calendar/components/CalendarWeekCell.js +8 -0
  10. package/calendar/components/CalendarWeekCell.mjs +23 -0
  11. package/calendar/components/Header.js +8 -0
  12. package/calendar/components/Header.mjs +78 -0
  13. package/calendar/components/HorizontalViewList.js +8 -0
  14. package/calendar/components/HorizontalViewList.mjs +120 -0
  15. package/calendar/components/MultiViewCalendar.js +8 -0
  16. package/calendar/components/MultiViewCalendar.mjs +428 -0
  17. package/calendar/components/Navigation.js +8 -0
  18. package/calendar/components/Navigation.mjs +117 -0
  19. package/calendar/components/TodayCommand.js +8 -0
  20. package/calendar/components/TodayCommand.mjs +74 -0
  21. package/calendar/components/View.js +8 -0
  22. package/calendar/components/View.mjs +153 -0
  23. package/calendar/components/ViewList.js +8 -0
  24. package/calendar/components/ViewList.mjs +228 -0
  25. package/calendar/models/CalendarViewEnum.js +8 -0
  26. package/calendar/models/CalendarViewEnum.mjs +12 -0
  27. package/calendar/models/NavigationAction.js +8 -0
  28. package/calendar/models/NavigationAction.mjs +12 -0
  29. package/calendar/models/SelectionRange.js +8 -0
  30. package/calendar/models/SelectionRange.mjs +12 -0
  31. package/calendar/services/BusViewService.js +8 -0
  32. package/calendar/services/BusViewService.mjs +58 -0
  33. package/calendar/services/CenturyViewService.js +8 -0
  34. package/calendar/services/CenturyViewService.mjs +126 -0
  35. package/calendar/services/DOMService.js +14 -0
  36. package/calendar/services/DOMService.mjs +124 -0
  37. package/calendar/services/DecadeViewService.js +8 -0
  38. package/calendar/services/DecadeViewService.mjs +126 -0
  39. package/calendar/services/MonthViewService.js +8 -0
  40. package/calendar/services/MonthViewService.mjs +139 -0
  41. package/calendar/services/NavigationService.js +8 -0
  42. package/calendar/services/NavigationService.mjs +36 -0
  43. package/calendar/services/ScrollSyncService.js +8 -0
  44. package/calendar/services/ScrollSyncService.mjs +50 -0
  45. package/calendar/services/WeekNamesService.js +8 -0
  46. package/calendar/services/WeekNamesService.mjs +24 -0
  47. package/calendar/services/YearViewService.js +8 -0
  48. package/calendar/services/YearViewService.mjs +135 -0
  49. package/common/AdaptiveMode.js +8 -0
  50. package/common/AdaptiveMode.mjs +73 -0
  51. package/common/PickerWrap.js +8 -0
  52. package/common/PickerWrap.mjs +32 -0
  53. package/common/constants.js +8 -0
  54. package/common/constants.mjs +12 -0
  55. package/dateinput/DateInput.js +8 -0
  56. package/dateinput/DateInput.mjs +503 -0
  57. package/dateinput/models/kendo-date.js +8 -0
  58. package/dateinput/models/kendo-date.mjs +233 -0
  59. package/dateinput/models/mask.js +8 -0
  60. package/dateinput/models/mask.mjs +16 -0
  61. package/dateinput/utils.js +8 -0
  62. package/dateinput/utils.mjs +38 -0
  63. package/datepicker/DatePicker.js +8 -0
  64. package/datepicker/DatePicker.mjs +462 -0
  65. package/datepicker/ToggleButton.js +8 -0
  66. package/datepicker/ToggleButton.mjs +13 -0
  67. package/daterangepicker/DateRangePicker.js +8 -0
  68. package/daterangepicker/DateRangePicker.mjs +426 -0
  69. package/datetimepicker/DateTimePicker.js +8 -0
  70. package/datetimepicker/DateTimePicker.mjs +475 -0
  71. package/datetimepicker/DateTimeSelector.js +8 -0
  72. package/datetimepicker/DateTimeSelector.mjs +275 -0
  73. package/dist/cdn/js/kendo-react-dateinputs.js +8 -21
  74. package/hooks/usePickerFloatingLabel.js +8 -0
  75. package/hooks/usePickerFloatingLabel.mjs +31 -0
  76. package/index.d.mts +4528 -5
  77. package/index.d.ts +4528 -39
  78. package/index.js +8 -21
  79. package/index.mjs +114 -6540
  80. package/messages/index.js +8 -0
  81. package/messages/index.mjs +59 -0
  82. package/package-metadata.js +8 -0
  83. package/package-metadata.mjs +19 -0
  84. package/package.json +7 -7
  85. package/timepicker/TimeList.js +14 -0
  86. package/timepicker/TimeList.mjs +230 -0
  87. package/timepicker/TimePart.js +8 -0
  88. package/timepicker/TimePart.mjs +267 -0
  89. package/timepicker/TimePicker.js +8 -0
  90. package/timepicker/TimePicker.mjs +479 -0
  91. package/timepicker/TimeSelector.js +8 -0
  92. package/timepicker/TimeSelector.mjs +250 -0
  93. package/timepicker/models/TimePart.js +8 -0
  94. package/timepicker/models/TimePart.mjs +18 -0
  95. package/timepicker/services/DOMService.js +8 -0
  96. package/timepicker/services/DOMService.mjs +34 -0
  97. package/timepicker/services/DayPeriodService.js +8 -0
  98. package/timepicker/services/DayPeriodService.mjs +89 -0
  99. package/timepicker/services/HoursService.js +8 -0
  100. package/timepicker/services/HoursService.mjs +92 -0
  101. package/timepicker/services/MinutesService.js +8 -0
  102. package/timepicker/services/MinutesService.mjs +91 -0
  103. package/timepicker/services/SecondsService.js +8 -0
  104. package/timepicker/services/SecondsService.mjs +91 -0
  105. package/timepicker/utils.js +8 -0
  106. package/timepicker/utils.mjs +91 -0
  107. package/utils.js +8 -0
  108. package/utils.mjs +111 -0
  109. package/virtualization/Virtualization.js +8 -0
  110. package/virtualization/Virtualization.mjs +204 -0
  111. package/virtualization/services/RowHeightService.js +8 -0
  112. package/virtualization/services/RowHeightService.mjs +50 -0
  113. package/virtualization/services/ScrollerService.js +8 -0
  114. package/virtualization/services/ScrollerService.mjs +52 -0
  115. package/PopupSettings.d.ts +0 -18
  116. package/calendar/components/Calendar.d.ts +0 -191
  117. package/calendar/components/CalendarCell.d.ts +0 -39
  118. package/calendar/components/CalendarHeaderTitle.d.ts +0 -32
  119. package/calendar/components/CalendarNavigationItem.d.ts +0 -31
  120. package/calendar/components/CalendarWeekCell.d.ts +0 -29
  121. package/calendar/components/Header.d.ts +0 -58
  122. package/calendar/components/HorizontalViewList.d.ts +0 -71
  123. package/calendar/components/MultiViewCalendar.d.ts +0 -212
  124. package/calendar/components/Navigation.d.ts +0 -80
  125. package/calendar/components/TodayCommand.d.ts +0 -35
  126. package/calendar/components/View.d.ts +0 -89
  127. package/calendar/components/ViewList.d.ts +0 -115
  128. package/calendar/models/ActiveView.d.ts +0 -8
  129. package/calendar/models/CalendarSettings.d.ts +0 -106
  130. package/calendar/models/CalendarViewEnum.d.ts +0 -13
  131. package/calendar/models/CellContext.d.ts +0 -23
  132. package/calendar/models/MultiViewCalendarMode.d.ts +0 -13
  133. package/calendar/models/MultiViewCalendarSettings.d.ts +0 -115
  134. package/calendar/models/NavigationAction.d.ts +0 -19
  135. package/calendar/models/SelectionRange.d.ts +0 -21
  136. package/calendar/models/SelectionRangeEnd.d.ts +0 -8
  137. package/calendar/models/ViewService.d.ts +0 -29
  138. package/calendar/models/index.d.ts +0 -15
  139. package/calendar/services/BusViewService.d.ts +0 -25
  140. package/calendar/services/CenturyViewService.d.ts +0 -29
  141. package/calendar/services/DOMService.d.ts +0 -33
  142. package/calendar/services/DecadeViewService.d.ts +0 -31
  143. package/calendar/services/MonthViewService.d.ts +0 -37
  144. package/calendar/services/NavigationService.d.ts +0 -18
  145. package/calendar/services/ScrollSyncService.d.ts +0 -25
  146. package/calendar/services/WeekNamesService.d.ts +0 -13
  147. package/calendar/services/YearViewService.d.ts +0 -35
  148. package/calendar/services/index.d.ts +0 -14
  149. package/common/AdaptiveMode.d.ts +0 -25
  150. package/common/PickerWrap.d.ts +0 -22
  151. package/common/constants.d.ts +0 -8
  152. package/dateinput/DateInput.d.ts +0 -355
  153. package/dateinput/models/DateInputSettings.d.ts +0 -103
  154. package/dateinput/models/format-placeholder.d.ts +0 -43
  155. package/dateinput/models/incremental-steps.d.ts +0 -15
  156. package/dateinput/models/index.d.ts +0 -11
  157. package/dateinput/models/kendo-date.d.ts +0 -57
  158. package/dateinput/models/mask.d.ts +0 -11
  159. package/dateinput/models/selection.d.ts +0 -11
  160. package/dateinput/utils.d.ts +0 -34
  161. package/datepicker/DatePicker.d.ts +0 -358
  162. package/datepicker/ToggleButton.d.ts +0 -14
  163. package/datepicker/models/DatePickerSettings.d.ts +0 -141
  164. package/datepicker/models/index.d.ts +0 -6
  165. package/daterangepicker/DateRangePicker.d.ts +0 -354
  166. package/daterangepicker/models/DateRangePickerCalendarSettings.d.ts +0 -10
  167. package/daterangepicker/models/DateRangePickerDateInputSettings.d.ts +0 -10
  168. package/daterangepicker/models/DateRangePickerPopupSettings.d.ts +0 -10
  169. package/daterangepicker/models/DateRangePickerSettings.d.ts +0 -126
  170. package/daterangepicker/models/index.d.ts +0 -9
  171. package/datetimepicker/DateTimePicker.d.ts +0 -342
  172. package/datetimepicker/DateTimeSelector.d.ts +0 -106
  173. package/datetimepicker/models/DateTimePickerSettings.d.ts +0 -144
  174. package/datetimepicker/models/index.d.ts +0 -6
  175. package/hooks/usePickerFloatingLabel.d.ts +0 -24
  176. package/messages/index.d.ts +0 -124
  177. package/package-metadata.d.ts +0 -9
  178. package/timepicker/TimeList.d.ts +0 -91
  179. package/timepicker/TimePart.d.ts +0 -141
  180. package/timepicker/TimePicker.d.ts +0 -355
  181. package/timepicker/TimeSelector.d.ts +0 -144
  182. package/timepicker/models/IncrementalSteps.d.ts +0 -12
  183. package/timepicker/models/ListItem.d.ts +0 -11
  184. package/timepicker/models/ListService.d.ts +0 -19
  185. package/timepicker/models/ListServiceSettings.d.ts +0 -16
  186. package/timepicker/models/TimePart.d.ts +0 -14
  187. package/timepicker/models/TimePickerSettings.d.ts +0 -133
  188. package/timepicker/models/index.d.ts +0 -11
  189. package/timepicker/services/DOMService.d.ts +0 -14
  190. package/timepicker/services/DayPeriodService.d.ts +0 -51
  191. package/timepicker/services/HoursService.d.ts +0 -37
  192. package/timepicker/services/MinutesService.d.ts +0 -36
  193. package/timepicker/services/SecondsService.d.ts +0 -36
  194. package/timepicker/services/index.d.ts +0 -10
  195. package/timepicker/utils.d.ts +0 -60
  196. package/utils.d.ts +0 -100
  197. package/virtualization/Virtualization.d.ts +0 -120
  198. package/virtualization/services/RowHeightService.d.ts +0 -22
  199. package/virtualization/services/ScrollerService.d.ts +0 -53
  200. package/virtualization/services/index.d.ts +0 -7
@@ -0,0 +1,78 @@
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 i from "prop-types";
11
+ import { registerForLocalization as c } from "@progress/kendo-react-intl";
12
+ import { classNames as p } from "@progress/kendo-react-common";
13
+ import { CalendarHeaderTitle as h } from "./CalendarHeaderTitle.mjs";
14
+ import { MIN_DATE as l, MAX_DATE as m } from "../../utils.mjs";
15
+ const t = class t extends s.Component {
16
+ constructor() {
17
+ super(...arguments), this.getTitle = () => {
18
+ if (!this.props.currentDate)
19
+ return "";
20
+ const e = this.rangeLength - 1, a = this.props.service.title(this.props.currentDate), r = this.props.service.addToDate(this.props.currentDate, e);
21
+ return e < 1 || !this.props.service.isInRange(r, this.min, this.max) ? a : `${a} - ${this.props.service.title(r)}`;
22
+ }, this.handleTitleClick = (e) => {
23
+ this.canMoveUp && this.props.bus.moveUp(this.props.activeView, e);
24
+ };
25
+ }
26
+ get min() {
27
+ return this.props.min !== void 0 ? this.props.min : t.defaultProps.min;
28
+ }
29
+ get max() {
30
+ return this.props.max !== void 0 ? this.props.max : t.defaultProps.max;
31
+ }
32
+ get rangeLength() {
33
+ return this.props.rangeLength !== void 0 ? this.props.rangeLength : t.defaultProps.rangeLength;
34
+ }
35
+ get canMoveUp() {
36
+ return this.props.bus.canMoveUp(this.props.activeView);
37
+ }
38
+ render() {
39
+ const e = this.getTitle(), a = p(
40
+ "k-calendar-title"
41
+ ), r = {
42
+ children: e,
43
+ value: e,
44
+ view: this.props.activeView,
45
+ className: a,
46
+ onClick: this.handleTitleClick,
47
+ disabled: !this.canMoveUp
48
+ }, o = this.props.headerTitle ? /* @__PURE__ */ s.createElement(this.props.headerTitle, { ...r }, e) : /* @__PURE__ */ s.createElement(h, { ...r }, e);
49
+ return /* @__PURE__ */ s.createElement(
50
+ "div",
51
+ {
52
+ className: p("k-calendar-header", {
53
+ "k-vstack": this.props.verticalView,
54
+ "k-hstack": !this.props.verticalView
55
+ })
56
+ },
57
+ o,
58
+ /* @__PURE__ */ s.createElement("span", { className: "k-spacer" }),
59
+ /* @__PURE__ */ s.createElement("span", { className: "k-calendar-nav k-hstack" }, this.props.commands)
60
+ );
61
+ }
62
+ };
63
+ t.propTypes = {
64
+ activeView: i.number.isRequired,
65
+ currentDate: i.instanceOf(Date).isRequired,
66
+ max: i.instanceOf(Date).isRequired,
67
+ min: i.instanceOf(Date).isRequired,
68
+ rangeLength: i.number
69
+ }, t.defaultProps = {
70
+ rangeLength: 1,
71
+ min: l,
72
+ max: m
73
+ };
74
+ let n = t;
75
+ c(n);
76
+ export {
77
+ n as Header
78
+ };
@@ -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 h=require("react"),m=require("./View.js"),r=require("../models/CalendarViewEnum.js"),d=require("@progress/kendo-react-common"),v=require("@progress/kendo-date-math"),l=require("../../utils.js");function f(i){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>i[e]})}}return s.default=i,Object.freeze(s)}const a=f(h),u=2,n=class n extends a.Component{constructor(s){super(s),this._element=null,this.isActive=!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.rotateSelectionRange=e=>{if(e.start===null||e.end===null)return e;const t=e.end<e.start;return{start:t?e.end:e.start,end:t?e.start:e.end}},this.handleDateChange=(e,t=!1)=>{const{onChange:c}=this.props;if(c){const p={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:v.cloneDate(e.value),target:this,isTodayClick:t};c.call(void 0,p)}}}get element(){return this._element}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===r.CalendarViewEnum.month)}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}componentDidUpdate(){this.isActive&&this.focusActiveDate()}render(){const s=this.props.allowReverse?this.rotateSelectionRange(this.props.selectionRange):this.props.selectionRange,e=d.classNames("k-calendar-view k-align-items-start k-justify-content-center",{"k-vstack":this.props.verticalView,"k-hstack":!this.props.verticalView,"k-calendar-monthview":this.props.activeView===r.CalendarViewEnum.month,"k-calendar-yearview":this.props.activeView===r.CalendarViewEnum.year,"k-calendar-decadeview":this.props.activeView===r.CalendarViewEnum.decade,"k-calendar-centuryview":this.props.activeView===r.CalendarViewEnum.century});return a.createElement("div",{ref:t=>{this._element=t},className:e},this.props.dates.map(t=>a.createElement("table",{className:"k-calendar-table k-content",key:t.getTime(),role:"grid"},a.createElement(m.View,{bus:this.props.bus,service:this.props.service,key:t.getTime(),direction:"horizontal",activeView:this.props.activeView,cellUID:this.props.cellUID,viewDate:t,min:this.min,max:this.max,focusedDate:this.props.focusedDate,selectionRange:s,selectedDate:this.props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,onCellEnter:this.props.onCellEnter,cell:this.props.cell,weekCell:this.props.weekCell}))))}};n.defaultProps={showWeekNumbers:!1,views:u,take:u,allowReverse:!0,min:l.MIN_DATE,max:l.MAX_DATE};let o=n;exports.HorizontalViewList=o;
@@ -0,0 +1,120 @@
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 r from "react";
10
+ import { View as p } from "./View.mjs";
11
+ import { CalendarViewEnum as s } from "../models/CalendarViewEnum.mjs";
12
+ import { classNames as h } from "@progress/kendo-react-common";
13
+ import { cloneDate as m } from "@progress/kendo-date-math";
14
+ import { MIN_DATE as u, MAX_DATE as v } from "../../utils.mjs";
15
+ const n = 2, i = class i extends r.Component {
16
+ constructor(a) {
17
+ super(a), this._element = null, this.isActive = !1, this.focusActiveDate = () => {
18
+ if (!this._element)
19
+ return;
20
+ const e = this._element.querySelector("td.k-focus"), t = this._element.querySelector(".k-state-pending-focus");
21
+ e && e[0] && e[0].classList.remove("k-focus"), t && t.classList.add("k-focus"), this.isActive = !0;
22
+ }, this.blurActiveDate = () => {
23
+ if (!this._element)
24
+ return;
25
+ const e = this._element.querySelector("td.k-focus");
26
+ e && e.classList.remove("k-focus"), this.isActive = !1;
27
+ }, this.rotateSelectionRange = (e) => {
28
+ if (e.start === null || e.end === null)
29
+ return e;
30
+ const t = e.end < e.start;
31
+ return {
32
+ start: t ? e.end : e.start,
33
+ end: t ? e.start : e.end
34
+ };
35
+ }, this.handleDateChange = (e, t = !1) => {
36
+ const { onChange: o } = this.props;
37
+ if (o) {
38
+ const c = {
39
+ syntheticEvent: e.syntheticEvent,
40
+ nativeEvent: e.nativeEvent,
41
+ value: m(e.value),
42
+ target: this,
43
+ isTodayClick: t
44
+ };
45
+ o.call(void 0, c);
46
+ }
47
+ };
48
+ }
49
+ get element() {
50
+ return this._element;
51
+ }
52
+ get weekNumber() {
53
+ return !!(this.props.showWeekNumbers && this.props.activeView === s.month);
54
+ }
55
+ get min() {
56
+ return this.props.min !== void 0 ? this.props.min : i.defaultProps.min;
57
+ }
58
+ get max() {
59
+ return this.props.max !== void 0 ? this.props.max : i.defaultProps.max;
60
+ }
61
+ componentDidUpdate() {
62
+ this.isActive && this.focusActiveDate();
63
+ }
64
+ render() {
65
+ const a = this.props.allowReverse ? this.rotateSelectionRange(this.props.selectionRange) : this.props.selectionRange, e = h(
66
+ "k-calendar-view k-align-items-start k-justify-content-center",
67
+ {
68
+ "k-vstack": this.props.verticalView,
69
+ "k-hstack": !this.props.verticalView,
70
+ "k-calendar-monthview": this.props.activeView === s.month,
71
+ "k-calendar-yearview": this.props.activeView === s.year,
72
+ "k-calendar-decadeview": this.props.activeView === s.decade,
73
+ "k-calendar-centuryview": this.props.activeView === s.century
74
+ }
75
+ );
76
+ return /* @__PURE__ */ r.createElement(
77
+ "div",
78
+ {
79
+ ref: (t) => {
80
+ this._element = t;
81
+ },
82
+ className: e
83
+ },
84
+ this.props.dates.map((t) => /* @__PURE__ */ r.createElement("table", { className: "k-calendar-table k-content", key: t.getTime(), role: "grid" }, /* @__PURE__ */ r.createElement(
85
+ p,
86
+ {
87
+ bus: this.props.bus,
88
+ service: this.props.service,
89
+ key: t.getTime(),
90
+ direction: "horizontal",
91
+ activeView: this.props.activeView,
92
+ cellUID: this.props.cellUID,
93
+ viewDate: t,
94
+ min: this.min,
95
+ max: this.max,
96
+ focusedDate: this.props.focusedDate,
97
+ selectionRange: a,
98
+ selectedDate: this.props.value,
99
+ showWeekNumbers: this.weekNumber,
100
+ onChange: this.handleDateChange,
101
+ onCellEnter: this.props.onCellEnter,
102
+ cell: this.props.cell,
103
+ weekCell: this.props.weekCell
104
+ }
105
+ )))
106
+ );
107
+ }
108
+ };
109
+ i.defaultProps = {
110
+ showWeekNumbers: !1,
111
+ views: n,
112
+ take: n,
113
+ allowReverse: !0,
114
+ min: u,
115
+ max: v
116
+ };
117
+ let l = i;
118
+ export {
119
+ l as HorizontalViewList
120
+ };
@@ -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 q=require("react"),i=require("prop-types"),I=require("@progress/kendo-react-intl"),f=require("@progress/kendo-react-common"),r=require("@progress/kendo-date-math"),O=require("@progress/kendo-react-buttons"),R=require("@progress/kendo-svg-icons"),C=require("../models/NavigationAction.js"),k=require("../models/CalendarViewEnum.js"),S=require("../models/SelectionRange.js"),_=require("./Header.js"),n=require("../../utils.js"),w=require("../../messages/index.js"),z=require("../services/BusViewService.js"),K=require("../services/NavigationService.js"),x=require("./HorizontalViewList.js"),H=require("./TodayCommand.js");function Y(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const a in l)if(a!=="default"){const u=Object.getOwnPropertyDescriptor(l,a);Object.defineProperty(s,a,u.get?u:{enumerable:!0,get:()=>l[a]})}}return s.default=l,Object.freeze(s)}const p=Y(q),F=(l=v.defaultProps.min,s=v.defaultProps.max,a)=>a instanceof Date&&!Array.isArray(a)&&n.isInRange(r.getDate(a),l,s)?r.getDate(a):null,A=(l=v.defaultProps.min,s=v.defaultProps.max,a)=>Array.isArray(a)?a.filter(u=>n.isInRange(u,l,s)).map(u=>r.getDate(u)):null,T=l=>typeof l=="object"&&!(l instanceof Date)&&l!==null&&!Array.isArray(l)?l:S.EMPTY_SELECTIONRANGE,M=(l,s,a)=>l||s&&s[0]||a&&a.start,j=(l,s)=>l.start===null&&s===null?"start":l.end===null?"end":"start",d=class d extends p.Component{constructor(s){super(s),this.dates=[],this.selectedDate=null,this.selectedMultiple=null,this.selectedRange=S.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.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:c}=t,g=t.start!==null&&e.getTime()<=t.start.getTime();return!this.props.allowReverse&&g?{start:e,end:this.selectedRange.start}:this.activeRange!=="end"?{start:e,end:h}:{start:c||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=>n.dateInRange(e,this.min,this.max),this.shouldAutoCorrect=(e,t)=>{const{end:h,start:c}=t;return this.activeRange!=="end"?h!==null&&e>h:c!==null&&e<c},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=C.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(C.Action.NextView,this.focusedDate)},this.handleKeyDown=e=>{const{keyCode:h,ctrlKey:c,metaKey:g}=e;if(h===84){const o=n.getToday();this.calculateFocusFromValue=!1,this.setState({focusedDate:o,navigateDate:o})}if((c||g)&&(h===f.Keys.left&&this.handlePrevButtonClick(),h===f.Keys.right&&this.handleNextButtonClick()),h===f.Keys.enter){const o={syntheticEvent:e,nativeEvent:e.nativeEvent,value:this.focusedDate,target:this};this.handleDateChange(o)}else{const o=n.dateInRange(this.navigation.move(this.focusedDate,this.navigation.action(e),this.state.activeView,this.service,e),this.min,this.max);if(r.isEqualDate(this.focusedDate,o))return;this.dates&&this.service&&!this.service.isInArray(o,this.dates)&&this.setState({navigateDate:o}),this.calculateFocusFromValue=!1,this.setState({focusedDate:o})}e.preventDefault()},this.handleViewChange=({view:e})=>{this.calculateFocusFromValue=!1,this.setState(t=>({activeView:e,navigateDate:t.focusedDate}))},this.handleDateChange=e=>{const t=r.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 c;switch(this.props.mode){case"single":c=r.cloneDate(e.value);break;case"multiple":if(Array.isArray(this.selectedMultiple)){const o=this.selectedMultiple.slice();let m=-1;o.forEach((L,B)=>{r.isEqualDate(L,e.value)&&(m=B)}),m!==-1?o.splice(m,1):o.push(r.cloneDate(e.value)),c=o.slice()}else this.selectedDate?c=[r.cloneDate(this.selectedDate),r.cloneDate(e.value)]:c=[r.cloneDate(e.value)];break;case"range":{c=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:c=r.cloneDate(e.value);break}this.valueDuringOnChange=c,e.isTodayClick&&this.setState({navigateDate:t}),this.setState({value:c,focusedDate:t}),this.valueDuringOnChange=c;const{onChange:g}=this.props;if(g){const o={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:c,target:this};g.call(void 0,o)}this.valueDuringOnChange=void 0};const a=s.value!==void 0?s.value:s.defaultValue||d.defaultProps.defaultValue,u=F(this.min,this.max,a),D=A(this.min,this.max,a),y=T(a),E=M(u,D,y),V=n.viewInRange(k.CalendarViewEnum[s.defaultActiveView],this.bottomView,this.topView),b=n.dateInRange(s.focusedDate||E||n.getToday(),this.min,this.max);this.state={value:a,activeView:V,focusedDate:b,navigateDate:b},this.activeRangeEnd=j(y,u),this.bus=new z.BusViewService(this.handleViewChange),this.navigation=new K.NavigationService(this.bus),this.calculateFocusFromValue=!1,this.lastView=V,this.lastViewsCount=this.props.views||x.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 r.cloneDate(this._focusedDate)}get min(){return r.getDate(this.props.min!==void 0?this.props.min:d.defaultProps.min)}get max(){return r.getDate(this.props.max!==void 0?this.props.max:d.defaultProps.max)}get bottomView(){return k.CalendarViewEnum[this.props.bottomView!==void 0?this.props.bottomView:d.defaultProps.bottomView]}get topView(){return k.CalendarViewEnum[this.props.topView!==void 0?this.props.topView:d.defaultProps.topView]}get activeRange(){return this.props.activeRangeEnd!==void 0?this.props.activeRangeEnd:this.activeRangeEnd}get todayIsInRange(){return n.isInRange(n.getToday(),r.getDate(this.min),r.getDate(this.max))}componentDidMount(){this.calculateFocusFromValue=!0}componentDidUpdate(){this.calendarViewList&&(this.isActive?this.calendarViewList.focusActiveDate:this.calendarViewList.blurActiveDate)();const s=F(this.min,this.max,this.value);this.calculateFocusFromValue=!!(this.selectedDate&&s&&this.selectedDate.getTime()&&s.getTime()),this.lastView=this.state.activeView,this.lastViewsCount=this.props.views||x.HorizontalViewList.defaultProps.views}render(){this.props._ref&&this.props._ref(this),this.intl=I.provideIntlService(this),this.localization=I.provideLocalizationService(this),this.bus.configure(this.bottomView,this.topView);const s=n.viewInRange(this.state.activeView,this.bottomView,this.topView);this.service=this.bus.service(s,this.intl),this.selectedDate=F(this.min,this.max,this.value),this.selectedMultiple=A(this.min,this.max,this.value),this.selectedRange=T(this.value);const a=M(this.selectedDate,this.selectedMultiple,this.selectedRange);this._focusedDate=n.dateInRange(this.calculateFocusFromValue&&a!==null?a:this.state.focusedDate,this.min,this.max);const u=f.classNames("k-widget k-calendar k-calendar-range",{"k-disabled":this.props.disabled},this.props.className),D=this.rangeWithFocused(this.selectedRange,this.focusedDate),y=this.localization.toLanguageString(w.prevView,w.messages[w.prevView]),E=this.localization.toLanguageString(w.nextView,w.messages[w.nextView]),V=!this.canNavigate(C.Action.PrevView),b=!this.canNavigate(C.Action.NextView),e={"aria-disabled":V},t={"aria-disabled":b},h=this.lastView!==s,c=this.dates&&this.isInMonth(this.state.navigateDate,this.dates[0]),g=this.lastViewsCount!==this.props.views;(!c||h||g)&&(this.dates=this.service.datesList(this.state.navigateDate,this.props.views||x.HorizontalViewList.defaultProps.views));const o=r.cloneDate(this.dates&&this.dates[0]?this.dates[0]:n.getToday());return p.createElement("div",{ref:m=>{this._element=m},className:u,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(_.Header,{key:`.kendo.calendar.header.${o.getTime()}`,activeView:s,currentDate:o,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(O.Button,{type:"button",className:"k-calendar-nav-prev",icon:this.isRtl?"chevron-right":"chevron-left",svgIcon:this.isRtl?R.chevronRightIcon:R.chevronLeftIcon,fillMode:"flat",title:y,disabled:V,onClick:this.handlePrevButtonClick,...e}),p.createElement(H.TodayCommand,{min:this.min,max:this.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange}),p.createElement(O.Button,{type:"button",className:"k-calendar-nav-next",icon:this.isRtl?"chevron-left":"chevron-right",svgIcon:this.isRtl?R.chevronLeftIcon:R.chevronRightIcon,fillMode:"flat",title:E,disabled:b,onClick:this.handleNextButtonClick,...t}))}),p.createElement(x.HorizontalViewList,{ref:m=>{this.calendarViewList=m},dates:this.dates,activeView:s,focusedDate:this.focusedDate,min:this.min,max:this.max,bus:this.bus,service:this.service,selectionRange:D,value:this.selectedMultiple||this.selectedDate,cellUID:this.cellUID,views:this.props.views,onChange:this.handleDateChange,showWeekNumbers:this.props.weekNumber,onCellEnter:this.handleCellEnter,cell:this.props.cell,weekCell:this.props.weekCell,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode}))}isInMonth(s,a){return!!a&&r.firstDayOfMonth(a)<=s&&s<=r.lastDayOfMonth(a)}};d.displayName="MultiViewCalendar",d.propTypes={activeRangeEnd:i.oneOf(["start","end"]),allowReverse:i.bool,bottomView:i.oneOf(["month","year","decade","century"]),className:i.string,defaultActiveView:i.oneOf(["month","year","decade","century"]),defaultValue:i.oneOfType([n.nullable(i.instanceOf(Date)),i.arrayOf(i.instanceOf(Date)),i.shape({start:n.nullable(i.instanceOf(Date)),end:n.nullable(i.instanceOf(Date))})]),disabled:i.bool,focusedDate:i.instanceOf(Date),id:i.string,ariaLabelledBy:i.string,ariaDescribedBy:i.string,max:i.instanceOf(Date),min:i.instanceOf(Date),mode:i.oneOf(["single","multiple","range"]),onBlur:i.func,onChange:i.func,onFocus:i.func,tabIndex:i.number,topView:i.oneOf(["month","year","decade","century"]),value:i.oneOfType([n.nullable(i.instanceOf(Date)),i.arrayOf(i.instanceOf(Date)),i.shape({start:n.nullable(i.instanceOf(Date).isRequired),end:n.nullable(i.instanceOf(Date).isRequired)})]),views:(s,a,u)=>{const D=s[a];return D!==void 0&&D<1?new Error(`Invalid prop '${a}' supplied to'${u}'. The '${a}' property cannot be less than 1'`):null},weekNumber:i.bool,dir:i.string},d.defaultProps={disabled:!1,min:n.MIN_DATE,max:n.MAX_DATE,navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",tabIndex:0,bottomView:"month",views:2,allowReverse:!1};let v=d;const N=f.createPropsContext(),P=f.withIdHOC(f.withPropsContext(N,v));P.displayName="KendoReactMultiViewCalendar";I.registerForIntl(v);I.registerForLocalization(v);exports.MultiViewCalendar=P;exports.MultiViewCalendarPropsContext=N;exports.MultiViewCalendarWithoutContext=v;
@@ -0,0 +1,428 @@
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 d from "react";
10
+ import s from "prop-types";
11
+ import { provideIntlService as q, provideLocalizationService as H, registerForIntl as j, registerForLocalization as G } from "@progress/kendo-react-intl";
12
+ import { Keys as E, classNames as X, createPropsContext as J, withIdHOC as Q, withPropsContext as Z } from "@progress/kendo-react-common";
13
+ import { isEqualDate as O, cloneDate as u, getDate as f, firstDayOfMonth as W, lastDayOfMonth as ee } from "@progress/kendo-date-math";
14
+ import { Button as T } from "@progress/kendo-react-buttons";
15
+ import { chevronRightIcon as M, chevronLeftIcon as N } from "@progress/kendo-svg-icons";
16
+ import { Action as y } from "../models/NavigationAction.mjs";
17
+ import { CalendarViewEnum as I } from "../models/CalendarViewEnum.mjs";
18
+ import { EMPTY_SELECTIONRANGE as Y } from "../models/SelectionRange.mjs";
19
+ import { Header as te } from "./Header.mjs";
20
+ import { dateInRange as R, getToday as C, viewInRange as P, nullable as D, MIN_DATE as se, MAX_DATE as ie, isInRange as A } from "../../utils.mjs";
21
+ import { prevView as S, messages as B, nextView as L } from "../../messages/index.mjs";
22
+ import { BusViewService as ae } from "../services/BusViewService.mjs";
23
+ import { NavigationService as ne } from "../services/NavigationService.mjs";
24
+ import { HorizontalViewList as x } from "./HorizontalViewList.mjs";
25
+ import { TodayCommand as le } from "./TodayCommand.mjs";
26
+ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Date && !Array.isArray(a) && A(f(a), o, i) ? f(a) : null, _ = (o = p.defaultProps.min, i = p.defaultProps.max, a) => Array.isArray(a) ? a.filter((h) => A(h, o, i)).map((h) => f(h)) : null, K = (o) => typeof o == "object" && !(o instanceof Date) && o !== null && !Array.isArray(o) ? o : Y, z = (o, i, a) => o || i && i[0] || a && a.start, re = (o, i) => o.start === null && i === null ? "start" : o.end === null ? "end" : "start", c = class c extends d.Component {
27
+ constructor(i) {
28
+ super(i), this.dates = [], this.selectedDate = null, this.selectedMultiple = null, this.selectedRange = Y, this._focusedDate = /* @__PURE__ */ 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.focus = () => {
29
+ this._element && this._element.focus();
30
+ }, this.clampRange = (e) => ({ start: e, end: null }), this.rangeWithFocused = (e, t) => ({
31
+ start: e.start,
32
+ end: e.end === null && e.start !== null && this.isActive ? t : e.end
33
+ }), this.generateRange = (e, t) => {
34
+ const { end: r, start: l } = t, m = t.start !== null && e.getTime() <= t.start.getTime();
35
+ return !this.props.allowReverse && m ? { start: e, end: this.selectedRange.start } : this.activeRange !== "end" ? { start: e, end: r } : { start: l || this.selectedDate, end: e };
36
+ }, this.canNavigate = (e) => {
37
+ if (!this.service)
38
+ return !1;
39
+ const t = this.service.move(this.focusedDate, e);
40
+ return this.min <= t && t <= this.max || this.service.isInSameView(t, this.min) || this.service.isInSameView(t, this.max);
41
+ }, this.navigate = (e, t) => {
42
+ this.calculateFocusFromValue = !1;
43
+ const r = this.move(e, t);
44
+ this.setState({ navigateDate: r, focusedDate: r });
45
+ }, this.move = (e, t) => this.clampDate(this.service.move(t, e)), this.clampDate = (e) => R(e, this.min, this.max), this.shouldAutoCorrect = (e, t) => {
46
+ const { end: r, start: l } = t;
47
+ return this.activeRange !== "end" ? r !== null && e > r : l !== null && e < l;
48
+ }, this.handleCellEnter = (e) => {
49
+ this.props.mode === "range" && (this.calculateFocusFromValue = !1, this.setState({
50
+ focusedDate: e
51
+ }));
52
+ }, this.handleMouseDown = (e) => {
53
+ e.preventDefault();
54
+ }, this.handleClick = (e) => {
55
+ this._element && this._element.focus({ preventScroll: !0 });
56
+ }, this.handleFocus = (e) => {
57
+ if (this.isActive = !0, !this.calendarViewList)
58
+ return;
59
+ this.calendarViewList.focusActiveDate();
60
+ const { onFocus: t } = this.props;
61
+ t && t.call(void 0, e);
62
+ }, this.handleBlur = (e) => {
63
+ if (this.isActive = !1, !this.calendarViewList)
64
+ return;
65
+ this.calendarViewList.blurActiveDate();
66
+ const { onBlur: t } = this.props;
67
+ t && t.call(void 0, e);
68
+ }, this.handleTodayClick = (e) => {
69
+ this.todayIsInRange && this.handleDateChange(e);
70
+ }, this.handlePrevButtonClick = () => {
71
+ const e = y.PrevView;
72
+ if (this.state.activeView > 0 && this.focusedDate.getFullYear() > this.dates[0].getFullYear())
73
+ this.navigate(e, this.move(e, this.focusedDate));
74
+ else {
75
+ const t = this.isInMonth(this.focusedDate, this.dates[1]) ? this.move(e, this.focusedDate) : this.focusedDate;
76
+ this.navigate(e, t);
77
+ }
78
+ }, this.handleNextButtonClick = () => {
79
+ this.navigate(y.NextView, this.focusedDate);
80
+ }, this.handleKeyDown = (e) => {
81
+ const { keyCode: r, ctrlKey: l, metaKey: m } = e;
82
+ if (r === 84) {
83
+ const n = C();
84
+ this.calculateFocusFromValue = !1, this.setState({ focusedDate: n, navigateDate: n });
85
+ }
86
+ if ((l || m) && (r === E.left && this.handlePrevButtonClick(), r === E.right && this.handleNextButtonClick()), r === E.enter) {
87
+ const n = {
88
+ syntheticEvent: e,
89
+ nativeEvent: e.nativeEvent,
90
+ value: this.focusedDate,
91
+ target: this
92
+ };
93
+ this.handleDateChange(n);
94
+ } else {
95
+ const n = R(
96
+ this.navigation.move(
97
+ this.focusedDate,
98
+ this.navigation.action(e),
99
+ this.state.activeView,
100
+ this.service,
101
+ e
102
+ ),
103
+ this.min,
104
+ this.max
105
+ );
106
+ if (O(this.focusedDate, n))
107
+ return;
108
+ this.dates && this.service && !this.service.isInArray(n, this.dates) && this.setState({ navigateDate: n }), this.calculateFocusFromValue = !1, this.setState({ focusedDate: n });
109
+ }
110
+ e.preventDefault();
111
+ }, this.handleViewChange = ({ view: e }) => {
112
+ this.calculateFocusFromValue = !1, this.setState((t) => ({ activeView: e, navigateDate: t.focusedDate }));
113
+ }, this.handleDateChange = (e) => {
114
+ const t = u(e.value), r = this.bus.canMoveDown(this.state.activeView);
115
+ if (this.props.disabled)
116
+ return;
117
+ if (r)
118
+ if (e.isTodayClick)
119
+ this.bus.moveToBottom(this.state.activeView);
120
+ else {
121
+ this.bus.moveDown(this.state.activeView, e.syntheticEvent), this.setState({ focusedDate: t, navigateDate: t });
122
+ return;
123
+ }
124
+ this.calculateFocusFromValue = !0;
125
+ let l;
126
+ switch (this.props.mode) {
127
+ case "single":
128
+ l = u(e.value);
129
+ break;
130
+ case "multiple":
131
+ if (Array.isArray(this.selectedMultiple)) {
132
+ const n = this.selectedMultiple.slice();
133
+ let v = -1;
134
+ n.forEach((U, $) => {
135
+ O(U, e.value) && (v = $);
136
+ }), v !== -1 ? n.splice(v, 1) : n.push(u(e.value)), l = n.slice();
137
+ } else
138
+ this.selectedDate ? l = [u(this.selectedDate), u(e.value)] : l = [u(e.value)];
139
+ break;
140
+ case "range": {
141
+ 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";
142
+ break;
143
+ }
144
+ default:
145
+ l = u(e.value);
146
+ break;
147
+ }
148
+ this.valueDuringOnChange = l, e.isTodayClick && this.setState({ navigateDate: t }), this.setState({ value: l, focusedDate: t }), this.valueDuringOnChange = l;
149
+ const { onChange: m } = this.props;
150
+ if (m) {
151
+ const n = {
152
+ syntheticEvent: e.syntheticEvent,
153
+ nativeEvent: e.nativeEvent,
154
+ value: l,
155
+ target: this
156
+ };
157
+ m.call(void 0, n);
158
+ }
159
+ this.valueDuringOnChange = void 0;
160
+ };
161
+ const a = i.value !== void 0 ? i.value : i.defaultValue || c.defaultProps.defaultValue, h = k(this.min, this.max, a), g = _(this.min, this.max, a), b = K(a), F = z(h, g, b), w = P(
162
+ I[i.defaultActiveView],
163
+ this.bottomView,
164
+ this.topView
165
+ ), V = R(
166
+ i.focusedDate || F || C(),
167
+ this.min,
168
+ this.max
169
+ );
170
+ this.state = {
171
+ value: a,
172
+ activeView: w,
173
+ focusedDate: V,
174
+ navigateDate: V
175
+ }, this.activeRangeEnd = re(b, h), this.bus = new ae(this.handleViewChange), this.navigation = new ne(this.bus), this.calculateFocusFromValue = !1, this.lastView = w, this.lastViewsCount = this.props.views || x.defaultProps.views;
176
+ }
177
+ get wrapperID() {
178
+ return this.props.id + "-wrapper-id";
179
+ }
180
+ get isRtl() {
181
+ return this.props.dir === "rtl";
182
+ }
183
+ /**
184
+ * Gets the wrapping element of the MultiViewCalendar component.
185
+ */
186
+ get element() {
187
+ return this._element;
188
+ }
189
+ /**
190
+ * Gets the value of the MultiViewCalendar.
191
+ */
192
+ get value() {
193
+ return this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value;
194
+ }
195
+ /**
196
+ * Gets the current focused date of the MultiViewCalendar.
197
+ */
198
+ get focusedDate() {
199
+ return u(this._focusedDate);
200
+ }
201
+ get min() {
202
+ return f(this.props.min !== void 0 ? this.props.min : c.defaultProps.min);
203
+ }
204
+ get max() {
205
+ return f(this.props.max !== void 0 ? this.props.max : c.defaultProps.max);
206
+ }
207
+ get bottomView() {
208
+ return I[this.props.bottomView !== void 0 ? this.props.bottomView : c.defaultProps.bottomView];
209
+ }
210
+ get topView() {
211
+ return I[this.props.topView !== void 0 ? this.props.topView : c.defaultProps.topView];
212
+ }
213
+ get activeRange() {
214
+ return this.props.activeRangeEnd !== void 0 ? this.props.activeRangeEnd : this.activeRangeEnd;
215
+ }
216
+ get todayIsInRange() {
217
+ return A(C(), f(this.min), f(this.max));
218
+ }
219
+ /**
220
+ * @hidden
221
+ */
222
+ componentDidMount() {
223
+ this.calculateFocusFromValue = !0;
224
+ }
225
+ /**
226
+ * @hidden
227
+ */
228
+ componentDidUpdate() {
229
+ this.calendarViewList && (this.isActive ? this.calendarViewList.focusActiveDate : this.calendarViewList.blurActiveDate)();
230
+ const i = k(this.min, this.max, this.value);
231
+ this.calculateFocusFromValue = !!(this.selectedDate && i && this.selectedDate.getTime() && i.getTime()), this.lastView = this.state.activeView, this.lastViewsCount = this.props.views || x.defaultProps.views;
232
+ }
233
+ /**
234
+ * @hidden
235
+ */
236
+ render() {
237
+ this.props._ref && this.props._ref(this), this.intl = q(this), this.localization = H(this), this.bus.configure(this.bottomView, this.topView);
238
+ const i = P(this.state.activeView, this.bottomView, this.topView);
239
+ this.service = this.bus.service(i, this.intl), this.selectedDate = k(this.min, this.max, this.value), this.selectedMultiple = _(this.min, this.max, this.value), this.selectedRange = K(this.value);
240
+ const a = z(this.selectedDate, this.selectedMultiple, this.selectedRange);
241
+ this._focusedDate = R(
242
+ this.calculateFocusFromValue && a !== null ? a : this.state.focusedDate,
243
+ this.min,
244
+ this.max
245
+ );
246
+ const h = X(
247
+ "k-widget k-calendar k-calendar-range",
248
+ {
249
+ "k-disabled": this.props.disabled
250
+ },
251
+ this.props.className
252
+ ), g = this.rangeWithFocused(this.selectedRange, this.focusedDate), b = this.localization.toLanguageString(S, B[S]), F = this.localization.toLanguageString(L, B[L]), w = !this.canNavigate(y.PrevView), V = !this.canNavigate(y.NextView), e = { "aria-disabled": w }, t = { "aria-disabled": V }, r = this.lastView !== i, l = this.dates && this.isInMonth(this.state.navigateDate, this.dates[0]), m = this.lastViewsCount !== this.props.views;
253
+ (!l || r || m) && (this.dates = this.service.datesList(
254
+ this.state.navigateDate,
255
+ this.props.views || x.defaultProps.views
256
+ ));
257
+ const n = u(this.dates && this.dates[0] ? this.dates[0] : C());
258
+ return /* @__PURE__ */ d.createElement(
259
+ "div",
260
+ {
261
+ ref: (v) => {
262
+ this._element = v;
263
+ },
264
+ className: h,
265
+ id: this.props.id || this.wrapperID,
266
+ "aria-labelledby": this.props.ariaLabelledBy,
267
+ "aria-describedby": this.props.ariaDescribedBy,
268
+ tabIndex: this.props.disabled ? void 0 : this.props.tabIndex,
269
+ onFocus: this.handleFocus,
270
+ onBlur: this.handleBlur,
271
+ onMouseDown: this.handleMouseDown,
272
+ onClick: this.handleClick,
273
+ onKeyDown: this.handleKeyDown,
274
+ "aria-disabled": this.props.disabled,
275
+ dir: this.props.dir
276
+ },
277
+ /* @__PURE__ */ d.createElement(
278
+ te,
279
+ {
280
+ key: `.kendo.calendar.header.${n.getTime()}`,
281
+ activeView: i,
282
+ currentDate: n,
283
+ min: this.min,
284
+ max: this.max,
285
+ rangeLength: this.props.views,
286
+ bus: this.bus,
287
+ service: this.service,
288
+ headerTitle: this.props.headerTitle,
289
+ verticalView: this.props.mobileMode,
290
+ commands: /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement(
291
+ T,
292
+ {
293
+ type: "button",
294
+ className: "k-calendar-nav-prev",
295
+ icon: this.isRtl ? "chevron-right" : "chevron-left",
296
+ svgIcon: this.isRtl ? M : N,
297
+ fillMode: "flat",
298
+ title: b,
299
+ disabled: w,
300
+ onClick: this.handlePrevButtonClick,
301
+ ...e
302
+ }
303
+ ), /* @__PURE__ */ d.createElement(
304
+ le,
305
+ {
306
+ min: this.min,
307
+ max: this.max,
308
+ onClick: this.handleTodayClick,
309
+ disabled: !this.todayIsInRange
310
+ }
311
+ ), /* @__PURE__ */ d.createElement(
312
+ T,
313
+ {
314
+ type: "button",
315
+ className: "k-calendar-nav-next",
316
+ icon: this.isRtl ? "chevron-left" : "chevron-right",
317
+ svgIcon: this.isRtl ? N : M,
318
+ fillMode: "flat",
319
+ title: F,
320
+ disabled: V,
321
+ onClick: this.handleNextButtonClick,
322
+ ...t
323
+ }
324
+ ))
325
+ }
326
+ ),
327
+ /* @__PURE__ */ d.createElement(
328
+ x,
329
+ {
330
+ ref: (v) => {
331
+ this.calendarViewList = v;
332
+ },
333
+ dates: this.dates,
334
+ activeView: i,
335
+ focusedDate: this.focusedDate,
336
+ min: this.min,
337
+ max: this.max,
338
+ bus: this.bus,
339
+ service: this.service,
340
+ selectionRange: g,
341
+ value: this.selectedMultiple || this.selectedDate,
342
+ cellUID: this.cellUID,
343
+ views: this.props.views,
344
+ onChange: this.handleDateChange,
345
+ showWeekNumbers: this.props.weekNumber,
346
+ onCellEnter: this.handleCellEnter,
347
+ cell: this.props.cell,
348
+ weekCell: this.props.weekCell,
349
+ headerTitle: this.props.headerTitle,
350
+ verticalView: this.props.mobileMode
351
+ }
352
+ )
353
+ );
354
+ }
355
+ // protected isListInRange = (list: Date[]): boolean => {
356
+ // return this.min < list[0]
357
+ // && this.max > list[Math.max(0, (this.props.views || MultiViewCalendarWithoutContext.defaultProps.views) - 1)];
358
+ // };
359
+ isInMonth(i, a) {
360
+ return !!a && W(a) <= i && i <= ee(a);
361
+ }
362
+ };
363
+ c.displayName = "MultiViewCalendar", c.propTypes = {
364
+ activeRangeEnd: s.oneOf(["start", "end"]),
365
+ allowReverse: s.bool,
366
+ bottomView: s.oneOf(["month", "year", "decade", "century"]),
367
+ className: s.string,
368
+ defaultActiveView: s.oneOf(["month", "year", "decade", "century"]),
369
+ defaultValue: s.oneOfType([
370
+ D(s.instanceOf(Date)),
371
+ s.arrayOf(s.instanceOf(Date)),
372
+ s.shape({
373
+ start: D(s.instanceOf(Date)),
374
+ end: D(s.instanceOf(Date))
375
+ })
376
+ ]),
377
+ disabled: s.bool,
378
+ focusedDate: s.instanceOf(Date),
379
+ id: s.string,
380
+ ariaLabelledBy: s.string,
381
+ ariaDescribedBy: s.string,
382
+ max: s.instanceOf(Date),
383
+ min: s.instanceOf(Date),
384
+ mode: s.oneOf(["single", "multiple", "range"]),
385
+ onBlur: s.func,
386
+ onChange: s.func,
387
+ onFocus: s.func,
388
+ tabIndex: s.number,
389
+ topView: s.oneOf(["month", "year", "decade", "century"]),
390
+ value: s.oneOfType([
391
+ D(s.instanceOf(Date)),
392
+ s.arrayOf(s.instanceOf(Date)),
393
+ s.shape({
394
+ start: D(s.instanceOf(Date).isRequired),
395
+ end: D(s.instanceOf(Date).isRequired)
396
+ })
397
+ ]),
398
+ views: (i, a, h) => {
399
+ const g = i[a];
400
+ return g !== void 0 && g < 1 ? new Error(
401
+ `Invalid prop '${a}' supplied to'${h}'. The '${a}' property cannot be less than 1'`
402
+ ) : null;
403
+ },
404
+ weekNumber: s.bool,
405
+ dir: s.string
406
+ }, c.defaultProps = {
407
+ disabled: !1,
408
+ min: se,
409
+ max: ie,
410
+ navigation: !0,
411
+ defaultActiveView: "month",
412
+ defaultValue: null,
413
+ topView: "century",
414
+ tabIndex: 0,
415
+ bottomView: "month",
416
+ views: 2,
417
+ allowReverse: !1
418
+ };
419
+ let p = c;
420
+ const oe = J(), he = Q(Z(oe, p));
421
+ he.displayName = "KendoReactMultiViewCalendar";
422
+ j(p);
423
+ G(p);
424
+ export {
425
+ he as MultiViewCalendar,
426
+ oe as MultiViewCalendarPropsContext,
427
+ p as MultiViewCalendarWithoutContext
428
+ };