@progress/kendo-react-dateinputs 14.4.1 → 14.5.0-develop.2
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.d.ts +35 -110
- package/calendar/components/Calendar.js +5 -5
- package/calendar/components/Calendar.mjs +288 -313
- package/calendar/components/CalendarCell.d.ts +1 -10
- package/calendar/components/CalendarCell.js +1 -1
- package/calendar/components/CalendarCell.mjs +68 -78
- package/calendar/components/Header.d.ts +10 -23
- package/calendar/components/Header.js +1 -1
- package/calendar/components/Header.mjs +41 -55
- package/calendar/components/HorizontalViewList.d.ts +28 -26
- package/calendar/components/HorizontalViewList.js +1 -1
- package/calendar/components/HorizontalViewList.mjs +112 -102
- package/calendar/components/MultiViewCalendar.d.ts +39 -141
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +331 -373
- package/calendar/components/Navigation.d.ts +19 -39
- package/calendar/components/Navigation.js +1 -1
- package/calendar/components/Navigation.mjs +95 -107
- package/calendar/components/TodayCommand.d.ts +8 -25
- package/calendar/components/TodayCommand.js +1 -1
- package/calendar/components/TodayCommand.mjs +44 -61
- package/calendar/components/View.d.ts +11 -42
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +111 -137
- package/calendar/components/ViewList.d.ts +25 -65
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +207 -225
- package/calendar/services/ScrollSyncService.d.ts +4 -4
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/virtualization/Virtualization.d.ts +25 -63
- package/virtualization/Virtualization.js +1 -1
- 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
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
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:
|
|
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
|
-
|
|
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 {
|
|
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:
|
|
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
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
|
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;
|