@progress/kendo-react-dateinputs 8.3.0-develop.6 → 8.3.0-develop.8
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 +123 -115
- package/calendar/components/CalendarCell.js +1 -1
- package/calendar/components/CalendarCell.mjs +37 -39
- package/calendar/components/CalendarHeaderTitle.js +1 -1
- package/calendar/components/CalendarHeaderTitle.mjs +6 -12
- package/calendar/components/CalendarNavigationItem.js +1 -1
- package/calendar/components/CalendarNavigationItem.mjs +15 -19
- package/calendar/components/CalendarWeekCell.js +1 -1
- package/calendar/components/CalendarWeekCell.mjs +10 -15
- package/calendar/components/Header.js +1 -1
- package/calendar/components/Header.mjs +30 -40
- package/calendar/components/Navigation.js +1 -1
- package/calendar/components/Navigation.mjs +52 -49
- package/calendar/components/TodayCommand.js +1 -1
- package/calendar/components/TodayCommand.mjs +21 -25
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +48 -42
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +99 -94
- package/common/ClearButton.js +1 -1
- package/common/ClearButton.mjs +25 -31
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +113 -110
- package/dateinput/utils.js +1 -1
- package/dateinput/utils.mjs +22 -23
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +9 -9
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +5 -5
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +95 -90
- package/datetimepicker/DateTimeSelector.js +1 -1
- package/datetimepicker/DateTimeSelector.mjs +83 -81
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +38 -28
- package/index.d.ts +38 -28
- package/package-metadata.mjs +1 -1
- package/package.json +7 -7
- package/timepicker/TimeList.js +3 -3
- package/timepicker/TimeList.mjs +83 -81
- package/timepicker/TimePart.js +1 -1
- package/timepicker/TimePart.mjs +74 -68
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +112 -107
- package/timepicker/TimeSelector.js +1 -1
- package/timepicker/TimeSelector.mjs +66 -59
- package/virtualization/Virtualization.js +1 -1
- package/virtualization/Virtualization.mjs +49 -48
|
@@ -8,29 +8,33 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as i from "react";
|
|
10
10
|
import s from "prop-types";
|
|
11
|
-
import { cloneDate as
|
|
12
|
-
import { provideIntlService as
|
|
13
|
-
import { CalendarCell as
|
|
14
|
-
import { CalendarWeekCell as
|
|
15
|
-
import { CalendarViewEnum as
|
|
16
|
-
import { getToday as
|
|
17
|
-
import { WeekNamesService as
|
|
18
|
-
|
|
11
|
+
import { cloneDate as k, weekInYear as R } from "@progress/kendo-date-math";
|
|
12
|
+
import { provideIntlService as M, registerForIntl as q } from "@progress/kendo-react-intl";
|
|
13
|
+
import { CalendarCell as x } from "./CalendarCell.mjs";
|
|
14
|
+
import { CalendarWeekCell as I } from "./CalendarWeekCell.mjs";
|
|
15
|
+
import { CalendarViewEnum as D } from "../models/CalendarViewEnum.mjs";
|
|
16
|
+
import { getToday as v, setTime as V } from "../../utils.mjs";
|
|
17
|
+
import { WeekNamesService as S } from "../services/WeekNamesService.mjs";
|
|
18
|
+
import { classNames as l, uCalendar as c } from "@progress/kendo-react-common";
|
|
19
|
+
const y = (g, t) => {
|
|
20
|
+
const e = t;
|
|
21
|
+
return /* @__PURE__ */ i.createElement("td", { key: g, role: "gridcell", className: l(c.td({ c: e, isEmpty: !0 })) }, " ");
|
|
22
|
+
}, u = class u extends i.Component {
|
|
19
23
|
constructor() {
|
|
20
24
|
super(...arguments), this.intl = null, this.weekService = null, this.buildWeekNumber = (t, e) => {
|
|
21
25
|
if (!this.firstDate(t))
|
|
22
|
-
return
|
|
23
|
-
const a = this.firstDate(t), n = this.getWeekNumber(a), o = `kendo-react-calendar-week-cell-${n}`,
|
|
24
|
-
className: "k-alt",
|
|
26
|
+
return y(`week-cell-${e}`);
|
|
27
|
+
const a = this.firstDate(t), n = this.getWeekNumber(a), o = `kendo-react-calendar-week-cell-${n}`, m = {
|
|
25
28
|
value: n,
|
|
26
29
|
firstDate: a,
|
|
27
30
|
weekDays: t,
|
|
31
|
+
unstyled: this.props.unstyled,
|
|
28
32
|
onClick: this.handleWeekCellClick
|
|
29
33
|
};
|
|
30
|
-
return this.props.weekCell ? /* @__PURE__ */ i.createElement(this.props.weekCell, { ...
|
|
34
|
+
return this.props.weekCell ? /* @__PURE__ */ i.createElement(this.props.weekCell, { ...m, key: o }, n) : /* @__PURE__ */ i.createElement(I, { ...m, key: o }, n);
|
|
31
35
|
}, this.buildRow = (t) => t.map((e, r) => {
|
|
32
36
|
if (!e)
|
|
33
|
-
return
|
|
37
|
+
return y(r);
|
|
34
38
|
const a = { "aria-selected": e.isSelected }, n = `kendo-react-calendar-cell-${e.value.getTime()}`, o = {
|
|
35
39
|
...a,
|
|
36
40
|
...e,
|
|
@@ -38,11 +42,12 @@ const k = (f) => /* @__PURE__ */ i.createElement("td", { key: f, className: "k-c
|
|
|
38
42
|
view: this.props.activeView,
|
|
39
43
|
showOtherMonthDays: this.props.showOtherMonthDays,
|
|
40
44
|
allowReverse: this.props.allowReverse,
|
|
45
|
+
unstyled: this.props.unstyled,
|
|
41
46
|
onClick: this.handleClick,
|
|
42
47
|
onMouseEnter: this.handleMouseEnter,
|
|
43
48
|
onMouseLeave: this.handleMouseLeave
|
|
44
49
|
};
|
|
45
|
-
return this.props.cell ? /* @__PURE__ */ i.createElement(this.props.cell, { ...o, key: n }, e.formattedValue) : /* @__PURE__ */ i.createElement(
|
|
50
|
+
return this.props.cell ? /* @__PURE__ */ i.createElement(this.props.cell, { ...o, key: n }, e.formattedValue) : /* @__PURE__ */ i.createElement(x, { ...o, key: n }, e.formattedValue);
|
|
46
51
|
}), this.firstDate = (t) => {
|
|
47
52
|
const e = this.firstWeekDateContext(t);
|
|
48
53
|
return e ? e.value : null;
|
|
@@ -57,7 +62,7 @@ const k = (f) => /* @__PURE__ */ i.createElement("td", { key: f, className: "k-c
|
|
|
57
62
|
const { onChange: r } = this.props;
|
|
58
63
|
if (r && e) {
|
|
59
64
|
const a = {
|
|
60
|
-
value:
|
|
65
|
+
value: k(t),
|
|
61
66
|
target: this,
|
|
62
67
|
nativeEvent: e && e.nativeEvent,
|
|
63
68
|
syntheticEvent: e
|
|
@@ -69,10 +74,10 @@ const k = (f) => /* @__PURE__ */ i.createElement("td", { key: f, className: "k-c
|
|
|
69
74
|
a && r && a.call(void 0, t, n, r);
|
|
70
75
|
}, this.handleMouseEnter = (t) => {
|
|
71
76
|
const { onCellEnter: e } = this.props;
|
|
72
|
-
e && e.call(void 0,
|
|
77
|
+
e && e.call(void 0, k(t));
|
|
73
78
|
}, this.handleMouseLeave = (t) => {
|
|
74
79
|
const { onCellLeave: e } = this.props;
|
|
75
|
-
e && e.call(void 0,
|
|
80
|
+
e && e.call(void 0, k(t));
|
|
76
81
|
};
|
|
77
82
|
}
|
|
78
83
|
get min() {
|
|
@@ -85,56 +90,57 @@ const k = (f) => /* @__PURE__ */ i.createElement("td", { key: f, className: "k-c
|
|
|
85
90
|
return this.props.direction === "horizontal";
|
|
86
91
|
}
|
|
87
92
|
get isMonthView() {
|
|
88
|
-
return this.props.activeView ===
|
|
93
|
+
return this.props.activeView === D.month;
|
|
89
94
|
}
|
|
90
95
|
get weekNumber() {
|
|
91
|
-
return !!(this.props.showWeekNumbers && this.props.activeView ===
|
|
96
|
+
return !!(this.props.showWeekNumbers && this.props.activeView === D.month);
|
|
92
97
|
}
|
|
93
98
|
get selectedDate() {
|
|
94
|
-
return this.props.selectedDate !== void 0 ? this.props.selectedDate :
|
|
99
|
+
return this.props.selectedDate !== void 0 ? this.props.selectedDate : u.defaultProps.selectedDate;
|
|
95
100
|
}
|
|
96
101
|
render() {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
const { service: t, weekDaysFormat: e, cellUID: r, focusedDate: a, bus: n, activeView: o, selectionRange: m, unstyled: w } = this.props, h = w && w.uCalendar;
|
|
103
|
+
this.intl = M(this), this.weekService = new S(this.intl);
|
|
104
|
+
const C = this.weekService.getWeekNames(this.weekNumber, e), N = t.rowLength(this.weekNumber), b = t.title(this.props.viewDate), E = v(), W = V(this.props.viewDate, E), O = t.data({
|
|
105
|
+
cellUID: r,
|
|
100
106
|
min: this.min,
|
|
101
107
|
max: this.max,
|
|
102
|
-
focusedDate:
|
|
103
|
-
isActiveView: !
|
|
108
|
+
focusedDate: a,
|
|
109
|
+
isActiveView: !n.canMoveDown(o),
|
|
104
110
|
selectedDate: this.selectedDate,
|
|
105
|
-
selectionRange:
|
|
106
|
-
viewDate:
|
|
111
|
+
selectionRange: m,
|
|
112
|
+
viewDate: W
|
|
107
113
|
});
|
|
108
114
|
return /* @__PURE__ */ i.createElement(i.Fragment, null, this.isMonthView && this.isHorizontal && /* @__PURE__ */ i.createElement(
|
|
109
115
|
"thead",
|
|
110
116
|
{
|
|
111
117
|
role: "rowgroup",
|
|
112
|
-
className:
|
|
118
|
+
className: l(c.thead({ c: h }))
|
|
113
119
|
},
|
|
114
|
-
/* @__PURE__ */ i.createElement("tr", { role: "row", className:
|
|
120
|
+
/* @__PURE__ */ i.createElement("tr", { role: "row", className: l(c.tr({ c: h })) }, C.map((p, d) => /* @__PURE__ */ i.createElement("th", { key: d, className: l(c.th({ c: h })) }, p)))
|
|
115
121
|
), /* @__PURE__ */ i.createElement(
|
|
116
122
|
"tbody",
|
|
117
123
|
{
|
|
118
124
|
role: "rowgroup",
|
|
119
|
-
className:
|
|
125
|
+
className: l(c.tbody({ c: h }))
|
|
120
126
|
},
|
|
121
|
-
!this.isHorizontal && /* @__PURE__ */ i.createElement("tr", { role: "presentation", className:
|
|
127
|
+
!this.isHorizontal && /* @__PURE__ */ i.createElement("tr", { role: "presentation", className: l(c.tr({ c: h })) }, /* @__PURE__ */ i.createElement(
|
|
122
128
|
"th",
|
|
123
129
|
{
|
|
124
130
|
scope: "col",
|
|
125
|
-
colSpan:
|
|
126
|
-
className:
|
|
131
|
+
colSpan: N,
|
|
132
|
+
className: l(c.caption({ c: h }))
|
|
127
133
|
},
|
|
128
|
-
|
|
134
|
+
b
|
|
129
135
|
)),
|
|
130
|
-
|
|
136
|
+
O.map((p, d) => /* @__PURE__ */ i.createElement("tr", { role: "row", className: l(c.tr({ c: h })), key: d }, this.weekNumber && this.buildWeekNumber(p, d), this.buildRow(p)))
|
|
131
137
|
));
|
|
132
138
|
}
|
|
133
139
|
getWeekNumber(t) {
|
|
134
|
-
return !this.weekNumber || !this.intl ? null :
|
|
140
|
+
return !this.weekNumber || !this.intl ? null : R(t, this.intl.firstDay());
|
|
135
141
|
}
|
|
136
142
|
};
|
|
137
|
-
|
|
143
|
+
u.propTypes = {
|
|
138
144
|
activeRangeEnd: s.oneOf(["start", "end", null]),
|
|
139
145
|
activeView: s.number.isRequired,
|
|
140
146
|
cellUID: s.string.isRequired,
|
|
@@ -149,13 +155,13 @@ c.propTypes = {
|
|
|
149
155
|
showWeekNumbers: s.bool,
|
|
150
156
|
showOtherMonthDays: s.bool,
|
|
151
157
|
viewDate: s.instanceOf(Date).isRequired
|
|
152
|
-
},
|
|
158
|
+
}, u.defaultProps = {
|
|
153
159
|
direction: "vertical",
|
|
154
|
-
selectedDate:
|
|
160
|
+
selectedDate: v(),
|
|
155
161
|
showWeekNumbers: !1
|
|
156
162
|
};
|
|
157
|
-
let
|
|
158
|
-
|
|
163
|
+
let f = u;
|
|
164
|
+
q(f);
|
|
159
165
|
export {
|
|
160
|
-
|
|
166
|
+
f as View
|
|
161
167
|
};
|
|
@@ -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 T=require("react"),o=require("prop-types"),n=require("@progress/kendo-react-common"),m=require("@progress/kendo-date-math"),D=require("@progress/kendo-react-intl"),N=require("../../virtualization/Virtualization.js"),O=require("./View.js"),q=require("./Header.js"),H=require("../services/WeekNamesService.js"),f=require("../../utils.js"),p=require("../models/CalendarViewEnum.js"),R=require("./TodayCommand.js");function _(d){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(r,e,t.get?t:{enumerable:!0,get:()=>d[e]})}}return r.default=d,Object.freeze(r)}const a=_(T),z=5,u=class u extends a.Component{constructor(r){super(r),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=f.dateInRange(this.props.focusedDate,this.props.min,this.props.max),s=this.props.service.skip(t,this.props.min);this.virtualization.scrollToIndex(s)}},this.buildMonthView=(e,t)=>{const{unstyled:s}=this.props,i=s&&s.uCalendar;return a.createElement("table",{key:"calendar-view-list-weekdays",className:n.classNames(n.uCalendar.table({c:i,weekdays:!0})),role:"grid",tabIndex:this.props.tabIndex},a.createElement("colgroup",null,e.map((h,l)=>a.createElement("col",{key:l}))),a.createElement("thead",{className:n.classNames(n.uCalendar.thead({c:i}))},a.createElement("tr",{className:n.classNames(n.uCalendar.tr({c:i}))},t.map((h,l)=>a.createElement("th",{key:l,className:n.classNames(n.uCalendar.th({c:i}))},h)))))},this.buildDates=(e,t)=>{const s=this.props.cellUID,{unstyled:i}=this.props,h=i&&i.uCalendar;return a.createElement("table",{className:n.classNames(n.uCalendar.table({c:h})),ref:l=>this.table=l,role:"grid",tabIndex:this.props.tabIndex,"aria-activedescendant":s+this.props.focusedDate.getTime()},a.createElement("colgroup",null,e.map((l,c)=>a.createElement("col",{key:c}))),t.map(l=>a.createElement(O.View,{ref:c=>{this.calendarView||(this.calendarView=c)},key:l.getTime(),activeView:this.props.activeView,viewDate:l,min:this.props.min,max:this.props.max,cellUID:s,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,unstyled:i})))},this.calculateHeights=()=>{if(!this.props.dom)return;const e=this.props.activeView===p.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:s})=>{const i=s?s.skip:this.state.skip;if((this.state.index!==e||this.state.skip!==i)&&this.setState({index:e,skip:i}),this.table&&t){const h=`translateY(${t.offset}px)`;this.table.style.transform=h}},this.handleTodayClick=e=>{this.shouldScroll=!0,this.handleDateChange.call(void 0,e,!0)},this.handleDateChange=(e,t=!1)=>{const{onChange:s}=this.props;if(s){const i={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:m.cloneDate(e.value),target:this,isTodayClick:t};s.call(void 0,i)}},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(){return this.intl=D.provideIntlService(this),this.weekService=new H.WeekNamesService(this.intl),this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat)}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===p.CalendarViewEnum.month)}get take(){return this.props.take!==void 0?this.props.take:u.defaultProps.take}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get todayIsInRange(){return f.isInRange(f.getToday(),m.getDate(this.props.min),m.getDate(this.props.max))}componentDidUpdate(r,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(){const{activeView:r,min:e,max:t,service:s,unstyled:i}=this.props,h=i&&i.uCalendar;this.calculateHeights();const l=this.lastView!==r,c=f.dateInRange(this.props.focusedDate,e,t),w=l?s.skip(c,e):this.state.skip,k=s.total(e,t),C=this.getTake(w,k),y=s.addToDate(e,w),x=s.addToDate(e,this.state.index),b=new Array(s.rowLength(this.weekNumber)).fill(""),g=r!==this.lastView;this.animateToIndex=!g,(g||!m.isEqualDate(this.lastFocus,c)||this.shouldScroll||!this.props.shouldScroll||this.props.shouldScroll())&&(this.indexToScroll=this.props.service.skip(c,this.props.min)),this.lastFocus=c;const S=n.classNames(n.uCalendar.view({c:h,month:r===p.CalendarViewEnum.month,year:r===p.CalendarViewEnum.year,decade:r===p.CalendarViewEnum.decade,century:r===p.CalendarViewEnum.century})),V=this.buildDates(b,s.datesList(y,C)),E=a.createElement(a.Fragment,null,a.createElement(q.Header,{key:"calendar-view-list-header",currentDate:x,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,unstyled:i,commands:a.createElement(R.TodayCommand,{min:this.props.min,max:this.props.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange,tabIndex:this.props.tabIndex,unstyled:i})}),this.props.activeView===p.CalendarViewEnum.month&&this.buildMonthView(b,this.weekNames),a.createElement(N.Virtualization,{key:"calendar-view-list-content",skip:w,take:this.take,total:k,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:V,tabIndex:this.props.tabIndex}));return a.createElement("div",{ref:I=>{this._element=I},className:S},this.props.dom.didCalculate?E:null)}};u.propTypes={activeView:o.number.isRequired,bottomOffset:o.number,cellUID:o.string.isRequired,focusedDate:o.instanceOf(Date).isRequired,max:o.instanceOf(Date).isRequired,min:o.instanceOf(Date).isRequired,onChange:o.func,showWeekNumbers:o.bool,smoothScroll:o.bool,take:o.number,value:o.instanceOf(Date),viewHeight:o.number,viewOffset:o.number,weekDaysFormat:o.oneOf(["short","abbreviated","narrow"]),tabIndex:o.number},u.defaultProps={take:z,showWeekNumbers:!1,weekDaysFormat:"short",smoothScroll:!0};let v=u;D.registerForIntl(v);exports.ViewList=v;
|
|
@@ -6,25 +6,25 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as a from "react";
|
|
10
10
|
import o from "prop-types";
|
|
11
|
-
import { classNames as
|
|
12
|
-
import { cloneDate as
|
|
13
|
-
import { provideIntlService as
|
|
14
|
-
import { Virtualization as
|
|
15
|
-
import { View as
|
|
16
|
-
import { Header as
|
|
17
|
-
import { WeekNamesService as
|
|
18
|
-
import { dateInRange as
|
|
19
|
-
import { CalendarViewEnum as
|
|
20
|
-
import { TodayCommand as
|
|
21
|
-
const
|
|
22
|
-
constructor(
|
|
23
|
-
super(
|
|
11
|
+
import { classNames as p, uCalendar as m } from "@progress/kendo-react-common";
|
|
12
|
+
import { cloneDate as T, getDate as b, isEqualDate as E } from "@progress/kendo-date-math";
|
|
13
|
+
import { provideIntlService as N, registerForIntl as O } from "@progress/kendo-react-intl";
|
|
14
|
+
import { Virtualization as H } from "../../virtualization/Virtualization.mjs";
|
|
15
|
+
import { View as z } from "./View.mjs";
|
|
16
|
+
import { Header as A } from "./Header.mjs";
|
|
17
|
+
import { WeekNamesService as R } from "../services/WeekNamesService.mjs";
|
|
18
|
+
import { dateInRange as g, isInRange as _, getToday as q } from "../../utils.mjs";
|
|
19
|
+
import { CalendarViewEnum as c } from "../models/CalendarViewEnum.mjs";
|
|
20
|
+
import { TodayCommand as F } from "./TodayCommand.mjs";
|
|
21
|
+
const M = 5, d = class d extends a.Component {
|
|
22
|
+
constructor(n) {
|
|
23
|
+
super(n), 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 = () => {
|
|
24
24
|
if (!this._element)
|
|
25
25
|
return;
|
|
26
|
-
const e = this._element.querySelector("td.k-focus"),
|
|
27
|
-
e && e[0] && e[0].classList.remove("k-focus"),
|
|
26
|
+
const e = this._element.querySelector("td.k-focus"), s = this._element.querySelector(".k-state-pending-focus");
|
|
27
|
+
e && e[0] && e[0].classList.remove("k-focus"), s && s.classList.add("k-focus"), this.isActive = !0;
|
|
28
28
|
}, this.blurActiveDate = () => {
|
|
29
29
|
if (!this._element)
|
|
30
30
|
return;
|
|
@@ -33,43 +33,46 @@ const H = 5, h = class h extends s.Component {
|
|
|
33
33
|
}, this.handleVirtualizationMount = (e) => {
|
|
34
34
|
if (this.virtualization = e, this.virtualization && this.table) {
|
|
35
35
|
this.table.style.transform = `translateY(${this.viewOffset}px)`;
|
|
36
|
-
const
|
|
37
|
-
this.virtualization.scrollToIndex(
|
|
36
|
+
const s = g(this.props.focusedDate, this.props.min, this.props.max), t = this.props.service.skip(s, this.props.min);
|
|
37
|
+
this.virtualization.scrollToIndex(t);
|
|
38
38
|
}
|
|
39
|
-
}, this.buildMonthView = (e,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
key: "calendar-view-list-weekdays",
|
|
43
|
-
className: "k-calendar-table k-calendar-weekdays",
|
|
44
|
-
role: "grid",
|
|
45
|
-
tabIndex: this.props.tabIndex
|
|
46
|
-
},
|
|
47
|
-
/* @__PURE__ */ s.createElement("colgroup", null, e.map((i, a) => /* @__PURE__ */ s.createElement("col", { key: a }))),
|
|
48
|
-
/* @__PURE__ */ s.createElement("thead", { className: "k-calendar-thead" }, /* @__PURE__ */ s.createElement("tr", { className: "k-calendar-tr" }, t.map((i, a) => /* @__PURE__ */ s.createElement("th", { key: a, className: "k-calendar-th" }, i))))
|
|
49
|
-
), this.buildDates = (e, t) => {
|
|
50
|
-
const i = this.props.cellUID;
|
|
51
|
-
return /* @__PURE__ */ s.createElement(
|
|
39
|
+
}, this.buildMonthView = (e, s) => {
|
|
40
|
+
const { unstyled: t } = this.props, i = t && t.uCalendar;
|
|
41
|
+
return /* @__PURE__ */ a.createElement(
|
|
52
42
|
"table",
|
|
53
43
|
{
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
key: "calendar-view-list-weekdays",
|
|
45
|
+
className: p(m.table({ c: i, weekdays: !0 })),
|
|
46
|
+
role: "grid",
|
|
47
|
+
tabIndex: this.props.tabIndex
|
|
48
|
+
},
|
|
49
|
+
/* @__PURE__ */ a.createElement("colgroup", null, e.map((l, r) => /* @__PURE__ */ a.createElement("col", { key: r }))),
|
|
50
|
+
/* @__PURE__ */ a.createElement("thead", { className: p(m.thead({ c: i })) }, /* @__PURE__ */ a.createElement("tr", { className: p(m.tr({ c: i })) }, s.map((l, r) => /* @__PURE__ */ a.createElement("th", { key: r, className: p(m.th({ c: i })) }, l))))
|
|
51
|
+
);
|
|
52
|
+
}, this.buildDates = (e, s) => {
|
|
53
|
+
const t = this.props.cellUID, { unstyled: i } = this.props, l = i && i.uCalendar;
|
|
54
|
+
return /* @__PURE__ */ a.createElement(
|
|
55
|
+
"table",
|
|
56
|
+
{
|
|
57
|
+
className: p(m.table({ c: l })),
|
|
58
|
+
ref: (r) => this.table = r,
|
|
56
59
|
role: "grid",
|
|
57
60
|
tabIndex: this.props.tabIndex,
|
|
58
|
-
"aria-activedescendant":
|
|
61
|
+
"aria-activedescendant": t + this.props.focusedDate.getTime()
|
|
59
62
|
},
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
/* @__PURE__ */ a.createElement("colgroup", null, e.map((r, h) => /* @__PURE__ */ a.createElement("col", { key: h }))),
|
|
64
|
+
s.map((r) => /* @__PURE__ */ a.createElement(
|
|
65
|
+
z,
|
|
63
66
|
{
|
|
64
|
-
ref: (
|
|
65
|
-
this.calendarView || (this.calendarView =
|
|
67
|
+
ref: (h) => {
|
|
68
|
+
this.calendarView || (this.calendarView = h);
|
|
66
69
|
},
|
|
67
|
-
key:
|
|
70
|
+
key: r.getTime(),
|
|
68
71
|
activeView: this.props.activeView,
|
|
69
|
-
viewDate:
|
|
72
|
+
viewDate: r,
|
|
70
73
|
min: this.props.min,
|
|
71
74
|
max: this.props.max,
|
|
72
|
-
cellUID:
|
|
75
|
+
cellUID: t,
|
|
73
76
|
focusedDate: this.props.focusedDate,
|
|
74
77
|
cell: this.props.cell,
|
|
75
78
|
selectedDate: this.props.value,
|
|
@@ -78,34 +81,35 @@ const H = 5, h = class h extends s.Component {
|
|
|
78
81
|
bus: this.props.bus,
|
|
79
82
|
service: this.props.service,
|
|
80
83
|
weekCell: this.props.weekCell,
|
|
81
|
-
showOtherMonthDays: this.props.showOtherMonthDays
|
|
84
|
+
showOtherMonthDays: this.props.showOtherMonthDays,
|
|
85
|
+
unstyled: i
|
|
82
86
|
}
|
|
83
87
|
))
|
|
84
88
|
);
|
|
85
89
|
}, this.calculateHeights = () => {
|
|
86
90
|
if (!this.props.dom)
|
|
87
91
|
return;
|
|
88
|
-
const e = this.props.activeView ===
|
|
92
|
+
const e = this.props.activeView === c.month ? this.props.dom.scrollableContentHeight : this.props.dom.scrollableYearContentHeight;
|
|
89
93
|
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;
|
|
90
|
-
}, this.getTake = (e,
|
|
91
|
-
const
|
|
92
|
-
if ((this.state.index !== e || this.state.skip !==
|
|
93
|
-
const
|
|
94
|
-
this.table.style.transform =
|
|
94
|
+
}, this.getTake = (e, s) => Math.min(s - e, this.take), this.handleScrollAction = ({ index: e, scrollAction: s, pageAction: t }) => {
|
|
95
|
+
const i = t ? t.skip : this.state.skip;
|
|
96
|
+
if ((this.state.index !== e || this.state.skip !== i) && this.setState({ index: e, skip: i }), this.table && s) {
|
|
97
|
+
const l = `translateY(${s.offset}px)`;
|
|
98
|
+
this.table.style.transform = l;
|
|
95
99
|
}
|
|
96
100
|
}, this.handleTodayClick = (e) => {
|
|
97
101
|
this.shouldScroll = !0, this.handleDateChange.call(void 0, e, !0);
|
|
98
|
-
}, this.handleDateChange = (e,
|
|
99
|
-
const { onChange:
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
102
|
+
}, this.handleDateChange = (e, s = !1) => {
|
|
103
|
+
const { onChange: t } = this.props;
|
|
104
|
+
if (t) {
|
|
105
|
+
const i = {
|
|
102
106
|
syntheticEvent: e.syntheticEvent,
|
|
103
107
|
nativeEvent: e.nativeEvent,
|
|
104
|
-
value:
|
|
108
|
+
value: T(e.value),
|
|
105
109
|
target: this,
|
|
106
|
-
isTodayClick:
|
|
110
|
+
isTodayClick: s
|
|
107
111
|
};
|
|
108
|
-
|
|
112
|
+
t.call(void 0, i);
|
|
109
113
|
}
|
|
110
114
|
}, this.lastView = this.props.activeView, this.lastFocus = this.props.focusedDate, this.state = {
|
|
111
115
|
skip: this.props.service.skip(this.props.focusedDate, this.props.min),
|
|
@@ -116,40 +120,39 @@ const H = 5, h = class h extends s.Component {
|
|
|
116
120
|
return this._element;
|
|
117
121
|
}
|
|
118
122
|
get weekNames() {
|
|
119
|
-
return this.intl =
|
|
123
|
+
return this.intl = N(this), this.weekService = new R(this.intl), this.weekService.getWeekNames(this.weekNumber, this.props.weekDaysFormat);
|
|
120
124
|
}
|
|
121
125
|
get weekNumber() {
|
|
122
|
-
return !!(this.props.showWeekNumbers && this.props.activeView ===
|
|
126
|
+
return !!(this.props.showWeekNumbers && this.props.activeView === c.month);
|
|
123
127
|
}
|
|
124
128
|
get take() {
|
|
125
|
-
return this.props.take !== void 0 ? this.props.take :
|
|
129
|
+
return this.props.take !== void 0 ? this.props.take : d.defaultProps.take;
|
|
126
130
|
}
|
|
127
131
|
get animate() {
|
|
128
132
|
return !!(this.props.smoothScroll && this.animateToIndex);
|
|
129
133
|
}
|
|
130
134
|
get todayIsInRange() {
|
|
131
|
-
return
|
|
135
|
+
return _(q(), b(this.props.min), b(this.props.max));
|
|
132
136
|
}
|
|
133
|
-
componentDidUpdate(
|
|
137
|
+
componentDidUpdate(n, e) {
|
|
134
138
|
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;
|
|
135
139
|
}
|
|
136
140
|
render() {
|
|
141
|
+
const { activeView: n, min: e, max: s, service: t, unstyled: i } = this.props, l = i && i.uCalendar;
|
|
137
142
|
this.calculateHeights();
|
|
138
|
-
const
|
|
139
|
-
this.animateToIndex = !
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
), w = this.buildDates(c, this.props.service.datesList(r, a)), k = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
|
|
149
|
-
T,
|
|
143
|
+
const r = this.lastView !== n, h = g(this.props.focusedDate, e, s), u = r ? t.skip(h, e) : this.state.skip, v = t.total(e, s), D = this.getTake(u, v), x = t.addToDate(e, u), y = t.addToDate(e, this.state.index), w = new Array(t.rowLength(this.weekNumber)).fill(""), k = n !== this.lastView;
|
|
144
|
+
this.animateToIndex = !k, (k || !E(this.lastFocus, h) || this.shouldScroll || !this.props.shouldScroll || this.props.shouldScroll()) && (this.indexToScroll = this.props.service.skip(h, this.props.min)), this.lastFocus = h;
|
|
145
|
+
const S = p(m.view({
|
|
146
|
+
c: l,
|
|
147
|
+
month: n === c.month,
|
|
148
|
+
year: n === c.year,
|
|
149
|
+
decade: n === c.decade,
|
|
150
|
+
century: n === c.century
|
|
151
|
+
})), C = this.buildDates(w, t.datesList(x, D)), I = /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
|
|
152
|
+
A,
|
|
150
153
|
{
|
|
151
154
|
key: "calendar-view-list-header",
|
|
152
|
-
currentDate:
|
|
155
|
+
currentDate: y,
|
|
153
156
|
min: this.props.min,
|
|
154
157
|
max: this.props.max,
|
|
155
158
|
activeView: this.props.activeView,
|
|
@@ -157,24 +160,26 @@ const H = 5, h = class h extends s.Component {
|
|
|
157
160
|
service: this.props.service,
|
|
158
161
|
headerTitle: this.props.headerTitle,
|
|
159
162
|
header: this.props.header,
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
unstyled: i,
|
|
164
|
+
commands: /* @__PURE__ */ a.createElement(
|
|
165
|
+
F,
|
|
162
166
|
{
|
|
163
167
|
min: this.props.min,
|
|
164
168
|
max: this.props.max,
|
|
165
169
|
onClick: this.handleTodayClick,
|
|
166
170
|
disabled: !this.todayIsInRange,
|
|
167
|
-
tabIndex: this.props.tabIndex
|
|
171
|
+
tabIndex: this.props.tabIndex,
|
|
172
|
+
unstyled: i
|
|
168
173
|
}
|
|
169
|
-
)
|
|
174
|
+
)
|
|
170
175
|
}
|
|
171
|
-
), this.props.activeView ===
|
|
172
|
-
|
|
176
|
+
), this.props.activeView === c.month && this.buildMonthView(w, this.weekNames), /* @__PURE__ */ a.createElement(
|
|
177
|
+
H,
|
|
173
178
|
{
|
|
174
179
|
key: "calendar-view-list-content",
|
|
175
|
-
skip:
|
|
180
|
+
skip: u,
|
|
176
181
|
take: this.take,
|
|
177
|
-
total:
|
|
182
|
+
total: v,
|
|
178
183
|
itemHeight: this.viewHeight,
|
|
179
184
|
topOffset: this.viewOffset,
|
|
180
185
|
bottomOffset: this.bottomOffset,
|
|
@@ -183,23 +188,23 @@ const H = 5, h = class h extends s.Component {
|
|
|
183
188
|
onScroll: this.props.onScroll,
|
|
184
189
|
onScrollAction: this.handleScrollAction,
|
|
185
190
|
onMount: this.handleVirtualizationMount,
|
|
186
|
-
children:
|
|
191
|
+
children: C,
|
|
187
192
|
tabIndex: this.props.tabIndex
|
|
188
193
|
}
|
|
189
194
|
));
|
|
190
|
-
return /* @__PURE__ */
|
|
195
|
+
return /* @__PURE__ */ a.createElement(
|
|
191
196
|
"div",
|
|
192
197
|
{
|
|
193
|
-
ref: (
|
|
194
|
-
this._element =
|
|
198
|
+
ref: (V) => {
|
|
199
|
+
this._element = V;
|
|
195
200
|
},
|
|
196
|
-
className:
|
|
201
|
+
className: S
|
|
197
202
|
},
|
|
198
|
-
this.props.dom.didCalculate ?
|
|
203
|
+
this.props.dom.didCalculate ? I : null
|
|
199
204
|
);
|
|
200
205
|
}
|
|
201
206
|
};
|
|
202
|
-
|
|
207
|
+
d.propTypes = {
|
|
203
208
|
activeView: o.number.isRequired,
|
|
204
209
|
bottomOffset: o.number,
|
|
205
210
|
cellUID: o.string.isRequired,
|
|
@@ -215,14 +220,14 @@ h.propTypes = {
|
|
|
215
220
|
viewOffset: o.number,
|
|
216
221
|
weekDaysFormat: o.oneOf(["short", "abbreviated", "narrow"]),
|
|
217
222
|
tabIndex: o.number
|
|
218
|
-
},
|
|
219
|
-
take:
|
|
223
|
+
}, d.defaultProps = {
|
|
224
|
+
take: M,
|
|
220
225
|
showWeekNumbers: !1,
|
|
221
226
|
weekDaysFormat: "short",
|
|
222
227
|
smoothScroll: !0
|
|
223
228
|
};
|
|
224
|
-
let
|
|
225
|
-
|
|
229
|
+
let f = d;
|
|
230
|
+
O(f);
|
|
226
231
|
export {
|
|
227
|
-
|
|
232
|
+
f as ViewList
|
|
228
233
|
};
|
package/common/ClearButton.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";const
|
|
8
|
+
"use client";"use strict";const d=require("react"),m=require("@progress/kendo-react-intl"),a=require("../messages/index.js"),o=require("@progress/kendo-react-common"),g=require("@progress/kendo-svg-icons");function p(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,c.get?c:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const l=p(d),b=e=>{const n=m.useLocalization(),t=o.useUnstyled(),c=t&&t.uDateInput,i=n.toLanguageString(a.clear,a.messages[a.clear]),u=s=>{s.stopPropagation();const{onClick:r}=e;r&&r.call(void 0,s)};return l.createElement("span",{className:o.classNames(o.uDateInput.clearButton({c})),role:"button",onClick:u,tabIndex:e.tabindex||-1,title:i,key:"clearbutton"},l.createElement(o.IconWrap,{name:"x",icon:g.xIcon}))};module.exports=b;
|
package/common/ClearButton.mjs
CHANGED
|
@@ -6,36 +6,30 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import {
|
|
11
|
-
import { clear as
|
|
12
|
-
import { IconWrap as
|
|
13
|
-
import { xIcon as
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
/* @__PURE__ */ e.createElement(s, { name: "x", icon: c })
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
n(l);
|
|
9
|
+
import * as a from "react";
|
|
10
|
+
import { useLocalization as m } from "@progress/kendo-react-intl";
|
|
11
|
+
import { clear as c, messages as u } from "../messages/index.mjs";
|
|
12
|
+
import { useUnstyled as p, classNames as d, uDateInput as f, IconWrap as g } from "@progress/kendo-react-common";
|
|
13
|
+
import { xIcon as x } from "@progress/kendo-svg-icons";
|
|
14
|
+
const y = (t) => {
|
|
15
|
+
const s = m(), e = p(), l = e && e.uDateInput, r = s.toLanguageString(c, u[c]), i = (o) => {
|
|
16
|
+
o.stopPropagation();
|
|
17
|
+
const { onClick: n } = t;
|
|
18
|
+
n && n.call(void 0, o);
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ a.createElement(
|
|
21
|
+
"span",
|
|
22
|
+
{
|
|
23
|
+
className: d(f.clearButton({ c: l })),
|
|
24
|
+
role: "button",
|
|
25
|
+
onClick: i,
|
|
26
|
+
tabIndex: t.tabindex || -1,
|
|
27
|
+
title: r,
|
|
28
|
+
key: "clearbutton"
|
|
29
|
+
},
|
|
30
|
+
/* @__PURE__ */ a.createElement(g, { name: "x", icon: x })
|
|
31
|
+
);
|
|
32
|
+
};
|
|
39
33
|
export {
|
|
40
|
-
|
|
34
|
+
y as default
|
|
41
35
|
};
|