@progress/kendo-react-dateinputs 7.5.0-develop.14 → 7.5.0-develop.15

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.
@@ -10,20 +10,20 @@ import * as d from "react";
10
10
  import t from "prop-types";
11
11
  import { provideIntlService as q, provideLocalizationService as H, registerForIntl as j, registerForLocalization as G } from "@progress/kendo-react-intl";
12
12
  import { Keys as k, classNames as X, createPropsContext as J, withIdHOC as Q, withPropsContext as Z } from "@progress/kendo-react-common";
13
- import { isEqualDate as O, cloneDate as u, getDate as f, firstDayOfMonth as W, lastDayOfMonth as ee } from "@progress/kendo-date-math";
14
- import { Button as T } from "@progress/kendo-react-buttons";
15
- import { chevronRightIcon as M, chevronLeftIcon as N } from "@progress/kendo-svg-icons";
13
+ import { isEqualDate as A, cloneDate as u, getDate as f, firstDayOfMonth as W, lastDayOfMonth as ee } from "@progress/kendo-date-math";
14
+ import { Button as M } from "@progress/kendo-react-buttons";
15
+ import { chevronRightIcon as T, chevronLeftIcon as N } from "@progress/kendo-svg-icons";
16
16
  import { Action as y } from "../models/NavigationAction.mjs";
17
17
  import { CalendarViewEnum as E } from "../models/CalendarViewEnum.mjs";
18
18
  import { EMPTY_SELECTIONRANGE as Y } from "../models/SelectionRange.mjs";
19
19
  import { Header as te } from "./Header.mjs";
20
- import { dateInRange as R, getToday as C, viewInRange as P, nullable as D, MIN_DATE as se, MAX_DATE as ie, isInRange as A } from "../../utils.mjs";
20
+ import { dateInRange as R, getToday as C, viewInRange as P, nullable as D, MIN_DATE as se, MAX_DATE as ie, isInRange as I } from "../../utils.mjs";
21
21
  import { prevView as S, messages as B, nextView as L } from "../../messages/index.mjs";
22
22
  import { BusViewService as ae } from "../services/BusViewService.mjs";
23
23
  import { NavigationService as ne } from "../services/NavigationService.mjs";
24
24
  import { HorizontalViewList as x } from "./HorizontalViewList.mjs";
25
- import { TodayCommand as re } from "./TodayCommand.mjs";
26
- const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Date && !Array.isArray(a) && A(f(a), o, i) ? f(a) : null, _ = (o = m.defaultProps.min, i = m.defaultProps.max, a) => Array.isArray(a) ? a.filter((h) => A(h, o, i)).map((h) => f(h)) : null, K = (o) => typeof o == "object" && !(o instanceof Date) && o !== null && !Array.isArray(o) ? o : Y, z = (o, i, a) => o || i && i[0] || a && a.start, le = (o, i) => o.start === null && i === null ? "start" : o.end === null ? "end" : "start", c = class c extends d.Component {
25
+ import { TodayCommand as oe } from "./TodayCommand.mjs";
26
+ const O = (l = p.defaultProps.min, i = p.defaultProps.max, a) => a instanceof Date && !Array.isArray(a) && I(f(a), l, i) ? f(a) : null, _ = (l = p.defaultProps.min, i = p.defaultProps.max, a) => Array.isArray(a) ? a.filter((h) => I(h, l, i)).map((h) => f(h)) : null, K = (l) => typeof l == "object" && !(l instanceof Date) && l !== null && !Array.isArray(l) ? l : Y, z = (l, i, a) => l || i && i[0] || a && a.start, re = (l, i) => l.start === null && i === null ? "start" : l.end === null ? "end" : "start", c = class c extends d.Component {
27
27
  constructor(i) {
28
28
  super(i), this.dates = [], this.selectedDate = null, this.selectedMultiple = null, this.selectedRange = Y, this._focusedDate = /* @__PURE__ */ new Date(), this.cellUID = this.props.id + "-cell-uid", this.activeRangeEnd = "start", this._element = null, this.intl = null, this.localization = null, this.service = null, this.calendarViewList = null, this.isActive = !1, this.calculateFocusFromValue = !0, this.focus = () => {
29
29
  this._element && this._element.focus();
@@ -31,8 +31,8 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
31
31
  start: e.start,
32
32
  end: e.end === null && e.start !== null && this.isActive ? s : e.end
33
33
  }), this.generateRange = (e, s) => {
34
- const { end: l, start: r } = s, p = s.start !== null && e.getTime() <= s.start.getTime();
35
- return !this.props.allowReverse && p ? { start: e, end: this.selectedRange.start } : this.activeRange !== "end" ? { start: e, end: l } : { start: r || this.selectedDate, end: e };
34
+ const { end: r, start: o } = s, m = s.start !== null && e.getTime() <= s.start.getTime();
35
+ return !this.props.allowReverse && m ? { start: e, end: this.selectedRange.start } : this.activeRange !== "end" ? { start: e, end: r } : { start: o || this.selectedDate, end: e };
36
36
  }, this.canNavigate = (e) => {
37
37
  if (!this.service)
38
38
  return !1;
@@ -40,11 +40,11 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
40
40
  return this.min <= s && s <= this.max || this.service.isInSameView(s, this.min) || this.service.isInSameView(s, this.max);
41
41
  }, this.navigate = (e, s) => {
42
42
  this.calculateFocusFromValue = !1;
43
- const l = this.move(e, s);
44
- this.setState({ navigateDate: l, focusedDate: l });
43
+ const r = this.move(e, s);
44
+ this.setState({ navigateDate: r, focusedDate: r });
45
45
  }, this.move = (e, s) => this.clampDate(this.service.move(s, e)), this.clampDate = (e) => R(e, this.min, this.max), this.shouldAutoCorrect = (e, s) => {
46
- const { end: l, start: r } = s;
47
- return this.activeRange !== "end" ? l !== null && e > l : r !== null && e < r;
46
+ const { end: r, start: o } = s;
47
+ return this.activeRange !== "end" ? r !== null && e > r : o !== null && e < o;
48
48
  }, this.handleCellEnter = (e) => {
49
49
  this.props.mode === "range" && (this.calculateFocusFromValue = !1, this.setState({
50
50
  focusedDate: e
@@ -78,12 +78,12 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
78
78
  }, this.handleNextButtonClick = () => {
79
79
  this.navigate(y.NextView, this.focusedDate);
80
80
  }, this.handleKeyDown = (e) => {
81
- const { keyCode: l, ctrlKey: r, metaKey: p } = e;
82
- if (l === 84) {
81
+ const { keyCode: r, ctrlKey: o, metaKey: m } = e;
82
+ if (r === 84) {
83
83
  const n = C();
84
84
  this.calculateFocusFromValue = !1, this.setState({ focusedDate: n, navigateDate: n });
85
85
  }
86
- if ((r || p) && (l === k.left && this.handlePrevButtonClick(), l === k.right && this.handleNextButtonClick()), l === k.enter) {
86
+ if ((o || m) && (r === k.left && this.handlePrevButtonClick(), r === k.right && this.handleNextButtonClick()), r === k.enter) {
87
87
  const n = {
88
88
  syntheticEvent: e,
89
89
  nativeEvent: e.nativeEvent,
@@ -103,7 +103,7 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
103
103
  this.min,
104
104
  this.max
105
105
  );
106
- if (O(this.focusedDate, n))
106
+ if (A(this.focusedDate, n))
107
107
  return;
108
108
  this.dates && this.service && !this.service.isInArray(n, this.dates) && this.setState({ navigateDate: n }), this.calculateFocusFromValue = !1, this.setState({ focusedDate: n });
109
109
  }
@@ -111,10 +111,10 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
111
111
  }, this.handleViewChange = ({ view: e }) => {
112
112
  this.calculateFocusFromValue = !1, this.setState((s) => ({ activeView: e, navigateDate: s.focusedDate }));
113
113
  }, this.handleDateChange = (e) => {
114
- const s = u(e.value), l = this.bus.canMoveDown(this.state.activeView);
114
+ const s = u(e.value), r = this.bus.canMoveDown(this.state.activeView);
115
115
  if (this.props.disabled)
116
116
  return;
117
- if (l)
117
+ if (r)
118
118
  if (e.isTodayClick)
119
119
  this.bus.moveToBottom(this.state.activeView);
120
120
  else {
@@ -122,43 +122,43 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
122
122
  return;
123
123
  }
124
124
  this.calculateFocusFromValue = !0;
125
- let r;
125
+ let o;
126
126
  switch (this.props.mode) {
127
127
  case "single":
128
- r = u(e.value);
128
+ o = u(e.value);
129
129
  break;
130
130
  case "multiple":
131
131
  if (Array.isArray(this.selectedMultiple)) {
132
132
  const n = this.selectedMultiple.slice();
133
133
  let v = -1;
134
134
  n.forEach((U, $) => {
135
- O(U, e.value) && (v = $);
136
- }), v !== -1 ? n.splice(v, 1) : n.push(u(e.value)), r = n.slice();
135
+ A(U, e.value) && (v = $);
136
+ }), v !== -1 ? n.splice(v, 1) : n.push(u(e.value)), o = n.slice();
137
137
  } else
138
- this.selectedDate ? r = [u(this.selectedDate), u(e.value)] : r = [u(e.value)];
138
+ this.selectedDate ? o = [u(this.selectedDate), u(e.value)] : o = [u(e.value)];
139
139
  break;
140
140
  case "range": {
141
- r = this.selectedRange.start !== null && this.selectedRange.end !== null && this.activeRange === "start" ? this.clampRange(e.value) : this.generateRange(e.value, this.selectedRange), this.activeRangeEnd = this.activeRange !== "end" ? "end" : "start";
141
+ o = this.selectedRange.start !== null && this.selectedRange.end !== null && this.activeRange === "start" ? this.clampRange(e.value) : this.generateRange(e.value, this.selectedRange), this.activeRangeEnd = this.activeRange !== "end" ? "end" : "start";
142
142
  break;
143
143
  }
144
144
  default:
145
- r = u(e.value);
145
+ o = u(e.value);
146
146
  break;
147
147
  }
148
- this.valueDuringOnChange = r, e.isTodayClick && this.setState({ navigateDate: s }), this.setState({ value: r, focusedDate: s }), this.valueDuringOnChange = r;
149
- const { onChange: p } = this.props;
150
- if (p) {
148
+ this.valueDuringOnChange = o, e.isTodayClick && this.setState({ navigateDate: s }), this.setState({ value: o, focusedDate: s }), this.valueDuringOnChange = o;
149
+ const { onChange: m } = this.props;
150
+ if (m) {
151
151
  const n = {
152
152
  syntheticEvent: e.syntheticEvent,
153
153
  nativeEvent: e.nativeEvent,
154
- value: r,
154
+ value: o,
155
155
  target: this
156
156
  };
157
- p.call(void 0, n);
157
+ m.call(void 0, n);
158
158
  }
159
159
  this.valueDuringOnChange = void 0;
160
160
  };
161
- const a = i.value !== void 0 ? i.value : i.defaultValue || c.defaultProps.defaultValue, h = I(this.min, this.max, a), g = _(this.min, this.max, a), b = K(a), F = z(h, g, b), w = P(
161
+ const a = i.value !== void 0 ? i.value : i.defaultValue || c.defaultProps.defaultValue, h = O(this.min, this.max, a), g = _(this.min, this.max, a), b = K(a), F = z(h, g, b), w = P(
162
162
  E[i.defaultActiveView],
163
163
  this.bottomView,
164
164
  this.topView
@@ -172,7 +172,7 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
172
172
  activeView: w,
173
173
  focusedDate: V,
174
174
  navigateDate: V
175
- }, this.activeRangeEnd = le(b, h), this.bus = new ae(this.handleViewChange), this.navigation = new ne(this.bus), this.calculateFocusFromValue = !1, this.lastView = w, this.lastViewsCount = this.props.views || x.defaultProps.views;
175
+ }, this.activeRangeEnd = re(b, h), this.bus = new ae(this.handleViewChange), this.navigation = new ne(this.bus), this.calculateFocusFromValue = !1, this.lastView = w, this.lastViewsCount = this.props.views || x.defaultProps.views;
176
176
  }
177
177
  get wrapperID() {
178
178
  return this.props.id + "-wrapper-id";
@@ -214,7 +214,7 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
214
214
  return this.props.activeRangeEnd !== void 0 ? this.props.activeRangeEnd : this.activeRangeEnd;
215
215
  }
216
216
  get todayIsInRange() {
217
- return A(C(), f(this.min), f(this.max));
217
+ return I(C(), f(this.min), f(this.max));
218
218
  }
219
219
  /**
220
220
  * @hidden
@@ -227,7 +227,7 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
227
227
  */
228
228
  componentDidUpdate() {
229
229
  this.calendarViewList && (this.isActive ? this.calendarViewList.focusActiveDate : this.calendarViewList.blurActiveDate)();
230
- const i = I(this.min, this.max, this.value);
230
+ const i = O(this.min, this.max, this.value);
231
231
  this.calculateFocusFromValue = !!(this.selectedDate && i && this.selectedDate.getTime() && i.getTime()), this.lastView = this.state.activeView, this.lastViewsCount = this.props.views || x.defaultProps.views;
232
232
  }
233
233
  /**
@@ -236,7 +236,7 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
236
236
  render() {
237
237
  this.props._ref && this.props._ref(this), this.intl = q(this), this.localization = H(this), this.bus.configure(this.bottomView, this.topView);
238
238
  const i = P(this.state.activeView, this.bottomView, this.topView);
239
- this.service = this.bus.service(i, this.intl), this.selectedDate = I(this.min, this.max, this.value), this.selectedMultiple = _(this.min, this.max, this.value), this.selectedRange = K(this.value);
239
+ this.service = this.bus.service(i, this.intl), this.selectedDate = O(this.min, this.max, this.value), this.selectedMultiple = _(this.min, this.max, this.value), this.selectedRange = K(this.value);
240
240
  const a = z(this.selectedDate, this.selectedMultiple, this.selectedRange);
241
241
  this._focusedDate = R(
242
242
  this.calculateFocusFromValue && a !== null ? a : this.state.focusedDate,
@@ -249,8 +249,8 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
249
249
  "k-disabled": this.props.disabled
250
250
  },
251
251
  this.props.className
252
- ), g = this.rangeWithFocused(this.selectedRange, this.focusedDate), b = this.localization.toLanguageString(S, B[S]), F = this.localization.toLanguageString(L, B[L]), w = !this.canNavigate(y.PrevView), V = !this.canNavigate(y.NextView), e = { "aria-disabled": w }, s = { "aria-disabled": V }, l = this.lastView !== i, r = this.dates && this.isInMonth(this.state.navigateDate, this.dates[0]), p = this.lastViewsCount !== this.props.views;
253
- (!r || l || p) && (this.dates = this.service.datesList(
252
+ ), g = this.rangeWithFocused(this.selectedRange, this.focusedDate), b = this.localization.toLanguageString(S, B[S]), F = this.localization.toLanguageString(L, B[L]), w = !this.canNavigate(y.PrevView), V = !this.canNavigate(y.NextView), e = { "aria-disabled": w }, s = { "aria-disabled": V }, r = this.lastView !== i, o = this.dates && this.isInMonth(this.state.navigateDate, this.dates[0]), m = this.lastViewsCount !== this.props.views;
253
+ (!o || r || m) && (this.dates = this.service.datesList(
254
254
  this.state.navigateDate,
255
255
  this.props.views || x.defaultProps.views
256
256
  ));
@@ -288,12 +288,12 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
288
288
  headerTitle: this.props.headerTitle,
289
289
  verticalView: this.props.mobileMode,
290
290
  commands: /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.createElement(
291
- T,
291
+ M,
292
292
  {
293
293
  type: "button",
294
294
  className: "k-calendar-nav-prev",
295
295
  icon: this.isRtl ? "chevron-right" : "chevron-left",
296
- svgIcon: this.isRtl ? M : N,
296
+ svgIcon: this.isRtl ? T : N,
297
297
  fillMode: "flat",
298
298
  title: b,
299
299
  disabled: w,
@@ -301,7 +301,7 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
301
301
  ...e
302
302
  }
303
303
  ), /* @__PURE__ */ d.createElement(
304
- re,
304
+ oe,
305
305
  {
306
306
  min: this.min,
307
307
  max: this.max,
@@ -309,12 +309,12 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
309
309
  disabled: !this.todayIsInRange
310
310
  }
311
311
  ), /* @__PURE__ */ d.createElement(
312
- T,
312
+ M,
313
313
  {
314
314
  type: "button",
315
315
  className: "k-calendar-nav-next",
316
316
  icon: this.isRtl ? "chevron-left" : "chevron-right",
317
- svgIcon: this.isRtl ? N : M,
317
+ svgIcon: this.isRtl ? N : T,
318
318
  fillMode: "flat",
319
319
  title: F,
320
320
  disabled: V,
@@ -348,7 +348,8 @@ const I = (o = m.defaultProps.min, i = m.defaultProps.max, a) => a instanceof Da
348
348
  cell: this.props.cell,
349
349
  weekCell: this.props.weekCell,
350
350
  headerTitle: this.props.headerTitle,
351
- verticalView: this.props.mobileMode
351
+ verticalView: this.props.mobileMode,
352
+ showOtherMonthDays: this.props.showOtherMonthDays
352
353
  }
353
354
  )
354
355
  );
@@ -404,6 +405,7 @@ c.displayName = "MultiViewCalendar", c.propTypes = {
404
405
  ) : null;
405
406
  },
406
407
  weekNumber: t.bool,
408
+ showOtherMonthDays: t.bool,
407
409
  dir: t.string
408
410
  }, c.defaultProps = {
409
411
  disabled: !1,
@@ -417,15 +419,16 @@ c.displayName = "MultiViewCalendar", c.propTypes = {
417
419
  tabIndex: 0,
418
420
  bottomView: "month",
419
421
  views: 2,
420
- allowReverse: !1
422
+ allowReverse: !1,
423
+ showOtherMonthDays: !1
421
424
  };
422
- let m = c;
423
- const oe = J(), he = Q(Z(oe, m));
425
+ let p = c;
426
+ const le = J(), he = Q(Z(le, p));
424
427
  he.displayName = "KendoReactMultiViewCalendar";
425
- j(m);
426
- G(m);
428
+ j(p);
429
+ G(p);
427
430
  export {
428
431
  he as MultiViewCalendar,
429
- oe as MultiViewCalendarPropsContext,
430
- m as MultiViewCalendarWithoutContext
432
+ le as MultiViewCalendarPropsContext,
433
+ p as MultiViewCalendarWithoutContext
431
434
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),s=require("prop-types"),d=require("@progress/kendo-react-intl"),m=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-buttons"),l=require("@progress/kendo-date-math"),r=require("../../messages/index.js"),i=require("../../utils.js");function h(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,c.get?c:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const u=h(p),n=class n extends u.Component{constructor(){super(...arguments),this.localization=null,this.handleClick=e=>{if(this.todayIsInRange&&this.props.onClick){const t={syntheticEvent:e,nativeEvent:e.nativeEvent,value:i.dateInRange(i.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:n.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:n.defaultProps.max}get todayIsInRange(){return i.isInRange(i.getToday(),l.getDate(this.min),l.getDate(this.max))}render(){this.localization=d.provideLocalizationService(this);const e=this.localization.toLanguageString(r.today,r.messages[r.today]),t=m.classNames("k-calendar-nav-today",{"k-disabled":this.props.disabled});return u.createElement(g.Button,{className:t,onClick:this.handleClick,tabIndex:this.props.tabIndex,fillMode:"flat",themeColor:"primary",role:"link"},e)}};n.propTypes={max:s.instanceOf(Date).isRequired,min:s.instanceOf(Date).isRequired,onClick:s.func,disabled:s.bool},n.defaultProps={min:i.MIN_DATE,max:i.MAX_DATE};let o=n;d.registerForLocalization(o);exports.TodayCommand=o;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),a=require("prop-types"),d=require("@progress/kendo-react-intl"),m=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-buttons"),l=require("@progress/kendo-date-math"),r=require("../../messages/index.js"),i=require("../../utils.js");function h(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,c.get?c:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const u=h(p),n=class n extends u.Component{constructor(){super(...arguments),this.localization=null,this.handleClick=e=>{if(this.todayIsInRange&&this.props.onClick){const t={syntheticEvent:e,nativeEvent:e.nativeEvent,value:i.dateInRange(i.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:n.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:n.defaultProps.max}get todayIsInRange(){return i.isInRange(i.getToday(),l.getDate(this.min),l.getDate(this.max))}render(){this.localization=d.provideLocalizationService(this);const e=this.localization.toLanguageString(r.today,r.messages[r.today]),t=m.classNames("k-calendar-nav-today",{"k-disabled":this.props.disabled});return u.createElement(g.Button,{className:t,onClick:this.handleClick,tabIndex:this.props.tabIndex,fillMode:"flat",themeColor:"base",role:"link"},e)}};n.propTypes={max:a.instanceOf(Date).isRequired,min:a.instanceOf(Date).isRequired,onClick:a.func,disabled:a.bool},n.defaultProps={min:i.MIN_DATE,max:i.MAX_DATE};let o=n;d.registerForLocalization(o);exports.TodayCommand=o;
@@ -53,7 +53,7 @@ const t = class t extends o.Component {
53
53
  onClick: this.handleClick,
54
54
  tabIndex: this.props.tabIndex,
55
55
  fillMode: "flat",
56
- themeColor: "primary",
56
+ themeColor: "base",
57
57
  role: "link"
58
58
  },
59
59
  i
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react"),i=require("prop-types"),p=require("@progress/kendo-date-math"),D=require("@progress/kendo-react-intl"),w=require("./CalendarCell.js"),g=require("./CalendarWeekCell.js"),k=require("../models/CalendarViewEnum.js"),m=require("../../utils.js"),b=require("../services/WeekNamesService.js");function y(l){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const e in l)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(l,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>l[e]})}}return t.default=l,Object.freeze(t)}const s=y(v),f=l=>s.createElement("td",{key:l,className:"k-calendar-td k-empty"}," "),u=class u extends s.Component{constructor(){super(...arguments),this.intl=null,this.weekService=null,this.buildWeekNumber=(t,e)=>{if(!this.firstDate(t))return f(`week-cell-${e}`);const n=this.firstDate(t),a=this.getWeekNumber(n),o=`kendo-react-calendar-week-cell-${a}`,c={className:"k-alt",value:a,firstDate:n};return this.props.weekCell?s.createElement(this.props.weekCell,{...c,key:o},a):s.createElement(g.CalendarWeekCell,{...c,key:o},a)},this.buildRow=t=>t.map((e,r)=>{if(!e)return f(r);const n={"aria-selected":e.isSelected},a=`kendo-react-calendar-cell-${e.value.getTime()}`,o={...n,...e,isDisabled:!e.isInRange,view:this.props.activeView,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave};return this.props.cell?s.createElement(this.props.cell,{...o,key:a},e.formattedValue):s.createElement(w.CalendarCell,{...o,key:a},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,r=t[e];for(;!r&&e<t.length;)r=t[++e];return r},this.handleClick=(t,e)=>{const{onChange:r}=this.props;if(r&&e){const n={value:p.cloneDate(t),target:this,nativeEvent:e&&e.nativeEvent,syntheticEvent:e};r.call(void 0,n)}},this.handleMouseEnter=t=>{const{onCellEnter:e}=this.props;e&&e.call(void 0,p.cloneDate(t))},this.handleMouseLeave=t=>{const{onCellLeave:e}=this.props;e&&e.call(void 0,p.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===k.CalendarViewEnum.month}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===k.CalendarViewEnum.month)}get selectedDate(){return this.props.selectedDate!==void 0?this.props.selectedDate:u.defaultProps.selectedDate}render(){this.intl=D.provideIntlService(this),this.weekService=new b.WeekNamesService(this.intl);const t=this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat),e=this.props.service.rowLength(this.weekNumber),r=this.props.service.title(this.props.viewDate),n=m.getToday(),a=m.setTime(this.props.viewDate,n),o=this.props.service.data({cellUID:this.props.cellUID,min:this.min,max:this.max,focusedDate:this.props.focusedDate,isActiveView:!this.props.bus.canMoveDown(this.props.activeView),selectedDate:this.selectedDate,selectionRange:this.props.selectionRange,viewDate:a});return s.createElement(s.Fragment,null,this.isMonthView&&this.isHorizontal&&s.createElement("thead",{role:"rowgroup",className:"k-calendar-thead"},s.createElement("tr",{role:"row",className:"k-calendar-tr"},t.map((c,h)=>s.createElement("th",{key:h,className:"k-calendar-th"},c)))),s.createElement("tbody",{role:"rowgroup",className:"k-calendar-tbody"},!this.isHorizontal&&s.createElement("tr",{role:"presentation",className:"k-calendar-tr"},s.createElement("th",{scope:"col",colSpan:e,className:"k-calendar-caption"},r)),o.map((c,h)=>s.createElement("tr",{role:"row",className:"k-calendar-tr",key:h},this.weekNumber&&this.buildWeekNumber(c,h),this.buildRow(c)))))}getWeekNumber(t){return!this.weekNumber||!this.intl?null:p.weekInYear(t,this.intl.firstDay())}};u.propTypes={activeRangeEnd:i.oneOf(["start","end",null]),activeView:i.number.isRequired,cellUID:i.string.isRequired,direction:i.oneOf(["horizontal","vertical"]),focusedDate:i.instanceOf(Date).isRequired,max:i.instanceOf(Date).isRequired,min:i.instanceOf(Date).isRequired,onChange:i.func,selectedDate:i.oneOfType([i.instanceOf(Date),i.arrayOf(i.instanceOf(Date))]),showWeekNumbers:i.bool,viewDate:i.instanceOf(Date).isRequired},u.defaultProps={direction:"vertical",selectedDate:m.getToday(),showWeekNumbers:!1};let d=u;D.registerForIntl(d);exports.View=d;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),s=require("prop-types"),p=require("@progress/kendo-date-math"),D=require("@progress/kendo-react-intl"),v=require("./CalendarCell.js"),g=require("./CalendarWeekCell.js"),k=require("../models/CalendarViewEnum.js"),m=require("../../utils.js"),b=require("../services/WeekNamesService.js");function y(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const r=y(w),f=o=>r.createElement("td",{key:o,className:"k-calendar-td k-empty"}," "),u=class u extends r.Component{constructor(){super(...arguments),this.intl=null,this.weekService=null,this.buildWeekNumber=(t,e)=>{if(!this.firstDate(t))return f(`week-cell-${e}`);const n=this.firstDate(t),a=this.getWeekNumber(n),l=`kendo-react-calendar-week-cell-${a}`,c={className:"k-alt",value:a,firstDate:n};return this.props.weekCell?r.createElement(this.props.weekCell,{...c,key:l},a):r.createElement(g.CalendarWeekCell,{...c,key:l},a)},this.buildRow=t=>t.map((e,i)=>{if(!e)return f(i);const n={"aria-selected":e.isSelected},a=`kendo-react-calendar-cell-${e.value.getTime()}`,l={...n,...e,isDisabled:!e.isInRange,view:this.props.activeView,showOtherMonthDays:this.props.showOtherMonthDays,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave};return this.props.cell?r.createElement(this.props.cell,{...l,key:a},e.formattedValue):r.createElement(v.CalendarCell,{...l,key:a},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,i=t[e];for(;!i&&e<t.length;)i=t[++e];return i},this.handleClick=(t,e)=>{const{onChange:i}=this.props;if(i&&e){const n={value:p.cloneDate(t),target:this,nativeEvent:e&&e.nativeEvent,syntheticEvent:e};i.call(void 0,n)}},this.handleMouseEnter=t=>{const{onCellEnter:e}=this.props;e&&e.call(void 0,p.cloneDate(t))},this.handleMouseLeave=t=>{const{onCellLeave:e}=this.props;e&&e.call(void 0,p.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===k.CalendarViewEnum.month}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===k.CalendarViewEnum.month)}get selectedDate(){return this.props.selectedDate!==void 0?this.props.selectedDate:u.defaultProps.selectedDate}render(){this.intl=D.provideIntlService(this),this.weekService=new b.WeekNamesService(this.intl);const t=this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat),e=this.props.service.rowLength(this.weekNumber),i=this.props.service.title(this.props.viewDate),n=m.getToday(),a=m.setTime(this.props.viewDate,n),l=this.props.service.data({cellUID:this.props.cellUID,min:this.min,max:this.max,focusedDate:this.props.focusedDate,isActiveView:!this.props.bus.canMoveDown(this.props.activeView),selectedDate:this.selectedDate,selectionRange:this.props.selectionRange,viewDate:a});return r.createElement(r.Fragment,null,this.isMonthView&&this.isHorizontal&&r.createElement("thead",{role:"rowgroup",className:"k-calendar-thead"},r.createElement("tr",{role:"row",className:"k-calendar-tr"},t.map((c,h)=>r.createElement("th",{key:h,className:"k-calendar-th"},c)))),r.createElement("tbody",{role:"rowgroup",className:"k-calendar-tbody"},!this.isHorizontal&&r.createElement("tr",{role:"presentation",className:"k-calendar-tr"},r.createElement("th",{scope:"col",colSpan:e,className:"k-calendar-caption"},i)),l.map((c,h)=>r.createElement("tr",{role:"row",className:"k-calendar-tr",key:h},this.weekNumber&&this.buildWeekNumber(c,h),this.buildRow(c)))))}getWeekNumber(t){return!this.weekNumber||!this.intl?null:p.weekInYear(t,this.intl.firstDay())}};u.propTypes={activeRangeEnd:s.oneOf(["start","end",null]),activeView:s.number.isRequired,cellUID:s.string.isRequired,direction:s.oneOf(["horizontal","vertical"]),focusedDate:s.instanceOf(Date).isRequired,max:s.instanceOf(Date).isRequired,min:s.instanceOf(Date).isRequired,onChange:s.func,selectedDate:s.oneOfType([s.instanceOf(Date),s.arrayOf(s.instanceOf(Date))]),showWeekNumbers:s.bool,showOtherMonthDays:s.bool,viewDate:s.instanceOf(Date).isRequired},u.defaultProps={direction:"vertical",selectedDate:m.getToday(),showWeekNumbers:!1};let d=u;D.registerForIntl(d);exports.View=d;
@@ -6,16 +6,16 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as s from "react";
10
- import r from "prop-types";
9
+ import * as r from "react";
10
+ import s from "prop-types";
11
11
  import { cloneDate as p, weekInYear as D } from "@progress/kendo-date-math";
12
- import { provideIntlService as v, registerForIntl as w } from "@progress/kendo-react-intl";
12
+ import { provideIntlService as w, registerForIntl as v } from "@progress/kendo-react-intl";
13
13
  import { CalendarCell as g } from "./CalendarCell.mjs";
14
14
  import { CalendarWeekCell as N } from "./CalendarWeekCell.mjs";
15
15
  import { CalendarViewEnum as u } from "../models/CalendarViewEnum.mjs";
16
16
  import { getToday as d, setTime as b } from "../../utils.mjs";
17
- import { WeekNamesService as E } from "../services/WeekNamesService.mjs";
18
- const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-calendar-td k-empty" }, " "), c = class c extends s.Component {
17
+ import { WeekNamesService as y } from "../services/WeekNamesService.mjs";
18
+ const k = (f) => /* @__PURE__ */ r.createElement("td", { key: f, className: "k-calendar-td k-empty" }, " "), c = class c extends r.Component {
19
19
  constructor() {
20
20
  super(...arguments), this.intl = null, this.weekService = null, this.buildWeekNumber = (t, e) => {
21
21
  if (!this.firstDate(t))
@@ -25,7 +25,7 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
25
25
  value: a,
26
26
  firstDate: n
27
27
  };
28
- return this.props.weekCell ? /* @__PURE__ */ s.createElement(this.props.weekCell, { ...l, key: o }, a) : /* @__PURE__ */ s.createElement(N, { ...l, key: o }, a);
28
+ return this.props.weekCell ? /* @__PURE__ */ r.createElement(this.props.weekCell, { ...l, key: o }, a) : /* @__PURE__ */ r.createElement(N, { ...l, key: o }, a);
29
29
  }, this.buildRow = (t) => t.map((e, i) => {
30
30
  if (!e)
31
31
  return k(i);
@@ -34,11 +34,12 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
34
34
  ...e,
35
35
  isDisabled: !e.isInRange,
36
36
  view: this.props.activeView,
37
+ showOtherMonthDays: this.props.showOtherMonthDays,
37
38
  onClick: this.handleClick,
38
39
  onMouseEnter: this.handleMouseEnter,
39
40
  onMouseLeave: this.handleMouseLeave
40
41
  };
41
- return this.props.cell ? /* @__PURE__ */ s.createElement(this.props.cell, { ...o, key: a }, e.formattedValue) : /* @__PURE__ */ s.createElement(g, { ...o, key: a }, e.formattedValue);
42
+ return this.props.cell ? /* @__PURE__ */ r.createElement(this.props.cell, { ...o, key: a }, e.formattedValue) : /* @__PURE__ */ r.createElement(g, { ...o, key: a }, e.formattedValue);
42
43
  }), this.firstDate = (t) => {
43
44
  const e = this.firstWeekDateContext(t);
44
45
  return e ? e.value : null;
@@ -87,7 +88,7 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
87
88
  return this.props.selectedDate !== void 0 ? this.props.selectedDate : c.defaultProps.selectedDate;
88
89
  }
89
90
  render() {
90
- this.intl = v(this), this.weekService = new E(this.intl);
91
+ this.intl = w(this), this.weekService = new y(this.intl);
91
92
  const t = this.weekService.getWeekNames(this.weekNumber, this.props.weekDaysFormat), e = this.props.service.rowLength(this.weekNumber), i = this.props.service.title(this.props.viewDate), n = d(), a = b(this.props.viewDate, n), o = this.props.service.data({
92
93
  cellUID: this.props.cellUID,
93
94
  min: this.min,
@@ -98,20 +99,20 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
98
99
  selectionRange: this.props.selectionRange,
99
100
  viewDate: a
100
101
  });
101
- return /* @__PURE__ */ s.createElement(s.Fragment, null, this.isMonthView && this.isHorizontal && /* @__PURE__ */ s.createElement(
102
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, this.isMonthView && this.isHorizontal && /* @__PURE__ */ r.createElement(
102
103
  "thead",
103
104
  {
104
105
  role: "rowgroup",
105
106
  className: "k-calendar-thead"
106
107
  },
107
- /* @__PURE__ */ s.createElement("tr", { role: "row", className: "k-calendar-tr" }, t.map((l, h) => /* @__PURE__ */ s.createElement("th", { key: h, className: "k-calendar-th" }, l)))
108
- ), /* @__PURE__ */ s.createElement(
108
+ /* @__PURE__ */ r.createElement("tr", { role: "row", className: "k-calendar-tr" }, t.map((l, h) => /* @__PURE__ */ r.createElement("th", { key: h, className: "k-calendar-th" }, l)))
109
+ ), /* @__PURE__ */ r.createElement(
109
110
  "tbody",
110
111
  {
111
112
  role: "rowgroup",
112
113
  className: "k-calendar-tbody"
113
114
  },
114
- !this.isHorizontal && /* @__PURE__ */ s.createElement("tr", { role: "presentation", className: "k-calendar-tr" }, /* @__PURE__ */ s.createElement(
115
+ !this.isHorizontal && /* @__PURE__ */ r.createElement("tr", { role: "presentation", className: "k-calendar-tr" }, /* @__PURE__ */ r.createElement(
115
116
  "th",
116
117
  {
117
118
  scope: "col",
@@ -120,7 +121,7 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
120
121
  },
121
122
  i
122
123
  )),
123
- o.map((l, h) => /* @__PURE__ */ s.createElement("tr", { role: "row", className: "k-calendar-tr", key: h }, this.weekNumber && this.buildWeekNumber(l, h), this.buildRow(l)))
124
+ o.map((l, h) => /* @__PURE__ */ r.createElement("tr", { role: "row", className: "k-calendar-tr", key: h }, this.weekNumber && this.buildWeekNumber(l, h), this.buildRow(l)))
124
125
  ));
125
126
  }
126
127
  getWeekNumber(t) {
@@ -128,26 +129,27 @@ const k = (f) => /* @__PURE__ */ s.createElement("td", { key: f, className: "k-c
128
129
  }
129
130
  };
130
131
  c.propTypes = {
131
- activeRangeEnd: r.oneOf(["start", "end", null]),
132
- activeView: r.number.isRequired,
133
- cellUID: r.string.isRequired,
134
- direction: r.oneOf(["horizontal", "vertical"]),
135
- focusedDate: r.instanceOf(Date).isRequired,
136
- max: r.instanceOf(Date).isRequired,
137
- min: r.instanceOf(Date).isRequired,
138
- onChange: r.func,
139
- selectedDate: r.oneOfType(
140
- [r.instanceOf(Date), r.arrayOf(r.instanceOf(Date))]
132
+ activeRangeEnd: s.oneOf(["start", "end", null]),
133
+ activeView: s.number.isRequired,
134
+ cellUID: s.string.isRequired,
135
+ direction: s.oneOf(["horizontal", "vertical"]),
136
+ focusedDate: s.instanceOf(Date).isRequired,
137
+ max: s.instanceOf(Date).isRequired,
138
+ min: s.instanceOf(Date).isRequired,
139
+ onChange: s.func,
140
+ selectedDate: s.oneOfType(
141
+ [s.instanceOf(Date), s.arrayOf(s.instanceOf(Date))]
141
142
  ),
142
- showWeekNumbers: r.bool,
143
- viewDate: r.instanceOf(Date).isRequired
143
+ showWeekNumbers: s.bool,
144
+ showOtherMonthDays: s.bool,
145
+ viewDate: s.instanceOf(Date).isRequired
144
146
  }, c.defaultProps = {
145
147
  direction: "vertical",
146
148
  selectedDate: d(),
147
149
  showWeekNumbers: !1
148
150
  };
149
151
  let m = c;
150
- w(m);
152
+ v(m);
151
153
  export {
152
154
  m as View
153
155
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),r=require("prop-types"),y=require("@progress/kendo-react-common"),d=require("@progress/kendo-date-math"),f=require("@progress/kendo-react-intl"),x=require("../../virtualization/Virtualization.js"),S=require("./View.js"),C=require("./Header.js"),E=require("../services/WeekNamesService.js"),c=require("../../utils.js"),l=require("../models/CalendarViewEnum.js"),I=require("./TodayCommand.js");function T(h){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const e in h)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(h,e);Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:()=>h[e]})}}return o.default=h,Object.freeze(o)}const s=T(V),N=5,p=class p extends s.Component{constructor(o){super(o),this.virtualization=null,this.calendarView=null,this.table=null,this.intl=null,this.bottomOffset=0,this.viewOffset=0,this.viewHeight=0,this._element=null,this.isActive=!1,this.animateToIndex=!0,this.shouldScroll=!1,this.weekService=null,this.focusActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus"),t=this._element.querySelector(".k-state-pending-focus");e&&e[0]&&e[0].classList.remove("k-focus"),t&&t.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus");e&&e.classList.remove("k-focus"),this.isActive=!1},this.handleVirtualizationMount=e=>{if(this.virtualization=e,this.virtualization&&this.table){this.table.style.transform=`translateY(${this.viewOffset}px)`;const t=c.dateInRange(this.props.focusedDate,this.props.min,this.props.max),i=this.props.service.skip(t,this.props.min);this.virtualization.scrollToIndex(i)}},this.buildMonthView=(e,t)=>s.createElement("table",{key:"calendar-view-list-weekdays",className:"k-calendar-table k-calendar-weekdays",role:"grid",tabIndex:this.props.tabIndex},s.createElement("colgroup",null,e.map((i,a)=>s.createElement("col",{key:a}))),s.createElement("thead",{className:"k-calendar-thead"},s.createElement("tr",{className:"k-calendar-tr"},t.map((i,a)=>s.createElement("th",{key:a,className:"k-calendar-th"},i))))),this.buildDates=(e,t)=>{const i=this.props.cellUID;return s.createElement("table",{className:"k-calendar-table",ref:a=>this.table=a,role:"grid",tabIndex:this.props.tabIndex,"aria-activedescendant":i+this.props.focusedDate.getTime()},s.createElement("colgroup",null,e.map((a,n)=>s.createElement("col",{key:n}))),t.map(a=>s.createElement(S.View,{ref:n=>{this.calendarView||(this.calendarView=n)},key:a.getTime(),activeView:this.props.activeView,viewDate:a,min:this.props.min,max:this.props.max,cellUID:i,focusedDate:this.props.focusedDate,cell:this.props.cell,selectedDate:this.props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,bus:this.props.bus,service:this.props.service,weekCell:this.props.weekCell})))},this.calculateHeights=()=>{if(!this.props.dom)return;const e=this.props.activeView===l.CalendarViewEnum.month?this.props.dom.scrollableContentHeight:this.props.dom.scrollableYearContentHeight;this.bottomOffset=e-this.props.dom.viewHeight(this.props.activeView),this.viewOffset=-1*this.props.dom.headerHeight,this.viewHeight=this.props.dom.viewHeight(this.props.activeView)||1},this.getTake=(e,t)=>Math.min(t-e,this.take),this.handleScrollAction=({index:e,scrollAction:t,pageAction:i})=>{const a=i?i.skip:this.state.skip;if((this.state.index!==e||this.state.skip!==a)&&this.setState({index:e,skip:a}),this.table&&t){const n=`translateY(${t.offset}px)`;this.table.style.transform=n}},this.handleTodayClick=e=>{this.shouldScroll=!0,this.handleDateChange.call(void 0,e,!0)},this.handleDateChange=(e,t=!1)=>{const{onChange:i}=this.props;if(i){const a={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:d.cloneDate(e.value),target:this,isTodayClick:t};i.call(void 0,a)}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.state={skip:this.props.service.skip(this.props.focusedDate,this.props.min),index:this.props.service.skip(this.props.focusedDate,this.props.min)}}get element(){return this._element}get weekNames(){this.intl=f.provideIntlService(this),this.weekService=new E.WeekNamesService(this.intl);const o=this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat),e=c.shiftWeekNames(o,this.intl.firstDay());return this.weekNumber?[""].concat(e):e}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===l.CalendarViewEnum.month)}get take(){return this.props.take!==void 0?this.props.take:p.defaultProps.take}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get todayIsInRange(){return c.isInRange(c.getToday(),d.getDate(this.props.min),d.getDate(this.props.max))}componentDidUpdate(o,e){this.shouldScroll=!1,this.indexToScroll!==void 0&&this.virtualization&&this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](this.indexToScroll),this.isActive&&this.focusActiveDate(),this.lastView=this.props.activeView,this.indexToScroll=void 0}render(){this.calculateHeights();const o=this.lastView!==this.props.activeView,e=c.dateInRange(this.props.focusedDate,this.props.min,this.props.max),t=o?this.props.service.skip(e,this.props.min):this.state.skip,i=this.props.service.total(this.props.min,this.props.max),a=this.getTake(t,i),n=this.props.service.addToDate(this.props.min,t),w=this.props.service.addToDate(this.props.min,this.state.index),m=new Array(this.props.service.rowLength(this.weekNumber)).fill(""),v=this.props.activeView!==this.lastView;this.animateToIndex=!v,(v||!d.isEqualDate(this.lastFocus,e)||this.shouldScroll||!this.props.shouldScroll||this.props.shouldScroll())&&(this.indexToScroll=this.props.service.skip(e,this.props.min)),this.lastFocus=e;const k=y.classNames("k-calendar-view k-vstack",{"k-calendar-monthview":this.props.activeView===l.CalendarViewEnum.month,"k-calendar-yearview":this.props.activeView===l.CalendarViewEnum.year,"k-calendar-decadeview":this.props.activeView===l.CalendarViewEnum.decade,"k-calendar-centuryview":this.props.activeView===l.CalendarViewEnum.century}),b=this.buildDates(m,this.props.service.datesList(n,a)),g=s.createElement(s.Fragment,null,s.createElement(C.Header,{key:"calendar-view-list-header",currentDate:w,min:this.props.min,max:this.props.max,activeView:this.props.activeView,bus:this.props.bus,service:this.props.service,headerTitle:this.props.headerTitle,commands:s.createElement(s.Fragment,null,s.createElement(I.TodayCommand,{min:this.props.min,max:this.props.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange,tabIndex:this.props.tabIndex}))}),this.props.activeView===l.CalendarViewEnum.month&&this.buildMonthView(m,this.weekNames),s.createElement(x.Virtualization,{key:"calendar-view-list-content",skip:t,take:this.take,total:i,itemHeight:this.viewHeight,topOffset:this.viewOffset,bottomOffset:this.bottomOffset,scrollOffsetSize:this.viewOffset,maxScrollDifference:this.viewHeight,onScroll:this.props.onScroll,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,children:b,tabIndex:this.props.tabIndex}));return s.createElement("div",{ref:D=>{this._element=D},className:k},this.props.dom.didCalculate?g:null)}};p.propTypes={activeView:r.number.isRequired,bottomOffset:r.number,cellUID:r.string.isRequired,focusedDate:r.instanceOf(Date).isRequired,max:r.instanceOf(Date).isRequired,min:r.instanceOf(Date).isRequired,onChange:r.func,showWeekNumbers:r.bool,smoothScroll:r.bool,take:r.number,value:r.instanceOf(Date),viewHeight:r.number,viewOffset:r.number,weekDaysFormat:r.oneOf(["short","abbreviated","narrow"]),tabIndex:r.number},p.defaultProps={take:N,showWeekNumbers:!1,weekDaysFormat:"short",smoothScroll:!0};let u=p;f.registerForIntl(u);exports.ViewList=u;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),r=require("prop-types"),V=require("@progress/kendo-react-common"),d=require("@progress/kendo-date-math"),f=require("@progress/kendo-react-intl"),x=require("../../virtualization/Virtualization.js"),S=require("./View.js"),C=require("./Header.js"),E=require("../services/WeekNamesService.js"),c=require("../../utils.js"),l=require("../models/CalendarViewEnum.js"),I=require("./TodayCommand.js");function T(h){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const e in h)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(h,e);Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:()=>h[e]})}}return o.default=h,Object.freeze(o)}const s=T(y),N=5,p=class p extends s.Component{constructor(o){super(o),this.virtualization=null,this.calendarView=null,this.table=null,this.intl=null,this.bottomOffset=0,this.viewOffset=0,this.viewHeight=0,this._element=null,this.isActive=!1,this.animateToIndex=!0,this.shouldScroll=!1,this.weekService=null,this.focusActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus"),t=this._element.querySelector(".k-state-pending-focus");e&&e[0]&&e[0].classList.remove("k-focus"),t&&t.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus");e&&e.classList.remove("k-focus"),this.isActive=!1},this.handleVirtualizationMount=e=>{if(this.virtualization=e,this.virtualization&&this.table){this.table.style.transform=`translateY(${this.viewOffset}px)`;const t=c.dateInRange(this.props.focusedDate,this.props.min,this.props.max),i=this.props.service.skip(t,this.props.min);this.virtualization.scrollToIndex(i)}},this.buildMonthView=(e,t)=>s.createElement("table",{key:"calendar-view-list-weekdays",className:"k-calendar-table k-calendar-weekdays",role:"grid",tabIndex:this.props.tabIndex},s.createElement("colgroup",null,e.map((i,a)=>s.createElement("col",{key:a}))),s.createElement("thead",{className:"k-calendar-thead"},s.createElement("tr",{className:"k-calendar-tr"},t.map((i,a)=>s.createElement("th",{key:a,className:"k-calendar-th"},i))))),this.buildDates=(e,t)=>{const i=this.props.cellUID;return s.createElement("table",{className:"k-calendar-table",ref:a=>this.table=a,role:"grid",tabIndex:this.props.tabIndex,"aria-activedescendant":i+this.props.focusedDate.getTime()},s.createElement("colgroup",null,e.map((a,n)=>s.createElement("col",{key:n}))),t.map(a=>s.createElement(S.View,{ref:n=>{this.calendarView||(this.calendarView=n)},key:a.getTime(),activeView:this.props.activeView,viewDate:a,min:this.props.min,max:this.props.max,cellUID:i,focusedDate:this.props.focusedDate,cell:this.props.cell,selectedDate:this.props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,bus:this.props.bus,service:this.props.service,weekCell:this.props.weekCell,showOtherMonthDays:this.props.showOtherMonthDays})))},this.calculateHeights=()=>{if(!this.props.dom)return;const e=this.props.activeView===l.CalendarViewEnum.month?this.props.dom.scrollableContentHeight:this.props.dom.scrollableYearContentHeight;this.bottomOffset=e-this.props.dom.viewHeight(this.props.activeView),this.viewOffset=-1*this.props.dom.headerHeight,this.viewHeight=this.props.dom.viewHeight(this.props.activeView)||1},this.getTake=(e,t)=>Math.min(t-e,this.take),this.handleScrollAction=({index:e,scrollAction:t,pageAction:i})=>{const a=i?i.skip:this.state.skip;if((this.state.index!==e||this.state.skip!==a)&&this.setState({index:e,skip:a}),this.table&&t){const n=`translateY(${t.offset}px)`;this.table.style.transform=n}},this.handleTodayClick=e=>{this.shouldScroll=!0,this.handleDateChange.call(void 0,e,!0)},this.handleDateChange=(e,t=!1)=>{const{onChange:i}=this.props;if(i){const a={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:d.cloneDate(e.value),target:this,isTodayClick:t};i.call(void 0,a)}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.state={skip:this.props.service.skip(this.props.focusedDate,this.props.min),index:this.props.service.skip(this.props.focusedDate,this.props.min)}}get element(){return this._element}get weekNames(){this.intl=f.provideIntlService(this),this.weekService=new E.WeekNamesService(this.intl);const o=this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat),e=c.shiftWeekNames(o,this.intl.firstDay());return this.weekNumber?[""].concat(e):e}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===l.CalendarViewEnum.month)}get take(){return this.props.take!==void 0?this.props.take:p.defaultProps.take}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get todayIsInRange(){return c.isInRange(c.getToday(),d.getDate(this.props.min),d.getDate(this.props.max))}componentDidUpdate(o,e){this.shouldScroll=!1,this.indexToScroll!==void 0&&this.virtualization&&this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](this.indexToScroll),this.isActive&&this.focusActiveDate(),this.lastView=this.props.activeView,this.indexToScroll=void 0}render(){this.calculateHeights();const o=this.lastView!==this.props.activeView,e=c.dateInRange(this.props.focusedDate,this.props.min,this.props.max),t=o?this.props.service.skip(e,this.props.min):this.state.skip,i=this.props.service.total(this.props.min,this.props.max),a=this.getTake(t,i),n=this.props.service.addToDate(this.props.min,t),w=this.props.service.addToDate(this.props.min,this.state.index),m=new Array(this.props.service.rowLength(this.weekNumber)).fill(""),v=this.props.activeView!==this.lastView;this.animateToIndex=!v,(v||!d.isEqualDate(this.lastFocus,e)||this.shouldScroll||!this.props.shouldScroll||this.props.shouldScroll())&&(this.indexToScroll=this.props.service.skip(e,this.props.min)),this.lastFocus=e;const k=V.classNames("k-calendar-view k-vstack",{"k-calendar-monthview":this.props.activeView===l.CalendarViewEnum.month,"k-calendar-yearview":this.props.activeView===l.CalendarViewEnum.year,"k-calendar-decadeview":this.props.activeView===l.CalendarViewEnum.decade,"k-calendar-centuryview":this.props.activeView===l.CalendarViewEnum.century}),b=this.buildDates(m,this.props.service.datesList(n,a)),g=s.createElement(s.Fragment,null,s.createElement(C.Header,{key:"calendar-view-list-header",currentDate:w,min:this.props.min,max:this.props.max,activeView:this.props.activeView,bus:this.props.bus,service:this.props.service,headerTitle:this.props.headerTitle,header:this.props.header,commands:s.createElement(s.Fragment,null,s.createElement(I.TodayCommand,{min:this.props.min,max:this.props.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange,tabIndex:this.props.tabIndex}))}),this.props.activeView===l.CalendarViewEnum.month&&this.buildMonthView(m,this.weekNames),s.createElement(x.Virtualization,{key:"calendar-view-list-content",skip:t,take:this.take,total:i,itemHeight:this.viewHeight,topOffset:this.viewOffset,bottomOffset:this.bottomOffset,scrollOffsetSize:this.viewOffset,maxScrollDifference:this.viewHeight,onScroll:this.props.onScroll,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,children:b,tabIndex:this.props.tabIndex}));return s.createElement("div",{ref:D=>{this._element=D},className:k},this.props.dom.didCalculate?g:null)}};p.propTypes={activeView:r.number.isRequired,bottomOffset:r.number,cellUID:r.string.isRequired,focusedDate:r.instanceOf(Date).isRequired,max:r.instanceOf(Date).isRequired,min:r.instanceOf(Date).isRequired,onChange:r.func,showWeekNumbers:r.bool,smoothScroll:r.bool,take:r.number,value:r.instanceOf(Date),viewHeight:r.number,viewOffset:r.number,weekDaysFormat:r.oneOf(["short","abbreviated","narrow"]),tabIndex:r.number},p.defaultProps={take:N,showWeekNumbers:!1,weekDaysFormat:"short",smoothScroll:!0};let u=p;f.registerForIntl(u);exports.ViewList=u;
@@ -18,9 +18,9 @@ import { WeekNamesService as N } from "../services/WeekNamesService.mjs";
18
18
  import { dateInRange as u, shiftWeekNames as C, isInRange as E, getToday as O } from "../../utils.mjs";
19
19
  import { CalendarViewEnum as n } from "../models/CalendarViewEnum.mjs";
20
20
  import { TodayCommand as H } from "./TodayCommand.mjs";
21
- const z = 5, h = class h extends s.Component {
22
- constructor(l) {
23
- super(l), 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 = () => {
21
+ const z = 5, l = class l extends s.Component {
22
+ constructor(h) {
23
+ super(h), this.virtualization = null, this.calendarView = null, this.table = null, this.intl = null, this.bottomOffset = 0, this.viewOffset = 0, this.viewHeight = 0, this._element = null, this.isActive = !1, this.animateToIndex = !0, this.shouldScroll = !1, this.weekService = null, this.focusActiveDate = () => {
24
24
  if (!this._element)
25
25
  return;
26
26
  const e = this._element.querySelector("td.k-focus"), t = this._element.querySelector(".k-state-pending-focus");
@@ -77,7 +77,8 @@ const z = 5, h = class h extends s.Component {
77
77
  onChange: this.handleDateChange,
78
78
  bus: this.props.bus,
79
79
  service: this.props.service,
80
- weekCell: this.props.weekCell
80
+ weekCell: this.props.weekCell,
81
+ showOtherMonthDays: this.props.showOtherMonthDays
81
82
  }
82
83
  ))
83
84
  );
@@ -116,14 +117,14 @@ const z = 5, h = class h extends s.Component {
116
117
  }
117
118
  get weekNames() {
118
119
  this.intl = y(this), this.weekService = new N(this.intl);
119
- const l = this.weekService.getWeekNames(this.weekNumber, this.props.weekDaysFormat), e = C(l, this.intl.firstDay());
120
+ const h = this.weekService.getWeekNames(this.weekNumber, this.props.weekDaysFormat), e = C(h, this.intl.firstDay());
120
121
  return this.weekNumber ? [""].concat(e) : e;
121
122
  }
122
123
  get weekNumber() {
123
124
  return !!(this.props.showWeekNumbers && this.props.activeView === n.month);
124
125
  }
125
126
  get take() {
126
- return this.props.take !== void 0 ? this.props.take : h.defaultProps.take;
127
+ return this.props.take !== void 0 ? this.props.take : l.defaultProps.take;
127
128
  }
128
129
  get animate() {
129
130
  return !!(this.props.smoothScroll && this.animateToIndex);
@@ -131,12 +132,12 @@ const z = 5, h = class h extends s.Component {
131
132
  get todayIsInRange() {
132
133
  return E(O(), d(this.props.min), d(this.props.max));
133
134
  }
134
- componentDidUpdate(l, e) {
135
+ componentDidUpdate(h, e) {
135
136
  this.shouldScroll = !1, this.indexToScroll !== void 0 && this.virtualization && this.virtualization[this.animate ? "animateToIndex" : "scrollToIndex"](this.indexToScroll), this.isActive && this.focusActiveDate(), this.lastView = this.props.activeView, this.indexToScroll = void 0;
136
137
  }
137
138
  render() {
138
139
  this.calculateHeights();
139
- const l = this.lastView !== this.props.activeView, e = u(this.props.focusedDate, this.props.min, this.props.max), t = l ? this.props.service.skip(e, this.props.min) : this.state.skip, i = this.props.service.total(this.props.min, this.props.max), a = this.getTake(t, i), r = this.props.service.addToDate(this.props.min, t), v = this.props.service.addToDate(this.props.min, this.state.index), p = new Array(this.props.service.rowLength(this.weekNumber)).fill(""), m = this.props.activeView !== this.lastView;
140
+ const h = this.lastView !== this.props.activeView, e = u(this.props.focusedDate, this.props.min, this.props.max), t = h ? this.props.service.skip(e, this.props.min) : this.state.skip, i = this.props.service.total(this.props.min, this.props.max), a = this.getTake(t, i), r = this.props.service.addToDate(this.props.min, t), v = this.props.service.addToDate(this.props.min, this.state.index), p = new Array(this.props.service.rowLength(this.weekNumber)).fill(""), m = this.props.activeView !== this.lastView;
140
141
  this.animateToIndex = !m, (m || !x(this.lastFocus, e) || this.shouldScroll || !this.props.shouldScroll || this.props.shouldScroll()) && (this.indexToScroll = this.props.service.skip(e, this.props.min)), this.lastFocus = e;
141
142
  const f = g(
142
143
  "k-calendar-view k-vstack",
@@ -146,7 +147,7 @@ const z = 5, h = class h extends s.Component {
146
147
  "k-calendar-decadeview": this.props.activeView === n.decade,
147
148
  "k-calendar-centuryview": this.props.activeView === n.century
148
149
  }
149
- ), k = this.buildDates(p, this.props.service.datesList(r, a)), w = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
150
+ ), w = this.buildDates(p, this.props.service.datesList(r, a)), k = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
150
151
  T,
151
152
  {
152
153
  key: "calendar-view-list-header",
@@ -157,6 +158,7 @@ const z = 5, h = class h extends s.Component {
157
158
  bus: this.props.bus,
158
159
  service: this.props.service,
159
160
  headerTitle: this.props.headerTitle,
161
+ header: this.props.header,
160
162
  commands: /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
161
163
  H,
162
164
  {
@@ -183,7 +185,7 @@ const z = 5, h = class h extends s.Component {
183
185
  onScroll: this.props.onScroll,
184
186
  onScrollAction: this.handleScrollAction,
185
187
  onMount: this.handleVirtualizationMount,
186
- children: k,
188
+ children: w,
187
189
  tabIndex: this.props.tabIndex
188
190
  }
189
191
  ));
@@ -195,11 +197,11 @@ const z = 5, h = class h extends s.Component {
195
197
  },
196
198
  className: f
197
199
  },
198
- this.props.dom.didCalculate ? w : null
200
+ this.props.dom.didCalculate ? k : null
199
201
  );
200
202
  }
201
203
  };
202
- h.propTypes = {
204
+ l.propTypes = {
203
205
  activeView: o.number.isRequired,
204
206
  bottomOffset: o.number,
205
207
  cellUID: o.string.isRequired,
@@ -215,13 +217,13 @@ h.propTypes = {
215
217
  viewOffset: o.number,
216
218
  weekDaysFormat: o.oneOf(["short", "abbreviated", "narrow"]),
217
219
  tabIndex: o.number
218
- }, h.defaultProps = {
220
+ }, l.defaultProps = {
219
221
  take: z,
220
222
  showWeekNumbers: !1,
221
223
  weekDaysFormat: "short",
222
224
  smoothScroll: !0
223
225
  };
224
- let c = h;
226
+ let c = l;
225
227
  S(c);
226
228
  export {
227
229
  c as ViewList