@progress/kendo-react-dateinputs 7.4.0 → 7.5.0-develop.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calendar/components/Calendar.js +2 -2
- package/calendar/components/Calendar.mjs +38 -35
- package/calendar/components/CalendarHeaderTitle.js +1 -1
- package/calendar/components/CalendarHeaderTitle.mjs +1 -1
- package/calendar/components/Header.js +1 -1
- package/calendar/components/Header.mjs +2 -3
- package/calendar/components/HorizontalViewList.js +1 -1
- package/calendar/components/HorizontalViewList.mjs +3 -1
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +94 -91
- package/calendar/components/TodayCommand.js +1 -1
- package/calendar/components/TodayCommand.mjs +3 -1
- package/calendar/components/View.js +1 -1
- package/calendar/components/View.mjs +6 -6
- package/calendar/components/ViewList.js +1 -1
- package/calendar/components/ViewList.mjs +42 -42
- package/calendar/services/WeekNamesService.js +1 -1
- package/calendar/services/WeekNamesService.mjs +5 -5
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +0 -1
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +21 -21
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +33 -6
- package/index.d.ts +33 -6
- package/messages/index.js +1 -1
- package/messages/index.mjs +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +7 -7
- package/timepicker/TimeList.js +6 -6
- package/timepicker/TimeList.mjs +52 -60
- package/timepicker/TimePart.js +1 -1
- package/timepicker/TimePart.mjs +4 -4
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +2 -3
- package/timepicker/TimeSelector.js +1 -1
- package/timepicker/TimeSelector.mjs +6 -6
|
@@ -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
|
|
13
|
-
import { provideIntlService as y, registerForIntl as
|
|
14
|
-
import { Virtualization as
|
|
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 {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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,
|
|
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: (
|
|
64
|
-
this.calendarView || (this.calendarView =
|
|
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 ===
|
|
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
|
|
92
|
-
this.table.style.transform =
|
|
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:
|
|
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
|
|
119
|
-
|
|
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 ===
|
|
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(
|
|
132
|
+
return E(O(), d(this.props.min), d(this.props.max));
|
|
135
133
|
}
|
|
136
|
-
componentDidUpdate(
|
|
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
|
|
142
|
-
this.animateToIndex = !m, (m || !
|
|
143
|
-
const
|
|
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 ===
|
|
147
|
-
"k-calendar-yearview": this.props.activeView ===
|
|
148
|
-
"k-calendar-decadeview": this.props.activeView ===
|
|
149
|
-
"k-calendar-centuryview": this.props.activeView ===
|
|
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
|
-
),
|
|
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:
|
|
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
|
-
|
|
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 ===
|
|
174
|
-
|
|
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:
|
|
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:
|
|
196
|
+
className: f
|
|
199
197
|
},
|
|
200
|
-
this.props.dom.didCalculate ?
|
|
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:
|
|
219
|
+
take: z,
|
|
221
220
|
showWeekNumbers: !1,
|
|
221
|
+
weekDaysFormat: "short",
|
|
222
222
|
smoothScroll: !0
|
|
223
223
|
};
|
|
224
224
|
let c = h;
|
|
225
|
-
|
|
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
|
|
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
|
|
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
|
|
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(
|
|
19
|
+
return e ? [""].concat(s) : s;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
export {
|
package/datepicker/DatePicker.js
CHANGED
|
@@ -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 W=require("react"),e=require("prop-types"),_=require("@progress/kendo-react-popup"),I=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),U=require("@progress/kendo-svg-icons"),j=require("../package-metadata.js"),$=require("../dateinput/DateInput.js"),H=require("../calendar/components/Calendar.js"),m=require("../utils.js"),D=require("../messages/index.js"),q=require("@progress/kendo-react-intl"),X=require("./ToggleButton.js"),Z=require("../common/PickerWrap.js"),G=require("../hooks/usePickerFloatingLabel.js"),J=require("@progress/kendo-react-layout"),Q=require("../common/AdaptiveMode.js"),Y=require("../common/constants.js");function ee(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>l[t]})}}return s.default=l,Object.freeze(s)}const r=ee(W),o=class o extends r.Component{constructor(s){super(s),this._element=null,this._dateInput=r.createRef(),this._calendar=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.setCalendarRef=t=>{this._calendar=t},this.nextValue=(t,i)=>t.value!==void 0?t.value:i.value,this.nextShow=(t,i)=>t.show!==void 0?t.show:i.show,this.renderPopup=()=>{const{disabled:t,min:i,max:a,weekNumber:g,focusedDate:f,popupSettings:d}=this.props,{popupClass:v,...w}=d,b=this.show,h=this.value,y=h&&I.getDate(h),p=n.classNames("k-calendar-container k-group k-reset",v),k={popupClass:"k-datepicker-popup",show:b,anchor:this._element,className:p,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...w},c={disabled:t,value:y,min:i,max:a,weekNumber:g,focusedDate:f,className:this.mobileMode?"k-calendar-lg":"",navigation:!this.mobileMode,onChange:this.handleCalendarValueChange};return this.mobileMode?r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}):r.createElement(this.popupComp,{...k},r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}))},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,i={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t};return r.createElement(Q.AdaptiveMode,{...i},r.createElement(J.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderPopup()))},this.handleInputValueChange=t=>{this.handleValueChange(t.value,t)},this.handleCalendarValueChange=t=>{const i=this.mergeTime(t.value);this.handleValueChange(i,t)},this.handleValueChange=(t,i)=>{this.setState({value:I.cloneDate(t||void 0)}),this.valueDuringOnChange=t,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:a}=this.props;a&&a.call(void 0,{syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:i,keyCode:a}=t;if(a===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(a===n.Keys.up||a===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=a===n.Keys.up,this.setShow(a===n.Keys.down))},n.validatePackage(j.packageMetadata),this.state={value:this.props.defaultValue||o.defaultProps.defaultValue,show:this.props.defaultShow||o.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=Y.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get dateInput(){return this._dateInput.current}get calendar(){return this._calendar}get value(){const s=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return s!==null?I.cloneDate(s):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:o.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:o.defaultProps.max}get dateInputComp(){return this.props.dateInput||o.defaultProps.dateInput}get toggleButtonComp(){return this.props.toggleButton||o.defaultProps.toggleButton}get calendarComp(){return this.props.calendar||o.defaultProps.calendar}get popupComp(){return this.props.popup||o.defaultProps.popup}get pickerWrapComp(){return this.props.pickerWrap||o.defaultProps.pickerWrap}get validity(){const s=m.isInDateRange(this.value,this.min,this.max),t=this.props.validationMessage!==void 0,i=(!this.required||this.value!==null)&&s,a=this.props.valid!==void 0?this.props.valid:i;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:a,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:o.defaultProps.required}componentDidMount(){var s;this.observerResize=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._calendar&&this._calendar.element&&this.show&&!this.prevShow&&this._calendar.element.focus({preventScroll:!0}),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var s;clearTimeout(this.nextTickId),(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:s=o.defaultProps.size,rounded:t=o.defaultProps.rounded,fillMode:i=o.defaultProps.fillMode,disabled:a,tabIndex:g,title:f,id:d,format:v,formatPlaceholder:w,min:b,max:h,className:y,width:p,name:k,validationMessage:c,required:E,validityStyles:R,ariaLabelledBy:z,ariaDescribedBy:F,ariaLabel:N,placeholder:V,label:C,popupSettings:te,defaultValue:se,defaultShow:ie,value:oe,popup:ae,weekNumber:ne,dateInput:re,calendar:le,toggleButton:ue,onChange:de,onBlur:he,onFocus:pe,show:ce,onOpen:me,pickerWrap:ge,...O}=this.props,A=this.value,S=!this.validityStyles||this.validity.valid,L={disabled:a,format:v,formatPlaceholder:w,id:d,ariaLabelledBy:z,ariaDescribedBy:F,ariaLabel:N,max:h,min:b,name:k,onChange:this.handleInputValueChange,required:E,tabIndex:this.show?-1:g,title:f,valid:this.validity.valid,validationMessage:c,validityStyles:R,value:A,label:void 0,placeholder:this.state.focused?null:V,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},M=q.provideLocalizationService(this).toLanguageString(D.toggleCalendar,D.messages[D.toggleCalendar]),P=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},T=>r.createElement(r.Fragment,null,r.createElement("span",{...C?{}:O,ref:K=>{this._element=K},className:n.classNames("k-input","k-datepicker",{[`k-input-${n.kendoThemeMaps.sizeMap[s]||s}`]:s,[`k-rounded-${n.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${i}`]:i,"k-invalid":!S,"k-required":this.required,"k-disabled":a},y),onKeyDown:this.handleKeyDown,style:{width:p},onFocus:T.onFocus,onBlur:T.onBlur,onClick:this.mobileMode?this.handleIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",readonly:this.mobileMode,ariaExpanded:this.show,ariaControls:this._popupId,...L}),r.createElement(this.toggleButtonComp,{type:"button",icon:"calendar",svgIcon:U.calendarIcon,title:M,className:"k-input-button",rounded:null,onClick:this.mobileMode?void 0:this.handleIconClick,"aria-label":M,onMouseDown:this.handleIconMouseDown}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return C?r.createElement(G.PickerFloatingLabel,{dateInput:this._dateInput,label:C,editorId:d,editorValid:S,editorDisabled:a,children:P,style:{width:p},...O}):P}setShow(s){const{onOpen:t,onClose:i}=this.props;this.show!==s&&(this.setState({show:s}),s&&t&&t.call(void 0,{target:this}),!s&&i&&i.call(void 0,{target:this}))}mergeTime(s){return this.value&&s?m.setTime(s,this.value):s}nextTick(s){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>s())}calculateMedia(s){for(let t of s)this.setState({windowWidth:t.target.clientWidth})}};o.displayName="DatePicker",o.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,ariaLabel:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),adaptive:e.bool,adaptiveTitle:e.string},o.defaultProps={defaultShow:!1,defaultValue:null,dateInput:$.DateInput,calendar:H.Calendar,toggleButton:X.ToggleButton,popup:_.Popup,pickerWrap:Z.PickerWrap,disabled:!1,format:"d",max:m.MAX_DATE,min:m.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid"};let u=o;const x=n.createPropsContext(),B=n.withIdHOC(n.withPropsContext(x,u));B.displayName="KendoReactDatePicker";q.registerForLocalization(u);exports.DatePicker=B;exports.DatePickerPropsContext=x;exports.DatePickerWithoutContext=u;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react"),e=require("prop-types"),_=require("@progress/kendo-react-popup"),I=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),U=require("@progress/kendo-svg-icons"),j=require("../package-metadata.js"),$=require("../dateinput/DateInput.js"),H=require("../calendar/components/Calendar.js"),m=require("../utils.js"),D=require("../messages/index.js"),q=require("@progress/kendo-react-intl"),X=require("./ToggleButton.js"),Z=require("../common/PickerWrap.js"),G=require("../hooks/usePickerFloatingLabel.js"),J=require("@progress/kendo-react-layout"),Q=require("../common/AdaptiveMode.js"),Y=require("../common/constants.js");function ee(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>l[t]})}}return s.default=l,Object.freeze(s)}const r=ee(W),o=class o extends r.Component{constructor(s){super(s),this._element=null,this._dateInput=r.createRef(),this._calendar=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.setCalendarRef=t=>{this._calendar=t},this.nextValue=(t,i)=>t.value!==void 0?t.value:i.value,this.nextShow=(t,i)=>t.show!==void 0?t.show:i.show,this.renderPopup=()=>{const{disabled:t,min:i,max:a,weekNumber:g,focusedDate:f,popupSettings:d}=this.props,{popupClass:v,...w}=d,b=this.show,h=this.value,y=h&&I.getDate(h),p=n.classNames(v),C={popupClass:"k-datepicker-popup",show:b,anchor:this._element,className:p,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...w},c={disabled:t,value:y,min:i,max:a,weekNumber:g,focusedDate:f,className:this.mobileMode?"k-calendar-lg":"",navigation:!this.mobileMode,onChange:this.handleCalendarValueChange};return this.mobileMode?r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}):r.createElement(this.popupComp,{...C},r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}))},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,i={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t};return r.createElement(Q.AdaptiveMode,{...i},r.createElement(J.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderPopup()))},this.handleInputValueChange=t=>{this.handleValueChange(t.value,t)},this.handleCalendarValueChange=t=>{const i=this.mergeTime(t.value);this.handleValueChange(i,t)},this.handleValueChange=(t,i)=>{this.setState({value:I.cloneDate(t||void 0)}),this.valueDuringOnChange=t,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:a}=this.props;a&&a.call(void 0,{syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:i,keyCode:a}=t;if(a===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(a===n.Keys.up||a===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=a===n.Keys.up,this.setShow(a===n.Keys.down))},n.validatePackage(j.packageMetadata),this.state={value:this.props.defaultValue||o.defaultProps.defaultValue,show:this.props.defaultShow||o.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=Y.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get dateInput(){return this._dateInput.current}get calendar(){return this._calendar}get value(){const s=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return s!==null?I.cloneDate(s):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:o.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:o.defaultProps.max}get dateInputComp(){return this.props.dateInput||o.defaultProps.dateInput}get toggleButtonComp(){return this.props.toggleButton||o.defaultProps.toggleButton}get calendarComp(){return this.props.calendar||o.defaultProps.calendar}get popupComp(){return this.props.popup||o.defaultProps.popup}get pickerWrapComp(){return this.props.pickerWrap||o.defaultProps.pickerWrap}get validity(){const s=m.isInDateRange(this.value,this.min,this.max),t=this.props.validationMessage!==void 0,i=(!this.required||this.value!==null)&&s,a=this.props.valid!==void 0?this.props.valid:i;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:a,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:o.defaultProps.required}componentDidMount(){var s;this.observerResize=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._calendar&&this._calendar.element&&this.show&&!this.prevShow&&this._calendar.element.focus({preventScroll:!0}),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var s;clearTimeout(this.nextTickId),(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:s=o.defaultProps.size,rounded:t=o.defaultProps.rounded,fillMode:i=o.defaultProps.fillMode,disabled:a,tabIndex:g,title:f,id:d,format:v,formatPlaceholder:w,min:b,max:h,className:y,width:p,name:C,validationMessage:c,required:E,validityStyles:R,ariaLabelledBy:z,ariaDescribedBy:F,ariaLabel:N,placeholder:V,label:k,popupSettings:te,defaultValue:se,defaultShow:ie,value:oe,popup:ae,weekNumber:ne,dateInput:re,calendar:le,toggleButton:ue,onChange:de,onBlur:he,onFocus:pe,show:ce,onOpen:me,pickerWrap:ge,...O}=this.props,A=this.value,S=!this.validityStyles||this.validity.valid,L={disabled:a,format:v,formatPlaceholder:w,id:d,ariaLabelledBy:z,ariaDescribedBy:F,ariaLabel:N,max:h,min:b,name:C,onChange:this.handleInputValueChange,required:E,tabIndex:this.show?-1:g,title:f,valid:this.validity.valid,validationMessage:c,validityStyles:R,value:A,label:void 0,placeholder:this.state.focused?null:V,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},M=q.provideLocalizationService(this).toLanguageString(D.toggleCalendar,D.messages[D.toggleCalendar]),P=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},T=>r.createElement(r.Fragment,null,r.createElement("span",{...k?{}:O,ref:K=>{this._element=K},className:n.classNames("k-input","k-datepicker",{[`k-input-${n.kendoThemeMaps.sizeMap[s]||s}`]:s,[`k-rounded-${n.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${i}`]:i,"k-invalid":!S,"k-required":this.required,"k-disabled":a},y),onKeyDown:this.handleKeyDown,style:{width:p},onFocus:T.onFocus,onBlur:T.onBlur,onClick:this.mobileMode?this.handleIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",readonly:this.mobileMode,ariaExpanded:this.show,ariaControls:this._popupId,...L}),r.createElement(this.toggleButtonComp,{type:"button",icon:"calendar",svgIcon:U.calendarIcon,title:M,className:"k-input-button",rounded:null,onClick:this.mobileMode?void 0:this.handleIconClick,"aria-label":M,onMouseDown:this.handleIconMouseDown}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return k?r.createElement(G.PickerFloatingLabel,{dateInput:this._dateInput,label:k,editorId:d,editorValid:S,editorDisabled:a,children:P,style:{width:p},...O}):P}setShow(s){const{onOpen:t,onClose:i}=this.props;this.show!==s&&(this.setState({show:s}),s&&t&&t.call(void 0,{target:this}),!s&&i&&i.call(void 0,{target:this}))}mergeTime(s){return this.value&&s?m.setTime(s,this.value):s}nextTick(s){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>s())}calculateMedia(s){for(let t of s)this.setState({windowWidth:t.target.clientWidth})}};o.displayName="DatePicker",o.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,ariaLabel:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),adaptive:e.bool,adaptiveTitle:e.string},o.defaultProps={defaultShow:!1,defaultValue:null,dateInput:$.DateInput,calendar:H.Calendar,toggleButton:X.ToggleButton,popup:_.Popup,pickerWrap:Z.PickerWrap,disabled:!1,format:"d",max:m.MAX_DATE,min:m.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid"};let u=o;const x=n.createPropsContext(),B=n.withIdHOC(n.withPropsContext(x,u));B.displayName="KendoReactDatePicker";q.registerForLocalization(u);exports.DatePicker=B;exports.DatePickerPropsContext=x;exports.DatePickerWithoutContext=u;
|
|
@@ -32,7 +32,6 @@ const o = class o extends n.Component {
|
|
|
32
32
|
this._calendar = t;
|
|
33
33
|
}, this.nextValue = (t, s) => t.value !== void 0 ? t.value : s.value, this.nextShow = (t, s) => t.show !== void 0 ? t.show : s.show, this.renderPopup = () => {
|
|
34
34
|
const { disabled: t, min: s, max: a, weekNumber: c, focusedDate: m, popupSettings: l } = this.props, { popupClass: f, ...g } = l, v = this.show, d = this.value, w = d && W(d), u = M(
|
|
35
|
-
"k-calendar-container k-group k-reset",
|
|
36
35
|
f
|
|
37
36
|
), b = {
|
|
38
37
|
popupClass: "k-datepicker-popup",
|
|
@@ -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 R=require("react"),t=require("prop-types"),M=require("@progress/kendo-react-popup"),D=require("@progress/kendo-date-math"),r=require("@progress/kendo-react-common"),c=require("@progress/kendo-react-intl"),O=require("@progress/kendo-svg-icons"),k=require("../package-metadata.js"),g=require("../dateinput/DateInput.js"),T=require("../calendar/components/MultiViewCalendar.js"),h=require("../calendar/models/SelectionRange.js"),d=require("../utils.js"),x=require("../common/constants.js"),n=require("../messages/index.js"),P=require("@progress/kendo-react-buttons"),_=require("../common/AdaptiveMode.js"),N=require("@progress/kendo-react-layout");function A(u){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const e in u)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(u,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>u[e]})}}return a.default=u,Object.freeze(a)}const i=A(R),l=class l extends i.Component{constructor(a){super(a),this._element=null,this._calendar=null,this._startDateInput=i.createRef(),this._endDateInput=i.createRef(),this.shouldFocusDateInput=!1,this.shouldFocusCalendar=!1,this.focus=()=>{this.startDateInput&&this.startDateInput.focus()},this.setCalendarRef=e=>{this._calendar=e},this.focusCalendarElement=()=>{this._calendar&&this._calendar.element&&this._calendar.element.focus({preventScroll:!0})},this.calculateValue=(e,s)=>(e.value!==void 0?e.value:s.value)||h.EMPTY_SELECTIONRANGE,this.calculateShow=(e,s)=>e.show!==void 0?e.show:s.show,this.renderCalendar=()=>{const e=this.value||h.EMPTY_SELECTIONRANGE,s={min:this.min,max:this.max,allowReverse:this.props.allowReverse,mode:"range",focusedDate:this.props.focusedDate,disabled:this.props.disabled,className:this.mobileMode?"k-calendar-lg":"",mobileMode:this.mobileMode,...this.props.calendarSettings,value:e,dir:this.props.dir,onChange:this.handleCalendarChange};return this.props.calendar?i.createElement(this.props.calendar,{...s}):i.createElement(T.MultiViewCalendar,{...s,ref:this.setCalendarRef})},this.renderPopup=()=>{const e={popupClass:"k-daterangepicker-popup",animate:this._element!==null,anchor:this._element,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...this.props.popupSettings,show:this.show};return this.props.popup?i.createElement(this.props.popup,{...e},this.renderCalendar()):i.createElement(M.Popup,{...e},this.renderCalendar())},this.renderAdaptivePopup=()=>{const{windowWidth:e=0}=this.state,s={expand:this.show,onClose:o=>this.handleCancel(o),adaptiveTitle:this.props.adaptiveTitle,windowWidth:e,footer:{cancelText:this.localizationService.toLanguageString(n.dateRangePickerCancel,n.messages[n.dateRangePickerCancel]),onCancel:this.handleCancel,applyText:this.localizationService.toLanguageString(n.dateRangePickerSet,n.messages[n.dateRangePickerSet]),onApply:this.handleBlur}};return i.createElement(_.AdaptiveMode,{...s},i.createElement(N.ActionSheetContent,{className:"!k-overflow-hidden"},i.createElement("div",{className:"k-scrollable-wrap"},this.renderCalendar())))},this.handleReverseClick=e=>{const s={start:this.value.end,end:this.value.start},o={syntheticEvent:e,nativeEvent:e.nativeEvent};this.handleChange(s,o)},this.handleReverseMouseDown=e=>{e.preventDefault()},this.handleFocus=e=>{clearTimeout(this.nextTickId),this.shouldFocusDateInput||this.mobileMode&&this.setState({currentValue:this.value});const{onFocus:s}=this.props;s&&s.call(void 0,e)},this.handleClick=()=>{this.shouldFocusDateInput||this.setShow(!0)},this.handleBlur=e=>{this.nextTick(()=>{this.setShow(!1)});const{onBlur:s}=this.props;s&&s.call(void 0,e)},this.handleCancel=e=>{this.nextTick(()=>{this.setShow(!1),this.setState({currentValue:h.EMPTY_SELECTIONRANGE})});const{onCancel:s}=this.props;s&&s.call(void 0,e)},this.handleEndChange=e=>{const s={start:this.value.start,end:D.cloneDate(e.value||void 0)};this.handleChange(s,e)},this.handleStartChange=e=>{const s={start:D.cloneDate(e.value||void 0),end:this.value.end};this.handleChange(s,e)},this.extractRangeFromValue=e=>{if(!Array.isArray(e.value)&&!(e.value instanceof Date))return e.value||h.EMPTY_SELECTIONRANGE;const s=Array.isArray(e.value)?e.value[0]:e.value;return{start:this.value.end!==null?s:this.value.start,end:this.value.start!==null?s:this.value.end}},this.handleCalendarChange=e=>{const s=this.extractRangeFromValue(e);this.handleChange(s,e)},this.handleKeyDown=e=>{const{keyCode:s,altKey:o}=e;s===r.Keys.esc?(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1)):o&&s===r.Keys.down?(e.preventDefault(),this.shouldFocusCalendar=!0,this.setShow(!0),this.focusCalendarElement()):o&&s===r.Keys.up&&(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1))},this.handleChange=(e,s)=>{this.setState({value:e}),this.valueDuringOnChange=e;const{onChange:o}=this.props;if(o){const m={syntheticEvent:s.syntheticEvent,nativeEvent:s.nativeEvent,value:this.value,show:this.show,target:this};o.call(void 0,m)}this.valueDuringOnChange=void 0},r.validatePackage(k.packageMetadata),this.state={show:this.props.show||this.props.defaultShow||l.defaultProps.defaultShow,value:this.props.value||this.props.defaultValue||l.defaultProps.defaultValue,currentValue:h.EMPTY_SELECTIONRANGE},this.nextTick=this.nextTick.bind(this),this.setShow=this.setShow.bind(this),this.focusCalendarElement=this.focusCalendarElement.bind(this),this.focusDateInputElement=this.focusDateInputElement.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get _startInputId(){return this.props.id+"-start-input-id"}get _endInputId(){return this.props.id+"-end-input-id"}get element(){return this._element}get startDateInput(){return this._startDateInput.current}get endDateInput(){return this._endDateInput.current}get calendar(){return this._calendar}get value(){return(this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value)||h.EMPTY_SELECTIONRANGE}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get min(){return this.props.min!==void 0?this.props.min:l.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:l.defaultProps.max}get document(){if(r.canUseDOM)return this.element&&this.element.ownerDocument||document}get localizationService(){return c.provideLocalizationService(this)}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=x.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}componentDidMount(){var a;this.observerResize=r.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this.shouldFocusCalendar&&this.focusCalendarElement(),this.shouldFocusDateInput&&this.focusDateInputElement(),this.shouldFocusCalendar=!1,this.shouldFocusDateInput=!1}componentWillUnmount(){var a;clearTimeout(this.nextTickId),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.disconnect()}render(){const a=this.value||h.EMPTY_SELECTIONRANGE,e=this.mobileMode&&this.show?this.state.currentValue:a,s=(this.props.startDateInputSettings||{}).id||this._startInputId,o=(this.props.endDateInputSettings||{}).id||this._endInputId,m=r.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),b=this.localizationService.toLanguageString(n.start,n.messages[n.start]),E=this.localizationService.toLanguageString(n.end,n.messages[n.end]),S=this.localizationService.toLanguageString(n.separator,n.messages[n.separator]),f={disableSelection:this.mobileMode&&!0,label:b,format:this.props.format,min:this.min,max:this.max,id:this._startInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,...this.props.startDateInputSettings,value:e.start,onChange:this.handleStartChange},v={disableSelection:this.mobileMode&&!0,label:E,format:this.props.format,min:this.min,max:this.max,id:this._endInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,...this.props.endDateInputSettings,value:e.end,onChange:this.handleEndChange},C=i.createElement(P.Button,{type:"button",className:"k-select",fillMode:"flat",title:c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd]),onMouseDown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":s+" "+o,"aria-label":c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd])},i.createElement(r.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:O.arrowsSwapIcon}));return i.createElement(i.Fragment,null,i.createElement("span",{ref:y=>{this._element=y},className:m,style:this.props.style,id:this.props.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.tabIndex,onFocus:this.handleFocus,onClick:this.handleClick,onKeyDown:this.handleKeyDown,onBlur:this.mobileMode?void 0:this.handleBlur,dir:this.props.dir},this.props.startDateInput?i.createElement(this.props.startDateInput,{...f}):i.createElement(g.DateInput,{...f,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?C:S,this.props.endDateInput?i.createElement(this.props.endDateInput,{...v}):i.createElement(g.DateInput,{...v,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup())}focusDateInputElement(){if(!document||!this.startDateInput||!this.startDateInput.element||!this.endDateInput||!this.endDateInput.element)return;const a=r.getActiveElement(document);(this.value.start===null||this.value.end!==null)&&a!==this.endDateInput.element?this.startDateInput.element.focus({preventScroll:!0}):a!==this.startDateInput.element&&this.endDateInput.element.focus({preventScroll:!0})}nextTick(a){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>a())}setShow(a){const{onOpen:e,onClose:s}=this.props;this.show!==a&&(this.setState({show:a}),a&&e&&e.call(void 0,{target:this}),!a&&s&&s.call(void 0,{target:this}))}calculateMedia(a){for(let e of a)this.setState({windowWidth:e.target.clientWidth})}};l.displayName="DateRangePicker",l.propTypes={allowReverse:t.bool,calendarSettings:t.any,className:t.string,defaultShow:t.bool,defaultValue:t.shape({start:d.nullable(t.instanceOf(Date).isRequired),end:d.nullable(t.instanceOf(Date).isRequired)}),disabled:t.bool,endDateInputSettings:t.shape(g.DateInputWithoutContext.propTypes),focusedDate:t.instanceOf(Date),format:t.oneOfType([t.string,t.shape({skeleton:t.string,pattern:t.string,date:t.oneOf(["short","medium","long","full"]),time:t.oneOf(["short","medium","long","full"]),datetime:t.oneOf(["short","medium","long","full"]),era:t.oneOf(["narrow","short","long"]),year:t.oneOf(["numeric","2-digit"]),month:t.oneOf(["numeric","2-digit","narrow","short","long"]),day:t.oneOf(["numeric","2-digit"]),weekday:t.oneOf(["narrow","short","long"]),hour:t.oneOf(["numeric","2-digit"]),hour12:t.bool,minute:t.oneOf(["numeric","2-digit"]),second:t.oneOf(["numeric","2-digit"]),timeZoneName:t.oneOf(["short","long"])})]),id:t.string,ariaLabelledBy:t.string,ariaDescribedBy:t.string,max:t.instanceOf(Date),min:t.instanceOf(Date),onBlur:t.func,onChange:t.func,onFocus:t.func,popupSettings:t.any,show:t.bool,startDateInputSettings:t.any,style:t.any,swapButton:t.any,tabIndex:t.number,dir:t.string,value:t.shape({start:d.nullable(t.instanceOf(Date).isRequired),end:d.nullable(t.instanceOf(Date).isRequired)})},l.defaultProps={allowReverse:!1,defaultShow:!1,defaultValue:h.EMPTY_SELECTIONRANGE,disabled:!1,format:"d",max:d.MAX_DATE,min:d.MIN_DATE,swapButton:!1};let p=l;const I=r.createPropsContext(),w=r.withIdHOC(r.withPropsContext(I,p));w.displayName="KendoReactDateRangePicker";c.registerForLocalization(p);exports.DateRangePicker=w;exports.DateRangePickerPropsContext=I;exports.DateRangePickerWithoutContext=p;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),t=require("prop-types"),M=require("@progress/kendo-react-popup"),D=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),c=require("@progress/kendo-react-intl"),O=require("@progress/kendo-svg-icons"),k=require("../package-metadata.js"),g=require("../dateinput/DateInput.js"),T=require("../calendar/components/MultiViewCalendar.js"),h=require("../calendar/models/SelectionRange.js"),d=require("../utils.js"),x=require("../common/constants.js"),n=require("../messages/index.js"),P=require("@progress/kendo-react-buttons"),_=require("../common/AdaptiveMode.js"),N=require("@progress/kendo-react-layout");function A(u){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const e in u)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(u,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>u[e]})}}return a.default=u,Object.freeze(a)}const i=A(R),l=class l extends i.Component{constructor(a){super(a),this._element=null,this._calendar=null,this._startDateInput=i.createRef(),this._endDateInput=i.createRef(),this.shouldFocusDateInput=!1,this.shouldFocusCalendar=!1,this.focus=()=>{this.startDateInput&&this.startDateInput.focus()},this.setCalendarRef=e=>{this._calendar=e},this.focusCalendarElement=()=>{this._calendar&&this._calendar.element&&this._calendar.element.focus({preventScroll:!0})},this.calculateValue=(e,s)=>(e.value!==void 0?e.value:s.value)||h.EMPTY_SELECTIONRANGE,this.calculateShow=(e,s)=>e.show!==void 0?e.show:s.show,this.renderCalendar=()=>{const e=this.value||h.EMPTY_SELECTIONRANGE,s={min:this.min,max:this.max,allowReverse:this.props.allowReverse,mode:"range",focusedDate:this.props.focusedDate,disabled:this.props.disabled,className:this.mobileMode?"k-calendar-lg":"",mobileMode:this.mobileMode,...this.props.calendarSettings,value:e,dir:this.props.dir,onChange:this.handleCalendarChange};return this.props.calendar?i.createElement(this.props.calendar,{...s}):i.createElement(T.MultiViewCalendar,{...s,ref:this.setCalendarRef})},this.renderPopup=()=>{const e={popupClass:o.classNames("k-calendar-container","k-daterangepicker-popup"),animate:this._element!==null,anchor:this._element,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...this.props.popupSettings,show:this.show};return this.props.popup?i.createElement(this.props.popup,{...e},this.renderCalendar()):i.createElement(M.Popup,{...e},this.renderCalendar())},this.renderAdaptivePopup=()=>{const{windowWidth:e=0}=this.state,s={expand:this.show,onClose:r=>this.handleCancel(r),adaptiveTitle:this.props.adaptiveTitle,windowWidth:e,footer:{cancelText:this.localizationService.toLanguageString(n.dateRangePickerCancel,n.messages[n.dateRangePickerCancel]),onCancel:this.handleCancel,applyText:this.localizationService.toLanguageString(n.dateRangePickerSet,n.messages[n.dateRangePickerSet]),onApply:this.handleBlur}};return i.createElement(_.AdaptiveMode,{...s},i.createElement(N.ActionSheetContent,{className:"!k-overflow-hidden"},i.createElement("div",{className:"k-scrollable-wrap"},this.renderCalendar())))},this.handleReverseClick=e=>{const s={start:this.value.end,end:this.value.start},r={syntheticEvent:e,nativeEvent:e.nativeEvent};this.handleChange(s,r)},this.handleReverseMouseDown=e=>{e.preventDefault()},this.handleFocus=e=>{clearTimeout(this.nextTickId),this.shouldFocusDateInput||this.mobileMode&&this.setState({currentValue:this.value});const{onFocus:s}=this.props;s&&s.call(void 0,e)},this.handleClick=()=>{this.shouldFocusDateInput||this.setShow(!0)},this.handleBlur=e=>{this.nextTick(()=>{this.setShow(!1)});const{onBlur:s}=this.props;s&&s.call(void 0,e)},this.handleCancel=e=>{this.nextTick(()=>{this.setShow(!1),this.setState({currentValue:h.EMPTY_SELECTIONRANGE})});const{onCancel:s}=this.props;s&&s.call(void 0,e)},this.handleEndChange=e=>{const s={start:this.value.start,end:D.cloneDate(e.value||void 0)};this.handleChange(s,e)},this.handleStartChange=e=>{const s={start:D.cloneDate(e.value||void 0),end:this.value.end};this.handleChange(s,e)},this.extractRangeFromValue=e=>{if(!Array.isArray(e.value)&&!(e.value instanceof Date))return e.value||h.EMPTY_SELECTIONRANGE;const s=Array.isArray(e.value)?e.value[0]:e.value;return{start:this.value.end!==null?s:this.value.start,end:this.value.start!==null?s:this.value.end}},this.handleCalendarChange=e=>{const s=this.extractRangeFromValue(e);this.handleChange(s,e)},this.handleKeyDown=e=>{const{keyCode:s,altKey:r}=e;s===o.Keys.esc?(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1)):r&&s===o.Keys.down?(e.preventDefault(),this.shouldFocusCalendar=!0,this.setShow(!0),this.focusCalendarElement()):r&&s===o.Keys.up&&(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1))},this.handleChange=(e,s)=>{this.setState({value:e}),this.valueDuringOnChange=e;const{onChange:r}=this.props;if(r){const m={syntheticEvent:s.syntheticEvent,nativeEvent:s.nativeEvent,value:this.value,show:this.show,target:this};r.call(void 0,m)}this.valueDuringOnChange=void 0},o.validatePackage(k.packageMetadata),this.state={show:this.props.show||this.props.defaultShow||l.defaultProps.defaultShow,value:this.props.value||this.props.defaultValue||l.defaultProps.defaultValue,currentValue:h.EMPTY_SELECTIONRANGE},this.nextTick=this.nextTick.bind(this),this.setShow=this.setShow.bind(this),this.focusCalendarElement=this.focusCalendarElement.bind(this),this.focusDateInputElement=this.focusDateInputElement.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get _startInputId(){return this.props.id+"-start-input-id"}get _endInputId(){return this.props.id+"-end-input-id"}get element(){return this._element}get startDateInput(){return this._startDateInput.current}get endDateInput(){return this._endDateInput.current}get calendar(){return this._calendar}get value(){return(this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value)||h.EMPTY_SELECTIONRANGE}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get min(){return this.props.min!==void 0?this.props.min:l.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:l.defaultProps.max}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}get localizationService(){return c.provideLocalizationService(this)}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=x.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}componentDidMount(){var a;this.observerResize=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this.shouldFocusCalendar&&this.focusCalendarElement(),this.shouldFocusDateInput&&this.focusDateInputElement(),this.shouldFocusCalendar=!1,this.shouldFocusDateInput=!1}componentWillUnmount(){var a;clearTimeout(this.nextTickId),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.disconnect()}render(){const a=this.value||h.EMPTY_SELECTIONRANGE,e=this.mobileMode&&this.show?this.state.currentValue:a,s=(this.props.startDateInputSettings||{}).id||this._startInputId,r=(this.props.endDateInputSettings||{}).id||this._endInputId,m=o.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),b=this.localizationService.toLanguageString(n.start,n.messages[n.start]),E=this.localizationService.toLanguageString(n.end,n.messages[n.end]),S=this.localizationService.toLanguageString(n.separator,n.messages[n.separator]),f={disableSelection:this.mobileMode&&!0,label:b,format:this.props.format,min:this.min,max:this.max,id:this._startInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,...this.props.startDateInputSettings,value:e.start,onChange:this.handleStartChange},v={disableSelection:this.mobileMode&&!0,label:E,format:this.props.format,min:this.min,max:this.max,id:this._endInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,...this.props.endDateInputSettings,value:e.end,onChange:this.handleEndChange},C=i.createElement(P.Button,{type:"button",className:"k-select",fillMode:"flat",title:c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd]),onMouseDown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":s+" "+r,"aria-label":c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd])},i.createElement(o.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:O.arrowsSwapIcon}));return i.createElement(i.Fragment,null,i.createElement("span",{ref:y=>{this._element=y},className:m,style:this.props.style,id:this.props.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.tabIndex,onFocus:this.handleFocus,onClick:this.handleClick,onKeyDown:this.handleKeyDown,onBlur:this.mobileMode?void 0:this.handleBlur,dir:this.props.dir},this.props.startDateInput?i.createElement(this.props.startDateInput,{...f}):i.createElement(g.DateInput,{...f,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?C:S,this.props.endDateInput?i.createElement(this.props.endDateInput,{...v}):i.createElement(g.DateInput,{...v,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup())}focusDateInputElement(){if(!document||!this.startDateInput||!this.startDateInput.element||!this.endDateInput||!this.endDateInput.element)return;const a=o.getActiveElement(document);(this.value.start===null||this.value.end!==null)&&a!==this.endDateInput.element?this.startDateInput.element.focus({preventScroll:!0}):a!==this.startDateInput.element&&this.endDateInput.element.focus({preventScroll:!0})}nextTick(a){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>a())}setShow(a){const{onOpen:e,onClose:s}=this.props;this.show!==a&&(this.setState({show:a}),a&&e&&e.call(void 0,{target:this}),!a&&s&&s.call(void 0,{target:this}))}calculateMedia(a){for(let e of a)this.setState({windowWidth:e.target.clientWidth})}};l.displayName="DateRangePicker",l.propTypes={allowReverse:t.bool,calendarSettings:t.any,className:t.string,defaultShow:t.bool,defaultValue:t.shape({start:d.nullable(t.instanceOf(Date).isRequired),end:d.nullable(t.instanceOf(Date).isRequired)}),disabled:t.bool,endDateInputSettings:t.shape(g.DateInputWithoutContext.propTypes),focusedDate:t.instanceOf(Date),format:t.oneOfType([t.string,t.shape({skeleton:t.string,pattern:t.string,date:t.oneOf(["short","medium","long","full"]),time:t.oneOf(["short","medium","long","full"]),datetime:t.oneOf(["short","medium","long","full"]),era:t.oneOf(["narrow","short","long"]),year:t.oneOf(["numeric","2-digit"]),month:t.oneOf(["numeric","2-digit","narrow","short","long"]),day:t.oneOf(["numeric","2-digit"]),weekday:t.oneOf(["narrow","short","long"]),hour:t.oneOf(["numeric","2-digit"]),hour12:t.bool,minute:t.oneOf(["numeric","2-digit"]),second:t.oneOf(["numeric","2-digit"]),timeZoneName:t.oneOf(["short","long"])})]),id:t.string,ariaLabelledBy:t.string,ariaDescribedBy:t.string,max:t.instanceOf(Date),min:t.instanceOf(Date),onBlur:t.func,onChange:t.func,onFocus:t.func,popupSettings:t.any,show:t.bool,startDateInputSettings:t.any,style:t.any,swapButton:t.any,tabIndex:t.number,dir:t.string,value:t.shape({start:d.nullable(t.instanceOf(Date).isRequired),end:d.nullable(t.instanceOf(Date).isRequired)})},l.defaultProps={allowReverse:!1,defaultShow:!1,defaultValue:h.EMPTY_SELECTIONRANGE,disabled:!1,format:"d",max:d.MAX_DATE,min:d.MIN_DATE,swapButton:!1};let p=l;const I=o.createPropsContext(),w=o.withIdHOC(o.withPropsContext(I,p));w.displayName="KendoReactDateRangePicker";c.registerForLocalization(p);exports.DateRangePicker=w;exports.DateRangePickerPropsContext=I;exports.DateRangePickerWithoutContext=p;
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as i from "react";
|
|
10
10
|
import e from "prop-types";
|
|
11
|
-
import { Popup as
|
|
11
|
+
import { Popup as T } from "@progress/kendo-react-popup";
|
|
12
12
|
import { cloneDate as v } from "@progress/kendo-date-math";
|
|
13
|
-
import {
|
|
13
|
+
import { classNames as D, Keys as c, validatePackage as _, canUseDOM as I, IconWrap as P, getActiveElement as F, createPropsContext as z, withIdHOC as A, withPropsContext as B } from "@progress/kendo-react-common";
|
|
14
14
|
import { provideLocalizationService as m, registerForLocalization as N } from "@progress/kendo-react-intl";
|
|
15
15
|
import { arrowsSwapIcon as L } from "@progress/kendo-svg-icons";
|
|
16
16
|
import { packageMetadata as V } from "../package-metadata.mjs";
|
|
17
|
-
import { DateInputWithoutContext as K, DateInput as
|
|
17
|
+
import { DateInputWithoutContext as K, DateInput as w } from "../dateinput/DateInput.mjs";
|
|
18
18
|
import { MultiViewCalendar as U } from "../calendar/components/MultiViewCalendar.mjs";
|
|
19
19
|
import { EMPTY_SELECTIONRANGE as r } from "../calendar/models/SelectionRange.mjs";
|
|
20
20
|
import { nullable as h, MAX_DATE as q, MIN_DATE as W } from "../utils.mjs";
|
|
21
21
|
import { MOBILE_MEDIUM_DEVISE as G } from "../common/constants.mjs";
|
|
22
|
-
import { dateRangePickerCancel as
|
|
22
|
+
import { dateRangePickerCancel as b, messages as l, dateRangePickerSet as C, start as S, end as E, separator as y, swapStartEnd as d } from "../messages/index.mjs";
|
|
23
23
|
import { Button as H } from "@progress/kendo-react-buttons";
|
|
24
24
|
import { AdaptiveMode as X } from "../common/AdaptiveMode.mjs";
|
|
25
25
|
import { ActionSheetContent as Y } from "@progress/kendo-react-layout";
|
|
@@ -49,7 +49,7 @@ const o = class o extends i.Component {
|
|
|
49
49
|
return this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { ...s }) : /* @__PURE__ */ i.createElement(U, { ...s, ref: this.setCalendarRef });
|
|
50
50
|
}, this.renderPopup = () => {
|
|
51
51
|
const t = {
|
|
52
|
-
popupClass: "k-daterangepicker-popup",
|
|
52
|
+
popupClass: D("k-calendar-container", "k-daterangepicker-popup"),
|
|
53
53
|
animate: this._element !== null,
|
|
54
54
|
anchor: this._element,
|
|
55
55
|
id: this._popupId,
|
|
@@ -64,7 +64,7 @@ const o = class o extends i.Component {
|
|
|
64
64
|
...this.props.popupSettings,
|
|
65
65
|
show: this.show
|
|
66
66
|
};
|
|
67
|
-
return this.props.popup ? /* @__PURE__ */ i.createElement(this.props.popup, { ...t }, this.renderCalendar()) : /* @__PURE__ */ i.createElement(
|
|
67
|
+
return this.props.popup ? /* @__PURE__ */ i.createElement(this.props.popup, { ...t }, this.renderCalendar()) : /* @__PURE__ */ i.createElement(T, { ...t }, this.renderCalendar());
|
|
68
68
|
}, this.renderAdaptivePopup = () => {
|
|
69
69
|
const { windowWidth: t = 0 } = this.state, s = {
|
|
70
70
|
expand: this.show,
|
|
@@ -72,9 +72,9 @@ const o = class o extends i.Component {
|
|
|
72
72
|
adaptiveTitle: this.props.adaptiveTitle,
|
|
73
73
|
windowWidth: t,
|
|
74
74
|
footer: {
|
|
75
|
-
cancelText: this.localizationService.toLanguageString(
|
|
75
|
+
cancelText: this.localizationService.toLanguageString(b, l[b]),
|
|
76
76
|
onCancel: this.handleCancel,
|
|
77
|
-
applyText: this.localizationService.toLanguageString(
|
|
77
|
+
applyText: this.localizationService.toLanguageString(C, l[C]),
|
|
78
78
|
onApply: this.handleBlur
|
|
79
79
|
}
|
|
80
80
|
};
|
|
@@ -148,7 +148,7 @@ const o = class o extends i.Component {
|
|
|
148
148
|
n.call(void 0, u);
|
|
149
149
|
}
|
|
150
150
|
this.valueDuringOnChange = void 0;
|
|
151
|
-
},
|
|
151
|
+
}, _(V), this.state = {
|
|
152
152
|
show: this.props.show || this.props.defaultShow || o.defaultProps.defaultShow,
|
|
153
153
|
value: this.props.value || this.props.defaultValue || o.defaultProps.defaultValue,
|
|
154
154
|
currentValue: r
|
|
@@ -206,7 +206,7 @@ const o = class o extends i.Component {
|
|
|
206
206
|
return this.props.max !== void 0 ? this.props.max : o.defaultProps.max;
|
|
207
207
|
}
|
|
208
208
|
get document() {
|
|
209
|
-
if (
|
|
209
|
+
if (I)
|
|
210
210
|
return this.element && this.element.ownerDocument || document;
|
|
211
211
|
}
|
|
212
212
|
get localizationService() {
|
|
@@ -223,7 +223,7 @@ const o = class o extends i.Component {
|
|
|
223
223
|
*/
|
|
224
224
|
componentDidMount() {
|
|
225
225
|
var a;
|
|
226
|
-
this.observerResize =
|
|
226
|
+
this.observerResize = I && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.show && this.forceUpdate(), (a = this.document) != null && a.body && this.observerResize && this.observerResize.observe(this.document.body);
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* @hidden
|
|
@@ -242,15 +242,15 @@ const o = class o extends i.Component {
|
|
|
242
242
|
* @hidden
|
|
243
243
|
*/
|
|
244
244
|
render() {
|
|
245
|
-
const a = this.value || r, t = this.mobileMode && this.show ? this.state.currentValue : a, s = (this.props.startDateInputSettings || {}).id || this._startInputId, n = (this.props.endDateInputSettings || {}).id || this._endInputId, u =
|
|
245
|
+
const a = this.value || r, t = this.mobileMode && this.show ? this.state.currentValue : a, s = (this.props.startDateInputSettings || {}).id || this._startInputId, n = (this.props.endDateInputSettings || {}).id || this._endInputId, u = D(
|
|
246
246
|
"k-daterangepicker",
|
|
247
247
|
{
|
|
248
248
|
"k-disabled": this.props.disabled
|
|
249
249
|
},
|
|
250
250
|
this.props.className
|
|
251
|
-
),
|
|
251
|
+
), x = this.localizationService.toLanguageString(S, l[S]), R = this.localizationService.toLanguageString(E, l[E]), M = this.localizationService.toLanguageString(y, l[y]), f = {
|
|
252
252
|
disableSelection: this.mobileMode && !0,
|
|
253
|
-
label:
|
|
253
|
+
label: x,
|
|
254
254
|
format: this.props.format,
|
|
255
255
|
min: this.min,
|
|
256
256
|
max: this.max,
|
|
@@ -264,7 +264,7 @@ const o = class o extends i.Component {
|
|
|
264
264
|
onChange: this.handleStartChange
|
|
265
265
|
}, g = {
|
|
266
266
|
disableSelection: this.mobileMode && !0,
|
|
267
|
-
label:
|
|
267
|
+
label: R,
|
|
268
268
|
format: this.props.format,
|
|
269
269
|
min: this.min,
|
|
270
270
|
max: this.max,
|
|
@@ -276,7 +276,7 @@ const o = class o extends i.Component {
|
|
|
276
276
|
...this.props.endDateInputSettings,
|
|
277
277
|
value: t.end,
|
|
278
278
|
onChange: this.handleEndChange
|
|
279
|
-
},
|
|
279
|
+
}, O = /* @__PURE__ */ i.createElement(
|
|
280
280
|
H,
|
|
281
281
|
{
|
|
282
282
|
type: "button",
|
|
@@ -293,8 +293,8 @@ const o = class o extends i.Component {
|
|
|
293
293
|
return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
|
|
294
294
|
"span",
|
|
295
295
|
{
|
|
296
|
-
ref: (
|
|
297
|
-
this._element =
|
|
296
|
+
ref: (k) => {
|
|
297
|
+
this._element = k;
|
|
298
298
|
},
|
|
299
299
|
className: u,
|
|
300
300
|
style: this.props.style,
|
|
@@ -309,7 +309,7 @@ const o = class o extends i.Component {
|
|
|
309
309
|
dir: this.props.dir
|
|
310
310
|
},
|
|
311
311
|
this.props.startDateInput ? /* @__PURE__ */ i.createElement(this.props.startDateInput, { ...f }) : /* @__PURE__ */ i.createElement(
|
|
312
|
-
|
|
312
|
+
w,
|
|
313
313
|
{
|
|
314
314
|
...f,
|
|
315
315
|
ref: this._startDateInput,
|
|
@@ -318,9 +318,9 @@ const o = class o extends i.Component {
|
|
|
318
318
|
readonly: this.mobileMode
|
|
319
319
|
}
|
|
320
320
|
),
|
|
321
|
-
(this.props.allowReverse || this.props.calendarSettings && this.props.calendarSettings.allowReverse) && this.props.swapButton ?
|
|
321
|
+
(this.props.allowReverse || this.props.calendarSettings && this.props.calendarSettings.allowReverse) && this.props.swapButton ? O : M,
|
|
322
322
|
this.props.endDateInput ? /* @__PURE__ */ i.createElement(this.props.endDateInput, { ...g }) : /* @__PURE__ */ i.createElement(
|
|
323
|
-
|
|
323
|
+
w,
|
|
324
324
|
{
|
|
325
325
|
...g,
|
|
326
326
|
ref: this._endDateInput,
|