@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,13 +5,18 @@
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 { CalendarNavigationItemProps } from './CalendarNavigationItem.js';
10
9
  import { DOMService } from '../services/index.js';
11
- import { Virtualization } from '../../virtualization/Virtualization.js';
10
+ import { VirtualizationHandle } from '../../virtualization/Virtualization.js';
12
11
  import { CalendarViewEnum, ViewService } from '../models/index.js';
13
12
  import { DateInputsClassStructure } from '@progress/kendo-react-common';
14
13
  import * as React from 'react';
14
+ /**
15
+ * @hidden
16
+ */
17
+ export interface NavigationHandle {
18
+ virtualization: VirtualizationHandle | null;
19
+ }
15
20
  /**
16
21
  * @hidden
17
22
  */
@@ -19,7 +24,7 @@ export interface NavigationEventArguments {
19
24
  syntheticEvent: React.SyntheticEvent<any>;
20
25
  nativeEvent?: any;
21
26
  value: Date;
22
- target: Navigation;
27
+ target: NavigationHandle;
23
28
  }
24
29
  /**
25
30
  * @hidden
@@ -47,39 +52,14 @@ export interface NavigationState {
47
52
  /**
48
53
  * @hidden
49
54
  */
50
- export declare class Navigation extends React.Component<NavigationProps, NavigationState> {
51
- static propTypes: {
52
- activeView: PropTypes.Validator<number>;
53
- focusedDate: PropTypes.Validator<Date>;
54
- max: PropTypes.Validator<Date>;
55
- min: PropTypes.Validator<Date>;
56
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
57
- take: PropTypes.Requireable<number>;
58
- tabIndex: PropTypes.Requireable<number>;
59
- };
60
- static defaultProps: {
61
- take: number;
62
- };
63
- virtualization: Virtualization | null;
64
- private list;
65
- private itemHeight;
66
- private topOffset;
67
- private maxViewHeight;
68
- private bottomOffset;
69
- private lastView;
70
- private indexToScroll?;
71
- private lastFocus;
72
- protected get take(): number;
73
- constructor(props: NavigationProps);
74
- /**
75
- * @hidden
76
- */
77
- componentDidUpdate(_prevProps: NavigationProps, _prevState: NavigationState): void;
78
- render(): React.JSX.Element;
79
- protected handleVirtualizationMount: (virtualization: Virtualization) => void;
80
- protected buildNavigationItem: (date: Date) => React.ReactNode;
81
- protected calculateHeights: () => void;
82
- protected getTake(skip: number, total: number): number;
83
- private handleDateChange;
84
- private handleScrollAction;
85
- }
55
+ export declare const navigationDefaultProps: {
56
+ take: number;
57
+ };
58
+ /**
59
+ * @hidden
60
+ */
61
+ export type Navigation = NavigationHandle;
62
+ /**
63
+ * @hidden
64
+ */
65
+ export declare const Navigation: React.ForwardRefExoticComponent<NavigationProps & React.RefAttributes<NavigationHandle | 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 O=require("react"),r=require("prop-types"),v=require("@progress/kendo-date-math"),T=require("./CalendarNavigationItem.js"),k=require("../../utils.js"),w=require("../../virtualization/Virtualization.js"),c=require("@progress/kendo-react-common");function V(p){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const e in p)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(p,e);Object.defineProperty(a,e,n.get?n:{enumerable:!0,get:()=>p[e]})}}return a.default=p,Object.freeze(a)}const l=V(O),C=30,d=class d extends l.Component{constructor(a){super(a),this.virtualization=null,this.list=null,this.itemHeight=0,this.topOffset=0,this.maxViewHeight=0,this.bottomOffset=0,this.handleVirtualizationMount=t=>{if(this.virtualization=t,this.virtualization&&this.list){this.list.style.transform=`translateY(${this.topOffset}px)`;const i=k.dateInRange(this.props.focusedDate,this.props.min,this.props.max),s=this.props.service.skip(i,this.props.min);this.virtualization.scrollToIndex(s)}},this.buildNavigationItem=t=>{const i=this.props.service.navigationTitle(t),s=this.props.service.isRangeStart(t),o=`kendo-react-calendar-nav-item-${t.getTime()}`,h={text:i,value:t,isRangeStart:s,view:this.props.activeView,onClick:this.handleDateChange};return this.props.navigationItem?l.createElement(this.props.navigationItem,{...h,key:o},i):l.createElement(T.CalendarNavigationItem,{...h,key:o},i)},this.calculateHeights=()=>{const t=this.props.dom.calendarHeight;this.itemHeight=this.props.dom.navigationItemHeight||1,this.maxViewHeight=this.props.dom.monthViewHeight,this.topOffset=(t-this.itemHeight)/2,this.bottomOffset=t-this.itemHeight},this.handleDateChange=(t,i)=>{const{onChange:s}=this.props;if(s&&i){const o={value:v.cloneDate(t),target:this,nativeEvent:i&&i.nativeEvent,syntheticEvent:i};s.call(void 0,o)}},this.handleScrollAction=({scrollAction:t,pageAction:i})=>{const s=i?i.skip:this.state.skip;if(this.state.skip!==s&&this.setState({skip:s}),this.list&&t){const o=`translateY(${t.offset}px)`;this.list.style.transform=o}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate;const e=this.props.service.skip(this.props.focusedDate,this.props.min),n=this.props.service.total(this.props.min,this.props.max);this.state={skip:e-this.getTake(e,n)>0?e:0}}get take(){return this.props.take!==void 0?this.props.take:d.defaultProps.take}componentDidUpdate(a,e){this.indexToScroll!==void 0&&this.virtualization&&this.virtualization.scrollToIndex(this.indexToScroll),this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.indexToScroll=void 0}render(){const{activeView:a,min:e,max:n,service:t,unstyled:i}=this.props;this.calculateHeights();const s=i&&i.uCalendar,o=this.lastView!==a,h=k.dateInRange(this.props.focusedDate,e,n),m=o?t.skip(h,e):this.state.skip,g=t.total(e,n),x=this.getTake(m,g),D=t.addToDate(e,m),b=t.datesList(D,x);(a!==this.lastView||!v.isEqual(h,this.lastFocus))&&(this.indexToScroll=t.skip(h,e));const S=l.createElement(w.Virtualization,{skip:m,take:this.take,total:g,itemHeight:this.itemHeight,topOffset:this.topOffset,bottomOffset:this.bottomOffset,onScroll:this.props.onScroll,maxScrollDifference:this.maxViewHeight,onScrollAction:this.handleScrollAction,onMount:u=>!this.virtualization&&this.handleVirtualizationMount(u),tabIndex:this.props.tabIndex,unstyled:i},l.createElement("ul",{ref:u=>{this.list=u},className:c.classNames(c.uCalendar.ul({c:s}))},b.map(u=>this.buildNavigationItem(u))));return l.createElement("div",{className:c.classNames(c.uCalendar.navigation({c:s}))},l.createElement("span",{className:c.classNames(c.uCalendar.navigationHighlight({c:s}))}),this.props.dom.didCalculate?S:null)}getTake(a,e){return Math.min(e-a,this.take)}};d.propTypes={activeView:r.number.isRequired,focusedDate:r.instanceOf(Date).isRequired,max:r.instanceOf(Date).isRequired,min:r.instanceOf(Date).isRequired,onChange:r.func,take:r.number,tabIndex:r.number},d.defaultProps={take:C};let f=d;exports.Navigation=f;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react"),x=require("@progress/kendo-date-math"),Z=require("./CalendarNavigationItem.js"),O=require("../../utils.js"),tt=require("../../virtualization/Virtualization.js"),m=require("@progress/kendo-react-common");function et(l){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const c in l)if(c!=="default"){const r=Object.getOwnPropertyDescriptor(l,c);Object.defineProperty(f,c,r.get?r:{enumerable:!0,get:()=>l[c]})}}return f.default=l,Object.freeze(f)}const e=et(X),nt=30,V={take:nt},q=e.forwardRef((l,f)=>{const{take:c=V.take,activeView:r,dom:d,focusedDate:g,max:p,min:o,onScroll:M,onChange:H,service:i,navigationItem:T,tabIndex:z,unstyled:R}=l,P=(t,n)=>{if(H&&n){const a={value:x.cloneDate(t),target:I.current,nativeEvent:n==null?void 0:n.nativeEvent,syntheticEvent:n};H(a)}},j=({scrollAction:t,pageAction:n})=>{const a=n?n.skip:void 0;if(a!==void 0&&B(s=>s.skip!==a?{skip:a}:s),v.current&&t){const s=`translateY(${t.offset}px)`;v.current.style.transform=s}},_=t=>{if(u.current=t,u.current&&v.current){const n=d.calendarHeight,a=d.navigationItemHeight||1,s=(n-a)/2;v.current.style.transform=`translateY(${s}px)`;const h=O.dateInRange(g,o,p),W=i.skip(h,o);u.current.scrollToIndex(W)}},$=t=>{const n=i.navigationTitle(t),a=i.isRangeStart(t),s=`kendo-react-calendar-nav-item-${t.getTime()}`,h={text:n,value:t,isRangeStart:a,view:r,onClick:P};return T?e.createElement(T,{...h,key:s},n):e.createElement(Z.CalendarNavigationItem,{...h,key:s},n)},u=e.useRef(null),I=e.useRef(null);e.useImperativeHandle(I,()=>({get virtualization(){return u.current}})),e.useImperativeHandle(f,()=>I.current);const v=e.useRef(null),N=e.useRef(r),E=e.useRef(g),k=e.useRef(void 0),[Y,B]=e.useState(()=>{const t=i.skip(g,o),n=i.total(o,p),a=Math.min(n-t,c);return{skip:t-a>0?t:0}});e.useEffect(()=>{k.current!==void 0&&u.current&&u.current.scrollToIndex(k.current),N.current=r,E.current=g,k.current=void 0});const b=d.calendarHeight,C=d.navigationItemHeight||1,F=d.monthViewHeight,K=(b-C)/2,L=b-C,S=R&&R.uCalendar,U=N.current!==r,D=O.dateInRange(g,o,p),y=U?i.skip(D,o):Y.skip,w=i.total(o,p),A=Math.min(w-y,c),G=i.addToDate(o,y),J=i.datesList(G,A);(r!==N.current||!x.isEqual(D,E.current))&&(k.current=i.skip(D,o));const Q=e.createElement(tt.Virtualization,{skip:y,take:c,total:w,itemHeight:C,topOffset:K,bottomOffset:L,onScroll:M,maxScrollDifference:F,onScrollAction:j,onMount:t=>!u.current&&_(t),tabIndex:z,unstyled:R},e.createElement("ul",{ref:v,className:m.classNames(m.uCalendar.ul({c:S}))},J.map(t=>$(t))));return e.createElement("div",{className:m.classNames(m.uCalendar.navigation({c:S}))},e.createElement("span",{className:m.classNames(m.uCalendar.navigationHighlight({c:S}))}),d.didCalculate?Q:null)});q.displayName="KendoReactNavigation";const at=q;exports.Navigation=at;exports.navigationDefaultProps=V;
@@ -5,115 +5,103 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as n from "react";
9
- import r from "prop-types";
10
- import { cloneDate as T, isEqual as V } from "@progress/kendo-date-math";
11
- import { CalendarNavigationItem as H } from "./CalendarNavigationItem.mjs";
12
- import { dateInRange as v } from "../../utils.mjs";
13
- import { Virtualization as S } from "../../virtualization/Virtualization.mjs";
14
- import { classNames as d, uCalendar as u } from "@progress/kendo-react-common";
15
- const I = 30, p = class p extends n.Component {
16
- constructor(o) {
17
- super(o), this.virtualization = null, this.list = null, this.itemHeight = 0, this.topOffset = 0, this.maxViewHeight = 0, this.bottomOffset = 0, this.handleVirtualizationMount = (t) => {
18
- if (this.virtualization = t, this.virtualization && this.list) {
19
- this.list.style.transform = `translateY(${this.topOffset}px)`;
20
- const i = v(this.props.focusedDate, this.props.min, this.props.max), s = this.props.service.skip(i, this.props.min);
21
- this.virtualization.scrollToIndex(s);
22
- }
23
- }, this.buildNavigationItem = (t) => {
24
- const i = this.props.service.navigationTitle(t), s = this.props.service.isRangeStart(t), a = `kendo-react-calendar-nav-item-${t.getTime()}`, h = {
25
- text: i,
26
- value: t,
27
- isRangeStart: s,
28
- view: this.props.activeView,
29
- onClick: this.handleDateChange
8
+ import * as e from "react";
9
+ import { isEqual as W, cloneDate as X } from "@progress/kendo-date-math";
10
+ import { CalendarNavigationItem as Z } from "./CalendarNavigationItem.mjs";
11
+ import { dateInRange as y } from "../../utils.mjs";
12
+ import { Virtualization as tt } from "../../virtualization/Virtualization.mjs";
13
+ import { classNames as C, uCalendar as E } from "@progress/kendo-react-common";
14
+ const et = 30, nt = {
15
+ take: et
16
+ }, V = e.forwardRef((M, z) => {
17
+ const {
18
+ take: p = nt.take,
19
+ activeView: l,
20
+ dom: c,
21
+ focusedDate: u,
22
+ max: f,
23
+ min: i,
24
+ onScroll: O,
25
+ onChange: N,
26
+ service: o,
27
+ navigationItem: S,
28
+ tabIndex: b,
29
+ unstyled: v
30
+ } = M, $ = (t, n) => {
31
+ if (N && n) {
32
+ const a = {
33
+ value: X(t),
34
+ target: h.current,
35
+ nativeEvent: n == null ? void 0 : n.nativeEvent,
36
+ syntheticEvent: n
30
37
  };
31
- return this.props.navigationItem ? /* @__PURE__ */ n.createElement(this.props.navigationItem, { ...h, key: a }, i) : /* @__PURE__ */ n.createElement(H, { ...h, key: a }, i);
32
- }, this.calculateHeights = () => {
33
- const t = this.props.dom.calendarHeight;
34
- this.itemHeight = this.props.dom.navigationItemHeight || 1, this.maxViewHeight = this.props.dom.monthViewHeight, this.topOffset = (t - this.itemHeight) / 2, this.bottomOffset = t - this.itemHeight;
35
- }, this.handleDateChange = (t, i) => {
36
- const { onChange: s } = this.props;
37
- if (s && i) {
38
- const a = {
39
- value: T(t),
40
- target: this,
41
- nativeEvent: i && i.nativeEvent,
42
- syntheticEvent: i
43
- };
44
- s.call(void 0, a);
45
- }
46
- }, this.handleScrollAction = ({ scrollAction: t, pageAction: i }) => {
47
- const s = i ? i.skip : this.state.skip;
48
- if (this.state.skip !== s && this.setState({ skip: s }), this.list && t) {
49
- const a = `translateY(${t.offset}px)`;
50
- this.list.style.transform = a;
38
+ N(a);
39
+ }
40
+ }, q = ({ scrollAction: t, pageAction: n }) => {
41
+ const a = n ? n.skip : void 0;
42
+ if (a !== void 0 && F((s) => s.skip !== a ? { skip: a } : s), m.current && t) {
43
+ const s = `translateY(${t.offset}px)`;
44
+ m.current.style.transform = s;
45
+ }
46
+ }, P = (t) => {
47
+ if (r.current = t, r.current && m.current) {
48
+ const n = c.calendarHeight, a = c.navigationItemHeight || 1, s = (n - a) / 2;
49
+ m.current.style.transform = `translateY(${s}px)`;
50
+ const g = y(u, i, f), Q = o.skip(g, i);
51
+ r.current.scrollToIndex(Q);
52
+ }
53
+ }, Y = (t) => {
54
+ const n = o.navigationTitle(t), a = o.isRangeStart(t), s = `kendo-react-calendar-nav-item-${t.getTime()}`, g = {
55
+ text: n,
56
+ value: t,
57
+ isRangeStart: a,
58
+ view: l,
59
+ onClick: $
60
+ };
61
+ return S ? /* @__PURE__ */ e.createElement(S, { ...g, key: s }, n) : /* @__PURE__ */ e.createElement(Z, { ...g, key: s }, n);
62
+ }, r = e.useRef(null), h = e.useRef(null);
63
+ e.useImperativeHandle(
64
+ h,
65
+ () => ({
66
+ get virtualization() {
67
+ return r.current;
51
68
  }
52
- }, this.lastView = this.props.activeView, this.lastFocus = this.props.focusedDate;
53
- const e = this.props.service.skip(this.props.focusedDate, this.props.min), c = this.props.service.total(this.props.min, this.props.max);
54
- this.state = {
55
- skip: e - this.getTake(e, c) > 0 ? e : 0
69
+ })
70
+ ), e.useImperativeHandle(z, () => h.current);
71
+ const m = e.useRef(null), k = e.useRef(l), T = e.useRef(u), d = e.useRef(void 0), [B, F] = e.useState(() => {
72
+ const t = o.skip(u, i), n = o.total(i, f), a = Math.min(n - t, p);
73
+ return {
74
+ skip: t - a > 0 ? t : 0
56
75
  };
57
- }
58
- get take() {
59
- return this.props.take !== void 0 ? this.props.take : p.defaultProps.take;
60
- }
61
- /**
62
- * @hidden
63
- */
64
- componentDidUpdate(o, e) {
65
- this.indexToScroll !== void 0 && this.virtualization && this.virtualization.scrollToIndex(this.indexToScroll), this.lastView = this.props.activeView, this.lastFocus = this.props.focusedDate, this.indexToScroll = void 0;
66
- }
67
- render() {
68
- const { activeView: o, min: e, max: c, service: t, unstyled: i } = this.props;
69
- this.calculateHeights();
70
- const s = i && i.uCalendar, a = this.lastView !== o, h = v(this.props.focusedDate, e, c), m = a ? t.skip(h, e) : this.state.skip, f = t.total(e, c), k = this.getTake(m, f), x = t.addToDate(e, m), D = t.datesList(x, k);
71
- (o !== this.lastView || !V(h, this.lastFocus)) && (this.indexToScroll = t.skip(h, e));
72
- const w = /* @__PURE__ */ n.createElement(
73
- S,
74
- {
75
- skip: m,
76
- take: this.take,
77
- total: f,
78
- itemHeight: this.itemHeight,
79
- topOffset: this.topOffset,
80
- bottomOffset: this.bottomOffset,
81
- onScroll: this.props.onScroll,
82
- maxScrollDifference: this.maxViewHeight,
83
- onScrollAction: this.handleScrollAction,
84
- onMount: (l) => !this.virtualization && this.handleVirtualizationMount(l),
85
- tabIndex: this.props.tabIndex,
86
- unstyled: i
87
- },
88
- /* @__PURE__ */ n.createElement(
89
- "ul",
90
- {
91
- ref: (l) => {
92
- this.list = l;
93
- },
94
- className: d(u.ul({ c: s }))
95
- },
96
- D.map((l) => this.buildNavigationItem(l))
97
- )
98
- );
99
- return /* @__PURE__ */ n.createElement("div", { className: d(u.navigation({ c: s })) }, /* @__PURE__ */ n.createElement("span", { className: d(u.navigationHighlight({ c: s })) }), this.props.dom.didCalculate ? w : null);
100
- }
101
- getTake(o, e) {
102
- return Math.min(e - o, this.take);
103
- }
104
- };
105
- p.propTypes = {
106
- activeView: r.number.isRequired,
107
- focusedDate: r.instanceOf(Date).isRequired,
108
- max: r.instanceOf(Date).isRequired,
109
- min: r.instanceOf(Date).isRequired,
110
- onChange: r.func,
111
- take: r.number,
112
- tabIndex: r.number
113
- }, p.defaultProps = {
114
- take: I
115
- };
116
- let g = p;
76
+ });
77
+ e.useEffect(() => {
78
+ d.current !== void 0 && r.current && r.current.scrollToIndex(d.current), k.current = l, T.current = u, d.current = void 0;
79
+ });
80
+ const w = c.calendarHeight, R = c.navigationItemHeight || 1, K = c.monthViewHeight, L = (w - R) / 2, U = w - R, I = v && v.uCalendar, _ = k.current !== l, H = y(u, i, f), x = _ ? o.skip(H, i) : B.skip, D = o.total(i, f), j = Math.min(D - x, p), A = o.addToDate(i, x), G = o.datesList(A, j);
81
+ (l !== k.current || !W(H, T.current)) && (d.current = o.skip(H, i));
82
+ const J = /* @__PURE__ */ e.createElement(
83
+ tt,
84
+ {
85
+ skip: x,
86
+ take: p,
87
+ total: D,
88
+ itemHeight: R,
89
+ topOffset: L,
90
+ bottomOffset: U,
91
+ onScroll: O,
92
+ maxScrollDifference: K,
93
+ onScrollAction: q,
94
+ onMount: (t) => !r.current && P(t),
95
+ tabIndex: b,
96
+ unstyled: v
97
+ },
98
+ /* @__PURE__ */ e.createElement("ul", { ref: m, className: C(E.ul({ c: I })) }, G.map((t) => Y(t)))
99
+ );
100
+ return /* @__PURE__ */ e.createElement("div", { className: C(E.navigation({ c: I })) }, /* @__PURE__ */ e.createElement("span", { className: C(E.navigationHighlight({ c: I })) }), c.didCalculate ? J : null);
101
+ });
102
+ V.displayName = "KendoReactNavigation";
103
+ const ct = V;
117
104
  export {
118
- g as Navigation
105
+ ct as Navigation,
106
+ nt as navigationDefaultProps
119
107
  };
@@ -5,7 +5,6 @@
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
9
  import { HeaderEventArguments } from './Header.js';
11
10
  import * as React from 'react';
@@ -20,27 +19,11 @@ export interface TodayCommandProps {
20
19
  tabIndex?: number;
21
20
  unstyled?: DateInputsClassStructure;
22
21
  }
23
- export declare class TodayCommand extends React.Component<TodayCommandProps> {
24
- /**
25
- * The prop types for the TodayCommand component.
26
- */
27
- static propTypes: {
28
- max: PropTypes.Validator<Date>;
29
- min: PropTypes.Validator<Date>;
30
- onClick: PropTypes.Requireable<(...args: any[]) => any>;
31
- disabled: PropTypes.Requireable<boolean>;
32
- };
33
- /**
34
- * The default props for the TodayCommand component.
35
- */
36
- static defaultProps: {
37
- min: Date;
38
- max: Date;
39
- };
40
- protected get min(): Date;
41
- protected get max(): Date;
42
- private localization;
43
- protected get todayIsInRange(): boolean;
44
- private handleClick;
45
- render(): React.JSX.Element;
46
- }
22
+ /**
23
+ * @hidden
24
+ */
25
+ export declare const todayCommandDefaultProps: {
26
+ min: Date;
27
+ max: Date;
28
+ };
29
+ export declare const TodayCommand: (props: TodayCommandProps) => React.JSX.Element;
@@ -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 f=require("react"),o=require("prop-types"),p=require("@progress/kendo-react-intl"),l=require("@progress/kendo-react-common"),y=require("@progress/kendo-react-buttons"),u=require("@progress/kendo-date-math"),c=require("../../messages/index.js"),n=require("../../utils.js");function b(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,a.get?a:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const d=b(f),s=class s extends d.Component{constructor(){super(...arguments),this.localization=null,this.handleClick=e=>{if(this.todayIsInRange&&this.props.onClick){const t={syntheticEvent:e,nativeEvent:e.nativeEvent,value:n.dateInRange(n.getToday(),this.min,this.max),target:this,isTodayClick:!0};this.props.onClick.call(void 0,t)}}}get min(){return this.props.min!==void 0?this.props.min:s.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:s.defaultProps.max}get todayIsInRange(){return n.isInRange(n.getToday(),u.getDate(this.min),u.getDate(this.max))}render(){const{disabled:e,tabIndex:t,unstyled:a}=this.props,m=a&&a.uCalendar;this.localization=p.provideLocalizationService(this);const g=this.localization.toLanguageString(c.today,c.messages[c.today]),h=l.classNames(l.uCalendar.today({c:m,disabled:e}));return d.createElement(y.Button,{className:h,onClick:this.handleClick,tabIndex:t,fillMode:"flat",themeColor:"base",role:"link"},g)}};s.propTypes={max:o.instanceOf(Date).isRequired,min:o.instanceOf(Date).isRequired,onClick:o.func,disabled:o.bool},s.defaultProps={min:n.MIN_DATE,max:n.MAX_DATE};let r=s;p.registerForLocalization(r);exports.TodayCommand=r;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),D=require("@progress/kendo-react-intl"),i=require("@progress/kendo-react-common"),I=require("@progress/kendo-react-buttons"),d=require("@progress/kendo-date-math"),s=require("../../messages/index.js"),n=require("../../utils.js");function R(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const T=R(p),c={min:n.MIN_DATE,max:n.MAX_DATE},q=e=>{const{min:a=c.min,max:t=c.max,onClick:o,disabled:u,tabIndex:m,unstyled:r}=e,g=l=>{if(n.isInRange(n.getToday(),d.getDate(a),d.getDate(t))&&o){const k={syntheticEvent:l,nativeEvent:l.nativeEvent,value:n.dateInRange(n.getToday(),a,t),target:null,isTodayClick:!0};o(k)}},y=D.useLocalization(),f=r&&r.uCalendar,C=y.toLanguageString(s.today,s.messages[s.today]),b=i.classNames(i.uCalendar.today({c:f,disabled:u}));return T.createElement(I.Button,{className:b,onClick:g,tabIndex:m,fillMode:"flat",themeColor:"base",role:"link"},C)};exports.TodayCommand=q;exports.todayCommandDefaultProps=c;
@@ -5,67 +5,50 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as r from "react";
9
- import e from "prop-types";
10
- import { provideLocalizationService as h, registerForLocalization as u } from "@progress/kendo-react-intl";
11
- import { classNames as f, uCalendar as g } from "@progress/kendo-react-common";
12
- import { Button as x } from "@progress/kendo-react-buttons";
13
- import { getDate as n } from "@progress/kendo-date-math";
14
- import { today as l, messages as v } from "../../messages/index.mjs";
15
- import { dateInRange as C, getToday as m, MAX_DATE as k, MIN_DATE as I, isInRange as y } from "../../utils.mjs";
16
- const t = class t extends r.Component {
17
- constructor() {
18
- super(...arguments), this.localization = null, this.handleClick = (i) => {
19
- if (this.todayIsInRange && this.props.onClick) {
20
- const s = {
21
- syntheticEvent: i,
22
- nativeEvent: i.nativeEvent,
23
- value: C(m(), this.min, this.max),
24
- target: this,
25
- isTodayClick: !0
26
- };
27
- this.props.onClick.call(void 0, s);
28
- }
29
- };
30
- }
31
- get min() {
32
- return this.props.min !== void 0 ? this.props.min : t.defaultProps.min;
33
- }
34
- get max() {
35
- return this.props.max !== void 0 ? this.props.max : t.defaultProps.max;
36
- }
37
- get todayIsInRange() {
38
- return y(m(), n(this.min), n(this.max));
39
- }
40
- render() {
41
- const { disabled: i, tabIndex: s, unstyled: o } = this.props, p = o && o.uCalendar;
42
- this.localization = h(this);
43
- const c = this.localization.toLanguageString(l, v[l]), d = f(g.today({ c: p, disabled: i }));
44
- return /* @__PURE__ */ r.createElement(
45
- x,
46
- {
47
- className: d,
48
- onClick: this.handleClick,
49
- tabIndex: s,
50
- fillMode: "flat",
51
- themeColor: "base",
52
- role: "link"
53
- },
54
- c
55
- );
56
- }
8
+ import * as I from "react";
9
+ import { useLocalization as k } from "@progress/kendo-react-intl";
10
+ import { classNames as v, uCalendar as x } from "@progress/kendo-react-common";
11
+ import { Button as R } from "@progress/kendo-react-buttons";
12
+ import { getDate as s } from "@progress/kendo-date-math";
13
+ import { today as m, messages as T } from "../../messages/index.mjs";
14
+ import { MIN_DATE as D, MAX_DATE as E, isInRange as M, getToday as r, dateInRange as N } from "../../utils.mjs";
15
+ const i = {
16
+ min: D,
17
+ max: E
18
+ }, P = (l) => {
19
+ const {
20
+ min: a = i.min,
21
+ max: o = i.max,
22
+ onClick: t,
23
+ disabled: c,
24
+ tabIndex: d,
25
+ unstyled: e
26
+ } = l, f = (n) => {
27
+ if (M(r(), s(a), s(o)) && t) {
28
+ const p = {
29
+ syntheticEvent: n,
30
+ nativeEvent: n.nativeEvent,
31
+ value: N(r(), a, o),
32
+ target: null,
33
+ isTodayClick: !0
34
+ };
35
+ t(p);
36
+ }
37
+ }, g = k(), u = e && e.uCalendar, C = g.toLanguageString(m, T[m]), y = v(x.today({ c: u, disabled: c }));
38
+ return /* @__PURE__ */ I.createElement(
39
+ R,
40
+ {
41
+ className: y,
42
+ onClick: f,
43
+ tabIndex: d,
44
+ fillMode: "flat",
45
+ themeColor: "base",
46
+ role: "link"
47
+ },
48
+ C
49
+ );
57
50
  };
58
- t.propTypes = {
59
- max: e.instanceOf(Date).isRequired,
60
- min: e.instanceOf(Date).isRequired,
61
- onClick: e.func,
62
- disabled: e.bool
63
- }, t.defaultProps = {
64
- min: I,
65
- max: k
66
- };
67
- let a = t;
68
- u(a);
69
51
  export {
70
- a as TodayCommand
52
+ P as TodayCommand,
53
+ i as todayCommandDefaultProps
71
54
  };
@@ -5,10 +5,9 @@
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 { CalendarCellProps } from './CalendarCell.js';
10
9
  import { CalendarWeekCellProps } from './CalendarWeekCell.js';
11
- import { CalendarViewEnum, CellContext, SelectionRange, SelectionRangeEnd, ViewService } from '../models/index.js';
10
+ import { CalendarViewEnum, SelectionRange, SelectionRangeEnd, ViewService } from '../models/index.js';
12
11
  import { BusViewService } from '../services/index.js';
13
12
  import { WeekDaysFormat } from '../models/WeekDaysFormat';
14
13
  import { DateInputsClassStructure } from '@progress/kendo-react-common';
@@ -20,7 +19,7 @@ export interface ViewEventArguments {
20
19
  syntheticEvent: React.SyntheticEvent<any>;
21
20
  nativeEvent?: any;
22
21
  value: Date;
23
- target: View;
22
+ target: any;
24
23
  }
25
24
  /**
26
25
  * @hidden
@@ -60,42 +59,12 @@ export interface ViewProps {
60
59
  /**
61
60
  * @hidden
62
61
  */
63
- export declare class View extends React.Component<ViewProps, {}> {
64
- static propTypes: {
65
- activeRangeEnd: PropTypes.Requireable<string | null>;
66
- activeView: PropTypes.Validator<number>;
67
- cellUID: PropTypes.Validator<string>;
68
- direction: PropTypes.Requireable<string>;
69
- focusedDate: PropTypes.Validator<Date>;
70
- max: PropTypes.Validator<Date>;
71
- min: PropTypes.Validator<Date>;
72
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
73
- selectedDate: PropTypes.Requireable<NonNullable<Date | (Date | null | undefined)[] | null | undefined>>;
74
- showWeekNumbers: PropTypes.Requireable<boolean>;
75
- showOtherMonthDays: PropTypes.Requireable<boolean>;
76
- viewDate: PropTypes.Validator<Date>;
77
- };
78
- static defaultProps: {
79
- direction: string;
80
- selectedDate: Date;
81
- showWeekNumbers: boolean;
82
- };
83
- private intl;
84
- private weekService;
85
- protected get min(): Date;
86
- protected get max(): Date;
87
- protected get isHorizontal(): boolean;
88
- protected get isMonthView(): boolean;
89
- protected get weekNumber(): boolean;
90
- protected get selectedDate(): Date | Date[] | null;
91
- render(): React.JSX.Element;
92
- protected buildWeekNumber: (row: any, idx: number) => React.JSX.Element;
93
- protected buildRow: (row: any) => any;
94
- protected getWeekNumber(date: Date): number | null;
95
- protected firstDate: (row: any) => Date | null;
96
- protected firstWeekDateContext: (rowCtx: CellContext[]) => CellContext | null;
97
- private handleClick;
98
- private handleWeekCellClick;
99
- private handleMouseEnter;
100
- private handleMouseLeave;
101
- }
62
+ export declare const viewDefaultProps: {
63
+ direction: "vertical";
64
+ selectedDate: Date;
65
+ showWeekNumbers: boolean;
66
+ };
67
+ /**
68
+ * @hidden
69
+ */
70
+ export declare const View: (props: ViewProps) => React.JSX.Element;
@@ -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 W=require("react"),r=require("prop-types"),k=require("@progress/kendo-date-math"),y=require("@progress/kendo-react-intl"),R=require("./CalendarCell.js"),M=require("./CalendarWeekCell.js"),v=require("../models/CalendarViewEnum.js"),w=require("../../utils.js"),S=require("../services/WeekNamesService.js"),a=require("@progress/kendo-react-common");function V(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const e in c)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(c,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>c[e]})}}return t.default=c,Object.freeze(t)}const n=V(W),C=(c,t)=>{const e=t;return n.createElement("td",{key:c,role:"gridcell",className:a.classNames(a.uCalendar.td({c:e,isEmpty:!0}))}," ")},h=class h extends n.Component{constructor(){super(...arguments),this.intl=null,this.weekService=null,this.buildWeekNumber=(t,e)=>{if(!this.firstDate(t))return C(`week-cell-${e}`);const i=this.firstDate(t),l=this.getWeekNumber(i),o=`kendo-react-calendar-week-cell-${l}`,d={value:l,firstDate:i,weekDays:t,unstyled:this.props.unstyled,onClick:this.handleWeekCellClick};return this.props.weekCell?n.createElement(this.props.weekCell,{...d,key:o},l):n.createElement(M.CalendarWeekCell,{...d,key:o},l)},this.buildRow=t=>t.map((e,s)=>{if(!e)return C(s);const i={"aria-selected":e.isSelected},l=`kendo-react-calendar-cell-${e.value.getTime()}`,o={...i,...e,isDisabled:!e.isInRange,view:this.props.activeView,showOtherMonthDays:this.props.showOtherMonthDays,allowReverse:this.props.allowReverse,unstyled:this.props.unstyled,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave};return this.props.cell?n.createElement(this.props.cell,{...o,key:l},e.formattedValue):n.createElement(R.CalendarCell,{...o,key:l},e.formattedValue)}),this.firstDate=t=>{const e=this.firstWeekDateContext(t);return e?e.value:null},this.firstWeekDateContext=t=>{if(!this.weekNumber)return null;let e=0,s=t[e];for(;!s&&e<t.length;)s=t[++e];return s},this.handleClick=(t,e)=>{const{onChange:s}=this.props;if(s&&e){const i={value:k.cloneDate(t),target:this,nativeEvent:e&&e.nativeEvent,syntheticEvent:e};s.call(void 0,i)}},this.handleWeekCellClick=(t,e,s)=>{const{onWeekSelect:i}=this.props,l=e.findIndex(o=>o&&o.value===t);i&&s&&i.call(void 0,t,l,s)},this.handleMouseEnter=t=>{const{onCellEnter:e}=this.props;e&&e.call(void 0,k.cloneDate(t))},this.handleMouseLeave=t=>{const{onCellLeave:e}=this.props;e&&e.call(void 0,k.cloneDate(t))}}get min(){return this.props.min}get max(){return this.props.max}get isHorizontal(){return this.props.direction==="horizontal"}get isMonthView(){return this.props.activeView===v.CalendarViewEnum.month}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===v.CalendarViewEnum.month)}get selectedDate(){return this.props.selectedDate!==void 0?this.props.selectedDate:h.defaultProps.selectedDate}render(){const{service:t,weekDaysFormat:e,cellUID:s,focusedDate:i,bus:l,activeView:o,selectionRange:d,unstyled:D}=this.props,u=D&&D.uCalendar;this.intl=y.provideIntlService(this),this.weekService=new S.WeekNamesService(this.intl);const g=this.weekService.getWeekNames(this.weekNumber,e),N=t.rowLength(this.weekNumber),b=t.title(this.props.viewDate),E=w.getToday(),O=w.setTime(this.props.viewDate,E),q=t.data({cellUID:s,min:this.min,max:this.max,focusedDate:i,isActiveView:!l.canMoveDown(o),selectedDate:this.selectedDate,selectionRange:d,viewDate:O});return n.createElement(n.Fragment,null,this.isMonthView&&this.isHorizontal&&n.createElement("thead",{role:"rowgroup",className:a.classNames(a.uCalendar.thead({c:u}))},n.createElement("tr",{role:"row",className:a.classNames(a.uCalendar.tr({c:u}))},g.map((m,p)=>n.createElement("th",{key:p,className:a.classNames(a.uCalendar.th({c:u}))},m)))),n.createElement("tbody",{role:"rowgroup",className:a.classNames(a.uCalendar.tbody({c:u}))},!this.isHorizontal&&n.createElement("tr",{role:"presentation",className:a.classNames(a.uCalendar.tr({c:u}))},n.createElement("th",{scope:"col",colSpan:N,className:a.classNames(a.uCalendar.caption({c:u}))},b)),q.map((m,p)=>n.createElement("tr",{role:"row",className:a.classNames(a.uCalendar.tr({c:u})),key:p},this.weekNumber&&this.buildWeekNumber(m,p),this.buildRow(m)))))}getWeekNumber(t){return!this.weekNumber||!this.intl?null:k.weekInYear(t,this.intl.firstDay())}};h.propTypes={activeRangeEnd:r.oneOf(["start","end",null]),activeView:r.number.isRequired,cellUID:r.string.isRequired,direction:r.oneOf(["horizontal","vertical"]),focusedDate:r.instanceOf(Date).isRequired,max:r.instanceOf(Date).isRequired,min:r.instanceOf(Date).isRequired,onChange:r.func,selectedDate:r.oneOfType([r.instanceOf(Date),r.arrayOf(r.instanceOf(Date))]),showWeekNumbers:r.bool,showOtherMonthDays:r.bool,viewDate:r.instanceOf(Date).isRequired},h.defaultProps={direction:"vertical",selectedDate:w.getToday(),showWeekNumbers:!1};let f=h;y.registerForIntl(f);exports.View=f;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const se=require("react"),f=require("@progress/kendo-date-math"),ce=require("@progress/kendo-react-intl"),re=require("./CalendarCell.js"),oe=require("./CalendarWeekCell.js"),S=require("../models/CalendarViewEnum.js"),y=require("../../utils.js"),ie=require("../services/WeekNamesService.js"),a=require("@progress/kendo-react-common");function ue(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const c in r)if(c!=="default"){const k=Object.getOwnPropertyDescriptor(r,c);Object.defineProperty(i,c,k.get?k:{enumerable:!0,get:()=>r[c]})}}return i.default=r,Object.freeze(i)}const l=ue(se),O=(r,i)=>{const c=i;return l.createElement("td",{key:r,role:"gridcell",className:a.classNames(a.uCalendar.td({c,isEmpty:!0}))}," ")},w={direction:"vertical",selectedDate:y.getToday(),showWeekNumbers:!1},me=r=>{const{activeRangeEnd:i,activeView:c,bus:k,cellUID:R,direction:I=w.direction,focusedDate:T,weekCell:N,max:P,weekDaysFormat:j,min:z,cell:h,onCellEnter:E,onCellLeave:v,onChange:g,onWeekSelect:p,selectedDate:L=w.selectedDate,selectionRange:_,service:D,showWeekNumbers:$=w.showWeekNumbers,showOtherMonthDays:x,viewDate:b,allowReverse:A,unstyled:C}=r,W=I==="horizontal",B=c===S.CalendarViewEnum.month,d=!!($&&c===S.CalendarViewEnum.month),F=(e,t)=>{if(g&&t){const s={value:f.cloneDate(e),target:null,nativeEvent:t==null?void 0:t.nativeEvent,syntheticEvent:t};g(s)}},H=(e,t,s)=>{const o=t.findIndex(n=>(n==null?void 0:n.value)===e);p&&s&&p(e,o,s)},K=e=>{E&&E(f.cloneDate(e))},U=e=>{v&&v(f.cloneDate(e))},V=ce.useInternationalization(),Y=new ie.WeekNamesService(V),u=C&&C.uCalendar,G=e=>d?f.weekInYear(e,V.firstDay()):null,J=e=>{if(!d)return null;let t=0,s=e[t];for(;!s&&t<e.length;)s=e[++t];return s},q=e=>{const t=J(e);return t?t.value:null},Q=(e,t)=>{if(!q(e))return O(`week-cell-${t}`);const o=q(e),n=G(o),m=`kendo-react-calendar-week-cell-${n}`,M={value:n,firstDate:o,weekDays:e,unstyled:C,onClick:H};return N?l.createElement(N,{...M,key:m},n):l.createElement(oe.CalendarWeekCell,{...M,key:m},n)},X=e=>e.map((t,s)=>{if(!t)return O(s);const o={"aria-selected":t.isSelected},n=`kendo-react-calendar-cell-${t.value.getTime()}`,m={...o,...t,isDisabled:!t.isInRange,view:c,showOtherMonthDays:x,allowReverse:A,activeRangeEnd:i,unstyled:C,onClick:F,onMouseEnter:K,onMouseLeave:U};return h?l.createElement(h,{...m,key:n},t.formattedValue):l.createElement(re.CalendarCell,{...m,key:n},t.formattedValue)}),Z=Y.getWeekNames(d,j),ee=D.rowLength(d),te=D.title(b),ae=y.getToday(),ne=y.setTime(b,ae),le=D.data({cellUID:R,min:z,max:P,focusedDate:T,isActiveView:!k.canMoveDown(c),selectedDate:L,selectionRange:_,viewDate:ne});return l.createElement(l.Fragment,null,B&&W&&l.createElement("thead",{className:a.classNames(a.uCalendar.thead({c:u}))},l.createElement("tr",{role:"row",className:a.classNames(a.uCalendar.tr({c:u}))},Z.map(e=>l.createElement("th",{key:e,className:a.classNames(a.uCalendar.th({c:u}))},e)))),l.createElement("tbody",{className:a.classNames(a.uCalendar.tbody({c:u}))},!W&&l.createElement("tr",{className:a.classNames(a.uCalendar.tr({c:u}))},l.createElement("th",{scope:"col",colSpan:ee,className:a.classNames(a.uCalendar.caption({c:u}))},te)),le.map((e,t)=>{var o,n;const s=(n=(o=e.find(m=>m!=null))==null?void 0:o.value.getTime())!=null?n:t;return l.createElement("tr",{role:"row",className:a.classNames(a.uCalendar.tr({c:u})),key:s},d&&Q(e,t),X(e))})))};exports.View=me;exports.viewDefaultProps=w;