@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
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import { cloneDate as p, weekInYear as
|
|
12
|
-
import { provideIntlService as
|
|
9
|
+
import * as r from "react";
|
|
10
|
+
import s from "prop-types";
|
|
11
|
+
import { cloneDate as p, weekInYear as D } from "@progress/kendo-date-math";
|
|
12
|
+
import { provideIntlService as w, registerForIntl as v } from "@progress/kendo-react-intl";
|
|
13
13
|
import { CalendarCell as g } from "./CalendarCell.mjs";
|
|
14
14
|
import { CalendarWeekCell as N } from "./CalendarWeekCell.mjs";
|
|
15
15
|
import { CalendarViewEnum as u } from "../models/CalendarViewEnum.mjs";
|
|
16
16
|
import { getToday as d, setTime as b } from "../../utils.mjs";
|
|
17
|
-
import { WeekNamesService as
|
|
18
|
-
const k = (f) => /* @__PURE__ */
|
|
17
|
+
import { WeekNamesService as y } from "../services/WeekNamesService.mjs";
|
|
18
|
+
const k = (f) => /* @__PURE__ */ r.createElement("td", { key: f, className: "k-calendar-td k-empty" }, " "), c = class c extends r.Component {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments), this.intl = null, this.weekService = null, this.buildWeekNumber = (t, e) => {
|
|
21
21
|
if (!this.firstDate(t))
|
|
@@ -25,7 +25,7 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
|
|
|
25
25
|
value: a,
|
|
26
26
|
firstDate: n
|
|
27
27
|
};
|
|
28
|
-
return this.props.weekCell ? /* @__PURE__ */
|
|
28
|
+
return this.props.weekCell ? /* @__PURE__ */ r.createElement(this.props.weekCell, { ...l, key: o }, a) : /* @__PURE__ */ r.createElement(N, { ...l, key: o }, a);
|
|
29
29
|
}, this.buildRow = (t) => t.map((e, i) => {
|
|
30
30
|
if (!e)
|
|
31
31
|
return k(i);
|
|
@@ -34,11 +34,12 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
|
|
|
34
34
|
...e,
|
|
35
35
|
isDisabled: !e.isInRange,
|
|
36
36
|
view: this.props.activeView,
|
|
37
|
+
showOtherMonthDays: this.props.showOtherMonthDays,
|
|
37
38
|
onClick: this.handleClick,
|
|
38
39
|
onMouseEnter: this.handleMouseEnter,
|
|
39
40
|
onMouseLeave: this.handleMouseLeave
|
|
40
41
|
};
|
|
41
|
-
return this.props.cell ? /* @__PURE__ */
|
|
42
|
+
return this.props.cell ? /* @__PURE__ */ r.createElement(this.props.cell, { ...o, key: a }, e.formattedValue) : /* @__PURE__ */ r.createElement(g, { ...o, key: a }, e.formattedValue);
|
|
42
43
|
}), this.firstDate = (t) => {
|
|
43
44
|
const e = this.firstWeekDateContext(t);
|
|
44
45
|
return e ? e.value : null;
|
|
@@ -87,8 +88,8 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
|
|
|
87
88
|
return this.props.selectedDate !== void 0 ? this.props.selectedDate : c.defaultProps.selectedDate;
|
|
88
89
|
}
|
|
89
90
|
render() {
|
|
90
|
-
this.intl =
|
|
91
|
-
const t = this.weekService.getWeekNames(this.weekNumber), e = this.props.service.rowLength(this.weekNumber), i = this.props.service.title(this.props.viewDate), n = d(), a = b(this.props.viewDate, n), o = this.props.service.data({
|
|
91
|
+
this.intl = w(this), this.weekService = new y(this.intl);
|
|
92
|
+
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 = d(), a = b(this.props.viewDate, n), o = this.props.service.data({
|
|
92
93
|
cellUID: this.props.cellUID,
|
|
93
94
|
min: this.min,
|
|
94
95
|
max: this.max,
|
|
@@ -98,20 +99,20 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
|
|
|
98
99
|
selectionRange: this.props.selectionRange,
|
|
99
100
|
viewDate: a
|
|
100
101
|
});
|
|
101
|
-
return /* @__PURE__ */
|
|
102
|
+
return /* @__PURE__ */ r.createElement(r.Fragment, null, this.isMonthView && this.isHorizontal && /* @__PURE__ */ r.createElement(
|
|
102
103
|
"thead",
|
|
103
104
|
{
|
|
104
105
|
role: "rowgroup",
|
|
105
106
|
className: "k-calendar-thead"
|
|
106
107
|
},
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
), /* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ r.createElement("tr", { role: "row", className: "k-calendar-tr" }, t.map((l, h) => /* @__PURE__ */ r.createElement("th", { key: h, className: "k-calendar-th" }, l)))
|
|
109
|
+
), /* @__PURE__ */ r.createElement(
|
|
109
110
|
"tbody",
|
|
110
111
|
{
|
|
111
112
|
role: "rowgroup",
|
|
112
113
|
className: "k-calendar-tbody"
|
|
113
114
|
},
|
|
114
|
-
!this.isHorizontal && /* @__PURE__ */
|
|
115
|
+
!this.isHorizontal && /* @__PURE__ */ r.createElement("tr", { role: "presentation", className: "k-calendar-tr" }, /* @__PURE__ */ r.createElement(
|
|
115
116
|
"th",
|
|
116
117
|
{
|
|
117
118
|
scope: "col",
|
|
@@ -120,34 +121,35 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
|
|
|
120
121
|
},
|
|
121
122
|
i
|
|
122
123
|
)),
|
|
123
|
-
o.map((l, h) => /* @__PURE__ */
|
|
124
|
+
o.map((l, h) => /* @__PURE__ */ r.createElement("tr", { role: "row", className: "k-calendar-tr", key: h }, this.weekNumber && this.buildWeekNumber(l, h), this.buildRow(l)))
|
|
124
125
|
));
|
|
125
126
|
}
|
|
126
127
|
getWeekNumber(t) {
|
|
127
|
-
return !this.weekNumber || !this.intl ? null :
|
|
128
|
+
return !this.weekNumber || !this.intl ? null : D(t, this.intl.firstDay());
|
|
128
129
|
}
|
|
129
130
|
};
|
|
130
131
|
c.propTypes = {
|
|
131
|
-
activeRangeEnd:
|
|
132
|
-
activeView:
|
|
133
|
-
cellUID:
|
|
134
|
-
direction:
|
|
135
|
-
focusedDate:
|
|
136
|
-
max:
|
|
137
|
-
min:
|
|
138
|
-
onChange:
|
|
139
|
-
selectedDate:
|
|
140
|
-
[
|
|
132
|
+
activeRangeEnd: s.oneOf(["start", "end", null]),
|
|
133
|
+
activeView: s.number.isRequired,
|
|
134
|
+
cellUID: s.string.isRequired,
|
|
135
|
+
direction: s.oneOf(["horizontal", "vertical"]),
|
|
136
|
+
focusedDate: s.instanceOf(Date).isRequired,
|
|
137
|
+
max: s.instanceOf(Date).isRequired,
|
|
138
|
+
min: s.instanceOf(Date).isRequired,
|
|
139
|
+
onChange: s.func,
|
|
140
|
+
selectedDate: s.oneOfType(
|
|
141
|
+
[s.instanceOf(Date), s.arrayOf(s.instanceOf(Date))]
|
|
141
142
|
),
|
|
142
|
-
showWeekNumbers:
|
|
143
|
-
|
|
143
|
+
showWeekNumbers: s.bool,
|
|
144
|
+
showOtherMonthDays: s.bool,
|
|
145
|
+
viewDate: s.instanceOf(Date).isRequired
|
|
144
146
|
}, c.defaultProps = {
|
|
145
147
|
direction: "vertical",
|
|
146
148
|
selectedDate: d(),
|
|
147
149
|
showWeekNumbers: !1
|
|
148
150
|
};
|
|
149
151
|
let m = c;
|
|
150
|
-
|
|
152
|
+
v(m);
|
|
151
153
|
export {
|
|
152
154
|
m as View
|
|
153
155
|
};
|
|
@@ -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 y=require("react"),r=require("prop-types"),V=require("@progress/kendo-react-common"),d=require("@progress/kendo-date-math"),f=require("@progress/kendo-react-intl"),x=require("../../virtualization/Virtualization.js"),S=require("./View.js"),C=require("./Header.js"),E=require("../services/WeekNamesService.js"),c=require("../../utils.js"),l=require("../models/CalendarViewEnum.js"),I=require("./TodayCommand.js");function T(h){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const e in h)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(h,e);Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:()=>h[e]})}}return o.default=h,Object.freeze(o)}const s=T(y),N=5,p=class p extends s.Component{constructor(o){super(o),this.virtualization=null,this.calendarView=null,this.table=null,this.intl=null,this.bottomOffset=0,this.viewOffset=0,this.viewHeight=0,this._element=null,this.isActive=!1,this.animateToIndex=!0,this.shouldScroll=!1,this.weekService=null,this.focusActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus"),t=this._element.querySelector(".k-state-pending-focus");e&&e[0]&&e[0].classList.remove("k-focus"),t&&t.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus");e&&e.classList.remove("k-focus"),this.isActive=!1},this.handleVirtualizationMount=e=>{if(this.virtualization=e,this.virtualization&&this.table){this.table.style.transform=`translateY(${this.viewOffset}px)`;const t=c.dateInRange(this.props.focusedDate,this.props.min,this.props.max),i=this.props.service.skip(t,this.props.min);this.virtualization.scrollToIndex(i)}},this.buildMonthView=(e,t)=>s.createElement("table",{key:"calendar-view-list-weekdays",className:"k-calendar-table k-calendar-weekdays",role:"grid",tabIndex:this.props.tabIndex},s.createElement("colgroup",null,e.map((i,a)=>s.createElement("col",{key:a}))),s.createElement("thead",{className:"k-calendar-thead"},s.createElement("tr",{className:"k-calendar-tr"},t.map((i,a)=>s.createElement("th",{key:a,className:"k-calendar-th"},i))))),this.buildDates=(e,t)=>{const i=this.props.cellUID;return s.createElement("table",{className:"k-calendar-table",ref:a=>this.table=a,role:"grid",tabIndex:this.props.tabIndex,"aria-activedescendant":i+this.props.focusedDate.getTime()},s.createElement("colgroup",null,e.map((a,n)=>s.createElement("col",{key:n}))),t.map(a=>s.createElement(S.View,{ref:n=>{this.calendarView||(this.calendarView=n)},key:a.getTime(),activeView:this.props.activeView,viewDate:a,min:this.props.min,max:this.props.max,cellUID:i,focusedDate:this.props.focusedDate,cell:this.props.cell,selectedDate:this.props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,bus:this.props.bus,service:this.props.service,weekCell:this.props.weekCell,showOtherMonthDays:this.props.showOtherMonthDays})))},this.calculateHeights=()=>{if(!this.props.dom)return;const e=this.props.activeView===l.CalendarViewEnum.month?this.props.dom.scrollableContentHeight:this.props.dom.scrollableYearContentHeight;this.bottomOffset=e-this.props.dom.viewHeight(this.props.activeView),this.viewOffset=-1*this.props.dom.headerHeight,this.viewHeight=this.props.dom.viewHeight(this.props.activeView)||1},this.getTake=(e,t)=>Math.min(t-e,this.take),this.handleScrollAction=({index:e,scrollAction:t,pageAction:i})=>{const a=i?i.skip:this.state.skip;if((this.state.index!==e||this.state.skip!==a)&&this.setState({index:e,skip:a}),this.table&&t){const n=`translateY(${t.offset}px)`;this.table.style.transform=n}},this.handleTodayClick=e=>{this.shouldScroll=!0,this.handleDateChange.call(void 0,e,!0)},this.handleDateChange=(e,t=!1)=>{const{onChange:i}=this.props;if(i){const a={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:d.cloneDate(e.value),target:this,isTodayClick:t};i.call(void 0,a)}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.state={skip:this.props.service.skip(this.props.focusedDate,this.props.min),index:this.props.service.skip(this.props.focusedDate,this.props.min)}}get element(){return this._element}get weekNames(){this.intl=f.provideIntlService(this),this.weekService=new E.WeekNamesService(this.intl);const o=this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat),e=c.shiftWeekNames(o,this.intl.firstDay());return this.weekNumber?[""].concat(e):e}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===l.CalendarViewEnum.month)}get take(){return this.props.take!==void 0?this.props.take:p.defaultProps.take}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get todayIsInRange(){return c.isInRange(c.getToday(),d.getDate(this.props.min),d.getDate(this.props.max))}componentDidUpdate(o,e){this.shouldScroll=!1,this.indexToScroll!==void 0&&this.virtualization&&this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](this.indexToScroll),this.isActive&&this.focusActiveDate(),this.lastView=this.props.activeView,this.indexToScroll=void 0}render(){this.calculateHeights();const o=this.lastView!==this.props.activeView,e=c.dateInRange(this.props.focusedDate,this.props.min,this.props.max),t=o?this.props.service.skip(e,this.props.min):this.state.skip,i=this.props.service.total(this.props.min,this.props.max),a=this.getTake(t,i),n=this.props.service.addToDate(this.props.min,t),w=this.props.service.addToDate(this.props.min,this.state.index),m=new Array(this.props.service.rowLength(this.weekNumber)).fill(""),v=this.props.activeView!==this.lastView;this.animateToIndex=!v,(v||!d.isEqualDate(this.lastFocus,e)||this.shouldScroll||!this.props.shouldScroll||this.props.shouldScroll())&&(this.indexToScroll=this.props.service.skip(e,this.props.min)),this.lastFocus=e;const k=V.classNames("k-calendar-view k-vstack",{"k-calendar-monthview":this.props.activeView===l.CalendarViewEnum.month,"k-calendar-yearview":this.props.activeView===l.CalendarViewEnum.year,"k-calendar-decadeview":this.props.activeView===l.CalendarViewEnum.decade,"k-calendar-centuryview":this.props.activeView===l.CalendarViewEnum.century}),b=this.buildDates(m,this.props.service.datesList(n,a)),g=s.createElement(s.Fragment,null,s.createElement(C.Header,{key:"calendar-view-list-header",currentDate:w,min:this.props.min,max:this.props.max,activeView:this.props.activeView,bus:this.props.bus,service:this.props.service,headerTitle:this.props.headerTitle,header:this.props.header,commands:s.createElement(s.Fragment,null,s.createElement(I.TodayCommand,{min:this.props.min,max:this.props.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange,tabIndex:this.props.tabIndex}))}),this.props.activeView===l.CalendarViewEnum.month&&this.buildMonthView(m,this.weekNames),s.createElement(x.Virtualization,{key:"calendar-view-list-content",skip:t,take:this.take,total:i,itemHeight:this.viewHeight,topOffset:this.viewOffset,bottomOffset:this.bottomOffset,scrollOffsetSize:this.viewOffset,maxScrollDifference:this.viewHeight,onScroll:this.props.onScroll,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,children:b,tabIndex:this.props.tabIndex}));return s.createElement("div",{ref:D=>{this._element=D},className:k},this.props.dom.didCalculate?g:null)}};p.propTypes={activeView:r.number.isRequired,bottomOffset:r.number,cellUID:r.string.isRequired,focusedDate:r.instanceOf(Date).isRequired,max:r.instanceOf(Date).isRequired,min:r.instanceOf(Date).isRequired,onChange:r.func,showWeekNumbers:r.bool,smoothScroll:r.bool,take:r.number,value:r.instanceOf(Date),viewHeight:r.number,viewOffset:r.number,weekDaysFormat:r.oneOf(["short","abbreviated","narrow"]),tabIndex:r.number},p.defaultProps={take:N,showWeekNumbers:!1,weekDaysFormat:"short",smoothScroll:!0};let u=p;f.registerForIntl(u);exports.ViewList=u;
|
|
@@ -9,17 +9,18 @@
|
|
|
9
9
|
import * as s from "react";
|
|
10
10
|
import o from "prop-types";
|
|
11
11
|
import { classNames as g } from "@progress/kendo-react-common";
|
|
12
|
-
import { cloneDate as
|
|
13
|
-
import { provideIntlService as y, registerForIntl as
|
|
14
|
-
import { Virtualization as
|
|
12
|
+
import { cloneDate as D, getDate as d, isEqualDate as x } from "@progress/kendo-date-math";
|
|
13
|
+
import { provideIntlService as y, registerForIntl as S } from "@progress/kendo-react-intl";
|
|
14
|
+
import { Virtualization as V } from "../../virtualization/Virtualization.mjs";
|
|
15
15
|
import { View as I } from "./View.mjs";
|
|
16
16
|
import { Header as T } from "./Header.mjs";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
import { WeekNamesService as N } from "../services/WeekNamesService.mjs";
|
|
18
|
+
import { dateInRange as u, shiftWeekNames as C, isInRange as E, getToday as O } from "../../utils.mjs";
|
|
19
|
+
import { CalendarViewEnum as n } from "../models/CalendarViewEnum.mjs";
|
|
20
|
+
import { TodayCommand as H } from "./TodayCommand.mjs";
|
|
21
|
+
const z = 5, l = class l extends s.Component {
|
|
22
|
+
constructor(h) {
|
|
23
|
+
super(h), this.virtualization = null, this.calendarView = null, this.table = null, this.intl = null, this.bottomOffset = 0, this.viewOffset = 0, this.viewHeight = 0, this._element = null, this.isActive = !1, this.animateToIndex = !0, this.shouldScroll = !1, this.weekService = null, this.focusActiveDate = () => {
|
|
23
24
|
if (!this._element)
|
|
24
25
|
return;
|
|
25
26
|
const e = this._element.querySelector("td.k-focus"), t = this._element.querySelector(".k-state-pending-focus");
|
|
@@ -56,12 +57,12 @@ const H = 5, h = class h extends s.Component {
|
|
|
56
57
|
tabIndex: this.props.tabIndex,
|
|
57
58
|
"aria-activedescendant": i + this.props.focusedDate.getTime()
|
|
58
59
|
},
|
|
59
|
-
/* @__PURE__ */ s.createElement("colgroup", null, e.map((a,
|
|
60
|
+
/* @__PURE__ */ s.createElement("colgroup", null, e.map((a, r) => /* @__PURE__ */ s.createElement("col", { key: r }))),
|
|
60
61
|
t.map((a) => /* @__PURE__ */ s.createElement(
|
|
61
62
|
I,
|
|
62
63
|
{
|
|
63
|
-
ref: (
|
|
64
|
-
this.calendarView || (this.calendarView =
|
|
64
|
+
ref: (r) => {
|
|
65
|
+
this.calendarView || (this.calendarView = r);
|
|
65
66
|
},
|
|
66
67
|
key: a.getTime(),
|
|
67
68
|
activeView: this.props.activeView,
|
|
@@ -76,20 +77,21 @@ const H = 5, h = class h extends s.Component {
|
|
|
76
77
|
onChange: this.handleDateChange,
|
|
77
78
|
bus: this.props.bus,
|
|
78
79
|
service: this.props.service,
|
|
79
|
-
weekCell: this.props.weekCell
|
|
80
|
+
weekCell: this.props.weekCell,
|
|
81
|
+
showOtherMonthDays: this.props.showOtherMonthDays
|
|
80
82
|
}
|
|
81
83
|
))
|
|
82
84
|
);
|
|
83
85
|
}, this.calculateHeights = () => {
|
|
84
86
|
if (!this.props.dom)
|
|
85
87
|
return;
|
|
86
|
-
const e = this.props.activeView ===
|
|
88
|
+
const e = this.props.activeView === n.month ? this.props.dom.scrollableContentHeight : this.props.dom.scrollableYearContentHeight;
|
|
87
89
|
this.bottomOffset = e - this.props.dom.viewHeight(this.props.activeView), this.viewOffset = -1 * this.props.dom.headerHeight, this.viewHeight = this.props.dom.viewHeight(this.props.activeView) || 1;
|
|
88
90
|
}, this.getTake = (e, t) => Math.min(t - e, this.take), this.handleScrollAction = ({ index: e, scrollAction: t, pageAction: i }) => {
|
|
89
91
|
const a = i ? i.skip : this.state.skip;
|
|
90
92
|
if ((this.state.index !== e || this.state.skip !== a) && this.setState({ index: e, skip: a }), this.table && t) {
|
|
91
|
-
const
|
|
92
|
-
this.table.style.transform =
|
|
93
|
+
const r = `translateY(${t.offset}px)`;
|
|
94
|
+
this.table.style.transform = r;
|
|
93
95
|
}
|
|
94
96
|
}, this.handleTodayClick = (e) => {
|
|
95
97
|
this.shouldScroll = !0, this.handleDateChange.call(void 0, e, !0);
|
|
@@ -99,7 +101,7 @@ const H = 5, h = class h extends s.Component {
|
|
|
99
101
|
const a = {
|
|
100
102
|
syntheticEvent: e.syntheticEvent,
|
|
101
103
|
nativeEvent: e.nativeEvent,
|
|
102
|
-
value:
|
|
104
|
+
value: D(e.value),
|
|
103
105
|
target: this,
|
|
104
106
|
isTodayClick: t
|
|
105
107
|
};
|
|
@@ -114,53 +116,51 @@ const H = 5, h = class h extends s.Component {
|
|
|
114
116
|
return this._element;
|
|
115
117
|
}
|
|
116
118
|
get weekNames() {
|
|
117
|
-
this.intl = y(this);
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
this.intl.firstDay()
|
|
121
|
-
);
|
|
122
|
-
return this.weekNumber ? [""].concat(r) : r;
|
|
119
|
+
this.intl = y(this), this.weekService = new N(this.intl);
|
|
120
|
+
const h = this.weekService.getWeekNames(this.weekNumber, this.props.weekDaysFormat), e = C(h, this.intl.firstDay());
|
|
121
|
+
return this.weekNumber ? [""].concat(e) : e;
|
|
123
122
|
}
|
|
124
123
|
get weekNumber() {
|
|
125
|
-
return !!(this.props.showWeekNumbers && this.props.activeView ===
|
|
124
|
+
return !!(this.props.showWeekNumbers && this.props.activeView === n.month);
|
|
126
125
|
}
|
|
127
126
|
get take() {
|
|
128
|
-
return this.props.take !== void 0 ? this.props.take :
|
|
127
|
+
return this.props.take !== void 0 ? this.props.take : l.defaultProps.take;
|
|
129
128
|
}
|
|
130
129
|
get animate() {
|
|
131
130
|
return !!(this.props.smoothScroll && this.animateToIndex);
|
|
132
131
|
}
|
|
133
132
|
get todayIsInRange() {
|
|
134
|
-
return E(
|
|
133
|
+
return E(O(), d(this.props.min), d(this.props.max));
|
|
135
134
|
}
|
|
136
|
-
componentDidUpdate(
|
|
135
|
+
componentDidUpdate(h, e) {
|
|
137
136
|
this.shouldScroll = !1, this.indexToScroll !== void 0 && this.virtualization && this.virtualization[this.animate ? "animateToIndex" : "scrollToIndex"](this.indexToScroll), this.isActive && this.focusActiveDate(), this.lastView = this.props.activeView, this.indexToScroll = void 0;
|
|
138
137
|
}
|
|
139
138
|
render() {
|
|
140
139
|
this.calculateHeights();
|
|
141
|
-
const
|
|
142
|
-
this.animateToIndex = !m, (m || !
|
|
143
|
-
const
|
|
140
|
+
const h = this.lastView !== this.props.activeView, e = u(this.props.focusedDate, this.props.min, this.props.max), t = h ? this.props.service.skip(e, this.props.min) : this.state.skip, i = this.props.service.total(this.props.min, this.props.max), a = this.getTake(t, i), r = this.props.service.addToDate(this.props.min, t), v = this.props.service.addToDate(this.props.min, this.state.index), p = new Array(this.props.service.rowLength(this.weekNumber)).fill(""), m = this.props.activeView !== this.lastView;
|
|
141
|
+
this.animateToIndex = !m, (m || !x(this.lastFocus, e) || this.shouldScroll || !this.props.shouldScroll || this.props.shouldScroll()) && (this.indexToScroll = this.props.service.skip(e, this.props.min)), this.lastFocus = e;
|
|
142
|
+
const f = g(
|
|
144
143
|
"k-calendar-view k-vstack",
|
|
145
144
|
{
|
|
146
|
-
"k-calendar-monthview": this.props.activeView ===
|
|
147
|
-
"k-calendar-yearview": this.props.activeView ===
|
|
148
|
-
"k-calendar-decadeview": this.props.activeView ===
|
|
149
|
-
"k-calendar-centuryview": this.props.activeView ===
|
|
145
|
+
"k-calendar-monthview": this.props.activeView === n.month,
|
|
146
|
+
"k-calendar-yearview": this.props.activeView === n.year,
|
|
147
|
+
"k-calendar-decadeview": this.props.activeView === n.decade,
|
|
148
|
+
"k-calendar-centuryview": this.props.activeView === n.century
|
|
150
149
|
}
|
|
151
|
-
), w = this.buildDates(p, this.props.service.datesList(
|
|
150
|
+
), w = this.buildDates(p, this.props.service.datesList(r, a)), k = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
|
|
152
151
|
T,
|
|
153
152
|
{
|
|
154
153
|
key: "calendar-view-list-header",
|
|
155
|
-
currentDate:
|
|
154
|
+
currentDate: v,
|
|
156
155
|
min: this.props.min,
|
|
157
156
|
max: this.props.max,
|
|
158
157
|
activeView: this.props.activeView,
|
|
159
158
|
bus: this.props.bus,
|
|
160
159
|
service: this.props.service,
|
|
161
160
|
headerTitle: this.props.headerTitle,
|
|
161
|
+
header: this.props.header,
|
|
162
162
|
commands: /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
|
|
163
|
-
|
|
163
|
+
H,
|
|
164
164
|
{
|
|
165
165
|
min: this.props.min,
|
|
166
166
|
max: this.props.max,
|
|
@@ -170,8 +170,8 @@ const H = 5, h = class h extends s.Component {
|
|
|
170
170
|
}
|
|
171
171
|
))
|
|
172
172
|
}
|
|
173
|
-
), this.props.activeView ===
|
|
174
|
-
|
|
173
|
+
), this.props.activeView === n.month && this.buildMonthView(p, this.weekNames), /* @__PURE__ */ s.createElement(
|
|
174
|
+
V,
|
|
175
175
|
{
|
|
176
176
|
key: "calendar-view-list-content",
|
|
177
177
|
skip: t,
|
|
@@ -195,13 +195,13 @@ const H = 5, h = class h extends s.Component {
|
|
|
195
195
|
ref: (b) => {
|
|
196
196
|
this._element = b;
|
|
197
197
|
},
|
|
198
|
-
className:
|
|
198
|
+
className: f
|
|
199
199
|
},
|
|
200
200
|
this.props.dom.didCalculate ? k : null
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
|
-
|
|
204
|
+
l.propTypes = {
|
|
205
205
|
activeView: o.number.isRequired,
|
|
206
206
|
bottomOffset: o.number,
|
|
207
207
|
cellUID: o.string.isRequired,
|
|
@@ -215,14 +215,16 @@ h.propTypes = {
|
|
|
215
215
|
value: o.instanceOf(Date),
|
|
216
216
|
viewHeight: o.number,
|
|
217
217
|
viewOffset: o.number,
|
|
218
|
+
weekDaysFormat: o.oneOf(["short", "abbreviated", "narrow"]),
|
|
218
219
|
tabIndex: o.number
|
|
219
|
-
},
|
|
220
|
-
take:
|
|
220
|
+
}, l.defaultProps = {
|
|
221
|
+
take: z,
|
|
221
222
|
showWeekNumbers: !1,
|
|
223
|
+
weekDaysFormat: "short",
|
|
222
224
|
smoothScroll: !0
|
|
223
225
|
};
|
|
224
|
-
let c =
|
|
225
|
-
|
|
226
|
+
let c = l;
|
|
227
|
+
S(c);
|
|
226
228
|
export {
|
|
227
229
|
c as ViewList
|
|
228
230
|
};
|
|
@@ -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 n=require("@progress/kendo-date-math"),l=require("../models/NavigationAction.js"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@progress/kendo-date-math"),l=require("../models/NavigationAction.js"),b=require("../models/SelectionRange.js"),h=require("../../utils.js"),v=[[]],f=7,O=6,p=6,V=0,k={[l.Action.Left]:a=>n.addDays(a,-1),[l.Action.Up]:a=>n.addWeeks(a,-1),[l.Action.Right]:a=>n.addDays(a,1),[l.Action.Down]:a=>n.addWeeks(a,1),[l.Action.PrevView]:a=>n.addMonths(a,-1),[l.Action.NextView]:a=>n.addMonths(a,1),[l.Action.FirstInView]:a=>n.firstDayOfMonth(a),[l.Action.LastInView]:a=>n.lastDayOfMonth(a)};class L{constructor(t){this.intl=t}addToDate(t,e){return n.addMonths(t,e)}datesList(t,e){return h.range(0,e).map(i=>n.addMonths(t,i))}data(t){const{cellUID:e,focusedDate:i,isActiveView:u,max:r,min:o,selectedDate:c,selectionRange:d=b.EMPTY_SELECTIONRANGE,viewDate:g}=t;if(!g)return v;const M=n.firstDayOfMonth(g),y=n.lastDayOfMonth(g),A=n.dayOfWeek(M,this.intl.firstDay(),-1),w=h.range(0,f),E=h.getToday();return h.range(0,O).map(T=>{const I=n.addDays(A,T*f);return w.map(R=>{const s=this.normalize(n.addDays(I,R),o,r),q=s<M||s>y,m=this.isEqual(s,d.start),S=this.isEqual(s,d.end),D=!m&&!S&&h.isInSelectionRange(s,d),N=u&&(Array.isArray(c)?this.isSelectedFromArray(s,c,o,r):h.isInRange(c,o,r)&&this.isEqual(s,c));return{formattedValue:this.value(s),id:`${e}${s.getTime()}`,isFocused:this.isEqual(s,i),isSelected:N,isInRange:h.isInRange(s,o,r),isWeekend:this.isWeekend(s),isRangeStart:m,isRangeMid:D,isRangeEnd:S,isRangeSplitStart:D&&this.isEqual(s,M),isRangeSplitEnd:D&&this.isEqual(s,y),isToday:this.isEqual(s,E),title:this.cellTitle(s),value:s,isOtherMonth:q}})})}isEqual(t,e){return!t||!e?!1:n.getDate(t).getTime()===n.getDate(e).getTime()}isSelectedFromArray(t,e,i,u){let r=!1;return e.forEach(o=>{h.isInRange(t,i,u)&&this.isEqual(t,o)&&(r=!0)}),r}isInArray(t,e){return!!e.length&&n.firstDayOfMonth(e[0])<=t&&t<=n.lastDayOfMonth(e[e.length-1])}isInRange(t,e,i){const u=n.getDate(t),r=!e||n.getDate(e)<=u,o=!i||u<=n.getDate(i);return r&&o}isInSameView(t,e){return n.durationInMonths(t,e)===0}isRangeStart(t){return!t.getMonth()}move(t,e){const i=k[e];return i?i(t):t}cellTitle(t){return this.intl.formatDate(t,"D")}navigationTitle(t){return t?this.isRangeStart(t)?t.getFullYear().toString():this.abbrMonthNames()[t.getMonth()]:""}title(t){return`${this.wideMonthNames()[t.getMonth()]} ${t.getFullYear()}`}rowLength(t){return f+(t?1:0)}skip(t,e){return n.durationInMonths(e,t)}total(t,e){return n.durationInMonths(t,e)+1}value(t){return t?t.getDate().toString():""}viewDate(t,e,i=1){return n.durationInMonths(t,e)<i?n.addMonths(t,-1):t}isWeekend(t){const e=t.getDay();return e===p||e===V}abbrMonthNames(){return this.intl.dateFormatNames({nameType:"abbreviated",type:"months"})}normalize(t,e,i){return t<e&&this.isEqual(t,e)?n.getDate(e):t>i&&this.isEqual(t,i)?n.getDate(i):t}wideMonthNames(){return this.intl.dateFormatNames({nameType:"wide",type:"months",standAlone:!0})}}exports.MonthViewService=L;
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import { addDays as g, addWeeks as I, addMonths as h, firstDayOfMonth as y, lastDayOfMonth as D, dayOfWeek as
|
|
9
|
+
import { addDays as g, addWeeks as I, addMonths as h, firstDayOfMonth as y, lastDayOfMonth as D, dayOfWeek as O, getDate as u, durationInMonths as d } from "@progress/kendo-date-math";
|
|
10
10
|
import { Action as o } from "../models/NavigationAction.mjs";
|
|
11
|
-
import { EMPTY_SELECTIONRANGE as
|
|
12
|
-
import { range as w, getToday as
|
|
13
|
-
const
|
|
11
|
+
import { EMPTY_SELECTIONRANGE as W } from "../models/SelectionRange.mjs";
|
|
12
|
+
import { range as w, getToday as Y, isInRange as T, isInSelectionRange as U } from "../../utils.mjs";
|
|
13
|
+
const _ = [[]], S = 7, $ = 6, C = 6, G = 0, P = {
|
|
14
14
|
[o.Left]: (s) => g(s, -1),
|
|
15
15
|
[o.Up]: (s) => I(s, -1),
|
|
16
16
|
[o.Right]: (s) => g(s, 1),
|
|
@@ -38,24 +38,21 @@ class Q {
|
|
|
38
38
|
max: r,
|
|
39
39
|
min: a,
|
|
40
40
|
selectedDate: c,
|
|
41
|
-
selectionRange: m =
|
|
41
|
+
selectionRange: m = W,
|
|
42
42
|
viewDate: f
|
|
43
43
|
} = t;
|
|
44
44
|
if (!f)
|
|
45
|
-
return
|
|
46
|
-
const M = y(f), R = D(f), N =
|
|
47
|
-
return w(0,
|
|
45
|
+
return _;
|
|
46
|
+
const M = y(f), R = D(f), N = O(M, this.intl.firstDay(), -1), b = w(0, S), q = Y();
|
|
47
|
+
return w(0, $).map((V) => {
|
|
48
48
|
const v = g(N, V * S);
|
|
49
49
|
return b.map((L) => {
|
|
50
|
-
const i = this.normalize(g(v, L), a, r);
|
|
51
|
-
if (i < M || i > R)
|
|
52
|
-
return null;
|
|
53
|
-
const p = this.isEqual(i, m.start), A = this.isEqual(i, m.end), E = !p && !A && Y(i, m), k = l && (Array.isArray(c) ? this.isSelectedFromArray(i, c, a, r) : T(c, a, r) && this.isEqual(i, c));
|
|
50
|
+
const i = this.normalize(g(v, L), a, r), k = i < M || i > R, p = this.isEqual(i, m.start), A = this.isEqual(i, m.end), E = !p && !A && U(i, m), F = l && (Array.isArray(c) ? this.isSelectedFromArray(i, c, a, r) : T(c, a, r) && this.isEqual(i, c));
|
|
54
51
|
return {
|
|
55
52
|
formattedValue: this.value(i),
|
|
56
53
|
id: `${e}${i.getTime()}`,
|
|
57
54
|
isFocused: this.isEqual(i, n),
|
|
58
|
-
isSelected:
|
|
55
|
+
isSelected: F,
|
|
59
56
|
isInRange: T(i, a, r),
|
|
60
57
|
isWeekend: this.isWeekend(i),
|
|
61
58
|
isRangeStart: p,
|
|
@@ -65,7 +62,8 @@ class Q {
|
|
|
65
62
|
isRangeSplitEnd: E && this.isEqual(i, R),
|
|
66
63
|
isToday: this.isEqual(i, q),
|
|
67
64
|
title: this.cellTitle(i),
|
|
68
|
-
value: i
|
|
65
|
+
value: i,
|
|
66
|
+
isOtherMonth: k
|
|
69
67
|
};
|
|
70
68
|
});
|
|
71
69
|
});
|
|
@@ -93,7 +91,7 @@ class Q {
|
|
|
93
91
|
return !t.getMonth();
|
|
94
92
|
}
|
|
95
93
|
move(t, e) {
|
|
96
|
-
const n =
|
|
94
|
+
const n = P[e];
|
|
97
95
|
return n ? n(t) : t;
|
|
98
96
|
}
|
|
99
97
|
cellTitle(t) {
|
|
@@ -122,7 +120,7 @@ class Q {
|
|
|
122
120
|
}
|
|
123
121
|
isWeekend(t) {
|
|
124
122
|
const e = t.getDay();
|
|
125
|
-
return e ===
|
|
123
|
+
return e === C || e === G;
|
|
126
124
|
}
|
|
127
125
|
abbrMonthNames() {
|
|
128
126
|
return this.intl.dateFormatNames({ nameType: "abbreviated", type: "months" });
|
|
@@ -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 i=require("../../utils.js");class c{constructor(e){this.intl=e}getWeekNames(e=!1,t){const s=i.shiftWeekNames(this.intl.dateFormatNames({nameType:t!=null?t:"short",type:"days"}),this.intl.firstDay());return e?[""].concat(s):s}}exports.WeekNamesService=c;
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import { shiftWeekNames as
|
|
9
|
+
import { shiftWeekNames as i } from "../../utils.mjs";
|
|
10
10
|
class r {
|
|
11
11
|
constructor(e) {
|
|
12
12
|
this.intl = e;
|
|
13
13
|
}
|
|
14
|
-
getWeekNames(e = !1) {
|
|
15
|
-
const
|
|
16
|
-
this.intl.dateFormatNames({ nameType: "short", type: "days" }),
|
|
14
|
+
getWeekNames(e = !1, t) {
|
|
15
|
+
const s = i(
|
|
16
|
+
this.intl.dateFormatNames({ nameType: t != null ? t : "short", type: "days" }),
|
|
17
17
|
this.intl.firstDay()
|
|
18
18
|
);
|
|
19
|
-
return e ? [""].concat(
|
|
19
|
+
return e ? [""].concat(s) : s;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
export {
|
package/datepicker/DatePicker.js
CHANGED
|
@@ -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 W=require("react"),e=require("prop-types"),_=require("@progress/kendo-react-popup"),I=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),U=require("@progress/kendo-svg-icons"),j=require("../package-metadata.js"),$=require("../dateinput/DateInput.js"),H=require("../calendar/components/Calendar.js"),m=require("../utils.js"),D=require("../messages/index.js"),q=require("@progress/kendo-react-intl"),X=require("./ToggleButton.js"),Z=require("../common/PickerWrap.js"),G=require("../hooks/usePickerFloatingLabel.js"),J=require("@progress/kendo-react-layout"),Q=require("../common/AdaptiveMode.js"),Y=require("../common/constants.js");function ee(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>l[t]})}}return s.default=l,Object.freeze(s)}const r=ee(W),o=class o extends r.Component{constructor(s){super(s),this._element=null,this._dateInput=r.createRef(),this._calendar=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.setCalendarRef=t=>{this._calendar=t},this.nextValue=(t,i)=>t.value!==void 0?t.value:i.value,this.nextShow=(t,i)=>t.show!==void 0?t.show:i.show,this.renderPopup=()=>{const{disabled:t,min:i,max:a,weekNumber:g,focusedDate:f,popupSettings:d}=this.props,{popupClass:v,...w}=d,b=this.show,h=this.value,y=h&&I.getDate(h),p=n.classNames(v),C={popupClass:"k-datepicker-popup",show:b,anchor:this._element,className:p,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...w},c={disabled:t,value:y,min:i,max:a,weekNumber:g,focusedDate:f,className:this.mobileMode?"k-calendar-lg":"",navigation:!this.mobileMode,onChange:this.handleCalendarValueChange};return this.mobileMode?r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}):r.createElement(this.popupComp,{...C},r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}))},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,i={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t};return r.createElement(Q.AdaptiveMode,{...i},r.createElement(J.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderPopup()))},this.handleInputValueChange=t=>{this.handleValueChange(t.value,t)},this.handleCalendarValueChange=t=>{const i=this.mergeTime(t.value);this.handleValueChange(i,t)},this.handleValueChange=(t,i)=>{this.setState({value:I.cloneDate(t||void 0)}),this.valueDuringOnChange=t,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:a}=this.props;a&&a.call(void 0,{syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:i,keyCode:a}=t;if(a===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(a===n.Keys.up||a===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=a===n.Keys.up,this.setShow(a===n.Keys.down))},n.validatePackage(j.packageMetadata),this.state={value:this.props.defaultValue||o.defaultProps.defaultValue,show:this.props.defaultShow||o.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=Y.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get dateInput(){return this._dateInput.current}get calendar(){return this._calendar}get value(){const s=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return s!==null?I.cloneDate(s):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:o.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:o.defaultProps.max}get dateInputComp(){return this.props.dateInput||o.defaultProps.dateInput}get toggleButtonComp(){return this.props.toggleButton||o.defaultProps.toggleButton}get calendarComp(){return this.props.calendar||o.defaultProps.calendar}get popupComp(){return this.props.popup||o.defaultProps.popup}get pickerWrapComp(){return this.props.pickerWrap||o.defaultProps.pickerWrap}get validity(){const s=m.isInDateRange(this.value,this.min,this.max),t=this.props.validationMessage!==void 0,i=(!this.required||this.value!==null)&&s,a=this.props.valid!==void 0?this.props.valid:i;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:a,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:o.defaultProps.required}componentDidMount(){var s;this.observerResize=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._calendar&&this._calendar.element&&this.show&&!this.prevShow&&this._calendar.element.focus({preventScroll:!0}),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var s;clearTimeout(this.nextTickId),(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:s=o.defaultProps.size,rounded:t=o.defaultProps.rounded,fillMode:i=o.defaultProps.fillMode,disabled:a,tabIndex:g,title:f,id:d,format:v,formatPlaceholder:w,min:b,max:h,className:y,width:p,name:C,validationMessage:c,required:E,validityStyles:R,ariaLabelledBy:z,ariaDescribedBy:F,ariaLabel:N,placeholder:V,label:k,popupSettings:te,defaultValue:se,defaultShow:ie,value:oe,popup:ae,weekNumber:ne,dateInput:re,calendar:le,toggleButton:ue,onChange:de,onBlur:he,onFocus:pe,show:ce,onOpen:me,pickerWrap:ge,...O}=this.props,A=this.value,S=!this.validityStyles||this.validity.valid,L={disabled:a,format:v,formatPlaceholder:w,id:d,ariaLabelledBy:z,ariaDescribedBy:F,ariaLabel:N,max:h,min:b,name:C,onChange:this.handleInputValueChange,required:E,tabIndex:this.show?-1:g,title:f,valid:this.validity.valid,validationMessage:c,validityStyles:R,value:A,label:void 0,placeholder:this.state.focused?null:V,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},M=q.provideLocalizationService(this).toLanguageString(D.toggleCalendar,D.messages[D.toggleCalendar]),P=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},T=>r.createElement(r.Fragment,null,r.createElement("span",{...k?{}:O,ref:K=>{this._element=K},className:n.classNames("k-input","k-datepicker",{[`k-input-${n.kendoThemeMaps.sizeMap[s]||s}`]:s,[`k-rounded-${n.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${i}`]:i,"k-invalid":!S,"k-required":this.required,"k-disabled":a},y),onKeyDown:this.handleKeyDown,style:{width:p},onFocus:T.onFocus,onBlur:T.onBlur,onClick:this.mobileMode?this.handleIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",readonly:this.mobileMode,ariaExpanded:this.show,ariaControls:this._popupId,...L}),r.createElement(this.toggleButtonComp,{type:"button",icon:"calendar",svgIcon:U.calendarIcon,title:M,className:"k-input-button",rounded:null,onClick:this.mobileMode?void 0:this.handleIconClick,"aria-label":M,onMouseDown:this.handleIconMouseDown}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return k?r.createElement(G.PickerFloatingLabel,{dateInput:this._dateInput,label:k,editorId:d,editorValid:S,editorDisabled:a,children:P,style:{width:p},...O}):P}setShow(s){const{onOpen:t,onClose:i}=this.props;this.show!==s&&(this.setState({show:s}),s&&t&&t.call(void 0,{target:this}),!s&&i&&i.call(void 0,{target:this}))}mergeTime(s){return this.value&&s?m.setTime(s,this.value):s}nextTick(s){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>s())}calculateMedia(s){for(let t of s)this.setState({windowWidth:t.target.clientWidth})}};o.displayName="DatePicker",o.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,ariaLabel:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),adaptive:e.bool,adaptiveTitle:e.string},o.defaultProps={defaultShow:!1,defaultValue:null,dateInput:$.DateInput,calendar:H.Calendar,toggleButton:X.ToggleButton,popup:_.Popup,pickerWrap:Z.PickerWrap,disabled:!1,format:"d",max:m.MAX_DATE,min:m.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid"};let u=o;const x=n.createPropsContext(),B=n.withIdHOC(n.withPropsContext(x,u));B.displayName="KendoReactDatePicker";q.registerForLocalization(u);exports.DatePicker=B;exports.DatePickerPropsContext=x;exports.DatePickerWithoutContext=u;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react"),e=require("prop-types"),_=require("@progress/kendo-react-popup"),I=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),U=require("@progress/kendo-svg-icons"),j=require("../package-metadata.js"),$=require("../dateinput/DateInput.js"),H=require("../calendar/components/Calendar.js"),m=require("../utils.js"),D=require("../messages/index.js"),q=require("@progress/kendo-react-intl"),X=require("./ToggleButton.js"),Z=require("../common/PickerWrap.js"),G=require("../hooks/usePickerFloatingLabel.js"),J=require("@progress/kendo-react-layout"),Q=require("../common/AdaptiveMode.js"),Y=require("../common/constants.js");function ee(l){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return i.default=l,Object.freeze(i)}const r=ee(W),o=class o extends r.Component{constructor(i){super(i),this._element=null,this._dateInput=r.createRef(),this._calendar=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.setCalendarRef=t=>{this._calendar=t},this.nextValue=(t,s)=>t.value!==void 0?t.value:s.value,this.nextShow=(t,s)=>t.show!==void 0?t.show:s.show,this.renderPopup=()=>{const{disabled:t,min:s,max:a,weekNumber:g,focusedDate:f,popupSettings:d}=this.props,{popupClass:v,...w}=d,b=this.show,h=this.value,y=h&&I.getDate(h),p=n.classNames(v),C={popupClass:"k-datepicker-popup",show:b,anchor:this._element,className:p,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...w},c={disabled:t,value:y,min:s,max:a,weekNumber:g,focusedDate:f,className:this.mobileMode?"k-calendar-lg":"",navigation:!this.mobileMode,onChange:this.handleCalendarValueChange};return this.mobileMode?r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}):r.createElement(this.popupComp,{...C},r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}))},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t};return r.createElement(Q.AdaptiveMode,{...s},r.createElement(J.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderPopup()))},this.handleInputValueChange=t=>{this.handleValueChange(t.value,t)},this.handleCalendarValueChange=t=>{const s=this.mergeTime(t.value);this.handleValueChange(s,t)},this.handleValueChange=(t,s)=>{this.setState({value:I.cloneDate(t||void 0)}),this.valueDuringOnChange=t,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:a}=this.props;a&&a.call(void 0,{syntheticEvent:s.syntheticEvent,nativeEvent:s.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:s,keyCode:a}=t;if(a===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(a===n.Keys.up||a===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=a===n.Keys.up,this.setShow(a===n.Keys.down))},n.validatePackage(j.packageMetadata),this.state={value:this.props.defaultValue||o.defaultProps.defaultValue,show:this.props.defaultShow||o.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=Y.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get dateInput(){return this._dateInput.current}get calendar(){return this._calendar}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?I.cloneDate(i):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:o.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:o.defaultProps.max}get dateInputComp(){return this.props.dateInput||o.defaultProps.dateInput}get toggleButtonComp(){return this.props.toggleButton||o.defaultProps.toggleButton}get calendarComp(){return this.props.calendar||o.defaultProps.calendar}get popupComp(){return this.props.popup||o.defaultProps.popup}get pickerWrapComp(){return this.props.pickerWrap||o.defaultProps.pickerWrap}get validity(){const i=m.isInDateRange(this.value,this.min,this.max),t=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&i,a=this.props.valid!==void 0?this.props.valid:s;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:a,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:o.defaultProps.required}componentDidMount(){var i;this.observerResize=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._calendar&&this._calendar.element&&this.show&&!this.prevShow&&this._calendar.element.focus({preventScroll:!0}),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=o.defaultProps.size,rounded:t=o.defaultProps.rounded,fillMode:s=o.defaultProps.fillMode,disabled:a,tabIndex:g,title:f,id:d,format:v,formatPlaceholder:w,min:b,max:h,className:y,width:p,name:C,validationMessage:c,required:E,validityStyles:R,ariaLabelledBy:z,ariaDescribedBy:F,ariaLabel:N,placeholder:V,label:k,popupSettings:te,defaultValue:ie,defaultShow:se,value:oe,popup:ae,weekNumber:ne,dateInput:re,calendar:le,toggleButton:ue,onChange:de,onBlur:he,onFocus:pe,show:ce,onOpen:me,pickerWrap:ge,adaptive:fe,adaptiveTitle:ve,valid:we,...O}=this.props,A=this.value,S=!this.validityStyles||this.validity.valid,L={disabled:a,format:v,formatPlaceholder:w,id:d,ariaLabelledBy:z,ariaDescribedBy:F,ariaLabel:N,max:h,min:b,name:C,onChange:this.handleInputValueChange,required:E,tabIndex:this.show?-1:g,title:f,valid:this.validity.valid,validationMessage:c,validityStyles:R,value:A,label:void 0,placeholder:this.state.focused?null:V,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},M=q.provideLocalizationService(this).toLanguageString(D.toggleCalendar,D.messages[D.toggleCalendar]),P=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},T=>r.createElement(r.Fragment,null,r.createElement("span",{...k?{}:O,ref:K=>{this._element=K},className:n.classNames("k-input","k-datepicker",{[`k-input-${n.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-rounded-${n.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${s}`]:s,"k-invalid":!S,"k-required":this.required,"k-disabled":a},y),onKeyDown:this.handleKeyDown,style:{width:p},onFocus:T.onFocus,onBlur:T.onBlur,onClick:this.mobileMode?this.handleIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",readonly:this.mobileMode,ariaExpanded:this.show,ariaControls:this._popupId,...L}),r.createElement(this.toggleButtonComp,{type:"button",icon:"calendar",svgIcon:U.calendarIcon,title:M,className:"k-input-button",rounded:null,onClick:this.mobileMode?void 0:this.handleIconClick,"aria-label":M,onMouseDown:this.handleIconMouseDown}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return k?r.createElement(G.PickerFloatingLabel,{dateInput:this._dateInput,label:k,editorId:d,editorValid:S,editorDisabled:a,children:P,style:{width:p},...O}):P}setShow(i){const{onOpen:t,onClose:s}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&s&&s.call(void 0,{target:this}))}mergeTime(i){return this.value&&i?m.setTime(i,this.value):i}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}calculateMedia(i){for(let t of i)this.setState({windowWidth:t.target.clientWidth})}};o.displayName="DatePicker",o.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,ariaLabel:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),adaptive:e.bool,adaptiveTitle:e.string},o.defaultProps={defaultShow:!1,defaultValue:null,dateInput:$.DateInput,calendar:H.Calendar,toggleButton:X.ToggleButton,popup:_.Popup,pickerWrap:Z.PickerWrap,disabled:!1,format:"d",max:m.MAX_DATE,min:m.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid"};let u=o;const x=n.createPropsContext(),B=n.withIdHOC(n.withPropsContext(x,u));B.displayName="KendoReactDatePicker";q.registerForLocalization(u);exports.DatePicker=B;exports.DatePickerPropsContext=x;exports.DatePickerWithoutContext=u;
|
|
@@ -264,6 +264,9 @@ const o = class o extends n.Component {
|
|
|
264
264
|
show: ke,
|
|
265
265
|
onOpen: Se,
|
|
266
266
|
pickerWrap: Oe,
|
|
267
|
+
adaptive: Me,
|
|
268
|
+
adaptiveTitle: Pe,
|
|
269
|
+
valid: Te,
|
|
267
270
|
...I
|
|
268
271
|
} = this.props, R = this.value, C = !this.validityStyles || this.validity.valid, A = {
|
|
269
272
|
disabled: a,
|