@progress/kendo-react-dateinputs 14.4.0-develop.1 → 14.4.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.
@@ -7,17 +7,17 @@
7
7
  */
8
8
  import * as i from "react";
9
9
  import { provideLocalizationService as R, registerForLocalization as M } from "@progress/kendo-react-intl";
10
- import { dateTimePickerCancel as D, messages as f, dateTimePickerSet as _, date as T, time as E } from "../messages/index.mjs";
11
- import { Button as g, ButtonGroup as x } from "@progress/kendo-react-buttons";
10
+ import { dateTimePickerCancel as C, messages as p, dateTimePickerSet as D, date as _, time as T } from "../messages/index.mjs";
11
+ import { Button as f, ButtonGroup as x } from "@progress/kendo-react-buttons";
12
12
  import { Calendar as z } from "../calendar/components/Calendar.mjs";
13
13
  import { TimePart as A } from "../timepicker/TimePart.mjs";
14
- import { MIDNIGHT_DATE as v, MAX_TIME as F, MIN_TIME as L, getToday as V, setTime as P } from "../utils.mjs";
14
+ import { MIDNIGHT_DATE as g, MAX_TIME as F, MIN_TIME as L, getToday as E, setTime as P } from "../utils.mjs";
15
15
  import { isEqualDate as k } from "@progress/kendo-date-math";
16
- import { classNames as l, uDateTimePicker as u, uTime as B, Keys as h, getActiveElement as I } from "@progress/kendo-react-common";
17
- import { getNow as w } from "../timepicker/utils.mjs";
18
- const y = class y extends i.Component {
19
- constructor(a) {
20
- super(a), this._calendar = null, this._timePart = null, this._cancelButton = null, this._acceptButton = null, this._dateButtonRef = null, this._calendarWrap = null, this.shouldFocusPart = !1, this.focus = (t) => {
16
+ import { classNames as l, uDateTimePicker as u, uTime as V, Keys as h, getActiveElement as I } from "@progress/kendo-react-common";
17
+ import { getNow as B } from "../timepicker/utils.mjs";
18
+ const b = class b extends i.Component {
19
+ constructor(s) {
20
+ super(s), this._calendar = null, this._timePart = null, this._cancelButton = null, this._acceptButton = null, this._dateButtonRef = null, this._calendarWrap = null, this.shouldFocusPart = !1, this.focus = (t) => {
21
21
  Promise.resolve().then(() => {
22
22
  this.state.tab === "time" && this._timePart && this._timePart.focus(t);
23
23
  const e = this.calendarElement();
@@ -29,30 +29,16 @@ const y = class y extends i.Component {
29
29
  const e = t === "left" ? "date" : "time";
30
30
  this.shouldFocusPart = !0, this.setState({ tab: e });
31
31
  }, this.dateTimeFooter = () => {
32
- const { cancelButton: t, unstyled: e } = this.props, s = e && e.uDateTimePicker, o = this.localizationService.toLanguageString(D, f[D]), r = this.localizationService.toLanguageString(_, f[_]);
33
- return /* @__PURE__ */ i.createElement("div", { className: l(u.timeFooter({ c: s })) }, t && /* @__PURE__ */ i.createElement(
34
- g,
35
- {
36
- type: "button",
37
- ref: (n) => {
38
- this._cancelButton = n;
39
- },
40
- className: l(B.cancel({ c: s })),
41
- onClick: this.handleReject,
42
- onKeyDown: this.handleCancelKeyDown,
43
- title: o,
44
- "aria-label": o
45
- },
46
- o
47
- ), /* @__PURE__ */ i.createElement(
48
- g,
32
+ const { cancelButton: t, unstyled: e } = this.props, a = e && e.uDateTimePicker, o = this.localizationService.toLanguageString(C, p[C]), r = this.localizationService.toLanguageString(D, p[D]);
33
+ return /* @__PURE__ */ i.createElement("div", { className: l(u.timeFooter({ c: a })) }, /* @__PURE__ */ i.createElement(
34
+ f,
49
35
  {
50
36
  type: "button",
51
37
  themeColor: "primary",
52
38
  ref: (n) => {
53
39
  this._acceptButton = n;
54
40
  },
55
- className: l(B.accept({ c: s })),
41
+ className: l(V.accept({ c: a })),
56
42
  disabled: !this.hasDateValue,
57
43
  onClick: this.handleAccept,
58
44
  onKeyDown: this.handleSetKeyDown,
@@ -60,31 +46,45 @@ const y = class y extends i.Component {
60
46
  "aria-label": r
61
47
  },
62
48
  r
49
+ ), t && /* @__PURE__ */ i.createElement(
50
+ f,
51
+ {
52
+ type: "button",
53
+ ref: (n) => {
54
+ this._cancelButton = n;
55
+ },
56
+ className: l(V.cancel({ c: a })),
57
+ onClick: this.handleReject,
58
+ onKeyDown: this.handleCancelKeyDown,
59
+ title: o,
60
+ "aria-label": o
61
+ },
62
+ o
63
63
  ));
64
64
  }, this.handleReject = (t) => {
65
- this.setState({ dateValue: this.props.value, timeValue: this.props.value || v });
66
- const e = this.mergeDate(this.props.value, this.props.value || v);
65
+ this.setState({ dateValue: this.props.value, timeValue: this.props.value || g });
66
+ const e = this.mergeDate(this.props.value, this.props.value || g);
67
67
  if (this.props.onReject) {
68
- const s = {
68
+ const a = {
69
69
  nativeEvent: t.nativeEvent,
70
70
  syntheticEvent: t,
71
71
  target: this,
72
72
  value: e
73
73
  };
74
- this.props.onReject.call(void 0, s);
74
+ this.props.onReject.call(void 0, a);
75
75
  }
76
76
  }, this.handleAccept = (t, e) => {
77
77
  if (!this.state.dateValue || !this.state.timeValue || !this.hasDateValue)
78
78
  return;
79
- const s = this.mergeDate(this.state.dateValue, e || this.state.timeValue);
79
+ const a = this.mergeDate(this.state.dateValue, e || this.state.timeValue);
80
80
  this.props.onChange.call(void 0, {
81
81
  syntheticEvent: t,
82
82
  nativeEvent: t.nativeEvent,
83
- value: s,
83
+ value: a,
84
84
  target: this
85
85
  });
86
86
  }, this.handleNowClick = (t) => {
87
- this.setState({ timeValue: w() }), this.handleAccept(t, w());
87
+ this.setState({ timeValue: B() }), this.handleAccept(t, B());
88
88
  }, this.handleCalendarValueChange = (t) => {
89
89
  t.syntheticEvent.stopPropagation(), this.setState({ dateValue: t.value, tab: "time" }), this.shouldFocusPart = !0;
90
90
  }, this.handleTimeListContainerChange = (t) => {
@@ -94,19 +94,19 @@ const y = class y extends i.Component {
94
94
  }, this.handleTimeClick = (t) => {
95
95
  t.stopPropagation(), this.move("right");
96
96
  }, this.handleKeyDown = (t) => {
97
- const { keyCode: e, altKey: s } = t;
97
+ const { keyCode: e, altKey: a } = t;
98
98
  if (!this.props.disabled)
99
99
  switch (e) {
100
100
  case h.enter:
101
101
  !this.hasActiveButton() && this.hasDateValue && this.handleAccept(t);
102
102
  return;
103
103
  case h.left:
104
- if (!s)
104
+ if (!a)
105
105
  return;
106
106
  this.move("left");
107
107
  return;
108
108
  case h.right:
109
- if (!s)
109
+ if (!a)
110
110
  return;
111
111
  this.move("right");
112
112
  return;
@@ -114,15 +114,17 @@ const y = class y extends i.Component {
114
114
  return;
115
115
  }
116
116
  }, this.handleCancelKeyDown = (t) => {
117
+ var a;
117
118
  const { keyCode: e } = t;
118
- e === h.tab && this._dateButtonRef && this._dateButtonRef.element && !this.hasDateValue && (t.preventDefault(), this._dateButtonRef.element.focus());
119
+ e === h.tab && ((a = this._dateButtonRef) != null && a.element) && (t.preventDefault(), this._dateButtonRef.element.focus());
119
120
  }, this.handleSetKeyDown = (t) => {
121
+ var a;
120
122
  const { keyCode: e } = t;
121
- e === h.tab && this._dateButtonRef && this._dateButtonRef.element && (t.preventDefault(), this._dateButtonRef.element.focus());
123
+ e === h.tab && !this.props.cancelButton && ((a = this._dateButtonRef) != null && a.element) && (t.preventDefault(), this._dateButtonRef.element.focus());
122
124
  }, this.handleDateKeyDown = (t) => {
123
- var o, r, n, d;
124
- const { keyCode: e, shiftKey: s } = t;
125
- s && e === h.tab && (t.stopPropagation(), this.hasDateValue ? (d = (n = this._acceptButton) == null ? void 0 : n.element) == null || d.focus() : (r = (o = this._cancelButton) == null ? void 0 : o.element) == null || r.focus()), e === h.enter && (t.stopPropagation(), this.move("left"));
125
+ var o, r, n;
126
+ const { keyCode: e, shiftKey: a } = t;
127
+ a && e === h.tab && (t.stopPropagation(), (o = this._cancelButton) != null && o.element ? this._cancelButton.element.focus() : (n = (r = this._acceptButton) == null ? void 0 : r.element) == null || n.focus()), e === h.enter && (t.stopPropagation(), this.move("left"));
126
128
  }, this.handleTimeKeyDown = (t) => {
127
129
  const { keyCode: e } = t;
128
130
  e === h.enter && (t.stopPropagation(), this.move("right"));
@@ -131,7 +133,7 @@ const y = class y extends i.Component {
131
133
  }, this.state = {
132
134
  tab: "date",
133
135
  dateValue: this.props.value,
134
- timeValue: this.props.value || v
136
+ timeValue: this.props.value || g
135
137
  };
136
138
  }
137
139
  get calendar() {
@@ -146,35 +148,35 @@ const y = class y extends i.Component {
146
148
  get localizationService() {
147
149
  return R(this);
148
150
  }
149
- componentDidUpdate(a, t) {
150
- var e, s;
151
- this.shouldFocusPart && this.focus({ preventScroll: !0 }), (((e = a.value) == null ? void 0 : e.getTime()) !== ((s = this.props.value) == null ? void 0 : s.getTime()) || this.state.tab !== t.tab && this.props.value) && this.setState((o) => ({
152
- dateValue: a.value && this.props.value && k(a.value, this.props.value) ? o.dateValue : this.props.value,
153
- timeValue: this.props.value || v
151
+ componentDidUpdate(s, t) {
152
+ var e, a;
153
+ this.shouldFocusPart && this.focus({ preventScroll: !0 }), (((e = s.value) == null ? void 0 : e.getTime()) !== ((a = this.props.value) == null ? void 0 : a.getTime()) || this.state.tab !== t.tab && this.props.value) && this.setState((o) => ({
154
+ dateValue: s.value && this.props.value && k(s.value, this.props.value) ? o.dateValue : this.props.value,
155
+ timeValue: this.props.value || g
154
156
  })), this.shouldFocusPart = !1;
155
157
  }
156
158
  render() {
157
- const { disabled: a, min: t, max: e, weekNumber: s, focusedDate: o, format: r, mobileMode: n, footerActions: d, unstyled: p } = this.props, m = p && p.uDateTimePicker, S = l(
159
+ const { disabled: s, min: t, max: e, weekNumber: a, focusedDate: o, format: r, mobileMode: n, footerActions: w, unstyled: d } = this.props, m = d && d.uDateTimePicker, S = l(
158
160
  u.wrap({
159
161
  c: m,
160
162
  date: this.state.tab === "date",
161
163
  time: this.state.tab === "time",
162
- disabled: a
164
+ disabled: s
163
165
  })
164
- ), K = this.localizationService.toLanguageString(T, f[T]), N = this.localizationService.toLanguageString(E, f[E]), C = {
166
+ ), K = this.localizationService.toLanguageString(_, p[_]), N = this.localizationService.toLanguageString(T, p[T]), y = {
165
167
  min: t,
166
168
  max: e,
167
- weekNumber: s,
169
+ weekNumber: a,
168
170
  focusedDate: o,
169
- disabled: a || this.state.tab !== "date",
171
+ disabled: s || this.state.tab !== "date",
170
172
  value: this.state.dateValue,
171
173
  onChange: this.handleCalendarValueChange,
172
174
  navigation: !1,
173
- tabIndex: a || this.state.tab !== "date" ? -1 : void 0,
175
+ tabIndex: s || this.state.tab !== "date" ? -1 : void 0,
174
176
  mobileMode: n
175
177
  };
176
- return /* @__PURE__ */ i.createElement("div", { onKeyDown: this.handleKeyDown, className: S, tabIndex: -1 }, /* @__PURE__ */ i.createElement("div", { className: l(u.buttonGroup({ c: m })) }, /* @__PURE__ */ i.createElement(x, { width: "100%", unstyled: p }, /* @__PURE__ */ i.createElement(
177
- g,
178
+ return /* @__PURE__ */ i.createElement("div", { onKeyDown: this.handleKeyDown, className: S, tabIndex: -1 }, /* @__PURE__ */ i.createElement("div", { className: l(u.buttonGroup({ c: m })) }, /* @__PURE__ */ i.createElement(x, { width: "100%", unstyled: d }, /* @__PURE__ */ i.createElement(
179
+ f,
178
180
  {
179
181
  ref: (c) => {
180
182
  this._dateButtonRef = c;
@@ -188,7 +190,7 @@ const y = class y extends i.Component {
188
190
  },
189
191
  K
190
192
  ), /* @__PURE__ */ i.createElement(
191
- g,
193
+ f,
192
194
  {
193
195
  type: "button",
194
196
  selected: this.state.tab === "time",
@@ -206,14 +208,14 @@ const y = class y extends i.Component {
206
208
  this._calendarWrap = c;
207
209
  }
208
210
  },
209
- this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { key: this.state.tab, ...C }) : /* @__PURE__ */ i.createElement(
211
+ this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { key: this.state.tab, ...y }) : /* @__PURE__ */ i.createElement(
210
212
  z,
211
213
  {
212
214
  key: this.state.tab,
213
215
  ref: (c) => {
214
216
  this._calendar = c;
215
217
  },
216
- ...C
218
+ ...y
217
219
  }
218
220
  )
219
221
  ), /* @__PURE__ */ i.createElement("div", { className: l(u.timeWrap({ c: m })) }, /* @__PURE__ */ i.createElement("div", { className: l(u.timeSelector({ c: m, mobileMode: n })) }, /* @__PURE__ */ i.createElement(
@@ -221,7 +223,7 @@ const y = class y extends i.Component {
221
223
  {
222
224
  key: 1,
223
225
  onNowClick: this.handleNowClick,
224
- disabled: a || this.state.tab !== "time",
226
+ disabled: s || this.state.tab !== "time",
225
227
  ref: (c) => {
226
228
  this._timePart = c;
227
229
  },
@@ -233,9 +235,9 @@ const y = class y extends i.Component {
233
235
  onChange: this.handleTimeListContainerChange,
234
236
  onMount: this.handleTimePartMount,
235
237
  mobileMode: n,
236
- unstyled: p
238
+ unstyled: d
237
239
  }
238
- )))), d && this.dateTimeFooter());
240
+ )))), w && this.dateTimeFooter());
239
241
  }
240
242
  get minTime() {
241
243
  return this.props.minTime !== void 0 ? this.props.minTime : this.normalizeRange(this.props.min, this.state.dateValue);
@@ -243,27 +245,27 @@ const y = class y extends i.Component {
243
245
  get maxTime() {
244
246
  return this.props.maxTime !== void 0 ? this.props.maxTime : this.normalizeRange(this.props.max, this.state.dateValue);
245
247
  }
246
- normalizeRange(a, t) {
247
- return k(a, t || V()) ? a : null;
248
+ normalizeRange(s, t) {
249
+ return k(s, t || E()) ? s : null;
248
250
  }
249
251
  hasActiveButton() {
250
252
  if (!this._acceptButton)
251
253
  return !1;
252
- const a = I(document);
253
- return this._acceptButton && a === this._acceptButton.element || this._cancelButton && a === this._cancelButton.element;
254
+ const s = I(document);
255
+ return this._acceptButton && s === this._acceptButton.element || this._cancelButton && s === this._cancelButton.element;
254
256
  }
255
- mergeTime(a, t) {
256
- return a && t ? P(t, a) : t;
257
+ mergeTime(s, t) {
258
+ return s && t ? P(t, s) : t;
257
259
  }
258
- mergeDate(a, t) {
259
- return a ? P(a || V(), t) : t;
260
+ mergeDate(s, t) {
261
+ return s ? P(s || E(), t) : t;
260
262
  }
261
263
  };
262
- y.defaultProps = {
264
+ b.defaultProps = {
263
265
  footerActions: !0
264
266
  };
265
- let b = y;
266
- M(b);
267
+ let v = b;
268
+ M(v);
267
269
  export {
268
- b as DateTimeSelector
270
+ v as DateTimeSelector
269
271
  };