@progress/kendo-react-dateinputs 5.13.0-dev.202303301815 → 5.13.0-dev.202304110959
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/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/dist/es/calendar/components/Calendar.js +1 -1
- package/dist/es/common/AdaptiveMode.d.ts +14 -0
- package/dist/es/common/AdaptiveMode.js +38 -0
- package/dist/es/common/constants.d.ts +4 -0
- package/dist/es/common/constants.js +4 -0
- package/dist/es/datepicker/DatePicker.d.ts +20 -0
- package/dist/es/datepicker/DatePicker.js +102 -34
- package/dist/es/package-metadata.js +1 -1
- package/dist/npm/calendar/components/Calendar.js +1 -1
- package/dist/npm/common/AdaptiveMode.d.ts +14 -0
- package/dist/npm/common/AdaptiveMode.js +42 -0
- package/dist/npm/common/constants.d.ts +4 -0
- package/dist/npm/common/constants.js +7 -0
- package/dist/npm/datepicker/DatePicker.d.ts +20 -0
- package/dist/npm/datepicker/DatePicker.js +101 -33
- package/dist/npm/package-metadata.js +1 -1
- package/dist/systemjs/kendo-react-dateinputs.js +1 -1
- package/package.json +13 -12
|
@@ -54,6 +54,9 @@ var kendo_react_intl_1 = require("@progress/kendo-react-intl");
|
|
|
54
54
|
var ToggleButton_1 = require("./ToggleButton");
|
|
55
55
|
var PickerWrap_1 = require("../common/PickerWrap");
|
|
56
56
|
var usePickerFloatingLabel_1 = require("../hooks/usePickerFloatingLabel");
|
|
57
|
+
var kendo_react_layout_1 = require("@progress/kendo-react-layout");
|
|
58
|
+
var AdaptiveMode_1 = require("../common/AdaptiveMode");
|
|
59
|
+
var constants_1 = require("../common/constants");
|
|
57
60
|
/** @hidden */
|
|
58
61
|
var DatePickerWithoutContext = /** @class */ (function (_super) {
|
|
59
62
|
__extends(DatePickerWithoutContext, _super);
|
|
@@ -86,6 +89,46 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
86
89
|
? nextProps.show
|
|
87
90
|
: nextState.show;
|
|
88
91
|
};
|
|
92
|
+
_this.renderPopup = function () {
|
|
93
|
+
var _a = _this.props, disabled = _a.disabled, min = _a.min, max = _a.max, weekNumber = _a.weekNumber, focusedDate = _a.focusedDate;
|
|
94
|
+
var _b = _this.props.popupSettings, popupClass = _b.popupClass, otherPopupSettings = __rest(_b, ["popupClass"]);
|
|
95
|
+
var show = _this.show;
|
|
96
|
+
var value = _this.value;
|
|
97
|
+
var sanitizedValue = value && (0, kendo_date_math_1.getDate)(value);
|
|
98
|
+
var popupClassNames = (0, kendo_react_common_1.classNames)('k-calendar-container k-group k-reset', popupClass);
|
|
99
|
+
var popupProps = __assign({ popupClass: 'k-datepicker-popup', show: show, anchor: _this._element, className: popupClassNames, id: _this._popupId, anchorAlign: {
|
|
100
|
+
horizontal: 'left',
|
|
101
|
+
vertical: 'bottom'
|
|
102
|
+
}, popupAlign: {
|
|
103
|
+
horizontal: 'left',
|
|
104
|
+
vertical: 'top'
|
|
105
|
+
} }, otherPopupSettings);
|
|
106
|
+
var calendarProps = {
|
|
107
|
+
disabled: disabled,
|
|
108
|
+
value: sanitizedValue,
|
|
109
|
+
min: min,
|
|
110
|
+
max: max,
|
|
111
|
+
weekNumber: weekNumber,
|
|
112
|
+
focusedDate: focusedDate,
|
|
113
|
+
onChange: _this.handleCalendarValueChange
|
|
114
|
+
};
|
|
115
|
+
if (_this.mobileMode) {
|
|
116
|
+
return React.createElement(_this.calendarComp, __assign({ _ref: _this.setCalendarRef }, calendarProps));
|
|
117
|
+
}
|
|
118
|
+
return (React.createElement(_this.popupComp, __assign({}, popupProps),
|
|
119
|
+
React.createElement(_this.calendarComp, __assign({ _ref: _this.setCalendarRef }, calendarProps))));
|
|
120
|
+
};
|
|
121
|
+
_this.renderAdaptivePopup = function () {
|
|
122
|
+
var _a = _this.state.windowWidth, windowWidth = _a === void 0 ? 0 : _a;
|
|
123
|
+
var actionSheetProps = {
|
|
124
|
+
expand: _this.show,
|
|
125
|
+
onClose: _this.handleBlur,
|
|
126
|
+
adaptiveTitle: _this.props.adaptiveTitle,
|
|
127
|
+
windowWidth: windowWidth
|
|
128
|
+
};
|
|
129
|
+
return (React.createElement(AdaptiveMode_1.AdaptiveMode, __assign({}, actionSheetProps),
|
|
130
|
+
React.createElement(kendo_react_layout_1.ActionSheetContent, { className: '!k-overflow-hidden' }, _this.renderPopup())));
|
|
131
|
+
};
|
|
89
132
|
_this.handleInputValueChange = function (event) {
|
|
90
133
|
_this.handleValueChange(event.value, event);
|
|
91
134
|
};
|
|
@@ -153,6 +196,17 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
153
196
|
};
|
|
154
197
|
return _this;
|
|
155
198
|
}
|
|
199
|
+
Object.defineProperty(DatePickerWithoutContext.prototype, "document", {
|
|
200
|
+
get: function () {
|
|
201
|
+
if (!kendo_react_common_1.canUseDOM) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
// useful only for user actions
|
|
205
|
+
return (this.element && this.element.ownerDocument) || document;
|
|
206
|
+
},
|
|
207
|
+
enumerable: false,
|
|
208
|
+
configurable: true
|
|
209
|
+
});
|
|
156
210
|
Object.defineProperty(DatePickerWithoutContext.prototype, "element", {
|
|
157
211
|
/**
|
|
158
212
|
* Gets the wrapping element of the DatePickerWithoutContext.
|
|
@@ -163,6 +217,17 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
163
217
|
enumerable: false,
|
|
164
218
|
configurable: true
|
|
165
219
|
});
|
|
220
|
+
Object.defineProperty(DatePickerWithoutContext.prototype, "mobileMode", {
|
|
221
|
+
/**
|
|
222
|
+
* The mobile mode of the DatePicker.
|
|
223
|
+
*/
|
|
224
|
+
get: function () {
|
|
225
|
+
var isAdaptive = this.state.windowWidth && this.state.windowWidth <= constants_1.MOBILE_MEDIUM_DEVISE && this.props.adaptive;
|
|
226
|
+
return !!isAdaptive;
|
|
227
|
+
},
|
|
228
|
+
enumerable: false,
|
|
229
|
+
configurable: true
|
|
230
|
+
});
|
|
166
231
|
Object.defineProperty(DatePickerWithoutContext.prototype, "dateInput", {
|
|
167
232
|
/**
|
|
168
233
|
* Gets the DateInput component inside the DatePicker component.
|
|
@@ -323,10 +388,15 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
323
388
|
* @hidden
|
|
324
389
|
*/
|
|
325
390
|
DatePickerWithoutContext.prototype.componentDidMount = function () {
|
|
391
|
+
var _a;
|
|
392
|
+
this.observerResize = kendo_react_common_1.canUseDOM && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this));
|
|
326
393
|
if (this.show) {
|
|
327
394
|
// If defaultShow is true during the initial render, the popup is not aligned.
|
|
328
395
|
this.forceUpdate();
|
|
329
396
|
}
|
|
397
|
+
if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
|
|
398
|
+
this.observerResize.observe(this.document.body);
|
|
399
|
+
}
|
|
330
400
|
};
|
|
331
401
|
/**
|
|
332
402
|
* @hidden
|
|
@@ -348,20 +418,23 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
348
418
|
* @hidden
|
|
349
419
|
*/
|
|
350
420
|
DatePickerWithoutContext.prototype.componentWillUnmount = function () {
|
|
421
|
+
var _a;
|
|
351
422
|
clearTimeout(this.nextTickId);
|
|
423
|
+
if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
|
|
424
|
+
this.observerResize.disconnect();
|
|
425
|
+
}
|
|
352
426
|
};
|
|
353
427
|
/**
|
|
354
428
|
* @hidden
|
|
355
429
|
*/
|
|
356
430
|
DatePickerWithoutContext.prototype.render = function () {
|
|
357
431
|
var _this = this;
|
|
358
|
-
var _a = this.props, _b = _a.size, size = _b === void 0 ? DatePickerWithoutContext.defaultProps.size : _b, _c = _a.rounded, rounded = _c === void 0 ? DatePickerWithoutContext.defaultProps.rounded : _c, _d = _a.fillMode, fillMode = _d === void 0 ? DatePickerWithoutContext.defaultProps.fillMode : _d, disabled = _a.disabled, tabIndex = _a.tabIndex, title = _a.title, id = _a.id, format = _a.format, formatPlaceholder = _a.formatPlaceholder, min = _a.min, max = _a.max,
|
|
359
|
-
var _e = this.
|
|
432
|
+
var _a = this.props, _b = _a.size, size = _b === void 0 ? DatePickerWithoutContext.defaultProps.size : _b, _c = _a.rounded, rounded = _c === void 0 ? DatePickerWithoutContext.defaultProps.rounded : _c, _d = _a.fillMode, fillMode = _d === void 0 ? DatePickerWithoutContext.defaultProps.fillMode : _d, disabled = _a.disabled, tabIndex = _a.tabIndex, title = _a.title, id = _a.id, format = _a.format, formatPlaceholder = _a.formatPlaceholder, min = _a.min, max = _a.max, className = _a.className, width = _a.width, name = _a.name, validationMessage = _a.validationMessage, required = _a.required, validityStyles = _a.validityStyles, ariaLabelledBy = _a.ariaLabelledBy, ariaDescribedBy = _a.ariaDescribedBy, ariaLabel = _a.ariaLabel, adaptive = _a.adaptive;
|
|
433
|
+
var _e = this.state.windowWidth, windowWidth = _e === void 0 ? 0 : _e;
|
|
360
434
|
var show = this.show;
|
|
361
435
|
var value = this.value;
|
|
362
|
-
var sanitizedValue = value && (0, kendo_date_math_1.getDate)(value);
|
|
363
436
|
var isValid = !this.validityStyles || this.validity.valid;
|
|
364
|
-
var
|
|
437
|
+
var renderAdaptive = windowWidth <= constants_1.MOBILE_MEDIUM_DEVISE && adaptive;
|
|
365
438
|
var dateInputProps = {
|
|
366
439
|
disabled: disabled,
|
|
367
440
|
format: format,
|
|
@@ -388,39 +461,24 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
388
461
|
fillMode: null,
|
|
389
462
|
rounded: null
|
|
390
463
|
};
|
|
391
|
-
var popupProps = __assign({ popupClass: 'k-datepicker-popup', show: show, anchor: this._element, className: popupClassNames, id: this._popupId, anchorAlign: {
|
|
392
|
-
horizontal: 'left',
|
|
393
|
-
vertical: 'bottom'
|
|
394
|
-
}, popupAlign: {
|
|
395
|
-
horizontal: 'left',
|
|
396
|
-
vertical: 'top'
|
|
397
|
-
} }, otherPopupSettings);
|
|
398
|
-
var calendarProps = {
|
|
399
|
-
disabled: disabled,
|
|
400
|
-
value: sanitizedValue,
|
|
401
|
-
min: min,
|
|
402
|
-
max: max,
|
|
403
|
-
weekNumber: weekNumber,
|
|
404
|
-
focusedDate: focusedDate,
|
|
405
|
-
onChange: this.handleCalendarValueChange
|
|
406
|
-
};
|
|
407
464
|
var toggleButtonTitle = (0, kendo_react_intl_1.provideLocalizationService)(this)
|
|
408
465
|
.toLanguageString(messages_1.toggleCalendar, messages_1.messages[messages_1.toggleCalendar]);
|
|
409
466
|
var datepicker = (React.createElement(kendo_react_common_1.AsyncFocusBlur, { onFocus: this.handleFocus, onBlur: this.handleBlur, onSyncBlur: this.props.onBlur, onSyncFocus: this.props.onFocus }, function (_a) {
|
|
410
467
|
var _b;
|
|
411
468
|
var onFocus = _a.onFocus, onBlur = _a.onBlur;
|
|
412
|
-
return (React.createElement(
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
469
|
+
return (React.createElement(React.Fragment, null,
|
|
470
|
+
React.createElement("span", { ref: function (span) { _this._element = span; }, className: (0, kendo_react_common_1.classNames)('k-input', 'k-datepicker', (_b = {},
|
|
471
|
+
_b["k-input-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
472
|
+
_b["k-rounded-".concat(kendo_react_common_1.kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
|
|
473
|
+
_b["k-input-".concat(fillMode)] = fillMode,
|
|
474
|
+
_b['k-invalid'] = !isValid,
|
|
475
|
+
_b['k-required'] = _this.required,
|
|
476
|
+
_b['k-disabled'] = _this.props.disabled,
|
|
477
|
+
_b), className), onKeyDown: _this.handleKeyDown, style: { width: width }, onFocus: onFocus, onBlur: onBlur },
|
|
478
|
+
React.createElement(_this.dateInputComp, __assign({ _ref: _this._dateInput, ariaRole: 'combobox', ariaExpanded: _this.show, ariaControls: _this._popupId }, dateInputProps)),
|
|
479
|
+
React.createElement(_this.toggleButtonComp, { type: "button", icon: "calendar", svgIcon: kendo_svg_icons_1.calendarIcon, title: toggleButtonTitle, className: "k-input-button", rounded: null, onClick: _this.handleIconClick, "aria-label": toggleButtonTitle, onMouseDown: _this.handleIconMouseDown }),
|
|
480
|
+
!renderAdaptive && _this.renderPopup()),
|
|
481
|
+
renderAdaptive && _this.renderAdaptivePopup()));
|
|
424
482
|
}));
|
|
425
483
|
return this.props.label
|
|
426
484
|
? (React.createElement(usePickerFloatingLabel_1.PickerFloatingLabel, { dateInput: this._dateInput, label: this.props.label, editorId: id, editorValid: isValid, editorDisabled: this.props.disabled, children: datepicker, style: { width: this.props.width } }))
|
|
@@ -442,6 +500,14 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
442
500
|
clearTimeout(this.nextTickId);
|
|
443
501
|
this.nextTickId = window.setTimeout(function () { return f(); });
|
|
444
502
|
};
|
|
503
|
+
DatePickerWithoutContext.prototype.calculateMedia = function (entries) {
|
|
504
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
505
|
+
var entry = entries_1[_i];
|
|
506
|
+
this.setState({ windowWidth: entry.target.clientWidth });
|
|
507
|
+
}
|
|
508
|
+
;
|
|
509
|
+
};
|
|
510
|
+
;
|
|
445
511
|
/**
|
|
446
512
|
* @hidden
|
|
447
513
|
*/
|
|
@@ -510,7 +576,9 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
|
|
|
510
576
|
valid: PropTypes.bool,
|
|
511
577
|
size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
|
|
512
578
|
rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
|
|
513
|
-
fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline'])
|
|
579
|
+
fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline']),
|
|
580
|
+
adaptive: PropTypes.bool,
|
|
581
|
+
adaptiveTitle: PropTypes.string
|
|
514
582
|
};
|
|
515
583
|
/**
|
|
516
584
|
* @hidden
|
|
@@ -8,7 +8,7 @@ exports.packageMetadata = {
|
|
|
8
8
|
name: '@progress/kendo-react-dateinputs',
|
|
9
9
|
productName: 'KendoReact',
|
|
10
10
|
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
11
|
-
publishDate:
|
|
11
|
+
publishDate: 1681205843,
|
|
12
12
|
version: '',
|
|
13
13
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
14
14
|
};
|