@progress/kendo-react-dateinputs 7.5.0-develop.1 → 7.5.0-develop.11

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.
@@ -9,17 +9,18 @@
9
9
  import * as s from "react";
10
10
  import o from "prop-types";
11
11
  import { classNames as g } from "@progress/kendo-react-common";
12
- import { cloneDate as x, getDate as d, isEqualDate as D } from "@progress/kendo-date-math";
13
- import { provideIntlService as y, registerForIntl as V } from "@progress/kendo-react-intl";
14
- import { Virtualization as S } from "../../virtualization/Virtualization.mjs";
12
+ import { cloneDate as D, getDate as d, isEqualDate as x } from "@progress/kendo-date-math";
13
+ import { provideIntlService as y, registerForIntl as S } from "@progress/kendo-react-intl";
14
+ import { Virtualization as V } from "../../virtualization/Virtualization.mjs";
15
15
  import { View as I } from "./View.mjs";
16
16
  import { Header as T } from "./Header.mjs";
17
- import { dateInRange as u, shiftWeekNames as C, isInRange as E, getToday as N } from "../../utils.mjs";
18
- import { CalendarViewEnum as l } from "../models/CalendarViewEnum.mjs";
19
- import { TodayCommand as O } from "./TodayCommand.mjs";
20
- const H = 5, h = class h extends s.Component {
21
- constructor(r) {
22
- super(r), this.virtualization = null, this.calendarView = null, this.table = null, this.intl = null, this.bottomOffset = 0, this.viewOffset = 0, this.viewHeight = 0, this._element = null, this.isActive = !1, this.animateToIndex = !0, this.shouldScroll = !1, this.focusActiveDate = () => {
17
+ import { WeekNamesService as N } from "../services/WeekNamesService.mjs";
18
+ import { dateInRange as u, shiftWeekNames as C, isInRange as E, getToday as O } from "../../utils.mjs";
19
+ import { CalendarViewEnum as n } from "../models/CalendarViewEnum.mjs";
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 = () => {
23
24
  if (!this._element)
24
25
  return;
25
26
  const e = this._element.querySelector("td.k-focus"), t = this._element.querySelector(".k-state-pending-focus");
@@ -56,12 +57,12 @@ const H = 5, h = class h extends s.Component {
56
57
  tabIndex: this.props.tabIndex,
57
58
  "aria-activedescendant": i + this.props.focusedDate.getTime()
58
59
  },
59
- /* @__PURE__ */ s.createElement("colgroup", null, e.map((a, n) => /* @__PURE__ */ s.createElement("col", { key: n }))),
60
+ /* @__PURE__ */ s.createElement("colgroup", null, e.map((a, r) => /* @__PURE__ */ s.createElement("col", { key: r }))),
60
61
  t.map((a) => /* @__PURE__ */ s.createElement(
61
62
  I,
62
63
  {
63
- ref: (n) => {
64
- this.calendarView || (this.calendarView = n);
64
+ ref: (r) => {
65
+ this.calendarView || (this.calendarView = r);
65
66
  },
66
67
  key: a.getTime(),
67
68
  activeView: this.props.activeView,
@@ -83,13 +84,13 @@ const H = 5, h = class h extends s.Component {
83
84
  }, this.calculateHeights = () => {
84
85
  if (!this.props.dom)
85
86
  return;
86
- const e = this.props.activeView === l.month ? this.props.dom.scrollableContentHeight : this.props.dom.scrollableYearContentHeight;
87
+ const e = this.props.activeView === n.month ? this.props.dom.scrollableContentHeight : this.props.dom.scrollableYearContentHeight;
87
88
  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;
88
89
  }, this.getTake = (e, t) => Math.min(t - e, this.take), this.handleScrollAction = ({ index: e, scrollAction: t, pageAction: i }) => {
89
90
  const a = i ? i.skip : this.state.skip;
90
91
  if ((this.state.index !== e || this.state.skip !== a) && this.setState({ index: e, skip: a }), this.table && t) {
91
- const n = `translateY(${t.offset}px)`;
92
- this.table.style.transform = n;
92
+ const r = `translateY(${t.offset}px)`;
93
+ this.table.style.transform = r;
93
94
  }
94
95
  }, this.handleTodayClick = (e) => {
95
96
  this.shouldScroll = !0, this.handleDateChange.call(void 0, e, !0);
@@ -99,7 +100,7 @@ const H = 5, h = class h extends s.Component {
99
100
  const a = {
100
101
  syntheticEvent: e.syntheticEvent,
101
102
  nativeEvent: e.nativeEvent,
102
- value: x(e.value),
103
+ value: D(e.value),
103
104
  target: this,
104
105
  isTodayClick: t
105
106
  };
@@ -114,15 +115,12 @@ const H = 5, h = class h extends s.Component {
114
115
  return this._element;
115
116
  }
116
117
  get weekNames() {
117
- this.intl = y(this);
118
- const r = C(
119
- this.intl.dateFormatNames({ nameType: "short", type: "days" }),
120
- this.intl.firstDay()
121
- );
122
- return this.weekNumber ? [""].concat(r) : r;
118
+ 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
+ return this.weekNumber ? [""].concat(e) : e;
123
121
  }
124
122
  get weekNumber() {
125
- return !!(this.props.showWeekNumbers && this.props.activeView === l.month);
123
+ return !!(this.props.showWeekNumbers && this.props.activeView === n.month);
126
124
  }
127
125
  get take() {
128
126
  return this.props.take !== void 0 ? this.props.take : h.defaultProps.take;
@@ -131,28 +129,28 @@ const H = 5, h = class h extends s.Component {
131
129
  return !!(this.props.smoothScroll && this.animateToIndex);
132
130
  }
133
131
  get todayIsInRange() {
134
- return E(N(), d(this.props.min), d(this.props.max));
132
+ return E(O(), d(this.props.min), d(this.props.max));
135
133
  }
136
- componentDidUpdate(r, e) {
134
+ componentDidUpdate(l, e) {
137
135
  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;
138
136
  }
139
137
  render() {
140
138
  this.calculateHeights();
141
- const r = this.lastView !== this.props.activeView, e = u(this.props.focusedDate, this.props.min, this.props.max), t = r ? 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), f = 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;
142
- this.animateToIndex = !m, (m || !D(this.lastFocus, e) || this.shouldScroll || !this.props.shouldScroll || this.props.shouldScroll()) && (this.indexToScroll = this.props.service.skip(e, this.props.min)), this.lastFocus = e;
143
- const v = g(
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
+ 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
+ const f = g(
144
142
  "k-calendar-view k-vstack",
145
143
  {
146
- "k-calendar-monthview": this.props.activeView === l.month,
147
- "k-calendar-yearview": this.props.activeView === l.year,
148
- "k-calendar-decadeview": this.props.activeView === l.decade,
149
- "k-calendar-centuryview": this.props.activeView === l.century
144
+ "k-calendar-monthview": this.props.activeView === n.month,
145
+ "k-calendar-yearview": this.props.activeView === n.year,
146
+ "k-calendar-decadeview": this.props.activeView === n.decade,
147
+ "k-calendar-centuryview": this.props.activeView === n.century
150
148
  }
151
- ), w = this.buildDates(p, this.props.service.datesList(n, a)), k = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
149
+ ), k = this.buildDates(p, this.props.service.datesList(r, a)), w = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
152
150
  T,
153
151
  {
154
152
  key: "calendar-view-list-header",
155
- currentDate: f,
153
+ currentDate: v,
156
154
  min: this.props.min,
157
155
  max: this.props.max,
158
156
  activeView: this.props.activeView,
@@ -160,7 +158,7 @@ const H = 5, h = class h extends s.Component {
160
158
  service: this.props.service,
161
159
  headerTitle: this.props.headerTitle,
162
160
  commands: /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
163
- O,
161
+ H,
164
162
  {
165
163
  min: this.props.min,
166
164
  max: this.props.max,
@@ -170,8 +168,8 @@ const H = 5, h = class h extends s.Component {
170
168
  }
171
169
  ))
172
170
  }
173
- ), this.props.activeView === l.month && this.buildMonthView(p, this.weekNames), /* @__PURE__ */ s.createElement(
174
- S,
171
+ ), this.props.activeView === n.month && this.buildMonthView(p, this.weekNames), /* @__PURE__ */ s.createElement(
172
+ V,
175
173
  {
176
174
  key: "calendar-view-list-content",
177
175
  skip: t,
@@ -185,7 +183,7 @@ const H = 5, h = class h extends s.Component {
185
183
  onScroll: this.props.onScroll,
186
184
  onScrollAction: this.handleScrollAction,
187
185
  onMount: this.handleVirtualizationMount,
188
- children: w,
186
+ children: k,
189
187
  tabIndex: this.props.tabIndex
190
188
  }
191
189
  ));
@@ -195,9 +193,9 @@ const H = 5, h = class h extends s.Component {
195
193
  ref: (b) => {
196
194
  this._element = b;
197
195
  },
198
- className: v
196
+ className: f
199
197
  },
200
- this.props.dom.didCalculate ? k : null
198
+ this.props.dom.didCalculate ? w : null
201
199
  );
202
200
  }
203
201
  };
@@ -215,14 +213,16 @@ h.propTypes = {
215
213
  value: o.instanceOf(Date),
216
214
  viewHeight: o.number,
217
215
  viewOffset: o.number,
216
+ weekDaysFormat: o.oneOf(["short", "abbreviated", "narrow"]),
218
217
  tabIndex: o.number
219
218
  }, h.defaultProps = {
220
- take: H,
219
+ take: z,
221
220
  showWeekNumbers: !1,
221
+ weekDaysFormat: "short",
222
222
  smoothScroll: !0
223
223
  };
224
224
  let c = h;
225
- V(c);
225
+ S(c);
226
226
  export {
227
227
  c as ViewList
228
228
  };
@@ -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 s=require("../../utils.js");class a{constructor(e){this.intl=e}getWeekNames(e=!1){const t=s.shiftWeekNames(this.intl.dateFormatNames({nameType:"short",type:"days"}),this.intl.firstDay());return e?[""].concat(t):t}}exports.WeekNamesService=a;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../utils.js");class c{constructor(e){this.intl=e}getWeekNames(e=!1,t){const s=i.shiftWeekNames(this.intl.dateFormatNames({nameType:t!=null?t:"short",type:"days"}),this.intl.firstDay());return e?[""].concat(s):s}}exports.WeekNamesService=c;
@@ -6,17 +6,17 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import { shiftWeekNames as s } from "../../utils.mjs";
9
+ import { shiftWeekNames as i } from "../../utils.mjs";
10
10
  class r {
11
11
  constructor(e) {
12
12
  this.intl = e;
13
13
  }
14
- getWeekNames(e = !1) {
15
- const t = s(
16
- this.intl.dateFormatNames({ nameType: "short", type: "days" }),
14
+ getWeekNames(e = !1, t) {
15
+ const s = i(
16
+ this.intl.dateFormatNames({ nameType: t != null ? t : "short", type: "days" }),
17
17
  this.intl.firstDay()
18
18
  );
19
- return e ? [""].concat(t) : t;
19
+ return e ? [""].concat(s) : s;
20
20
  }
21
21
  }
22
22
  export {