@progress/kendo-react-dateinputs 14.4.1 → 14.5.0-develop.1

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.
Files changed (35) hide show
  1. package/calendar/components/Calendar.d.ts +35 -110
  2. package/calendar/components/Calendar.js +5 -5
  3. package/calendar/components/Calendar.mjs +288 -313
  4. package/calendar/components/CalendarCell.d.ts +1 -10
  5. package/calendar/components/CalendarCell.js +1 -1
  6. package/calendar/components/CalendarCell.mjs +68 -78
  7. package/calendar/components/Header.d.ts +10 -23
  8. package/calendar/components/Header.js +1 -1
  9. package/calendar/components/Header.mjs +41 -55
  10. package/calendar/components/HorizontalViewList.d.ts +28 -26
  11. package/calendar/components/HorizontalViewList.js +1 -1
  12. package/calendar/components/HorizontalViewList.mjs +112 -102
  13. package/calendar/components/MultiViewCalendar.d.ts +39 -141
  14. package/calendar/components/MultiViewCalendar.js +1 -1
  15. package/calendar/components/MultiViewCalendar.mjs +331 -373
  16. package/calendar/components/Navigation.d.ts +19 -39
  17. package/calendar/components/Navigation.js +1 -1
  18. package/calendar/components/Navigation.mjs +95 -107
  19. package/calendar/components/TodayCommand.d.ts +8 -25
  20. package/calendar/components/TodayCommand.js +1 -1
  21. package/calendar/components/TodayCommand.mjs +44 -61
  22. package/calendar/components/View.d.ts +11 -42
  23. package/calendar/components/View.js +1 -1
  24. package/calendar/components/View.mjs +111 -137
  25. package/calendar/components/ViewList.d.ts +25 -65
  26. package/calendar/components/ViewList.js +1 -1
  27. package/calendar/components/ViewList.mjs +207 -225
  28. package/calendar/services/ScrollSyncService.d.ts +4 -4
  29. package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
  30. package/package-metadata.js +1 -1
  31. package/package-metadata.mjs +2 -2
  32. package/package.json +8 -8
  33. package/virtualization/Virtualization.d.ts +25 -63
  34. package/virtualization/Virtualization.js +1 -1
  35. package/virtualization/Virtualization.mjs +163 -168
@@ -5,145 +5,119 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as i from "react";
9
- import s from "prop-types";
10
- import { cloneDate as k, weekInYear as R } from "@progress/kendo-date-math";
11
- import { provideIntlService as M, registerForIntl as q } from "@progress/kendo-react-intl";
12
- import { CalendarCell as x } from "./CalendarCell.mjs";
13
- import { CalendarWeekCell as I } from "./CalendarWeekCell.mjs";
14
- import { CalendarViewEnum as D } from "../models/CalendarViewEnum.mjs";
15
- import { getToday as v, setTime as V } from "../../utils.mjs";
16
- import { WeekNamesService as S } from "../services/WeekNamesService.mjs";
17
- import { classNames as l, uCalendar as c } from "@progress/kendo-react-common";
18
- const y = (g, t) => {
19
- const e = t;
20
- return /* @__PURE__ */ i.createElement("td", { key: g, role: "gridcell", className: l(c.td({ c: e, isEmpty: !0 })) }, " ");
21
- }, u = class u extends i.Component {
22
- constructor() {
23
- super(...arguments), this.intl = null, this.weekService = null, this.buildWeekNumber = (t, e) => {
24
- if (!this.firstDate(t))
25
- return y(`week-cell-${e}`);
26
- const a = this.firstDate(t), n = this.getWeekNumber(a), o = `kendo-react-calendar-week-cell-${n}`, m = {
27
- value: n,
28
- firstDate: a,
29
- weekDays: t,
30
- unstyled: this.props.unstyled,
31
- onClick: this.handleWeekCellClick
32
- };
33
- return this.props.weekCell ? /* @__PURE__ */ i.createElement(this.props.weekCell, { ...m, key: o }, n) : /* @__PURE__ */ i.createElement(I, { ...m, key: o }, n);
34
- }, this.buildRow = (t) => t.map((e, r) => {
35
- if (!e)
36
- return y(r);
37
- const a = { "aria-selected": e.isSelected }, n = `kendo-react-calendar-cell-${e.value.getTime()}`, o = {
38
- ...a,
39
- ...e,
40
- isDisabled: !e.isInRange,
41
- view: this.props.activeView,
42
- showOtherMonthDays: this.props.showOtherMonthDays,
43
- allowReverse: this.props.allowReverse,
44
- unstyled: this.props.unstyled,
45
- onClick: this.handleClick,
46
- onMouseEnter: this.handleMouseEnter,
47
- onMouseLeave: this.handleMouseLeave
48
- };
49
- return this.props.cell ? /* @__PURE__ */ i.createElement(this.props.cell, { ...o, key: n }, e.formattedValue) : /* @__PURE__ */ i.createElement(x, { ...o, key: n }, e.formattedValue);
50
- }), this.firstDate = (t) => {
51
- const e = this.firstWeekDateContext(t);
52
- return e ? e.value : null;
53
- }, this.firstWeekDateContext = (t) => {
54
- if (!this.weekNumber)
55
- return null;
56
- let e = 0, r = t[e];
57
- for (; !r && e < t.length; )
58
- r = t[++e];
59
- return r;
60
- }, this.handleClick = (t, e) => {
61
- const { onChange: r } = this.props;
62
- if (r && e) {
63
- const a = {
64
- value: k(t),
65
- target: this,
66
- nativeEvent: e && e.nativeEvent,
67
- syntheticEvent: e
68
- };
69
- r.call(void 0, a);
70
- }
71
- }, this.handleWeekCellClick = (t, e, r) => {
72
- const { onWeekSelect: a } = this.props, n = e.findIndex((o) => o && o.value === t);
73
- a && r && a.call(void 0, t, n, r);
74
- }, this.handleMouseEnter = (t) => {
75
- const { onCellEnter: e } = this.props;
76
- e && e.call(void 0, k(t));
77
- }, this.handleMouseLeave = (t) => {
78
- const { onCellLeave: e } = this.props;
79
- e && e.call(void 0, k(t));
80
- };
81
- }
82
- get min() {
83
- return this.props.min;
84
- }
85
- get max() {
86
- return this.props.max;
87
- }
88
- get isHorizontal() {
89
- return this.props.direction === "horizontal";
90
- }
91
- get isMonthView() {
92
- return this.props.activeView === D.month;
93
- }
94
- get weekNumber() {
95
- return !!(this.props.showWeekNumbers && this.props.activeView === D.month);
96
- }
97
- get selectedDate() {
98
- return this.props.selectedDate !== void 0 ? this.props.selectedDate : u.defaultProps.selectedDate;
99
- }
100
- render() {
101
- const { service: t, weekDaysFormat: e, cellUID: r, focusedDate: a, bus: n, activeView: o, selectionRange: m, unstyled: w } = this.props, h = w && w.uCalendar;
102
- this.intl = M(this), this.weekService = new S(this.intl);
103
- 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({
104
- cellUID: r,
105
- min: this.min,
106
- max: this.max,
107
- focusedDate: a,
108
- isActiveView: !n.canMoveDown(o),
109
- selectedDate: this.selectedDate,
110
- selectionRange: m,
111
- viewDate: W
112
- });
113
- return /* @__PURE__ */ i.createElement(i.Fragment, null, this.isMonthView && this.isHorizontal && /* @__PURE__ */ i.createElement("thead", { role: "rowgroup", className: l(c.thead({ c: h })) }, /* @__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)))), /* @__PURE__ */ i.createElement("tbody", { role: "rowgroup", className: l(c.tbody({ c: h })) }, !this.isHorizontal && /* @__PURE__ */ i.createElement("tr", { role: "presentation", className: l(c.tr({ c: h })) }, /* @__PURE__ */ i.createElement(
114
- "th",
115
- {
116
- scope: "col",
117
- colSpan: N,
118
- className: l(c.caption({ c: h }))
119
- },
120
- b
121
- )), 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)))));
122
- }
123
- getWeekNumber(t) {
124
- return !this.weekNumber || !this.intl ? null : R(t, this.intl.firstDay());
125
- }
126
- };
127
- u.propTypes = {
128
- activeRangeEnd: s.oneOf(["start", "end", null]),
129
- activeView: s.number.isRequired,
130
- cellUID: s.string.isRequired,
131
- direction: s.oneOf(["horizontal", "vertical"]),
132
- focusedDate: s.instanceOf(Date).isRequired,
133
- max: s.instanceOf(Date).isRequired,
134
- min: s.instanceOf(Date).isRequired,
135
- onChange: s.func,
136
- selectedDate: s.oneOfType([s.instanceOf(Date), s.arrayOf(s.instanceOf(Date))]),
137
- showWeekNumbers: s.bool,
138
- showOtherMonthDays: s.bool,
139
- viewDate: s.instanceOf(Date).isRequired
140
- }, u.defaultProps = {
8
+ import * as a from "react";
9
+ import { weekInYear as re, cloneDate as h } from "@progress/kendo-date-math";
10
+ import { useInternationalization as se } from "@progress/kendo-react-intl";
11
+ import { CalendarCell as ce } from "./CalendarCell.mjs";
12
+ import { CalendarWeekCell as ie } from "./CalendarWeekCell.mjs";
13
+ import { CalendarViewEnum as M } from "../models/CalendarViewEnum.mjs";
14
+ import { getToday as S, setTime as me } from "../../utils.mjs";
15
+ import { WeekNamesService as ue } from "../services/WeekNamesService.mjs";
16
+ import { classNames as r, uCalendar as s } from "@progress/kendo-react-common";
17
+ const R = (k, f) => {
18
+ const m = f;
19
+ return /* @__PURE__ */ a.createElement("td", { key: k, role: "gridcell", className: r(s.td({ c: m, isEmpty: !0 })) }, " ");
20
+ }, p = {
141
21
  direction: "vertical",
142
- selectedDate: v(),
22
+ selectedDate: S(),
143
23
  showWeekNumbers: !1
24
+ }, Ee = (k) => {
25
+ const {
26
+ activeRangeEnd: f,
27
+ activeView: m,
28
+ bus: T,
29
+ cellUID: z,
30
+ direction: L = p.direction,
31
+ focusedDate: q,
32
+ weekCell: C,
33
+ max: x,
34
+ weekDaysFormat: O,
35
+ min: P,
36
+ cell: D,
37
+ onCellEnter: E,
38
+ onCellLeave: y,
39
+ onChange: v,
40
+ onWeekSelect: N,
41
+ selectedDate: $ = p.selectedDate,
42
+ selectionRange: A,
43
+ service: w,
44
+ showWeekNumbers: B = p.showWeekNumbers,
45
+ showOtherMonthDays: F,
46
+ viewDate: g,
47
+ allowReverse: H,
48
+ unstyled: d
49
+ } = k, W = L === "horizontal", K = m === M.month, u = !!(B && m === M.month), U = (e, t) => {
50
+ if (v && t) {
51
+ const l = {
52
+ value: h(e),
53
+ target: null,
54
+ nativeEvent: t == null ? void 0 : t.nativeEvent,
55
+ syntheticEvent: t
56
+ };
57
+ v(l);
58
+ }
59
+ }, Y = (e, t, l) => {
60
+ const o = t.findIndex((n) => (n == null ? void 0 : n.value) === e);
61
+ N && l && N(e, o, l);
62
+ }, j = (e) => {
63
+ E && E(h(e));
64
+ }, G = (e) => {
65
+ y && y(h(e));
66
+ }, b = se(), J = new ue(b), c = d && d.uCalendar, Q = (e) => u ? re(e, b.firstDay()) : null, X = (e) => {
67
+ if (!u)
68
+ return null;
69
+ let t = 0, l = e[t];
70
+ for (; !l && t < e.length; )
71
+ l = e[++t];
72
+ return l;
73
+ }, V = (e) => {
74
+ const t = X(e);
75
+ return t ? t.value : null;
76
+ }, Z = (e, t) => {
77
+ if (!V(e))
78
+ return R(`week-cell-${t}`);
79
+ const o = V(e), n = Q(o), i = `kendo-react-calendar-week-cell-${n}`, I = {
80
+ value: n,
81
+ firstDate: o,
82
+ weekDays: e,
83
+ unstyled: d,
84
+ onClick: Y
85
+ };
86
+ return C ? /* @__PURE__ */ a.createElement(C, { ...I, key: i }, n) : /* @__PURE__ */ a.createElement(ie, { ...I, key: i }, n);
87
+ }, _ = (e) => e.map((t, l) => {
88
+ if (!t)
89
+ return R(l);
90
+ const o = { "aria-selected": t.isSelected }, n = `kendo-react-calendar-cell-${t.value.getTime()}`, i = {
91
+ ...o,
92
+ ...t,
93
+ isDisabled: !t.isInRange,
94
+ view: m,
95
+ showOtherMonthDays: F,
96
+ allowReverse: H,
97
+ activeRangeEnd: f,
98
+ unstyled: d,
99
+ onClick: U,
100
+ onMouseEnter: j,
101
+ onMouseLeave: G
102
+ };
103
+ return D ? /* @__PURE__ */ a.createElement(D, { ...i, key: n }, t.formattedValue) : /* @__PURE__ */ a.createElement(ce, { ...i, key: n }, t.formattedValue);
104
+ }), ee = J.getWeekNames(u, O), te = w.rowLength(u), ne = w.title(g), ae = S(), le = me(g, ae), oe = w.data({
105
+ cellUID: z,
106
+ min: P,
107
+ max: x,
108
+ focusedDate: q,
109
+ isActiveView: !T.canMoveDown(m),
110
+ selectedDate: $,
111
+ selectionRange: A,
112
+ viewDate: le
113
+ });
114
+ return /* @__PURE__ */ a.createElement(a.Fragment, null, K && W && /* @__PURE__ */ a.createElement("thead", { className: r(s.thead({ c })) }, /* @__PURE__ */ a.createElement("tr", { role: "row", className: r(s.tr({ c })) }, ee.map((e) => /* @__PURE__ */ a.createElement("th", { key: e, className: r(s.th({ c })) }, e)))), /* @__PURE__ */ a.createElement("tbody", { className: r(s.tbody({ c })) }, !W && /* @__PURE__ */ a.createElement("tr", { className: r(s.tr({ c })) }, /* @__PURE__ */ a.createElement("th", { scope: "col", colSpan: te, className: r(s.caption({ c })) }, ne)), oe.map((e, t) => {
115
+ var o, n;
116
+ const l = (n = (o = e.find((i) => i != null)) == null ? void 0 : o.value.getTime()) != null ? n : t;
117
+ return /* @__PURE__ */ a.createElement("tr", { role: "row", className: r(s.tr({ c })), key: l }, u && Z(e, t), _(e));
118
+ })));
144
119
  };
145
- let f = u;
146
- q(f);
147
120
  export {
148
- f as View
121
+ Ee as View,
122
+ p as viewDefaultProps
149
123
  };
@@ -5,9 +5,8 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { default as PropTypes } from 'prop-types';
9
8
  import { DateInputsClassStructure } from '@progress/kendo-react-common';
10
- import { Virtualization } from '../../virtualization/Virtualization.js';
9
+ import { VirtualizationHandle } from '../../virtualization/Virtualization.js';
11
10
  import { BusViewService, DOMService } from '../services/index.js';
12
11
  import { CalendarCellProps } from './CalendarCell.js';
13
12
  import { ViewService, CalendarViewEnum } from '../models/index.js';
@@ -16,6 +15,15 @@ import { CalendarHeaderTitleProps } from './CalendarHeaderTitle.js';
16
15
  import { WeekDaysFormat } from '../models/WeekDaysFormat';
17
16
  import { CalendarHeaderProps } from '../models/CalendarSettings';
18
17
  import * as React from 'react';
18
+ /**
19
+ * @hidden
20
+ */
21
+ export interface ViewListHandle {
22
+ element: HTMLDivElement | null;
23
+ virtualization: VirtualizationHandle | null;
24
+ focusActiveDate: () => void;
25
+ blurActiveDate: () => void;
26
+ }
19
27
  /**
20
28
  * @hidden
21
29
  */
@@ -23,7 +31,7 @@ export interface ViewListEventArguments {
23
31
  syntheticEvent: React.SyntheticEvent<any>;
24
32
  nativeEvent?: any;
25
33
  value: Date;
26
- target: ViewList;
34
+ target: ViewListHandle;
27
35
  isTodayClick?: boolean;
28
36
  }
29
37
  /**
@@ -31,7 +39,6 @@ export interface ViewListEventArguments {
31
39
  */
32
40
  export interface ViewListProps {
33
41
  activeView: CalendarViewEnum;
34
- bottomOffset?: number;
35
42
  bus: BusViewService;
36
43
  cellUID: string;
37
44
  dom: DOMService;
@@ -47,8 +54,6 @@ export interface ViewListProps {
47
54
  take?: number;
48
55
  weekDaysFormat?: WeekDaysFormat;
49
56
  value: Date | null;
50
- viewHeight?: number;
51
- viewOffset?: number;
52
57
  weekCell?: React.ComponentType<CalendarWeekCellProps>;
53
58
  showOtherMonthDays?: boolean;
54
59
  headerTitle?: React.ComponentType<CalendarHeaderTitleProps>;
@@ -67,62 +72,17 @@ export interface ViewListState {
67
72
  /**
68
73
  * @hidden
69
74
  */
70
- export declare class ViewList extends React.Component<ViewListProps, ViewListState> {
71
- static propTypes: {
72
- activeView: PropTypes.Validator<number>;
73
- bottomOffset: PropTypes.Requireable<number>;
74
- cellUID: PropTypes.Validator<string>;
75
- focusedDate: PropTypes.Validator<Date>;
76
- max: PropTypes.Validator<Date>;
77
- min: PropTypes.Validator<Date>;
78
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
79
- showWeekNumbers: PropTypes.Requireable<boolean>;
80
- smoothScroll: PropTypes.Requireable<boolean>;
81
- take: PropTypes.Requireable<number>;
82
- value: PropTypes.Requireable<Date>;
83
- viewHeight: PropTypes.Requireable<number>;
84
- viewOffset: PropTypes.Requireable<number>;
85
- weekDaysFormat: PropTypes.Requireable<string>;
86
- tabIndex: PropTypes.Requireable<number>;
87
- };
88
- static defaultProps: {
89
- take: number;
90
- showWeekNumbers: boolean;
91
- weekDaysFormat: string;
92
- smoothScroll: boolean;
93
- };
94
- virtualization: Virtualization | null;
95
- private calendarView;
96
- private table;
97
- private intl;
98
- private bottomOffset;
99
- private viewOffset;
100
- private viewHeight;
101
- private _element;
102
- private lastView;
103
- private isActive;
104
- private animateToIndex;
105
- private shouldScroll;
106
- private indexToScroll?;
107
- private lastFocus;
108
- private weekService;
109
- get element(): HTMLDivElement | null;
110
- protected get weekNames(): string[];
111
- protected get weekNumber(): boolean;
112
- protected get take(): number;
113
- protected get animate(): boolean;
114
- protected get todayIsInRange(): boolean;
115
- constructor(props: ViewListProps);
116
- componentDidUpdate(_prevProps: ViewListProps, _prevState: ViewListState): void;
117
- focusActiveDate: () => void;
118
- blurActiveDate: () => void;
119
- render(): React.JSX.Element;
120
- protected handleVirtualizationMount: (virtualization: Virtualization) => void;
121
- protected buildMonthView: (cols: any[], weekNames: any[]) => React.JSX.Element;
122
- protected buildDates: (cols: any[], dates: Date[]) => React.JSX.Element;
123
- protected calculateHeights: () => void;
124
- protected getTake: (skip: number, total: number) => number;
125
- private handleScrollAction;
126
- private handleTodayClick;
127
- private handleDateChange;
128
- }
75
+ export declare const viewListDefaultProps: {
76
+ take: number;
77
+ showWeekNumbers: boolean;
78
+ weekDaysFormat: "short";
79
+ smoothScroll: boolean;
80
+ };
81
+ /**
82
+ * @hidden
83
+ */
84
+ export type ViewList = ViewListHandle;
85
+ /**
86
+ * @hidden
87
+ */
88
+ export declare const ViewList: React.ForwardRefExoticComponent<ViewListProps & React.RefAttributes<ViewListHandle | null>>;
@@ -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 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"),C=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 z(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=z(T),_=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=C.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,b=s.total(e,t),y=this.getTake(w,b),x=s.addToDate(e,w),S=s.addToDate(e,this.state.index),g=new Array(s.rowLength(this.weekNumber)).fill(""),D=r!==this.lastView;this.animateToIndex=!D,(D||!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 V=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})),E=this.buildDates(g,s.datesList(x,y)),I=a.createElement(a.Fragment,null,a.createElement(q.Header,{key:"calendar-view-list-header",currentDate:S,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(g,this.weekNames),a.createElement(N.Virtualization,{key:"calendar-view-list-content",skip:w,take:this.take,total:b,itemHeight:this.viewHeight,topOffset:this.viewOffset,bottomOffset:this.bottomOffset,scrollOffsetSize:this.viewOffset,maxScrollDifference:this.viewHeight,onScroll:this.props.onScroll,onScrollAction:this.handleScrollAction,onMount:k=>!this.virtualization&&this.handleVirtualizationMount(k),children:E,tabIndex:this.props.tabIndex,unstyled:i}));return a.createElement("div",{ref:k=>{this._element=k},className:V},this.props.dom.didCalculate?I: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:_,showWeekNumbers:!1,weekDaysFormat:"short",smoothScroll:!0};let v=u;C.registerForIntl(v);exports.ViewList=v;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ee=require("react"),r=require("@progress/kendo-react-common"),b=require("@progress/kendo-date-math"),De=require("@progress/kendo-react-intl"),Se=require("../../virtualization/Virtualization.js"),Ve=require("./View.js"),be=require("./Header.js"),Ne=require("../services/WeekNamesService.js"),N=require("../../utils.js"),f=require("../models/CalendarViewEnum.js"),Te=require("./TodayCommand.js");function Ie(l){const C=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const i in l)if(i!=="default"){const E=Object.getOwnPropertyDescriptor(l,i);Object.defineProperty(C,i,E.get?E:{enumerable:!0,get:()=>l[i]})}}return C.default=l,Object.freeze(C)}const t=Ie(Ee),qe=5,R={take:qe,showWeekNumbers:!1,weekDaysFormat:"short",smoothScroll:!0},Q=t.forwardRef((l,C)=>{const{take:i=R.take,showWeekNumbers:E=R.showWeekNumbers,weekDaysFormat:X=R.weekDaysFormat,smoothScroll:Z=R.smoothScroll,activeView:n,bus:W,cellUID:M,dom:o,focusedDate:h,max:u,min:a,cell:ee,onScroll:te,onChange:P,service:s,value:ne,weekCell:ae,showOtherMonthDays:re,headerTitle:se,header:ce,shouldScroll:j,tabIndex:k,unstyled:w}=l,T=!!(E&&n===f.CalendarViewEnum.month),oe=N.isInRange(N.getToday(),b.getDate(a),b.getDate(u)),A=()=>{if(!m.current)return;const e=m.current.querySelector("td.k-focus"),c=m.current.querySelector(".k-state-pending-focus");e&&e[0]&&e[0].classList.remove("k-focus"),c&&c.classList.add("k-focus"),H.current=!0},le=()=>{if(!m.current)return;const e=m.current.querySelector("td.k-focus");e&&e.classList.remove("k-focus"),H.current=!1},F=(e,c=!1)=>{if(P){const v={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:b.cloneDate(e.value),target:I.current,isTodayClick:c};P(v)}},ie=e=>{O.current=!0,F(e,!0)},ue=({index:e,scrollAction:c,pageAction:v})=>{const V=v?v.skip:void 0;if(me(y=>{const J=V!==void 0?V:y.skip;return y.index!==e||y.skip!==J?{index:e,skip:J}:y}),p.current&&c){const y=`translateY(${c.offset}px)`;p.current.style.transform=y}},de=e=>{if(d.current=e,d.current&&p.current){const c=-1*o.headerHeight;p.current.style.transform=`translateY(${c}px)`;const v=N.dateInRange(h,a,u),V=s.skip(v,a);d.current.scrollToIndex(V)}},d=t.useRef(null),I=t.useRef(null);t.useImperativeHandle(I,()=>({get element(){return m.current},get virtualization(){return d.current},focusActiveDate:A,blurActiveDate:le})),t.useImperativeHandle(C,()=>I.current);const m=t.useRef(null),p=t.useRef(null),q=t.useRef(n),_=t.useRef(h),H=t.useRef(!1),B=t.useRef(!0),O=t.useRef(!1),D=t.useRef(void 0),[Y,me]=t.useState(()=>{const e=s.skip(h,a);return{skip:e,index:e}});t.useEffect(()=>{if(O.current=!1,D.current!==void 0&&d.current){const e=!!(Z&&B.current);d.current[e?"animateToIndex":"scrollToIndex"](D.current)}H.current&&A(),q.current=n,D.current=void 0});const fe=De.useInternationalization(),he=new Ne.WeekNamesService(fe).getWeekNames(T,X),g=w&&w.uCalendar;let U=0,x=0,L=1;o&&(U=(n===f.CalendarViewEnum.month?o.scrollableContentHeight:o.scrollableYearContentHeight)-o.viewHeight(n),x=-1*o.headerHeight,L=o.viewHeight(n)||1);const ke=q.current!==n,S=N.dateInRange(h,a,u),z=ke?s.skip(S,a):Y.skip,$=s.total(a,u),we=Math.min($-z,i),ge=s.addToDate(a,z),ve=s.addToDate(a,Y.index),K=Array.from({length:s.rowLength(T)},(e,c)=>c),G=n!==q.current;B.current=!G,(G||!b.isEqualDate(_.current,S)||O.current||!j||j())&&(D.current=s.skip(S,a)),_.current=S;const ye=r.classNames(r.uCalendar.view({c:g,month:n===f.CalendarViewEnum.month,year:n===f.CalendarViewEnum.year,decade:n===f.CalendarViewEnum.decade,century:n===f.CalendarViewEnum.century})),Ce=t.createElement("table",{className:r.classNames(r.uCalendar.table({c:g})),ref:p,role:"grid",tabIndex:k!=null?k:0,"aria-activedescendant":M+h.getTime()},t.createElement("colgroup",null,K.map(e=>t.createElement("col",{key:e}))),s.datesList(ge,we).map(e=>t.createElement(Ve.View,{key:e.getTime(),activeView:n,viewDate:e,min:a,max:u,cellUID:M,focusedDate:h,cell:ee,selectedDate:ne,showWeekNumbers:T,onChange:F,bus:W,service:s,weekCell:ae,showOtherMonthDays:re,unstyled:w}))),pe=n===f.CalendarViewEnum.month?t.createElement("table",{key:"calendar-view-list-weekdays",className:r.classNames(r.uCalendar.table({c:g,weekdays:!0})),role:"grid",tabIndex:k},t.createElement("colgroup",null,K.map(e=>t.createElement("col",{key:e}))),t.createElement("thead",{className:r.classNames(r.uCalendar.thead({c:g}))},t.createElement("tr",{className:r.classNames(r.uCalendar.tr({c:g}))},he.map(e=>t.createElement("th",{key:e,className:r.classNames(r.uCalendar.th({c:g}))},e))))):null,Re=t.createElement(t.Fragment,null,t.createElement(be.Header,{key:"calendar-view-list-header",currentDate:ve,min:a,max:u,activeView:n,bus:W,service:s,headerTitle:se,header:ce,unstyled:w,commands:t.createElement(Te.TodayCommand,{min:a,max:u,onClick:ie,disabled:!oe,tabIndex:k,unstyled:w})}),pe,t.createElement(Se.Virtualization,{key:"calendar-view-list-content",skip:z,take:i,total:$,itemHeight:L,topOffset:x,bottomOffset:U,scrollOffsetSize:x,maxScrollDifference:L,onScroll:te,onScrollAction:ue,onMount:e=>!d.current&&de(e),tabIndex:k,unstyled:w},Ce));return t.createElement("div",{ref:m,className:ye},o.didCalculate?Re:null)});Q.displayName="KendoReactViewList";const He=Q;exports.ViewList=He;exports.viewListDefaultProps=R;