@progress/kendo-react-dateinputs 7.5.0-develop.13 → 7.5.0-develop.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calendar/components/Calendar.js +2 -2
- package/calendar/components/Calendar.mjs +27 -24
- package/calendar/components/CalendarCell.js +1 -1
- package/calendar/components/CalendarCell.mjs +51 -48
- package/calendar/components/Header.js +1 -1
- package/calendar/components/Header.mjs +20 -19
- package/calendar/components/HorizontalViewList.js +1 -1
- package/calendar/components/HorizontalViewList.mjs +6 -5
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +53 -50
- package/calendar/components/TodayCommand.js +1 -1
- package/calendar/components/TodayCommand.mjs +1 -1
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +28 -26
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +16 -14
- package/calendar/services/MonthViewService.js +1 -1
- package/calendar/services/MonthViewService.mjs +14 -16
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +3 -0
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +30 -1
- package/index.d.ts +30 -1
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
|
@@ -5,8 +5,8 @@
|
|
|
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"),a=require("prop-types"),u=require("@progress/kendo-react-common"),r=require("@progress/kendo-date-math"),V=require("@progress/kendo-react-intl"),k=require("../../package-metadata.js"),E=require("./ViewList.js"),I=require("./Navigation.js"),d=require("../models/CalendarViewEnum.js"),l=require("../../utils.js"),x=require("../services/BusViewService.js"),N=require("../services/DOMService.js"),O=require("../services/NavigationService.js"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),a=require("prop-types"),u=require("@progress/kendo-react-common"),r=require("@progress/kendo-date-math"),V=require("@progress/kendo-react-intl"),k=require("../../package-metadata.js"),E=require("./ViewList.js"),I=require("./Navigation.js"),d=require("../models/CalendarViewEnum.js"),l=require("../../utils.js"),x=require("../services/BusViewService.js"),N=require("../services/DOMService.js"),O=require("../services/NavigationService.js"),M=require("../services/ScrollSyncService.js");function P(c){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(s,t,e.get?e:{enumerable:!0,get:()=>c[t]})}}return s.default=c,Object.freeze(s)}const m=P(C),g=c=>c?c.virtualization:null,D=(c=p.defaultProps.min,s=p.defaultProps.max,t,e)=>e!==void 0?e!==null&&l.isInRange(r.getDate(e),c,s)?e:null:t!==null&&l.isInRange(r.getDate(t),c,s)?t:null,h=class h extends m.Component{constructor(s){super(s),this.scrollSyncService=null,this.focusedDate=null,this.Navigation=null,this.calendarViewList=null,this._element=null,this.intl=null,this.service=null,this.isActive=!1,this.didNavigationChange=!1,this.focus=()=>{this._element&&this._element.focus()},this.shouldScroll=()=>this.didNavigationChange,this.handleScroll=e=>{this.scrollSyncService&&this.scrollSyncService.sync(g(this.Navigation),g(this.calendarViewList),e)},this.handleNavigationChange=e=>{if(this.props.disabled)return;this.didNavigationChange=!0;const i=r.cloneDate(e.value);this.setState({focusedDate:i})},this.handleViewChange=({view:e})=>{this.scrollSyncService&&this.scrollSyncService.configure(e),this.setState({activeView:e})},this.handleDateChange=e=>{const i=r.cloneDate(e.value),n=r.cloneDate(e.value),f=this.bus.canMoveDown(this.state.activeView);if(this.props.disabled)return;if(f)if(e.isTodayClick)this.bus.moveToBottom(this.state.activeView);else{this.bus.moveDown(this.state.activeView,e.syntheticEvent),this.setState({focusedDate:n});return}this.setState({value:i,focusedDate:n}),this.valueDuringOnChange=i;const{onChange:v}=this.props;if(v){const o={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:i,target:this};v.call(void 0,o)}this.valueDuringOnChange=void 0},this.handleFocus=e=>{if(this.isActive=!0,!this.calendarViewList)return;this.calendarViewList.focusActiveDate();const{onFocus:i}=this.props;i&&i.call(void 0,e)},this.handleBlur=e=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:i}=this.props;i&&i.call(void 0,e)},this.handleKeyDown=e=>{const{keyCode:n,ctrlKey:f,metaKey:v}=e;if(!(!this.focusedDate||!this.service)){if(n===84&&this.setState({focusedDate:l.getToday()}),(f||v)&&(n===u.Keys.left||n===u.Keys.right)){if(this.props.disabled)return;this.didNavigationChange=!0,this.focusedDate.getDate()===31&&this.focusedDate.setDate(30);const o=n===u.Keys.left?this.focusedDate.getMonth()-1:this.focusedDate.getMonth()+1,w=new Date(this.focusedDate.setMonth(o)),S=r.cloneDate(w);this.setState({focusedDate:S})}if(n===u.Keys.enter){if(this.value!==null&&r.isEqualDate(this.focusedDate,this.value)){const w=l.dateInRange(this.focusedDate,this.min,this.max);g(this.calendarViewList).scrollToIndex(this.service.skip(w,this.min))}const o={syntheticEvent:e,nativeEvent:e.nativeEvent,value:this.focusedDate,target:this};this.handleDateChange(o)}else{const o=l.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.setState({focusedDate:o})}e.preventDefault()}},this.handleMouseDown=e=>{e.preventDefault()},this.handleClick=e=>{this._element&&this._element.focus({preventScroll:!0})},u.validatePackage(k.packageMetadata);const t=D(this.min,this.max,this.props.defaultValue||h.defaultProps.defaultValue,this.props.value);this.state={value:t,activeView:l.viewInRange(d.CalendarViewEnum[s.defaultActiveView],this.bottomView,this.topView),focusedDate:l.dateInRange(s.focusedDate||t||l.getToday(),this.min,this.max)},this.dom=new N.DOMService,this.bus=new x.BusViewService(this.handleViewChange),this.navigation=new O.NavigationService(this.bus),this.oldValue=t}get cellUID(){return this.props.id+"-cell-uid"}get id(){return this.props.id+"-id"}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 min(){return r.getDate(this.props.min!==void 0?this.props.min:h.defaultProps.min)}get max(){return r.getDate(this.props.max!==void 0?this.props.max:h.defaultProps.max)}get bottomView(){return d.CalendarViewEnum[this.props.bottomView!==void 0?this.props.bottomView:h.defaultProps.bottomView]}get topView(){return d.CalendarViewEnum[this.props.topView!==void 0?this.props.topView:h.defaultProps.topView]}componentDidMount(){Promise.resolve().then(()=>{u.setScrollbarWidth(),this._element&&(this.dom.calculateHeights(this._element),this.scrollSyncService=new M.ScrollSyncService(this.dom),this.scrollSyncService.configure(this.state.activeView),this.forceUpdate())})}componentDidUpdate(s,t){u.setScrollbarWidth(),t.activeView!==this.state.activeView&&this.scrollSyncService&&this.scrollSyncService.configure(this.state.activeView),this.calendarViewList&&(this.isActive?this.calendarViewList.focusActiveDate:this.calendarViewList.blurActiveDate)(),this.didNavigationChange=!1,this.isActive&&(this.oldValue=this.value)}render(){this.props._ref&&this.props._ref(this);const s=this.value!==null&&this.oldValue!==null?!r.isEqualDate(this.value,this.oldValue):this.value!==this.oldValue,t=l.viewInRange(this.state.activeView,d.CalendarViewEnum[this.props.bottomView!==void 0?this.props.bottomView:h.defaultProps.bottomView],d.CalendarViewEnum[this.props.topView!==void 0?this.props.topView:h.defaultProps.topView]),e=D(this.min,this.max,this.value,this.value),i=e?r.getDate(e):null;this.focusedDate=r.getDate(l.dateInRange(s&&e!==null?e:this.state.focusedDate,this.min,this.max)),this.intl=V.provideIntlService(this),this.bus.configure(this.bottomView,this.topView),this.service=this.bus.service(t,this.intl);const{smoothScroll:n=Number.parseFloat(m.version)<18}=this.props,f=u.classNames("k-calendar k-calendar-infinite",{"k-disabled":this.props.disabled,"k-week-number":this.props.weekNumber},this.props.mobileMode?"k-calendar-lg":"k-calendar-md",this.props.className),v=[this.props.navigation&&m.createElement(I.Navigation,{key:0,ref:o=>{this.Navigation=o},activeView:this.state.activeView,focusedDate:this.focusedDate,min:this.min,max:this.max,onScroll:this.handleScroll,onChange:this.handleNavigationChange,service:this.service,dom:this.dom,navigationItem:this.props.navigationItem,tabIndex:this.props.tabIndex}),m.createElement(E.ViewList,{key:1,ref:o=>{this.calendarViewList=o},activeView:this.state.activeView,focusedDate:this.focusedDate,min:this.min,max:this.max,bus:this.bus,shouldScroll:this.shouldScroll,onScroll:this.handleScroll,service:this.service,cell:this.props.cell,weekCell:this.props.weekCell,dom:this.dom,smoothScroll:n,showWeekNumbers:this.props.weekNumber,onChange:this.handleDateChange,value:i,cellUID:this.cellUID,headerTitle:this.props.headerTitle,header:this.props.header,tabIndex:this.props.tabIndex,weekDaysFormat:this.props.weekDaysFormat,showOtherMonthDays:this.props.showOtherMonthDays})];return m.createElement("div",{ref:o=>{this._element=o},className:f,id:this.props.id||this.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-disabled":this.props.disabled,tabIndex:this.props.disabled?void 0:this.props.tabIndex||0,onFocus:this.handleFocus,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onClick:this.handleClick},v)}};h.displayName="Calendar",h.propTypes={className:a.string,defaultActiveView:a.oneOf(["month","year","decade","century"]),defaultValue:a.instanceOf(Date),disabled:a.bool,focusedDate:a.instanceOf(Date),id:a.string,ariaLabelledBy:a.string,ariaDescribedBy:a.string,weekDaysFormat:a.oneOf(["short","abbreviated","narrow"]),max:a.instanceOf(Date),min:a.instanceOf(Date),navigation:a.bool,smoothScroll:a.bool,onBlur:a.func,onChange:a.func,onFocus:a.func,tabIndex:a.number,value:a.instanceOf(Date),weekNumber:a.bool,topView:(s,t,e)=>{const i=s[t],n=s.bottomView;return i&&n&&d.CalendarViewEnum[i]<d.CalendarViewEnum[n]?new Error(`Invalid prop + ${t} suplied to ${e}.
|
|
9
9
|
${t} can not be smaller than bottomView.
|
|
10
10
|
`):null},bottomView:(s,t,e)=>{const i=s[t],n=s.topView;return i&&n&&d.CalendarViewEnum[i]>d.CalendarViewEnum[n]?new Error(`Invalid prop + ${t} suplied to ${e}.
|
|
11
11
|
${t} can not be bigger than topView.
|
|
12
|
-
`):null}},h.defaultProps={disabled:!1,min:l.MIN_DATE,max:l.MAX_DATE,weekDaysFormat:"short",navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",bottomView:"month"};let
|
|
12
|
+
`):null}},h.defaultProps={disabled:!1,min:l.MIN_DATE,max:l.MAX_DATE,weekDaysFormat:"short",navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",bottomView:"month",showOtherMonthDays:!1};let p=h;const b=u.createPropsContext(),y=u.withIdHOC(u.withPropsContext(b,p));y.displayName="KendoReactCalendar";V.registerForIntl(p);exports.Calendar=y;exports.CalendarPropsContext=b;exports.CalendarWithoutContext=p;
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as v from "react";
|
|
10
10
|
import s from "prop-types";
|
|
11
|
-
import { Keys as m, validatePackage as I, setScrollbarWidth as b, classNames as N, createPropsContext as E, withIdHOC as
|
|
11
|
+
import { Keys as m, validatePackage as I, setScrollbarWidth as b, classNames as N, createPropsContext as E, withIdHOC as O, withPropsContext as P } from "@progress/kendo-react-common";
|
|
12
12
|
import { cloneDate as f, isEqualDate as D, getDate as c } from "@progress/kendo-date-math";
|
|
13
|
-
import { provideIntlService as
|
|
14
|
-
import { packageMetadata as
|
|
13
|
+
import { provideIntlService as A, registerForIntl as M } from "@progress/kendo-react-intl";
|
|
14
|
+
import { packageMetadata as L } from "../../package-metadata.mjs";
|
|
15
15
|
import { ViewList as B } from "./ViewList.mjs";
|
|
16
16
|
import { Navigation as T } from "./Navigation.mjs";
|
|
17
|
-
import { CalendarViewEnum as
|
|
17
|
+
import { CalendarViewEnum as h } from "../models/CalendarViewEnum.mjs";
|
|
18
18
|
import { getToday as y, dateInRange as w, viewInRange as S, MIN_DATE as F, MAX_DATE as K, isInRange as C } from "../../utils.mjs";
|
|
19
19
|
import { BusViewService as _ } from "../services/BusViewService.mjs";
|
|
20
20
|
import { DOMService as $ } from "../services/DOMService.mjs";
|
|
@@ -50,15 +50,15 @@ const V = (u) => u ? u.virtualization : null, k = (u = d.defaultProps.min, o = d
|
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
this.setState({ value: e, focusedDate: a }), this.valueDuringOnChange = e;
|
|
53
|
-
const { onChange:
|
|
54
|
-
if (
|
|
53
|
+
const { onChange: l } = this.props;
|
|
54
|
+
if (l) {
|
|
55
55
|
const n = {
|
|
56
56
|
syntheticEvent: t.syntheticEvent,
|
|
57
57
|
nativeEvent: t.nativeEvent,
|
|
58
58
|
value: e,
|
|
59
59
|
target: this
|
|
60
60
|
};
|
|
61
|
-
|
|
61
|
+
l.call(void 0, n);
|
|
62
62
|
}
|
|
63
63
|
this.valueDuringOnChange = void 0;
|
|
64
64
|
}, this.handleFocus = (t) => {
|
|
@@ -74,9 +74,9 @@ const V = (u) => u ? u.virtualization : null, k = (u = d.defaultProps.min, o = d
|
|
|
74
74
|
const { onBlur: e } = this.props;
|
|
75
75
|
e && e.call(void 0, t);
|
|
76
76
|
}, this.handleKeyDown = (t) => {
|
|
77
|
-
const { keyCode: a, ctrlKey: p, metaKey:
|
|
77
|
+
const { keyCode: a, ctrlKey: p, metaKey: l } = t;
|
|
78
78
|
if (!(!this.focusedDate || !this.service)) {
|
|
79
|
-
if (a === 84 && this.setState({ focusedDate: y() }), (p ||
|
|
79
|
+
if (a === 84 && this.setState({ focusedDate: y() }), (p || l) && (a === m.left || a === m.right)) {
|
|
80
80
|
if (this.props.disabled)
|
|
81
81
|
return;
|
|
82
82
|
this.didNavigationChange = !0, this.focusedDate.getDate() === 31 && this.focusedDate.setDate(30);
|
|
@@ -117,7 +117,7 @@ const V = (u) => u ? u.virtualization : null, k = (u = d.defaultProps.min, o = d
|
|
|
117
117
|
t.preventDefault();
|
|
118
118
|
}, this.handleClick = (t) => {
|
|
119
119
|
this._element && this._element.focus({ preventScroll: !0 });
|
|
120
|
-
}, I(
|
|
120
|
+
}, I(L);
|
|
121
121
|
const i = k(
|
|
122
122
|
this.min,
|
|
123
123
|
this.max,
|
|
@@ -127,7 +127,7 @@ const V = (u) => u ? u.virtualization : null, k = (u = d.defaultProps.min, o = d
|
|
|
127
127
|
this.state = {
|
|
128
128
|
value: i,
|
|
129
129
|
activeView: S(
|
|
130
|
-
|
|
130
|
+
h[o.defaultActiveView],
|
|
131
131
|
this.bottomView,
|
|
132
132
|
this.topView
|
|
133
133
|
),
|
|
@@ -163,10 +163,10 @@ const V = (u) => u ? u.virtualization : null, k = (u = d.defaultProps.min, o = d
|
|
|
163
163
|
return c(this.props.max !== void 0 ? this.props.max : r.defaultProps.max);
|
|
164
164
|
}
|
|
165
165
|
get bottomView() {
|
|
166
|
-
return
|
|
166
|
+
return h[this.props.bottomView !== void 0 ? this.props.bottomView : r.defaultProps.bottomView];
|
|
167
167
|
}
|
|
168
168
|
get topView() {
|
|
169
|
-
return
|
|
169
|
+
return h[this.props.topView !== void 0 ? this.props.topView : r.defaultProps.topView];
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* @hidden
|
|
@@ -189,14 +189,14 @@ const V = (u) => u ? u.virtualization : null, k = (u = d.defaultProps.min, o = d
|
|
|
189
189
|
this.props._ref && this.props._ref(this);
|
|
190
190
|
const o = this.value !== null && this.oldValue !== null ? !D(this.value, this.oldValue) : this.value !== this.oldValue, i = S(
|
|
191
191
|
this.state.activeView,
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
h[this.props.bottomView !== void 0 ? this.props.bottomView : r.defaultProps.bottomView],
|
|
193
|
+
h[this.props.topView !== void 0 ? this.props.topView : r.defaultProps.topView]
|
|
194
194
|
), t = k(this.min, this.max, this.value, this.value), e = t ? c(t) : null;
|
|
195
195
|
this.focusedDate = c(w(
|
|
196
196
|
o && t !== null ? t : this.state.focusedDate,
|
|
197
197
|
this.min,
|
|
198
198
|
this.max
|
|
199
|
-
)), this.intl =
|
|
199
|
+
)), this.intl = A(this), this.bus.configure(this.bottomView, this.topView), this.service = this.bus.service(i, this.intl);
|
|
200
200
|
const { smoothScroll: a = Number.parseFloat(v.version) < 18 } = this.props, p = N(
|
|
201
201
|
"k-calendar k-calendar-infinite",
|
|
202
202
|
{
|
|
@@ -205,7 +205,7 @@ const V = (u) => u ? u.virtualization : null, k = (u = d.defaultProps.min, o = d
|
|
|
205
205
|
},
|
|
206
206
|
this.props.mobileMode ? "k-calendar-lg" : "k-calendar-md",
|
|
207
207
|
this.props.className
|
|
208
|
-
),
|
|
208
|
+
), l = [this.props.navigation && /* @__PURE__ */ v.createElement(
|
|
209
209
|
T,
|
|
210
210
|
{
|
|
211
211
|
key: 0,
|
|
@@ -247,8 +247,10 @@ const V = (u) => u ? u.virtualization : null, k = (u = d.defaultProps.min, o = d
|
|
|
247
247
|
value: e,
|
|
248
248
|
cellUID: this.cellUID,
|
|
249
249
|
headerTitle: this.props.headerTitle,
|
|
250
|
+
header: this.props.header,
|
|
250
251
|
tabIndex: this.props.tabIndex,
|
|
251
|
-
weekDaysFormat: this.props.weekDaysFormat
|
|
252
|
+
weekDaysFormat: this.props.weekDaysFormat,
|
|
253
|
+
showOtherMonthDays: this.props.showOtherMonthDays
|
|
252
254
|
}
|
|
253
255
|
)];
|
|
254
256
|
return /* @__PURE__ */ v.createElement(
|
|
@@ -269,7 +271,7 @@ const V = (u) => u ? u.virtualization : null, k = (u = d.defaultProps.min, o = d
|
|
|
269
271
|
onMouseDown: this.handleMouseDown,
|
|
270
272
|
onClick: this.handleClick
|
|
271
273
|
},
|
|
272
|
-
|
|
274
|
+
l
|
|
273
275
|
);
|
|
274
276
|
}
|
|
275
277
|
};
|
|
@@ -295,7 +297,7 @@ r.displayName = "Calendar", r.propTypes = {
|
|
|
295
297
|
weekNumber: s.bool,
|
|
296
298
|
topView: (o, i, t) => {
|
|
297
299
|
const e = o[i], a = o.bottomView;
|
|
298
|
-
return e && a &&
|
|
300
|
+
return e && a && h[e] < h[a] ? new Error(
|
|
299
301
|
`Invalid prop + ${i} suplied to ${t}.
|
|
300
302
|
${i} can not be smaller than bottomView.
|
|
301
303
|
`
|
|
@@ -303,7 +305,7 @@ r.displayName = "Calendar", r.propTypes = {
|
|
|
303
305
|
},
|
|
304
306
|
bottomView: (o, i, t) => {
|
|
305
307
|
const e = o[i], a = o.topView;
|
|
306
|
-
return e && a &&
|
|
308
|
+
return e && a && h[e] > h[a] ? new Error(
|
|
307
309
|
`Invalid prop + ${i} suplied to ${t}.
|
|
308
310
|
${i} can not be bigger than topView.
|
|
309
311
|
`
|
|
@@ -318,12 +320,13 @@ r.displayName = "Calendar", r.propTypes = {
|
|
|
318
320
|
defaultActiveView: "month",
|
|
319
321
|
defaultValue: null,
|
|
320
322
|
topView: "century",
|
|
321
|
-
bottomView: "month"
|
|
323
|
+
bottomView: "month",
|
|
324
|
+
showOtherMonthDays: !1
|
|
322
325
|
};
|
|
323
326
|
let d = r;
|
|
324
|
-
const Y = E(), z = P(
|
|
327
|
+
const Y = E(), z = O(P(Y, d));
|
|
325
328
|
z.displayName = "KendoReactCalendar";
|
|
326
|
-
|
|
329
|
+
M(d);
|
|
327
330
|
export {
|
|
328
331
|
z as Calendar,
|
|
329
332
|
Y as CalendarPropsContext,
|
|
@@ -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 b=require("react"),C=require("@progress/kendo-react-common");function O(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const e in s)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>s[e]})}}return t.default=s,Object.freeze(t)}const l=O(b),y=(s,t)=>{const e=Object.getOwnPropertyNames(s),n=Object.getOwnPropertyNames(t);if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++){const o=e[r];if(s[o]!==t[o])return!1}return!0};class R extends l.Component{constructor(){super(...arguments),this.handleClick=t=>{const{onClick:e,value:n}=this.props;e&&e.call(void 0,n,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,...n}=this.props,{value:r,...o}=t;return!((!(e&&r)||e.getTime()===r.getTime())&&y(n,o))}render(){const{className:t,formattedValue:e,isWeekend:n,isFocused:r,isInRange:o,isSelected:d,isRangeStart:i,isRangeMid:u,isRangeEnd:c,isRangeSplitStart:p,isRangeSplitEnd:h,isToday:g,isDisabled:m,view:N,value:S,isOtherMonth:a,showOtherMonthDays:k,...v}=this.props,f=this.props.activeRangeEnd==="end"&&c,E=this.props.activeRangeEnd==="start"&&i,M=C.classNames("k-calendar-td",{"k-range-end":!a&&c,"k-range-mid":!a&&u,"k-range-split-end":!a&&h,"k-range-split-start":!a&&p,"k-range-start":!a&&i,"k-active":E||f,"k-state-pending-focus":r,"k-selected":!a&&(d||i||c),"k-today":!a&&g,"k-weekend":n,"k-disabled":m,"k-other-month":a},t);return!k&&a?l.createElement("td",{role:"gridcell",className:"k-empty k-calendar-td"}):l.createElement("td",{...v,className:M,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},l.createElement("span",{className:"k-link"},this.props.children))}}exports.CalendarCell=R;
|
|
@@ -6,30 +6,30 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import { classNames as
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
9
|
+
import * as r from "react";
|
|
10
|
+
import { classNames as C } from "@progress/kendo-react-common";
|
|
11
|
+
const N = (i, e) => {
|
|
12
|
+
const t = Object.getOwnPropertyNames(i), a = Object.getOwnPropertyNames(e);
|
|
13
|
+
if (t.length !== a.length)
|
|
14
14
|
return !1;
|
|
15
|
-
for (let
|
|
16
|
-
const
|
|
17
|
-
if (o
|
|
15
|
+
for (let n = 0; n < t.length; n++) {
|
|
16
|
+
const o = t[n];
|
|
17
|
+
if (i[o] !== e[o])
|
|
18
18
|
return !1;
|
|
19
19
|
}
|
|
20
20
|
return !0;
|
|
21
21
|
};
|
|
22
|
-
class
|
|
22
|
+
class O extends r.Component {
|
|
23
23
|
constructor() {
|
|
24
24
|
super(...arguments), this.handleClick = (e) => {
|
|
25
|
-
const { onClick:
|
|
26
|
-
|
|
25
|
+
const { onClick: t, value: a } = this.props;
|
|
26
|
+
t && t.call(void 0, a, e);
|
|
27
27
|
}, this.handleMouseEnter = () => {
|
|
28
|
-
const { onMouseEnter: e, value:
|
|
29
|
-
e && e.call(void 0,
|
|
28
|
+
const { onMouseEnter: e, value: t } = this.props;
|
|
29
|
+
e && e.call(void 0, t);
|
|
30
30
|
}, this.handleMouseLeave = () => {
|
|
31
|
-
const { onMouseLeave: e, value:
|
|
32
|
-
e && e.call(void 0,
|
|
31
|
+
const { onMouseLeave: e, value: t } = this.props;
|
|
32
|
+
e && e.call(void 0, t);
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
// Manually checking if the component needs an update
|
|
@@ -40,8 +40,8 @@ class w extends l.Component {
|
|
|
40
40
|
* @hidden
|
|
41
41
|
*/
|
|
42
42
|
shouldComponentUpdate(e) {
|
|
43
|
-
const { value:
|
|
44
|
-
return !((!(
|
|
43
|
+
const { value: t, ...a } = this.props, { value: n, ...o } = e;
|
|
44
|
+
return !((!(t && n) || t.getTime() === n.getTime()) && N(a, o));
|
|
45
45
|
}
|
|
46
46
|
/* eslint-disable max-len */
|
|
47
47
|
/**
|
|
@@ -51,51 +51,54 @@ class w extends l.Component {
|
|
|
51
51
|
render() {
|
|
52
52
|
const {
|
|
53
53
|
className: e,
|
|
54
|
-
formattedValue:
|
|
55
|
-
isWeekend:
|
|
56
|
-
isFocused:
|
|
57
|
-
isInRange:
|
|
58
|
-
isSelected:
|
|
59
|
-
isRangeStart:
|
|
60
|
-
isRangeMid:
|
|
61
|
-
isRangeEnd:
|
|
62
|
-
isRangeSplitStart:
|
|
63
|
-
isRangeSplitEnd:
|
|
64
|
-
isToday:
|
|
54
|
+
formattedValue: t,
|
|
55
|
+
isWeekend: a,
|
|
56
|
+
isFocused: n,
|
|
57
|
+
isInRange: o,
|
|
58
|
+
isSelected: d,
|
|
59
|
+
isRangeStart: l,
|
|
60
|
+
isRangeMid: p,
|
|
61
|
+
isRangeEnd: c,
|
|
62
|
+
isRangeSplitStart: u,
|
|
63
|
+
isRangeSplitEnd: h,
|
|
64
|
+
isToday: m,
|
|
65
65
|
isDisabled: g,
|
|
66
|
-
view:
|
|
67
|
-
value:
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
view: R,
|
|
67
|
+
value: w,
|
|
68
|
+
isOtherMonth: s,
|
|
69
|
+
showOtherMonthDays: k,
|
|
70
|
+
...v
|
|
71
|
+
} = this.props, E = this.props.activeRangeEnd === "end" && c, f = this.props.activeRangeEnd === "start" && l, M = C(
|
|
70
72
|
"k-calendar-td",
|
|
71
73
|
{
|
|
72
|
-
"k-range-end":
|
|
73
|
-
"k-range-mid":
|
|
74
|
-
"k-range-split-end":
|
|
75
|
-
"k-range-split-start":
|
|
76
|
-
"k-range-start":
|
|
77
|
-
"k-active":
|
|
78
|
-
"k-state-pending-focus":
|
|
79
|
-
"k-selected":
|
|
80
|
-
"k-today":
|
|
81
|
-
"k-weekend":
|
|
82
|
-
"k-disabled": g
|
|
74
|
+
"k-range-end": !s && c,
|
|
75
|
+
"k-range-mid": !s && p,
|
|
76
|
+
"k-range-split-end": !s && h,
|
|
77
|
+
"k-range-split-start": !s && u,
|
|
78
|
+
"k-range-start": !s && l,
|
|
79
|
+
"k-active": f || E,
|
|
80
|
+
"k-state-pending-focus": n,
|
|
81
|
+
"k-selected": !s && (d || l || c),
|
|
82
|
+
"k-today": !s && m,
|
|
83
|
+
"k-weekend": a,
|
|
84
|
+
"k-disabled": g,
|
|
85
|
+
"k-other-month": s
|
|
83
86
|
},
|
|
84
87
|
e
|
|
85
88
|
);
|
|
86
|
-
return /* @__PURE__ */
|
|
89
|
+
return !k && s ? /* @__PURE__ */ r.createElement("td", { role: "gridcell", className: "k-empty k-calendar-td" }) : /* @__PURE__ */ r.createElement(
|
|
87
90
|
"td",
|
|
88
91
|
{
|
|
89
|
-
...
|
|
90
|
-
className:
|
|
92
|
+
...v,
|
|
93
|
+
className: M,
|
|
91
94
|
onClick: this.handleClick,
|
|
92
95
|
onMouseEnter: this.handleMouseEnter,
|
|
93
96
|
onMouseLeave: this.handleMouseLeave
|
|
94
97
|
},
|
|
95
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ r.createElement("span", { className: "k-link" }, this.props.children)
|
|
96
99
|
);
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
export {
|
|
100
|
-
|
|
103
|
+
O as CalendarCell
|
|
101
104
|
};
|
|
@@ -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 d=require("react"),a=require("prop-types"),m=require("@progress/kendo-react-intl"),c=require("@progress/kendo-react-common"),g=require("./CalendarHeaderTitle.js"),p=require("../../utils.js");function v(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const s=v(d),i=class i extends s.Component{constructor(){super(...arguments),this.getTitle=()=>{if(!this.props.currentDate)return"";const e=this.rangeLength-1,t=this.props.service.title(this.props.currentDate),r=this.props.service.addToDate(this.props.currentDate,e);return e<1||!this.props.service.isInRange(r,this.min,this.max)?t:`${t} - ${this.props.service.title(r)}`},this.handleTitleClick=e=>{this.canMoveUp&&this.props.bus.moveUp(this.props.activeView,e)}}get min(){return this.props.min!==void 0?this.props.min:i.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:i.defaultProps.max}get rangeLength(){return this.props.rangeLength!==void 0?this.props.rangeLength:i.defaultProps.rangeLength}get canMoveUp(){return this.props.bus.canMoveUp(this.props.activeView)}render(){const e=this.getTitle(),t=c.classNames("k-calendar-title"),r={children:e,value:e,view:this.props.activeView,className:t,onClick:this.handleTitleClick,disabled:!this.canMoveUp},l={headerTitleProps:r,commands:this.props.commands},h=this.props.headerTitle?s.createElement(this.props.headerTitle,{...r},e):s.createElement(g.CalendarHeaderTitle,{...r},e),u=this.props.header?s.createElement(this.props.header,{...l}):s.createElement(s.Fragment,null,h,s.createElement("span",{className:"k-spacer"}),s.createElement("span",{className:"k-calendar-nav"},this.props.commands));return s.createElement("div",{className:c.classNames("k-calendar-header",{"k-vstack":this.props.verticalView})},u)}};i.propTypes={activeView:a.number.isRequired,currentDate:a.instanceOf(Date).isRequired,max:a.instanceOf(Date).isRequired,min:a.instanceOf(Date).isRequired,rangeLength:a.number},i.defaultProps={rangeLength:1,min:p.MIN_DATE,max:p.MAX_DATE};let o=i;m.registerForLocalization(o);exports.Header=o;
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as t from "react";
|
|
10
10
|
import i from "prop-types";
|
|
11
|
-
import { registerForLocalization as
|
|
11
|
+
import { registerForLocalization as m } from "@progress/kendo-react-intl";
|
|
12
12
|
import { classNames as p } from "@progress/kendo-react-common";
|
|
13
|
-
import { CalendarHeaderTitle as
|
|
14
|
-
import { MIN_DATE as
|
|
15
|
-
const
|
|
13
|
+
import { CalendarHeaderTitle as l } from "./CalendarHeaderTitle.mjs";
|
|
14
|
+
import { MIN_DATE as d, MAX_DATE as u } from "../../utils.mjs";
|
|
15
|
+
const s = class s extends t.Component {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments), this.getTitle = () => {
|
|
18
18
|
if (!this.props.currentDate)
|
|
@@ -24,13 +24,13 @@ const t = class t extends s.Component {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
get min() {
|
|
27
|
-
return this.props.min !== void 0 ? this.props.min :
|
|
27
|
+
return this.props.min !== void 0 ? this.props.min : s.defaultProps.min;
|
|
28
28
|
}
|
|
29
29
|
get max() {
|
|
30
|
-
return this.props.max !== void 0 ? this.props.max :
|
|
30
|
+
return this.props.max !== void 0 ? this.props.max : s.defaultProps.max;
|
|
31
31
|
}
|
|
32
32
|
get rangeLength() {
|
|
33
|
-
return this.props.rangeLength !== void 0 ? this.props.rangeLength :
|
|
33
|
+
return this.props.rangeLength !== void 0 ? this.props.rangeLength : s.defaultProps.rangeLength;
|
|
34
34
|
}
|
|
35
35
|
get canMoveUp() {
|
|
36
36
|
return this.props.bus.canMoveUp(this.props.activeView);
|
|
@@ -45,33 +45,34 @@ const t = class t extends s.Component {
|
|
|
45
45
|
className: a,
|
|
46
46
|
onClick: this.handleTitleClick,
|
|
47
47
|
disabled: !this.canMoveUp
|
|
48
|
-
}, o =
|
|
49
|
-
|
|
48
|
+
}, o = {
|
|
49
|
+
headerTitleProps: r,
|
|
50
|
+
commands: this.props.commands
|
|
51
|
+
}, c = this.props.headerTitle ? /* @__PURE__ */ t.createElement(this.props.headerTitle, { ...r }, e) : /* @__PURE__ */ t.createElement(l, { ...r }, e), h = this.props.header ? /* @__PURE__ */ t.createElement(this.props.header, { ...o }) : /* @__PURE__ */ t.createElement(t.Fragment, null, c, /* @__PURE__ */ t.createElement("span", { className: "k-spacer" }), /* @__PURE__ */ t.createElement("span", { className: "k-calendar-nav" }, this.props.commands));
|
|
52
|
+
return /* @__PURE__ */ t.createElement(
|
|
50
53
|
"div",
|
|
51
54
|
{
|
|
52
55
|
className: p("k-calendar-header", {
|
|
53
56
|
"k-vstack": this.props.verticalView
|
|
54
57
|
})
|
|
55
58
|
},
|
|
56
|
-
|
|
57
|
-
/* @__PURE__ */ s.createElement("span", { className: "k-spacer" }),
|
|
58
|
-
/* @__PURE__ */ s.createElement("span", { className: "k-calendar-nav" }, this.props.commands)
|
|
59
|
+
h
|
|
59
60
|
);
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
|
-
|
|
63
|
+
s.propTypes = {
|
|
63
64
|
activeView: i.number.isRequired,
|
|
64
65
|
currentDate: i.instanceOf(Date).isRequired,
|
|
65
66
|
max: i.instanceOf(Date).isRequired,
|
|
66
67
|
min: i.instanceOf(Date).isRequired,
|
|
67
68
|
rangeLength: i.number
|
|
68
|
-
},
|
|
69
|
+
}, s.defaultProps = {
|
|
69
70
|
rangeLength: 1,
|
|
70
|
-
min:
|
|
71
|
-
max:
|
|
71
|
+
min: d,
|
|
72
|
+
max: u
|
|
72
73
|
};
|
|
73
|
-
let n =
|
|
74
|
-
|
|
74
|
+
let n = s;
|
|
75
|
+
m(n);
|
|
75
76
|
export {
|
|
76
77
|
n as Header
|
|
77
78
|
};
|
|
@@ -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 p=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 n=f(p),h=2,a=class a extends n.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 u={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:v.cloneDate(e.value),target:this,isTodayClick:t};c.call(void 0,u)}}}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:a.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:a.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 n.createElement("div",{ref:t=>{this._element=t},className:e},this.props.dates.map(t=>n.createElement("table",{className:"k-calendar-table",key:t.getTime(),role:"grid"},n.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,onCellEnter:this.props.onCellEnter,cell:this.props.cell,weekCell:this.props.weekCell,showOtherMonthDays:this.props.showOtherMonthDays}))))}};a.defaultProps={showWeekNumbers:!1,views:h,take:h,allowReverse:!0,weekDaysFormat:"short",min:l.MIN_DATE,max:l.MAX_DATE};let o=a;exports.HorizontalViewList=o;
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as r from "react";
|
|
10
|
-
import { View as
|
|
10
|
+
import { View as h } from "./View.mjs";
|
|
11
11
|
import { CalendarViewEnum as s } from "../models/CalendarViewEnum.mjs";
|
|
12
|
-
import { classNames as
|
|
12
|
+
import { classNames as p } from "@progress/kendo-react-common";
|
|
13
13
|
import { cloneDate as m } from "@progress/kendo-date-math";
|
|
14
14
|
import { MIN_DATE as u, MAX_DATE as v } from "../../utils.mjs";
|
|
15
15
|
const n = 2, i = class i extends r.Component {
|
|
@@ -62,7 +62,7 @@ const n = 2, i = class i extends r.Component {
|
|
|
62
62
|
this.isActive && this.focusActiveDate();
|
|
63
63
|
}
|
|
64
64
|
render() {
|
|
65
|
-
const a = this.props.allowReverse ? this.rotateSelectionRange(this.props.selectionRange) : this.props.selectionRange, e =
|
|
65
|
+
const a = this.props.allowReverse ? this.rotateSelectionRange(this.props.selectionRange) : this.props.selectionRange, e = p(
|
|
66
66
|
"k-calendar-view k-align-items-start k-justify-content-center",
|
|
67
67
|
{
|
|
68
68
|
"k-vstack": this.props.verticalView,
|
|
@@ -82,7 +82,7 @@ const n = 2, i = class i extends r.Component {
|
|
|
82
82
|
className: e
|
|
83
83
|
},
|
|
84
84
|
this.props.dates.map((t) => /* @__PURE__ */ r.createElement("table", { className: "k-calendar-table", key: t.getTime(), role: "grid" }, /* @__PURE__ */ r.createElement(
|
|
85
|
-
|
|
85
|
+
h,
|
|
86
86
|
{
|
|
87
87
|
bus: this.props.bus,
|
|
88
88
|
weekDaysFormat: this.props.weekDaysFormat,
|
|
@@ -101,7 +101,8 @@ const n = 2, i = class i extends r.Component {
|
|
|
101
101
|
onChange: this.handleDateChange,
|
|
102
102
|
onCellEnter: this.props.onCellEnter,
|
|
103
103
|
cell: this.props.cell,
|
|
104
|
-
weekCell: this.props.weekCell
|
|
104
|
+
weekCell: this.props.weekCell,
|
|
105
|
+
showOtherMonthDays: this.props.showOtherMonthDays
|
|
105
106
|
}
|
|
106
107
|
)))
|
|
107
108
|
);
|
|
@@ -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 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,i)=>({start:e.start,end:e.end===null&&e.start!==null&&this.isActive?i:e.end}),this.generateRange=(e,i)=>{const{end:h,start:c}=i,m=i.start!==null&&e.getTime()<=i.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 i=this.service.move(this.focusedDate,e);return this.min<=i&&i<=this.max||this.service.isInSameView(i,this.min)||this.service.isInSameView(i,this.max)},this.navigate=(e,i)=>{this.calculateFocusFromValue=!1;const h=this.move(e,i);this.setState({navigateDate:h,focusedDate:h})},this.move=(e,i)=>this.clampDate(this.service.move(i,e)),this.clampDate=e=>n.dateInRange(e,this.min,this.max),this.shouldAutoCorrect=(e,i)=>{const{end:h,start:c}=i;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:i}=this.props;i&&i.call(void 0,e)},this.handleBlur=e=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:i}=this.props;i&&i.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 i=this.isInMonth(this.focusedDate,this.dates[1])?this.move(e,this.focusedDate):this.focusedDate;this.navigate(e,i)}},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(i=>({activeView:e,navigateDate:i.focusedDate}))},this.handleDateChange=e=>{const i=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:i,navigateDate:i});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:i}),this.setState({value:c,focusedDate:i}),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=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-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},i={"aria-disabled":b},h=this.lastView!==s,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 p.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},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,...i}))}),p.createElement(x.HorizontalViewList,{ref:g=>{this.calendarViewList=g},dates:this.dates,activeView:s,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}))}isInMonth(s,a){return!!a&&r.firstDayOfMonth(a)<=s&&s<=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:(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: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};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;
|
|
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;
|