@progress/kendo-react-dateinputs 7.5.0-develop.2 → 7.5.0-develop.20
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 +46 -40
- 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 +8 -5
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +99 -93
- 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 +31 -29
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +47 -45
- package/calendar/services/MonthViewService.js +1 -1
- package/calendar/services/MonthViewService.mjs +14 -16
- package/calendar/services/WeekNamesService.js +1 -1
- package/calendar/services/WeekNamesService.mjs +5 -5
- 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 +63 -7
- package/index.d.ts +63 -7
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +5 -6
- package/virtualization/services/RowHeightService.js +0 -8
- package/virtualization/services/RowHeightService.mjs +0 -50
|
@@ -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"),i=require("prop-types"),I=require("@progress/kendo-react-intl"),f=require("@progress/kendo-react-common"),r=require("@progress/kendo-date-math"),O=require("@progress/kendo-react-buttons"),R=require("@progress/kendo-svg-icons"),C=require("../models/NavigationAction.js"),k=require("../models/CalendarViewEnum.js"),S=require("../models/SelectionRange.js"),_=require("./Header.js"),n=require("../../utils.js"),w=require("../../messages/index.js"),z=require("../services/BusViewService.js"),K=require("../services/NavigationService.js"),x=require("./HorizontalViewList.js"),H=require("./TodayCommand.js");function Y(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const a in l)if(a!=="default"){const u=Object.getOwnPropertyDescriptor(l,a);Object.defineProperty(s,a,u.get?u:{enumerable:!0,get:()=>l[a]})}}return s.default=l,Object.freeze(s)}const p=Y(q),F=(l=v.defaultProps.min,s=v.defaultProps.max,a)=>a instanceof Date&&!Array.isArray(a)&&n.isInRange(r.getDate(a),l,s)?r.getDate(a):null,A=(l=v.defaultProps.min,s=v.defaultProps.max,a)=>Array.isArray(a)?a.filter(u=>n.isInRange(u,l,s)).map(u=>r.getDate(u)):null,T=l=>typeof l=="object"&&!(l instanceof Date)&&l!==null&&!Array.isArray(l)?l:S.EMPTY_SELECTIONRANGE,M=(l,s,a)=>l||s&&s[0]||a&&a.start,j=(l,s)=>l.start===null&&s===null?"start":l.end===null?"end":"start",d=class d extends p.Component{constructor(s){super(s),this.dates=[],this.selectedDate=null,this.selectedMultiple=null,this.selectedRange=S.EMPTY_SELECTIONRANGE,this._focusedDate=new Date,this.cellUID=this.props.id+"-cell-uid",this.activeRangeEnd="start",this._element=null,this.intl=null,this.localization=null,this.service=null,this.calendarViewList=null,this.isActive=!1,this.calculateFocusFromValue=!0,this.focus=()=>{this._element&&this._element.focus()},this.clampRange=e=>({start:e,end:null}),this.rangeWithFocused=(e,t)=>({start:e.start,end:e.end===null&&e.start!==null&&this.isActive?t:e.end}),this.generateRange=(e,t)=>{const{end:h,start:c}=t,g=t.start!==null&&e.getTime()<=t.start.getTime();return!this.props.allowReverse&&g?{start:e,end:this.selectedRange.start}:this.activeRange!=="end"?{start:e,end:h}:{start:c||this.selectedDate,end:e}},this.canNavigate=e=>{if(!this.service)return!1;const t=this.service.move(this.focusedDate,e);return this.min<=t&&t<=this.max||this.service.isInSameView(t,this.min)||this.service.isInSameView(t,this.max)},this.navigate=(e,t)=>{this.calculateFocusFromValue=!1;const h=this.move(e,t);this.setState({navigateDate:h,focusedDate:h})},this.move=(e,t)=>this.clampDate(this.service.move(t,e)),this.clampDate=e=>n.dateInRange(e,this.min,this.max),this.shouldAutoCorrect=(e,t)=>{const{end:h,start:c}=t;return this.activeRange!=="end"?h!==null&&e>h:c!==null&&e<c},this.handleCellEnter=e=>{this.props.mode==="range"&&(this.calculateFocusFromValue=!1,this.setState({focusedDate:e}))},this.handleMouseDown=e=>{e.preventDefault()},this.handleClick=e=>{this._element&&this._element.focus({preventScroll:!0})},this.handleFocus=e=>{if(this.isActive=!0,!this.calendarViewList)return;this.calendarViewList.focusActiveDate();const{onFocus:t}=this.props;t&&t.call(void 0,e)},this.handleBlur=e=>{if(this.isActive=!1,!this.calendarViewList)return;this.calendarViewList.blurActiveDate();const{onBlur:t}=this.props;t&&t.call(void 0,e)},this.handleTodayClick=e=>{this.todayIsInRange&&this.handleDateChange(e)},this.handlePrevButtonClick=()=>{const e=C.Action.PrevView;if(this.state.activeView>0&&this.focusedDate.getFullYear()>this.dates[0].getFullYear())this.navigate(e,this.move(e,this.focusedDate));else{const t=this.isInMonth(this.focusedDate,this.dates[1])?this.move(e,this.focusedDate):this.focusedDate;this.navigate(e,t)}},this.handleNextButtonClick=()=>{this.navigate(C.Action.NextView,this.focusedDate)},this.handleKeyDown=e=>{const{keyCode:h,ctrlKey:c,metaKey:g}=e;if(h===84){const o=n.getToday();this.calculateFocusFromValue=!1,this.setState({focusedDate:o,navigateDate:o})}if((c||g)&&(h===f.Keys.left&&this.handlePrevButtonClick(),h===f.Keys.right&&this.handleNextButtonClick()),h===f.Keys.enter){const o={syntheticEvent:e,nativeEvent:e.nativeEvent,value:this.focusedDate,target:this};this.handleDateChange(o)}else{const o=n.dateInRange(this.navigation.move(this.focusedDate,this.navigation.action(e),this.state.activeView,this.service,e),this.min,this.max);if(r.isEqualDate(this.focusedDate,o))return;this.dates&&this.service&&!this.service.isInArray(o,this.dates)&&this.setState({navigateDate:o}),this.calculateFocusFromValue=!1,this.setState({focusedDate:o})}e.preventDefault()},this.handleViewChange=({view:e})=>{this.calculateFocusFromValue=!1,this.setState(t=>({activeView:e,navigateDate:t.focusedDate}))},this.handleDateChange=e=>{const t=r.cloneDate(e.value),h=this.bus.canMoveDown(this.state.activeView);if(this.props.disabled)return;if(h)if(e.isTodayClick)this.bus.moveToBottom(this.state.activeView);else{this.bus.moveDown(this.state.activeView,e.syntheticEvent),this.setState({focusedDate:t,navigateDate:t});return}this.calculateFocusFromValue=!0;let c;switch(this.props.mode){case"single":c=r.cloneDate(e.value);break;case"multiple":if(Array.isArray(this.selectedMultiple)){const o=this.selectedMultiple.slice();let m=-1;o.forEach((L,B)=>{r.isEqualDate(L,e.value)&&(m=B)}),m!==-1?o.splice(m,1):o.push(r.cloneDate(e.value)),c=o.slice()}else this.selectedDate?c=[r.cloneDate(this.selectedDate),r.cloneDate(e.value)]:c=[r.cloneDate(e.value)];break;case"range":{c=this.selectedRange.start!==null&&this.selectedRange.end!==null&&this.activeRange==="start"?this.clampRange(e.value):this.generateRange(e.value,this.selectedRange),this.activeRangeEnd=this.activeRange!=="end"?"end":"start";break}default:c=r.cloneDate(e.value);break}this.valueDuringOnChange=c,e.isTodayClick&&this.setState({navigateDate:t}),this.setState({value:c,focusedDate:t}),this.valueDuringOnChange=c;const{onChange:g}=this.props;if(g){const o={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:c,target:this};g.call(void 0,o)}this.valueDuringOnChange=void 0};const a=s.value!==void 0?s.value:s.defaultValue||d.defaultProps.defaultValue,u=F(this.min,this.max,a),D=A(this.min,this.max,a),y=T(a),E=M(u,D,y),V=n.viewInRange(k.CalendarViewEnum[s.defaultActiveView],this.bottomView,this.topView),b=n.dateInRange(s.focusedDate||E||n.getToday(),this.min,this.max);this.state={value:a,activeView:V,focusedDate:b,navigateDate:b},this.activeRangeEnd=j(y,u),this.bus=new z.BusViewService(this.handleViewChange),this.navigation=new K.NavigationService(this.bus),this.calculateFocusFromValue=!1,this.lastView=V,this.lastViewsCount=this.props.views||x.HorizontalViewList.defaultProps.views}get wrapperID(){return this.props.id+"-wrapper-id"}get isRtl(){return this.props.dir==="rtl"}get element(){return this._element}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value}get focusedDate(){return r.cloneDate(this._focusedDate)}get min(){return r.getDate(this.props.min!==void 0?this.props.min:d.defaultProps.min)}get max(){return r.getDate(this.props.max!==void 0?this.props.max:d.defaultProps.max)}get bottomView(){return k.CalendarViewEnum[this.props.bottomView!==void 0?this.props.bottomView:d.defaultProps.bottomView]}get topView(){return k.CalendarViewEnum[this.props.topView!==void 0?this.props.topView:d.defaultProps.topView]}get activeRange(){return this.props.activeRangeEnd!==void 0?this.props.activeRangeEnd:this.activeRangeEnd}get todayIsInRange(){return n.isInRange(n.getToday(),r.getDate(this.min),r.getDate(this.max))}componentDidMount(){this.calculateFocusFromValue=!0}componentDidUpdate(){this.calendarViewList&&(this.isActive?this.calendarViewList.focusActiveDate:this.calendarViewList.blurActiveDate)();const s=F(this.min,this.max,this.value);this.calculateFocusFromValue=!!(this.selectedDate&&s&&this.selectedDate.getTime()&&s.getTime()),this.lastView=this.state.activeView,this.lastViewsCount=this.props.views||x.HorizontalViewList.defaultProps.views}render(){this.props._ref&&this.props._ref(this),this.intl=I.provideIntlService(this),this.localization=I.provideLocalizationService(this),this.bus.configure(this.bottomView,this.topView);const s=n.viewInRange(this.state.activeView,this.bottomView,this.topView);this.service=this.bus.service(s,this.intl),this.selectedDate=F(this.min,this.max,this.value),this.selectedMultiple=A(this.min,this.max,this.value),this.selectedRange=T(this.value);const a=M(this.selectedDate,this.selectedMultiple,this.selectedRange);this._focusedDate=n.dateInRange(this.calculateFocusFromValue&&a!==null?a:this.state.focusedDate,this.min,this.max);const u=f.classNames("k-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},t={"aria-disabled":b},h=this.lastView!==s,c=this.dates&&this.isInMonth(this.state.navigateDate,this.dates[0]),g=this.lastViewsCount!==this.props.views;(!c||h||g)&&(this.dates=this.service.datesList(this.state.navigateDate,this.props.views||x.HorizontalViewList.defaultProps.views));const o=r.cloneDate(this.dates&&this.dates[0]?this.dates[0]:n.getToday());return p.createElement("div",{ref:m=>{this._element=m},className:u,id:this.props.id||this.wrapperID,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.disabled?void 0:this.props.tabIndex,onFocus:this.handleFocus,onBlur:this.handleBlur,onMouseDown:this.handleMouseDown,onClick:this.handleClick,onKeyDown:this.handleKeyDown,"aria-disabled":this.props.disabled,dir:this.props.dir},p.createElement(_.Header,{key:`.kendo.calendar.header.${o.getTime()}`,activeView:s,currentDate:o,min:this.min,max:this.max,rangeLength:this.props.views,bus:this.bus,service:this.service,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode,commands:p.createElement(p.Fragment,null,p.createElement(O.Button,{type:"button",className:"k-calendar-nav-prev",icon:this.isRtl?"chevron-right":"chevron-left",svgIcon:this.isRtl?R.chevronRightIcon:R.chevronLeftIcon,fillMode:"flat",title:y,disabled:V,onClick:this.handlePrevButtonClick,...e}),p.createElement(H.TodayCommand,{min:this.min,max:this.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange}),p.createElement(O.Button,{type:"button",className:"k-calendar-nav-next",icon:this.isRtl?"chevron-left":"chevron-right",svgIcon:this.isRtl?R.chevronLeftIcon:R.chevronRightIcon,fillMode:"flat",title:E,disabled:b,onClick:this.handleNextButtonClick,...t}))}),p.createElement(x.HorizontalViewList,{ref:m=>{this.calendarViewList=m},dates:this.dates,activeView:s,focusedDate:this.focusedDate,min:this.min,max:this.max,bus:this.bus,service:this.service,selectionRange:D,value:this.selectedMultiple||this.selectedDate,cellUID:this.cellUID,views:this.props.views,onChange:this.handleDateChange,showWeekNumbers:this.props.weekNumber,onCellEnter:this.handleCellEnter,cell:this.props.cell,weekCell:this.props.weekCell,headerTitle:this.props.headerTitle,verticalView:this.props.mobileMode}))}isInMonth(s,a){return!!a&&r.firstDayOfMonth(a)<=s&&s<=r.lastDayOfMonth(a)}};d.displayName="MultiViewCalendar",d.propTypes={activeRangeEnd:i.oneOf(["start","end"]),allowReverse:i.bool,bottomView:i.oneOf(["month","year","decade","century"]),className:i.string,defaultActiveView:i.oneOf(["month","year","decade","century"]),defaultValue:i.oneOfType([n.nullable(i.instanceOf(Date)),i.arrayOf(i.instanceOf(Date)),i.shape({start:n.nullable(i.instanceOf(Date)),end:n.nullable(i.instanceOf(Date))})]),disabled:i.bool,focusedDate:i.instanceOf(Date),id:i.string,ariaLabelledBy:i.string,ariaDescribedBy:i.string,max:i.instanceOf(Date),min:i.instanceOf(Date),mode:i.oneOf(["single","multiple","range"]),onBlur:i.func,onChange:i.func,onFocus:i.func,tabIndex:i.number,topView:i.oneOf(["month","year","decade","century"]),value:i.oneOfType([n.nullable(i.instanceOf(Date)),i.arrayOf(i.instanceOf(Date)),i.shape({start:n.nullable(i.instanceOf(Date).isRequired),end:n.nullable(i.instanceOf(Date).isRequired)})]),views:(s,a,u)=>{const D=s[a];return D!==void 0&&D<1?new Error(`Invalid prop '${a}' supplied to'${u}'. The '${a}' property cannot be less than 1'`):null},weekNumber:i.bool,dir:i.string},d.defaultProps={disabled:!1,min:n.MIN_DATE,max:n.MAX_DATE,navigation:!0,defaultActiveView:"month",defaultValue:null,topView:"century",tabIndex:0,bottomView:"month",views:2,allowReverse:!1};let v=d;const N=f.createPropsContext(),P=f.withIdHOC(f.withPropsContext(N,v));P.displayName="KendoReactMultiViewCalendar";I.registerForIntl(v);I.registerForLocalization(v);exports.MultiViewCalendar=P;exports.MultiViewCalendarPropsContext=N;exports.MultiViewCalendarWithoutContext=v;
|
|
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;
|
|
@@ -7,44 +7,44 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as d from "react";
|
|
10
|
-
import
|
|
10
|
+
import t from "prop-types";
|
|
11
11
|
import { provideIntlService as q, provideLocalizationService as H, registerForIntl as j, registerForLocalization as G } from "@progress/kendo-react-intl";
|
|
12
|
-
import { Keys as
|
|
13
|
-
import { isEqualDate as
|
|
14
|
-
import { Button as
|
|
15
|
-
import { chevronRightIcon as
|
|
12
|
+
import { Keys as k, classNames as X, createPropsContext as J, withIdHOC as Q, withPropsContext as Z } from "@progress/kendo-react-common";
|
|
13
|
+
import { isEqualDate as A, cloneDate as u, getDate as f, firstDayOfMonth as W, lastDayOfMonth as ee } from "@progress/kendo-date-math";
|
|
14
|
+
import { Button as M } from "@progress/kendo-react-buttons";
|
|
15
|
+
import { chevronRightIcon as T, chevronLeftIcon as N } from "@progress/kendo-svg-icons";
|
|
16
16
|
import { Action as y } from "../models/NavigationAction.mjs";
|
|
17
|
-
import { CalendarViewEnum as
|
|
17
|
+
import { CalendarViewEnum as E } from "../models/CalendarViewEnum.mjs";
|
|
18
18
|
import { EMPTY_SELECTIONRANGE as Y } from "../models/SelectionRange.mjs";
|
|
19
19
|
import { Header as te } from "./Header.mjs";
|
|
20
|
-
import { dateInRange as R, getToday as C, viewInRange as P, nullable as D, MIN_DATE as se, MAX_DATE as ie, isInRange as
|
|
20
|
+
import { dateInRange as R, getToday as C, viewInRange as P, nullable as D, MIN_DATE as se, MAX_DATE as ie, isInRange as I } from "../../utils.mjs";
|
|
21
21
|
import { prevView as S, messages as B, nextView as L } from "../../messages/index.mjs";
|
|
22
22
|
import { BusViewService as ae } from "../services/BusViewService.mjs";
|
|
23
23
|
import { NavigationService as ne } from "../services/NavigationService.mjs";
|
|
24
24
|
import { HorizontalViewList as x } from "./HorizontalViewList.mjs";
|
|
25
|
-
import { TodayCommand as
|
|
26
|
-
const
|
|
25
|
+
import { TodayCommand as oe } from "./TodayCommand.mjs";
|
|
26
|
+
const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Date && !Array.isArray(a) && I(f(a), l, i) ? f(a) : null, _ = (l = p.defaultProps.min, i = p.defaultProps.max, a) => Array.isArray(a) ? a.filter((h) => I(h, l, i)).map((h) => f(h)) : null, K = (l) => typeof l == "object" && !(l instanceof Date) && l !== null && !Array.isArray(l) ? l : Y, z = (l, i, a) => l || i && i[0] || a && a.start, re = (l, i) => l.start === null && i === null ? "start" : l.end === null ? "end" : "start", c = class c extends d.Component {
|
|
27
27
|
constructor(i) {
|
|
28
28
|
super(i), this.dates = [], this.selectedDate = null, this.selectedMultiple = null, this.selectedRange = Y, this._focusedDate = /* @__PURE__ */ new Date(), this.cellUID = this.props.id + "-cell-uid", this.activeRangeEnd = "start", this._element = null, this.intl = null, this.localization = null, this.service = null, this.calendarViewList = null, this.isActive = !1, this.calculateFocusFromValue = !0, this.focus = () => {
|
|
29
29
|
this._element && this._element.focus();
|
|
30
|
-
}, this.clampRange = (e) => ({ start: e, end: null }), this.rangeWithFocused = (e,
|
|
30
|
+
}, this.clampRange = (e) => ({ start: e, end: null }), this.rangeWithFocused = (e, s) => ({
|
|
31
31
|
start: e.start,
|
|
32
|
-
end: e.end === null && e.start !== null && this.isActive ?
|
|
33
|
-
}), this.generateRange = (e,
|
|
34
|
-
const { end: r, start:
|
|
35
|
-
return !this.props.allowReverse && m ? { start: e, end: this.selectedRange.start } : this.activeRange !== "end" ? { start: e, end: r } : { start:
|
|
32
|
+
end: e.end === null && e.start !== null && this.isActive ? s : e.end
|
|
33
|
+
}), this.generateRange = (e, s) => {
|
|
34
|
+
const { end: r, start: o } = s, m = s.start !== null && e.getTime() <= s.start.getTime();
|
|
35
|
+
return !this.props.allowReverse && m ? { start: e, end: this.selectedRange.start } : this.activeRange !== "end" ? { start: e, end: r } : { start: o || this.selectedDate, end: e };
|
|
36
36
|
}, this.canNavigate = (e) => {
|
|
37
37
|
if (!this.service)
|
|
38
38
|
return !1;
|
|
39
|
-
const
|
|
40
|
-
return this.min <=
|
|
41
|
-
}, this.navigate = (e,
|
|
39
|
+
const s = this.service.move(this.focusedDate, e);
|
|
40
|
+
return this.min <= s && s <= this.max || this.service.isInSameView(s, this.min) || this.service.isInSameView(s, this.max);
|
|
41
|
+
}, this.navigate = (e, s) => {
|
|
42
42
|
this.calculateFocusFromValue = !1;
|
|
43
|
-
const r = this.move(e,
|
|
43
|
+
const r = this.move(e, s);
|
|
44
44
|
this.setState({ navigateDate: r, focusedDate: r });
|
|
45
|
-
}, this.move = (e,
|
|
46
|
-
const { end: r, start:
|
|
47
|
-
return this.activeRange !== "end" ? r !== null && e > r :
|
|
45
|
+
}, this.move = (e, s) => this.clampDate(this.service.move(s, e)), this.clampDate = (e) => R(e, this.min, this.max), this.shouldAutoCorrect = (e, s) => {
|
|
46
|
+
const { end: r, start: o } = s;
|
|
47
|
+
return this.activeRange !== "end" ? r !== null && e > r : o !== null && e < o;
|
|
48
48
|
}, this.handleCellEnter = (e) => {
|
|
49
49
|
this.props.mode === "range" && (this.calculateFocusFromValue = !1, this.setState({
|
|
50
50
|
focusedDate: e
|
|
@@ -57,14 +57,14 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
57
57
|
if (this.isActive = !0, !this.calendarViewList)
|
|
58
58
|
return;
|
|
59
59
|
this.calendarViewList.focusActiveDate();
|
|
60
|
-
const { onFocus:
|
|
61
|
-
|
|
60
|
+
const { onFocus: s } = this.props;
|
|
61
|
+
s && s.call(void 0, e);
|
|
62
62
|
}, this.handleBlur = (e) => {
|
|
63
63
|
if (this.isActive = !1, !this.calendarViewList)
|
|
64
64
|
return;
|
|
65
65
|
this.calendarViewList.blurActiveDate();
|
|
66
|
-
const { onBlur:
|
|
67
|
-
|
|
66
|
+
const { onBlur: s } = this.props;
|
|
67
|
+
s && s.call(void 0, e);
|
|
68
68
|
}, this.handleTodayClick = (e) => {
|
|
69
69
|
this.todayIsInRange && this.handleDateChange(e);
|
|
70
70
|
}, this.handlePrevButtonClick = () => {
|
|
@@ -72,18 +72,18 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
72
72
|
if (this.state.activeView > 0 && this.focusedDate.getFullYear() > this.dates[0].getFullYear())
|
|
73
73
|
this.navigate(e, this.move(e, this.focusedDate));
|
|
74
74
|
else {
|
|
75
|
-
const
|
|
76
|
-
this.navigate(e,
|
|
75
|
+
const s = this.isInMonth(this.focusedDate, this.dates[1]) ? this.move(e, this.focusedDate) : this.focusedDate;
|
|
76
|
+
this.navigate(e, s);
|
|
77
77
|
}
|
|
78
78
|
}, this.handleNextButtonClick = () => {
|
|
79
79
|
this.navigate(y.NextView, this.focusedDate);
|
|
80
80
|
}, this.handleKeyDown = (e) => {
|
|
81
|
-
const { keyCode: r, ctrlKey:
|
|
81
|
+
const { keyCode: r, ctrlKey: o, metaKey: m } = e;
|
|
82
82
|
if (r === 84) {
|
|
83
83
|
const n = C();
|
|
84
84
|
this.calculateFocusFromValue = !1, this.setState({ focusedDate: n, navigateDate: n });
|
|
85
85
|
}
|
|
86
|
-
if ((
|
|
86
|
+
if ((o || m) && (r === k.left && this.handlePrevButtonClick(), r === k.right && this.handleNextButtonClick()), r === k.enter) {
|
|
87
87
|
const n = {
|
|
88
88
|
syntheticEvent: e,
|
|
89
89
|
nativeEvent: e.nativeEvent,
|
|
@@ -103,63 +103,63 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
103
103
|
this.min,
|
|
104
104
|
this.max
|
|
105
105
|
);
|
|
106
|
-
if (
|
|
106
|
+
if (A(this.focusedDate, n))
|
|
107
107
|
return;
|
|
108
108
|
this.dates && this.service && !this.service.isInArray(n, this.dates) && this.setState({ navigateDate: n }), this.calculateFocusFromValue = !1, this.setState({ focusedDate: n });
|
|
109
109
|
}
|
|
110
110
|
e.preventDefault();
|
|
111
111
|
}, this.handleViewChange = ({ view: e }) => {
|
|
112
|
-
this.calculateFocusFromValue = !1, this.setState((
|
|
112
|
+
this.calculateFocusFromValue = !1, this.setState((s) => ({ activeView: e, navigateDate: s.focusedDate }));
|
|
113
113
|
}, this.handleDateChange = (e) => {
|
|
114
|
-
const
|
|
114
|
+
const s = u(e.value), r = this.bus.canMoveDown(this.state.activeView);
|
|
115
115
|
if (this.props.disabled)
|
|
116
116
|
return;
|
|
117
117
|
if (r)
|
|
118
118
|
if (e.isTodayClick)
|
|
119
119
|
this.bus.moveToBottom(this.state.activeView);
|
|
120
120
|
else {
|
|
121
|
-
this.bus.moveDown(this.state.activeView, e.syntheticEvent), this.setState({ focusedDate:
|
|
121
|
+
this.bus.moveDown(this.state.activeView, e.syntheticEvent), this.setState({ focusedDate: s, navigateDate: s });
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
this.calculateFocusFromValue = !0;
|
|
125
|
-
let
|
|
125
|
+
let o;
|
|
126
126
|
switch (this.props.mode) {
|
|
127
127
|
case "single":
|
|
128
|
-
|
|
128
|
+
o = u(e.value);
|
|
129
129
|
break;
|
|
130
130
|
case "multiple":
|
|
131
131
|
if (Array.isArray(this.selectedMultiple)) {
|
|
132
132
|
const n = this.selectedMultiple.slice();
|
|
133
133
|
let v = -1;
|
|
134
134
|
n.forEach((U, $) => {
|
|
135
|
-
|
|
136
|
-
}), v !== -1 ? n.splice(v, 1) : n.push(u(e.value)),
|
|
135
|
+
A(U, e.value) && (v = $);
|
|
136
|
+
}), v !== -1 ? n.splice(v, 1) : n.push(u(e.value)), o = n.slice();
|
|
137
137
|
} else
|
|
138
|
-
this.selectedDate ?
|
|
138
|
+
this.selectedDate ? o = [u(this.selectedDate), u(e.value)] : o = [u(e.value)];
|
|
139
139
|
break;
|
|
140
140
|
case "range": {
|
|
141
|
-
|
|
141
|
+
o = this.selectedRange.start !== null && this.selectedRange.end !== null && this.activeRange === "start" ? this.clampRange(e.value) : this.generateRange(e.value, this.selectedRange), this.activeRangeEnd = this.activeRange !== "end" ? "end" : "start";
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
144
144
|
default:
|
|
145
|
-
|
|
145
|
+
o = u(e.value);
|
|
146
146
|
break;
|
|
147
147
|
}
|
|
148
|
-
this.valueDuringOnChange =
|
|
148
|
+
this.valueDuringOnChange = o, e.isTodayClick && this.setState({ navigateDate: s }), this.setState({ value: o, focusedDate: s }), this.valueDuringOnChange = o;
|
|
149
149
|
const { onChange: m } = this.props;
|
|
150
150
|
if (m) {
|
|
151
151
|
const n = {
|
|
152
152
|
syntheticEvent: e.syntheticEvent,
|
|
153
153
|
nativeEvent: e.nativeEvent,
|
|
154
|
-
value:
|
|
154
|
+
value: o,
|
|
155
155
|
target: this
|
|
156
156
|
};
|
|
157
157
|
m.call(void 0, n);
|
|
158
158
|
}
|
|
159
159
|
this.valueDuringOnChange = void 0;
|
|
160
160
|
};
|
|
161
|
-
const a = i.value !== void 0 ? i.value : i.defaultValue || c.defaultProps.defaultValue, h =
|
|
162
|
-
|
|
161
|
+
const a = i.value !== void 0 ? i.value : i.defaultValue || c.defaultProps.defaultValue, h = O(this.min, this.max, a), g = _(this.min, this.max, a), b = K(a), F = z(h, g, b), w = P(
|
|
162
|
+
E[i.defaultActiveView],
|
|
163
163
|
this.bottomView,
|
|
164
164
|
this.topView
|
|
165
165
|
), V = R(
|
|
@@ -205,16 +205,16 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
205
205
|
return f(this.props.max !== void 0 ? this.props.max : c.defaultProps.max);
|
|
206
206
|
}
|
|
207
207
|
get bottomView() {
|
|
208
|
-
return
|
|
208
|
+
return E[this.props.bottomView !== void 0 ? this.props.bottomView : c.defaultProps.bottomView];
|
|
209
209
|
}
|
|
210
210
|
get topView() {
|
|
211
|
-
return
|
|
211
|
+
return E[this.props.topView !== void 0 ? this.props.topView : c.defaultProps.topView];
|
|
212
212
|
}
|
|
213
213
|
get activeRange() {
|
|
214
214
|
return this.props.activeRangeEnd !== void 0 ? this.props.activeRangeEnd : this.activeRangeEnd;
|
|
215
215
|
}
|
|
216
216
|
get todayIsInRange() {
|
|
217
|
-
return
|
|
217
|
+
return I(C(), f(this.min), f(this.max));
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
220
220
|
* @hidden
|
|
@@ -227,7 +227,7 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
227
227
|
*/
|
|
228
228
|
componentDidUpdate() {
|
|
229
229
|
this.calendarViewList && (this.isActive ? this.calendarViewList.focusActiveDate : this.calendarViewList.blurActiveDate)();
|
|
230
|
-
const i =
|
|
230
|
+
const i = O(this.min, this.max, this.value);
|
|
231
231
|
this.calculateFocusFromValue = !!(this.selectedDate && i && this.selectedDate.getTime() && i.getTime()), this.lastView = this.state.activeView, this.lastViewsCount = this.props.views || x.defaultProps.views;
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
@@ -236,7 +236,7 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
236
236
|
render() {
|
|
237
237
|
this.props._ref && this.props._ref(this), this.intl = q(this), this.localization = H(this), this.bus.configure(this.bottomView, this.topView);
|
|
238
238
|
const i = P(this.state.activeView, this.bottomView, this.topView);
|
|
239
|
-
this.service = this.bus.service(i, this.intl), this.selectedDate =
|
|
239
|
+
this.service = this.bus.service(i, this.intl), this.selectedDate = O(this.min, this.max, this.value), this.selectedMultiple = _(this.min, this.max, this.value), this.selectedRange = K(this.value);
|
|
240
240
|
const a = z(this.selectedDate, this.selectedMultiple, this.selectedRange);
|
|
241
241
|
this._focusedDate = R(
|
|
242
242
|
this.calculateFocusFromValue && a !== null ? a : this.state.focusedDate,
|
|
@@ -249,8 +249,8 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
249
249
|
"k-disabled": this.props.disabled
|
|
250
250
|
},
|
|
251
251
|
this.props.className
|
|
252
|
-
), g = this.rangeWithFocused(this.selectedRange, this.focusedDate), b = this.localization.toLanguageString(S, B[S]), F = this.localization.toLanguageString(L, B[L]), w = !this.canNavigate(y.PrevView), V = !this.canNavigate(y.NextView), e = { "aria-disabled": w },
|
|
253
|
-
(!
|
|
252
|
+
), g = this.rangeWithFocused(this.selectedRange, this.focusedDate), b = this.localization.toLanguageString(S, B[S]), F = this.localization.toLanguageString(L, B[L]), w = !this.canNavigate(y.PrevView), V = !this.canNavigate(y.NextView), e = { "aria-disabled": w }, s = { "aria-disabled": V }, r = this.lastView !== i, o = this.dates && this.isInMonth(this.state.navigateDate, this.dates[0]), m = this.lastViewsCount !== this.props.views;
|
|
253
|
+
(!o || r || m) && (this.dates = this.service.datesList(
|
|
254
254
|
this.state.navigateDate,
|
|
255
255
|
this.props.views || x.defaultProps.views
|
|
256
256
|
));
|
|
@@ -288,12 +288,12 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
288
288
|
headerTitle: this.props.headerTitle,
|
|
289
289
|
verticalView: this.props.mobileMode,
|
|
290
290
|
commands: /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement(
|
|
291
|
-
|
|
291
|
+
M,
|
|
292
292
|
{
|
|
293
293
|
type: "button",
|
|
294
294
|
className: "k-calendar-nav-prev",
|
|
295
295
|
icon: this.isRtl ? "chevron-right" : "chevron-left",
|
|
296
|
-
svgIcon: this.isRtl ?
|
|
296
|
+
svgIcon: this.isRtl ? T : N,
|
|
297
297
|
fillMode: "flat",
|
|
298
298
|
title: b,
|
|
299
299
|
disabled: w,
|
|
@@ -301,7 +301,7 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
301
301
|
...e
|
|
302
302
|
}
|
|
303
303
|
), /* @__PURE__ */ d.createElement(
|
|
304
|
-
|
|
304
|
+
oe,
|
|
305
305
|
{
|
|
306
306
|
min: this.min,
|
|
307
307
|
max: this.max,
|
|
@@ -309,17 +309,17 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
309
309
|
disabled: !this.todayIsInRange
|
|
310
310
|
}
|
|
311
311
|
), /* @__PURE__ */ d.createElement(
|
|
312
|
-
|
|
312
|
+
M,
|
|
313
313
|
{
|
|
314
314
|
type: "button",
|
|
315
315
|
className: "k-calendar-nav-next",
|
|
316
316
|
icon: this.isRtl ? "chevron-left" : "chevron-right",
|
|
317
|
-
svgIcon: this.isRtl ? N :
|
|
317
|
+
svgIcon: this.isRtl ? N : T,
|
|
318
318
|
fillMode: "flat",
|
|
319
319
|
title: F,
|
|
320
320
|
disabled: V,
|
|
321
321
|
onClick: this.handleNextButtonClick,
|
|
322
|
-
...
|
|
322
|
+
...s
|
|
323
323
|
}
|
|
324
324
|
))
|
|
325
325
|
}
|
|
@@ -333,6 +333,7 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
333
333
|
dates: this.dates,
|
|
334
334
|
activeView: i,
|
|
335
335
|
focusedDate: this.focusedDate,
|
|
336
|
+
weekDaysFormat: this.props.weekDaysFormat,
|
|
336
337
|
min: this.min,
|
|
337
338
|
max: this.max,
|
|
338
339
|
bus: this.bus,
|
|
@@ -347,7 +348,8 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
347
348
|
cell: this.props.cell,
|
|
348
349
|
weekCell: this.props.weekCell,
|
|
349
350
|
headerTitle: this.props.headerTitle,
|
|
350
|
-
verticalView: this.props.mobileMode
|
|
351
|
+
verticalView: this.props.mobileMode,
|
|
352
|
+
showOtherMonthDays: this.props.showOtherMonthDays
|
|
351
353
|
}
|
|
352
354
|
)
|
|
353
355
|
);
|
|
@@ -361,38 +363,39 @@ const k = (o = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Da
|
|
|
361
363
|
}
|
|
362
364
|
};
|
|
363
365
|
c.displayName = "MultiViewCalendar", c.propTypes = {
|
|
364
|
-
activeRangeEnd:
|
|
365
|
-
allowReverse:
|
|
366
|
-
bottomView:
|
|
367
|
-
className:
|
|
368
|
-
defaultActiveView:
|
|
369
|
-
defaultValue:
|
|
370
|
-
D(
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
start: D(
|
|
374
|
-
end: D(
|
|
366
|
+
activeRangeEnd: t.oneOf(["start", "end"]),
|
|
367
|
+
allowReverse: t.bool,
|
|
368
|
+
bottomView: t.oneOf(["month", "year", "decade", "century"]),
|
|
369
|
+
className: t.string,
|
|
370
|
+
defaultActiveView: t.oneOf(["month", "year", "decade", "century"]),
|
|
371
|
+
defaultValue: t.oneOfType([
|
|
372
|
+
D(t.instanceOf(Date)),
|
|
373
|
+
t.arrayOf(t.instanceOf(Date)),
|
|
374
|
+
t.shape({
|
|
375
|
+
start: D(t.instanceOf(Date)),
|
|
376
|
+
end: D(t.instanceOf(Date))
|
|
375
377
|
})
|
|
376
378
|
]),
|
|
377
|
-
disabled:
|
|
378
|
-
focusedDate:
|
|
379
|
-
id:
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
379
|
+
disabled: t.bool,
|
|
380
|
+
focusedDate: t.instanceOf(Date),
|
|
381
|
+
id: t.string,
|
|
382
|
+
weekDaysFormat: t.oneOf(["narrow", "short", "abbreviated"]),
|
|
383
|
+
ariaLabelledBy: t.string,
|
|
384
|
+
ariaDescribedBy: t.string,
|
|
385
|
+
max: t.instanceOf(Date),
|
|
386
|
+
min: t.instanceOf(Date),
|
|
387
|
+
mode: t.oneOf(["single", "multiple", "range"]),
|
|
388
|
+
onBlur: t.func,
|
|
389
|
+
onChange: t.func,
|
|
390
|
+
onFocus: t.func,
|
|
391
|
+
tabIndex: t.number,
|
|
392
|
+
topView: t.oneOf(["month", "year", "decade", "century"]),
|
|
393
|
+
value: t.oneOfType([
|
|
394
|
+
D(t.instanceOf(Date)),
|
|
395
|
+
t.arrayOf(t.instanceOf(Date)),
|
|
396
|
+
t.shape({
|
|
397
|
+
start: D(t.instanceOf(Date).isRequired),
|
|
398
|
+
end: D(t.instanceOf(Date).isRequired)
|
|
396
399
|
})
|
|
397
400
|
]),
|
|
398
401
|
views: (i, a, h) => {
|
|
@@ -401,8 +404,9 @@ c.displayName = "MultiViewCalendar", c.propTypes = {
|
|
|
401
404
|
`Invalid prop '${a}' supplied to'${h}'. The '${a}' property cannot be less than 1'`
|
|
402
405
|
) : null;
|
|
403
406
|
},
|
|
404
|
-
weekNumber:
|
|
405
|
-
|
|
407
|
+
weekNumber: t.bool,
|
|
408
|
+
showOtherMonthDays: t.bool,
|
|
409
|
+
dir: t.string
|
|
406
410
|
}, c.defaultProps = {
|
|
407
411
|
disabled: !1,
|
|
408
412
|
min: se,
|
|
@@ -411,18 +415,20 @@ c.displayName = "MultiViewCalendar", c.propTypes = {
|
|
|
411
415
|
defaultActiveView: "month",
|
|
412
416
|
defaultValue: null,
|
|
413
417
|
topView: "century",
|
|
418
|
+
weekDaysFormat: "short",
|
|
414
419
|
tabIndex: 0,
|
|
415
420
|
bottomView: "month",
|
|
416
421
|
views: 2,
|
|
417
|
-
allowReverse: !1
|
|
422
|
+
allowReverse: !1,
|
|
423
|
+
showOtherMonthDays: !1
|
|
418
424
|
};
|
|
419
425
|
let p = c;
|
|
420
|
-
const
|
|
426
|
+
const le = J(), he = Q(Z(le, p));
|
|
421
427
|
he.displayName = "KendoReactMultiViewCalendar";
|
|
422
428
|
j(p);
|
|
423
429
|
G(p);
|
|
424
430
|
export {
|
|
425
431
|
he as MultiViewCalendar,
|
|
426
|
-
|
|
432
|
+
le as MultiViewCalendarPropsContext,
|
|
427
433
|
p as MultiViewCalendarWithoutContext
|
|
428
434
|
};
|
|
@@ -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 p=require("react"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),a=require("prop-types"),d=require("@progress/kendo-react-intl"),m=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-buttons"),l=require("@progress/kendo-date-math"),r=require("../../messages/index.js"),i=require("../../utils.js");function h(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,c.get?c:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=h(p),n=class n extends u.Component{constructor(){super(...arguments),this.localization=null,this.handleClick=e=>{if(this.todayIsInRange&&this.props.onClick){const t={syntheticEvent:e,nativeEvent:e.nativeEvent,value:i.dateInRange(i.getToday(),this.min,this.max),target:this,isTodayClick:!0};this.props.onClick.call(void 0,t)}}}get min(){return this.props.min!==void 0?this.props.min:n.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:n.defaultProps.max}get todayIsInRange(){return i.isInRange(i.getToday(),l.getDate(this.min),l.getDate(this.max))}render(){this.localization=d.provideLocalizationService(this);const e=this.localization.toLanguageString(r.today,r.messages[r.today]),t=m.classNames("k-calendar-nav-today",{"k-disabled":this.props.disabled});return u.createElement(g.Button,{className:t,onClick:this.handleClick,tabIndex:this.props.tabIndex,fillMode:"flat",themeColor:"base",role:"link"},e)}};n.propTypes={max:a.instanceOf(Date).isRequired,min:a.instanceOf(Date).isRequired,onClick:a.func,disabled:a.bool},n.defaultProps={min:i.MIN_DATE,max:i.MAX_DATE};let o=n;d.registerForLocalization(o);exports.TodayCommand=o;
|
|
@@ -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 w=require("react"),s=require("prop-types"),p=require("@progress/kendo-date-math"),D=require("@progress/kendo-react-intl"),v=require("./CalendarCell.js"),g=require("./CalendarWeekCell.js"),k=require("../models/CalendarViewEnum.js"),m=require("../../utils.js"),b=require("../services/WeekNamesService.js");function y(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const r=y(w),f=o=>r.createElement("td",{key:o,className:"k-calendar-td k-empty"}," "),u=class u extends r.Component{constructor(){super(...arguments),this.intl=null,this.weekService=null,this.buildWeekNumber=(t,e)=>{if(!this.firstDate(t))return f(`week-cell-${e}`);const n=this.firstDate(t),a=this.getWeekNumber(n),l=`kendo-react-calendar-week-cell-${a}`,c={className:"k-alt",value:a,firstDate:n};return this.props.weekCell?r.createElement(this.props.weekCell,{...c,key:l},a):r.createElement(g.CalendarWeekCell,{...c,key:l},a)},this.buildRow=t=>t.map((e,i)=>{if(!e)return f(i);const n={"aria-selected":e.isSelected},a=`kendo-react-calendar-cell-${e.value.getTime()}`,l={...n,...e,isDisabled:!e.isInRange,view:this.props.activeView,showOtherMonthDays:this.props.showOtherMonthDays,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave};return this.props.cell?r.createElement(this.props.cell,{...l,key:a},e.formattedValue):r.createElement(v.CalendarCell,{...l,key:a},e.formattedValue)}),this.firstDate=t=>{const e=this.firstWeekDateContext(t);return e?e.value:null},this.firstWeekDateContext=t=>{if(!this.weekNumber)return null;let e=0,i=t[e];for(;!i&&e<t.length;)i=t[++e];return i},this.handleClick=(t,e)=>{const{onChange:i}=this.props;if(i&&e){const n={value:p.cloneDate(t),target:this,nativeEvent:e&&e.nativeEvent,syntheticEvent:e};i.call(void 0,n)}},this.handleMouseEnter=t=>{const{onCellEnter:e}=this.props;e&&e.call(void 0,p.cloneDate(t))},this.handleMouseLeave=t=>{const{onCellLeave:e}=this.props;e&&e.call(void 0,p.cloneDate(t))}}get min(){return this.props.min}get max(){return this.props.max}get isHorizontal(){return this.props.direction==="horizontal"}get isMonthView(){return this.props.activeView===k.CalendarViewEnum.month}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===k.CalendarViewEnum.month)}get selectedDate(){return this.props.selectedDate!==void 0?this.props.selectedDate:u.defaultProps.selectedDate}render(){this.intl=D.provideIntlService(this),this.weekService=new b.WeekNamesService(this.intl);const t=this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat),e=this.props.service.rowLength(this.weekNumber),i=this.props.service.title(this.props.viewDate),n=m.getToday(),a=m.setTime(this.props.viewDate,n),l=this.props.service.data({cellUID:this.props.cellUID,min:this.min,max:this.max,focusedDate:this.props.focusedDate,isActiveView:!this.props.bus.canMoveDown(this.props.activeView),selectedDate:this.selectedDate,selectionRange:this.props.selectionRange,viewDate:a});return r.createElement(r.Fragment,null,this.isMonthView&&this.isHorizontal&&r.createElement("thead",{role:"rowgroup",className:"k-calendar-thead"},r.createElement("tr",{role:"row",className:"k-calendar-tr"},t.map((c,h)=>r.createElement("th",{key:h,className:"k-calendar-th"},c)))),r.createElement("tbody",{role:"rowgroup",className:"k-calendar-tbody"},!this.isHorizontal&&r.createElement("tr",{role:"presentation",className:"k-calendar-tr"},r.createElement("th",{scope:"col",colSpan:e,className:"k-calendar-caption"},i)),l.map((c,h)=>r.createElement("tr",{role:"row",className:"k-calendar-tr",key:h},this.weekNumber&&this.buildWeekNumber(c,h),this.buildRow(c)))))}getWeekNumber(t){return!this.weekNumber||!this.intl?null:p.weekInYear(t,this.intl.firstDay())}};u.propTypes={activeRangeEnd:s.oneOf(["start","end",null]),activeView:s.number.isRequired,cellUID:s.string.isRequired,direction:s.oneOf(["horizontal","vertical"]),focusedDate:s.instanceOf(Date).isRequired,max:s.instanceOf(Date).isRequired,min:s.instanceOf(Date).isRequired,onChange:s.func,selectedDate:s.oneOfType([s.instanceOf(Date),s.arrayOf(s.instanceOf(Date))]),showWeekNumbers:s.bool,showOtherMonthDays:s.bool,viewDate:s.instanceOf(Date).isRequired},u.defaultProps={direction:"vertical",selectedDate:m.getToday(),showWeekNumbers:!1};let d=u;D.registerForIntl(d);exports.View=d;
|