@progress/kendo-react-dateinputs 7.5.0-develop.20 → 7.5.0-develop.21
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/CalendarCell.js +1 -1
- package/calendar/components/CalendarCell.mjs +29 -28
- package/calendar/components/CalendarWeekCell.js +1 -1
- package/calendar/components/CalendarWeekCell.mjs +12 -10
- package/calendar/components/HorizontalViewList.js +1 -1
- package/calendar/components/HorizontalViewList.mjs +31 -26
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +187 -163
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +40 -34
- package/common/ClearButton.js +8 -0
- package/common/ClearButton.mjs +41 -0
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +32 -29
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +6 -4
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +17 -0
- package/index.d.ts +17 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +38 -36
- package/package-metadata.mjs +1 -1
- package/package.json +7 -7
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),O=require("@progress/kendo-react-common");function R(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>n[e]})}}return t.default=n,Object.freeze(t)}const l=R(C),y=(n,t)=>{const e=Object.getOwnPropertyNames(n),s=Object.getOwnPropertyNames(t);if(e.length!==s.length)return!1;for(let r=0;r<e.length;r++){const o=e[r];if(n[o]!==t[o])return!1}return!0};class N extends l.Component{constructor(){super(...arguments),this.handleClick=t=>{const{onClick:e,value:s}=this.props;e&&e.call(void 0,s,t)},this.handleMouseEnter=()=>{const{onMouseEnter:t,value:e}=this.props;t&&t.call(void 0,e)},this.handleMouseLeave=()=>{const{onMouseLeave:t,value:e}=this.props;t&&t.call(void 0,e)}}shouldComponentUpdate(t){const{value:e,...s}=this.props,{value:r,...o}=t;return!((!(e&&r)||e.getTime()===r.getTime())&&y(s,o))}render(){const{className:t,formattedValue:e,isWeekend:s,isFocused:r,isInRange:o,isSelected:d,isRangeStart:i,isRangeMid:p,isRangeEnd:c,isRangeSplitStart:h,isRangeSplitEnd:g,isToday:m,isDisabled:k,view:S,value:w,isOtherMonth:a,showOtherMonthDays:v,allowReverse:u,...f}=this.props,E=this.props.activeRangeEnd==="end"&&c,M=this.props.activeRangeEnd==="start"&&i,b=O.classNames("k-calendar-td",{"k-range-start":!a&&!u&&i,"k-range-end":!a&&!u&&c,"k-range-mid":!a&&p,"k-range-split-end":!a&&g,"k-range-split-start":!a&&h,"k-active":M||E,"k-state-pending-focus":r,"k-selected":!a&&(d||i||c),"k-today":!a&&m,"k-weekend":s,"k-disabled":k,"k-other-month":a},t);return!v&&a?l.createElement("td",{role:"gridcell",className:"k-empty k-calendar-td"}):l.createElement("td",{...f,className:b,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},l.createElement("span",{className:"k-link"},this.props.children))}}exports.CalendarCell=N;
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as r from "react";
|
|
10
10
|
import { classNames as C } from "@progress/kendo-react-common";
|
|
11
|
-
const N = (
|
|
12
|
-
const t = Object.getOwnPropertyNames(
|
|
11
|
+
const N = (l, e) => {
|
|
12
|
+
const t = Object.getOwnPropertyNames(l), a = Object.getOwnPropertyNames(e);
|
|
13
13
|
if (t.length !== a.length)
|
|
14
14
|
return !1;
|
|
15
15
|
for (let n = 0; n < t.length; n++) {
|
|
16
16
|
const o = t[n];
|
|
17
|
-
if (
|
|
17
|
+
if (l[o] !== e[o])
|
|
18
18
|
return !1;
|
|
19
19
|
}
|
|
20
20
|
return !0;
|
|
21
21
|
};
|
|
22
|
-
class
|
|
22
|
+
class P extends r.Component {
|
|
23
23
|
constructor() {
|
|
24
24
|
super(...arguments), this.handleClick = (e) => {
|
|
25
25
|
const { onClick: t, value: a } = this.props;
|
|
@@ -56,41 +56,42 @@ class O extends r.Component {
|
|
|
56
56
|
isFocused: n,
|
|
57
57
|
isInRange: o,
|
|
58
58
|
isSelected: d,
|
|
59
|
-
isRangeStart:
|
|
60
|
-
isRangeMid:
|
|
59
|
+
isRangeStart: i,
|
|
60
|
+
isRangeMid: u,
|
|
61
61
|
isRangeEnd: c,
|
|
62
|
-
isRangeSplitStart:
|
|
63
|
-
isRangeSplitEnd:
|
|
64
|
-
isToday:
|
|
65
|
-
isDisabled:
|
|
66
|
-
view:
|
|
67
|
-
value:
|
|
62
|
+
isRangeSplitStart: h,
|
|
63
|
+
isRangeSplitEnd: m,
|
|
64
|
+
isToday: g,
|
|
65
|
+
isDisabled: k,
|
|
66
|
+
view: w,
|
|
67
|
+
value: y,
|
|
68
68
|
isOtherMonth: s,
|
|
69
|
-
showOtherMonthDays:
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
showOtherMonthDays: v,
|
|
70
|
+
allowReverse: p,
|
|
71
|
+
...E
|
|
72
|
+
} = this.props, f = this.props.activeRangeEnd === "end" && c, M = this.props.activeRangeEnd === "start" && i, R = C(
|
|
72
73
|
"k-calendar-td",
|
|
73
74
|
{
|
|
74
|
-
"k-range-
|
|
75
|
-
"k-range-
|
|
76
|
-
"k-range-
|
|
77
|
-
"k-range-split-
|
|
78
|
-
"k-range-start": !s &&
|
|
79
|
-
"k-active":
|
|
75
|
+
"k-range-start": !s && !p && i,
|
|
76
|
+
"k-range-end": !s && !p && c,
|
|
77
|
+
"k-range-mid": !s && u,
|
|
78
|
+
"k-range-split-end": !s && m,
|
|
79
|
+
"k-range-split-start": !s && h,
|
|
80
|
+
"k-active": M || f,
|
|
80
81
|
"k-state-pending-focus": n,
|
|
81
|
-
"k-selected": !s && (d ||
|
|
82
|
-
"k-today": !s &&
|
|
82
|
+
"k-selected": !s && (d || i || c),
|
|
83
|
+
"k-today": !s && g,
|
|
83
84
|
"k-weekend": a,
|
|
84
|
-
"k-disabled":
|
|
85
|
+
"k-disabled": k,
|
|
85
86
|
"k-other-month": s
|
|
86
87
|
},
|
|
87
88
|
e
|
|
88
89
|
);
|
|
89
|
-
return !
|
|
90
|
+
return !v && s ? /* @__PURE__ */ r.createElement("td", { role: "gridcell", className: "k-empty k-calendar-td" }) : /* @__PURE__ */ r.createElement(
|
|
90
91
|
"td",
|
|
91
92
|
{
|
|
92
|
-
...
|
|
93
|
-
className:
|
|
93
|
+
...E,
|
|
94
|
+
className: R,
|
|
94
95
|
onClick: this.handleClick,
|
|
95
96
|
onMouseEnter: this.handleMouseEnter,
|
|
96
97
|
onMouseLeave: this.handleMouseLeave
|
|
@@ -100,5 +101,5 @@ class O extends r.Component {
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
export {
|
|
103
|
-
|
|
104
|
+
P as CalendarCell
|
|
104
105
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),o=require("@progress/kendo-react-common");function
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),o=require("@progress/kendo-react-common");function l(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const a=l(c);class i extends a.Component{constructor(){super(...arguments),this.handleClick=e=>{const{onClick:t,firstDate:n,weekDays:s}=this.props;t&&e&&t.call(void 0,n,s||[],e)}}render(){const{className:e,firstDate:t,weekDays:n,...s}=this.props;return a.createElement("td",{className:o.classNames("k-calendar-td",e),...s,onClick:this.handleClick},this.props.children)}}exports.CalendarWeekCell=i;
|
|
@@ -6,18 +6,20 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import { classNames as
|
|
11
|
-
class
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
import * as a from "react";
|
|
10
|
+
import { classNames as l } from "@progress/kendo-react-common";
|
|
11
|
+
class i extends a.Component {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.handleClick = (e) => {
|
|
14
|
+
const { onClick: s, firstDate: r, weekDays: t } = this.props;
|
|
15
|
+
s && e && s.call(void 0, r, t || [], e);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
16
18
|
render() {
|
|
17
|
-
const { className:
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
+
const { className: e, firstDate: s, weekDays: r, ...t } = this.props;
|
|
20
|
+
return /* @__PURE__ */ a.createElement("td", { className: l("k-calendar-td", e), ...t, onClick: this.handleClick }, this.props.children);
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
export {
|
|
22
|
-
|
|
24
|
+
i as CalendarWeekCell
|
|
23
25
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),m=require("./View.js"),a=require("../models/CalendarViewEnum.js"),d=require("@progress/kendo-react-common"),v=require("@progress/kendo-date-math"),h=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 l=f(u),p=2,n=class n extends l.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.handleWeekCellClick=(e,t,r)=>{const{onWeekSelect:o}=this.props;o&&r&&o.call(void 0,e,t,r)},this.handleDateChange=(e,t=!1)=>{const{onChange:r}=this.props;if(r){const o={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:v.cloneDate(e.value),target:this,isTodayClick:t};r.call(void 0,o)}}}get element(){return this._element}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===a.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===a.CalendarViewEnum.month,"k-calendar-yearview":this.props.activeView===a.CalendarViewEnum.year,"k-calendar-decadeview":this.props.activeView===a.CalendarViewEnum.decade,"k-calendar-centuryview":this.props.activeView===a.CalendarViewEnum.century});return l.createElement("div",{ref:t=>{this._element=t},className:e},this.props.dates.map(t=>l.createElement("table",{className:"k-calendar-table",key:t.getTime(),role:"grid"},l.createElement(m.View,{bus:this.props.bus,weekDaysFormat:this.props.weekDaysFormat,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,onWeekSelect:this.handleWeekCellClick,onCellEnter:this.props.onCellEnter,cell:this.props.cell,weekCell:this.props.weekCell,showOtherMonthDays:this.props.showOtherMonthDays,allowReverse:this.props.allowReverse}))))}};n.defaultProps={showWeekNumbers:!1,views:p,take:p,allowReverse:!0,weekDaysFormat:"short",min:h.MIN_DATE,max:h.MAX_DATE};let c=n;exports.HorizontalViewList=c;
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as o from "react";
|
|
10
10
|
import { View as h } from "./View.mjs";
|
|
11
|
-
import { CalendarViewEnum as
|
|
11
|
+
import { CalendarViewEnum as i } from "../models/CalendarViewEnum.mjs";
|
|
12
12
|
import { classNames as p } from "@progress/kendo-react-common";
|
|
13
13
|
import { cloneDate as m } from "@progress/kendo-date-math";
|
|
14
|
-
import { MIN_DATE as u, MAX_DATE as
|
|
15
|
-
const n = 2,
|
|
16
|
-
constructor(
|
|
17
|
-
super(
|
|
14
|
+
import { MIN_DATE as u, MAX_DATE as d } from "../../utils.mjs";
|
|
15
|
+
const n = 2, r = class r extends o.Component {
|
|
16
|
+
constructor(l) {
|
|
17
|
+
super(l), this._element = null, this.isActive = !1, this.focusActiveDate = () => {
|
|
18
18
|
if (!this._element)
|
|
19
19
|
return;
|
|
20
20
|
const e = this._element.querySelector("td.k-focus"), t = this._element.querySelector(".k-state-pending-focus");
|
|
@@ -32,17 +32,20 @@ const n = 2, i = class i extends r.Component {
|
|
|
32
32
|
start: t ? e.end : e.start,
|
|
33
33
|
end: t ? e.start : e.end
|
|
34
34
|
};
|
|
35
|
+
}, this.handleWeekCellClick = (e, t, s) => {
|
|
36
|
+
const { onWeekSelect: a } = this.props;
|
|
37
|
+
a && s && a.call(void 0, e, t, s);
|
|
35
38
|
}, this.handleDateChange = (e, t = !1) => {
|
|
36
|
-
const { onChange:
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
+
const { onChange: s } = this.props;
|
|
40
|
+
if (s) {
|
|
41
|
+
const a = {
|
|
39
42
|
syntheticEvent: e.syntheticEvent,
|
|
40
43
|
nativeEvent: e.nativeEvent,
|
|
41
44
|
value: m(e.value),
|
|
42
45
|
target: this,
|
|
43
46
|
isTodayClick: t
|
|
44
47
|
};
|
|
45
|
-
|
|
48
|
+
s.call(void 0, a);
|
|
46
49
|
}
|
|
47
50
|
};
|
|
48
51
|
}
|
|
@@ -50,30 +53,30 @@ const n = 2, i = class i extends r.Component {
|
|
|
50
53
|
return this._element;
|
|
51
54
|
}
|
|
52
55
|
get weekNumber() {
|
|
53
|
-
return !!(this.props.showWeekNumbers && this.props.activeView ===
|
|
56
|
+
return !!(this.props.showWeekNumbers && this.props.activeView === i.month);
|
|
54
57
|
}
|
|
55
58
|
get min() {
|
|
56
|
-
return this.props.min !== void 0 ? this.props.min :
|
|
59
|
+
return this.props.min !== void 0 ? this.props.min : r.defaultProps.min;
|
|
57
60
|
}
|
|
58
61
|
get max() {
|
|
59
|
-
return this.props.max !== void 0 ? this.props.max :
|
|
62
|
+
return this.props.max !== void 0 ? this.props.max : r.defaultProps.max;
|
|
60
63
|
}
|
|
61
64
|
componentDidUpdate() {
|
|
62
65
|
this.isActive && this.focusActiveDate();
|
|
63
66
|
}
|
|
64
67
|
render() {
|
|
65
|
-
const
|
|
68
|
+
const l = this.props.allowReverse ? this.rotateSelectionRange(this.props.selectionRange) : this.props.selectionRange, e = p(
|
|
66
69
|
"k-calendar-view k-align-items-start k-justify-content-center",
|
|
67
70
|
{
|
|
68
71
|
"k-vstack": this.props.verticalView,
|
|
69
72
|
"k-hstack": !this.props.verticalView,
|
|
70
|
-
"k-calendar-monthview": this.props.activeView ===
|
|
71
|
-
"k-calendar-yearview": this.props.activeView ===
|
|
72
|
-
"k-calendar-decadeview": this.props.activeView ===
|
|
73
|
-
"k-calendar-centuryview": this.props.activeView ===
|
|
73
|
+
"k-calendar-monthview": this.props.activeView === i.month,
|
|
74
|
+
"k-calendar-yearview": this.props.activeView === i.year,
|
|
75
|
+
"k-calendar-decadeview": this.props.activeView === i.decade,
|
|
76
|
+
"k-calendar-centuryview": this.props.activeView === i.century
|
|
74
77
|
}
|
|
75
78
|
);
|
|
76
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ o.createElement(
|
|
77
80
|
"div",
|
|
78
81
|
{
|
|
79
82
|
ref: (t) => {
|
|
@@ -81,7 +84,7 @@ const n = 2, i = class i extends r.Component {
|
|
|
81
84
|
},
|
|
82
85
|
className: e
|
|
83
86
|
},
|
|
84
|
-
this.props.dates.map((t) => /* @__PURE__ */
|
|
87
|
+
this.props.dates.map((t) => /* @__PURE__ */ o.createElement("table", { className: "k-calendar-table", key: t.getTime(), role: "grid" }, /* @__PURE__ */ o.createElement(
|
|
85
88
|
h,
|
|
86
89
|
{
|
|
87
90
|
bus: this.props.bus,
|
|
@@ -95,29 +98,31 @@ const n = 2, i = class i extends r.Component {
|
|
|
95
98
|
min: this.min,
|
|
96
99
|
max: this.max,
|
|
97
100
|
focusedDate: this.props.focusedDate,
|
|
98
|
-
selectionRange:
|
|
101
|
+
selectionRange: l,
|
|
99
102
|
selectedDate: this.props.value,
|
|
100
103
|
showWeekNumbers: this.weekNumber,
|
|
101
104
|
onChange: this.handleDateChange,
|
|
105
|
+
onWeekSelect: this.handleWeekCellClick,
|
|
102
106
|
onCellEnter: this.props.onCellEnter,
|
|
103
107
|
cell: this.props.cell,
|
|
104
108
|
weekCell: this.props.weekCell,
|
|
105
|
-
showOtherMonthDays: this.props.showOtherMonthDays
|
|
109
|
+
showOtherMonthDays: this.props.showOtherMonthDays,
|
|
110
|
+
allowReverse: this.props.allowReverse
|
|
106
111
|
}
|
|
107
112
|
)))
|
|
108
113
|
);
|
|
109
114
|
}
|
|
110
115
|
};
|
|
111
|
-
|
|
116
|
+
r.defaultProps = {
|
|
112
117
|
showWeekNumbers: !1,
|
|
113
118
|
views: n,
|
|
114
119
|
take: n,
|
|
115
120
|
allowReverse: !0,
|
|
116
121
|
weekDaysFormat: "short",
|
|
117
122
|
min: u,
|
|
118
|
-
max:
|
|
123
|
+
max: d
|
|
119
124
|
};
|
|
120
|
-
let
|
|
125
|
+
let c = r;
|
|
121
126
|
export {
|
|
122
|
-
|
|
127
|
+
c as HorizontalViewList
|
|
123
128
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react"),t=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 i=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(i,a,u.get?u:{enumerable:!0,get:()=>l[a]})}}return i.default=l,Object.freeze(i)}const v=Y(q),F=(l=p.defaultProps.min,i=p.defaultProps.max,a)=>a instanceof Date&&!Array.isArray(a)&&n.isInRange(r.getDate(a),l,i)?r.getDate(a):null,M=(l=p.defaultProps.min,i=p.defaultProps.max,a)=>Array.isArray(a)?a.filter(u=>n.isInRange(u,l,i)).map(u=>r.getDate(u)):null,A=l=>typeof l=="object"&&!(l instanceof Date)&&l!==null&&!Array.isArray(l)?l:S.EMPTY_SELECTIONRANGE,T=(l,i,a)=>l||i&&i[0]||a&&a.start,j=(l,i)=>l.start===null&&i===null?"start":l.end===null?"end":"start",d=class d extends v.Component{constructor(i){super(i),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,s)=>({start:e.start,end:e.end===null&&e.start!==null&&this.isActive?s:e.end}),this.generateRange=(e,s)=>{const{end:h,start:c}=s,m=s.start!==null&&e.getTime()<=s.start.getTime();return!this.props.allowReverse&&m?{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 s=this.service.move(this.focusedDate,e);return this.min<=s&&s<=this.max||this.service.isInSameView(s,this.min)||this.service.isInSameView(s,this.max)},this.navigate=(e,s)=>{this.calculateFocusFromValue=!1;const h=this.move(e,s);this.setState({navigateDate:h,focusedDate:h})},this.move=(e,s)=>this.clampDate(this.service.move(s,e)),this.clampDate=e=>n.dateInRange(e,this.min,this.max),this.shouldAutoCorrect=(e,s)=>{const{end:h,start:c}=s;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:s}=this.props;s&&s.call(void 0,e)},this.handleBlur=e=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:s}=this.props;s&&s.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 s=this.isInMonth(this.focusedDate,this.dates[1])?this.move(e,this.focusedDate):this.focusedDate;this.navigate(e,s)}},this.handleNextButtonClick=()=>{this.navigate(C.Action.NextView,this.focusedDate)},this.handleKeyDown=e=>{const{keyCode:h,ctrlKey:c,metaKey:m}=e;if(h===84){const o=n.getToday();this.calculateFocusFromValue=!1,this.setState({focusedDate:o,navigateDate:o})}if((c||m)&&(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(s=>({activeView:e,navigateDate:s.focusedDate}))},this.handleDateChange=e=>{const s=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:s,navigateDate:s});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 g=-1;o.forEach((L,B)=>{r.isEqualDate(L,e.value)&&(g=B)}),g!==-1?o.splice(g,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:s}),this.setState({value:c,focusedDate:s}),this.valueDuringOnChange=c;const{onChange:m}=this.props;if(m){const o={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:c,target:this};m.call(void 0,o)}this.valueDuringOnChange=void 0};const a=i.value!==void 0?i.value:i.defaultValue||d.defaultProps.defaultValue,u=F(this.min,this.max,a),D=M(this.min,this.max,a),y=A(a),E=T(u,D,y),V=n.viewInRange(k.CalendarViewEnum[i.defaultActiveView],this.bottomView,this.topView),b=n.dateInRange(i.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 i=F(this.min,this.max,this.value);this.calculateFocusFromValue=!!(this.selectedDate&&i&&this.selectedDate.getTime()&&i.getTime()),this.lastView=this.state.activeView,this.lastViewsCount=this.props.views||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 i=n.viewInRange(this.state.activeView,this.bottomView,this.topView);this.service=this.bus.service(i,this.intl),this.selectedDate=F(this.min,this.max,this.value),this.selectedMultiple=M(this.min,this.max,this.value),this.selectedRange=A(this.value);const a=T(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-calendar k-calendar-range k-calendar-md",{"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},s={"aria-disabled":b},h=this.lastView!==i,c=this.dates&&this.isInMonth(this.state.navigateDate,this.dates[0]),m=this.lastViewsCount!==this.props.views;(!c||h||m)&&(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 v.createElement("div",{ref:g=>{this._element=g},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},v.createElement(_.Header,{key:`.kendo.calendar.header.${o.getTime()}`,activeView:i,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:v.createElement(v.Fragment,null,v.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}),v.createElement(H.TodayCommand,{min:this.min,max:this.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange}),v.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,...s}))}),v.createElement(x.HorizontalViewList,{ref:g=>{this.calendarViewList=g},dates:this.dates,activeView:i,focusedDate:this.focusedDate,weekDaysFormat:this.props.weekDaysFormat,min:this.min,max:this.max,bus:this.bus,service:this.service,selectionRange: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,showOtherMonthDays:this.props.showOtherMonthDays}))}isInMonth(i,a){return!!a&&r.firstDayOfMonth(a)<=i&&i<=r.lastDayOfMonth(a)}};d.displayName="MultiViewCalendar",d.propTypes={activeRangeEnd:t.oneOf(["start","end"]),allowReverse:t.bool,bottomView:t.oneOf(["month","year","decade","century"]),className:t.string,defaultActiveView:t.oneOf(["month","year","decade","century"]),defaultValue:t.oneOfType([n.nullable(t.instanceOf(Date)),t.arrayOf(t.instanceOf(Date)),t.shape({start:n.nullable(t.instanceOf(Date)),end:n.nullable(t.instanceOf(Date))})]),disabled:t.bool,focusedDate:t.instanceOf(Date),id:t.string,weekDaysFormat:t.oneOf(["narrow","short","abbreviated"]),ariaLabelledBy:t.string,ariaDescribedBy:t.string,max:t.instanceOf(Date),min:t.instanceOf(Date),mode:t.oneOf(["single","multiple","range"]),onBlur:t.func,onChange:t.func,onFocus:t.func,tabIndex:t.number,topView:t.oneOf(["month","year","decade","century"]),value:t.oneOfType([n.nullable(t.instanceOf(Date)),t.arrayOf(t.instanceOf(Date)),t.shape({start:n.nullable(t.instanceOf(Date).isRequired),end:n.nullable(t.instanceOf(Date).isRequired)})]),views:(i,a,u)=>{const D=i[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:t.bool,showOtherMonthDays:t.bool,dir:t.string},d.defaultProps={disabled:!1,min:n.MIN_DATE,max:n.MAX_DATE,navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",weekDaysFormat:"short",tabIndex:0,bottomView:"month",views:2,allowReverse:!1,showOtherMonthDays:!1};let p=d;const N=f.createPropsContext(),P=f.withIdHOC(f.withPropsContext(N,p));P.displayName="KendoReactMultiViewCalendar";I.registerForIntl(p);I.registerForLocalization(p);exports.MultiViewCalendar=P;exports.MultiViewCalendarPropsContext=N;exports.MultiViewCalendarWithoutContext=p;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),s=require("prop-types"),F=require("@progress/kendo-react-intl"),D=require("@progress/kendo-react-common"),o=require("@progress/kendo-date-math"),S=require("@progress/kendo-react-buttons"),k=require("@progress/kendo-svg-icons"),I=require("../models/NavigationAction.js"),M=require("../models/CalendarViewEnum.js"),L=require("../models/SelectionRange.js"),K=require("./Header.js"),r=require("../../utils.js"),V=require("../../messages/index.js"),z=require("../services/BusViewService.js"),H=require("../services/NavigationService.js"),E=require("./HorizontalViewList.js"),Y=require("./TodayCommand.js");function j(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const a in c)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(c,a);Object.defineProperty(i,a,d.get?d:{enumerable:!0,get:()=>c[a]})}}return i.default=c,Object.freeze(i)}const g=j(_),A=(c=v.defaultProps.min,i=v.defaultProps.max,a)=>a instanceof Date&&!Array.isArray(a)&&r.isInRange(o.getDate(a),c,i)?o.getDate(a):null,T=(c=v.defaultProps.min,i=v.defaultProps.max,a)=>Array.isArray(a)?a.filter(d=>r.isInRange(d,c,i)).map(d=>o.getDate(d)):null,N=c=>typeof c=="object"&&!(c instanceof Date)&&c!==null&&!Array.isArray(c)?c:L.EMPTY_SELECTIONRANGE,P=(c,i,a)=>c||i&&i[0]||a&&a.start,U=(c,i)=>c.start===null&&i===null?"start":c.end===null?"end":"start",p=class p extends g.Component{constructor(i){super(i),this.dates=[],this.selectedDate=null,this.selectedMultiple=null,this.selectedRange=L.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:l}=t,u=t.start!==null&&e.getTime()<=t.start.getTime();return!this.props.allowReverse&&u?{start:e,end:this.selectedRange.start}:this.activeRange!=="end"?{start:e,end:h}:{start:l||this.selectedDate,end:e}},this.canNavigate=e=>{if(!this.service)return!1;const t=this.service.move(this.focusedDate,e);return this.min<=t&&t<=this.max||this.service.isInSameView(t,this.min)||this.service.isInSameView(t,this.max)},this.navigate=(e,t)=>{this.calculateFocusFromValue=!1;const h=this.move(e,t);this.setState({navigateDate:h,focusedDate:h})},this.move=(e,t)=>this.clampDate(this.service.move(t,e)),this.clampDate=e=>r.dateInRange(e,this.min,this.max),this.shouldAutoCorrect=(e,t)=>{const{end:h,start:l}=t;return this.activeRange!=="end"?h!==null&&e>h:l!==null&&e<l},this.handleCellEnter=e=>{this.props.mode==="range"&&(this.calculateFocusFromValue=!1,this.setState({focusedDate:e}))},this.handleMouseDown=e=>{e.preventDefault()},this.handleClick=e=>{this._element&&this._element.focus({preventScroll:!0})},this.handleFocus=e=>{if(this.isActive=!0,!this.calendarViewList)return;this.calendarViewList.focusActiveDate();const{onFocus:t}=this.props;t&&t.call(void 0,e)},this.handleBlur=e=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:t}=this.props;t&&t.call(void 0,e)},this.handleTodayClick=e=>{this.todayIsInRange&&this.handleDateChange(e)},this.handlePrevButtonClick=()=>{const e=I.Action.PrevView;if(this.state.activeView>0&&this.focusedDate.getFullYear()>this.dates[0].getFullYear())this.navigate(e,this.move(e,this.focusedDate));else{const t=this.isInMonth(this.focusedDate,this.dates[1])?this.move(e,this.focusedDate):this.focusedDate;this.navigate(e,t)}},this.handleNextButtonClick=()=>{this.navigate(I.Action.NextView,this.focusedDate)},this.handleKeyDown=e=>{const{keyCode:h,ctrlKey:l,metaKey:u}=e;if(h===84){const n=r.getToday();this.calculateFocusFromValue=!1,this.setState({focusedDate:n,navigateDate:n})}if((l||u)&&(h===D.Keys.left&&this.handlePrevButtonClick(),h===D.Keys.right&&this.handleNextButtonClick()),h===D.Keys.enter){const n={syntheticEvent:e,nativeEvent:e.nativeEvent,value:this.focusedDate,target:this};this.handleDateChange(n)}else{const n=r.dateInRange(this.navigation.move(this.focusedDate,this.navigation.action(e),this.state.activeView,this.service,e),this.min,this.max);if(o.isEqualDate(this.focusedDate,n))return;this.dates&&this.service&&!this.service.isInArray(n,this.dates)&&this.setState({navigateDate:n}),this.calculateFocusFromValue=!1,this.setState({focusedDate:n})}e.preventDefault()},this.handleViewChange=({view:e})=>{this.calculateFocusFromValue=!1,this.setState(t=>({activeView:e,navigateDate:t.focusedDate}))},this.handleWeekSelection=(e,t,h)=>{if(this.props.mode==="single")return;const l=0,u=6,n=t===l?e:o.addDays(e,-t),m=t===u?e:o.addDays(e,u-t);let f=null;if(this.props.mode==="multiple"){f=[];for(let R=l;R<=u;R++)f.push(o.addDays(n,R));this.setState({value:f,focusedDate:e})}this.props.mode==="range"&&(f={start:n,end:m},this.setState({value:f,focusedDate:e}));const{onChange:x}=this.props;if(x){const R={syntheticEvent:h,nativeEvent:h.nativeEvent,value:f,target:this};x.call(void 0,R)}},this.handleDateChange=e=>{const t=o.cloneDate(e.value),h=this.bus.canMoveDown(this.state.activeView);if(this.props.disabled)return;if(h)if(e.isTodayClick)this.bus.moveToBottom(this.state.activeView);else{this.bus.moveDown(this.state.activeView,e.syntheticEvent),this.setState({focusedDate:t,navigateDate:t});return}this.calculateFocusFromValue=!0;let l;switch(this.props.mode){case"single":l=o.cloneDate(e.value);break;case"multiple":if(Array.isArray(this.selectedMultiple)){const n=this.selectedMultiple.slice();let m=-1;n.forEach((f,x)=>{o.isEqualDate(f,e.value)&&(m=x)}),m!==-1?n.splice(m,1):n.push(o.cloneDate(e.value)),l=n.slice()}else this.selectedDate?l=[o.cloneDate(this.selectedDate),o.cloneDate(e.value)]:l=[o.cloneDate(e.value)];break;case"range":{l=this.selectedRange.start!==null&&this.selectedRange.end!==null&&this.activeRange==="start"?this.clampRange(e.value):this.generateRange(e.value,this.selectedRange),this.activeRangeEnd=this.activeRange!=="end"?"end":"start";break}default:l=o.cloneDate(e.value);break}this.valueDuringOnChange=l,e.isTodayClick&&this.setState({navigateDate:t}),this.setState({value:l,focusedDate:t}),this.valueDuringOnChange=l;const{onChange:u}=this.props;if(u){const n={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:l,target:this};u.call(void 0,n)}this.valueDuringOnChange=void 0};const a=i.value!==void 0?i.value:i.defaultValue||p.defaultProps.defaultValue,d=A(this.min,this.max,a),w=T(this.min,this.max,a),C=N(a),O=P(d,w,C),b=r.viewInRange(M.CalendarViewEnum[i.defaultActiveView],this.bottomView,this.topView),y=r.dateInRange(i.focusedDate||O||r.getToday(),this.min,this.max);this.state={value:a,activeView:b,focusedDate:y,navigateDate:y},this.activeRangeEnd=U(C,d),this.bus=new z.BusViewService(this.handleViewChange),this.navigation=new H.NavigationService(this.bus),this.calculateFocusFromValue=!1,this.lastView=b,this.lastViewsCount=this.props.views||E.HorizontalViewList.defaultProps.views}get wrapperID(){return this.props.id+"-wrapper-id"}get isRtl(){return this.props.dir==="rtl"}get element(){return this._element}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value}get focusedDate(){return o.cloneDate(this._focusedDate)}get min(){return o.getDate(this.props.min!==void 0?this.props.min:p.defaultProps.min)}get max(){return o.getDate(this.props.max!==void 0?this.props.max:p.defaultProps.max)}get bottomView(){return M.CalendarViewEnum[this.props.bottomView!==void 0?this.props.bottomView:p.defaultProps.bottomView]}get topView(){return M.CalendarViewEnum[this.props.topView!==void 0?this.props.topView:p.defaultProps.topView]}get activeRange(){return this.props.activeRangeEnd!==void 0?this.props.activeRangeEnd:this.activeRangeEnd}get todayIsInRange(){return r.isInRange(r.getToday(),o.getDate(this.min),o.getDate(this.max))}componentDidMount(){this.calculateFocusFromValue=!0}componentDidUpdate(){this.calendarViewList&&(this.isActive?this.calendarViewList.focusActiveDate:this.calendarViewList.blurActiveDate)();const i=A(this.min,this.max,this.value);this.calculateFocusFromValue=!!(this.selectedDate&&i&&this.selectedDate.getTime()&&i.getTime()),this.lastView=this.state.activeView,this.lastViewsCount=this.props.views||E.HorizontalViewList.defaultProps.views}render(){this.props._ref&&this.props._ref(this),this.intl=F.provideIntlService(this),this.localization=F.provideLocalizationService(this),this.bus.configure(this.bottomView,this.topView);const i=r.viewInRange(this.state.activeView,this.bottomView,this.topView);this.service=this.bus.service(i,this.intl),this.selectedDate=A(this.min,this.max,this.value),this.selectedMultiple=T(this.min,this.max,this.value),this.selectedRange=N(this.value);const a=P(this.selectedDate,this.selectedMultiple,this.selectedRange);this._focusedDate=r.dateInRange(this.calculateFocusFromValue&&a!==null?a:this.state.focusedDate,this.min,this.max);const d=D.classNames("k-calendar k-calendar-range k-calendar-md",{"k-disabled":this.props.disabled},this.props.className),w=this.rangeWithFocused(this.selectedRange,this.focusedDate),C=this.localization.toLanguageString(V.prevView,V.messages[V.prevView]),O=this.localization.toLanguageString(V.nextView,V.messages[V.nextView]),b=!this.canNavigate(I.Action.PrevView),y=!this.canNavigate(I.Action.NextView),e={"aria-disabled":b},t={"aria-disabled":y},h=this.lastView!==i,l=this.dates&&this.isInMonth(this.state.navigateDate,this.dates[0]),u=this.lastViewsCount!==this.props.views;(!l||h||u)&&(this.dates=this.service.datesList(this.state.navigateDate,this.props.views||E.HorizontalViewList.defaultProps.views));const n=o.cloneDate(this.dates&&this.dates[0]?this.dates[0]:r.getToday());return g.createElement("div",{ref:m=>{this._element=m},className:d,id:this.props.id||this.wrapperID,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.disabled?void 0:this.props.tabIndex,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseDown:this.handleMouseDown,onClick:this.handleClick,onKeyDown:this.handleKeyDown,"aria-disabled":this.props.disabled,dir:this.props.dir},g.createElement(K.Header,{key:`.kendo.calendar.header.${n.getTime()}`,activeView:i,currentDate:n,min:this.min,max:this.max,rangeLength:this.props.views,bus:this.bus,service:this.service,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode,commands:g.createElement(g.Fragment,null,g.createElement(S.Button,{type:"button",className:"k-calendar-nav-prev",icon:this.isRtl?"chevron-right":"chevron-left",svgIcon:this.isRtl?k.chevronRightIcon:k.chevronLeftIcon,fillMode:"flat",title:C,disabled:b,onClick:this.handlePrevButtonClick,...e}),g.createElement(Y.TodayCommand,{min:this.min,max:this.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange}),g.createElement(S.Button,{type:"button",className:"k-calendar-nav-next",icon:this.isRtl?"chevron-left":"chevron-right",svgIcon:this.isRtl?k.chevronLeftIcon:k.chevronRightIcon,fillMode:"flat",title:O,disabled:y,onClick:this.handleNextButtonClick,...t}))}),g.createElement(E.HorizontalViewList,{ref:m=>{this.calendarViewList=m},dates:this.dates,activeView:i,focusedDate:this.focusedDate,weekDaysFormat:this.props.weekDaysFormat,min:this.min,max:this.max,bus:this.bus,service:this.service,selectionRange:w,value:this.selectedMultiple||this.selectedDate,cellUID:this.cellUID,views:this.props.views,onChange:this.handleDateChange,onWeekSelect:this.handleWeekSelection,showWeekNumbers:this.props.weekNumber,onCellEnter:this.handleCellEnter,cell:this.props.cell,weekCell:this.props.weekCell,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode,showOtherMonthDays:this.props.showOtherMonthDays,allowReverse:this.props.allowReverse}))}isInMonth(i,a){return!!a&&o.firstDayOfMonth(a)<=i&&i<=o.lastDayOfMonth(a)}};p.displayName="MultiViewCalendar",p.propTypes={activeRangeEnd:s.oneOf(["start","end"]),allowReverse:s.bool,bottomView:s.oneOf(["month","year","decade","century"]),className:s.string,defaultActiveView:s.oneOf(["month","year","decade","century"]),defaultValue:s.oneOfType([r.nullable(s.instanceOf(Date)),s.arrayOf(s.instanceOf(Date)),s.shape({start:r.nullable(s.instanceOf(Date)),end:r.nullable(s.instanceOf(Date))})]),disabled:s.bool,focusedDate:s.instanceOf(Date),id:s.string,weekDaysFormat:s.oneOf(["narrow","short","abbreviated"]),ariaLabelledBy:s.string,ariaDescribedBy:s.string,max:s.instanceOf(Date),min:s.instanceOf(Date),mode:s.oneOf(["single","multiple","range"]),onBlur:s.func,onChange:s.func,onFocus:s.func,tabIndex:s.number,topView:s.oneOf(["month","year","decade","century"]),value:s.oneOfType([r.nullable(s.instanceOf(Date)),s.arrayOf(s.instanceOf(Date)),s.shape({start:r.nullable(s.instanceOf(Date).isRequired),end:r.nullable(s.instanceOf(Date).isRequired)})]),views:(i,a,d)=>{const w=i[a];return w!==void 0&&w<1?new Error(`Invalid prop '${a}' supplied to'${d}'. The '${a}' property cannot be less than 1'`):null},weekNumber:s.bool,showOtherMonthDays:s.bool,dir:s.string},p.defaultProps={disabled:!1,min:r.MIN_DATE,max:r.MAX_DATE,navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",weekDaysFormat:"short",tabIndex:0,bottomView:"month",views:2,allowReverse:!1,showOtherMonthDays:!1};let v=p;const B=D.createPropsContext(),q=D.withIdHOC(D.withPropsContext(B,v));q.displayName="KendoReactMultiViewCalendar";F.registerForIntl(v);F.registerForLocalization(v);exports.MultiViewCalendar=q;exports.MultiViewCalendarPropsContext=B;exports.MultiViewCalendarWithoutContext=v;
|